home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / SASC6571.LZX / extras / ttx / rexx / SetDefs.ttx < prev    next >
Encoding:
Text File  |  1996-12-24  |  1.6 KB  |  60 lines

  1. /*
  2. **  $VER: SetDefs.ttx 2.1 (17.8.93)
  3. **       By Kenneth Yarnall.  This code may be freely distributed.
  4. **
  5. **  This macro should be attached to the open functions of TTX (see
  6. ** instructions).  It checks the extension of the filename, and loads the
  7. ** appropriate dfn file, if it recognizes the file type.  See the
  8. ** instructions for more info.
  9. **
  10. **  Current extensions:  c, h, cpp, cxx, tex.  Add at your leisure.
  11. */
  12.  
  13. Options RESULTS
  14.  
  15. GetFileInfo
  16. parse var RESULT . . '"'name'"'
  17.  
  18. if name ~= "" then do
  19.     dotpos = LastPos('.', name)
  20.     if dotpos = 0 then
  21.         new.ext = ""
  22.     else
  23.         new.ext = SubStr(name, dotpos+1)
  24. end
  25. else
  26.     exit 0
  27.  
  28. if new.ext == GetClip('extension') then
  29.     exit 0
  30.  
  31. select
  32.     when new.ext = 'c' then do
  33.         SetClip('extension',new.ext)
  34.         OpenDefinitions "TURBOTEXT:Support/TTX_Startup.dfn"
  35.         OpenDefinitions "TURBOTEXT:Support/TTX_SASC.dfn"
  36.     end
  37.     when new.ext = 'h' then do
  38.         SetClip('extension',new.ext)
  39.         OpenDefinitions "TURBOTEXT:Support/TTX_Startup.dfn"
  40.         OpenDefinitions "TURBOTEXT:Support/TTX_SASC.dfn"
  41.     end
  42.     when new.ext = 'cpp' then do
  43.         SetClip('extension',new.ext)
  44.         OpenDefinitions "TURBOTEXT:Support/TTX_Startup.dfn"
  45.         OpenDefinitions "TURBOTEXT:Support/TTX_SASC.dfn"
  46.     end
  47.     when new.ext = 'cxx' then do
  48.         SetClip('extension',new.ext)
  49.         OpenDefinitions "TURBOTEXT:Support/TTX_Startup.dfn"
  50.         OpenDefinitions "TURBOTEXT:Support/TTX_SASC.dfn"
  51.     end
  52.     when new.ext = 'tex' then do
  53.         SetClip('extension',new.ext)
  54.         OpenDefinitions "TURBOTEXT:Support/TTX_Startup.dfn"
  55.         OpenDefinitions "TURBOTEXT:Support/TTX_TeX.dfn"
  56.     end
  57.     otherwise
  58.         NOP
  59. end
  60.