Clone of PhatAC @ https://github.com/floaterxk/PhatAC

typelib.h 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
  12. #ifndef _typelib_h
  13. #define _typelib_h
  14. #include "my_alloc.h"
  15. typedef struct st_typelib { /* Different types saved here */
  16. unsigned int count; /* How many types */
  17. const char *name; /* Name of typelib */
  18. const char **type_names;
  19. unsigned int *type_lengths;
  20. } TYPELIB;
  21. extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
  22. extern int find_type_or_exit(const char *x, TYPELIB *typelib,
  23. const char *option);
  24. #define FIND_TYPE_BASIC 0
  25. /** makes @c find_type() require the whole name, no prefix */
  26. #define FIND_TYPE_NO_PREFIX (1 << 0)
  27. /** always implicitely on, so unused, but old code may pass it */
  28. #define FIND_TYPE_NO_OVERWRITE (1 << 1)
  29. /** makes @c find_type() accept a number */
  30. #define FIND_TYPE_ALLOW_NUMBER (1 << 2)
  31. /** makes @c find_type() treat ',' as terminator */
  32. #define FIND_TYPE_COMMA_TERM (1 << 3)
  33. extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
  34. extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
  35. extern const char *get_type(TYPELIB *typelib,unsigned int nr);
  36. extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
  37. extern TYPELIB sql_protocol_typelib;
  38. my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name,
  39. my_ulonglong cur_set, my_ulonglong default_set,
  40. const char *str, unsigned int length,
  41. char **err_pos, unsigned int *err_len);
  42. #endif /* _typelib_h */