Ticket #343: coretypes.patch

File coretypes.patch, 10.5 KB (added by NotFound, 5 years ago)
  • src/embed.c

     
    2222#include "parrot/embed.h" 
    2323#include "parrot/oplib/ops.h" 
    2424 
     25#include "../compilers/imcc/imc.h" 
     26 
    2527/* HEADERIZER HFILE: none */ /* The visible types are different than what we use in here */ 
    2628 
    2729/* HEADERIZER BEGIN: static */ 
     
    12521254 
    12531255/* 
    12541256 
     1257=item C<Parrot_PMC Parrot_compile_string> 
     1258 
     1259Compile code string. 
     1260 
     1261=cut 
     1262 
     1263*/ 
     1264 
     1265PARROT_EXPORT 
     1266Parrot_PMC 
     1267Parrot_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 
    12551295=back 
    12561296 
    12571297=head1 SEE ALSO 
  • src/inter_misc.c

     
    152152 
    153153/* 
    154154 
    155 =item C<PMC * Parrot_compile_string> 
    156  
    157 Compile code string. 
    158  
    159 =cut 
    160  
    161 */ 
    162  
    163 PARROT_EXPORT 
    164 PARROT_WARN_UNUSED_RESULT 
    165 PARROT_CAN_RETURN_NULL 
    166 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 pbc 
    173      * before compiling a string 
    174      */ 
    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 a 
    179          * runtime check 
    180          */ 
    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  
    196155=item C<void * Parrot_compile_file> 
    197156 
    198157Compile code file. 
  • MANIFEST

     
    11# ex: set ro: 
    22# $Id$ 
    33# 
    4 # generated by tools/dev/mk_manifest_and_skip.pl Mon Feb 16 07:09:26 2009 UT 
     4# generated by tools/dev/mk_manifest_and_skip.pl Mon Feb 16 19:00:35 2009 UT 
    55# 
    66# See tools/dev/install_files.pl for documentation on the 
    77# format of this file. 
     
    897897include/parrot/cclass.h                                     [main]include 
    898898include/parrot/charset.h                                    [main]include 
    899899include/parrot/compiler.h                                   [main]include 
     900include/parrot/core_types.h                                 [main]include 
    900901include/parrot/datatypes.h                                  [main]include 
    901902include/parrot/debugger.h                                   [main]include 
    902903include/parrot/dynext.h                                     [main]include 
  • MANIFEST.SKIP

     
    11# ex: set ro: 
    22# $Id$ 
    3 # generated by tools/dev/mk_manifest_and_skip.pl Mon Feb 16 06:10:54 2009 UT 
     3# generated by tools/dev/mk_manifest_and_skip.pl Mon Feb 16 19:00:35 2009 UT 
    44# 
    55# This file should contain a transcript of the svn:ignore properties 
    66# of the directories in the Parrot subversion repository. (Needed for 
     
    973973^lib/Parrot/Config/Generated\.pm$ 
    974974^lib/Parrot/Config/Generated\.pm/ 
    975975# generated from svn:ignore of 'lib/Parrot/Pmc2c/' 
    976 ^lib/Parrot/Pmc2c/PCCMETHOD_BITS\.pl$ 
    977 ^lib/Parrot/Pmc2c/PCCMETHOD_BITS\.pl/ 
     976^lib/Parrot/Pmc2c/PCCMETHOD_BITS\.pm$ 
     977^lib/Parrot/Pmc2c/PCCMETHOD_BITS\.pm/ 
    978978# generated from svn:ignore of 'runtime/parrot/dynext/' 
    979979^runtime/parrot/dynext/.*\.bundle$ 
    980980^runtime/parrot/dynext/.*\.bundle/ 
  • include/parrot/parrot.h

     
    1818#ifndef PARROT_PARROT_H_GUARD 
    1919#define PARROT_PARROT_H_GUARD 
    2020 
     21#include "parrot/core_types.h" 
     22 
    2123#if defined(INSIDE_GLOBAL_SETUP) 
    2224#  define VAR_SCOPE 
    2325#else 
     
    116118#define OPCODE_TYPE_JAVA 4871757 
    117119#define OPCODE_TYPE_MSNET 0x2e4e4554 
    118120 
    119 typedef struct PMC PMC; 
    120121typedef void STRING_FUNCS; 
    121122typedef struct parrot_interp_t Interp; 
    122123 
  • include/parrot/embed.h

     
    1515#ifndef PARROT_EMBED_H_GUARD 
    1616#define PARROT_EMBED_H_GUARD 
    1717 
     18#include "parrot/core_types.h"  /* types used */ 
    1819#include "parrot/compiler.h"    /* compiler capabilities */ 
    1920#include "parrot/config.h"      /* PARROT_VERSION, PARROT_JIT_CAPABLE... */ 
    2021#include "parrot/interpreter.h" /* give us the interpreter flags */ 
     
    5960 
    6061PARROT_EXPORT void Parrot_runcode(Parrot_Interp, int argc, char **argv); 
    6162 
     63PARROT_EXPORT Parrot_PMC Parrot_compile_string(Parrot_Interp, 
     64        Parrot_String type, const char *code, Parrot_String *error); 
     65 
    6266PARROT_EXPORT void Parrot_destroy(Parrot_Interp); 
    6367 
    6468PARROT_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 
     12typedef struct PMC PMC; 
     13typedef PMC *Parrot_PMC; 
     14 
     15struct parrot_string_t; 
     16typedef struct parrot_string_t *Parrot_String; 
     17 
     18struct parrot_interp_t; 
     19typedef 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

     
    1313#ifndef PARROT_STRING_H_GUARD 
    1414#define PARROT_STRING_H_GUARD 
    1515 
     16#include "parrot/core_types.h" 
    1617#include "parrot/config.h" 
    1718 
    18 struct parrot_string_t; 
    19  
    2019#ifdef PARROT_IN_CORE 
    2120 
    2221#include "parrot/pobj.h" 
  • include/parrot/interpreter.h

     
    110110 
    111111#ifdef PARROT_IN_CORE 
    112112 
    113 #define Parrot_String   STRING * 
    114 #define Parrot_PMC      PMC * 
    115113#define Parrot_Language Parrot_Int 
    116114#define Parrot_Vtable struct _vtable* 
    117115 
    118 typedef struct parrot_interp_t *Parrot_Interp; 
    119  
    120116typedef Parrot_Interp_flag Interp_flags; 
    121117typedef Parrot_Run_core_t Run_Cores; 
    122118 
     
    610606        FUNC_MODIFIES(*error); 
    611607 
    612608PARROT_EXPORT 
    613 PARROT_WARN_UNUSED_RESULT 
    614 PARROT_CAN_RETURN_NULL 
    615 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_EXPORT 
    626609void Parrot_compreg(PARROT_INTERP, 
    627610    ARGIN(STRING *type), 
    628611    NOTNULL(Parrot_compiler_func_t func)) 
     
    675658       PARROT_ASSERT_ARG(interp) \ 
    676659    || PARROT_ASSERT_ARG(fullname) \ 
    677660    || 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) 
    683661#define ASSERT_ARGS_Parrot_compreg __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 
    684662       PARROT_ASSERT_ARG(interp) \ 
    685663    || PARROT_ASSERT_ARG(type) \ 
     
    728706 
    729707#else /* !PARROT_IN_CORE */ 
    730708 
    731 struct Parrot_Interp_; 
    732 typedef struct Parrot_Interp_ *Parrot_Interp; 
    733  
    734709typedef void * *(*native_func_t)(PARROT_INTERP, 
    735710                                 void *cur_opcode, 
    736711                                 void *start_code); 
  • include/parrot/extend.h

     
    1616#define PARROT_EXTEND_H_GUARD 
    1717 
    1818#include <stdarg.h> 
     19#include "parrot/core_types.h" 
    1920#include "parrot/config.h"      /* PARROT_VERSION, PARROT_JIT_CAPABLE... */ 
    2021#include "parrot/interpreter.h" /* give us the interpreter flags */ 
    2122#include "parrot/warnings.h"    /* give us the warnings flags    */ 
     
    2627   but that would be really annoying */ 
    2728#if defined(PARROT_IN_CORE) 
    2829 
    29 #define Parrot_String STRING * 
    30 #define Parrot_PMC PMC * 
    3130#define Parrot_Language Parrot_Int 
    3231#define Parrot_VTABLE VTABLE * 
    3332 
     
    4342 
    4443#else 
    4544 
    46 typedef void * Parrot_String; 
    47 typedef void * Parrot_PMC; 
    4845typedef Parrot_Int Parrot_Language; 
    4946typedef void * Parrot_Encoding; 
    5047typedef void * Parrot_CharType; 
  • t/src/embed.t

     
    6464 
    6565#include "parrot/embed.h" 
    6666#include "parrot/extend.h" 
    67 #include "parrot/interpreter.h" 
    6867 
    6968void fail(const char *msg); 
    7069 
     
    7978    Parrot_Interp interp; 
    8079    Parrot_String compiler; 
    8180    Parrot_String errstr; 
    82     Parrot_PMC *code; 
     81    Parrot_PMC code; 
    8382 
    8483    /* Create the interprter and show a message using parrot io */ 
    8584    interp = Parrot_new(NULL);