home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / books / cinstall.db < prev    next >
Encoding:
Text File  |  1991-03-01  |  133.6 KB  |  2,876 lines

  1. %@1@%%@AB@%Microsoft  C - Installing and Using the Professional Development System%@AE@%%@EH@%%@NL@%
  2.                                       %@NL@%
  3.                                       %@NL@%
  4.                                       %@NL@%
  5.                                       %@NL@%
  6.                                       %@NL@%
  7.                                       %@NL@%
  8.                                       %@NL@%
  9.  
  10. ────────────────────────────────────────────────────────────────────────────%@NL@%
  11.  %@AB@%Microsoft (R) C - Installing and Using the Professional Development System%@AE@%%@NL@%
  12.                                       %@NL@%
  13.                        %@AB@%FOR MS (R) OS/2 AND MS-DOS (R)
  14.                              %@AB@%%@AB@%%@AE@%%@AI@%OPERATING SYSTEMS%@AE@%%@AE@%%@NL@%
  15. ────────────────────────────────────────────────────────────────────────────%@NL@%
  16.                                       %@NL@%
  17.                                       %@NL@%
  18.                            MICROSOFT CORPORATION %@NL@%
  19.                                       %@NL@%
  20. %@NL@%
  21. %@NL@%
  22. %@NL@%
  23. %@NL@%%@NL@%
  24. %@NL@%
  25.  
  26.  
  27. Information in this document is subject to change without notice and does
  28. not represent a commitment on the part of Microsoft Corporation. The
  29. software described in this document is furnished under a license agreement
  30. or nondisclosure agreement. The software may be used or copied only in
  31. accordance with the terms of the agreement. It is against the law to copy
  32. the software on any medium except as specifically allowed in the license or
  33. nondisclosure agreement. No part of this manual may be reproduced or
  34. transmitted in any form or by any means, electronic or mechanical, including
  35. photocopying and recording, for any purpose without the express written
  36. permission of Microsoft.  
  37. (C) Copyright Microsoft Corporation, 1990. All rights reserved.%@NL@%
  38. %@NL@%
  39.  
  40. Printed and bound in the United States of America.%@NL@%
  41. %@NL@%
  42.  
  43. Microsoft, MS, MS-DOS, and CodeView are registered trademarks 
  44. and Windows is a trademark of Microsoft Corporation.%@NL@%
  45. %@NL@%
  46. 386-Max is a trademark of Qualitas, Inc.%@NL@%
  47. %@NL@%
  48. BRIEF is a registered trademark of UnderWare, Inc.%@NL@%
  49. %@NL@%
  50. IBM is a registered trademark of International Business 
  51. Machines Corporation.%@NL@%
  52. %@NL@%
  53. UNIX is a registered trademark of American Telephone 
  54. and Telegraph Company.%@NL@%
  55. %@NL@%
  56. %@NL@%
  57. %@NL@%
  58. Document No.  LN06516-1189 OEMO711-6Z
  59.  
  60. 10
  61.  9
  62.  8
  63.  7
  64.  6
  65.  5
  66.  4
  67.  3
  68.  2
  69.  1 
  70. %@AI@%%@AE@%%@NL@%
  71. %@NL@%
  72.  
  73. %@NL@%
  74. %@NL@%
  75. %@NL@%
  76. %@NL@%
  77. %@NL@%
  78. %@NL@%
  79. %@AB@%Chapter 1%@AE@%%@BO:        16ba@%  %@AB@%The Microsoft(R) C Professional Development System%@AE@%%@NL@%
  80. %@NL@%
  81.      Before You Proceed%@BO:        20f6@%%@NL@%
  82.             System Requirements%@BO:        21e8@%%@NL@%
  83.             Package Contents%@BO:        264d@%%@NL@%
  84.      Features New to Version 6.0%@BO:        3112@%%@NL@%
  85.      Why Microsoft Programmer's WorkBench?%@BO:        3876@%%@NL@%
  86. %@NL@%
  87. %@AB@%Chapter 2%@AE@%%@BO:        4787@%  %@AB@%Installing Microsoft C%@AE@%%@NL@%
  88. %@NL@%
  89.      Running SETUP%@BO:        4e18@%%@NL@%
  90.             Supplying SETUP Information%@BO:        5047@%%@NL@%
  91.             Correcting Mistakes%@BO:        5492@%%@NL@%
  92.             First Screen: Installing Libraries%@BO:        5748@%%@NL@%
  93.             Second Screen: Installing Additional Files%@BO:        6ebf@%%@NL@%
  94.             Third Screen: Specifying Directories%@BO:        7314@%%@NL@%
  95.             Checking Available Disk Space%@BO:        7727@%%@NL@%
  96.             SETUP Options%@BO:        7a72@%%@NL@%
  97.             Configuring Your System%@BO:        7de7@%%@NL@%
  98.             Choosing a Target Operating Environment%@BO:        9028@%%@NL@%
  99.      Configuring Extended Memory for CodeView%@BO:        9e86@%%@NL@%
  100.      Customizing Microsoft C%@BO:        a92e@%%@NL@%
  101. %@NL@%
  102. %@AB@%Chapter 3%@AE@%%@BO:        abd9@%  %@AB@%Using the Programmer's WorkBench%@AE@%%@NL@%
  103. %@NL@%
  104.      Starting PWB%@BO:        b3c3@%%@NL@%
  105.             Specifying a Source File%@BO:        b5c3@%%@NL@%
  106.             Command-Line Options%@BO:        b749@%%@NL@%
  107.      Using Windows and Menus%@BO:        be47@%%@NL@%
  108.             Windows%@BO:        c121@%%@NL@%
  109.             Menus%@BO:        cc8d@%%@NL@%
  110.             Dialog Boxes%@BO:        ef99@%%@NL@%
  111.             Getting Help%@BO:        fd1c@%%@NL@%
  112.      Using the Editor%@BO:       103e2@%%@NL@%
  113.             Moving Around in a Source File%@BO:       104f6@%%@NL@%
  114.             Customizing the Editor%@BO:       12315@%%@NL@%
  115.      Compiling and Linking%@BO:       1382c@%%@NL@%
  116.             Building Programs in PWB%@BO:       13cc4@%%@NL@%
  117.             Compiling and Linking from the Command Line%@BO:       166cb@%%@NL@%
  118.      Debugging Programs%@BO:       16f56@%%@NL@%
  119.             Using the Browser%@BO:       1764e@%%@NL@%
  120.             Debugging with CodeView%@BO:       182a9@%%@NL@%
  121.             Running IO.C%@BO:       1a763@%%@NL@%
  122.             Debugging IO.C%@BO:       1b0a7@%%@NL@%
  123.      Getting More Details%@BO:       1b456@%%@NL@%
  124. %@NL@%
  125. %@AB@%Chapter 4%@AE@%%@BO:       1b748@%  %@AB@%Using the On-Line Reference%@AE@%%@NL@%
  126. %@NL@%
  127.      Structure of the Microsoft Advisor%@BO:       1bb8e@%%@NL@%
  128.      Navigating Through the Microsoft Advisor%@BO:       1beb7@%%@NL@%
  129.             Using the Help Menu%@BO:       1c180@%%@NL@%
  130.             Using the F1 Key%@BO:       1c82d@%%@NL@%
  131.             Using Hyperlinks%@BO:       1cd2a@%%@NL@%
  132.             Using Help Windows and Dialog Boxes%@BO:       1d640@%%@NL@%
  133.             Accessing Different Types of Information%@BO:       1ec73@%%@NL@%
  134.             Specifying Temporary Help Files%@BO:       1f973@%%@NL@%
  135.      Using QuickHelp%@BO:       1fbf6@%%@NL@%
  136.             Using the /HELP Switch%@BO:       1fefc@%%@NL@%
  137.             Using the QH Command%@BO:       20078@%%@NL@%
  138. %@NL@%
  139. %@NL@%
  140. %@NL@%
  141. %@CR:C6A00010001 @%%@1@%%@AB@%Chapter 1  The Microsoft(R) C Professional Development System%@AE@%%@EH@%%@NL@%
  142. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  143. %@NL@%
  144. The Microsoft C Professional Development System is a collection of tools
  145. designed to increase DOS and OS/2 programming efficiency. The system offers
  146. %@NL@%
  147. %@NL@%
  148. %@NL@%
  149.   ■   A customizable editor that is capable of being extended%@NL@%
  150. %@NL@%
  151.   ■   An optimizing and incremental compiler%@NL@%
  152. %@NL@%
  153.   ■   An intelligent linker%@NL@%
  154. %@NL@%
  155.   ■   A project-oriented Make utility%@NL@%
  156. %@NL@%
  157.   ■   A source-level browser%@NL@%
  158. %@NL@%
  159.   ■   A complete on-line reference system%@NL@%
  160. %@NL@%
  161.   ■   A source-level, window-oriented debugger %@NL@%
  162. %@NL@%
  163. %@NL@%
  164. The Programmer's WorkBench (PWB) integrates these tools, creating an
  165. environment in which you can edit, compile, link, and debug your programs.  %@NL@%
  166. %@NL@%
  167. This book is a general introduction to the Microsoft C Professional
  168. Development System. This chapter introduces some of the features of the
  169. Professional Development System. Chapter 2 describes how to install the
  170. Professional Development System. Chapter 3 introduces the Programmer's
  171. WorkBench. Chapter 4 shows how to use the on-line reference system─a
  172. complete reference to the Professional Development System and the C
  173. language, which is available both within PWB and at the OS/2 and DOS command
  174. lines.  %@NL@%
  175. %@NL@%
  176. ────────────────────────────────────────────────────────────────────────────%@NL@%
  177. NOTE
  178.  
  179. %@AI@%Microsoft documentation uses the term "OS/2" to refer to the OS/2 systems─
  180. %@AI@%Microsoft Operating System/2 (MS%@AI@%(R)%@AE@%%@AI@% OS/2) and IBM%@AE@%%@AI@%(R)%@AE@%%@AI@% %@AE@%%@AI@% OS/2. Similarly, the
  181. %@AI@%term "DOS" refers to both the MS-DOS%@AE@%%@AI@%(R)%@AE@%%@AI@% and IBM Personal Computer DOS
  182. %@AI@%operating systems. The name of a specific operating system is used when it
  183. %@AI@%is necessary to note features that are unique to the system.%@AE@%%@AE@%%@NL@%
  184. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  185. %@NL@%
  186. If you'd like further information about a topic as you read through this
  187. book, you can consult  %@NL@%
  188. %@NL@%
  189. %@NL@%
  190.   ■   %@AI@%Advanced Programming Techniques%@AE@%%@NL@%
  191. %@NL@%
  192.   ■   The %@AI@%C Reference%@AE@% guide%@NL@%
  193. %@NL@%
  194.   ■   The on-line reference system (as discussed in Chapter 4)%@NL@%
  195. %@NL@%
  196. %@NL@%
  197. All of these sources are included in the Microsoft C package; they present
  198. detailed information about the various components of the Professional
  199. Development System.  %@NL@%
  200. %@NL@%
  201. %@NL@%
  202. %@2@%%@CR:C6A00010002 @%%@AB@%Before You Proceed%@AE@%%@EH@%%@NL@%
  203. %@NL@%
  204. Before installing Microsoft C, take a few minutes to make sure your computer
  205. meets minimum system requirements and that your package is complete.  %@NL@%
  206. %@NL@%
  207. %@NL@%
  208. %@3@%%@CR:C6A00010003 @%%@AB@%System Requirements%@AE@%%@EH@%%@NL@%
  209. %@NL@%
  210. Microsoft C requires the following configuration:  %@NL@%
  211. %@NL@%
  212. %@NL@%
  213.   ■   An IBM Personal Computer or 100% compatible running DOS version 3.0 or
  214.       later or OS/2 version 1.1 or later.  %@NL@%
  215. %@NL@%
  216.   ■   An 8088 processor (a minimum of an 8 megahertz, 80286 processor is
  217.       recommended).%@NL@%
  218. %@NL@%
  219.   ■   512K (kilobytes) of available memory (RAM) for operating under DOS (1
  220.       megabyte of RAM is recommended).%@NL@%
  221. %@NL@%
  222.   ■   3 megabytes of RAM for operating under OS/2 (4 megabytes of RAM are
  223.       recommended).%@NL@%
  224. %@NL@%
  225.   ■   At least 384K of extended memory if you want to debug large DOS
  226.       programs.%@NL@%
  227. %@NL@%
  228.   ■   One hard-disk drive with a minimum of 8 megabytes of free space.
  229.       (Depending on the options you want, you may need up to 20 megabytes of
  230.       disk space.)%@NL@%
  231. %@NL@%
  232.   ■   One 1.2 megabyte, 5.25-inch floppy disk drive or one 720K, 3.5-inch
  233.       floppy disk drive.%@NL@%
  234. %@NL@%
  235. %@NL@%
  236. Programs compiled with Microsoft C version 6.0 support DOS versions 2.1 and
  237. later.  %@NL@%
  238. %@NL@%
  239. %@NL@%
  240. %@3@%%@CR:C6A00010004 @%%@AB@%Package Contents%@AE@%%@EH@%%@NL@%
  241. %@NL@%
  242. Check your Microsoft C package to see if everything is there. If any pieces
  243. are missing, contact the retailer from whom you purchased Microsoft C.  %@NL@%
  244. %@NL@%
  245. In the package, you should find the following items:  %@NL@%
  246. %@NL@%
  247. %@NL@%
  248.   ■   Registration card. There are many advantages to being a registered
  249.       owner of Microsoft C version 6.0, including notification of future
  250.       software releases and easy access to customer assistance. Please take
  251.       the time to fill out and mail the registration card now. (If you are
  252.       already a registered owner of an earlier version of Microsoft C, a
  253.       registration card is not included with the update.)%@NL@%
  254. %@NL@%
  255.   ■   Disks. The distribution disk labeled "Setup/Compiler" contains a file
  256.       named PACKING.LST that lists the location and description of all disk
  257.       files in the Microsoft C package. Files on the disks are compacted and
  258.       are uncompressed with the Setup program as they are installed.
  259.       Microsoft C is distributed on 5.25-inch high density disks or 3.5-inch
  260.       disks. If you need 360K disks to install the compiler, please send in
  261.       the 3.5-inch media order card contained in the C 6.0 package or call
  262.       Microsoft Customer Service (1-800-426-9400).%@NL@%
  263. %@NL@%
  264.   ■   %@AI@%Installing and Using Microsoft C.%@AE@% It explains how to install and use
  265.       Microsoft C.%@NL@%
  266. %@NL@%
  267.   ■   %@AI@%Advanced Programming Techniques.%@AE@% This book discusses advanced topics
  268.       concerning Microsoft C. Part 1, "Improving Program Performance,"
  269.       examines options and methods for producing more efficient code. Part
  270.       2, "Improving Programmer Productivity," describes tools and techniques
  271.       the Professional Development System offers to help you work more
  272.       efficiently. Part 3, "Special Environments," discusses graphics,
  273.       mixed-language programming, and portability. Part 4, "OS/2 Support,"
  274.       discusses developing OS/2 applications with the Professional
  275.       Development System.%@NL@%
  276. %@NL@%
  277.   ■   %@AI@%C Reference.%@AE@% This book includes a summary of compiler, linker, editor,
  278.       the Microsoft CodeView(R) debugger, and other tool commands; a brief
  279.       language reference; and a complete list of library functions.%@NL@%
  280. %@NL@%
  281.   ■   %@AI@%Product Assistance Request.%@AE@% If you need to contact Microsoft Product
  282.       Support, be sure to fill out this questionnaire before calling.%@NL@%
  283. %@NL@%
  284.   ■   %@AI@%Documentation Feedback Card.%@AE@% To help Microsoft improve its
  285.       documentation, a postage-paid survey mailer is included. Please take
  286.       the time to fill out the card with any comments or suggestions. %@NL@%
  287. %@NL@%
  288. %@NL@%
  289. %@NL@%
  290. %@2@%%@CR:C6A00010005 @%%@AB@%Features New to Version 6.0%@AE@%%@EH@%%@NL@%
  291. %@NL@%
  292. If you've used an earlier version of Microsoft C, you'll find many new
  293. capabilities in version 6.0, and you'll discover that you can perform
  294. familiar operations more quickly:  %@NL@%
  295. %@NL@%
  296. %@NL@%
  297.   ■   Speed up development with the integrated PWB environment, including a
  298.       fast-turnaround incremental compiler and linker.%@NL@%
  299. %@NL@%
  300.   ■   Increase program efficiency with global optimization and smaller
  301.       run-time libraries.%@NL@%
  302. %@NL@%
  303.   ■   Build programs more easily with the new Make facility (NMAKE) and
  304.       PWB's powerful project capabilities.%@NL@%
  305. %@NL@%
  306.   ■   Insert assembly code directly into your C source code with the
  307.       integrated in-line assembler.%@NL@%
  308. %@NL@%
  309.   ■   Track down program bugs and logic errors more quickly with the new
  310.       Microsoft CodeView debugger version 3.0. With an 80286 or 80386
  311.       processor and 1 megabyte or more of RAM, you can debug a program of
  312.       any size in real mode.%@NL@%
  313. %@NL@%
  314.   ■   Access all C run-time, language, compiler, linker, and utility
  315.       documentation with the Microsoft Advisor and QuickHelp on-line
  316.       reference systems.%@NL@%
  317. %@NL@%
  318.   ■   Cross-reference program functions and variables with the PWB Source
  319.       Browser.%@NL@%
  320. %@NL@%
  321.   ■   Create OS/2 applications with increased support for dynamic-link
  322.       libraries (DLLs), multiple threads, and improved debugging options.%@NL@%
  323. %@NL@%
  324.   ■   Use based pointers to control placement of data in segments and
  325.       generate better code for far-pointer manipulation.%@NL@%
  326. %@NL@%
  327.   ■   Pass function parameters more efficiently with the %@AB@%_fastcall%@AE@% calling
  328.       convention.%@NL@%
  329. %@NL@%
  330.   ■   Edit source code with PWB's mouse- and window-oriented editor, which
  331.       has all the functionality of the Microsoft Editor.%@NL@%
  332. %@NL@%
  333. %@NL@%
  334. %@NL@%
  335. %@2@%%@CR:C6A00010006 @%%@AB@%Why Microsoft Programmer's WorkBench?%@AE@%%@EH@%%@NL@%
  336. %@NL@%
  337. The Programmer's WorkBench offers a wide array of features that can cut
  338. development time and increase your productivity.  %@NL@%
  339. %@NL@%
  340. One feature that sets PWB apart from other development systems is its fully
  341. integrated, mouse- and window-based development environment. Most operations
  342. can be performed with menu selections or single keyboard commands. You never
  343. need to leave PWB to edit, build, debug, and run a program.  %@NL@%
  344. %@NL@%
  345. PWB is built around the Microsoft Editor. The editor is completely
  346. extensible and can easily be configured to meet your personal needs. The
  347. editor combines advanced features such as macros and regular-expression
  348. search capabilities with the simplicity of a window-based application (see
  349. Figure 1.1).  %@NL@%
  350. %@NL@%
  351. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  352. %@NL@%
  353. As you develop your program, you can find information in the Microsoft
  354. Advisor on-line reference system instead of paging through manuals. A menu
  355. command provides complete information on the C language and run-time
  356. libraries. The Microsoft Advisor also supplies details on PWB, the compiler,
  357. linker, CodeView, and even the reference system itself. Figure 1.2 shows
  358. summary information on %@AB@%printf%@AE@%.  %@NL@%
  359. %@NL@%
  360. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  361. %@NL@%
  362. When you're ready to compile the program, you don't need to remember the
  363. full range of command-line compiler options. All of the options are
  364. conveniently available in a PWB dialog box and can be clicked on or off (see
  365. Figure 1.3). Setting options is simply a matter of using the mouse or
  366. keyboard to select compiler, linker, NMAKE, and CodeView switches.  %@NL@%
  367. %@NL@%
  368. PWB uses the powerful NMAKE tool to speed up development. NMAKE examines
  369. each module of a program to determine whether changes have been made that
  370. require the module to be recompiled. NMAKE then automatically compiles the
  371. modules as necessary and links them. When you're ready to build your
  372. program, you just select a single menu command to start the process. PWB
  373. invokes NMAKE and builds an application, using the options you set.  %@NL@%
  374. %@NL@%
  375. If any errors are encountered, PWB displays an error window with a full
  376. listing of the compile and link errors (see Figure 1.4). The editor
  377. indicates the source line containing the error, and you can use the on-line
  378. reference system to provide comprehensive information about each error.  %@NL@%
  379. %@NL@%
  380. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  381. %@NL@%
  382. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  383. %@NL@%
  384. Once a program has been successfully built, you can run it from within PWB
  385. to test it. If you need to make modifications, you can interrupt the program
  386. and return directly to PWB to make the changes.  %@NL@%
  387. %@NL@%
  388. Another useful PWB feature is the Source Browser. With the Browser you can
  389. examine your code and display information about function and variable
  390. relationships (see Figure 1.5). This option is helpful in tracking program
  391. flow and isolating bugs.  %@NL@%
  392. %@NL@%
  393. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  394. %@NL@%
  395. For bugs that are more difficult to locate and understand, use PWB's Debug
  396. Build option, and invoke the CodeView debugger directly from PWB. Then you
  397. can step and trace through your code at the source level and examine
  398. variables, registers, and memory (see Figure 1.6).  %@NL@%
  399. %@NL@%
  400. Once you locate the bug you can exit CodeView and return directly to PWB,
  401. where you can fix the problem. When the code is completely debugged, a final
  402. release program can be built by using PWB's Release Build option.  %@NL@%
  403. %@NL@%
  404. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  405. %@NL@%
  406. %@NL@%
  407. %@NL@%
  408. %@NL@%
  409. %@NL@%
  410. %@NL@%
  411. %@CR:C6A00020001 @%%@1@%%@AB@%Chapter 2  Installing Microsoft C%@AE@%%@EH@%%@NL@%
  412. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  413. %@NL@%
  414. This chapter describes how to install Microsoft C on your system, configure
  415. extended memory for use with CodeView, and customize components of
  416. Microsoft C.  %@NL@%
  417. %@NL@%
  418. Files on the disks are compressed; SETUP.EXE is provided for installing
  419. Microsoft C under DOS and OS/2 operating environments. SETUP uncompresses
  420. and copies a variety of files─the compiler, the linker, the Programmer's
  421. WorkBench (PWB), the library manager, libraries, the help system, and
  422. others─from the distribution disks to your hard disk. SETUP also can build
  423. combined libraries from component libraries such as math libraries,
  424. memory-model-specific base libraries, and graphics libraries; and can build
  425. additional libraries as needed.  %@NL@%
  426. %@NL@%
  427. Before you run the SETUP utility, back up the distribution disks and make
  428. sure you have enough disk space (between 5 and 10 megabytes, depending on
  429. which options you select) to install the Professional Development System.
  430. Then read the first part of the README.DOC file to see whether it has any
  431. information concerning the installation process.  %@NL@%
  432. %@NL@%
  433. ────────────────────────────────────────────────────────────────────────────%@NL@%
  434. NOTE
  435.  
  436. %@AI@%If you are installing Microsoft C from 3.5-inch disks, SETUP.EXE is found on
  437. %@AI@%the disk labeled "Setup." If you are using 5.25-inch disks, SETUP is on the
  438. %@AI@%disk labeled "Setup and Compiler."%@AE@%%@NL@%
  439.  
  440. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  441. %@NL@%
  442. %@NL@%
  443. %@2@%%@CR:C6A00020002 @%%@AB@%Running SETUP%@AE@%%@EH@%%@NL@%
  444. %@NL@%
  445. Insert the disk containing the SETUP program in drive A, make that drive the
  446. current drive, then run SETUP.EXE. The program first displays a screen
  447. reminding you to read the documentation before installing Microsoft C (see
  448. Figure 2.1). This initial screen also points out that the default answers to
  449. SETUP's questions are usually good when you first install Microsoft C. Press
  450. ENTER to proceed.  %@NL@%
  451. %@NL@%
  452. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  453. %@NL@%
  454. %@NL@%
  455. %@3@%%@CR:C6A00020003 @%%@AB@%Supplying SETUP Information%@AE@%%@EH@%%@NL@%
  456. %@NL@%
  457. Before SETUP can install Microsoft C, it needs information about your system
  458. and the type of programming you intend to do. This first stage of SETUP is a
  459. series of questions divided among three screens. Default answers to the
  460. questions appear in brackets; you can press ENTER to accept the defaults, or
  461. you can type in your own answers to override the defaults. Detailed
  462. information on the questions appears at the bottom of each screen. Each
  463. screen concludes by asking if you want to change any of your choices. Press
  464. N and then ENTER to move to the next screen.  %@NL@%
  465. %@NL@%
  466. ────────────────────────────────────────────────────────────────────────────%@NL@%
  467. NOTE
  468.  
  469. %@AI@%The questions that are displayed on your screen may differ slightly from the
  470. %@AI@%questions that are shown in this chapter. For example, if DOS is specified
  471. %@AI@%as the host operating mode, later questions will refer to DOS.%@AE@%%@NL@%
  472. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  473. %@NL@%
  474. %@NL@%
  475. %@3@%%@CR:C6A00020004 @%%@AB@%Correcting Mistakes%@AE@%%@EH@%%@NL@%
  476. %@NL@%
  477. If you want to change any of your choices, press Y. The questions will be
  478. repeated, but the choices you previously made become the default answers.  %@NL@%
  479. %@NL@%
  480. To exit the SETUP program at any time without saving default answers, press
  481. CTRL+C.  %@NL@%
  482. %@NL@%
  483. ────────────────────────────────────────────────────────────────────────────%@NL@%
  484. NOTE
  485.  
  486. %@AI@%The SETUP program doesn't erase any files from the distribution disks. If
  487. %@AI@%you make a mistake during the setup process, just run SETUP again.%@AE@%%@NL@%
  488. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  489. %@NL@%
  490. %@NL@%
  491. %@3@%%@CR:C6A00020005 @%%@AB@%First Screen: Installing Libraries%@AE@%%@EH@%%@NL@%
  492. %@NL@%
  493. On the first SETUP screen (see Figure 2.2), you supply information SETUP
  494. uses to build run-time library files on your hard disk.  %@NL@%
  495. %@NL@%
  496. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  497. %@NL@%
  498. %@NL@%
  499. %@4@%%@AB@%Selecting the Operating Mode%@AE@%%@EH@%%@NL@%
  500. %@NL@%
  501. Microsoft C can run under both OS/2 and DOS, and it can create executable
  502. files for either environment. Select the host operating mode under which
  503. your computer will usually run. Applications intended for OS/2 and DOS use
  504. different libraries. Specify the target operating mode for which you will
  505. most frequently be developing executable files. Both modes may optionally be
  506. selected.  %@NL@%
  507. %@NL@%
  508. %@NL@%
  509. %@4@%%@AB@%Building Combined Libraries%@AE@%%@EH@%%@NL@%
  510. %@NL@%
  511. SETUP can create combined libraries for the memory model, math options, and
  512. operating modes you specify. Combined libraries reduce the amount of time
  513. required for linking.  %@NL@%
  514. %@NL@%
  515. The component libraries can be left on your hard disk after combined
  516. libraries are built. However, you should delete them to free disk space
  517. unless you plan to build additional combined libraries in the near future.  %@NL@%
  518. %@NL@%
  519. You have the option of including the graphics libraries GRAPHICS.LIB and
  520. PGCHART.LIB in your combined libraries. GRAPHICS.LIB contains numerous
  521. functions for drawing lines, rectangles, circles, and other shapes.
  522. PGCHART.LIB contains functions for creating presentation-quality,
  523. high-resolution graphs. (Under OS/2 protected mode, you also have the option
  524. of including another library, GRTEXTP.LIB, in your combined library. This
  525. library provides support for OS/2 text-mode functions.) If you choose not to
  526. include these libraries in the combined libraries, they will be copied onto
  527. your disk as separate libraries. If you then use routines from these
  528. libraries, you will need to explicitly specify the libraries when you link.
  529. %@NL@%
  530. %@NL@%
  531. The first time you install Microsoft C, you should create only one or two
  532. combined libraries. If you need other memory models, math packages, or
  533. operating modes, rerun the SETUP program with the /L option.  %@NL@%
  534. %@NL@%
  535. %@NL@%
  536. %@4@%%@AB@%Choosing Math Options%@AE@%%@EH@%%@NL@%
  537. %@NL@%
  538. The math options you choose determine which math component libraries are
  539. included in your combined libraries. The default provided by SETUP depends
  540. on whether it detects a math coprocessor.  %@NL@%
  541. %@NL@%
  542. Programs that use the 8087 library run only on a machine equipped with a
  543. math coprocessor. The 80x87 option generates applications that perform fast
  544. floating-point math.  %@NL@%
  545. %@NL@%
  546. Programs linked with the emulator library will run on any computer, whether
  547. or not it has a coprocessor. If the computer has a coprocessor, the emulator
  548. library uses the coprocessor to perform all floating-point math operations.
  549. Otherwise, the library emulates a coprocessor.  %@NL@%
  550. %@NL@%
  551. The alternate math library uses an alternate number representation; when a
  552. coprocessor is not present, programs using this library run faster than
  553. programs using the emulator. (Even if a coprocessor is installed, the
  554. alternate math library routines will not use it.) Selecting the alternate
  555. math library sacrifices some accuracy for increased execution speed and
  556. decreased program size.  %@NL@%
  557. %@NL@%
  558. ────────────────────────────────────────────────────────────────────────────%@NL@%
  559. NOTE
  560.  
  561. %@AI@%You may include all math libraries in your libraries, but doing so triples
  562. %@AI@%the number of combined libraries SETUP builds, thus tripling installation
  563. %@AI@%time and increasing storage requirements. If you intend to install all
  564. %@AI@%possible library configurations, you'll need approximately 6 megabytes of
  565. %@AI@%free space on your hard disk just for libraries. If you install just one
  566. %@AI@%library, you'll need about 3.3 megabytes.%@AE@%%@NL@%
  567. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  568. %@NL@%
  569. For more information on math options, see Chapter 4, "Controlling
  570. Floating-Point Math Operations," in %@AI@%Advanced Programming Techniques%@AE@%.  %@NL@%
  571. %@NL@%
  572. %@NL@%
  573. %@4@%%@AB@%Choosing Memory Models%@AE@%%@EH@%%@NL@%
  574. %@NL@%
  575. Microsoft C supports six standard memory models. Table 2.1 illustrates the
  576. relationship between the available memory models and the limits placed on
  577. their code and data segments.  %@NL@%
  578. %@NL@%
  579. %@AB@%Table 2.1  Memory Models%@AE@%
  580.  
  581. %@TH:  16   526 02 14 20 42 @%Memory Model  Code Segment Limit  Data Segment Limit%@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%Tiny          64K                 64K (CODE + DATA)Small         64K                 64KMedium        None                64KCompact       64K                 NoneLarge         None                NoneHuge          None                None%@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%%@TE:  16   526 02 14 20 42 @%
  582.  
  583. For more information on memory models, see Chapter 2, "Managing Memory," in
  584. %@AI@%Advanced Programming Techniques%@AE@%.  %@NL@%
  585. %@NL@%
  586. %@NL@%
  587. %@4@%%@AB@%Specifying Default Library Names%@AE@%%@EH@%%@NL@%
  588. %@NL@%
  589. SETUP normally gives each combined library a name of the form %@AI@%m%@AE@%LIBC%@AI@%fs%@AE@%.LIB,
  590. where %@AI@%m%@AE@% is S, M ,C, or L (memory model); %@AI@%f%@AE@% is A, E, or 7 (math library); and
  591. %@AI@%s%@AE@% is R or P (operating mode).  %@NL@%
  592. %@NL@%
  593. This question will vary according to the target operating system you
  594. selected. If you chose OS/2, you will be asked whether to use the default
  595. OS/2 library names. If you selected both operating modes, you will be asked
  596. whether to use the default libraries for OS/2 and DOS.  %@NL@%
  597. %@NL@%
  598. If you selected only one operating mode, or if you selected both but plan to
  599. program in one mode predominantly, you should have SETUP give default names
  600. to all libraries built for that mode.  %@NL@%
  601. %@NL@%
  602. %@NL@%
  603. %@3@%%@CR:C6A00020006 @%%@AB@%Second Screen: Installing Additional Files%@AE@%%@EH@%%@NL@%
  604. %@NL@%
  605. Your answers to questions on this screen determine whether PWB is installed
  606. (see Figure 2.3).  %@NL@%
  607. %@NL@%
  608. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  609. %@NL@%
  610. %@NL@%
  611. %@4@%%@AB@%Installing PWB%@AE@%%@EH@%%@NL@%
  612. %@NL@%
  613. You may choose not to install PWB if you plan to use only the command-line
  614. version of the compiler and linker. If you install PWB, you can choose to
  615. configure the PWB editor so that it is similar to the BRIEF(R) editor.  %@NL@%
  616. %@NL@%
  617. %@NL@%
  618. %@4@%%@AB@%Installing the Microsoft Mouse%@AE@%%@EH@%%@NL@%
  619. %@NL@%
  620. If you have chosen OS/2 real mode and DOS as the host operating mode, you
  621. are asked whether you want to install the most recent version of the
  622. Microsoft Mouse device driver.  %@NL@%
  623. %@NL@%
  624. %@NL@%
  625. %@4@%%@AB@%Copying Patch Files%@AE@%%@EH@%%@NL@%
  626. %@NL@%
  627. If you have chosen OS/2 real mode and DOS as the host operating mode, you
  628. have the option of installing a patch for dealing with floating-point
  629. exceptions found under PC-DOS version 3.20.  %@NL@%
  630. %@NL@%
  631. %@NL@%
  632. %@3@%%@CR:C6A00020007 @%%@AB@%Third Screen: Specifying Directories%@AE@%%@EH@%%@NL@%
  633. %@NL@%
  634. On this screen, you specify the directories into which SETUP copies library,
  635. header, and other files (see Figure 2.4). You can choose to override the
  636. default options for directory names. Be sure to enter complete path names
  637. for your own directories. If the specified directories don't exist, SETUP
  638. asks whether you want to create them.  %@NL@%
  639. %@NL@%
  640. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  641. %@NL@%
  642. The questions about protected-mode executable files and dynamic link
  643. libraries appear only if OS/2 protected mode has been selected as the target
  644. operating mode.  %@NL@%
  645. %@NL@%
  646. ────────────────────────────────────────────────────────────────────────────%@NL@%
  647. NOTE
  648.  
  649. %@AI@%The questions about executable files concern the location of development
  650. %@AI@%tools, not the executable files you create with Microsoft C.%@AE@%%@NL@%
  651. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  652. %@NL@%
  653. %@NL@%
  654. %@3@%%@CR:C6A00020008 @%%@AB@%Checking Available Disk Space%@AE@%%@EH@%%@NL@%
  655. %@NL@%
  656. Before moving to stage two, SETUP checks your hard disk to see how much free
  657. space is available. If you don't have enough room to install Microsoft C, an
  658. error message informs you how much space is required for the files you've
  659. requested.  %@NL@%
  660. %@NL@%
  661. If you don't have enough room on your hard disk, you can either delete
  662. existing hard-disk files or reduce the number of requested libraries.  %@NL@%
  663. %@NL@%
  664. ────────────────────────────────────────────────────────────────────────────%@NL@%
  665. NOTE
  666.  
  667. %@AI@%If you feel that SETUP has incorrectly sized your disk for some reason, you
  668. %@AI@%can disable space checking by using the /NOFREE option.%@AE@%%@NL@%
  669. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  670. %@NL@%
  671. %@NL@%
  672. %@3@%%@CR:C6A00020009 @%%@AB@%SETUP Options%@AE@%%@EH@%%@NL@%
  673. %@NL@%
  674. SETUP has several options: /?, /COPY, /HELP, /LIB, /NOFREE, and /NOHELP.
  675. With the exception of /? and /HELP, you should %@AI@%not%@AE@% use any of the options
  676. the first time you run SETUP. The /? and /HELP options (see Figure 2.5)
  677. present information about the options.  %@NL@%
  678. %@NL@%
  679. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  680. %@NL@%
  681. The /COPY option uncompresses and copies individual files from the
  682. distribution disks. The /LIB option builds additional combined libraries
  683. after you have already installed Microsoft C, without going through the
  684. entire setup process. /NOFREE instructs SETUP not to check for available
  685. free disk space before uncompressing and copying files. The /NOHELP option
  686. suppresses the SETUP help information displayed at the bottom of the screen.
  687. %@NL@%
  688. %@NL@%
  689. %@NL@%
  690. %@3@%%@CR:C6A00020010 @%%@AB@%Configuring Your System%@AE@%%@EH@%%@NL@%
  691. %@NL@%
  692. When SETUP has finished creating the combined libraries and placing them in
  693. the directories you specified, it creates files that are used for
  694. configuring your system.  %@NL@%
  695. %@NL@%
  696. If you selected OS/2 real mode or DOS as the host environment, SETUP creates
  697. three files: NEW-VARS.BAT, NEW-CONF.SYS, and TOOLS.PRE. The files
  698. NEW-VARS.BAT and NEW-CONF.SYS are placed in the directory C:\C600\BIN; the
  699. file TOOLS.PRE is placed in the directory C:\C600\INIT. (These are the
  700. default directory names. If you have overridden them with your own choices,
  701. SETUP places these files in the directories you specified.)  %@NL@%
  702. %@NL@%
  703. If you selected OS/2 protected mode as the host environment, SETUP creates
  704. two files: NEW-VARS.CMD and TOOLS.PRE. The file NEW-VARS.CMD is placed in
  705. the directory C:\C600\BINP; the file TOOLS.PRE is placed in the directory
  706. C:\C600\INIT. (These are the default directory names. If you have overridden
  707. them with your own choices, SETUP places these files in the directories you
  708. specified.)  %@NL@%
  709. %@NL@%
  710. To permanently configure your system for Microsoft C, you must add the
  711. respective file contents to your AUTOEXEC.BAT (or STARTUP.CMD), CONFIG.SYS,
  712. and TOOLS.INI files, and reboot your system. You can, however, run
  713. NEW-VARS.BAT or NEW-VARS.CMD to set environment variables before you use
  714. Microsoft C.  %@NL@%
  715. %@NL@%
  716. %@NL@%
  717. %@4@%%@AB@%Changing AUTOEXEC.BAT or STARTUP.CMD%@AE@%%@EH@%%@NL@%
  718. %@NL@%
  719. The NEW-VARS.BAT and NEW-VARS.CMD files contain batch file commands that set
  720. environment variables. Insert these commands into the AUTOEXEC.BAT or
  721. STARTUP.CMD file. Table 2.2 describes the meaning of each variable.  %@NL@%
  722. %@NL@%
  723. %@AB@%Table 2.2  Environment Variables%@AE@%
  724.  
  725. %@TH:  16   673 02 34 44 @%Variable                          Description%@AB@%──────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%PATH                              Path to search for applicationsLIB                               Location of run-time librariesINCLUDE                           Location of include (.H) filesHELPFILES                         Location of help (.HLP) filesINIT                              Location of initialization filesTEMP                              Location of PWB/LINK temporary files%@AB@%──────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%%@TE:  16   673 02 34 44 @%
  726.  
  727. %@NL@%
  728. %@4@%%@AB@%Modifying CONFIG.SYS%@AE@%%@EH@%%@NL@%
  729. %@NL@%
  730. If the host operating mode is OS/2 real mode or DOS, be sure the %@AS@% files %@AE@% and
  731. %@AS@% buffer %@AE@% values in CONFIG.SYS are large enough for Microsoft C. The values
  732. in NEW-CONF.SYS are minimums. The values in CONFIG.SYS should be greater
  733. than or equal to these amounts. Additionally, with OS/2, make sure the %@AS@%
  734. %@AS@%LIBPATH= %@AE@% line of the CONFIG.SYS file specifies the location of the file
  735. MSHELP.DLL. OS/2 users who want to use the CodeView debugger must also
  736. include the statement %@AS@% IOPL=YES%@AE@%.  %@NL@%
  737. %@NL@%
  738. To use the extended memory features of CodeView under DOS, set
  739. %@AS@%DEVICE=HIMEM.SYS %@AE@% (with HIMEM's fully qualified path name). See the section
  740. in this chapter titled "Configuring Extended Memory for CodeView" for
  741. additional information on running CodeView with extended memory in a DOS
  742. environment.  %@NL@%
  743. %@NL@%
  744. %@NL@%
  745. %@4@%%@AB@%Modifying TOOLS.INI%@AE@%%@EH@%%@NL@%
  746. %@NL@%
  747. SETUP creates a file called TOOLS.PRE. This file contains various PWB
  748. settings, such as those that specify libraries. You should add the contents
  749. of the TOOLS.PRE file to your existing TOOLS.INI file; if TOOLS.INI does not
  750. exist, you should rename TOOLS.PRE to TOOLS.INI.  %@NL@%
  751. %@NL@%
  752. The TOOLS.INI file contains many configuration options, which help you
  753. customize the following utilities in Microsoft C:  %@NL@%
  754. %@NL@%
  755. %@NL@%
  756.   ■   PWB%@NL@%
  757. %@NL@%
  758.   ■   The CodeView debugger%@NL@%
  759. %@NL@%
  760.   ■   The Microsoft Advisor help system%@NL@%
  761. %@NL@%
  762.   ■   The NMAKE utility%@NL@%
  763. %@NL@%
  764. %@NL@%
  765. You can use the PWB editor or a word processor to change the settings in the
  766. TOOLS.INI file. These are some of the options you can change:  %@NL@%
  767. %@NL@%
  768. %@NL@%
  769.   ■   The colors and the number of lines displayed by CodeView and PWB%@NL@%
  770. %@NL@%
  771.   ■   Macros for PWB%@NL@%
  772. %@NL@%
  773.   ■   Key assignments for PWB%@NL@%
  774. %@NL@%
  775.   ■   Default key settings for PWB%@NL@%
  776. %@NL@%
  777.   ■   The location of help files used by the Microsoft Advisor%@NL@%
  778. %@NL@%
  779.   ■   Options for NMAKE%@NL@%
  780. %@NL@%
  781. %@NL@%
  782. A complete table of TOOLS.INI settings is available in on-line help and the
  783. %@AI@%C Reference%@AE@%.  %@NL@%
  784. %@NL@%
  785. %@NL@%
  786. %@3@%%@CR:C6A00020011 @%%@AB@%Choosing a Target Operating Environment%@AE@%%@EH@%%@NL@%
  787. %@NL@%
  788. In many cases you will program primarily for either the OS/2 protected mode
  789. or the DOS 3.x - OS/2 real mode and use one combined library. Allowing SETUP
  790. to make either DOS or OS/2 the default environment is the easiest method,
  791. but you can also manually choose a target environment.  %@NL@%
  792. %@NL@%
  793. %@NL@%
  794. %@4@%%@AB@%Choosing Defaults for a Single Mode%@AE@%%@EH@%%@NL@%
  795. %@NL@%
  796. Start by deciding which operating mode will be the default environment. Then
  797. give the combined library for that mode the default combined-library name.
  798. The composition of library names is explained in the section "Specifying
  799. Default Library Names."  %@NL@%
  800. %@NL@%
  801. For example, the following steps will create a protected-mode executable
  802. file using the small memory model and the emulation floating-point library:
  803. %@NL@%
  804. %@NL@%
  805. %@NL@%
  806.   1.  Use SETUP to create SLIBCEP.LIB, the combined library for the small
  807.       memory model, floating-point emulation, and protected mode.%@NL@%
  808. %@NL@%
  809.   2.  Rename SLIBCEP.LIB as SLIBCE.LIB (the same name without P), the
  810.       default combined library name for the small memory model and
  811.       floating-point emulation library.%@NL@%
  812. %@NL@%
  813. %@NL@%
  814. At this point you can use PWB or invoke the command-line compiler, CL,
  815. without specifying the target operating environment for your application.
  816. (In this example, you still need to supply the appropriate PWB or CL options
  817. to select a memory model and floating point options.) If you don't specify a
  818. memory-model option or floating-point option on the command line, the linker
  819. links SLIBCE.LIB, creating an executable file that runs in OS/2 protected
  820. mode.  %@NL@%
  821. %@NL@%
  822. The same general procedure works for real mode, other memory models, and
  823. floating-point libraries: Create the appropriate operating mode and combined
  824. library, and give it the appropriate default combined-library name.  %@NL@%
  825. %@NL@%
  826. %@NL@%
  827. %@4@%%@AB@%Selecting a Mode at Compile Time%@AE@%%@EH@%%@NL@%
  828. %@NL@%
  829. If you need the flexibility of programming for both operating modes, you
  830. should use SETUP to create the combined libraries that you need for each
  831. model. Once you have created the combined libraries, you can select a model
  832. either by using the PWB options found in the C Compiler Options dialog box
  833. or the CL options listed in Table 2.3.  %@NL@%
  834. %@NL@%
  835. %@AB@%Table 2.3  Operating Environment Options%@AE@%
  836.  
  837. %@TH:  10   594 02 08 52 18 @%Option  Environment                                         Library Selected%@AB@%──────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%/Lp     OS/2 protected mode                                 %@AI@%m%@AE@%LIBC%@AI@%f%@AE@%P.LIB/Lr     DOS 3.x - OS/2 real mode                            %@AI@%m%@AE@%LIBC%@AI@%f%@AE@%R.LIB/Lc     DOS 3.x (synonym for /Lr)                           %@AI@%m%@AE@%LIBC%@AI@%f%@AE@%R.LIB%@AB@%──────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%%@TE:  10   594 02 08 52 18 @%
  838.  
  839. Using these options causes CL to substitute one of these library names for
  840. the default combined-library name in the object module's library-search
  841. record.  %@NL@%
  842. %@NL@%
  843. These options automatically set the /NODEFAULTLIBRARYSEARCH linker option,
  844. which overrides the default library (the syntax is /NOD:%@AI@%libraryname%@AE@%). For
  845. example, if you are programming for the OS/2 protected mode with the small
  846. memory model and floating-point emulation, and you supply the /Lp option for
  847. CL, the compiler passes the following option to the linker:  %@NL@%
  848. %@NL@%
  849. %@AS@%  /NOD:slibce slibcep%@AE@%%@NL@%
  850. %@NL@%
  851. %@NL@%
  852. %@2@%%@CR:C6A00020012 @%%@AB@%Configuring Extended Memory for CodeView%@AE@%%@EH@%%@NL@%
  853. %@NL@%
  854. Extended memory refers to memory at physical addresses above 1 megabyte that
  855. can be accessed by an 80%@AI@%x%@AE@%86 CPU in protected mode.  %@NL@%
  856. %@NL@%
  857. As previously mentioned, in order to use the extended memory features of
  858. CodeView under a DOS environment, you must set %@AS@% DEVICE=HIMEM.SYS %@AE@% (with
  859. HIMEM's fully qualified path name) in the CONFIG.SYS file. A sample entry of
  860. how to implement HIMEM is found in the NEW-CONF.SYS file that SETUP creates.
  861. %@NL@%
  862. %@NL@%
  863. ────────────────────────────────────────────────────────────────────────────%@NL@%
  864. NOTE
  865.  
  866. %@AI@%HIMEM.SYS is an implementation of the XMS 2.x standard. The complete XMS
  867. %@AI@%source and specification are available from the Microsoft Information
  868. %@AI@%Center; call 1-800-426-9400.%@AE@%%@NL@%
  869. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  870. %@NL@%
  871. In addition, there are several factors to consider when using CodeView under
  872. DOS with extended memory:  %@NL@%
  873. %@NL@%
  874. %@NL@%
  875.   ■   At least 384K of extended memory should be set aside for use with
  876.       HIMEM.SYS.%@NL@%
  877. %@NL@%
  878.   ■   Other memory managers such as 386-Max(tm) or QEMM may not work in
  879.       conjunction with HIMEM.SYS. You should use only one memory manager.%@NL@%
  880. %@NL@%
  881.   ■   Older versions of HIMEM.SYS may present problems. Use the most recent
  882.       version included on the distribution disks.%@NL@%
  883. %@NL@%
  884.   ■   Many RAM disk (VDISK) and disk cache programs are incompatible with
  885.       HIMEM.SYS. The HIMEM.SYS compatible RAMDRIVE RAM disk and SMARTDRV
  886.       disk cache programs are provided on the distribution disks. If you are
  887.       operating under Microsoft Windows(tm) , the SMARTDRV application
  888.       shipped with the Professional Development System is incompatible with
  889.       Windows 2.11, and is compatible only with Windows 3.0.%@NL@%
  890. %@NL@%
  891.   ■   Check the documentation of installed terminate-and-stay-resident (TSR)
  892.       programs to see if they are compatible with HIMEM/XMS 2.x. You can
  893.       incrementally install each TSR until you find a potential offender.%@NL@%
  894. %@NL@%
  895. %@NL@%
  896. If you choose to install the HIMEM, RAMDRIVE, and SMARTDRV files, SETUP
  897. places them in the C:\C600\BIN directory.  %@NL@%
  898. %@NL@%
  899. ────────────────────────────────────────────────────────────────────────────%@NL@%
  900. NOTE
  901.  
  902. %@AI@%Extended memory should not be confused with %@AI@%expanded memory%@AE@%%@AI@%. Expanded memory
  903. %@AI@%refers to bank-switched memory that overcomes the 640K RAM limitation found
  904. %@AI@%in the 8088 processor.%@AE@%%@AE@%%@NL@%
  905. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  906. %@NL@%
  907. %@NL@%
  908. %@2@%%@CR:C6A00020013 @%%@AB@%Customizing Microsoft C%@AE@%%@EH@%%@NL@%
  909. %@NL@%
  910. In addition to modifying the TOOLS.INI file, Microsoft C can be customized
  911. in other ways. For example, a variety of editor functions and options can be
  912. set within PWB by using the Editor Settings command on the Options menu.  %@NL@%
  913. %@NL@%
  914. For more information about customizing PWB, refer to Chapter 3 or see
  915. Chapter 8, "Customizing the Microsoft Programmer's WorkBench," in %@AI@%Advanced
  916. %@AI@%Programming Techniques%@AE@%. More information about customizing NMAKE and other
  917. utilities can also be found in %@AI@%Advanced Programming Techniques%@AE@%.  %@NL@%
  918. %@NL@%
  919. %@NL@%
  920. %@NL@%
  921. %@NL@%
  922. %@NL@%
  923. %@NL@%
  924. %@CR:C6A00030001 @%%@1@%%@AB@%Chapter 3  Using the Programmer's WorkBench%@AE@%%@EH@%%@NL@%
  925. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  926. %@NL@%
  927. This chapter introduces the Programmer's WorkBench (PWB)─a powerful
  928. integrated tool designed to make writing and debugging programs easier. PWB
  929. is a window-oriented programming environment that incorporates a text
  930. editor, a compiler, a linker, a debugger, a Make utility, a source-code
  931. browser, and an on-line help database. PWB provides an alternative to
  932. switching between command-linebased programs: You can edit, compile, link
  933. and debug from within an integrated environment. To demonstrate various
  934. features of PWB, this chapter provides a sample program for you to compile,
  935. link, and debug.  %@NL@%
  936. %@NL@%
  937. This chapter explains how to start PWB and then introduces the following
  938. elements of PWB:  %@NL@%
  939. %@NL@%
  940. %@NL@%
  941.   ■   Windows and menus. You can quickly find the command you need with the
  942.       menu system. The section "Using Windows and Menus" explains how to
  943.       open and close windows and how to navigate through the menus.%@NL@%
  944. %@NL@%
  945.   ■   Programmer's editor. Features such as "bookmarks," macros, customized
  946.       key commands, and enhanced search capabilities decrease the amount of
  947.       time you spend writing code.%@NL@%
  948. %@NL@%
  949.   ■   Integrated compiler and linker. You can compile, link, and run a
  950.       program without ever leaving the editor. PWB's integrated environment
  951.       and project-management facilities save you hours of development time.%@NL@%
  952. %@NL@%
  953.   ■   Integrated browser and debugger. With the Source Browser, you can
  954.       quickly find a data declaration or function definition within your
  955.       source code, and find references to all functions and variables in a
  956.       multi-module program. With the CodeView debugger, you can set
  957.       breakpoints, examine variables and machine registers, and step through
  958.       execution of your program one line at a time.%@NL@%
  959. %@NL@%
  960. %@NL@%
  961. %@NL@%
  962. %@2@%%@CR:C6A00030002 @%%@AB@%Starting PWB%@AE@%%@EH@%%@NL@%
  963. %@NL@%
  964. To run PWB for the first time, type  %@NL@%
  965. %@NL@%
  966. %@AS@%  PWB%@AE@%%@NL@%
  967. %@NL@%
  968. at the command line. (If errors occur, PWB displays error messages. See the
  969. README.DOC file for further information.)  %@NL@%
  970. %@NL@%
  971. You can immediately begin writing source code in the new, untitled window
  972. that appears. PWB maintains a history of the files you have opened. The next
  973. time you run PWB, it opens the last file you worked on.  %@NL@%
  974. %@NL@%
  975. %@NL@%
  976. %@3@%%@CR:C6A00030003 @%%@AB@%Specifying a Source File%@AE@%%@EH@%%@NL@%
  977. %@NL@%
  978. You can open an existing source file by entering its name on the command
  979. line after the PWB command. If PWB can't find the specified file in the
  980. current directory, it asks if you want to create a new file. You can also
  981. open an existing source file with the Open command in the File menu.  %@NL@%
  982. %@NL@%
  983. %@NL@%
  984. %@3@%%@CR:C6A00030004 @%%@AB@%Command-Line Options%@AE@%%@EH@%%@NL@%
  985. %@NL@%
  986. PWB has several command-line options that you can issue when you start the
  987. program.  %@NL@%
  988. %@NL@%
  989. %@AB@%Option%@AE@%                            %@AB@%Action%@AE@%
  990. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  991. /e %@AI@%string%@AE@%                         The %@AI@%string%@AE@% represents a series of PWB 
  992.                                   commands that will be executed at 
  993.                                   start-up.
  994.  
  995. /t %@AI@%file%@AE@%                           Indicates the specified file is 
  996.                                   temporary, and should not be kept in the
  997.                                   file history. You must precede the name 
  998.                                   of each temporary file with a /t.
  999.  
  1000. /D                                Prevents all PWB initialization and 
  1001.                                   status files from being read at 
  1002.                                   start-up.
  1003.  
  1004. /DS                               Prevents the CURRENT.STS file from being
  1005.                                   read.
  1006.  
  1007. /DT                               Prevents the TOOLS.INI file from being 
  1008.                                   read at
  1009.                                   start-up.
  1010.  
  1011. /r                                Turns on the global "no-edit mode," 
  1012.                                   which gives all files opened with PWB 
  1013.                                   Read Only status.
  1014.  
  1015. /m %@AI@%bookmark%@AE@%                       Positions the cursor at the file 
  1016.                                   location designated by %@AI@%bookmark%@AE@%.
  1017.  
  1018. /?                                Lists the command-line options for 
  1019.                                   starting up PWB.
  1020.  
  1021. %@NL@%
  1022. %@2@%%@CR:C6A00030005 @%%@AB@%Using Windows and Menus%@AE@%%@EH@%%@NL@%
  1023. %@NL@%
  1024. This section introduces the PWB environment and describes how to control
  1025. windows and choose commands from the menus. Terms used to describe elements
  1026. of the PWB environment are also presented.  %@NL@%
  1027. %@NL@%
  1028. ────────────────────────────────────────────────────────────────────────────%@NL@%
  1029. NOTE
  1030.  
  1031. %@AI@%You can enter commands in PWB with the keyboard or a Microsoft (or fully
  1032. %@AI@%compatible) Mouse. Unless the Right mouse button is specifically mentioned,
  1033. %@AI@%"clicking" means that you press and release the Left mouse button once.%@AE@%%@NL@%
  1034.  
  1035. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  1036. %@NL@%
  1037. %@NL@%
  1038. %@3@%%@CR:C6A00030006 @%%@AB@%Windows%@AE@%%@EH@%%@NL@%
  1039. %@NL@%
  1040. Figure 3.1 shows parts of a typical PWB screen. Some of the elements provide
  1041. information only. For example, if CAPS LOCK is on, the letter %@AS@% C %@AE@% appears in
  1042. the lower right corner of the screen; the letter %@AS@% C %@AE@% is informational. Other
  1043. parts perform actions triggered by a specific keystroke or mouse action. For
  1044. example, if you click the button in the upper left corner of a window, the
  1045. window closes. The button is active rather than informational.  %@NL@%
  1046. %@NL@%
  1047. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1048. %@NL@%
  1049. The parts of a PWB screen and their use are listed in Table 3.1 below.  %@NL@%
  1050. %@NL@%
  1051. %@AB@%Table 3.1  Parts of a PWB Screen%@AE@%
  1052.  
  1053. %@TH:  44  2135 02 22 54 @%Name                  Use%@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%Menu bar              Lists names of available menus.Close button          Closes window (appears only if more than one window                       is displayed).Title bar             Shows name of file currently being edited.Windows               Contain source code or display information                       associated with on-line help.Maximize button       Enlarges or restores window to its original size.Screen number         Indicates number of help screen in the on-line help                       database.Scroll bars           Indicate cursor position in the current file and                       allow cursor movement.Reference bar         Lists shortcut keystrokes (keyboard users) and                       directs PWB commands (mouse users); summar izes menu                      contents and displays other information.File-type indicator   Indicates type of file. %@AS@%C%@AE@%: C source. %@AS@%text%@AE@%: any other                      user-created file. %@AS@%pseudo%@AE@%: file-like means of                       displaying data.Line and column       Shows current line and column of text cursor.indicators            Status indicators     %@AS@%A%@AE@%: Meta condition is on.%@AS@%%@AE@%                      %@AS@%B%@AE@%: Background compile in OS/2.%@AS@%%@AE@%                      %@AS@%C%@AE@%: CAPS LOCK is on.%@AS@%%@AE@%                      %@AS@%L%@AE@%: A CR isn't used to terminate a line.%@AS@%%@AE@%                      %@AS@%M%@AE@%: File has been modified.%@AS@%%@AE@%                      %@AS@%N%@AE@%: NUM LOCK is on.%@AS@%%@AE@%                      %@AS@%O%@AE@%: Overtype is on.%@AS@%%@AE@%                      %@AS@%R%@AE@%: The file is set to Read Only status.%@AS@%%@AE@%                      %@AS@%T%@AE@%: File is temporary.%@AS@%%@AE@%                      %@AS@%X%@AE@%: A macro is recording.%@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%%@TE:  44  2135 02 22 54 @%
  1054.  
  1055. %@NL@%
  1056. %@3@%%@CR:C6A00030007 @%%@AB@%Menus%@AE@%%@EH@%%@NL@%
  1057. %@NL@%
  1058. The menu bar contains seven or more menus which can be accessed at any time.
  1059. A brief description of the selected menu command is displayed in the
  1060. reference bar. To get further information about what a menu does, invoke the
  1061. on-line help system by using the ALT and ARROW keys to highlight a menu
  1062. title or menu command, then press F1; or point the mouse cursor at the menu
  1063. command and click the Right mouse button.  %@NL@%
  1064. %@NL@%
  1065. PWB has the following menus:  %@NL@%
  1066. %@NL@%
  1067. %@AU@%(Please refer to the printed %@AE@%     The File menu allows you to clear the 
  1068. %@AU@%book)%@AE@%                             Source window, load an existing source 
  1069.                                   file, merge a file with the file in 
  1070.                                   memory, display the next file in the 
  1071.                                   file list specified at start-up, save 
  1072.                                   the current file, save the current file 
  1073.                                   under a different name, print the 
  1074.                                   selection or current file contents, 
  1075.                                   temporarily exit to DOS or OS/2, or 
  1076.                                   permanently exit PWB. Additionally, a 
  1077.                                   list of recently opened source files is 
  1078.                                   displayed at the bottom of the menu.
  1079.  
  1080. %@AU@%(Please refer to the printed %@AE@%     The Edit menu allows you to delete, cut,
  1081. %@AU@%book)%@AE@%                             copy, and paste text. Anchors can be set
  1082.                                   in the text as reference points for 
  1083.                                   selection. Box, stream, and line mode 
  1084.                                   determine how text will be selected with
  1085.                                   the cursor. Read Only status protects 
  1086.                                   source files. Commands to record, play, 
  1087.                                   and edit recorded macros are also 
  1088.                                   available in this menu. These items are 
  1089.                                   discussed further in the section "Using 
  1090.                                   the Editor."
  1091.  
  1092. %@AU@%(Please refer to the printed %@AE@%     The View menu controls the active 
  1093. %@AU@%book)%@AE@%                             window. A window can be closed, sized, 
  1094.                                   and split vertically or horizontally 
  1095.                                   with the menu commands.
  1096.  
  1097. %@AU@%(Please refer to the printed %@AE@%     The Search menu invokes commands that 
  1098. %@AU@%book)%@AE@%                             find or change text in source files. 
  1099.                                   Commands to search the source file for 
  1100.                                   compilation errors are also available. 
  1101.                                   Commonly accessed text can be identified
  1102.                                   with "bookmarks." Once a bookmark is 
  1103.                                   associated with a certain position in 
  1104.                                   the source file, the Go To Mark command 
  1105.                                   moves the cursor to that location.
  1106.  
  1107. %@AU@%(Please refer to the printed %@AE@%     The Make menu is used for compiling or 
  1108. %@AU@%book)%@AE@%                             building (to "build" means to compile 
  1109.                                   and link) programs. From this menu, you 
  1110.                                   also create or edit program lists, which
  1111.                                   name the components of multi-module
  1112.                                   programs.
  1113.  
  1114. %@AU@%(Please refer to the printed %@AE@%     The Run menu is used to execute your 
  1115. %@AU@%book)%@AE@%                             compiled program. Compiled programs can 
  1116.                                   be debugged with CodeView using the 
  1117.                                   Debug command. The Run menu also has 
  1118.                                   options for issuing DOS or OS/2 commands
  1119.                                   and adding applications as PWB menu 
  1120.                                   items (for example, the Customize Menu 
  1121.                                   command).
  1122.  
  1123. %@AU@%(Please refer to the printed %@AE@%     The items in the Options menu control 
  1124. %@AU@%book)%@AE@%                             the integrated environment. The 
  1125.                                   Environment command temporarily changes 
  1126.                                   path names for libraries, include files,
  1127.                                   and help files. Both Key Assignments and
  1128.                                   Editor Settings customize the operation 
  1129.                                   of the PWB editor. The Build Options 
  1130.                                   command saves current build options, 
  1131.                                   determines what type of program will be 
  1132.                                   built (OS/2, DOS) with the Initial Build
  1133.                                   option, and specifies whether the 
  1134.                                   program is built as a debug or release 
  1135.                                   version. The Browse, C Compiler, 
  1136.                                   CodeView, LINK, and NMAKE commands 
  1137.                                   configure their respective applications.
  1138.  
  1139. %@AU@%(Please refer to the printed %@AE@%     The commands in the optional Browse menu
  1140. %@AU@%book)%@AE@%                             are used to scan through data 
  1141.                                   declarations and functions once a 
  1142.                                   program has been compiled. Program call 
  1143.                                   trees, references to variables, and 
  1144.                                   symbol relationships can be shown in the
  1145.                                   Browser window. Menu items are disabled 
  1146.                                   unless you have compiled your program 
  1147.                                   with options that generate a Browser 
  1148.                                   database.
  1149.  
  1150. %@AU@%(Please refer to the printed %@AE@%     The optional Help menu accesses the 
  1151. %@AU@%book)%@AE@%                             on-line reference system. For more 
  1152.                                   information, see Chapter 4, "Using the 
  1153.                                   On-Line Reference."
  1154.  
  1155. %@NL@%
  1156. %@4@%%@AB@%Choosing Menu Commands%@AE@%%@EH@%%@NL@%
  1157. %@NL@%
  1158. Choose a command from a menu by "pulling down" or "opening" the menu.  %@NL@%
  1159. %@NL@%
  1160. To choose a command from the keyboard:  %@NL@%
  1161. %@NL@%
  1162. %@NL@%
  1163.   1.  Press the ALT key to activate the menu bar.%@NL@%
  1164. %@NL@%
  1165.   2.  Press the highlighted character in the menu name (such as F for File),
  1166.       or use the right and left ARROW keys to select a menu. The left and
  1167.       right ARROW keys only select the menu; they do not open it.%@NL@%
  1168. %@NL@%
  1169.   3.  Press the highlighted character in the command name (such as S for
  1170.       Save in the File menu), or use the up and down ARROW keys to highlight
  1171.       the command and then press ENTER.%@NL@%
  1172. %@NL@%
  1173. %@NL@%
  1174. To choose a command with the mouse:  %@NL@%
  1175. %@NL@%
  1176. %@NL@%
  1177.   1.  Open the menu by clicking the menu name.%@NL@%
  1178. %@NL@%
  1179.   2.  Click the command.%@NL@%
  1180. %@NL@%
  1181. %@NL@%
  1182. %@NL@%
  1183. %@4@%%@AB@%Closing Menus%@AE@%%@EH@%%@NL@%
  1184. %@NL@%
  1185. If you open a menu and then decide you don't want to issue a command, you
  1186. can close the menu in any of these ways:  %@NL@%
  1187. %@NL@%
  1188. %@NL@%
  1189.   ■   Press the ESC key%@NL@%
  1190. %@NL@%
  1191.   ■   Click the mouse somewhere outside of the menu%@NL@%
  1192. %@NL@%
  1193.   ■   Press ALT twice%@NL@%
  1194. %@NL@%
  1195. %@NL@%
  1196. %@NL@%
  1197. %@4@%%@AB@%Using Shortcut Keys%@AE@%%@EH@%%@NL@%
  1198. %@NL@%
  1199. Certain menu items are followed by the names of keys or key combinations.
  1200. These are "shortcut keys" for commonly used commands. Instead of issuing a
  1201. command by opening a menu, press the shortcut key to issue the command.  %@NL@%
  1202. %@NL@%
  1203. ────────────────────────────────────────────────────────────────────────────%@NL@%
  1204. NOTE
  1205.  
  1206. %@AI@%The reference bar at the bottom of the screen displays common shortcut keys.
  1207. %@AI@%You can click any of these buttons to execute the indicated command.%@AE@%%@NL@%
  1208. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  1209. %@NL@%
  1210. %@NL@%
  1211. %@4@%%@AB@%Shaded Commands%@AE@%%@EH@%%@NL@%
  1212. %@NL@%
  1213. When a command within a menu is in grayed type, it is "disabled," or
  1214. unavailable for use; some condition prevents the command from being used.
  1215. For example, when PWB is first run, and no programs have been compiled or
  1216. linked, the Next Error and Previous Error commands in the Search menu are
  1217. both disabled.  %@NL@%
  1218. %@NL@%
  1219. %@NL@%
  1220. %@4@%%@AB@%Ellipses%@AE@%%@EH@%%@NL@%
  1221. %@NL@%
  1222. If a command is followed by three periods (an ellipsis), it means more
  1223. information must be provided before the command is executed. You provide
  1224. this information in a dialog box that appears when you issue the command. If
  1225. a command is not followed by an ellipsis, it is executed immediately.  %@NL@%
  1226. %@NL@%
  1227. %@NL@%
  1228. %@3@%%@CR:C6A00030008 @%%@AB@%Dialog Boxes%@AE@%%@EH@%%@NL@%
  1229. %@NL@%
  1230. Some menu commands cause dialog boxes to appear. For example, Figure 3.2
  1231. shows the dialog box opened by the Search menu's Find command.  %@NL@%
  1232. %@NL@%
  1233. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1234. %@NL@%
  1235. ────────────────────────────────────────────────────────────────────────────%@NL@%
  1236. NOTE
  1237.  
  1238. %@AI@%Dialog boxes usually offer shortcut keys. Shortcut keys are identified by
  1239. %@AI@%highlighted letters, and can be activated by pressing the corresponding key.%@AE@%%@NL@%
  1240. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  1241. %@NL@%
  1242. Dialog boxes can contain one or more of the items in the following list.
  1243. Press ALT and the item's highlighted letter or press the TAB or SHIFT+TAB
  1244. keys to move among items in a dialog box. Dialog items can be set either
  1245. with keyboard commands or with the mouse.  %@NL@%
  1246. %@NL@%
  1247. %@AB@%Item%@AE@%                              %@AB@%Description%@AE@%
  1248. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  1249. Option buttons ()                 Offer a list of choices; only one option
  1250.                                   can be chosen. Use the ARROW keys to 
  1251.                                   move between the choices. In Figure 3.2,
  1252.                                   three option buttons set the direction 
  1253.                                   of the search (Forward, Backward, Find 
  1254.                                   All).
  1255.  
  1256. Check box [X]                     A yes/no switch. If the box is empty, 
  1257.                                   the option is turned off. If it contains
  1258.                                   the letter X, the feature is on. Press 
  1259.                                   the SPACEBAR or use the up and down 
  1260.                                   ARROW keys to turn a check box on or 
  1261.                                   off.
  1262.  
  1263. Text box [. . . . .]              Accepts text that you enter. In Figure 
  1264.                                   3.2, Find Text requires you to type in 
  1265.                                   the text to search for.
  1266.  
  1267. Command buttons                   Pass commands to the dialog box 
  1268. < OK >                            (enclosed in angle brackets). The OK 
  1269.                                   button means to use the current 
  1270.                                   settings. The Cancel button exits the 
  1271.                                   dialog box and does not change the 
  1272.                                   current settings. If one of the command 
  1273.                                   buttons is highlighted, press ENTER to 
  1274.                                   execute that command. Clicking a command
  1275.                                   button also executes it. If a button 
  1276.                                   contains an ellipsis, it indicates that 
  1277.                                   another dialog box will appear when the 
  1278.                                   command is carried out.
  1279.  
  1280. List boxes                        Display lists of information, such as 
  1281.                                   the contents of the current disk 
  1282.                                   directory, inside a list box. If the 
  1283.                                   number of items exceeds the list box 
  1284.                                   space, press the ARROW keys and 
  1285.                                   PGUP/PGDN or click the scroll bar to 
  1286.                                   move around the list.
  1287.  
  1288. %@NL@%
  1289. %@3@%%@CR:C6A00030009 @%%@AB@%Getting Help%@AE@%%@EH@%%@NL@%
  1290. %@NL@%
  1291. PWB uses the Microsoft Advisor on-line help system to provide information
  1292. about PWB, the compiler, the linker, the CodeView debugger, other utilities,
  1293. and topics relating to the C language. Information can be displayed at any
  1294. time and at any point you're using PWB or CodeView. For a complete
  1295. discussion of the on-line reference, see Chapter 4.  %@NL@%
  1296. %@NL@%
  1297. %@NL@%
  1298. %@4@%%@AB@%Menu Help%@AE@%%@EH@%%@NL@%
  1299. %@NL@%
  1300. To get information about a PWB menu command, choose the command with the
  1301. ARROW key, then press F1; or point the mouse cursor at the menu command and
  1302. click with the Right mouse button. A help window then appears with
  1303. information about the command.  %@NL@%
  1304. %@NL@%
  1305. %@NL@%
  1306. %@4@%%@AB@%Dialog-Box Help%@AE@%%@EH@%%@NL@%
  1307. %@NL@%
  1308. Many dialog boxes have a help button that provides additional information
  1309. about the dialog box and its contents. To display the information, click the
  1310. Help button with the mouse or press F1.  %@NL@%
  1311. %@NL@%
  1312. %@NL@%
  1313. %@4@%%@AB@%The Help Menu%@AE@%%@EH@%%@NL@%
  1314. %@NL@%
  1315. You can also use the commands listed in the Help menu to display an index of
  1316. all help topics, a table of contents, and information about using the
  1317. on-line reference system itself.  %@NL@%
  1318. %@NL@%
  1319. Choose the Contents command to display a global contents screen for the
  1320. entire help system. The main contents lists information divided by topic,
  1321. such as PWB, CodeView, or the C language. From the main contents, you can
  1322. navigate to a selected topic's table of contents by clicking that topic.  %@NL@%
  1323. %@NL@%
  1324. Choose the Index command to display a main index where you can move to other
  1325. indexes for different components of the Microsoft C help database.  %@NL@%
  1326. %@NL@%
  1327. %@NL@%
  1328. %@2@%%@CR:C6A00030010 @%%@AB@%Using the Editor%@AE@%%@EH@%%@NL@%
  1329. %@NL@%
  1330. The program editor is an important part of the PWB environment. This section
  1331. provides a brief overview of its major functions, and assumes you are using
  1332. the default key assignments.  %@NL@%
  1333. %@NL@%
  1334. %@NL@%
  1335. %@3@%%@CR:C6A00030011 @%%@AB@%Moving Around in a Source File%@AE@%%@EH@%%@NL@%
  1336. %@NL@%
  1337. Many of the keys within the editor work as you would expect them to. For
  1338. example:  %@NL@%
  1339. %@NL@%
  1340. %@NL@%
  1341.   ■   The PGDN and PGUP keys advance forward or back within the file.%@NL@%
  1342. %@NL@%
  1343.   ■   The HOME key moves the cursor to the beginning of the current line.%@NL@%
  1344. %@NL@%
  1345.   ■   The END key moves the cursor to the end of the current line.%@NL@%
  1346. %@NL@%
  1347.   ■   The ARROW keys move the cursor one character or one line at a time.
  1348. %@NL@%
  1349. ────────────────────────────────────────────────────────────────────────────%@NL@%
  1350. NOTE
  1351.  
  1352. %@AI@%For a complete list of editor commands, refer to the on-line help system's
  1353. %@AI@%PWB Function Quick Reference section on the PWB global contents screen.%@AE@%%@NL@%
  1354. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  1355. %@NL@%
  1356. %@NL@%
  1357. %@NL@%
  1358. %@NL@%
  1359. If you click in the shaded area on either side of the scroll box (position
  1360. marker) in the scroll bar, you move the cursor one full window at a time in
  1361. that direction. If you click on the scroll-bar arrows, you move the cursor
  1362. one row or column in the corresponding direction. If you click and drag the
  1363. scroll box, you move the cursor to the corresponding position within the
  1364. file.  %@NL@%
  1365. %@NL@%
  1366. %@NL@%
  1367. %@4@%%@AB@%Defining a Block%@AE@%%@EH@%%@NL@%
  1368. %@NL@%
  1369. To define a block with the PWB editor using the keyboard:  %@NL@%
  1370. %@NL@%
  1371. %@NL@%
  1372.   1.  Move the cursor to the beginning of the block. %@NL@%
  1373. %@NL@%
  1374.   2.  Hold down the SHIFT key and move the cursor to the end of the block. %@NL@%
  1375. %@NL@%
  1376.   3.  Use the other cursor keys (HOME, END, CTRL+RIGHT, and so on) while
  1377.       you're holding down SHIFT to extend the block.%@NL@%
  1378. %@NL@%
  1379. %@NL@%
  1380. To define a block with the PWB editor using the mouse:  %@NL@%
  1381. %@NL@%
  1382. %@NL@%
  1383.   1.  Move the cursor to the beginning of the block. %@NL@%
  1384. %@NL@%
  1385.   2.  While holding down the left button, move to the end of the block.%@NL@%
  1386. %@NL@%
  1387. %@NL@%
  1388. Once a block has been defined, it can be erased (press DEL), or placed into
  1389. the Clipboard, a temporary buffer, by cutting (press SHIFT+DEL) or by
  1390. copying (press CTRL+INS). Once in the Clipboard, the block can be inserted
  1391. at a cursor location (press SHIFT+INS). While a block is defined, anything
  1392. you type will delete the highlighted block and then insert the typed
  1393. characters.  %@NL@%
  1394. %@NL@%
  1395. Three text-selection modes are available in the Edit menu:  %@NL@%
  1396. %@NL@%
  1397. %@NL@%
  1398.   1.  Box mode selects text in a rectangular area whose opposite corners are
  1399.       the starting and ending cursor positions.%@NL@%
  1400. %@NL@%
  1401.   2.  Line mode selects entire lines of text from the starting cursor
  1402.       position to the ending cursor position.%@NL@%
  1403. %@NL@%
  1404.   3.  Stream mode selects all text from the starting cursor position to the
  1405.       ending cursor location.%@NL@%
  1406. %@NL@%
  1407. %@NL@%
  1408. Selecting a mode from the Edit menu changes the menu item to a new mode. The
  1409. mode displayed in the menu is the next available text-selection mode.  %@NL@%
  1410. %@NL@%
  1411. You can also toggle through the selection modes during text selection by
  1412. clicking the Right mouse button while you hold down the Left mouse button.  %@NL@%
  1413. %@NL@%
  1414. %@NL@%
  1415. %@4@%%@AB@%Setting Bookmarks%@AE@%%@EH@%%@NL@%
  1416. %@NL@%
  1417. You can set bookmarks anywhere in your source code with the Define Mark
  1418. command in the Search menu. Move the cursor to the location you want to
  1419. mark, then choose Define Mark.  %@NL@%
  1420. %@NL@%
  1421. In the dialog box that appears, type the name you want to give the bookmark.
  1422. The source file name and the row and column are already entered. Press ENTER
  1423. to save the bookmark for the current session. To permanently save a
  1424. bookmark, you must use the Add To Mark File option. Permanent bookmarks can
  1425. be loaded with the Set Mark File command in the Search menu.  %@NL@%
  1426. %@NL@%
  1427. To move the cursor to a bookmark, choose the Go To Mark command from the
  1428. Search menu. A list of all bookmarks is displayed. Select the bookmark from
  1429. the list using the ARROW keys or click the selected bookmark with the Left
  1430. mouse button. Press ENTER to go to the bookmark.  %@NL@%
  1431. %@NL@%
  1432. %@NL@%
  1433. %@4@%%@AB@%Setting Anchors%@AE@%%@EH@%%@NL@%
  1434. %@NL@%
  1435. An anchor is a temporary marker that identifies a cursor position somewhere
  1436. in the text. Use anchors to select large blocks of text.  %@NL@%
  1437. %@NL@%
  1438. To set an anchor, move the cursor to the desired location and use the Set
  1439. Anchor command in the Edit menu. Use the Select To Anchor command in the
  1440. Edit menu to select all text between the current cursor position and the
  1441. anchor. Only one anchor may be set at a time.  %@NL@%
  1442. %@NL@%
  1443. %@NL@%
  1444. %@4@%%@AB@%Searching for and Changing Text%@AE@%%@EH@%%@NL@%
  1445. %@NL@%
  1446. You can search for a string of text by using the Find command in the Search
  1447. menu. Type the string you want to look for, then use the check boxes to set
  1448. options such as wraparound search and case sensitivity. The Files button
  1449. allows you to specify a list of files to be searched for the designated
  1450. string.  %@NL@%
  1451. %@NL@%
  1452. Once a string has been located, use the Repeat Last Find command in the
  1453. Search menu (or press the shortcut key, F3) to move to the next occurrence
  1454. of the string. If you specified several files to search, press SHIFT+F3 to
  1455. move to the next occurrence of the string.  %@NL@%
  1456. %@NL@%
  1457. To modify several instances of a string in the source file, use the Change
  1458. command in the Search menu. Enter the target string, the replacement string,
  1459. and the search options.  %@NL@%
  1460. %@NL@%
  1461. PWB also supports the search and replace of text patterns using regular
  1462. expressions. Both UNIX(R) and non-UNIX regular expression syntaxes are
  1463. supported. For further information, see the on-line reference system.  %@NL@%
  1464. %@NL@%
  1465. ────────────────────────────────────────────────────────────────────────────%@NL@%
  1466. NOTE
  1467.  
  1468. %@AI@%Multi-file searches run a built-in GREP facility, and text that is found may
  1469. %@AI@%be scanned with the Next Error and Previous Error commands.%@AE@%%@NL@%
  1470. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  1471. %@NL@%
  1472. %@NL@%
  1473. %@4@%%@AB@%Creating Macros%@AE@%%@EH@%%@NL@%
  1474. %@NL@%
  1475. Editing tasks that you perform frequently can be saved as macros. A macro is
  1476. the record of a sequence of commands and/or literal text. Each macro has a
  1477. key combination that is used to "play back" the recorded actions.  %@NL@%
  1478. %@NL@%
  1479. For example, suppose several programmers are working on a file and need to
  1480. keep track of who made what changes. A macro can be used to insert a comment
  1481. with the programmer's name.  %@NL@%
  1482. %@NL@%
  1483. To create such a macro, choose the Set Record command in the Edit menu and
  1484. enter a macro name and associated key combination. For this example, call
  1485. the macro %@AS@% modname %@AE@% and let the key combination be CTRL+J. (Any key
  1486. combination can be used for a macro.) After you've named the macro, choose
  1487. the Record On command from the Edit menu. A bullet will appear to the left
  1488. of the menu command and an X in the status line, indicating all keystrokes
  1489. and menu commands are being recorded. Then type the following:  %@NL@%
  1490. %@NL@%
  1491. %@AS@%  /* j. courtney coded this */%@AE@%%@NL@%
  1492. %@NL@%
  1493. To stop the recording, choose Record On once again, which causes the bullet
  1494. to disappear. This action associates all the recorded actions with the
  1495. previously selected macro. Now, each time you press the CTRL+J key
  1496. combination for the macro, the comment you typed is instantly inserted at
  1497. the cursor position.  %@NL@%
  1498. %@NL@%
  1499. You save macros to the TOOLS.INI file when you save the <record> pseudofile
  1500. which can be reached by the Edit Macro command in the Edit menu. They may be
  1501. changed or deleted by modifying the file. See the section "Customizing PWB"
  1502. in on-line help for additional information about macros.  %@NL@%
  1503. %@NL@%
  1504. %@NL@%
  1505. %@3@%%@CR:C6A00030012 @%%@AB@%Customizing the Editor%@AE@%%@EH@%%@NL@%
  1506. %@NL@%
  1507. You can customize the PWB editor to meet your needs. Editor settings can be
  1508. modified, keyboard commands can be assigned, and command sets from other
  1509. editors can be emulated. In addition, customized extensions to the editor
  1510. can be written in C. See the on-line reference system and Chapter 8,
  1511. "Customizing PWB," in %@AI@%Advanced Programming Techniques%@AE@%, for complete details.
  1512. %@NL@%
  1513. %@NL@%
  1514. %@NL@%
  1515. %@4@%%@AB@%Changing Editor Settings%@AE@%%@EH@%%@NL@%
  1516. %@NL@%
  1517. The PWB editor has a variety of settings you can customize, such as word
  1518. wrap, color, and width of tab stops.  %@NL@%
  1519. %@NL@%
  1520. View or modify the settings by choosing the Editor Settings command from the
  1521. Options menu. A pseudofile named <assign> appears. (The title bar says
  1522. "Current Assignments and Settings," but the name <assign> appears in the
  1523. File menu's list of files.) This file displays numerous editor settings in
  1524. the format %@AI@%setting%@AE@%:%@AI@%value%@AE@%, where %@AI@%setting%@AE@% is the name of the setting, and
  1525. %@AI@%value%@AE@% is a Boolean, numeric, or text value. You can learn about a setting by
  1526. positioning the cursor on it and pressing F1.  %@NL@%
  1527. %@NL@%
  1528. To change the value of a setting, enter a new value. The change does not
  1529. take effect until you move the cursor to a different line. To save the
  1530. changed assignments, press SHIFT+F2 (if the default keyboard assignments are
  1531. in effect) or choose the Save command in the File menu. If you do not save,
  1532. the assignments will be temporary and will last only for the duration of the
  1533. PWB session.  %@NL@%
  1534. %@NL@%
  1535. To return to your source file, press F2.  %@NL@%
  1536. %@NL@%
  1537. %@NL@%
  1538. %@4@%%@AB@%Modifying Keyboard Assignments%@AE@%%@EH@%%@NL@%
  1539. %@NL@%
  1540. You can easily change all PWB keyboard assignments. Functions such as
  1541. %@AB@%delete%@AE@%, %@AB@%home%@AE@%, and %@AB@%copy%@AE@% can be reassigned by choosing the Key Assignments
  1542. command from the Options menu.  %@NL@%
  1543. %@NL@%
  1544. A pseudofile named <assign> appears. (The title bar says "Current
  1545. Assignments and Settings," but the name <assign> appears in the File menu's
  1546. list of files.) This file lists PWB functions and the keys to which they are
  1547. assigned. These appear in the format %@AI@%function%@AE@%:%@AI@%keyname%@AE@%. You can learn about a
  1548. PWB function by positioning the cursor on the function name and pressing F1.
  1549. A list of unused keys follows the assignment list.  %@NL@%
  1550. %@NL@%
  1551. To assign a new key to a function, replace %@AI@%keyname%@AE@% with the name of the new
  1552. key. The change does not take effect until you move the cursor to a
  1553. different line.  %@NL@%
  1554. %@NL@%
  1555. When you move the cursor to a different line, the line with the new
  1556. assignment is highlighted. To make the assignment permanent, save the file
  1557. by pressing SHIFT+F2 or by choosing the Save command in the File menu. This
  1558. updates the TOOLS.INI file, where changes to key assignments are stored.  %@NL@%
  1559. %@NL@%
  1560. To remove a key from a given function, assign the %@AB@%unassigned%@AE@% function to the
  1561. key.  %@NL@%
  1562. %@NL@%
  1563. %@NL@%
  1564. %@4@%%@AB@%Using Advanced Editor Features%@AE@%%@EH@%%@NL@%
  1565. %@NL@%
  1566. Most of the standard editing features in PWB are intuitive and easy to use.
  1567. However, there are also many advanced editing options that allow you to
  1568. customize and control the editor beyond simple menu commands.  %@NL@%
  1569. %@NL@%
  1570. The PWB editor incorporates all of the powerful features found in the
  1571. Microsoft Editor. A variety of functions and switches can be set to further
  1572. customize the PWB editor and enhance its performance. A complete list of
  1573. editor functions and settings is available in the on-line reference system.
  1574. %@NL@%
  1575. %@NL@%
  1576. New or altered functions and settings can be added to the TOOLS.INI file so
  1577. they are immediately loaded when PWB starts up. Or, they can be
  1578. interactively entered while you are working in the PWB environment.  %@NL@%
  1579. %@NL@%
  1580. For example, to interactively assign a key command to the editor's %@AB@%curdate%@AE@%
  1581. function, which enters the current date at the cursor, first press ALT+A,
  1582. then type the following into the argument dialog box:  %@NL@%
  1583. %@NL@%
  1584. %@AS@%  Curdate:SHIFT+CTRL+T%@AE@%%@NL@%
  1585. %@NL@%
  1586. Press ALT+= to assign the key to the function.  %@NL@%
  1587. %@NL@%
  1588. Now, whenever you press SHIFT+CTRL+T, the current date will instantly be
  1589. inserted at the editor's cursor position.  %@NL@%
  1590. %@NL@%
  1591. For detailed information about advanced PWB editor features, refer to the
  1592. %@AI@%Microsoft C Reference%@AE@% and the on-line reference system.  %@NL@%
  1593. %@NL@%
  1594. %@NL@%
  1595. %@4@%%@AB@%Reconfiguring the Editor%@AE@%%@EH@%%@NL@%
  1596. %@NL@%
  1597. If you wish to use another set of editing commands, PWB comes with an
  1598. additional .INI file containing key assignments for the BRIEF editor. You
  1599. can add the contents of the file to TOOLS.INI, or you can simulate other
  1600. editors' command sets by using the customization techniques previously
  1601. described.  %@NL@%
  1602. %@NL@%
  1603. %@NL@%
  1604. %@4@%%@AB@%Using Another Editor%@AE@%%@EH@%%@NL@%
  1605. %@NL@%
  1606. If you prefer to use another word processor or text editor, choose the Run
  1607. menu's Customize Menu command. This command is used to add other programs
  1608. (including word processors) to the Run menu so that you can run them from
  1609. within the PWB environment. Through the dialog box you can specify directory
  1610. paths and arguments to pass, and assign a key-command equivalent to run the
  1611. editor. When you exit the program, you return to PWB.  %@NL@%
  1612. %@NL@%
  1613. %@NL@%
  1614. %@2@%%@CR:C6A00030013 @%%@AB@%Compiling and Linking%@AE@%%@EH@%%@NL@%
  1615. %@NL@%
  1616. PWB uses a project-oriented approach to compiling and linking programs.
  1617. After a source file has been created and a program list associated with it,
  1618. PWB produces a makefile. A "program list" is a list of all of the source
  1619. files that make up the program; the "makefile" contains information about
  1620. the source files that compose the project. Whenever a multi-module program
  1621. is compiled or linked, the NMAKE utility examines the makefile and
  1622. determines which part of the project will be affected.  %@NL@%
  1623. %@NL@%
  1624. The process of creating an executable file by compiling and linking is known
  1625. as "building." When you build an application, the source code is first
  1626. compiled on a module-by-module basis into .OBJ files, and then linked with
  1627. the appropriate libraries.  %@NL@%
  1628. %@NL@%
  1629. Makefiles are especially useful with multi-module programs, because only
  1630. those source files that have changed are recompiled. This results in faster
  1631. build times, since existing source files that haven't been changed are not
  1632. recompiled. After you set a program list, building is a one-step process in
  1633. PWB.  %@NL@%
  1634. %@NL@%
  1635. %@NL@%
  1636. %@3@%%@CR:C6A00030014 @%%@AB@%Building Programs in PWB%@AE@%%@EH@%%@NL@%
  1637. %@NL@%
  1638. This section illustrates how to build programs under the PWB environment. To
  1639. start, type in this sample program:  %@NL@%
  1640. %@NL@%
  1641. %@AS@%  /* IO.C: String input and output */
  1642. %@AS@%  
  1643. %@AS@%  #include <stdio.h>
  1644. %@AS@%  
  1645. %@AS@%  main()
  1646. %@AS@%  {
  1647. %@AS@%     char date[30];
  1648. %@AS@%  
  1649. %@AS@%     printf( "Enter today's date: \n" );
  1650. %@AS@%     gets( date );
  1651. %@AS@%     printf( "Sample program run on %s\n", date );
  1652. %@AS@%  }%@AE@%%@NL@%
  1653. %@NL@%
  1654. This simple program uses the %@AS@% printf %@AE@% and %@AS@% gets %@AE@% library functions to prompt
  1655. for, and then print, today's date.  %@NL@%
  1656. %@NL@%
  1657. %@NL@%
  1658. %@4@%%@AB@%Saving the Program%@AE@%%@EH@%%@NL@%
  1659. %@NL@%
  1660. To save the source file, pull down the File menu and choose either Save or
  1661. Save As. If the file is new or you choose Save As, a dialog box prompts you
  1662. for a file name (see Figure 3.3). If you choose Save with an existing file,
  1663. PWB automatically saves the file under the name listed in the title bar of
  1664. the source window. To save a copy of a file under a different name, choose
  1665. Save As.  %@NL@%
  1666. %@NL@%
  1667. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1668. %@NL@%
  1669. Type in the new name of the source file, IO.C.  %@NL@%
  1670. %@NL@%
  1671. %@NL@%
  1672. %@4@%%@AB@%Setting and Clearing the Program List%@AE@%%@EH@%%@NL@%
  1673. %@NL@%
  1674. The Set Program List command in the Make menu tells PWB which makefile to
  1675. use in building a program. It clears the current makefile setting, instructs
  1676. PWB to use the makefile you have specified, and specifies which Browser
  1677. (.BSC) file is associated with the current project.  %@NL@%
  1678. %@NL@%
  1679. After you have saved the source file IO.C, choose the Set Program List
  1680. command in the Make menu. In the dialog box that appears, type the base file
  1681. name (IO), then press ENTER (see Figure 3.4). PWB automatically provides a
  1682. .MAK extension.  %@NL@%
  1683. %@NL@%
  1684. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1685. %@NL@%
  1686. If the makefile does not exist, PWB asks if you want to create a new
  1687. makefile; answer yes to this dialog box. Another dialog box titled Edit
  1688. Program List appears, listing all files in the current directory. From the
  1689. list, select the files you want to include in the project (in this example,
  1690. just IO.C).  %@NL@%
  1691. %@NL@%
  1692. Press TAB until the cursor is within the list box containing the directory
  1693. of files (another box lists the directory names). Use the ARROW keys to move
  1694. to the IO.C file. Press ENTER and the file name appears in the program list
  1695. below. Once the file is selected, press TAB until the Save List command
  1696. button is highlighted, and then press ENTER.  %@NL@%
  1697. %@NL@%
  1698. If you have a mouse, click IO.C once and then click the Add/Delete button
  1699. (or just double-click IO.C). Once the file appears in the program list,
  1700. click the Save List command button to save the makefile.  %@NL@%
  1701. %@NL@%
  1702. PWB automatically determines the contents of the makefile based on the files
  1703. you selected. You can edit the .MAK text file to change or add additional
  1704. commands.  %@NL@%
  1705. %@NL@%
  1706. If you want to create a new program or instruct PWB to "forget" about the
  1707. current program, use the Clear Program List command in the Make menu. This
  1708. action clears the current program list setting. You can then specify a new
  1709. program to build with Set Program List.  %@NL@%
  1710. %@NL@%
  1711. %@NL@%
  1712. %@4@%%@AB@%Setting Build Options%@AE@%%@EH@%%@NL@%
  1713. %@NL@%
  1714. Before compiling the program, you must specify the type of program you will
  1715. be building. This is done with the Build Options command in the Options
  1716. menu. Build Options calls a dialog box, whose Set Initial Build Options
  1717. button presents a series of predefined compiler settings for creating
  1718. programs (such as bound EXE, DOS EXE, DOS COM) and OS/2 .DLL libraries. Once
  1719. an initial build option has been chosen, its settings can be changed with
  1720. the C Compiler Options command in the Options menu.  %@NL@%
  1721. %@NL@%
  1722. To specify an existing build option:  %@NL@%
  1723. %@NL@%
  1724. %@NL@%
  1725.   1.  Choose the Build Options command from the Options menu%@NL@%
  1726. %@NL@%
  1727.   2.  Select the Set Initial Build Options button%@NL@%
  1728. %@NL@%
  1729.   3.  Use the mouse or the ARROW keys to select a build option from the list
  1730.       and press ENTER%@NL@%
  1731. %@NL@%
  1732. %@NL@%
  1733. To save your own group of build option settings:  %@NL@%
  1734. %@NL@%
  1735. %@NL@%
  1736.   1.  Select the appropriate settings in the C Compiler Options dialog box%@NL@%
  1737. %@NL@%
  1738.   2.  Choose the Build Options command from the Options menu%@NL@%
  1739. %@NL@%
  1740.   3.  Select the Save Current Build Options button%@NL@%
  1741. %@NL@%
  1742.   4.  Type a description of the options and press ENTER%@NL@%
  1743. %@NL@%
  1744. %@NL@%
  1745. The settings are now available through the Set Initial Build Options dialog
  1746. box.  %@NL@%
  1747. %@NL@%
  1748. %@NL@%
  1749. %@4@%%@AB@%Compiling and Linking the Program%@AE@%%@EH@%%@NL@%
  1750. %@NL@%
  1751. You can set a variety of compiler directives in the Options menu. The C
  1752. Compiler Options command provides options for memory model, processor type,
  1753. and other global settings that affect overall compilation (see Figure 3.5).
  1754. %@NL@%
  1755. %@NL@%
  1756. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1757. %@NL@%
  1758. From within the C Compiler Options dialog box, you can use the Set Debug
  1759. Options and Set Release Options buttons to easily create debug and release
  1760. versions of your program.  %@NL@%
  1761. %@NL@%
  1762. When you select the Set Debug Options button, a dialog box appears in which
  1763. you can set parameters such as stack checking, optimization, and debug
  1764. information. These settings also apply to programs built with the Debug
  1765. Build option, which you select from the dialog box displayed by the Build
  1766. Options command. Use debug settings when you are in the development phase
  1767. and actively debugging your program. When the Release Build option is
  1768. checked in the Build Options dialog box, the parameters specified in the Set
  1769. Release Options dialog box apply.  %@NL@%
  1770. %@NL@%
  1771. Similar debug and release options are also available for the linker with the
  1772. LINK Options command in the Options menu (see Figure 3.6). You can display
  1773. the options in both the C Compiler Options and LINK Options dialog boxes
  1774. with the Show Debug Options and Show Release Options buttons.  %@NL@%
  1775. %@NL@%
  1776. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1777. %@NL@%
  1778. The Set Release Options button in the C Compiler Options dialog box offers
  1779. the same choices as Set Debug Options, but Set Release applies them to a
  1780. final version of the program. Use these settings when your program is
  1781. completely debugged and ready for release.  %@NL@%
  1782. %@NL@%
  1783. For this example, use the default settings in the C Compiler Options dialog
  1784. box.  %@NL@%
  1785. %@NL@%
  1786. Before building the sample program, make sure that its name appears after
  1787. the Compile File and Build commands in the Make menu. If the name does not
  1788. appear after the Build command, choose the Set Program List command in the
  1789. Make menu to set the makefile as the current project.  %@NL@%
  1790. %@NL@%
  1791. To build the program, choose the Build command in the Make menu. If a
  1792. compile or link error occurs, the build terminates, and the error appears in
  1793. the Compile Results window. Use the on-line reference system to explain
  1794. unknown errors by selecting the error and pressing F1. If you are using OS/2
  1795. and errors occur, you will be informed and asked if you want to see the
  1796. compile log.  %@NL@%
  1797. %@NL@%
  1798. %@NL@%
  1799. %@4@%%@AB@%Running the Program%@AE@%%@EH@%%@NL@%
  1800. %@NL@%
  1801. After the program has been built, the name of your executable file is
  1802. appended to the Execute command in the Run menu. Choose Execute to run the
  1803. program. When the program is finished running, press any key to return to
  1804. PWB.  %@NL@%
  1805. %@NL@%
  1806. %@NL@%
  1807. %@4@%%@AB@%Building from Multiple Source Files%@AE@%%@EH@%%@NL@%
  1808. %@NL@%
  1809. You can build most applications from more than one source file. This section
  1810. demonstrates how to create a multi-module program.  %@NL@%
  1811. %@NL@%
  1812. First, edit the IO.C program:  %@NL@%
  1813. %@NL@%
  1814. %@AS@%  /* IO.C: Illustrates external functions */
  1815. %@AS@%  
  1816. %@AS@%  #include <stdio.h>
  1817. %@AS@%  
  1818. %@AS@%  void outsider(void); /* Add this function. */
  1819. %@AS@%  void sample(void);   /* Add this function. */
  1820. %@AS@%  
  1821. %@AS@%  main()
  1822. %@AS@%  {
  1823. %@AS@%     char date[30];
  1824. %@AS@%  
  1825. %@AS@%     sample();   /* Call new function. */
  1826. %@AS@%     outsider(); /* Call new function. */
  1827. %@AS@%     printf( "Enter today's date: \n" );
  1828. %@AS@%     gets( date );
  1829. %@AS@%     printf( "Sample program run on %s\n", date );
  1830. %@AS@%  }
  1831. %@AS@%  
  1832. %@AS@%  /* Implement the new sample function. */ 
  1833. %@AS@%  void sample(void)
  1834. %@AS@%  {
  1835. %@AS@%     printf( "A sample function.\n" );
  1836. %@AS@%  }%@AE@%%@NL@%
  1837. %@NL@%
  1838. The %@AS@% main %@AE@% function calls two new functions defined within the program: %@AS@%
  1839. %@AS@%sample %@AE@% and %@AS@% outsider%@AE@%.  %@NL@%
  1840. %@NL@%
  1841. Save the changed file and then choose New from the File menu. Type in a
  1842. second source file:  %@NL@%
  1843. %@NL@%
  1844. %@AS@%  /* IOB.C: Second module for IO.C */
  1845. %@AS@%  
  1846. %@AS@%  #include <stdio.h>
  1847. %@AS@%  
  1848. %@AS@%  void outsider(void);
  1849. %@AS@%  
  1850. %@AS@%  void outsider(void)
  1851. %@AS@%  {
  1852. %@AS@%     printf( "This line is from the file IOB.C.\n" );
  1853. %@AS@%  }%@AE@%%@NL@%
  1854. %@NL@%
  1855. Save it as IOB.C. The two source files are combined to produce a
  1856. multi-module program.  %@NL@%
  1857. %@NL@%
  1858. %@NL@%
  1859. %@4@%%@AB@%Multiple Modules and the Program List%@AE@%%@EH@%%@NL@%
  1860. %@NL@%
  1861. Since the example program now uses two source files, the makefile must be
  1862. changed to tell PWB which files should be compiled. Choose the Edit Program
  1863. List command from the Make menu, add the IOB.C file to the list, and save
  1864. it. When you create multimodule programs, the order of the file names added
  1865. is inconsequential.  %@NL@%
  1866. %@NL@%
  1867. ────────────────────────────────────────────────────────────────────────────%@NL@%
  1868. NOTE
  1869.  
  1870. %@AI@%A program list can include source files (with the .C extension), assembler
  1871. %@AI@%files (.ASM), object files (.OBJ), library files (.LIB), definition files
  1872. %@AI@%(.DEF), and resource files (.RC). For example, if you didn't include the
  1873. %@AI@%graphics libraries in the combined library when you ran the SETUP program,
  1874. %@AI@%you can place GRAPHICS.LIB in the program list to gain access to graphics
  1875. %@AI@%functions under DOS.%@AE@%%@NL@%
  1876. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  1877. %@NL@%
  1878. At this point you can compile and link the program.  %@NL@%
  1879. %@NL@%
  1880. When you choose the Rebuild All command from the Make menu, every .C file in
  1881. the program list is compiled into a .OBJ file. Then all of the .OBJ files
  1882. are linked with .LIB files to create one .EXE file.  %@NL@%
  1883. %@NL@%
  1884. If you choose the Build command, the NMAKE utility checks the time and date
  1885. stamps on the source and object files. If the source code has not changed
  1886. since the last time a Build command was executed, unchanged files are not
  1887. recompiled. Consequently, the Build command is often faster than Rebuild
  1888. All.  %@NL@%
  1889. %@NL@%
  1890. %@NL@%
  1891. %@3@%%@CR:C6A00030015 @%%@AB@%Compiling and Linking from the Command Line%@AE@%%@EH@%%@NL@%
  1892. %@NL@%
  1893. You are not restricted to using the PWB environment to create executable
  1894. programs. Programs can be compiled and linked with Microsoft C at the DOS or
  1895. OS/2 command line.  %@NL@%
  1896. %@NL@%
  1897. The CL.EXE program may be used to compile and link programs. PWB
  1898. automatically executes CL, or you can manually execute it at the command
  1899. line. Simply enter CL followed by a space and the name of the source file to
  1900. create a .EXE program.  %@NL@%
  1901. %@NL@%
  1902. In addition, a variety of command-line options can be used. For example,  %@NL@%
  1903. %@NL@%
  1904. %@AS@%  CL /AM IO.C%@AE@%%@NL@%
  1905. %@NL@%
  1906. causes the program to be compiled using the medium memory model instead of
  1907. the default small model. Any compiler options should appear before the names
  1908. of the files to be compiled.  %@NL@%
  1909. %@NL@%
  1910. You can find a complete list of compiler and linker options in the %@AI@%C
  1911. %@AI@%Reference%@AE@% or by typing  %@NL@%
  1912. %@NL@%
  1913. %@AS@%  CL /HELP%@AE@%%@NL@%
  1914. %@NL@%
  1915. to invoke the on-line reference system.  %@NL@%
  1916. %@NL@%
  1917. You can also use CL to build multi-module programs by specifying all source
  1918. files to be compiled:  %@NL@%
  1919. %@NL@%
  1920. %@AS@%  CL IO.C IOB.C%@AE@%%@NL@%
  1921. %@NL@%
  1922. This command builds a program called IO.EXE, because IO.C is listed first.  %@NL@%
  1923. %@NL@%
  1924. Another way to build a multi-module program is to compile the two files and
  1925. then manually link them:  %@NL@%
  1926. %@NL@%
  1927. %@AS@%  CL /c IO.C
  1928. %@AS@%  CL /c IOB.C
  1929. %@AS@%  LINK IO.OBJ IOB.OBJ%@AE@%%@NL@%
  1930. %@NL@%
  1931. The /c option instructs CL to compile but not link. Once the .OBJ files have
  1932. been created, use the linker to create the executable file.  %@NL@%
  1933. %@NL@%
  1934. Since a makefile named IO.MAK has already been created using PWB, you can
  1935. also use the NMAKE utility to build IO.EXE. Simply pass it the name of the
  1936. makefile:  %@NL@%
  1937. %@NL@%
  1938. %@AS@%  NMAKE /F IO.MAK%@AE@%%@NL@%
  1939. %@NL@%
  1940. If you don't provide /F and a file name, NMAKE searches for a file named
  1941. MAKEFILE.  %@NL@%
  1942. %@NL@%
  1943. For a complete list of compiler, linker, and NMAKE options, see %@AI@%Advanced
  1944. %@AI@%Programming Techniques%@AE@%, the%@AI@% C Reference%@AE@%, or the on-line reference system.  %@NL@%
  1945. %@NL@%
  1946. %@NL@%
  1947. %@2@%%@CR:C6A00030016 @%%@AB@%Debugging Programs%@AE@%%@EH@%%@NL@%
  1948. %@NL@%
  1949. PWB has a variety of resources available for debugging programs. They range
  1950. from simple compile- and link-error messages to sophisticated source
  1951. browsing and source- or assembly-level debugging.  %@NL@%
  1952. %@NL@%
  1953. When compile-time errors occur, the cursor moves to the line that caused the
  1954. first error and a brief description of the error appears in the reference
  1955. bar. Use the Next Error and Previous Error commands in the Search menu to
  1956. move the cursor to the lines where other errors occurred.  %@NL@%
  1957. %@NL@%
  1958. To view a complete list of errors, choose the Compile Results command from
  1959. the View menu. Use the Set Error command in the Search menu to select the
  1960. error under the cursor as the current error. This command synchronizes the
  1961. source and error windows so that the source-code line that contains the
  1962. error appears in the source window.  %@NL@%
  1963. %@NL@%
  1964. The Microsoft Advisor can be used to display on-line help about the error.
  1965. In the Compile Results window, move the cursor to the error number and press
  1966. F1.  %@NL@%
  1967. %@NL@%
  1968. PWB incorporates a source-code browser and interfaces with the CodeView
  1969. debugger. The Browser displays information about function and data
  1970. relationships. CodeView is a window-oriented symbolic debugger that lets you
  1971. step through your code and examine variables and data as the program
  1972. executes.  %@NL@%
  1973. %@NL@%
  1974. Before a program can take advantage of the Browser or CodeView, the
  1975. appropriate %@AB@%debug%@AE@% or %@AB@%browse%@AE@% switches must be set with the C Compiler Options
  1976. and Browse Options commands in the Options menu. As an example, build one of
  1977. the sample programs previously listed with the debug options to experiment
  1978. with the Browser and CodeView.  %@NL@%
  1979. %@NL@%
  1980. %@NL@%
  1981. %@3@%%@CR:C6A00030017 @%%@AB@%Using the Browser%@AE@%%@EH@%%@NL@%
  1982. %@NL@%
  1983. The commands on the Browse menu are referred to collectively as the PWB
  1984. Source Browser. These commands allow you to search a database comprising
  1985. selected files, to get a list of references and definitions, build a call
  1986. tree and outline, or create a list of relationships among program symbols.
  1987. Figure 3.7 shows the functions called by %@AS@% main %@AE@% in IO.C.  %@NL@%
  1988. %@NL@%
  1989. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1990. %@NL@%
  1991. Before using these commands, you must define the database the Source Browser
  1992. is going to search.  %@NL@%
  1993. %@NL@%
  1994. To define a database:  %@NL@%
  1995. %@NL@%
  1996. %@NL@%
  1997.   1.  Generate a program list using the Set Program List command in the Make
  1998.       menu. The files contained in the program list make up the database.%@NL@%
  1999. %@NL@%
  2000.   2.  Choose Browse Options from the Options menu. You must select the
  2001.       Generate Browse Information field in the dialog box to create the
  2002.       Source Browser database. The rest of the fields on this dialog box
  2003.       offer you choices of how to build the database; they are optional.%@NL@%
  2004. %@NL@%
  2005.   3.  Build your program using the commands in the Make Menu. When you build
  2006.       the program, a file with the same program-list root name and a .BSC
  2007.       (Browser Source Cache) extension is created. This file contains
  2008.       reference information that the Browser uses.%@NL@%
  2009. %@NL@%
  2010. %@NL@%
  2011. Once you have completed these steps, Browse Menu commands are ready for you
  2012. to use.  %@NL@%
  2013. %@NL@%
  2014. %@NL@%
  2015.   ■   The Goto Definition command provides a list of symbols and variables
  2016.       that occur within include files and modules. You can immediately open
  2017.       the file at the line number where the definition occurred by selecting
  2018.       the <OK> button.%@NL@%
  2019. %@NL@%
  2020.   ■   The Goto Reference command displays a list of files and line numbers
  2021.       where  symbols and variables have been referenced in include files and
  2022.       modules.%@NL@%
  2023. %@NL@%
  2024.   ■   The View Relationships command provides detailed information about
  2025.       various portions of your program. You can examine functions, macros,
  2026.       types, and variables by their use, definition, or inclusion in include
  2027.       files and modules.%@NL@%
  2028. %@NL@%
  2029.   ■   The List References command displays references to functions, macros,
  2030.       types, and variables. You can move the cursor to a reference, and then
  2031.       use the Goto Definition or Goto Reference commands to show occurrences
  2032.       of the reference.%@NL@%
  2033. %@NL@%
  2034.   ■   The Call Tree command displays a tree structure of function calls
  2035.       within the program.%@NL@%
  2036. %@NL@%
  2037. %@NL@%
  2038. For additional information about the Browser, refer to the on-line reference
  2039. system.  %@NL@%
  2040. %@NL@%
  2041. ────────────────────────────────────────────────────────────────────────────%@NL@%
  2042. NOTE
  2043.  
  2044. %@AI@%You can create a Browser information file with the CL (command-line)
  2045. %@AI@%compiler by using the /FR or /Fr options. This creates a .SBR file which can
  2046. %@AI@%be converted to a .BSC file with the PWBRMAKE.EXE utility.%@AE@%%@NL@%
  2047. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  2048. %@NL@%
  2049. %@NL@%
  2050. %@3@%%@CR:C6A00030018 @%%@AB@%Debugging with CodeView%@AE@%%@EH@%%@NL@%
  2051. %@NL@%
  2052. PWB provides access to the Microsoft CodeView debugger. After a program has
  2053. been built, CodeView can be used to step through the source code, displaying
  2054. output, registers, and variables as each line is executed (see Figure 3.8).
  2055. You can set breakpoints and watchpoints to further aid in debugging.
  2056. CodeView uses the Microsoft Advisor to provide on-line help about its
  2057. operation and options, in addition to information about any C keywords in
  2058. the program you are debugging.  %@NL@%
  2059. %@NL@%
  2060. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2061. %@NL@%
  2062. ────────────────────────────────────────────────────────────────────────────%@NL@%
  2063. NOTES
  2064.  
  2065. %@AI@%CodeView version 3.0 is compatible with releases of OS/2 later than version
  2066. %@AI@%1.0. If you encounter problems exiting CodeView, you either have an older
  2067. %@AI@%version of OS/2 or the wrong version of the DOSCALLS.DLL file.%@AE@%%@NL@%
  2068.  
  2069. %@AI@%If you use CodeView from the OS/2 DOS compatibility box, be sure the /S
  2070. %@AI@%(Swap Screen in Buffers) option is set in the CodeView Options dialog box.
  2071. %@AI@%If the option is not set, the mouse cursor is not displayed while you are
  2072. %@AI@%debugging.%@AE@%%@NL@%
  2073.  
  2074. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  2075. %@NL@%
  2076. %@NL@%
  2077. %@4@%%@AB@%Preparing a Debug Build%@AE@%%@EH@%%@NL@%
  2078. %@NL@%
  2079. It's easy to create a debug version of a program so it can be examined with
  2080. CodeView.  %@NL@%
  2081. %@NL@%
  2082. First, choose C Compiler Options from the Options menu, then select the Set
  2083. Debug Options button. This dialog box contains a variety of settings for a
  2084. debug build. Although most of the dialog box options can be set to your
  2085. preference, you must check the CodeView option under the Debug Information
  2086. heading, which is on by default. In addition, code optimization options,
  2087. which are off by default, should be unchecked so that code movement does not
  2088. affect debugging.  %@NL@%
  2089. %@NL@%
  2090. The CodeView Options command in PWB's Options menu provides a variety of
  2091. choices for configuring CodeView. These include two-monitor debugging,
  2092. memory allocation, and the number of lines on the screen. For now, use the
  2093. default settings initially displayed.  %@NL@%
  2094. %@NL@%
  2095. In order for the compiler to build a program that contains the necessary
  2096. CodeView information, you must check the Debug option, set in the dialog box
  2097. displayed by the Build Options command in the Options menu. In addition, the
  2098. CodeView option, which is on by default, must be selected in the Set Debug
  2099. Options dialog box.  %@NL@%
  2100. %@NL@%
  2101. To demonstrate how CodeView works, set the debug options as listed above,
  2102. then rebuild the IO.C program using the Rebuild All command in the Make
  2103. menu.  %@NL@%
  2104. %@NL@%
  2105. %@NL@%
  2106. %@4@%%@AB@%Examining the Program%@AE@%%@EH@%%@NL@%
  2107. %@NL@%
  2108. After your program has been built with the appropriate debug options, choose
  2109. the Debug command from the Run menu. PWB immediately transfers control to
  2110. the CodeView debugger, loading the current project as indicated in the
  2111. program list.  %@NL@%
  2112. %@NL@%
  2113. When you switch from PWB to CodeView, the program appears in the source
  2114. window. Choose the Source command in the Options menu or type the %@AS@% S+ %@AE@%
  2115. command in CodeView's command window to display the code in C, the %@AS@% S- %@AE@%
  2116. command for assembly language, or the %@AS@% S& %@AE@% command for a combination of the
  2117. two. With C or mixed-source options, a line number appears to the left of
  2118. each line of source code as a reference.  %@NL@%
  2119. %@NL@%
  2120. In addition to the source code, commands in the View menu show windows
  2121. displaying memory, registers, and local variables. CodeView windows are
  2122. similar to PWB windows in that they can be scrolled, sized, and closed.
  2123. Multiple windows can appear on the screen at once, displaying a variety of
  2124. information. A list of shortcut keys and buttons appears at the bottom of
  2125. the screen.  %@NL@%
  2126. %@NL@%
  2127. %@NL@%
  2128. %@4@%%@AB@%Setting Watch Expressions and Breakpoints%@AE@%%@EH@%%@NL@%
  2129. %@NL@%
  2130. Watch expressions and breakpoints are optional CodeView settings that
  2131. display variable values and interrupt execution of the program.  %@NL@%
  2132. %@NL@%
  2133. A "watch expression" is a variable within the program that CodeView
  2134. continually watches. Watch expressions are displayed with the Watch command
  2135. in the View menu. As the value of a variable changes, the value changes in
  2136. the watch window.  %@NL@%
  2137. %@NL@%
  2138. To add a variable to the watch expression list, select the variable and
  2139. choose the Add Watch command from the Watch menu or use the W%@AB@% %@AE@%command in the
  2140. command window. You can optionally enter the variable name in the dialog
  2141. box. Watch expressions are removed with the Delete Watch command in the
  2142. watch menu or with the Y command in the command window.  %@NL@%
  2143. %@NL@%
  2144. To set a watch variable in the IO.C file, use the cursor to highlight the %@AS@%
  2145. %@AS@%date %@AE@% variable in the CodeView source window. Then choose the Add Watch
  2146. command from the Watch menu. The %@AS@% date %@AE@% variable appears in the Expression
  2147. text box. Press ENTER or click the OK button to store the watch variable.  %@NL@%
  2148. %@NL@%
  2149. CodeView also incorporates a temporary watch option called a QuickWatch.
  2150. Highlight a variable in the source window with the mouse or cursor. Choose
  2151. the QuickWatch command from the Watch menu. A dialog box appears with the
  2152. current value of the variable. You can add any QuickWatch variable to the
  2153. watch window with the Add Watch dialog option.  %@NL@%
  2154. %@NL@%
  2155. You can expand any structures or arrays that are set as watch expressions
  2156. (identified with a "+" in the watch window) to show individual elements.
  2157. Position the cursor on the variable name and either double-click the Left
  2158. mouse button or press ENTER (see Figure 3.9).  %@NL@%
  2159. %@NL@%
  2160. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2161. %@NL@%
  2162. A "breakpoint" is an instruction that tells CodeView to interrupt execution
  2163. at a certain location or when an expression becomes true.  %@NL@%
  2164. %@NL@%
  2165. Use breakpoints to gain control of the program before an error occurs and to
  2166. quickly move to a part of the program you want to trace. When CodeView stops
  2167. at a breakpoint, you can then single-step or trace through instructions
  2168. until you find the problem.  %@NL@%
  2169. %@NL@%
  2170. Set a breakpoint by positioning the cursor on the line at which you want the
  2171. program to stop and then pressing F9. Alternatively, you can choose the Set
  2172. Breakpoint command from the Watch menu. A dialog box presents a series of
  2173. options for setting types of breakpoints. Breakpoints are modified or
  2174. deleted with the Edit Breakpoints command in the Watch menu.  %@NL@%
  2175. %@NL@%
  2176. Set a breakpoint in the IO.C file by moving the cursor in the CodeView
  2177. source window to the line that reads  %@NL@%
  2178. %@NL@%
  2179. %@AS@%  printf( "A sample function.\n" );%@AE@%%@NL@%
  2180. %@NL@%
  2181. From the Watch menu, choose the Set Breakpoint command. The number of the
  2182. line the cursor appears on is displayed in the dialog box. Press ENTER or
  2183. click the OK button with the mouse to store the breakpoint. After the
  2184. breakpoint has been set, the line it occurs on is highlighted.  %@NL@%
  2185. %@NL@%
  2186. %@NL@%
  2187. %@4@%%@AB@%Running the Program%@AE@%%@EH@%%@NL@%
  2188. %@NL@%
  2189. CodeView runs your program and displays each source line as it executes. If
  2190. an error occurs, CodeView stops at the instruction that caused the error.
  2191. CodeView also halts execution at breakpoints.  %@NL@%
  2192. %@NL@%
  2193. If a program requires arguments to be passed from the command line, these
  2194. arguments can be entered with the Set Runtime Arguments command in the Run
  2195. menu.  %@NL@%
  2196. %@NL@%
  2197. Table 3.2 lists several CodeView commands for running a program.  %@NL@%
  2198. %@NL@%
  2199. %@AB@%Table 3.2  CodeView Run Commands%@AE@%
  2200.  
  2201. %@TH:  12   473 02 06 08 64 @%Key   Name    Use%@AB@%──────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%F5    Go      Executes the program to the next breakpoint, error, or end of               the programF8    Trace   Executes a single lineF10   Step    Executes a single line, but doesn't trace into               functions%@AB@%──────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%%@TE:  12   473 02 06 08 64 @%
  2202.  
  2203. Run commands can be entered by pressing the appropriate key or clicking the
  2204. commands at the bottom of the screen. With the Trace and Step commands, each
  2205. line is highlighted as it is executed. The Go command executes each line
  2206. until it stops at an error, a breakpoint, or the end of the program. If you
  2207. choose the Animate command, each line is highlighted as it executes. To
  2208. force the run commands to start at the beginning of the program, use the
  2209. Restart command in the Run menu.  %@NL@%
  2210. %@NL@%
  2211. The Screen Swap setting in the Options menu controls display of the output.
  2212. If the option is turned on, CodeView switches to the output screen after
  2213. each line executes, and then switch back to the source window. You can turn
  2214. the option off during portions of your program that don't access the screen
  2215. to reduce the distracting flicker of switching screens. If you want to view
  2216. the output screen longer, choose the Output command from the View menu.
  2217. Press any key to exit the output screen and return to CodeView.  %@NL@%
  2218. %@NL@%
  2219. In addition to single-stepping through a program, the Animate command in the
  2220. Run menu automatically steps through the program, highlighting each line as
  2221. it proceeds.  %@NL@%
  2222. %@NL@%
  2223. %@NL@%
  2224. %@3@%%@CR:C6A00030019 @%%@AB@%Running IO.C%@AE@%%@EH@%%@NL@%
  2225. %@NL@%
  2226. To demonstrate some of these commands with the IO.C program, make the source
  2227. window active by pressing F6 or by clicking its title bar, then choose the
  2228. Restart command from the Run menu. This command clears memory and prepares
  2229. the program to start execution at the first line of %@AS@% main%@AE@%.  %@NL@%
  2230. %@NL@%
  2231. Press F5 or select the Go button at the bottom of the screen to start the
  2232. program. The program executes until it reaches the breakpoint set at the %@AS@%
  2233. %@AS@%sample %@AE@% function.  %@NL@%
  2234. %@NL@%
  2235. Use F10 or the Step button to execute each statement until you come to the %@AS@%
  2236. %@AS@%outsider %@AE@% function. If you press F8 or the Trace button at the %@AS@% outsider %@AE@%
  2237. function, CodeView traces through each statement of the function. If you use
  2238. the Step button or F10, CodeView executes the function without tracing
  2239. through it and moves on to the next program statement.  %@NL@%
  2240. %@NL@%
  2241. Continue stepping through the program until you reach the %@AS@% gets ( date ) %@AE@%
  2242. statement. Press F10; CodeView switches to the output screen and prompts you
  2243. to enter a date. Type today's date and press ENTER. CodeView regains control
  2244. and moves to the next statement.  %@NL@%
  2245. %@NL@%
  2246. Since %@AS@% date %@AE@% was set as a watch variable and now contains data, use the
  2247. mouse or press F6 to make the watch window active. Move the cursor to %@AS@% date %@AE@%
  2248. and press ENTER. This expands the display of the array and shows all of the
  2249. elements. Press ENTER again while the cursor is on %@AS@% date %@AE@% to contract the
  2250. array.  %@NL@%
  2251. %@NL@%
  2252. Because %@AS@% date %@AE@% is also a local variable, it is shown in the local window
  2253. with all variables local to the current function. You can expand or contract
  2254. data in the local and the watch windows .  %@NL@%
  2255. %@NL@%
  2256. Another way to view the contents of %@AS@% date %@AE@% is to put the cursor on it in the
  2257. CodeView source window and choose QuickWatch from the Watch menu. The %@AS@% date %@AE@%
  2258. variable is immediately displayed in its expanded form. Press ENTER or click
  2259. the OK button to leave the dialog box.  %@NL@%
  2260. %@NL@%
  2261. Press F10 to finish stepping through the program. A dialog box informs you
  2262. that the program has completed execution normally. Press ENTER to clear the
  2263. dialog box and complete your debugging session.  %@NL@%
  2264. %@NL@%
  2265. %@NL@%
  2266. %@3@%%@CR:C6A00030020 @%%@AB@%Debugging IO.C%@AE@%%@EH@%%@NL@%
  2267. %@NL@%
  2268. To see how CodeView deals with a bug in a program, use the Exit command in
  2269. the File menu to return to PWB, then add this function to the IO.C program,
  2270. and call it from %@AS@% main%@AE@%:  %@NL@%
  2271. %@NL@%
  2272. %@AS@%  void bounds_error(void)
  2273. %@AS@%  {
  2274. %@AS@%     int loop, the_num[10];
  2275. %@AS@%  
  2276. %@AS@%     for(loop = 0; loop < 15; loop++)
  2277. %@AS@%        the_num[loop] = loop; }%@AE@%%@NL@%
  2278. %@NL@%
  2279. Set the appropriate debug options, rebuild the program, and return to
  2280. CodeView.  %@NL@%
  2281. %@NL@%
  2282. Use the F8 Trace command to execute the program. The program runs until it
  2283. reaches the %@AS@% for %@AE@% statement in the %@AS@% bounds_error %@AE@% function, where the array
  2284. bounds are exceeded. The output window reports an error while a CodeView
  2285. dialog box indicates the program has terminated. At this point you can
  2286. return to PWB, locate the error, and correct it.  %@NL@%
  2287. %@NL@%
  2288. %@NL@%
  2289. %@2@%%@CR:C6A00030021 @%%@AB@%Getting More Details%@AE@%%@EH@%%@NL@%
  2290. %@NL@%
  2291. PWB, the compiler, the linker, NMAKE, and CodeView all have other features
  2292. and options that go beyond the scope of this introduction.  %@NL@%
  2293. %@NL@%
  2294. Refer to %@AI@%Advanced Programming Techniques%@AE@% for information about PWB, NMAKE,
  2295. CodeView, and other tools, and the %@AI@%C Reference%@AE@% for a comprehensive listing
  2296. of all commands and options for the applications included with Microsoft C.
  2297. %@NL@%
  2298. %@NL@%
  2299. In addition, information about any component of the Professional Development
  2300. System can be accessed through the Microsoft Advisor reference system. For a
  2301. complete discussion of the on-line reference, see Chapter 4.  %@NL@%
  2302. %@NL@%
  2303. %@NL@%
  2304. %@NL@%
  2305. %@NL@%
  2306. %@NL@%
  2307. %@NL@%
  2308. %@CR:C6A00040001 @%%@1@%%@AB@%Chapter 4  Using the On-Line Reference%@AE@%%@EH@%%@NL@%
  2309. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  2310. %@NL@%
  2311. Microsoft C offers two types of on-line reference systems:  %@NL@%
  2312. %@NL@%
  2313. %@NL@%
  2314.   ■   The Microsoft Advisor, found within the Programmer's WorkBench (PWB)
  2315.       and CodeView environments.%@NL@%
  2316. %@NL@%
  2317.   ■   The QuickHelp program, accessed from the OS/2 or DOS command line.%@NL@%
  2318. %@NL@%
  2319. %@NL@%
  2320. Both systems provide the same information on important C topics and
  2321. utilities provided with the Professional Development System, which include
  2322. the C language, run-time libraries, CodeView, and PWB.  %@NL@%
  2323. %@NL@%
  2324. The first section of this chapter, "Structure of the Microsoft Advisor,"
  2325. outlines the structure and contents of the on-line reference database. The
  2326. second section, "Navigating Through the Microsoft Advisor," takes you on a
  2327. quick tour of the system. The third section, "Using QuickHelp," explains how
  2328. to use the QuickHelp program and how it differs from the Microsoft Advisor.
  2329. %@NL@%
  2330. %@NL@%
  2331. %@NL@%
  2332. %@2@%%@CR:C6A00040002 @%%@AB@%Structure of the Microsoft Advisor%@AE@%%@EH@%%@NL@%
  2333. %@NL@%
  2334. The Microsoft Advisor can be compared to a librarian managing a collection
  2335. of books. Each book, or help file, has its own table of contents, index, and
  2336. pages of information. The Advisor organizes the help files with a global
  2337. contents and index. All of the files are listed, and their specific tables
  2338. of contents and indexes can be accessed through the global references. The
  2339. global contents screen is shown in Figure 4.1.  %@NL@%
  2340. %@NL@%
  2341. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2342. %@NL@%
  2343. You can access a variety of information from the on-line reference system.
  2344. Information regarding the C language, run-time libraries, errors, and the
  2345. reference system itself is available.  %@NL@%
  2346. %@NL@%
  2347. %@NL@%
  2348. %@2@%%@CR:C6A00040003 @%%@AB@%Navigating Through the Microsoft Advisor%@AE@%%@EH@%%@NL@%
  2349. %@NL@%
  2350. You request information about a topic in a window by positioning the cursor
  2351. over it and pressing F1 or clicking the Right mouse button once. The help
  2352. system then searches through the help files for information about the topic.
  2353. If it finds the topic, the help system displays information in the help
  2354. window. If help cannot be found for a particular word or symbol, a message
  2355. informs you that no information is associated with the topic. Sometimes, a
  2356. topic with the same name occurs in several help files. In such cases, a
  2357. dialog box is displayed in which you can select the context of the topic.  %@NL@%
  2358. %@NL@%
  2359. %@NL@%
  2360. %@3@%%@CR:C6A00040004 @%%@AB@%Using the Help Menu%@AE@%%@EH@%%@NL@%
  2361. %@NL@%
  2362. The simplest method for accessing the on-line reference is by using the
  2363. commands found in the Help menu. All of these commands present information
  2364. in the Help window.  %@NL@%
  2365. %@NL@%
  2366. %@AB@%Command%@AE@%                           %@AB@%Description%@AE@%
  2367. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  2368. Index                             Displays the global index of help-file 
  2369.                                   categories (see Figure 4.2).
  2370.  
  2371. Contents                          Displays the global contents screen for 
  2372.                                   the categories found in the help files.
  2373.  
  2374. Topic:                            Provides information about the topic 
  2375.                                   that the cursor is currently positioned 
  2376.                                   over. If information about the topic is 
  2377.                                   available, the topic's name is appended 
  2378.                                   to the Topic: command. Otherwise, this 
  2379.                                   menu option is grayed.
  2380.  
  2381. Help on Help                      Displays information about using the 
  2382.                                   on-line reference itself.
  2383.  
  2384. Next                              Is useful if a topic with the same name 
  2385.                                   appears in more than one help file. This
  2386.                                   option locates the next occurrence of 
  2387.                                   the topic name and displays the 
  2388.                                   information associated with it.
  2389.  
  2390. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2391. %@NL@%
  2392. %@NL@%
  2393. %@3@%%@CR:C6A00040005 @%%@AB@%Using the F1 Key%@AE@%%@EH@%%@NL@%
  2394. %@NL@%
  2395. You can use the F1 key to get information about any menu command or PWB
  2396. dialog box, as well as information on C keywords, operators, and run-time
  2397. library functions.  %@NL@%
  2398. %@NL@%
  2399. %@NL@%
  2400. %@4@%%@AB@%Menu Help%@AE@%%@EH@%%@NL@%
  2401. %@NL@%
  2402. To view information about a menu item, first pull down the menu, then  %@NL@%
  2403. %@NL@%
  2404. %@NL@%
  2405.   ■   Use the cursor keys to highlight the command, and press F1, or%@NL@%
  2406. %@NL@%
  2407.   ■   Move the mouse cursor on the command and click the Right mouse button%@NL@%
  2408. %@NL@%
  2409. %@NL@%
  2410. Figure 4.3 shows the help information for the Cut command in the Edit menu.
  2411. %@NL@%
  2412. %@NL@%
  2413. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2414. %@NL@%
  2415. %@NL@%
  2416. %@4@%%@AB@%Keyword and Library-Function Help%@AE@%%@EH@%%@NL@%
  2417. %@NL@%
  2418. To view information about a C keyword, operator, or run-time library
  2419. function,  %@NL@%
  2420. %@NL@%
  2421. %@NL@%
  2422.   ■   Put the cursor on the keyword or function name, and press F1, or%@NL@%
  2423. %@NL@%
  2424.   ■   Click the command with the Right mouse button%@NL@%
  2425. %@NL@%
  2426. %@NL@%
  2427. %@NL@%
  2428. %@4@%%@AB@%Dialog-Box Help%@AE@%%@EH@%%@NL@%
  2429. %@NL@%
  2430. To view information about a PWB dialog box, simply press F1 while the dialog
  2431. box is displayed, or click on the help button.  %@NL@%
  2432. %@NL@%
  2433. %@NL@%
  2434. %@3@%%@CR:C6A00040006 @%%@AB@%Using Hyperlinks%@AE@%%@EH@%%@NL@%
  2435. %@NL@%
  2436. Hyperlinks are cross-references that connect related topic information.  %@NL@%
  2437. %@NL@%
  2438. Hyperlinks enclosed by the < and > characters are called "buttons." Navigate
  2439. through the on-line help system by using these buttons.  %@NL@%
  2440. %@NL@%
  2441. You can press TAB to move to the next hyperlink button within the current
  2442. help window. SHIFT+TAB moves back to the previous button. Typing any letter
  2443. moves the cursor to the next button that begins with the letter; holding
  2444. SHIFT down and typing a letter moves the cursor backward.  %@NL@%
  2445. %@NL@%
  2446. The Microsoft Advisor also recognizes C keywords, library functions,
  2447. constants defined by Microsoft C, and similar identifiers as hyperlinks, but
  2448. they are unmarked hyperlinks. Unmarked hyperlinks are recognized by the
  2449. Microsoft Advisor wherever they appear in the help-information text or %@AI@%in
  2450. %@AI@%your source code%@AE@%. However, an unmarked hyperlink is not delimited with the <
  2451. and > characters, and you can't move to it with the TAB key. An unmarked
  2452. hyperlink can only be executed by placing the cursor on it and pressing F1,
  2453. or pointing to it with the mouse cursor and clicking the Right mouse button.
  2454. %@NL@%
  2455. %@NL@%
  2456. You can access a hyperlink in several ways. First move either the mouse or
  2457. text cursor to a hyperlink, then either  %@NL@%
  2458. %@NL@%
  2459. %@NL@%
  2460.   ■   Press F1%@NL@%
  2461. %@NL@%
  2462.   ■   Click the Right mouse button%@NL@%
  2463. %@NL@%
  2464.   ■   Click the Left mouse button twice (double-click)%@NL@%
  2465. %@NL@%
  2466. %@NL@%
  2467. Highlighted button hyperlinks can also be executed by pressing ENTER or
  2468. SPACEBAR.  %@NL@%
  2469. %@NL@%
  2470. Any of these actions displays information about the topic the cursor is
  2471. positioned on. If the topic isn't a hyperlink, a message informs you that no
  2472. information on the topic could be found.  %@NL@%
  2473. %@NL@%
  2474. ────────────────────────────────────────────────────────────────────────────%@NL@%
  2475. NOTE
  2476.  
  2477. %@AI@%CodeView uses the Right mouse button differently in the source window.
  2478. %@AI@%Clicking the Right button in the source window executes the program to the
  2479. %@AI@%line the mouse was clicked on. However, once the help window is displayed,
  2480. %@AI@%the Right mouse button can be used to select hyperlinks.%@AE@%%@NL@%
  2481. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  2482. %@NL@%
  2483. %@NL@%
  2484. %@3@%%@CR:C6A00040007 @%%@AB@%Using Help Windows and Dialog Boxes%@AE@%%@EH@%%@NL@%
  2485. %@NL@%
  2486. The Microsoft Advisor displays information in windows or dialog boxes. Help
  2487. windows and dialog boxes function the same as other windows and dialog boxes
  2488. found in PWB and CodeView. For a complete description of windows and dialog
  2489. boxes, refer to Chapter 3, "Using the Programmer's WorkBench."  %@NL@%
  2490. %@NL@%
  2491. %@NL@%
  2492. %@4@%%@AB@%Using the Help Window%@AE@%%@EH@%%@NL@%
  2493. %@NL@%
  2494. The help window displays various contents, indexes, and information about
  2495. selected topics. Some screens of information are larger than the help
  2496. window; information beyond the window borders can be viewed by using the
  2497. scroll bars or the cursor-movement keys. The  - u -  symbol indicates the
  2498. end of information in the help window.  %@NL@%
  2499. %@NL@%
  2500. %@AB@%Navigating with Hyperlink Buttons%@AE@% - At the top of the help window is a row
  2501. of buttons that are useful for moving through the reference system:  %@NL@%
  2502. %@NL@%
  2503. %@AB@%Button%@AE@%                            %@AB@%Description%@AE@%
  2504. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  2505. < Up >                            Moves upward in the hierarchy of help 
  2506.                                   screens. Since information is ordered in
  2507.                                   a logical way, moving from the general 
  2508.                                   to the specific, this command is useful 
  2509.                                   for moving up the information tree.
  2510.  
  2511. < Contents >                      Displays the global contents screen. 
  2512.                                   This command is useful because it always
  2513.                                   returns you to a known point in the 
  2514.                                   on-line help system hierarchy.
  2515.  
  2516. < Index >                         Displays the global index list. 
  2517.                                   Selecting an item from the list displays
  2518.                                   the index for that category.
  2519.  
  2520. < Back >                          Moves you to the last on-line help 
  2521.                                   screen you saw.
  2522.  
  2523. Screens on a particular topic frequently are physically grouped together in
  2524. a help file. You can press CTRL+F1 to display information about the next
  2525. physical topic in the help file.  %@NL@%
  2526. %@NL@%
  2527. %@AB@%Viewing the Previous Help Screen%@AE@% - The Microsoft Advisor remembers the last
  2528. 20 help screens you've accessed. To return to a previous screen, use the <
  2529. Back > button or hold down the ALT key and press F1 as many times as
  2530. necessary to return to the screen you want to see. The help screen that
  2531. appears is active; you can ask for help on any of its hyperlinks or topics.
  2532. %@NL@%
  2533. %@NL@%
  2534. You can always return to the global contents screen by pressing SHIFT+F1.  %@NL@%
  2535. %@NL@%
  2536. %@AB@%Copying and Pasting Help Information%@AE@% - Any text that appears in the help
  2537. window can easily be copied to another window. For example, to test an
  2538. example program from the help window, you only have to copy it to the source
  2539. window and compile it.  %@NL@%
  2540. %@NL@%
  2541. To copy and paste using the keyboard, follow these steps:  %@NL@%
  2542. %@NL@%
  2543. %@NL@%
  2544.   1.  Move the cursor to the beginning or the end of the text you want to
  2545.       select. Hold down the SHIFT key and move the cursor to the other end
  2546.       of the text. The text is now highlighted.%@NL@%
  2547. %@NL@%
  2548.   2.  Execute the Copy command: Press ALT to activate the menus, E for Edit,
  2549.       then C for Copy. Note that the menu lists the shortcut command
  2550.       (CTRL+INS), which can be substituted for ALT+E, then C.%@NL@%
  2551. %@NL@%
  2552.   3.  Press F6 to switch to another window. Position the cursor where you
  2553.       want to insert the text, and execute the Paste command: ALT+E then P,
  2554.       or use the SHIFT+INS shortcut. The text from the help window is
  2555.       inserted at the current cursor position.%@NL@%
  2556. %@NL@%
  2557. %@NL@%
  2558. To copy and paste using the mouse, follow these steps:  %@NL@%
  2559. %@NL@%
  2560. %@NL@%
  2561.   1.  Click the Left mouse button and drag the cursor (hold down the button
  2562.       while moving the mouse) to select the text you want to copy.%@NL@%
  2563. %@NL@%
  2564.   2.  Choose Copy from the Edit menu (or press CTRL+INS).%@NL@%
  2565. %@NL@%
  2566.   3.  Move the mouse cursor to the location where you want to insert the
  2567.       text, and click once. Then choose Paste from the Edit menu. The text
  2568.       from the help window is inserted at the current cursor position.%@NL@%
  2569. %@NL@%
  2570. %@NL@%
  2571. %@AB@%Closing the Help Window%@AE@% - Once you're through working with the reference
  2572. system, you can close the active help window and return to the source window
  2573. by  %@NL@%
  2574. %@NL@%
  2575. %@NL@%
  2576.   ■   Pressing ESC%@NL@%
  2577. %@NL@%
  2578.   ■   Clicking the Close button in the upper left corner of the window with
  2579.       the Left mouse button%@NL@%
  2580. %@NL@%
  2581. %@NL@%
  2582. %@NL@%
  2583. %@4@%%@AB@%Using Help Dialog Boxes%@AE@%%@EH@%%@NL@%
  2584. %@NL@%
  2585. Help dialog boxes contain information about menu commands and their dialog
  2586. boxes. A help dialog box differs from a help window in that it is displayed
  2587. over the source window and any other windows that are displayed. Unlike the
  2588. help window, a help dialog box must be closed before you can execute any
  2589. menu commands. The Cancel button in the lower right portion of the dialog
  2590. box closes the help dialog box.  %@NL@%
  2591. %@NL@%
  2592. To view information about any PWB dialog box, you can  %@NL@%
  2593. %@NL@%
  2594. %@NL@%
  2595.   ■   Press F1%@NL@%
  2596. %@NL@%
  2597.   ■   Click the Help button in the dialog box with the Left mouse button%@NL@%
  2598. %@NL@%
  2599. %@NL@%
  2600. Either of these commands causes a help dialog box to appear. To close a help
  2601. dialog box,  %@NL@%
  2602. %@NL@%
  2603. %@NL@%
  2604.   ■   Press ESC%@NL@%
  2605. %@NL@%
  2606.   ■   Click the dialog box's Cancel button by using the Left mouse button%@NL@%
  2607. %@NL@%
  2608. %@NL@%
  2609. %@NL@%
  2610. %@3@%%@CR:C6A00040008 @%%@AB@%Accessing Different Types of Information%@AE@%%@EH@%%@NL@%
  2611. %@NL@%
  2612. This section presents some strategies for accessing the different types of
  2613. information available within the on-line reference system.  %@NL@%
  2614. %@NL@%
  2615. %@NL@%
  2616. %@4@%%@AB@%Keyword Information%@AE@%%@EH@%%@NL@%
  2617. %@NL@%
  2618. To get information about any keyword, operator, symbolic constant, or
  2619. library function, display the appropriate index for the keyword, select the
  2620. keyword's first letter from the index, then scroll down the list of entries
  2621. and select the topic's hyperlink. If you know the exact name of a keyword,
  2622. it is often quicker to simply type it in the source window and press F1 to
  2623. locate it through an index.  %@NL@%
  2624. %@NL@%
  2625. Information about keywords can also be viewed by using the %@AB@%arg%@AE@% command and
  2626. entering the keyword with F1 in the %@AB@%arg%@AE@% command dialog box. Assuming that
  2627. you have the %@AB@%arg%@AE@% function assigned to %@AS@% alt+a%@AE@%, the following series of
  2628. keystrokes displays help on the %@AB@%printf%@AE@% function:  %@NL@%
  2629. %@NL@%
  2630. %@AS@%  alt+a printf F1%@AE@%%@NL@%
  2631. %@NL@%
  2632. Figure 4.4 shows the information screen that then appears.  %@NL@%
  2633. %@NL@%
  2634. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2635. %@NL@%
  2636. When information about a function is shown in the help window, two
  2637. additional hyperlink buttons are displayed.  %@NL@%
  2638. %@NL@%
  2639. %@NL@%
  2640.   ■   < Description > provides a detailed explanation of the function. When
  2641.       the information is displayed, the button changes to < Summary >. Click
  2642.       this button to return to the summarized information about the
  2643.       function.%@NL@%
  2644. %@NL@%
  2645.   ■   < Example > displays C source code that provides an example of how the
  2646.       function is used.%@NL@%
  2647. %@NL@%
  2648. %@NL@%
  2649. %@NL@%
  2650. %@4@%%@AB@%Topical Information%@AE@%%@EH@%%@NL@%
  2651. %@NL@%
  2652. The on-line reference system is useful when you want an overview of the
  2653. available reference topics, or when you only have a general idea of what
  2654. information you need. Start with the global contents screen, then select any
  2655. hyperlinks that relate to the topic. You can traverse the hyperlinks until
  2656. you locate the necessary information.  %@NL@%
  2657. %@NL@%
  2658. %@NL@%
  2659. %@4@%%@AB@%Menu and Dialog-Box Information%@AE@%%@EH@%%@NL@%
  2660. %@NL@%
  2661. You can get information about any menu command or dialog box by pressing F1
  2662. when the menu command is highlighted or the dialog box is displayed. This is
  2663. helpful when you are first learning to use the Professional Development
  2664. System and are not completely familiar with all of the features.  %@NL@%
  2665. %@NL@%
  2666. %@NL@%
  2667. %@4@%%@AB@%Error Information%@AE@%%@EH@%%@NL@%
  2668. %@NL@%
  2669. The Microsoft Advisor provides information about compiler and linker error
  2670. messages.  %@NL@%
  2671. %@NL@%
  2672. To find the meaning of an error message using the keyboard,  %@NL@%
  2673. %@NL@%
  2674. %@NL@%
  2675.   1.  Press F6 to move the cursor to the error window%@NL@%
  2676. %@NL@%
  2677.   2.  Position the cursor on the error number%@NL@%
  2678. %@NL@%
  2679.   3.  Press F1%@NL@%
  2680. %@NL@%
  2681. %@NL@%
  2682. or with the mouse,  %@NL@%
  2683. %@NL@%
  2684. %@NL@%
  2685.   1.  Position the mouse cursor on the error number%@NL@%
  2686. %@NL@%
  2687.   2.  Click the Right mouse button%@NL@%
  2688. %@NL@%
  2689. %@NL@%
  2690. Help on error messages is also available directly from the PWB source window
  2691. by entering the %@AB@%arg%@AE@% command with the error number and its alphabetic prefix,
  2692. and then pressing F1.  %@NL@%
  2693. %@NL@%
  2694. %@NL@%
  2695. %@3@%%@CR:C6A00040009 @%%@AB@%Specifying Temporary Help Files%@AE@%%@EH@%%@NL@%
  2696. %@NL@%
  2697. You can temporarily load other help files using the Environment command in
  2698. the PWB Options menu. The Microsoft Advisor searches help files you specify
  2699. in this text box before it searches the standard Development System help
  2700. files as specified by the HELPFILES environment variable. Use the help files
  2701. text box to override (for the current session only) the help-file path
  2702. defined in the HELPFILES variable. When programming with mixed languages,
  2703. you may want to temporarily load the help files for each of the languages
  2704. you're using.  %@NL@%
  2705. %@NL@%
  2706. %@NL@%
  2707. %@2@%%@CR:C6A00040010 @%%@AB@%Using QuickHelp%@AE@%%@EH@%%@NL@%
  2708. %@NL@%
  2709. QuickHelp is a separate application that provides access to any help file.
  2710. It uses the same help files as the Microsoft Advisor, and presents
  2711. information about topics in the same way. QuickHelp is designed for the
  2712. developer who prefers using command-line utilities or another editor, and
  2713. doesn't have access to the Microsoft Advisor through PWB.  %@NL@%
  2714. %@NL@%
  2715. Major utilities and applications that come with the Microsoft C package
  2716. invoke QuickHelp and display related information if you use the /HELP
  2717. switch. You can also use QuickHelp from the command line, as explained in
  2718. the following sections. Once you are in the QuickHelp program, select which
  2719. help file you want to view.  %@NL@%
  2720. %@NL@%
  2721. %@NL@%
  2722. %@3@%%@CR:C6A00040011 @%%@AB@%Using the /HELP Switch%@AE@%%@EH@%%@NL@%
  2723. %@NL@%
  2724. You can get immediate information on major components of Microsoft C by
  2725. using the /HELP switch.  %@NL@%
  2726. %@NL@%
  2727. For example, to learn about the LIB utility, enter  %@NL@%
  2728. %@NL@%
  2729. %@AS@%  LIB /HELP%@AE@%%@NL@%
  2730. %@NL@%
  2731. QuickHelp will run and immediately display information about LIB.  %@NL@%
  2732. %@NL@%
  2733. %@NL@%
  2734. %@3@%%@CR:C6A00040012 @%%@AB@%Using the QH Command%@AE@%%@EH@%%@NL@%
  2735. %@NL@%
  2736. You can also run QuickHelp by typing QH at the DOS or OS/2 command line.
  2737. Specify an application to get help about, such as  %@NL@%
  2738. %@NL@%
  2739. %@AS@%  QH LIB.EXE%@AE@%%@NL@%
  2740. %@NL@%
  2741. In addition to information about programs, QuickHelp can also display
  2742. information about run-time errors. You can type the error number with its
  2743. alphabetic prefix after the QH command at the DOS or OS/2 command line.  %@NL@%
  2744. %@NL@%
  2745. %@NL@%
  2746. %@4@%%@AB@%Opening and Closing Help Files%@AE@%%@EH@%%@NL@%
  2747. %@NL@%
  2748. If no file name is specified when QuickHelp is run, it looks for the
  2749. environment variable HELPFILES, and opens all listed .HLP files. If the
  2750. HELPFILES variable isn't present, all .HLP files in directories specified by
  2751. the PATH environment variable are loaded.  %@NL@%
  2752. %@NL@%
  2753. Choose the List Database command on the File menu to view a list of all the
  2754. currently open help files.  %@NL@%
  2755. %@NL@%
  2756. To open additional help files,  %@NL@%
  2757. %@NL@%
  2758. %@NL@%
  2759.   ■   Choose the Open Database command from the File menu.%@NL@%
  2760. %@NL@%
  2761.   ■   Type the fully qualified path name of the help file to be opened in
  2762.       the dialog box that appears. You can specify all help files in a
  2763.       directory with *.HLP.%@NL@%
  2764. %@NL@%
  2765.   ■   Press ENTER or click the OK button with the Left mouse button.%@NL@%
  2766. %@NL@%
  2767. %@NL@%
  2768. To close an open help file,  %@NL@%
  2769. %@NL@%
  2770. %@NL@%
  2771.   ■   Choose the Close Database command from the File menu.%@NL@%
  2772. %@NL@%
  2773.   ■   Use the mouse or keyboard to select which help file you would like to
  2774.       close from the list of help files displayed in the menu%@NL@%
  2775. %@NL@%
  2776. %@NL@%
  2777. %@NL@%
  2778. %@4@%%@AB@%Displaying a Topic%@AE@%%@EH@%%@NL@%
  2779. %@NL@%
  2780. You can view information about a topic by using the Search command in the
  2781. View menu. When topic information is displayed, it is shown in the same
  2782. format as information presented by the Microsoft Advisor.  %@NL@%
  2783. %@NL@%
  2784. To display a topic from any of the open help files,  %@NL@%
  2785. %@NL@%
  2786. %@NL@%
  2787.   ■   Choose the Search command from the View menu%@NL@%
  2788. %@NL@%
  2789.   ■   Type the topic you want information about in the Search dialog box
  2790.       (the search is not case sensitive)%@NL@%
  2791. %@NL@%
  2792.   ■   Press ENTER or click the OK button with the Left mouse button%@NL@%
  2793. %@NL@%
  2794. %@NL@%
  2795. QuickHelp begins searching for the topic in the open help files. If the
  2796. topic cannot be found, a dialog box informs you that the search failed. If
  2797. the search is successful, information about the topic is displayed in the
  2798. QuickHelp window.  %@NL@%
  2799. %@NL@%
  2800. %@NL@%
  2801. %@4@%%@AB@%Navigating Through Topics%@AE@%%@EH@%%@NL@%
  2802. %@NL@%
  2803. A series of commands on the View menu allow you to selectively display
  2804. topics. These commands include the following:  %@NL@%
  2805. %@NL@%
  2806. %@AB@%Command%@AE@%                           %@AB@%Description%@AE@%
  2807. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  2808. View History                      Displays a list of all the topics that 
  2809.                                   have recently been displayed. You can 
  2810.                                   view a topic in the list by selecting it
  2811.                                   and clicking the Right mouse button or 
  2812.                                   pressing ENTER.
  2813.  
  2814. View Last                         Displays the last topic you looked at.
  2815.  
  2816. View Back                         Moves backward one topic in the help 
  2817.                                   file.
  2818.  
  2819. View Next                         Displays the next topic in the help 
  2820.                                   file.
  2821.  
  2822. %@NL@%
  2823. %@4@%%@AB@%Using the QuickHelp Window%@AE@%%@EH@%%@NL@%
  2824. %@NL@%
  2825. The QuickHelp window (see Figure 4.5) is similar in function to the
  2826. Microsoft Advisor help window, described earlier in this chapter.
  2827. Information that doesn't fully fit in a window can be scrolled, and
  2828. hyperlinks are used to display additional information.  %@NL@%
  2829. %@NL@%
  2830. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2831. %@NL@%
  2832. The main differences between the two windows are  %@NL@%
  2833. %@NL@%
  2834. %@NL@%
  2835.   ■   Information presented in QuickHelp cannot selectively be copied. See
  2836.       the section "Copying and Pasting in QuickHelp" that follows for more
  2837.       information.%@NL@%
  2838. %@NL@%
  2839.   ■   The QuickHelp window cannot be closed.%@NL@%
  2840. %@NL@%
  2841.   ■   Any information that appears on the screen can be sent to a printer by
  2842.       using the Print command in the File menu.%@NL@%
  2843. %@NL@%
  2844. %@NL@%
  2845. %@NL@%
  2846. %@4@%%@AB@%Copying and Pasting in QuickHelp%@AE@%%@EH@%%@NL@%
  2847. %@NL@%
  2848. In order to transfer information, you must first specify a new file with the
  2849. Rename Paste File command in the File menu. Once the file is specified,
  2850. choose either the Current Window or the Current Topic command in the Paste
  2851. menu to transfer the text to that file. Be sure to specify a new file when
  2852. you paste, since QuickHelp overwrites text in an existing file.  %@NL@%
  2853. %@NL@%
  2854. %@NL@%
  2855. %@4@%%@AB@%More About QuickHelp%@AE@%%@EH@%%@NL@%
  2856. %@NL@%
  2857. In addition to the features mentioned above, QuickHelp has a variety of
  2858. other options such as changing the appearance of the help window, searching
  2859. for text within topics, and controlling the function of the Right mouse
  2860. button.  %@NL@%
  2861. %@NL@%
  2862. To learn more about QuickHelp's features, make sure the QH.HLP file is
  2863. loaded, then do one of the following:  %@NL@%
  2864. %@NL@%
  2865. %@NL@%
  2866.   ■   Press F1 to view QuickHelp's on-line reference%@NL@%
  2867. %@NL@%
  2868.   ■   Choose a menu command and press F1 or click the Right mouse button to
  2869.       get information about it%@NL@%
  2870. %@NL@%
  2871.   ■   Refer to the %@AI@%C Reference%@AE@% guide for a list of QuickHelp options%@NL@%
  2872. %@NL@%
  2873. %@NL@%
  2874. %@NL@%
  2875. %@NL@%
  2876.