00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #define _COMMLINE_SOURCE_
00033
00034 #include <stdio.h>
00035 #define _STDIO_INCLUDED_
00036 #include <string.h>
00037 #include <ctype.h>
00038
00039 #include "setup.h"
00040 #include "constant.h"
00041
00042 #include "argacces.h"
00043 #include "constrct.h"
00044 #include "cstrcpsr.h"
00045 #include "envrnmnt.h"
00046 #include "exprnpsr.h"
00047 #include "filecom.h"
00048 #include "memalloc.h"
00049 #include "prcdrfun.h"
00050 #include "prcdrpsr.h"
00051 #include "router.h"
00052 #include "scanner.h"
00053 #include "strngrtr.h"
00054 #include "symbol.h"
00055 #include "sysdep.h"
00056 #include "utility.h"
00057
00058 #include "commline.h"
00059
00060
00061
00062
00063
00064 #if ! RUN_TIME
00065 static int DoString(char *,int,int *);
00066 static int DoComment(char *,int);
00067 static int DoWhiteSpace(char *,int);
00068 static int DefaultGetNextEvent(void *);
00069 #endif
00070 static void DeallocateCommandLineData(void *);
00071
00072
00073
00074
00075
00076 globle void InitializeCommandLineData(
00077 void *theEnv)
00078 {
00079 AllocateEnvironmentData(theEnv,COMMANDLINE_DATA,sizeof(struct commandLineData),DeallocateCommandLineData);
00080
00081 #if ! RUN_TIME
00082 CommandLineData(theEnv)->BannerString = BANNER_STRING;
00083 CommandLineData(theEnv)->EventFunction = DefaultGetNextEvent;
00084 #endif
00085 }
00086
00087
00088
00089
00090
00091 static void DeallocateCommandLineData(
00092 void *theEnv)
00093 {
00094 #if ! RUN_TIME
00095 if (CommandLineData(theEnv)->CommandString != NULL)
00096 { rm(theEnv,CommandLineData(theEnv)->CommandString,CommandLineData(theEnv)->MaximumCharacters); }
00097
00098 if (CommandLineData(theEnv)->CurrentCommand != NULL)
00099 { ReturnExpression(theEnv,CommandLineData(theEnv)->CurrentCommand); }
00100 #else
00101 #if MAC_MCW || WIN_MCW || MAC_XCD
00102 #pragma unused(theEnv)
00103 #endif
00104 #endif
00105 }
00106
00107 #if ! RUN_TIME
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117 globle int ExpandCommandString(
00118 void *theEnv,
00119 int inchar)
00120 {
00121 size_t k;
00122
00123 k = RouterData(theEnv)->CommandBufferInputCount;
00124 CommandLineData(theEnv)->CommandString = ExpandStringWithChar(theEnv,inchar,CommandLineData(theEnv)->CommandString,&RouterData(theEnv)->CommandBufferInputCount,
00125 &CommandLineData(theEnv)->MaximumCharacters,CommandLineData(theEnv)->MaximumCharacters+80);
00126 return((RouterData(theEnv)->CommandBufferInputCount != k) ? TRUE : FALSE);
00127 }
00128
00129
00130
00131
00132 globle void FlushCommandString(
00133 void *theEnv)
00134 {
00135 if (CommandLineData(theEnv)->CommandString != NULL) rm(theEnv,CommandLineData(theEnv)->CommandString,CommandLineData(theEnv)->MaximumCharacters);
00136 CommandLineData(theEnv)->CommandString = NULL;
00137 CommandLineData(theEnv)->MaximumCharacters = 0;
00138 RouterData(theEnv)->CommandBufferInputCount = 0;
00139 RouterData(theEnv)->AwaitingInput = TRUE;
00140 }
00141
00142
00143
00144
00145 globle void SetCommandString(
00146 void *theEnv,
00147 char *str)
00148 {
00149 size_t length;
00150
00151 FlushCommandString(theEnv);
00152 length = strlen(str);
00153 CommandLineData(theEnv)->CommandString = (char *)
00154 genrealloc(theEnv,CommandLineData(theEnv)->CommandString,(unsigned) CommandLineData(theEnv)->MaximumCharacters,
00155 (unsigned) CommandLineData(theEnv)->MaximumCharacters + length + 1);
00156
00157 genstrcpy(CommandLineData(theEnv)->CommandString,str);
00158 CommandLineData(theEnv)->MaximumCharacters += (length + 1);
00159 RouterData(theEnv)->CommandBufferInputCount += (int) length;
00160 }
00161
00162
00163
00164
00165
00166 globle void SetNCommandString(
00167 void *theEnv,
00168 char *str,
00169 unsigned length)
00170 {
00171 FlushCommandString(theEnv);
00172 CommandLineData(theEnv)->CommandString = (char *)
00173 genrealloc(theEnv,CommandLineData(theEnv)->CommandString,(unsigned) CommandLineData(theEnv)->MaximumCharacters,
00174 (unsigned) CommandLineData(theEnv)->MaximumCharacters + length + 1);
00175
00176 genstrncpy(CommandLineData(theEnv)->CommandString,str,length);
00177 CommandLineData(theEnv)->CommandString[CommandLineData(theEnv)->MaximumCharacters + length] = 0;
00178 CommandLineData(theEnv)->MaximumCharacters += (length + 1);
00179 RouterData(theEnv)->CommandBufferInputCount += (int) length;
00180 }
00181
00182
00183
00184
00185 globle void AppendCommandString(
00186 void *theEnv,
00187 char *str)
00188 {
00189 CommandLineData(theEnv)->CommandString = AppendToString(theEnv,str,CommandLineData(theEnv)->CommandString,&RouterData(theEnv)->CommandBufferInputCount,&CommandLineData(theEnv)->MaximumCharacters);
00190 }
00191
00192
00193
00194
00195 globle void InsertCommandString(
00196 void *theEnv,
00197 char *str,
00198 unsigned int position)
00199 {
00200 CommandLineData(theEnv)->CommandString =
00201 InsertInString(theEnv,str,position,CommandLineData(theEnv)->CommandString,
00202 &RouterData(theEnv)->CommandBufferInputCount,&CommandLineData(theEnv)->MaximumCharacters);
00203 }
00204
00205
00206
00207
00208
00209 globle void AppendNCommandString(
00210 void *theEnv,
00211 char *str,
00212 unsigned length)
00213 {
00214 CommandLineData(theEnv)->CommandString = AppendNToString(theEnv,str,CommandLineData(theEnv)->CommandString,length,&RouterData(theEnv)->CommandBufferInputCount,&CommandLineData(theEnv)->MaximumCharacters);
00215 }
00216
00217
00218
00219
00220 globle char *GetCommandString(
00221 void *theEnv)
00222 {
00223 return(CommandLineData(theEnv)->CommandString);
00224 }
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236 globle int CompleteCommand(
00237 char *mstring)
00238 {
00239 int i;
00240 char inchar;
00241 int depth = 0;
00242 int moreThanZero = 0;
00243 int complete;
00244 int error = 0;
00245
00246 if (mstring == NULL) return(0);
00247
00248
00249
00250
00251
00252
00253 i = 0;
00254 while ((inchar = mstring[i++]) != EOS)
00255 {
00256 switch(inchar)
00257 {
00258
00259
00260
00261
00262
00263
00264
00265
00266 case '\n' :
00267 case '\r' :
00268 if (error) return(-1);
00269 if (moreThanZero && (depth == 0)) return(1);
00270 i = DoWhiteSpace(mstring,i);
00271 break;
00272
00273
00274
00275
00276
00277 case ' ' :
00278 case '\f' :
00279 case '\t' :
00280 i = DoWhiteSpace(mstring,i);
00281 break;
00282
00283
00284
00285
00286
00287
00288
00289
00290 case '"' :
00291 i = DoString(mstring,i,&complete);
00292 if ((depth == 0) && complete) moreThanZero = TRUE;
00293 break;
00294
00295
00296
00297
00298
00299 case ';' :
00300 i = DoComment(mstring,i);
00301 if (moreThanZero && (depth == 0) && (mstring[i] != EOS))
00302 {
00303 if (error) return(-1);
00304 else return(1);
00305 }
00306 else if (mstring[i] != EOS) i++;
00307 break;
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320 case '(' :
00321 if ((depth > 0) || (moreThanZero == FALSE))
00322 {
00323 depth++;
00324 moreThanZero = TRUE;
00325 }
00326 break;
00327
00328
00329
00330
00331
00332
00333
00334
00335 case ')' :
00336 if (depth > 0) depth--;
00337 else if (moreThanZero == FALSE) error = TRUE;
00338 break;
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348 default:
00349 if (depth == 0)
00350 {
00351 if (isprint(inchar) || IsUTF8MultiByteStart(inchar))
00352 {
00353 while ((inchar = mstring[i++]) != EOS)
00354 {
00355 if ((inchar == '\n') || (inchar == '\r'))
00356 {
00357 if (error) return(-1);
00358 else return(1);
00359 }
00360 }
00361 return(0);
00362 }
00363 }
00364 break;
00365 }
00366 }
00367
00368
00369
00370
00371
00372 return(0);
00373 }
00374
00375
00376
00377
00378
00379 static int DoString(
00380 char *str,
00381 int pos,
00382 int *complete)
00383 {
00384 int inchar;
00385
00386
00387
00388
00389
00390
00391 inchar = str[pos];
00392 while (inchar != '"')
00393 {
00394
00395
00396
00397
00398
00399 if (inchar == '\\')
00400 {
00401 pos++;
00402 inchar = str[pos];
00403 }
00404
00405
00406
00407
00408
00409
00410
00411
00412 if (inchar == EOS)
00413 {
00414 *complete = FALSE;
00415 return(pos);
00416 }
00417
00418
00419
00420
00421
00422 pos++;
00423 inchar = str[pos];
00424 }
00425
00426
00427
00428
00429
00430
00431 pos++;
00432 *complete = TRUE;
00433 return(pos);
00434 }
00435
00436
00437
00438
00439
00440 static int DoComment(
00441 char *str,
00442 int pos)
00443 {
00444 int inchar;
00445
00446 inchar = str[pos];
00447 while ((inchar != '\n') && (inchar != '\r'))
00448 {
00449 if (inchar == EOS)
00450 { return(pos); }
00451
00452 pos++;
00453 inchar = str[pos];
00454 }
00455
00456 return(pos);
00457 }
00458
00459
00460
00461
00462
00463 static int DoWhiteSpace(
00464 char *str,
00465 int pos)
00466 {
00467 int inchar;
00468
00469 inchar = str[pos];
00470 while ((inchar == ' ') || (inchar == '\f') || (inchar == '\t'))
00471 {
00472 pos++;
00473 inchar = str[pos];
00474 }
00475
00476 return(pos);
00477 }
00478
00479
00480
00481
00482
00483
00484 globle void CommandLoop(
00485 void *theEnv)
00486 {
00487 int inchar;
00488
00489 EnvPrintRouter(theEnv,WPROMPT,CommandLineData(theEnv)->BannerString);
00490 SetHaltExecution(theEnv,FALSE);
00491 SetEvaluationError(theEnv,FALSE);
00492 PeriodicCleanup(theEnv,TRUE,FALSE);
00493 PrintPrompt(theEnv);
00494 RouterData(theEnv)->CommandBufferInputCount = 0;
00495 RouterData(theEnv)->AwaitingInput = TRUE;
00496
00497 while (TRUE)
00498 {
00499
00500
00501
00502
00503
00504
00505 if (BatchActive(theEnv) == TRUE)
00506 {
00507 inchar = LLGetcBatch(theEnv,"stdin",TRUE);
00508 if (inchar == EOF)
00509 { (*CommandLineData(theEnv)->EventFunction)(theEnv); }
00510 else
00511 { ExpandCommandString(theEnv,(char) inchar); }
00512 }
00513 else
00514 { (*CommandLineData(theEnv)->EventFunction)(theEnv); }
00515
00516
00517
00518
00519
00520
00521 if (GetHaltExecution(theEnv) == TRUE)
00522 {
00523 SetHaltExecution(theEnv,FALSE);
00524 SetEvaluationError(theEnv,FALSE);
00525 FlushCommandString(theEnv);
00526 #if ! WINDOW_INTERFACE
00527 fflush(stdin);
00528 #endif
00529 EnvPrintRouter(theEnv,WPROMPT,"\n");
00530 PrintPrompt(theEnv);
00531 }
00532
00533
00534
00535
00536
00537
00538 ExecuteIfCommandComplete(theEnv);
00539 }
00540 }
00541
00542
00543
00544
00545
00546
00547 globle void CommandLoopBatch(
00548 void *theEnv)
00549 {
00550 SetHaltExecution(theEnv,FALSE);
00551 SetEvaluationError(theEnv,FALSE);
00552 PeriodicCleanup(theEnv,TRUE,FALSE);
00553 PrintPrompt(theEnv);
00554 RouterData(theEnv)->CommandBufferInputCount = 0;
00555 RouterData(theEnv)->AwaitingInput = TRUE;
00556
00557 CommandLoopBatchDriver(theEnv);
00558 }
00559
00560
00561
00562
00563
00564
00565 globle void CommandLoopOnceThenBatch(
00566 void *theEnv)
00567 {
00568 if (! ExecuteIfCommandComplete(theEnv)) return;
00569
00570 CommandLoopBatchDriver(theEnv);
00571 }
00572
00573
00574
00575
00576
00577
00578 globle void CommandLoopBatchDriver(
00579 void *theEnv)
00580 {
00581 int inchar;
00582
00583 while (TRUE)
00584 {
00585 if (GetHaltCommandLoopBatch(theEnv) == TRUE)
00586 {
00587 CloseAllBatchSources(theEnv);
00588 SetHaltCommandLoopBatch(theEnv,FALSE);
00589 }
00590
00591
00592
00593
00594
00595
00596
00597 if (BatchActive(theEnv) == TRUE)
00598 {
00599 inchar = LLGetcBatch(theEnv,"stdin",TRUE);
00600 if (inchar == EOF)
00601 { return; }
00602 else
00603 { ExpandCommandString(theEnv,(char) inchar); }
00604 }
00605 else
00606 { return; }
00607
00608
00609
00610
00611
00612
00613 if (GetHaltExecution(theEnv) == TRUE)
00614 {
00615 SetHaltExecution(theEnv,FALSE);
00616 SetEvaluationError(theEnv,FALSE);
00617 FlushCommandString(theEnv);
00618 #if ! WINDOW_INTERFACE
00619 fflush(stdin);
00620 #endif
00621 EnvPrintRouter(theEnv,WPROMPT,"\n");
00622 PrintPrompt(theEnv);
00623 }
00624
00625
00626
00627
00628
00629
00630 ExecuteIfCommandComplete(theEnv);
00631 }
00632 }
00633
00634
00635
00636
00637
00638 globle intBool ExecuteIfCommandComplete(
00639 void *theEnv)
00640 {
00641 if ((CompleteCommand(CommandLineData(theEnv)->CommandString) == 0) ||
00642 (RouterData(theEnv)->CommandBufferInputCount == 0) ||
00643 (RouterData(theEnv)->AwaitingInput == FALSE))
00644 { return FALSE; }
00645
00646 if (CommandLineData(theEnv)->BeforeCommandExecutionFunction != NULL)
00647 {
00648 if (! (*CommandLineData(theEnv)->BeforeCommandExecutionFunction)(theEnv))
00649 { return FALSE; }
00650 }
00651
00652 FlushPPBuffer(theEnv);
00653 SetPPBufferStatus(theEnv,OFF);
00654 RouterData(theEnv)->CommandBufferInputCount = 0;
00655 RouterData(theEnv)->AwaitingInput = FALSE;
00656 RouteCommand(theEnv,CommandLineData(theEnv)->CommandString,TRUE);
00657 FlushPPBuffer(theEnv);
00658 SetHaltExecution(theEnv,FALSE);
00659 SetEvaluationError(theEnv,FALSE);
00660 FlushCommandString(theEnv);
00661 PeriodicCleanup(theEnv,TRUE,FALSE);
00662 PrintPrompt(theEnv);
00663
00664 return TRUE;
00665 }
00666
00667
00668
00669
00670 globle intBool CommandCompleteAndNotEmpty(
00671 void *theEnv)
00672 {
00673 if ((CompleteCommand(CommandLineData(theEnv)->CommandString) == 0) ||
00674 (RouterData(theEnv)->CommandBufferInputCount == 0) ||
00675 (RouterData(theEnv)->AwaitingInput == FALSE))
00676 { return FALSE; }
00677
00678 return TRUE;
00679 }
00680
00681
00682
00683
00684 globle void PrintPrompt(
00685 void *theEnv)
00686 {
00687 EnvPrintRouter(theEnv,WPROMPT,COMMAND_PROMPT);
00688
00689 if (CommandLineData(theEnv)->AfterPromptFunction != NULL)
00690 { (*CommandLineData(theEnv)->AfterPromptFunction)(theEnv); }
00691 }
00692
00693
00694
00695
00696 globle void PrintBanner(
00697 void *theEnv)
00698 {
00699 EnvPrintRouter(theEnv,WPROMPT,CommandLineData(theEnv)->BannerString);
00700 }
00701
00702
00703
00704
00705
00706 globle void SetAfterPromptFunction(
00707 void *theEnv,
00708 int (*funptr)(void *))
00709 {
00710 CommandLineData(theEnv)->AfterPromptFunction = funptr;
00711 }
00712
00713
00714
00715
00716
00717 globle void SetBeforeCommandExecutionFunction(
00718 void *theEnv,
00719 int (*funptr)(void *))
00720 {
00721 CommandLineData(theEnv)->BeforeCommandExecutionFunction = funptr;
00722 }
00723
00724
00725
00726
00727 globle intBool RouteCommand(
00728 void *theEnv,
00729 char *command,
00730 int printResult)
00731 {
00732 DATA_OBJECT result;
00733 struct expr *top;
00734 char *commandName;
00735 struct token theToken;
00736
00737 if (command == NULL)
00738 { return(0); }
00739
00740
00741
00742
00743
00744
00745 OpenStringSource(theEnv,"command",command,0);
00746
00747 GetToken(theEnv,"command",&theToken);
00748
00749
00750
00751
00752
00753 if ((theToken.type == SYMBOL) || (theToken.type == STRING) ||
00754 (theToken.type == FLOAT) || (theToken.type == INTEGER) ||
00755 (theToken.type == INSTANCE_NAME))
00756 {
00757 CloseStringSource(theEnv,"command");
00758 if (printResult)
00759 {
00760 PrintAtom(theEnv,"stdout",theToken.type,theToken.value);
00761 EnvPrintRouter(theEnv,"stdout","\n");
00762 }
00763 return(1);
00764 }
00765
00766
00767
00768
00769
00770 if ((theToken.type == GBL_VARIABLE) ||
00771 (theToken.type == SF_VARIABLE) ||
00772 (theToken.type == MF_VARIABLE))
00773 {
00774 CloseStringSource(theEnv,"command");
00775 top = GenConstant(theEnv,theToken.type,theToken.value);
00776 EvaluateExpression(theEnv,top,&result);
00777 rtn_struct(theEnv,expr,top);
00778 if (printResult)
00779 {
00780 PrintDataObject(theEnv,"stdout",&result);
00781 EnvPrintRouter(theEnv,"stdout","\n");
00782 }
00783 return(1);
00784 }
00785
00786
00787
00788
00789
00790
00791
00792 if (theToken.type != LPAREN)
00793 {
00794 PrintErrorID(theEnv,"COMMLINE",1,FALSE);
00795 EnvPrintRouter(theEnv,WERROR,"Expected a '(', constant, or variable\n");
00796 CloseStringSource(theEnv,"command");
00797 return(0);
00798 }
00799
00800
00801
00802
00803
00804 GetToken(theEnv,"command",&theToken);
00805 if (theToken.type != SYMBOL)
00806 {
00807 PrintErrorID(theEnv,"COMMLINE",2,FALSE);
00808 EnvPrintRouter(theEnv,WERROR,"Expected a command.\n");
00809 CloseStringSource(theEnv,"command");
00810 return(0);
00811 }
00812
00813 commandName = ValueToString(theToken.value);
00814
00815
00816
00817
00818
00819 #if (! RUN_TIME) && (! BLOAD_ONLY)
00820 {
00821 int errorFlag;
00822
00823 errorFlag = ParseConstruct(theEnv,commandName,"command");
00824 if (errorFlag != -1)
00825 {
00826 CloseStringSource(theEnv,"command");
00827 if (errorFlag == 1)
00828 {
00829 EnvPrintRouter(theEnv,WERROR,"\nERROR:\n");
00830 PrintInChunks(theEnv,WERROR,GetPPBuffer(theEnv));
00831 EnvPrintRouter(theEnv,WERROR,"\n");
00832 }
00833 DestroyPPBuffer(theEnv);
00834 return(errorFlag);
00835 }
00836 }
00837 #endif
00838
00839
00840
00841
00842
00843 CommandLineData(theEnv)->ParsingTopLevelCommand = TRUE;
00844 top = Function2Parse(theEnv,"command",commandName);
00845 CommandLineData(theEnv)->ParsingTopLevelCommand = FALSE;
00846 ClearParsedBindNames(theEnv);
00847
00848
00849
00850
00851
00852 CloseStringSource(theEnv,"command");
00853
00854
00855
00856
00857
00858 if (top == NULL) return(0);
00859
00860 ExpressionInstall(theEnv,top);
00861
00862 CommandLineData(theEnv)->EvaluatingTopLevelCommand = TRUE;
00863 CommandLineData(theEnv)->CurrentCommand = top;
00864 EvaluateExpression(theEnv,top,&result);
00865 CommandLineData(theEnv)->CurrentCommand = NULL;
00866 CommandLineData(theEnv)->EvaluatingTopLevelCommand = FALSE;
00867
00868 ExpressionDeinstall(theEnv,top);
00869 ReturnExpression(theEnv,top);
00870
00871 if ((result.type != RVOID) && printResult)
00872 {
00873 PrintDataObject(theEnv,"stdout",&result);
00874 EnvPrintRouter(theEnv,"stdout","\n");
00875 }
00876
00877 return(1);
00878 }
00879
00880
00881
00882
00883
00884
00885
00886 static int DefaultGetNextEvent(
00887 void *theEnv)
00888 {
00889 int inchar;
00890
00891 inchar = EnvGetcRouter(theEnv,"stdin");
00892
00893 if (inchar == EOF) inchar = '\n';
00894
00895 ExpandCommandString(theEnv,(char) inchar);
00896
00897 return 0;
00898 }
00899
00900
00901
00902
00903
00904 globle int (*SetEventFunction(void *theEnv,int (*theFunction)(void *)))(void *)
00905 {
00906 int (*tmp_ptr)(void *);
00907
00908 tmp_ptr = CommandLineData(theEnv)->EventFunction;
00909 CommandLineData(theEnv)->EventFunction = theFunction;
00910 return(tmp_ptr);
00911 }
00912
00913
00914
00915
00916
00917 globle intBool TopLevelCommand(
00918 void *theEnv)
00919 {
00920 return(CommandLineData(theEnv)->ParsingTopLevelCommand);
00921 }
00922
00923
00924
00925
00926
00927 globle char *GetCommandCompletionString(
00928 void *theEnv,
00929 char *theString,
00930 size_t maxPosition)
00931 {
00932 struct token lastToken;
00933 struct token theToken;
00934 char lastChar;
00935 char *rs;
00936 size_t length;
00937
00938
00939
00940
00941
00942 if (theString == NULL) return("");
00943
00944
00945
00946
00947
00948
00949 lastChar = theString[maxPosition - 1];
00950 if ((lastChar == ' ') || (lastChar == '"') ||
00951 (lastChar == '\t') || (lastChar == '\f') ||
00952 (lastChar == '\n') || (lastChar == '\r'))
00953 { return(""); }
00954
00955
00956
00957
00958
00959 OpenTextSource(theEnv,"CommandCompletion",theString,0,maxPosition);
00960 ScannerData(theEnv)->IgnoreCompletionErrors = TRUE;
00961 GetToken(theEnv,"CommandCompletion",&theToken);
00962 CopyToken(&lastToken,&theToken);
00963 while (theToken.type != STOP)
00964 {
00965 CopyToken(&lastToken,&theToken);
00966 GetToken(theEnv,"CommandCompletion",&theToken);
00967 }
00968 CloseStringSource(theEnv,"CommandCompletion");
00969 ScannerData(theEnv)->IgnoreCompletionErrors = FALSE;
00970
00971
00972
00973
00974
00975 if (lastToken.type == SYMBOL)
00976 {
00977 rs = ValueToString(lastToken.value);
00978 if (rs[0] == '[') return (&rs[1]);
00979 return(ValueToString(lastToken.value));
00980 }
00981 else if (lastToken.type == SF_VARIABLE)
00982 { return(ValueToString(lastToken.value)); }
00983 else if (lastToken.type == MF_VARIABLE)
00984 { return(ValueToString(lastToken.value)); }
00985 else if ((lastToken.type == GBL_VARIABLE) || (lastToken.type == MF_GBL_VARIABLE) ||
00986 (lastToken.type == INSTANCE_NAME))
00987 { return(NULL); }
00988 else if (lastToken.type == STRING)
00989 {
00990 length = strlen(ValueToString(lastToken.value));
00991 return(GetCommandCompletionString(theEnv,ValueToString(lastToken.value),length));
00992 }
00993 else if ((lastToken.type == FLOAT) || (lastToken.type == INTEGER))
00994 { return(NULL); }
00995
00996 return("");
00997 }
00998
00999
01000
01001
01002 globle void SetHaltCommandLoopBatch(
01003 void *theEnv,
01004 int value)
01005 {
01006 CommandLineData(theEnv)->HaltCommandLoopBatch = value;
01007 }
01008
01009
01010
01011
01012 globle int GetHaltCommandLoopBatch(
01013 void *theEnv)
01014 {
01015 return(CommandLineData(theEnv)->HaltCommandLoopBatch);
01016 }
01017
01018 #endif
01019