Lisp: upd new function.

git-svn-id: svn://kolibrios.org@7745 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pavelyakov 2020-03-22 11:50:49 +00:00
parent bf41544e29
commit 4d5b6935a6
2 changed files with 66 additions and 4 deletions

View File

@ -230,7 +230,7 @@ void main()
}
}
IF(initConsole) con_exit stdcall (0);
IF(initConsole) con_exit stdcall (1);
ExitProcess();
}

View File

@ -1,9 +1,30 @@
/* Lisp functions */
:dword std_exit()
:dword std_sleep(dword count, args)
{
con_exit stdcall (1);
ExitProcess();
dword ret = 0;
dword arg = 0;
dword val = 0;
WHILE(count)
{
arg = DSDWORD[args];
REPEAT1:
IF (DSDWORD[arg+4] == TSym)
{
arg = std_get(1, args);
goto REPEAT1;
}
IF (DSDWORD[arg+4] == TInt)
{
EAX = 5;
EBX = DSDWORD[arg];
$int 0x40
}
args+=4;
count--;
}
RETURN ret;
}
:dword std_set(dword count, args)
@ -62,6 +83,12 @@
RETURN ret;
}
:dword std_exit(dword count, args)
{
IF(initConsole) con_exit stdcall (1);
ExitProcess();
}
:dword std_sub(dword count, args)
{
dword ret = 0;
@ -80,6 +107,38 @@
RETURN ret;
}
:dword std_type(dword count, args)
{
dword ret = 0;
dword arg = 0;
dword val = 0;
ret = malloc(TLen);
DSDWORD[ret] = "nil";
DSDWORD[ret+4] = TStr;
WHILE(count)
{
arg = DSDWORD[args];
REPEAT1:
IF (DSDWORD[arg+4] == TSym)
{
arg = std_get(1, args);
goto REPEAT1;
}
switch (DSDWORD[arg+4])
{
case TStr:
DSDWORD[ret] = "string";
break;
case TInt:
DSDWORD[ret] = "integer";
break;
}
args+=4;
count--;
}
RETURN ret;
}
/* Console functions */
:dword std_print(dword count, args)
{
@ -218,6 +277,9 @@ void Init()
/* Lisp functions */
functions.set("set", #std_set);
functions.set("get", #std_get);
functions.set("type", #std_type);
functions.set("sleep", #std_sleep);
variables.init(100);
}