-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIMenubar.mod
executable file
·5067 lines (4986 loc) · 205 KB
/
IMenubar.mod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{++++++++++++++++++++++++++++++++++++++RAPTOR++++++++++++++++++++++++++++++++++++++}
{+ +}
{+ Implementation Module : Menubar +}
{+ Author : Steve Brown +}
{+ Modified By : Elizabeth Grimes +}
{+ Last Modified : 8/18/08 wds/TES +}
{+ Description : This module controls all menubars in RAPTOR - RBD workspace, +}
{+ simulation, and graph. Handles all actions from selections. +}
{+ +}
{++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
IMPLEMENTATION MODULE Menubar;
FROM SimMod IMPORT Timescale;
FROM Check IMPORT CheckBoxObj;
FROM Button IMPORT ButtonObj;
FROM Radio IMPORT RadioBoxObj, RadioButtonObj;
FROM Intract IMPORT AboutBoxObj, SystemInputBoxObj, BlockInputBoxObj, NodeInputBoxObj, EventInputBoxObj,
HierInputBoxObj, TablesOutObj, SystemBoxObj, PrefsBoxObj, MassEditBoxObj,
PrintTablesBoxObj, BlockPropObj, PhaseBoxObj, SendAlert, CallHelp, HelpBoxObj,
SparePoolsBoxObj, ResPoolsBoxObj, threeWay, loadCanceled, PrintWinObj,
TrigBoxObj, TreeBoxObj, FailEffectsBoxObj, GotoHierBoxObj, FailRepairBoxObj, GetNumParams;
FROM Value IMPORT ValueBoxObj;
FROM Menu IMPORT MenuItemObj, MenuObj;
FROM Objects IMPORT realArray, RBDNodeObj, RBDBlockObj, RBDEventObj, RBDHierObj, PhaseObj;
FROM GPalet IMPORT PaletteButtonObj;
FROM Graphic IMPORT GraphicVObj;
FROM Chart IMPORT ChartObj, ChartAxisFieldType(ChartYMax,ChartYMin,ChartYIntercept);
FROM Display IMPORT window, root, grid, dialogs, images, systemImage, ClearAllBlocks,
SetView, soundPath, gridIsOn, fileIsOpen, nameOfFile, pathName, filter,
totalBlocks, totalEvents, totalNodes, totalLinks, xOrigin, yOrigin, sound, startStep,
defaultBlock, linkCursor, selectGroup, soundIsOn, sysStreams, soundsPath,
AoGraph, IntAoGraph, MultiRunGraph, AoGraphWindow, DisplayAoGraph, simZoomX,
simZoomY, yMin, yMax, simToolBar, timeSlice, capacityAnalysis, block, event, node, hier,
weakAnalysis, costAnalysis, saveInc, saveIsOn, lastSave, exampPath, AoVisible,
statusBarOn, flowGenerated, cusZoomVal, ZoomPercent,
sysLostCost, systemRedCost, menuTool, fevToolBar, menubar, simMenuBar, weakMenuBar, fevMenuBar,
SelectBlock, SelectEvent, SelectNode, dSimWithGraph, ShowAnalView, analUp, weakToolBar,
analViewAvail, configFrozen, hitXinSim, {changedZoom,} compileType, pastingMultiple,
ValidateRBD, StartFailureEffects, EndFailureEffects, greenFace, yellowFace, redFace,
faceVisible, activePhases, blockGUIColor, symbolScale, symbolOffset, graphYOff
,totalHiers, hierLevel, deepestLevel, activeWindow, ChangeWindow, HandleLinks, phaseObjArray, currentView,
CollapseIntoHier, ZoomFit, {installPath,} password, dontChangeXY, ignoreMouse {eag error 51 fix};
FROM FileFx IMPORT menuPath, menuFile, NewFFile, SaveFile, CloseFFile, SaveAsFile, OpenFile,
SavePathsCFG, rapVersion, GetFileName;
FROM GTypes IMPORT ALL ColorType, TextBufferType, ALL SysCursorType, ALL GraphPartType,
TextFontType(SystemFont,RomanFont,CourierFont,SystemText), OptionListType;
FROM OSMod IMPORT SystemCall, FileExists, GetProgDir, Delay, GetOSType;
FROM GPrint IMPORT PrinterObj, ALL PrintOrientationType;
FROM Image IMPORT ImageObj;
FROM Text IMPORT TextObj;
FROM UtilMod IMPORT DateTime, ClockRealSecs;
FROM IOMod IMPORT StreamObj,FileUseType(Output,Input);
FROM Runsim IMPORT AvailGraph, System, FillStatusBar, phaseNumber, RefreshAllFEV, RefreshPhase,
CreateFMECAarray, WriteFMECAtoFile, simInProgress, WriteSPFfile, exploded;
FROM Print IMPORT ExportRBD, PrintSelected, PrintTree;
FROM GProcs IMPORT HandleEvents;
FROM Button IMPORT ButtonObj;
FROM TextBox IMPORT ComboBoxObj;
FROM Menu IMPORT MenuObj, MenuItemObj;
FROM Control IMPORT ControlVObj;
FROM Form IMPORT DialogBoxObj;
FROM Display IMPORT userPath; { wds/TES, 8/18/08 }
VAR
i, j, k : INTEGER;
message : TextBufferType;
stepped, notSimming : BOOLEAN;
button : ButtonObj;
oldSpeed : REAL;
menuItem, pauseItem, stepItem, jumpItem, stopItem,
returnItem, resimItem, viewItem, printItem,
slowItem, fastItem, statusItem, colorItem,
smallItem, medItem, largeItem, grandeItem,
homeItem, upItem, gotoItem : MenuItemObj;
statusIndItem : ARRAY INTEGER OF MenuItemObj;
buttItem, pauseBut, stepBut, jumpBut, stopBut,
returnBut, resimBut, viewBut, printBut,
slowBut, fastBut, colorBut : PaletteButtonObj;
homeBut, upBut, gotoBut : PaletteButtonObj;
checkedWindow : MenuItemObj;
PROCEDURE ReadLib (IN libPath : STRING;
IN append : BOOLEAN;
OUT success : BOOLEAN);
VAR
tempStrm : StreamObj;
endOfFile, blankLines, goodName, firstMatch : BOOLEAN;
name, theRest, origName : STRING;
last, consecBlanks, nextPos, inInt, tempPos,
numLibBlocks,first,position,matches,j,libSize : INTEGER;
tempName : OptionListType;
tempLib : ARRAY INTEGER, INTEGER OF STRING;
BEGIN
first := 1;
NEW(tempStrm);
ASK tempStrm TO Open(libPath, Input);
IF tempStrm.ioResult <> 0
success := FALSE;
NEW(message, 1..2);
message[1] := "There is a problem opening the block library file. ";
message[2] := "Make sure this file is not set to read only. ";
result := SendAlert(message, FALSE, FALSE, FALSE);
DISPOSE(message);
RETURN;
END IF;
ASK tempStrm TO ReadLine(theRest);
IF SUBSTR(1,9,theRest)="Raptor6.0" {tony}
libVersion:=6;
libSize:=16;
ELSIF SUBSTR(1,9,theRest)="Raptor7.0"
libVersion:=7;
libSize:=22;
ELSE
NEW(message, 1..2);
message[1] := "There is a problem opening the block library file. ";
message[2] := "It does not appear to be properly formatted. ";
result := SendAlert(message, FALSE, FALSE, FALSE);
DISPOSE(message);
RETURN;
END IF;
ASK tempStrm TO ReadLine(theRest);
REPEAT
ASK tempStrm TO ReadString(name);
ASK tempStrm TO ReadLine(theRest);
IF name <> ""
INC(last);
consecBlanks := 0;
ELSE
INC(consecBlanks);
END IF;
IF tempStrm.eof OR (consecBlanks = 499)
endOfFile := TRUE;
numLibBlocks := last;
END IF;
UNTIL endOfFile;
IF numLibBlocks > 0
success := TRUE;
IF append
first := HIGH(libArray)+1;
last := first+last-1;
NEW(tempName, 1..HIGH(nameArray));
NEW(tempLib, 1..HIGH(nameArray), 1..libSize);
FOR i := 1 TO HIGH(nameArray)
tempName[i] := nameArray[i];
FOR j := 1 TO libSize
tempLib[i,j] := libArray[i,j];
END FOR;
END FOR;
DISPOSE(nameArray);
DISPOSE(libArray);
NEW(nameArray, 1..last);
NEW(libArray, 1..last, 1..libSize);
FOR i := 1 TO HIGH(tempName)
nameArray[i] := tempName[i];
FOR j := 1 TO libSize
libArray[i,j] := tempLib[i,j];
END FOR;
END FOR;
ELSE
IF libArray <> NILARRAY
DISPOSE(nameArray);
DISPOSE(libArray);
END IF;
NEW(nameArray, 1..last);
NEW(libArray, 1..last, 1..libSize);
END IF;
ASK tempStrm TO Position(0);
ASK tempStrm TO ReadLine(theRest);
ASK tempStrm TO ReadLine(theRest);
nextPos := ASK tempStrm TO GetPosition;
FOR i := first TO last
ASK tempStrm TO Position(nextPos);
ASK tempStrm TO ReadString(name);
position := ASK tempStrm TO GetPosition;
ASK tempStrm TO ReadLine(theRest);
nextPos := ASK tempStrm TO GetPosition;
ASK tempStrm TO ReadString(theRest);
ASK tempStrm TO Position(position);
IF name = ""
blankLines := TRUE;
ELSE
firstMatch := TRUE;
REPEAT
goodName := TRUE;
FOR j := 1 TO i
IF name = nameArray[j]
IF firstMatch
firstMatch := FALSE;
origName := name;
matches := 1;
END IF;
INC(matches);
name := origName+"-"+INTTOSTR(matches);
goodName := FALSE;
END IF;
END FOR;
UNTIL goodName;
libArray[i,1] := name;
nameArray[i] := name;
tempPos := ASK tempStrm TO GetPosition;
IF tempPos < nextPos
ASK tempStrm TO ReadInt(inInt); {FailDistro}
{eag start}
IF ((inInt = 16) OR (inInt < 1) OR (inInt > 22))
success := FALSE;
NEW(message, 1..3);
message[1] := "There is an invalid distribution in the library ";
message[2] := "file. Contact [email protected] or call ";
message[3] := "505.248.0718 for further assistance. ";
result := SendAlert(message, FALSE, FALSE, TRUE);
DISPOSE(message);
DISPOSE(libArray);
DISPOSE(nameArray);
RETURN;
END IF;
{eag end}
IF (inInt >=1) AND (inInt <= 22)
libArray[i,2] := INTTOSTR(inInt);
ASK tempStrm TO ReadString(libArray[i,3]); {FVal 1}
ASK tempStrm TO ReadString(libArray[i,4]); {FVal 2}
ASK tempStrm TO ReadString(libArray[i,5]); {FVal 3}
IF libVersion=6
ASK tempStrm TO ReadString(theRest); {FVal 4}
END IF;
ELSE
libArray[i,2] := "4";
libArray[i,3] := "100"; {FVal 1}
END IF;
ELSE
libArray[i,2] := "4";
libArray[i,3] := "100"; {FVal 1}
END IF;
tempPos := ASK tempStrm TO GetPosition;
IF tempPos < nextPos
ASK tempStrm TO ReadInt(inInt); {RepDistro}
{eag start}
IF ((inInt = 16) OR (inInt < 1) OR (inInt > 22))
success := FALSE;
NEW(message, 1..3);
message[1] := "There is an invalid distribution in the library ";
message[2] := "file. Contact [email protected] or call ";
message[3] := "505.248.0718 for further assistance. ";
result := SendAlert(message, FALSE, FALSE, TRUE);
DISPOSE(message);
DISPOSE(libArray);
DISPOSE(nameArray);
RETURN;
END IF;
{eag end}
IF ((inInt >=1) AND (inInt <= 22))
libArray[i,7] := INTTOSTR(inInt);
ASK tempStrm TO ReadString(libArray[i,8]); {RVal 1}
ASK tempStrm TO ReadString(libArray[i,9]); {RVal 2}
ASK tempStrm TO ReadString(libArray[i,10]); {RVal 3}
IF libVersion=6
ASK tempStrm TO ReadString(theRest); {RVal 4}
END IF;
ELSE
libArray[i,7] := "7";
libArray[i,8] := "10"; {RVal 1}
libArray[i,9] := "2"; {RVal 2}
END IF;
ELSE
libArray[i,7] := "7";
libArray[i,8] := "10"; {RVal 1}
libArray[i,9] := "2"; {RVal 2}
END IF;
tempPos := ASK tempStrm TO GetPosition;
IF tempPos < nextPos
ASK tempStrm TO ReadString(libArray[i,12]); {Pre LDT dist}
ELSE
libArray[i,12] := "0";
END IF;
tempPos := ASK tempStrm TO GetPosition;
IF tempPos < nextPos
ASK tempStrm TO ReadString(libArray[i,13]); {Post LDT dist}
ELSE
libArray[i,13] := "0";
END IF;
tempPos := ASK tempStrm TO GetPosition;
IF tempPos < nextPos
ASK tempStrm TO ReadString(theRest); {Dependency}
IF LOWER(theRest) = "yes"
libArray[i,14] := "TRUE";
ELSE
libArray[i,14] := "FALSE";
END IF;
ELSE
libArray[i,14] := "FALSE";
END IF;
IF libVersion=7
tempPos := ASK tempStrm TO GetPosition;
IF tempPos < nextPos
ASK tempStrm TO ReadString(libArray[i,15]); {PreVal 1}
ASK tempStrm TO ReadString(libArray[i,16]); {PreVal 2}
ASK tempStrm TO ReadString(libArray[i,17]); {PreVal 3}
ELSE
{tony}
END IF;
tempPos := ASK tempStrm TO GetPosition;
IF tempPos < nextPos
ASK tempStrm TO ReadString(libArray[i,18]); {PostVal 1}
ASK tempStrm TO ReadString(libArray[i,19]); {PostVal 2}
ASK tempStrm TO ReadString(libArray[i,20]); {PostVal 3}
ELSE
{tony}
END IF;
END IF;
END IF;
END FOR;
FOR i := 1 TO HIGH(nameArray) {error checking for fail/repair dist inputs}
FOR j := 1 TO 2
k := 2 + ((j-1)*4); {index for fail/repair dist in libArray}
CASE libArray[i,k]
WHEN "1": {Beta}
IF (STRTOREAL(libArray[i,k+1]) < 0.000001) OR (STRTOREAL(libArray[i,k+1]) > 999999999.999999)
libArray[i,k+1] := "1";
END IF;
IF (STRTOREAL(libArray[i,k+2]) < 0.000001) OR (STRTOREAL(libArray[i,k+2]) > 999999999.999999)
libArray[i,k+2] := "1";
END IF;
WHEN "2": {Chi-square}
IF FLOAT(TRUNC(STRTOREAL(libArray[i,k+1]))) <> STRTOREAL(libArray[i,k+1])
libArray[i,k+1] := INTTOSTR(TRUNC(STRTOREAL(libArray[i,k+1])));
END IF;
IF STRTOREAL(libArray[i,k+1]) > 999999999.
libArray[i,k+1] := "999999999";
END IF;
WHEN "3": {Binomial}
IF FLOAT(TRUNC(STRTOREAL(libArray[i,k+1]))) <> STRTOREAL(libArray[i,k+1])
libArray[i,k+1] := INTTOSTR(TRUNC(STRTOREAL(libArray[i,k+1])));
END IF;
IF STRTOREAL(libArray[i,k+1]) > 999999999.
libArray[i,k+1] := "999999999";
END IF;
IF (STRTOREAL(libArray[i,k+2]) < 0.000001) OR (STRTOREAL(libArray[i,k+2]) > 1.0)
libArray[i,k+2] := "0.8";
END IF;
WHEN "4": {Exponential}
IF (STRTOREAL(libArray[i,k+1]) < 0.000001) OR (STRTOREAL(libArray[i,k+1]) > 999999999.999999)
libArray[i,k+1] := "100";
END IF;
IF (STRTOREAL(libArray[i,k+2]) < 0.0) OR (STRTOREAL(libArray[i,k+2]) > 999999999.999999)
libArray[i,k+2] := "0";
END IF;
WHEN "5": {Erlang}
IF FLOAT(TRUNC(STRTOREAL(libArray[i,k+1]))) <> STRTOREAL(libArray[i,k+1])
libArray[i,k+1] := INTTOSTR(TRUNC(STRTOREAL(libArray[i,k+1])));
END IF;
IF STRTOREAL(libArray[i,k+1]) > 999999999.
libArray[i,k+1] := "999999999";
END IF;
IF (STRTOREAL(libArray[i,k+2]) < 0.000001) OR (STRTOREAL(libArray[i,k+2]) > 999999999.999999)
libArray[i,k+2] := "1";
END IF; {Gamma, Pearson 5, Weibull}
WHEN "6", "11", "15":
IF (STRTOREAL(libArray[i,k+1]) < 0.000001) OR (STRTOREAL(libArray[i,k+1]) > 999999999.999999)
libArray[i,k+1] := "1";
END IF;
IF (STRTOREAL(libArray[i,k+2]) < 0.000001) OR (STRTOREAL(libArray[i,k+2]) > 999999999.999999)
libArray[i,k+2] := "1";
END IF;
IF (STRTOREAL(libArray[i,k+3]) < 0.0) OR (STRTOREAL(libArray[i,k+3]) > 999999999.999999)
libArray[i,k+3] := "0";
END IF;
WHEN "7": {Lognormal}
IF (STRTOREAL(libArray[i,k+1]) < 0.000001) OR (STRTOREAL(libArray[i,k+1]) > 999999999.999999)
libArray[i,k+1] := "10";
END IF;
IF (STRTOREAL(libArray[i,k+2]) < 0.000001) OR (STRTOREAL(libArray[i,k+2]) > 999999999.999999)
libArray[i,k+2] := "2";
END IF;
WHEN "8":
IF (STRTOREAL(libArray[i,k+1]) < 0.0) OR (STRTOREAL(libArray[i,k+1]) > 999999999.999999)
libArray[i,k+1] := "1";
END IF;
IF (STRTOREAL(libArray[i,k+2]) < 0.000001) OR (STRTOREAL(libArray[i,k+2]) > 999999999.999999)
libArray[i,k+2] := "1";
END IF;
WHEN "9": {Uniform Integer}
IF FLOAT(TRUNC(STRTOREAL(libArray[i,k+1]))) <> STRTOREAL(libArray[i,k+1])
libArray[i,k+1] := INTTOSTR(TRUNC(STRTOREAL(libArray[i,k+1])));
END IF;
IF STRTOREAL(libArray[i,k+1]) < 0.0
libArray[i,k+1] := "0";
END IF;
IF FLOAT(TRUNC(STRTOREAL(libArray[i,k+2]))) <> STRTOREAL(libArray[i,k+2])
libArray[i,k+2] := INTTOSTR(TRUNC(STRTOREAL(libArray[i,k+2])));
END IF;
IF (STRTOREAL(libArray[i,k+2]) <= 0.0) OR (STRTOREAL(libArray[i,k+2]) > 999999999.)
libArray[i,k+1] := "1";
END IF;
IF (STRTOREAL(libArray[i,k+1])) > (STRTOREAL(libArray[i,k+2]))
libArray[i,k+1] := libArray[i,k+2];
END IF;
WHEN "10": {Uniform Real}
IF STRTOREAL(libArray[i,k+1]) < 0.0
libArray[i,k+1] := "0";
END IF;
IF (STRTOREAL(libArray[i,k+2]) <= 0.0) OR (STRTOREAL(libArray[i,k+2]) > 999999999.999999)
libArray[i,k+2] := "1";
END IF;
IF (STRTOREAL(libArray[i,k+1])) > (STRTOREAL(libArray[i,k+2]))
libArray[i,k+1] := libArray[i,k+2];
END IF;
WHEN "12": {Pearson 6}
IF (STRTOREAL(libArray[i,k+1]) < 0.000001) OR (STRTOREAL(libArray[i,k+1]) > 999999999.999999)
libArray[i,k+1] := "1";
END IF;
IF (STRTOREAL(libArray[i,k+2]) < 0.000001) OR (STRTOREAL(libArray[i,k+2]) > 999999999.999999)
libArray[i,k+2] := "1";
END IF;
IF (STRTOREAL(libArray[i,k+3]) < 0.000001) OR (STRTOREAL(libArray[i,k+3]) > 999999999.999999)
libArray[i,k+3] := "1";
END IF;
{IF (STRTOREAL(libArray[i,k+4]) < 0.0) OR (STRTOREAL(libArray[i,k+4]) > 999999999.999999)
libArray[i,k+4] := "0";
END IF;}
WHEN "13": {Poisson}
IF (STRTOREAL(libArray[i,k+1]) < 0.000001) OR (STRTOREAL(libArray[i,k+1]) > 999999999.999999)
libArray[i,k+1] := "1";
END IF;
WHEN "14": {Triangular}
IF STRTOREAL(libArray[i,k+1]) < 0.0
libArray[i,k+1] := "0";
END IF;
IF (STRTOREAL(libArray[i,k+3]) <= 0.0) OR (STRTOREAL(libArray[i,k+3]) > 999999999.999999)
libArray[i,k+3] := "999999999";
END IF;
IF (STRTOREAL(libArray[i,k+1])) >= (STRTOREAL(libArray[i,k+2]))
libArray[i,k+1] := REALTOSTR((STRTOREAL(libArray[i,k+2])/2.));
END IF;
IF (STRTOREAL(libArray[i,k+2])) >= (STRTOREAL(libArray[i,k+3]))
libArray[i,k+2] := REALTOSTR((STRTOREAL(libArray[i,k+3])/2.));
IF (STRTOREAL(libArray[i,k+1])) >= (STRTOREAL(libArray[i,k+2]))
libArray[i,k+1] := REALTOSTR((STRTOREAL(libArray[i,k+2])/2.));
END IF;
END IF;
WHEN "18": {None}
OTHERWISE
END CASE;
END FOR;
IF libVersion=6
IF (STRTOREAL(libArray[i,12]) < 0.00000) OR (STRTOREAL(libArray[i,12]) > 999999999.999999)
libArray[i,12] := "0";
END IF;
IF (STRTOREAL(libArray[i,13]) < 0.00000) OR (STRTOREAL(libArray[i,13]) > 999999999.999999)
libArray[i,13] := "0";
END IF;
ELSIF libVersion=7
IF ( (STRTOINT(libArray[i,12])<1) OR (STRTOINT(libArray[i,12])>22) )
libArray[i,12] := "0";
{ ELSE
libArray[i,12]:=STRTOINT(libArray[i,12]); } {tony}
END IF;
IF (STRTOINT(libArray[i,13]) < 1) OR (STRTOINT(libArray[i,13]) > 22)
libArray[i,13] := "0";
{ ELSE
libArray[i,13]:=STRTOINT(libArray[i,13]); }
END IF;
END IF;
END FOR;
IF blankLines
NEW(message, 1..2);
message[1] := "There were lines in the file which began with ";
message[2] := "blank characters. Those lines were not used. ";
result := SendAlert(message, FALSE, FALSE, TRUE);
DISPOSE(message);
END IF;
ELSE
success := TRUE;
NEW(message, 1..2);
message[1] := "There are no valid blocks in the selected file. ";
message[2] := "Make sure this file contains text numbers. ";
result := SendAlert(message, FALSE, FALSE, FALSE);
DISPOSE(message);
RETURN;
END IF;
ASK tempStrm TO Close;
DISPOSE(tempStrm);
DISPOSE(tempName);
DISPOSE(tempLib);
END PROCEDURE; {ReadLib}
PROCEDURE FEVOpenFile;
VAR
filter, nameOfFile, pathName : STRING;
message : TextBufferType;
BEGIN
filter := "*.txt";
NEW(message,1..2);
NEW(FEVStream);
SaveAsFile(nameOfFile, pathName, filter, "FEV Data File");
IF nameOfFile = "NoFile"
DISPOSE(FEVStream);
ELSE
ASK FEVStream TO Open(pathName + nameOfFile, Output);
IF FEVStream.ioResult <> 0
message[1]:="The file "+nameOfFile+" could not be opened! ";
message[2]:="It is already open, is set to read-only, or is corrupted! ";
result:=SendAlert(message,FALSE, FALSE, TRUE);
ELSE
buttItem := ASK fevToolBar Descendant("OpenFile",903);
ASK buttItem TO Deactivate;
buttItem := ASK fevToolBar Descendant("EditFile",904);
ASK buttItem TO Activate;
buttItem := ASK fevToolBar Descendant("CloseFile", 905);
ASK buttItem TO Activate;
menuItem := ASK fevMenuBar Descendant("OpenItem",101);
ASK menuItem TO SetLabel("&Close Interactive Log");
menuItem := ASK fevMenuBar Descendant("WriteItem",102);
ASK menuItem TO Activate;
END IF;
END IF;
DISPOSE(message);
END PROCEDURE; {FEVOpenFile}
PROCEDURE FEVCloseFile;
BEGIN
ASK FEVStream TO Close;
DISPOSE(FEVStream); {need to dispose of FEVStream as soon as Close for Method ShowRightClickMenu in IDisplay}
buttItem := ASK fevToolBar Descendant("OpenFile",903);
ASK buttItem TO Activate;
buttItem := ASK fevToolBar Descendant("EditFile",904);
ASK buttItem TO Deactivate;
buttItem := ASK fevToolBar Descendant("CloseFile", 905);
ASK buttItem TO Deactivate;
menuItem := ASK fevMenuBar Descendant("OpenItem",101);
ASK menuItem TO SetLabel("&Open Interactive Log...");
menuItem := ASK fevMenuBar Descendant("WriteItem",102);
ASK menuItem TO Deactivate;
END PROCEDURE; {FEVCloseFile}
PROCEDURE FEVIndicateStatus;
BEGIN
statusItem := ASK fevMenuBar Descendant("StatusItem", 302);
IF statusItem.Label() = "Hide Status Indicator"
faceBoxOpen := FALSE;
ASK statusItem TO SetLabel("Show Status Indicator");
ASK greenFace TO Erase;
ASK yellowFace TO Erase;
ASK redFace TO Erase;
ELSE
faceBoxOpen := TRUE;
ASK statusItem TO SetLabel("Hide Status Indicator");
ASK faceVisible TO Draw;
END IF;
END PROCEDURE; {FEVIndicateStatus}
PROCEDURE DisplayFailureEffects;
VAR
failEffectsBox : FailEffectsBoxObj;
BEGIN
typeOfCursor := dialogC;
NEW(failEffectsBox);
ASK failEffectsBox TO LoadFromLibrary(dialogs, "FailureEffectsBox");
ASK window TO AddGraphic(failEffectsBox);
ASK failEffectsBox TO ReceiveData;
typeOfCursor := fevC;
DISPOSE(failEffectsBox);
END PROCEDURE; {DisplayFailureEffects}
PROCEDURE SaveTables;
VAR
printTablesBox : PrintTablesBoxObj;
BEGIN
typeOfCursor := dialogC;
NEW(printTablesBox);
ASK printTablesBox TO LoadFromLibrary(dialogs, "PrintTablesBox");
ASK window TO AddGraphic(printTablesBox);
ASK printTablesBox TO SetLabel("Save .TXT Options");
ASK printTablesBox TO Draw;
ASK printTablesBox TO GetPreferences(TRUE);
DISPOSE(printTablesBox);
typeOfCursor := nilC;
END PROCEDURE;
PROCEDURE FindItem;
VAR
itemList : OptionListType;
tempString : STRING;
tempBlock : RBDBlockObj;
tempEvent : RBDEventObj;
locateBox : HelpBoxObj;
tempNode : RBDNodeObj;
tempHier : RBDHierObj;
itemCombo : ComboBoxObj;
zoomer, id, i : INTEGER;
tempX, tempY, localZoom : REAL;
BEGIN
i := 1;
{Make itemList 2 elements shorter for each hier cuz won't show in/out nodes in list}
NEW(itemList, 1..(totalObjects-(totalHiers*2)));
FOREACH tempBlock IN blockGroup
id := tempBlock.Id;
tempString := INTTOSTR(id);
IF id < 10
tempString := "00" + tempString;
ELSIF id < 100
tempString := "0" + tempString;
END IF;
itemList[i] := tempBlock.name+" Block - " + tempString;
INC(i);
END FOREACH;
FOREACH tempEvent IN eventGroup
id := tempEvent.Id;
tempString := INTTOSTR(id);
IF id < 10
tempString := "00" + tempString;
ELSIF id < 100
tempString := "0" + tempString;
END IF;
itemList[i] := tempEvent.name+" Event - " + tempString;
INC(i);
END FOREACH;
FOREACH tempNode IN nodeGroup
id := tempNode.Id;
tempString := INTTOSTR(id);
IF id < 10
tempString := "00" + tempString;
ELSIF id < 100
tempString := "0" + tempString;
END IF;
IF ((tempNode.typeNode <> 4) AND (tempNode.typeNode <> 5))
itemList[i] := tempNode.name+" Node - " + tempString;
INC(i);
END IF;
END FOREACH;
FOREACH tempHier IN hierGroup
id := tempHier.Id;
tempString := INTTOSTR(id);
IF id < 10
tempString := "00" + tempString;
ELSIF id < 100
tempString := "0" + tempString;
END IF;
itemList[i] := tempHier.name+" Hier - " + tempString;
INC(i);
END FOREACH;
ClearAllBlocks;
typeOfCursor := dialogC;
NEW(locateBox);
ASK locateBox TO LoadFromLibrary(dialogs, "LocateBox");
ASK window TO AddGraphic(locateBox);
itemCombo := ASK locateBox Child("LocateCombo", 100);
ASK itemCombo TO SetOptions(itemList);
ASK itemCombo TO ReceiveFocus;
button := ASK locateBox TO AcceptInput();
IF button.ReferenceName = "OKButton"
i := STRLEN(itemCombo.Text);
REPEAT
DEC(i);
tempString := SUBSTR(i,i,itemCombo.Text);
UNTIL tempString = "-";
zoomer := STRTOINT(SUBSTR(i+1,STRLEN(itemCombo.Text),itemCombo.Text));
block := ASK root Child("RBDBlock", zoomer);
node := ASK root Child("RBDNode", zoomer);
hier := ASK root Child("RBDHier", zoomer);
event := ASK root Child("RBDEvent", zoomer);
IF block <> NILOBJ
tempX := block.xPosition;
tempY := block.yPosition;
IF (block.parentID <> activeWindow)
IF block.parentID = 0
ChangeWindow(0, 0);
ELSE
tempHier := ASK root Child("RBDHier", block.parentID);
ChangeWindow(tempHier.Id, tempHier.level);
END IF;
END IF;
SelectBlock;
HandleLinks(TRUE);
ELSIF event <> NILOBJ
tempX := event.xPosition;
tempY := event.yPosition;
IF (event.parentID <> activeWindow)
IF event.parentID = 0
ChangeWindow(0, 0);
ELSE
tempHier := ASK root Child("RBDHier", event.parentID);
ChangeWindow(tempHier.Id, tempHier.level);
END IF;
END IF;
SelectEvent;
HandleLinks(TRUE);
ELSIF node <> NILOBJ
tempX := node.xPosition;
tempY := node.yPosition;
IF (node.parentID <> activeWindow)
IF node.parentID = 0
ChangeWindow(0, 0);
ELSE
tempHier := ASK root Child("RBDHier", node.parentID);
ChangeWindow(tempHier.Id, tempHier.level);
END IF;
END IF;
SelectNode;
HandleLinks(TRUE);
ELSIF hier <> NILOBJ;
tempX := hier.xPosition;
tempY := hier.yPosition;
IF (hier.parentID <> activeWindow)
IF hier.parentID = 0
ChangeWindow(0, 0);
ELSE
tempHier := ASK root Child("RBDHier", hier.parentID);
ChangeWindow(tempHier.Id, tempHier.level);
END IF;
END IF;
SelectHier;
HandleLinks(TRUE);
END IF;
IF currentView = "workspace"
IF activeWindow <> 0
tempHier := ASK root Child("RBDHier", activeWindow);
localZoom := tempHier.zoom;
ELSE
localZoom := cusZoomVal;
END IF;
dontChangeXY := TRUE;
SetView(localZoom, (tempX-localZoom/2.), (tempY+localZoom*13.2/40.));
dontChangeXY := FALSE;
ASK menubar TO Enable(1);
ASK menubar TO Enable2Thru6;
ASK menubar TO Enable(7);
ASK menubar TO Enable(8);
ASK menubar TO Enable(10);
END IF;
END IF;
IF currentView = "workspace"
typeOfCursor := nilC;
{ELSIF currentView = "simulation"
typeOfCursor := simC;
ELSIF currentView = "fev"
typeOfCursor := fevC;
ELSIF currentView = "weaklink"
typeOfCursor := weakC;}
END IF;
DISPOSE(locateBox);
DISPOSE(itemList);
END PROCEDURE;
PROCEDURE PrintSetup;
VAR
opSys : STRING;
pID : INTEGER;
BEGIN
opSys := GetOSType();
IF GetProgDir("control.exe") <> ""
IF POSITION(opSys, "UNICODE") > 0
IF FileExists("c:\winnt\system32\control.exe")
pID := SystemCall("c:\winnt\system32\control.exe printers",0);
ELSIF ((POSITION(GetProgDir("control.exe"),"win") > 0)
OR (POSITION(GetProgDir("control.exe"),"WIN") > 0))
pID := SystemCall(GetProgDir("control.exe")+"control.exe printers",0);
ELSE
NEW(message, 1..2);
message[1] := "Control.exe found but not in a windows directory. If the control panel ";
message[2] := "doesn't come up, the printer will have to be set outside of RAPTOR. ";
result := SendAlert(message, FALSE, FALSE, FALSE);
DISPOSE(message);
pID := SystemCall(GetProgDir("control.exe")+"control.exe printers",0);
END IF;
ELSIF POSITION(opSys, "WINDOWS") > 0
IF FileExists("c:\windows\control.exe")
pID := SystemCall("c:\windows\control.exe printers",0);
ELSIF POSITION(GetProgDir("control.exe"),"win") > 0
pID := SystemCall(GetProgDir("control.exe")+"control.exe printers",0);
ELSE
NEW(message, 1..2);
message[1] := "Control.exe found but not in a windows directory. If the control panel ";
message[2] := "doesn't come up, the printer will have to be set outside of RAPTOR. ";
result := SendAlert(message, FALSE, FALSE, FALSE);
DISPOSE(message);
pID := SystemCall(GetProgDir("control.exe")+"control.exe printers",0);
END IF;
ELSE
NEW(message, 1..1);
message[1] := "Unable to identify the operating system! Control panel not found. ";
result := SendAlert(message, FALSE, FALSE, TRUE);
DISPOSE(message);
END IF;
ELSE
NEW(message, 1..1);
message[1] := "Unable to locate the control.exe file on this hard drive! ";
result := SendAlert(message, FALSE, FALSE, TRUE);
DISPOSE(message);
END IF;
END PROCEDURE;
PROCEDURE PrintWindow;
VAR
tempBlock : RBDBlockObj;
tempEvent : RBDEventObj;
tempNode : RBDNodeObj;
tempHier : RBDHierObj;
printWinBox : PrintWinObj;
numPages : ValueBoxObj;
dirRadBox : RadioBoxObj;
landButton, porButton : RadioButtonObj;
printPages : INTEGER;
dir : STRING;
BEGIN
NEW(printWinBox);
ASK printWinBox TO LoadFromLibrary(dialogs, "PrintWinBox");
ASK window TO AddGraphic(printWinBox);
ASK printWinBox TO Draw;
numPages := ASK printWinBox Descendant("NumPages", 102);
dirRadBox := ASK printWinBox Descendant("DirRadBox", 104);
landButton := ASK printWinBox Descendant("LandButton", 1041);
porButton := ASK printWinBox Descendant("PorButton", 1042);
ASK dirRadBox TO SetSelectedButton(landButton);
ASK dirRadBox TO Draw;
button := ASK printWinBox TO AcceptInput();
IF button.ReferenceName = "OKButton"
printPages := ROUND(numPages.Value());
IF printPages < 1
printPages := 1;
END IF;
IF printPages > 20
printPages := 20;
END IF;
IF dirRadBox.SelectedButton = landButton
dir := "Landscape";
ELSE
dir := "Portrait";
END IF;
ExportRBD(TRUE, printPages, activeWindow, dir);
END IF;
END PROCEDURE;
PROCEDURE ReturnToWorkspace;
VAR
tempBlock : RBDBlockObj;
tempEvent : RBDEventObj;
tempNode : RBDNodeObj;
tempHier : RBDHierObj;
nodeImage, blockImage, eventImage, hierImage, dsi, innerSquare : ImageObj;
aoText : TextObj;
BEGIN
IF weakAnalysis OR analUp
FOREACH tempNode IN nodeGroup
nodeImage := ASK tempNode Child("Node", 602);
aoText := ASK tempNode Child("NodeAoText",0);
IF tempNode.typeNode = 2
ASK aoText TO SetText("");
ASK aoText TO SetHidden(TRUE);
ASK nodeImage TO SetColor(blockGUIColor);
ASK aoText TO Draw;
ASK nodeImage TO Draw;
ELSIF tempNode.typeNode = 3
ASK aoText TO SetText("");
ASK aoText TO SetHidden(TRUE);
ASK nodeImage TO SetColor(Black);
ASK aoText TO Draw;
ASK nodeImage TO Draw;
END IF;
END FOREACH;
FOREACH tempBlock IN blockGroup
blockImage := ASK tempBlock Child("BasicBlock", 601);
aoText := ASK tempBlock Child("BlockAoText",0);
innerSquare := ASK tempBlock Child("InnerSquare",0);
ASK aoText TO SetText("");
ASK aoText TO SetHidden(TRUE);
ASK innerSquare TO SetColor(blockGUIColor);
ASK innerSquare TO SetHidden(TRUE);
ASK blockImage TO SetColor(blockGUIColor);
ASK aoText TO Draw;
ASK blockImage TO Draw;
END FOREACH;
FOREACH tempEvent IN eventGroup
eventImage := ASK tempEvent Child("BasicBlock", 601);
aoText := ASK tempEvent Child("EventAoText",0);
innerSquare := ASK tempEvent Child("InnerSquare",0);
ASK aoText TO SetText("");
ASK aoText TO SetHidden(TRUE);
ASK innerSquare TO SetColor(blockGUIColor);
ASK innerSquare TO SetHidden(TRUE);
ASK eventImage TO SetColor(blockGUIColor);
ASK aoText TO Draw;
ASK eventImage TO Draw;
END FOREACH;
FOREACH tempHier IN hierGroup
hierImage := ASK tempHier Child("Hier", 603);
ASK hierImage TO SetColor(blockGUIColor);
aoText := ASK tempHier Child("HierAoText",0);
ASK aoText TO SetText("");
ASK aoText TO SetHidden(TRUE);
dsi:=ASK tempHier Descendant("HierMid",0);
ASK dsi TO SetColor(Black);
ASK aoText TO Draw;
ASK hierImage TO Draw;
ASK dsi TO Draw;
END FOREACH;
AoVisible := FALSE;
IF analUp AND notSimming
ShowAnalView(FALSE);
notSimming := FALSE;
END IF;
END IF;
analUp := FALSE;
returnToRBD := TRUE;
currentView := "workspace";
ClearAllBlocks;
END PROCEDURE;
PROCEDURE ViewOutputs;
VAR
tabOutBox : TablesOutObj;
BEGIN
NEW(tabOutBox);
ASK tabOutBox TO LoadFromLibrary(dialogs, "ViewOutputBox");
ASK window TO AddGraphic(tabOutBox);
ASK tabOutBox TO InitSelf(FALSE);
button := ASK tabOutBox TO AcceptInput();
DISPOSE(tabOutBox);
END PROCEDURE;
PROCEDURE ColorPrefs;
VAR
cancelled : BOOLEAN;
sysBox : SystemBoxObj;
tempBlock : RBDBlockObj;
tempEvent : RBDEventObj;
tempNode : RBDNodeObj;
tempHier : RBDHierObj;
nodeImage, blockImage : ImageObj;
aoText : TextObj;
BEGIN
NEW(sysBox);
ASK sysBox TO LoadFromLibrary(dialogs, "SystemBox");
ASK window TO AddGraphic(sysBox);
ASK sysBox TO Draw;
ASK sysBox TO GetColors(cancelled);
DISPOSE(sysBox);
IF NOT cancelled
FOREACH tempNode IN nodeGroup
ASK tempNode TO ShowAnalColor;
END FOREACH;
FOREACH tempBlock IN blockGroup
ASK tempBlock TO ShowAnalColor;
END FOREACH;
FOREACH tempEvent IN eventGroup
ASK tempEvent TO ShowAnalColor;
END FOREACH;
END IF;
END PROCEDURE
PROCEDURE UpOneLevel;
VAR
tempHier : RBDHierObj;
newId : INTEGER;
BEGIN
ClearAllBlocks
tempHier := ASK root Descendant("RBDHier", activeWindow);
newId := tempHier.parentID;
IF newId > 0
tempHier := ASK root Descendant("RBDHier", newId);
ChangeWindow(newId, hierLevel-1);
ELSE
ChangeWindow(0, 0);
END IF;
END PROCEDURE;
PROCEDURE Home;
BEGIN
ClearAllBlocks;
ChangeWindow(0, 0);
END PROCEDURE;
PROCEDURE GotoHier;
VAR
gotoHierBox : GotoHierBoxObj;
BEGIN
ClearAllBlocks;
NEW(gotoHierBox);
ASK gotoHierBox TO LoadFromLibrary(dialogs, "GotoHierBox");
ASK window TO AddGraphic(gotoHierBox);
ASK gotoHierBox TO ReceiveData;
END PROCEDURE;
PROCEDURE Step;