File: score5.doc.html

package info (click to toggle)
pact 980714-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 13,096 kB
  • ctags: 26,034
  • sloc: ansic: 109,076; lisp: 9,645; csh: 7,147; fortran: 1,050; makefile: 136; lex: 95; sh: 32
file content (1125 lines) | stat: -rw-r--r-- 51,896 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
<html><head><title></title></head>

<body>

<a name="354317">
<h1>1.0   </a>Introduction</h1>
</a>
<a name="354318">
</a>PACT is a set of tools to facilitate the development of </a>portable scientific software and to </a>visualize scientific data. As with most constructs, PACT has a foundation. In this case that foundation is SCORE.<p>
</a>
<a name="354319">
</a>SCORE (System CORE) has two main functions. The first and perhaps most important is to smooth over the differences between different </a>C implementations and define the parameters which drive most of the conditional compilations in the rest of PACT. Secondly, it contains several groups of functionality that are used extensively throughout PACT.<p>
</a>
<a name="354320">
Although C is highly standardized now, that has not always been the case. Roughly speaking C compilers fall into three categories: </a>ANSI standard; derivative of the </a>Portable C Compiler (Kernighan and Ritchie); and the rest. PACT has been successfully ported to many </a>ANSI and </a>PCC systems. It has never been successfully ported to a system in the last category. The reason is mainly that the &#147;standard&#148; C library supplied with such implementations is so far from true ANSI or PCC standard that PACT would have to include its own version of the standard C library in order to work at all.<p>
</a>
<a name="354321">
Even with standardized compilers life is not dead simple. The ANSI standard leaves several crucial points ambiguous as &#147;</a>implementation defined&#148;. Under these conditions one can find significant differences in going from one ANSI standard compiler to another.<p>
</a>
<a name="354322">
SCORE&#146;s job is to include the requisite standard </a>headers and ensure that certain key </a>standard library functions exist and function correctly (there are bugs in the standard library functions supplied with some compilers) so that, to applications which include the SCORE header(s) and load with SCORE, all C implementations look the same. This is a tall order, but in practice once SCORE has been successfully compiled only the areas of graphics, IPC, and binary data handling require special handling! This has more of an impact on some programmers than on others. Those who prefer to specify only the exact headers to be included in each source file will find SCORE and PACT unusual. At the expense of a slight increase in compile time, the most commonly used headers are always included. This is crucial to getting the C implementation independence.<p>
</a>
<a name="354323">
Typically, the SCORE header </a>scstd.h includes the following:<p>
</a>
<A NAME="354324"><PRE>   ANSI    stdlib.h stddef.h stdarg.h float.h
</PRE><A NAME="354325"><PRE>   PCC      sys/types.h varargs.h malloc.h
</PRE><A NAME="354326"><PRE>   Both     limits.h stdio.h string.h math.h ctype.h signal.h setjmp.h time.h
</PRE><a name="354327">
The single header,</a> scstd.h, smooths over most of the generic problems that arise because of implementation defined behavior in the host C implementation. The remainder of the PACT sources ultimately include </a>scstd.h. This strategy has been extremely successful for PACT and applications which use PACT.<p>
</a>
<a name="354328">
There are basically three other areas which </a>SCORE functions address: </a>memory management; </a>hash table management; and </a>extended </a>string handling.<p>
</a>
<a name="354329">
<h1>2.0   SCORE Constants</h1>
</a>
<A NAME="354793"><CENTER><B></B></CENTER><A NAME="354411"><BR><B></a>HSZSMALL = 31
</B><BR><a name="354466">
- </a>small </a>table </a>size<p>
</a>
<A NAME="354415"><BR><B></a>HSZSMINT = 67
</B><BR><a name="354667">
- </a>small intermediate table size<p>
</a>
<A NAME="354668"><BR><B></a>HSZLRINT = 127
</B><BR><a name="354676">
- </a>large intermediate table size<p>
</a>
<A NAME="354671"><BR><B></a>HSZLARGE = 521
</B><BR><a name="354677">
- </a>large table size<p>
</a>
<A NAME="354672"><BR><B></a>DOC = 1
</B><BR><a name="354678">
- </a>documentation<p>
</a>
<A NAME="354673"><BR><B></a>NODOC = 0
</B><BR><a name="354674">
- </a>no documentation<p>
</a>
<A NAME="354791"><CENTER><B></B></CENTER><A NAME="354679"><BR><B>MAX_LEX_BUFFER = 4096
</B><BR><a name="354796">
- default size of lexical token buffer<p>
</a>
<A NAME="354795"><BR><B></a>SC_WSPC_TOK = 0 
</B><BR><a name="354790">
- </a>whitespace </a>token<p>
</a>
<A NAME="354767"><BR><B></a>SC_DELIM_TOK = 1
</B><BR><a name="354792">
- </a>delimiter token<p>
</a>
<A NAME="354769"><BR><B></a>SC_IDENT_TOK = 2
</B><BR><a name="354766">
- </a>identifier token<p>
</a>
<A NAME="354770"><BR><B></a>SC_DINT_TOK = 3
</B><BR><a name="354768">
- </a>decimal integer number token<p>
</a>
<A NAME="354771"><BR><B></a>SC_REAL_TOK =  4
</B><BR><a name="354773">
- </a>decimal floating point number token<p>
</a>
<A NAME="354772"><BR><B></a>SC_OINT_TOK =  5
</B><BR><a name="354774">
- </a>octal integer number token<p>
</a>
<A NAME="354777"><BR><B></a>SC_HINT_TOK =  6
</B><BR><a name="354775">
- </a>hexidecimal integer number token<p>
</a>
<A NAME="354778"><BR><B></a>SC_OPER_TOK =  7
</B><BR><a name="354776">
- </a>operator token<p>
</a>
<A NAME="354779"><BR><B></a>SC_STRING_TOK =  8
</B><BR><a name="354783">
- </a>string token<p>
</a>
<A NAME="354780"><BR><B></a>SC_KEY_TOK =  9
</B><BR><a name="354784">
- </a>keyword token<p>
</a>
<A NAME="354781"><BR><B></a>SC_PRED_TOK =  10
</B><BR><a name="354787">
- </a>predicate </a>token<p>
</a>
<A NAME="354782"><BR><B></a>SC_CMMNT_TOK =  11
</B><BR><a name="354786">
- </a>comment token<p>
</a>
<A NAME="354788"><BR><B></a>SC_HOLLERTOK = 1000
</B><BR><a name="354785">
- </a>hollerith string token<p>
</a>
<A NAME="354789"><CENTER><B></B></CENTER><A NAME="354392"><BR><B></a>REAL = double | float
</B><BR><a name="354395">
- </a>THINK C | otherwise<p>
</a>
<A NAME="354396"><BR><B></a>HUGE_REAL = 1.0e30 | 1.0e100
</B><BR><a name="354398">
- </a>THINK C | otherwise<p>
</a>
<A NAME="354404"><BR><B></a>ERRDEV = </a>stderr
</B><BR><a name="354421">
- </a>device to dump </a>diagnostic </a>messages to<p>
</a>
<A NAME="354680"><BR><B></a>ABORT = 3
</B><BR><a name="354681">
- </a>error return flag for </a>longjmps<p>
</a>
<A NAME="354682"><BR><B></a>ERR_FREE = 2
</B><BR><a name="354683">
- </a>error free return flag for longjmps<p>
</a>
<A NAME="354684"><BR><B></a>CODE = &#147;&#147;
</B><BR><a name="354685">
- name of program using the package<p>
</a>
<A NAME="354686"><BR><B></a>VERSION = &#147;&#147;
</B><BR><a name="354794">
- version designation of CODE<p>
</a>
<a name="354386">
<p>
</a>
<a name="354675">
<h3>2.0.1   </a>scstd.h</h3>
</a>
<A NAME="354426"><BR><B></a>BINARY_MODE_R = &#147;</a>rb&#148;
</B><BR><A NAME="354432"><BR><B></a>BINARY_MODE_W = &#147;</a>wb&#148;
</B><BR><A NAME="354444"><BR><B></a>BINARY_MODE_RPLUS = &#147;</a>r+b&#148;
</B><BR><A NAME="354447"><BR><B></a>BINARY_MODE_WPLUS = &#147;</a>w+b&#148;
</B><BR><A NAME="354452"><BR><B></a>TRUE = 1
</B><BR><A NAME="354456"><BR><B></a>FALSE = 0
</B><BR><A NAME="354462"><BR><B></a>ON = 1
</B><BR><A NAME="354467"><BR><B></a>OFF = 0
</B><BR><A NAME="354479"><BR><B></a>FIXNUM = long
</B><BR><a name="354687">
- if not already defined<p>
</a>
<A NAME="354470"><BR><B></a>SMALL = 1.0e-100
</B><BR><A NAME="354474"><BR><B></a>HUGE = 1.0e100
</B><BR><A NAME="354472"><BR><B></a>HUGE_INT = </a>LONG_MAX | (1 &lt;&lt; (sizeof(long)-1)) - 1
</B><BR><a name="354688">
- if defined | otherwise<p>
</a>
<A NAME="354664"><BR><B></a>RAND_MAX = 32767.0 | 2147483647.0
</B><BR><a name="354689">
- if not already defined<p>
</a>
<A NAME="354661"><BR><B></a>MAXLINE = 200
</B><BR><a name="354690">
- if not already defined<p>
</a>
<A NAME="354475"><BR><B></a>SC_BITS_BYTE = 8
</B><BR><a name="354691">
- </a>bits per byte<p>
</a>
<A NAME="354476"><BR><B></a>SC_CHAR_I = &#145;A&#146;
</B><BR><A NAME="354649"><BR><B></a>SC_SHORT_I = &#145;B&#146;
</B><BR><A NAME="354652"><BR><B></a>SC_INTEGER_I = &#145;C&#146;
</B><BR><A NAME="354653"><BR><B></a>SC_LONG_I = &#145;D&#146;
</B><BR><A NAME="354654"><BR><B></a>SC_FLOAT_I = &#145;E&#146;
</B><BR><A NAME="354655"><BR><B></a>SC_DOUBLE_I = &#145;F&#146;
</B><BR><A NAME="354656"><BR><B></a>SC_STRING_I = &#145;G&#146;
</B><BR><A NAME="354657"><BR><B></a>SC_POINTER_I = &#145;H&#146;
</B><BR><A NAME="354658"><BR><B></a>SEEK_SET = 0
</B><BR><a name="354692">
- </a>fseek sets </a>file position relative to beginning<p>
</a>
<A NAME="354659"><BR><B></a>SEEK_CUR = 1
</B><BR><a name="354693">
- </a>fseek sets </a>file position relative to current position<p>
</a>
<A NAME="354660"><BR><B></a>SEEK_END = 2
</B><BR><a name="354694">
- </a>fseek sets </a>file position relative to end<p>
</a>
<A NAME="354663"><BR><B></a>TICKS_SECOND = 1000000 | </a>CLOCKS_PER_SEC
</B><BR><A NAME="354665"><BR><B>  | 100*</a>ZQHERTZ | </a>CLK_TCK
</B><BR><A NAME="354695"><BR><B></a>directory_delim = &#147;</a>/&#148; | &#147;</a>\\&#148; | &#147;:&#148;
</B><BR><A NAME="354666"><BR><B></a>directory_delim_c = &#145;/&#146; | &#145;\\&#146; | &#145;:&#146;
</B><BR><a name="354480">
<h1>3.0   The SCORE API</h1>
</a>
<a name="354811">
This section of the manual details the SCORE functions intended for use by C application programs. Functions here are presented in alphabetical order and are given with full ANSI C prototypes.<p>
</a>
<a name="354482">
<h2>3.1   </a>Hash Table Handling</h2>
</a>
<a name="354273">
These routines allow applications to manage multiple heterogeneous open hash tables. They form a generalized version of the hashing routines described in Kernighan and Ritchie&#146;s The C Programming Language. They are most conveniently used by a call by value language such as C.<p>
</a>
<a name="354539">
<p>
</a>
<A NAME="354289"><I>C Binding: </I>void *</a>SC_def_lookup(char *name, HASHTAB *tab)
<BR><A NAME="354330"><I>F77 Binding: </I>void *</a>schlkp(integer nc, char *name, integer tab)
<BR><A NAME="354331"><I>SX Binding: </I>
<P><a name="354486">
This function looks up the given name in the specified </a>hash table and returns an object associated with the name if one was previously installed with </a>SC_install. In contrast to </a>SC_lookup this function strips off the additional information stored in the </a>hashel associated with the name and only returns a pointer to the object member of the hashel.<p>
</a>
<a name="354489">
An ASCII string, name, and a HASHTAB *, tab are the arguments to this function.<p>
</a>
<a name="354494">
In the FORTRAN binding it is assumed that the pointer extension is present.<p>
</a>
<a name="213182">
The return value is a pointer to an object if successful or a null pointer (NULL) if there is no hashel installed under name.<p>
</a>
<a name="354495">
<p>
</a>
<A NAME="354496"><I>C Binding: </I>void </a>SC_hash_clr(HASHTAB *tab)
<BR><A NAME="354332"><I>F77 Binding: </I>integer </a>schclr(integer tab)
<BR><A NAME="354333"><I>SX Binding: </I>
<P><a name="354497">
This routine clears out a </a>hash table for possible reuse. It frees the memory allocated to the </a>hashels in the table, but does not release any other memory. This is because there is no certain knowledge about the objects installed in the table.<p>
</a>
<a name="354498">
The only argument is the HASHTAB *, tab to be cleared.<p>
</a>
<a name="354499">
There is no return value from this function.<p>
</a>
<a name="354500">
<p>
</a>
<A NAME="354501"><I>C Binding: </I>char **</a>SC_hash_dump(HASHTAB *tab, char *pattern)
<BR><A NAME="354334"><I>F77 Binding: </I>
<BR><A NAME="354335"><I>SX Binding: </I>
<P><a name="354502">
This function returns an array of the names installed in the given </a>hash table. In this way the contents of a hash table may be checked at runtime. The names are alphabetically sorted according the C library function </a>STRCMP. If the pattern specified is not null then only names matching the pattern are returned. In the </a>pattern &#145;</a>*&#146; matches any number of characters and &#145;</a>?&#146; matches any single character. Since the number of elements installed in the hash table is a part of the hash table, the length of the array can also be accessed by application programs.<p>
</a>
<a name="354503">
The arguments are the HASHTAB *, tab to be listed or dumped and an ASCII string, pattern.<p>
</a>
<a name="354504">
The return value is actually a pointer to an array of ASCII strings (which are themselves pointers to character strings).<p>
</a>
<a name="354505">
<p>
</a>
<A NAME="354506"><I>C Binding: </I>int </a>SC_hash_rem(char *name, HASHTAB *tab)
<BR><A NAME="354336"><I>F77 Binding: </I>integer </a>schrem(integer nc, char *name, integer tab)
<BR><A NAME="354357"><I>SX Binding: </I>
<P><a name="354507">
This function removes the item specified by name from the indicated </a>hash table.<p>
</a>
<a name="354508">
An ASCII string, name, and a HASHTAB *, tab are the arguments to this function.<p>
</a>
<a name="354509">
TRUE is returned if the operation is successfully carried out, and FALSE is returned otherwise.<p>
</a>
<a name="354510">
<p>
</a>
<A NAME="354511"><I>C Binding: </I>hashel *</a>SC_install(char *name, void *obj, char *type,                   
HASHTAB *tab)
<BR><A NAME="354360"><I>F77 Binding: </I>integer </a>schins(integer nc, char *name, obj, integer nt, char *type, 
integer cp,  integer tab)
<BR><A NAME="354374"><I>SX Binding: </I>
<P><a name="354512">
This function installs an object, obj, with type in the specified hashtable under the identifier, name. The procedure is an adaptation of the function described in Kernighan and Ritchie in The C Programming Language. It allows an application program to have multiple </a>hash tables simultaneously. Furthermore by including a type with the installation of an object, applications can install different types of objects in a single table and distinguish between types so that they may be handled appropriately. The type is in no way used by the hash package. It is solely for the use of the application.<p>
</a>
<a name="354513">
The given information is encoded in a structure termed a </a>hashel (</a>HASH ELement) which is installed in the specified hash table. This is the information returned by the function </a>SC_lookup. If a single type of object is installed in a hash table, the function </a>SC_def_lookup returns the object from the hashel directly and passes all responsibility to the application for keeping the types straight. Any type of data object call be installed, however it must be cast to an object pointer first. <p>
</a>
<a name="213184">
In the FORTRAN binding, the argument cp is a flag requesting that the installed object is a copy of the argument pointed to by obj. In that case, schins will allocate one item of type type and copy one such item from obj into the new space.  The new space will be installed in the hash table.<p>
</a>
<a name="354514">
Input to this function is an ASCII string, name, a pointer to the object obj to be installed, an ASCII string, type, and an HASHTAB *, tab.<p>
</a>
<a name="354515">
If successful </a>SC_install returns a pointer to the hashel which was installed in the given hash table.<p>
</a>
<a name="354516">
<p>
</a>
<A NAME="354517"><I>C Binding: </I>hashel *</a>SC_lookup(char *name, HASHTAB *tab)
<BR><A NAME="354380"><I>F77 Binding: </I>
<BR><A NAME="354436"><I>SX Binding: </I>
<P><a name="354518">
This function looks up the given name in the given </a>hash table and returns an </a>hashel associated with the name if one was previously installed with </a>SC_install. In contrast to </a>SC_def_lookup this function does not strip off any information stored in the hashel associated with the name.<p>
</a>
<a name="354519">
An ASCII string, name, and a HASHTAB *, tab are the arguments to this function.<p>
</a>
<a name="354520">
The return value is a pointer to an hashel if successful or a null pointer (NULL) if there is no hashel installed under name.<p>
</a>
<a name="354521">
<p>
</a>
<A NAME="354522"><I>C Binding: </I>HASHTAB *</a>SC_make_hash_table(int size, int docflag)
<BR><A NAME="354437"><I>F77 Binding: </I>integer </a>scmkht(integer size, integer docflag)
<BR><A NAME="354460"><I>SX Binding: </I>
<P><a name="354523">
This is the function which creates new </a>hash tables. The size of a hash table should be a prime number for greatest efficiency. For C based applications, there are four #define&#146;d sizes in the header, </a>schash.h. They are </a>HSZSMALL, </a>HSZSMINT, </a>HSZLRINT, </a>HSZLARGE (31, 67, 127, and 521 respectively).<p>
</a>
<a name="354526">
Applications can have </a>documentation with the installed objects, and for efficiency in searching a hash table for documentation a flag is provided in the hash table structure telling whether or not the objects which are installed have documentation. The predefined flags in C applications are </a>DOC and </a>NODOC (1 and 0 respectively).<p>
</a>
<a name="354527">
Two integers, size and docflag, are the input to </a>SC_make_hash_table.<p>
</a>
<a name="354528">
The return value is a HASHTAB * if successful and a null pointer (NULL) otherwise.<p>
</a>
<a name="354297">
<p>
</a>
<A NAME="354292"><I>C Binding: </I>void </a>SC_rl_hash_table(HASHTAB *tab)
<BR><A NAME="354465"><I>F77 Binding: </I>integer </a>scrlht(integer tab)
<BR><A NAME="354592"><I>SX Binding: </I>
<P><a name="354293">
</a>Release the space previously allocated for the specified </a>hash table by </a>SC_make_hash_table. Call </a>SC_hash_clr first to release the space associated with hash elements.<p>
</a>
<a name="354812">
<h2>3.2   </a>Lexical Stream Handling</h2>
</a>
<a name="354463">
The following routines assist code developers with integrating automatically generated </a>lexical scanners into their applications and controlling them. The </a>SC_lexical_stream structure encapsulates the lexical scanner, the I/O stream, and various buffers so that applications can apply arbitrarily many lexical scanners to any number of input streams. The </a>SC_lexical_token describes a lexical token for parsers and other applications.<p>
</a>
<a name="354459">
<p>
</a>
<A NAME="354800"><I>C Binding: </I>void </a>SC_close_lexical_stream(SC_lexical_stream *str)
<BR><A NAME="354542"><I>F77 Binding: </I>integer </a>scclls(integer strid)
<BR><A NAME="354541"><I>SX Binding: </I>
<P><a name="354535">
This function closes the given </a>lexical stream.  Closing the lexical stream means closing the I/O stream if it is not stdin and releasing the buffer spaces as well as the SC_lexical_stream itself.<p>
</a>
<a name="354810">
This function takes str, a pointer to the </a>SC_lexical_stream, as argument.<p>
</a>
<a name="354813">
This function has no return value.<p>
</a>
<A NAME="354819"><B>SEE ALSO: </B>SC_open_lexical_stream, SC_get_next_lexical_token, SC_scan.
<BR><a name="354487">
<p>
</a>
<A NAME="354488"><I>C Binding: </I>SC_lexical_token *</a>SC_get_next_lexical_token(SC_lexical_stream 
*str)
<BR><A NAME="354593"><I>F77 Binding: </I>
<BR><A NAME="354594"><I>SX Binding: </I>
<P><a name="354543">
This function permits applications to view an input stream as a sequence of tokens returned by the </a>lexical scanner bound in an </a>SC_lexical_stream.  It returns one token at a time until the end of the stream is encountered when NULL is returned. The function handles all reads of the </a>input stream.<p>
</a>
<a name="354491">
The argument to this function is: str, a pointer to a </a>SC_lexical_stream.<p>
</a>
<a name="354492">
A pointer to an </a>SC_lexical_token is returned or NULL if the end of the input stream has been reached.<p>
</a>
<A NAME="354493"><B>SEE ALSO: </B>SC_open_lexical_stream, SC_close_lexical_stream, SC_scan.
<BR><a name="354524">
<p>
</a>
<A NAME="354525"><I>C Binding: </I>SC_lexical_stream *</a>SC_open_lexical_stream(char *name, int inbfsz, 
int strbfsz, PFInt scan, PFInt input, PFInt output, PFInt 
unput, PFInt wrap, PFInt more, PFInt less)
<BR><A NAME="354490"><I>F77 Binding: </I>integer </a>scopls(integer nchr, char *name, integer inbs, integer strbs, 
integer function scan)
<BR><A NAME="354595"><I>SX Binding: </I>
<P><a name="354536">
This function initializes a new </a>lexical stream and returns a pointer to it. A lexical stream consists of: an input buffer; a string buffer for tokens; an output buffer for text not handled by the lexical scanner; an SC_lexical_token buffer; a lexical scanning function produced by a tool such as </a>FLEX or </a>LEX; and additional integer valued functions (some optional) to support the flexibility of the lexical scanner.<p>
</a>
<a name="354537">
The main attempt here is to encapsulate the functions and data structures necessary to support an application in the use of multiple independent lexical scanners.  Such capability can be used in conjunction with parsers or other applications where some sort of input language must be broken down into proper sized pieces.<p>
</a>
<a name="354538">
The arguments are: name, the name of a file to attach to the lexical stream or NULL for stdin; inbfsz, the integer byte size of the input buffer or </a>MAXLINE if 0; strbfsz, the integer byte size of string buffer or </a>MAX_LEN_BUFFER if 0; scan, the lexical scanning function to be used (for example yylex); input, the single character supply function for the scanner  (defaults to  </a>SC_lex_getc if NULL); output, the single character output function for the scanner (defaults to  </a>SC_lex_putc if NULL); unput, a function which pushes a single character at a time back onto the input stream (defaults to  </a>SC_lex_push if NULL); wrap, a function which handles end of input conditions for the scanner (defaults to  </a>SC_lex_wrap if NULL); more, a function to process more input for the scanner if required by the associated lexical rules; and less, a function to back up the input stream if required by the lexical scanner.<p>
</a>
<a name="354546">
In the C binding, this function returns a non-NULL pointer to a newly allocated </a>SC_lexical_stream if successful and NULL if not. In the FORTRAN binding, this function returns a non-negative  integer identifier for the lexical stream if successful and -1 otherwise.<p>
</a>
<A NAME="354540"><B>SEE ALSO: </B>SC_close_lexical_stream, SC_scan, SC_get_next_lexical_token.
<BR><a name="354481">
<p>
</a>
<A NAME="354545"><I>C Binding: </I>
<BR><A NAME="354547"><I>F77 Binding: </I>integer </a>scrdls(integer strid, integer nc, char *s)
<BR><A NAME="354552"><I>SX Binding: </I>
<P><a name="354548">
This function reads a line from the specified lexical stream&#146;s input stream  into its input buffer.<p>
</a>
<a name="354549">
The arguments to this function are: strid, an integer identifier specifying the lexical stream as returned by </a>scopls; nc, an integer size of the character array s; s, a character array for the contents of the input buffer to be returned to the application.<p>
</a>
<a name="354550">
This function returns the specified number of characters via the supplied character array. The return value is TRUE if successful and FALSE otherwise.<p>
</a>
<A NAME="354551"><B>SEE ALSO: </B>scopls, scclls, scrdls.
<BR><a name="354544">
<p>
</a>
<A NAME="354529"><I>C Binding: </I>int </a>SC_scan(SC_lexical_stream *str, int rd)
<BR><A NAME="354556"><I>F77 Binding: </I>integer </a>scscan(integer strid,  integer mxtok, integer width, char *tok, 
integer ntok, integer nctok, integer ixtok, integer toktyp, 
REAL tokval)
<BR><A NAME="354565"><I>SX Binding: </I>
<P><a name="354566">
This function scans the current input buffer in the specified </a>lexical stream and returns arrays of tokens.<p>
</a>
<a name="354530">
 The</a> lexical rules are defined by the routine attached to the lexical stream when it is opened. However a default set of rules implements a FORTRANish syntax.<p>
</a>
<a name="354567">
 The string to be scanned is contained in the lexical stream. A call to </a>scrdls can be made to read a new line of text from the input stream into the input buffer, otherwise the current contents of the input buffer will be scanned.<p>
</a>
<a name="354568">
The default scanner, </a>f77lxr, defines the following </a>token types:<p>
</a>
<A NAME="354569"><PRE>   TYPE	NAME		EXAMPLE
</PRE><A NAME="354570"><PRE>   1	</a>DELIMITER		&amp; ( ) , : &lt; = &gt; _ |
</PRE><A NAME="354571"><PRE>   2	</a>ALPHANUM		abc
</PRE><A NAME="354572"><PRE>   3	</a>INTEGER		10
</PRE><A NAME="354573"><PRE>   4	</a>REAL		1.2 6.0e10
</PRE><A NAME="354574"><PRE>   5	</a>OCTAL		17b
</PRE><A NAME="354575"><PRE>   6	</a>HEX		#17
</PRE><A NAME="354576"><PRE>   7	</a>OPERAND		.and.
</PRE><A NAME="354577"><PRE>   8	</a>STRING		&#147;foo&#148;
</PRE><A NAME="354578"><PRE>   1000	</a>HOLLERITH		3hFOO
</PRE><a name="354531">
Invoke the lexical scanner to traverse the current input buffer and identify the lexical tokens as defined by the lexical rules which generated the scanner.  These are placed in a buffer of SC_lexical_tokens.<p>
</a>
<a name="354532">
The other arguments to this function are: str, a pointer to a SC_lexical_stream; rd, an integer flag; mxtok, and integer maximum number of tokens to be returned; width, an integer character field width (e.g. char*8 =&gt; 8); tok, character array char*width(mxtok) for returned tokens; ntok, an integer count of </a>tokens available; nctok, an integer character length of each token; ixtok, an integer index in tok for each token; toktyp, type for each token; and tokval, an array of REAL numerical values for numerical tokens.<p>
</a>
<a name="354580">
If the rd argument it TRUE an new line is read from the input stream into the input buffer before it is scanned. <p>
</a>
<a name="354533">
In the C binding this function returns the number of lexical tokens found in the current input buffer. In the FORTRAN binding this function returns TRUE if successful and FALSE otherwise.<p>
</a>
<A NAME="354534"><B>SEE ALSO: </B>SC_open_lexical_stream, SC_close_lexical_stream, 
SC_get_next_lexical_token.
<BR><a name="354799">
<p>
</a>
<a name="354815">
<h2>3.3   </a>Association List Handling</h2>
</a>
<a name="354596">
Association lists are similar to hash tables in that they associate a key (in this case an ASCII string) with a &#147;value&#148;.  They differ from hash tables in that the elements are chained together in a linked list instead of being organized in a hashed table. The principle advantage of association lists is lower memory overhead. The disadvantage is the relative inefficiency of checking each key until a match is found. The application developer must decide.<p>
</a>
<a name="354613">
<p>
</a>
<A NAME="354597"><I>C Binding: </I>pcons *</a>SC_change_alist(pcons *al, char *name, char *type, void *val)
<BR><A NAME="354602"><I>F77 Binding: </I>integer </a>scchal(integer al, integer nn, char *pname, integer nt, char 
*ptype, integer nv,  val)
<BR><A NAME="354603"><I>SX Binding: </I>
<P><a name="354598">
This routine changes the value associated with name on the specified association list. If there is no value associated with the name key then the value is added to the list under the name.  Because of this property is is permissible to pass a NULL association list into this function. In this way association list can be built up without explicitly creating them. It also means that the return list may not have the same address as the input list and consequently the return list must be used in all future calls to these routines.<p>
</a>
<a name="354618">
The other arguments are: type, an ASCII string specifying the data type of the values(s) being added to the list (arrays may be used as values!); val, a pointer to the values to be added to the list; and, in FORTRAN, nv, the number of values to be added.  In the C binding val must have been dynamically allocated with </a>MAKE, </a>MAKE_N, or </a>SC_alloc.<p>
</a>
<a name="354614">
<p>
</a>
<A NAME="354604"><I>C Binding: </I>pcons *</a>SC_rem_alist(pcons *al, char *name)
<BR><A NAME="354612"><I>F77 Binding: </I>integer </a>scrmal(integer al, integer nn, char *name)
<BR><A NAME="354611"><I>SX Binding: </I>
<P><a name="354599">
Removes the named element from the association list, al. Because the specified element may be the first on the list, the modified list is returned and must be used in all future calls to these functions!<p>
</a>
<a name="354615">
<p>
</a>
<A NAME="354605"><I>C Binding: </I>void </a>SC_free_alist(pcons *al, int level)
<BR><A NAME="354610"><I>F77 Binding: </I>integer </a>scrlal(integer al, integer level)
<BR><A NAME="354609"><I>SX Binding: </I>
<P><a name="354600">
Free the specified association list, al. The level argument refers to how much information is to be released. If level is 1 the only the name key is released; if level is 2 only the value is released; and if level is 3 both are released.<p>
</a>
<a name="213328">
<p>
</a>
<A NAME="213330"><I>C Binding: </I>pcons *</a>SC_copy_alist(pcons *al)
<BR><A NAME="213332"><I>F77 Binding: </I>integer </a>sccpal(integer al)
<BR><A NAME="213333"><I>SX Binding: </I>
<P><a name="213334">
This routine returns a copy of the given association list if successful.<p>
</a>
<a name="213338">
<p>
</a>
<A NAME="213370"><I>C Binding: </I>pcons *</a>SC_append_alist(pcons *al1, pcons *al2)
<BR><A NAME="213372"><I>F77 Binding: </I>  
<BR><A NAME="213373"><I>SX Binding: </I>
<P><a name="213344">
This routine copies the contents of association list al2  to association list al1. As always a NULL list for al1 or al2 is acceptable. The modified assocation list al1 is returned if successful.<p>
</a>
<a name="354617">
<p>
</a>
<a name="354816">
<h2>3.4   </a>String Handling</h2>
</a>
<a name="354304">
The string handling routines in </a>SCORE provide functionality which extends or supplements that available from the </a>standard </a>C </a>library.<p>
</a>
<a name="354305">
<h3>3.4.1   </a>Predicates</h3>
</a>
<a name="354619">
The functions test strings for specific properties and return TRUE or FALSE depending on the outcome.<p>
</a>
<a name="354639">
<p>
</a>
<A NAME="354306"><I>C Binding: </I>int </a>SC_numstrp(char *s)
<BR><a name="354307">
Return TRUE iff the string is a valid representation of a a </a>number.<p>
</a>
<a name="354620">
<p>
</a>
<A NAME="354308"><I>C Binding: </I>int </a>SC_intstrp(char *s, int base)
<BR><a name="354378">
Return TRUE iff the string is a valid representation of an </a>integer in the specified base.<p>
</a>
<a name="354621">
<p>
</a>
<A NAME="354379"><I>C Binding: </I>int </a>SC_fltstrp(char *s)
<BR><a name="354394">
Return TRUE iff the string is a valid representation of a </a>floating point number.<p>
</a>
<a name="354622">
<p>
</a>
<A NAME="354407"><I>C Binding: </I>int </a>SC_chrstrp(char *s)
<BR><a name="354408">
Return TRUE iff the string contain </a>printable </a>characters only.<p>
</a>
<a name="354623">
<p>
</a>
<A NAME="354410"><I>C Binding: </I>int </a>SC_blankp(char *string1, char *string2)
<BR><a name="354412">
Return TRUE iff string1 is  </a>blank or a </a>comment. A </a>comment begins with a character in string2 followed by a blank, tab, or end of line.<p>
</a>
<a name="354640">
<p>
</a>
<a name="354413">
<h3>3.4.2   </a>Pattern </a>Matching</h3>
</a>
<a name="354624">
These functions do certain patterm matching operations.<p>
</a>
<a name="354641">
<p>
</a>
<A NAME="354414"><I>C Binding: </I>char *</a>SC_strstr(char *string1, char *string2)
<BR><a name="354416">
</a>Find the </a>first occurrence of string2 in string1.<p>
</a>
<a name="354625">
<p>
</a>
<A NAME="354417"><I>C Binding: </I>char *</a>SC_strstri(char *string1, char *string2)
<BR><a name="354418">
</a>Find the </a>first </a>case insensitive occurrence of string2 in string1.<p>
</a>
<a name="354626">
<p>
</a>
<A NAME="354419"><I>C Binding: </I>char *</a>SC_str_replace(char *s, char * patto, char * pattn)
<BR><a name="354420">
</a>Replace all non-overlapping occurrences of patto in string s with pattn.<p>
</a>
<a name="354627">
<p>
</a>
<A NAME="354422"><I>C Binding: </I>int </a>SC_regx_match(char *s, char *patt)
<BR><a name="354423">
</a>Match string s against </a>regular expression patt. &#145;</a>*&#146; matches any number of characters. &#145;</a>?&#146; matches any single character.<p>
</a>
<a name="354642">
<p>
</a>
<a name="354424">
<h3>3.4.3   </a></a>String </a>Sorting</h3>
</a>
<a name="354628">
These functions are involved in sorting operations on strings.<p>
</a>
<a name="354643">
<p>
</a>
<A NAME="354425"><I>C Binding: </I>void </a>SC_string_sort(char **s, int number)
<BR><a name="354427">
</a>Sort an array of character pointers by what they point to. The arguments are: s, an array of pointers to ASCII strings, and number, the number of strings.<p>
</a>
<a name="354428">
<p>
</a>
<a name="354431">
<h3>3.4.4   </a>String Operations Involving </a>Case</h3>
</a>
<a name="354429">
These functions are used in connection with the case of the characters in strings.<p>
</a>
<a name="354644">
<p>
</a>
<A NAME="354433"><I>C Binding: </I>int </a>SC_str_icmp(char *s, char *t)
<BR><a name="354434">
</a>Compare two strings ignoring </a>case.<p>
</a>
<a name="354430">
<p>
</a>
<A NAME="354435"><I>C Binding: </I>char *</a>SC_str_upper(char *s)
<BR><a name="354438">
</a>Convert a string to all </a>uppercase.<p>
</a>
<a name="354629">
<p>
</a>
<A NAME="354439"><I>C Binding: </I>char *</a>SC_str_lower(char *s)
<BR><a name="354440">
</a>Convert a string to all </a>lowercase.<p>
</a>
<a name="354630">
<p>
</a>
<a name="354441">
<h3>3.4.5   </a>Tokenizers</h3>
</a>
<a name="354632">
These functions supplement the string tokenizing capability of the standard C library.<p>
</a>
<a name="354645">
<p>
</a>
<A NAME="354442"><I>C Binding: </I>char *</a>SC_firsttok(char *s, char *delim)
<BR><a name="354445">
</a>Find the </a>first </a>token in a string.<p>
</a>
<a name="354631">
<p>
</a>
<A NAME="354446"><I>C Binding: </I>char *</a>SC_firsttokq(char *s, char *delim, char *quote)
<BR><a name="354448">
</a>Find the </a>first </a>token or </a>quoted </a>token string  in a string.<p>
</a>
<a name="354638">
<p>
</a>
<A NAME="354449"><I>C Binding: </I>char *</a>SC_lasttok(char *s, char *delim)
<BR><a name="354450">
</a>Find the </a>last </a>token in a string.<p>
</a>
<a name="354646">
<p>
</a>
<a name="354451">
<h3>3.4.6   </a>Other </a>String Operations</h3>
</a>
<a name="354637">
These additional string operations do not fitt into any of the above categories.<p>
</a>
<a name="354647">
<p>
</a>
<A NAME="354453"><I>C Binding: </I>char *</a>SC_strrev(char *s)
<BR><a name="354454">
</a>Reverse a string in place.<p>
</a>
<a name="354636">
<p>
</a>
<A NAME="354455"><I>C Binding: </I>int </a>SC_char_count(char *s, int c)
<BR><a name="354457">
</a>Count the occurrences of a specified character in a string.<p>
</a>
<a name="354635">
<p>
</a>
<A NAME="354458"><I>C Binding: </I>char *</a>SC_squeeze_blanks(char *s)
<BR><a name="354278">
</a>Replace contiguous </a>blanks in a stirng with a single blank and </a>remove leading and trailing blanks.<p>
</a>
<a name="354817">
<h2>3.5   </a>Time and Date Handling</h2>
</a>
<a name="354354">
The SCORE routines dealing with time and date are provided mainly for true portability and standardization.<p>
</a>
<a name="354634">
<p>
</a>
<A NAME="354391"><I>C Binding: </I>double </a>SC_cpu_time(void)
<BR><A NAME="354399"><I>F77 Binding: </I>
<BR><A NAME="354650"><I>SX Binding: </I>
<P><a name="354651">
Return the combined user and system processor time in seconds and microseconds consumed since the first call to SC_cpu_time. Most systems limit actual time resolution to 0.01 seconds to reduce overhead.<p>
</a>
<a name="354662">
<p>
</a>
<A NAME="354805"><I>C Binding: </I>double SC_wall_clock_time(void)
<BR><A NAME="354806"><I>F77 Binding: </I>
<BR><A NAME="354807"><I>SX Binding: </I>
<P><a name="354808">
Return the wall clock time in seconds and microseconds since the first call to SC_wall_clock_time. Most systems limit actual time resolution to 0.01 seconds to reduce overhead.<p>
</a>
<a name="354809">
<p>
</a>
<A NAME="354400"><I>C Binding: </I>char *</a>SC_date(void)
<BR><A NAME="354669"><I>F77 Binding: </I>
<BR><A NAME="354670"><I>SX Binding: </I>
<P><a name="354401">
Get the time and date. This is a guaranteed to work version of the standard C library function </a>ctime.<p>
</a>
<a name="354818">
<h2>3.6   </a>Memory Management</h2>
</a>
<a name="354294">
The following is a summary of routines which constitute a simple, fast, and small layer of memory management on top of the standard C library routines. It was originally implemented to allow </a>PDBLib be able to trace down layers of </a>indirections and write out arbitrary data structures, but it can also be used to do such things as </a>array </a>bounds checking on </a>dynamically allocated arrays when routines have no other knowledge of a space than the pointer to it.<p>
</a>
<a name="354696">
<p>
</a>
<A NAME="354295"><I>C Binding: </I>int </a>SC_arrlen(void *ptr)
<BR><A NAME="354697"><I>F77 Binding: </I>integer </a>scalen(pointer ptr)
<BR><A NAME="354698"><I>SX Binding: </I>
<P><a name="354389">
Given a pointer to space allocated with </a>SC_alloc or </a>SC_realloc extract the number of bytes to which the pointer points and return it.WARNING: this function can fail to recognize the presence of a pointer allocated statically or with </a>malloc, </a>calloc, or </a>realloc! The FORTRAN binding is intended for use in FORTRAN implementations which support the pointer extension.<p>
</a>
<a name="354299">
The number of bytes pointed to by ptr is returned if successful, and -1 if not.<p>
</a>
<a name="354298">
<p>
</a>
<A NAME="354300"><I>C Binding: </I>void *</a>SC_alloc(long nitems, long bytepitem)
<BR><A NAME="354699"><I>F77 Binding: </I>                               use scmake
<BR><A NAME="354700"><I>SX Binding: </I>                memory management is automatic
<P><a name="354301">
</a>Allocate a new space in memory nitems x bytepitem long and return a pointer to it. The arguments are: nitems, the number of items (e.g. floats); and bytepitem, the number of bytes per item.<p>
</a>
<a name="354310">
Returns a non-NULL pointer to a newly allocated space if successful and NULL if not. The pointer should be </a>cast to the appropriate type in C.<p>
</a>
<a name="354302">
<p>
</a>
<A NAME="354311"><I>C Binding: </I>int </a>SC_free(void *ptr)
<BR><A NAME="354303"><I>F77 Binding: </I>                                 use scfree
<BR><A NAME="354701"><I>SX Binding: </I>                memory management is automatic
<P><a name="354312">
</a>Release the space pointed to by ptr.  Returns TRUE if successful, FALSE otherwise.<p>
</a>
<a name="354371">
<p>
</a>
<A NAME="354315"><I>C Binding: </I>int </a>SC_mem_trace(void)
<BR><A NAME="354313"><I>F77 Binding: </I>integer </a>scmemt(void)
<BR><A NAME="354314"><I>SX Binding: </I>
<P><a name="354316">
Return the </a>number of </a>chunks of memory being managed or an error condition.<p>
</a>
<a name="354337">
Return -1 if the forward and backward counts differ, -2 if a NULL pointer occurs in the chain, -3 if the link count exceeds the number of blocks; otherwise return the number of chunks of memory being managed.<p>
</a>
<a name="354340">
<p>
</a>
<A NAME="354341"><I>C Binding: </I>void *</a>SC_realloc(void *ptr, long nitems, long bytepitem)
<BR><A NAME="354702"><I>F77 Binding: </I>                                 use screma
<BR><A NAME="354703"><I>SX Binding: </I>                memory management is automatic
<P><a name="354342">
</a>Reallocate the space in memory associated with ptr so that it is nitems x bytepitem long and return a pointer to it. Copy the contents of the old space into the new space if necessary, but preserve the original contents pointed to. Ptr  must be a pointer to a space previously allocated by </a>SC_alloc. The other argument are: nitems, the number of items (e.g. floats); and bytepitem, the number of bytes per item.<p>
</a>
<a name="354343">
Returns a non-NULL pointer to a newly allocated space if successful and NULL if not. The pointer should be </a>cast to the appropriate type in C.<p>
</a>
<a name="354345">
<p>
</a>
<A NAME="354348"><I>C Binding: </I>char *</a>SC_strsave(char *s)
<BR><A NAME="354346"><I>F77 Binding: </I>
<BR><A NAME="354347"><I>SX Binding: </I>
<P><a name="354350">
</a>Allocate a new space in memory large enough to contain the char array s, copy its contents to the new space, and return a pointer to it. S must be a null terminated array of characters. <p>
</a>
<a name="354351">
Return a non-NULL pointer to a newly allocated space if successful and NULL if not.<p>
</a>
<a name="354355">
<p>
</a>
<A NAME="354356"><I>C Binding: </I>type *</a>MAKE(type)
<BR><A NAME="354353"><I>F77 Binding: </I>                                  use scmake
<BR><A NAME="354361"><I>SX Binding: </I>                memory management is automatic
<P><a name="354359">
</a>Allocate a new space in memory the size of type and return a pointer to it which has been </a>cast to type *.  In the C binding this is a macro and type is a primitive or derived type specifier.<p>
</a>
<a name="354923">
Returns a non-NULL pointer to a newly allocated space if successful and NULL if not.<p>
</a>
<a name="354935">
<p>
</a>
<A NAME="354363"><I>C Binding: </I>type *</a>MAKE_N(type, long ni)
<BR><A NAME="354362"><I>F77 Binding: </I>integer </a>scmake(pointer ptr, integer ni, integer bpi)
<BR><A NAME="354704"><I>SX Binding: </I>                memory management is automatic
<P><a name="354364">
</a>Allocate a new space in memory for ni items the size of  type (C) or bpi bytes each (FORTRAN) and return a pointer to it. In the C binding, which is a macro, type is a primitive or derived type specifier, and the return value is a pointer cast to type *. In the FORTRAN binding, which is intended for use in FORTRAN implementations which support the pointer extension, ptr is a pointer (e.g. ipa of pointer (ipa, a)).<p>
</a>
<a name="354365">
The C binding returns a non-NULL pointer to a newly allocated space if successful and NULL if not. The FORTRAN binding returns 1 if successful and 0 if not.<p>
</a>
<a name="354366">
<p>
</a>
<A NAME="354369"><I>C Binding: </I>type *</a>REMAKE(void *ptr, type)
<BR><A NAME="354367"><I>F77 Binding: </I>                            use screma
<BR><A NAME="354705"><I>SX Binding: </I>                memory management is automatic
<P><a name="354288">
</a>Reallocate the space in memory associated with ptr to the size of type and return a pointer to it, which has been </a>cast to type *. Copy the contents of the old space into the new space if necessary. In the C binding this is a macro and  type is a primitive or derived type specifier. <p>
</a>
<a name="354290">
Returns a non-NULL pointer to a reallocated space if successful and NULL if not.<p>
</a>
<a name="354372">
<p>
</a>
<A NAME="354381"><I>C Binding: </I>type *</a>REMAKE_N(void *ptr, type, long ni)
<BR><A NAME="354373"><I>F77 Binding: </I>integer </a>screma(pointer ptr, integer ni, integer bpi)
<BR><A NAME="354296"><I>SX Binding: </I>                memory management is automatic
<P><a name="213269">
</a>Reallocate the space in memory associated with ptr to be ni items the size of  type (C) or bpi bytes each (FORTRAN) and return a pointer to it. Copy the contents of the old space into the new space if necessary. In the C binding, which is a macro, type is a primitive or derived type specifier, and the returned pointer is cast to type *. The FORTRAN binding  is intended for use in FORTRAN implementations which support the pointer extension.<p>
</a>
<a name="213259">
The C binding returns a non-NULL pointer to a reallocated space if successful and NULL if not. The FORTRAN binding returns 1 if successful and 0 if not.<p>
</a>
<A NAME="354388"><I>C Binding: </I>void </a>SFREE(void *ptr)
<BR><A NAME="354402"><I>F77 Binding: </I>integer </a>scfree(pointer ptr)
<BR><A NAME="354403"><I>SX Binding: </I>                memory management is automatic
<P><a name="354405">
</a>Release the space pointed to by ptr. The FORTRAN binding is intended for use in FORTRAN implementations which support the pointer extension and always returns 1.<p>
</a>
<a name="354925">
<p>
</a>
<A NAME="354338"><I>C Binding: </I>int </a>SC_zero_space(int flag)
<BR><A NAME="354382"><I>F77 Binding: </I>integer </a>sczrsp(integer flag)
<BR><A NAME="354385"><I>SX Binding: </I>                            not applicable
<P><a name="354387">
If flag is non-zero, memory will be zeroed out when allocated and when released.  The latter is useful (in spite of the overhead) in order to spot the situation where space is freed when more than one pointer points to it.  The default is for space to be zeroed out.<p>
</a>
<a name="354936">
Returns the old value of the flag.<p>
</a>
<a name="354406">
<h2>3.7   Miscellaneous Routines</h2>
</a>
<a name="354339">
<h3>3.7.1   </a>Bit Level Manipulations</h3>
</a>
<a name="354291">
<p>
</a>
<A NAME="354344"><I>C Binding: </I>int </a>SC_bit_count(long c, int n)
<BR><A NAME="354390"><I>F77 Binding: </I>
<BR><A NAME="354707"><I>SX Binding: </I>
<P><a name="354349">
</a>Count the </a>number of </a>set </a>bits in the specified number of bytes of a given long.<p>
</a>
<a name="354708">
<p>
</a>
<A NAME="354358"><I>C Binding: </I>unsigned int </a>SC_bit_reverse(unsigned int i, int n)
<BR><A NAME="354710"><I>F77 Binding: </I>
<BR><A NAME="354711"><I>SX Binding: </I>
<P><a name="354368">
</a>Reverse the specified number of </a>bits of a given unsigned int.<p>
</a>
<a name="354709">
<p>
</a>
<a name="354375">
<h3>3.7.2   </a>Numeric </a>Conversion</h3>
</a>
<a name="354712">
<p>
</a>
<A NAME="354376"><I>C Binding: </I>int </a>SC_stoi(char *s)
<BR><A NAME="354713"><I>F77 Binding: </I>
<BR><A NAME="354714"><I>SX Binding: </I>
<P><a name="354377">
</a>Convert a string to an int. Return 0 if the string is null.<p>
</a>
<a name="354715">
<p>
</a>
<A NAME="354393"><I>C Binding: </I></a>STRTOL(char *str, char **ptr, int base)
<BR><A NAME="354716"><I>F77 Binding: </I>
<BR><A NAME="354717"><I>SX Binding: </I>
<P><a name="354397">
</a>Convert a string to a long and return a pointer to any unconverted suffix. This </a>macro invokes either the standard C library function </a>strtol or the guaranteed to work SCORE equivalent.<p>
</a>
<a name="354718">
<p>
</a>
<A NAME="354409"><I>C Binding: </I>double </a>ATOF(char *s)
<BR><A NAME="354719"><I>F77 Binding: </I>
<BR><A NAME="354720"><I>SX Binding: </I>
<P><a name="354443">
</a>Convert a string to a double. This </a>macro invokes either the standard C library function </a>atof or the guaranteed to work SCORE equivalent.<p>
</a>
<a name="354721">
<p>
</a>
<A NAME="354461"><I>C Binding: </I>double </a>SC_stof(char *s)
<BR><A NAME="354722"><I>F77 Binding: </I>
<BR><A NAME="354723"><I>SX Binding: </I>
<P><a name="354464">
</a>Convert a string to a double. Return 0.0 if the string is null.<p>
</a>
<a name="354724">
<p>
</a>
<A NAME="354468"><I>C Binding: </I>double </a>STRTOD(char *nptr, char **endptr)
<BR><A NAME="354725"><I>F77 Binding: </I>
<BR><A NAME="354726"><I>SX Binding: </I>
<P><a name="354469">
</a>Convert a string to a double and return a pointer to any unconverted suffix. This </a>macro invokes either the standard C library function </a>strtod or the guaranteed to work SCORE equivalent.<p>
</a>
<a name="354727">
<p>
</a>
<a name="354471">
<h3>3.7.3   </a>Other </a>Numeric</h3>
</a>
<a name="354728">
<p>
</a>
<A NAME="354473"><I>C Binding: </I>double </a>ABS(double x)
<BR><A NAME="354729"><I>F77 Binding: </I>
<BR><A NAME="354730"><I>SX Binding: </I>
<P><a name="354477">
Return the </a>absolute value of a double.<p>
</a>
<a name="354731">
<p>
</a>
<A NAME="354478"><I>C Binding: </I></a>max(a, b)
<BR><A NAME="354732"><I>F77 Binding: </I>
<BR><A NAME="354733"><I>SX Binding: </I>
<P><a name="354483">
Return the </a>greater of the two arguments.<p>
</a>
<A NAME="354484"><I>C Binding: </I></a>min(a, b)
<BR><A NAME="354734"><I>F77 Binding: </I>
<BR><A NAME="354735"><I>SX Binding: </I>
<P><a name="354485">
Return the </a>lesser of the two arguments.<p>
</a>
<a name="354736">
<p>
</a>
<a name="354553">
<h3>3.7.4   </a>File </a>Search</h3>
</a>
<a name="354737">
<p>
</a>
<A NAME="354554"><I>C Binding: </I>int </a>SC_isfile(char *s)
<BR><A NAME="354750"><I>F77 Binding: </I>
<BR><A NAME="354751"><I>SX Binding: </I>
<P><a name="354555">
Is the string the name of an </a>existing file? <p>
</a>
<a name="354752">
<p>
</a>
<A NAME="354557"><I>C Binding: </I>int </a>SC_isfile_ascii(char *s)
<BR><A NAME="354753"><I>F77 Binding: </I>
<BR><A NAME="354754"><I>SX Binding: </I>
<P><a name="354558">
Is the string the name of an </a>existing ascii file?<p>
</a>
<a name="354755">
<p>
</a>
<A NAME="354559"><I>C Binding: </I>char *</a>SC_search_file(char **directory, char *s)</a>
<BR><A NAME="354756"><I>F77 Binding: </I>
<BR><A NAME="354757"><I>SX Binding: </I>
<P><a name="354560">
</a>Search a list of </a>directories for a </a>file and return the </a>full </a>path name if the file </a>exists.<p>
</a>
<a name="354758">
<p>
</a>
<a name="354561">
<h3>3.7.5   </a>I/O</h3>
</a>
<a name="354760">
<p>
</a>
<A NAME="354562"><I>C Binding: </I></a>PRINT
<BR><a name="354761">
<p>
</a>
<A NAME="354563"><I>C Binding: </I></a>GETLN
<BR><a name="354762">
<p>
</a>
<a name="354564">
<h3>3.7.6   </a>Interrupts</h3>
</a>
<a name="354759">
<p>
</a>
<A NAME="354579"><I>C Binding: </I>void </a>SC_init(char *msg, PFByte fnc, int sighand, PFByte sigfnc, int 
bfhand, char *bf, int bfsize)
<BR><A NAME="354764"><I>F77 Binding: </I>
<BR><A NAME="354765"><I>SX Binding: </I>
<P><a name="354582">
</a>Setup the </a>interrupt handler, </a>top level </a>longjump, and </a>output </a>buffering for an application.<p>
</a>
<a name="354581">
<p>
</a>
<A NAME="354583"><I>C Binding: </I>void </a>SC_interrupt_handler(int sig)
<BR><A NAME="354797"><I>F77 Binding: </I>
<BR><A NAME="354798"><I>SX Binding: </I>
<P><a name="354584">
</a>Handle </a>interrupts in a default sort of way.<p>
</a>
<a name="354763">
<p>
</a>
<a name="354588">
<h3>3.7.7   </a>Other</h3>
</a>
<a name="354585">
<p>
</a>
<A NAME="354589"><I>C Binding: </I>void </a>SC_banner(char *s)
<BR><A NAME="354802"><I>F77 Binding: </I>
<BR><A NAME="354803"><I>SX Binding: </I>
<P><a name="354590">
</a>Display the input string as a </a>banner on </a>stdout.<p>
</a>
<a name="354586">
<p>
</a>
<A NAME="354591"><I>C Binding: </I>void </a>SC_pause(void)
<BR><A NAME="354587"><I>F77 Binding: </I>integer </a>scpaus(void)
<BR><A NAME="354801"><I>SX Binding: </I>
<P><a name="354309">
</a>Pause until a character arrives on </a>stdin.<p>
</a>
<a name="354804">
<h1>4.0   </a>Examples</h1>
</a>
<a name="354706">
This section will illustrate the use of the SCORE functions.<p>
</a>
<a name="354814">
<h1>5.0   </a>Related </a>Documentation</h1>
</a>
<a name="354633">
</a>SCORE is one part of a collection of libraries called </a>PACT. It provides the foundation for PACT. Its functionality includes </a>memory management, </a>hash table functions, and </a>string handling support. <p>
</a>
<a name="354738">
The list of PACT Documents is:<p>
</a>
<A NAME="354739"><PRE>   PACT User&#146;s Guide, UCRL-MA-112087
</PRE><A NAME="354740"><PRE>   SCORE User&#146;s Manual, UCRL-MA-108976 Rev.1 (this document)
</PRE><A NAME="354741"><PRE>   PPC User&#146;s Manual UCRL-MA-108964 Rev.1
</PRE><A NAME="354742"><PRE>   PML User&#146;s Manual, UCRL-MA-108965 Rev.1
</PRE><A NAME="354743"><PRE>   PDBLib User&#146;s Manual, M-270 Rev.2
</PRE><A NAME="354744"><PRE>   PGS User&#146;s Manual, UCRL-MA-108966 Rev.1
</PRE><A NAME="354745"><PRE>   PANACEA User&#146;s Manual, M-276 Rev.2
</PRE><A NAME="354746"><PRE>   ULTRA II User&#146;s Manual, UCRL-MA-108967 Rev.1
</PRE><A NAME="354747"><PRE>   PDBDiff User&#146;s Manual, UCRL-MA-108975 Rev.1
</PRE><A NAME="354748"><PRE>   PDBView User&#146;s Manual, UCRL-MA-108968 Rev.1
</PRE><A NAME="354749"><PRE>   SX User&#146;s Manual, UCRL-MA-112315
</PRE><a name="354648">
<p>
</a>

<p><hr>

</body></html>