ifxgls.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * Licensed Materials - Property of IBM and/or HCL
  3. *
  4. * IBM Informix Dynamic Server
  5. * Copyright IBM Corporation 1996, 2011
  6. * (c) Copyright HCL Technologies Ltd. 2017. All Rights Reserved.
  7. *
  8. ***************************************************************************
  9. *
  10. * Title: ifxgls.h
  11. * Description: UDS interface to GLS API
  12. *
  13. ***************************************************************************/
  14. #ifndef _IFXGLS_API_HEADER_INCLUDED
  15. #define _IFXGLS_API_HEADER_INCLUDED
  16. #include "ifxtypes.h"
  17. #include "gls.h"
  18. #include "datetime.h"
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /*
  23. * The following defines determine whether gl_locale implies a session
  24. * locale or a db_locale/client_locale combination depending on server/client
  25. * initialisation.
  26. */
  27. #ifdef NT_MI_SAPI /* NT Server/Blade */
  28. #ifdef MI_SERVBUILD
  29. #ifdef NT_SERVER /* NT Server */
  30. #else /* NT Blade */
  31. __declspec(dllimport) gl_lc_t ** mi_get_locale();
  32. #define gl_locale ** mi_get_locale()
  33. #endif /* NT_SERVER */
  34. #endif /* MI_SERVBUILD */
  35. #else /* UNIX/Win32 Client - Default */
  36. #ifdef MI_SERVBUILD
  37. MI_EXT_DECL gl_lc_t *scb;
  38. #define gl_locale (*scb)
  39. #else
  40. MI_EXT_DECL gl_lc_t gls_env;
  41. #define gl_locale (gls_env)
  42. #endif /* MI_SERVBUILD */
  43. #endif /* NT_MI_SAPI */
  44. /*
  45. * Locale initialisation function.
  46. */
  47. MI_EXT_DECL mint ifx_gl_init(void);
  48. /*
  49. * Codeset conversion functions.
  50. */
  51. /*
  52. * The four functions ifx_gl_cv_mconv(), ifx_gl_cv_outbuflen(),
  53. * ifx_gl_conv_needed() and ifx_gl_cv_sb2sb_table() are declared
  54. * in both ifxgls.h and gcvsrv.h (and defined in gcvsrv.c).
  55. */
  56. MI_EXT_DECL mint ifx_gl_cv_mconv(gl_cv_state_t *state,
  57. gl_mchar_t **dst,
  58. mint *dstbytes,
  59. char *dst_codeset,
  60. gl_mchar_t **src,
  61. mint *srcbytes,
  62. char *src_codeset);
  63. MI_EXT_DECL mint ifx_gl_cv_outbuflen(char *dst_codeset,
  64. char *src_codeset,
  65. mint srcbytes);
  66. MI_EXT_DECL mint ifx_gl_conv_needed(char *dst_codeset,
  67. char *src_codeset);
  68. MI_EXT_DECL mint ifx_gl_cv_sb2sb_table(char *dstcs,
  69. char *srccs,
  70. unsigned char **array);
  71. /*
  72. * Built-in Data Type Conversion.
  73. */
  74. MI_EXT_DECL mint ifx_gl_convert_date(int4 *date,
  75. char *datestr,
  76. char *format);
  77. MI_EXT_DECL mint ifx_gl_format_date(char *datestr,
  78. mint len,
  79. int4 *date,
  80. char *format);
  81. MI_EXT_DECL mint ifx_gl_convert_datetime(dtime_t *dt,
  82. char *datetimestr,
  83. char *format);
  84. MI_EXT_DECL mint ifx_gl_format_datetime(char *datetimestr,
  85. mint len,
  86. dtime_t *dt,
  87. char *format);
  88. MI_EXT_DECL mint ifx_gl_convert_double(double *d,
  89. char *dstr,
  90. char *format);
  91. MI_EXT_DECL mint ifx_gl_format_double(char *dstr,
  92. mint len,
  93. double d,
  94. char *format);
  95. MI_EXT_DECL mint ifx_gl_convert_money(dec_t *mon,
  96. char *monstr,
  97. char *format);
  98. MI_EXT_DECL mint ifx_gl_format_money(char *monstr,
  99. mint len,
  100. dec_t *mon,
  101. char *format);
  102. MI_EXT_DECL mint ifx_gl_convert_number(dec_t *dec,
  103. char *decstr,
  104. char *format);
  105. MI_EXT_DECL mint ifx_gl_format_number(char *decstr,
  106. mint len,
  107. dec_t *dec,
  108. char *format);
  109. #ifdef __cplusplus
  110. }
  111. #endif
  112. #endif /* _IFXGLS_API_HEADER_INCLUDED */