mf_common.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /****************************************************************************
  2. * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
  3. * *
  4. * Permission is hereby granted, free of charge, to any person obtaining a *
  5. * copy of this software and associated documentation files (the *
  6. * "Software"), to deal in the Software without restriction, including *
  7. * without limitation the rights to use, copy, modify, merge, publish, *
  8. * distribute, distribute with modifications, sublicense, and/or sell *
  9. * copies of the Software, and to permit persons to whom the Software is *
  10. * furnished to do so, subject to the following conditions: *
  11. * *
  12. * The above copyright notice and this permission notice shall be included *
  13. * in all copies or substantial portions of the Software. *
  14. * *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
  16. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
  18. * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
  19. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
  20. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
  21. * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
  22. * *
  23. * Except as contained in this notice, the name(s) of the above copyright *
  24. * holders shall not be used in advertising or otherwise to promote the *
  25. * sale, use or other dealings in this Software without prior written *
  26. * authorization. *
  27. ****************************************************************************/
  28. /****************************************************************************
  29. * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
  30. ****************************************************************************/
  31. /* Common internal header for menu and form library */
  32. #if HAVE_CONFIG_H
  33. # include <ncurses_cfg.h>
  34. #endif
  35. #include <stdlib.h>
  36. #include <sys/types.h>
  37. #include <assert.h>
  38. #include <string.h>
  39. #include <ctype.h>
  40. #include <errno.h>
  41. #if DECL_ERRNO
  42. extern int errno;
  43. #endif
  44. /* in case of debug version we ignore the suppression of assertions */
  45. #ifdef TRACE
  46. # ifdef NDEBUG
  47. # undef NDEBUG
  48. # endif
  49. #endif
  50. #include <nc_alloc.h>
  51. #if USE_RCS_IDS
  52. #define MODULE_ID(id) static const char Ident[] = id;
  53. #else
  54. #define MODULE_ID(id) /*nothing*/
  55. #endif
  56. /* Maximum regular 8-bit character code */
  57. #define MAX_REGULAR_CHARACTER (0xff)
  58. #define SET_ERROR(code) (errno=(code))
  59. #define GET_ERROR() (errno)
  60. #define RETURN(code) return( SET_ERROR(code) )
  61. /* The few common values in the status fields for menus and forms */
  62. #define _POSTED (0x01) /* menu or form is posted */
  63. #define _IN_DRIVER (0x02) /* menu or form is processing hook routine */
  64. /* Call object hook */
  65. #define Call_Hook( object, handler ) \
  66. if ( (object) && ((object)->handler) )\
  67. {\
  68. (object)->status |= _IN_DRIVER;\
  69. (object)->handler(object);\
  70. (object)->status &= ~_IN_DRIVER;\
  71. }
  72. #define INLINE
  73. #ifndef TRACE
  74. # if CC_HAS_INLINE_FUNCS
  75. # undef INLINE
  76. # define INLINE inline
  77. # endif
  78. #endif