|
94 | 94 | ⍝ 2032 04 28 MBaas, v1.81: Check: additional context info in msgs of failing checks - if -halt is set, we also display the calling line
|
95 | 95 | ⍝ 2032 05 10 MBaas, v1.82: DTest now counts and reports the number of "Checks" that were executed (calls of function Check)
|
96 | 96 | ⍝ 2023 05 20 MBaas, v1.83: DBuild: the icon-parameter of the target-directivy may use "./" to indicate path relative to the location of the .dyalogbuild file
|
97 |
| -⍝ 2023 06 05 MBaas, v1.84: DBuild: added "nousource" directive and option for TARGET to save a dws w/o source (neccessary when building for Classic & Unicode!) |
| 97 | +⍝ 2023 07 05 MBaas, v1.84: DBuild: added "nousource" directive and option for TARGET to save a dws w/o source (neccessary when building for Classic & Unicode!) |
98 | 98 |
|
99 | 99 |
|
100 | 100 | DEBUG←⎕se.SALTUtils.DEBUG ⍝ used for testing to disable error traps ⍝ BTW, m19091 for that being "⎕se" (instead of ⎕SE) even after Edit > Reformat.
|
|
273 | 273 | :EndIf
|
274 | 274 | ∇
|
275 | 275 |
|
276 |
| - ∇ {names}←{options}LoadCode file_target_mode;target;file;whatWeHave;f1;f2;f3;fl;fls;sep;sf;source;res;mode;larg |
| 276 | + ∇ {names}←{options}LoadCode file_target_mode;target;file;whatWeHave;f1;f2;f3;fl;fls;sep;sf;source;res;mode;larg;ref |
277 | 277 | ⍝ loads code from scriptfile (NB: file points to one existing file, no pattern etc.)
|
278 | 278 | ⍝ Options defines SALT options
|
279 | 279 | ⍝ file_target_mode: (filename )
|
|
314 | 314 | :Select lc 3⊃⎕NPARTS fl
|
315 | 315 | :CaseList '.dyalog' '.aplc' '.aplf' '.apln' '.aplo' '.apli'
|
316 | 316 | :Trap DEBUG↓0 ⍝↓↓↓↓ be sure to pass target as a ref, bad things may happen otherwise ()
|
317 |
| - res←0({0::⍵ ⋄ ⍎⍵}target)0 ⎕SE.SALT.Load fl,' ',options |
318 |
| - |
319 |
| - ⍝source←⎕SE.SALT.Load fl,' -source=no' ⍝ unfortunately need two calls to establish function & get source |
320 |
| - ⍝source←1⊃⎕NGET fl |
| 317 | + source←1⊃⎕NGET fl 1 |
| 318 | + :If {(1=≢⍵)∧⊃1↑,⍵}~(⎕NC ⍕target)∊0 9 ⍝ deal with name clashes |
| 319 | + :andif (,'#')≢,⍕target |
| 320 | + ('target="',(⍕target),'" exists already with ⎕NC=',(⍕⎕NC target),' and is protected')⎕SIGNAL(∨/' -protect'⍷options)/11 |
| 321 | + ⎕EX target |
| 322 | + :EndIf |
| 323 | + ref←{0::⍵ ⋄ ⍎⍵}target |
| 324 | + ref.⍙src⍙←source |
| 325 | + ⍝ res←ref⍎'2⎕fix ⍙src⍙' |
| 326 | + res←2 ref.⎕FIX'file://',fl |
321 | 327 | :Else
|
322 | 328 | res←'*** Error executing "⎕SE.SALT.Load ',fl,' -target=',(⍕target,options),'": ',NL
|
323 | 329 | res,←⎕DMX.(OSError{⍵,2⌽(×≢⊃⍬⍴2⌽⍺)/'") ("',⊃⍬⍴2⌽⍺}Message{⍵,⍺,⍨': '/⍨×≢⍺}⊃⍬⍴DM,⊂'') ⍝ CompCheck: ignore
|
|
1566 | 1572 | :Case 'target'
|
1567 | 1573 | :If (,0)≡2 args.Switch'save'
|
1568 | 1574 | :AndIf (('2'GetNumParam'save')∊0 1)
|
1569 |
| - ('Type' 'I') Log'Found TARGET-Entry with SAVE-parameter, but modifier -save=',(⍕save),' overruled it' |
| 1575 | + ('Type' 'I')Log'Found TARGET-Entry with SAVE-parameter, but modifier -save=',(⍕save),' overruled it' |
1570 | 1576 | :ElseIf Target≡null
|
1571 |
| - :if (,2)≠2 args.Switch'nosource' |
1572 |
| - :andif ('2'GetNumParam'nosource')≠arg.Switch'nosource' |
1573 |
| - ('Type' 'I')Log'Found TARGET-Entry with nosource=',(GetParam'nosource'),', but modifier -nosource=',(),' overruled it' |
1574 |
| - :endif |
1575 | 1577 | TargetList⍪←i line params names values
|
1576 | 1578 | :EndIf
|
1577 | 1579 | :Else
|
|
1601 | 1603 | :EndIf
|
1602 | 1604 |
|
1603 | 1605 | n←≢3⊃LOGS
|
| 1606 | + :If DyaVersion≥19 |
| 1607 | + :If nosource>¯1 ⍝ if this is set |
| 1608 | + :AndIf 0<≢GetParam'nosource' ⍝ and the TARGET instruction also has a nosource param |
| 1609 | + :AndIf ('2'GetNumParam'nosource')≠nosource ⍝ and they are different |
| 1610 | + ('Type' 'W')Log'Found TARGET-Entry with nosource=',(GetParam'nosource'),', but modifier -nosource=',(⍕nosource),' overruled it' |
| 1611 | + :EndIf |
| 1612 | + :If (1=GetNumParam'nosource')∧0≠2 args.Switch'nosource' |
| 1613 | + :OrIf 1=2 args.Switch'nosource' |
| 1614 | + {}5171⌶# |
| 1615 | + {}5172⌶0 |
| 1616 | + :EndIf |
| 1617 | + :Else |
| 1618 | + :If 0<≢GetParam'nosource' |
| 1619 | + :OrIf nosoure>¯1 |
| 1620 | + ('Type' 'W')Log'Using "nosource" requires at least Version 19' |
| 1621 | + :EndIf |
| 1622 | + :EndIf |
1604 | 1623 | :If 0=n ⍝ if no errors were found
|
1605 | 1624 | :If (save≡1)∧0=1↑⍴TargetList ⍝ save switch was set, but no target instruction given
|
1606 | 1625 | ⍝ pretend we had one which save under name of build file
|
1607 | 1626 | TargetList←1 5⍴0('target: ',name)('wsid=',name)(,⊂'wsid')(,⊂name)
|
1608 | 1627 | :EndIf
|
1609 | 1628 | :If save
|
1610 |
| - :If 1=GetNumParam'nosource' |
1611 |
| - :orif 1=2 args.Switch'nosource' |
1612 |
| - 5171⌶# |
1613 |
| - :EndIf |
1614 | 1629 | :For (i line params names values) :In ↓TargetList
|
1615 | 1630 | :If 0∊⍴tmp←GetParam'wsid' ''
|
1616 | 1631 | LogError'wsid missing'
|
|
1640 | 1655 | :If save∊0 2
|
1641 | 1656 | :Continue
|
1642 | 1657 | :EndIf
|
| 1658 | + |
1643 | 1659 | ⍝ Apr 21-research found these vars referencing # (or elements of it) - get them out of the way temporarily
|
1644 | 1660 | rfs←0 2⍴''
|
1645 | 1661 | ⎕EX¨'⎕SE.'∘,¨'SALTUtils.spc.z' 'SALTUtils.spc.res'
|
|
1884 | 1900 | msg,←' when DTest expected an empty charvec to indicate success'
|
1885 | 1901 | :EndIf
|
1886 | 1902 | :Else
|
1887 |
| - msg←'code returned character value = "',msg,'"' |
| 1903 | + msg←'code returned character value = "',(¯1↓,msg,⎕UCS 10),'"' |
1888 | 1904 | :If SuccessValue≢''
|
1889 | 1905 | msg,←' that did not match SuccessValue=',{' '=⍥⎕DR ⍵:'''',⍵,'''' ⋄ 'num ',((0 1⍳⍴⍴msg)⊃'scalar ' 'vector '),⍕⍵}SuccessValue
|
1890 | 1906 | :Else
|
|
2024 | 2040 | r,←'' 'Optional modifiers are:'
|
2025 | 2041 | r,←⊂' -clear[=NCs] expunge all objects, optionally of specified nameclasses only'
|
2026 | 2042 | r,←⊂' -halt halt on error rather than log and continue'
|
| 2043 | + :If 19≤DyaVersion |
| 2044 | + r,←⊂' -nosource do not preserve "source-as-typed" (neccessary if you want to create workspaces' |
| 2045 | + r,←⊂' that can be used on Classic and Unicode Editions!)' |
| 2046 | + :EndIf |
2027 | 2047 | r,←⊂' -production remove links to source files (and execute code given in PROD instructions in buildfile)'
|
2028 | 2048 | r,←⊂' -quiet[=n] only output actual errors (quiet=2 only writes them to log, not into session)'
|
2029 | 2049 | r,←⊂' -save[=0|1|2] save the build workspace (overwrites TARGET''s save option). Note: we only save if no errors were logged during Build process. save=2: do NOT save, but set ⎕WSID (according to TARGET Instruction in buildfile)'
|
|
2243 | 2263 | :EndIf
|
2244 | 2264 |
|
2245 | 2265 | :If 2=⎕NC'⎕se._cita._memStats'
|
2246 |
| - t←{0::((1 3⍴0 ¯1 0)⎕FSTAC t)⊢t←⍵ ⎕FCREATE 0 ⋄ ⍵ ⎕FSTIE 0}(1⊃⎕NPARTS file),'MemRep' |
2247 |
| - ⎕SE._cita._memStats ⎕FAPPEND t |
2248 |
| - ⎕SE._cita.∆cpu ⎕FAPPEND t |
2249 |
| - ⎕FUNTIE t |
| 2266 | + :Trap 0 |
| 2267 | + t←{0::((1 3⍴0 ¯1 0)⎕FSTAC t)⊢t←⍵ ⎕FCREATE 0 ⋄ ⍵ ⎕FSTIE 0}(1⊃⎕NPARTS file),'MemRep' |
| 2268 | + ⎕SE._cita._memStats ⎕FAPPEND t |
| 2269 | + ⎕SE._cita.∆cpu ⎕FAPPEND t |
| 2270 | + ⎕FUNTIE t |
| 2271 | + :Else |
| 2272 | + ⎕←'Caught error writing mem stats into ',(1⊃⎕NPARTS file),'MemRep:' |
| 2273 | + ⎕←(⎕JSON ⎕OPT'Compact' 0)⎕DMX |
| 2274 | + :EndTrap |
2250 | 2275 | :EndIf
|
2251 | 2276 |
|
2252 | 2277 | ⍝ write the logfile
|
|
0 commit comments