[OpenBIOS] r104 - fcode-utils/detok

svn at openbios.org svn at openbios.org
Mon Oct 30 12:31:17 CET 2006


Author: stepan
Date: 2006-10-30 12:31:16 +0100 (Mon, 30 Oct 2006)
New Revision: 104

Modified:
   fcode-utils/detok/decode.c
   fcode-utils/detok/detok.c
Log:
detok 1.0.2 merge commit II


Modified: fcode-utils/detok/decode.c
===================================================================
--- fcode-utils/detok/decode.c	2006-10-30 10:04:23 UTC (rev 103)
+++ fcode-utils/detok/decode.c	2006-10-30 11:31:16 UTC (rev 104)
@@ -38,6 +38,7 @@
 
 #include "detok.h"
 #include "stream.h"
+#include "addfcodes.h"
 
 static int indent;		/*  Current level of indentation   */
 
@@ -125,8 +126,7 @@
 static void decode_lines(void)
 {
 	if (show_linenumbers) {
-		printf("%6d: ",
-		       show_offsets ? token_streampos : linenum++);
+		printf("%6d: ",show_offsets ? token_streampos : linenum++);
 	}
 }
 
@@ -384,6 +384,18 @@
 	printf("0x%x\n", lit);
 }
 
+static void double_length_literal(void)
+{
+	u16 quadhh, quadhl, quadlh, quadll;
+
+	output_token();
+	quadhh = get_num16();
+	quadhl = get_num16();
+	quadlh = get_num16();
+	quadll = get_num16();
+	printf("0x%04x.%04x.%04x.%04x\n", quadhh, quadhl, quadlh, quadll);
+}
+
 static void offset16(void)
 {
 	decode_default();
@@ -536,10 +548,28 @@
 		end_found = TRUE;
 		decode_default();
 		break;
+
+#if  0  /*  Fooey on C's petty limitations!  */
+        /*  I'd like to be able to do this:  */
+	/*  Special Functions  */
+	case *double_lit_code:
+		double_length_literal();
+		break;
+#endif  /*  Fooey on C's petty limitations!  */
+
 	default:
+	{
+	    /*  Have to do this clumsy thing instead  */
+	    if ( token == *double_lit_code )
+	    {
+		double_length_literal();
+		break;
+	    }
+
 		decode_default();
 	}
 }
+}
 
 
 /* **************************************************************************
@@ -556,15 +586,18 @@
  *      Outputs:
  *         Returned Value:      NONE
  *         Global/Static Variables:
- *             offs16           FALSE if Starter was version1, else TRUE
+ *             offs16           FALSE if Starter was version1, TRUE for all
+ *                                  other valid Starters, otherwise unchanged.
  *             fclen            On error, gets set to reach end of input stream
  *                                  Otherwise, gets set by  decode_start() 
  *         Printout:
+ *             On error, print a new-line to finish previous token's line.
  *
  *      Error Detection:
  *          First byte not a valid FCode Start:  Print message, restore
  *              input pointer to initial value, set fclen to [(end of
- *              input stream) - (input pointer)], return FALSE.
+ *              input stream) - (input pointer)], leave offs16 unchanged.
+ *              Return FALSE.
  *
  *      Process Explanation:
  *          This routine error-checks and dispatches to the routine that
@@ -578,18 +611,20 @@
 {
 	long err_pos;
 	u16 token;
+	bool new_offs16 = TRUE;
 
 	err_pos = get_streampos();
 	indent = 0;
 	token = next_token();
-	offs16 = TRUE;
+
 	switch (token) {
 	case 0x0fd:		/* version1 */
-		offs16 = FALSE;
+		new_offs16 = FALSE;
 	case 0x0f0:		/* start0 */
 	case 0x0f1:		/* start1 */
 	case 0x0f2:		/* start2 */
 	case 0x0f3:		/* start4 */
+		offs16 = new_offs16;
 		decode_start();
 		break;
 	default:

Modified: fcode-utils/detok/detok.c
===================================================================
--- fcode-utils/detok/detok.c	2006-10-30 10:04:23 UTC (rev 103)
+++ fcode-utils/detok/detok.c	2006-10-30 11:31:16 UTC (rev 104)
@@ -45,7 +45,7 @@
 #include "stream.h"
 #include "addfcodes.h"
 
-#define DETOK_VERSION "1.0.0"
+#define DETOK_VERSION "1.0.2"
 
 #define CORE_COPYR   "(C) Copyright 2001-2006 Stefan Reinauer.\n" \
 		     "(C) Copyright 2006 coresystems GmbH <info at coresystems.de>"
@@ -69,8 +69,8 @@
 		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");
+		"under the terms of\nthe GNU General Public License v2. "
+		"This program has absolutely no warranty.\n\n");
 
 	pfunct = (is_error ? (vfunct) printf : printremark);
 
@@ -190,3 +190,4 @@
 
 	return 0;
 }
+




More information about the OpenBIOS mailing list