home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / ME494-6.ZIP / MEERROR.SRC < prev    next >
Encoding:
Text File  |  1990-05-25  |  8.9 KB  |  296 lines

  1. $MACRO_FILE MEERROR;
  2. {******************************************************************************
  3.                                                      MULTI-EDIT MACRO FILE MEERROR
  4. MEERROR - Main error handing
  5. MESSAGEBOX - Puts a message box on the screen
  6. ERRMSG - Returns verbose error messages
  7.  
  8.                              (C) Copyright 1989 by American Cybernetics, Inc.
  9. ******************************************************************************}
  10.  
  11. $MACRO MEERROR FROM ALL TRANS;
  12. {******************************************************************************
  13.                                                                 MULTI-EDIT MACRO
  14.  
  15. Name: MEERROR
  16.  
  17. Description:    Multi-Edit's main error handling.
  18.  
  19. Parameters: /EM=str  Error message override.
  20.                              (C) Copyright 1989 by American Cybernetics, Inc.
  21. ******************************************************************************}
  22.     def_str( estr[20] );
  23.     if error_level <> 0 then
  24.         Return_Str := parse_str('/EM=', mparm_str);
  25.         if return_str = '' then
  26.             RM('ERRMSG');
  27.         end;
  28.         IF return_int = 1 THEN
  29.             estr := 'WARNING';
  30.         ELSE
  31.             estr := 'ERROR';
  32.         END;
  33.         RM('MessageBox /B=2/T=' + estr + ' #' + str(error_level) + '/M=' + return_str );
  34.         ERROR_LEVEL := 0;
  35.     end;
  36. END_MACRO;
  37.  
  38. {*******************************MULTI-EDIT MACRO******************************
  39.  
  40. Name: MessageBox
  41.  
  42. Description: Puts a message box on the screen (using ERROR_COLOR).  Waits
  43.     for the user to press a key.
  44.  
  45. Parameters:    /T=str        box title
  46.                         /M=str        message
  47.                         /B=n            beep count.
  48.             /Y=n      The starting row position, the box will automatically
  49.                         be centered in the screen.
  50.                         /NW=n            Do NOT wait for a key, and don't kill the box.
  51.  
  52.                              (C) Copyright 1989 by American Cybernetics, Inc.
  53. ******************************************************************************}
  54. $MACRO MESSAGEBOX FROM ALL;
  55.   def_int( tr, w, tc, tx, jx, message_count,y );
  56.     def_str( tstr );
  57.  
  58.     tr := refresh;
  59.     refresh := false;
  60.     tStr := parse_str('/M=', mparm_str);
  61.   y := parse_int('/Y=',mparm_str);
  62.   IF y = 0 THEN
  63.     y := 4;
  64.   END;
  65.     message_count := 1;
  66.     tx := 1;
  67.     w := 26;
  68.     While (svl(tstr) > (screen_width - 6)) AND (tx > 0) DO
  69.         tx := screen_width - 6;
  70.         WHILE (str_char(tstr,tx) <> ' ') AND (tx > 0) DO
  71.             --tx;
  72.         END;
  73.         set_global_str( '!MBSTR!' + str(message_count), shorten_str(copy(tstr,1,tx)));
  74.         jx := length(global_str('!MBSTR!' + str(message_count)));
  75.         IF jx > w THEN
  76.             w := jx;
  77.         END;
  78.         ++message_count;
  79.         tstr := copy(tstr,tx + 1, 254);
  80.     END;
  81.  
  82.     tstr := shorten_str(tstr);
  83.     jx := svl(tstr);
  84.     IF jx = 0 THEN
  85.         --message_count;
  86.     ELSE
  87.         set_global_str( '!MBSTR!' + str(message_count), tstr);
  88.         IF jx > w THEN
  89.             w := jx;
  90.         END;
  91.     END;
  92.  
  93.     tx := (screen_width / 2) - (w / 2 );
  94.     tc := tx - 1;
  95.     if w < 24 then
  96.         w := 24;
  97.         tc := (screen_width / 2) - (w / 2 ) - 1;
  98.     END;
  99.   IF (y + message_count + 2) > (screen_length) THEN
  100.     y := screen_length - message_count - 3;
  101.   END;
  102.   Put_Box(tc,y,tc + w + 4,y + 3 + message_count,0,Error_Color,parse_str('/T=', mparm_str),true);
  103.     jx := 0;
  104.     while jx < message_count DO
  105.         ++jx;
  106.     WRITE(global_str('!MBSTR!' + str(jx)),tx, y + jx, 0, Error_Color);
  107.     END;
  108.     IF parse_int('/NW=',mparm_str) = 0 THEN
  109.       Write('<Press ANY key to continue>',(screen_width / 2) - 13 , y + 1 + message_count,0,error_Color);
  110.     END;
  111.     RM('BEEPS /C=' + parse_str('/B=',mparm_str));
  112.     IF parse_int('/NW=',mparm_str) = 0 THEN
  113.         READ_KEY;
  114.         Kill_Box;
  115.     END;
  116. EXIT:
  117.     jx := 0;
  118.     WHILE jx < message_count DO
  119.         ++jx;
  120.         Set_Global_Str('!MBSTR!' + str(jx),'');
  121.     END;
  122.     refresh := tr;
  123.  
  124. END_MACRO;
  125.  
  126. {*******************************MULTI-EDIT MACRO******************************
  127.  
  128. Name: BEEPS
  129.  
  130. Description:  Beeps count number of times, at a given frequency and
  131.                             duration.  A step value may be passed to create staircase
  132.                             effects.
  133.  
  134. Parameters:
  135.                             /C=n        Count (# of beeps)
  136.                             /D=n        Duration in 100ths of a second (default = 60);
  137.                             /F=n        Frequency (default = 520)
  138.                             /P=n        Pause (time between beeps, default = 40)
  139.                             /S=n        Step frequency (for staircase effect, positive goes
  140.                                                         up, negative goes down, default = 0)
  141.  
  142.                (C) Copyright 1989 by American Cybernetics, Inc.
  143. ******************************************************************************}
  144. $MACRO Beeps FROM ALL;
  145.     def_int( frequency, duration, pause, step, count );
  146.     frequency := parse_int('/F=', mparm_str );
  147.     duration := parse_int('/D=', mparm_str );
  148.     pause := parse_int('/P=', mparm_str );
  149.     step := parse_int('/S=', mparm_str );
  150.     count := parse_int('/C=', mparm_str);
  151.     IF frequency = 0 THEN
  152.         frequency := 520;
  153.     END;
  154.     IF duration = 0 THEN
  155.         duration := 60;
  156.     END;
  157.     IF pause = 0 THEN
  158.         pause := 40;
  159.     END;
  160.     WHILE count > 0 DO
  161.         --count;
  162.         sound(frequency);
  163.         delay(duration);
  164.         sound(0);
  165.         delay(pause);
  166.         frequency := frequency + step;
  167.     END;
  168. END_MACRO;
  169.  
  170.  
  171. $MACRO ERRMSG FROM ALL TRANS;
  172. {******************************************************************************
  173.                                                                 MULTI-EDIT MACRO
  174.  
  175. Name: ERRMSG
  176.  
  177. Description:    Returns a message string (in RETURN_STR) corresponding to the
  178.                         value in ERROR_LEVEL.
  179.  
  180.                              (C) Copyright 1989 by American Cybernetics, Inc.
  181. ******************************************************************************}
  182.  
  183.     Return_Str := '';
  184.  
  185.     return_int := 0;
  186.  
  187.     IF ERROR_LEVEL = 0 THEN
  188.         GOTO DO_ERROR;
  189.     END;
  190.  
  191.     { Multi-Edit errors }
  192.  
  193.     IF ERROR_LEVEL = 1001 THEN
  194.         Return_Str := 'No Windows Left';
  195.     ELSIF ERROR_LEVEL = 1002 THEN
  196.         Return_Str := 'Insufficient Memory to complete operation';
  197.     ELSIF ERROR_LEVEL = 1003 THEN
  198.         Return_Str := 'Maximum line length reached';
  199.     ELSIF ERROR_LEVEL = 1004 THEN
  200.         Return_Str := 'Operation Not Yet Supported';
  201.     ELSIF ERROR_LEVEL = 1006 THEN
  202.         Return_Str := 'Invalid Numeric Input';
  203.     ELSIF ERROR_LEVEL = 1007 THEN
  204.         Return_Str := 'HELP FILE not found';
  205.     ELSIF ERROR_LEVEL = 1010 THEN
  206.         Return_Str := 'Invalid Search String';
  207.     ELSIF ERROR_LEVEL = 1011 THEN
  208.         Return_Str := 'Input file NOT FOUND.  Save operation aborted.';
  209.     ELSIF ERROR_LEVEL = 1012 THEN
  210.         Return_Str := 'File is marked read-only.';
  211.     ELSIF ERROR_LEVEL = 1013 THEN
  212.         Return_Str := 'Save aborted by user.';
  213.     ELSIF ERROR_LEVEL = 1015 THEN
  214.         Return_Str := 'Operation aborted by user.';
  215.     ELSIF ERROR_LEVEL = 1018 THEN
  216.         Return_Str := 'Memory low:  UNDO information may be lost.';
  217.         return_int := 1;
  218.     ELSIF ERROR_LEVEL = 1016 THEN
  219.         Return_Str := 'No Memory left for UNDO buffer.';
  220.         return_int := 1;
  221.     ELSIF ERROR_LEVEL = 1017 THEN
  222.         Return_Str := 'Error saving backup file.';
  223.     ELSIF ERROR_LEVEL = 1020 THEN
  224.         Return_Str := 'Unable to create temporary file... Please make sure your Temporary File Directory is valid.';
  225.     ELSIF ERROR_LEVEL = 1030 then
  226.         Return_Str := 'Invalid DIR Window Number.';
  227.     ELSIF ERROR_LEVEL = 1031 then
  228.         Return_Str := 'DIR Window Not Open.';
  229.     ELSIF ERROR_LEVEL = 1050 then
  230.         Return_Str := 'Operation two large to store in undo buffer.';
  231.     { DOS errors }
  232.     ELSIF ERROR_LEVEL = 2002 then
  233.         Return_Str := 'Printer not ready.';
  234.     ELSIF ERROR_LEVEL = 3002 THEN
  235.         Return_Str := 'File Not Found';
  236.     ELSIF ERROR_LEVEL = 3003 THEN
  237.         Return_Str := 'Path Not Found';
  238.     ELSIF ERROR_LEVEL = 3005 THEN
  239.         Return_Str := 'Access Denied';
  240.     ELSIF ERROR_LEVEL = 3007 THEN
  241.         Return_Str := 'Memory Control blocks Destroyed';
  242.     ELSIF ERROR_LEVEL = 3008 THEN
  243.         Return_Str := 'Insufficient Memory';
  244.     ELSIF ERROR_LEVEL = 3010 THEN
  245.         Return_Str := 'Invalid Environment';
  246.     ELSIF ERROR_LEVEL = 3015 THEN
  247.         Return_Str := 'Invalid Drive';
  248.     ELSIF ERROR_LEVEL = 3018 THEN
  249.         Return_Str := 'No More Files';
  250.     ELSIF ERROR_LEVEL = 3021 THEN
  251. e1:
  252.         Return_Str := 'Device not ready';
  253.         goto do_error;
  254.     ELSIF ERROR_LEVEL = 3031 THEN
  255. e2:
  256.         Return_Str := 'General Failure';
  257.         goto do_error;
  258.     ELSIF ERROR_LEVEL = 3150 THEN
  259.         Return_Str := 'Write protect Error';
  260.     ELSIF ERROR_LEVEL = 3152 THEN
  261.         goto e1;
  262.     ELSIF ERROR_LEVEL = 3153 THEN
  263.         Return_Str := 'Unknown Command';
  264.     ELSIF ERROR_LEVEL = 3154 THEN
  265.         Return_Str := 'Data Error';
  266.     ELSIF ERROR_LEVEL = 3158 THEN
  267.         Return_Str := 'Sector Not Found';
  268.     ELSIF ERROR_LEVEL = 3159 THEN
  269.         Return_Str := 'Printer out of Paper';
  270.     ELSIF ERROR_LEVEL = 3160 THEN
  271.         Return_Str := 'Write fault';
  272.     ELSIF ERROR_LEVEL = 3161 THEN
  273.         Return_Str := 'Read fault';
  274.     ELSIF ERROR_LEVEL = 3162 THEN
  275.         goto e2;
  276.     ELSIF ERROR_LEVEL = 3241 THEN
  277.         Return_Str := 'Disk Full';
  278.     ELSIF ERROR_LEVEL = 5001 THEN
  279.         Return_Str := 'Macro "' + error_str + '" NOT Found';
  280.     ELSIF ERROR_LEVEL = 5005 THEN
  281.         Return_Str := 'Macro being loaded is an incompatible version';
  282.     ELSIF ERROR_LEVEL = 5006 THEN
  283.         Return_Str := 'Macros may not be debugged when loaded in EMS';
  284.     ELSIF ERROR_LEVEL = 8001 THEN
  285.         Return_Str := 'Link not found.';
  286.     ELSIF ERROR_LEVEL = 8002 THEN
  287.         Return_Str := 'Path to help files not valid.';
  288.     ELSIF ERROR_LEVEL = 8010 THEN
  289.         Return_Str := 'No occurrences found.';
  290.         return_int := 1;
  291.     ELSIF ERROR_LEVEL = 8011 THEN
  292.         Return_Str := 'Incompatible index format.';
  293.     END;
  294.  
  295. DO_ERROR:
  296. END_MACRO;