tkparse.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * tkparse.h
  3.  */
  4. /*
  5.  * Token types (mostly statement types).
  6.  */
  7. enum e_token
  8. {
  9.     token_UNKNOWN,
  10.     token_bool, 
  11.     token_choice_header,
  12.     token_choice_item,
  13.     token_comment, 
  14.     token_define_bool,
  15.     token_define_hex,
  16.     token_define_int,
  17.     token_define_string,
  18.     token_define_tristate,
  19.     token_dep_bool,
  20.     token_dep_mbool,
  21.     token_dep_tristate,
  22.     token_else, 
  23.     token_endmenu,
  24.     token_fi, 
  25.     token_hex,
  26.     token_if, 
  27.     token_int,
  28.     token_mainmenu_name, 
  29.     token_mainmenu_option, 
  30.     token_source,
  31.     token_string,
  32.     token_then,
  33.     token_tristate, 
  34.     token_unset,
  35. };
  36. /*
  37.  * Operator types for conditionals.
  38.  */
  39. enum operator
  40. {
  41.     op_eq,
  42.     op_neq,
  43.     op_and,
  44.     op_and1,
  45.     op_or,
  46.     op_bang,
  47.     op_lparen,
  48.     op_rparen,
  49.     op_constant,
  50.     op_variable,
  51.     op_true,
  52.     op_false,
  53.     op_nuked
  54. };
  55. /*
  56.  * Conditions come in linked lists.
  57.  * Some operators take strings:
  58.  *
  59.  *   op_constant   "foo"
  60.  *   op_variable   "$ARCH", "$CONFIG_PMAC", "$CONFIG_EXPERIMENTAL"
  61.  *
  62.  * Most "$..." constructs refer to a variable which is defined somewhere
  63.  * in the script.  Note that it is legal to test variables which are never
  64.  * defined, such as variables that are meaningful only on other architectures.
  65.  */
  66. struct condition
  67. {
  68.     struct condition * next;
  69.     enum operator op;
  70.     const char * str; /* op_constant */
  71.     int nameindex; /* op_variable */
  72. };
  73. /*
  74.  * Dependency list for dep_bool, dep_mbool, dep_tristate
  75.  */
  76. struct dependency
  77. {
  78.     char * name;
  79.     struct dependency * next;
  80. };
  81. /*
  82.  * A statement from a config.in file
  83.  */
  84. struct kconfig
  85. {
  86.     struct kconfig * next;
  87.     enum e_token token;
  88.     int nameindex;
  89.     char * label;
  90.     char * value;
  91.     struct condition * cond;
  92.     struct dependency * depend; /* token_dep_tristate */
  93.     struct kconfig * cfg_parent; /* token_choice_item */
  94.     /* used only in tkgen.c */
  95.     int menu_number;
  96.     int menu_line;
  97.     struct kconfig * menu_next;
  98. };
  99. struct variable
  100. {
  101.     char * name;
  102.     char defined;
  103.     char global_written;
  104. };
  105. extern struct variable *vartable;
  106. extern int max_varnum;
  107. /*
  108.  * Prototypes
  109.  */
  110. extern void fix_conditionals ( struct kconfig * scfg ); /* tkcond.c */
  111. extern void dump_tk_script   ( struct kconfig * scfg ); /* tkgen.c  */
  112. extern int get_varnum        ( char * name ); /* tkparse.c */