home *** CD-ROM | disk | FTP | other *** search
-
-
-
- $read.me (c)Copyright Sequiter Software Inc., 1992-1993.
- All rights reserved.
- ----------------------------------------------------------
-
- README - Table of Contents
-
- I. Introduction
-
- II. CodeBase Electronic Documentation Files.
-
- III. CodeBase Manual and Code Revisions.
-
- IV. CodeBase Interactive for DOS
-
- V. Examples.
-
- VI. Using CodeScreens with CodeBase 5.0.
-
- VII. CodeBase Public-Access Bulletin Board System.
-
- VIII. 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.
-
- 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 5.0 portability
- version, or CodeScreens, contact Sequiter Software Inc.
-
- ----------------------------------------------------------
-
- 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.
-
- PORT.DOC Important information when using the CodeBase 5.0
- portability version. Not included with the
- CodeBase 5.0 DOS/WINDOWS version. Located on
- ANSI and K&R diskettes.
-
- CODEREP.DOC Further information on CodeReporter. Includes
- important information regarding the building of
- the CodeReporter launch utility executables.
-
- COMPILER DOCUMENTATION:
-
- COMPILER.DOC Borland Turbo C++ 1.01 specific information.
-
- EXAMPLES.DOC Information on usage of the provided source code
- examples.
-
- TEST.DOC Information on usage of the CodeBase test
-
- programs
-
- 45UPGRAD.DOC CodeBase 4.5 to 5.0 translation information.
-
- ----------------------------------------------------------
-
- III. CodeBase Manual and Code Revisions
-
- Following are corrections to the CodeBase 5.0 printed documentation:
-
-
- CODEBASE 5.0 REFERENCE GUIDE:
-
- 1. Conditional Compilation Switch addendum (page 8)
- New Conditional Compilation Switch. 'S4FLUSH' may be defined
- if a hard-flush is required when writing data to disk:
-
- S4FLUSH This switch automatically calls function file4flush()
- whenever a write() occurs. It is set automatically
- whenever S4WINDOWS, S4DLL or S4DLL_BUILD is defined.
- This switch is not usually required, since a write()
- should perform a flush, but some environments do not
- flush data immediately. S4FLUSH is meant to be used
- with these environments. See function file4flush().
-
-
- 2. CODE4.lock_attempts Clarification (page 17)
-
- If CODE4.lock_attempts is greater than zero, it is the
- number of times a CodeBase function will attempt to lock before
- returning r4locked.
-
- If CODE4.lock_attempts is (int) -1, CodeBase retries until
- it succeeds.
-
- Any other value for CODE4.lock_attempts is undefined.
-
-
- 3. file4flush() (page 162)
-
- The 'NOTE' at the bottom of the page is incorrect. S4WINDOWS
- does not have to be defined. file4flush() may be used under DOS
- or other operating systems.
-
-
- 4. relate4lock() (page 226)
-
- Under 'Usage', please note that the return value of relate4lock()
- is of type 'int'.
-
- Usage: int relate4lock( RELATE4 *relate )
-
-
- 5. The Comparison Function (page 238)
-
-
- At the bottom of the page is a small table with 'Return' and
- 'Meaning' headings. The '> 0' return should instead read:
-
- > 0 The value pointed to by p1 is greater than p2.
-
-
- 6. e4hook() (page 319)
-
- 'Description', third paragraph. The reference to switch 'S4HOOK'
- should instead be 'S4ERROR_HOOK':
-
- Consequently, to turn off error reporting, just define
- 'S4ERROR_HOOK' and do nothing else.
-
-
- 7. e4severe() (page 320)
-
- The parameter listing under 'Usage' should not include
- parameter 'CODE4':
-
- Usage: void e4severe( int err_code, char *desc )
-
-
-
- CODEBASE SOURCE CODE CHANGES:
-
- Note: Notices of fixes to CodeBase 5.0 will be
- updated on files contained on Sequiter's BBS system.
- For more information, refer to section
- "CodeBase Public-Access Bulletin Board System."
-
- ----------------------------------------------------------
-
- IV. CodeBase Interactive for DOS
-
- Interactive CodeBase 5.0 for DOS is a CodeBase application
- that allows the interactive manipulation of databases.
- 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. Two DOS Interactive CodeBase executables are currently
- provided. They are intended for either dBASE IV or FoxPro file
- formats. Other file formats are supported, but must be recompiled.
-
- 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 DATA4 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 CODE4.safety to FALSE
-
- -select the CODE4 menu.
- -use the cursor keys to move the highlighting over CODE4.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 5.0 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.
-
- ----------------------------------------------------------
-
- V. Examples
-
- There are four sources of CodeBase 5.0 examples:
-
- 1. The manual, for short examples of function (and class)
- usage.
-
- 2. The examples present on the CodeBase 5.0 diskette.
- All examples installed are placed on the CodeBase
- \EXAMPLES subdirectory. Examples from the manual
- can be found in \EXAMPLES\MANUAL.
-
- 3. The testing and diagnostic code. These programs test
- the important CodeBase functions, and can also be
- used to ensure that CodeBase 5.0 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.
-
- ----------------------------------------------------------
-
- VI. Using CodeScreens with CodeBase 5.0
-
- Sequiter's 'CodeScreens 1.0' is an add-on package that
- contains screen management functions for DOS applications.
- If you are interested in obtaining this screen management
- library, please contact Sequiter Software for more
- information.
-
- You must have at least CodeScreens version 1.02. Owners
- of previous versions can contact Sequiter for upgrade
- information.
-
- CodeScreens 1.02 functions are used by creating a separate
- library, 'W4.LIB', which contains the screen functions.
-
- When using any screen function, remember to include 'W4.H'
- at the top of your program. 'W4.H' can be found with
-
- CodeScreens.
-
- There are also provided batch files that can be used to
- compile and link a CodeBase 5.0. application using screen
- functions. These are named "C4?C.BAT", where '?' is replaced
- by a specific letter denoting the compiler used.
-
- ----------------------------------------------------------
-
- VII. 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.
-
- ----------------------------------------------------------
-
- VIII. 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 5.0 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.
-
- 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.
-
- 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".
-
- 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 5.0 test programs. It has not been tested
- over the network yet.
-
-
- // * * * filehand.c * * *
-
- #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 one file from the RTL ( Run-Time
- Library ): _NFILE.H
-
- A change to this file affects these files: FILES.C and FILES2.C .
- Therefore, FILES.C and FILES2.C must be recompiled and re-linked.
-
- 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 /* change 20 to larger value */
-
- //........................................................
-
-
- 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.
-
- eg. For large model usage:
-
- bcc -c -ml FILES.C FILES2.C
-
-
-
- Now link the new modules into the library. For example, the large
- model link would be:
-
- tlib cX.lib -+FILES.OBJ -+FILES2.OBJ
- tlib cwX.lib -+FILES.OBJ -+FILES2.OBJ
-
- where the X is the memory model being used. Each memory
- model used must have these changes made to each repective memory model
- library.
-
- eg. For large model usage:
-
- tlib cl.lib -+FILES.OBJ -+FILES2.OBJ
- tlib cwl.lib -+FILES.OBJ -+FILES2.OBJ
-
-
- Both of these lines should be executed. 'CL.LIB' is a Borland DOS
- library, and 'CWL.LIB' is a Borland Windows library.
-
- Once completed, you should now be able to open more than twenty
- files.
-
- ------ END ------
-