mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-04-22 08:50:48 +00:00
Removed luaDefParser
Not needed anymore.
This commit is contained in:
parent
056553e85c
commit
07bb309d8d
6 changed files with 0 additions and 432 deletions
|
@ -1,24 +0,0 @@
|
|||
Copyright (c) 2012 Walter Julius Hennecke, Ubergames
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to
|
||||
whom the Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
|
||||
WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,24 +0,0 @@
|
|||
Lua Definitions Parser (WIP)
|
||||
|
||||
Required tools:
|
||||
Linux:
|
||||
* flex
|
||||
Windows:
|
||||
* mingw
|
||||
|
||||
Building:
|
||||
Linux:
|
||||
flex quake.l
|
||||
gcc lex.yy.c -o luaDefParser -lfl
|
||||
Mac:
|
||||
flex quake.l
|
||||
gcc lex.yy.c -o luaDefParser -lfl
|
||||
Windows:
|
||||
flex quake.l
|
||||
gcc lex.yy.c -o luaDefParser /lib/libfl.a
|
||||
|
||||
Usage:
|
||||
./luaDefParser <code file> <output file>
|
||||
|
||||
Example:
|
||||
./luaDefParser game/lua_game.c module_game.lyx
|
|
@ -1,171 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2012 Walter Julius Hennecke, Ubergames
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to
|
||||
whom the Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
|
||||
WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "export_lyx.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
function_p create_function(void) {
|
||||
function_p n = (function_p)malloc(sizeof(function_s));
|
||||
|
||||
if(n == NULL) return NULL;
|
||||
|
||||
n->desc = create_list();
|
||||
if(n->desc == NULL) {
|
||||
free(n);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
n->params = create_list();
|
||||
if(n->params == NULL) {
|
||||
destroy_list(n->desc);
|
||||
free(n);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
void destroy_function(function_p f) {
|
||||
if(f != NULL) {
|
||||
if(f->desc != NULL) {
|
||||
destroy_list(f->desc);
|
||||
}
|
||||
if(f->params != NULL) {
|
||||
destroy_list(f->params);
|
||||
}
|
||||
free(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
desc_p create_desc(void) {
|
||||
desc_p n = (desc_p)malloc(sizeof(desc_s));
|
||||
|
||||
if(n == NULL) return NULL;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
void destroy_desc(desc_p d) {
|
||||
if(d != NULL) {
|
||||
if(d->text != NULL) {
|
||||
free(d->text);
|
||||
}
|
||||
|
||||
free(d);
|
||||
}
|
||||
}
|
||||
|
||||
param_p create_param(void) {
|
||||
param_p n = (param_p)malloc(sizeof(param_s));
|
||||
|
||||
if(n == NULL) return NULL;
|
||||
|
||||
n->desc = create_list();
|
||||
if(n->desc == NULL) {
|
||||
free(n);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
void destroy_param(param_p p) {
|
||||
if (p != NULL) {
|
||||
if(p->name != NULL) {
|
||||
free(p->name);
|
||||
}
|
||||
if(p->desc != NULL) {
|
||||
destroy_list(p->desc);
|
||||
}
|
||||
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
|
||||
void write_desc(list_p d, FILE* f) {
|
||||
list_iter_p iter;
|
||||
desc_p d;
|
||||
|
||||
if(d == NULL || f == NULL) return;
|
||||
|
||||
fprintf(f, "%s", BEGIN_STANDART);
|
||||
|
||||
for(d = list_next(iter); d != NULL; d = list_next(iter)) {
|
||||
fprintf(f, "%s", d->text);
|
||||
}
|
||||
|
||||
fprintf(f, "%s", END_LAYOUT);
|
||||
}
|
||||
|
||||
void write_params(list_p p, FILE* f) {
|
||||
list_iter_p iter;
|
||||
param_p d;
|
||||
|
||||
if(p == NULL || f == NULL) return;
|
||||
|
||||
fprintf(f, "%s", BEGIN_TABULAR);
|
||||
iter = list_iterator(p);
|
||||
for(d = list_next(iter); d != NULL; d = list_next(iter)) {
|
||||
write_param(d, f);
|
||||
}
|
||||
fprintf(f, "%s", END_TABULAR);
|
||||
}
|
||||
|
||||
void write_param(param_p p, FILE* f) {
|
||||
list_iter_p iter;
|
||||
desc_p d;
|
||||
|
||||
if(p == NULL || f == NULL) return;
|
||||
|
||||
fprintf(f, "%s%s", BEGIN_TABULAR_ROW, BEGIN_TABULAR_CELL);
|
||||
switch(p->type) {
|
||||
case FLOAT:
|
||||
fprintf(f, "float\n");
|
||||
break;
|
||||
case ENTITY:
|
||||
fprintf(f, "entity\n");
|
||||
break;
|
||||
case VECTOR:
|
||||
fprintf(f, "vector\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "write_param - Uknown param type %d\n", p->type);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
fprintf(f, "%s%s", END_TABULAR_CELL, BEGIN_TABULAR_CELL);
|
||||
fprintf(f, "%s\n", p->name);
|
||||
fprintf(f, "%s%s", END_TABULAR_CELL, BEGIN_TABULAR_CELL);
|
||||
iter = list_iterator(p->desc, FRONT);
|
||||
for(d = list_next(iter); d != NULL; d = list_next(iter)) {
|
||||
fprintf(f, "%s", d->desc);
|
||||
}
|
||||
fprintf(f, "%s%s%s", END_TABULAR_CELL, END_TABULAR_ROW, END_TABULAR);
|
||||
}
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2012 Walter Julius Hennecke, Ubergames
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to
|
||||
whom the Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
|
||||
WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef EXPORT_LYX_H_
|
||||
#define EXPORT_LYX_H_
|
||||
|
||||
#include "../../game/list.h"
|
||||
|
||||
typedef struct function_s* function_p;
|
||||
struct function_s {
|
||||
char* name;
|
||||
list_p desc;
|
||||
list_p params;
|
||||
} function_s;
|
||||
function_p create_function(void);
|
||||
void destroy_function(function_p f);
|
||||
|
||||
typedef struct desc_s* desc_p;
|
||||
struct desc_s {
|
||||
char* text;
|
||||
} desc_s;
|
||||
desc_p create_desc(void);
|
||||
void destroy_desc(desc_p d);
|
||||
|
||||
typedef enum { FLOAT, ENTITY, VECTOR } pType;
|
||||
|
||||
typedef struct param_s* param_p;
|
||||
struct param_s {
|
||||
pType type;
|
||||
char* name;
|
||||
list_p desc;
|
||||
} param_s;
|
||||
param_p create_param(void);
|
||||
void destroy_param(param_p p);
|
||||
|
||||
void write_function(function_p f, FILE* f);
|
||||
void write_desc(list_p d, FILE* f);
|
||||
void wrtie_params(list_p p, FILE* f);
|
||||
void write_param(param_p p, FILE* f);
|
||||
|
||||
#define BEGIN_SECTION "\\begin_layout Section"
|
||||
#define BEGIN_SUBSECTION "\\begin_layout Subsection"
|
||||
#define BEGIN_STANDART "\\begin_layout Standart"
|
||||
#define END_LAYOUT "\\ent_layout
|
||||
|
||||
#define BEGIN_TABULAR "\\begin_layout Standard\n\\begin_inset Tabular\n<lyxtabular version=\"3\" rows=\"2\" columns=\"3\">\n<features tabularvalignment=\"middle\">\n<column alignment=\"center\" valignment=\"top\" width=\"0\">\n<column alignment=\"center\" valignment=\"top\" width=\"0\">\n<column alignment=\"center\" valignment=\"top\" width=\"0\">\n"
|
||||
#define BEGIN_TABULAR_ROW "<row>\n"
|
||||
#define END_TABULAR_ROW "</row>\n"
|
||||
#define BEGIN_TABULAR_CELL "<cell allignment=\"center\" valignment=\"top\" usebox=\"none\">\n\\begin_inset Text\n\\begin_layout Plain Layout\n"
|
||||
#define END_TABULAR_CELL "\\end_layout\n\\end_inset\n</cell>\n"
|
||||
#define END_TABULAR "</lyxtabular>\n\\end_inset\n\\end_layout\n"
|
||||
|
||||
|
||||
#endif
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2012 Walter Julius Hennecke, Ubergames
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to
|
||||
whom the Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
|
||||
WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
FILE* out;
|
||||
|
||||
int lastState = 0;
|
||||
|
||||
#define YY_DECL int yylex()
|
||||
%}
|
||||
|
||||
%x C_COMMENT
|
||||
%x C_FUNCTION
|
||||
%x C_DESC
|
||||
%x C_PARAM
|
||||
%x C_STRING
|
||||
%x C_MODULE
|
||||
FUNCTEXT [a-zA-z0-9.(), \t]+
|
||||
STRING [a-zA-z0-9.(), \t\n!?<>/\\\[\]\{\}]+
|
||||
VAR [a-zA-Z0-9]+
|
||||
%%
|
||||
"/*" { BEGIN(C_COMMENT); puts("Found a comment"); }
|
||||
<C_COMMENT>"*/" { BEGIN(INITIAL); puts("End of comment"); }
|
||||
<C_COMMENT>[ \t\n*] ;
|
||||
<C_COMMENT>"luamodule" { BEGIN(C_MODULE); puts("Found a luamodule"); }
|
||||
<C_COMMENT>"\\function" { BEGIN(C_FUNCTION); puts("Found a \\function"); }
|
||||
<C_COMMENT>"\\desc" { BEGIN(C_DESC); puts("Found a \\desc"); }
|
||||
<C_COMMENT>"\\param" { BEGIN(C_PARAM); puts("Found a \\param"); }
|
||||
<C_COMMENT>[ \t\n]* ;
|
||||
<C_COMMENT>. ;
|
||||
|
||||
<C_MODULE>[ \t\n] ;
|
||||
<C_MODULE>{VAR} { BEGIN(C_COMMENT); printf("module name: %s\n", yytext); }
|
||||
<C_MODULE>. ;
|
||||
|
||||
<C_FUNCTION>";" { BEGIN(C_COMMENT); puts("End of function"); }
|
||||
<C_FUNCTION>{FUNCTEXT} { printf("function text: %s\n", yytext); }
|
||||
<C_FUNCTION>. ;
|
||||
|
||||
<C_DESC>";" { BEGIN(C_COMMENT); puts("End of desc"); }
|
||||
<C_DESC>"\"" { BEGIN(C_STRING); lastState = C_DESC; puts("Found a String"); }
|
||||
<C_DESC>[.\n]+ { printf("desc text: %s\n", yytext); }
|
||||
<C_DESC>. ;
|
||||
|
||||
<C_PARAM>";" { BEGIN(C_COMMENT); puts("End of param"); }
|
||||
<C_PARAM>"\"" { BEGIN(C_STRING); lastState = C_PARAM; puts("Found a string"); }
|
||||
<C_PARAM>[ \t] ;
|
||||
<C_PARAM>"float" { printf("foud type: %s\n", yytext); }
|
||||
<C_PARAM>"vec" { printf("foud type: %s\n", yytext); }
|
||||
<C_PARAM>"vector" { printf("foud type: %s\n", yytext); }
|
||||
<C_PARAM>"ent" { printf("foud type: %s\n", yytext); }
|
||||
<C_PARAM>"entity" { printf("foud type: %s\n", yytext); }
|
||||
<C_PARAM>{VAR} { printf("foud name: %s\n", yytext); }
|
||||
<C_PARAM>. ;
|
||||
|
||||
<C_STRING>"\"" { BEGIN(lastState); puts("End of String"); }
|
||||
<C_STRING>{STRING} { printf("string text: %s\n", yytext); }
|
||||
<C_STRING>. ;
|
||||
|
||||
"\n" ;
|
||||
. ;
|
||||
%%
|
||||
|
||||
main(int argc, char *argv[]) {
|
||||
FILE *in;
|
||||
|
||||
if(argc < 3) {
|
||||
printf("Usage: %s <input file> <output file>\n", argv[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
in = fopen(argv[1], "r");
|
||||
if(!in) {
|
||||
printf("Could not open \'%s\'.\n", argv[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
out = fopen(argv[2], "a");
|
||||
if(!out) {
|
||||
fclose(in);
|
||||
printf("Could not open \'%s\'.\n", argv[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
yyin = in;
|
||||
|
||||
yylex();
|
||||
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
/* luamodule test */
|
||||
|
||||
int a;
|
||||
|
||||
/* test */
|
||||
void test() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* \function test.func(float a, entity b);
|
||||
* \param float a "this is a";
|
||||
* \desc test 123;
|
||||
* \desc "test
|
||||
* test2";
|
||||
*/
|
Loading…
Reference in a new issue