[svn:parrot] r43841 - branches/opengl_dynamic_nci/tools/build
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Wed Feb 10 01:45:10 UTC 2010
Author: plobsing
Date: Wed Feb 10 01:45:09 2010
New Revision: 43841
URL: https://trac.parrot.org/parrot/changeset/43841
Log:
add --core option to create nci thunk files suitable for core. handle CONST_STRING correctly outside of core.
Modified:
branches/opengl_dynamic_nci/tools/build/nativecall.pir
Modified: branches/opengl_dynamic_nci/tools/build/nativecall.pir
==============================================================================
--- branches/opengl_dynamic_nci/tools/build/nativecall.pir Wed Feb 10 01:06:36 2010 (r43840)
+++ branches/opengl_dynamic_nci/tools/build/nativecall.pir Wed Feb 10 01:45:09 2010 (r43841)
@@ -86,7 +86,7 @@
.macro_const THUNK_NAME_PROTO 'thunk-name-proto'
.macro_const LOADER_STORAGE_CLASS 'loader-storage-class'
.macro_const LOADER_NAME 'loader-name'
-
+.macro_const CORE 'core'
.sub 'get_options'
.param pmc argv
@@ -97,6 +97,7 @@
getopt = new ['Getopt';'Obj']
push getopt, 'help|h'
push getopt, 'version|v'
+ push getopt, 'core'
push getopt, 'target=s'
push getopt, 'thunk-storage-class=s'
push getopt, 'thunk-name-proto=s'
@@ -139,6 +140,7 @@
Options
--help print this message and exit
--version print the version number of this utility
+ --core output a thunks file suitable for inclusion in Parrot core. Default is no.
--target <target> select what to output (valid options are 'head', 'thunks',
'loader', 'coda', 'all', 'names', and 'signatures'). Default value is 'all'
--thunk-storage-class <storage class>
@@ -164,6 +166,14 @@
.sub 'fixup_opts'
.param pmc opts
+ $I0 = defined opts['core']
+ if $I0 goto in_core
+ opts['core'] = ''
+ goto end_core
+ in_core:
+ opts['core'] = 'true'
+ end_core:
+
$I0 = defined opts['target']
if $I0 goto end_target
opts['target'] = 'all'
@@ -220,7 +230,18 @@
.sub 'get_head'
.param pmc ignored :slurpy
- .return (<<'HEAD')
+
+ .local string in_core
+ in_core = 'read_from_opts'(.CORE)
+
+ .local string ext_defn
+ ext_defn = ''
+ if in_core goto end_ext_defn
+ ext_defn = '#define PARROT_IN_EXTENSION'
+ end_ext_defn:
+
+ .local string head
+ head = 'sprintf'(<<'HEAD', ext_defn)
/* ex: set ro ft=c:
* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
*
@@ -243,13 +264,16 @@
* References:
*/
-#define PARROT_IN_EXTENSION
+%s
#include "parrot/parrot.h"
#include "pmc/pmc_nci.h"
-#ifdef PARROT_IN_CORE
-/* external libraries don't have to care about string subsystem */
-# include "nci.str"
+
+#ifdef PARROT_IN_EXTENSION
+/* external libraries can't have strings statically compiled into parrot */
+# define CONST_STRING(i, s) Parrot_str_new_constant(i, s)
+#else
+# include "core.str"
#endif
/* HEADERIZER HFILE: none */
@@ -259,6 +283,7 @@
hackish, but that is just fine */
HEAD
+ .return (head)
.end
.sub 'get_thunks'
More information about the parrot-commits
mailing list