home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 4 / AACD04.ISO / AACD / Programming / envsof20 / eiffel / rexx / view_as.ged < prev   
Encoding:
Text File  |  1999-08-24  |  2.6 KB  |  95 lines

  1. /*
  2.  * view_as.ged -- Open (cached) class in same window in a different view
  3.  *
  4.  * Copyright (C) 1999 Thomas Aglassiner <agi@sbox.tu-graz.ac.at>
  5.  * Freeware. Use at your own risk.
  6.  */
  7. version_info = "$VER: view_as_short.ged 1.0 (20.8.99)"
  8.  
  9. Call AddLib('rexxsupport.library', 0, -30, 0)
  10. Call AddLib('rexxdossupport.library', 0, -30, 0)
  11.  
  12. OPTIONS RESULTS                             /* enable return codes     */
  13.  
  14. if (LEFT(ADDRESS(), 6) ~= "GOLDED") then    /* not started by GoldEd ? */
  15.     address 'GOLDED.1'
  16.  
  17. 'LOCK CURRENT RELEASE=6'                    /* lock GUI, gain access   */
  18.  
  19. if (RC ~= 0) then
  20.     exit
  21.  
  22. OPTIONS FAILAT 21
  23.  
  24. SIGNAL ON SYNTAX                            /* ensure clean exit       */
  25.  
  26. /* Set default options */
  27. template = 'Mode/A,Options/F'
  28. cli.mode = ''
  29. cli.options = ''
  30.  
  31. /* Check Arguments */
  32. argument_error = ''
  33. Parse Arg arguments
  34. if ~ReadArgs(arguments, template, 'cli.') then do
  35.    argument_error =  Fault(RC) || '*N(Template is ' || template || ')'
  36. end
  37.  
  38. cli.mode = Upper(cli.mode)
  39. if Index("CLASS SHORT", cli.mode) = 0 then do
  40.    argument_error = 'MODE must be one of CLASS or SHORT'
  41. end
  42.  
  43. if argument_error ~= '' then do
  44.    'REQUEST TITLE="Error in arguments to view_as.ged" PROBLEM="' || argument_error || '"'
  45.    Call cleanup
  46. end
  47.  
  48. /* Start being productive */
  49. rexx_path = 'GoldEd:add-ons/eiffel/rexx/'
  50. update_command_script = rexx_path || 'update_short.rexx'
  51.  
  52. 'QUERY DOC VAR=class_path'
  53.  
  54. separator_index = max(lastpos(':', class_path), lastpos('/',  class_path)) + 1
  55. Parse Var class_path class_directory =separator_index class_name
  56.  
  57. if cli.mode = 'CLASS' then do
  58.    cache_index = LastPos('sofa/', class_directory) - 1
  59.    real_directory = Left(class_directory, cache_index)
  60.    class_path = real_directory || class_name
  61.    'OPEN NAME="' || class_path || '"'
  62. end
  63. else if cli.mode = 'SHORT' then do
  64.    short_path = class_directory || 'sofa/short/' || class_name
  65.    update_command = update_command_script || ' "' || class_path || '" Quiet Port="' || Address() || '"'
  66.    Address Command 'rx ' || update_command
  67.    if RC = 0 then do
  68.       'OPEN NAME="' || short_path || '"'
  69.    end
  70.    else do
  71.        Call view_class_error('View as short Error')
  72.    end
  73. end
  74.  
  75. CLEANUP:
  76.  
  77. 'UNLOCK' /* unlock GUI */
  78. exit
  79.  
  80. /* View class error message */
  81. view_class_error:
  82.    Parse Arg title
  83.    'REQUEST STATUS=""'
  84.    'REQUEST TITLE="' || title || '" PROBLEM="Cannot find class ''' || class_name || '''.*NMake sure that*N· the current directory of GoldEd is the same as for the compiler,*N· the class path (loadpath.se) is set properly*N· the class name is typed properly and the file exists.*N"'
  85.    Return
  86.  
  87. /* Syntax error handler */
  88. SYNTAX:
  89.    Say "Syntax error line" SIGL ":" ErrorText(RC)
  90.    'UNLOCK'
  91.  
  92.    exit
  93.  
  94.  
  95.