`!ԠO( .>!-({N(-(N(LN(|N(-(4-(-(O(0= O([O(AHO(HO(8O(PHO(O(O(f-(8O(O(PuN(PuN(O(O(O(O(O(O(O(O(0A*>Cx~N(H~N(d,~N(BN(-XN(CxN(YN(CN(e8N(CxN( N( CN( N( CPN( P6N(CȁN(tN(C@N(N(CN(ϱN(C8N(XN(CN(oЃN(CN((N(C@N(;hN(BN(N(C N(aVHN(CpN(uN(CN( ofN( CN(!(@N("CN(#xȆN($CN(%?hN(&BN('?ЇN((C N()`pN(*BN(+QN(,CN(-R(N(.BhN(/N(0BN(1%ON(2B@N(3N(4BN(5(؊N(6BN(6O N(7BPN(7XxN(8CN(9N(:BN(&O00X ( {0X(rob xfrto Arg;oNS;file;l;nL;q;range;t;XfrID;lockXH&( DanB 19971124 (c) transfer file or items to host 2H@( [namelist] xfrto 'tohostfile /switches'@ 0( Switches: @&( /file[=] use APL file given)32@H8F( /range=n1[,n2] transfer components n1 to n2n20H8@( /lock= file lock to use8@H( /q do not display bannerred'@(;o((XG( parse argument& r(Hh_( Arg1'/lock= /q /= /file[=] /range=' parse ArgHPP( Arg[t/tArg'\']'/' change \ into / for UnixP@O( ((~q),r)r'* XFR version 3.08'e@8( do we transfer the whole workspace?88( ((0file)^0=nc 'ob')/'oball'8@@( (1file)18 no filename for the file?d'[@HP( file(^\t'.')/t(-tt~Arg':/\')ArgrH0( add extention to filenameep(00B(XfrID'.xuw' file extention0P( this ws should be )pcopy-ed to guard against name conflictsn(P X( (0file)44 H( locklock 0 by default - no check if numericH0( (^/file'0123456789')24m0 ( t,file 8( 28 a tie number is acceptable28(;o(((l' ',file,' '((P (t(/l' ',names,' ')nums)28 already tied?tiedn(P8( file stielock,t1+/nums,308n80`(ArgArg,(1XfrID),'f'' ' f0(( rsize t,lock(((( l0 1+2r k(o(((( (0range)32erid( ( nLrange 88( l((1l)1nL),(1l)Ģ1nL8 H(nL'cpt' nL 0F( r(12r) create Arg' 0Plc '((read t,i,lock) forme nL,i) write r' fori lpP8h( q(01--/l),' cpts transfered' 8Hp( Access Matrix: trap access problems if possible2(HX2( create a temp fn to localize trap/elx to create the access tablexX@x(l'rnL;m',0ex'nL' reuse name nL@((l80l,';trap'(Pn)l2 80l,80'r0trap''19 e 0''mrdac t,lock''((PP tll,[io]80'(m forme''AccessTable'')write rr1+1m'P(((lfx l)56etc (Hx(qq,' with ',(61l)'EMPTY Access Matrix'l' 2H(56;o(0e(rt'' no tie # to close0@(( try to estimate space taken (SAM only)o(Xp(@H(q1++/' '=nL1(l1lnL' ')/nL,' ',obH8(obqq,' objects transfered'ring8((r+/4 ws nLionr h(0e(rr create Arg,XfrID0@(XfrID'SAX',(version,1002 3ts),'; WS='4 @((XfrIDXfrID,(2 ws 1)(0xf((XfrID forme '') write r)0(((iolnL' ')56( ( l-io-l 0p( (forme lnL) write r(0(( nL(l+1)nL (O( 53n( p"(close rt H(untie (t)t untie only if it wasn't tied HP(rqpePO(xKO(O(AO(pO(X7O(O(5O(O(3O(ЕO(p'O(O(O(pYO(O(XYO([O(@YO(N((YO(N(0O(8oO(YO(YO(XO({O(XO(N(XO(O(XO({O(xXO(N(`XO(N(HXO(N((XO(|O(XO(O(WO(N(WO(hN(WO(N(WO(N( WO({N(`KO(HKO(0KO(KO(KO(JO(JO(JO(JO(JO(pJO( XJO(@JO((JO(JO(IO(IO(IO(IO(IO(IO(hIO(PIO(8IO( IO(IO( HO(@O(&@O(@O(@O(@O(p@O(%X@O(@@O((@O("@O(@7O((7O(7O(6O(B6O(6O(46O(3x5O(D5O(.X'O(@'O((('O('O(=&O(J&O(N&O(O&O(&O(&O(h&O(P&O(R8&O( &O(2O(MO(6O(O(WxO(O( O(O(xO(H`O(HO(E0O(O(O(N(N(N(N(N(_pN(`XN(bN(KN(N(QN(CN(xN(#`N(HN(N(7N(*N(N(N(/N(pN(:O(yO(\O(N(ehO(^PO(8O(; O(O(O(؟O(fO(qO(,O((N(xO(n`O(LHO(O(hO(PO(8O(A O(O(jN(N(8лN(PN(N(>N(pN(cXN(Y@N(5(N(9N(N(<N(@ȺN(N(N(pN(kXN(l@N(d(N(N(N(N(gȩN(iN(N(hN(hN(PN(8N( N(N(N(بN(N(N(N(xN(`N(HN(xN(Z`N(HN( 0N(hN(PN(PN(8N(! N(N(N(ОN(N(uhN(]PN(F8N( N(sN(N(N('N(N(IN(pX(z>N(؝N(N(i(HN(N(X + ( (close f;clc( 0p( close the current fileTUVWXYZ08е( 'Sunix.close'bind 'cl' define IF88( 0=fcl f closei(YZ8asrx(z>oNN(`N(lN(N(XfXN( 〠N(11N(nsؠN(r x(H< (v8i(>i((0&(ras create file;cr;bInd(WXYZ0P danb 19981104 create native file. as is approximate sizePP  r'Sunix.creat'bind 'cr' return code unimportantP(0?( file should not exist((;( assume home directory(0( rcr file256+128 read/write0@( ߢ1raddwRbIndhandlerecxz>93N(N( L8N(_8xN(8 N(L_N( LN(_8(N(9 x( (%(0(rec write handle;n;bInd;wR0@8( write rec to file associated with handle(Ƞm(@0@('Sunix.write'bind 'wR'0@(add:nwR handle(nrec)0{nblksizerec(@@(0 HN( N(.upN(X.N(.dФN(frN( HN(tixN(lN(anХN(.SN( til.( (]DYW(((allall;99;98(08( DanB 1998 all names not usedZ00`G( 99allnl all2 3 08؜( 98[1+io]199990,198XfrObjs8@@( all(^/all.98XfrObjs)all99alll(@0( all(all[;2].'')allm(00H( all(990 3all)all(Xk(0(( 98'lx pw io ct '((PF( 98(((98)4),4)98(8( all(((198),199)98),[io]all 8MFNEXPp(z>us(N(N( 'PN(/fN( /N(' N(o N(cex isp( ()(((EXP fori N;F;M;iori N(0(i''N2io,N-io<1=,N (0g(0 ( (iN1N)0 i H(NN'F'fx(3,M)(M'F'),(MEXP),(M8,EXP)'Nii+1'Hh(FHx( danb 83/9/27 will EXP for i:=N[1](or io) to N[2]HW89W76W77W85W82W78W79W80W88W81W84W83W87W86W92W90W91W93W94W95vAlW96W97W98vaLueW99@B*>CSpN(N(GNN(atN( SXN(NSN(aدN(d N(lo(N(rtHN( tiN( N( utN( cN( ch@N( xN( peN(cN(krرN( N(clN( N(ll8N(teN( ȸN(coN(op(N(inXN(crpN(f N(etN(ne(N( hN(dN(obN(owشN( N(tf0N( dhN( ȘN(! N("ocN(#dN($k 8N(%sm`N(&t xN('caN((eN((jtN()er0N(*rtN(+k N(,anN(-at N(.pe`N(.drN(/ ȨN(0tcиN(1pdN(2f N(3n HN(3tshN(4nrN(5foN(6ecN(7e XN(8erN(fsks @x (b c "'*./02358e(i(xH(W99vaLue forme obJ;W98;W97;pp;W96;vAl;W95;W94;W932HP؈( DanB 1990 (c) form object with vaLue (default by itself)Lue PP( If the object name is a package then the defn of its uniquensPPP( item is returned and 'vaLue' holds the path (of namespaces),'P0( each name separated by a dot.0 `( W95W96'?' 0#( W99pp16 16 fits all APLs0 ( W93W98''a i( @0d( 1st we find if we're dealing with a "package"@8 ( (2=pnames obJ)W92 a package?8 ( W95vaLue 98 ( vaLueobJ 97 @( obJW98, pnames obJ package right arg@8<( (9 2 3 4=obJ pnc vaLue)/2/W91,W908( W89z(i(0(W91:vaLueW98 pval vaLue type0( W92e(((W90:e(q( W88e(0o(;e(X`( a name is to be represented. It's value may be supplied as left arg.X(p(W92:(nc 'vaLue')W87 (@8( W943 if not supplied chk name is validkage?@0( (W94=W97nc W93,obJ)/W88 CM'00d( W97W89 fn unknown83 0x7( W944(@X( ((W94~''obJ)^W97W94)/W89 skip invalid90@8Ho( System vars can use namespace headerv8@h(W86:vaLue6 ws W93,obJ name looks OK, try it@@e(W87:(2=pnames(W97vaLue))W85,W98''' 34a@(( (W97W97,W97)W84( H4( W96'E' W96 (x](W83: Enclosed typew,(0`( W99W99,(>W97[io])forme 'x'0(e( (W971W97)W82,W83(8-( account for mixed types and prototype80(W84:W963ٰ\2010vaLue 807 0((f( (0vaLue)W81(0( W96W96,^/W960 1vaLueav0(xf(W81:W961W96/'NCM'V ( `( ('M'W96)W83 ('( W82,W99,vaLueHV (`5(;)f(H( Funtions; we use cr since it's the only standardW81 H((W88:(0N(xN(8N(N(N((N(xN(N(N(hN( N( N( 8N( N( N( N((N(@N(N(N(N(N(HN(pN(N(N(N(N(0N(N(N(N(N(`N(N(N(N(N(N(8N(PN(N(N(N(N((N(pN(N(N(N(N(0N( N( N( N(!N(!N(! N(!PN("xN("N(#N(#N($ N(%`N(&N(&N(&N('N(' N((PN()N(*N(+ N(,HN(-N(-N(.N(.N(.0N(/HN(0`N(1N(2N(2 N(2HN(2hN(3N(4N(50N(5XN(`h@ (X LBC&(*H"#\!"$&-.s2hX(parmspatn parse arg;d;e;dlm;i;p;pat;q;s;sp;sw;swit;t;D;;io;Er;md.Z(XX8( Dan Baronet 1993 - PARSE switches and reset argument. Version L2.3ts.XH( special version for XFR: the switches' header is ''HP|( Spaces are used to delimit arguments. '/' delimits switches. PPH( Quotes must be used to include spaces or '/' in arguments.d. PPȬ( Switches can exist with or without [possibly defaulted] valuePH( or be elided. Switches not mentioned are refused.2KHXp( Shorter names are accepted but '=' MUST be used to supply values.,@XX( Variables holding switch values have the same name as the switchSgedXX$( with a before or with the contents of immediatly global var 1avX H( Example:anged X0 ( cmdarg '/sa /ab= /sc[=] /cd=1 2 3 /e[=]d e f /=*' parse cmdargtion X8( Er710 this error no can be changed 8(p( dlm1patn,'/' (8M( arg' ',arg ' ' added for LOGOS use 8`( io1 @XP( '' this default prefix can be changed@ ( t\arg='''' ( @0|( s\swt( ipatdlm p)K ( s(i-1)pat t ,( ,(d s),'0' P,( l1,patipat 5(۪m(P@( Process each switch separatly according to their positionsttP((l2:(0swit)/l5 t(( P?( i1sp A2Kspm( ?( siswit swr ( switiswitwit HH( pat1'>unknown or ambiguous switch: <',1td s ',q H ( q1+/itpatn (X( pat signal qEr+1((H( pat1(\i)/patn (0Г( qd pat(1+patdlm)pat 4 0 ( sp1sp2KDAPL X( 'pat' is 1 switch group complete with assignment & value if presentmX(( e''2(q)pat (x( ecm (( pat[pat'']'='((cm:t1 p( s1s 0( (/p2'[=]'pat)mem 0(8( ('='s)l3,chk(0(mem:(/ppat'=')/comp (08( m1'>no value allowed for switch <',q8((m signal('='s)Er+2 (h( l3n(@hQ(comp:m1'>value required for switch <',q YW@((m signal('='s)Er+3((((chk:t(is'=')s ( ( s[i]' ' Kioe (( (^/m' '=t)/comp((( t((^\m)^\m)/t (0X( (' '^.=pat(p1)pat)/l3l2r0Pp( valid elements are supplied with the pattern: verify theml2:P@0(p(e^^/tpat)einvalid value for switch <',(i-1)s~A2K@( (m signal pEr+4,(m(H( Drop trailing spaces, remove surrounding quotes' ' H((l3:(/s' '=t)l4 ( ( t(-ss)tErK (0(l4:i/s''''=t (0( ,q,'',(i/'1(\s)/'),'t' (0<( l2bm(+(;m(XP( Find each token in the argument and use the delimiter to separate2K0XHp( them. The following allows to deal with '' properly:H h(l5:sparms' ' (( \qparms'''' ( ( iq^1q 2Kl00 (p( tq>1q t=1ST quote(H+(pts> DELIMITERS: spaces NOT in quotes OR 1st quoteHX(( COMPRESSOR: any double quote OR last quote NOT in \ or double delim.X((parms[p/p]1D (8=( parms((1q)p^1p)/parmsll8lockXfrIDtnLlArg!obrcl(fuoNSinWsbUfArGX+>(N(8N((N(`N(N((N((N(pN(N((N( HN( N( N( ( N( pN(N(r(N(( N(PN(N((N((N(PN(N(s(N((N(N( N(u(PN((pN(N(N(y(N((0N(XN(pN( (N( (N(!N("(N(#(@N($(XN(%N(&N('|(N(((N()XN(*N(+w(N(,(N(-HN(.N(/q(N(0(N(1 N(2PN(2w(xN(3(N(4N(5N(6~(XN(7(N(8N(9N(:(0N(;(`N(<N(=N(>N(?(0N(@pN(AN(AN(B( N(CpN(DN(E(N(F(HN(GN(HN(IN(J((N(KN(LN(MN(M(8N(NhN(ON(PN(Q(0N(RPN(SN(T(N(U( N(VXN(WpN(X(N(Y(N(Z8N([N(\{(N(](N(^N(_0N(`(PN(a(xN(bN(cN(d( N(e(`N(fN(gN(gN(h(N(i8N(ixN(jN(k(N(lN(mPN(n|(xN(n(N(oN(pN(q(0N(r(XN(rN(sN(t(N(u(N(vN(w8N(xj(hN((XH (8xxyz{|}~H!(ArGxfrfrom ArG;bUf;inWs;oNS;rEf;tIE;xlate;readBuf;noam;apl;ascii;cR;debug;file;list;objs;q;range;replace;trans;CodT;NaM8( DanB 2001 define objects in host file8X*( ArG is a string with the source filename and possible switches:layed(X(X( /trans=(012) is level of code translation to occur (def 0)XH(( /apl=(SAMSAXDYWA2K) source APL; av[positions]2H@( /file[=] target APL files OFF~@H( /range=start[,end] component range affectedle HP'( /replace if objects are to be replaced (def NO)P@@( /noam NO access matrix reset@@`( /objs=[vars][fns][...] def ALL (fns=ops)e'[@X$( /list only list items that would be brought inm:ix0XP( /q quiet mode - mo messages displayed?j(P8Ho( See [:d]oc for the format of the file88(۹d(`(bUf'/= /q/apl=/file[=]/replace/range=/noam/objs=/trans[=]0 1 2/list/debug':`0(oNS0ArG1bUf parse ArGons]B0H( bUf[NaM/NaMbUf'\']'/' change \ into / for Unix(H@(((~q),rEf)rEf'* XFR version 3.08'0),NaM@(8(cRav[io+10]se rEf((P<( all the vars should be defined now - validate them:ArGtlpaP8-(transtrans default is OFF)NaM8h(tIE0  ( NaM1 1 ted (( (inWs0file)38((88( are we supplying a tie number?oO'80xJ((^/file'0123456789')26 0 P( tIEfile j( `( 32 e(0(;j(H((file1)30 should we use the same filename?e4HH`c(file(^\tIE'.')/tIE(-tIEtIE~ArG':/\')ArG08' 2H(( Filename suppliedc((\(;d((8(tIEfile fopen 308il((؞(rangerange g(8((0( (^/range' 0123456789,')3508(ArG'*** illegal component range' 08p(0;j(@(;j((h( NaM2size tIEtR(8@(range(0 1+2(range),/0),NaM'8(;j(@X( Is there a file extention? then warn usered[@H4(NaM(1,NaM)NaM'** Warning: no /file switch present'0H0Я((qH@H(rEfopen ArG grab proper fns, open file@8H-(aplArG'' gather messages here>ap8h(;j(8<( * objects are defined in this section8X( if /list has been supplied only those that would be (re)definedPL? X8 ( will have their name displayed.s)08X( if /replace has NOT been supplied then a message will appearcternLX00( for all those that existlp0x(;j(0 ((qbUfread rEf)116js ap0(( screen objects herepl( ((objs)97q ((((1bUf)objs)93(@x(q''=1٢2NaMnameof bUf is this a ?@ 0(inWs107aM H(NaM(^\NaM'.')/NaM remove any namespace ref here.H@ج(qq,replace,0=nc 2NaM unknown?m 't'@8(list104 listing takes place here8@h((/q)93 list if unknown or to be replaced@((ArGArG,NaM,cR (`( 93d( ((/q)107Xsp @о(ArGArG,'* "',NaM,'" not redefined',cR ths@X( 93j(X( this object is either new, allowed replaced or to be put on filee (X((bUf(~inWs)create bUfe(@x( create will return a name or a value to file@((aplapl+inWs>1q(( д(inWs93 YWPX X( NaMfi 3NaM( 0y( 'NaM' reset by ttt0H(NaMbUf infile tIE,replace,range,noam,list,NaMH((aplapl+>NaM[io](8h(ArGArG,(11NaM),cR 96 8( 93j(h(;d( p(close rEf ( untie tIEl10 8(ArGArG,(apl),' objects defined'80p(((apl=0)debug~inWs)0160(Xw( rEfex XfrObjsfx5( (readBuf opfilehdlX(z>93pN(PN(N(N(N(X  (uvw ( (hdlopen file;op()(8P( danb 1998 open file, return handle80( 'Sunix.open'bind 'op'TUVWXYZ0(( ߢ1hdlop file00}(( (replace l7l5sourcerDbuftoreadxFr`(z>N(hN(N(0N(`N(N(N(N(N(8N(N(N( N( N( PN( pN( N( N( N( N( 0N( XN(N(N(N(N(@N(c`@` (* mn%opqrst 1 2read@8(read xFr;n;io;toread;buf;rD;source8PH( read an opened file, leave it open & return the next objecte'P0j( xFr is the handle to the file00( 'Sunix.read'bind 'rD'0H( sourcexFrbuf0@buf1024'?' arg to read fnfd 2H~( io1 (( (nc 'readBuf')l5 ( Xd( readBuf'' H(l5:(9O(O((O(pO(O(O(XO(O(O( O( X O( O( O( O(  O( X O( O( O(0 O(` O( O( O( O(0 O(x O( O( O( O( O(@ O(h O( O( O(O(@O(O(O(O(O(0O(XO(xO(O(O(O(PO(O(O(O(O( O(`O(O(O(O( O( pO( O( O(!O(!8O(!hO(!O(!O(!O("O("8O("XO("xO(#O(#O($O($(O(%xO(&O(&O(&O(&(O(&PO(&pO('O('O((O((O((0O((PO()pO(*O(*O(+O(+O(+O(,0O(-XO(.O(.O(.O(.O(/O(00O(0XO(1pO(1O(2O(3O(3O(4(O(4O(5O(5O(6O(7O(70O(7`O(8O(9O(:O(:O(:8O(;PO(8 ((]^_`abcdefghijkl8`(X99cOde create X98;X97;dFn;X96;obJ;X95;X94;X93;X92;X91;X90;X89;X88;X875`H(;( DanB 1990 (c) Create obJs defined in string. V3d 2sHX( Works in stream mode where it returns unused portion or by objectX@( where left arg is specified and meaning is@P( 0=Create, 1=return Value and put name in global 'NaM'stemsPXh( 3=return package. With a left argument an exact defn is given.theseX@ ( For non var only codes 0 & 3 are meaningful.@0(P( X90(2-(X90)nc'oNS')X90'0oNS' where to put thesePX`( X90X90,(X951X95,X90)X95'.' namespace always followed by dotZ0X A( obJX98 k(^a( (X( (X920=nc 'cOde')18([( cOde0H@( STREAM mode - recreate each individual objectngfvarHP8( in 'stream' mode each object's length is also suppliedor opf(PHx!( is used as FI is not available on all systems themH@ ((X99X98)0 split length from string')name@0p( X96(X931-io-X99' ')X990H0( X98X93X99 split object off string, recoup spaceJH ( obJX96X98 d( ( X98X96X98 8 H( X99'' obJ now contains the representation of 1 obJHHph( determine type (1st char). Undefined is tricky varsH@P( we rely on packages or fns to emulate themb(@ `(X893=cOde X97 Ⱦ( X911obJ dFn (( X951-io-obJ' ' a((  ( X9219X96r (К( X980 recoup spacea((((X94X95+X961X95obJ (( ( X99X95X94obJ 0a((`%( obJX94obJ next is the object itself. For a package multiple defns follow._`(P((X91='?P')/51,45 0:((@( object follows as rank (len), Shape, obJpack@8i( X940X96(X951-io-obJ' ')obJ ?80( obJX95obJ shape, rank0 ((X96=X94)24 (( X951-io-obJ' ' (((( X94X94,X95obJ]end ( ]( obJX95obJ 5 ( 23k((+((X87X91='ME')/39 %H0(`X2( (X91'N')27 Numbers. We need to account for capitalization for all but DYW`8 ( (/X88(io+2)>X93'EJ'obJ)26 80X( obJ[X88/obJ]'ej'[X88/X93]300 (obJX94obJ,(0X94)/',0'J 0( 54f( @(obJX94obJ 94: 8(<( (X91'RFO')54 This is a fn or op8@( X97(-X93X93'.'X99)X99 drop path if any@( V( (obJX95'')34((+( (nc 'fix')30ed( t( obJfix obJ32 P)( define fn - DO NOT OVERWRITE any existing fn if package(0f(PPb( We must define the fn w/o constraints. We do this shadowed.P (X88'fx' X92 ( (2=X94)331 @((X88'3 fd' 3fd accepts no decoratorspe(@HH(X96X94'(0=10dFn',X88,' obJ)0dFn pack dFn'H0( X96X96X93'dFndFn;',X97 (0 ( X94X96X94 0x P( X93X96X93892 0,( X95fx(2,X96)X93,X94k obJbJ0(p( (2=pnames X95)38 (8Ȇ('Can''t fix ',X99,'; reason ',X95 08 0( X93-X97WX88b @( X97'',X9787 8%( X94(X93X99),X97 new full name2 8(( X99X97 pack obJ (0y( X890 result to return?0 ( X99X94 Wfix P)( 54 this fn will be kept in a variable to be fixed latercopyPX!( 'name' contains the fn packaged which is returned now (code=3)ckageX M(X94X99 YWNaMt x( X99X95 WcOde H( X890(o( X93X88,' obJ' ht( p( X99'' ( obJ 8( 13X92 WdFn h](obJ0X97obJ ( 8`( X8711X87 mixed or enclosed?deffn8 ((X97)44 (( X931-io-X97' ' 8qe(( t( X96X93X97 ( X97X93X97os (( X931 create X96X97( ( X8743 c(s! ( X93tsO(O(po0O(orO(ppO(k ( O(rop O(pt O(to O(q!O( 0!O(ovX!O( r!O( eg!O( lv!O( ut@"O( sx"O( ec"O(p "O(av"O(ve(#O(te`#O(ve#O(s#O(k #O(tc#O(sP$O( Ȉ$O( Ȩ$O(ms$O(si$O(s(%O(srX%O(tax%O( Ș%O(sk%O(ve%O(tie 8x ("XYZ[s"#\ d80`(zfna fopen tno;i;j;io;trap0X( share tie the file name if it exists; otherwise, create it..XP( specifies the tie number and optional passnumber.td.PPw( the lowest available tie number is chosen automatically if 0.PH( the result is the actual tie number of the file.H( io0 P fna1(i1ifna' ')/fna' ',fna remove unwanted blanksp(P8( compute library number of file 8 ( i1vi fna py (( j1iai[0],fi fnah((8( convert file name to canonical format88x( i11fnai(i\fna' ')/fna z''i8(( fna(11٢10j),11fna(Pred (i(/fnanames)/jnums)l2 check if already tiediP8J( set trap for 'file name' errorYZ8(e( trap' 22 c ',l1mb((8f( (0 @*O()O( *O( *O( X+O( +O( +O( +O( ,O( 0,O( P,O( p,O( ,O( ,O( -O( P-O( -O( -O( .O( P.O( .O( .O(FN/O( P/O( p/O( /O( /O( /O( /O( 00O( X0O( 0O( 0O( 0O( 0O( 1O( 01O( p1O( 1O( 1O( 2O( 82O( X2O( p2O( 2O( 2O( 2O(! 3O(" `3O(# 3O($ 3O( P > JKLMNOsPQRST12UVW4#G$g(PP(msg obj infile arg;tie;cpt;rng;io;trap;rep;fsz;ams;ok;listPPP( DanB 19971214 put in file TIEd. Append cpts if necessary.APXPx Mt arg is tie#, replace, range(2), original file size(2), NO access matrix, list only, cpt no (0=AM) xP( done and message string returned if nothing was definedendP (msgiook0 ( tiearg[0] f( (( fsz2size tie( k( reparg[1] rg ( rngarg[2 3] p( amsarg[6] pt ( listarg[7] gX ( cptarg[8]rep P( global 'NaM' refers to either a ComPonenT or the Access TablePPf(trap'21 e (1e5+/2size tie)resize tielc19 c end'APXP8x(cptam is this the access matrix?]8(( must be a componentD(X( because the file components are supposed to be sequential we can do:XH(j((cpt.rng)l20tie ((P( rng1+''appendr tie (( l10g(0( domain error means troublee 00 Q(l20:rngcpt=obj appendr tie 0( endf(  (no:listendms @( msg'* Component ',(cpt),' not replaced' ed@8( endo(X( this cpt COULD be replaced but all that is wanted is the cpt #inedy. X8Ȥ(show:msg(~ams)/'Access Matrix' z)l10(8 ( cptendoks ((msgcpt clist H( endi((( we replace it if ~ams( @i(am:listshowst 8(msg'* Access Matrix not replaced' end 8 w( amsendXend P8(msg'* Access Matrix not replaced (problem encountered)'P @l(obj stac tie `l(l30:msgok1ow 0h(end:msg( p4O(H4O( 4O( 4O( 4O( 5O(2 85O(73X5O(_7x(V (%Ilacee(((U(nnameof str;b;io str(8p( name of object defined by string(8H(io1  W( bstr' ' fn( 0 (n1bstr length of nameWXYZ0 V(nnbstr@G d(  2(nn,':',1strix strHX(z> 6O(6O(86O( h6O(6O( X P, (HH (xl 0( danb 19981013 translate textZ0((nc'xlate')0b(( p(xlate[av] endl12cfbdlmdb1"(->nd`9O(9O(di9O(r 9O(Th :O( kH:O(r `:O(va:O(th:O(em:O(r ;O( t.H;O( oo;O( bj;O( ea;O( le(O( (P>O(pa>O(me>O(o >O(le?O(meP?O(be?O( o?O(ut?O(o ll nH{ (4 77ABC=*DE1F 24GdH8(fnfix fn;io;b;b1;d;dlm;mat;t;fb;c88@( DanB 1990 (c) fix vars+fns names 8Pb( It relies on table 'equivalence' which contains replacementsP(6( for various APLs( ( io0  `( cav[io+10] 80( fnbout fn remove {} brackets s8(X( (mat2=fn)l10C( $( fn1,c,fnm `( H(l10:(d3''fn[(fn=' ')0])l12 any decorators?2HP fn(-bbb^0b''12fn)fn does not tolerate extra charsP8`a(l12:bc=fn merge ;locals linesl fn8 P( t1+d+b1b1 ` 8( (b1=b)l20 more than 1 line?8( ( tt++/^\' '=tfn ( x( (tfn)l20 8(( (';'=fn[t])l20 1st char ';'?n8H( OK, line[1] starts with a ';', merge it with [0]H8( b\fb<\(\b)^(b>fb<\b)fn''AD8(( fn[b/b](t-b1)b/fn](((l20:(nc'CodT')end((@W( b'**NOTR**' 'no translate' signature;t;fb;c@@( (1tbfn)l30 should we translate this fn?@86( remove the occurence of the request8 ( dlmt1 d1 0@( fn(dlmfn),(dlm+b)fn tors? 0H( endm((?(; R(Prou translation requested. The translation string is in 'CodT'PP|  Empty lines: it is assumed all versions can handle them< PPefn (Sharp starts at r19) otherwise we have to introduce them.delP0 (l30:fnCodT txtrepl fn0 (end:mat0dlm x( fn>1nd@CO(BO('xCO(o CO(yoCO(meCO(ssCO(PL DO( -@DO(o XDO( xDO(OUDO(coDO(FRDO(orEO( EO(xfPEO(t\hEO( 'EO(caEO(2 EO(, FO(fn8FO( aPFO(nsFO(s.FO(riFO(jeFO(ilGO(os0GO(adPGO(FRpGO(orGO( GO(hoGO(enHO(AN8HO( T`HO(evHO(heHO(mpH (8 7789:;(*24<=>?@H8(fnbout fn;cr;io;com;line0;line1;s;t8(io0 ((8;( crav[io+10] ( X( (2=fn)mat (tfncr @p Q( (@4( (/'{'line0tfn)0( :(fn(t+1)fn om H( com'' (tline0'' om (P<( (t=line0)l60( PH(comtline0 g( ( line0tline0 F(tfncr l60 ( (t=fn)l200 0(line1((''line0)/'[1] '),com 0X( l30g((x<(l20:line1(tfn),com g(( ( fntfnl30 (<(l30:line1fnline1,fn((8_(l60:line0s\(s~line0'{}')/line0ne18(0n(fnline0,(0HNO(MO( NO(NO(NO( 0OO(hOO(OO( OO(PO(0PO(PPO( [(xPO( j(PO( k(QO( i(hQO( d(QO(J(RO(g(0RO(X(PRO(k(pRO(W(RO(f(RO(f(RO(f(SO(j((SO(i(PSO(I(xSO(h(SO(h(SO(J(TO(h(0TO(o(XTO(V(TO(V(TO(c(TO(Z(TO(Y((UO(Y(PUO(Y(pUO(l(UO(X(UO(b(UO(I(8VO(l(hVO(VO( c(VO(!WO(!(WO("XWO(p`_ (N !"#$%&'()*+,-./0123456;W`X(TS txtrepl T;io;b;i;l;lbr;l0;l1;mask;n;p;pos;s;ss;t;up;A;C;NC;U;WX@( 'S' is delimited list of search/replace items@x( io08( prepare start/length of stringsch88P7( WW,[0.1](1t,s)-W1+tt/stS=1S80`( Non-Overlapping searchmsl30 s0HX( T is text to search, S is search/replace itemsfd 2H0H9( p is 2 col of Position,pair #0 h( p0 2i0  ( n1W @ i( (r( mask(NCT,T)0i((P( This is a special case for xfr: if the searched string has]PP( If in it we seach the uppercased version (for sys names)elPP@( C2 26'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'(PP( Ufx ((U)'rup t'),[-.1]U'r(C[1;],t)[(C[0;],t)t]'t' PP( When searching names we look for an exact match (sisize)P(( U(U[t] cei(( I( tl25 MDDlbr ( pospos>NClA ((l25:post/tpos>mask(((( t~/mask[pos.+l]nce(H{( post/pos some cannot be used for replacement01 H8,(l30:(^/t\pos10,l+pos)/l40 b)/T8 h( postpos l1 ( l30l((@(l40:pp,[0]pos,[0.1]i (((( mask[pos.+l]1Hi((0H;(l50:(n>ii+tpos2)/l10 0 r( pp[p;] mask (ۿI(@( W: which pairs to use; l1/l0: their lengths@(X|( l1W[1+tp[;1];1] (( :( l0W[t;1]nask 8( lbr: len BEFORE string to replacering80XT( lbr(b,T)-0,l0+bp[;0] 0 T( b(2lbr)1 0 @ ( size of not/replace portions: remove from 't'@0(( T((,lbr,[0.1]l0,0)/b)/T00( insert room for new string00( T((,lbr,[0.1]l1,0)/b)\T0@X( put in place (doing b/b might wsfull)[p;]@ ( b+/l1 posw 0P( il1/W[1+p[;1];0]-0,+\1l1XYZ00<( T[b+l1/+\1lbr]S[b+i]0xfrtoclose create writeall copyright describe foriformeparse version xfr xfrfrom blksize XfrObjs openreadXscreate`0D XfrObjs Xs all bout copyright create describe equivalencefix fopen fori forme infile nameof parse txtrepl version xfr xfrfrom xfrto xl blksize close create open read write `8(2 ws 1  $  []();/\+-*^<=>,!?~_}{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789. ':  |`#@"%&  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ %'_abcdefghijklmnopqrstuvwxyz . 0123456789 $ABCDEFGHIJKLMNOPQRSTUVWXYZ{}[/\<=>^-+?~*(;,!"#&@`|:)]   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  ! )<=>]^,+./0123456789([;:\_{'*?~-ABCDEFGHIJKLMNOPQRSTUVWXYZ$}|"#%&@`abcdefghijklmnopqrstuvwxyz    >L_9 :A2K FREPLACE%replace FRESIZE%resize FCREATE%create FRENAME%rename FAPPEND%appendr IDLIST%IDLIST FAVAIL%avail FNAMES%names FERASE%erase FUNTIE%untie ERASE%6 fd IDLOC%IDLOC ERROR%99 signal FRDCI%rdci FSIZE%size FNUMS%nums FRDAC%rdac FSTAC%stac FHOLD%hold FREAD%read FSTIE%stie FDROP%drop WSLIB%wslib TCESC%ESC TCNUL%NUL WSTS%WSTS WSID%(2 ws 1) SIZE%4 ws SINL%SINL ;ELX%;trap ;ALX%;trap FLIB%lib FTIE%tie FDUP%copy TCNL%CR TCLF%LF TCFF%FF TCBS%BS "22"%(0) DEF%3 fd ELX%trap ;SA%;trap LIB%lib SEG%SEG FMT%fmt VR%1 fd VI%vi FI%fi SI%(2 ws 2) %><< DM%(6,CR,er) IO%io CT%ct PP%pp RL%rl PW%pw CR%cr FX%fx LX%lx NC%nc NL%nl EX%ex AI%ai AV%av TS%ts WA%wa MF%fm LC%lc %>< )(%)( )'%)' '(%'( (%(< %< \%\< %< %< %< %< %< %< %< ,%,< %< /%/< %< (%(> +%+> %> %> <%<> %> =%=> %> >%>> %> %> ^%^> -%-> %> %> !%!> %> %> %> %> \%\> %> %> %> %> ~%~> %> %> %> %> %> *%*> %> [%[> %> %> %> %> %> %> %> %> %> %> ,%,> %> ?%?> /%/> %> %> :DYW IOVFI%fi FREPLACE%replace IOVFI%vi FRESIZE%resize FCREATE%create FRENAME%rename FAPPEND%appendr MONITOR%fm SIGNAL%signal FAVAIL%avail FNAMES%names FERASE%erase FUNTIE%untie SHADOW%SHADOW FHIST%rdfi FRDCI%rdci FSIZE%size FNUMS%nums FRDAC%rdac FSTAC%stac FHOLD%hold FREAD%read FSTIE%stie FDROP%drop TRACE%trace WSID%(2 ws 1) size%4 ws PATH%PATH TRAP%trap FLIB%lib FTIE%tie "133"% "210"% notmatch STOP%stop "47"%(0) SVS%svs SVR%svr SVO%svo SVC%svc SVQ%svq FMT%fmt VR%1 fd SI%SI TC%TC %><< DM%DM ED%EDIT ML%ML IO%io CT%ct PP%pp RL%rl PW%pw CR%cr FX%fx LX%lx NC%nc NL%nl EX%ex AI%ai AV%av TS%ts WA%wa LC%lc %>< )(%)( )'%)' '(%'( (%(< %< \%\< %< %< %< %< %< %< %< ,%,< %< /%/< %< (%(> +%+> %> %> <%<> %> =%=> %> >%>> %> %> ^%^> -%-> %> %> !%!> %> %> %> %> \%\> %> %> %> %> ~%~> %> %> %> %> %> *%*> %> [%[> %> %> %> %> %> %> %> %> %> %> ,%,> %> ?%?> /%/> %> %> % union % intersect :APX TRACE%trace "210"%(0) 2 CR%1 fd "175"% index STOP%stop ERS%signal "11"% Fread "12"% Fwrite SVR%svr SVO%svo SVC%svc SVQ%svq FMT%fmt SI%SI ES%99 signal "9"% Fdrop "7"% Fhold TC%TC %><< EM%(6,CR,er) UL%ul IO%io CT%ct PP%pp RL%rl PW%pw CR%cr FX%fx LX%lx NC%nc NL%nl EX%ex AI%ai AV%av TS%ts WA%wa LC%lc FC%fc R%CR L%LF B%BS N%NUL %>< )(%)( )'%)' '(%'( (%(< %< \%\< %< %< %< %< %< %< %< ,%,< %< /%/< %< (%(> +%+> %> %> <%<> %> =%=> %> >%>> %> %> ^%^> -%-> %> %> !%!> %> %> %> \%\> %> %> %> %> ~%~> %> %> %> %> %> *%*> %> [%[> %> %> %> %> %> %> %> %> %> %> ,%,> %> ?%?> /%/> %> %>s1 y( 0Xp= ף@( sett2001 - Version 3 This workspace is used to transfer workspaces to/from host files. This be can useful when taking backups or going back to a previous incompatible version of an APL. Because it can apply some code translation it can also be used to go between APLs. It can be used stand alone for most PC APLs but for some mainframe APLs this method assumes you have access to some transfer program like PC108 for the PC. For example, TSO users need TSIO access (for SAM) and corresponding transfer programs. The programs known so far reside in variables with names resembling their environment. For SAM look at the objects and reassign 'filefns' to suit best your environment if necessary. SIMPLEST USAGE - To send to the host: )xload YOURWS )pcopy [lib] XFRPC (this workspace) namelist xfrto 'tohost\filename' 'namelist' can be (nl 2 3) or all, a utility fn to return all non transfer objects. - To retrieve the objects in a file on the host: )load [libno] XFRPC (this workspace) xfrfrom 'hostpath\filename' ADVANCED USAGE There are several switches. For example, if you want to transfer a file (ex: 'MFfile') instead of the current workspace, use switch 'file': xfrto 'tohost\filename /file=MFfile' local file name format varies but use \ instead of / for Unix pathnames to avoid conflicts with switches' delimiter. To transfer specific components use xfrto 'localfile /file=myfile /range=3,45' cpts 3 to 45 The access matrix is always transfered unless access is restricted. If a lock is required add the switch /lock. To retrieve a file do xfrfrom 'hostpath\filename /file=myfile' possibly adding switches /range and /noam if needed. The file will be created if it does not already exist. New items will be appended. Note that you must use the /f switch if it's a file even though the extention is .x?f otherwise all the components will be defined in the workspace in variables named something like CPTxxx. To replace objects or components use the /replace switch. If you only wish to see the names that will be produced use the /list switch. AV MAPPING and CODE TRANSLATION The program will perform av mapping automatically. To get the program to also translate the code use switch /trans. With /trans=2 you also get the av map in variable AV. This is useful if there is a lot of AV[...] in the code. They will be changed to AV[...]. Some of the programs can be used by themselves. For example, if you wish to keep the result of the transfer you can assign it to a variable as in toxfrxfr namelist and use your favorite program to transfer that variable. Note that translation problems are more likely to occur with this method. TECHNICAL DETAILS The transfer file extention is 'x?w' (ws) or 'x?f' (files) where '?' is 'u' for SAX, 's' for APL2000, 'd' for Dyalog, 'm' for SAM, and 'p' for AplX. This extention will be ADDED by the program and USED by the program. This extention usage can be overridden by the /apl= switch as in xfrfrom 'myxfr.file /apl=DYW' Possible /apl= values are SAM (SHARP APL mainframe), SAX (SHARP APL Unix), DYW (Dyalog for Windows), APX (AplX) and A2K (APL2000). dumps all objects to file without translation. Those include all variable types (character, numeric, mixed, enclosed/boxed, packages and, within those, undefined) and functions/operators. Packages are transformed into namespaces under Dyalog, overlay under APLX and into nested structures for APL+Win. Special fns are included to handle these in the transfer workspace. They all start with the capital letter 'P'. The code will also use those names instead of pnames where appropriate. reads a file, maps the av if from a different APL and applies code translation if /trans=1 (or 2) is supplied with the argument. All functions start with a delta. For Dyalog APL they all reside in the 'xfr' namespace. Code is written in "common" APL. The internal names (locals) are unusual to minimize name conflicts. There is a different workspace for each APL version. Switches can be shortened to a short non-ambiguous form. The actual switches are (*=xfrfrom only, CAPITALS=minimum length): /Apl*, /File=, /List*, /Noam, /Objs=*, /RAnge=, /REplace*, /Trans=* /Lock= EXAMPLES xfrto 'myexportfile /file=myaplfile /range=100 999 ' xfrfrom 'yourfile /objs=fns /trans' apply translation xfrfrom 'x.xuw /list' only list objects xfrfrom 'fx.xuw /f/n' file, no access matrix Function will look like this when translated SAX Dyalog APL 2000 F; trap;ec F; TRAP;ec_ F; ELX;ec_ [1] 2 ws 2 [1] w_(SI) [1] w_SI [2] a replace t [2] a FREPLACE t [2] a FREPLACE t CODE TRANSLATION To change the behaviour of the translation edit variable 'equivalence' under the APL section desired. Each section starts with a colon followed by the APL vendor code (SAX, DYW or A2K) as in ':SAX'. Each non empty line after is made out of 2 strings separated by '%'. The first one is the string to replace, the second its replacement. Strings surrounded by " are the av value instead. names are case independent and treated syntactically but others are not. RESTRICTIONS The usual ws full problems can be encountered. If possible increase ws size to solve this problem. Many characters have no equivalent in other APLs. They are still mapped to a character when read from the file. If a function cannot be fixed in the workspace (possibly because of an invalid header) a variable with same name preceded by a '' contains the offending code. For example, if function cannot be fixed then variable 'F' will contain the (translated) code. HISTORY This workspace started life as an APL/PC workspace in the early 80's. It has gone through extensive changes over the years. The original workspaces did not have switches but they are still available with the format unmodified. In 2003 I included APLX and adopted CR as the standard for fn representation. DanB 2001 (c) XCopyright Milinta inc 1999+ You are granted a licence to use this code provided it is for private use and the code is not modified. Contact support@milinta.com for details or report problems.Pt..vvlx0'DanB 2002. Transfer ws version 3.08' P(infile(boutfopen(nameof equivalence (txtrepld (fixddYO((.,**_(             $  []();/\+-*^<=>,!?~_ܭ}{abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789. ':  |`#@"%&徼е뱿    !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     hO(   hhO(HO(0O(O(O(؛O(O(O(O(xO(`O(@O( O(O(O(O(O(O(`O(hP(xlceN(patnparms97B98994`(z> O(O(.HO( O( O( O(ll`( ({((X6(99xfr 98;97;oNSe((P DanB 1990 (c) return a string representing objects named@PHhm((0981(97197' '=98)/98,' ',98)99''2H@(9999,forme(1+971-io-98' ')98@(6((989798)3(`e((NaMCodTtransrange_qobjsKlistfileCdebugcRasciiapl*noamxlate/tIErEf:d 1[GmvzSUXw$+)o~TVx?r}t-{a|0