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
00033
00034
00035
00036
00037
00038
00039
00040 #include "setup.h"
00041
00042 #if DEFFUNCTION_CONSTRUCT
00043
00044 #if (BLOAD || BLOAD_ONLY || BLOAD_AND_BSAVE)
00045 #include "bload.h"
00046 #include "dffnxbin.h"
00047 #endif
00048
00049 #if CONSTRUCT_COMPILER && (! RUN_TIME)
00050 #include "dffnxcmp.h"
00051 #endif
00052
00053 #if (! BLOAD_ONLY) && (! RUN_TIME)
00054 #include "constrct.h"
00055 #include "cstrcpsr.h"
00056 #include "dffnxpsr.h"
00057 #include "modulpsr.h"
00058 #endif
00059
00060 #include "envrnmnt.h"
00061
00062 #if (! RUN_TIME)
00063 #include "extnfunc.h"
00064 #endif
00065
00066 #include "dffnxexe.h"
00067
00068 #if DEBUGGING_FUNCTIONS
00069 #include "watch.h"
00070 #endif
00071
00072 #include "argacces.h"
00073 #include "memalloc.h"
00074 #include "cstrccom.h"
00075 #include "router.h"
00076
00077 #define _DFFNXFUN_SOURCE_
00078 #include "dffnxfun.h"
00079
00080
00081
00082
00083
00084
00085
00086 static void PrintDeffunctionCall(void *,char *,void *);
00087 static intBool EvaluateDeffunctionCall(void *,void *,DATA_OBJECT *);
00088 static void DecrementDeffunctionBusyCount(void *,void *);
00089 static void IncrementDeffunctionBusyCount(void *,void *);
00090 static void DeallocateDeffunctionData(void *);
00091
00092 #if ! RUN_TIME
00093 static void DestroyDeffunctionAction(void *,struct constructHeader *,void *);
00094 static void *AllocateModule(void *);
00095 static void ReturnModule(void *,void *);
00096 static intBool ClearDeffunctionsReady(void *);
00097 #endif
00098
00099 #if (! BLOAD_ONLY) && (! RUN_TIME)
00100 static intBool RemoveAllDeffunctions(void *);
00101 static void DeffunctionDeleteError(void *,char *);
00102 static void SaveDeffunctionHeaders(void *,void *,char *);
00103 static void SaveDeffunctionHeader(void *,struct constructHeader *,void *);
00104 static void SaveDeffunctions(void *,void *,char *);
00105 #endif
00106
00107 #if DEBUGGING_FUNCTIONS
00108 static unsigned DeffunctionWatchAccess(void *,int,unsigned,EXPRESSION *);
00109 static unsigned DeffunctionWatchPrint(void *,char *,int,EXPRESSION *);
00110 #endif
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 globle void SetupDeffunctions(
00128 void *theEnv)
00129 {
00130 ENTITY_RECORD deffunctionEntityRecord =
00131 { "PCALL", PCALL,0,0,1,
00132 PrintDeffunctionCall,PrintDeffunctionCall,
00133 NULL,EvaluateDeffunctionCall,NULL,
00134 DecrementDeffunctionBusyCount,IncrementDeffunctionBusyCount,
00135 NULL,NULL,NULL,NULL,NULL };
00136
00137 AllocateEnvironmentData(theEnv,DEFFUNCTION_DATA,sizeof(struct deffunctionData),DeallocateDeffunctionData);
00138 memcpy(&DeffunctionData(theEnv)->DeffunctionEntityRecord,&deffunctionEntityRecord,sizeof(struct entityRecord));
00139
00140 InstallPrimitive(theEnv,&DeffunctionData(theEnv)->DeffunctionEntityRecord,PCALL);
00141
00142 DeffunctionData(theEnv)->DeffunctionModuleIndex =
00143 RegisterModuleItem(theEnv,"deffunction",
00144 #if (! RUN_TIME)
00145 AllocateModule,ReturnModule,
00146 #else
00147 NULL,NULL,
00148 #endif
00149 #if BLOAD_AND_BSAVE || BLOAD || BLOAD_ONLY
00150 BloadDeffunctionModuleReference,
00151 #else
00152 NULL,
00153 #endif
00154 #if CONSTRUCT_COMPILER && (! RUN_TIME)
00155 DeffunctionCModuleReference,
00156 #else
00157 NULL,
00158 #endif
00159 EnvFindDeffunction);
00160
00161 DeffunctionData(theEnv)->DeffunctionConstruct = AddConstruct(theEnv,"deffunction","deffunctions",
00162 #if (! BLOAD_ONLY) && (! RUN_TIME)
00163 ParseDeffunction,
00164 #else
00165 NULL,
00166 #endif
00167 EnvFindDeffunction,
00168 GetConstructNamePointer,GetConstructPPForm,
00169 GetConstructModuleItem,EnvGetNextDeffunction,
00170 SetNextConstruct,EnvIsDeffunctionDeletable,
00171 EnvUndeffunction,
00172 #if (! BLOAD_ONLY) && (! RUN_TIME)
00173 RemoveDeffunction
00174 #else
00175 NULL
00176 #endif
00177 );
00178 #if ! RUN_TIME
00179 AddClearReadyFunction(theEnv,"deffunction",ClearDeffunctionsReady,0);
00180
00181 #if ! BLOAD_ONLY
00182 #if DEFMODULE_CONSTRUCT
00183 AddPortConstructItem(theEnv,"deffunction",SYMBOL);
00184 #endif
00185 AddSaveFunction(theEnv,"deffunction-headers",SaveDeffunctionHeaders,1000);
00186 AddSaveFunction(theEnv,"deffunctions",SaveDeffunctions,0);
00187 EnvDefineFunction2(theEnv,"undeffunction",'v',PTIEF UndeffunctionCommand,"UndeffunctionCommand","11w");
00188 #endif
00189
00190 #if DEBUGGING_FUNCTIONS
00191 EnvDefineFunction2(theEnv,"list-deffunctions",'v',PTIEF ListDeffunctionsCommand,"ListDeffunctionsCommand","01");
00192 EnvDefineFunction2(theEnv,"ppdeffunction",'v',PTIEF PPDeffunctionCommand,"PPDeffunctionCommand","11w");
00193 #endif
00194
00195 EnvDefineFunction2(theEnv,"get-deffunction-list",'m',PTIEF GetDeffunctionListFunction,
00196 "GetDeffunctionListFunction","01");
00197
00198 EnvDefineFunction2(theEnv,"deffunction-module",'w',PTIEF GetDeffunctionModuleCommand,
00199 "GetDeffunctionModuleCommand","11w");
00200
00201 #if BLOAD_AND_BSAVE || BLOAD || BLOAD_ONLY
00202 SetupDeffunctionsBload(theEnv);
00203 #endif
00204
00205 #if CONSTRUCT_COMPILER
00206 SetupDeffunctionCompiler(theEnv);
00207 #endif
00208
00209 #endif
00210
00211 #if DEBUGGING_FUNCTIONS
00212 AddWatchItem(theEnv,"deffunctions",0,&DeffunctionData(theEnv)->WatchDeffunctions,32,
00213 DeffunctionWatchAccess,DeffunctionWatchPrint);
00214 #endif
00215
00216 }
00217
00218
00219
00220
00221
00222 static void DeallocateDeffunctionData(
00223 void *theEnv)
00224 {
00225 #if ! RUN_TIME
00226 struct deffunctionModule *theModuleItem;
00227 void *theModule;
00228
00229 #if BLOAD || BLOAD_AND_BSAVE
00230 if (Bloaded(theEnv)) return;
00231 #endif
00232
00233 DoForAllConstructs(theEnv,DestroyDeffunctionAction,DeffunctionData(theEnv)->DeffunctionModuleIndex,FALSE,NULL);
00234
00235 for (theModule = EnvGetNextDefmodule(theEnv,NULL);
00236 theModule != NULL;
00237 theModule = EnvGetNextDefmodule(theEnv,theModule))
00238 {
00239 theModuleItem = (struct deffunctionModule *)
00240 GetModuleItem(theEnv,(struct defmodule *) theModule,
00241 DeffunctionData(theEnv)->DeffunctionModuleIndex);
00242 rtn_struct(theEnv,deffunctionModule,theModuleItem);
00243 }
00244 #else
00245 #if MAC_MCW || WIN_MCW || MAC_XCD
00246 #pragma unused(theEnv)
00247 #endif
00248 #endif
00249 }
00250
00251 #if ! RUN_TIME
00252
00253
00254
00255
00256 #if WIN_BTC
00257 #pragma argsused
00258 #endif
00259 static void DestroyDeffunctionAction(
00260 void *theEnv,
00261 struct constructHeader *theConstruct,
00262 void *buffer)
00263 {
00264 #if MAC_MCW || WIN_MCW || MAC_XCD
00265 #pragma unused(buffer)
00266 #endif
00267 #if (! BLOAD_ONLY) && (! RUN_TIME)
00268 struct deffunctionStruct *theDeffunction = (struct deffunctionStruct *) theConstruct;
00269
00270 if (theDeffunction == NULL) return;
00271
00272 ReturnPackedExpression(theEnv,theDeffunction->code);
00273
00274 DestroyConstructHeader(theEnv,&theDeffunction->header);
00275
00276 rtn_struct(theEnv,deffunctionStruct,theDeffunction);
00277 #else
00278 #if MAC_MCW || WIN_MCW || MAC_XCD
00279 #pragma unused(theConstruct,theEnv)
00280 #endif
00281 #endif
00282 }
00283 #endif
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295 globle void *EnvFindDeffunction(
00296 void *theEnv,
00297 char *dfnxModuleAndName)
00298 {
00299 return(FindNamedConstruct(theEnv,dfnxModuleAndName,DeffunctionData(theEnv)->DeffunctionConstruct));
00300 }
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313 globle DEFFUNCTION *LookupDeffunctionByMdlOrScope(
00314 void *theEnv,
00315 char *deffunctionName)
00316 {
00317 return((DEFFUNCTION *) LookupConstruct(theEnv,DeffunctionData(theEnv)->DeffunctionConstruct,deffunctionName,TRUE));
00318 }
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331 globle DEFFUNCTION *LookupDeffunctionInScope(
00332 void *theEnv,
00333 char *deffunctionName)
00334 {
00335 return((DEFFUNCTION *) LookupConstruct(theEnv,DeffunctionData(theEnv)->DeffunctionConstruct,deffunctionName,FALSE));
00336 }
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348 globle intBool EnvUndeffunction(
00349 void *theEnv,
00350 void *vptr)
00351 {
00352 #if (MAC_MCW || WIN_MCW) && (RUN_TIME || BLOAD_ONLY)
00353 #pragma unused(theEnv,vptr)
00354 #endif
00355
00356 #if BLOAD_ONLY || RUN_TIME
00357 return(FALSE);
00358 #else
00359
00360 #if BLOAD || BLOAD_AND_BSAVE
00361
00362 if (Bloaded(theEnv) == TRUE)
00363 return(FALSE);
00364 #endif
00365 if (vptr == NULL)
00366 return(RemoveAllDeffunctions(theEnv));
00367 if (EnvIsDeffunctionDeletable(theEnv,vptr) == FALSE)
00368 return(FALSE);
00369 RemoveConstructFromModule(theEnv,(struct constructHeader *) vptr);
00370 RemoveDeffunction(theEnv,vptr);
00371 return(TRUE);
00372 #endif
00373 }
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384 globle void *EnvGetNextDeffunction(
00385 void *theEnv,
00386 void *ptr)
00387 {
00388 return((void *) GetNextConstructItem(theEnv,(struct constructHeader *) ptr,DeffunctionData(theEnv)->DeffunctionModuleIndex));
00389 }
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402 globle int EnvIsDeffunctionDeletable(
00403 void *theEnv,
00404 void *ptr)
00405 {
00406 DEFFUNCTION *dptr;
00407
00408 if (! ConstructsDeletable(theEnv))
00409 { return FALSE; }
00410
00411 dptr = (DEFFUNCTION *) ptr;
00412
00413 return(((dptr->busy == 0) && (dptr->executing == 0)) ? TRUE : FALSE);
00414 }
00415
00416 #if (! BLOAD_ONLY) && (! RUN_TIME)
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426 globle void RemoveDeffunction(
00427 void *theEnv,
00428 void *vdptr)
00429 {
00430 DEFFUNCTION *dptr = (DEFFUNCTION *) vdptr;
00431
00432 if (dptr == NULL)
00433 return;
00434 DecrementSymbolCount(theEnv,GetDeffunctionNamePointer((void *) dptr));
00435 ExpressionDeinstall(theEnv,dptr->code);
00436 ReturnPackedExpression(theEnv,dptr->code);
00437 SetDeffunctionPPForm((void *) dptr,NULL);
00438 ClearUserDataList(theEnv,dptr->header.usrData);
00439 rtn_struct(theEnv,deffunctionStruct,dptr);
00440 }
00441
00442 #endif
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452 globle void UndeffunctionCommand(
00453 void *theEnv)
00454 {
00455 UndefconstructCommand(theEnv,"undeffunction",DeffunctionData(theEnv)->DeffunctionConstruct);
00456 }
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466 globle void *GetDeffunctionModuleCommand(
00467 void *theEnv)
00468 {
00469 return(GetConstructModuleCommand(theEnv,"deffunction-module",DeffunctionData(theEnv)->DeffunctionConstruct));
00470 }
00471
00472 #if DEBUGGING_FUNCTIONS
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484 globle void PPDeffunctionCommand(
00485 void *theEnv)
00486 {
00487 PPConstructCommand(theEnv,"ppdeffunction",DeffunctionData(theEnv)->DeffunctionConstruct);
00488 }
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498 globle void ListDeffunctionsCommand(
00499 void *theEnv)
00500 {
00501 ListConstructCommand(theEnv,"list-deffunctions",DeffunctionData(theEnv)->DeffunctionConstruct);
00502 }
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513 globle void EnvListDeffunctions(
00514 void *theEnv,
00515 char *logicalName,
00516 struct defmodule *theModule)
00517 {
00518 ListConstruct(theEnv,DeffunctionData(theEnv)->DeffunctionConstruct,logicalName,theModule);
00519 }
00520
00521 #endif
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533 globle void GetDeffunctionListFunction(
00534 void *theEnv,
00535 DATA_OBJECT *returnValue)
00536 {
00537 GetConstructListFunction(theEnv,"get-deffunction-list",returnValue,DeffunctionData(theEnv)->DeffunctionConstruct);
00538 }
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551 globle void EnvGetDeffunctionList(
00552 void *theEnv,
00553 DATA_OBJECT *returnValue,
00554 struct defmodule *theModule)
00555 {
00556 GetConstructList(theEnv,returnValue,DeffunctionData(theEnv)->DeffunctionConstruct,theModule);
00557 }
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569 globle int CheckDeffunctionCall(
00570 void *theEnv,
00571 void *vdptr,
00572 int args)
00573 {
00574 DEFFUNCTION *dptr;
00575
00576 if (vdptr == NULL)
00577 return(FALSE);
00578 dptr = (DEFFUNCTION *) vdptr;
00579 if (args < dptr->minNumberOfParameters)
00580 {
00581 if (dptr->maxNumberOfParameters == -1)
00582 ExpectedCountError(theEnv,EnvGetDeffunctionName(theEnv,(void *) dptr),
00583 AT_LEAST,dptr->minNumberOfParameters);
00584 else
00585 ExpectedCountError(theEnv,EnvGetDeffunctionName(theEnv,(void *) dptr),
00586 EXACTLY,dptr->minNumberOfParameters);
00587 return(FALSE);
00588 }
00589 else if ((args > dptr->minNumberOfParameters) &&
00590 (dptr->maxNumberOfParameters != -1))
00591 {
00592 ExpectedCountError(theEnv,EnvGetDeffunctionName(theEnv,(void *) dptr),
00593 EXACTLY,dptr->minNumberOfParameters);
00594 return(FALSE);
00595 }
00596 return(TRUE);
00597 }
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615 #if WIN_BTC
00616 #pragma argsused
00617 #endif
00618 static void PrintDeffunctionCall(
00619 void *theEnv,
00620 char *logName,
00621 void *value)
00622 {
00623 #if DEVELOPER
00624
00625 EnvPrintRouter(theEnv,logName,"(");
00626 EnvPrintRouter(theEnv,logName,EnvGetDeffunctionName(theEnv,value));
00627 if (GetFirstArgument() != NULL)
00628 {
00629 EnvPrintRouter(theEnv,logName," ");
00630 PrintExpression(theEnv,logName,GetFirstArgument());
00631 }
00632 EnvPrintRouter(theEnv,logName,")");
00633 #else
00634 #if MAC_MCW || WIN_MCW || MAC_XCD
00635 #pragma unused(theEnv)
00636 #pragma unused(logName)
00637 #pragma unused(value)
00638 #endif
00639 #endif
00640 }
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656 static intBool EvaluateDeffunctionCall(
00657 void *theEnv,
00658 void *value,
00659 DATA_OBJECT *result)
00660 {
00661 CallDeffunction(theEnv,(DEFFUNCTION *) value,GetFirstArgument(),result);
00662 if ((GetpType(result) == SYMBOL) &&
00663 (GetpValue(result) == EnvFalseSymbol(theEnv)))
00664 return(FALSE);
00665 return(TRUE);
00666 }
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678 static void DecrementDeffunctionBusyCount(
00679 void *theEnv,
00680 void *value)
00681 {
00682
00683
00684
00685
00686
00687
00688 if (! ConstructData(theEnv)->ClearInProgress)
00689 ((DEFFUNCTION *) value)->busy--;
00690 }
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701 #if WIN_BTC
00702 #pragma argsused
00703 #endif
00704 static void IncrementDeffunctionBusyCount(
00705 void *theEnv,
00706 void *value)
00707 {
00708 #if MAC_MCW || WIN_MCW || MAC_XCD
00709 #pragma unused(theEnv)
00710 #endif
00711
00712 ((DEFFUNCTION *) value)->busy++;
00713 }
00714
00715 #if ! RUN_TIME
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726 static void *AllocateModule(
00727 void *theEnv)
00728 {
00729 return((void *) get_struct(theEnv,deffunctionModule));
00730 }
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741 static void ReturnModule(
00742 void *theEnv,
00743 void *theItem)
00744 {
00745 #if (! BLOAD_ONLY)
00746 FreeConstructHeaderModule(theEnv,(struct defmoduleItemHeader *) theItem,DeffunctionData(theEnv)->DeffunctionConstruct);
00747 #endif
00748 rtn_struct(theEnv,deffunctionModule,theItem);
00749 }
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765 static intBool ClearDeffunctionsReady(
00766 void *theEnv)
00767 {
00768 return((DeffunctionData(theEnv)->ExecutingDeffunction != NULL) ? FALSE : TRUE);
00769 }
00770
00771 #endif
00772
00773 #if (! BLOAD_ONLY) && (! RUN_TIME)
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784 static intBool RemoveAllDeffunctions(
00785 void *theEnv)
00786 {
00787 DEFFUNCTION *dptr,*dtmp;
00788 unsigned oldbusy;
00789 intBool success = TRUE;
00790
00791 #if BLOAD || BLOAD_AND_BSAVE
00792
00793 if (Bloaded(theEnv) == TRUE)
00794 return(FALSE);
00795 #endif
00796
00797 dptr = (DEFFUNCTION *) EnvGetNextDeffunction(theEnv,NULL);
00798 while (dptr != NULL)
00799 {
00800 if (dptr->executing > 0)
00801 {
00802 DeffunctionDeleteError(theEnv,EnvGetDeffunctionName(theEnv,(void *) dptr));
00803 success = FALSE;
00804 }
00805 else
00806 {
00807 oldbusy = dptr->busy;
00808 ExpressionDeinstall(theEnv,dptr->code);
00809 dptr->busy = oldbusy;
00810 ReturnPackedExpression(theEnv,dptr->code);
00811 dptr->code = NULL;
00812 }
00813 dptr = (DEFFUNCTION *) EnvGetNextDeffunction(theEnv,(void *) dptr);
00814 }
00815
00816 dptr = (DEFFUNCTION *) EnvGetNextDeffunction(theEnv,NULL);
00817 while (dptr != NULL)
00818 {
00819 dtmp = dptr;
00820 dptr = (DEFFUNCTION *) EnvGetNextDeffunction(theEnv,(void *) dptr);
00821 if (dtmp->executing == 0)
00822 {
00823 if (dtmp->busy > 0)
00824 {
00825 PrintWarningID(theEnv,"DFFNXFUN",1,FALSE);
00826 EnvPrintRouter(theEnv,WWARNING,"Deffunction ");
00827 EnvPrintRouter(theEnv,WWARNING,EnvGetDeffunctionName(theEnv,(void *) dtmp));
00828 EnvPrintRouter(theEnv,WWARNING," only partially deleted due to usage by other constructs.\n");
00829 SetDeffunctionPPForm((void *) dtmp,NULL);
00830 success = FALSE;
00831 }
00832 else
00833 {
00834 RemoveConstructFromModule(theEnv,(struct constructHeader *) dtmp);
00835 RemoveDeffunction(theEnv,dtmp);
00836 }
00837 }
00838 }
00839 return(success);
00840 }
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851 static void DeffunctionDeleteError(
00852 void *theEnv,
00853 char *dfnxName)
00854 {
00855 CantDeleteItemErrorMessage(theEnv,"deffunction",dfnxName);
00856 }
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870 static void SaveDeffunctionHeaders(
00871 void *theEnv,
00872 void *theModule,
00873 char *logicalName)
00874 {
00875 DoForAllConstructsInModule(theEnv,theModule,SaveDeffunctionHeader,
00876 DeffunctionData(theEnv)->DeffunctionModuleIndex,
00877 FALSE,(void *) logicalName);
00878 }
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890 static void SaveDeffunctionHeader(
00891 void *theEnv,
00892 struct constructHeader *theDeffunction,
00893 void *userBuffer)
00894 {
00895 DEFFUNCTION *dfnxPtr = (DEFFUNCTION *) theDeffunction;
00896 char *logicalName = (char *) userBuffer;
00897 register int i;
00898
00899 if (EnvGetDeffunctionPPForm(theEnv,(void *) dfnxPtr) != NULL)
00900 {
00901 EnvPrintRouter(theEnv,logicalName,"(deffunction ");
00902 EnvPrintRouter(theEnv,logicalName,EnvDeffunctionModule(theEnv,(void *) dfnxPtr));
00903 EnvPrintRouter(theEnv,logicalName,"::");
00904 EnvPrintRouter(theEnv,logicalName,EnvGetDeffunctionName(theEnv,(void *) dfnxPtr));
00905 EnvPrintRouter(theEnv,logicalName," (");
00906 for (i = 0 ; i < dfnxPtr->minNumberOfParameters ; i++)
00907 {
00908 EnvPrintRouter(theEnv,logicalName,"?p");
00909 PrintLongInteger(theEnv,logicalName,(long long) i);
00910 if (i != dfnxPtr->minNumberOfParameters-1)
00911 EnvPrintRouter(theEnv,logicalName," ");
00912 }
00913 if (dfnxPtr->maxNumberOfParameters == -1)
00914 {
00915 if (dfnxPtr->minNumberOfParameters != 0)
00916 EnvPrintRouter(theEnv,logicalName," ");
00917 EnvPrintRouter(theEnv,logicalName,"$?wildargs))\n\n");
00918 }
00919 else
00920 EnvPrintRouter(theEnv,logicalName,"))\n\n");
00921 }
00922 }
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933 static void SaveDeffunctions(
00934 void *theEnv,
00935 void *theModule,
00936 char *logicalName)
00937 {
00938 SaveConstruct(theEnv,theModule,logicalName,DeffunctionData(theEnv)->DeffunctionConstruct);
00939 }
00940
00941 #endif
00942
00943 #if DEBUGGING_FUNCTIONS
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958 #if WIN_BTC
00959 #pragma argsused
00960 #endif
00961 static unsigned DeffunctionWatchAccess(
00962 void *theEnv,
00963 int code,
00964 unsigned newState,
00965 EXPRESSION *argExprs)
00966 {
00967 #if MAC_MCW || WIN_MCW || MAC_XCD
00968 #pragma unused(code)
00969 #endif
00970
00971 return(ConstructSetWatchAccess(theEnv,DeffunctionData(theEnv)->DeffunctionConstruct,newState,argExprs,
00972 EnvGetDeffunctionWatch,EnvSetDeffunctionWatch));
00973 }
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988 #if WIN_BTC
00989 #pragma argsused
00990 #endif
00991 static unsigned DeffunctionWatchPrint(
00992 void *theEnv,
00993 char *logName,
00994 int code,
00995 EXPRESSION *argExprs)
00996 {
00997 #if MAC_MCW || WIN_MCW || MAC_XCD
00998 #pragma unused(code)
00999 #endif
01000
01001 return(ConstructPrintWatchAccess(theEnv,DeffunctionData(theEnv)->DeffunctionConstruct,logName,argExprs,
01002 EnvGetDeffunctionWatch,EnvSetDeffunctionWatch));
01003 }
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016 #if WIN_BTC
01017 #pragma argsused
01018 #endif
01019 globle void EnvSetDeffunctionWatch(
01020 void *theEnv,
01021 unsigned newState,
01022 void *dptr)
01023 {
01024 #if MAC_MCW || WIN_MCW || MAC_XCD
01025 #pragma unused(theEnv)
01026 #endif
01027
01028 ((DEFFUNCTION *) dptr)->trace = (unsigned short) newState;
01029 }
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041 #if WIN_BTC
01042 #pragma argsused
01043 #endif
01044 globle unsigned EnvGetDeffunctionWatch(
01045 void *theEnv,
01046 void *dptr)
01047 {
01048 #if MAC_MCW || WIN_MCW || MAC_XCD
01049 #pragma unused(theEnv)
01050 #endif
01051
01052 return(((DEFFUNCTION *) dptr)->trace);
01053 }
01054
01055 #endif
01056
01057 #endif
01058
01059