-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetval.c
More file actions
executable file
·78 lines (61 loc) · 1.41 KB
/
getval.c
File metadata and controls
executable file
·78 lines (61 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#define RETURN_VALUE gotval
#define OPTIMIZE_ROM_CALLS
#define USE_TI89
#define ENABLE_ERROR_RETURN // Enable Returning Errors to TIOS
#define USE_TI92PLUS
#define USE_V200
//#define SAVE_SCREEN
#define MIN_AMS 101 //200
#include <tigcclib.h>
float matval(const char * tabela, short i, short j, short jmax, short fsz)
{
static float d;
FILE *f;
static short fpos;
static char buffer[10];
//short i2,j2;
TRY
f = fopen (tabela, "rb");
if (f!=NULL)
{
//for (i2=1;i2<10;i2++)
//for (j2=1;j2<10;j2++)
//{
fpos = fsz - (2 + (jmax * 10 + 2) * (i-1) + j * 10);
fseek (f, fpos, SEEK_SET);
fread(buffer,1,10,f);
d = estack_number_to_Float (buffer+9);
//}
//printf("%f\n",d);
//ngetchx();
fclose(f);
}
FINALLY
ENDFINAL
return d;
}
// Main Function
void _main(void)
{
ESI argptr;
short i,j,jmax,fsz;
const char *tabela;
static char tabela2[10];
float val;
//clrscr();
//ngetchx();
//get arguments
argptr = top_estack;
i = GetIntArg (argptr);
j = GetIntArg (argptr);
jmax = GetIntArg (argptr);
fsz = GetIntArg (argptr);
tabela = GetStrnArg (argptr);
strcpy(tabela2,tabela);
while (GetArgType (top_estack) != END_TAG) // Clean up arguments
top_estack = next_expression_index (top_estack);
top_estack--;
val=matval(tabela2, i, j, jmax, fsz);
push_Float(val);
return;
}