home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 283.lha / AmigaLibHost_v0.9 / fd2rx.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1989-09-07  |  1.1 KB  |  52 lines

  1. /* convert a .fd file to format used by AmigaLibHost */
  2.  
  3. parse arg infile ' ' outfile
  4.  
  5. if open('MyIn',infile,'Read') = 0 then exit 10
  6. if open('MyOut',outfile,'Write') = 0 then exit 10
  7.  
  8. say 'running...'
  9. say
  10.  
  11. bias = -30
  12. public = 1
  13.  
  14. do i = 1 while eof('MyIn') = 0
  15.     inline = readln('MyIn')
  16.  
  17.     if left(inline,1,'*') == '*' then iterate i
  18.  
  19.     if left(inline,2,' ') == '##' then do
  20.         if (substr(inline,3,4) == 'base') then do
  21.             libname = strip(substr(inline,9))
  22.             outline = '/* ' || libname || ' */'
  23.             writeln('MyOut',upper(outline))
  24.             writeln('MyOut',"")
  25.         end
  26.         if (substr(inline,3,4) == 'bias') then bias = '-' || strip(substr(inline,8))
  27.         if (substr(inline,3,6) == 'public') then public = 1
  28.         if (substr(inline,3,6) == 'private') then public = 0
  29.         iterate i
  30.     end
  31.  
  32.     if public = 1 then do
  33.         at = index(inline,'(')
  34.         fname = left(inline,at-1)
  35.  
  36.         outline = fname || '.BASE = ' || libname
  37.         writeln('MyOut',upper(outline))
  38.  
  39.         outline = fname || '.LVO = ' || bias
  40.         writeln('MyOut',upper(outline))
  41.         
  42.         outline = fname || '.CALL = ' || "'" || substr(inline,at) || "'"
  43.         writeln('MyOut',upper(outline))
  44.  
  45.         writeln('MyOut',"")
  46.     end
  47.  
  48.     bias = bias - 6
  49. end
  50.  
  51. say 'done...'
  52.