[OpenBIOS] r96 - fcode-utils/detok
svn at openbios.org
svn at openbios.org
Sat Oct 14 23:32:17 CEST 2006
Author: stepan
Date: 2006-10-14 23:32:13 +0200 (Sat, 14 Oct 2006)
New Revision: 96
Modified:
fcode-utils/detok/addfcodes.c
fcode-utils/detok/addfcodes.h
fcode-utils/detok/decode.c
fcode-utils/detok/detok.c
fcode-utils/detok/detok.h
fcode-utils/detok/dictionary.c
fcode-utils/detok/pcihdr.c
fcode-utils/detok/printformats.c
fcode-utils/detok/stream.c
fcode-utils/detok/stream.h
Log:
fix indentation
Modified: fcode-utils/detok/addfcodes.c
===================================================================
--- fcode-utils/detok/addfcodes.c 2006-10-14 21:07:27 UTC (rev 95)
+++ fcode-utils/detok/addfcodes.c 2006-10-14 21:32:13 UTC (rev 96)
@@ -97,17 +97,15 @@
*
**************************************************************************** */
-static void skip_whitespace( char **string_line_ptr)
+static void skip_whitespace(char **string_line_ptr)
{
- char *cur_char_ptr = *string_line_ptr;
- for ( ; *cur_char_ptr != 0 ; cur_char_ptr++ )
- {
- if ( (*cur_char_ptr != '\t') && (*cur_char_ptr != ' ') )
- {
- *string_line_ptr = cur_char_ptr;
- break;
+ char *cur_char_ptr = *string_line_ptr;
+ for (; *cur_char_ptr != 0; cur_char_ptr++) {
+ if ((*cur_char_ptr != '\t') && (*cur_char_ptr != ' ')) {
+ *string_line_ptr = cur_char_ptr;
+ break;
+ }
}
- }
}
/* **************************************************************************
@@ -134,24 +132,26 @@
*
**************************************************************************** */
-static bool get_next_vfc_line( void )
+static bool get_next_vfc_line(void)
{
- bool retval = FALSE; /* TRUE = not at end yet */
- while ( vfc_remainder < vfc_buf_end )
- {
- current_vfc_line = vfc_remainder;
- vfc_remainder = strchr( current_vfc_line, '\n');
- *vfc_remainder = 0;
- vfc_remainder++;
- vfc_line_no++;
- skip_whitespace( ¤t_vfc_line);
- if ( *current_vfc_line == 0 ) continue; /* Blank line */
- if ( *current_vfc_line == '#' ) continue; /* Comment */
- if ( *current_vfc_line == '\\' ) continue; /* Comment */
- retval = TRUE;
- break; /* Found something */
- }
- return( retval);
+ bool retval = FALSE; /* TRUE = not at end yet */
+ while (vfc_remainder < vfc_buf_end) {
+ current_vfc_line = vfc_remainder;
+ vfc_remainder = strchr(current_vfc_line, '\n');
+ *vfc_remainder = 0;
+ vfc_remainder++;
+ vfc_line_no++;
+ skip_whitespace(¤t_vfc_line);
+ if (*current_vfc_line == 0)
+ continue; /* Blank line */
+ if (*current_vfc_line == '#')
+ continue; /* Comment */
+ if (*current_vfc_line == '\\')
+ continue; /* Comment */
+ retval = TRUE;
+ break; /* Found something */
+ }
+ return (retval);
}
/* **************************************************************************
@@ -176,20 +176,19 @@
*
**************************************************************************** */
static bool did_not_splash = TRUE;
-static void vfc_splash( char *vf_file_name)
+static void vfc_splash(char *vf_file_name)
{
- if ( did_not_splash )
- {
- /* Temporary substring buffer */
- /* Guarantee that the malloc will be big enough. */
- char *strbfr = malloc( strlen( vf_file_name) +65 ) ;
- sprintf( strbfr,
- "Reading additional FCodes from file: %s\n",
- vf_file_name);
- printremark( strbfr);
- free( strbfr);
- did_not_splash = FALSE;
- }
+ if (did_not_splash) {
+ /* Temporary substring buffer */
+ /* Guarantee that the malloc will be big enough. */
+ char *strbfr = malloc(strlen(vf_file_name) + 65);
+ sprintf(strbfr,
+ "Reading additional FCodes from file: %s\n",
+ vf_file_name);
+ printremark(strbfr);
+ free(strbfr);
+ did_not_splash = FALSE;
+ }
}
/* **************************************************************************
@@ -240,104 +239,98 @@
*
**************************************************************************** */
-bool add_fcodes_from_list( char *vf_file_name)
+bool add_fcodes_from_list(char *vf_file_name)
{
- bool retval = FALSE;
- int added_fc_count = 0;
- check_tok_seq = FALSE;
+ bool retval = FALSE;
+ int added_fc_count = 0;
+ check_tok_seq = FALSE;
- if ( verbose ) vfc_splash( vf_file_name);
+ if (verbose)
+ vfc_splash(vf_file_name);
- if ( init_stream( vf_file_name) != 0 )
- {
- char *strbfr = malloc( strlen( vf_file_name) +65 );
- sprintf( strbfr,
- "Could not open Additional FCodes file: %s\n",
- vf_file_name);
- printremark( strbfr);
- free( strbfr);
- exit(1);
- }
- vfc_remainder = indata;
- vfc_buf_end = indata + stream_max -1;
+ if (init_stream(vf_file_name) != 0) {
+ char *strbfr = malloc(strlen(vf_file_name) + 65);
+ sprintf(strbfr,
+ "Could not open Additional FCodes file: %s\n",
+ vf_file_name);
+ printremark(strbfr);
+ free(strbfr);
+ exit(1);
+ }
+ vfc_remainder = indata;
+ vfc_buf_end = indata + stream_max - 1;
- while ( get_next_vfc_line() )
- {
- char vs_fc_name[36];
- int vs_fc_number;
- int scan_result;
- char *lookup_result;
- char *fc_name_cpy;
+ while (get_next_vfc_line()) {
+ char vs_fc_name[36];
+ int vs_fc_number;
+ int scan_result;
+ char *lookup_result;
+ char *fc_name_cpy;
- scan_result = sscanf( current_vfc_line, "0x%x %32s",
- &vs_fc_number, vs_fc_name);
+ scan_result = sscanf(current_vfc_line, "0x%x %32s",
+ &vs_fc_number, vs_fc_name);
- if ( scan_result != 2 ) /* Allow a capital 0X */
- {
- scan_result = sscanf( current_vfc_line, "0X%x %32s",
- &vs_fc_number, vs_fc_name);
- }
- if ( scan_result != 2 ) /* Try it without the 0x */
- {
- scan_result = sscanf( current_vfc_line, "%x %32s",
- &vs_fc_number, vs_fc_name);
- }
+ if (scan_result != 2) { /* Allow a capital 0X */
+ scan_result = sscanf(current_vfc_line, "0X%x %32s",
+ &vs_fc_number, vs_fc_name);
+ }
+ if (scan_result != 2) { /* Try it without the 0x */
+ scan_result = sscanf(current_vfc_line, "%x %32s",
+ &vs_fc_number, vs_fc_name);
+ }
- if ( scan_result != 2 ) /* That's it... */
- {
- char *strbfr = malloc( strlen( current_vfc_line) +65 );
- vfc_splash( vf_file_name);
- sprintf( strbfr,
- "Line #%d, invalid format. Ignoring: %s\n",
- vfc_line_no, current_vfc_line);
- printremark( strbfr);
- free( strbfr);
- continue;
- }
+ if (scan_result != 2) { /* That's it... */
+ char *strbfr =
+ malloc(strlen(current_vfc_line) + 65);
+ vfc_splash(vf_file_name);
+ sprintf(strbfr,
+ "Line #%d, invalid format. Ignoring: %s\n",
+ vfc_line_no, current_vfc_line);
+ printremark(strbfr);
+ free(strbfr);
+ continue;
+ }
- if ( ( vs_fc_number < 0x10 ) || ( vs_fc_number > 0x7ff ) )
- {
- char *strbfr = malloc( 85 );
- vfc_splash( vf_file_name);
- sprintf( strbfr,
- "Line #%d, FCode number out of range: 0x%x Ignoring.\n",
- vfc_line_no, vs_fc_number);
- printremark( strbfr);
- free( strbfr);
- continue;
+ if ((vs_fc_number < 0x10) || (vs_fc_number > 0x7ff)) {
+ char *strbfr = malloc(85);
+ vfc_splash(vf_file_name);
+ sprintf(strbfr,
+ "Line #%d, FCode number out of range: 0x%x Ignoring.\n",
+ vfc_line_no, vs_fc_number);
+ printremark(strbfr);
+ free(strbfr);
+ continue;
+ }
+
+ lookup_result = lookup_token((u16) vs_fc_number);
+ if (strcmp(lookup_result, "ferror") != 0) {
+ char *strbfr = malloc(strlen(lookup_result) + 85);
+ vfc_splash(vf_file_name);
+ sprintf(strbfr,
+ "Line #%d. FCode number 0x%x is already "
+ "defined as %s Ignoring.\n",
+ vfc_line_no, vs_fc_number, lookup_result);
+ printremark(strbfr);
+ free(strbfr);
+ continue;
+ }
+
+ /* We've passed all the tests! */
+ fc_name_cpy = strdup(vs_fc_name);
+ add_token((u16) vs_fc_number, fc_name_cpy);
+ added_fc_count++;
+ retval = TRUE;
}
- lookup_result = lookup_token( (u16)vs_fc_number);
- if ( strcmp( lookup_result, "ferror") != 0 )
- {
- char *strbfr = malloc( strlen( lookup_result) + 85 );
- vfc_splash( vf_file_name);
- sprintf( strbfr,
- "Line #%d. FCode number 0x%x is already "
- "defined as %s Ignoring.\n",
- vfc_line_no, vs_fc_number, lookup_result);
- printremark( strbfr);
- free( strbfr);
- continue;
+ if (verbose) {
+ char *strbfr = malloc(85);
+ sprintf(strbfr,
+ "Added %d FCode numbers\n", added_fc_count);
+ printremark(strbfr);
+ free(strbfr);
}
- /* We've passed all the tests! */
- fc_name_cpy = strdup( vs_fc_name);
- add_token( (u16)vs_fc_number, fc_name_cpy);
- added_fc_count++;
- retval = TRUE;
- }
-
- if ( verbose )
- {
- char *strbfr = malloc( 85 );
- sprintf( strbfr,
- "Added %d FCode numbers\n", added_fc_count);
- printremark( strbfr);
- free( strbfr);
- }
-
- close_stream();
- check_tok_seq = TRUE;
- return( retval);
+ close_stream();
+ check_tok_seq = TRUE;
+ return (retval);
}
Modified: fcode-utils/detok/addfcodes.h
===================================================================
--- fcode-utils/detok/addfcodes.h 2006-10-14 21:07:27 UTC (rev 95)
+++ fcode-utils/detok/addfcodes.h 2006-10-14 21:32:13 UTC (rev 96)
@@ -43,6 +43,6 @@
*
**************************************************************************** */
-bool add_fcodes_from_list( char *vf_file_name);
+bool add_fcodes_from_list(char *vf_file_name);
-#endif /* _DETOK_VSFCODES_H */
+#endif /* _DETOK_VSFCODES_H */
Modified: fcode-utils/detok/decode.c
===================================================================
--- fcode-utils/detok/decode.c 2006-10-14 21:07:27 UTC (rev 95)
+++ fcode-utils/detok/decode.c 2006-10-14 21:32:13 UTC (rev 96)
@@ -39,7 +39,7 @@
#include "detok.h"
#include "stream.h"
-static int indent; /* Current level of indentation */
+static int indent; /* Current level of indentation */
/* **************************************************************************
*
@@ -53,71 +53,71 @@
*
**************************************************************************** */
-static bool ended_okay = TRUE; /* FALSE if finished prematurely */
+static bool ended_okay = TRUE; /* FALSE if finished prematurely */
-bool offs16=TRUE;
+bool offs16 = TRUE;
unsigned int linenum;
-bool end_found=FALSE;
-unsigned int token_streampos; /* Streampos() of currently-gotten token */
+bool end_found = FALSE;
+unsigned int token_streampos; /* Streampos() of currently-gotten token */
u16 last_defined_token = 0;
jmp_buf eof_exception;
static int fclen;
-static const char *unnamed = "(unnamed-fcode)" ;
+static const char *unnamed = "(unnamed-fcode)";
-static void decode_indent(void)
+static void decode_indent(void)
{
int i;
- if (indent<0) {
+ if (indent < 0) {
#ifdef DEBUG_INDENT
printf("detok: error in indentation code.\n");
#endif
- indent=0;
+ indent = 0;
}
- for (i=0; i<indent; i++)
- printf (" ");
+ for (i = 0; i < indent; i++)
+ printf(" ");
}
-
+
/* Print forth string ( [len] char[0] ... char[len] ) */
static void pretty_print_string(void)
{
- u8 len;
- u8 *strptr;
- int indx;
- bool in_parens = FALSE ; /* Are we already inside parentheses? */
+ u8 len;
+ u8 *strptr;
+ int indx;
+ bool in_parens = FALSE; /* Are we already inside parentheses? */
- strptr = get_string( &len );
+ strptr = get_string(&len);
- printf("( len=%s%x", len >= 10 ? "0x":"", len);
- if ( len >= 10 ) printf(" [%d bytes]", len);
- printf(" )\n");
- if (show_linenumbers) printf(" ");
- decode_indent();
+ printf("( len=%s%x", len >= 10 ? "0x" : "", len);
+ if (len >= 10)
+ printf(" [%d bytes]", len);
+ printf(" )\n");
+ if (show_linenumbers)
+ printf(" ");
+ decode_indent();
printf("\" ");
- for ( indx = 0; indx < len; indx++ )
- {
- u8 c = *strptr++;
+ for (indx = 0; indx < len; indx++) {
+ u8 c = *strptr++;
if (isprint(c)) {
- if ( in_parens )
- {
+ if (in_parens) {
printf(" )");
- in_parens = FALSE;
+ in_parens = FALSE;
}
- printf("%c",c);
- /* Quote-mark must escape itself */
- if ( c == '"' ) printf("%c",c);
+ printf("%c", c);
+ /* Quote-mark must escape itself */
+ if (c == '"')
+ printf("%c", c);
} else {
- if ( !in_parens )
- {
+ if (!in_parens) {
printf("\"(");
- in_parens = TRUE;
+ in_parens = TRUE;
}
- printf(" %02x",c);
+ printf(" %02x", c);
}
}
- if ( in_parens )
+ if (in_parens)
printf(" )");
printf("\"");
}
@@ -125,7 +125,8 @@
static void decode_lines(void)
{
if (show_linenumbers) {
- printf("%6d: ",show_offsets ? token_streampos : linenum++);
+ printf("%6d: ",
+ show_offsets ? token_streampos : linenum++);
}
}
@@ -176,29 +177,27 @@
char *tname;
/* Run error detection only if last_defined_token was assigned */
- if ( (fcode > last_defined_token) && (last_defined_token > 0) )
- {
- char temp_buf[80];
- int buf_pos;
- u8 top_byte = fcode >> 8;
- printf ("Invalid token: [0x%03x]\n", fcode);
- sprintf(temp_buf, "Backing up over first byte, which is ");
- buf_pos = strlen(temp_buf);
- if ( top_byte < 10 )
- {
- sprintf(&temp_buf[buf_pos], " %02x", top_byte);
- }else{
- sprintf( &temp_buf[buf_pos], "0x%02x ( =dec %d)",
- top_byte, top_byte);
+ if ((fcode > last_defined_token) && (last_defined_token > 0)) {
+ char temp_buf[80];
+ int buf_pos;
+ u8 top_byte = fcode >> 8;
+ printf("Invalid token: [0x%03x]\n", fcode);
+ sprintf(temp_buf, "Backing up over first byte, which is ");
+ buf_pos = strlen(temp_buf);
+ if (top_byte < 10) {
+ sprintf(&temp_buf[buf_pos], " %02x", top_byte);
+ } else {
+ sprintf(&temp_buf[buf_pos], "0x%02x ( =dec %d)",
+ top_byte, top_byte);
+ }
+ printremark(temp_buf);
+ set_streampos(token_streampos + 1);
+ return;
}
- printremark(temp_buf);
- set_streampos(token_streampos+1);
- return;
-}
-
+
tname = lookup_token(fcode);
- printf ("%s ", tname);
+ printf("%s ", tname);
/* The fcode number is interesting
* if either
@@ -206,18 +205,16 @@
* or
* b) detok is in verbose mode.
*/
- if ( strcmp( tname, unnamed) == 0 )
- {
+ if (strcmp(tname, unnamed) == 0) {
printf("[0x%03x] ", fcode);
- } else {
- if ( verbose )
- {
- /* If the token is named,
- * show its fcode number in
- * the syntax of a FORTH Comment
- */
- printf("( 0x%03x ) ", fcode);
- }
+ } else {
+ if (verbose) {
+ /* If the token is named,
+ * show its fcode number in
+ * the syntax of a FORTH Comment
+ */
+ printf("( 0x%03x ) ", fcode);
+ }
}
}
@@ -290,13 +287,13 @@
static s16 decode_offset(void)
{
- s16 offs;
+ s16 offs;
int dest;
bool invalid_dest;
int streampos = get_streampos();
output_token();
- offs=get_offset();
+ offs = get_offset();
/* The target-destination is the source-byte offset
* at which the FCode-offset is found, plus
@@ -311,34 +308,32 @@
* theoretically possible, so we'll treat it as valid.
* An offset of zero is also, of course, invalid.
*/
- invalid_dest = BOOLVAL ( (dest <= 0)
- || (dest > stream_max)
- || (offs == 0) );
+ invalid_dest = BOOLVAL((dest <= 0)
+ || (dest > stream_max)
+ || (offs == 0));
/* Show the offset in hex and again as a signed decimal number. */
- if ( offs16 )
- {
- printf("0x%04x (", (u16)(offs & 0xffff) );
- }else{
- printf("0x%02x (", (u8)(offs & 0x00ff) );
+ if (offs16) {
+ printf("0x%04x (", (u16) (offs & 0xffff));
+ } else {
+ printf("0x%02x (", (u8) (offs & 0x00ff));
}
- if ( (offs < 0) || (offs > 9) ) printf(" =dec %d", offs);
+ if ((offs < 0) || (offs > 9))
+ printf(" =dec %d", offs);
/* If we're showing source-byte offsets, show targets of offsets */
- if ( show_offsets || invalid_dest )
- {
- printf(" dest = %d ",dest);
+ if (show_offsets || invalid_dest) {
+ printf(" dest = %d ", dest);
}
printf(")\n");
- if ( invalid_dest )
- {
- if (offs == 0)
- {
- printremark("Error: Unresolved offset.");
- }else{
- printremark("Error: Invalid offset. Ignoring...");
- set_streampos( streampos);
- }
+ if (invalid_dest) {
+ if (offs == 0) {
+ printremark("Error: Unresolved offset.");
+ } else {
+ printremark
+ ("Error: Invalid offset. Ignoring...");
+ set_streampos(streampos);
+ }
}
return offs;
}
@@ -346,7 +341,7 @@
static void decode_default(void)
{
output_token();
- printf ("\n");
+ printf("\n");
}
static void new_token(void)
@@ -354,7 +349,7 @@
u16 token;
output_token();
token = next_token();
- printf("0x%03x\n",token);
+ printf("0x%03x\n", token);
add_token(token, strdup(unnamed));
}
@@ -362,14 +357,14 @@
{
u16 token;
u8 len;
- u8* string;
+ u8 *string;
output_token();
/* get forth string ( [len] [char0] ... [charn] ) */
- string=get_name(&len);
+ string = get_name(&len);
token = next_token();
printf("%s 0x%03x\n", string, token);
- add_token(token,string);
+ add_token(token, string);
}
static void bquote(void)
@@ -385,21 +380,21 @@
u32 lit;
output_token();
- lit=get_num32();
- printf("0x%x\n",lit);
+ lit = get_num32();
+ printf("0x%x\n", lit);
}
static void offset16(void)
{
decode_default();
- offs16=TRUE;
+ offs16 = TRUE;
}
static void decode_branch(void)
{
s16 offs;
- offs=decode_offset();
- if (offs>=0)
+ offs = decode_offset();
+ if (offs >= 0)
indent++;
else
indent--;
@@ -412,7 +407,7 @@
output_token();
token = next_token();
output_token_name();
- printf ("\n");
+ printf("\n");
}
/* **************************************************************************
@@ -428,37 +423,36 @@
static void decode_start(void)
{
- u8 fcformat;
- u16 fcchecksum, checksum=0;
+ u8 fcformat;
+ u16 fcchecksum, checksum = 0;
output_token();
- printf(" ( %d-bit offsets)\n", offs16 ? 16 : 8 );
-
- token_streampos = get_streampos();
+ printf(" ( %d-bit offsets)\n", offs16 ? 16 : 8);
+
+ token_streampos = get_streampos();
decode_lines();
- fcformat=get_num8();
+ fcformat = get_num8();
printf(" format: 0x%02x\n", fcformat);
-
-
- /* Check for checksum correctness. */
-
- token_streampos = get_streampos();
+
+
+ /* Check for checksum correctness. */
+
+ token_streampos = get_streampos();
decode_lines();
- fcchecksum=get_num16(); /* Read the stored checksum */
- checksum = calc_checksum(); /* Calculate the actual checksum */
-
- if ( fcchecksum==checksum )
- {
+ fcchecksum = get_num16(); /* Read the stored checksum */
+ checksum = calc_checksum(); /* Calculate the actual checksum */
+
+ if (fcchecksum == checksum) {
printf(" checksum: 0x%04x (Ok)\n", fcchecksum);
} else {
printf(" checksum should be: 0x%04x, but is 0x%04x\n",
- checksum,fcchecksum);
+ checksum, fcchecksum);
}
- token_streampos = get_streampos();
+ token_streampos = get_streampos();
decode_lines();
- fclen=get_num32();
- printf(" len: 0x%04x ( %d bytes)\n", fclen, fclen);
+ fclen = get_num32();
+ printf(" len: 0x%04x ( %d bytes)\n", fclen, fclen);
}
@@ -476,13 +470,13 @@
static void decode_token(u16 token)
{
- bool handy_flag = TRUE;
+ bool handy_flag = TRUE;
switch (token) {
case 0x0b5:
new_token();
break;
- case 0x0b6: /* Named Token */
- case 0x0ca: /* External Token */
+ case 0x0b6: /* Named Token */
+ case 0x0ca: /* External Token */
named_token();
break;
case 0x012:
@@ -494,52 +488,52 @@
case 0x0cc:
offset16();
break;
- case 0x013: /* bbranch */
- case 0x014: /* b?branch */
+ case 0x013: /* bbranch */
+ case 0x014: /* b?branch */
decode_branch();
break;
- case 0x0b7: /* b(:) */
- case 0x0b1: /* b(<mark) */
- case 0x0c4: /* b(case) */
+ case 0x0b7: /* b(:) */
+ case 0x0b1: /* b(<mark) */
+ case 0x0c4: /* b(case) */
decode_default();
indent++;
break;
- case 0x0c2: /* b(;) */
- case 0x0b2: /* b(>resolve) */
- case 0x0c5: /* b(endcase) */
+ case 0x0c2: /* b(;) */
+ case 0x0b2: /* b(>resolve) */
+ case 0x0c5: /* b(endcase) */
indent--;
decode_default();
break;
- case 0x015: /* b(loop) */
- case 0x016: /* b(+loop) */
- case 0x0c6: /* b(endof) */
+ case 0x015: /* b(loop) */
+ case 0x016: /* b(+loop) */
+ case 0x0c6: /* b(endof) */
indent--;
decode_offset();
break;
- case 0x017: /* b(do) */
- case 0x018: /* b/?do) */
- case 0x01c: /* b(of) */
+ case 0x017: /* b(do) */
+ case 0x018: /* b/?do) */
+ case 0x01c: /* b(of) */
decode_offset();
indent++;
break;
- case 0x011: /* b(') */
- case 0x0c3: /* b(to) */
+ case 0x011: /* b(') */
+ case 0x0c3: /* b(to) */
decode_two();
break;
- case 0x0fd: /* version1 */
+ case 0x0fd: /* version1 */
handy_flag = FALSE;
- case 0x0f0: /* start0 */
- case 0x0f1: /* start1 */
- case 0x0f2: /* start2 */
- case 0x0f3: /* start4 */
+ case 0x0f0: /* start0 */
+ case 0x0f1: /* start1 */
+ case 0x0f2: /* start2 */
+ case 0x0f3: /* start4 */
offs16 = handy_flag;
printremark("Unexpected FCode-Block Starter.");
decode_start();
printremark(" Ignoring length field.");
break;
- case 0: /* end0 */
- case 0xff: /* end1 */
- end_found=TRUE;
+ case 0: /* end0 */
+ case 0xff: /* end1 */
+ end_found = TRUE;
decode_default();
break;
default:
@@ -582,39 +576,38 @@
static void decode_fcode_header(void)
{
- long err_pos;
- u16 token;
+ long err_pos;
+ u16 token;
- err_pos = get_streampos();
- indent = 0;
- token = next_token();
- offs16=TRUE;
- switch (token)
- {
- case 0x0fd: /* version1 */
- offs16=FALSE;
- case 0x0f0: /* start0 */
- case 0x0f1: /* start1 */
- case 0x0f2: /* start2 */
- case 0x0f3: /* start4 */
- decode_start();
+ err_pos = get_streampos();
+ indent = 0;
+ token = next_token();
+ offs16 = TRUE;
+ switch (token) {
+ case 0x0fd: /* version1 */
+ offs16 = FALSE;
+ case 0x0f0: /* start0 */
+ case 0x0f1: /* start1 */
+ case 0x0f2: /* start2 */
+ case 0x0f3: /* start4 */
+ decode_start();
break;
default:
- {
- char temp_bufr[128] =
- "Invalid FCode Start Byte. Ignoring FCode header." ;
- set_streampos( err_pos );
- fclen = max - pc;
- printf("\n");
- if (show_linenumbers)
{
- sprintf( &(temp_bufr[strlen(temp_bufr)]),
- " Remaining len = 0x%04x ( %d bytes)", fclen, fclen);
+ char temp_bufr[128] =
+ "Invalid FCode Start Byte. Ignoring FCode header.";
+ set_streampos(err_pos);
+ fclen = max - pc;
+ printf("\n");
+ if (show_linenumbers) {
+ sprintf(&(temp_bufr[strlen(temp_bufr)]),
+ " Remaining len = 0x%04x ( %d bytes)",
+ fclen, fclen);
+ }
+ printremark(temp_bufr);
}
- printremark( temp_bufr );
}
}
-}
/* **************************************************************************
*
@@ -654,45 +647,42 @@
static void decode_fcode_block(void)
{
u16 token;
- unsigned int fc_block_start;
- unsigned int fc_block_end;
-
- end_found = FALSE;
- fc_block_start = get_streampos();
-
- decode_fcode_header();
+ unsigned int fc_block_start;
+ unsigned int fc_block_end;
- fc_block_end = fc_block_start + fclen;
-
- while ( ( !end_found || decode_all )
- && ( get_streampos() < fc_block_end ) )
- {
- token = next_token();
+ end_found = FALSE;
+ fc_block_start = get_streampos();
+
+ decode_fcode_header();
+
+ fc_block_end = fc_block_start + fclen;
+
+ while ((!end_found || decode_all)
+ && (get_streampos() < fc_block_end)) {
+ token = next_token();
decode_token(token);
- }
- if ( !end_found )
- {
- printremark("FCode-ender not found");
- }
- {
- char temp_bufr[80];
- /* Don't use fclen here, in case it got corrupted
- * by an "Unexpected FCode-Block Starter"
- */
- if ( get_streampos() == fc_block_end )
+ }
+ if (!end_found) {
+ printremark("FCode-ender not found");
+ }
{
- sprintf( temp_bufr,
- "Detokenization finished normally after %d bytes.",
- fc_block_end - fc_block_start );
- }else{
- sprintf( temp_bufr,
- "Detokenization finished prematurely after %d of %d bytes.",
- get_streampos() - fc_block_start,
- fc_block_end - fc_block_start );
- ended_okay = FALSE;
+ char temp_bufr[80];
+ /* Don't use fclen here, in case it got corrupted
+ * by an "Unexpected FCode-Block Starter"
+ */
+ if (get_streampos() == fc_block_end) {
+ sprintf(temp_bufr,
+ "Detokenization finished normally after %d bytes.",
+ fc_block_end - fc_block_start);
+ } else {
+ sprintf(temp_bufr,
+ "Detokenization finished prematurely after %d of %d bytes.",
+ get_streampos() - fc_block_start,
+ fc_block_end - fc_block_start);
+ ended_okay = FALSE;
+ }
+ printremark(temp_bufr);
}
- printremark( temp_bufr );
- }
}
/* **************************************************************************
@@ -725,35 +715,35 @@
static bool another_fcode_block(void)
{
- bool retval = FALSE;
- u16 token;
+ bool retval = FALSE;
+ u16 token;
- token = next_token();
- set_streampos( token_streampos );
+ token = next_token();
+ set_streampos(token_streampos);
- switch (token)
- {
- case 0x0fd: /* version1 */
- case 0x0f0: /* start0 */
- case 0x0f1: /* start1 */
- case 0x0f2: /* start2 */
- case 0x0f3: /* start4 */
- retval = TRUE;
- printremark("Subsequent FCode Block detected. Detokenizing.");
- break;
- case 0: /* Start of a zero-fill field */
- /* retval already = FALSE . Nothing else to be done. */
- break;
+ switch (token) {
+ case 0x0fd: /* version1 */
+ case 0x0f0: /* start0 */
+ case 0x0f1: /* start1 */
+ case 0x0f2: /* start2 */
+ case 0x0f3: /* start4 */
+ retval = TRUE;
+ printremark
+ ("Subsequent FCode Block detected. Detokenizing.");
+ break;
+ case 0: /* Start of a zero-fill field */
+ /* retval already = FALSE . Nothing else to be done. */
+ break;
default:
- {
- char temp_bufr[80];
- sprintf( temp_bufr,
- "Unexpected token, 0x%02x, after end of FCode block.",
- token);
- printremark( temp_bufr);
- }
- }
- return ( retval );
+ {
+ char temp_bufr[80];
+ sprintf(temp_bufr,
+ "Unexpected token, 0x%02x, after end of FCode block.",
+ token);
+ printremark(temp_bufr);
+ }
+ }
+ return (retval);
}
/* **************************************************************************
@@ -767,33 +757,29 @@
void detokenize(void)
{
- fclen = stream_max;
+ fclen = stream_max;
- if ( setjmp(eof_exception) == 0 )
- {
- while ( more_to_go() )
- {
- if ( ended_okay )
- {
- init_fcode_block();
- }
- ended_okay = TRUE;
+ if (setjmp(eof_exception) == 0) {
+ while (more_to_go()) {
+ if (ended_okay) {
+ init_fcode_block();
+ }
+ ended_okay = TRUE;
- adjust_for_pci_header();
+ adjust_for_pci_header();
- /* Allow for multiple FCode Blocks within the PCI image.
- * The first one had better be a valid block, but the
- * next may or may not be...
- */
- do
- {
- decode_fcode_block();
- } while ( another_fcode_block() );
+ /* Allow for multiple FCode Blocks within the PCI image.
+ * The first one had better be a valid block, but the
+ * next may or may not be...
+ */
+ do {
+ decode_fcode_block();
+ } while (another_fcode_block());
- adjust_for_pci_filler();
+ adjust_for_pci_filler();
+ }
}
- }
}
Modified: fcode-utils/detok/detok.c
===================================================================
--- fcode-utils/detok/detok.c 2006-10-14 21:07:27 UTC (rev 95)
+++ fcode-utils/detok/detok.c 2006-10-14 21:32:13 UTC (rev 96)
@@ -51,47 +51,47 @@
"(C) Copyright 2006 coresystems GmbH <info at coresystems.de>"
#define IBM_COPYR "(C) Copyright 2005 IBM Corporation. All Rights Reserved."
-bool verbose = FALSE ;
-bool decode_all = FALSE ;
-bool show_linenumbers = FALSE ;
-bool show_offsets = FALSE ;
+bool verbose = FALSE;
+bool decode_all = FALSE;
+bool show_linenumbers = FALSE;
+bool show_offsets = FALSE;
/* Param is FALSE when beginning to detokenize,
* TRUE preceding error-exit */
static void print_copyright(bool is_error)
{
- typedef void (*vfunct)(); /* Pointer to function returning void */
- vfunct pfunct ;
+ typedef void (*vfunct) (); /* Pointer to function returning void */
+ vfunct pfunct;
char buffr[512];
- sprintf( buffr,
- "Welcome to detok - OpenBIOS detokenizer v" DETOK_VERSION "\n"
- CORE_COPYR "\n" IBM_COPYR "\n"
- "Written by Stefan Reinauer, <stepan at openbios.org>\n"
+ sprintf(buffr,
+ "Welcome to detok - OpenBIOS detokenizer v" DETOK_VERSION "\n"
+ CORE_COPYR "\n" IBM_COPYR "\n"
+ "Written by Stefan Reinauer, <stepan at openbios.org>\n"
"This program is free software; you may redistribute it "
"under the terms of\nthe GNU General Public License v2. This "
- "program has absolutely no warranty.\n\n" );
+ "program has absolutely no warranty.\n\n");
- pfunct = ( is_error ? (vfunct)printf : printremark );
+ pfunct = (is_error ? (vfunct) printf : printremark);
- (*pfunct) ( buffr );
+ (*pfunct) (buffr);
}
static void usage(char *name)
{
- printf( "usage: %s [OPTION]... [FCODE-FILE]...\n\n"
- " -v, --verbose print fcode numbers\n"
- " -a, --all don't stop at end0\n"
- " -n, --linenumbers print line numbers\n"
- " -o, --offsets print byte offsets\n"
- " -f, --fcodes add FCodes from list-file\n"
- " -h, --help print this help text\n\n", name);
+ printf("usage: %s [OPTION]... [FCODE-FILE]...\n\n"
+ " -v, --verbose print fcode numbers\n"
+ " -a, --all don't stop at end0\n"
+ " -n, --linenumbers print line numbers\n"
+ " -o, --offsets print byte offsets\n"
+ " -f, --fcodes add FCodes from list-file\n"
+ " -h, --help print this help text\n\n", name);
}
int main(int argc, char **argv)
{
int c;
- const char *optstring="vhanof:?";
+ const char *optstring = "vhanof:?";
int linenumbers = 0;
bool add_vfcodes = FALSE;
char *vfc_filnam = NULL;
@@ -100,36 +100,36 @@
#ifdef __GLIBC__
int option_index = 0;
static struct option long_options[] = {
- { "verbose", 0, 0, 'v' },
- { "help", 0, 0, 'h' },
- { "all", 0, 0, 'a' },
- { "linenumbers", 0, 0, 'n' },
- { "offsets", 0, 0, 'o' },
- { "fcodes", 1, 0, 'f' },
- { 0, 0, 0, 0 }
+ {"verbose", 0, 0, 'v'},
+ {"help", 0, 0, 'h'},
+ {"all", 0, 0, 'a'},
+ {"linenumbers", 0, 0, 'n'},
+ {"offsets", 0, 0, 'o'},
+ {"fcodes", 1, 0, 'f'},
+ {0, 0, 0, 0}
};
- c = getopt_long (argc, argv, optstring,
- long_options, &option_index);
+ c = getopt_long(argc, argv, optstring,
+ long_options, &option_index);
#else
- c = getopt (argc, argv, optstring);
+ c = getopt(argc, argv, optstring);
#endif
if (c == -1)
break;
switch (c) {
case 'v':
- verbose=TRUE;
+ verbose = TRUE;
break;
case 'a':
- decode_all=TRUE;
+ decode_all = TRUE;
break;
case 'n':
- linenumbers|=1;
+ linenumbers |= 1;
show_linenumbers = TRUE;
break;
case 'o':
- linenumbers|=2;
+ linenumbers |= 2;
show_linenumbers = TRUE;
show_offsets = TRUE;
break;
@@ -141,10 +141,10 @@
case '?':
print_copyright(TRUE);
usage(argv[0]);
- return 0;
+ return 0;
default:
print_copyright(TRUE);
- printf ("%s: unknown option.\n",argv[0]);
+ printf("%s: unknown option.\n", argv[0]);
usage(argv[0]);
return 1;
}
@@ -152,44 +152,41 @@
if (verbose)
print_copyright(FALSE);
-
- if (linenumbers>2)
- printremark(
- "Line numbers will be disabled in favour of offsets.\n");
-
+
+ if (linenumbers > 2)
+ printremark
+ ("Line numbers will be disabled in favour of offsets.\n");
+
if (optind >= argc) {
print_copyright(TRUE);
- printf ("%s: filename missing.\n",argv[0]);
+ printf("%s: filename missing.\n", argv[0]);
usage(argv[0]);
return 1;
}
-
+
init_dictionary();
-
- if ( add_vfcodes )
- {
- if ( add_fcodes_from_list( vfc_filnam) )
- {
- freeze_dictionary();
- }
+
+ if (add_vfcodes) {
+ if (add_fcodes_from_list(vfc_filnam)) {
+ freeze_dictionary();
+ }
}
while (optind < argc) {
-
+
if (init_stream(argv[optind])) {
- printf ("Could not open file \"%s\".\n",argv[optind]);
+ printf("Could not open file \"%s\".\n", argv[optind]);
optind++;
continue;
}
detokenize();
close_stream();
-
+
optind++;
reset_dictionary();
}
-
+
printf("\n");
-
+
return 0;
}
-
Modified: fcode-utils/detok/detok.h
===================================================================
--- fcode-utils/detok/detok.h 2006-10-14 21:07:27 UTC (rev 95)
+++ fcode-utils/detok/detok.h 2006-10-14 21:32:13 UTC (rev 96)
@@ -49,8 +49,8 @@
void printremark(char *str);
-int handle_pci_header ( u8 *data_ptr );
-void handle_pci_filler(u8 *filler_ptr);
+int handle_pci_header(u8 * data_ptr);
+void handle_pci_filler(u8 * filler_ptr);
/* External declarations for variables defined in or used by
@@ -72,4 +72,4 @@
extern unsigned int token_streampos;
extern u16 last_defined_token;
-#endif /* _UTILS_DETOK_DETOK_H */
+#endif /* _UTILS_DETOK_DETOK_H */
Modified: fcode-utils/detok/dictionary.c
===================================================================
--- fcode-utils/detok/dictionary.c 2006-10-14 21:07:27 UTC (rev 95)
+++ fcode-utils/detok/dictionary.c 2006-10-14 21:32:13 UTC (rev 96)
@@ -44,16 +44,16 @@
struct token *next;
} token_t;
#define TOKEN_ENTRY(num, name) { name, (u16)num, (token_t *)NULL }
-static token_t *dictionary; /* Initialize dynamically to accommodate AIX */
+static token_t *dictionary; /* Initialize dynamically to accommodate AIX */
-static char *fcerror="ferror";
+static char *fcerror = "ferror";
char *lookup_token(u16 number)
{
token_t *curr;
-
- for (curr=dictionary; curr!=NULL; curr=curr->next)
- if (curr->fcode==number)
+
+ for (curr = dictionary; curr != NULL; curr = curr->next)
+ if (curr->fcode == number)
break;
if (curr)
@@ -110,462 +110,458 @@
{
token_t *curr;
- curr=malloc(sizeof(token_t));
- if(!curr) {
+ curr = malloc(sizeof(token_t));
+ if (!curr) {
printf("Out of memory while adding token.\n");
exit(-ENOMEM);
}
- curr->next=dictionary;
- curr->fcode=number;
- curr->name=name;
+ curr->next = dictionary;
+ curr->fcode = number;
+ curr->name = name;
- dictionary=curr;
+ dictionary = curr;
- if ( check_tok_seq )
- {
- /* Error-check, but not for first time. */
- if ( (number == last_defined_token + 1)
- || (last_defined_token == 0) )
- {
- last_defined_token = number;
- }else{
- if ( number <= last_defined_token )
- {
- printremark("Warning: New token # might overlap "
- "previously assigned token #(s).");
- }else{
- printremark("Warning: New token # out of sequence with "
- "previously assigned token #(s).");
- /* It's increasing; update it. */
- last_defined_token = number;
+ if (check_tok_seq) {
+ /* Error-check, but not for first time. */
+ if ((number == last_defined_token + 1)
+ || (last_defined_token == 0)) {
+ last_defined_token = number;
+ } else {
+ if (number <= last_defined_token) {
+ printremark("Warning: New token # might overlap "
+ "previously assigned token #(s).");
+ } else {
+ printremark("Warning: New token # out of sequence with "
+ "previously assigned token #(s).");
+ /* It's increasing; update it. */
+ last_defined_token = number;
+ }
}
-}
}
}
-token_t detok_table[] = {
+token_t detok_table[] = {
- TOKEN_ENTRY( 0x000, "end0" ),
- TOKEN_ENTRY( 0x010, "b(lit)" ),
- TOKEN_ENTRY( 0x011, "b(')" ),
- TOKEN_ENTRY( 0x012, "b(\")" ),
- TOKEN_ENTRY( 0x013, "bbranch" ),
- TOKEN_ENTRY( 0x014, "b?branch" ),
- TOKEN_ENTRY( 0x015, "b(loop)" ),
- TOKEN_ENTRY( 0x016, "b(+loop)" ),
- TOKEN_ENTRY( 0x017, "b(do)" ),
- TOKEN_ENTRY( 0x018, "b(?do)" ),
- TOKEN_ENTRY( 0x019, "i" ),
- TOKEN_ENTRY( 0x01a, "j" ),
- TOKEN_ENTRY( 0x01b, "b(leave)" ),
- TOKEN_ENTRY( 0x01c, "b(of)" ),
- TOKEN_ENTRY( 0x01d, "execute" ),
- TOKEN_ENTRY( 0x01e, "+" ),
- TOKEN_ENTRY( 0x01f, "-" ),
- TOKEN_ENTRY( 0x020, "*" ),
- TOKEN_ENTRY( 0x021, "/" ),
- TOKEN_ENTRY( 0x022, "mod" ),
- TOKEN_ENTRY( 0x023, "and" ),
- TOKEN_ENTRY( 0x024, "or" ),
- TOKEN_ENTRY( 0x025, "xor" ),
- TOKEN_ENTRY( 0x026, "invert" ),
- TOKEN_ENTRY( 0x027, "lshift" ),
- TOKEN_ENTRY( 0x028, "rshift" ),
- TOKEN_ENTRY( 0x029, ">>a" ),
- TOKEN_ENTRY( 0x02a, "/mod" ),
- TOKEN_ENTRY( 0x02b, "u/mod" ),
- TOKEN_ENTRY( 0x02c, "negate" ),
- TOKEN_ENTRY( 0x02d, "abs" ),
- TOKEN_ENTRY( 0x02e, "min" ),
- TOKEN_ENTRY( 0x02f, "max" ),
- TOKEN_ENTRY( 0x030, ">r" ),
- TOKEN_ENTRY( 0x031, "r>" ),
- TOKEN_ENTRY( 0x032, "r@" ),
- TOKEN_ENTRY( 0x033, "exit" ),
- TOKEN_ENTRY( 0x034, "0=" ),
- TOKEN_ENTRY( 0x035, "0<>" ),
- TOKEN_ENTRY( 0x036, "0<" ),
- TOKEN_ENTRY( 0x037, "0<=" ),
- TOKEN_ENTRY( 0x038, "0>" ),
- TOKEN_ENTRY( 0x039, "0>=" ),
- TOKEN_ENTRY( 0x03a, "<" ),
- TOKEN_ENTRY( 0x03b, ">" ),
- TOKEN_ENTRY( 0x03c, "=" ),
- TOKEN_ENTRY( 0x03d, "<>" ),
- TOKEN_ENTRY( 0x03e, "u>" ),
- TOKEN_ENTRY( 0x03f, "u<=" ),
- TOKEN_ENTRY( 0x040, "u<" ),
- TOKEN_ENTRY( 0x041, "u>=" ),
- TOKEN_ENTRY( 0x042, ">=" ),
- TOKEN_ENTRY( 0x043, "<=" ),
- TOKEN_ENTRY( 0x044, "between" ),
- TOKEN_ENTRY( 0x045, "within" ),
- TOKEN_ENTRY( 0x046, "drop" ),
- TOKEN_ENTRY( 0x047, "dup" ),
- TOKEN_ENTRY( 0x048, "over" ),
- TOKEN_ENTRY( 0x049, "swap" ),
- TOKEN_ENTRY( 0x04A, "rot" ),
- TOKEN_ENTRY( 0x04b, "-rot" ),
- TOKEN_ENTRY( 0x04c, "tuck" ),
- TOKEN_ENTRY( 0x04d, "nip" ),
- TOKEN_ENTRY( 0x04e, "pick" ),
- TOKEN_ENTRY( 0x04f, "roll" ),
- TOKEN_ENTRY( 0x050, "?dup" ),
- TOKEN_ENTRY( 0x051, "depth" ),
- TOKEN_ENTRY( 0x052, "2drop" ),
- TOKEN_ENTRY( 0x053, "2dup" ),
- TOKEN_ENTRY( 0x054, "2over" ),
- TOKEN_ENTRY( 0x055, "2swap" ),
- TOKEN_ENTRY( 0x056, "2rot" ),
- TOKEN_ENTRY( 0x057, "2/" ),
- TOKEN_ENTRY( 0x058, "u2/" ),
- TOKEN_ENTRY( 0x059, "2*" ),
- TOKEN_ENTRY( 0x05a, "/c" ),
- TOKEN_ENTRY( 0x05b, "/w" ),
- TOKEN_ENTRY( 0x05c, "/l" ),
- TOKEN_ENTRY( 0x05d, "/n" ),
- TOKEN_ENTRY( 0x05e, "ca+" ),
- TOKEN_ENTRY( 0x05f, "wa+" ),
- TOKEN_ENTRY( 0x060, "la+" ),
- TOKEN_ENTRY( 0x061, "na+" ),
- TOKEN_ENTRY( 0x062, "char+" ),
- TOKEN_ENTRY( 0x063, "wa1+" ),
- TOKEN_ENTRY( 0x064, "la1+" ),
- TOKEN_ENTRY( 0x065, "cell+" ),
- TOKEN_ENTRY( 0x066, "chars" ),
- TOKEN_ENTRY( 0x067, "/w*" ),
- TOKEN_ENTRY( 0x068, "/l*" ),
- TOKEN_ENTRY( 0x069, "cells" ),
- TOKEN_ENTRY( 0x06a, "on" ),
- TOKEN_ENTRY( 0x06b, "off" ),
- TOKEN_ENTRY( 0x06c, "+!" ),
- TOKEN_ENTRY( 0x06d, "@" ),
- TOKEN_ENTRY( 0x06e, "l@" ),
- TOKEN_ENTRY( 0x06f, "w@" ),
- TOKEN_ENTRY( 0x070, "<w@" ),
- TOKEN_ENTRY( 0x071, "c@" ),
- TOKEN_ENTRY( 0x072, "!" ),
- TOKEN_ENTRY( 0x073, "l!" ),
- TOKEN_ENTRY( 0x074, "w!" ),
- TOKEN_ENTRY( 0x075, "c!" ),
- TOKEN_ENTRY( 0x076, "2@" ),
- TOKEN_ENTRY( 0x077, "2!" ),
- TOKEN_ENTRY( 0x078, "move" ),
- TOKEN_ENTRY( 0x079, "fill" ),
- TOKEN_ENTRY( 0x07a, "comp" ),
- TOKEN_ENTRY( 0x07b, "noop" ),
- TOKEN_ENTRY( 0x07c, "lwsplit" ),
- TOKEN_ENTRY( 0x07d, "wljoin" ),
- TOKEN_ENTRY( 0x07e, "lbsplit" ),
- TOKEN_ENTRY( 0x07f, "bljoin" ),
- TOKEN_ENTRY( 0x080, "wbflip" ),
- TOKEN_ENTRY( 0x081, "upc" ),
- TOKEN_ENTRY( 0x082, "lcc" ),
- TOKEN_ENTRY( 0x083, "pack" ),
- TOKEN_ENTRY( 0x084, "count" ),
- TOKEN_ENTRY( 0x085, "body>" ),
- TOKEN_ENTRY( 0x086, ">body" ),
- TOKEN_ENTRY( 0x087, "fcode-revision" ),
- TOKEN_ENTRY( 0x088, "span" ),
- TOKEN_ENTRY( 0x089, "unloop" ),
- TOKEN_ENTRY( 0x08a, "expect" ),
- TOKEN_ENTRY( 0x08b, "alloc-mem" ),
- TOKEN_ENTRY( 0x08c, "free-mem" ),
- TOKEN_ENTRY( 0x08d, "key?" ),
- TOKEN_ENTRY( 0x08e, "key" ),
- TOKEN_ENTRY( 0x08f, "emit" ),
- TOKEN_ENTRY( 0x090, "type" ),
- TOKEN_ENTRY( 0x091, "(cr" ),
- TOKEN_ENTRY( 0x092, "cr" ),
- TOKEN_ENTRY( 0x093, "#out" ),
- TOKEN_ENTRY( 0x094, "#line" ),
- TOKEN_ENTRY( 0x095, "hold" ),
- TOKEN_ENTRY( 0x096, "<#" ),
- TOKEN_ENTRY( 0x097, "u#>" ),
- TOKEN_ENTRY( 0x098, "sign" ),
- TOKEN_ENTRY( 0x099, "u#" ),
- TOKEN_ENTRY( 0x09a, "u#s" ),
- TOKEN_ENTRY( 0x09b, "u." ),
- TOKEN_ENTRY( 0x09c, "u.r" ),
- TOKEN_ENTRY( 0x09d, "." ),
- TOKEN_ENTRY( 0x09e, ".r" ),
- TOKEN_ENTRY( 0x09f, ".s" ),
- TOKEN_ENTRY( 0x0a0, "base" ),
- TOKEN_ENTRY( 0x0a1, "convert" ),
- TOKEN_ENTRY( 0x0a2, "$number" ),
- TOKEN_ENTRY( 0x0a3, "digit" ),
- TOKEN_ENTRY( 0x0a4, "-1" ),
- TOKEN_ENTRY( 0x0a5, "0" ),
- TOKEN_ENTRY( 0x0a6, "1" ),
- TOKEN_ENTRY( 0x0a7, "2" ),
- TOKEN_ENTRY( 0x0a8, "3" ),
- TOKEN_ENTRY( 0x0a9, "bl" ),
- TOKEN_ENTRY( 0x0aa, "bs" ),
- TOKEN_ENTRY( 0x0ab, "bell" ),
- TOKEN_ENTRY( 0x0ac, "bounds" ),
- TOKEN_ENTRY( 0x0ad, "here" ),
- TOKEN_ENTRY( 0x0ae, "aligned" ),
- TOKEN_ENTRY( 0x0af, "wbsplit" ),
- TOKEN_ENTRY( 0x0b0, "bwjoin" ),
- TOKEN_ENTRY( 0x0b1, "b(<mark)" ),
- TOKEN_ENTRY( 0x0b2, "b(>resolve)" ),
- TOKEN_ENTRY( 0x0b3, "set-token-table" ),
- TOKEN_ENTRY( 0x0b4, "set-table" ),
- TOKEN_ENTRY( 0x0b5, "new-token" ),
- TOKEN_ENTRY( 0x0b6, "named-token" ),
- TOKEN_ENTRY( 0x0b7, "b(:)" ),
- TOKEN_ENTRY( 0x0b8, "b(value)" ),
- TOKEN_ENTRY( 0x0b9, "b(variable)" ),
- TOKEN_ENTRY( 0x0ba, "b(constant)" ),
- TOKEN_ENTRY( 0x0bb, "b(create)" ),
- TOKEN_ENTRY( 0x0bc, "b(defer)" ),
- TOKEN_ENTRY( 0x0bd, "b(buffer:)" ),
- TOKEN_ENTRY( 0x0be, "b(field)" ),
- TOKEN_ENTRY( 0x0bf, "b(code)" ),
- TOKEN_ENTRY( 0x0c0, "instance" ),
- TOKEN_ENTRY( 0x0c2, "b(;)" ),
- TOKEN_ENTRY( 0x0c3, "b(to)" ),
- TOKEN_ENTRY( 0x0c4, "b(case)" ),
- TOKEN_ENTRY( 0x0c5, "b(endcase)" ),
- TOKEN_ENTRY( 0x0c6, "b(endof)" ),
- TOKEN_ENTRY( 0x0c7, "#" ),
- TOKEN_ENTRY( 0x0c8, "#s" ),
- TOKEN_ENTRY( 0x0c9, "#>" ),
- TOKEN_ENTRY( 0x0ca, "external-token" ),
- TOKEN_ENTRY( 0x0cb, "$find" ),
- TOKEN_ENTRY( 0x0cc, "offset16" ),
- TOKEN_ENTRY( 0x0cd, "evaluate" ),
- TOKEN_ENTRY( 0x0d0, "c," ),
- TOKEN_ENTRY( 0x0d1, "w," ),
- TOKEN_ENTRY( 0x0d2, "l," ),
- TOKEN_ENTRY( 0x0d3, "," ),
- TOKEN_ENTRY( 0x0d4, "um*" ),
- TOKEN_ENTRY( 0x0d5, "um/mod" ),
- TOKEN_ENTRY( 0x0d8, "d+" ),
- TOKEN_ENTRY( 0x0d9, "d-" ),
- TOKEN_ENTRY( 0x0da, "get-token" ),
- TOKEN_ENTRY( 0x0db, "set-token" ),
- TOKEN_ENTRY( 0x0dc, "state" ),
- TOKEN_ENTRY( 0x0dd, "compile" ),
- TOKEN_ENTRY( 0x0de, "behavior" ),
- TOKEN_ENTRY( 0x0f0, "start0" ),
- TOKEN_ENTRY( 0x0f1, "start1" ),
- TOKEN_ENTRY( 0x0f2, "start2" ),
- TOKEN_ENTRY( 0x0f3, "start4" ),
- TOKEN_ENTRY( 0x0fc, "ferror" ),
- TOKEN_ENTRY( 0x0fd, "version1" ),
- TOKEN_ENTRY( 0x0fe, "4-byte-id" ),
- TOKEN_ENTRY( 0x0ff, "end1" ),
- TOKEN_ENTRY( 0x101, "dma-alloc" ),
- TOKEN_ENTRY( 0x102, "my-address" ),
- TOKEN_ENTRY( 0x103, "my-space" ),
- TOKEN_ENTRY( 0x104, "memmap" ),
- TOKEN_ENTRY( 0x105, "free-virtual" ),
- TOKEN_ENTRY( 0x106, ">physical" ),
- TOKEN_ENTRY( 0x10f, "my-params" ),
- TOKEN_ENTRY( 0x110, "property" ),
- TOKEN_ENTRY( 0x111, "encode-int" ),
- TOKEN_ENTRY( 0x112, "encode+" ),
- TOKEN_ENTRY( 0x113, "encode-phys" ),
- TOKEN_ENTRY( 0x114, "encode-string" ),
- TOKEN_ENTRY( 0x115, "encode-bytes" ),
- TOKEN_ENTRY( 0x116, "reg" ),
- TOKEN_ENTRY( 0x117, "intr" ),
- TOKEN_ENTRY( 0x118, "driver" ),
- TOKEN_ENTRY( 0x119, "model" ),
- TOKEN_ENTRY( 0x11a, "device-type" ),
- TOKEN_ENTRY( 0x11b, "parse-2int" ),
- TOKEN_ENTRY( 0x11c, "is-install" ),
- TOKEN_ENTRY( 0x11d, "is-remove" ),
- TOKEN_ENTRY( 0x11e, "is-selftest" ),
- TOKEN_ENTRY( 0x11f, "new-device" ),
- TOKEN_ENTRY( 0x120, "diagnostic-mode?" ),
- TOKEN_ENTRY( 0x121, "display-status" ),
- TOKEN_ENTRY( 0x122, "memory-test-issue" ),
- TOKEN_ENTRY( 0x123, "group-code" ),
- TOKEN_ENTRY( 0x124, "mask" ),
- TOKEN_ENTRY( 0x125, "get-msecs" ),
- TOKEN_ENTRY( 0x126, "ms" ),
- TOKEN_ENTRY( 0x127, "finish-device" ),
- TOKEN_ENTRY( 0x128, "decode-phys" ),
- TOKEN_ENTRY( 0x12b, "interpose" ),
- TOKEN_ENTRY( 0x130, "map-low" ),
- TOKEN_ENTRY( 0x131, "sbus-intr>cpu" ),
- TOKEN_ENTRY( 0x150, "#lines" ),
- TOKEN_ENTRY( 0x151, "#columns" ),
- TOKEN_ENTRY( 0x152, "line#" ),
- TOKEN_ENTRY( 0x153, "column#" ),
- TOKEN_ENTRY( 0x154, "inverse?" ),
- TOKEN_ENTRY( 0x155, "inverse-screen?" ),
- TOKEN_ENTRY( 0x156, "frame-buffer-busy?" ),
- TOKEN_ENTRY( 0x157, "draw-character" ),
- TOKEN_ENTRY( 0x158, "reset-screen" ),
- TOKEN_ENTRY( 0x159, "toggle-cursor" ),
- TOKEN_ENTRY( 0x15a, "erase-screen" ),
- TOKEN_ENTRY( 0x15b, "blink-screen" ),
- TOKEN_ENTRY( 0x15c, "invert-screen" ),
- TOKEN_ENTRY( 0x15d, "insert-characters" ),
- TOKEN_ENTRY( 0x15e, "delete-characters" ),
- TOKEN_ENTRY( 0x15f, "insert-lines" ),
- TOKEN_ENTRY( 0x160, "delete-lines" ),
- TOKEN_ENTRY( 0x161, "draw-logo" ),
- TOKEN_ENTRY( 0x162, "frame-buffer-adr" ),
- TOKEN_ENTRY( 0x163, "screen-height" ),
- TOKEN_ENTRY( 0x164, "screen-width" ),
- TOKEN_ENTRY( 0x165, "window-top" ),
- TOKEN_ENTRY( 0x166, "window-left" ),
- TOKEN_ENTRY( 0x16a, "default-font" ),
- TOKEN_ENTRY( 0x16b, "set-font" ),
- TOKEN_ENTRY( 0x16c, "char-height" ),
- TOKEN_ENTRY( 0x16d, "char-width" ),
- TOKEN_ENTRY( 0x16e, ">font" ),
- TOKEN_ENTRY( 0x16f, "fontbytes" ),
- TOKEN_ENTRY( 0x170, "fb1-draw-character" ),
- TOKEN_ENTRY( 0x171, "fb1-reset-screen" ),
- TOKEN_ENTRY( 0x172, "fb1-toggle-cursor" ),
- TOKEN_ENTRY( 0x173, "fb1-erase-screen" ),
- TOKEN_ENTRY( 0x174, "fb1-blink-screen" ),
- TOKEN_ENTRY( 0x175, "fb1-invert-screen" ),
- TOKEN_ENTRY( 0x176, "fb1-insert-characters" ),
- TOKEN_ENTRY( 0x177, "fb1-delete-characters" ),
- TOKEN_ENTRY( 0x178, "fb1-insert-lines" ),
- TOKEN_ENTRY( 0x179, "fb1-delete-lines" ),
- TOKEN_ENTRY( 0x17a, "fb1-draw-logo" ),
- TOKEN_ENTRY( 0x17b, "fb1-install" ),
- TOKEN_ENTRY( 0x17c, "fb1-slide-up" ),
- TOKEN_ENTRY( 0x180, "fb8-draw-character" ),
- TOKEN_ENTRY( 0x181, "fb8-reset-screen" ),
- TOKEN_ENTRY( 0x182, "fb8-toggle-cursor" ),
- TOKEN_ENTRY( 0x183, "fb8-erase-screen" ),
- TOKEN_ENTRY( 0x184, "fb8-blink-screen" ),
- TOKEN_ENTRY( 0x185, "fb8-invert-screen" ),
- TOKEN_ENTRY( 0x186, "fb8-insert-characters" ),
- TOKEN_ENTRY( 0x187, "fb8-delete-characters" ),
- TOKEN_ENTRY( 0x188, "fb8-insert-lines" ),
- TOKEN_ENTRY( 0x189, "fb8-delete-lines" ),
- TOKEN_ENTRY( 0x18a, "fb8-draw-logo" ),
- TOKEN_ENTRY( 0x18b, "fb8-install" ),
- TOKEN_ENTRY( 0x1a0, "return-buffer" ),
- TOKEN_ENTRY( 0x1a1, "xmit-packet" ),
- TOKEN_ENTRY( 0x1a2, "poll-packet" ),
- TOKEN_ENTRY( 0x1a4, "mac-address" ),
- TOKEN_ENTRY( 0x201, "device-name" ),
- TOKEN_ENTRY( 0x202, "my-args" ),
- TOKEN_ENTRY( 0x203, "my-self" ),
- TOKEN_ENTRY( 0x204, "find-package" ),
- TOKEN_ENTRY( 0x205, "open-package" ),
- TOKEN_ENTRY( 0x206, "close-package" ),
- TOKEN_ENTRY( 0x207, "find-method" ),
- TOKEN_ENTRY( 0x208, "call-package" ),
- TOKEN_ENTRY( 0x209, "$call-parent" ),
- TOKEN_ENTRY( 0x20a, "my-parent" ),
- TOKEN_ENTRY( 0x20b, "ihandle>phandle" ),
- TOKEN_ENTRY( 0x20d, "my-unit" ),
- TOKEN_ENTRY( 0x20e, "$call-method" ),
- TOKEN_ENTRY( 0x20f, "$open-package" ),
- TOKEN_ENTRY( 0x210, "processor-type" ),
- TOKEN_ENTRY( 0x211, "firmware-version" ),
- TOKEN_ENTRY( 0x212, "fcode-version" ),
- TOKEN_ENTRY( 0x213, "alarm" ),
- TOKEN_ENTRY( 0x214, "(is-user-word)" ),
- TOKEN_ENTRY( 0x215, "suspend-fcode" ),
- TOKEN_ENTRY( 0x216, "abort" ),
- TOKEN_ENTRY( 0x217, "catch" ),
- TOKEN_ENTRY( 0x218, "throw" ),
- TOKEN_ENTRY( 0x219, "user-abort" ),
- TOKEN_ENTRY( 0x21a, "get-my-property" ),
- TOKEN_ENTRY( 0x21b, "decode-int" ),
- TOKEN_ENTRY( 0x21c, "decode-string" ),
- TOKEN_ENTRY( 0x21d, "get-inherited-property" ),
- TOKEN_ENTRY( 0x21e, "delete-property" ),
- TOKEN_ENTRY( 0x21f, "get-package-property" ),
- TOKEN_ENTRY( 0x220, "cpeek" ),
- TOKEN_ENTRY( 0x221, "wpeek" ),
- TOKEN_ENTRY( 0x222, "lpeek" ),
- TOKEN_ENTRY( 0x223, "cpoke" ),
- TOKEN_ENTRY( 0x224, "wpoke" ),
- TOKEN_ENTRY( 0x225, "lpoke" ),
- TOKEN_ENTRY( 0x226, "lwflip" ),
- TOKEN_ENTRY( 0x227, "lbflip" ),
- TOKEN_ENTRY( 0x228, "lbflips" ),
- TOKEN_ENTRY( 0x229, "adr-mask" ),
- TOKEN_ENTRY( 0x230, "rb@" ),
- TOKEN_ENTRY( 0x231, "rb!" ),
- TOKEN_ENTRY( 0x232, "rw@" ),
- TOKEN_ENTRY( 0x233, "rw!" ),
- TOKEN_ENTRY( 0x234, "rl@" ),
- TOKEN_ENTRY( 0x235, "rl!" ),
- TOKEN_ENTRY( 0x236, "wbflips" ),
- TOKEN_ENTRY( 0x237, "lwflips" ),
- TOKEN_ENTRY( 0x238, "probe" ),
- TOKEN_ENTRY( 0x239, "probe-virtual" ),
- TOKEN_ENTRY( 0x23b, "child" ),
- TOKEN_ENTRY( 0x23c, "peer" ),
- TOKEN_ENTRY( 0x23d, "next-property" ),
- TOKEN_ENTRY( 0x23e, "byte-load" ),
- TOKEN_ENTRY( 0x23f, "set-args" ),
- TOKEN_ENTRY( 0x240, "left-parse-string" ),
+ TOKEN_ENTRY(0x000, "end0"),
+ TOKEN_ENTRY(0x010, "b(lit)"),
+ TOKEN_ENTRY(0x011, "b(')"),
+ TOKEN_ENTRY(0x012, "b(\")"),
+ TOKEN_ENTRY(0x013, "bbranch"),
+ TOKEN_ENTRY(0x014, "b?branch"),
+ TOKEN_ENTRY(0x015, "b(loop)"),
+ TOKEN_ENTRY(0x016, "b(+loop)"),
+ TOKEN_ENTRY(0x017, "b(do)"),
+ TOKEN_ENTRY(0x018, "b(?do)"),
+ TOKEN_ENTRY(0x019, "i"),
+ TOKEN_ENTRY(0x01a, "j"),
+ TOKEN_ENTRY(0x01b, "b(leave)"),
+ TOKEN_ENTRY(0x01c, "b(of)"),
+ TOKEN_ENTRY(0x01d, "execute"),
+ TOKEN_ENTRY(0x01e, "+"),
+ TOKEN_ENTRY(0x01f, "-"),
+ TOKEN_ENTRY(0x020, "*"),
+ TOKEN_ENTRY(0x021, "/"),
+ TOKEN_ENTRY(0x022, "mod"),
+ TOKEN_ENTRY(0x023, "and"),
+ TOKEN_ENTRY(0x024, "or"),
+ TOKEN_ENTRY(0x025, "xor"),
+ TOKEN_ENTRY(0x026, "invert"),
+ TOKEN_ENTRY(0x027, "lshift"),
+ TOKEN_ENTRY(0x028, "rshift"),
+ TOKEN_ENTRY(0x029, ">>a"),
+ TOKEN_ENTRY(0x02a, "/mod"),
+ TOKEN_ENTRY(0x02b, "u/mod"),
+ TOKEN_ENTRY(0x02c, "negate"),
+ TOKEN_ENTRY(0x02d, "abs"),
+ TOKEN_ENTRY(0x02e, "min"),
+ TOKEN_ENTRY(0x02f, "max"),
+ TOKEN_ENTRY(0x030, ">r"),
+ TOKEN_ENTRY(0x031, "r>"),
+ TOKEN_ENTRY(0x032, "r@"),
+ TOKEN_ENTRY(0x033, "exit"),
+ TOKEN_ENTRY(0x034, "0="),
+ TOKEN_ENTRY(0x035, "0<>"),
+ TOKEN_ENTRY(0x036, "0<"),
+ TOKEN_ENTRY(0x037, "0<="),
+ TOKEN_ENTRY(0x038, "0>"),
+ TOKEN_ENTRY(0x039, "0>="),
+ TOKEN_ENTRY(0x03a, "<"),
+ TOKEN_ENTRY(0x03b, ">"),
+ TOKEN_ENTRY(0x03c, "="),
+ TOKEN_ENTRY(0x03d, "<>"),
+ TOKEN_ENTRY(0x03e, "u>"),
+ TOKEN_ENTRY(0x03f, "u<="),
+ TOKEN_ENTRY(0x040, "u<"),
+ TOKEN_ENTRY(0x041, "u>="),
+ TOKEN_ENTRY(0x042, ">="),
+ TOKEN_ENTRY(0x043, "<="),
+ TOKEN_ENTRY(0x044, "between"),
+ TOKEN_ENTRY(0x045, "within"),
+ TOKEN_ENTRY(0x046, "drop"),
+ TOKEN_ENTRY(0x047, "dup"),
+ TOKEN_ENTRY(0x048, "over"),
+ TOKEN_ENTRY(0x049, "swap"),
+ TOKEN_ENTRY(0x04A, "rot"),
+ TOKEN_ENTRY(0x04b, "-rot"),
+ TOKEN_ENTRY(0x04c, "tuck"),
+ TOKEN_ENTRY(0x04d, "nip"),
+ TOKEN_ENTRY(0x04e, "pick"),
+ TOKEN_ENTRY(0x04f, "roll"),
+ TOKEN_ENTRY(0x050, "?dup"),
+ TOKEN_ENTRY(0x051, "depth"),
+ TOKEN_ENTRY(0x052, "2drop"),
+ TOKEN_ENTRY(0x053, "2dup"),
+ TOKEN_ENTRY(0x054, "2over"),
+ TOKEN_ENTRY(0x055, "2swap"),
+ TOKEN_ENTRY(0x056, "2rot"),
+ TOKEN_ENTRY(0x057, "2/"),
+ TOKEN_ENTRY(0x058, "u2/"),
+ TOKEN_ENTRY(0x059, "2*"),
+ TOKEN_ENTRY(0x05a, "/c"),
+ TOKEN_ENTRY(0x05b, "/w"),
+ TOKEN_ENTRY(0x05c, "/l"),
+ TOKEN_ENTRY(0x05d, "/n"),
+ TOKEN_ENTRY(0x05e, "ca+"),
+ TOKEN_ENTRY(0x05f, "wa+"),
+ TOKEN_ENTRY(0x060, "la+"),
+ TOKEN_ENTRY(0x061, "na+"),
+ TOKEN_ENTRY(0x062, "char+"),
+ TOKEN_ENTRY(0x063, "wa1+"),
+ TOKEN_ENTRY(0x064, "la1+"),
+ TOKEN_ENTRY(0x065, "cell+"),
+ TOKEN_ENTRY(0x066, "chars"),
+ TOKEN_ENTRY(0x067, "/w*"),
+ TOKEN_ENTRY(0x068, "/l*"),
+ TOKEN_ENTRY(0x069, "cells"),
+ TOKEN_ENTRY(0x06a, "on"),
+ TOKEN_ENTRY(0x06b, "off"),
+ TOKEN_ENTRY(0x06c, "+!"),
+ TOKEN_ENTRY(0x06d, "@"),
+ TOKEN_ENTRY(0x06e, "l@"),
+ TOKEN_ENTRY(0x06f, "w@"),
+ TOKEN_ENTRY(0x070, "<w@"),
+ TOKEN_ENTRY(0x071, "c@"),
+ TOKEN_ENTRY(0x072, "!"),
+ TOKEN_ENTRY(0x073, "l!"),
+ TOKEN_ENTRY(0x074, "w!"),
+ TOKEN_ENTRY(0x075, "c!"),
+ TOKEN_ENTRY(0x076, "2@"),
+ TOKEN_ENTRY(0x077, "2!"),
+ TOKEN_ENTRY(0x078, "move"),
+ TOKEN_ENTRY(0x079, "fill"),
+ TOKEN_ENTRY(0x07a, "comp"),
+ TOKEN_ENTRY(0x07b, "noop"),
+ TOKEN_ENTRY(0x07c, "lwsplit"),
+ TOKEN_ENTRY(0x07d, "wljoin"),
+ TOKEN_ENTRY(0x07e, "lbsplit"),
+ TOKEN_ENTRY(0x07f, "bljoin"),
+ TOKEN_ENTRY(0x080, "wbflip"),
+ TOKEN_ENTRY(0x081, "upc"),
+ TOKEN_ENTRY(0x082, "lcc"),
+ TOKEN_ENTRY(0x083, "pack"),
+ TOKEN_ENTRY(0x084, "count"),
+ TOKEN_ENTRY(0x085, "body>"),
+ TOKEN_ENTRY(0x086, ">body"),
+ TOKEN_ENTRY(0x087, "fcode-revision"),
+ TOKEN_ENTRY(0x088, "span"),
+ TOKEN_ENTRY(0x089, "unloop"),
+ TOKEN_ENTRY(0x08a, "expect"),
+ TOKEN_ENTRY(0x08b, "alloc-mem"),
+ TOKEN_ENTRY(0x08c, "free-mem"),
+ TOKEN_ENTRY(0x08d, "key?"),
+ TOKEN_ENTRY(0x08e, "key"),
+ TOKEN_ENTRY(0x08f, "emit"),
+ TOKEN_ENTRY(0x090, "type"),
+ TOKEN_ENTRY(0x091, "(cr"),
+ TOKEN_ENTRY(0x092, "cr"),
+ TOKEN_ENTRY(0x093, "#out"),
+ TOKEN_ENTRY(0x094, "#line"),
+ TOKEN_ENTRY(0x095, "hold"),
+ TOKEN_ENTRY(0x096, "<#"),
+ TOKEN_ENTRY(0x097, "u#>"),
+ TOKEN_ENTRY(0x098, "sign"),
+ TOKEN_ENTRY(0x099, "u#"),
+ TOKEN_ENTRY(0x09a, "u#s"),
+ TOKEN_ENTRY(0x09b, "u."),
+ TOKEN_ENTRY(0x09c, "u.r"),
+ TOKEN_ENTRY(0x09d, "."),
+ TOKEN_ENTRY(0x09e, ".r"),
+ TOKEN_ENTRY(0x09f, ".s"),
+ TOKEN_ENTRY(0x0a0, "base"),
+ TOKEN_ENTRY(0x0a1, "convert"),
+ TOKEN_ENTRY(0x0a2, "$number"),
+ TOKEN_ENTRY(0x0a3, "digit"),
+ TOKEN_ENTRY(0x0a4, "-1"),
+ TOKEN_ENTRY(0x0a5, "0"),
+ TOKEN_ENTRY(0x0a6, "1"),
+ TOKEN_ENTRY(0x0a7, "2"),
+ TOKEN_ENTRY(0x0a8, "3"),
+ TOKEN_ENTRY(0x0a9, "bl"),
+ TOKEN_ENTRY(0x0aa, "bs"),
+ TOKEN_ENTRY(0x0ab, "bell"),
+ TOKEN_ENTRY(0x0ac, "bounds"),
+ TOKEN_ENTRY(0x0ad, "here"),
+ TOKEN_ENTRY(0x0ae, "aligned"),
+ TOKEN_ENTRY(0x0af, "wbsplit"),
+ TOKEN_ENTRY(0x0b0, "bwjoin"),
+ TOKEN_ENTRY(0x0b1, "b(<mark)"),
+ TOKEN_ENTRY(0x0b2, "b(>resolve)"),
+ TOKEN_ENTRY(0x0b3, "set-token-table"),
+ TOKEN_ENTRY(0x0b4, "set-table"),
+ TOKEN_ENTRY(0x0b5, "new-token"),
+ TOKEN_ENTRY(0x0b6, "named-token"),
+ TOKEN_ENTRY(0x0b7, "b(:)"),
+ TOKEN_ENTRY(0x0b8, "b(value)"),
+ TOKEN_ENTRY(0x0b9, "b(variable)"),
+ TOKEN_ENTRY(0x0ba, "b(constant)"),
+ TOKEN_ENTRY(0x0bb, "b(create)"),
+ TOKEN_ENTRY(0x0bc, "b(defer)"),
+ TOKEN_ENTRY(0x0bd, "b(buffer:)"),
+ TOKEN_ENTRY(0x0be, "b(field)"),
+ TOKEN_ENTRY(0x0bf, "b(code)"),
+ TOKEN_ENTRY(0x0c0, "instance"),
+ TOKEN_ENTRY(0x0c2, "b(;)"),
+ TOKEN_ENTRY(0x0c3, "b(to)"),
+ TOKEN_ENTRY(0x0c4, "b(case)"),
+ TOKEN_ENTRY(0x0c5, "b(endcase)"),
+ TOKEN_ENTRY(0x0c6, "b(endof)"),
+ TOKEN_ENTRY(0x0c7, "#"),
+ TOKEN_ENTRY(0x0c8, "#s"),
+ TOKEN_ENTRY(0x0c9, "#>"),
+ TOKEN_ENTRY(0x0ca, "external-token"),
+ TOKEN_ENTRY(0x0cb, "$find"),
+ TOKEN_ENTRY(0x0cc, "offset16"),
+ TOKEN_ENTRY(0x0cd, "evaluate"),
+ TOKEN_ENTRY(0x0d0, "c,"),
+ TOKEN_ENTRY(0x0d1, "w,"),
+ TOKEN_ENTRY(0x0d2, "l,"),
+ TOKEN_ENTRY(0x0d3, ","),
+ TOKEN_ENTRY(0x0d4, "um*"),
+ TOKEN_ENTRY(0x0d5, "um/mod"),
+ TOKEN_ENTRY(0x0d8, "d+"),
+ TOKEN_ENTRY(0x0d9, "d-"),
+ TOKEN_ENTRY(0x0da, "get-token"),
+ TOKEN_ENTRY(0x0db, "set-token"),
+ TOKEN_ENTRY(0x0dc, "state"),
+ TOKEN_ENTRY(0x0dd, "compile"),
+ TOKEN_ENTRY(0x0de, "behavior"),
+ TOKEN_ENTRY(0x0f0, "start0"),
+ TOKEN_ENTRY(0x0f1, "start1"),
+ TOKEN_ENTRY(0x0f2, "start2"),
+ TOKEN_ENTRY(0x0f3, "start4"),
+ TOKEN_ENTRY(0x0fc, "ferror"),
+ TOKEN_ENTRY(0x0fd, "version1"),
+ TOKEN_ENTRY(0x0fe, "4-byte-id"),
+ TOKEN_ENTRY(0x0ff, "end1"),
+ TOKEN_ENTRY(0x101, "dma-alloc"),
+ TOKEN_ENTRY(0x102, "my-address"),
+ TOKEN_ENTRY(0x103, "my-space"),
+ TOKEN_ENTRY(0x104, "memmap"),
+ TOKEN_ENTRY(0x105, "free-virtual"),
+ TOKEN_ENTRY(0x106, ">physical"),
+ TOKEN_ENTRY(0x10f, "my-params"),
+ TOKEN_ENTRY(0x110, "property"),
+ TOKEN_ENTRY(0x111, "encode-int"),
+ TOKEN_ENTRY(0x112, "encode+"),
+ TOKEN_ENTRY(0x113, "encode-phys"),
+ TOKEN_ENTRY(0x114, "encode-string"),
+ TOKEN_ENTRY(0x115, "encode-bytes"),
+ TOKEN_ENTRY(0x116, "reg"),
+ TOKEN_ENTRY(0x117, "intr"),
+ TOKEN_ENTRY(0x118, "driver"),
+ TOKEN_ENTRY(0x119, "model"),
+ TOKEN_ENTRY(0x11a, "device-type"),
+ TOKEN_ENTRY(0x11b, "parse-2int"),
+ TOKEN_ENTRY(0x11c, "is-install"),
+ TOKEN_ENTRY(0x11d, "is-remove"),
+ TOKEN_ENTRY(0x11e, "is-selftest"),
+ TOKEN_ENTRY(0x11f, "new-device"),
+ TOKEN_ENTRY(0x120, "diagnostic-mode?"),
+ TOKEN_ENTRY(0x121, "display-status"),
+ TOKEN_ENTRY(0x122, "memory-test-issue"),
+ TOKEN_ENTRY(0x123, "group-code"),
+ TOKEN_ENTRY(0x124, "mask"),
+ TOKEN_ENTRY(0x125, "get-msecs"),
+ TOKEN_ENTRY(0x126, "ms"),
+ TOKEN_ENTRY(0x127, "finish-device"),
+ TOKEN_ENTRY(0x128, "decode-phys"),
+ TOKEN_ENTRY(0x12b, "interpose"),
+ TOKEN_ENTRY(0x130, "map-low"),
+ TOKEN_ENTRY(0x131, "sbus-intr>cpu"),
+ TOKEN_ENTRY(0x150, "#lines"),
+ TOKEN_ENTRY(0x151, "#columns"),
+ TOKEN_ENTRY(0x152, "line#"),
+ TOKEN_ENTRY(0x153, "column#"),
+ TOKEN_ENTRY(0x154, "inverse?"),
+ TOKEN_ENTRY(0x155, "inverse-screen?"),
+ TOKEN_ENTRY(0x156, "frame-buffer-busy?"),
+ TOKEN_ENTRY(0x157, "draw-character"),
+ TOKEN_ENTRY(0x158, "reset-screen"),
+ TOKEN_ENTRY(0x159, "toggle-cursor"),
+ TOKEN_ENTRY(0x15a, "erase-screen"),
+ TOKEN_ENTRY(0x15b, "blink-screen"),
+ TOKEN_ENTRY(0x15c, "invert-screen"),
+ TOKEN_ENTRY(0x15d, "insert-characters"),
+ TOKEN_ENTRY(0x15e, "delete-characters"),
+ TOKEN_ENTRY(0x15f, "insert-lines"),
+ TOKEN_ENTRY(0x160, "delete-lines"),
+ TOKEN_ENTRY(0x161, "draw-logo"),
+ TOKEN_ENTRY(0x162, "frame-buffer-adr"),
+ TOKEN_ENTRY(0x163, "screen-height"),
+ TOKEN_ENTRY(0x164, "screen-width"),
+ TOKEN_ENTRY(0x165, "window-top"),
+ TOKEN_ENTRY(0x166, "window-left"),
+ TOKEN_ENTRY(0x16a, "default-font"),
+ TOKEN_ENTRY(0x16b, "set-font"),
+ TOKEN_ENTRY(0x16c, "char-height"),
+ TOKEN_ENTRY(0x16d, "char-width"),
+ TOKEN_ENTRY(0x16e, ">font"),
+ TOKEN_ENTRY(0x16f, "fontbytes"),
+ TOKEN_ENTRY(0x170, "fb1-draw-character"),
+ TOKEN_ENTRY(0x171, "fb1-reset-screen"),
+ TOKEN_ENTRY(0x172, "fb1-toggle-cursor"),
+ TOKEN_ENTRY(0x173, "fb1-erase-screen"),
+ TOKEN_ENTRY(0x174, "fb1-blink-screen"),
+ TOKEN_ENTRY(0x175, "fb1-invert-screen"),
+ TOKEN_ENTRY(0x176, "fb1-insert-characters"),
+ TOKEN_ENTRY(0x177, "fb1-delete-characters"),
+ TOKEN_ENTRY(0x178, "fb1-insert-lines"),
+ TOKEN_ENTRY(0x179, "fb1-delete-lines"),
+ TOKEN_ENTRY(0x17a, "fb1-draw-logo"),
+ TOKEN_ENTRY(0x17b, "fb1-install"),
+ TOKEN_ENTRY(0x17c, "fb1-slide-up"),
+ TOKEN_ENTRY(0x180, "fb8-draw-character"),
+ TOKEN_ENTRY(0x181, "fb8-reset-screen"),
+ TOKEN_ENTRY(0x182, "fb8-toggle-cursor"),
+ TOKEN_ENTRY(0x183, "fb8-erase-screen"),
+ TOKEN_ENTRY(0x184, "fb8-blink-screen"),
+ TOKEN_ENTRY(0x185, "fb8-invert-screen"),
+ TOKEN_ENTRY(0x186, "fb8-insert-characters"),
+ TOKEN_ENTRY(0x187, "fb8-delete-characters"),
+ TOKEN_ENTRY(0x188, "fb8-insert-lines"),
+ TOKEN_ENTRY(0x189, "fb8-delete-lines"),
+ TOKEN_ENTRY(0x18a, "fb8-draw-logo"),
+ TOKEN_ENTRY(0x18b, "fb8-install"),
+ TOKEN_ENTRY(0x1a0, "return-buffer"),
+ TOKEN_ENTRY(0x1a1, "xmit-packet"),
+ TOKEN_ENTRY(0x1a2, "poll-packet"),
+ TOKEN_ENTRY(0x1a4, "mac-address"),
+ TOKEN_ENTRY(0x201, "device-name"),
+ TOKEN_ENTRY(0x202, "my-args"),
+ TOKEN_ENTRY(0x203, "my-self"),
+ TOKEN_ENTRY(0x204, "find-package"),
+ TOKEN_ENTRY(0x205, "open-package"),
+ TOKEN_ENTRY(0x206, "close-package"),
+ TOKEN_ENTRY(0x207, "find-method"),
+ TOKEN_ENTRY(0x208, "call-package"),
+ TOKEN_ENTRY(0x209, "$call-parent"),
+ TOKEN_ENTRY(0x20a, "my-parent"),
+ TOKEN_ENTRY(0x20b, "ihandle>phandle"),
+ TOKEN_ENTRY(0x20d, "my-unit"),
+ TOKEN_ENTRY(0x20e, "$call-method"),
+ TOKEN_ENTRY(0x20f, "$open-package"),
+ TOKEN_ENTRY(0x210, "processor-type"),
+ TOKEN_ENTRY(0x211, "firmware-version"),
+ TOKEN_ENTRY(0x212, "fcode-version"),
+ TOKEN_ENTRY(0x213, "alarm"),
+ TOKEN_ENTRY(0x214, "(is-user-word)"),
+ TOKEN_ENTRY(0x215, "suspend-fcode"),
+ TOKEN_ENTRY(0x216, "abort"),
+ TOKEN_ENTRY(0x217, "catch"),
+ TOKEN_ENTRY(0x218, "throw"),
+ TOKEN_ENTRY(0x219, "user-abort"),
+ TOKEN_ENTRY(0x21a, "get-my-property"),
+ TOKEN_ENTRY(0x21b, "decode-int"),
+ TOKEN_ENTRY(0x21c, "decode-string"),
+ TOKEN_ENTRY(0x21d, "get-inherited-property"),
+ TOKEN_ENTRY(0x21e, "delete-property"),
+ TOKEN_ENTRY(0x21f, "get-package-property"),
+ TOKEN_ENTRY(0x220, "cpeek"),
+ TOKEN_ENTRY(0x221, "wpeek"),
+ TOKEN_ENTRY(0x222, "lpeek"),
+ TOKEN_ENTRY(0x223, "cpoke"),
+ TOKEN_ENTRY(0x224, "wpoke"),
+ TOKEN_ENTRY(0x225, "lpoke"),
+ TOKEN_ENTRY(0x226, "lwflip"),
+ TOKEN_ENTRY(0x227, "lbflip"),
+ TOKEN_ENTRY(0x228, "lbflips"),
+ TOKEN_ENTRY(0x229, "adr-mask"),
+ TOKEN_ENTRY(0x230, "rb@"),
+ TOKEN_ENTRY(0x231, "rb!"),
+ TOKEN_ENTRY(0x232, "rw@"),
+ TOKEN_ENTRY(0x233, "rw!"),
+ TOKEN_ENTRY(0x234, "rl@"),
+ TOKEN_ENTRY(0x235, "rl!"),
+ TOKEN_ENTRY(0x236, "wbflips"),
+ TOKEN_ENTRY(0x237, "lwflips"),
+ TOKEN_ENTRY(0x238, "probe"),
+ TOKEN_ENTRY(0x239, "probe-virtual"),
+ TOKEN_ENTRY(0x23b, "child"),
+ TOKEN_ENTRY(0x23c, "peer"),
+ TOKEN_ENTRY(0x23d, "next-property"),
+ TOKEN_ENTRY(0x23e, "byte-load"),
+ TOKEN_ENTRY(0x23f, "set-args"),
+ TOKEN_ENTRY(0x240, "left-parse-string"),
/* FCodes from 64bit extension addendum */
- TOKEN_ENTRY( 0x22e, "rx@" ),
- TOKEN_ENTRY( 0x22f, "rx!" ),
- TOKEN_ENTRY( 0x241, "bxjoin" ),
- TOKEN_ENTRY( 0x242, "<l@" ),
- TOKEN_ENTRY( 0x243, "lxjoin" ),
- TOKEN_ENTRY( 0x244, "wxjoin" ),
- TOKEN_ENTRY( 0x245, "x," ),
- TOKEN_ENTRY( 0x246, "x@" ),
- TOKEN_ENTRY( 0x247, "x!" ),
- TOKEN_ENTRY( 0x248, "/x" ),
- TOKEN_ENTRY( 0x249, "/x*" ),
- TOKEN_ENTRY( 0x24a, "xa+" ),
- TOKEN_ENTRY( 0x24b, "xa1+" ),
- TOKEN_ENTRY( 0x24c, "xbflip" ),
- TOKEN_ENTRY( 0x24d, "xbflips" ),
- TOKEN_ENTRY( 0x24e, "xbsplit" ),
- TOKEN_ENTRY( 0x24f, "xlflip" ),
- TOKEN_ENTRY( 0x250, "xlflips" ),
- TOKEN_ENTRY( 0x251, "xlsplit" ),
- TOKEN_ENTRY( 0x252, "xwflip" ),
- TOKEN_ENTRY( 0x253, "xwflips" ),
- TOKEN_ENTRY( 0x254, "xwsplit" ),
+ TOKEN_ENTRY(0x22e, "rx@"),
+ TOKEN_ENTRY(0x22f, "rx!"),
+ TOKEN_ENTRY(0x241, "bxjoin"),
+ TOKEN_ENTRY(0x242, "<l@"),
+ TOKEN_ENTRY(0x243, "lxjoin"),
+ TOKEN_ENTRY(0x244, "wxjoin"),
+ TOKEN_ENTRY(0x245, "x,"),
+ TOKEN_ENTRY(0x246, "x@"),
+ TOKEN_ENTRY(0x247, "x!"),
+ TOKEN_ENTRY(0x248, "/x"),
+ TOKEN_ENTRY(0x249, "/x*"),
+ TOKEN_ENTRY(0x24a, "xa+"),
+ TOKEN_ENTRY(0x24b, "xa1+"),
+ TOKEN_ENTRY(0x24c, "xbflip"),
+ TOKEN_ENTRY(0x24d, "xbflips"),
+ TOKEN_ENTRY(0x24e, "xbsplit"),
+ TOKEN_ENTRY(0x24f, "xlflip"),
+ TOKEN_ENTRY(0x250, "xlflips"),
+ TOKEN_ENTRY(0x251, "xlsplit"),
+ TOKEN_ENTRY(0x252, "xwflip"),
+ TOKEN_ENTRY(0x253, "xwflips"),
+ TOKEN_ENTRY(0x254, "xwsplit"),
};
-static const int dictionary_indx_max = (sizeof(detok_table)/sizeof(token_t)) ;
+static const int dictionary_indx_max =
+ (sizeof(detok_table) / sizeof(token_t));
static token_t *dictionary_reset_position;
-void init_dictionary(void)
+void init_dictionary(void)
{
- int indx;
+ int indx;
- dictionary = &detok_table[dictionary_indx_max-1];
- dictionary_reset_position = dictionary;
+ dictionary = &detok_table[dictionary_indx_max - 1];
+ dictionary_reset_position = dictionary;
- for (indx = 1; indx < dictionary_indx_max ; indx++ )
- {
- detok_table[indx].next = &detok_table[indx-1];
- }
+ for (indx = 1; indx < dictionary_indx_max; indx++) {
+ detok_table[indx].next = &detok_table[indx - 1];
+ }
}
-void reset_dictionary(void)
+void reset_dictionary(void)
{
- token_t *next_t;
+ token_t *next_t;
- next_t = dictionary;
- while ( next_t != dictionary_reset_position )
- {
- next_t = dictionary->next ;
- free( dictionary->name );
- free( dictionary );
- dictionary = next_t ;
- }
+ next_t = dictionary;
+ while (next_t != dictionary_reset_position) {
+ next_t = dictionary->next;
+ free(dictionary->name);
+ free(dictionary);
+ dictionary = next_t;
+ }
}
/* If FCodes have been added by User, we need to update reset-position */
void freeze_dictionary(void)
{
- dictionary_reset_position = dictionary;
+ dictionary_reset_position = dictionary;
}
Modified: fcode-utils/detok/pcihdr.c
===================================================================
--- fcode-utils/detok/pcihdr.c 2006-10-14 21:07:27 UTC (rev 95)
+++ fcode-utils/detok/pcihdr.c 2006-10-14 21:32:13 UTC (rev 96)
@@ -136,18 +136,17 @@
*
**************************************************************************** */
-static int is_pci_header ( rom_header_t *pci_rom_hdr )
+static int is_pci_header(rom_header_t * pci_rom_hdr)
{
- const u16 pci_header_signature = 0x55aa;
- int retval ;
+ const u16 pci_header_signature = 0x55aa;
+ int retval;
- retval = 0;
+ retval = 0;
- if ( BIG_ENDIAN_WORD_FETCH(pci_rom_hdr->signature) == pci_header_signature )
- {
- retval = LITTLE_ENDIAN_WORD_FETCH(pci_rom_hdr->data_ptr);
- }
- return(retval);
+ if (BIG_ENDIAN_WORD_FETCH(pci_rom_hdr->signature) == pci_header_signature) {
+ retval = LITTLE_ENDIAN_WORD_FETCH(pci_rom_hdr->data_ptr);
+ }
+ return (retval);
}
/* **************************************************************************
@@ -196,20 +195,19 @@
*
**************************************************************************** */
-static int is_pci_data_struct ( pci_data_t *pci_data_ptr )
+static int is_pci_data_struct(pci_data_t * pci_data_ptr)
{
- int retval ;
+ int retval;
- retval = 0;
+ retval = 0;
- if (BIG_ENDIAN_LONG_FETCH(pci_data_ptr->signature) == PCI_DATA_HDR)
- {
- retval = LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->dlen);
- }
- return(retval);
+ if (BIG_ENDIAN_LONG_FETCH(pci_data_ptr->signature) == PCI_DATA_HDR) {
+ retval = LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->dlen);
+ }
+ return (retval);
}
-
+
/* **************************************************************************
*
* Function name: announce_pci_hdr ( rom_header_t *pci_rom_hdr )
@@ -226,16 +224,16 @@
*
**************************************************************************** */
-static void announce_pci_hdr ( rom_header_t *pci_rom_hdr )
+static void announce_pci_hdr(rom_header_t * pci_rom_hdr)
{
- char temp_buf[80];
- u32 temp;
+ char temp_buf[80];
+ u32 temp;
- printremark ( "PCI Header identified");
- temp=(u32)LITTLE_ENDIAN_WORD_FETCH(pci_rom_hdr->data_ptr);
- sprintf(temp_buf, " Offset to Data Structure = 0x%04x (%d)\n",
- temp, temp);
- printremark ( temp_buf );
+ printremark("PCI Header identified");
+ temp = (u32) LITTLE_ENDIAN_WORD_FETCH(pci_rom_hdr->data_ptr);
+ sprintf(temp_buf, " Offset to Data Structure = 0x%04x (%d)\n",
+ temp, temp);
+ printremark(temp_buf);
}
/* **************************************************************************
@@ -266,57 +264,56 @@
*
**************************************************************************** */
-static void announce_pci_data_struct ( pci_data_t *pci_data_ptr )
+static void announce_pci_data_struct(pci_data_t * pci_data_ptr)
{
- char temp_buf[80];
- u32 temp;
+ char temp_buf[80];
+ u32 temp;
- printremark ( "PCI Data Structure identified");
+ printremark("PCI Data Structure identified");
- temp=(u32)LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->dlen);
- sprintf(temp_buf, " Data Structure Length = 0x%04x (%d)\n", temp, temp);
- printremark ( temp_buf );
+ temp = (u32) LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->dlen);
+ sprintf(temp_buf, " Data Structure Length = 0x%04x (%d)\n", temp, temp);
+ printremark(temp_buf);
- sprintf(temp_buf, " Vendor ID: 0x%04x\n",
- LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->vendor));
- printremark ( temp_buf );
+ sprintf(temp_buf, " Vendor ID: 0x%04x\n",
+ LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->vendor));
+ printremark(temp_buf);
- sprintf(temp_buf, " Device ID: 0x%04x\n",
- LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->device));
- printremark ( temp_buf );
+ sprintf(temp_buf, " Device ID: 0x%04x\n",
+ LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->device));
+ printremark(temp_buf);
- temp=(u32)CLASS_CODE_FETCH(pci_data_ptr->class_code);
- sprintf(temp_buf, " Class Code: 0x%06x (%s)",
- temp, pci_device_class_name(temp));
- printremark ( temp_buf );
+ temp = (u32) CLASS_CODE_FETCH(pci_data_ptr->class_code);
+ sprintf(temp_buf, " Class Code: 0x%06x (%s)",
+ temp, pci_device_class_name(temp));
+ printremark(temp_buf);
- temp=(u32)LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->vpd);
- if ( temp != 0 )
- {
- sprintf(temp_buf, " Vital Prod Data: 0x%02x\n", temp);
- printremark ( temp_buf );
- }
+ temp = (u32) LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->vpd);
+ if (temp != 0) {
+ sprintf(temp_buf, " Vital Prod Data: 0x%02x\n", temp);
+ printremark(temp_buf);
+ }
- temp=(u32)LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->irevision);
- if ( temp != 0 )
- {
- sprintf(temp_buf, " Image Revision: 0x%02x\n", temp);
- printremark ( temp_buf );
- }
+ temp = (u32) LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->irevision);
+ if (temp != 0) {
+ sprintf(temp_buf, " Image Revision: 0x%02x\n", temp);
+ printremark(temp_buf);
+ }
- sprintf(temp_buf, " Code Type: 0x%02x (%s)\n", pci_data_ptr->code_type,
- pci_code_type_name(pci_data_ptr->code_type) );
- printremark ( temp_buf );
+ sprintf(temp_buf, " Code Type: 0x%02x (%s)\n",
+ pci_data_ptr->code_type,
+ pci_code_type_name(pci_data_ptr->code_type));
+ printremark(temp_buf);
- temp=(u32)LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->ilen);
- pci_image_len = temp*512;
- sprintf(temp_buf, " Image Length: 0x%04x blocks (%d bytes)\n",
- temp, pci_image_len);
- printremark ( temp_buf );
+ temp = (u32) LITTLE_ENDIAN_WORD_FETCH(pci_data_ptr->ilen);
+ pci_image_len = temp * 512;
+ sprintf(temp_buf, " Image Length: 0x%04x blocks (%d bytes)\n",
+ temp, pci_image_len);
+ printremark(temp_buf);
- sprintf(temp_buf, " %sast PCI Image.\n",
- pci_data_ptr->last_image_flag&&0x80 != 0 ? "L" : "Not l");
- printremark ( temp_buf );
+ sprintf(temp_buf, " %sast PCI Image.\n",
+ pci_data_ptr->last_image_flag && 0x80 != 0 ? "L" : "Not l");
+ printremark(temp_buf);
}
@@ -369,46 +366,42 @@
*
**************************************************************************** */
-int handle_pci_header ( u8 *data_ptr )
+int handle_pci_header(u8 * data_ptr)
{
- int hdrlen;
- int data_struc_len;
- /* int retval; */ /* Not needed until we handle error cases... */
+ int hdrlen;
+ int data_struc_len;
+ /* int retval; *//* Not needed until we handle error cases... */
- data_struc_len = 0;
+ data_struc_len = 0;
- hdrlen = is_pci_header( (rom_header_t *)data_ptr );
- /* retval = hdrlen; */ /* Not needed yet... */
- if ( hdrlen < 0 )
- {
- /* Handle error case... */
- /* Leave null for now... */
- /* It might need to do a premature EXIT here... */
- } else {
- /* if hdrlen == 0 then we don't need to check a Data Structure */
- if ( hdrlen > 0 )
- {
- announce_pci_hdr ( (rom_header_t *)data_ptr );
- data_struc_len = is_pci_data_struct(
- (pci_data_t *) &data_ptr[hdrlen] );
- /*
- * A Data Structure Length of Zero would be an error
- * that could be detected by is_pci_data_struct()
- */
- if ( data_struc_len <= 0 )
- {
- /* Handle error case... */
- /* Leave null for now... */
- /* It might need to do a premature EXIT here... */
- /* retval = -1; */ /* Not needed yet... */
- } else {
- announce_pci_data_struct ( (pci_data_t *) &data_ptr[hdrlen] );
- pci_image_end = data_ptr + pci_image_len;
- /* retval = hdrlen+data_struc_len; */ /* Not needed yet... */
- }
- }
- }
- return (hdrlen+data_struc_len);
+ hdrlen = is_pci_header((rom_header_t *) data_ptr);
+ /* retval = hdrlen; *//* Not needed yet... */
+ if (hdrlen < 0) {
+ /* Handle error case... */
+ /* Leave null for now... */
+ /* It might need to do a premature EXIT here... */
+ } else {
+ /* if hdrlen == 0 then we don't need to check a Data Structure */
+ if (hdrlen > 0) {
+ announce_pci_hdr((rom_header_t *) data_ptr);
+ data_struc_len = is_pci_data_struct((pci_data_t *) & data_ptr[hdrlen]);
+ /*
+ * A Data Structure Length of Zero would be an error
+ * that could be detected by is_pci_data_struct()
+ */
+ if (data_struc_len <= 0) {
+ /* Handle error case... */
+ /* Leave null for now... */
+ /* It might need to do a premature EXIT here... */
+ /* retval = -1; *//* Not needed yet... */
+ } else {
+ announce_pci_data_struct((pci_data_t *) & data_ptr[hdrlen]);
+ pci_image_end = data_ptr + pci_image_len;
+ /* retval = hdrlen+data_struc_len; *//* Not needed yet... */
+ }
+ }
+ }
+ return (hdrlen + data_struc_len);
}
@@ -445,34 +438,30 @@
*
**************************************************************************** */
-void handle_pci_filler(u8 *filler_ptr)
+void handle_pci_filler(u8 * filler_ptr)
{
- u8 *scan_ptr;
- int filler_len;
- char temp_buf[80];
- bool all_zero = TRUE;
- u8 filler_byte = *filler_ptr;
+ u8 *scan_ptr;
+ int filler_len;
+ char temp_buf[80];
+ bool all_zero = TRUE;
+ u8 filler_byte = *filler_ptr;
- filler_len = pci_image_end - filler_ptr;
+ filler_len = pci_image_end - filler_ptr;
- for ( scan_ptr = filler_ptr;
- scan_ptr < pci_image_end;
- filler_byte = *(++scan_ptr) )
- {
- if ( filler_byte != 0 )
- {
- all_zero = FALSE;
- break;
- }
- }
-
- if ( all_zero )
- {
- sprintf(temp_buf, "PCI Image padded with %d bytes of zero", filler_len);
- }else{
- sprintf(temp_buf, "PCI Image padding-field of %d bytes "
- "had first non-zero byte at offset %ld",
- filler_len, scan_ptr - filler_ptr );
- }
- printremark ( temp_buf );
+ for (scan_ptr = filler_ptr;
+ scan_ptr < pci_image_end; filler_byte = *(++scan_ptr)) {
+ if (filler_byte != 0) {
+ all_zero = FALSE;
+ break;
+ }
+ }
+
+ if (all_zero) {
+ sprintf(temp_buf, "PCI Image padded with %d bytes of zero", filler_len);
+ } else {
+ sprintf(temp_buf, "PCI Image padding-field of %d bytes "
+ "had first non-zero byte at offset %ld",
+ filler_len, scan_ptr - filler_ptr);
+ }
+ printremark(temp_buf);
}
Modified: fcode-utils/detok/printformats.c
===================================================================
--- fcode-utils/detok/printformats.c 2006-10-14 21:07:27 UTC (rev 95)
+++ fcode-utils/detok/printformats.c 2006-10-14 21:32:13 UTC (rev 96)
@@ -84,57 +84,54 @@
*
**************************************************************************** */
-void printremark ( char *str)
+void printremark(char *str)
{
- char *strtmp ; /* Temporary pointer to current substring */
- int substrlen ; /* Length of current substring */
- char *substrend ; /* Pointer to end of current substring */
- char *strend ; /* Pointer to end of given string */
+ char *strtmp; /* Temporary pointer to current substring */
+ int substrlen; /* Length of current substring */
+ char *substrend; /* Pointer to end of current substring */
+ char *strend; /* Pointer to end of given string */
- char *strbfr ; /* Temporary substring buffer */
+ char *strbfr; /* Temporary substring buffer */
- /* Guarantee that the malloc will be big enough. */
- strbfr = (char *)malloc(strlen((char *)str)+1);
- if ( !strbfr )
- {
- printf ("No memory.\n");
- exit(-1);
- }
+ /* Guarantee that the malloc will be big enough. */
+ strbfr = (char *) malloc(strlen((char *) str) + 1);
+ if (!strbfr) {
+ printf("No memory.\n");
+ exit(-1);
+ }
- strtmp = str;
- strend = &str[strlen(str)];
+ strtmp = str;
+ strend = &str[strlen(str)];
- /* ******************************************************************
- *
- * Isolate the current substring; allow that the given
- * string might not be terminated with a new-line.
- *
- * The strend pointer provides a convenient means to
- * test for when we've reached the end.
- *
- ******************************************************************** */
+ /* ******************************************************************
+ *
+ * Isolate the current substring; allow that the given
+ * string might not be terminated with a new-line.
+ *
+ * The strend pointer provides a convenient means to
+ * test for when we've reached the end.
+ *
+ ******************************************************************** */
- while ( strtmp < strend )
- {
- substrend = strchr(strtmp , '\n');
- substrlen = ( substrend ? (substrend-strtmp) : strlen(strtmp) );
+ while (strtmp < strend) {
+ substrend = strchr(strtmp, '\n');
+ substrlen = (substrend ? (substrend - strtmp) : strlen(strtmp));
- strncpy (strbfr, strtmp, substrlen);
- /* **********************************************************
- *
- * strncpy() does not append a terminating null character,
- * so we have to.
- *
- ************************************************************ */
- strbfr[substrlen] = (char)0;
+ strncpy(strbfr, strtmp, substrlen);
+ /* **********************************************************
+ *
+ * strncpy() does not append a terminating null character,
+ * so we have to.
+ *
+ ************************************************************ */
+ strbfr[substrlen] = (char) 0;
- printf("\\ %s\n",strbfr);
+ printf("\\ %s\n", strbfr);
- strtmp = &strtmp[ substrlen + ( substrend ? 1 : 0 ) ] ;
+ strtmp = &strtmp[substrlen + (substrend ? 1 : 0)];
- }
+ }
- free(strbfr) ;
+ free(strbfr);
}
-
Modified: fcode-utils/detok/stream.c
===================================================================
--- fcode-utils/detok/stream.c 2006-10-14 21:07:27 UTC (rev 95)
+++ fcode-utils/detok/stream.c 2006-10-14 21:32:13 UTC (rev 96)
@@ -82,31 +82,31 @@
{
FILE *infile;
struct stat finfo;
-
- if (stat(name,&finfo))
+
+ if (stat(name, &finfo))
return -1;
-
- indata=malloc(finfo.st_size);
+
+ indata = malloc(finfo.st_size);
if (!indata)
return -1;
- infile=fopen(name,"r");
- if (!infile)
- return -1;
+ infile = fopen(name, "r");
+ if (!infile)
+ return -1;
- if (fread(indata, finfo.st_size, 1, infile)!=1) {
+ if (fread(indata, finfo.st_size, 1, infile) != 1) {
free(indata);
return -1;
}
fclose(infile);
-
- pc=indata;
+
+ pc = indata;
fc_start = indata;
- max=pc+finfo.st_size;
-
+ max = pc + finfo.st_size;
+
stream_max = finfo.st_size;
-
+
return 0;
}
@@ -121,7 +121,7 @@
void init_fcode_block(void)
{
fc_start = pc;
- linenum = 1 ;
+ linenum = 1;
}
@@ -133,7 +133,7 @@
int get_streampos(void)
{
- return (int)( pc - fc_start );
+ return (int) (pc - fc_start);
}
void set_streampos(int pos)
@@ -170,23 +170,21 @@
static void throw_eof(bool premature)
{
- char yoo = 'U';
- char eee = 'E';
- if ( premature)
- {
- printf("Premature ");
- yoo = 'u';
- eee = 'e';
- }
- if ( ! end_found )
- {
- printf("%cnexpected ",yoo);
- eee = 'e';
- }
- printf("%cnd of file.\n",eee);
- longjmp(eof_exception, -1);
+ char yoo = 'U';
+ char eee = 'E';
+ if (premature) {
+ printf("Premature ");
+ yoo = 'u';
+ eee = 'e';
+ }
+ if (!end_found) {
+ printf("%cnexpected ", yoo);
+ eee = 'e';
+ }
+ printf("%cnd of file.\n", eee);
+ longjmp(eof_exception, -1);
}
-
+
/* **************************************************************************
*
* Function name: get_bytes
@@ -230,18 +228,16 @@
static u8 *get_bytes(int nbytes)
{
- u8 *retval = pc;
- if ( pc == max )
- {
- throw_eof(FALSE);
- }
- if ( pc + nbytes > max )
- {
- throw_eof(TRUE);
- }
- pc += nbytes;
- return( retval);
- }
+ u8 *retval = pc;
+ if (pc == max) {
+ throw_eof(FALSE);
+ }
+ if (pc + nbytes > max) {
+ throw_eof(TRUE);
+ }
+ pc += nbytes;
+ return (retval);
+}
/* **************************************************************************
@@ -254,12 +250,12 @@
bool more_to_go(void)
{
- bool retval;
- retval = INVERSE( pc == max );
- return( retval);
+ bool retval;
+ retval = INVERSE(pc == max);
+ return (retval);
}
-
+
/* **************************************************************************
*
* Function name: next_token
@@ -275,64 +271,62 @@
* token_streampos Streampos() of token just gotten
*
**************************************************************************** */
-
+
u16 next_token(void)
{
- u16 tok;
- token_streampos = get_streampos();
- tok = *(get_bytes(1));
- if ( tok != 0x00 && tok < 0x10)
- {
- tok<<=8;
- tok |= *(get_bytes(1));
- }
- fcode=tok;
- return(tok);
+ u16 tok;
+ token_streampos = get_streampos();
+ tok = *(get_bytes(1));
+ if (tok != 0x00 && tok < 0x10) {
+ tok <<= 8;
+ tok |= *(get_bytes(1));
+ }
+ fcode = tok;
+ return (tok);
}
u32 get_num32(void)
{
- u32 retval;
+ u32 retval;
u8 *num_str;
-
+
num_str = get_bytes(4);
retval = BIG_ENDIAN_LONG_FETCH(num_str);
-
- return ( retval);
+
+ return (retval);
}
u16 get_num16(void)
{
- u16 retval;
+ u16 retval;
u8 *num_str;
-
- num_str = get_bytes(2);
+
+ num_str = get_bytes(2);
retval = BIG_ENDIAN_WORD_FETCH(num_str);
-
- return ( retval);
+
+ return (retval);
}
-
+
u8 get_num8(void)
{
- u8 inbyte;
+ u8 inbyte;
inbyte = *(get_bytes(1));
- return(inbyte);
+ return (inbyte);
}
s16 get_offset(void)
{
- s16 retval;
- if (offs16)
- {
- retval = (s16)get_num16();
- }else{
- retval = (s16)get_num8();
- /* Make sure it's sign-extended */
- retval |= ( retval & 0x80 ) ? 0xff00 : 0 ;
+ s16 retval;
+ if (offs16) {
+ retval = (s16) get_num16();
+ } else {
+ retval = (s16) get_num8();
+ /* Make sure it's sign-extended */
+ retval |= (retval & 0x80) ? 0xff00 : 0;
}
-
- return (retval);
+
+ return (retval);
}
/* **************************************************************************
@@ -360,14 +354,14 @@
*
**************************************************************************** */
-u8 *get_string(u8 *len)
+u8 *get_string(u8 * len)
{
- char *retval;
+ char *retval;
- *len = get_num8();
- retval = get_bytes((int)*len);
-
- return (retval);
+ *len = get_num8();
+ retval = get_bytes((int) *len);
+
+ return (retval);
}
@@ -405,23 +399,23 @@
*
**************************************************************************** */
-char *get_name(u8 *len)
+char *get_name(u8 * len)
{
- char *str_start;
- char *retval;
- u8 sav_byt;
-
- str_start = get_string( len );
+ char *str_start;
+ char *retval;
+ u8 sav_byt;
- sav_byt = *pc;
- *pc = 0;
+ str_start = get_string(len);
- retval = strdup(str_start);
- *pc = sav_byt;
-
- return (retval);
- }
-
+ sav_byt = *pc;
+ *pc = 0;
+
+ retval = strdup(str_start);
+ *pc = sav_byt;
+
+ return (retval);
+}
+
/* **************************************************************************
*
* Function name: calc_checksum
@@ -452,27 +446,26 @@
u16 calc_checksum(void)
{
- u16 retval = 0;
- u8 *cksmptr;
- u8 *save_pc;
- u32 fc_blk_len;
- int indx;
+ u16 retval = 0;
+ u8 *cksmptr;
+ u8 *save_pc;
+ u32 fc_blk_len;
+ int indx;
- save_pc = pc;
+ save_pc = pc;
- fc_blk_len = get_num32(); /* Read len */
- cksmptr = get_bytes(fc_blk_len-8); /* Make sure we have all our data */
+ fc_blk_len = get_num32(); /* Read len */
+ cksmptr = get_bytes(fc_blk_len - 8); /* Make sure we have all our data */
- for ( indx = 8; indx < fc_blk_len; indx++)
- {
- retval += *cksmptr++;
+ for (indx = 8; indx < fc_blk_len; indx++) {
+ retval += *cksmptr++;
+ }
+
+ pc = save_pc;
+ return (retval);
}
- pc = save_pc;
- return( retval);
-}
-
/* **************************************************************************
*
* Function name: adjust_for_pci_header
@@ -510,7 +503,7 @@
void adjust_for_pci_header(void)
{
int pci_header_size;
-
+
pci_header_size = handle_pci_header(pc);
pci_image_found = pci_header_size > 0 ? TRUE : FALSE;
pc += pci_header_size;
@@ -543,14 +536,13 @@
void adjust_for_pci_filler(void)
{
- if ( pci_image_found )
- {
- int pci_filler_len;
- u8 *pci_filler_ptr;
+ if (pci_image_found) {
+ int pci_filler_len;
+ u8 *pci_filler_ptr;
- pci_filler_len = pci_image_end - pc;
- pci_filler_ptr = get_bytes(pci_filler_len);
- handle_pci_filler( pci_filler_ptr );
- pci_image_found = FALSE;
- }
+ pci_filler_len = pci_image_end - pc;
+ pci_filler_ptr = get_bytes(pci_filler_len);
+ handle_pci_filler(pci_filler_ptr);
+ pci_image_found = FALSE;
+ }
}
Modified: fcode-utils/detok/stream.h
===================================================================
--- fcode-utils/detok/stream.h 2006-10-14 21:07:27 UTC (rev 95)
+++ fcode-utils/detok/stream.h 2006-10-14 21:32:13 UTC (rev 96)
@@ -46,16 +46,16 @@
void adjust_for_pci_filler(void);
void init_fcode_block(void);
-int get_streampos(void);
+int get_streampos(void);
void set_streampos(int pos);
u16 next_token(void);
-u8 get_num8(void);
+u8 get_num8(void);
u16 get_num16(void);
u32 get_num32(void);
s16 get_offset(void);
-u8 *get_string(u8 *len);
-char *get_name(u8 *len);
+u8 *get_string(u8 * len);
+char *get_name(u8 * len);
u16 calc_checksum(void);
/* External declarations for variables defined in stream.c */
@@ -65,4 +65,4 @@
extern u8 *pc;
extern u8 *max;
-#endif /* _UTILS_DETOK_STREAM_H */
+#endif /* _UTILS_DETOK_STREAM_H */
More information about the OpenBIOS
mailing list