<!DOCTYPE LINUXDOC SYSTEM>

<!-- This SGML file generated by cxref. -->
<!-- cxref program (c) Andrew M. Bishop 1995,96,97,98. -->

<article>

<title>Cross reference for parse-yacc.c of cxref.
<author>cxref

<sect>File parse-yacc.c
<bf>RCS Header: /home/amb/cxref/RCS/parse.y 1.38 1999/01/27 19:19:31 amb Exp </bf>
<p>

  C Cross Referencing &amp; Documentation tool. Version 1.5.
<newline>
  C parser.
<p>
<descrip>
<tag>References Variables:</tag>
<itemize>
<item>first  :  parse-yacc.c
</itemize>
</descrip>

<sect1>Included Files

<p>
<itemize>
<item><tt>#include &lt;string.h&gt;</tt>
</itemize>
<itemize>
<item><tt>#include &quot;parse-yy.h&quot;</tt>
<itemize>
<item><tt>#include &lt;stdio.h&gt;</tt>
<item><tt>#include &lt;stdlib.h&gt;</tt>
</itemize>
</itemize>
<itemize>
<item><tt>#include &quot;cxref.h&quot;</tt>
<itemize>
<item><tt>#include &quot;datatype.h&quot;</tt>
</itemize>
</itemize>
<itemize>
<item><tt>#include &quot;memory.h&quot;</tt>
</itemize>
<itemize>
<item><tt>#include &lt;stdio.h&gt;</tt>
</itemize>

<sect1>Preprocessor definitions

<p>
<tt>#define YYBISON 1</tt><newline>
<p>
<tt>#define IDENTIFIER 258</tt><newline>
<p>
<tt>#define TYPE_NAME 259</tt><newline>
<p>
<tt>#define LITERAL 260</tt><newline>
<p>
<tt>#define STRING_LITERAL 261</tt><newline>
<p>
<tt>#define ELLIPSES 262</tt><newline>
<p>
<tt>#define MUL_ASSIGN 263</tt><newline>
<p>
<tt>#define DIV_ASSIGN 264</tt><newline>
<p>
<tt>#define MOD_ASSIGN 265</tt><newline>
<p>
<tt>#define ADD_ASSIGN 266</tt><newline>
<p>
<tt>#define SUB_ASSIGN 267</tt><newline>
<p>
<tt>#define LEFT_ASSIGN 268</tt><newline>
<p>
<tt>#define RIGHT_ASSIGN 269</tt><newline>
<p>
<tt>#define AND_ASSIGN 270</tt><newline>
<p>
<tt>#define XOR_ASSIGN 271</tt><newline>
<p>
<tt>#define OR_ASSIGN 272</tt><newline>
<p>
<tt>#define EQ_OP 273</tt><newline>
<p>
<tt>#define NE_OP 274</tt><newline>
<p>
<tt>#define PTR_OP 275</tt><newline>
<p>
<tt>#define AND_OP 276</tt><newline>
<p>
<tt>#define OR_OP 277</tt><newline>
<p>
<tt>#define DEC_OP 278</tt><newline>
<p>
<tt>#define INC_OP 279</tt><newline>
<p>
<tt>#define LE_OP 280</tt><newline>
<p>
<tt>#define GE_OP 281</tt><newline>
<p>
<tt>#define LEFT_SHIFT 282</tt><newline>
<p>
<tt>#define RIGHT_SHIFT 283</tt><newline>
<p>
<tt>#define SIZEOF 284</tt><newline>
<p>
<tt>#define TYPEDEF 285</tt><newline>
<p>
<tt>#define EXTERN 286</tt><newline>
<p>
<tt>#define STATIC 287</tt><newline>
<p>
<tt>#define AUTO 288</tt><newline>
<p>
<tt>#define REGISTER 289</tt><newline>
<p>
<tt>#define CONST 290</tt><newline>
<p>
<tt>#define VOLATILE 291</tt><newline>
<p>
<tt>#define VOID 292</tt><newline>
<p>
<tt>#define INLINE 293</tt><newline>
<p>
<tt>#define CHAR 294</tt><newline>
<p>
<tt>#define SHORT 295</tt><newline>
<p>
<tt>#define INT 296</tt><newline>
<p>
<tt>#define LONG 297</tt><newline>
<p>
<tt>#define SIGNED 298</tt><newline>
<p>
<tt>#define UNSIGNED 299</tt><newline>
<p>
<tt>#define FLOAT 300</tt><newline>
<p>
<tt>#define DOUBLE 301</tt><newline>
<p>
<tt>#define STRUCT 302</tt><newline>
<p>
<tt>#define UNION 303</tt><newline>
<p>
<tt>#define ENUM 304</tt><newline>
<p>
<tt>#define CASE 305</tt><newline>
<p>
<tt>#define DEFAULT 306</tt><newline>
<p>
<tt>#define IF 307</tt><newline>
<p>
<tt>#define ELSE 308</tt><newline>
<p>
<tt>#define SWITCH 309</tt><newline>
<p>
<tt>#define WHILE 310</tt><newline>
<p>
<tt>#define DO 311</tt><newline>
<p>
<tt>#define FOR 312</tt><newline>
<p>
<tt>#define GOTO 313</tt><newline>
<p>
<tt>#define CONTINUE 314</tt><newline>
<p>
<tt>#define BREAK 315</tt><newline>
<p>
<tt>#define RETURN 316</tt><newline>
<p>
<tt>#define ASM 317</tt><newline>
<p>
<tt>#define yylex cxref_yylex</tt><newline>
<p>
 The variable must be LOCAL or EXTERNAL or GLOBAL, so this checks and sets that. 
<p>
<tt>#define SCOPE</tt><newline>
<p>
<tt>#define YYFINAL 554</tt><newline>
<p>
<tt>#define YYFLAG 32768</tt><newline>
<p>
<tt>#define YYNTBASE 87</tt><newline>
<p>
<tt>#define YYTRANSLATE( x )</tt><newline>
<p>
<tt>#define YYLAST 1566</tt><newline>
<p>
<tt>#define yyerrok</tt><newline>
<p>
<tt>#define yyclearin</tt><newline>
<p>
<tt>#define YYEMPTY 2</tt><newline>
<p>
<tt>#define YYEOF 0</tt><newline>
<p>
<tt>#define YYACCEPT</tt><newline>
<p>
<tt>#define YYABORT</tt><newline>
<p>
<tt>#define YYERROR</tt><newline>
<p>
<tt>#define YYFAIL</tt><newline>
<p>
<tt>#define YYRECOVERING</tt><newline>
<p>
<tt>#define YYBACKUP( token, value )</tt><newline>
<p>
<tt>#define YYTERROR 1</tt><newline>
<p>
<tt>#define YYERRCODE 256</tt><newline>
<p>
<tt>#define YYLEX yylex</tt><newline>
<p>
<tt>#define YYINITDEPTH 200</tt><newline>
<p>
<tt>#define YYMAXDEPTH 10000</tt><newline>
<p>
<tt>#define YYPARSE_PARAM_ARG</tt><newline>
<p>
<tt>#define YYPARSE_PARAM_DECL</tt><newline>
<p>
<tt>#define YYPOPSTACK</tt><newline>

<sect1>Typedef stack

<p>
 A structure to hold the information about an object. 
<p>
<tt>typedef struct _stack stack</tt><newline>
<itemize>
<item><tt>struct _stack</tt><newline>
<itemize>
<item><tt>{</tt><newline>
<item><tt>char* name;      </tt> The name of the object. <newline>
<item><tt>char* type;      </tt> The type of the object. <newline>
<item><tt>char* qual;      </tt> The type qualifier of the object. <newline>
<item><tt>}</tt><newline>
</itemize>
</itemize>

<sect1>Global Variable yylval

<p>
 For communication between the lex and yacc code. 
<p>
<tt>char* yylval</tt><newline>
<descrip>
<tag>Visible in:</tag>
<itemize>
<item>cxref.c
<item>func.c
<item>parse-lex.c
<item>parse-yacc.c
<item>parse-yacc.h
<item>parse-yy.h
<item>preproc.c
<item>type.c
<item>var.c
</itemize>
<tag>Used in:</tag>
<itemize>
<item>yylex()  :  parse-lex.c
<item>yyparse()  :  parse-yacc.c
</itemize>
</descrip>

<sect1>Global Variable in_typedef

<p>
 A flag that is set to true when typedef is seen in a statement. 
<p>
<tt>int in_typedef</tt><newline>
<descrip>
<tag>Visible in:</tag>
<itemize>
<item>parse-yacc.c
<item>type.c
</itemize>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()  :  parse-yacc.c
<item>SeenStructUnionEnd()  :  type.c
<item>SeenStructUnionStart()  :  type.c
<item>yyparse()  :  parse-yacc.c
</itemize>
</descrip>

<sect1>Global Variable yychar

<p>
<tt>int yychar</tt><newline>
<descrip>
<tag>Visible in:</tag>
<itemize>
<item>parse-yacc.c
</itemize>
<tag>Used in:</tag>
<itemize>
<item>yyerror()  :  parse-yacc.c
<item>yyparse()  :  parse-yacc.c
</itemize>
</descrip>

<sect1>Global Variable yynerrs

<p>
<tt>int yynerrs</tt><newline>
<descrip>
<tag>Visible in:</tag>
<itemize>
<item>parse-yacc.c
</itemize>
<tag>Used in:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
</descrip>

<sect1>External Variables

<p>
<bf>in_header</bf><newline>
 When in a header file, some stuff can be skipped over quickly. 
<p>
<tt>extern int in_header</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>in_header</itemize>
</descrip>

<sect1>Local Variables

<p>
<bf>scope</bf><newline>
 The scope of the function / variable that is being examined. 
<p>
<tt>static int scope</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>in_function</bf><newline>
 When in a function or a function definition, the behaviour is different. 
<p>
<tt>static int in_function</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>in_funcdef</bf><newline>
 When in a function or a function definition, the behaviour is different. 
<p>
<tt>static int in_funcdef</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>in_funcbody</bf><newline>
 When in a function or a function definition, the behaviour is different. 
<p>
<tt>static int in_funcbody</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>first</bf><newline>
 The parsing stack   first value. 
<p>
<tt>static stack first</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>parse-yacc.c
<item>ResetParser()
<item>push()
</itemize>
</descrip>
<p>
<bf>list</bf><newline>
 The parsing stack   list of all values. 
<p>
<tt>static stack* list</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()
<item>pop()
<item>push()
</itemize>
</descrip>
<p>
<bf>current</bf><newline>
 The parsing stack   current values. 
<p>
<tt>static stack* current</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()
<item>pop()
<item>push()
<item>reset()
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>depth</bf><newline>
 The depth of the stack   currently in use. 
<p>
<tt>static int depth</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()
<item>pop()
<item>push()
</itemize>
</descrip>
<p>
<bf>maxdepth</bf><newline>
 The depth of the stack   total malloced. 
<p>
<tt>static int maxdepth</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()
<item>push()
</itemize>
</descrip>
<p>
<bf>common_comment</bf><newline>
 Declarations that are in the same statement share this comment. 
<p>
<tt>static char* common_comment</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>in_structunion</bf><newline>
 When inside a struct / union / enum definition, this is the depth. 
<p>
<tt>static int in_structunion</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()
<item>cxref_yylex()
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>comp_type</bf><newline>
 When inside a struct / union definition, this is the component type. 
<p>
<tt>static char* comp_type</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>in_type_spec</bf><newline>
 To solve the problem where a type name is used as an identifier. 
<p>
<tt>static int in_type_spec</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetParser()
<item>cxref_yylex()
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>yytranslate</bf><newline>
<tt>static const char yytranslate[]</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>yyr1</bf><newline>
<tt>static const short yyr1[]</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>yyr2</bf><newline>
<tt>static const short yyr2[]</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>yydefact</bf><newline>
<tt>static const short yydefact[]</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>yydefgoto</bf><newline>
<tt>static const short yydefgoto[]</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>yypact</bf><newline>
<tt>static const short yypact[]</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>yypgoto</bf><newline>
<tt>static const short yypgoto[]</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>yytable</bf><newline>
<tt>static const short yytable[]</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>yyparse()
</itemize>
</descrip>
<p>
<bf>yycheck</bf><newline>
<tt>static const short yycheck[]</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>yyparse()
</itemize>
</descrip>

<sect1>Global Function ResetParser()

<p>  Reset the Parser, ready for the next file.
<p>
<tt>void ResetParser ( void )</tt><newline>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>SafeFree()  :  memory.c
<item>reset()  :  parse-yacc.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>main()  :  cxref.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>common_comment  :  parse-yacc.c
<item>comp_type  :  parse-yacc.c
<item>current  :  parse-yacc.c
<item>depth  :  parse-yacc.c
<item>first  :  parse-yacc.c
<item>in_funcbody  :  parse-yacc.c
<item>in_funcdef  :  parse-yacc.c
<item>in_function  :  parse-yacc.c
<item>in_structunion  :  parse-yacc.c
<item>in_type_spec  :  parse-yacc.c
<item>in_typedef  :  parse-yacc.c
<item>list  :  parse-yacc.c
<item>maxdepth  :  parse-yacc.c
<item>scope  :  parse-yacc.c
</itemize>
</descrip>

<sect1>Global Function yyparse()

<p><tt>int yyparse ( void )</tt><newline>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>parse-yy.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>CheckFunctionVariableRef()  :  func.c
<item>ConcatStrings()  :  memory.c
<item>CopyString()  :  memory.c
<item>DownScope()  :  var.c
<item>GetCurrentComment()  :  comment.c
<item>IsAScopeVariable()  :  var.c
<item>IsATypeName()  :  type.c
<item>SeenFunctionArg()  :  func.c
<item>SeenFunctionCall()  :  func.c
<item>SeenFunctionDeclaration()  :  func.c
<item>SeenFunctionDefinition()  :  func.c
<item>SeenFunctionProto()  :  func.c
<item>SeenScopeVariable()  :  var.c
<item>SeenStructUnionComp()  :  type.c
<item>SeenStructUnionEnd()  :  type.c
<item>SeenStructUnionStart()  :  type.c
<item>SeenTypedef()  :  type.c
<item>SeenTypedefName()  :  type.c
<item>SeenVariableDefinition()  :  var.c
<item>SetCurrentComment()  :  comment.c
<item>UpScope()  :  var.c
<item>__yy_memcpy()  :  parse-yacc.c
<item>cxref_yylex()  :  parse-yacc.c
<item>pop()  :  parse-yacc.c
<item>push()  :  parse-yacc.c
<item>reset()  :  parse-yacc.c
<item>yyerror()  :  parse-yacc.c
<item>alloca(), strcmp(), strlen(), strstr()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>DocumentTheFile()  :  cxref.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>common_comment  :  parse-yacc.c
<item>comp_type  :  parse-yacc.c
<item>current  :  parse-yacc.c
<item>in_funcbody  :  parse-yacc.c
<item>in_funcdef  :  parse-yacc.c
<item>in_function  :  parse-yacc.c
<item>in_header  :  preproc.c
<item>in_structunion  :  parse-yacc.c
<item>in_type_spec  :  parse-yacc.c
<item>in_typedef  :  parse-yacc.c
<item>scope  :  parse-yacc.c
<item>yychar  :  parse-yacc.c
<item>yycheck  :  parse-yacc.c
<item>yydefact  :  parse-yacc.c
<item>yydefgoto  :  parse-yacc.c
<item>yylval  :  parse-yacc.c
<item>yynerrs  :  parse-yacc.c
<item>yypact  :  parse-yacc.c
<item>yypgoto  :  parse-yacc.c
<item>yyr1  :  parse-yacc.c
<item>yyr2  :  parse-yacc.c
<item>yytable  :  parse-yacc.c
<item>yytranslate  :  parse-yacc.c
</itemize>
</descrip>

<sect1>Local Function __yy_memcpy()

<p><tt>static void __yy_memcpy ( char* to, char* from, int count )</tt><newline>
<descrip>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
</descrip>

<sect1>Local Function cxref_yylex()

<p>  Call the lexer, the feedback from the parser to the lexer is applied here.
<p>
<tt>static int cxref_yylex ( void )</tt><newline>
<descrip>
<tag><tt>int cxref_yylex</tt></tag>
Returns the value from the lexer, modified due to parser feedback.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>parse-yacc.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>yylex()  :  parse-lex.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>in_structunion  :  parse-yacc.c
<item>in_type_spec  :  parse-yacc.c
</itemize>
</descrip>

<sect1>Local Function pop()

<p>  Pop a level from the stack.
<p>
<tt>static void pop ( void )</tt><newline>
<descrip>
<tag>Calls:</tag>
<itemize>
<item>reset()  :  parse-yacc.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>current  :  parse-yacc.c
<item>depth  :  parse-yacc.c
<item>list  :  parse-yacc.c
</itemize>
</descrip>

<sect1>Local Function push()

<p>  Push a level onto the stack.
<p>
<tt>static void push ( void )</tt><newline>
<descrip>
<tag>Calls:</tag>
<itemize>
<item>SafeMalloc()  :  memory.c
<item>SafeRealloc()  :  memory.c
<item>reset()  :  parse-yacc.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>current  :  parse-yacc.c
<item>depth  :  parse-yacc.c
<item>first  :  parse-yacc.c
<item>list  :  parse-yacc.c
<item>maxdepth  :  parse-yacc.c
</itemize>
</descrip>

<sect1>Local Function reset()

<p>  Reset the current level on the stack.
<p>
<tt>static void reset ( void )</tt><newline>
<descrip>
<tag>Called by:</tag>
<itemize>
<item>ResetParser()  :  parse-yacc.c
<item>pop()  :  parse-yacc.c
<item>push()  :  parse-yacc.c
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>current  :  parse-yacc.c
</itemize>
</descrip>

<sect1>Local Function yyerror()

<p>  Stop parsing the current file, due to an error.
<p>
<tt>static void yyerror ( char* s )</tt><newline>
<descrip>
<tag><tt>char* s</tt></tag>
The error message to print out.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>parse-yacc.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>yylex()  :  parse-lex.c
<item>fflush(), fprintf()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>parse_file  :  parse-lex.c
<item>parse_line  :  parse-lex.c
<item>yychar  :  parse-yacc.c
</itemize>
</descrip>

</article>
