Author: durner Date: 2005-03-24 14:28:39 -0800 (Thu, 24 Mar 2005) New Revision: 483
Modified: GNUnet/contrib/config.in GNUnet/src/conf/lex.zconf.c GNUnet/src/conf/lkc_proto.h GNUnet/src/conf/symbol.c GNUnet/src/conf/zconf.l Log: Make dependencies and conditionals work Modified: GNUnet/contrib/config.in =================================================================== --- GNUnet/contrib/config.in 2005-03-23 18:52:06 UTC (rev 482) +++ GNUnet/contrib/config.in 2005-03-24 22:28:39 UTC (rev 483) @@ -41,7 +41,7 @@ config HELOEXPIRES int "How many minutes should peer advertisements last?" default 1440 - depends on ADVANCED + depends on Meta::ADVANCED help How many minutes is the current IP valid? (GNUnet will sign HELO messages with this expiration timeline. If you are on dialup, 60 @@ -56,7 +56,7 @@ config LOGLEVEL string "Log level" default "WARNING" - depends on ADVANCED + depends on Meta::ADVANCED help Loglevel, how much should be logged? You can use NOTHING, FATAL, ERROR, FAILURE, WARNING, MESSAGE, INFO, DEBUG, CRON or EVERYTHING @@ -66,7 +66,7 @@ config LOGFILE string "Where should logs go by default" default "$GNUNET_HOME/logs" - depends on ADVANCED + depends on Meta::ADVANCED help In which file should gnunetd write the logs? If you specify nothing, logs are written to stderr (and note that if gnunetd runs @@ -76,7 +76,7 @@ config PIDFILE string "Where should gnunetd write the PID" default "$GNUNET_HOME/gnunet.pid" - depends on ADVANCED + depends on Meta::ADVANCED help In which file should gnunetd write the process-id of the server? If you run gnunetd as root, you may want to choose @@ -87,7 +87,7 @@ config HOSTS string "Where should gnunetd keep the list of peers" default "$GNUNET_HOME/data/hosts/" - depends on ADVANCED + depends on Meta::ADVANCED help This directory should be made available periodically --- it contains information how to join GNUnet that is in no way private to the @@ -102,7 +102,7 @@ config HOSTLISTURL string "Where can GNUnet find an initial list of peers" - depends on ADVANCED + depends on Meta::ADVANCED default "http://www.ovmj.org/GNUnet/download/hostlist http://gnunet.cryss.net/hostlist http://www.woodtick.co.uk/hostlist" help GNUnet can automatically update the hostlist from the web. While @@ -126,7 +126,7 @@ config HTTP-PROXY string "HTTP Proxy Server" default "localhost" - depends on ADVANCED + depends on Meta::ADVANCED help If you have to use a proxy for outbound HTTP connections, specify the proxy configuration here. Default is no proxy. @@ -135,7 +135,7 @@ int "HTTP Proxy Port" range 1 65535 default "1080" - depends on ADVANCED + depends on Meta::ADVANCED help If you have to use a proxy for outbound HTTP connections, specify the proxy configuration here. Default is no proxy. @@ -143,7 +143,7 @@ config APPLICATIONS string "Which applications should gnunetd support?" default "afs tbench tracekit" - depends on ADVANCED + depends on Meta::ADVANCED help Which applications should gnunetd support? Specify the name of the dynamic shared object (DSO) that implements the service in the @@ -165,7 +165,7 @@ config TRANSPORTS string "Which transport mechanisms are available?" default "udp tcp nat" - depends on ADVANCED + depends on Meta::ADVANCED help Which transport mechanisms are available? Use space-separated list of the modules, e.g. "udp smtp tcp". The order is irrelevant, each @@ -193,7 +193,7 @@ int "Client/Server Port" range 1 65535 default "2087" - depends on ADVANCED + depends on Meta::ADVANCED help Which is the client-server port that is used between gnunetd and the clients (TCP only). You may firewall this port for non-local @@ -232,7 +232,7 @@ config HELOEXCHANGE bool "Participate in network topology management" default y - depends on ADVANCED + depends on Meta::ADVANCED help If this host is connected to two networks, a private which is not reachable from the Internet and that contains GNUnet clients and to @@ -247,7 +247,7 @@ config TRUSTED string "IPs allowed to use gnunetd server" default "127.0.0.0/8;" - depends on ADVANCED + depends on Meta::ADVANCED help With this option, you can specify which networks are trusted enough to connect as clients to the TCP port. This is useful if you run @@ -283,7 +283,7 @@ config INTERFACES string "Network interface to monitor" default "eth0" - depends on ADVANCEDLIMITING + depends on Meta::ADVANCEDLIMITING help For which interfaces should we do accounting? GNUnet will evaluate the total traffic (not only the GNUnet related traffic) and adjust @@ -366,7 +366,7 @@ config MTU int "MTU" default 1472 - depends on RARE + depends on Meta::RARE help The MTU to use. Do not use more than your OS (and firewall) can support. Typically, your @@ -415,7 +415,7 @@ config MTU int "MTU" default 1460 - depends on RARE + depends on Meta::RARE help The MTU to use (TCP is stream oriented, so we are pretty free to choose what we want, but note that larger MTUs mean more noise if @@ -441,7 +441,7 @@ endmenu - if EXPERIMENTAL && RARE + if Meta::EXPERIMENTAL && Meta::RARE menu "UDP over IPv6" "UDP6" @@ -453,7 +453,7 @@ config MTU int "MTU" default 1452 - depends on RARE + depends on Meta::RARE config BLACKLIST string "Disallow connections from" @@ -470,7 +470,7 @@ config MTU int "MTU" default 1440 - depends on RARE + depends on Meta::RARE config BLACKLIST string "Disallow connections from" @@ -479,7 +479,7 @@ endif - if ADVANCED + if Meta::ADVANCED menu "SMTP" "SMTP" @@ -558,7 +558,7 @@ config MTU int "MTU" default 1400 - depends on RARE + depends on Meta::RARE config BLACKLIST string "Disallow connections from" @@ -605,7 +605,7 @@ config ANONYMITY_RECEIVE int "Level of anonymity desired for receiving" default 0 - depends on RARE && ADVANCED + depends on Meta::RARE && Meta::ADVANCED help What degree of receiver anonymity is required? If set to 0, GNUnet will try to download the file as fast as possible without any @@ -641,7 +641,7 @@ config ANONYMITY_SEND int "Level of anonymity desired for sending" default 0 - depends on RARE && ADVANCED + depends on Meta::RARE && Meta::ADVANCED help You can also request a certain degree of anonymity for the files and blocks that you are sharing. In this case, only a certain faction of @@ -655,7 +655,7 @@ config ACTIVEMIGRATION string "Allow migrating content" - depends on ADVANCED + depends on Meta::ADVANCED help Should we participate in content migration? If you say yes here, GNUnet will migrate content to your server, and you will not be able @@ -695,14 +695,14 @@ config AFSDIR string "Directory for storing AFS data" default "$GNUNET_HOME/data/afs/" - depends on ADVANCED + depends on Meta::ADVANCED help Where to store the AFS related data (content, etc)? config INDEX-DIRECTORY string "Where to store indexed files" default "$GNUNETD_HOME/data/shared/" - depends on ADVANCED + depends on Meta::ADVANCED help Where to store indexed files (NEW!) Note that you MUST not copy files directly to this @@ -735,7 +735,7 @@ Indexing quota. Default is 8192. endmenu - if ADVANCED + if Meta::ADVANCED menu "GNUnet Testbed" "TESTBED" Modified: GNUnet/src/conf/lex.zconf.c =================================================================== --- GNUnet/src/conf/lex.zconf.c 2005-03-23 18:52:06 UTC (rev 482) +++ GNUnet/src/conf/lex.zconf.c 2005-03-24 22:28:39 UTC (rev 483) @@ -42,7 +42,7 @@ 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 char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ @@ -148,7 +148,7 @@ #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) - + /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ @@ -215,7 +215,7 @@ 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. */ @@ -1961,7 +1961,7 @@ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 1, 1, 7, 8, 9, 10, 1, 1, 1, 11, 12, 12, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, + 13, 13, 13, 13, 13, 13, 13, 13, 1, 1, 14, 1, 1, 1, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, @@ -2094,7 +2094,7 @@ #endif static void yyunput (int c,char *buf_ptr ); - + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif @@ -2123,7 +2123,7 @@ /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) GN_FWRITE( zconftext, zconfleng, 1, zconfout ) +#define ECHO (void) fwrite( zconftext, zconfleng, 1, zconfout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -2132,7 +2132,7 @@ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ errno=0; \ - while ( (result = READ( fileno(zconfin), (char *) buf, max_size )) < 0 ) \ + while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \ { \ if( errno != EINTR) \ { \ @@ -2199,7 +2199,7 @@ register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - + int str = 0; int ts, i; @@ -2904,7 +2904,7 @@ { 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 ) @@ -2923,7 +2923,7 @@ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { register int yy_is_jam; - + yy_current_state = yy_nxt[yy_current_state][1]; yy_is_jam = (yy_current_state <= 0); @@ -2933,7 +2933,7 @@ static void yyunput (int c, register char * yy_bp ) { register char *yy_cp; - + yy_cp = (yy_c_buf_p); /* undo effects of setting up zconftext */ @@ -2976,7 +2976,7 @@ { int c; - + *(yy_c_buf_p) = (yy_hold_char); if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) @@ -3043,12 +3043,12 @@ /** 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 zconfrestart (FILE * input_file ) { - + if ( ! YY_CURRENT_BUFFER ){ zconfensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = @@ -3061,11 +3061,11 @@ /** Switch to a different input buffer. * @param new_buffer The new input buffer. - * + * */ void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { - + /* TODO. We should be able to replace this entire function body * with * zconfpop_buffer_state(); @@ -3105,13 +3105,13 @@ /** 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 zconf_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - + b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" ); @@ -3134,11 +3134,11 @@ /** Destroy the buffer. * @param b a buffer created with zconf_create_buffer() - * + * */ void zconf_delete_buffer (YY_BUFFER_STATE b ) { - + if ( ! b ) return; @@ -3159,7 +3159,7 @@ { int oerrno = errno; - + zconf_flush_buffer(b ); b->yy_input_file = file; @@ -3175,13 +3175,13 @@ } b->yy_is_interactive = 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 zconf_flush_buffer (YY_BUFFER_STATE b ) { @@ -3210,7 +3210,7 @@ * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. - * + * */ void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer ) { @@ -3240,7 +3240,7 @@ /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. - * + * */ void zconfpop_buffer_state (void) { @@ -3264,7 +3264,7 @@ static void zconfensure_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 @@ -3303,13 +3303,13 @@ /** 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. + * + * @return the newly allocated buffer state object. */ YY_BUFFER_STATE zconf_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 ) @@ -3338,14 +3338,14 @@ /** Setup the input buffer state to scan a string. The next call to zconflex() will * scan from a @e copy of @a str. * @param str 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 * zconf_scan_bytes() instead. */ YY_BUFFER_STATE zconf_scan_string (yyconst char * yy_str ) { - + return zconf_scan_bytes(yy_str,strlen(yy_str) ); } @@ -3353,7 +3353,7 @@ * scan from a @e copy of @a bytes. * @param bytes the byte buffer to scan * @param len the number of bytes in the buffer pointed to by @a bytes. - * + * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len ) @@ -3362,7 +3362,7 @@ char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) zconfalloc(n ); @@ -3416,16 +3416,16 @@ /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. - * + * */ int zconfget_lineno (void) { - + return zconflineno; } /** Get the input stream. - * + * */ FILE *zconfget_in (void) { @@ -3433,7 +3433,7 @@ } /** Get the output stream. - * + * */ FILE *zconfget_out (void) { @@ -3441,7 +3441,7 @@ } /** Get the length of the current token. - * + * */ int zconfget_leng (void) { @@ -3449,7 +3449,7 @@ } /** Get the current token. - * + * */ char *zconfget_text (void) @@ -3459,18 +3459,18 @@ /** Set the current line number. * @param line_number - * + * */ void zconfset_lineno (int line_number ) { - + zconflineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. - * + * * @see zconf_switch_to_buffer */ void zconfset_in (FILE * in_str ) @@ -3496,7 +3496,7 @@ /* zconflex_destroy is for both reentrant and non-reentrant scanners. */ int zconflex_destroy (void) { - + /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ zconf_delete_buffer(YY_CURRENT_BUFFER ); Modified: GNUnet/src/conf/lkc_proto.h =================================================================== --- GNUnet/src/conf/lkc_proto.h 2005-03-23 18:52:06 UTC (rev 482) +++ GNUnet/src/conf/lkc_proto.h 2005-03-24 22:28:39 UTC (rev 483) @@ -23,8 +23,8 @@ P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); P(sym_change_count,int,); -P(sym_lookup,struct symbol *,(const char *name, const char *sect, int isconst)); -P(sym_find,struct symbol *,(const char *name, const char *sect)); +P(sym_lookup,struct symbol *,(char *name, char *sect, int isconst)); +P(sym_find,struct symbol *,(char *name, char *sect)); P(sym_type_name,const char *,(enum symbol_type type)); P(sym_calc_value,void,(struct symbol *sym)); P(sym_calc_value_ext,void,(struct symbol *sym, int returnInv)); Modified: GNUnet/src/conf/symbol.c =================================================================== --- GNUnet/src/conf/symbol.c 2005-03-23 18:52:06 UTC (rev 482) +++ GNUnet/src/conf/symbol.c 2005-03-24 22:28:39 UTC (rev 483) @@ -28,18 +28,22 @@ struct symbol symbol_yes = { .name = "y", + .sect = "", .curr = { "y", yes }, .flags = SYMBOL_YES|SYMBOL_VALID, }, symbol_mod = { .name = "m", + .sect = "", .curr = { "m", mod }, .flags = SYMBOL_MOD|SYMBOL_VALID, }, symbol_no = { .name = "n", + .sect = "", .curr = { "n", no }, .flags = SYMBOL_NO|SYMBOL_VALID, }, symbol_empty = { .name = "", + .sect = "", .curr = { "", no }, .flags = SYMBOL_VALID, }; @@ -52,7 +56,7 @@ { struct property *prop = prop_alloc(P_DEFAULT, sym); - prop->expr = expr_alloc_symbol(sym_lookup(def, sect, 1)); + prop->expr = expr_alloc_symbol(sym_lookup((char *) def, (char *) sect, 1)); } void sym_init(void) @@ -613,13 +617,32 @@ return sym->visible > sym->rev_dep.tri; } -struct symbol *sym_lookup(const char *name, const char *sect, int isconst) +struct symbol *sym_lookup(char *name, char *sect, int isconst) { struct symbol *symbol; const char *ptr; char *new_name, *new_sect; int hash = 0; + char *scope; + int sect_alloc = 0; + scope = strstr(name, "::"); + if (scope) { + int len; + + sect = scope; + while(sect >= name) + sect--; + + len = scope - name; + sect = (char *) malloc(len + 1); + memcpy(sect, name, len); + sect[len] = 0; + sect_alloc = 1; + + name = scope + 2; + } + if (!sect) sect = current_sect; if (!sect) @@ -642,7 +665,11 @@ !strcmp(symbol->sect, sect)) { if ((isconst && symbol->flags & SYMBOL_CONST) || (!isconst && !(symbol->flags & SYMBOL_CONST))) + { + if (sect_alloc) + free(sect); return symbol; + } } } new_name = strdup(name); @@ -664,19 +691,41 @@ symbol->next = symbol_hash[hash]; symbol_hash[hash] = symbol; + + if (sect_alloc) + free(sect); return symbol; } -struct symbol *sym_find(const char *name, const char *sect) +struct symbol *sym_find(char *name, char *sect) { struct symbol *symbol = NULL; const char *ptr; int hash = 0; + char *scope; + int sect_alloc = 0; if (!name) return NULL; + scope = strstr(name, "::"); + if (scope) { + int len; + + sect = scope; + while(sect >= name) + sect--; + + len = scope - name; + sect = (char *) malloc(len + 1); + memcpy(sect, name, len); + sect[len] = 0; + sect_alloc = 1; + + name = scope + 2; + } + if (!sect) sect = current_sect; if (!sect) @@ -700,6 +749,9 @@ break; } + if (sect_alloc) + free(sect); + return symbol; } Modified: GNUnet/src/conf/zconf.l =================================================================== --- GNUnet/src/conf/zconf.l 2005-03-23 18:52:06 UTC (rev 482) +++ GNUnet/src/conf/zconf.l 2005-03-24 22:28:39 UTC (rev 483) @@ -69,7 +69,7 @@ %} ws [ \n\t] -n [A-Za-z0-9_] +n [A-Za-z0-9_:] %% int str = 0; _______________________________________________ GNUnet-SVN mailing list GNUnet-SVN@gnu.org http://lists.gnu.org/mailman/listinfo/gnunet-svn