check.inc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. {
  2. Free Pascal port of the OpenPTC C++ library.
  3. Copyright (C) 2001-2003 Nikolay Nikolov ([email protected])
  4. Original C++ version by Glenn Fiedler ([email protected])
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. }
  17. Procedure X11Check(result : TStatus);
  18. Var
  19. ErrStr : String;
  20. Begin
  21. {todo: fix X11 error handling}
  22. { If result = Success Then
  23. Exit;
  24. Case result Of
  25. BadRequest : ErrStr := 'BadRequest';
  26. BadValue : ErrStr := 'BadValue';
  27. BadWindow : ErrStr := 'BadWindow';
  28. BadPixmap : ErrStr := 'BadPixmap';
  29. BadAtom : ErrStr := 'BadAtom';
  30. BadCursor : ErrStr := 'BadCursor';
  31. BadFont : ErrStr := 'BadFont';
  32. BadMatch : ErrStr := 'BadMatch';
  33. BadDrawable : ErrStr := 'BadDrawable';
  34. BadAccess : ErrStr := 'BadAccess';
  35. BadAlloc : ErrStr := 'BadAlloc';
  36. BadColor : ErrStr := 'BadColor';
  37. BadGC : ErrStr := 'BadGC';
  38. BadIDChoice : ErrStr := 'BadIDChoice';
  39. BadName : ErrStr := 'BadName';
  40. BadLength : ErrStr := 'BadLength';
  41. BadImplementation : ErrStr := 'BadImplementation';
  42. Else
  43. Str(result, ErrStr);
  44. End;
  45. Raise TPTCError.Create('X11 Error: ' + ErrStr);}
  46. End;
  47. Procedure X11Check(result : TStatus; Const message : String);
  48. Begin
  49. Try
  50. X11Check(result);
  51. Except
  52. On error : TPTCError Do
  53. Raise TPTCError.Create(message, error);
  54. End;
  55. End;