Mercurial > repos > rhope
changeset 53:70af7fa155d0
Cleaned up some C warnings and added a simple compile script
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 29 Apr 2010 04:32:54 +0000 |
parents | 079200bc3e75 |
children | 243d013a49cb |
files | compile runtime/array.c runtime/builtin.c runtime/context.h runtime/func.h runtime/object.h |
diffstat | 6 files changed, 38 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compile Thu Apr 29 04:32:54 2010 +0000 @@ -0,0 +1,23 @@ +#!/bin/sh + +if test -f "$1.c"; then + rm "$1.c" +fi + +./rhope -t 1 parser_old.rhope $1 + +if test ! -f "$1.c"; then + echo "Compilation to C failed" + exit 1 +fi + +cp runtime/* build/ +cp "$1.c" build/ +cd build +bin=`echo $1 | sed s/\.rhope//` + +if test -f "$bin"; then + rm "$bin" +fi +gcc -Wformat=0 -o $bin $2 "$1.c" blueprint.c context.c fixed_alloc.c object.c +
--- a/runtime/array.c Wed Apr 28 01:23:30 2010 -0400 +++ b/runtime/array.c Thu Apr 29 04:32:54 2010 +0000 @@ -16,7 +16,7 @@ object * _internal_array_getboxed(object * array, int32_t index) { object * ret; - object ** intarr = (object *)(((char *) array) + sizeof(t_Array)); + object ** intarr = (object **)(((char *) array) + sizeof(t_Array)); ret = add_ref(intarr[index]); release_ref(array); return ret; @@ -24,7 +24,7 @@ void _internal_array_setboxed(object *array, int32_t index, object * val) { - object ** intarr = (object *)(((char *) array) + sizeof(t_Array)); + object ** intarr = (object **)(((char *) array) + sizeof(t_Array)); intarr[index] = val; } @@ -35,7 +35,7 @@ ret->payload.Storage = size; ret->payload.Eltype = (t_Blueprint *)make_Blueprint(0); - return ret; + return (object *)ret; } object * _internal_array_allocnaked(int32_t size , object * type)
--- a/runtime/builtin.c Wed Apr 28 01:23:30 2010 -0400 +++ b/runtime/builtin.c Thu Apr 29 04:32:54 2010 +0000 @@ -4,6 +4,7 @@ #include "bool.h" #include <stddef.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> void register_builtin_type(uint32_t type)
--- a/runtime/context.h Wed Apr 28 01:23:30 2010 -0400 +++ b/runtime/context.h Thu Apr 29 04:32:54 2010 +0000 @@ -16,7 +16,7 @@ typedef struct { rhope_func func; - struct calldata *params; + calldata *params; } unwind_cell; typedef struct context { @@ -28,7 +28,7 @@ stackchunk * new_stack(); context * new_context(); void * alloc_stack(context * ct, uint32_t size); -struct calldata * alloc_cdata(context * ct, uint32_t num_params); +calldata * alloc_cdata(context * ct, uint32_t num_params); void free_stack(context * ct, void * data); void free_context(context * c); #endif //_CONTEXT_H_
--- a/runtime/func.h Wed Apr 28 01:23:30 2010 -0400 +++ b/runtime/func.h Thu Apr 29 04:32:54 2010 +0000 @@ -1,6 +1,9 @@ #ifndef _FUNC_H_ #define _FUNC_H_ +typedef struct object object; +typedef struct calldata calldata; + typedef enum { NORMAL_RETURN=0, EXCEPTION_RETURN, @@ -10,8 +13,8 @@ } returntype; -typedef returntype (*rhope_func)(struct calldata *); -typedef void (*special_func) (struct object *); +typedef returntype (*rhope_func)(calldata *); +typedef void (*special_func) (object *); #define MethodName(name,type) f_ ## name ## AT_ ## type
--- a/runtime/object.h Wed Apr 28 01:23:30 2010 -0400 +++ b/runtime/object.h Thu Apr 29 04:32:54 2010 +0000 @@ -30,10 +30,10 @@ int32_t boxed_size; } blueprint; -typedef struct object { +struct object { rh_atomic32(refcount); blueprint *bprint; -} object; +}; typedef struct { object base; @@ -41,7 +41,7 @@ } multisize; -typedef struct calldata { +struct calldata { rhope_func tail_func; struct context *ct; void *locals; @@ -50,7 +50,7 @@ uint16_t num_params; uint16_t resume; object *params[1]; -} calldata; +}; #define OBegin typedef struct { #define Object(name) } nt_ ## name; typedef struct { object SP_header; nt_ ## name payload; } t_ ## name;