home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR36 / KEXX.ZIP / CC.KEX < prev    next >
Text File  |  1992-06-15  |  3KB  |  95 lines

  1. ************************************************
  2. * CC.KEX
  3. *
  4. * Function: Compile programs and locate the lines that generated
  5. *           compiler errors.
  6. * To run:   See CC.DOC for complete documentation.
  7. * Requires: KEDIT 5.0 and RUNCMD.KEX
  8. * Version:  2.0 (June, 1992)
  9. *
  10. * User set EDITV variables:
  11. *       CC_Extension  commands for specific extensions (no defaults)
  12. *       CC_NextKey    default: "Alt-N"
  13. *       CC_PrevKey    default: "Alt-P"
  14. *       CC_CurrKey    default: "Alt-T"
  15. *
  16. ************************************************
  17.  
  18. * If we are run as a profile, run the user's profile first.
  19. If Initial() Then Do
  20.    'Macro' DefProfile.1()
  21.    Arg = '-'
  22. End
  23. Else
  24.    Arg = Arg(1)
  25.  
  26. If Arg \= '-' Then Do
  27.    original_fileid = fileid.1()
  28.    * Write files to disk if necessary
  29.    Do I = 1 To NBFile.1()
  30.       'Kedit'
  31.       If \Alt() Then Iterate
  32.       FileName = FName.1()
  33.       FileExt = FExt.1()
  34.  
  35.       * Skip prompting for obviously unimportant files
  36.       If Dir() Then Iterate
  37.       If FileName = "MACROS" & FileExt = "KML" Then Iterate
  38.       If FileExt = "TMP" Then Iterate
  39.  
  40.       If Fileid.1() \= original_fileid then do
  41.          'Dialog /Save changes to' Fileid.1()'/ YESNOCANCEL'
  42.          If Dialog.2 = "CANCEL" Then Exit
  43.          If Dialog.2 = "NO" Then iterate
  44.       End
  45.       'NoMsg Save'
  46.       If RC \= 0 Then Do
  47.          M = 'Unable to save changes to' Fileid.1()''D2C(10)D2C(10)''LastMsg.1()
  48.          'Alert' Delimit(M) 'Title /Fatal Error/'
  49.          Exit 1
  50.       End
  51.    End
  52. End
  53.  
  54. 'Editv Get CC_NextKey CC_PrevKey CC_CurrKey'
  55.  
  56. If CC_NextKey = '' Then CC_NextKey = 'Alt-N'
  57. If CC_PrevKey = '' Then CC_PrevKey = 'Alt-P'
  58. If CC_CurrKey = '' Then CC_CurrKey = 'Alt-T'
  59.  
  60. * Get command, either from arg(1), file, or from editv variable
  61. If Arg \= '' Then Do
  62.    CC_Cmd = Arg
  63.    'Editv SetL CC_'FType.1() CC_Cmd
  64. End
  65. Else Do
  66.    SaveLine = Line.1()
  67.    'NoMsg Locate :0 Locate Blank | / cc: "/'
  68.    If RC = 0 & CurLine.3() \= '' Then Do
  69.       * Get value from file
  70.       CC_Cmd = SubStr(CurLine.3(), Target.4() + 1)
  71.       P = Pos('"', CC_Cmd)
  72.       If P = 0 Then Do
  73.          'Alert $No closing quote for CC: entry in file$ Title $CC$'
  74.          Exit
  75.       End
  76.       CC_Cmd = SubStr(CC_Cmd, 1, P - 1)
  77.    End
  78.    Else Do
  79.       * Get value from Editv variable
  80.       'NoMsg Editv List CC_'ftype.1()
  81.       If Word(LastMsg.1(), 2) = '' Then Do
  82.          m = 'No command found for extension ".'ftype.1()'".  To use CC, issue'
  83.          m = m || d2c(10) || '"CC your-compile-command" on the command line.'
  84.          'Alert' delimit(m) 'Title $CC$'
  85.          Exit
  86.       End
  87.          CC_Cmd = SubStr(LastMsg.1(), Length(Word(LastMsg.1(), 1)) + 1)
  88.    End
  89.    'Locate :'SaveLine
  90. End
  91.  
  92. 'Macro RunCmd /%m/ cc CC.TMP message' CC_NextKey CC_PrevKey CC_CurrKey 'DOSNOWAIT' CC_Cmd
  93.  
  94. Exit
  95.