acdbads.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. #ifndef _acdbads_h
  12. #define _acdbads_h 1
  13. #include "adsdef.h"
  14. #include "acmem.h"
  15. #include "AdAChar.h"
  16. #pragma pack (push, 8)
  17. #ifdef __cplusplus
  18. #include "adesk.h"
  19. #include "acdbport.h"
  20. #endif
  21. // These functions are exported with both extern "C" and C++ linkage. Some day
  22. // we may drop support for C applications, however.
  23. void acdbFail (const ACHAR *str);
  24. int acdbHandEnt (const ACHAR *handle, ads_name entres);
  25. // These functions are only available to C++ apps.
  26. #ifdef __cplusplus
  27. ACDB_PORT int acdbXdRoom (const ads_name ent, Adesk::Int32 *result);
  28. ACDB_PORT int acdbXdSize (const resbuf *rb, Adesk::Int32 *result);
  29. // Function to save a string ensuring no buffer overflow if,
  30. // when converted, characters expand to \U+ sequences
  31. ACDB_PORT ACHAR * acdbXStrSave (ACHAR *pSource, ACHAR **pDest);
  32. // Function to uppercase a table name
  33. ACDB_PORT int acdbXStrCase (ACHAR *str, size_t strLen);
  34. #endif
  35. /* Define macros to copy them. NOTE that the result is the SECOND argument,
  36. consistent with ADS usage. The standard C ones require <string.h> */
  37. #ifdef __STDC__
  38. #define acdbNameSet(from, to) (memcpy(to, from, sizeof(ads_name)))
  39. #define acdbPointSet(from,to) (memcpy(to, from, sizeof(ads_point)))
  40. #else
  41. #define acdbNameSet(from, to) (*(to)= *(from), (to)[1]=(from)[1])
  42. #define acdbPointSet(from, to) (*(to)= *(from), (to)[1]=(from)[1], (to)[2]=(from)[2])
  43. #endif /* !__STDC__ */
  44. /* Define null value for ads_names. These values are NOT guaranteed valid;
  45. that is, there is no actual guarantee (such as C gives with NULL) that the
  46. system will never under any circumstances generate the values as valid data.
  47. The correct values will be created as part of the Lisp reinitialization
  48. project, if we go through with that one, and will then be inserted here.
  49. */
  50. #define acdbNameClear(name) name[0] = name[1] = 0
  51. #define acdbNameNil(name) (name[0] == 0 && name[1] == 0)
  52. #define acdbNameEqual(name1, name2) (name1[0]==name2[0] \
  53. && name1[1]==name2[1])
  54. #pragma pack (pop)
  55. #endif // !acdbads.h