Ticket #343: coretypes.patch
File coretypes.patch, 10.5 KB (added by NotFound, 13 years ago) |
---|
-
src/embed.c
22 22 #include "parrot/embed.h" 23 23 #include "parrot/oplib/ops.h" 24 24 25 #include "../compilers/imcc/imc.h" 26 25 27 /* HEADERIZER HFILE: none */ /* The visible types are different than what we use in here */ 26 28 27 29 /* HEADERIZER BEGIN: static */ … … 1252 1254 1253 1255 /* 1254 1256 1257 =item C<Parrot_PMC Parrot_compile_string> 1258 1259 Compile code string. 1260 1261 =cut 1262 1263 */ 1264 1265 PARROT_EXPORT 1266 Parrot_PMC 1267 Parrot_compile_string(PARROT_INTERP, Parrot_String type, 1268 const char *code, Parrot_String *error) 1269 { 1270 1271 /* For the benefit of embedders that does not load any pbc 1272 * before compiling a string 1273 */ 1274 if (! interp->initial_pf) { 1275 PackFile *pf = PackFile_new_dummy(interp, "compile_string"); 1276 /* Assumption: there is no valid reason to fail to create it. 1277 * If the assumption changes, replace the assertio with a 1278 * runtime check 1279 */ 1280 PARROT_ASSERT(interp->initial_pf); 1281 } 1282 1283 if (Parrot_str_compare(interp, Parrot_str_new(interp, "PIR", 3), type) == 0) 1284 return IMCC_compile_pir_s(interp, code, error); 1285 1286 if (Parrot_str_compare(interp, Parrot_str_new(interp, "PASM", 4), type) == 0) 1287 return IMCC_compile_pasm_s(interp, code, error); 1288 1289 *error = Parrot_str_new(interp, "Invalid interpreter type", 0); 1290 return NULL; 1291 } 1292 1293 /* 1294 1255 1295 =back 1256 1296 1257 1297 =head1 SEE ALSO -
src/inter_misc.c
152 152 153 153 /* 154 154 155 =item C<PMC * Parrot_compile_string>156 157 Compile code string.158 159 =cut160 161 */162 163 PARROT_EXPORT164 PARROT_WARN_UNUSED_RESULT165 PARROT_CAN_RETURN_NULL166 PMC *167 Parrot_compile_string(PARROT_INTERP, ARGIN(STRING *type),168 ARGIN(const char *code), ARGOUT(STRING **error))169 {170 ASSERT_ARGS(Parrot_compile_string)171 172 /* For the benefit of embedders that does not load any pbc173 * before compiling a string174 */175 if (! interp->initial_pf) {176 PackFile *pf = PackFile_new_dummy(interp, "compile_string");177 /* Assumption: there is no valid reason to fail to create it.178 * If the assumption changes, replace the assertio with a179 * runtime check180 */181 PARROT_ASSERT(interp->initial_pf);182 }183 184 if (Parrot_str_compare(interp, CONST_STRING(interp, "PIR"), type) == 0)185 return IMCC_compile_pir_s(interp, code, error);186 187 if (Parrot_str_compare(interp, CONST_STRING(interp, "PASM"), type) == 0)188 return IMCC_compile_pasm_s(interp, code, error);189 190 *error = CONST_STRING(interp, "Invalid interpreter type");191 return NULL;192 }193 194 /*195 196 155 =item C<void * Parrot_compile_file> 197 156 198 157 Compile code file. -
MANIFEST
1 1 # ex: set ro: 2 2 # $Id$ 3 3 # 4 # generated by tools/dev/mk_manifest_and_skip.pl Mon Feb 16 07:09:262009 UT4 # generated by tools/dev/mk_manifest_and_skip.pl Mon Feb 16 19:00:35 2009 UT 5 5 # 6 6 # See tools/dev/install_files.pl for documentation on the 7 7 # format of this file. … … 897 897 include/parrot/cclass.h [main]include 898 898 include/parrot/charset.h [main]include 899 899 include/parrot/compiler.h [main]include 900 include/parrot/core_types.h [main]include 900 901 include/parrot/datatypes.h [main]include 901 902 include/parrot/debugger.h [main]include 902 903 include/parrot/dynext.h [main]include -
MANIFEST.SKIP
1 1 # ex: set ro: 2 2 # $Id$ 3 # generated by tools/dev/mk_manifest_and_skip.pl Mon Feb 16 06:10:542009 UT3 # generated by tools/dev/mk_manifest_and_skip.pl Mon Feb 16 19:00:35 2009 UT 4 4 # 5 5 # This file should contain a transcript of the svn:ignore properties 6 6 # of the directories in the Parrot subversion repository. (Needed for … … 973 973 ^lib/Parrot/Config/Generated\.pm$ 974 974 ^lib/Parrot/Config/Generated\.pm/ 975 975 # generated from svn:ignore of 'lib/Parrot/Pmc2c/' 976 ^lib/Parrot/Pmc2c/PCCMETHOD_BITS\.p l$977 ^lib/Parrot/Pmc2c/PCCMETHOD_BITS\.p l/976 ^lib/Parrot/Pmc2c/PCCMETHOD_BITS\.pm$ 977 ^lib/Parrot/Pmc2c/PCCMETHOD_BITS\.pm/ 978 978 # generated from svn:ignore of 'runtime/parrot/dynext/' 979 979 ^runtime/parrot/dynext/.*\.bundle$ 980 980 ^runtime/parrot/dynext/.*\.bundle/ -
include/parrot/parrot.h
18 18 #ifndef PARROT_PARROT_H_GUARD 19 19 #define PARROT_PARROT_H_GUARD 20 20 21 #include "parrot/core_types.h" 22 21 23 #if defined(INSIDE_GLOBAL_SETUP) 22 24 # define VAR_SCOPE 23 25 #else … … 116 118 #define OPCODE_TYPE_JAVA 4871757 117 119 #define OPCODE_TYPE_MSNET 0x2e4e4554 118 120 119 typedef struct PMC PMC;120 121 typedef void STRING_FUNCS; 121 122 typedef struct parrot_interp_t Interp; 122 123 -
include/parrot/embed.h
15 15 #ifndef PARROT_EMBED_H_GUARD 16 16 #define PARROT_EMBED_H_GUARD 17 17 18 #include "parrot/core_types.h" /* types used */ 18 19 #include "parrot/compiler.h" /* compiler capabilities */ 19 20 #include "parrot/config.h" /* PARROT_VERSION, PARROT_JIT_CAPABLE... */ 20 21 #include "parrot/interpreter.h" /* give us the interpreter flags */ … … 59 60 60 61 PARROT_EXPORT void Parrot_runcode(Parrot_Interp, int argc, char **argv); 61 62 63 PARROT_EXPORT Parrot_PMC Parrot_compile_string(Parrot_Interp, 64 Parrot_String type, const char *code, Parrot_String *error); 65 62 66 PARROT_EXPORT void Parrot_destroy(Parrot_Interp); 63 67 64 68 PARROT_EXPORT Parrot_Opcode * Parrot_debug(Parrot_Interp, Parrot_Interp, Parrot_Opcode *pc); -
include/parrot/core_types.h
1 /* core_types.h 2 * Copyright (C) 2009, Parrot Foundation. 3 * SVN Info 4 * $Id: $ 5 * Overview: 6 * Forward declaration of the interpreter basic types 7 */ 8 9 #ifndef PARROT_CORE_TYPES_H_GUARD 10 #define PARROT_CORE_TYPES_H_GUARD 11 12 typedef struct PMC PMC; 13 typedef PMC *Parrot_PMC; 14 15 struct parrot_string_t; 16 typedef struct parrot_string_t *Parrot_String; 17 18 struct parrot_interp_t; 19 typedef struct parrot_interp_t *Parrot_Interp; 20 21 #endif /* PARROT_CORE_TYPES_H_GUARD */ 22 23 /* 24 * Local variables: 25 * c-file-style: "parrot" 26 * End: 27 * vim: expandtab shiftwidth=4: 28 */ -
include/parrot/string.h
13 13 #ifndef PARROT_STRING_H_GUARD 14 14 #define PARROT_STRING_H_GUARD 15 15 16 #include "parrot/core_types.h" 16 17 #include "parrot/config.h" 17 18 18 struct parrot_string_t;19 20 19 #ifdef PARROT_IN_CORE 21 20 22 21 #include "parrot/pobj.h" -
include/parrot/interpreter.h
110 110 111 111 #ifdef PARROT_IN_CORE 112 112 113 #define Parrot_String STRING *114 #define Parrot_PMC PMC *115 113 #define Parrot_Language Parrot_Int 116 114 #define Parrot_Vtable struct _vtable* 117 115 118 typedef struct parrot_interp_t *Parrot_Interp;119 120 116 typedef Parrot_Interp_flag Interp_flags; 121 117 typedef Parrot_Run_core_t Run_Cores; 122 118 … … 610 606 FUNC_MODIFIES(*error); 611 607 612 608 PARROT_EXPORT 613 PARROT_WARN_UNUSED_RESULT614 PARROT_CAN_RETURN_NULL615 PMC * Parrot_compile_string(PARROT_INTERP,616 ARGIN(STRING *type),617 ARGIN(const char *code),618 ARGOUT(STRING **error))619 __attribute__nonnull__(1)620 __attribute__nonnull__(2)621 __attribute__nonnull__(3)622 __attribute__nonnull__(4)623 FUNC_MODIFIES(*error);624 625 PARROT_EXPORT626 609 void Parrot_compreg(PARROT_INTERP, 627 610 ARGIN(STRING *type), 628 611 NOTNULL(Parrot_compiler_func_t func)) … … 675 658 PARROT_ASSERT_ARG(interp) \ 676 659 || PARROT_ASSERT_ARG(fullname) \ 677 660 || PARROT_ASSERT_ARG(error) 678 #define ASSERT_ARGS_Parrot_compile_string __attribute__unused__ int _ASSERT_ARGS_CHECK = \679 PARROT_ASSERT_ARG(interp) \680 || PARROT_ASSERT_ARG(type) \681 || PARROT_ASSERT_ARG(code) \682 || PARROT_ASSERT_ARG(error)683 661 #define ASSERT_ARGS_Parrot_compreg __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 684 662 PARROT_ASSERT_ARG(interp) \ 685 663 || PARROT_ASSERT_ARG(type) \ … … 728 706 729 707 #else /* !PARROT_IN_CORE */ 730 708 731 struct Parrot_Interp_;732 typedef struct Parrot_Interp_ *Parrot_Interp;733 734 709 typedef void * *(*native_func_t)(PARROT_INTERP, 735 710 void *cur_opcode, 736 711 void *start_code); -
include/parrot/extend.h
16 16 #define PARROT_EXTEND_H_GUARD 17 17 18 18 #include <stdarg.h> 19 #include "parrot/core_types.h" 19 20 #include "parrot/config.h" /* PARROT_VERSION, PARROT_JIT_CAPABLE... */ 20 21 #include "parrot/interpreter.h" /* give us the interpreter flags */ 21 22 #include "parrot/warnings.h" /* give us the warnings flags */ … … 26 27 but that would be really annoying */ 27 28 #if defined(PARROT_IN_CORE) 28 29 29 #define Parrot_String STRING *30 #define Parrot_PMC PMC *31 30 #define Parrot_Language Parrot_Int 32 31 #define Parrot_VTABLE VTABLE * 33 32 … … 43 42 44 43 #else 45 44 46 typedef void * Parrot_String;47 typedef void * Parrot_PMC;48 45 typedef Parrot_Int Parrot_Language; 49 46 typedef void * Parrot_Encoding; 50 47 typedef void * Parrot_CharType; -
t/src/embed.t
64 64 65 65 #include "parrot/embed.h" 66 66 #include "parrot/extend.h" 67 #include "parrot/interpreter.h"68 67 69 68 void fail(const char *msg); 70 69 … … 79 78 Parrot_Interp interp; 80 79 Parrot_String compiler; 81 80 Parrot_String errstr; 82 Parrot_PMC *code;81 Parrot_PMC code; 83 82 84 83 /* Create the interprter and show a message using parrot io */ 85 84 interp = Parrot_new(NULL);