From: David Schleef Date: Thu, 10 Jun 2010 02:14:08 +0000 (-0700) Subject: more conversion to orc int types X-Git-Tag: orc-0.4.6~80 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=29ea6b1aa95234cd97e6c6a9e79b2392dea1f21d;p=platform%2Fupstream%2Forc.git more conversion to orc int types --- diff --git a/orc/orcprogram-c.c b/orc/orcprogram-c.c index dcb4ec2..0a7bcf2 100644 --- a/orc/orcprogram-c.c +++ b/orc/orcprogram-c.c @@ -27,10 +27,9 @@ orc_compiler_c_init (OrcCompiler *compiler) } const char * -orc_target_c_get_asm_preamble (void) +orc_target_c_get_typedefs (void) { - return "\n" - "/* begin Orc C target preamble */\n" + return "#ifndef _ORC_INTEGER_TYPEDEFS_\n" "#define _ORC_INTEGER_TYPEDEFS_\n" "#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L\n" @@ -70,7 +69,14 @@ orc_target_c_get_asm_preamble (void) "#endif\n" "typedef union { orc_int32 i; float f; } orc_union32;\n" "typedef union { orc_int64 i; double f; } orc_union64;\n" - "#endif\n" + "#endif\n"; +} + +const char * +orc_target_c_get_asm_preamble (void) +{ + return "\n" + "/* begin Orc C target preamble */\n" "#define ORC_CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))\n" "#define ORC_ABS(a) ((a)<0 ? -(a) : (a))\n" "#define ORC_MIN(a,b) ((a)<(b) ? (a) : (b))\n" diff --git a/orc/orcprogram.h b/orc/orcprogram.h index 6050b91..c2220b7 100644 --- a/orc/orcprogram.h +++ b/orc/orcprogram.h @@ -577,6 +577,7 @@ int orc_compiler_get_constant (OrcCompiler *compiler, int size, int value); const char *orc_program_get_asm_code (OrcProgram *program); const char *orc_target_get_asm_preamble (const char *target); const char * orc_target_get_preamble (OrcTarget *target); +const char * orc_target_c_get_typedefs (void); void orc_compiler_append_code (OrcCompiler *p, const char *fmt, ...) ORC_GNU_PRINTF(2,3); diff --git a/tools/orcc.c b/tools/orcc.c index 081dab7..753b7ad 100644 --- a/tools/orcc.c +++ b/tools/orcc.c @@ -176,6 +176,7 @@ main (int argc, char *argv[]) output_code_header (programs[i], output); } fprintf(output, "\n"); + fprintf(output, "%s", orc_target_c_get_typedefs ()); fprintf(output, "%s", orc_target_get_asm_preamble ("c")); fprintf(output, "\n"); for(i=0;i\n", include_file); } fprintf(output, "\n"); + fprintf(output, "%s", orc_target_c_get_typedefs ()); fprintf(output, "%s", orc_target_get_asm_preamble ("c")); fprintf(output, "\n"); for(i=0;itype_name, varnames[ORC_VAR_D1 + i]); } else { - fprintf(output, "uint%d_t * %s", var->size*8, + fprintf(output, "orc_uint%d * %s", var->size*8, varnames[ORC_VAR_D1 + i]); } if (p->is_2d) { @@ -376,7 +380,7 @@ output_prototype (OrcProgram *p, FILE *output) fprintf(output, "%s * %s", var->type_name, varnames[ORC_VAR_A1 + i]); } else { - fprintf(output, "uint%d_t * %s", var->size*8, + fprintf(output, "orc_uint%d * %s", var->size*8, varnames[ORC_VAR_A1 + i]); } need_comma = TRUE; @@ -390,7 +394,7 @@ output_prototype (OrcProgram *p, FILE *output) fprintf(output, "const %s * %s", var->type_name, varnames[ORC_VAR_S1 + i]); } else { - fprintf(output, "const uint%d_t * %s", var->size*8, + fprintf(output, "const orc_uint%d * %s", var->size*8, varnames[ORC_VAR_S1 + i]); } if (p->is_2d) {