Author: bernhard
Date: Fri Jan 16 09:23:18 2009
New Revision: 35635

Modified:
   trunk/languages/pipp/src/common/php_API.pir
   trunk/languages/pipp/src/common/php_MACRO.pir
   trunk/languages/pipp/src/common/php_array.pir
   trunk/languages/pipp/src/common/php_basic.pir
   trunk/languages/pipp/src/common/php_builtin.pir
   trunk/languages/pipp/src/common/php_file.pir
   trunk/languages/pipp/src/common/php_gmp.pir
   trunk/languages/pipp/src/common/php_info.pir
   trunk/languages/pipp/src/common/php_pcre.pir

Log:
[Pipp] Eliminate usage of macro GET_CONSTANTS

Modified: trunk/languages/pipp/src/common/php_API.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_API.pir (original)
+++ trunk/languages/pipp/src/common/php_API.pir Fri Jan 16 09:23:18 2009
@@ -22,11 +22,9 @@
     set_hll_global 'php_constants', $P0
 
     # set up error codes
-    .local pmc cst
-    .GET_CONSTANTS(cst)
-    .REGISTER_LONG_CONSTANT(cst, 'E_ERROR', E_ERROR)
-    .REGISTER_LONG_CONSTANT(cst, 'E_WARNING', E_WARNING)
-    .REGISTER_LONG_CONSTANT(cst, 'E_CORE', E_CORE)
+    .REGISTER_LONG_CONSTANT('E_ERROR', E_ERROR)
+    .REGISTER_LONG_CONSTANT('E_WARNING', E_WARNING)
+    .REGISTER_LONG_CONSTANT('E_CORE', E_CORE)
 
     # set up default error_reporting
     $P1 = new 'PhpInteger'

Modified: trunk/languages/pipp/src/common/php_MACRO.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_MACRO.pir       (original)
+++ trunk/languages/pipp/src/common/php_MACRO.pir       Fri Jan 16 09:23:18 2009
@@ -30,20 +30,18 @@
 .const int E_ALL = 0x1fff
 .const int E_CORE = 0x0030
 
-.macro GET_CONSTANTS(reg)
-    get_hll_global .reg, 'php_constants'
-.endm
-
-.macro REGISTER_LONG_CONSTANT(reg, symb, val)
+.macro REGISTER_LONG_CONSTANT(symb, val)
     new $P0, 'PhpInteger'
     set $P0, .val
-    .reg[.symb] = $P0
+    $P44 = get_hll_global 'php_constants'
+    $P44[.symb] = $P0
 .endm
 
-.macro REGISTER_STRING_CONSTANT(reg, symb, val)
+.macro REGISTER_STRING_CONSTANT(symb, val)
     new $P0, 'PhpString'
     set $P0, .val
-    .reg[.symb] = $P0
+    $P44 = get_hll_global 'php_constants'
+    $P44[.symb] = $P0
 .endm
 
 =item C<.RETURN_BOOL( val )>

Modified: trunk/languages/pipp/src/common/php_array.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_array.pir       (original)
+++ trunk/languages/pipp/src/common/php_array.pir       Fri Jan 16 09:23:18 2009
@@ -39,26 +39,24 @@
 .const int COUNT_RECURSIVE              = 1
 
 .sub '__init' :anon :load :init
-    .local pmc cst
-    .GET_CONSTANTS(cst)
-    .REGISTER_LONG_CONSTANT(cst, 'EXTR_OVERWRITE', EXTR_OVERWRITE)
-    .REGISTER_LONG_CONSTANT(cst, 'EXTR_SKIP', EXTR_SKIP)
-    .REGISTER_LONG_CONSTANT(cst, 'EXTR_PREFIX_SAME', EXTR_PREFIX_SAME)
-    .REGISTER_LONG_CONSTANT(cst, 'EXTR_PREFIX_ALL', EXTR_PREFIX_ALL)
-    .REGISTER_LONG_CONSTANT(cst, 'EXTR_PREFIX_INVALID', EXTR_PREFIX_INVALID)
-    .REGISTER_LONG_CONSTANT(cst, 'EXTR_PREFIX_IF_EXISTS', 
EXTR_PREFIX_IF_EXISTS)
-    .REGISTER_LONG_CONSTANT(cst, 'EXTR_IF_EXISTS', EXTR_IF_EXISTS)
-    .REGISTER_LONG_CONSTANT(cst, 'EXTR_REFS', EXTR_REFS)
-    .REGISTER_LONG_CONSTANT(cst, 'SORT_ASC', SORT_ASC)
-    .REGISTER_LONG_CONSTANT(cst, 'SORT_DESC', SORT_DESC)
-    .REGISTER_LONG_CONSTANT(cst, 'SORT_REGULAR', SORT_REGULAR)
-    .REGISTER_LONG_CONSTANT(cst, 'SORT_NUMERIC', SORT_NUMERIC)
-    .REGISTER_LONG_CONSTANT(cst, 'SORT_STRING', SORT_STRING)
-    .REGISTER_LONG_CONSTANT(cst, 'SORT_LOCALE_STRING', SORT_LOCALE_STRING)
-    .REGISTER_LONG_CONSTANT(cst, 'CASE_LOWER', CASE_LOWER)
-    .REGISTER_LONG_CONSTANT(cst, 'CASE_UPPER', CASE_UPPER)
-    .REGISTER_LONG_CONSTANT(cst, 'COUNT_NORMAL', COUNT_NORMAL)
-    .REGISTER_LONG_CONSTANT(cst, 'COUNT_RECURSIVE', COUNT_RECURSIVE)
+    .REGISTER_LONG_CONSTANT('EXTR_OVERWRITE', EXTR_OVERWRITE)
+    .REGISTER_LONG_CONSTANT('EXTR_SKIP', EXTR_SKIP)
+    .REGISTER_LONG_CONSTANT('EXTR_PREFIX_SAME', EXTR_PREFIX_SAME)
+    .REGISTER_LONG_CONSTANT('EXTR_PREFIX_ALL', EXTR_PREFIX_ALL)
+    .REGISTER_LONG_CONSTANT('EXTR_PREFIX_INVALID', EXTR_PREFIX_INVALID)
+    .REGISTER_LONG_CONSTANT('EXTR_PREFIX_IF_EXISTS', EXTR_PREFIX_IF_EXISTS)
+    .REGISTER_LONG_CONSTANT('EXTR_IF_EXISTS', EXTR_IF_EXISTS)
+    .REGISTER_LONG_CONSTANT('EXTR_REFS', EXTR_REFS)
+    .REGISTER_LONG_CONSTANT('SORT_ASC', SORT_ASC)
+    .REGISTER_LONG_CONSTANT('SORT_DESC', SORT_DESC)
+    .REGISTER_LONG_CONSTANT('SORT_REGULAR', SORT_REGULAR)
+    .REGISTER_LONG_CONSTANT('SORT_NUMERIC', SORT_NUMERIC)
+    .REGISTER_LONG_CONSTANT('SORT_STRING', SORT_STRING)
+    .REGISTER_LONG_CONSTANT('SORT_LOCALE_STRING', SORT_LOCALE_STRING)
+    .REGISTER_LONG_CONSTANT('CASE_LOWER', CASE_LOWER)
+    .REGISTER_LONG_CONSTANT('CASE_UPPER', CASE_UPPER)
+    .REGISTER_LONG_CONSTANT('COUNT_NORMAL', COUNT_NORMAL)
+    .REGISTER_LONG_CONSTANT('COUNT_RECURSIVE', COUNT_RECURSIVE)
 .end
 
 =item C<array array([mixed $...])>

Modified: trunk/languages/pipp/src/common/php_basic.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_basic.pir       (original)
+++ trunk/languages/pipp/src/common/php_basic.pir       Fri Jan 16 09:23:18 2009
@@ -102,7 +102,7 @@
     $P1 = shift args
     $S1 = $P1
     .local pmc cst
-    .GET_CONSTANTS(cst)
+    cst = get_hll_global 'php_constants'
     $I0 = exists cst[$S1]
     unless $I0 goto L2
     $P0 = cst[$S1]

Modified: trunk/languages/pipp/src/common/php_builtin.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_builtin.pir     (original)
+++ trunk/languages/pipp/src/common/php_builtin.pir     Fri Jan 16 09:23:18 2009
@@ -114,7 +114,7 @@
   L4:
     $S1 = $P1
     .local pmc cst
-    .GET_CONSTANTS(cst)
+    cst = get_hll_global 'php_constants'
     $I0 = exists cst[$S1]
     if $I0 goto L6
     cst[$S1] = $P2
@@ -141,8 +141,9 @@
     $P1 = shift args
     $S1 = $P1
     .local pmc cst
-    .GET_CONSTANTS(cst)
+    cst = get_hll_global 'php_constants'
     $I0 = exists cst[$S1]
+
     .RETURN_BOOL($I0)
 .end
 

Modified: trunk/languages/pipp/src/common/php_file.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_file.pir        (original)
+++ trunk/languages/pipp/src/common/php_file.pir        Fri Jan 16 09:23:18 2009
@@ -20,11 +20,9 @@
 .const int SEEK_END = 2
 
 .sub '__init' :anon :load :init
-    .local pmc cst
-    .GET_CONSTANTS(cst)
-    .REGISTER_LONG_CONSTANT(cst, 'SEEK_SET', SEEK_SET)
-    .REGISTER_LONG_CONSTANT(cst, 'SEEK_CUR', SEEK_CUR)
-    .REGISTER_LONG_CONSTANT(cst, 'SEEK_END', SEEK_END)
+    .REGISTER_LONG_CONSTANT('SEEK_SET', SEEK_SET)
+    .REGISTER_LONG_CONSTANT('SEEK_CUR', SEEK_CUR)
+    .REGISTER_LONG_CONSTANT('SEEK_END', SEEK_END)
 .end
 
 =item C<string basename(string path [, string suffix])>

Modified: trunk/languages/pipp/src/common/php_gmp.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_gmp.pir (original)
+++ trunk/languages/pipp/src/common/php_gmp.pir Fri Jan 16 09:23:18 2009
@@ -28,13 +28,11 @@
 .const int GMP_ROUND_MINUSINF  = 2
 
 .sub '__init' :anon :load :init
-    .local pmc cst
-    .GET_CONSTANTS(cst)
-    .REGISTER_LONG_CONSTANT(cst, 'GMP_ROUND_ZERO', GMP_ROUND_ZERO)
-    .REGISTER_LONG_CONSTANT(cst, 'GMP_ROUND_PLUSINF', GMP_ROUND_PLUSINF)
-    .REGISTER_LONG_CONSTANT(cst, 'GMP_ROUND_MINUSINF', GMP_ROUND_MINUSINF)
+    .REGISTER_LONG_CONSTANT('GMP_ROUND_ZERO', GMP_ROUND_ZERO)
+    .REGISTER_LONG_CONSTANT('GMP_ROUND_PLUSINF', GMP_ROUND_PLUSINF)
+    .REGISTER_LONG_CONSTANT('GMP_ROUND_MINUSINF', GMP_ROUND_MINUSINF)
 #    $S0 =
-#    .REGISTER_STRING_CONSTANT(cst, 'GMP_VERSION', $S0)
+#    .REGISTER_STRING_CONSTANT('GMP_VERSION', $S0)
 .end
 
 .macro UNARY_OP(args, op)

Modified: trunk/languages/pipp/src/common/php_info.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_info.pir        (original)
+++ trunk/languages/pipp/src/common/php_info.pir        Fri Jan 16 09:23:18 2009
@@ -22,21 +22,21 @@
 .include 'tm.pasm'
 
 .sub '__init' :anon :load :init
-    .local pmc cst
-    .GET_CONSTANTS(cst)
     $S0 = sysinfo .SYSINFO_PARROT_OS
-    .REGISTER_STRING_CONSTANT(cst, 'PHP_OS', $S0)
-    .REGISTER_STRING_CONSTANT(cst, 'PHP_VERSION', "5.3.0 on Parrot")
-    .REGISTER_LONG_CONSTANT(cst, 'PHP_MAJOR_VERSION', 5)
-    .REGISTER_LONG_CONSTANT(cst, 'PHP_MINOR_VERSION', 3)
-    .REGISTER_LONG_CONSTANT(cst, 'PHP_RELEASE_VERSION', 0)
-    .REGISTER_STRING_CONSTANT(cst, 'PHP_EXTRA_VERSION', " on Parrot")
-    .REGISTER_LONG_CONSTANT(cst, 'PHP_VERSION_ID', 50300)
-    .REGISTER_LONG_CONSTANT(cst, 'PHP_ZTS', 0)
+    .REGISTER_STRING_CONSTANT('PHP_OS', $S0)
+    .REGISTER_STRING_CONSTANT('PHP_VERSION', "5.3.0 on Parrot")
+    .REGISTER_LONG_CONSTANT('PHP_MAJOR_VERSION', 5)
+    .REGISTER_LONG_CONSTANT('PHP_MINOR_VERSION', 3)
+    .REGISTER_LONG_CONSTANT('PHP_RELEASE_VERSION', 0)
+    .REGISTER_STRING_CONSTANT('PHP_EXTRA_VERSION', " on Parrot")
+    .REGISTER_LONG_CONSTANT('PHP_VERSION_ID', 50300)
+    .REGISTER_LONG_CONSTANT('PHP_ZTS', 0)
 
-    .REGISTER_STRING_CONSTANT(cst, 'DEFAULT_INCLUDE_PATH', '.')
+    .REGISTER_STRING_CONSTANT('DEFAULT_INCLUDE_PATH', '.')
 
     # register NULL
+    .local pmc cst
+    cst = get_hll_global 'php_constants'
     new $P0, 'PhpNull'
     cst['NULL'] = $P0
 

Modified: trunk/languages/pipp/src/common/php_pcre.pir
==============================================================================
--- trunk/languages/pipp/src/common/php_pcre.pir        (original)
+++ trunk/languages/pipp/src/common/php_pcre.pir        Fri Jan 16 09:23:18 2009
@@ -82,24 +82,22 @@
 
 
 .sub '__init' :anon
-    .local pmc cst
-    .GET_CONSTANTS(cst)
-    .REGISTER_LONG_CONSTANT(cst, 'PREG_PATTERN_ORDER', PREG_PATTERN_ORDER)
-    .REGISTER_LONG_CONSTANT(cst, 'PREG_SET_ORDER', PREG_SET_ORDER)
-    .REGISTER_LONG_CONSTANT(cst, 'PREG_OFFSET_CAPTURE', PREG_OFFSET_CAPTURE)
-    .REGISTER_LONG_CONSTANT(cst, 'PREG_SPLIT_NO_EMPTY', PREG_SPLIT_NO_EMPTY)
-    .REGISTER_LONG_CONSTANT(cst, 'PREG_SPLIT_DELIM_CAPTURE', 
PREG_SPLIT_DELIM_CAPTURE)
-    .REGISTER_LONG_CONSTANT(cst, 'PREG_SPLIT_OFFSET_CAPTURE', 
PREG_SPLIT_OFFSET_CAPTURE)
-    .REGISTER_LONG_CONSTANT(cst, 'PREG_GREP_INVERT', PREG_GREP_INVERT)
-
-    .REGISTER_LONG_CONSTANT(cst, 'PREG_NO_ERROR', PHP_PCRE_NO_ERROR)
-    .REGISTER_LONG_CONSTANT(cst, 'PREG_INTERNAL_ERROR', 
PHP_PCRE_INTERNAL_ERROR)
-    .REGISTER_LONG_CONSTANT(cst, 'PREG_BACKTRACK_LIMIT_ERROR', 
PHP_PCRE_BACKTRACK_LIMIT_ERROR)
-    .REGISTER_LONG_CONSTANT(cst, 'PREG_RECURSION_LIMIT_ERROR', 
PHP_PCRE_RECURSION_LIMIT_ERROR)
-    .REGISTER_LONG_CONSTANT(cst, 'PREG_BAD_UTF8_ERROR', 
PHP_PCRE_BAD_UTF8_ERROR)
+    .REGISTER_LONG_CONSTANT('PREG_PATTERN_ORDER', PREG_PATTERN_ORDER)
+    .REGISTER_LONG_CONSTANT('PREG_SET_ORDER', PREG_SET_ORDER)
+    .REGISTER_LONG_CONSTANT('PREG_OFFSET_CAPTURE', PREG_OFFSET_CAPTURE)
+    .REGISTER_LONG_CONSTANT('PREG_SPLIT_NO_EMPTY', PREG_SPLIT_NO_EMPTY)
+    .REGISTER_LONG_CONSTANT('PREG_SPLIT_DELIM_CAPTURE', 
PREG_SPLIT_DELIM_CAPTURE)
+    .REGISTER_LONG_CONSTANT('PREG_SPLIT_OFFSET_CAPTURE', 
PREG_SPLIT_OFFSET_CAPTURE)
+    .REGISTER_LONG_CONSTANT('PREG_GREP_INVERT', PREG_GREP_INVERT)
+
+    .REGISTER_LONG_CONSTANT('PREG_NO_ERROR', PHP_PCRE_NO_ERROR)
+    .REGISTER_LONG_CONSTANT('PREG_INTERNAL_ERROR', PHP_PCRE_INTERNAL_ERROR)
+    .REGISTER_LONG_CONSTANT('PREG_BACKTRACK_LIMIT_ERROR', 
PHP_PCRE_BACKTRACK_LIMIT_ERROR)
+    .REGISTER_LONG_CONSTANT('PREG_RECURSION_LIMIT_ERROR', 
PHP_PCRE_RECURSION_LIMIT_ERROR)
+    .REGISTER_LONG_CONSTANT('PREG_BAD_UTF8_ERROR', PHP_PCRE_BAD_UTF8_ERROR)
     $P0 = get_global ['PCRE'], 'version'
     $S0= $P0()
-    .REGISTER_STRING_CONSTANT(cst, 'PCRE_VERSION', $S0)
+    .REGISTER_STRING_CONSTANT('PCRE_VERSION', $S0)
 .end
 
 

Reply via email to