1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-22 20:06:43 +00:00
This commit is contained in:
Such Meme, Many Skill 2020-03-31 00:09:23 +02:00
parent 887972d67c
commit c4783fc2ca

View file

@ -94,22 +94,81 @@ void getnextvalidchar(){
getnextchar(); getnextchar();
} }
char *makestr(u32 size, char ignore){
char *str;
u32 count = 0;
str = calloc(size + 1, sizeof(char));
for (u32 i = 0; i < size; i++){
getnextchar();
if (ignore != 0 && ignore == currentchar)
continue;
str[count++] = currentchar;
}
return str;
}
/*
char *makestrstrip(u32 size){
char *str;
int count = 0;
str = calloc(size + 1, sizeof(char));
for (u32 i = 0; i < size;){
if (currentchar == '"'){
getnextchar();
i++;
while (getnextchar() != '"')
i++;
}
else if (currentchar == ' '){
while (getnextchar() == ' ')
i++;
}
else{
getnextchar();
i++;
}
str[count++] = currentchar;
}
return str;
}
*/
char *readtilchar(char end, char ignore){ // this will strip spaces unless it's enclosed in a ""
FSIZE_t offset, size;
offset = f_tell(&scriptin);
getfollowingchar(end);
size = f_tell(&scriptin) - offset;
f_lseek(&scriptin, offset - 1);
return makestr((u32)size, ignore);
}
void functionparser(){ void functionparser(){
char *unsplitargs; char *unsplitargs;
FSIZE_t fileoffset; FSIZE_t fileoffset;
u32 argsize = 0; u32 argsize = 0;
//gfx_printf("getting func %c\n", currentchar); //gfx_printf("getting func %c\n", currentchar);
char *funcbuff = calloc(20, sizeof(char)); char *funcbuff = readtilchar('(', 0);
/*calloc(20, sizeof(char));
for (int i = 0; i < 19 && currentchar != '(' && currentchar != ' '; i++){ for (int i = 0; i < 19 && currentchar != '(' && currentchar != ' '; i++){
funcbuff[i] = currentchar; funcbuff[i] = currentchar;
getnextchar(); getnextchar();
} }
*/
getfollowingchar('('); getfollowingchar('(');
getnextchar(); getnextchar();
//gfx_printf("getting arg len %c\n", currentchar); //gfx_printf("getting arg len %c\n", currentchar);
/*
fileoffset = f_tell(&scriptin); fileoffset = f_tell(&scriptin);
getfollowingchar(')'); getfollowingchar(')');
argsize = f_tell(&scriptin) - fileoffset; argsize = f_tell(&scriptin) - fileoffset;
@ -124,10 +183,13 @@ void functionparser(){
unsplitargs[i] = currentchar; unsplitargs[i] = currentchar;
getnextchar(); getnextchar();
} }
*/
unsplitargs = readtilchar(')', 0);
//gfx_printf("parsing args %c\n", currentchar); //gfx_printf("parsing args %c\n", currentchar);
argc = splitargs(unsplitargs); argc = splitargs(unsplitargs);
getnextchar(); getnextchar();
getnextchar();
gfx_printf("\n\nFunc: %s\n", funcbuff, currentchar); gfx_printf("\n\nFunc: %s\n", funcbuff, currentchar);
gfx_printf("Split: %s\n", unsplitargs); gfx_printf("Split: %s\n", unsplitargs);
@ -135,6 +197,7 @@ void functionparser(){
for (int i = 0; i < argc; i++) for (int i = 0; i < argc; i++)
gfx_printf("%d | %s\n", i, argv[i]); gfx_printf("%d | %s\n", i, argv[i]);
//gfx_printf("\ncurrent char: %c", currentchar);
free(unsplitargs); free(unsplitargs);
free(funcbuff); free(funcbuff);
} }
@ -144,6 +207,7 @@ char *gettargetvar(){
FSIZE_t fileoffset; FSIZE_t fileoffset;
u32 varsize = 0; u32 varsize = 0;
/*
fileoffset = f_tell(&scriptin); fileoffset = f_tell(&scriptin);
getfollowingchar('='); getfollowingchar('=');
varsize = f_tell(&scriptin) - fileoffset; varsize = f_tell(&scriptin) - fileoffset;
@ -159,6 +223,9 @@ char *gettargetvar(){
variable[i] = currentchar; variable[i] = currentchar;
getnextchar(); getnextchar();
} }
*/
variable = readtilchar('=', ' ');
getfollowingchar('='); getfollowingchar('=');
getnextchar(); getnextchar();