genius r750 - in trunk: . src
- From: jirka svn gnome org
- To: svn-commits-list gnome org
- Subject: genius r750 - in trunk: . src
- Date: Sun, 15 Mar 2009 05:01:35 +0000 (UTC)
Author: jirka
Date: Sun Mar 15 05:01:35 2009
New Revision: 750
URL: http://svn.gnome.org/viewvc/genius?rev=750&view=rev
Log:
Sun Mar 15 00:01:20 2009 Jiri (George) Lebl <jirka 5z com>
* src/*.[ch]: do much interface cleanup again.
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/src/calc.c
trunk/src/compil.c
trunk/src/eval.c
trunk/src/eval.h
trunk/src/funclib.c
trunk/src/funclibhelper.cP
trunk/src/gnome-genius.c
trunk/src/graphing.c
trunk/src/matop.c
trunk/src/matrixw.c
trunk/src/parse.y
trunk/src/parseutil.c
trunk/src/parseutil.h
trunk/src/structs.h
trunk/src/symbolic.c
trunk/src/utype.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sun Mar 15 05:01:35 2009
@@ -4,7 +4,7 @@
* Draw solutions for vector fields
* Add VectorfieldDrawSolution and VectorfieldClearSolutions
* AskString now allows setting a default
-* LinePlotDrawLine can change the plot winow and draw arrows
+* LinePlotDrawLine can change the plot window and draw arrows
* Read-only files are handled properly
* Clip all lines to within the plot window
* LinePlotWindow, SurfacePlotWindow now update the zoom immediately
@@ -13,6 +13,8 @@
* Fix line plot scale precision in case the x and y axis have very different
scales
* Remove dependence on libgnome/ui
+* PLUGIN API CHANGE: interface namespace is cleaned up. But I don't know of
+ any plugins that exist and thus break.
* An icon for the plot button
* Some optimizations
* Several other minor bugfixes
Modified: trunk/src/calc.c
==============================================================================
--- trunk/src/calc.c (original)
+++ trunk/src/calc.c Sun Mar 15 05:01:35 2009
@@ -544,12 +544,12 @@
gboolean extra_param2 = FALSE;
GelETree *l,*r;
GEL_GET_LR(n,l,r);
- if (l->type == VALUE_NODE &&
+ if (l->type == GEL_VALUE_NODE &&
(mpw_is_complex (l->val.value) ||
mpw_sgn (l->val.value) < 0 ||
mpw_is_rational (l->val.value)))
extra_param1 = TRUE;
- if (r->type == VALUE_NODE &&
+ if (r->type == GEL_VALUE_NODE &&
(mpw_is_complex (r->val.value) ||
mpw_sgn (r->val.value) < 0 ||
mpw_is_rational (r->val.value)))
@@ -602,7 +602,7 @@
GelETree *li;
switch(n->op.oper) {
- case E_SEPAR:
+ case GEL_E_SEPAR:
gel_output_string (gelo,"(");
r = n->op.args;
while (r != NULL) {
@@ -613,11 +613,11 @@
}
gel_output_string (gelo,")");
break;
- case E_EQUALS:
+ case GEL_E_EQUALS:
append_binaryoper(gelo,"=",n); break;
- case E_PARAMETER:
+ case GEL_E_PARAMETER:
GEL_GET_LRR(n,l,r,rr);
- if (l->type != NULL_NODE) {
+ if (l->type != GEL_NULL_NODE) {
gel_output_string(gelo,"(parameter (");
gel_print_etree (gelo, l, FALSE);
gel_output_string(gelo,") ");
@@ -633,56 +633,56 @@
gel_output_string(gelo,")");
}
break;
- case E_ABS:
+ case GEL_E_ABS:
GEL_GET_L(n,l);
gel_output_string(gelo,"|");
gel_print_etree(gelo, l, FALSE);
gel_output_string(gelo,"|");
break;
- case E_PLUS:
+ case GEL_E_PLUS:
append_binaryoper(gelo,"+",n); break;
- case E_ELTPLUS:
+ case GEL_E_ELTPLUS:
append_binaryoper(gelo,".+",n); break;
- case E_MINUS:
+ case GEL_E_MINUS:
append_binaryoper(gelo,"-",n); break;
- case E_ELTMINUS:
+ case GEL_E_ELTMINUS:
append_binaryoper(gelo,".-",n); break;
- case E_MUL:
+ case GEL_E_MUL:
append_binaryoper(gelo,"*",n); break;
- case E_ELTMUL:
+ case GEL_E_ELTMUL:
append_binaryoper(gelo,".*",n); break;
- case E_DIV:
+ case GEL_E_DIV:
append_binaryoper(gelo,"/",n); break;
- case E_ELTDIV:
+ case GEL_E_ELTDIV:
append_binaryoper(gelo,"./",n); break;
- case E_BACK_DIV:
- if(n->op.args->type == VALUE_NODE &&
- n->op.args->any.next->type == VALUE_NODE)
+ case GEL_E_BACK_DIV:
+ if(n->op.args->type == GEL_VALUE_NODE &&
+ n->op.args->any.next->type == GEL_VALUE_NODE)
append_binaryoper(gelo," \\ ",n);
else
append_binaryoper(gelo,"\\",n);
break;
- case E_ELT_BACK_DIV:
- if(n->op.args->type == VALUE_NODE &&
- n->op.args->any.next->type == VALUE_NODE)
+ case GEL_E_ELT_BACK_DIV:
+ if(n->op.args->type == GEL_VALUE_NODE &&
+ n->op.args->any.next->type == GEL_VALUE_NODE)
append_binaryoper(gelo," .\\ ",n);
else
append_binaryoper(gelo,".\\",n);
break;
- case E_MOD:
+ case GEL_E_MOD:
append_binaryoper(gelo,"%",n); break;
- case E_ELTMOD:
+ case GEL_E_ELTMOD:
append_binaryoper(gelo,".%",n); break;
- case E_NEG:
+ case GEL_E_NEG:
append_unaryoper(gelo,"-",n); break;
- case E_EXP:
+ case GEL_E_EXP:
append_anal_binaryoper(gelo,"^",n); break;
- case E_ELTEXP:
+ case GEL_E_ELTEXP:
append_anal_binaryoper(gelo,".^",n); break;
- case E_FACT:
+ case GEL_E_FACT:
GEL_GET_L(n,l);
gel_output_string(gelo, "(");
- if (l->type == VALUE_NODE &&
+ if (l->type == GEL_VALUE_NODE &&
(mpw_is_complex (l->val.value) ||
mpw_sgn (l->val.value) < 0 ||
mpw_is_rational (l->val.value))) {
@@ -694,10 +694,10 @@
}
gel_output_string(gelo, "!)");
break;
- case E_DBLFACT:
+ case GEL_E_DBLFACT:
GEL_GET_L(n,l);
gel_output_string(gelo, "(");
- if (l->type == VALUE_NODE &&
+ if (l->type == GEL_VALUE_NODE &&
(mpw_is_complex (l->val.value) ||
mpw_sgn (l->val.value) < 0 ||
mpw_is_rational (l->val.value))) {
@@ -710,47 +710,47 @@
gel_output_string(gelo, "!!)");
break;
- case E_TRANSPOSE:
+ case GEL_E_TRANSPOSE:
GEL_GET_L(n,l);
gel_output_string(gelo, "(");
gel_print_etree (gelo, l, FALSE);
gel_output_string(gelo, ".')");
break;
- case E_CONJUGATE_TRANSPOSE:
+ case GEL_E_CONJUGATE_TRANSPOSE:
GEL_GET_L(n,l);
gel_output_string(gelo, "(");
gel_print_etree (gelo, l, FALSE);
gel_output_string(gelo, "')");
break;
- case E_EQ_CMP:
+ case GEL_E_EQ_CMP:
append_binaryoper(gelo,"==",n); break;
- case E_NE_CMP:
+ case GEL_E_NE_CMP:
append_binaryoper(gelo,"!=",n); break;
- case E_CMP_CMP:
+ case GEL_E_CMP_CMP:
append_binaryoper(gelo,"<=>",n); break;
- case E_LT_CMP:
+ case GEL_E_LT_CMP:
append_binaryoper(gelo,"<",n); break;
- case E_GT_CMP:
+ case GEL_E_GT_CMP:
append_binaryoper(gelo,">",n); break;
- case E_LE_CMP:
+ case GEL_E_LE_CMP:
append_binaryoper(gelo,"<=",n); break;
- case E_GE_CMP:
+ case GEL_E_GE_CMP:
append_binaryoper(gelo,">=",n); break;
- case E_LOGICAL_AND:
+ case GEL_E_LOGICAL_AND:
append_binaryoper(gelo," and ",n); break;
- case E_LOGICAL_OR:
+ case GEL_E_LOGICAL_OR:
append_binaryoper(gelo," or ",n); break;
- case E_LOGICAL_XOR:
+ case GEL_E_LOGICAL_XOR:
append_binaryoper(gelo," xor ",n); break;
- case E_LOGICAL_NOT:
+ case GEL_E_LOGICAL_NOT:
append_unaryoper(gelo,"not ",n); break;
- case E_REGION_SEP:
+ case GEL_E_REGION_SEP:
append_binaryoper(gelo,":",n); break;
- case E_REGION_SEP_BY:
+ case GEL_E_REGION_SEP_BY:
GEL_GET_LRR(n,l,r,rr);
gel_output_string(gelo,"(");
gel_print_etree (gelo, l, FALSE);
@@ -761,7 +761,7 @@
gel_output_string(gelo,")");
break;
- case E_GET_VELEMENT:
+ case GEL_E_GET_VELEMENT:
GEL_GET_LR(n,l,r);
gel_output_string(gelo,"(");
gel_print_etree (gelo, l, FALSE);
@@ -770,7 +770,7 @@
gel_output_string(gelo,"))");
break;
- case E_GET_ELEMENT:
+ case GEL_E_GET_ELEMENT:
GEL_GET_LRR(n,l,r,rr);
gel_output_string(gelo,"(");
gel_print_etree (gelo, l, FALSE);
@@ -780,7 +780,7 @@
gel_print_etree (gelo, rr, FALSE);
gel_output_string(gelo,"))");
break;
- case E_GET_ROW_REGION:
+ case GEL_E_GET_ROW_REGION:
GEL_GET_LR(n,l,r);
gel_output_string(gelo,"(");
gel_print_etree (gelo, l, FALSE);
@@ -788,7 +788,7 @@
gel_print_etree (gelo, r, FALSE);
gel_output_string(gelo,",))");
break;
- case E_GET_COL_REGION:
+ case GEL_E_GET_COL_REGION:
GEL_GET_LR(n,l,r);
gel_output_string(gelo,"(");
gel_print_etree (gelo, l, FALSE);
@@ -797,14 +797,14 @@
gel_output_string(gelo,"))");
break;
- case E_QUOTE:
+ case GEL_E_QUOTE:
append_unaryoper(gelo,"`",n); break;
- case E_REFERENCE:
+ case GEL_E_REFERENCE:
append_unaryoper(gelo,"&",n); break;
- case E_DEREFERENCE:
+ case GEL_E_DEREFERENCE:
append_unaryoper(gelo,"*",n); break;
- case E_IF_CONS:
+ case GEL_E_IF_CONS:
GEL_GET_LR(n,l,r);
gel_output_string(gelo,"(if ");
gel_print_etree (gelo, l, FALSE);
@@ -812,7 +812,7 @@
gel_print_etree (gelo, r, FALSE);
gel_output_string(gelo,")");
break;
- case E_IFELSE_CONS:
+ case GEL_E_IFELSE_CONS:
GEL_GET_LRR(n,l,r,rr);
gel_output_string(gelo,"(if ");
gel_print_etree (gelo, l, FALSE);
@@ -822,7 +822,7 @@
gel_print_etree (gelo, rr, FALSE);
gel_output_string(gelo,")");
break;
- case E_WHILE_CONS:
+ case GEL_E_WHILE_CONS:
GEL_GET_LR(n,l,r);
gel_output_string(gelo,"(while ");
gel_print_etree (gelo, l, FALSE);
@@ -830,7 +830,7 @@
gel_print_etree (gelo, r, FALSE);
gel_output_string(gelo,")");
break;
- case E_UNTIL_CONS:
+ case GEL_E_UNTIL_CONS:
GEL_GET_LR(n,l,r);
gel_output_string(gelo, "(until ");
gel_print_etree (gelo, l, FALSE);
@@ -838,7 +838,7 @@
gel_print_etree (gelo, r, FALSE);
gel_output_string(gelo, ")");
break;
- case E_DOWHILE_CONS:
+ case GEL_E_DOWHILE_CONS:
GEL_GET_LR(n,l,r);
gel_output_string (gelo, "(do ");
gel_print_etree (gelo, l, FALSE);
@@ -846,7 +846,7 @@
gel_print_etree (gelo, r, FALSE);
gel_output_string (gelo, ")");
break;
- case E_DOUNTIL_CONS:
+ case GEL_E_DOUNTIL_CONS:
GEL_GET_LR(n,l,r);
gel_output_string(gelo,"(do ");
gel_print_etree (gelo, l, FALSE);
@@ -854,7 +854,7 @@
gel_print_etree (gelo, r, FALSE);
gel_output_string(gelo,")");
break;
- case E_FOR_CONS:
+ case GEL_E_FOR_CONS:
GEL_GET_ABCD (n, a, b, c, d);
gel_output_string (gelo, "(for ");
gel_print_etree (gelo, a, FALSE);
@@ -866,7 +866,7 @@
gel_print_etree (gelo, d, FALSE);
gel_output_string (gelo, ")");
break;
- case E_FORBY_CONS:
+ case GEL_E_FORBY_CONS:
GEL_GET_ABCDE (n, a, b, c, d, e);
gel_output_string (gelo, "(for ");
gel_print_etree (gelo, a, FALSE);
@@ -880,7 +880,7 @@
gel_print_etree (gelo, e, FALSE);
gel_output_string (gelo, ")");
break;
- case E_FORIN_CONS:
+ case GEL_E_FORIN_CONS:
GEL_GET_LRR(n,l,r,rr);
gel_output_string(gelo,"(for ");
gel_print_etree (gelo, l, FALSE);
@@ -890,7 +890,7 @@
gel_print_etree (gelo, rr, FALSE);
gel_output_string(gelo,")");
break;
- case E_SUM_CONS:
+ case GEL_E_SUM_CONS:
GEL_GET_ABCD (n, a, b, c, d);
gel_output_string (gelo, "(sum ");
gel_print_etree (gelo, a, FALSE);
@@ -902,7 +902,7 @@
gel_print_etree (gelo, d, FALSE);
gel_output_string (gelo, ")");
break;
- case E_SUMBY_CONS:
+ case GEL_E_SUMBY_CONS:
GEL_GET_ABCDE (n, a, b, c, d, e);
gel_output_string (gelo, "(sum ");
gel_print_etree (gelo, a, FALSE);
@@ -916,7 +916,7 @@
gel_print_etree (gelo, e, FALSE);
gel_output_string (gelo, ")");
break;
- case E_SUMIN_CONS:
+ case GEL_E_SUMIN_CONS:
GEL_GET_LRR(n,l,r,rr);
gel_output_string(gelo,"(sum ");
gel_print_etree (gelo, l, FALSE);
@@ -926,7 +926,7 @@
gel_print_etree (gelo, rr, FALSE);
gel_output_string(gelo,")");
break;
- case E_PROD_CONS:
+ case GEL_E_PROD_CONS:
GEL_GET_ABCD(n,a,b,c,d);
gel_output_string (gelo, "(prod ");
gel_print_etree (gelo, a, FALSE);
@@ -938,7 +938,7 @@
gel_print_etree (gelo, d, FALSE);
gel_output_string (gelo, ")");
break;
- case E_PRODBY_CONS:
+ case GEL_E_PRODBY_CONS:
GEL_GET_ABCDE (n, a, b, c, d, e);
gel_output_string (gelo, "(prod ");
gel_print_etree (gelo, a, FALSE);
@@ -952,7 +952,7 @@
gel_print_etree (gelo, e, FALSE);
gel_output_string (gelo, ")");
break;
- case E_PRODIN_CONS:
+ case GEL_E_PRODIN_CONS:
GEL_GET_LRR(n,l,r,rr);
gel_output_string(gelo,"(prod ");
gel_print_etree (gelo, l, FALSE);
@@ -963,18 +963,18 @@
gel_output_string(gelo,")");
break;
- case E_DIRECTCALL:
- case E_CALL:
+ case GEL_E_DIRECTCALL:
+ case GEL_E_CALL:
GEL_GET_L(n,l);
- if (l->type==IDENTIFIER_NODE) {
+ if (l->type==GEL_IDENTIFIER_NODE) {
gel_output_string (gelo, l->id.id->token);
- } else if (l->type == FUNCTION_NODE &&
+ } else if (l->type == GEL_FUNCTION_NODE &&
l->func.func->id != NULL) {
gel_output_string (gelo, l->func.func->id->token);
- } else if(l->type == OPERATOR_NODE && l->op.oper == E_DEREFERENCE) {
+ } else if(l->type == GEL_OPERATOR_NODE && l->op.oper == GEL_E_DEREFERENCE) {
GelETree *t;
GEL_GET_L(l,t);
- if G_UNLIKELY (t->type!=IDENTIFIER_NODE) {
+ if G_UNLIKELY (t->type!=GEL_IDENTIFIER_NODE) {
gel_errorout (_("Bad identifier for function node!"));
gel_output_string(gelo,"?)");
break;
@@ -997,19 +997,19 @@
}
gel_output_string(gelo,")");
break;
- case E_RETURN:
+ case GEL_E_RETURN:
append_unaryoper(gelo,"return ",n); break;
- case E_BAILOUT:
+ case GEL_E_BAILOUT:
gel_output_string(gelo,"(bailout)"); break;
- case E_EXCEPTION:
+ case GEL_E_EXCEPTION:
gel_output_string(gelo,"(exception)"); break;
- case E_CONTINUE:
+ case GEL_E_CONTINUE:
gel_output_string(gelo,"(continue)"); break;
- case E_BREAK:
+ case GEL_E_BREAK:
gel_output_string(gelo,"(break)"); break;
- case E_MOD_CALC:
+ case GEL_E_MOD_CALC:
append_binaryoper(gelo," mod ",n); break;
- case E_DEFEQUALS:
+ case GEL_E_DEFEQUALS:
append_binaryoper (gelo, ":=", n); break;
default:
@@ -1032,17 +1032,17 @@
int oper= GPOINTER_TO_INT(oli->data);
gel_print_etree (gelo, li, FALSE);
switch(oper) {
- case E_EQ_CMP:
+ case GEL_E_EQ_CMP:
gel_output_string(gelo,"=="); break;
- case E_NE_CMP:
+ case GEL_E_NE_CMP:
gel_output_string(gelo,"!="); break;
- case E_LT_CMP:
+ case GEL_E_LT_CMP:
gel_output_string(gelo,"<"); break;
- case E_GT_CMP:
+ case GEL_E_GT_CMP:
gel_output_string(gelo,">"); break;
- case E_LE_CMP:
+ case GEL_E_LE_CMP:
gel_output_string(gelo,"<="); break;
- case E_GE_CMP:
+ case GEL_E_GE_CMP:
gel_output_string(gelo,">="); break;
default:
g_assert_not_reached();
@@ -1283,7 +1283,7 @@
for (i = 0; i < gel_matrixw_width(m); i++) {
GelETree *t = gel_matrixw_get_index (m, i, j);
if (t != NULL &&
- t->type == VALUE_NODE &&
+ t->type == GEL_VALUE_NODE &&
mpw_chop_p (t->val.value, chop_when))
return TRUE;
}
@@ -1369,15 +1369,15 @@
/* all non-value nodes printed as <ci></ci> and
* value nodes as <cn></cn> */
if (gel_calcstate.output_style == GEL_OUTPUT_MATHML &&
- n->type != VALUE_NODE)
+ n->type != GEL_VALUE_NODE)
gel_output_string (gelo, "<ci>");
switch(n->type) {
- case NULL_NODE:
+ case GEL_NULL_NODE:
gel_output_string (gelo, "(null)");
break;
- case VALUE_NODE:
+ case GEL_VALUE_NODE:
p=mpw_getstring_chop (n->val.value,gel_calcstate.max_digits,
gel_calcstate.scientific_notation,
gel_calcstate.results_as_floats,
@@ -1402,7 +1402,7 @@
gel_output_string (gelo, "</cn>");
g_free(p);
break;
- case MATRIX_NODE:
+ case GEL_MATRIX_NODE:
old_force_chop = gelo->force_chop;
if ( ! gelo->force_chop &&
matrix_chop_p (n->mat.matrix,
@@ -1416,33 +1416,33 @@
appendmatrix (gelo, n->mat.matrix);
gelo->force_chop = old_force_chop;
break;
- case SET_NODE:
+ case GEL_SET_NODE:
/* FIXME: not implemented */
g_assert_not_reached ();
break;
- case POLYNOMIAL_NODE:
+ case GEL_POLYNOMIAL_NODE:
appendpolynomial (gelo, n);
break;
- case OPERATOR_NODE:
+ case GEL_OPERATOR_NODE:
appendoper(gelo,n);
break;
- case IDENTIFIER_NODE:
+ case GEL_IDENTIFIER_NODE:
gel_output_string(gelo,n->id.id->token);
break;
- case STRING_NODE:
+ case GEL_STRING_NODE:
gel_output_string(gelo,"\"");
p = gel_escape_string(n->str.str);
gel_output_string(gelo,p);
g_free(p);
gel_output_string(gelo,"\"");
break;
- case FUNCTION_NODE:
+ case GEL_FUNCTION_NODE:
append_func (gelo, n->func.func);
break;
- case COMPARISON_NODE:
+ case GEL_COMPARISON_NODE:
appendcomp(gelo,n);
break;
- case BOOL_NODE:
+ case GEL_BOOL_NODE:
if (n->bool_.bool_)
gel_output_string (gelo, "true");
else
@@ -1456,7 +1456,7 @@
/* all non-value nodes printed as <ci></ci> and
* value nodes as <cn></cn> */
if (gel_calcstate.output_style == GEL_OUTPUT_MATHML &&
- n->type != VALUE_NODE)
+ n->type != GEL_VALUE_NODE)
gel_output_string (gelo, "</ci>");
gel_output_pop_nonotify (gelo);
@@ -1649,10 +1649,10 @@
/*do a nice printout of matrices if that's the
top node*/
gel_output_push_nonotify (gelo);
- if (n->type == VALUE_NODE &&
+ if (n->type == GEL_VALUE_NODE &&
gel_calcstate.output_style == GEL_OUTPUT_NORMAL) {
pretty_print_value_normal (gelo, n);
- } else if (n->type == MATRIX_NODE) {
+ } else if (n->type == GEL_MATRIX_NODE) {
int i, j, w, h;
int old_force_chop = gelo->force_chop;
char **entries;
@@ -3217,7 +3217,7 @@
if (ret == NULL)
return;
- if(ret->type != NULL_NODE && gelo) {
+ if(ret->type != GEL_NULL_NODE && gelo) {
if(prefix) {
gel_output_string(gelo, prefix);
}
@@ -3229,14 +3229,14 @@
}
/*set ans to the last answer*/
- if(ret->type == FUNCTION_NODE) {
+ if(ret->type == GEL_FUNCTION_NODE) {
if(ret->func.func)
d_addfunc(d_makerealfunc(ret->func.func,d_intern("Ans"),TRUE));
else
d_addfunc(d_makevfunc(d_intern("Ans"),gel_makenum_ui(0)));
gel_freetree(ret);
- } else if(ret->type == OPERATOR_NODE &&
- ret->op.oper == E_REFERENCE) {
+ } else if(ret->type == GEL_OPERATOR_NODE &&
+ ret->op.oper == GEL_E_REFERENCE) {
GelETree *t = ret->op.args;
if(!t) {
GelEFunc *rf = d_lookup_global(t->id.id);
Modified: trunk/src/compil.c
==============================================================================
--- trunk/src/compil.c (original)
+++ trunk/src/compil.c Sun Mar 15 05:01:35 2009
@@ -88,15 +88,15 @@
GelETree *ali;
g_string_append_printf (gs, ";%d", t->type);
switch(t->type) {
- case NULL_NODE:
+ case GEL_NULL_NODE:
break;
- case VALUE_NODE:
+ case GEL_VALUE_NODE:
s = mpw_getstring(t->val.value,0,FALSE,FALSE,FALSE,GEL_OUTPUT_NORMAL,10, TRUE);
g_string_append_c(gs,';');
g_string_append(gs,s);
g_free(s);
break;
- case MATRIX_NODE:
+ case GEL_MATRIX_NODE:
g_string_append_printf (gs, ";%dx%d;%d",
gel_matrixw_width (t->mat.matrix),
gel_matrixw_height (t->mat.matrix),
@@ -114,7 +114,7 @@
}
}
break;
- case OPERATOR_NODE:
+ case GEL_OPERATOR_NODE:
g_string_append_printf (gs, ";%d;%d",
t->op.oper,
t->op.nargs);
@@ -122,10 +122,10 @@
gel_compile_node(ali,gs);
}
break;
- case IDENTIFIER_NODE:
+ case GEL_IDENTIFIER_NODE:
g_string_append_printf (gs, ";%s", t->id.id->token);
break;
- case STRING_NODE:
+ case GEL_STRING_NODE:
if(*t->str.str) {
g_string_append_c(gs,';');
append_string(gs,t->str.str);
@@ -133,7 +133,7 @@
g_string_append(gs,";E");
}
break;
- case FUNCTION_NODE:
+ case GEL_FUNCTION_NODE:
g_assert(t->func.func->type==GEL_USER_FUNC);
/*g_assert(t->func.func->id==NULL);*/
g_string_append_printf (gs, ";%s;%s;%d;%d;%d;%d",
@@ -149,7 +149,7 @@
}
gel_compile_node(t->func.func->data.user,gs);
break;
- case COMPARISON_NODE:
+ case GEL_COMPARISON_NODE:
g_string_append_printf (gs, ";%d", t->comp.nargs);
for(li=t->comp.comp;li;li=g_slist_next(li)) {
int oper = GPOINTER_TO_INT(li->data);
@@ -159,7 +159,7 @@
gel_compile_node(ali,gs);
}
break;
- case BOOL_NODE:
+ case GEL_BOOL_NODE:
g_string_append_printf (gs, ";%c",
t->bool_.bool_ ? 't' : 'f');
break;
@@ -211,15 +211,15 @@
if G_UNLIKELY (type==-1) return NULL;
switch(type) {
- case NULL_NODE:
+ case GEL_NULL_NODE:
return gel_makenum_null();
- case VALUE_NODE:
+ case GEL_VALUE_NODE:
p = strtok_r(NULL,";", ptrptr);
if G_UNLIKELY (!p) return NULL;
mpw_init(tmp);
mpw_set_str(tmp,p,10);
return gel_makenum_use(tmp);
- case MATRIX_NODE:
+ case GEL_MATRIX_NODE:
p = strtok_r(NULL,";", ptrptr);
if G_UNLIKELY (!p) return NULL;
h = w = -1;
@@ -258,11 +258,11 @@
}
}
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = m;
n->mat.quoted = quote;
return n;
- case OPERATOR_NODE:
+ case GEL_OPERATOR_NODE:
p = strtok_r (NULL,";", ptrptr);
if G_UNLIKELY (!p) return NULL;
oper = -1;
@@ -294,19 +294,19 @@
}
GEL_GET_NEW_NODE(n);
- n->type = OPERATOR_NODE;
+ n->type = GEL_OPERATOR_NODE;
n->op.args = args;
n->op.nargs = nargs;
n->op.oper = oper;
return n;
- case IDENTIFIER_NODE:
+ case GEL_IDENTIFIER_NODE:
p = strtok_r (NULL,";", ptrptr);
if G_UNLIKELY (!p) return NULL;
GEL_GET_NEW_NODE(n);
- n->type = IDENTIFIER_NODE;
+ n->type = GEL_IDENTIFIER_NODE;
n->id.id = d_intern(p);
return n;
- case STRING_NODE:
+ case GEL_STRING_NODE:
p = strtok_r (NULL, ";", ptrptr);
if G_UNLIKELY (p == NULL)
return NULL;
@@ -321,7 +321,7 @@
g_free (p);
}
return n;
- case FUNCTION_NODE:
+ case GEL_FUNCTION_NODE:
p = strtok_r (NULL,";", ptrptr);
if G_UNLIKELY (!p) return NULL;
if (strcmp (p, "*") == 0)
@@ -382,10 +382,10 @@
func->no_mod_all_args = no_mod_all_args ? 1 : 0;
GEL_GET_NEW_NODE(n);
- n->type = FUNCTION_NODE;
+ n->type = GEL_FUNCTION_NODE;
n->func.func = func;
return n;
- case COMPARISON_NODE:
+ case GEL_COMPARISON_NODE:
p = strtok_r (NULL,";", ptrptr);
if G_UNLIKELY (!p) return NULL;
sscanf(p,"%d",&nargs);
@@ -428,12 +428,12 @@
}
GEL_GET_NEW_NODE(n);
- n->type = COMPARISON_NODE;
+ n->type = GEL_COMPARISON_NODE;
n->comp.args = args;
n->comp.nargs = nargs;
n->comp.comp = oli;
return n;
- case BOOL_NODE:
+ case GEL_BOOL_NODE:
p = strtok_r (NULL, ";", ptrptr);
if G_UNLIKELY (p == NULL)
return NULL;
Modified: trunk/src/eval.c
==============================================================================
--- trunk/src/eval.c (original)
+++ trunk/src/eval.c Sun Mar 15 05:01:35 2009
@@ -180,73 +180,73 @@
branches (int op)
{
switch(op) {
- case E_SEPAR: return 2;
- case E_EQUALS: return 2;
- case E_PARAMETER: return 3;
- case E_ABS: return 1;
- case E_PLUS: return 2;
- case E_ELTPLUS: return 2;
- case E_MINUS: return 2;
- case E_ELTMINUS: return 2;
- case E_MUL: return 2;
- case E_ELTMUL: return 2;
- case E_DIV: return 2;
- case E_ELTDIV: return 2;
- case E_BACK_DIV: return 2;
- case E_ELT_BACK_DIV: return 2;
- case E_MOD: return 2;
- case E_ELTMOD: return 2;
- case E_NEG: return 1;
- case E_EXP: return 2;
- case E_ELTEXP: return 2;
- case E_FACT: return 1;
- case E_DBLFACT: return 1;
- case E_TRANSPOSE: return 1;
- case E_CONJUGATE_TRANSPOSE: return 1;
- case E_IF_CONS: return 2;
- case E_IFELSE_CONS: return 3;
- case E_WHILE_CONS: return 2;
- case E_UNTIL_CONS: return 2;
- case E_DOWHILE_CONS: return 2;
- case E_DOUNTIL_CONS: return 2;
- case E_FOR_CONS: return 4;
- case E_FORBY_CONS: return 5;
- case E_FORIN_CONS: return 3;
- case E_SUM_CONS: return 4;
- case E_SUMBY_CONS: return 5;
- case E_SUMIN_CONS: return 3;
- case E_PROD_CONS: return 4;
- case E_PRODBY_CONS: return 5;
- case E_PRODIN_CONS: return 3;
- case E_EQ_CMP: return 2;
- case E_NE_CMP: return 2;
- case E_CMP_CMP: return 2;
- case E_LT_CMP: return 2;
- case E_GT_CMP: return 2;
- case E_LE_CMP: return 2;
- case E_GE_CMP: return 2;
- case E_LOGICAL_AND: return 2;
- case E_LOGICAL_OR: return 2;
- case E_LOGICAL_XOR: return 2;
- case E_LOGICAL_NOT: return 1;
- case E_REGION_SEP: return 2;
- case E_REGION_SEP_BY: return 3;
- case E_GET_VELEMENT: return 2;
- case E_GET_ELEMENT: return 3;
- case E_GET_ROW_REGION: return 2;
- case E_GET_COL_REGION: return 2;
- case E_QUOTE: return 1;
- case E_REFERENCE: return 1;
- case E_DEREFERENCE: return 1;
- case E_DIRECTCALL: return -2;
- case E_CALL: return -2;
- case E_RETURN: return 1;
- case E_BAILOUT: return 0;
- case E_EXCEPTION: return 0;
- case E_CONTINUE: return 0;
- case E_BREAK: return 0;
- case E_MOD_CALC: return 2;
- case E_DEFEQUALS: return 2;
+ case GEL_E_SEPAR: return 2;
+ case GEL_E_EQUALS: return 2;
+ case GEL_E_PARAMETER: return 3;
+ case GEL_E_ABS: return 1;
+ case GEL_E_PLUS: return 2;
+ case GEL_E_ELTPLUS: return 2;
+ case GEL_E_MINUS: return 2;
+ case GEL_E_ELTMINUS: return 2;
+ case GEL_E_MUL: return 2;
+ case GEL_E_ELTMUL: return 2;
+ case GEL_E_DIV: return 2;
+ case GEL_E_ELTDIV: return 2;
+ case GEL_E_BACK_DIV: return 2;
+ case GEL_E_ELT_BACK_DIV: return 2;
+ case GEL_E_MOD: return 2;
+ case GEL_E_ELTMOD: return 2;
+ case GEL_E_NEG: return 1;
+ case GEL_E_EXP: return 2;
+ case GEL_E_ELTEXP: return 2;
+ case GEL_E_FACT: return 1;
+ case GEL_E_DBLFACT: return 1;
+ case GEL_E_TRANSPOSE: return 1;
+ case GEL_E_CONJUGATE_TRANSPOSE: return 1;
+ case GEL_E_IF_CONS: return 2;
+ case GEL_E_IFELSE_CONS: return 3;
+ case GEL_E_WHILE_CONS: return 2;
+ case GEL_E_UNTIL_CONS: return 2;
+ case GEL_E_DOWHILE_CONS: return 2;
+ case GEL_E_DOUNTIL_CONS: return 2;
+ case GEL_E_FOR_CONS: return 4;
+ case GEL_E_FORBY_CONS: return 5;
+ case GEL_E_FORIN_CONS: return 3;
+ case GEL_E_SUM_CONS: return 4;
+ case GEL_E_SUMBY_CONS: return 5;
+ case GEL_E_SUMIN_CONS: return 3;
+ case GEL_E_PROD_CONS: return 4;
+ case GEL_E_PRODBY_CONS: return 5;
+ case GEL_E_PRODIN_CONS: return 3;
+ case GEL_E_EQ_CMP: return 2;
+ case GEL_E_NE_CMP: return 2;
+ case GEL_E_CMP_CMP: return 2;
+ case GEL_E_LT_CMP: return 2;
+ case GEL_E_GT_CMP: return 2;
+ case GEL_E_LE_CMP: return 2;
+ case GEL_E_GE_CMP: return 2;
+ case GEL_E_LOGICAL_AND: return 2;
+ case GEL_E_LOGICAL_OR: return 2;
+ case GEL_E_LOGICAL_XOR: return 2;
+ case GEL_E_LOGICAL_NOT: return 1;
+ case GEL_E_REGION_SEP: return 2;
+ case GEL_E_REGION_SEP_BY: return 3;
+ case GEL_E_GET_VELEMENT: return 2;
+ case GEL_E_GET_ELEMENT: return 3;
+ case GEL_E_GET_ROW_REGION: return 2;
+ case GEL_E_GET_COL_REGION: return 2;
+ case GEL_E_QUOTE: return 1;
+ case GEL_E_REFERENCE: return 1;
+ case GEL_E_DEREFERENCE: return 1;
+ case GEL_E_DIRECTCALL: return -2;
+ case GEL_E_CALL: return -2;
+ case GEL_E_RETURN: return 1;
+ case GEL_E_BAILOUT: return 0;
+ case GEL_E_EXCEPTION: return 0;
+ case GEL_E_CONTINUE: return 0;
+ case GEL_E_BREAK: return 0;
+ case GEL_E_MOD_CALC: return 2;
+ case GEL_E_DEFEQUALS: return 2;
}
return 0;
}
@@ -323,7 +323,7 @@
{
GelETree *n;
GEL_GET_NEW_NODE (n);
- n->type = NULL_NODE;
+ n->type = GEL_NULL_NODE;
n->any.next = NULL;
return n;
}
@@ -333,7 +333,7 @@
{
GelETree *n;
GEL_GET_NEW_NODE (n);
- n->type = IDENTIFIER_NODE;
+ n->type = GEL_IDENTIFIER_NODE;
n->id.id = id;
n->any.next = NULL;
@@ -345,7 +345,7 @@
{
GelETree *n;
GEL_GET_NEW_NODE (n);
- n->type = STRING_NODE;
+ n->type = GEL_STRING_NODE;
n->str.str = g_strdup (str);
n->str.constant = FALSE;
n->any.next = NULL;
@@ -358,7 +358,7 @@
{
GelETree *n;
GEL_GET_NEW_NODE (n);
- n->type = STRING_NODE;
+ n->type = GEL_STRING_NODE;
n->str.str = str;
n->str.constant = FALSE;
n->any.next = NULL;
@@ -385,7 +385,7 @@
}
GEL_GET_NEW_NODE (n);
- n->type = STRING_NODE;
+ n->type = GEL_STRING_NODE;
n->str.str = hstr;
n->str.constant = TRUE;
n->any.next = NULL;
@@ -398,7 +398,7 @@
{
GelETree *n;
GEL_GET_NEW_NODE(n);
- n->type=VALUE_NODE;
+ n->type=GEL_VALUE_NODE;
mpw_init(n->val.value);
mpw_set_ui(n->val.value,num);
n->any.next = NULL;
@@ -410,7 +410,7 @@
{
GelETree *n;
GEL_GET_NEW_NODE(n);
- n->type=VALUE_NODE;
+ n->type=GEL_VALUE_NODE;
mpw_init(n->val.value);
mpw_set_si(n->val.value,num);
n->any.next = NULL;
@@ -422,7 +422,7 @@
{
GelETree *n;
GEL_GET_NEW_NODE (n);
- n->type = VALUE_NODE;
+ n->type = GEL_VALUE_NODE;
mpw_init (n->val.value);
mpw_set_d (n->val.value, num);
n->any.next = NULL;
@@ -434,7 +434,7 @@
{
GelETree *n;
GEL_GET_NEW_NODE (n);
- n->type = BOOL_NODE;
+ n->type = GEL_BOOL_NODE;
n->bool_.bool_ = bool_ ? 1 : 0;
n->any.next = NULL;
return n;
@@ -445,7 +445,7 @@
{
GelETree *n;
GEL_GET_NEW_NODE(n);
- n->type=VALUE_NODE;
+ n->type=GEL_VALUE_NODE;
mpw_init_set(n->val.value,num);
n->any.next = NULL;
return n;
@@ -453,74 +453,74 @@
/*don't create a new number*/
GelETree *
-gel_makenum_use(mpw_t num)
+gel_makenum_use (mpw_t num)
{
GelETree *n;
- GEL_GET_NEW_NODE(n);
- n->type=VALUE_NODE;
- memcpy(n->val.value,num,sizeof(struct _mpw_t));
+ GEL_GET_NEW_NODE (n);
+ n->type = GEL_VALUE_NODE;
+ memcpy (n->val.value, num, sizeof(struct _mpw_t));
n->any.next = NULL;
return n;
}
void
-gel_makenum_null_from(GelETree *n)
+gel_makenum_null_from (GelETree *n)
{
- n->type = NULL_NODE;
+ n->type = GEL_NULL_NODE;
}
void
-gel_makenum_ui_from(GelETree *n, unsigned long num)
+gel_makenum_ui_from (GelETree *n, unsigned long num)
{
- n->type=VALUE_NODE;
- mpw_init(n->val.value);
- mpw_set_ui(n->val.value,num);
+ n->type = GEL_VALUE_NODE;
+ mpw_init (n->val.value);
+ mpw_set_ui (n->val.value,num);
}
void
-gel_makenum_si_from(GelETree *n, long num)
+gel_makenum_si_from (GelETree *n, long num)
{
- n->type=VALUE_NODE;
- mpw_init(n->val.value);
- mpw_set_si(n->val.value,num);
+ n->type = GEL_VALUE_NODE;
+ mpw_init (n->val.value);
+ mpw_set_si (n->val.value, num);
}
void
-gel_makenum_from(GelETree *n, mpw_t num)
+gel_makenum_from (GelETree *n, mpw_t num)
{
- n->type=VALUE_NODE;
- mpw_init_set(n->val.value,num);
+ n->type = GEL_VALUE_NODE;
+ mpw_init_set (n->val.value, num);
}
void
gel_makenum_bool_from (GelETree *n, gboolean bool_)
{
- n->type = BOOL_NODE;
+ n->type = GEL_BOOL_NODE;
n->bool_.bool_ = bool_ ? 1 : 0;
}
/*don't create a new number*/
void
-gel_makenum_use_from(GelETree *n, mpw_t num)
+gel_makenum_use_from (GelETree *n, mpw_t num)
{
- n->type=VALUE_NODE;
- memcpy(n->val.value,num,sizeof(struct _mpw_t));
+ n->type = GEL_VALUE_NODE;
+ memcpy (n->val.value, num, sizeof (struct _mpw_t));
}
static inline void
-freetree_full(GelETree *n, gboolean freeargs, gboolean kill)
+freetree_full (GelETree *n, gboolean freeargs, gboolean kill)
{
- if(!n)
+ if (!n)
return;
switch(n->type) {
- case VALUE_NODE:
+ case GEL_VALUE_NODE:
mpw_clear(n->val.value);
break;
- case MATRIX_NODE:
+ case GEL_MATRIX_NODE:
if(n->mat.matrix)
gel_matrixw_free(n->mat.matrix);
break;
- case OPERATOR_NODE:
+ case GEL_OPERATOR_NODE:
if(freeargs) {
while(n->op.args) {
GelETree *a = n->op.args;
@@ -529,7 +529,7 @@
}
}
break;
- case IDENTIFIER_NODE:
+ case GEL_IDENTIFIER_NODE:
/*was this a fake token, to an anonymous function*/
if(!n->id.id->token) {
/*XXX:where does the function go?*/
@@ -537,14 +537,14 @@
g_free(n->id.id);
}
break;
- case STRING_NODE:
+ case GEL_STRING_NODE:
if ( ! n->str.constant)
g_free (n->str.str);
break;
- case FUNCTION_NODE:
+ case GEL_FUNCTION_NODE:
d_freefunc(n->func.func);
break;
- case COMPARISON_NODE:
+ case GEL_COMPARISON_NODE:
if(freeargs) {
while(n->comp.args) {
GelETree *a = n->comp.args;
@@ -554,10 +554,10 @@
}
g_slist_free(n->comp.comp);
break;
- case USERTYPE_NODE:
+ case GEL_USERTYPE_NODE:
gel_free_user_variable_data(n->ut.ttype,n->ut.data);
break;
- case MATRIX_ROW_NODE:
+ case GEL_MATRIX_ROW_NODE:
if(freeargs) {
while(n->row.args) {
GelETree *a = n->row.args;
@@ -566,7 +566,7 @@
}
}
break;
- case SPACER_NODE:
+ case GEL_SPACER_NODE:
if(freeargs && n->sp.arg)
gel_freetree(n->sp.arg);
break;
@@ -627,7 +627,7 @@
freetree_full(n,TRUE,FALSE);
}
-/* Makes a new node and replaces the old one with NULL_NODE */
+/* Makes a new node and replaces the old one with GEL_NULL_NODE */
GelETree *
gel_stealnode (GelETree *n)
{
@@ -646,7 +646,7 @@
n->any.next = next;
}
#endif /* MEM_DEBUG_FRIENDLY */
- n->type = NULL_NODE;
+ n->type = GEL_NULL_NODE;
nn->any.next = NULL;
return nn;
@@ -663,23 +663,23 @@
copynode_to(GelETree *empty, GelETree *o)
{
switch(o->type) {
- case NULL_NODE:
- empty->type = NULL_NODE;
+ case GEL_NULL_NODE:
+ empty->type = GEL_NULL_NODE;
empty->any.next = o->any.next;
break;
- case VALUE_NODE:
- empty->type = VALUE_NODE;
+ case GEL_VALUE_NODE:
+ empty->type = GEL_VALUE_NODE;
empty->any.next = o->any.next;
mpw_init_set_no_uncomplex (empty->val.value,o->val.value);
break;
- case MATRIX_NODE:
- empty->type = MATRIX_NODE;
+ case GEL_MATRIX_NODE:
+ empty->type = GEL_MATRIX_NODE;
empty->any.next = o->any.next;
empty->mat.matrix = gel_matrixw_copy(o->mat.matrix);
empty->mat.quoted = o->mat.quoted;
break;
- case OPERATOR_NODE:
- empty->type = OPERATOR_NODE;
+ case GEL_OPERATOR_NODE:
+ empty->type = GEL_OPERATOR_NODE;
empty->any.next = o->any.next;
empty->op.oper = o->op.oper;
empty->op.nargs = o->op.nargs;
@@ -692,13 +692,13 @@
}
}
break;
- case IDENTIFIER_NODE:
- empty->type = IDENTIFIER_NODE;
+ case GEL_IDENTIFIER_NODE:
+ empty->type = GEL_IDENTIFIER_NODE;
empty->any.next = o->any.next;
empty->id.id = o->id.id;
break;
- case STRING_NODE:
- empty->type = STRING_NODE;
+ case GEL_STRING_NODE:
+ empty->type = GEL_STRING_NODE;
empty->any.next = o->any.next;
empty->str.constant = o->str.constant;
if (o->str.constant)
@@ -706,13 +706,13 @@
else
empty->str.str = g_strdup (o->str.str);
break;
- case FUNCTION_NODE:
- empty->type = FUNCTION_NODE;
+ case GEL_FUNCTION_NODE:
+ empty->type = GEL_FUNCTION_NODE;
empty->any.next = o->any.next;
empty->func.func = d_copyfunc(o->func.func);
break;
- case COMPARISON_NODE:
- empty->type = COMPARISON_NODE;
+ case GEL_COMPARISON_NODE:
+ empty->type = GEL_COMPARISON_NODE;
empty->any.next = o->any.next;
empty->comp.nargs = o->comp.nargs;
empty->comp.args = o->comp.args;
@@ -725,20 +725,20 @@
}
empty->comp.comp = g_slist_copy(o->comp.comp);
break;
- case USERTYPE_NODE:
- empty->type = USERTYPE_NODE;
+ case GEL_USERTYPE_NODE:
+ empty->type = GEL_USERTYPE_NODE;
empty->any.next = o->any.next;
empty->ut.ttype = o->ut.ttype;
empty->ut.data = gel_copy_user_variable_data(o->ut.ttype,
o->ut.data);
break;
- case BOOL_NODE:
- empty->type = BOOL_NODE;
+ case GEL_BOOL_NODE:
+ empty->type = GEL_BOOL_NODE;
empty->any.next = o->any.next;
empty->bool_.bool_ = o->bool_.bool_;
break;
- case MATRIX_ROW_NODE:
- empty->type = MATRIX_ROW_NODE;
+ case GEL_MATRIX_ROW_NODE:
+ empty->type = GEL_MATRIX_ROW_NODE;
empty->any.next = o->any.next;
empty->row.nargs = o->row.nargs;
empty->row.args = o->row.args;
@@ -750,8 +750,8 @@
}
}
break;
- case SPACER_NODE:
- empty->type = SPACER_NODE;
+ case GEL_SPACER_NODE:
+ empty->type = GEL_SPACER_NODE;
empty->any.next = o->any.next;
if(o->sp.arg)
empty->sp.arg = gel_copynode(o->sp.arg);
@@ -845,9 +845,9 @@
return NULL;
}
/* just reduce the list for separators */
- if (oper == E_SEPAR &&
- tree->type == OPERATOR_NODE &&
- tree->op.oper == E_SEPAR) {
+ if (oper == GEL_E_SEPAR &&
+ tree->type == GEL_OPERATOR_NODE &&
+ tree->op.oper == GEL_E_SEPAR) {
int extranum = 1;
GelETree *last;
@@ -884,7 +884,7 @@
}
return NULL;
}
- if(tree->type==EXPRLIST_START_NODE) {
+ if(tree->type==GEL_EXPRLIST_START_NODE) {
gel_freetree(tree);
/*pop one more in case of -2*/
if(args==-2) {
@@ -914,7 +914,7 @@
}
GEL_GET_NEW_NODE(n);
- n->type = OPERATOR_NODE;
+ n->type = GEL_OPERATOR_NODE;
n->op.oper = oper;
n->op.args = list;
@@ -926,7 +926,7 @@
}
/* kind of a hack */
-static GelETree the_null = {NULL_NODE};
+static GelETree the_null = {GEL_NULL_NODE};
/*need_colwise will return if we need column wise expansion*/
static int
@@ -945,12 +945,12 @@
for(i=0;i<roww;i++) {
GelETree *et = gel_matrixw_get_index(src,i,si);
if (et == NULL ||
- (et->type != NULL_NODE &&
- et->type != MATRIX_NODE)) {
+ (et->type != GEL_NULL_NODE &&
+ et->type != GEL_MATRIX_NODE)) {
if (height == 0)
height = 1;
} else if (et != NULL &&
- et->type == MATRIX_NODE &&
+ et->type == GEL_MATRIX_NODE &&
gel_matrixw_height(et->mat.matrix)>height) {
height = gel_matrixw_height(et->mat.matrix);
}
@@ -972,13 +972,13 @@
for(x=0;x<height;x++)
gel_matrix_index(dest,i,di+x) = NULL;
/*null node*/
- } else if (et->type == NULL_NODE) {
+ } else if (et->type == GEL_NULL_NODE) {
*need_colwise = TRUE;
gel_matrix_index(dest,i,di) = et;
for(x=1;x<height;x++)
gel_matrix_index(dest,i,di+x) = &the_null;
/*non-matrix node*/
- } else if(et->type!=MATRIX_NODE) {
+ } else if(et->type!=GEL_MATRIX_NODE) {
gel_matrix_index(dest,i,di) = et;
for(x=1;x<height;x++)
gel_matrix_index(dest,i,di+x) = gel_copynode(et);
@@ -1012,7 +1012,7 @@
for(x=0;x<h;x++) {
GelETree *n;
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_ROW_NODE;
+ n->type = GEL_MATRIX_ROW_NODE;
n->row.args = NULL;
for(xx=w-1;xx>=0;xx--) {
@@ -1053,11 +1053,11 @@
GelETree *et = gel_matrix_index (src, si, i);
if (et == NULL) {
;
- } else if (et->type == NULL_NODE) {
- /* Also here we just replace NULL_NODE's with 0's */
+ } else if (et->type == GEL_NULL_NODE) {
+ /* Also here we just replace GEL_NULL_NODE's with 0's */
if (et != &the_null)
gel_freetree (et);
- } else if (et->type != MATRIX_ROW_NODE) {
+ } else if (et->type != GEL_MATRIX_ROW_NODE) {
int x;
gel_matrix_index (dest, di, i) = et;
for (x = 1; x < w; x++)
@@ -1069,7 +1069,7 @@
iter = et->row.args;
for (iter = et->row.args, x=0; iter != NULL; x++) {
- if (iter->type == VALUE_NODE &&
+ if (iter->type == GEL_VALUE_NODE &&
MPW_IS_REAL (iter->val.value) &&
mpw_is_integer (iter->val.value) &&
mpw_sgn (iter->val.value) == 0) {
@@ -1115,12 +1115,12 @@
for (j = 0; j < m->height; j++) {
GelETree *et = gel_matrix_index (m, i, j);
if (et == NULL ||
- (et->type != MATRIX_ROW_NODE &&
- et->type != NULL_NODE)) {
+ (et->type != GEL_MATRIX_ROW_NODE &&
+ et->type != GEL_NULL_NODE)) {
if (maxcol == 0)
maxcol = 1;
- } else if (et->type != NULL_NODE) {
- /* Must be MATRIX_ROW_NODE then */
+ } else if (et->type != GEL_NULL_NODE) {
+ /* Must be GEL_MATRIX_ROW_NODE then */
if (et->row.nargs > maxcol)
maxcol = et->row.nargs;
}
@@ -1141,9 +1141,9 @@
for (i = 0; i < gel_matrixw_width (m); i++) {
for (j = 0; j < gel_matrixw_height (m); j++) {
GelETree *et = gel_matrixw_get_index (m, i, j);
- if (et != NULL &&
- (et->type == MATRIX_NODE ||
- et->type == NULL_NODE))
+ if G_UNLIKELY (et != NULL &&
+ (et->type == GEL_MATRIX_NODE ||
+ et->type == GEL_NULL_NODE))
return TRUE;
}
}
@@ -1165,12 +1165,12 @@
int h,w;
/* An empty matrix really */
- if (n->type == NULL_NODE)
+ if (n->type == GEL_NULL_NODE)
return;
nm = n->mat.matrix;
- g_return_if_fail (n->type == MATRIX_NODE);
+ g_return_if_fail (n->type == GEL_MATRIX_NODE);
if ( ! mat_need_expand (nm))
return;
@@ -1181,7 +1181,7 @@
if (w == 1 && h == 1) {
GelETree *t = gel_matrixw_get_index (nm, 0, 0);
if (t != NULL &&
- t->type == MATRIX_NODE) {
+ t->type == GEL_MATRIX_NODE) {
if (nm->m->use == 1) {
gel_matrixw_set_index (nm, 0, 0) = NULL;
} else {
@@ -1190,9 +1190,9 @@
replacenode (n, t);
return;
} else if (t != NULL &&
- t->type == NULL_NODE) {
+ t->type == GEL_NULL_NODE) {
freetree_full (n, TRUE, FALSE);
- n->type = NULL_NODE;
+ n->type = GEL_NULL_NODE;
return;
}
/* never should be reached */
@@ -1214,7 +1214,7 @@
if (k == 0) {
gel_matrix_free (m);
freetree_full (n, TRUE, FALSE);
- n->type = NULL_NODE;
+ n->type = GEL_NULL_NODE;
return;
}
@@ -1234,7 +1234,7 @@
gel_matrix_free (m);
g_free (colwidths);
freetree_full (n, TRUE, FALSE);
- n->type = NULL_NODE;
+ n->type = GEL_NULL_NODE;
return;
}
@@ -1245,7 +1245,7 @@
GelETree *et
= gel_matrix_index (m, i, j);
if (et != NULL &&
- et->type == NULL_NODE) {
+ et->type == GEL_NULL_NODE) {
if (et != &the_null)
gel_freetree (et);
gel_matrix_index (m, i, j)
@@ -1284,7 +1284,7 @@
freetree_full (n, TRUE, FALSE);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix (m);
n->mat.quoted = FALSE;
}
@@ -1298,13 +1298,13 @@
GelETree *li = NULL;
GEL_GET_NEW_NODE(l);
- l->type = FUNCTION_NODE;
+ l->type = GEL_FUNCTION_NODE;
l->func.func = d_copyfunc(func);
l->any.next = NULL;
GEL_GET_NEW_NODE(ret);
- ret->type = OPERATOR_NODE;
- ret->op.oper = E_DIRECTCALL;
+ ret->type = GEL_OPERATOR_NODE;
+ ret->op.oper = GEL_E_DIRECTCALL;
ret->op.args = l;
li = l;
@@ -1332,8 +1332,8 @@
static gboolean
eqlnodes (GelETree *l, GelETree *r)
{
- if (l->type == BOOL_NODE ||
- r->type == BOOL_NODE) {
+ if (l->type == GEL_BOOL_NODE ||
+ r->type == GEL_BOOL_NODE) {
gboolean lt = gel_isnodetrue (l, NULL);
gboolean rt = gel_isnodetrue (r, NULL);
if ((lt && ! rt) ||
@@ -1415,14 +1415,14 @@
eqstring(GelETree *a, GelETree *b)
{
int r = 0;
- if (a->type == STRING_NODE &&
- b->type == STRING_NODE) {
+ if (a->type == GEL_STRING_NODE &&
+ b->type == GEL_STRING_NODE) {
r = (strcmp (a->str.str, b->str.str) == 0);
- } else if (a->type == STRING_NODE) {
+ } else if (a->type == GEL_STRING_NODE) {
char *s = gel_string_print_etree (b);
r = (strcmp (a->str.str, s) == 0);
g_free (s);
- } else if (b->type == STRING_NODE) {
+ } else if (b->type == GEL_STRING_NODE) {
char *s = gel_string_print_etree (a);
r = (strcmp (b->str.str, s) == 0);
g_free (s);
@@ -1438,8 +1438,8 @@
{
gboolean r = FALSE;
int i,j;
- if(a->type == MATRIX_NODE &&
- b->type == MATRIX_NODE) {
+ if(a->type == GEL_MATRIX_NODE &&
+ b->type == GEL_MATRIX_NODE) {
if G_UNLIKELY (!gel_is_matrix_value_or_bool_only(a->mat.matrix) ||
!gel_is_matrix_value_or_bool_only(b->mat.matrix)) {
gel_errorout (_("Cannot compare non value or bool only matrixes"));
@@ -1487,30 +1487,30 @@
break;
}
}
- } else if(a->type == MATRIX_NODE) {
+ } else if(a->type == GEL_MATRIX_NODE) {
GelMatrixW *m = a->mat.matrix;
if G_UNLIKELY (gel_matrixw_width(m)>1 ||
gel_matrixw_height(m)>1) {
r = FALSE;
} else {
GelETree *t = gel_matrixw_index(m,0,0);
- if G_UNLIKELY (t->type != VALUE_NODE &&
- t->type != BOOL_NODE) {
+ if G_UNLIKELY (t->type != GEL_VALUE_NODE &&
+ t->type != GEL_BOOL_NODE) {
gel_errorout (_("Cannot compare non value or bool only matrixes"));
*error = TRUE;
return 0;
}
r = eqlnodes (t, b);
}
- } else if(b->type == MATRIX_NODE) {
+ } else if(b->type == GEL_MATRIX_NODE) {
GelMatrixW *m = b->mat.matrix;
if G_UNLIKELY (gel_matrixw_width(m)>1 ||
gel_matrixw_height(m)>1) {
r = FALSE;
} else {
GelETree *t = gel_matrixw_index(m,0,0);
- if G_UNLIKELY (t->type != VALUE_NODE &&
- t->type != BOOL_NODE) {
+ if G_UNLIKELY (t->type != GEL_VALUE_NODE &&
+ t->type != GEL_BOOL_NODE) {
gel_errorout (_("Cannot compare non value or bool only matrixes"));
*error = TRUE;
return 0;
@@ -1527,14 +1527,14 @@
cmpstring(GelETree *a, GelETree *b)
{
int r = 0;
- if (a->type == STRING_NODE &&
- b->type == STRING_NODE) {
+ if (a->type == GEL_STRING_NODE &&
+ b->type == GEL_STRING_NODE) {
r = strcmp (a->str.str, b->str.str);
- } else if (a->type == STRING_NODE) {
+ } else if (a->type == GEL_STRING_NODE) {
char *s = gel_string_print_etree (b);
r = strcmp (a->str.str, s);
g_free (s);
- } else if (b->type == STRING_NODE) {
+ } else if (b->type == GEL_STRING_NODE) {
char *s = gel_string_print_etree (a);
r = strcmp (s, b->str.str);
g_free (s);
@@ -1625,37 +1625,37 @@
GelETree *n;
mpw_t res;
- if(rr->type == VALUE_NODE &&
- ll->type == VALUE_NODE) {
+ if(rr->type == GEL_VALUE_NODE &&
+ ll->type == GEL_VALUE_NODE) {
gboolean skipmod = FALSE;
mpw_init(res);
switch(oper) {
- case E_PLUS:
- case E_ELTPLUS:
+ case GEL_E_PLUS:
+ case GEL_E_ELTPLUS:
mpw_add(res,ll->val.value,rr->val.value);
break;
- case E_MINUS:
- case E_ELTMINUS:
+ case GEL_E_MINUS:
+ case GEL_E_ELTMINUS:
mpw_sub(res,ll->val.value,rr->val.value);
break;
- case E_MUL:
- case E_ELTMUL:
+ case GEL_E_MUL:
+ case GEL_E_ELTMUL:
mpw_mul(res,ll->val.value,rr->val.value);
break;
- case E_DIV:
- case E_ELTDIV:
+ case GEL_E_DIV:
+ case GEL_E_ELTDIV:
mpw_div(res,ll->val.value,rr->val.value);
break;
- case E_BACK_DIV:
- case E_ELT_BACK_DIV:
+ case GEL_E_BACK_DIV:
+ case GEL_E_ELT_BACK_DIV:
mpw_div(res,rr->val.value,ll->val.value);
break;
- case E_MOD:
- case E_ELTMOD:
+ case GEL_E_MOD:
+ case GEL_E_ELTMOD:
mpw_mod(res,ll->val.value,rr->val.value);
break;
- case E_EXP:
- case E_ELTEXP:
+ case GEL_E_EXP:
+ case GEL_E_ELTEXP:
if (ctx->modulo != NULL) {
mpw_powm (res, ll->val.value, rr->val.value,
ctx->modulo);
@@ -1673,7 +1673,7 @@
}
if G_UNLIKELY (gel_error_num == GEL_NUMERICAL_MPW_ERROR) {
GEL_GET_NEW_NODE(n);
- n->type = OPERATOR_NODE;
+ n->type = GEL_OPERATOR_NODE;
n->op.oper = oper;
n->op.args = gel_copynode(ll);
n->op.args->any.next = gel_copynode(rr);
@@ -1684,26 +1684,26 @@
return n;
}
return gel_makenum_use(res);
- } else if ((rr->type == VALUE_NODE || rr->type == BOOL_NODE) &&
- (ll->type == VALUE_NODE || ll->type == BOOL_NODE)) {
+ } else if ((rr->type == GEL_VALUE_NODE || rr->type == GEL_BOOL_NODE) &&
+ (ll->type == GEL_VALUE_NODE || ll->type == GEL_BOOL_NODE)) {
gboolean lt = gel_isnodetrue (ll, NULL);
gboolean rt = gel_isnodetrue (rr, NULL);
gboolean res;
gboolean got_res = FALSE;
switch (oper) {
- case E_PLUS:
- case E_ELTPLUS:
+ case GEL_E_PLUS:
+ case GEL_E_ELTPLUS:
res = lt || rt;
got_res = TRUE;
break;
- case E_MINUS:
- case E_ELTMINUS:
+ case GEL_E_MINUS:
+ case GEL_E_ELTMINUS:
res = lt || ! rt;
got_res = TRUE;
break;
- case E_MUL:
- case E_ELTMUL:
+ case GEL_E_MUL:
+ case GEL_E_ELTMUL:
res = lt && rt;
got_res = TRUE;
break;
@@ -1715,7 +1715,7 @@
if G_UNLIKELY ( ! got_res ||
gel_error_num == GEL_NUMERICAL_MPW_ERROR) {
GEL_GET_NEW_NODE(n);
- n->type = OPERATOR_NODE;
+ n->type = GEL_OPERATOR_NODE;
n->op.oper = oper;
n->op.args = gel_copynode(ll);
n->op.args->any.next = gel_copynode(rr);
@@ -1730,7 +1730,7 @@
wierd thing, we'll just make a new fake node and pretend
we want to evaluate that*/
GEL_GET_NEW_NODE(n);
- n->type = OPERATOR_NODE;
+ n->type = GEL_OPERATOR_NODE;
n->op.oper = oper;
n->op.args = gel_copynode(ll);
@@ -1756,7 +1756,7 @@
GelETree *node;
int order = 0;
int quote = 0;
- if(l->type == MATRIX_NODE) {
+ if(l->type == GEL_MATRIX_NODE) {
m = l->mat.matrix;
quote = l->mat.quoted;
node = r;
@@ -1791,7 +1791,7 @@
}
n->op.args = NULL;
- if(l->type == MATRIX_NODE) {
+ if(l->type == GEL_MATRIX_NODE) {
replacenode(n,l);
gel_freetree(r);
} else {
@@ -1810,7 +1810,7 @@
GelETree *node;
int quote = 0;
- if (l->type == MATRIX_NODE) {
+ if (l->type == GEL_MATRIX_NODE) {
m = l->mat.matrix;
quote = l->mat.quoted;
node = r;
@@ -1844,7 +1844,7 @@
}
n->op.args = NULL;
- if (l->type == MATRIX_NODE) {
+ if (l->type == GEL_MATRIX_NODE) {
replacenode (n, l);
gel_freetree (r);
} else {
@@ -1866,33 +1866,33 @@
for(i=0;i<gel_matrixw_width(m);i++) {
GelETree *t = gel_matrixw_get_index(m,i,j);
if(t == NULL) {
- if(n->op.oper == E_FACT ||
- n->op.oper == E_DBLFACT)
+ if(n->op.oper == GEL_E_FACT ||
+ n->op.oper == GEL_E_DBLFACT)
gel_matrixw_set_index(m,i,j) = gel_makenum_ui(1);
- } else if(t->type == VALUE_NODE) {
+ } else if(t->type == GEL_VALUE_NODE) {
switch(n->op.oper) {
- case E_ABS:
+ case GEL_E_ABS:
mpw_abs(t->val.value,t->val.value);
break;
- case E_NEG:
+ case GEL_E_NEG:
mpw_neg(t->val.value,t->val.value);
break;
- case E_FACT:
+ case GEL_E_FACT:
mpw_fac(t->val.value,t->val.value);
break;
- case E_DBLFACT:
+ case GEL_E_DBLFACT:
mpw_dblfac(t->val.value,t->val.value);
break;
default:
g_assert_not_reached();
}
- } else if (t->type == BOOL_NODE &&
- n->op.oper == E_NEG) {
+ } else if (t->type == GEL_BOOL_NODE &&
+ n->op.oper == GEL_E_NEG) {
t->bool_.bool_ = ! t->bool_.bool_;
} else {
GelETree *nn;
GEL_GET_NEW_NODE(nn);
- nn->type = OPERATOR_NODE;
+ nn->type = GEL_OPERATOR_NODE;
nn->op.oper = n->op.oper;
nn->op.args = t;
t->any.next = NULL;
@@ -1917,10 +1917,10 @@
m2 = r->mat.matrix;
if G_UNLIKELY ((gel_matrixw_width(m1) != gel_matrixw_width(m2)) ||
(gel_matrixw_height(m1) != gel_matrixw_height(m2))) {
- if (n->op.oper == E_PLUS ||
- n->op.oper == E_ELTPLUS ||
- n->op.oper == E_MINUS ||
- n->op.oper == E_ELTMINUS)
+ if (n->op.oper == GEL_E_PLUS ||
+ n->op.oper == GEL_E_ELTPLUS ||
+ n->op.oper == GEL_E_MINUS ||
+ n->op.oper == GEL_E_ELTMINUS)
gel_errorout (_("Can't add/subtract two matricies of different sizes"));
else
gel_errorout (_("Can't do element by element operations on two matricies of different sizes"));
@@ -1961,12 +1961,12 @@
t = op_two_nodes (ctx,
gel_matrixw_index (m1, k, j),
gel_matrixw_index (m2, i, k),
- E_MUL,
+ GEL_E_MUL,
TRUE /* no_push */);
if (a == NULL) {
a = t;
} else {
- t2 = op_two_nodes (ctx, a, t, E_PLUS,
+ t2 = op_two_nodes (ctx, a, t, GEL_E_PLUS,
TRUE /* no_push */);
gel_freetree (t);
gel_freetree (a);
@@ -1974,7 +1974,7 @@
}
}
gel_matrixw_set_index (res, i, j) = a;
- if (a->type == OPERATOR_NODE) {
+ if (a->type == GEL_OPERATOR_NODE) {
GE_PUSH_STACK (ctx, a, GE_PRE);
}
}
@@ -2014,7 +2014,7 @@
}
}
freetree_full(n,TRUE,FALSE);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = m;
n->mat.quoted = quote;
return TRUE;
@@ -2034,7 +2034,7 @@
m = l->mat.matrix;
quote = l->mat.quoted;
- if G_UNLIKELY (r->type != VALUE_NODE ||
+ if G_UNLIKELY (r->type != GEL_VALUE_NODE ||
mpw_is_complex(r->val.value) ||
!mpw_is_integer(r->val.value) ||
(gel_matrixw_width(m) !=
@@ -2069,7 +2069,7 @@
gel_makenum_ui(1);
if(power==0) {
freetree_full(n,TRUE,FALSE);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = mi;
n->mat.quoted = quote;
return TRUE;
@@ -2102,7 +2102,7 @@
if(!free_m)
l->mat.matrix = NULL;
freetree_full(n,TRUE,FALSE);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = m;
n->mat.quoted = quote;
return TRUE;
@@ -2136,7 +2136,7 @@
}
freetree_full(n,TRUE,FALSE);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
if(!res) {
if(free_m)
n->mat.matrix = m;
@@ -2185,7 +2185,7 @@
gel_matrixw_set_index(mi,i,i) =
gel_makenum_ui(1);
- if(n->op.oper == E_BACK_DIV)
+ if(n->op.oper == GEL_E_BACK_DIV)
toinvert = m1;
else
toinvert = m2;
@@ -2208,7 +2208,7 @@
if (ctx->modulo != NULL)
mod_matrix (mi, ctx->modulo);
- if(n->op.oper == E_BACK_DIV)
+ if(n->op.oper == GEL_E_BACK_DIV)
m1 = mi;
else
m2 = mi;
@@ -2217,13 +2217,13 @@
gel_matrixw_set_size(res,gel_matrixw_width(m1),
gel_matrixw_height(m1));
gel_value_matrix_multiply(res,m1,m2,ctx->modulo);
- if(n->op.oper == E_BACK_DIV)
+ if(n->op.oper == GEL_E_BACK_DIV)
gel_matrixw_free(m1);
else
gel_matrixw_free(m2);
freetree_full(n,TRUE,FALSE);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = res;
n->mat.quoted = quote;
return TRUE;
@@ -2285,7 +2285,7 @@
}
freetree_full(n,TRUE,FALSE);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = m;
n->mat.quoted = quote;
return TRUE;
@@ -2295,11 +2295,11 @@
static gboolean
polynomial_add_sub_op (GelCtx *ctx, GelETree *n, GelETree *l, GelETree *r)
{
- if (l->type == VALUE_NODE) {
- /* r->type == POLYNOMIAL_NODE */
+ if (l->type == GEL_VALUE_NODE) {
+ /* r->type == GEL_POLYNOMIAL_NODE */
/* FIXME implement */
- } else if (r->type == VALUE_NODE) {
- /* l->type == POLYNOMIAL_NODE */
+ } else if (r->type == GEL_VALUE_NODE) {
+ /* l->type == GEL_POLYNOMIAL_NODE */
/* FIXME implement */
} else {
/* FIXME implement */
@@ -2332,12 +2332,12 @@
static void
mod_node (GelETree *n, mpw_ptr mod)
{
- if(n->type == VALUE_NODE) {
+ if(n->type == GEL_VALUE_NODE) {
if ( ! gel_mod_integer_rational (n->val.value, mod)) {
GelETree *nn;
GEL_GET_NEW_NODE(nn);
- nn->type = OPERATOR_NODE;
- nn->op.oper = E_MOD_CALC;
+ nn->type = GEL_OPERATOR_NODE;
+ nn->op.oper = GEL_E_MOD_CALC;
nn->op.args = gel_copynode (n);
nn->op.args->any.next = gel_makenum (mod);
nn->op.args->any.next->any.next = NULL;
@@ -2345,7 +2345,7 @@
gel_error_num = GEL_NO_ERROR;
replacenode (n, nn);
}
- } else if(n->type == MATRIX_NODE) {
+ } else if(n->type == GEL_MATRIX_NODE) {
if (n->mat.matrix != NULL)
mod_matrix (n->mat.matrix, mod);
}
@@ -2363,16 +2363,16 @@
gel_isnodetrue (GelETree *n, gboolean *bad_node)
{
switch (n->type) {
- case NULL_NODE:
+ case GEL_NULL_NODE:
return FALSE;
- case VALUE_NODE:
+ case GEL_VALUE_NODE:
return ! mpw_zero_p (n->val.value);
- case STRING_NODE:
+ case GEL_STRING_NODE:
if(n->str.str && *n->str.str)
return TRUE;
else
return FALSE;
- case BOOL_NODE:
+ case GEL_BOOL_NODE:
return n->bool_.bool_;
default:
if (bad_node)
@@ -2408,20 +2408,20 @@
{
char *s = NULL;
- if (l->type == STRING_NODE &&
- r->type == STRING_NODE) {
+ if (l->type == GEL_STRING_NODE &&
+ r->type == GEL_STRING_NODE) {
s = g_strconcat (l->str.str, r->str.str, NULL);
- } else if (l->type == STRING_NODE &&
- r->type == IDENTIFIER_NODE) {
+ } else if (l->type == GEL_STRING_NODE &&
+ r->type == GEL_IDENTIFIER_NODE) {
s = g_strconcat (l->str.str, r->id.id->token, NULL);
- } else if (r->type == STRING_NODE &&
- l->type == IDENTIFIER_NODE) {
+ } else if (r->type == GEL_STRING_NODE &&
+ l->type == GEL_IDENTIFIER_NODE) {
s = g_strconcat (l->id.id->token, r->str.str, NULL);
- } else if (l->type == STRING_NODE) {
+ } else if (l->type == GEL_STRING_NODE) {
char *t = gel_string_print_etree (r);
s = g_strconcat (l->str.str, t, NULL);
g_free (t);
- } else if (r->type == STRING_NODE) {
+ } else if (r->type == GEL_STRING_NODE) {
char *t = gel_string_print_etree (l);
s = g_strconcat (t, r->str.str, NULL);
g_free (t);
@@ -2430,7 +2430,7 @@
}
freetree_full (n, TRUE, FALSE);
- n->type = STRING_NODE;
+ n->type = GEL_STRING_NODE;
n->str.str = s;
n->str.constant = FALSE;
@@ -2587,12 +2587,12 @@
GelETree *nn;
GEL_GET_NEW_NODE (n);
- n->type = OPERATOR_NODE;
- n->op.oper = E_DIRECTCALL;
+ n->type = GEL_OPERATOR_NODE;
+ n->op.oper = GEL_E_DIRECTCALL;
n->op.nargs = a->nargs+1;
GEL_GET_NEW_NODE (nn);
- nn->type = FUNCTION_NODE;
+ nn->type = GEL_FUNCTION_NODE;
nn->func.func = d_copyfunc (a);
nn->func.func->context = -1;
@@ -2618,7 +2618,7 @@
GelEFunc *f;
GEL_GET_NEW_NODE (nn);
- nn->type = OPERATOR_NODE;
+ nn->type = GEL_OPERATOR_NODE;
nn->op.oper = n->op.oper;
nn->op.args = la;
nn->op.args->any.next = lb;
@@ -2635,7 +2635,7 @@
args, nargs,
NULL /* extra_dict */);
freetree_full (n, TRUE /* free args */, FALSE /* kill */);
- n->type = FUNCTION_NODE;
+ n->type = GEL_FUNCTION_NODE;
n->func.func = f;
n->func.func->context = -1;
@@ -2734,7 +2734,7 @@
la = make_funccall (a);
GEL_GET_NEW_NODE (nn);
- nn->type = OPERATOR_NODE;
+ nn->type = GEL_OPERATOR_NODE;
nn->op.oper = n->op.oper;
nn->op.args = la;
nn->op.args->any.next = NULL;
@@ -2750,7 +2750,7 @@
args, a->nargs,
NULL /* extra_dict */);
freetree_full (n, TRUE /* free args */, FALSE /* kill */);
- n->type = FUNCTION_NODE;
+ n->type = GEL_FUNCTION_NODE;
n->func.func = f;
n->func.func->context = -1;
@@ -2785,13 +2785,13 @@
la = make_funccall (a);
GEL_GET_NEW_NODE (n);
- n->type = FUNCTION_NODE;
+ n->type = GEL_FUNCTION_NODE;
n->func.func = d_copyfunc (func);
n->func.func->context = -1;
GEL_GET_NEW_NODE (nn);
- nn->type = OPERATOR_NODE;
- nn->op.oper = E_DIRECTCALL;
+ nn->type = GEL_OPERATOR_NODE;
+ nn->op.oper = GEL_E_DIRECTCALL;
nn->op.args = n;
nn->op.args->any.next = la;
nn->op.args->any.next->any.next = NULL;
@@ -2807,7 +2807,7 @@
args, a->nargs,
NULL /* extra_dict */);
GEL_GET_NEW_NODE (n);
- n->type = FUNCTION_NODE;
+ n->type = GEL_FUNCTION_NODE;
n->func.func = f;
n->func.func->context = -1;
@@ -2818,18 +2818,18 @@
#define EMPTY_PRIM {{{{0}}}}
/* May have to raise OP_TABLE_LEN in eval.h if you add entries below */
-static const GelOper prim_table[E_OPER_LAST] = {
- /*E_SEPAR*/ EMPTY_PRIM,
- /*E_EQUALS*/ EMPTY_PRIM,
- /*E_PARAMETER*/ EMPTY_PRIM,
- /*E_ABS*/
+static const GelOper prim_table[GEL_E_OPER_LAST] = {
+ /*GEL_E_SEPAR*/ EMPTY_PRIM,
+ /*GEL_E_EQUALS*/ EMPTY_PRIM,
+ /*GEL_E_PARAMETER*/ EMPTY_PRIM,
+ /*GEL_E_ABS*/
{{
{{GO_VALUE,0,0},(GelEvalFunc)numerical_abs},
{{GO_MATRIX,0,0},(GelEvalFunc)matrix_absnegfac_op},
{{GO_FUNCTION|GO_IDENTIFIER,0,0},
(GelEvalFunc)function_uni_op},
}},
- /*E_PLUS*/
+ /*GEL_E_PLUS*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_add},
{{GO_MATRIX,GO_MATRIX,0},(GelEvalFunc)pure_matrix_eltbyelt_op},
@@ -2849,7 +2849,7 @@
(GelEvalFunc)polynomial_add_sub_op},
{{GO_VALUE|GO_STRING|GO_BOOL,GO_VALUE|GO_STRING|GO_BOOL,0},(GelEvalFunc)boolean_add},
}},
- /*E_ELTPLUS*/
+ /*GEL_E_ELTPLUS*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_add},
{{GO_MATRIX,GO_MATRIX,0},(GelEvalFunc)pure_matrix_eltbyelt_op},
@@ -2869,7 +2869,7 @@
(GelEvalFunc)polynomial_add_sub_op},
{{GO_VALUE|GO_STRING|GO_BOOL,GO_VALUE|GO_STRING|GO_BOOL,0},(GelEvalFunc)boolean_add},
}},
- /*E_MINUS*/
+ /*GEL_E_MINUS*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_sub},
{{GO_MATRIX,GO_MATRIX,0},(GelEvalFunc)pure_matrix_eltbyelt_op},
@@ -2885,7 +2885,7 @@
(GelEvalFunc)something_function_bin_op},
{{GO_VALUE|GO_STRING|GO_BOOL,GO_VALUE|GO_STRING|GO_BOOL,0},(GelEvalFunc)boolean_sub},
}},
- /*E_ELTMINUS*/
+ /*GEL_E_ELTMINUS*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_sub},
{{GO_MATRIX,GO_MATRIX,0},(GelEvalFunc)pure_matrix_eltbyelt_op},
@@ -2901,7 +2901,7 @@
(GelEvalFunc)something_function_bin_op},
{{GO_VALUE|GO_STRING|GO_BOOL,GO_VALUE|GO_STRING|GO_BOOL,0},(GelEvalFunc)boolean_sub},
}},
- /*E_MUL*/
+ /*GEL_E_MUL*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_mul},
{{GO_MATRIX,GO_MATRIX,0},(GelEvalFunc)pure_matrix_mul_op},
@@ -2915,7 +2915,7 @@
(GelEvalFunc)something_function_bin_op},
{{GO_VALUE|GO_STRING|GO_BOOL,GO_VALUE|GO_STRING|GO_BOOL,0},(GelEvalFunc)boolean_mul},
}},
- /*E_ELTMUL*/
+ /*GEL_E_ELTMUL*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_mul},
{{GO_MATRIX,GO_MATRIX,0},(GelEvalFunc)pure_matrix_eltbyelt_op},
@@ -2929,7 +2929,7 @@
(GelEvalFunc)something_function_bin_op},
{{GO_VALUE|GO_STRING|GO_BOOL,GO_VALUE|GO_STRING|GO_BOOL,0},(GelEvalFunc)boolean_mul},
}},
- /*E_DIV*/
+ /*GEL_E_DIV*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_div},
{{GO_MATRIX,GO_VALUE,0}, (GelEvalFunc)matrix_scalar_matrix_op},
@@ -2942,7 +2942,7 @@
{{GO_VALUE|GO_MATRIX,GO_FUNCTION|GO_IDENTIFIER,0},
(GelEvalFunc)something_function_bin_op},
}},
- /*E_ELTDIV*/
+ /*GEL_E_ELTDIV*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_div},
{{GO_MATRIX,GO_MATRIX,0},(GelEvalFunc)pure_matrix_eltbyelt_op},
@@ -2955,7 +2955,7 @@
{{GO_VALUE|GO_MATRIX,GO_FUNCTION|GO_IDENTIFIER,0},
(GelEvalFunc)something_function_bin_op},
}},
- /*E_BACK_DIV*/
+ /*GEL_E_BACK_DIV*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_back_div},
{{GO_MATRIX,GO_MATRIX,0},(GelEvalFunc)pure_matrix_div_op},
@@ -2966,7 +2966,7 @@
{{GO_VALUE|GO_MATRIX,GO_FUNCTION|GO_IDENTIFIER,0},
(GelEvalFunc)something_function_bin_op},
}},
- /*E_ELT_BACK_DIV*/
+ /*GEL_E_ELT_BACK_DIV*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_back_div},
{{GO_MATRIX,GO_MATRIX,0},(GelEvalFunc)pure_matrix_eltbyelt_op},
@@ -2979,7 +2979,7 @@
{{GO_VALUE|GO_MATRIX,GO_FUNCTION|GO_IDENTIFIER,0},
(GelEvalFunc)something_function_bin_op},
}},
- /*E_MOD*/
+ /*GEL_E_MOD*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_mod},
{{GO_FUNCTION|GO_IDENTIFIER,GO_FUNCTION|GO_IDENTIFIER,0},
@@ -2989,7 +2989,7 @@
{{GO_VALUE,GO_FUNCTION|GO_IDENTIFIER,0},
(GelEvalFunc)something_function_bin_op},
}},
- /*E_ELTMOD*/
+ /*GEL_E_ELTMOD*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_mod},
{{GO_MATRIX,GO_MATRIX,0},(GelEvalFunc)pure_matrix_eltbyelt_op},
@@ -3002,7 +3002,7 @@
{{GO_VALUE|GO_MATRIX,GO_FUNCTION|GO_IDENTIFIER,0},
(GelEvalFunc)something_function_bin_op},
}},
- /*E_NEG*/
+ /*GEL_E_NEG*/
{{
{{GO_VALUE,0,0},(GelEvalFunc)numerical_neg},
{{GO_MATRIX,0,0},(GelEvalFunc)matrix_absnegfac_op},
@@ -3010,7 +3010,7 @@
(GelEvalFunc)function_uni_op},
{{GO_BOOL,0,0},(GelEvalFunc)boolean_neg},
}},
- /*E_EXP*/
+ /*GEL_E_EXP*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_pow},
{{GO_MATRIX,GO_VALUE,0},(GelEvalFunc)matrix_pow_op},
@@ -3021,7 +3021,7 @@
{{GO_VALUE|GO_MATRIX,GO_FUNCTION|GO_IDENTIFIER,0},
(GelEvalFunc)something_function_bin_op},
}},
- /*E_ELTEXP*/
+ /*GEL_E_ELTEXP*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)numerical_pow},
{{GO_MATRIX,GO_MATRIX,0},(GelEvalFunc)pure_matrix_eltbyelt_op},
@@ -3034,50 +3034,50 @@
{{GO_VALUE|GO_MATRIX,GO_FUNCTION|GO_IDENTIFIER,0},
(GelEvalFunc)something_function_bin_op},
}},
- /*E_FACT*/
+ /*GEL_E_FACT*/
{{
{{GO_VALUE,0,0},(GelEvalFunc)numerical_fac},
{{GO_MATRIX,0,0},(GelEvalFunc)matrix_absnegfac_op},
{{GO_FUNCTION|GO_IDENTIFIER,0,0},
(GelEvalFunc)function_uni_op},
}},
- /*E_DBLFACT*/
+ /*GEL_E_DBLFACT*/
{{
{{GO_VALUE,0,0},(GelEvalFunc)numerical_dblfac},
{{GO_MATRIX,0,0},(GelEvalFunc)matrix_absnegfac_op},
{{GO_FUNCTION|GO_IDENTIFIER,0,0},
(GelEvalFunc)function_uni_op},
}},
- /*E_TRANSPOSE*/
+ /*GEL_E_TRANSPOSE*/
{{
{{GO_MATRIX,0,0},(GelEvalFunc)transpose_matrix},
{{GO_FUNCTION|GO_IDENTIFIER,0,0},
(GelEvalFunc)function_uni_op},
}},
- /*E_CONJUGATE_TRANSPOSE*/
+ /*GEL_E_CONJUGATE_TRANSPOSE*/
{{
{{GO_MATRIX,0,0},(GelEvalFunc)conjugate_transpose_matrix},
{{GO_FUNCTION|GO_IDENTIFIER,0,0},
(GelEvalFunc)function_uni_op},
}},
- /*E_IF_CONS*/ EMPTY_PRIM,
- /*E_IFELSE_CONS*/ EMPTY_PRIM,
- /*E_WHILE_CONS*/ EMPTY_PRIM,
- /*E_UNTIL_CONS*/ EMPTY_PRIM,
- /*E_DOWHILE_CONS*/ EMPTY_PRIM,
- /*E_DOUNTIL_CONS*/ EMPTY_PRIM,
- /*E_FOR_CONS*/ EMPTY_PRIM,
- /*E_FORBY_CONS*/ EMPTY_PRIM,
- /*E_FORIN_CONS*/ EMPTY_PRIM,
- /*E_SUM_CONS*/ EMPTY_PRIM,
- /*E_SUMBY_CONS*/ EMPTY_PRIM,
- /*E_SUMIN_CONS*/ EMPTY_PRIM,
- /*E_PROD_CONS*/ EMPTY_PRIM,
- /*E_PRODBY_CONS*/ EMPTY_PRIM,
- /*E_PRODIN_CONS*/ EMPTY_PRIM,
- /*E_EQ_CMP*/ EMPTY_PRIM,
- /*E_NE_CMP*/ EMPTY_PRIM,
- /*E_CMP_CMP*/
+ /*GEL_E_IF_CONS*/ EMPTY_PRIM,
+ /*GEL_E_IFELSE_CONS*/ EMPTY_PRIM,
+ /*GEL_E_WHILE_CONS*/ EMPTY_PRIM,
+ /*GEL_E_UNTIL_CONS*/ EMPTY_PRIM,
+ /*GEL_E_DOWHILE_CONS*/ EMPTY_PRIM,
+ /*GEL_E_DOUNTIL_CONS*/ EMPTY_PRIM,
+ /*GEL_E_FOR_CONS*/ EMPTY_PRIM,
+ /*GEL_E_FORBY_CONS*/ EMPTY_PRIM,
+ /*GEL_E_FORIN_CONS*/ EMPTY_PRIM,
+ /*GEL_E_SUM_CONS*/ EMPTY_PRIM,
+ /*GEL_E_SUMBY_CONS*/ EMPTY_PRIM,
+ /*GEL_E_SUMIN_CONS*/ EMPTY_PRIM,
+ /*GEL_E_PROD_CONS*/ EMPTY_PRIM,
+ /*GEL_E_PRODBY_CONS*/ EMPTY_PRIM,
+ /*GEL_E_PRODIN_CONS*/ EMPTY_PRIM,
+ /*GEL_E_EQ_CMP*/ EMPTY_PRIM,
+ /*GEL_E_NE_CMP*/ EMPTY_PRIM,
+ /*GEL_E_CMP_CMP*/
{{
{{GO_VALUE,GO_VALUE,0},(GelEvalFunc)cmpcmpop},
{{GO_VALUE|GO_MATRIX|GO_FUNCTION|GO_STRING,GO_STRING,0},
@@ -3085,42 +3085,42 @@
{{GO_STRING,GO_VALUE|GO_MATRIX|GO_FUNCTION|GO_STRING,0},
(GelEvalFunc)cmpstringop},
}},
- /*E_LT_CMP*/ EMPTY_PRIM,
- /*E_GT_CMP*/ EMPTY_PRIM,
- /*E_LE_CMP*/ EMPTY_PRIM,
- /*E_GE_CMP*/ EMPTY_PRIM,
- /*E_LOGICAL_AND*/ EMPTY_PRIM,
- /*E_LOGICAL_OR*/ EMPTY_PRIM,
- /*E_LOGICAL_XOR*/
+ /*GEL_E_LT_CMP*/ EMPTY_PRIM,
+ /*GEL_E_GT_CMP*/ EMPTY_PRIM,
+ /*GEL_E_LE_CMP*/ EMPTY_PRIM,
+ /*GEL_E_GE_CMP*/ EMPTY_PRIM,
+ /*GEL_E_LOGICAL_AND*/ EMPTY_PRIM,
+ /*GEL_E_LOGICAL_OR*/ EMPTY_PRIM,
+ /*GEL_E_LOGICAL_XOR*/
{{
{{GO_VALUE|GO_STRING|GO_BOOL,GO_VALUE|GO_STRING|GO_BOOL,0},
(GelEvalFunc)logicalxorop},
}},
- /*E_LOGICAL_NOT*/
+ /*GEL_E_LOGICAL_NOT*/
{{
{{GO_VALUE|GO_STRING|GO_BOOL,0,0},(GelEvalFunc)logicalnotop},
{{GO_FUNCTION|GO_IDENTIFIER,0,0},
(GelEvalFunc)function_uni_op},
}},
- /*E_REGION_SEP*/ EMPTY_PRIM,
- /*E_REGION_SEP_BY*/ EMPTY_PRIM,
- /*E_GET_VELEMENT*/ EMPTY_PRIM,
- /*E_GET_ELEMENT*/ EMPTY_PRIM,
- /*E_GET_ROW_REGION*/ EMPTY_PRIM,
- /*E_GET_COL_REGION*/ EMPTY_PRIM,
- /*E_QUOTE*/ EMPTY_PRIM,
- /*E_REFERENCE*/ EMPTY_PRIM,
- /*E_DEREFERENCE*/ EMPTY_PRIM,
- /*E_DIRECTCALL*/ EMPTY_PRIM,
- /*E_CALL*/ EMPTY_PRIM,
- /*E_RETURN*/ EMPTY_PRIM,
- /*E_BAILOUT*/ EMPTY_PRIM,
- /*E_EXCEPTION*/ EMPTY_PRIM,
- /*E_CONTINUE*/ EMPTY_PRIM,
- /*E_BREAK*/ EMPTY_PRIM,
- /*E_MOD_CALC*/ EMPTY_PRIM,
- /*E_DEFEQUALS*/ EMPTY_PRIM,
- /*E_OPER_LAST*/
+ /*GEL_E_REGION_SEP*/ EMPTY_PRIM,
+ /*GEL_E_REGION_SEP_BY*/ EMPTY_PRIM,
+ /*GEL_E_GET_VELEMENT*/ EMPTY_PRIM,
+ /*GEL_E_GET_ELEMENT*/ EMPTY_PRIM,
+ /*GEL_E_GET_ROW_REGION*/ EMPTY_PRIM,
+ /*GEL_E_GET_COL_REGION*/ EMPTY_PRIM,
+ /*GEL_E_QUOTE*/ EMPTY_PRIM,
+ /*GEL_E_REFERENCE*/ EMPTY_PRIM,
+ /*GEL_E_DEREFERENCE*/ EMPTY_PRIM,
+ /*GEL_E_DIRECTCALL*/ EMPTY_PRIM,
+ /*GEL_E_CALL*/ EMPTY_PRIM,
+ /*GEL_E_RETURN*/ EMPTY_PRIM,
+ /*GEL_E_BAILOUT*/ EMPTY_PRIM,
+ /*GEL_E_EXCEPTION*/ EMPTY_PRIM,
+ /*GEL_E_CONTINUE*/ EMPTY_PRIM,
+ /*GEL_E_BREAK*/ EMPTY_PRIM,
+ /*GEL_E_MOD_CALC*/ EMPTY_PRIM,
+ /*GEL_E_DEFEQUALS*/ EMPTY_PRIM,
+ /*GEL_E_OPER_LAST*/
};
#undef EMPTY_PRIM
@@ -3294,7 +3294,7 @@
D_ENSURE_USER_BODY (f);
freetree_full(n,TRUE,FALSE);
- n->type = FUNCTION_NODE;
+ n->type = GEL_FUNCTION_NODE;
/* FIXME: are we ok with passing the token as well? */
n->func.func = d_makeufunc (f->id /* FIXME: does this need to be NULL */,
gel_copynode (f->data.user),
@@ -3312,7 +3312,7 @@
if(f->nargs != 0) {
freetree_full(n,TRUE,FALSE);
- n->type = FUNCTION_NODE;
+ n->type = GEL_FUNCTION_NODE;
/* FIXME: are we ok with passing the token (f->id) as well? */
n->func.func = d_makerealfunc(f,f->id,FALSE);
n->func.func->context = -1;
@@ -3330,7 +3330,7 @@
if(ret)
gel_freetree(ret);
return FALSE;
- } else if(ret) {
+ } else if G_LIKELY (ret) {
replacenode(n,ret);
}
} else if(f->type == GEL_REFERENCE_FUNC) {
@@ -3338,7 +3338,7 @@
f = f->data.ref;
GEL_GET_NEW_NODE(i);
- i->type = IDENTIFIER_NODE;
+ i->type = GEL_IDENTIFIER_NODE;
if(f->id) {
i->id.id = f->id;
} else {
@@ -3351,8 +3351,8 @@
i->any.next = NULL;
freetree_full(n,TRUE,FALSE);
- n->type = OPERATOR_NODE;
- n->op.oper = E_REFERENCE;
+ n->type = GEL_OPERATOR_NODE;
+ n->op.oper = GEL_E_REFERENCE;
n->op.args = i;
n->op.nargs = 1;
@@ -3486,14 +3486,14 @@
int i;
int level = 0;
for(i=0;i<cnt;i++,r = r->any.next) {
- if (r->type == VALUE_NODE)
+ if (r->type == GEL_VALUE_NODE)
continue;
- if (bool_ok && r->type == BOOL_NODE)
+ if (bool_ok && r->type == GEL_BOOL_NODE)
continue;
- if(r->type==MATRIX_NODE)
+ if(r->type==GEL_MATRIX_NODE)
level = level<1?1:level;
- else if(r->type==STRING_NODE)
+ else if(r->type==GEL_STRING_NODE)
level = 2;
else
return 3;
@@ -3511,15 +3511,15 @@
int oper = GPOINTER_TO_INT(oli->data);
gboolean err = FALSE;
GelETree *l = ali,*r = ali->any.next;
- gboolean bool_ok = (oper == E_EQ_CMP ||
- oper == E_NE_CMP);
+ gboolean bool_ok = (oper == GEL_E_EQ_CMP ||
+ oper == GEL_E_NE_CMP);
switch (arglevel (ali,
2,
bool_ok)) {
case 0:
switch(oper) {
- case E_EQ_CMP:
+ case GEL_E_EQ_CMP:
if ( ! eqlnodes (l, r)) {
if G_UNLIKELY (gel_error_num != GEL_NO_ERROR) {
gel_error_num = GEL_NO_ERROR;
@@ -3528,7 +3528,7 @@
RET_RES(0)
}
break;
- case E_NE_CMP:
+ case GEL_E_NE_CMP:
if (eqlnodes (l, r)) {
RET_RES(0)
} else if G_UNLIKELY (gel_error_num != GEL_NO_ERROR) {
@@ -3536,7 +3536,7 @@
return;
}
break;
- case E_LT_CMP:
+ case GEL_E_LT_CMP:
if(cmpnodes(l,r)>=0) {
if G_UNLIKELY (gel_error_num != GEL_NO_ERROR) {
gel_error_num = GEL_NO_ERROR;
@@ -3545,7 +3545,7 @@
RET_RES(0)
}
break;
- case E_GT_CMP:
+ case GEL_E_GT_CMP:
if(cmpnodes(l,r)<=0) {
if G_UNLIKELY (gel_error_num != GEL_NO_ERROR) {
gel_error_num = GEL_NO_ERROR;
@@ -3554,7 +3554,7 @@
RET_RES(0)
}
break;
- case E_LE_CMP:
+ case GEL_E_LE_CMP:
if(cmpnodes(l,r)>0) {
RET_RES(0)
} else if G_UNLIKELY (gel_error_num != GEL_NO_ERROR) {
@@ -3562,7 +3562,7 @@
return;
}
break;
- case E_GE_CMP:
+ case GEL_E_GE_CMP:
if(cmpnodes(l,r)<0) {
RET_RES(0)
} else if G_UNLIKELY (gel_error_num != GEL_NO_ERROR) {
@@ -3576,7 +3576,7 @@
break;
case 1:
switch(oper) {
- case E_EQ_CMP:
+ case GEL_E_EQ_CMP:
if(!eqmatrix(l,r,&err)) {
if G_UNLIKELY (err) {
gel_error_num = GEL_NO_ERROR;
@@ -3585,7 +3585,7 @@
RET_RES(0)
}
break;
- case E_NE_CMP:
+ case GEL_E_NE_CMP:
if(eqmatrix(l,r,&err)) {
RET_RES(0)
} else if G_UNLIKELY (err) {
@@ -3601,32 +3601,32 @@
break;
case 2:
switch(oper) {
- case E_EQ_CMP:
+ case GEL_E_EQ_CMP:
if(!eqstring(l,r)) {
RET_RES(0)
}
break;
- case E_NE_CMP:
+ case GEL_E_NE_CMP:
if(eqstring(l,r)) {
RET_RES(0)
}
break;
- case E_LT_CMP:
+ case GEL_E_LT_CMP:
if(cmpstring(l,r)>=0) {
RET_RES(0)
}
break;
- case E_GT_CMP:
+ case GEL_E_GT_CMP:
if(cmpstring(l,r)<=0) {
RET_RES(0)
}
break;
- case E_LE_CMP:
+ case GEL_E_LE_CMP:
if(cmpstring(l,r)>0) {
RET_RES(0)
}
break;
- case E_GE_CMP:
+ case GEL_E_GE_CMP:
if(cmpstring(l,r)<0) {
RET_RES(0)
}
@@ -3723,7 +3723,7 @@
GEL_GET_LR (n, l, r);
- if G_UNLIKELY (r->type != VALUE_NODE ||
+ if G_UNLIKELY (r->type != GEL_VALUE_NODE ||
mpw_is_complex (r->val.value) ||
! mpw_is_integer (r->val.value) ||
mpw_sgn (r->val.value) <= 0) {
@@ -3930,7 +3930,7 @@
} else if (b == NULL) {
EDEBUG(" NULL BODY");
freetree_full (n, TRUE, FALSE);
- n->type = NULL_NODE;
+ n->type = GEL_NULL_NODE;
} else {
replacenode (n, b);
}
@@ -3982,7 +3982,7 @@
res = op_two_nodes (ctx,
evf->result,
evf->body,
- E_PLUS,
+ GEL_E_PLUS,
TRUE /* no_push */);
gel_freetree (evf->result);
evf->result = NULL;
@@ -3997,7 +3997,7 @@
res = op_two_nodes (ctx,
evf->result,
evf->body,
- E_MUL,
+ GEL_E_MUL,
TRUE /* no_push */);
gel_freetree (evf->result);
evf->result = NULL;
@@ -4008,10 +4008,10 @@
gel_freetree (evf->body);
evf->body = NULL;
}
- if (res->type == VALUE_NODE ||
- res->type == NULL_NODE ||
- res->type == BOOL_NODE ||
- res->type == STRING_NODE) {
+ if (res->type == GEL_VALUE_NODE ||
+ res->type == GEL_NULL_NODE ||
+ res->type == GEL_BOOL_NODE ||
+ res->type == GEL_STRING_NODE) {
if (flag & GE_WHACKARG) {
/* WHACKWHACK */
gel_freetree (data);
@@ -4039,7 +4039,7 @@
op_two_nodes (ctx,
old,
evf->body,
- E_PLUS,
+ GEL_E_PLUS,
TRUE /* no_push */);
gel_freetree (old);
} else {
@@ -4053,7 +4053,7 @@
op_two_nodes (ctx,
old,
evf->body,
- E_MUL,
+ GEL_E_MUL,
TRUE /* no_push */);
gel_freetree (old);
} else {
@@ -4092,7 +4092,7 @@
op_two_nodes (ctx,
old,
evfi->body,
- E_PLUS,
+ GEL_E_PLUS,
TRUE /* no_push */);
gel_freetree (old);
} else {
@@ -4106,7 +4106,7 @@
op_two_nodes (ctx,
old,
evfi->body,
- E_MUL,
+ GEL_E_MUL,
TRUE /* no_push */);
gel_freetree (old);
} else {
@@ -4137,7 +4137,7 @@
res = op_two_nodes (ctx,
evfi->result,
evfi->body,
- E_PLUS,
+ GEL_E_PLUS,
TRUE /* no_push */);
gel_freetree (evfi->result);
evfi->result = NULL;
@@ -4152,7 +4152,7 @@
res = op_two_nodes (ctx,
evfi->result,
evfi->body,
- E_MUL,
+ GEL_E_MUL,
TRUE /* no_push */);
gel_freetree (evfi->result);
evfi->result = NULL;
@@ -4163,10 +4163,10 @@
gel_freetree (evfi->body);
evfi->body = NULL;
}
- if (res->type == VALUE_NODE ||
- res->type == NULL_NODE ||
- res->type == BOOL_NODE ||
- res->type == STRING_NODE) {
+ if (res->type == GEL_VALUE_NODE ||
+ res->type == GEL_NULL_NODE ||
+ res->type == GEL_BOOL_NODE ||
+ res->type == GEL_STRING_NODE) {
if (flag & GE_WHACKARG) {
/* WHACKWHACK */
gel_freetree (data);
@@ -4399,11 +4399,11 @@
for (x = w-1; x >= 0; x--) {
t = gel_matrixw_get_index (m, x, y);
if (t != NULL &&
- t->type != NULL_NODE &&
- t->type != BOOL_NODE &&
- t->type != VALUE_NODE &&
- t->type != STRING_NODE &&
- t->type != USERTYPE_NODE) {
+ t->type != GEL_NULL_NODE &&
+ t->type != GEL_BOOL_NODE &&
+ t->type != GEL_VALUE_NODE &&
+ t->type != GEL_STRING_NODE &&
+ t->type != GEL_USERTYPE_NODE) {
if ( ! pushed) {
/*make us a private copy!*/
gel_matrixw_make_private (m, TRUE /* kill_type_caches */);
@@ -4438,7 +4438,7 @@
{
GelEFunc *f;
- if(l->type == IDENTIFIER_NODE) {
+ if(l->type == GEL_IDENTIFIER_NODE) {
f = d_lookup_global(l->id.id);
if (f == NULL) {
if G_UNLIKELY ( ! silent) {
@@ -4458,10 +4458,10 @@
}
return NULL;
}
- } else if(l->type == FUNCTION_NODE) {
+ } else if(l->type == GEL_FUNCTION_NODE) {
f = l->func.func;
- } else if(l->type == OPERATOR_NODE &&
- l->op.oper == E_DEREFERENCE) {
+ } else if(l->type == GEL_OPERATOR_NODE &&
+ l->op.oper == GEL_E_DEREFERENCE) {
GelETree *ll;
GEL_GET_L(l,ll);
f = d_lookup_global(ll->id.id);
@@ -4555,10 +4555,10 @@
if (f->vararg)
break;
}
- if (ali->type == FUNCTION_NODE) {
+ if (ali->type == GEL_FUNCTION_NODE) {
d_addfunc(d_makerealfunc(ali->func.func,li->data,FALSE));
- } else if(ali->type == OPERATOR_NODE &&
- ali->op.oper == E_REFERENCE) {
+ } else if(ali->type == GEL_OPERATOR_NODE &&
+ ali->op.oper == GEL_E_REFERENCE) {
GelETree *t = ali->op.args;
GelEFunc *rf = d_lookup_global_up1(t->id.id);
if G_UNLIKELY (rf == NULL) {
@@ -4601,7 +4601,7 @@
}
GEL_GET_NEW_NODE (nn);
- nn->type = MATRIX_NODE;
+ nn->type = GEL_MATRIX_NODE;
nn->mat.quoted = FALSE;
nn->mat.matrix = gel_matrixw_new_with_matrix (m);
@@ -4662,7 +4662,7 @@
* the arguments. This can be used for optimization
* such as the Identity function. The function should
* however not just steal the GelETree, it should replace
- * it with a NULL_NODE or some such.
+ * it with a GEL_NULL_NODE or some such.
*/
ret = (*f->data.func)(ctx,r,&exception);
@@ -4703,13 +4703,13 @@
}
GEL_GET_NEW_NODE(id);
- id->type = IDENTIFIER_NODE;
+ id->type = GEL_IDENTIFIER_NODE;
id->id.id = f->id; /*this WILL have an id*/
id->any.next = NULL;
freetree_full(n,TRUE,FALSE);
- n->type = OPERATOR_NODE;
- n->op.oper = E_REFERENCE;
+ n->type = GEL_OPERATOR_NODE;
+ n->op.oper = GEL_E_REFERENCE;
n->op.args = id;
n->op.nargs = 1;
@@ -4786,27 +4786,27 @@
gint8 init_cmp;
switch (n->op.oper) {
- case E_FOR_CONS:
+ case GEL_E_FOR_CONS:
type = GEL_EVAL_FOR;
GEL_GET_ABCD(n,ident,from,to,body);
break;
- case E_SUM_CONS:
+ case GEL_E_SUM_CONS:
type = GEL_EVAL_SUM;
GEL_GET_ABCD(n,ident,from,to,body);
break;
- case E_PROD_CONS:
+ case GEL_E_PROD_CONS:
type = GEL_EVAL_PROD;
GEL_GET_ABCD(n,ident,from,to,body);
break;
- case E_FORBY_CONS:
+ case GEL_E_FORBY_CONS:
type = GEL_EVAL_FOR;
GEL_GET_ABCDE(n,ident,from,to,by,body);
break;
- case E_SUMBY_CONS:
+ case GEL_E_SUMBY_CONS:
type = GEL_EVAL_SUM;
GEL_GET_ABCDE(n,ident,from,to,by,body);
break;
- case E_PRODBY_CONS:
+ case GEL_E_PRODBY_CONS:
type = GEL_EVAL_PROD;
GEL_GET_ABCDE(n,ident,from,to,by,body);
break;
@@ -4817,10 +4817,10 @@
EDEBUG(" ITER FOR LOOP");
- if G_UNLIKELY ((by && (by->type != VALUE_NODE ||
+ if G_UNLIKELY ((by && (by->type != GEL_VALUE_NODE ||
mpw_is_complex(by->val.value))) ||
- from->type != VALUE_NODE || mpw_is_complex(from->val.value) ||
- to->type != VALUE_NODE || mpw_is_complex(to->val.value)) {
+ from->type != GEL_VALUE_NODE || mpw_is_complex(from->val.value) ||
+ to->type != GEL_VALUE_NODE || mpw_is_complex(to->val.value)) {
gel_errorout (_("Bad type for 'for/sum/prod' loop!"));
iter_pop_stack(ctx);
return;
@@ -4839,7 +4839,7 @@
d_addfunc(d_makevfunc(ident->id.id,gel_copynode(from)));
freetree_full(n,TRUE,FALSE);
if (type == GEL_EVAL_FOR) {
- n->type = NULL_NODE;
+ n->type = GEL_NULL_NODE;
} else if (type == GEL_EVAL_SUM) {
gel_makenum_ui_from (n, 0);
} else /* if (type == GEL_EVAL_PROD) */ {
@@ -4858,7 +4858,7 @@
d_addfunc(d_makevfunc(ident->id.id,gel_copynode(from)));
freetree_full(n,TRUE,FALSE);
if (type == GEL_EVAL_FOR) {
- n->type = NULL_NODE;
+ n->type = GEL_NULL_NODE;
} else if (type == GEL_EVAL_SUM) {
gel_makenum_ui_from (n, 0);
} else /* if (type == GEL_EVAL_PROD) */ {
@@ -4893,13 +4893,13 @@
GelETree *from,*body,*ident;
switch (n->op.oper) {
- case E_FORIN_CONS:
+ case GEL_E_FORIN_CONS:
type = GEL_EVAL_FOR;
break;
- case E_SUMIN_CONS:
+ case GEL_E_SUMIN_CONS:
type = GEL_EVAL_SUM;
break;
- case E_PRODIN_CONS:
+ case GEL_E_PRODIN_CONS:
type = GEL_EVAL_PROD;
break;
default:
@@ -4912,12 +4912,12 @@
EDEBUG(" ITER FORIN LOOP");
/* If there is nothing to sum */
- if (from->type == NULL_NODE) {
+ if (from->type == GEL_NULL_NODE) {
/* replace n with the appropriate nothingness */
freetree_full (n, TRUE, FALSE);
switch (type) {
case GEL_EVAL_FOR:
- n->type = NULL_NODE;
+ n->type = GEL_NULL_NODE;
break;
case GEL_EVAL_SUM:
gel_makenum_ui_from (n, 0);
@@ -4934,15 +4934,15 @@
}
/* FIXME: string should go through all the characters I suppose */
- if G_UNLIKELY (from->type != VALUE_NODE &&
- from->type != BOOL_NODE &&
- from->type != MATRIX_NODE) {
+ if G_UNLIKELY (from->type != GEL_VALUE_NODE &&
+ from->type != GEL_BOOL_NODE &&
+ from->type != GEL_MATRIX_NODE) {
gel_errorout (_("Bad type for 'for in' loop!"));
iter_pop_stack(ctx);
return;
}
- if(from->type == MATRIX_NODE) {
+ if(from->type == GEL_MATRIX_NODE) {
evfi = evfi_new (type, from->mat.matrix,
gel_copynode (body), body, ident->id.id);
d_addfunc(d_makevfunc(ident->id.id,
@@ -5042,7 +5042,7 @@
EDEBUG(" IF FALSE RETURN NULL");
/*just return NULL*/
freetree_full(n,TRUE,FALSE);
- n->type = NULL_NODE;
+ n->type = GEL_NULL_NODE;
iter_pop_stack(ctx);
}
}
@@ -5054,7 +5054,7 @@
structtype *e = data; \
if(cont) { \
freetree_full(e->body,TRUE,FALSE); \
- e->body->type = NULL_NODE; \
+ e->body->type = GEL_NULL_NODE; \
GE_PUSH_STACK(ctx,e,pushflag); \
/*we have already killed the body, so \
this will continue as if the body \
@@ -5077,7 +5077,7 @@
} else { \
/*null the tree*/ \
freetree_full(n,TRUE,FALSE); \
- n->type = NULL_NODE; \
+ n->type = GEL_NULL_NODE; \
} \
\
/*go on with the computation*/ \
@@ -5116,7 +5116,7 @@
gel_freetree (data);
} else {
freetree_full(data,TRUE,FALSE);
- ((GelETree *)data)->type = NULL_NODE;
+ ((GelETree *)data)->type = GEL_NULL_NODE;
}
iter_pop_stack(ctx);
@@ -5141,7 +5141,7 @@
ctx->post = FALSE;
ctx->whackarg = FALSE;
freetree_full(ctx->res,TRUE,FALSE);
- ctx->res->type = NULL_NODE;
+ ctx->res->type = GEL_NULL_NODE;
}
#undef LOOP_BREAK_CONT
@@ -5193,7 +5193,7 @@
iter_get_ui_index (GelETree *num)
{
long i;
- if G_UNLIKELY (num->type != VALUE_NODE ||
+ if G_UNLIKELY (num->type != GEL_VALUE_NODE ||
!mpw_is_integer(num->val.value)) {
gel_errorout (_("Wrong argument type as matrix index"));
return -1;
@@ -5238,7 +5238,7 @@
return reg;
}
-/* assumes index->type == VALUE_NODE */
+/* assumes index->type == GEL_VALUE_NODE */
static inline int
iter_get_matrix_index_num (GelETree *index, int maxsize)
{
@@ -5255,14 +5255,14 @@
static gboolean
iter_get_index_region (GelETree *index, int maxsize, int **reg, int *l)
{
- if (index->type == VALUE_NODE) {
+ if (index->type == GEL_VALUE_NODE) {
int i = iter_get_matrix_index_num (index, maxsize);
if (i < 0)
return FALSE;
*reg = g_new (int, 1);
(*reg)[0] = i;
*l = 1;
- } else /* MATRIX_NODE */ {
+ } else /* GEL_MATRIX_NODE */ {
*reg = iter_get_matrix_index_vector (index, maxsize, l);
if (*reg == NULL)
return FALSE;
@@ -5289,7 +5289,7 @@
{
GelMatrixW *mat = NULL;
- if(m->type == IDENTIFIER_NODE) {
+ if(m->type == GEL_IDENTIFIER_NODE) {
GelEFunc *f;
if G_UNLIKELY (d_curcontext()==0 &&
m->id.id->protected_) {
@@ -5301,7 +5301,7 @@
if(!f) {
GelETree *t;
GEL_GET_NEW_NODE(t);
- t->type = MATRIX_NODE;
+ t->type = GEL_MATRIX_NODE;
t->mat.matrix = gel_matrixw_new();
t->mat.quoted = FALSE;
gel_matrixw_set_size(t->mat.matrix,1,1);
@@ -5315,10 +5315,10 @@
return NULL;
}
D_ENSURE_USER_BODY (f);
- if(f->data.user->type != MATRIX_NODE) {
+ if(f->data.user->type != GEL_MATRIX_NODE) {
GelETree *t;
GEL_GET_NEW_NODE(t);
- t->type = MATRIX_NODE;
+ t->type = GEL_MATRIX_NODE;
t->mat.matrix = gel_matrixw_new();
t->mat.quoted = FALSE;
gel_matrixw_set_size(t->mat.matrix,1,1);
@@ -5327,13 +5327,13 @@
if(new_matrix) *new_matrix = TRUE;
}
mat = f->data.user->mat.matrix;
- } else if(m->type == OPERATOR_NODE ||
- m->op.oper == E_DEREFERENCE) {
+ } else if(m->type == GEL_OPERATOR_NODE ||
+ m->op.oper == GEL_E_DEREFERENCE) {
GelETree *l;
GelEFunc *f;
GEL_GET_L(m,l);
- if G_UNLIKELY (l->type != IDENTIFIER_NODE) {
+ if G_UNLIKELY (l->type != GEL_IDENTIFIER_NODE) {
gel_errorout (_("Dereference of non-identifier!"));
return NULL;
}
@@ -5360,10 +5360,10 @@
return NULL;
}
D_ENSURE_USER_BODY (f->data.ref);
- if(f->data.ref->data.user->type != MATRIX_NODE) {
+ if(f->data.ref->data.user->type != GEL_MATRIX_NODE) {
GelETree *t;
GEL_GET_NEW_NODE(t);
- t->type = MATRIX_NODE;
+ t->type = GEL_MATRIX_NODE;
t->mat.matrix = gel_matrixw_new();
t->mat.quoted = FALSE;
gel_matrixw_set_size(t->mat.matrix,1,1);
@@ -5405,17 +5405,17 @@
GEL_GET_LR(n,l,r);
- if G_UNLIKELY (l->type != IDENTIFIER_NODE &&
- !(l->type == OPERATOR_NODE && l->op.oper == E_GET_VELEMENT) &&
- !(l->type == OPERATOR_NODE && l->op.oper == E_GET_ELEMENT) &&
- !(l->type == OPERATOR_NODE && l->op.oper == E_GET_COL_REGION) &&
- !(l->type == OPERATOR_NODE && l->op.oper == E_GET_ROW_REGION) &&
- !(l->type == OPERATOR_NODE && l->op.oper == E_DEREFERENCE)) {
+ if G_UNLIKELY (l->type != GEL_IDENTIFIER_NODE &&
+ !(l->type == GEL_OPERATOR_NODE && l->op.oper == GEL_E_GET_VELEMENT) &&
+ !(l->type == GEL_OPERATOR_NODE && l->op.oper == GEL_E_GET_ELEMENT) &&
+ !(l->type == GEL_OPERATOR_NODE && l->op.oper == GEL_E_GET_COL_REGION) &&
+ !(l->type == GEL_OPERATOR_NODE && l->op.oper == GEL_E_GET_ROW_REGION) &&
+ !(l->type == GEL_OPERATOR_NODE && l->op.oper == GEL_E_DEREFERENCE)) {
gel_errorout (_("Lvalue not an identifier/dereference/matrix location!"));
return;
}
- if(l->type == IDENTIFIER_NODE) {
+ if(l->type == GEL_IDENTIFIER_NODE) {
if G_UNLIKELY (d_curcontext() == 0 &&
l->id.id->protected_) {
gel_errorout (_("Trying to set a protected id '%s'"),
@@ -5427,12 +5427,12 @@
if (ret != NULL)
replacenode (n, ret);
return;
- } else if(r->type == FUNCTION_NODE) {
+ } else if(r->type == GEL_FUNCTION_NODE) {
d_addfunc (d_makerealfunc (r->func.func,
l->id.id,
FALSE));
- } else if(r->type == OPERATOR_NODE &&
- r->op.oper == E_REFERENCE) {
+ } else if(r->type == GEL_OPERATOR_NODE &&
+ r->op.oper == GEL_E_REFERENCE) {
GelETree *t = r->op.args;
GelEFunc *rf = d_lookup_global(t->id.id);
if G_UNLIKELY (rf == NULL) {
@@ -5443,12 +5443,12 @@
} else {
d_addfunc(d_makevfunc(l->id.id,gel_copynode(r)));
}
- } else if(l->op.oper == E_DEREFERENCE) {
+ } else if(l->op.oper == GEL_E_DEREFERENCE) {
GelEFunc *f;
GelETree *ll;
GEL_GET_L(l,ll);
- if G_UNLIKELY (ll->type != IDENTIFIER_NODE) {
+ if G_UNLIKELY (ll->type != GEL_IDENTIFIER_NODE) {
gel_errorout (_("Dereference of non-identifier!"));
return;
}
@@ -5470,10 +5470,10 @@
return;
}
- if(r->type == FUNCTION_NODE) {
+ if(r->type == GEL_FUNCTION_NODE) {
d_setrealfunc(f->data.ref,r->func.func,FALSE);
- } else if(r->type == OPERATOR_NODE &&
- r->op.oper == E_REFERENCE) {
+ } else if(r->type == GEL_OPERATOR_NODE &&
+ r->op.oper == GEL_E_REFERENCE) {
GelETree *t = r->op.args;
GelEFunc *rf = d_lookup_global(t->id.id);
if G_UNLIKELY (rf == NULL) {
@@ -5484,13 +5484,13 @@
} else {
d_set_value(f->data.ref,gel_copynode(r));
}
- } else if(l->op.oper == E_GET_ELEMENT) {
+ } else if(l->op.oper == GEL_E_GET_ELEMENT) {
GelMatrixW *mat;
GelETree *m, *index1, *index2;
GEL_GET_LRR (l, m, index1, index2);
- if (index1->type == VALUE_NODE &&
- index2->type == VALUE_NODE) {
+ if (index1->type == GEL_VALUE_NODE &&
+ index2->type == GEL_VALUE_NODE) {
int x, y;
x = iter_get_matrix_index_num (index2, INT_MAX);
@@ -5505,10 +5505,10 @@
return;
gel_matrixw_set_element (mat, x, y, gel_copynode (r));
- } else if ((index1->type == VALUE_NODE ||
- index1->type == MATRIX_NODE) &&
- (index2->type == VALUE_NODE ||
- index2->type == MATRIX_NODE)) {
+ } else if ((index1->type == GEL_VALUE_NODE ||
+ index1->type == GEL_MATRIX_NODE) &&
+ (index2->type == GEL_VALUE_NODE ||
+ index2->type == GEL_MATRIX_NODE)) {
int *regx, *regy;
int lx, ly;
@@ -5518,7 +5518,7 @@
&ly, &lx))
return;
- if G_UNLIKELY (r->type == MATRIX_NODE &&
+ if G_UNLIKELY (r->type == GEL_MATRIX_NODE &&
(gel_matrixw_width (r->mat.matrix) != lx ||
gel_matrixw_height (r->mat.matrix) != ly)) {
g_free (regx);
@@ -5534,7 +5534,7 @@
return;
}
- if (r->type == MATRIX_NODE)
+ if (r->type == GEL_MATRIX_NODE)
gel_matrixw_set_region (mat, r->mat.matrix, regx, regy, lx, ly);
else
gel_matrixw_set_region_etree (mat, r, regx, regy, lx, ly);
@@ -5544,12 +5544,12 @@
gel_errorout (_("Matrix index not an integer or a vector"));
return;
}
- } else if(l->op.oper == E_GET_VELEMENT) {
+ } else if(l->op.oper == GEL_E_GET_VELEMENT) {
GelMatrixW *mat;
GelETree *m, *index;
GEL_GET_LR (l, m, index);
- if (index->type == VALUE_NODE) {
+ if (index->type == GEL_VALUE_NODE) {
int i;
i = iter_get_matrix_index_num (index, INT_MAX);
@@ -5561,7 +5561,7 @@
return;
gel_matrixw_set_velement (mat, i, gel_copynode (r));
- } else if (index->type == MATRIX_NODE) {
+ } else if (index->type == GEL_MATRIX_NODE) {
int *reg;
int len;
@@ -5575,7 +5575,7 @@
return;
}
- if (r->type == MATRIX_NODE)
+ if (r->type == GEL_MATRIX_NODE)
gel_matrixw_set_vregion (mat, r->mat.matrix, reg, len);
else
gel_matrixw_set_vregion_etree (mat, r, reg, len);
@@ -5584,21 +5584,21 @@
gel_errorout (_("Matrix index not an integer or a vector"));
return;
}
- } else /*l->data.oper == E_GET_COL_REGION E_GET_ROW_REGION*/ {
+ } else /*l->data.oper == GEL_E_GET_COL_REGION GEL_E_GET_ROW_REGION*/ {
GelMatrixW *mat;
GelETree *m, *index;
GEL_GET_LR (l, m, index);
- if (index->type == VALUE_NODE ||
- index->type == MATRIX_NODE) {
+ if (index->type == GEL_VALUE_NODE ||
+ index->type == GEL_MATRIX_NODE) {
int *regx, *regy;
int lx, ly;
int i;
- if (l->op.oper == E_GET_COL_REGION) {
+ if (l->op.oper == GEL_E_GET_COL_REGION) {
if ( ! iter_get_index_region (index, INT_MAX, ®x, &lx))
return;
- if G_UNLIKELY (r->type == MATRIX_NODE &&
+ if G_UNLIKELY (r->type == GEL_MATRIX_NODE &&
gel_matrixw_width (r->mat.matrix) != lx) {
g_free (regx);
gel_errorout (_("Wrong matrix dimensions when setting"));
@@ -5607,7 +5607,7 @@
} else {
if ( ! iter_get_index_region (index, INT_MAX, ®y, &ly))
return;
- if G_UNLIKELY (r->type == MATRIX_NODE &&
+ if G_UNLIKELY (r->type == GEL_MATRIX_NODE &&
gel_matrixw_height (r->mat.matrix) != ly) {
g_free (regy);
gel_errorout (_("Wrong matrix dimensions when setting"));
@@ -5622,9 +5622,9 @@
return;
}
- if (l->op.oper == E_GET_COL_REGION) {
+ if (l->op.oper == GEL_E_GET_COL_REGION) {
ly = gel_matrixw_height (mat);
- if (r->type == MATRIX_NODE &&
+ if (r->type == GEL_MATRIX_NODE &&
ly < gel_matrixw_height (r->mat.matrix))
ly = gel_matrixw_height (r->mat.matrix);
regy = g_new (int, ly);
@@ -5632,7 +5632,7 @@
regy[i] = i;
} else {
lx = gel_matrixw_width (mat);
- if (r->type == MATRIX_NODE &&
+ if (r->type == GEL_MATRIX_NODE &&
lx < gel_matrixw_width (r->mat.matrix))
lx = gel_matrixw_width (r->mat.matrix);
regx = g_new (int, lx);
@@ -5640,7 +5640,7 @@
regx[i] = i;
}
- if (r->type == MATRIX_NODE)
+ if (r->type == GEL_MATRIX_NODE)
gel_matrixw_set_region (mat, r->mat.matrix, regx, regy, lx, ly);
else
gel_matrixw_set_region_etree (mat, r, regx, regy, lx, ly);
@@ -5665,7 +5665,7 @@
/* FIXME: l should be the set func */
- g_assert (r->type == IDENTIFIER_NODE);
+ g_assert (r->type == GEL_IDENTIFIER_NODE);
if G_UNLIKELY (d_curcontext() != 0) {
gel_errorout (_("Parameters can only be created in the global context"));
@@ -5687,7 +5687,7 @@
GEL_GET_L(n,l);
- if (l->op.oper == E_GET_ELEMENT) {
+ if (l->op.oper == GEL_E_GET_ELEMENT) {
GelETree *ll,*rr;
GEL_GET_LRR(l,ident,ll,rr);
@@ -5697,9 +5697,9 @@
ctx->post = FALSE;
ctx->current = ll;
ctx->whackarg = FALSE;
- } else if(l->op.oper == E_GET_VELEMENT ||
- l->op.oper == E_GET_COL_REGION ||
- l->op.oper == E_GET_ROW_REGION) {
+ } else if(l->op.oper == GEL_E_GET_VELEMENT ||
+ l->op.oper == GEL_E_GET_COL_REGION ||
+ l->op.oper == GEL_E_GET_ROW_REGION) {
GelETree *ll;
GEL_GET_LR(l,ident,ll);
@@ -5723,19 +5723,19 @@
GEL_GET_LR (n, m, index);
- if G_UNLIKELY (m->type != MATRIX_NODE) {
+ if G_UNLIKELY (m->type != GEL_MATRIX_NODE) {
gel_errorout (_("Index works only on matricies"));
return;
}
- if (index->type == VALUE_NODE) {
+ if (index->type == GEL_VALUE_NODE) {
GelETree *t;
int i = iter_get_matrix_index_num (index, gel_matrixw_elements (m->mat.matrix));
if (i < 0)
return;
t = gel_copynode (gel_matrixw_vindex (m->mat.matrix, i));
replacenode (n, t);
- } else if (index->type == MATRIX_NODE) {
+ } else if (index->type == GEL_MATRIX_NODE) {
GelMatrixW *vec;
int matsize = gel_matrixw_elements (m->mat.matrix);
gboolean quoted = m->mat.quoted;
@@ -5750,10 +5750,10 @@
g_free (reg);
freetree_full (n, TRUE /* freeargs */, FALSE /* kill */);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = vec;
n->mat.quoted = quoted;
- } else if (index->type == NULL_NODE) {
+ } else if (index->type == GEL_NULL_NODE) {
freetree_full (n, TRUE, FALSE);
gel_makenum_null_from (n);
} else {
@@ -5768,19 +5768,19 @@
GEL_GET_LRR (n, m, index1, index2);
- if G_UNLIKELY (m->type != MATRIX_NODE) {
+ if G_UNLIKELY (m->type != GEL_MATRIX_NODE) {
gel_errorout (_("Index works only on matricies"));
return;
- } else if G_UNLIKELY (index1->type != NULL_NODE &&
- index1->type != MATRIX_NODE &&
- index1->type != VALUE_NODE &&
- index2->type != NULL_NODE &&
- index2->type != MATRIX_NODE &&
- index2->type != VALUE_NODE) {
+ } else if G_UNLIKELY (index1->type != GEL_NULL_NODE &&
+ index1->type != GEL_MATRIX_NODE &&
+ index1->type != GEL_VALUE_NODE &&
+ index2->type != GEL_NULL_NODE &&
+ index2->type != GEL_MATRIX_NODE &&
+ index2->type != GEL_VALUE_NODE) {
gel_errorout (_("Matrix index not an integer or a vector"));
return;
- } else if G_UNLIKELY (index1->type == NULL_NODE ||
- index2->type == NULL_NODE) {
+ } else if G_UNLIKELY (index1->type == GEL_NULL_NODE ||
+ index2->type == GEL_NULL_NODE) {
/* This is rather unlikely, most of the time we don't
* want NULLs */
freetree_full (n, TRUE, FALSE);
@@ -5789,8 +5789,8 @@
/* this is where we get to the real code */
- } else if (index1->type == VALUE_NODE &&
- index2->type == VALUE_NODE) {
+ } else if (index1->type == GEL_VALUE_NODE &&
+ index2->type == GEL_VALUE_NODE) {
int x, y;
GelETree *t;
@@ -5821,10 +5821,10 @@
gel_freetree (index1);
gel_freetree (index2);
/* Now at least one is a matrix and the other is a value */
- /*} else if ((index1->type == VALUE_NODE ||
- index1->type == MATRIX_NODE) &&
- (index2->type == VALUE_NODE ||
- index2->type == MATRIX_NODE)) {*/
+ /*} else if ((index1->type == GEL_VALUE_NODE ||
+ index1->type == GEL_MATRIX_NODE) &&
+ (index2->type == GEL_VALUE_NODE ||
+ index2->type == GEL_MATRIX_NODE)) {*/
} else {
GelMatrixW *mat;
int *regx, *regy;
@@ -5846,7 +5846,7 @@
g_free (regy);
freetree_full (n, TRUE /* freeargs */, FALSE /* kill */);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = mat;
n->mat.quoted = quoted;
}
@@ -5859,11 +5859,11 @@
GEL_GET_LR (n, m, index);
- if G_UNLIKELY (m->type != MATRIX_NODE) {
+ if G_UNLIKELY (m->type != GEL_MATRIX_NODE) {
gel_errorout (_("Index works only on matricies"));
return;
- } else if G_LIKELY (index->type == VALUE_NODE ||
- index->type == MATRIX_NODE) {
+ } else if G_LIKELY (index->type == GEL_VALUE_NODE ||
+ index->type == GEL_MATRIX_NODE) {
GelMatrixW *mat;
int *regx, *regy;
int lx, ly;
@@ -5895,10 +5895,10 @@
g_free (regy);
freetree_full (n, TRUE /* freeargs */, FALSE /* kill */);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = mat;
n->mat.quoted = quoted;
- } else if (index->type == NULL_NODE) {
+ } else if (index->type == GEL_NULL_NODE) {
freetree_full (n, TRUE, FALSE);
gel_makenum_null_from (n);
} else {
@@ -5910,13 +5910,13 @@
iter_get_arg(GelETree *n)
{
switch(n->type) {
- case VALUE_NODE: return GO_VALUE;
- case MATRIX_NODE: return GO_MATRIX;
- case STRING_NODE: return GO_STRING;
- case FUNCTION_NODE: return GO_FUNCTION;
- case IDENTIFIER_NODE: return GO_IDENTIFIER;
- case POLYNOMIAL_NODE: return GO_POLYNOMIAL;
- case BOOL_NODE: return GO_BOOL;
+ case GEL_VALUE_NODE: return GO_VALUE;
+ case GEL_MATRIX_NODE: return GO_MATRIX;
+ case GEL_STRING_NODE: return GO_STRING;
+ case GEL_FUNCTION_NODE: return GO_FUNCTION;
+ case GEL_IDENTIFIER_NODE: return GO_IDENTIFIER;
+ case GEL_POLYNOMIAL_NODE: return GO_POLYNOMIAL;
+ case GEL_BOOL_NODE: return GO_BOOL;
default: return 0;
}
}
@@ -5946,33 +5946,33 @@
name = NULL;
switch(oper) {
- case E_SEPAR:
- case E_EQUALS:
- case E_DEFEQUALS:
- case E_PARAMETER: break;
- case E_ABS: name = g_strdup(_("Absolute value")); break;
- case E_PLUS: name = g_strdup(_("Addition")); break;
- case E_ELTPLUS: name = g_strdup(_("Element by element addition")); break;
- case E_MINUS: name = g_strdup(_("Subtraction")); break;
- case E_ELTMINUS: name = g_strdup(_("Element by element subtraction")); break;
- case E_MUL: name = g_strdup(_("Multiplication")); break;
- case E_ELTMUL: name = g_strdup(_("Element by element multiplication")); break;
- case E_DIV: name = g_strdup(_("Division")); break;
- case E_ELTDIV: name = g_strdup(_("Element by element division")); break;
- case E_BACK_DIV: name = g_strdup(_("Back division")); break;
- case E_ELT_BACK_DIV: name = g_strdup(_("Element by element back division")); break;
- case E_MOD: name = g_strdup(_("Modulo")); break;
- case E_ELTMOD: name = g_strdup(_("Element by element modulo")); break;
- case E_NEG: name = g_strdup(_("Negation")); break;
- case E_EXP: name = g_strdup(_("Power")); break;
- case E_ELTEXP: name = g_strdup(_("Element by element power")); break;
- case E_FACT: name = g_strdup(_("Factorial")); break;
- case E_DBLFACT: name = g_strdup(_("Double factorial")); break;
- case E_TRANSPOSE: name = g_strdup(_("Transpose")); break;
- case E_CONJUGATE_TRANSPOSE: name = g_strdup(_("ConjugateTranspose")); break;
- case E_CMP_CMP: name = g_strdup(_("Comparison (<=>)")); break;
- case E_LOGICAL_XOR: name = g_strdup(_("XOR")); break;
- case E_LOGICAL_NOT: name = g_strdup(_("NOT")); break;
+ case GEL_E_SEPAR:
+ case GEL_E_EQUALS:
+ case GEL_E_DEFEQUALS:
+ case GEL_E_PARAMETER: break;
+ case GEL_E_ABS: name = g_strdup(_("Absolute value")); break;
+ case GEL_E_PLUS: name = g_strdup(_("Addition")); break;
+ case GEL_E_ELTPLUS: name = g_strdup(_("Element by element addition")); break;
+ case GEL_E_MINUS: name = g_strdup(_("Subtraction")); break;
+ case GEL_E_ELTMINUS: name = g_strdup(_("Element by element subtraction")); break;
+ case GEL_E_MUL: name = g_strdup(_("Multiplication")); break;
+ case GEL_E_ELTMUL: name = g_strdup(_("Element by element multiplication")); break;
+ case GEL_E_DIV: name = g_strdup(_("Division")); break;
+ case GEL_E_ELTDIV: name = g_strdup(_("Element by element division")); break;
+ case GEL_E_BACK_DIV: name = g_strdup(_("Back division")); break;
+ case GEL_E_ELT_BACK_DIV: name = g_strdup(_("Element by element back division")); break;
+ case GEL_E_MOD: name = g_strdup(_("Modulo")); break;
+ case GEL_E_ELTMOD: name = g_strdup(_("Element by element modulo")); break;
+ case GEL_E_NEG: name = g_strdup(_("Negation")); break;
+ case GEL_E_EXP: name = g_strdup(_("Power")); break;
+ case GEL_E_ELTEXP: name = g_strdup(_("Element by element power")); break;
+ case GEL_E_FACT: name = g_strdup(_("Factorial")); break;
+ case GEL_E_DBLFACT: name = g_strdup(_("Double factorial")); break;
+ case GEL_E_TRANSPOSE: name = g_strdup(_("Transpose")); break;
+ case GEL_E_CONJUGATE_TRANSPOSE: name = g_strdup(_("ConjugateTranspose")); break;
+ case GEL_E_CMP_CMP: name = g_strdup(_("Comparison (<=>)")); break;
+ case GEL_E_LOGICAL_XOR: name = g_strdup(_("XOR")); break;
+ case GEL_E_LOGICAL_NOT: name = g_strdup(_("NOT")); break;
default: break;
}
@@ -6046,11 +6046,11 @@
GelMatrix *mat;
int bysgn = 1, cmp, initcmp, count, i;
mpw_t tmp;
- if (n->op.oper == E_REGION_SEP_BY) {
+ if (n->op.oper == GEL_E_REGION_SEP_BY) {
GEL_GET_LRR (n, from, by, to);
- if G_UNLIKELY (from->type != VALUE_NODE ||
- to->type != VALUE_NODE ||
- by->type != VALUE_NODE) {
+ if G_UNLIKELY (from->type != GEL_VALUE_NODE ||
+ to->type != GEL_VALUE_NODE ||
+ by->type != GEL_VALUE_NODE) {
gel_errorout (_("Vector building only works on numbers"));
return;
}
@@ -6066,8 +6066,8 @@
}
} else {
GEL_GET_LR (n, from, to);
- if G_UNLIKELY (from->type != VALUE_NODE ||
- to->type != VALUE_NODE) {
+ if G_UNLIKELY (from->type != GEL_VALUE_NODE ||
+ to->type != GEL_VALUE_NODE) {
gel_errorout (_("Vector building only works on numbers"));
return;
}
@@ -6113,7 +6113,7 @@
}
freetree_full (n, TRUE /* freeargs */, FALSE /* kill */);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix (mat);
n->mat.quoted = TRUE;
}
@@ -6128,8 +6128,8 @@
EDEBUG(" OPERATOR PRE");
switch(n->op.oper) {
- case E_EQUALS:
- case E_DEFEQUALS:
+ case GEL_E_EQUALS:
+ case GEL_E_DEFEQUALS:
EDEBUG(" EQUALS PRE");
GE_PUSH_STACK (ctx, n,
GE_ADDWHACKARG (GE_POST,
@@ -6137,7 +6137,7 @@
iter_push_indexes_and_arg(ctx,n);
break;
- case E_PARAMETER:
+ case GEL_E_PARAMETER:
EDEBUG(" PARAMETER PRE");
GE_PUSH_STACK (ctx, n,
GE_ADDWHACKARG (GE_POST,
@@ -6148,8 +6148,8 @@
ctx->whackarg = FALSE;
break;
- case E_EXP:
- case E_ELTEXP:
+ case GEL_E_EXP:
+ case GEL_E_ELTEXP:
EDEBUG(" PUSH US AS POST AND ALL ARGUMENTS AS PRE (no modulo on second)");
GE_PUSH_STACK (ctx, n,
GE_ADDWHACKARG (GE_POST,
@@ -6157,7 +6157,7 @@
iter_push_two_args_no_modulo_on_2 (ctx, n->op.args);
break;
- case E_SEPAR:
+ case GEL_E_SEPAR:
EDEBUG(" PUSH US AS POST AND ALL ARGUMENTS AS PRE WITH "
" WHACKARGS");
GE_PUSH_STACK (ctx, n,
@@ -6166,34 +6166,34 @@
n->op.args = iter_push_args_whack (ctx, n->op.args, n->op.nargs);
break;
- case E_ABS:
- case E_PLUS:
- case E_ELTPLUS:
- case E_MINUS:
- case E_ELTMINUS:
- case E_MUL:
- case E_ELTMUL:
- case E_DIV:
- case E_ELTDIV:
- case E_BACK_DIV:
- case E_ELT_BACK_DIV:
- case E_MOD:
- case E_ELTMOD:
- case E_NEG:
- case E_FACT:
- case E_DBLFACT:
- case E_TRANSPOSE:
- case E_CONJUGATE_TRANSPOSE:
- case E_CMP_CMP:
- case E_LOGICAL_XOR:
- case E_LOGICAL_NOT:
- case E_RETURN:
- case E_GET_VELEMENT:
- case E_GET_ELEMENT:
- case E_GET_ROW_REGION:
- case E_GET_COL_REGION:
- case E_REGION_SEP:
- case E_REGION_SEP_BY:
+ case GEL_E_ABS:
+ case GEL_E_PLUS:
+ case GEL_E_ELTPLUS:
+ case GEL_E_MINUS:
+ case GEL_E_ELTMINUS:
+ case GEL_E_MUL:
+ case GEL_E_ELTMUL:
+ case GEL_E_DIV:
+ case GEL_E_ELTDIV:
+ case GEL_E_BACK_DIV:
+ case GEL_E_ELT_BACK_DIV:
+ case GEL_E_MOD:
+ case GEL_E_ELTMOD:
+ case GEL_E_NEG:
+ case GEL_E_FACT:
+ case GEL_E_DBLFACT:
+ case GEL_E_TRANSPOSE:
+ case GEL_E_CONJUGATE_TRANSPOSE:
+ case GEL_E_CMP_CMP:
+ case GEL_E_LOGICAL_XOR:
+ case GEL_E_LOGICAL_NOT:
+ case GEL_E_RETURN:
+ case GEL_E_GET_VELEMENT:
+ case GEL_E_GET_ELEMENT:
+ case GEL_E_GET_ROW_REGION:
+ case GEL_E_GET_COL_REGION:
+ case GEL_E_REGION_SEP:
+ case GEL_E_REGION_SEP_BY:
EDEBUG(" PUSH US AS POST AND ALL ARGUMENTS AS PRE");
GE_PUSH_STACK (ctx, n,
GE_ADDWHACKARG (GE_POST,
@@ -6201,9 +6201,9 @@
iter_push_args (ctx, n->op.args, n->op.nargs);
break;
- case E_CALL:
+ case GEL_E_CALL:
EDEBUG(" CHANGE CALL TO DIRECTCALL AND EVAL THE FIRST ARGUMENT");
- n->op.oper = E_DIRECTCALL;
+ n->op.oper = GEL_E_DIRECTCALL;
GE_PUSH_STACK (ctx, n,
GE_ADDWHACKARG (GE_PRE,
ctx->whackarg));
@@ -6214,7 +6214,7 @@
break;
/*in case of DIRECTCALL we don't evaluate the first argument*/
- case E_DIRECTCALL:
+ case GEL_E_DIRECTCALL:
/*if there are arguments to evaluate*/
if(n->op.args->any.next) {
GelEFunc *f;
@@ -6238,16 +6238,16 @@
}
break;
- /*these should have been translated to COMPARE_NODEs*/
- case E_EQ_CMP:
- case E_NE_CMP:
- case E_LT_CMP:
- case E_GT_CMP:
- case E_LE_CMP:
- case E_GE_CMP:
+ /*these should have been translated to GEL_COMPARE_NODEs*/
+ case GEL_E_EQ_CMP:
+ case GEL_E_NE_CMP:
+ case GEL_E_LT_CMP:
+ case GEL_E_GT_CMP:
+ case GEL_E_LE_CMP:
+ case GEL_E_GE_CMP:
g_assert_not_reached();
- case E_LOGICAL_AND:
+ case GEL_E_LOGICAL_AND:
EDEBUG(" LOGICAL AND");
GE_PUSH_STACK (ctx, n,
GE_ADDWHACKARG (GE_POST, ctx->whackarg));
@@ -6256,7 +6256,7 @@
ctx->current = n->op.args;
ctx->whackarg = FALSE;
break;
- case E_LOGICAL_OR:
+ case GEL_E_LOGICAL_OR:
EDEBUG(" LOGICAL OR");
GE_PUSH_STACK (ctx, n,
GE_ADDWHACKARG (GE_POST, ctx->whackarg));
@@ -6266,21 +6266,21 @@
ctx->whackarg = FALSE;
break;
- case E_WHILE_CONS:
+ case GEL_E_WHILE_CONS:
iter_loop(ctx,n,FALSE,TRUE);
break;
- case E_UNTIL_CONS:
+ case GEL_E_UNTIL_CONS:
iter_loop(ctx,n,FALSE,FALSE);
break;
- case E_DOWHILE_CONS:
+ case GEL_E_DOWHILE_CONS:
iter_loop(ctx,n,TRUE,TRUE);
break;
- case E_DOUNTIL_CONS:
+ case GEL_E_DOUNTIL_CONS:
iter_loop(ctx,n,TRUE,FALSE);
break;
- case E_IF_CONS:
- case E_IFELSE_CONS:
+ case GEL_E_IF_CONS:
+ case GEL_E_IFELSE_CONS:
EDEBUG(" IF/IFELSE PRE");
GE_PUSH_STACK (ctx, n,
GE_ADDWHACKARG (GE_POST, ctx->whackarg));
@@ -6289,35 +6289,35 @@
ctx->whackarg = FALSE;
break;
- case E_DEREFERENCE:
+ case GEL_E_DEREFERENCE:
if(!iter_derefvarop(ctx,n))
return FALSE;
if (ctx->whackarg) {
ctx->current = NULL;
gel_freetree (n);
} else {
- if ((n->type == VALUE_NODE ||
- n->type == MATRIX_NODE) &&
+ if ((n->type == GEL_VALUE_NODE ||
+ n->type == GEL_MATRIX_NODE) &&
ctx->modulo != NULL)
mod_node (n, ctx->modulo);
}
iter_pop_stack(ctx);
break;
- case E_FOR_CONS:
- case E_FORBY_CONS:
- case E_SUM_CONS:
- case E_SUMBY_CONS:
- case E_PROD_CONS:
- case E_PRODBY_CONS:
+ case GEL_E_FOR_CONS:
+ case GEL_E_FORBY_CONS:
+ case GEL_E_SUM_CONS:
+ case GEL_E_SUMBY_CONS:
+ case GEL_E_PROD_CONS:
+ case GEL_E_PRODBY_CONS:
GE_PUSH_STACK (ctx, n,
GE_ADDWHACKARG (GE_POST, ctx->whackarg));
iter_push_args (ctx, n->op.args->any.next, n->op.nargs - 2);
break;
- case E_FORIN_CONS:
- case E_SUMIN_CONS:
- case E_PRODIN_CONS:
+ case GEL_E_FORIN_CONS:
+ case GEL_E_SUMIN_CONS:
+ case GEL_E_PRODIN_CONS:
GE_PUSH_STACK (ctx, n,
GE_ADDWHACKARG (GE_POST, ctx->whackarg));
ctx->current = n->op.args->any.next;
@@ -6325,14 +6325,14 @@
ctx->whackarg = FALSE;
break;
- case E_EXCEPTION:
+ case GEL_E_EXCEPTION:
if (ctx->whackarg) {
ctx->current = NULL;
gel_freetree (n);
}
return FALSE;
- case E_BAILOUT:
+ case GEL_E_BAILOUT:
if (ctx->whackarg) {
ctx->current = NULL;
gel_freetree (n);
@@ -6340,7 +6340,7 @@
iter_bailout_op(ctx);
break;
- case E_CONTINUE:
+ case GEL_E_CONTINUE:
if (ctx->whackarg) {
ctx->current = NULL;
gel_freetree (n);
@@ -6348,7 +6348,7 @@
iter_continue_break_op(ctx,TRUE);
break;
- case E_BREAK:
+ case GEL_E_BREAK:
if (ctx->whackarg) {
ctx->current = NULL;
gel_freetree (n);
@@ -6356,7 +6356,7 @@
iter_continue_break_op(ctx,FALSE);
break;
- case E_QUOTE:
+ case GEL_E_QUOTE:
if (ctx->whackarg) {
ctx->current = NULL;
gel_freetree (n);
@@ -6369,7 +6369,7 @@
iter_pop_stack(ctx);
break;
- case E_REFERENCE:
+ case GEL_E_REFERENCE:
{
GelETree *t;
GelEFunc *rf;
@@ -6391,7 +6391,7 @@
break;
}
- case E_MOD_CALC:
+ case GEL_E_MOD_CALC:
/* Push modulo op, so that we may push the
* first argument once we have gotten a modulo */
GE_PUSH_STACK (ctx, n,
@@ -6420,7 +6420,7 @@
GelETree *r;
EDEBUG(" OPERATOR POST");
switch(n->op.oper) {
- case E_SEPAR:
+ case GEL_E_SEPAR:
/* By now there is only one argument and that
is the last one */
r = n->op.args;
@@ -6429,81 +6429,81 @@
iter_pop_stack (ctx);
break;
- case E_EQUALS:
- case E_DEFEQUALS:
+ case GEL_E_EQUALS:
+ case GEL_E_DEFEQUALS:
EDEBUG(" EQUALS POST");
iter_equalsop(n);
iter_pop_stack(ctx);
break;
- case E_PARAMETER:
+ case GEL_E_PARAMETER:
EDEBUG(" PARAMETER POST");
iter_parameterop (n);
iter_pop_stack (ctx);
break;
- case E_PLUS:
- case E_ELTPLUS:
- case E_MINUS:
- case E_ELTMINUS:
- case E_MUL:
- case E_ELTMUL:
- case E_DIV:
- case E_ELTDIV:
- case E_BACK_DIV:
- case E_ELT_BACK_DIV:
- case E_MOD:
- case E_ELTMOD:
- case E_EXP:
- case E_ELTEXP:
- case E_CMP_CMP:
- case E_LOGICAL_XOR:
+ case GEL_E_PLUS:
+ case GEL_E_ELTPLUS:
+ case GEL_E_MINUS:
+ case GEL_E_ELTMINUS:
+ case GEL_E_MUL:
+ case GEL_E_ELTMUL:
+ case GEL_E_DIV:
+ case GEL_E_ELTDIV:
+ case GEL_E_BACK_DIV:
+ case GEL_E_ELT_BACK_DIV:
+ case GEL_E_MOD:
+ case GEL_E_ELTMOD:
+ case GEL_E_EXP:
+ case GEL_E_ELTEXP:
+ case GEL_E_CMP_CMP:
+ case GEL_E_LOGICAL_XOR:
if(!iter_call2(ctx,&prim_table[n->op.oper],n))
return FALSE;
if (ctx->modulo != NULL &&
- (n->type == VALUE_NODE ||
+ (n->type == GEL_VALUE_NODE ||
/* FIXME: note, most matrix operations already
* mod, so this will just make things slower,
* but currently it is needed for correct
* behaviour */
- n->type == MATRIX_NODE) &&
+ n->type == GEL_MATRIX_NODE) &&
! ctx->whackarg)
mod_node (n, ctx->modulo);
iter_pop_stack(ctx);
break;
- case E_ABS:
- case E_NEG:
- case E_FACT:
- case E_DBLFACT:
- case E_TRANSPOSE:
- case E_CONJUGATE_TRANSPOSE:
- case E_LOGICAL_NOT:
+ case GEL_E_ABS:
+ case GEL_E_NEG:
+ case GEL_E_FACT:
+ case GEL_E_DBLFACT:
+ case GEL_E_TRANSPOSE:
+ case GEL_E_CONJUGATE_TRANSPOSE:
+ case GEL_E_LOGICAL_NOT:
if(!iter_call1(ctx,&prim_table[n->op.oper],n))
return FALSE;
if (ctx->modulo != NULL &&
- (n->type == VALUE_NODE ||
+ (n->type == GEL_VALUE_NODE ||
/* FIXME: note, most matrix operations already
* mod, so this will just make things slower,
* but currently it is needed for correct
* behaviour */
- n->type == MATRIX_NODE) &&
+ n->type == GEL_MATRIX_NODE) &&
! ctx->whackarg)
mod_node (n, ctx->modulo);
iter_pop_stack(ctx);
break;
- case E_MOD_CALC:
+ case GEL_E_MOD_CALC:
/* FIXME: maybe we should always replace things here,
* not just for values and matrices */
- if (n->op.args->type == BOOL_NODE ||
- n->op.args->type == VALUE_NODE ||
- n->op.args->type == MATRIX_NODE ||
- /* also replace if we got a E_MOD_CALC oper since
+ if (n->op.args->type == GEL_BOOL_NODE ||
+ n->op.args->type == GEL_VALUE_NODE ||
+ n->op.args->type == GEL_MATRIX_NODE ||
+ /* also replace if we got a GEL_E_MOD_CALC oper since
* that can only mean an error occured, and we
* don't want to duplicate the mod */
- (n->op.args->type == OPERATOR_NODE &&
- n->op.args->op.oper == E_MOD_CALC)) {
+ (n->op.args->type == GEL_OPERATOR_NODE &&
+ n->op.args->op.oper == GEL_E_MOD_CALC)) {
GelETree *t = n->op.args;
gel_freetree (n->op.args->any.next);
n->op.args = NULL;
@@ -6512,87 +6512,87 @@
iter_pop_stack(ctx);
break;
- case E_FOR_CONS:
- case E_FORBY_CONS:
- case E_SUM_CONS:
- case E_SUMBY_CONS:
- case E_PROD_CONS:
- case E_PRODBY_CONS:
+ case GEL_E_FOR_CONS:
+ case GEL_E_FORBY_CONS:
+ case GEL_E_SUM_CONS:
+ case GEL_E_SUMBY_CONS:
+ case GEL_E_PROD_CONS:
+ case GEL_E_PRODBY_CONS:
iter_forloop (ctx, n, repushed);
break;
- case E_FORIN_CONS:
- case E_SUMIN_CONS:
- case E_PRODIN_CONS:
+ case GEL_E_FORIN_CONS:
+ case GEL_E_SUMIN_CONS:
+ case GEL_E_PRODIN_CONS:
iter_forinloop (ctx, n, repushed);
break;
- case E_GET_VELEMENT:
+ case GEL_E_GET_VELEMENT:
iter_get_velement (n);
iter_pop_stack (ctx);
break;
- case E_GET_ELEMENT:
+ case GEL_E_GET_ELEMENT:
iter_get_element (n);
iter_pop_stack (ctx);
break;
- case E_GET_ROW_REGION:
+ case GEL_E_GET_ROW_REGION:
iter_get_region (n, FALSE /* col */);
iter_pop_stack (ctx);
break;
- case E_GET_COL_REGION:
+ case GEL_E_GET_COL_REGION:
iter_get_region (n, TRUE /* col */);
iter_pop_stack (ctx);
break;
- case E_IF_CONS:
+ case GEL_E_IF_CONS:
iter_ifop (ctx, n, FALSE, repushed);
break;
- case E_IFELSE_CONS:
+ case GEL_E_IFELSE_CONS:
iter_ifop (ctx, n, TRUE, repushed);
break;
- case E_DIRECTCALL:
- case E_CALL:
+ case GEL_E_DIRECTCALL:
+ case GEL_E_CALL:
if ( ! iter_funccallop(ctx, n, repushed))
return FALSE;
break;
- case E_RETURN:
+ case GEL_E_RETURN:
iter_returnop(ctx,n);
break;
- case E_REGION_SEP:
- case E_REGION_SEP_BY:
+ case GEL_E_REGION_SEP:
+ case GEL_E_REGION_SEP_BY:
iter_region_sep_op (ctx, n);
iter_pop_stack (ctx);
break;
- /*these should have been translated to COMPARE_NODEs*/
- case E_EQ_CMP:
- case E_NE_CMP:
- case E_LT_CMP:
- case E_GT_CMP:
- case E_LE_CMP:
- case E_GE_CMP:
+ /*these should have been translated to GEL_COMPARE_NODEs*/
+ case GEL_E_EQ_CMP:
+ case GEL_E_NE_CMP:
+ case GEL_E_LT_CMP:
+ case GEL_E_GT_CMP:
+ case GEL_E_LE_CMP:
+ case GEL_E_GE_CMP:
/*This operators should never reach post, they are evaluated in pre,
or dealt with through the pop_stack_special*/
- case E_QUOTE:
- case E_REFERENCE:
- case E_LOGICAL_AND:
- case E_LOGICAL_OR:
- case E_WHILE_CONS:
- case E_UNTIL_CONS:
- case E_DOWHILE_CONS:
- case E_DOUNTIL_CONS:
- case E_CONTINUE:
- case E_BREAK:
- case E_EXCEPTION:
- case E_BAILOUT:
- case E_DEREFERENCE:
+ case GEL_E_QUOTE:
+ case GEL_E_REFERENCE:
+ case GEL_E_LOGICAL_AND:
+ case GEL_E_LOGICAL_OR:
+ case GEL_E_WHILE_CONS:
+ case GEL_E_UNTIL_CONS:
+ case GEL_E_DOWHILE_CONS:
+ case GEL_E_DOUNTIL_CONS:
+ case GEL_E_CONTINUE:
+ case GEL_E_BREAK:
+ case GEL_E_EXCEPTION:
+ case GEL_E_BAILOUT:
+ case GEL_E_DEREFERENCE:
g_assert_not_reached();
default:
@@ -6625,7 +6625,7 @@
if (n == NULL)
return funclist;
- if (n->type == IDENTIFIER_NODE) {
+ if (n->type == GEL_IDENTIFIER_NODE) {
GelEFunc *func = d_lookup_local (n->id.id);
if (func != NULL &&
! function_id_on_list (funclist, n->id.id)) {
@@ -6633,13 +6633,13 @@
f->context = -1;
funclist = g_slist_prepend (funclist, f);
}
- } else if (n->type == SPACER_NODE) {
+ } else if (n->type == GEL_SPACER_NODE) {
funclist = gel_subst_local_vars (funclist, n->sp.arg);
- } else if(n->type == OPERATOR_NODE) {
+ } else if(n->type == GEL_OPERATOR_NODE) {
/* special case to avoid more work
* than needed */
- if ((n->op.oper == E_EQUALS || n->op.oper == E_DEFEQUALS) &&
- n->op.args->type == IDENTIFIER_NODE) {
+ if ((n->op.oper == GEL_E_EQUALS || n->op.oper == GEL_E_DEFEQUALS) &&
+ n->op.args->type == GEL_IDENTIFIER_NODE) {
funclist = gel_subst_local_vars (funclist, n->op.args->any.next);
} else {
GelETree *args = n->op.args;
@@ -6648,7 +6648,7 @@
args = args->any.next;
}
}
- } else if (n->type == MATRIX_NODE &&
+ } else if (n->type == GEL_MATRIX_NODE &&
n->mat.matrix != NULL &&
! gel_is_matrix_value_only (n->mat.matrix)) {
int i,j;
@@ -6664,11 +6664,11 @@
funclist = gel_subst_local_vars (funclist, t);
}
}
- } else if (n->type == SET_NODE) {
+ } else if (n->type == GEL_SET_NODE) {
GelETree *ali;
for(ali = n->set.items; ali != NULL; ali = ali->any.next)
funclist = gel_subst_local_vars (funclist, ali);
- } else if (n->type == FUNCTION_NODE &&
+ } else if (n->type == GEL_FUNCTION_NODE &&
(n->func.func->type == GEL_USER_FUNC ||
n->func.func->type == GEL_VARIABLE_FUNC)) {
D_ENSURE_USER_BODY (n->func.func);
@@ -6713,12 +6713,12 @@
}
switch(n->type) {
- case NULL_NODE:
+ case GEL_NULL_NODE:
EDEBUG(" NULL NODE");
WHACK_SAVEDN_POP;
break;
- case VALUE_NODE:
+ case GEL_VALUE_NODE:
EDEBUG(" VALUE NODE");
if (ctx->modulo != NULL)
@@ -6726,7 +6726,7 @@
WHACK_SAVEDN_POP;
break;
- case MATRIX_NODE:
+ case GEL_MATRIX_NODE:
EDEBUG(" MATRIX NODE");
if(!ctx->post) {
/*if in pre mode, push elements onto stack*/
@@ -6740,7 +6740,7 @@
WHACK_SAVEDN_POP;
}
break;
- case OPERATOR_NODE:
+ case GEL_OPERATOR_NODE:
EDEBUG(" OPERATOR NODE");
if(!ctx->post) {
if G_UNLIKELY (!iter_operator_pre(ctx)) {
@@ -6775,7 +6775,7 @@
}
}
break;
- case IDENTIFIER_NODE:
+ case GEL_IDENTIFIER_NODE:
EDEBUG(" IDENTIFIER NODE");
if G_UNLIKELY (!iter_variableop(ctx, n)) {
/* WHACKWHACK */
@@ -6783,19 +6783,19 @@
gel_freetree (n);
return FALSE;
}
- if ((n->type == VALUE_NODE ||
- n->type == MATRIX_NODE) &&
+ if ((n->type == GEL_VALUE_NODE ||
+ n->type == GEL_MATRIX_NODE) &&
ctx->modulo != NULL &&
! whack_saved)
mod_node (n, ctx->modulo);
WHACK_SAVEDN_POP;
break;
- case STRING_NODE:
+ case GEL_STRING_NODE:
EDEBUG(" STRING NODE");
WHACK_SAVEDN_POP;
break;
- case FUNCTION_NODE:
+ case GEL_FUNCTION_NODE:
EDEBUG(" FUNCTION NODE");
if (n->func.func != NULL &&
(n->func.func->type == GEL_USER_FUNC ||
@@ -6806,7 +6806,7 @@
WHACK_SAVEDN_POP;
break;
- case COMPARISON_NODE:
+ case GEL_COMPARISON_NODE:
EDEBUG(" COMPARISON NODE");
if(!ctx->post) {
/*if in pre mode, push arguments onto stack*/
@@ -6822,11 +6822,11 @@
WHACK_SAVEDN_POP;
}
break;
- case USERTYPE_NODE:
+ case GEL_USERTYPE_NODE:
EDEBUG(" USERTYPE NODE");
WHACK_SAVEDN_POP;
break;
- case BOOL_NODE:
+ case GEL_BOOL_NODE:
#ifdef EVAL_DEBUG
printf (" BOOL NODE -- %p %s\n", n, n->bool_.bool_ ? "true" : "false");
#endif
@@ -6962,22 +6962,22 @@
ret = n;
next = n->any.next;
- if(n->type == SPACER_NODE) {
+ if(n->type == GEL_SPACER_NODE) {
GelETree *t = n->sp.arg;
freenode(n);
ret = gel_gather_comparisons(t);
- } else if(n->type==OPERATOR_NODE) {
+ } else if(n->type==GEL_OPERATOR_NODE) {
GelETree *nn;
GelETree *ali = NULL;
switch(n->op.oper) {
- case E_EQ_CMP:
- case E_NE_CMP:
- case E_LT_CMP:
- case E_GT_CMP:
- case E_LE_CMP:
- case E_GE_CMP:
+ case GEL_E_EQ_CMP:
+ case GEL_E_NE_CMP:
+ case GEL_E_LT_CMP:
+ case GEL_E_GT_CMP:
+ case GEL_E_LE_CMP:
+ case GEL_E_GE_CMP:
GEL_GET_NEW_NODE(nn);
- nn->type = COMPARISON_NODE;
+ nn->type = GEL_COMPARISON_NODE;
nn->comp.nargs = 0;
nn->comp.args = NULL;
nn->comp.comp = NULL;
@@ -7000,13 +7000,13 @@
freenode(n);
n = t;
- if(n->type != OPERATOR_NODE ||
- (n->op.oper != E_EQ_CMP &&
- n->op.oper != E_NE_CMP &&
- n->op.oper != E_LT_CMP &&
- n->op.oper != E_GT_CMP &&
- n->op.oper != E_LE_CMP &&
- n->op.oper != E_GE_CMP)) {
+ if(n->type != GEL_OPERATOR_NODE ||
+ (n->op.oper != GEL_E_EQ_CMP &&
+ n->op.oper != GEL_E_NE_CMP &&
+ n->op.oper != GEL_E_LT_CMP &&
+ n->op.oper != GEL_E_GT_CMP &&
+ n->op.oper != GEL_E_LE_CMP &&
+ n->op.oper != GEL_E_GE_CMP)) {
ali = ali->any.next =
gel_gather_comparisons(n);
ali->any.next = NULL;
@@ -7024,7 +7024,7 @@
gel_gather_comparisons(ali->any.next);
}
}
- } else if(n->type==MATRIX_NODE) {
+ } else if(n->type==GEL_MATRIX_NODE) {
int i,j;
int w,h;
if(!n->mat.matrix ||
@@ -7043,7 +7043,7 @@
}
}
}
- } else if(n->type==SET_NODE) {
+ } else if(n->type==GEL_SET_NODE) {
GelETree *ali;
if(n->set.items) {
n->set.items = gel_gather_comparisons(n->set.items);
@@ -7051,7 +7051,7 @@
ali->any.next =
gel_gather_comparisons(ali->any.next);
}
- } else if(n->type==FUNCTION_NODE) {
+ } else if(n->type==GEL_FUNCTION_NODE) {
if ((n->func.func->type == GEL_USER_FUNC ||
n->func.func->type == GEL_VARIABLE_FUNC) &&
n->func.func->data.user) {
@@ -7070,25 +7070,25 @@
if (n == NULL)
return;
- if (n->type == SPACER_NODE) {
+ if (n->type == GEL_SPACER_NODE) {
gel_replace_equals (n->sp.arg, in_expression);
- } else if(n->type == OPERATOR_NODE) {
+ } else if(n->type == GEL_OPERATOR_NODE) {
gboolean run_through_args = TRUE;
- if (n->op.oper == E_EQUALS &&
+ if (n->op.oper == GEL_E_EQUALS &&
in_expression) {
- n->op.oper = E_EQ_CMP;
- } else if (n->op.oper == E_WHILE_CONS ||
- n->op.oper == E_UNTIL_CONS ||
- n->op.oper == E_IF_CONS) {
+ n->op.oper = GEL_E_EQ_CMP;
+ } else if (n->op.oper == GEL_E_WHILE_CONS ||
+ n->op.oper == GEL_E_UNTIL_CONS ||
+ n->op.oper == GEL_E_IF_CONS) {
run_through_args = FALSE;
gel_replace_equals (n->op.args, TRUE);
gel_replace_equals (n->op.args->any.next, in_expression);
- } else if (n->op.oper == E_DOWHILE_CONS ||
- n->op.oper == E_DOUNTIL_CONS) {
+ } else if (n->op.oper == GEL_E_DOWHILE_CONS ||
+ n->op.oper == GEL_E_DOUNTIL_CONS) {
run_through_args = FALSE;
gel_replace_equals (n->op.args, in_expression);
gel_replace_equals (n->op.args->any.next, TRUE);
- } else if (n->op.oper == E_IFELSE_CONS) {
+ } else if (n->op.oper == GEL_E_IFELSE_CONS) {
run_through_args = FALSE;
gel_replace_equals (n->op.args, TRUE);
gel_replace_equals (n->op.args->any.next, in_expression);
@@ -7102,7 +7102,7 @@
args = args->any.next;
}
}
- } else if (n->type == MATRIX_NODE &&
+ } else if (n->type == GEL_MATRIX_NODE &&
n->mat.matrix != NULL &&
! gel_is_matrix_value_only (n->mat.matrix)) {
int i,j;
@@ -7118,11 +7118,11 @@
gel_replace_equals (t, in_expression);
}
}
- } else if (n->type == SET_NODE ) {
+ } else if (n->type == GEL_SET_NODE ) {
GelETree *ali;
for(ali = n->set.items; ali != NULL; ali = ali->any.next)
gel_replace_equals (ali, in_expression);
- } else if (n->type == FUNCTION_NODE &&
+ } else if (n->type == GEL_FUNCTION_NODE &&
(n->func.func->type == GEL_USER_FUNC ||
n->func.func->type == GEL_VARIABLE_FUNC) &&
n->func.func->data.user != NULL) {
@@ -7137,15 +7137,15 @@
if (n == NULL)
return;
- if (n->type == SPACER_NODE) {
+ if (n->type == GEL_SPACER_NODE) {
gel_replace_exp (n->sp.arg);
- } else if(n->type == OPERATOR_NODE) {
+ } else if(n->type == GEL_OPERATOR_NODE) {
GelETree *args;
- if (n->op.oper == E_EXP &&
- n->op.args->type == IDENTIFIER_NODE &&
+ if (n->op.oper == GEL_E_EXP &&
+ n->op.args->type == GEL_IDENTIFIER_NODE &&
n->op.args->id.id->token != NULL &&
strcmp (n->op.args->id.id->token, "e") == 0) {
- n->op.oper = E_DIRECTCALL;
+ n->op.oper = GEL_E_DIRECTCALL;
n->op.args->id.id = d_intern ("exp");
}
@@ -7154,7 +7154,7 @@
gel_replace_exp (args);
args = args->any.next;
}
- } else if (n->type == MATRIX_NODE &&
+ } else if (n->type == GEL_MATRIX_NODE &&
n->mat.matrix != NULL &&
! gel_is_matrix_value_only (n->mat.matrix)) {
int i,j;
@@ -7170,11 +7170,11 @@
gel_replace_exp (t);
}
}
- } else if (n->type == SET_NODE ) {
+ } else if (n->type == GEL_SET_NODE ) {
GelETree *ali;
for(ali = n->set.items; ali != NULL; ali = ali->any.next)
gel_replace_exp (ali);
- } else if (n->type == FUNCTION_NODE &&
+ } else if (n->type == GEL_FUNCTION_NODE &&
(n->func.func->type == GEL_USER_FUNC ||
n->func.func->type == GEL_VARIABLE_FUNC) &&
n->func.func->data.user != NULL) {
@@ -7189,18 +7189,18 @@
if (n == NULL)
return;
- if (n->type == SPACER_NODE) {
+ if (n->type == GEL_SPACER_NODE) {
gel_fixup_num_neg (n->sp.arg);
- } else if(n->type == OPERATOR_NODE) {
+ } else if(n->type == GEL_OPERATOR_NODE) {
/* replace -1^2 with something like (-1)^2, only
* for numbers. If you typed parenthesis as in
* -(1)^2, there would be a spacer node present
* so the below would not happen */
- if (n->op.oper == E_NEG &&
- n->op.args->type == OPERATOR_NODE &&
- (n->op.args->op.oper == E_EXP ||
- n->op.args->op.oper == E_ELTEXP) &&
- n->op.args->op.args->type == VALUE_NODE) {
+ if (n->op.oper == GEL_E_NEG &&
+ n->op.args->type == GEL_OPERATOR_NODE &&
+ (n->op.args->op.oper == GEL_E_EXP ||
+ n->op.args->op.oper == GEL_E_ELTEXP) &&
+ n->op.args->op.args->type == GEL_VALUE_NODE) {
GelETree *t = n->op.args;
n->op.args = NULL;
replacenode (n, t);
@@ -7214,7 +7214,7 @@
args = args->any.next;
}
}
- } else if (n->type == MATRIX_NODE &&
+ } else if (n->type == GEL_MATRIX_NODE &&
n->mat.matrix != NULL &&
! gel_is_matrix_value_only (n->mat.matrix)) {
int i,j;
@@ -7230,11 +7230,11 @@
gel_fixup_num_neg (t);
}
}
- } else if (n->type == SET_NODE ) {
+ } else if (n->type == GEL_SET_NODE ) {
GelETree *ali;
for(ali = n->set.items; ali != NULL; ali = ali->any.next)
gel_fixup_num_neg (ali);
- } else if (n->type == FUNCTION_NODE &&
+ } else if (n->type == GEL_FUNCTION_NODE &&
(n->func.func->type == GEL_USER_FUNC ||
n->func.func->type == GEL_VARIABLE_FUNC) &&
n->func.func->data.user != NULL) {
@@ -7251,14 +7251,14 @@
if (n == NULL)
return FALSE;
- if (n->type == SPACER_NODE) {
+ if (n->type == GEL_SPACER_NODE) {
return gel_eval_find_identifier (n->sp.arg, tok, funcbody);
- } else if (n->type == IDENTIFIER_NODE ) {
+ } else if (n->type == GEL_IDENTIFIER_NODE ) {
if (n->id.id == tok)
return TRUE;
else
return FALSE;
- } else if(n->type == OPERATOR_NODE) {
+ } else if(n->type == GEL_OPERATOR_NODE) {
GelETree *args = n->op.args;
while (args != NULL) {
if (gel_eval_find_identifier (args, tok, funcbody))
@@ -7266,7 +7266,7 @@
args = args->any.next;
}
return FALSE;
- } else if (n->type == MATRIX_NODE &&
+ } else if (n->type == GEL_MATRIX_NODE &&
n->mat.matrix != NULL) {
int i,j;
int w,h;
@@ -7282,7 +7282,7 @@
}
}
return FALSE;
- } else if (n->type == SET_NODE ) {
+ } else if (n->type == GEL_SET_NODE ) {
GelETree *ali;
for (ali = n->set.items; ali != NULL; ali = ali->any.next) {
if (gel_eval_find_identifier (ali, tok, funcbody))
@@ -7290,7 +7290,7 @@
}
return FALSE;
} else if (funcbody &&
- n->type == FUNCTION_NODE &&
+ n->type == GEL_FUNCTION_NODE &&
(n->func.func->type == GEL_USER_FUNC ||
n->func.func->type == GEL_VARIABLE_FUNC)) {
D_ENSURE_USER_BODY (n->func.func);
@@ -7308,7 +7308,7 @@
GelETree *l;
mpw_t res;
GEL_GET_L(n,l);
- if(l->type != VALUE_NODE)
+ if(l->type != GEL_VALUE_NODE)
return;
mpw_init(res);
(*func)(res,l->val.value);
@@ -7329,7 +7329,7 @@
GelETree *l;
mpw_t res;
GEL_GET_L(n,l);
- if (l->type != VALUE_NODE ||
+ if (l->type != GEL_VALUE_NODE ||
(respect_type &&
(mpw_is_complex (l->val.value) ||
mpw_is_float (l->val.value))))
@@ -7353,8 +7353,8 @@
GelETree *l,*r,*next;
mpw_t res;
GEL_GET_LR(n,l,r);
- if (l->type != VALUE_NODE ||
- r->type != VALUE_NODE ||
+ if (l->type != GEL_VALUE_NODE ||
+ r->type != GEL_VALUE_NODE ||
(respect_type &&
(mpw_is_complex (l->val.value) ||
mpw_is_complex (r->val.value) ||
@@ -7378,50 +7378,50 @@
try_to_precalc_op (GelETree *n, gboolean respect_type)
{
switch(n->op.oper) {
- case E_NEG:
+ case GEL_E_NEG:
op_precalc_all_1 (n, mpw_neg);
return;
- case E_ABS:
+ case GEL_E_ABS:
op_precalc_1 (n, mpw_abs, respect_type);
return;
- case E_FACT:
+ case GEL_E_FACT:
op_precalc_1 (n, mpw_fac, respect_type);
return;
- case E_DBLFACT:
+ case GEL_E_DBLFACT:
op_precalc_1 (n, mpw_dblfac, respect_type);
return;
- case E_PLUS:
+ case GEL_E_PLUS:
op_precalc_2 (n, mpw_add, respect_type);
return;
- case E_ELTPLUS:
+ case GEL_E_ELTPLUS:
op_precalc_2 (n, mpw_add, respect_type);
return;
- case E_MINUS:
+ case GEL_E_MINUS:
op_precalc_2 (n, mpw_sub, respect_type);
return;
- case E_ELTMINUS:
+ case GEL_E_ELTMINUS:
op_precalc_2 (n, mpw_sub, respect_type);
return;
- case E_MUL:
+ case GEL_E_MUL:
op_precalc_2 (n, mpw_mul, respect_type);
return;
- case E_ELTMUL:
+ case GEL_E_ELTMUL:
op_precalc_2 (n, mpw_mul, respect_type);
return;
- case E_DIV:
+ case GEL_E_DIV:
op_precalc_2 (n, mpw_div, respect_type);
return;
- case E_ELTDIV:
+ case GEL_E_ELTDIV:
op_precalc_2 (n, mpw_div, respect_type);
return;
- case E_MOD:
+ case GEL_E_MOD:
op_precalc_2 (n, mpw_mod, respect_type);
return;
/* FIXME: this could be time consuming, somehow catch that */
- case E_EXP:
+ case GEL_E_EXP:
op_precalc_2 (n, mpw_pow, respect_type);
return;
- case E_ELTEXP:
+ case GEL_E_ELTEXP:
op_precalc_2 (n, mpw_pow, respect_type);
return;
default:
@@ -7434,19 +7434,19 @@
{
if(!n) return;
- if(n->type==OPERATOR_NODE) {
+ if(n->type==GEL_OPERATOR_NODE) {
GelETree *ali;
/* double negation is always positive no matter what */
- if (n->op.oper == E_NEG &&
- n->op.args->type == OPERATOR_NODE &&
- n->op.args->op.oper == E_NEG) {
+ if (n->op.oper == GEL_E_NEG &&
+ n->op.args->type == GEL_OPERATOR_NODE &&
+ n->op.args->op.oper == GEL_E_NEG) {
GelETree *nn;
nn = n->op.args->op.args;
n->op.args->op.args = NULL;
replacenode (n, nn);
gel_try_to_do_precalc (n);
- } else if(n->op.oper == E_MOD_CALC) {
+ } else if(n->op.oper == GEL_E_MOD_CALC) {
/* in case of modular calculation, only do
precalc on the second argument (don't descend
at all into the first one) */
@@ -7457,11 +7457,11 @@
for(ali=n->op.args;ali;ali=ali->any.next)
gel_try_to_do_precalc(ali);
}
- if(n->type==OPERATOR_NODE)
+ if(n->type==GEL_OPERATOR_NODE)
try_to_precalc_op (n,
TRUE /* respect_type */);
}
- } else if(n->type==MATRIX_NODE) {
+ } else if(n->type==GEL_MATRIX_NODE) {
int i,j;
int w,h;
if (n->mat.matrix == NULL ||
@@ -7477,13 +7477,13 @@
gel_try_to_do_precalc(t);
}
}
- } else if(n->type==SET_NODE) {
+ } else if(n->type==GEL_SET_NODE) {
GelETree *ali;
if(n->set.items) {
for(ali=n->set.items;ali;ali=ali->any.next)
gel_try_to_do_precalc(ali);
}
- } else if(n->type==FUNCTION_NODE) {
+ } else if(n->type==GEL_FUNCTION_NODE) {
if ((n->func.func->type == GEL_USER_FUNC ||
n->func.func->type == GEL_VARIABLE_FUNC) &&
n->func.func->data.user)
@@ -7502,11 +7502,11 @@
if (l->type != r->type)
return FALSE;
- if (l->type == NULL_NODE) {
+ if (l->type == GEL_NULL_NODE) {
return TRUE;
- } else if (l->type == VALUE_NODE) {
+ } else if (l->type == GEL_VALUE_NODE) {
return mpw_symbolic_eql (l->val.value, r->val.value);
- } else if (l->type == OPERATOR_NODE) {
+ } else if (l->type == GEL_OPERATOR_NODE) {
GelETree *ali, *bli;
if (l->op.oper != r->op.oper || l->op.nargs != r->op.nargs)
return FALSE;
@@ -7517,25 +7517,25 @@
return FALSE;
}
return TRUE;
- } else if (l->type == IDENTIFIER_NODE) {
+ } else if (l->type == GEL_IDENTIFIER_NODE) {
if (l->id.id == r->id.id)
return TRUE;
else
return FALSE;
- } else if (l->type == STRING_NODE) {
+ } else if (l->type == GEL_STRING_NODE) {
if (l->str.str != NULL && /* sanity only! */
r->str.str != NULL &&
strcmp (l->str.str, r->str.str) == 0)
return TRUE;
else
return FALSE;
- } else if (l->type == BOOL_NODE) {
+ } else if (l->type == GEL_BOOL_NODE) {
if ((l->bool_.bool_ && r->bool_.bool_) ||
( ! l->bool_.bool_ && ! r->bool_.bool_))
return TRUE;
else
return FALSE;
- } else if (l->type == MATRIX_NODE) {
+ } else if (l->type == GEL_MATRIX_NODE) {
int i, j;
int w, h;
if G_UNLIKELY (l->mat.matrix == NULL ||
@@ -7556,11 +7556,11 @@
}
}
return TRUE;
- /* FIXME: SET_NODE */
- /* FIXME: POLYNOMIAL_NODE */
- /* FIXME: FUNCTION_NODE */
- /* FIXME: COMPARISON_NODE */
- /* FIXME: USERTYPE_NODE */
+ /* FIXME: GEL_SET_NODE */
+ /* FIXME: GEL_POLYNOMIAL_NODE */
+ /* FIXME: GEL_FUNCTION_NODE */
+ /* FIXME: GEL_COMPARISON_NODE */
+ /* FIXME: GEL_USERTYPE_NODE */
}
return FALSE;
}
@@ -7578,8 +7578,8 @@
GEL_GET_LR (n, l, r);
/* always swap values to go first */
- if (r->type == VALUE_NODE &&
- l->type != VALUE_NODE) {
+ if (r->type == GEL_VALUE_NODE &&
+ l->type != GEL_VALUE_NODE) {
n->op.args = r;
r->any.next = l;
l->any.next = NULL;
@@ -7591,21 +7591,21 @@
/* make into (a*b)*c, "*" is * or + (oper) */
/* unless a is a value and b and c are not */
- if (r->type == OPERATOR_NODE &&
+ if (r->type == GEL_OPERATOR_NODE &&
r->op.oper == oper) {
GelETree *a, *b, *c;
a = l;
b = r->op.args;
c = r->op.args->any.next;
- if ( ! (a->type == VALUE_NODE &&
- b->type != VALUE_NODE &&
- c->type != VALUE_NODE)) {
+ if ( ! (a->type == GEL_VALUE_NODE &&
+ b->type != GEL_VALUE_NODE &&
+ c->type != GEL_VALUE_NODE)) {
r->op.args = NULL;
gel_freetree (r);
GEL_GET_NEW_NODE (l);
- l->type = OPERATOR_NODE;
+ l->type = GEL_OPERATOR_NODE;
l->op.oper = oper;
l->op.nargs = 2;
l->op.args = a;
@@ -7624,21 +7624,21 @@
/* if (a*b)*c and a is a value and b and c are not
make into a*(b*c) */
- if (l->type == OPERATOR_NODE &&
+ if (l->type == GEL_OPERATOR_NODE &&
l->op.oper == oper) {
GelETree *a, *b, *c;
a = l->op.args;
b = l->op.args->any.next;
c = r;
- if (a->type == VALUE_NODE &&
- b->type != VALUE_NODE &&
- c->type != VALUE_NODE) {
+ if (a->type == GEL_VALUE_NODE &&
+ b->type != GEL_VALUE_NODE &&
+ c->type != GEL_VALUE_NODE) {
l->op.args = NULL;
gel_freetree (l);
GEL_GET_NEW_NODE (r);
- r->type = OPERATOR_NODE;
+ r->type = GEL_OPERATOR_NODE;
r->op.oper = oper;
r->op.nargs = 2;
r->op.args = b;
@@ -7665,19 +7665,19 @@
if (n == NULL)
return;
- if (n->type == OPERATOR_NODE) {
+ if (n->type == GEL_OPERATOR_NODE) {
GelETree *ali;
/* double negation is always positive no matter what */
- if (n->op.oper == E_NEG &&
- n->op.args->type == OPERATOR_NODE &&
- n->op.args->op.oper == E_NEG) {
+ if (n->op.oper == GEL_E_NEG &&
+ n->op.args->type == GEL_OPERATOR_NODE &&
+ n->op.args->op.oper == GEL_E_NEG) {
GelETree *nn;
nn = n->op.args->op.args;
n->op.args->op.args = NULL;
replacenode (n, nn);
goto resimplify;
- } else if(n->op.oper == E_MOD_CALC) {
+ } else if(n->op.oper == GEL_E_MOD_CALC) {
/* in case of modular calculation, only do
precalc on the second argument (don't descend
at all into the first one) */
@@ -7694,7 +7694,7 @@
/* be aggressive! */
try_to_precalc_op (n, FALSE /* respect_type */);
- if (n->type != OPERATOR_NODE)
+ if (n->type != GEL_OPERATOR_NODE)
return;
/* FIXME: we want to assume addition ALWAYS comutes and
@@ -7705,30 +7705,30 @@
/* sort out multiplications and additions,
putting all values first */
- if (oper_reshufle (n, E_MUL)) {
+ if (oper_reshufle (n, GEL_E_MUL)) {
goto resimplify;
}
- if (oper_reshufle (n, E_PLUS)) {
+ if (oper_reshufle (n, GEL_E_PLUS)) {
goto resimplify;
}
/* Now try to put together multiplications and exponents */
/* FIXME: this is too specific be more general!, though maybe if we sort out all
multiplication and addition as above, things will work nicely */
- if (n->op.oper == E_MUL) {
+ if (n->op.oper == GEL_E_MUL) {
GelETree *l, *r;
GelETree *ll, *rr;
GelETree *le = NULL, *re = NULL;
GEL_GET_LR (n, l, r);
ll = l;
rr = r;
- if (l->type == OPERATOR_NODE &&
- l->op.oper == E_EXP) {
+ if (l->type == GEL_OPERATOR_NODE &&
+ l->op.oper == GEL_E_EXP) {
ll = l->op.args;
le = l->op.args->any.next;
}
- if (r->type == OPERATOR_NODE &&
- r->op.oper == E_EXP) {
+ if (r->type == GEL_OPERATOR_NODE &&
+ r->op.oper == GEL_E_EXP) {
rr = r->op.args;
re = r->op.args->any.next;
}
@@ -7748,8 +7748,8 @@
}
GEL_GET_NEW_NODE (e);
- e->type = OPERATOR_NODE;
- e->op.oper = E_PLUS;
+ e->type = GEL_OPERATOR_NODE;
+ e->op.oper = GEL_E_PLUS;
e->op.nargs = 2;
if (le == NULL) {
e->op.args = gel_makenum_ui (1);
@@ -7764,8 +7764,8 @@
e->op.args->any.next->any.next = NULL;
GEL_GET_NEW_NODE (nn);
- nn->type = OPERATOR_NODE;
- nn->op.oper = E_EXP;
+ nn->type = GEL_OPERATOR_NODE;
+ nn->op.oper = GEL_E_EXP;
nn->op.nargs = 2;
nn->op.args = ll;
@@ -7778,22 +7778,22 @@
}
}
- /* FIXME: this is just like for E_MUL except re and le
+ /* FIXME: this is just like for GEL_E_MUL except re and le
are on the other side si there are some changes */
- if (n->op.oper == E_PLUS) {
+ if (n->op.oper == GEL_E_PLUS) {
GelETree *l, *r;
GelETree *ll, *rr;
GelETree *le = NULL, *re = NULL;
GEL_GET_LR (n, l, r);
ll = l;
rr = r;
- if (l->type == OPERATOR_NODE &&
- l->op.oper == E_MUL) {
+ if (l->type == GEL_OPERATOR_NODE &&
+ l->op.oper == GEL_E_MUL) {
le = l->op.args;
ll = l->op.args->any.next;
}
- if (r->type == OPERATOR_NODE &&
- r->op.oper == E_MUL) {
+ if (r->type == GEL_OPERATOR_NODE &&
+ r->op.oper == GEL_E_MUL) {
re = r->op.args;
rr = r->op.args->any.next;
}
@@ -7813,8 +7813,8 @@
}
GEL_GET_NEW_NODE (e);
- e->type = OPERATOR_NODE;
- e->op.oper = E_PLUS;
+ e->type = GEL_OPERATOR_NODE;
+ e->op.oper = GEL_E_PLUS;
e->op.nargs = 2;
if (le == NULL) {
e->op.args = gel_makenum_ui (1);
@@ -7829,8 +7829,8 @@
e->op.args->any.next->any.next = NULL;
GEL_GET_NEW_NODE (nn);
- nn->type = OPERATOR_NODE;
- nn->op.oper = E_MUL;
+ nn->type = GEL_OPERATOR_NODE;
+ nn->op.oper = GEL_E_MUL;
nn->op.nargs = 2;
nn->op.args = e;
@@ -7843,83 +7843,83 @@
}
}
- if (n->op.oper == E_MUL &&
- (n->op.args->type == VALUE_NODE ||
- n->op.args->any.next->type == VALUE_NODE)) {
+ if (n->op.oper == GEL_E_MUL &&
+ (n->op.args->type == GEL_VALUE_NODE ||
+ n->op.args->any.next->type == GEL_VALUE_NODE)) {
GelETree *l, *r;
GEL_GET_LR (n, l, r);
/* multiply by 0, so nothing */
- if ((l->type == VALUE_NODE &&
+ if ((l->type == GEL_VALUE_NODE &&
mpw_zero_p (l->val.value)) ||
- (r->type == VALUE_NODE &&
+ (r->type == GEL_VALUE_NODE &&
mpw_zero_p (r->val.value))) {
freetree_full (n, TRUE, FALSE);
gel_makenum_ui_from (n, 0);
- } else if (l->type == VALUE_NODE &&
+ } else if (l->type == GEL_VALUE_NODE &&
mpw_eql_ui (l->val.value, 1)) {
/* multiply by 1, so identity */
n->op.args = NULL;
gel_freetree (l);
replacenode (n, r);
- } else if (r->type == VALUE_NODE &&
+ } else if (r->type == GEL_VALUE_NODE &&
mpw_eql_ui (r->val.value, 1)) {
/* multiply by 1, so identity */
n->op.args = NULL;
gel_freetree (r);
replacenode (n, l);
}
- } else if (n->op.oper == E_DIV &&
- (n->op.args->type == VALUE_NODE ||
- n->op.args->any.next->type == VALUE_NODE)) {
+ } else if (n->op.oper == GEL_E_DIV &&
+ (n->op.args->type == GEL_VALUE_NODE ||
+ n->op.args->any.next->type == GEL_VALUE_NODE)) {
GelETree *l, *r;
GEL_GET_LR (n, l, r);
/* divide 0 by something so nothing
(unless the bottom is 0) */
- if ((l->type == VALUE_NODE &&
+ if ((l->type == GEL_VALUE_NODE &&
mpw_zero_p (l->val.value)) &&
- (r->type != VALUE_NODE ||
+ (r->type != GEL_VALUE_NODE ||
! mpw_zero_p (r->val.value))) {
freetree_full (n, TRUE, FALSE);
gel_makenum_ui_from (n, 0);
- } else if (r->type == VALUE_NODE &&
+ } else if (r->type == GEL_VALUE_NODE &&
mpw_eql_ui (r->val.value, 1)) {
/* divide by 1, so identity */
n->op.args = NULL;
gel_freetree (r);
replacenode (n, l);
}
- } else if (n->op.oper == E_PLUS &&
- (n->op.args->type == VALUE_NODE ||
- n->op.args->any.next->type == VALUE_NODE)) {
+ } else if (n->op.oper == GEL_E_PLUS &&
+ (n->op.args->type == GEL_VALUE_NODE ||
+ n->op.args->any.next->type == GEL_VALUE_NODE)) {
GelETree *l, *r;
GEL_GET_LR (n, l, r);
- if (l->type == VALUE_NODE &&
+ if (l->type == GEL_VALUE_NODE &&
mpw_zero_p (l->val.value)) {
/* add 0, so identity */
n->op.args = NULL;
gel_freetree (l);
replacenode (n, r);
- } else if (r->type == VALUE_NODE &&
+ } else if (r->type == GEL_VALUE_NODE &&
mpw_zero_p (r->val.value)) {
/* add 0, so identity */
n->op.args = NULL;
gel_freetree (r);
replacenode (n, l);
}
- } else if (n->op.oper == E_EXP) {
+ } else if (n->op.oper == GEL_E_EXP) {
GelETree *l, *r;
GEL_GET_LR (n, l, r);
- if (r->type == VALUE_NODE &&
+ if (r->type == GEL_VALUE_NODE &&
mpw_zero_p (r->val.value)) {
/* something^0 so we get 1 */
freetree_full (n, TRUE, FALSE);
gel_makenum_ui_from (n, 1);
- } else if (l->type == OPERATOR_NODE &&
- l->op.oper == E_EXP) {
+ } else if (l->type == GEL_OPERATOR_NODE &&
+ l->op.oper == GEL_E_EXP) {
/* (x^v)^w => x^(v*w);
and then simplify again */
GelETree *nn;
@@ -7932,8 +7932,8 @@
gel_freetree (l);
GEL_GET_NEW_NODE (nn);
- nn->type = OPERATOR_NODE;
- nn->op.oper = E_MUL;
+ nn->type = GEL_OPERATOR_NODE;
+ nn->op.oper = GEL_E_MUL;
nn->op.nargs = 2;
nn->op.args = v;
@@ -7947,7 +7947,7 @@
goto resimplify;
}
}
- } else if(n->type==MATRIX_NODE) {
+ } else if(n->type==GEL_MATRIX_NODE) {
int i,j;
int w,h;
if (n->mat.matrix == NULL ||
@@ -7963,13 +7963,13 @@
gel_simplify (t);
}
}
- } else if(n->type==SET_NODE) {
+ } else if(n->type==GEL_SET_NODE) {
GelETree *ali;
if(n->set.items) {
for(ali=n->set.items;ali;ali=ali->any.next)
gel_simplify (ali);
}
- } else if(n->type==FUNCTION_NODE) {
+ } else if(n->type==GEL_FUNCTION_NODE) {
if ((n->func.func->type == GEL_USER_FUNC ||
n->func.func->type == GEL_VARIABLE_FUNC) &&
n->func.func->data.user)
Modified: trunk/src/eval.h
==============================================================================
--- trunk/src/eval.h (original)
+++ trunk/src/eval.h Sun Mar 15 05:01:35 2009
@@ -19,8 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef EVAL_H
-#define EVAL_H
+#ifndef _GEL_EVAL_H
+#define _GEL_EVAL_H
/* #define EVAL_DEBUG 1 */
/* Note: this won't be completely mem-debug friendly, but only mostly */
@@ -32,79 +32,6 @@
/*declarations of structures*/
#include "structs.h"
-/* builtin primitives */
-enum {
- E_SEPAR = 0,
- E_EQUALS, /* see E_DEFEQUALS (on the end not to break bincompat) */
- E_PARAMETER,
- E_ABS,
- E_PLUS,
- E_ELTPLUS,
- E_MINUS,
- E_ELTMINUS,
- E_MUL,
- E_ELTMUL,
- E_DIV,
- E_ELTDIV,
- E_BACK_DIV,
- E_ELT_BACK_DIV,
- E_MOD,
- E_ELTMOD,
- E_NEG,
- E_EXP,
- E_ELTEXP,
- E_FACT,
- E_DBLFACT,
- E_TRANSPOSE,
- E_CONJUGATE_TRANSPOSE,
- E_IF_CONS,
- E_IFELSE_CONS,
- E_WHILE_CONS,
- E_UNTIL_CONS,
- E_DOWHILE_CONS,
- E_DOUNTIL_CONS,
- E_FOR_CONS,
- E_FORBY_CONS,
- E_FORIN_CONS,
- E_SUM_CONS,
- E_SUMBY_CONS,
- E_SUMIN_CONS,
- E_PROD_CONS,
- E_PRODBY_CONS,
- E_PRODIN_CONS,
- E_EQ_CMP,
- E_NE_CMP,
- E_CMP_CMP,
- E_LT_CMP,
- E_GT_CMP,
- E_LE_CMP,
- E_GE_CMP,
- E_LOGICAL_AND,
- E_LOGICAL_OR,
- E_LOGICAL_XOR,
- E_LOGICAL_NOT,
- E_REGION_SEP,
- E_REGION_SEP_BY,
- E_GET_VELEMENT,
- E_GET_ELEMENT,
- E_GET_ROW_REGION,
- E_GET_COL_REGION,
- E_QUOTE,
- E_REFERENCE,
- E_DEREFERENCE,
- E_DIRECTCALL,
- E_CALL,
- E_RETURN,
- E_BAILOUT,
- E_EXCEPTION,
- E_CONTINUE,
- E_BREAK,
- E_MOD_CALC,
- E_DEFEQUALS,
- E_OPER_LAST
-};
-
-
/*table of operators, at least the primitive types*/
enum {
GO_VALUE=1<<0,
@@ -274,7 +201,7 @@
const extern GelHookFunc _gel_tree_limit_hook;
void gel_test_max_nodes_again (void);
-extern GelEFunc *_internal_ln_function;
-extern GelEFunc *_internal_exp_function;
+extern GelEFunc *_gel_internal_ln_function;
+extern GelEFunc *_gel_internal_exp_function;
-#endif /* EVAL_H */
+#endif /* _GEL_EVAL_H */
Modified: trunk/src/funclib.c
==============================================================================
--- trunk/src/funclib.c (original)
+++ trunk/src/funclib.c Sun Mar 15 05:01:35 2009
@@ -40,43 +40,43 @@
#include "binreloc.h"
-GelEFunc *_internal_ln_function = NULL;
-GelEFunc *_internal_exp_function = NULL;
+static GelEFunc *_internal_ln_function = NULL;
+static GelEFunc *_internal_exp_function = NULL;
-GelEFunc *conj_function = NULL;
-GelEFunc *sin_function = NULL;
-GelEFunc *cos_function = NULL;
-GelEFunc *sinh_function = NULL;
-GelEFunc *cosh_function = NULL;
-GelEFunc *tan_function = NULL;
-GelEFunc *atan_function = NULL;
-GelEFunc *sqrt_function = NULL;
-GelEFunc *exp_function = NULL;
-GelEFunc *ln_function = NULL;
-GelEFunc *log2_function = NULL;
-GelEFunc *log10_function = NULL;
-GelEFunc *round_function = NULL;
-GelEFunc *floor_function = NULL;
-GelEFunc *ceil_function = NULL;
-GelEFunc *trunc_function = NULL;
-GelEFunc *float_function = NULL;
-GelEFunc *Numerator_function = NULL;
-GelEFunc *Denominator_function = NULL;
-GelEFunc *Re_function = NULL;
-GelEFunc *Im_function = NULL;
-/*GelEFunc *ErrorFunction_function = NULL;*/
-GelEFunc *RiemannZeta_function = NULL;
-GelEFunc *GammaFunction_function = NULL;
-GelEFunc *pi_function = NULL;
-GelEFunc *e_function = NULL;
-GelEFunc *GoldenRatio_function = NULL;
-GelEFunc *Gravity_function = NULL;
-GelEFunc *EulerConstant_function = NULL;
+static GelEFunc *conj_function = NULL;
+static GelEFunc *sin_function = NULL;
+static GelEFunc *cos_function = NULL;
+static GelEFunc *sinh_function = NULL;
+static GelEFunc *cosh_function = NULL;
+static GelEFunc *tan_function = NULL;
+static GelEFunc *atan_function = NULL;
+static GelEFunc *sqrt_function = NULL;
+static GelEFunc *exp_function = NULL;
+static GelEFunc *ln_function = NULL;
+static GelEFunc *log2_function = NULL;
+static GelEFunc *log10_function = NULL;
+static GelEFunc *round_function = NULL;
+static GelEFunc *floor_function = NULL;
+static GelEFunc *ceil_function = NULL;
+static GelEFunc *trunc_function = NULL;
+static GelEFunc *float_function = NULL;
+static GelEFunc *Numerator_function = NULL;
+static GelEFunc *Denominator_function = NULL;
+static GelEFunc *Re_function = NULL;
+static GelEFunc *Im_function = NULL;
+/*static GelEFunc *ErrorFunction_function = NULL;*/
+static GelEFunc *RiemannZeta_function = NULL;
+static GelEFunc *GammaFunction_function = NULL;
+static GelEFunc *pi_function = NULL;
+static GelEFunc *e_function = NULL;
+static GelEFunc *GoldenRatio_function = NULL;
+static GelEFunc *Gravity_function = NULL;
+static GelEFunc *EulerConstant_function = NULL;
/*maximum number of primes to precalculate and store*/
#define MAXPRIMES 30000
-GArray *primes = NULL;
-int numprimes = 0;
+static GArray *primes = NULL;
+static int numprimes = 0;
static mpw_t e_cache;
static int e_iscached = FALSE;
@@ -158,7 +158,7 @@
gel_matrix_index (m, 2, 0) = gel_makenum_ui (c);
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix_value_only_integer (m);
n->mat.quoted = FALSE;
@@ -223,7 +223,7 @@
{
GelToken *tok;
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrix
(ctx, a[0], IsDefined_op, "IsDefined",
exception);
@@ -231,9 +231,9 @@
if G_UNLIKELY ( ! check_argument_string_or_identifier (a, 0, "IsDefined"))
return NULL;
- if (a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_IDENTIFIER_NODE) {
tok = a[0]->id.id;
- } else /* STRING_NODE */ {
+ } else /* GEL_STRING_NODE */ {
tok = d_intern (a[0]->str.str);
}
@@ -248,7 +248,7 @@
{
GelToken *tok;
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrix
(ctx, a[0], undefine_op, "undefine",
exception);
@@ -256,9 +256,9 @@
if G_UNLIKELY ( ! check_argument_string_or_identifier (a, 0, "undefine"))
return NULL;
- if (a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_IDENTIFIER_NODE) {
tok = a[0]->id.id;
- } else /* STRING_NODE */ {
+ } else /* GEL_STRING_NODE */ {
tok = d_intern (a[0]->str.str);
}
@@ -290,7 +290,7 @@
IntegerFromBoolean_op (GelCtx *ctx, GelETree * * a, gboolean *exception)
{
int i;
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrix
(ctx, a[0], IntegerFromBoolean_op, "IntegerFromBoolean",
exception);
@@ -298,9 +298,9 @@
if G_UNLIKELY ( ! check_argument_bool (a, 0, "IntegerFromBoolean"))
return NULL;
- if (a[0]->type == VALUE_NODE)
+ if (a[0]->type == GEL_VALUE_NODE)
i = mpw_zero_p (a[0]->val.value) ? 0 : 1;
- else /* a->type == BOOL_NODE */
+ else /* a->type == GEL_BOOL_NODE */
i = a[0]->bool_.bool_ ? 1 : 0;
return gel_makenum_ui (i);
@@ -310,7 +310,7 @@
static GelETree *
error_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if (a[0]->type == STRING_NODE) {
+ if (a[0]->type == GEL_STRING_NODE) {
gel_errorout ("%s", a[0]->str.str);
} else {
GelOutput *gelo = gel_output_new();
@@ -384,7 +384,7 @@
{
gboolean old_limit = gel_main_out->length_limit;
gel_output_set_length_limit (gel_main_out, FALSE);
- if (a[0]->type==STRING_NODE) {
+ if (a[0]->type==GEL_STRING_NODE) {
gel_output_printf_full (gel_main_out, FALSE, "%s\n", a[0]->str.str);
} else {
gel_pretty_print_etree (gel_main_out, a[0]);
@@ -408,7 +408,7 @@
{
gboolean old_limit = gel_main_out->length_limit;
gel_output_set_length_limit (gel_main_out, FALSE);
- if(a[0]->type==STRING_NODE)
+ if(a[0]->type==GEL_STRING_NODE)
gel_output_printf (gel_main_out, "%s", a[0]->str.str);
else
gel_print_etree (gel_main_out, a[0], TRUE);
@@ -444,9 +444,9 @@
GelEFunc *func;
if G_UNLIKELY ( ! check_argument_string_or_identifier (a, 0, "set"))
return NULL;
- if (a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_IDENTIFIER_NODE) {
id = a[0]->id.id;
- } else /* STRING_NODE */ {
+ } else /* GEL_STRING_NODE */ {
id = d_intern (a[0]->str.str);
}
@@ -521,7 +521,7 @@
}
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix_value_only_real_nonrational (m);
n->mat.quoted = FALSE;
@@ -558,7 +558,7 @@
}
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix_value_only_real_nonrational (m);
n->mat.quoted = FALSE;
@@ -633,7 +633,7 @@
}
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix_value_only_integer (m);
n->mat.quoted = FALSE;
@@ -681,7 +681,7 @@
}
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix_value_only_integer (m);
n->mat.quoted = FALSE;
@@ -707,16 +707,16 @@
int quote = 0;
gboolean internal_exception = FALSE;
- if(mat1->type == MATRIX_NODE &&
- mat2->type == MATRIX_NODE) {
+ if(mat1->type == GEL_MATRIX_NODE &&
+ mat2->type == GEL_MATRIX_NODE) {
m1 = mat1->mat.matrix;
m2 = mat2->mat.matrix;
quote = mat1->mat.quoted || mat2->mat.quoted;
- } else if(mat1->type == MATRIX_NODE) {
+ } else if(mat1->type == GEL_MATRIX_NODE) {
m1 = mat1->mat.matrix;
quote = mat1->mat.quoted;
re_node = mat2;
- } else /*if(mat2->type == MATRIX_NODE)*/ {
+ } else /*if(mat2->type == GEL_MATRIX_NODE)*/ {
m1 = mat2->mat.matrix;
quote = mat2->mat.quoted;
re_node = mat1;
@@ -734,7 +734,7 @@
/*make us a new empty node*/
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
new = n->mat.matrix = gel_matrixw_new();
n->mat.quoted = quote;
gel_matrixw_set_size (new, w, h);
@@ -759,12 +759,12 @@
GelETree *nn;
GelETree *ni;
GEL_GET_NEW_NODE(ni);
- ni->type = IDENTIFIER_NODE;
+ ni->type = GEL_IDENTIFIER_NODE;
ni->id.id = d_intern(ident);
GEL_GET_NEW_NODE(nn);
- nn->type = OPERATOR_NODE;
- nn->op.oper = E_CALL;
+ nn->type = GEL_OPERATOR_NODE;
+ nn->op.oper = GEL_E_CALL;
nn->op.nargs = 3;
nn->op.args = ni;
nn->op.args->any.next = gel_copynode(t[0]);
@@ -805,7 +805,7 @@
/*make us a new empty node*/
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
new = n->mat.matrix = gel_matrixw_new();
n->mat.quoted = mat->mat.quoted;
gel_matrixw_set_size (new, w, h);
@@ -824,13 +824,13 @@
GelETree *nn;
GelETree *ni;
GEL_GET_NEW_NODE(nn);
- nn->type = OPERATOR_NODE;
- nn->op.oper = E_CALL;
+ nn->type = GEL_OPERATOR_NODE;
+ nn->op.oper = GEL_E_CALL;
nn->op.args = NULL;
nn->op.nargs = 2;
GEL_GET_NEW_NODE(ni);
- ni->type = IDENTIFIER_NODE;
+ ni->type = GEL_IDENTIFIER_NODE;
ni->id.id = d_intern(ident);
nn->op.args = ni;
@@ -838,7 +838,7 @@
nn->op.args->any.next->any.next = NULL;
gel_matrixw_set_index(new,i,j) = nn;
- } else if (e->type == VALUE_NODE &&
+ } else if (e->type == GEL_VALUE_NODE &&
mpw_exact_zero_p (e->val.value)) {
gel_freetree (e);
gel_matrixw_set_index(new,i,j) = NULL;
@@ -865,7 +865,7 @@
return NULL;
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_copy (a[0]->mat.matrix);
gel_expandmatrix (n);
n->mat.quoted = FALSE;
@@ -881,7 +881,7 @@
return NULL;
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_rowsof (a[0]->mat.matrix);
n->mat.quoted = FALSE;
return n;
@@ -896,7 +896,7 @@
return NULL;
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_columnsof (a[0]->mat.matrix);
n->mat.quoted = FALSE;
return n;
@@ -910,11 +910,11 @@
if G_UNLIKELY ( ! check_argument_matrix_or_null (a, 0, "DiagonalOf"))
return NULL;
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_null ();
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_diagonalof (a[0]->mat.matrix);
n->mat.quoted = FALSE;
return n;
@@ -930,7 +930,7 @@
if G_UNLIKELY ( ! check_argument_matrix_or_null (a, 0, "CountZeroColumns"))
return NULL;
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_ui (0);
m = a[0]->mat.matrix;
@@ -942,8 +942,8 @@
for (j = 0; j < h; j++) {
GelETree *t = gel_matrixw_get_index (m, i, j);
if ( ! ( t == NULL ||
- t->type == NULL_NODE ||
- (t->type == VALUE_NODE &&
+ t->type == GEL_NULL_NODE ||
+ (t->type == GEL_VALUE_NODE &&
mpw_zero_p (t->val.value)))) {
cnt++;
break;
@@ -967,7 +967,7 @@
if G_UNLIKELY ( ! check_argument_matrix_or_null (a, 0, "StripZeroColumns"))
return NULL;
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_null ();
m = a[0]->mat.matrix;
@@ -980,8 +980,8 @@
for (j = 0; j < h; j++) {
GelETree *t = gel_matrixw_get_index (m, i, j);
if ( ! ( t == NULL ||
- t->type == NULL_NODE ||
- (t->type == VALUE_NODE &&
+ t->type == GEL_NULL_NODE ||
+ (t->type == GEL_VALUE_NODE &&
mpw_zero_p (t->val.value)))) {
cols = g_slist_prepend (cols,
GINT_TO_POINTER (i));
@@ -1014,7 +1014,7 @@
g_slist_free (cols);
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix (nm);
n->mat.quoted = a[0]->mat.quoted;
@@ -1027,12 +1027,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (conj_function, a[0]);
}
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrix (ctx, a[0], ComplexConjugate_op, "ComplexConjugate", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "ComplexConjugate"))
@@ -1051,12 +1051,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (sin_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],sin_op,"sin", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "sin"))
@@ -1075,12 +1075,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (sinh_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],sinh_op,"sinh", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "sinh"))
@@ -1099,12 +1099,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (cos_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],cos_op,"cos", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "cos"))
@@ -1123,12 +1123,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (cosh_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],cosh_op,"cosh", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "cosh"))
@@ -1148,12 +1148,12 @@
mpw_t fr;
mpw_t fr2;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (tan_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],tan_op,"tan", exception);
if G_UNLIKELY ( ! check_argument_real_number (a, 0, "tan"))
@@ -1178,12 +1178,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (atan_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],atan_op,"atan", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "atan"))
@@ -1202,8 +1202,8 @@
{
mpw_t fr;
- if(a[0]->type==MATRIX_NODE ||
- a[1]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE ||
+ a[1]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen(ctx,a[0],a[1],atan2_op,"atan2", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "atan2") ||
@@ -1302,12 +1302,12 @@
mpfr_t ret;
mpw_t retw;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (ErrorFunction_function, a[0]);
}
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrix (ctx, a[0], ErrorFunction_op, "ErrorFunction", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "ErrorFunction"))
@@ -1340,12 +1340,12 @@
mpfr_t ret;
mpw_t retw;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (RiemannZeta_function, a[0]);
}
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrix (ctx, a[0], RiemannZeta_op, "RiemannZeta", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "RiemannZeta"))
@@ -1377,12 +1377,12 @@
mpfr_t ret;
mpw_t retw;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (GammaFunction_function, a[0]);
}
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrix (ctx, a[0], GammaFunction_op, "GammaFunction", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "GammaFunction"))
@@ -1410,7 +1410,7 @@
static GelETree *
IsNull_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type==NULL_NODE)
+ if(a[0]->type==GEL_NULL_NODE)
return gel_makenum_bool (1);
else
return gel_makenum_bool (0);
@@ -1418,7 +1418,7 @@
static GelETree *
IsValue_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type==VALUE_NODE)
+ if(a[0]->type==GEL_VALUE_NODE)
return gel_makenum_bool (1);
else
return gel_makenum_bool (0);
@@ -1426,7 +1426,7 @@
static GelETree *
IsBoolean_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if (a[0]->type == BOOL_NODE)
+ if (a[0]->type == GEL_BOOL_NODE)
return gel_makenum_bool (1);
else
return gel_makenum_bool (0);
@@ -1434,7 +1434,7 @@
static GelETree *
IsString_op (GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if (a[0]->type == STRING_NODE)
+ if (a[0]->type == GEL_STRING_NODE)
return gel_makenum_bool (1);
else
return gel_makenum_bool (0);
@@ -1442,7 +1442,7 @@
static GelETree *
IsMatrix_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_makenum_bool (1);
else
return gel_makenum_bool (0);
@@ -1450,7 +1450,7 @@
static GelETree *
IsVector_op (GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if (a[0]->type == MATRIX_NODE &&
+ if (a[0]->type == GEL_MATRIX_NODE &&
(gel_matrixw_width(a[0]->mat.matrix) == 1 ||
gel_matrixw_height(a[0]->mat.matrix) == 1))
return gel_makenum_bool (1);
@@ -1460,7 +1460,7 @@
static GelETree *
IsFunction_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if (a[0]->type == FUNCTION_NODE)
+ if (a[0]->type == GEL_FUNCTION_NODE)
return gel_makenum_bool (1);
else
return gel_makenum_bool (0);
@@ -1468,7 +1468,7 @@
static GelETree *
IsFunctionOrIdentifier_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if (a[0]->type == FUNCTION_NODE || a[0]->type == IDENTIFIER_NODE)
+ if (a[0]->type == GEL_FUNCTION_NODE || a[0]->type == GEL_IDENTIFIER_NODE)
return gel_makenum_bool (1);
else
return gel_makenum_bool (0);
@@ -1476,11 +1476,11 @@
static GelETree *
IsFunctionRef_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type==OPERATOR_NODE &&
- a[0]->op.oper == E_REFERENCE) {
+ if(a[0]->type==GEL_OPERATOR_NODE &&
+ a[0]->op.oper == GEL_E_REFERENCE) {
GelETree *arg = a[0]->op.args;
g_assert(arg);
- if(arg->type==IDENTIFIER_NODE &&
+ if(arg->type==GEL_IDENTIFIER_NODE &&
d_lookup_global(arg->id.id))
return gel_makenum_bool (1);
}
@@ -1489,7 +1489,7 @@
static GelETree *
IsComplex_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type!=VALUE_NODE)
+ if(a[0]->type!=GEL_VALUE_NODE)
return gel_makenum_bool (0);
else if(mpw_is_complex(a[0]->val.value))
return gel_makenum_bool (1);
@@ -1499,7 +1499,7 @@
static GelETree *
IsReal_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type!=VALUE_NODE)
+ if(a[0]->type!=GEL_VALUE_NODE)
return gel_makenum_bool (0);
else if(mpw_is_complex(a[0]->val.value))
return gel_makenum_bool (0);
@@ -1520,7 +1520,7 @@
static GelETree *
IsInteger_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type!=VALUE_NODE ||
+ if(a[0]->type!=GEL_VALUE_NODE ||
mpw_is_complex(a[0]->val.value))
return gel_makenum_bool (0);
else if(mpw_is_integer(a[0]->val.value))
@@ -1531,7 +1531,7 @@
static GelETree *
IsPositiveInteger_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type!=VALUE_NODE ||
+ if(a[0]->type!=GEL_VALUE_NODE ||
mpw_is_complex(a[0]->val.value))
return gel_makenum_bool (0);
else if(mpw_is_integer(a[0]->val.value) &&
@@ -1543,7 +1543,7 @@
static GelETree *
IsNonNegativeInteger_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type!=VALUE_NODE ||
+ if(a[0]->type!=GEL_VALUE_NODE ||
mpw_is_complex(a[0]->val.value))
return gel_makenum_bool (0);
else if(mpw_is_integer(a[0]->val.value) &&
@@ -1555,7 +1555,7 @@
static GelETree *
IsGaussInteger_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type!=VALUE_NODE)
+ if(a[0]->type!=GEL_VALUE_NODE)
return gel_makenum_bool (0);
else if(mpw_is_complex_integer(a[0]->val.value))
return gel_makenum_bool (1);
@@ -1576,7 +1576,7 @@
static GelETree *
IsRational_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type!=VALUE_NODE ||
+ if(a[0]->type!=GEL_VALUE_NODE ||
mpw_is_complex(a[0]->val.value))
return gel_makenum_bool (0);
else if(mpw_is_rational(a[0]->val.value) ||
@@ -1588,7 +1588,7 @@
static GelETree *
IsComplexRational_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type!=VALUE_NODE)
+ if(a[0]->type!=GEL_VALUE_NODE)
return gel_makenum_bool (0);
else if (mpw_is_complex_rational_or_integer (a[0]->val.value))
return gel_makenum_bool (1);
@@ -1609,7 +1609,7 @@
static GelETree *
IsFloat_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type!=VALUE_NODE ||
+ if(a[0]->type!=GEL_VALUE_NODE ||
mpw_is_complex(a[0]->val.value))
return gel_makenum_bool (0);
else if(mpw_is_float(a[0]->val.value))
@@ -1623,12 +1623,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (trunc_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],trunc_op,"trunc", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "trunc"))
@@ -1642,12 +1642,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (floor_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],floor_op,"floor", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "floor"))
@@ -1661,12 +1661,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (ceil_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],ceil_op,"ceil", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "ceil"))
@@ -1680,12 +1680,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (round_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],round_op,"round", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "round"))
@@ -1699,12 +1699,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (float_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],float_op,"float", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "float"))
@@ -1719,12 +1719,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (Numerator_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],Numerator_op,"Numerator", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "Numerator"))
@@ -1744,12 +1744,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (Denominator_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],Denominator_op,"Denominator", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "Denominator"))
@@ -1769,12 +1769,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (Re_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],Re_op,"Re", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "Re"))
@@ -1789,12 +1789,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (Im_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],Im_op,"Im", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "Im"))
@@ -1807,12 +1807,12 @@
static GelETree *
sqrt_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (sqrt_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],sqrt_op,"sqrt", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "sqrt"))
@@ -1865,12 +1865,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (exp_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE) {
+ if(a[0]->type==GEL_MATRIX_NODE) {
if G_UNLIKELY (gel_matrixw_width(a[0]->mat.matrix) !=
gel_matrixw_height(a[0]->mat.matrix)) {
gel_errorout (_("%s: matrix argument is not square"),
@@ -1892,12 +1892,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (ln_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],ln_op,"ln", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "ln"))
@@ -1917,12 +1917,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (log2_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],log2_op,"log2", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "log2"))
@@ -1942,12 +1942,12 @@
{
mpw_t fr;
- if (a[0]->type == FUNCTION_NODE ||
- a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE ||
+ a[0]->type == GEL_IDENTIFIER_NODE) {
return gel_function_from_function (log10_function, a[0]);
}
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],log10_op,"log10", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "log10"))
@@ -1968,8 +1968,8 @@
{
mpw_t tmp;
- if(a[0]->type==MATRIX_NODE ||
- a[1]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE ||
+ a[1]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen(ctx,a[0],a[1],gcd2_op,"gcd", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "gcd") ||
@@ -1997,7 +1997,7 @@
int i;
if (a[1] == NULL) {
- if (a[0]->type == MATRIX_NODE) {
+ if (a[0]->type == GEL_MATRIX_NODE) {
int j, w, h;
mpw_t gcd;
if ( ! gel_is_matrix_value_only_integer (a[0]->mat.matrix)) {
@@ -2019,7 +2019,7 @@
}
}
return gel_makenum_use (gcd);
- } else if (a[0]->type == VALUE_NODE) {
+ } else if (a[0]->type == GEL_VALUE_NODE) {
mpw_t tmp;
if (mpw_is_complex (a[0]->val.value) ||
! mpw_is_integer (a[0]->val.value)) {
@@ -2068,8 +2068,8 @@
{
mpw_t tmp;
- if(a[0]->type==MATRIX_NODE ||
- a[1]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE ||
+ a[1]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen(ctx,a[0],a[1],lcm2_op,"lcm", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "lcm") ||
@@ -2097,7 +2097,7 @@
int i;
if (a[1] == NULL) {
- if (a[0]->type == MATRIX_NODE) {
+ if (a[0]->type == GEL_MATRIX_NODE) {
int j, w, h;
mpw_t lcm;
if ( ! gel_is_matrix_value_only_integer (a[0]->mat.matrix)) {
@@ -2119,7 +2119,7 @@
}
}
return gel_makenum_use (lcm);
- } else if (a[0]->type == VALUE_NODE) {
+ } else if (a[0]->type == GEL_VALUE_NODE) {
mpw_t tmp;
if (mpw_is_complex (a[0]->val.value) ||
! mpw_is_integer (a[0]->val.value)) {
@@ -2167,8 +2167,8 @@
{
mpw_t tmp;
- if(a[0]->type==MATRIX_NODE ||
- a[1]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE ||
+ a[1]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen(ctx,a[0],a[1],Jacobi_op,"Jacobi", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "Jacobi") ||
@@ -2194,8 +2194,8 @@
{
mpw_t tmp;
- if(a[0]->type==MATRIX_NODE ||
- a[1]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE ||
+ a[1]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen (ctx, a[0], a[1], JacobiKronecker_op, "JacobiKronecker", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "JacobiKronecker") ||
@@ -2221,8 +2221,8 @@
{
mpw_t tmp;
- if(a[0]->type==MATRIX_NODE ||
- a[1]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE ||
+ a[1]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen(ctx,a[0],a[1],Legendre_op,"Legendre", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "Legendere") ||
@@ -2246,7 +2246,7 @@
static GelETree *
IsPerfectSquare_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],IsPerfectSquare_op,"IsPerfectSquare", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "IsPerfectSquare"))
@@ -2268,7 +2268,7 @@
static GelETree *
IsPerfectPower_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],IsPerfectPower_op,"IsPerfectPower", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "IsPerfectPower"))
@@ -2288,7 +2288,7 @@
static GelETree *
IsEven_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],IsEven_op,"IsEven", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "IsEven"))
@@ -2308,7 +2308,7 @@
static GelETree *
IsOdd_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],IsOdd_op,"IsOdd", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "IsOdd"))
@@ -2329,8 +2329,8 @@
static GelETree *
max2_op (GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type==MATRIX_NODE ||
- a[1]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE ||
+ a[1]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen(ctx,a[0],a[1],max2_op,"max", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "max") ||
@@ -2355,7 +2355,7 @@
GelETree *max = NULL;
int i;
if (a[1] == NULL) {
- if (a[0]->type == MATRIX_NODE) {
+ if (a[0]->type == GEL_MATRIX_NODE) {
int j, w, h;
if G_UNLIKELY ( ! gel_is_matrix_value_only (a[0]->mat.matrix)) {
gel_errorout (_("%s: matrix argument must be value only"),
@@ -2377,7 +2377,7 @@
}
g_assert (max != NULL);
return gel_copynode (max);
- } else if (a[0]->type == VALUE_NODE) {
+ } else if (a[0]->type == GEL_VALUE_NODE) {
/*
* Evil optimization to avoid copying the node from the argument
*/
@@ -2416,8 +2416,8 @@
static GelETree *
min2_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if(a[0]->type==MATRIX_NODE ||
- a[1]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE ||
+ a[1]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen(ctx,a[0],a[1],min2_op,"min", exception);
if G_UNLIKELY ( ! check_argument_number (a, 0, "min") ||
@@ -2442,7 +2442,7 @@
GelETree *min = NULL;
int i;
if (a[1] == NULL) {
- if (a[0]->type == MATRIX_NODE) {
+ if (a[0]->type == GEL_MATRIX_NODE) {
int j, w, h;
if ( ! gel_is_matrix_value_only (a[0]->mat.matrix)) {
gel_errorout (_("%s: matrix argument must be value only"),
@@ -2464,7 +2464,7 @@
}
g_assert (min != NULL);
return gel_copynode (min);
- } else if (a[0]->type == VALUE_NODE) {
+ } else if (a[0]->type == GEL_VALUE_NODE) {
/*
* Evil optimization to avoid copying the node from the argument
*/
@@ -2528,7 +2528,7 @@
for (i = 0; i < w; i++) {
GelETree *t = gel_matrixw_get_index (m, i, j);
if (t == NULL ||
- t->type != VALUE_NODE ||
+ t->type != GEL_VALUE_NODE ||
mpw_is_complex (t->val.value) ||
mpw_sgn (t->val.value) <= 0)
return gel_makenum_bool (0);
@@ -2554,7 +2554,7 @@
for (i = 0; i < w; i++) {
GelETree *t = gel_matrixw_get_index (m, i, j);
if (t != NULL) {
- if (t->type != VALUE_NODE ||
+ if (t->type != GEL_VALUE_NODE ||
mpw_is_complex (t->val.value) ||
mpw_sgn (t->val.value) < 0)
return gel_makenum_bool (0);
@@ -2570,9 +2570,9 @@
if G_UNLIKELY ( ! check_argument_null_or_number_or_matrix (a, 0, "IsZero"))
return NULL;
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_bool (1);
- else if (a[0]->type == VALUE_NODE)
+ else if (a[0]->type == GEL_VALUE_NODE)
return gel_makenum_bool (mpw_zero_p (a[0]->val.value));
else {
GelMatrixW *m = a[0]->mat.matrix;
@@ -2583,7 +2583,7 @@
for (i = 0; i < w; i++) {
GelETree *t = gel_matrixw_get_index (m, i, j);
if ( ! ( t == NULL ||
- (t->type == VALUE_NODE &&
+ (t->type == GEL_VALUE_NODE &&
mpw_zero_p (t->val.value)))) {
return gel_makenum_bool (0);
}
@@ -2599,9 +2599,9 @@
if G_UNLIKELY ( ! check_argument_null_or_number_or_matrix (a, 0, "IsIdentity"))
return NULL;
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_bool (0);
- else if (a[0]->type == VALUE_NODE)
+ else if (a[0]->type == GEL_VALUE_NODE)
return gel_makenum_bool (mpw_eql_ui (a[0]->val.value, 1));
else {
GelMatrixW *m = a[0]->mat.matrix;
@@ -2615,12 +2615,12 @@
GelETree *t = gel_matrixw_get_index (m, i, j);
if (i == j) {
if (t == NULL ||
- t->type != VALUE_NODE ||
+ t->type != GEL_VALUE_NODE ||
! mpw_eql_ui (t->val.value, 1)) {
return gel_makenum_bool (0);
}
} else if ( ! ( t == NULL ||
- (t->type == VALUE_NODE &&
+ (t->type == GEL_VALUE_NODE &&
mpw_zero_p (t->val.value)))) {
return gel_makenum_bool (0);
}
@@ -2651,7 +2651,7 @@
/*make us a new empty node*/
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.quoted = FALSE;
if (cached_size == size) {
@@ -2723,7 +2723,7 @@
/*make us a new empty node*/
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = m = gel_matrixw_new();
n->mat.quoted = FALSE;
gel_matrixw_set_size (m, cols, rows);
@@ -2781,7 +2781,7 @@
/*make us a new empty node*/
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = m = gel_matrixw_new();
n->mat.quoted = FALSE;
gel_matrixw_set_size (m, cols, rows);
@@ -2808,7 +2808,7 @@
static GelETree *
rows_op(GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_ui (0);
if G_UNLIKELY ( ! check_argument_matrix (a, 0, "rows"))
return NULL;
@@ -2817,7 +2817,7 @@
static GelETree *
columns_op (GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_ui (0);
if G_UNLIKELY ( ! check_argument_matrix (a, 0, "columns"))
return NULL;
@@ -2826,7 +2826,7 @@
static GelETree *
elements_op (GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_ui (0);
if G_UNLIKELY ( ! check_argument_matrix (a, 0, "elements"))
return NULL;
@@ -2860,7 +2860,7 @@
for (j = 0; j < i; j++) {
GelETree *node = gel_matrixw_get_index (m, i, j);
if (node != NULL &&
- (node->type != VALUE_NODE ||
+ (node->type != GEL_VALUE_NODE ||
/* FIXME: perhaps use some zero tolerance */
! mpw_zero_p (node->val.value))) {
return gel_makenum_bool (0);
@@ -2886,7 +2886,7 @@
for (i = 0; i < j; i++) {
GelETree *node = gel_matrixw_get_index (m, i, j);
if (node != NULL &&
- (node->type != VALUE_NODE ||
+ (node->type != GEL_VALUE_NODE ||
/* FIXME: perhaps use some zero tolerance */
! mpw_zero_p (node->val.value))) {
return gel_makenum_bool (0);
@@ -2913,7 +2913,7 @@
GelETree *node = gel_matrixw_get_index (m, i, j);
if (i != j &&
node != NULL &&
- (node->type != VALUE_NODE ||
+ (node->type != GEL_VALUE_NODE ||
/* FIXME: perhaps use some zero tolerance */
! mpw_zero_p (node->val.value))) {
return gel_makenum_bool (0);
@@ -2973,7 +2973,7 @@
if G_UNLIKELY (len == 0)
return gel_makenum_null ();
- if (a[0]->type == MATRIX_NODE) {
+ if (a[0]->type == GEL_MATRIX_NODE) {
index = g_new0 (char, len);
m = a[0]->mat.matrix;
@@ -2982,7 +2982,7 @@
for (i = 0; i < ml; i++) {
GelETree *t = gel_matrixw_vindex (m, i);
int elt;
- if G_UNLIKELY (t->type != VALUE_NODE) {
+ if G_UNLIKELY (t->type != GEL_VALUE_NODE) {
gel_errorout (_("%s: vector argument not value only"), "IndexComplement");
g_free (index);
return NULL;
@@ -3054,9 +3054,9 @@
}
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix_value_only_integer (nm);
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
n->mat.quoted = a[0]->mat.quoted;
else
n->mat.quoted = TRUE;
@@ -3137,7 +3137,7 @@
if G_UNLIKELY ( ! check_argument_matrix_or_null (a, 1, "IsIn"))
return NULL;
- if (a[1]->type == NULL_NODE)
+ if (a[1]->type == GEL_NULL_NODE)
return gel_makenum_bool (FALSE);
return gel_makenum_bool (symbolic_isinmatrix (a[0], a[1]->mat.matrix));
@@ -3154,12 +3154,12 @@
return NULL;
/* emptyset is a subset of everything */
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_bool (TRUE);
/* now we know that X is not empty so if Y is empty
* then answer is no */
- if (a[1]->type == NULL_NODE)
+ if (a[1]->type == GEL_NULL_NODE)
return gel_makenum_bool (FALSE);
mX = a[0]->mat.matrix;
@@ -3194,9 +3194,9 @@
! check_argument_matrix_or_null (a, 1, "SetMinus"))
return NULL;
- if (a[0]->type == NULL_NODE) {
+ if (a[0]->type == GEL_NULL_NODE) {
return gel_makenum_null ();
- } else if (a[1]->type == NULL_NODE) {
+ } else if (a[1]->type == GEL_NULL_NODE) {
return gel_copynode (a[0]);
}
@@ -3236,7 +3236,7 @@
g_slist_free (list);
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix (nm);
n->mat.quoted = a[0]->mat.quoted;
@@ -3257,9 +3257,9 @@
! check_argument_matrix_or_null (a, 1, "Intersection"))
return NULL;
- if (a[0]->type == NULL_NODE) {
+ if (a[0]->type == GEL_NULL_NODE) {
return gel_makenum_null ();
- } else if (a[1]->type == NULL_NODE) {
+ } else if (a[1]->type == GEL_NULL_NODE) {
return gel_makenum_null ();
}
@@ -3299,7 +3299,7 @@
g_slist_free (list);
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix (nm);
n->mat.quoted = a[0]->mat.quoted;
@@ -3327,7 +3327,7 @@
return NULL;
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_copy(a[0]->mat.matrix);
gel_value_matrix_gauss (ctx, n->mat.matrix, FALSE, FALSE, FALSE, FALSE, NULL, NULL);
n->mat.quoted = FALSE;
@@ -3341,7 +3341,7 @@
return NULL;
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_copy(a[0]->mat.matrix);
if ( ! n->mat.matrix->rref) {
gel_value_matrix_gauss (ctx, n->mat.matrix, TRUE, FALSE, FALSE, FALSE, NULL, NULL);
@@ -3393,7 +3393,7 @@
int cnt, mwh;
int i;
- if G_UNLIKELY (a[0]->type == NULL_NODE)
+ if G_UNLIKELY (a[0]->type == GEL_NULL_NODE)
return gel_makenum_null ();
if G_UNLIKELY ( ! check_argument_value_only_matrix (a, 0, "PivotColumns"))
@@ -3431,7 +3431,7 @@
}
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix_value_only_integer (nm);
n->mat.quoted = FALSE;
@@ -3475,7 +3475,7 @@
int number_of_pivots, mwh;
int i, ii, j, pi;
- if G_UNLIKELY (a[0]->type == NULL_NODE)
+ if G_UNLIKELY (a[0]->type == GEL_NULL_NODE)
return gel_makenum_null ();
if G_UNLIKELY ( ! check_argument_value_only_matrix (a, 0, "NullSpace"))
@@ -3555,7 +3555,7 @@
g_free (pivot_rows);
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix_value_only (nm);
n->mat.quoted = FALSE;
@@ -3566,11 +3566,11 @@
static GelEFunc *
get_reference (GelETree *a, const char *argname, const char *func)
{
- if G_LIKELY (a->type == OPERATOR_NODE &&
- a->op.oper == E_REFERENCE) {
+ if G_LIKELY (a->type == GEL_OPERATOR_NODE &&
+ a->op.oper == GEL_E_REFERENCE) {
GelETree *arg = a->op.args;
g_assert(arg);
- if G_UNLIKELY (arg->type != IDENTIFIER_NODE ||
+ if G_UNLIKELY (arg->type != GEL_IDENTIFIER_NODE ||
d_lookup_global (arg->id.id) == NULL) {
gel_errorout (_("%s: %s not a reference"),
func, argname);
@@ -3592,7 +3592,7 @@
for (i = 0; i < w; i++) {
GelETree *node = gel_matrixw_get_index (m, i, r);
if (node != NULL &&
- (node->type != VALUE_NODE ||
+ (node->type != GEL_VALUE_NODE ||
/* FIXME: perhaps use some zero tolerance */
! mpw_zero_p (node->val.value))) {
return FALSE;
@@ -3641,7 +3641,7 @@
if (retm != NULL) {
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = RM;
n->mat.quoted = FALSE;
d_set_value (retm, n);
@@ -3651,7 +3651,7 @@
if (retv != NULL) {
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_copy (RV);
n->mat.quoted = FALSE;
d_set_value (retv, n);
@@ -3690,7 +3690,7 @@
RV = tmp;
}
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = RV;
n->mat.quoted = FALSE;
return n;
@@ -3723,7 +3723,7 @@
unsigned int i;
unsigned int last_prime;
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],Prime_op,"prime", exception);
if G_UNLIKELY ( ! check_argument_positive_integer (a, 0, "Prime"))
@@ -3777,7 +3777,7 @@
{
mpw_t ret;
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],NextPrime_op,"NextPrime", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "NextPrime"))
@@ -3799,7 +3799,7 @@
{
mpw_t ret;
- if(a[0]->type==MATRIX_NODE)
+ if(a[0]->type==GEL_MATRIX_NODE)
return gel_apply_func_to_matrix(ctx,a[0],LucasNumber_op,"LucasNumber", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "LucasNumber"))
@@ -3821,7 +3821,7 @@
int ret;
mpz_ptr num;
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrix (ctx, a[0], IsPrime_op, "IsPrime", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "IsPrime"))
@@ -3841,7 +3841,7 @@
mpz_ptr num;
mpz_ptr b;
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen (ctx, a[0], a[1],
StrongPseudoprimeTest_op,
"StrongPseudoprimeTest",
@@ -3866,8 +3866,8 @@
int reps;
mpz_ptr num;
- if (a[0]->type == MATRIX_NODE ||
- a[1]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE ||
+ a[1]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen (ctx, a[0], a[1],
MillerRabinTest_op,
"MillerRabinTest",
@@ -3894,7 +3894,7 @@
int ret;
mpz_ptr num;
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrix (ctx, a[0],
MillerRabinTestSure_op,
"MillerRabinTestSure", exception);
@@ -3923,7 +3923,7 @@
GelMatrixW *mn;
int i;
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrix (ctx, a[0],
Factorize_op,
"Factorize", exception);
@@ -3942,7 +3942,7 @@
}
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = mn = gel_matrixw_new();
n->mat.quoted = FALSE;
gel_matrixw_set_size (mn, fact->len, 2);
@@ -3966,8 +3966,8 @@
{
mpw_t ret;
- if (a[0]->type == MATRIX_NODE ||
- a[1]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE ||
+ a[1]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen (ctx, a[0], a[1],
ModInvert_op,
"ModInvert",
@@ -3993,8 +3993,8 @@
int ret;
mpz_ptr numa, numb;
- if (a[0]->type == MATRIX_NODE ||
- a[1]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE ||
+ a[1]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen (ctx, a[0], a[1], Divides_op, "Divides", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "Divides") ||
@@ -4022,8 +4022,8 @@
mpz_t ret;
mpw_t retw;
- if (a[0]->type == MATRIX_NODE ||
- a[1]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE ||
+ a[1]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen (ctx, a[0], a[1], ExactDivision_op, "ExactDivision", exception);
if G_UNLIKELY ( ! check_argument_integer (a, 0, "ExactDivision") ||
@@ -4087,7 +4087,7 @@
int i,j;
for (j = 0; j < args; j++) {
- if (a[j]->type != MATRIX_NODE ||
+ if (a[j]->type != GEL_MATRIX_NODE ||
gel_matrixw_height (a[j]->mat.matrix) != 1) {
if G_UNLIKELY (complain)
gel_errorout (_("%s: arguments not horizontal vectors"),
@@ -4097,7 +4097,7 @@
for(i=0;i<gel_matrixw_width(a[j]->mat.matrix);i++) {
GelETree *t = gel_matrixw_index(a[j]->mat.matrix,i,0);
- if (t->type != VALUE_NODE) {
+ if (t->type != GEL_VALUE_NODE) {
if G_UNLIKELY (complain)
gel_errorout (_("%s: arguments not numeric only vectors"),
func);
@@ -4123,7 +4123,7 @@
m2 = a[1]->mat.matrix;
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = mn = gel_matrixw_new();
n->mat.quoted = FALSE;
size = MAX(gel_matrixw_width(m1), gel_matrixw_width(m2));
@@ -4168,7 +4168,7 @@
m2 = a[1]->mat.matrix;
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = mn = gel_matrixw_new();
n->mat.quoted = FALSE;
size = MAX(gel_matrixw_width(m1), gel_matrixw_width(m2));
@@ -4216,7 +4216,7 @@
m2 = a[1]->mat.matrix;
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = mn = gel_matrixw_new();
n->mat.quoted = FALSE;
size = gel_matrixw_width(m1) + gel_matrixw_width(m2);
@@ -4264,7 +4264,7 @@
if G_UNLIKELY ( ! check_poly (a, 2, "DividePoly", TRUE))
return NULL;
if (a[2] != NULL) {
- if (a[2]->type != NULL_NODE) {
+ if (a[2]->type != GEL_NULL_NODE) {
retrem = get_reference (a[2], _("third argument"),
"DividePoly");
if G_UNLIKELY (retrem == NULL)
@@ -4291,7 +4291,7 @@
}
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = mn = gel_matrixw_new ();
n->mat.quoted = FALSE;
@@ -4301,7 +4301,7 @@
if (retrem != NULL) {
GEL_GET_NEW_NODE(rn);
- rn->type = MATRIX_NODE;
+ rn->type = GEL_MATRIX_NODE;
rn->mat.matrix = gel_matrixw_copy (pm);
poly_cut_zeros (rn->mat.matrix);
rn->mat.quoted = FALSE;
@@ -4353,7 +4353,7 @@
poly_cut_zeros (rem);
GEL_GET_NEW_NODE (rn);
- rn->type = MATRIX_NODE;
+ rn->type = GEL_MATRIX_NODE;
rn->mat.matrix = rem;
rn->mat.quoted = FALSE;
d_set_value (retrem, rn);
@@ -4377,7 +4377,7 @@
m = a[0]->mat.matrix;
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = mn = gel_matrixw_new();
n->mat.quoted = FALSE;
if(gel_matrixw_width(m)==1) {
@@ -4413,7 +4413,7 @@
m = a[0]->mat.matrix;
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = mn = gel_matrixw_new();
n->mat.quoted = FALSE;
if(gel_matrixw_width(m)<=2) {
@@ -4445,7 +4445,7 @@
return NULL;
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_copy(a[0]->mat.matrix);
n->mat.quoted = FALSE;
@@ -4473,7 +4473,7 @@
mpw_ptr aa, bb, cc;
mpw_t r1, r2;
- if G_UNLIKELY (a[0]->type == NULL_NODE)
+ if G_UNLIKELY (a[0]->type == GEL_NULL_NODE)
return gel_makenum_null ();
if G_UNLIKELY ( ! check_poly(a,1,"QuadraticFormula",TRUE))
@@ -4536,7 +4536,7 @@
gel_matrix_index (nm, 0, 1) = gel_makenum_use (r2);
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix_value_only (nm);
n->mat.quoted = FALSE;
@@ -4633,7 +4633,7 @@
gel_output_unref (gelo);
GEL_GET_NEW_NODE(n);
- n->type = STRING_NODE;
+ n->type = GEL_STRING_NODE;
n->str.str = r;
n->str.constant = FALSE;
@@ -4646,15 +4646,15 @@
GelETree *n;
GelETree *tokn;
GEL_GET_NEW_NODE(tokn);
- tokn->type = IDENTIFIER_NODE;
+ tokn->type = GEL_IDENTIFIER_NODE;
tokn->id.id = id;
if(power == 1)
return tokn;
GEL_GET_NEW_NODE(n);
- n->type = OPERATOR_NODE;
- n->op.oper = E_EXP;
+ n->type = GEL_OPERATOR_NODE;
+ n->op.oper = GEL_E_EXP;
n->op.args = tokn;
n->op.args->any.next = gel_makenum_ui(power);
n->op.args->any.next->any.next = NULL;
@@ -4674,8 +4674,8 @@
n = ptf_makenew_power(id,power);
} else {
GEL_GET_NEW_NODE(n);
- n->type = OPERATOR_NODE;
- n->op.oper = E_MUL;
+ n->type = GEL_OPERATOR_NODE;
+ n->op.oper = GEL_E_MUL;
n->op.args = gel_makenum (mul);
n->op.args->any.next = ptf_makenew_power(id,power);
n->op.args->any.next->any.next = NULL;
@@ -4713,8 +4713,8 @@
else {
GelETree *nnn;
GEL_GET_NEW_NODE(nnn);
- nnn->type = OPERATOR_NODE;
- nnn->op.oper = E_PLUS;
+ nnn->type = GEL_OPERATOR_NODE;
+ nnn->op.oper = GEL_E_PLUS;
nnn->op.args = nn;
nnn->op.args->any.next =
ptf_makenew_term(t->val.value,var,i);
@@ -4727,7 +4727,7 @@
nn = gel_makenum_ui(0);
GEL_GET_NEW_NODE(n);
- n->type = FUNCTION_NODE;
+ n->type = GEL_FUNCTION_NODE;
n->func.func = d_makeufunc(NULL,nn,g_slist_append(NULL,var),1, NULL);
n->func.func->context = -1;
@@ -4752,7 +4752,7 @@
return gel_makenum_null ();
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = m = gel_matrixw_new();
n->mat.quoted = FALSE;
gel_matrixw_set_size (m, size, 1);
@@ -4772,7 +4772,7 @@
int i;
GelMatrixW *m;
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_string ("");
if G_UNLIKELY ( ! check_argument_matrix (a, 0, "ASCIIToString"))
@@ -4787,7 +4787,7 @@
for (i = 0; i < size; i++) {
GelETree *t;
t = gel_matrixw_vindex (m, i);
- if (t->type != VALUE_NODE ||
+ if (t->type != GEL_VALUE_NODE ||
mpw_is_complex (t->val.value) ||
! mpw_is_integer (t->val.value) ||
mpw_sgn (t->val.value) < 0 ||
@@ -4835,7 +4835,7 @@
return gel_makenum_null ();
GEL_GET_NEW_NODE(n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = m = gel_matrixw_new();
n->mat.quoted = FALSE;
gel_matrixw_set_size (m, size, 1);
@@ -4858,7 +4858,7 @@
int i;
GelMatrixW *m;
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_string ("");
if G_UNLIKELY ( ! check_argument_matrix (a, 0, "AlphabetToString") ||
@@ -4876,7 +4876,7 @@
for (i = 0; i < size; i++) {
GelETree *t;
t = gel_matrixw_vindex (m, i);
- if G_UNLIKELY (t->type != VALUE_NODE ||
+ if G_UNLIKELY (t->type != GEL_VALUE_NODE ||
mpw_is_complex (t->val.value) ||
! mpw_is_integer (t->val.value) ||
mpw_sgn (t->val.value) < 0 ||
@@ -4902,9 +4902,9 @@
! check_argument_string (a, 2, "SetHelp"))
return NULL;
- if (a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_IDENTIFIER_NODE) {
fname = a[0]->id.id->token;
- } else /* STRING_NODE */ {
+ } else /* GEL_STRING_NODE */ {
fname = a[0]->str.str;
}
@@ -4924,15 +4924,15 @@
! check_argument_string_or_identifier (a, 1, "SetHelpAlias"))
return NULL;
- if (a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_IDENTIFIER_NODE) {
fname1 = a[0]->id.id->token;
- } else /* STRING_NODE */ {
+ } else /* GEL_STRING_NODE */ {
fname1 = a[0]->str.str;
}
- if (a[1]->type == IDENTIFIER_NODE) {
+ if (a[1]->type == GEL_IDENTIFIER_NODE) {
fname2 = a[1]->id.id->token;
- } else /* STRING_NODE */ {
+ } else /* GEL_STRING_NODE */ {
fname2 = a[1]->str.str;
}
@@ -4965,7 +4965,7 @@
}
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix_value_only_integer (mm);
n->mat.quoted = FALSE;
@@ -4990,7 +4990,7 @@
}
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_new_with_matrix (mm);
n->mat.quoted = FALSE;
@@ -5269,8 +5269,8 @@
{
unsigned long r;
- if (a[0]->type == MATRIX_NODE ||
- a[1]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE ||
+ a[1]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrixen (ctx, a[0], a[1],
nCr_op,
"nCr",
@@ -5314,7 +5314,7 @@
{
GelToken *tok;
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrix
(ctx, a[0], protect_op, "protect",
exception);
@@ -5322,9 +5322,9 @@
if G_UNLIKELY ( ! check_argument_string_or_identifier (a, 0, "protect"))
return NULL;
- if (a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_IDENTIFIER_NODE) {
tok = a[0]->id.id;
- } else /* STRING_NODE */ {
+ } else /* GEL_STRING_NODE */ {
tok = d_intern (a[0]->str.str);
}
@@ -5338,7 +5338,7 @@
{
GelToken *tok;
- if (a[0]->type == MATRIX_NODE)
+ if (a[0]->type == GEL_MATRIX_NODE)
return gel_apply_func_to_matrix
(ctx, a[0], unprotect_op, "unprotect",
exception);
@@ -5346,9 +5346,9 @@
if G_UNLIKELY ( ! check_argument_string_or_identifier (a, 0, "unprotect"))
return NULL;
- if (a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_IDENTIFIER_NODE) {
tok = a[0]->id.id;
- } else /* STRING_NODE */ {
+ } else /* GEL_STRING_NODE */ {
tok = d_intern (a[0]->str.str);
}
@@ -5367,9 +5367,9 @@
if G_UNLIKELY ( ! check_argument_string_or_identifier (a, 0, "SetFunctionFlags"))
return NULL;
- if (a[0]->type == IDENTIFIER_NODE) {
+ if (a[0]->type == GEL_IDENTIFIER_NODE) {
tok = a[0]->id.id;
- } else /* STRING_NODE */ {
+ } else /* GEL_STRING_NODE */ {
tok = d_intern (a[0]->str.str);
}
@@ -5380,7 +5380,7 @@
}
for (i = 1; a[i] != NULL; i++) {
- if G_UNLIKELY (a[i]->type != STRING_NODE) {
+ if G_UNLIKELY (a[i]->type != GEL_STRING_NODE) {
gel_errorout (_("%s: flags argument must be a string"),
"SetFunctionFlags");
} else if (a[i]->str.str != NULL) {
@@ -5414,7 +5414,7 @@
GelETree *ret;
GelETree *args[2];
- arg.type = VALUE_NODE;
+ arg.type = GEL_VALUE_NODE;
arg.val.next = NULL;
mpw_init_set (arg.val.value, argnum);
@@ -5427,7 +5427,7 @@
if G_UNLIKELY (gel_error_num != 0 ||
ret == NULL ||
- ret->type != VALUE_NODE) {
+ ret->type != GEL_VALUE_NODE) {
gel_freetree (ret);
return FALSE;
}
@@ -5501,9 +5501,9 @@
do_neg = TRUE;
}
- if (a[0]->type == FUNCTION_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE) {
f = a[0]->func.func;
- } else /* (a[0]->type == IDENTIFIER_NODE) */ {
+ } else /* (a[0]->type == GEL_IDENTIFIER_NODE) */ {
f = d_lookup_global (a[0]->id.id);
}
@@ -5600,7 +5600,7 @@
static GelETree *
Parse_op (GelCtx *ctx, GelETree * * a, gboolean *exception)
{
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_null ();
if G_UNLIKELY ( ! check_argument_string (a, 0, "Parse"))
@@ -5619,7 +5619,7 @@
{
GelETree *et;
- if (a[0]->type == NULL_NODE)
+ if (a[0]->type == GEL_NULL_NODE)
return gel_makenum_null ();
if G_UNLIKELY ( ! check_argument_string (a, 0, "Evaluate"))
@@ -5788,9 +5788,9 @@
{
if G_UNLIKELY ( ! check_argument_bool (&a, 0, "set_ResultsAsFloats"))
return NULL;
- if (a->type == VALUE_NODE)
+ if (a->type == GEL_VALUE_NODE)
gel_calcstate.results_as_floats = ! mpw_zero_p (a->val.value);
- else /* a->type == BOOL_NODE */
+ else /* a->type == GEL_BOOL_NODE */
gel_calcstate.results_as_floats = a->bool_.bool_;
gel_set_state (gel_calcstate);
@@ -5806,9 +5806,9 @@
{
if G_UNLIKELY ( ! check_argument_bool (&a, 0, "set_ScientificNotation"))
return NULL;
- if (a->type == VALUE_NODE)
+ if (a->type == GEL_VALUE_NODE)
gel_calcstate.scientific_notation = ! mpw_zero_p (a->val.value);
- else /* a->type == BOOL_NODE */
+ else /* a->type == GEL_BOOL_NODE */
gel_calcstate.scientific_notation = a->bool_.bool_;
gel_set_state (gel_calcstate);
@@ -5824,9 +5824,9 @@
{
if G_UNLIKELY ( ! check_argument_bool (&a, 0, "set_FullExpressions"))
return NULL;
- if (a->type == VALUE_NODE)
+ if (a->type == GEL_VALUE_NODE)
gel_calcstate.full_expressions = ! mpw_zero_p (a->val.value);
- else /* a->type == BOOL_NODE */
+ else /* a->type == GEL_BOOL_NODE */
gel_calcstate.full_expressions = a->bool_.bool_;
gel_set_state (gel_calcstate);
@@ -5847,7 +5847,7 @@
if G_UNLIKELY ( ! check_argument_string_or_identifier (&a, 0, "set_OutputStyle"))
return NULL;
- if (a->type == STRING_NODE)
+ if (a->type == GEL_STRING_NODE)
token = a->str.str;
else
token = a->id.id->token;
@@ -5925,9 +5925,9 @@
{
if G_UNLIKELY ( ! check_argument_bool (&a, 0, "set_MixedFractions"))
return NULL;
- if (a->type == VALUE_NODE)
+ if (a->type == GEL_VALUE_NODE)
gel_calcstate.mixed_fractions = ! mpw_zero_p (a->val.value);
- else /* a->type == BOOL_NODE */
+ else /* a->type == GEL_BOOL_NODE */
gel_calcstate.mixed_fractions = a->bool_.bool_;
gel_set_state (gel_calcstate);
@@ -6365,13 +6365,13 @@
NULL);
_internal_exp_function = d_makeufunc(d_intern("<internal>exp"),
gel_parseexp
- ("s = float(x^0); "
- "fact = 1; "
- "for i = 1 to 100 do "
- "(fact = fact * x / i; "
- "s = s + fact) ; s",
- NULL, FALSE, FALSE,
- NULL, NULL),
+ ("s = float(x^0); "
+ "fact = 1; "
+ "for i = 1 to 100 do "
+ "(fact = fact * x / i; "
+ "s = s + fact) ; s",
+ NULL, FALSE, FALSE,
+ NULL, NULL),
g_slist_append(NULL,d_intern("x")),1,
NULL);
Modified: trunk/src/funclibhelper.cP
==============================================================================
--- trunk/src/funclibhelper.cP (original)
+++ trunk/src/funclibhelper.cP Sun Mar 15 05:01:35 2009
@@ -34,7 +34,7 @@
static inline gboolean
check_argument_integer (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != VALUE_NODE ||
+ if G_UNLIKELY (a[argnum]->type != GEL_VALUE_NODE ||
mpw_is_complex(a[argnum]->val.value) ||
! mpw_is_integer (a[argnum]->val.value)) {
gel_errorout (_("%s: argument number %d not an integer"), funcname, argnum+1);
@@ -46,10 +46,10 @@
static inline gboolean
check_argument_integer_or_matrix (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY ((a[argnum]->type != VALUE_NODE ||
+ if G_UNLIKELY ((a[argnum]->type != GEL_VALUE_NODE ||
mpw_is_complex(a[argnum]->val.value) ||
! mpw_is_integer (a[argnum]->val.value)) &&
- a[argnum]->type != MATRIX_NODE) {
+ a[argnum]->type != GEL_MATRIX_NODE) {
gel_errorout (_("%s: argument number %d not an integer or a matrix"), funcname, argnum+1);
return FALSE;
}
@@ -59,9 +59,9 @@
static inline gboolean
check_argument_null_or_number_or_matrix (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != VALUE_NODE &&
- a[argnum]->type != NULL_NODE &&
- a[argnum]->type != MATRIX_NODE) {
+ if G_UNLIKELY (a[argnum]->type != GEL_VALUE_NODE &&
+ a[argnum]->type != GEL_NULL_NODE &&
+ a[argnum]->type != GEL_MATRIX_NODE) {
gel_errorout (_("%s: argument number %d not a number or a matrix"), funcname, argnum+1);
return FALSE;
}
@@ -71,8 +71,8 @@
static inline gboolean
check_argument_number_or_matrix (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != VALUE_NODE &&
- a[argnum]->type != MATRIX_NODE) {
+ if G_UNLIKELY (a[argnum]->type != GEL_VALUE_NODE &&
+ a[argnum]->type != GEL_MATRIX_NODE) {
gel_errorout (_("%s: argument number %d not a number or a matrix"), funcname, argnum+1);
return FALSE;
}
@@ -82,7 +82,7 @@
static inline gboolean
check_argument_nonnegative_integer (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != VALUE_NODE ||
+ if G_UNLIKELY (a[argnum]->type != GEL_VALUE_NODE ||
mpw_is_complex(a[argnum]->val.value) ||
! mpw_is_integer (a[argnum]->val.value) ||
mpw_sgn (a[argnum]->val.value) < 0) {
@@ -96,7 +96,7 @@
static inline gboolean
check_argument_positive_integer (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != VALUE_NODE ||
+ if G_UNLIKELY (a[argnum]->type != GEL_VALUE_NODE ||
mpw_is_complex(a[argnum]->val.value) ||
! mpw_is_integer (a[argnum]->val.value) ||
mpw_sgn (a[argnum]->val.value) <= 0) {
@@ -109,7 +109,7 @@
static inline gboolean
check_argument_number (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type!=VALUE_NODE) {
+ if G_UNLIKELY (a[argnum]->type!=GEL_VALUE_NODE) {
gel_errorout (_("%s: argument number %d not a number"), funcname, argnum+1);
return FALSE;
}
@@ -119,8 +119,8 @@
static inline gboolean
check_argument_bool (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != VALUE_NODE &&
- a[argnum]->type != BOOL_NODE) {
+ if G_UNLIKELY (a[argnum]->type != GEL_VALUE_NODE &&
+ a[argnum]->type != GEL_BOOL_NODE) {
gel_errorout (_("%s: argument number %d not a boolean"), funcname, argnum+1);
return FALSE;
}
@@ -130,7 +130,7 @@
static inline gboolean
check_argument_real_number (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type!=VALUE_NODE ||
+ if G_UNLIKELY (a[argnum]->type!=GEL_VALUE_NODE ||
mpw_is_complex(a[argnum]->val.value)) {
gel_errorout (_("%s: argument number %d not a real number"), funcname, argnum+1);
return FALSE;
@@ -141,7 +141,7 @@
static inline gboolean
check_argument_matrix (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != MATRIX_NODE) {
+ if G_UNLIKELY (a[argnum]->type != GEL_MATRIX_NODE) {
gel_errorout (_("%s: argument number %d not a matrix"), funcname, argnum+1);
return FALSE;
}
@@ -151,7 +151,7 @@
static inline gboolean
check_argument_square_matrix (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != MATRIX_NODE ||
+ if G_UNLIKELY (a[argnum]->type != GEL_MATRIX_NODE ||
gel_matrixw_width (a[argnum]->mat.matrix) != gel_matrixw_height (a[argnum]->mat.matrix)) {
gel_errorout (_("%s: argument number %d not a square matrix"), funcname, argnum+1);
return FALSE;
@@ -162,8 +162,8 @@
static inline gboolean
check_argument_matrix_or_null (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != MATRIX_NODE &&
- a[argnum]->type != NULL_NODE) {
+ if G_UNLIKELY (a[argnum]->type != GEL_MATRIX_NODE &&
+ a[argnum]->type != GEL_NULL_NODE) {
gel_errorout (_("%s: argument number %d not a matrix or null node"), funcname, argnum+1);
return FALSE;
}
@@ -173,7 +173,7 @@
static inline gboolean
check_argument_value_only_matrix (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != MATRIX_NODE ||
+ if G_UNLIKELY (a[argnum]->type != GEL_MATRIX_NODE ||
! gel_is_matrix_value_only (a[argnum]->mat.matrix)) {
gel_errorout (_("%s: argument number %d not a value only matrix"), funcname, argnum+1);
return FALSE;
@@ -184,7 +184,7 @@
static inline gboolean
check_argument_value_only_vector (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != MATRIX_NODE ||
+ if G_UNLIKELY (a[argnum]->type != GEL_MATRIX_NODE ||
! gel_is_matrix_value_only (a[argnum]->mat.matrix) ||
! (gel_matrixw_width (a[argnum]->mat.matrix) == 1 ||
gel_matrixw_height (a[argnum]->mat.matrix) == 1)) {
@@ -197,7 +197,7 @@
static inline gboolean
check_argument_string (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != STRING_NODE) {
+ if G_UNLIKELY (a[argnum]->type != GEL_STRING_NODE) {
gel_errorout (_("%s: argument number %d not a string"), funcname, argnum+1);
return FALSE;
}
@@ -207,8 +207,8 @@
static inline gboolean
check_argument_string_or_identifier (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != STRING_NODE &&
- a[argnum]->type != IDENTIFIER_NODE) {
+ if G_UNLIKELY (a[argnum]->type != GEL_STRING_NODE &&
+ a[argnum]->type != GEL_IDENTIFIER_NODE) {
gel_errorout (_("%s: argument number %d not a string"), funcname, argnum+1);
return FALSE;
}
@@ -218,8 +218,8 @@
static inline gboolean
check_argument_function_or_identifier (GelETree **a, int argnum, const char *funcname)
{
- if G_UNLIKELY (a[argnum]->type != FUNCTION_NODE &&
- a[argnum]->type != IDENTIFIER_NODE) {
+ if G_UNLIKELY (a[argnum]->type != GEL_FUNCTION_NODE &&
+ a[argnum]->type != GEL_IDENTIFIER_NODE) {
gel_errorout (_("%s: argument number %d not a function or identifier"), funcname, argnum+1);
return FALSE;
}
Modified: trunk/src/gnome-genius.c
==============================================================================
--- trunk/src/gnome-genius.c (original)
+++ trunk/src/gnome-genius.c Sun Mar 15 05:01:35 2009
@@ -1267,7 +1267,7 @@
gel_output_string (md->out, "\n ");
gel_output_clear_string (md->out);
- if (func->data.user->type == MATRIX_NODE)
+ if (func->data.user->type == GEL_MATRIX_NODE)
any_matrix = TRUE;
gel_pretty_print_etree (md->out, func->data.user);
@@ -1473,13 +1473,13 @@
if (ans != NULL) {
if (ans->type == GEL_VARIABLE_FUNC) {
- if (ans->data.user->type == MATRIX_NODE)
+ if (ans->data.user->type == GEL_MATRIX_NODE)
wrap = FALSE;
gel_pretty_print_etree (out, ans->data.user);
} else {
/* ugly? maybe! */
GelETree n;
- n.type = FUNCTION_NODE;
+ n.type = GEL_FUNCTION_NODE;
n.any.next = NULL;
n.func.func = ans;
gel_pretty_print_etree (out, &n);
Modified: trunk/src/graphing.c
==============================================================================
--- trunk/src/graphing.c (original)
+++ trunk/src/graphing.c Sun Mar 15 05:01:35 2009
@@ -2139,7 +2139,7 @@
gel_error_num = 0;
/* only do one level of indirection to avoid infinite loops */
- if (ret != NULL && ret->type == FUNCTION_NODE) {
+ if (ret != NULL && ret->type == GEL_FUNCTION_NODE) {
if (ret->func.func->nargs == 3) {
GelETree *ret2;
ret2 = gel_funccall (ctx, ret->func.func, args, 3);
@@ -2159,7 +2159,7 @@
}
- if (ret == NULL || ret->type != VALUE_NODE) {
+ if (ret == NULL || ret->type != GEL_VALUE_NODE) {
*ex = TRUE;
gel_freetree (ret);
#ifdef HUGE_VAL
@@ -2205,7 +2205,7 @@
gel_error_num = 0;
/* only do one level of indirection to avoid infinite loops */
- if (ret != NULL && ret->type == FUNCTION_NODE) {
+ if (ret != NULL && ret->type == GEL_FUNCTION_NODE) {
if (ret->func.func->nargs == 2) {
GelETree *ret2;
ret2 = gel_funccall (ctx, ret->func.func, args, 2);
@@ -2224,7 +2224,7 @@
}
}
- if (ret == NULL || ret->type != VALUE_NODE) {
+ if (ret == NULL || ret->type != GEL_VALUE_NODE) {
*ex = TRUE;
gel_freetree (ret);
#ifdef HUGE_VAL
@@ -2268,7 +2268,7 @@
gel_error_num = 0;
/* only do one level of indirection to avoid infinite loops */
- if (ret != NULL && ret->type == FUNCTION_NODE) {
+ if (ret != NULL && ret->type == GEL_FUNCTION_NODE) {
if (ret->func.func->nargs == 1) {
GelETree *ret2;
ret2 = gel_funccall (ctx, ret->func.func, args, 1);
@@ -2288,7 +2288,7 @@
}
- if (ret == NULL || ret->type != VALUE_NODE) {
+ if (ret == NULL || ret->type != GEL_VALUE_NODE) {
*ex = TRUE;
gel_freetree (ret);
#ifdef HUGE_VAL
@@ -2333,7 +2333,7 @@
gel_error_num = 0;
/* only do one level of indirection to avoid infinite loops */
- if (ret != NULL && ret->type == FUNCTION_NODE) {
+ if (ret != NULL && ret->type == GEL_FUNCTION_NODE) {
if (ret->func.func->nargs == 1) {
GelETree *ret2;
ret2 = gel_funccall (ctx, ret->func.func, args, 1);
@@ -2356,7 +2356,7 @@
}
- if (ret == NULL || ret->type != VALUE_NODE) {
+ if (ret == NULL || ret->type != GEL_VALUE_NODE) {
*ex = TRUE;
gel_freetree (ret);
#ifdef HUGE_VAL
@@ -2757,7 +2757,7 @@
#define GET_DOUBLE(var,argnum,func) \
{ \
- if (a[argnum]->type != VALUE_NODE) { \
+ if (a[argnum]->type != GEL_VALUE_NODE) { \
gel_errorout (_("%s: argument number %d not a number"), func, argnum+1); \
return NULL; \
} \
@@ -2769,32 +2769,32 @@
{
GelETree *t;
- if (m->type != MATRIX_NODE ||
+ if (m->type != GEL_MATRIX_NODE ||
gel_matrixw_elements (m->mat.matrix) != 4) {
gel_errorout (_("Graph limits not given as a 4-vector"));
return FALSE;
}
t = gel_matrixw_vindex (m->mat.matrix, 0);
- if (t->type != VALUE_NODE) {
+ if (t->type != GEL_VALUE_NODE) {
gel_errorout (_("Graph limits not given as numbers"));
return FALSE;
}
*x1 = mpw_get_double (t->val.value);
t = gel_matrixw_vindex (m->mat.matrix, 1);
- if (t->type != VALUE_NODE) {
+ if (t->type != GEL_VALUE_NODE) {
gel_errorout (_("Graph limits not given as numbers"));
return FALSE;
}
*x2 = mpw_get_double (t->val.value);
t = gel_matrixw_vindex (m->mat.matrix, 2);
- if (t->type != VALUE_NODE) {
+ if (t->type != GEL_VALUE_NODE) {
gel_errorout (_("Graph limits not given as numbers"));
return FALSE;
}
*y1 = mpw_get_double (t->val.value);
t = gel_matrixw_vindex (m->mat.matrix, 3);
- if (t->type != VALUE_NODE) {
+ if (t->type != GEL_VALUE_NODE) {
gel_errorout (_("Graph limits not given as numbers"));
return FALSE;
}
@@ -2834,7 +2834,7 @@
GelMatrixW *m;
/*make us a new empty node*/
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
m = n->mat.matrix = gel_matrixw_new ();
n->mat.quoted = FALSE;
gel_matrixw_set_size (m, 4, 1);
@@ -2852,44 +2852,44 @@
{
GelETree *t;
- if (m->type != MATRIX_NODE ||
+ if (m->type != GEL_MATRIX_NODE ||
gel_matrixw_elements (m->mat.matrix) != 6) {
gel_errorout (_("Graph limits not given as a 6-vector"));
return FALSE;
}
t = gel_matrixw_vindex (m->mat.matrix, 0);
- if (t->type != VALUE_NODE) {
+ if (t->type != GEL_VALUE_NODE) {
gel_errorout (_("Graph limits not given as numbers"));
return FALSE;
}
*x1 = mpw_get_double (t->val.value);
t = gel_matrixw_vindex (m->mat.matrix, 1);
- if (t->type != VALUE_NODE) {
+ if (t->type != GEL_VALUE_NODE) {
gel_errorout (_("Graph limits not given as numbers"));
return FALSE;
}
*x2 = mpw_get_double (t->val.value);
t = gel_matrixw_vindex (m->mat.matrix, 2);
- if (t->type != VALUE_NODE) {
+ if (t->type != GEL_VALUE_NODE) {
gel_errorout (_("Graph limits not given as numbers"));
return FALSE;
}
*y1 = mpw_get_double (t->val.value);
t = gel_matrixw_vindex (m->mat.matrix, 3);
- if (t->type != VALUE_NODE) {
+ if (t->type != GEL_VALUE_NODE) {
gel_errorout (_("Graph limits not given as numbers"));
return FALSE;
}
*y2 = mpw_get_double (t->val.value);
t = gel_matrixw_vindex (m->mat.matrix, 4);
- if (t->type != VALUE_NODE) {
+ if (t->type != GEL_VALUE_NODE) {
gel_errorout (_("Graph limits not given as numbers"));
return FALSE;
}
*z1 = mpw_get_double (t->val.value);
t = gel_matrixw_vindex (m->mat.matrix, 5);
- if (t->type != VALUE_NODE) {
+ if (t->type != GEL_VALUE_NODE) {
gel_errorout (_("Graph limits not given as numbers"));
return FALSE;
}
@@ -2938,7 +2938,7 @@
GelMatrixW *m;
/*make us a new empty node*/
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
m = n->mat.matrix = gel_matrixw_new ();
n->mat.quoted = FALSE;
gel_matrixw_set_size (m, 6, 1);
@@ -5070,7 +5070,7 @@
i = 0;
- if (a[i] != NULL && a[i]->type != FUNCTION_NODE) {
+ if (a[i] != NULL && a[i]->type != GEL_FUNCTION_NODE) {
gel_errorout (_("%s: argument not a function"), "SurfacePlot");
goto whack_copied_funcs;
}
@@ -5080,7 +5080,7 @@
i++;
- if (a[i] != NULL && a[i]->type == FUNCTION_NODE) {
+ if (a[i] != NULL && a[i]->type == GEL_FUNCTION_NODE) {
gel_errorout (_("%s: only one function supported"), "SurfacePlot");
goto whack_copied_funcs;
}
@@ -5094,7 +5094,7 @@
z2 = surf_defz2;
if (a[i] != NULL) {
- if (a[i]->type == MATRIX_NODE) {
+ if (a[i]->type == GEL_MATRIX_NODE) {
if ( ! get_limits_from_matrix_surf (a[i], &x1, &x2, &y1, &y2, &z1, &z2))
goto whack_copied_funcs;
i++;
@@ -5323,7 +5323,7 @@
}
if G_UNLIKELY (a[0] == NULL ||
- a[0]->type != FUNCTION_NODE) {
+ a[0]->type != GEL_FUNCTION_NODE) {
gel_errorout (_("%s: First argument must be a function"),
"SlopefieldPlot");
return NULL;
@@ -5342,7 +5342,7 @@
/* Get window limits */
if (a[i] != NULL) {
- if (a[i]->type == MATRIX_NODE) {
+ if (a[i]->type == GEL_MATRIX_NODE) {
if ( ! get_limits_from_matrix (a[i], &x1, &x2, &y1, &y2))
goto whack_copied_funcs;
i++;
@@ -5433,8 +5433,8 @@
* valued */
if G_UNLIKELY (a[0] == NULL || a[1] == NULL ||
- a[0]->type != FUNCTION_NODE ||
- a[1]->type != FUNCTION_NODE) {
+ a[0]->type != GEL_FUNCTION_NODE ||
+ a[1]->type != GEL_FUNCTION_NODE) {
gel_errorout (_("%s: First two arguments must be functions"), "VectorfieldPlot");
return NULL;
}
@@ -5454,7 +5454,7 @@
/* Get window limits */
if (a[i] != NULL) {
- if (a[i]->type == MATRIX_NODE) {
+ if (a[i]->type == GEL_MATRIX_NODE) {
if ( ! get_limits_from_matrix (a[i], &x1, &x2, &y1, &y2))
goto whack_copied_funcs;
i++;
@@ -5548,14 +5548,14 @@
}
for (i = 0;
- i < MAXFUNC && a[i] != NULL && a[i]->type == FUNCTION_NODE;
+ i < MAXFUNC && a[i] != NULL && a[i]->type == GEL_FUNCTION_NODE;
i++) {
func[funcs] = d_copyfunc (a[i]->func.func);
func[funcs]->context = -1;
funcs++;
}
- if G_UNLIKELY (a[i] != NULL && a[i]->type == FUNCTION_NODE) {
+ if G_UNLIKELY (a[i] != NULL && a[i]->type == GEL_FUNCTION_NODE) {
gel_errorout (_("%s: only up to 10 functions supported"), "LinePlot");
goto whack_copied_funcs;
}
@@ -5572,7 +5572,7 @@
y2 = defy2;
if (a[i] != NULL) {
- if (a[i]->type == MATRIX_NODE) {
+ if (a[i]->type == GEL_MATRIX_NODE) {
if ( ! get_limits_from_matrix (a[i], &x1, &x2, &y1, &y2))
goto whack_copied_funcs;
i++;
@@ -5665,8 +5665,8 @@
}
if G_UNLIKELY (a[0] == NULL || a[1] == NULL ||
- a[0]->type != FUNCTION_NODE ||
- a[1]->type != FUNCTION_NODE) {
+ a[0]->type != GEL_FUNCTION_NODE ||
+ a[1]->type != GEL_FUNCTION_NODE) {
gel_errorout (_("%s: First two arguments must be functions"), "LinePlotParametric");
return NULL;
}
@@ -5708,7 +5708,7 @@
/* Get window limits */
if (a[i] != NULL) {
- if (a[i]->type == MATRIX_NODE) {
+ if (a[i]->type == GEL_MATRIX_NODE) {
if ( ! get_limits_from_matrix (a[i], &x1, &x2, &y1, &y2))
goto whack_copied_funcs;
i++;
@@ -5807,7 +5807,7 @@
}
if G_UNLIKELY (a[0] == NULL ||
- a[0]->type != FUNCTION_NODE) {
+ a[0]->type != GEL_FUNCTION_NODE) {
gel_errorout (_("%s: First argument must be a function"),
"LinePlotCParametric");
return NULL;
@@ -5848,7 +5848,7 @@
/* Get window limits */
if (a[i] != NULL) {
- if (a[i]->type == MATRIX_NODE) {
+ if (a[i]->type == GEL_MATRIX_NODE) {
if ( ! get_limits_from_matrix (a[i], &x1, &x2, &y1, &y2))
goto whack_copied_funcs;
i++;
@@ -6003,7 +6003,7 @@
nominmax = FALSE; \
}
- g_return_val_if_fail (a->type == MATRIX_NODE, FALSE);
+ g_return_val_if_fail (a->type == GEL_MATRIX_NODE, FALSE);
m = a->mat.matrix;
@@ -6132,7 +6132,7 @@
ensure_window (FALSE /* do_window_present */);
- if (a[0]->type == MATRIX_NODE) {
+ if (a[0]->type == GEL_MATRIX_NODE) {
if G_UNLIKELY ( ! get_line_numbers (a[0], &x, &y, &len,
&minx, &maxx, &miny, &maxy))
return NULL;
@@ -6167,8 +6167,8 @@
thickness = 2;
for (i = nextarg; a[i] != NULL; i++) {
- if G_LIKELY (a[i]->type == STRING_NODE ||
- a[i]->type == IDENTIFIER_NODE) {
+ if G_LIKELY (a[i]->type == GEL_STRING_NODE ||
+ a[i]->type == GEL_IDENTIFIER_NODE) {
GelToken *id;
static GelToken *colorid = NULL;
static GelToken *thicknessid = NULL;
@@ -6192,7 +6192,7 @@
noneid = d_intern ("none");
}
- if (a[i]->type == STRING_NODE)
+ if (a[i]->type == GEL_STRING_NODE)
id = d_intern (a[i]->str.str);
else
id = a[i]->id.id;
@@ -6205,9 +6205,9 @@
return NULL;
}
/* FIXME: helper routine for getting color */
- if (a[i+1]->type == STRING_NODE) {
+ if (a[i+1]->type == GEL_STRING_NODE) {
gdk_color_parse (a[i+1]->str.str, &color);
- } else if (a[i+1]->type == IDENTIFIER_NODE) {
+ } else if (a[i+1]->type == GEL_IDENTIFIER_NODE) {
gdk_color_parse (a[i+1]->id.id->token, &color);
} else {
gel_errorout (_("%s: Color must be a string"),
@@ -6237,18 +6237,18 @@
} else if (id == windowid) {
double x1, x2, y1, y2;
if G_UNLIKELY (a[i+1] == NULL ||
- (a[i+1]->type != STRING_NODE &&
- a[i+1]->type != IDENTIFIER_NODE &&
- a[i+1]->type != MATRIX_NODE)) {
+ (a[i+1]->type != GEL_STRING_NODE &&
+ a[i+1]->type != GEL_IDENTIFIER_NODE &&
+ a[i+1]->type != GEL_MATRIX_NODE)) {
gel_errorout (_("%s: No window specified"),
"LinePlotDrawLine");
g_free (x);
g_free (y);
return NULL;
}
- if ((a[i+1]->type == STRING_NODE &&
+ if ((a[i+1]->type == GEL_STRING_NODE &&
fitid == d_intern (a[i+1]->str.str)) ||
- (a[i+1]->type == IDENTIFIER_NODE &&
+ (a[i+1]->type == GEL_IDENTIFIER_NODE &&
fitid == a[i+1]->id.id)) {
x1 = minx;
x2 = maxx;
@@ -6284,15 +6284,15 @@
GelToken *astyleid;
if G_UNLIKELY (a[i+1] == NULL ||
- (a[i+1]->type != STRING_NODE &&
- a[i+1]->type != IDENTIFIER_NODE)) {
+ (a[i+1]->type != GEL_STRING_NODE &&
+ a[i+1]->type != GEL_IDENTIFIER_NODE)) {
gel_errorout (_("%s: arrow style should be \"origin\", \"end\", \"both\", or \"none\""),
"LinePlotDrawLine");
g_free (x);
g_free (y);
return NULL;
}
- if (a[i+1]->type == STRING_NODE)
+ if (a[i+1]->type == GEL_STRING_NODE)
astyleid = d_intern (a[i+1]->str.str);
else
astyleid = a[i+1]->id.id;
@@ -6467,10 +6467,10 @@
if G_UNLIKELY ( ! check_argument_bool (&a, 0, "set_VectorfieldNormalized"))
return NULL;
- if (a->type == VALUE_NODE)
+ if (a->type == GEL_VALUE_NODE)
vectorfield_normalize_arrow_length_parameter
= ! mpw_zero_p (a->val.value);
- else /* a->type == BOOL_NODE */
+ else /* a->type == GEL_BOOL_NODE */
vectorfield_normalize_arrow_length_parameter = a->bool_.bool_;
return gel_makenum_bool (vectorfield_normalize_arrow_length_parameter);
@@ -6491,10 +6491,10 @@
}
if G_UNLIKELY ( ! check_argument_bool (&a, 0, "set_LinePlotDrawLegend"))
return NULL;
- if (a->type == VALUE_NODE)
+ if (a->type == GEL_VALUE_NODE)
lineplot_draw_legends
= ! mpw_zero_p (a->val.value);
- else /* a->type == BOOL_NODE */
+ else /* a->type == GEL_BOOL_NODE */
lineplot_draw_legends = a->bool_.bool_;
if (line_plot != NULL) {
Modified: trunk/src/matop.c
==============================================================================
--- trunk/src/matop.c (original)
+++ trunk/src/matop.c Sun Mar 15 05:01:35 2009
@@ -46,7 +46,7 @@
for (j = 0; j < h; j++) {
for (i = 0; i < w; i++) {
GelETree *n = gel_matrixw_get_index(m,i,j);
- if(n && n->type != VALUE_NODE) {
+ if(n && n->type != GEL_VALUE_NODE) {
m->cached_value_only = 1;
m->value_only = 0;
m->cached_value_only_real = 1;
@@ -78,12 +78,12 @@
GelETree *n = gel_matrixw_get_index(m,i,j);
if ( ! n)
continue;
- if (n->type == BOOL_NODE) {
+ if (n->type == GEL_BOOL_NODE) {
got_bools = TRUE;
continue;
}
- if (n->type != VALUE_NODE) {
+ if (n->type != GEL_VALUE_NODE) {
m->cached_value_or_bool_only = 1;
m->value_or_bool_only = 0;
m->cached_value_only = 1;
@@ -122,7 +122,7 @@
for (i = 0; i < w; i++) {
GelETree *n = gel_matrixw_get_index(m,i,j);
if (n != NULL &&
- (n->type != VALUE_NODE ||
+ (n->type != GEL_VALUE_NODE ||
mpw_is_complex (n->val.value))) {
m->cached_value_only_real = 1;
m->value_only_real = 0;
@@ -149,7 +149,7 @@
for (i = 0; i < w; i++) {
GelETree *n = gel_matrixw_get_index(m,i,j);
if (n != NULL &&
- (n->type != VALUE_NODE ||
+ (n->type != GEL_VALUE_NODE ||
mpw_is_complex (n->val.value) ||
mpw_is_float (n->val.value))) {
m->cached_value_only_rational = 1;
@@ -177,7 +177,7 @@
for (i = 0; i < w; i++) {
GelETree *n = gel_matrixw_get_index(m,i,j);
if (n != NULL &&
- (n->type != VALUE_NODE ||
+ (n->type != GEL_VALUE_NODE ||
mpw_is_complex (n->val.value) ||
! mpw_is_integer (n->val.value))) {
m->cached_value_only_integer = 1;
@@ -214,17 +214,17 @@
GelETree *n = gel_matrixw_get_index (m, i, j);
if (n == NULL)
continue;
- if (n->type == VALUE_NODE) {
+ if (n->type == GEL_VALUE_NODE) {
if (mpw_is_complex (n->val.value))
mpw_conj (n->val.value, n->val.value);
} else {
GelETree *nn;
GEL_GET_NEW_NODE (nn);
- nn->type = OPERATOR_NODE;
- nn->op.oper = E_DIRECTCALL;
+ nn->type = GEL_OPERATOR_NODE;
+ nn->op.oper = GEL_E_DIRECTCALL;
GEL_GET_NEW_NODE (nn->op.args);
- nn->op.args->type = IDENTIFIER_NODE;
+ nn->op.args->type = GEL_IDENTIFIER_NODE;
nn->op.args->id.id = d_intern ("conj");
nn->op.args->any.next = n;
@@ -326,7 +326,7 @@
if (ctx->modulo != NULL) {
gel_mod_node (ctx, t);
/* can't mod so we have a singular matrix / system */
- if (t != NULL && t->type != VALUE_NODE)
+ if (t != NULL && t->type != GEL_VALUE_NODE)
ret = FALSE;
}
}
@@ -372,7 +372,7 @@
if (ctx->modulo != NULL && t2 != NULL) {
gel_mod_node (ctx, t2);
/* can't mod so we have a singular matrix / system */
- if (t2 != NULL && t2->type != VALUE_NODE)
+ if (t2 != NULL && t2->type != GEL_VALUE_NODE)
ret = FALSE;
}
}
@@ -545,7 +545,7 @@
gel_mod_node (ctx, t);
if (stopsing &&
t != NULL &&
- t->type != VALUE_NODE) {
+ t->type != GEL_VALUE_NODE) {
mpw_clear(tmp);
return FALSE;
}
Modified: trunk/src/matrixw.c
==============================================================================
--- trunk/src/matrixw.c (original)
+++ trunk/src/matrixw.c Sun Mar 15 05:01:35 2009
@@ -378,7 +378,7 @@
int mj = m->regy ? m->regy[j] : j;
GelETree *t = gel_matrix_index (old, mi, mj);
if (t != NULL &&
- (t->type != VALUE_NODE ||
+ (t->type != GEL_VALUE_NODE ||
! mpw_exact_zero_p (t->val.value)))
gel_matrix_index (m->m, i, j) = gel_copynode (t);
}
@@ -892,7 +892,7 @@
GelETree *n;
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_get_region (source, reg, &i, width, 1);
gel_matrix_index (mm, 0, i) = n;
@@ -930,7 +930,7 @@
GelETree *n;
GEL_GET_NEW_NODE (n);
- n->type = MATRIX_NODE;
+ n->type = GEL_MATRIX_NODE;
n->mat.matrix = gel_matrixw_get_region (source, &i, reg, 1, height);
n->mat.quoted = 0;
Modified: trunk/src/parse.y
==============================================================================
--- trunk/src/parse.y (original)
+++ trunk/src/parse.y Sun Mar 15 05:01:35 2009
@@ -124,14 +124,14 @@
| STARTTOK PWD '\n' { gel_command = GEL_PWD; YYACCEPT; }
| STARTTOK LOAD_PLUGIN '\n' { gel_command = GEL_LOADPLUGIN; gel_command_arg = $<id>2; YYACCEPT; }
| STARTTOK '\n' { YYACCEPT; }
- | STARTTOK expr SEPAR '\n' { gp_push_null(); PUSH_ACT(E_SEPAR); YYACCEPT; }
+ | STARTTOK expr SEPAR '\n' { gp_push_null(); PUSH_ACT(GEL_E_SEPAR); YYACCEPT; }
| error '\n' { gel_return_ret = TRUE; yyclearin; YYABORT; }
| error { gel_return_ret = TRUE; }
;
-expr: expr SEPAR expr { PUSH_ACT(E_SEPAR); }
- | expr MOD expr { PUSH_ACT(E_MOD_CALC); }
- | '(' expr SEPAR ')' { gp_push_null(); PUSH_ACT(E_SEPAR);
+expr: expr SEPAR expr { PUSH_ACT(GEL_E_SEPAR); }
+ | expr MOD expr { PUSH_ACT(GEL_E_MOD_CALC); }
+ | '(' expr SEPAR ')' { gp_push_null(); PUSH_ACT(GEL_E_SEPAR);
gp_push_spacer(); }
| '(' expr ')' { gp_push_spacer(); }
| '(' expr MAKEIMAGPARENTH { mpw_t i;
@@ -140,64 +140,64 @@
gp_push_spacer();
gel_stack_push(&gel_parsestack,
gel_makenum_use(i));
- PUSH_ACT(E_MUL); }
- | expr EQUALS expr { PUSH_ACT(E_EQUALS); }
- | expr DEFEQUALS expr { PUSH_ACT(E_DEFEQUALS); }
- | '|' expr '|' { PUSH_ACT(E_ABS); }
- | expr '+' expr { PUSH_ACT(E_PLUS); }
- | expr ELTELTPLUS expr { PUSH_ACT(E_ELTPLUS); }
- | expr '-' expr { PUSH_ACT(E_MINUS); }
- | expr ELTELTMINUS expr { PUSH_ACT(E_ELTMINUS); }
- | expr '*' expr { PUSH_ACT(E_MUL); }
- | expr ELTELTMUL expr { PUSH_ACT(E_ELTMUL); }
- | expr '/' expr { PUSH_ACT(E_DIV); }
- | expr ELTELTDIV expr { PUSH_ACT(E_ELTDIV); }
- | expr '\\' expr { PUSH_ACT(E_BACK_DIV); }
- | expr ELTELTBACKDIV expr { PUSH_ACT(E_ELT_BACK_DIV); }
- | expr '%' expr { PUSH_ACT(E_MOD); }
- | expr ELTELTMOD expr { PUSH_ACT(E_ELTMOD); }
- | expr CMP_CMP expr { PUSH_ACT(E_CMP_CMP); }
-
- | expr EQ_CMP expr { PUSH_ACT(E_EQ_CMP); }
- | expr NE_CMP expr { PUSH_ACT(E_NE_CMP); }
- | expr LT_CMP expr { PUSH_ACT(E_LT_CMP); }
- | expr GT_CMP expr { PUSH_ACT(E_GT_CMP); }
- | expr LE_CMP expr { PUSH_ACT(E_LE_CMP); }
- | expr GE_CMP expr { PUSH_ACT(E_GE_CMP); }
-
- | expr LOGICAL_AND expr { PUSH_ACT(E_LOGICAL_AND); }
- | expr LOGICAL_OR expr { PUSH_ACT(E_LOGICAL_OR); }
- | expr LOGICAL_XOR expr { PUSH_ACT(E_LOGICAL_XOR); }
- | LOGICAL_NOT expr { PUSH_ACT(E_LOGICAL_NOT); }
-
- /*| expr IN expr { PUSH_ACT(E_EXISTS_IN); }
- | expr LOGICAL_NOT IN expr { PUSH_ACT(E_NOT_EXISTS_IN); }*/
-
- | expr '!' { PUSH_ACT(E_FACT); }
- | expr DOUBLEFACT { PUSH_ACT(E_DBLFACT); }
- | expr '\'' { PUSH_ACT(E_CONJUGATE_TRANSPOSE); }
- | expr TRANSPOSE { PUSH_ACT(E_TRANSPOSE); }
- | '-' expr %prec UMINUS { PUSH_ACT(E_NEG); }
+ PUSH_ACT(GEL_E_MUL); }
+ | expr EQUALS expr { PUSH_ACT(GEL_E_EQUALS); }
+ | expr DEFEQUALS expr { PUSH_ACT(GEL_E_DEFEQUALS); }
+ | '|' expr '|' { PUSH_ACT(GEL_E_ABS); }
+ | expr '+' expr { PUSH_ACT(GEL_E_PLUS); }
+ | expr ELTELTPLUS expr { PUSH_ACT(GEL_E_ELTPLUS); }
+ | expr '-' expr { PUSH_ACT(GEL_E_MINUS); }
+ | expr ELTELTMINUS expr { PUSH_ACT(GEL_E_ELTMINUS); }
+ | expr '*' expr { PUSH_ACT(GEL_E_MUL); }
+ | expr ELTELTMUL expr { PUSH_ACT(GEL_E_ELTMUL); }
+ | expr '/' expr { PUSH_ACT(GEL_E_DIV); }
+ | expr ELTELTDIV expr { PUSH_ACT(GEL_E_ELTDIV); }
+ | expr '\\' expr { PUSH_ACT(GEL_E_BACK_DIV); }
+ | expr ELTELTBACKDIV expr { PUSH_ACT(GEL_E_ELT_BACK_DIV); }
+ | expr '%' expr { PUSH_ACT(GEL_E_MOD); }
+ | expr ELTELTMOD expr { PUSH_ACT(GEL_E_ELTMOD); }
+ | expr CMP_CMP expr { PUSH_ACT(GEL_E_CMP_CMP); }
+
+ | expr EQ_CMP expr { PUSH_ACT(GEL_E_EQ_CMP); }
+ | expr NE_CMP expr { PUSH_ACT(GEL_E_NE_CMP); }
+ | expr LT_CMP expr { PUSH_ACT(GEL_E_LT_CMP); }
+ | expr GT_CMP expr { PUSH_ACT(GEL_E_GT_CMP); }
+ | expr LE_CMP expr { PUSH_ACT(GEL_E_LE_CMP); }
+ | expr GE_CMP expr { PUSH_ACT(GEL_E_GE_CMP); }
+
+ | expr LOGICAL_AND expr { PUSH_ACT(GEL_E_LOGICAL_AND); }
+ | expr LOGICAL_OR expr { PUSH_ACT(GEL_E_LOGICAL_OR); }
+ | expr LOGICAL_XOR expr { PUSH_ACT(GEL_E_LOGICAL_XOR); }
+ | LOGICAL_NOT expr { PUSH_ACT(GEL_E_LOGICAL_NOT); }
+
+ /*| expr IN expr { PUSH_ACT(GEL_E_EXISTS_IN); }
+ | expr LOGICAL_NOT IN expr { PUSH_ACT(GEL_E_NOT_EXISTS_IN); }*/
+
+ | expr '!' { PUSH_ACT(GEL_E_FACT); }
+ | expr DOUBLEFACT { PUSH_ACT(GEL_E_DBLFACT); }
+ | expr '\'' { PUSH_ACT(GEL_E_CONJUGATE_TRANSPOSE); }
+ | expr TRANSPOSE { PUSH_ACT(GEL_E_TRANSPOSE); }
+ | '-' expr %prec UMINUS { PUSH_ACT(GEL_E_NEG); }
| '+' expr %prec UPLUS
- | expr '^' expr { PUSH_ACT(E_EXP); }
- | expr ELTELTEXP expr { PUSH_ACT(E_ELTEXP); }
+ | expr '^' expr { PUSH_ACT(GEL_E_EXP); }
+ | expr ELTELTEXP expr { PUSH_ACT(GEL_E_ELTEXP); }
| expr ':' expr {
if (gp_prepare_push_region_sep ()) {
- PUSH_ACT(E_REGION_SEP_BY);
+ PUSH_ACT(GEL_E_REGION_SEP_BY);
} else {
- PUSH_ACT(E_REGION_SEP);
+ PUSH_ACT(GEL_E_REGION_SEP);
}
}
| expr AT ':' ')' { /* FIXME: do nothing?, this is just a
get all */ }
- | expr AT expr ')' { PUSH_ACT(E_GET_VELEMENT); }
- | expr AT expr ',' expr ')' { PUSH_ACT(E_GET_ELEMENT); }
- | expr AT expr ',' ')' { PUSH_ACT(E_GET_ROW_REGION); }
- | expr AT expr ',' ':' ')' { PUSH_ACT(E_GET_ROW_REGION); }
- | expr AT ',' expr ')' { PUSH_ACT(E_GET_COL_REGION); }
- | expr AT ':' ',' expr ')' { PUSH_ACT(E_GET_COL_REGION); }
+ | expr AT expr ')' { PUSH_ACT(GEL_E_GET_VELEMENT); }
+ | expr AT expr ',' expr ')' { PUSH_ACT(GEL_E_GET_ELEMENT); }
+ | expr AT expr ',' ')' { PUSH_ACT(GEL_E_GET_ROW_REGION); }
+ | expr AT expr ',' ':' ')' { PUSH_ACT(GEL_E_GET_ROW_REGION); }
+ | expr AT ',' expr ')' { PUSH_ACT(GEL_E_GET_COL_REGION); }
+ | expr AT ':' ',' expr ')' { PUSH_ACT(GEL_E_GET_COL_REGION); }
| '[' matrixrows ']' { if(!gp_push_matrix(FALSE)) {SYNTAX_ERROR;} }
| '`' '[' matrixrows ']' { if(!gp_push_matrix(TRUE)) {SYNTAX_ERROR;} }
/*This next rule DOESN'T work right, we need some sort of connection
@@ -208,56 +208,56 @@
/*FIXME: vector */
| '(' exprlist ',' expr ')' {
if(!gp_push_matrix_row()) {SYNTAX_ERROR;}
- if(!gp_push_marker(MATRIX_START_NODE)) {SYNTAX_ERROR;}
+ if(!gp_push_marker(GEL_MATRIX_START_NODE)) {SYNTAX_ERROR;}
if(!gp_push_matrix(TRUE)) {SYNTAX_ERROR;}
}
| '{' exprlist '}' {SYNTAX_ERROR;}/*FIXME: set*/
| '`' '{' exprlist '}' {SYNTAX_ERROR;}/*FIXME: nonordered multiset*/
- | WHILE expr DO expr { PUSH_ACT(E_WHILE_CONS); }
- | UNTIL expr DO expr { PUSH_ACT(E_UNTIL_CONS); }
- | DO expr WHILE expr { PUSH_ACT(E_DOWHILE_CONS); }
- | DO expr UNTIL expr { PUSH_ACT(E_DOUNTIL_CONS); }
- | FOR ident anyequals expr TO expr DO expr { PUSH_ACT(E_FOR_CONS); }
- | FOR ident anyequals expr TO expr BY expr DO expr { PUSH_ACT(E_FORBY_CONS); }
- | FOR ident IN expr DO expr { PUSH_ACT(E_FORIN_CONS); }
- | SUM ident anyequals expr TO expr DO expr { PUSH_ACT(E_SUM_CONS); }
- | SUM ident anyequals expr TO expr BY expr DO expr { PUSH_ACT(E_SUMBY_CONS); }
- | SUM ident IN expr DO expr { PUSH_ACT(E_SUMIN_CONS); }
- | PROD ident anyequals expr TO expr DO expr { PUSH_ACT(E_PROD_CONS); }
- | PROD ident anyequals expr TO expr BY expr DO expr { PUSH_ACT(E_PRODBY_CONS); }
- | PROD ident IN expr DO expr { PUSH_ACT(E_PRODIN_CONS); }
- | IF expr THEN expr %prec LOWER_THEN_ELSE { PUSH_ACT(E_IF_CONS); }
- | IF expr THEN expr ELSE expr { PUSH_ACT(E_IFELSE_CONS); }
+ | WHILE expr DO expr { PUSH_ACT(GEL_E_WHILE_CONS); }
+ | UNTIL expr DO expr { PUSH_ACT(GEL_E_UNTIL_CONS); }
+ | DO expr WHILE expr { PUSH_ACT(GEL_E_DOWHILE_CONS); }
+ | DO expr UNTIL expr { PUSH_ACT(GEL_E_DOUNTIL_CONS); }
+ | FOR ident anyequals expr TO expr DO expr { PUSH_ACT(GEL_E_FOR_CONS); }
+ | FOR ident anyequals expr TO expr BY expr DO expr { PUSH_ACT(GEL_E_FORBY_CONS); }
+ | FOR ident IN expr DO expr { PUSH_ACT(GEL_E_FORIN_CONS); }
+ | SUM ident anyequals expr TO expr DO expr { PUSH_ACT(GEL_E_SUM_CONS); }
+ | SUM ident anyequals expr TO expr BY expr DO expr { PUSH_ACT(GEL_E_SUMBY_CONS); }
+ | SUM ident IN expr DO expr { PUSH_ACT(GEL_E_SUMIN_CONS); }
+ | PROD ident anyequals expr TO expr DO expr { PUSH_ACT(GEL_E_PROD_CONS); }
+ | PROD ident anyequals expr TO expr BY expr DO expr { PUSH_ACT(GEL_E_PRODBY_CONS); }
+ | PROD ident IN expr DO expr { PUSH_ACT(GEL_E_PRODIN_CONS); }
+ | IF expr THEN expr %prec LOWER_THEN_ELSE { PUSH_ACT(GEL_E_IF_CONS); }
+ | IF expr THEN expr ELSE expr { PUSH_ACT(GEL_E_IFELSE_CONS); }
| ident { gp_convert_identifier_to_bool ();
/* convert true/false to bool */}
- | '`' ident { PUSH_ACT(E_QUOTE); }
- | '&' ident { PUSH_ACT(E_REFERENCE); }
+ | '`' ident { PUSH_ACT(GEL_E_QUOTE); }
+ | '&' ident { PUSH_ACT(GEL_E_REFERENCE); }
| deref
- | ident '(' ')' { gp_push_marker_simple(EXPRLIST_START_NODE);
- PUSH_ACT(E_DIRECTCALL); }
- | ident '(' exprlist ')' { PUSH_ACT(E_DIRECTCALL); }
- | deref '(' ')' { gp_push_marker_simple(EXPRLIST_START_NODE);
- PUSH_ACT(E_DIRECTCALL); }
- | deref '(' exprlist ')' { PUSH_ACT(E_DIRECTCALL); }
- | expr CALL '(' exprlist ')' { PUSH_ACT(E_CALL); }
- | expr CALL '(' ')' { gp_push_marker_simple(EXPRLIST_START_NODE);
- PUSH_ACT(E_CALL); }
- | FUNCTION ident funcdef { PUSH_ACT(E_DEFEQUALS); }
+ | ident '(' ')' { gp_push_marker_simple(GEL_EXPRLIST_START_NODE);
+ PUSH_ACT(GEL_E_DIRECTCALL); }
+ | ident '(' exprlist ')' { PUSH_ACT(GEL_E_DIRECTCALL); }
+ | deref '(' ')' { gp_push_marker_simple(GEL_EXPRLIST_START_NODE);
+ PUSH_ACT(GEL_E_DIRECTCALL); }
+ | deref '(' exprlist ')' { PUSH_ACT(GEL_E_DIRECTCALL); }
+ | expr CALL '(' exprlist ')' { PUSH_ACT(GEL_E_CALL); }
+ | expr CALL '(' ')' { gp_push_marker_simple(GEL_EXPRLIST_START_NODE);
+ PUSH_ACT(GEL_E_CALL); }
+ | FUNCTION ident funcdef { PUSH_ACT(GEL_E_DEFEQUALS); }
| PARAMETER paramdef
| FUNCTION funcdef
| '`' funcdef
- | RETURNTOK expr { PUSH_ACT(E_RETURN); }
- | BAILOUT { PUSH_ACT(E_BAILOUT); }
- | EXCEPTION { PUSH_ACT(E_EXCEPTION); }
- | CONTINUE { PUSH_ACT(E_CONTINUE); }
- | BREAK { PUSH_ACT(E_BREAK); }
+ | RETURNTOK expr { PUSH_ACT(GEL_E_RETURN); }
+ | BAILOUT { PUSH_ACT(GEL_E_BAILOUT); }
+ | EXCEPTION { PUSH_ACT(GEL_E_EXCEPTION); }
+ | CONTINUE { PUSH_ACT(GEL_E_CONTINUE); }
+ | BREAK { PUSH_ACT(GEL_E_BREAK); }
| NUMBER { gel_stack_push(&gel_parsestack,
gel_makenum_use($<val>1)); }
| STRING { PUSH_CONST_STRING($<id>1); }
| '.' { gp_push_null(); }
;
-deref: '*' ident { PUSH_ACT(E_DEREFERENCE); }
+deref: '*' ident { PUSH_ACT(GEL_E_DEREFERENCE); }
;
ident: FUNCID { PUSH_IDENTIFIER($<id>1); }
@@ -265,11 +265,11 @@
paramdef: ident anyequals expr %prec EQUALS {
gp_prepare_push_param (FALSE);
- PUSH_ACT (E_PARAMETER);
+ PUSH_ACT (GEL_E_PARAMETER);
}
/*| '(' expr ')' ident EQUALS expr {
gp_prepare_push_param (TRUE);
- PUSH_ACT (E_PARAMETER);
+ PUSH_ACT (GEL_E_PARAMETER);
}*/
;
@@ -288,7 +288,7 @@
}
}
| '(' ')' anyequals expr %prec FUNCTION {
- if ( ! gp_push_marker (EXPRLIST_START_NODE)) {
+ if ( ! gp_push_marker (GEL_EXPRLIST_START_NODE)) {
SYNTAX_ERROR;
}
if ( ! gp_push_func (FALSE /* vararg */)) {
@@ -298,18 +298,18 @@
;
identlist: identlist ',' ident
- | ident { if(!gp_push_marker(EXPRLIST_START_NODE)) {SYNTAX_ERROR;} }
+ | ident { if(!gp_push_marker(GEL_EXPRLIST_START_NODE)) {SYNTAX_ERROR;} }
;
exprlist: exprlist ',' expr
/* We ignore the NEXTROW mark after a comma as it's just a return
* breaking a long vector */
| exprlist ',' NEXTROW expr
- | expr { if(!gp_push_marker(EXPRLIST_START_NODE)) {SYNTAX_ERROR;} }
+ | expr { if(!gp_push_marker(GEL_EXPRLIST_START_NODE)) {SYNTAX_ERROR;} }
;
matrixrows: matrixrows NEXTROW exprlist { if(!gp_push_matrix_row()) {SYNTAX_ERROR;} }
- | exprlist { if(!gp_push_matrix_row()) {SYNTAX_ERROR;} if(!gp_push_marker(MATRIX_START_NODE)) {SYNTAX_ERROR;} }
+ | exprlist { if(!gp_push_matrix_row()) {SYNTAX_ERROR;} if(!gp_push_marker(GEL_MATRIX_START_NODE)) {SYNTAX_ERROR;} }
;
%%
Modified: trunk/src/parseutil.c
==============================================================================
--- trunk/src/parseutil.c (original)
+++ trunk/src/parseutil.c Sun Mar 15 05:01:35 2009
@@ -52,13 +52,13 @@
for(;;) {
tree = gel_stack_pop(&gel_parsestack);
- if(tree && tree->type==EXPRLIST_START_NODE) {
+ if(tree && tree->type==GEL_EXPRLIST_START_NODE) {
gel_freetree(tree);
break;
}
/*we have gone all the way to the top and haven't found a
marker or tree is not an ident node*/
- if(!tree || tree->type != IDENTIFIER_NODE) {
+ if(!tree || tree->type != GEL_IDENTIFIER_NODE) {
if(tree) gel_freetree(tree);
g_slist_foreach(list,(GFunc)gel_freetree,NULL);
g_slist_free(list);
@@ -71,7 +71,7 @@
GEL_GET_NEW_NODE(tree);
- tree->type = FUNCTION_NODE;
+ tree->type = GEL_FUNCTION_NODE;
tree->func.func = d_makeufunc(NULL,val,list,i, NULL);
tree->func.func->context = -1;
tree->func.func->vararg = vararg;
@@ -117,8 +117,8 @@
e2 = gel_stack_pop (&gel_parsestack);
e1 = gel_stack_pop (&gel_parsestack);
- if (e2->type == OPERATOR_NODE &&
- e2->op.oper == E_REGION_SEP) {
+ if (e2->type == GEL_OPERATOR_NODE &&
+ e2->op.oper == GEL_E_REGION_SEP) {
GelETree *a1 = e2->op.args;
GelETree *a2 = e2->op.args->any.next;
a1->any.next = NULL;
@@ -175,12 +175,12 @@
if(!last_expr)
return FALSE;
- else if(last_expr->type == SPACER_NODE)
+ else if(last_expr->type == GEL_SPACER_NODE)
gel_stack_push(&gel_parsestack,last_expr);
else {
GelETree * tree;
GEL_GET_NEW_NODE(tree);
- tree->type = SPACER_NODE;
+ tree->type = GEL_SPACER_NODE;
tree->sp.arg = last_expr;
gel_stack_push(&gel_parsestack,tree);
}
@@ -188,7 +188,7 @@
}
/*gather all expressions up until a row start marker and push the
- result as a MATRIX_ROW_NODE*/
+ result as a GEL_MATRIX_ROW_NODE*/
gboolean
gp_push_matrix_row(void)
{
@@ -207,7 +207,7 @@
}
return FALSE;
}
- if(tree->type==EXPRLIST_START_NODE) {
+ if(tree->type==GEL_EXPRLIST_START_NODE) {
gel_freetree(tree);
break;
}
@@ -216,7 +216,7 @@
i++;
}
GEL_GET_NEW_NODE(tree);
- tree->type = MATRIX_ROW_NODE;
+ tree->type = GEL_MATRIX_ROW_NODE;
tree->row.args = row;
tree->row.nargs = i;
@@ -258,10 +258,10 @@
g_slist_free(rowl);
/**/g_warning("BAD MATRIX, NO START MARKER");
return FALSE;
- } else if(tree->type==MATRIX_START_NODE) {
+ } else if(tree->type==GEL_MATRIX_START_NODE) {
gel_freetree(tree);
break;
- } else if(tree->type==MATRIX_ROW_NODE) {
+ } else if(tree->type==GEL_MATRIX_ROW_NODE) {
if(tree->row.nargs>cols)
cols = tree->row.nargs;
rowl = g_slist_prepend(rowl,tree->row.args);
@@ -306,7 +306,7 @@
g_slist_free(rowl);
GEL_GET_NEW_NODE(tree);
- tree->type = MATRIX_NODE;
+ tree->type = GEL_MATRIX_NODE;
tree->mat.matrix = gel_matrixw_new_with_matrix(matrix);
tree->mat.quoted = quoted ? 1 : 0;
@@ -321,7 +321,7 @@
{
GelETree *tree;
GEL_GET_NEW_NODE(tree);
- tree->type = NULL_NODE;
+ tree->type = GEL_NULL_NODE;
gel_stack_push(&gel_parsestack,tree);
}
@@ -333,7 +333,7 @@
val = gel_stack_peek (&gel_parsestack);
if (val == NULL ||
- val->type != IDENTIFIER_NODE) {
+ val->type != GEL_IDENTIFIER_NODE) {
/**/g_warning ("NO IDENTIFIER TO CONVERT TO TRY TO CONVERT BOOL");
return;
}
Modified: trunk/src/parseutil.h
==============================================================================
--- trunk/src/parseutil.h (original)
+++ trunk/src/parseutil.h Sun Mar 15 05:01:35 2009
@@ -41,7 +41,7 @@
gboolean gp_push_spacer(void) GEL_WEAK_FUNC;
/*gather all expressions up until a row start marker and push the
- result as a MATRIX_ROW_NODE*/
+ result as a GEL_MATRIX_ROW_NODE*/
gboolean gp_push_matrix_row(void) GEL_WEAK_FUNC;
/*gather all expressions up until a row start marker and push the
@@ -63,7 +63,7 @@
#define PUSH_IDENTIFIER(ID) { \
GelETree * tree; \
GEL_GET_NEW_NODE(tree); \
- tree->type = IDENTIFIER_NODE; \
+ tree->type = GEL_IDENTIFIER_NODE; \
tree->id.id = d_intern(ID); \
gel_stack_push(&gel_parsestack,tree); \
g_free (ID); \
Modified: trunk/src/structs.h
==============================================================================
--- trunk/src/structs.h (original)
+++ trunk/src/structs.h Sun Mar 15 05:01:35 2009
@@ -19,8 +19,8 @@
* USA.
*/
-#ifndef STRUCTS_H
-#define STRUCTS_H
+#ifndef _GEL_STRUCTS_H
+#define _GEL_STRUCTS_H
#include <stdio.h>
#include "mpwrap.h"
@@ -123,24 +123,24 @@
};
typedef enum {
- NULL_NODE=0,
- VALUE_NODE,
- MATRIX_NODE,
- SET_NODE, /* FIXME: Note implemented */
- POLYNOMIAL_NODE, /* FIXME: Note implemented */
- OPERATOR_NODE,
- IDENTIFIER_NODE,
- STRING_NODE,
- FUNCTION_NODE, /*stores an anonymous function*/
- COMPARISON_NODE,
- USERTYPE_NODE, /*for user types, FIXME: not finished*/
- BOOL_NODE, /*boolean*/
+ GEL_NULL_NODE=0,
+ GEL_VALUE_NODE,
+ GEL_MATRIX_NODE,
+ GEL_SET_NODE, /* FIXME: Note implemented */
+ GEL_POLYNOMIAL_NODE, /* FIXME: Note implemented */
+ GEL_OPERATOR_NODE,
+ GEL_IDENTIFIER_NODE,
+ GEL_STRING_NODE,
+ GEL_FUNCTION_NODE, /*stores an anonymous function*/
+ GEL_COMPARISON_NODE,
+ GEL_USERTYPE_NODE, /*for user types, FIXME: not finished*/
+ GEL_BOOL_NODE, /*boolean*/
/*marker nodes*/
- MATRIX_ROW_NODE=1000,
- MATRIX_START_NODE,
- EXPRLIST_START_NODE,
- SPACER_NODE
+ GEL_MATRIX_ROW_NODE=1000,
+ GEL_MATRIX_START_NODE,
+ GEL_EXPRLIST_START_NODE,
+ GEL_SPACER_NODE
} GelETreeType;
struct _GelETreeAny {
@@ -307,6 +307,78 @@
GelETreeSpacer sp;
};
+/* builtin primitives (operator node type) */
+enum {
+ GEL_E_SEPAR = 0,
+ GEL_E_EQUALS, /* see E_DEFEQUALS (on the end not to break bincompat) */
+ GEL_E_PARAMETER,
+ GEL_E_ABS,
+ GEL_E_PLUS,
+ GEL_E_ELTPLUS,
+ GEL_E_MINUS,
+ GEL_E_ELTMINUS,
+ GEL_E_MUL,
+ GEL_E_ELTMUL,
+ GEL_E_DIV,
+ GEL_E_ELTDIV,
+ GEL_E_BACK_DIV,
+ GEL_E_ELT_BACK_DIV,
+ GEL_E_MOD,
+ GEL_E_ELTMOD,
+ GEL_E_NEG,
+ GEL_E_EXP,
+ GEL_E_ELTEXP,
+ GEL_E_FACT,
+ GEL_E_DBLFACT,
+ GEL_E_TRANSPOSE,
+ GEL_E_CONJUGATE_TRANSPOSE,
+ GEL_E_IF_CONS,
+ GEL_E_IFELSE_CONS,
+ GEL_E_WHILE_CONS,
+ GEL_E_UNTIL_CONS,
+ GEL_E_DOWHILE_CONS,
+ GEL_E_DOUNTIL_CONS,
+ GEL_E_FOR_CONS,
+ GEL_E_FORBY_CONS,
+ GEL_E_FORIN_CONS,
+ GEL_E_SUM_CONS,
+ GEL_E_SUMBY_CONS,
+ GEL_E_SUMIN_CONS,
+ GEL_E_PROD_CONS,
+ GEL_E_PRODBY_CONS,
+ GEL_E_PRODIN_CONS,
+ GEL_E_EQ_CMP,
+ GEL_E_NE_CMP,
+ GEL_E_CMP_CMP,
+ GEL_E_LT_CMP,
+ GEL_E_GT_CMP,
+ GEL_E_LE_CMP,
+ GEL_E_GE_CMP,
+ GEL_E_LOGICAL_AND,
+ GEL_E_LOGICAL_OR,
+ GEL_E_LOGICAL_XOR,
+ GEL_E_LOGICAL_NOT,
+ GEL_E_REGION_SEP,
+ GEL_E_REGION_SEP_BY,
+ GEL_E_GET_VELEMENT,
+ GEL_E_GET_ELEMENT,
+ GEL_E_GET_ROW_REGION,
+ GEL_E_GET_COL_REGION,
+ GEL_E_QUOTE,
+ GEL_E_REFERENCE,
+ GEL_E_DEREFERENCE,
+ GEL_E_DIRECTCALL,
+ GEL_E_CALL,
+ GEL_E_RETURN,
+ GEL_E_BAILOUT,
+ GEL_E_EXCEPTION,
+ GEL_E_CONTINUE,
+ GEL_E_BREAK,
+ GEL_E_MOD_CALC,
+ GEL_E_DEFEQUALS,
+ GEL_E_OPER_LAST
+};
+
/* Evaluation stack */
/* The flag for the stack */
@@ -431,4 +503,4 @@
typedef void (*GelHookFunc) (void);
-#endif /* STRUCTS_H */
+#endif /* _GEL_STRUCTS_H */
Modified: trunk/src/symbolic.c
==============================================================================
--- trunk/src/symbolic.c (original)
+++ trunk/src/symbolic.c Sun Mar 15 05:01:35 2009
@@ -160,13 +160,13 @@
if (expr == NULL)
return;
- if (expr->type == SPACER_NODE) {
+ if (expr->type == GEL_SPACER_NODE) {
substitute_x_y_z_w (expr->sp.arg,
xtok, x, xcopy,
ytok, y, ycopy,
ztok, z, zcopy,
wtok, w, wcopy);
- } else if (expr->type == IDENTIFIER_NODE ) {
+ } else if (expr->type == GEL_IDENTIFIER_NODE ) {
if (xtok != NULL && x != NULL && expr->id.id == xtok) {
gel_replacenode (expr, x, xcopy);
} else if (ytok != NULL && y != NULL && expr->id.id == ytok) {
@@ -176,7 +176,7 @@
} else if (wtok != NULL && w != NULL && expr->id.id == wtok) {
gel_replacenode (expr, w, wcopy);
}
- } else if (expr->type == OPERATOR_NODE) {
+ } else if (expr->type == GEL_OPERATOR_NODE) {
GelETree *args = expr->op.args;
while (args != NULL) {
substitute_x_y_z_w (args,
@@ -186,7 +186,7 @@
wtok, w, wcopy);
args = args->any.next;
}
- } else if (expr->type == MATRIX_NODE &&
+ } else if (expr->type == GEL_MATRIX_NODE &&
expr->mat.matrix != NULL) {
int i, j;
int mw, mh;
@@ -204,7 +204,7 @@
wtok, w, wcopy);
}
}
- } else if (expr->type == SET_NODE ) {
+ } else if (expr->type == GEL_SET_NODE ) {
GelETree *ali;
for (ali = expr->set.items; ali != NULL; ali = ali->any.next) {
substitute_x_y_z_w (ali,
@@ -214,7 +214,7 @@
wtok, w, wcopy);
}
/* Not inside function body I don't think
- } else if (expr->type == FUNCTION_NODE &&
+ } else if (expr->type == GEL_FUNCTION_NODE &&
(expr->func.func->type == GEL_USER_FUNC ||
expr->func.func->type == GEL_VARIABLE_FUNC) &&
ENSURE BODY! expr->func.func->data.user != NULL) {
@@ -251,8 +251,8 @@
static gboolean
is_constant (GelETree *expr, GelToken *xtok)
{
- if (expr->type == VALUE_NODE ||
- (expr->type == IDENTIFIER_NODE &&
+ if (expr->type == GEL_VALUE_NODE ||
+ (expr->type == GEL_IDENTIFIER_NODE &&
expr->id.id != xtok)) {
return TRUE;
}
@@ -281,15 +281,15 @@
GelETree *n, *nn, *nnn;
switch (expr->op.oper) {
- case E_EXP:
- /* FIXME: case E_ELTEXP: */
+ case GEL_E_EXP:
+ /* FIXME: case GEL_E_ELTEXP: */
if (is_constant (expr->op.args, xtok)) {
nnn = differentiate_expr (expr->op.args->any.next, xtok);
if (nnn == NULL) {
/* FIXME: */
return NULL;
}
- if (expr->op.args->type == IDENTIFIER_NODE &&
+ if (expr->op.args->type == GEL_IDENTIFIER_NODE &&
expr->op.args->id.id == d_intern ("e")) {
n = PARSE ("(x^y)*dy");
} else {
@@ -308,7 +308,7 @@
/* FIXME: */
return NULL;
}
- if (expr->op.args->any.next->type == VALUE_NODE) {
+ if (expr->op.args->any.next->type == GEL_VALUE_NODE) {
GelETree *ymo = NULL;
mpw_t val;
if (mpw_zero_p (expr->op.args->any.next->val.value)) {
@@ -318,7 +318,7 @@
mpw_init (val);
mpw_sub_ui (val,
expr->op.args->any.next->val.value, 1);
- if (nn->type == VALUE_NODE &&
+ if (nn->type == GEL_VALUE_NODE &&
mpw_eql_ui (nn->val.value, 1)) {
if (mpw_zero_p (val)) {
n = gel_makenum_ui (1);
@@ -347,7 +347,7 @@
d_intern ("ymo"), ymo, FALSE);
return n;
}
- if (nn->type == VALUE_NODE &&
+ if (nn->type == GEL_VALUE_NODE &&
mpw_eql_ui (nn->val.value, 1)) {
n = PARSE ("y*x^(y-1)");
gel_freetree (nn);
@@ -382,7 +382,7 @@
d_intern ("dy"), nnn, FALSE);
return n;
- case E_ABS:
+ case GEL_E_ABS:
if (is_constant (expr->op.args, xtok))
return gel_makenum_ui (0);
nn = differentiate_expr (expr->op.args, xtok);
@@ -395,10 +395,10 @@
d_intern ("x"), expr->op.args, TRUE,
d_intern ("y"), nn, FALSE);
return n;
- case E_PLUS:
- /* FIXME: case E_ELTPLUS: */
- case E_MINUS:
- /* FIXME: case E_ELTMINUS: */
+ case GEL_E_PLUS:
+ /* FIXME: case GEL_E_ELTPLUS: */
+ case GEL_E_MINUS:
+ /* FIXME: case GEL_E_ELTMINUS: */
nn = differentiate_expr (expr->op.args, xtok);
if (nn == NULL) {
/* FIXME: */
@@ -411,15 +411,15 @@
return NULL;
}
GEL_GET_NEW_NODE(n);
- n->type = OPERATOR_NODE;
+ n->type = GEL_OPERATOR_NODE;
n->op.oper = expr->op.oper;
n->op.args = nn;
n->op.args->any.next = nnn;
n->op.args->any.next->any.next = NULL;
n->op.nargs = 2;
return n;
- case E_MUL:
- /* FIXME: case E_ELTMUL: */
+ case GEL_E_MUL:
+ /* FIXME: case GEL_E_ELTMUL: */
if (is_constant (expr->op.args, xtok)) {
nnn = differentiate_expr (expr->op.args->any.next, xtok);
if (nnn == NULL) {
@@ -427,7 +427,7 @@
return NULL;
}
GEL_GET_NEW_NODE(n);
- n->type = OPERATOR_NODE;
+ n->type = GEL_OPERATOR_NODE;
n->op.oper = expr->op.oper;
n->op.args = gel_copynode (expr->op.args);
n->op.args->any.next = nnn;
@@ -441,7 +441,7 @@
return NULL;
}
GEL_GET_NEW_NODE(n);
- n->type = OPERATOR_NODE;
+ n->type = GEL_OPERATOR_NODE;
n->op.oper = expr->op.oper;
n->op.args = nn;
n->op.args->any.next = gel_copynode (expr->op.args->any.next);
@@ -467,8 +467,8 @@
d_intern ("dx"), nn, FALSE,
d_intern ("dy"), nnn, FALSE);
return n;
- case E_DIV:
- /* FIXME: case E_ELTDIV: */
+ case GEL_E_DIV:
+ /* FIXME: case GEL_E_ELTDIV: */
if (is_constant (expr->op.args->any.next, xtok)) {
nn = differentiate_expr (expr->op.args, xtok);
if (nn == NULL) {
@@ -476,7 +476,7 @@
return NULL;
}
GEL_GET_NEW_NODE(n);
- n->type = OPERATOR_NODE;
+ n->type = GEL_OPERATOR_NODE;
n->op.oper = expr->op.oper;
n->op.args = nn;
n->op.args->any.next = gel_copynode (expr->op.args->any.next);
@@ -496,7 +496,7 @@
return NULL;
}
/* FIXME: is this better idea then is_constant? */
- if (nn->type == VALUE_NODE &&
+ if (nn->type == GEL_VALUE_NODE &&
mpw_zero_p (nn->val.value)) {
gel_freetree (nn);
nn = NULL;
@@ -510,26 +510,26 @@
d_intern ("dx"), nn, FALSE,
d_intern ("dy"), nnn, FALSE);
return n;
- /* FIXME: case E_BACK_DIV: */
- /* FIXME: case E_ELT_BACK_DIV: */
- case E_NEG:
+ /* FIXME: case GEL_E_BACK_DIV: */
+ /* FIXME: case GEL_E_ELT_BACK_DIV: */
+ case GEL_E_NEG:
nn = differentiate_expr (expr->op.args, xtok);
if (nn == NULL) {
/* FIXME: */
return NULL;
}
GEL_GET_NEW_NODE(n);
- n->type = OPERATOR_NODE;
+ n->type = GEL_OPERATOR_NODE;
n->op.oper = expr->op.oper;
n->op.args = nn;
n->op.args->any.next = NULL;
n->op.nargs = 1;
return n;
- case E_CALL:
- case E_DIRECTCALL:
- if (expr->op.args->type != IDENTIFIER_NODE &&
- expr->op.args->type != FUNCTION_NODE) {
+ case GEL_E_CALL:
+ case GEL_E_DIRECTCALL:
+ if (expr->op.args->type != GEL_IDENTIFIER_NODE &&
+ expr->op.args->type != GEL_FUNCTION_NODE) {
/* FIXME: */
return NULL;
}
@@ -541,9 +541,9 @@
if (is_constant (expr->op.args->any.next, xtok)) {
return gel_makenum_ui (0);
}
- if (expr->op.args->type == IDENTIFIER_NODE) {
+ if (expr->op.args->type == GEL_IDENTIFIER_NODE) {
ftok = get_symbolic_id (expr->op.args->id.id);
- } else /* if (expr->op.args->type == FUNCTION_NODE) */ {
+ } else /* if (expr->op.args->type == GEL_FUNCTION_NODE) */ {
GelEFunc *f = expr->op.args->func.func;
if (f->symbolic_id != NULL)
ftok = f->symbolic_id;
@@ -567,11 +567,11 @@
}
substitute_x (nn, d_intern ("x"), expr->op.args->any.next, TRUE);
- if (nnn->type == VALUE_NODE &&
+ if (nnn->type == GEL_VALUE_NODE &&
mpw_eql_ui (nnn->val.value, 1)) {
gel_freetree (nnn);
return nn;
- } else if (nnn->type == VALUE_NODE &&
+ } else if (nnn->type == GEL_VALUE_NODE &&
mpw_zero_p (nnn->val.value)) {
gel_freetree (nnn);
gel_freetree (nn);
@@ -579,8 +579,8 @@
}
GEL_GET_NEW_NODE (n);
- n->type = OPERATOR_NODE;
- n->op.oper = E_MUL;
+ n->type = GEL_OPERATOR_NODE;
+ n->op.oper = GEL_E_MUL;
n->op.args = nn;
n->op.args->any.next = nnn;
n->op.args->any.next->any.next = NULL;
@@ -612,14 +612,14 @@
if (expr == NULL) {
return NULL;
- } else if (expr->type == VALUE_NODE) {
+ } else if (expr->type == GEL_VALUE_NODE) {
return gel_makenum_ui (0);
- } else if (expr->type == IDENTIFIER_NODE) {
+ } else if (expr->type == GEL_IDENTIFIER_NODE) {
if (expr->id.id == xtok)
return gel_makenum_ui (1);
else
return gel_makenum_ui (0);
- } else if (expr->type == OPERATOR_NODE) {
+ } else if (expr->type == GEL_OPERATOR_NODE) {
return differentiate_oper (expr, xtok);
} else {
/* FIXME: complain about this more finegraindly? */
@@ -711,9 +711,9 @@
if G_UNLIKELY ( ! check_argument_function_or_identifier (a, 0, "SymbolicDerivative"))
return NULL;
- if (a[0]->type == FUNCTION_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE) {
f = a[0]->func.func;
- } else /* (a[0]->type == IDENTIFIER_NODE) */ {
+ } else /* (a[0]->type == GEL_IDENTIFIER_NODE) */ {
f = d_lookup_global (a[0]->id.id);
}
@@ -727,7 +727,7 @@
rf = gel_differentiate_func (f);
if (rf != NULL) {
GEL_GET_NEW_NODE (n);
- n->type = FUNCTION_NODE;
+ n->type = GEL_FUNCTION_NODE;
n->func.func = rf;
return n;
} else {
@@ -761,9 +761,9 @@
if G_UNLIKELY ( ! check_argument_function_or_identifier (a, 0, "SimplifyFunction"))
return NULL;
- if (a[0]->type == FUNCTION_NODE) {
+ if (a[0]->type == GEL_FUNCTION_NODE) {
f = a[0]->func.func;
- } else /* (a[0]->type == IDENTIFIER_NODE) */ {
+ } else /* (a[0]->type == GEL_IDENTIFIER_NODE) */ {
f = d_lookup_global (a[0]->id.id);
}
Modified: trunk/src/utype.c
==============================================================================
--- trunk/src/utype.c (original)
+++ trunk/src/utype.c Sun Mar 15 05:01:35 2009
@@ -148,7 +148,7 @@
GEL_GET_NEW_NODE(n);
- n->type = USERTYPE_NODE;
+ n->type = GEL_USERTYPE_NODE;
n->ut.next = NULL;
n->ut.ttype = ut->type;
n->ut.data = data;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]