version 1.42, 2004/03/12 02:15:23 |
version 1.47, 2004/07/07 07:40:19 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/strobj.c,v 1.41 2004/03/12 02:06:48 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/strobj.c,v 1.46 2004/03/25 01:56:00 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 75 void Pstring_to_tb(); |
|
Line 75 void Pstring_to_tb(); |
|
void Pquotetotex_tb(); |
void Pquotetotex_tb(); |
void Pquotetotex(); |
void Pquotetotex(); |
void Pquotetotex_env(); |
void Pquotetotex_env(); |
|
void Pflatten_quote(); |
void fnodetotex_tb(FNODE f,TB tb); |
void fnodetotex_tb(FNODE f,TB tb); |
char *symbol_name(char *name); |
char *symbol_name(char *name); |
char *conv_rule(char *name); |
char *conv_rule(char *name); |
Line 101 struct ftab str_tab[] = { |
|
Line 102 struct ftab str_tab[] = { |
|
{"quotetotex_tb",Pquotetotex_tb,2}, |
{"quotetotex_tb",Pquotetotex_tb,2}, |
{"quotetotex",Pquotetotex,1}, |
{"quotetotex",Pquotetotex,1}, |
{"quotetotex_env",Pquotetotex_env,-99999999}, |
{"quotetotex_env",Pquotetotex_env,-99999999}, |
|
{"flatten_quote",Pflatten_quote,2}, |
{0,0,0}, |
{0,0,0}, |
}; |
}; |
|
|
Line 118 int register_symbol_table(Obj arg); |
|
Line 120 int register_symbol_table(Obj arg); |
|
int register_conv_rule(Obj arg); |
int register_conv_rule(Obj arg); |
int register_conv_func(Obj arg); |
int register_conv_func(Obj arg); |
int register_dp_vars(Obj arg); |
int register_dp_vars(Obj arg); |
|
int register_dp_vars_origin(Obj arg); |
|
int register_dp_dvars_origin(Obj arg); |
|
int register_dp_dvars_prefix(Obj arg); |
int register_dp_vars_prefix(Obj arg); |
int register_dp_vars_prefix(Obj arg); |
int register_dp_vars_hweyl(Obj arg); |
int register_dp_vars_hweyl(Obj arg); |
int register_show_lt(Obj arg); |
int register_show_lt(Obj arg); |
Line 126 static struct TeXSymbol *user_texsymbol; |
|
Line 131 static struct TeXSymbol *user_texsymbol; |
|
static char **dp_vars; |
static char **dp_vars; |
static int dp_vars_len; |
static int dp_vars_len; |
static char *dp_vars_prefix; |
static char *dp_vars_prefix; |
|
static char *dp_dvars_prefix; |
|
static int dp_vars_origin; |
|
static int dp_dvars_origin; |
static int show_lt; |
static int show_lt; |
static FUNC convfunc; |
static FUNC convfunc; |
static int is_lt; |
static int is_lt; |
|
|
{"conv_func",0,register_conv_func}, |
{"conv_func",0,register_conv_func}, |
{"dp_vars",0,register_dp_vars}, |
{"dp_vars",0,register_dp_vars}, |
{"dp_vars_prefix",0,register_dp_vars_prefix}, |
{"dp_vars_prefix",0,register_dp_vars_prefix}, |
|
{"dp_dvars_prefix",0,register_dp_dvars_prefix}, |
|
{"dp_vars_origin",0,register_dp_vars_origin}, |
|
{"dp_dvars_origin",0,register_dp_dvars_origin}, |
{"dp_vars_hweyl",0,register_dp_vars_hweyl}, |
{"dp_vars_hweyl",0,register_dp_vars_hweyl}, |
{"show_lt",0,register_show_lt}, |
{"show_lt",0,register_show_lt}, |
{0,0,0}, |
{0,0,0}, |
Line 309 int register_symbol_table(Obj arg) |
|
Line 320 int register_symbol_table(Obj arg) |
|
return 1; |
return 1; |
} |
} |
|
|
|
int register_dp_vars_origin(Obj arg) |
|
{ |
|
if ( INT(arg) ) { |
|
dp_vars_origin = QTOS((Q)arg); |
|
return 1; |
|
} else return 0; |
|
} |
|
|
|
int register_dp_dvars_origin(Obj arg) |
|
{ |
|
if ( INT(arg) ) { |
|
dp_dvars_origin = QTOS((Q)arg); |
|
return 1; |
|
} else return 0; |
|
} |
|
|
int register_dp_vars_hweyl(Obj arg) |
int register_dp_vars_hweyl(Obj arg) |
{ |
{ |
if ( INT(arg) ) { |
if ( INT(arg) ) { |
Line 336 int register_conv_rule(Obj arg) |
|
Line 363 int register_conv_rule(Obj arg) |
|
|
|
int register_conv_func(Obj arg) |
int register_conv_func(Obj arg) |
{ |
{ |
if ( OID(arg) == O_P && (int)(VR((P)arg))->attr == V_SR ) { |
if ( !arg ) { |
|
convfunc = 0; |
|
return 1; |
|
} else if ( OID(arg) == O_P && (int)(VR((P)arg))->attr == V_SR ) { |
convfunc = (FUNC)(VR((P)arg)->priv); |
convfunc = (FUNC)(VR((P)arg)->priv); |
/* f must be a function which takes single argument */ |
/* f must be a function which takes single argument */ |
return 1; |
return 1; |
Line 390 int register_dp_vars_prefix(Obj arg) |
|
Line 420 int register_dp_vars_prefix(Obj arg) |
|
} else return 0; |
} else return 0; |
} |
} |
|
|
|
int register_dp_dvars_prefix(Obj arg) |
|
{ |
|
if ( !arg ) { |
|
dp_dvars_prefix = 0; |
|
return 1; |
|
} else if ( OID(arg) == O_STR ) { |
|
dp_dvars_prefix = BDY((STRING)arg); |
|
return 1; |
|
} else if ( OID(arg) == O_P ) { |
|
dp_dvars_prefix = NAME(VR((P)arg)); |
|
return 1; |
|
} else return 0; |
|
} |
|
|
void Pquotetotex_env(NODE arg,Obj *rp) |
void Pquotetotex_env(NODE arg,Obj *rp) |
{ |
{ |
int ac,i; |
int ac,i; |
Line 410 void Pquotetotex_env(NODE arg,Obj *rp) |
|
Line 454 void Pquotetotex_env(NODE arg,Obj *rp) |
|
*rp = (Obj)l; |
*rp = (Obj)l; |
} else if ( ac == 1 && !ARG0(arg) ) { |
} else if ( ac == 1 && !ARG0(arg) ) { |
/* set to default */ |
/* set to default */ |
for ( i = 0; qtot_env[i].name; i++ ) |
for ( i = 0; qtot_env[i].name; i++ ) { |
|
(qtot_env[i].reg)(0); |
qtot_env[i].value = 0; |
qtot_env[i].value = 0; |
|
} |
*rp = 0; |
*rp = 0; |
} else if ( ac == 1 || ac == 2 ) { |
} else if ( ac == 1 || ac == 2 ) { |
asir_assert(ARG0(arg),O_STR,"quotetotex_env"); |
asir_assert(ARG0(arg),O_STR,"quotetotex_env"); |
Line 799 void fnodetotex_tb(FNODE f,TB tb) |
|
Line 845 void fnodetotex_tb(FNODE f,TB tb) |
|
char vname[BUFSIZ],prefix[BUFSIZ]; |
char vname[BUFSIZ],prefix[BUFSIZ]; |
char *opname,*vname_conv,*prefix_conv; |
char *opname,*vname_conv,*prefix_conv; |
Obj obj; |
Obj obj; |
int i,len,allzero,elen,elen2; |
int i,len,allzero,elen,elen2,si; |
C cplx; |
C cplx; |
char *r; |
char *r; |
FNODE fi,f2; |
FNODE fi,f2; |
Line 889 void fnodetotex_tb(FNODE f,TB tb) |
|
Line 935 void fnodetotex_tb(FNODE f,TB tb) |
|
break; |
break; |
case C_GT: |
case C_GT: |
fnodetotex_tb((FNODE)FA1(f),tb); |
fnodetotex_tb((FNODE)FA1(f),tb); |
write_tb(" \\gt ",tb); |
write_tb(" > ",tb); |
fnodetotex_tb((FNODE)FA2(f),tb); |
fnodetotex_tb((FNODE)FA2(f),tb); |
break; |
break; |
case C_LT: |
case C_LT: |
fnodetotex_tb((FNODE)FA1(f),tb); |
fnodetotex_tb((FNODE)FA1(f),tb); |
write_tb(" \\lt ",tb); |
write_tb(" < ",tb); |
fnodetotex_tb((FNODE)FA2(f),tb); |
fnodetotex_tb((FNODE)FA2(f),tb); |
break; |
break; |
case C_GE: |
case C_GE: |
Line 924 void fnodetotex_tb(FNODE f,TB tb) |
|
Line 970 void fnodetotex_tb(FNODE f,TB tb) |
|
break; |
break; |
case L_GT: |
case L_GT: |
fnodetotex_tb((FNODE)FA1(f),tb); |
fnodetotex_tb((FNODE)FA1(f),tb); |
write_tb(" \\gt ",tb); |
write_tb(" > ",tb); |
fnodetotex_tb((FNODE)FA2(f),tb); |
fnodetotex_tb((FNODE)FA2(f),tb); |
break; |
break; |
case L_LT: |
case L_LT: |
fnodetotex_tb((FNODE)FA1(f),tb); |
fnodetotex_tb((FNODE)FA1(f),tb); |
write_tb(" \\lt ",tb); |
write_tb(" < ",tb); |
fnodetotex_tb((FNODE)FA2(f),tb); |
fnodetotex_tb((FNODE)FA2(f),tb); |
break; |
break; |
case L_GE: |
case L_GE: |
Line 1038 void fnodetotex_tb(FNODE f,TB tb) |
|
Line 1084 void fnodetotex_tb(FNODE f,TB tb) |
|
vname_conv = conv_rule(vname); |
vname_conv = conv_rule(vname); |
} else { |
} else { |
if ( dp_vars_hweyl ) { |
if ( dp_vars_hweyl ) { |
if ( i < elen2 ) |
if ( i < elen2 ) { |
strcpy(prefix,dp_vars_prefix?dp_vars_prefix:"x"); |
strcpy(prefix,dp_vars_prefix?dp_vars_prefix:"x"); |
else if ( i < elen ) |
prefix_conv = conv_rule(prefix); |
strcpy(prefix,"\\partial"); |
vname_conv = (char *)ALLOCA(strlen(prefix_conv)+50); |
else |
si = i+dp_vars_origin; |
|
sprintf(vname_conv,(si>=0&&si<10)?"%s_%d":"%s_{%d}", |
|
prefix_conv,si); |
|
} else if ( i < elen ) { |
|
strcpy(prefix, |
|
dp_dvars_prefix?dp_dvars_prefix:"\\partial"); |
|
prefix_conv = conv_rule(prefix); |
|
vname_conv = (char *)ALLOCA(strlen(prefix_conv)+50); |
|
si = i+dp_dvars_origin-elen2; |
|
sprintf(vname_conv,(si>=0&&si<10)?"%s_%d":"%s_{%d}", |
|
prefix_conv,si); |
|
} else { |
strcpy(prefix,"h"); |
strcpy(prefix,"h"); |
} else |
vname_conv = conv_rule(prefix); |
|
} |
|
} else { |
strcpy(prefix,dp_vars_prefix?dp_vars_prefix:"x"); |
strcpy(prefix,dp_vars_prefix?dp_vars_prefix:"x"); |
prefix_conv = conv_rule(prefix); |
prefix_conv = conv_rule(prefix); |
vname_conv = (char *)ALLOCA(strlen(prefix_conv)+50); |
vname_conv = (char *)ALLOCA(strlen(prefix_conv)+50); |
if ( i < 10 ) |
si = i+dp_vars_origin; |
sprintf(vname_conv,"%s_%d",prefix_conv,i); |
sprintf(vname_conv,(si>=0&&si<10)?"%s_%d":"%s_{%d}", |
else |
prefix_conv,si); |
sprintf(vname_conv,"%s_{%d}",prefix_conv,i); |
} |
} |
} |
if ( fi->id == I_FORMULA && UNIQ(FA0(fi)) ) { |
if ( fi->id == I_FORMULA && UNIQ(FA0(fi)) ) { |
len = strlen(vname_conv); |
len = strlen(vname_conv); |
Line 1220 int top_is_minus(FNODE f) |
|
Line 1279 int top_is_minus(FNODE f) |
|
default: |
default: |
return 0; |
return 0; |
} |
} |
|
} |
|
|
|
FNODE flatten_fnode(FNODE,char *); |
|
|
|
void Pflatten_quote(NODE arg,QUOTE *rp) |
|
{ |
|
FNODE f; |
|
QUOTE q; |
|
|
|
f = flatten_fnode(BDY((QUOTE)ARG0(arg)),BDY((STRING)ARG1(arg))); |
|
MKQUOTE(q,f); |
|
*rp = q; |
} |
} |