[A89] Re: Determine Variable Type
[Prev][Next][Index][Thread]
[A89] Re: Determine Variable Type
I was using eTag & eTagPtr with estack_to_short.
Anyway, I'm still having problems and I figure it's
something else I'm doing wrong. So this is all I've
got so far. I'd appreciate any help -- it displays
"Not supported" no matter the variable type.
// code starts
#define OPTIMIZE_ROM_CALLS
#define RETURN_VALUE
#include <tigcclib.h>
short _ti89;
void _main(void)
{
unsigned char *argumentPointer;
short argumentNumber;
char *variableName;
ESI expressionTagPtr;
FILE *file;
HANDLE handle;
BYTE byte;
InitArgPtr(argumentPointer);
argumentNumber =
remaining_element_count(argumentPointer);
if (argumentNumber > 1)
{
ST_helpMsg("Usage: open(''variableName'')");
ER_throwVar (940);
}
if (argumentNumber < 1)
{
ST_helpMsg("Usage: open(''variableName'')");
ER_throwVar (930);
}
// make sure argument is a string
if (*argumentPointer != STR_TAG)
ER_throwVar (130);
variableName = GetStrnArg (argumentPointer);
// open file . . .
file = fopen (variableName, "rb");
if (file == NULL)
{
fclose(file);
ER_throwVar (960);
}
// file does exist! is it a variable we can handle?
handle = HS_popEStack ();
expressionTagPtr = HToESI(handle);
// expressionTagPtr now points to the tag of the
expression
byte = peek (expressionTagPtr);
if (byte != TEXT_TAG)
{
fclose(file);
push_expr_quantum($(Not supported), STR_TAG);
return;
}
// do some other stuff :)
// finish & clean up
HeapFree(handle);
fclose(file);
push_expr_quantum($(Done), STR_TAG);
}
// end code
Sorry to be such a pest. Rick
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
References: