[Synopsis-cvs] Synopsis/Synopsis/Synopsis/Parser/C Makefile,1.1,1.2 ctool.cc,1.1,1.2

Stefan Seefeld stefan at users.sourceforge.net
Tue Aug 19 21:58:02 UTC 2003


Update of /cvsroot/synopsis/Synopsis/Synopsis/Parser/C
In directory sc8-pr-cvs1:/tmp/cvs-serv11348/Synopsis/Parser/C

Modified Files:
	Makefile ctool.cc 
Log Message:
little fixes

Index: Makefile
===================================================================
RCS file: /cvsroot/synopsis/Synopsis/Synopsis/Parser/C/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -d -r1.1 -r1.2
--- Makefile	20 Aug 2003 02:16:37 -0000	1.1
+++ Makefile	20 Aug 2003 03:25:16 -0000	1.2
@@ -32,6 +32,9 @@ else
 CPPFLAGS+= -I $(python_prefix)/include -D PYTHON_INCLUDE="$(python_include)"
 endif
 
+CPPFLAGS+= $(CTOOL_CPPFLAGS)
+LIBS	:= $(CTOOL_LIBS) $(LIBS)
+
 SRC	:= Translator.cc ctool.cc
 OBJ	:= $(patsubst %.cc, %.o, $(SRC))
 DEP	:= $(patsubst %.cc, %.d, $(SRC))

Index: ctool.cc
===================================================================
RCS file: /cvsroot/synopsis/Synopsis/Synopsis/Parser/C/ctool.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -d -r1.1 -r1.2
--- ctool.cc	20 Aug 2003 02:16:37 -0000	1.1
+++ ctool.cc	20 Aug 2003 03:25:16 -0000	1.2
@@ -19,6 +19,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.2  2003/08/20 03:25:16  stefan
+// little fixes
+//
 // Revision 1.1  2003/08/20 02:16:37  stefan
 // first steps towards a C parser backend (based on the ctool)
 //
@@ -36,6 +39,10 @@
 #endif
 #include <fstream>
 
+#if 1
+int Trace::level = 0;
+#endif
+
 bool verbose;
 
 // If true then everything but what's in the main file will be stripped
@@ -65,7 +72,8 @@ void unexpected()
 
 void getopts(PyObject *args, std::vector<const char *> &cppflags, 
 	     std::vector<const char *> &ctflags,
-	     PyObject* config)
+	     PyObject *config,
+	     PyObject *extra_files)
 {
   verbose = false;
   syn_main_only = false;
@@ -187,6 +195,27 @@ Py_XDECREF(value);
     else if (strcmp(argument, "-t") == 0)
       syn_extract_tails = true;
   }
+
+  // If multi_files is set, we check the extra_files argument to see if it
+  // has a list of filenames like it should do
+  if (extra_files && PyList_Check(extra_files))
+  {
+#if 0
+    size_t extra_size = PyList_Size(extra_files);
+    if (extra_size > 0)
+    {
+      PyObject* item;
+      const char* string;
+      syn_extra_filenames = new std::vector<const char*>;
+      for (size_t i = 0; i < extra_size; i++)
+      {
+	item = PyList_GetItem(extra_files, i);
+	string = PyString_AsString(item);
+ 	syn_extra_filenames->push_back(string);
+      }
+    }
+#endif
+  }
 }
 
 char *RunPreprocessor(const char *file, const std::vector<const char *> &flags)
@@ -325,6 +354,7 @@ void do_parse(const char *src, 
 	      PyObject *ast, PyObject *types, PyObject *declarations,
 	      PyObject* files)
 {
+  Trace trace("do_parse");
   // Run the preprocessor
   char *cppfile = RunPreprocessor(src, cppargs);
 
@@ -338,12 +368,12 @@ PyObject *ctoolParse(PyObject *self, PyO
   Trace trace("ctoolParse");
 
   char *src;
-  PyObject *parserargs, *types, *declarations, *config, *ast;
-  if (!PyArg_ParseTuple(args, "sO!O", &src, &PyList_Type, &parserargs, &config))
+  PyObject *extra_files, *parserargs, *types, *declarations, *config, *ast;
+  if (!PyArg_ParseTuple(args, "sOO!O", &src, &extra_files, &PyList_Type, &parserargs, &config))
     return 0;
   std::vector<const char *> cppargs;
   std::vector<const char *> ctargs;
-  getopts(parserargs, cppargs, ctargs, config);
+  getopts(parserargs, cppargs, ctargs, config, extra_files);
   if (!src || *src == '\0')
   {
     std::cerr << "No source file" << std::endl;






More information about the Synopsis-changes mailing list