Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.0 KiB

  1. /*
  2. * Adobe Graphics Manager
  3. *
  4. * Copyright (c) 1996 Adobe Systems Inc.
  5. * All Rights Reserved
  6. *
  7. * UFLStd -- UFL C Standard APIs.
  8. *
  9. *
  10. * $Header:
  11. */
  12. #ifndef _H_UFLStd
  13. #define _H_UFLStd
  14. #ifdef WIN32KERNEL
  15. //
  16. // Definitions for NT Kernel mode driver.
  17. //
  18. #define UFLmemsetShort memset
  19. #define UFLstrlen strlen
  20. #define UFLstrcmp strcmp
  21. #define UFLstrcmpW _tcscmp
  22. int UFLsprintf(char *buf, size_t cchDest, const char *fmtstr, ...);
  23. long UFLstrtol (const char *nptr, char **endptr, int ibase);
  24. #define KStringCchCopyA(d,l,s) strcpy(d,s)
  25. #else // !WIN32KERNEL
  26. //
  27. // Definitions for NT/9x User mode driver.
  28. //
  29. #include <memory.h>
  30. #include <stdio.h>
  31. #include <string.h>
  32. #define UFLmemsetShort memset
  33. #define UFLstrlen strlen
  34. #define UFLstrcmp strcmp
  35. #define UFLsprintf StringCchPrintfA
  36. #define UFLstrtol strtol
  37. #define KStringCchCopyA(d,l,s) StringCchCopyA(d,l,s)
  38. //
  39. // We need a strcmp function that is aware of Unicode on Unicode savvy
  40. // platform or application.
  41. //
  42. #ifdef UNICODE
  43. #include <tchar.h>
  44. #define UFLstrcmpW _tcscmp
  45. #include <strsafe.h>
  46. #else
  47. /* Although UFLstrcmpW is defined as strcmpW and strcmpW is defined in */
  48. /* UFLSPROC.C, it is not prototyped anywhere. We prototype it here so */
  49. /* we can avoid a "strcmpW() not defined" error in PARSETT.C */
  50. /* jfu: 8-13-97 */
  51. int strcmpW ( unsigned short *str1, unsigned short *str2 );
  52. #define UFLstrcmpW strcmpW
  53. /* _ltoa() and _ultoa() are specific to NT and Win32, but unix and mac */
  54. /* environments define these in UFLSPROC.C, so prototype them here. */
  55. /* jfu: 8-13-97 */
  56. char *_ltoa( long val, char *str, int radix );
  57. char *_ultoa( unsigned long val, char *str, int radix );
  58. #endif // UNICODE
  59. #endif // WIN32KERNEL
  60. /*
  61. This is NOT a full implementation of "sprintf" as found
  62. in the C runtime library. Specifically, the only form of
  63. format specification allowed is %type, where "type" can
  64. be one of the following characters:
  65. d int signed decimal integer
  66. l long signed decimal integer
  67. ld long signed decimal integer
  68. lu unsigned long unsigned decimal integer
  69. u unsigned int unsigned decimal integer
  70. s char* character string
  71. c char character
  72. x,X unsigned long hex number (emits at least two digits, uppercase)
  73. b UFLBool boolean (true or false)
  74. f long 24.8 fixed-pointed number
  75. Normally, you should use UFLsprintf. Use this function
  76. only when you want to sprintf with %f in the form of 24.8 fixed point
  77. number. Currently, it is only used in UFOt42 module.
  78. */
  79. int UFLsprintfEx(char *buf, size_t cchDest, const char *fmtstr, ...);
  80. //
  81. // Count of characters
  82. //
  83. #define CCHOF(x) (sizeof(x)/sizeof(*(x)))
  84. #endif