📄 config.cpp
字号:
#ifndef YY_ALWAYS_INTERACTIVE#ifndef YY_NEVER_INTERACTIVEextern int isatty YY_PROTO(( int ));#endif#endif#ifdef YY_USE_PROTOSvoid yy_init_buffer( YY_BUFFER_STATE b, FILE *file )#elsevoid yy_init_buffer( b, file )YY_BUFFER_STATE b;FILE *file;#endif { yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1;#if YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1;#else#if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0;#else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;#endif#endif }#ifdef YY_USE_PROTOSvoid yy_flush_buffer( YY_BUFFER_STATE b )#elsevoid yy_flush_buffer( b )YY_BUFFER_STATE b;#endif { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == yy_current_buffer ) yy_load_buffer_state(); }#ifndef YY_NO_SCAN_BUFFER#ifdef YY_USE_PROTOSYY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )#elseYY_BUFFER_STATE yy_scan_buffer( base, size )char *base;yy_size_t size;#endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; }#endif#ifndef YY_NO_SCAN_STRING#ifdef YY_USE_PROTOSYY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )#elseYY_BUFFER_STATE yy_scan_string( yy_str )yyconst char *yy_str;#endif { int len; for ( len = 0; yy_str[len]; ++len ) ; return yy_scan_bytes( yy_str, len ); }#endif#ifndef YY_NO_SCAN_BYTES#ifdef YY_USE_PROTOSYY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )#elseYY_BUFFER_STATE yy_scan_bytes( bytes, len )yyconst char *bytes;int len;#endif { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; }#endif#ifndef YY_NO_PUSH_STATE#ifdef YY_USE_PROTOSstatic void yy_push_state( int new_state )#elsestatic void yy_push_state( new_state )int new_state;#endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); }#endif#ifndef YY_NO_POP_STATEstatic void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); }#endif#ifndef YY_NO_TOP_STATEstatic int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; }#endif#ifndef YY_EXIT_FAILURE#define YY_EXIT_FAILURE 2#endif#ifdef YY_USE_PROTOSstatic void yy_fatal_error( yyconst char msg[] )#elsestatic void yy_fatal_error( msg )char msg[];#endif { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); }/* Redefine yyless() so it works in section 3 code. */#undef yyless#define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 )/* Internal utility routines. */#ifndef yytext_ptr#ifdef YY_USE_PROTOSstatic void yy_flex_strncpy( char *s1, yyconst char *s2, int n )#elsestatic void yy_flex_strncpy( s1, s2, n )char *s1;yyconst char *s2;int n;#endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; }#endif#ifdef YY_NEED_STRLEN#ifdef YY_USE_PROTOSstatic int yy_flex_strlen( yyconst char *s )#elsestatic int yy_flex_strlen( s )yyconst char *s;#endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; }#endif#ifdef YY_USE_PROTOSstatic void *yy_flex_alloc( yy_size_t size )#elsestatic void *yy_flex_alloc( size )yy_size_t size;#endif { return (void *) malloc( size ); }#ifdef YY_USE_PROTOSstatic void *yy_flex_realloc( void *ptr, yy_size_t size )#elsestatic void *yy_flex_realloc( ptr, size )void *ptr;yy_size_t size;#endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); }#ifdef YY_USE_PROTOSstatic void yy_flex_free( void *ptr )#elsestatic void yy_flex_free( ptr )void *ptr;#endif { free( ptr ); }#if YY_MAINint main() { yylex(); return 0; }#endif#line 591 "config.l"/*@ ---------------------------------------------------------------------------- */#if 0static void writeBoolValue(QTextStream &t,bool v){ if (v) t << "YES"; else t << "NO";}static void writeIntValue(QTextStream &t,int i){ t << i;}static void writeStringValue(QTextStream &t,QCString &s){ const char *p=s.data(); char c; bool hasBlanks=FALSE; if (p) { while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t'); if (hasBlanks) t << "\"" << s << "\""; else t << s; }}static void writeStringList(QTextStream &t,QStrList &l){ const char *p = l.first(); bool first=TRUE; while (p) { char c; const char *s=p; bool hasBlanks=FALSE; while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t'); if (!first) t << " "; first=FALSE; if (hasBlanks) t << "\"" << s << "\""; else t << s; p = l.next(); if (p) t << " \\" << endl; }}#endifvoid Config::writeTemplate(QFile *f,bool sl,bool upd){ QTextStream t(f); t << "# Doxyfile " << versionString << endl << endl; if (!sl) { t << "# This file describes the settings to be used by the documentation system\n"; t << "# doxygen (www.doxygen.org) for a project\n"; t << "#\n"; t << "# All text after a hash (#) is considered a comment and will be ignored\n"; t << "# The format is:\n"; t << "# TAG = value [value, ...]\n"; t << "# For lists items can also be appended using:\n"; t << "# TAG += value [value, ...]\n"; t << "# Values that contain spaces should be placed between quotes (\" \")\n"; } ConfigOption *option = m_options->first(); while (option) { option->writeTemplate(t,sl,upd); option = m_options->next(); }}void Config::convertStrToVal(){ ConfigOption *option = m_options->first(); while (option) { option->convertStrToVal(); option = m_options->next(); }}static void substEnvVarsInString(QCString &s){ static QRegExp re("\\$\\([a-z_A-Z0-9]+\\)"); if (s.isEmpty()) return; int p=0; int i,l; //printf("substEnvVarInString(%s) start\n",s.data()); while ((i=re.match(s,p,&l))!=-1) { //printf("Found environment var s.mid(%d,%d)=`%s'\n",i+2,l-3,s.mid(i+2,l-3).data()); QCString env=getenv(s.mid(i+2,l-3)); substEnvVarsInString(env); // recursively expand variables if needed. s = s.left(i)+env+s.right(s.length()-i-l); p=i+env.length(); // next time start at the end of the expanded string } //printf("substEnvVarInString(%s) end\n",s.data());}static void substEnvVarsInStrList(QStrList &sl){ char *s = sl.first(); while (s) { QCString result(s); bool wasQuoted = (result.find(' ')!=-1) || (result.find('\t')!=-1); substEnvVarsInString(result); if (!wasQuoted) /* as a result of the expansion, a single string may have expanded into a list, which we'll add to sl. If the orginal string already contained multiple elements no further splitting is done to allow quoted items with spaces! */ { int l=result.length(); int i,p=0; // skip spaces // search for a "word" for (i=0;i<l;i++) { char c; // skip until start of new word while (i<l && ((c=result.at(i))==' ' || c=='\t')) i++; p=i; // p marks the start index of the word // skip until end of a word while (i<l && ((c=result.at(i))!=' ' && c!='\t' && c!='"')) i++; if (i<l) // not at the end of the string { if (c=='"') // word within quotes { p=i+1; for (i++;i<l;i++) { c=result.at(i); if (c=='"') // end quote { // replace the string in the list and go to the next item. sl.insert(sl.at(),result.mid(p,i-p)); // insert new item before current item. sl.next(); // current item is now the old item p=i+1; break; } else if (c=='\\') // skip escaped stuff { i++; } } } else if (c==' ' || c=='\t') // separator { // replace the string in the list and go to the next item. sl.insert(sl.at(),result.mid(p,i-p)); // insert new item before current item. sl.next(); // current item is now the old item p=i+1; } } } if (p!=l) // add the leftover as a string { // replace the string in the list and go to the next item. sl.insert(sl.at(),result.right(l-p)); // insert new item before current item. sl.next(); // current item is now the old item } // remove the old unexpanded string from the list i=sl.at(); sl.remove(); // current item index changes if the last element is removed. if (sl.at()==i) // not last item s = sl.current(); else // just removed la
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -