home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
text
/
jed
/
src
/
jed.lha
/
initsymbols.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-01-09
|
4KB
|
175 lines
/*
* INITSYMBOLS.C
* (c) 1992-3 J.Harper
*
* defines and creates the default commands
*/
#include "jed.h"
#include "jed_protos.h"
Prototype BOOL initcommands (VOID);
Prototype VOID killsymbols (VOID);
typedef struct INIT {
STRPTR i_Name;
CMPTR i_Func;
} INIT;
Local const INIT CmdList[] =
{
"+", cmd_plus,
"-", cmd_minus,
"*", cmd_product,
"/", cmd_divide,
"%", cmd_mod,
"<<", cmd_lshift,
">>", cmd_rshift,
"~", cmd_b_not,
"!", cmd_l_not,
"|", cmd_b_or,
"||", cmd_l_or,
"&", cmd_b_and,
"&&", cmd_l_and,
"^", cmd_b_eor,
"^^", cmd_l_eor,
"=", cmd_equals,
"==", cmd_equality,
"!=", cmd_inequality,
">", cmd_gtthan,
"<", cmd_ltthan,
">=", cmd_gethan,
"<=", cmd_lethan,
"activatefile", cmd_activatefile,
"addsym", cmd_addsym,
"addpath", cmd_addpath,
"arg", cmd_arg,
"atol", cmd_atol,
"bind", cmd_bind,
"block", cmd_block,
"break", cmd_break,
"car", cmd_car,
"cd", cmd_cd,
"cdr", cmd_cdr,
"changes", cmd_changes,
"cli", cmd_cli,
"close", cmd_close,
"copy", cmd_copy,
"cut", cmd_cut,
"clear", cmd_clear,
"changecase", cmd_changecase,
"delete", cmd_delete,
"dowhile", cmd_dowhile,
"dlock", cmd_dlock,
"export", cmd_export,
"extract", cmd_extract,
"find", cmd_find,
"freq", cmd_freq,
"format", cmd_format,
"getref", cmd_getref,
"getstr", cmd_getstr,
"getnum", cmd_getnum,
"getpref", cmd_getpref,
"if", cmd_if,
"ilock", cmd_ilock,
"insert", cmd_insert,
"info", cmd_info,
"isalpha", cmd_isalpha,
"isdigit", cmd_isdigit,
"isalnum", cmd_isalnum,
"isspace", cmd_isspace,
"join", cmd_join,
"move", cmd_move,
"match", cmd_match,
"menu", cmd_menu,
"nargs", cmd_nargs,
"newfile", cmd_newfile,
"newview", cmd_newview,
"nextwind", cmd_nextwind,
"nop", cmd_nop,
"openfile", cmd_openfile,
"prevwind", cmd_prevwind,
"poke", cmd_poke,
"position", cmd_position,
"replace", cmd_replace,
"remsym", cmd_remsym,
"rempath", cmd_rempath,
"rename", cmd_rename,
"renamesym", cmd_renamesym,
"req", cmd_req,
"rexx", cmd_rexx,
"return", cmd_return,
"savefile", cmd_savefile,
"savefileas", cmd_savefileas,
"savesection", cmd_savesection,
"saveprefs", cmd_saveprefs,
"select", cmd_select,
"setmenu", cmd_setmenu,
"setpref", cmd_setpref,
"settitle", cmd_settitle,
"script", cmd_script,
"sleep", cmd_sleep,
"split", cmd_split,
"substr", cmd_substr,
"symboldump", cmd_symboldump,
"system", cmd_system,
"toupper", cmd_toupper,
"tolower", cmd_tolower,
"type", cmd_type,
"unbind", cmd_unbind,
"undo", cmd_undo,
"unsleep", cmd_unsleep,
"while", cmd_while,
NULL, NULL
};
/*
* initializes command list
*/
BOOL
initcommands(VOID)
{
INIT *init = CmdList;
VALUE tmp;
tmp.val_Type = VTF_FUNC;
while(init->i_Name)
{
tmp.val_Value.Func = init->i_Func;
if(!(addgsym(init->i_Name, STF_COMMAND, &tmp)))
{
killsymbols();
return(FALSE);
}
init++;
}
return(TRUE);
}
/*
* kills symbol table
*/
VOID
killsymbols(VOID)
{
HASHNODE **hash = SymbolTab;
WORD i;
for(i = 0; i < GSYMTABSIZE; i++)
{
GSYM *sym = hash[i], *next;
while(sym)
{
next = sym->gs_Node.h_Next;
freestring(sym->gs_Node.h_Name);
releasevalue(&sym->gs_Sym.sym_Value);
FreeVec(sym);
sym = next;
}
}
}