📄 trafo.c
字号:
/*Copyright (c) 2000, Red Hat, Inc.This file is part of Source-Navigator.Source-Navigator is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public License as publishedby the Free Software Foundation; either version 2, or (at your option)any later version.Source-Navigator is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public License alongwith Source-Navigator; see the file COPYING. If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330, Boston,MA 02111-1307, USA.*/#include "Trafo.h"#ifdef __cplusplusextern "C" {#include "General.h"#include "rSystem.h"}#else#include "General.h"#include "rSystem.h"#endif#include <stdio.h>#include "Tree.h"#define yyInline#ifndef NULL#define NULL 0L#endif#ifndef rfalse#define rfalse 0#endif#ifndef rtrue#define rtrue 1#endif#ifdef yyInline#define yyALLOC(tree, free, start, alloc, type, make, ptr, kind, init) \ ptr = (free -= yyAlignedSize (sizeof (type))) >= start ? \ (tree) free : alloc (sizeof (type)); \ init (ptr, kind);#else#define yyALLOC(tree, free, start, alloc, type, make, ptr, kind, init) \ ptr = make (kind);#endif/* line 5 "java.puma" */#include "Reuse.h"#include "StringM.h"#include "Idents.h"#include "Parser.h"#include "deftab.h"#include "sn.h"#define null (char *) NULLstatic char * p;static char * cur_class_ptr ;static char * cur_method_ptr ;static char * cur_arg_types_ptr;static char cur_arg_types [256];static char ref_class [256], ref_sym [256], ref_arg_types [256];static int acc = PAF_REF_READ;static short no_of_args = -1;#ifndef yyWrite#define yyWrite(s) (void) fputs (s, yyf)#endif#ifndef yyWriteNl#define yyWriteNl (void) fputc ('\n', yyf)#endif#include "yyTrafo.h"static void yyExit ARGS ((void)) { rExit (1); }void (* Trafo_Exit) ARGS ((void)) = yyExit;#ifdef UNIXstatic FILE * yyf = stdout;#elsestatic FILE * yyf;#endifstatic void yyAbort#ifdef __cplusplus (char * yyFunction)#else (yyFunction) char * yyFunction;#endif{ (void) fprintf (stderr, "Error: module Trafo, routine %s failed\n", yyFunction); Trafo_Exit ();}void to_types ARGS ((tTree yyP2, tString yyP1));static void get_types ARGS ((tTree yyP3));void to_names ARGS ((tTree yyP5, tString yyP4));static void get_names ARGS ((tTree yyP6));void to_files ARGS ((tTree yyP8, tString yyP7));static void get_files ARGS ((tTree yyP9));static void get_separator ARGS ((tTree yyP10));tTree get_objects ARGS ((tTree t, tTree o));static void use_object ARGS ((tTree yyP11));static tString get_class_name ARGS ((tTree yyP12));static tString get_class_name_2 ARGS ((tTree yyP13));static tTree get_current_class ARGS ((tTree yyP14));static void Tsuperclass ARGS ((tTree yyP15));void Traverse ARGS ((tTree yyP16));static void Tqualification ARGS ((tTree yyP17));static void Tclass ARGS ((tTree yyP18));static void Texception ARGS ((tTree yyP19));static tTree Tidentify ARGS ((tTree yyP20));void to_types#if defined __STDC__ | defined __cplusplus(register tTree yyP2, register tString yyP1)#else(yyP2, yyP1) register tTree yyP2; register tString yyP1;#endif{/* line 27 "java.puma" */ {/* line 27 "java.puma" */ p = yyP1;/* line 27 "java.puma" */ get_types (yyP2);/* line 27 "java.puma" */ * p = '\0'; } return;;}static void get_types#if defined __STDC__ | defined __cplusplus(register tTree yyP3)#else(yyP3) register tTree yyP3;#endif{ yyRecursion: if (yyP3->Kind == kparameter) {/* line 31 "java.puma" */ {/* line 32 "java.puma" */ get_types (yyP3->parameter.type);/* line 33 "java.puma" */ get_types (yyP3->parameter.array);/* line 34 "java.puma" */ get_separator (yyP3->parameter.next);/* line 35 "java.puma" */ yyP3 = yyP3->parameter.next; goto yyRecursion; } } if (yyP3->Kind == ksimple_type) {/* line 37 "java.puma" */ {/* line 38 "java.puma" */ strcpy (p, types [yyP3->simple_type.type]);/* line 38 "java.puma" */ p = p + strlen (types [yyP3->simple_type.type]); } return; } if (yyP3->Kind == knamed_type) {/* line 40 "java.puma" */ {/* line 41 "java.puma" */ yyP3 = yyP3->named_type.qualified_symbol; goto yyRecursion; } } if (yyP3->Kind == karray_type) {/* line 43 "java.puma" */ {/* line 44 "java.puma" */ get_types (yyP3->array_type.type);/* line 45 "java.puma" */ strcpy (p, "[]");/* line 45 "java.puma" */ p = p + 2; } return; } if (yyP3->Kind == kqualification) {/* line 47 "java.puma" */ {/* line 48 "java.puma" */ get_types (yyP3->qualification.qualified_symbol);/* line 49 "java.puma" */ * p ++ = '.';/* line 50 "java.puma" */ GetString (yyP3->qualification.ident, p);/* line 50 "java.puma" */ p = p + LengthSt (GetStringRef (yyP3->qualification.ident)); } return; } if (yyP3->Kind == kident) {/* line 52 "java.puma" */ {/* line 53 "java.puma" */ GetString (yyP3->ident.ident, p);/* line 53 "java.puma" */ p = p + LengthSt (GetStringRef (yyP3->ident.ident)); } return; };}void to_names#if defined __STDC__ | defined __cplusplus(register tTree yyP5, register tString yyP4)#else(yyP5, yyP4) register tTree yyP5; register tString yyP4;#endif{/* line 58 "java.puma" */ {/* line 58 "java.puma" */ p = yyP4;/* line 58 "java.puma" */ get_names (yyP5);/* line 58 "java.puma" */ * p = '\0'; } return;;}static void get_names#if defined __STDC__ | defined __cplusplus(register tTree yyP6)#else(yyP6) register tTree yyP6;#endif{ yyRecursion: if (yyP6->Kind == kparameter) {/* line 62 "java.puma" */ {/* line 63 "java.puma" */ GetString (yyP6->parameter.ident, p);/* line 63 "java.puma" */ p = p + LengthSt (GetStringRef (yyP6->parameter.ident));/* line 64 "java.puma" */ get_separator (yyP6->parameter.next);/* line 65 "java.puma" */ yyP6 = yyP6->parameter.next; goto yyRecursion; } };}void to_files#if defined __STDC__ | defined __cplusplus(register tTree yyP8, register tString yyP7)#else(yyP8, yyP7) register tTree yyP8; register tString yyP7;#endif{/* line 70 "java.puma" */ {/* line 70 "java.puma" */ p = yyP7;/* line 70 "java.puma" */ get_files (yyP8);/* line 70 "java.puma" */ * p = '\0'; } return;;}static void get_files#if defined __STDC__ | defined __cplusplus(register tTree yyP9)#else(yyP9) register tTree yyP9;#endif{ if (yyP9->Kind == kqualification) {/* line 74 "java.puma" */ {/* line 75 "java.puma" */ get_files (yyP9->qualification.qualified_symbol);/* line 76 "java.puma" */ * p ++ = '/';/* line 77 "java.puma" */ GetString (yyP9->qualification.ident, p);/* line 77 "java.puma" */ p = p + LengthSt (GetStringRef (yyP9->qualification.ident)); } return; } if (yyP9->Kind == kident) {/* line 79 "java.puma" */ {/* line 80 "java.puma" */ GetString (yyP9->ident.ident, p);/* line 80 "java.puma" */ p = p + LengthSt (GetStringRef (yyP9->ident.ident)); } return; };}static void get_separator#if defined __STDC__ | defined __cplusplus(register tTree yyP10)#else(yyP10) register tTree yyP10;#endif{ if (yyP10->Kind == kparameter) {/* line 85 "java.puma" */ {/* line 85 "java.puma" */ * p ++ = ','; } return; };}tTree get_objects#if defined __STDC__ | defined __cplusplus(register tTree t, register tTree o)#else(t, o) register tTree t; register tTree o;#endif{ yyRecursion: switch (t->Kind) { case kimport_asterisk:/* line 91 "java.puma" */ t = t->import_asterisk.next; goto yyRecursion; case kimport:/* line 94 "java.puma" */ return get_objects (t->import.next, get_objects (t->import.qualified_symbol, o)); case knoimport:/* line 97 "java.puma" */ return o; case kqualification:/* line 100 "java.puma" */ { { register tTree yyV1; yyALLOC (tTree,Tree_PoolFreePtr,Tree_PoolStartPtr, Tree_Alloc,yobject,MakeTree,yyV1,kobject,Tree_InitHead) yyV1->object.object = t; yyV1->object.ident = t->qualification.ident; yyV1->object.next = o; begintTree (yyV1->object.collision) return yyV1; } } case kident:/* line 103 "java.puma" */ { { register tTree yyV1; yyALLOC (tTree,Tree_PoolFreePtr,Tree_PoolStartPtr, Tree_Alloc,yobject,MakeTree,yyV1,kobject,Tree_InitHead) yyV1->object.object = t; yyV1->object.ident = t->ident.ident; yyV1->object.next = o; begintTree (yyV1->object.collision) return yyV1; } } case ktype_decl: case kclass: case kinterface:/* line 106 "java.puma" */ { { register tTree yyV1; yyALLOC (tTree,Tree_PoolFreePtr,Tree_PoolStartPtr, Tree_Alloc,yobject,MakeTree,yyV1,kobject,Tree_InitHead) yyV1->object.object = t; yyV1->object.ident = t->type_decl.ident; yyV1->object.next = o; begintTree (yyV1->object.collision) return get_objects (t->type_decl.next, yyV1); } } case kfunction: case kmethod: case kconstructor:/* line 109 "java.puma" */ { { register tTree yyV1; yyALLOC (tTree,Tree_PoolFreePtr,Tree_PoolStartPtr, Tree_Alloc,yobject,MakeTree,yyV1,kobject,Tree_InitHead) yyV1->object.object = t; yyV1->object.ident = t->function.ident; yyV1->object.next = o; begintTree (yyV1->object.collision) return get_objects (t->function.next, yyV1); } } case kvar_decl:/* line 112 "java.puma" */ return get_objects (t->var_decl.next, get_objects (t->var_decl.decl_list, o)); case kfield: case kstatic_initializer: case kinitializer:/* line 115 "java.puma" */ t = t->field.next; goto yyRecursion; case knofield:/* line 118 "java.puma" */ return o; case kdecl: case kvariable: case kparameter:/* line 121 "java.puma" */ { { register tTree yyV1; yyALLOC (tTree,Tree_PoolFreePtr,Tree_PoolStartPtr, Tree_Alloc,yobject,MakeTree,yyV1,kobject,Tree_InitHead) yyV1->object.object = t; yyV1->object.ident = t->decl.ident; yyV1->object.next = o; begintTree (yyV1->object.collision) return get_objects (t->decl.next, yyV1); } } case knodecl:/* line 124 "java.puma" */ return o;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -