diff options
author | Joe Onorato <joeo@android.com> | 2009-08-10 15:01:51 -0700 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2009-08-10 15:01:51 -0700 |
commit | daed524c35f5fe4d35f403d2279947605d161b2e (patch) | |
tree | 4b372e0d0863f8ee059acb0f5edb694e539e6d57 /libs/rs | |
parent | c028d09409c3cd290949974258264903106a3346 (diff) | |
download | frameworks_base-daed524c35f5fe4d35f403d2279947605d161b2e.zip frameworks_base-daed524c35f5fe4d35f403d2279947605d161b2e.tar.gz frameworks_base-daed524c35f5fe4d35f403d2279947605d161b2e.tar.bz2 |
The build system knows how to deal with lex files, but it treats them as c++, so make spec.lex
conform to that.
Diffstat (limited to 'libs/rs')
-rw-r--r-- | libs/rs/Android.mk | 11 | ||||
-rw-r--r-- | libs/rs/rsg_generator.c | 12 | ||||
-rw-r--r-- | libs/rs/spec.h | 38 | ||||
-rw-r--r-- | libs/rs/spec.l (renamed from libs/rs/spec.lex) | 22 |
4 files changed, 49 insertions, 34 deletions
diff --git a/libs/rs/Android.mk b/libs/rs/Android.mk index 978d975..7075842 100644 --- a/libs/rs/Android.mk +++ b/libs/rs/Android.mk @@ -14,17 +14,8 @@ LOCAL_IS_HOST_MODULE := true LOCAL_MODULE_CLASS := EXECUTABLES intermediates := $(local-intermediates-dir) -GEN := $(addprefix $(intermediates)/, \ - lex.yy.c \ - ) -$(GEN): PRIVATE_CUSTOM_TOOL = flex -o $@ $< - -$(intermediates)/lex.yy.c : $(LOCAL_PATH)/spec.lex - $(transform-generated-source) - -$(LOCAL_PATH)/rsg_generator.c : $(intermediates)/lex.yy.c - LOCAL_SRC_FILES:= \ + spec.l \ rsg_generator.c include $(BUILD_HOST_EXECUTABLE) diff --git a/libs/rs/rsg_generator.c b/libs/rs/rsg_generator.c index a4d659d..7cf6bb6 100644 --- a/libs/rs/rsg_generator.c +++ b/libs/rs/rsg_generator.c @@ -1,6 +1,6 @@ - -#include "lex.yy.c" +#include "spec.h" +#include <stdio.h> void printFileHeader(FILE *f) { @@ -45,7 +45,7 @@ void printVarType(FILE *f, const VarType *vt) fprintf(f, "double"); break; case 4: - fprintf(f, "%s", vt->typename); + fprintf(f, "%s", vt->typeName); break; } @@ -157,7 +157,7 @@ void printApiCpp(FILE *f) needFlush += vt->ptrLevel; fprintf(f, " cmd->%s = %s;\n", vt->name, vt->name); } - if (api->ret.typename[0]) { + if (api->ret.typeName[0]) { needFlush = 1; } @@ -167,7 +167,7 @@ void printApiCpp(FILE *f) } fprintf(f, "(RS_CMD_ID_%s, size);\n", api->name); - if (api->ret.typename[0]) { + if (api->ret.typeName[0]) { fprintf(f, " return reinterpret_cast<"); printVarType(f, &api->ret); fprintf(f, ">(io->mToCoreRet);\n"); @@ -199,7 +199,7 @@ void printPlaybackCpp(FILE *f) //fprintf(f, " LOGE(\"play command %s\\n\");\n", api->name); fprintf(f, " const RS_CMD_%s *cmd = static_cast<const RS_CMD_%s *>(vp);\n", api->name, api->name); fprintf(f, " "); - if (api->ret.typename[0]) { + if (api->ret.typeName[0]) { fprintf(f, "gIO->mToCoreRet = (intptr_t)"); } fprintf(f, "rsi_%s(con", api->name); diff --git a/libs/rs/spec.h b/libs/rs/spec.h new file mode 100644 index 0000000..b474dca --- /dev/null +++ b/libs/rs/spec.h @@ -0,0 +1,38 @@ +#ifndef SPEC_H +#define SPEC_H + +#if __cplusplus +extern "C" { +#endif + +extern int num_lines; + +typedef struct { + int isConst; + int type; + int bits; + int ptrLevel; + char name[256]; + char typeName[256]; +} VarType; + +extern VarType *currType; + +typedef struct { + char name[256]; + int sync; + int paramCount; + VarType ret; + VarType params[16]; +} ApiEntry; + +extern ApiEntry apis[128]; +extern int apiCount; + +extern int typeNextState; + +#if __cplusplus +} // extern "C" +#endif + +#endif // SPEC_H diff --git a/libs/rs/spec.lex b/libs/rs/spec.l index 0f8e9ab..62fcb63 100644 --- a/libs/rs/spec.lex +++ b/libs/rs/spec.l @@ -9,33 +9,19 @@ DIGIT [0-9] ID [a-zA-Z_][a-zA-Z0-9_]* + #include "spec.h" int num_lines = 0; - typedef struct { - int isConst; - int type; - int bits; - int ptrLevel; - char name[256]; - char typename[256]; - } VarType; - VarType *currType = 0; - typedef struct { - char name[256]; - int sync; - int paramCount; - VarType ret; - VarType params[16]; - } ApiEntry; - ApiEntry apis[128]; int apiCount = 0; int typeNextState; + extern "C" int yylex(); + %% "/*" BEGIN(comment); @@ -141,7 +127,7 @@ ID [a-zA-Z_][a-zA-Z0-9_]* <var_type>{ID} { currType->type = 4; currType->bits = 32; - memcpy(currType->typename, yytext, yyleng); + memcpy(currType->typeName, yytext, yyleng); BEGIN(typeNextState); } |