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 @%
  582. Memory Model  Code Segment Limit  Data Segment Limit
  583. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  584. Tiny          64K                 64K (CODE + DATA)
  585.  
  586. Small         64K                 64K
  587.  
  588. Medium        None                64K
  589.  
  590. Compact       64K                 None
  591.  
  592. Large         None                None
  593.  
  594. Huge          None                None
  595.  
  596. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  597.  
  598. %@TE:  16   526 02 14 20 42 @%
  599.  
  600. For more information on memory models, see Chapter 2, "Managing Memory," in
  601. %@AI@%Advanced Programming Techniques%@AE@%.  %@NL@%
  602. %@NL@%
  603. %@NL@%
  604. %@4@%%@AB@%Specifying Default Library Names%@AE@%%@EH@%%@NL@%
  605. %@NL@%
  606. SETUP normally gives each combined library a name of the form %@AI@%m%@AE@%LIBC%@AI@%fs%@AE@%.LIB,
  607. where %@AI@%m%@AE@% is S, M ,C, or L (memory model); %@AI@%f%@AE@% is A, E, or 7 (math library); and
  608. %@AI@%s%@AE@% is R or P (operating mode).  %@NL@%
  609. %@NL@%
  610. This question will vary according to the target operating system you
  611. selected. If you chose OS/2, you will be asked whether to use the default
  612. OS/2 library names. If you selected both operating modes, you will be asked
  613. whether to use the default libraries for OS/2 and DOS.  %@NL@%
  614. %@NL@%
  615. If you selected only one operating mode, or if you selected both but plan to
  616. program in one mode predominantly, you should have SETUP give default names
  617. to all libraries built for that mode.  %@NL@%
  618. %@NL@%
  619. %@NL@%
  620. %@3@%%@CR:C6A00020006 @%%@AB@%Second Screen: Installing Additional Files%@AE@%%@EH@%%@NL@%
  621. %@NL@%
  622. Your answers to questions on this screen determine whether PWB is installed
  623. (see Figure 2.3).  %@NL@%
  624. %@NL@%
  625. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  626. %@NL@%
  627. %@NL@%
  628. %@4@%%@AB@%Installing PWB%@AE@%%@EH@%%@NL@%
  629. %@NL@%
  630. You may choose not to install PWB if you plan to use only the command-line
  631. version of the compiler and linker. If you install PWB, you can choose to
  632. configure the PWB editor so that it is similar to the BRIEF(R) editor.  %@NL@%
  633. %@NL@%
  634. %@NL@%
  635. %@4@%%@AB@%Installing the Microsoft Mouse%@AE@%%@EH@%%@NL@%
  636. %@NL@%
  637. If you have chosen OS/2 real mode and DOS as the host operating mode, you
  638. are asked whether you want to install the most recent version of the
  639. Microsoft Mouse device driver.  %@NL@%
  640. %@NL@%
  641. %@NL@%
  642. %@4@%%@AB@%Copying Patch Files%@AE@%%@EH@%%@NL@%
  643. %@NL@%
  644. If you have chosen OS/2 real mode and DOS as the host operating mode, you
  645. have the option of installing a patch for dealing with floating-point
  646. exceptions found under PC-DOS version 3.20.  %@NL@%
  647. %@NL@%
  648. %@NL@%
  649. %@3@%%@CR:C6A00020007 @%%@AB@%Third Screen: Specifying Directories%@AE@%%@EH@%%@NL@%
  650. %@NL@%
  651. On this screen, you specify the directories into which SETUP copies library,
  652. header, and other files (see Figure 2.4). You can choose to override the
  653. default options for directory names. Be sure to enter complete path names
  654. for your own directories. If the specified directories don't exist, SETUP
  655. asks whether you want to create them.  %@NL@%
  656. %@NL@%
  657. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  658. %@NL@%
  659. The questions about protected-mode executable files and dynamic link
  660. libraries appear only if OS/2 protected mode has been selected as the target
  661. operating mode.  %@NL@%
  662. %@NL@%
  663. ────────────────────────────────────────────────────────────────────────────%@NL@%
  664. NOTE
  665.  
  666. %@AI@%The questions about executable files concern the location of development
  667. %@AI@%tools, not the executable files you create with Microsoft C.%@AE@%%@NL@%
  668. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  669. %@NL@%
  670. %@NL@%
  671. %@3@%%@CR:C6A00020008 @%%@AB@%Checking Available Disk Space%@AE@%%@EH@%%@NL@%
  672. %@NL@%
  673. Before moving to stage two, SETUP checks your hard disk to see how much free
  674. space is available. If you don't have enough room to install Microsoft C, an
  675. error message informs you how much space is required for the files you've
  676. requested.  %@NL@%
  677. %@NL@%
  678. If you don't have enough room on your hard disk, you can either delete
  679. existing hard-disk files or reduce the number of requested libraries.  %@NL@%
  680. %@NL@%
  681. ────────────────────────────────────────────────────────────────────────────%@NL@%
  682. NOTE
  683.  
  684. %@AI@%If you feel that SETUP has incorrectly sized your disk for some reason, you
  685. %@AI@%can disable space checking by using the /NOFREE option.%@AE@%%@NL@%
  686. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  687. %@NL@%
  688. %@NL@%
  689. %@3@%%@CR:C6A00020009 @%%@AB@%SETUP Options%@AE@%%@EH@%%@NL@%
  690. %@NL@%
  691. SETUP has several options: /?, /COPY, /HELP, /LIB, /NOFREE, and /NOHELP.
  692. With the exception of /? and /HELP, you should %@AI@%not%@AE@% use any of the options
  693. the first time you run SETUP. The /? and /HELP options (see Figure 2.5)
  694. present information about the options.  %@NL@%
  695. %@NL@%
  696. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  697. %@NL@%
  698. The /COPY option uncompresses and copies individual files from the
  699. distribution disks. The /LIB option builds additional combined libraries
  700. after you have already installed Microsoft C, without going through the
  701. entire setup process. /NOFREE instructs SETUP not to check for available
  702. free disk space before uncompressing and copying files. The /NOHELP option
  703. suppresses the SETUP help information displayed at the bottom of the screen.
  704. %@NL@%
  705. %@NL@%
  706. %@NL@%
  707. %@3@%%@CR:C6A00020010 @%%@AB@%Configuring Your System%@AE@%%@EH@%%@NL@%
  708. %@NL@%
  709. When SETUP has finished creating the combined libraries and placing them in
  710. the directories you specified, it creates files that are used for
  711. configuring your system.  %@NL@%
  712. %@NL@%
  713. If you selected OS/2 real mode or DOS as the host environment, SETUP creates
  714. three files: NEW-VARS.BAT, NEW-CONF.SYS, and TOOLS.PRE. The files
  715. NEW-VARS.BAT and NEW-CONF.SYS are placed in the directory C:\C600\BIN; the
  716. file TOOLS.PRE is placed in the directory C:\C600\INIT. (These are the
  717. default directory names. If you have overridden them with your own choices,
  718. SETUP places these files in the directories you specified.)  %@NL@%
  719. %@NL@%
  720. If you selected OS/2 protected mode as the host environment, SETUP creates
  721. two files: NEW-VARS.CMD and TOOLS.PRE. The file NEW-VARS.CMD is placed in
  722. the directory C:\C600\BINP; the file TOOLS.PRE is placed in the directory
  723. C:\C600\INIT. (These are the default directory names. If you have overridden
  724. them with your own choices, SETUP places these files in the directories you
  725. specified.)  %@NL@%
  726. %@NL@%
  727. To permanently configure your system for Microsoft C, you must add the
  728. respective file contents to your AUTOEXEC.BAT (or STARTUP.CMD), CONFIG.SYS,
  729. and TOOLS.INI files, and reboot your system. You can, however, run
  730. NEW-VARS.BAT or NEW-VARS.CMD to set environment variables before you use
  731. Microsoft C.  %@NL@%
  732. %@NL@%
  733. %@NL@%
  734. %@4@%%@AB@%Changing AUTOEXEC.BAT or STARTUP.CMD%@AE@%%@EH@%%@NL@%
  735. %@NL@%
  736. The NEW-VARS.BAT and NEW-VARS.CMD files contain batch file commands that set
  737. environment variables. Insert these commands into the AUTOEXEC.BAT or
  738. STARTUP.CMD file. Table 2.2 describes the meaning of each variable.  %@NL@%
  739. %@NL@%
  740. %@AB@%Table 2.2  Environment Variables%@AE@%
  741.  
  742. %@TH:  16   673 02 34 44 @%
  743. Variable                          Description
  744. %@AB@%──────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  745. PATH                              Path to search for applications
  746.  
  747. LIB                               Location of run-time libraries
  748.  
  749. INCLUDE                           Location of include (.H) files
  750.  
  751. HELPFILES                         Location of help (.HLP) files
  752.  
  753. INIT                              Location of initialization files
  754.  
  755. TEMP                              Location of PWB/LINK temporary files
  756.  
  757. %@AB@%──────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  758.  
  759. %@TE:  16   673 02 34 44 @%
  760.  
  761. %@NL@%
  762. %@4@%%@AB@%Modifying CONFIG.SYS%@AE@%%@EH@%%@NL@%
  763. %@NL@%
  764. If the host operating mode is OS/2 real mode or DOS, be sure the %@AS@% files %@AE@% and
  765. %@AS@% buffer %@AE@% values in CONFIG.SYS are large enough for Microsoft C. The values
  766. in NEW-CONF.SYS are minimums. The values in CONFIG.SYS should be greater
  767. than or equal to these amounts. Additionally, with OS/2, make sure the %@AS@%
  768. %@AS@%LIBPATH= %@AE@% line of the CONFIG.SYS file specifies the location of the file
  769. MSHELP.DLL. OS/2 users who want to use the CodeView debugger must also
  770. include the statement %@AS@% IOPL=YES%@AE@%.  %@NL@%
  771. %@NL@%
  772. To use the extended memory features of CodeView under DOS, set
  773. %@AS@%DEVICE=HIMEM.SYS %@AE@% (with HIMEM's fully qualified path name). See the section
  774. in this chapter titled "Configuring Extended Memory for CodeView" for
  775. additional information on running CodeView with extended memory in a DOS
  776. environment.  %@NL@%
  777. %@NL@%
  778. %@NL@%
  779. %@4@%%@AB@%Modifying TOOLS.INI%@AE@%%@EH@%%@NL@%
  780. %@NL@%
  781. SETUP creates a file called TOOLS.PRE. This file contains various PWB
  782. settings, such as those that specify libraries. You should add the contents
  783. of the TOOLS.PRE file to your existing TOOLS.INI file; if TOOLS.INI does not
  784. exist, you should rename TOOLS.PRE to TOOLS.INI.  %@NL@%
  785. %@NL@%
  786. The TOOLS.INI file contains many configuration options, which help you
  787. customize the following utilities in Microsoft C:  %@NL@%
  788. %@NL@%
  789. %@NL@%
  790.   ■   PWB%@NL@%
  791. %@NL@%
  792.   ■   The CodeView debugger%@NL@%
  793. %@NL@%
  794.   ■   The Microsoft Advisor help system%@NL@%
  795. %@NL@%
  796.   ■   The NMAKE utility%@NL@%
  797. %@NL@%
  798. %@NL@%
  799. You can use the PWB editor or a word processor to change the settings in the
  800. TOOLS.INI file. These are some of the options you can change:  %@NL@%
  801. %@NL@%
  802. %@NL@%
  803.   ■   The colors and the number of lines displayed by CodeView and PWB%@NL@%
  804. %@NL@%
  805.   ■   Macros for PWB%@NL@%
  806. %@NL@%
  807.   ■   Key assignments for PWB%@NL@%
  808. %@NL@%
  809.   ■   Default key settings for PWB%@NL@%
  810. %@NL@%
  811.   ■   The location of help files used by the Microsoft Advisor%@NL@%
  812. %@NL@%
  813.   ■   Options for NMAKE%@NL@%
  814. %@NL@%
  815. %@NL@%
  816. A complete table of TOOLS.INI settings is available in on-line help and the
  817. %@AI@%C Reference%@AE@%.  %@NL@%
  818. %@NL@%
  819. %@NL@%
  820. %@3@%%@CR:C6A00020011 @%%@AB@%Choosing a Target Operating Environment%@AE@%%@EH@%%@NL@%
  821. %@NL@%
  822. In many cases you will program primarily for either the OS/2 protected mode
  823. or the DOS 3.x - OS/2 real mode and use one combined library. Allowing SETUP
  824. to make either DOS or OS/2 the default environment is the easiest method,
  825. but you can also manually choose a target environment.  %@NL@%
  826. %@NL@%
  827. %@NL@%
  828. %@4@%%@AB@%Choosing Defaults for a Single Mode%@AE@%%@EH@%%@NL@%
  829. %@NL@%
  830. Start by deciding which operating mode will be the default environment. Then
  831. give the combined library for that mode the default combined-library name.
  832. The composition of library names is explained in the section "Specifying
  833. Default Library Names."  %@NL@%
  834. %@NL@%
  835. For example, the following steps will create a protected-mode executable
  836. file using the small memory model and the emulation floating-point library:
  837. %@NL@%
  838. %@NL@%
  839. %@NL@%
  840.   1.  Use SETUP to create SLIBCEP.LIB, the combined library for the small
  841.       memory model, floating-point emulation, and protected mode.%@NL@%
  842. %@NL@%
  843.   2.  Rename SLIBCEP.LIB as SLIBCE.LIB (the same name without P), the
  844.       default combined library name for the small memory model and
  845.       floating-point emulation library.%@NL@%
  846. %@NL@%
  847. %@NL@%
  848. At this point you can use PWB or invoke the command-line compiler, CL,
  849. without specifying the target operating environment for your application.
  850. (In this example, you still need to supply the appropriate PWB or CL options
  851. to select a memory model and floating point options.) If you don't specify a
  852. memory-model option or floating-point option on the command line, the linker
  853. links SLIBCE.LIB, creating an executable file that runs in OS/2 protected
  854. mode.  %@NL@%
  855. %@NL@%
  856. The same general procedure works for real mode, other memory models, and
  857. floating-point libraries: Create the appropriate operating mode and combined
  858. library, and give it the appropriate default combined-library name.  %@NL@%
  859. %@NL@%
  860. %@NL@%
  861. %@4@%%@AB@%Selecting a Mode at Compile Time%@AE@%%@EH@%%@NL@%
  862. %@NL@%
  863. If you need the flexibility of programming for both operating modes, you
  864. should use SETUP to create the combined libraries that you need for each
  865. model. Once you have created the combined libraries, you can select a model
  866. either by using the PWB options found in the C Compiler Options dialog box
  867. or the CL options listed in Table 2.3.  %@NL@%
  868. %@NL@%
  869. %@AB@%Table 2.3  Operating Environment Options%@AE@%
  870.  
  871. %@TH:  10   594 02 08 52 18 @%
  872. Option  Environment                                         Library Selected
  873. %@AB@%──────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  874. /Lp     OS/2 protected mode                                 %@AI@%m%@AE@%LIBC%@AI@%f%@AE@%P.LIB
  875.  
  876. /Lr     DOS 3.x - OS/2 real mode                            %@AI@%m%@AE@%LIBC%@AI@%f%@AE@%R.LIB
  877.  
  878. /Lc     DOS 3.x (synonym for /Lr)                           %@AI@%m%@AE@%LIBC%@AI@%f%@AE@%R.LIB
  879.  
  880. %@AB@%──────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  881.  
  882. %@TE:  10   594 02 08 52 18 @%
  883.  
  884. Using these options causes CL to substitute one of these library names for
  885. the default combined-library name in the object module's library-search
  886. record.  %@NL@%
  887. %@NL@%
  888. These options automatically set the /NODEFAULTLIBRARYSEARCH linker option,
  889. which overrides the default library (the syntax is /NOD:%@AI@%libraryname%@AE@%). For
  890. example, if you are programming for the OS/2 protected mode with the small
  891. memory model and floating-point emulation, and you supply the /Lp option for
  892. CL, the compiler passes the following option to the linker:  %@NL@%
  893. %@NL@%
  894. %@AS@%  /NOD:slibce slibcep%@AE@%%@NL@%
  895. %@NL@%
  896. %@NL@%
  897. %@2@%%@CR:C6A00020012 @%%@AB@%Configuring Extended Memory for CodeView%@AE@%%@EH@%%@NL@%
  898. %@NL@%
  899. Extended memory refers to memory at physical addresses above 1 megabyte that
  900. can be accessed by an 80%@AI@%x%@AE@%86 CPU in protected mode.  %@NL@%
  901. %@NL@%
  902. As previously mentioned, in order to use the extended memory features of
  903. CodeView under a DOS environment, you must set %@AS@% DEVICE=HIMEM.SYS %@AE@% (with
  904. HIMEM's fully qualified path name) in the CONFIG.SYS file. A sample entry of
  905. how to implement HIMEM is found in the NEW-CONF.SYS file that SETUP creates.
  906. %@NL@%
  907. %@NL@%
  908. ────────────────────────────────────────────────────────────────────────────%@NL@%
  909. NOTE
  910.  
  911. %@AI@%HIMEM.SYS is an implementation of the XMS 2.x standard. The complete XMS
  912. %@AI@%source and specification are available from the Microsoft Information
  913. %@AI@%Center; call 1-800-426-9400.%@AE@%%@NL@%
  914. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  915. %@NL@%
  916. In addition, there are several factors to consider when using CodeView under
  917. DOS with extended memory:  %@NL@%
  918. %@NL@%
  919. %@NL@%
  920.   ■   At least 384K of extended memory should be set aside for use with
  921.       HIMEM.SYS.%@NL@%
  922. %@NL@%
  923.   ■   Other memory managers such as 386-Max(tm) or QEMM may not work in
  924.       conjunction with HIMEM.SYS. You should use only one memory manager.%@NL@%
  925. %@NL@%
  926.   ■   Older versions of HIMEM.SYS may present problems. Use the most recent
  927.       version included on the distribution disks.%@NL@%
  928. %@NL@%
  929.   ■   Many RAM disk (VDISK) and disk cache programs are incompatible with
  930.       HIMEM.SYS. The HIMEM.SYS compatible RAMDRIVE RAM disk and SMARTDRV
  931.       disk cache programs are provided on the distribution disks. If you are
  932.       operating under Microsoft Windows(tm) , the SMARTDRV application
  933.       shipped with the Professional Development System is incompatible with
  934.       Windows 2.11, and is compatible only with Windows 3.0.%@NL@%
  935. %@NL@%
  936.   ■   Check the documentation of installed terminate-and-stay-resident (TSR)
  937.       programs to see if they are compatible with HIMEM/XMS 2.x. You can
  938.       incrementally install each TSR until you find a potential offender.%@NL@%
  939. %@NL@%
  940. %@NL@%
  941. If you choose to install the HIMEM, RAMDRIVE, and SMARTDRV files, SETUP
  942. places them in the C:\C600\BIN directory.  %@NL@%
  943. %@NL@%
  944. ────────────────────────────────────────────────────────────────────────────%@NL@%
  945. NOTE
  946.  
  947. %@AI@%Extended memory should not be confused with %@AI@%expanded memory%@AE@%%@AI@%. Expanded memory
  948. %@AI@%refers to bank-switched memory that overcomes the 640K RAM limitation found
  949. %@AI@%in the 8088 processor.%@AE@%%@AE@%%@NL@%
  950. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  951. %@NL@%
  952. %@NL@%
  953. %@2@%%@CR:C6A00020013 @%%@AB@%Customizing Microsoft C%@AE@%%@EH@%%@NL@%
  954. %@NL@%
  955. In addition to modifying the TOOLS.INI file, Microsoft C can be customized
  956. in other ways. For example, a variety of editor functions and options can be
  957. set within PWB by using the Editor Settings command on the Options menu.  %@NL@%
  958. %@NL@%
  959. For more information about customizing PWB, refer to Chapter 3 or see
  960. Chapter 8, "Customizing the Microsoft Programmer's WorkBench," in %@AI@%Advanced
  961. %@AI@%Programming Techniques%@AE@%. More information about customizing NMAKE and other
  962. utilities can also be found in %@AI@%Advanced Programming Techniques%@AE@%.  %@NL@%
  963. %@NL@%
  964. %@NL@%
  965. %@NL@%
  966. %@NL@%
  967. %@NL@%
  968. %@NL@%
  969. %@CR:C6A00030001 @%%@1@%%@AB@%Chapter 3  Using the Programmer's WorkBench%@AE@%%@EH@%%@NL@%
  970. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  971. %@NL@%
  972. This chapter introduces the Programmer's WorkBench (PWB)─a powerful
  973. integrated tool designed to make writing and debugging programs easier. PWB
  974. is a window-oriented programming environment that incorporates a text
  975. editor, a compiler, a linker, a debugger, a Make utility, a source-code
  976. browser, and an on-line help database. PWB provides an alternative to
  977. switching between command-linebased programs: You can edit, compile, link
  978. and debug from within an integrated environment. To demonstrate various
  979. features of PWB, this chapter provides a sample program for you to compile,
  980. link, and debug.  %@NL@%
  981. %@NL@%
  982. This chapter explains how to start PWB and then introduces the following
  983. elements of PWB:  %@NL@%
  984. %@NL@%
  985. %@NL@%
  986.   ■   Windows and menus. You can quickly find the command you need with the
  987.       menu system. The section "Using Windows and Menus" explains how to
  988.       open and close windows and how to navigate through the menus.%@NL@%
  989. %@NL@%
  990.   ■   Programmer's editor. Features such as "bookmarks," macros, customized
  991.       key commands, and enhanced search capabilities decrease the amount of
  992.       time you spend writing code.%@NL@%
  993. %@NL@%
  994.   ■   Integrated compiler and linker. You can compile, link, and run a
  995.       program without ever leaving the editor. PWB's integrated environment
  996.       and project-management facilities save you hours of development time.%@NL@%
  997. %@NL@%
  998.   ■   Integrated browser and debugger. With the Source Browser, you can
  999.       quickly find a data declaration or function definition within your
  1000.       source code, and find references to all functions and variables in a
  1001.       multi-module program. With the CodeView debugger, you can set
  1002.       breakpoints, examine variables and machine registers, and step through
  1003.       execution of your program one line at a time.%@NL@%
  1004. %@NL@%
  1005. %@NL@%
  1006. %@NL@%
  1007. %@2@%%@CR:C6A00030002 @%%@AB@%Starting PWB%@AE@%%@EH@%%@NL@%
  1008. %@NL@%
  1009. To run PWB for the first time, type  %@NL@%
  1010. %@NL@%
  1011. %@AS@%  PWB%@AE@%%@NL@%
  1012. %@NL@%
  1013. at the command line. (If errors occur, PWB displays error messages. See the
  1014. README.DOC file for further information.)  %@NL@%
  1015. %@NL@%
  1016. You can immediately begin writing source code in the new, untitled window
  1017. that appears. PWB maintains a history of the files you have opened. The next
  1018. time you run PWB, it opens the last file you worked on.  %@NL@%
  1019. %@NL@%
  1020. %@NL@%
  1021. %@3@%%@CR:C6A00030003 @%%@AB@%Specifying a Source File%@AE@%%@EH@%%@NL@%
  1022. %@NL@%
  1023. You can open an existing source file by entering its name on the command
  1024. line after the PWB command. If PWB can't find the specified file in the
  1025. current directory, it asks if you want to create a new file. You can also
  1026. open an existing source file with the Open command in the File menu.  %@NL@%
  1027. %@NL@%
  1028. %@NL@%
  1029. %@3@%%@CR:C6A00030004 @%%@AB@%Command-Line Options%@AE@%%@EH@%%@NL@%
  1030. %@NL@%
  1031. PWB has several command-line options that you can issue when you start the
  1032. program.  %@NL@%
  1033. %@NL@%
  1034. %@AB@%Option%@AE@%                            %@AB@%Action%@AE@%
  1035. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  1036. /e %@AI@%string%@AE@%                         The %@AI@%string%@AE@% represents a series of PWB 
  1037.                                   commands that will be executed at 
  1038.                                   start-up.
  1039.  
  1040. /t %@AI@%file%@AE@%                           Indicates the specified file is 
  1041.                                   temporary, and should not be kept in the
  1042.                                   file history. You must precede the name 
  1043.                                   of each temporary file with a /t.
  1044.  
  1045. /D                                Prevents all PWB initialization and 
  1046.                                   status files from being read at 
  1047.                                   start-up.
  1048.  
  1049. /DS                               Prevents the CURRENT.STS file from being
  1050.                                   read.
  1051.  
  1052. /DT                               Prevents the TOOLS.INI file from being 
  1053.                                   read at
  1054.                                   start-up.
  1055.  
  1056. /r                                Turns on the global "no-edit mode," 
  1057.                                   which gives all files opened with PWB 
  1058.                                   Read Only status.
  1059.  
  1060. /m %@AI@%bookmark%@AE@%                       Positions the cursor at the file 
  1061.                                   location designated by %@AI@%bookmark%@AE@%.
  1062.  
  1063. /?                                Lists the command-line options for 
  1064.                                   starting up PWB.
  1065.  
  1066. %@NL@%
  1067. %@2@%%@CR:C6A00030005 @%%@AB@%Using Windows and Menus%@AE@%%@EH@%%@NL@%
  1068. %@NL@%
  1069. This section introduces the PWB environment and describes how to control
  1070. windows and choose commands from the menus. Terms used to describe elements
  1071. of the PWB environment are also presented.  %@NL@%
  1072. %@NL@%
  1073. ────────────────────────────────────────────────────────────────────────────%@NL@%
  1074. NOTE
  1075.  
  1076. %@AI@%You can enter commands in PWB with the keyboard or a Microsoft (or fully
  1077. %@AI@%compatible) Mouse. Unless the Right mouse button is specifically mentioned,
  1078. %@AI@%"clicking" means that you press and release the Left mouse button once.%@AE@%%@NL@%
  1079.  
  1080. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  1081. %@NL@%
  1082. %@NL@%
  1083. %@3@%%@CR:C6A00030006 @%%@AB@%Windows%@AE@%%@EH@%%@NL@%
  1084. %@NL@%
  1085. Figure 3.1 shows parts of a typical PWB screen. Some of the elements provide
  1086. information only. For example, if CAPS LOCK is on, the letter %@AS@% C %@AE@% appears in
  1087. the lower right corner of the screen; the letter %@AS@% C %@AE@% is informational. Other
  1088. parts perform actions triggered by a specific keystroke or mouse action. For
  1089. example, if you click the button in the upper left corner of a window, the
  1090. window closes. The button is active rather than informational.  %@NL@%
  1091. %@NL@%
  1092. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1093. %@NL@%
  1094. The parts of a PWB screen and their use are listed in Table 3.1 below.  %@NL@%
  1095. %@NL@%
  1096. %@AB@%Table 3.1  Parts of a PWB Screen%@AE@%
  1097.  
  1098. %@TH:  44  2135 02 22 54 @%
  1099. Name                  Use
  1100. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  1101. Menu bar              Lists names of available menus.
  1102.  
  1103. Close button          Closes window (appears only if more than one window 
  1104.                       is displayed).
  1105.  
  1106. Title bar             Shows name of file currently being edited.
  1107.  
  1108. Windows               Contain source code or display information 
  1109.                       associated with on-line help.
  1110.  
  1111. Maximize button       Enlarges or restores window to its original size.
  1112.  
  1113. Screen number         Indicates number of help screen in the on-line help 
  1114.                       database.
  1115.  
  1116. Scroll bars           Indicate cursor position in the current file and 
  1117.                       allow cursor movement.
  1118.  
  1119. Reference bar         Lists shortcut keystrokes (keyboard users) and 
  1120.                       directs PWB commands (mouse users); summar izes menu
  1121.                       contents and displays other information.
  1122.  
  1123. File-type indicator   Indicates type of file. %@AS@%C%@AE@%: C source. %@AS@%text%@AE@%: any other
  1124.                       user-created file. %@AS@%pseudo%@AE@%: file-like means of 
  1125.                       displaying data.
  1126.  
  1127. Line and column       Shows current line and column of text cursor.
  1128. indicators            
  1129.  
  1130. Status indicators     %@AS@%A%@AE@%: Meta condition is on.%@AS@%%@AE@%
  1131.                       %@AS@%B%@AE@%: Background compile in OS/2.%@AS@%%@AE@%
  1132.                       %@AS@%C%@AE@%: CAPS LOCK is on.%@AS@%%@AE@%
  1133.                       %@AS@%L%@AE@%: A CR isn't used to terminate a line.%@AS@%%@AE@%
  1134.                       %@AS@%M%@AE@%: File has been modified.%@AS@%%@AE@%
  1135.                       %@AS@%N%@AE@%: NUM LOCK is on.%@AS@%%@AE@%
  1136.                       %@AS@%O%@AE@%: Overtype is on.%@AS@%%@AE@%
  1137.                       %@AS@%R%@AE@%: The file is set to Read Only status.%@AS@%%@AE@%
  1138.                       %@AS@%T%@AE@%: File is temporary.%@AS@%%@AE@%
  1139.                       %@AS@%X%@AE@%: A macro is recording.
  1140.  
  1141. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  1142.  
  1143. %@TE:  44  2135 02 22 54 @%
  1144.  
  1145. %@NL@%
  1146. %@3@%%@CR:C6A00030007 @%%@AB@%Menus%@AE@%%@EH@%%@NL@%
  1147. %@NL@%
  1148. The menu bar contains seven or more menus which can be accessed at any time.
  1149. A brief description of the selected menu command is displayed in the
  1150. reference bar. To get further information about what a menu does, invoke the
  1151. on-line help system by using the ALT and ARROW keys to highlight a menu
  1152. title or menu command, then press F1; or point the mouse cursor at the menu
  1153. command and click the Right mouse button.  %@NL@%
  1154. %@NL@%
  1155. PWB has the following menus:  %@NL@%
  1156. %@NL@%
  1157. %@AU@%(Please refer to the printed %@AE@%     The File menu allows you to clear the 
  1158. %@AU@%book)%@AE@%                             Source window, load an existing source 
  1159.                                   file, merge a file with the file in 
  1160.                                   memory, display the next file in the 
  1161.                                   file list specified at start-up, save 
  1162.                                   the current file, save the current file 
  1163.                                   under a different name, print the 
  1164.                                   selection or current file contents, 
  1165.                                   temporarily exit to DOS or OS/2, or 
  1166.                                   permanently exit PWB. Additionally, a 
  1167.                                   list of recently opened source files is 
  1168.                                   displayed at the bottom of the menu.
  1169.  
  1170. %@AU@%(Please refer to the printed %@AE@%     The Edit menu allows you to delete, cut,
  1171. %@AU@%book)%@AE@%                             copy, and paste text. Anchors can be set
  1172.                                   in the text as reference points for 
  1173.                                   selection. Box, stream, and line mode 
  1174.                                   determine how text will be selected with
  1175.                                   the cursor. Read Only status protects 
  1176.                                   source files. Commands to record, play, 
  1177.                                   and edit recorded macros are also 
  1178.                                   available in this menu. These items are 
  1179.                                   discussed further in the section "Using 
  1180.                                   the Editor."
  1181.  
  1182. %@AU@%(Please refer to the printed %@AE@%     The View menu controls the active 
  1183. %@AU@%book)%@AE@%                             window. A window can be closed, sized, 
  1184.                                   and split vertically or horizontally 
  1185.                                   with the menu commands.
  1186.  
  1187. %@AU@%(Please refer to the printed %@AE@%     The Search menu invokes commands that 
  1188. %@AU@%book)%@AE@%                             find or change text in source files. 
  1189.                                   Commands to search the source file for 
  1190.                                   compilation errors are also available. 
  1191.                                   Commonly accessed text can be identified
  1192.                                   with "bookmarks." Once a bookmark is 
  1193.                                   associated with a certain position in 
  1194.                                   the source file, the Go To Mark command 
  1195.                                   moves the cursor to that location.
  1196.  
  1197. %@AU@%(Please refer to the printed %@AE@%     The Make menu is used for compiling or 
  1198. %@AU@%book)%@AE@%                             building (to "build" means to compile 
  1199.                                   and link) programs. From this menu, you 
  1200.                                   also create or edit program lists, which
  1201.                                   name the components of multi-module
  1202.                                   programs.
  1203.  
  1204. %@AU@%(Please refer to the printed %@AE@%     The Run menu is used to execute your 
  1205. %@AU@%book)%@AE@%                             compiled program. Compiled programs can 
  1206.                                   be debugged with CodeView using the 
  1207.                                   Debug command. The Run menu also has 
  1208.                                   options for issuing DOS or OS/2 commands
  1209.                                   and adding applications as PWB menu 
  1210.                                   items (for example, the Customize Menu 
  1211.                                   command).
  1212.  
  1213. %@AU@%(Please refer to the printed %@AE@%     The items in the Options menu control 
  1214. %@AU@%book)%@AE@%                             the integrated environment. The 
  1215.                                   Environment command temporarily changes 
  1216.                                   path names for libraries, include files,
  1217.                                   and help files. Both Key Assignments and
  1218.                                   Editor Settings customize the operation 
  1219.                                   of the PWB editor. The Build Options 
  1220.                                   command saves current build options, 
  1221.                                   determines what type of program will be 
  1222.                                   built (OS/2, DOS) with the Initial Build
  1223.                                   option, and specifies whether the 
  1224.                                   program is built as a debug or release 
  1225.                                   version. The Browse, C Compiler, 
  1226.                                   CodeView, LINK, and NMAKE commands 
  1227.                                   configure their respective applications.
  1228.  
  1229. %@AU@%(Please refer to the printed %@AE@%     The commands in the optional Browse menu
  1230. %@AU@%book)%@AE@%                             are used to scan through data 
  1231.                                   declarations and functions once a 
  1232.                                   program has been compiled. Program call 
  1233.                                   trees, references to variables, and 
  1234.                                   symbol relationships can be shown in the
  1235.                                   Browser window. Menu items are disabled 
  1236.                                   unless you have compiled your program 
  1237.                                   with options that generate a Browser 
  1238.                                   database.
  1239.  
  1240. %@AU@%(Please refer to the printed %@AE@%     The optional Help menu accesses the 
  1241. %@AU@%book)%@AE@%                             on-line reference system. For more 
  1242.                                   information, see Chapter 4, "Using the 
  1243.                                   On-Line Reference."
  1244.  
  1245. %@NL@%
  1246. %@4@%%@AB@%Choosing Menu Commands%@AE@%%@EH@%%@NL@%
  1247. %@NL@%
  1248. Choose a command from a menu by "pulling down" or "opening" the menu.  %@NL@%
  1249. %@NL@%
  1250. To choose a command from the keyboard:  %@NL@%
  1251. %@NL@%
  1252. %@NL@%
  1253.   1.  Press the ALT key to activate the menu bar.%@NL@%
  1254. %@NL@%
  1255.   2.  Press the highlighted character in the menu name (such as F for File),
  1256.       or use the right and left ARROW keys to select a menu. The left and
  1257.       right ARROW keys only select the menu; they do not open it.%@NL@%
  1258. %@NL@%
  1259.   3.  Press the highlighted character in the command name (such as S for
  1260.       Save in the File menu), or use the up and down ARROW keys to highlight
  1261.       the command and then press ENTER.%@NL@%
  1262. %@NL@%
  1263. %@NL@%
  1264. To choose a command with the mouse:  %@NL@%
  1265. %@NL@%
  1266. %@NL@%
  1267.   1.  Open the menu by clicking the menu name.%@NL@%
  1268. %@NL@%
  1269.   2.  Click the command.%@NL@%
  1270. %@NL@%
  1271. %@NL@%
  1272. %@NL@%
  1273. %@4@%%@AB@%Closing Menus%@AE@%%@EH@%%@NL@%
  1274. %@NL@%
  1275. If you open a menu and then decide you don't want to issue a command, you
  1276. can close the menu in any of these ways:  %@NL@%
  1277. %@NL@%
  1278. %@NL@%
  1279.   ■   Press the ESC key%@NL@%
  1280. %@NL@%
  1281.   ■   Click the mouse somewhere outside of the menu%@NL@%
  1282. %@NL@%
  1283.   ■   Press ALT twice%@NL@%
  1284. %@NL@%
  1285. %@NL@%
  1286. %@NL@%
  1287. %@4@%%@AB@%Using Shortcut Keys%@AE@%%@EH@%%@NL@%
  1288. %@NL@%
  1289. Certain menu items are followed by the names of keys or key combinations.
  1290. These are "shortcut keys" for commonly used commands. Instead of issuing a
  1291. command by opening a menu, press the shortcut key to issue the command.  %@NL@%
  1292. %@NL@%
  1293. ────────────────────────────────────────────────────────────────────────────%@NL@%
  1294. NOTE
  1295.  
  1296. %@AI@%The reference bar at the bottom of the screen displays common shortcut keys.
  1297. %@AI@%You can click any of these buttons to execute the indicated command.%@AE@%%@NL@%
  1298. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  1299. %@NL@%
  1300. %@NL@%
  1301. %@4@%%@AB@%Shaded Commands%@AE@%%@EH@%%@NL@%
  1302. %@NL@%
  1303. When a command within a menu is in grayed type, it is "disabled," or
  1304. unavailable for use; some condition prevents the command from being used.
  1305. For example, when PWB is first run, and no programs have been compiled or
  1306. linked, the Next Error and Previous Error commands in the Search menu are
  1307. both disabled.  %@NL@%
  1308. %@NL@%
  1309. %@NL@%
  1310. %@4@%%@AB@%Ellipses%@AE@%%@EH@%%@NL@%
  1311. %@NL@%
  1312. If a command is followed by three periods (an ellipsis), it means more
  1313. information must be provided before the command is executed. You provide
  1314. this information in a dialog box that appears when you issue the command. If
  1315. a command is not followed by an ellipsis, it is executed immediately.  %@NL@%
  1316. %@NL@%
  1317. %@NL@%
  1318. %@3@%%@CR:C6A00030008 @%%@AB@%Dialog Boxes%@AE@%%@EH@%%@NL@%
  1319. %@NL@%
  1320. Some menu commands cause dialog boxes to appear. For example, Figure 3.2
  1321. shows the dialog box opened by the Search menu's Find command.  %@NL@%
  1322. %@NL@%
  1323. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1324. %@NL@%
  1325. ────────────────────────────────────────────────────────────────────────────%@NL@%
  1326. NOTE
  1327.  
  1328. %@AI@%Dialog boxes usually offer shortcut keys. Shortcut keys are identified by
  1329. %@AI@%highlighted letters, and can be activated by pressing the corresponding key.%@AE@%%@NL@%
  1330. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  1331. %@NL@%
  1332. Dialog boxes can contain one or more of the items in the following list.
  1333. Press ALT and the item's highlighted letter or press the TAB or SHIFT+TAB
  1334. keys to move among items in a dialog box. Dialog items can be set either
  1335. with keyboard commands or with the mouse.  %@NL@%
  1336. %@NL@%
  1337. %@AB@%Item%@AE@%                              %@AB@%Description%@AE@%
  1338. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  1339. Option buttons ()                 Offer a list of choices; only one option
  1340.                                   can be chosen. Use the ARROW keys to 
  1341.                                   move between the choices. In Figure 3.2,
  1342.                                   three option buttons set the direction 
  1343.                                   of the search (Forward, Backward, Find 
  1344.                                   All).
  1345.  
  1346. Check box [X]                     A yes/no switch. If the box is empty, 
  1347.                                   the option is turned off. If it contains
  1348.                                   the letter X, the feature is on. Press 
  1349.                                   the SPACEBAR or use the up and down 
  1350.                                   ARROW keys to turn a check box on or 
  1351.                                   off.
  1352.  
  1353. Text box [. . . . .]              Accepts text that you enter. In Figure 
  1354.                                   3.2, Find Text requires you to type in 
  1355.                                   the text to search for.
  1356.  
  1357. Command buttons                   Pass commands to the dialog box 
  1358. < OK >                            (enclosed in angle brackets). The OK 
  1359.                                   button means to use the current 
  1360.                                   settings. The Cancel button exits the 
  1361.                                   dialog box and does not change the 
  1362.                                   current settings. If one of the command 
  1363.                                   buttons is highlighted, press ENTER to 
  1364.                                   execute that command. Clicking a command
  1365.                                   button also executes it. If a button 
  1366.                                   contains an ellipsis, it indicates that 
  1367.                                   another dialog box will appear when the 
  1368.                                   command is carried out.
  1369.  
  1370. List boxes                        Display lists of information, such as 
  1371.                                   the contents of the current disk 
  1372.                                   directory, inside a list box. If the 
  1373.                                   number of items exceeds the list box 
  1374.                                   space, press the ARROW keys and 
  1375.                                   PGUP/PGDN or click the scroll bar to 
  1376.                                   move around the list.
  1377.  
  1378. %@NL@%
  1379. %@3@%%@CR:C6A00030009 @%%@AB@%Getting Help%@AE@%%@EH@%%@NL@%
  1380. %@NL@%
  1381. PWB uses the Microsoft Advisor on-line help system to provide information
  1382. about PWB, the compiler, the linker, the CodeView debugger, other utilities,
  1383. and topics relating to the C language. Information can be displayed at any
  1384. time and at any point you're using PWB or CodeView. For a complete
  1385. discussion of the on-line reference, see Chapter 4.  %@NL@%
  1386. %@NL@%
  1387. %@NL@%
  1388. %@4@%%@AB@%Menu Help%@AE@%%@EH@%%@NL@%
  1389. %@NL@%
  1390. To get information about a PWB menu command, choose the command with the
  1391. ARROW key, then press F1; or point the mouse cursor at the menu command and
  1392. click with the Right mouse button. A help window then appears with
  1393. information about the command.  %@NL@%
  1394. %@NL@%
  1395. %@NL@%
  1396. %@4@%%@AB@%Dialog-Box Help%@AE@%%@EH@%%@NL@%
  1397. %@NL@%
  1398. Many dialog boxes have a help button that provides additional information
  1399. about the dialog box and its contents. To display the information, click the
  1400. Help button with the mouse or press F1.  %@NL@%
  1401. %@NL@%
  1402. %@NL@%
  1403. %@4@%%@AB@%The Help Menu%@AE@%%@EH@%%@NL@%
  1404. %@NL@%
  1405. You can also use the commands listed in the Help menu to display an index of
  1406. all help topics, a table of contents, and information about using the
  1407. on-line reference system itself.  %@NL@%
  1408. %@NL@%
  1409. Choose the Contents command to display a global contents screen for the
  1410. entire help system. The main contents lists information divided by topic,
  1411. such as PWB, CodeView, or the C language. From the main contents, you can
  1412. navigate to a selected topic's table of contents by clicking that topic.  %@NL@%
  1413. %@NL@%
  1414. Choose the Index command to display a main index where you can move to other
  1415. indexes for different components of the Microsoft C help database.  %@NL@%
  1416. %@NL@%
  1417. %@NL@%
  1418. %@2@%%@CR:C6A00030010 @%%@AB@%Using the Editor%@AE@%%@EH@%%@NL@%
  1419. %@NL@%
  1420. The program editor is an important part of the PWB environment. This section
  1421. provides a brief overview of its major functions, and assumes you are using
  1422. the default key assignments.  %@NL@%
  1423. %@NL@%
  1424. %@NL@%
  1425. %@3@%%@CR:C6A00030011 @%%@AB@%Moving Around in a Source File%@AE@%%@EH@%%@NL@%
  1426. %@NL@%
  1427. Many of the keys within the editor work as you would expect them to. For
  1428. example:  %@NL@%
  1429. %@NL@%
  1430. %@NL@%
  1431.   ■   The PGDN and PGUP keys advance forward or back within the file.%@NL@%
  1432. %@NL@%
  1433.   ■   The HOME key moves the cursor to the beginning of the current line.%@NL@%
  1434. %@NL@%
  1435.   ■   The END key moves the cursor to the end of the current line.%@NL@%
  1436. %@NL@%
  1437.   ■   The ARROW keys move the cursor one character or one line at a time.
  1438. %@NL@%
  1439. ────────────────────────────────────────────────────────────────────────────%@NL@%
  1440. NOTE
  1441.  
  1442. %@AI@%For a complete list of editor commands, refer to the on-line help system's
  1443. %@AI@%PWB Function Quick Reference section on the PWB global contents screen.%@AE@%%@NL@%
  1444. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  1445. %@NL@%
  1446. %@NL@%
  1447. %@NL@%
  1448. %@NL@%
  1449. If you click in the shaded area on either side of the scroll box (position
  1450. marker) in the scroll bar, you move the cursor one full window at a time in
  1451. that direction. If you click on the scroll-bar arrows, you move the cursor
  1452. one row or column in the corresponding direction. If you click and drag the
  1453. scroll box, you move the cursor to the corresponding position within the
  1454. file.  %@NL@%
  1455. %@NL@%
  1456. %@NL@%
  1457. %@4@%%@AB@%Defining a Block%@AE@%%@EH@%%@NL@%
  1458. %@NL@%
  1459. To define a block with the PWB editor using the keyboard:  %@NL@%
  1460. %@NL@%
  1461. %@NL@%
  1462.   1.  Move the cursor to the beginning of the block. %@NL@%
  1463. %@NL@%
  1464.   2.  Hold down the SHIFT key and move the cursor to the end of the block. %@NL@%
  1465. %@NL@%
  1466.   3.  Use the other cursor keys (HOME, END, CTRL+RIGHT, and so on) while
  1467.       you're holding down SHIFT to extend the block.%@NL@%
  1468. %@NL@%
  1469. %@NL@%
  1470. To define a block with the PWB editor using the mouse:  %@NL@%
  1471. %@NL@%
  1472. %@NL@%
  1473.   1.  Move the cursor to the beginning of the block. %@NL@%
  1474. %@NL@%
  1475.   2.  While holding down the left button, move to the end of the block.%@NL@%
  1476. %@NL@%
  1477. %@NL@%
  1478. Once a block has been defined, it can be erased (press DEL), or placed into
  1479. the Clipboard, a temporary buffer, by cutting (press SHIFT+DEL) or by
  1480. copying (press CTRL+INS). Once in the Clipboard, the block can be inserted
  1481. at a cursor location (press SHIFT+INS). While a block is defined, anything
  1482. you type will delete the highlighted block and then insert the typed
  1483. characters.  %@NL@%
  1484. %@NL@%
  1485. Three text-selection modes are available in the Edit menu:  %@NL@%
  1486. %@NL@%
  1487. %@NL@%
  1488.   1.  Box mode selects text in a rectangular area whose opposite corners are
  1489.       the starting and ending cursor positions.%@NL@%
  1490. %@NL@%
  1491.   2.  Line mode selects entire lines of text from the starting cursor
  1492.       position to the ending cursor position.%@NL@%
  1493. %@NL@%
  1494.   3.  Stream mode selects all text from the starting cursor position to the
  1495.       ending cursor location.%@NL@%
  1496. %@NL@%
  1497. %@NL@%
  1498. Selecting a mode from the Edit menu changes the menu item to a new mode. The
  1499. mode displayed in the menu is the next available text-selection mode.  %@NL@%
  1500. %@NL@%
  1501. You can also toggle through the selection modes during text selection by
  1502. clicking the Right mouse button while you hold down the Left mouse button.  %@NL@%
  1503. %@NL@%
  1504. %@NL@%
  1505. %@4@%%@AB@%Setting Bookmarks%@AE@%%@EH@%%@NL@%
  1506. %@NL@%
  1507. You can set bookmarks anywhere in your source code with the Define Mark
  1508. command in the Search menu. Move the cursor to the location you want to
  1509. mark, then choose Define Mark.  %@NL@%
  1510. %@NL@%
  1511. In the dialog box that appears, type the name you want to give the bookmark.
  1512. The source file name and the row and column are already entered. Press ENTER
  1513. to save the bookmark for the current session. To permanently save a
  1514. bookmark, you must use the Add To Mark File option. Permanent bookmarks can
  1515. be loaded with the Set Mark File command in the Search menu.  %@NL@%
  1516. %@NL@%
  1517. To move the cursor to a bookmark, choose the Go To Mark command from the
  1518. Search menu. A list of all bookmarks is displayed. Select the bookmark from
  1519. the list using the ARROW keys or click the selected bookmark with the Left
  1520. mouse button. Press ENTER to go to the bookmark.  %@NL@%
  1521. %@NL@%
  1522. %@NL@%
  1523. %@4@%%@AB@%Setting Anchors%@AE@%%@EH@%%@NL@%
  1524. %@NL@%
  1525. An anchor is a temporary marker that identifies a cursor position somewhere
  1526. in the text. Use anchors to select large blocks of text.  %@NL@%
  1527. %@NL@%
  1528. To set an anchor, move the cursor to the desired location and use the Set
  1529. Anchor command in the Edit menu. Use the Select To Anchor command in the
  1530. Edit menu to select all text between the current cursor position and the
  1531. anchor. Only one anchor may be set at a time.  %@NL@%
  1532. %@NL@%
  1533. %@NL@%
  1534. %@4@%%@AB@%Searching for and Changing Text%@AE@%%@EH@%%@NL@%
  1535. %@NL@%
  1536. You can search for a string of text by using the Find command in the Search
  1537. menu. Type the string you want to look for, then use the check boxes to set
  1538. options such as wraparound search and case sensitivity. The Files button
  1539. allows you to specify a list of files to be searched for the designated
  1540. string.  %@NL@%
  1541. %@NL@%
  1542. Once a string has been located, use the Repeat Last Find command in the
  1543. Search menu (or press the shortcut key, F3) to move to the next occurrence
  1544. of the string. If you specified several files to search, press SHIFT+F3 to
  1545. move to the next occurrence of the string.  %@NL@%
  1546. %@NL@%
  1547. To modify several instances of a string in the source file, use the Change
  1548. command in the Search menu. Enter the target string, the replacement string,
  1549. and the search options.  %@NL@%
  1550. %@NL@%
  1551. PWB also supports the search and replace of text patterns using regular
  1552. expressions. Both UNIX(R) and non-UNIX regular expression syntaxes are
  1553. supported. For further information, see the on-line reference system.  %@NL@%
  1554. %@NL@%
  1555. ────────────────────────────────────────────────────────────────────────────%@NL@%
  1556. NOTE
  1557.  
  1558. %@AI@%Multi-file searches run a built-in GREP facility, and text that is found may
  1559. %@AI@%be scanned with the Next Error and Previous Error commands.%@AE@%%@NL@%
  1560. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  1561. %@NL@%
  1562. %@NL@%
  1563. %@4@%%@AB@%Creating Macros%@AE@%%@EH@%%@NL@%
  1564. %@NL@%
  1565. Editing tasks that you perform frequently can be saved as macros. A macro is
  1566. the record of a sequence of commands and/or literal text. Each macro has a
  1567. key combination that is used to "play back" the recorded actions.  %@NL@%
  1568. %@NL@%
  1569. For example, suppose several programmers are working on a file and need to
  1570. keep track of who made what changes. A macro can be used to insert a comment
  1571. with the programmer's name.  %@NL@%
  1572. %@NL@%
  1573. To create such a macro, choose the Set Record command in the Edit menu and
  1574. enter a macro name and associated key combination. For this example, call
  1575. the macro %@AS@% modname %@AE@% and let the key combination be CTRL+J. (Any key
  1576. combination can be used for a macro.) After you've named the macro, choose
  1577. the Record On command from the Edit menu. A bullet will appear to the left
  1578. of the menu command and an X in the status line, indicating all keystrokes
  1579. and menu commands are being recorded. Then type the following:  %@NL@%
  1580. %@NL@%
  1581. %@AS@%  /* j. courtney coded this */%@AE@%%@NL@%
  1582. %@NL@%
  1583. To stop the recording, choose Record On once again, which causes the bullet
  1584. to disappear. This action associates all the recorded actions with the
  1585. previously selected macro. Now, each time you press the CTRL+J key
  1586. combination for the macro, the comment you typed is instantly inserted at
  1587. the cursor position.  %@NL@%
  1588. %@NL@%
  1589. You save macros to the TOOLS.INI file when you save the <record> pseudofile
  1590. which can be reached by the Edit Macro command in the Edit menu. They may be
  1591. changed or deleted by modifying the file. See the section "Customizing PWB"
  1592. in on-line help for additional information about macros.  %@NL@%
  1593. %@NL@%
  1594. %@NL@%
  1595. %@3@%%@CR:C6A00030012 @%%@AB@%Customizing the Editor%@AE@%%@EH@%%@NL@%
  1596. %@NL@%
  1597. You can customize the PWB editor to meet your needs. Editor settings can be
  1598. modified, keyboard commands can be assigned, and command sets from other
  1599. editors can be emulated. In addition, customized extensions to the editor
  1600. can be written in C. See the on-line reference system and Chapter 8,
  1601. "Customizing PWB," in %@AI@%Advanced Programming Techniques%@AE@%, for complete details.
  1602. %@NL@%
  1603. %@NL@%
  1604. %@NL@%
  1605. %@4@%%@AB@%Changing Editor Settings%@AE@%%@EH@%%@NL@%
  1606. %@NL@%
  1607. The PWB editor has a variety of settings you can customize, such as word
  1608. wrap, color, and width of tab stops.  %@NL@%
  1609. %@NL@%
  1610. View or modify the settings by choosing the Editor Settings command from the
  1611. Options menu. A pseudofile named <assign> appears. (The title bar says
  1612. "Current Assignments and Settings," but the name <assign> appears in the
  1613. File menu's list of files.) This file displays numerous editor settings in
  1614. the format %@AI@%setting%@AE@%:%@AI@%value%@AE@%, where %@AI@%setting%@AE@% is the name of the setting, and
  1615. %@AI@%value%@AE@% is a Boolean, numeric, or text value. You can learn about a setting by
  1616. positioning the cursor on it and pressing F1.  %@NL@%
  1617. %@NL@%
  1618. To change the value of a setting, enter a new value. The change does not
  1619. take effect until you move the cursor to a different line. To save the
  1620. changed assignments, press SHIFT+F2 (if the default keyboard assignments are
  1621. in effect) or choose the Save command in the File menu. If you do not save,
  1622. the assignments will be temporary and will last only for the duration of the
  1623. PWB session.  %@NL@%
  1624. %@NL@%
  1625. To return to your source file, press F2.  %@NL@%
  1626. %@NL@%
  1627. %@NL@%
  1628. %@4@%%@AB@%Modifying Keyboard Assignments%@AE@%%@EH@%%@NL@%
  1629. %@NL@%
  1630. You can easily change all PWB keyboard assignments. Functions such as
  1631. %@AB@%delete%@AE@%, %@AB@%home%@AE@%, and %@AB@%copy%@AE@% can be reassigned by choosing the Key Assignments
  1632. command from the Options menu.  %@NL@%
  1633. %@NL@%
  1634. A pseudofile named <assign> appears. (The title bar says "Current
  1635. Assignments and Settings," but the name <assign> appears in the File menu's
  1636. list of files.) This file lists PWB functions and the keys to which they are
  1637. assigned. These appear in the format %@AI@%function%@AE@%:%@AI@%keyname%@AE@%. You can learn about a
  1638. PWB function by positioning the cursor on the function name and pressing F1.
  1639. A list of unused keys follows the assignment list.  %@NL@%
  1640. %@NL@%
  1641. To assign a new key to a function, replace %@AI@%keyname%@AE@% with the name of the new
  1642. key. The change does not take effect until you move the cursor to a
  1643. different line.  %@NL@%
  1644. %@NL@%
  1645. When you move the cursor to a different line, the line with the new
  1646. assignment is highlighted. To make the assignment permanent, save the file
  1647. by pressing SHIFT+F2 or by choosing the Save command in the File menu. This
  1648. updates the TOOLS.INI file, where changes to key assignments are stored.  %@NL@%
  1649. %@NL@%
  1650. To remove a key from a given function, assign the %@AB@%unassigned%@AE@% function to the
  1651. key.  %@NL@%
  1652. %@NL@%
  1653. %@NL@%
  1654. %@4@%%@AB@%Using Advanced Editor Features%@AE@%%@EH@%%@NL@%
  1655. %@NL@%
  1656. Most of the standard editing features in PWB are intuitive and easy to use.
  1657. However, there are also many advanced editing options that allow you to
  1658. customize and control the editor beyond simple menu commands.  %@NL@%
  1659. %@NL@%
  1660. The PWB editor incorporates all of the powerful features found in the
  1661. Microsoft Editor. A variety of functions and switches can be set to further
  1662. customize the PWB editor and enhance its performance. A complete list of
  1663. editor functions and settings is available in the on-line reference system.
  1664. %@NL@%
  1665. %@NL@%
  1666. New or altered functions and settings can be added to the TOOLS.INI file so
  1667. they are immediately loaded when PWB starts up. Or, they can be
  1668. interactively entered while you are working in the PWB environment.  %@NL@%
  1669. %@NL@%
  1670. For example, to interactively assign a key command to the editor's %@AB@%curdate%@AE@%
  1671. function, which enters the current date at the cursor, first press ALT+A,
  1672. then type the following into the argument dialog box:  %@NL@%
  1673. %@NL@%
  1674. %@AS@%  Curdate:SHIFT+CTRL+T%@AE@%%@NL@%
  1675. %@NL@%
  1676. Press ALT+= to assign the key to the function.  %@NL@%
  1677. %@NL@%
  1678. Now, whenever you press SHIFT+CTRL+T, the current date will instantly be
  1679. inserted at the editor's cursor position.  %@NL@%
  1680. %@NL@%
  1681. For detailed information about advanced PWB editor features, refer to the
  1682. %@AI@%Microsoft C Reference%@AE@% and the on-line reference system.  %@NL@%
  1683. %@NL@%
  1684. %@NL@%
  1685. %@4@%%@AB@%Reconfiguring the Editor%@AE@%%@EH@%%@NL@%
  1686. %@NL@%
  1687. If you wish to use another set of editing commands, PWB comes with an
  1688. additional .INI file containing key assignments for the BRIEF editor. You
  1689. can add the contents of the file to TOOLS.INI, or you can simulate other
  1690. editors' command sets by using the customization techniques previously
  1691. described.  %@NL@%
  1692. %@NL@%
  1693. %@NL@%
  1694. %@4@%%@AB@%Using Another Editor%@AE@%%@EH@%%@NL@%
  1695. %@NL@%
  1696. If you prefer to use another word processor or text editor, choose the Run
  1697. menu's Customize Menu command. This command is used to add other programs
  1698. (including word processors) to the Run menu so that you can run them from
  1699. within the PWB environment. Through the dialog box you can specify directory
  1700. paths and arguments to pass, and assign a key-command equivalent to run the
  1701. editor. When you exit the program, you return to PWB.  %@NL@%
  1702. %@NL@%
  1703. %@NL@%
  1704. %@2@%%@CR:C6A00030013 @%%@AB@%Compiling and Linking%@AE@%%@EH@%%@NL@%
  1705. %@NL@%
  1706. PWB uses a project-oriented approach to compiling and linking programs.
  1707. After a source file has been created and a program list associated with it,
  1708. PWB produces a makefile. A "program list" is a list of all of the source
  1709. files that make up the program; the "makefile" contains information about
  1710. the source files that compose the project. Whenever a multi-module program
  1711. is compiled or linked, the NMAKE utility examines the makefile and
  1712. determines which part of the project will be affected.  %@NL@%
  1713. %@NL@%
  1714. The process of creating an executable file by compiling and linking is known
  1715. as "building." When you build an application, the source code is first
  1716. compiled on a module-by-module basis into .OBJ files, and then linked with
  1717. the appropriate libraries.  %@NL@%
  1718. %@NL@%
  1719. Makefiles are especially useful with multi-module programs, because only
  1720. those source files that have changed are recompiled. This results in faster
  1721. build times, since existing source files that haven't been changed are not
  1722. recompiled. After you set a program list, building is a one-step process in
  1723. PWB.  %@NL@%
  1724. %@NL@%
  1725. %@NL@%
  1726. %@3@%%@CR:C6A00030014 @%%@AB@%Building Programs in PWB%@AE@%%@EH@%%@NL@%
  1727. %@NL@%
  1728. This section illustrates how to build programs under the PWB environment. To
  1729. start, type in this sample program:  %@NL@%
  1730. %@NL@%
  1731. %@AS@%  /* IO.C: String input and output */
  1732. %@AS@%  
  1733. %@AS@%  #include <stdio.h>
  1734. %@AS@%  
  1735. %@AS@%  main()
  1736. %@AS@%  {
  1737. %@AS@%     char date[30];
  1738. %@AS@%  
  1739. %@AS@%     printf( "Enter today's date: \n" );
  1740. %@AS@%     gets( date );
  1741. %@AS@%     printf( "Sample program run on %s\n", date );
  1742. %@AS@%  }%@AE@%%@NL@%
  1743. %@NL@%
  1744. This simple program uses the %@AS@% printf %@AE@% and %@AS@% gets %@AE@% library functions to prompt
  1745. for, and then print, today's date.  %@NL@%
  1746. %@NL@%
  1747. %@NL@%
  1748. %@4@%%@AB@%Saving the Program%@AE@%%@EH@%%@NL@%
  1749. %@NL@%
  1750. To save the source file, pull down the File menu and choose either Save or
  1751. Save As. If the file is new or you choose Save As, a dialog box prompts you
  1752. for a file name (see Figure 3.3). If you choose Save with an existing file,
  1753. PWB automatically saves the file under the name listed in the title bar of
  1754. the source window. To save a copy of a file under a different name, choose
  1755. Save As.  %@NL@%
  1756. %@NL@%
  1757. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1758. %@NL@%
  1759. Type in the new name of the source file, IO.C.  %@NL@%
  1760. %@NL@%
  1761. %@NL@%
  1762. %@4@%%@AB@%Setting and Clearing the Program List%@AE@%%@EH@%%@NL@%
  1763. %@NL@%
  1764. The Set Program List command in the Make menu tells PWB which makefile to
  1765. use in building a program. It clears the current makefile setting, instructs
  1766. PWB to use the makefile you have specified, and specifies which Browser
  1767. (.BSC) file is associated with the current project.  %@NL@%
  1768. %@NL@%
  1769. After you have saved the source file IO.C, choose the Set Program List
  1770. command in the Make menu. In the dialog box that appears, type the base file
  1771. name (IO), then press ENTER (see Figure 3.4). PWB automatically provides a
  1772. .MAK extension.  %@NL@%
  1773. %@NL@%
  1774. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1775. %@NL@%
  1776. If the makefile does not exist, PWB asks if you want to create a new
  1777. makefile; answer yes to this dialog box. Another dialog box titled Edit
  1778. Program List appears, listing all files in the current directory. From the
  1779. list, select the files you want to include in the project (in this example,
  1780. just IO.C).  %@NL@%
  1781. %@NL@%
  1782. Press TAB until the cursor is within the list box containing the directory
  1783. of files (another box lists the directory names). Use the ARROW keys to move
  1784. to the IO.C file. Press ENTER and the file name appears in the program list
  1785. below. Once the file is selected, press TAB until the Save List command
  1786. button is highlighted, and then press ENTER.  %@NL@%
  1787. %@NL@%
  1788. If you have a mouse, click IO.C once and then click the Add/Delete button
  1789. (or just double-click IO.C). Once the file appears in the program list,
  1790. click the Save List command button to save the makefile.  %@NL@%
  1791. %@NL@%
  1792. PWB automatically determines the contents of the makefile based on the files
  1793. you selected. You can edit the .MAK text file to change or add additional
  1794. commands.  %@NL@%
  1795. %@NL@%
  1796. If you want to create a new program or instruct PWB to "forget" about the
  1797. current program, use the Clear Program List command in the Make menu. This
  1798. action clears the current program list setting. You can then specify a new
  1799. program to build with Set Program List.  %@NL@%
  1800. %@NL@%
  1801. %@NL@%
  1802. %@4@%%@AB@%Setting Build Options%@AE@%%@EH@%%@NL@%
  1803. %@NL@%
  1804. Before compiling the program, you must specify the type of program you will
  1805. be building. This is done with the Build Options command in the Options
  1806. menu. Build Options calls a dialog box, whose Set Initial Build Options
  1807. button presents a series of predefined compiler settings for creating
  1808. programs (such as bound EXE, DOS EXE, DOS COM) and OS/2 .DLL libraries. Once
  1809. an initial build option has been chosen, its settings can be changed with
  1810. the C Compiler Options command in the Options menu.  %@NL@%
  1811. %@NL@%
  1812. To specify an existing build option:  %@NL@%
  1813. %@NL@%
  1814. %@NL@%
  1815.   1.  Choose the Build Options command from the Options menu%@NL@%
  1816. %@NL@%
  1817.   2.  Select the Set Initial Build Options button%@NL@%
  1818. %@NL@%
  1819.   3.  Use the mouse or the ARROW keys to select a build option from the list
  1820.       and press ENTER%@NL@%
  1821. %@NL@%
  1822. %@NL@%
  1823. To save your own group of build option settings:  %@NL@%
  1824. %@NL@%
  1825. %@NL@%
  1826.   1.  Select the appropriate settings in the C Compiler Options dialog box%@NL@%
  1827. %@NL@%
  1828.   2.  Choose the Build Options command from the Options menu%@NL@%
  1829. %@NL@%
  1830.   3.  Select the Save Current Build Options button%@NL@%
  1831. %@NL@%
  1832.   4.  Type a description of the options and press ENTER%@NL@%
  1833. %@NL@%
  1834. %@NL@%
  1835. The settings are now available through the Set Initial Build Options dialog
  1836. box.  %@NL@%
  1837. %@NL@%
  1838. %@NL@%
  1839. %@4@%%@AB@%Compiling and Linking the Program%@AE@%%@EH@%%@NL@%
  1840. %@NL@%
  1841. You can set a variety of compiler directives in the Options menu. The C
  1842. Compiler Options command provides options for memory model, processor type,
  1843. and other global settings that affect overall compilation (see Figure 3.5).
  1844. %@NL@%
  1845. %@NL@%
  1846. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1847. %@NL@%
  1848. From within the C Compiler Options dialog box, you can use the Set Debug
  1849. Options and Set Release Options buttons to easily create debug and release
  1850. versions of your program.  %@NL@%
  1851. %@NL@%
  1852. When you select the Set Debug Options button, a dialog box appears in which
  1853. you can set parameters such as stack checking, optimization, and debug
  1854. information. These settings also apply to programs built with the Debug
  1855. Build option, which you select from the dialog box displayed by the Build
  1856. Options command. Use debug settings when you are in the development phase
  1857. and actively debugging your program. When the Release Build option is
  1858. checked in the Build Options dialog box, the parameters specified in the Set
  1859. Release Options dialog box apply.  %@NL@%
  1860. %@NL@%
  1861. Similar debug and release options are also available for the linker with the
  1862. LINK Options command in the Options menu (see Figure 3.6). You can display
  1863. the options in both the C Compiler Options and LINK Options dialog boxes
  1864. with the Show Debug Options and Show Release Options buttons.  %@NL@%
  1865. %@NL@%
  1866. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  1867. %@NL@%
  1868. The Set Release Options button in the C Compiler Options dialog box offers
  1869. the same choices as Set Debug Options, but Set Release applies them to a
  1870. final version of the program. Use these settings when your program is
  1871. completely debugged and ready for release.  %@NL@%
  1872. %@NL@%
  1873. For this example, use the default settings in the C Compiler Options dialog
  1874. box.  %@NL@%
  1875. %@NL@%
  1876. Before building the sample program, make sure that its name appears after
  1877. the Compile File and Build commands in the Make menu. If the name does not
  1878. appear after the Build command, choose the Set Program List command in the
  1879. Make menu to set the makefile as the current project.  %@NL@%
  1880. %@NL@%
  1881. To build the program, choose the Build command in the Make menu. If a
  1882. compile or link error occurs, the build terminates, and the error appears in
  1883. the Compile Results window. Use the on-line reference system to explain
  1884. unknown errors by selecting the error and pressing F1. If you are using OS/2
  1885. and errors occur, you will be informed and asked if you want to see the
  1886. compile log.  %@NL@%
  1887. %@NL@%
  1888. %@NL@%
  1889. %@4@%%@AB@%Running the Program%@AE@%%@EH@%%@NL@%
  1890. %@NL@%
  1891. After the program has been built, the name of your executable file is
  1892. appended to the Execute command in the Run menu. Choose Execute to run the
  1893. program. When the program is finished running, press any key to return to
  1894. PWB.  %@NL@%
  1895. %@NL@%
  1896. %@NL@%
  1897. %@4@%%@AB@%Building from Multiple Source Files%@AE@%%@EH@%%@NL@%
  1898. %@NL@%
  1899. You can build most applications from more than one source file. This section
  1900. demonstrates how to create a multi-module program.  %@NL@%
  1901. %@NL@%
  1902. First, edit the IO.C program:  %@NL@%
  1903. %@NL@%
  1904. %@AS@%  /* IO.C: Illustrates external functions */
  1905. %@AS@%  
  1906. %@AS@%  #include <stdio.h>
  1907. %@AS@%  
  1908. %@AS@%  void outsider(void); /* Add this function. */
  1909. %@AS@%  void sample(void);   /* Add this function. */
  1910. %@AS@%  
  1911. %@AS@%  main()
  1912. %@AS@%  {
  1913. %@AS@%     char date[30];
  1914. %@AS@%  
  1915. %@AS@%     sample();   /* Call new function. */
  1916. %@AS@%     outsider(); /* Call new function. */
  1917. %@AS@%     printf( "Enter today's date: \n" );
  1918. %@AS@%     gets( date );
  1919. %@AS@%     printf( "Sample program run on %s\n", date );
  1920. %@AS@%  }
  1921. %@AS@%  
  1922. %@AS@%  /* Implement the new sample function. */ 
  1923. %@AS@%  void sample(void)
  1924. %@AS@%  {
  1925. %@AS@%     printf( "A sample function.\n" );
  1926. %@AS@%  }%@AE@%%@NL@%
  1927. %@NL@%
  1928. The %@AS@% main %@AE@% function calls two new functions defined within the program: %@AS@%
  1929. %@AS@%sample %@AE@% and %@AS@% outsider%@AE@%.  %@NL@%
  1930. %@NL@%
  1931. Save the changed file and then choose New from the File menu. Type in a
  1932. second source file:  %@NL@%
  1933. %@NL@%
  1934. %@AS@%  /* IOB.C: Second module for IO.C */
  1935. %@AS@%  
  1936. %@AS@%  #include <stdio.h>
  1937. %@AS@%  
  1938. %@AS@%  void outsider(void);
  1939. %@AS@%  
  1940. %@AS@%  void outsider(void)
  1941. %@AS@%  {
  1942. %@AS@%     printf( "This line is from the file IOB.C.\n" );
  1943. %@AS@%  }%@AE@%%@NL@%
  1944. %@NL@%
  1945. Save it as IOB.C. The two source files are combined to produce a
  1946. multi-module program.  %@NL@%
  1947. %@NL@%
  1948. %@NL@%
  1949. %@4@%%@AB@%Multiple Modules and the Program List%@AE@%%@EH@%%@NL@%
  1950. %@NL@%
  1951. Since the example program now uses two source files, the makefile must be
  1952. changed to tell PWB which files should be compiled. Choose the Edit Program
  1953. List command from the Make menu, add the IOB.C file to the list, and save
  1954. it. When you create multimodule programs, the order of the file names added
  1955. is inconsequential.  %@NL@%
  1956. %@NL@%
  1957. ────────────────────────────────────────────────────────────────────────────%@NL@%
  1958. NOTE
  1959.  
  1960. %@AI@%A program list can include source files (with the .C extension), assembler
  1961. %@AI@%files (.ASM), object files (.OBJ), library files (.LIB), definition files
  1962. %@AI@%(.DEF), and resource files (.RC). For example, if you didn't include the
  1963. %@AI@%graphics libraries in the combined library when you ran the SETUP program,
  1964. %@AI@%you can place GRAPHICS.LIB in the program list to gain access to graphics
  1965. %@AI@%functions under DOS.%@AE@%%@NL@%
  1966. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  1967. %@NL@%
  1968. At this point you can compile and link the program.  %@NL@%
  1969. %@NL@%
  1970. When you choose the Rebuild All command from the Make menu, every .C file in
  1971. the program list is compiled into a .OBJ file. Then all of the .OBJ files
  1972. are linked with .LIB files to create one .EXE file.  %@NL@%
  1973. %@NL@%
  1974. If you choose the Build command, the NMAKE utility checks the time and date
  1975. stamps on the source and object files. If the source code has not changed
  1976. since the last time a Build command was executed, unchanged files are not
  1977. recompiled. Consequently, the Build command is often faster than Rebuild
  1978. All.  %@NL@%
  1979. %@NL@%
  1980. %@NL@%
  1981. %@3@%%@CR:C6A00030015 @%%@AB@%Compiling and Linking from the Command Line%@AE@%%@EH@%%@NL@%
  1982. %@NL@%
  1983. You are not restricted to using the PWB environment to create executable
  1984. programs. Programs can be compiled and linked with Microsoft C at the DOS or
  1985. OS/2 command line.  %@NL@%
  1986. %@NL@%
  1987. The CL.EXE program may be used to compile and link programs. PWB
  1988. automatically executes CL, or you can manually execute it at the command
  1989. line. Simply enter CL followed by a space and the name of the source file to
  1990. create a .EXE program.  %@NL@%
  1991. %@NL@%
  1992. In addition, a variety of command-line options can be used. For example,  %@NL@%
  1993. %@NL@%
  1994. %@AS@%  CL /AM IO.C%@AE@%%@NL@%
  1995. %@NL@%
  1996. causes the program to be compiled using the medium memory model instead of
  1997. the default small model. Any compiler options should appear before the names
  1998. of the files to be compiled.  %@NL@%
  1999. %@NL@%
  2000. You can find a complete list of compiler and linker options in the %@AI@%C
  2001. %@AI@%Reference%@AE@% or by typing  %@NL@%
  2002. %@NL@%
  2003. %@AS@%  CL /HELP%@AE@%%@NL@%
  2004. %@NL@%
  2005. to invoke the on-line reference system.  %@NL@%
  2006. %@NL@%
  2007. You can also use CL to build multi-module programs by specifying all source
  2008. files to be compiled:  %@NL@%
  2009. %@NL@%
  2010. %@AS@%  CL IO.C IOB.C%@AE@%%@NL@%
  2011. %@NL@%
  2012. This command builds a program called IO.EXE, because IO.C is listed first.  %@NL@%
  2013. %@NL@%
  2014. Another way to build a multi-module program is to compile the two files and
  2015. then manually link them:  %@NL@%
  2016. %@NL@%
  2017. %@AS@%  CL /c IO.C
  2018. %@AS@%  CL /c IOB.C
  2019. %@AS@%  LINK IO.OBJ IOB.OBJ%@AE@%%@NL@%
  2020. %@NL@%
  2021. The /c option instructs CL to compile but not link. Once the .OBJ files have
  2022. been created, use the linker to create the executable file.  %@NL@%
  2023. %@NL@%
  2024. Since a makefile named IO.MAK has already been created using PWB, you can
  2025. also use the NMAKE utility to build IO.EXE. Simply pass it the name of the
  2026. makefile:  %@NL@%
  2027. %@NL@%
  2028. %@AS@%  NMAKE /F IO.MAK%@AE@%%@NL@%
  2029. %@NL@%
  2030. If you don't provide /F and a file name, NMAKE searches for a file named
  2031. MAKEFILE.  %@NL@%
  2032. %@NL@%
  2033. For a complete list of compiler, linker, and NMAKE options, see %@AI@%Advanced
  2034. %@AI@%Programming Techniques%@AE@%, the%@AI@% C Reference%@AE@%, or the on-line reference system.  %@NL@%
  2035. %@NL@%
  2036. %@NL@%
  2037. %@2@%%@CR:C6A00030016 @%%@AB@%Debugging Programs%@AE@%%@EH@%%@NL@%
  2038. %@NL@%
  2039. PWB has a variety of resources available for debugging programs. They range
  2040. from simple compile- and link-error messages to sophisticated source
  2041. browsing and source- or assembly-level debugging.  %@NL@%
  2042. %@NL@%
  2043. When compile-time errors occur, the cursor moves to the line that caused the
  2044. first error and a brief description of the error appears in the reference
  2045. bar. Use the Next Error and Previous Error commands in the Search menu to
  2046. move the cursor to the lines where other errors occurred.  %@NL@%
  2047. %@NL@%
  2048. To view a complete list of errors, choose the Compile Results command from
  2049. the View menu. Use the Set Error command in the Search menu to select the
  2050. error under the cursor as the current error. This command synchronizes the
  2051. source and error windows so that the source-code line that contains the
  2052. error appears in the source window.  %@NL@%
  2053. %@NL@%
  2054. The Microsoft Advisor can be used to display on-line help about the error.
  2055. In the Compile Results window, move the cursor to the error number and press
  2056. F1.  %@NL@%
  2057. %@NL@%
  2058. PWB incorporates a source-code browser and interfaces with the CodeView
  2059. debugger. The Browser displays information about function and data
  2060. relationships. CodeView is a window-oriented symbolic debugger that lets you
  2061. step through your code and examine variables and data as the program
  2062. executes.  %@NL@%
  2063. %@NL@%
  2064. Before a program can take advantage of the Browser or CodeView, the
  2065. appropriate %@AB@%debug%@AE@% or %@AB@%browse%@AE@% switches must be set with the C Compiler Options
  2066. and Browse Options commands in the Options menu. As an example, build one of
  2067. the sample programs previously listed with the debug options to experiment
  2068. with the Browser and CodeView.  %@NL@%
  2069. %@NL@%
  2070. %@NL@%
  2071. %@3@%%@CR:C6A00030017 @%%@AB@%Using the Browser%@AE@%%@EH@%%@NL@%
  2072. %@NL@%
  2073. The commands on the Browse menu are referred to collectively as the PWB
  2074. Source Browser. These commands allow you to search a database comprising
  2075. selected files, to get a list of references and definitions, build a call
  2076. tree and outline, or create a list of relationships among program symbols.
  2077. Figure 3.7 shows the functions called by %@AS@% main %@AE@% in IO.C.  %@NL@%
  2078. %@NL@%
  2079. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2080. %@NL@%
  2081. Before using these commands, you must define the database the Source Browser
  2082. is going to search.  %@NL@%
  2083. %@NL@%
  2084. To define a database:  %@NL@%
  2085. %@NL@%
  2086. %@NL@%
  2087.   1.  Generate a program list using the Set Program List command in the Make
  2088.       menu. The files contained in the program list make up the database.%@NL@%
  2089. %@NL@%
  2090.   2.  Choose Browse Options from the Options menu. You must select the
  2091.       Generate Browse Information field in the dialog box to create the
  2092.       Source Browser database. The rest of the fields on this dialog box
  2093.       offer you choices of how to build the database; they are optional.%@NL@%
  2094. %@NL@%
  2095.   3.  Build your program using the commands in the Make Menu. When you build
  2096.       the program, a file with the same program-list root name and a .BSC
  2097.       (Browser Source Cache) extension is created. This file contains
  2098.       reference information that the Browser uses.%@NL@%
  2099. %@NL@%
  2100. %@NL@%
  2101. Once you have completed these steps, Browse Menu commands are ready for you
  2102. to use.  %@NL@%
  2103. %@NL@%
  2104. %@NL@%
  2105.   ■   The Goto Definition command provides a list of symbols and variables
  2106.       that occur within include files and modules. You can immediately open
  2107.       the file at the line number where the definition occurred by selecting
  2108.       the <OK> button.%@NL@%
  2109. %@NL@%
  2110.   ■   The Goto Reference command displays a list of files and line numbers
  2111.       where  symbols and variables have been referenced in include files and
  2112.       modules.%@NL@%
  2113. %@NL@%
  2114.   ■   The View Relationships command provides detailed information about
  2115.       various portions of your program. You can examine functions, macros,
  2116.       types, and variables by their use, definition, or inclusion in include
  2117.       files and modules.%@NL@%
  2118. %@NL@%
  2119.   ■   The List References command displays references to functions, macros,
  2120.       types, and variables. You can move the cursor to a reference, and then
  2121.       use the Goto Definition or Goto Reference commands to show occurrences
  2122.       of the reference.%@NL@%
  2123. %@NL@%
  2124.   ■   The Call Tree command displays a tree structure of function calls
  2125.       within the program.%@NL@%
  2126. %@NL@%
  2127. %@NL@%
  2128. For additional information about the Browser, refer to the on-line reference
  2129. system.  %@NL@%
  2130. %@NL@%
  2131. ────────────────────────────────────────────────────────────────────────────%@NL@%
  2132. NOTE
  2133.  
  2134. %@AI@%You can create a Browser information file with the CL (command-line)
  2135. %@AI@%compiler by using the /FR or /Fr options. This creates a .SBR file which can
  2136. %@AI@%be converted to a .BSC file with the PWBRMAKE.EXE utility.%@AE@%%@NL@%
  2137. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  2138. %@NL@%
  2139. %@NL@%
  2140. %@3@%%@CR:C6A00030018 @%%@AB@%Debugging with CodeView%@AE@%%@EH@%%@NL@%
  2141. %@NL@%
  2142. PWB provides access to the Microsoft CodeView debugger. After a program has
  2143. been built, CodeView can be used to step through the source code, displaying
  2144. output, registers, and variables as each line is executed (see Figure 3.8).
  2145. You can set breakpoints and watchpoints to further aid in debugging.
  2146. CodeView uses the Microsoft Advisor to provide on-line help about its
  2147. operation and options, in addition to information about any C keywords in
  2148. the program you are debugging.  %@NL@%
  2149. %@NL@%
  2150. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2151. %@NL@%
  2152. ────────────────────────────────────────────────────────────────────────────%@NL@%
  2153. NOTES
  2154.  
  2155. %@AI@%CodeView version 3.0 is compatible with releases of OS/2 later than version
  2156. %@AI@%1.0. If you encounter problems exiting CodeView, you either have an older
  2157. %@AI@%version of OS/2 or the wrong version of the DOSCALLS.DLL file.%@AE@%%@NL@%
  2158.  
  2159. %@AI@%If you use CodeView from the OS/2 DOS compatibility box, be sure the /S
  2160. %@AI@%(Swap Screen in Buffers) option is set in the CodeView Options dialog box.
  2161. %@AI@%If the option is not set, the mouse cursor is not displayed while you are
  2162. %@AI@%debugging.%@AE@%%@NL@%
  2163.  
  2164. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  2165. %@NL@%
  2166. %@NL@%
  2167. %@4@%%@AB@%Preparing a Debug Build%@AE@%%@EH@%%@NL@%
  2168. %@NL@%
  2169. It's easy to create a debug version of a program so it can be examined with
  2170. CodeView.  %@NL@%
  2171. %@NL@%
  2172. First, choose C Compiler Options from the Options menu, then select the Set
  2173. Debug Options button. This dialog box contains a variety of settings for a
  2174. debug build. Although most of the dialog box options can be set to your
  2175. preference, you must check the CodeView option under the Debug Information
  2176. heading, which is on by default. In addition, code optimization options,
  2177. which are off by default, should be unchecked so that code movement does not
  2178. affect debugging.  %@NL@%
  2179. %@NL@%
  2180. The CodeView Options command in PWB's Options menu provides a variety of
  2181. choices for configuring CodeView. These include two-monitor debugging,
  2182. memory allocation, and the number of lines on the screen. For now, use the
  2183. default settings initially displayed.  %@NL@%
  2184. %@NL@%
  2185. In order for the compiler to build a program that contains the necessary
  2186. CodeView information, you must check the Debug option, set in the dialog box
  2187. displayed by the Build Options command in the Options menu. In addition, the
  2188. CodeView option, which is on by default, must be selected in the Set Debug
  2189. Options dialog box.  %@NL@%
  2190. %@NL@%
  2191. To demonstrate how CodeView works, set the debug options as listed above,
  2192. then rebuild the IO.C program using the Rebuild All command in the Make
  2193. menu.  %@NL@%
  2194. %@NL@%
  2195. %@NL@%
  2196. %@4@%%@AB@%Examining the Program%@AE@%%@EH@%%@NL@%
  2197. %@NL@%
  2198. After your program has been built with the appropriate debug options, choose
  2199. the Debug command from the Run menu. PWB immediately transfers control to
  2200. the CodeView debugger, loading the current project as indicated in the
  2201. program list.  %@NL@%
  2202. %@NL@%
  2203. When you switch from PWB to CodeView, the program appears in the source
  2204. window. Choose the Source command in the Options menu or type the %@AS@% S+ %@AE@%
  2205. command in CodeView's command window to display the code in C, the %@AS@% S- %@AE@%
  2206. command for assembly language, or the %@AS@% S& %@AE@% command for a combination of the
  2207. two. With C or mixed-source options, a line number appears to the left of
  2208. each line of source code as a reference.  %@NL@%
  2209. %@NL@%
  2210. In addition to the source code, commands in the View menu show windows
  2211. displaying memory, registers, and local variables. CodeView windows are
  2212. similar to PWB windows in that they can be scrolled, sized, and closed.
  2213. Multiple windows can appear on the screen at once, displaying a variety of
  2214. information. A list of shortcut keys and buttons appears at the bottom of
  2215. the screen.  %@NL@%
  2216. %@NL@%
  2217. %@NL@%
  2218. %@4@%%@AB@%Setting Watch Expressions and Breakpoints%@AE@%%@EH@%%@NL@%
  2219. %@NL@%
  2220. Watch expressions and breakpoints are optional CodeView settings that
  2221. display variable values and interrupt execution of the program.  %@NL@%
  2222. %@NL@%
  2223. A "watch expression" is a variable within the program that CodeView
  2224. continually watches. Watch expressions are displayed with the Watch command
  2225. in the View menu. As the value of a variable changes, the value changes in
  2226. the watch window.  %@NL@%
  2227. %@NL@%
  2228. To add a variable to the watch expression list, select the variable and
  2229. choose the Add Watch command from the Watch menu or use the W%@AB@% %@AE@%command in the
  2230. command window. You can optionally enter the variable name in the dialog
  2231. box. Watch expressions are removed with the Delete Watch command in the
  2232. watch menu or with the Y command in the command window.  %@NL@%
  2233. %@NL@%
  2234. To set a watch variable in the IO.C file, use the cursor to highlight the %@AS@%
  2235. %@AS@%date %@AE@% variable in the CodeView source window. Then choose the Add Watch
  2236. command from the Watch menu. The %@AS@% date %@AE@% variable appears in the Expression
  2237. text box. Press ENTER or click the OK button to store the watch variable.  %@NL@%
  2238. %@NL@%
  2239. CodeView also incorporates a temporary watch option called a QuickWatch.
  2240. Highlight a variable in the source window with the mouse or cursor. Choose
  2241. the QuickWatch command from the Watch menu. A dialog box appears with the
  2242. current value of the variable. You can add any QuickWatch variable to the
  2243. watch window with the Add Watch dialog option.  %@NL@%
  2244. %@NL@%
  2245. You can expand any structures or arrays that are set as watch expressions
  2246. (identified with a "+" in the watch window) to show individual elements.
  2247. Position the cursor on the variable name and either double-click the Left
  2248. mouse button or press ENTER (see Figure 3.9).  %@NL@%
  2249. %@NL@%
  2250. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2251. %@NL@%
  2252. A "breakpoint" is an instruction that tells CodeView to interrupt execution
  2253. at a certain location or when an expression becomes true.  %@NL@%
  2254. %@NL@%
  2255. Use breakpoints to gain control of the program before an error occurs and to
  2256. quickly move to a part of the program you want to trace. When CodeView stops
  2257. at a breakpoint, you can then single-step or trace through instructions
  2258. until you find the problem.  %@NL@%
  2259. %@NL@%
  2260. Set a breakpoint by positioning the cursor on the line at which you want the
  2261. program to stop and then pressing F9. Alternatively, you can choose the Set
  2262. Breakpoint command from the Watch menu. A dialog box presents a series of
  2263. options for setting types of breakpoints. Breakpoints are modified or
  2264. deleted with the Edit Breakpoints command in the Watch menu.  %@NL@%
  2265. %@NL@%
  2266. Set a breakpoint in the IO.C file by moving the cursor in the CodeView
  2267. source window to the line that reads  %@NL@%
  2268. %@NL@%
  2269. %@AS@%  printf( "A sample function.\n" );%@AE@%%@NL@%
  2270. %@NL@%
  2271. From the Watch menu, choose the Set Breakpoint command. The number of the
  2272. line the cursor appears on is displayed in the dialog box. Press ENTER or
  2273. click the OK button with the mouse to store the breakpoint. After the
  2274. breakpoint has been set, the line it occurs on is highlighted.  %@NL@%
  2275. %@NL@%
  2276. %@NL@%
  2277. %@4@%%@AB@%Running the Program%@AE@%%@EH@%%@NL@%
  2278. %@NL@%
  2279. CodeView runs your program and displays each source line as it executes. If
  2280. an error occurs, CodeView stops at the instruction that caused the error.
  2281. CodeView also halts execution at breakpoints.  %@NL@%
  2282. %@NL@%
  2283. If a program requires arguments to be passed from the command line, these
  2284. arguments can be entered with the Set Runtime Arguments command in the Run
  2285. menu.  %@NL@%
  2286. %@NL@%
  2287. Table 3.2 lists several CodeView commands for running a program.  %@NL@%
  2288. %@NL@%
  2289. %@AB@%Table 3.2  CodeView Run Commands%@AE@%
  2290.  
  2291. %@TH:  12   473 02 06 08 64 @%
  2292. Key   Name    Use
  2293. %@AB@%──────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  2294. F5    Go      Executes the program to the next breakpoint, error, or end of 
  2295.               the program
  2296.  
  2297. F8    Trace   Executes a single line
  2298.  
  2299. F10   Step    Executes a single line, but doesn't trace into 
  2300.               functions
  2301.  
  2302. %@AB@%──────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  2303.  
  2304. %@TE:  12   473 02 06 08 64 @%
  2305.  
  2306. Run commands can be entered by pressing the appropriate key or clicking the
  2307. commands at the bottom of the screen. With the Trace and Step commands, each
  2308. line is highlighted as it is executed. The Go command executes each line
  2309. until it stops at an error, a breakpoint, or the end of the program. If you
  2310. choose the Animate command, each line is highlighted as it executes. To
  2311. force the run commands to start at the beginning of the program, use the
  2312. Restart command in the Run menu.  %@NL@%
  2313. %@NL@%
  2314. The Screen Swap setting in the Options menu controls display of the output.
  2315. If the option is turned on, CodeView switches to the output screen after
  2316. each line executes, and then switch back to the source window. You can turn
  2317. the option off during portions of your program that don't access the screen
  2318. to reduce the distracting flicker of switching screens. If you want to view
  2319. the output screen longer, choose the Output command from the View menu.
  2320. Press any key to exit the output screen and return to CodeView.  %@NL@%
  2321. %@NL@%
  2322. In addition to single-stepping through a program, the Animate command in the
  2323. Run menu automatically steps through the program, highlighting each line as
  2324. it proceeds.  %@NL@%
  2325. %@NL@%
  2326. %@NL@%
  2327. %@3@%%@CR:C6A00030019 @%%@AB@%Running IO.C%@AE@%%@EH@%%@NL@%
  2328. %@NL@%
  2329. To demonstrate some of these commands with the IO.C program, make the source
  2330. window active by pressing F6 or by clicking its title bar, then choose the
  2331. Restart command from the Run menu. This command clears memory and prepares
  2332. the program to start execution at the first line of %@AS@% main%@AE@%.  %@NL@%
  2333. %@NL@%
  2334. Press F5 or select the Go button at the bottom of the screen to start the
  2335. program. The program executes until it reaches the breakpoint set at the %@AS@%
  2336. %@AS@%sample %@AE@% function.  %@NL@%
  2337. %@NL@%
  2338. Use F10 or the Step button to execute each statement until you come to the %@AS@%
  2339. %@AS@%outsider %@AE@% function. If you press F8 or the Trace button at the %@AS@% outsider %@AE@%
  2340. function, CodeView traces through each statement of the function. If you use
  2341. the Step button or F10, CodeView executes the function without tracing
  2342. through it and moves on to the next program statement.  %@NL@%
  2343. %@NL@%
  2344. Continue stepping through the program until you reach the %@AS@% gets ( date ) %@AE@%
  2345. statement. Press F10; CodeView switches to the output screen and prompts you
  2346. to enter a date. Type today's date and press ENTER. CodeView regains control
  2347. and moves to the next statement.  %@NL@%
  2348. %@NL@%
  2349. Since %@AS@% date %@AE@% was set as a watch variable and now contains data, use the
  2350. mouse or press F6 to make the watch window active. Move the cursor to %@AS@% date %@AE@%
  2351. and press ENTER. This expands the display of the array and shows all of the
  2352. elements. Press ENTER again while the cursor is on %@AS@% date %@AE@% to contract the
  2353. array.  %@NL@%
  2354. %@NL@%
  2355. Because %@AS@% date %@AE@% is also a local variable, it is shown in the local window
  2356. with all variables local to the current function. You can expand or contract
  2357. data in the local and the watch windows .  %@NL@%
  2358. %@NL@%
  2359. Another way to view the contents of %@AS@% date %@AE@% is to put the cursor on it in the
  2360. CodeView source window and choose QuickWatch from the Watch menu. The %@AS@% date %@AE@%
  2361. variable is immediately displayed in its expanded form. Press ENTER or click
  2362. the OK button to leave the dialog box.  %@NL@%
  2363. %@NL@%
  2364. Press F10 to finish stepping through the program. A dialog box informs you
  2365. that the program has completed execution normally. Press ENTER to clear the
  2366. dialog box and complete your debugging session.  %@NL@%
  2367. %@NL@%
  2368. %@NL@%
  2369. %@3@%%@CR:C6A00030020 @%%@AB@%Debugging IO.C%@AE@%%@EH@%%@NL@%
  2370. %@NL@%
  2371. To see how CodeView deals with a bug in a program, use the Exit command in
  2372. the File menu to return to PWB, then add this function to the IO.C program,
  2373. and call it from %@AS@% main%@AE@%:  %@NL@%
  2374. %@NL@%
  2375. %@AS@%  void bounds_error(void)
  2376. %@AS@%  {
  2377. %@AS@%     int loop, the_num[10];
  2378. %@AS@%  
  2379. %@AS@%     for(loop = 0; loop < 15; loop++)
  2380. %@AS@%        the_num[loop] = loop; }%@AE@%%@NL@%
  2381. %@NL@%
  2382. Set the appropriate debug options, rebuild the program, and return to
  2383. CodeView.  %@NL@%
  2384. %@NL@%
  2385. Use the F8 Trace command to execute the program. The program runs until it
  2386. reaches the %@AS@% for %@AE@% statement in the %@AS@% bounds_error %@AE@% function, where the array
  2387. bounds are exceeded. The output window reports an error while a CodeView
  2388. dialog box indicates the program has terminated. At this point you can
  2389. return to PWB, locate the error, and correct it.  %@NL@%
  2390. %@NL@%
  2391. %@NL@%
  2392. %@2@%%@CR:C6A00030021 @%%@AB@%Getting More Details%@AE@%%@EH@%%@NL@%
  2393. %@NL@%
  2394. PWB, the compiler, the linker, NMAKE, and CodeView all have other features
  2395. and options that go beyond the scope of this introduction.  %@NL@%
  2396. %@NL@%
  2397. Refer to %@AI@%Advanced Programming Techniques%@AE@% for information about PWB, NMAKE,
  2398. CodeView, and other tools, and the %@AI@%C Reference%@AE@% for a comprehensive listing
  2399. of all commands and options for the applications included with Microsoft C.
  2400. %@NL@%
  2401. %@NL@%
  2402. In addition, information about any component of the Professional Development
  2403. System can be accessed through the Microsoft Advisor reference system. For a
  2404. complete discussion of the on-line reference, see Chapter 4.  %@NL@%
  2405. %@NL@%
  2406. %@NL@%
  2407. %@NL@%
  2408. %@NL@%
  2409. %@NL@%
  2410. %@NL@%
  2411. %@CR:C6A00040001 @%%@1@%%@AB@%Chapter 4  Using the On-Line Reference%@AE@%%@EH@%%@NL@%
  2412. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  2413. %@NL@%
  2414. Microsoft C offers two types of on-line reference systems:  %@NL@%
  2415. %@NL@%
  2416. %@NL@%
  2417.   ■   The Microsoft Advisor, found within the Programmer's WorkBench (PWB)
  2418.       and CodeView environments.%@NL@%
  2419. %@NL@%
  2420.   ■   The QuickHelp program, accessed from the OS/2 or DOS command line.%@NL@%
  2421. %@NL@%
  2422. %@NL@%
  2423. Both systems provide the same information on important C topics and
  2424. utilities provided with the Professional Development System, which include
  2425. the C language, run-time libraries, CodeView, and PWB.  %@NL@%
  2426. %@NL@%
  2427. The first section of this chapter, "Structure of the Microsoft Advisor,"
  2428. outlines the structure and contents of the on-line reference database. The
  2429. second section, "Navigating Through the Microsoft Advisor," takes you on a
  2430. quick tour of the system. The third section, "Using QuickHelp," explains how
  2431. to use the QuickHelp program and how it differs from the Microsoft Advisor.
  2432. %@NL@%
  2433. %@NL@%
  2434. %@NL@%
  2435. %@2@%%@CR:C6A00040002 @%%@AB@%Structure of the Microsoft Advisor%@AE@%%@EH@%%@NL@%
  2436. %@NL@%
  2437. The Microsoft Advisor can be compared to a librarian managing a collection
  2438. of books. Each book, or help file, has its own table of contents, index, and
  2439. pages of information. The Advisor organizes the help files with a global
  2440. contents and index. All of the files are listed, and their specific tables
  2441. of contents and indexes can be accessed through the global references. The
  2442. global contents screen is shown in Figure 4.1.  %@NL@%
  2443. %@NL@%
  2444. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2445. %@NL@%
  2446. You can access a variety of information from the on-line reference system.
  2447. Information regarding the C language, run-time libraries, errors, and the
  2448. reference system itself is available.  %@NL@%
  2449. %@NL@%
  2450. %@NL@%
  2451. %@2@%%@CR:C6A00040003 @%%@AB@%Navigating Through the Microsoft Advisor%@AE@%%@EH@%%@NL@%
  2452. %@NL@%
  2453. You request information about a topic in a window by positioning the cursor
  2454. over it and pressing F1 or clicking the Right mouse button once. The help
  2455. system then searches through the help files for information about the topic.
  2456. If it finds the topic, the help system displays information in the help
  2457. window. If help cannot be found for a particular word or symbol, a message
  2458. informs you that no information is associated with the topic. Sometimes, a
  2459. topic with the same name occurs in several help files. In such cases, a
  2460. dialog box is displayed in which you can select the context of the topic.  %@NL@%
  2461. %@NL@%
  2462. %@NL@%
  2463. %@3@%%@CR:C6A00040004 @%%@AB@%Using the Help Menu%@AE@%%@EH@%%@NL@%
  2464. %@NL@%
  2465. The simplest method for accessing the on-line reference is by using the
  2466. commands found in the Help menu. All of these commands present information
  2467. in the Help window.  %@NL@%
  2468. %@NL@%
  2469. %@AB@%Command%@AE@%                           %@AB@%Description%@AE@%
  2470. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  2471. Index                             Displays the global index of help-file 
  2472.                                   categories (see Figure 4.2).
  2473.  
  2474. Contents                          Displays the global contents screen for 
  2475.                                   the categories found in the help files.
  2476.  
  2477. Topic:                            Provides information about the topic 
  2478.                                   that the cursor is currently positioned 
  2479.                                   over. If information about the topic is 
  2480.                                   available, the topic's name is appended 
  2481.                                   to the Topic: command. Otherwise, this 
  2482.                                   menu option is grayed.
  2483.  
  2484. Help on Help                      Displays information about using the 
  2485.                                   on-line reference itself.
  2486.  
  2487. Next                              Is useful if a topic with the same name 
  2488.                                   appears in more than one help file. This
  2489.                                   option locates the next occurrence of 
  2490.                                   the topic name and displays the 
  2491.                                   information associated with it.
  2492.  
  2493. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2494. %@NL@%
  2495. %@NL@%
  2496. %@3@%%@CR:C6A00040005 @%%@AB@%Using the F1 Key%@AE@%%@EH@%%@NL@%
  2497. %@NL@%
  2498. You can use the F1 key to get information about any menu command or PWB
  2499. dialog box, as well as information on C keywords, operators, and run-time
  2500. library functions.  %@NL@%
  2501. %@NL@%
  2502. %@NL@%
  2503. %@4@%%@AB@%Menu Help%@AE@%%@EH@%%@NL@%
  2504. %@NL@%
  2505. To view information about a menu item, first pull down the menu, then  %@NL@%
  2506. %@NL@%
  2507. %@NL@%
  2508.   ■   Use the cursor keys to highlight the command, and press F1, or%@NL@%
  2509. %@NL@%
  2510.   ■   Move the mouse cursor on the command and click the Right mouse button%@NL@%
  2511. %@NL@%
  2512. %@NL@%
  2513. Figure 4.3 shows the help information for the Cut command in the Edit menu.
  2514. %@NL@%
  2515. %@NL@%
  2516. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2517. %@NL@%
  2518. %@NL@%
  2519. %@4@%%@AB@%Keyword and Library-Function Help%@AE@%%@EH@%%@NL@%
  2520. %@NL@%
  2521. To view information about a C keyword, operator, or run-time library
  2522. function,  %@NL@%
  2523. %@NL@%
  2524. %@NL@%
  2525.   ■   Put the cursor on the keyword or function name, and press F1, or%@NL@%
  2526. %@NL@%
  2527.   ■   Click the command with the Right mouse button%@NL@%
  2528. %@NL@%
  2529. %@NL@%
  2530. %@NL@%
  2531. %@4@%%@AB@%Dialog-Box Help%@AE@%%@EH@%%@NL@%
  2532. %@NL@%
  2533. To view information about a PWB dialog box, simply press F1 while the dialog
  2534. box is displayed, or click on the help button.  %@NL@%
  2535. %@NL@%
  2536. %@NL@%
  2537. %@3@%%@CR:C6A00040006 @%%@AB@%Using Hyperlinks%@AE@%%@EH@%%@NL@%
  2538. %@NL@%
  2539. Hyperlinks are cross-references that connect related topic information.  %@NL@%
  2540. %@NL@%
  2541. Hyperlinks enclosed by the < and > characters are called "buttons." Navigate
  2542. through the on-line help system by using these buttons.  %@NL@%
  2543. %@NL@%
  2544. You can press TAB to move to the next hyperlink button within the current
  2545. help window. SHIFT+TAB moves back to the previous button. Typing any letter
  2546. moves the cursor to the next button that begins with the letter; holding
  2547. SHIFT down and typing a letter moves the cursor backward.  %@NL@%
  2548. %@NL@%
  2549. The Microsoft Advisor also recognizes C keywords, library functions,
  2550. constants defined by Microsoft C, and similar identifiers as hyperlinks, but
  2551. they are unmarked hyperlinks. Unmarked hyperlinks are recognized by the
  2552. Microsoft Advisor wherever they appear in the help-information text or %@AI@%in
  2553. %@AI@%your source code%@AE@%. However, an unmarked hyperlink is not delimited with the <
  2554. and > characters, and you can't move to it with the TAB key. An unmarked
  2555. hyperlink can only be executed by placing the cursor on it and pressing F1,
  2556. or pointing to it with the mouse cursor and clicking the Right mouse button.
  2557. %@NL@%
  2558. %@NL@%
  2559. You can access a hyperlink in several ways. First move either the mouse or
  2560. text cursor to a hyperlink, then either  %@NL@%
  2561. %@NL@%
  2562. %@NL@%
  2563.   ■   Press F1%@NL@%
  2564. %@NL@%
  2565.   ■   Click the Right mouse button%@NL@%
  2566. %@NL@%
  2567.   ■   Click the Left mouse button twice (double-click)%@NL@%
  2568. %@NL@%
  2569. %@NL@%
  2570. Highlighted button hyperlinks can also be executed by pressing ENTER or
  2571. SPACEBAR.  %@NL@%
  2572. %@NL@%
  2573. Any of these actions displays information about the topic the cursor is
  2574. positioned on. If the topic isn't a hyperlink, a message informs you that no
  2575. information on the topic could be found.  %@NL@%
  2576. %@NL@%
  2577. ────────────────────────────────────────────────────────────────────────────%@NL@%
  2578. NOTE
  2579.  
  2580. %@AI@%CodeView uses the Right mouse button differently in the source window.
  2581. %@AI@%Clicking the Right button in the source window executes the program to the
  2582. %@AI@%line the mouse was clicked on. However, once the help window is displayed,
  2583. %@AI@%the Right mouse button can be used to select hyperlinks.%@AE@%%@NL@%
  2584. ────────────────────────────────────────────────────────────────────────────%@NL@%%@NL@%
  2585. %@NL@%
  2586. %@NL@%
  2587. %@3@%%@CR:C6A00040007 @%%@AB@%Using Help Windows and Dialog Boxes%@AE@%%@EH@%%@NL@%
  2588. %@NL@%
  2589. The Microsoft Advisor displays information in windows or dialog boxes. Help
  2590. windows and dialog boxes function the same as other windows and dialog boxes
  2591. found in PWB and CodeView. For a complete description of windows and dialog
  2592. boxes, refer to Chapter 3, "Using the Programmer's WorkBench."  %@NL@%
  2593. %@NL@%
  2594. %@NL@%
  2595. %@4@%%@AB@%Using the Help Window%@AE@%%@EH@%%@NL@%
  2596. %@NL@%
  2597. The help window displays various contents, indexes, and information about
  2598. selected topics. Some screens of information are larger than the help
  2599. window; information beyond the window borders can be viewed by using the
  2600. scroll bars or the cursor-movement keys. The  - u -  symbol indicates the
  2601. end of information in the help window.  %@NL@%
  2602. %@NL@%
  2603. %@AB@%Navigating with Hyperlink Buttons%@AE@% - At the top of the help window is a row
  2604. of buttons that are useful for moving through the reference system:  %@NL@%
  2605. %@NL@%
  2606. %@AB@%Button%@AE@%                            %@AB@%Description%@AE@%
  2607. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  2608. < Up >                            Moves upward in the hierarchy of help 
  2609.                                   screens. Since information is ordered in
  2610.                                   a logical way, moving from the general 
  2611.                                   to the specific, this command is useful 
  2612.                                   for moving up the information tree.
  2613.  
  2614. < Contents >                      Displays the global contents screen. 
  2615.                                   This command is useful because it always
  2616.                                   returns you to a known point in the 
  2617.                                   on-line help system hierarchy.
  2618.  
  2619. < Index >                         Displays the global index list. 
  2620.                                   Selecting an item from the list displays
  2621.                                   the index for that category.
  2622.  
  2623. < Back >                          Moves you to the last on-line help 
  2624.                                   screen you saw.
  2625.  
  2626. Screens on a particular topic frequently are physically grouped together in
  2627. a help file. You can press CTRL+F1 to display information about the next
  2628. physical topic in the help file.  %@NL@%
  2629. %@NL@%
  2630. %@AB@%Viewing the Previous Help Screen%@AE@% - The Microsoft Advisor remembers the last
  2631. 20 help screens you've accessed. To return to a previous screen, use the <
  2632. Back > button or hold down the ALT key and press F1 as many times as
  2633. necessary to return to the screen you want to see. The help screen that
  2634. appears is active; you can ask for help on any of its hyperlinks or topics.
  2635. %@NL@%
  2636. %@NL@%
  2637. You can always return to the global contents screen by pressing SHIFT+F1.  %@NL@%
  2638. %@NL@%
  2639. %@AB@%Copying and Pasting Help Information%@AE@% - Any text that appears in the help
  2640. window can easily be copied to another window. For example, to test an
  2641. example program from the help window, you only have to copy it to the source
  2642. window and compile it.  %@NL@%
  2643. %@NL@%
  2644. To copy and paste using the keyboard, follow these steps:  %@NL@%
  2645. %@NL@%
  2646. %@NL@%
  2647.   1.  Move the cursor to the beginning or the end of the text you want to
  2648.       select. Hold down the SHIFT key and move the cursor to the other end
  2649.       of the text. The text is now highlighted.%@NL@%
  2650. %@NL@%
  2651.   2.  Execute the Copy command: Press ALT to activate the menus, E for Edit,
  2652.       then C for Copy. Note that the menu lists the shortcut command
  2653.       (CTRL+INS), which can be substituted for ALT+E, then C.%@NL@%
  2654. %@NL@%
  2655.   3.  Press F6 to switch to another window. Position the cursor where you
  2656.       want to insert the text, and execute the Paste command: ALT+E then P,
  2657.       or use the SHIFT+INS shortcut. The text from the help window is
  2658.       inserted at the current cursor position.%@NL@%
  2659. %@NL@%
  2660. %@NL@%
  2661. To copy and paste using the mouse, follow these steps:  %@NL@%
  2662. %@NL@%
  2663. %@NL@%
  2664.   1.  Click the Left mouse button and drag the cursor (hold down the button
  2665.       while moving the mouse) to select the text you want to copy.%@NL@%
  2666. %@NL@%
  2667.   2.  Choose Copy from the Edit menu (or press CTRL+INS).%@NL@%
  2668. %@NL@%
  2669.   3.  Move the mouse cursor to the location where you want to insert the
  2670.       text, and click once. Then choose Paste from the Edit menu. The text
  2671.       from the help window is inserted at the current cursor position.%@NL@%
  2672. %@NL@%
  2673. %@NL@%
  2674. %@AB@%Closing the Help Window%@AE@% - Once you're through working with the reference
  2675. system, you can close the active help window and return to the source window
  2676. by  %@NL@%
  2677. %@NL@%
  2678. %@NL@%
  2679.   ■   Pressing ESC%@NL@%
  2680. %@NL@%
  2681.   ■   Clicking the Close button in the upper left corner of the window with
  2682.       the Left mouse button%@NL@%
  2683. %@NL@%
  2684. %@NL@%
  2685. %@NL@%
  2686. %@4@%%@AB@%Using Help Dialog Boxes%@AE@%%@EH@%%@NL@%
  2687. %@NL@%
  2688. Help dialog boxes contain information about menu commands and their dialog
  2689. boxes. A help dialog box differs from a help window in that it is displayed
  2690. over the source window and any other windows that are displayed. Unlike the
  2691. help window, a help dialog box must be closed before you can execute any
  2692. menu commands. The Cancel button in the lower right portion of the dialog
  2693. box closes the help dialog box.  %@NL@%
  2694. %@NL@%
  2695. To view information about any PWB dialog box, you can  %@NL@%
  2696. %@NL@%
  2697. %@NL@%
  2698.   ■   Press F1%@NL@%
  2699. %@NL@%
  2700.   ■   Click the Help button in the dialog box with the Left mouse button%@NL@%
  2701. %@NL@%
  2702. %@NL@%
  2703. Either of these commands causes a help dialog box to appear. To close a help
  2704. dialog box,  %@NL@%
  2705. %@NL@%
  2706. %@NL@%
  2707.   ■   Press ESC%@NL@%
  2708. %@NL@%
  2709.   ■   Click the dialog box's Cancel button by using the Left mouse button%@NL@%
  2710. %@NL@%
  2711. %@NL@%
  2712. %@NL@%
  2713. %@3@%%@CR:C6A00040008 @%%@AB@%Accessing Different Types of Information%@AE@%%@EH@%%@NL@%
  2714. %@NL@%
  2715. This section presents some strategies for accessing the different types of
  2716. information available within the on-line reference system.  %@NL@%
  2717. %@NL@%
  2718. %@NL@%
  2719. %@4@%%@AB@%Keyword Information%@AE@%%@EH@%%@NL@%
  2720. %@NL@%
  2721. To get information about any keyword, operator, symbolic constant, or
  2722. library function, display the appropriate index for the keyword, select the
  2723. keyword's first letter from the index, then scroll down the list of entries
  2724. and select the topic's hyperlink. If you know the exact name of a keyword,
  2725. it is often quicker to simply type it in the source window and press F1 to
  2726. locate it through an index.  %@NL@%
  2727. %@NL@%
  2728. Information about keywords can also be viewed by using the %@AB@%arg%@AE@% command and
  2729. entering the keyword with F1 in the %@AB@%arg%@AE@% command dialog box. Assuming that
  2730. you have the %@AB@%arg%@AE@% function assigned to %@AS@% alt+a%@AE@%, the following series of
  2731. keystrokes displays help on the %@AB@%printf%@AE@% function:  %@NL@%
  2732. %@NL@%
  2733. %@AS@%  alt+a printf F1%@AE@%%@NL@%
  2734. %@NL@%
  2735. Figure 4.4 shows the information screen that then appears.  %@NL@%
  2736. %@NL@%
  2737. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2738. %@NL@%
  2739. When information about a function is shown in the help window, two
  2740. additional hyperlink buttons are displayed.  %@NL@%
  2741. %@NL@%
  2742. %@NL@%
  2743.   ■   < Description > provides a detailed explanation of the function. When
  2744.       the information is displayed, the button changes to < Summary >. Click
  2745.       this button to return to the summarized information about the
  2746.       function.%@NL@%
  2747. %@NL@%
  2748.   ■   < Example > displays C source code that provides an example of how the
  2749.       function is used.%@NL@%
  2750. %@NL@%
  2751. %@NL@%
  2752. %@NL@%
  2753. %@4@%%@AB@%Topical Information%@AE@%%@EH@%%@NL@%
  2754. %@NL@%
  2755. The on-line reference system is useful when you want an overview of the
  2756. available reference topics, or when you only have a general idea of what
  2757. information you need. Start with the global contents screen, then select any
  2758. hyperlinks that relate to the topic. You can traverse the hyperlinks until
  2759. you locate the necessary information.  %@NL@%
  2760. %@NL@%
  2761. %@NL@%
  2762. %@4@%%@AB@%Menu and Dialog-Box Information%@AE@%%@EH@%%@NL@%
  2763. %@NL@%
  2764. You can get information about any menu command or dialog box by pressing F1
  2765. when the menu command is highlighted or the dialog box is displayed. This is
  2766. helpful when you are first learning to use the Professional Development
  2767. System and are not completely familiar with all of the features.  %@NL@%
  2768. %@NL@%
  2769. %@NL@%
  2770. %@4@%%@AB@%Error Information%@AE@%%@EH@%%@NL@%
  2771. %@NL@%
  2772. The Microsoft Advisor provides information about compiler and linker error
  2773. messages.  %@NL@%
  2774. %@NL@%
  2775. To find the meaning of an error message using the keyboard,  %@NL@%
  2776. %@NL@%
  2777. %@NL@%
  2778.   1.  Press F6 to move the cursor to the error window%@NL@%
  2779. %@NL@%
  2780.   2.  Position the cursor on the error number%@NL@%
  2781. %@NL@%
  2782.   3.  Press F1%@NL@%
  2783. %@NL@%
  2784. %@NL@%
  2785. or with the mouse,  %@NL@%
  2786. %@NL@%
  2787. %@NL@%
  2788.   1.  Position the mouse cursor on the error number%@NL@%
  2789. %@NL@%
  2790.   2.  Click the Right mouse button%@NL@%
  2791. %@NL@%
  2792. %@NL@%
  2793. Help on error messages is also available directly from the PWB source window
  2794. by entering the %@AB@%arg%@AE@% command with the error number and its alphabetic prefix,
  2795. and then pressing F1.  %@NL@%
  2796. %@NL@%
  2797. %@NL@%
  2798. %@3@%%@CR:C6A00040009 @%%@AB@%Specifying Temporary Help Files%@AE@%%@EH@%%@NL@%
  2799. %@NL@%
  2800. You can temporarily load other help files using the Environment command in
  2801. the PWB Options menu. The Microsoft Advisor searches help files you specify
  2802. in this text box before it searches the standard Development System help
  2803. files as specified by the HELPFILES environment variable. Use the help files
  2804. text box to override (for the current session only) the help-file path
  2805. defined in the HELPFILES variable. When programming with mixed languages,
  2806. you may want to temporarily load the help files for each of the languages
  2807. you're using.  %@NL@%
  2808. %@NL@%
  2809. %@NL@%
  2810. %@2@%%@CR:C6A00040010 @%%@AB@%Using QuickHelp%@AE@%%@EH@%%@NL@%
  2811. %@NL@%
  2812. QuickHelp is a separate application that provides access to any help file.
  2813. It uses the same help files as the Microsoft Advisor, and presents
  2814. information about topics in the same way. QuickHelp is designed for the
  2815. developer who prefers using command-line utilities or another editor, and
  2816. doesn't have access to the Microsoft Advisor through PWB.  %@NL@%
  2817. %@NL@%
  2818. Major utilities and applications that come with the Microsoft C package
  2819. invoke QuickHelp and display related information if you use the /HELP
  2820. switch. You can also use QuickHelp from the command line, as explained in
  2821. the following sections. Once you are in the QuickHelp program, select which
  2822. help file you want to view.  %@NL@%
  2823. %@NL@%
  2824. %@NL@%
  2825. %@3@%%@CR:C6A00040011 @%%@AB@%Using the /HELP Switch%@AE@%%@EH@%%@NL@%
  2826. %@NL@%
  2827. You can get immediate information on major components of Microsoft C by
  2828. using the /HELP switch.  %@NL@%
  2829. %@NL@%
  2830. For example, to learn about the LIB utility, enter  %@NL@%
  2831. %@NL@%
  2832. %@AS@%  LIB /HELP%@AE@%%@NL@%
  2833. %@NL@%
  2834. QuickHelp will run and immediately display information about LIB.  %@NL@%
  2835. %@NL@%
  2836. %@NL@%
  2837. %@3@%%@CR:C6A00040012 @%%@AB@%Using the QH Command%@AE@%%@EH@%%@NL@%
  2838. %@NL@%
  2839. You can also run QuickHelp by typing QH at the DOS or OS/2 command line.
  2840. Specify an application to get help about, such as  %@NL@%
  2841. %@NL@%
  2842. %@AS@%  QH LIB.EXE%@AE@%%@NL@%
  2843. %@NL@%
  2844. In addition to information about programs, QuickHelp can also display
  2845. information about run-time errors. You can type the error number with its
  2846. alphabetic prefix after the QH command at the DOS or OS/2 command line.  %@NL@%
  2847. %@NL@%
  2848. %@NL@%
  2849. %@4@%%@AB@%Opening and Closing Help Files%@AE@%%@EH@%%@NL@%
  2850. %@NL@%
  2851. If no file name is specified when QuickHelp is run, it looks for the
  2852. environment variable HELPFILES, and opens all listed .HLP files. If the
  2853. HELPFILES variable isn't present, all .HLP files in directories specified by
  2854. the PATH environment variable are loaded.  %@NL@%
  2855. %@NL@%
  2856. Choose the List Database command on the File menu to view a list of all the
  2857. currently open help files.  %@NL@%
  2858. %@NL@%
  2859. To open additional help files,  %@NL@%
  2860. %@NL@%
  2861. %@NL@%
  2862.   ■   Choose the Open Database command from the File menu.%@NL@%
  2863. %@NL@%
  2864.   ■   Type the fully qualified path name of the help file to be opened in
  2865.       the dialog box that appears. You can specify all help files in a
  2866.       directory with *.HLP.%@NL@%
  2867. %@NL@%
  2868.   ■   Press ENTER or click the OK button with the Left mouse button.%@NL@%
  2869. %@NL@%
  2870. %@NL@%
  2871. To close an open help file,  %@NL@%
  2872. %@NL@%
  2873. %@NL@%
  2874.   ■   Choose the Close Database command from the File menu.%@NL@%
  2875. %@NL@%
  2876.   ■   Use the mouse or keyboard to select which help file you would like to
  2877.       close from the list of help files displayed in the menu%@NL@%
  2878. %@NL@%
  2879. %@NL@%
  2880. %@NL@%
  2881. %@4@%%@AB@%Displaying a Topic%@AE@%%@EH@%%@NL@%
  2882. %@NL@%
  2883. You can view information about a topic by using the Search command in the
  2884. View menu. When topic information is displayed, it is shown in the same
  2885. format as information presented by the Microsoft Advisor.  %@NL@%
  2886. %@NL@%
  2887. To display a topic from any of the open help files,  %@NL@%
  2888. %@NL@%
  2889. %@NL@%
  2890.   ■   Choose the Search command from the View menu%@NL@%
  2891. %@NL@%
  2892.   ■   Type the topic you want information about in the Search dialog box
  2893.       (the search is not case sensitive)%@NL@%
  2894. %@NL@%
  2895.   ■   Press ENTER or click the OK button with the Left mouse button%@NL@%
  2896. %@NL@%
  2897. %@NL@%
  2898. QuickHelp begins searching for the topic in the open help files. If the
  2899. topic cannot be found, a dialog box informs you that the search failed. If
  2900. the search is successful, information about the topic is displayed in the
  2901. QuickHelp window.  %@NL@%
  2902. %@NL@%
  2903. %@NL@%
  2904. %@4@%%@AB@%Navigating Through Topics%@AE@%%@EH@%%@NL@%
  2905. %@NL@%
  2906. A series of commands on the View menu allow you to selectively display
  2907. topics. These commands include the following:  %@NL@%
  2908. %@NL@%
  2909. %@AB@%Command%@AE@%                           %@AB@%Description%@AE@%
  2910. %@AB@%────────────────────────────────────────────────────────────────────────────%@AE@%%@NL@%
  2911. View History                      Displays a list of all the topics that 
  2912.                                   have recently been displayed. You can 
  2913.                                   view a topic in the list by selecting it
  2914.                                   and clicking the Right mouse button or 
  2915.                                   pressing ENTER.
  2916.  
  2917. View Last                         Displays the last topic you looked at.
  2918.  
  2919. View Back                         Moves backward one topic in the help 
  2920.                                   file.
  2921.  
  2922. View Next                         Displays the next topic in the help 
  2923.                                   file.
  2924.  
  2925. %@NL@%
  2926. %@4@%%@AB@%Using the QuickHelp Window%@AE@%%@EH@%%@NL@%
  2927. %@NL@%
  2928. The QuickHelp window (see Figure 4.5) is similar in function to the
  2929. Microsoft Advisor help window, described earlier in this chapter.
  2930. Information that doesn't fully fit in a window can be scrolled, and
  2931. hyperlinks are used to display additional information.  %@NL@%
  2932. %@NL@%
  2933. %@AU@%(This figure may be found in the printed book).%@AE@%%@NL@%
  2934. %@NL@%
  2935. The main differences between the two windows are  %@NL@%
  2936. %@NL@%
  2937. %@NL@%
  2938.   ■   Information presented in QuickHelp cannot selectively be copied. See
  2939.       the section "Copying and Pasting in QuickHelp" that follows for more
  2940.       information.%@NL@%
  2941. %@NL@%
  2942.   ■   The QuickHelp window cannot be closed.%@NL@%
  2943. %@NL@%
  2944.   ■   Any information that appears on the screen can be sent to a printer by
  2945.       using the Print command in the File menu.%@NL@%
  2946. %@NL@%
  2947. %@NL@%
  2948. %@NL@%
  2949. %@4@%%@AB@%Copying and Pasting in QuickHelp%@AE@%%@EH@%%@NL@%
  2950. %@NL@%
  2951. In order to transfer information, you must first specify a new file with the
  2952. Rename Paste File command in the File menu. Once the file is specified,
  2953. choose either the Current Window or the Current Topic command in the Paste
  2954. menu to transfer the text to that file. Be sure to specify a new file when
  2955. you paste, since QuickHelp overwrites text in an existing file.  %@NL@%
  2956. %@NL@%
  2957. %@NL@%
  2958. %@4@%%@AB@%More About QuickHelp%@AE@%%@EH@%%@NL@%
  2959. %@NL@%
  2960. In addition to the features mentioned above, QuickHelp has a variety of
  2961. other options such as changing the appearance of the help window, searching
  2962. for text within topics, and controlling the function of the Right mouse
  2963. button.  %@NL@%
  2964. %@NL@%
  2965. To learn more about QuickHelp's features, make sure the QH.HLP file is
  2966. loaded, then do one of the following:  %@NL@%
  2967. %@NL@%
  2968. %@NL@%
  2969.   ■   Press F1 to view QuickHelp's on-line reference%@NL@%
  2970. %@NL@%
  2971.   ■   Choose a menu command and press F1 or click the Right mouse button to
  2972.       get information about it%@NL@%
  2973. %@NL@%
  2974.   ■   Refer to the %@AI@%C Reference%@AE@% guide for a list of QuickHelp options%@NL@%
  2975. %@NL@%
  2976. %@NL@%
  2977. %@NL@%
  2978. %@NL@%
  2979.