mirror of
https://github.com/UberGames/rpgxEF.git
synced 2024-11-10 07:11:34 +00:00
export functions for lyx (WIP)
This commit is contained in:
parent
1abb89ff21
commit
522b00756f
2 changed files with 73 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
|||
#include "export_lyx.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
function_p create_function(void) {
|
||||
function_p n = (function_p)malloc(sizeof(function_s));
|
||||
|
@ -80,3 +81,64 @@ void destroy_param(param_p p) {
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,22 +30,22 @@ struct param_s {
|
|||
param_p create_param(void);
|
||||
void destroy_param(param_p p);
|
||||
|
||||
void write_function(function_p f);
|
||||
void write_desc(list_p d);
|
||||
void write_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\
|
||||
\\begin_inset Tabular\
|
||||
<lyxtabular version=\"3\" rows=\"2\" columns=\"3\">\
|
||||
<features tabularvalignment=\"middle\">\
|
||||
<column alignment=\"center\" valignment=\"top\" width=\"0\">\
|
||||
<column alignment=\"center\" valignment=\"top\" width=\"0\">\
|
||||
<column alignment=\"center\" valignment=\"top\" width=\"0\">"
|
||||
#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
|
||||
|
|
Loading…
Reference in a new issue