home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-08-29 | 42.3 KB | 1,025 lines |
-
-
-
- $read.me (c)Copyright Sequiter Software Inc., 1990-1992.
- All rights reserved.
- ----------------------------------------------------------
-
- README - Table of Contents
-
- I. Introduction
-
- II. CodeBase Electronic Documentation Files.
-
- III. CodeBase Manual and Code Revisions.
-
- IV. Windows 3.0 and the CodeBase 4.5 DLL.
-
- V. Interactive CodeBase 4.5.
-
- VI. CodeBase Index and Memo File Compatibility.
-
- VII. Examples.
-
- VIII. Using CodeScreens with CodeBase 4.5.
-
- IX. CodeBase Public-Access Bulletin Board System.
-
- X. Accessing More Than 20 Files in DOS or Windows.
-
- ----------------------------------------------------------
-
- I. Introduction
-
- CodeBase is a C library for database management. Its compat-
- ibility allows you to directly create, access, or change dBASE
- IV, dBASE III, FoxPro or Clipper data, index, or memo files.
-
- CodeBase has full multi-user capabilities. When programs are
- run on a network, the network is automatically detected and
- used. CodeBase allows both explicit and automatic record
- locking and file locking. It is also possible to bypass the
- locking mechanism and read data locked by another user.
-
- All of the CodeBase functions work together to allow C
- programmers to program at a very high level. Programs will
- execute very quickly, they will be readable and there will be no
- unnecessary lines of code.
-
- In order to use CodeBase, it is necessary to have a C
- compiler and it is necessary to have some knowledge of the C
- programming language.
-
- In addition, for C++ programmers, there is a C++ interface
- and functionality extension. There are new string classes which
- let you manipulate text easily. Fields become strings so that
-
- you can manipulate data easily. Finally, there is an object-
- oriented interface to data and index files.
-
- Foreign support, currently for German and French, is
- available by contacting Sequiter Software. Foreign support is
- enabled by the use of a simple define. Foreign versions are
- supported under Windows through the use of either the ANSI
- character set or the ASCII character set.
- For platforms other than DOS/Windows or OS2, a portability
- version is available. This version is intended for use on UNIX/
- XENIX and similar platforms. Both ANSI and Kernigan & Ritchie
- source code is provided for maximum portability.
-
- To accomodate users requiring DOS or UNIX screen management
- capabilities, a software library called 'CodeScreens' is
- available. CodeScreens features pop-up and pull-down window
- support, color screen design capabilities, and print functions,
- plus much more.
-
- For information on either the CodeBase 4.5 portability
- version, or CodeScreens, contact Sequiter Software Ltd.
-
- ----------------------------------------------------------
-
- II. CodeBase Electronic Documentation Files.
-
- It is highly recommended that any installed documentation
- files be read in addition to the CodeBase manuals. These
- documentation files serve as the primary information source
- for Visual Basic and Turbo Pascal for Windows support.
-
- The various documentation files provide additional specific
- information not found in the CodeBase manual. Please note
- that only documentation files relevant to the options
- installed will be present on your drive after installation.
-
- All electronic documentation files have been suitably
- formatted for hard-copy printing. To print any document,
- simply direct that file to your printer, using the 'print'
- command.
-
- The complete list of documentation files that are present
- on the CodeBase disk are:
-
- GENERAL DOCUMENTATION:
-
- $READ.ME General user information, manual changes/updates,
- and installation information. Always installed.
-
- INSTALL.DOC Information on CodeBase installation. Includes
- manual unfolding documentation.
-
- CLIP_NDX.DOC Information on using CLIPPER and dBASE III
- compatible index and memo files.
-
-
- PORT.DOC Important information when using the CodeBase 4.5
- portability version. Not included with the
- CodeBase 4.5 DOS/WINDOWS version. Located on
- ANSI and K&R diskettes.
-
-
- COMPILER DOCUMENTATION:
-
- BORLAND.DOC Borland C++ compiler specific information.
-
- TURBOCPP.DOC Borland Turbo C++ 1.01 specific information.
- MSC.DOC Microsoft C 6.00a compiler specific information.
-
- METAWARE.DOC MetaWare High C 386 compiler specific
- information.
-
- WATCOM.DOC Watcom 386 8.5 and 9.0 compiler specific
- information.
-
- ZORTECH.DOC Zortech C++ 3.0 compiler specific information.
-
- EXAMPLES.DOC Information on usage of the provided source code
- examples.
-
- TEST.DOC Information on usage of the CodeBase test
- programs
-
- WINDOWS.DOC Windows 3.0 and CodeBase DLL information. Other
- Windows information can be found in selected
- compiler document files.
-
- CODEWIN.DOC CodeWindows information.
-
- CPP.DOC Information for users of the CodeBase C++
- extension.
-
- 42UPGRAD.DOC CodeBase 4.2 to 4.5 translation information.
-
-
- VISUAL BASIC DOCUMENTATION:
-
- VBASIC.DOC Introduction to Visual Basic. Also contains
- an explanation of the supplied Visual Basic
- functions.
-
- A4QUICK.DOC Visual Basic / CodeBase quick reference.
-
-
- TURBO PASCAL FOR WINDOWS DOCUMENTATION:
-
- CBPASCAL.DOC Introduction to using CodeBase with Turbo Pascal
- for Windows.
-
- FUNCTION.DOC CodeBase 4.5 Turbo Pascal for Windows function
- reference.
-
-
- CBDEMO1.DOC Documentation for provided examples.
- CBDEMO2.DOC
- CBDEMO3.DOC
- CBDEMO4.DOC
- CBDEMO5.DOC
- CBDEMO6.DOC
- CBDEMO7.DOC
- CBDEMO8.DOC
- CBDEMO9.DOC
-
- ----------------------------------------------------------
-
- III. CodeBase Manual and Code Revisions
- CODEBASE 4.5 MANUAL:
-
- 1. Page 17
- Switch 'S4MEMO_OFF' is not yet implemented.
-
- 2. Page 19
- Additional switches for Clipper and dBASE III support
- have been added.
- Insert:
-
- S4CLIPPER - This switch adds support for Nantucket
- CLIPPER file formats. This includes '.NTX'
- index files and '.DBT' memo files.
-
- S4NDX - This switch adds support for dBASE III and
- dBASE II plus file formats. This includes
- '.NDX' indexes and '.DBT' memo files.
-
- S4USE_COUNT- This switch is for use with dBASE III files.
- When performing deletions and zaps in dBASE
- III, the actual file is not properly shrunk
- when completed. With the switch set, any
- improper files will be detected and corrected.
- Set this switch when building a CodeBase .NDX
- library if you also use dBASE III with the
- database files.
-
- 3. Page 62, 'd4check'
- The line 'See Also t4check() and i4check()' should be
- deleted. Although these functions do exist, they are
- not documented.
-
-
- 4. Page 64, 'd4close_all()'
- From:
- Usage void d4close_all( C4CODE *code_base )
- To:
- Usage int d4close_all( C4CODE *code_base )
-
-
- 5. Page 102, 'd4skip()'
-
- The return 'r4entry' is no longer returned for
- for compatibility reasons.
-
- Delete:
- r4entry 'C4CODE.skip_error' is false and there was
- entry in the selected tag for the current
- record.
-
-
- 6. Page 107, 'd4top()'
- Add to 'Returns':
-
- r4locked Index Tag or Record locked.
-
- 7. Page 135, 'f4long()'
- From:
- Usage int f4long( F4FIELD *field )
- To:
- Usage long f4long( F4FIELD *field )
-
- 8. Page 137, 'f4ncpy()'
- From:
- In addition, f4ncpy() guarantees that 'mempt' will be
- null termination, provided that 'mem_len' is greater
- than zero.
- To:
- In addition, f4ncpy() guarantees that 'mempt' will be
- null terminated, provided that 'mem_len' is greater
- than the length of the field.
-
- 9. Page 157, 'i4create()'
- Add to 'DESCRIPTION' (second paragraph)
-
- A production index can be created for an existing database
- file by setting the parameter 'file_name' in 'i4create()'
- to '0'. Conversely, passing a non-NULL file_name will
- result in the creation of a non-production index. This is
- true even if the file_name has the same prefix as the
- database file name.
-
-
- 10. Pages 183 and 184 are in the wrong order.
-
-
- 11. Page 251, 's4Str::ncpy'
- From:
- Usage void s4Str::ncpy(char *to, unsigned to_len)
- To:
- Usage unsigned s4Str::ncpy(char *to, unsigned to_len)
-
-
- CODEWINDOWS MANUAL:
-
- 1. Page 8
- Delete the reference to the 'CodeWindows DLL'. The
-
- CodeWindows functions are contained within the CodeBase DLL.
-
- 2 Page 42.
- The buffer supplied to g4display_buffer() must be null
- terminated.
-
- CODEBASE SOURCE CODE CHANGES:
-
- Note: Notices of changes and enhancements to CodeBase 4.5 are
- updated on files contained on Sequiter's BBS system. For
- more information, see 'section IX'.
-
- ----------------------------------------------------------
-
- IV. Windows 3.0 And The CodeBase 4.5 DLL
-
- The DLL provided, 'M4DLL.DLL', is a DLL designed to be
- used with many different compilers and Windows programming
- tools. It has been tested with Microsoft C 6.00a, Borland
- C++ 2.0 and 3.0, Visual Basic, and Turbo Pascal for Windows,
- and should work with other Windows products that will accept
- a DLL. See the file 'WINDOWS.DOC', on the \CB sub-directory
- for more extensive information.
-
- ----------------------------------------------------------
-
- V. Interactive CodeBase 4.5.
-
- Interactive CodeBase 4.5 for DOS or Windows is a CodeBase
- application that allows the interactive manipulation of databases
- under Windows. Interactive CodeBase may be used to test the
- operation and consequence of CodeBase functions, or as a tutorial
- aid to familiarize users with CodeBase functions, or may be
- used as a quick and easy way to manipulate databases without
- coding and compiling. For Windows, the Interactive CodeBase
- provided is intended for use with dBASE IV index and memo
- file formats. Also, two DOS Interactive CodeBase executables
- are currently provided. They are intended for either dBASE
- IV or FoxPro file formats. For both Interactive CodeBases,
- use of other file formats are supported, but must be recompiled.
-
-
- A) Interactive CodeBase for DOS
- ----------------------------
-
- Interactive CodeBase for DOS, known as 'CID', contains all of
- the functionality mentioned above, as well as interactive browse
- and edit facilities.
-
- To install Interactive CodeBase, select 'Interactive CodeBase
- for DOS' during the CodeBase INSTALL. Alternatively, you
- may manually UNFOLD the Interactive files, contained in 'INTERACT.FLD'.
-
-
- Using CID:
-
-
- Each provided CID executable program can handle only one of the
- CodeBase-supported index formats. The file format can be determined
- by examining the last three letters of the executables provided:
-
- eg. CID_MDX.EXE is the MDX file format of dBASE IV
- CID_CDX.EXE is the CDX file format of FoxPro
-
- Also, during CID execution, the file format will be displayed on
- the bottom row of CID's main screen. Please ensure that the CID
- being used is the proper CID for your file format. If not, recompile
- as directed, or contact the Sequiter BBS for the correct CID.
-
- You can run Interactive CodeBase for DOS in either color or
- monochrome modes. Pass the command line argument of MONO to select
- monochrome mode or enter no arguments for color mode:
-
- Eg. c:\CID_MDX MONO ** for monochrome mode
-
- or c:\CID_MDX ** for color mode
-
-
- Upon startup, Interactive CodeBase for DOS will display a
- startup message. Press any key to clear this message. The main
- menu bar will then be activated. You can use the cursor keys
- to move the highlighting over the item that you desire and press
- [ENTER] to select.
-
- In addition you can use the highlighted hot keys to select a menu
- item. Holding down the ALT key and pressing a letter will move to
- appropriate menu. For example, pressing [ALT D] will move you to
- D4DATA menu. Pressing the letter that is highlighted in an entry of
- the current menu, will select that item. For example, pressing
- the [O] key while in the I4INDEX menu will select the i4open
- function.
-
- After selecting a function from a menu, you will be presented
- with a variety of menus, and input boxes, prompting you to enter in the
- parameters of the function. Most functions will present you with a
- list of the databases that are currently open. You can press the
- [ESC] key to abort most operations.
-
- When all of the parameters have been entered, the function will
- be executed. If CodeBase encounters any errors, they will be
- displayed in popup boxes. After execution of a function, the return
- value (if any) will be displayed.
-
- Examples:
-
- To open a database:
-
- -select d4open from the D4DATA menu. A file requester will then
- appear.
- -enter the directory containing the database you want to open.
- -a list of the databases in that directory will appear.
-
- -select the database moving the highlighting with the cursor
- keys and press [ENTER]
-
- To set the C4CODE.safety to FALSE
-
- -select the C4CODE menu.
- -use the cursor keys to move the highlighting over C4CODE.safety
- -press the [ENTER] key to togle between true and false.
-
-
- Using the Browser:
-
- InterActive CodeBase for DOS has a built in Browser. To browse a
- database, either open it with d4data, or create it with d4create. Then
- select BROWSER from the main menu. You will then be presented with a
- list of open databases. Select the database that you want to browse.
-
- NOTE: Memo field browsing and editing is not yet supported.
-
- Browse Mode:
-
- The following keys have special functions when in browse mode:
-
-
- [UP ARROW] : Selects the previous record
- [DOWN ARROW] : Selects the next record
- [LEFT ARROW] : Selects the previous field
- [RIGHT ARROW] : Selects the next field
- [ESC] : Leaves Browse mode and activates the menu
- [ENTER] : Allows you to edit the field
- [PAGE UP] : Skips back one page of records
- [PAGE DOWN] : Skips forward one page of records
- [HOME] : Selects the first field
- [END] : Selects the last field
- [CNTL HOME] : Selects the first record
- [CNTL END] : Selects the last record
- [INS] : Inserts a new record
- [DEL] : Toggles the deletion flag
-
- Menu Items:
-
- BROWSE : Reenters Browse mode
- d4tag_select : Select one of the database's tags
- d4go : go to the entered record number
- d4seek : seek using the currently selected tag
- d4top : goto the top of the database
- d4bottom : goto the bottom of the database
- QUIT BROWSER : quit browser and return the main menu
-
-
- Compiling the Source Code:
-
- Source code for InterActive CodeBase for DOS has been provided
- along with a project file for the Borland C++ (CID.PRJ) and a batch
- file (CID.BAT) for the MSC compilers. InterActive CodeBase for DOS
-
- uses the CodeScreens screen library. You will need this library if
- you plan on recompiling this program. If you do not have
- CodeScreens, but would like CodeBase Interactive for DOS compiled
- for another file format (such as NTX or NDX), you can download these
- versions from our BBS.
-
- If you are using Microsoft C ,you will also have to rebuild the
- CodeBase 4.5 library with the e4error and e4severe functions
- commented out. InterActive CodeBase for DOS has replacements
- for those routines and the Microsoft C linker will not allow functions
- in a library with the same names as those in the source code.
-
-
- B) Interactive CodeBase for Windows
- --------------------------------
-
- To install Interactive CodeBase, select 'Interactive CodeBase
- for Windows' during the CodeBase INSTALL. Alternatively, you
- may manually UNFOLD the Interactive files, contained in 'INTERWIN.FLD'
- and 'INTERACT.FLD'. Start up Windows, and create a new program
- item. Name the item INTERACT 4.5, and set the path to run
- the executable 'INTERACT.EXE'. Interactive CodeBase should
- now be ready for use.
-
- To use, simply press the newly created icon, or 'run
- INTERACT'. When the program has loaded, you will see the
- Interactive CodeBase main window, and several menu selection
- headings. These menu selections correspond to the main sections
- in the CodeBase manual. For example, 'DATA' corresponds to the
- 'Data File Functions' in the manual. To use, click on any of
- these menus to get a new window with a sub-menu of CodeBase
- functions. These functions will correspond to the functions
- contained in the manual. To activate a function, simply press
- that function, and follow any given instructions. For example,
- you will likely start an Interactive session by selecting
- 'DATA', and then 'd4open()' or 'd4create()'.
-
- Interactive CodeBase contains error checking to stop users
- from performing invalid code sequences. For example, if you try
- to append a record to a file before opening or creating that
- file, an error message will appear. If this happens, simply
- continue on by performing the required function.
-
- Included with the executable Interactive program are some
- additional files that can be used. The source code is included,
- as well as some batch and project files that can be used to
- rebuild Interactive CodeBase. Microsoft 6.00a users may use the
- batch file to rebuild Interactive CodeBase, while Borland users
- may use the project files. Users of other compilers may edit
- one of the batch files for use with their compiler. Interactive
- CodeBase may also be compiled for use with a DLL. In this case,
- you may alter and use 'M4DLLRUN.MAK' or 'B4DLLRUN.PRJ' files,
- located in 'WINDOWS.FLD', to build an executable.
-
- As noted, the provided Interactive CodeBase is compiled for
-
- use with dBASE IV index and memo file formats. If you want to
- use Interactive CodeBase with another file format, you must
- recompile a new Interactive CodeBase. This is done by using
- the relevant batch or project file, with the appropriate define
- for the index format specified. See 'section VI' for a
- description of the file formats and the associated use of
- defines.
-
- ----------------------------------------------------------
-
- VI. CodeBase Index and Memo File Compatibility
-
- CodeBase currently supports four types of index and
- memo file formats:
-
- 1. dBASE III compatible index files and memo files.
- 2. Clipper compatible index files and memo files.
- 3. dBASE IV compatible multiple index files and memo files.
- 4. FoxPro compatible compound and compact index files,
- and memo files.
-
- All of the above products use the same database ('.DBF') file
- format.
-
- CodeBase uses special defines to determine which file format
- should be used. These defines are set as conditional
- compilation switches when building a library. The defines are:
-
- S4MDX - dBASE IV compatible ('S4MDX' does not have to
- be explicitly defined since
- this is the default format)
-
- S4FOX - FoxPro compatible (See manual, page 19)
-
- S4CLIPPER - Clipper compatible (See $read.me, line 140.
- Also see CLIP_NDX.DOC )
-
- S4NDX - dBASE III compatible (See $read.me, line 140.
- Also see CLIP_NDX.DOC )
-
- To enable a non-default file format, define the appropriate
- switch during the compilation of a library and/or application.
- This is usually done by preceding one of the above switches with
- a '-D' prefix. This usually requires editing of the supplied
- batch/make files used to build new libraries or applications.
-
- e.g. bcc -c -DS4CLIPPER b4*.c
-
- Once a new library has been built, usage of the dBASE IV and
- FoxPro formats is as described in the CodeBase manual. Usage of
- the Clipper and dBASE III formats is slightly different from the
- manual. The usage of these formats are outlined in the document
- CLIP_NDX.DOC. Please read this document carefully.
-
- ----------------------------------------------------------
-
-
- VII. Examples
-
- There are four sources of CodeBase 4.5 examples:
-
- 1. The manual, for short examples of function (and class)
- usage.
-
- 2. The examples present on the CodeBase 4.5 diskette.
- All examples installed are placed on the CodeBase
- \EXAMPLES subdirectory.
-
- 3. The testing and diagnostic code. These programs test
- the important CodeBase functions, and can also be
- used to ensure that CodeBase 4.5 was installed
- correctly.
-
- 4. Our BBS, which contains new examples produced by our
- developers and examples which users have uploaded.
- Please see 'Section IX: The CodeBase Public-Access
- Bulletin Board System (BBS)' for more information.
-
- ----------------------------------------------------------
-
- VIII. Using CodeScreens with CodeBase 4.5
-
- Sequiter's 'CodeScreens 1.0' is an add-on package that
- contains screen management functions for DOS applications.
- Owners of CodeBase 4.2 can also have access to these
- functions through CodeBase 4.2. Select the '4.2 UPGRADE'
- install option for further information. If you are
- interested in obtaining this screen management library,
- please contact Sequiter Software for more information.
-
- If you have purchased either CodeScreens 1.0 or
- CodeBase 4.2, you may use the DOS screen utilities
- available through those products with CodeBase 4.5.
-
- There are currently two versions of CodeScreens:
- CodeScreens 1.0 and CodeScreens 1.01. Both have equivalent
- functionality, but CodeScreens 1.01 has been customized for
- compatibility with CodeBase 4.5. The supplied 1.01 libraries
- and header files may be used with CodeBase 4.5 without modifi-
- cations. Users of CodeScreens 1.0 can still use their version
- with CodeBase 4.5, but the modifications discussed below must
- be carefully made before use.
-
- CodeScreens 1.0 functions are used by creating a separate
- library, 'W4.LIB', which contains the screen functions.
- However, there are certain source files that must replace the
- original source files. These are supplied with CodeBase 4.5
- and are located with the 4.2 upgrade files. If you did not
- install the upgrade files, please see 'INSTALL.DOC' for manual
- install instructions.
-
-
- Note that CodeScreens functions are also found contained
- within CodeBase 4.2. If you have CodeBase 4.2, the following
- directions may also be succesfully used. More information
- can also be found in the document file, '42UPGRAD.DOC'.
-
- As noted, you must replace certain CodeScreens (or
- CodeBase 4.2) files. The files are:
-
- P4MISC.H
- C4.C (with C4_F.C)
- G4.C
- H4.C
- N4.C
- P4MISC.C
- U4NAME.C (with U4NAME_F.C)
- W4.C
-
- The files replace all occurrences of the function
- 'H4CREATE' with 'H45CREATE'. This is necessary because
- CodeBase 4.5 also has a function with this name, and
- there cannot be two functions with the same name used
- with an application. Also, some functions are duplicated
- within CodeBase 4.5. If these duplicate functions are
- left in the CodeScreens library, linking errors will
- occur when using Microsoft compilers to link your application
- with the CodeBase 4.5 library and the CodeScreens library.
- These functions have been removed from the above source code.
-
- You must also change the prototype declaration for
- 'H4CREATE' in the 'D4ALL.H' (4.2 or CodeScreens) header file:
-
- Edit line 169 (or 165) of 'D4ALL.H'
-
- From:
- int h4create( char **, int, int, int) ;
-
- To:
- int h45create( char **, int, int, int) ;
-
- Also, some older versions of CodeBase 4.2 or CodeScreens
- have a different prototype for functions 'h4alloc' and
- 'h4alloc_try' in file h4.c. Please check file 'd4all.h',
- around lines 163 and 164, and correct if necessary:
-
- From:
- char * h4alloc( int ) ;
- char * h4alloc_try( int ) ;
-
- To:
- char * h4alloc( unsigned ) ;
- char * h4alloc_try( unsigned ) ;
-
-
- After replacement, compile the 'W4.LIB' using one of the
- batch files provided with CodeBase 4.5. The batch files are
-
- named "?4SCRN.BAT", where '?' is replaced by a specific letter
- denoting the compiler used. These batch files are included with
- the '42 UPGRADE' files.
-
- When using any screen function, remember to include 'W4.H'
- at the top of your program. 'W4.H' can be found with
- CodeScreens or CodeBase 4.2.
-
- There are also provided batch files that can be used to
- compile and link a CodeBase 4.5. application using screen
- functions. These are named "C4?C.BAT", where '?' is replaced
- by a specific letter denoting the compiler used.
-
- The screen functions available are the following:
-
- C4...
- G4...
- N4...
- W4...
-
- Please consult your CodeBase 4.2 or CodeScreens manual for
- the descriptions and use of these functions.
-
- ----------------------------------------------------------
-
- IX. The CodeBase Public-Access Bulletin Board System (BBS)
-
- Any user with a modem may connect with the Sequiter
- Bulletin Board System. Connection to the BBS is free,
- although all users are responsible for their own long-
- distance toll charges. The BBS operates twenty-four hours
- a day, seven days-a-week, excluding maintenance periods.
- The BBS operates under the DOS environment, running
- WildCat(c) communications software.
-
- The BBS contains several CodeBase-related files and
- documents that may be downloaded. There is also a message
- system so that electronic correspondence may be left for
- Sequiter staff, or other BBS users. The files include example
- programs, utilities, add-ons and enhancements, written by
- both Sequiter developers and CodeBase users. Users are
- invited to upload interesting CodeBase-related files for the
- use of all BBS users. A list of the latest enhancements, fixes
- and additions for all Sequiter products is also maintained on
- the Sequiter BBS. Users are encouraged to periodically
- download these files, and make the appropriate changes.
-
- The phone number for the BBS is found on the back outside
- cover of the CodeBase manual. The phone number is currently
- (403)-437-2229.
-
- Settings for the connection are:
-
- 1200, 2400 or 9600 baud
- ANSI terminal type.
-
- No parity.
- 8 bits.
- 1 stop bit.
-
- Upon connection to the Sequiter BBS, a new user will be
- prompted for some information and the selection of a private
- password. After selection of your password, please memorize
- it since you will be asked for that password on future
- connections to the BBS.
-
- ----------------------------------------------------------
-
- X. Accessing More Than 20 Files in DOS or Windows.
-
- Due to a default imposed by most compilers and DOS, no more
- than twenty files can be opened during the execution of any
- one single process by default. And since the file streams 'stdout',
- 'stprn', 'stdin', 'stderr' and 'stdaux' count as files, and
- your executing application counts as well, this leaves only
- fourteen database, index and memo files that are allowed to
- be opened by any one application. CodeBase has no inherent
- limit to the number of files opened, but will display an error
- because of the failure of the system function call 'sopen()'.
-
- Several compilers have patches available for increasing the
- file limit. However, because of the nature of these patches,
- Sequiter does not provide technical support regarding this issue.
- Please consult your compiler's manufacturer for information.
- Again, CodeBase has no inherent file limit, but will produce
- an error message when it receives an 'error' return from any
- C library function that is called.
-
- Don't forget to increase the number of file handles in your
- CONFIG.SYS file. To open more than 20 files (eg. 100), you
- need to also modify your CONFIG.SYS file :
-
- eg. set 'FILES=100'
-
-
- Please note the above config.sys setting will only affect
- files opened on your local drives. If you are operating on
- a network drive, note that there is a default setting to the
- number of files specified by your network software. For example,
- Novell's default setting is 40 files. If you want to increase
- this limit in Novell, create or edit the file 'SHELL.CFG',
- which should be located together with 'IPX.COM' and 'NETX.COM'.
- Add 'FILEHANDLES = n', where 'n' is the maximum number of
- file handles required, into SHELL.CFG. Other LAN software
- users should consult their LAN documentation.
-
- Under MicroSoft Windows 3.x, you need to also make a call
- to the function SetHandleCount (eg. SetHandleCount( 100 )).
- If you are using CodeBase 4.5 as a DLL, then you need to add
- this function call to the beginning of the d4init function in
- c4code.c. This requires you to alter the source code, then
-
- to rebuild the DLL and its import library. If you are using
- CodeBase statically, then all you need to do is add the
- 'SetHandleCount()' function call to your application program.
-
- General outines of the patches provided by the more popular
- compilers is provided below. This includes MicroSoft C 6.00a
- and 7.0, Borland C++ 2.0 and 3.0, Turbo C++ 1.01 and Turbo C 2.0.
-
- Microsoft C patch:
- ------------------
-
- By default, MicroSoft is hardcoded to only allow 20 file handles.
- This limit can be increased by altering the 'startup' code in
- MicroSoft C and is outlined in the 'readme.doc' file supplied with
- MicroSoft C.
-
- You will need to alter the following files:
-
- _FILE.C (source\startup)
- crt0dat.asm (source\startup\dos)
-
- 1. _FILE.C :
- line 18 : from : #define _NFILE_ 20
- to : #define _NFILE_ 100
-
- crt0dat.asm :
- line 17 : from : _NFILE_ = 20
- to : _NFILE_ = 100
-
- line 259 : (comment this line out)
- line 731 : (comment this line out)
- - these were commented out because of
- an unresolved external. This didn't
- seem to affect the example.
-
- line 319 - 321 : (uncomment these lines)
-
- 2. Compile _FILE.C and crt0dat.asm :
-
- cl -c -AL -W2 -Gsw -Owd _FILE.C
- masm -Mx -Dmem_L crt0dat.asm
-
- 3. The compiled .OBJs need to be put in the appropriate library.
-
- DLL : lib ldllcew-+_FILE;
- lib ldllcew-+crt0dat;
-
- NONDLL : lib llibcew-+_FILE;
- lib llibcew-+crt0dat;
-
-
- Borland C++ 2.0, Turbo C++ 1.01 and Turbo C 2.0 patch:
- ------------------------------------------------------
-
- Borland provides patches for both Borland C++ 2.0 and 3.0. This
-
- patch is not for Borland C++ 3.0. See the next section for the
- Borland C++ 3.0 patch.
-
- To increase the number of file handles to 50 under Borland
- compilers simply include the file "filehand.c" in your project
- file (Turbo C 2.0 users must call the function setup() from
- main). If you wish the number of file handles to be different
- then 50 than simply modify the define value at the beginning
- of "filehand.c".
-
- Note that in order for this method to work you must use
- _close() instead of close(). Therefore in all versions of
- CodeBase so far it is necessary to modify the CodeBase source
- code so that close()'s are changed to _close()'s.
-
- So far this fix has been tested using Borland C++ 2.0
- on a simple program that opens 50 files locally without CodeBase
- and on the CodeBase 4.2 test programs. It has not been tested
- over the network yet.
-
- #include <fcntl.h>
- #include <dos.h>
-
- #define MAX_HANDLES 50
-
- void set_up(void)
- {
- unsigned int _openfd[MAX_HANDLES];
- int j;
-
- /* initialize table of handles and the first five reserved ones */
- /* STDIN, STDOUT, STDPRN, STDAUX, STDERR */
-
- _openfd[0] = O_RDONLY | O_DEVICE;
- _openfd[1] = O_WRONLY | O_DEVICE;
- _openfd[2] = O_WRONLY | O_DEVICE;
- _openfd[3] = O_RDWR | O_DEVICE | O_BINARY;
- _openfd[4] = O_WRONLY | O_DEVICE | O_BINARY;
-
- /* fill remaining slots with -1 (0xFF) so DOS knows they're
- available */
- for (j=5; j < MAX_HANDLES; j++)
- _openfd[j] = 0xFF;
-
- /* DOS function 58h to set allocation strategy to LAST_FIT.
- FIRST_FIT - 00h
- BEST_FIT - 01h
- LAST_FIT - 02h
- */
- _AH = 0x58;
- _AL = 1;
- _BX = 2;
- geninterrupt(0x21); /* call DOS */
-
- /* set DOS handle count with function 67h only
-
- available in DOS >= 3.3 */
- _AH = 0x67;
- _BX = MAX_HANDLES;
- geninterrupt(0x21); /* call DOS */
-
- /* DOS function 58h to set allocation strategy to FIRST_FIT */
- _AH = 0x58;
- _AL = 1;
- _BX = 0;
- geninterrupt(0x21); /* call DOS */
- }
-
- #ifdef __TURBOC__ == 0x18D
- In order to fix Turbo C 2.0 you must make an explicit function call
- to setup() at the beginning of main() (comment out these lines)
- #else
- #ifdef __TURBOC__ == 0x400
- This fix does not work with Borland C++ 3.0. It only works on
- Turbo C 2.0, Turbo C++ 1.01, and Borland C++ 2.0
- #else
- #pragma startup set_up 64 /* automatically invokes set_up() at
- program startup for Turbo C++ 1.01
- and Borland C++ 2.0 */
- #endif
- #endif
-
-
- Borland C++ 3.0 patch:
- ----------------------
-
- This patch was obtained directly from Borland International Inc.
- This patch involves changes to three files from the RTL ( Run-Time
- Library ): _NFILE.H, FILES.C and FILES2.C .
-
- Please note that this fix has not been extensively tested
- by Sequiter.
-
-
- 1. _NFILE.H:
-
- // _NFILE.H
- // Copyright (C) 1992 Borland International, Inc.
- // All Rights Reserved
-
- // Maximum number of open FILES
- #define _NFILE_ 20
-
- //........................................................
-
-
- 2. FILES.C:
-
- // FILES.C
- // Copyright (C) 1992 Borland International, Inc.
- // All Rights Reserved
-
-
-
- #include <stdio.h>
- #include <_nfile.h>
-
- #define _F_STDIN (_F_READ | _F_TERM | _F_LBUF)
- #define _F_STDOUT (_F_WRIT | _F_TERM | _F_LBUF)
- #define _F_STDERR (_F_WRIT | _F_TERM)
- #define _F_STDAUX (_F_RDWR | _F_TERM | _F_BIN)
- #define _F_STDPRN (_F_WRIT | _F_TERM | _F_BIN)
-
- #if !defined( _RTLDLL )
-
- file _streams [_NFILE_] =
- {
- {0, _F_STDIN, 0, 0, 0, NULL, NULL, O, (short) stdin},
- {0, _F_STDOUT, 1, 0, 0, NULL, NULL, O, (short) stdout},
- {0, _F_STDERR, 2, 0, 0, NULL, NULL, O, (short) stderr},
- {0, _F_STDAUX, 3, 0, 0, NULL, NULL, O, (short) stdaux},
- {0, _F_STDPRN, 4, 0, 0, NULL, NULL, O, (short) stdprn}
- } ;
-
- #endif // _RTLDLL
-
- //........................................................
-
-
- 3. FILES2.C:
-
- // FILES2.C
- // Copyright (C) 1992 Borland International, Inc.
- // All Rights Reserved
-
-
- #include <io.h>
- #include <fcntl.h>
- #include <_nfile.h>
-
- unsigned _nfile = _NFILE_ ;
-
- unsigned int _openfd[_NFILE_] =
- {
- O_RDONLY | O_DEVICE | O_TEXT,
- O_WRONLY | O_DEVICE | O_TEXT,
- O_WRONLY | O_DEVICE | O_TEXT,
- O_RDWR | O_DEVICE | O_BINARY,
- O_WRONLY | O_DEVICE | O_BINARY
- } ;
-
- //........................................................
-
- You will now have to replace the files FILES.C and FILES2.C in
- the standard library with the patched files. You must first compile
- FILES.C and FILES2.C. You can do this as follows:
-
-
- bcc -c -mX FILES.C FILES2.C
-
- where the X in -mX is the memory model being used. Each memory
- model used must have these changes made to each repective memory model
- library.
-
- Now link the new modules into the library. For example, the large
- model link would be:
-
- tlib m4.lib +-FILES.OBJ +-FILES2.OBJ
-
-
- Once completed, you should now be able to open more than twenty
- files.
-
- ------ END ------
-