Annotation of 43BSD/contrib/apl/lib/iows, revision 1.1.1.1

1.1       root        1: n��*.KB�&       H
                      2: writevfd writev x;dumb;shape;rank;type
                      3:   rank { Rshape{Rx
                      4:   type { 'nc'[(1?1) + ' 'E(,0)\0Rx]
                      5:   dumb { fd Lwrite type
                      6:   dumb { fd Lwrite rank,shape
                      7:   dumb { fd Lwrite x
                      8:       readvr { readv fd;type;rank;shape;m
                      9: CJ change the '8' in line 2 to '4' for apl
                     10:   len { 8
                     11:   type { (len,1)[(1?1) + 'c' = fd Lread 1]
                     12:   rank { Lfloat fd Lread len
                     13:   shape { Lfloat fd Lread X/len,rank
                     14:   r { ''
                     15:   m { n { X/shape,type
                     16: next: r { r, fd Lread m
                     17:   } (0 # m { n-Rr)/next
                     18:   } (1=type)/rshape
                     19:   r { Lfloat r
                     20: rshape: r { shape Rr
                     21:       closeclose v;n
                     22:   n { `1+Rv{,v
                     23: loop: xx { Lclose v[n+I1]
                     24:   } (0 $ n { n - 1) / loop
                     25:       splitch { split v; t; tl; n
                     26:   n { Rv
                     27:   ch { (n+1)R0
                     28:   tl { (2,n)R0
                     29:   i { I1
                     30: nxp: tl[;i] { Lpipe 0
                     31:   } ((n+I1) > i { i + 1) / nxp
                     32:   i { I1
                     33: } (0 = ch[n+I1] { Lfork 0) / child
                     34: parent: v { ~v
                     35: child: t { Lclose tl[v[i]+I1;i]
                     36:   ch[i] { tl[(~v[i])+I1;i]
                     37:   } ((n+I1) > i { i + 1) / child
                     38:       execexec name; t
                     39:   t { Lexec name { ((2,Rname)Rname),0
                     40:   t { Lexec ((2,5)R'/bin/'),name
                     41:   t { Lexec ((2,9)R'/usr/bin/'),name
                     42:   t { 2 Lwrite 'exec failed'
                     43:   Lexit 1
                     44:       setinsetin fd; t
                     45:   t { Lclose 0
                     46:   t { Ldup fd
                     47:   t { Lclose fd
                     48:       setoutsetout fd; t
                     49:   t { Lclose 1
                     50:   t { Ldup fd
                     51:   t { Lclose fd
                     52:       readallr { readall fd ;t
                     53: r { ''
                     54: nxt: r { r,t{ fd Lread 512
                     55: }(0#Rt)/nxt
                     56: t { Lclose fd
                     57: 
                     58:        writeallfd writeall data ;t
                     59: t { fd Lwrite data
                     60: t { Lclose fd
                     61: &Llx3&'type ''describe'' for details'&      describe�&��this workspace contains the following functions
                     62: which permit the generation of, communication with,
                     63: and control of independant cooperating processes.
                     64: these functions are described in 'the application of an apl
                     65: interpreter to the control of lower-level more efficient
                     66: processors' by a. p. reeves, accepted by apl79.
                     67: the following functions are available:
                     68: 
                     69: split -- fork a child process and set up pipes to it
                     70: exec -- execute (overlay apl with) another Unix program
                     71: setin -- change standard input to specified file descriptor
                     72: setout -- change standard output to specified fd
                     73: readall -- read everything from fd and close it
                     74: writeall -- write to specified fd and close it
                     75: writev -- write apl variable to fd
                     76: readv -- read apl variable from fd
                     77: close -- close file(s)
                     78: 
                     79: readv and writev use a special format which includes
                     80: the rank and shape of the variable, so the entire
                     81: nature of a variable written with 'writev' may be
                     82: recovered using 'readv'.
                     83: &fd&&�A&xx&&shsh; z
                     84: } (Lfork 1 /= 0) / cont
                     85: Lexec 2 8 R '/bin/sh',0,'-',7R0
                     86: z _ Lexit 1
                     87: cont: z _  3 Lsig 1
                     88: z _ Lwait 1
                     89: z _ 3 Lsig 0
                     90: 'Returning to APL now'
                     91:       evokech { evoke process
                     92:  ch { split 1 0
                     93:  } (0#`1Ych)/0
                     94:  setin ch[1]
                     95:  setout ch[2]
                     96:  exec process
                     97:       readlr { readl d
                     98: r { Lrd d
                     99: 
                    100: writelch writel data
                    101: ch Lap data
                    102:       execniexecni name; t
                    103:   t { 2 Lsig 1
                    104:   t { Lexec name { ((2,Rname)Rname),0
                    105:   t { Lexec ((2,5)R'/bin/'),name
                    106:   t { Lexec ((2,9)R'/usr/bin/'),name
                    107:   t { 2 Lwrite 'exec failed'
                    108:   Lexit 1
                    109: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.