dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: treecc ChangeLog,1.64,1.65 gen_cs.c,1.2,1.3


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: treecc ChangeLog,1.64,1.65 gen_cs.c,1.2,1.3 gen_java.c,1.3,1.4 info.h,1.6,1.7 options.c,1.4,1.5
Date: Mon, 30 Dec 2002 16:54:16 -0500

Update of /cvsroot/dotgnu-pnet/treecc
In directory subversions:/tmp/cvs-serv8880

Modified Files:
        ChangeLog gen_cs.c gen_java.c info.h options.c 
Log Message:


Add the "internal_access" and "public_access" options, so that
treecc can output assembly-private node definitions.


Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/treecc/ChangeLog,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -r1.64 -r1.65
*** ChangeLog   21 Dec 2002 10:57:17 -0000      1.64
--- ChangeLog   30 Dec 2002 21:54:14 -0000      1.65
***************
*** 1,3 ****
--- 1,10 ----
  
+ 2002-12-31  Rhys Weatherley  <address@hidden>
+ 
+       * gen_cs.c, gen_java.c, info.h, options.c, doc/treecc.texi,
+       tests/output16.out, tests/output16.tst, tests/test_list:
+       add the "internal_access" and "public_access" options, so that
+       treecc can output assembly-private node definitions.
+ 
  2002-12-21  Rhys Weatherley  <address@hidden>
  

Index: gen_cs.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/treecc/gen_cs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gen_cs.c    17 Mar 2002 10:35:28 -0000      1.2
--- gen_cs.c    30 Dec 2002 21:54:14 -0000      1.3
***************
*** 55,59 ****
                TreeCCStream *stream = node->source;
                TreeCCNode *child;
!               TreeCCStreamPrint(stream, "public enum %s\n", node->name);
                TreeCCStreamPrint(stream, "{\n");
                child = node->firstChild;
--- 55,66 ----
                TreeCCStream *stream = node->source;
                TreeCCNode *child;
!               if(context->internal_access)
!               {
!                       TreeCCStreamPrint(stream, "internal enum %s\n", 
node->name);
!               }
!               else
!               {
!                       TreeCCStreamPrint(stream, "public enum %s\n", 
node->name);
!               }
                TreeCCStreamPrint(stream, "{\n");
                child = node->firstChild;
***************
*** 284,287 ****
--- 291,295 ----
        TreeCCField *field;
        int isAbstract;
+       const char *accessMode;
  
        /* Ignore if this is an enumerated type node */
***************
*** 294,297 ****
--- 302,315 ----
        isAbstract = TreeCCNodeHasAbstracts(context, node);
  
+       /* Determine the access mode for the class */
+       if(context->internal_access)
+       {
+               accessMode = "internal";
+       }
+       else
+       {
+               accessMode = "public";
+       }
+ 
        /* Output the class header */
        stream = node->source;
***************
*** 301,311 ****
                if(isAbstract)
                {
!                       TreeCCStreamPrint(stream, "public abstract class %s : 
%s\n{\n",
!                                                         node->name, 
node->parent->name);
                }
                else
                {
!                       TreeCCStreamPrint(stream, "public class %s : %s\n{\n",
!                                                         node->name, 
node->parent->name);
                }
        }
--- 319,329 ----
                if(isAbstract)
                {
!                       TreeCCStreamPrint(stream, "%s abstract class %s : 
%s\n{\n",
!                                                         accessMode, 
node->name, node->parent->name);
                }
                else
                {
!                       TreeCCStreamPrint(stream, "%s class %s : %s\n{\n",
!                                                         accessMode, 
node->name, node->parent->name);
                }
        }
***************
*** 315,324 ****
                if(isAbstract)
                {
!                       TreeCCStreamPrint(stream, "public abstract class 
%s\n{\n",
!                                                         node->name);
                }
                else
                {
!                       TreeCCStreamPrint(stream, "public class %s\n{\n", 
node->name);
                }
  
--- 333,343 ----
                if(isAbstract)
                {
!                       TreeCCStreamPrint(stream, "%s abstract class %s\n{\n",
!                                                         accessMode, 
node->name);
                }
                else
                {
!                       TreeCCStreamPrint(stream, "%s class %s\n{\n",
!                                                         accessMode, 
node->name);
                }
  
***************
*** 642,652 ****
        if(context->reentrant && context->abstract_factory)
        {
!               TreeCCStreamPrint(stream, "public abstract class %s\n{\n\n",
!                                                 context->state_type);
        }
        else
        {
!               TreeCCStreamPrint(stream, "public class %s\n{\n\n",
!                                                 context->state_type);
        }
  
--- 661,687 ----
        if(context->reentrant && context->abstract_factory)
        {
!               if(context->internal_access)
!               {
!                       TreeCCStreamPrint(stream, "internal abstract class 
%s\n{\n\n",
!                                                         context->state_type);
!               }
!               else
!               {
!                       TreeCCStreamPrint(stream, "public abstract class 
%s\n{\n\n",
!                                                         context->state_type);
!               }
        }
        else
        {
!               if(context->internal_access)
!               {
!                       TreeCCStreamPrint(stream, "internal class %s\n{\n\n",
!                                                         context->state_type);
!               }
!               else
!               {
!                       TreeCCStreamPrint(stream, "public class %s\n{\n\n",
!                                                         context->state_type);
!               }
        }
  

Index: gen_java.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/treecc/gen_java.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** gen_java.c  17 Mar 2002 10:35:28 -0000      1.3
--- gen_java.c  30 Dec 2002 21:54:14 -0000      1.4
***************
*** 698,708 ****
                                              TreeCCOperation *oper)
  {
        if(oper->className)
        {
!               TreeCCStreamPrint(stream, "public class %s\n{\n", 
oper->className);
        }
        else
        {
!               TreeCCStreamPrint(stream, "public class %s\n{\n", oper->name);
        }
  }
--- 698,719 ----
                                              TreeCCOperation *oper)
  {
+       const char *accessMode;
+       if(context->internal_access && context->language == TREECC_LANG_CSHARP)
+       {
+               accessMode = "internal";
+       }
+       else
+       {
+               accessMode = "public";
+       }
        if(oper->className)
        {
!               TreeCCStreamPrint(stream, "%s class %s\n{\n",
!                                                 accessMode, oper->className);
        }
        else
        {
!               TreeCCStreamPrint(stream, "%s class %s\n{\n",
!                                                 accessMode, oper->name);
        }
  }

Index: info.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/treecc/info.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** info.h      15 Dec 2002 04:03:27 -0000      1.6
--- info.h      30 Dec 2002 21:54:14 -0000      1.7
***************
*** 224,227 ****
--- 224,228 ----
        int                             kind_in_vtable : 1;     /* Put kind 
value in vtable only */
        int                             strip_filenames : 1; /* Strip names in 
#line directives */
+       int                             internal_access : 1; /* Use "internal" 
classes in C# */
  
        /* String to use to replace "yy" in output files */

Index: options.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/treecc/options.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** options.c   2 Nov 2002 04:38:21 -0000       1.4
--- options.c   30 Dec 2002 21:54:14 -0000      1.5
***************
*** 312,315 ****
--- 312,332 ----
  
  /*
+  * "internal_access": use "internal" access on classes in C#, instead
+  * of using "public".  "public_access" is used to select "public".
+  */
+ static int InternalAccessOption(TreeCCContext *context, char *value, int flag)
+ {
+       if(value)
+       {
+               return TREECC_OPT_NO_VALUE;
+       }
+       else
+       {
+               context->internal_access = flag;
+               return TREECC_OPT_OK;
+       }
+ }
+ 
+ /*
   * Table of option handlers.
   */
***************
*** 344,348 ****
        {"strip_filenames",             StripFilenamesOption,   1},
        {"no_strip_filenames",  StripFilenamesOption,   0},
!       {0,                                             0},
  };
  
--- 361,367 ----
        {"strip_filenames",             StripFilenamesOption,   1},
        {"no_strip_filenames",  StripFilenamesOption,   0},
!       {"internal_access",             InternalAccessOption,   1},
!       {"public_access",               InternalAccessOption,   0},
!       {0,                                             0,                      
                        0},
  };
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]