? axis-emc2.patch
Index: setup.py
===================================================================
RCS file: /fs/c1/cvs/axis/setup.py,v
retrieving revision 1.14
diff -u -u -r1.14 setup.py
--- setup.py	9 Mar 2005 02:30:46 -0000	1.14
+++ setup.py	6 Jun 2005 19:13:01 -0000
@@ -33,35 +33,21 @@
 DOCDIR="share/doc/%s-%s" % (name, version)
 SHAREDIR="share/%s" % (name)
 
-emcroot = os.getenv("EMCROOT", find_emc_root())
-if emcroot is None:
+emc2root = os.getenv("EMC2ROOT", find_emc_root())
+if emc2root is None:
     print """\
 setup.py failed to locate the root directory of your emc installation.
 Determine the location of your emc installation and re-run setup.py with a
 commandline like this:
-    $ env EMCROOT=/usr/local/emc python setup.py
-
-See the README file for more information.
-"""
-    raise SystemExit, 1
-emcplat = os.getenv("PLAT", find_emc_plat(emcroot))
-if emcplat is None:
-    print """\
-setup.py failed to locate the (non-realtime) platform of your emc installation.
-Determine the platform name and re-run setup.py with a commandline like this:
-    $ env PLAT=nonrealtime python setup.py
-
-If you had to specify EMCSOURCEDIR, the commandline would look like
-    $ env EMCSOURCEDIR=/usr/local/emc PLAT=nonrealtime python setup.py
+    $ env EMC2ROOT=/usr/local/emc python setup.py
 
 See the README file for more information.
 """
     raise SystemExit, 1
 
 distutils.command.install.INSTALL_SCHEMES['unix_prefix']['scripts'] = \
-        "%s/emc/plat/%s/bin" % (emcroot, emcplat)
-print "Building for EMC in", emcroot
-print "Non-realtime PLAT", emcplat
+        "%s/bin" % (emc2root)
+print "Building for EMC in", emc2root
 
 togl = Extension("_togl", ["extensions/_toglmodule.c"], **get_togl_flags())
 
@@ -69,37 +55,31 @@
         "extensions/gcodemodule.cc"
     ],
     include_dirs=[
-        os.path.join(emcroot, "emc", "plat", emcplat, "include",
-             "rs274ngc_new"),
-        os.path.join(emcroot, "emc", "plat", emcplat, "include"),
-        os.path.join(emcroot, "rcslib", "plat", emcplat, "include")
+        os.path.join(emc2root, "include"),
     ],
     library_dirs = [
-        os.path.join(emcroot, "emc", "plat", emcplat, "lib"),
-        os.path.join(emcroot, "rcslib", "plat", emcplat, "lib")
+        os.path.join(emc2root, "lib"),
     ],
     extra_link_args = [
         '-DNEW_INTERPRETER', 
         '-Wl,-rpath,%s' % 
-            os.path.join(emcroot, "rcslib", "plat", emcplat, "lib"),
-        os.path.join(emcroot, "emc", "plat", emcplat, "lib", "rs274abc.o"),
-        '-lrcs', '-lm', '-lstdc++',
+            os.path.join(emc2root, "lib"),
+            os.path.join(emc2root, "src", ".tmp", "rs274.o"),
+        '-lnml', '-lm', '-lstdc++',
     ]
 )
 
 emc = Extension("emc", ["extensions/emcmodule.cc"],
-    define_macros=[('DEFAULT_NMLFILE', '"%s/emc/emc.nml"' % emcroot)],
+    define_macros=[('DEFAULT_NMLFILE', '"%s/configs/emc.nml"' % emc2root)],
     include_dirs=[
-        os.path.join(emcroot, "emc", "plat", emcplat, "include"),
-        os.path.join(emcroot, "rcslib", "plat", emcplat, "include")
+        os.path.join(emc2root, "include"),
     ],
     library_dirs = [
-        os.path.join(emcroot, "emc", "plat", emcplat, "lib"),
-        os.path.join(emcroot, "rcslib", "plat", emcplat, "lib")
+        os.path.join(emc2root, "lib"),
     ],
-    libraries = ["emc", "rcs", "m", "stdc++"],
+    libraries = ["emc", "nml", "m", "stdc++"],
     extra_link_args = ['-Wl,-rpath,%s' % 
-        os.path.join(emcroot, "rcslib", "plat", emcplat, "lib")]
+        os.path.join(emc2root, "lib")]
 )
 
 glfixes = Extension("_glfixes", ["extensions/_glfixes.c"], libraries = ["GL"], 
Index: extensions/emcmodule.cc
===================================================================
RCS file: /fs/c1/cvs/axis/extensions/emcmodule.cc,v
retrieving revision 1.6
diff -u -u -r1.6 emcmodule.cc
--- extensions/emcmodule.cc	9 Mar 2005 01:20:38 -0000	1.6
+++ extensions/emcmodule.cc	6 Jun 2005 19:13:01 -0000
@@ -20,6 +20,7 @@
 #include <structmember.h>
 #include "rcs.hh"
 #include "emc.hh"
+#include "global_defs.h"
 #include "inifile.h"
 #include <cmath>
 
@@ -37,6 +38,11 @@
 
 #define NUM_AXES (6)
 
+#define EMC_OPERATOR_ERROR_LEN LINELEN
+#define EMC_OPERATOR_TEXT_LEN LINELEN
+#define EMC_OPERATOR_DISPLAY_LEN LINELEN
+
+
 #define LOCAL_SPINDLE_FORWARD (1)
 #define LOCAL_SPINDLE_REVERSE (-1)
 #define LOCAL_SPINDLE_OFF (0)
@@ -430,15 +436,15 @@
 }
 
 static PyObject *Stat_activegcodes(pyStatChannel *s) {
-    return int_array(s->status.task.activeGCodes, EMC_TASK_ACTIVE_G_CODES);
+    return int_array(s->status.task.activeGCodes, ACTIVE_G_CODES);
 }
 
 static PyObject *Stat_activemcodes(pyStatChannel *s) {
-    return int_array(s->status.task.activeMCodes, EMC_TASK_ACTIVE_M_CODES);
+    return int_array(s->status.task.activeMCodes, ACTIVE_M_CODES);
 }
 
 static PyObject *Stat_activesettings(pyStatChannel *s) {
-   return double_array(s->status.task.activeSettings, EMC_TASK_ACTIVE_SETTINGS);
+   return double_array(s->status.task.activeSettings, ACTIVE_SETTINGS);
 }
 
 static PyObject *Stat_din(pyStatChannel *s) {
Index: extensions/gcodemodule.cc
===================================================================
RCS file: /fs/c1/cvs/axis/extensions/gcodemodule.cc,v
retrieving revision 1.9
diff -u -u -r1.9 gcodemodule.cc
--- extensions/gcodemodule.cc	9 Mar 2005 01:20:38 -0000	1.9
+++ extensions/gcodemodule.cc	6 Jun 2005 19:13:01 -0000
@@ -36,6 +36,8 @@
 #undef offsetof
 #define offsetof(T,x) (int)(-1+(char*)&(((T*)1)->x))
 
+char _parameter_file_name[LINELEN];
+
 
 static PyObject *pose(const EmcPose &p) {
     PyObject *res = PyTuple_New(6);
@@ -61,16 +63,16 @@
 
 typedef struct {
     PyObject_HEAD
-    double settings[RS274NGC_ACTIVE_SETTINGS];
-    int gcodes[RS274NGC_ACTIVE_G_CODES];
-    int mcodes[RS274NGC_ACTIVE_M_CODES];
+    double settings[ACTIVE_SETTINGS];
+    int gcodes[ACTIVE_G_CODES];
+    int mcodes[ACTIVE_M_CODES];
 } LineCode;
 
 PyObject *LineCode_gcodes(LineCode *l) {
-    return int_array(l->gcodes, RS274NGC_ACTIVE_G_CODES);
+    return int_array(l->gcodes, ACTIVE_G_CODES);
 }
 PyObject *LineCode_mcodes(LineCode *l) {
-    return int_array(l->mcodes, RS274NGC_ACTIVE_M_CODES);
+    return int_array(l->mcodes, ACTIVE_M_CODES);
 }
 
 PyGetSetDef LineCodeGetSet[] = {
@@ -154,14 +156,15 @@
 int last_sequence_number;
 int plane;
 bool metric;
+Interp interp_new;
 
 void maybe_new_line() {
     if(interp_error) return;
     LineCode *new_line_code =
         (LineCode*)(PyObject_New(LineCode, &LineCodeType));
-    rs274ngc_active_settings(new_line_code->settings);
-    rs274ngc_active_g_codes(new_line_code->gcodes);
-    rs274ngc_active_m_codes(new_line_code->mcodes);
+    interp_new.rs274ngc_active_settings(new_line_code->settings);
+    interp_new.rs274ngc_active_g_codes(new_line_code->gcodes);
+    interp_new.rs274ngc_active_m_codes(new_line_code->mcodes);
     int sequence_number = new_line_code->gcodes[0];
     if(sequence_number == last_sequence_number) {
         Py_DECREF(new_line_code);
@@ -349,6 +352,7 @@
     if(!s) { name[0] = 0; return; }
     memset(name, 0, max_size);
     strncpy(name, s, max_size - 1);
+    printf("alex_joni was here\n");
 }
 int GET_EXTERNAL_LENGTH_UNIT_TYPE() { return CANON_UNITS_INCHES; }
 CANON_TOOL_TABLE GET_EXTERNAL_TOOL_TABLE(int tool) {
@@ -388,13 +392,13 @@
     interp_error = 0;
     last_sequence_number = -1;
 
-    rs274ngc_init();
-    rs274ngc_open(f);
+    interp_new.rs274ngc_init();
+    interp_new.rs274ngc_open(f);
     int result = 0;
     while(!interp_error) {
-        result = rs274ngc_read();
+        result = interp_new.rs274ngc_read();
         if(result != RS274NGC_OK) break;
-        result = rs274ngc_execute();
+        result = interp_new.rs274ngc_execute();
         if(result != RS274NGC_OK) break;
     }
     if(interp_error || !result) return NULL;
