Index: doc-rnd/TODO =================================================================== --- doc-rnd/TODO (revision 1433) +++ doc-rnd/TODO (revision 1434) @@ -10,7 +10,6 @@ CLEANUP #4 - libstroke: zoom - cleanup/rewrite resources: - - better tree structs with less hidden properties (minor change in the res format: always require key=val pairs) - gtk, lesstif: reorganize the code so that: - menus are always created using a path (ghid_main_menu_real_add_resource) - res->menu should be a common code @@ -18,6 +17,8 @@ - gpmi: - hid: hid_destroy (pair of hid_create) - cleanup on unload: remove menus + - check how toolbar disappears under short menus + - check why hotkeys (e.g. ESC) don't work - check whether local copy of gts is needed, bisect when toporouter broke Index: src/res_lex.c =================================================================== --- src/res_lex.c (revision 1433) +++ src/res_lex.c (nonexistent) @@ -1,1898 +0,0 @@ -#line 2 "lex.yy.c" - -#line 4 "lex.yy.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define yy_create_buffer res_create_buffer -#define yy_delete_buffer res_delete_buffer -#define yy_flex_debug res_flex_debug -#define yy_init_buffer res_init_buffer -#define yy_flush_buffer res_flush_buffer -#define yy_load_buffer_state res_load_buffer_state -#define yy_switch_to_buffer res_switch_to_buffer -#define yyin resin -#define yyleng resleng -#define yylex reslex -#define yylineno reslineno -#define yyout resout -#define yyrestart resrestart -#define yytext restext -#define yywrap reswrap -#define yyalloc resalloc -#define yyrealloc resrealloc -#define yyfree resfree - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE resrestart(resin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -extern int resleng; - -extern FILE *resin, *resout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE reslex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-reslineno scanner, because yy_act is - * normally declared as a register variable-- so it is not worth it. - */ - #define YY_LESS_LINENO(n) \ - do { \ - int yyl;\ - for ( yyl = n; yyl < resleng; ++yyl )\ - if ( restext[yyl] == '\n' )\ - --reslineno;\ - }while(0) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up restext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up restext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via resrestart()), so that the user can continue scanning by - * just pointing resin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when restext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int resleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow reswrap()'s to do buffer switches - * instead of setting up a fresh resin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void resrestart (FILE *input_file ); -void res_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE res_create_buffer (FILE *file,int size ); -void res_delete_buffer (YY_BUFFER_STATE b ); -void res_flush_buffer (YY_BUFFER_STATE b ); -void respush_buffer_state (YY_BUFFER_STATE new_buffer ); -void respop_buffer_state (void ); - -static void resensure_buffer_stack (void ); -static void res_load_buffer_state (void ); -static void res_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER res_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE res_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE res_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE res_scan_bytes (yyconst char *bytes,int len ); - -void *resalloc (yy_size_t ); -void *resrealloc (void *,yy_size_t ); -void resfree (void * ); - -#define yy_new_buffer res_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - resensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - res_create_buffer(resin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - resensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - res_create_buffer(resin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -#define reswrap(n) 1 -#define YY_SKIP_YYWRAP - -typedef unsigned char YY_CHAR; - -FILE *resin = (FILE *) 0, *resout = (FILE *) 0; - -typedef int yy_state_type; - -extern int reslineno; - -int reslineno = 1; - -extern char *restext; -#define yytext_ptr restext - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up restext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - resleng = (size_t) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 8 -#define YY_END_OF_BUFFER 9 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[28] = - { 0, - 0, 0, 9, 6, 4, 4, 7, 6, 7, 7, - 7, 6, 6, 0, 0, 1, 6, 0, 3, 0, - 0, 2, 0, 5, 0, 3, 0 - } ; - -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 4, 5, 1, 1, 1, 6, 7, - 8, 1, 1, 1, 1, 1, 1, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 1, 1, 1, - 10, 1, 1, 11, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 1, 1, 1, 1, 9, 1, 9, 9, 9, 9, - - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 10, 1, 10, 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, 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, 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, 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 - } ; - -static yyconst flex_int32_t yy_meta[12] = - { 0, - 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, - 1 - } ; - -static yyconst flex_int16_t yy_base[33] = - { 0, - 0, 0, 44, 34, 57, 57, 36, 11, 33, 30, - 57, 16, 28, 25, 27, 57, 0, 25, 57, 34, - 23, 57, 20, 0, 40, 19, 57, 23, 48, 50, - 52, 54 - } ; - -static yyconst flex_int16_t yy_def[33] = - { 0, - 27, 1, 27, 28, 27, 27, 29, 27, 30, 31, - 27, 28, 28, 31, 29, 27, 8, 8, 27, 32, - 30, 27, 31, 12, 32, 31, 0, 27, 27, 27, - 27, 27 - } ; - -static yyconst flex_int16_t yy_nxt[69] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 4, 11, - 12, 17, 18, 19, 18, 17, 18, 20, 18, 17, - 18, 17, 14, 13, 24, 18, 13, 13, 22, 18, - 16, 18, 13, 18, 14, 18, 26, 13, 22, 16, - 14, 17, 26, 27, 27, 27, 27, 17, 15, 15, - 21, 21, 23, 23, 25, 25, 3, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27 - } ; - -static yyconst flex_int16_t yy_chk[69] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 12, 28, 12, 18, 26, 23, 21, 18, - 15, 18, 14, 18, 13, 18, 20, 10, 9, 7, - 4, 20, 25, 3, 0, 0, 0, 25, 29, 29, - 30, 30, 31, 31, 32, 32, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27 - } ; - -/* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[9] = - { 0, -1, 1, 1, 1, 0, 1, 0, 0, }; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int res_flex_debug; -int res_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *restext; -#line 1 "res_lex.l" -/* $Id$ */ -#line 4 "res_lex.l" - -#include "config.h" - -#ifdef HAVE_STRING_H -#include -#endif - -#include "global.h" -#include "resource.h" -#include "res_parse.h" -#include "free_atexit.h" - -#ifdef HAVE_LIBDMALLOC -#include -#endif - -RCSID("$Id$"); - -#define YY_NO_INPUT -#define YY_INPUT(buf,result,max_size) { result = res_parse_getchars(buf, max_size); } - -#ifdef FLEX_SCANNER -#define yyunput ATTRIBUTE_UNUSED yyunput -#endif - -extern int res_lineno; -extern int res_parse_getchars(char *buf, int max_size); - -#line 550 "lex.yy.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int reslex_destroy (void ); - -int resget_debug (void ); - -void resset_debug (int debug_flag ); - -YY_EXTRA_TYPE resget_extra (void ); - -void resset_extra (YY_EXTRA_TYPE user_defined ); - -FILE *resget_in (void ); - -void resset_in (FILE * in_str ); - -FILE *resget_out (void ); - -void resset_out (FILE * out_str ); - -int resget_leng (void ); - -char *resget_text (void ); - -int resget_lineno (void ); - -void resset_lineno (int line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int reswrap (void ); -#else -extern int reswrap (void ); -#endif -#endif - - static void yyunput (int c,char *buf_ptr ); - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#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 do { if (fwrite( restext, resleng, 1, resout )) {} } while (0) -#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_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( resin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( resin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, resin))==0 && ferror(resin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(resin); \ - } \ - }\ -\ - -#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 - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int reslex (void); - -#define YY_DECL int reslex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after restext and resleng - * 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 \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 43 "res_lex.l" - - -#line 740 "lex.yy.c" - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! resin ) - resin = stdin; - - if ( ! resout ) - resout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - resensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - res_create_buffer(resin,YY_BUF_SIZE ); - } - - res_load_buffer_state( ); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of restext. */ - *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_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = 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 >= 28 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 57 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) - { - int yyl; - for ( yyl = 0; yyl < resleng; ++yyl ) - if ( restext[yyl] == '\n' ) - - reslineno++; -; - } - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -/* rule 1 can match eol */ -YY_RULE_SETUP -#line 45 "res_lex.l" -{ reslval.sval = leaky_strdup(restext+1); - reslval.sval[strlen(reslval.sval) - 1] = 0; - return STRING; } - YY_BREAK -case 2: -/* rule 2 can match eol */ -YY_RULE_SETUP -#line 49 "res_lex.l" -{ reslval.sval = leaky_strdup(restext+1); - reslval.sval[strlen(reslval.sval) - 1] = 0; - return STRING; } - YY_BREAK -case 3: -/* rule 3 can match eol */ -YY_RULE_SETUP -#line 53 "res_lex.l" -{ res_lineno++; } - YY_BREAK -case 4: -/* rule 4 can match eol */ -YY_RULE_SETUP -#line 54 "res_lex.l" -{ if (restext[0] == '\n') res_lineno++; } - YY_BREAK -case 5: -YY_RULE_SETUP -#line 56 "res_lex.l" -{ reslval.sval = leaky_strdup(restext); - return INCLUDE; } - YY_BREAK -case 6: -/* rule 6 can match eol */ -YY_RULE_SETUP -#line 59 "res_lex.l" -{ reslval.sval = leaky_strdup(restext); - return STRING; } - YY_BREAK -case 7: -YY_RULE_SETUP -#line 62 "res_lex.l" -{ return restext[0]; } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 64 "res_lex.l" -ECHO; - YY_BREAK -#line 884 "lex.yy.c" -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed resin at a new source and called - * reslex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = resin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( reswrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * restext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ -} /* end of reslex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - resrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), (size_t) num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - resrestart(resin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) resrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = 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 >= 28 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = 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 >= 28 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 27); - - return yy_is_jam ? 0 : yy_current_state; -} - - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up restext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - if ( c == '\n' ){ - --reslineno; - } - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - resrestart(resin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( reswrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve restext */ - (yy_hold_char) = *++(yy_c_buf_p); - - if ( c == '\n' ) - - reslineno++; -; - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void resrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - resensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - res_create_buffer(resin,YY_BUF_SIZE ); - } - - res_init_buffer(YY_CURRENT_BUFFER,input_file ); - res_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void res_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * respop_buffer_state(); - * respush_buffer_state(new_buffer); - */ - resensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - res_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (reswrap()) processing, but the only time this flag - * is looked at is after reswrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void res_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - resin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE res_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) resalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in res_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) resalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in res_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - res_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with res_create_buffer() - * - */ - void res_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - resfree((void *) b->yy_ch_buf ); - - resfree((void *) b ); -} - -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a resrestart() or at EOF. - */ - static void res_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - res_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then res_init_buffer was _probably_ - * called from resrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void res_flush_buffer (YY_BUFFER_STATE b ) -{ - 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 ) - res_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void respush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - resensure_buffer_stack(); - - /* This block is copied from res_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from res_switch_to_buffer. */ - res_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void respop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - res_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - res_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void resensure_buffer_stack (void) -{ - int num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)resalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in resensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)resrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in resensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE res_scan_buffer (char * base, yy_size_t size ) -{ - 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) resalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in res_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; - - res_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to reslex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * res_scan_bytes() instead. - */ -YY_BUFFER_STATE res_scan_string (yyconst char * yystr ) -{ - - return res_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to reslex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE res_scan_bytes (yyconst char * yybytes, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) resalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in res_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = res_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in res_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; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (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 restext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - restext[resleng] = (yy_hold_char); \ - (yy_c_buf_p) = restext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - resleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int resget_lineno (void) -{ - - return reslineno; -} - -/** Get the input stream. - * - */ -FILE *resget_in (void) -{ - return resin; -} - -/** Get the output stream. - * - */ -FILE *resget_out (void) -{ - return resout; -} - -/** Get the length of the current token. - * - */ -int resget_leng (void) -{ - return resleng; -} - -/** Get the current token. - * - */ - -char *resget_text (void) -{ - return restext; -} - -/** Set the current line number. - * @param line_number - * - */ -void resset_lineno (int line_number ) -{ - - reslineno = line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param in_str A readable stream. - * - * @see res_switch_to_buffer - */ -void resset_in (FILE * in_str ) -{ - resin = in_str ; -} - -void resset_out (FILE * out_str ) -{ - resout = out_str ; -} - -int resget_debug (void) -{ - return res_flex_debug; -} - -void resset_debug (int bdebug ) -{ - res_flex_debug = bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from reslex_destroy(), so don't allocate here. - */ - - /* We do not touch reslineno unless the option is enabled. */ - reslineno = 1; - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - resin = stdin; - resout = stdout; -#else - resin = (FILE *) 0; - resout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * reslex_init() - */ - return 0; -} - -/* reslex_destroy is for both reentrant and non-reentrant scanners. */ -int reslex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - res_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - respop_buffer_state(); - } - - /* Destroy the stack itself. */ - resfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * reslex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *resalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *resrealloc (void * ptr, yy_size_t size ) -{ - /* 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 ); -} - -void resfree (void * ptr ) -{ - free( (char *) ptr ); /* see resrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 64 "res_lex.l" - - - -/* ' */ - Index: src/res_lex.l =================================================================== --- src/res_lex.l (revision 1433) +++ src/res_lex.l (nonexistent) @@ -1,66 +0,0 @@ -/* $Id$ */ - -%{ - -#include "config.h" - -#ifdef HAVE_STRING_H -#include -#endif - -#include "global.h" -#include "resource.h" -#include "res_parse.h" -#include "free_atexit.h" - -#ifdef HAVE_LIBDMALLOC -#include -#endif - -RCSID("$Id$"); - -#define YY_NO_INPUT -#define YY_INPUT(buf,result,max_size) { result = res_parse_getchars(buf, max_size); } - -#ifdef FLEX_SCANNER -#define yyunput ATTRIBUTE_UNUSED yyunput -#endif - -extern int res_lineno; -extern int res_parse_getchars(char *buf, int max_size); - -%} - -%option prefix="res" -%option outfile="lex.yy.c" -%option yylineno -%option noyywrap - -PARENSTR ([^ (){}=\"\'\t\r\n]|\([^\)]*\))+ -INCSTR @[a-z0-9A-Z_]+ -COMMENT #[^\n]* - -%% - -\"[^"]*\" { reslval.sval = leaky_strdup(yytext+1); - reslval.sval[strlen(reslval.sval) - 1] = 0; - return STRING; } - -\'[^']*\' { reslval.sval = leaky_strdup(yytext+1); - reslval.sval[strlen(reslval.sval) - 1] = 0; - return STRING; } - -{COMMENT}\n { res_lineno++; } -[ \t\r\n] { if (yytext[0] == '\n') res_lineno++; } - -{INCSTR} { reslval.sval = leaky_strdup(yytext); - return INCLUDE; } - -{PARENSTR} { reslval.sval = leaky_strdup(yytext); - return STRING; } - -. { return yytext[0]; } - -%% - -/* ' */ Index: src/res_parse.c =================================================================== --- src/res_parse.c (revision 1433) +++ src/res_parse.c (nonexistent) @@ -1,1672 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - - This program 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 3 of the License, or - (at your option) any later version. - - This program 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, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "3.0.2" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - - -/* Substitute the variable and function names. */ -#define yyparse resparse -#define yylex reslex -#define yyerror reserror -#define yydebug resdebug -#define yynerrs resnerrs - -#define yylval reslval -#define yychar reschar - -/* Copy the first part of user declarations. */ -#line 3 "res_parse.y" /* yacc.c:339 */ - - -#include "config.h" - - -#include -#include - -#include "free_atexit.h" - -#ifdef HAVE_STRING_H -#include -#endif - -#define YYDEBUG 0 -#define YYERROR_VERBOSE 1 - - /* #define YYSTYPE void * */ - -#include "global.h" -#include "resource.h" -#include "res_parse.h" - - -RCSID("$Id$"); - -static Resource *parsed_res; -static Resource *current_res; - -int reserror(char *); -int reslex(); - -#define f(x) current_res->flags |= x - - -#line 110 "res_parse.tab.c" /* yacc.c:339 */ - -# ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "res_parse.tab.h". */ -#ifndef YY_RES_RES_PARSE_TAB_H_INCLUDED -# define YY_RES_RES_PARSE_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int resdebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - STRING = 258, - INCLUDE = 259 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE -{ -#line 42 "res_parse.y" /* yacc.c:355 */ - - int ival; - char *sval; - Resource *rval; - -#line 161 "res_parse.tab.c" /* yacc.c:355 */ -}; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE reslval; - -int resparse (void); - -#endif /* !YY_RES_RES_PARSE_TAB_H_INCLUDED */ - -/* Copy the second part of user declarations. */ - -#line 176 "res_parse.tab.c" /* yacc.c:358 */ - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#else -typedef signed char yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) -#else -# define YYUSE(E) /* empty */ -#endif - -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -# define YY_INITIAL_VALUE(Value) Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -# include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 3 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 25 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 8 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 7 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 13 -/* YYNSTATES -- Number of states. */ -#define YYNSTATES 18 - -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 259 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 7, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 5, 2, 6, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4 -}; - -#if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint8 yyrline[] = -{ - 0, 54, 54, 54, 59, 59, 64, 64, 66, 67, - 68, 69, 70, 71 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || 0 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "STRING", "INCLUDE", "'{'", "'}'", "'='", - "$accept", "top_res", "$@1", "res", "$@2", "res_item_zm", "res_item", YY_NULLPTR -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 123, 125, 61 -}; -# endif - -#define YYPACT_NINF -1 - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-1))) - -#define YYTABLE_NINF -8 - -#define yytable_value_is_error(Yytable_value) \ - 0 - - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int8 yypact[] = -{ - -1, 2, 7, -1, -1, 13, -1, -1, 4, -1, - 0, 11, 12, -1, -1, -1, 16, -1 -}; - - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 2, 0, 0, 1, 13, 8, 10, 11, 0, 3, - 0, 4, 0, 6, 9, 12, 0, 5 -}; - - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = -{ - -1, -1, -1, 14, -1, 9, -1 -}; - - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 1, 2, 7, 8, 9, 10 -}; - - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_int8 yytable[] = -{ - -7, 4, 3, 5, 6, -4, -7, -7, 4, 12, - 5, 6, -4, 4, 14, 5, 6, -4, -7, 13, - 11, 16, 17, 0, 0, 15 -}; - -static const yytype_int8 yycheck[] = -{ - 0, 1, 0, 3, 4, 5, 6, 0, 1, 5, - 3, 4, 5, 1, 3, 3, 4, 5, 6, 10, - 7, 12, 6, -1, -1, 11 -}; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 9, 10, 0, 1, 3, 4, 11, 12, 13, - 14, 7, 5, 13, 3, 11, 13, 6 -}; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 8, 10, 9, 12, 11, 13, 13, 14, 14, - 14, 14, 14, 14 -}; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 0, 2, 0, 4, 2, 0, 1, 3, - 1, 1, 3, 1 -}; - - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - - - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ - -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -{ - FILE *yyo = yyoutput; - YYUSE (yyo); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - YYUSE (yytype); -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -{ - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) -{ - unsigned long int yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, Rule); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -yystrlen (const char *yystr) -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -{ - YYUSE (yyvaluep); - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END -} - - - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - -/*----------. -| yyparse. | -`----------*/ - -int -yyparse (void) -{ - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (); - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: -#line 54 "res_parse.y" /* yacc.c:1646 */ - { current_res = parsed_res = resource_create(NULL); } -#line 1251 "res_parse.tab.c" /* yacc.c:1646 */ - break; - - case 4: -#line 59 "res_parse.y" /* yacc.c:1646 */ - { current_res = resource_create(current_res); } -#line 1257 "res_parse.tab.c" /* yacc.c:1646 */ - break; - - case 5: -#line 61 "res_parse.y" /* yacc.c:1646 */ - { (yyval.rval) = current_res; current_res = current_res->parent; } -#line 1263 "res_parse.tab.c" /* yacc.c:1646 */ - break; - - case 8: -#line 66 "res_parse.y" /* yacc.c:1646 */ - { resource_add_val(current_res, 0, (yyvsp[0].sval), 0); f(FLAG_V); } -#line 1269 "res_parse.tab.c" /* yacc.c:1646 */ - break; - - case 9: -#line 67 "res_parse.y" /* yacc.c:1646 */ - { resource_add_val(current_res, (yyvsp[-2].sval), (yyvsp[0].sval), 0); f(FLAG_NV); } -#line 1275 "res_parse.tab.c" /* yacc.c:1646 */ - break; - - case 10: -#line 68 "res_parse.y" /* yacc.c:1646 */ - { resource_add_val(current_res, 0, (yyvsp[0].sval), 0); f(FLAG_S); } -#line 1281 "res_parse.tab.c" /* yacc.c:1646 */ - break; - - case 11: -#line 69 "res_parse.y" /* yacc.c:1646 */ - { resource_add_val(current_res, 0, 0, (yyvsp[0].rval)); f(FLAG_S); } -#line 1287 "res_parse.tab.c" /* yacc.c:1646 */ - break; - - case 12: -#line 70 "res_parse.y" /* yacc.c:1646 */ - { resource_add_val(current_res, (yyvsp[-2].sval), 0, (yyvsp[0].rval)); f(FLAG_NS); } -#line 1293 "res_parse.tab.c" /* yacc.c:1646 */ - break; - - -#line 1297 "res_parse.tab.c" /* yacc.c:1646 */ - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now 'shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ -yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule whose action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - } - /* Do not reclaim the symbols of the rule whose action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - return yyresult; -} -#line 74 "res_parse.y" /* yacc.c:1906 */ - - -static const char *res_filename = 0; -static FILE *res_file = 0; -static const char **res_strings = 0; -static int res_string_idx = 0; -int res_lineno; - -int -res_parse_getchars(char *buf, int max_size) -{ - if (res_file) - { - int i = fgetc(res_file); - buf[0] = i; - if (i == EOF) - return 0; - } - else - { - if (res_strings[0] == 0) - return 0; - buf[0] = res_strings[0][res_string_idx]; - res_string_idx ++; - if (buf[0] == 0) - { - res_strings ++; - res_string_idx = 0; - buf[0] = '\n'; - return 1; - } - } - return 1; -} - -Resource * -resource_parse(const char *filename, const char **strings) -{ - res_lineno = 1; - if (filename) - { - res_filename = filename; - res_file = fopen (filename, "r"); - if (res_file == NULL) - { - perror(filename); - return 0; - } - } - else if (strings) - { - res_filename = NULL; - res_strings = strings; - res_string_idx = 0; - } - else - return NULL; -#if YYDEBUG - yydebug = 1; -#endif - if (resparse()) - return 0; - if (filename) - fclose (res_file); - else - res_strings = 0; - return parsed_res; -} - -Resource * -resource_create(Resource *parent) -{ - Resource *rv = (Resource *)leaky_malloc(sizeof(Resource)); - rv->parent = parent; - rv->flags = 0; - rv->c = 0; - rv->v = (ResourceVal *)leaky_malloc(sizeof(ResourceVal)); - return rv; -} - -void -resource_add_val(Resource *n, char *name, char *value, Resource *subres) -{ - n->v = (ResourceVal *)leaky_realloc(n->v, sizeof(ResourceVal)*(n->c+1)); - n->v[n->c].name = name; - n->v[n->c].value = value; - n->v[n->c].subres = subres; - n->c++; -} - -char * -resource_value(const Resource *res, char *name) -{ - int i; - if (res == 0 || name == 0) - return 0; - for (i=0; ic; i++) - if (res->v[i].name && res->v[i].value - && NSTRCMP(res->v[i].name, name) == 0) - return res->v[i].value; - return 0; -} - -Resource * -resource_subres(const Resource *res, const char *name) -{ - int i; - if (res == 0 || name == 0) - return 0; - for (i=0; ic; i++) - if (res->v[i].name && res->v[i].subres - && NSTRCMP(res->v[i].name, name) == 0) - return res->v[i].subres; - return 0; -} - -int -reserror(char *str) -{ - fprintf(stderr, "Error: %s around line %d: %s\n", - res_file ? res_filename : "internal strings", - res_lineno, str); - return 0; -} - -static void -dump_res(Resource *n, int l) -{ - int i; - for (i=0; ic; i++) - { - if (n->v[i].subres) - { - printf("%*cn[%s] = {\n", l, ' ', n->v[i].name? n->v[i].name :""); - dump_res(n->v[i].subres, l+3); - printf("%*c}\n", l, ' '); - } - else - printf("%*cn[%s] = v[%s]\n", l, ' ', n->v[i].name? n->v[i].name :"", n->v[i].value? n->v[i].value :""); - } -} - -void -resource_dump (Resource *r) -{ - dump_res (r, 0); -} - Index: src/res_parse.h =================================================================== --- src/res_parse.h (revision 1433) +++ src/res_parse.h (nonexistent) @@ -1,75 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.2. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - - This program 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 3 of the License, or - (at your option) any later version. - - This program 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, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -#ifndef YY_RES_RES_PARSE_TAB_H_INCLUDED -# define YY_RES_RES_PARSE_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int resdebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - STRING = 258, - INCLUDE = 259 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE YYSTYPE; -union YYSTYPE -{ -#line 42 "res_parse.y" /* yacc.c:1909 */ - - int ival; - char *sval; - Resource *rval; - -#line 65 "res_parse.tab.h" /* yacc.c:1909 */ -}; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE reslval; - -int resparse (void); - -#endif /* !YY_RES_RES_PARSE_TAB_H_INCLUDED */ Index: src/res_parse.y =================================================================== --- src/res_parse.y (revision 1433) +++ src/res_parse.y (nonexistent) @@ -1,221 +0,0 @@ -/* $Id$ */ - -%{ - -#include "config.h" - - -#include -#include - -#include "free_atexit.h" - -#ifdef HAVE_STRING_H -#include -#endif - -#define YYDEBUG 0 -#define YYERROR_VERBOSE 1 - - /* #define YYSTYPE void * */ - -#include "global.h" -#include "resource.h" -#include "res_parse.h" - - -RCSID("$Id$"); - -static Resource *parsed_res; -static Resource *current_res; - -int reserror(char *); -int reslex(); - -#define f(x) current_res->flags |= x - -%} - -%name-prefix="res" -%start top_res - -%union { - int ival; - char *sval; - Resource *rval; -}; - -%token STRING INCLUDE -%type res - -%% - -top_res - : { current_res = parsed_res = resource_create(NULL); } - res_item_zm - ; - -res - : { current_res = resource_create(current_res); } - '{' res_item_zm '}' - { $$ = current_res; current_res = current_res->parent; } - ; - -res_item_zm : res_item res_item_zm | ; -res_item - : STRING { resource_add_val(current_res, 0, $1, 0); f(FLAG_V); } - | STRING '=' STRING { resource_add_val(current_res, $1, $3, 0); f(FLAG_NV); } - | INCLUDE { resource_add_val(current_res, 0, $1, 0); f(FLAG_S); } - | res { resource_add_val(current_res, 0, 0, $1); f(FLAG_S); } - | STRING '=' res { resource_add_val(current_res, $1, 0, $3); f(FLAG_NS); } - | error - ; - -%% - -static const char *res_filename = 0; -static FILE *res_file = 0; -static const char **res_strings = 0; -static int res_string_idx = 0; -int res_lineno; - -int -res_parse_getchars(char *buf, int max_size) -{ - if (res_file) - { - int i = fgetc(res_file); - buf[0] = i; - if (i == EOF) - return 0; - } - else - { - if (res_strings[0] == 0) - return 0; - buf[0] = res_strings[0][res_string_idx]; - res_string_idx ++; - if (buf[0] == 0) - { - res_strings ++; - res_string_idx = 0; - buf[0] = '\n'; - return 1; - } - } - return 1; -} - -Resource * -resource_parse(const char *filename, const char **strings) -{ - res_lineno = 1; - if (filename) - { - res_filename = filename; - res_file = fopen (filename, "r"); - if (res_file == NULL) - { - perror(filename); - return 0; - } - } - else if (strings) - { - res_filename = NULL; - res_strings = strings; - res_string_idx = 0; - } - else - return NULL; -#if YYDEBUG - yydebug = 1; -#endif - if (resparse()) - return 0; - if (filename) - fclose (res_file); - else - res_strings = 0; - return parsed_res; -} - -Resource * -resource_create(Resource *parent) -{ - Resource *rv = (Resource *)leaky_malloc(sizeof(Resource)); - rv->parent = parent; - rv->flags = 0; - rv->c = 0; - rv->v = (ResourceVal *)leaky_malloc(sizeof(ResourceVal)); - return rv; -} - -void -resource_add_val(Resource *n, char *name, char *value, Resource *subres) -{ - n->v = (ResourceVal *)leaky_realloc(n->v, sizeof(ResourceVal)*(n->c+1)); - n->v[n->c].name = name; - n->v[n->c].value = value; - n->v[n->c].subres = subres; - n->c++; -} - -char * -resource_value(const Resource *res, char *name) -{ - int i; - if (res == 0 || name == 0) - return 0; - for (i=0; ic; i++) - if (res->v[i].name && res->v[i].value - && NSTRCMP(res->v[i].name, name) == 0) - return res->v[i].value; - return 0; -} - -Resource * -resource_subres(const Resource *res, const char *name) -{ - int i; - if (res == 0 || name == 0) - return 0; - for (i=0; ic; i++) - if (res->v[i].name && res->v[i].subres - && NSTRCMP(res->v[i].name, name) == 0) - return res->v[i].subres; - return 0; -} - -int -reserror(char *str) -{ - fprintf(stderr, "Error: %s around line %d: %s\n", - res_file ? res_filename : "internal strings", - res_lineno, str); - return 0; -} - -static void -dump_res(Resource *n, int l) -{ - int i; - for (i=0; ic; i++) - { - if (n->v[i].subres) - { - printf("%*cn[%s] = {\n", l, ' ', n->v[i].name? n->v[i].name :""); - dump_res(n->v[i].subres, l+3); - printf("%*c}\n", l, ' '); - } - else - printf("%*cn[%s] = v[%s]\n", l, ' ', n->v[i].name? n->v[i].name :"", n->v[i].value? n->v[i].value :""); - } -} - -void -resource_dump (Resource *r) -{ - dump_res (r, 0); -} - Index: src/resource.h =================================================================== --- src/resource.h (revision 1433) +++ src/resource.h (nonexistent) @@ -1,43 +0,0 @@ -/* $Id$ */ - -#ifndef PCB_RESOURCE_H -#define PCB_RESOURCE_H - -#include - - struct Resource; - - typedef struct ResourceVal { - char *name; - char *value; - struct Resource *subres; - } ResourceVal; - -#define FLAG_V 1 -#define FLAG_NV 2 -#define FLAG_S 4 -#define FLAG_NS 8 - - typedef struct Resource { - struct Resource *parent; - void *user_ptr; - int flags; - int c; /* number of v[i] */ - ResourceVal *v; - } Resource; - -#define resource_type(resval) (((resval).name?100:0)+((resval).value?10:0)+((resval).subres?1:0)) - -/* res_parse.y */ - -/* Pass either filename OR stringtab. */ - Resource *resource_parse(const char *filename, const char **stringtab); - char *resource_value(const Resource * res, char *name); - Resource *resource_subres(const Resource * res, const char *name); - - Resource *resource_create(Resource * parent); - void resource_add_val(Resource * n, char *name, char *value, Resource * subres); - - void resource_dump(Resource * res); - -#endif Index: src/Makefile.dep =================================================================== --- src/Makefile.dep (revision 1433) +++ src/Makefile.dep (revision 1434) @@ -267,12 +267,15 @@ list_pad.h list_pin.h list_rat.h vtonpoint.h \ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + list_element.h plug_footprint.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h \ ../src_plugins/hid_gtk/ghid-cell-renderer-visibility.h ../src_plugins/hid_gtk/ghid-coord-entry.o: \ @@ -286,12 +289,15 @@ list_pad.h list_pin.h list_rat.h vtonpoint.h \ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + list_element.h plug_footprint.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h pcb-printf.h ../src_plugins/hid_gtk/ghid-layer-selector.o: \ ../src_plugins/hid_gtk/ghid-layer-selector.c \ @@ -304,12 +310,15 @@ list_pad.h list_pin.h list_rat.h vtonpoint.h \ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + list_element.h plug_footprint.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h pcb-printf.h \ ../src_plugins/hid_gtk/ghid-cell-renderer-visibility.h ../src_plugins/hid_gtk/ghid-main-menu.o: \ @@ -322,12 +331,15 @@ list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + list_element.h plug_footprint.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h pcb-printf.h ../src_plugins/hid_gtk/ghid-route-style-selector.o: \ ../src_plugins/hid_gtk/ghid-route-style-selector.c global.h ../config.h \ @@ -339,12 +351,15 @@ vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ list_element.h plug_footprint.h ../src_plugins/hid_gtk/gtkhid.h \ - ../src_plugins/hid_gtk/gui.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + ../src_plugins/hid_gtk/gui.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h pcb-printf.h ../src_plugins/hid_gtk/gtkhid-gdk.o: ../src_plugins/hid_gtk/gtkhid-gdk.c \ ../config.h ../config.manual.h ../config.auto.h crosshair.h global.h \ @@ -356,12 +371,15 @@ vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ list_element.h plug_footprint.h clip.h ../src_plugins/hid_gtk/gui.h \ - global.h hid.h hid_resource.h resource.h data.h misc.h \ + global.h hid.h hid_resource.h ../src_3rd/liblihata/dom.h \ + ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ + ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ + ../src_3rd/liblihata/genht/ht_inlines.h data.h misc.h \ ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h hid_draw_helpers.h \ hid_attrib.h hid_helper.h hid_color.h ../src_plugins/hid_gtk/gtkhid-main.o: \ @@ -375,12 +393,15 @@ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ list_element.h plug_footprint.h crosshair.h error.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_resource.h resource.h \ + ../src_plugins/hid_gtk/gui.h global.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ data.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h hid_nogui.h \ hid_draw_helpers.h pcb-printf.h plugins.h hid_attrib.h hid_init.h \ hid_flags.h hid_actions.h dolists.h @@ -394,12 +415,15 @@ list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + list_element.h plug_footprint.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h crosshair.h hid_actions.h ../src_plugins/hid_gtk/gui-config.o: ../src_plugins/hid_gtk/gui-config.c \ ../config.h ../config.manual.h ../config.auto.h \ @@ -411,12 +435,15 @@ list_pad.h list_pin.h list_rat.h vtonpoint.h \ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + list_element.h plug_footprint.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h \ ../src_plugins/hid_gtk/gtkhid.h action_helper.h change.h file.h error.h \ draw.h pcb-printf.h set.h hid_attrib.h compat_fs.h @@ -430,12 +457,15 @@ list_pad.h list_pin.h list_rat.h vtonpoint.h \ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + list_element.h plug_footprint.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h pcb-printf.h hid_attrib.h \ hid_init.h ../src_plugins/hid_gtk/gui-dialog.o: ../src_plugins/hid_gtk/gui-dialog.c \ @@ -448,11 +478,15 @@ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ list_element.h plug_footprint.h ../src_plugins/hid_gtk/gui.h global.h \ - hid.h hid_resource.h resource.h misc.h ../src_3rd/genvector/gds_char.h \ - mymem.h ../src_plugins/hid_gtk/ghid-coord-entry.h \ + hid.h hid_resource.h ../src_3rd/liblihata/dom.h \ + ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ + ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ + ../src_3rd/liblihata/genht/ht_inlines.h misc.h \ + ../src_3rd/genvector/gds_char.h mymem.h \ + ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h ../src_plugins/hid_gtk/gui-drc-window.o: \ ../src_plugins/hid_gtk/gui-drc-window.c ../config.h ../config.manual.h \ @@ -466,11 +500,14 @@ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ list_element.h plug_footprint.h draw.h pcb-printf.h \ ../src_3rd/genvector/gds_char.h undo.h set.h \ - ../src_plugins/hid_gtk/gui.h global.h hid.h hid_resource.h resource.h \ + ../src_plugins/hid_gtk/gui.h global.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ data.h misc.h mymem.h ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h \ ../src_plugins/hid_gtk/gui-drc-window.h hid_actions.h ../src_plugins/hid_gtk/gui-keyref-window.o: \ @@ -483,12 +520,15 @@ list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + list_element.h plug_footprint.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h ../src_plugins/hid_gtk/gui-library-window.o: \ ../src_plugins/hid_gtk/gui-library-window.c ../config.h \ @@ -500,12 +540,15 @@ list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + list_element.h plug_footprint.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h buffer.h set.h \ ../src_plugins/hid_gtk/gui-library-window.h ../src_plugins/hid_gtk/gui-log-window.o: \ @@ -518,12 +561,15 @@ list_pad.h list_pin.h list_rat.h vtonpoint.h \ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + list_element.h plug_footprint.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h pcb-printf.h ../src_plugins/hid_gtk/gui-misc.o: ../src_plugins/hid_gtk/gui-misc.c \ ../config.h ../config.manual.h ../config.auto.h global.h const.h \ @@ -537,10 +583,13 @@ list_element.h plug_footprint.h crosshair.h global.h data.h misc.h \ ../src_3rd/genvector/gds_char.h mymem.h action_helper.h set.h \ pcb-printf.h ../src_plugins/hid_gtk/gui.h hid.h hid_resource.h \ - resource.h ../src_plugins/hid_gtk/ghid-coord-entry.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h ../src_plugins/hid_gtk/gui-netlist-window.o: \ ../src_plugins/hid_gtk/gui-netlist-window.c ../config.h \ @@ -555,11 +604,14 @@ list_element.h plug_footprint.h create.h global.h data.h draw.h error.h \ find.h misc.h ../src_3rd/genvector/gds_char.h mymem.h mymem.h rats.h \ remove.h search.h select.h set.h undo.h hid_actions.h \ - ../src_plugins/hid_gtk/gui.h hid.h hid_resource.h resource.h \ + ../src_plugins/hid_gtk/gui.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h ../src_plugins/hid_gtk/gui-output-events.o: \ ../src_plugins/hid_gtk/gui-output-events.c ../config.h \ @@ -571,12 +623,15 @@ list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + list_element.h plug_footprint.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h \ ../src_plugins/hid_gtk/gtkhid.h action_helper.h crosshair.h draw.h \ error.h set.h find.h search.h rats.h @@ -591,12 +646,14 @@ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ list_element.h plug_footprint.h ../src_plugins/hid_gtk/gui.h hid.h \ - hid_resource.h resource.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h \ + hid_resource.h ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h copy.h draw.h mymem.h move.h \ rotate.h ../src_plugins/hid_gtk/gui-pinout-window.o: \ @@ -610,12 +667,14 @@ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ list_element.h plug_footprint.h ../src_plugins/hid_gtk/gui.h hid.h \ - hid_resource.h resource.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h \ + hid_resource.h ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h copy.h draw.h mymem.h move.h \ rotate.h ../src_plugins/hid_gtk/gui-top-window.o: \ @@ -630,10 +689,13 @@ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ list_element.h plug_footprint.h ../src_plugins/hid_gtk/gtkhid.h \ - ../src_plugins/hid_gtk/gui.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + ../src_plugins/hid_gtk/gui.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ - ../src_plugins/hid_gtk/ghid-main-menu.h resource.h \ + ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h action_helper.h buffer.h \ change.h copy.h create.h crosshair.h draw.h error.h file.h find.h \ gpcb-menu.h insert.h line.h mymem.h move.h pcb-printf.h polygon.h rats.h \ @@ -651,97 +713,16 @@ list_pad.h list_pin.h list_rat.h vtonpoint.h \ ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h hid.h hid_resource.h resource.h data.h \ - global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ + list_element.h plug_footprint.h hid.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + data.h global.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ ../src_plugins/hid_gtk/ghid-coord-entry.h \ ../src_plugins/hid_gtk/ghid-main-menu.h \ ../src_plugins/hid_gtk/ghid-layer-selector.h \ - ../src_plugins/hid_gtk/ghid-route-style-selector.h resource.h \ + ../src_plugins/hid_gtk/ghid-route-style-selector.h \ ../src_plugins/hid_gtk/gui-pinout-preview.h -../src_plugins/hid_lesstif/dialogs.o: \ - ../src_plugins/hid_lesstif/dialogs.c ../config.h ../config.manual.h \ - ../config.auto.h ../src_plugins/hid_lesstif/xincludes.h compat_misc.h \ - global.h const.h ../globalconst.h ../config.h macro.h global_typedefs.h \ - global_objs.h ../src_3rd/genlist/gendlist.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h data.h global.h crosshair.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h pcb-printf.h hid.h \ - ../src_plugins/hid_lesstif/lesstif.h hid_attrib.h hid_actions.h \ - hid_init.h -../src_plugins/hid_lesstif/library.o: \ - ../src_plugins/hid_lesstif/library.c ../config.h ../config.manual.h \ - ../config.auto.h ../src_plugins/hid_lesstif/xincludes.h compat_misc.h \ - global.h const.h ../globalconst.h ../config.h macro.h global_typedefs.h \ - global_objs.h ../src_3rd/genlist/gendlist.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h data.h global.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h set.h buffer.h hid.h \ - ../src_plugins/hid_lesstif/lesstif.h -../src_plugins/hid_lesstif/main.o: ../src_plugins/hid_lesstif/main.c \ - ../config.h ../config.manual.h ../config.auto.h \ - ../src_plugins/hid_lesstif/xincludes.h global.h const.h ../globalconst.h \ - ../config.h macro.h global_typedefs.h global_objs.h \ - ../src_3rd/genlist/gendlist.h polyarea.h list_common.h list_line.h \ - ../src_3rd/genlist/gentdlist_impl.h ../src_3rd/genlist/gendlist.h \ - ../src_3rd/genlist/gentdlist_undef.h list_arc.h list_text.h list_poly.h \ - list_pad.h list_pin.h list_rat.h vtonpoint.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h data.h global.h action_helper.h \ - crosshair.h mymem.h misc.h ../src_3rd/genvector/gds_char.h mymem.h \ - pcb-printf.h resource.h clip.h event.h error.h plugins.h hid.h \ - hid_nogui.h hid_draw_helpers.h hid_resource.h resource.h \ - ../src_plugins/hid_lesstif/lesstif.h hid_attrib.h hid_helper.h \ - hid_init.h hid_color.h hid_extents.h hid_flags.h hid_actions.h dolists.h -../src_plugins/hid_lesstif/menu.o: ../src_plugins/hid_lesstif/menu.c \ - ../config.h ../config.manual.h ../config.auto.h \ - ../src_plugins/hid_lesstif/xincludes.h global.h const.h ../globalconst.h \ - ../config.h macro.h global_typedefs.h global_objs.h \ - ../src_3rd/genlist/gendlist.h polyarea.h list_common.h list_line.h \ - ../src_3rd/genlist/gentdlist_impl.h ../src_3rd/genlist/gendlist.h \ - ../src_3rd/genlist/gentdlist_undef.h list_arc.h list_text.h list_poly.h \ - list_pad.h list_pin.h list_rat.h vtonpoint.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h data.h global.h error.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h pcb-printf.h hid.h \ - hid_resource.h resource.h resource.h \ - ../src_plugins/hid_lesstif/lesstif.h mymem.h paths.h hid_actions.h \ - hid_flags.h pcb-menu.h -../src_plugins/hid_lesstif/netlist.o: \ - ../src_plugins/hid_lesstif/netlist.c ../config.h ../config.manual.h \ - ../config.auto.h ../src_plugins/hid_lesstif/xincludes.h compat_misc.h \ - global.h const.h ../globalconst.h ../config.h macro.h global_typedefs.h \ - global_objs.h ../src_3rd/genlist/gendlist.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h data.h global.h find.h rats.h select.h \ - undo.h remove.h crosshair.h draw.h hid.h hid_actions.h \ - ../src_plugins/hid_lesstif/lesstif.h -../src_plugins/hid_lesstif/styles.o: ../src_plugins/hid_lesstif/styles.c \ - ../config.h ../config.manual.h ../config.auto.h \ - ../src_plugins/hid_lesstif/xincludes.h compat_misc.h global.h const.h \ - ../globalconst.h ../config.h macro.h global_typedefs.h global_objs.h \ - ../src_3rd/genlist/gendlist.h polyarea.h list_common.h list_line.h \ - ../src_3rd/genlist/gentdlist_impl.h ../src_3rd/genlist/gendlist.h \ - ../src_3rd/genlist/gentdlist_undef.h list_arc.h list_text.h list_poly.h \ - list_pad.h list_pin.h list_rat.h vtonpoint.h \ - ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h data.h global.h set.h misc.h \ - ../src_3rd/genvector/gds_char.h mymem.h mymem.h pcb-printf.h hid.h \ - ../src_plugins/hid_lesstif/lesstif.h hid_flags.h ../src_plugins/import_edif/edif.o: ../src_plugins/import_edif/edif.c \ global.h ../config.h ../config.manual.h ../config.auto.h const.h \ ../globalconst.h ../config.h macro.h global_typedefs.h global_objs.h \ @@ -896,9 +877,9 @@ list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h data.h draw.h error.h global.h \ - resource.h set.h undo.h ../src_plugins/vendordrill/vendor.h \ - stub_vendor.h plugins.h hid_flags.h hid_actions.h dolists.h + list_element.h plug_footprint.h data.h draw.h error.h global.h set.h \ + undo.h ../src_plugins/vendordrill/vendor.h stub_vendor.h plugins.h \ + hid_flags.h hid_actions.h dolists.h gds_char.o: ../src_3rd/genvector/gds_char.c \ ../src_3rd/genvector/gds_char.h ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h \ @@ -1257,7 +1238,11 @@ list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h resource.h hid_resource.h hid_actions.h + list_element.h plug_footprint.h hid_resource.h \ + ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ + ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + hid_actions.h ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/tree.h insert.o: insert.c ../config.h ../config.manual.h ../config.auto.h \ global.h const.h ../globalconst.h ../config.h macro.h global_typedefs.h \ global_objs.h ../src_3rd/genlist/gendlist.h polyarea.h list_common.h \ @@ -1573,24 +1558,6 @@ ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ list_element.h plug_footprint.h data.h action_helper.h change.h error.h \ undo.h set.h remove.h funchash_core.h funchash.h funchash_core_list.h -res_lex.o: res_lex.c ../config.h ../config.manual.h ../config.auto.h \ - global.h const.h ../globalconst.h ../config.h macro.h global_typedefs.h \ - global_objs.h ../src_3rd/genlist/gendlist.h polyarea.h list_common.h \ - list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h resource.h res_parse.h free_atexit.h -res_parse.o: res_parse.c ../config.h ../config.manual.h ../config.auto.h \ - free_atexit.h global.h const.h ../globalconst.h ../config.h macro.h \ - global_typedefs.h global_objs.h ../src_3rd/genlist/gendlist.h polyarea.h \ - list_common.h list_line.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ - list_arc.h list_text.h list_poly.h list_pad.h list_pin.h list_rat.h \ - vtonpoint.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h hid.h global_element.h \ - list_element.h plug_footprint.h resource.h res_parse.h rotate.o: rotate.c ../config.h ../config.manual.h ../config.auto.h \ global.h const.h ../globalconst.h ../config.h macro.h global_typedefs.h \ global_objs.h ../src_3rd/genlist/gendlist.h polyarea.h list_common.h \ Index: src/Makefile.in =================================================================== --- src/Makefile.in (revision 1433) +++ src/Makefile.in (revision 1434) @@ -95,20 +95,32 @@ undo.o undo_act.o vtonpoint.o - res_parse.o - res_lex.o parse_y.o parse_l.o buildin.o + ../src_3rd/liblihata/parser.o + ../src_3rd/liblihata/dom.o + ../src_3rd/liblihata/dom_list.o + ../src_3rd/liblihata/dom_hash.o + ../src_3rd/liblihata/dom_table.o + ../src_3rd/liblihata/lihata.o + ../src_3rd/liblihata/hash_str.o + ../src_3rd/liblihata/tree.o + ../src_3rd/liblihata/tree_list.o + ../src_3rd/liblihata/tree_hash.o + ../src_3rd/liblihata/tree_table.o + ../src_3rd/liblihata/tree_symlink.o + ../src_3rd/liblihata/tree_path.o ../src_3rd/liblihata/genht/hash.o ../src_3rd/liblihata/genht/htsp.o ../src_3rd/liblihata/genht/htpi.o + ../src_3rd/liblihata/genht/htip.o ../src_3rd/genvector/gds_char.o @] # main: language generator files -put /local/pcb/YACC {res_parse parse_y} -put /local/pcb/LEX {res_lex parse_l} +put /local/pcb/YACC {parse_y} +put /local/pcb/LEX {parse_l} # main: action registrations put /local/pcb/ACTION_REG_SRC { Index: src/hid_resource.c =================================================================== --- src/hid_resource.c (revision 1433) +++ src/hid_resource.c (revision 1434) @@ -1,268 +1,295 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 2016 Tibor 'Igor2' Palinkas + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +#include +#include #include -#include -#include +#include +#include +#include #include "global.h" #include "hid.h" -#include "resource.h" #include "hid_resource.h" #include "hid_actions.h" +#include "hid_resource.h" +#include "error.h" -/* #define DEBUG_HID_RESOURCE */ +static void hid_res_flush(hid_res_t *hr); -static int button_count; /* number of buttons we have actions for */ -static int *button_nums; /* list of button numbers */ -static int *mod_count; /* how many mods they have */ -static unsigned *mods; /* mods, in order, one button after another */ -static Resource **actions; /* actions, in order, one button after another */ +char hid_res_error_shared[1024]; -static Resource *res_wrap(char *value) +/* split value into a list of '-' separated words; examine each word + and set the bitmask of modifiers */ +static hid_res_mod_t parse_mods(const char *value) { - Resource *tmp; - tmp = resource_create(0); - resource_add_val(tmp, 0, value, 0); - return tmp; -} + hid_res_mod_t m = 0; + int press = 0; -static unsigned parse_mods(char *value) -{ - unsigned m = 0; - long int mod_num; - char *s; + for(;;) { + if (strncmp(value, "shift", 5) == 0) m |= M_Shift; + else if (strncmp(value, "ctrl", 4) == 0) m |= M_Ctrl; + else if (strncmp(value, "alt", 3) == 0) m |= M_Alt; + else if (strncmp(value, "release", 7) == 0) m |= M_Release; + else if (strncmp(value, "press", 5) == 0) press = 1; + else + Message("Unkown modifier: %s\n", value); + /* skip to next word */ + value = strchr(value, '-'); + if (value == NULL) + break; + value++; + } - for (s = value; *s; s++) - *s = tolower(*s); + if (press && (m & M_Release)) + Message("Bogus modifier: both press and release\n"); - s = strstr(value, "mod"); - if (s) { - s += 3; /* skip "mod" to get to number */ - errno = 0; - mod_num = strtol(s, (char **) NULL, 0); - if (!errno) - m |= M_Mod(mod_num); - } - if (strstr(value, "shift")) - m |= M_Shift; - if (strstr(value, "ctrl")) - m |= M_Ctrl; - if (strstr(value, "alt")) - m |= M_Alt; - if (strstr(value, "up")) - m |= M_Release; return m; } -static int button_name_to_num(const char *name) +static hid_res_mod_t button_name2mask(const char *name) { /* All mouse-related resources must be named. The name is the mouse button number. */ if (!name) - return -1; - else if (strcasecmp(name, "left") == 0) - return 1; - else if (strcasecmp(name, "middle") == 0) - return 2; - else if (strcasecmp(name, "right") == 0) - return 3; - else if (strcasecmp(name, "up") == 0) - return 4; - else if (strcasecmp(name, "down") == 0) - return 5; - else - return atoi(name); + return 0; + else if (strcasecmp(name, "left") == 0) return MB_LEFT; + else if (strcasecmp(name, "middle") == 0) return MB_MIDDLE; + else if (strcasecmp(name, "right") == 0) return MB_RIGHT; + else if (strcasecmp(name, "up") == 0) return MB_UP; + else if (strcasecmp(name, "down") == 0) return MB_DOWN; + else { + Message("Error: unknown mouse button: %s\n", name); + return 0; + } } -void load_mouse_resource(const Resource * res) + +static int keyeq_int(htip_key_t a, htip_key_t b) { return a == b; } +static unsigned int keyhash_int(htip_key_t a) { return murmurhash32(a & 0xFFFF); } + +static void build_mouse_cache(hid_res_t *hr) { - int bi, mi, a; - int action_count; -#ifdef DEBUG_HID_RESOURCE - fprintf(stderr, "note mouse resource:\n"); - resource_dump(res); -#endif + lht_node_t *btn, *m; - button_count = res->c; - button_nums = (int *) malloc(res->c * sizeof(int)); - mod_count = (int *) malloc(res->c * sizeof(int)); - action_count = 0; - for (bi = 0; bi < res->c; bi++) { - if (res->v[bi].value) - action_count++; + if (hr->cache.mouse == NULL) + hr->cache.mouse = hid_res_get_menu(hr, "/mouse"); - if (res->v[bi].subres) - action_count += res->v[bi].subres->c; + if (hr->cache.mouse == NULL) { + Message("Warning: no /mouse section in the resource file - mouse is disabled\n"); + return; + } + if (hr->cache.mouse->type != LHT_LIST) { + hid_res_error(hr->cache.mouse, "Warning: should be a list - mouse is disabled\n"); + return; } - mods = (unsigned int *) malloc(action_count * sizeof(int)); - actions = (Resource **) malloc(action_count * sizeof(Resource *)); - a = 0; - for (bi = 0; bi < res->c; bi++) { - int button_num = button_name_to_num(res->v[bi].name); + if (hr->cache.mouse_mask == NULL) + hr->cache.mouse_mask = htip_alloc(keyhash_int, keyeq_int); + else + htip_clear(hr->cache.mouse_mask); - if (button_num < 0) + for(btn = hr->cache.mouse->data.list.first; btn != NULL; btn = btn->next) { + hid_res_mod_t btn_mask = button_name2mask(btn->name); + if (btn_mask == 0) { + hid_res_error(btn, "unknown mouse button"); continue; - - button_nums[bi] = button_num; - mod_count[bi] = 0; - - if (res->v[bi].value) { - mods[a] = 0; - actions[a++] = res_wrap(res->v[bi].value); - mod_count[bi] = 1; } - - if (res->v[bi].subres) { - Resource *m = res->v[bi].subres; - mod_count[bi] += m->c; - - for (mi = 0; mi < m->c; mi++, a++) { - switch (resource_type(m->v[mi])) { - case 1: /* subres only */ - mods[a] = 0; - actions[a] = m->v[mi].subres; - break; - - case 10: /* value only */ - mods[a] = 0; - actions[a] = res_wrap(m->v[mi].value); - break; - - case 101: /* name = subres */ - mods[a] = parse_mods(m->v[mi].name); - actions[a] = m->v[mi].subres; - break; - - case 110: /* name = value */ - mods[a] = parse_mods(m->v[mi].name); - actions[a] = res_wrap(m->v[mi].value); - break; - } - } + if (btn->type != LHT_LIST) { + hid_res_error(btn, "needs to be a list"); + continue; } + for(m = btn->data.list.first; m != NULL; m = m->next) { + hid_res_mod_t mod_mask = parse_mods(m->name); + printf("add %x|%x (%s, %s) %x %p\n", btn_mask, mod_mask, btn->name, m->name, btn_mask|mod_mask, m); + htip_set(hr->cache.mouse_mask, btn_mask|mod_mask, m); + } } } -static Resource *find_best_action(int button, int start, unsigned mod_mask) +static lht_node_t *find_best_action(hid_res_t *hr, hid_res_mod_t button_and_mask) { - int i, j; - int count = mod_count[button]; - unsigned search_mask = mod_mask & ~M_Release; - unsigned release_mask = mod_mask & M_Release; + lht_node_t *n; + if (hr->cache.mouse_mask == NULL) + return NULL; + /* look for exact mod match */ - for (i = start; i < start + count; i++) - if (mods[i] == mod_mask) { - return actions[i]; - } + n = htip_get(hr->cache.mouse_mask, button_and_mask); +printf("BEST exact: %x %p\n", button_and_mask, n); + if (n != NULL) + return n; - for (j = search_mask - 1; j >= 0; j--) - if ((j & search_mask) == j) /* this would work */ - for (i = start; i < start + count; i++) /* search for it */ - if (mods[i] == (j | release_mask)) - return actions[i]; + if (button_and_mask & M_Release) { + /* look for plain release for the given button */ + n = htip_get(hr->cache.mouse_mask, (button_and_mask & M_ANY) | M_Release); +printf("BEST rels.: %x %p\n", (button_and_mask & M_ANY) | M_Release, n); + if (n != NULL) + return n; + } return NULL; } -void do_mouse_action(int button, int mod_mask) +void hid_res_mouse_action(hid_res_t *hr, hid_res_mod_t button_and_mask) { - Resource *action = NULL; - int bi, i, a; + hid_res_action(find_best_action(hr, button_and_mask)); +} - /* find the right set of actions; */ - a = 0; - for (bi = 0; bi < button_count && !action; bi++) - if (button_nums[bi] == button) { - action = find_best_action(bi, a, mod_mask); - break; - } - else - a += mod_count[bi]; /* skip this buttons actions */ +lht_node_t *resource_create_menu(hid_res_t *hr, const char *name, const char *action, const char *mnemonic, const char *accel, const char *tip, int flags) +{ + /* TODO */ + abort(); +} - if (!action) - return; - for (i = 0; i < action->c; i++) - if (action->v[i].value) - if (hid_parse_actions(action->v[i].value)) - return; -} - -Resource *resource_create_menu(const char *name, const char *action, const char *mnemonic, const char *accel, const char *tip, - int flags) +hid_res_t *hid_res_load(const char *hidname, const char *embedded_fallback) { - Resource *resp, *res; - ResourceVal *rvp, *rv; - int next; + lht_doc_t *doc; + hid_res_t *hr; + FILE *f; +//static const char *pcbmenu_paths_in[] = { "gpcb-menu.res", "gpcb-menu.res", PCBSHAREDIR "/gpcb-menu.res", NULL }; + char *hidfn = strdup(hidname); /* TODO: search for the file */ + int error = 0; - /* child */ - res = calloc(sizeof(Resource), 1); - res->c = 1 + (action != NULL) + (mnemonic != NULL) + (accel != NULL) + (tip != NULL); - rv = malloc(sizeof(ResourceVal) * res->c); - res->v = rv; - res->flags = flags; + f = fopen(hidfn, "r"); + doc = lht_dom_init(); + lht_dom_loc_newfile(doc, hidfn); - rv[0].name = NULL; - rv[0].value = strdup(name); - rv[0].subres = NULL; - next = 1; + while(!(feof(f))) { + lht_err_t err; + int c = fgetc(f); + err = lht_dom_parser_char(doc, c); + if (err != LHTE_SUCCESS) { + if (err != LHTE_STOP) { + const char *fn; + int line, col; + lht_dom_loc_active(doc, &fn, &line, &col); + Message("Resource error: %s (%s:%d.%d)*\n", lht_err_str(err), hidfn, line+1, col+1); + error = 1; + break; + } + break; /* error or stop, do not read anymore (would get LHTE_STOP without any processing all the time) */ + } + } - if (action != NULL) { - rv[next].name = NULL; - rv[next].value = strdup(action); - rv[next].subres = NULL; - next++; + if (error) { + lht_dom_uninit(doc); + doc = NULL; } + fclose(f); - if (mnemonic != NULL) { - rv[next].name = "m"; - rv[next].value = strdup(mnemonic); - rv[next].subres = NULL; - next++; + if (doc != NULL) { + hr = calloc(sizeof(hid_res_t), 1); /* make sure the cache is cleared */ + hr->doc = doc; + hid_res_flush(hr); } + else + hr = NULL; - if (accel != NULL) { - Resource *ares; - ResourceVal *arv; + return hr; +} - ares = calloc(sizeof(Resource), 1); - arv = malloc(sizeof(ResourceVal) * 2); - ares->c = 2; - ares->v = arv; - ares->flags = 0; +void hid_res_action(const lht_node_t *node) +{ + if (node == NULL) + return; + switch(node->type) { + case LHT_TEXT: + hid_parse_actions(node->data.text.value); + break; + case LHT_LIST: + for(node = node->data.list.first; node != NULL; node = node->next) + if (node->type == LHT_TEXT) + hid_parse_actions(node->data.text.value); + break; + } +} - arv[0].name = NULL; - arv[0].value = strdup(accel); - arv[0].subres = NULL; +/************* "parsing" **************/ - arv[1].name = NULL; - arv[1].value = strdup(accel); - arv[1].subres = NULL; +lht_node_t *hid_res_get_menu(hid_res_t *hr, const char *menu_path) +{ + lht_err_t err; + return lht_tree_path(hr->doc, "/", menu_path, 1, &err); +} - rv[next].name = "a"; - rv[next].value = NULL; - rv[next].subres = ares; +lht_node_t *hid_res_menu_field(const lht_node_t *submenu, hid_res_menufield_t field, const char **field_name) +{ + lht_node_t *n; + lht_err_t err; + const char *fieldstr = NULL; - next++; + switch(field) { + case MF_ACCELERATOR: fieldstr = "a"; break; + case MF_MNEMONIC: fieldstr = "m"; break; + case MF_SUBMENU: fieldstr = "submenu"; break; + case MF_CHECKED: fieldstr = "checked"; break; + case MF_SENSITIVE: fieldstr = "sensitive"; break; + case MF_TIP: fieldstr = "tip"; break; + case MF_ACTIVE: fieldstr = "active"; break; + case MF_ACTION: fieldstr = "action"; break; } + if (field_name != NULL) + *field_name = fieldstr; - if (tip != NULL) { - rv[next].name = "tip"; - rv[next].value = strdup(tip); - rv[next].subres = NULL; - next++; - } + if (fieldstr == NULL) + return NULL; - /* parent */ - resp = calloc(sizeof(Resource), 1); - rvp = malloc(sizeof(ResourceVal)); + return lht_tree_path_(submenu->doc, (lht_node_t *)submenu, fieldstr, 1, 0, &err); +} - resp->v = rvp; - resp->c = 1; - rvp->name = NULL; - rvp->value = NULL; - rvp->subres = res; +const char *hid_res_menu_field_str(const lht_node_t *submenu, hid_res_menufield_t field) +{ + const char *fldname; + lht_node_t *n = hid_res_menu_field(submenu, field, &fldname); - return resp; + if (n == NULL) + return NULL; + if (n->type != LHT_TEXT) { + hid_res_error(submenu, "Error: field %s should be a text node\n", fldname); + return NULL; + } + return n->data.text.value; } + +int hid_res_has_submenus(const lht_node_t *submenu) +{ + const char *fldname; + lht_node_t *n = hid_res_menu_field(submenu, MF_SUBMENU, &fldname); + if (n == NULL) + return 0; + if (n->type != LHT_LIST) { + hid_res_error(submenu, "Error: field %s should be a list (of submenus)\n", fldname); + return NULL; + } + return 1; +} + +/************* cache **************/ +/* reset the cache of a resource tree; should be called any time the tree + changes */ +static void hid_res_flush(hid_res_t *hr) +{ + build_mouse_cache(hr); +} Index: src/hid_resource.h =================================================================== --- src/hid_resource.h (revision 1433) +++ src/hid_resource.h (revision 1434) @@ -1,21 +1,113 @@ +/* + * COPYRIGHT + * + * PCB, interactive printed circuit board design + * Copyright (C) 2016 Tibor 'Igor2' Palinkas + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ -#ifndef PCB_HID_COMMON_HID_RESOURCE_H -#define PCB_HID_COMMON_HID_RESOURCE_H +/* Load resources (menus, key and mouse action bindings) from lihata files */ -#include "resource.h" +#ifndef PCB_HID_RESOURCE_H +#define PCB_HID_RESOURCE_H -#define M_Shift 1 -#define M_Ctrl 2 -#define M_Mod(n) (1<<(n+1)) -#define M_Alt M_Mod(1) -#define M_Multi M_Mod(2) -#define M_Release (~((unsigned)-1>>1)) /* set the top bit */ +#include +#include -void load_mouse_resource(const Resource * res); -void do_mouse_action(int button, int mods); +typedef struct hid_res_s { + lht_doc_t *doc; + struct { + lht_node_t *mouse; + htip_t *mouse_mask; + } cache; +} hid_res_t; +/* For compatibility; TODO: REMOVE */ +#define M_Mod(n) (1u<<(n+1)) + +#define M_Mod0(n) (1u<<(n)) +typedef enum { + M_Shift = M_Mod0(0), + M_Ctrl = M_Mod0(1), + M_Alt = M_Mod0(2), + M_Multi = M_Mod0(3), + /* M_Mod(3) is M_Mod0(4) */ + /* M_Mod(4) is M_Mod0(5) */ + M_Release = M_Mod0(6), /* there might be a random number of modkeys, but hopefully not this many */ + + MB_LEFT = M_Mod0(7), + MB_MIDDLE = M_Mod0(8), + MB_RIGHT = M_Mod0(9), + MB_UP = M_Mod0(10), /* scroll wheel */ + MB_DOWN = M_Mod0(11) /* scroll wheel */ +} hid_res_mod_t; + +#define MB_ANY (MB_LEFT | MB_MIDDLE | MB_RIGHT | MB_UP | MB_DOWN) +#define M_ANY (M_Release-1) + + + /* Create a set of resources representing a single menu item */ -Resource *resource_create_menu(const char *name, const char *action, const char *mnemonic, const char *accel, const char *tip, - int flags); +lht_node_t *resource_create_menu(hid_res_t *hr, const char *name, const char *action, const char *mnemonic, const char *accel, const char *tip, int flags); +/* Search and load the menu res for hidname; if not found, and embedded_fallback + is not NULL, parse that string instead. Returns NULL on error */ +hid_res_t *hid_res_load(const char *hidname, const char *embedded_fallback); + +lht_node_t *hid_res_get_menu(hid_res_t *hr, const char *menu_path); + +/* Fields are retrieved using this enum so that HIDs don't need to hardwire + lihata node names */ +typedef enum { + MF_ACCELERATOR, + MF_MNEMONIC, + MF_SUBMENU, + MF_CHECKED, + MF_SENSITIVE, + MF_TIP, + MF_ACTIVE, + MF_ACTION +} hid_res_menufield_t; + +/* Return a field of a submenu and optionally fill in field_name with the + field name expected in the lihata document (useful for error messages) */ +lht_node_t *hid_res_menu_field(const lht_node_t *submenu, hid_res_menufield_t field, const char **field_name); + +/* Return a text field of a submenu; return NULL and generate a Message() if + the given field is not text */ +const char *hid_res_menu_field_str(const lht_node_t *submenu, hid_res_menufield_t field); + +/* Return non-zero if submenu has further submenus; generate Message() if + there is a submenu field with the wrong lihata type */ +int hid_res_has_submenus(const lht_node_t *submenu); + +void hid_res_mouse_action(hid_res_t *hr, hid_res_mod_t button_and_mask); + +/* Run an action node. The node is either a list of text nodes or a text node */ +void hid_res_action(const lht_node_t *node); + +/* Report an error about a node */ +#define hid_res_error(node, ...) \ +do { \ + extern char hid_res_error_shared[]; \ + char *__end__; \ + __end__ = hid_res_error_shared + sprintf(hid_res_error_shared, "Error in lihata node %s:%d.%d:", node->file_name, node->line, node->col); \ + __end__ += sprintf(__end__, __VA_ARGS__); \ + Message(hid_res_error_shared); \ +} while(0) + #endif Index: src/pcb-menu-gtk.lht =================================================================== --- src/pcb-menu-gtk.lht (nonexistent) +++ src/pcb-menu-gtk.lht (revision 1434) @@ -0,0 +1,312 @@ +ha:{ + li:mouse { + li:left { + li:press = { Mode(Notify) } + li:press-ctrl = { Mode(Save); Mode(None); Mode(Restore); Mode(Notify) } + li:press-shift-ctrl = { Mode(Save); Mode(Remove); Mode(Notify); Mode(Restore) } + li:release = { Mode(Release) } + } + li:right { + li:press = { Pan(1) } + li:release = { Pan(0) } + li:press-shift = { Popup(Popup1) } + li:press-ctrl = { Display(CycleCrosshair) } + } + li:middle { + li:press = { Mode(Stroke) } + li:release = { Mode(Release) } + li:press-ctrl = { Mode(Save); Mode(Copy); Mode(Notify) } + li:release-ctrl = { Mode(Notify); Mode(Restore); } + li:press-shift-ctrl = { Display(ToggleRubberbandMode); Mode(Save); Mode(Move); Mode(Notify) } + li:release-shift-ctrl = { Mode(Notify); Mode(Restore); Display(ToggleRubberbandMode) } + } + li:up { + li:press = { Zoom(0.8) } + li:press-shift = { Scroll(up) } + li:press-ctrl = { Scroll(left) } + } + li:down { + li:press = { Zoom(1.25) } + li:press-shift = { Scroll(down) } + li:press-ctrl = { Scroll(right) } + } +# If you want zoom to center, do this instead. + #ha:Up = { li:{} = {Zoom(0.8); Center()} } + #ha:Down = { li:{} = {Zoom(1.25); Center()} } + } + + li:main_menu { + ### File Menu + ha:File { + m=F + li:submenu { + ha:Save Layout = { m=S; a={Ctrls}; action=Save(Layout); tip=Saves current layout } + ha:Save Layout As... = { m=A; a={Shift Ctrls}; action=Save(LayoutAs); tip=Saves current layout into a new file } + - + ha:Revert = { action=Load(Revert,none); tip=Revert to the layout stored on disk } + - + ha:Import Schematics = { action=Import() } + ha:Load layout = { action=Load(Layout); tip=Load a layout from a file } + ha:Load element data to paste-buffer = { li:action={PasteBuffer(Clear); Load(ElementTobuffer)} } + ha:Load layout data to paste-buffer = { li:action={PasteBuffer(Clear); Load(LayoutTobuffer)} } + ha:Load netlist file = { action=Load(Netlist) } + ha:Load vendor resource file = { action=LoadVendorFrom() } + - + ha:Save connection data of { + li:submenu { + ha:a single element = { li:action={ GetXY(Click to set the element mark <>); Save(ElementConnections)}} + ha:all elements = { action=Save(AllConnections) } + ha:unused pins = { action=Save(AllUnusedPins) } + ha:netlist patch for back annotation = {a=Alt Ctrlb; action=SavePatch() } + } + } + - + ha:Print layout... = { action=Print()} + ha:Export layout... = { action=Export()} + ha:Calibrate Printer... = { action=PrintCalibrate()} + - + ha:Start New Layout = { a=Ctrln; action=New() } + - + ha:Preferences... = { action=DoWindows(Preferences)} + - + ha:Quit Program = { a=Ctrlq; action=Quit() } + } + } + + ha:Edit { + m=E + li:submenu { + ha:Undo last operation = { a=u; action=Undo() } + ha:Redo last undone operation = { a=Shiftr; action=Redo() } + ha:Clear undo-buffer = { a=Shift Ctrlu; action=Undo(ClearList) } + - + ha:Cut selection to buffer = { a=Ctrlx; li:action={ GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); RemoveSelected(); Mode(PasteBuffer) } } + ha:Copy selection to buffer = { a=Ctrlc; li:action={ GetXY(Click to set the snap point for this buffer); PasteBuffer(Clear); PasteBuffer(AddSelected); Unselect(All); Mode(PasteBuffer) } } + ha:Paste buffer to layout = { a=Ctrlv; action=Mode(PasteBuffer) } + - + ha:Unselect all = { a=Shift Alta; action=Unselect(All) } + ha:Select all visible = { a=Alta; action=Select(All) } + - + ha:Edit name of { + li:submenu { + ha:text on layout = { a=n; action=ChangeName(Object) } + ha:pin on layout = { a=Shift Ctrln; action=ChangeName(Object, Number) } + ha:layout = { action=ChangeName(Layout) } + ha:active layer = { action=ChangeName(Layer) } + } + } + ha:Edit attributes of { + li:submenu { + ha:Layout = { action=Attributes(Layout) } + ha:CurrentLayer = { action=Attributes(Layer) } + ha:Element = { action=Attributes(Element) } + } + } + ha:Change flags { + li:submenu { + ha:Nonetlist = { a=Altn; action=ChangeNonetlist(Element) } + } + } + ha:Route Styles { + li:submenu { + @routestyles + - + ha:Edit... = { action=AdjustStyle(0) } + } + } + } + } # Edit + + ha:View { + m=V + li:submenu { + ha:Enable visible grid = { checked=drawgrid; action=Display(Grid) } + ha:Grid units { + li:submenu { + ha:mil = { checked=grid_units_mil,1; action=SetUnits(mil) } + ha:mm = { checked=grid_units_mm,1; action=SetUnits(mm) } + } + } + ha:Grid size = { + li:submenu { + ha:No Grid = { checked=grid,0; action=SetValue(Grid,1) } + - + ha:0.1 mil = { checked=gridsize,0.1mil; li:action={SetUnits(mil); SetValue(Grid,0.1mil)} } + ha:1 mil = { checked=gridsize,1mil; li:action={SetUnits(mil); SetValue(Grid,1mil)} } + ha:5 mil = { checked=gridsize,5mil; li:action={SetUnits(mil); SetValue(Grid,5mil)} } + ha:10 mil = { checked=gridsize,10mil; li:action={SetUnits(mil); SetValue(Grid,10mil)} } + ha:25 mil = { checked=gridsize,25mil; li:action={SetUnits(mil); SetValue(Grid,25mil)} } + ha:50 mil = { checked=gridsize,50mil; li:action={SetUnits(mil); SetValue(Grid,50mil)} } + ha:100 mil = { checked=gridsize,100mil; li:action={SetUnits(mil); SetValue(Grid,100mil)} } + - + ha:0.01 mm = { checked=gridsize,0.01mm; li:action={SetUnits(mm); SetValue(Grid,0.01mm)} } + ha:0.05 mm = { checked=gridsize,0.05mm; li:action={SetUnits(mm); SetValue(Grid,0.05mm)} } + ha:0.1 mm = { checked=gridsize,0.10mm; li:action={SetUnits(mm); SetValue(Grid,0.1mm)} } + ha:0.25 mm = { checked=gridsize,0.25mm; li:action={SetUnits(mm); SetValue(Grid,0.25mm)} } + ha:0.5 mm = { checked=gridsize,0.50mm; li:action={SetUnits(mm); SetValue(Grid,0.5mm)} } + ha:1 mm = { checked=gridsize,1mm; li:action={SetUnits(mm); SetValue(Grid,1mm)} } + - + ha:Grid -5mil = { a=Shiftg; action=SetValue(Grid,-5,mil) } + ha:Grid +5mil = { a=g; action=SetValue(Grid,+5,mil) } + ha:Grid -0.05mm = { a=Shift Ctrlg; action=SetValue(Grid,-0.05,mm) } + ha:Grid +0.05mm = { a=Ctrlg; action=SetValue(Grid,+0.05,mm) } + } + } + ha:Realign grid = { li:action={GetXY(Click to set the grid origin); Display(ToggleGrid) } } + - + ha:Displayed element name { + li:submenu { + ha:Description = { checked=elementname,1; action=Display(Description) } + ha:Reference Designator = { checked=elementname,2; action=Display(NameOnPCB) } + ha:Value = { checked=elementname,3; action=Display(Value) } + } + } + ha:Enable Pinout shows number = { checked=shownumber; action=Display(ToggleName) } + ha:Pins/Via show Name/Number = { a=d; action=Display(PinOrPadName) } + ha:Zoom In 20% = { m=Z; a=z; action=Zoom(-1.2) } + ha:Zoom Out 20% = { m=O; a=Shiftz; action=Zoom(+1.2) } + ha:More zooms and view changes { + li:submenu { + ha:Zoom Max = { m=M; a=v; action=Zoom() } + ha:Zoom In 2X = { action=Zoom(-2) } + ha:Zoom Out 2X = { action=Zoom(+2) } + ha:Zoom to 0.1mil/px = { action={Zoom(=0.1mil)} } + ha:Zoom to 0.01mm/px = { action={Zoom(=0.01mm)} } + ha:Zoom to 1mil/px = { action={Zoom(=1mil)} } + ha:Zoom to 0.05mm/px = { action={Zoom(=0.05mm)} } + ha:Zoom to 2.5mil/px = { action={Zoom(=2.5mil)} } + ha:Zoom to 0.1mm/px = { action={Zoom(=0.1mm)} } + ha:Zoom to 10mil/px = { action={Zoom(=10mil)} } + ha:Zoom In 20% and center = { m=Z; li:action={Zoom(-1.2); Center()} } + ha:Zoom Out 20% and center= { m=O; li:action={Zoom(+1.2); Center()} } + ha:Flip up/down = { checked=flip_y; a=Tab; action=SwapSides(V) } + ha:Flip left/right = { checked=flip_x; a=ShiftTab; action=SwapSides(H) } + ha:Spin 180 degrees = { a=CtrlTab; action=SwapSides(R) } + ha:Swap Sides = { a=Ctrl ShiftTab; action=SwapSides() } + ha:Center cursor = { a=c; action=Center() } + } + } + - + ha:Shown Layers { + li:submenu { + @layerview + - + ha:Edit Layer Groups = { action=EditLayerGroups() } + } + } + ha:Current Layer { + li:submenu { + anon2=@layerpick + - + ha:Delete current layer = { action=MoveLayer(c,-1) } + ha:Add new layer = { action=MoveLayer(-1,c) } + ha:Move current layer up = { action=MoveLayer(c,up) } + ha:Move current layer down= { action=MoveLayer(c,down) } + } + } + } + } # View + + ha:Settings = { + m=S + li:submenu { + ha:'All-direction' lines = { checked=alldirection; a=.; action=Display(Toggle45Degree) } + ha:Auto swap line start angle = { checked=swapstartdir; action=Display(ToggleStartDirection) } + ha:Orthogonal moves = { checked=orthomove; action=Display(ToggleOrthoMove) } + ha:Crosshair snaps to pins and pads = { checked=snappin; action=Display(ToggleSnapPin) } + ha:Crosshair snaps to off-grid points on lines = { checked=snapoffgridline; action=Display(ToggleSnapOffGridLine) } + ha:Crosshair shows DRC clearance = { checked=showdrc; action=Display(ToggleShowDRC) } + ha:Auto enforce DRC clearance = { checked=autodrc; action=Display(ToggleAutoDRC) } + ha:Lock Names = { checked=locknames; action=Display(ToggleLockNames) } + ha:Only Names = { checked=onlynames; action=Display(ToggleOnlyNames) } + ha:Hide Names = { checked=hidenames; action=Display(ToggleHideNames) } + ha:Mincut on shorts = { checked=enablemincut; action=Display(ToggleMinCut) } + ha:Libstroke gestures on middle button = { checked=enablestroke; action=Display(ToggleStroke) } + - + ha:Rubber band mode = { checked=rubberband; action=Display(ToggleRubberBandMode) } + ha:Require unique element names = { checked=uniquename; action=Display(ToggleUniqueNames) } + ha:Auto-zero delta measurements = { checked=localref; action=Display(ToggleLocalRef) } + ha:New lines, arcs clear polygons = { checked=clearnew; action=Display(ToggleClearLine) } + ha:New polygons are full ones = { checked=newfullpoly; action=Display(ToggleFullPoly) } + ha:Show autorouter trials = { checked=liveroute; action=Display(ToggleLiveRoute) } + ha:Highlighting on line, arc points = { checked=highlightonpoint; action=Display(ToggleHighlightOnPoint) } + ha:Thin draw = { checked=thindraw; a=|; action=Display(ToggleThindraw) } + ha:Thin draw poly = { checked=thindrawpoly; a=Ctrl Shiftp; action=Display(ToggleThindrawPoly) } + ha:Check polygons = { checked=checkplanes; action=Display(ToggleCheckPlanes) } + - + ha:Vendor drill mapping = { checked=VendorMapOn; action=ToggleVendor() } + ha:Import New Elements at = { + m=I + li:submenu { + ha:Center = { m=C; action=Import(setnewpoint,center) } + ha:Mark = { m=M; action=Import(setnewpoint,mark) } + ha:Crosshair = { m=h; action=Import(setnewpoint) } + - + ha:Set Dispersion = { m=D; action=Import(setdisperse) } + } + } + } + } #Settings + + ha:Select { + m=l + li:submenu { + ha:Select all visible objects = { action=Select(All) } + ha:Select all connected objects = { action=Select(Connection) } + ha:Unselect all objects = { action=Unselect(All) } + ha:unselect all connected objects = { action=Unselect(Connection) } + ha:Select by name { + li:submenu { + ha:All objects = { active=have_regex; action=Select(ObjectByName) } + ha:Elements = { active=have_regex; action=Select(ElementByName) } + ha:Pads = { active=have_regex; action=Select(PadByName) } + ha:Pins = { active=have_regex; action=Select(PinByName) } + ha:Text = { active=have_regex; action=Select(TextByName) } + ha:Vias = { active=have_regex; action=Select(ViaByName) } + } + } + ha:Auto-place selected elements = { a=Ctrlp; action=AutoPlaceSelected() } + ha:Disperse all elements = { action=DisperseElements(All) } + ha:Disperse selected elements = { action=DisperseElements(Selected) } + ha:Move selected elements to other side = { a=Shiftb; action=Flip(SelectedElements) } + ha:Move selected to current layer = { a=Shiftm; action=MoveToCurrentLayer(Selected) } + ha:Remove selected objects = { a=ShiftDelete; action=RemoveSelected() } + ha:Convert selection to element = { action=Select(Convert) } + ha:Optimize selected rats = { li:action={DeleteRats(SelectedRats); AddRats(SelectedRats) } } + ha:Auto-route selected rats = { a=Altr; action=AutoRoute(SelectedRats) } + ha:Rip up selected auto-routed tracks = { action=RipUp(Selected) } + ha:Change size of selected objects { + li:submenu { + ha:Lines -10 mil = { li:action={ChangeSize(SelectedLines,-10,mil); ChangeSize(SelectedArcs,-10,mil)} } + ha:Lines +10 mil = { li:action={ChangeSize(SelectedLines,+10,mil); ChangeSize(SelectedArcs,+10,mil)} } + ha:Pads -10 mil = { action=ChangeSize(SelectedPads,-10,mil) } + ha:Pads +10 mil = { action=ChangeSize(SelectedPads,+10,mil) } + ha:Pins -10 mil = { action=ChangeSize(SelectedPins,-10,mil) } + ha:Pins +10 mil = { action=ChangeSize(SelectedPins,+10,mil) } + ha:Texts -10 mil = { action=ChangeSize(SelectedTexts,-10,mil) } + ha:Texts +10 mil = { action=ChangeSize(SelectedTexts,+10,mil) } + ha:Vias -10 mil = { action=ChangeSize(SelectedVias,-10,mil) } + ha:Vias +10 mil = { action=ChangeSize(SelectedVias,+10,mil) } + } + } + ha:Change drilling hole of selected objects { + li:submenu { + ha:Vias -10 mil = { action=ChangeDrillSize(SelectedVias,-10,mil) } + ha:Vias +10 mil = { action=ChangeDrillSize(SelectedVias,+10,mil) } + ha:Pins -10 mil = { action=ChangeDrillSize(SelectedPins,-10,mil) } + ha:Pins +10 mil = { action=ChangeDrillSize(SelectedPins,+10,mil) } + } + } + ha:Change square-flag of selected objects { + li:submenu { + ha:Elements = { action=ChangeSquare(SelectedElements) } + ha:Pins = { action=ChangeSquare(SelectedPins) } + } + } + ha:Cycle object being dragged = { a=x; action=CycleDrag() } + } + } # Select + + + } # main menu +} # root Index: src_plugins/hid_gtk/ghid-layer-selector.c =================================================================== --- src_plugins/hid_gtk/ghid-layer-selector.c (revision 1433) +++ src_plugins/hid_gtk/ghid-layer-selector.c (revision 1434) @@ -111,7 +111,7 @@ { gtk_list_store_set(ls->list_store, iter, VISIBLE_COL, state, -1); - if (ldata) { + if ((ldata) && (ldata->view_item)) { gtk_action_block_activate(GTK_ACTION(ldata->view_action)); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(ldata->view_item), state); gtk_action_unblock_activate(GTK_ACTION(ldata->view_action)); Index: src_plugins/hid_gtk/ghid-main-menu.c =================================================================== --- src_plugins/hid_gtk/ghid-main-menu.c (revision 1433) +++ src_plugins/hid_gtk/ghid-main-menu.c (revision 1434) @@ -42,7 +42,7 @@ gint n_route_styles; GCallback action_cb; - void (*special_key_cb) (const char *accel, GtkAction * action, const Resource * node); + void (*special_key_cb) (const char *accel, GtkAction * action, const lht_node_t * node); }; struct _GHidMainMenuClass { @@ -149,15 +149,11 @@ return accelerator; } -void ghid_main_menu_real_add_resource(GHidMainMenu * menu, GtkMenuShell * shell, const Resource * res, const char *path); +void ghid_main_menu_real_add_resource(GHidMainMenu * menu, GtkMenuShell * shell, const lht_node_t * res, const char *path); - -static GHashTable *menu_hash = NULL; /* path->GtkWidget */ - -static GtkAction *ghid_add_menu(GHidMainMenu * menu, GtkMenuShell * shell, const Resource * sub_res, const char *path) +static GtkAction *ghid_add_menu(GHidMainMenu * menu, GtkMenuShell * shell, const lht_node_t * sub_res, const char *path) { - const char *res_val; - const Resource *tmp_res; + const char *tmp_val; gchar mnemonic = 0; int j; GtkAction *action = NULL; @@ -164,42 +160,31 @@ const gchar *accel = NULL; char *menu_label; char *npath; + lht_node_t *n_action = hid_res_menu_field(sub_res, MF_ACTION, NULL); - if (!menu_hash) - menu_hash = g_hash_table_new(g_str_hash, g_str_equal); + /* Resolve accelerator */ + tmp_val = hid_res_menu_field_str(sub_res, MF_ACCELERATOR); + if (tmp_val) + accel = check_unique_accel(translate_accelerator(tmp_val)); + /* Resolve the mnemonic */ + tmp_val = hid_res_menu_field_str(sub_res, MF_MNEMONIC); + if (tmp_val) + mnemonic = tmp_val[0]; - tmp_res = resource_subres(sub_res, "a"); /* accelerator */ - res_val = resource_value(sub_res, "m"); /* mnemonic */ + /* Resolve menu name */ + tmp_val = sub_res->name; - - - if (res_val) - mnemonic = res_val[0]; - /* The accelerator resource will have two values, like - * a={"Ctrl-Q" "Ctrlq"} - * The first Gtk ignores. The second needs to be translated. */ - if (tmp_res) - accel = check_unique_accel(translate_accelerator(tmp_res->v[1].value)); - - /* Now look for the first unnamed value (not a subresource) to - * figure out the name of the menu or the menuitem. */ - res_val = "button"; - for (j = 0; j < sub_res->c; ++j) - if (resource_type(sub_res->v[j]) == 10) { - res_val = sub_res->v[j].value; - break; - } /* Hack '_' in based on mnemonic value */ if (!mnemonic) - menu_label = g_strdup(res_val); + menu_label = g_strdup(tmp_val); else { - char *post_ = strchr(res_val, mnemonic); + char *post_ = strchr(tmp_val, mnemonic); if (post_ == NULL) - menu_label = g_strdup(res_val); + menu_label = g_strdup(tmp_val); else { GString *tmp = g_string_new(""); - g_string_append_len(tmp, res_val, post_ - res_val); + g_string_append_len(tmp, tmp_val, post_ - tmp_val); g_string_append_c(tmp, '_'); g_string_append(tmp, post_); menu_label = g_string_free(tmp, FALSE); @@ -206,15 +191,14 @@ } } - npath = Concat(path, "/", res_val, NULL); + npath = Concat(path, "/", tmp_val, NULL); - /* If the subresource we're processing also has unnamed - * subresources, it's a submenu, not a regular menuitem. */ - if (sub_res->flags & FLAG_S) { + if (hid_res_has_submenus(sub_res)) { /* SUBMENU */ GtkWidget *submenu = gtk_menu_new(); GtkWidget *item = gtk_menu_item_new_with_mnemonic(menu_label); GtkWidget *tearoff = gtk_tearoff_menu_item_new(); + lht_node_t *n; gtk_menu_shell_append(shell, item); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); @@ -222,23 +206,21 @@ /* add tearoff to menu */ gtk_menu_shell_append(GTK_MENU_SHELL(submenu), tearoff); - - g_hash_table_insert(menu_hash, (gpointer) npath, (gpointer) submenu); - - /* recurse on the newly-added submenu */ - ghid_main_menu_real_add_resource(menu, GTK_MENU_SHELL(submenu), sub_res, npath); - + /* recurse on the newly-added submenu; hid_res_has_submenus() makes sure + the node format is correct; iterate over the list of submenus and create + them recursively. */ + n = hid_res_menu_field(sub_res, MF_SUBMENU, NULL); + for(n = n->data.list.first; n != NULL; n = n->next) + ghid_main_menu_real_add_resource(menu, GTK_MENU_SHELL(submenu), n, npath); } else { /* NON-SUBMENU: MENU ITEM */ - const char *checked = resource_value(sub_res, "checked"); - const char *label = resource_value(sub_res, "sensitive"); - const char *tip = resource_value(sub_res, "tip"); + const char *checked = hid_res_menu_field_str(sub_res, MF_CHECKED); + const char *label = hid_res_menu_field_str(sub_res, MF_SENSITIVE); + const char *tip = hid_res_menu_field_str(sub_res, MF_TIP); if (checked) { /* TOGGLE ITEM */ - gchar *name = g_strdup_printf("MainMenuAction%d", - action_counter++); - + gchar *name = g_strdup_printf("MainMenuAction%d", action_counter++); action = GTK_ACTION(gtk_toggle_action_new(name, menu_label, tip, NULL)); /* checked=foo is a binary flag (checkbox) * checked=foo,bar is a flag compared to a value (radio) */ @@ -249,7 +231,6 @@ GtkWidget *item = gtk_menu_item_new_with_label(menu_label); gtk_widget_set_sensitive(item, FALSE); gtk_menu_shell_append(shell, item); - g_hash_table_insert(menu_hash, (gpointer) npath, (gpointer) item); } else { /* NORMAL ITEM */ @@ -264,14 +245,12 @@ gtk_action_set_accel_group(action, menu->accel_group); gtk_action_group_add_action_with_accel(menu->action_group, action, accel); gtk_action_connect_accelerator(action); - g_signal_connect(G_OBJECT(action), "activate", menu->action_cb, (gpointer) sub_res); + g_signal_connect(G_OBJECT(action), "activate", menu->action_cb, (gpointer) n_action); g_object_set_data(G_OBJECT(action), "resource", (gpointer) sub_res); item = gtk_action_create_menu_item(action); gtk_menu_shell_append(shell, item); menu->actions = g_list_append(menu->actions, action); - menu->special_key_cb(accel, action, sub_res); - - g_hash_table_insert(menu_hash, (gpointer) npath, (gpointer) item); + menu->special_key_cb(accel, action, n_action); } /* keep npath for the hash so do not free(npath); */ @@ -278,7 +257,6 @@ return action; } - /*! \brief Translate a resource tree into a menu structure * * \param [in] menu The GHidMainMenu widget to be acted on @@ -285,54 +263,30 @@ * \param [in] shall The base menu shell (a menu bar or popup menu) * \param [in] res The base of the resource tree * */ -void ghid_main_menu_real_add_resource(GHidMainMenu * menu, GtkMenuShell * shell, const Resource * res, const char *path) +void ghid_main_menu_real_add_resource(GHidMainMenu * menu, GtkMenuShell * shell, const lht_node_t * res, const char *path) { - int i, j; - GtkAction *action = NULL; + lht_node_t *n; - for (i = 0; i < res->c; ++i) { - const Resource *sub_res = res->v[i].subres; + switch(res->type) { + case LHT_HASH: /* leaf submenu */ + { + GtkAction *action = NULL; + action = ghid_add_menu(menu, shell, res, path); + if (action) { + const char *val; - switch (resource_type(res->v[i])) { - case 101: /* name, subres: passthrough */ - ghid_main_menu_real_add_resource(menu, shell, sub_res, path); - break; - case 1: /* no name, subres */ - action = ghid_add_menu(menu, shell, sub_res, path); - /* Scan rest of resource in case there is more work */ - for (j = 0; j < sub_res->c; j++) { - const char *res_name; - /* named value = X resource */ - if (resource_type(sub_res->v[j]) == 110) { - res_name = sub_res->v[j].name; + val = hid_res_menu_field_str(res, MF_CHECKED); + if (val != NULL) + g_object_set_data(G_OBJECT(action), "checked-flag", (gpointer *)val); - /* translate bg, fg to background, foreground */ - if (strcmp(res_name, "fg") == 0) - res_name = "foreground"; - if (strcmp(res_name, "bg") == 0) - res_name = "background"; - - /* ignore special named values (m, a, sensitive) */ - if (strcmp(res_name, "m") == 0 - || strcmp(res_name, "a") == 0 || strcmp(res_name, "sensitive") == 0 || strcmp(res_name, "tip") == 0) - break; - - /* log checked and active special values */ - if (action && strcmp(res_name, "checked") == 0) - g_object_set_data(G_OBJECT(action), "checked-flag", sub_res->v[j].value); - else if (action && strcmp(res_name, "active") == 0) - g_object_set_data(G_OBJECT(action), "active-flag", sub_res->v[j].value); - else - /* if we got this far it is supposed to be an X - * resource. For now ignore it and warn the user */ - Message(_("The gtk gui currently ignores \"%s\"" - "as part of a menuitem resource.\n" "Feel free to provide patches\n"), sub_res->v[j].value); + val = hid_res_menu_field_str(res, MF_ACTIVE); + if (val != NULL) + g_object_set_data(G_OBJECT(action), "active-flag", (gpointer *)val); } } break; - case 10: /* no name, value */ - /* If we get here, the resource is "-" or "@foo" for some foo */ - if (res->v[i].value[0] == '@') { + case LHT_TEXT: /* separator */ + { GList *children; int pos; @@ -340,34 +294,28 @@ pos = g_list_length(children); g_list_free(children); - if (strcmp(res->v[i].value, "@layerview") == 0) { + if ((strcmp(res->data.text.value, "sep") == 0) || (strcmp(res->data.text.value, "-") == 0)) { + GtkWidget *item = gtk_separator_menu_item_new(); + gtk_menu_shell_append(shell, item); + } + else if (strcmp(res->data.text.value, "@layerview") == 0) { menu->layer_view_shell = shell; menu->layer_view_pos = pos; } - else if (strcmp(res->v[i].value, "@layerpick") == 0) { + else if (strcmp(res->data.text.value, "@layerpick") == 0) { menu->layer_pick_shell = shell; menu->layer_pick_pos = pos; } - else if (strcmp(res->v[i].value, "@routestyles") == 0) { + else if (strcmp(res->data.text.value, "@routestyles") == 0) { menu->route_style_shell = shell; menu->route_style_pos = pos; } else - Message(_("GTK GUI currently ignores \"%s\" in the menu\n" "resource file.\n"), res->v[i].value); + hid_res_error(res, "Unexpected text node; the only text accepted here is sep, -, @layerview, @layerpick and @routestyles"); } - else if (strcmp(res->v[i].value, "-") == 0) { - GtkWidget *item = gtk_separator_menu_item_new(); - gtk_menu_shell_append(shell, item); - } - else if (i > 0) { - /* This is an action-less menuitem. It is really only useful - * when you're starting to build a new menu and you're looking - * to get the layout right. */ - GtkWidget *item = gtk_menu_item_new_with_label(res->v[i].value); - gtk_menu_shell_append(shell, item); - } break; - } + default: + hid_res_error(res, "Unexpected node type; should be hash (submenu) or text (separator or @special)"); } } @@ -410,7 +358,7 @@ * \return a freshly-allocated GHidMainMenu */ GtkWidget *ghid_main_menu_new(GCallback action_cb, - void (*special_key_cb) (const char *accel, GtkAction * action, const Resource * node)) + void (*special_key_cb) (const char *accel, GtkAction * action, const lht_node_t * node)) { GHidMainMenu *mm = g_object_new(GHID_MAIN_MENU_TYPE, NULL); @@ -436,18 +384,25 @@ } /*! \brief Turn a pcb resource into the main menu */ -void ghid_main_menu_add_resource(GHidMainMenu * menu, const Resource * res) +void ghid_main_menu_add_resource(GHidMainMenu * menu, const lht_node_t * res) { - ghid_main_menu_real_add_resource(menu, GTK_MENU_SHELL(menu), res, ""); + lht_node_t *n; + if (res->type != LHT_LIST) { + hid_res_error(res, "Menu description shall be a list (li)\n"); + abort(); + } + for(n = res->data.list.first; n != NULL; n = n->next) { + ghid_main_menu_real_add_resource(menu, GTK_MENU_SHELL(menu), n, ""); + } } /*! \brief Turn a pcb resource into a popup menu */ -void ghid_main_menu_add_popup_resource(GHidMainMenu * menu, const char *name, const Resource * res) +void ghid_main_menu_add_popup_resource(GHidMainMenu * menu, const lht_node_t * res) { GtkWidget *new_menu = gtk_menu_new(); g_object_ref_sink(new_menu); ghid_main_menu_real_add_resource(menu, GTK_MENU_SHELL(new_menu), res, ""); - g_hash_table_insert(menu->popup_table, (gpointer) name, new_menu); + g_hash_table_insert(menu->popup_table, (gpointer) res->name, new_menu); gtk_widget_show_all(new_menu); } @@ -474,14 +429,15 @@ { GList *list; for (list = menu->actions; list; list = list->next) { - Resource *res = g_object_get_data(G_OBJECT(list->data), "resource"); + lht_node_t *res = g_object_get_data(G_OBJECT(list->data), "resource"); + lht_node_t *act = hid_res_menu_field(res, MF_ACTION, NULL); const char *tf = g_object_get_data(G_OBJECT(list->data), "checked-flag"); const char *af = g_object_get_data(G_OBJECT(list->data), "active-flag"); - g_signal_handlers_block_by_func(G_OBJECT(list->data), menu->action_cb, res); + g_signal_handlers_block_by_func(G_OBJECT(list->data), menu->action_cb, act); cb(GTK_ACTION(list->data), tf, af); - g_signal_handlers_unblock_by_func(G_OBJECT(list->data), menu->action_cb, res); + g_signal_handlers_unblock_by_func(G_OBJECT(list->data), menu->action_cb, act); } } @@ -561,21 +517,26 @@ int last = (menu[n + 1] == NULL); int first = (n == 0); GtkWidget *w; - Resource *res; + lht_node_t *res; /* check if the current node exists */ *path_end = '/'; path_end++; strcpy(path_end, menu[n]); +#if 0 +what is this? if (g_hash_table_lookup(menu_hash, path) != NULL) { path_end += strlen(menu[n]); continue; } +#endif /* if not, revert path to the parent's path */ path_end--; *path_end = '\0'; +#if 0 +what? /* look up the parent */ if (first) w = ghidgui->menu_bar; @@ -588,6 +549,7 @@ } else res = resource_create_menu(menu[n], action, mnemonic, accel, tip, FLAG_NS | FLAG_NV | FLAG_V); +#endif ghid_main_menu_real_add_resource(GHID_MAIN_MENU(ghidgui->menu_bar), GTK_MENU_SHELL(w), res, path); Index: src_plugins/hid_gtk/ghid-main-menu.h =================================================================== --- src_plugins/hid_gtk/ghid-main-menu.h (revision 1433) +++ src_plugins/hid_gtk/ghid-main-menu.h (revision 1434) @@ -7,7 +7,7 @@ #include "ghid-layer-selector.h" #include "ghid-route-style-selector.h" -#include "resource.h" +#include "hid_resource.h" G_BEGIN_DECLS /* keep c++ happy */ #define GHID_MAIN_MENU_TYPE (ghid_main_menu_get_type ()) @@ -20,13 +20,13 @@ GType ghid_main_menu_get_type(void); GtkWidget *ghid_main_menu_new(GCallback action_cb, - void (*special_key_cb) (const char *accel, GtkAction * action, const Resource * node)); -void ghid_main_menu_add_resource(GHidMainMenu * menu, const Resource * res); + void (*special_key_cb) (const char *accel, GtkAction * action, const lht_node_t * node)); +void ghid_main_menu_add_resource(GHidMainMenu * menu, const lht_node_t * res); GtkAccelGroup *ghid_main_menu_get_accel_group(GHidMainMenu * menu); void ghid_main_menu_update_toggle_state(GHidMainMenu * menu, void (*cb) (GtkAction *, const char *toggle_flag, const char *active_flag)); -void ghid_main_menu_add_popup_resource(GHidMainMenu * menu, const char *name, const Resource * res); +void ghid_main_menu_add_popup_resource(GHidMainMenu * menu, const lht_node_t * res); GtkMenu *ghid_main_menu_get_popup(GHidMainMenu * menu, const char *name); void ghid_main_menu_install_layer_selector(GHidMainMenu * mm, GHidLayerSelector * ls); @@ -34,5 +34,7 @@ void ghid_create_menu(const char *menu[], const char *action, const char *mnemonic, const char *accel, const char *tip); +extern hid_res_t *ghid_res; + G_END_DECLS /* keep c++ happy */ #endif Index: src_plugins/hid_gtk/gui-output-events.c =================================================================== --- src_plugins/hid_gtk/gui-output-events.c (revision 1433) +++ src_plugins/hid_gtk/gui-output-events.c (revision 1434) @@ -268,6 +268,12 @@ return handled; } +static hid_res_mod_t ghid_mouse_button(int ev_button) +{ +#warning TODO: convert ev->button + return (MB_LEFT << (ev_button-1)); +} + gboolean ghid_port_button_press_cb(GtkWidget * drawing_area, GdkEventButton * ev, gpointer data) { ModifierKeysState mk; @@ -281,7 +287,7 @@ state = (GdkModifierType) (ev->state); mk = ghid_modifier_keys_state(&state); - do_mouse_action(ev->button, mk); + hid_res_mouse_action(ghid_res, ghid_mouse_button(ev->button) | mk); ghid_invalidate_all(); ghid_window_set_name_label(PCB->Name); @@ -301,7 +307,7 @@ state = (GdkModifierType) (ev->state); mk = ghid_modifier_keys_state(&state); - do_mouse_action(ev->button, mk + M_Release); + hid_res_mouse_action(ghid_res, ghid_mouse_button(ev->button) | mk | M_Release); AdjustAttachedObjects(); ghid_invalidate_all(); @@ -547,23 +553,14 @@ * who has buttons 4 - 7 that aren't the scroll wheel? */ switch (ev->direction) { - case GDK_SCROLL_UP: - button = 4; - break; - case GDK_SCROLL_DOWN: - button = 5; - break; - case GDK_SCROLL_LEFT: - button = 6; - break; - case GDK_SCROLL_RIGHT: - button = 7; - break; - default: - button = -1; + case GDK_SCROLL_UP: button = MB_UP; break; + case GDK_SCROLL_DOWN: button = MB_DOWN; break; + case GDK_SCROLL_LEFT: button = MB_LEFT; break; + case GDK_SCROLL_RIGHT: button = MB_RIGHT; break; + default: return FALSE; } - do_mouse_action(button, mk); + hid_res_mouse_action(ghid_res, button | mk); return TRUE; } Index: src_plugins/hid_gtk/gui-top-window.c =================================================================== --- src_plugins/hid_gtk/gui-top-window.c (revision 1433) +++ src_plugins/hid_gtk/gui-top-window.c (revision 1434) @@ -89,7 +89,6 @@ #include "polygon.h" #include "rats.h" #include "remove.h" -#include "resource.h" #include "rotate.h" #include "rubberband.h" #include "search.h" @@ -115,11 +114,13 @@ GHidPort ghid_port, *gport; +hid_res_t *ghid_res = NULL; + static gchar *bg_image_file; static struct { GtkAction *action; - const Resource *node; + const lht_node_t *node; } ghid_hotkey_actions[256]; #define N_HOTKEY_ACTIONS \ (sizeof (ghid_hotkey_actions) / sizeof (ghid_hotkey_actions[0])) @@ -298,10 +299,10 @@ * pcb calls this function directly through ghid_hotkey_cb() for them. * * \param [in] The action that was activated - * \param [in] The menu resource associated with the action + * \param [in] The related menu resource's action node */ -static void ghid_menu_cb(GtkAction * action, const Resource * node) +static void ghid_menu_cb(GtkAction * action, const lht_node_t * node) { int i; @@ -308,13 +309,7 @@ if (action == NULL || node == NULL) return; - for (i = 1; i < node->c; i++) - if (resource_type(node->v[i]) == 10) { -#ifdef DEBUG_MENUS - printf(" %s\n", node->v[i].value); -#endif - hid_parse_actions(node->v[i].value); - } + hid_res_action(node); /* Sync gui widgets with pcb state */ ghid_update_toggle_flags(); @@ -1371,7 +1366,6 @@ /* ------------------------------------------------------------ */ static int stdin_listen = 0; -static const char *pcbmenu_paths_in[] = { "gpcb-menu.res", "gpcb-menu.res", PCBSHAREDIR "/gpcb-menu.res", NULL }; static char **pcbmenu_paths = NULL; @@ -1400,17 +1394,6 @@ {"bg-image", "Background Image", HID_String, 0, 0, {0, 0, 0}, 0, &bg_image_file}, #define HA_bg_image 1 - -/* %start-doc options "21 GTK+ GUI Options" -@ftable @code -@item --pcb-menu -Location of the @file{gpcb-menu.res} file which defines the menu for the GTK+ GUI. -@end ftable -%end-doc -*/ - {"pcb-menu", "Location of gpcb-menu.res file", - HID_String, 0, 0, {0, "gpcb-menu.res", 0}, 0, &pcbmenu_paths_in[0]} -#define HA_pcbmenu 2 }; REGISTER_ATTRIBUTES(ghid_attribute_list, ghid_cookie) @@ -1686,7 +1669,7 @@ * accelerators are added when the menus are being built */ static void - ghid_check_special_key(const char *accel, GtkAction * action, const Resource * node) + ghid_check_special_key(const char *accel, GtkAction * action, const lht_node_t * node) { size_t len; unsigned int mods; @@ -1746,38 +1729,9 @@ } } -/*! \brief Finds the gpcb-menu.res file */ -char *get_menu_filename(void) -{ - char **s, *rv = NULL; - char *home_pcbmenu = NULL; - - /* homedir is set by the core */ - if (homedir) { - Message(_("Note: home directory is \"%s\"\n"), homedir); - home_pcbmenu = Concat(homedir, PCB_DIR_SEPARATOR_S, ".pcb", PCB_DIR_SEPARATOR_S, "gpcb-menu.res", NULL); - } - else - Message(_("Warning: could not determine home directory\n")); - - resolve_all_paths(pcbmenu_paths_in, pcbmenu_paths); - - for (s = pcbmenu_paths; *s != NULL; s++) { - if (access(*s, R_OK) == 0) - return strdup(*s); - } - - if (home_pcbmenu != NULL && (access(home_pcbmenu, R_OK) == 0)) - rv = home_pcbmenu; - - return rv; -} - static GtkWidget *ghid_load_menus(void) { - char *filename; - const Resource *r = 0, *bir; - const Resource *mr; + const lht_node_t *mr; GtkWidget *menu_bar = NULL; int i; @@ -1786,43 +1740,28 @@ ghid_hotkey_actions[i].node = NULL; } - bir = resource_parse(0, gpcb_menu_default); - if (!bir) { - fprintf(stderr, _("Error: internal menu resource didn't parse\n")); - exit(1); - } +#warning TODO + const char *gpcb_menu_default = NULL; - filename = get_menu_filename(); - if (filename) { - Message("Loading menus from %s\n", filename); - r = resource_parse(filename, 0); + ghid_res = hid_res_load("gtk", gpcb_menu_default); + if (ghid_res == NULL) { + Message("FATAL: can't load the gtk menu res either from file or from hardwired default."); + abort(); } - if (!r) { - Message("Using default menus\n"); - r = bir; - } - free(filename); - - mr = resource_subres(r, "MainMenu"); - if (!mr) - mr = resource_subres(bir, "MainMenu"); - - if (mr) { + mr = hid_res_get_menu(ghid_res, "/main_menu"); + if (mr != NULL) { menu_bar = ghid_main_menu_new(G_CALLBACK(ghid_menu_cb), ghid_check_special_key); ghid_main_menu_add_resource(GHID_MAIN_MENU(menu_bar), mr); } - mr = resource_subres(r, "PopupMenus"); - if (!mr) - mr = resource_subres(bir, "PopupMenus"); - - if (mr) { - int i; - for (i = 0; i < mr->c; i++) - if (resource_type(mr->v[i]) == 101) - /* This is a named resource which defines a popup menu */ - ghid_main_menu_add_popup_resource(GHID_MAIN_MENU(menu_bar), mr->v[i].name, mr->v[i].subres); + mr = hid_res_get_menu(ghid_res, "/popups"); + if (mr != NULL) { + if (mr->type == LHT_LIST) { + lht_node_t *n; + for(n = mr->data.list.first; n != NULL; n = n->next) + ghid_main_menu_add_popup_resource(GHID_MAIN_MENU(menu_bar), n); + } } #ifdef DEBUG_MENUS @@ -1829,11 +1768,9 @@ puts("Finished loading menus."); #endif - mr = resource_subres(r, "Mouse"); - if (!mr) - mr = resource_subres(bir, "Mouse"); - if (mr) - load_mouse_resource(mr); +#warning TODO: + mr = hid_res_get_menu(ghid_res, "/mouse"); +/* load_mouse_resource(mr);*/ return menu_bar; } Index: src_plugins/hid_lesstif/main.c =================================================================== --- src_plugins/hid_lesstif/main.c (revision 1433) +++ src_plugins/hid_lesstif/main.c (revision 1434) @@ -22,7 +22,6 @@ #include "mymem.h" #include "misc.h" #include "pcb-printf.h" -#include "resource.h" #include "clip.h" #include "event.h" #include "error.h" Index: src_plugins/hid_lesstif/menu.c =================================================================== --- src_plugins/hid_lesstif/menu.c (revision 1433) +++ src_plugins/hid_lesstif/menu.c (revision 1434) @@ -18,7 +18,6 @@ #include "hid.h" #include "hid_resource.h" -#include "resource.h" #include "lesstif.h" #include "mymem.h" #include "paths.h" Index: src_plugins/vendordrill/vendor.c =================================================================== --- src_plugins/vendordrill/vendor.c (revision 1433) +++ src_plugins/vendordrill/vendor.c (revision 1434) @@ -53,7 +53,6 @@ #include "draw.h" #include "error.h" #include "global.h" -#include "resource.h" #include "set.h" #include "undo.h" #include "vendor.h"