#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:

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_grammar (unsigned long int *token) |
| void | check_macro (char *input) |
| BOOL | check_path (char *input) |
| void | check_string (char *pattern, char *str) |
| void | check_trigger (char *input) |
| void | compile_script (char *scr) |
| void | do_math_internal (char *str) |
| BOOL | eval_expression (char *exp) |
| void | free_alias (void) |
| void | free_class (void) |
| void | free_macro (void) |
| void | free_path (void) |
| void | free_scripts (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_math (char *str) |
| BOOL | is_operator (char *point) |
| void | load_scripts (void) |
| void | make_token (char *str) |
| char * | makelower (char *str) |
| char * | makeupper (char *str) |
| AL * | new_alias (void) |
| CL * | new_class (void) |
| MC * | new_macro (void) |
| PA * | new_path (void) |
| TR * | new_trigger (void) |
| VR * | new_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 | strip_paren (char *str) |
| void | strip_space (char *str) |
| unsigned long int | tokenize (char *str) |
| int | unlink (const char *filename) |
Variables | |
| AL * | aliaslist |
| CL * | classlist |
| cstack ** | cmd_stack |
| AL * | freealias |
| CL * | freeclass |
| MC * | freemacro |
| PA * | freepath |
| TR * | freetrigger |
| VR * | freevar |
| func_type | func_table [] |
| MC * | macrolist |
| PA * | pathlist |
| script_table_command | stable [] |
| enum { ... } | state |
| char | str_emp [1] |
| TR * | triggerlist |
| VR * | varlist |
|
|
Definition at line 58 of file nanomud-script.c. 00058 {
00059 SC_NORM,
00060 SC_VAR,
00061 SC_FUN,
00062 SC_NONE
00063 } state;
|
|
|
Definition at line 944 of file nanomud-script.c. References AL, BOOL, alias::name, alias::next, and one_argument(). Referenced by handle_input(). 00945 {
00946 AL *alias;
00947 char command[32000];
00948
00949
00950 input = one_argument(input, command);
00951 alias = aliaslist;
00952 if (alias == NULL)
00953 return FALSE;
00954 for (alias = aliaslist; alias != NULL; alias = alias->next)
00955 {
00956
00957 if (!strcmp(command, alias->name))
00958 {
00959 // MessageBox(MudMain, alias->script,"",MB_OK);
00960 // handle_input (alias->script);
00961 return TRUE;
00962 }
00963
00964
00965 }
00966
00967 return FALSE;
00968 }
|
Here is the call graph for this function:

|
|
Definition at line 1726 of file nanomud-script.c. References LOG(), TOK_CLOSEB, TOK_CLOSEP, TOK_CONST, TOK_OPENB, TOK_OPENP, TOK_OPER, and TOK_STRING. 01727 {
01728 int paren=0; //Parenthesis number.
01729 int brack=0; //Bracket ( {} ) number.
01730
01731 unsigned long int runner=0; //iterater.
01732 unsigned long int tok;
01733
01734 for (runner=0;token[runner]!= TOK_END;runner++)
01735 {
01736 tok = token[runner];
01737
01738 switch (tok)
01739 {
01740 case TOK_OPENP:
01741 paren++;
01742 continue;
01743 break;
01744 case TOK_CLOSEP:
01745 paren--;
01746 continue;
01747 break;
01748 case TOK_STRING:
01749 case TOK_CONST:
01750 continue;
01751 break;
01752 case TOK_OPENB:
01753 brack++;
01754 continue;
01755 break;
01756 case TOK_CLOSEB:
01757 brack--;
01758 continue;
01759 break;
01760 case TOK_OPER:
01761 continue;
01762 break;
01763 }
01764 }
01765 if (paren > 0)
01766 {
01767 LOG("Unmatching parenthesis.");
01768 }
01769 if (paren < 0)
01770 {
01771 LOG("Unmatching parenthesis: Too many closing parenthesis.");
01772 }
01773 if (brack <0)
01774 {
01775 LOG("Unmatching brackets: Too many closing brackets.");
01776 }
01777 if (brack >0)
01778 {
01779 LOG("Unmatching brackets: Too many opening brackets.");
01780 }
01781 return;
01782 }
|
Here is the call graph for this function:

|
|
Definition at line 1013 of file nanomud-script.c. 01014 {
01015 return;
01016 }
|
|
|
Definition at line 992 of file nanomud-script.c. References BOOL, path::name, path::next, one_argument(), and PA. Referenced by handle_input(). 00993 {
00994
00995 PA *path;
00996 char command[500];
00997 input = one_argument(input, command);
00998
00999 path = pathlist;
01000 if (path == NULL)
01001 return FALSE;
01002 for (path=pathlist; path != NULL; path = path->next)
01003 {
01004 if (!strcmp(command, path->name))
01005 {
01006 return TRUE;
01007 continue;
01008 }
01009 }
01010
01011 return FALSE;
01012 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 1406 of file nanomud-script.c. References FALSE, fnmatch(), and GiveError(). 01407 {
01408 // LOG("Analyzing string: %s with pattern of: %s", str, pattern);
01409 if (fnmatch(pattern, str, 0) == 0)
01410 GiveError("Match", FALSE);
01411
01412 }
|
Here is the call graph for this function:

|
|
Definition at line 972 of file nanomud-script.c. References trigger::name, trigger::next, and TR. 00973 {
00974 TR *trigger;
00975 char *point;
00976
00977 trigger = triggerlist;
00978
00979 if (trigger == NULL)
00980 return;
00981 for (; trigger != NULL; trigger = trigger->next) {
00982 point = strstr(input, trigger->name);
00983 if (point != NULL) {
00984 //parse_trigger(trigger);
00985 // parse will do all the real work!
00986 }
00987 }
00988
00989 return;
00990 }
|
|
|
Definition at line 1793 of file nanomud-script.c. References BOOL, eval_expression(), free, is_function_internal(), is_operator(), LOG(), makeupper(), malloc, and strip_space(). Referenced by init_scripts(). 01794 {
01795
01796 unsigned long int *token; // README: Free this damn thing when we're done.
01797 unsigned long int i; // Interator.
01798 char *point;
01799
01800 char *exp;
01801 char buf[2555]="";
01802 char buf2[2555]="";
01803 char *buffer;
01804 char exp_buf[21024]; //expression buffer -- used to validate expressions
01805 buffer = buf2;
01806 BOOL endl=FALSE; // used to various boolean stuff within parse.
01807 int paren;
01808
01809 if (scr == NULL || scr[0] == '\0')
01810 return;
01811
01812 token = (unsigned long int*)malloc(strlen(scr)*3000); // give it lots fo space.
01813 memset(token, 0, sizeof(token));
01814 point = scr;
01815 exp = scr;
01816
01817 i=0;
01818
01819
01820 for (;;point++,exp++)
01821 {
01822 if (!*point)
01823 {
01824 token[i] = TOK_END;
01825 i++;
01826 break;
01827 }
01828
01829 if (*point == ' ')
01830 continue;
01831 if ((*point >= 'a' && *point <= 'z') || (*point >= 'A' && *point <= 'Z')) //a-zA-Z
01832 {
01833 buf[0] = '\0';
01834 for (;*point;point++)
01835 {
01836
01837 *buffer = *point;
01838 if (is_operator(buffer) || *point == ' ')
01839 {
01840 *--point;
01841 break;
01842 }
01843
01844 buffer[1] = '\0';
01845 strcat(buf, buffer);
01846 }
01847 if (is_function_internal(buf))
01848 {
01849
01850 token[i] = TOK_FUNCTION;
01851 if (!strcmp(makeupper(buf), "IF"))
01852 {
01853
01854
01855 *++exp;
01856 *++exp;
01857 paren = 0;
01858 exp_buf[0] = '\0';
01859 for (;*exp;exp++)
01860 {
01861
01862 if (*exp == '(')
01863 paren++;
01864
01865 if (*exp == ')')
01866 paren--;
01867 *buffer = *exp;
01868 buffer[1] = '\0';
01869 strcat(exp_buf, buffer);
01870
01871
01872 if (paren == 0)
01873 {
01874
01875 exp_buf[0] = ' ';
01876 exp_buf[strlen(exp_buf)-1] = ' ';
01877 strip_space(exp_buf);
01878 eval_expression(exp_buf);
01879 free(token);
01880 return;
01881
01882 }
01883 }
01884 LOG("Paren: %d", paren);
01885 }
01886
01887
01888 i++;
01889 buf[0] = '\0';
01890 }
01891 else
01892 {
01893
01894 token[i] = TOK_UNKNOWN;
01895 i++;
01896 buf[0] = '\0';
01897
01898 }
01899 continue;
01900 }
01901 if (*point >= '0' && *point <= '9')
01902 {
01903 token[i] = TOK_CONST;
01904 i++;
01905
01906 for (;*point >= '0' && *point <= '9';point++);
01907 *--point;
01908 continue;
01909 }
01910 if (*point == '\"')
01911 {
01912 *point++;
01913
01914 for (;*point;point++)
01915 {
01916
01917
01918 endl = TRUE;
01919 if (*point == '\"')
01920 {
01921 token[i] = TOK_STRING;
01922 i++;
01923 endl= FALSE;
01924 break;
01925 }
01926
01927 }
01928 if (endl == TRUE)
01929 {
01930 token[i] = TOK_ERROR;
01931 i++;
01932 token[i] = TOK_END;
01933 i++;
01934 endl = FALSE;
01935 }
01936 continue;
01937 }
01938
01939 if (*point == '(')
01940 {
01941 token[i] = TOK_OPENP;
01942 i++;
01943 continue;
01944 }
01945 if (*point == ')')
01946 {
01947 token[i] = TOK_CLOSEP;
01948 i++;
01949 continue;
01950 }
01951 if (*point == '}')
01952 {
01953 token[i] = TOK_CLOSEB;
01954 i++;
01955 continue;
01956 }
01957 if (*point == '{')
01958 {
01959 token[i] = TOK_OPENB;
01960 i++;
01961 continue;
01962 }
01963 *buffer = *point;
01964 buffer[1] = '\0';
01965 buf[0] = '\0';
01966 strcat(buf,buffer);
01967 if (is_operator(buf))
01968 {
01969 token[i] = TOK_OPER;
01970 i++;
01971 continue;
01972 }
01973
01974
01975 }
01976 i=0;
01977 /* LOG("%s\n\n", scr);
01978 for (;;)
01979 {
01980 if (token[i] == TOK_END)
01981 {
01982 LOG("Token END");
01983 break;
01984 }
01985 switch (token[i])
01986 {
01987 case TOK_FUNCTION:
01988 LOG("TOK_FUNCTION");
01989 break;
01990 case TOK_CONST:
01991 LOG("TOK_CONST");
01992 break;
01993 case TOK_OPER:
01994 LOG("TOK_OPER");
01995 break;
01996 case TOK_STRING:
01997 LOG("TOK_STRING");
01998 break;
01999 case TOK_OPENP:
02000 LOG("TOK_OPENP");
02001 break;
02002 case TOK_CLOSEP:
02003 LOG("TOK_CLOSEP");
02004 break;
02005 case TOK_UNKNOWN:
02006 LOG("TOK_UNKNOWN");
02007 break;
02008 case TOK_INVALID:
02009 LOG("TOK_INVALID");
02010 break;
02011 case TOK_ERROR:
02012 LOG("TOK_ERROR");
02013 break;
02014 case TOK_END:
02015 LOG("TOK_END");
02016 break;
02017 case TOK_OPENB:
02018 LOG("TOK_OPENB");
02019 break;
02020 case TOK_CLOSEB:
02021 LOG("TOK_CLOSEB");
02022 break;
02023 }
02024 i++;
02025 }
02026 check_grammar(token);
02027 */ //free(token);
02028 //exit(0);
02029
02030
02031
02032
02033
02034 }
|
Here is the call graph for this function:

|
|
Definition at line 1548 of file nanomud-script.c. References GiveError(), is_math(), isdigit(), strip_paren(), and strip_space(). Referenced by eval_expression(). 01549 {
01550 long int total;
01551 char arg1[100];
01552 char arg2[100];
01553 char *buffer;
01554 char buf[100];
01555 buffer = buf;
01556 char *point;
01557 point = str;
01558 int oper;
01559 arg1[0] = arg2[0] = buf[0] = '\0';
01560 enum { MUL, DIV, ADD, SUB, MODULO};
01561
01562 strip_space(str);
01563 strip_paren(str);
01564
01565 if (!is_math(str))
01566 GiveError("Wow............",1);
01567
01568 for (;*point;point++)
01569 {
01570 if(*point == '+' || *point == '-' || *point == '/' || *point == '*'
01571 || *point == '%')
01572 break;
01573 *buffer = *point;
01574 buffer[1] = '\0';
01575 strcat(arg1, buffer);
01576 }
01577 switch (*point)
01578 {
01579 case '+': oper = ADD; break;
01580 case '-': oper = SUB; break;
01581 case '/': oper = DIV; break;
01582 case '*': oper = MUL; break;
01583 case '%': oper = MODULO; break;
01584 default: return;
01585 }
01586 *++point;
01587 for (;*point;point++)
01588 {
01589 if(*point == '+' || *point == '-' || *point == '/' || *point == '*'
01590 || *point == '%')
01591 break;
01592 *buffer = *point;
01593 buffer[1] = '\0';
01594 strcat(arg2, buffer);
01595 }
01596
01597
01598
01599 switch (oper)
01600 {
01601 case ADD:
01602 if (!isdigit(arg1[0]) || !isdigit(arg2[0]))
01603 {
01604 sprintf(str,"%s%s", arg1,arg2);
01605 return;
01606 }
01607
01608 total = atoi(arg1) + atoi(arg2);
01609 break;
01610 case MUL:
01611 total = atoi(arg1) * atoi (arg2);
01612 break;
01613 }
01614 str[0] = '\0';
01615 sprintf(str, "%ld", total);
01616 }
|
Here is the call graph for this function:

|
|
Definition at line 1624 of file nanomud-script.c. References BOOL, do_math_internal(), get_mid(), interp_function(), is_function_internal(), is_math(), left_token(), LOG(), and right_token(). Referenced by compile_script(). 01625 {
01626 int idx,ldx,fdx;
01627 BOOL quote=FALSE;
01628 char *buffer;
01629 char buf[11024];
01630 char stack[11024];
01631 buffer = buf;
01632 idx = ldx = 0;
01633 char new_string[strlen(exp)*2];
01634 new_string[0] = '\0';
01635 int i,x,y,z;
01636 idx =0;
01637 char function[11000];
01638 char *ret;
01639 static int c=0;
01640
01641 int len = strlen(exp);
01642 stack[0] = '\0';
01643 char *point=exp;
01644
01645 fdx = 0;
01646 for (;*point;point++)
01647 {
01648 if (*point == '(')
01649 fdx++;
01650 if (*point == ')')
01651 fdx--;
01652 }
01653
01654 while (idx < len)
01655 {
01656
01657
01658 if (!quote && exp[idx+1] == ')')
01659 {
01660 ldx = left_token(exp,idx,"(");
01661 if (idx == 0)
01662 {
01663 LOG("Missing open paren");
01664 return 0;
01665 }
01666
01667
01668
01669 get_mid(exp, stack, ldx-1,idx+2 );
01670 if (is_math(stack))
01671 {
01672 do_math_internal(stack);
01673 // x = strlen(stack);
01674 // memcpy(new_string, exp, ldx);
01675 // new_string[ldx] = '\0';
01676 // strcat(new_string, stack);
01677 // strcat(new_string, &exp[idx+2]);
01678 // memcpy (exp, new_string, strlen(new_string)+1);
01679 // len = strlen(exp);
01680
01681 }
01682 ldx = left_token(exp, ldx-2,"(");
01683 memset(function,0,1000);
01684 get_mid(exp,function, ldx,right_token(exp, ldx,"("));
01685 if (is_function_internal(function))
01686 {
01687 ret = interp_function(function, stack,0,0,0);
01688
01689 memcpy(new_string, exp, ldx);
01690 new_string[ldx] = '\0';
01691 x = strlen(new_string);
01692
01693
01694 memcpy(&new_string[x], ret, strlen(ret)+1);
01695 //strcat(new_string, ret);
01696 //strcat(new_string, &exp[idx+2]);
01697
01698
01699 memcpy(&new_string[x + strlen(ret)], &exp[idx+2], strlen(exp) - (idx));
01700 memcpy (exp, new_string, strlen(new_string)+1);
01701
01702
01703
01704 c++;
01705
01706 len = strlen(exp);
01707
01708
01709 }
01710
01711 idx=ldx=0;
01712
01713
01714
01715
01716 }
01717
01718
01719 idx++;
01720
01721 }
01722
01723 return FALSE;
01724 }
|
Here is the call graph for this function:

|
|
Definition at line 652 of file nanomud-script.c. References AL, free, and alias::next. Referenced by free_scripts().
|
|
|
Definition at line 624 of file nanomud-script.c. References CL, free, and classes::next. Referenced by free_scripts().
|
|
|
Definition at line 660 of file nanomud-script.c. References free, MC, and macro::next. Referenced by free_scripts(). 00661 {
00662 MC *mc;
00663
00664 for (mc=macrolist;mc;mc=mc->next)
00665 free(mc);
00666 return;
00667 }
|
|
|
Definition at line 632 of file nanomud-script.c. References free, path::next, and PA. Referenced by free_scripts(). 00633 {
00634 PA *pa;
00635
00636 for (pa=pathlist;pa;pa=pa->next)
00637 free(pa);
00638 return;
00639 }
|
|
|
Definition at line 615 of file nanomud-script.c. References free_alias(), free_class(), free_macro(), free_path(), and free_trigger(). Referenced by WindowProcedure(). 00616 {
00617 free_class();
00618 free_path();
00619 free_trigger();
00620 free_alias();
00621 free_macro();
00622 }
|
Here is the call graph for this function:

|
|
Definition at line 641 of file nanomud-script.c. References free, trigger::next, and TR. Referenced by free_scripts(). 00642 {
00643
00644 TR * tr;
00645 for (tr = triggerlist;tr;tr=tr->next)
00646 free(tr);
00647
00648
00649 return;
00650 }
|
|
|
Definition at line 779 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(). 00780 {
00781 AL *alias;
00782 alias = new_alias();
00783 if (alias == NULL)
00784 GiveError("Alias Failed to initialize", TRUE);
00785 char name[200];
00786 char value[200];
00787 char priority[4];
00788 char cls[100];
00789
00790 CL *cls2;
00791 int pri;
00792
00793 input = script_strip(input, name);
00794 input = script_strip(input, value);
00795 input = script_strip(input, priority);
00796 input = script_strip(input, cls);
00797
00798 if (name[0] == '\0')
00799 {
00800 GiveError("Improper Alias format of type: name", FALSE);
00801 return;
00802 }
00803 if (value[0] == '\0')
00804 {
00805 GiveError("Improper Alias format of type: value", FALSE);
00806 return;
00807 }
00808 if (atoi (priority) > 1000)
00809 pri = 1000;
00810 else if (atoi (priority) < 0)
00811 pri = 0;
00812 else
00813 pri = atoi(priority);
00814
00815 for (cls2 = classlist; cls2 != NULL; cls2++) {
00816 if (string_compare(cls, cls2->name))
00817 break;
00818 }
00819
00820 alias->name = str_dup(name);
00821 alias->enabled = TRUE;
00822 alias->priority = pri;
00823 alias->script = str_dup(value);
00824 alias->next = aliaslist;
00825 alias->cl = (cls2 == NULL ? classlist : cls2);
00826 aliaslist = alias;
00827
00828 return;
00829 }
|
Here is the call graph for this function:

|
|
Definition at line 920 of file nanomud-script.c. Referenced by handle_input(). 00921 {
00922 return;
00923 }
|
|
|
Definition at line 672 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(). 00673 {
00674 if (classlist == NULL) {
00675 // this should only run once!
00676 classlist = new_class();
00677 classlist->enabled = TRUE;
00678 classlist->name = str_dup("main_class");
00679 classlist->priority = 0;
00680 classlist->next = NULL;
00681 }
00682
00683 CL *newClass;
00684 newClass = new_class();
00685
00686 if (newClass == NULL)
00687 GiveError("Null class encountered... that's not good m'kay?", TRUE);
00688
00689 char thisName[100];
00690 char thisPriority[4];
00691
00692 int pri;
00693
00694 input = script_strip(input, thisName);
00695 input = script_strip(input, thisPriority);
00696
00697 if (thisName[0] == '\0') {
00698 // this means it's a default class!
00699 newClass = classlist;
00700 return;
00701 }
00702
00703 else {
00704 if (atoi (thisPriority) > 1000)
00705 pri = 1000;
00706 else if (atoi (thisPriority) < 0)
00707 pri = 0;
00708 else
00709 pri = atoi(thisPriority);
00710
00711 newClass->name = str_dup(thisName);
00712 newClass->enabled = TRUE;
00713 newClass->priority = pri;
00714 newClass->next = classlist->next;
00715 classlist->next = newClass;
00716 }
00717
00718 return;
00719 }
|
Here is the call graph for this function:

|
|
Definition at line 916 of file nanomud-script.c. 00917 {
00918 return;
00919 }
|
|
|
Definition at line 1174 of file nanomud-script.c. References AL, ANSI_YELLOW, termbuf::buffer, check_alias(), check_output(), check_path(), do_repeat(), echo_off, give_term_debug(), 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 do_repeat(), EditProc(), load_scripts(), and load_settings(). 01175 {
01176
01177
01178 unsigned long int runner=0;
01179 typedef struct termbuf SBuf;
01180 unsigned long int ilen=strlen(in);
01181 if (ilen < 10)
01182 ilen = 10;
01183 char command[ilen];
01184
01185 char buff2[10000];
01186 char buffer[10000];
01187 char buff3[10000];
01188 char buff4[10000];
01189 command[0] = '\0';
01190 buff2[0] = '\0';
01191 buff3[0] = '\0';
01192 buff4[0] = '\0';
01193 buffer[0] = '\0';
01194
01195
01196 strcpy(buffer,in);
01197 extern SBuf *send_buff[100];
01198 in = one_argument(in,command);
01199
01200 AL *alias;
01201 PA *path;
01202 char *point = buffer;
01203 char *pbuf;
01204 pbuf = buff3;
01205 if (strprefix("#",&command[0]))
01206 {
01207
01208 if ((strchr(buffer, ';') != NULL) && (strlen(strstr(buffer, ";")) != strlen(buffer)))
01209 {
01210
01211 for (;*point;point++)
01212 {
01213
01214 if (*point == '\0')
01215 break;
01216
01217
01218 if (*point == ';')
01219 {
01220
01221 buff3[0] = '\0';
01222 handle_input(buff4);
01223 buff4[0] = '\0';
01224 continue;
01225 }
01226 *pbuf = *point;
01227 pbuf[1] = '\0';
01228 strcat(buff4,pbuf);
01229
01230
01231 }
01232 if (buff4[0] != '\0')
01233 {
01234 buff3[0] = '\0';
01235 handle_input(buff4);
01236 buff4[0] = '\0';
01237 return;
01238 }
01239 return;
01240
01241 }
01242 else if (buffer[0] == ';' && (strstr(&buffer[1], ";") != NULL))
01243 {
01244 // Let's send the first command on off to the thingie
01245 for (runner=0;*point;point++,runner++)
01246 {
01247 if (*point == ';' && runner != 0)
01248 break;
01249
01250 *pbuf = *point;
01251 pbuf[1] = '\0';
01252 strcat(buff4,pbuf);
01253 }
01254
01255 strcat(buff2, buff4);
01256 strcat(buff2, "\n");
01257 for (runner=0;runner<=100 || send_buff[runner] != NULL;runner++)
01258 {
01259 if (send_buff[runner]->buffer == NULL)
01260 {
01261 send_buff[runner]->buffer = str_dup(buff2);
01262
01263 check_output();
01264 break;
01265 }
01266 }
01267 buff2[0] = '\0';
01268 strcat(buff2, ANSI_YELLOW);
01269 strcat(buff2, buff4);
01270 strcat(buff2, "\e[0m");
01271 strcat(buff2, "\n");
01272 ParseLines(str_dup(buff2));
01273 tbuf->y_end += 13;
01274 tbuf->x_end =0;
01275 pbuf[0] = '\0';
01276 buff4[0] = '\0';
01277 buff2[0] = '\0';
01278 buff3[0] = '\0';
01279 *point++;
01280
01281 for (;*point;*point++)
01282 {
01283 *pbuf = *point;
01284 strcat(buff4, pbuf);
01285 }
01286 handle_input(buff4);
01287 return;
01288 }
01289
01290
01291 if (check_alias(command) == TRUE)
01292 {
01293 for (alias = aliaslist; alias!= NULL;alias = alias->next)
01294 {
01295 if (!strcmp(command, alias->name))
01296 {
01297 strcat(buff3, alias->script);
01298 strcat(buff3, " ");
01299 strcat(buff3, in);
01300 memcpy(buffer, buff3, strlen(buff3));
01301 handle_input(buffer);
01302
01303 return;
01304
01305 }
01306 }
01307 }
01308
01309 if (!strprefix(".", &command[0]))
01310 {
01311
01312 if (check_path(&command[1]) == TRUE)
01313 {
01314 for (path = pathlist; path != NULL; path = path->next)
01315 {
01316 if (!strcmp(&command[1], path->name))
01317 {
01318
01319 buff3[0] = '\0';
01320 buffer[0] = '\0';
01321 // strcat(buff3, path->script);
01322 // strcat(buff3, " ");
01323 // strcat(buff3, in);
01324 memcpy(buffer, buff3, strlen(buff3));//sizeof(buff3));
01325
01326 give_term_debug(path->script);
01327 handle_input(path->script);
01328 return;
01329
01330 }
01331 }
01332 }
01333 }
01334
01335
01336 if (!echo_off && buffer[0] != '\0')
01337 {
01338 strcat(buff2, ANSI_YELLOW);
01339 strcat(buff2, buffer);
01340 strcat(buff2, "\e[0m ");
01341
01342
01343 strcat(buff2, "\n");
01344 strcat(buff2,"\0");
01345
01346 ParseLines(str_dup(buff2));
01347
01348 }
01349
01350 if (strlen(buff2) == 0)
01351 strcat(buff2, "\n");
01352
01353 strcat(buffer, "\n");
01354 for (runner=0;runner<=100 || send_buff[runner] != NULL;runner++)
01355 {
01356 if (send_buff[runner]->buffer == '\0')
01357 {
01358 send_buff[runner]->buffer = str_dup(buffer);
01359 check_output();
01360 break;
01361 }
01362 }
01363 tbuf->y_end +=13;
01364 tbuf->x_end = 0;
01365 buffer[0] = '\0';
01366 return;
01367 }
01368
01369
01370 if (!strprefix(command, "#trigger"))
01371 handle_triggers(in);
01372 else if (!strprefix(command, "#alias"))
01373 handle_aliases(in);
01374 else if (!strprefix(command, "#macro"))
01375 handle_macros(in);
01376 else if (!strprefix(command, "#path"))
01377 handle_path(in);
01378 else if (!strprefix(command, "#url"))
01379 handle_url(in);
01380 else if (!strprefix(command, "#class"))
01381 handle_class(in);
01382 else if (!strprefix(command, "#open"))
01383 handle_open(in);
01384 else if (!strprefix(command, "#log"))
01385 handle_log(in);
01386 else if (!strprefix(command, "#capture"))
01387 handle_capture(in);
01388 else if (!strprefix(command, "#option"))
01389 handle_option(in);
01390 else if (!strprefix(command, "#save"))
01391 handle_save(in);
01392 else if (!strprefix(command, "#var"))
01393 handle_var(in);
01394 else if (!strprefix(command, "#setoption"))
01395 handle_set_options(in);
01396 else if (!strprefix(command, "#repeat"))
01397 do_repeat(in,NULL,NULL,NULL);
01398
01399
01400
01401 SendMessage(MudInput, WM_SETTEXT, 0, (LPARAM)(LPCSTR)"");
01402 return;
01403 }
|
Here is the call graph for this function:

|
|
Definition at line 912 of file nanomud-script.c. Referenced by handle_input(). 00913 {
00914 return;
00915 }
|
|
|
Definition at line 830 of file nanomud-script.c. Referenced by handle_input(). 00831 {
00832 return;
00833 }
|
|
|
Definition at line 908 of file nanomud-script.c. Referenced by handle_input(). 00909 {
00910 return;
00911 }
|
|
|
Definition at line 928 of file nanomud-script.c. Referenced by handle_input(). 00929 {
00930 return;
00931 }
|
|
|
Definition at line 858 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(). 00859 {
00860 PA *path;
00861 path = new_path();
00862 if (path == NULL)
00863 GiveError("Path failed to initialize", TRUE);
00864 char name[200];
00865 char whereto[200];
00866 char priority[4];
00867 char cls[100];
00868
00869 CL *cls2;
00870 int pri;
00871
00872 input = script_strip(input, name);
00873 input = script_strip(input, whereto);
00874 input = script_strip(input, priority);
00875 input = script_strip(input, cls);
00876
00877 if (name[0] == '\0')
00878 {
00879 GiveError("Improper Path format of type: name", FALSE);
00880 return;
00881 }
00882
00883 if (atoi (priority) > 1000)
00884 pri = 1000;
00885 else if (atoi (priority) < 0)
00886 pri = 0;
00887 else
00888 pri = atoi(priority);
00889
00890 for (cls2 = classlist; cls2 != NULL; cls2++) {
00891 if (string_compare(cls, cls2->name))
00892 break;
00893 }
00894
00895 path->name = str_dup(name);
00896 path->enabled = TRUE;
00897 path->priority = pri;
00898 path->script = str_dup(whereto);
00899 path->next = pathlist;
00900 path->cl = (cls2 == NULL ? classlist : cls2);
00901 pathlist = path;
00902 return;
00903 }
|
Here is the call graph for this function:

|
|
Definition at line 932 of file nanomud-script.c. Referenced by handle_input(). 00933 {
00934
00935 return;
00936 }
|
|
|
Definition at line 924 of file nanomud-script.c. 00925 {
00926 return;
00927 }
|
|