home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 15 / CD_ASCQ_15_070894.iso / vrac / pwrpak.zip / PWRPAK.TXT < prev    next >
Text File  |  1994-05-19  |  21KB  |  542 lines

  1.  
  2.  
  3.  
  4.  
  5. Borland PowerPack for DOS 
  6. Version 1.0 
  7. Evaluator's Guide 
  8.  
  9.  
  10.  
  11.  
  12.       
  13.  
  14.  
  15. PART 1 
  16. Introduction 
  17.  
  18. About this guide 
  19. Welcome to the Borland PowerPack for DOS evaluator's guide.  The Borland 
  20. PowerPack for DOS is a complete suite of DOS development tools and 
  21. libraries designed to work with Borland C+ 4.0.  The purpose of this 
  22. guide is to provide an understanding of the features and benefits found 
  23. in this powerful new product.   
  24.  
  25. Part 2, Introducing Borland PowerPack for DOS, provides a capsule 
  26. summary of the features and benefits of the product. 
  27.  
  28. Part 3, Borland PowerPack for DOS In Depth, provides greater detail 
  29. about  product features and components.  
  30.  
  31. Part 4 provides information on hardware and software requirements, as 
  32. well as installation and storage requirements. 
  33.  
  34.  
  35.  
  36. PART 2 
  37. Introducing Borland PowerPack for DOS 
  38.  
  39. The Borland PowerPack for DOS provides several important features for 
  40. DOS developers: 
  41.       
  42. +     royalty free 16 and 32-bit DOS Extenders 
  43. +     more application memory 
  44. +     faster application performance 
  45. +     code reuse through DOS DLLs 
  46. +     16- and 32-bit Borland Graphics Interface libraries 
  47. +     support for the newest super vga video cards 
  48. +     16- and 32-bit Turbo Vision libraries 
  49. +     data validation classes 
  50. +     outline viewer object 
  51.  
  52. In addition to developing for graphical environments such as Windows and 
  53. OS/2, most programmers continue to develop and maintain DOS applications 
  54. as well.  The reason is simple.  DOS has by far the largest installed 
  55. base of any operating system, and will continue to sell well into the 
  56. foreseeable future.  In fact, recent surveys have indicated that one out 
  57. of every five personal computers sold this year will be installed with 
  58. DOS only.  Clearly, DOS will continue to represent a substantial market 
  59. opportunity for some time to come. 
  60.  
  61. Despite its tremendous success, DOS has some serious limitations.  Most 
  62. notable is the fact that DOS relies on the 16-bit segmented memory 
  63. architecture used by the Intel 8086 microprocessor.  Newer 
  64. microprocessors such as the 80386 and 80486 must emulate this 
  65. architecture to run DOS.  The 8086 architecture limits the range of 
  66. addressable memory to 1MB.  Even worse, by default DOS applications can 
  67. access only the first 640K bytes of this memory.  The remaining 384K is 
  68. used by the system for video memory, the BIOS, and as ROM for expansion 
  69. cards.  Although the majority of personal computers sold today contain 
  70. four or more megabytes of RAM memory, this additional memory is unable 
  71. to be addressed without substantial effort.  As DOS applications 
  72. increase in complexity, developers are finding the memory limitations of 
  73. DOS to be unacceptable. 
  74.  
  75. The best solution to this problem is a DOS Extender.  A DOS Extender 
  76. utilizes the advanced features of 80286 and newer microprocessors to 
  77. allow transparent access to all machine memory.  An application that 
  78. manipulates a pointer to memory need not worry whether this memory was 
  79. allocated above the 1MB limit or below it.  Further, a DOS Extender 
  80. still allows access to DOS and BIOS calls, interrupt handlers, and other 
  81. low-level techniques common in today's software. 
  82.  
  83. The Borland PowerPack for DOS contains a powerful set of development 
  84. tools and libraries for the DOS developer.  Included are both a 16-bit 
  85. and a 32-bit DOS Extender which allow programmers to break through the 
  86. 640K barrier.  The 32-bit extender is for use with 80386 or better 
  87. microprocessors and allows access of up to 4GB of machine memory.  The 
  88. 16-bit extender is for use the 80286 or better microprocessors and 
  89. allows access of up to 16MB of machine memory.  As an added benefit, 
  90. both extenders enable dynamic link libraries (DLL's) to be shared 
  91. between DOS and Windows.  Applications written using the DOS Extenders 
  92. included in the PowerPack will work with any DPMI server that provides 
  93. .9 DPMI services or better. Also included in the product are 16 and 32-
  94. bit versions of the popular Borland Graphics Interface (BGI) library.  
  95. This library provides a complete set of functions for creating high 
  96. performance graphics applications.  In addition, the Borland PowerPack 
  97. for DOS includes 16 and 32-bit versions of the Turbo Vision 2.0 
  98. application framework for creating event-driven text mode interfaces for 
  99. DOS applications. 
  100.  
  101.  
  102.  
  103. Features and Benefits 
  104.  
  105. The Borland PowerPack for DOS makes it easy to unlock the power of 
  106. today's microprocessors.  With both 16 and 32-bit DOS Extenders, the 
  107. lightning fast BGI graphics library, and the Turbo Vision application 
  108. framework, the Borland PowerPack for DOS provides all of the necessary 
  109. tools for creating sophisticated DOS applications. 
  110.  
  111.  
  112. 16 and 32-bit DOS Extenders       
  113.  
  114. More DOS memory.  Applications built using the Borland PowerPack for DOS 
  115. break through the 640K memory barrier.  The 32-bit DOS Extender not only 
  116. increases the amount of addressable memory to 4GB, but makes 
  117. applications easier to develop by providing a flat address space.  
  118. Applications written with the 32-bit DOS Extender also show a dramatic 
  119. increase in performance since they run in a native 32-bit environment. 
  120. The 16-bit DOS Extender allows applications to access up to 16MB of 
  121. machine memory. 
  122.  
  123. Royalty free distribution.  The extenders included in the Borland 
  124. PowerPack for DOS are completely royalty free.  There are no licensing 
  125. or distribution fees.  Now every developer can take advantage of DOS 
  126. Extender technology. 
  127.  
  128. Increased code reuse through DOS DLLs.  The DLL technology found in the 
  129. Borland PowerPack for DOS allows developers to share DLLs between DOS 
  130. and Windows without recompiling.  DLL's written using the 16-bit DOS 
  131. Extender can be shared with Windows 3.1, while DLLs written using the 
  132. 32-bit DOS Extender can be shared with Windows NT and Chicago. 
  133.  
  134. Seamless integration into the Borland C++ 4.0 IDE.  The Borland 
  135. PowerPack for DOS integrates directly into the Borland C++ 4.0 
  136. environment, so there's no switching between different tools.  Using the 
  137. TargetExpert, a developer can select from between Windows, Windows NT, 
  138. DOS real mode, and DOS 16- or DOS 32-bit protected mode development with 
  139. a click of the mouse.  
  140.  
  141.  
  142.  
  143. Borland Graphics Interface       
  144.  
  145. 16 and 32-bit libraries.   The Borland PowerPack for DOS includes 16 and 
  146. 32-bit graphics libraries.  This allows programmers to add charts, 
  147. graphics, and animation to their protected mode applications. 
  148.  
  149. Extended graphics driver support.  The new 32-bit BGI library supports  
  150. more video cards and resolutions.  Supported video cards include TSENG, 
  151. PARADISE, VIDEO7, TRIDENT, and all S3 cards.  The 32-bit BGI library can 
  152. operate in resolutions as high as 1280x1024. 
  153.  
  154. High Performance.  The BGI libraries included in the Borland PowerPack 
  155. for DOS were written in assembly language to provide superior 
  156. performance.  Applications that use the 32-bit graphics libraries will 
  157. typically perform twice as fast as those that use the 16-bit graphics 
  158. libraries. 
  159.  
  160.  
  161. Turbo Vision 2.0 Framework       
  162.  
  163. 16- and 32-bit libraries. Turbo Vision 2.0 works in real mode and both 
  164. 16- and 32-bit protected mode.  This gives Turbo Vision 2.0 applications 
  165. megabytes of memory to work with. 
  166.  
  167. Data validation classes.  Using the validator objects makes it easy to 
  168. add data validation to any existing or new Turbo Vision applications.  
  169. Validator objects are connected to edit control objects to validate the 
  170. information a user types into an edit control.  For example, you can add 
  171. a use a validator to create an edit control that will only accept 
  172. numeric input. 
  173.  
  174. Outline viewer object.  The new outline viewer object presents data in a 
  175. hierarchical format, allowing users to incorporate sophisticated outline 
  176. displays in their applications. 
  177.  
  178.  
  179.  
  180.  
  181. PART 3 
  182. Borland PowerPack for DOS in Depth 
  183.  
  184.  
  185.  
  186. 16 and 32-bit DOS Extenders 
  187.  
  188. By allowing programmers to break through the 640K barrier, DOS Extenders 
  189. help unlock the power of todays microprocessors.  And with the flat 
  190. memory model provided by Borland's 32-bit extender, DOS programming 
  191. becomes easier than ever before. No longer do programmers have to worry 
  192. about near and far pointers or segment arithmetic.  Plus, developers get 
  193. the benefit of true 32-bit performance.   
  194.  
  195.  
  196. Compiling for protected mode      
  197.  
  198. Whether compiling from the command line, or using the Borland C++ 4.0 
  199. Integrated Development Environment (IDE), creating DOS extended 
  200. applications is easy.  You can easily recompile most existing real mode 
  201. applications to take advantage of Borland's DOS Extenders. 
  202.  
  203. When using the IDE, simply use the TargetExpert to select DOS 16-bit or 
  204. 32-bit DPMI targeting.  With a click of the mouse you can choose between 
  205. building a DOS extended application or a DOS DLL. 
  206.  
  207. Borland's command line compilers feature new switches to target DOS 
  208. extended applications.  For BCC.EXE these switches are: 
  209.  
  210.           -WX             DPMI16 EXE 
  211.           -WXD           DPMI16 DLL, all functions exported 
  212.           -WXDE          DPMI16 DLL, explicit functions exported 
  213.  
  214. and for BCC32.EXE these switches are: 
  215.  
  216.           -WX            DPMI32 EXE, all functions exported 
  217.           -WXD           DPMI32 DLL, all functions exported 
  218.           -WXDE          DPMI32 DLL, explicit functions exported 
  219.  
  220.  
  221.  
  222. Breaking the 640K barrier           
  223.       
  224. Programmers will exerience a dramatic increase in the memory available 
  225. for code and data when using DOS Extenders.   
  226.  
  227. The following program helps illustrate the additional memory available 
  228. to a DOS Extended application: 
  229.  
  230. #include <iostream.h> 
  231. #include <except.h> 
  232.  
  233. const BLOCK_SIZE = 4096; 
  234.  
  235. #pragma warn -aus 
  236. int main( void ) 
  237.      long totalRam = 0; 
  238.      char* p; 
  239.      try 
  240.      { 
  241.           for( ;; ) 
  242.           { 
  243.                p = new char[BLOCK_SIZE]; 
  244.                totalRam += BLOCK_SIZE; 
  245.           } 
  246.      } 
  247.      catch( xalloc) 
  248.      { 
  249.           cout << "Total memory allocated is " << totalRam <<  end; 
  250.      } 
  251.      return( 0 ); 
  252.  
  253. When compiled for real mode, the above program displays the following: 
  254.  
  255.      Total memory allocated is 417792  
  256.  
  257. This occurs even though the computer contains over 12 MB of RAM memory.  
  258. When running in real mode, applications must work within the 640K memory 
  259. barrier. 
  260.  
  261. When compiled for extended mode, the same program displays the 
  262. following: 
  263.  
  264.      Total memory allocated is 13012992 
  265.  
  266. If run from a DOS box in Windows, this program would be able to make use 
  267. of virtual memory allowing access to more memory that is physically 
  268. available.  
  269.  
  270.  
  271.  
  272. Compatibility           
  273.  
  274. Applications created using Borland's DOS Extenders are compatible with a 
  275. number of operating environments. Programs written using the 16-bit DOS 
  276. Extender run unmodified under DOS, Windows NT, Windows 3.1 DOS boxes, 
  277. Windows 3.11 DOS boxes and OS/2 2.x DOS boxes.  Programs written using 
  278. the 32-bit DOS Extender in general run under DOS, Windows NT, Windows 
  279. 3.1 DOS boxes, and OS/2 2.x DOS boxes.  Applications which use 
  280. interrupts or IO instructions, or expect to have direct access to 
  281. video/DOS memory will generally fail to run under NT. 
  282.  
  283. The 16- and 32-bit extenders support emulation of the non visual Windows 
  284. and 
  285. Win32 APIs, respectively. An import record is provided for those APIs 
  286. which are emulated, so use of unimplemented functions will result in 
  287. link time errors.  If you need to use an API function which is not 
  288. implemented by the extenders, you can hook unresolved APIs and provide 
  289. resolution for them at run time.  To do this, you need to implement and 
  290. export a hook function as follows: 
  291.  
  292. FARPROC WINAPI _export  
  293. BorlandUnresolvedEntryHook (LPCSTR modName, 
  294.                       BOOL     byOrdinal, 
  295.                       LPCSTR entry); 
  296.  
  297.  The first parameter is the name of the module for the function, for  
  298. example, "KERNEL".  The second parameter tells whether the third 
  299. parameter is a string or an ordinal value.  If it is FALSE, then the 
  300. third parameter is a string naming the unresolved entry, for example, 
  301. "GETATOMNAME".  Your hook function should determine if it is has an 
  302. implementation for this entry.  If it does, it should hand back a 
  303. pointer to the function.  This will be used by the loader to resolve the 
  304. references in the image. 
  305.  
  306.  
  307.  
  308. DOS DLLs           
  309.  
  310. The DLL technology found in the Borland PowerPack for DOS allows 
  311. developers to share DLLs between DOS and Windows without recompiling. 
  312. Developers can create DOS DLL's callable from both DOS and Windows, or 
  313. can take advantage of using Windows DLLs from DOS.  This includes many 
  314. of the commercially available Windows DLLs, such as the Borland Paradox 
  315. Engine.  As long as a Windows DLL doesn't make calls to Windows user 
  316. interface or graphics functions, it can be used from DOS.  DLL's written 
  317. using the 16-bit DOS Extender can be shared with Windows 3.x, while DLLs 
  318. written using the 32-bit DOS Extender can be shared with Windows NT and 
  319. Chicago. 
  320.  
  321.  
  322.  
  323. Borland Graphics Interface 
  324.  
  325. The Borland PowerPack for DOS includes high performance 16- and 32-bit 
  326. versions of the Borland Graphics Interface (BGI) library.  The BGI 
  327. library provides over 70 graphics functions, ranging from high-level 
  328. calls (such as setviewport, bar3d, and drawpoly) to bit-oriented 
  329. functions (such as getimage and putimage).  The graphics library 
  330. supports numerous fill and line styles, and provides several text fonts 
  331. that you can size, justify, and orient horizontally or vertically.      
  332.  
  333. BGI DLLs      
  334.  
  335. Protected mode BGI support follows a slightly different model from 
  336. the real mode graphics library included in Borland C++ 4.0.  The 16 and 
  337. 32-bit graphics libraries included in the Borland PowerPack are 
  338. implemented as DOS DLLs.   The 16- and 32-bit BGI DLLs are called 
  339. BGI16.DLL and BGI32.DLL, respectively.  Instead of linking with 
  340. GRAPHICS.LIB, you  must link with BGI16.LIB or BGI32.LIB, the import 
  341. libraries for 16bit and 32bit applications. 
  342.  
  343.  
  344. Performance      
  345.  
  346. The performance of the BGI libraries included in the Borland PowerPack 
  347. for DOS has been greatly enhanced.  Each of the routines is written in 
  348. hand optimized assembly language to provide fast execution.  In 
  349. particular, the performance of the 32-bit graphics library is 
  350. particularly fast. 
  351.  
  352. The following program demonstrates the speed of the 32-bit graphics 
  353. library. This program draws 1000 random polygons on the screen, and then 
  354. displays the number of seconds required to perform that task.  The real 
  355. mode version takes 7 seconds on a 80486 66MHz machine, while the 32-bit 
  356. version takes only 3 seconds on the same machine.  While this program 
  357. tests only a small portion of the graphics support in the drivers and 
  358. graphics engine, the results are indicative of the overall speed 
  359. provided by the 32-bit library. 
  360.  
  361. #include <dos.h> 
  362. #include <stdio.h> 
  363. #include <stdlib.h> 
  364. #include <time.h> 
  365. #include <graphics.h> 
  366. #include <_defs.h> 
  367.  
  368. struct PTS { 
  369.   int x, y; 
  370. };     
  371.  
  372. int    GraphDriver;          
  373. int    GraphMode;             
  374. int    MaxX, MaxY;            
  375. int    MaxColors;           
  376. int    ErrorCode;             
  377.  
  378. void Initialize(void); 
  379. void PolyDemo(void); 
  380.  
  381. //      Begin main function                              
  382.  
  383. int main() 
  384.   time_t t1, t2; 
  385.  
  386.   Initialize();          
  387.   t1 = time(NULL); 
  388.   PolyDemo(); 
  389.   t2 = time(NULL); 
  390.   closegraph();  
  391.   printf( "Time is %ld seconds", t2-t1); 
  392.   return(0); 
  393.  
  394. //      INITIALIZE: Initializes the graphics system                      
  395.  
  396. void Initialize(void) 
  397.       //  GraphDriver = DETECT;            
  398.         GraphDriver = VGA; 
  399.     initgraph( &GraphDriver, &GraphMode, "d:\\bc4.0\\bgi" ); 
  400.     ErrorCode = graphresult();            
  401.     if( ErrorCode != grOk )  
  402.     {                      
  403.        printf("Graphics Error: %s\n",grapherrormsg(ErrorCode)); 
  404.        exit( 1 ); 
  405.      } 
  406.   } 
  407.   MaxColors = getmaxcolor( ) + 1; 
  408.   MaxX = getmaxx(); 
  409.   MaxY = getmaxy();                    
  410. }  
  411.  
  412. //   POLYDEMO: Display a random pattern of polygons on the screen     
  413.  
  414. #define MaxPts          6               
  415.  
  416. void PolyDemo(void) 
  417.     struct PTS poly[ MaxPts ];            
  418.     int color;                            
  419.     int i, nTimes; 
  420.  
  421.     for(nTimes = 0; nTimes < 1000; nTimes++) 
  422.     { 
  423.        color = 1 + random( MaxColors-1 ); 
  424.        setfillstyle( random(10), color );  
  425.        setcolor( color );                 
  426.        for( i=0 ; i<(MaxPts-1) ; i++ ){     
  427.           poly[i].x = random( MaxX );       
  428.           poly[i].y = random( MaxY );       
  429.        } 
  430.        poly[i].x = poly[0].x;            
  431.        poly[i].y = poly[1].y; 
  432.        fillpoly( MaxPts, (int FAR *)poly );    
  433.     }  
  434.  
  435.  
  436.  
  437. Turbo Vision 2.0 
  438.  
  439. Turbo Vision is Borland's application framework for DOS.  It 
  440. encapsulates the behavior of a text-mode application that conforms to 
  441. the IBM Common User Access (CUA) user interface specification.  With 
  442. Turbo Vision, you can inherit an application that has pull-down menus, 
  443. overlapping windows, dialog boxes, and mouse support.  Turbo Vision 
  444. gives the DOS developer a head start in creating great looking text-mode 
  445. applications. 
  446.  
  447. Turbo Vision includes a class hierarchy that supports event handling, 
  448. user interface management, and data management.  Turbo Vision includes 
  449. over 100 classes, including classes that allow developers to easily 
  450. incorporate objects such as calculators, calendars, edit windows, file 
  451. open and directory navigation dialog boxes, and a clock in their 
  452. applications. 
  453.  
  454. Turbo Vision 2.0 now includes classes for data validation, a multi-state 
  455. checkbox, and an outline viewer that presents a hierarchical view of 
  456. data. 
  457.  
  458.  
  459. Extensible Architecture      
  460.  
  461. Turbo Vision classes define a CUA application as a set of abstract 
  462. classes that provide a general structure for implementing an interface.  
  463. The result is a large body of ready-to-use, high-quality code that can 
  464. be inherited directly by your application. 
  465.  
  466. Windowing  User Interface      
  467.  
  468. Turbo Vision provides support for windows and mouse operations, in an 
  469. event-driven environment.  The user is relieved of the task of writing 
  470. code to define window behavior, manage windowing objects such as menus 
  471. and dialog boxes, and read user input. 
  472.  
  473. High-level Objects      
  474.  
  475. Objects such as an editor, a calendar, a calculator, a clock, as well as 
  476. standard dialog boxes for opening files and browsing directories, and a 
  477. color palette are included in Turbo Vision.  This allows users to 
  478. incorporate these features easily in application programs. 
  479.  
  480. Hypertext-help      
  481.  
  482. Programmers can build applications with context-sensitive, hypertext-
  483. based help. 
  484.  
  485.  
  486.  
  487.  
  488. PART 4 
  489. Appendix 
  490.  
  491. Hardware/software requirements 
  492. A complete installation of the current version of Borland PowerPack for 
  493. DOS requires 5 Mb of hard disk space.   The Borland PowerPack for DOS 
  494. requires a minimal installation of Borland C++ 4.0. 
  495.  
  496. Installation 
  497. Borland PowerPack for DOS installs automatically.  Insert the first disk 
  498. of the install set in your A: drive and type install. 
  499.  
  500.  
  501.  
  502.  
  503. PART 5 
  504. Conclusion 
  505.  
  506. The Borland PowerPack for DOS solidifies Borland's leadership in C++ and 
  507. demonstrates Borland's commitment to bringing the best development tools 
  508. to a wide range of environments and operating systems.  This product 
  509. provides a series of features important to the DOS developer, such as: 
  510.       
  511. +     royalty free 16 and 32-bit DOS Extenders 
  512. +     more application memory 
  513. +     faster application performance 
  514. +     code reuse through DOS DLLs 
  515. +     16 and 32-bit Borland Graphics Interface libraries 
  516. +     support for the newest super vga video cards 
  517. +     16 and 32-bit Turbo Vision libraries 
  518. +     data validation classes 
  519. +     outline viewer object 
  520.  
  521. We are confident you will share our enthusiasm for this new suite of 
  522. tools for the Borland C++ 4.0 compiler.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528. BORLAND INTERNATIONAL, INC.   1 BORLAND WAY 
  529. P.O. BOX 660001, SCOTTS VALLEY, CA 95067-0001 
  530. Copyright 1994 by Borland International, Inc.  All rights reserved.  All 
  531. Borland products are trademarks or registered trademarks of Borland 
  532. International, Inc.  Other brand and product names are trademarks or 
  533. registered trademarks of their respective holders. 
  534. April 1994
  535.