Author: stepan Date: 2006-10-14 22:19:21 +0200 (Sat, 14 Oct 2006) New Revision: 90
Modified: fcode-utils/detok/decode.c fcode-utils/detok/detok.c fcode-utils/toke/dictionary.c fcode-utils/toke/scanner.c fcode-utils/toke/strsubvocab.c fcode-utils/toke/strsubvocab.h fcode-utils/toke/toke.c fcode-utils/toke/tokzesc.c fcode-utils/toke/tokzesc.h fcode-utils/toke/usersymbols.c fcode-utils/toke/usersymbols.h fcode-utils/toke/vocabfuncts.h Log: merge David Paktor's changes for toke 1.0.1
Modified: fcode-utils/detok/decode.c =================================================================== --- fcode-utils/detok/decode.c 2006-10-14 20:18:07 UTC (rev 89) +++ fcode-utils/detok/decode.c 2006-10-14 20:19:21 UTC (rev 90) @@ -206,7 +206,7 @@ * or * b) detok is in verbose mode. */ - if ( tname == unnamed ) + if ( strcmp( tname, unnamed) == 0 ) { printf("[0x%03x] ", fcode); } else { @@ -355,7 +355,7 @@ output_token(); token = next_token(); printf("0x%03x\n",token); - add_token(token, (char *)unnamed); + add_token(token, strdup(unnamed)); }
static void named_token(void)
Modified: fcode-utils/detok/detok.c =================================================================== --- fcode-utils/detok/detok.c 2006-10-14 20:18:07 UTC (rev 89) +++ fcode-utils/detok/detok.c 2006-10-14 20:19:21 UTC (rev 90) @@ -184,6 +184,7 @@ close_stream(); optind++; + reset_dictionary(); } printf("\n");
Modified: fcode-utils/toke/dictionary.c =================================================================== --- fcode-utils/toke/dictionary.c 2006-10-14 20:18:07 UTC (rev 89) +++ fcode-utils/toke/dictionary.c 2006-10-14 20:19:21 UTC (rev 90) @@ -212,61 +212,6 @@
/* ************************************************************************** * - * Function name: exists_in_core - * Synopsis: Confirm whether the given name exists in the - * Global (aka "core") Vocabulary. Search the - * Global Vocabulary exclusively. - * - * Inputs: - * Parameters: - * name The name for which to look - * Local Static Variables: - * global_voc_dict_ptr "Tail" of Global Vocabulary - * - * Outputs: - * Returned Value: TRUE if name is found. - * - **************************************************************************** */ - -bool exists_in_core( char *name) -{ - return exists_in_tic_vocab( name, global_voc_dict_ptr ); -} - -/* ************************************************************************** - * - * Function name: handle_core_word - * Synopsis: Perform a function in the "Global" Vocabulary and - * indicate whether the name is valid. - * - * Inputs: - * Parameters: - * tname The name to handle - * Local Static Variables: - * global_voc_dict_ptr "Tail" of Global Vocabulary - * - * Outputs: - * Returned Value: TRUE if the given name is valid in Global Vocab - * - * Error Detection: - * If the name is not in the "Global" Vocabulary, let the calling - * routine determine whether to print an error message or to - * try it out as a number. - * - **************************************************************************** */ - -bool handle_core_word( char *tname ) -{ - bool retval; - - retval = handle_tic_vocab( tname, global_voc_dict_ptr ); - - return ( retval ) ; -} - - -/* ************************************************************************** - * * Function name: create_core_alias * Synopsis: Create, in the "Global" ("core") Vocabulary, an entry * for NEW_NAME that behaves the same as the latest @@ -618,43 +563,8 @@ return( retval); }
- /* ************************************************************************** * - * Function name: handle_current - * Synopsis: Perform a function in the current device-node vocab, - * if one is in effect, or in the "Global" Vocabulary. - * Indicate whether the name is valid. - * - * Inputs: - * Parameters: - * tname The name to handle - * Global Variables: - * current_definitions Device-Node (or Global) Vocabulary - * currently in effect. - * scope_is_global TRUE if "global" scope is in effect - * Local Static Variables: - * - * Outputs: - * Returned Value: TRUE if the given name is valid - * - **************************************************************************** */ - -bool handle_current( char *tname ) -{ - bool retval = handle_tic_vocab( tname, *current_definitions ); - - if ( INVERSE(retval) && INVERSE(scope_is_global) ) - { - retval = handle_core_word( tname ); - } - return ( retval ); - -} - - -/* ************************************************************************** - * * Function name: lookup_in_dev_node * Synopsis: Return a pointer to the data-structure of the * named word in the Current device node, if @@ -1778,41 +1688,6 @@
/* ************************************************************************** * - * Function name: handle_shared_word - * Synopsis: Perform the function associated with the given name - * only if it is a "Shared Word". Indicate if it was. - * - * Inputs: - * Parameters: - * tname The "target" name for which to look - * - * Outputs: - * Returned Value: TRUE if the name is a valid "Shared Word" - * - * Extraneous Remarks: - * This is very similar to a call to handle_tic_vocab() except - * for the additional filtering for a "Shared Word" definer. - * - **************************************************************************** */ - -bool handle_shared_word( char *tname ) -{ - tic_hdr_t *found ; - bool retval = FALSE; - - found = lookup_shared_word( tname ); - if ( found != NULL ) - { - found->funct(found->pfield); - retval = TRUE; - } - - return ( retval ) ; -} - - -/* ************************************************************************** - * * Function name: lookup_shared_f_exec_word * Synopsis: Return a pointer to the data-structure of the named * word, only if it is a "Shared F-Exec Word"
Modified: fcode-utils/toke/scanner.c =================================================================== --- fcode-utils/toke/scanner.c 2006-10-14 20:18:07 UTC (rev 89) +++ fcode-utils/toke/scanner.c 2006-10-14 20:19:21 UTC (rev 90) @@ -3243,7 +3243,7 @@ bool retval = FALSE; char *defn_type_name;
- /* If already inside a colon, ERROR and discontinueprocessing */ + /* If already inside a colon, ERROR and discontinue processing */ /* If an alias to a definer is used, show the name of the alias */ if ( test_in_colon(statbuf, FALSE, TKERROR, NULL) ) { @@ -5011,9 +5011,9 @@ case VERSION1: case FCODE_V1: + fcode_starter( "version1", 1, FALSE) ; tokenization_error( INFO, "Using version1 header " "(8-bit offsets).\n"); - fcode_starter( "version1", 1, FALSE) ; break; case START1:
Modified: fcode-utils/toke/strsubvocab.c =================================================================== --- fcode-utils/toke/strsubvocab.c 2006-10-14 20:18:07 UTC (rev 89) +++ fcode-utils/toke/strsubvocab.c 2006-10-14 20:19:21 UTC (rev 90) @@ -45,14 +45,11 @@ /* ************************************************************************** * * Functions Exported: - * init_str_sub_vocab Initialize a String-Substitution vocab * add_str_sub_entry Add an entry to a Str-Subst vocab - * lookup_str_sub Look for a name in a String-Substitution - * vocab, return the substitution string. + * lookup_str_sub Look for a name in a String-Subst'n vocab; + * return a pointer to the structure. * exists_in_str_sub Confirm whether a given name exists in a * String-Substitution vocabulary - * create_str_sub_alias Duplicate the behavior of one name with - * another name. Return a "success" flag. * reset_str_sub_vocab Reset a given Str-Subst vocab to its initial * "Built-In" position. * @@ -72,34 +69,6 @@
/* ************************************************************************** * - * Function name: init_str_sub_vocab - * Synopsis: Dynamically initialize the link-pointers - * of the.given String-Substitution vocabulary - * - * Inputs: - * Parameters: - * str_sub_vocab_tbl Pointer to the initial Str-Subst vocab array - * max_indx Maximum Index of the initial array. - * - * Outputs: - * Returned Value: None - * Global Variables: - * The link-fields of the initial Str-Subs vocab array entries - * will be filled in. - * - **************************************************************************** */ - -void init_str_sub_vocab( str_sub_vocab_t *str_sub_vocab_tbl, int max_indx) -{ - int indx; - for ( indx = 1 ; indx < max_indx ; indx++ ) - { - str_sub_vocab_tbl[indx].next = &str_sub_vocab_tbl[indx-1]; - } -} - -/* ************************************************************************** - * * Function name: add_str_sub_entry * Synopsis: Add an entry to the given Str-Subst vocab * @@ -155,7 +124,8 @@ /* ************************************************************************** * * Function name: lookup_str_sub - * Synopsis: Look for a name in the given Str-Subst vocabulary + * Synopsis: Look for a name in the given Str-Subst vocabulary. + * Return a pointer to the structure if name was valid * * Inputs: * Parameters: @@ -163,22 +133,21 @@ * str_sub_vocab The Str-Subst vocab-list * * Outputs: - * Returned Value: Pointer to the substitution string, or - * NULL pointer if name not found. - * May be NULL if subst'n string is NULL. + * Returned Value: Pointer to the substitution-string entry + * data-structure. NULL if not found. * **************************************************************************** */
-char *lookup_str_sub( char *tname, str_sub_vocab_t *str_sub_vocab ) +str_sub_vocab_t *lookup_str_sub( char *tname, str_sub_vocab_t *str_sub_vocab ) { str_sub_vocab_t *curr; - char *retval = NULL; + str_sub_vocab_t *retval = NULL;
for (curr = str_sub_vocab ; curr != NULL ; curr=curr->next) { if ( strcasecmp(tname, curr->name) == 0 ) { - retval = curr->alias; + retval = curr; break; } } @@ -197,141 +166,21 @@ * str_sub_vocab Pointer to the Str-Subst vocab-list * * Outputs: - * Returned Value: TRUE if the name is found + * Returned Value: TRUE if the name is found * - * Extraneous Remarks: - * Because the Returned Value of lookup_str_sub() may be NULL for - * other reasons than that the name was not found, we cannot - * rely on that routine, and must replicate the outer-shell - * of its structure. - * **************************************************************************** */
bool exists_in_str_sub( char *tname, str_sub_vocab_t *str_sub_vocab ) { - str_sub_vocab_t *curr; bool retval = FALSE; + str_sub_vocab_t *found = NULL;
- for (curr = str_sub_vocab ; curr != NULL ; curr=curr->next) + found = lookup_str_sub( tname, str_sub_vocab ); + if ( found != NULL ) { - if ( strcasecmp(tname, curr->name) == 0 ) - { - retval = TRUE; - break; - } + retval = TRUE; } return ( retval );
}
-/* ************************************************************************** - * - * Function name: create_str_sub_alias - * Synopsis: Create an Alias in a String-Substitution vocabulary - * Return a "success" flag. - * - * Associated FORTH word: ALIAS - * - * Inputs: - * Parameters: - * old_name Name of existing entry - * new_name New name for which to create an entry - * *str_sub_vocab Pointer to "tail" of Str-Subst vocab-list - * - * Outputs: - * Returned Value: TRUE if old_name found in str_sub_vocab - * Supplied Pointers: - * *str_sub_vocab Will be updated to point to the new entry - * Memory Allocated: - * A copy of the "old" name's substitution string. - * When Freed? - * When reset_str_sub_vocab() is applied to the same vocab-list. - * In some instances, the new entry will be freed when the - * device-node in which it was created is "finish"ed; in - * others, only on termination of the program. - * - * Process Explanation: - * The "new" name is presumed to point to a stable memory-space. - * If the given "old" name exists in the given Str-Subst vocab-list, - * duplicate the substitution string into newly-allocated memory - * and pass the duplicated string and the "new" name along to - * the add_str_sub_entry() routine and return TRUE. - * If the given "old" name does not exist in the given vocab-list, - * return FALSE. - * - * Extraneous Remarks: - * This neatly bypasses the question of re-aliasing... ;-) - * - * We can rely on testing for a returned NULL from lookup_str_sub() - * because we won't be applying this routine to any vocabulary - * that permits a NULL in its substitution string. - * - **************************************************************************** */ - -bool create_str_sub_alias(char *new_name, - char *old_name, - str_sub_vocab_t **str_sub_vocab ) -{ - bool retval = FALSE; - char *old_subst_str = lookup_str_sub( old_name, *str_sub_vocab ); - if ( old_subst_str != NULL ) - { - char *new_subst_str = strdup(old_subst_str ); - add_str_sub_entry(new_name, new_subst_str, str_sub_vocab ); - retval = TRUE ; - } - - return ( retval ); -} - - -/* ************************************************************************** - * - * Function name: reset_str_sub_vocab - * Synopsis: Reset a given Str-Subst vocab to its initial - * "Built-In" position. - * - * Inputs: - * Parameters: - * *str_sub_vocab Pointer to the Str-Subst vocab-list - * reset_position Position to which to reset the list - * - * Outputs: - * Returned Value: NONE - * Supplied Pointers: - * *str_sub_vocab Reset to given "Built-In" position. - * Memory Freed - * All memory allocated by user-definitions will be freed - * - * Process Explanation: - * The "stable memory-spaces" to which the name and substitution - * string pointers point are presumed to have been acquired - * by allocation of memory, which is reasonable for entries - * created by the user as opposed to the built-in entries, - * which we are, in any case, not releasing. - * The substitution-string pointer may be null; watch out when - * we free() it; not all C implementations forgive that. - * - **************************************************************************** */ - -void reset_str_sub_vocab( - str_sub_vocab_t **str_sub_vocab , - str_sub_vocab_t *reset_position ) -{ - str_sub_vocab_t *next_t; - - next_t = *str_sub_vocab; - while ( next_t != reset_position ) - { - next_t = (*str_sub_vocab)->next ; - - free( (*str_sub_vocab)->name ); - if ( !(*str_sub_vocab)->alias ) - { - free( (*str_sub_vocab)->alias ); - } - free( *str_sub_vocab ); - *str_sub_vocab = next_t ; - } -} -
Modified: fcode-utils/toke/strsubvocab.h =================================================================== --- fcode-utils/toke/strsubvocab.h 2006-10-14 20:18:07 UTC (rev 89) +++ fcode-utils/toke/strsubvocab.h 2006-10-14 20:19:21 UTC (rev 90) @@ -55,31 +55,12 @@ struct str_sub_vocab *next; } str_sub_vocab_t;
-#if 0 /* On the way out */ -/* - * BUILTIN_STR_SUB Add an entry to the initial Str-Sub vocab. - * - * Arguments: (Both are strings) - * princ Principal name by which the string is known - * subst Substitution-string that replaces the Principal. - */ -#define BUILTIN_STR_SUB(princ, subst) \ - { princ , subst , (str_sub_vocab_t *)NULL } -#endif /* On the way out */
- -void init_str_sub_vocab( str_sub_vocab_t *str_sub_vocab_tbl, - int max_indx); void add_str_sub_entry( char *ename, char *subst_str, str_sub_vocab_t **str_sub_vocab ); -char *lookup_str_sub( char *tname, str_sub_vocab_t *str_sub_vocab ); -bool create_str_sub_alias(char *new_name, - char *old_name, - str_sub_vocab_t **str_sub_vocab ); +str_sub_vocab_t *lookup_str_sub( char *tname, str_sub_vocab_t *str_sub_vocab ); bool exists_in_str_sub( char *tname, str_sub_vocab_t *str_sub_vocab ); -void reset_str_sub_vocab( str_sub_vocab_t **str_sub_vocab , - str_sub_vocab_t *reset_position );
#endif /* _TOKE_STRSUBVOCAB_H */
Modified: fcode-utils/toke/toke.c =================================================================== --- fcode-utils/toke/toke.c 2006-10-14 20:18:07 UTC (rev 89) +++ fcode-utils/toke/toke.c 2006-10-14 20:19:21 UTC (rev 90) @@ -46,7 +46,7 @@ #include "stack.h" #include "emit.h"
-#define TOKE_VERSION "1.0.0" +#define TOKE_VERSION "1.0.1"
#include "vocabfuncts.h" #include "scanner.h"
Modified: fcode-utils/toke/tokzesc.c =================================================================== --- fcode-utils/toke/tokzesc.c 2006-10-14 20:18:07 UTC (rev 89) +++ fcode-utils/toke/tokzesc.c 2006-10-14 20:19:21 UTC (rev 90) @@ -36,10 +36,6 @@ * Functions Exported: * init_tokz_esc_vocab Initialize the relevant vocabulary. * enter_tokz_esc Enter "Tokenizer Escape" mode - * handle_tokz_esc Perform a function in the - * "Tokenizer Escape" Vocabulary - * exists_in_tokz_esc Confirm whether a given name exists in - * the "Tokz_Esc_Vocabulary" * create_tokz_esc_alias Add an alias to "Tokenizer Escape" space * reset_tokz_esc Reset the "Tokenizer Escape" Vocabulary * to its "Built-In" position. @@ -605,37 +601,6 @@
/* ************************************************************************** * - * Function name: handle_tokz_esc - * Synopsis: Perform a function in the "Tokenizer Escape" Vocabulary - * Indicate whether the name is valid in this vocabulary. - * Handle "Tokenizer Escape" aliases implicitly. - * - * Inputs: - * Parameters: - * tname The name to handle - * Global Variables: - * tokz_esc_vocab Pointer to "Tokenizer Escape" Vocabulary - * - * Outputs: - * Returned Value: TRUE if the given name is valid in tokz_esc - * - * Process Explanation: - * Find the name and execute its associated function. - * If the name is not in the "Tokenizer Escape" Vocabulary, - * let the calling routine determine whether to try it - * out as a number or to print an error message. - * - **************************************************************************** */ - -bool handle_tokz_esc( char *tname ) -{ - bool retval = handle_tic_vocab( tname, tokz_esc_vocab ); - return ( retval ) ; -} - - -/* ************************************************************************** - * * Function name: lookup_tokz_esc * Synopsis: Return a pointer to the data-structure of the named * word in the"Tokenizer Escape" Vocabulary @@ -660,30 +625,6 @@
/* ************************************************************************** * - * Function name: exists_in_tokz_esc - * Synopsis: Confirm whether a given name exists in the - * "Tokenizer Escape" Vocabulary - * - * Inputs: - * Parameters: - * name The given name to confirm - * Global Variables: - * tokz_esc_vocab Pointer to "Tokenizer Escape" Vocabulary - * - * Outputs: - * Returned Value: TRUE if name is found, - * - **************************************************************************** */ - -bool exists_in_tokz_esc(char *name) -{ - bool retval = exists_in_tic_vocab( name, tokz_esc_vocab ); - return ( retval ); -} - - -/* ************************************************************************** - * * Function name: create_tokz_esc_alias * Synopsis: Create an alias in the "Tokenizer Escape" Vocabulary *
Modified: fcode-utils/toke/tokzesc.h =================================================================== --- fcode-utils/toke/tokzesc.h 2006-10-14 20:18:07 UTC (rev 89) +++ fcode-utils/toke/tokzesc.h 2006-10-14 20:19:21 UTC (rev 90) @@ -41,9 +41,7 @@ void init_tokz_esc_vocab( void ); bool create_tokz_esc_alias(char *new_name, char *old_name); void enter_tokz_esc( void ); -bool handle_tokz_esc( char *tname ); tic_hdr_t *lookup_tokz_esc(char *name); -bool exists_in_tokz_esc(char *name); void reset_tokz_esc( void ); void pop_next_fcode( void);
Modified: fcode-utils/toke/usersymbols.c =================================================================== --- fcode-utils/toke/usersymbols.c 2006-10-14 20:18:07 UTC (rev 89) +++ fcode-utils/toke/usersymbols.c 2006-10-14 20:19:21 UTC (rev 90) @@ -37,7 +37,7 @@ * The syntax for user-defined command-line compilation-control symbols * is <NAME>[=<VALUE>] * - * The name is always required; the equal-sign and value is optional. + * The name is always required; the equal-sign and value are optional. * If you wish the "value" to contain spaces or quotes, you can * accomplish that using the shell escape conventions. * @@ -65,11 +65,9 @@ * * Functions Exported: * add_user_symbol Add a user-defined symbol to the list - * lookup_user_symbol Look for a user-defined symbol, return - * the assigned value. * exists_as_user_symbol Confirm whether a given name exists * as a user-defined symbol. - * eval_user_symbol Tokenize the value assigned to a user + * eval_user_symbol Evaluate the value assigned to a user * symbol. * list_user_symbols Print the list of user-defined symbols * for the Logfile. @@ -90,7 +88,7 @@ * were created on the command-line; if we ever allow symbols * to be defined in the Source file, they should be as volatile * as anything else that comes from a source file... - * Putting source-file-derived user-defined symbols into the Global + * Appending source-file-derived user-defined symbols to the Global * Vocabulary could be a quasi-simple way to accomplish this.) * * Enable the definition of user-symbols from the Source file, using @@ -150,7 +148,7 @@ * Memory Allocated: * for the string(s) and the new entry * When Freed? - * Never. Well, only on termination of the program. User-defined + * Never. Well, upon termination of the program. User-defined * symbols endure for the entire batch of tokenizations. * * Process Explanation: @@ -183,33 +181,6 @@
/* ************************************************************************** * - * Function name: lookup_user_symbol - * Synopsis: Look for the given name as user-defined symbol, return - * the assigned value. - * - * Inputs: - * Parameters: - * symb_nam The name for which to look. - * Local Static Variables: - * user_symbol_list Pointer to the list of user-defined symbols. - * - * Outputs: - * Returned Value: Pointer to the "value" string, or NULL - * pointer if the name was not found. - * May also be NULL if "value" is NULL. - * - **************************************************************************** */ - -char *lookup_user_symbol(char *symb_nam) -{ - char *symb_valu; - - symb_valu = lookup_str_sub(symb_nam, user_symbol_list ); - return (symb_valu); -} - -/* ************************************************************************** - * * Function name: exists_as_user_symbol * Synopsis: Confirm whether a given name exists * as a user-defined symbol. @@ -236,7 +207,7 @@ /* ************************************************************************** * * Function name: eval_user_symbol - * Synopsis: Tokenize the value assigned to a user-symbol. + * Synopsis: Evaluate the value assigned to a user-symbol. * * Associated Tokenizer directive (synonyms): [DEFINED] * #DEFINED @@ -251,7 +222,7 @@ * * Inputs: * Parameters: - * symbol The User-Defined-Symbol to evaluate + * symb_nam Name of the User-Defined-Symbol to evaluate * Local Static Variables: * user_symbol_list Pointer to the list of user-defined symbols. * @@ -262,13 +233,15 @@ * Error Detection: * Calling routine is responsible for verifying that the user-symbol * is on the same line as the directive. - * WARNING if the symbol is not found or has no assigned value. + * ERROR if the symbol is not found + * WARNING if the symbol has no assigned value. * * Process Explanation: - * Look up the parameter in the User Symbol List, and retrieve - * its associated value. - * If it is not found, or if it has no associated value, issue - * a WARNING and do nothing further. Otherwise... + * Look up the parameter in the User Symbol List, + * If it is not found, issue an ERROR and do nothing further. + * If it is found, attempt to retrieve its associated value + * If it has no associated value, issue a WARNING and + * do nothing further. Otherwise... * Interpret the associated value as though it were source. * * Still to be done: @@ -277,16 +250,26 @@ * **************************************************************************** */
-void eval_user_symbol(char *symbol ) +void eval_user_symbol( char *symb_nam) { - char *symb_valu; - symb_valu = lookup_user_symbol(symbol ); - if ( symb_valu == NULL ) + str_sub_vocab_t *found = NULL; + + + found = lookup_str_sub( symb_nam, user_symbol_list ); + if ( found == NULL ) { - tokenization_error ( WARNING, - "No value assigned to command-line symbol %s\n", symbol ); + tokenization_error ( TKERROR, + "Command-line symbol %s is not defined.\n", symb_nam); }else{ - eval_string( symb_valu ); + char *symb_valu = found->alias; + + if ( symb_valu == NULL ) + { + tokenization_error ( WARNING, + "No value assigned to command-line symbol %s\n", symb_nam ); + }else{ + eval_string( symb_valu ); + } }
} @@ -311,13 +294,30 @@ * We will: * Allocate a temporary array of pointers. * Step backwards through the linked-list of symbols, and - * enter their pointers into the array. + * enter their pointers into the array. The array order + * reflects the backward-linked order of the linked-list + * of symbols is kept and searched, * Collect the maximum length of the symbol names. - * Step through the array in the reverse order, printing - * as we go. - * Use the max name length to space the equal-signs evenly + * Step through the array in the reverse order, to follow the + * order in which the symbols were defined. + * Check for a duplicate of the current symbol name: + * Look backwards through the array, at the names we + * have not yet printed, which were defined later. + * Since the later-defined value will prevail, the + * notation should be on the earlier one. + * Print the current name + * Use the maximum name-length to space the equal-signs or + * duplicate-name notation, as required, evenly. * Free the temporary array. * + * Revision History: + * Updated Thu, 07 Sep 2006 by David L. Paktor + * Report duplicated symbol names. + * + * Still to be done: + * Space the duplicate-name notation evenly; line it up past + * the longest name-with-value. + * **************************************************************************** */
void list_user_symbols(void ) @@ -346,16 +346,46 @@ printf("\nUser-Defined Symbols:\n"); while ( indx > 0 ) { + bool is_dup; + int dup_srch_indx; indx--; curr = symb_ptr[indx]; + + /* Detect duplicate names. */ + dup_srch_indx = indx; + is_dup = FALSE; + while ( dup_srch_indx > 0 ) + { + str_sub_vocab_t *dup_cand; + dup_srch_indx--; + dup_cand = symb_ptr[dup_srch_indx]; + if ( strcmp( curr->name, dup_cand->name) == 0 ) + { + is_dup = TRUE; + break; + } + } + printf("\t%s",curr->name); - if ( curr->alias != NULL ) + + if ( ( curr->alias != NULL ) || is_dup ) { int strindx; for ( strindx = strlen(curr->name) ; - strindx < maxlen ; strindx++ ) printf(" "); + strindx < maxlen ; + strindx++ ) + { + printf(" "); + } + } + if ( curr->alias != NULL ) + { printf(" = %s",curr->alias); } + if ( is_dup ) + { + printf(" *** Over-ridden" ); + } printf("\n"); } free(symb_ptr);
Modified: fcode-utils/toke/usersymbols.h =================================================================== --- fcode-utils/toke/usersymbols.h 2006-10-14 20:18:07 UTC (rev 89) +++ fcode-utils/toke/usersymbols.h 2006-10-14 20:19:21 UTC (rev 90) @@ -38,7 +38,6 @@ **************************************************************************** */
void add_user_symbol(char *raw_symb); -char *lookup_user_symbol(char *symb_nam); bool exists_as_user_symbol(char *symb_nam); void eval_user_symbol(char *symbol ); void list_user_symbols(void );
Modified: fcode-utils/toke/vocabfuncts.h =================================================================== --- fcode-utils/toke/vocabfuncts.h 2006-10-14 20:18:07 UTC (rev 89) +++ fcode-utils/toke/vocabfuncts.h 2006-10-14 20:19:21 UTC (rev 90) @@ -56,8 +56,6 @@
tic_hdr_t *lookup_core_word( char *tname); -bool exists_in_core( char *name); -bool handle_core_word( char *tname ); bool create_core_alias( char *new_name, char *old_name);
void enter_global_scope( void ); @@ -65,7 +63,6 @@
tic_hdr_t *lookup_current( char *name); bool exists_in_current( char *tname); -bool handle_current( char *tname ); tic_hdr_t *lookup_in_dev_node( char *tname); void add_to_current( char *name, TIC_P_DEFLT_TYPE fc_token, @@ -81,7 +78,6 @@ void token_entry_warning( tic_hdr_t *t_entry);
tic_hdr_t *lookup_shared_word( char *tname); -bool handle_shared_word( char *tname ); tic_hdr_t *lookup_shared_f_exec_word( char *tname);
void init_dictionary( void );