home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / table111.zip / source.zip / Table.RXX < prev   
Text File  |  2000-01-01  |  20KB  |  681 lines

  1. /*-----------------------------------------------------------------------------+
  2. |                                                                              |
  3. |  REXX source code listing for DrRexx application:                            |
  4. |    E:\Goran\Table111\Table.res                                               |
  5. |                                                                              |
  6. |  File last modified on: 01/02/00 at: 01:53am                                 |
  7. |  Listing produced on:   01/02/00 at: 01:54am                                 |
  8. |                                                                              |
  9. +-----------------------------------------------------------------------------*/
  10.  
  11. SIGNAL ON SYNTAX
  12. SIGNAL ON HALT
  13. SIGNAL INIT
  14.  
  15. RETURN:
  16.   SIGNAL VALUE DrRexxEvent()
  17.  
  18. L1:
  19.   EXIT -1
  20.  
  21. L2:
  22.   INTERPRET DrRexxInterpret()
  23.   SIGNAL RETURN
  24.  
  25. /*-----------------------------------------------------------------------------+
  26. |                                                                              |
  27. |  Event handlers for dialog: Table                                            |
  28. |                                                                              |
  29. +-----------------------------------------------------------------------------*/
  30.  
  31. /* Event handlers for: Table (DIALOG) */
  32.  
  33. Table_Move:
  34.   PARSE VALUE Table.Position() WITH tabx taby tabxs tabys
  35.   SIGNAL RETURN
  36.  
  37. Table_Init:
  38.   PARSE ARG isclip
  39.   PARSE VALUE ScreenSize() WITH cx cy
  40.   CALL LoadCfg
  41.   CALL ShowTable
  42.   
  43.   CALL C199.IsDefault('C')
  44.   CALL C123.Hint 'Leave program '||progname
  45.   CALL C102.Add '00000000'||'  '||'000'||'  '||'00'||'  '||'NULL'
  46.   DO i = 1 TO 254
  47.       CALL C102.Add TRANSLATE(FORMAT(X2B(D2X(i)),8,0),'0',' ')||'  '||TRANSLATE(FORMAT(i,3,0),'0',' ')||'  '||D2X(i,2)||'  '||X2C(D2X(i))
  48.   END
  49.   CALL C102.Add '11111111'||'  '||'255'||'  '||'FF'||'  '||'BLANK'
  50.   
  51.   CALL Table.Show
  52.   CALL C102.Select 1
  53.   CALL C114.Select 1
  54.   IF isclip = 1 THEN DO
  55.       CALL C115.Text Clipboard()
  56.   END
  57.   CALL C115.Focus
  58.   SIGNAL RETURN
  59.  
  60. /* Event handlers for: C199 (CANVAS) */
  61.  
  62. Table_C199_ShowMenu:
  63.   'START /F E.exe Table.man'
  64.   SIGNAL RETURN
  65.  
  66. /* Event handlers for: C123 (PUSHBUTTON) */
  67.  
  68. Table_C123_Click:
  69.   Exit
  70.   SIGNAL RETURN
  71.  
  72. Table_C123_:
  73.   SIGNAL RETURN
  74.  
  75. /* Event handlers for: C122 (PUSHBUTTON) */
  76.  
  77. Table_C122_Click:
  78.   'View.exe Table.inf Manual'
  79.   SIGNAL RETURN
  80.  
  81. /* Event handlers for: C121 (PUSHBUTTON) */
  82.  
  83. Table_C121_Click:
  84.   isclip = 0
  85.   IF LENGTH(C115.Text()) > 0 THEN DO
  86.       isclip = 1
  87.       CALL Clipboard C115.Text()
  88.   END
  89.   CALL Table.Hide
  90.   '@START /B /C /MIN TableCP.cmd '||Table.C121.Text()||' '||isclip
  91.   Exit
  92.   SIGNAL RETURN
  93.  
  94. /* Event handlers for: C118 (PUSHBUTTON) */
  95.  
  96. Table_C118_Click:
  97.   myerr = 0
  98.   c2bin = ''
  99.   c2dec = ''
  100.   c2hex = ''
  101.   c2asc = ''
  102.   
  103.   IF LENGTH(C115.Text()) = 0 THEN DO
  104.       IF RxMessageBox('Nothing to convert. Enter string to convert and try again!',,,'ERROR') = 1 THEN DO
  105.       END
  106.   END
  107.   IF LENGTH(C115.Text()) > 0 THEN DO
  108.       SELECT
  109.       WHEN C111.Select() = 1 THEN CALL ConvertBIN
  110.       WHEN C112.Select() = 1 THEN CALL ConvertDEC
  111.       WHEN C113.Select() = 1 THEN CALL ConvertHEX
  112.       WHEN C114.Select() = 1 THEN CALL ConvertASC
  113.       OTHERWISE NOP
  114.       END
  115.   END
  116.   
  117.   SIGNAL RETURN
  118.  
  119. Table_C118_:
  120.   SIGNAL RETURN
  121.  
  122. /* Event handlers for: C117 (PUSHBUTTON) */
  123.  
  124. Table_C117_Click:
  125.   CALL C115.Text ''
  126.   SIGNAL RETURN
  127.  
  128. /* Event handlers for: C116 (PUSHBUTTON) */
  129.  
  130. Table_C116_Click:
  131.   CALL C115.Text Clipboard()
  132.   SIGNAL RETURN
  133.  
  134. /* Event handlers for: C102 (LISTBOX) */
  135.  
  136. Table_C102_Enter:
  137.   CALL Clipboard X2C(D2X(C102.Select()-1))
  138.   dummy = BEEP(450,100)
  139.   SIGNAL RETURN
  140.  
  141. /*-----------------------------------------------------------------------------+
  142. |                                                                              |
  143. |  Event handlers for dialog: Result                                           |
  144. |                                                                              |
  145. +-----------------------------------------------------------------------------*/
  146.  
  147. /* Event handlers for: Result (DIALOG) */
  148.  
  149. Result_Init:
  150.   CALL Result.Text progname||' - Conversion result'
  151.   PARSE VALUE Result.Frame() WITH rfl rfb rfr rft 
  152.   CALL ShowResult
  153.   
  154.   CALL C201.Font monoFont
  155.   CALL C202.Font monoFont
  156.   CALL C203.Font monoFont
  157.   CALL C204.Font monoFont
  158.   CALL C201.Text STRIP(c2bin)
  159.   CALL C202.Text STRIP(c2dec)
  160.   CALL C203.Text STRIP(c2hex)
  161.   c2asc = TRANSLATE(c2asc,' ','00'x)
  162.   CALL C204.Text c2asc
  163.   CALL Table.Disable
  164.   CALL Result.Show
  165.   SIGNAL RETURN
  166.  
  167. /* Event handlers for: C210 (PUSHBUTTON) */
  168.  
  169. Result_C210_Click:
  170.   c2bin = ''
  171.   c2dec = ''
  172.   c2hex = ''
  173.   c2asc = ''
  174.   CALL C201.Text ''
  175.   CALL C202.Text ''
  176.   CALL C203.Text ''
  177.   CALL C204.Text ''
  178.   CALL Result.Close
  179.   CALL Table.Enable
  180.   SIGNAL RETURN
  181.  
  182. /* Event handlers for: C209 (PUSHBUTTON) */
  183.  
  184. Result_C209_Click:
  185.   CALL WriteMe.Open
  186.   SIGNAL RETURN
  187.  
  188. /* Event handlers for: C214 (PUSHBUTTON) */
  189.  
  190. Result_C214_Click:
  191.   CALL Clipboard c2asc
  192.   dummy = BEEP(500,100)
  193.   SIGNAL RETURN
  194.  
  195. /* Event handlers for: C213 (PUSHBUTTON) */
  196.  
  197. Result_C213_Click:
  198.   CALL Clipboard STRIP(c2hex)
  199.   dummy = BEEP(500,100)
  200.   SIGNAL RETURN
  201.  
  202. /* Event handlers for: C212 (PUSHBUTTON) */
  203.  
  204. Result_C212_Click:
  205.   CALL Clipboard STRIP(c2dec)
  206.   dummy = BEEP(500,100)
  207.   SIGNAL RETURN
  208.  
  209. /* Event handlers for: C211 (PUSHBUTTON) */
  210.  
  211. Result_C211_Click:
  212.   CALL Clipboard STRIP(c2bin)
  213.   dummy = BEEP(500,100)
  214.   SIGNAL RETURN
  215.  
  216. /*-----------------------------------------------------------------------------+
  217. |                                                                              |
  218. |  Event handlers for dialog: WriteMe                                          |
  219. |                                                                              |
  220. +-----------------------------------------------------------------------------*/
  221.  
  222. /* Event handlers for: WriteMe (DIALOG) */
  223.  
  224. WriteMe_Init:
  225.   CALL WriteMe.Text progname||' - Write result to file'
  226.   CALL ShowWriteMe
  227.   
  228.   CALL C416.Select 1
  229.   CALL C417.Select 1
  230.   CALL C421.Select 1
  231.   CALL C422.Select 1
  232.   CALL C423.Select 1
  233.   CALL C424.Select 1
  234.   
  235.   CALL WriteMe.Show
  236.   SIGNAL RETURN
  237.  
  238. /* Event handlers for: C402 (PUSHBUTTON) */
  239.  
  240. WriteMe_C402_Click:
  241.   CALL WriteMe.Close
  242.   SIGNAL RETURN
  243.  
  244. /* Event handlers for: C401 (PUSHBUTTON) */
  245.  
  246. WriteMe_C401_Click:
  247.   CALL WriteCol
  248.   CALL WriteMe.Close
  249.   SIGNAL RETURN
  250.  
  251. /*-----------------------------------------------------------------------------+
  252. |                                                                              |
  253. |  Global procedures:                                                          |
  254. |                                                                              |
  255. +-----------------------------------------------------------------------------*/
  256.  
  257. Strings:
  258.   c2bin = c2bin||' '||bchar
  259.   c2dec = c2dec||' '||dchar
  260.   c2hex = c2hex||' '||hchar
  261.   c2asc = c2asc||achar
  262.   
  263.   IF chars2conv > 100 & RIGHT(i,1) = 0 THEN DO
  264.       CALL Table.C199.Text 'Conversion - character: '||i||'/ '||chars2conv
  265.   END
  266.   
  267.   RETURN
  268.  
  269. Result:
  270.   IF myerr = 0 THEN DO
  271.       CALL Result.Open
  272.   END
  273.   RETURN
  274.  
  275. IsErr:
  276.   PARSE ARG errtype errchar
  277.   myerr = 1
  278.   IF RxMessageBox(errchar||' is not valid '||errtype||' character.'||'0D'x||'Please enter correct values.',,,'WARNING') = 1 THEN DO
  279.       CALL Table.C115.Text ''
  280.   END
  281.   RETURN
  282.  
  283. ShowWriteMe:
  284.   CALL WriteMe.Position rx, ry, rxs, rys
  285.   CALL WriteMe.C401.Position rfl*2, rfb*2, (rxs-rfl*5)%2, step+rfb
  286.   CALL WriteMe.C402.Position rfl*3+(rxs-rfl*5)%2, rfb*2, (rxs-rfl*5)%2, step+rfb
  287.   x420 = rfl
  288.   y420 = rfb*4+step
  289.   xs420 = rxs-rfl-rfr
  290.   ys420 = (rys-step-rft-rfb*6)%2
  291.   CALL WriteMe.C420.Position x420, y420, xs420, ys420
  292.   CALL WriteMe.C421.Position x420+rfb, y420+rfb+step*3, xs420-rfl-rfr, step
  293.   CALL WriteMe.C422.Position x420+rfb, y420+rfb+step*2, xs420-rfl-rfr, step
  294.   CALL WriteMe.C423.Position x420+rfb, y420+rfb+step, xs420-rfl-rfr, step
  295.   CALL WriteMe.C424.Position x420+rfb, y420+rfb, xs420-rfl-rfr, step
  296.   x410 = rfl
  297.   y410 = y420+ys420
  298.   xs410 = rxs-rfl-rfr
  299.   ys410 = rys-step-rft-rfb*4-ys420
  300.   CALL WriteMe.C410.Position x410, y410, xs410, ys410
  301.   CALL WriteMe.C411.Position x410+rfb, y410+step*3+rfb*2, (rxs-rfl*5)%2, step
  302.   CALL WriteMe.C412.Position rfl*3+(rxs-rfl*5)%2, y410+step*3+rfb*2, (rxs-rfl*5)%2, step
  303.   CALL WriteMe.C413.Position x410+rfb, y410+step*2+rfb, (rxs-rfl*5)%2, step
  304.   CALL WriteMe.C414.Position rfl*3+(rxs-rfl*5)%2, y410+step*2+rfb, step*2, step
  305.   CALL WriteMe.C415.Position rfl*3+(rxs-rfl*5)%2+step*2, y410+step*2+rfb, (rxs-rfl*5)%2-step*2, step
  306.   CALL WriteMe.C416.Position x410+rfb, y410+step+rfb, rxs-rfl*2-rfr*2, step
  307.   CALL WriteMe.C417.Position x410+rfb, y410+rfb, rxs-rfl*2-rfr*2, step
  308.   RETURN
  309.  
  310. ShowResult:
  311.   rx = tabx
  312.   ry = taby+step+rfb*2
  313.   rxs = tabxs
  314.   rys = tabys-step-rfb*2
  315.   strw = rxs*10%13
  316.   CALL Result.Position rx, ry, rxs, rys
  317.   CALL Result.C209.Position rfl*2, rfb*2, (rxs-rfl*5)%2, step
  318.   CALL Result.C210.Position rfl*3+(rxs-rfl*5)%2, rfb*2, (rxs-rfl*5)%2, step
  319.   x204 = rfl*2
  320.   y204 = rfb*3+step
  321.   xs204 = strw
  322.   ys204 = step*2-rfb*3
  323.   CALL Result.C204.Position x204, y204, xs204, ys204
  324.   CALL Result.C214.Position rfl*3+strw, y204, rxs-strw-rfl*5, ys204
  325.   x203 = rfl*2
  326.   y203 = rfb*4+step+ys204
  327.   xs203 = strw
  328.   ys203 = step*2
  329.   CALL Result.C203.Position x203, y203, xs203, ys203
  330.   CALL Result.C213.Position rfl*3+strw, y203, rxs-strw-rfl*5, ys203
  331.   x202 = rfl*2
  332.   y202 = rfb*5+step+ys204+ys203
  333.   xs202 = strw
  334.   ys202 = step*3+rfb
  335.   CALL Result.C202.Position x202, y202, xs202, ys202
  336.   CALL Result.C212.Position rfl*3+strw, y202, rxs-strw-rfl*5, ys202
  337.   x201 = rfl*2
  338.   y201 = rfb*6+step+ys204+ys203+ys202
  339.   xs201 = strw
  340.   ys201 = rys-rft-ys202-ys203-ys204-rfb*7-step
  341.   CALL Result.C201.Position x201, y201, xs201, ys201
  342.   CALL Result.C211.Position rfl*3+strw, y201, rxs-strw-rfl*5, ys201
  343.   RETURN
  344.  
  345. ShowTable:
  346.   tabx = (cx-tabxs)%2
  347.   taby = (cy-tabys)%2
  348.   CALL Table.Position tabx, taby, tabxs, tabys
  349.   PARSE VALUE TABLE.Frame() WITH tfl tfr tfb tft
  350.   CALL Table.C199.Position tfl, tfb, tabxs*4%5, step+tfb
  351.   x104 = tfl
  352.   y104 = tfb*2+step
  353.   xs104 = tabxs*6%11
  354.   ys104 = tabys-tfb*2-tft-step
  355.   CALL Table.C104.Position x104, y104, xs104, ys104
  356.   CALL Table.C102.Position x104+tfl, y104+tfb, xs104-tfl-tfr, ys104-tfb*2-step
  357.   x103 = tfl+xs104
  358.   y103 = tfb*2+step
  359.   xs103 = tabxs-xs104-tfl-tfr
  360.   ys103 = tabys-tfb*2-tft-step
  361.   CALL Table.C103.Position x103, y103, xs103, ys103
  362.   CALL Table.C111.Position x103+tfl, y103+ys103-step-tfb*2, (xs103-tfl*2)%4, step
  363.   CALL Table.C112.Position x103+tfl+(xs103-tfl*2)%4, y103+ys103-step-tfb*2, (xs103-tfl*2)%4, step
  364.   CALL Table.C113.Position x103+tfl+((xs103-tfl*2)*2)%4, y103+ys103-step-tfb*2, (xs103-tfl*2)%4, step
  365.   CALL Table.C114.Position x103+tfl+((xs103-tfl*2)*3)%4, y103+ys103-step-tfb*2, (xs103-tfl*2)%4, step
  366.   CALL Table.C115.Position x103+tfl, y103+step+tfb*3, xs103-tfl-tfr, ys103-step*3
  367.   CALL Table.C116.Position x103+tfl, y103+tfb, (xs103-tfl*4)%3, step+tfb
  368.   CALL Table.C117.Position x103+tfl*2+(xs103-tfl*4)%3, y103+tfb, (xs103-tfl*4)%3, step+tfb
  369.   CALL Table.C118.Position x103+tfl*3+((xs103-tfl*4)*2)%3, y103+tfb, (xs103-tfl*4)%3, step+tfb
  370.   
  371.   CALL Table.C199.Position tfl, tfb, xs104, step+tfb
  372.   CALL Table.C121.Position x103, tfb, xs103%3, step+tfb
  373.   CALL Table.C122.Position x103+xs103%3, tfb, xs103%3, step+tfb
  374.   CALL Table.C123.Position x103+(xs103*2)%3, tfb, xs103%3, step+tfb
  375.   RETURN
  376.  
  377. LoadCfg:
  378.   IF RxFuncQuery('SysLoadFuncs') THEN DO
  379.       CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  380.       CALL SysLoadFuncs
  381.   END
  382.   progname = 'Table 1.11'
  383.   propFont = "9.WarpSans"
  384.   monoFont = "10.System VIO"
  385.   oldFont = Table.Font(propFont)
  386.   oldFont = Table.C102.Font(monoFont)
  387.   oldFont = Table.C104.Font(monoFont)
  388.   oldFont = Table.C115.Font(monoFont)
  389.   ishelp = 0
  390.   valbin = '01'
  391.   valdec = '0123456789'
  392.   valhex = '0123456789ABCDEFabcdef'
  393.   tabxs = 400
  394.   tabys = 300
  395.   step = 21
  396.   
  397.   '@DEL Table_CP.txt'
  398.   '@CHCP > Table_CP.txt'
  399.   rc = STREAM('Table_CP.txt',"c","OPEN READ")
  400.   selpage = LINEIN('Table_CP.txt',1,1)
  401.   prepage =  LINEIN('Table_CP.txt')
  402.   rc = STREAM('Table_CP.txt',"c","CLOSE")
  403.   '@DEL Table_CP.txt'
  404.   
  405.   selpage = STRIP(selpage)
  406.   thispage = WORD(selpage,WORDS(selpage))
  407.   prepage = SPACE(STRIP(TRANSLATE(SUBSTR(prepage,POS(':',prepage)+1), ,',')),1)
  408.   CALL Table.C121.Text 'Select '||selpage1
  409.   selpage1 = thispage
  410.   IF WORDS(prepage) > 1 THEN DO
  411.       selpage1 = WORD(prepage,1)
  412.       selpage2 = WORD(prepage,2)
  413.       CALL Table.C121.Show
  414.       SELECT
  415.       WHEN selpage1 = thispage THEN CALL Table.C121.Text selpage2
  416.       WHEN selpage2 = thispage THEN CALL Table.C121.Text selpage1
  417.       OTHERWISE NOP
  418.       END
  419.       CALL Table.C121.Hint 'Select code page '||Table.C121.Text()
  420.   END
  421.   CALL Table.Text progname||',  '||selpage||', Prepared: '||prepage
  422.   RETURN
  423.  
  424. WriteCol:
  425.   myFile = WriteMe.C412.Text()
  426.   myWidth = WriteMe.C414.Text()
  427.   IF DATATYPE(myWidth)<>'NUM' THEN DO
  428.       myWidth = 80
  429.   END
  430.   recNo = WriteMe.C416.Select()
  431.   areSpaces = WriteMe.C417.Select()
  432.   'del '||myFile
  433.   writeLine = 0
  434.   cols = 0
  435.   binLine = ''
  436.   decLine = ''
  437.   hexLine = ''
  438.   ascLine = ''
  439.   ascCols = 1
  440.   binCols = 9
  441.   decCols = 4
  442.   hexCols = 3
  443.   binText = Result.C201.Text()
  444.   decText = Result.C202.Text()
  445.   hexText = Result.C203.Text()
  446.   IF areSpaces = 0 THEN DO
  447.       binCols = 8
  448.       decCols = 3
  449.       hexCols = 2
  450.       binText = SPACE(binText,0)
  451.       decText = SPACE(decText,0)
  452.       hexText = SPACE(hexText,0)
  453.   END
  454.   ascText = TRANSLATE(Result.C204.Text(),'  ','0D0A'x)
  455.   myWidth = myWidth - 1
  456.   
  457.   IF WriteMe.C421.Select() = 1 THEN DO
  458.       cols = cols + binCols
  459.   END
  460.   IF WriteMe.C422.Select() = 1 THEN DO
  461.       cols = cols + decCols
  462.   END
  463.   IF WriteMe.C423.Select() = 1 THEN DO
  464.       cols = cols + hexCols
  465.   END
  466.   IF WriteMe.C424.Select() = 1 THEN DO
  467.       cols = cols + ascCols
  468.   END
  469.   IF areSpaces = 1 THEN DO
  470.       myWidth = myWidth - 7
  471.   END
  472.   
  473.   mychars = myWidth % cols
  474.   binLen = mychars * binCols
  475.   decLen = mychars * decCols
  476.   hexLen = mychars * hexCols
  477.   ascLen = mychars * ascCols
  478.   
  479.   rc = STREAM(myfile,"c","OPEN")
  480.   myText = 'Conversion result, generated with '||progname||' on '||DATE()||' at '||TIME()
  481.   CALL LINEOUT myFile,myText
  482.   CALL LINEOUT myFile,' '
  483.   
  484.   myTxt = ''
  485.   IF WriteMe.C421.Select() = 1 THEN DO
  486.       myTxt = myTxt||LEFT(' BIN',binLen+1)
  487.   END
  488.   IF WriteMe.C422.Select() = 1 THEN DO
  489.       myTxt = myTxt||LEFT(' DEC',decLen+1)
  490.   END
  491.   IF WriteMe.C423.Select() = 1 THEN DO
  492.       myTxt = myTxt||LEFT(' HEX',hexLen+1)
  493.   END
  494.   IF WriteMe.C424.Select() = 1 THEN DO
  495.        myTxt = myTxt||LEFT(' ASC',ascLen)
  496.   END
  497.   IF recNo = 1 THEN DO
  498.        myText = '  Chars'||myTxt
  499.   END
  500.   CALL LINEOUT myFile,myText
  501.   
  502.   DO i = 1 TO LENGTH(ascText) BY mychars
  503.       binPart = i*binCols-binCols+1
  504.       decPart = i*decCols-decCols+1
  505.       hexPart = i*hexCols-hexCols+1
  506.       ascPart = i*ascCols
  507.       endchar = i + mychars - 1
  508.       IF endchar > LENGTH(ascText) THEN DO
  509.       endchar = LENGTH(ascText)
  510.       END
  511.       statLine = RIGHT(i,3)||'-'||RIGHT(endchar,3)
  512.       IF WriteMe.C421.Select() = 1 THEN DO
  513.       binLine = ' '||LEFT(SUBSTR(binText,binPart,binLen),binLen)
  514.       END
  515.       IF WriteMe.C422.Select() = 1 THEN DO
  516.       decLine = ' '||LEFT(SUBSTR(decText,decPart,decLen),decLen)
  517.       END
  518.       IF WriteMe.C423.Select() = 1 THEN DO
  519.       hexLine = ' '||LEFT(SUBSTR(hexText,hexPart,hexLen),hexLen)
  520.       END
  521.       IF WriteMe.C424.Select() = 1 THEN DO
  522.       ascLine = ' '||LEFT(SUBSTR(ascText,ascPart,ascLen),ascLen)
  523.       END
  524.       myText = binLine||decLine||hexLine||ascLine
  525.       IF recNo = 1 THEN DO
  526.       myText = statLine||myText
  527.       END
  528.       CALL LINEOUT myFile,myText
  529.       writeLine = writeLine + 1
  530.       IF RIGHT(writeLine,1) = '0' THEN DO
  531.       CALL Table.C199.Text 'Writing line: '||writeLine
  532.       END
  533.   END
  534.   CALL LINEOUT myFile,' '
  535.   CALL LINEOUT myFile
  536.   rc = STREAM(myfile,"c","CLOSE")
  537.   dummy = BEEP(400,150)
  538.   IF RxMessageBox(DIRECTORY()||'\'||myFile||'0D0A'x||'To view file with OS/2 System editor press OK. To return to program press Cancel.','Result saved to:','OKCANCEL','INFORMATION') = 1 THEN DO
  539.       'START /F E.exe '||DIRECTORY()||'\'||myFile
  540.   END
  541.   RETURN
  542.  
  543. ConvertASC:
  544.   asc2conv = Table.C115.Text()
  545.   chars2conv = LENGTH(asc2conv)
  546.   DO i = 1 TO chars2conv
  547.       achar = SUBSTR(asc2conv,i,1)
  548.       hchar = RIGHT(C2X(achar),2,'0')
  549.       bchar = RIGHT(X2B(hchar),8,'0')
  550.       dchar = RIGHT(X2D(hchar),3,'0')
  551.       CALL Strings
  552.   END
  553.   asc2conv = ''
  554.   CALL Result
  555.   RETURN
  556.  
  557. ConvertHEX:
  558.   errtype = 'HEX'
  559.   hex2conv = Table.C115.Text()
  560.   chars2conv = WORDS(hex2conv)
  561.   DO i = 1 TO chars2conv
  562.       hchar = WORD(hex2conv,i)
  563.       IF LENGTH(hchar) > 2 THEN DO
  564.       hex2conv = ''
  565.       CALL IsErr errtype hchar
  566.       LEAVE
  567.       END
  568.       hchar = RIGHT(hchar,2,'0')
  569.       DO j = 1 TO LENGTH(hchar)
  570.       x = SUBSTR(hchar,j,1)
  571.       IF POS(x,valhex) = 0 THEN DO
  572.           hex2conv = ''
  573.           CALL IsErr errtype hchar
  574.           LEAVE
  575.       END
  576.       END
  577.       IF myerr = 0 THEN DO
  578.       bchar = RIGHT(X2B(hchar),8,'0')
  579.       dchar = RIGHT(X2D(hchar),3,'0')
  580.       achar = X2C(hchar)
  581.       CALL Strings
  582.       END
  583.   END
  584.   hex2conv = ''
  585.   CALL Result
  586.   RETURN
  587.  
  588. ConvertDEC:
  589.   errtype = 'DEC'
  590.   dec2conv = Table.C115.Text()
  591.   chars2conv = WORDS(dec2conv)
  592.   DO i = 1 TO chars2conv
  593.       dchar = WORD(dec2conv,i)
  594.       IF LENGTH(dchar) > 3 THEN DO
  595.       dec2conv = ''
  596.       CALL IsErr errtype dchar
  597.       LEAVE
  598.       END
  599.       dchar = RIGHT(dchar,3,'0')
  600.       DO j = 1 TO LENGTH(dchar)
  601.       x = SUBSTR(dchar,j,1)
  602.       IF POS(x,valdec) = 0 THEN DO
  603.           dec2conv = ''
  604.           CALL IsErr errtype dchar
  605.           LEAVE
  606.       END
  607.       END
  608.       IF  dchar > 255 THEN DO
  609.       dec2conv = ''
  610.       CALL IsErr dchar
  611.       LEAVE
  612.       END
  613.       IF myerr = 0 THEN DO
  614.       hchar = D2X(dchar,2)
  615.       bchar = RIGHT(X2B(hchar),8,'0')
  616.       achar = X2C(hchar)
  617.       CALL Strings
  618.       END
  619.   END
  620.   dec2conv = ''
  621.   CALL Result
  622.   RETURN
  623.  
  624. ConvertBIN:
  625.   errtype = 'BIN'
  626.   bin2conv = Table.C115.Text()
  627.   chars2conv = WORDS(bin2conv)
  628.   DO i = 1 TO chars2conv
  629.       bchar = WORD(bin2conv,i)
  630.       IF LENGTH(bchar) > 8 THEN DO
  631.       bin2conv = ''
  632.       CALL IsErr errtype bchar
  633.       LEAVE
  634.       END
  635.       bchar = RIGHT(bchar,8,'0')
  636.       DO j = 1 TO LENGTH(bchar)
  637.       x = SUBSTR(bchar,j,1)
  638.       IF POS(x,valbin) = 0 THEN DO
  639.           bin2conv = ''
  640.           CALL IsErr errtype bchar
  641.           LEAVE
  642.       END
  643.       END
  644.       IF myerr = 0 THEN DO
  645.       hchar = RIGHT(B2X(bchar),2,'0')
  646.       dchar = RIGHT(X2D(hchar),3,'0')
  647.       achar = X2C(hchar)
  648.       CALL Strings
  649.       END
  650.   END
  651.   bin2conv = ''
  652.   CALL Result
  653.   RETURN
  654.  
  655. /*-----------------------------------------------------------------------------+
  656. |                                                                              |
  657. |  Default initialization:                                                     |
  658. |                                                                              |
  659. +-----------------------------------------------------------------------------*/
  660.  
  661. INIT:
  662.   SIGNAL RETURN
  663.  
  664. /*-----------------------------------------------------------------------------+
  665. |                                                                              |
  666. |  Default error handlers:                                                     |
  667. |                                                                              |
  668. +-----------------------------------------------------------------------------*/
  669.  
  670. SYNTAX:
  671.   SAY 'SYNTAX ERROR:' errortext( rc ) 'in:'
  672.   SAY sourceline( sigl )
  673.   SIGNAL ON SYNTAX
  674.   SIGNAL RETURN
  675.  
  676. HALT:
  677.   SAY 'HALT occurred in:'
  678.   SAY sourceline( sigl )
  679.   SIGNAL ON HALT
  680.   SIGNAL RETURN
  681.