home *** CD-ROM | disk | FTP | other *** search
- From: zeppelin@login.dknet.dk (Thomas B. Pedersen)
- Newsgroups: comp.sources.misc
- Subject: v44i064: typhoon - Typhoon Relational Database Management System, Part08/09
- Date: 17 Sep 1994 21:45:58 -0500
- Organization: Sterling Software
- Sender: kent@sparky.sterling.com
- Approved: kent@sparky.sterling.com
- Message-ID: <35g9l6$ojp@sparky.sterling.com>
- X-Md4-Signature: d51d04476a538da46c340f1f3a1a68ce
-
- Submitted-by: zeppelin@login.dknet.dk (Thomas B. Pedersen)
- Posting-number: Volume 44, Issue 64
- Archive-name: typhoon/part08
- Environment: SCO UNIX, Tandem NonStop UNIX, Sun Solaris, AIX, Linux, OS/2
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: typhoon/examples/demo.ddl typhoon/makefile
- # typhoon/man/d_crread.1 typhoon/man/d_fillnew.1
- # typhoon/man/d_keyfind.1 typhoon/man/d_keyfrst.1
- # typhoon/man/d_keylast.1 typhoon/man/d_keynext.1
- # typhoon/man/d_keyprev.1 typhoon/man/d_open.1
- # typhoon/man/d_recfrst.1 typhoon/man/d_recnext.1
- # typhoon/man/d_recwrite.1 typhoon/man/ddlp.1 typhoon/src/bt_io.c
- # typhoon/src/catalog.h typhoon/src/dos.c typhoon/src/makefile
- # typhoon/src/ty_glob.h typhoon/src/util/export.h
- # typhoon/src/util/import.h typhoon/src/util/makefile
- # typhoon/src/util/util.c typhoon/src/util/util.h
- # Wrapped by kent@sparky on Sat Sep 17 21:38:18 1994
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 8 (of 9)."'
- if test -f 'typhoon/examples/demo.ddl' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/examples/demo.ddl'\"
- else
- echo shar: Extracting \"'typhoon/examples/demo.ddl'\" \(1449 characters\)
- sed "s/^X//" >'typhoon/examples/demo.ddl' <<'END_OF_FILE'
- X/*
- X demonstration database
- X*/
- X
- Xdatabase demo {
- X
- X define NAME_LEN 30
- X
- X data file "company.dat" contains company;
- X key file "company.ix1" contains company.id;
- X key file "company.ix2" contains company.references;
- X data file "product.dat" contains product;
- X key file "product.ix1" contains product.name;
- X
- X data file "fancy.dat" contains fancy;
- X key file "fancy.ix1" contains fancy.fancy_key1;
- X key file "fancy.ix2" contains fancy.name;
- X key file "fancy.ix3" contains fancy.fancy_key2;
- X
- X record company {
- X ulong id;
- X char name[NAME_LEN+1];
- X
- X primary key id;
- X }
- X
- X record product {
- X ulong company_id;
- X ushort descr_len;
- X char name[NAME_LEN+1];
- X char description[2000] variable by descr_len;
- X
- X primary key name;
- X foreign key company_id references company
- X on update restrict
- X on delete restrict;
- X }
- X
- X
- X // This record just shows some of the things that are possible in
- X // a ddl-file.
- X
- X record fancy {
- X char name[20];
- X ulong number;
- X
- X char key2_is_null;
- X
- X ushort a_count;
- X struct {
- X char a[2][20];
- X uchar type;
- X
- X union controlled by type {
- X char s[80]; // If type is 0
- X ulong a; // If type is 1
- X struct {
- X int a;
- X long b;
- X } c; // If type is 0
- X } u[2];
- X
- X } a[10] variable by a_count;
- X
- X primary key fancy_key1 { name, number desc };
- X alternate key name null by name;
- X alternate key fancy_key2 { number desc, name } null by key2_is_null;
- X }
- X}
- X
- X/* end-of-file */
- X
- END_OF_FILE
- if test 1449 -ne `wc -c <'typhoon/examples/demo.ddl'`; then
- echo shar: \"'typhoon/examples/demo.ddl'\" unpacked with wrong size!
- fi
- # end of 'typhoon/examples/demo.ddl'
- fi
- if test -f 'typhoon/makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/makefile'\"
- else
- echo shar: Extracting \"'typhoon/makefile'\" \(1689 characters\)
- sed "s/^X//" >'typhoon/makefile' <<'END_OF_FILE'
- X#-----------------------------------------------------------------------------
- X# File : makefile
- X# Library : typhoon
- X# OS : UNIX, OS/2, DOS
- X# Author : Thomas B. Pedersen
- X#
- X# Copyright (c) 1994 Thomas B. Pedersen. All rights reserved.
- X#
- X# Permission is hereby granted, without written agreement and without
- X# license or royalty fees, to use, copy, modify, and distribute this
- X# software and its documentation for any purpose, provided that the above
- X# copyright notice and the following two paragraphs appear (1) in all
- X# source copies of this software and (2) in accompanying documentation
- X# wherever the programatic interface of this software, or any derivative
- X# of it, is described.
- X#
- X# IN NO EVENT SHALL THOMAS B. PEDERSEN BE LIABLE TO ANY PARTY FOR DIRECT,
- X# INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
- X# THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF HE HAS BEEN
- X# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X#
- X# THOMAS B. PEDERSEN SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
- X# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- X# A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
- X# BASIS, AND THOMAS B. PEDERSEN HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
- X# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- X#
- X# Description:
- X# Makefile for Typhoon Relational Database Management System.
- X#
- X# $Id: makefile,v 1.1 1994/09/13 21:29:38 tbp Exp $
- X#
- X# $Log: makefile,v $
- X# Revision 1.1 1994/09/13 21:29:38 tbp
- X# Added to repository.
- X#
- X#
- X# ----------------------------------------------------------------------------
- X
- X
- Xall:
- X cd src; make;
- X cd src/util; make;
- X
- X
- X# end-of-file
- END_OF_FILE
- if test 1689 -ne `wc -c <'typhoon/makefile'`; then
- echo shar: \"'typhoon/makefile'\" unpacked with wrong size!
- fi
- # end of 'typhoon/makefile'
- fi
- if test -f 'typhoon/man/d_crread.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/man/d_crread.1'\"
- else
- echo shar: Extracting \"'typhoon/man/d_crread.1'\" \(1280 characters\)
- sed "s/^X//" >'typhoon/man/d_crread.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X.ds iD \\$3 \\$4 \\$5 \\$6 \\$7
- X..
- X.Id $Id: d_crread.1,v 1.1 1994/09/13 21:29:54 tbp Exp $
- X.ds r \s-1TYPHOON\s0
- X.if n .ds - \%--
- X.if t .ds - \(em
- X.TH D_CRREAD 1 \*(Dt TYPHOON
- X.SH NAME
- Xd_crread \- read a field from the current record
- X.SH SYNOPSIS
- X.B #include <typhoon.h>
- X.br
- X
- X\fBd_crread(ulong \fPfieldid\fB, void *\fPbuf\fB)
- X.SH DESCRIPTION
- X\fBd_crread\fP copies the contents of the field specified by \fIfieldid\fP
- Xinto the buffer \fIbuf\fP. If the field is a variable length field, only
- Xthe actual number of bytes in the field is copied.
- X.br
- X.SH DIAGNOSTICS
- XThe status code returned by the function is also stored in the global
- Xvariable \fIdb_status\fP.
- X.TP
- X.B S_OKAY
- XOperation successful.
- X.TP
- X.B S_NOCD
- XThere is no current database.
- X.TP
- X.B S_NOCR
- XThere is no current record.
- X.TP
- X.B S_INVFLD
- XThe id is not a valid field.
- X.SH CURRENCY CHANGES
- XNone.
- X.SH EXAMPLE
- X/* Get Pedersen's account number */
- X.br
- X
- X#include <typhoon.h>
- X.br
- X
- Xif( d_keyfind(CUSTOMER_NAME, "Pedersen") == S_OKAY )
- X.br
- X{
- X.br
- X unsigned long account;
- X.br
- X d_crread(CUSTOMER_ACCOUNT, &account);
- X printf("Account number %lu\\n", account);
- X.br
- X}
- X.SH IDENTIFICATION
- XAuthor: Thomas B. Pedersen.
- X.br
- XCopyright (c) 1994 Thomas B. Pedersen.
- X.SH "SEE ALSO"
- Xd_recread(1), d_keyread(1)
- END_OF_FILE
- if test 1280 -ne `wc -c <'typhoon/man/d_crread.1'`; then
- echo shar: \"'typhoon/man/d_crread.1'\" unpacked with wrong size!
- fi
- # end of 'typhoon/man/d_crread.1'
- fi
- if test -f 'typhoon/man/d_fillnew.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/man/d_fillnew.1'\"
- else
- echo shar: Extracting \"'typhoon/man/d_fillnew.1'\" \(1650 characters\)
- sed "s/^X//" >'typhoon/man/d_fillnew.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X.ds iD \\$3 \\$4 \\$5 \\$6 \\$7
- X..
- X.Id $Id: d_fillnew.1,v 1.1 1994/09/13 21:29:56 tbp Exp $
- X.ds r \s-1TYPHOON\s0
- X.if n .ds - \%--
- X.if t .ds - \(em
- X.TH D_FILLNEW 1 \*(Dt TYPHOON
- X.SH NAME
- Xd_fillnew \- insert a new record
- X.SH SYNOPSIS
- X.B #include <typhoon.h>
- X.br
- X
- X\fBd_fillnew(ulong \fPrecid\fB, void *\fPbuf\fB)
- X.SH DESCRIPTION
- X\fBd_fillnew\fP inserts a new record in a table. \fIrecid\fP specifies the
- Xtype of the record stored in \fIbuf\fP. The inserted record retains the
- Xsame database address throughout its life in the database.
- X.SH DIAGNOSTICS
- XThe status code returned by the function is also stored in the global
- Xvariable \fIdb_status\fP.
- X.TP
- X.B S_OKAY
- XThe record was successfully inserted.
- X.TP
- X.B S_NOCD
- XThere is no current database.
- X.TP
- X.B S_INVREC
- XThe record id is not valid.
- X.TP
- X.B S_DUPLICATE
- XOne of the keys in the record would cause duplicates in a unique index.
- X\fIdb_subcode\fP contains the id of the conflicting field or key.
- X.TP
- X.B S_RECSIZE
- XA length determinator of a variable length field contained a illegal
- Xvalue. \fIdb_subcode\fP contains the id of the conflicting field.
- X.TP
- X.B S_FOREIGN
- XThe target of a foreign key could not be found. \fIdb_subcode\fP contains
- Xthe id of the target table.
- X.SH CURRENCY CHANGES
- XIf \fBd_fillnew\fP returned \fBS_OKAY\fP the record becomes the current record.
- X.SH EXAMPLE
- X#include <typhoon.h>
- X
- Xstruct customer cust;
- X.br
- Xstrcpy(cust.name, "Pedersen");
- X.br
- Xcust.account = 10002;
- Xif( d_fillnew(CUSTOMER, &cust) != S_OKAY )
- X.br
- X /* handle error */
- X.SH IDENTIFICATION
- XAuthor: Thomas B. Pedersen.
- X.br
- XCopyright (c) 1994 Thomas B. Pedersen.
- X.SH "SEE ALSO"
- Xd_recwrite(1)
- X
- END_OF_FILE
- if test 1650 -ne `wc -c <'typhoon/man/d_fillnew.1'`; then
- echo shar: \"'typhoon/man/d_fillnew.1'\" unpacked with wrong size!
- fi
- # end of 'typhoon/man/d_fillnew.1'
- fi
- if test -f 'typhoon/man/d_keyfind.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/man/d_keyfind.1'\"
- else
- echo shar: Extracting \"'typhoon/man/d_keyfind.1'\" \(1890 characters\)
- sed "s/^X//" >'typhoon/man/d_keyfind.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X.ds iD \\$3 \\$4 \\$5 \\$6 \\$7
- X..
- X.Id $Id: d_keyfind.1,v 1.1 1994/09/13 21:29:56 tbp Exp $
- X.ds r \s-1TYPHOON\s0
- X.if n .ds - \%--
- X.if t .ds - \(em
- X.TH D_KEYFIND 1 \*(Dt TYPHOON
- X.SH NAME
- Xd_keyfind \- search an index for a specific key value
- X.SH SYNOPSIS
- X.B #include <typhoon.h>
- X.br
- X
- X\fBd_keyfind(ulong \fPkeyid\fB, void *\fPbuf\fB)
- X.SH DESCRIPTION
- X\fBd_keyfind\fP is used to lookup a record in a table via one of its
- Xindexes. \fIkeyid\fP specifies which index to search and \fIbuf\fP contains
- Xthe value to search for. If the index contains more than
- Xone occurrence of the key value (only possible for non-unique indexes)
- X\fBd_keyfind\fP returns the first one.
- X.br
- X
- XThe id can be either the id of a compound key or a field that is a key
- Xby itself.
- X.br
- X
- XIf the key value was not found, \fBd_keyfind\fP returns \fBS_NOTFOUND\fP.
- XA subsequent call to \fBd_keynext(1)\fP returns next value in the sorting
- Xorder.
- X.br
- X
- XThe actual record is not read from the database until \fBd_recread(1)\fP is
- Xcalled.
- X.SH DIAGNOSTICS
- XThe status code returned by the function is also stored in the global
- Xvariable \fIdb_status\fP.
- X.TP
- X.B S_OKAY
- XThe key value was found.
- X.TP
- X.B S_NOTFOUND
- XThe key value was not found.
- X.TP
- X.B S_NOCD
- XThere is no current database.
- X.TP
- X.B S_INVFLD
- XThe id is not a valid field.
- X.TP
- X.B S_NOTKEY
- XThe field id is not a key itself.
- X.SH CURRENCY CHANGES
- XIf \fBS_OKAY\fP is returned. the record found becomes the current record.
- X.SH EXAMPLE
- X/* Find the customer called 'Pedersen' */
- X.br
- X
- X#include <typhoon.h>
- X.br
- X
- Xif( d_keyfind(CUSTOMER_NAME, "Pedersen") == S_OKAY )
- X.br
- X{
- X.br
- X struct customer cust;
- X.br
- X d_recread(&cust);
- X printf("Account number %lu\\n", cust.account);
- X.br
- X}
- X.SH IDENTIFICATION
- XAuthor: Thomas B. Pedersen.
- X.br
- XCopyright (c) 1994 Thomas B. Pedersen.
- X.SH "SEE ALSO"
- Xd_keynext(1), d_keyprev(1), d_keyfrst(1), d_keylast(1), d_recread(1).
- END_OF_FILE
- if test 1890 -ne `wc -c <'typhoon/man/d_keyfind.1'`; then
- echo shar: \"'typhoon/man/d_keyfind.1'\" unpacked with wrong size!
- fi
- # end of 'typhoon/man/d_keyfind.1'
- fi
- if test -f 'typhoon/man/d_keyfrst.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/man/d_keyfrst.1'\"
- else
- echo shar: Extracting \"'typhoon/man/d_keyfrst.1'\" \(1599 characters\)
- sed "s/^X//" >'typhoon/man/d_keyfrst.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X.ds iD \\$3 \\$4 \\$5 \\$6 \\$7
- X..
- X.Id $Id: d_keyfrst.1,v 1.1 1994/09/13 21:29:57 tbp Exp $
- X.ds r \s-1TYPHOON\s0
- X.if n .ds - \%--
- X.if t .ds - \(em
- X.TH D_KEYFRST 1 \*(Dt TYPHOON
- X.SH NAME
- Xd_keyfrst \- find the first key value in an index
- X.SH SYNOPSIS
- X.B #include <typhoon.h>
- X.br
- X
- X\fBd_keyfrst(ulong \fPkeyid\fB)
- X.SH DESCRIPTION
- X\fBd_keyfrst\fP finds the first key value in the index specified by
- X\fIkeyid\fP. If \fBd_keyfrst\fP returns \fBS_NOTFOUND\fP the index is empty.
- X.br
- X
- XThe id can be either the id of a compound key or a field that is a key
- Xby itself.
- X.br
- X
- XThe actual record is not read from the database until \fBd_recread(1)\fP is
- Xcalled.
- X.SH DIAGNOSTICS
- XThe status code returned by the function is also stored in the global
- Xvariable \fIdb_status\fP.
- X.TP
- X.B S_OKAY
- XThe key value was found.
- X.TP
- X.B S_NOTFOUND
- XThe key value was not found, i.e. the index is empty.
- X.TP
- X.B S_NOCD
- XThere is no current database.
- X.TP
- X.B S_INVFLD
- XThe id is not a valid field.
- X.TP
- X.B S_NOTKEY
- XThe field id is not a key itself.
- X.SH CURRENCY CHANGES
- XIf \fBS_OKAY\fP is returned, the record found becomes the current record.
- X.SH EXAMPLE
- X/* Traverse the customers in alphabetical, ascending order */
- X
- X#include <typhoon.h>
- X.br
- X
- Xd_keyfrst(CUSTOMER_NAME);
- X.br
- X
- Xwhile( db_status == S_OKAY )
- X.br
- X{
- X.br
- X struct customer cust;
- X.br
- X
- X d_recread(&cust);
- X.br
- X printf("%s\\n", cust.name);
- X.br
- X d_keynext(CUSTOMER_NAME);
- X.br
- X}
- X.SH IDENTIFICATION
- XAuthor: Thomas B. Pedersen.
- X.br
- XCopyright (c) 1994 Thomas B. Pedersen.
- X.SH "SEE ALSO"
- Xd_keynext(1), d_keyfind(1), d_keyprev(1), d_keylast(1), d_recread(1).
- X
- END_OF_FILE
- if test 1599 -ne `wc -c <'typhoon/man/d_keyfrst.1'`; then
- echo shar: \"'typhoon/man/d_keyfrst.1'\" unpacked with wrong size!
- fi
- # end of 'typhoon/man/d_keyfrst.1'
- fi
- if test -f 'typhoon/man/d_keylast.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/man/d_keylast.1'\"
- else
- echo shar: Extracting \"'typhoon/man/d_keylast.1'\" \(1599 characters\)
- sed "s/^X//" >'typhoon/man/d_keylast.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X.ds iD \\$3 \\$4 \\$5 \\$6 \\$7
- X..
- X.Id $Id: d_keylast.1,v 1.1 1994/09/13 21:29:57 tbp Exp $
- X.ds r \s-1TYPHOON\s0
- X.if n .ds - \%--
- X.if t .ds - \(em
- X.TH D_KEYLAST 1 \*(Dt TYPHOON
- X.SH NAME
- Xd_keylast \- find the last key value in an index
- X.SH SYNOPSIS
- X.B #include <typhoon.h>
- X.br
- X
- X\fBd_keylast(ulong \fPkeyid\fB)
- X.SH DESCRIPTION
- X\fBd_keyfrst\fP finds the last key value in the index specified by
- X\fIkeyid\fP. If \fBd_keyfrst\fP returns \fBS_NOTFOUND\fP the index is empty.
- X.br
- X
- XThe id can be either the id of a compound key, or a field that is a key
- Xby itself.
- X.br
- X
- XThe actual record is not read from the database until \fBd_recread(1)\fP is
- Xcalled.
- X.SH DIAGNOSTICS
- XThe status code returned by the function is also stored in the global
- Xvariable \fIdb_status\fP.
- X.TP
- X.B S_OKAY
- XThe key value was found.
- X.TP
- X.B S_NOTFOUND
- XThe key value was not found, i.e. the index is empty.
- X.TP
- X.B S_NOCD
- XThere is no current database.
- X.TP
- X.B S_INVFLD
- XThe id is not a valid field.
- X.TP
- X.B S_NOTKEY
- XThe field id is not a key itself.
- X.SH CURRENCY CHANGES
- XIf \fBS_OKAY\fP is returned, the record found becomes the current record.
- X.SH EXAMPLE
- X/* Traverse the customers in alphabetical, descending order */
- X
- X#include <typhoon.h>
- X.br
- X
- Xd_keylast(CUSTOMER_NAME);
- X.br
- X
- Xwhile( db_status == S_OKAY )
- X.br
- X{
- X.br
- X struct customer cust;
- X.br
- X
- X d_recread(&cust);
- X.br
- X printf("%s\\n", cust.name);
- X.br
- X d_keyprev(CUSTOMER_NAME);
- X.br
- X}
- X.SH IDENTIFICATION
- XAuthor: Thomas B. Pedersen.
- X.br
- XCopyright (c) 1994 Thomas B. Pedersen.
- X.SH "SEE ALSO"
- Xd_keynext(1), d_keyfind(1), d_keyprev(1), d_keylast(1), d_recread(1).
- X
- END_OF_FILE
- if test 1599 -ne `wc -c <'typhoon/man/d_keylast.1'`; then
- echo shar: \"'typhoon/man/d_keylast.1'\" unpacked with wrong size!
- fi
- # end of 'typhoon/man/d_keylast.1'
- fi
- if test -f 'typhoon/man/d_keynext.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/man/d_keynext.1'\"
- else
- echo shar: Extracting \"'typhoon/man/d_keynext.1'\" \(1734 characters\)
- sed "s/^X//" >'typhoon/man/d_keynext.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X.ds iD \\$3 \\$4 \\$5 \\$6 \\$7
- X..
- X.Id $Id: d_keynext.1,v 1.1 1994/09/13 21:29:57 tbp Exp $
- X.ds r \s-1TYPHOON\s0
- X.if n .ds - \%--
- X.if t .ds - \(em
- X.TH D_KEYNEXT 1 \*(Dt TYPHOON
- X.SH NAME
- Xd_keynext \- find the next key value in an index
- X.SH SYNOPSIS
- X.B #include <typhoon.h>
- X.br
- X
- X\fBd_keynext(ulong \fPkeyid\fB)
- X.SH DESCRIPTION
- X\fBd_keynext\fP finds the next key value greater than or equal to the
- Xcurrent key value in the index specified by
- X\fIkeyid\fP. If \fBd_keynext\fP returns \fBS_NOTFOUND\fP the end of the index
- Xhas been passed. A subsequent call to \fBd_keynext\fP will return the first
- Xkey value in the index.
- X.br
- X
- XThe id can be either the id of a compound key or a field that is a key
- Xby itself.
- X.br
- X
- XThe actual record is not read from the database until \fBd_recread(1)\fP is
- Xcalled.
- X.SH DIAGNOSTICS
- XThe status code returned by the function is also stored in the global
- Xvariable \fIdb_status\fP.
- X.TP
- X.B S_OKAY
- XThe key value was found.
- X.TP
- X.B S_NOTFOUND
- XThe key value was not found, i.e. the index is empty.
- X.TP
- X.B S_NOCD
- XThere is no current database.
- X.TP
- X.B S_INVFLD
- XThe id is not a valid field.
- X.TP
- X.B S_NOTKEY
- XThe field id is not a key itself.
- X.SH CURRENCY CHANGES
- XIf \fBS_OKAY\fP is returned, the record found becomes the current record.
- X.SH EXAMPLE
- X/* Traverse the customers in alphabetical order */
- X
- X#include <typhoon.h>
- X.br
- X
- Xd_keyfrst(CUSTOMER_NAME);
- X.br
- X
- Xwhile( db_status == S_OKAY )
- X.br
- X{
- X.br
- X struct customer cust;
- X.br
- X
- X d_recread(&cust);
- X.br
- X printf("%s\\n", cust.name);
- X.br
- X d_keynext(CUSTOMER_NAME);
- X.br
- X}
- X.SH IDENTIFICATION
- XAuthor: Thomas B. Pedersen.
- X.br
- XCopyright (c) 1994 Thomas B. Pedersen.
- X.SH "SEE ALSO"
- Xd_keyfind(1), d_keyprev(1), d_keyfrst(1), d_keylast(1), d_recread(1).
- X
- END_OF_FILE
- if test 1734 -ne `wc -c <'typhoon/man/d_keynext.1'`; then
- echo shar: \"'typhoon/man/d_keynext.1'\" unpacked with wrong size!
- fi
- # end of 'typhoon/man/d_keynext.1'
- fi
- if test -f 'typhoon/man/d_keyprev.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/man/d_keyprev.1'\"
- else
- echo shar: Extracting \"'typhoon/man/d_keyprev.1'\" \(1739 characters\)
- sed "s/^X//" >'typhoon/man/d_keyprev.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X.ds iD \\$3 \\$4 \\$5 \\$6 \\$7
- X..
- X.Id $Id: d_keyprev.1,v 1.1 1994/09/13 21:29:58 tbp Exp $
- X.ds r \s-1TYPHOON\s0
- X.if n .ds - \%--
- X.if t .ds - \(em
- X.TH D_KEYPREV 1 \*(Dt TYPHOON
- X.SH NAME
- Xd_keyprev \- find the previous key value in an index
- X.SH SYNOPSIS
- X.B #include <typhoon.h>
- X.br
- X
- X\fBd_keyprev(ulong \fPkeyid\fB)
- X.SH DESCRIPTION
- X\fBd_keyprevf\fP finds the next key value smaller than or equal to the
- Xcurrent key value in the index specified by
- X\fIkeyid\fP. If \fBd_keyprev\fP returns \fBS_NOTFOUND\fP the start of the
- Xindex has been passed. A subsequent call to \fBd_keyprev\fP will return the
- Xlast key value in the index.
- X.br
- X
- XThe id can be either the id of a compound key or a field that is a key
- Xby itself.
- X.br
- X
- XThe actual record is not read from the database until \fBd_recread(1)\fP is
- Xcalled.
- X.SH EXAMPLE
- X/* Traverse the customers in alphabetical, descending order */
- X
- X#include <typhoon.h>
- X.br
- X
- Xd_keylast(CUSTOMER_NAME);
- X.br
- X
- Xwhile( db_status == S_OKAY )
- X.br
- X{
- X.br
- X struct customer cust;
- X.br
- X
- X d_recread(&cust);
- X.br
- X printf("%s\\n", cust.name);
- X.br
- X d_keyprev(CUSTOMER_NAME);
- X.br
- X}
- X.SH DIAGNOSTICS
- XThe status code returned by the function is also stored in the global
- Xvariable \fIdb_status\fP.
- X.TP
- X.B S_OKAY
- XThe key value was found.
- X.TP
- X.B S_NOTFOUND
- XThe key value was not found, i.e. the index is empty.
- X.TP
- X.B S_NOCD
- XThere is no current database.
- X.TP
- X.B S_INVFLD
- XThe id is not a valid field.
- X.TP
- X.B S_NOTKEY
- XThe field id is not a key itself.
- X.SH CURRENCY CHANGES
- XIf \fBS_OKAY\fP is returned, the record found becomes the current record.
- X.SH IDENTIFICATION
- XAuthor: Thomas B. Pedersen.
- X.br
- XCopyright (c) 1994 Thomas B. Pedersen.
- X.SH "SEE ALSO"
- Xd_keyfind(1), d_keynext(1), d_keylast(1), d_recread(1).
- X
- END_OF_FILE
- if test 1739 -ne `wc -c <'typhoon/man/d_keyprev.1'`; then
- echo shar: \"'typhoon/man/d_keyprev.1'\" unpacked with wrong size!
- fi
- # end of 'typhoon/man/d_keyprev.1'
- fi
- if test -f 'typhoon/man/d_open.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/man/d_open.1'\"
- else
- echo shar: Extracting \"'typhoon/man/d_open.1'\" \(1532 characters\)
- sed "s/^X//" >'typhoon/man/d_open.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X.ds iD \\$3 \\$4 \\$5 \\$6 \\$7
- X..
- X.Id $Id: d_open.1,v 1.1 1994/09/13 21:29:58 tbp Exp $
- X.ds r \s-1TYPHOON\s0
- X.if n .ds - \%--
- X.if t .ds - \(em
- X.TH D_OPEN 1 \*(Dt TYPHOON
- X.SH NAME
- Xd_open \- open a database
- X.SH SYNOPSIS
- X.B #include <typhoon.h>
- X.br
- X
- X\fBd_open(char *\fPdbname\fB, char *\fPmode\fB)
- X.SH DESCRIPTION
- X\fBd_open\fP opens a database in either shared or exclusive mode.
- XIf the database does not already exist it is created without warning.
- XThe dbd-file must be placed in the path specified by d_dbdpath(1) and
- Xthe database files must be placed in the path specified by d_dbfpath(1).
- X\fIdbname\fP is the name of the dbd-file without extension.
- X\fImode\fP is "s" or "x" for shared and exclusive mode, respectively.
- X
- XIf \fBd_open\fP returns \fBS_OKAY\fP the database becomes the current
- Xdatabase.
- X
- XIf the database has already been opened by another process in exclusive
- Xmode, d_open returns S_UNAVAIL.
- X.SH DIAGNOSTICS
- XThe status code returned by the function is also stored in the global
- Xvariable \fIdb_status\fP.
- X.TP
- X.B S_OKAY
- XDatabase opened successfully.
- X.TP
- X.B S_NOMEM
- XOut of memory.
- X.TP
- X.B S_INVDB
- XInvalid database name.
- X.TP
- X.B S_FATALIO
- XFatal file i/o error.
- X.TP
- X.B S_UNAVAIL
- XThe database has been opened in exclusive mode by another process.
- X.SH CURRENCY CHANGES
- XThe opened database becomes the current database.
- X.SH IDENTIFICATION
- XAuthor: Thomas B. Pedersen.
- X.br
- XCopyright (c) 1994 Thomas B. Pedersen.
- X.SH "SEE ALSO"
- Xd_dbdpath(1), d_dbfpath(1), d_setfiles(1), d_close(1), d_destroy(1).
- X
- END_OF_FILE
- if test 1532 -ne `wc -c <'typhoon/man/d_open.1'`; then
- echo shar: \"'typhoon/man/d_open.1'\" unpacked with wrong size!
- fi
- # end of 'typhoon/man/d_open.1'
- fi
- if test -f 'typhoon/man/d_recfrst.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/man/d_recfrst.1'\"
- else
- echo shar: Extracting \"'typhoon/man/d_recfrst.1'\" \(1319 characters\)
- sed "s/^X//" >'typhoon/man/d_recfrst.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X.ds iD \\$3 \\$4 \\$5 \\$6 \\$7
- X..
- X.Id $Id: d_recfrst.1,v 1.1 1994/09/13 21:29:58 tbp Exp $
- X.ds r \s-1TYPHOON\s0
- X.if n .ds - \%--
- X.if t .ds - \(em
- X.TH D_RECFRST 1 \*(Dt TYPHOON
- X.SH NAME
- Xd_recfrst \- find the first record in a table
- X.SH SYNOPSIS
- X.B #include <typhoon.h>
- X.br
- X
- X\fBd_recfrst(ulong \fPrecid\fB)
- X.SH DESCRIPTION
- X\fBd_recfrst\fP finds the first record in the table specified by
- X\fIrecid\fP. If \fBd_recfrst\fP returns \fBS_NOTFOUND\fP the table
- Xis empty.
- X.SH DIAGNOSTICS
- XThe status code returned by the function is also stored in the global
- Xvariable \fIdb_status\fP.
- X.TP
- X.B S_OKAY
- XA record was found.
- X.TP
- X.B S_NOTFOUND
- XThe key value was not found, i.e. the index is empty.
- X.TP
- X.B S_NOCD
- XThere is no current database.
- X.TP
- X.B S_INVREC
- XThe id is not a record id.
- X.SH CURRENCY CHANGES
- XIf \fBS_OKAY\fP is returned, the record found becomes the current record.
- X.SH EXAMPLE
- X/* Traverse the customers in randomorder */
- X
- X#include <typhoon.h>
- X.br
- X
- Xd_recfrst(CUSTOMER);
- X.br
- X
- Xwhile( db_status == S_OKAY )
- X.br
- X{
- X.br
- X struct customer cust;
- X.br
- X
- X d_recread(&cust);
- X.br
- X printf("%s\\n", cust.name);
- X.br
- X d_recnext(CUSTOMER);
- X.br
- X}
- X.SH IDENTIFICATION
- XAuthor: Thomas B. Pedersen.
- X.br
- XCopyright (c) 1994 Thomas B. Pedersen.
- X.SH "SEE ALSO"
- Xd_reclast(1), d_recnext(1), d_recprev(1), d_recread(1).
- X
- END_OF_FILE
- if test 1319 -ne `wc -c <'typhoon/man/d_recfrst.1'`; then
- echo shar: \"'typhoon/man/d_recfrst.1'\" unpacked with wrong size!
- fi
- # end of 'typhoon/man/d_recfrst.1'
- fi
- if test -f 'typhoon/man/d_recnext.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/man/d_recnext.1'\"
- else
- echo shar: Extracting \"'typhoon/man/d_recnext.1'\" \(1317 characters\)
- sed "s/^X//" >'typhoon/man/d_recnext.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X.ds iD \\$3 \\$4 \\$5 \\$6 \\$7
- X..
- X.Id $Id: d_recnext.1,v 1.1 1994/09/13 21:29:59 tbp Exp $
- X.ds r \s-1TYPHOON\s0
- X.if n .ds - \%--
- X.if t .ds - \(em
- X.TH D_RECNEXT 1 \*(Dt TYPHOON
- X.SH NAME
- Xd_recnext \- find the next record in a table
- X.SH SYNOPSIS
- X.B #include <typhoon.h>
- X.br
- X
- X\fBd_recnext(ulong \fPrecid\fB)
- X.SH DESCRIPTION
- X\fBd_recnext\fP finds the next record in the table specified by
- X\fIrecid\fP. If \fBd_recnext\fP returns \fBS_NOTFOUND\fP the table
- Xis empty.
- X.SH DIAGNOSTICS
- XThe status code returned by the function is also stored in the global
- Xvariable \fIdb_status\fP.
- X.TP
- X.B S_OKAY
- XA record was found.
- X.TP
- X.B S_NOTFOUND
- XThe key value was not found, i.e. the index is empty.
- X.TP
- X.B S_NOCD
- XThere is no current database.
- X.TP
- X.B S_INVREC
- XThe id is not a record id.
- X.SH CURRENCY CHANGES
- XIf \fBS_OKAY\fP is returned, the record found becomes the current record.
- X.SH EXAMPLE
- X/* Traverse the customers in randomorder */
- X
- X#include <typhoon.h>
- X.br
- X
- Xd_recfrst(CUSTOMER);
- X.br
- X
- Xwhile( db_status == S_OKAY )
- X.br
- X{
- X.br
- X struct customer cust;
- X.br
- X
- X d_recread(&cust);
- X.br
- X printf("%s\\n", cust.name);
- X.br
- X d_recnext(CUSTOMER);
- X.br
- X}
- X.SH IDENTIFICATION
- XAuthor: Thomas B. Pedersen.
- X.br
- XCopyright (c) 1994 Thomas B. Pedersen.
- X.SH "SEE ALSO"
- Xd_recfrst(1), d_reclast(1), d_recprev(1), d_recread(1).
- X
- END_OF_FILE
- if test 1317 -ne `wc -c <'typhoon/man/d_recnext.1'`; then
- echo shar: \"'typhoon/man/d_recnext.1'\" unpacked with wrong size!
- fi
- # end of 'typhoon/man/d_recnext.1'
- fi
- if test -f 'typhoon/man/d_recwrite.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/man/d_recwrite.1'\"
- else
- echo shar: Extracting \"'typhoon/man/d_recwrite.1'\" \(1568 characters\)
- sed "s/^X//" >'typhoon/man/d_recwrite.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X.ds iD \\$3 \\$4 \\$5 \\$6 \\$7
- X..
- X.Id $Id: d_recwrite.1,v 1.1 1994/09/13 21:30:00 tbp Exp $
- X.ds r \s-1TYPHOON\s0
- X.if n .ds - \%--
- X.if t .ds - \(em
- X.TH D_RECWRITE 1 \*(Dt TYPHOON
- X.SH NAME
- Xd_recwrite \- update the current record
- X.SH SYNOPSIS
- X.B #include <typhoon.h>
- X.br
- X
- X\fBd_recwrite(void *\fPbuf\fB)
- X.SH DESCRIPTION
- X\fBd_recwrite\fP updates the contents of the current record.
- X.SH DIAGNOSTICS
- XThe status code returned by the function is also stored in the global
- Xvariable \fIdb_status\fP.
- X.TP
- X.B S_OKAY
- XThe record was successfully updated.
- X.TP
- X.B S_NOCD
- XThere is no current database.
- X.TP
- X.B S_NOCR
- XThere is no current record.
- X.TP
- X.B S_INVREC
- XThe record id is not valid.
- X.TP
- X.B S_DUPLICATE
- XOne of the keys in the record would cause duplicates in a unique index.
- X\fIdb_subcode\fP contains the id of the conflicting field or key.
- X.TP
- X.B S_RECSIZE
- XA length determinator of a variable length field contained a illegal
- Xvalue. \fIdb_subcode\fP contains the id of the conflicting field.
- X.TP
- X.B S_FOREIGN
- XThe target of a foreign key could not be found. \fIdb_subcode\fP contains
- Xthe id of the target table.
- X.TP
- X.SH CURRENCY CHANGES
- XNone.
- X.SH EXAMPLE
- X#include <typhoon.h>
- X
- Xstruct customer cust;
- X.br
- Xstrcpy(cust.name, "Pedersen");
- X.br
- Xif( d_keyfind(CUSTOMER_NAME, &cust.name) == S_OKAY )
- X.br
- X{
- X.br
- X d_recread(&cust);
- X.br
- X cust.account = 2000;
- X.br
- X if( d_recwrite(&cust) != S_OKAY )
- X.br
- X /* handle error */
- X.br
- X}
- X.SH IDENTIFICATION
- XAuthor: Thomas B. Pedersen.
- X.br
- XCopyright (c) 1994 Thomas B. Pedersen.
- X.SH "SEE ALSO"
- Xd_fillnew(1), d_recread(1)
- END_OF_FILE
- if test 1568 -ne `wc -c <'typhoon/man/d_recwrite.1'`; then
- echo shar: \"'typhoon/man/d_recwrite.1'\" unpacked with wrong size!
- fi
- # end of 'typhoon/man/d_recwrite.1'
- fi
- if test -f 'typhoon/man/ddlp.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/man/ddlp.1'\"
- else
- echo shar: Extracting \"'typhoon/man/ddlp.1'\" \(2382 characters\)
- sed "s/^X//" >'typhoon/man/ddlp.1' <<'END_OF_FILE'
- X.de Id
- X.ds Rv \\$3
- X.ds Dt \\$4
- X.ds iD \\$3 \\$4 \\$5 \\$6 \\$7
- X..
- X.Id $Id: ddlp.1,v 1.1 1994/09/13 21:30:01 tbp Exp $
- X.ds r \s-1TYPHOON\s0
- X.if n .ds - \%--
- X.if t .ds - \(em
- X.TH DDLP 1 \*(Dt TYPHOON
- X.SH NAME
- Xddlp \- Data Definition Language Processor
- X.SH SYNOPSIS
- X\fBddlp \fP[\fB-a\fP[1|2|4]] [\fB-f\fP] [\fB-h\fP<file>] file
- X.SH DESCRIPTION
- X\fBddlp\fP processes a ddl-file and generates a dbd-file and a header file
- Xwith structures and ids for records, fields and keys.
- X.br
- X
- XThe \fB-a\fP option sets the structure alignment which must match
- Xthe one used by the C compiler. Specifying the \fB-f\fP
- Xoptions causes \fBddlp\fP to only generate constants for those fields
- Xthat are keys. The \fB-h\fP option overrides the default header file name
- Xby the one specified by the user.
- X.br
- X.SH DATA DEFINITION LANGUAGE GRAMMER
- X.TP
- Xdatabase
- X-> "database" name "{" decl {decl} "}"
- X.TP
- Xdecl
- X-> "data" "file" "[" pagesize "]" name "contains"
- X.br
- X name ";"
- X.br
- X| "key" "file" "[" pagesize "]" name "contains"
- X.br
- X name "." name
- X";"
- X.br
- X| "define" name expr
- X.br
- X| "record" name "{" field {field} [key_decls] "}"
- X.br
- X.TP
- Xkey_decls
- X-> primary_key {alternate_key} {foreign_key}
- X.TP
- Xprimary_key
- X-> "primary" "key" name key_def ";"
- X.TP
- Xalternate_key
- X-> "alternate" ["optional"] ["unique"] "key" name
- X.br
- X key_def
- X";"
- X.TP
- Xforeign_key
- X-> "foreign" ["optional"] foreign_keydef name
- X.br
- X "references" name ";"
- X.TP
- Xforeign_keydef
- X-> name
- X| name "{" name { "," name } "}"
- X.TP
- Xkey_def
- X-> "{" key_field { "," key_field } "}"
- X.br
- X "on" "update" action
- X.br
- X "on" "delete" action ";"
- X.TP
- Xkey_field
- X-> name [sortorder]
- X.TP
- Xsortorder
- X-> "asc" | "desc"
- X.TP
- Xaction
- X-> "restrict" | "cascade"
- X.TP
- Xpagesize
- X-> "[" int "]"
- X.TP
- Xfield
- X-> type name [dimension] ";"
- X.TP
- Xdimension
- X-> array {array} [ "variable" "by" name ]
- X.TP
- Xarray
- X-> "[" integer "]"
- X.TP
- Xtype
- X-> int_type
- X.br
- X| "signed" int_type
- X.br
- X| "unsigned" int_type
- X.br
- X| float_type
- X.br
- X| struct_type
- X.TP
- Xint_type
- X-> "char"
- X.br
- X| "int"
- X.br
- X| "long"
- X.TP
- Xfloat_type
- X-> "float"
- X.br
- X| "double"
- X.TP
- Xstruct_type
- X-> struct_head [name] "{" field {field} "}" name
- X.br
- X [dimension]
- X.TP
- Xstruct_head
- X-> "struct"
- X.br
- X| "union"
- X.TP
- Xexpr
- X-> expr "+" expr
- X.br
- X| expr "-" expr
- X.br
- X| expr "/" expr
- X.br
- X| expr "*" expr
- X.br
- X| "(" expr ")"
- X.br
- X| integer
- X.SH IDENTIFICATION
- XAuthor: Thomas B. Pedersen.
- X.br
- XCopyright (c) 1994 Thomas B. Pedersen.
- X.SH "SEE ALSO"
- END_OF_FILE
- if test 2382 -ne `wc -c <'typhoon/man/ddlp.1'`; then
- echo shar: \"'typhoon/man/ddlp.1'\" unpacked with wrong size!
- fi
- # end of 'typhoon/man/ddlp.1'
- fi
- if test -f 'typhoon/src/bt_io.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/src/bt_io.c'\"
- else
- echo shar: Extracting \"'typhoon/src/bt_io.c'\" \(2786 characters\)
- sed "s/^X//" >'typhoon/src/bt_io.c' <<'END_OF_FILE'
- X/*----------------------------------------------------------------------------
- X * File : bt_io.c
- X * Library : typhoon
- X * OS : UNIX, OS/2, DOS
- X * Author : Thomas B. Pedersen
- X *
- X * Copyright (c) 1994 Thomas B. Pedersen. All rights reserved.
- X *
- X * Permission is hereby granted, without written agreement and without
- X * license or royalty fees, to use, copy, modify, and distribute this
- X * software and its documentation for any purpose, provided that the above
- X * copyright notice and the following two paragraphs appear (1) in all
- X * source copies of this software and (2) in accompanying documentation
- X * wherever the programatic interface of this software, or any derivative
- X * of it, is described.
- X *
- X * IN NO EVENT SHALL THOMAS B. PEDERSEN BE LIABLE TO ANY PARTY FOR DIRECT,
- X * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
- X * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF HE HAS BEEN
- X * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X *
- X * THOMAS B. PEDERSEN SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
- X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- X * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
- X * BASIS, AND THOMAS B. PEDERSEN HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
- X * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- X *
- X * Description:
- X * Contains functions for opening and closing B-tree index files.
- X *
- X * Functions:
- X *
- X * $Log: bt_io.c,v $
- X * Revision 1.2 1994/09/17 16:00:12 tbp
- X * typhoon.h and environ.h are now included from <>.
- X *
- X * Revision 1.1 1994/09/13 21:28:29 tbp
- X * Added to repository.
- X *
- X *
- X *--------------------------------------------------------------------------*/
- X
- Xstatic char rcsid[] = "$Id: bt_io.c,v 1.2 1994/09/17 16:00:12 tbp Exp $";
- X
- X
- X#include <string.h>
- X#include <stdio.h>
- X#ifndef UNIX
- X# include <io.h>
- X#else
- X# include <unistd.h>
- X#endif
- X#include <typhoon.h>
- X#include "ty_dbd.h"
- X#include "ty_type.h"
- X#include "btree.h"
- X
- X
- Xix_addr noderead(I, node, page)
- XINDEX *I;
- Xchar *node;
- Xix_addr page;
- X{
- X int i;
- X
- X lseek(I->fh, (long)page * I->H.nodesize, SEEK_SET);
- X if( read(I->fh, node, I->H.nodesize) < I->H.nodesize )
- X return (ix_addr)-1;
- X
- X return page;
- X}
- X
- X
- Xix_addr nodewrite(I, node, page)
- XINDEX *I;
- Xchar *node;
- Xix_addr page;
- X{
- X if( page == NEWPOS )
- X {
- X if( I->H.first_deleted )
- X {
- X page = I->H.first_deleted;
- X lseek(I->fh, (long)I->H.nodesize * page, SEEK_SET);
- X read(I->fh, &I->H.first_deleted, sizeof I->H.first_deleted);
- X }
- X else
- X page = (lseek(I->fh, 0L, SEEK_END) / I->H.nodesize);
- X }
- X
- X lseek(I->fh, (long)page * I->H.nodesize, SEEK_SET);
- X write(I->fh, node, I->H.nodesize);
- X
- X return page;
- X}
- X
- X/* end-of-file */
- END_OF_FILE
- if test 2786 -ne `wc -c <'typhoon/src/bt_io.c'`; then
- echo shar: \"'typhoon/src/bt_io.c'\" unpacked with wrong size!
- fi
- # end of 'typhoon/src/bt_io.c'
- fi
- if test -f 'typhoon/src/catalog.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/src/catalog.h'\"
- else
- echo shar: Extracting \"'typhoon/src/catalog.h'\" \(1794 characters\)
- sed "s/^X//" >'typhoon/src/catalog.h' <<'END_OF_FILE'
- X/*---------- headerfile for catalog.ddl ----------*/
- X/* alignment is 4 */
- X
- X/*---------- structures ----------*/
- Xstruct sys_dissite { /* size 166 */
- X unsigned long id;
- X long last_call;
- X unsigned short tables;
- X char name[21];
- X char nua[17];
- X char udata_len;
- X char udata[16];
- X char up_to_date;
- X char in_error;
- X char spare[99];
- X};
- X
- Xstruct sys_distab { /* size 24 */
- X long id;
- X long site_id;
- X long last_seqno;
- X char tag;
- X char up_to_date;
- X char spare[10];
- X};
- X
- Xstruct sys_distab_key { /* size 8 */
- X long site_id;
- X long id;
- X};
- X
- Xstruct sys_dischange { /* size 53 */
- X unsigned long seqno;
- X long table_id;
- X long recno;
- X unsigned short sites;
- X unsigned char prog_id;
- X char action;
- X unsigned char site[37];
- X};
- X
- Xstruct sys_dischange_key { /* size 8 */
- X long table_id;
- X long recno;
- X};
- X
- Xstruct sys_disprkey { /* size 257 */
- X unsigned short size;
- X unsigned char buf[255];
- X};
- X
- Xstruct sys_disfulltab { /* size 12 */
- X long site_id;
- X unsigned long table_id;
- X unsigned long curr_rec;
- X};
- X
- Xstruct fulltab_key { /* size 8 */
- X long site_id;
- X unsigned long table_id;
- X};
- X
- X/*---------- record names ----------*/
- X#define SYS_DISSITE 1000L
- X#define SYS_DISTAB 2000L
- X#define SYS_DISCHANGE 3000L
- X#define SYS_DISPRKEY 4000L
- X#define SYS_DISFULLTAB 5000L
- X
- X/*---------- field names ----------*/
- X#define SYS_DISSITE_ID 1001L
- X
- X/*---------- key constants ----------*/
- X#define SYS_DISTAB_KEY 1
- X#define SYS_DISCHANGE_KEY 2
- X#define FULLTAB_KEY 3
- X
- X/*---------- integer constants ----------*/
- X#define SITES_MAX 296
- X#define SITEBITMAP_SIZE 37
- X#define SITENAME_LEN 20
- X#define NUA_LEN 16
- X#define UDATA_LEN 16
- X#define KEYSIZE_MAX 255
- END_OF_FILE
- if test 1794 -ne `wc -c <'typhoon/src/catalog.h'`; then
- echo shar: \"'typhoon/src/catalog.h'\" unpacked with wrong size!
- fi
- # end of 'typhoon/src/catalog.h'
- fi
- if test -f 'typhoon/src/dos.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/src/dos.c'\"
- else
- echo shar: Extracting \"'typhoon/src/dos.c'\" \(1804 characters\)
- sed "s/^X//" >'typhoon/src/dos.c' <<'END_OF_FILE'
- X/*----------------------------------------------------------------------------
- X * File : dos.c
- X * Library : typhoon
- X * OS : UNIX, OS/2, DOS
- X * Author : Thomas B. Pedersen
- X *
- X * Copyright (c) 1994 Thomas B. Pedersen. All rights reserved.
- X *
- X * Permission is hereby granted, without written agreement and without
- X * license or royalty fees, to use, copy, modify, and distribute this
- X * software and its documentation for any purpose, provided that the above
- X * copyright notice and the following two paragraphs appear (1) in all
- X * source copies of this software and (2) in accompanying documentation
- X * wherever the programatic interface of this software, or any derivative
- X * of it, is described.
- X *
- X * IN NO EVENT SHALL THOMAS B. PEDERSEN BE LIABLE TO ANY PARTY FOR DIRECT,
- X * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
- X * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF HE HAS BEEN
- X * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X *
- X * THOMAS B. PEDERSEN SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
- X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- X * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
- X * BASIS, AND THOMAS B. PEDERSEN HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
- X * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- X *
- X * Description:
- X * Contiains functions specific to DOS.
- X *
- X * Functions:
- X *
- X * $Log: dos.c,v $
- X * Revision 1.1 1994/09/13 21:28:30 tbp
- X * Added to repository.
- X *
- X *
- X *--------------------------------------------------------------------------*/
- X
- Xstatic char rcsid[] = "$Id: dos.c,v 1.1 1994/09/13 21:28:30 tbp Exp $";
- X
- X
- Xty_openlock()
- X{
- X return 0;
- X}
- X
- X
- Xty_closelock()
- X{
- X return 0;
- X}
- X
- X
- Xty_lock()
- X{
- X return 0;
- X}
- X
- X
- Xty_unlock()
- X{
- X return 0;
- X}
- X
- X/* end-of-file */
- X
- END_OF_FILE
- if test 1804 -ne `wc -c <'typhoon/src/dos.c'`; then
- echo shar: \"'typhoon/src/dos.c'\" unpacked with wrong size!
- fi
- # end of 'typhoon/src/dos.c'
- fi
- if test -f 'typhoon/src/makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/src/makefile'\"
- else
- echo shar: Extracting \"'typhoon/src/makefile'\" \(2254 characters\)
- sed "s/^X//" >'typhoon/src/makefile' <<'END_OF_FILE'
- X#-----------------------------------------------------------------------------
- X# File : makefile
- X# Library : typhoon
- X# OS : UNIX, OS/2, DOS
- X# Author : Thomas B. Pedersen
- X#
- X# Copyright (c) 1994 Thomas B. Pedersen. All rights reserved.
- X#
- X# Permission is hereby granted, without written agreement and without
- X# license or royalty fees, to use, copy, modify, and distribute this
- X# software and its documentation for any purpose, provided that the above
- X# copyright notice and the following two paragraphs appear (1) in all
- X# source copies of this software and (2) in accompanying documentation
- X# wherever the programatic interface of this software, or any derivative
- X# of it, is described.
- X#
- X# IN NO EVENT SHALL THOMAS B. PEDERSEN BE LIABLE TO ANY PARTY FOR DIRECT,
- X# INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
- X# THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF HE HAS BEEN
- X# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X#
- X# THOMAS B. PEDERSEN SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
- X# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- X# A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
- X# BASIS, AND THOMAS B. PEDERSEN HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
- X# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- X#
- X# Description:
- X# Makefile for Typhoon Relational Database Management System.
- X#
- X# $Id: makefile,v 1.3 1994/09/17 16:11:04 tbp Exp $
- X#
- X# $Log: makefile,v $
- X# Revision 1.3 1994/09/17 16:11:04 tbp
- X# Added include directive.
- X#
- X# Added included directive.
- X#
- X# Revision 1.2 1994/09/13 21:36:06 tbp
- X# Compilation of catalog.ddl cannot take place before ddlp has been compiled.
- X#
- X# Revision 1.1 1994/09/13 21:28:31 tbp
- X# Added to repository.
- X#
- X#
- X#-----------------------------------------------------------------------------
- X
- XOBJS = bt_del.o bt_funcs.o bt_io.o bt_open.o cmpfuncs.o os.o \
- X readdbd.o record.o ty_ins.o ty_find.o ty_auxfn.o ty_open.o ty_io.o \
- X unix.o vlr.o ty_refin.o ty_util.o ty_log.o ty_repl.o
- XLIB = libtyphoon.a
- XCFLAGS = -DUNIX -g -Ih
- X
- Xall: $(LIB)
- X
- X$(LIB): $(OBJS)
- X ar r $(LIB) $(OBJS)
- X ranlib $(LIB)
- X
- X#catalog.dbd: catalog.ddl
- X# ddlp -f -hcatalog.h -a4 catalog
- X
- X.c.o:
- X cc -c $(CFLAGS) $<
- X
- X# end-of-file
- END_OF_FILE
- if test 2254 -ne `wc -c <'typhoon/src/makefile'`; then
- echo shar: \"'typhoon/src/makefile'\" unpacked with wrong size!
- fi
- # end of 'typhoon/src/makefile'
- fi
- if test -f 'typhoon/src/ty_glob.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/src/ty_glob.h'\"
- else
- echo shar: Extracting \"'typhoon/src/ty_glob.h'\" \(3068 characters\)
- sed "s/^X//" >'typhoon/src/ty_glob.h' <<'END_OF_FILE'
- X/*----------------------------------------------------------------------------
- X * File : ty_glob.h
- X * Library : typhoon
- X * OS : UNIX, OS/2, DOS
- X * Author : Thomas B. Pedersen
- X *
- X * Copyright (c) 1994 Thomas B. Pedersen. All rights reserved.
- X *
- X * Permission is hereby granted, without written agreement and without
- X * license or royalty fees, to use, copy, modify, and distribute this
- X * software and its documentation for any purpose, provided that the above
- X * copyright notice and the following two paragraphs appear (1) in all
- X * source copies of this software and (2) in accompanying documentation
- X * wherever the programatic interface of this software, or any derivative
- X * of it, is described.
- X *
- X * IN NO EVENT SHALL THOMAS B. PEDERSEN BE LIABLE TO ANY PARTY FOR DIRECT,
- X * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
- X * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF HE HAS BEEN
- X * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X *
- X * THOMAS B. PEDERSEN SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
- X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- X * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
- X * BASIS, AND THOMAS B. PEDERSEN HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
- X * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- X *
- X * Description:
- X * Contains the global variables for the library.
- X *
- X * $Id: ty_glob.h,v 1.1 1994/09/13 21:28:34 tbp Exp $
- X *
- X * $Log: ty_glob.h,v $
- X * Revision 1.1 1994/09/13 21:28:34 tbp
- X * Added to repository.
- X *
- X *
- X *--------------------------------------------------------------------------*/
- X
- X/*---------------------------------- OS/2 ----------------------------------*\
- X *
- X * If Typhoon is compiled as an OS/2 DLL, the functions must be a special
- X * class in order to be known to other programs.
- X *
- X */
- X
- X#ifdef OS2
- X# define INCL_NOPMAPI
- X# include <os2.h>
- X# define FNCLASS APIRET EXPENTRY
- X#else
- X# define FNCLASS
- X# define VAR
- X#endif
- X
- X#ifdef DEFINE_GLOBALS
- X
- XTyphoonGlobals typhoon = {
- X { 0 }, /* dbtab */
- X NULL, /* db */
- X 0, /* do_rebuild */
- X 0, /* dbs_open */
- X 0, /* cur_open */
- X 20, /* max_open */
- X { 0 }, /* curr_keybuf */
- X 0, /* curr_key */
- X -1, /* curr_db */
- X NULL, /* ty_errfn */
- X { '.', DIR_SWITCH, 0 }, /* dbfpath */
- X { '.', DIR_SWITCH, 0 } /* dbdpath */
- X};
- X
- Xint db_status = 0; /* Status code */
- Xlong db_subcode = 0; /* Sub error code */
- X
- X#else
- X
- X
- Xextern TyphoonGlobals typhoon;
- Xextern int db_status;
- Xextern long db_subcode;
- X
- X
- X#endif
- X
- Xextern CMPFUNC keycmp[]; /* Comparison function table */
- X
- X
- X#define DB typhoon.db
- X#define CURR_DB typhoon.curr_db
- X#define CURR_KEY typhoon.curr_key
- X#define CURR_KEYBUF typhoon.curr_keybuf
- X#define CURR_REC typhoon.db->curr_rec
- X#define CURR_RECID typhoon.db->curr_recid
- X#define CURR_BUFREC typhoon.db->curr_bufrec
- X#define CURR_BUFRECID typhoon.db->curr_bufrecid
- X
- X
- X
- X/* end-of-file */
- X
- END_OF_FILE
- if test 3068 -ne `wc -c <'typhoon/src/ty_glob.h'`; then
- echo shar: \"'typhoon/src/ty_glob.h'\" unpacked with wrong size!
- fi
- # end of 'typhoon/src/ty_glob.h'
- fi
- if test -f 'typhoon/src/util/export.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/src/util/export.h'\"
- else
- echo shar: Extracting \"'typhoon/src/util/export.h'\" \(2629 characters\)
- sed "s/^X//" >'typhoon/src/util/export.h' <<'END_OF_FILE'
- X/*----------------------------------------------------------------------------
- X * File : export.h
- X * Program : tyexport
- X * OS : UNIX, OS/2, DOS
- X * Author : Thomas B. Pedersen
- X *
- X * Copyright (c) 1994 Thomas B. Pedersen. All rights reserved.
- X *
- X * Permission is hereby granted, without written agreement and without
- X * license or royalty fees, to use, copy, modify, and distribute this
- X * software and its documentation for any purpose, provided that the above
- X * copyright notice and the following two paragraphs appear (1) in all
- X * source copies of this software and (2) in accompanying documentation
- X * wherever the programatic interface of this software, or any derivative
- X * of it, is described.
- X *
- X * IN NO EVENT SHALL THOMAS B. PEDERSEN BE LIABLE TO ANY PARTY FOR DIRECT,
- X * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
- X * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF HE HAS BEEN
- X * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X *
- X * THOMAS B. PEDERSEN SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
- X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- X * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
- X * BASIS, AND THOMAS B. PEDERSEN HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
- X * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- X *
- X * Description:
- X * Header file for export utility.
- X *
- X * $Id: export.h,v 1.1 1994/09/13 21:28:55 tbp Exp $
- X *
- X * $Log: export.h,v $
- X * Revision 1.1 1994/09/13 21:28:55 tbp
- X * Added to repository.
- X *
- X * Added to repository.
- X *
- X *
- X *--------------------------------------------------------------------------*/
- X
- X#ifdef DEFINE_GLOBALS
- X#define CLASS
- X#define I(x) = x
- X#else
- X#define CLASS extern
- X#define I(x)
- X#endif
- X
- X
- X/*--------------------------- Function prototypes --------------------------*/
- Xint yyerror PRM( (char *fmt ELLIPSIS); )
- X
- Xvoid err_quit PRM( (char * ELLIPSIS); )
- Xvoid GenerateExportSpec PRM( (char *); )
- Xvoid ReadExportSpec PRM( (char *); )
- X
- X
- X/*------------------------------- Constants --------------------------------*/
- X#define FT_INCLUDE 0x8000 /* Set in field[].type if */
- X /* field should be included */
- X /* export. */
- X
- X/*---------------------------- Global variables ----------------------------*/
- XCLASS Dbentry dbd;
- XCLASS char dbd_fname[256];
- XCLASS char spec_fname[256];
- XCLASS int lex_lineno I( 1 ); /* Current line number */
- XCLASS int errors I( 0 ); /* Number of errors */
- XCLASS Header header; /* .dbd file header */
- X
- X#undef CLASS
- X#undef I
- X
- X/* end-of-file */
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- END_OF_FILE
- if test 2629 -ne `wc -c <'typhoon/src/util/export.h'`; then
- echo shar: \"'typhoon/src/util/export.h'\" unpacked with wrong size!
- fi
- # end of 'typhoon/src/util/export.h'
- fi
- if test -f 'typhoon/src/util/import.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/src/util/import.h'\"
- else
- echo shar: Extracting \"'typhoon/src/util/import.h'\" \(2621 characters\)
- sed "s/^X//" >'typhoon/src/util/import.h' <<'END_OF_FILE'
- X/*----------------------------------------------------------------------------
- X * File : import.h
- X * Program : tyimport
- X * OS : UNIX, OS/2, DOS
- X * Author : Thomas B. Pedersen
- X *
- X * Copyright (c) 1994 Thomas B. Pedersen. All rights reserved.
- X *
- X * Permission is hereby granted, without written agreement and without
- X * license or royalty fees, to use, copy, modify, and distribute this
- X * software and its documentation for any purpose, provided that the above
- X * copyright notice and the following two paragraphs appear (1) in all
- X * source copies of this software and (2) in accompanying documentation
- X * wherever the programatic interface of this software, or any derivative
- X * of it, is described.
- X *
- X * IN NO EVENT SHALL THOMAS B. PEDERSEN BE LIABLE TO ANY PARTY FOR DIRECT,
- X * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
- X * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF HE HAS BEEN
- X * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X *
- X * THOMAS B. PEDERSEN SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
- X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- X * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
- X * BASIS, AND THOMAS B. PEDERSEN HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
- X * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- X *
- X * Description:
- X * Header file for tyexport.
- X *
- X * $Id: import.h,v 1.1 1994/09/13 21:28:58 tbp Exp $
- X *
- X * $Log: import.h,v $
- X * Revision 1.1 1994/09/13 21:28:58 tbp
- X * Added to repository.
- X *
- X * Added to repository.
- X *
- X *
- X *--------------------------------------------------------------------------*/
- X
- X#ifdef DEFINE_GLOBALS
- X#define CLASS
- X#define I(x) = x
- X#else
- X#define CLASS extern
- X#define I(x)
- X#endif
- X
- X/*--------------------------- Function prototypes --------------------------*/
- Xint yyerror PRM( (char *fmt ELLIPSIS); )
- X
- Xvoid err_quit PRM( (char * ELLIPSIS); )
- Xvoid GenerateImportSpec PRM( (char *); )
- Xvoid ReadImportSpec PRM( (char *); )
- X
- X/*------------------------------- Constants --------------------------------*/
- X#define FT_INCLUDE 0x8000 /* Set in field[].type if */
- X /* field should be included */
- X /* import. */
- X
- X
- X/*---------------------------- Global variables ----------------------------*/
- XCLASS Dbentry dbd;
- XCLASS char dbd_fname[256];
- XCLASS char spec_fname[256];
- XCLASS int lex_lineno I( 1 ); /* Current line number */
- XCLASS int errors I( 0 ); /* Number of errors */
- XCLASS Header header; /* .dbd file header */
- X
- X#undef CLASS
- X#undef I
- X
- X/* end-of-file */
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- END_OF_FILE
- if test 2621 -ne `wc -c <'typhoon/src/util/import.h'`; then
- echo shar: \"'typhoon/src/util/import.h'\" unpacked with wrong size!
- fi
- # end of 'typhoon/src/util/import.h'
- fi
- if test -f 'typhoon/src/util/makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/src/util/makefile'\"
- else
- echo shar: Extracting \"'typhoon/src/util/makefile'\" \(2836 characters\)
- sed "s/^X//" >'typhoon/src/util/makefile' <<'END_OF_FILE'
- X#-----------------------------------------------------------------------------
- X# File : makefile
- X# Library : typhoon
- X# OS : UNIX, OS/2, DOS
- X# Author : Thomas B. Pedersen
- X#
- X# Copyright (c) 1994 Thomas B. Pedersen. All rights reserved.
- X#
- X# Permission is hereby granted, without written agreement and without
- X# license or royalty fees, to use, copy, modify, and distribute this
- X# software and its documentation for any purpose, provided that the above
- X# copyright notice and the following two paragraphs appear (1) in all
- X# source copies of this software and (2) in accompanying documentation
- X# wherever the programatic interface of this software, or any derivative
- X# of it, is described.
- X#
- X# IN NO EVENT SHALL THOMAS B. PEDERSEN BE LIABLE TO ANY PARTY FOR DIRECT,
- X# INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
- X# THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF HE HAS BEEN
- X# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X#
- X# THOMAS B. PEDERSEN SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
- X# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- X# A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
- X# BASIS, AND THOMAS B. PEDERSEN HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
- X# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- X#
- X# Description:
- X# Makefile for Typhoon utilities.
- X#
- X# $Id: makefile,v 1.2 1994/09/17 16:11:14 tbp Exp $
- X#
- X# $Log: makefile,v $
- X# Revision 1.2 1994/09/17 16:11:14 tbp
- X# Added include directive.
- X#
- X# Added included directive.
- X#
- X# Added include directive.
- X#
- X# Revision 1.1 1994/09/13 21:29:00 tbp
- X# Added to repository.
- X#
- X# Added to repository.
- X#
- X#
- X# ----------------------------------------------------------------------------
- X
- XDDLP_OBJS = ddl_y.o ddlp.o ddlplex.o ddlpsym.o
- XDBDVIEW_OBJS = dbdview.o
- XEXPORT_OBJS = exp_y.o export.o exportlx.o expspec.o
- XIMPORT_OBJS = imp_y.o import.o importlx.o impspec.o
- XBACKUP_OBJS = backup.o util.o
- XRESTORE_OBJS = restore.o util.o fixlog.o
- XLIB = ../libtyphoon.a
- X
- XCFLAGS = -DUNIX -g -I../h
- X
- Xall: ddlp dbdview tyexport tyimport
- X
- Xdbdview: $(DBDVIEW_OBJS)
- X cc $(CFLAGS) -o dbdview $(DBDVIEW_OBJS)
- X
- Xddlp: $(DDLP_OBJS) ddl_y.c
- X cc $(CFLAGS) -o ddlp $(DDLP_OBJS)
- X
- Xtyimport: $(IMPORT_OBJS) exp_y.c
- X cc $(CFLAGS) -o tyimport $(IMPORT_OBJS) $(LIB)
- X
- Xtyexport: $(EXPORT_OBJS) imp_y.c
- X cc $(CFLAGS) -o tyexport $(EXPORT_OBJS) $(LIB)
- X
- Xtybackup: $(BACKUP_OBJS)
- X $(CC) -o tybackup $(BACKUP_OBJS) ../readdbd.o ../os.o ../unix.o
- X
- Xtyrestore: $(RESTORE_OBJS)
- X $(CC) -o tyrestore $(RESTORE_OBJS) ../readdbd.o ../os.o ../unix.o
- X
- Xddl_y.c: ddl.y
- X yacc -d ddl.y
- X mv y.tab.c ddl_y.c
- X mv y.tab.h ddl_y.h
- X
- Xexp_y.c: exp.y
- X yacc -d exp.y
- X mv y.tab.c exp_y.c
- X mv y.tab.h exp_y.h
- X
- Ximp_y.c: imp.y
- X yacc -d imp.y
- X mv y.tab.c imp_y.c
- X mv y.tab.h imp_y.h
- X
- X.c.o:
- X cc -c $(CFLAGS) $<
- X
- X# end-of-file
- END_OF_FILE
- if test 2836 -ne `wc -c <'typhoon/src/util/makefile'`; then
- echo shar: \"'typhoon/src/util/makefile'\" unpacked with wrong size!
- fi
- # end of 'typhoon/src/util/makefile'
- fi
- if test -f 'typhoon/src/util/util.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/src/util/util.c'\"
- else
- echo shar: Extracting \"'typhoon/src/util/util.c'\" \(2695 characters\)
- sed "s/^X//" >'typhoon/src/util/util.c' <<'END_OF_FILE'
- X/*----------------------------------------------------------------------------
- X * File : util.c
- X * Program : tybackup, tyrestore
- X * OS : UNIX, OS/2, DOS
- X * Author : Thomas B. Pedersen
- X *
- X * Copyright (c) 1994 Thomas B. Pedersen. All rights reserved.
- X *
- X * Permission is hereby granted, without written agreement and without
- X * license or royalty fees, to use, copy, modify, and distribute this
- X * software and its documentation for any purpose, provided that the above
- X * copyright notice and the following two paragraphs appear (1) in all
- X * source copies of this software and (2) in accompanying documentation
- X * wherever the programatic interface of this software, or any derivative
- X * of it, is described.
- X *
- X * IN NO EVENT SHALL THOMAS B. PEDERSEN BE LIABLE TO ANY PARTY FOR DIRECT,
- X * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
- X * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF HE HAS BEEN
- X * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X *
- X * THOMAS B. PEDERSEN SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
- X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- X * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
- X * BASIS, AND THOMAS B. PEDERSEN HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
- X * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- X *
- X * Description:
- X * Contains miscellaneous function used by tybackup and tyrestore.
- X *
- X * Functions:
- X * clock_on - Start timer.
- X * clock_off - Stop timer.
- X * clock_secs - Report number of seconds passed.
- X * printlong - Print a long with 1000 separators.
- X *
- X * $Log: util.c,v $
- X * Revision 1.2 1994/09/17 16:00:57 tbp
- X * typhoon.h and environ.h are now included from <>.
- X *
- X * Revision 1.1 1994/09/13 21:29:01 tbp
- X * Added to repository.
- X *
- X * Added to repository.
- X *
- X *
- X *--------------------------------------------------------------------------*/
- X
- Xstatic char rcsid[] = "$Id: util.c,v 1.2 1994/09/17 16:00:57 tbp Exp $";
- X
- X#include <time.h>
- X#include <environ.h>
- X
- X
- X/*---------------------------- Global variables ----------------------------*/
- Xstatic ulong secs_used = 0;
- Xstatic ulong clock_start = 0;
- X
- X
- X
- Xvoid clock_on()
- X{
- X clock_start = time(NULL);
- X}
- X
- X
- Xvoid clock_off()
- X{
- X if( clock_start )
- X secs_used += time(NULL) - clock_start;
- X}
- X
- X
- Xulong clock_secs()
- X{
- X return secs_used;
- X}
- X
- X
- Xchar *printlong(number)
- Xulong number;
- X{
- X static char s[20];
- X char *p = s + sizeof(s)-1;
- X int n = 3;
- X
- X s[19] = 0;
- X if( !number )
- X {
- X p = s + sizeof(s)-2;
- X *p = '0';
- X }
- X
- X while( number )
- X {
- X *--p = '0' + (number % 10);
- X number /= 10;
- X
- X if( !--n && number )
- X {
- X *--p = ',';
- X n = 3;
- X }
- X }
- X
- X return p;
- X}
- X
- X/* end-of-file */
- END_OF_FILE
- if test 2695 -ne `wc -c <'typhoon/src/util/util.c'`; then
- echo shar: \"'typhoon/src/util/util.c'\" unpacked with wrong size!
- fi
- # end of 'typhoon/src/util/util.c'
- fi
- if test -f 'typhoon/src/util/util.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'typhoon/src/util/util.h'\"
- else
- echo shar: Extracting \"'typhoon/src/util/util.h'\" \(1982 characters\)
- sed "s/^X//" >'typhoon/src/util/util.h' <<'END_OF_FILE'
- X/*----------------------------------------------------------------------------
- X * File : util.h
- X * Program : tybackup, tyrestore
- X * OS : UNIX, OS/2, DOS
- X * Author : Thomas B. Pedersen
- X *
- X * Copyright (c) 1994 Thomas B. Pedersen. All rights reserved.
- X *
- X * Permission is hereby granted, without written agreement and without
- X * license or royalty fees, to use, copy, modify, and distribute this
- X * software and its documentation for any purpose, provided that the above
- X * copyright notice and the following two paragraphs appear (1) in all
- X * source copies of this software and (2) in accompanying documentation
- X * wherever the programatic interface of this software, or any derivative
- X * of it, is described.
- X *
- X * IN NO EVENT SHALL THOMAS B. PEDERSEN BE LIABLE TO ANY PARTY FOR DIRECT,
- X * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
- X * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF HE HAS BEEN
- X * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- X *
- X * THOMAS B. PEDERSEN SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
- X * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- X * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
- X * BASIS, AND THOMAS B. PEDERSEN HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
- X * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- X *
- X * Description:
- X * Prototypes for functions in util.c.
- X *
- X * $Id: util.h,v 1.1 1994/09/13 21:29:01 tbp Exp $
- X *
- X * $Log: util.h,v $
- X * Revision 1.1 1994/09/13 21:29:01 tbp
- X * Added to repository.
- X *
- X * Added to repository.
- X *
- X *
- X *--------------------------------------------------------------------------*/
- X
- Xstatic char rcsid[] = "$Id: util.h,v 1.1 1994/09/13 21:29:01 tbp Exp $";
- X
- X/*-------------------------- Function prototypes ---------------------------*/
- Xvoid clock_on PRM( (void); )
- Xvoid clock_off PRM( (void); )
- Xulong clock_secs PRM( (void); )
- Xchar *printlong PRM( (ulong); )
- X
- X
- X/* end-of-file */
- END_OF_FILE
- if test 1982 -ne `wc -c <'typhoon/src/util/util.h'`; then
- echo shar: \"'typhoon/src/util/util.h'\" unpacked with wrong size!
- fi
- # end of 'typhoon/src/util/util.h'
- fi
- echo shar: End of archive 8 \(of 9\).
- cp /dev/null ark8isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 9 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-