tcase2.pp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const
  2. maxsmallint = high(smallint);
  3. { error codes }
  4. grOk = 0;
  5. grNoInitGraph = -1;
  6. grNotDetected = -2;
  7. grFileNotFound = -3;
  8. grInvalidDriver = -4;
  9. grNoLoadMem = -5;
  10. grNoScanMem = -6;
  11. grNoFloodMem = -7;
  12. grFontNotFound = -8;
  13. grNoFontMem = -9;
  14. grInvalidMode = -10;
  15. grError = -11;
  16. grIOerror = -12;
  17. grInvalidFont = -13;
  18. grInvalidFontNum = -14;
  19. grInvalidVersion = -18;
  20. function GraphErrorMsg(ErrorCode: smallint): string;
  21. Begin
  22. GraphErrorMsg:='';
  23. case ErrorCode of
  24. grOk,grFileNotFound,grInvalidDriver: exit;
  25. grNoInitGraph: GraphErrorMsg:='Graphics driver not installed';
  26. grNotDetected: GraphErrorMsg:='Graphics hardware not detected';
  27. grNoLoadMem,grNoScanMem,grNoFloodMem: GraphErrorMsg := 'Not enough memory for graphics';
  28. grNoFontMem: GraphErrorMsg := 'Not enough memory to load font';
  29. grFontNotFound: GraphErrorMsg:= 'Font file not found';
  30. grInvalidMode: GraphErrorMsg := 'Invalid graphics mode';
  31. grError: GraphErrorMsg:='Graphics error';
  32. grIoError: GraphErrorMsg:='Graphics I/O error';
  33. grInvalidFont,grInvalidFontNum: GraphErrorMsg := 'Invalid font';
  34. grInvalidVersion: GraphErrorMsg:='Invalid driver version';
  35. end;
  36. end;
  37. begin
  38. if GraphErrorMsg(grNoInitGraph) <> 'Graphics driver not installed' then
  39. halt(1);
  40. end.