smoke tests might be due to lack of mp testing
authorThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Mon, 17 Feb 2025 14:45:05 +0000 (14:45 +0000)
committerThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Mon, 17 Feb 2025 14:45:05 +0000 (14:45 +0000)
developer/python/template_N.py
tester/python/template_test_N32.py
tester/tool馃枆/makefile

index 45a4b9e..dc90aaa 100644 (file)
@@ -4,7 +4,7 @@ def N(namespace: str ,digit_type: str ,digit_extent: int ,constants_block: str)
     """
     template = template_N()
     code = template.format(
-        NAMESPACE = namespace
+        NS = namespace
         ,DIGIT_TYPE = digit_type
         ,DIGIT_EXTENT = digit_extent
         ,CONSTANTS_BLOCK = constants_block
@@ -37,18 +37,18 @@ def template_N():
 
 */
 
-#define {NAMESPACE}路DEBUG
+#define {NS}路DEBUG
 
 #ifndef FACE
-#define {NAMESPACE}路IMPLEMENTATION
+#define {NS}路IMPLEMENTATION
 #define FACE
 #endif
 
 //--------------------------------------------------------------------------------
 // Interface
 
-#ifndef {NAMESPACE}路FACE
-#define {NAMESPACE}路FACE
+#ifndef {NS}路FACE
+#define {NS}路FACE
 
   #include <stdint.h>
   #include <stdbool.h>
@@ -61,81 +61,81 @@ def template_N():
   typedef uint32_t Extent;
   typedef uint32_t Digit;
 
-  typedef struct {NAMESPACE}路T {NAMESPACE}路T;
+  typedef struct {NS}路T {NS}路T;
 
-  extern {NAMESPACE}路T *{NAMESPACE}路zero;
-  extern {NAMESPACE}路T *{NAMESPACE}路one;
-  extern {NAMESPACE}路T *{NAMESPACE}路all_one_bit;
-  extern {NAMESPACE}路T *{NAMESPACE}路lsb;
-  extern {NAMESPACE}路T *{NAMESPACE}路msb;
+  extern {NS}路T *{NS}路zero;
+  extern {NS}路T *{NS}路one;
+  extern {NS}路T *{NS}路all_one_bit;
+  extern {NS}路T *{NS}路lsb;
+  extern {NS}路T *{NS}路msb;
 
   //----------------------------------------
   // Return/Error Status and handlers
 
   typedef enum{{
-    {NAMESPACE}路Status路ok = 0
-    ,{NAMESPACE}路Status路overflow = 1
-    ,{NAMESPACE}路Status路accumulator1_overflow = 2
-    ,{NAMESPACE}路Status路carry = 3
-    ,{NAMESPACE}路Status路borrow = 4
-    ,{NAMESPACE}路Status路undefined_divide_by_zero = 5
-    ,{NAMESPACE}路Status路undefined_modulus_zero = 6
-    ,{NAMESPACE}路Status路gt_max_shift_count = 7
-    ,{NAMESPACE}路Status路spill_eq_operand = 8 // not currently signaled, result will be spill value
-    ,{NAMESPACE}路Status路one_word_product = 9
-    ,{NAMESPACE}路Status路two_word_product = 10
-  }} {NAMESPACE}路Status;
+    {NS}路Status路ok = 0
+    ,{NS}路Status路overflow = 1
+    ,{NS}路Status路accumulator1_overflow = 2
+    ,{NS}路Status路carry = 3
+    ,{NS}路Status路borrow = 4
+    ,{NS}路Status路undefined_divide_by_zero = 5
+    ,{NS}路Status路undefined_modulus_zero = 6
+    ,{NS}路Status路gt_max_shift_count = 7
+    ,{NS}路Status路spill_eq_operand = 8 // not currently signaled, result will be spill value
+    ,{NS}路Status路one_word_product = 9
+    ,{NS}路Status路two_word_product = 10
+  }} {NS}路Status;
 
   typedef enum{{
-    {NAMESPACE}路Order_lt = -1
-    ,{NAMESPACE}路Order_eq = 0
-    ,{NAMESPACE}路Order_gt = 1
-  }} {NAMESPACE}路Order;
+    {NS}路Order_lt = -1
+    ,{NS}路Order_eq = 0
+    ,{NS}路Order_gt = 1
+  }} {NS}路Order;
 
-  typedef {NAMESPACE}路T *( *{NAMESPACE}路Allocate_MemoryFault )(Extent);
+  typedef {NS}路T *( *{NS}路Allocate_MemoryFault )(Extent);
 
   //----------------------------------------
   // Interface
 
   typedef struct{{
 
-    {NAMESPACE}路T *(*allocate_array_zero)(Extent, {NAMESPACE}路Allocate_MemoryFault);
-    {NAMESPACE}路T *(*allocate_array)(Extent, {NAMESPACE}路Allocate_MemoryFault);
-    void (*deallocate)({NAMESPACE}路T*);
-
-    void (*copy)({NAMESPACE}路T*, {NAMESPACE}路T*);
-    void (*bit_and)({NAMESPACE}路T*, {NAMESPACE}路T*, {NAMESPACE}路T*);
-    void (*bit_or)({NAMESPACE}路T*, {NAMESPACE}路T*, {NAMESPACE}路T*);
-    void (*bit_complement)({NAMESPACE}路T*, {NAMESPACE}路T*);
-    void (*bit_twos_complement)({NAMESPACE}路T*, {NAMESPACE}路T*);
-    {NAMESPACE}路Order (*compare)({NAMESPACE}路T*, {NAMESPACE}路T*);
-    bool (*lt)({NAMESPACE}路T*, {NAMESPACE}路T*);
-    bool (*gt)({NAMESPACE}路T*, {NAMESPACE}路T*);
-    bool (*eq)({NAMESPACE}路T*, {NAMESPACE}路T*);
-    bool (*eq_zero)({NAMESPACE}路T*);
-    {NAMESPACE}路Status (*accumulate)({NAMESPACE}路T *accumulator1 ,{NAMESPACE}路T *accumulator0 ,...);
-    {NAMESPACE}路Status (*add)({NAMESPACE}路T*, {NAMESPACE}路T*, {NAMESPACE}路T*);
-    bool (*increment)({NAMESPACE}路T *a);
-    {NAMESPACE}路Status (*subtract)({NAMESPACE}路T*, {NAMESPACE}路T*, {NAMESPACE}路T*);
-    {NAMESPACE}路Status (*multiply)({NAMESPACE}路T*, {NAMESPACE}路T*, {NAMESPACE}路T*, {NAMESPACE}路T*);
-    {NAMESPACE}路Status (*divide)({NAMESPACE}路T*, {NAMESPACE}路T*, {NAMESPACE}路T*, {NAMESPACE}路T*);
-    {NAMESPACE}路Status (*modulus)({NAMESPACE}路T*, {NAMESPACE}路T*, {NAMESPACE}路T*);
-    {NAMESPACE}路Status (*shift_left)(Extent, {NAMESPACE}路T*, {NAMESPACE}路T*, {NAMESPACE}路T*);
-    {NAMESPACE}路Status (*shift_right)(Extent, {NAMESPACE}路T*, {NAMESPACE}路T*, {NAMESPACE}路T*);
-    {NAMESPACE}路Status (*arithmetic_shift_right)(Extent, {NAMESPACE}路T*, {NAMESPACE}路T*);
-
-    {NAMESPACE}路T* (*access)({NAMESPACE}路T*, Extent);
-    void (*from_uint32)({NAMESPACE}路T *destination ,uint32_t value);
-  }} {NAMESPACE}路螞;
-
-  Local const {NAMESPACE}路螞 {NAMESPACE}路位; // initialized in the LOCAL section
+    {NS}路T *(*allocate_array_zero)(Extent, {NS}路Allocate_MemoryFault);
+    {NS}路T *(*allocate_array)(Extent, {NS}路Allocate_MemoryFault);
+    void (*deallocate)({NS}路T*);
+
+    void (*copy)({NS}路T*, {NS}路T*);
+    void (*bit_and)({NS}路T*, {NS}路T*, {NS}路T*);
+    void (*bit_or)({NS}路T*, {NS}路T*, {NS}路T*);
+    void (*bit_complement)({NS}路T*, {NS}路T*);
+    void (*bit_twos_complement)({NS}路T*, {NS}路T*);
+    {NS}路Order (*compare)({NS}路T*, {NS}路T*);
+    bool (*lt)({NS}路T*, {NS}路T*);
+    bool (*gt)({NS}路T*, {NS}路T*);
+    bool (*eq)({NS}路T*, {NS}路T*);
+    bool (*eq_zero)({NS}路T*);
+    {NS}路Status (*accumulate)({NS}路T *accumulator1 ,{NS}路T *accumulator0 ,...);
+    {NS}路Status (*add)({NS}路T*, {NS}路T*, {NS}路T*);
+    bool (*increment)({NS}路T *a);
+    {NS}路Status (*subtract)({NS}路T*, {NS}路T*, {NS}路T*);
+    {NS}路Status (*multiply)({NS}路T*, {NS}路T*, {NS}路T*, {NS}路T*);
+    {NS}路Status (*divide)({NS}路T*, {NS}路T*, {NS}路T*, {NS}路T*);
+    {NS}路Status (*modulus)({NS}路T*, {NS}路T*, {NS}路T*);
+    {NS}路Status (*shift_left)(Extent, {NS}路T*, {NS}路T*, {NS}路T*);
+    {NS}路Status (*shift_right)(Extent, {NS}路T*, {NS}路T*, {NS}路T*);
+    {NS}路Status (*arithmetic_shift_right)(Extent, {NS}路T*, {NS}路T*);
+
+    {NS}路T* (*access)({NS}路T*, Extent);
+    void (*from_uint32)({NS}路T *destination ,uint32_t value);
+  }} {NS}路螞;
+
+  Local const {NS}路螞 {NS}路位; // initialized in the LOCAL section
 
 #endif
 
 //--------------------------------------------------------------------------------
 // Implementation
 
-#ifdef {NAMESPACE}路IMPLEMENTATION
+#ifdef {NS}路IMPLEMENTATION
 
   // this part goes into the library
   #ifndef LOCAL
@@ -143,41 +143,41 @@ def template_N():
     #include <stdarg.h>
     #include <stdlib.h>
 
-    struct {NAMESPACE}路T{{
+    struct {NS}路T{{
       Digit d0;
     }};
 
-    {NAMESPACE}路T {NAMESPACE}路constant[4] = {{
+    {NS}路T {NS}路constant[4] = {{
       {{.d0 = 0}},
       {{.d0 = 1}},
       {{.d0 = ~(uint32_t)0}},
       {{.d0 = 1 << 31}}
     }};
 
-    {NAMESPACE}路T *{NAMESPACE}路zero = &{NAMESPACE}路constant[0];
-    {NAMESPACE}路T *{NAMESPACE}路one = &{NAMESPACE}路constant[1];
-    {NAMESPACE}路T *{NAMESPACE}路all_one_bit = &{NAMESPACE}路constant[2];
-    {NAMESPACE}路T *{NAMESPACE}路msb = &{NAMESPACE}路constant[3];
-    {NAMESPACE}路T *{NAMESPACE}路lsb = &{NAMESPACE}路constant[1];
+    {NS}路T *{NS}路zero = &{NS}路constant[0];
+    {NS}路T *{NS}路one = &{NS}路constant[1];
+    {NS}路T *{NS}路all_one_bit = &{NS}路constant[2];
+    {NS}路T *{NS}路msb = &{NS}路constant[3];
+    {NS}路T *{NS}路lsb = &{NS}路constant[1];
 
     // the allocate an array of N32
-    {NAMESPACE}路T *{NAMESPACE}路allocate_array(Extent extent ,{NAMESPACE}路Allocate_MemoryFault memory_fault){{
-      {NAMESPACE}路T *instance = malloc((extent + 1) * sizeof({NAMESPACE}路T) );
+    {NS}路T *{NS}路allocate_array(Extent extent ,{NS}路Allocate_MemoryFault memory_fault){{
+      {NS}路T *instance = malloc((extent + 1) * sizeof({NS}路T) );
       if(!instance){{
         return memory_fault ? memory_fault(extent) : NULL;
       }}
       return instance;
     }}
 
-    {NAMESPACE}路T *{NAMESPACE}路allocate_array_zero(Extent extent ,{NAMESPACE}路Allocate_MemoryFault memory_fault){{
-      {NAMESPACE}路T *instance = calloc( extent + 1 ,sizeof({NAMESPACE}路T) );
+    {NS}路T *{NS}路allocate_array_zero(Extent extent ,{NS}路Allocate_MemoryFault memory_fault){{
+      {NS}路T *instance = calloc( extent + 1 ,sizeof({NS}路T) );
       if(!instance){{
         return memory_fault ? memory_fault(extent) : NULL;
       }}
       return instance;
     }}
 
-    void {NAMESPACE}路deallocate({NAMESPACE}路T *unencumbered){{
+    void {NS}路deallocate({NS}路T *unencumbered){{
       free(unencumbered);
     }}
 
@@ -188,7 +188,7 @@ def template_N():
 
     // instance
 
-    struct {NAMESPACE}路T{{
+    struct {NS}路T{{
       Digit d0;
     }};
 
@@ -197,106 +197,106 @@ def template_N():
     // allocating a block once is more efficient
     // library code writes these, they are not on the interface
 
-    Local {NAMESPACE}路T {NAMESPACE}路t[4];
+    Local {NS}路T {NS}路t[4];
 
 
     // allocation 
 
-    extern {NAMESPACE}路T *{NAMESPACE}路allocate_array(Extent, {NAMESPACE}路Allocate_MemoryFault);
-    extern {NAMESPACE}路T *{NAMESPACE}路allocate_array_zero(Extent, {NAMESPACE}路Allocate_MemoryFault);
-    extern void {NAMESPACE}路deallocate({NAMESPACE}路T *);
+    extern {NS}路T *{NS}路allocate_array(Extent, {NS}路Allocate_MemoryFault);
+    extern {NS}路T *{NS}路allocate_array_zero(Extent, {NS}路Allocate_MemoryFault);
+    extern void {NS}路deallocate({NS}路T *);
 
     // so the user can access numbers in an array allocation
-    Local {NAMESPACE}路T* {NAMESPACE}路access({NAMESPACE}路T *array ,Extent index){{
+    Local {NS}路T* {NS}路access({NS}路T *array ,Extent index){{
       return &array[index];
     }}
 
-    Local void {NAMESPACE}路from_uint32({NAMESPACE}路T *destination ,uint32_t value){{
+    Local void {NS}路from_uint32({NS}路T *destination ,uint32_t value){{
       if(destination == NULL) return;
       destination->d0 = value;
     }}
 
     // copy, convenience copy
 
-    Local void {NAMESPACE}路copy({NAMESPACE}路T *destination ,{NAMESPACE}路T *source){{
+    Local void {NS}路copy({NS}路T *destination ,{NS}路T *source){{
       if(source == destination) return; // that was easy! 
       *destination = *source;
     }}
 
-    Local void {NAMESPACE}路set_to_zero({NAMESPACE}路T *instance){{
+    Local void {NS}路set_to_zero({NS}路T *instance){{
       instance->d0 = 0;
     }}
 
-    Local void {NAMESPACE}路set_to_one({NAMESPACE}路T *instance){{
+    Local void {NS}路set_to_one({NS}路T *instance){{
       instance->d0 = 1;
     }}
 
     // bit operations
 
-    Local void {NAMESPACE}路bit_and({NAMESPACE}路T *result, {NAMESPACE}路T *a, {NAMESPACE}路T *b){{
+    Local void {NS}路bit_and({NS}路T *result, {NS}路T *a, {NS}路T *b){{
       result->d0 = a->d0 & b->d0;
     }}
 
     // result can be one of the operands
-    Local void {NAMESPACE}路bit_or({NAMESPACE}路T *result, {NAMESPACE}路T *a, {NAMESPACE}路T *b){{
+    Local void {NS}路bit_or({NS}路T *result, {NS}路T *a, {NS}路T *b){{
       result->d0 = a->d0 | b->d0;
     }}
 
     // result can the same as the operand
-    Local void {NAMESPACE}路bit_complement({NAMESPACE}路T *result, {NAMESPACE}路T *a){{
+    Local void {NS}路bit_complement({NS}路T *result, {NS}路T *a){{
       result->d0 = ~a->d0;
     }}
 
     // result can the same as the operand
-    Local void {NAMESPACE}路bit_twos_complement({NAMESPACE}路T *result ,{NAMESPACE}路T *a){{
+    Local void {NS}路bit_twos_complement({NS}路T *result ,{NS}路T *a){{
       result->d0 = ~a->d0 + 1;
     }}
 
     // test functions
 
-    Local {NAMESPACE}路Order {NAMESPACE}路compare({NAMESPACE}路T *a, {NAMESPACE}路T *b){{
-      if(a->d0 < b->d0) return {NAMESPACE}路Order_lt;
-      if(a->d0 > b->d0) return {NAMESPACE}路Order_gt;
-      return {NAMESPACE}路Order_eq;
+    Local {NS}路Order {NS}路compare({NS}路T *a, {NS}路T *b){{
+      if(a->d0 < b->d0) return {NS}路Order_lt;
+      if(a->d0 > b->d0) return {NS}路Order_gt;
+      return {NS}路Order_eq;
     }}
 
-    Local bool {NAMESPACE}路lt({NAMESPACE}路T *a ,{NAMESPACE}路T *b){{
+    Local bool {NS}路lt({NS}路T *a ,{NS}路T *b){{
       return  a->d0 < b->d0;
     }}    
 
-    Local bool {NAMESPACE}路gt({NAMESPACE}路T *a ,{NAMESPACE}路T *b){{
+    Local bool {NS}路gt({NS}路T *a ,{NS}路T *b){{
       return  a->d0 > b->d0;
     }}    
 
-    Local bool {NAMESPACE}路eq({NAMESPACE}路T *a ,{NAMESPACE}路T *b){{
+    Local bool {NS}路eq({NS}路T *a ,{NS}路T *b){{
       return  a->d0 == b->d0;
     }}    
 
-    Local bool {NAMESPACE}路eq_zero({NAMESPACE}路T *a){{
+    Local bool {NS}路eq_zero({NS}路T *a){{
       return  a->d0 == 0;
     }}    
 
 
     // arithmetic operations
 
-    // For a large number of summands for the lower precision Natural implementations, for accumulate/add/sub, the 'overflow' operand could overflow and thus this routine will halt and return {NAMESPACE}路Status路accumulator1_overflow
+    // For a large number of summands for the lower precision Natural implementations, for accumulate/add/sub, the 'overflow' operand could overflow and thus this routine will halt and return {NS}路Status路accumulator1_overflow
     //
     // When accumulator1 and accumulator0 point to the same location, the result is the accumulator1 value.
-    Local {NAMESPACE}路Status {NAMESPACE}路accumulate({NAMESPACE}路T *accumulator1 ,{NAMESPACE}路T *accumulator0 ,...){{
+    Local {NS}路Status {NS}路accumulate({NS}路T *accumulator1 ,{NS}路T *accumulator0 ,...){{
 
       va_list args;
       va_start(args ,accumulator0);
       uint32_t sum = accumulator0->d0;
       uint32_t carry = 0;
-      {NAMESPACE}路T *current;
+      {NS}路T *current;
 
-      while( (current = va_arg(args ,{NAMESPACE}路T *)) ){{
+      while( (current = va_arg(args ,{NS}路T *)) ){{
         sum += current->d0;
         if(sum < current->d0){{  // Accumulator1 into carry
           (carry)++;
           if(carry == 0){{
             va_end(args);
-            return {NAMESPACE}路Status路accumulator1_overflow;
+            return {NS}路Status路accumulator1_overflow;
           }}
         }}
       }}
@@ -305,50 +305,50 @@ def template_N():
       // wipes out prior value of accumulator1
       accumulator1->d0 = carry;
 
-      return {NAMESPACE}路Status路ok;
+      return {NS}路Status路ok;
     }}
 
-    Local {NAMESPACE}路Status {NAMESPACE}路add({NAMESPACE}路T *sum ,{NAMESPACE}路T *a ,{NAMESPACE}路T *b){{
+    Local {NS}路Status {NS}路add({NS}路T *sum ,{NS}路T *a ,{NS}路T *b){{
       uint64_t result = (uint64_t)a->d0 + (uint64_t)b->d0;
       sum->d0 = (uint32_t)result;
-      return (result >> 32) ? {NAMESPACE}路Status路carry : {NAMESPACE}路Status路ok;
+      return (result >> 32) ? {NS}路Status路carry : {NS}路Status路ok;
     }}
 
-    Local bool {NAMESPACE}路increment({NAMESPACE}路T *a){{
+    Local bool {NS}路increment({NS}路T *a){{
       a->d0++;
       return a->d0 == 0;
     }}
 
-    Local {NAMESPACE}路Status {NAMESPACE}路subtract({NAMESPACE}路T *difference ,{NAMESPACE}路T *a ,{NAMESPACE}路T *b){{
+    Local {NS}路Status {NS}路subtract({NS}路T *difference ,{NS}路T *a ,{NS}路T *b){{
       uint64_t diff = (uint64_t) a->d0 - (uint64_t) b->d0;
       difference->d0 = (uint32_t)diff;
-      return (diff > a->d0) ? {NAMESPACE}路Status路borrow : {NAMESPACE}路Status路ok;
+      return (diff > a->d0) ? {NS}路Status路borrow : {NS}路Status路ok;
     }}
 
 
-    Local {NAMESPACE}路Status {NAMESPACE}路multiply({NAMESPACE}路T *product1 ,{NAMESPACE}路T *product0 ,{NAMESPACE}路T *a ,{NAMESPACE}路T *b){{
+    Local {NS}路Status {NS}路multiply({NS}路T *product1 ,{NS}路T *product0 ,{NS}路T *a ,{NS}路T *b){{
       uint64_t product = (uint64_t)a->d0 * (uint64_t)b->d0;
       product0->d0 = (uint32_t)product;
       product1->d0 = (uint32_t)(product >> 32);
 
-      if(product1->d0 == 0) return {NAMESPACE}路Status路one_word_product;
-      return {NAMESPACE}路Status路two_word_product;
+      if(product1->d0 == 0) return {NS}路Status路one_word_product;
+      return {NS}路Status路two_word_product;
     }}
 
-    Local {NAMESPACE}路Status {NAMESPACE}路divide({NAMESPACE}路T *remainder ,{NAMESPACE}路T *quotient ,{NAMESPACE}路T *a ,{NAMESPACE}路T *b){{
-      if(b->d0 == 0) return {NAMESPACE}路Status路undefined_divide_by_zero; 
+    Local {NS}路Status {NS}路divide({NS}路T *remainder ,{NS}路T *quotient ,{NS}路T *a ,{NS}路T *b){{
+      if(b->d0 == 0) return {NS}路Status路undefined_divide_by_zero; 
 
       quotient->d0 = a->d0 / b->d0;
       remainder->d0 = a->d0 - (quotient->d0 * b->d0);
 
-      return {NAMESPACE}路Status路ok;
+      return {NS}路Status路ok;
     }}
 
-    Local {NAMESPACE}路Status {NAMESPACE}路modulus({NAMESPACE}路T *remainder ,{NAMESPACE}路T *a ,{NAMESPACE}路T *b){{
-      if(b->d0 == 0) return {NAMESPACE}路Status路undefined_modulus_zero; 
+    Local {NS}路Status {NS}路modulus({NS}路T *remainder ,{NS}路T *a ,{NS}路T *b){{
+      if(b->d0 == 0) return {NS}路Status路undefined_modulus_zero; 
       uint32_t quotient = a->d0 / b->d0;
       remainder->d0 = a->d0 - (quotient * b->d0);
-      return {NAMESPACE}路Status路ok;
+      return {NS}路Status路ok;
     }}
 
     // bit motion
@@ -365,105 +365,105 @@ def template_N():
 
     // modifies all three of its operands
     // in the case of duplicate operands this is the order: first modifies operand, then fill, then spill, 
-    Local {NAMESPACE}路Status {NAMESPACE}路shift
+    Local {NS}路Status {NS}路shift
     (
      uint32_t shift_count
-     ,{NAMESPACE}路T *spill
-     ,{NAMESPACE}路T *operand
-     ,{NAMESPACE}路T *fill
+     ,{NS}路T *spill
+     ,{NS}路T *operand
+     ,{NS}路T *fill
      ,ShiftOp shift_op
      ,ShiftOp complement_shift_op
      ){{
 
       // If no result is needed, return immediately.
-      if(operand == NULL && spill == NULL) return {NAMESPACE}路Status路ok;
+      if(operand == NULL && spill == NULL) return {NS}路Status路ok;
 
       // Treat NULL operand as zero.
       if(operand == NULL){{
-        operand = &{NAMESPACE}路t[0];
-        {NAMESPACE}路copy(operand, {NAMESPACE}路zero);
+        operand = &{NS}路t[0];
+        {NS}路copy(operand, {NS}路zero);
       }}
 
       // Shifting more than one word breaks our fill/spill model.
-      if(shift_count > 31) return {NAMESPACE}路Status路gt_max_shift_count;
+      if(shift_count > 31) return {NS}路Status路gt_max_shift_count;
 
       // The given operand is still required after it is modified, so we copy it.
-      {NAMESPACE}路T *given_operand = &{NAMESPACE}路t[1];
-      {NAMESPACE}路copy(given_operand, operand);
+      {NS}路T *given_operand = &{NS}路t[1];
+      {NS}路copy(given_operand, operand);
 
       // Perform the shift
       operand->d0 = shift_op(given_operand->d0, shift_count);
       if(fill != NULL){{
         fill->d0 = complement_shift_op(fill->d0, (32 - shift_count));
-        {NAMESPACE}路bit_or(operand, operand, fill);
+        {NS}路bit_or(operand, operand, fill);
       }}
       if(spill != NULL){{
         spill->d0 = shift_op(spill->d0, shift_count);
         spill->d0 += complement_shift_op(given_operand->d0, (32 - shift_count));
       }}
 
-      return {NAMESPACE}路Status路ok;
+      return {NS}路Status路ok;
     }}
 
     // Define concrete shift functions using valid C function pointers
-    Local {NAMESPACE}路Status 
-    {NAMESPACE}路shift_left(uint32_t shift_count, {NAMESPACE}路T *spill, {NAMESPACE}路T *operand, {NAMESPACE}路T *fill){{
-      return {NAMESPACE}路shift(shift_count, spill, operand, fill, shift_left_op, shift_right_op);
+    Local {NS}路Status 
+    {NS}路shift_left(uint32_t shift_count, {NS}路T *spill, {NS}路T *operand, {NS}路T *fill){{
+      return {NS}路shift(shift_count, spill, operand, fill, shift_left_op, shift_right_op);
     }}
 
-    Local {NAMESPACE}路Status 
-    {NAMESPACE}路shift_right(uint32_t shift_count, {NAMESPACE}路T *spill, {NAMESPACE}路T *operand, {NAMESPACE}路T *fill){{
-      return {NAMESPACE}路shift(shift_count, spill, operand, fill, shift_right_op, shift_left_op);
+    Local {NS}路Status 
+    {NS}路shift_right(uint32_t shift_count, {NS}路T *spill, {NS}路T *operand, {NS}路T *fill){{
+      return {NS}路shift(shift_count, spill, operand, fill, shift_right_op, shift_left_op);
     }}
 
-    Local {NAMESPACE}路Status 
-    {NAMESPACE}路arithmetic_shift_right(uint32_t shift_count, {NAMESPACE}路T *operand, {NAMESPACE}路T *spill){{
+    Local {NS}路Status 
+    {NS}路arithmetic_shift_right(uint32_t shift_count, {NS}路T *operand, {NS}路T *spill){{
 
       // Guard against excessive shift counts
-      if(shift_count > 31) return {NAMESPACE}路Status路gt_max_shift_count;
+      if(shift_count > 31) return {NS}路Status路gt_max_shift_count;
 
       // A NULL operand is treated as zero
       if(operand == NULL){{
-        operand = &{NAMESPACE}路t[0];
-        {NAMESPACE}路copy(operand, {NAMESPACE}路zero);
+        operand = &{NS}路t[0];
+        {NS}路copy(operand, {NS}路zero);
       }}
 
       // Pick the fill value based on the sign bit
-      {NAMESPACE}路T *fill = (operand->d0 & 0x80000000) ? {NAMESPACE}路all_one_bit : {NAMESPACE}路zero;
+      {NS}路T *fill = (operand->d0 & 0x80000000) ? {NS}路all_one_bit : {NS}路zero;
 
       // Call shift_right with the appropriate fill
-      return {NAMESPACE}路shift_right(shift_count, spill, operand, fill);
+      return {NS}路shift_right(shift_count, spill, operand, fill);
     }}
 
-    Local const {NAMESPACE}路螞 {NAMESPACE}路位 = {{
-
-      .allocate_array = {NAMESPACE}路allocate_array
-      ,.allocate_array_zero = {NAMESPACE}路allocate_array_zero
-      ,.deallocate = {NAMESPACE}路deallocate
-
-      ,.copy = {NAMESPACE}路copy
-      ,.bit_and = {NAMESPACE}路bit_and
-      ,.bit_or = {NAMESPACE}路bit_or
-      ,.bit_complement = {NAMESPACE}路bit_complement
-      ,.bit_twos_complement = {NAMESPACE}路bit_twos_complement
-      ,.compare = {NAMESPACE}路compare
-      ,.lt = {NAMESPACE}路lt
-      ,.gt = {NAMESPACE}路gt
-      ,.eq = {NAMESPACE}路eq
-      ,.eq_zero = {NAMESPACE}路eq_zero
-      ,.accumulate = {NAMESPACE}路accumulate
-      ,.add = {NAMESPACE}路add
-      ,.increment = {NAMESPACE}路increment
-      ,.subtract = {NAMESPACE}路subtract
-      ,.multiply = {NAMESPACE}路multiply
-      ,.divide = {NAMESPACE}路divide
-      ,.modulus = {NAMESPACE}路modulus
-      ,.shift_left = {NAMESPACE}路shift_left
-      ,.shift_right = {NAMESPACE}路shift_right
-      ,.arithmetic_shift_right = {NAMESPACE}路arithmetic_shift_right
-
-      ,.access = {NAMESPACE}路access
-      ,.from_uint32 = {NAMESPACE}路from_uint32
+    Local const {NS}路螞 {NS}路位 = {{
+
+      .allocate_array = {NS}路allocate_array
+      ,.allocate_array_zero = {NS}路allocate_array_zero
+      ,.deallocate = {NS}路deallocate
+
+      ,.copy = {NS}路copy
+      ,.bit_and = {NS}路bit_and
+      ,.bit_or = {NS}路bit_or
+      ,.bit_complement = {NS}路bit_complement
+      ,.bit_twos_complement = {NS}路bit_twos_complement
+      ,.compare = {NS}路compare
+      ,.lt = {NS}路lt
+      ,.gt = {NS}路gt
+      ,.eq = {NS}路eq
+      ,.eq_zero = {NS}路eq_zero
+      ,.accumulate = {NS}路accumulate
+      ,.add = {NS}路add
+      ,.increment = {NS}路increment
+      ,.subtract = {NS}路subtract
+      ,.multiply = {NS}路multiply
+      ,.divide = {NS}路divide
+      ,.modulus = {NS}路modulus
+      ,.shift_left = {NS}路shift_left
+      ,.shift_right = {NS}路shift_right
+      ,.arithmetic_shift_right = {NS}路arithmetic_shift_right
+
+      ,.access = {NS}路access
+      ,.from_uint32 = {NS}路from_uint32
     }};
 
   #endif
index e2211d4..7d26285 100644 (file)
@@ -1,4 +1,4 @@
-# {NAMESPACE} must be a N32 type.
+# {NS} must be a N32 type.
 #
 # test_N32 can be used to test any 32 bit natural number types. As examples: N32PN the processor native type; N32_4_by_8 a 32 bit natural number type made of 4 digits, where each digit is 8 bits.
 #
@@ -9,7 +9,7 @@ def test_N32(namespace: str) -> str:
     """
     template = template_test_N32()
     code = template.format(
-        NAMESPACE = namespace
+        NS = namespace
     )
     return code
 
@@ -21,7 +21,7 @@ def template_test_N32():
 
 // Enable interface section
 #define FACE
-#include "{NAMESPACE}.lib.c"
+#include "{NS}.lib.c"
 #undef FACE
 
 // Jump buffer for signal handling
@@ -97,285 +97,285 @@ int main(int argc ,char **argv){{
 
 bool test_copy(){{
   // Allocate memory
-  {NAMESPACE}路T *array = {NAMESPACE}路位.allocate_array(2 ,NULL);
+  {NS}路T *array = {NS}路位.allocate_array(2 ,NULL);
   if( !array ) return false;
 
   // Access elements via access function
-  {NAMESPACE}路T *a = {NAMESPACE}路位.access(array ,0);
-  {NAMESPACE}路T *b = {NAMESPACE}路位.access(array ,1);
+  {NS}路T *a = {NS}路位.access(array ,0);
+  {NS}路T *b = {NS}路位.access(array ,1);
 
   // Assign value and copy
-  {NAMESPACE}路位.from_uint32(a ,42);
-  {NAMESPACE}路位.copy(b ,a);
+  {NS}路位.from_uint32(a ,42);
+  {NS}路位.copy(b ,a);
 
-  bool success = ( {NAMESPACE}路位.compare(b ,a) == {NAMESPACE}路Order_eq );
-  {NAMESPACE}路位.deallocate(array);
+  bool success = ( {NS}路位.compare(b ,a) == {NS}路Order_eq );
+  {NS}路位.deallocate(array);
   return success;
 }}
 
 bool test_arithmetic(){{
   // Allocate memory
-  {NAMESPACE}路T *array = {NAMESPACE}路位.allocate_array(3 ,NULL);
+  {NS}路T *array = {NS}路位.allocate_array(3 ,NULL);
   if( !array ) return false;
 
-  {NAMESPACE}路T *a = {NAMESPACE}路位.access(array ,0);
-  {NAMESPACE}路T *b = {NAMESPACE}路位.access(array ,1);
-  {NAMESPACE}路T *result = {NAMESPACE}路位.access(array ,2);
+  {NS}路T *a = {NS}路位.access(array ,0);
+  {NS}路T *b = {NS}路位.access(array ,1);
+  {NS}路T *result = {NS}路位.access(array ,2);
 
-  {NAMESPACE}路位.from_uint32(a ,20);
-  {NAMESPACE}路位.from_uint32(b ,22);
+  {NS}路位.from_uint32(a ,20);
+  {NS}路位.from_uint32(b ,22);
 
-  if( {NAMESPACE}路位.add(result ,a ,b) != {NAMESPACE}路Status路ok ) return false;
-  if( {NAMESPACE}路位.compare(result ,{NAMESPACE}路位.access(array ,0)) != {NAMESPACE}路Order_gt ) return false;
+  if( {NS}路位.add(result ,a ,b) != {NS}路Status路ok ) return false;
+  if( {NS}路位.compare(result ,{NS}路位.access(array ,0)) != {NS}路Order_gt ) return false;
 
-  if( {NAMESPACE}路位.subtract(result ,b ,a) != {NAMESPACE}路Status路ok ) return false;
-  if( {NAMESPACE}路位.compare(result ,{NAMESPACE}路位.access(array ,0)) != {NAMESPACE}路Order_lt ) return false;
+  if( {NS}路位.subtract(result ,b ,a) != {NS}路Status路ok ) return false;
+  if( {NS}路位.compare(result ,{NS}路位.access(array ,0)) != {NS}路Order_lt ) return false;
 
-  {NAMESPACE}路位.deallocate(array);
+  {NS}路位.deallocate(array);
   return true;
 }}
 
 bool test_bitwise_operations(){{
   // Allocate memory
-  {NAMESPACE}路T *array = {NAMESPACE}路位.allocate_array(3, NULL);
+  {NS}路T *array = {NS}路位.allocate_array(3, NULL);
   if(!array) return false;
 
-  {NAMESPACE}路T *a = {NAMESPACE}路位.access(array, 0);
-  {NAMESPACE}路T *b = {NAMESPACE}路位.access(array, 1);
-  {NAMESPACE}路T *result = {NAMESPACE}路位.access(array, 2);
+  {NS}路T *a = {NS}路位.access(array, 0);
+  {NS}路T *b = {NS}路位.access(array, 1);
+  {NS}路T *result = {NS}路位.access(array, 2);
 
   // a = 0x0F0F0F0F, b = 0xF0F0F0F0
-  {NAMESPACE}路位.from_uint32(a, 0x0F0F0F0F);
-  {NAMESPACE}路位.from_uint32(b, 0xF0F0F0F0);
+  {NS}路位.from_uint32(a, 0x0F0F0F0F);
+  {NS}路位.from_uint32(b, 0xF0F0F0F0);
 
   // bit_and => expect 0x00000000
-  {NAMESPACE}路位.bit_and(result, a, b);
-  {NAMESPACE}路位.from_uint32(a, 0x00000000);
-  if({NAMESPACE}路位.compare(result, a) != {NAMESPACE}路Order_eq){{
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.bit_and(result, a, b);
+  {NS}路位.from_uint32(a, 0x00000000);
+  if({NS}路位.compare(result, a) != {NS}路Order_eq){{
+    {NS}路位.deallocate(array);
     return false;
   }}
 
   // Reset a to 0x0F0F0F0F for next tests
-  {NAMESPACE}路位.from_uint32(a, 0x0F0F0F0F);
+  {NS}路位.from_uint32(a, 0x0F0F0F0F);
 
   // bit_or => expect 0xFFFFFFFF
-  {NAMESPACE}路位.bit_or(result, a, b);
-  {NAMESPACE}路位.from_uint32(b, 0xFFFFFFFF);
-  if({NAMESPACE}路位.compare(result, b) != {NAMESPACE}路Order_eq){{
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.bit_or(result, a, b);
+  {NS}路位.from_uint32(b, 0xFFFFFFFF);
+  if({NS}路位.compare(result, b) != {NS}路Order_eq){{
+    {NS}路位.deallocate(array);
     return false;
   }}
 
   // bit_complement(a=0x0F0F0F0F) => expect 0xF0F0F0F0
-  {NAMESPACE}路位.from_uint32(a, 0x0F0F0F0F);
-  {NAMESPACE}路位.bit_complement(result, a);
-  {NAMESPACE}路位.from_uint32(b, 0xF0F0F0F0);
-  if({NAMESPACE}路位.compare(result, b) != {NAMESPACE}路Order_eq){{
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.from_uint32(a, 0x0F0F0F0F);
+  {NS}路位.bit_complement(result, a);
+  {NS}路位.from_uint32(b, 0xF0F0F0F0);
+  if({NS}路位.compare(result, b) != {NS}路Order_eq){{
+    {NS}路位.deallocate(array);
     return false;
   }}
 
   // bit_twos_complement(a=0x0F0F0F0F) => expect 0xF0F0F0F1
-  {NAMESPACE}路位.from_uint32(a, 0x0F0F0F0F);
-  {NAMESPACE}路位.bit_twos_complement(result, a);
-  {NAMESPACE}路位.from_uint32(b, 0xF0F0F0F1);
-  if({NAMESPACE}路位.compare(result, b) != {NAMESPACE}路Order_eq){{
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.from_uint32(a, 0x0F0F0F0F);
+  {NS}路位.bit_twos_complement(result, a);
+  {NS}路位.from_uint32(b, 0xF0F0F0F1);
+  if({NS}路位.compare(result, b) != {NS}路Order_eq){{
+    {NS}路位.deallocate(array);
     return false;
   }}
 
-  {NAMESPACE}路位.deallocate(array);
+  {NS}路位.deallocate(array);
   return true;
 }}
 
 bool test_comparisons(){{
   // Allocate memory
-  {NAMESPACE}路T *array = {NAMESPACE}路位.allocate_array(3, NULL);
+  {NS}路T *array = {NS}路位.allocate_array(3, NULL);
   if(!array) return false;
 
-  {NAMESPACE}路T *a = {NAMESPACE}路位.access(array, 0);
-  {NAMESPACE}路T *b = {NAMESPACE}路位.access(array, 1);
-  {NAMESPACE}路T *c = {NAMESPACE}路位.access(array, 2);
+  {NS}路T *a = {NS}路位.access(array, 0);
+  {NS}路T *b = {NS}路位.access(array, 1);
+  {NS}路T *c = {NS}路位.access(array, 2);
 
   // First set: a=0, b=42, c=42
-  {NAMESPACE}路位.from_uint32(a, 0);
-  {NAMESPACE}路位.from_uint32(b, 42);
-  {NAMESPACE}路位.from_uint32(c, 42);
+  {NS}路位.from_uint32(a, 0);
+  {NS}路位.from_uint32(b, 42);
+  {NS}路位.from_uint32(c, 42);
 
   // eq_zero(a) => true
-  if(!{NAMESPACE}路位.eq_zero(a)){{
-    {NAMESPACE}路位.deallocate(array);
+  if(!{NS}路位.eq_zero(a)){{
+    {NS}路位.deallocate(array);
     return false;
   }}
   // eq_zero(b) => false
-  if({NAMESPACE}路位.eq_zero(b)){{
-    {NAMESPACE}路位.deallocate(array);
+  if({NS}路位.eq_zero(b)){{
+    {NS}路位.deallocate(array);
     return false;
   }}
   // eq(b, c) => true
-  if(!{NAMESPACE}路位.eq(b, c)){{
-    {NAMESPACE}路位.deallocate(array);
+  if(!{NS}路位.eq(b, c)){{
+    {NS}路位.deallocate(array);
     return false;
   }}
   // eq(a, b) => false
-  if({NAMESPACE}路位.eq(a, b)){{
-    {NAMESPACE}路位.deallocate(array);
+  if({NS}路位.eq(a, b)){{
+    {NS}路位.deallocate(array);
     return false;
   }}
-  // compare(a, b) => {NAMESPACE}路Order_lt
-  if({NAMESPACE}路位.compare(a, b) != {NAMESPACE}路Order_lt){{
-    {NAMESPACE}路位.deallocate(array);
+  // compare(a, b) => {NS}路Order_lt
+  if({NS}路位.compare(a, b) != {NS}路Order_lt){{
+    {NS}路位.deallocate(array);
     return false;
   }}
-  // compare(b, a) => {NAMESPACE}路Order_gt
-  if({NAMESPACE}路位.compare(b, a) != {NAMESPACE}路Order_gt){{
-    {NAMESPACE}路位.deallocate(array);
+  // compare(b, a) => {NS}路Order_gt
+  if({NS}路位.compare(b, a) != {NS}路Order_gt){{
+    {NS}路位.deallocate(array);
     return false;
   }}
-  // compare(b, c) => {NAMESPACE}路Order_eq
-  if({NAMESPACE}路位.compare(b, c) != {NAMESPACE}路Order_eq){{
-    {NAMESPACE}路位.deallocate(array);
+  // compare(b, c) => {NS}路Order_eq
+  if({NS}路位.compare(b, c) != {NS}路Order_eq){{
+    {NS}路位.deallocate(array);
     return false;
   }}
   // lt(a, b) => true, gt(b, a) => true
-  if(!{NAMESPACE}路位.lt(a, b) || !{NAMESPACE}路位.gt(b, a)){{
-    {NAMESPACE}路位.deallocate(array);
+  if(!{NS}路位.lt(a, b) || !{NS}路位.gt(b, a)){{
+    {NS}路位.deallocate(array);
     return false;
   }}
 
   // Second set: a=100, b=50
-  {NAMESPACE}路位.from_uint32(a, 100);
-  {NAMESPACE}路位.from_uint32(b, 50);
-  if({NAMESPACE}路位.compare(a, b) != {NAMESPACE}路Order_gt){{
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.from_uint32(a, 100);
+  {NS}路位.from_uint32(b, 50);
+  if({NS}路位.compare(a, b) != {NS}路Order_gt){{
+    {NS}路位.deallocate(array);
     return false;
   }}
   // eq_zero(a) => false
-  if({NAMESPACE}路位.eq_zero(a)){{
-    {NAMESPACE}路位.deallocate(array);
+  if({NS}路位.eq_zero(a)){{
+    {NS}路位.deallocate(array);
     return false;
   }}
   // eq_zero(b) => false
-  if({NAMESPACE}路位.eq_zero(b)){{
-    {NAMESPACE}路位.deallocate(array);
+  if({NS}路位.eq_zero(b)){{
+    {NS}路位.deallocate(array);
     return false;
   }}
 
-  {NAMESPACE}路位.deallocate(array);
+  {NS}路位.deallocate(array);
   return true;
 }}
 
 bool test_shifts(){{
   // Allocate memory for operand, fill, spill
-  {NAMESPACE}路T *array = {NAMESPACE}路位.allocate_array(3, NULL);
+  {NS}路T *array = {NS}路位.allocate_array(3, NULL);
   if(!array) return false;
 
-  {NAMESPACE}路T *operand = {NAMESPACE}路位.access(array, 0);
-  {NAMESPACE}路T *fill    = {NAMESPACE}路位.access(array, 1);
-  {NAMESPACE}路T *spill   = {NAMESPACE}路位.access(array, 2);
+  {NS}路T *operand = {NS}路位.access(array, 0);
+  {NS}路T *fill    = {NS}路位.access(array, 1);
+  {NS}路T *spill   = {NS}路位.access(array, 2);
 
   // Subtest A: shift_left(4) with operand=1 => expect operand=16, fill=0, spill=0
-  {NAMESPACE}路位.from_uint32(operand, 1);
-  {NAMESPACE}路位.from_uint32(fill, 0);
-  {NAMESPACE}路位.from_uint32(spill, 0);
-  if({NAMESPACE}路位.shift_left(4, spill, operand, fill) != {NAMESPACE}路Status路ok){{
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.from_uint32(operand, 1);
+  {NS}路位.from_uint32(fill, 0);
+  {NS}路位.from_uint32(spill, 0);
+  if({NS}路位.shift_left(4, spill, operand, fill) != {NS}路Status路ok){{
+    {NS}路位.deallocate(array);
     return false;
   }}
-  {NAMESPACE}路T *temp = {NAMESPACE}路位.allocate_array(1, NULL);
+  {NS}路T *temp = {NS}路位.allocate_array(1, NULL);
   if(!temp){{
-    {NAMESPACE}路位.deallocate(array);
+    {NS}路位.deallocate(array);
     return false;
   }}
-  {NAMESPACE}路位.from_uint32(temp, 16);
-  if({NAMESPACE}路位.compare(operand, temp) != {NAMESPACE}路Order_eq){{
-    {NAMESPACE}路位.deallocate(temp);
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.from_uint32(temp, 16);
+  if({NS}路位.compare(operand, temp) != {NS}路Order_eq){{
+    {NS}路位.deallocate(temp);
+    {NS}路位.deallocate(array);
     return false;
   }}
-  if({NAMESPACE}路位.compare(fill, {NAMESPACE}路zero) != {NAMESPACE}路Order_eq){{
-    {NAMESPACE}路位.deallocate(temp);
-    {NAMESPACE}路位.deallocate(array);
+  if({NS}路位.compare(fill, {NS}路zero) != {NS}路Order_eq){{
+    {NS}路位.deallocate(temp);
+    {NS}路位.deallocate(array);
     return false;
   }}
-  if({NAMESPACE}路位.compare(spill, {NAMESPACE}路zero) != {NAMESPACE}路Order_eq){{
-    {NAMESPACE}路位.deallocate(temp);
-    {NAMESPACE}路位.deallocate(array);
+  if({NS}路位.compare(spill, {NS}路zero) != {NS}路Order_eq){{
+    {NS}路位.deallocate(temp);
+    {NS}路位.deallocate(array);
     return false;
   }}
 
   // Subtest B: shift_left(1) with operand=0x80000000 => expect operand=0, spill=1
-  {NAMESPACE}路位.from_uint32(operand, 0x80000000);
-  {NAMESPACE}路位.from_uint32(fill, 0);
-  {NAMESPACE}路位.from_uint32(spill, 0);
-  if({NAMESPACE}路位.shift_left(1, spill, operand, fill) != {NAMESPACE}路Status路ok){{
-    {NAMESPACE}路位.deallocate(temp);
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.from_uint32(operand, 0x80000000);
+  {NS}路位.from_uint32(fill, 0);
+  {NS}路位.from_uint32(spill, 0);
+  if({NS}路位.shift_left(1, spill, operand, fill) != {NS}路Status路ok){{
+    {NS}路位.deallocate(temp);
+    {NS}路位.deallocate(array);
     return false;
   }}
-  if(!{NAMESPACE}路位.eq_zero(operand)){{
-    {NAMESPACE}路位.deallocate(temp);
-    {NAMESPACE}路位.deallocate(array);
+  if(!{NS}路位.eq_zero(operand)){{
+    {NS}路位.deallocate(temp);
+    {NS}路位.deallocate(array);
     return false;
   }}
-  {NAMESPACE}路位.from_uint32(temp, 1);
-  if({NAMESPACE}路位.compare(spill, temp) != {NAMESPACE}路Order_eq){{
-    {NAMESPACE}路位.deallocate(temp);
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.from_uint32(temp, 1);
+  if({NS}路位.compare(spill, temp) != {NS}路Order_eq){{
+    {NS}路位.deallocate(temp);
+    {NS}路位.deallocate(array);
     return false;
   }}
 
   // Subtest C: shift_right(1) with operand=0x80000000 => expect operand=0x40000000, spill=0
-  {NAMESPACE}路位.from_uint32(operand, 0x80000000);
-  {NAMESPACE}路位.from_uint32(fill, 0);
-  {NAMESPACE}路位.from_uint32(spill, 0);
-  if({NAMESPACE}路位.shift_right(1, spill, operand, fill) != {NAMESPACE}路Status路ok){{
-    {NAMESPACE}路位.deallocate(temp);
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.from_uint32(operand, 0x80000000);
+  {NS}路位.from_uint32(fill, 0);
+  {NS}路位.from_uint32(spill, 0);
+  if({NS}路位.shift_right(1, spill, operand, fill) != {NS}路Status路ok){{
+    {NS}路位.deallocate(temp);
+    {NS}路位.deallocate(array);
     return false;
   }}
-  {NAMESPACE}路位.from_uint32(temp, 0x40000000);
-  if({NAMESPACE}路位.compare(operand, temp) != {NAMESPACE}路Order_eq){{
-    {NAMESPACE}路位.deallocate(temp);
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.from_uint32(temp, 0x40000000);
+  if({NS}路位.compare(operand, temp) != {NS}路Order_eq){{
+    {NS}路位.deallocate(temp);
+    {NS}路位.deallocate(array);
     return false;
   }}
-  if(!{NAMESPACE}路位.eq_zero(spill)){{
-    {NAMESPACE}路位.deallocate(temp);
-    {NAMESPACE}路位.deallocate(array);
+  if(!{NS}路位.eq_zero(spill)){{
+    {NS}路位.deallocate(temp);
+    {NS}路位.deallocate(array);
     return false;
   }}
 
   // Subtest D: arithmetic_shift_right(1) with operand=0x80000000 => expect operand=0xC0000000, spill=0
-  {NAMESPACE}路位.from_uint32(operand, 0x80000000);
-  {NAMESPACE}路位.from_uint32(spill, 0);
-  if({NAMESPACE}路位.arithmetic_shift_right(1, operand, spill) != {NAMESPACE}路Status路ok){{
-    {NAMESPACE}路位.deallocate(temp);
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.from_uint32(operand, 0x80000000);
+  {NS}路位.from_uint32(spill, 0);
+  if({NS}路位.arithmetic_shift_right(1, operand, spill) != {NS}路Status路ok){{
+    {NS}路位.deallocate(temp);
+    {NS}路位.deallocate(array);
     return false;
   }}
-  {NAMESPACE}路位.from_uint32(temp, 0xC0000000);
-  if({NAMESPACE}路位.compare(operand, temp) != {NAMESPACE}路Order_eq){{
-    {NAMESPACE}路位.deallocate(temp);
-    {NAMESPACE}路位.deallocate(array);
+  {NS}路位.from_uint32(temp, 0xC0000000);
+  if({NS}路位.compare(operand, temp) != {NS}路Order_eq){{
+    {NS}路位.deallocate(temp);
+    {NS}路位.deallocate(array);
     return false;
   }}
-  if(!{NAMESPACE}路位.eq_zero(spill)){{
-    {NAMESPACE}路位.deallocate(temp);
-    {NAMESPACE}路位.deallocate(array);
+  if(!{NS}路位.eq_zero(spill)){{
+    {NS}路位.deallocate(temp);
+    {NS}路位.deallocate(array);
     return false;
   }}
 
-  {NAMESPACE}路位.deallocate(temp);
-  {NAMESPACE}路位.deallocate(array);
+  {NS}路位.deallocate(temp);
+  {NS}路位.deallocate(array);
   return true;
 }}
 
 
 
-// Include the local section of {NAMESPACE}.lib.c for testing
+// Include the local section of {NS}.lib.c for testing
 #define LOCAL
-#include "{NAMESPACE}.lib.c"
+#include "{NS}.lib.c"
 #undef LOCAL
 '''
index 9b933d5..99161fd 100644 (file)
@@ -3,7 +3,7 @@ RT-INCOMMON:=$(REPO_HOME)/tool_shared/third_party/RT-project-share/release
 
 include $(RT-INCOMMON)/make/environment_RT_0
 
-CFLAGS+=-Werror -include "$(RT-INCOMMON)/make/RT_0.h"
+CFLAGS+= -g -O0 -Werror -include "$(RT-INCOMMON)/make/RT_0.h"
 LINKFLAGS+= -l$(PROJECT)
 LIBFILE=$(LIBDIR)/lib$(PROJECT).a