logo       


r10298 - branches/GD_2_4/src/tools/melange: msg#00085

Subject: r10298 - branches/GD_2_4/src/tools/melange
Author: brent
Date: Thu Oct 27 15:19:55 2005
New Revision: 10298

Modified:
   branches/GD_2_4/src/tools/melange/c-lexer-cpp.dylan
   branches/GD_2_4/src/tools/melange/c-parse.input
   branches/GD_2_4/src/tools/melange/macos-portability.dylan
Log:
Job: 7267
   Handle parsing of macro definitions involving empty argument lists.
   Correct handling of Mac OS X 10.4.2 header files.


Modified: branches/GD_2_4/src/tools/melange/c-lexer-cpp.dylan
==============================================================================
--- branches/GD_2_4/src/tools/melange/c-lexer-cpp.dylan (original)
+++ branches/GD_2_4/src/tools/melange/c-lexer-cpp.dylan Thu Oct 27 15:19:55 2005
@@ -745,7 +745,7 @@
   if (*show-parse-progress-level* > $parse-progress-level-none)
     let defn = state.cpp-table[name.string-value];
     let (args, expansion) =
-      if (instance?(defn.head, <pair>))
+      if (defn ~== #() & instance?(defn.head, <list>))
         values(defn.head.reverse, defn.tail.reverse)
       else
         values(#f, defn.reverse)

Modified: branches/GD_2_4/src/tools/melange/c-parse.input
==============================================================================
--- branches/GD_2_4/src/tools/melange/c-parse.input     (original)
+++ branches/GD_2_4/src/tools/melange/c-parse.input     Thu Oct 27 15:19:55 2005
@@ -398,27 +398,37 @@
   //
   if (~instance?(@0, <parse-cpp-state>) | %1.string-value ~= "defined")
     let definition = element(%1.generator.cpp-table, %1.string-value,
-                         default: #f);
+                       default: #f);
     if (definition ~= #f)
       if (instance?(definition.head, <token>)) 
-       parse-error(@0,concatenate(%1.string-value, " isn't a parameterized 
macro."));
+        parse-error(@0,concatenate(%1.string-value, " isn't a parameterized 
macro."));
       else
-       // XXX: We don't actually substitute here like we should, but
-       // it'll handle "#define __GNUC_PREREQ(maj,min) 0" correctly...
-//     for (token in definition.tail)
-/*       for (count from 0, param in definition.head)
-           if (token.string-value = param.string-value)
-             token := %3[count];
-           end if;
-         end for;
+        // XXX: We don't actually substitute here like we should, but
+        // it'll handle "#define __GNUC_PREREQ(maj,min) 0" correctly...
+//      for (token in definition.tail)
+/*        for (count from 0, param in definition.head)
+            if (token.string-value = param.string-value)
+              token := %3[count];
+            end if;
+          end for;
 */
-//       unget-token(%1.generator, token);
-//     end for;
-//     cpp-parse(%1.generator);
+//        unget-token(%1.generator, token);
+//      end for;
+//      cpp-parse(%1.generator);
         0; // yeah, chickening out.
       end if;
     else
-      parse-error(@0,"Function calls not allowed in constant expressions.");
+      if ( %1.string-value = "defined" )
+        if (~instance?(%3, <token>))
+          %3;  // It's a literal
+        elseif (element(%3.generator.cpp-table, %3.string-value, default: #f))
+          1;
+        else
+          0
+        end if
+      else
+        parse-error(@0,"Function calls not allowed in constant expressions.");
+      end if;
     end if;
   elseif (element(%3.generator.cpp-table, %3.string-value, default: #f))
     1;

Modified: branches/GD_2_4/src/tools/melange/macos-portability.dylan
==============================================================================
--- branches/GD_2_4/src/tools/melange/macos-portability.dylan   (original)
+++ branches/GD_2_4/src/tools/melange/macos-portability.dylan   Thu Oct 27 
15:19:55 2005
@@ -48,38 +48,41 @@
       // Basics
       "const", "",
       "volatile", "",
+      "__STDC__", "",
+
       //"__cdecl", "",
-      
       // cpp -dM /dev/null
-      "GNUC", "(1)",
-      
+      //"GNUC", "(1)",
       // cc -E -dM -o - /dev/null
-      "__GNUC__", "2",
-      "__GNUC_MINOR__", "95",
+      "__GNUC__", "4",
+      "__GNUC_MINOR__", "0",
+
+      "__APPLE__", "",
       "__ppc__", "",
       "__NATURAL_ALIGNMENT__", "",
       "__MACH__", "",
       "__BIG_ENDIAN__", "",
-      "__APPLE__", "",
-      "__STDC__", "",
-      "__APPLE_CC__", "934",
+      "__APPLE_CC__", "5026",
       "__DYNAMIC__", "",
       "__signed__", "",
       "__signed", "",
       "__inline__", "",
       "__inline", "",
+      "__STDC_VERSION__", "199901L",
+      "__builtin_va_list", "void*",
       
       // Parameterized macros which remove various GCC extensions from our
       // source code. The last item in the list is the right-hand side of
       // the define; all the items preceding it are named parameters.
-      "__attribute__", #(#("x"), "")
+      "__attribute__", #(#("x"), ""),
+      "__asm", #(#("x"), "")
       ];
 
 // Set up the search path for .h files
 // cc -E -v /dev/null
 define constant macos-include-directories
   = #["/usr/local/include",
-                       "/usr/include/gcc/darwin/2.95.2/g++/..",
+                       "/usr/include/gcc/darwin/default/c++/..",
                        "/usr/include"];
 
 for (dir in macos-include-directories)
-- 
Gd-chatter mailing list
Gd-chatter@xxxxxxxxxxxxxxxx
https://gauss.gwydiondylan.org/mailman/listinfo/gd-chatter



Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe