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 #define _FACTRETE_SOURCE_
00027
00028 #include <stdio.h>
00029 #define _STDIO_INCLUDED_
00030
00031 #include "setup.h"
00032
00033 #if DEFTEMPLATE_CONSTRUCT && DEFRULE_CONSTRUCT
00034
00035 #include "memalloc.h"
00036 #include "extnfunc.h"
00037 #include "router.h"
00038 #include "incrrset.h"
00039 #include "reteutil.h"
00040 #include "drive.h"
00041 #include "engine.h"
00042 #include "factgen.h"
00043 #include "factmch.h"
00044 #include "envrnmnt.h"
00045
00046 #include "factrete.h"
00047
00048
00049
00050
00051
00052 globle intBool FactPNGetVar1(
00053 void *theEnv,
00054 void *theValue,
00055 DATA_OBJECT_PTR returnValue)
00056 {
00057 unsigned short theField, theSlot;
00058 struct fact *factPtr;
00059 struct field *fieldPtr;
00060 struct multifieldMarker *marks;
00061 struct multifield *segmentPtr;
00062 int extent;
00063 struct factGetVarPN1Call *hack;
00064
00065
00066
00067
00068
00069 hack = (struct factGetVarPN1Call *) ValueToBitMap(theValue);
00070
00071
00072
00073
00074
00075 factPtr = FactData(theEnv)->CurrentPatternFact;
00076 marks = FactData(theEnv)->CurrentPatternMarks;
00077
00078
00079
00080
00081
00082
00083 if (hack->factAddress)
00084 {
00085 returnValue->type = FACT_ADDRESS;
00086 returnValue->value = (void *) factPtr;
00087 return(TRUE);
00088 }
00089
00090
00091
00092
00093
00094 if (hack->allFields)
00095 {
00096 theSlot = hack->whichSlot;
00097 fieldPtr = &factPtr->theProposition.theFields[theSlot];
00098 returnValue->type = fieldPtr->type;
00099 returnValue->value = fieldPtr->value;
00100 if (returnValue->type == MULTIFIELD)
00101 {
00102 SetpDOBegin(returnValue,1);
00103 SetpDOEnd(returnValue,((struct multifield *) fieldPtr->value)->multifieldLength);
00104 }
00105
00106 return(TRUE);
00107 }
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118 theField = hack->whichField;
00119 theSlot = hack->whichSlot;
00120 fieldPtr = &factPtr->theProposition.theFields[theSlot];
00121
00122
00123
00124
00125
00126
00127 extent = -1;
00128 theField = AdjustFieldPosition(theEnv,marks,theField,theSlot,&extent);
00129
00130
00131
00132
00133
00134
00135 if (extent != -1)
00136 {
00137 returnValue->type = MULTIFIELD;
00138 returnValue->value = (void *) fieldPtr->value;
00139 returnValue->begin = theField;
00140 returnValue->end = theField + extent - 1;
00141 return(TRUE);
00142 }
00143
00144
00145
00146
00147
00148
00149 segmentPtr = (struct multifield *) fieldPtr->value;
00150 fieldPtr = &segmentPtr->theFields[theField];
00151
00152 returnValue->type = fieldPtr->type;
00153 returnValue->value = fieldPtr->value;
00154
00155 return(TRUE);
00156 }
00157
00158
00159
00160
00161
00162
00163 globle intBool FactPNGetVar2(
00164 void *theEnv,
00165 void *theValue,
00166 DATA_OBJECT_PTR returnValue)
00167 {
00168 struct fact *factPtr;
00169 struct factGetVarPN2Call *hack;
00170 struct field *fieldPtr;
00171
00172
00173
00174
00175
00176 hack = (struct factGetVarPN2Call *) ValueToBitMap(theValue);
00177
00178
00179
00180
00181
00182 factPtr = FactData(theEnv)->CurrentPatternFact;
00183
00184
00185
00186
00187
00188 fieldPtr = &factPtr->theProposition.theFields[hack->whichSlot];
00189
00190 returnValue->type = fieldPtr->type;
00191 returnValue->value = fieldPtr->value;
00192
00193 return(TRUE);
00194 }
00195
00196
00197
00198
00199
00200
00201 globle intBool FactPNGetVar3(
00202 void *theEnv,
00203 void *theValue,
00204 DATA_OBJECT_PTR returnValue)
00205 {
00206 struct fact *factPtr;
00207 struct multifield *segmentPtr;
00208 struct field *fieldPtr;
00209 struct factGetVarPN3Call *hack;
00210
00211
00212
00213
00214
00215 hack = (struct factGetVarPN3Call *) ValueToBitMap(theValue);
00216
00217
00218
00219
00220
00221 factPtr = FactData(theEnv)->CurrentPatternFact;
00222
00223
00224
00225
00226
00227 segmentPtr = (struct multifield *) factPtr->theProposition.theFields[hack->whichSlot].value;
00228
00229
00230
00231
00232
00233
00234 if (hack->fromBeginning && hack->fromEnd)
00235 {
00236 returnValue->type = MULTIFIELD;
00237 returnValue->value = (void *) segmentPtr;
00238 returnValue->begin = (long) hack->beginOffset;
00239 returnValue->end = (long) (segmentPtr->multifieldLength - (hack->endOffset + 1));
00240 return(TRUE);
00241 }
00242
00243
00244
00245
00246
00247 if (hack->fromBeginning)
00248 { fieldPtr = &segmentPtr->theFields[hack->beginOffset]; }
00249 else
00250 { fieldPtr = &segmentPtr->theFields[segmentPtr->multifieldLength - (hack->endOffset + 1)]; }
00251
00252 returnValue->type = fieldPtr->type;
00253 returnValue->value = fieldPtr->value;
00254
00255 return(TRUE);
00256 }
00257
00258
00259
00260
00261
00262
00263 #if WIN_BTC
00264 #pragma argsused
00265 #endif
00266 globle intBool FactPNConstant1(
00267 void *theEnv,
00268 void *theValue,
00269 DATA_OBJECT_PTR returnValue)
00270 {
00271 #if MAC_MCW || WIN_MCW || MAC_XCD
00272 #pragma unused(returnValue)
00273 #endif
00274 struct factConstantPN1Call *hack;
00275 struct field *fieldPtr;
00276 struct expr *theConstant;
00277
00278
00279
00280
00281
00282 hack = (struct factConstantPN1Call *) ValueToBitMap(theValue);
00283
00284
00285
00286
00287
00288 fieldPtr = &FactData(theEnv)->CurrentPatternFact->theProposition.theFields[hack->whichSlot];
00289
00290
00291
00292
00293
00294 theConstant = GetFirstArgument();
00295 if (theConstant->type != fieldPtr->type) return(1 - hack->testForEquality);
00296 if (theConstant->value != fieldPtr->value) return(1 - hack->testForEquality);
00297 return(hack->testForEquality);
00298 }
00299
00300
00301
00302
00303
00304
00305
00306
00307 #if WIN_BTC
00308 #pragma argsused
00309 #endif
00310 globle intBool FactPNConstant2(
00311 void *theEnv,
00312 void *theValue,
00313 DATA_OBJECT_PTR returnValue)
00314 {
00315 #if MAC_MCW || WIN_MCW || MAC_XCD
00316 #pragma unused(returnValue)
00317 #endif
00318 struct factConstantPN2Call *hack;
00319 struct field *fieldPtr;
00320 struct expr *theConstant;
00321 struct multifield *segmentPtr;
00322
00323
00324
00325
00326
00327 hack = (struct factConstantPN2Call *) ValueToBitMap(theValue);
00328
00329
00330
00331
00332
00333
00334
00335
00336 fieldPtr = &FactData(theEnv)->CurrentPatternFact->theProposition.theFields[hack->whichSlot];
00337
00338 if (fieldPtr->type == MULTIFIELD)
00339 {
00340 segmentPtr = (struct multifield *) fieldPtr->value;
00341
00342 if (hack->fromBeginning)
00343 { fieldPtr = &segmentPtr->theFields[hack->offset]; }
00344 else
00345 {
00346 fieldPtr = &segmentPtr->theFields[segmentPtr->multifieldLength -
00347 (hack->offset + 1)];
00348 }
00349 }
00350
00351
00352
00353
00354
00355 theConstant = GetFirstArgument();
00356 if (theConstant->type != fieldPtr->type) return(1 - hack->testForEquality);
00357 if (theConstant->value != fieldPtr->value) return(1 - hack->testForEquality);
00358 return(hack->testForEquality);
00359 }
00360
00361
00362
00363
00364
00365 globle intBool FactJNGetVar1(
00366 void *theEnv,
00367 void *theValue,
00368 DATA_OBJECT_PTR returnValue)
00369 {
00370 unsigned short theField, theSlot;
00371 struct fact *factPtr;
00372 struct field *fieldPtr;
00373 struct multifieldMarker *marks;
00374 struct multifield *segmentPtr;
00375 int extent;
00376 struct factGetVarJN1Call *hack;
00377
00378
00379
00380
00381
00382 hack = (struct factGetVarJN1Call *) ValueToBitMap(theValue);
00383
00384
00385
00386
00387
00388 if (hack->lhs)
00389 {
00390 factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalLHSBinds,hack->whichPattern)->matchingItem;
00391 marks = get_nth_pm_match(EngineData(theEnv)->GlobalLHSBinds,hack->whichPattern)->markers;
00392 }
00393 else if (hack->rhs)
00394 {
00395 factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalRHSBinds,hack->whichPattern)->matchingItem;
00396 marks = get_nth_pm_match(EngineData(theEnv)->GlobalRHSBinds,hack->whichPattern)->markers;
00397 }
00398 else if (EngineData(theEnv)->GlobalRHSBinds == NULL)
00399 {
00400 factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalLHSBinds,hack->whichPattern)->matchingItem;
00401 marks = get_nth_pm_match(EngineData(theEnv)->GlobalLHSBinds,hack->whichPattern)->markers;
00402 }
00403 else if ((((unsigned short) (EngineData(theEnv)->GlobalJoin->depth - 1))) == hack->whichPattern)
00404 {
00405 factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalRHSBinds,0)->matchingItem;
00406 marks = get_nth_pm_match(EngineData(theEnv)->GlobalRHSBinds,0)->markers;
00407 }
00408 else
00409 {
00410 factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalLHSBinds,hack->whichPattern)->matchingItem;
00411 marks = get_nth_pm_match(EngineData(theEnv)->GlobalLHSBinds,hack->whichPattern)->markers;
00412 }
00413
00414
00415
00416
00417
00418
00419 if (hack->factAddress)
00420 {
00421 returnValue->type = FACT_ADDRESS;
00422 returnValue->value = (void *) factPtr;
00423 return(TRUE);
00424 }
00425
00426
00427
00428
00429
00430 if (hack->allFields)
00431 {
00432 theSlot = hack->whichSlot;
00433 fieldPtr = &factPtr->theProposition.theFields[theSlot];
00434 returnValue->type = fieldPtr->type;
00435 returnValue->value = fieldPtr->value;
00436 if (returnValue->type == MULTIFIELD)
00437 {
00438 SetpDOBegin(returnValue,1);
00439 SetpDOEnd(returnValue,((struct multifield *) fieldPtr->value)->multifieldLength);
00440 }
00441
00442 return(TRUE);
00443 }
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454 theField = hack->whichField;
00455 theSlot = hack->whichSlot;
00456 fieldPtr = &factPtr->theProposition.theFields[theSlot];
00457
00458 if (fieldPtr->type != MULTIFIELD)
00459 {
00460 returnValue->type = fieldPtr->type;
00461 returnValue->value = fieldPtr->value;
00462 return(TRUE);
00463 }
00464
00465
00466
00467
00468
00469
00470 extent = -1;
00471 theField = AdjustFieldPosition(theEnv,marks,theField,theSlot,&extent);
00472
00473
00474
00475
00476
00477
00478 if (extent != -1)
00479 {
00480 returnValue->type = MULTIFIELD;
00481 returnValue->value = (void *) fieldPtr->value;
00482 returnValue->begin = theField;
00483 returnValue->end = theField + extent - 1;
00484 return(TRUE);
00485 }
00486
00487
00488
00489
00490
00491
00492 segmentPtr = (struct multifield *) factPtr->theProposition.theFields[theSlot].value;
00493 fieldPtr = &segmentPtr->theFields[theField];
00494
00495 returnValue->type = fieldPtr->type;
00496 returnValue->value = fieldPtr->value;
00497
00498 return(TRUE);
00499 }
00500
00501
00502
00503
00504
00505
00506 globle intBool FactJNGetVar2(
00507 void *theEnv,
00508 void *theValue,
00509 DATA_OBJECT_PTR returnValue)
00510 {
00511 struct fact *factPtr;
00512 struct factGetVarJN2Call *hack;
00513 struct field *fieldPtr;
00514
00515
00516
00517
00518
00519 hack = (struct factGetVarJN2Call *) ValueToBitMap(theValue);
00520
00521
00522
00523
00524
00525 if (hack->lhs)
00526 { factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalLHSBinds,hack->whichPattern)->matchingItem; }
00527 else if (hack->rhs)
00528 { factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalRHSBinds,hack->whichPattern)->matchingItem; }
00529 else if (EngineData(theEnv)->GlobalRHSBinds == NULL)
00530 { factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalLHSBinds,hack->whichPattern)->matchingItem; }
00531 else if (((unsigned short) (EngineData(theEnv)->GlobalJoin->depth - 1)) == hack->whichPattern)
00532 { factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalRHSBinds,0)->matchingItem; }
00533 else
00534 { factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalLHSBinds,hack->whichPattern)->matchingItem; }
00535
00536
00537
00538
00539
00540 fieldPtr = &factPtr->theProposition.theFields[hack->whichSlot];
00541
00542 returnValue->type = fieldPtr->type;
00543 returnValue->value = fieldPtr->value;
00544
00545 return(TRUE);
00546 }
00547
00548
00549
00550
00551
00552
00553 globle intBool FactJNGetVar3(
00554 void *theEnv,
00555 void *theValue,
00556 DATA_OBJECT_PTR returnValue)
00557 {
00558 struct fact *factPtr;
00559 struct multifield *segmentPtr;
00560 struct field *fieldPtr;
00561 struct factGetVarJN3Call *hack;
00562
00563
00564
00565
00566
00567 hack = (struct factGetVarJN3Call *) ValueToBitMap(theValue);
00568
00569
00570
00571
00572
00573 if (hack->lhs)
00574 { factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalLHSBinds,hack->whichPattern)->matchingItem; }
00575 else if (hack->rhs)
00576 { factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalRHSBinds,hack->whichPattern)->matchingItem; }
00577 else if (EngineData(theEnv)->GlobalRHSBinds == NULL)
00578 { factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalLHSBinds,hack->whichPattern)->matchingItem; }
00579 else if (((unsigned short) (EngineData(theEnv)->GlobalJoin->depth - 1)) == hack->whichPattern)
00580 { factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalRHSBinds,0)->matchingItem; }
00581 else
00582 { factPtr = (struct fact *) get_nth_pm_match(EngineData(theEnv)->GlobalLHSBinds,hack->whichPattern)->matchingItem; }
00583
00584
00585
00586
00587
00588 segmentPtr = (struct multifield *) factPtr->theProposition.theFields[hack->whichSlot].value;
00589
00590
00591
00592
00593
00594
00595 if (hack->fromBeginning && hack->fromEnd)
00596 {
00597 returnValue->type = MULTIFIELD;
00598 returnValue->value = (void *) segmentPtr;
00599 returnValue->begin = hack->beginOffset;
00600 returnValue->end = (long) (segmentPtr->multifieldLength - (hack->endOffset + 1));
00601 return(TRUE);
00602 }
00603
00604
00605
00606
00607
00608 if (hack->fromBeginning)
00609 { fieldPtr = &segmentPtr->theFields[hack->beginOffset]; }
00610 else
00611 { fieldPtr = &segmentPtr->theFields[segmentPtr->multifieldLength - (hack->endOffset + 1)]; }
00612
00613 returnValue->type = fieldPtr->type;
00614 returnValue->value = fieldPtr->value;
00615
00616 return(TRUE);
00617 }
00618
00619
00620
00621
00622
00623 globle intBool FactSlotLength(
00624 void *theEnv,
00625 void *theValue,
00626 DATA_OBJECT_PTR returnValue)
00627 {
00628 struct factCheckLengthPNCall *hack;
00629 struct multifield *segmentPtr;
00630 long extraOffset = 0;
00631 struct multifieldMarker *tempMark;
00632
00633 returnValue->type = SYMBOL;
00634 returnValue->value = EnvFalseSymbol(theEnv);
00635
00636 hack = (struct factCheckLengthPNCall *) ValueToBitMap(theValue);
00637
00638 for (tempMark = FactData(theEnv)->CurrentPatternMarks;
00639 tempMark != NULL;
00640 tempMark = tempMark->next)
00641 {
00642 if (tempMark->where.whichSlotNumber != hack->whichSlot) continue;
00643 extraOffset += ((tempMark->endPosition - tempMark->startPosition) + 1);
00644 }
00645
00646 segmentPtr = (struct multifield *) FactData(theEnv)->CurrentPatternFact->theProposition.theFields[hack->whichSlot].value;
00647
00648 if (segmentPtr->multifieldLength < (hack->minLength + extraOffset))
00649 { return(FALSE); }
00650
00651 if (hack->exactly && (segmentPtr->multifieldLength > (hack->minLength + extraOffset)))
00652 { return(FALSE); }
00653
00654 returnValue->value = EnvTrueSymbol(theEnv);
00655 return(TRUE);
00656 }
00657
00658
00659
00660
00661
00662 #if WIN_BTC
00663 #pragma argsused
00664 #endif
00665 globle int FactJNCompVars1(
00666 void *theEnv,
00667 void *theValue,
00668 DATA_OBJECT *theResult)
00669 {
00670 #if MAC_MCW || WIN_MCW || MAC_XCD
00671 #pragma unused(theResult)
00672 #endif
00673 int p1, e1, p2, e2;
00674 struct fact *fact1, *fact2;
00675 struct factCompVarsJN1Call *hack;
00676
00677
00678
00679
00680
00681 hack = (struct factCompVarsJN1Call *) ValueToBitMap(theValue);
00682
00683
00684
00685
00686
00687 p1 = (int) hack->pattern1;
00688 p2 = (int) hack->pattern2;
00689
00690 fact1 = (struct fact *) EngineData(theEnv)->GlobalRHSBinds->binds[p1].gm.theMatch->matchingItem;
00691
00692 if (hack->p2rhs)
00693 { fact2 = (struct fact *) EngineData(theEnv)->GlobalRHSBinds->binds[p2].gm.theMatch->matchingItem; }
00694 else
00695 { fact2 = (struct fact *) EngineData(theEnv)->GlobalLHSBinds->binds[p2].gm.theMatch->matchingItem; }
00696
00697
00698
00699
00700
00701 e1 = (int) hack->slot1;
00702 e2 = (int) hack->slot2;
00703
00704 if (fact1->theProposition.theFields[e1].type !=
00705 fact2->theProposition.theFields[e2].type)
00706 { return((int) hack->fail); }
00707
00708 if (fact1->theProposition.theFields[e1].value !=
00709 fact2->theProposition.theFields[e2].value)
00710 { return((int) hack->fail); }
00711
00712 return((int) hack->pass);
00713 }
00714
00715
00716
00717
00718
00719
00720
00721
00722 #if WIN_BTC
00723 #pragma argsused
00724 #endif
00725 globle int FactJNCompVars2(
00726 void *theEnv,
00727 void *theValue,
00728 DATA_OBJECT *theResult)
00729 {
00730 #if MAC_MCW || WIN_MCW || MAC_XCD
00731 #pragma unused(theResult)
00732 #endif
00733 int p1, s1, p2, s2;
00734 struct fact *fact1, *fact2;
00735 struct factCompVarsJN2Call *hack;
00736 struct multifield *segment;
00737 struct field *fieldPtr1, *fieldPtr2;
00738
00739
00740
00741
00742
00743 hack = (struct factCompVarsJN2Call *) ValueToBitMap(theValue);
00744
00745
00746
00747
00748
00749 p1 = (int) hack->pattern1;
00750 p2 = (int) hack->pattern2;
00751 s1 = (int) hack->slot1;
00752 s2 = (int) hack->slot2;
00753
00754 fact1 = (struct fact *) EngineData(theEnv)->GlobalRHSBinds->binds[p1].gm.theMatch->matchingItem;
00755
00756 if (hack->p2rhs)
00757 { fact2 = (struct fact *) EngineData(theEnv)->GlobalRHSBinds->binds[p2].gm.theMatch->matchingItem; }
00758 else
00759 { fact2 = (struct fact *) EngineData(theEnv)->GlobalLHSBinds->binds[p2].gm.theMatch->matchingItem; }
00760
00761
00762
00763
00764
00765 if (fact1->theProposition.theFields[s1].type != MULTIFIELD)
00766 { fieldPtr1 = &fact1->theProposition.theFields[s1]; }
00767 else
00768 {
00769 segment = (struct multifield *) fact1->theProposition.theFields[s1].value;
00770
00771 if (hack->fromBeginning1)
00772 { fieldPtr1 = &segment->theFields[hack->offset1]; }
00773 else
00774 { fieldPtr1 = &segment->theFields[segment->multifieldLength - (hack->offset1 + 1)]; }
00775 }
00776
00777 if (fact2->theProposition.theFields[s2].type != MULTIFIELD)
00778 { fieldPtr2 = &fact2->theProposition.theFields[s2]; }
00779 else
00780 {
00781 segment = (struct multifield *) fact2->theProposition.theFields[s2].value;
00782
00783 if (hack->fromBeginning2)
00784 { fieldPtr2 = &segment->theFields[hack->offset2]; }
00785 else
00786 { fieldPtr2 = &segment->theFields[segment->multifieldLength - (hack->offset2 + 1)]; }
00787 }
00788
00789
00790
00791
00792
00793 if (fieldPtr1->type != fieldPtr2->type)
00794 { return((int) hack->fail); }
00795
00796 if (fieldPtr1->value != fieldPtr2->value)
00797 { return((int) hack->fail); }
00798
00799 return((int) hack->pass);
00800 }
00801
00802
00803
00804
00805
00806 globle int FactPNCompVars1(
00807 void *theEnv,
00808 void *theValue,
00809 DATA_OBJECT *theResult)
00810 {
00811 int rv;
00812 struct field *fieldPtr1, *fieldPtr2;
00813 struct factCompVarsPN1Call *hack;
00814
00815
00816
00817
00818
00819 hack = (struct factCompVarsPN1Call *) ValueToBitMap(theValue);
00820 fieldPtr1 = &FactData(theEnv)->CurrentPatternFact->theProposition.theFields[hack->field1];
00821 fieldPtr2 = &FactData(theEnv)->CurrentPatternFact->theProposition.theFields[hack->field2];
00822
00823
00824
00825
00826
00827 if (fieldPtr1->type != fieldPtr2->type) rv = (int) hack->fail;
00828 else if (fieldPtr1->value != fieldPtr2->value) rv = (int) hack->fail;
00829 else rv = (int) hack->pass;
00830
00831 theResult->type = SYMBOL;
00832 if (rv) theResult->value = EnvTrueSymbol(theEnv);
00833 else theResult->value = EnvFalseSymbol(theEnv);
00834
00835 return(rv);
00836 }
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854 #if WIN_BTC
00855 #pragma argsused
00856 #endif
00857 globle unsigned short AdjustFieldPosition(
00858 void *theEnv,
00859 struct multifieldMarker *markList,
00860 unsigned short whichField,
00861 unsigned short whichSlot,
00862 int *extent)
00863 {
00864 unsigned short actualIndex;
00865 #if MAC_MCW || WIN_MCW || MAC_XCD
00866 #pragma unused(theEnv)
00867 #endif
00868
00869 actualIndex = whichField;
00870 for (;
00871 markList != NULL;
00872 markList = markList->next)
00873 {
00874
00875
00876
00877
00878 if (markList->where.whichSlotNumber != whichSlot) continue;
00879
00880
00881
00882
00883
00884
00885
00886
00887 if (markList->whichField == whichField)
00888 {
00889 *extent = (markList->endPosition - markList->startPosition) + 1;
00890 return(actualIndex);
00891 }
00892
00893
00894
00895
00896
00897
00898
00899 else if (markList->whichField > whichField)
00900 { return(actualIndex); }
00901
00902
00903
00904
00905
00906
00907 actualIndex += (unsigned short) (markList->endPosition - markList->startPosition);
00908 }
00909
00910
00911
00912
00913
00914 return(actualIndex);
00915 }
00916
00917
00918
00919
00920
00921
00922 #if WIN_BTC
00923 #pragma argsused
00924 #endif
00925 globle int FactStoreMultifield(
00926 void *theEnv,
00927 void *theValue,
00928 DATA_OBJECT *theResult)
00929 {
00930 #if MAC_MCW || WIN_MCW || MAC_XCD
00931 #pragma unused(theValue)
00932 #endif
00933
00934 StoreInMultifield(theEnv,theResult,GetFirstArgument(),FALSE);
00935 return(TRUE);
00936 }
00937
00938 #endif
00939