checkpoint on RT_gcc_16 integration
authorThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Fri, 2 May 2025 08:05:56 +0000 (08:05 +0000)
committerThomas Walker Lynch <eknp9n@reasoningtechnology.com>
Fri, 2 May 2025 08:05:56 +0000 (08:05 +0000)
developer/experiment/try_assign.c [new file with mode: 0644]
developer/experiment/try_assign_0.c [new file with mode: 0644]
developer/experiment/try_assign_1.c [new file with mode: 0644]
developer/experiment/try_assign_1.make [new file with mode: 0644]
tool_shared/bespokeđź–‰/env
tool_shared/customized/RT_gcc_16 [new symlink]
tool_shared/customized/install [deleted symlink]
tool_shared/documentđź–‰/install.txt

diff --git a/developer/experiment/try_assign.c b/developer/experiment/try_assign.c
new file mode 100644 (file)
index 0000000..959144a
--- /dev/null
@@ -0,0 +1,34 @@
+#include <stdio.h>
+
+// Helper to stringify a macro argument
+#define STR(x) #x
+#define SHOW(x) STR(x)
+
+#define BAD(x ,y) x + y
+#assign (Z ,12)
+//#xassign (Z ,12)  // invalid directive
+
+// Macros to test argument parsing and expansion
+#define ZERO()         SHOW(ZERO())
+#define ONE(x)         SHOW(ONE(x))
+#define TWO(x ,y)      SHOW(TWO(x ,y))
+#define VAR(...)       SHOW(VAR(__VA_ARGS__))
+#define MIXED(x ,...)  SHOW(MIXED(x ,__VA_ARGS__))
+
+int main() {
+  int x = BAD(1 ,2);   // should work
+  printf("x:%x\n" ,x);
+
+  // int y = BAD(1 ,2 ,3);   // Too many args
+  printf("%s\n" ,ZERO());                   // "ZERO()"
+  printf("%s\n" ,ONE(42));                  // "ONE(42)"
+  printf("%s\n" ,TWO(a ,b));                // "TWO(a ,b)"
+  printf("%s\n" ,VAR());                    // "VAR()"
+  printf("%s\n" ,VAR(1));                   // "VAR(1)"
+  printf("%s\n" ,VAR(1 ,2 ,3));             // "VAR(1 ,2 ,3)"
+  printf("%s\n" ,MIXED(0));                 // "MIXED(0)"
+  printf("%s\n" ,MIXED(x ,y ,z));           // "MIXED(x ,y ,z)"
+  printf("%s\n" ,ONE((1 ,2)));              // "ONE((1 ,2))"
+  printf("%s\n" ,VAR((a ,b) ,c));           // "VAR((a ,b) ,c)"
+  return 0;
+}
diff --git a/developer/experiment/try_assign_0.c b/developer/experiment/try_assign_0.c
new file mode 100644 (file)
index 0000000..959144a
--- /dev/null
@@ -0,0 +1,34 @@
+#include <stdio.h>
+
+// Helper to stringify a macro argument
+#define STR(x) #x
+#define SHOW(x) STR(x)
+
+#define BAD(x ,y) x + y
+#assign (Z ,12)
+//#xassign (Z ,12)  // invalid directive
+
+// Macros to test argument parsing and expansion
+#define ZERO()         SHOW(ZERO())
+#define ONE(x)         SHOW(ONE(x))
+#define TWO(x ,y)      SHOW(TWO(x ,y))
+#define VAR(...)       SHOW(VAR(__VA_ARGS__))
+#define MIXED(x ,...)  SHOW(MIXED(x ,__VA_ARGS__))
+
+int main() {
+  int x = BAD(1 ,2);   // should work
+  printf("x:%x\n" ,x);
+
+  // int y = BAD(1 ,2 ,3);   // Too many args
+  printf("%s\n" ,ZERO());                   // "ZERO()"
+  printf("%s\n" ,ONE(42));                  // "ONE(42)"
+  printf("%s\n" ,TWO(a ,b));                // "TWO(a ,b)"
+  printf("%s\n" ,VAR());                    // "VAR()"
+  printf("%s\n" ,VAR(1));                   // "VAR(1)"
+  printf("%s\n" ,VAR(1 ,2 ,3));             // "VAR(1 ,2 ,3)"
+  printf("%s\n" ,MIXED(0));                 // "MIXED(0)"
+  printf("%s\n" ,MIXED(x ,y ,z));           // "MIXED(x ,y ,z)"
+  printf("%s\n" ,ONE((1 ,2)));              // "ONE((1 ,2))"
+  printf("%s\n" ,VAR((a ,b) ,c));           // "VAR((a ,b) ,c)"
+  return 0;
+}
diff --git a/developer/experiment/try_assign_1.c b/developer/experiment/try_assign_1.c
new file mode 100644 (file)
index 0000000..b99c08d
--- /dev/null
@@ -0,0 +1,25 @@
+#include <stdio.h>
+
+// Static macros
+#define VALUE 42
+#define OTHER 99
+#define JOIN(a, b) a##b
+#define SUFFIX ID
+
+// Symbolic macro name and value
+#define NAME myvar
+
+// Assign dynamically: #define myvar 42
+#assign(NAME, VALUE)
+
+// Assign dynamically: #define pre_ID 99
+#assign(JOIN(pre_, SUFFIX), OTHER)
+
+int main(void)
+{
+    // Check that macros were defined
+    printf("myvar: %d\n", myvar);         // Should print 42
+    printf("pre_ID: %d\n", pre_ID);       // Should print 99
+
+    return 0;
+}
diff --git a/developer/experiment/try_assign_1.make b/developer/experiment/try_assign_1.make
new file mode 100644 (file)
index 0000000..79a4fc5
--- /dev/null
@@ -0,0 +1,19 @@
+1. To see preprocessor output:
+
+gcc -E try_assign.c
+
+You should see:
+
+#define myvar 42
+#define pre_ID 99
+
+2. To compile and run:
+
+gcc try_assign.c -o try_assign
+./try_assign
+
+Expected output:
+
+myvar: 42
+pre_ID: 99
+
index 6e4e025..449d8a6 100644 (file)
@@ -32,37 +32,41 @@ shopt -s nullglob
   export REPO_HOME PROJECT PROMPT_DECOR
 
 # --------------------------------------------------------------------------------
-# tool chain
+# RT_gcc_16
+#  note also PATH entry
+
+  export RT_gcc_16=/home/Thomas/subu_data/developer/N/tool_shared/customized/RT_gcc_16
+  export LIBRARY_PATH=$RT_gcc_16/lib
+  export C_INCLUDE_PATH=$RT_gcc_16/include
+  export LD_LIBRARY_PATH=$RT_gcc_16/lib
+
+# --------------------------------------------------------------------------------
+# Other Tool roots
 #
+  export JAVA_HOME="$REPO_HOME/tool_shared/third_party/jdk-23.0.1"
+  export MOSAIC_HOME="$REPO_HOME/tool_shared/third_party/Mosaic"
+
+
+# --------------------------------------------------------------------------------
+# PATH
+#   precedence: last defined, first discovered
+  
   PATH="$REPO_HOME/tool_shared/third_party/RT-project-share/release/bash:$PATH"
   PATH="$REPO_HOME/tool_shared/third_party/RT-project-share/release/amd64:$PATH"
   PATH="$REPO_HOME/tool_shared/third_party/emacs/bin:$PATH"
   PATH="$REPO_HOME/tool_shared/third_party/idea-IC-243.21565.193/bin:$PATH"
   PATH="$REPO_HOME/tool_shared/third_party:$PATH"
-
-  gcc_16=/home/Thomas/subu_data/developer/N/tool_shared/customized/gcc_16
-  PATH="$gcc_16":"$PATH"
-
+  PATH="$RT_gcc_16":"$PATH"
   PATH="$REPO_HOME/tool_shared/customized:$PATH"
   PATH="$REPO_HOME"/tool_shared/bespokeđź–‰:"$PATH"
 
-  # Remove duplicates and export path
+  # Remove duplicates
   clean_path() {
     PATH=$(echo ":$PATH" | awk -v RS=: -v ORS=: '!seen[$0]++' | sed 's/^://; s/:$//')
   }
   clean_path
   export PATH
 
-  # Toolchain roots
-  export JAVA_HOME="$REPO_HOME/tool_shared/third_party/jdk-23.0.1"
-  export MOSAIC_HOME="$REPO_HOME/tool_shared/third_party/Mosaic"
-
-  // for the customized gcc/cpp
-  export LIBRARY_PATH=$gcc_16/lib
-  export C_INCLUDE_PATH=$gcc_16/include
-  export LD_LIBRARY_PATH=$gcc_16/lib
-
-
 # --------------------------------------------------------------------------------
 # the following functions are provided for other scripts to use.
 # at the top of files that make use of these functions put the following line:
diff --git a/tool_shared/customized/RT_gcc_16 b/tool_shared/customized/RT_gcc_16
new file mode 120000 (symlink)
index 0000000..1fd2c65
--- /dev/null
@@ -0,0 +1 @@
+/home/Thomas/subu_data/developer/RT_gcc_16/install
\ No newline at end of file
diff --git a/tool_shared/customized/install b/tool_shared/customized/install
deleted file mode 120000 (symlink)
index 9028162..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/Thomas/subu_data/developer/pragma_macro/install
\ No newline at end of file
index b3b03b8..4f24c15 100644 (file)
@@ -47,16 +47,16 @@ gcc
     make sure `pragma_macro` project is installed and built. This provides gcc
     to multiple projects, so it is at the top level   ~/pragma_macro.
 
-    gcc_16=/home/Thomas/subu_data/developer/N/tool_shared/customized/gcc_16
 
-    cd $REPO_HOME/tool_shared/customized
-    ln -s /home/Thomas/subu_data/developer/pragma_macro/install $gcc_16
+    RT_gcc_16=/home/Thomas/subu_data/developer/N/tool_shared/customized/RT_gcc_16
 
-    place in bespokeđź–‰/env:
-      export PATH=$gcc_16:$PATH
-      export LIBRARY_PATH=$gcc_16/lib
-      export C_INCLUDE_PATH=$gcc_16/include
-      export LD_LIBRARY_PATH=$gcc_16/lib
+    ln -s /home/Thomas/subu_data/developer/RT_gcc_16/install $RT_gcc_16
+
+      PATH="$RT_gcc_16":"$PATH"
+      export PATH=$RT_gcc_16:$PATH
+      export LIBRARY_PATH=$RT_gcc_16/lib
+      export C_INCLUDE_PATH=$RT_gcc_16/include
+      export LD_LIBRARY_PATH=$RT_gcc_16/lib