embryo_cc line numebrs match up with edje .edc ones now - much better foir

debugging


SVN revision: 9891
This commit is contained in:
Carsten Haitzler 2004-04-25 04:20:58 +00:00
parent 30179574bd
commit ec680ae695
4 changed files with 318 additions and 268 deletions

View File

@ -49,12 +49,14 @@ struct _Font
struct _Code
{
int l1, l2;
char *shared;
Evas_List *programs;
};
struct _Code_Program
{
int l1, l2;
int id;
char *script;
};
@ -72,8 +74,10 @@ void data_process_script_lookups(void);
int is_verbatim(void);
void track_verbatim(int on);
void set_verbatim(char *s);
void set_verbatim(char *s, int l1, int l2);
char *get_verbatim(void);
int get_verbatim_line1(void);
int get_verbatim_line2(void);
void compile(void);
int is_param(int n);
int is_num(int n);

View File

@ -398,6 +398,8 @@ ob_collections_group_script(void)
s = get_verbatim();
if (s)
{
cd->l1 = get_verbatim_line1();
cd->l2 = get_verbatim_line2();
if (cd->shared)
{
fprintf(stderr, "%s: Error. parse error %s:%i. There is already an existing script section for the group\n",
@ -405,7 +407,7 @@ ob_collections_group_script(void)
exit(-1);
}
cd->shared = s;
set_verbatim(NULL);
set_verbatim(NULL, 0, 0);
}
}
}
@ -1422,10 +1424,12 @@ ob_collections_group_programs_program_script(void)
Code_Program *cp;
cp = mem_alloc(SZ(Code_Program));
cp->l1 = get_verbatim_line1();
cp->l2 = get_verbatim_line2();
cp->id = ep->id;
cp->script = s;
cd->programs = evas_list_append(cd->programs, cp);
set_verbatim(NULL);
set_verbatim(NULL, 0, 0);
ep->action = EDJE_ACTION_TYPE_SCRIPT;
}
}

View File

@ -409,6 +409,7 @@ data_write(void)
for (i = 0, l = codes; l; l = l->next, i++)
{
Code *cd;
int ln = 0;
cd = l->data;
if ((cd->shared) || (cd->programs))
@ -430,8 +431,18 @@ data_write(void)
{
Evas_List *ll;
fprintf(f, "#include <edje>\n\n");
if (cd->shared) fprintf(f, "%s\n", cd->shared);
fprintf(f, "#include <edje>\n");
ln = 2;
if (cd->shared)
{
while (ln < (cd->l1 - 1))
{
fprintf(f, " \n");
ln++;
}
fprintf(f, "%s\n", cd->shared);
ln += cd->l2 - cd->l1 + 1;
}
for (ll = cd->programs; ll; ll = ll->next)
{
Code_Program *cp;
@ -439,11 +450,17 @@ data_write(void)
cp = ll->data;
if (cp->script)
{
while (ln < (cp->l1 - 1))
{
fprintf(f, " \n");
ln++;
}
/* FIXME: this prototype needs to be */
/* formalised and set in stone */
fprintf(f, "public _p%i(sig[], src[]) {\n", cp->id);
fprintf(f, "%s\n", cp->script);
fprintf(f, "}\n");
fprintf(f, "public _p%i(sig[], src[]) {", cp->id);
fprintf(f, "%s", cp->script);
fprintf(f, "}");
ln += cp->l2 - cp->l1 + 1;
}
}
fclose(f);

View File

@ -38,6 +38,8 @@ Evas_List *params = NULL;
static char file_buf[4096];
static int verbatim = 0;
static int verbatim_line1 = 0;
static int verbatim_line2 = 0;
static char *verbatim_str = NULL;
static void
@ -387,15 +389,22 @@ parse(char *data, off_t size)
int inquotes = 0;
int insquotes = 0;
int squigglie = 1;
int l1 = 0, l2 = 0;
char *verbatim_1;
char *verbatim_2;
while ((p[0] != '{') && (p < end)) p++;
l1 = line;
while ((p[0] != '{') && (p < end))
{
if (*p == '\n') line++;
p++;
}
p++;
verbatim_1 = p;
verbatim_2 = NULL;
for (; p < end; p++)
{
if (*p == '\n') line++;
if (escaped) escaped = 0;
if (!escaped)
{
@ -423,6 +432,7 @@ parse(char *data, off_t size)
if (squigglie == 0)
{
verbatim_2 = p - 1;
l2 = line;
break;
}
}
@ -437,7 +447,7 @@ parse(char *data, off_t size)
v = malloc(l + 1);
strncpy(v, verbatim_1, l);
v[l] = 0;
set_verbatim(v);
set_verbatim(v, l1, l2);
}
else
{
@ -478,8 +488,10 @@ track_verbatim(int on)
}
void
set_verbatim(char *s)
set_verbatim(char *s, int l1, int l2)
{
verbatim_line1 = l1;
verbatim_line2 = l2;
verbatim_str = s;
}
@ -489,6 +501,18 @@ get_verbatim(void)
return verbatim_str;
}
int
get_verbatim_line1(void)
{
return verbatim_line1;
}
int
get_verbatim_line2(void)
{
return verbatim_line2;
}
void
compile(void)
{
@ -722,24 +746,20 @@ parse_float_range(int n, double f, double t)
return i;
}
/* simple expression parsing stuff */
/*
* alpha ::= beta + beta || beta
* beta ::= gamma + gamma || gamma
* gamma ::= num || delta
* delta ::= '(' alpha ')'
*
* */
*/
/* int set of function */
int my_atoi(const char * s)
int
my_atoi(const char * s)
{
int res = 0;
char *p, *p_in, *p_out;
@ -756,11 +776,11 @@ int my_atoi(const char * s)
}
/* remove spaces and tabs */
p_in = s;
p_in = (char *)s;
p_out = buf;
while(*p_in)
while (*p_in)
{
if((0x20 != *p_in) && (0x09 != *p_in))
if ((0x20 != *p_in) && (0x09 != *p_in))
{
*p_out = *p_in;
p_out++;
@ -773,8 +793,8 @@ int my_atoi(const char * s)
return res;
}
char * _deltai(char *s, int * val)
char *
_deltai(char *s, int * val)
{
if (!val) return;
@ -795,7 +815,8 @@ char * _deltai(char *s, int * val)
return s;
}
char * _gammai(char *s, int * val)
char *
_gammai(char *s, int * val)
{
if (!val) return;
@ -804,7 +825,7 @@ char * _gammai(char *s, int * val)
s = _get_numi(s, val);
return s;
}
else if ( '(' == s[0])
else if ('(' == s[0])
{
s = _deltai(s, val);
return s;
@ -815,8 +836,8 @@ char * _gammai(char *s, int * val)
return s;
}
char * _betai(char *s, int * val)
char *
_betai(char *s, int * val)
{
int a1, a2;
char op;
@ -826,7 +847,7 @@ char * _betai(char *s, int * val)
s = _gammai(s, &a1);
while(_is_op1i(s[0]))
while (_is_op1i(s[0]))
{
op = s[0];
s++;
@ -839,7 +860,8 @@ char * _betai(char *s, int * val)
return s;
}
char * _alphai(char *s, int * val)
char *
_alphai(char *s, int * val)
{
int a1, a2;
char op;
@ -849,7 +871,7 @@ char * _alphai(char *s, int * val)
s = _betai(s, &a1);
while(_is_op2i(s[0]))
while (_is_op2i(s[0]))
{
op = s[0];
s++;
@ -861,8 +883,8 @@ char * _alphai(char *s, int * val)
return s;
}
char * _get_numi(char *s, int * val)
char *
_get_numi(char *s, int * val)
{
char buf[4096];
int pos = 0;
@ -884,7 +906,8 @@ char * _get_numi(char *s, int * val)
return (s+pos);
}
int _is_numi(char c)
int
_is_numi(char c)
{
if (((c >= '0') && (c <= '9')) || ('-' == c) || ('+' == c))
return 1;
@ -892,7 +915,8 @@ int _is_numi(char c)
return 0;
}
int _is_op1i(char c)
int
_is_op1i(char c)
{
switch(c)
{
@ -903,7 +927,8 @@ int _is_op1i(char c)
return 0;
}
int _is_op2i(char c)
int
_is_op2i(char c)
{
switch(c)
{
@ -914,8 +939,8 @@ int _is_op2i(char c)
return 0;
}
int _calci(char op, int a, int b)
int
_calci(char op, int a, int b)
{
switch(op)
{
@ -942,11 +967,10 @@ int _calci(char op, int a, int b)
}
}
/* float set of functoins */
double my_atof(const char * s)
double
my_atof(const char * s)
{
double res = 0;
char *p, *p_in, *p_out;
@ -963,11 +987,11 @@ double my_atof(const char * s)
}
/* remove spaces and tabs */
p_in = s;
p_in = (char *)s;
p_out = buf;
while(*p_in)
while (*p_in)
{
if((0x20 != *p_in) && (0x09 != *p_in))
if ((0x20 != *p_in) && (0x09 != *p_in))
{
*p_out = *p_in;
p_out++;
@ -981,8 +1005,8 @@ double my_atof(const char * s)
return res;
}
char * _deltaf(char *s, double * val)
char *
_deltaf(char *s, double * val)
{
if (!val) return;
@ -1003,7 +1027,8 @@ char * _deltaf(char *s, double * val)
return s;
}
char * _gammaf(char *s, double * val)
char *
_gammaf(char *s, double * val)
{
if (!val) return;
@ -1012,7 +1037,7 @@ char * _gammaf(char *s, double * val)
s = _get_numf(s, val);
return s;
}
else if ( '(' == s[0])
else if ('(' == s[0])
{
s = _deltaf(s, val);
return s;
@ -1023,8 +1048,8 @@ char * _gammaf(char *s, double * val)
return s;
}
char * _betaf(char *s, double * val)
char *
_betaf(char *s, double * val)
{
double a1=0, a2=0;
char op;
@ -1034,7 +1059,7 @@ char * _betaf(char *s, double * val)
s = _gammaf(s, &a1);
while(_is_op1f(s[0]))
while (_is_op1f(s[0]))
{
op = s[0];
s++;
@ -1047,8 +1072,8 @@ char * _betaf(char *s, double * val)
return s;
}
char * _alphaf(char *s, double * val)
char *
_alphaf(char *s, double * val)
{
double a1=0, a2=0;
char op;
@ -1058,7 +1083,7 @@ char * _alphaf(char *s, double * val)
s = _betaf(s, &a1);
while(_is_op2f(s[0]))
while (_is_op2f(s[0]))
{
op = s[0];
s++;
@ -1071,8 +1096,8 @@ char * _alphaf(char *s, double * val)
return s;
}
char * _get_numf(char *s, double * val)
char *
_get_numf(char *s, double * val)
{
char buf[4096];
int pos = 0;
@ -1095,7 +1120,8 @@ char * _get_numf(char *s, double * val)
return (s+pos);
}
int _is_numf(char c)
int
_is_numf(char c)
{
if (((c >= '0') && (c <= '9'))
|| ('-' == c)
@ -1106,7 +1132,8 @@ int _is_numf(char c)
return 0;
}
int _is_op1f(char c)
int
_is_op1f(char c)
{
switch(c)
{
@ -1117,7 +1144,8 @@ int _is_op1f(char c)
return 0;
}
int _is_op2f(char c)
int
_is_op2f(char c)
{
switch(c)
{
@ -1128,8 +1156,8 @@ int _is_op2f(char c)
return 0;
}
double _calcf(char op, double a, double b)
double
_calcf(char op, double a, double b)
{
switch(op)
{
@ -1140,8 +1168,7 @@ double _calcf(char op, double a, double b)
a -= b;
return a;
case '/':
if(0 != b)
a /= b;
if (b != 0) a /= b;
else
fprintf(stderr, "%s: Error. %s:%i divide by zero\n",
progname, file_in, line);
@ -1155,5 +1182,3 @@ double _calcf(char op, double a, double b)
return a;
}
}