Author: chromatic
Date: Sun May 13 13:42:55 2007
New Revision: 18526
Modified:
trunk/compilers/imcc/parser_util.c
trunk/examples/compilers/japhc.c
trunk/include/parrot/interpreter.h
trunk/include/parrot/pobj.h
trunk/include/parrot/sub.h
trunk/languages/lua/pmc/lua.pmc
trunk/src/call_list.txt
trunk/src/debug.c
trunk/src/dynpmc/subproxy.pmc
trunk/src/embed.c
trunk/src/exceptions.c
trunk/src/gc/register.c
trunk/src/headers.c
trunk/src/inter_call.c
trunk/src/jit.c
trunk/src/ops/debug.ops
trunk/src/ops/pic.ops
trunk/src/packdump.c
trunk/src/packfile.c
trunk/src/packout.c
trunk/src/pbc_merge.c
trunk/src/pmc/eval.pmc
trunk/src/stacks.c
trunk/src/string.c
trunk/src/sub.c
Log:
Use typedefs for Parrot-defined structs outside of headers.
Note that this required renaming a function Parrot_Context_info() to
Parrot_Context_get_info(), so as to avoid a confusing name collision.
Modified: trunk/compilers/imcc/parser_util.c
==============================================================================
--- trunk/compilers/imcc/parser_util.c (original)
+++ trunk/compilers/imcc/parser_util.c Sun May 13 13:42:55 2007
@@ -596,7 +596,7 @@
char name[64];
PackFile_ByteCode *old_cs, *new_cs;
PMC *sub=NULL;
- parrot_sub_t sub_data;
+ Parrot_sub *sub_data;
struct _imc_info_t *imc_info = NULL;
struct parser_state_t *next;
DECL_CONST_CAST;
Modified: trunk/examples/compilers/japhc.c
==============================================================================
--- trunk/examples/compilers/japhc.c (original)
+++ trunk/examples/compilers/japhc.c Sun May 13 13:42:55 2007
@@ -117,7 +117,7 @@
opcode_t* pc;
const char *p;
PMC *sub;
- parrot_sub_t sub_data;
+ Parrot_sub *sub_data;
#define CODE_SIZE 128
cdebug((stderr, "japh_compiler '%s'\n", program));
Modified: trunk/include/parrot/interpreter.h
==============================================================================
--- trunk/include/parrot/interpreter.h (original)
+++ trunk/include/parrot/interpreter.h Sun May 13 13:42:55 2007
@@ -240,6 +240,8 @@
size_t pred_offset;
} parrot_context_t;
+typedef parrot_context_t Parrot_Context;
+
struct _Thread_data; /* in thread.h */
struct _Caches; /* caches .h */
Modified: trunk/include/parrot/pobj.h
==============================================================================
--- trunk/include/parrot/pobj.h (original)
+++ trunk/include/parrot/pobj.h Sun May 13 13:42:55 2007
@@ -149,7 +149,7 @@
struct _Sync; /* forward decl */
-struct PMC_EXT {
+typedef struct PMC_EXT {
#if PMC_DATA_IN_EXT
DPOINTER *data;
#endif /* PMC_DATA_IN_EXT */
@@ -177,9 +177,7 @@
stuff, which'd merit an extra dereference when setting, but let
us memset the actual GC data in a big block
*/
-};
-
-typedef struct PMC_EXT PMC_EXT;
+} PMC_EXT;
#ifdef NDEBUG
# define PMC_ext_checked(pmc) (pmc)->pmc_ext
Modified: trunk/include/parrot/sub.h
==============================================================================
--- trunk/include/parrot/sub.h (original)
+++ trunk/include/parrot/sub.h Sun May 13 13:42:55 2007
@@ -142,9 +142,9 @@
/* - end common */
struct Parrot_Context *outer_ctx; /* outer context, if a closure */
-} * parrot_sub_t;
+} Parrot_sub;
-#define PMC_sub(pmc) ((parrot_sub_t)PMC_struct_val(pmc))
+#define PMC_sub(pmc) ((Parrot_sub *)PMC_struct_val(pmc))
/* the first entries must match Parrot_sub, so we can cast
* these two to the other type
@@ -176,9 +176,9 @@
struct PackFile_ByteCode *caller_seg; /* bytecode segment */
opcode_t *address; /* next address to run - toggled each time */
struct Stack_Chunk *dynamic_state; /* next dynamic state */
-} * parrot_coro_t;
+} Parrot_coro;
-#define PMC_coro(pmc) ((parrot_coro_t)PMC_struct_val(pmc))
+#define PMC_coro(pmc) ((Parrot_coro *)PMC_struct_val(pmc))
typedef struct Parrot_cont {
/* continuation destination */
@@ -191,11 +191,11 @@
opcode_t *current_results; /* ptr into code with get_results opcode
full continuation only */
int runloop_id; /* id of the creating runloop. */
-} * parrot_cont_t;
+} Parrot_cont;
-#define PMC_cont(pmc) ((parrot_cont_t)PMC_struct_val(pmc))
+#define PMC_cont(pmc) ((Parrot_cont *)PMC_struct_val(pmc))
-struct Parrot_Context_info {
+typedef struct Parrot_Context_info {
STRING* subname;
STRING* nsname;
STRING* fullname;
@@ -203,7 +203,7 @@
char *file;
int line;
opcode_t *address;
-};
+} Parrot_Context_info;
struct Parrot_sub * new_sub(Interp * interp);
struct Parrot_sub * new_closure(Interp * interp);
@@ -218,7 +218,7 @@
void invalidate_retc_context(Interp *interp, PMC *cont);
PARROT_API STRING* Parrot_full_sub_name(Interp *interp, PMC* sub);
-PARROT_API int Parrot_Context_info(Interp *interp, parrot_context_t *, struct
Parrot_Context_info *);
+PARROT_API int Parrot_Context_get_info(Interp *interp, parrot_context_t *,
Parrot_Context_info *);
PARROT_API STRING* Parrot_Context_infostr(Interp *interp, parrot_context_t *);
PARROT_API PMC* Parrot_find_pad(Interp*, STRING *lex_name, parrot_context_t *);
Modified: trunk/languages/lua/pmc/lua.pmc
==============================================================================
--- trunk/languages/lua/pmc/lua.pmc (original)
+++ trunk/languages/lua/pmc/lua.pmc Sun May 13 13:42:55 2007
@@ -33,7 +33,7 @@
STRING *res = NULL;
Parrot_block_DOD(interp);
- if (Parrot_Context_info(interp, ctx, &info)) {
+ if (Parrot_Context_get_info(interp, ctx, &info)) {
char *file = info.file;
res = Parrot_sprintf_c(interp, "\t%s:%d in function '%Ss'\n",
file, info.line, info.fullname);
@@ -89,7 +89,7 @@
if (PMC_metadata(ctx->current_sub) != NULL) {
struct Parrot_Context_info info;
Parrot_block_DOD(INTERP);
- if (Parrot_Context_info(INTERP, ctx, &info)) {
+ if (Parrot_Context_get_info(INTERP, ctx, &info)) {
/* free the non-constant string, but not the constant one
*/
if (strncmp( "(unknown file)", info.file, 14 ) < 0 )
string_cstring_free(info.file);
@@ -261,7 +261,7 @@
&& VTABLE_isa(INTERP, sub, const_string(INTERP, "LuaClosure")) )
{
struct Parrot_Context_info info;
Parrot_block_DOD(INTERP);
- if (Parrot_Context_info(INTERP, ctx, &info)) {
+ if (Parrot_Context_get_info(INTERP, ctx, &info)) {
STRING* res = Parrot_sprintf_c(INTERP, "%s:%d:",
info.file, info.line);
/* free the non-constant string, but not the constant one
*/
Modified: trunk/src/call_list.txt
==============================================================================
--- trunk/src/call_list.txt (original)
+++ trunk/src/call_list.txt Sun May 13 13:42:55 2007
@@ -425,3 +425,7 @@
# win32
l lttl
+
+i pip
+i piS
+S i
Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c (original)
+++ trunk/src/debug.c Sun May 13 13:42:55 2007
@@ -2399,7 +2399,7 @@
/* backtrace: follow the continuation chain */
while (1) {
- parrot_cont_t sub_cont;
+ Parrot_cont *sub_cont;
sub = ctx->current_cont;
if (!sub)
break;
Modified: trunk/src/dynpmc/subproxy.pmc
==============================================================================
--- trunk/src/dynpmc/subproxy.pmc (original)
+++ trunk/src/dynpmc/subproxy.pmc Sun May 13 13:42:55 2007
@@ -45,12 +45,9 @@
internal_exception(1, "SubProxy: sub not found");
PObj_get_FLAGS(SELF) &= ~PObj_private0_FLAG;
- ((parrot_sub_t)(PMC_sub(SELF))) ->seg =
- ((parrot_sub_t)(PMC_sub(rsub))) ->seg;
- ((parrot_sub_t)(PMC_sub(SELF))) ->start_offs =
- ((parrot_sub_t)(PMC_sub(rsub))) ->start_offs;
- ((parrot_sub_t)(PMC_sub(SELF))) ->end_offs =
- ((parrot_sub_t)(PMC_sub(rsub))) ->end_offs;
+ PMC_sub(SELF)->seg = PMC_sub(rsub)->seg;
+ PMC_sub(SELF)->start_offs = PMC_sub(rsub)->start_offs;
+ PMC_sub(SELF)->end_offs = PMC_sub(rsub)->end_offs;
}
return SUPER(next);
}
Modified: trunk/src/embed.c
==============================================================================
--- trunk/src/embed.c (original)
+++ trunk/src/embed.c Sun May 13 13:42:55 2007
@@ -671,7 +671,7 @@
PackFile_ByteCode *cur_cs;
PackFile_FixupTable *ft;
PackFile_ConstTable *ct;
- struct Parrot_sub *sub;
+ Parrot_sub *sub;
PMC *sub_pmc;
opcode_t *code_start;
size_t offs;
Modified: trunk/src/exceptions.c
==============================================================================
--- trunk/src/exceptions.c (original)
+++ trunk/src/exceptions.c Sun May 13 13:42:55 2007
@@ -313,8 +313,8 @@
void
pop_exception(Interp *interp)
{
- Stack_entry_type type;
- struct Parrot_cont * cc;
+ Stack_entry_type type;
+ Parrot_cont *cc;
PMC * const handler
= (PMC *)stack_peek(interp, interp->dynamic_env, &type);
Modified: trunk/src/gc/register.c
==============================================================================
--- trunk/src/gc/register.c (original)
+++ trunk/src/gc/register.c Sun May 13 13:42:55 2007
@@ -438,7 +438,8 @@
#ifndef NDEBUG
if (Interp_debug_TEST(interp, PARROT_CTX_DESTROY_DEBUG_FLAG)) {
/* can't probably PIO_eprintf here */
- parrot_sub_t doomed = PMC_sub(ctxp->current_sub);
+ Parrot_sub *doomed;
+ doomed = PMC_sub(ctxp->current_sub);
fprintf(stderr, "[free ctx %p of sub '%s']\n",
(void *)ctxp,
Modified: trunk/src/headers.c
==============================================================================
--- trunk/src/headers.c (original)
+++ trunk/src/headers.c Sun May 13 13:42:55 2007
@@ -328,7 +328,7 @@
if (!PObj_is_PMC_EXT_TEST(pmc)) {
add_pmc_ext(interp, pmc);
}
- PMC_sync(pmc) = (struct _Sync *)mem_internal_allocate(sizeof
(*PMC_sync(pmc)));
+ PMC_sync(pmc) = (Sync *)mem_internal_allocate(sizeof (*PMC_sync(pmc)));
PMC_sync(pmc)->owner = interp;
MUTEX_INIT(PMC_sync(pmc)->pmc_lock);
}
@@ -571,7 +571,7 @@
/* pmc extension buffer */
arena_base->pmc_ext_pool =
- new_small_object_pool(interp, sizeof (struct PMC_EXT), 1024);
+ new_small_object_pool(interp, sizeof (PMC_EXT), 1024);
/*
* pmc_ext isn't a managed item. If a PMC has a pmc_ext structure
* it is returned to the pool instantly - the structure is never
Modified: trunk/src/inter_call.c
==============================================================================
--- trunk/src/inter_call.c (original)
+++ trunk/src/inter_call.c Sun May 13 13:42:55 2007
@@ -72,15 +72,14 @@
int
Parrot_init_ret_nci(Interp *interp, call_state *st, const char *sig)
{
- struct Parrot_Context *ctx = CONTEXT(interp->ctx);
- PMC *current_cont = ctx->current_cont;
+ Parrot_Context *ctx = CONTEXT(interp->ctx);
+ PMC *current_cont = ctx->current_cont;
/*
* if this NCI call was a taicall, return results to caller's get_results
* this also means that we pass the caller's register base pointer
*/
- if (SUB_FLAG_TAILCALL_ISSET(current_cont)) {
+ if (SUB_FLAG_TAILCALL_ISSET(current_cont))
ctx = PMC_cont(current_cont)->to_ctx;
- }
/* TODO simplify all */
Parrot_init_arg_sig(interp, CONTEXT(interp->ctx), sig, NULL, &st->src);
Modified: trunk/src/jit.c
==============================================================================
--- trunk/src/jit.c (original)
+++ trunk/src/jit.c Sun May 13 13:42:55 2007
@@ -1292,7 +1292,7 @@
PackFile_FixupTable *ft;
PackFile_ConstTable *ct;
PMC *sub_pmc;
- parrot_sub_t sub;
+ Parrot_sub *sub;
int i, ci;
size_t offs;
Modified: trunk/src/ops/debug.ops
==============================================================================
--- trunk/src/ops/debug.ops (original)
+++ trunk/src/ops/debug.ops Sun May 13 13:42:55 2007
@@ -155,8 +155,8 @@
=cut
inline op getline(out INT) {
- struct Parrot_Context_info info;
- Parrot_Context_info(interp, CONTEXT(interp->ctx), &info);
+ Parrot_Context_info info;
+ Parrot_Context_get_info(interp, CONTEXT(interp->ctx), &info);
$1 = info.line;
goto NEXT();
}
@@ -168,8 +168,8 @@
=cut
inline op getfile(out STR) {
- struct Parrot_Context_info info;
- Parrot_Context_info(interp, CONTEXT(interp->ctx), &info);
+ Parrot_Context_info info;
+ Parrot_Context_get_info(interp, CONTEXT(interp->ctx), &info);
$1 = string_from_cstring(interp, info.file, 0);
goto NEXT();
}
Modified: trunk/src/ops/pic.ops
==============================================================================
--- trunk/src/ops/pic.ops (original)
+++ trunk/src/ops/pic.ops Sun May 13 13:42:55 2007
@@ -192,7 +192,7 @@
opcode_t *dest_pc;
void **dest_pred;
parrot_context_t *caller_ctx, *ctx;
- parrot_cont_t cc;
+ Parrot_cont *cc;
int n;
ctx = CONTEXT(interp->ctx);
Modified: trunk/src/packdump.c
==============================================================================
--- trunk/src/packdump.c (original)
+++ trunk/src/packdump.c Sun May 13 13:42:55 2007
@@ -71,7 +71,7 @@
PackFile_Constant_dump(Interp *interp, PackFile_ConstTable *ct,
PackFile_Constant *self)
{
- struct PMC *key;
+ PMC *key;
size_t i;
size_t ct_index;
opcode_t slice_bits;
@@ -181,7 +181,7 @@
PIO_printf(interp, " [ 'PFC_PMC', {\n");
{
PMC *pmc = self->u.key;
- parrot_sub_t sub;
+ Parrot_sub *sub;
STRING *a_key = const_string(interp, "(keyed)");
STRING *null = const_string(interp, "(null)");
STRING *namespace_description;
Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c (original)
+++ trunk/src/packfile.c Sun May 13 13:42:55 2007
@@ -283,7 +283,7 @@
{
size_t start_offs;
- struct Parrot_sub * const sub = PMC_sub(sub_pmc);
+ Parrot_sub const * sub = PMC_sub(sub_pmc);
PMC *result;
void *lo_var_ptr;
Modified: trunk/src/packout.c
==============================================================================
--- trunk/src/packout.c (original)
+++ trunk/src/packout.c Sun May 13 13:42:55 2007
@@ -219,7 +219,7 @@
PackFile_Constant_pack(Interp* interp, PackFile_ConstTable * const_table,
PackFile_Constant *self, opcode_t *cursor)
{
- struct PMC *key;
+ PMC *key;
size_t i;
opcode_t slice_bits;
STRING *image;
Modified: trunk/src/pbc_merge.c
==============================================================================
--- trunk/src/pbc_merge.c (original)
+++ trunk/src/pbc_merge.c Sun May 13 13:42:55 2007
@@ -39,7 +39,7 @@
/* This struct describes an input file. */
-struct pbc_merge_input
+typedef struct pbc_merge_input
{
char *filename; /* Filename of the input file. */
PackFile *pf; /* The loaded packfile. */
@@ -47,8 +47,7 @@
bytecode. */
opcode_t const_start; /* Where the const table is located in the merged
one. */
-};
-
+} pbc_merge_input;
/*
@@ -158,7 +157,7 @@
/*
static PackFile_ByteCode*
-pbc_merge_bytecode(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_bytecode(Interp *interp, pbc_merge_input **inputs,
int num_inputs, PackFile *pf)
This function merges the bytecode from the input packfiles, storing the
@@ -166,7 +165,7 @@
*/
static PackFile_ByteCode*
-pbc_merge_bytecode(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_bytecode(Interp *interp, pbc_merge_input **inputs,
int num_inputs, PackFile *pf)
{
PackFile_ByteCode *bc_seg;
@@ -225,14 +224,14 @@
/*
static PackFile_ConstTable*
-pbc_merge_constants(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_constants(Interp *interp, pbc_merge_input **inputs,
int num_inputs, PackFile *pf, PackFile_ByteCode *bc)
This function merges the constants tables from the input PBC files.
*/
static PackFile_ConstTable*
-pbc_merge_constants(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_constants(Interp *interp, pbc_merge_input **inputs,
int num_inputs, PackFile *pf, PackFile_ByteCode *bc)
{
PackFile_ConstTable *const_seg;
@@ -297,7 +296,7 @@
/* If it's a sub PMC, need to deal with offsets. */
if (copy->type == PFC_PMC)
{
- struct Parrot_sub *sub;
+ Parrot_sub *sub;
switch (copy->u.key->vtable->base_type) {
case enum_class_Sub:
case enum_class_Closure:
@@ -327,14 +326,14 @@
/*
static void
-pbc_merge_fixups(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_fixups(Interp *interp, pbc_merge_input **inputs,
int num_inputs, PackFile *pf, PackFile_ByteCode *bc)
This function merges the fixups tables from the input PBC files.
*/
static void
-pbc_merge_fixups(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_fixups(Interp *interp, pbc_merge_input **inputs,
int num_inputs, PackFile *pf, PackFile_ByteCode *bc)
{
PackFile_FixupTable *fixup_seg;
@@ -429,14 +428,14 @@
/*
static void
-pbc_merge_debugs(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_debugs(Interp *interp, pbc_merge_input **inputs,
int num_inputs, PackFile *pf, PackFile_ByteCode *bc)
This function merges the debug segments from the input PBC files.
*/
static void
-pbc_merge_debugs(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_debugs(Interp *interp, pbc_merge_input **inputs,
int num_inputs, PackFile *pf, PackFile_ByteCode *bc)
{
PackFile_Debug *debug_seg;
@@ -501,7 +500,7 @@
/*
static void
-pbc_merge_pic_index(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_pic_index(Interp *interp, pbc_merge_input **inputs,
int num_inputs, PackFile *pf, PackFile_ByteCode *bc)
This function merges the pic_index segments from the input PBC files.
@@ -509,7 +508,7 @@
*/
static void
-pbc_merge_pic_index(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_pic_index(Interp *interp, pbc_merge_input **inputs,
int num_inputs, PackFile *pf, PackFile_ByteCode *bc)
{
int i;
@@ -550,7 +549,7 @@
/*
static void
-pbc_merge_ctpointers(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_ctpointers(Interp *interp, pbc_merge_input **inputs,
int num_inputs, PackFile *pf, PackFile_ByteCode *bc,
PackFile_ConstTable *ct)
@@ -559,7 +558,7 @@
*/
static void
-pbc_merge_ctpointers(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_ctpointers(Interp *interp, pbc_merge_input **inputs,
int num_inputs, PackFile *pf, PackFile_ByteCode *bc,
PackFile_ConstTable *ct)
{
@@ -635,14 +634,14 @@
/*
static PackFile*
-pbc_merge_begin(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_begin(Interp *interp, pbc_merge_input **inputs,
int num_inputs)
This is the function that drives PBC merging process.
*/
static PackFile*
-pbc_merge_begin(Interp *interp, struct pbc_merge_input **inputs,
+pbc_merge_begin(Interp *interp, pbc_merge_input **inputs,
int num_inputs)
{
PackFile *merged;
@@ -733,7 +732,7 @@
{
Interp *interp;
int status;
- struct pbc_merge_input** input_files;
+ pbc_merge_input** input_files;
PackFile *merged;
int i;
const char *output_file = NULL;
@@ -769,13 +768,13 @@
/* Load each packfile that we are to merge and set up an input
structure for each of them. */
- input_files = (struct pbc_merge_input **)mem_sys_allocate(
+ input_files = (pbc_merge_input **)mem_sys_allocate(
argc * sizeof (Parrot_Pointer));
for (i = 0; i < argc; i++)
{
/* Allocate a struct. */
- input_files[i] = mem_allocate_typed(struct pbc_merge_input);
+ input_files[i] = mem_allocate_typed(pbc_merge_input);
/* Set filename */
input_files[i]->filename = *argv;
Modified: trunk/src/pmc/eval.pmc
==============================================================================
--- trunk/src/pmc/eval.pmc (original)
+++ trunk/src/pmc/eval.pmc Sun May 13 13:42:55 2007
@@ -22,7 +22,7 @@
#include "parrot/parrot.h"
static void
-clear_fixups(Interp *interp, parrot_sub_t sub_data)
+clear_fixups(Interp *interp, Parrot_sub *sub_data)
{
opcode_t i, ci;
PackFile_ByteCode *seg;
@@ -116,7 +116,7 @@
pmclass Eval extends Sub need_ext {
void init() {
- parrot_sub_t sub_data;
+ Parrot_sub *sub_data;
SUPER();
sub_data = PMC_sub(SELF);
PObj_custom_mark_destroy_SETALL(SELF);
@@ -153,7 +153,7 @@
* OTOH - if the global exists - this eval pmc ought
* to be alive and destroy isn't called.
*/
- parrot_sub_t sub_data;
+ Parrot_sub *sub_data;
PackFile_Segment *seg;
PackFile_ByteCode *cur_cs;
Modified: trunk/src/stacks.c
==============================================================================
--- trunk/src/stacks.c (original)
+++ trunk/src/stacks.c Sun May 13 13:42:55 2007
@@ -418,7 +418,7 @@
=item C<void
Parrot_dump_dynamic_environment(Interp *interp,
- struct Stack_Chunk *dynamic_env)>
+ Stack_Chunk_t *dynamic_env)>
Print a representation of the dynamic stack to the standard error (using
C<PIO_eprintf>). This is used only temporarily for debugging.
@@ -429,7 +429,7 @@
void
Parrot_dump_dynamic_environment(Interp *interp,
- struct Stack_Chunk *dynamic_env)
+ Stack_Chunk_t *dynamic_env)
{
int height = (int) stack_height(interp, dynamic_env);
Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c (original)
+++ trunk/src/string.c Sun May 13 13:42:55 2007
@@ -1865,7 +1865,7 @@
}
p = (char *)mem_sys_allocate(s->bufused + 1);
memcpy(p, s->strstart, s->bufused);
- p[s->bufused] = 0;
+ p[s->bufused] = '\0';
return p;
}
Modified: trunk/src/sub.c
==============================================================================
--- trunk/src/sub.c (original)
+++ trunk/src/sub.c Sun May 13 13:42:55 2007
@@ -77,7 +77,7 @@
/*
-=item C<struct Parrot_sub *
+=item C<Parrot_sub *
new_sub(Interp *interp)>
Returns a new C<Parrot_sub>.
@@ -86,19 +86,18 @@
*/
-struct Parrot_sub *
+Parrot_sub *
new_sub(Interp *interp)
{
/* Using system memory until I figure out GC issues */
- struct Parrot_sub * const newsub =
- mem_allocate_zeroed_typed(struct Parrot_sub);
- newsub->seg = interp->code;
+ Parrot_sub * const newsub = mem_allocate_zeroed_typed(Parrot_sub);
+ newsub->seg = interp->code;
return newsub;
}
/*
-=item C<struct Parrot_sub *
+=item C<Parrot_sub *
new_closure(Interp *interp)>
Returns a new C<Parrot_sub> with its own sctatchpad.
@@ -109,16 +108,16 @@
*/
-struct Parrot_sub *
+Parrot_sub *
new_closure(Interp *interp)
{
- struct Parrot_sub * const newsub = new_sub(interp);
+ Parrot_sub * const newsub = new_sub(interp);
return newsub;
}
/*
-=item C<struct Parrot_cont *
-new_continuation(Interp *interp, struct Parrot_cont *to)>
+=item C<Parrot_cont *
+new_continuation(Interp *interp, Parrot_cont *to)>
Returns a new C<Parrot_cont> to the context of C<to> with its own copy of the
current interpreter context. If C<to> is C<NULL>, then the C<to_ctx> is set
@@ -128,14 +127,11 @@
*/
-
-struct Parrot_cont *
-new_continuation(Interp *interp, struct Parrot_cont *to)
+Parrot_cont *
+new_continuation(Interp *interp, Parrot_cont *to)
{
- struct Parrot_cont * const cc =
- mem_allocate_typed(struct Parrot_cont);
- struct Parrot_Context * const to_ctx =
- to ? to->to_ctx : CONTEXT(interp->ctx);
+ Parrot_cont * const cc = mem_allocate_typed(Parrot_cont);
+ Parrot_Context * const to_ctx = to ? to->to_ctx : CONTEXT(interp->ctx);
cc->to_ctx = to_ctx;
cc->from_ctx = CONTEXT(interp->ctx);
@@ -156,7 +152,7 @@
/*
-=item C<struct Parrot_cont *
+=item C<Parrot_cont *
new_ret_continuation(Interp *interp)>
Returns a new C<Parrot_cont> pointing to the current context.
@@ -165,11 +161,10 @@
*/
-struct Parrot_cont *
+Parrot_cont *
new_ret_continuation(Interp *interp)
{
- struct Parrot_cont * const cc =
- mem_allocate_typed(struct Parrot_cont);
+ Parrot_cont * const cc = mem_allocate_typed(Parrot_cont);
cc->to_ctx = CONTEXT(interp->ctx);
cc->from_ctx = NULL; /* filled in during a call */
cc->dynamic_state = NULL;
@@ -182,7 +177,7 @@
/*
-=item C<struct Parrot_coro *
+=item C<Parrot_coro *
new_coroutine(Interp *interp)>
Returns a new C<Parrot_coro>.
@@ -193,11 +188,10 @@
*/
-struct Parrot_coro *
+Parrot_coro *
new_coroutine(Interp *interp)
{
- struct Parrot_coro * const co =
- mem_allocate_zeroed_typed(struct Parrot_coro);
+ Parrot_coro * const co = mem_allocate_zeroed_typed(Parrot_coro);
co->seg = interp->code;
co->ctx = NULL;
@@ -238,7 +232,7 @@
void
invalidate_retc_context(Interp *interp, PMC *cont)
{
- struct Parrot_Context *ctx = PMC_cont(cont)->from_ctx;
+ Parrot_Context *ctx = PMC_cont(cont)->from_ctx;
Parrot_set_context_threshold(interp, ctx);
while (1) {
@@ -275,7 +269,7 @@
STRING*
Parrot_full_sub_name(Interp *interp, PMC* sub)
{
- struct Parrot_sub * s;
+ Parrot_sub * s;
STRING *res;
@@ -304,10 +298,10 @@
}
int
-Parrot_Context_info(Interp *interp, parrot_context_t *ctx,
- struct Parrot_Context_info *info)
+Parrot_Context_get_info(Interp *interp, parrot_context_t *ctx,
+ Parrot_Context_info *info)
{
- struct Parrot_sub *sub;
+ Parrot_sub *sub;
/* set file/line/pc defaults */
info->file = (char *) "(unknown file)";
@@ -326,7 +320,7 @@
return 0;
}
- /* fetch struct Parrot_sub of the current sub in the given context */
+ /* fetch Parrot_sub of the current sub in the given context */
if (!VTABLE_isa(interp, ctx->current_sub,
const_string(interp, "Sub")))
return 1;
@@ -383,14 +377,14 @@
STRING*
Parrot_Context_infostr(Interp *interp, parrot_context_t *ctx)
{
- struct Parrot_Context_info info;
+ Parrot_Context_info info;
const char* const msg = (CONTEXT(interp->ctx) == ctx) ?
"current instr.:":
"called from Sub";
STRING *res;
Parrot_block_DOD(interp);
- if (Parrot_Context_info(interp, ctx, &info)) {
+ if (Parrot_Context_get_info(interp, ctx, &info)) {
char *file = info.file;
res = Parrot_sprintf_c(interp,
"%s '%Ss' pc %d (%s:%d)", msg,
@@ -451,7 +445,7 @@
parrot_new_closure(Interp *interp, PMC *sub_pmc)
{
PMC *clos_pmc;
- struct Parrot_sub *clos, *sub;
+ Parrot_sub *clos, *sub;
PMC *cont;
parrot_context_t *ctx;