home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 3.ddi / BATSRC.ZIP / CRTL.DOC < prev    next >
Encoding:
Text File  |  1992-06-10  |  16.8 KB  |  406 lines

  1.  
  2.   BORLAND C++ RUNTIME LIBRARY SOURCE CODE 3.0 DOCUMENTATION
  3.   _________________________________________________________
  4.  
  5.   Please read this document carefully. It contains information on
  6.   how to install the Borland C++ Runtime Library source files, an
  7.   overview of what the Runtime Library contains, instructions for
  8.   modifying Runtime Library files, and Borland's licensing
  9.   agreement.
  10.  
  11.  
  12.   TABLE OF CONTENTS
  13.   _________________
  14.  
  15.      1.  Installing Library Sources
  16.      2.  Runtime Library Overview
  17.      3.  Modifying Library Files
  18.      4.  License Agreement
  19.      5.  More information on the batch files
  20.  
  21.  
  22.   1. INSTALLING LIBRARY SOURCES
  23.   _____________________________
  24.  
  25.   The following diagram shows the recommended directory structure
  26.   for the libraries on a hard disk. This is also the directory
  27.   structure created by the hard disk installation program, INSTALL.
  28.   All of the batch files that build the RTL files assume this
  29.   directory structure.
  30.  
  31.   In the diagram, and in the text that follows, we assume that you
  32.   have installed the RTL directory structure in a subdirectory
  33.   named \CRTL. If you have put the RTL directory structure in a
  34.   subdirectory other than \CRTL, simply substitute the path to that
  35.   directory wherever \CRTL appears.
  36.  
  37.   RECOMMENDED LIBRARY DIRECTORY STRUCTURE
  38.   _______________________________________
  39.  
  40.   \CRTL                    library root directory; all batch files
  41.                            are contained here (BATCH.ZIP)
  42.   \CRTL\LOG                compiler and assembler error message
  43.                            logs
  44.   \CRTL\LIB                library files are created here
  45.   \CRTL\RTLINC             library header files (RTLINC.ZIP)
  46.   \CRTL\CLIB               general library sources (CLIB1.ZIP,
  47.                            CLIB2.ZIP).
  48.   \CRTL\IOSTREAM           C++ stream I/O library sources
  49.                            (IOSTREAM.ZIP)
  50.   \CRTL\MATH               math library sources (MATH.ZIP)
  51.   \CRTL\EMU                floating point initialization.
  52.                            (FPINIT.ASM in MATH.ZIP)
  53.   \CRTL\WINLIB             Windows library sources (WINLIB.ZIP)
  54.   \CRTL\WINLIB\NOTIMP      Stubs for library functions not
  55.                            implemented under Windows.
  56.  
  57.   To install the library source files on your hard disk, insert the
  58.   library source distribution disk 1 in your floppy drive, and
  59.   enter the following command at the DOS prompt:
  60.  
  61.        A:INSTALL
  62.  
  63.   The INSTALL program will default to the library directories as
  64.   shown above and extract the source and header/include files,
  65.   placing them in the appropriate directories. It will also extract
  66.   several batch files that may be used to recompile and/or rebuild
  67.   the C and MATH libraries. It is a good idea to have a look at
  68.   these batch files, to see how the source modules are compiled and
  69.   how the libraries are built.
  70.  
  71.   The following batch files will be placed in \CRTL:
  72.  
  73.   BUILD.BAT      Compiles and assembles ALL modules in one or more
  74.                  libraries, for one or more memory models.
  75.  
  76.   ALL.BAT        Compiles and assembles ALL modules in ALL
  77.                  libraries, for ALL memory models.
  78.  
  79.   These batch files assume the recommended directory structure. For
  80.   usage information and an example, see section 5 or enter the name
  81.   of the batch file without any parameters.
  82.  
  83.   If you choose to compile or assemble a module without using the
  84.   batch files, be aware that certain files need special switches.
  85.   Make sure to check the configuration files (TASM.CFG and
  86.   TURBOC.CFG) and the batch files to find the necessary switches.
  87.  
  88.  
  89.   2. RUNTIME LIBRARY OVERVIEW
  90.   ___________________________
  91.  
  92.   Most of the library routines require .H files from Borland C++,
  93.   and you'll also need TLIB, the object file librarian.
  94.  
  95.   The runtime libraries are blocks of object code grouped together
  96.   in several library files.  These library files contain the
  97.   general library routines and the standard math routines.
  98.  
  99.   FPINIT.ASM is provided to allow you to modify the floating-point
  100.   initialization and termination process.  If you used the
  101.   installation batch file, this file will be found in a
  102.   subdirectory called EMU. FPINIT.ASM is used to create two OBJ
  103.   files, one for the emulator (FPINIT.OBJ) and one for inline 8087
  104.   instructions (FP87INIT.OBJ). The following command lines will
  105.   create these two files from the EMU subdirectory.
  106.  
  107.        TASM /MX /t /z fpinit
  108.        TASM /MX /t /z /DFP87 fpinit, fp87init
  109.  
  110.   Most of the modules contained in the runtime libraries are object
  111.   files produced by compiling the library source files with the
  112.   Borland C++ compiler.  Some of the files contain inline assembly
  113.   language code; therefore you will need a TASM 2.0 (or compatible)
  114.   Macro Assembler to compile those source files. Finally, a few
  115.   modules are written entirely in assembly language.
  116.  
  117.   Here is a key to some of the file extensions found in the RTL:
  118.  
  119.   .C             C source file
  120.   .CPP           C++ source file
  121.   .H             C header file
  122.   .CAS           C source file with inline assembler
  123.   .ASM           Assembler source file
  124.   .ASI           Include file needed for .ASM files
  125.   .CFG           Configuration files for Borland C++ and Turbo
  126.                  Assembler.
  127.   .ZIP           Archive file
  128.  
  129.   The library source files have been grouped together into several
  130.   "archive" files (.ZIP extensions). An archive file contains a
  131.   collection of files in a compressed form. You use the UNZIP
  132.   utility to extract files from the archive. Here is the usage
  133.   information for UNZIP:
  134.  
  135.   Usage: UNZIP [options] zipfile [destpath] [files...]
  136.  
  137.   Options:
  138.   /o = overwrite existing files         /v = verbose listing of archive(s)
  139.   /c = extract file(s) to the console   /p = extract file(s) to the printer
  140.   /t = test archive integrity
  141.  
  142.   zipfile    Archive file name, wildcards *,? ok.  Default extension is .ZIP
  143.   destpath   Destination for extracted files.
  144.   files      Name(s) of files to extract.  Wildcards *,? ok.
  145.              Default is ALL files.
  146.  
  147.   Examples:
  148.     UNZIP CLIB1                     - Unpack all files in CLIB1 to
  149.                                        current drive and directory.
  150.     UNZIP MATH C:\CRTL\MATH        - Unpack all files in MATH.ZIP to
  151.                                        C:\LIBRARY\MATH directory.
  152.     UNZIP CLIB2 C: *.CPP *.CAS      - Unpack all .CPP and .CAS files in
  153.                                        CLIB2.ZIP to drive C.
  154.  
  155.  
  156.   3. MODIFYING LIBRARY FILES
  157.   __________________________
  158.  
  159.   This section describes how to modify a source module, compile or
  160.   assemble it, and replace it in a library. If you have installed
  161.   the source using INSTALL, there are several batch files included
  162.   to make your job easier; see section 5 for more information.
  163.  
  164.   You can modify a library file by first changing the corresponding
  165.   source file, compiling (or assembling) the modified source file
  166.   into an object file, and finally rebuilding the library files
  167.   from its constituent object files.
  168.  
  169.   In order to compile most of the library source files, the
  170.   standard header files and the library header files (contained in
  171.   RTLINC.ZIP) #included in most of the C source files must be
  172.   present on your system. They must be made available to Borland
  173.   C++ through the -I option.
  174.  
  175.   The following steps are recommended for modifying a library
  176.   module. You might want to modify all the modules you need, then
  177.   rebuild the library (or libraries) from scratch.
  178.  
  179.      1.  Install all the source files on a hard disk using the
  180.          installation procedure described in section 1.  Even
  181.          though you will not be modifying all of the source files,
  182.          the makefiles that build the libraries assume that all
  183.          source files are present.
  184.  
  185.      2.  Figure out which module you need to modify, and to which
  186.          library file(s) it belongs.
  187.  
  188.          The library listing feature of TLIB will be helpful here,
  189.          since it shows all the modules in a library file, together
  190.          with all the functions that the modules define. Use "tlib
  191.          lib-name,con" or "tlib lib-name,listfile-name."
  192.  
  193.          Note that the general routine libraries (CS.LIB, CC.LIB,
  194.          CM.LIB, CL.LIB, and CH.LIB) all contain the same set of
  195.          modules, compiled for different memory models; likewise
  196.          for the math routine libraries (MATHS.LIB, MATHC.LIB,
  197.          MATHM.LIB, MATHL.LIB, and MATHH.LIB), and the Windows
  198.          libraries (CWS.LIB, CWC.LIB, CWM.LIB, CWL.LIB, and
  199.          CWH.LIB).
  200.  
  201.      3.  Apply and test all the changes you need to make.
  202.  
  203.          To test a C library module, write a simple testing
  204.          program, and compile and link both modules at the same
  205.          time; for example:
  206.  
  207.               BCC  [options]  tsrchp  searchp.cas
  208.  
  209.          That way you make sure the tested module will not be
  210.          linked in from the library.
  211.  
  212.          For an assembler file, assemble the library file, then
  213.          link it with a test file using BCC; for example:
  214.  
  215.               TASM lrsh /MX;
  216.  
  217.               BCC  [options]  tstshf  lrsh.obj
  218.  
  219.      4.  Recompile the module and replace it in the library
  220.          file(s).
  221.  
  222.          The batch file BUILD.BAT is provided on the distribution
  223.          disk to help with rebuilding the libraries. It compiles or
  224.          assembles all modules that are more recent than the
  225.          corresponding object files, or which do not have object
  226.          files, then rebuilds the library from its object files.
  227.  
  228.          For batch file usage information and examples, see section
  229.          5 or enter the name of the batch file without any
  230.          parameters.
  231.  
  232.          If you are using a floppy-based system, don't use these
  233.          batch files. At this point, it's easier just to update the
  234.          library with the .OBJ file. Remember, TLIB creates a
  235.          backup of the library file, so make sure you have plenty
  236.          of space.
  237.  
  238.   4. LICENSE AGREEMENT
  239.   ____________________
  240.  
  241.   Borland C++ Runtime Library Source Code
  242.   Borland's No-Nonsense License Agreement
  243.  
  244.   Borland International, Inc. (Borland) is offering you a license
  245.   to the source code to the Borland C++ Runtime Library portion of
  246.   Borland C++ (the Source Programs), including updates that may
  247.   later be supplied by Borland at additional cost, but not
  248.   including the source code of the 8087 emulator or the graphics
  249.   library.
  250.  
  251.   The Source Programs are protected by both United States copyright
  252.   law and international treaty provisions. Therefore, you must
  253.   treat the Source Programs just like a book, with the following
  254.   single exception:  Borland authorizes you to make archival copies
  255.   of the Source Programs for the sole purpose of backing-up your
  256.   programs and protecting your investments from loss.
  257.  
  258.   By "just like a book," Borland means, for example, that the
  259.   Source Programs may be used by any number of people and may be
  260.   freely moved from one computer workstation to another, so long as
  261.   there is no possibility of them being used at one computer
  262.   workstation at the same time they are being used at another. Just
  263.   as a book can't be read by two different people in two different
  264.   places at the same time, neither can the Source Programs be used
  265.   by two different people in two different places at the same time.
  266.   (Unless, of course, Borland's copyright has been violated.)
  267.  
  268.   You may modify the Source Programs, but the modified source code,
  269.   regardless of the extent of the modifications, shall always
  270.   remain Borland's source code. You may not remove or modify
  271.   Borland's copyright and other proprietary copyright notices, and
  272.   you may not transport any of the Source Programs to another
  273.   computer operating system or environment. You are responsible for
  274.   all claims, liability, and damages arising from your own
  275.   modifications and the products which include them.
  276.  
  277.   You may use the Source Programs to support your licensed copies
  278.   of Borland C++. This means you may include all or some of the
  279.   original or modified Source Programs routines in your own Borland
  280.   C++ based programs, but you may only distribute binary copies of
  281.   such routines when linked into your executable programs. You may
  282.   not distribute any source code for the original or modified
  283.   Borland C++ Runtime Library under any circumstances. You are not,
  284.   of course, restricted from distributing your own source code.
  285.  
  286.   All rights not specifically granted in this license are reserved
  287.   by Borland.
  288.  
  289.  
  290.   5. MORE INFORMATION ON THE BATCH FILES
  291.   ______________________________________
  292.  
  293.   The following descriptions are of the batch files you may find
  294.   useful when modifying the library source files.  All of them
  295.   assume that you have installed the sources by using INSTALL.
  296.   Usage information can also be found by entering the name of the
  297.   batch file without any parameters.
  298.  
  299.   There are two batch files that you can use to build libraries:
  300.   ALL.BAT and BUILD.BAT. The batch files work by invoking MAKE with
  301.   a master MAKEFILE, \CRTL\MAKEFILE. This makefile, in turn,
  302.   invokes MAKE with makefiles for specific libraries. These
  303.   library-specific makefiles have the extension .MAK.  For example,
  304.   one of the the makefiles that is used to build the Windows
  305.   libraries is \CRTL\WINLIB\WINLIB.MAK.
  306.  
  307.   Note that the makefiles invoke TLIB with the /0 option when
  308.   replacing modules in the CLIB and WINLIB libraries, and with the
  309.   /0 /E options when replacing modules in the MATH libraries. If
  310.   you want to build one or more library files to include debugging
  311.   information (so that you can step through library calls with TC
  312.   or TD), you have to remove both the /E and /0 options from the
  313.   TLIB command line(s), as these options effectively remove all
  314.   debugging information from library files.
  315.  
  316.   ENVIRONMENT VARIABLES
  317.   _____________________
  318.  
  319.   The batch files use two environment variables to determine which
  320.   memory models should be used, and where the error log should be
  321.   saved.
  322.  
  323.   The environment variable MODEL specifies which memory models
  324.   should be used.  Set it to all the memory model letters you want
  325.   to use. Separate the letters with spaces, and be sure to use only
  326.   lower-case letters. For example, if you want to compile for all
  327.   memory models, use all the model letters:
  328.  
  329.        set MODEL=s c m l h
  330.  
  331.   If you want to compile for just one memory model, set MODEL to a
  332.   single letter: use the command:
  333.  
  334.        set MODEL=s
  335.  
  336.   If you don't set MODEL, the batch files will use all memory
  337.   models.
  338.  
  339.   The environment variable LOGFILE determines where the compiler
  340.   and assembler error messages will be saved.  If you want the
  341.   error messages to be displayed on the screen, use the following
  342.   command before you run the batch files:
  343.  
  344.        set LOGFILE=CON
  345.  
  346.   If you don't set LOGFILE, the batch files will set it to the
  347.   default value ..\LOG\CRTL.LOG. The directory ..\LOG is a
  348.   subdirectory of \CRTL, and if doesn't already exist, you must
  349.   create it with the command:
  350.  
  351.        MKDIR \CRTL\LOG
  352.  
  353.   The batch files also use environment variables to control the
  354.   operation of the compiler, assembler, and librarian. These
  355.   variables are set in VARS.BAT.  You can edit this file to change
  356.   the operation of the tools. For example, if you want to compile
  357.   with debugging information turned on, add -v to the line in
  358.   VARS.BAT that defines the TC environment variable, and remove /0
  359.   from the line that defines the TLIB environment variable.
  360.  
  361.   You should always run VARS.BAT before running BUILD.BAT.
  362.  
  363.   BUILD.BAT
  364.   _________
  365.  
  366.   This batch file will recompile all modified modules (or modules
  367.   which have no corresponding object files) for a specific library
  368.   (or all libraries) for one or more memory models. It places the
  369.   resultant object files in the appropriate subdirectory (for
  370.   example, the S subdirectory for small model). It then rebuilds
  371.   the library from its object files.
  372.  
  373.   The "libtype" parameter specified which library should be built:
  374.   CLIB, WINLIB, WINDLL, STARTUP, or MATH.  If you want to build all
  375.   libraries, specify ALL.
  376.  
  377.   The environment variable MODEL specifies which memory models are
  378.   to be used. If MODEL is not set, BUILD.BAT uses all memory
  379.   models.
  380.  
  381.   The current directory must be \CRTL when you run BUILD.BAT.
  382.  
  383.   Usage:
  384.  
  385.        build libtype
  386.  
  387.   Examples:
  388.  
  389.        build all
  390.        build math
  391.        build clib
  392.  
  393.   Note that recompiling all the source files using this batch file
  394.   may take a considerable amount of time.  But once the files have
  395.   been compiled, subsequent runs of BUILD.BAT will compile only
  396.   those modules that have changed.
  397.  
  398.  
  399.   ALL.BAT
  400.   _______
  401.  
  402.   This batch file builds all libraries in all memory model by
  403.   repeatedly invoking BUILD.BAT.  Not only will this will take a
  404.   considerable amount of time, but will also consume large amounts
  405.   of disk space.
  406.