Mercurial > hg > CbC > old > device
changeset 134:7a55819b0482
*** empty log message ***
author | kono |
---|---|
date | Sat, 03 May 2003 15:27:00 +0900 |
parents | 7d436c08e949 |
children | 4cfd24d1b929 |
files | Changes conv_func.pl conv_func.tbl mc-code-powerpc.c |
diffstat | 4 files changed, 137 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Fri May 02 14:26:54 2003 +0900 +++ b/Changes Sat May 03 15:27:00 2003 +0900 @@ -2867,3 +2867,12 @@ Mon Apr 14 23:29:37 JST 2003 やっぱり、ちょっと変更大きいなぁ。 + +Fri May 2 14:53:16 JST 2003 + +なんでもいいけど、power-pc の test/basic が通らなくなってる。 +(ま、そうだよな....) struct-pushと args-works の途中で +動かなくなったらしい。 + +あと、引数の引渡しだけど、printf (...) だけ特別扱いしたら? +プロトタイプがあるのを特別扱いする必要はないんじゃない?
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conv_func.pl Sat May 03 15:27:00 2003 +0900 @@ -0,0 +1,52 @@ +#!/usr/bin/perl + +$in="conv_func.tbl"; +$out="conv/conv.h"; +$def="conv/convdef.h"; +$nul="conv/null.c"; + +open(IN,"<$in") or die("can't open $in"); +open(OUT,">$out") or die("can't open $out"); +print OUT "/* Do not edit this file. This is automatically generated. */\n"; +open(DEF,">$def") or die("can't open $def"); +print DEF "/* Do not edit this file. This is automatically generated. */\n"; +open(NUL,">$nul") or die("can't open $nul"); +print NUL "/* Do not edit this file. This is automatically generated. */\n"; + +print OUT "typedef struct converter {\n"; +print NUL "#define EXTERN /**/\n"; +print NUL "#include \"mc.h\"\n"; +print NUL "#include \"conv/convdef.h\"\n\n"; +print NUL "#include \"conv/null.h\"\n\n"; + +while(<IN>) { + if (/([^\s]*)\s+([_a-zA-Z0-9]*)\((.*)\)/) { + $type=$1; $name=$2; $arg=$3; + # print OUT "$type=$name=$arg\n"; + $return = ($type && $type ne "void")? "return ($type)0;" : ""; + print OUT " $type (*$name)($arg);\n"; + print NUL "static $type\n$name($arg)\n{ $return}\n\n"; + print DEF "static $_"; + } +} + +print OUT "} Converter;\n"; + +foreach $def ('conv/c.h','conv/null.h' ) { + $def =~ m-conv/(.*)\.h-; $m = $1; + open(DEF,">$def") or die("can't open $def"); + print DEF "/* Do not edit this file. This is automatically generated. */\n"; + + print OUT "extern Converter ${m}_converter;\n"; + print DEF "\nextern Converter $1_converter;\n"; + print DEF "\n\n\nConverter $1_converter = {\n"; + open(IN,"<$in") or die("can't open $in"); + while(<IN>) { + if (/([^\s]*)\s+([_a-zA-Z0-9]*)\((.*)\)/) { + $type=$1; $name=$2; $arg=$3; + print DEF " \&$name,\n"; + } + } + print DEF "};\n"; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conv_func.tbl Sat May 03 15:27:00 2003 +0900 @@ -0,0 +1,73 @@ +void conv_() ; +void noconv_(int f) ; +void comment_(int f) ; +void open_(char *s) ; +void print_(char *s) ; +void close_() ; +void case_(int cases,int def); +void case_begin_(); +void code_(NMTBL *fnptr); +void code_end_(); +void comma_(); +void cond_(); +void cond1_(); +void cond2_(); +void cond_end_(); +void decl_data_begin_(); +void decl_data_end_(); +void def_(NMTBL *n); +void dowhile_(); +void dowhile_cond_(); +void dowhile_end_(); +int error_(int n); +void extern_(); +void for_(); +void for1_(); +void for2_(); +void for_body_(); +void for_end_(); +void funcall_(int type); +void funcall_args_(); +void function_(NMTBL *n,int cont); +void function_end_(); +void goto_(); +void goto_label_(); +void id_(int sy,NMTBL *nptr); +void string_(char *s); +void const_(int symval); +void return_f_(); +void defined_(char *p); +void environment_(); +void if_(); +void if_else_(); +void if_endif_(); +void if_then_(); +void jump_(int env); +void label_(); +void lbra_(int sym); +void lc_(); +void localvar_end_(); +void lpar_(); +void op_(int sym); +void postfix_(int sym); +void prefix_(int sym); +void rbra_(int sym); +void rc_(); +void register_(); +void return_(); +void return_end_(); +void return_type_(int t,NMTBL *n,int cont); +void rpar_(); +void sm_(); +void static_(); +void switch_(); +void switch_body_(); +void switch_end_(); +void typedef_(); +void while_(); +void while_body_(); +void while_end_(); +void decl_data_(); +void break_(); +void continue_(); +void sdecl_(int f);
--- a/mc-code-powerpc.c Fri May 02 14:26:54 2003 +0900 +++ b/mc-code-powerpc.c Sat May 03 15:27:00 2003 +0900 @@ -458,24 +458,23 @@ void register_usage(char *s) { -#if 0 +#if 1 int i; #endif if (chk) return; if (!lsrc) return; printf("# %d: %s:",lineno,s); printf(" creg=%s fgreg=%s",register_name(creg),fregister_name(freg)); -#if 0 +#if 1 printf("\n# regs:"); for(i=0;i<MAX_REGISTER;i++) { printf("%d",regv[i]); } printf(":"); for(i=0;i<MAX_REGISTER;i++) { printf("%d",regs[i]); } printf("\n# freg:"); for(i=0;i<MAX_FREGISTER;i++) { printf("%d",fregs[i]); } - printf(" regs_stack",register_name(creg),register_name(dreg)); for(i=reg_sp;i>=0;i--) { if(reg_stack[i]>=0) - printf(" %s",register_name(reg_stack[i],0)); + printf(" %s",register_name(reg_stack[i])); } #endif printf("\n");