Permalink
Browse files

Continuing Parrot/C++ cleanups (Steve Peters, RT #42746).

git-svn-id: https://svn.parrot.org/parrot/trunk@18339 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 368e650 commit e063e4973803525fc57dcd8f5d358ce1fe3dbab5 @chromatic chromatic committed Apr 26, 2007
View
@@ -57,7 +57,7 @@ typedef struct parrot_io_event {
typedef struct _call_back_info {
PMC* cbi; /* callback info */
- void* external_data;
+ char* external_data;
} _call_back_info;
typedef struct parrot_event {
@@ -94,8 +94,8 @@ PARROT_API void Parrot_new_suspend_for_gc_event(Parrot_Interp);
PARROT_API void disable_event_checking(Parrot_Interp);
PARROT_API void enable_event_checking(Parrot_Interp);
-PARROT_API void Parrot_new_cb_event(Parrot_Interp, PMC* cbi, void*ext);
-PARROT_API void Parrot_run_callback(Parrot_Interp, PMC* cbi, void*ext);
+PARROT_API void Parrot_new_cb_event(Parrot_Interp, PMC* cbi, char *ext);
+PARROT_API void Parrot_run_callback(Parrot_Interp, PMC* cbi, char *ext);
PARROT_API void Parrot_kill_event_loop(void);
PARROT_API void* Parrot_sleep_on_event(Parrot_Interp, FLOATVAL t, void* next);
@@ -472,7 +472,7 @@ PARROT_API STRING*interpinfo_s(Interp *interp, INTVAL what);
void runops(Interp *, size_t offset);
void runops_int(Interp *, size_t offset);
PARROT_API parrot_context_t* Parrot_runops_fromc(Interp *, PMC *sub);
-PARROT_API void* Parrot_runops_fromc_args(Interp *, PMC *sub, const char *sig, ...);
+PARROT_API PMC* Parrot_runops_fromc_args(Interp *, PMC *sub, const char *sig, ...);
PARROT_API void* Parrot_runops_fromc_args_event(Interp *, PMC *sub, const char *sig, ...);
PARROT_API INTVAL Parrot_runops_fromc_args_reti(Interp *, PMC *, const char *, ...);
PARROT_API FLOATVAL Parrot_runops_fromc_args_retf(Interp *, PMC *, const char *, ...);
@@ -497,8 +497,8 @@ PARROT_API INTVAL Parrot_run_meth_fromc_arglist_reti(Interp *, PMC *sub,
PARROT_API FLOATVAL Parrot_run_meth_fromc_arglist_retf(Interp *, PMC *sub,
PMC* obj, STRING *meth, const char *signature, va_list);
-PARROT_API void Parrot_callback_C(void *external_data, PMC *callback_info);
-PARROT_API void Parrot_callback_D(PMC *callback_info, void *external_data);
+PARROT_API void Parrot_callback_C(char *external_data, PMC *callback_info);
+PARROT_API void Parrot_callback_D(PMC *callback_info, char *external_data);
PARROT_API PMC* Parrot_make_cb(Interp *interp, PMC* sub, PMC* user_data,
STRING* cb_signature);
View
@@ -170,7 +170,7 @@ PARROT_API extern PMC *PIO_fdopen(Interp *, ParrotIOLayer *, PIOHANDLE, const ch
PARROT_API extern INTVAL PIO_close(Interp *, PMC *);
PARROT_API extern void PIO_flush(Interp *, PMC *);
PARROT_API extern STRING *PIO_reads(Interp *, PMC *, size_t);
-PARROT_API extern INTVAL PIO_read(Interp *, PMC *, void *, size_t);
+PARROT_API extern INTVAL PIO_read(Interp *, PMC *, char *, size_t);
PARROT_API extern INTVAL PIO_write(Interp *, PMC *, const void *, size_t);
PARROT_API extern INTVAL PIO_setbuf(Interp *, PMC *, size_t);
PARROT_API extern INTVAL PIO_setlinebuf(Interp *, PMC *);
@@ -178,7 +178,7 @@ typedef struct PackFile_ConstTable {
typedef struct PackFile_ByteCode {
PackFile_Segment base;
Prederef prederef; /* The predereferenced code and info */
- void *jit_info; /* JITs data */
+ struct Parrot_jit_info_t *jit_info; /* JITs data */
Parrot_PIC_store *pic_store; /* PIC storage */
PackFile_Segment *pic_index; /* segment of indices into store */
struct PackFile_Debug *debugs;
View
@@ -81,10 +81,8 @@ struct parrot_string_t {
char *strstart;
UINTVAL strlen;
/* parrot_string_representation_t representation;*/
- void *encoding; /* These should be of type ENCODING * and CHARSET *
- * respectively, but I'm not sure how to get them
- * to do that without a whole lotta work right now */
- void *charset;
+ struct _encoding *encoding;
+ struct _charset *charset;
UINTVAL hashval; /* cached hash value computation; not yet used */
};
@@ -58,9 +58,9 @@ PARROT_API STRING *string_from_num(Interp *, FLOATVAL f);
PARROT_API STRING *string_grow(Interp *, STRING *s, INTVAL addlen);
PARROT_API const char* string_primary_encoding_for_representation(Interp *,
parrot_string_representation_t representation);
-PARROT_API STRING *string_make(Interp *interp, const void *buffer,
+PARROT_API STRING *string_make(Interp *interp, const char *buffer,
UINTVAL len, const char *charset_name, UINTVAL flags);
-PARROT_API STRING *string_make_direct(Interp *interp, const void *buffer,
+PARROT_API STRING *string_make_direct(Interp *interp, const char *buffer,
UINTVAL len, ENCODING *encoding, CHARSET *charset, UINTVAL flags);
PARROT_API STRING * string_make_empty(Interp *interp,
parrot_string_representation_t representation,
@@ -78,8 +78,8 @@ PARROT_API void *string_pointer_to_index(Interp *, const STRING *s, UINTVAL idx)
PARROT_API INTVAL string_index(Interp *, const STRING *, UINTVAL idx);
PARROT_API INTVAL string_str_index(Interp *interp, const STRING *s,
const STRING *s2, INTVAL start);
-PARROT_API STRING *string_from_cstring(Interp *, const void *, UINTVAL);
-PARROT_API STRING *string_from_const_cstring(Interp *, const void *, UINTVAL);
+PARROT_API STRING *string_from_cstring(Interp *, const char *, UINTVAL);
+PARROT_API STRING *string_from_const_cstring(Interp *, const char *, UINTVAL);
PARROT_API STRING *const_string(Interp *, const char *buffer)
__attribute__nonnull__(2);
PARROT_API char *string_to_cstring(Interp *, STRING *);
View
@@ -200,7 +200,7 @@ struct Parrot_Context_info {
STRING* nsname;
STRING* fullname;
int pc;
- const char *file;
+ char *file;
int line;
opcode_t *address;
};
@@ -480,7 +480,7 @@ sub rewrite_pccinvoke {
my $n_regs_used = find_max_regs( [ $result_n_regs_used, $args_n_regs_used ] );
- $method_name = "string_from_const_cstring(interp, $method_name, 0)"
+ $method_name = "string_from_const_cstring(interp, (const char *) $method_name, 0)"
if isquoted($method_name);
my $file = '"' . __FILE__ . '"';
View
@@ -1545,7 +1545,7 @@ PDB_disassemble_op(Interp *interp, char* dest, int space,
dest[size++] = '?';
break;
}
- k = PMC_data(k);
+ k = (PMC *)PMC_data(k);
if (k) dest[size++] = ';';
}
dest[size++] = ']';
@@ -1624,7 +1624,7 @@ PDB_disassemble(Interp *interp, const char *command)
if (space < default_size) {
alloced += default_size;
space += default_size;
- pfile->source = mem_sys_realloc(pfile->source, alloced);
+ pfile->source = (char *)mem_sys_realloc(pfile->source, alloced);
}
size = PDB_disassemble_op(interp, pfile->source + pfile->size,
@@ -1810,7 +1810,7 @@ PDB_load_source(Interp *interp, const char *command)
while ((c = fgetc(file)) != EOF) {
/* Grow it */
if (++size == 1024) {
- pfile->source = mem_sys_realloc(pfile->source,
+ pfile->source = (char *)mem_sys_realloc(pfile->source,
(size_t)pfile->size + 1024);
size = 0;
}
@@ -2053,12 +2053,12 @@ PDB_extend_const_table(Interp *interp)
k = ++interp->code->const_table->const_count;
if (interp->code->const_table->constants) {
interp->code->const_table->constants =
- mem_sys_realloc(interp->code->const_table->constants,
+ (PackFile_Constant **)mem_sys_realloc(interp->code->const_table->constants,
k * sizeof (PackFile_Constant *));
}
else {
interp->code->const_table->constants =
- mem_sys_allocate(k * sizeof (PackFile_Constant *));
+ (PackFile_Constant **)mem_sys_allocate(k * sizeof (PackFile_Constant *));
}
/* Allocate a new constant */
@@ -2491,7 +2491,7 @@ GDB_B(Interp *interp, char *s) {
if (!gdb_bps) {
nr = 0;
- newbreak = mem_sys_allocate(sizeof (PDB_breakpoint_t));
+ newbreak = mem_allocate_typed(PDB_breakpoint_t);
newbreak->prev = NULL;
newbreak->next = NULL;
gdb_bps = newbreak;
@@ -2505,7 +2505,7 @@ GDB_B(Interp *interp, char *s) {
break;
}
++nr;
- newbreak = mem_sys_allocate(sizeof (PDB_breakpoint_t));
+ newbreak = mem_allocate_typed(PDB_breakpoint_t);
newbreak->prev = bp;
newbreak->next = NULL;
bp->next = newbreak;
View
@@ -335,7 +335,7 @@ Create queue entry and insert event into task queue.
void
Parrot_schedule_event(Parrot_Interp interp, parrot_event* ev)
{
- QUEUE_ENTRY* entry = mem_sys_allocate(sizeof (QUEUE_ENTRY));
+ QUEUE_ENTRY* entry = mem_allocate_typed(QUEUE_ENTRY);
entry->next = NULL;
ev->interp = interp;
entry->data = ev;
@@ -364,10 +364,10 @@ Parrot_schedule_event(Parrot_Interp interp, parrot_event* ev)
static void
schedule_signal_event(int signum)
{
- parrot_event* ev = mem_sys_allocate(sizeof (parrot_event));
+ parrot_event* ev = mem_allocate_typed(parrot_event);
QUEUE_ENTRY *entry;
- entry = mem_sys_allocate(sizeof (QUEUE_ENTRY));
+ entry = mem_allocate_typed(QUEUE_ENTRY);
entry->next = NULL;
entry->type = QUEUE_ENTRY_TYPE_EVENT;
ev->type = EVENT_TYPE_SIGNAL;
@@ -396,7 +396,7 @@ void
Parrot_new_timer_event(Parrot_Interp interp, PMC* timer, FLOATVAL diff,
FLOATVAL interval, int repeat, PMC* sub, parrot_event_type_enum typ)
{
- parrot_event* ev = mem_sys_allocate(sizeof (parrot_event));
+ parrot_event* ev = mem_allocate_typed(parrot_event);
FLOATVAL now = Parrot_floatval_time();
ev->type = typ;
ev->u.timer_event.timer = timer;
@@ -421,10 +421,10 @@ Prepare and schedule a callback event.
*/
void
-Parrot_new_cb_event(Parrot_Interp interp, PMC* cbi, void* ext)
+Parrot_new_cb_event(Parrot_Interp interp, PMC* cbi, char* ext)
{
- parrot_event* ev = mem_sys_allocate(sizeof (parrot_event));
- QUEUE_ENTRY* entry = mem_sys_allocate(sizeof (QUEUE_ENTRY));
+ parrot_event* ev = mem_allocate_typed(parrot_event);
+ QUEUE_ENTRY* entry = mem_allocate_typed(QUEUE_ENTRY);
entry->next = NULL;
entry->data = ev;
ev->interp = interp;
@@ -480,7 +480,7 @@ event arrives.
void
Parrot_new_terminate_event(Parrot_Interp interp)
{
- parrot_event* ev = mem_sys_allocate(sizeof (parrot_event));
+ parrot_event* ev = mem_allocate_typed(parrot_event);
ev->type = EVENT_TYPE_TERMINATE;
Parrot_schedule_event(interp, ev);
}
@@ -499,9 +499,9 @@ variable for GC to finish when the event arrives.
void
Parrot_new_suspend_for_gc_event(Parrot_Interp interp) {
QUEUE_ENTRY *qe;
- parrot_event* ev = mem_sys_allocate(sizeof (parrot_event));
+ parrot_event* ev = mem_allocate_typed(parrot_event);
ev->type = EVENT_TYPE_SUSPEND_FOR_GC;
- qe = mem_sys_allocate(sizeof (QUEUE_ENTRY));
+ qe = mem_allocate_typed(QUEUE_ENTRY);
qe->next = NULL;
qe->data = ev;
qe->type = QUEUE_ENTRY_TYPE_EVENT;
@@ -524,7 +524,7 @@ Schedule event-loop terminate event. This shuts down the event thread.
void
Parrot_kill_event_loop(void)
{
- parrot_event* ev = mem_sys_allocate(sizeof (parrot_event));
+ parrot_event* ev = mem_allocate_typed(parrot_event);
ev->type = EVENT_TYPE_EVENT_TERMINATE;
Parrot_schedule_event(NULL, ev);
}
@@ -667,12 +667,12 @@ static void
store_io_event(pending_io_events *ios, parrot_event *ev)
{
if (!ios->alloced) {
- ios->events = mem_sys_allocate(16 * sizeof (ev));
+ ios->events = (parrot_event **)mem_sys_allocate(16 * sizeof (ev));
ios->alloced = 16;
}
else if (ios->n == ios->alloced - 1) {
ios->alloced <<= 1;
- ios->events = mem_sys_realloc(ios->events, (ios->alloced * sizeof (ev)));
+ ios->events = (parrot_event **)mem_sys_realloc(ios->events, (ios->alloced * sizeof (ev)));
}
ios->events[ios->n++] = ev;
}
@@ -847,7 +847,7 @@ Parrot_event_add_io_event(Interp* interp,
parrot_event *event;
io_thread_msg buf;
- event = mem_sys_allocate(sizeof (parrot_event));
+ event = mem_allocate_typed(parrot_event);
event->type = EVENT_TYPE_IO;
event->interp = interp;
/*
@@ -891,10 +891,10 @@ dup_entry(QUEUE_ENTRY* entry)
parrot_event *event;
QUEUE_ENTRY *new_entry;
- new_entry = mem_sys_allocate(sizeof (QUEUE_ENTRY));
+ new_entry = mem_allocate_typed(QUEUE_ENTRY);
new_entry->next = NULL;
new_entry->type = entry->type;
- event = new_entry->data = mem_sys_allocate(sizeof (parrot_event));
+ event = new_entry->data = mem_allocate_typed(parrot_event);
mem_sys_memcopy(event, entry->data, sizeof (parrot_event));
return new_entry;
}
View
@@ -228,7 +228,7 @@ Parrot_get_global(Interp *interp, PMC *ns, STRING *globalname)
if (PMC_IS_NULL(ns))
return PMCNULL;
- return VTABLE_get_pointer_keyed_str(interp, ns, globalname);
+ return (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname);
}
void
@@ -293,7 +293,7 @@ Parrot_find_global_n(Interp *interp, PMC *ns, STRING *globalname)
* distinguishes 'get_pmc_keyed' from 'get_pointer_keyed';
* the former is for NS and the latter is for non-NS.
*/
- res = VTABLE_get_pointer_keyed_str(interp, ns, globalname);
+ res = (PMC *)VTABLE_get_pointer_keyed_str(interp, ns, globalname);
}
return PMC_IS_NULL(res) ? NULL : res;
View
@@ -76,7 +76,7 @@ parrot_set_config_hash_interpreter(Interp* interp)
{
STRING *config_string =
string_make_direct(interp,
- parrot_config_stored, parrot_config_size_stored,
+ (const char *)parrot_config_stored, parrot_config_size_stored,
PARROT_DEFAULT_ENCODING, PARROT_DEFAULT_CHARSET,
PObj_external_FLAG|PObj_constant_FLAG);
Oops, something went wrong.

0 comments on commit e063e49

Please sign in to comment.