develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34473 - in trunk: . compilers/pirc/new

From:
kjs
Date:
December 28, 2008 02:30
Subject:
[svn:parrot] r34473 - in trunk: . compilers/pirc/new
Message ID:
20081228103007.F2B8FCB9B0@x12.develooper.com
Author: kjs
Date: Sun Dec 28 02:30:04 2008
New Revision: 34473

Added:
   trunk/compilers/pirc/new/pirdefines.h   (contents, props changed)
Modified:
   trunk/MANIFEST
   trunk/compilers/pirc/new/bcgen.h
   trunk/compilers/pirc/new/pircompiler.h
   trunk/compilers/pirc/new/pircompunit.c
   trunk/compilers/pirc/new/pircompunit.h

Log:
[pirc] refactor a bit of #defines, adding a new header file. + update MANIFEST.

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	(original)
+++ trunk/MANIFEST	Sun Dec 28 02:30:04 2008
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Sat Dec 27 22:28:00 2008 UT
+# generated by tools\dev\mk_manifest_and_skip.pl Sun Dec 28 10:28:36 2008 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -171,6 +171,7 @@
 compilers/pirc/new/pircompiler.h                            []
 compilers/pirc/new/pircompunit.c                            []
 compilers/pirc/new/pircompunit.h                            []
+compilers/pirc/new/pirdefines.h                             []
 compilers/pirc/new/piremit.c                                []
 compilers/pirc/new/piremit.h                                []
 compilers/pirc/new/pirheredoc.h                             []

Modified: trunk/compilers/pirc/new/bcgen.h
==============================================================================
--- trunk/compilers/pirc/new/bcgen.h	(original)
+++ trunk/compilers/pirc/new/bcgen.h	Sun Dec 28 02:30:04 2008
@@ -8,6 +8,7 @@
 
 #include "parrot/parrot.h"
 #include "parrot/embed.h"
+#include "pirdefines.h"
 
 /* the type name is exported, but not its private bits */
 struct bytecode;
@@ -22,7 +23,7 @@
     char const * nsentry;
     char const * subid;
     int          vtable_index;
-    unsigned     regs_used[4];
+    unsigned     regs_used[NUM_PARROT_TYPES];
     int          startoffset;
     int          endoffset;
 

Modified: trunk/compilers/pirc/new/pircompiler.h
==============================================================================
--- trunk/compilers/pirc/new/pircompiler.h	(original)
+++ trunk/compilers/pirc/new/pircompiler.h	Sun Dec 28 02:30:04 2008
@@ -14,9 +14,6 @@
 #include "parrot/embed.h"
 
 
-#define TRUE    1
-#define FALSE   0
-
 #include <stdio.h> /* for FILE * */
 
 

Modified: trunk/compilers/pirc/new/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.c	(original)
+++ trunk/compilers/pirc/new/pircompunit.c	Sun Dec 28 02:30:04 2008
@@ -27,17 +27,20 @@
 #include "pircompiler.h"
 #include "pirsymbol.h"
 #include "piryy.h"
+#include "pirdefines.h"
+#include "bcgen.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
+#include <assert.h>
 
 #include "parrot/oplib/ops.h"
 #include "parrot/string_funcs.h"
 #include "parrot/dynext.h"
 
-#include <assert.h>
+
 
 static unsigned const prime_numbers[] = {113 /* XXX think of more primes */ };
 
@@ -230,7 +233,9 @@
 =item C<void
 set_sub_flag(lexer_state * const lexer, sub_flag flag)>
 
-Set a subroutine flag on the current sub.
+Set a subroutine flag on the current sub. The C<flag> parameter may encode
+multiple flags. If it encodes the C<:vtable> or C<:method> flag, an extra
+parameter named C<self> is added to the current subroutine.
 
 =cut
 
@@ -396,7 +401,7 @@
 /*
 
 =item C<argument *
-set_curarg(lexer_state * const lexer, argument *arg)>
+set_curarg(lexer_state * const lexer, argument * const arg)>
 
 Sets the argument C<arg> as the current argument in C<lexer>
 to make it accessible to other parse actions. C<arg> is returned.

Modified: trunk/compilers/pirc/new/pircompunit.h
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.h	(original)
+++ trunk/compilers/pirc/new/pircompunit.h	Sun Dec 28 02:30:04 2008
@@ -13,10 +13,9 @@
 #ifndef PARROT_PIR_PIRCOMPUNIT_H_GUARD
 #define PARROT_PIR_PIRCOMPUNIT_H_GUARD
 
-/* needed for sub_info structure definition */
+#include "pirdefines.h"
 #include "bcgen.h"
 
-
 /* the 4 parrot types; use explicit values that match the values in
  * PDD03_calling_conventions.pod.
  */
@@ -29,8 +28,6 @@
 
 } pir_type;
 
-/* Parrot has 4 types */
-#define NUM_PARROT_TYPES    4
 
 
 /* selector values for the expression value union */
@@ -303,6 +300,8 @@
 struct symbol;
 struct label;
 
+
+
 /* a sub */
 typedef struct subroutine {
     key                *name_space;    /* this sub's namespace */
@@ -312,7 +311,7 @@
     char const         *methodname;    /* name of this sub by which it's stored as a method */
     int                 flags;         /* this sub's flags */
 
-    sub_info            info;
+    struct sub_info     info;
 
     /* XXX the whole multi stuff must be implemented */
     char              **multi_types;   /* data types of parameters if this is a multi sub */
@@ -323,7 +322,7 @@
     hashtable           symbols;
     hashtable           labels;        /* local labels */
 
-    struct pir_reg     *registers[4];  /* used PIR registers in this sub (1 list for each type) */
+    struct pir_reg     *registers[NUM_PARROT_TYPES];  /* used PIR registers in this sub */
 
     struct subroutine  *next;          /* pointer to next subroutine in the list */
 

Added: trunk/compilers/pirc/new/pirdefines.h
==============================================================================
--- (empty file)
+++ trunk/compilers/pirc/new/pirdefines.h	Sun Dec 28 02:30:04 2008
@@ -0,0 +1,23 @@
+/*
+ * $Id$
+ * Copyright (C) 2008, The Perl Foundation.
+ */
+
+#ifndef PARROT_PIR_PIRDEFINES_H_GUARD
+#define PARROT_PIR_PIRDEFINES_H_GUARD
+
+/* Parrot has 4 types */
+#define NUM_PARROT_TYPES  4
+
+#define TRUE              1
+#define FALSE             0
+
+#endif /* PARROT_PIR_PIRDEFINES_H_GUARD */
+
+/*
+ * Local variables:
+ *   c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
+



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About