home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / hp / 14513 < prev    next >
Encoding:
Text File  |  1993-01-05  |  2.3 KB  |  85 lines

  1. Newsgroups: comp.sys.hp
  2. Path: sparky!uunet!pipex!bnr.co.uk!bnrgate!corpgate!brtph560!brtph46!rjohns
  3. From: rjohns@brtph46.BNR.CA (Richard Johns P205)
  4. Subject: Bad escape codes on 9000/720?
  5. Message-ID: <1993Jan5.170026.16862@brtph560.bnr.ca>
  6. Sender: news@brtph560.bnr.ca (Usenet News)
  7. Reply-To: rjohns@brtph46.BNR.CA (Richard Johns P205)
  8. Organization: Bell-Northern Research Ltd.
  9. Date: Tue, 5 Jan 1993 17:00:26 GMT
  10. Lines: 73
  11.  
  12. I'm using HP Pascal on a 9000/720 under HP-UX 8.07.  It seems that the
  13. escapecode function isn't returning the correct values for runtime errors.  For
  14. example, resetting a file with permissions of 000 should raise an escapecode
  15. of 692 (FILE OPEN ERROR), but instead it's a huge number -- garbage.  Raising
  16. a escape code myself works, though.
  17.  
  18. Here's my sample program and output.  Any ideas?  Thanks.
  19.  
  20. ------------cut here----------------------
  21.  
  22. $STANDARD_LEVEL 'HP_MODCAL'$
  23. program t(input, output);
  24.  
  25. var
  26.   esc_code : integer;
  27.   i : integer;
  28.   file_var : text;
  29. begin
  30.   TRY
  31.     begin
  32.       {try our own escape code -- this works}
  33.       escape(21);
  34.     end;
  35.   RECOVER
  36.     begin
  37.       esc_code := escapecode;
  38.       writeln('Raised escape code - escape code should be 21');
  39.       writeln('  escape code = ', esc_code:1);
  40.     end;
  41.   TRY
  42.     begin
  43.       i := 1;
  44.       i := i div 0;
  45.     end;
  46.   RECOVER
  47.     begin
  48.       esc_code := escapecode;
  49.       writeln('integer divide by zero - escape code should be 512 (?)');
  50.       writeln('  escape code = ', esc_code:1);
  51.     end;
  52.   TRY
  53.     begin
  54.       {file 'no_rights' has permissions set to zero so reset fails}
  55.       reset(file_var, 'no_rights');
  56.       writeln('opened ok');
  57.     end;
  58.   RECOVER
  59.     begin
  60.       esc_code := escapecode;
  61.       writeln('Couldn''t open file - escape code should be 692');
  62.       writeln('  escape code = ', esc_code:1);
  63.     end;
  64. end.
  65.  
  66. ------------cut here----------------------
  67.  
  68. Raised escape code - escape code should be 21
  69.   escape code = 21
  70. integer divide by zero - escape code should be 512 (?)
  71.   escape code = 1966280
  72. Couldn't open file - escape code should be 692
  73.   escape code = 45351104
  74.  
  75.  
  76. ==============================================================================
  77. ==============================================================================
  78.  
  79. Cheers,
  80.  Rick Johns
  81.  BNR
  82.  rjohns@bnr.ca
  83.  
  84. Disclaimer: I said it, BNR didn't.
  85.