home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / samples / sam02l / build02d.cm_ / BUILD02D.CMD
Encoding:
Text File  |  1992-04-01  |  8.8 KB  |  144 lines

  1. @echo OFF
  2. cls
  3. ECHO ***************************************************************************
  4. ECHO * SAMPLE PROGRAM 02: SAMPLE02.C                                           *
  5. ECHO *                                                                         *
  6. ECHO * COPYRIGHT:                                                              *
  7. ECHO * ----------                                                              *
  8. ECHO * Copyright (C) International Business Machines Corp., 1991,1992.         *
  9. ECHO *                                                                         *
  10. ECHO * STATUS: VERSION 1, RELEASE 0, MODIFICATION 0                            *
  11. ECHO *                                                                         *
  12. ECHO * DISCLAIMER OF WARRANTIES:                                               *
  13. ECHO * -------------------------                                               *
  14. ECHO * The following [enclosed] code is sample code created by IBM             *
  15. ECHO * Corporation.  This sample code is not part of any standard IBM product  *
  16. ECHO * and is provided to you solely for the purpose of assisting you in the   *
  17. ECHO * development of your applications.  The code is provided "AS IS",        *
  18. ECHO * without warranty of any kind.  IBM shall not be liable for any damages  *
  19. ECHO * arising out of your use of the sample code, even if they have been      *
  20. ECHO * advised of the possibility of such damages.                             *
  21. ECHO *                                                                         *
  22. ECHO * ----------------------------------------------------------------------- *
  23. ECHO *                                                                         *
  24. ECHO *  Sample to demonstrate a multithread program                            *
  25. ECHO *                                                                         *
  26. ECHO *  This program demonstrates the multithread programming capability       *
  27. ECHO *  of the IBM C Set/2 compiler.                                           *
  28. ECHO *                                                                         *
  29. ECHO *  This sample program creates one thread for each argument.  Each        *
  30. ECHO *  thread prints "Hello world from thread n!" the number of times         *
  31. ECHO *  specified in the corresponding argument.  For example                  *
  32. ECHO *                                                                         *
  33. ECHO *     SAMPLE02 2 4 6                                                      *
  34. ECHO *                                                                         *
  35. ECHO *  creates three threads; the first thread displays "Hello"               *
  36. ECHO *  two times, the second thread displays "Hello" four times,              *
  37. ECHO *  and the third thread displays "Hello" six times.                       *
  38. ECHO *                                                                         *
  39. ECHO *  In operation, the program works in the following order:                *
  40. ECHO *                                                                         *
  41. ECHO *     1. Creates the requested number of threads                          *
  42. ECHO *     2. Waits until all threads have been created                        *
  43. ECHO *     3. Begins multithread execution and waits for completion            *
  44. ECHO *                                                                         *
  45. ECHO *  NOTE:  The program also requires the IBM TOOLKIT 2.0 headers           *
  46. ECHO *                                                                         *
  47. ECHO *  File list:                                                             *
  48. ECHO *                                                                         *
  49. ECHO *   SAMPLE02.C    - source code to create the .EXE file                   *
  50. ECHO *   SAMPLE02.DEF  - module definition file for SAMPLE02.C                 *
  51. ECHO *   BUILD02D.CMD  - command file to link the program dynamically          *
  52. ECHO *   BUILD02S.CMD  - command file to link the program statically           *
  53. ECHO ***************************************************************************
  54. PAUSE
  55. SETLOCAL
  56. echo ************************************************************************
  57. echo Call CSETENV.CMD to set up the IBM C Set/2 environment
  58. echo ************************************************************************
  59. :ENV
  60. IF NOT EXIST ..\..\BIN\CSETENV.CMD GOTO ERROR1
  61. CALL ..\..\BIN\CSETENV.CMD
  62. GOTO CHECK
  63. :ERROR1
  64. ECHO ERROR:  Failed to locate CSETENV.CMD command file
  65. ECHO REMEDY: Verify that CSETENV.CMD is in the \BIN directory and try again
  66. PAUSE
  67. GOTO END
  68. :CHECK
  69. echo ************************************************************************
  70. ECHO Check that all required files exist
  71. echo ************************************************************************
  72. IF NOT EXIST ..\..\LIB\DDE4MBSI.LIB GOTO ERROR2
  73. GOTO EXEC
  74. :ERROR2
  75. echo ERROR:  One or more libraries are missing
  76. echo REMEDY: Make sure that you have installed the correct libraries
  77. echo         and try again
  78. PAUSE
  79. GOTO END
  80. :EXEC
  81. echo ***************************************************************************
  82. ECHO * Building program                                                        *
  83. ECHO *                                                                         *
  84. ECHO * icc /c /Gd+ /Ge /Gm+ /Re /Se SAMPLE02.C                                 *
  85. ECHO *                                                                         *
  86. ECHO * compiler options:                                                       *
  87. ECHO *                                                                         *
  88. ECHO *   /c    :  perform compile only, no link                                *
  89. ECHO *   /Gd+  :  dynamically link the run-time library                        *
  90. ECHO *   /Ge   :  build a .EXE file                                            *
  91. ECHO *   /Gm+  :  use the multithread library                                  *
  92. ECHO *   /Re   :  the .EXE is compatible with the run-time environment         *
  93. ECHO *   /Se   :  allow the standard IBM C Set/2 extensions                    *
  94. ECHO *                                                                         *
  95. echo ***************************************************************************
  96. icc /c /Gd+ /Ge /Gm+ /Re /Se  SAMPLE02.C
  97. IF NOT ERRORLEVEL 1 GOTO LINK
  98. echo ERROR:  Failed to compile SAMPLE02.C
  99. echo REMEDY: Make sure that you have installed the correct components,
  100. echo         and try again
  101. PAUSE
  102. GOTO END
  103. :LINK
  104. echo ***************************************************************************
  105. ECHO * Linking program                                                         *
  106. ECHO *                                                                         *
  107. ECHO * link386 /NOE /NOD /NOI SAMPLE02,,NUL,DDE4MBSI+os2386,SAMPLE02.def       *
  108. ECHO *                                                                         *
  109. echo * link options:                                                           *
  110. echo *                                                                         *
  111. echo *   /NOE  - no extra dictionary                                           *
  112. echo *   /NOD  - ignore default libraries                                      *
  113. echo *   /NOI  - differentiate between cases                                   *
  114. echo *    NUL  - do not create mapping file                                    *
  115. echo *                                                                         *
  116. echo *  LIBRARIES:                                                             *
  117. echo *    DDE4MBSI - Dynamically bound, multithread, standard library          *
  118. echo *    OS2386   - OS/2 import library                                       *
  119. echo *                                                                         *
  120. echo *  SAMPLE02.DEF - module definition file                                  *
  121. echo *                                                                         *
  122. echo ***************************************************************************
  123. link386 /NOE /NOD /NOI SAMPLE02,,NUL,DDE4MBSI+OS2386,SAMPLE02.def;
  124. IF NOT ERRORLEVEL 1 GOTO RUN
  125. echo ERROR:  Failed to create SAMPLE02.EXE
  126. echo REMEDY: Make sure that you have installed the correct components,
  127. echo         and try again
  128. PAUSE
  129. GOTO END
  130. :RUN
  131. echo ************************************************************************
  132. ECHO Running SAMPLE02.EXE with 3 secondary threads
  133. echo ************************************************************************
  134. SAMPLE02 2 4 6
  135. PAUSE
  136. echo ************************************************************************
  137. REM Clean up files and environment
  138. echo ************************************************************************
  139. :CLEANUP
  140. IF EXIST SAMPLE02.EXE ERASE SAMPLE02.EXE
  141. IF EXIST SAMPLE02.OBJ ERASE SAMPLE02.OBJ
  142. :END
  143. ENDLOCAL
  144.