Commit 6dcfd5aa72c8e507aa63ebc0428a5d18034ddc52

Stefan Reinauer 2006-10-14T20:19:21

merge David Paktor's changes for toke 1.0.1 git-svn-id: svn://coreboot.org/openbios/fcode-utils@90 f158a5a8-5612-0410-a976-696ce0be7e32

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
diff --git a/detok/decode.c b/detok/decode.c
index 000e740..9cf6a72 100644
--- a/detok/decode.c
+++ b/detok/decode.c
@@ -206,7 +206,7 @@ static void output_token_name(void)
 	 *            or
 	 *  b) detok is in verbose mode.
 	 */
-       if ( tname == unnamed )
+       if ( strcmp( tname, unnamed) == 0 )
        {
 		printf("[0x%03x] ", fcode);
        } else {
@@ -355,7 +355,7 @@ static void new_token(void)
 	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)
diff --git a/detok/detok.c b/detok/detok.c
index a69441e..041012a 100644
--- a/detok/detok.c
+++ b/detok/detok.c
@@ -184,6 +184,7 @@ int main(int argc, char **argv)
 		close_stream();
 		
 		optind++;
+		reset_dictionary();
 	}
 	
 	printf("\n");
diff --git a/toke/dictionary.c b/toke/dictionary.c
index a662a4d..dcc7bde 100644
--- a/toke/dictionary.c
+++ b/toke/dictionary.c
@@ -212,61 +212,6 @@ tic_hdr_t *lookup_core_word( char *tname)
 
 /* **************************************************************************
  *
- *      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,41 +563,6 @@ bool exists_in_current( char *tname)
     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
@@ -1778,41 +1688,6 @@ tic_hdr_t *lookup_shared_word( char *tname)
 
 /* **************************************************************************
  *
- *      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"
diff --git a/toke/scanner.c b/toke/scanner.c
index 030f667..16336af 100644
--- a/toke/scanner.c
+++ b/toke/scanner.c
@@ -3243,7 +3243,7 @@ static bool create_word(fwtoken definer)
     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 @@ void handle_internal( tic_param_t pfield)
 	
 	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:
diff --git a/toke/strsubvocab.c b/toke/strsubvocab.c
index ddb6139..5717be9 100644
--- a/toke/strsubvocab.c
+++ b/toke/strsubvocab.c
@@ -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 @@ void add_str_sub_entry( char *ename,
 /* **************************************************************************
  *
  *      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 @@ void add_str_sub_entry( char *ename,
  *             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 @@ char *lookup_str_sub( char *tname, str_sub_vocab_t *str_sub_vocab )
  *             str_sub_vocab        Pointer to the Str-Subst vocab-list
  *
  *      Outputs:
- *         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.
+ *         Returned Value:          TRUE if the name is found
  *
  **************************************************************************** */
 
 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 ;
-    }
-}
-
diff --git a/toke/strsubvocab.h b/toke/strsubvocab.h
index 5b404da..93838f5 100644
--- a/toke/strsubvocab.h
+++ b/toke/strsubvocab.h
@@ -55,31 +55,12 @@ typedef struct str_sub_vocab {
 	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    */
diff --git a/toke/toke.c b/toke/toke.c
index d9739a0..367cd1a 100644
--- a/toke/toke.c
+++ b/toke/toke.c
@@ -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"
diff --git a/toke/tokzesc.c b/toke/tokzesc.c
index a45f952..703b393 100644
--- a/toke/tokzesc.c
+++ b/toke/tokzesc.c
@@ -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 @@ void init_tokz_esc_vocab ( void )
 
 /* **************************************************************************
  *
- *      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 @@ tic_hdr_t *lookup_tokz_esc(char *name)
 
 /* **************************************************************************
  *
- *      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
  *
diff --git a/toke/tokzesc.h b/toke/tokzesc.h
index 21c74da..717b45c 100644
--- a/toke/tokzesc.h
+++ b/toke/tokzesc.h
@@ -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);
 
diff --git a/toke/usersymbols.c b/toke/usersymbols.c
index f0acbf5..388b819 100644
--- a/toke/usersymbols.c
+++ b/toke/usersymbols.c
@@ -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 @@ static int user_symbol_count = 0;
  *         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 @@ void add_user_symbol(char *raw_symb)
 
 /* **************************************************************************
  *
- *      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 @@ bool exists_as_user_symbol(char *symb_nam)
 /* **************************************************************************
  *
  *      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 @@ bool exists_as_user_symbol(char *symb_nam)
  *
  *      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 @@ bool exists_as_user_symbol(char *symb_nam)
  *      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 @@ bool exists_as_user_symbol(char *symb_nam)
  *
  **************************************************************************** */
 
-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 @@ void eval_user_symbol(char *symbol )
  *          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 @@ void list_user_symbols(void )
 	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);
diff --git a/toke/usersymbols.h b/toke/usersymbols.h
index 26d2869..a6f4776 100644
--- a/toke/usersymbols.h
+++ b/toke/usersymbols.h
@@ -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 );
diff --git a/toke/vocabfuncts.h b/toke/vocabfuncts.h
index eb46e79..7eb97dd 100644
--- a/toke/vocabfuncts.h
+++ b/toke/vocabfuncts.h
@@ -56,8 +56,6 @@ extern bool scope_is_global;
 
 
 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 @@ void resume_device_scope( void );
 
 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 @@ bool entry_is_token( tic_hdr_t *test_entry );
 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 );