2002-08-03 06:04:00 +00:00
|
|
|
/*
|
|
|
|
#FILENAME#
|
|
|
|
|
|
|
|
#DESCRIPTION#
|
|
|
|
|
|
|
|
Copyright (C) 2002 #AUTHOR#
|
|
|
|
|
|
|
|
Author: #AUTHOR#
|
|
|
|
Date: #DATE#
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2002-08-08 09:20:00 +00:00
|
|
|
static const char rcsid[] =
|
|
|
|
"$Id$";
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2002-08-28 23:00:30 +00:00
|
|
|
#include <ctype.h>
|
2002-08-03 06:04:00 +00:00
|
|
|
#include <stdlib.h>
|
2002-08-07 06:17:50 +00:00
|
|
|
#include <string.h>
|
2002-08-27 23:25:52 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <fnmatch.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#include "QF/quakeio.h"
|
|
|
|
#include "QF/quakefs.h"
|
|
|
|
#include "QF/zone.h"
|
2002-08-07 06:17:50 +00:00
|
|
|
#include "QF/va.h"
|
2002-08-03 06:04:00 +00:00
|
|
|
#include "QF/sys.h"
|
|
|
|
#include "QF/cmd.h"
|
|
|
|
#include "QF/cbuf.h"
|
|
|
|
#include "QF/hash.h"
|
|
|
|
#include "QF/dstring.h"
|
2002-08-07 06:17:50 +00:00
|
|
|
#include "QF/gib_parse.h"
|
2002-08-03 06:04:00 +00:00
|
|
|
#include "QF/gib_builtin.h"
|
2002-08-05 00:01:06 +00:00
|
|
|
#include "QF/gib_buffer.h"
|
2002-08-03 06:04:00 +00:00
|
|
|
#include "QF/gib_function.h"
|
2002-08-08 09:20:00 +00:00
|
|
|
#include "QF/gib_vars.h"
|
2002-08-27 04:47:49 +00:00
|
|
|
#include "QF/gib_thread.h"
|
2002-08-03 06:04:00 +00:00
|
|
|
|
|
|
|
hashtab_t *gib_builtins;
|
|
|
|
|
2002-08-14 05:28:07 +00:00
|
|
|
/*
|
|
|
|
Hashtable callbacks
|
|
|
|
*/
|
2002-08-03 06:04:00 +00:00
|
|
|
const char *
|
|
|
|
GIB_Builtin_Get_Key (void *ele, void *ptr)
|
|
|
|
{
|
|
|
|
return ((gib_builtin_t *)ele)->name->str;
|
|
|
|
}
|
|
|
|
void
|
|
|
|
GIB_Builtin_Free (void *ele, void *ptr)
|
|
|
|
{
|
|
|
|
gib_builtin_t *b;
|
|
|
|
b = (gib_builtin_t *) ele;
|
|
|
|
dstring_delete (b->name);
|
|
|
|
free (b);
|
|
|
|
}
|
|
|
|
|
2002-08-14 05:28:07 +00:00
|
|
|
/*
|
|
|
|
GIB_Builtin_Add
|
|
|
|
|
|
|
|
Registers a new builtin GIB command.
|
|
|
|
*/
|
2002-08-03 06:04:00 +00:00
|
|
|
void
|
2002-08-07 06:17:50 +00:00
|
|
|
GIB_Builtin_Add (const char *name, void (*func) (void), enum gib_builtin_type_e type)
|
2002-08-03 06:04:00 +00:00
|
|
|
{
|
|
|
|
gib_builtin_t *new;
|
|
|
|
|
|
|
|
if (!gib_builtins)
|
|
|
|
gib_builtins = Hash_NewTable (1024, GIB_Builtin_Get_Key, GIB_Builtin_Free, 0);
|
|
|
|
|
|
|
|
new = calloc (1, sizeof (gib_builtin_t));
|
|
|
|
new->func = func;
|
|
|
|
new->name = dstring_newstr();
|
2002-08-07 06:17:50 +00:00
|
|
|
new->type = type;
|
2002-08-03 06:04:00 +00:00
|
|
|
dstring_appendstr (new->name, name);
|
|
|
|
Hash_Add (gib_builtins, new);
|
|
|
|
}
|
|
|
|
|
2002-08-14 05:28:07 +00:00
|
|
|
/*
|
|
|
|
GIB_Builtin_Find
|
|
|
|
|
|
|
|
Looks up the builtin name in the builtin hash,
|
|
|
|
returning a pointer to the struct on success,
|
|
|
|
zero otherwise.
|
|
|
|
*/
|
2002-08-03 06:04:00 +00:00
|
|
|
gib_builtin_t *
|
|
|
|
GIB_Builtin_Find (const char *name)
|
|
|
|
{
|
|
|
|
if (!gib_builtins)
|
|
|
|
return 0;
|
|
|
|
return (gib_builtin_t *) Hash_Find (gib_builtins, name);
|
|
|
|
}
|
|
|
|
|
2002-08-14 05:28:07 +00:00
|
|
|
/*
|
|
|
|
GIB_Arg_Strip_Delim
|
|
|
|
|
|
|
|
Strips any wrapping characters off of the
|
|
|
|
specified argument. Useful for GIB_BUILTIN_NOPROCESS
|
|
|
|
or GIB_BUILTIN_FIRSTONLY builtins.
|
|
|
|
*/
|
2002-08-07 06:17:50 +00:00
|
|
|
void
|
|
|
|
GIB_Arg_Strip_Delim (unsigned int arg)
|
|
|
|
{
|
|
|
|
char *p = cbuf_active->args->argv[arg]->str;
|
|
|
|
if (*p == '{' || *p == '\"') {
|
|
|
|
dstring_snip (cbuf_active->args->argv[arg], 0, 1);
|
|
|
|
p[strlen(p)-1] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-23 21:18:00 +00:00
|
|
|
void
|
|
|
|
GIB_Return (const char *str)
|
|
|
|
{
|
|
|
|
if (GIB_DATA(cbuf_active)->type != GIB_BUFFER_PROXY)
|
|
|
|
return;
|
|
|
|
dstring_clearstr (GIB_DATA(cbuf_active->up)->ret.retval);
|
|
|
|
dstring_appendstr (GIB_DATA(cbuf_active->up)->ret.retval, str);
|
|
|
|
GIB_DATA(cbuf_active->up)->ret.available = true;
|
|
|
|
}
|
|
|
|
|
2002-08-14 05:28:07 +00:00
|
|
|
/*
|
|
|
|
GIB Builtin functions
|
|
|
|
|
|
|
|
See GIB docs for information.
|
|
|
|
*/
|
2002-08-03 06:04:00 +00:00
|
|
|
void
|
|
|
|
GIB_Function_f (void)
|
|
|
|
{
|
2002-08-05 00:01:06 +00:00
|
|
|
if (GIB_Argc () != 3)
|
2002-08-07 06:17:50 +00:00
|
|
|
Cbuf_Error ("syntax",
|
|
|
|
"function: invalid syntax\n"
|
2002-08-03 06:04:00 +00:00
|
|
|
"usage: function function_name {program}");
|
2002-08-05 00:01:06 +00:00
|
|
|
else
|
2002-08-03 06:04:00 +00:00
|
|
|
GIB_Function_Define (GIB_Argv(1), GIB_Argv(2));
|
|
|
|
}
|
|
|
|
|
2002-08-23 21:18:00 +00:00
|
|
|
void
|
2002-11-11 01:57:34 +00:00
|
|
|
GIB_Function_Get_f (void)
|
2002-08-23 21:18:00 +00:00
|
|
|
{
|
|
|
|
if (GIB_Argc () != 2)
|
|
|
|
Cbuf_Error ("syntax",
|
|
|
|
"function.get: invalid syntax\n"
|
2002-11-11 01:57:34 +00:00
|
|
|
"usage: function::get function_name");
|
2002-08-23 21:18:00 +00:00
|
|
|
else {
|
|
|
|
gib_function_t *f;
|
|
|
|
if ((f = GIB_Function_Find (GIB_Argv (1))))
|
|
|
|
GIB_Return (f->program->str);
|
|
|
|
else
|
|
|
|
GIB_Return ("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-05 00:01:06 +00:00
|
|
|
void
|
2002-08-08 09:20:00 +00:00
|
|
|
GIB_Local_f (void)
|
2002-08-05 00:01:06 +00:00
|
|
|
{
|
2002-11-11 01:57:34 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if (GIB_Argc () < 2)
|
2002-08-07 06:17:50 +00:00
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"local: invalid syntax\n"
|
|
|
|
"usage: local varname1 varname2 varname3 [...]");
|
2002-08-05 00:01:06 +00:00
|
|
|
else
|
2002-11-11 01:57:34 +00:00
|
|
|
for (i = 1; i < GIB_Argc(); i++)
|
|
|
|
GIB_Var_Set_Local (cbuf_active, GIB_Argv(i), "");
|
2002-08-08 09:20:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GIB_Global_f (void)
|
|
|
|
{
|
2002-11-11 01:57:34 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if (GIB_Argc () < 2)
|
2002-08-08 09:20:00 +00:00
|
|
|
Cbuf_Error ("syntax",
|
|
|
|
"global: invalid syntax\n"
|
2002-11-11 01:57:34 +00:00
|
|
|
"usage: global varname1 varname2 varname3 [...]");
|
|
|
|
else
|
|
|
|
for (i = 1; i < GIB_Argc(); i++)
|
|
|
|
GIB_Var_Set_Global (GIB_Argv(i), "");
|
2002-08-05 00:01:06 +00:00
|
|
|
}
|
|
|
|
|
2002-10-23 03:56:57 +00:00
|
|
|
void
|
|
|
|
GIB_Global_Delete_f (void)
|
|
|
|
{
|
|
|
|
if (GIB_Argc () != 2)
|
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"global::delete: invalid syntax\n"
|
2002-10-23 03:56:57 +00:00
|
|
|
"usage: global.delete variable");
|
|
|
|
GIB_Var_Free_Global (GIB_Argv(1));
|
|
|
|
}
|
|
|
|
|
2002-08-06 08:15:20 +00:00
|
|
|
void
|
|
|
|
GIB_Return_f (void)
|
|
|
|
{
|
2002-08-07 06:17:50 +00:00
|
|
|
cbuf_t *sp;
|
|
|
|
|
2002-08-06 08:15:20 +00:00
|
|
|
if (GIB_Argc () > 2)
|
2002-08-07 06:17:50 +00:00
|
|
|
Cbuf_Error ("syntax",
|
|
|
|
"return: invalid syntax\n"
|
2002-08-06 08:15:20 +00:00
|
|
|
"usage: return <value>");
|
|
|
|
else {
|
2002-08-07 06:17:50 +00:00
|
|
|
sp = cbuf_active;
|
|
|
|
while (sp->interpreter == &gib_interp && GIB_DATA(sp)->type == GIB_BUFFER_LOOP) { // Get out of loops
|
|
|
|
GIB_DATA(sp)->type = GIB_BUFFER_PROXY;
|
|
|
|
dstring_clearstr (sp->buf);
|
|
|
|
dstring_clearstr (sp->line);
|
|
|
|
sp = sp->up;
|
|
|
|
}
|
|
|
|
dstring_clearstr (sp->buf);
|
|
|
|
dstring_clearstr (sp->line);
|
2002-08-06 08:15:20 +00:00
|
|
|
if (GIB_Argc () == 1)
|
|
|
|
return;
|
2002-08-23 07:45:46 +00:00
|
|
|
if (!sp->up || // Nothing above us on the stack
|
|
|
|
GIB_DATA(sp->up)->type != GIB_BUFFER_PROXY || // No proxy buffer created
|
|
|
|
!sp->up->up || // Nothing above proxy buffer on the stack
|
|
|
|
sp->up->up->interpreter != &gib_interp || // Not a GIB buffer
|
|
|
|
!GIB_DATA(sp->up->up)->ret.waiting) // Buffer doesn't want a return value
|
|
|
|
Sys_Printf("Warning: unwanted return value discarded.\n"); // Not a serious error
|
|
|
|
else {
|
2002-08-07 06:17:50 +00:00
|
|
|
dstring_clearstr (GIB_DATA(sp->up->up)->ret.retval);
|
|
|
|
dstring_appendstr (GIB_DATA(sp->up->up)->ret.retval, GIB_Argv(1));
|
|
|
|
GIB_DATA(sp->up->up)->ret.available = true;
|
2002-08-06 08:15:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-07 06:17:50 +00:00
|
|
|
void
|
|
|
|
GIB_If_f (void)
|
|
|
|
{
|
|
|
|
int condition;
|
|
|
|
if ((!strcmp (GIB_Argv (3), "else") && GIB_Argc() >= 5) || // if condition {program} else ...
|
|
|
|
(GIB_Argc() == 3)) { // if condition {program}
|
|
|
|
condition = atoi(GIB_Argv(1));
|
|
|
|
if (!strcmp (GIB_Argv(0), "ifnot"))
|
|
|
|
condition = !condition;
|
|
|
|
if (condition) {
|
|
|
|
GIB_Arg_Strip_Delim (2);
|
|
|
|
Cbuf_InsertText (cbuf_active, GIB_Argv(2));
|
|
|
|
} else if (GIB_Argc() == 5) {
|
|
|
|
GIB_Arg_Strip_Delim (4);
|
|
|
|
Cbuf_InsertText (cbuf_active, GIB_Argv(4));
|
|
|
|
} else if (GIB_Argc() > 5)
|
|
|
|
Cbuf_InsertText (cbuf_active, GIB_Args (4));
|
|
|
|
} else
|
|
|
|
Cbuf_Error ("syntax",
|
|
|
|
"if: invalid syntax\n"
|
|
|
|
"usage: if condition {program} [else ...]"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GIB_While_f (void)
|
|
|
|
{
|
|
|
|
if (GIB_Argc() != 3) {
|
|
|
|
Cbuf_Error ("syntax",
|
|
|
|
"while: invalid syntax\n"
|
|
|
|
"usage: while condition {program}"
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
cbuf_t *sub = Cbuf_New (&gib_interp);
|
|
|
|
GIB_DATA(sub)->type = GIB_BUFFER_LOOP;
|
|
|
|
GIB_DATA(sub)->locals = GIB_DATA(cbuf_active)->locals;
|
|
|
|
GIB_DATA(sub)->loop_program = dstring_newstr ();
|
|
|
|
if (cbuf_active->down)
|
|
|
|
Cbuf_DeleteStack (cbuf_active->down);
|
|
|
|
cbuf_active->down = sub;
|
|
|
|
sub->up = cbuf_active;
|
|
|
|
GIB_Arg_Strip_Delim (2);
|
2002-08-28 08:00:35 +00:00
|
|
|
dstring_appendstr (GIB_DATA(sub)->loop_program, va("ifnot %s break;%s", GIB_Argv (1), GIB_Argv (2)));
|
|
|
|
Cbuf_AddText (sub, GIB_DATA(sub)->loop_program->str);
|
|
|
|
cbuf_active->state = CBUF_STATE_STACK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-22 05:34:59 +00:00
|
|
|
void
|
|
|
|
GIB_Field_Get_f (void)
|
|
|
|
{
|
|
|
|
unsigned int field;
|
|
|
|
char *list, *end;
|
|
|
|
const char *ifs;
|
|
|
|
if (GIB_Argc() < 3 || GIB_Argc() > 4) {
|
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"field::get: invalid syntax\n"
|
|
|
|
"usage: field::get list element [ifs]"
|
2002-10-22 05:34:59 +00:00
|
|
|
);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
field = atoi (GIB_Argv(2));
|
|
|
|
|
|
|
|
if (GIB_Argc() == 4)
|
|
|
|
ifs = GIB_Argv (3);
|
|
|
|
else if (!(ifs = GIB_Var_Get_Local (cbuf_active, "ifs")))
|
2002-11-14 02:10:55 +00:00
|
|
|
ifs = " \t\n\r";
|
2002-10-22 05:34:59 +00:00
|
|
|
for (list = GIB_Argv(1); *list && strchr(ifs, *list); list++);
|
|
|
|
while (field) {
|
|
|
|
while (!strchr(ifs, *list))
|
|
|
|
list++;
|
|
|
|
while (*list && strchr(ifs, *list))
|
|
|
|
list++;
|
|
|
|
if (!*list) {
|
|
|
|
GIB_Return ("");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
field--;
|
|
|
|
}
|
|
|
|
for (end = list; !strchr(ifs, *end); end++);
|
|
|
|
*end = 0;
|
|
|
|
GIB_Return (list);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-08-28 08:00:35 +00:00
|
|
|
void
|
|
|
|
GIB___For_f (void)
|
|
|
|
{
|
2002-08-28 23:00:30 +00:00
|
|
|
char *end = 0, old = 0;
|
|
|
|
if (!GIB_DATA(cbuf_active)->loop_list_p[0]) {
|
2002-08-28 08:00:35 +00:00
|
|
|
Cbuf_InsertText (cbuf_active, "break;");
|
|
|
|
return;
|
|
|
|
}
|
2002-10-22 05:34:59 +00:00
|
|
|
if (!GIB_DATA(cbuf_active)->loop_ifs_p[0]) {
|
|
|
|
end = GIB_DATA(cbuf_active)->loop_list_p;
|
|
|
|
old = end[1];
|
|
|
|
end[1] = 0;
|
|
|
|
GIB_Var_Set_Local (cbuf_active, GIB_DATA(cbuf_active)->loop_var_p, GIB_DATA(cbuf_active)->loop_list_p++);
|
|
|
|
end[1] = old;
|
|
|
|
return;
|
|
|
|
}
|
2002-10-13 05:52:06 +00:00
|
|
|
for (end = GIB_DATA(cbuf_active)->loop_list_p; !strchr(GIB_DATA(cbuf_active)->loop_ifs_p, *end); end++);
|
2002-08-28 23:00:30 +00:00
|
|
|
if (*end) {
|
|
|
|
old = *end;
|
2002-08-28 08:00:35 +00:00
|
|
|
*end = 0;
|
2002-08-28 23:00:30 +00:00
|
|
|
}
|
2002-08-28 08:00:35 +00:00
|
|
|
GIB_Var_Set_Local (cbuf_active, GIB_DATA(cbuf_active)->loop_var_p, GIB_DATA(cbuf_active)->loop_list_p);
|
2002-08-28 23:00:30 +00:00
|
|
|
if (old)
|
|
|
|
*end = old;
|
2002-10-13 05:52:06 +00:00
|
|
|
while (*end && strchr(GIB_DATA(cbuf_active)->loop_ifs_p, *end))
|
2002-08-28 08:00:35 +00:00
|
|
|
end++;
|
|
|
|
GIB_DATA(cbuf_active)->loop_list_p = end;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GIB_For_f (void)
|
|
|
|
{
|
2002-10-22 05:34:59 +00:00
|
|
|
if (strcmp ("in", GIB_Argv (2)) ||
|
|
|
|
(GIB_Argc() == 7 && strcmp ("by", GIB_Argv(4))) ||
|
|
|
|
(GIB_Argc() != 5 && GIB_Argc() != 7)) {
|
2002-08-28 08:00:35 +00:00
|
|
|
Cbuf_Error ("syntax",
|
|
|
|
"for: invalid syntax\n"
|
|
|
|
"usage: for variable in list {program}"
|
|
|
|
);
|
|
|
|
} else if (GIB_Argv (3)[0]) {
|
2002-08-29 22:12:51 +00:00
|
|
|
char *ll;
|
2002-10-13 05:52:06 +00:00
|
|
|
const char *ifs;
|
2002-08-28 08:00:35 +00:00
|
|
|
cbuf_t *sub = Cbuf_New (&gib_interp);
|
2002-10-13 05:52:06 +00:00
|
|
|
// Create loop buffer
|
2002-08-28 08:00:35 +00:00
|
|
|
GIB_DATA(sub)->type = GIB_BUFFER_LOOP;
|
|
|
|
GIB_DATA(sub)->locals = GIB_DATA(cbuf_active)->locals;
|
|
|
|
GIB_DATA(sub)->loop_program = dstring_newstr ();
|
|
|
|
GIB_DATA(sub)->loop_data = dstring_newstr ();
|
|
|
|
if (cbuf_active->down)
|
|
|
|
Cbuf_DeleteStack (cbuf_active->down);
|
|
|
|
cbuf_active->down = sub;
|
|
|
|
sub->up = cbuf_active;
|
2002-10-13 05:52:06 +00:00
|
|
|
// Store all for-loop data in one big buffer (easy to clean up)
|
2002-08-28 08:00:35 +00:00
|
|
|
dstring_appendstr (GIB_DATA(sub)->loop_data, GIB_Argv(3));
|
|
|
|
dstring_append (GIB_DATA(sub)->loop_data, GIB_Argv(1), strlen(GIB_Argv(1))+1);
|
2002-10-22 05:34:59 +00:00
|
|
|
if (GIB_Argc() == 7)
|
|
|
|
ifs = GIB_Argv (5);
|
|
|
|
else if (!(ifs = GIB_Var_Get_Local (cbuf_active, "ifs")))
|
2002-11-14 02:10:55 +00:00
|
|
|
ifs = " \n\r\t";
|
2002-10-13 05:52:06 +00:00
|
|
|
dstring_append (GIB_DATA(sub)->loop_data, ifs, strlen(ifs)+1);
|
|
|
|
// Store pointers to data
|
2002-08-29 22:12:51 +00:00
|
|
|
ll = GIB_DATA(sub)->loop_data->str;
|
|
|
|
while (isspace ((byte) *ll))
|
|
|
|
ll++;
|
2002-10-13 05:52:06 +00:00
|
|
|
GIB_DATA(sub)->loop_list_p = ll; // List to iterate through
|
|
|
|
GIB_DATA(sub)->loop_var_p = GIB_DATA(sub)->loop_data->str + strlen(GIB_Argv(3))+1; // Var to use
|
|
|
|
GIB_DATA(sub)->loop_ifs_p = GIB_DATA(sub)->loop_var_p + strlen(GIB_Argv(1))+1; // Internal field separator
|
2002-08-28 08:00:35 +00:00
|
|
|
dstring_appendstr (GIB_DATA(sub)->loop_program, "__for;");
|
2002-10-22 05:34:59 +00:00
|
|
|
dstring_appendstr (GIB_DATA(sub)->loop_program, GIB_Argc() == 7 ? GIB_Argv (6) : GIB_Argv(4));
|
2002-08-07 06:17:50 +00:00
|
|
|
Cbuf_AddText (sub, GIB_DATA(sub)->loop_program->str);
|
|
|
|
cbuf_active->state = CBUF_STATE_STACK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GIB_Break_f (void)
|
|
|
|
{
|
|
|
|
if (GIB_DATA(cbuf_active)->type != GIB_BUFFER_LOOP)
|
|
|
|
Cbuf_Error ("syntax",
|
|
|
|
"break attempted outside of a loop"
|
|
|
|
);
|
|
|
|
else {
|
|
|
|
GIB_DATA(cbuf_active)->type = GIB_BUFFER_PROXY; // If we set it to normal locals will get freed
|
|
|
|
dstring_clearstr (cbuf_active->buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-11 01:57:34 +00:00
|
|
|
// Note: this is a standard console command, not a GIB builtin
|
2002-08-07 06:17:50 +00:00
|
|
|
void
|
|
|
|
GIB_Runexported_f (void)
|
|
|
|
{
|
|
|
|
gib_function_t *f;
|
|
|
|
|
|
|
|
if (!(f = GIB_Function_Find (Cmd_Argv (0))))
|
|
|
|
Sys_Printf ("Error: No function found for exported command \"%s\".\n"
|
|
|
|
"This is most likely a bug, please report it to"
|
|
|
|
"The QuakeForge developers.", Cmd_Argv(0));
|
2002-08-27 04:47:49 +00:00
|
|
|
else {
|
|
|
|
cbuf_t *sub = Cbuf_New (&gib_interp);
|
|
|
|
GIB_Function_Execute (sub, f, cbuf_active->args);
|
|
|
|
cbuf_active->down = sub;
|
|
|
|
sub->up = cbuf_active;
|
|
|
|
cbuf_active->state = CBUF_STATE_STACK;
|
|
|
|
}
|
2002-08-07 06:17:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-11-11 01:57:34 +00:00
|
|
|
GIB_Function_Export_f (void)
|
2002-08-07 06:17:50 +00:00
|
|
|
{
|
|
|
|
gib_function_t *f;
|
2002-11-11 01:57:34 +00:00
|
|
|
int i;
|
2002-08-07 06:17:50 +00:00
|
|
|
|
2002-11-11 01:57:34 +00:00
|
|
|
if (GIB_Argc() < 2)
|
2002-08-07 06:17:50 +00:00
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"function::export: invalid syntax\n"
|
|
|
|
"usage: funciton::export function1 function2 function3 [...]");
|
|
|
|
for (i = 1; i < GIB_Argc(); i++) {
|
|
|
|
if (!(f = GIB_Function_Find (GIB_Argv (i))))
|
|
|
|
Cbuf_Error ("function", "function::export: function '%s' not found", GIB_Argv (i));
|
|
|
|
else if (!f->exported) {
|
|
|
|
Cmd_AddCommand (f->name->str, GIB_Runexported_f, "Exported GIB function.");
|
|
|
|
f->exported = true;
|
|
|
|
}
|
2002-08-07 06:17:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-24 05:14:46 +00:00
|
|
|
void
|
|
|
|
GIB_String_Length_f (void)
|
|
|
|
{
|
|
|
|
if (GIB_Argc() != 2)
|
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"string::length: invalid syntax\n"
|
|
|
|
"usage: string::length string");
|
2002-08-24 05:14:46 +00:00
|
|
|
else
|
2002-11-10 02:50:42 +00:00
|
|
|
GIB_Return (va("%i", (int) strlen(GIB_Argv(1))));
|
2002-08-24 05:14:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GIB_String_Equal_f (void)
|
|
|
|
{
|
|
|
|
if (GIB_Argc() != 3)
|
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"string::equal: invalid syntax\n"
|
|
|
|
"usage: string::equal string1 string2");
|
2002-08-24 05:14:46 +00:00
|
|
|
else
|
|
|
|
GIB_Return (va("%i", !strcmp(GIB_Argv(1), GIB_Argv(2))));
|
|
|
|
}
|
|
|
|
|
2002-08-27 04:47:49 +00:00
|
|
|
void
|
|
|
|
GIB_Thread_Create_f (void)
|
|
|
|
{
|
|
|
|
if (GIB_Argc() != 2)
|
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"thread::create: invalid syntax\n"
|
|
|
|
"usage: thread::create program");
|
2002-08-27 04:47:49 +00:00
|
|
|
else {
|
|
|
|
gib_thread_t *thread = GIB_Thread_New ();
|
|
|
|
Cbuf_AddText (thread->cbuf, GIB_Argv(1));
|
|
|
|
GIB_Thread_Add (thread);
|
|
|
|
GIB_Return (va("%lu", thread->id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GIB_Thread_Kill_f (void)
|
|
|
|
{
|
|
|
|
if (GIB_Argc() != 2)
|
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"thread::kill: invalid syntax\n"
|
|
|
|
"usage: thread::kill id");
|
2002-08-27 04:47:49 +00:00
|
|
|
else {
|
|
|
|
gib_thread_t *thread;
|
|
|
|
cbuf_t *cur;
|
|
|
|
unsigned long int id = strtoul (GIB_Argv(1), 0, 10);
|
|
|
|
thread = GIB_Thread_Find (id);
|
|
|
|
if (!thread) {
|
|
|
|
Cbuf_Error ("thread", "thread.kill: thread %ul does not exist.", id);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (cur = thread->cbuf; cur; cur = cur->down) {
|
2002-10-06 04:40:18 +00:00
|
|
|
// Kill all loops
|
|
|
|
if (GIB_DATA(cur)->type == GIB_BUFFER_LOOP)
|
|
|
|
GIB_DATA(cur)->type = GIB_BUFFER_PROXY; // Proxy to prevent shared locals being freed
|
2002-08-27 04:47:49 +00:00
|
|
|
dstring_clearstr (cur->line);
|
|
|
|
dstring_clearstr (cur->buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-08-27 23:25:52 +00:00
|
|
|
|
|
|
|
/* File access */
|
|
|
|
|
2002-11-14 05:28:54 +00:00
|
|
|
int (*GIB_File_Transform_Path) (dstring_t *path) = NULL;
|
|
|
|
|
|
|
|
int
|
|
|
|
GIB_File_Transform_Path_Null (dstring_t *path)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
GIB_File_Transform_Path_Secure (dstring_t *path)
|
|
|
|
{
|
|
|
|
if (Sys_PathType (path->str) != PATHTYPE_RELATIVE_BELOW)
|
|
|
|
return -1;
|
|
|
|
dstring_insertstr (path, 0, com_gamedir);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-08-27 23:25:52 +00:00
|
|
|
void
|
|
|
|
GIB_File_Read_f (void)
|
|
|
|
{
|
|
|
|
char *path, *contents;
|
|
|
|
int mark;
|
|
|
|
|
|
|
|
if (GIB_Argc () != 2) {
|
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"file::read: invalid syntax\n"
|
|
|
|
"usage: file::read path_and_filename");
|
|
|
|
return;
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
if (!*GIB_Argv (1)) {
|
2002-11-11 01:57:34 +00:00
|
|
|
Cbuf_Error ("file",
|
|
|
|
"file::read: null filename provided");
|
2002-08-27 23:25:52 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
if (GIB_File_Transform_Path (GIB_Argd(1))) {
|
2002-10-13 19:18:10 +00:00
|
|
|
Cbuf_Error ("access",
|
2002-11-14 05:28:54 +00:00
|
|
|
"file::read: access to %s denied", GIB_Argv(1));
|
2002-08-27 23:25:52 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
path = GIB_Argv (1);
|
2002-08-27 23:25:52 +00:00
|
|
|
mark = Hunk_LowMark ();
|
|
|
|
contents = (char *) COM_LoadHunkFile (path);
|
|
|
|
if (!contents) {
|
|
|
|
Cbuf_Error ("file",
|
2002-11-14 05:28:54 +00:00
|
|
|
"file::read: could not open %s for reading: %s", path, strerror (errno));
|
2002-08-27 23:25:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
GIB_Return (contents);
|
|
|
|
Hunk_FreeToLowMark (mark);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GIB_File_Write_f (void)
|
|
|
|
{
|
|
|
|
QFile *file;
|
|
|
|
char *path;
|
|
|
|
|
|
|
|
if (GIB_Argc () != 3) {
|
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"file::write: invalid syntax\n"
|
|
|
|
"usage: file::write path_and_filename data");
|
2002-08-27 23:25:52 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
if (!*GIB_Argv(1)) {
|
2002-11-11 01:57:34 +00:00
|
|
|
Cbuf_Error ("file",
|
|
|
|
"file::write: null filename provided");
|
|
|
|
return;
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
if (GIB_File_Transform_Path (GIB_Argd(1))) {
|
2002-10-13 19:18:10 +00:00
|
|
|
Cbuf_Error ("access",
|
2002-11-14 05:28:54 +00:00
|
|
|
"file::write: access to %s denied", GIB_Argv(1));
|
2002-08-27 23:25:52 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
path = GIB_Argv(1);
|
|
|
|
if (!(file = Qopen (path, "w"))) {
|
2002-08-27 23:25:52 +00:00
|
|
|
Cbuf_Error ("file",
|
2002-11-14 05:28:54 +00:00
|
|
|
"file::write: could not open %s for writing: %s", path, strerror (errno));
|
2002-08-27 23:25:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
Qprintf (file, "%s", GIB_Argv (2));
|
|
|
|
Qclose (file);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GIB_File_Find_f (void)
|
|
|
|
{
|
|
|
|
DIR *directory;
|
|
|
|
struct dirent *entry;
|
|
|
|
char *path;
|
2002-10-13 05:52:06 +00:00
|
|
|
const char *ifs;
|
2002-08-27 23:25:52 +00:00
|
|
|
dstring_t *list;
|
|
|
|
|
|
|
|
if (GIB_Argc () < 2 || GIB_Argc () > 3) {
|
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"file::find: invalid syntax\n"
|
|
|
|
"usage: file::find glob [path]");
|
2002-08-27 23:25:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (GIB_Argc () == 3) {
|
2002-11-14 05:28:54 +00:00
|
|
|
if (!*GIB_Argv(2)) {
|
2002-11-11 01:57:34 +00:00
|
|
|
Cbuf_Error ("file",
|
|
|
|
"file::find: null path provided");
|
|
|
|
return;
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
if (GIB_File_Transform_Path (GIB_Argd(2))) {
|
2002-10-13 19:18:10 +00:00
|
|
|
Cbuf_Error ("access",
|
2002-11-14 05:28:54 +00:00
|
|
|
"file::find: access to %s denied", GIB_Argv(2));
|
2002-08-27 23:25:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
path = GIB_Argv(2);
|
|
|
|
directory = opendir (path);
|
2002-08-27 23:25:52 +00:00
|
|
|
if (!directory) {
|
|
|
|
Cbuf_Error ("file",
|
2002-11-14 05:28:54 +00:00
|
|
|
"file.find: could not open directory %s: %s", path, strerror (errno));
|
2002-08-27 23:25:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
list = dstring_newstr ();
|
2002-10-13 05:52:06 +00:00
|
|
|
if (!(ifs = GIB_Var_Get_Local (cbuf_active, "ifs")))
|
|
|
|
ifs = " ";
|
2002-08-27 23:25:52 +00:00
|
|
|
while ((entry = readdir (directory))) {
|
2002-10-13 05:52:06 +00:00
|
|
|
if (strcmp (entry->d_name, ".") &&
|
|
|
|
strcmp (entry->d_name, "..") &&
|
|
|
|
!fnmatch (GIB_Argv (1), entry->d_name, 0)) {
|
|
|
|
dstring_appendstr (list, ifs);
|
2002-08-27 23:25:52 +00:00
|
|
|
dstring_appendstr (list, entry->d_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (list->str[0])
|
|
|
|
GIB_Return (list->str + 1);
|
|
|
|
else
|
|
|
|
GIB_Return ("");
|
|
|
|
dstring_delete (list);
|
|
|
|
}
|
2002-10-16 04:59:34 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
GIB_File_Move_f (void)
|
|
|
|
{
|
|
|
|
char *path1, *path2;
|
|
|
|
|
|
|
|
if (GIB_Argc () != 3) {
|
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"file::move: invalid syntax\n"
|
|
|
|
"usage: file::move from_file to_file");
|
2002-10-16 04:59:34 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
if (GIB_File_Transform_Path (GIB_Argd(1))) {
|
2002-10-16 04:59:34 +00:00
|
|
|
Cbuf_Error ("access",
|
2002-11-14 05:28:54 +00:00
|
|
|
"file::move: access to %s denied", GIB_Argv(1));
|
2002-10-16 04:59:34 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
if (GIB_File_Transform_Path (GIB_Argd(2))) {
|
2002-10-16 04:59:34 +00:00
|
|
|
Cbuf_Error ("access",
|
2002-11-14 05:28:54 +00:00
|
|
|
"file::move: access to %s denied", GIB_Argv(2));
|
2002-10-16 04:59:34 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
path1 = GIB_Argv(1);
|
|
|
|
path2 = GIB_Argv(2);
|
|
|
|
if (Qrename (path1, path2))
|
2002-10-16 04:59:34 +00:00
|
|
|
Cbuf_Error ("file",
|
2002-11-11 01:57:34 +00:00
|
|
|
"file::move: could not move %s to %s: %s",
|
2002-11-14 05:28:54 +00:00
|
|
|
path1, path2, strerror(errno));
|
2002-10-16 04:59:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GIB_File_Delete_f (void)
|
|
|
|
{
|
|
|
|
char *path;
|
|
|
|
|
|
|
|
if (GIB_Argc () != 2) {
|
|
|
|
Cbuf_Error ("syntax",
|
2002-11-11 01:57:34 +00:00
|
|
|
"file::delete: invalid syntax\n"
|
|
|
|
"usage: file::delete file");
|
2002-10-16 04:59:34 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
if (GIB_File_Transform_Path (GIB_Argd(1))) {
|
2002-10-16 04:59:34 +00:00
|
|
|
Cbuf_Error ("access",
|
2002-11-14 05:28:54 +00:00
|
|
|
"file::delete: access to %s denied", GIB_Argv(1));
|
2002-10-16 04:59:34 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-11-14 05:28:54 +00:00
|
|
|
path = GIB_Argv (1);
|
|
|
|
if (Qremove(path))
|
2002-10-16 04:59:34 +00:00
|
|
|
Cbuf_Error ("file",
|
2002-11-14 05:28:54 +00:00
|
|
|
"file::delete: could not delete %s: %s",
|
|
|
|
path, strerror(errno));
|
2002-10-16 04:59:34 +00:00
|
|
|
}
|
|
|
|
|
2002-08-28 08:00:35 +00:00
|
|
|
void
|
|
|
|
GIB_Range_f (void)
|
|
|
|
{
|
|
|
|
double i, inc, start, limit;
|
|
|
|
dstring_t *dstr;
|
2002-10-13 19:46:47 +00:00
|
|
|
const char *ifs;
|
2002-08-28 08:00:35 +00:00
|
|
|
if (GIB_Argc () < 3 || GIB_Argc () > 4) {
|
|
|
|
Cbuf_Error ("syntax",
|
|
|
|
"range: invalid syntax\n"
|
|
|
|
"range: lower upper [step]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
limit = atof(GIB_Argv(2));
|
|
|
|
start = atof(GIB_Argv(1));
|
|
|
|
if (GIB_Argc () == 4)
|
|
|
|
inc = atof(GIB_Argv(3));
|
|
|
|
else
|
|
|
|
inc = limit < start ? -1.0 : 1.0;
|
|
|
|
if (inc == 0.0) {
|
|
|
|
GIB_Return ("");
|
|
|
|
return;
|
|
|
|
}
|
2002-10-13 19:46:47 +00:00
|
|
|
if (!(ifs = GIB_Var_Get_Local (cbuf_active, "ifs")))
|
|
|
|
ifs = " ";
|
2002-08-28 08:00:35 +00:00
|
|
|
dstr = dstring_newstr ();
|
|
|
|
for (i = atof(GIB_Argv(1)); inc < 0 ? i >= limit : i <= limit; i += inc)
|
2002-10-13 19:46:47 +00:00
|
|
|
dstring_appendstr (dstr, va("%s%.10g", ifs, i));
|
2002-08-28 08:00:35 +00:00
|
|
|
GIB_Return (dstr->str[0] ? dstr->str+1 : "");
|
|
|
|
dstring_delete (dstr);
|
|
|
|
}
|
|
|
|
|
2002-10-06 04:40:18 +00:00
|
|
|
void
|
|
|
|
GIB_Print_f (void)
|
|
|
|
{
|
|
|
|
if (GIB_Argc() != 2) {
|
|
|
|
Cbuf_Error ("syntax",
|
|
|
|
"print: invalid syntax\n"
|
|
|
|
"usage: print text");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Sys_Printf ("%s", GIB_Argv(1));
|
|
|
|
}
|
|
|
|
|
2002-08-03 06:04:00 +00:00
|
|
|
void
|
2002-11-14 05:28:54 +00:00
|
|
|
GIB_Builtin_Init (qboolean sandbox)
|
2002-08-03 06:04:00 +00:00
|
|
|
{
|
2002-08-24 05:14:46 +00:00
|
|
|
gib_globals = Hash_NewTable (512, GIB_Var_Get_Key, GIB_Var_Free, 0);
|
|
|
|
|
2002-11-14 05:28:54 +00:00
|
|
|
if (sandbox)
|
|
|
|
GIB_File_Transform_Path = GIB_File_Transform_Path_Secure;
|
|
|
|
else
|
|
|
|
GIB_File_Transform_Path = GIB_File_Transform_Path_Null;
|
|
|
|
|
2002-08-07 06:17:50 +00:00
|
|
|
GIB_Builtin_Add ("function", GIB_Function_f, GIB_BUILTIN_NORMAL);
|
2002-11-11 01:57:34 +00:00
|
|
|
GIB_Builtin_Add ("function::get", GIB_Function_Get_f, GIB_BUILTIN_NORMAL);
|
|
|
|
GIB_Builtin_Add ("function::export", GIB_Function_Export_f, GIB_BUILTIN_NORMAL);
|
2002-08-08 09:20:00 +00:00
|
|
|
GIB_Builtin_Add ("local", GIB_Local_f, GIB_BUILTIN_NORMAL);
|
|
|
|
GIB_Builtin_Add ("global", GIB_Global_f, GIB_BUILTIN_NORMAL);
|
2002-11-11 01:57:34 +00:00
|
|
|
GIB_Builtin_Add ("global::delete", GIB_Global_Delete_f, GIB_BUILTIN_NORMAL);
|
2002-08-07 06:17:50 +00:00
|
|
|
GIB_Builtin_Add ("return", GIB_Return_f, GIB_BUILTIN_NORMAL);
|
|
|
|
GIB_Builtin_Add ("if", GIB_If_f, GIB_BUILTIN_FIRSTONLY);
|
|
|
|
GIB_Builtin_Add ("ifnot", GIB_If_f, GIB_BUILTIN_FIRSTONLY);
|
|
|
|
GIB_Builtin_Add ("while", GIB_While_f, GIB_BUILTIN_NOPROCESS);
|
2002-11-11 01:57:34 +00:00
|
|
|
GIB_Builtin_Add ("field::get", GIB_Field_Get_f, GIB_BUILTIN_NORMAL);
|
2002-08-28 08:00:35 +00:00
|
|
|
GIB_Builtin_Add ("for", GIB_For_f, GIB_BUILTIN_NORMAL);
|
|
|
|
GIB_Builtin_Add ("__for", GIB___For_f, GIB_BUILTIN_NORMAL);
|
2002-08-07 06:17:50 +00:00
|
|
|
GIB_Builtin_Add ("break", GIB_Break_f, GIB_BUILTIN_NORMAL);
|
2002-11-11 01:57:34 +00:00
|
|
|
GIB_Builtin_Add ("string::length", GIB_String_Length_f, GIB_BUILTIN_NORMAL);
|
|
|
|
GIB_Builtin_Add ("string::equal", GIB_String_Equal_f, GIB_BUILTIN_NORMAL);
|
|
|
|
GIB_Builtin_Add ("thread::create", GIB_Thread_Create_f, GIB_BUILTIN_NORMAL);
|
|
|
|
GIB_Builtin_Add ("thread::kill", GIB_Thread_Kill_f, GIB_BUILTIN_NORMAL);
|
|
|
|
GIB_Builtin_Add ("file::read", GIB_File_Read_f, GIB_BUILTIN_NORMAL);
|
|
|
|
GIB_Builtin_Add ("file::write", GIB_File_Write_f, GIB_BUILTIN_NORMAL);
|
|
|
|
GIB_Builtin_Add ("file::find", GIB_File_Find_f, GIB_BUILTIN_NORMAL);
|
|
|
|
GIB_Builtin_Add ("file::move", GIB_File_Move_f, GIB_BUILTIN_NORMAL);
|
|
|
|
GIB_Builtin_Add ("file::delete", GIB_File_Delete_f, GIB_BUILTIN_NORMAL);
|
2002-08-28 08:00:35 +00:00
|
|
|
GIB_Builtin_Add ("range", GIB_Range_f, GIB_BUILTIN_NORMAL);
|
2002-10-06 04:40:18 +00:00
|
|
|
GIB_Builtin_Add ("print", GIB_Print_f, GIB_BUILTIN_NORMAL);
|
2002-08-03 06:04:00 +00:00
|
|
|
}
|