System.h.in 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*============================================================================
  2. KWSys - Kitware System Library
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef @KWSYS_NAMESPACE@_System_h
  11. #define @KWSYS_NAMESPACE@_System_h
  12. #include <@KWSYS_NAMESPACE@/Configure.h>
  13. /* Redefine all public interface symbol names to be in the proper
  14. namespace. These macros are used internally to kwsys only, and are
  15. not visible to user code. Use kwsysHeaderDump.pl to reproduce
  16. these macros after making changes to the interface. */
  17. #if !defined(KWSYS_NAMESPACE)
  18. # define kwsys_ns(x) @KWSYS_NAMESPACE@##x
  19. # define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
  20. #endif
  21. #if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
  22. # define kwsysSystem_Parse_CommandForUnix kwsys_ns(System_Parse_CommandForUnix)
  23. # define kwsysSystem_Shell_GetArgumentForWindows kwsys_ns(System_Shell_GetArgumentForWindows)
  24. # define kwsysSystem_Shell_GetArgumentForUnix kwsys_ns(System_Shell_GetArgumentForUnix)
  25. # define kwsysSystem_Shell_GetArgumentSizeForWindows kwsys_ns(System_Shell_GetArgumentSizeForWindows)
  26. # define kwsysSystem_Shell_GetArgumentSizeForUnix kwsys_ns(System_Shell_GetArgumentSizeForUnix)
  27. # define kwsysSystem_Shell_Flag_e kwsys_ns(System_Shell_Flag_e)
  28. # define kwsysSystem_Shell_Flag_Make kwsys_ns(System_Shell_Flag_Make)
  29. # define kwsysSystem_Shell_Flag_VSIDE kwsys_ns(System_Shell_Flag_VSIDE)
  30. # define kwsysSystem_Shell_Flag_EchoWindows kwsys_ns(System_Shell_Flag_EchoWindows)
  31. # define kwsysSystem_Shell_Flag_WatcomWMake kwsys_ns(System_Shell_Flag_WatcomWMake)
  32. # define kwsysSystem_Shell_Flag_MinGWMake kwsys_ns(System_Shell_Flag_MinGWMake)
  33. # define kwsysSystem_Shell_Flag_NMake kwsys_ns(System_Shell_Flag_NMake)
  34. # define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables)
  35. # define kwsysSystem_Shell_Flag_WatcomQuote kwsys_ns(System_Shell_Flag_WatcomQuote)
  36. #endif
  37. #ifdef __VMS
  38. #define @KWSYS_NAMESPACE@System_Shell_GetArgumentForUnix \
  39. @KWSYS_NAMESPACE@System_Shell_UnixGA
  40. #define @KWSYS_NAMESPACE@System_Shell_GetArgumentSizeForUnix \
  41. @KWSYS_NAMESPACE@System_Shell_UnixGAS
  42. #define @KWSYS_NAMESPACE@System_Shell_GetArgumentForWindows \
  43. @KWSYS_NAMESPACE@System_Shell_WindowsGA
  44. #endif
  45. #if defined(__cplusplus)
  46. extern "C"
  47. {
  48. #endif
  49. /**
  50. * Transform the given command line argument for use in a Windows or
  51. * Unix shell. Returns a pointer to the end of the command line
  52. * argument in the provided output buffer. Flags may be passed to
  53. * modify the generated quoting and escape sequences to work under
  54. * alternative environments.
  55. */
  56. kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForWindows(const char* in,
  57. char* out,
  58. int flags);
  59. kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForUnix(const char* in,
  60. char* out,
  61. int flags);
  62. /**
  63. * Compute the size of the buffer required to store the output from
  64. * kwsysSystem_Shell_GetArgumentForWindows or
  65. * kwsysSystem_Shell_GetArgumentForUnix. The flags passed must be
  66. * identical between the two calls.
  67. */
  68. kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForWindows(const char* in,
  69. int flags);
  70. kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForUnix(const char* in,
  71. int flags);
  72. /**
  73. * Flags to pass to kwsysSystem_Shell_GetArgumentForWindows or
  74. * kwsysSystem_Shell_GetArgumentForUnix. These modify the generated
  75. * quoting and escape sequences to work under alternative
  76. * environments.
  77. */
  78. enum kwsysSystem_Shell_Flag_e
  79. {
  80. /** The target shell is in a makefile. */
  81. kwsysSystem_Shell_Flag_Make = (1<<0),
  82. /** The target shell is in a VS project file. Do not use with
  83. Shell_Flag_Make. */
  84. kwsysSystem_Shell_Flag_VSIDE = (1<<1),
  85. /** In a windows shell the argument is being passed to "echo". */
  86. kwsysSystem_Shell_Flag_EchoWindows = (1<<2),
  87. /** The target shell is in a Watcom WMake makefile. */
  88. kwsysSystem_Shell_Flag_WatcomWMake = (1<<3),
  89. /** The target shell is in a MinGW Make makefile. */
  90. kwsysSystem_Shell_Flag_MinGWMake = (1<<4),
  91. /** The target shell is in a NMake makefile. */
  92. kwsysSystem_Shell_Flag_NMake = (1<<5),
  93. /** Make variable reference syntax $(MAKEVAR) should not be escaped
  94. to allow a build tool to replace it. Replacement values
  95. containing spaces, quotes, backslashes, or other
  96. non-alphanumeric characters that have significance to some makes
  97. or shells produce undefined behavior. */
  98. kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<6),
  99. /** The target shell quoting uses extra single Quotes for Watcom tools. */
  100. kwsysSystem_Shell_Flag_WatcomQuote = (1<<7)
  101. };
  102. /**
  103. * Parse a unix-style command line string into separate arguments.
  104. *
  105. * On success, returns a pointer to an array of pointers to individual
  106. * argument strings. Each string is null-terminated and the last
  107. * entry in the array is a NULL pointer (just like argv). It is the
  108. * caller's responsibility to free() the strings and the array of
  109. * pointers to them.
  110. *
  111. * On failure, returns NULL. Failure occurs only on invalid flags or
  112. * when memory cannot be allocated; never due to content of the input
  113. * string. Missing close-quotes are treated as if the necessary
  114. * closing quote appears.
  115. *
  116. * By default single- and double-quoted arguments are supported, and
  117. * any character may be escaped by a backslash. The flags argument is
  118. * reserved for future use, and must be zero (or the call will fail).
  119. */
  120. kwsysEXPORT char** kwsysSystem_Parse_CommandForUnix(const char* command,
  121. int flags);
  122. #if defined(__cplusplus)
  123. } /* extern "C" */
  124. #endif
  125. /* If we are building a kwsys .c or .cxx file, let it use these macros.
  126. Otherwise, undefine them to keep the namespace clean. */
  127. #if !defined(KWSYS_NAMESPACE)
  128. # undef kwsys_ns
  129. # undef kwsysEXPORT
  130. # if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
  131. # undef kwsysSystem_Parse_CommandForUnix
  132. # undef kwsysSystem_Shell_GetArgumentForWindows
  133. # undef kwsysSystem_Shell_GetArgumentForUnix
  134. # undef kwsysSystem_Shell_GetArgumentSizeForWindows
  135. # undef kwsysSystem_Shell_GetArgumentSizeForUnix
  136. # undef kwsysSystem_Shell_Flag_e
  137. # undef kwsysSystem_Shell_Flag_Make
  138. # undef kwsysSystem_Shell_Flag_VSIDE
  139. # undef kwsysSystem_Shell_Flag_EchoWindows
  140. # undef kwsysSystem_Shell_Flag_WatcomWMake
  141. # undef kwsysSystem_Shell_Flag_MinGWMake
  142. # undef kwsysSystem_Shell_Flag_NMake
  143. # undef kwsysSystem_Shell_Flag_AllowMakeVariables
  144. # undef kwsysSystem_Shell_Flag_WatcomQuote
  145. # endif
  146. #endif
  147. #endif