Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

nanomud-script.c File Reference

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
#include <winsock.h>
#include <richedit.h>
#include "NanoMud.h"
#include <assert.h>
#include "nanomud-script.h"

Include dependency graph for nanomud-script.c:

Include dependency graph

Go to the source code of this file.

Enumerations

enum  { SC_NORM, SC_VAR, SC_FUN, SC_NONE }

Functions

BOOL check_alias (char *input)
void check_macro (char *input)
BOOL check_path (char *input)
void check_string (char *pattern, char *str)
void check_trigger (char *input)
void free_alias (void)
void free_class (void)
void free_macro (void)
void free_path (void)
void free_trigger (void)
void handle_aliases (char *input)
void handle_capture (char *input)
void handle_class (char *input)
void handle_help (char *input)
void handle_input (char *in)
void handle_log (char *input)
void handle_macros (char *input)
void handle_open (char *input)
void handle_option (char *input)
void handle_path (char *input)
void handle_save (char *input)
void handle_script (char *input)
void handle_scripts (char *input, char *output)
void handle_set_options (char *input)
void handle_triggers (char *input)
void handle_url (char *input)
void handle_var (char *input)
void init_scripts (void)
int is_function (char *str)
BOOL is_operator (char *point)
void load_scripts (void)
void make_token (char *str)
char * makelower (char *str)
char * makeupper (char *str)
ALnew_alias (void)
CLnew_class (void)
MCnew_macro (void)
PAnew_path (void)
TRnew_trigger (void)
VRnew_var (void)
void parse_script (const unsigned char *script)
void save_aliases (FILE *fp)
void save_macros (FILE *fp)
void save_paths (FILE *fp)
void save_scripts (void)
void save_triggers (FILE *fp)
void save_vars (FILE *fp)
void sort_list (int count, struct script_table_command tab[])
void write_func_interp (void)
void write_shit_good (void)

Variables

ALaliaslist
CLclasslist
cstack ** cmd_stack
ALfreealias
CLfreeclass
MCfreemacro
PAfreepath
TRfreetrigger
VRfreevar
func_type func_table []
MCmacrolist
PApathlist
script_table_command stable []
enum { ... }  state
char str_emp [1]
TRtriggerlist
VRvarlist


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
SC_NORM 
SC_VAR 
SC_FUN 
SC_NONE 

Definition at line 58 of file nanomud-script.c.

00058      {
00059     SC_NORM,
00060     SC_VAR,
00061     SC_FUN,
00062     SC_NONE
00063 } state;    


Function Documentation

BOOL check_alias char *  input  ) 
 

Definition at line 982 of file nanomud-script.c.

References AL, BOOL, alias::name, alias::next, and one_argument().

Referenced by handle_input().

00983 {
00984     AL *alias;
00985     char command[500];
00986     char buf[500];
00987     
00988     input = one_argument(input, command);
00989     alias = aliaslist;
00990     if (alias == NULL)
00991         return FALSE;
00992     for (alias = aliaslist; alias != NULL; alias = alias->next)
00993     {
00994         
00995         if (!strcmp(command, alias->name))
00996         {
00997            // MessageBox(MudMain, alias->script,"",MB_OK);
00998            //handle_input (alias->script);
00999            return TRUE;
01000            continue;
01001        }    
01002         
01003             
01004     }
01005     
01006     return FALSE;
01007 }

Here is the call graph for this function:

void check_macro char *  input  ) 
 

Definition at line 1052 of file nanomud-script.c.

01053 {
01054     return;
01055 }

BOOL check_path char *  input  ) 
 

Definition at line 1031 of file nanomud-script.c.

References BOOL, path::name, path::next, one_argument(), and PA.

Referenced by handle_input().

01032 {
01033     
01034     PA *path;
01035     char command[500];
01036     input = one_argument(input, command);
01037     
01038     path = pathlist;
01039     if (path == NULL)
01040         return FALSE;
01041     for (path=pathlist; path != NULL; path = path->next)
01042     {
01043         if (!strcmp(command, path->name))
01044         {
01045             return TRUE;
01046             continue;
01047         }
01048     }
01049             
01050     return FALSE;
01051 }

Here is the call graph for this function:

void check_string char *  pattern,
char *  str
 

Definition at line 1423 of file nanomud-script.c.

References FALSE, fnmatch(), and GiveError().

01424 {
01425  //   LOG("Analyzing string: %s with pattern of: %s", str, pattern);
01426     if (fnmatch(pattern, str, 0) == 0)
01427         GiveError("Match", FALSE);
01428         
01429 }

Here is the call graph for this function:

void check_trigger char *  input  ) 
 

Definition at line 1011 of file nanomud-script.c.

References trigger::name, trigger::next, and TR.

01012 {
01013     TR *trigger;
01014     char *point;
01015     
01016     trigger = triggerlist;
01017     
01018     if (trigger == NULL)
01019         return;
01020     for (; trigger != NULL; trigger = trigger->next) {
01021         point = strstr(input, trigger->name);
01022         if (point != NULL) {
01023             //parse_trigger(trigger);
01024             // parse will do all the real work!
01025         }
01026     }
01027     
01028     return;
01029 }

void free_alias void   ) 
 

Definition at line 697 of file nanomud-script.c.

00698 {
00699     return;
00700 }

void free_class void   ) 
 

Definition at line 682 of file nanomud-script.c.

00683 {
00684     return;
00685 }

void free_macro void   ) 
 

Definition at line 702 of file nanomud-script.c.

00703 {
00704     return;
00705 }

void free_path void   ) 
 

Definition at line 687 of file nanomud-script.c.

00688 {
00689     return;
00690 }

void free_trigger void   ) 
 

Definition at line 692 of file nanomud-script.c.

00693 {
00694     return;
00695 }

void handle_aliases char *  input  ) 
 

Definition at line 817 of file nanomud-script.c.

References AL, aliaslist, CL, alias::cl, classlist, alias::enabled, FALSE, GiveError(), classes::name, alias::name, new_alias(), alias::next, alias::priority, alias::script, script_strip(), str_dup(), string_compare(), and TRUE.

Referenced by handle_input().

00818 {
00819     AL *alias;
00820     alias = new_alias();
00821     if (alias == NULL)
00822         GiveError("Alias Failed to initialize", TRUE);
00823     char name[200];
00824     char value[200];
00825     char priority[4];
00826     char cls[100];
00827     
00828     CL *cls2;
00829     int pri;
00830     
00831     input = script_strip(input, name);
00832     input = script_strip(input, value);
00833     input = script_strip(input, priority);
00834     input = script_strip(input, cls);
00835     
00836     if (name[0] == '\0')
00837     {
00838         GiveError("Improper Alias format of type: name", FALSE); 
00839         return;
00840     }
00841     if (value[0] == '\0')
00842     {
00843         GiveError("Improper Alias format of type: value", FALSE);
00844         return;
00845     }
00846     if (atoi (priority) > 1000)
00847         pri = 1000;
00848     else if (atoi (priority) < 0)
00849         pri = 0;
00850     else
00851         pri = atoi(priority);
00852         
00853     for (cls2 = classlist; cls2 != NULL; cls2++) {
00854         if (string_compare(cls, cls2->name))
00855             break;
00856     }
00857     
00858     alias->name = str_dup(name);
00859     alias->enabled = TRUE;
00860     alias->priority = pri;
00861     alias->script = str_dup(value);
00862     alias->next = aliaslist;
00863     alias->cl = (cls2 == NULL ? classlist : cls2);
00864     aliaslist = alias;
00865         
00866     return;
00867 }

Here is the call graph for this function:

void handle_capture char *  input  ) 
 

Definition at line 958 of file nanomud-script.c.

Referenced by handle_input().

00959 {
00960     return;
00961 }

void handle_class char *  input  ) 
 

Definition at line 710 of file nanomud-script.c.

References CL, classlist, classes::enabled, GiveError(), classes::name, new_class(), classes::next, classes::priority, script_strip(), str_dup(), and TRUE.

Referenced by handle_input().

00711 {
00712     if (classlist == NULL) {
00713         // this should only run once!
00714         classlist = new_class();
00715         classlist->enabled = TRUE;
00716         classlist->name = str_dup("main_class");
00717         classlist->priority = 0;
00718         classlist->next = NULL;
00719     }
00720     
00721     CL *newClass;
00722     newClass = new_class();
00723     
00724     if (newClass == NULL)
00725         GiveError("Null class encountered... that's not good m'kay?", TRUE);
00726     
00727     char thisName[100];
00728     char thisPriority[4];
00729     
00730     int pri;
00731     
00732     input = script_strip(input, thisName);
00733     input = script_strip(input, thisPriority);
00734     
00735     if (thisName[0] == '\0') {
00736         // this means it's a default class!
00737         newClass = classlist;
00738         return;
00739     }
00740     
00741     else {
00742         if (atoi (thisPriority) > 1000)
00743             pri = 1000;
00744         else if (atoi (thisPriority) < 0)
00745             pri = 0;
00746         else
00747             pri = atoi(thisPriority);    
00748         
00749         newClass->name = str_dup(thisName);
00750         newClass->enabled = TRUE;
00751         newClass->priority = pri;
00752         newClass->next = classlist->next;
00753         classlist->next = newClass;
00754     }
00755     
00756     return;
00757 }

Here is the call graph for this function:

void handle_help char *  input  ) 
 

Definition at line 954 of file nanomud-script.c.

00955 {
00956     return;
00957 }

void handle_input char *  in  ) 
 

Definition at line 1206 of file nanomud-script.c.

References AL, ANSI_YELLOW, termbuf::buffer, check_alias(), check_output(), check_path(), echo_off, handle_aliases(), handle_capture(), handle_class(), handle_log(), handle_macros(), handle_open(), handle_option(), handle_path(), handle_save(), handle_set_options(), handle_triggers(), handle_url(), handle_var(), MudInput, alias::name, path::name, alias::next, path::next, one_argument(), PA, ParseLines(), SBuf, alias::script, path::script, send_buff, str_dup(), strprefix(), and tbuf.

Referenced by EditProc(), load_scripts(), and load_settings().

01207 {
01208 
01209     unsigned long int runner=0;
01210     typedef struct termbuf      SBuf;
01211     unsigned long int ilen=strlen(in);
01212     if (ilen < 10)
01213         ilen = 10;
01214     char command[ilen]; 
01215     int err;
01216     char buff2[ilen+20];
01217     char buffer[ilen+20];
01218     char buff3[ilen+20];
01219     char buff4[ilen+20];
01220     command[0] = '\0';
01221     buff2[0] = '\0';
01222     buff3[0] = '\0';
01223     buff4[0] = '\0';
01224     buffer[0] = '\0';
01225 
01226     strcpy(buffer,in);
01227     extern SBuf *send_buff[100];
01228     in = one_argument(in,command);
01229     bool found;
01230     AL *alias;
01231     PA *path;
01232     char *point = buffer;
01233     char *pbuf;
01234     pbuf = buff3;
01235     
01236     if (strprefix("#",&command[0]))
01237     {
01238           
01239           if ((strchr(buffer, ';') != NULL) && (strlen(strstr(buffer, ";")) != strlen(buffer)))
01240           {
01241               
01242               for (;*point;point++)
01243               {
01244                   if (*point == ';')
01245                   {
01246 
01247                       buff3[0] = '\0';
01248                       handle_input(buff4);
01249                       buff4[0] = '\0';
01250                       continue;
01251                   }
01252                   *pbuf = *point;
01253                   strcat(buff4,pbuf);
01254                   
01255                   
01256               }
01257               if (buff4[0] != '\0')
01258               {
01259                   buff3[0] = '\0';
01260                   handle_input(buff4);
01261                   buff4[0] = '\0';
01262                   return;
01263               } 
01264               return;   
01265 
01266           }
01267           else if (buffer[0] == ';' && (strstr(&buffer[1], ";") != NULL))
01268           {
01269               // Let's send the first command on off to the thingie
01270               for (runner=0;*point;point++,runner++)
01271               {
01272                   if (*point == ';' && runner != 0)
01273                       break;
01274                   
01275                   *pbuf = *point;
01276                   strcat(buff4,pbuf);
01277               }
01278               
01279               strcat(buff2, buff4);
01280               strcat(buff2, "\n");
01281               for (runner=0;runner<=100, send_buff[runner] != NULL;runner++)
01282               {
01283                   if (send_buff[runner]->buffer == '\0')
01284                   {
01285                       send_buff[runner]->buffer = str_dup(buff2);
01286                       
01287                       check_output();
01288                       break;
01289                   }
01290               } 
01291               buff2[0] = '\0';   
01292               strcat(buff2, ANSI_YELLOW);
01293               strcat(buff2, buff4);
01294               strcat(buff2, "\e[0m");
01295               strcat(buff2, "\n");
01296               ParseLines(str_dup(buff2));
01297               tbuf->y_end += 13;
01298               tbuf->x_end =0;
01299               pbuf[0] = '\0';
01300               buff4[0] = '\0';
01301               buff2[0] = '\0';
01302               buff3[0]  = '\0';
01303               *point++;
01304               
01305               for (;*point;*point++)
01306               {
01307                   *pbuf = *point;
01308                   strcat(buff4, pbuf);
01309               }
01310               handle_input(buff4);
01311               return;
01312           }        
01313               
01314               
01315           if (check_alias(command) == TRUE)
01316           {
01317               for (alias = aliaslist; alias!= NULL;alias = alias->next)
01318               {
01319                   if (!strcmp(command, alias->name))
01320                   {
01321                      strcat(buff3, alias->script);
01322                      strcat(buff3, " ");
01323                      strcat(buff3, in);
01324                      memcpy(buffer, buff3, sizeof(buff3));
01325                      handle_input(buffer);
01326                      
01327                      return;
01328                      
01329                   }
01330               }
01331           }
01332                      
01333           if (!strprefix(".", &command[0]))
01334           {
01335               
01336               if (check_path(&command[1]) == TRUE)
01337               {
01338                   for (path = pathlist; path != NULL; path = path->next)
01339                   {
01340                       if (!strcmp(&command[1], path->name))
01341                       {
01342                           
01343                           strcat(buff3, path->script);
01344                           strcat(buff3, " ");
01345                           strcat(buff3, in);
01346                           memcpy(buffer, buff3, sizeof(buff3));
01347                           handle_input(buffer);
01348                           return;
01349                           
01350                       }
01351                   }
01352               }
01353           }
01354                           
01355           
01356           if (!echo_off && buffer[0] != '\0')
01357           {
01358               strcat(buff2, ANSI_YELLOW);
01359               strcat(buff2, buffer);
01360               strcat(buff2, "\e[0m ");
01361               
01362               
01363               strcat(buff2, "\n");
01364               
01365               ParseLines(str_dup(buff2));              
01366               
01367           }
01368           
01369           if (strlen(buff2) == 0)
01370               strcat(buff2, "\n");                
01371           
01372           strcat(buffer, "\n");
01373           for (runner=0;runner<=100, send_buff[runner] != NULL;runner++)
01374           {
01375               if (send_buff[runner]->buffer == '\0')
01376               {
01377                   send_buff[runner]->buffer = str_dup(buffer);
01378                   check_output();
01379                   break;
01380               }
01381           }    
01382           tbuf->y_end +=13;
01383           tbuf->x_end = 0;
01384           buffer[0] = '\0';
01385           return;
01386     }
01387       
01388          
01389     if (!strprefix(command, "#trigger"))
01390         handle_triggers(in);
01391     else if (!strprefix(command, "#alias"))
01392         handle_aliases(in);
01393     else if (!strprefix(command, "#macro"))
01394         handle_macros(in);
01395     else if (!strprefix(command, "#path"))
01396         handle_path(in);
01397     else if (!strprefix(command, "#url"))
01398         handle_url(in);
01399     else if (!strprefix(command, "#class"))
01400         handle_class(in);
01401     else if (!strprefix(command, "#open"))
01402         handle_open(in);
01403     else if (!strprefix(command, "#log"))
01404         handle_log(in);
01405     else if (!strprefix(command, "#capture"))
01406         handle_capture(in);
01407     else if (!strprefix(command, "#option"))
01408         handle_option(in);
01409     else if (!strprefix(command, "#save"))
01410         handle_save(in);
01411     else if (!strprefix(command, "#var"))
01412         handle_var(in);
01413     else if (!strprefix(command, "#setoption"))
01414         handle_set_options(in);
01415     
01416     
01417 
01418     SendMessage(MudInput, WM_SETTEXT, 0, (LPARAM)(LPCSTR)"");
01419     return;
01420 }

Here is the call graph for this function:

void handle_log char *  input  ) 
 

Definition at line 950 of file nanomud-script.c.

Referenced by handle_input().

00951 {
00952     return;
00953 }

void handle_macros char *  input  ) 
 

Definition at line 868 of file nanomud-script.c.

Referenced by handle_input().

00869 {
00870     return;
00871 }

void handle_open char *  input  ) 
 

Definition at line 946 of file nanomud-script.c.

Referenced by handle_input().

00947 {
00948     return;
00949 }

void handle_option char *  input  ) 
 

Definition at line 966 of file nanomud-script.c.

Referenced by handle_input().

00967 {
00968     return;
00969 }

void handle_path char *  input  ) 
 

Definition at line 896 of file nanomud-script.c.

References CL, path::cl, classlist, path::enabled, FALSE, GiveError(), classes::name, path::name, new_path(), path::next, PA, pathlist, path::priority, path::script, script_strip(), str_dup(), string_compare(), and TRUE.

Referenced by handle_input().

00897 {
00898     PA *path;
00899     path = new_path();
00900     if (path == NULL)
00901         GiveError("Path failed to initialize", TRUE);
00902     char name[200];
00903     char whereto[200];
00904     char priority[4];
00905     char cls[100];
00906     
00907     CL *cls2;
00908     int pri;
00909     
00910     input = script_strip(input, name);
00911     input = script_strip(input, whereto);
00912     input = script_strip(input, priority);
00913     input = script_strip(input, cls);
00914     
00915     if (name[0] == '\0')
00916     {
00917         GiveError("Improper Path format of type: name", FALSE); 
00918         return;
00919     }
00920     
00921     if (atoi (priority) > 1000)
00922         pri = 1000;
00923     else if (atoi (priority) < 0)
00924         pri = 0;
00925     else
00926         pri = atoi(priority);
00927         
00928     for (cls2 = classlist; cls2 != NULL; cls2++) {
00929         if (string_compare(cls, cls2->name))
00930             break;
00931     }
00932     
00933     path->name = str_dup(name);
00934     path->enabled = TRUE;
00935     path->priority = pri;
00936     path->script = str_dup(whereto);
00937     path->next = pathlist;
00938     path->cl = (cls2 == NULL ? classlist : cls2);
00939     pathlist = path;
00940     return;
00941 }

Here is the call graph for this function:

void handle_save char *  input  ) 
 

Definition at line 970 of file nanomud-script.c.

Referenced by handle_input().

00971 {
00972 
00973     return;
00974 }

void handle_script char *  input  ) 
 

Definition at line 962 of file nanomud-script.c.

00963 {
00964     return;
00965 }

void handle_scripts char *  input,
char *  output
 

Definition at line 976 of file nanomud-script.c.

00977 {
00978     return;
00979 }

void handle_set_options char *  input  ) 
 

Definition at line 1057 of file nanomud-script.c.

References session_data::colour, session_data::EnableAliases, session_data::EnableBlinkies, session_data::EnableClientChat, session_data::EnableMacros, session_data::EnablePaths, session_data::EnablePing, session_data::EnableScripts, session_data::EnableSound, session_data::EnableSplashScreen, session_data::EnableTestLogging, session_data::EnableTN, session_data::EnableTriggers, session_data::EnableUsageReports, give_term_error(), session_data::host, session_data::IsBetaTester, session_data::max_buffer, session_data::name, session_data::OptimizeDualScreen, session_data::port, str_dup(), strprefix(), this_session, and session_data::UseMemoryCompression.

Referenced by handle_input().

01058 {
01059     input[strlen(input)-1] = '\0';
01060     if (!strprefix("name", input))
01061     {
01062         this_session->name = str_dup(&input[5]);
01063     }    
01064     else if (!strprefix("host", input))
01065     {
01066         this_session->host = str_dup(&input[5]);
01067     }    
01068     else if (!strprefix("port", input))
01069     {
01070         this_session->port = atoi(&input[5]);
01071     }    
01072     else if (!strprefix("colour", input)) 
01073     {    
01074         if (input[7] == '1')
01075             this_session->colour = TRUE;
01076         else
01077             this_session->colour = FALSE;
01078      
01079     }
01080     else if (!strprefix("max_buffer", input))
01081         this_session->max_buffer = atoi(&input[11]);
01082     else if (!strprefix("UseMemoryCompression", input))
01083     {
01084         if (input[strlen("UseMemoryCompression")+1] == '1')
01085             this_session->UseMemoryCompression = TRUE;
01086         else
01087             this_session->UseMemoryCompression = FALSE;
01088     }        
01089     else if (!strprefix("IsBetaTester", input))
01090     {
01091         if (input[strlen("IsBetaTester")+1] == '1')
01092             this_session->IsBetaTester = TRUE;
01093         else
01094             this_session->IsBetaTester = FALSE;
01095     }
01096     else if (!strprefix("EnableTestLogging", input))
01097     {
01098         if (input[strlen("EnableTestLogging")+1] == '1')
01099             this_session->EnableTestLogging = TRUE;
01100         else
01101             this_session->EnableTestLogging = FALSE;
01102     }        
01103     else if (!strprefix("OptimizeDualScreen", input))
01104     {
01105         if (input[strlen("OptimizeDualScreen")+1] == '1')
01106             this_session->OptimizeDualScreen = TRUE;
01107         else
01108             this_session->OptimizeDualScreen = FALSE;
01109     }        
01110     else if (!strprefix("EnableScripts", input))
01111     {
01112         if (input[strlen("EnableScripts")+1] == '1')
01113             this_session->EnableScripts = TRUE;
01114         else
01115             this_session->EnableScripts = FALSE;
01116     }        
01117     else if (!strprefix("EnableAliases", input))
01118     {
01119         if (input[strlen("EnableAliases")+1] == '1')
01120             this_session->EnableAliases = TRUE;
01121         else
01122             this_session->EnableAliases = FALSE;
01123     }        
01124     else if (!strprefix("EnableTriggers", input))
01125     {
01126         if (input[strlen("EnableTriggers")+1] == '1')
01127             this_session->EnableTriggers = TRUE;
01128         else
01129             this_session->EnableTriggers = FALSE;
01130     }        
01131     else if (!strprefix("EnablePaths", input))
01132     {
01133         if (input[strlen("EnablePaths")+1] == '1')
01134             this_session->EnablePaths = TRUE;
01135         else
01136             this_session->EnablePaths = FALSE;
01137     }        
01138     else if (!strprefix("EnableMacros", input))
01139     {
01140         if (input[strlen("EnableMacros")+1] == '1')
01141             this_session->EnableMacros = TRUE;
01142         else
01143             this_session->EnableMacros = FALSE;
01144     }        
01145     else if (!strprefix("EnableSplashScreen", input))
01146     {
01147         if (input[strlen("EnableSplashScreen")+1] == '1')
01148             this_session->EnableSplashScreen = TRUE;
01149         else
01150             this_session->EnableSplashScreen = FALSE;
01151     }        
01152     else if (!strprefix("EnableClientChat", input))
01153     {
01154         if (input[strlen("EnableClientChat")+1] == '1')
01155             this_session->EnableClientChat = TRUE;
01156         else
01157             this_session->EnableClientChat = FALSE;
01158     }        
01159     else if (!strprefix("EnablePing", input))
01160     {
01161         if (input[strlen("EnablePing")+1] == '1')
01162             this_session->EnablePing = TRUE;
01163         else
01164             this_session->EnablePing = FALSE;
01165        
01166     }        
01167     else if (!strprefix("EnableUsageReports", input))
01168     {
01169         if (input[strlen("EnableUsageReports")+1] == '1')
01170             this_session->EnableUsageReports = TRUE;
01171         else
01172             this_session->EnableUsageReports = FALSE;
01173     }        
01174     else if (!strprefix("EnableBlinkies", input))
01175     {
01176         if (input[strlen("EnableBlinkies")+1] == '1')
01177             this_session->EnableBlinkies = TRUE;
01178         else
01179             this_session->EnableBlinkies = FALSE;
01180     }        
01181     else if (!strprefix("EnableSound", input))
01182     {
01183         if (input[strlen("EnableSound")+1] == '1')
01184             this_session->EnableSound = TRUE;
01185         else
01186             this_session->EnableSound = FALSE;
01187     }        
01188     else if (!strprefix("EnableTN", input))
01189     {
01190         if (input[strlen("EnableTN")+1] == '1')
01191             this_session->EnableTN = TRUE;
01192         else
01193             this_session->EnableTN = FALSE;
01194     }
01195     else
01196         give_term_error("Unrecognized option. Please try again.");
01197         
01198         
01199 }    

Here is the call graph for this function:

void handle_triggers char *  input  ) 
 

Definition at line 761 of file nanomud-script.c.

References CL, trigger::cl, classlist, trigger::enabled, FALSE, GiveError(), classes::name, trigger::name, new_trigger(), trigger::next, trigger::priority, trigger::script, script_strip(), str_dup(), string_compare(), TR, triggerlist, and TRUE.

Referenced by handle_input().

00762 {
00763     TR *trigger;
00764     trigger = new_trigger();
00765     
00766     if (trigger == NULL)
00767         GiveError("Trigger reported NULL!", TRUE);
00768     
00769     char thisName[1000];
00770     char thisScript[10000];
00771     char thisPriority[4];
00772     char cls[100];
00773     
00774     CL *cls2;
00775     int pri;
00776     
00777     input = script_strip(input, thisName);
00778     input = script_strip(input, thisScript);
00779     input = script_strip(input, thisPriority);
00780     input = script_strip(input, cls);
00781     
00782     if (thisName[0] == '\0') {
00783         GiveError("Improper Trigger format of type: Name", FALSE);
00784         return;
00785     }
00786     if (atoi (thisPriority) > 1000)
00787         pri = 1000;
00788     else if (atoi (thisPriority) < 0)
00789         pri = 0;
00790     else
00791         pri = atoi(thisPriority);
00792         
00793     for (cls2 = classlist; cls2 != NULL; cls2++) {
00794         if (string_compare(cls, cls2->name))
00795             break;
00796     }
00797         
00798     trigger->name = str_dup(thisName);
00799     trigger->script = str_dup(thisScript);
00800     trigger->enabled = TRUE;
00801     trigger->priority = pri;
00802     trigger->next = triggerlist;
00803     // NOTE we should add a GLOBAL class that is the default
00804     // WHEN we do, this NEEDS to be updated. - Alex
00805     // done and done, classlist points to the uberclass item
00806     // only problem is if it never ran the handle_class function.... crap
00807     // mike, you wanna some up with a better solution?
00808     // well I guess it will still work, since the classlist pointer is changed
00809     // in that code, but until it does run a handle_class funtion, this will
00810     // point to NULL, or worse    -Alex
00811     trigger->cl = (cls2 == NULL ? classlist : cls2);
00812     triggerlist = trigger;
00813     
00814     return;
00815 }

Here is the call graph for this function:

void handle_url char *  input  ) 
 

Definition at line 942 of file nanomud-script.c.

Referenced by handle_input().

00943 {
00944     return;
00945 }

void handle_var char *  input  ) 
 

Definition at line 872 of file nanomud-script.c.

References GiveError(), vars::name, new_var(), vars::next, vars::script, script_strip(), str_dup(), TRUE, varlist, and VR.

Referenced by handle_input().

00873 {
00874     VR *pvar;
00875     pvar = new_var();
00876     if (pvar == NULL)
00877         GiveError("Variable failed to initialize.", TRUE);
00878     char name[200];
00879     char value[2048];
00880     char cls[100];
00881     
00882     input = script_strip(input, name);
00883     input = script_strip(input, value);
00884     
00885         
00886     pvar->next = varlist;
00887     pvar->name = str_dup(name);
00888     pvar->script = str_dup(value);
00889     
00890     
00891     varlist = pvar;
00892     
00893     
00894 }

Here is the call graph for this function:

void init_scripts void   ) 
 

Definition at line 82 of file nanomud-script.c.

References cmd_stack, cstack, malloc, new_trigger(), parse_script(), trigger::script, str_dup(), and TR.

Referenced by WinMain().

00083 {
00084     
00085     cmd_stack = (cstack **)malloc(500 * sizeof(*cmd_stack));
00086     TR *tri = new_trigger();
00087     tri->script = str_dup("%if( %eval( %eval( %secs - %1)/1000/60/60\60), \"+hour\", %if( %eval( %eval( %secs - %1)/1000/60\60) < 10, 0)%eval( %eval( %secs - %1)/1000/60\60):%if( %eval( %eval( %secs - %1)/1000\60) < 10, 0)%eval( %eval( %secs - %1)/1000\60))");
00088     parse_script(tri->script);
00089 }

Here is the call graph for this function:

int is_function char *  str  ) 
 

Definition at line 1460 of file nanomud-script.c.

References makeupper(), script_table_command::name, stable, and script_table_command::token.

Referenced by parse_script().

01461 {
01462     int i=0;
01463     
01464     for (i=0;stable[i].name != NULL;i++)
01465         if (!strcmp(makeupper(stable[i].name), makeupper(str)))
01466             return stable[i].token;
01467             
01468     return -1;
01469 }

Here is the call graph for this function:

BOOL is_operator char *  point  ) 
 

Definition at line 1431 of file nanomud-script.c.

References BOOL.

Referenced by check_url(), and count_op().

01432 {
01433     
01434     if (!point)
01435         return FALSE;
01436     if (point[0] == '{' || point[0] == '}' 
01437         || point[0] ==  '+' || point[0] ==  '-'
01438         || point[0] ==  '=' || point[0] ==  '*' 
01439         || point[0] ==  '/' || point[0] ==  '#'
01440         || point[0] ==  '%' || point[0] ==  '@' 
01441         || point[0] ==  '(' || point[0] ==  ')'
01442         || point[0] ==  '\\'|| point[0] ==  '|' 
01443         || point[0] ==  '^' || point[0] ==  '$'
01444         || point[0] ==  '!' || point[0] ==  '<' 
01445         || point[0] ==  '>' || point[0] ==  '?'
01446         || point[0] ==  ':' || point[0] ==  '\''
01447         || point[0] ==  ';' || point[0] ==  ','
01448         || point[0] ==  '~' || point[0] ==  '`' 
01449         || point[0] ==  '\"'|| point[0] ==  '['
01450         || point[0] ==  ']')
01451         {
01452 
01453             return TRUE;
01454         }    
01455     return FALSE;    
01456 
01457     
01458 }

void load_scripts void   ) 
 

Definition at line 1757 of file nanomud-script.c.

References give_term_debug(), give_term_echo(), handle_input(), and read_string().

Referenced by WinMain().

01758 {
01759     FILE *fp;
01760     int ret;
01761     char temp[5000];
01762     char buf[6000];
01763     
01764     
01765     if ((fp = fopen(