rendered paste body#define NUM_ARGS 2
#include <tigcclib.h>
#include <args.h>
#include <estack.h>
void check_arg_nums() {
int arg_cnt=ArgCount();
if(ArgCount()>NUM_ARGS) {
ER_throw(ER_TOO_MANY_ARGS);
} else if(arg_cnt<NUM_ARGS) {
ER_throw(ER_TOO_FEW_ARGS);
}
}
float get_arg_float() {
if(!can_be_approxed(top_estack,FALSE)) {
ER_throw(ER_ARG_MISMATCH);
}
long l=(long)top_estack;
printf("0X%l",l);
NG_approxESI(top_estack);
float result=estack_number_to_Float(top_estack);
top_estack = next_expression_index (top_estack);
printf("0x%p\n",top_estack);
//top_estack--;
return result;
}
int get_arg_int() {
unsigned short result;
if(estack_to_ushort(top_estack,&result)!=1) {
printf("messed up ushort convert %i, %i",estack_to_ushort(top_estack,&result), GetArgType(top_estack));
ngetchx();
ER_throw(ER_ARG_MISMATCH);
}
top_estack = next_expression_index (top_estack);
//top_estack--;
return result;
}
void _main()
{
check_arg_nums();
float lower_bounds=get_arg_float();
//float upper_bounds=get_arg_float();
int numsteps=get_arg_int();
printf("arg1:%f arg2:%i",lower_bounds,numsteps);
ngetchx();
return;
}