version 1.3, 2003/01/13 12:04:53 |
version 1.4, 2003/02/04 14:27:43 |
|
|
/* -*- mode: C; coding: euc-japan -*- */ |
/* -*- mode: C; coding: euc-japan -*- */ |
/* $OpenXM: OpenXM/src/ox_math/sm.c,v 1.2 2003/01/11 12:38:57 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/ox_math/sm.c,v 1.3 2003/01/13 12:04:53 ohara Exp $ */ |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
Line 33 void stack_extend() |
|
Line 33 void stack_extend() |
|
|
|
void push(cmo *ob) |
void push(cmo *ob) |
{ |
{ |
#if DEBUG |
ox_printf("push<%s>.\n", get_symbol_by_tag(ob->tag)); |
symbol_t symp; |
|
|
|
if (ob->tag == CMO_STRING) { |
|
ox_printf("ox_math:: a CMO_STRING(%s) was pushed.\n", ((cmo_string *)ob)->s); |
|
}else { |
|
symp = lookup_by_tag(ob->tag); |
|
ox_printf("ox_math:: a %s was pushed.\n", symbol_get_key(symp)); |
|
} |
|
#endif |
|
if (stack_ptr >= stack_size) { |
if (stack_ptr >= stack_size) { |
stack_extend(); |
stack_extend(); |
} |
} |
Line 79 an sm_* function, called by sm_run, pushes an error ob |
|
Line 70 an sm_* function, called by sm_run, pushes an error ob |
|
void sm_popCMO() |
void sm_popCMO() |
{ |
{ |
cmo* m = pop(); |
cmo* m = pop(); |
#ifdef DEBUG |
ox_printf(" <%s>", get_symbol_by_tag(m->tag)); |
symbol_t symp = lookup_by_tag(m->tag); |
|
ox_printf("ox_math:: opecode = SM_popCMO. (%s)\n", symbol_get_key(symp)); |
|
#endif |
|
send_ox_cmo(stack_oxfp, m); |
send_ox_cmo(stack_oxfp, m); |
} |
} |
|
|
|
|
void sm_run(int code) |
void sm_run(int code) |
{ |
{ |
int (*func)(OXFILE *) = sm_search_f(code); |
int (*func)(OXFILE *) = sm_search_f(code); |
#ifdef DEBUG |
ox_printf("ox_math:: opecode=<%s>[%d]", get_symbol_by_tag(code), code); |
symbol_t sp = lookup_by_tag(code); |
|
ox_printf("ox_math:: %s received.\n", symbol_get_key(sp)); |
|
#endif |
|
if (func != NULL) { |
if (func != NULL) { |
func(stack_oxfp); |
func(stack_oxfp); |
}else { |
}else { |
ox_printf("unknown command: %d.\n", code); |
|
push_error(ERROR_ID_UNKNOWN_SM, new_cmo_null()); |
push_error(ERROR_ID_UNKNOWN_SM, new_cmo_null()); |
} |
} |
|
ox_printf("\n"); |
} |
} |
|
|
int oxf_error(OXFILE *oxfp) |
int oxf_error(OXFILE *oxfp) |
Line 119 int oxf_error(OXFILE *oxfp) |
|
Line 104 int oxf_error(OXFILE *oxfp) |
|
} |
} |
return e; |
return e; |
} |
} |
|
|