asm_scan.c

来自「代码检索工具GLOBAL源码。可用来浏览分析LINUX源码。」· C语言 代码 · 共 2,006 行 · 第 1/4 页

C
2,006
字号
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    2,    3,    4,    5,    2,    6,      168,    3,    4,    7,    8,    7,    8,    2,  167,    2,        9,    2,    2,    2,    9,   10,    2,  166,   15,   10,       15,   19,   21,   19,   34,    5,   21,    6,   31,   34,       40,    7,    8,   30,  165,   30,   40,   30,    9,   47,       40,   47,  164,   10,   11,   11,   11,   11,   11,   11,       11,   11,   11,   11,   11,   11,   11,   11,   22,   51,       22,   31,   54,   51,   54,   69,  163,   69,   22,   69,       31,   70,  162,   71,   11,   12,   12,   12,   12,   12,       12,   12,   12,   12,   12,   12,   12,   12,   12,   56,       57,   56,   83,   76,  161,   57,   76,   85,   83,   56,      160,   76,   83,   85,   70,   12,   71,   85,  159,  158,       98,   98,   57,   70,   98,   71,   99,  157,  117,  117,      156,   99,  117,  155,  154,  153,  151,  150,  149,  148,      147,  146,  144,  143,  142,  141,  140,  139,   99,  170,      170,  170,  170,  170,  170,  170,  170,  170,  171,  171,      171,  171,  171,  171,  171,  171,  171,  172,  172,  172,      172,  172,  172,  172,  172,  172,  173,  173,  173,  173,      173,  173,  173,  173,  173,  174,  174,  174,  174,  174,      174,  174,  174,  174,  175,  175,  176,  137,  136,  135,      134,  133,  132,  176,  177,  177,  177,  177,  177,  177,      131,  177,  177,  178,  178,  178,  178,  178,  178,  178,      178,  178,  179,  179,  130,  179,  179,  179,  179,  179,      179,  180,  180,  129,  128,  180,  180,  180,  180,  180,      181,  181,  127,  181,  126,  181,  181,  181,  181,  182,      125,  182,  182,  183,  183,  124,  123,  122,  121,  120,      119,  118,  116,  115,  114,  113,  112,  111,  110,  109,      108,  107,  106,  103,  102,  100,   97,   94,   93,   91,       90,   87,   81,   80,   79,   78,   77,   75,   74,   73,       68,   67,   65,   64,   63,   60,   55,   53,   48,   44,       43,   41,   38,   37,   36,   35,   33,   32,   29,   28,       27,   26,   25,   24,   20,   13,  169,  169,  169,  169,      169,  169,  169,  169,  169,  169,  169,  169,  169,  169,      169,  169,  169,  169,  169,  169,  169,  169,  169,  169,      169,  169,  169,  169,  169,  169,  169,  169,  169,  169,      169,  169,  169,  169,  169,  169,  169,  169,  169,  169,      169    } ;static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;static char *yy_full_match;static int yy_lp;#define REJECT \{ \*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \yy_cp = yy_full_match; /* restore poss. backed-over text */ \++yy_lp; \goto find_rule; \}#define yymore() yymore_used_but_not_detected#define YY_MORE_ADJ 0#define YY_RESTORE_YY_MORE_OFFSETchar *yytext;#line 1 "asm_scan.l"#define INITIAL 0#line 2 "asm_scan.l"/* * Copyright (c) 2002, 2004 Tama Communications Corporation * * This file is part of GNU GLOBAL. * * GNU GLOBAL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * GNU GLOBAL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA. */#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <stdio.h>#ifdef HAVE_STRING_H#include <string.h>#else#include <strings.h>#endif#define YYLTYPE		int#include "asm_parse.h"#include "asm_res.h"#include "die.h"#include "gctags.h"#include "linetable.h"#include "strbuf.h"#define lex_symbol_generation_rule(x) asm_ ## x#define LEXTEXT lex_symbol_generation_rule(text)#define LEXLENG lex_symbol_generation_rule(leng)#define LEXLINENO lex_symbol_generation_rule(lineno)#define LEXRESTART lex_symbol_generation_rule(restart)#define LEXLVAL lex_symbol_generation_rule(lval)#define LEXLLOC lex_symbol_generation_rule(lloc)#define YY_INPUT(buf, result, max_size) do {				\	if ((result = linetable_read(buf, max_size)) == -1)		\		result = YY_NULL;					\} while (0)#define ADD_SYM() do {							\	LEXLVAL = strbuf_getlen(asm_symtable);				\	LEXLLOC = LEXLINENO;						\	strbuf_puts0(asm_symtable, LEXTEXT);				\} while (0)extern const char *asm_input_file;extern STRBUF *asm_symtable;#define C_COMMENT 1#define CPP_COMMENT 2#define STRING 3#define LITERAL 4#define PREPROCESSOR_LINE 5#define YY_STACK_USED 1#define YY_NO_TOP_STATE 1#line 637 "asm_scan.c"/* Macros after this point can all be overridden by user definitions in * section 1. */#ifndef YY_SKIP_YYWRAP#ifdef __cplusplusextern "C" int yywrap YY_PROTO(( void ));#elseextern int yywrap YY_PROTO(( void ));#endif#endif#ifndef YY_NO_UNPUTstatic void yyunput YY_PROTO(( int c, char *buf_ptr ));#endif#ifndef yytext_ptrstatic void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));#endif#ifdef YY_NEED_STRLENstatic int yy_flex_strlen YY_PROTO(( yyconst char * ));#endif#ifndef YY_NO_INPUT#ifdef __cplusplusstatic int yyinput YY_PROTO(( void ));#elsestatic int input YY_PROTO(( void ));#endif#endif#if YY_STACK_USEDstatic int yy_start_stack_ptr = 0;static int yy_start_stack_depth = 0;static int *yy_start_stack = 0;#ifndef YY_NO_PUSH_STATEstatic void yy_push_state YY_PROTO(( int new_state ));#endif#ifndef YY_NO_POP_STATEstatic void yy_pop_state YY_PROTO(( void ));#endif#ifndef YY_NO_TOP_STATEstatic int yy_top_state YY_PROTO(( void ));#endif#else#define YY_NO_PUSH_STATE 1#define YY_NO_POP_STATE 1#define YY_NO_TOP_STATE 1#endif#ifdef YY_MALLOC_DECLYY_MALLOC_DECL#else#if __STDC__#ifndef __cplusplus#include <stdlib.h>#endif#else/* Just try to get by without declaring the routines.  This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */#endif#endif/* Amount of stuff to slurp up with each read. */#ifndef YY_READ_BUF_SIZE#define YY_READ_BUF_SIZE 8192#endif/* Copy whatever the last rule matched to the standard output. */#ifndef ECHO/* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )#endif/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL, * is returned in "result". */#ifndef YY_INPUT#define YY_INPUT(buf,result,max_size) \	if ( yy_current_buffer->yy_is_interactive ) \		{ \		int c = '*', n; \		for ( n = 0; n < max_size && \			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \			buf[n] = (char) c; \		if ( c == '\n' ) \			buf[n++] = (char) c; \		if ( c == EOF && ferror( yyin ) ) \			YY_FATAL_ERROR( "input in flex scanner failed" ); \		result = n; \		} \	else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \		  && ferror( yyin ) ) \		YY_FATAL_ERROR( "input in flex scanner failed" );#endif/* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */#ifndef yyterminate#define yyterminate() return YY_NULL#endif/* Number of entries by which start-condition stack grows. */#ifndef YY_START_STACK_INCR#define YY_START_STACK_INCR 25#endif/* Report a fatal error. */#ifndef YY_FATAL_ERROR#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )#endif/* Default declaration of generated scanner - a define so the user can * easily add parameters. */#ifndef YY_DECL#define YY_DECL int yylex YY_PROTO(( void ))#endif/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */#ifndef YY_USER_ACTION#define YY_USER_ACTION#endif/* Code executed at the end of each rule. */#ifndef YY_BREAK#define YY_BREAK break;#endif#define YY_RULE_SETUP \	if ( yyleng > 0 ) \		yy_current_buffer->yy_at_bol = \				(yytext[yyleng - 1] == '\n'); \	YY_USER_ACTIONYY_DECL	{	register yy_state_type yy_current_state;	register char *yy_cp, *yy_bp;	register int yy_act;#line 80 "asm_scan.l" /* Ignore spaces */#line 795 "asm_scan.c"	if ( yy_init )		{		yy_init = 0;#ifdef YY_USER_INIT		YY_USER_INIT;#endif		if ( ! yy_start )			yy_start = 1;	/* first start state */		if ( ! yyin )			yyin = stdin;		if ( ! yyout )			yyout = stdout;		if ( ! yy_current_buffer )			yy_current_buffer =				yy_create_buffer( yyin, YY_BUF_SIZE );		yy_load_buffer_state();		}	while ( 1 )		/* loops until end-of-file is reached */		{		yy_cp = yy_c_buf_p;		/* Support of yytext. */		*yy_cp = yy_hold_char;		/* yy_bp points to the position in yy_ch_buf of the start of		 * the current run.		 */		yy_bp = yy_cp;		yy_current_state = yy_start;		yy_current_state += YY_AT_BOL();		yy_state_ptr = yy_state_buf;		*yy_state_ptr++ = yy_current_state;yy_match:		do			{			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )				{				yy_current_state = (int) yy_def[yy_current_state];				if ( yy_current_state >= 170 )					yy_c = yy_meta[(unsigned int) yy_c];				}			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];			*yy_state_ptr++ = yy_current_state;			++yy_cp;			}		while ( yy_base[yy_current_state] != 357 );yy_find_action:		yy_current_state = *--yy_state_ptr;		yy_lp = yy_accept[yy_current_state];find_rule: /* we branch to this label when backing up */		for ( ; ; ) /* until we find what rule we matched */			{			if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )				{				yy_act = yy_acclist[yy_lp];					{					yy_full_match = yy_cp;					break;					}				}			--yy_cp;			yy_current_state = *--yy_state_ptr;			yy_lp = yy_accept[yy_current_state];			}		YY_DO_BEFORE_ACTION;		if ( yy_act != YY_END_OF_BUFFER )			{			int yyl;			for ( yyl = 0; yyl < yyleng; ++yyl )				if ( yytext[yyl] == '\n' )					++yylineno;			}do_action:	/* This label is used only to access EOF actions. */		switch ( yy_act )	{ /* beginning of action switch */case 1:YY_RULE_SETUP#line 83 "asm_scan.l"	YY_BREAK/* C style comment */case 2:YY_RULE_SETUP#line 86 "asm_scan.l"{ yy_push_state(C_COMMENT); }	YY_BREAKcase 3:YY_RULE_SETUP#line 88 "asm_scan.l"	YY_BREAKcase 4:YY_RULE_SETUP#line 89 "asm_scan.l"	YY_BREAKcase 5:YY_RULE_SETUP#line 90 "asm_scan.l"	YY_BREAKcase 6:YY_RULE_SETUP#line 91 "asm_scan.l"	YY_BREAKcase 7:YY_RULE_SETUP#line 92 "asm_scan.l"{ yy_pop_state(); }	YY_BREAKcase YY_STATE_EOF(C_COMMENT):#line 93 "asm_scan.l"{		if (wflag)			warning("unexpected eof. [+%d %s]", LEXLINENO, asm_input_file);		yyterminate();	}	YY_BREAK/* C++ style line comment */case 8:YY_RULE_SETUP#line 101 "asm_scan.l"{ yy_push_state(CPP_COMMENT); }	YY_BREAKcase 9:YY_RULE_SETUP#line 103 "asm_scan.l"	YY_BREAKcase 10:YY_RULE_SETUP#line 104 "asm_scan.l"	YY_BREAKcase 11:YY_RULE_SETUP#line 105 "asm_scan.l"{ yy_pop_state(); unput('\n'); }	YY_BREAK/* String */case 12:YY_RULE_SETUP#line 109 "asm_scan.l"{ yy_push_state(STRING); }	YY_BREAKcase 13:YY_RULE_SETUP#line 111 "asm_scan.l"	YY_BREAKcase 14:YY_RULE_SETUP#line 112 "asm_scan.l"	YY_BREAKcase 15:YY_RULE_SETUP#line 113 "asm_scan.l"{ yy_pop_state(); unput('\n'); return ASM_CONST; }	YY_BREAKcase 16:YY_RULE_SETUP#line 114 "asm_scan.l"{ yy_pop_state(); return ASM_CONST; }	YY_BREAK/* Character */case 17:YY_RULE_SETUP#line 118 "asm_scan.l"{ yy_push_state(LITERAL); }	YY_BREAKcase 18:YY_RULE_SETUP#line 120 "asm_scan.l"	YY_BREAKcase 19:YY_RULE_SETUP#line 121 "asm_scan.l"	YY_BREAKcase 20:YY_RULE_SETUP#line 122 "asm_scan.l"{ yy_pop_state(); unput('\n'); return ASM_CONST; }	YY_BREAK

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?