home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / CFWANSRX.ZIP / CFWANSI.CMD next >
OS/2 REXX Batch file  |  1992-08-09  |  3KB  |  112 lines

  1. /*╒════════════════════════════════════════════════════════════════╕
  2.   │    C.F.W ANSI-TREIBER   (C) Copyright 1992 by                  │
  3.   │                                                                │
  4.   │             C.F.W. Christian Fair Ware                         │
  5.   │                   Hölderlinweg 10                              │
  6.   │                   7043 Grafenau 2                              │
  7.   │                                                                │
  8.   │               Tel./FAX : (07033) 41 40 4                       │
  9.   │                                                                │
  10.   │════════════════════════════════════════════════════════════════│
  11.   │                                                                │
  12.   │  Parameter : 1 COMMAND : SS = SCREEN SIZE  , row , col         │
  13.   │                                                                │
  14.   │                          CL = COLOUR       , foreground, backg.│
  15.   │                                                                │
  16.   ╘════════════════════════════════════════════════════════════════╛
  17.  
  18. */
  19. trace on
  20. parse arg command,parm1,parm2
  21. command = translate(command)
  22. parm1   = translate(parm1)
  23. parm2   = translate(parm2)
  24. select
  25.   when command = 'SS'
  26.    then
  27.       do
  28.        rc= screen_mode(parm1,parm2)
  29.        return rc
  30.       end
  31.   when translate(strip(command)) = 'CL'
  32.    then
  33.       do
  34.        rc=ansi_handle(parm1,parm2)
  35.        return rc
  36.       end
  37.   otherwise
  38.       return 99
  39.  end
  40.  exit rc
  41. ansi_handle: procedure
  42.  seq=''
  43.  fg = ''
  44.  bg = ''
  45.  parse arg foreground,background
  46.  select
  47.    when substr(foreground,1,3) = 'RES'
  48.      then
  49.         call charout ,seq||'0m'
  50.    when substr(foreground,1,3) = 'BOL'
  51.      then
  52.         call charout ,seq||'1m'
  53.    when substr(foreground,1,3) = 'BLI'
  54.      then
  55.         call charout ,seq||'5m'
  56.    when substr(foreground,1,3) = 'INV'
  57.      then
  58.         call charout ,seq||'7m'
  59.    when substr(foreground,1,4) = 'INVI'
  60.      then
  61.         call charout ,seq||'8m'
  62.    otherwise
  63.      select
  64.        when substr(foreground,1,3) = 'BLA'
  65.          then fg = 30
  66.        when substr(foreground,1,3) = 'RED'
  67.          then fg = 31
  68.        when substr(foreground,1,3) = 'GRE'
  69.          then fg = 32
  70.        when substr(foreground,1,3) = 'YEL'
  71.          then fg = 33
  72.        when substr(foreground,1,3) = 'BLU'
  73.          then fg = 34
  74.        when substr(foreground,1,3) = 'MAG'
  75.          then fg = 35
  76.        when substr(foreground,1,3) = 'CYA'
  77.          then fg = 36
  78.        when substr(foreground,1,3) = 'WHI'
  79.          then fg = 37
  80.        otherwise
  81.           fg = 37
  82.      end
  83.      select
  84.        when substr(background,1,3) = 'BLA'
  85.          then bg = 40
  86.        when substr(background,1,3) = 'RED'
  87.          then bg = 41
  88.        when substr(background,1,3) = 'GRE'
  89.          then bg = 42
  90.        when substr(background,1,3) = 'YEL'
  91.          then bg = 43
  92.        when substr(background,1,3) = 'BLU'
  93.          then bg = 44
  94.        when substr(background,1,3) = 'MAG'
  95.          then bg = 45
  96.        when substr(background,1,3) = 'CYA'
  97.          then bg = 46
  98.        when substr(background,1,3) = 'WHI'
  99.          then bg = 47
  100.        otherwise
  101.           bg = 40
  102.      end
  103.   end
  104.   if fg <> '' & bg <> ''
  105.   then
  106.      call charout ,''||seq||fg||';'||bg||'m'
  107. return rc
  108. screen_mode: procedure
  109.  parse arg cols,rows
  110.  '@MODE CO'||cols','rows
  111. return rc
  112.