Skip to content

Commit 6dcfd5a

Browse files
author
Stefan Reinauer
committed
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 parent 13d59b2 commit 6dcfd5a

12 files changed

Lines changed: 104 additions & 434 deletions

File tree

detok/decode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static void output_token_name(void)
206206
* or
207207
* b) detok is in verbose mode.
208208
*/
209-
if ( tname == unnamed )
209+
if ( strcmp( tname, unnamed) == 0 )
210210
{
211211
printf("[0x%03x] ", fcode);
212212
} else {
@@ -355,7 +355,7 @@ static void new_token(void)
355355
output_token();
356356
token = next_token();
357357
printf("0x%03x\n",token);
358-
add_token(token, (char *)unnamed);
358+
add_token(token, strdup(unnamed));
359359
}
360360

361361
static void named_token(void)

detok/detok.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ int main(int argc, char **argv)
184184
close_stream();
185185

186186
optind++;
187+
reset_dictionary();
187188
}
188189

189190
printf("\n");

toke/dictionary.c

Lines changed: 0 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -210,61 +210,6 @@ tic_hdr_t *lookup_core_word( char *tname)
210210
return ( found ) ;
211211
}
212212

213-
/* **************************************************************************
214-
*
215-
* Function name: exists_in_core
216-
* Synopsis: Confirm whether the given name exists in the
217-
* Global (aka "core") Vocabulary. Search the
218-
* Global Vocabulary exclusively.
219-
*
220-
* Inputs:
221-
* Parameters:
222-
* name The name for which to look
223-
* Local Static Variables:
224-
* global_voc_dict_ptr "Tail" of Global Vocabulary
225-
*
226-
* Outputs:
227-
* Returned Value: TRUE if name is found.
228-
*
229-
**************************************************************************** */
230-
231-
bool exists_in_core( char *name)
232-
{
233-
return exists_in_tic_vocab( name, global_voc_dict_ptr );
234-
}
235-
236-
/* **************************************************************************
237-
*
238-
* Function name: handle_core_word
239-
* Synopsis: Perform a function in the "Global" Vocabulary and
240-
* indicate whether the name is valid.
241-
*
242-
* Inputs:
243-
* Parameters:
244-
* tname The name to handle
245-
* Local Static Variables:
246-
* global_voc_dict_ptr "Tail" of Global Vocabulary
247-
*
248-
* Outputs:
249-
* Returned Value: TRUE if the given name is valid in Global Vocab
250-
*
251-
* Error Detection:
252-
* If the name is not in the "Global" Vocabulary, let the calling
253-
* routine determine whether to print an error message or to
254-
* try it out as a number.
255-
*
256-
**************************************************************************** */
257-
258-
bool handle_core_word( char *tname )
259-
{
260-
bool retval;
261-
262-
retval = handle_tic_vocab( tname, global_voc_dict_ptr );
263-
264-
return ( retval ) ;
265-
}
266-
267-
268213
/* **************************************************************************
269214
*
270215
* Function name: create_core_alias
@@ -618,41 +563,6 @@ bool exists_in_current( char *tname)
618563
return( retval);
619564
}
620565

621-
622-
/* **************************************************************************
623-
*
624-
* Function name: handle_current
625-
* Synopsis: Perform a function in the current device-node vocab,
626-
* if one is in effect, or in the "Global" Vocabulary.
627-
* Indicate whether the name is valid.
628-
*
629-
* Inputs:
630-
* Parameters:
631-
* tname The name to handle
632-
* Global Variables:
633-
* current_definitions Device-Node (or Global) Vocabulary
634-
* currently in effect.
635-
* scope_is_global TRUE if "global" scope is in effect
636-
* Local Static Variables:
637-
*
638-
* Outputs:
639-
* Returned Value: TRUE if the given name is valid
640-
*
641-
**************************************************************************** */
642-
643-
bool handle_current( char *tname )
644-
{
645-
bool retval = handle_tic_vocab( tname, *current_definitions );
646-
647-
if ( INVERSE(retval) && INVERSE(scope_is_global) )
648-
{
649-
retval = handle_core_word( tname );
650-
}
651-
return ( retval );
652-
653-
}
654-
655-
656566
/* **************************************************************************
657567
*
658568
* Function name: lookup_in_dev_node
@@ -1776,41 +1686,6 @@ tic_hdr_t *lookup_shared_word( char *tname)
17761686

17771687
}
17781688

1779-
/* **************************************************************************
1780-
*
1781-
* Function name: handle_shared_word
1782-
* Synopsis: Perform the function associated with the given name
1783-
* only if it is a "Shared Word". Indicate if it was.
1784-
*
1785-
* Inputs:
1786-
* Parameters:
1787-
* tname The "target" name for which to look
1788-
*
1789-
* Outputs:
1790-
* Returned Value: TRUE if the name is a valid "Shared Word"
1791-
*
1792-
* Extraneous Remarks:
1793-
* This is very similar to a call to handle_tic_vocab() except
1794-
* for the additional filtering for a "Shared Word" definer.
1795-
*
1796-
**************************************************************************** */
1797-
1798-
bool handle_shared_word( char *tname )
1799-
{
1800-
tic_hdr_t *found ;
1801-
bool retval = FALSE;
1802-
1803-
found = lookup_shared_word( tname );
1804-
if ( found != NULL )
1805-
{
1806-
found->funct(found->pfield);
1807-
retval = TRUE;
1808-
}
1809-
1810-
return ( retval ) ;
1811-
}
1812-
1813-
18141689
/* **************************************************************************
18151690
*
18161691
* Function name: lookup_shared_f_exec_word

toke/scanner.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3243,7 +3243,7 @@ static bool create_word(fwtoken definer)
32433243
bool retval = FALSE;
32443244
char *defn_type_name;
32453245

3246-
/* If already inside a colon, ERROR and discontinueprocessing */
3246+
/* If already inside a colon, ERROR and discontinue processing */
32473247
/* If an alias to a definer is used, show the name of the alias */
32483248
if ( test_in_colon(statbuf, FALSE, TKERROR, NULL) )
32493249
{
@@ -5011,9 +5011,9 @@ void handle_internal( tic_param_t pfield)
50115011

50125012
case VERSION1:
50135013
case FCODE_V1:
5014+
fcode_starter( "version1", 1, FALSE) ;
50145015
tokenization_error( INFO, "Using version1 header "
50155016
"(8-bit offsets).\n");
5016-
fcode_starter( "version1", 1, FALSE) ;
50175017
break;
50185018

50195019
case START1:

0 commit comments

Comments
 (0)