System.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*=========================================================================
  2. Program: KWSys - Kitware System Library
  3. Module: $RCSfile$
  4. Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
  5. See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even
  7. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  8. PURPOSE. See the above copyright notices for more information.
  9. =========================================================================*/
  10. #ifndef cmsys_System_h
  11. #define cmsys_System_h
  12. #include <cmsys/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) cmsys##x
  19. # define kwsysEXPORT cmsys_EXPORT
  20. #endif
  21. #if !cmsys_NAME_IS_KWSYS
  22. # define kwsysSystem_Shell_GetArgumentForWindows kwsys_ns(System_Shell_GetArgumentForWindows)
  23. # define kwsysSystem_Shell_GetArgumentForUnix kwsys_ns(System_Shell_GetArgumentForUnix)
  24. # define kwsysSystem_Shell_GetArgumentSizeForWindows kwsys_ns(System_Shell_GetArgumentSizeForWindows)
  25. # define kwsysSystem_Shell_GetArgumentSizeForUnix kwsys_ns(System_Shell_GetArgumentSizeForUnix)
  26. # define kwsysSystem_Shell_Flag_e kwsys_ns(System_Shell_Flag_e)
  27. # define kwsysSystem_Shell_Flag_Make kwsys_ns(System_Shell_Flag_Make)
  28. # define kwsysSystem_Shell_Flag_VSIDE kwsys_ns(System_Shell_Flag_VSIDE)
  29. # define kwsysSystem_Shell_Flag_EchoWindows kwsys_ns(System_Shell_Flag_EchoWindows)
  30. # define kwsysSystem_Shell_Flag_WatcomWMake kwsys_ns(System_Shell_Flag_WatcomWMake)
  31. # define kwsysSystem_Shell_Flag_MinGWMake kwsys_ns(System_Shell_Flag_MinGWMake)
  32. # define kwsysSystem_Shell_Flag_NMake kwsys_ns(System_Shell_Flag_NMake)
  33. # define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables)
  34. #endif
  35. #ifdef __VMS
  36. #define cmsysSystem_Shell_GetArgumentForUnix \
  37. cmsysSystem_Shell_UnixGA
  38. #define cmsysSystem_Shell_GetArgumentSizeForUnix \
  39. cmsysSystem_Shell_UnixGAS
  40. #define cmsysSystem_Shell_GetArgumentForWindows \
  41. cmsysSystem_Shell_WindowsGA
  42. #endif
  43. #if defined(__cplusplus)
  44. extern "C"
  45. {
  46. #endif
  47. /**
  48. * Transform the given command line argument for use in a Windows or
  49. * Unix shell. Returns a pointer to the end of the command line
  50. * argument in the provided output buffer. Flags may be passed to
  51. * modify the generated quoting and escape sequences to work under
  52. * alternative environments.
  53. */
  54. kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForWindows(const char* in,
  55. char* out,
  56. int flags);
  57. kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForUnix(const char* in,
  58. char* out,
  59. int flags);
  60. /**
  61. * Compute the size of the buffer required to store the output from
  62. * kwsysSystem_Shell_GetArgumentForWindows or
  63. * kwsysSystem_Shell_GetArgumentForUnix. The flags passed must be
  64. * identical between the two calls.
  65. */
  66. kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForWindows(const char* in,
  67. int flags);
  68. kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForUnix(const char* in,
  69. int flags);
  70. /**
  71. * Flags to pass to kwsysSystem_Shell_GetArgumentForWindows or
  72. * kwsysSystem_Shell_GetArgumentForUnix. These modify the generated
  73. * quoting and escape sequences to work under alternative
  74. * environments.
  75. */
  76. enum kwsysSystem_Shell_Flag_e
  77. {
  78. /** The target shell is in a makefile. */
  79. kwsysSystem_Shell_Flag_Make = (1<<0),
  80. /** The target shell is in a VS project file. Do not use with
  81. Shell_Flag_Make. */
  82. kwsysSystem_Shell_Flag_VSIDE = (1<<1),
  83. /** In a windows shell the argument is being passed to "echo". */
  84. kwsysSystem_Shell_Flag_EchoWindows = (1<<2),
  85. /** The target shell is in a Watcom WMake makefile. */
  86. kwsysSystem_Shell_Flag_WatcomWMake = (1<<3),
  87. /** The target shell is in a MinGW Make makefile. */
  88. kwsysSystem_Shell_Flag_MinGWMake = (1<<4),
  89. /** The target shell is in a NMake makefile. */
  90. kwsysSystem_Shell_Flag_NMake = (1<<6),
  91. /** Make variable reference syntax $(MAKEVAR) should not be escaped
  92. to allow a build tool to replace it. Replacement values
  93. containing spaces, quotes, backslashes, or other
  94. non-alphanumeric characters that have significance to some makes
  95. or shells produce undefined behavior. */
  96. kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<5)
  97. };
  98. #if defined(__cplusplus)
  99. } /* extern "C" */
  100. #endif
  101. /* If we are building a kwsys .c or .cxx file, let it use these macros.
  102. Otherwise, undefine them to keep the namespace clean. */
  103. #if !defined(KWSYS_NAMESPACE)
  104. # undef kwsys_ns
  105. # undef kwsysEXPORT
  106. # if !defined(KWSYS_NAMESPACE) && !cmsys_NAME_IS_KWSYS
  107. # undef kwsysSystem_Shell_GetArgumentForWindows
  108. # undef kwsysSystem_Shell_GetArgumentForUnix
  109. # undef kwsysSystem_Shell_GetArgumentSizeForWindows
  110. # undef kwsysSystem_Shell_GetArgumentSizeForUnix
  111. # undef kwsysSystem_Shell_Flag_e
  112. # undef kwsysSystem_Shell_Flag_Make
  113. # undef kwsysSystem_Shell_Flag_VSIDE
  114. # undef kwsysSystem_Shell_Flag_EchoWindows
  115. # undef kwsysSystem_Shell_Flag_WatcomWMake
  116. # undef kwsysSystem_Shell_Flag_MinGWMake
  117. # undef kwsysSystem_Shell_Flag_NMake
  118. # undef kwsysSystem_Shell_Flag_AllowMakeVariables
  119. # endif
  120. #endif
  121. #endif