-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateDocFromXml.dbl
1435 lines (1211 loc) · 45.7 KB
/
createDocFromXml.dbl
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
import System.collections
;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.include 'INC:genxml_tokens.def'
;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;;; <summary>
;;; Create documentation file from MDU/GENXML XML file
;;; </summary>
;;; <param name="aXmlFilename">XML filename</param>
;;; <param name="aOutFilename">Otput filename</param>
;;; <param name="aInterfaceName">Optional interface name</param>
;;; <returns>
;;; 0 = ok
;;; else Synergy error number
;;; </returns>
function createDocFromXml ,i4
req in aXmlFilename ,a255 ;; XML filename
req in aOutFilename ,a255 ;; output filename
opt in aInterfaceName ,a30 ;; selected interface (or blank)
endparams
.include 'DBLDIR:synxml.def'
external function
process_interfaces ,i
endexternal
record clr
aval ,a80 ;; alpha value
endrecord
record clr_i
fstatus ,i4 ;; return status
sts ,i4 ;; status
chan ,i4 ;; Channel for XML file
dom ,D_ADDR ;; document object model id
doc ,XML_DOC_TYPE ;; document id
rootNode ,XML_DOC_TYPE ;; root id
ifaceNode ,XML_ELEMLIST_TYPE ;; list of interfaces
endrecord
proc
clear clr, ^i(clr_i)
if (aXmlFilename) then
call process_xml_file
else
fstatus = $ERR_FILSPC
freturn fstatus
;; --------------------------------------------------------------------------
process_xml_file,
sts = %xml_option('ENCODE', SYNESCAPE_UNESCAPE)
try
begin
;; create an instance of the DOM parser
dom = %xml_parser_create()
;; call the dom parser to parse the xml file
if (dom && (doc = %xml_parser_parseFile(dom, aXmlFilename))) then
begin
;; get root id for document
if(rootNode = %xml_doc_getRoot(doc)) then
begin
;; get interfaces from the xml document
ifaceNode = %xml_elem_getElementsByName(rootNode, D_XML_INTER)
end
else
clear ifaceNode
;; MUST have some interfaces
if(ifaceNode) then
begin
fstatus = %process_interfaces(ifaceNode, aOutFilename, aInterfaceName)
;; delete list of interfaces
xml_elemlist_delete(ifaceNode)
clear ifaceNode
end
else
fstatus = -1
;; delete document created by xml_parser_parsefile
xml_doc_delete(doc)
clear doc
end
else
begin
;; else return the dom parser error
xml_parser_error(dom, aval)
fstatus = -2
end
end
catch (ex, @Exception)
begin
fstatus = %error
end
finally
begin
if(dom)
begin
;; release the dom parser
xml_parser_delete(dom)
clear dom
end
end
endtry
return
endfunction
;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;; outputText mode defines
.define D_OUT_LINE -1
.define D_OUT_INDENT -2
.define D_OUT_OPEN -3
.define D_OUT_CLOSE -4
.define D_OUT_PURGE -5
;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;;; <summary>
;;; Output text with desired indentation
;;; </summary>
;;; <param name="aMode">
;;; Optional: Number of indents or
;;; D_OUT_LINE -1
;;; D_OUT_INDENT -2
;;; D_OUT_OPEN -3
;;; D_OUT_CLOSE -4
;;; D_OUT_PURGE -5
;;; </param>
;;; <param name="aText">
;;; Text to output
;;; </param>
subroutine outputText
req in aMode ,n ;; mode +ve = #indents / -ve = D_OUT_*
opt in aText ,a ;; text
endparams
literal
spaces ,a80 ,' ' ;; maximum indent
endliteral
static record
ch ,i4 ;; output channel
indentSize ,i4 ;; size of each indent (spaces)
indentMax ,i4 ;; maximum number of indents allowed
indents ,i4 ;; number of indents
endrecord
record
textLen ,i4 ;; length of aText
endrecord
proc
if(!indentSize)
begin
indentSize = 4
indentMax = %trunc(^size(spaces) / indentSize)
end
if(^passed(aText)) then
textLen = %trimz(aText)
else
textLen = 0
using aMode select
(D_OUT_LINE),
begin
if(textLen) then
begin
if(indents > 0) then
writes(ch, spaces(1:indents*indentSize) + aText(1:textLen))
else
writes(ch, aText(1:textLen))
end
else
forms(ch, 1)
end
(D_OUT_INDENT),
begin
using aText(1:1) select
('+'),
begin
if(indents < indentMax)
indents += 1
end
('-'),
begin
if(indents > 0)
indents -= 1
end
('0' thru '9'),
begin
try
begin
indents = aText(1:textLen)
if(indents > indentMax)
indents = indentMax
end
catch (ex ,@Exception)
indents = 0
endtry
end
(),
indents = 0
endusing
end
(>= 0),
begin
if(textLen)
begin
data localIndents ,i4
if(aMode > indentMax) then
localIndents = indentMax
else
localIndents = aMode
if(localIndents > 0) then
display(ch, spaces(1:localIndents*indentSize) + aText(1:textLen))
else
display(ch, aText(1:textLen))
end
end
(D_OUT_OPEN),
begin
if(ch > 0 && ch <= 1024 && %chopen(ch))
purge ch
ch = %syn_freechn()
open(ch, O, aText(1:textLen), TEMPFILE)
end
(D_OUT_CLOSE),
begin
if(ch > 0 && ch <= 1024 && %chopen(ch))
close ch
clear ch
end
(D_OUT_PURGE),
begin
if(ch > 0 && ch <= 1024 && %chopen(ch))
purge ch
clear ch
end
endusing
xreturn
endsubroutine
;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;;; <summary>
;;; Process interfaces
;;; </summary>
;;; <param name="aIfaceNode">Interface node in XML document</param>
;;; <param name="aOutFilename">Output filename</param>
;;; <param name="aInterfaceName">Optional interface name to process</param>
;;; <returns>
;;; 0 = ok
;;; else Synergy error number
;;; </returns>
function process_interfaces ,i
req in aIfaceNode ,XML_ELEMLIST_TYPE ;; list of interfaces
req in aOutFilename ,a ;; output filename
opt in aInterfaceName ,a ;; interface name
endparams
.include 'DBLDIR:synxml.def'
external function
xml_elem_getAttribute ,^val
xml_elem_getElementsByName ,^val
xml_elemlist_item ,^val
xml_elemlist_delete ,^val
xml_elemlist_count ,^val
locase ,a
getAttributeText ,a
getxfType ,a
endexternal
.define D_MAX_COMMENT_LINES 6 ;; number of comment lines in SMC
.define D_MAX_COMMENT_SIZE 50 ;; size of comment lines in SMC
literal
includeRpsStructure ,a* ,'.include "%a" REPOSITORY ,structure="%a" ,end'
includeRpsEnum ,a* ,'.include "%a" REPOSITORY ,public ENUM'
endliteral
record appParameters
indentCode ,i4 ;; number of indents for procedure division
indentParams ,i4 ;; number of indents for routine parameters
indentData ,i4 ;; number of indents for data division
offsetFieldType ,i4 ;; offset for data type (cols)
offsetComment ,i4 ;; offset for comments (cols)
sComment ,string ;; comment character(s)
sCommentDoc ,string ;; doc comment character(s)
sCommentLine ,string ;; comment line
sHandleType ,string ;; string for D_HANDLE
sArrayListNS ,string ;; string for ArrayList namespace
sDefaultParamMod ,string ;; default parameter modifier (req/opt)
sDefaultParamDir ,string ;; default parameter direction (in/out/inout)
endrecord
record clr
reqInterface ,a50 ;; required interface
interfaceName ,a50 ;; interface
retType ,a50 ;; return type
rpsName ,a30 ;; general purpose rps name field
aval ,a40 ;; alpha value
group comments ,a
comment_array ,[D_MAX_COMMENT_LINES]a D_MAX_COMMENT_SIZE
endgroup
methodType ,a10 ;; subroutine / function text
methodName ,a31 ;; method name
outbuf ,a512 ;; output buffer
endrecord
record clr_i
fstatus ,i4 ;; return status
attributes_required ,i4 ;; are attributes required
ctr ,i4 ;; counter
ctr2 ,i4 ;; counter2
ctr3 ,i4 ;; counter3
ctr4 ,i4 ;; counter4
iface ,XML_ELEM_TYPE ;; inteface id
meths ,XML_ELEMLIST_TYPE ;; list of methods for interface
meth ,XML_ELEM_TYPE ;; method id
methrs ,XML_ELEMLIST_TYPE ;; list of method results for method
methr ,XML_ELEM_TYPE ;; method id
params ,XML_ELEMLIST_TYPE ;; list of parameters for method
param ,XML_ELEM_TYPE ;; parameter id
endrecord
record
strctArray ,@System.Collections.ArrayList
enumArray ,@System.Collections.ArrayList
alphaObj ,@a
found ,boolean
outputInterface ,boolean
endrecord
proc
clear clr, ^i(clr_i)
;; the following fields (from appParameters record) can be modifed to adjust the output generated
sComment = ';; '
sCommentDoc = ';;; '
sCommentLine = ';; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
indentCode = 0
indentParams = 0
indentData = 0
offsetFieldType = 24
offsetComment = 48
sHandleType = 'D_HANDLE'
sArrayListNS = 'System.Collections'
sDefaultParamMod = 'req'
sDefaultParamDir = 'in'
;; what interface to process (or all)
if(^passed(aInterfaceName))
reqInterface = aInterfaceName
;; create output source file
outputText(D_OUT_OPEN, aOutFilename)
;; output any required namespaces
outputText(D_OUT_LINE, "import " + sArrayListNS)
;; not output any interface information (yet)
outputInterface = false
enumArray = new ArrayList()
strctArray = new ArrayList()
;; iterate through the interfaces, looking for global structures / enums
for ctr from 1 thru %xml_elemlist_count(aIfaceNode)
begin
iface = %xml_elemlist_item(aIfaceNode, ctr)
xml_elem_getAttribute(iface, D_XML_NAME, interfaceName)
if(!reqInterface || interfaceName == reqInterface)
begin
meths = %xml_elem_getElementsByName(iface, D_XML_METHOD)
if(meths)
begin
;; iterate through the methods for this interface
for ctr2 from 1 thru %xml_elemlist_count(meths)
begin
meth = %xml_elemlist_item(meths, ctr2)
call get_method_globals
end
end
;; delete method list
xml_elemlist_delete(meths)
clear meths
end
end
outputText(D_OUT_LINE) ;; blank line
call write_method_globals
clear strctArray, enumArray
outputText(D_OUT_LINE) ;; blank line
;; indent all interface code
for ctr4 from 1 thru indentCode
outputText(D_OUT_INDENT, '+')
;; iterate through the interfaces
for ctr from 1 thru %xml_elemlist_count(aIfaceNode)
begin
iface = %xml_elemlist_item(aIfaceNode, ctr)
xml_elem_getAttribute(iface, D_XML_NAME, interfaceName)
if(!reqInterface || interfaceName == reqInterface)
begin
meths = %xml_elem_getElementsByName(iface, D_XML_METHOD)
if(meths)
begin
outputInterface = true
;; iterate through the methods for this interface
for ctr2 from 1 thru %xml_elemlist_count(meths)
begin
meth = %xml_elemlist_item(meths, ctr2)
outputText(D_OUT_LINE, sCommentLine)
outputText(D_OUT_LINE) ;; blank line
call write_doc_comments
call write_delegate
outputText(D_OUT_LINE) ;; blank line
outputText(D_OUT_LINE, sCommentLine)
end
outputText(D_OUT_LINE) ;; blank line
end
;; delete method list
xml_elemlist_delete(meths)
clear meths
end
end
if(outputInterface == true) then
outputText(D_OUT_CLOSE)
else
begin
outputText(D_OUT_PURGE)
fstatus = -1
end
freturn fstatus
;; --------------------------------------------------------------------------
get_method_globals,
if(methrs = %xml_elem_getElementsByName(meth, D_XML_METHRES))
begin
methr = %xml_elemlist_item(methrs, 1)
using %locase(%getAttributeText(methr, D_XML_TYPE)) select
(D_XML_RET_ENUM),
begin
rpsName = %getAttributeText(methr, D_XML_ENUMNAME)
if(rpsName)
begin
found = 0
foreach alphaObj in enumArray
begin
if((a)alphaObj == %locase(rpsName))
found = 1
end
if(found == 0)
begin
foreach alphaObj in enumArray
begin
if((a)alphaObj < %locase(rpsName))
found += 1
end
enumArray.insert(found, (@a)%locase(rpsName))
end
end
end
endusing
end
if(params = %xml_elem_getElementsByName(meth, D_XML_PARAM))
begin
;; iterate through the parameters for this method
for ctr3 from 1 thru %xml_elemlist_count(params)
begin
param = %xml_elemlist_item(params, ctr3)
if(!param)
nextloop
using %locase(%getAttributeText(param, D_XML_TYPE)) select
(D_XML_FLD_STRUCT),
begin
rpsName = %getAttributeText(param, D_XML_STRNAME)
if(rpsName)
begin
found = 0
foreach alphaObj in strctArray
begin
if(%upcase((a)alphaObj) == %upcase(rpsName))
found = 1
end
if(found == 0)
begin
foreach alphaObj in strctArray
begin
if(%upcase((a)alphaObj) < %upcase(rpsName))
found += 1
end
strctArray.insert(found, (@a)rpsName)
end
end
end
(D_XML_FLD_ENUM),
begin
rpsName = %getAttributeText(param, D_XML_ENUMNAME)
if(rpsName)
begin
found = 0
foreach alphaObj in enumArray
begin
if(%upcase((a)alphaObj) == %upcase(rpsName))
found = 1
end
if(found == 0)
begin
foreach alphaObj in enumArray
begin
if(%upcase((a)alphaObj) < %upcase(rpsName))
found += 1
end
enumArray.insert(found, (@a)rpsName)
end
end
end
endusing
end
;; delete parameters list
xml_elemlist_delete(params)
clear params
end
return
;; --------------------------------------------------------------------------
write_method_globals,
foreach alphaObj in enumArray
begin
rpsName = (a)alphaObj
s_bld(outbuf,, includeRpsEnum, %upcase(rpsName))
outputText(D_OUT_LINE, outbuf)
end
foreach alphaObj in strctArray
begin
rpsName = (a)alphaObj
s_bld(outbuf,, includeRpsStructure, %upcase(rpsName), rpsName)
outputText(D_OUT_LINE, outbuf)
end
return
;; --------------------------------------------------------------------------
write_doc_comments,
;; process method comments
outputText(D_OUT_LINE, sCommentDoc + "<summary>")
comments = %getComments(meth)
for ctr4 from 1 thru D_MAX_COMMENT_LINES
if(comment_array[ctr4])
outputText(D_OUT_LINE, sCommentDoc + comment_array[ctr4])
outputText(D_OUT_LINE, sCommentDoc + "</summary>")
if(methrs = %xml_elem_getElementsByName(meth, D_XML_METHRES))
begin
outputText(D_OUT_LINE, sCommentDoc + "<returns>")
methr = %xml_elemlist_item(methrs, 1)
comments = %getComments(methr)
for ctr4 from 1 thru D_MAX_COMMENT_LINES
if(comment_array[ctr4])
outputText(D_OUT_LINE, sCommentDoc + comment_array[ctr4])
outputText(D_OUT_LINE, sCommentDoc + "</returns>")
end
;; process parameter comments
if(params = %xml_elem_getElementsByName(meth, D_XML_PARAM))
begin
;; iterate through the parameters for this method
for ctr3 from 1 thru %xml_elemlist_count(params)
begin
param = %xml_elemlist_item(params, ctr3)
if(!param)
nextloop
outputText(D_OUT_LINE, sCommentDoc + '<param name="' + %getAttributeText(param, D_XML_NAME) + '">')
;; process parameter comments
comments = %getComments(param)
for ctr4 from 1 thru D_MAX_COMMENT_LINES
if(comment_array[ctr4])
outputText(D_OUT_LINE, sCommentDoc + comment_array[ctr4])
outputText(D_OUT_LINE, sCommentDoc + '</param>')
end
end
outputText(D_OUT_LINE) ;; blank line
return
;; --------------------------------------------------------------------------
write_delegate,
;; {xfMethod(name="",interface="",elb="",id="",length=0,precision=0,
;; format=xfFormat.XX,cType=xfType.XX,nullable=true,encrypt=true)}
attributes_required = (interfaceName != ' ')
if(methrs = %xml_elem_getElementsByName(meth, D_XML_METHRES)) then
methodType = 'function'
else
methodType = 'subroutine'
methodName = %getAttributeText(meth, D_XML_ROUTINE)
if(methodName == ' ')
methodName = %getAttributeText(meth, D_XML_NAME)
if(attributes_required)
begin
outbuf = '{xfMethod('
outbuf = %atrim(outbuf) + 'interface="' + %atrim(interfaceName) + '"'
outbuf = %atrim(outbuf) + ',name="' + %atrim(methodName) + '"'
outbuf = %atrim(outbuf) + ',elb="' + %getAttributeText(meth, D_XML_ELB) + '"'
outbuf = %atrim(outbuf) + ',id="' + %getAttributeText(meth, D_XML_ID) + '"'
if(%locase(%getAttributeText(meth, D_XML_ENCRYPT))==D_XML_TRUE)
outbuf = %atrim(outbuf) + ',encrypt="true"'
;if(%locase(%getAttributeText(meth, D_XML_LINQ))==D_XML_TRUE)
; outbuf = %atrim(outbuf) + ',linq="true"'
;; get methodresults
if(methrs = %xml_elem_getElementsByName(meth, D_XML_METHRES))
begin
methr = %xml_elemlist_item(methrs, 1)
if(aval=%getxfType(methr))
outbuf = %atrim(outbuf) + ',cType=xfType.' + %atrim(aval)
begin
using %locase(%getAttributeText(methr, D_XML_DTFORMAT)) select
(D_XML_DT14),
outbuf = %atrim(outbuf) + ',format=xfFormat.yyyymmddhhmiss'
(D_XML_DTYYYYMMDD),
outbuf = %atrim(outbuf) + ',format=xfFormat.yyyymmdd'
(D_XML_DTYYMMDD),
outbuf = %atrim(outbuf) + ',format=xfFormat.yymmdd'
(D_XML_DTYYYYJJJ),
outbuf = %atrim(outbuf) + ',format=xfFormat.yyyyjjj'
(D_XML_DTYYJJJ),
outbuf = %atrim(outbuf) + ',format=xfFormat.yyjjj'
(D_XML_DTHHMMSS),
outbuf = %atrim(outbuf) + ',format=xfFormat.hhmmss'
(D_XML_DTHHMM),
outbuf = %atrim(outbuf) + ',format=xfFormat.hhmm'
endusing
end
end
outbuf = %atrim(outbuf) + ')}'
outputText(D_OUT_LINE, outbuf)
outputText(D_OUT_LINE) ;; blank line
end
outbuf = %atrim(methodType) + ' ' + methodName
;; get methodresults
if(methrs = %xml_elem_getElementsByName(meth, D_XML_METHRES)) then
begin
methr = %xml_elemlist_item(methrs, 1)
using %locase(%getAttributeText(methr, D_XML_TYPE)) select
(D_XML_RET_ALPHA),
retType = 'a' + %getAttributeText(methr, D_XML_SIZE)
(D_XML_RET_DEC, D_XML_RET_IMPDEC),
begin
retType = 'd' + %getAttributeText(methr, D_XML_SIZE)
if(%getAttributeText(methr, D_XML_PREC))
retType = %atrim(retType) + '.' + %getAttributeText(methr, D_XML_PREC)
end
(D_XML_RET_INT),
retType = 'i' + %getAttributeText(methr, D_XML_SIZE)
(D_XML_RET_VAL),
retType = '^val'
(D_XML_RET_STRING),
retType = 'string'
(D_XML_RET_ENUM),
retType = %getAttributeText(methr, D_XML_ENUMNAME)
endusing
ctr4 = %trim(outBuf)
if(ctr4 >= offsetFieldType) then
ctr4 += 1
else
ctr4 = offsetFieldType
outbuf = outbuf(1:ctr4) + ',' + %atrim(retType)
if(retType == '^val')
retType = 'i4'
end
else
begin
clear retType
end
outputText(D_OUT_LINE, outbuf)
outputText(D_OUT_LINE) ;; blank line
;; indent parameters
for ctr4 from 1 thru indentParams
outputText(D_OUT_INDENT, '+')
if(params = %xml_elem_getElementsByName(meth, D_XML_PARAM))
begin
;; iterate through the parameters for this method
for ctr3 from 1 thru %xml_elemlist_count(params)
begin
param = %xml_elemlist_item(params, ctr3)
if(!param)
nextloop
if(attributes_required)
begin
;; {xfParameter(name="",type=SynType.XX,length=0,precision=0,structure="",
;; format=xfFormat.XX,cType=xfType.XX,collectionType=xfCollectType.XX,
;; dataTable=true,nullable=true)}
outbuf = '{xfParameter('
if(%getAttributeText(param, D_XML_ALTNAME)) then
outbuf = %atrim(outbuf) + 'name="' + %getAttributeText(param, D_XML_ALTNAME) + '"'
else
outbuf = %atrim(outbuf) + 'name="' + %getAttributeText(param, D_XML_NAME) + '"'
using %locase(%getAttributeText(param, D_XML_TYPE)) select
(D_XML_FLD_ALPHA),
begin
;; is this an array list collection
using %locase(%getAttributeText(param, D_XML_COLLECTION)) select
(D_XML_ARRAYLIST),
outbuf = %atrim(outbuf) + ',collectionType=xfCollectType.alpha'
(D_XML_SYSAL),
begin
outbuf = %atrim(outbuf) + ',collectionType=xfCollectType.alpha'
& + ',length=' + %getAttributeText(param, D_XML_SIZE)
end
endusing
end
(D_XML_FLD_DEC, D_XML_FLD_IMPDEC),
begin
;; is this an array list collection
using %locase(%getAttributeText(param, D_XML_COLLECTION)) select
(D_XML_ARRAYLIST),
outbuf = %atrim(outbuf) + ',collectionType=xfCollectType.decimal'
(D_XML_SYSAL),
begin
outbuf = %atrim(outbuf) + ',collectionType=xfCollectType.decimal'
& + ',length=' + %getAttributeText(param, D_XML_SIZE)
end
endusing
end
(D_XML_FLD_INT),
begin
using %locase(%getAttributeText(param, D_XML_COLLECTION)) select
(D_XML_ARRAYLIST),
outbuf = %atrim(outbuf) + ',collectionType=xfCollectType.integer'
(D_XML_SYSAL),
begin
outbuf = %atrim(outbuf) + ',collectionType=xfCollectType.integer'
& + ',length=' + %getAttributeText(param, D_XML_SIZE)
end
endusing
end
(D_XML_FLD_STRUCT),
begin
outbuf = %atrim(outbuf) + ',structure="' + %getAttributeText(param, D_XML_STRNAME) + '"'
;; is this an array list collection
using %locase(%getAttributeText(param, D_XML_COLLECTION)) select
(D_XML_ARRAYLIST),
outbuf = %atrim(outbuf) + ',collectionType=xfCollectType.structure'
(D_XML_SYSAL),
outbuf = %atrim(outbuf) + ',collectionType=xfCollectType.structure'
endusing
;; is this an data table
using %getAttributeText(param, D_XML_DATATABLE) select
(D_XML_TRUE),
outbuf = %atrim(outbuf) + ',dataTable=true'
(D_XML_FALSE),
outbuf = %atrim(outbuf) + ',dataTable=false'
endusing
end
(D_XML_FLD_STRING),
begin
;; is this an array list collection
using %locase(%getAttributeText(param, D_XML_COLLECTION)) select
(D_XML_ARRAYLIST),
outbuf = %atrim(outbuf) + ',collectionType=xfCollectType.string'
(D_XML_SYSAL),
outbuf = %atrim(outbuf) + ',collectionType=xfCollectType.string'
(),
outbuf = %atrim(outbuf) + ',type=SynType.handle'
endusing
end
(D_XML_FLD_HANDLE),
outbuf = %atrim(outbuf) + ',type=SynType.handle'
(D_XML_FLD_BINARY),
outbuf = %atrim(outbuf) + ',type=SynType.binaryhandle'
(D_XML_FLD_ENUM),
nop
endusing
if(aval=%getxfType(param))
begin
outbuf = %atrim(outbuf) + ',cType=xfType.' + %atrim(aval)
if(aval=='datetime')
begin
using %getAttributeText(param, D_XML_NULLABLE) select
(D_XML_YES),
outbuf = %atrim(outbuf) + ',nullable="true"'
(D_XML_NO),
outbuf = %atrim(outbuf) + ',nullable="false"'
endusing
end
end
outbuf = %atrim(outbuf) + ')}'
outputText(D_OUT_LINE, outbuf)
end
;; define Synergy parameter
clear outbuf
if(%getAttributeText(param, D_XML_NAME) == '.include ') then
begin
;; if an include file, just output name
outbuf = %getAttributeText(param, D_XML_NAME)
end
else
begin
using %locase(%getAttributeText(param, D_XML_REQD)) select
(D_XML_YES),
outbuf = 'req'
(D_XML_NO),
outbuf = 'opt'
(),
begin
if(sDefaultParamMod.Length > 0)
outbuf = sDefaultParamMod
end
endusing
ctr4 = 4
using %locase(%getAttributeText(param, D_XML_DIR)) select
(D_XML_DIR_INOUT),
outbuf = outbuf(1:ctr4) + 'inout'
(D_XML_DIR_OUT),
outbuf = outbuf(1:ctr4) + 'out'
(D_XML_DIR_IN),
outbuf = outbuf(1:ctr4) + 'in'
(),
begin
if(sDefaultParamDir.Length > 0)
outbuf = outbuf(1:ctr4) + sDefaultParamDir
end
endusing
ctr4 += 8
using %getAttributeText(param, D_XML_PASSBY) select
(D_XML_PASSBY_VAL),
outbuf = outbuf(1:ctr4) + '^VAL(' + %getAttributeText(param, D_XML_NAME) + ')'
(D_XML_PASSBY_REF),
outbuf = outbuf(1:ctr4) + '^REF(' + %getAttributeText(param, D_XML_NAME) + ')'
(),
outbuf = outbuf(1:ctr4) + %getAttributeText(param, D_XML_NAME)
endusing
;; output parameter type
ctr4 = %trim(outBuf)
if(ctr4 >= offsetFieldType) then
ctr4 += 1
else
ctr4 = offsetFieldType
outbuf = outbuf(1:ctr4) + ','
ctr4 = ^d(%getAttributeText(param, D_XML_DIM))
if(ctr4)
begin
outbuf = %atrim(outbuf) + '['
while(ctr4 > 1)
begin
outbuf = %atrim(outbuf) + '*,'
ctr4 -= 1
end
outbuf = %atrim(outbuf) + '*]'
end
using %locase(%getAttributeText(param, D_XML_TYPE)) select
(D_XML_FLD_ALPHA),
begin
;; is this an array list collection
using %locase(%getAttributeText(param, D_XML_COLLECTION)) select
(D_XML_ARRAYLIST),
outbuf = %atrim(outbuf) + sHandleType
(D_XML_SYSAL),
outbuf = %atrim(outbuf) + '@' + sArrayListNS + '.ArrayList'
(),
outbuf = %atrim(outbuf) + 'a' + %getAttributeText(param, D_XML_SIZE)
endusing
end
(D_XML_FLD_DEC, D_XML_FLD_IMPDEC),
begin
;; is this an array list collection
using %locase(%getAttributeText(param, D_XML_COLLECTION)) select
(D_XML_ARRAYLIST),
outbuf = %atrim(outbuf) + sHandleType
(D_XML_SYSAL),
outbuf = %atrim(outbuf) + '@' + sArrayListNS + '.ArrayList'
(),
begin
outbuf = %atrim(outbuf) + 'd' + %getAttributeText(param, D_XML_SIZE)
ctr4 = ^d(%getAttributeText(param, D_XML_PREC))
if(ctr4)
outbuf = %atrim(outbuf) + '.' + %getAttributeText(param, D_XML_PREC)
end
endusing
end
(D_XML_FLD_INT),
begin
;; is this an array list collection
using %locase(%getAttributeText(param, D_XML_COLLECTION)) select
(D_XML_ARRAYLIST),
outbuf = %atrim(outbuf) + sHandleType
(D_XML_SYSAL),
outbuf = %atrim(outbuf) + '@' + sArrayListNS + '.ArrayList'
(),
outbuf = %atrim(outbuf) + 'i' + %getAttributeText(param, D_XML_SIZE)
endusing
end
(D_XML_FLD_STRUCT),
begin
;; is this an array list collection