start fixing of this shit

This commit is contained in:
2024-08-15 16:50:06 +03:00
parent eaf137b5b6
commit 018f0d4b33
15 changed files with 140 additions and 130 deletions

View File

@@ -175,9 +175,7 @@ static const char *fhdr =
int i = 0;\n\
while(*str > '@' && i < CMD_MAXLEN){ cmd[i++] = *str++; }\n\
cmd[i] = 0;\n\
if(*str){\n\
while(*str <= ' ') ++str;\n\
}\n\
while(*str && *str <= ' ') ++str;\n\
char *args = (char*) str;\n\
uint32_t h = hashf(cmd);\n\
switch(h){\n\n"

View File

@@ -8,6 +8,8 @@
#define WAL __attribute__ ((weak, alias ("__f1")))
#endif
char lastcmd[CMD_MAXLEN + 1];
static int __f1(uint32_t _U_ h, char _U_ *a){return 1;}
int fn_abspos(uint32_t _U_ hash, char _U_ *args) WAL; // "abspos" (3056382221)
@@ -137,16 +139,13 @@ static uint32_t hashf(const char *str){
}
int parsecmd(const char *str){
char cmd[CMD_MAXLEN + 1];
if(!str || !*str) return RET_CMDNOTFOUND;
int i = 0;
while(*str > '@' && i < CMD_MAXLEN){ cmd[i++] = *str++; }
cmd[i] = 0;
if(*str){
while(*str <= ' ') ++str;
}
while(*str > '@' && i < CMD_MAXLEN){ lastcmd[i++] = *str++; }
lastcmd[i] = 0;
while(*str && *str <= ' ') ++str;
char *args = (char*) str;
uint32_t h = hashf(cmd);
uint32_t h = hashf(lastcmd);
switch(h){
case CMD_ABSPOS:

View File

@@ -13,6 +13,8 @@ enum{
int parsecmd(const char *cmdwargs);
extern char lastcmd[];
#define CMD_ABSPOS (3056382221)
#define CMD_ACCEL (1490521981)
#define CMD_ADC (2963026093)