changeset 774:09a63eb47e0f

Merged.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 10 May 2013 12:38:07 +0300
parents 95d9bd557a54 (current diff) 8314b484893f (diff)
children 4ff7d7f6f4d1
files
diffstat 3 files changed, 75 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/dmlib.h	Fri May 10 12:37:51 2013 +0300
+++ b/dmlib.h	Fri May 10 12:38:07 2013 +0300
@@ -15,9 +15,9 @@
 #include <stdarg.h>
 
 #ifdef DM_USE_ASSERTS
-#include <assert.h>
+#  include <assert.h>
 #else
-#define assert(NEXPR) // stub
+#  define assert(NEXPR) // stub
 #endif
 
 #ifdef __cplusplus
@@ -31,35 +31,35 @@
 /* Error codes
  */
 enum {
-	// General error codes
-	DMERR_OK = 0,
-	DMERR_PROGRESS,     // Status OK, but operation in progress
+    // General error codes
+    DMERR_OK = 0,
+    DMERR_PROGRESS,     // Status OK, but operation in progress
 	
-	DMERR_FOPEN,
-	DMERR_FREAD,
-	DMERR_FWRITE,
-	DMERR_FSEEK,
-	DMERR_NOT_FOUND,    // Resource/data not found
+    DMERR_FOPEN,
+    DMERR_FREAD,
+    DMERR_FWRITE,
+    DMERR_FSEEK,
+    DMERR_NOT_FOUND,    // Resource/data not found
 
-	DMERR_INVALID_DATA, // Some data was invalid
-	DMERR_MALLOC,       // Memory allocation failure
-	DMERR_ALREADY_INIT, // Resource has already been initialized
-	DMERR_INIT_FAIL,    // General initialization failure
-	DMERR_INVALID_ARGS,
+    DMERR_INVALID_DATA, // Some data was invalid
+    DMERR_MALLOC,       // Memory allocation failure
+    DMERR_ALREADY_INIT, // Resource has already been initialized
+    DMERR_INIT_FAIL,    // General initialization failure
+    DMERR_INVALID_ARGS,
 
-	DMERR_NULLPTR,      // NULL pointer specified in critical argument
-	DMERR_NOT_SUPPORTED,// Operation not supported
-	DMERR_OUT_OF_DATA,
-	DMERR_EXTRA_DATA,
-	DMERR_BOUNDS,
+    DMERR_NULLPTR,      // NULL pointer specified in critical argument
+    DMERR_NOT_SUPPORTED,// Operation not supported
+    DMERR_OUT_OF_DATA,
+    DMERR_EXTRA_DATA,
+    DMERR_BOUNDS,
 
-	DMERR_INTERNAL,
+    DMERR_INTERNAL,
 
-	// PACK-file subsystem
-	DMERR_NOTPACK,
-	DMERR_VERSION,
-	DMERR_INVALID,
-	DMERR_COMPRESSION,
+    // PACK-file subsystem
+    DMERR_NOTPACK,
+    DMERR_VERSION,
+    DMERR_INVALID,
+    DMERR_COMPRESSION,
 };
 
 
@@ -77,11 +77,11 @@
 #endif
 
 #ifndef BOOL
-#ifdef bool
-#define BOOL bool
-#else
-#define BOOL int
-#endif
+#  ifdef bool
+#    define BOOL bool
+#  else
+#    define BOOL int
+#  endif
 #endif
 
 
@@ -459,41 +459,41 @@
 /* Macros that swap only when needed ...
  */
 #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
-#    define DM_LE16_TO_NATIVE(value) DM_SWAP_16_LE_BE(value)
-#    define DM_LE32_TO_NATIVE(value) DM_SWAP_32_LE_BE(value)
-#    define DM_NATIVE_TO_LE16(value) DM_SWAP_16_LE_BE(value)
-#    define DM_NATIVE_TO_LE32(value) DM_SWAP_32_LE_BE(value)
+#  define DM_LE16_TO_NATIVE(value) DM_SWAP_16_LE_BE(value)
+#  define DM_LE32_TO_NATIVE(value) DM_SWAP_32_LE_BE(value)
+#  define DM_NATIVE_TO_LE16(value) DM_SWAP_16_LE_BE(value)
+#  define DM_NATIVE_TO_LE32(value) DM_SWAP_32_LE_BE(value)
 
-#    define DM_BE16_TO_NATIVE(value) ((Uint16) (value))
-#    define DM_BE32_TO_NATIVE(value) ((Uint32) (value))
-#    define DM_NATIVE_TO_BE16(value) ((Uint16) (value))
-#    define DM_NATIVE_TO_BE32(value) ((Uint32) (value))
+#  define DM_BE16_TO_NATIVE(value) ((Uint16) (value))
+#  define DM_BE32_TO_NATIVE(value) ((Uint32) (value))
+#  define DM_NATIVE_TO_BE16(value) ((Uint16) (value))
+#  define DM_NATIVE_TO_BE32(value) ((Uint32) (value))
 
-#    ifdef DM_HAVE_64BIT
-#        define DM_LE64_TO_NATIVE(value) DM_SWAP_64_LE_BE(value)
-#        define DM_NATIVE_TO_LE64(value) DM_SWAP_64_LE_BE(value)
-#        define DM_BE64_TO_NATIVE(value) ((Uint64) (value))
-#        define DM_NATIVE_TO_BE64(value) ((Uint64) (value))
-#    endif
+#  ifdef DM_HAVE_64BIT
+#    define DM_LE64_TO_NATIVE(value) DM_SWAP_64_LE_BE(value)
+#    define DM_NATIVE_TO_LE64(value) DM_SWAP_64_LE_BE(value)
+#    define DM_BE64_TO_NATIVE(value) ((Uint64) (value))
+#    define DM_NATIVE_TO_BE64(value) ((Uint64) (value))
+#  endif
 
 #elif (SDL_BYTEORDER == SDL_LIL_ENDIAN)
 
-#    define DM_LE16_TO_NATIVE(value) ((Uint16) (value))
-#    define DM_LE32_TO_NATIVE(value) ((Uint32) (value))
-#    define DM_NATIVE_TO_LE16(value) ((Uint16) (value))
-#    define DM_NATIVE_TO_LE32(value) ((Uint32) (value))
+#  define DM_LE16_TO_NATIVE(value) ((Uint16) (value))
+#  define DM_LE32_TO_NATIVE(value) ((Uint32) (value))
+#  define DM_NATIVE_TO_LE16(value) ((Uint16) (value))
+#  define DM_NATIVE_TO_LE32(value) ((Uint32) (value))
 
-#    define DM_BE16_TO_NATIVE(value) DM_SWAP_16_LE_BE(value)
-#    define DM_BE32_TO_NATIVE(value) DM_SWAP_32_LE_BE(value)
-#    define DM_NATIVE_TO_BE16(value) DM_SWAP_16_LE_BE(value)
-#    define DM_NATIVE_TO_BE32(value) DM_SWAP_32_LE_BE(value)
+#  define DM_BE16_TO_NATIVE(value) DM_SWAP_16_LE_BE(value)
+#  define DM_BE32_TO_NATIVE(value) DM_SWAP_32_LE_BE(value)
+#  define DM_NATIVE_TO_BE16(value) DM_SWAP_16_LE_BE(value)
+#  define DM_NATIVE_TO_BE32(value) DM_SWAP_32_LE_BE(value)
 
-#    ifdef DM_HAVE_64BIT
-#        define DM_LE64_TO_NATIVE(value) ((Uint64) (value))
-#        define DM_NATIVE_TO_LE64(value) ((Uint64) (value))
-#        define DM_BE64_TO_NATIVE(value) DM_SWAP_64_LE_BE(value)
-#        define DM_NATIVE_TO_BE64(value) DM_SWAP_64_LE_BE(value)
-#    endif
+#  ifdef DM_HAVE_64BIT
+#    define DM_LE64_TO_NATIVE(value) ((Uint64) (value))
+#    define DM_NATIVE_TO_LE64(value) ((Uint64) (value))
+#    define DM_BE64_TO_NATIVE(value) DM_SWAP_64_LE_BE(value)
+#    define DM_NATIVE_TO_BE64(value) DM_SWAP_64_LE_BE(value)
+#  endif
 #endif
 
 
--- a/dmsimple.c	Fri May 10 12:37:51 2013 +0300
+++ b/dmsimple.c	Fri May 10 12:38:07 2013 +0300
@@ -901,8 +901,8 @@
 #ifdef DM_USE_JSS
     if (engine.optAudioSetup == DM_ASETUP_JSS)
     {
-        jmpClose(engine.plr);
-        jvmClose(engine.dev);
+        jmpClose(engine.jssPlr);
+        jvmClose(engine.jssDev);
         jssClose();
     }
 #endif
--- a/tools/svg2qd.py	Fri May 10 12:37:51 2013 +0300
+++ b/tools/svg2qd.py	Fri May 10 12:38:07 2013 +0300
@@ -1,4 +1,9 @@
 #!/usr/bin/python
+#
+# Inkscape SVG to "qd" format converter
+# Programmed and designed by Matti 'ccr' Hamalainen
+# (C) Copyright 2012-2013 Tecnic Software productions (TNSP)
+#
 import sys
 import re
 import xml.etree.ElementTree as ET
@@ -78,6 +83,9 @@
       print "{}E\n".format("  "*level)
 
 
+###
+### Iterate XML document tree elements
+###
 def iterateDocument(elems, level) :
    for elem in elems:
       if elem.tag == "{http://www.w3.org/2000/svg}g" :
@@ -93,10 +101,15 @@
          printPath(elem, level)
 
 
-# Ns. paaohjelma
+###
+### The "main program"
+###
 if len(sys.argv) != 2 :
    print "Usage: "+sys.argv[0]+" <input.svg>"
    sys.exit(1)
    
+# Parse input XML to a tree
 tree = ET.parse(sys.argv[1])
+
+# Iterate through the document
 iterateDocument(tree.getroot(), 0)