diff --git a/(dirinf).fm b/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..ad90163739c280602db08afd3627e96a36d7d951 --- /dev/null +++ b/(dirinf).fm @@ -0,0 +1,12 @@ +##!/usr/local/bin/perl +# FILE .../(dirinf).fm +# +# written: 2002-04-20 +# latest update: 2002-04-20 15:23:46 +# $Id: (dirinf).fm,v 1.1 2002/05/02 06:48:28 gonter Exp $ +# + +License 1691 f 100644 3222 3000 +README 2922 f 100644 3222 3000 +app 512 d 040755 3222 3000 +lib 512 d 040755 3222 3000 diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..0b17c9e006601bdc4a8aa4941dd1f54c4158e6e6 --- /dev/null +++ b/.cvsignore @@ -0,0 +1,8 @@ +GPATH +GRTAGS +GSYMS +GTAGS +tmp +typescript +.git +@* diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ce439ab8a0ef24bddead5cb86c5e497451bf2169 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.project +CVSROOT +CVS +tmp +typescript +@* diff --git a/License b/License new file mode 100644 index 0000000000000000000000000000000000000000..30a24d19a667af0f2402830f3a99780af3f26b96 --- /dev/null +++ b/License @@ -0,0 +1,36 @@ +$Id: License,v 1.1 2002/03/25 07:28:07 gonter Exp $ + +This BSD-style License applies to all files in this repository or +library, unless otherwise stated. + +Authors and contributors, unless otherwise stated: + ++ Copyright 1986-2002 Gerhard Gonter <g.gonter@ieee.org>. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation +are those of the authors and should not be interpreted as representing +official policies, either expressed or implied. + diff --git a/Perl/Modules/.cvsignore b/Perl/Modules/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..8d177772707f307f91a939ac02e1963be4600626 --- /dev/null +++ b/Perl/Modules/.cvsignore @@ -0,0 +1,3 @@ +tmp +*.tar +*.tar.gz diff --git a/Perl/Modules/net-freedb/(dirinf).fm b/Perl/Modules/net-freedb/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..e007d91b139a32256d06ab4e892bf832bc8814a3 --- /dev/null +++ b/Perl/Modules/net-freedb/(dirinf).fm @@ -0,0 +1,11 @@ +#!/usr/local/bin/perl +# FILE %gg/work/sf/hyx-tools/Perl/Modules/net-freedb/(dirinf).fm +# +# written: 2002-07-01 +# $Id: (dirinf).fm,v 1.2 2002/07/01 02:42:46 gonter Exp $ +# + +Changes what's new +MANIFEST package list +lib/Net/freedb/ library modules + diff --git a/Perl/Modules/net-freedb/Changes b/Perl/Modules/net-freedb/Changes new file mode 100644 index 0000000000000000000000000000000000000000..dafaa0af8f3ed2eaf9203bf3f68a0209ec23822a --- /dev/null +++ b/Perl/Modules/net-freedb/Changes @@ -0,0 +1,5 @@ + +2002-06-30 21:26:06 gg + + imported from private repository and re-organized as net::freedb::* + diff --git a/Perl/Modules/net-freedb/MANIFEST b/Perl/Modules/net-freedb/MANIFEST new file mode 100644 index 0000000000000000000000000000000000000000..945739c978dda15a3648d5ad0eda9d9b34871520 --- /dev/null +++ b/Perl/Modules/net-freedb/MANIFEST @@ -0,0 +1,9 @@ +README +MANIFEST +Makefile.PL +lib/Net/freedb/file.pm +lib/Net/freedb/track.pm +lib/Net/freedb/cluster.pm +lib/Net/freedb/tools.pm +lib/Net/freedb/catalog.pm +lib/Net/freedb/catalog_entry.pm diff --git a/Perl/Modules/net-freedb/Makefile.PL b/Perl/Modules/net-freedb/Makefile.PL new file mode 100644 index 0000000000000000000000000000000000000000..d861aea890478d2a5cf1290c410543fee2bec5b2 --- /dev/null +++ b/Perl/Modules/net-freedb/Makefile.PL @@ -0,0 +1,10 @@ +use ExtUtils::MakeMaker; + +WriteMakefile( + 'NAME' => 'net::freedb', + 'VERSION_FROM' => 'lib/Net/freedb/file.pm', # finds $VERSION + 'PREREQ_PM' => { + MD5 => 0, + }, # e.g., Module::Name => 1.1 +); + diff --git a/Perl/Modules/net-freedb/README b/Perl/Modules/net-freedb/README new file mode 100644 index 0000000000000000000000000000000000000000..0516ba9942b1ecdd2e96b08fe0ae3caa01d62824 --- /dev/null +++ b/Perl/Modules/net-freedb/README @@ -0,0 +1,13 @@ +FILE .../net-freedb/README +written: 2002-06-30 +$Id: README,v 1.1 2002/06/30 19:45:16 gonter Exp $ + +collection of modules to handle freedb files + +Docu-T2D: ++ mention net::FreeDB module ++ why freedb and not FreeDB (pointer to www.freedb.org FAQ) + + + + diff --git a/Perl/Modules/net-freedb/lib/Net/freedb/(dirinf).fm b/Perl/Modules/net-freedb/lib/Net/freedb/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..63f296256041c501ef86c5af8851f07e2d8c76f8 --- /dev/null +++ b/Perl/Modules/net-freedb/lib/Net/freedb/(dirinf).fm @@ -0,0 +1,15 @@ +#!/usr/local/bin/perl +# FILE .../net-freedb/lib/Net/freedb/(dirinf).fm +# +# written: 2001-01-28 +# re-issued as Net::freedb::* 2002-06-30 +# $Id: (dirinf).fm,v 1.1 2002/07/01 02:42:25 gonter Exp $ +# + +file.pm process freedb files +track.pm individual freedb track +tools.pm Various utility functions +catalog.pm handle a catalog file used from LMD and RCS +catalog_entry.pm handle a single catalog entry + +cluster.pm clustering of similar entries diff --git a/Perl/Modules/net-freedb/lib/Net/freedb/catalog.pm b/Perl/Modules/net-freedb/lib/Net/freedb/catalog.pm new file mode 100644 index 0000000000000000000000000000000000000000..6365edadedd4f8d212bdf3e74c377904a7e3d609 --- /dev/null +++ b/Perl/Modules/net-freedb/lib/Net/freedb/catalog.pm @@ -0,0 +1,254 @@ +#!/usr/local/bin/perl +# FILE .../net-freedb/lib/Net/freedb/catalog.pm +# +# manage a catalog of freedb database files +# +# written: 2001-09-02 +# re-issued as Net::freedb::* 2002-06-30 +# $Id: catalog.pm,v 1.2 2002/07/01 06:56:30 gonter Exp $ +# + +use strict; +package Net::freedb::catalog; +use Net::freedb::catalog_entry; + +my $VERSION= '0.02'; + +# ---------------------------------------------------------------------------- +sub new +{ + my $class= shift; + my %pars= @_; + + my $cat= $pars{'category'} or return undef; + my $path= $pars{'path'} or return undef; + + print "new catalog: category=$cat\n"; + my $obj= + { + 'category' => $cat, + 'path' => $path, + 'pars' => \%pars, + 'updates' => 0, # > 0 if there are updates + 'highest_index' => 0, + + # list of catalog entries by ... + 'entries' => [], # ... by position + 'keys' => {}, # ... by freedb id (or relative path?) + }; + bless $obj; + + $obj->load ($pars{'catalog'}) if ($pars{'catalog'}); + $obj; +} + +# ---------------------------------------------------------------------------- +# reads a catalog file +# returns the number of entries read or 0 if the file did not exist +sub load +{ + my ($obj, $fnm)= @_; + + $obj->{'catalog'}= $fnm; # save filename, it is needed for the save method + + local *FI; + open (FI, $fnm) or return 0; + + print "reading: $fnm\n"; + my $array= $obj->{'entries'}; + my $table= $obj->{'keys'}; + my $highest_index= $obj->{'highest_index'}; + + my $entries= undef; + while (<FI>) + { + chop; + if (/^#/) + { + push (@$array, $_); + next; + } + + my $entry= new Net::freedb::catalog_entry (split (':', $_, 6)); + push (@$array, $entry); + my $key= $entry->key (); + my $index= $entry->index (); + $highest_index= $index if ($index > $highest_index); + + # print ">>> entry=$entry key='$key'\n"; + $table->{$key}= $entry; + + $entries++; + } + close (FI); + + $obj->{highest_index}= $highest_index; + + return $entries; +} + +# ---------------------------------------------------------------------------- +# writes a catalog file +# returns the number of entries written or 0 if the file could not be opened +sub save +{ + my $obj= shift; + my $fnm= shift || $obj->{'catalog'}; + return undef unless ($fnm); + + local *FO; + open (FO, ">$fnm") or return undef; + + print "saving $fnm\n"; + my $array= $obj->{'entries'}; + my $entries= 0; + my $comments= 0; + + my $entry; + foreach $entry (@$array) + { + my $r= ref ($entry); + # print "entry= $entry, r= $r\n"; + if ($r eq '') { print FO $entry, "\n"; $comments++; } + else { print FO join (':', @$entry), "\n"; $entries++; } + } + close (FO); + + ($entries, $comments); +} + +# ---------------------------------------------------------------------------- +# add comments to catalog file +sub comment +{ + my $obj= shift; + my $array= $obj->{'entries'}; + foreach (@_) + { + push (@$array, '# '. $_); + } +} + +# ---------------------------------------------------------------------------- +# locate all freedb database files that were updated relative to the +# timestamps given in the catalog file +sub updates +{ + my $obj= shift; + my %opts= @_; + + my $path= $obj->{path} or return undef; + + my $check_lmd= 1; + my $check_rcs= 1; + my $opt; + foreach $opt (keys %opts) + { + if ($opt eq 'lmd') { $check_lmd= $opts{$opt}; } + elsif ($opt eq 'rcs') { $check_rcs= $opts{$opt}; } + } + + return undef unless ($check_lmd || $check_rcs); # nothing to do??? + + local *DIR; + opendir (DIR, $path) or return undef; + print "updating $path\n"; + + my $table= $obj->{'keys'}; + my $array= $obj->{'entries'}; + my $highest_index= $obj->{'highest_index'}; + + my (@res, $res, $e); + while (defined ($e= readdir (DIR))) + { + next unless ($e =~ /^[0-9a-fA-F]{8}$/); + + my $f= "$path/$e"; + my @stat= stat ($f); + my $mtime= $stat[9]; + + my $entry= $table->{$f}; + + $res= undef; + + if (!$entry) + { + # print "new: $e\n"; + $res= { 'x' => 'n' }; + + $highest_index++; + $entry= new Net::freedb::catalog_entry ($highest_index, $mtime, 0, 0, $f, 'unknown'); + + # print ">>> entry=$entry key='$f'\n"; + push (@$array, $entry); + $table->{$f}= $entry; + + if ($check_lmd) { $res->{'lmd'}= { 'x' => 'n' }; } + if ($check_rcs) { $res->{'rcs'}= { 'x' => 'n' }; } + + $obj->{updates}++; + } + else + { + my $o_mtime= $entry->mtime (); + my $t_diff= $mtime - $o_mtime; + + if ($t_diff != $0) + { # file was modified + # t_diff should be positive otherwise the file is now older than + # it was last time; we do not care about this, it's updated... + + # print "e: t_diff=$t_diff\n"; + $res= { 'x' => 'u', 'old_mtime' => $o_mtime }; + $entry->mtime ($mtime); + $obj->{updates}++; + + if ($check_lmd) + { + my $lmd_update= $entry->lmd_update (); + if ($lmd_update == 0) + { + print "not in lmd!\n"; + $res->{'lmd'}= { 'x' => 'n' }; + } + else + { + $res->{'lmd'}= { 'x' => 'u' }; + } + } + + if ($check_rcs) + { + my $rcs_update= $entry->rcs_update (); + if ($rcs_update == 0) + { + print "not in rcs!\n"; + $res->{'rcs'}= { 'x' => 'n' }; + } + else + { + $res->{'rcs'}= { 'x' => 'u' }; + } + } + } # t_diff != 0 + } # entry exists + + if (defined ($res)) + { + $res->{'f'}= $f; + $res->{'e'}= $e; + $res->{'t'}= $mtime; + $res->{'r'}= $entry; + + # print ">>>> push\n"; + push (@res, $res); + } + } + closedir (DIR); + + $obj->{highest_index}= $highest_index; + + (wantarray) ? @res : \@res; +} + +1; diff --git a/Perl/Modules/net-freedb/lib/Net/freedb/catalog_entry.pm b/Perl/Modules/net-freedb/lib/Net/freedb/catalog_entry.pm new file mode 100644 index 0000000000000000000000000000000000000000..2bca6fea69b3539b3069865be02ad27987a3b502 --- /dev/null +++ b/Perl/Modules/net-freedb/lib/Net/freedb/catalog_entry.pm @@ -0,0 +1,45 @@ +#!/usr/local/bin/perl +# FILE .../net-freedb/lib/Net/freedb/catalog_entry.pm +# +# manage a catalog of freedb database files +# +# written: 2001-09-02 +# re-issued as Net::freedb::* 2002-06-30 +# $Id: catalog_entry.pm,v 1.1 2002/07/01 02:42:25 gonter Exp $ +# + +use strict; + +package Net::freedb::catalog_entry; + +# ---------------------------------------------------------------------------- +sub new +{ + my $class= shift; + my @fields= @_; + my $entry= \@fields; + bless $entry; +} + +# ---------------------------------------------------------------------------- +sub index { &get_idx ($_[0], 0, $_[1]); } +sub mtime { &get_idx ($_[0], 1, $_[1]); } +sub lmd_update { &get_idx ($_[0], 2, $_[1]); } +sub rcs_update { &get_idx ($_[0], 3, $_[1]); } +sub key { &get_idx ($_[0], 4, $_[1]); } +sub title { &get_idx ($_[0], 5, $_[1]); } + +# ---------------------------------------------------------------------------- +sub get_idx +{ + my $obj= shift; + my $idx= shift; + my $val= shift; + + my $res= $obj->[$idx]; + $obj->[$idx]= $val if (defined ($val)); + + $res; +} + +1; diff --git a/Perl/Modules/net-freedb/lib/Net/freedb/cdex/local.pm b/Perl/Modules/net-freedb/lib/Net/freedb/cdex/local.pm new file mode 100644 index 0000000000000000000000000000000000000000..9687104ae49a285d378f1efc8f294d4621a21eb2 --- /dev/null +++ b/Perl/Modules/net-freedb/lib/Net/freedb/cdex/local.pm @@ -0,0 +1,153 @@ +#!/usr/local/bin/perl +# FILE .../net-freedb/lib/Net/freedb/file.pm +# +# written: 2001-01-28 +# re-issued as Net::freedb::* 2002-06-30 +# $Id: local.pm,v 1.1 2012/08/12 16:32:56 gonter Exp $ +# + +=head1 NAME + +Net::freedb::cdex - Perl module to hande freedb database files + +=head1 SYNOPSIS + + use Net::freedb::dex; + + $cdex= new Net::freedb::dex; create a new freedb object + $cdex->read ($filename); read a given freedb file into object + +=head1 DESCRIPTION + +Net::freedb::cdex +files which represent freedb database files. + +=cut + +use strict; + +package Net::freedb::cdex::local; + +use Net::freedb::file; + +my $VERSION= '0.03'; + +my $do_parse= 1; + +sub new +{ + my $class= shift; + my %pars= @_; + + my $obj= + { + }; + bless $obj; + + foreach my $par (keys %pars) + { + if ($par eq 'read') + { + $obj->read ($pars{$par}); + } + else + { + $obj->{$par}= $pars{$par}; + } + } + + $obj; +} + +=pod + +=head2 $cdex->read ($fnm) + +CDex stores multiple freedb files in one file, e.g. classical/aa12b90a +and classcial/aa11741c end up together in a file called classical/aatoaa . + +=cut + +# ---------------------------------------------------------------------------- +sub read +{ + my $obj= shift; + my $fnm= shift; + + local *FI; + open (FI, $fnm) || return 0; + + my %items= (); + $obj->{'items'}= \%items; + my $lines= undef; + my $x_filename= undef; + my $cnt= 0; + while (my $l= <FI>) + { + chop ($l); + + if ($l =~ m/^#FILENAME=([a-fA-F0-9]{8})$/) + { + $x_filename= $1; + print ">> x_filename=[$x_filename]\n"; + $lines= []; + $items{$x_filename}= { 'filename' => $x_filename, '_' => $lines }; + $cnt++; + } + elsif (defined ($lines)) + { + push (@$lines, $l); + } + else + { + # TODO: garbage in the file? + } + } + close (FI); + + if ($do_parse) + { + foreach my $item (sort keys %items) + { + my $x= $items{$item}; + my $lines= $x->{'_'}; + + my $fdb= $x->{'freedb'}= new Net::freedb::file; + + # $fdb->{'_FILENAME_'}= $fnm; + $fdb->parse ($lines); + } + } + + #\%items; + $cnt; +} + +1; +__END__ +# POD Section + +=head1 NOTES + +=head1 BUGS + +This module is work in progres... + +=head2 To-Do-List + + How to handle track information + +=head1 Copyright + +Copyright (c) 2012 Gerhard Gonter. All rights reserved. +This is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=head1 AUTHOR + +Gerhard Gonter, g.gonter@ieee.org + +=head1 SEE ALSO + +=cut + diff --git a/Perl/Modules/net-freedb/lib/Net/freedb/cluster.pm b/Perl/Modules/net-freedb/lib/Net/freedb/cluster.pm new file mode 100755 index 0000000000000000000000000000000000000000..ba0cd1eedcb614f38652553caf3e6333de50993c --- /dev/null +++ b/Perl/Modules/net-freedb/lib/Net/freedb/cluster.pm @@ -0,0 +1,51 @@ +#!/usr/local/bin/perl +# FILE .../net-freedb/lib/Net/freedb/cluster.pm +# +# handle clusters of similar entries +# re-issued as Net::freedb::* 2002-06-30 +# +# $Id: cluster.pm,v 1.2 2002/07/01 06:56:30 gonter Exp $ + +package Net::freedb::cluster; + +my $VERSION= '0.02'; +my $cluster_id= 1; + +sub new +{ + my $class= shift; + my $cat= shift; + + my $obj= + { + 'id' => $cluster_id++, + 'cat' => $cat, + 'members' => {}, + }; + bless $obj; +} + +# add an entry to a cluster +sub add +{ + my $obj= shift; + my $id= shift; # freedb id; + my $data= shift; # some data associated with it, e.g. a Net::freedb::file object + + $obj->{members}->{$id}= $data; +} + +# merge the data of two clusters +sub merge +{ + my $obj1= shift; + my $obj2= shift; + my $mem; + foreach $mem (keys %{$obj2->{members}}) + { + $obj1->{members}->{$mem}= $obj2->{members}->{$mem}; + } +} + +1; + diff --git a/Perl/Modules/net-freedb/lib/Net/freedb/file.pm b/Perl/Modules/net-freedb/lib/Net/freedb/file.pm new file mode 100644 index 0000000000000000000000000000000000000000..461a158e5d900fc5d4b6d20712cf41439d3d81eb --- /dev/null +++ b/Perl/Modules/net-freedb/lib/Net/freedb/file.pm @@ -0,0 +1,372 @@ +#!/usr/local/bin/perl +# FILE .../net-freedb/lib/Net/freedb/file.pm +# +# written: 2001-01-28 +# re-issued as Net::freedb::* 2002-06-30 +# $Id: file.pm,v 1.3 2012/08/12 16:30:13 gonter Exp $ +# + +=head1 NAME + +Net::freedb::file - Perl module to handle freedb database files + +=head1 SYNOPSIS + + use Net::freedb::file; + + $db= new Net::freedb::file; create a new freedb object + $db->read ($filename); read a given freedb file into object + $db->print (*FILEHANDLE); print object in freedb file format + $db->inc_revision; increment revision counter + + Methods for field retrieval: + $db->program ([<str>]); retrieve or set program identifier + $db->header ([<str>]); retrieve or set freedb file header + + more functions + discids all discids (ARRAY reference!) + track (idx, <obj>) track object at that position + length length in seconds + revision db file revision number + title full title + ext extended information + playorder + + methods of a track object: + offset start of track, counted in frames + title full title + ext extended information + +=head1 DESCRIPTION + +Net::freedb::file and it's sister-modules are used to handle text +files which represent freedb database files. + +=cut + +use strict; + +package Net::freedb::file; + +use Net::freedb::track; + +# ---------------------------------------------------------------------------- +my $VERSION= '0.03'; +my $LLNG= 64; # max. length of a line in the freedb file + +my $default_header => <<EOX; +# xmcd CD database file +# +EOX + +my %ESCAPE= +( + 'n' => "\n", + 't' => "\t", +); + +# ---------------------------------------------------------------------------- +sub new +{ + my $class= shift; + my %pars= @_; + + my $obj= + { + 'header' => $default_header, + 'revision' => 0, + }; + bless $obj; + + foreach my $par (keys %pars) + { + if ($par eq 'read') + { + $obj->read ($pars{$par}); + } + else + { + $obj->{$par}= $pars{$par}; + } + } + + $obj; +} + +# ---------------------------------------------------------------------------- +sub read +{ + my $obj= shift; + my $fnm= shift; + + local *FI; + open (FI, $fnm) || return 0; + my @lines= <FI>; + close (FI); + chop (@lines); + + $obj->{'_FILENAME_'}= $fnm; + $obj->parse (\@lines); +} + +sub parse +{ + my $obj= shift; + my $lines= shift; + + my @lines= @$lines; + + my $state= 'header'; + my @tracks= (); + $obj->{tracks}= \@tracks; + $obj->{discid}= []; + my $hdr= ''; + + while (my $l= shift (@lines)) + { + # print ">>> [$l]\n"; + + if ($l =~ /^# Track frame offsets:/) + { + $state= 'track offsets'; + } + elsif ($state eq 'header') { $hdr .= $l. "\n"; } + elsif ($state eq 'track offsets' && $l =~ /^#\s*(\d+)/) + { + my $track= new Net::freedb::track + ( + 'offset' => $1, + ); + push (@tracks, $track); + } + elsif ($l =~ /^#\s*$/) { $state= 'rest'; } + elsif ($l =~ /^# Disc length: (\d+) seconds/) { $obj->{length}= $1; } + elsif ($l =~ /^# Revision: (\d+)/) { $obj->{revision}= $1; } + elsif ($l =~ /^# Submitted via: (.+)/) { $obj->{program}= $1; } + elsif ($l =~ /^DISCID=(.*)/) + { # see the note about DISCID in the POD section below + push (@{$obj->{discid}}, split (/,/, $1)); + } + elsif ($l =~ /^(DTITLE|EXTD|PLAYORDER|DGENRE|DYEAR)=(.*)/) + { + my ($par, $val)= ($1, $2); + $obj->{$par} .= $2; + } + elsif ($l =~ /^(TTITLE|EXTT)(\d+)=(.*)/) + { + my ($par, $idx, $val)= ($1, $2, $3); + my $t= $obj->{tracks}->[$idx]; + $t->{$par} .= $3; + } + } + $obj->{header}= $hdr; + + my ($xt, $xf); + foreach $xf (qw(DTITLE EXTD PLAYORDER DGENRE DYEAR)) + { + $obj->{$xf}= &decode ($obj->{$xf}); + } + foreach $xt (@{$obj->{tracks}}) + { + $xt->{TTITLE}= &decode ($xt->{TTITLE}); + $xt->{EXTT}= &decode ($xt->{EXTT}); + } + + 1; +} + +# ---------------------------------------------------------------------------- +sub print +{ + my $obj= shift; + local *FO= shift; + + print FO $obj->{header}; + print FO "# Track frame offsets:\n"; + my $track; + foreach $track (@{$obj->{tracks}}) + { + printf FO ("#\t%d\n", $track->{offset}); + } + print FO "#\n# Disc length: ", $obj->{length}, " seconds\n#\n", + "# Revision: ", $obj->{revision}, + "\n# Submitted via: ", $obj->{program}, "\n#\n"; + + # print the DISCID + # see the note about DISCID in the POD section below + my @discids= @{$obj->{discid}}; + while ($#discids >= 7) + { + my @x= @discids[0..7]; + @discids= @discids[8..$#discids]; + print FO "DISCID=", join (',', @x), "\n"; + } + print FO "DISCID=", join (',', @discids), "\n"; + + &print_field (*FO, 'DTITLE', $obj->{DTITLE}); + &print_field (*FO, 'DYEAR', $obj->{DYEAR}); + &print_field (*FO, 'DGENRE', $obj->{DGENRE}); + my $num= 0; + foreach $track (@{$obj->{tracks}}) + { + &print_field (*FO, "TTITLE$num", $track->{TTITLE}); + $num++; + } + &print_field (*FO, 'EXTD', $obj->{EXTD}); + $num= 0; + foreach $track (@{$obj->{tracks}}) + { + &print_field (*FO, "EXTT$num", $track->{EXTT}); + $num++; + } + &print_field (*FO, 'PLAYORDER', $obj->{PLAYORDER}); + 1; +} + +# ---------------------------------------------------------------------------- +sub inc_revision +{ + my $obj= shift; + $obj->{revision}++; +} + +# ---------------------------------------------------------------------------- +sub discids { my $obj= shift; $obj->_field_ ('discid', @_); } +sub ext { my $obj= shift; $obj->_field_ ('EXTD', @_); } +sub header { my $obj= shift; $obj->_field_ ('header', @_); } +sub length { my $obj= shift; $obj->_field_ ('length', @_); } +sub program { my $obj= shift; $obj->_field_ ('program', @_); } +sub playorder { my $obj= shift; $obj->_field_ ('PLAYORDER', @_); } +sub revision { my $obj= shift; $obj->_field_ ('REVISION', @_); } +sub title { my $obj= shift; $obj->_field_ ('DTITLE', @_); } +sub dyear { my $obj= shift; $obj->_field_ ('DYEAR', @_); } +sub dgenre { my $obj= shift; $obj->_field_ ('DGENRE', @_); } + +# ---------------------------------------------------------------------------- +sub _field_ +{ + my $obj= shift; + my $field= shift; + my $val= shift; + my $old= $obj->{$field}; + $obj->{$field}= $val if ($val); + $old; +} + +# ---------------------------------------------------------------------------- +sub track +{ + my $obj= shift; + my $idx= shift; + my $val= shift; + + my $tr= $obj->{tracks}; + my $old= $tr->[$idx]; + + $tr->[$idx]= $val if ($val); + $old; +} + +# ---------------------------------------------------------------------------- +sub track_count +{ + my $obj= shift; + + my $tr= $obj->{tracks}; + $#$tr+1; +} + +# ---------------------------------------------------------------------------- +sub ESCAPE +{ + my $c= shift; + $c= $ESCAPE{$c} if (exists ($ESCAPE{$c})); + $c; +} + +# ---------------------------------------------------------------------------- +sub decode +{ + my $str= shift; + $str=~ s/\\(.)/&ESCAPE($1)/eg; + $str; +} + +# ---------------------------------------------------------------------------- +sub print_field +{ + local *FO= shift; + my $par= shift; + my $val= shift; + my $lines= 0; + my $v1; + + while (1) + { + my $l1= length ($val); + last if ($l1 <= 0); + if ($l1 > $LLNG) + { + $v1= substr ($val, 0, $LLNG); + $val= substr ($val, $LLNG); + } + else + { + $v1= $val; + $val= undef; + } + + $v1=~ s#\\#\\\\#g; + $v1=~ s#\n#\\n#g; + $v1=~ s#\t#\\t#g; + print FO $par, '=', $v1, "\n"; + $lines++; + } + + print FO $par, "=\n" unless ($lines); + + $lines; +} + +# ============================================================================ +1; +__END__ +# POD Section + +=head1 NOTES + +=head2 DISCID + +There are up to 8 discid codes in a DISCID line, each separated by commas. +If therer are more such codes, they need to be written into separate +lines. There is no comma after the last code, even if there is another +line following! + + Example: + DISCID=b10ca40e,b10ca70e,b00ca50e,ae0ca30e,ab0ca30e,aa0ca40e,a90ca50e,a90ca40e + DISCID=a80ca50e + DTITLE=Nirvana / Unplugged In New York + +=head1 BUGS + +This module is work in progres... + +=head2 To-Do-List + + How to handle track information + +=head1 Copyright + +Copyright (c) 2001..2012 Gerhard Gonter. All rights reserved. +This is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=head1 AUTHOR + +Gerhard Gonter, g.gonter@ieee.org + +=head1 SEE ALSO + +http://www.freedb.org/ + +=cut diff --git a/Perl/Modules/net-freedb/lib/Net/freedb/tools.pm b/Perl/Modules/net-freedb/lib/Net/freedb/tools.pm new file mode 100644 index 0000000000000000000000000000000000000000..f296b2742890e9073fad2b51ad46596189efb7c4 --- /dev/null +++ b/Perl/Modules/net-freedb/lib/Net/freedb/tools.pm @@ -0,0 +1,55 @@ +#!/usr/local/bin/perl +# FILE .../net-freedb/lib/Net/freedb/tools.pm +# +# written: 2001-05-01 +# re-issued as Net::freedb::* 2002-06-30 +# $Id: tools.pm,v 1.2 2002/07/01 06:56:30 gonter Exp $ +# + +use strict; +use MD5; + +package Net::freedb::tools; + +my $VERSION= '0.02'; + +# ---------------------------------------------------------------------------- +sub offset2time +{ + my $offset= shift; + my $f= $offset % 75; $offset= int ($offset / 75); + my $s= $offset % 60; + my $m= int ($offset / 60); + ($m, $s, $f); +} + +# ---------------------------------------------------------------------------- +# calculate an experimental alternative disc id +sub get_exp_id +{ + my $db= shift; + + my $cnt= $db->track_count; + + my $str= ''; + + my ($i, $off0); + for ($i= 0; $i < $cnt; $i++) + { + my $track= $db->track ($i); # returns a Net::freedb::track object + my $off= $track->offset; + $off0= $off if ($i == 0); + $str .= $off . '+'; + } + + # unfortunately, we do not have disc length in frames! + my $tt= 75 * $db->length + $off0; + $str .= $tt; + + my $md5= MD5->hexhash ($str); + + $md5; +} + +# ---------------------------------------------------------------------------- +1; diff --git a/Perl/Modules/net-freedb/lib/Net/freedb/track.pm b/Perl/Modules/net-freedb/lib/Net/freedb/track.pm new file mode 100644 index 0000000000000000000000000000000000000000..273c6313d41721735dda1a75bd203e49a51fc05f --- /dev/null +++ b/Perl/Modules/net-freedb/lib/Net/freedb/track.pm @@ -0,0 +1,44 @@ +#!/usr/local/bin/perl +# FILE .../net-freedb/lib/Net/freedb/track.pm +# +# written: 2001-03-03 +# re-issued as Net::freedb::* 2002-06-30 +# $Id: track.pm,v 1.2 2002/07/01 06:56:30 gonter Exp $ +# + +use strict; +package Net::freedb::track; + +# ---------------------------------------------------------------------------- +my $VERSION= '0.02'; + +# ---------------------------------------------------------------------------- +sub offset { my $obj= shift; $obj->_field_ ('offset', @_); } +sub title { my $obj= shift; $obj->_field_ ('TTITLE', @_); } +sub ext { my $obj= shift; $obj->_field_ ('EXTT', @_); } + +# ---------------------------------------------------------------------------- +sub new +{ + my $class= shift; + my %pars= @_; + my $obj= + { + 'offset' => 0, + 'TITLE' => '', + 'EXTT' => '', + }; + foreach (keys %pars) { $obj->{$_}= $pars{$_}; } + bless $obj; +} + +# ---------------------------------------------------------------------------- +sub _field_ +{ + my $obj= shift; + my $field= shift; + my $val= shift; + my $old= $obj->{$field}; + $obj->{$field}= $val if ($val); + $old; +} diff --git a/Perl/Modules/vdif/(dirinf).fm b/Perl/Modules/vdif/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..a1cd9de7bc7c620ffc6faabbf2d4b1e6c909facb --- /dev/null +++ b/Perl/Modules/vdif/(dirinf).fm @@ -0,0 +1,19 @@ +#!/usr/local/bin/perl +# FILE %usr/unixonly/CPAN/ldif/(dirinf).fm +# +# written: 1998-09-13 +# latest update: 1998-09-13 9:09:33 +# + +. LDIF, vCard, vCalendar hanlding +Changes modifcation log +MANIFEST File Listek +Makefile.PL generic makefile + +LDIF.pm Main Module +VDIF + +abook.pl Address Book Converter +cookieflt.pl Cookie Filter +pl.pl test? +test.pl test? diff --git a/Perl/Modules/vdif/.cvsignore b/Perl/Modules/vdif/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..3a1d4667015f6a9405e955fe0af9d2604ca73cb8 --- /dev/null +++ b/Perl/Modules/vdif/.cvsignore @@ -0,0 +1,2 @@ +@* +aliases.text diff --git a/Perl/Modules/vdif/Changes b/Perl/Modules/vdif/Changes new file mode 100644 index 0000000000000000000000000000000000000000..53f0137b4d69de21419835106941d1bd90b0deb0 --- /dev/null +++ b/Perl/Modules/vdif/Changes @@ -0,0 +1,5 @@ +Revision history for Perl extension LDIF. + +0.01 Sun Aug 9 13:53:20 1998 + - original version; created by h2xs 1.16 + diff --git a/Perl/Modules/vdif/MANIFEST b/Perl/Modules/vdif/MANIFEST new file mode 100644 index 0000000000000000000000000000000000000000..10e23e466d47824a08fb4a9aa96b31e8922121cd --- /dev/null +++ b/Perl/Modules/vdif/MANIFEST @@ -0,0 +1,11 @@ +Changes +VDIF.pm +VDIF/Entry.pm +VDIF/LDIF.pm +VDIF/TopCall.pm +VDIF/vCx.pm +MANIFEST +Makefile.PL +test.pl +scripts/abook.pl +scripts/cookieflt.pl diff --git a/Perl/Modules/vdif/Makefile.PL b/Perl/Modules/vdif/Makefile.PL new file mode 100644 index 0000000000000000000000000000000000000000..f3a3c4463615aacbbaf1c1786709fc2cd842fd1c --- /dev/null +++ b/Perl/Modules/vdif/Makefile.PL @@ -0,0 +1,7 @@ +use ExtUtils::MakeMaker; +# See lib/ExtUtils/MakeMaker.pm for details of how to influence +# the contents of the Makefile that is written. +WriteMakefile( + 'NAME' => 'VDIF', + 'VERSION_FROM' => 'VDIF.pm', # finds $VERSION +); diff --git a/Perl/Modules/vdif/VDIF.pm b/Perl/Modules/vdif/VDIF.pm new file mode 100755 index 0000000000000000000000000000000000000000..3eb9b6092c847036d83489f50b93a19078ff12e6 --- /dev/null +++ b/Perl/Modules/vdif/VDIF.pm @@ -0,0 +1,182 @@ +#!/usr/local/bin/perl +# FILE %usr/unixonly/hp200lx/VPAN/vdif/LDIF.pm +# +# implements packages VDIF::LDIF and VDIF::Entry; +# see POD Section +# +# written: 1998-08-09 +# latest update: 1998-10-08 11:57:40 +# $Id: VDIF.pm,v 1.3 2011/05/31 15:37:57 gonter Exp $ +# + +package VDIF; + +use strict; +use vars qw($VERSION @ISA @EXPORT_OK); +# use MIME::Media_Types qw(print_refs); + +require Exporter; + +@ISA = qw(Exporter); +# Items to export into callers namespace by default. Note: do not export +# names by default without a very good reason. Use EXPORT_OK instead. +# Do not simply export all your public functions/methods/constants. +@EXPORT_OK = qw(); +$VERSION = '0.03'; + +use VDIF::LDIF; +use VDIF::Entry; +use VDIF::vCx; +use VDIF::TopCall; + +# ---------------------------------------------------------------------------- +sub parse_file +{ + my $fnm= shift; + my $fmt= shift || 'ldif'; + my $dn_suffix= shift; + + my @entries= (); + local (*FI); + unless (open (FI, $fnm)) + { + print "can't parse $fnm\n"; + return (); + } + + if ($fmt eq 'ldif') + { + @entries= &VDIF::LDIF::parse_stream (*FI, $fnm, $dn_suffix); + } + elsif ($fmt eq 'vcx' || $fmt eq 'vcard' || $fmt eq 'vcalendar') + { + @entries= &VDIF::vCx::parse_stream (*FI, $fnm, $dn_suffix); + } + elsif ($fmt eq 'TopCall') + { + @entries= &VDIF::TopCall::parse_stream (*FI, $fnm); + } + else + { + print "WARNING: VDIF::parse_file; unknown \$fmt='$fmt'\n"; + } + + close (FI); + + return (wantarray) ? @entries : \@entries; +} + +# ---------------------------------------------------------------------------- +# Autoload methods go after =cut, and are processed by the autosplit program. + +1; +__END__ +# Below is the stub of documentation for your module. You better edit it! +# POD Section + +=head1 NAME + +VDIF - Perl module to manipulate VDIF files and entries + + ** WARNING ** (1998-09-13 12:32:29) + The information here may be inconsistent due to major restructuring + +=head1 SYNOPSIS + + use VDIF; + +VDIF::LDIF methods on DB level: + These method operate on LDIF database which is held in memory + $ldif= new VDIF::LDIF; + $entry= $ldif->add_entry ($entry); + @entries= $ldif->add_file ($file_name); + @entries= $ldif->print_all (*FH); + $entry= $ldif->lookup_dn ($dn); + $entry= $ldif->lookup_unique ($attribute, $value); + $entry= $ldif->lookup_indexed ($attribute, $value); + $entry= $ldif->lookup_not_null ($attribute, $value); + T2D: $entry= $ldif->get_entry_by_dn ($dn); + +VDIF::Entry methods: + These functions operate at the entry level. + $entry= new LDIF::Entry ($dn, %attributes); + $entry->update (%attributes); + $attribute_ref= $entry->add_attribute ($name, $value [, $type [, $mod]]); + $entry->print_ldif (*FH); + +VDIF utility functions: + @entries= VDIF::Entry::parse_file ($file_name); + +VDIF::LDIF utitlity functions: + @entries= VDIF::LDIF::parse_stream (*FH); + +=head1 ENTRY STRUCTURE + + Entries are references to hashes consisting of named attributes. + Each attribute is basically a name and a list of values. Each + value may have an optional scalar type and a optional reference + to a hash of modifiers. + + *THIS* entry structure is used for LDIF as well as vCard, vCalendar + data storage. + + Each attribute has the following structure: + + $attribute= + { + 'name' => $string, # attribute name + 'value' => $string, # first attribute value, string only + 'values' => # list of all attribute values + [ + { + 'v' => $value, # actual attribute value + 't' => $type, # OPTIONAL attribute type, e.g. 'base64' + 'mod' => {}, # OPTIONAL attribute modifiers, + }, # repeated 1..n times + ] + 'group' => {}, # OPTIONAL grouped properties + }; + + Modifiers are name value pairs and are mainly used to encode + information about properties. + + $modifier= + { + 'n' => $name, # modifier name + 'v' => $value, # modifier value + }, + + Grouped properties are defined in the vCard (section 2.1.4.2) + specification and are used to capture items that belong together. + The field 'group' is a reference to hash containing againg + LDIF entry attributes, keyed by attribute name. This definition + is basically recursive, however, the vCard specification does + not mention recursion. + +=head1 DESCRIPTION + +Stub documentation for LDIF was created by h2xs. + +=head1 Internal Note + +=head1 T2D + + encoding, decoding, checking of binary values + +=head1 Copyright + + Copyright (c) 1998 Gerhard Gonter. All rights reserved. + This is free software; you can redistribute it and/or modify + it under the same terms as Perl itself. + +=head1 AUTHOR + + Gerhard Gonter, g.gonter@ieee.org or gonter@wu-wien.ac.at + +=head1 SEE ALSO + + http://falbala.wu-wien.ac.at:8684/pub/english.cgi/0/24065 + perl(1). + + +=cut diff --git a/Perl/Modules/vdif/VDIF/(dirinf).fm b/Perl/Modules/vdif/VDIF/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..4ffe9352672d5763f4b5c0ad7864acdf6b43567f --- /dev/null +++ b/Perl/Modules/vdif/VDIF/(dirinf).fm @@ -0,0 +1,11 @@ +#!/usr/local/bin/perl +# FILE %work/fbsd/gg/CPAN/vdif/VDIF/(dirinf).fm +# +# written: 1999-10-21 +# latest update: 1999-10-21 18:58:38 +# + +Entry.pm 4158 f 100644 3222 3000 +LDIF.pm 7325 f 100644 3222 3000 +TopCall.pm 2896 f 100644 3222 3000 +vCx.pm 3786 f 100644 3222 3000 diff --git a/Perl/Modules/vdif/VDIF/Entry.pm b/Perl/Modules/vdif/VDIF/Entry.pm new file mode 100644 index 0000000000000000000000000000000000000000..32f73ca4a0b28912632d5a7aa1d16304140c565c --- /dev/null +++ b/Perl/Modules/vdif/VDIF/Entry.pm @@ -0,0 +1,222 @@ +#!/usr/local/bin/perl +# FILE %usr/unixonly/CPAN/vdif-0.01/VDIF/Entry.pm +# +# written: 1998-09-13 +# latest update: 1998-09-13 12:21:08 +# $Id: Entry.pm,v 1.1 2004/08/19 02:12:36 gonter Exp $ +# + +package VDIF::Entry; + +use strict; +use vars qw($VERSION @ISA @EXPORT_OK); + +require Exporter; + +@ISA = qw(Exporter); +@EXPORT_OK = qw(); +$VERSION = '0.02'; +my $MAX_LINE_SIZE= 71; + +# ---------------------------------------------------------------------------- +# create a new VDIF entry +sub new +{ + my $class= shift; + my $dn= shift; + my %attrs= @_; + + my $obj= {}; + bless $obj; + + $obj->add_attribute ('dn', $dn) if ($dn); + + my $attr; + foreach $attr (keys %attrs) + { + $obj->add_attribute ($attr, $attrs{$attr}); + } + + $obj; +} + +# ---------------------------------------------------------------------------- +sub update +{ + my $obj= shift; + my %attrs= @_; + + my $attr; + foreach $attr (keys %attrs) + { + $obj->add_attribute ($attr, $attrs{$attr}); + } + + $obj; +} + +# ---------------------------------------------------------------------------- +sub add_attribute +{ + my ($entry, $name, $value_list, $type, $mod)= @_; + + $name=~ tr/A-Z/a-z/; + my ($value, $aref, $vref); + if (ref ($value_list) eq 'ARRAY') + { + $value= $value_list->[0]; + } + else + { + $value= $value_list; + } + + unless (defined ($aref= $entry->{$name})) + { + $aref= $entry->{$name}= { name => $name, value => $value, values => [] }; + } + + if (ref ($value_list) eq 'ARRAY') + { + foreach $value (@$value_list) + { + push (@{$aref->{values}}, $vref= { 'v' => $value }); + } + } + else + { + push (@{$aref->{values}}, $vref= { 'v' => $value_list }); + } + + $vref->{t}= $type if ($type); + $vref->{'mod'}= $mod if (defined ($mod)); + $vref; +} + +# ---------------------------------------------------------------------------- +sub contains +{ + my ($entry, $aname, $avalue)= @_; + my ($aref, $av); + $aname=~ tr/A-Z/a-z/; + + return 0 unless (defined ($aref= $entry->{$aname})); + return 0 unless (defined ($aref= $aref->{values})); + foreach $av (@$aref) + { + return 1 if ($av->{v} eq $avalue); + } + return 0; +} + +# ---------------------------------------------------------------------------- +sub values +{ + my ($entry, $aname)= @_; + my ($aref); + $aname=~ tr/A-Z/a-z/; + + return undef unless (defined ($aref= $entry->{$aname})); + return undef unless (defined ($aref= $aref->{values})); + + return $aref unless (wantarray); + + # calling function wants just the attribute values... + my ($av, @values); + foreach $av (@$aref) + { + push (@values, $av->{v}); + } + @values; +} + +# ---------------------------------------------------------------------------- +sub value_ref +{ + my ($entry, $aname, $num)= @_; + my ($aref); + $aname=~ tr/A-Z/a-z/; + + return undef unless (defined ($aref= $entry->{$aname})); + return undef unless (defined ($aref= $aref->{values})); + $aref->[$num]; +} + +# ---------------------------------------------------------------------------- +sub value +{ + my $vref= value_ref (@_); + defined ($vref) ? $vref->{v} : undef; +} + +# ---------------------------------------------------------------------------- +# print an entry in LDIF format +sub print_ldif +{ + my $entry= shift; + local *FO= shift || *STDOUT; + my $id= shift; + + print FO $id, "\n" if ($id); + &print_attribute_ldif (*FO, 'dn', ':', $entry->{dn}->{value}); + my ($an, $aref, $vref); + foreach $an (sort keys %$entry) + { + next if ($an eq 'dn'); + $aref= $entry->{$an}; + foreach $vref (@{$aref->{values}}) + { + if ($vref->{t} eq 'base64') + { + &print_attribute_ldif (*FO, $an, '::', $vref->{v}); + } + else + { + &print_attribute_ldif (*FO, $an, ':', $vref->{v}); + } + } + } + print FO "\n"; +} + +# ---------------------------------------------------------------------------- +# print exactly one attribute name and value pair in LDIF format, +# wrap lines longer than $MAX_LINE_SIZE (72) characters as continuation records +sub print_attribute_ldif +{ + local (*FO)= shift; + my ($an, $delimiter, $av)= @_; + my ($lng, $ml); + + print FO $an, $delimiter; + $lng= length ($an) + length ($delimiter); + + while ($av) + { + $ml= length ($av); + if ($lng + $ml <= $MAX_LINE_SIZE) + { + print FO ' ', $av, "\n"; + last; + } + + $ml= $MAX_LINE_SIZE - $lng; + print FO ' ', substr ($av, 0, $ml), "\n"; + $av= substr ($av, $ml); + $lng= 0; + } +} + +# ---------------------------------------------------------------------------- +sub set_MAX_LINE_SIZE +{ + my $o= shift; + my $n= shift; + my $res= $MAX_LINE_SIZE; + $MAX_LINE_SIZE= $n if ($n > 0); + + $res; +} + +# ---------------------------------------------------------------------------- +1; diff --git a/Perl/Modules/vdif/VDIF/LDIF.pm b/Perl/Modules/vdif/VDIF/LDIF.pm new file mode 100644 index 0000000000000000000000000000000000000000..63b0fe19d6fc1c67e1e6f1e3703146ae2c7faef4 --- /dev/null +++ b/Perl/Modules/vdif/VDIF/LDIF.pm @@ -0,0 +1,347 @@ +#!/usr/local/bin/perl +# FILE %usr/unixonly/CPAN/vdif/VDIF/LDIF.pm +# +# written: 1998-09-13 +# latest update: 1999-10-21 18:59:23 +# +# $Id: LDIF.pm,v 1.3 2005/08/23 03:13:07 gonter Exp $ +# + +package VDIF::LDIF; + +use strict; +use vars qw($VERSION @ISA @EXPORT_OK); +# use MIME::Media_Types qw(print_refs); +use VDIF::Entry; + +require Exporter; + +@ISA = qw(Exporter); +@EXPORT_OK = qw(); +$VERSION = '0.01'; + +# ---------------------------------------------------------------------------- +# create a new LDIF repository +# T2D: set up additional indexed, unique and not_null attributes +sub new +{ + my $class= shift; + my $name= shift; # just a name for the LDIF database + + my $obj= + { + name => $name, # just a name + not_null => # attributes which must be present + { + 'dn' => {}, + }, + unique => # records indexed by unique attribute + { + 'dn' => {}, + }, + indexed => {}, # records indexed by non-unique attribute + }; + + my ($mode, $arg); + foreach $arg (@_) + { + if ($arg =~ /^-/) + { + if ($arg =~ /^-(indexed|unique|not_null)$/) { $mode= $1; } + next; + } + $obj->{$mode}->{$arg}= {} if ($mode); + } + + bless $obj, $class; +} + +# ---------------------------------------------------------------------------- +sub get_special_list +{ + my ($ldif, $where, $fld)= @_; + + my $index; + + return (defined ($index= %$ldif->{$where}) + && defined ($index= $index->{$fld}) + ) + ? $index : undef; +} + +# ---------------------------------------------------------------------------- +sub lookup_special_entry +{ + my ($ldif, $where, $fld, $value)= @_; + + my ($index, $ue); + + return (defined ($index= %$ldif->{$where}) + && defined ($index= $index->{$fld}) + && defined ($ue= $index->{$value}) # value present + ) + ? $ue : undef; +} + +# ---------------------------------------------------------------------------- +sub lookup_unique +{ + my ($ldif, $fld, $value)= @_; + &lookup_special_entry ($ldif, 'unique', $fld, $value); +} + +# ---------------------------------------------------------------------------- +sub lookup_dn +{ + my ($ldif, $fld, $value)= @_; + &lookup_special_entry ($ldif, 'unique', 'dn', $value); +} + +# ---------------------------------------------------------------------------- +sub lookup_indexed +{ + my ($ldif, $fld, $value)= @_; + &lookup_special_entry ($ldif, 'indexed', $fld, $value); + # Note: returns an array reference! +} + +# ---------------------------------------------------------------------------- +# this one is cheap! +sub lookup_not_null +{ + my ($ldif, $fld, $value)= @_; + &lookup_special_entry ($ldif, 'not_null', $fld, $value); +} + +# ---------------------------------------------------------------------------- +sub print_all +{ + my $ldif= shift; + local (*FO)= shift; + + my $idx= $ldif->{not_null}; # just the first key will do + my ($key)= keys (%$idx); # just the first key will do + ### print ">> key=$key\n"; + + my ($dn, $entry, $values); + my $index= $idx->{$key}; + foreach $dn (keys %$index) + { + $values= $index->{$dn}; + foreach $entry (@$values) + { + ### print ">>> dn=$dn, entry=$entry\n"; &print_refs (*STDOUT, 'entry', $entry); + $entry->print_ldif (*FO); + } + } +} + +# ---------------------------------------------------------------------------- +# add a LDIF entry to a LDIF database +sub add_entry +{ + my $ldif= shift; + my $entry= shift; + + my ($fld, $index, $ue, $aref, $av); + # check if required attributes are present and uniquenes is given + my $errors= 0; + foreach $fld (keys %{$ldif->{not_null}}) + { + $index= $ldif->{not_null}; + unless (defined ($aref= $entry->{$fld}) # attribute is present + && ($av= $aref->{value}) # value is defined + ) + { + print "ERROR: $ldif->{name} null value: $fld\n"; + $errors++; + } + } + return undef if ($errors); + + $errors= 0; + foreach $fld (keys %{$ldif->{unique}}) + { + $index= $ldif->{unique}; + if (!defined ($aref= $entry->{$fld}) # attribute is present + || $#{$aref->{values}} != 0 # only one value ... + || !defined ($av= $aref->{value}) # ... is defined + || defined ($ue= $index->{$av}) # value not already present + ) + { + print "ERROR: $ldif->{name} not unique: $fld=$av\n"; + $errors++; + } + } + return undef if ($errors); + + # insert unique keys + foreach $fld (keys %{$ldif->{unique}}) + { + $index= $ldif->{unique}->{$fld}; + $aref= $entry->{$fld}; # attribute is present + $av= $aref->{value}; # value is defined + $index->{$av}= $entry; + } + + &insert_index ($ldif, 'indexed', $entry); + &insert_index ($ldif, 'not_null', $entry); + $entry; +} + +# ---------------------------------------------------------------------------- +sub insert_index +{ + my ($ldif, $what, $entry)= @_; + + # insert indexed keys + my ($vref, $fld, $aref, $index, $av, $ue); + foreach $fld (keys %{$ldif->{$what}}) + { + next unless (defined ($aref= $entry->{$fld})); # attribute is present + $index= $ldif->{$what}->{$fld}; + foreach $vref (@{$aref->{values}}) + { + $av= $vref->{v}; + $ue= $index->{$av}= [] unless (defined ($ue= $index->{$av})); + push (@$ue, $entry); + } + } +} + +# ---------------------------------------------------------------------------- +# add the contents of LDIF stream to a LDIF database +sub add_file +{ + my $ldif= shift; + my $fnm= shift; + + my @entries= &VDIF::parse_file ($fnm); + my $entry; + foreach $entry (@entries) + { + $ldif->add_entry ($entry); + } + + @entries; +} + +# ---------------------------------------------------------------------------- +sub parse_stream +{ + local *FI= shift; # already opened stream + my $fnm= shift; # used for error messages + my $dn_suffix= shift; # suffix for generated dn values + + my @entries; + + &parse_stream2 (*FI, $fnm, $dn_suffix, sub { push (@entries, @_); }); + + return (wantarray) ? @entries : \@entries; +} + +# ---------------------------------------------------------------------------- +# T2D: options to limit number of lines, entries, bytes or such +sub parse_stream2 +{ + local *FI= shift; # already opened stream + my $fnm= shift; # used for error messages + my $dn_suffix= shift; # suffix for generated dn values + my $cb= shift; # callback to process entry + + $dn_suffix= ','.$dn_suffix if ($dn_suffix && !($dn_suffix =~ /^,/)); + + print "parsing stream: cb='$cb'\n"; + + my $line= 0; + my @data= (); + while (<FI>) + { + $line++; + chomp; + s/\015//g; + +# print $line, " ", $_, "\n"; + next if (/^#/); # comments are not defined in VDIF files! + next if (/^\d+$/); # optional ID line + + if (/^\s*$/) + { + my $entry= &parse_lines ($dn_suffix, \@data); + if (defined ($entry)) + { + &$cb ($entry); + } + $entry= undef; + @data= (); + } + elsif (/^[ \t](.*)/) # attribute value continuation + { + $data[$#data] .= $1; + } + elsif (/^\w+:/) + { + push (@data, $_); + } + else + { + print STDERR "LDIF error $fnm ($line): $_\n"; + } + } + + if (@data) + { + my $entry= &parse_lines ($dn_suffix, \@data); + &$cb ($entry) if (defined ($entry)); # process entry from last dn + } + + $line; +} + +sub parse_lines +{ + my $dn_suffix= shift; + my $data= shift; + +# print "parse_lines: dn_suffix=$dn_suffix data=$data ", $#$data, "\n"; + my $entry; + local $_; + foreach $_ (@$data) + { +# print $_, "\n"; + if (/^(\w+)(\:\:?)[ \t]*(.*)/) # attribute value in ascii format + { + my ($an, $ty, $av)= ($1, $2, $3); $an=~ tr/A-Z/a-z/; + + $ty= ($ty eq '::') ? 'base64' : undef; + + if ($an eq 'dn') + { + if ($ty eq 'base64') + { + print "ERROR: dn in base64 not supported! [$av]\n"; + return undef; + } + $av .= $dn_suffix if ($dn_suffix); + $entry= new VDIF::Entry ($av, $ty); + # push (@entries, $entry); + } + elsif (!$entry) + { + printf STDERR "WARNING: not a valid entry\n"; + } + else + { + $entry->add_attribute ($an, $av, $ty); + } + } + else + { + return undef; + } + } + + $entry; +} + +1; diff --git a/Perl/Modules/vdif/VDIF/TopCall.pm b/Perl/Modules/vdif/VDIF/TopCall.pm new file mode 100644 index 0000000000000000000000000000000000000000..1ca0c5e77567d6594c9154a8a7f7e9dfa44e389c --- /dev/null +++ b/Perl/Modules/vdif/VDIF/TopCall.pm @@ -0,0 +1,123 @@ +#!/usr/local/bin/perl +# FILE %usr/unixonly/CPAN/vdif-0.01/VDIF/TopCall.pm +# +# written: 1998-10-08 +# latest update: 1998-10-08 11:57:55 +# + +package VDIF::TopCall; + +use strict; +use vars qw($VERSION @ISA @EXPORT_OK); +use VDIF::Entry; + +require Exporter; + +@ISA = qw(Exporter); +@EXPORT_OK = qw(); +$VERSION = '0.01'; + +# ---------------------------------------------------------------------------- +sub new +{ + my $class= shift; + my $name= shift; + + my $obj= + { + }; + bless $obj, $class; +} + +# ---------------------------------------------------------------------------- +sub parse_stream +{ + local (*FI)= shift; # already opened stream + my $fnm= shift; # used for error messages + + my @L; + my $LP= \@L; # pointer to current container + my @Stack; # stack of entry container pointers; + my $line; + + my ($type, $name, $val); + my (%TYPES, %NAMES); + + while (<FI>) + { + $line++; + chomp; + s/\015//g; + next if (/^#/); # comments are not defined + +# print ">$_<\n"; + if (/^\s*(\S+)\s*=\s*\($/) + { # new structured entry + $name= $1; + ($type, $name)= split ('/', $name); + ($name, $type)= ($type, '__list__') unless ($name); + + # insert the new structure into the current container + my $nx_entry= { 'type' => $type, 'name' => $name, 'list' => []}; + push (@$LP, $nx_entry); + + # push the current pointers to the stack +# print ">>> $_ $#Stack $line\n";# if ($#Stack == -1); + push (@Stack, $LP); + $LP= $nx_entry->{list}; + + $TYPES{$type}++; + $NAMES{$name}++; + } + elsif (/^\s*\)(,|)$/) + { # structure is completed, pop pointers from the stacks +# print "<<< $_ $#Stack $line\n";# if ($#Stack == -1); + $LP= pop (@Stack); + } + elsif (/^\s*(\S+)\/(\S+)\s*=\s*((-|)\d+)(,|)$/ + || /^\s*(\S+)\/(\S+)\s*=\s*\"([^\"]*)\"(,|)$/ + ) + { + ($type, $name, $val)= ($1, $2, $3); + my $nx_entry= { 'type' => $type, 'name' => $name, 'val' => $val }; + push (@$LP, $nx_entry); + $TYPES{$type}++; + $NAMES{$name}++; + } + elsif (/^\s*(\S+)\/(\S+)\s*=\s*\(\)(,|)$/) + { + ($type, $name, $val)= ($1, $2, []); + my $nx_entry= { 'type' => $type, 'name' => $name, 'list' => $val }; + push (@$LP, $nx_entry); + $TYPES{$type}++; + $NAMES{$name}++; + } + elsif (/^\s*(\S+)\s*=\s*\(\)(,|)$/) + { + ($type, $name, $val)= ('__list__', $1, []); + my $nx_entry= { 'type' => $type, 'name' => $name, 'list' => $val }; + push (@$LP, $nx_entry); + $TYPES{$type}++; + $NAMES{$name}++; + } + else + { + print ">>> $_\n"; + } + } + + foreach $type (sort keys %TYPES) + { + printf ("type: %7d %s\n", $TYPES{$type}, $type); + } + + foreach $name (sort keys %NAMES) + { + printf ("name: %7d %s\n", $NAMES{$name}, $name); + } + + \@L; +} + +# ---------------------------------------------------------------------------- +1; diff --git a/Perl/Modules/vdif/VDIF/vCx.pm b/Perl/Modules/vdif/VDIF/vCx.pm new file mode 100644 index 0000000000000000000000000000000000000000..3f7fed1f4bcfa7c80f574b2a25d0864cfd150993 --- /dev/null +++ b/Perl/Modules/vdif/VDIF/vCx.pm @@ -0,0 +1,139 @@ +#!/usr/local/bin/perl +# FILE %usr/unixonly/CPAN/vdif-0.01/VDIF/vCx.pm +# +# written: 1998-09-12 +# latest update: 1998-10-08 12:00:49 +# + +package VDIF::vCx; + +use vars qw($VERSION @ISA @EXPORT_OK); + +require Exporter; + +@ISA = qw(Exporter); +@EXPORT_OK = qw(); +$VERSION = '0.01'; + +# ---------------------------------------------------------------------------- +# T2D: options to limit number of lines, entries, bytes or such +sub parse_stream +{ + local (*FI)= shift; # already opened stream + my $fnm= shift; # used for error messages + my $dn_suffix= shift; # suffix for generated dn values + $dn_suffix= ','.$dn_suffix if ($dn_suffix && !($dn_suffix =~ /^,/)); + + my ($p_n, $p_val, $p_mod, $vref); + my $entry; # current active entry + my @entry_stack; # vCalendar files define one level of nesting + my $line; + my %count; # sequence counter for various object types + my @entries; + + while (<FI>) + { + $line++; + chomp; + s/\015//g; + next if (/^#/); # comments are not defined in vCard, vCalendar files! + + if (/^(\w[\w\d\-\.]*):(.*)/) # property without modifiers + { + $p_n= $1; $p_val= $2; $p_n=~ tr/A-Z/a-z/; + + if ($p_n eq 'begin') + { # some object begins here + $p_val=~ tr/A-Z/a-z/; # normalize object type + + my $dn= sprintf ("%s=%d,class=vcx", $p_val, ++$count{$p_val}); + $dn .= $dn_suffix if ($dn_suffix); + + push (@entry_stack, $entry); + $entry= new VDIF::Entry ($dn); + $vref= $entry->add_attribute ($p_n, $p_val); + push (@entries, $entry); + } + elsif ($p_n eq 'end') + { # something ends here ... + # $p_val=~ tr/A-Z/a-z/; # normalize object type again + $entry= pop (@entry_stack); + } + else + { + $vref= $entry->add_attribute ($p_n, $p_val); + } + } + elsif ($entry + && /^(\w[\w\d\-\.]*);([^:]*):(.*)/ # property with modifiers + ) + { + $p_n= $1; $p_mod= $2; $p_val= $3; + $p_n=~ tr/A-Z/a-z/; + + # analyze properity parameters into modifier reference structure + $p_mod= &normalize_property_parameters ($p_mod); + + $vref= $entry->add_attribute ($p_n, $p_val, '', $p_mod); + } + elsif ($entry + && /^[ \t](.*)/ # attribute value continuation + ) # exactly one blank or TAB + { # T2D: this is defined differently! + $vref->{v} .= $1; + } + elsif ($entry) + { + $vref->{v} .= $_; + } + # else skip this, this does not belong to anything. + } + + return (wantarray) ? @entries : \@entries; +} + +# ---------------------------------------------------------------------------- +sub normalize_property_parameters +{ + my $str= shift || return undef; + + # NOTE: property parameters are spearated by semi colons and + # may also contain semi colons if they are escaped as \; + # Thus we split the string and combine thos with the back slash. + # ALSO NOTE: the vCard specification doesn't mention escaped colons! + + # return values: + # + array context: unprocessed property parameter list + # + scalar context: reference to modifier structure + + my @f= split (/;/, $str); + my (@f2, $f); + while (defined ($f= shift (@f))) + { + while ($#f >= 0 && $f =~ /\\$/) { $f= $f .';'. shift (@f); } + @f2= push (@f2); + } + + return @f2 if (wantarray); + + my ($pn, $pv); + my %mod; + while (defined ($f= shift (@f2))) + { + ($pn, $pv)= split ('=', $f, 2); + $pn=~ tr/A-Z/a-z/; + + if ($pn eq 'quoted-printable' || $pn eq 'base64' || $pn eq '8-bit') + { # Grrrr!!!! This non-sense called "valid shorthand version" + # is defined in vCalendar V1.0, section 2.1.2 + $pv= $pn; + $pn= 'encoding'; + } + + $mod{$pn}= $pv; + } + + \%mod; +} + +1; diff --git a/Perl/Modules/vdif/scripts/(dirinf).fm b/Perl/Modules/vdif/scripts/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..a870f42a7688c6e1bc9b270d6282dd803830d4f2 --- /dev/null +++ b/Perl/Modules/vdif/scripts/(dirinf).fm @@ -0,0 +1,10 @@ +# automagically GENERATED directory listing of /afs/wu-wien.ac.at/home/edvz/gonter/usr/work/fbsd/gg/CPAN/vdif/scripts +# filename size T mode owner group +. 16384 d 040700 14685 0 +.. 4096 d 040777 0 0 +(dirinf).fm 0 f 100644 3222 3000 +CVS 2048 d 040755 3222 3000 +_bak_ftr.ned 2048 d 040755 3222 3000 +abook.pl 5077 f 100755 3222 3000 +almagen.pl 699 f 100755 3222 3000 +cookieflt.pl 1132 f 100755 3222 3000 diff --git a/Perl/Modules/vdif/scripts/abook.pl b/Perl/Modules/vdif/scripts/abook.pl new file mode 100755 index 0000000000000000000000000000000000000000..9ab8a11face6afbfea1836380a14f9ec03da35f4 --- /dev/null +++ b/Perl/Modules/vdif/scripts/abook.pl @@ -0,0 +1,247 @@ +#!/usr/local/bin/perl +# FILE %usr/unixonly/hp200lx/CPAN/ldif-0.01/pl.pl +# +# written: 1998-08-09 +# latest update: 1998-08-09 16:55:13 +# + +use strict; +use lib '.'; +use VDIF; + +# require MIME::Media_Types; # debugging +use MIME::Base64; + +# configuration; +my $nick_attribute= 'xmozillanickname'; + +# init +my $aliases= shift || 'aliases.text'; +my $in_format= 'elm'; +my $out_fmt= 'mozilla'; +my @mozilla_object_classes= +( 'top', 'person', 'organizationalPerson', + 'inetOrgPerson', 'mozillaAbPersonObsolete' +); + +# &convert ('vcards-comp.out', 'out.ldif', 'vcard', 'ldif'); +&convert ($aliases, 'out.ldif', $in_format, 'ldif'); +# &convert ('addr.txt', 'out.ldif', 'casio', 'ldif'); +exit (0); + +# ---------------------------------------------------------------------------- +sub convert +{ + my ($in_file, $out_file, $in_format, $out_format)= @_; + + my $ldif= new VDIF::LDIF ('abook');#, '-unique', $nick_attribute); + + if ($in_format eq 'elm' || $in_format eq 'pine') + { + &read_elm_aliases ($ldif, $aliases, $in_format); + } + elsif ($in_format eq 'casio') + { + &read_casio_addresses ($ldif, $in_file, $in_format); + } + elsif ($in_format eq 'vcard' || $in_format eq 'vcx') + { + &read_vcards ($ldif, $in_file); + } + else + { + die "Unknown input file format $in_format"; + } + + if ($out_format eq 'ldif') + { + local (*FH); + open (FH, ">$out_file") || die; + $ldif->print_all (*FH); + close (FH); + } + else + { + die "Unknown ouput file format $out_format"; + } + + 1; +} + +# ---------------------------------------------------------------------------- +sub read_vcards +{ + my $ldif= shift; + my $fnm= shift; + + print "read_vcards: fnm=$fnm\n"; + my @list= &VDIF::parse_file ($fnm, 'vcx', 'news=comp'); + + my $entry; + foreach $entry (@list) + { + $ldif->add_entry ($entry); + } +} + +# ---------------------------------------------------------------------------- +# read ELM aliases file or PINE addressbook +sub read_elm_aliases +{ + my $ldif= shift; + my $fnm= shift; + my $mode= shift || 'elm'; # maybe 'pine' ... + + open (FI, $fnm) || die "cant read $fnm"; + while (<FI>) + { + chop; + my ($nick, $fullname, $address, $description); + if ($mode eq 'pine') + { + ($nick, $fullname, $address)= split (/\t/); + } + else + { + ($nick, $fullname, $address)= split (/\s*=\s*/); + } + + unless ($fullname) + { # no fullname, fake something + $fullname= $nick; + } + + ($fullname, $description)= split (/, */, $fullname); + my ($sn, $givenname)= split (/; */, $fullname); + + if ($givenname) + { + $fullname= "$givenname $sn"; + } + else + { + $fullname= $givenname= $sn; + $sn= ''; + } + + my $dn= "cn=$fullname,mail=$address"; + my $entry= new VDIF::Entry + ( + $dn, + 'cn' => $fullname, + 'givenname' => $givenname, + $nick_attribute => $nick, + 'objectclass' => \@mozilla_object_classes, + 'mail' => $address + ); + $entry->add_attribute ('sn', $sn) if ($sn); + $entry->add_attribute ('description', $description) + if ($description); + + $ldif->add_entry ($entry); + + # print ">>> dump entry\n"; + # MIME::Media_Types::print_refs (*STDOUT, 'entry', $entry); + + } + close (FI); +} + +# ---------------------------------------------------------------------------- +# read ELM aliases file or PINE addressbook +sub read_casio_addresses +{ + my $ldif= shift; + my $fnm= shift; + + my $cnt= 0; + my $entry_cnt= 0; + my $entry= undef; + my (@desc, $fullname); + + open (FI, $fnm) || die "cant read $fnm"; + while (<FI>) + { + chomp; + $cnt++; + + s/ +$//; + s/\x0d//g; + tr/\x81\x84\x8E\x94\x99\x9A\xE1\xF1/\xDC\xE4\xC4\xF6\xD6\xDC\xDF\xB1/; + # print "$cnt: $_\n"; + if ($cnt == 1) + { # empty line used as separator + } + elsif ($cnt == 2) + { + $fullname= $_; + + my ($sn, $givenname)= split (' ', $fullname, 2); + $entry_cnt++; + my $dn= "cn=$fullname,num=$entry_cnt"; + $entry= new VDIF::Entry + ( + $dn, + 'cn' => $fullname, + 'sn' => $sn, + 'objectclass' => \@mozilla_object_classes, + ); + $entry->add_attribute ('givenname' => $givenname) if ($givenname); + + $entry_cnt++; + @desc= (); + } + elsif ($cnt == 3 && $_) + { + $entry->add_attribute ('telephonenumber', $_); + } + elsif ($cnt == 4 && $_) + { + my @f= split (/\\/); + my @g= (); + my $f; + foreach $f (@f) + { + if ($f =~ /[A-Z]\-\d+/) + { # vermutlich Postleitzahl mit Stadt + $entry->add_attribute ('locality', $f); + } + else { push (@g, $f); } + } + + $entry->add_attribute ('streetaddress', join ('$', @g)); + } + elsif ($_ =~ /\@/) + { + $entry->add_attribute ('mail', $_); + } + elsif ($_ =~ /nick: *(.*)/) + { + $entry->add_attribute ('xmozillanickname', $1) + } + elsif ($_) + { + push (@desc, $_); + } + + if ($cnt == 10) + { + if ($#desc >= 0) + { + my $description= MIME::Base64::encode (join ("\n", @desc)); + $description=~ s/\n//g; + + $entry->add_attribute ('description', $description, 'base64'); + } + $ldif->add_entry ($entry); + + # print ">>> dump entry\n"; + # MIME::Media_Types::print_refs (*STDOUT, 'entry', $entry); + print "fullname=$fullname\n"; + + $cnt= 0; + $entry= undef; + } + } + close (FI); +} diff --git a/Perl/Modules/vdif/scripts/almagen.pl b/Perl/Modules/vdif/scripts/almagen.pl new file mode 100755 index 0000000000000000000000000000000000000000..06fed9a95c95d78ae782fab6bd515e9fee22d0b5 --- /dev/null +++ b/Perl/Modules/vdif/scripts/almagen.pl @@ -0,0 +1,37 @@ +#!/usr/local/bin/perl +# FILE .../CPAN/ldif/cookieflt.pl +# +# filter out old items from a cookie database +# +# written: 1998-09-01 +# latest update: 1999-06-14 14:55:56 +# + +use lib '.'; +use VDIF; + +$fnm_in= shift (@ARGV) || die "need input LDIF file"; +$domain= shift (@ARGV) || die "need domain name"; + +$ldif= new VDIF::LDIF ('cookie-db'); + +@entries= $ldif->add_file ($fnm_in); +@filtered= (); + +my $now= time; +foreach $entry (@entries) +{ + # $entry->print_ldif (*STDOUT); + + my $oc= $entry->value ('objectclass', 0); + next unless ($oc eq 'personalalias'); + my $lhs= $entry->value ('lhs', 0); + my $rhs= $entry->value ('rhs', 0); + print "$lhs\@$domain\t$rhs\n"; +} + +foreach $entry (@filtered) +{ +} + + diff --git a/Perl/Modules/vdif/scripts/cookiefilt2.pl b/Perl/Modules/vdif/scripts/cookiefilt2.pl new file mode 100644 index 0000000000000000000000000000000000000000..c4d9468b6375956c0a3ad3c386099d9c7df5b113 --- /dev/null +++ b/Perl/Modules/vdif/scripts/cookiefilt2.pl @@ -0,0 +1,79 @@ +#!/usr/local/bin/perl +# FILE %gg/work/fbsd/gg/CPAN/vdif/scripts/cookiefilt2.pl +# +# written: 2003-03-06 +# latest update: 2003-03-06 16:38:56 +# $Id: cookiefilt2.pl,v 1.1 2004/08/19 02:12:36 gonter Exp $ +# + +use strict; + +use lib '.'; +use VDIF; + +my $fnm_in= shift (@ARGV) || die "need input LDIF file"; +my $fnm_out= shift (@ARGV) || '@cookiefilt-out.ldif'; + +my $now= time (); +my $count_analyzed= 0; +my $count_used= 0; + +&perform_filtering ($fnm_in, $fnm_out); +printf ("filter: %6d %6d\n", $count_analyzed, $count_used); + +exit (0); + +sub perform_filtering +{ + my $fnm_in= shift; + my $fnm_out= shift; + + local (*FI, *FO); + open (FI, $fnm_in) || die; + open (FO, ">$fnm_out") || die; + + &VDIF::LDIF::parse_stream2 (*FI, $fnm_in, '', sub { &filter_ldif_entry ($_[0], *FO); } ); + close (FI); + close (FO); +} + +sub filter_ldif_entry +{ + my $entry= shift; + local *FO= shift; + + my $use= 0; + $count_analyzed++; + + my ($dn, $vll); + if ($entry->contains ('objectclass', 'cookie') + && $entry->contains ('state', 'good') + && $entry->value ('expires', 0) > $now + ) + { # good cookie which expires sometime in the future! + $use= 1; + } + elsif ($entry->contains ('objectclass', 'prefs') + && ($dn= $entry->value ('dn', 0)) + && ($dn=~ /,cm=qdpop,/) + ) + { # Preferences fuer den Web Popper + unless (defined ($vll= $entry->values ('cm'))) + { # zusaetzliches Attribut einfuegen, falls nicht schon vorhanden + $entry->add_attribute ('cm', 'qdpop'); + } + $use= 1; + } + + if ($use) + { + $entry->print_ldif (*FO); + $count_used++; + } + + printf ("filter: %6d %6d\n", $count_analyzed, $count_used) + if (($count_analyzed % 100) == 0); +} + + + diff --git a/Perl/Modules/vdif/scripts/cookieflt.pl b/Perl/Modules/vdif/scripts/cookieflt.pl new file mode 100755 index 0000000000000000000000000000000000000000..b2c00da4387f7727b27772cc4f76d4e7db376dc0 --- /dev/null +++ b/Perl/Modules/vdif/scripts/cookieflt.pl @@ -0,0 +1,53 @@ +#!/usr/local/bin/perl +# FILE .../CPAN/vdif/scripts/cookieflt.pl +# +# filter out old items from a cookie database +# +# written: 1998-09-01 +# latest update: 1999-06-14 14:55:56 +# $Id: cookieflt.pl,v 1.1 2004/08/19 02:12:36 gonter Exp $ +# + +use lib '.'; +use VDIF; + +$fnm_in= shift (@ARGV) || die "need input LDIF file"; + +$ldif= new VDIF::LDIF ('cookie-db'); + +@entries= $ldif->add_file ($fnm_in); +@filtered= (); + +my $now= time; +foreach $entry (@entries) +{ + # $dn= $entry->value ('dn', 0); + # print ">> dn: $dn\n"; + + if ($entry->contains ('objectclass', 'cookie') + && $entry->contains ('state', 'good') + && $entry->value ('expires', 0) > $now + ) + { # good cookie which expire sometime in the future! + push (@filtered, $entry); + } + elsif ($entry->contains ('objectclass', 'prefs') + && ($dn= $entry->value ('dn', 0)) + && ($dn=~ /,cm=qdpop,/) + ) + { # Preferences fuer den Web Popper + unless (defined ($vll= $entry->values ('cm'))) + { # zusaetzliches Attribut einfuegen, falls nicht schon vorhanden + $entry->add_attribute ('cm', 'qdpop'); + } + + push (@filtered, $entry); + } +} + +foreach $entry (@filtered) +{ + $entry->print_ldif (*STDOUT); +} + + diff --git a/Perl/Modules/vdif/test.pl b/Perl/Modules/vdif/test.pl new file mode 100644 index 0000000000000000000000000000000000000000..8a9a901f3685568553f88df67bebf31f3b401319 --- /dev/null +++ b/Perl/Modules/vdif/test.pl @@ -0,0 +1,20 @@ +# Before `make install' is performed this script should be runnable with +# `make test'. After `make install' it should work as `perl test.pl' + +######################### We start with some black magic to print on failure. + +# Change 1..1 below to 1..last_test_to_print . +# (It may become useful if the test is moved to ./t subdirectory.) + +BEGIN {print "1..1\n";} +END {print "not ok 1\n" unless $loaded;} +use VDIF::LDIF; +$loaded = 1; +print "ok 1\n"; + +######################### End of black magic. + +# Insert your test code below (better if it prints "ok 13" +# (correspondingly "not ok 13") depending on the success of chunk 13 +# of the test code): + diff --git a/app/Makefile b/app/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..60acd1c1b6fdc4e109dbda4fc910a308103d1d43 --- /dev/null +++ b/app/Makefile @@ -0,0 +1,41 @@ +#!/usr/local/bin/perl +# FILE .../app/Makefile +# +# written: 1999-04-25 +# latest update: 1999-04-25 10:22:59 +# $Id: Makefile,v 1.4 2002/12/24 07:02:27 gonter Exp $ +# + +all : all.utils + +all.ned: + (cd ned;make all.groups all) + +all.utils: + (cd sgml; make) + (cd nl_kr; make) + (cd lex; make) + (cd lexicon; make) + +install: install.utils + +install.utils: + (cd sgml; make install) + (cd nl_kr; make install) + (cd lexicon; make install) + +# do not install this yet! +install.broken: + (cd lexicon; make install) + +clean: clean.ned clean.utils + +clean.ned: + (cd ned; make clean) + +clean.utils: + (cd sgml; make clean) + (cd nl_kr; make clean) + (cd lex; make clean) + (cd lexicon; make clean) + diff --git a/app/SetupWork b/app/SetupWork new file mode 100755 index 0000000000000000000000000000000000000000..4233f9dcefb50d5ed5019a7ce43a8d2fb6ffd35d --- /dev/null +++ b/app/SetupWork @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +my @SUBDIRS= qw( +planner +sgml +nl_kr lex lexicon +); + +my %OLD_LIST1= +( + 'include/gg' => 'gg', + 'include/contrib' => 'contrib', +); + +my %OLD_LIST2= +( +); + +my ($sub); +foreach $sub (@SUBDIRS) +{ + next unless (-d $sub); + &mk_links ($sub); +} +print "(cd ned; ./SetupWork)\n"; + +exit (0); + +sub mk_links +{ + my $dir= shift; + + my ($old, $new); + foreach $old (sort keys %OLD_LIST1) + { + $new= $OLD_LIST1{$old}; + print "ln -fs ../../lib/$old $dir/$new\n"; + } + + foreach $old (sort keys %OLD_LIST2) + { + $new= $OLD_LIST2{$old}; + print "ln -fs $old $dir/$new\n"; + } + print "\n"; +} diff --git a/app/lex/(dirinf).fm b/app/lex/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..52651f8e6a157b327e12fc031474cb7e5a437993 --- /dev/null +++ b/app/lex/(dirinf).fm @@ -0,0 +1,24 @@ +# automagically GENERATED directory listing of /afs/wu-wien.ac.at/home/edvz/gonter/usr/work/fbsd/gg/app/lex +# filename size T mode owner group +. 2048 d 040755 3222 3000 +.. 2048 d 040755 3222 3000 +(dirinf).fm 0 f 100644 1 3000 +CVS 2048 d 040755 3222 3000 +Makefile 325 f 100644 3222 3000 +_bak_ftr.ned 2048 d 040755 3222 3000 +contrib 25 l 120755 3222 3000 +gg 20 l 120755 3222 3000 +lexcut 16913 f 100755 3222 3000 +lexcut.c 5271 f 100644 3222 3000 +lexcut.o 5276 f 100644 3222 3000 +lexcut01.c 1583 f 100644 3222 3000 +lexcut01.o 1612 f 100644 3222 3000 +lexdiv.c 4533 f 100644 3222 3000 +lexm.c 3567 f 100644 3222 3000 +lexm2.c 3219 f 100644 3222 3000 +lext.c 5650 f 100644 3222 3000 +lext1.c 6551 f 100644 3222 3000 +make-dos 1544 f 100644 3222 3000 +makeshar.lst 340 f 100644 3222 3000 +xxconven.c 1285 f 100644 3222 3000 +yyconven.c 1418 f 100644 3222 3000 diff --git a/app/lex/.cvsignore b/app/lex/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..a7e0f6a68b454f7578c16e6f4028cb6529d7b3c4 --- /dev/null +++ b/app/lex/.cvsignore @@ -0,0 +1 @@ +lexcut diff --git a/app/lex/Makefile b/app/lex/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..135582b677f5f79c0685dbc260fc6a24d5e1525e --- /dev/null +++ b/app/lex/Makefile @@ -0,0 +1,28 @@ +# +# FILE ~/usr/lex/makefile.ux +# +# Makefile for the lex files under Unix +# +# written: 1993-07-05 +# latest update: 1999-05-08 10:10:04 +# + +CC=cc +OPTS=-I. +lib=lsbr.a + +all : lexcut + +install: + @echo nothing to install + +clean : + rm -f *.o lexcut + +# -------- +.c.o: + $(CC) $(OPTS) -c $*.c + +# -------- +lexcut: lexcut.o lexcut01.o + cc -o lexcut lexcut.o lexcut01.o diff --git a/app/lex/contrib b/app/lex/contrib new file mode 120000 index 0000000000000000000000000000000000000000..6021a51ea9120394be7d8ebb813d5b9b5d4e575c --- /dev/null +++ b/app/lex/contrib @@ -0,0 +1 @@ +../../lib/include/contrib \ No newline at end of file diff --git a/app/lex/gg b/app/lex/gg new file mode 120000 index 0000000000000000000000000000000000000000..7b7c80811f4d282d5ba38a29e0f67cf0b8335b96 --- /dev/null +++ b/app/lex/gg @@ -0,0 +1 @@ +../../lib/include/gg \ No newline at end of file diff --git a/app/lex/lexcut b/app/lex/lexcut new file mode 100755 index 0000000000000000000000000000000000000000..a51e3d00c8cb557a8cffe8ce059c86a11bc78fc2 Binary files /dev/null and b/app/lex/lexcut differ diff --git a/app/lex/lexcut.c b/app/lex/lexcut.c new file mode 100644 index 0000000000000000000000000000000000000000..05098d8ec9844baf0b97a929088dbc016548f930 --- /dev/null +++ b/app/lex/lexcut.c @@ -0,0 +1,229 @@ +/* + * FILE ~/usr/lex/lexcut.c + * + * cut up a lexicon file into seperate files where each entry + * shares the first N_PREFIX characters. + * + * written: 1993-07-05 + * latest update: 1994-07-17 + * + */ + + +#include <stdio.h> +#include <string.h> + +#ifndef MSDOS +#ifndef cdecl +#define cdecl +#endif +#endif + +int cdecl main (int argc, char *argv[]); +int cdecl lexicon_cut (char *fnm); +char *cdecl get_extension (char *key); + +#define DO_WRITE_DATA /* really transfer data to the outfile */ + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + if (argc == 2) + lexicon_cut (argv[1]); + else + { + fprintf (stderr, "usage: %s lexicon file\n", argv[0]); + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +#define MAX_BUFFER 2000 +static char buffer [MAX_BUFFER+10]; +static char le_buffer [MAX_BUFFER+10]; +static char le_last [MAX_BUFFER]= "shurely not that"; +static char outname [200]; + +/* ------------------------------------------------------------------------ */ +int lexicon_cut (char *fnm) +{ + FILE *fi; + FILE *fo= (FILE *) 0; + int ch; +#define STAT_start 0 +#define STAT_lt 1 +#define STAT_colon 2 +#define STAT_L 3 +#define STAT_LX 4 +#define STAT_fr 5 +#define STAT_fr_lt 6 +#define STAT_fr_l 7 +#define STAT_fr_le 8 +#define STAT_fr_LE 9 + int stat= STAT_start; + int buffer_idx; + int le_idx; + char *cluster_ext; + + if ((fi= fopen (fnm, "r")) == (FILE *) 0) return -1; + buffer_idx= 0; + for (;;) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + switch (stat) + { + case STAT_start: + if (ch == '<') + { + buffer [0]= '<'; + buffer [1]= 0; + buffer_idx= 1; + stat= STAT_lt; + } + else + { + if (fo != (FILE *) 0) fputc (ch, fo); + } + break; + + case STAT_lt: + if (ch == ':') + { + stat= STAT_colon; + buffer [buffer_idx++]= (char) ch; + buffer [buffer_idx]= 0; + } + else + { +FLUSH_BUFFER: + if (fo != (FILE *) 0) + { + fprintf (fo, "%s%c", buffer, ch); + } + stat= STAT_start; + } + break; + + case STAT_colon: + if (ch == 'L') + { + stat= STAT_L; + buffer [buffer_idx++]= (char) ch; + buffer [buffer_idx]= 0; + } + else goto FLUSH_BUFFER; + break; + + case STAT_L: + if (ch == 'X') + { + stat= STAT_LX; + buffer [buffer_idx++]= (char) ch; + buffer [buffer_idx]= 0; + } + else goto FLUSH_BUFFER; + break; + + case STAT_LX: + if (ch == '>') + { + stat= STAT_fr; + buffer [buffer_idx++]= (char) ch; + buffer [buffer_idx]= 0; + } + else + { + if (buffer_idx >= MAX_BUFFER) + { + fprintf (stderr, "error: frame start sequence too long!\n"); + goto FLUSH_BUFFER; + } + else + { + buffer [buffer_idx++]= (char) ch; + buffer [buffer_idx]= 0; + } + } + break; + + case STAT_fr: + if (ch == '<') + { + stat= STAT_fr_lt; + buffer [buffer_idx++]= (char) ch; + buffer [buffer_idx]= 0; + } + else goto FLUSH_BUFFER; + break; + + case STAT_fr_lt: + if (ch == 'L' || ch == 'l') + { + stat= STAT_fr_l; + buffer [buffer_idx++]= (char) ch; + buffer [buffer_idx]= 0; + } + else goto FLUSH_BUFFER; + break; + + case STAT_fr_l: + if (ch == 'E' || ch == 'e') + { + stat= STAT_fr_le; + buffer [buffer_idx++]= (char) ch; + buffer [buffer_idx]= 0; + } + else goto FLUSH_BUFFER; + break; + + case STAT_fr_le: + if (ch == '>') + { + stat= STAT_fr_LE; + le_idx= 0; + buffer [buffer_idx++]= (char) ch; + buffer [buffer_idx]= 0; + } + else goto FLUSH_BUFFER; + break; + + case STAT_fr_LE: /* collect characters from the LE name */ + if (ch == '<') + { +GOT_PREFIX: + cluster_ext= get_extension (le_buffer); + if (strcmp (cluster_ext, le_last) != 0) + { + if (fo != (FILE *) 0) fclose (fo); + sprintf (outname, "lexcut.%s", cluster_ext); + fo= fopen (outname, "a"); + printf ("appending to: %s\n", outname); + strcpy (le_last, cluster_ext); + } + if (fo != (FILE *) 0) + { + fprintf (fo, "%s", buffer); /* <:LX12345678><LE> */ + fprintf (fo, "%s", le_buffer); + if (ch == '<') fputc ('<', fo); + stat= STAT_start; + } + } + else + { + le_buffer [le_idx++]= (char) ch; + le_buffer [le_idx]= 0; + if (le_idx >= MAX_BUFFER) goto GOT_PREFIX; + /* Note: we collect the complete lexicon entry, not */ + /* just the first <chars> characters. */ + + } + break; + + } + } + fclose (fi); + if (fo != (FILE *) 0) fclose (fo); + + return 0; +} diff --git a/app/lex/lexcut.o b/app/lex/lexcut.o new file mode 100644 index 0000000000000000000000000000000000000000..3d12bd7c54bcd26032c3eaccccaef47468b3a4c4 Binary files /dev/null and b/app/lex/lexcut.o differ diff --git a/app/lex/lexcut01.c b/app/lex/lexcut01.c new file mode 100644 index 0000000000000000000000000000000000000000..2b23c5d968346221b5bf6720f7fb96b326b6fc4a --- /dev/null +++ b/app/lex/lexcut01.c @@ -0,0 +1,95 @@ +/* + * FILE /usr/lex/lexcut01.c + * + * find the appropriate file extension for a given key. + * + * written: 1993-07-06 + * latest update: 1993-07-06 + * + */ + +/* ------------------------------------------------------------------------ */ +static char EXTENSION[20]; + +/* ------------------------------------------------------------------------ */ +char *get_extension (char *key) +{ + int ch; + int key_1; + int ext_1; + + if (key == (char *) 0) return "_"; + ch= *key & 0x00FF; + if (ch == (char) 0 || ch < 'a' || ch > 'z') return "_"; + + EXTENSION [0]= key[0]; + EXTENSION [2]= 0; + ext_1= 0; + key_1= key[1]; + + switch (key[0]) + { + case 'a': + case 'i': + case 'u': + if (key_1 == 'n') ext_1= key_1; + break; + + case 'b': + case 'm': + if (key_1 == 'a') ext_1= key_1; + break; + + case 'r': + if (key_1 == 'e') ext_1= key_1; + break; + + case 's': + switch (key_1) + { + case 't': + case 'u': + case 'e': + ext_1= key_1; + break; + } + break; + + case 't': + if (key_1 == 'r') ext_1= key_1; + break; + + case 'p': + switch (key_1) + { + case 'r': + case 'a': + ext_1= key_1; + break; + } + break; + + case 'd': + switch (key_1) + { + case 'i': + case 'e': + ext_1= key_1; + break; + } + break; + + case 'c': + switch (key_1) + { + case 'o': + case 'a': + ext_1= key_1; + break; + } + break; + } + EXTENSION [1]= (char) ext_1; + + return EXTENSION; +} diff --git a/app/lex/lexcut01.o b/app/lex/lexcut01.o new file mode 100644 index 0000000000000000000000000000000000000000..8d91c118f793ee286f296b489e34bdb7aa2d4398 Binary files /dev/null and b/app/lex/lexcut01.o differ diff --git a/app/lex/lexdiv.c b/app/lex/lexdiv.c new file mode 100644 index 0000000000000000000000000000000000000000..e490297660f97b039a28d2f93df018f617731b52 --- /dev/null +++ b/app/lex/lexdiv.c @@ -0,0 +1,199 @@ +/* + * FILE /usr/inc/XXXX.c + * + * + * 1992 02 19 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <io.h> +#include <conio.h> +#include <gg/filename.h> + +# define STDHLP stderr +#ifdef MSDOS +# define ARG_C_max 24 +#else +# define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c = 0; + +/* Quick Hack: ------------------------------------------------------------ */ +#ifdef MSDOS +# define SUBDIRS /* Rekusive Suche durch das */ + /* Filesystem m�glich */ +# define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ +#else +#define wcrd_wildcards main_fnc +#endif + +/* ------------------------------------------------------------------------ */ +static char filenm [66]; +static int verbose_mode = 0; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: XXXX [options] {file name}\n", + "OPTIONS:\n", + " -f<filename> ... List of Files\n", +# ifdef SUBDIRS + " -s -r ... Subdirs\n", +# endif + " -v ... Verbose Mode\n", + "EXAMPLES: \n", + "\n", + "(@)AXXXX.c 0.0 #D$1991-02-19 23:40:00\n", + "\n", +# include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn); + +/* ------------------------------------------------------------------------ */ +main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + + if (argc <= 1) goto HLP; + + for (i = 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + +# ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': +#endif + case 'v': case 'V': + for (j=1; argv [i][j]; j++) + switch (argv [i][j]) + { +# ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': + wcrd_set_subdirs (1); + break; +#endif + case 'v': case 'V': + verbose_mode = 1; + break; + } + break; + +HLP: +# include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + if (arg_c) + { + for (i = 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if (access (& arg_v [i][2], 0) != 0) + { + fprintf (stderr, "File %s not found!\n", &arg_v [i][2]); + break; + } + fi2 = fopen (& arg_v [i][2], "rt"); + for (;;) + { + fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; +# ifdef SUBDIRS + if (wcrd_wildcards_or_rec (filenm) == -1) + { + fclose (fi2); + goto STOP; + } +#else + wcrd_wildcards (filenm); +#endif + } + fclose (fi2); + } + else + { +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (arg_v [i]) == -1) goto STOP; +#else + wcrd_wildcards (arg_v [i]); +#endif + } + } + else + { +#ifdef SUBDIRS + wcrd_wildcards_or_rec ("*.*"); +#else + main_fnc ("Default.fil"); +#endif + } + +STOP: + return 0; +} + +/* ------------------------------------------------------------------------ */ +#define LB_SIZE 1024 +static char line1 [LB_SIZE]; +static char out_name [66]; +static int out_count=1; + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn) +{ + FILE *fi; + FILE *fo=(FILE *) 0; + long linecnt; + + if (access (fn, 0) != 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -2; + } + + printf ("reading from %s\n", fn); + fi = fopen (fn, "rb"); + for (linecnt=0L;; linecnt++) + { + if (fgets (line1, LB_SIZE, fi) == (char *) 0 + || feof (fi)) break; + if (fo == (FILE *) 0) + { + sprintf (out_name, "splt%04d.div", out_count++); + printf ("writing to %s\n", out_name); + fo = fopen (out_name, "wb"); + } + if (fo == (FILE *) 0) + { + fprintf (stderr, "error creating an output file\n"); + break; + } + fputs (line1, fo); + if ((linecnt % 1000L) == 999L) + { + if (fo != (FILE *) 0) fclose (fo); + fo = (FILE *) 0; + } + } + fclose (fi); + if (fo != (FILE *) 0) fclose (fo); + + return 0; +} diff --git a/app/lex/lexm.c b/app/lex/lexm.c new file mode 100644 index 0000000000000000000000000000000000000000..80e48f8546407f57a61e64ca8b9b94b86c4159ad --- /dev/null +++ b/app/lex/lexm.c @@ -0,0 +1,155 @@ +/* + * FILE /usr/lex/lexm.c + * + * + * 1992 02 19 + * + */ + +# include <stdlib.h> +# include <stdio.h> +# include <io.h> +# include <conio.h> +# include <gg/filename.h> + +# define STDHLP stderr +#ifdef MSDOS +# define ARG_C_max 24 +#else +# define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c = 0; + +/* Quick Hack: ------------------------------------------------------------ */ +#ifdef MSDOS +# define SUBDIRS /* Rekusive Suche durch das */ + /* Filesystem m�glich */ +# define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ +#else +#define wcrd_wildcards main_fnc +#endif + +/* ------------------------------------------------------------------------ */ +static int verbose_mode = 0; +FILE *logfile; +static char filenm [66]; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: lexm [options] {file name}\n", + " merge files containing lexicon entries\n", + "OPTIONS:\n", + " -f<filename> ... List of Files\n", +# ifdef SUBDIRS + " -s -r ... Subdirs\n", +# endif + " -v ... Verbose Mode\n", + "EXAMPLES: \n", + "\n", + "(@)Alexm.c 0.0 #D$1989-02-14 15:45:00\n", + "\n", +# include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +long cdecl lexm_dump (char *fno); + +/* ------------------------------------------------------------------------ */ +main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + + if (argc <= 1) goto HLP; + logfile = fopen ("lexm.log", "at"); + + for (i = 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + +# ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': +#endif + case 'v': case 'V': + for (j=1; argv [i][j]; j++) + switch (argv [i][j]) + { +# ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': + wcrd_set_subdirs (1); + break; +#endif + case 'v': case 'V': + verbose_mode = 1; + break; + } + break; + +HLP: +# include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + if (arg_c) + { + for (i = 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if (access (& arg_v [i][2], 0) != 0) + { + fprintf (stderr, "File %s not found!\n", &arg_v [i][2]); + break; + } + fi2 = fopen (& arg_v [i][2], "rt"); + for (;;) + { + fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; +# ifdef SUBDIRS + if (wcrd_wildcards_or_rec (filenm) == -1) + { + fclose (fi2); + goto STOP; + } +#else + wcrd_wildcards (filenm); +#endif + } + fclose (fi2); + } + else + { +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (arg_v [i]) == -1) goto STOP; +#else + wcrd_wildcards (arg_v [i]); +#endif + } + } + else + { +#ifdef SUBDIRS + wcrd_wildcards_or_rec ("*.*"); +#else + main_fnc ("Default.fil"); +#endif + } + + lexm_dump ("$$.lut"); + +STOP: + return 0; +} diff --git a/app/lex/lexm2.c b/app/lex/lexm2.c new file mode 100644 index 0000000000000000000000000000000000000000..d5f868fe579c7e7707ea0410ba967bbb0ad37112 --- /dev/null +++ b/app/lex/lexm2.c @@ -0,0 +1,153 @@ +/* + * FILE /usr/lex/lexm.c + * + * + * 1992 02 19 + * + */ + +#include <stdio.h> +#include <io.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/ytree.h> + +#ifndef NIL +#define NIL (void *) 0 +#endif + +extern FILE *logfile; + +/* ------------------------------------------------------------------------ */ +int cdecl main_fnc (char *fn); +long cdecl lexm_dump (char *fno); + +/* ------------------------------------------------------------------------ */ +static int file_count=0; +static long file_flag [] = +{ + 0x00000000L, 0x00000001L, 0x00000002L, 0x00000004L, 0x00000008L +} ; + +static struct YTREE *ytree=NIL; + +#define LB_SIZE 1024 +static char line_buffer[LB_SIZE]; +static char line_buffer2[LB_SIZE]; + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn) +{ + FILE *fi; + int bs; + struct YTREE *yt; + int fl; + int xfl; + + fprintf (logfile, "lexm: %s\n", fn); + if (access (fn, 0) != 0) + { + fprintf (logfile, "** File %s not found!\n", fn); + return -2; + } + + file_count++; + if (file_count > 3) + { + fprintf (logfile, "** can't process more that 3 files!\n"); + return -2; + } + + fi = fopen (fn, "rb"); + if (fi == (FILE *) 0) + { + fprintf (logfile, "** can't open file %s for reading!\n", fn); + return -2; + } + for (;;) + { + if (fgets (line_buffer, LB_SIZE, fi) == (char *) 0) break; + if (feof (fi)) break; + for (bs= strlen (line_buffer)-1; bs >= 0; bs--) + { + switch (line_buffer [bs] & 0x00FF) + { + case 0x0D: + case 0x0A: + case 0x09: + case 0x20: + line_buffer[bs]= 0; + break; + default: + bs=0; + break; + } + } + + switch (file_count) + { + case 1: + case 2: + yt= ytree_insert_word (&ytree, line_buffer); + if (yt == NIL) + { + fprintf (logfile, "*** creating ytree: can't insert %s\n", line_buffer); + goto STOP; + } + yt->YT_info |= file_flag [file_count]; + yt->YT_flags |= YTflag_EOW; + break; + + case 3: + yyconvent (line_buffer, line_buffer2); + xfl = (strcmp (line_buffer, line_buffer2)==0); + yt= ytree_insert_word (&ytree, line_buffer2); + if (yt == NIL) + { + fprintf (logfile, "*** creating ytree: can't insert %s\n", line_buffer2); + goto STOP; + } + + fl = (yt->YT_info != 0); + yt->YT_flags |= YTflag_EOW; + if (xfl) + { + yt->YT_info |= 0x00000004L; + break; + } + yt->YT_info |= 0x00000008L; + + yt= ytree_insert_word (&ytree, line_buffer); + if (yt == NIL) + { + fprintf (logfile, "*** creating ytree: can't insert %s\n", line_buffer); + goto STOP; + } + yt->YT_info |= 0x00000010L; + if (fl) yt->YT_info |= 0x00000020L; + yt->YT_flags |= YTflag_EOW; + break; + } + } + +STOP: + fclose (fi); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +long lexm_dump (char *fno) +{ + FILE *fo; + long unique; + + fo = fopen (fno, "wb"); + if (fo == (FILE *) 0) return -1L; + + ytree_size (ytree); + unique = ytree_dump (fo, ytree); + fclose (fo); + + return unique; +} diff --git a/app/lex/lext.c b/app/lex/lext.c new file mode 100644 index 0000000000000000000000000000000000000000..34eed631b5703728dd26c4dcc668a41306d53e69 --- /dev/null +++ b/app/lex/lext.c @@ -0,0 +1,243 @@ +/* + * FILE /usr/lex/lext.c + * + * + * 1992 02 19 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <io.h> +#include <conio.h> +#include <string.h> +#include <gg/filename.h> + +#define STDHLP stderr +#ifdef MSDOS +#define ARG_C_max 24 +#else +#define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c = 0; + +/* Quick Hack: ------------------------------------------------------------ */ +#ifdef MSDOS +# define SUBDIRS /* Rekusive Suche durch das */ + /* Filesystem m�glich */ +# define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ +#else +#define wcrd_wildcards main_fnc +#endif + +/* ------------------------------------------------------------------------ */ +static int verbose_mode = 0; +static char filenm [66]; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: lext [options] {file name}\n", + " split file according to first char of lexicon entry\n", + "OPTIONS:\n", + " -f<filename> ... List of Files\n", +# ifdef SUBDIRS + " -s -r ... Subdirs\n", +# endif + " -v ... Verbose Mode\n", + "EXAMPLES: \n", + "\n", + "(@)Alext.c 1.0 #D$1992-02-23 11:00:00\n", + "\n", +# include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn); +int cdecl xxconvent (char *lps, char *lpd); + +/* ------------------------------------------------------------------------ */ +main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + + if (argc <= 1) goto HLP; + + for (i = 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + +# ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': +#endif + case 'v': case 'V': + for (j=1; argv [i][j]; j++) + switch (argv [i][j]) + { +# ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': + wcrd_set_subdirs (1); + break; +#endif + case 'v': case 'V': + verbose_mode = 1; + break; + } + break; + +HLP: +# include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + if (arg_c) + { + for (i = 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if (access (& arg_v [i][2], 0) != 0) + { + fprintf (stderr, "File %s not found!\n", &arg_v [i][2]); + break; + } + fi2 = fopen (& arg_v [i][2], "rt"); + for (;;) + { + fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; +# ifdef SUBDIRS + if (wcrd_wildcards_or_rec (filenm) == -1) + { + fclose (fi2); + goto STOP; + } +#else + wcrd_wildcards (filenm); +#endif + } + fclose (fi2); + } + else + { +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (arg_v [i]) == -1) goto STOP; +#else + wcrd_wildcards (arg_v [i]); +#endif + } + } + else + { +#ifdef SUBDIRS + wcrd_wildcards_or_rec ("*.*"); +#else + main_fnc ("Default.fil"); +#endif + } + +STOP: + return 0; +} + +/* ------------------------------------------------------------------------ */ +#define LB_SIZE 1024 +static char line_buffer1 [LB_SIZE]; +static char line_buffer2 [LB_SIZE]; + +static char fo_seg_p[]="??????????"; + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn) +{ + FILE *fi; + FILE *fo=(FILE *) 0; + FILE *foe=(FILE *) 0; + int ch1; + char fo_name [66]; + char *cp; + char *fo_seg; + long lc=0; + + if (access (fn, 0) != 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -2; + } + + fi = fopen (fn, "r"); + for (;;) + { + cp=fgets (line_buffer1, LB_SIZE, fi); + if (feof (fi)) break; + if (cp == (char *) 0) break; + lc++; + + if (xxconvent (line_buffer1, line_buffer2) <= 0) + { + if (foe == (FILE *) 0) + { + foe = fopen ("error", "a"); + fprintf (stderr, "openening error!\n"); + } + fprintf (foe, "%s(%ld) ", fn, lc); + fputs (line_buffer1, foe); + continue; + } + + /* check out output segment */ + ch1 = line_buffer2[0]; + fo_seg="sy"; + if (ch1 >= 'a' && ch1 <= 'z') + { + fo_seg = "la"; + fo_seg[1]=(char) ch1; + } + if (ch1 >= 'A' && ch1 <= 'Z') + { + fo_seg = "ua"; + fo_seg[1]=(char) ch1-'A'+'a'; + } + if (ch1 >= '0' && ch1 <= '9') fo_seg = "nu"; + if (ch1 == '&') fo_seg = "en"; + + if (strcmp (fo_seg, fo_seg_p) != 0) + { + if (fo != (FILE *) 0) fclose (fo); + strcpy (fo_name, &fn[2]); /* ############################ */ + fo_name [4]=0; + sprintf (&fo_name[strlen(fo_name)], "wg%s", fo_seg); + fprintf (stderr, "opening file %s for output\n", fo_name); + fo = fopen (fo_name, "a"); + if (fo == (FILE *) 0) + { + fprintf (stderr, "can't open file %s for output!\n", fo_name); + goto STOP; + } + } + strcpy (fo_seg_p, fo_seg); + + fputs (line_buffer2, fo); + fputc ('\n', fo); + if ((lc % 1000) == 0) fprintf (stderr, "record %8ld\n", lc); + } + +STOP: + if (fo != (FILE *) 0) fclose (fo); + if (foe != (FILE *) 0) fclose (foe); + fclose (fi); + + return 0; +} diff --git a/app/lex/lext1.c b/app/lex/lext1.c new file mode 100644 index 0000000000000000000000000000000000000000..3febd1fd200b1c6ad9b89d53859356566413e7f8 --- /dev/null +++ b/app/lex/lext1.c @@ -0,0 +1,273 @@ +/* + * FILE /usr/lex/lext1.c + * + * + * 1992 02 19 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <io.h> +#include <conio.h> +#include <string.h> +#include <gg/filename.h> +#include <gg/ytree.h> +#include <gg/dpp.h> + +# define STDHLP stderr +#ifdef MSDOS +# define ARG_C_max 24 +#else +# define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c = 0; + +/* Quick Hack: ------------------------------------------------------------ */ +#ifdef MSDOS +/* # define SUBDIRS */ /* Rekusive Suche durch das */ + /* Filesystem m�glich */ +# define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ +#else +#define wcrd_wildcards main_fnc +#endif + +/* ------------------------------------------------------------------------ */ +static char filenm [66]; +static int verbose_mode = 0; +static int max_lng=3; +static int syl_lng=3; +static int syl_mode=0; +static int rev_mode=0; +static long syl_split=300L; +static struct YTREE *ytree=(struct YTREE *) 0; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: lext1 [options] {file name}\n", + " generate word prefix (or suffix) list from lexicon entries\n", + "OPTIONS:\n", + " -f<filename> ... List of Files\n", + " -n<n> ... number of chars [DEF: 3]\n", + " -m<mode> ... mode [DEF: 0] 1=dynamic split up to <n>\n", + " -s<size> ... split_size [DEF: 300]\n", + " -r ... reverse input string\n", + " -v ... Verbose Mode\n", + "EXAMPLES: \n", + "\n", + "(@)Alext1.c 0.0 #D$1992-02-19 23:40:00\n", + "\n", +# include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn); +int cdecl xmain_fnc (char *fn); +long cdecl t1_dump (char *fno); + +/* ------------------------------------------------------------------------ */ +main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + + if (argc <= 1) goto HLP; + + for (i = 1; i < argc; i++) + if (argv [i][0] == '-' || argv [i][0] == '/') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + case 'n': case 'N': + sscanf (&argv[i][2], "%d", &max_lng); + syl_lng = max_lng; + break; + case 'm': case 'M': + sscanf (&argv[i][2], "%d", &syl_mode); + break; + case 's': case 'S': + syl_split = get_parameter_value (&argv[i][2]); + break; + + case 'r': case 'R': + case 'v': case 'V': + for (j=1; argv [i][j]; j++) + switch (argv [i][j]) + { + case 'r': case 'R': + rev_mode= 1; + break; + case 'v': case 'V': + verbose_mode= 1; + break; + } + break; + +HLP: +# include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + if (arg_c) + { + for (i = 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if (access (& arg_v [i][2], 0) != 0) + { + fprintf (stderr, "File %s not found!\n", &arg_v [i][2]); + break; + } + fi2 = fopen (& arg_v [i][2], "rt"); + for (;;) + { + fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; +# ifdef SUBDIRS + if (wcrd_wildcards_or_rec (filenm) == -1) + { + fclose (fi2); + goto STOP; + } +#else + wcrd_wildcards (filenm); +#endif + } + fclose (fi2); + } + else + { +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (arg_v [i]) == -1) goto STOP; +#else + wcrd_wildcards (arg_v [i]); +#endif + } + } + else + { +#ifdef SUBDIRS + wcrd_wildcards_or_rec ("*.*"); +#else + main_fnc ("Default.fil"); +#endif + } + + t1_dump ("$t1_dmp$.lut"); + +#ifdef SUBDIRS +STOP: +#endif + return 0; +} + +/* ------------------------------------------------------------------------ */ +#define LB_SIZE 1024 +static char line1 [LB_SIZE]; + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn) +{ + int rc; + + switch (syl_mode) + { + case 0: + syl_lng = max_lng; + return xmain_fnc (fn); + case 1: + for (syl_lng = 1; syl_lng <= max_lng; syl_lng++) + { + rc= xmain_fnc (fn); + if (rc < 0) return rc; + if (rc == 1) return 0; + } + printf ("further splitting would be possible\n"); + return 0; + } +} + +/* ------------------------------------------------------------------------ */ +int xmain_fnc (char *fn) +{ + FILE *fi; + struct YTREE *yt; + int i; + int ch; + char *line2; + int rv=1; + + if (access (fn, 0) != 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -2; + } + + printf ("reading from file %s; syl=%d max_syl=%d\n", fn, syl_lng, max_lng); + fi = fopen (fn, "r"); + for (;;) + { + if (fgets (line1, LB_SIZE, fi) == (char *) 0) break; + if (feof (fi)) break; + line2=&line1[12]; + for (i=strlen(line2)-1; i>=0; i--) + { + ch = line2[i] & 0x00FF; + if (ch == 0x0D) line2[i]=0; else + if (ch == 0x0A) line2[i]=0; else break; + } + if (rev_mode) strrev (line2); + + line2[syl_lng]=0; + if (syl_mode == 1 && strlen (line2) > 1) + { + if (strlen (line2) < syl_lng) continue; + ch= line2[syl_lng-1] & 0x00FF; + line2[syl_lng-1]= 0; + yt= ytree_lookup_word (ytree, line2); + if (yt == (struct YTREE *) 0 + || yt->YT_info <= syl_split) continue; + line2[syl_lng-1]= (char) ch; + } + + yt= ytree_insert_word (&ytree, line2); + if (yt == NIL) + { + printf ("*** creating ytree: can't insert %s\n", line2); + break; + } + yt->YT_flags |= YTflag_EOW; + yt->YT_info++; + if (yt->YT_info > syl_split) rv=0; + } + fclose (fi); + + return rv; +} + +/* ------------------------------------------------------------------------ */ +long t1_dump (char *fno) +{ + FILE *fo; + long unique; + + fo = fopen (fno, "wb"); + if (fo == (FILE *) 0) return -1L; + + printf ("dumping to file %s ...", fno); + ytree_size (ytree); + unique = ytree_dump (fo, ytree); + printf (" %ld unique\n", unique); + fclose (fo); + + return unique; +} diff --git a/app/lex/make-dos b/app/lex/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..53139df4f6067a72423c9a6d9b8113d65639366b --- /dev/null +++ b/app/lex/make-dos @@ -0,0 +1,75 @@ +# +# FILE /usr/lex/makefile +# +# written: 1991-xx-xx +# latest update: 1993-07-06 +# +# ======================================================================== +cml=cl -AL /W3 /c +cms=cl -AS /W3 /c +ccl=cl -AL /W3 +ccs=cl -AS /W3 +obj=objdec -w -d -m0 -sl 2 LEXTOOL_TEXT +bin=c:\bin\ +lib=c:\usr\sbr\lsbr + +all.exe : $(bin)lext.exe $(bin)lexm.exe $(bin)lext1.exe $(bin)lexdiv.exe ! + $(bin)lexcut.exe + +# --- +lex.sh : + del lex.sh + shar -a lex.sh -fmakeshar.lst + +# --- +$(bin)lext.exe : lext.obj xxconven.obj + link lext xxconven,$(bin)lext.exe,\dev\nul,$(lib); + +lext.obj : lext.c + $(cml) lext.c + $(obj) lext.obj + +xxconven.obj : xxconven.c + $(cml) xxconven.c + $(obj) xxconven.obj + +yyconven.obj : yyconven.c + $(cml) yyconven.c + $(obj) yyconven.obj + +$(bin)lexm.exe : lexm.obj lexm2.obj yyconven.obj + link lexm lexm2 yyconven,$(bin)lexm.exe,\dev\nul,$(lib); + +lexm.obj : lexm.c + $(cml) lexm.c + $(obj) lexm.obj + +lexm2.obj : lexm2.c + $(cml) lexm2.c + $(obj) lexm2.obj + +$(bin)lext1.exe : lext1.obj + link lext1,$(bin)lext1.exe,\dev\nul,$(lib); + +lext1.obj : lext1.c + $(cml) lext1.c + $(obj) lext1.obj + +$(bin)lexdiv.exe : lexdiv.obj + link lexdiv,$(bin)lexdiv.exe,\dev\nul,$(lib); + +lexdiv.obj : lexdiv.c + $(cml) lexdiv.c + $(obj) lexdiv.obj + +$(bin)lexcut.exe : lexcut.obj lexcut01.obj + link lexcut lexcut01,$(bin)lexcut.exe,\dev\nul,$(lib); + +lexcut.obj : lexcut.c + $(cml) lexcut.c + $(obj) lexcut.obj + +lexcut01.obj : lexcut01.c + $(cml) lexcut01.c + $(obj) lexcut01.obj + diff --git a/app/lex/makeshar.lst b/app/lex/makeshar.lst new file mode 100644 index 0000000000000000000000000000000000000000..3422ecd1c66340734e561dff819ff2be208f9d6c --- /dev/null +++ b/app/lex/makeshar.lst @@ -0,0 +1,12 @@ +# +# FILE usr/lex/makeshar.lst +# +# copy all necessary files into a shar file. +# +# written: 1993-07-05 +# latest update: 1993-07-06 +# +# --------------------------------------------------------------------------- +a makefile.ux Makefile +a lexcut.c lexcut.c +a lexcut01.c lexcut01.c diff --git a/app/lex/xxconven.c b/app/lex/xxconven.c new file mode 100644 index 0000000000000000000000000000000000000000..ef3c7f99c477796a728a5e943dd501487b22f091 --- /dev/null +++ b/app/lex/xxconven.c @@ -0,0 +1,54 @@ +/* + * FILE /usr/lex/xxconven.c + * + * 1992 02 19 + * + */ + +#include <string.h> + +/* ------------------------------------------------------------------------ */ +int xxconvent (char *lps, char *lpd) +{ + int id=0; + int is=0; + + for (is=0; lps[is]; is++) + { + if ((lps[is] & 0x00FF) == 0x0D) continue; + if ((lps[is] & 0x00FF) == 0x0A) continue; + if ((lps[is] & 0x00FF) == 0x09) lps[is] = (char) 0x20; + if ((lps[is] & 0x00FF) >= 0x7F) return -1; + if ((lps[is] & 0x00FF) < 0x20) return -1; + if (is==0) goto DEF; + + switch (lps[is]) + { + case '\"': + switch (lps [is-1]) + { + case 'a': strcpy (&lpd[id-1], "ä"); break; + case 'o': strcpy (&lpd[id-1], "ö"); break; + case 'u': strcpy (&lpd[id-1], "ü"); break; + case 'A': strcpy (&lpd[id-1], "Ä"); break; + case 'O': strcpy (&lpd[id-1], "Ö"); break; + case 'U': strcpy (&lpd[id-1], "Ü"); break; + default: return -1; + } + id = strlen (lpd); + break; + case 'S': + if (lps [is-1] != 's') goto DEF; + strcpy (&lpd[id-1], "ß"); + id = strlen (lpd); + break; + default: +DEF: + lpd[id++] = lps[is]; + lpd[id]=0; + break; + } + } + + return id; +} diff --git a/app/lex/yyconven.c b/app/lex/yyconven.c new file mode 100644 index 0000000000000000000000000000000000000000..42505d5bbd44bdfde6227ad9e599411abdccbb53 --- /dev/null +++ b/app/lex/yyconven.c @@ -0,0 +1,61 @@ +/* + * FILE /usr/lex/xxconven.c + * + * 1992 02 19 + * + */ + +#include <string.h> + +/* ------------------------------------------------------------------------ */ +int yyconvent (char *lps, char *lpd) +{ + int id=0; + int is=0; + + for (is=0; lps[is]; is++) + { + if ((lps[is] & 0x00FF) == 0x0D) continue; + if ((lps[is] & 0x00FF) == 0x0A) continue; + if ((lps[is] & 0x00FF) == 0x09) lps[is] = (char) 0x20; + if ((lps[is] & 0x00FF) >= 0x7F) return -1; + if ((lps[is] & 0x00FF) < 0x20) return -1; + if (is==0) goto DEF; + + switch (lps[is]) + { + case 'e': + switch (lps [is-1]) + { + case 'a': strcpy (&lpd[id-1], "ä"); break; + case 'o': strcpy (&lpd[id-1], "ö"); break; + case 'u': strcpy (&lpd[id-1], "ü"); break; + default: goto DEF; + } + id = strlen (lpd); + break; + case 'E': + switch (lps [is-1]) + { + case 'A': strcpy (&lpd[id-1], "Ä"); break; + case 'O': strcpy (&lpd[id-1], "Ö"); break; + case 'U': strcpy (&lpd[id-1], "Ü"); break; + default: goto DEF; + } + id = strlen (lpd); + break; + case 's': + if (lps [is-1] != 's') goto DEF; + strcpy (&lpd[id-1], "ß"); + id = strlen (lpd); + break; + default: +DEF: + lpd[id++] = lps[is]; + lpd[id]=0; + break; + } + } + + return id; +} diff --git a/app/lexicon/(dirinf).fm b/app/lexicon/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..b755f366df36b320968e229e9797c3e49278a4d0 --- /dev/null +++ b/app/lexicon/(dirinf).fm @@ -0,0 +1,104 @@ +# +# FILE %lexicon/(dirinf).fm +# +# written: 1991 03 26 +# latest update: 2000-08-26 15:16:36 +# $Id: (dirinf).fm,v 1.4 2000/08/26 13:21:14 gonter Exp $ +# + +(dirinf).fm Contents +Makefile Unix version of Makefile +make-dos MSDOS version of Makefile + +NOTES various notes + +# debugging stuff: +possig.awk search for patterns + +# headers and documentation ---- +lexicon.mod control file for library +lexfile.doc Beschreibung der Datenstrukturen des Lexicons +lexdoc.zip auxiliary information +lexint.doc internal information +# +makefile MSDOS makefile +make-ux UNIX makefile +makeshar.lst list of files transported to unix +http4lex.pl format frames from a lexicon as a filter stage of a HTTP4HYX server +# +# production programs ---------- +dictadd.c add entries to dictionary; main module +dictmod.c modify dictionary +# +# test programs ---------------- +lex.c Lexicon Test +lex.c (nicht verwendet) +pt.c parse test +# +# library modules -------------- +# +parse001.c struct LEX_PARSER_STATUS *LEX_reset_segment_parser () +parse002.c struct TEXT_ELEMENT *LEX_segment_parse_char (...) +parse003.c Tag Definition anfordern +parse004.c free text list etc. +parse005.c free text segment list +parse006.c copy text segments +parse007.c print text element list +parse008.c print text segment list +parse009.c strip text segment list +parse010.c text list in markup struktur umbauen +parse011.c allocate text semgent +parse012.c allocate text node +parse013.c allocate text node together with text segment +parse014.c key string transformation +parse015.c make markup +parse016.c display markup structure +parse017.c display tag definition +parse018.c append_text_element (...) +parse019.c int parse_tag_sequence (...) +parse020.c long text_segment_count_char (...) +parse021.c void dump_text_element_list (FILE *fo, ...); +parse022.c int dump_text_segment_list (FILE *fo, ...); +parse023.c struct TEXT_ELEMENT **find_last_text_element_ptr (...); + +parse024.c int read_tag_definition (char *fn) +parse025.c int process_tag_definition (char *line) +parse026.c struct TAG_DEFINITION *identify_tag (char *str, ...) +parse027.c struct TAG_DEFINITION *new_tag_definition (...) +parse028.c struct TAG_DEFINITION *find_tag_definition (...) +# +dictadd1.c add entries to dictionary +dictadd2.c restructure lexicon entry +dictadd3.c int dict_update_entry (...) +dictadd4.c write lexicon entry to files +dictadd5.c lexicon file cache +dictadd6.c write lexicon text +dictadd8.c purge entry list +dictadd9.c combine two entries +# +dict0001.c char *get_divided_lexicon (char *base_name, ...) +dict0002.c int dict_check_integrity (void); +dict0003.c int write_lexicon_frame (FILE *fhyx, ...) +dict0004.c int dict_add_init (struct HYX_CLUSTER_CONTROL *hcc) +dict0005.c int dict_add_finish (struct HYX_CLUSTER_CONTROL *hcc) +dict0006.c void memory_statistics (FILE *fo, long record_counter) +dict0007.c int ytree_index_to_entry_descriptor (yt_node, ...) +dict0008.c int ytree_entry_descriptor_to_index (yt_node, ...) +dict0009.c int dict_queue (struct LEXICON_CONTROL *lcc, ...) +dict0010.c int dict_flush_queue (struct HYX_CLUSTER_CONTROL *hcc, ...); +dict0011.c int dict_write_xfn_entry (struct YTREE *yt_node, void *client_data) +dict0012.c int dict_read_setup_file (...) +dict0013.c char *dict_get_frame_name (struct HYX_CLUSTER_CONTROL *hcc, ...) +dict0014.c int dict_restructure2_entry (struct LEXICON_CONTROL *lcc, ...) +dict0015.c int dict_process_entry (struct HYX_CLUSTER_CONTROL *hcc, ...) +dict0016.c int hyx_unroll_text (struct DYNAMIC_BLOCK *dyb, ...) +dict0017.c /* unroll tag defintion */ +dict0018.c int hyx_unroll_text_segment_list (struct DYNAMIC_BLOCK *dyb, ...) +# +dict0031.c read lexicon entry from named files +dict0032.c read lexicon entry from opened files +dict0033.c read lexicon text +# +lex00001.c Lexicon Verwaltung *** NICHT VERWENDET *** +# +lexut001.c int ISPELL_derive (char *orig, int flag, char *deriv) diff --git a/app/lexicon/.cvsignore b/app/lexicon/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..73f2b144d07e4f0c40cb412c782a3063fb8aa1e7 --- /dev/null +++ b/app/lexicon/.cvsignore @@ -0,0 +1,12 @@ +dictadd +dictmod +pt +tst1 +atag +tmp +*.idx +*.hyx +*.lut +*.words +@* +.kredenz.tfb diff --git a/app/lexicon/@@@.lut b/app/lexicon/@@@.lut new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/lexicon/@@@chk.lst b/app/lexicon/@@@chk.lst new file mode 100644 index 0000000000000000000000000000000000000000..e61b21c30ac9ab8e6c23d43478ad863095069dda --- /dev/null +++ b/app/lexicon/@@@chk.lst @@ -0,0 +1,183 @@ +./(dirinf).fm +./.cvsignore +./@@@.lut +./CVS/Entries +./CVS/Repository +./CVS/Root +./CVS/Root.bak +./Makefile +./NOTES +./_bak_ftr.ned/(dirinf).ftr +./_bak_ftr.ned/CVS/Entries +./_bak_ftr.ned/CVS/Repository +./_bak_ftr.ned/CVS/Root +./_bak_ftr.ned/CVS/Root.bak +./_bak_ftr.ned/Makefile.ftr +./_bak_ftr.ned/NOTES.ftr +./_bak_ftr.ned/dab1.ftr +./_bak_ftr.ned/dict0001.ftr +./_bak_ftr.ned/dict0002.ftr +./_bak_ftr.ned/dict0003.ftr +./_bak_ftr.ned/dict0004.ftr +./_bak_ftr.ned/dict0005.ftr +./_bak_ftr.ned/dict0006.ftr +./_bak_ftr.ned/dict0007.ftr +./_bak_ftr.ned/dict0008.ftr +./_bak_ftr.ned/dict0009.ftr +./_bak_ftr.ned/dict0010.ftr +./_bak_ftr.ned/dict0011.ftr +./_bak_ftr.ned/dict0012.ftr +./_bak_ftr.ned/dict0013.ftr +./_bak_ftr.ned/dict0014.ftr +./_bak_ftr.ned/dict0015.ftr +./_bak_ftr.ned/dict0016.ftr +./_bak_ftr.ned/dict0018.ftr +./_bak_ftr.ned/dict0031.ftr +./_bak_ftr.ned/dict0032.ftr +./_bak_ftr.ned/dict0033.ftr +./_bak_ftr.ned/dictadd.ftr +./_bak_ftr.ned/dictadd1.ftr +./_bak_ftr.ned/dictadd2.ftr +./_bak_ftr.ned/dictadd3.ftr +./_bak_ftr.ned/dictadd4.ftr +./_bak_ftr.ned/dictadd6.ftr +./_bak_ftr.ned/dictadd8.ftr +./_bak_ftr.ned/dictadd9.ftr +./_bak_ftr.ned/dictmod.ftr +./_bak_ftr.ned/edited.ftr +./_bak_ftr.ned/grtag.ftr +./_bak_ftr.ned/http4lex.ftr +./_bak_ftr.ned/lex.ftr +./_bak_ftr.ned/lex00001.ftr +./_bak_ftr.ned/lexfile.ftr +./_bak_ftr.ned/lexicon.ftr +./_bak_ftr.ned/lexpr001.ftr +./_bak_ftr.ned/lexproc.ftr +./_bak_ftr.ned/lexut001.ftr +./_bak_ftr.ned/make-dos.ftr +./_bak_ftr.ned/makeshar.ftr +./_bak_ftr.ned/ned.ftr +./_bak_ftr.ned/parse001.ftr +./_bak_ftr.ned/parse002.ftr +./_bak_ftr.ned/parse007.ftr +./_bak_ftr.ned/parse008.ftr +./_bak_ftr.ned/parse014.ftr +./_bak_ftr.ned/parse015.ftr +./_bak_ftr.ned/parse016.ftr +./_bak_ftr.ned/parse017.ftr +./_bak_ftr.ned/parse019.ftr +./_bak_ftr.ned/parse021.ftr +./_bak_ftr.ned/parse022.ftr +./_bak_ftr.ned/possig.ftr +./_bak_ftr.ned/pt.ftr +./_bak_ftr.ned/test1.ftr +./_bak_ftr.ned/test2.ftr +./_bak_ftr.ned/tst1.ftr +./_bak_ftr.ned/tst2.ftr +./_bak_ftr.ned/xx.ftr +./alexicon.hyx +./alexicon.idx +./alexicon.lut +./dict0001.c +./dict0001.o +./dict0002.c +./dict0002.o +./dict0003.c +./dict0003.o +./dict0004.c +./dict0004.o +./dict0005.c +./dict0005.o +./dict0006.c +./dict0006.o +./dict0007.c +./dict0007.o +./dict0008.c +./dict0008.o +./dict0009.c +./dict0009.o +./dict0010.c +./dict0010.o +./dict0011.c +./dict0011.o +./dict0012.c +./dict0012.o +./dict0013.c +./dict0013.o +./dict0014.c +./dict0014.o +./dict0015.c +./dict0015.o +./dict0016.c +./dict0016.o +./dict0018.c +./dict0018.o +./dictadd +./dictadd.c +./dictadd.o +./dictadd1.c +./dictadd1.o +./dictadd2.c +./dictadd2.o +./dictadd3.c +./dictadd3.o +./dictadd4.c +./dictadd4.o +./dictadd6.c +./dictadd6.o +./dictadd8.c +./dictadd8.o +./dictadd9.c +./dictadd9.o +./dictmod +./dictmod.c +./dictmod.o +./grtag.pl +./http4lex.pl +./lex.c +./lex00001.c +./lexpr001.c +./lexpr001.o +./lexproc.h +./lexut001.c +./lexut001.o +./lib +./make-dos +./makeshar.lst +./parsd008.o +./parsd016.o +./parse007.c +./parse007.o +./parse008.c +./parse008.o +./parse014.c +./parse014.o +./parse015.c +./parse016.c +./parse016.o +./parse017.c +./parse017.o +./parse019.c +./parse019.o +./parse021.c +./parse021.o +./parse022.c +./parse022.o +./possig.awk +./pt +./pt.c +./pt.o +./test3a +./test3b +./testdata/CVS/Entries +./testdata/CVS/Repository +./testdata/CVS/Root +./testdata/CVS/Root.bak +./testdata/test1.l +./testdata/test2.l +./testdata/x1.l +./testdata/x2a.l +./testdata/x2b.l +./tst1 +./tst1.c +./tst2.c diff --git a/app/lexicon/@@@md5.tmp b/app/lexicon/@@@md5.tmp new file mode 100644 index 0000000000000000000000000000000000000000..0c6412775c11a28f3d857e7f88f95421fb0700d2 --- /dev/null +++ b/app/lexicon/@@@md5.tmp @@ -0,0 +1,183 @@ +c5a56cb08c9b68d5d95be67f2820e670 file 4242 ./(dirinf).fm +e1a3139468fb49161ce389b75e54d71f file 75 ./.cvsignore +c36572de7beac94fd2f9418bd3b1dd78 file 32 ./@@@.lut +2759baf11c89e121587834b092c2460f file 2419 ./CVS/Entries +02e8ff0d3f2ec7d43c5bd2cab43411f2 file 12 ./CVS/Repository +3f6cbd81c1c48286b371ab4555e9db3d file 61 ./CVS/Root +b403f6424bc8c7a8f3f4b628b2e00d09 file 51 ./CVS/Root.bak +4788c16f03d34c5c794a8aa2eeb2f953 file 2532 ./Makefile +14bf9693ed16c86c3af6b60b2c5d6486 file 234 ./NOTES +787b04cd6f5389f8f629110ea8ebac3f file 3714 ./_bak_ftr.ned/(dirinf).ftr +d4540fe545687342343961fb6e5843ff file 2827 ./_bak_ftr.ned/CVS/Entries +6da01e2e1be3a2e225647c1bee808617 file 25 ./_bak_ftr.ned/CVS/Repository +3f6cbd81c1c48286b371ab4555e9db3d file 61 ./_bak_ftr.ned/CVS/Root +b403f6424bc8c7a8f3f4b628b2e00d09 file 51 ./_bak_ftr.ned/CVS/Root.bak +c9a38c49e35c5ce1c63e59870ba72df9 file 29 ./_bak_ftr.ned/Makefile.ftr +788dad3abaca5c2a13ec0976827b6c93 file 111 ./_bak_ftr.ned/NOTES.ftr +183ebbc9e3df749f5d017a3ec80d5d6d file 5098 ./_bak_ftr.ned/dab1.ftr +48e0beca98ebbf8f7e9ebafb5864d420 file 153 ./_bak_ftr.ned/dict0001.ftr +6693aa9badc4ea473d184ccffc26adff file 426 ./_bak_ftr.ned/dict0002.ftr +68814842aa54584717d2a3e44c9586c1 file 325 ./_bak_ftr.ned/dict0003.ftr +10a0bd37d9a66615416a6f9730ce3e8b file 2129 ./_bak_ftr.ned/dict0004.ftr +ecce3a8f3817f7d44e5ed60422ad8167 file 1005 ./_bak_ftr.ned/dict0005.ftr +f9c31578f181b1d5225ee175c3d64254 file 1184 ./_bak_ftr.ned/dict0006.ftr +5babd79fbe660e1a2a33bbf52edcdae6 file 546 ./_bak_ftr.ned/dict0007.ftr +e34819615d74bcd4e522e5ebfbe3a7a0 file 550 ./_bak_ftr.ned/dict0008.ftr +edabb2a3cea79acdaa481a0e7692a8df file 883 ./_bak_ftr.ned/dict0009.ftr +aea01ceea5d13320359b60d51e88b4b0 file 1706 ./_bak_ftr.ned/dict0010.ftr +dc57af1c26b299559994aa671ef1a4d0 file 379 ./_bak_ftr.ned/dict0011.ftr +aae33957bd4bdc62246a180e0a817159 file 1196 ./_bak_ftr.ned/dict0012.ftr +7dc6acaa2072cd40e964457b068092e6 file 455 ./_bak_ftr.ned/dict0013.ftr +60983f89d384ec5e889fe31b93ac837f file 926 ./_bak_ftr.ned/dict0014.ftr +6652ae79024a1b9952eb143dd7a95359 file 1085 ./_bak_ftr.ned/dict0015.ftr +c369c7617ffec225d3c1266d9455a9fc file 2554 ./_bak_ftr.ned/dict0016.ftr +d2864c589bbab42c7130ad2f54da2210 file 726 ./_bak_ftr.ned/dict0018.ftr +465302b497873379614b84af7ad94f5f file 531 ./_bak_ftr.ned/dict0031.ftr +87d9a4832020fba83a31768f977f0350 file 468 ./_bak_ftr.ned/dict0032.ftr +13f57a0c83e599f5578a4ee35537fa3e file 1341 ./_bak_ftr.ned/dict0033.ftr +4627842b771dadecf64613ada2f4c615 file 6797 ./_bak_ftr.ned/dictadd.ftr +9bafc3d8337bfa662b86baebd4ac87f1 file 1440 ./_bak_ftr.ned/dictadd1.ftr +0c1b66108b27bf06aa18266e40ba8cb5 file 4230 ./_bak_ftr.ned/dictadd2.ftr +a50a10aa74260e974f5272f808d82ced file 6310 ./_bak_ftr.ned/dictadd3.ftr +0cffe7b1673c3f90216a80d8167832e4 file 597 ./_bak_ftr.ned/dictadd4.ftr +f5096e833e0176aa41912f9a0c7b330e file 756 ./_bak_ftr.ned/dictadd6.ftr +750162df6439c49d73e1ec12451fe9b6 file 833 ./_bak_ftr.ned/dictadd8.ftr +5b1577f5aee4c0c2c6dad44c11f5453e file 1276 ./_bak_ftr.ned/dictadd9.ftr +f592de1c8e5ba32ccdbf5d2904ffc0e0 file 2183 ./_bak_ftr.ned/dictmod.ftr +5c8db8b8a7590273b9735652a644e529 file 90 ./_bak_ftr.ned/edited.ftr +672bf65a6ae075ce5f95558aea32997a file 29 ./_bak_ftr.ned/grtag.ftr +674cd0a6bbbf4a67ed71ada706b44efe file 402 ./_bak_ftr.ned/http4lex.ftr +9a0a10f87aed7c643815c88f438d2ab4 file 263 ./_bak_ftr.ned/lex.ftr +46d197489c6d0917715861f2b7fb6d80 file 4230 ./_bak_ftr.ned/lex00001.ftr +ea69102086e34c570b4f24e6aaa71365 file 38 ./_bak_ftr.ned/lexfile.ftr +ec0e4a898190f3cdc043c2826e4c6998 file 29 ./_bak_ftr.ned/lexicon.ftr +ef08aed1a99b84cf3ac23ccb73d02076 file 457 ./_bak_ftr.ned/lexpr001.ftr +9eedc8e6c04a72799111a6ae1222b4ac file 110 ./_bak_ftr.ned/lexproc.ftr +c654e879b0a81614741efa7e8aea9259 file 803 ./_bak_ftr.ned/lexut001.ftr +2e877afe782a674d80e91bace1a19bfd file 96 ./_bak_ftr.ned/make-dos.ftr +5f433bdee912012f99c6e98d7b577008 file 29 ./_bak_ftr.ned/makeshar.ftr +460ec1c5c58828fe944d9028a20e2a87 file 29 ./_bak_ftr.ned/ned.ftr +f18a7c290eec74368be721d71c6e3944 file 241 ./_bak_ftr.ned/parse001.ftr +3f3aba4c1b83e8fed8bc6d0181dd4676 file 872 ./_bak_ftr.ned/parse002.ftr +31d4738d139be749362aa166572a7c4c file 334 ./_bak_ftr.ned/parse007.ftr +b102c8adaa411d134dd4821e868e77f6 file 682 ./_bak_ftr.ned/parse008.ftr +26d29107715a26b0d626443183c7ecbf file 300 ./_bak_ftr.ned/parse014.ftr +bd66a22d034f623c377597ed1c115126 file 289 ./_bak_ftr.ned/parse015.ftr +81437c8f9094bbf0d9d23d4974ea886f file 2448 ./_bak_ftr.ned/parse016.ftr +248cefaa8c4533493609841b1ad8f1a3 file 235 ./_bak_ftr.ned/parse017.ftr +7945504f21085fc0c055598e4ab0d7d0 file 152 ./_bak_ftr.ned/parse019.ftr +5b8f927e886e4d39d836e8b076855cca file 250 ./_bak_ftr.ned/parse021.ftr +9f8620ebe18a4611f539bf13408c21a3 file 275 ./_bak_ftr.ned/parse022.ftr +e3b4583b3c9f715ec1b7d98757615652 file 2329 ./_bak_ftr.ned/possig.ftr +407a1451c371ab520f020e3793f2e90c file 2907 ./_bak_ftr.ned/pt.ftr +76027db3e48126cde323ce746efe689e file 29 ./_bak_ftr.ned/test1.ftr +10d2a0eda08fc34c0e78018be1df8e94 file 29 ./_bak_ftr.ned/test2.ftr +830c88d2fe1b26c14d9138e44070f7ad file 667 ./_bak_ftr.ned/tst1.ftr +91708b42cb22d1d1ccad7564651edcc0 file 180 ./_bak_ftr.ned/tst2.ftr +9736f1a6b6db910bae73ecada375c9bd file 29 ./_bak_ftr.ned/xx.ftr +10cabc7bd0fcab1ffce2cead7134cbfb file 753 ./alexicon.hyx +c9eabc39b163c5260be043c289c8a0fc file 36 ./alexicon.idx +c36572de7beac94fd2f9418bd3b1dd78 file 32 ./alexicon.lut +25c3e0240a733ed978f1c91d3ec327a1 file 735 ./dict0001.c +7df42a0c59645a7124a625a7ca0c5671 file 2596 ./dict0001.o +b88c018fc122c70e2b108a685e8bc129 file 1165 ./dict0002.c +7ca981048c0d6793d74507ed56042c62 file 3728 ./dict0002.o +2c65dc29b902325279f9c433c646e5b2 file 755 ./dict0003.c +3ee2bd0f5d260a6191fdc6d8f44b1403 file 4320 ./dict0003.o +77ecfb8b1afea9cfd2aacd1f31e288c3 file 4814 ./dict0004.c +2a04dd2a8c7566eb63af2697eceefa47 file 8492 ./dict0004.o +a8f1483975c942ba364a25df720a71ad file 1099 ./dict0005.c +141085a9f8059d75f7cf67cbc7f05ca9 file 6004 ./dict0005.o +fc432e07680f7e1893aa869866836cf8 file 1936 ./dict0006.c +cb92ba6b02e37e2f65e0b8470685db41 file 4820 ./dict0006.o +1031776dead55fd0cb782fc15704c74a file 927 ./dict0007.c +4f3eb9f70d31ad6a17a5db32ec852671 file 3472 ./dict0007.o +696d087160b44eddd3b35bede17f6274 file 920 ./dict0008.c +e86c5c857a818c6ff51738810ec040e7 file 3524 ./dict0008.o +be608c4c52b9f6f5fefbf026028fdb86 file 995 ./dict0009.c +5d951a8c969a60061c43e58660b0960f file 3784 ./dict0009.o +f198ddeaa0204a34442c79f01d4eae73 file 2285 ./dict0010.c +fa876edf11789421ea02b07c24a7f5b0 file 6264 ./dict0010.o +11eef22874edbce6e3fc9d24713b1138 file 694 ./dict0011.c +99e6ca67ffc56595886088dd4b89b8ac file 4512 ./dict0011.o +904ab571bd338998fcfda55ff7ebb497 file 1693 ./dict0012.c +a9de960f8f8318f0dddd5d2c7d5297c5 file 5448 ./dict0012.o +c395d152be2c03eccff9fff6cda53acb file 682 ./dict0013.c +959a0f6cea54800fe85cc7632b0f1a3a file 4240 ./dict0013.o +0cfc95102bd53babe351be227a3a2d77 file 1915 ./dict0014.c +d0b1d3b70f9becba64c4175f0d5f3c9d file 4708 ./dict0014.o +de31b64d234ebd4282fd0880ecd6d1cd file 1618 ./dict0015.c +da9dbfee1ca19bb65fb3520dd535eb54 file 7092 ./dict0015.o +ccec9826c46ebac07b5953104da37f3b file 3587 ./dict0016.c +3bf112ed9c7b07845d4a284af909789b file 6004 ./dict0016.o +edbb96a221be6d0c30ecceec51967936 file 1016 ./dict0018.c +8a0fe0414dfeda35e15ed312fb0269c6 file 2900 ./dict0018.o +c613a5d6f1b95d2594ad4b06c67d93be file 388488 ./dictadd +32b584ea223a015f2e0d153f682d5aea file 11200 ./dictadd.c +b7e18637dea58e84bc414e6ee88e13fc file 21328 ./dictadd.o +726d54770219ddb165f26cae0cd979f3 file 3235 ./dictadd1.c +e4ce273194fec8e27856fb4b773a99e3 file 8076 ./dictadd1.o +dda2ac67474da3ff08c141f7c995f593 file 7417 ./dictadd2.c +6bcbbda3a4e09574cc2f80554140e14e file 5908 ./dictadd2.o +0528b4e55c6dfea8d56f568464250b55 file 8144 ./dictadd3.c +626d206d09e83ab32883f943d4fd2720 file 9728 ./dictadd3.o +12235ad28abdf31a687185689bb766f6 file 1887 ./dictadd4.c +0b04aa92c35f185c9847a88fbf6f3edd file 5084 ./dictadd4.o +8fb53fd042307604fedb1abf7d5d44c3 file 1426 ./dictadd6.c +57a731fe921925dc2c9ab353a383b7b4 file 4800 ./dictadd6.o +6eb434a3bf55fd19dff044dc4d753432 file 1561 ./dictadd8.c +3fb941df9e5df46f52bf05fc9a93a756 file 3544 ./dictadd8.o +2d7b45a056c373fd7794b92b05a15dd0 file 1674 ./dictadd9.c +dc8047fa7099fd950397915902b3c097 file 3644 ./dictadd9.o +f9b2c351f258942633cc1540a536b794 file 109460 ./dictmod +72376830988bb71625eff6e025a10710 file 13184 ./dictmod.c +6ef55195d6f4d44b73d27674057f5c19 file 18808 ./dictmod.o +0abcc5f96310398f31a9ddb0cc0bd996 file 6641 ./grtag.pl +18a20dde925ef6589cbac1f329fb7961 file 5816 ./http4lex.pl +9d6ce0fc4b5739b58b5a8ee266602ad4 file 400 ./lex.c +1d429a50e9900525dcdff198769c0a10 file 15134 ./lex00001.c +f9aeade4ae7fd265e3f01809b3dd30e5 file 1959 ./lexpr001.c +4104dc8b6324b46a0bdf840c084ff27d file 4280 ./lexpr001.o +838192fa57aba272a40892ceff9c0820 file 265 ./lexproc.h +6dd47b55d356e0abf60c6bbe16dba50d file 6466 ./lexut001.c +c4e4c6e93165ecae0d2314ea2ccd7eb6 file 7236 ./lexut001.o +d41d8cd98f00b204e9800998ecf8427e file 0 ./lib +744ba024486b9d7ee9319bc3eb51db3e file 2429 ./make-dos +48c625d9d5228a47171aff22c2381ffa file 6343 ./makeshar.lst +3c6a4fa828ff948020f5dda79b4f4efc file 4540 ./parsd008.o +67dd182f3a28e7a4f76576120aedb417 file 6960 ./parsd016.o +fdbc1444920f04e5d72c40710a76696d file 704 ./parse007.c +d9a771086d3895297480b6e9e87bacca file 4308 ./parse007.o +6b4dcc218c5b4be614ca6e520a7939ea file 2021 ./parse008.c +c360fb88bd9ec65ab3c54f2b0cccbaf8 file 4384 ./parse008.o +3666227eb0822560af2a2d4d68ca20e2 file 558 ./parse014.c +a0b26f62c915af7123503fe53e324e9f file 2412 ./parse014.o +07b51d758bfee6aaac02e114fcbd7c52 file 3315 ./parse015.c +df26045c123b75dbba3e90616b61e6f0 file 4266 ./parse016.c +e285338524c27fbcd730082b9f20e2c2 file 6524 ./parse016.o +83ba6b9be085d8710d8cb13989104301 file 875 ./parse017.c +d29ed7bcb68671c7aa661e79324f0db9 file 3964 ./parse017.o +30c22988db7c578aeca03a3954f88977 file 3396 ./parse019.c +92caf57b6661d6dd18b12ddb54fe58de file 3024 ./parse019.o +38a19233e8bba91a013ad6ad358a821d file 555 ./parse021.c +cd975af9128097830a1b544da14f2a19 file 4252 ./parse021.o +1a4be39dc8c202857141d2a869049d6a file 747 ./parse022.c +56909122432617f91a7e709f7dfd1ac6 file 3672 ./parse022.o +b433f34332c05f0cb40c627b5edea2fb file 4053 ./possig.awk +f95886faeb329056c5a7371a6911c4de file 127443 ./pt +e57af719a461af6ce8ec959afb201a37 file 6581 ./pt.c +091d0d78155e737b411e850db1f1f6e5 file 11628 ./pt.o +1e7efa4d5c1264acb5f40034dc455ac1 file 200 ./test3a +cc4fb51e168a4d7950e583751d0b9494 file 200 ./test3b +3ebbeb571d1e9d8a354ad1fc77fbfb9a file 195 ./testdata/CVS/Entries +460e9ae96ee9730a1fbdaa128b456ab4 file 21 ./testdata/CVS/Repository +3f6cbd81c1c48286b371ab4555e9db3d file 61 ./testdata/CVS/Root +b403f6424bc8c7a8f3f4b628b2e00d09 file 51 ./testdata/CVS/Root.bak +5bd82f7acaf0923b7bb0d8022d29c6fc file 308 ./testdata/test1.l +f93900f14c00c2580ca2336095e75ff8 file 126 ./testdata/test2.l +7e27d1d4ee1e8d9aec0d976ab5d0f20e file 20 ./testdata/x1.l +4590e24626f557f385f3f01d28c06a3a file 215 ./testdata/x2a.l +dfdfb1cf2484830bd83c8dcc577a84ef file 63 ./testdata/x2b.l +969cc90f7549f7faa3f74c7d7bd76bba file 16043 ./tst1 +dbbb6c092d74f7fd2c67809fe837501c file 3088 ./tst1.c +14aee66fefd27984a3c0f311ee527f4e file 960 ./tst2.c diff --git a/app/lexicon/Makefile b/app/lexicon/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..e35bea82cd5a58c3fc34ae41424869cec87f591d --- /dev/null +++ b/app/lexicon/Makefile @@ -0,0 +1,98 @@ +# +# FILE %lexicon/make-ux (Makefile) +# +# Makefile fuer Unix +# see also: makeshar.lst +# +# written: 1991-02-01 +# latest update: 2001-02-18 22:07:06 +# $Id: Makefile,v 1.8 2009/03/07 11:36:39 gonter Exp $ +# +# ============================================================================ +CC=cc +OPTS=-g -I. +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +BIN=/usr/local/bin +# BIN=/afs/.wu-wien.ac.at/rs_aix32/usr/afsws/local/bin +# BIN=/afs/.wu-wien.ac.at/pmax_ul43a/usr/afsws/local/bin +BINS=dictadd +BINS2=pt dictmod +BINS3=tst1 +# Note: atag.c missing? +lib=../../lib/libgg.a +LIBS= +# For SINIX 5.41 you need also these: +# LIBS=-lnsl -lresolv -lsocket -lksocket + +all : all.exe +all.exe : lib $(BINS) $(BINS2) $(BINS3) + +install : ${BINS} + cp ${BINS} ${BIN} + +install2 : ${BINS2} + cp ${BINS2} ${BIN} + +clean : + rm -f *.o lib $(BINS) $(BINS2) + +distclean : clean + rm -f alexicon.lut alexicon.hyx alexicon.idx + +# ---------------------------------------------------------------------------- +lib.old= lex00001.o +lib1=parse007.o parse008.o parse014.o parse016.o parse017.o \ + parse019.o parse021.o parse022.o parsd008.o parsd016.o \ + dictadd1.o dictadd2.o dictadd3.o dictadd4.o dictadd6.o \ + dictadd8.o dictadd9.o \ + dict0001.o dict0002.o dict0003.o dict0004.o dict0005.o dict0006.o \ + dict0007.o dict0008.o dict0009.o dict0010.o dict0011.o dict0012.o \ + dict0013.o dict0014.o dict0015.o dict0016.o dict0018.o \ + lexut001.o + +lib : $(lib1) + ar ru $(lib) $? + touch lib + ranlib $(lib) + +.c.o: + $(CC) $(OPTS) -c $? + +all2: + ( cd bbc && make ) + ( cd hyxp && make ) + ( cd ytree && make ) + make + +all2cleanall: + ( cd bbc && make clean all ) + ( cd hyxp && make clean all ) + ( cd ytree && make clean all ) + make clean all + +# test programs: ------------------------------------------------------------- +pt : pt.o parsd008.o parsd016.o $(lib) + cc -o pt pt.o parsd008.o parsd016.o $(lib) + +lex : lex.o $(lib) + cc -o lex lex.o $(lib) + +# production programs: ------------------------------------------------------- +dictadd : dictadd.o $(lib) + cc -o dictadd dictadd.o $(lib) $(LIBS) + +dictmod : dictmod.o lexpr001.o $(lib) + cc -o dictmod dictmod.o lexpr001.o $(lib) + +atag : atag.o $(lib) + cc -o atag atag.o $(lib) + +tst1 : tst1.c $(lib) + cc -I. -o tst1 tst1.c $(lib) + +# ---------------------------------------------------------------------------- +parsd008.o: parse008.c + $(CC) $(OPTS) -c -DDIAGNOSTIC -o $@ parse008.c + +parsd016.o: parse016.c + $(CC) $(OPTS) -c -DDIAGNOSTIC -o $@ parse016.c diff --git a/app/lexicon/NOTES b/app/lexicon/NOTES new file mode 100644 index 0000000000000000000000000000000000000000..f759f04a147d04636177b4b3678882ce94cde9bd --- /dev/null +++ b/app/lexicon/NOTES @@ -0,0 +1,11 @@ +#!/usr/local/bin/perl +# FILE %work/fbsd/gg/app/lexicon/NOTES +# +# written: 1999-11-28 +# latest update: 1999-11-28 13:12:34 +# + +char *get_divided_lexicon() returns strdup()'ed string. + => Check if this could be a memory leak. + + diff --git a/app/lexicon/alexicon.hyx b/app/lexicon/alexicon.hyx new file mode 100644 index 0000000000000000000000000000000000000000..05021ec3f271ba92652df2f6d1661b79fcf7325d --- /dev/null +++ b/app/lexicon/alexicon.hyx @@ -0,0 +1,2541 @@ +<ned.sgml enc="LEX"> +<hyx.stamp d="2010-04-28" t="18:36:24" u="user@unknown" pgm=dictadd> +<:md5 c5a56cb08c9b68d5d95be67f2820e670> +<LE>md5 c5a56cb08c9b68d5d95be67f2820e670</LE> +<II> +<md5>c5a56cb08c9b68d5d95be67f2820e670 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>(dirinf).fm +<;> +<:fnm (dirinf).fm> +<LE>fnm (dirinf).fm</LE> +<II> +<md5>c5a56cb08c9b68d5d95be67f2820e670 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>(dirinf).fm +<;> +<:md5 e1a3139468fb49161ce389b75e54d71f> +<LE>md5 e1a3139468fb49161ce389b75e54d71f</LE> +<II> +<md5>e1a3139468fb49161ce389b75e54d71f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>.cvsignore +<;> +<:fnm .cvsignore> +<LE>fnm .cvsignore</LE> +<II> +<md5>e1a3139468fb49161ce389b75e54d71f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>.cvsignore +<;> +<:md5 c36572de7beac94fd2f9418bd3b1dd78> +<LE>md5 c36572de7beac94fd2f9418bd3b1dd78</LE> +<II> +<md5>c36572de7beac94fd2f9418bd3b1dd78 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>@@@.lut +<II> +<md5>c36572de7beac94fd2f9418bd3b1dd78 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>alexicon.lut +<;> +<:fnm @@@.lut> +<LE>fnm @@@.lut</LE> +<II> +<md5>c36572de7beac94fd2f9418bd3b1dd78 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>@@@.lut +<;> +<:md5 2759baf11c89e121587834b092c2460f> +<LE>md5 2759baf11c89e121587834b092c2460f</LE> +<II> +<md5>2759baf11c89e121587834b092c2460f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/CVS +<fnm>Entries +<;> +<:fnm entries> +<LE>fnm entries</LE> +<LM>fnm Entries</LM> +<II> +<md5>2759baf11c89e121587834b092c2460f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/CVS +<fnm>Entries +<LM>fnm Entries</LM> +<II> +<md5>d4540fe545687342343961fb6e5843ff +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned/CVS +<fnm>Entries +<LM>fnm Entries</LM> +<II> +<md5>3ebbeb571d1e9d8a354ad1fc77fbfb9a +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata/CVS +<fnm>Entries +<;> +<:md5 02e8ff0d3f2ec7d43c5bd2cab43411f2> +<LE>md5 02e8ff0d3f2ec7d43c5bd2cab43411f2</LE> +<II> +<md5>02e8ff0d3f2ec7d43c5bd2cab43411f2 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/CVS +<fnm>Repository +<;> +<:fnm repository> +<LE>fnm repository</LE> +<LM>fnm Repository</LM> +<II> +<md5>02e8ff0d3f2ec7d43c5bd2cab43411f2 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/CVS +<fnm>Repository +<LM>fnm Repository</LM> +<II> +<md5>6da01e2e1be3a2e225647c1bee808617 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned/CVS +<fnm>Repository +<LM>fnm Repository</LM> +<II> +<md5>460e9ae96ee9730a1fbdaa128b456ab4 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata/CVS +<fnm>Repository +<;> +<:md5 3f6cbd81c1c48286b371ab4555e9db3d> +<LE>md5 3f6cbd81c1c48286b371ab4555e9db3d</LE> +<II> +<md5>3f6cbd81c1c48286b371ab4555e9db3d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/CVS +<fnm>Root +<II> +<md5>3f6cbd81c1c48286b371ab4555e9db3d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned/CVS +<fnm>Root +<II> +<md5>3f6cbd81c1c48286b371ab4555e9db3d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata/CVS +<fnm>Root +<;> +<:fnm root> +<LE>fnm root</LE> +<LM>fnm Root</LM> +<II> +<md5>3f6cbd81c1c48286b371ab4555e9db3d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/CVS +<fnm>Root +<LM>fnm Root</LM> +<II> +<md5>3f6cbd81c1c48286b371ab4555e9db3d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned/CVS +<fnm>Root +<LM>fnm Root</LM> +<II> +<md5>3f6cbd81c1c48286b371ab4555e9db3d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata/CVS +<fnm>Root +<;> +<:md5 b403f6424bc8c7a8f3f4b628b2e00d09> +<LE>md5 b403f6424bc8c7a8f3f4b628b2e00d09</LE> +<II> +<md5>b403f6424bc8c7a8f3f4b628b2e00d09 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/CVS +<fnm>Root.bak +<II> +<md5>b403f6424bc8c7a8f3f4b628b2e00d09 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned/CVS +<fnm>Root.bak +<II> +<md5>b403f6424bc8c7a8f3f4b628b2e00d09 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata/CVS +<fnm>Root.bak +<;> +<:fnm root.bak> +<LE>fnm root.bak</LE> +<LM>fnm Root.bak</LM> +<II> +<md5>b403f6424bc8c7a8f3f4b628b2e00d09 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/CVS +<fnm>Root.bak +<LM>fnm Root.bak</LM> +<II> +<md5>b403f6424bc8c7a8f3f4b628b2e00d09 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned/CVS +<fnm>Root.bak +<LM>fnm Root.bak</LM> +<II> +<md5>b403f6424bc8c7a8f3f4b628b2e00d09 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata/CVS +<fnm>Root.bak +<;> +<:md5 4788c16f03d34c5c794a8aa2eeb2f953> +<LE>md5 4788c16f03d34c5c794a8aa2eeb2f953</LE> +<II> +<md5>4788c16f03d34c5c794a8aa2eeb2f953 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>Makefile +<;> +<:fnm makefile> +<LE>fnm makefile</LE> +<LM>fnm Makefile</LM> +<II> +<md5>4788c16f03d34c5c794a8aa2eeb2f953 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>Makefile +<;> +<:md5 14bf9693ed16c86c3af6b60b2c5d6486> +<LE>md5 14bf9693ed16c86c3af6b60b2c5d6486</LE> +<II> +<md5>14bf9693ed16c86c3af6b60b2c5d6486 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>NOTES +<;> +<:fnm notes> +<LE>fnm notes</LE> +<LM>fnm NOTES</LM> +<II> +<md5>14bf9693ed16c86c3af6b60b2c5d6486 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>NOTES +<;> +<:md5 787b04cd6f5389f8f629110ea8ebac3f> +<LE>md5 787b04cd6f5389f8f629110ea8ebac3f</LE> +<II> +<md5>787b04cd6f5389f8f629110ea8ebac3f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>(dirinf).ftr +<;> +<:fnm (dirinf).ftr> +<LE>fnm (dirinf).ftr</LE> +<II> +<md5>787b04cd6f5389f8f629110ea8ebac3f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>(dirinf).ftr +<;> +<:md5 d4540fe545687342343961fb6e5843ff> +<LE>md5 d4540fe545687342343961fb6e5843ff</LE> +<II> +<md5>d4540fe545687342343961fb6e5843ff +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned/CVS +<fnm>Entries +<;> +<:md5 6da01e2e1be3a2e225647c1bee808617> +<LE>md5 6da01e2e1be3a2e225647c1bee808617</LE> +<II> +<md5>6da01e2e1be3a2e225647c1bee808617 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned/CVS +<fnm>Repository +<;> +<:md5 c9a38c49e35c5ce1c63e59870ba72df9> +<LE>md5 c9a38c49e35c5ce1c63e59870ba72df9</LE> +<II> +<md5>c9a38c49e35c5ce1c63e59870ba72df9 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>Makefile.ftr +<;> +<:fnm makefile.ftr> +<LE>fnm makefile.ftr</LE> +<LM>fnm Makefile.ftr</LM> +<II> +<md5>c9a38c49e35c5ce1c63e59870ba72df9 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>Makefile.ftr +<;> +<:md5 788dad3abaca5c2a13ec0976827b6c93> +<LE>md5 788dad3abaca5c2a13ec0976827b6c93</LE> +<II> +<md5>788dad3abaca5c2a13ec0976827b6c93 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>NOTES.ftr +<;> +<:fnm notes.ftr> +<LE>fnm notes.ftr</LE> +<LM>fnm NOTES.ftr</LM> +<II> +<md5>788dad3abaca5c2a13ec0976827b6c93 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>NOTES.ftr +<;> +<:md5 183ebbc9e3df749f5d017a3ec80d5d6d> +<LE>md5 183ebbc9e3df749f5d017a3ec80d5d6d</LE> +<II> +<md5>183ebbc9e3df749f5d017a3ec80d5d6d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dab1.ftr +<;> +<:fnm dab1.ftr> +<LE>fnm dab1.ftr</LE> +<II> +<md5>183ebbc9e3df749f5d017a3ec80d5d6d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dab1.ftr +<;> +<:md5 48e0beca98ebbf8f7e9ebafb5864d420> +<LE>md5 48e0beca98ebbf8f7e9ebafb5864d420</LE> +<II> +<md5>48e0beca98ebbf8f7e9ebafb5864d420 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0001.ftr +<;> +<:fnm dict0001.ftr> +<LE>fnm dict0001.ftr</LE> +<II> +<md5>48e0beca98ebbf8f7e9ebafb5864d420 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0001.ftr +<;> +<:md5 6693aa9badc4ea473d184ccffc26adff> +<LE>md5 6693aa9badc4ea473d184ccffc26adff</LE> +<II> +<md5>6693aa9badc4ea473d184ccffc26adff +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0002.ftr +<;> +<:fnm dict0002.ftr> +<LE>fnm dict0002.ftr</LE> +<II> +<md5>6693aa9badc4ea473d184ccffc26adff +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0002.ftr +<;> +<:md5 68814842aa54584717d2a3e44c9586c1> +<LE>md5 68814842aa54584717d2a3e44c9586c1</LE> +<II> +<md5>68814842aa54584717d2a3e44c9586c1 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0003.ftr +<;> +<:fnm dict0003.ftr> +<LE>fnm dict0003.ftr</LE> +<II> +<md5>68814842aa54584717d2a3e44c9586c1 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0003.ftr +<;> +<:md5 10a0bd37d9a66615416a6f9730ce3e8b> +<LE>md5 10a0bd37d9a66615416a6f9730ce3e8b</LE> +<II> +<md5>10a0bd37d9a66615416a6f9730ce3e8b +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0004.ftr +<;> +<:fnm dict0004.ftr> +<LE>fnm dict0004.ftr</LE> +<II> +<md5>10a0bd37d9a66615416a6f9730ce3e8b +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0004.ftr +<;> +<:md5 ecce3a8f3817f7d44e5ed60422ad8167> +<LE>md5 ecce3a8f3817f7d44e5ed60422ad8167</LE> +<II> +<md5>ecce3a8f3817f7d44e5ed60422ad8167 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0005.ftr +<;> +<:fnm dict0005.ftr> +<LE>fnm dict0005.ftr</LE> +<II> +<md5>ecce3a8f3817f7d44e5ed60422ad8167 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0005.ftr +<;> +<:md5 f9c31578f181b1d5225ee175c3d64254> +<LE>md5 f9c31578f181b1d5225ee175c3d64254</LE> +<II> +<md5>f9c31578f181b1d5225ee175c3d64254 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0006.ftr +<;> +<:fnm dict0006.ftr> +<LE>fnm dict0006.ftr</LE> +<II> +<md5>f9c31578f181b1d5225ee175c3d64254 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0006.ftr +<;> +<:md5 5babd79fbe660e1a2a33bbf52edcdae6> +<LE>md5 5babd79fbe660e1a2a33bbf52edcdae6</LE> +<II> +<md5>5babd79fbe660e1a2a33bbf52edcdae6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0007.ftr +<;> +<:fnm dict0007.ftr> +<LE>fnm dict0007.ftr</LE> +<II> +<md5>5babd79fbe660e1a2a33bbf52edcdae6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0007.ftr +<;> +<:md5 e34819615d74bcd4e522e5ebfbe3a7a0> +<LE>md5 e34819615d74bcd4e522e5ebfbe3a7a0</LE> +<II> +<md5>e34819615d74bcd4e522e5ebfbe3a7a0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0008.ftr +<;> +<:fnm dict0008.ftr> +<LE>fnm dict0008.ftr</LE> +<II> +<md5>e34819615d74bcd4e522e5ebfbe3a7a0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0008.ftr +<;> +<:md5 edabb2a3cea79acdaa481a0e7692a8df> +<LE>md5 edabb2a3cea79acdaa481a0e7692a8df</LE> +<II> +<md5>edabb2a3cea79acdaa481a0e7692a8df +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0009.ftr +<;> +<:fnm dict0009.ftr> +<LE>fnm dict0009.ftr</LE> +<II> +<md5>edabb2a3cea79acdaa481a0e7692a8df +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0009.ftr +<;> +<:md5 aea01ceea5d13320359b60d51e88b4b0> +<LE>md5 aea01ceea5d13320359b60d51e88b4b0</LE> +<II> +<md5>aea01ceea5d13320359b60d51e88b4b0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0010.ftr +<;> +<:fnm dict0010.ftr> +<LE>fnm dict0010.ftr</LE> +<II> +<md5>aea01ceea5d13320359b60d51e88b4b0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0010.ftr +<;> +<:md5 dc57af1c26b299559994aa671ef1a4d0> +<LE>md5 dc57af1c26b299559994aa671ef1a4d0</LE> +<II> +<md5>dc57af1c26b299559994aa671ef1a4d0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0011.ftr +<;> +<:fnm dict0011.ftr> +<LE>fnm dict0011.ftr</LE> +<II> +<md5>dc57af1c26b299559994aa671ef1a4d0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0011.ftr +<;> +<:md5 aae33957bd4bdc62246a180e0a817159> +<LE>md5 aae33957bd4bdc62246a180e0a817159</LE> +<II> +<md5>aae33957bd4bdc62246a180e0a817159 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0012.ftr +<;> +<:fnm dict0012.ftr> +<LE>fnm dict0012.ftr</LE> +<II> +<md5>aae33957bd4bdc62246a180e0a817159 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0012.ftr +<;> +<:md5 7dc6acaa2072cd40e964457b068092e6> +<LE>md5 7dc6acaa2072cd40e964457b068092e6</LE> +<II> +<md5>7dc6acaa2072cd40e964457b068092e6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0013.ftr +<;> +<:fnm dict0013.ftr> +<LE>fnm dict0013.ftr</LE> +<II> +<md5>7dc6acaa2072cd40e964457b068092e6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0013.ftr +<;> +<:md5 60983f89d384ec5e889fe31b93ac837f> +<LE>md5 60983f89d384ec5e889fe31b93ac837f</LE> +<II> +<md5>60983f89d384ec5e889fe31b93ac837f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0014.ftr +<;> +<:fnm dict0014.ftr> +<LE>fnm dict0014.ftr</LE> +<II> +<md5>60983f89d384ec5e889fe31b93ac837f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0014.ftr +<;> +<:md5 6652ae79024a1b9952eb143dd7a95359> +<LE>md5 6652ae79024a1b9952eb143dd7a95359</LE> +<II> +<md5>6652ae79024a1b9952eb143dd7a95359 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0015.ftr +<;> +<:fnm dict0015.ftr> +<LE>fnm dict0015.ftr</LE> +<II> +<md5>6652ae79024a1b9952eb143dd7a95359 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0015.ftr +<;> +<:md5 c369c7617ffec225d3c1266d9455a9fc> +<LE>md5 c369c7617ffec225d3c1266d9455a9fc</LE> +<II> +<md5>c369c7617ffec225d3c1266d9455a9fc +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0016.ftr +<;> +<:fnm dict0016.ftr> +<LE>fnm dict0016.ftr</LE> +<II> +<md5>c369c7617ffec225d3c1266d9455a9fc +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0016.ftr +<;> +<:md5 d2864c589bbab42c7130ad2f54da2210> +<LE>md5 d2864c589bbab42c7130ad2f54da2210</LE> +<II> +<md5>d2864c589bbab42c7130ad2f54da2210 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0018.ftr +<;> +<:fnm dict0018.ftr> +<LE>fnm dict0018.ftr</LE> +<II> +<md5>d2864c589bbab42c7130ad2f54da2210 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0018.ftr +<;> +<:md5 465302b497873379614b84af7ad94f5f> +<LE>md5 465302b497873379614b84af7ad94f5f</LE> +<II> +<md5>465302b497873379614b84af7ad94f5f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0031.ftr +<;> +<:fnm dict0031.ftr> +<LE>fnm dict0031.ftr</LE> +<II> +<md5>465302b497873379614b84af7ad94f5f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0031.ftr +<;> +<:md5 87d9a4832020fba83a31768f977f0350> +<LE>md5 87d9a4832020fba83a31768f977f0350</LE> +<II> +<md5>87d9a4832020fba83a31768f977f0350 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0032.ftr +<;> +<:fnm dict0032.ftr> +<LE>fnm dict0032.ftr</LE> +<II> +<md5>87d9a4832020fba83a31768f977f0350 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0032.ftr +<;> +<:md5 13f57a0c83e599f5578a4ee35537fa3e> +<LE>md5 13f57a0c83e599f5578a4ee35537fa3e</LE> +<II> +<md5>13f57a0c83e599f5578a4ee35537fa3e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0033.ftr +<;> +<:fnm dict0033.ftr> +<LE>fnm dict0033.ftr</LE> +<II> +<md5>13f57a0c83e599f5578a4ee35537fa3e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dict0033.ftr +<;> +<:md5 4627842b771dadecf64613ada2f4c615> +<LE>md5 4627842b771dadecf64613ada2f4c615</LE> +<II> +<md5>4627842b771dadecf64613ada2f4c615 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd.ftr +<;> +<:fnm dictadd.ftr> +<LE>fnm dictadd.ftr</LE> +<II> +<md5>4627842b771dadecf64613ada2f4c615 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd.ftr +<;> +<:md5 9bafc3d8337bfa662b86baebd4ac87f1> +<LE>md5 9bafc3d8337bfa662b86baebd4ac87f1</LE> +<II> +<md5>9bafc3d8337bfa662b86baebd4ac87f1 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd1.ftr +<;> +<:fnm dictadd1.ftr> +<LE>fnm dictadd1.ftr</LE> +<II> +<md5>9bafc3d8337bfa662b86baebd4ac87f1 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd1.ftr +<;> +<:md5 0c1b66108b27bf06aa18266e40ba8cb5> +<LE>md5 0c1b66108b27bf06aa18266e40ba8cb5</LE> +<II> +<md5>0c1b66108b27bf06aa18266e40ba8cb5 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd2.ftr +<;> +<:fnm dictadd2.ftr> +<LE>fnm dictadd2.ftr</LE> +<II> +<md5>0c1b66108b27bf06aa18266e40ba8cb5 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd2.ftr +<;> +<:md5 a50a10aa74260e974f5272f808d82ced> +<LE>md5 a50a10aa74260e974f5272f808d82ced</LE> +<II> +<md5>a50a10aa74260e974f5272f808d82ced +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd3.ftr +<;> +<:fnm dictadd3.ftr> +<LE>fnm dictadd3.ftr</LE> +<II> +<md5>a50a10aa74260e974f5272f808d82ced +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd3.ftr +<;> +<:md5 0cffe7b1673c3f90216a80d8167832e4> +<LE>md5 0cffe7b1673c3f90216a80d8167832e4</LE> +<II> +<md5>0cffe7b1673c3f90216a80d8167832e4 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd4.ftr +<;> +<:fnm dictadd4.ftr> +<LE>fnm dictadd4.ftr</LE> +<II> +<md5>0cffe7b1673c3f90216a80d8167832e4 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd4.ftr +<;> +<:md5 f5096e833e0176aa41912f9a0c7b330e> +<LE>md5 f5096e833e0176aa41912f9a0c7b330e</LE> +<II> +<md5>f5096e833e0176aa41912f9a0c7b330e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd6.ftr +<;> +<:fnm dictadd6.ftr> +<LE>fnm dictadd6.ftr</LE> +<II> +<md5>f5096e833e0176aa41912f9a0c7b330e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd6.ftr +<;> +<:md5 750162df6439c49d73e1ec12451fe9b6> +<LE>md5 750162df6439c49d73e1ec12451fe9b6</LE> +<II> +<md5>750162df6439c49d73e1ec12451fe9b6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd8.ftr +<;> +<:fnm dictadd8.ftr> +<LE>fnm dictadd8.ftr</LE> +<II> +<md5>750162df6439c49d73e1ec12451fe9b6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd8.ftr +<;> +<:md5 5b1577f5aee4c0c2c6dad44c11f5453e> +<LE>md5 5b1577f5aee4c0c2c6dad44c11f5453e</LE> +<II> +<md5>5b1577f5aee4c0c2c6dad44c11f5453e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd9.ftr +<;> +<:fnm dictadd9.ftr> +<LE>fnm dictadd9.ftr</LE> +<II> +<md5>5b1577f5aee4c0c2c6dad44c11f5453e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictadd9.ftr +<;> +<:md5 f592de1c8e5ba32ccdbf5d2904ffc0e0> +<LE>md5 f592de1c8e5ba32ccdbf5d2904ffc0e0</LE> +<II> +<md5>f592de1c8e5ba32ccdbf5d2904ffc0e0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictmod.ftr +<;> +<:fnm dictmod.ftr> +<LE>fnm dictmod.ftr</LE> +<II> +<md5>f592de1c8e5ba32ccdbf5d2904ffc0e0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>dictmod.ftr +<;> +<:md5 5c8db8b8a7590273b9735652a644e529> +<LE>md5 5c8db8b8a7590273b9735652a644e529</LE> +<II> +<md5>5c8db8b8a7590273b9735652a644e529 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>edited.ftr +<;> +<:fnm edited.ftr> +<LE>fnm edited.ftr</LE> +<II> +<md5>5c8db8b8a7590273b9735652a644e529 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>edited.ftr +<;> +<:md5 672bf65a6ae075ce5f95558aea32997a> +<LE>md5 672bf65a6ae075ce5f95558aea32997a</LE> +<II> +<md5>672bf65a6ae075ce5f95558aea32997a +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>grtag.ftr +<;> +<:fnm grtag.ftr> +<LE>fnm grtag.ftr</LE> +<II> +<md5>672bf65a6ae075ce5f95558aea32997a +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>grtag.ftr +<;> +<:md5 674cd0a6bbbf4a67ed71ada706b44efe> +<LE>md5 674cd0a6bbbf4a67ed71ada706b44efe</LE> +<II> +<md5>674cd0a6bbbf4a67ed71ada706b44efe +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>http4lex.ftr +<;> +<:fnm http4lex.ftr> +<LE>fnm http4lex.ftr</LE> +<II> +<md5>674cd0a6bbbf4a67ed71ada706b44efe +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>http4lex.ftr +<;> +<:md5 9a0a10f87aed7c643815c88f438d2ab4> +<LE>md5 9a0a10f87aed7c643815c88f438d2ab4</LE> +<II> +<md5>9a0a10f87aed7c643815c88f438d2ab4 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lex.ftr +<;> +<:fnm lex.ftr> +<LE>fnm lex.ftr</LE> +<II> +<md5>9a0a10f87aed7c643815c88f438d2ab4 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lex.ftr +<;> +<:md5 46d197489c6d0917715861f2b7fb6d80> +<LE>md5 46d197489c6d0917715861f2b7fb6d80</LE> +<II> +<md5>46d197489c6d0917715861f2b7fb6d80 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lex00001.ftr +<;> +<:fnm lex00001.ftr> +<LE>fnm lex00001.ftr</LE> +<II> +<md5>46d197489c6d0917715861f2b7fb6d80 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lex00001.ftr +<;> +<:md5 ea69102086e34c570b4f24e6aaa71365> +<LE>md5 ea69102086e34c570b4f24e6aaa71365</LE> +<II> +<md5>ea69102086e34c570b4f24e6aaa71365 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lexfile.ftr +<;> +<:fnm lexfile.ftr> +<LE>fnm lexfile.ftr</LE> +<II> +<md5>ea69102086e34c570b4f24e6aaa71365 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lexfile.ftr +<;> +<:md5 ec0e4a898190f3cdc043c2826e4c6998> +<LE>md5 ec0e4a898190f3cdc043c2826e4c6998</LE> +<II> +<md5>ec0e4a898190f3cdc043c2826e4c6998 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lexicon.ftr +<;> +<:fnm lexicon.ftr> +<LE>fnm lexicon.ftr</LE> +<II> +<md5>ec0e4a898190f3cdc043c2826e4c6998 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lexicon.ftr +<;> +<:md5 ef08aed1a99b84cf3ac23ccb73d02076> +<LE>md5 ef08aed1a99b84cf3ac23ccb73d02076</LE> +<II> +<md5>ef08aed1a99b84cf3ac23ccb73d02076 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lexpr001.ftr +<;> +<:fnm lexpr001.ftr> +<LE>fnm lexpr001.ftr</LE> +<II> +<md5>ef08aed1a99b84cf3ac23ccb73d02076 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lexpr001.ftr +<;> +<:md5 9eedc8e6c04a72799111a6ae1222b4ac> +<LE>md5 9eedc8e6c04a72799111a6ae1222b4ac</LE> +<II> +<md5>9eedc8e6c04a72799111a6ae1222b4ac +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lexproc.ftr +<;> +<:fnm lexproc.ftr> +<LE>fnm lexproc.ftr</LE> +<II> +<md5>9eedc8e6c04a72799111a6ae1222b4ac +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lexproc.ftr +<;> +<:md5 c654e879b0a81614741efa7e8aea9259> +<LE>md5 c654e879b0a81614741efa7e8aea9259</LE> +<II> +<md5>c654e879b0a81614741efa7e8aea9259 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lexut001.ftr +<;> +<:fnm lexut001.ftr> +<LE>fnm lexut001.ftr</LE> +<II> +<md5>c654e879b0a81614741efa7e8aea9259 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>lexut001.ftr +<;> +<:md5 2e877afe782a674d80e91bace1a19bfd> +<LE>md5 2e877afe782a674d80e91bace1a19bfd</LE> +<II> +<md5>2e877afe782a674d80e91bace1a19bfd +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>make-dos.ftr +<;> +<:fnm make-dos.ftr> +<LE>fnm make-dos.ftr</LE> +<II> +<md5>2e877afe782a674d80e91bace1a19bfd +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>make-dos.ftr +<;> +<:md5 5f433bdee912012f99c6e98d7b577008> +<LE>md5 5f433bdee912012f99c6e98d7b577008</LE> +<II> +<md5>5f433bdee912012f99c6e98d7b577008 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>makeshar.ftr +<;> +<:fnm makeshar.ftr> +<LE>fnm makeshar.ftr</LE> +<II> +<md5>5f433bdee912012f99c6e98d7b577008 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>makeshar.ftr +<;> +<:md5 460ec1c5c58828fe944d9028a20e2a87> +<LE>md5 460ec1c5c58828fe944d9028a20e2a87</LE> +<II> +<md5>460ec1c5c58828fe944d9028a20e2a87 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>ned.ftr +<;> +<:fnm ned.ftr> +<LE>fnm ned.ftr</LE> +<II> +<md5>460ec1c5c58828fe944d9028a20e2a87 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>ned.ftr +<;> +<:md5 f18a7c290eec74368be721d71c6e3944> +<LE>md5 f18a7c290eec74368be721d71c6e3944</LE> +<II> +<md5>f18a7c290eec74368be721d71c6e3944 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse001.ftr +<;> +<:fnm parse001.ftr> +<LE>fnm parse001.ftr</LE> +<II> +<md5>f18a7c290eec74368be721d71c6e3944 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse001.ftr +<;> +<:md5 3f3aba4c1b83e8fed8bc6d0181dd4676> +<LE>md5 3f3aba4c1b83e8fed8bc6d0181dd4676</LE> +<II> +<md5>3f3aba4c1b83e8fed8bc6d0181dd4676 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse002.ftr +<;> +<:fnm parse002.ftr> +<LE>fnm parse002.ftr</LE> +<II> +<md5>3f3aba4c1b83e8fed8bc6d0181dd4676 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse002.ftr +<;> +<:md5 31d4738d139be749362aa166572a7c4c> +<LE>md5 31d4738d139be749362aa166572a7c4c</LE> +<II> +<md5>31d4738d139be749362aa166572a7c4c +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse007.ftr +<;> +<:fnm parse007.ftr> +<LE>fnm parse007.ftr</LE> +<II> +<md5>31d4738d139be749362aa166572a7c4c +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse007.ftr +<;> +<:md5 b102c8adaa411d134dd4821e868e77f6> +<LE>md5 b102c8adaa411d134dd4821e868e77f6</LE> +<II> +<md5>b102c8adaa411d134dd4821e868e77f6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse008.ftr +<;> +<:fnm parse008.ftr> +<LE>fnm parse008.ftr</LE> +<II> +<md5>b102c8adaa411d134dd4821e868e77f6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse008.ftr +<;> +<:md5 26d29107715a26b0d626443183c7ecbf> +<LE>md5 26d29107715a26b0d626443183c7ecbf</LE> +<II> +<md5>26d29107715a26b0d626443183c7ecbf +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse014.ftr +<;> +<:fnm parse014.ftr> +<LE>fnm parse014.ftr</LE> +<II> +<md5>26d29107715a26b0d626443183c7ecbf +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse014.ftr +<;> +<:md5 bd66a22d034f623c377597ed1c115126> +<LE>md5 bd66a22d034f623c377597ed1c115126</LE> +<II> +<md5>bd66a22d034f623c377597ed1c115126 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse015.ftr +<;> +<:fnm parse015.ftr> +<LE>fnm parse015.ftr</LE> +<II> +<md5>bd66a22d034f623c377597ed1c115126 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse015.ftr +<;> +<:md5 81437c8f9094bbf0d9d23d4974ea886f> +<LE>md5 81437c8f9094bbf0d9d23d4974ea886f</LE> +<II> +<md5>81437c8f9094bbf0d9d23d4974ea886f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse016.ftr +<;> +<:fnm parse016.ftr> +<LE>fnm parse016.ftr</LE> +<II> +<md5>81437c8f9094bbf0d9d23d4974ea886f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse016.ftr +<;> +<:md5 248cefaa8c4533493609841b1ad8f1a3> +<LE>md5 248cefaa8c4533493609841b1ad8f1a3</LE> +<II> +<md5>248cefaa8c4533493609841b1ad8f1a3 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse017.ftr +<;> +<:fnm parse017.ftr> +<LE>fnm parse017.ftr</LE> +<II> +<md5>248cefaa8c4533493609841b1ad8f1a3 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse017.ftr +<;> +<:md5 7945504f21085fc0c055598e4ab0d7d0> +<LE>md5 7945504f21085fc0c055598e4ab0d7d0</LE> +<II> +<md5>7945504f21085fc0c055598e4ab0d7d0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse019.ftr +<;> +<:fnm parse019.ftr> +<LE>fnm parse019.ftr</LE> +<II> +<md5>7945504f21085fc0c055598e4ab0d7d0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse019.ftr +<;> +<:md5 5b8f927e886e4d39d836e8b076855cca> +<LE>md5 5b8f927e886e4d39d836e8b076855cca</LE> +<II> +<md5>5b8f927e886e4d39d836e8b076855cca +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse021.ftr +<;> +<:fnm parse021.ftr> +<LE>fnm parse021.ftr</LE> +<II> +<md5>5b8f927e886e4d39d836e8b076855cca +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse021.ftr +<;> +<:md5 9f8620ebe18a4611f539bf13408c21a3> +<LE>md5 9f8620ebe18a4611f539bf13408c21a3</LE> +<II> +<md5>9f8620ebe18a4611f539bf13408c21a3 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse022.ftr +<;> +<:fnm parse022.ftr> +<LE>fnm parse022.ftr</LE> +<II> +<md5>9f8620ebe18a4611f539bf13408c21a3 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>parse022.ftr +<;> +<:md5 e3b4583b3c9f715ec1b7d98757615652> +<LE>md5 e3b4583b3c9f715ec1b7d98757615652</LE> +<II> +<md5>e3b4583b3c9f715ec1b7d98757615652 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>possig.ftr +<;> +<:fnm possig.ftr> +<LE>fnm possig.ftr</LE> +<II> +<md5>e3b4583b3c9f715ec1b7d98757615652 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>possig.ftr +<;> +<:md5 407a1451c371ab520f020e3793f2e90c> +<LE>md5 407a1451c371ab520f020e3793f2e90c</LE> +<II> +<md5>407a1451c371ab520f020e3793f2e90c +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>pt.ftr +<;> +<:fnm pt.ftr> +<LE>fnm pt.ftr</LE> +<II> +<md5>407a1451c371ab520f020e3793f2e90c +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>pt.ftr +<;> +<:md5 76027db3e48126cde323ce746efe689e> +<LE>md5 76027db3e48126cde323ce746efe689e</LE> +<II> +<md5>76027db3e48126cde323ce746efe689e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>test1.ftr +<;> +<:fnm test1.ftr> +<LE>fnm test1.ftr</LE> +<II> +<md5>76027db3e48126cde323ce746efe689e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>test1.ftr +<;> +<:md5 10d2a0eda08fc34c0e78018be1df8e94> +<LE>md5 10d2a0eda08fc34c0e78018be1df8e94</LE> +<II> +<md5>10d2a0eda08fc34c0e78018be1df8e94 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>test2.ftr +<;> +<:fnm test2.ftr> +<LE>fnm test2.ftr</LE> +<II> +<md5>10d2a0eda08fc34c0e78018be1df8e94 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>test2.ftr +<;> +<:md5 830c88d2fe1b26c14d9138e44070f7ad> +<LE>md5 830c88d2fe1b26c14d9138e44070f7ad</LE> +<II> +<md5>830c88d2fe1b26c14d9138e44070f7ad +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>tst1.ftr +<;> +<:fnm tst1.ftr> +<LE>fnm tst1.ftr</LE> +<II> +<md5>830c88d2fe1b26c14d9138e44070f7ad +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>tst1.ftr +<;> +<:md5 91708b42cb22d1d1ccad7564651edcc0> +<LE>md5 91708b42cb22d1d1ccad7564651edcc0</LE> +<II> +<md5>91708b42cb22d1d1ccad7564651edcc0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>tst2.ftr +<;> +<:fnm tst2.ftr> +<LE>fnm tst2.ftr</LE> +<II> +<md5>91708b42cb22d1d1ccad7564651edcc0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>tst2.ftr +<;> +<:md5 9736f1a6b6db910bae73ecada375c9bd> +<LE>md5 9736f1a6b6db910bae73ecada375c9bd</LE> +<II> +<md5>9736f1a6b6db910bae73ecada375c9bd +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>xx.ftr +<;> +<:fnm xx.ftr> +<LE>fnm xx.ftr</LE> +<II> +<md5>9736f1a6b6db910bae73ecada375c9bd +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/_bak_ftr.ned +<fnm>xx.ftr +<;> +<:md5 10cabc7bd0fcab1ffce2cead7134cbfb> +<LE>md5 10cabc7bd0fcab1ffce2cead7134cbfb</LE> +<II> +<md5>10cabc7bd0fcab1ffce2cead7134cbfb +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>alexicon.hyx +<;> +<:fnm alexicon.hyx> +<LE>fnm alexicon.hyx</LE> +<II> +<md5>10cabc7bd0fcab1ffce2cead7134cbfb +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>alexicon.hyx +<;> +<:md5 c9eabc39b163c5260be043c289c8a0fc> +<LE>md5 c9eabc39b163c5260be043c289c8a0fc</LE> +<II> +<md5>c9eabc39b163c5260be043c289c8a0fc +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>alexicon.idx +<;> +<:fnm alexicon.idx> +<LE>fnm alexicon.idx</LE> +<II> +<md5>c9eabc39b163c5260be043c289c8a0fc +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>alexicon.idx +<;> +<:fnm alexicon.lut> +<LE>fnm alexicon.lut</LE> +<II> +<md5>c36572de7beac94fd2f9418bd3b1dd78 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>alexicon.lut +<;> +<:md5 25c3e0240a733ed978f1c91d3ec327a1> +<LE>md5 25c3e0240a733ed978f1c91d3ec327a1</LE> +<II> +<md5>25c3e0240a733ed978f1c91d3ec327a1 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0001.c +<;> +<:fnm dict0001.c> +<LE>fnm dict0001.c</LE> +<II> +<md5>25c3e0240a733ed978f1c91d3ec327a1 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0001.c +<;> +<:md5 7df42a0c59645a7124a625a7ca0c5671> +<LE>md5 7df42a0c59645a7124a625a7ca0c5671</LE> +<II> +<md5>7df42a0c59645a7124a625a7ca0c5671 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0001.o +<;> +<:fnm dict0001.o> +<LE>fnm dict0001.o</LE> +<II> +<md5>7df42a0c59645a7124a625a7ca0c5671 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0001.o +<;> +<:md5 b88c018fc122c70e2b108a685e8bc129> +<LE>md5 b88c018fc122c70e2b108a685e8bc129</LE> +<II> +<md5>b88c018fc122c70e2b108a685e8bc129 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0002.c +<;> +<:fnm dict0002.c> +<LE>fnm dict0002.c</LE> +<II> +<md5>b88c018fc122c70e2b108a685e8bc129 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0002.c +<;> +<:md5 7ca981048c0d6793d74507ed56042c62> +<LE>md5 7ca981048c0d6793d74507ed56042c62</LE> +<II> +<md5>7ca981048c0d6793d74507ed56042c62 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0002.o +<;> +<:fnm dict0002.o> +<LE>fnm dict0002.o</LE> +<II> +<md5>7ca981048c0d6793d74507ed56042c62 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0002.o +<;> +<:md5 2c65dc29b902325279f9c433c646e5b2> +<LE>md5 2c65dc29b902325279f9c433c646e5b2</LE> +<II> +<md5>2c65dc29b902325279f9c433c646e5b2 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0003.c +<;> +<:fnm dict0003.c> +<LE>fnm dict0003.c</LE> +<II> +<md5>2c65dc29b902325279f9c433c646e5b2 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0003.c +<;> +<:md5 3ee2bd0f5d260a6191fdc6d8f44b1403> +<LE>md5 3ee2bd0f5d260a6191fdc6d8f44b1403</LE> +<II> +<md5>3ee2bd0f5d260a6191fdc6d8f44b1403 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0003.o +<;> +<:fnm dict0003.o> +<LE>fnm dict0003.o</LE> +<II> +<md5>3ee2bd0f5d260a6191fdc6d8f44b1403 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0003.o +<;> +<:md5 77ecfb8b1afea9cfd2aacd1f31e288c3> +<LE>md5 77ecfb8b1afea9cfd2aacd1f31e288c3</LE> +<II> +<md5>77ecfb8b1afea9cfd2aacd1f31e288c3 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0004.c +<;> +<:fnm dict0004.c> +<LE>fnm dict0004.c</LE> +<II> +<md5>77ecfb8b1afea9cfd2aacd1f31e288c3 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0004.c +<;> +<:md5 2a04dd2a8c7566eb63af2697eceefa47> +<LE>md5 2a04dd2a8c7566eb63af2697eceefa47</LE> +<II> +<md5>2a04dd2a8c7566eb63af2697eceefa47 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0004.o +<;> +<:fnm dict0004.o> +<LE>fnm dict0004.o</LE> +<II> +<md5>2a04dd2a8c7566eb63af2697eceefa47 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0004.o +<;> +<:md5 a8f1483975c942ba364a25df720a71ad> +<LE>md5 a8f1483975c942ba364a25df720a71ad</LE> +<II> +<md5>a8f1483975c942ba364a25df720a71ad +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0005.c +<;> +<:fnm dict0005.c> +<LE>fnm dict0005.c</LE> +<II> +<md5>a8f1483975c942ba364a25df720a71ad +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0005.c +<;> +<:md5 141085a9f8059d75f7cf67cbc7f05ca9> +<LE>md5 141085a9f8059d75f7cf67cbc7f05ca9</LE> +<II> +<md5>141085a9f8059d75f7cf67cbc7f05ca9 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0005.o +<;> +<:fnm dict0005.o> +<LE>fnm dict0005.o</LE> +<II> +<md5>141085a9f8059d75f7cf67cbc7f05ca9 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0005.o +<;> +<:md5 fc432e07680f7e1893aa869866836cf8> +<LE>md5 fc432e07680f7e1893aa869866836cf8</LE> +<II> +<md5>fc432e07680f7e1893aa869866836cf8 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0006.c +<;> +<:fnm dict0006.c> +<LE>fnm dict0006.c</LE> +<II> +<md5>fc432e07680f7e1893aa869866836cf8 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0006.c +<;> +<:md5 cb92ba6b02e37e2f65e0b8470685db41> +<LE>md5 cb92ba6b02e37e2f65e0b8470685db41</LE> +<II> +<md5>cb92ba6b02e37e2f65e0b8470685db41 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0006.o +<;> +<:fnm dict0006.o> +<LE>fnm dict0006.o</LE> +<II> +<md5>cb92ba6b02e37e2f65e0b8470685db41 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0006.o +<;> +<:md5 1031776dead55fd0cb782fc15704c74a> +<LE>md5 1031776dead55fd0cb782fc15704c74a</LE> +<II> +<md5>1031776dead55fd0cb782fc15704c74a +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0007.c +<;> +<:fnm dict0007.c> +<LE>fnm dict0007.c</LE> +<II> +<md5>1031776dead55fd0cb782fc15704c74a +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0007.c +<;> +<:md5 4f3eb9f70d31ad6a17a5db32ec852671> +<LE>md5 4f3eb9f70d31ad6a17a5db32ec852671</LE> +<II> +<md5>4f3eb9f70d31ad6a17a5db32ec852671 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0007.o +<;> +<:fnm dict0007.o> +<LE>fnm dict0007.o</LE> +<II> +<md5>4f3eb9f70d31ad6a17a5db32ec852671 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0007.o +<;> +<:md5 696d087160b44eddd3b35bede17f6274> +<LE>md5 696d087160b44eddd3b35bede17f6274</LE> +<II> +<md5>696d087160b44eddd3b35bede17f6274 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0008.c +<;> +<:fnm dict0008.c> +<LE>fnm dict0008.c</LE> +<II> +<md5>696d087160b44eddd3b35bede17f6274 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0008.c +<;> +<:md5 e86c5c857a818c6ff51738810ec040e7> +<LE>md5 e86c5c857a818c6ff51738810ec040e7</LE> +<II> +<md5>e86c5c857a818c6ff51738810ec040e7 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0008.o +<;> +<:fnm dict0008.o> +<LE>fnm dict0008.o</LE> +<II> +<md5>e86c5c857a818c6ff51738810ec040e7 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0008.o +<;> +<:md5 be608c4c52b9f6f5fefbf026028fdb86> +<LE>md5 be608c4c52b9f6f5fefbf026028fdb86</LE> +<II> +<md5>be608c4c52b9f6f5fefbf026028fdb86 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0009.c +<;> +<:fnm dict0009.c> +<LE>fnm dict0009.c</LE> +<II> +<md5>be608c4c52b9f6f5fefbf026028fdb86 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0009.c +<;> +<:md5 5d951a8c969a60061c43e58660b0960f> +<LE>md5 5d951a8c969a60061c43e58660b0960f</LE> +<II> +<md5>5d951a8c969a60061c43e58660b0960f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0009.o +<;> +<:fnm dict0009.o> +<LE>fnm dict0009.o</LE> +<II> +<md5>5d951a8c969a60061c43e58660b0960f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0009.o +<;> +<:md5 f198ddeaa0204a34442c79f01d4eae73> +<LE>md5 f198ddeaa0204a34442c79f01d4eae73</LE> +<II> +<md5>f198ddeaa0204a34442c79f01d4eae73 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0010.c +<;> +<:fnm dict0010.c> +<LE>fnm dict0010.c</LE> +<II> +<md5>f198ddeaa0204a34442c79f01d4eae73 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0010.c +<;> +<:md5 fa876edf11789421ea02b07c24a7f5b0> +<LE>md5 fa876edf11789421ea02b07c24a7f5b0</LE> +<II> +<md5>fa876edf11789421ea02b07c24a7f5b0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0010.o +<;> +<:fnm dict0010.o> +<LE>fnm dict0010.o</LE> +<II> +<md5>fa876edf11789421ea02b07c24a7f5b0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0010.o +<;> +<:md5 11eef22874edbce6e3fc9d24713b1138> +<LE>md5 11eef22874edbce6e3fc9d24713b1138</LE> +<II> +<md5>11eef22874edbce6e3fc9d24713b1138 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0011.c +<;> +<:fnm dict0011.c> +<LE>fnm dict0011.c</LE> +<II> +<md5>11eef22874edbce6e3fc9d24713b1138 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0011.c +<;> +<:md5 99e6ca67ffc56595886088dd4b89b8ac> +<LE>md5 99e6ca67ffc56595886088dd4b89b8ac</LE> +<II> +<md5>99e6ca67ffc56595886088dd4b89b8ac +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0011.o +<;> +<:fnm dict0011.o> +<LE>fnm dict0011.o</LE> +<II> +<md5>99e6ca67ffc56595886088dd4b89b8ac +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0011.o +<;> +<:md5 904ab571bd338998fcfda55ff7ebb497> +<LE>md5 904ab571bd338998fcfda55ff7ebb497</LE> +<II> +<md5>904ab571bd338998fcfda55ff7ebb497 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0012.c +<;> +<:fnm dict0012.c> +<LE>fnm dict0012.c</LE> +<II> +<md5>904ab571bd338998fcfda55ff7ebb497 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0012.c +<;> +<:md5 a9de960f8f8318f0dddd5d2c7d5297c5> +<LE>md5 a9de960f8f8318f0dddd5d2c7d5297c5</LE> +<II> +<md5>a9de960f8f8318f0dddd5d2c7d5297c5 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0012.o +<;> +<:fnm dict0012.o> +<LE>fnm dict0012.o</LE> +<II> +<md5>a9de960f8f8318f0dddd5d2c7d5297c5 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0012.o +<;> +<:md5 c395d152be2c03eccff9fff6cda53acb> +<LE>md5 c395d152be2c03eccff9fff6cda53acb</LE> +<II> +<md5>c395d152be2c03eccff9fff6cda53acb +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0013.c +<;> +<:fnm dict0013.c> +<LE>fnm dict0013.c</LE> +<II> +<md5>c395d152be2c03eccff9fff6cda53acb +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0013.c +<;> +<:md5 959a0f6cea54800fe85cc7632b0f1a3a> +<LE>md5 959a0f6cea54800fe85cc7632b0f1a3a</LE> +<II> +<md5>959a0f6cea54800fe85cc7632b0f1a3a +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0013.o +<;> +<:fnm dict0013.o> +<LE>fnm dict0013.o</LE> +<II> +<md5>959a0f6cea54800fe85cc7632b0f1a3a +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0013.o +<;> +<:md5 0cfc95102bd53babe351be227a3a2d77> +<LE>md5 0cfc95102bd53babe351be227a3a2d77</LE> +<II> +<md5>0cfc95102bd53babe351be227a3a2d77 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0014.c +<;> +<:fnm dict0014.c> +<LE>fnm dict0014.c</LE> +<II> +<md5>0cfc95102bd53babe351be227a3a2d77 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0014.c +<;> +<:md5 d0b1d3b70f9becba64c4175f0d5f3c9d> +<LE>md5 d0b1d3b70f9becba64c4175f0d5f3c9d</LE> +<II> +<md5>d0b1d3b70f9becba64c4175f0d5f3c9d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0014.o +<;> +<:fnm dict0014.o> +<LE>fnm dict0014.o</LE> +<II> +<md5>d0b1d3b70f9becba64c4175f0d5f3c9d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0014.o +<;> +<:md5 de31b64d234ebd4282fd0880ecd6d1cd> +<LE>md5 de31b64d234ebd4282fd0880ecd6d1cd</LE> +<II> +<md5>de31b64d234ebd4282fd0880ecd6d1cd +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0015.c +<;> +<:fnm dict0015.c> +<LE>fnm dict0015.c</LE> +<II> +<md5>de31b64d234ebd4282fd0880ecd6d1cd +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0015.c +<;> +<:md5 da9dbfee1ca19bb65fb3520dd535eb54> +<LE>md5 da9dbfee1ca19bb65fb3520dd535eb54</LE> +<II> +<md5>da9dbfee1ca19bb65fb3520dd535eb54 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0015.o +<;> +<:fnm dict0015.o> +<LE>fnm dict0015.o</LE> +<II> +<md5>da9dbfee1ca19bb65fb3520dd535eb54 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0015.o +<;> +<:md5 ccec9826c46ebac07b5953104da37f3b> +<LE>md5 ccec9826c46ebac07b5953104da37f3b</LE> +<II> +<md5>ccec9826c46ebac07b5953104da37f3b +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0016.c +<;> +<:fnm dict0016.c> +<LE>fnm dict0016.c</LE> +<II> +<md5>ccec9826c46ebac07b5953104da37f3b +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0016.c +<;> +<:md5 3bf112ed9c7b07845d4a284af909789b> +<LE>md5 3bf112ed9c7b07845d4a284af909789b</LE> +<II> +<md5>3bf112ed9c7b07845d4a284af909789b +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0016.o +<;> +<:fnm dict0016.o> +<LE>fnm dict0016.o</LE> +<II> +<md5>3bf112ed9c7b07845d4a284af909789b +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0016.o +<;> +<:md5 edbb96a221be6d0c30ecceec51967936> +<LE>md5 edbb96a221be6d0c30ecceec51967936</LE> +<II> +<md5>edbb96a221be6d0c30ecceec51967936 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0018.c +<;> +<:fnm dict0018.c> +<LE>fnm dict0018.c</LE> +<II> +<md5>edbb96a221be6d0c30ecceec51967936 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0018.c +<;> +<:md5 8a0fe0414dfeda35e15ed312fb0269c6> +<LE>md5 8a0fe0414dfeda35e15ed312fb0269c6</LE> +<II> +<md5>8a0fe0414dfeda35e15ed312fb0269c6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0018.o +<;> +<:fnm dict0018.o> +<LE>fnm dict0018.o</LE> +<II> +<md5>8a0fe0414dfeda35e15ed312fb0269c6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dict0018.o +<;> +<:md5 c613a5d6f1b95d2594ad4b06c67d93be> +<LE>md5 c613a5d6f1b95d2594ad4b06c67d93be</LE> +<II> +<md5>c613a5d6f1b95d2594ad4b06c67d93be +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd +<;> +<:fnm dictadd> +<LE>fnm dictadd</LE> +<II> +<md5>c613a5d6f1b95d2594ad4b06c67d93be +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd +<;> +<:md5 32b584ea223a015f2e0d153f682d5aea> +<LE>md5 32b584ea223a015f2e0d153f682d5aea</LE> +<II> +<md5>32b584ea223a015f2e0d153f682d5aea +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd.c +<;> +<:fnm dictadd.c> +<LE>fnm dictadd.c</LE> +<II> +<md5>32b584ea223a015f2e0d153f682d5aea +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd.c +<;> +<:md5 b7e18637dea58e84bc414e6ee88e13fc> +<LE>md5 b7e18637dea58e84bc414e6ee88e13fc</LE> +<II> +<md5>b7e18637dea58e84bc414e6ee88e13fc +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd.o +<;> +<:fnm dictadd.o> +<LE>fnm dictadd.o</LE> +<II> +<md5>b7e18637dea58e84bc414e6ee88e13fc +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd.o +<;> +<:md5 726d54770219ddb165f26cae0cd979f3> +<LE>md5 726d54770219ddb165f26cae0cd979f3</LE> +<II> +<md5>726d54770219ddb165f26cae0cd979f3 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd1.c +<;> +<:fnm dictadd1.c> +<LE>fnm dictadd1.c</LE> +<II> +<md5>726d54770219ddb165f26cae0cd979f3 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd1.c +<;> +<:md5 e4ce273194fec8e27856fb4b773a99e3> +<LE>md5 e4ce273194fec8e27856fb4b773a99e3</LE> +<II> +<md5>e4ce273194fec8e27856fb4b773a99e3 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd1.o +<;> +<:fnm dictadd1.o> +<LE>fnm dictadd1.o</LE> +<II> +<md5>e4ce273194fec8e27856fb4b773a99e3 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd1.o +<;> +<:md5 dda2ac67474da3ff08c141f7c995f593> +<LE>md5 dda2ac67474da3ff08c141f7c995f593</LE> +<II> +<md5>dda2ac67474da3ff08c141f7c995f593 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd2.c +<;> +<:fnm dictadd2.c> +<LE>fnm dictadd2.c</LE> +<II> +<md5>dda2ac67474da3ff08c141f7c995f593 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd2.c +<;> +<:md5 6bcbbda3a4e09574cc2f80554140e14e> +<LE>md5 6bcbbda3a4e09574cc2f80554140e14e</LE> +<II> +<md5>6bcbbda3a4e09574cc2f80554140e14e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd2.o +<;> +<:fnm dictadd2.o> +<LE>fnm dictadd2.o</LE> +<II> +<md5>6bcbbda3a4e09574cc2f80554140e14e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd2.o +<;> +<:md5 0528b4e55c6dfea8d56f568464250b55> +<LE>md5 0528b4e55c6dfea8d56f568464250b55</LE> +<II> +<md5>0528b4e55c6dfea8d56f568464250b55 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd3.c +<;> +<:fnm dictadd3.c> +<LE>fnm dictadd3.c</LE> +<II> +<md5>0528b4e55c6dfea8d56f568464250b55 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd3.c +<;> +<:md5 626d206d09e83ab32883f943d4fd2720> +<LE>md5 626d206d09e83ab32883f943d4fd2720</LE> +<II> +<md5>626d206d09e83ab32883f943d4fd2720 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd3.o +<;> +<:fnm dictadd3.o> +<LE>fnm dictadd3.o</LE> +<II> +<md5>626d206d09e83ab32883f943d4fd2720 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd3.o +<;> +<:md5 12235ad28abdf31a687185689bb766f6> +<LE>md5 12235ad28abdf31a687185689bb766f6</LE> +<II> +<md5>12235ad28abdf31a687185689bb766f6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd4.c +<;> +<:fnm dictadd4.c> +<LE>fnm dictadd4.c</LE> +<II> +<md5>12235ad28abdf31a687185689bb766f6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd4.c +<;> +<:md5 0b04aa92c35f185c9847a88fbf6f3edd> +<LE>md5 0b04aa92c35f185c9847a88fbf6f3edd</LE> +<II> +<md5>0b04aa92c35f185c9847a88fbf6f3edd +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd4.o +<;> +<:fnm dictadd4.o> +<LE>fnm dictadd4.o</LE> +<II> +<md5>0b04aa92c35f185c9847a88fbf6f3edd +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd4.o +<;> +<:md5 8fb53fd042307604fedb1abf7d5d44c3> +<LE>md5 8fb53fd042307604fedb1abf7d5d44c3</LE> +<II> +<md5>8fb53fd042307604fedb1abf7d5d44c3 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd6.c +<;> +<:fnm dictadd6.c> +<LE>fnm dictadd6.c</LE> +<II> +<md5>8fb53fd042307604fedb1abf7d5d44c3 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd6.c +<;> +<:md5 57a731fe921925dc2c9ab353a383b7b4> +<LE>md5 57a731fe921925dc2c9ab353a383b7b4</LE> +<II> +<md5>57a731fe921925dc2c9ab353a383b7b4 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd6.o +<;> +<:fnm dictadd6.o> +<LE>fnm dictadd6.o</LE> +<II> +<md5>57a731fe921925dc2c9ab353a383b7b4 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd6.o +<;> +<:md5 6eb434a3bf55fd19dff044dc4d753432> +<LE>md5 6eb434a3bf55fd19dff044dc4d753432</LE> +<II> +<md5>6eb434a3bf55fd19dff044dc4d753432 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd8.c +<;> +<:fnm dictadd8.c> +<LE>fnm dictadd8.c</LE> +<II> +<md5>6eb434a3bf55fd19dff044dc4d753432 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd8.c +<;> +<:md5 3fb941df9e5df46f52bf05fc9a93a756> +<LE>md5 3fb941df9e5df46f52bf05fc9a93a756</LE> +<II> +<md5>3fb941df9e5df46f52bf05fc9a93a756 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd8.o +<;> +<:fnm dictadd8.o> +<LE>fnm dictadd8.o</LE> +<II> +<md5>3fb941df9e5df46f52bf05fc9a93a756 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd8.o +<;> +<:md5 2d7b45a056c373fd7794b92b05a15dd0> +<LE>md5 2d7b45a056c373fd7794b92b05a15dd0</LE> +<II> +<md5>2d7b45a056c373fd7794b92b05a15dd0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd9.c +<;> +<:fnm dictadd9.c> +<LE>fnm dictadd9.c</LE> +<II> +<md5>2d7b45a056c373fd7794b92b05a15dd0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd9.c +<;> +<:md5 dc8047fa7099fd950397915902b3c097> +<LE>md5 dc8047fa7099fd950397915902b3c097</LE> +<II> +<md5>dc8047fa7099fd950397915902b3c097 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd9.o +<;> +<:fnm dictadd9.o> +<LE>fnm dictadd9.o</LE> +<II> +<md5>dc8047fa7099fd950397915902b3c097 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictadd9.o +<;> +<:md5 f9b2c351f258942633cc1540a536b794> +<LE>md5 f9b2c351f258942633cc1540a536b794</LE> +<II> +<md5>f9b2c351f258942633cc1540a536b794 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictmod +<;> +<:fnm dictmod> +<LE>fnm dictmod</LE> +<II> +<md5>f9b2c351f258942633cc1540a536b794 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictmod +<;> +<:md5 72376830988bb71625eff6e025a10710> +<LE>md5 72376830988bb71625eff6e025a10710</LE> +<II> +<md5>72376830988bb71625eff6e025a10710 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictmod.c +<;> +<:fnm dictmod.c> +<LE>fnm dictmod.c</LE> +<II> +<md5>72376830988bb71625eff6e025a10710 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictmod.c +<;> +<:md5 6ef55195d6f4d44b73d27674057f5c19> +<LE>md5 6ef55195d6f4d44b73d27674057f5c19</LE> +<II> +<md5>6ef55195d6f4d44b73d27674057f5c19 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictmod.o +<;> +<:fnm dictmod.o> +<LE>fnm dictmod.o</LE> +<II> +<md5>6ef55195d6f4d44b73d27674057f5c19 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>dictmod.o +<;> +<:md5 0abcc5f96310398f31a9ddb0cc0bd996> +<LE>md5 0abcc5f96310398f31a9ddb0cc0bd996</LE> +<II> +<md5>0abcc5f96310398f31a9ddb0cc0bd996 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>grtag.pl +<;> +<:fnm grtag.pl> +<LE>fnm grtag.pl</LE> +<II> +<md5>0abcc5f96310398f31a9ddb0cc0bd996 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>grtag.pl +<;> +<:md5 18a20dde925ef6589cbac1f329fb7961> +<LE>md5 18a20dde925ef6589cbac1f329fb7961</LE> +<II> +<md5>18a20dde925ef6589cbac1f329fb7961 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>http4lex.pl +<;> +<:fnm http4lex.pl> +<LE>fnm http4lex.pl</LE> +<II> +<md5>18a20dde925ef6589cbac1f329fb7961 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>http4lex.pl +<;> +<:md5 9d6ce0fc4b5739b58b5a8ee266602ad4> +<LE>md5 9d6ce0fc4b5739b58b5a8ee266602ad4</LE> +<II> +<md5>9d6ce0fc4b5739b58b5a8ee266602ad4 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lex.c +<;> +<:fnm lex.c> +<LE>fnm lex.c</LE> +<II> +<md5>9d6ce0fc4b5739b58b5a8ee266602ad4 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lex.c +<;> +<:md5 1d429a50e9900525dcdff198769c0a10> +<LE>md5 1d429a50e9900525dcdff198769c0a10</LE> +<II> +<md5>1d429a50e9900525dcdff198769c0a10 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lex00001.c +<;> +<:fnm lex00001.c> +<LE>fnm lex00001.c</LE> +<II> +<md5>1d429a50e9900525dcdff198769c0a10 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lex00001.c +<;> +<:md5 f9aeade4ae7fd265e3f01809b3dd30e5> +<LE>md5 f9aeade4ae7fd265e3f01809b3dd30e5</LE> +<II> +<md5>f9aeade4ae7fd265e3f01809b3dd30e5 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lexpr001.c +<;> +<:fnm lexpr001.c> +<LE>fnm lexpr001.c</LE> +<II> +<md5>f9aeade4ae7fd265e3f01809b3dd30e5 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lexpr001.c +<;> +<:md5 4104dc8b6324b46a0bdf840c084ff27d> +<LE>md5 4104dc8b6324b46a0bdf840c084ff27d</LE> +<II> +<md5>4104dc8b6324b46a0bdf840c084ff27d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lexpr001.o +<;> +<:fnm lexpr001.o> +<LE>fnm lexpr001.o</LE> +<II> +<md5>4104dc8b6324b46a0bdf840c084ff27d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lexpr001.o +<;> +<:md5 838192fa57aba272a40892ceff9c0820> +<LE>md5 838192fa57aba272a40892ceff9c0820</LE> +<II> +<md5>838192fa57aba272a40892ceff9c0820 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lexproc.h +<;> +<:fnm lexproc.h> +<LE>fnm lexproc.h</LE> +<II> +<md5>838192fa57aba272a40892ceff9c0820 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lexproc.h +<;> +<:md5 6dd47b55d356e0abf60c6bbe16dba50d> +<LE>md5 6dd47b55d356e0abf60c6bbe16dba50d</LE> +<II> +<md5>6dd47b55d356e0abf60c6bbe16dba50d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lexut001.c +<;> +<:fnm lexut001.c> +<LE>fnm lexut001.c</LE> +<II> +<md5>6dd47b55d356e0abf60c6bbe16dba50d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lexut001.c +<;> +<:md5 c4e4c6e93165ecae0d2314ea2ccd7eb6> +<LE>md5 c4e4c6e93165ecae0d2314ea2ccd7eb6</LE> +<II> +<md5>c4e4c6e93165ecae0d2314ea2ccd7eb6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lexut001.o +<;> +<:fnm lexut001.o> +<LE>fnm lexut001.o</LE> +<II> +<md5>c4e4c6e93165ecae0d2314ea2ccd7eb6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lexut001.o +<;> +<:md5 d41d8cd98f00b204e9800998ecf8427e> +<LE>md5 d41d8cd98f00b204e9800998ecf8427e</LE> +<II> +<md5>d41d8cd98f00b204e9800998ecf8427e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lib +<;> +<:fnm lib> +<LE>fnm lib</LE> +<II> +<md5>d41d8cd98f00b204e9800998ecf8427e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>lib +<;> +<:md5 744ba024486b9d7ee9319bc3eb51db3e> +<LE>md5 744ba024486b9d7ee9319bc3eb51db3e</LE> +<II> +<md5>744ba024486b9d7ee9319bc3eb51db3e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>make-dos +<;> +<:fnm make-dos> +<LE>fnm make-dos</LE> +<II> +<md5>744ba024486b9d7ee9319bc3eb51db3e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>make-dos +<;> +<:md5 48c625d9d5228a47171aff22c2381ffa> +<LE>md5 48c625d9d5228a47171aff22c2381ffa</LE> +<II> +<md5>48c625d9d5228a47171aff22c2381ffa +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>makeshar.lst +<;> +<:fnm makeshar.lst> +<LE>fnm makeshar.lst</LE> +<II> +<md5>48c625d9d5228a47171aff22c2381ffa +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>makeshar.lst +<;> +<:md5 3c6a4fa828ff948020f5dda79b4f4efc> +<LE>md5 3c6a4fa828ff948020f5dda79b4f4efc</LE> +<II> +<md5>3c6a4fa828ff948020f5dda79b4f4efc +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parsd008.o +<;> +<:fnm parsd008.o> +<LE>fnm parsd008.o</LE> +<II> +<md5>3c6a4fa828ff948020f5dda79b4f4efc +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parsd008.o +<;> +<:md5 67dd182f3a28e7a4f76576120aedb417> +<LE>md5 67dd182f3a28e7a4f76576120aedb417</LE> +<II> +<md5>67dd182f3a28e7a4f76576120aedb417 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parsd016.o +<;> +<:fnm parsd016.o> +<LE>fnm parsd016.o</LE> +<II> +<md5>67dd182f3a28e7a4f76576120aedb417 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parsd016.o +<;> +<:md5 fdbc1444920f04e5d72c40710a76696d> +<LE>md5 fdbc1444920f04e5d72c40710a76696d</LE> +<II> +<md5>fdbc1444920f04e5d72c40710a76696d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse007.c +<;> +<:fnm parse007.c> +<LE>fnm parse007.c</LE> +<II> +<md5>fdbc1444920f04e5d72c40710a76696d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse007.c +<;> +<:md5 d9a771086d3895297480b6e9e87bacca> +<LE>md5 d9a771086d3895297480b6e9e87bacca</LE> +<II> +<md5>d9a771086d3895297480b6e9e87bacca +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse007.o +<;> +<:fnm parse007.o> +<LE>fnm parse007.o</LE> +<II> +<md5>d9a771086d3895297480b6e9e87bacca +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse007.o +<;> +<:md5 6b4dcc218c5b4be614ca6e520a7939ea> +<LE>md5 6b4dcc218c5b4be614ca6e520a7939ea</LE> +<II> +<md5>6b4dcc218c5b4be614ca6e520a7939ea +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse008.c +<;> +<:fnm parse008.c> +<LE>fnm parse008.c</LE> +<II> +<md5>6b4dcc218c5b4be614ca6e520a7939ea +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse008.c +<;> +<:md5 c360fb88bd9ec65ab3c54f2b0cccbaf8> +<LE>md5 c360fb88bd9ec65ab3c54f2b0cccbaf8</LE> +<II> +<md5>c360fb88bd9ec65ab3c54f2b0cccbaf8 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse008.o +<;> +<:fnm parse008.o> +<LE>fnm parse008.o</LE> +<II> +<md5>c360fb88bd9ec65ab3c54f2b0cccbaf8 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse008.o +<;> +<:md5 3666227eb0822560af2a2d4d68ca20e2> +<LE>md5 3666227eb0822560af2a2d4d68ca20e2</LE> +<II> +<md5>3666227eb0822560af2a2d4d68ca20e2 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse014.c +<;> +<:fnm parse014.c> +<LE>fnm parse014.c</LE> +<II> +<md5>3666227eb0822560af2a2d4d68ca20e2 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse014.c +<;> +<:md5 a0b26f62c915af7123503fe53e324e9f> +<LE>md5 a0b26f62c915af7123503fe53e324e9f</LE> +<II> +<md5>a0b26f62c915af7123503fe53e324e9f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse014.o +<;> +<:fnm parse014.o> +<LE>fnm parse014.o</LE> +<II> +<md5>a0b26f62c915af7123503fe53e324e9f +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse014.o +<;> +<:md5 07b51d758bfee6aaac02e114fcbd7c52> +<LE>md5 07b51d758bfee6aaac02e114fcbd7c52</LE> +<II> +<md5>07b51d758bfee6aaac02e114fcbd7c52 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse015.c +<;> +<:fnm parse015.c> +<LE>fnm parse015.c</LE> +<II> +<md5>07b51d758bfee6aaac02e114fcbd7c52 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse015.c +<;> +<:md5 df26045c123b75dbba3e90616b61e6f0> +<LE>md5 df26045c123b75dbba3e90616b61e6f0</LE> +<II> +<md5>df26045c123b75dbba3e90616b61e6f0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse016.c +<;> +<:fnm parse016.c> +<LE>fnm parse016.c</LE> +<II> +<md5>df26045c123b75dbba3e90616b61e6f0 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse016.c +<;> +<:md5 e285338524c27fbcd730082b9f20e2c2> +<LE>md5 e285338524c27fbcd730082b9f20e2c2</LE> +<II> +<md5>e285338524c27fbcd730082b9f20e2c2 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse016.o +<;> +<:fnm parse016.o> +<LE>fnm parse016.o</LE> +<II> +<md5>e285338524c27fbcd730082b9f20e2c2 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse016.o +<;> +<:md5 83ba6b9be085d8710d8cb13989104301> +<LE>md5 83ba6b9be085d8710d8cb13989104301</LE> +<II> +<md5>83ba6b9be085d8710d8cb13989104301 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse017.c +<;> +<:fnm parse017.c> +<LE>fnm parse017.c</LE> +<II> +<md5>83ba6b9be085d8710d8cb13989104301 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse017.c +<;> +<:md5 d29ed7bcb68671c7aa661e79324f0db9> +<LE>md5 d29ed7bcb68671c7aa661e79324f0db9</LE> +<II> +<md5>d29ed7bcb68671c7aa661e79324f0db9 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse017.o +<;> +<:fnm parse017.o> +<LE>fnm parse017.o</LE> +<II> +<md5>d29ed7bcb68671c7aa661e79324f0db9 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse017.o +<;> +<:md5 30c22988db7c578aeca03a3954f88977> +<LE>md5 30c22988db7c578aeca03a3954f88977</LE> +<II> +<md5>30c22988db7c578aeca03a3954f88977 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse019.c +<;> +<:fnm parse019.c> +<LE>fnm parse019.c</LE> +<II> +<md5>30c22988db7c578aeca03a3954f88977 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse019.c +<;> +<:md5 92caf57b6661d6dd18b12ddb54fe58de> +<LE>md5 92caf57b6661d6dd18b12ddb54fe58de</LE> +<II> +<md5>92caf57b6661d6dd18b12ddb54fe58de +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse019.o +<;> +<:fnm parse019.o> +<LE>fnm parse019.o</LE> +<II> +<md5>92caf57b6661d6dd18b12ddb54fe58de +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse019.o +<;> +<:md5 38a19233e8bba91a013ad6ad358a821d> +<LE>md5 38a19233e8bba91a013ad6ad358a821d</LE> +<II> +<md5>38a19233e8bba91a013ad6ad358a821d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse021.c +<;> +<:fnm parse021.c> +<LE>fnm parse021.c</LE> +<II> +<md5>38a19233e8bba91a013ad6ad358a821d +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse021.c +<;> +<:md5 cd975af9128097830a1b544da14f2a19> +<LE>md5 cd975af9128097830a1b544da14f2a19</LE> +<II> +<md5>cd975af9128097830a1b544da14f2a19 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse021.o +<;> +<:fnm parse021.o> +<LE>fnm parse021.o</LE> +<II> +<md5>cd975af9128097830a1b544da14f2a19 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse021.o +<;> +<:md5 1a4be39dc8c202857141d2a869049d6a> +<LE>md5 1a4be39dc8c202857141d2a869049d6a</LE> +<II> +<md5>1a4be39dc8c202857141d2a869049d6a +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse022.c +<;> +<:fnm parse022.c> +<LE>fnm parse022.c</LE> +<II> +<md5>1a4be39dc8c202857141d2a869049d6a +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse022.c +<;> +<:md5 56909122432617f91a7e709f7dfd1ac6> +<LE>md5 56909122432617f91a7e709f7dfd1ac6</LE> +<II> +<md5>56909122432617f91a7e709f7dfd1ac6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse022.o +<;> +<:fnm parse022.o> +<LE>fnm parse022.o</LE> +<II> +<md5>56909122432617f91a7e709f7dfd1ac6 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>parse022.o +<;> +<:md5 b433f34332c05f0cb40c627b5edea2fb> +<LE>md5 b433f34332c05f0cb40c627b5edea2fb</LE> +<II> +<md5>b433f34332c05f0cb40c627b5edea2fb +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>possig.awk +<;> +<:fnm possig.awk> +<LE>fnm possig.awk</LE> +<II> +<md5>b433f34332c05f0cb40c627b5edea2fb +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>possig.awk +<;> +<:md5 f95886faeb329056c5a7371a6911c4de> +<LE>md5 f95886faeb329056c5a7371a6911c4de</LE> +<II> +<md5>f95886faeb329056c5a7371a6911c4de +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>pt +<;> +<:fnm pt> +<LE>fnm pt</LE> +<II> +<md5>f95886faeb329056c5a7371a6911c4de +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>pt +<;> +<:md5 e57af719a461af6ce8ec959afb201a37> +<LE>md5 e57af719a461af6ce8ec959afb201a37</LE> +<II> +<md5>e57af719a461af6ce8ec959afb201a37 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>pt.c +<;> +<:fnm pt.c> +<LE>fnm pt.c</LE> +<II> +<md5>e57af719a461af6ce8ec959afb201a37 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>pt.c +<;> +<:md5 091d0d78155e737b411e850db1f1f6e5> +<LE>md5 091d0d78155e737b411e850db1f1f6e5</LE> +<II> +<md5>091d0d78155e737b411e850db1f1f6e5 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>pt.o +<;> +<:fnm pt.o> +<LE>fnm pt.o</LE> +<II> +<md5>091d0d78155e737b411e850db1f1f6e5 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>pt.o +<;> +<:md5 1e7efa4d5c1264acb5f40034dc455ac1> +<LE>md5 1e7efa4d5c1264acb5f40034dc455ac1</LE> +<II> +<md5>1e7efa4d5c1264acb5f40034dc455ac1 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>test3a +<;> +<:fnm test3a> +<LE>fnm test3a</LE> +<II> +<md5>1e7efa4d5c1264acb5f40034dc455ac1 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>test3a +<;> +<:md5 cc4fb51e168a4d7950e583751d0b9494> +<LE>md5 cc4fb51e168a4d7950e583751d0b9494</LE> +<II> +<md5>cc4fb51e168a4d7950e583751d0b9494 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>test3b +<;> +<:fnm test3b> +<LE>fnm test3b</LE> +<II> +<md5>cc4fb51e168a4d7950e583751d0b9494 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>test3b +<;> +<:md5 3ebbeb571d1e9d8a354ad1fc77fbfb9a> +<LE>md5 3ebbeb571d1e9d8a354ad1fc77fbfb9a</LE> +<II> +<md5>3ebbeb571d1e9d8a354ad1fc77fbfb9a +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata/CVS +<fnm>Entries +<;> +<:md5 460e9ae96ee9730a1fbdaa128b456ab4> +<LE>md5 460e9ae96ee9730a1fbdaa128b456ab4</LE> +<II> +<md5>460e9ae96ee9730a1fbdaa128b456ab4 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata/CVS +<fnm>Repository +<;> +<:md5 5bd82f7acaf0923b7bb0d8022d29c6fc> +<LE>md5 5bd82f7acaf0923b7bb0d8022d29c6fc</LE> +<II> +<md5>5bd82f7acaf0923b7bb0d8022d29c6fc +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata +<fnm>test1.l +<;> +<:fnm test1.l> +<LE>fnm test1.l</LE> +<II> +<md5>5bd82f7acaf0923b7bb0d8022d29c6fc +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata +<fnm>test1.l +<;> +<:md5 f93900f14c00c2580ca2336095e75ff8> +<LE>md5 f93900f14c00c2580ca2336095e75ff8</LE> +<II> +<md5>f93900f14c00c2580ca2336095e75ff8 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata +<fnm>test2.l +<;> +<:fnm test2.l> +<LE>fnm test2.l</LE> +<II> +<md5>f93900f14c00c2580ca2336095e75ff8 +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata +<fnm>test2.l +<;> +<:md5 7e27d1d4ee1e8d9aec0d976ab5d0f20e> +<LE>md5 7e27d1d4ee1e8d9aec0d976ab5d0f20e</LE> +<II> +<md5>7e27d1d4ee1e8d9aec0d976ab5d0f20e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata +<fnm>x1.l +<;> +<:fnm x1.l> +<LE>fnm x1.l</LE> +<II> +<md5>7e27d1d4ee1e8d9aec0d976ab5d0f20e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata +<fnm>x1.l +<;> +<:md5 4590e24626f557f385f3f01d28c06a3a> +<LE>md5 4590e24626f557f385f3f01d28c06a3a</LE> +<II> +<md5>4590e24626f557f385f3f01d28c06a3a +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata +<fnm>x2a.l +<;> +<:fnm x2a.l> +<LE>fnm x2a.l</LE> +<II> +<md5>4590e24626f557f385f3f01d28c06a3a +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata +<fnm>x2a.l +<;> +<:md5 dfdfb1cf2484830bd83c8dcc577a84ef> +<LE>md5 dfdfb1cf2484830bd83c8dcc577a84ef</LE> +<II> +<md5>dfdfb1cf2484830bd83c8dcc577a84ef +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata +<fnm>x2b.l +<;> +<:fnm x2b.l> +<LE>fnm x2b.l</LE> +<II> +<md5>dfdfb1cf2484830bd83c8dcc577a84ef +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon/testdata +<fnm>x2b.l +<;> +<:md5 969cc90f7549f7faa3f74c7d7bd76bba> +<LE>md5 969cc90f7549f7faa3f74c7d7bd76bba</LE> +<II> +<md5>969cc90f7549f7faa3f74c7d7bd76bba +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>tst1 +<;> +<:fnm tst1> +<LE>fnm tst1</LE> +<II> +<md5>969cc90f7549f7faa3f74c7d7bd76bba +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>tst1 +<;> +<:md5 dbbb6c092d74f7fd2c67809fe837501c> +<LE>md5 dbbb6c092d74f7fd2c67809fe837501c</LE> +<II> +<md5>dbbb6c092d74f7fd2c67809fe837501c +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>tst1.c +<;> +<:fnm tst1.c> +<LE>fnm tst1.c</LE> +<II> +<md5>dbbb6c092d74f7fd2c67809fe837501c +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>tst1.c +<;> +<:md5 14aee66fefd27984a3c0f311ee527f4e> +<LE>md5 14aee66fefd27984a3c0f311ee527f4e</LE> +<II> +<md5>14aee66fefd27984a3c0f311ee527f4e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>tst2.c +<;> +<:fnm tst2.c> +<LE>fnm tst2.c</LE> +<II> +<md5>14aee66fefd27984a3c0f311ee527f4e +<path>/home/gonter/work/sf/hyx-tools/app/lexicon/home/gonter/work/sf/hyx-tools/app/lexicon +<fnm>tst2.c +<;> diff --git a/app/lexicon/alexicon.idx b/app/lexicon/alexicon.idx new file mode 100644 index 0000000000000000000000000000000000000000..5f9cb0c5e2ace7f62284fcc05d8cd9394a3f04f5 Binary files /dev/null and b/app/lexicon/alexicon.idx differ diff --git a/app/lexicon/alexicon.lut b/app/lexicon/alexicon.lut new file mode 100644 index 0000000000000000000000000000000000000000..641f5972a0934b8e9cb2ad508536ca2d903f98c2 Binary files /dev/null and b/app/lexicon/alexicon.lut differ diff --git a/app/lexicon/contrib b/app/lexicon/contrib new file mode 120000 index 0000000000000000000000000000000000000000..6021a51ea9120394be7d8ebb813d5b9b5d4e575c --- /dev/null +++ b/app/lexicon/contrib @@ -0,0 +1 @@ +../../lib/include/contrib \ No newline at end of file diff --git a/app/lexicon/dict0001.c b/app/lexicon/dict0001.c new file mode 100644 index 0000000000000000000000000000000000000000..0891539ef5693f657534b0ff921044edd63a51f3 --- /dev/null +++ b/app/lexicon/dict0001.c @@ -0,0 +1,35 @@ +/* + * FILE gg/app/lexicon/dict001.c + * + * written: 1994-07-24 + * latest update: 1999-11-28 13:08:31 + * + */ + +#include <string.h> +#include <gg/filename.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +char *get_divided_lexicon ( +char *base_name, +int divide_mode, +char *entry_key) +{ + int i; + int m; + char xfnm [24]; + + switch (divide_mode) + { + case DAMODE_DIVIDE1: m= 6; break; + case DAMODE_DIVIDE2: m= 7; break; + case DAMODE_DIVIDE3: m= 8; break; + default: return base_name; + } + + for (i= 0; i < 5; i++) xfnm [i]= base_name [i]; + for ( ; i < m; i++) xfnm [i]= *entry_key++; + for ( ; i < 8; i++) xfnm [i]= 'x'; + return fnmcpy2 (xfnm+i, ".hyx"); +} diff --git a/app/lexicon/dict0001.o b/app/lexicon/dict0001.o new file mode 100644 index 0000000000000000000000000000000000000000..964fbed0a5323fc590b73feef19a94d836ad4ea9 Binary files /dev/null and b/app/lexicon/dict0001.o differ diff --git a/app/lexicon/dict0002.c b/app/lexicon/dict0002.c new file mode 100644 index 0000000000000000000000000000000000000000..72644dec53ef20483a423c6ead49d9a180fa483e --- /dev/null +++ b/app/lexicon/dict0002.c @@ -0,0 +1,32 @@ +/* + * FILE %lexicon/dict0002.c + * + * written: 1994-07-29 + * latest update: 1999-05-08 10:41:57 + * $Id: dict0002.c,v 1.3 2001/02/19 00:27:16 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int dict_check_integrity (struct HYX_PARSER_CLASS *hpc) +{ + if ((hyx_find_tag_definition (hpc, "LE") == (struct TAG_DEFINITION *) 0 + &&hyx_make_tag_definition (hpc, "LE", 0x0201L, 0, 5000L, 2, "lexicon entry begin") + == (struct TAG_DEFINITION *) 0) + || (hyx_find_tag_definition (hpc, "/LE") == (struct TAG_DEFINITION *) 0 + &&hyx_make_tag_definition (hpc, "/LE", 0x0202L, 0, 5000L, 3, "lexicon entry end") + == (struct TAG_DEFINITION *) 0) + || (hyx_find_tag_definition (hpc, ":") == (struct TAG_DEFINITION *) 0 + &&hyx_make_tag_definition (hpc, ":", 0x0001L, 1, 10000L, 2, "frame begin") + == (struct TAG_DEFINITION *) 0) + || (hyx_find_tag_definition (hpc, ";") == (struct TAG_DEFINITION *) 0 + &&hyx_make_tag_definition (hpc, ";", 0x0002L, 1, 10000L, 3, "frame end") + == (struct TAG_DEFINITION *) 0)) + return -1; + + return 0; +} diff --git a/app/lexicon/dict0002.o b/app/lexicon/dict0002.o new file mode 100644 index 0000000000000000000000000000000000000000..6b2252a26536263dd36fd580db1aec135317fe9b Binary files /dev/null and b/app/lexicon/dict0002.o differ diff --git a/app/lexicon/dict0003.c b/app/lexicon/dict0003.c new file mode 100644 index 0000000000000000000000000000000000000000..e9ec6c5f53c81620cee71f2536a3df17a1e00c47 --- /dev/null +++ b/app/lexicon/dict0003.c @@ -0,0 +1,27 @@ +/* + * FILE ~/usr/lexicon/dict003.c + * + * written: 1994-07-29 + * latest update: 1995-08-19 + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int write_lexicon_frame ( +FILE *fhyx, /* file to write frame data to */ +char *frame_name, /* name used for the frame */ +struct TEXT_ELEMENT *lexicon_entry, /* lexicon data structure */ +int write_nl) +{ + if (lexicon_entry == (struct TEXT_ELEMENT *) 0) return -1; + + /* fprintf (fhyx, "<:LX%08lX>", frame_index); */ + fprintf (fhyx, "<:%s>", frame_name); + write_lexicon_text (fhyx, lexicon_entry, write_nl); + fprintf (fhyx, "\n<;>"); + + return 0; +} diff --git a/app/lexicon/dict0003.o b/app/lexicon/dict0003.o new file mode 100644 index 0000000000000000000000000000000000000000..44a90bb4c84b651bd21c5db560f78a57679b7777 Binary files /dev/null and b/app/lexicon/dict0003.o differ diff --git a/app/lexicon/dict0004.c b/app/lexicon/dict0004.c new file mode 100644 index 0000000000000000000000000000000000000000..57435bd017738c0db9998063e48f5189b9631cb0 --- /dev/null +++ b/app/lexicon/dict0004.c @@ -0,0 +1,173 @@ +/* + * FILE %lexicon/dict0004.c + * + * written: 1994-12-10: isolated from dictadd1.c + * latest update: 2000-08-26 15:16:48 + * $Id: dict0004.c,v 1.6 2004/05/08 15:40:34 gonter Exp $ + * + */ + +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/ytree.h> +#include <gg/hytxt.h> +#include <gg/parse.h> +#include <gg/lookup.h> +#include <gg/dpp.h> +#include <gg/sbr.h> + +extern int errno; +static int add_to_ytree (char *w, long idx, void *client_data); + +/* ------------------------------------------------------------------------ */ +static char entry_key [ENTRY_KEY_SIZE]; + +#define MAX_KILL 32 +static long kill_by_id [MAX_KILL]; +static int kill_by_id_cnt= 0; +static char *kill_by_lx [MAX_KILL]; +static int kill_by_lx_cnt= 0; + +/* ------------------------------------------------------------------------ */ +static int add_to_ytree (char *w, long idx, void *client_data) +{ + ytree_set_value ((struct YTREE **) client_data, + (unsigned char *) w, idx); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int dict_add_init (struct HYX_CLUSTER_CONTROL *hcc) +{ + FILE *f; + struct stat st; + int rc; + + if (hcc->HCC_dictadd1_inited) return 0; + + printf ("dict_add_init mode=%d\n", hcc->HCC_dict_mode); + + if (hcc->HCC_dict_mode != DAMODE_MERGE + && hcc->HCC_dict_mode != DAMODE_REPLACE) goto SKIP1; + + /* read kill file for entries to be killed by ID code */ + kill_by_id_cnt= fread_integer_table_file (hcc->HCC_fnm_kill_by_id, + kill_by_id, MAX_KILL, entry_key, ENTRY_KEY_SIZE); + + /* read kill file for entries to be killed by entry string */ + kill_by_lx_cnt= fread_string_table_file (hcc->HCC_fnm_kill_by_lx, + kill_by_lx, MAX_KILL, entry_key, ENTRY_KEY_SIZE); + + if (hcc->HCC_lut_mode == HCC_lm_full_write) + { /* Main LUT File einlesen */ + char *fnm_lut= hcc->HCC_fnm_lut; + printf ("dict0004: scanning LUT %s ...", fnm_lut); + +#define x_DOES_NOT_WORK +#ifdef DOES_NOT_WORK + if ((f= fopen (fnm_lut, "rb")) != (FILE *) 0) + { +/********* +printf ( +"ytree_full_scan (f, &hcc->HCC_ytree, %d, kill_by_id, %d, kill_by_lx);\n", +kill_by_id_cnt, kill_by_lx_cnt); +*********/ + +/**** + ytree_full_scan (f, &hcc->HCC_ytree, + kill_by_id, kill_by_id_cnt, + kill_by_lx, kill_by_lx_cnt); +****/ + +/*****/ + ytree_scan (f, &hcc->HCC_ytree); +/*****/ + + /*** lut_scan_file (f, &hcc->HCC_ytree, 0L); ****/ + fclose (f); + } +#else + hcc->HCC_ytree= lut_scan_ytree (fnm_lut, 0L); +#endif + + printf ("done; OK!\n"); +/**** DEBUGGING ONLY *****/ + if ((f= fopen ("@@@.lut", "wb")) != (FILE *) 0) + { +printf ("dumping ytree\n"); + ytree_size (hcc->HCC_ytree); + ytree_dump (f, hcc->HCC_ytree); + close (f); + /*** exit (0); ****/ + } + + if (xfn_process (hcc->HCC_fnm_xfn, add_to_ytree, + (void *) &hcc->HCC_ytree, 0L) == 0) + printf ("dict0004: scanning XFN %s ...done; OK", hcc->HCC_fnm_xfn); + + /* repack index information from YTREE into ENTRY_DESCRIPTOR structure */ + printf ("repacking YTREE ..."); + ytree_process (hcc->HCC_ytree, ytree_index_to_entry_descriptor, + (void *) 0); + printf (" done\n"); + } + + if (hcc->HCC_lut_mode == HCC_lm_incremental) + { + hcc->HCC_f_lut= fopen (hcc->HCC_fnm_lut, "rb"); + hcc->HCC_f_xfn= fopen (hcc->HCC_fnm_xfn, "r"); + } + + /* naechsten moeglichen Index bestimmen */ + printf ("dict0004: checking index file %s;\n", hcc->HCC_fnm_idx); + rc= stat (hcc->HCC_fnm_idx, &st); + if (rc == -1 && errno == ENOENT) + { /* Index File existiert noch nicht; anlegen */ + if ((f= fopen (hcc->HCC_fnm_idx, "wb")) != (FILE *) 0) + { + dpp_fwrite_long (f, -1L, 4); + dpp_fwrite_long (f, -1L, 4); + dpp_fwrite_long (f, -1L, 4); + fclose (f); + hcc->HCC_next_index= 1L; + printf (" : writing dummy index 0x00000000;\n"); + } + else + { + fprintf (stdout, "ERROR: couldn't write dummy index %s!!\n", + hcc->HCC_fnm_idx); + } + } + else + { + hcc->HCC_next_index= st.st_size / sizeof (struct LEXICON_INDEX); + } + printf (" : next index= 0x%lX; ... OK!\n", hcc->HCC_next_index); + + /* HYX File vorbehandeln, wenn nicht vorhanden */ + printf ("dictadd: checking lexicon file %s; ", hcc->HCC_fnm_hyx); + rc= stat (hcc->HCC_fnm_hyx, &st); + if (rc == -1 && errno == ENOENT) + { + printf ("writing signature; "); + if ((f= fopen (hcc->HCC_fnm_hyx, "wb")) != (FILE *) 0) + { + fprintf (f, "<ned.sgml enc=\"LEX\">\n"); + hyx_write_stamp (f, "pgm=dictadd"); + fputc ('\n', f); + fclose (f); + } + } + +SKIP1: + printf ("... OK!\n"); + + hcc->HCC_dictadd1_inited= 1; + + return 0; +} diff --git a/app/lexicon/dict0004.o b/app/lexicon/dict0004.o new file mode 100644 index 0000000000000000000000000000000000000000..74e7134311eb706a74e219397aad578331576dd6 Binary files /dev/null and b/app/lexicon/dict0004.o differ diff --git a/app/lexicon/dict0005.c b/app/lexicon/dict0005.c new file mode 100644 index 0000000000000000000000000000000000000000..28476617a8d7d70c1697b27d69b13a3f8ade5523 --- /dev/null +++ b/app/lexicon/dict0005.c @@ -0,0 +1,44 @@ +/* + * FILE %lexicon/dict0005.c + * + * written: 1994-12-10: isolated from dictadd1.c + * latest update: 1997-11-01 11:58:05 + * + */ + +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/hytxt.h> +#include <gg/parse.h> + +/* statistics: ------------------------------------------------------------ */ +extern long YTREE_ALLOCATED; +extern long YTREE_ALLOC_SIZE; + +/* ------------------------------------------------------------------------ */ +int dict_add_finish ( +struct HYX_CLUSTER_CONTROL *hcc, +struct LEXICON_CONTROL *lcc) +{ + long unique; + + if (!hcc->HCC_dictadd1_inited) return 0; + + if (hcc->HCC_dict_mode == DAMODE_MERGE + || hcc->HCC_dict_mode == DAMODE_LOOKUP + || hcc->HCC_dict_mode == DAMODE_REPLACE + ) + { + dict_flush_queue (hcc, lcc); + + unique= hcc_update_index (hcc, + ytree_entry_descriptor_to_index, + dict_write_xfn_entry); + + printf ("LUT file %s: \n", hcc->HCC_fnm_lut); + printf ("%ld nodes; %ld byte; %ld unique entries\n", + YTREE_ALLOCATED, YTREE_ALLOC_SIZE, unique); + } + + return 0; +} diff --git a/app/lexicon/dict0005.o b/app/lexicon/dict0005.o new file mode 100644 index 0000000000000000000000000000000000000000..ff10e39bb99b135bedcbe7640293724ccc37119f Binary files /dev/null and b/app/lexicon/dict0005.o differ diff --git a/app/lexicon/dict0006.c b/app/lexicon/dict0006.c new file mode 100644 index 0000000000000000000000000000000000000000..b5a638bc1c02c770e93cdc70dda1cb8ada1f4b68 --- /dev/null +++ b/app/lexicon/dict0006.c @@ -0,0 +1,63 @@ +/* + * FILE ~/usr/lexicon/dict0006.c + * + * written: 1994-12-10: isolated from dictadd1.c + * latest update: 2000-08-26 15:17:12 + * $Id: dict0006.c,v 1.2 2000/08/26 13:21:15 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/parse.h> + +/* statistics: ------------------------------------------------------------ */ +extern long YTREE_ALLOCATED; +extern long YTREE_ALLOC_SIZE; +extern long _hyx_markup_allocated; +extern long _hyx_markup_freed; +extern long _hyx_text_allocated; +extern long _hyx_text_freed; +extern long _hyx_text_segment_allocated; +extern long _hyx_txsegm_freed; +extern long _hyx_text_segment_alloc_size; +extern long _hyx_txsegm_free_size; +extern long TAG_DEFINITION_allocated; + +/* ------------------------------------------------------------------------ */ +void memory_statistics (FILE *fo, long record_counter) +{ + fprintf (fo, "Record %ld\n", record_counter); +#ifdef MSDOS + fprintf (fo, "mem avail 0x%04X\n", _memavl()); +#endif + + fprintf (fo, + "Markup nodes: alloc=%9ld free=%9ld active=%9ld\n", + _hyx_markup_allocated, + _hyx_markup_freed, + _hyx_markup_allocated-_hyx_markup_freed); + + fprintf (fo, + "Text nodes: alloc=%9ld free=%9ld active=%9ld\n", + _hyx_text_allocated, + _hyx_text_freed, + _hyx_text_allocated-_hyx_text_freed); + + fprintf (fo, + "Text Seg nodes: alloc=%9ld free=%9ld active=%9ld\n", + _hyx_text_segment_allocated, + _hyx_txsegm_freed, + _hyx_text_segment_allocated-_hyx_txsegm_freed); + + fprintf (fo, + "Text Seg size: alloc=%9ld free=%9ld active=%9ld\n", + _hyx_text_segment_alloc_size, + _hyx_txsegm_free_size, + _hyx_text_segment_alloc_size-_hyx_txsegm_free_size); + + fprintf (fo, + "YTREE nodes: alloc=%9ld size=%9ld\n", + YTREE_ALLOCATED, + YTREE_ALLOC_SIZE); +} diff --git a/app/lexicon/dict0006.o b/app/lexicon/dict0006.o new file mode 100644 index 0000000000000000000000000000000000000000..ffdce016580c86154e64ec0bdeb9129b11647dfc Binary files /dev/null and b/app/lexicon/dict0006.o differ diff --git a/app/lexicon/dict0007.c b/app/lexicon/dict0007.c new file mode 100644 index 0000000000000000000000000000000000000000..434a9efdc4428daeeddd91d20ce3361cede114eb --- /dev/null +++ b/app/lexicon/dict0007.c @@ -0,0 +1,41 @@ +/* + * FILE %lexicon/dict0007.c + * + * repack frame index in YTREE info into ENTRY_DESCRIPTOR + * called by ytree_process + * opposite of dict0008.c + * + * written: 1995-01-23 + * latest update: 2000-08-26 15:17:27 + * $Id: dict0007.c,v 1.2 2000/08/26 13:21:15 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int ytree_index_to_entry_descriptor ( +struct YTREE *yt_node, +void *client_data) +{ + struct ENTRY_DESCRIPTOR *ed; + +#ifdef MSDOS + client_data; +#endif + + if (yt_node->YT_info == 0L || !(yt_node->YT_flags & YTflag_EOW)) return 0; + + if ((ed= (struct ENTRY_DESCRIPTOR *) + calloc (sizeof (struct ENTRY_DESCRIPTOR), 1)) + == (struct ENTRY_DESCRIPTOR *) 0) + return -1; + + ed->ED_index= yt_node->YT_info; + ed->ED_status= ED_stat_from_LUT; + yt_node->YT_info= (long) ed; + + return 0; +} diff --git a/app/lexicon/dict0007.o b/app/lexicon/dict0007.o new file mode 100644 index 0000000000000000000000000000000000000000..10028f1f92dc19102c5acb97840a4ccd66004818 Binary files /dev/null and b/app/lexicon/dict0007.o differ diff --git a/app/lexicon/dict0008.c b/app/lexicon/dict0008.c new file mode 100644 index 0000000000000000000000000000000000000000..49d01ebbd04805951c7653a71068bbd2d1b6dc12 --- /dev/null +++ b/app/lexicon/dict0008.c @@ -0,0 +1,42 @@ +/* + * FILE %lexicon/dict0008.c + * + * repack frame index in YTREE info into ENTRY_DESCRIPTOR + * called by ytree_process + * + * written: 1995-01-23 + * latest update: 2000-08-26 15:17:40 + * $Id: dict0008.c,v 1.2 2000/08/26 13:21:15 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int ytree_entry_descriptor_to_index ( +struct YTREE *yt_node, +void *client_data) +{ + struct ENTRY_DESCRIPTOR *ed; + +#ifdef MSDOS + client_data; +#endif + + if ((ed= (struct ENTRY_DESCRIPTOR *) yt_node->YT_info) + == (struct ENTRY_DESCRIPTOR *) 0 + || !(yt_node->YT_flags & YTflag_EOW)) + return 0; + + yt_node->YT_info= ed->ED_index; + + if (ed->ED_frame_name != (char *) 0) free (ed->ED_frame_name); + if (ed->ED_te != (struct TEXT_ELEMENT *) 0) + hyx_frtx_elem_list (ed->ED_te); + + free (ed); + + return 0; +} diff --git a/app/lexicon/dict0008.o b/app/lexicon/dict0008.o new file mode 100644 index 0000000000000000000000000000000000000000..6eb76a2591d64b5ecedd065983021cf63b08e42c Binary files /dev/null and b/app/lexicon/dict0008.o differ diff --git a/app/lexicon/dict0009.c b/app/lexicon/dict0009.c new file mode 100644 index 0000000000000000000000000000000000000000..f7638511be89309692be8a765409a4c65526e32d --- /dev/null +++ b/app/lexicon/dict0009.c @@ -0,0 +1,42 @@ +/* + * FILE %lexicon/dict0009.c + * + * store a pointer to an ENTRY_DESCRIPTOR in the queue maintained + * in a LEXICON_CONTROL structure + * + * written: 1995-01-23 + * latest update: 2000-08-26 15:18:36 + * $Id: dict0009.c,v 1.2 2000/08/26 13:21:15 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int dict_queue ( +struct LEXICON_CONTROL *lcc, +struct ENTRY_DESCRIPTOR *ed, +int mark_dirty) +{ + struct ENTRY_QUEUE *e_q; + struct LEXICON_GLOBAL_CONTROL *lgc; + + if (lcc == (struct LEXICON_CONTROL *) 0 + || (lgc= lcc->LC_lgc) == (struct LEXICON_GLOBAL_CONTROL *) 0 + ) return -1; + + if (ed == (struct ENTRY_DESCRIPTOR *) 0) return 0; + + if ((e_q= hyx_new_entry_queue()) == (struct ENTRY_QUEUE *) 0) return -1; + + e_q->EQ_ed= ed; + e_q->EQ_is_dirty |= mark_dirty; + + *(lgc->LGC_EQ_append)= e_q; + lgc->LGC_EQ_append= &e_q->EQ_next; + lgc->LGC_EQ_count++; + + return 0; +} diff --git a/app/lexicon/dict0009.o b/app/lexicon/dict0009.o new file mode 100644 index 0000000000000000000000000000000000000000..efbd4fac71169c74d66835b15e9b29873db8e107 Binary files /dev/null and b/app/lexicon/dict0009.o differ diff --git a/app/lexicon/dict0010.c b/app/lexicon/dict0010.c new file mode 100644 index 0000000000000000000000000000000000000000..5a2be7e5d776aad5d37f10a4a9ae0428c678a957 --- /dev/null +++ b/app/lexicon/dict0010.c @@ -0,0 +1,88 @@ +/* + * FILE %lexicon/dict0010.c + * + * flush all queued-up entries if they're dirty. + * + * written: 1995-01-23 + * latest update: 2000-08-26 15:17:56 + * $Id: dict0010.c,v 1.2 2000/08/26 13:21:15 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/hytxt.h> +#include <gg/ytree.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int dict_flush_queue ( +struct HYX_CLUSTER_CONTROL *hcc, +struct LEXICON_CONTROL *lcc) +{ + struct ENTRY_QUEUE *e_q, *e_q2; + struct ENTRY_DESCRIPTOR *ed; + struct LEXICON_GLOBAL_CONTROL *lgc; + + if (hcc == (struct HYX_CLUSTER_CONTROL *) 0 + || lcc == (struct LEXICON_CONTROL *) 0 + || (lgc= lcc->LC_lgc) == (struct LEXICON_GLOBAL_CONTROL *) 0 + ) return -1; + +#ifdef MSDOS + printf ("flushing %d entries; mem avail=0x%04X\n", + lgc->LGC_EQ_count, _memavl()); +#else + printf ("flushing %d entries\n", lgc->LGC_EQ_count); +#endif + + for (e_q= lgc->LGC_EQ_first; + e_q != (struct ENTRY_QUEUE *) 0;) + { + e_q2= e_q->EQ_next; + + if ((ed= e_q->EQ_ed) != (struct ENTRY_DESCRIPTOR *) 0 + && ed->ED_te != (struct TEXT_ELEMENT *) 0 + && ed->ED_frame_name != (char *) 0) + { + if (e_q->EQ_is_dirty) + { + if (write_lexicon_entry (hcc->HCC_fnm_hyx, hcc->HCC_fnm_idx, + &ed->ED_index, ed->ED_frame_name, ed->ED_te, + &hcc->HCC_next_index, lcc->LC_write_nl) + == -1) + { + printf ("dict_flush_queue: error writing frame '%s'\n", + ed->ED_frame_name); + printf (" : stopping flush!\n"); + + lgc->LGC_EQ_first= e_q; + lgc->LGC_EQ_append= &e_q->EQ_next; + + return -1; + } + } + + if (hcc->HCC_lut_mode != HCC_lm_incremental + || ed->ED_status != ED_stat_is_new + ) + { + free (ed->ED_frame_name); + ed->ED_frame_name= (char *) 0; + } + else printf ("new frame: %s\n", ed->ED_frame_name); + + hyx_frtx_elem_list (ed->ED_te); + ed->ED_te= (struct TEXT_ELEMENT *) 0; + } + + free (e_q); + e_q= e_q2; + } + + lgc->LGC_EQ_first= (struct ENTRY_QUEUE *) 0; + lgc->LGC_EQ_append= &lgc->LGC_EQ_first; + lgc->LGC_EQ_count= 0; + + return 0; +} diff --git a/app/lexicon/dict0010.o b/app/lexicon/dict0010.o new file mode 100644 index 0000000000000000000000000000000000000000..6f33c700a23dbcfb77242a128c53652300418694 Binary files /dev/null and b/app/lexicon/dict0010.o differ diff --git a/app/lexicon/dict0011.c b/app/lexicon/dict0011.c new file mode 100644 index 0000000000000000000000000000000000000000..105fbceaec02a58d16fe538f8b580fcea8181de0 --- /dev/null +++ b/app/lexicon/dict0011.c @@ -0,0 +1,30 @@ +/* + * FILE %lexicon/dict0011.c + * + * written: 1995-03-11 + * latest update: 1997-11-01 12:04:47 + * + */ + +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int dict_write_xfn_entry (struct YTREE *yt_node, void *client_data) +{ + struct ENTRY_DESCRIPTOR *ed; + FILE *fo; + + if ((yt_node->YT_flags & YTflag_EOW) + && (ed= (struct ENTRY_DESCRIPTOR *) yt_node->YT_info) + != (struct ENTRY_DESCRIPTOR *) 0 + && ed->ED_frame_name != (char *) 0 + && (fo= (FILE *) client_data) != (FILE *) 0 + ) + { + fprintf (fo, "%lx %s\n", ed->ED_index, ed->ED_frame_name); + } + + return 0; +} diff --git a/app/lexicon/dict0011.o b/app/lexicon/dict0011.o new file mode 100644 index 0000000000000000000000000000000000000000..206a4edb736be46107385ac546bcece2eaf2ca35 Binary files /dev/null and b/app/lexicon/dict0011.o differ diff --git a/app/lexicon/dict0012.c b/app/lexicon/dict0012.c new file mode 100644 index 0000000000000000000000000000000000000000..1dc4c255ce35c80bbc4b98fd2c9d78d9f5e99bd1 --- /dev/null +++ b/app/lexicon/dict0012.c @@ -0,0 +1,83 @@ +/* + * FILE %lexicon/dict0012.c + * + * written: 1995-06-25 + * latest update: 1996-10-10 0:15:49 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/filename.h> +#include <gg/sbr.h> +#include <gg/hytxt.h> +#include <gg/strings.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int dict_read_setup_file ( +struct HYX_CLUSTER_CONTROL *hcc, +char *fn, +char *line, +int MAX_LINE, +char **tag_definition) +{ + FILE *fi; + +#ifdef MSDOS + MAX_LINE; +#endif + + if (fn == (char *) 0 || *fn == 0) return 0; + + /* read lexicon setup file */ + if ((fi= fopen (fn, "rt")) == (FILE *) 0) + { + /******** + fprintf (stdout, "error opening setup file \'%s\'\n", fn); + fprintf (stdout, "... using default values\n"); + ********/ + return 0; + } + + for (;;) + { + fscanf (fi, "%s", line); + if (feof (fi)) break; + if (line [0] == '#') + { +READ_NEXT: + trash_until_eol (fi); + continue; + } + + if (strncmp (line, "cluster", 3) == 0) + { + fscanf (fi, "%s", line); + hcc_set_cluster_name (hcc, line); + } else + if (strncmp (line, "lex", 3) == 0) + { + fscanf (fi, "%s", line); + str_assign (&hcc->HCC_fnm_hyx, line); + } else + if (strncmp (line, "idx", 3) == 0) + { + fscanf (fi, "%s", line); + str_assign (&hcc->HCC_fnm_idx, line); + } else + if (strncmp (line, "main", 4) == 0) + { + fscanf (fi, "%s", line); + str_assign (&hcc->HCC_fnm_lut, line); + } else + if (strncmp (line, "tag", 3) == 0) + { + fscanf (fi, "%s", line); + str_assign (tag_definition, translate_logic_filename (line)); + } else goto READ_NEXT; + } + fclose (fi); + + return 0; +} diff --git a/app/lexicon/dict0012.o b/app/lexicon/dict0012.o new file mode 100644 index 0000000000000000000000000000000000000000..54bf330035b485c3932ba45a781502fc90a76721 Binary files /dev/null and b/app/lexicon/dict0012.o differ diff --git a/app/lexicon/dict0013.c b/app/lexicon/dict0013.c new file mode 100644 index 0000000000000000000000000000000000000000..499b97b3365da523271277ff41906799c0c7ca0f --- /dev/null +++ b/app/lexicon/dict0013.c @@ -0,0 +1,32 @@ +/* + * FILE %lexicon/dict0013.c + * + * written: 1995-08-04 + * latest update: 1996-10-10 0:15:55 + * + */ + +#include <stdio.h> +#include <contrib/md5gg.h> +#include <gg/hytxt.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +char *dict_get_frame_name ( +struct HYX_CLUSTER_CONTROL *hcc, +char *entry_key, +char *index_str) +{ + /* generate a frame name for the entry */ + switch (hcc->HCC_mode_frame_name) + { + case DAFNM_index: + sprintf (index_str, "LX%08lx", hcc->HCC_next_index); + return index_str; + + case DAFNM_entry_key: + return entry_key; + } + + return MD5check_string ((unsigned char *) entry_key); +} diff --git a/app/lexicon/dict0013.o b/app/lexicon/dict0013.o new file mode 100644 index 0000000000000000000000000000000000000000..06ffc8d9a8b2a843bd32e78321de97911672ff72 Binary files /dev/null and b/app/lexicon/dict0013.o differ diff --git a/app/lexicon/dict0014.c b/app/lexicon/dict0014.c new file mode 100644 index 0000000000000000000000000000000000000000..703e99a4ddbe8087045d1519dfdf105f820dbd2f --- /dev/null +++ b/app/lexicon/dict0014.c @@ -0,0 +1,59 @@ +/* + * FILE %lexicon/dict0014.c + * + * restructure text elements according to lexicon control + * + * written: 1995-08-05 + * latest update: 2001-02-18 18:06:39 + * $Id: dict0014.c,v 1.3 2002/01/22 03:07:27 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +long dict_restructure2_entry ( +struct HYX_PARSER_CLASS *hpc, +struct LEXICON_CONTROL *lcc, +struct TEXT_ELEMENT **tx_new_entry, +char *entry_key, +int entry_key_size) +{ + struct TEXT_ELEMENT *head_tag_text= (struct TEXT_ELEMENT *) 0; + struct TEXT_ELEMENT *tail_tag_text= (struct TEXT_ELEMENT *) 0; + +#ifdef PARSER_DEBUG_B +printf ("dict0014: hpc=0x%08lX lcc=0x%08lX tx_new_entry=0x%08lX entry_key=0x%08lX '%s'\n", + hpc, lcc, tx_new_entry, entry_key, entry_key); +#endif /* PARSER_DEBUG_B */ + + if (lcc == (struct LEXICON_CONTROL *) 0 + || tx_new_entry == (struct TEXT_ELEMENT **) 0 + ) return -1; + +#ifdef PARSER_DEBUG_B +printf ("dict0014: 2: lcc->LC_head_tag_str=0x%08lX\n", lcc->LC_head_tag_str); +#endif /* PARSER_DEBUG_B */ + if (lcc->LC_head_tag_str != (char *) 0) + head_tag_text= hyx_mktx_elem_and_segm (hpc, lcc->LC_head_tag_str, + (long) strlen (lcc->LC_head_tag_str), + 1L, TEt_tag, 1, 1); + +#ifdef PARSER_DEBUG_B +printf ("dict0014: 3\n"); +#endif /* PARSER_DEBUG_B */ + if (lcc->LC_tail_tag_str != (char *) 0) + tail_tag_text= hyx_mktx_elem_and_segm (hpc, lcc->LC_tail_tag_str, + (long) strlen (lcc->LC_tail_tag_str), + 1L, TEt_tag, 1, 1); + +#ifdef PARSER_DEBUG_B +printf ("dict0014: 4\n"); +#endif /* PARSER_DEBUG_B */ + return dict_restructure_new_entry (hpc, tx_new_entry, entry_key, + entry_key_size, + lcc->LC_do_strip, + head_tag_text, tail_tag_text); +} diff --git a/app/lexicon/dict0014.o b/app/lexicon/dict0014.o new file mode 100644 index 0000000000000000000000000000000000000000..c67da0db3c446fc606e78e88d32946178dae0e0c Binary files /dev/null and b/app/lexicon/dict0014.o differ diff --git a/app/lexicon/dict0015.c b/app/lexicon/dict0015.c new file mode 100644 index 0000000000000000000000000000000000000000..d173e6febf1978dbd23346ef1ea07fd09f180083 --- /dev/null +++ b/app/lexicon/dict0015.c @@ -0,0 +1,61 @@ +/* + * FILE %lexicon/dict0015.c + * + * restructure text elements according to lexicon control + * + * written: 1995-08-05 + * latest update: 2001-02-18 18:04:53 + * $Id: dict0015.c,v 1.2 2001/02/19 00:27:16 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/hytxt.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int dict_process_entry ( +struct HYX_PARSER_CLASS *hpc, +struct HYX_CLUSTER_CONTROL *hcc, +struct LEXICON_CONTROL *lcc, +struct TEXT_ELEMENT *tx_new_entry, +hyx_output_processor *op, +void *op_client_data, +int verbose_level) +{ + char entry_key [ENTRY_KEY_SIZE]; + char index_str [24]; + char *frame_name; /* name of the new frame */ + +if (tx_new_entry == (struct TEXT_ELEMENT *) 0) +{ +fprintf (stdout, "warning: tx_new_entry == NIL 1\n"); +return -1L; +} + +/***************** +printf ("dict0015: tx_new_entry:\n"); +print_text_element_list (stdout, tx_new_entry); +*****************/ + + dict_restructure2_entry (hpc, lcc, &tx_new_entry, entry_key, ENTRY_KEY_SIZE); + + if (tx_new_entry == (struct TEXT_ELEMENT *) 0) + { + fprintf (stdout, "warning: tx_new_entry == NIL\n"); + return -1L; + } + + if (*entry_key == 0) + { + fprintf (stdout, "warning: frame without <LE> markup; ignored ...\n"); + hyx_frtx_elem_list (tx_new_entry); + return 1; + } + + frame_name= dict_get_frame_name (hcc, entry_key, index_str); + if (verbose_level > 0) printf ("%s %-27s ", frame_name, entry_key); + + return dict_update_entry (hpc, hcc, lcc, frame_name, tx_new_entry, + op, op_client_data, verbose_level); +} diff --git a/app/lexicon/dict0015.o b/app/lexicon/dict0015.o new file mode 100644 index 0000000000000000000000000000000000000000..965983848ea4b0962614ce1496b895adfc65895d Binary files /dev/null and b/app/lexicon/dict0015.o differ diff --git a/app/lexicon/dict0016.c b/app/lexicon/dict0016.c new file mode 100644 index 0000000000000000000000000000000000000000..d5d5997a2ff12c2aeaed2e65f072a5d1e410e34d --- /dev/null +++ b/app/lexicon/dict0016.c @@ -0,0 +1,151 @@ +/* + * FILE %lexicon/dict0016.c + * + * print markup structure + * + * written: 1995-08-19: reorganized version of display_markup + * latest update: 1995-08-19 + * + */ + +#include <stdio.h> +#include <gg/dyb.h> +#include <gg/parse.h> +#include <gg/strings.h> + +#ifdef DIAGNOSTIC +#define hyx_unroll_text_segment_list hyx_idag_unrtxtsl +#define hyx_unroll_text hyx_diag_unrtxt +#endif + +/* ------------------------------------------------------------------------ */ +static void xx_unroll ( +struct DYNAMIC_BLOCK *dyb, +struct TEXT_ELEMENT *t, +char *txt) +{ +#ifdef DIAGNOSTIC + struct TAG_DEFINITION *td; +#endif /* DIAGNOSTIC */ + +#ifdef MSDOS + txt; +#endif + + if (t == (struct TEXT_ELEMENT *) 0) return; + + /* fprintf (fo, "%s: ", txt); */ + for (; t != (struct TEXT_ELEMENT *) 0; t= t->TE_next) + { +#ifdef DIAGNOSTIC + if ((td= t->TE_tag_definition) != (struct TAG_DEFINITION *) 0) + { + fputc ('[', fo); + display_tag_definition (fo, td); + fputc (']', fo); + } +#endif /* DIAGNOSTIC */ + + if (t->sig == SIG_TEXT_ELEMENT) + { + dyb_append_block (dyb, "<", 1L); + hyx_unroll_text_segment_list (dyb, t->TE_text_segment); + dyb_append_block (dyb, ">", 1L); + } + } + + dyb_append_block (dyb, "\n", 1L); +} + +/* ------------------------------------------------------------------------ */ +int hyx_unroll_text ( +struct DYNAMIC_BLOCK *dyb, +struct TEXT_ELEMENT *t, +int indent, +int verbosity, +int append_eoln) +{ +#ifdef DIAGNOSTIC + struct TAG_DEFINITION *td; +#endif /* DIAGNOSTIC */ + struct MARKUP *m; + int item= 0; + + if (dyb == (struct DYNAMIC_BLOCK *) 0 + || t == (struct TEXT_ELEMENT *) 0 + ) return -1; + + for (; t != (struct TEXT_ELEMENT *) 0; t= t->TE_next) + { + item++; + +#ifdef DIAGNOSTIC + if ((td= t->TE_tag_definition) != (struct TAG_DEFINITION *) 0) + { + fputc ('[', fo); + display_tag_definition (fo, td); + fputc (']', fo); + } +#endif /* DIAGNOSTIC */ + + dyb_append_blanks (dyb, (long) indent); + + if (t->sig == SIG_TEXT_ELEMENT) + { + /******* + fprintf (fo, "[%2d] TEXT_ELEMENT (%ld) ", item, t->TE_level); + *******/ + if (t->TE_level == 0) + { + hyx_unroll_text_segment_list (dyb, t->TE_text_segment); + if (append_eoln) dyb_append_block (dyb, "\n", 1L); + } else + if (t->TE_level == 1) + { + dyb_append_block (dyb, "<", 1L); + hyx_unroll_text_segment_list (dyb, t->TE_text_segment); + dyb_append_block (dyb, ">", 1L); + if (append_eoln) dyb_append_block (dyb, "\n", 1L); + } + } + else + if (t->sig == SIG_MARKUP) + { + m= (struct MARKUP *) t; + + if (verbosity > 1) + { + /* fprintf (fo, "[%2d] MARKUP\n", item); */ + /* dyb_append_blanks (dyb, (long) indent); */ + /* display_tag_definition (fo, m->tag_definition); */ + } + + if (verbosity > 0) + { + /* dyb_append_blanks (dyb, (long) indent); */ + /* ... erfolgt bereits weiter vorne! */ + xx_unroll (dyb, (struct TEXT_ELEMENT *) m->tag_open, "Start"); + } + + hyx_unroll_text (dyb, m->tagged_text, indent+2, verbosity, append_eoln); + + if (m->tag_close != (void *) 0) + { + if (verbosity > 0) + { + /* ... here it's necessary to print blanks: */ + dyb_append_blanks (dyb, (long) indent); + xx_unroll (dyb, (struct TEXT_ELEMENT *) m->tag_close, "Stop "); + } + } + } + else + { + fprintf (stderr, + "[%2d] unknown element in list! sig=%d\n", item, t->sig); + return -1; + } + } + + return 0; +} diff --git a/app/lexicon/dict0016.o b/app/lexicon/dict0016.o new file mode 100644 index 0000000000000000000000000000000000000000..f7bc2b2d6d143f243df27ae6b4042a03e635905c Binary files /dev/null and b/app/lexicon/dict0016.o differ diff --git a/app/lexicon/dict0018.c b/app/lexicon/dict0018.c new file mode 100644 index 0000000000000000000000000000000000000000..3fafbe27aa5fdb8130dc5a733c24b69ff31ecaa8 --- /dev/null +++ b/app/lexicon/dict0018.c @@ -0,0 +1,48 @@ +/* + * FILE %lexicon/dict0018.c + * + * Text Segment Liste ausgeben + * + * written: 1995-08-19: reorganized from dict0008.c + * latest update: 1995-08-19 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dyb.h> +#include <gg/parse.h> + +#ifdef DIAGNOSTIC +#define hyx_unroll_text_segment_list hyx_idag_unrtxtsl +#endif /* DIAGNOSTIC */ + +/* ------------------------------------------------------------------------ */ +int hyx_unroll_text_segment_list ( +struct DYNAMIC_BLOCK *dyb, +struct TEXT_SEGMENT *ts) +{ + char *cp; + int first_char= -1; /* used for what??? @@@ T2D ### */ + + for (; + ts != (struct TEXT_SEGMENT *) 0; + ts= ts->TSEG_next) + { + cp= ts->TSEG_text_array; + if (first_char == -1) first_char= *cp; + +#ifdef DIAGNOSTIC + dyb_append_block (dub, "{", 1); + dyb_append_block (dyb, cp, ts->TSEG_text_lng); + dyb_append_block (dub, "}", 1); +#else + dyb_append_block (dyb, cp, ts->TSEG_text_lng); +#endif /* !DIAGNOSTIC */ + } + + return first_char; +} diff --git a/app/lexicon/dict0018.o b/app/lexicon/dict0018.o new file mode 100644 index 0000000000000000000000000000000000000000..b8b121e02491c3e068ca79cc75552981ee9f91cc Binary files /dev/null and b/app/lexicon/dict0018.o differ diff --git a/app/lexicon/dictadd b/app/lexicon/dictadd new file mode 100755 index 0000000000000000000000000000000000000000..296c8b9e8d75e0a9ae81112483c6060ee5b0c9fd Binary files /dev/null and b/app/lexicon/dictadd differ diff --git a/app/lexicon/dictadd.c b/app/lexicon/dictadd.c new file mode 100644 index 0000000000000000000000000000000000000000..d878da1c3a4d191a8807d58da87e69372b4916b2 --- /dev/null +++ b/app/lexicon/dictadd.c @@ -0,0 +1,405 @@ +/* + * FILE %lexicon/dictadd.c + * + * Files dem Dictionary einverleiben + * - HELP + * + * written: 1991 03 17 + * latest update: 2000-08-26 15:19:08 + * + */ +static char ID []= "$Id: dictadd.c,v 1.5 2003/06/25 10:12:06 gonter Exp $\n"; + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/hytxt.h> +#include <gg/parse.h> +#include <gg/filename.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/sgml.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#ifdef MSDOS +#include <conio.h> +#endif + +#ifndef MSDOS +#define BBC_SERVER +#endif + +#ifdef BBC_SERVER +#include <gg/bbch.h> +static int port_number= 0; +static char *key_file= ".kredenz.tfb"; +#endif /* BBC_SERVER */ + +/* ------------------------------------------------------------------------ */ +static int verbose_mode= 0; +static int do_strip= 1; +static int write_nl= 1; +static int queue_size= QUEUE_SIZE; +static int do_query= 0; + +static char *head_tag= (char *) 0; +static char *tail_tag= (char *) 0; + +static char head_tag_str [256]; + +static char *def_tag_definition= "lexicon.tags"; +static char *tag_definition= (char *) 0; +#define FILENAME_SIZE 256 +static char lexicon_setup [FILENAME_SIZE]= "alexicon.stp"; +static int setup_readin= 0; + +#define MAX_LINE 256 +static char line [MAX_LINE]; + +static struct HYX_CLUSTER_CONTROL *hcc; +static struct LEXICON_CONTROL *lcc; +static struct HYX_PARSER_CLASS *hpc; +static char *FNM_HYX= "alexicon.hyx"; + +/* ------------------------------------------------------------------------ */ +#define NUM_END_TAGS 1 +static long end_tags [NUM_END_TAGS]= { (long) SGML_TAG_endframe } ; + +/* ------------------------------------------------------------------------ */ +static char VERSION []= "(@)Adictadd.c 1.39 #D$2000-08-26 15:19:29\n"; + +static char *HELP [] = +{ + "USAGE: dictadd [options] {file name}\n", + " add files in lexicon format to an existing main lexicon\n", +#ifdef BBC_SERVER + " with Black Board Controller\n", +#endif /* BBC_SERVER */ + "OPTIONS:\n", +#ifdef BBC_SERVER + " -p<num> ... port number to listen on\n", +#endif /* BBC_SERVER */ + " -c<fnm> ... cluster name\n", + " -l<fnm> ... list of files\n", + " -t<fnm> ... tag definition file\n", + " -s<fnm> ... lexicon setup file\n", + " -i<itemstr> ... generate item tag <I itemstr>\n", + " -m<c> ... processing mode\n", + " m ... merge old and new entry [DEF]\n", + " r ... replace existing entry by new one\n", + " c ... check new entries\n", + " l ... lookup\n", + " d<num> ... divide mode; 1, 2, or 3 chars\n", + " -n<mode> ... mode for generating frame names\n", + " m .. md5 hash strings (0)\n", + " e .. entry key (1) [DEF]\n", + " i .. index (2) [BUG: DOESN'T WORK RIGHT NOW!]\n", + " -o<opt> ... processing options\n", + " n ... write new lines after text [DEF]\n", + " N ... don't write new lines after text\n", + " s ... text stripping on [DEF]\n", + " S ... text stripping off\n", + " -q<num> ... queue size [DEF: 4096 Unix, 128 DOS]\n", + " -x ... write XFN instead of full lut (incremental mode)\n", + " -v ... verbose mode\n", + " -? ... query default values\n", + "Notes:\n", + " <fnm>=- ... stdin or stdout, respectively\n", + "\n", + VERSION, + ID, + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_dict_add (char *fn, void *cd); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + int t2d= 0; + char *arg; +#ifdef BBC_SERVER + struct BBC_SESSION *bbcs; +#endif /* BBC_SERVER */ + struct LEXICON_GLOBAL_CONTROL *lgc; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; + + if (argc <= 1) goto HLP; + +#ifdef MSDOS + fclose (stdaux); + fclose (stdprn); +#endif + + if ((hcc= hyx_new_cluster_control ()) == (struct HYX_CLUSTER_CONTROL *) 0 + || (lgc= hyx_new_lexicon_global_control ()) + == (struct LEXICON_GLOBAL_CONTROL *) 0 + || (lcc= hyx_new_lexicon_control ()) == (struct LEXICON_CONTROL *) 0 + || (hpc= hyx_init_parser_class ()) == (struct HYX_PARSER_CLASS *) 0 + || (wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) goto HLP; + + hcc_set_cluster_name (hcc, FNM_HYX); + hcc->HCC_dict_mode= DAMODE_MERGE; + hcc->HCC_mode_frame_name= DAFNM_entry_key; + hcc->HCC_next_index= 1L; + + lcc->LC_lgc= lgc; + lgc->LGC_EQ_append= &lgc->LGC_EQ_first; + + /* setup end tag codes */ + if ((j= NUM_END_TAGS) > MAX_LC_END_TAGS) j= MAX_LC_END_TAGS; + for (i= 0; i < j; i++) lcc->LC_end_tags [i]= end_tags [i]; + lcc->LC_end_tag_count= j; + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, + main_dict_add, (void *) 0); + tag_definition= set_etc_filename ((char *) 0, def_tag_definition); + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (*arg == '-') + switch (arg [1]) + { + case 'c': case 'C': + hcc_set_cluster_name (hcc, arg +2); + break; + + case 'i': case 'I': + if (arg [2]) + sprintf (head_tag_str, "I %s", arg+2); + else sprintf (head_tag_str, "I"); + head_tag= head_tag_str; + break; + + case 'l': case 'L': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + + case 'm': case 'M': + switch (arg [2]) + { + case 'c': case 'C': + hcc->HCC_dict_mode= DAMODE_CHECK; + break; + case 'd': case 'D': + switch ((int) get_parameter_value (arg+3)) + { + case 1: hcc->HCC_dict_mode= DAMODE_DIVIDE1; break; + case 2: hcc->HCC_dict_mode= DAMODE_DIVIDE2; break; + case 3: hcc->HCC_dict_mode= DAMODE_DIVIDE3; break; + default: + goto HLP; + } + break; + case 'm': case 'M': + hcc->HCC_dict_mode= DAMODE_MERGE; + break; + case 'l': case 'L': + hcc->HCC_dict_mode= DAMODE_LOOKUP; + break; + case 'r': case 'R': + hcc->HCC_dict_mode= DAMODE_REPLACE; + break; + } + break; + + case 'n': case 'N': + switch (arg [2]) + { + case 'm': case 'M': + hcc->HCC_mode_frame_name= DAFNM_md5; + break; + case 'e': case 'E': + hcc->HCC_mode_frame_name= DAFNM_entry_key; + break; + case 'i': case 'I': + hcc->HCC_mode_frame_name= DAFNM_index; + printf ("BUG: this mode doesn't work currently!\n"); + goto HLP; + break; + } + break; + + case 'o': case 'O': + switch (arg [2]) + { + case 'n': + write_nl= 1; + break; + case 'N': + write_nl= 0; + break; + case 's': + do_strip= 1; + break; + case 'S': + do_strip= 0; + break; + } + break; + +#ifdef BBC_SERVER + case 'p': case 'P': + if (arg [2] == 0) break; + port_number= (int) get_parameter_value (arg+2); + t2d= 1; + break; +#endif /* BBC_SERVER */ + + case 'q': case 'Q': + if ((queue_size= (int) get_parameter_value (arg+2)) == 0L) + queue_size= QUEUE_SIZE; + break; + + case 's': case 'S': + strcpy (lexicon_setup, arg+2); + dict_read_setup_file (hcc, lexicon_setup, line, MAX_LINE, + &tag_definition); + setup_readin= 1; + break; + + case 't': case 'T': + str_assign (&tag_definition, translate_logic_filename (arg+2)); + break; + + case 'v': case 'V': + case 'x': case 'X': + case '?': + for (j= 1; arg [j]; j++) + switch (arg [j]) + { + case 'x': case 'X': + hcc->HCC_lut_mode= HCC_lm_incremental; + break; + case 'v': case 'V': + verbose_mode++; + break; + case '?': + do_query= 1; + break; + } + break; + + case 0: + goto ADD_TO_LIST; + +HLP: +#include <gg/help.inc> + } + else + { +ADD_TO_LIST: + array_push (arguments, (void *) arg); + t2d= 1; + } + } + + if (!setup_readin) + dict_read_setup_file (hcc, lexicon_setup, line, MAX_LINE, + &tag_definition); + + lgc->LGC_queue_size= queue_size; + lcc->LC_do_strip= do_strip; + lcc->LC_write_nl= write_nl; + lcc->LC_head_tag_str= head_tag; + lcc->LC_tail_tag_str= tail_tag; + + if (do_query) + { + printf (VERSION); + printf ("dictadd default values:\n"); + printf ("lexicon setup file: %s\n", lexicon_setup); + printf ("tag definition file: %s\n", tag_definition); + printf ("lexicon file: %s\n", hcc->HCC_fnm_hyx); + printf ("index file: %s\n", hcc->HCC_fnm_idx); + printf ("main lut file: %s\n", hcc->HCC_fnm_lut); + + printf ("queue size: %d [DEF: %d]\n", + queue_size, QUEUE_SIZE); + printf ( +"procssing options: %s strip white space off text; %s write LF after text\n", + (do_strip) ? "do" : "don't", + (write_nl) ? "do" : "don't"); + } + + if (t2d) + { + /* 1. bisherige Files einlesen */ + hyx_read_tag_definition (hpc, tag_definition); + if (dict_check_integrity (hpc) != 0) + { + fprintf (stdout, + "error: tags not defined properly in %s; stopping\n", + tag_definition); + return 0; + } + + dict_add_init (hcc); + + /* 2. neue Files verarbeiten */ + wcrd2_arguments (wcrd, arguments); + +#ifdef BBC_SERVER + if (port_number > 0) + { + struct LEX_SESSION *lexs; + + if ((bbcs= bbc_new_session ()) == (struct BBC_SESSION *) 0) + { + fprintf (stderr, "could not establish BBC session\n"); + return -1; + } + + bbcs->BBCS_input1= bbc_authentication_protocol; + bbcs->BBCS_input2= bbc_lexicon_processor; + bbcs->BBCS_op= bbc_transmit_text; + bbcs->BBCS_key_file= key_file; + +fprintf (stderr, "input2=0x%08lX\n", bbc_lexicon_processor); + if ((lexs= (struct LEX_SESSION *) + calloc (sizeof (struct LEX_SESSION), 1)) + == (struct LEX_SESSION *) 0) + { + fprintf (stderr, "could not initialize\n"); + return -1; + } + + lexs->LEXS_hcc= hcc; + lexs->LEXS_hpc= hpc; + lexs->LEXS_lcc= lcc; + bbcs->BBCS_client_data1= (void *) lexs; + + bbc_main (bbcs, (char *) 0, port_number, 1, (char *) 0, (char *) 0); + } +#endif /* BBC_SERVER */ + + /* 3. veraenderte Files abschliessen */ + hyx_write_stamp (stdout, "p=\"dictadd finish\""); + fputc ('\n', stdout); + dict_add_finish (hcc, lcc); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main_dict_add (char *fn, void *cd) +{ +#ifdef MSDOS + cd; +#endif + + return dict_add_file (hpc, hcc, lcc, fn, verbose_mode); +} diff --git a/app/lexicon/dictadd.o b/app/lexicon/dictadd.o new file mode 100644 index 0000000000000000000000000000000000000000..c96d2573444a0508dbc50959ee45880cf23d6435 Binary files /dev/null and b/app/lexicon/dictadd.o differ diff --git a/app/lexicon/dictadd1.c b/app/lexicon/dictadd1.c new file mode 100644 index 0000000000000000000000000000000000000000..741e33c62233ab170f572ec3c242f8cdea6bd104 --- /dev/null +++ b/app/lexicon/dictadd1.c @@ -0,0 +1,111 @@ +/* + * FILE %lexicon/dictadd1.c + * + * - info: + * Beschleunigung von Updates + * + * written: 1991 03 17 + * latest update: 2001-02-18 17:57:46 + * $Id: dictadd1.c,v 1.4 2003/06/25 10:12:06 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/hytxt.h> +#include <gg/parse.h> + +#ifndef MSDOS +#include <unistd.h> +#endif + +/* ------------------------------------------------------------------------ */ +int dict_add_file ( +struct HYX_PARSER_CLASS *hpc, +struct HYX_CLUSTER_CONTROL *hcc, +struct LEXICON_CONTROL *lcc, +char *fn, /* file to be processed */ +int verbose_level) /* to chat or not to chat ... */ +{ + FILE *fi; /* verarbeitetes Files */ + struct TEXT_ELEMENT *tx_new_entry= (struct TEXT_ELEMENT *) 0; + /* neu gelesener Eintrag */ + long record_counter= 0L; /* number of used lexicon frames */ + long chars_read; /* number of chars read in lexicon entry */ + int rc; + + if (hcc == (struct HYX_CLUSTER_CONTROL *) 0 + || !hcc->HCC_dictadd1_inited + || lcc == (struct LEXICON_CONTROL *) 0 + ) + { + fprintf (stdout, "lexicon system not initialized!!!\n"); + return -1; + } + + fputc ('\n', stdout); + hyx_write_stamp (stdout, "pgm=dictadd"); + fprintf (stdout, "\nadding file %s in mode %d to lexicon\n", + fn, hcc->HCC_dict_mode); + fprintf (stdout, "frame name generation: %d\n", hcc->HCC_mode_frame_name); + + /**************** + fprintf (stdout, "head='%s' tail='%s'\n", + lcc->LC_head_tag_str, lcc->LC_tail_tag_str); + *****************/ + memory_statistics (stdout, 0L); + + if ((fi= (strcmp (fn, "$stdin") == 0 || strcmp (fn, "-") == 0) + ? (FILE *) stdin : fopen (fn, "rb")) == (FILE *) 0) + { + fprintf (stdout, "dict_add_file: couldn't read from %s\n", fn); + return 0; + } + printf ("dictadd1: reading file '%s'\n", fn); + + for (;;) + { + /* read entry from input file which shall be added to the lexicon */ + +#ifdef PARSER_DEBUG_B + printf ("dictadd1: calling hyx_parse1_file () \n", fn); +#endif /* PARSER_DEBUG_B */ + + rc= hyx_parse1_file (hpc, fi, &tx_new_entry, + lcc->LC_end_tags, lcc->LC_end_tag_count, + 0x7FFFFFFFL, &chars_read); + + if (rc != 0 || chars_read == 0L) + { + fprintf (stdout, + "note: hyx_parse_file: rc=%d chars_read=%ld fn=%s\n", + rc, chars_read, fn); + break; + } + +#ifdef PARSER_DEBUG_B + printf ("dictadd1: calling dict_process_entry ()\n", fn); +#endif /* PARSER_DEBUG_B */ + + rc= dict_process_entry (hpc, hcc, lcc, tx_new_entry, + (hyx_output_processor *) 0, (void *) 0, + verbose_level); + if (rc == -1) break; + if (rc == 1) continue; + + record_counter++; + if ((record_counter % 0x00010000L) == 0) + memory_statistics (stdout, record_counter); + + if (feof (fi)) break; + } + + fprintf (stdout, "stopping...\n"); + + if (strcmp (fn, "$stdin") != 0 && strcmp (fn, "-") != 0) fclose (fi); + flclose_all (); + memory_statistics (stdout, record_counter); + + return 0; +} diff --git a/app/lexicon/dictadd1.o b/app/lexicon/dictadd1.o new file mode 100644 index 0000000000000000000000000000000000000000..772c1aed582aa163de189bda371c84469ef17941 Binary files /dev/null and b/app/lexicon/dictadd1.o differ diff --git a/app/lexicon/dictadd2.c b/app/lexicon/dictadd2.c new file mode 100644 index 0000000000000000000000000000000000000000..c08bf7fc364d3e062a12e428029bb613ff51904e --- /dev/null +++ b/app/lexicon/dictadd2.c @@ -0,0 +1,208 @@ +/* + * FILE %lexicon/dictadd2.c + * + * written: 1991 03 17 + * latest update: 2001-02-18 18:24:54 + * $Id: dictadd2.c,v 1.4 2002/01/22 03:07:27 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/ytree.h> +#include <gg/sgml.h> + +/* ------------------------------------------------------------------------ */ +long dict_restructure_new_entry ( +struct HYX_PARSER_CLASS *hpc, +struct TEXT_ELEMENT **tx_list, +char *key_string, /* key string found in <LE> markup */ +int key_string_length, /* maximum length of the key_string */ +int do_strip, +struct TEXT_ELEMENT *insert_head, +struct TEXT_ELEMENT *insert_tail) +{ + struct TEXT_ELEMENT **tx, *t; + struct TEXT_ELEMENT **last_tag= (struct TEXT_ELEMENT **) 0; + struct TEXT_ELEMENT *t1, *t2, *t3, *t4, *t5; + struct TAG_DEFINITION *td; + long last_tag_id= -1L; + int any_tag_seen= 0; + int tags_counted= 0; + int rc; + int key_length; /* tatsaechliche Laenge des key_strings */ + +#ifdef PARSER_DEBUG_B +printf ("Restructuring entry\n"); +diag_display_text_element (stdout, *tx_list, ""); +#endif /* PARSER_DEBUG_B */ + + if (tx_list == (struct TEXT_ELEMENT **) 0) return -1; + if (key_string != (char *) 0) *key_string= 0; + + for (tx= tx_list;; tx= &(*tx)->TE_next) + { +ONCE_MORE: + if ((t= *tx) == (struct TEXT_ELEMENT *) 0) + { + if (insert_tail != (struct TEXT_ELEMENT *) 0) + hyx_append_tx_elem_list (tx, insert_tail); + break; + } + +#ifdef PARSER_DEBUG_B +printf ("dictadd2: level=%d last_tag_id=%d tag_name=%s\n", + t->TE_level, last_tag_id, t->TE_tag_name); +print_text_segment_list (stdout, t->TE_text_segment); +fputc ('\n', stdout); +#endif /* PARSER_DEBUG_B */ + + switch ((int) t->TE_level) + { + case 0: /* moeglicherweise getaggter Text */ + if (!any_tag_seen + || (do_strip && hyx_strip_text_elem (t) == 1) + ) goto DISCARD; + + switch ((int) last_tag_id) + { + case -1: + break; + /* hardcoded tags vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */ + case LEX_sTAG_LE: + key_length= hyx_copy_tx_segm_list (key_string, + key_string_length, t->TE_text_segment); + + /* key string untersuchen: */ + /* Spezielle Codes: -> umwandeln, neues Tag erzeugen und */ + /* VOR das jeweilige Tag einhaengen. Altes Tag auf <Le> */ + /* und folgendes auf </Le> aendern. */ + /* Upper Case Chars: -> tolower, neues Tag erzeugen und */ + /* VOR das jeweilige Tag einhaengen. Altes Tag auf <le> */ + /* und folgendes auf </le> aendern. */ + + rc= key_string_transform (key_string, key_length); + switch (rc) + { + case 1: /* mixed case characters */ + case 2: /* special codes */ + /* create new <LE>...</LE> structure and */ + /* insert that before the acutal structure */ + t1= hyx_mktx_elem_and_segm (hpc, "LE", 2L, 1L, TEt_tag, 1, 1); + t2= hyx_mktx_elem_and_segm (hpc, key_string, (long) key_length, + 0L, TEt_text, 0, 0); + t3= hyx_mktx_elem_and_segm (hpc, "/LE", 3L, 1L, TEt_tag, 1, 1); + + if (t1 == (struct TEXT_ELEMENT *) 0 + || t2 == (struct TEXT_ELEMENT *) 0 + || t3 == (struct TEXT_ELEMENT *) 0 + ) return -1; + + t1->TE_next= t2; + t2->TE_next= t3; + t3->TE_next= *last_tag; + if (insert_head != (struct TEXT_ELEMENT *) 0) + { /* insert information between newly created */ + /* <LE> structure and the previous one. */ + t5= hyx_append_tx_elem_list (&t3->TE_next, insert_head); + if (t5 != (struct TEXT_ELEMENT *) 0) t5->TE_next= *last_tag; + } + t3= *last_tag; /* save pointer of previous structure */ + *last_tag= t1; /* make insertion complete */ + + /* modify old <LE> structure to <LM> or <LX> respectively */ + t3->TE_text_segment->TSEG_text_array [0]= 'L'; + if (rc == 1) + { + t3->TE_text_segment->TSEG_text_array [1] = 'M'; + t3->TE_tag_definition= hyx_identify_tag (hpc, "LM", 1); + } else + { + t3->TE_text_segment->TSEG_text_array [1] = 'X'; + t3->TE_tag_definition= hyx_identify_tag (hpc, "LX", 1); + } + + t2= t->TE_next; + if (t2 != (struct TEXT_ELEMENT *) 0 + && t2->TE_level == 1L + && t2->TE_tag_definition->tag_id == (long) LEX_eTAG_LE) + { + t2->TE_text_segment->TSEG_text_array [1] = 'L'; + if (rc == 1) + { + t2->TE_text_segment->TSEG_text_array [2] = 'M'; + t2->TE_tag_definition= hyx_identify_tag (hpc, "/LM", 1); + } else + { + t2->TE_text_segment->TSEG_text_array [2] = 'X'; + t2->TE_tag_definition= hyx_identify_tag (hpc, "/LX", 1); + } + } + break; + default: /* keine Aenderung */ + break; + } + break; + /* hardcoded tags ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ + default: + break; + } + last_tag= (struct TEXT_ELEMENT **) 0; + last_tag_id= -1L; + break; + + case 1: /* Tag */ + any_tag_seen= 1; + td= t->TE_tag_definition; + last_tag= tx; + last_tag_id= (td == (struct TAG_DEFINITION *) 0) ? -1L : td->tag_id; + +#ifdef PARSER_DEBUG_B +printf ("dictadd2: TAG: td=0x%08lX last_tag_id=%ld\n", + td, last_tag_id); +#endif /* PARSER_DEBUG_B */ + + if (last_tag_id == SGML_TAG_frame + || last_tag_id == SGML_TAG_endframe + || last_tag_id == SGML_TAG_ned_sgml + || last_tag_id == SGML_TAG_hyx_stamp + ) goto DISCARD; + + if (last_tag_id == LEX_eTAG_LE + && insert_head != (struct TEXT_ELEMENT *) 0) + { /* an dieser Stelle ev. Textliste einfuegen */ + t4= t->TE_next; + t5= hyx_append_tx_elem_list (&t->TE_next, insert_head); + if (t5 != (struct TEXT_ELEMENT *) 0) + { + if (t5->sig != SIG_TEXT_ELEMENT + && t5->sig != SIG_MARKUP) return -1; + tx= &t5->TE_next; + t5->TE_next= t4; + goto ONCE_MORE; + } + } + + if (last_tag_id >= LEX_sTAG_LE && last_tag_id <= LEX_eTAG_LX) + break; + + tags_counted++; /* don't count discrded tags or LE tags */ + + /* eventuell hier Tag umbauen */ + break; + + default: /* anderer Tag-Level; z.B: <<xyz>> */ + /* kommt in den Muell */ +DISCARD: + *tx= t->TE_next; + t->TE_next= (struct TEXT_ELEMENT *) 0; + hyx_frtx_elem_list (t); + goto ONCE_MORE; + } + } + +#ifdef PARSER_DEBUG_B +printf ("Restructuring entry; ... done\n"); +#endif /* PARSER_DEBUG_B */ + return tags_counted; +} diff --git a/app/lexicon/dictadd2.o b/app/lexicon/dictadd2.o new file mode 100644 index 0000000000000000000000000000000000000000..c6715ac9ccbdd637ad0944cf759cb6adfcc2e3d2 Binary files /dev/null and b/app/lexicon/dictadd2.o differ diff --git a/app/lexicon/dictadd3.c b/app/lexicon/dictadd3.c new file mode 100644 index 0000000000000000000000000000000000000000..fd2f9b00868817f5e7071925d124d12eaf2ebac4 --- /dev/null +++ b/app/lexicon/dictadd3.c @@ -0,0 +1,268 @@ +/* + * FILE %lexicon/dictadd3.c + * + * - t2d: + * Beschleunigung von Updates + * + * written: 1991 03 17 + * latest update: 2000-08-26 15:16:15 + * $Id: dictadd3.c,v 1.3 2004/05/08 15:40:34 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/hytxt.h> +#include <gg/parse.h> +#include <gg/strings.h> + +#ifndef MSDOS +#include <unistd.h> +#endif + +/* ------------------------------------------------------------------------ */ +int dict_update_entry ( +struct HYX_PARSER_CLASS *hpc, +struct HYX_CLUSTER_CONTROL *hcc, +struct LEXICON_CONTROL *lcc, +char *frame_name, +struct TEXT_ELEMENT *tx_new_entry, +hyx_output_processor *op, +void *op_client_data, +int verbose_level) /* to chat or not to chat ... */ +{ + struct TEXT_ELEMENT *lexicon_entry= (struct TEXT_ELEMENT *) 0; + /* Eintrag aus dem Lexicon als Liste */ + struct ENTRY_DESCRIPTOR *ed= /* descriptor of found word */ + (struct ENTRY_DESCRIPTOR *) 0; + char *divide_file; /* file name for divide mode */ + struct LEXICON_GLOBAL_CONTROL *lgc; + int is_dirty= 0; /* entry needs to be written */ + int mode; /* processing mode, see parse.h */ + int rc; + + if (lcc == (struct LEXICON_CONTROL *) 0 + || hcc == (struct HYX_CLUSTER_CONTROL *) 0 + || (lgc= lcc->LC_lgc) == (struct LEXICON_GLOBAL_CONTROL *) 0 + ) return -1; + +{ /* ### BEGIN read_existing_entry (hcc, frame_name) ### or so ... */ + /* also merges new entry to existing entry */ + struct YTREE *yt= /* Endknoten des gesuchten bzw. */ + (struct YTREE *) 0; /* eingesetzten Wortes */ + /* return: rc, ed */ + + switch (mode= hcc->HCC_dict_mode) + { + case DAMODE_CHECK: + case DAMODE_DIVIDE1: + case DAMODE_DIVIDE2: + case DAMODE_DIVIDE3: + goto SKIP; + + case DAMODE_LOOKUP: + if ((yt= ytree_lookup_word (hcc->HCC_ytree, + (unsigned char *) frame_name)) + == (struct YTREE *) 0) + goto SKIP; + break; + + case DAMODE_MERGE: + case DAMODE_REPLACE: + if ((yt= ytree_insert_word (&hcc->HCC_ytree, + (unsigned char *) frame_name)) + == (struct YTREE *) 0) + { + fprintf (stdout, "error: dictadd1: yt == NIL !!!\n"); + return -1; + } + break; + } + + if ((ed= (struct ENTRY_DESCRIPTOR *) yt->YT_info) + == (struct ENTRY_DESCRIPTOR *) 0 + && hcc->HCC_lut_mode == HCC_lm_incremental) + { + long idx; + + if ((idx= hyx_get_index (hcc->HCC_f_idx, hcc->HCC_f_lut, hcc->HCC_f_xfn, + frame_name)) >= 0L) + { + yt->YT_info= idx; + yt->YT_flags |= YTflag_EOW; + if (ytree_index_to_entry_descriptor (yt, (void *) 0) == 0) + ed= (struct ENTRY_DESCRIPTOR *) yt->YT_info; + } + } + + if (ed == (struct ENTRY_DESCRIPTOR *) 0) + { + if (verbose_level > 0) printf ("(new) "); + if ((ed= (struct ENTRY_DESCRIPTOR *) + calloc (sizeof (struct ENTRY_DESCRIPTOR), 1)) + == (struct ENTRY_DESCRIPTOR *) 0) + { + fprintf (stdout, "error: dictadd1: ed == NIL !!!\n"); + return -1; + } + + ed->ED_status= ED_stat_is_new; + yt->YT_info= (long) ed; /* ED_index == 0L: get the next free entry */ + yt->YT_flags |= YTflag_EOW; + lexicon_entry= tx_new_entry; + tx_new_entry= (struct TEXT_ELEMENT *) 0; + } + else + { + if (ed->ED_index >= hcc->HCC_next_index) + { + fprintf (stdout, + "error: dictadd1: structural error in lexicon, %s %s %s\n", + hcc->HCC_fnm_hyx, hcc->HCC_fnm_idx, hcc->HCC_fnm_lut); + fprintf (stdout, + " ed->ED_index >= hcc->HCC_next_index! (0x%08lX >= 0x%08lX)\n", + ed->ED_index, hcc->HCC_next_index); + return -1; + } + + /* ASSERTION: at this point, ed is a pointer to the entry */ + /* descriptor of the newly read entry */ + if (mode == DAMODE_MERGE || mode == DAMODE_LOOKUP) + { + if (ed->ED_te == (struct TEXT_ELEMENT *) 0) + { + if (verbose_level > 0) printf ("(old) "); + rc= hyx_parse_hyx_frame (hpc, hcc->HCC_fnm_hyx, hcc->HCC_fnm_idx, + ed->ED_index, &lexicon_entry, + lcc->LC_end_tags, lcc->LC_end_tag_count); + + if (rc == -1) return -1; + + dict_restructure_new_entry (hpc, &lexicon_entry, (char *) 0, 0, + lcc->LC_do_strip, + (struct TEXT_ELEMENT *) 0, + (struct TEXT_ELEMENT *) 0); + } + else + { + if (verbose_level > 0) printf ("(get) "); + lexicon_entry= ed->ED_te; + + /* reset entry in entry descriptor to avoid multiple flushes */ + /* <confused> why exactly is that needed? */ + ed->ED_te= (struct TEXT_ELEMENT *) 0; + free (ed->ED_frame_name); + ed->ED_frame_name= (char *) 0; + /* </confused> */ + + lgc->LGC_EQ_count--; + } + + if (lexicon_entry == (struct TEXT_ELEMENT *) 0) + { + fprintf (stdout, "error: lexicon_entry == NIL\n"); + return -1; + } + + if (mode == DAMODE_MERGE) + { + /* Eintraege kombinieren und zu einem zusammenfassen ... */ + dict_combine_entries (&lexicon_entry, &tx_new_entry); + } + } + else + { /* check this for entries stored in the entry descriptor! */ + if (mode == DAMODE_REPLACE) + { + if (verbose_level > 0) printf ("(rep) "); + } + lexicon_entry= tx_new_entry; + tx_new_entry= (struct TEXT_ELEMENT *) 0; + } + } + +} /* ### END reading existing entry ### or so ... */ + + /* ASSERTION: at this point, ed is a pointer to the */ + /* entry descriptor of the newly read entry */ + + if (verbose_level > 0) printf ("ID=%08lX\n", ed->ED_index); + +SKIP: + switch (mode= hcc->HCC_dict_mode) + { + case DAMODE_MERGE: + case DAMODE_REPLACE: + case DAMODE_LOOKUP: + is_dirty= 1; + + if (mode == DAMODE_LOOKUP) + { + is_dirty= 0; + if (op != (hyx_output_processor *) 0) + (*op) (op_client_data, lexicon_entry); + } + +#ifdef IMMED_WRITE + if (is_dirty) + { + rc= write_lexicon_entry (hcc->HCC_fnm_hyx, hcc->HCC_fnm_idx, + &ed->ED_index, frame_name, lexicon_entry, + &hcc->HCC_next_index, lcc->LC_write_nl); + if (rc == -1) return -1; + } +#endif + + if (ed == (struct ENTRY_DESCRIPTOR *) 0) + { /* DAMODE_LOOKUP can result in a ed NIL pointer */ + break; + } + + /*** printf ("*** storing entry '%s'\n", frame_name); ***/ + ed->ED_frame_name= strdup (frame_name); + ed->ED_te= lexicon_entry; + lexicon_entry= (struct TEXT_ELEMENT *) 0; + dict_queue (lcc, ed, is_dirty); /* queue up entry */ + if (lgc->LGC_EQ_count >= lgc->LGC_queue_size) + dict_flush_queue (hcc, lcc); + break; + + case DAMODE_DIVIDE1: + case DAMODE_DIVIDE2: + case DAMODE_DIVIDE3: + if (verbose_level > 0) printf ("(divide)\n"); + divide_file= get_divided_lexicon (hcc->HCC_fnm_hyx, mode, frame_name); + hcc->HCC_next_index= -1L; + lexicon_entry= tx_new_entry; + tx_new_entry= (struct TEXT_ELEMENT *) 0; + rc= write_lexicon_entry (divide_file, hcc->HCC_fnm_idx, + &hcc->HCC_next_index, frame_name, + lexicon_entry, &hcc->HCC_next_index, 1); + if (rc == -1) return -1; + break; + + case DAMODE_CHECK: + if (verbose_level > 0) printf ("(test)\nno update\n"); + break; + } + + /* ### @@@ T2D ??? ev. loeschen */ + if (verbose_level > 1) + { + struct MARKUP *markup_new; + + if (hyx_text_to_markup (hpc, lexicon_entry, &markup_new) != -1) + { + lexicon_entry= (struct TEXT_ELEMENT *) 0; + display_markup (stdout, hpc, (struct TEXT_ELEMENT *) markup_new, 0, 1, 1, 1); + hyx_frtx_elem_list ((struct TEXT_ELEMENT *) markup_new); + } + } + + hyx_frtx_elem_list (lexicon_entry); + hyx_frtx_elem_list (tx_new_entry); + + return 0; +} diff --git a/app/lexicon/dictadd3.o b/app/lexicon/dictadd3.o new file mode 100644 index 0000000000000000000000000000000000000000..563054ee92e2751f4ccd667f2742c1b193eb4074 Binary files /dev/null and b/app/lexicon/dictadd3.o differ diff --git a/app/lexicon/dictadd4.c b/app/lexicon/dictadd4.c new file mode 100644 index 0000000000000000000000000000000000000000..b4d2dc50469808a4a152a6cbbe14aafa5e677df7 --- /dev/null +++ b/app/lexicon/dictadd4.c @@ -0,0 +1,72 @@ +/* + * FILE ~/usr/lexicon/dictadd4.c + * + * write a complete lexicon entry + * source: internal representation in memory + * destination: SGML formated representation + * + * written: 1991 03 19 + * latest update: 1995-08-19 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> +#include <gg/hytxt.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int write_lexicon_entry ( +char *lexicon_file, +char *index_file, +long *frame_index, +char *frame_name, /* name used for the frame */ +struct TEXT_ELEMENT *lexicon_entry, /* lexicon data structure */ +long *next_index, /* naechster moeglicher Index/File */ +int write_nl) /* 1 -> append LF after text */ +{ + FILE *fhyx; /* Lexicon File */ + long li_end; + long li_begin; + long li_cluster_number= 0L; + + if (*frame_index == 0L) + { + *frame_index= (*next_index)++; + /*** printf ("setting frame_index to 0x%08lX\n", *frame_index); ***/ + } + + if (*frame_index < 0L) return 0; + + if ((fhyx= flopen (lexicon_file, "ab")) == (FILE *) 0) + { + fprintf (stdout, + "ERROR: dictadd4: file %s could not be appended\n", + lexicon_file); + return -1; + } + + fseek (fhyx, 0L, 2); + + li_end= + li_begin= ftell (fhyx); + + if (write_lexicon_frame (fhyx, frame_name, lexicon_entry, write_nl) != 0) + return -1; + + li_end= ftell (fhyx) - 1L; + fputc ('\n', fhyx); + + /* printf ("written: 0x%08lX '%s'\n", *frame_index, frame_name); */ + + if (hyx_update_index (index_file, li_begin, li_end, li_cluster_number, + frame_index, next_index) != 0) + { + fprintf (stdout, + "ERROR: dictadd4: index could not be updated in file %s\n", + index_file); + return -1; + } + + return 0; +} diff --git a/app/lexicon/dictadd4.o b/app/lexicon/dictadd4.o new file mode 100644 index 0000000000000000000000000000000000000000..ab9f7d6f4126acb31fec66df0727aae1ff4a4c26 Binary files /dev/null and b/app/lexicon/dictadd4.o differ diff --git a/app/lexicon/dictadd6.c b/app/lexicon/dictadd6.c new file mode 100644 index 0000000000000000000000000000000000000000..221de59db9b1ffa07612bb4d6390d86b1e9fa646 --- /dev/null +++ b/app/lexicon/dictadd6.c @@ -0,0 +1,58 @@ +/* + * FILE %lexicon/dictadd6.c + * + * Schreiben eines Lexicon Eintrags + * + * written: 1991 03 26 + * latest update: 1996-06-09 11:06:41 + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +static int t_open= '<'; +static int t_close= '>'; + +/* ------------------------------------------------------------------------ */ +int write_lexicon_text (FILE *fhyx, struct TEXT_ELEMENT *le, int write_nl) +{ + struct MARKUP *m; + + /* Eintrag schreiben */ + for (; le != (struct TEXT_ELEMENT *) 0; le= le->TE_next) + { + if (le->sig == SIG_MARKUP) + { + m= (struct MARKUP *) le; + write_lexicon_text (fhyx, m->tag_open, write_nl); + write_lexicon_text (fhyx, m->tagged_text, write_nl); + write_lexicon_text (fhyx, m->tag_close, write_nl); + } + else + if (le->sig == SIG_TEXT_ELEMENT) + { + if (le->TE_level == 0) + { + print_text_segment_list (fhyx, le->TE_text_segment); + } + else + if (le->TE_level == 1) + { + struct TEXT_SEGMENT *txs; + int first_char; + + if ((txs= le->TE_text_segment) != (struct TEXT_SEGMENT *) 0) + { + if (write_nl && txs->TSEG_text_array [0] != '/') fputc ('\n', fhyx); + fputc (t_open, fhyx); + first_char= print_text_segment_list (fhyx, txs); + fputc (t_close, fhyx); + } + } + } + } + + return 0; +} diff --git a/app/lexicon/dictadd6.o b/app/lexicon/dictadd6.o new file mode 100644 index 0000000000000000000000000000000000000000..8aee34207a7ca16b50a8fbabc504139475b4b517 Binary files /dev/null and b/app/lexicon/dictadd6.o differ diff --git a/app/lexicon/dictadd8.c b/app/lexicon/dictadd8.c new file mode 100644 index 0000000000000000000000000000000000000000..943a148fb91589ef97b990e6104a73985968f62d --- /dev/null +++ b/app/lexicon/dictadd8.c @@ -0,0 +1,63 @@ +/* + * FILE %usr/lexicon/dictadd8.c + * + * written: 1991 04 12 + * 1995-08-23 + * latest update: 2001-02-18 19:26:18 + * $Id: dictadd8.c,v 1.2 2001/02/19 00:27:17 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int dict_purge_entry ( +struct TEXT_ELEMENT **tx_list, +long purge_tags [], +int purge_tags_flags [], +int purge_tags_cnt) +{ + long last_tag_id= -1L; + struct TEXT_ELEMENT **tx, *t; + struct TAG_DEFINITION *td; + int purge_text= 0; + int i; + + if (tx_list == (struct TEXT_ELEMENT **) 0) return -1; + + for (tx= tx_list;; tx= &(*tx)->TE_next) + { +ONCE_MORE: + if ((t= *tx) == (struct TEXT_ELEMENT *) 0) break; + switch ((int) t->TE_level) + { + case 0: /* moeglicherweise getaggter Text */ + if (last_tag_id != -1L && purge_text) goto DISCARD; + last_tag_id= -1L; + break; + + case 1: /* Tag */ + td= t->TE_tag_definition; + last_tag_id= (td == (struct TAG_DEFINITION *) 0) ? -1L : td->tag_id; + purge_text= 0; + for (i= 0; i < purge_tags_cnt; i++) + if (last_tag_id == purge_tags [i]) + { + purge_text= purge_tags_flags [i]; + goto DISCARD; + } + break; + + default: /* anderer Tag-Level; z.B: <<xyz>> */ + /* kommt in den Muell */ +DISCARD: + *tx= t->TE_next; + t->TE_next= (struct TEXT_ELEMENT *) 0; + hyx_frtx_elem_list (t); + goto ONCE_MORE; + } + } + + return 0; +} diff --git a/app/lexicon/dictadd8.o b/app/lexicon/dictadd8.o new file mode 100644 index 0000000000000000000000000000000000000000..017955ed18900e6d5a2a45bee6ee5de6a0a8ef6e Binary files /dev/null and b/app/lexicon/dictadd8.o differ diff --git a/app/lexicon/dictadd9.c b/app/lexicon/dictadd9.c new file mode 100644 index 0000000000000000000000000000000000000000..d0df83233f909a4510ff6014f6eeab006eda34e9 --- /dev/null +++ b/app/lexicon/dictadd9.c @@ -0,0 +1,63 @@ +/* + * FILE %usr/lexicon/dictadd9.c + * + * int dict_combine_entries () + * + * written: 1991 04 12 + * 1995-07-16 + * latest update: 2001-02-18 19:22:08 + * $Id: dictadd9.c,v 1.2 2001/02/19 00:27:18 gonter Exp $ + * + */ + + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/sgml.h> + +/* ------------------------------------------------------------------------ */ +#define purge_cnt_old 4 +static long purge_list_old [purge_cnt_old] = +{ + SGML_TAG_frame, SGML_TAG_endframe, + SGML_TAG_ned_sgml, SGML_TAG_hyx_stamp +} ; + +static int purge_flags_old [purge_cnt_old] = { 0, 0, 0, 0 } ; + +/* ------------------------------------------------------------------------ */ +#define purge_cnt_new 6 +static long purge_list_new [purge_cnt_new] = +{ + SGML_TAG_frame, SGML_TAG_endframe, + SGML_TAG_ned_sgml, SGML_TAG_hyx_stamp, + LEX_sTAG_LE, LEX_eTAG_LE +} ; + +static int purge_flags_new [purge_cnt_new]= { 0, 0, 0, 0, 1, 0 } ; + +/* ------------------------------------------------------------------------ */ +int dict_combine_entries ( +struct TEXT_ELEMENT **tx_old, +struct TEXT_ELEMENT **tx_new) +{ + struct TEXT_ELEMENT **tx; + + if (tx_new == (struct TEXT_ELEMENT **) 0 + || tx_old == (struct TEXT_ELEMENT **) 0 + ) return -1; + + dict_purge_entry (tx_old, purge_list_old, purge_flags_old, purge_cnt_old); + dict_purge_entry (tx_new, purge_list_new, purge_flags_new, purge_cnt_new); + + /* look for the end of the old entry */ + for (tx= tx_old; *tx != (struct TEXT_ELEMENT *) 0; tx= &(*tx)->TE_next); + + /* append new list to old list */ + *tx= *tx_new; + + /* note: tx_new is now more or less invalid (or not so??) */ + *tx_new= (struct TEXT_ELEMENT *) 0; + + return 0; +} diff --git a/app/lexicon/dictadd9.o b/app/lexicon/dictadd9.o new file mode 100644 index 0000000000000000000000000000000000000000..3b956814122f9cc2490235a71f54e6ad5ba12386 Binary files /dev/null and b/app/lexicon/dictadd9.o differ diff --git a/app/lexicon/dictmod b/app/lexicon/dictmod new file mode 100755 index 0000000000000000000000000000000000000000..cad38f2485cb9398107b66a6512275e8c70d8058 Binary files /dev/null and b/app/lexicon/dictmod differ diff --git a/app/lexicon/dictmod.c b/app/lexicon/dictmod.c new file mode 100644 index 0000000000000000000000000000000000000000..596ac9063e754a049581fd77175fe0d39a126e11 --- /dev/null +++ b/app/lexicon/dictmod.c @@ -0,0 +1,447 @@ +/* + * FILE %lexicon/dictmod.c + * + * general sequential lexicon processor for modification and filtering + * - HELP + * + * processors: are used to modify the contents of the lexicon + * filters: are used to extract certain information of the lexicon + * + * installed processors: + * 1. purge (don't process, only write sequentially) + * 2. extract some frames + * + * installed filters: + * (none sofar) + * + * written: 1991 04 14 + * latest update: 1996-02-17 13:51:56 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/parse.h> +#include <gg/sgml.h> +#include <gg/lookup.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/hytxt.h> +#ifdef MSDOS +#include <io.h> +#include <dos.h> +#include <conio.h> +#include <gg/fnames.h> +#else +#include <unistd.h> +#endif +#include "lexproc.h" + +#define STDHLP stdout +#define ARG_C_max 24 +static char *arg_v [ARG_C_max]; +static int arg_c = 0; + +/* extern int errno; ... defined in <stdlib.h> */ + +/* ------------------------------------------------------------------------ */ +static int verbose_mode = 0; + +#ifdef MSDOS +#define FILENAME_SIZE 66 +static char tag_definition [FILENAME_SIZE] = "c:/etc/lexicon.tag"; +#else +#define FILENAME_SIZE 256 +static char tag_definition [FILENAME_SIZE] = "/home/gonter/etc/lexicon.tags"; +#endif + +static int setup_readin=0; +static char lexicon_setup [FILENAME_SIZE] = "alexicon.stp"; +static char lexicon_file [FILENAME_SIZE] = "alexicon.hyx"; +static char lexicon_temp [FILENAME_SIZE] = "alexicon.hy$"; +static char lexicon_back [FILENAME_SIZE] = "alexicon.$hy"; +static char index_file [FILENAME_SIZE] = "alexicon.idx"; +static char index_temp [FILENAME_SIZE] = "alexicon.ix$"; +static char index_back [FILENAME_SIZE] = "alexicon.$ix"; +static char main_lut_file [FILENAME_SIZE] = "alexicon.lut"; + +static char line [256]; + +static long end_tags[1] = { (long) SGML_TAG_endframe } ; + +/* processing done over the lexicon --------------------------------------- */ +static int processing_mode=0; +#define FILTER_LEXICON 0 /* -> don't modify lexicon (filter) */ +#define MODIFY_LEXICON 1 /* -> modify lexicon */ + +static int read_mode=1; +#define NOREAD_LEXICON 0 +#define READ_LEXICON 1 + +static int processor=0; +#define PROCESSOR_UNDEFINED 0 +#define PROCESSOR_PURGE 1 +#define PROCESSOR_BY_SIZE 2 +#define PROCESSOR_NTH 3 + +static long extract_nth; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: dictmod [options] {file name}\n", + " modify lexicon files\n", + "\n", + "OPTIONS:\n", + " -f<filename> ... List of Files\n", + " -t<filename> ... tag definition file\n", + " -s<filename> ... lexicon setup file\n", + " -v ... Verbose Mode\n", + "\n", + "PROCESSING:\n", + " -p ... purge\n", + " -l ... extract the largest entry\n", + " -n<n> ... extract every n-th entry\n", + "\n", + "(@)Adictmod.c 1.19 #D$1995-01-20 9:30:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +static int cdecl read_setup_file (char *fn); +static int modify_dictionary (struct HYX_PARSER_CLASS *hpc); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + struct HYX_PARSER_CLASS *hpc; + + if (argc <= 1 + || (hpc= hyx_new_parser_class ()) == (struct HYX_PARSER_CLASS *) 0 + ) goto HLP; + + for (i= 1; i < argc; i++) + if (argv [i][0] == '-' || argv [i][0] == '/') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + case 's': case 'S': + strcpy (lexicon_setup, &argv[i][2]); + read_setup_file (lexicon_setup); + setup_readin=1; + break; + case 't': case 'T': + strcpy (tag_definition, &argv[i][2]); + break; + case 'p': case 'P': + processor = PROCESSOR_PURGE; + processing_mode = MODIFY_LEXICON; + read_mode = READ_LEXICON; + break; + case 'l': case 'L': + processor = PROCESSOR_BY_SIZE; + processing_mode = FILTER_LEXICON; + read_mode = NOREAD_LEXICON; + break; + case 'n': case 'N': + processor = PROCESSOR_NTH; + processing_mode = FILTER_LEXICON; + read_mode = NOREAD_LEXICON; + sscanf (&argv [i][2], "%ld", &extract_nth); + break; + + case 'v': case 'V': + for (j=1; argv [i][j]; j++) + switch (argv [i][j]) + { + case 'v': case 'V': + verbose_mode = 1; + break; + } + break; + +HLP: +#include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + if (PROCESSOR_UNDEFINED) + fprintf (stdout, "no processor defined!\n"); + else + { + if (!setup_readin) read_setup_file (lexicon_setup); + hyx_read_tag_definition (hpc, tag_definition); + modify_dictionary (hpc); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +static int read_setup_file (char *fn) +{ + FILE *fi; + + if (fn == (void *) 0 || *fn == 0) return 0; + + /* read lexicon setup file */ + if ((fi= fopen (fn, "rt")) == (FILE *) 0) + { + /******** + fprintf (stdout, "error opening setup file \'%s\'\n", fn); + fprintf (stdout, "... using default values\n"); + ********/ + return 0; + } + for (;;) + { + fscanf (fi, "%s", line); + if (feof (fi)) break; + if (line [0] == '#') + { +READ_NEXT: + trash_until_eol (fi); + continue; + } + if (strncmp (line, "lex", 3)==0) + { + fscanf (fi, "%s", lexicon_file); + } else + if (strncmp (line, "tlex", 4)==0) + { + fscanf (fi, "%s", lexicon_temp); + } else + if (strncmp (line, "blex", 4)==0) + { + fscanf (fi, "%s", lexicon_back); + } else + if (strncmp (line, "idx", 3)==0) + { + fscanf (fi, "%s", index_file); + } else + if (strncmp (line, "tidx", 4)==0) + { + fscanf (fi, "%s", index_temp); + } else + if (strncmp (line, "bidx", 4)==0) + { + fscanf (fi, "%s", index_back); + } else + if (strncmp (line, "main", 4)==0) + { + fscanf (fi, "%s", main_lut_file); + } else + if (strncmp (line, "tag", 3)==0) + { + fscanf (fi, "%s", tag_definition); + } else goto READ_NEXT; + } + fclose (fi); + return 0; +} + +/* ------------------------------------------------------------------------ */ +static int modify_dictionary (struct HYX_PARSER_CLASS *hpc) +{ + FILE *fi_hyx; /* lexicon file input */ + FILE *fo_hyx= (FILE *) 0; /* lexicon file output */ + FILE *fi_idx; /* lndex file input */ + FILE *fo_idx= (FILE *) 0; /* index file output */ + struct stat st; /* index file status and size */ + struct LEXICON_INDEX idx_in; /* index record read from fi_idx */ + struct LEXICON_INDEX idx_out; /* index record to write to fo_idx */ + struct TEXT_ELEMENT *tx_entry; /* raw form of lexicon entry */ + long next_index; /* next valid index possible */ + long current_index; /* currently processed index number */ + long fo_hyx_position= 0L; /* current write address in lexicon file */ + long chars_read; /* characters read from the lexicon file */ + int flag_write_frame_tags= 0; /* 1 -> write frame information too... */ + int rc; + + if (stat (index_file, &st) && errno == ENOENT) + { + fprintf (stdout, "error: index file is empty; nothing to do...\n"); + return -1; + } + next_index = st.st_size / sizeof (struct LEXICON_INDEX); + + /* opening files ... */ + if ((fi_idx= fopen (index_file, "rb")) == (FILE *) 0) + { + fprintf (stdout, "error opening index file for input!\n"); + return -1; + } + + if ((fi_hyx= fopen (lexicon_file, "rb")) == (FILE *) 0) + { + fprintf (stdout, "error opening lexicon file for input!\n"); + fclose (fi_idx); + return -1; + } + + if (processing_mode == MODIFY_LEXICON) + { + if ((fo_idx= fopen (index_temp, "wb")) == (FILE *) 0) + { + fprintf (stdout, "error opening temporary index file for output!\n"); + fclose (fi_idx); + fclose (fi_hyx); + return -1; + } + + if ((fo_hyx= fopen (lexicon_temp, "wb")) == (FILE *) 0) + { + fprintf (stdout, "error opening temporary lexicon file for output!\n"); + fclose (fi_idx); + fclose (fi_hyx); + fclose (fo_idx); + return -1; + } + + /* preparing files: dummy index 0 and lexicon signature */ + fprintf (fo_hyx, "<ned.sgml enc=\"LEX\">\n"); + hyx_write_stamp (fo_hyx, "pgm=dictmod"); + fputc ('\n', fo_hyx); + fo_hyx_position= ftell (fo_hyx); + } + + switch (processor) + { + case PROCESSOR_BY_SIZE: + init_by_size (0, 0); /* #### */ + break; + } + + /* process all records */ + for (current_index = 0L; + current_index < next_index; + current_index++) + { + idx_in.LEXI_begin = dpp_fread_long (fi_idx, 4); + idx_in.LEXI_end = dpp_fread_long (fi_idx, 4); + idx_in.LEXI_cluster_number = dpp_fread_long (fi_idx, 4); + + if (idx_in.LEXI_begin == -1L || idx_in.LEXI_begin == 0L) + { /* dummy, empty, deleted or invalid index */ + fprintf (stdout, + "[0x%08lX] *dummy* begin=0x%08lX end=0x%08lX cluster=0x%lX\n", + current_index, idx_in.LEXI_begin, idx_in.LEXI_end, + idx_in.LEXI_cluster_number); + if (processing_mode == MODIFY_LEXICON) + { + dpp_fwrite_long (fo_idx, idx_in.LEXI_begin, 4); + dpp_fwrite_long (fo_idx, idx_in.LEXI_end, 4); + dpp_fwrite_long (fo_idx, idx_in.LEXI_cluster_number, 4); + } + continue; + } + + if (read_mode == READ_LEXICON) + { + fseek (fi_hyx, idx_in.LEXI_begin, 0); + rc= hyx_parse1_file (hpc, fi_hyx, &tx_entry, end_tags, 1, + 0x7FFFFFFFL, &chars_read); + if (rc != 0 || chars_read == 0L) + { + fprintf (stdout, + "[0x%08lX] *empty entry* rc=%d chars_read=%ld\n", + current_index, rc, chars_read); + fprintf (stdout, + "[0x%08lX] *empty entry* begin=0x%08lX end=0x%08lX cluster=%lX\n", + current_index, + idx_in.LEXI_begin, idx_in.LEXI_end, idx_in.LEXI_cluster_number); + + if (processing_mode == MODIFY_LEXICON) + { + printf (" ... reset to -1L\n"); + dpp_fwrite_long (fo_idx, -1L, 4); + dpp_fwrite_long (fo_idx, -1L, 4); + dpp_fwrite_long (fo_idx, -1L, 4); + } + continue; + } + } + + switch (processor) + { +#ifdef __COMMENT__ + /* this shows how a processor function should be called */ + /* flags are to be set if necesseray ... */ + case PROCESSOR_XXXX: + process_XXXX (&tx_entry, additional parameters, etc...); + flag_write_frame_tags = 0 .. 1; + break; +#endif + case PROCESSOR_PURGE: + /* do nothing ... */ + flag_write_frame_tags= 0; + break; + case PROCESSOR_BY_SIZE: + process_by_size (&idx_in); + break; + case PROCESSOR_NTH: + if (((current_index+1) % extract_nth) == 0L) + { + fseek (fi_hyx, idx_in.LEXI_begin, 0); + ftransfer (fi_hyx, stdout, idx_in.LEXI_end-idx_in.LEXI_begin+1L); + printf ("\n"); + } + break; + } + + if (processing_mode == MODIFY_LEXICON) + { + /* write entry */ + idx_out.LEXI_begin = ftell (fo_hyx); + if (flag_write_frame_tags) fprintf (fo_hyx,"<:LX%08lX>",current_index); + write_lexicon_text (fo_hyx, tx_entry, 1); + if (flag_write_frame_tags) fprintf (fo_hyx, "<;>"); + idx_out.LEXI_end = ftell (fo_hyx) - 1L; + idx_out.LEXI_cluster_number = idx_in.LEXI_cluster_number; + fputc ('\n', fo_hyx); /* just for a bit readability ... */ + + /* write index */ + dpp_fwrite_long (fo_idx, idx_out.LEXI_begin, 4); + dpp_fwrite_long (fo_idx, idx_out.LEXI_end, 4); + dpp_fwrite_long (fo_idx, idx_out.LEXI_cluster_number, 4); + } + + hyx_frtx_elem_list (tx_entry); + } + + switch (processor) + { + case PROCESSOR_BY_SIZE: + finish_by_size (fi_hyx, stdout); + break; + } + + fclose (fi_idx); + fclose (fi_hyx); + if (processing_mode == MODIFY_LEXICON) + { + fclose (fo_idx); + fclose (fo_hyx); + unlink (lexicon_back); + rename (lexicon_file, lexicon_back); + rename (lexicon_temp, lexicon_file); + unlink (index_back); + rename (index_file, index_back); + rename (index_temp, index_file); + } + + return 0; +} diff --git a/app/lexicon/dictmod.o b/app/lexicon/dictmod.o new file mode 100644 index 0000000000000000000000000000000000000000..4626382229b8e1112d8389f91c22ec388b8a5e15 Binary files /dev/null and b/app/lexicon/dictmod.o differ diff --git a/app/lexicon/gg b/app/lexicon/gg new file mode 120000 index 0000000000000000000000000000000000000000..7b7c80811f4d282d5ba38a29e0f67cf0b8335b96 --- /dev/null +++ b/app/lexicon/gg @@ -0,0 +1 @@ +../../lib/include/gg \ No newline at end of file diff --git a/app/lexicon/grtag.pl b/app/lexicon/grtag.pl new file mode 100644 index 0000000000000000000000000000000000000000..926511d46469fc852aeddf5bf45ef4835756af7c --- /dev/null +++ b/app/lexicon/grtag.pl @@ -0,0 +1,267 @@ +# +# FILE %lexicon/grtag.pl +# +# written: 1995-12-10 +# latest update: 1995-12-10 +# +# NOTES +# Anforderung und Wuensche an einen Wort Tagger: +# - *bar$ -> absperrbar, Salatbar (N) +# - Erkennung von Umlauten aus ae, oe, ue Konstruktionen +# - Erkennung von ß aus ss Konstruktionen +# + +$mode= 'diag'; # report strange or difficult entries +# $mode= 'tag'; # normal tagging operation +# $mode= 'stat'; # print statistics only... + +while (<>) +{ + chop; + + next if (/^#/); + $found= 0; + $total++; + + ($N_pos, $N_ty)= &identify_german_noun ($_); + $found++ if ($N_pos ne '-'); + + ($J_pos, $J_ty)= &identify_german_adjective ($_); + $found++ if ($J_pos ne '-'); + + ($A_pos, $A_ty)= &identify_german_adverb ($_); + $found++ if ($A_pos ne '-'); + + ($V_pos, $V_ty)= &identify_german_verb ($_); + $found++ if ($V_pos ne '-'); + + # statistics + $CNT{'MULTI'}++ if ($found > 1); + if ($found == 1) + { + $CNT{'N'}++ if ($N_pos ne '-'); + $CNT{'J'}++ if ($J_pos ne '-'); + $CNT{'V'}++ if ($V_pos ne '-'); + $CNT{'A'}++ if ($A_pos ne '-'); + } + $CNT{'NONE'}++ if ($found == 0); + + if ($found > 1 && $mode eq 'diag') + { + print "$N_pos:$J_pos:$A_pos:$V_pos:$_\n"; + next; + } + + if ($found == 1 && $mode eq 'tag') + { + if ($N_pos ne '') + { + if ($N_ty ne '') { $N_ty= " t=$N_ty"; } + print "$_:<F f=$N_pos l=g$N_ty xt=gen>\n"; + } + + if ($J_pos ne '') + { + if ($J_ty ne '') { $J_ty= " t=$J_ty"; } + print "$_:<F f=$J_pos l=g$J_ty xt=gen>\n"; + } + + if ($A_pos ne '') + { + if ($A_ty ne '') { $A_ty= " t=$A_ty"; } + print "$_:<F f=$A_pos l=g$A_ty xt=gen>\n"; + } + + if ($V_pos ne '') + { + if ($V_ty ne '') { $V_ty= " t=$V_ty"; } + print "$_:<F f=$V_pos l=g$V_ty xt=gen>\n"; + } + + next; + } + + if ($mode eq 'tag') + { # at this point, print everything that's not identifyable... + print "$_:<F l=g>\n"; + } +} + +foreach $cat (keys %CNT) +{ + $pct= int (100*$CNT{$cat}/$total); + printf ("# %-8s %8s (%3s%%)\n", $cat, $CNT{$cat}, $pct); +} +printf ("# ------------------------\n", 'total', $total, '100'); +printf ("# %-8s %8s (%3s%%)\n", 'total', $total, '100'); + +exit (0); + +# ---------------------------------------------------------------------------- +sub identify_german_noun +{ + local ($wort)= $_[0]; + + # GG + return ('N', 'f') if ($wort =~ /.bar$/); + + # Fleischer p. 198 + return ('N', 'n') if ($wort =~ /.zeug$/); + return ('N', 'n') if ($wort =~ /.werk$/); + return ('N', 'n') if ($wort =~ /.wesen$/); + return ('N', 'n') if ($wort =~ /.gut$/); + + # Fleischer p. 152 + return ('N', 'f') if ($wort =~ /.igkeit$/); + return ('N', 'f') if ($wort =~ /.keit$/); + return ('N', 'f') if ($wort =~ /.heit$/); + + # Fleischer p. 154 + # return ('N', '') if ($wort =~ /.icht$/); + # !! abricht + + # Fleischer p. 155 + return ('N', '') if ($wort =~ /ling$/); + + # Fleischer p. 157 + return ('N', '') if ($wort =~ /.nis$/); + + # Fleischer p. 159 + return ('N', 'n') if ($wort =~ /.sal$/); + + # Fleischer p. 160 + return ('N', '') if ($wort =~ /.sel$/); + return ('N', 'f') if ($wort =~ /.schaft$/); + + # Fleischer p. 163 + return ('N', 'mn') if ($wort =~ /.tum$/); # m=Reichtum, n=Eigentum + + # Fleischer p. 164 + return ('N', 'f') if ($wort =~ /.ung$/); + + # Fleischer p. 178 + # return ('N', 'n') if ($wort =~ /.chen$/); + # !! abgleichen + return ('N', 'n') if ($wort =~ /.lein$/); + + # Fleischer p. 189, ff + # return ('N', 'f') if ($wort =~ /.ade$/); + # !! Ade + # return ('N', 'f') if ($wort =~ /.age$/); + # !! absage, Anlage + return ('N', 'f') if ($wort =~ /.aille$/); + # return ('N', 'f') if ($wort =~ /.elle$/); + # !! Geselle, Stelle + return ('N', 'f') if ($wort =~ /.enz$/); + return ('N', 'f') if ($wort =~ /.anz$/); + # return ('N', 'f') if ($wort =~ /esse$/); + # !! abschliesse + # return ('N', 'f') if ($wort =~ /iere$/); + # !! abonniere + return ('N', 'f') if ($wort =~ /.ik$/); + return ('N', 'f') if ($wort =~ /.ion$/); + return ('N', 'f') if ($wort =~ /.ose$/); + return ('N', 'f') if ($wort =~ /.t&aauml;t$/); + return ('N', 'f') if ($wort =~ /.taet$/); # UML!!! + # return ('N', 'f') if ($wort =~ /ur$/); + # !! nur + + # Fleischer p. 194, ff + return ('N', 'm') if ($wort =~ /.ant$/); + # return ('N', 'm') if ($wort =~ /.ent$/); + # !! abgedient + return ('N', 'm') if ($wort =~ /.eur$/); + return ('N', 'm') if ($wort =~ /.ismus$/); + return ('N', 'm') if ($wort =~ /.asmus$/); + return ('N', 'm') if ($wort =~ /.ist$/); + # !! abgespeist + # return ('N', 'm') if ($wort =~ /or$/); + # !! sonor + + # Fleischer p. 196, ff + # return ('N', 'mn') if ($wort =~ /ar$/); + # !! absperrbar, sogar + # return ('N', 'mn') if ($wort =~ /är$/); + # !! elitaer + # return ('N', 'mn') if ($wort =~ /at$/); + # !! abtrat + # return ('N', 'mn') if ($wort =~ /ier$/); + # !! aasgeier + # return ('N', 'mn') if ($wort =~ /it$/); + # !! soweit + + # Fleischer p. 197, ff + return ('N', 'n') if ($wort =~ /.arium$/); + return ('N', 'n') if ($wort =~ /.ament$/); + return ('N', 'n') if ($wort =~ /.ement$/); + + return ('-', ''); +} + +# ---------------------------------------------------------------------------- +sub identify_german_adjective +{ + local ($wort)= $_[0]; + + # GG: word stemmer + if ($wort =~ /(.+)er$/) { $wort= $1; } + if ($wort =~ /(.+)e$/) { $wort= $1; } + + # Fleischer p. 251 + return ('J', '') if ($wort =~ /.bar$/); + + # Fleischer p. 253 + return ('J', '') if ($wort =~ /.lich$/); + return ('J', '') if ($wort =~ /.sam$/); + return ('J', '') if ($wort =~ /.faehig$/); # UML !!! + return ('J', '') if ($wort =~ /.fähig$/); + + # Fleischer p. 257 + return ('J', '') if ($wort =~ /.haft$/ && !($wort =~ /.schaft/)); + + # Fleischer p. 259 + return ('J', '') if ($wort =~ /.isch$/); + return ('J', '') if ($wort =~ /.los$/); + + # Fleischer p. 274 + return ('J', '') if ($wort =~ /.aessig$/); + return ('J', '') if ($wort =~ /.ässig$/); # UML !!! + return ('J', '') if ($wort =~ /.ä$szlig;ig$/); # UML !!! + + return ('-', ''); +} + + +# ---------------------------------------------------------------------------- +sub identify_german_adverb +{ + local ($wort)= $_[0]; + + # Fleischer p. 297 + return ('A', '') if ($wort =~ /.her$/); + return ('A', '') if ($wort =~ /.hin$/); + + + return ('-', ''); +} + +# ---------------------------------------------------------------------------- +sub identify_german_verb +{ + local ($wort)= $_[0]; + + # Fleischer p. 322 + return ('V', '') if ($wort =~ /..ieren$/); + # keine Nieren bitte... + + + return ('-', ''); +} + +# ---------------------------------------------------------------------------- +sub identify_whatever +{ + local ($wort)= $_[0]; + + return ('-', ''); +} diff --git a/app/lexicon/http4lex.pl b/app/lexicon/http4lex.pl new file mode 100644 index 0000000000000000000000000000000000000000..8d73885cebaf046a429d78513f7f14d4bd986dcc --- /dev/null +++ b/app/lexicon/http4lex.pl @@ -0,0 +1,250 @@ +#!/usr/local/bin/perl +# FILE ~/usr/lexicon/http4lex.pl +# +# format frames from a lexicon as a filter stage of a HTTP4HYX server +# see also: lexicon.hyx +# +# written: 1995-01-18 +# latest update: 1995-02-19 +# +# ---------------------------------------------------------------------------- + +# $lex_path= '/afs/wu-wien.ac.at/public/usr/edvz/gonter/lexicon/'; + +# setup tag names (see "tags") +$tag_type{'DT'}= 'descriptive text'; +$tag_type{'HP'}= 'hyphenation'; +$tag_type{'TE'}= 'translation'; +$tag_type{'WF'}= 'word form'; +$tag_type{'CR'}= 'concept reference to'; +$tag_type{'AE'}= 'alternative entry'; + +# setup langauage codes (see "language ID") +$lang{'e'}= ' (english)'; +$lang{'g'}= ' (german)'; +$lang{'d'}= ' (dutch)'; +$lang{'s'}= ' (spanish)'; +$lang{'f'}= ' (french)'; +$lang{'i'}= ' (italian)'; + +# setup lexicon function codes (see "function codes") +$func_code{'a'}= ' archaic'; +$func_code{'b'}= ' abbreviation'; +$func_code{'c'}= ' capital'; +$func_code{'d'}= ' dialectical'; +$func_code{'e'}= ' erroneous'; +$func_code{'f'}= ' alien'; +$func_code{'h'}= ' rhetoric'; +$func_code{'n'}= ' nonsense'; +$func_code{'o'}= ' obsolete'; +$func_code{'p'}= ' poetical'; +$func_code{'q'}= ' colloquial'; +$func_code{'r'}= ' rare'; +$func_code{'s'}= ' standard'; +$func_code{'w'}= ' nonce word'; +$func_code{'x'}= ' specialised'; +$func_code{'z'}= ' substandard'; +$func_code{'A'}= ' adverb'; +$func_code{'B'}= ' broken word'; +$func_code{'C'}= ' conjunction'; +$func_code{'D'}= ' name'; +$func_code{'E'}= ' suffix'; +$func_code{'F'}= ' prefix'; +$func_code{'G'}= ' (appended)'; +$func_code{'H'}= ' hyphenated'; +$func_code{'I'}= ' interjection'; +$func_code{'J'}= ' adjective'; +$func_code{'K'}= ' *ENZYCLOPEDIC*'; +$func_code{'L'}= ' phrase'; +$func_code{'M'}= ' morpheme'; +$func_code{'N'}= ' noun'; +$func_code{'O'}= ' other'; +$func_code{'P'}= ' past participle'; +$func_code{'R'}= ' preposition'; +$func_code{'S'}= ' syllable'; +$func_code{'U'}= ' pronoun'; +$func_code{'V'}= ' verb'; +$func_code{'Y'}= ' *CONCEPT*'; + +# $req= <STDIN>; # read request line +# print "Content-Type: text/html\n"; +# print ""; +# print "<PRE>\n"; + +alex_line: while (<STDIN>) +{ + chop; + if (/<;/) + { + # print "\n"; + next alex_line; + } + + if (/^<:/||/<;/||/<JF /) + { + next alex_line; + } + + if (/^<IS /||/^<II /||/^<I /||/<SE>/) + { + next alex_line; + } + + if (/^<LE>/) + { + $x= substr ($_, 4); + ($word, $rest)= split (/</, $x); + print "<title>MRLEX $word</title>\n"; + print "<h1>$word</h1>\n"; + next alex_line; + } + + if (/^<F /) + { + $func= substr($_,1); + ($func, $rest)= split ('>', $func); + $func= &disp_F(substr($func,2)); + if ($func ne '' && $func ne ' ') { print "<dd>function: ".$func."\n"; } + next alex_line; + } + + if (/^<SL /) + { + ($inf, $ref)= split (/>/, $_); + @p= split(' ',$inf); + $refl= $ref; + $refl=~ s/ /_b/g; + $refl=~ y/A-Z/a-z/; + print '<dd>see also ('.$p[1].'): <a href='.$refl.'>'.$ref.'</a>'."\n"; + next alex_line; + } + + if (/^<DT /||/^<TE /||/^<HP>/||/^<WF /||/^<CR>/||/^<AE /) + { + ($func, $text)= split ('>', $_); + ($text, $rest)= split ('<', $text); + $pos= index($func, ' '); + $tag= ($pos == -1) ? substr($func,1) : substr($func,1,$pos-1); + $func= &disp_F($func,$pos+1); + if ($tag eq 'TE' || $tag eq 'WF' || $tag eq 'CR' || $tag eq 'AE') + { + $refl= $text; + $refl=~ s/ /_b/g; + $refl=~ y/A-Z/a-z/; + $text='<a href='.$refl.'>'.$text.'</a>' + } + print "<dd>$tag_type{$tag}$func: $text\n"; + next alex_line; + } + + if (/^<xxM-/||/^<FJ /) + { + next alex_line; + } + + $x= $_; + $x=~ s/</</g; + $x=~ s/>/>/g; + print '<dd>'.$x."\n"; +} + +# print "</PRE>\n"; + +exit (0); + +sub disp_F +{ + local($code)= $_[0]; # contents of a tag, e.g. a <F> tag + local($x); + local($y); + local($refl); + local($rv)= ''; + local($pos); + +func: while ($code ne '') + { +# print "disp_F: begin code='$code'\n"; + if ($code =~ /^\?/ + || $code =~ /^s=/ + || $code =~ /^t=/) + { +# print "disp_F: junk code='$code'\n"; + $pos= index($code,' '); + $code= ($pos == -1) ? '' : substr($code, $pos+1); + next func; + } + + if ($code =~ /^cpt=/) + { + $pos= index($code,'" '); + $x= ($pos == -1) ? substr($code,5,length($code)-6):substr($code,5, $pos-6); +# print "disp_F: cpt x='$x'\n"; + $x=~ s/\"//; + $refl= $x; + $refl=~ s/ /_b/g; + $refl=~ y/A-Z/a-z/; + $rv= $rv.' [referenced by concept: <a href='.$refl.'>'.$x.'</a>]'; + $code= ($pos == -1) ? '' : substr($code, $pos+2); + next func; + } + + if ($code =~ /^l=/) + { + $pos= index($code,' '); + $x= ($pos == -1) ? $code : substr($code,0,$pos); +# print "disp_F: l x='$x'\n"; + $y= $x; + $x= $lang{substr($x,2)}; + if ($x eq '') { $x= $y; } + $code= ($pos == -1) ? '' : substr($code, $pos+1); + $rv= $rv.$x; + next func; + } + + if ($code =~ /^f=/) + { + $pos= index($code,' '); + $x= ($pos == -1) ? $code : substr($code,2,$pos-2); +# print "disp_F: f x='$x'\n"; + $rv= $rv.&disp_F_f($x); + $code= ($pos == -1) ? '' : substr($code, $pos+1); + next func; + } + + if ($code =~ /^ /) + { + $code= substr($code, 1); + } + + if ($code =~ /^=/) + { + $pos= index($code,' '); + $x= $lang{substr($code,0,$pos)}; +# print "disp_F: x='$x'\n"; + $rv= $rv.$x; + $code= ($pos == -1) ? '' : substr($code, $pos); + next func; + } + + $pos= index($code,' '); + $x= substr($code,0,$pos); +# print "disp_F: def x='$x'\n"; + $rv= $rv.&disp_F_f($x); + $code= ($pos == -1) ? '' : substr($code, $pos+1); + } + return $rv; +} + +sub disp_F_f +{ + local($in)= $_[0]; + local($i); + local($c)= ''; +# print "disp_F_f: in=$in\n"; + for ($i=0; $i<length($in); $i++) + { + # $c= $c . '['.substr($in,$i,1).']'; + $c= $c . $func_code{substr($in,$i,1)}; + } + return $c; +} diff --git a/app/lexicon/lex.c b/app/lexicon/lex.c new file mode 100644 index 0000000000000000000000000000000000000000..190a56c27d9e5274273c6a98e07121c2aeaa60f0 --- /dev/null +++ b/app/lexicon/lex.c @@ -0,0 +1,25 @@ +/* + * FILE ~/usr/lexicon/lex.c + * + * latest update: 1995-07-16 + * + */ + +#include <stdio.h> +#include <gg/lexicon.h> + +int cdecl main (void); + +/* ------------------------------------------------------------------------ */ +int main () +{ +/************** + printf ("enter lexicon path> "); + scanf ("%s", line); +**************/ + + LEXICON_init (0, "\\LEXICON\\"); + LEXICON_print (stdout); + + return 0; +} diff --git a/app/lexicon/lex00001.c b/app/lexicon/lex00001.c new file mode 100644 index 0000000000000000000000000000000000000000..c18a2b56dcb589240d0568aafa040afdad2bcbbc --- /dev/null +++ b/app/lexicon/lex00001.c @@ -0,0 +1,568 @@ +/* + * FILE ~/usr/lexicon/lex00001.c + * + * - Prototypes + * + * written: 1990 11 13 + * 1991 03 16: Revision; AIX + * latest update: 1995-07-16 + * + */ + +#include <stdio.h> +#include <malloc.h> +#include <string.h> +#ifdef MSDOS +#include <gg/fnames.h> +#endif +#include <gg/lexicon.h> +#include <gg/sbr.h> + +#define LEX_DESCS 20 +#define CACHE_FILES 10 /* Zahl der Files, die `gecachet' */ + /* geoeffnet werden duerfen. */ + +static struct LEXICON_DESCRIPTION lexdesc [LEX_DESCS]; +static int lexdesc_inited= 0; +static int cache_counter= 0; + +/* Prototypes statischer Funktionen: -------------------------------------- */ +#ifdef MSDOS +static long cdecl get_counter (char *s, int idx); +#endif /* MSDOS */ +static int cdecl get_files (char *path, char *pattern, + int mode, struct LEXICON_FILE **lfp); +static void cdecl release_files (struct LEXICON_FILE *lfp); +static void cdecl cache_close_all (void); +static void cdecl cached_close (struct LEXICON_FILE *lf); +static void cache_close_some (struct LEXICON_FILE *lf, int cnt); +static FILE *cdecl cached_open (struct LEXICON_DESCRIPTION *ld, + struct LEXICON_FILE *lf, char *open_mode); +static struct LEXICON_FILE *cdecl cached_open_cluster ( + struct LEXICON_DESCRIPTION *ld, + long cluster_number, + char *open_mode); +static void cdecl lex_prnt_files (FILE *fo, struct LEXICON_FILE *lf, int typ); + +/* ------------------------------------------------------------------------ */ +struct LEXICON_DESCRIPTION *LEXICON_get_description (int lexicon_handle) +{ + struct LEXICON_DESCRIPTION *ld; + + if (lexicon_handle < 0 || lexicon_handle > LEX_DESCS) return (void *) 0; + ld= & lexdesc [lexicon_handle]; + if (!ld->LEX_used) return (void *) 0; + return ld; +} + +/* ------------------------------------------------------------------------ */ +int LEXICON_init (int lexicon_handle, char *lexicon_path) +{ + register struct LEXICON_DESCRIPTION *ld; + int i; + char *cp; + + if (lexdesc_inited == 0) + { + for (i= 0; i < LEX_DESCS; i++) + lexdesc [i].LEX_used=0; + lexdesc_inited= 1; + } + + if (lexicon_handle < 0 || lexicon_handle > LEX_DESCS) return -1; + ld= & lexdesc [lexicon_handle]; + + if (ld->LEX_used) + { + release_files (ld->LEX_main_luts); + release_files (ld->LEX_clusters); + release_files (ld->LEX_index_tables); + ld->LEX_main_luts = (void *) 0; + ld->LEX_clusters = (void *) 0; + ld->LEX_index_tables = (void *) 0; + } + + cp= lexdesc [lexicon_handle].LEX_path; + strcpy (cp, lexicon_path); + + if (lexicon_path == (char *) 0) return 0; + + get_files (cp, "*.LUT", 1, &ld->LEX_main_luts); + get_files (cp, "*.HYX", 2, &ld->LEX_clusters); + get_files (cp, "*.IDX", 3, &ld->LEX_index_tables); + + ld->LEX_used=1; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef MSDOS +static long get_counter (char *s, int idx) +{ + int ch; + long val= 0L; + + for (; ch = s[idx] & 0x00FF; idx++) + { + if (ch >= '0' && ch <= '9') val = 16*val + ((long) (ch - '0')); else + if (ch >= 'A' && ch <= 'F') val = 16*val + ((long) (ch - 'A' + 10)); else + if (ch >= 'a' && ch <= 'f') val = 16*val + ((long) (ch - 'a' + 10)); + else break; + } + return val; +} +#endif /* MSDOS */ + +/* ------------------------------------------------------------------------ */ +static int get_files ( +char *path, +char *pattern, +int mode, +struct LEXICON_FILE **lfp) +{ + int size; +#ifdef MSDOS + char *fnd, *cp; + struct LEXICON_FILE *lf; + struct dta_buff *dta; + long l; +#endif /* MSDOS */ + + size= strlen (path); + strcpy (&path[size], pattern); + + *lfp= (void *) 0; + +#ifdef MSDOS + while ((fnd= Fname_find (path, FA_FILE)) != (char *) 0) + { + lf = calloc (sizeof (struct LEXICON_FILE), 1); + if (lf==(void *) 0) + { +MEMORY: + fprintf (stderr, "LEXICON_INIT: out of memory!!!\n"); + return -1; + } + if ((cp= strdup (fnd)) == (void *) 0) goto MEMORY; + dta= Fget_dta (); + lf->LEXF_fnm= cp; + switch (mode) + { + case 1: /* LUT */ + lf->LEXF_p1= get_counter (dta->name, 4); + lf->LEXF_p2= dta->size; + lf->LEXF_p3= (lf->LEXF_p2 < LEXICON_LUT_SIZE); + break; + case 2: /* HYX */ + lf->LEXF_p1= get_counter (dta->name, 3); + lf->LEXF_p2= dta->size; + lf->LEXF_p3= (lf->LEXF_p2 < LEXICON_LUT_SIZE); + break; + case 3: /* IDX */ + lf->LEXF_p1= get_counter (dta->name, 3) * LEXICON_INDEX_SIZE; + l= dta->size / ((long) sizeof (struct LEXICON_INDEX)); + lf->LEXF_p2= lf->LEXF_p1 + l; + lf->LEXF_p3= (l < LEXICON_INDEX_SIZE); + break; + } + + *lfp=lf; + lfp=&(lf->LEXF_next); + } +#endif + + path [size] = 0; + return 0; +} + +/* ------------------------------------------------------------------------ */ +static void release_files (struct LEXICON_FILE *lfp) +{ + struct LEXICON_FILE *lfp2; + + while ((lfp2= lfp) != (void *) 0) + { + lfp= lfp->LEXF_next; + if (lfp2->LEXF_open_mode [0]) + { + cache_counter--; + fclose (lfp2->LEXF_fp); + } + free (lfp2->LEXF_fnm); + free (lfp2); + } +} + +/* ------------------------------------------------------------------------ */ +static void cached_close (struct LEXICON_FILE *lf) +{ + if (lf->LEXF_open_mode[0] == 0) return; + fclose (lf->LEXF_fp); + lf->LEXF_open_mode[0]=0; + cache_counter--; +} + +/* ------------------------------------------------------------------------ */ +static void cache_close_all () /* *alle* geoeffneten Files *aller* */ + /* verwendeten Lexica schliessen */ +{ + int i; + + for (i= 0; i < LEX_DESCS; i++) + { + if (lexdesc[i].LEX_used) + { + cache_close_some (lexdesc [i].LEX_main_luts, 32000); + cache_close_some (lexdesc [i].LEX_clusters, 32000); + cache_close_some (lexdesc [i].LEX_index_tables, 32000); + } + } +} + +/* close a few open files ------------------------------------------------- */ +static void cache_close_some (struct LEXICON_FILE *lf, int cnt) +{ + for (; lf != (struct LEXICON_FILE *) 0; lf= lf->LEXF_next) + if (lf->LEXF_open_mode[0]) + { + fclose (lf->LEXF_fp); + lf->LEXF_open_mode[0]= 0; + cache_counter--; + cnt--; + if (cnt <= 0) return; + } +} + +/* ------------------------------------------------------------------------ */ +static FILE *cached_open ( +struct LEXICON_DESCRIPTION *ld, +struct LEXICON_FILE *lf, +char *open_mode) +{ + FILE *f; + + if (strcmp (lf->LEXF_open_mode, open_mode) == 0) return lf->LEXF_fp; + if (lf->LEXF_open_mode[0] != 0) + { + cached_close (lf); + } + else + { + if (cache_counter >= CACHE_FILES) cache_close_some (ld->LEX_main_luts, 1); + if (cache_counter >= CACHE_FILES) cache_close_some (ld->LEX_clusters, 1); + if (cache_counter >= CACHE_FILES) cache_close_some (ld->LEX_index_tables, 1); + if (cache_counter >= CACHE_FILES) cache_close_all (); + if (cache_counter >= CACHE_FILES) return (FILE *) 0; + } + + if ((lf->LEXF_fp= f= fopen (lf->LEXF_fnm, open_mode)) == (FILE *) 0) + return (FILE *) 0; + strcpy (lf->LEXF_open_mode, open_mode); + cache_counter++; + + return f; +} + +/* ------------------------------------------------------------------------ */ +static struct LEXICON_FILE *cached_open_cluster ( +struct LEXICON_DESCRIPTION *ld, +long cluster_number, +char *open_mode) +{ + FILE *fp; + struct LEXICON_FILE *lf; + char *cp; + + for (lf= ld->LEX_clusters; + lf != (struct LEXICON_FILE *) 0; + lf= lf->LEXF_next) + { + if (lf->LEXF_p1 == cluster_number) + { + if ((fp= cached_open (ld, lf, open_mode))== (FILE *) 0) + return (void *) 0; + return lf; + } + } + + if (strcmp (open_mode, fopen_APPEND) != 0) return (void *) 0; + + /* Zum Schreiben auf einen Cluster kann auch ein */ + /* bislang unbenutzter Cluster herangezogen werden. */ + /* Geschrieben wird normalerweise mit "ab" */ + + if ((lf= (struct LEXICON_FILE *) calloc (sizeof (struct LEXICON_FILE), 1)) + == (struct LEXICON_FILE *) 0) + { +MEMORY: + fprintf (stderr, "OPEN new CLUSTER MC-%04lX (%s): out of memory!!!\n", + cluster_number, open_mode); + return (void *) 0; + } + + if ((cp= malloc (strlen (ld->LEX_path)+16)) == (void *) 0) goto MEMORY; + sprintf (cp, "%sMC-%04lX.HYX", ld->LEX_path, cluster_number); + lf->LEXF_fnm= cp; + lf->LEXF_p1= cluster_number; + lf->LEXF_p2= 0L; + lf->LEXF_p3= 1; + + lf->LEXF_next= ld->LEX_clusters; + ld->LEX_clusters= lf; + + if ((lf->LEXF_fp= fopen (cp, open_mode)) == (FILE *) 0) + return (struct LEXICON_FILE *) 0; + strcpy (lf->LEXF_open_mode, open_mode); + cache_counter++; + + return lf; +} + +/* ------------------------------------------------------------------------ */ +int LEXICON_get_entry ( +int lexicon_handle, +long frame_index, +char *puffer, +long puffer_size) +{ + struct LEXICON_DESCRIPTION *ld; + + if ((ld= LEXICON_get_description (lexicon_handle)) == (void *) 0) return -1; + + return _LEXICON_get_entry (ld, frame_index, puffer, puffer_size, + (FILE *) 0, 1); +} + +/* ------------------------------------------------------------------------ */ +int _LEXICON_get_entry ( +struct LEXICON_DESCRIPTION *ld, +long frame_index, +char *puffer, +long puffer_size, +FILE *fo, +int out_mode) +{ + struct LEXICON_FILE *lfidx; + struct LEXICON_FILE *lfhyx; + struct LEXICON_INDEX li; + long offset; + FILE *fi; + int rc; + + lfidx= ld->LEX_index_tables; + + while (lfidx != (void *) 0) + { + if (frame_index >= lfidx->LEXF_p1 && frame_index < lfidx->LEXF_p2) + { + if ((fi= cached_open (ld, lfidx, fopen_READ)) == (FILE *) 0) return -1; + offset= frame_index - lfidx->LEXF_p1; + offset *= (long) sizeof (struct LEXICON_INDEX); + fseek (fi, offset, 0); + rc= fread ((char *) &li, sizeof (struct LEXICON_INDEX), 1, fi); + if (rc < 1) return -1; + + if ((lfhyx= cached_open_cluster (ld, li.LEXI_cluster_number, + fopen_READ)) + == (void *) 0) return -1; + + fi= lfhyx->LEXF_fp; + fseek (fi, li.LEXI_begin, 0); + offset= li.LEXI_end - li.LEXI_begin + 1L; + + switch (out_mode) + { + case 1: + if (puffer_size-- <= 0L) return -1; + while (offset-- > 0L) *puffer++ = (char) (fgetc (fi) & 0x00FF); + break; + case 2: + ftransfer (fi, fo, offset); + break; + } + return 0; + } + } + + return -1; +} + +/* ------------------------------------------------------------------------ */ +/* Bestimmung eines Clusters, der zur Aufnahme von Daten herangezogen */ +/* werden kann. */ +long get_usable_cluster (struct LEXICON_DESCRIPTION *ld) +{ + struct LEXICON_FILE *lf; + long max= 0; + + for (lf=ld->LEX_clusters; lf!=(struct LEXICON_FILE *) 0; lf=lf->LEXF_next) + { + if (lf->LEXF_p2 >= max) max= lf->LEXF_p2+1L; + if (lf->LEXF_p3) return lf->LEXF_p2; + } + + return max; +} + +/* ------------------------------------------------------------------------ */ +int LEXICON_add_entry ( +int lexicon_handle, +long frame_index, +char *puffer, +long siz) +{ + struct LEXICON_DESCRIPTION *ld; + + ld = LEXICON_get_description (lexicon_handle); + if (ld == (void *) 0) return -1; + + return _LEXICON_add_entry (ld, frame_index, puffer, siz); +} + +/* ------------------------------------------------------------------------ */ +int _LEXICON_add_entry ( +struct LEXICON_DESCRIPTION *ld, +long frame_index, +char *puffer, +long siz) +{ + struct LEXICON_FILE *lfidx; + struct LEXICON_FILE *lfhyx; + struct LEXICON_INDEX li; + long offset; + FILE *fo; + int rc; + + lfidx= ld->LEX_index_tables; + + while (lfidx != (void *) 0) + { + if (frame_index >= lfidx->LEXF_p1 && frame_index < lfidx->LEXF_p1 + LEXICON_INDEX_SIZE) + { + if ((lfhyx= cached_open_cluster (ld, + li.LEXI_cluster_number= get_usable_cluster (ld), + fopen_APPEND)) + == (struct LEXICON_FILE *) 0) return -1; + + fo= lfhyx->LEXF_fp; + fseek (fo, (long) 0, 2); + li.LEXI_begin= ftell(fo); + li.LEXI_end= li.LEXI_begin - 1L + (long) siz; + + lfhyx->LEXF_p2 += (long) siz; + lfhyx->LEXF_p3= (lfhyx->LEXF_p2 < LEXICON_LUT_SIZE); + + while (siz-- > 0L) fputc (*puffer++, fo); + + if (frame_index < lfidx->LEXF_p2) + { + if ((fo= cached_open (ld, lfidx, fopen_READ_WRITE)) == (FILE *) 0) + return -1; + offset= frame_index - lfidx->LEXF_p1; + offset *= (long) sizeof (struct LEXICON_INDEX); + fseek (fo, offset, 0); + rc= fwrite ((char *) &li, sizeof (struct LEXICON_INDEX), 1, fo); + if (rc < 1) return -1; + } + else + { + struct LEXICON_INDEX li2; + + fo = cached_open (ld, lfidx, fopen_APPEND); + if (fo == (FILE *) 0) return -1; + li2.LEXI_begin = -1L; + li2.LEXI_end = -1L; + li2.LEXI_cluster_number = -1L; + while (lfidx->LEXF_p2 < frame_index) + { + rc= fwrite ((char *) &li2, sizeof (struct LEXICON_INDEX), 1, fo); + if (rc < 1) return -1; + (lfidx->LEXF_p2)++; + } + rc=fwrite ((char *) &li, sizeof (struct LEXICON_INDEX), 1, fo); + if (rc < 1) return -1; + (lfidx->LEXF_p2)++; + } + + return 0; + } + } + + return -1; +} + +/* ------------------------------------------------------------------------ */ +long LEXICON_new_entry (int lexicon_handle) +{ + struct LEXICON_DESCRIPTION *ld; + struct LEXICON_FILE *lf; + + if ((ld= LEXICON_get_description (lexicon_handle)) == (void *) 0) + return -1L; + + for (lf= ld->LEX_index_tables; + lf != (struct LEXICON_FILE *) 0; + lf= lf->LEXF_next) + if (lf->LEXF_p3) return lf->LEXF_p2; + + return -1L; +} + +/* ------------------------------------------------------------------------ */ +int LEXICON_print (FILE *fo) +{ + int i; + + for (i= 0; i<LEX_DESCS; i++) LEXICON_print_entry (fo, i); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int LEXICON_print_entry (FILE *fo, int nr) +{ + struct LEXICON_DESCRIPTION *ld; + + fprintf (fo, "Lexicon Entry %d \n", nr); + ld= &lexdesc [nr]; + if (!ld->LEX_used) + { + fprintf (fo, "unused\n"); + return 0; + } + + fprintf (fo, "--------------------\n"); + + fprintf (fo, "Path: %s\n", ld->LEX_path); + fprintf (fo, "LUT-Files:\n"); lex_prnt_files (fo, ld->LEX_main_luts, 1); + fprintf (fo, "HYX-Files:\n"); lex_prnt_files (fo, ld->LEX_clusters, 2); + fprintf (fo, "IDX-Files:\n"); lex_prnt_files (fo, ld->LEX_index_tables, 3); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +static void lex_prnt_files (FILE *fo, struct LEXICON_FILE *lf, int typ) +{ + while (lf != (void *) 0) + { + switch (typ) + { + case 1: /* spaeter genauer .... */ + case 2: + case 3: + fprintf (fo, "* %s %08lX %08lX %ld\n", + lf->LEXF_fnm, lf->LEXF_p1, lf->LEXF_p2, lf->LEXF_p3); + break; + } + lf= lf->LEXF_next; + } +} + +/* ------------------------------------------------------------------------ */ +int LEXICON_flush (void) +{ + cache_close_all (); + return 0; +} diff --git a/app/lexicon/lexpr001.c b/app/lexicon/lexpr001.c new file mode 100644 index 0000000000000000000000000000000000000000..2add6d8fc7c54fc9bc64e11c224e746db81b17d5 --- /dev/null +++ b/app/lexicon/lexpr001.c @@ -0,0 +1,89 @@ +/* + * FILE ~/usr/lexicon/lexpr001.c + * + * written: 1991 04 19 + * latest update: 1995-06-25 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> +#include <gg/parse.h> +#include "lexproc.h" + +#ifdef JUNK +static struct LEXICON_INDEX *used_index; +static int used_index_count= 0; +static int used_sort_mode= 0; +#endif + +static struct LEXICON_INDEX largest; + +/* ------------------------------------------------------------------------ */ +int init_by_size (int sort_mode, int sort_cnt) +{ + largest.LEXI_begin= -1L; +#ifdef MSDOS + sort_mode; + sort_cnt; +#endif + +/**** +fprintf (stdout, "init_by_size\n"); +****/ +#ifdef XXX + used_index= calloc (sizeof (struct LEXICON_INDEX), sort_cnt); + if (used_index == (void *) 0) return -1; + used_sort_mode= sort_mode; +#endif + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int process_by_size (struct LEXICON_INDEX *idx) +{ +/**** +fprintf (stdout, "process_by_size\n"); +****/ + + if (largest.LEXI_begin < 0L || + idx->LEXI_end - idx->LEXI_begin > largest.LEXI_end - largest.LEXI_begin) + { + largest.LEXI_begin = idx->LEXI_begin; + largest.LEXI_end = idx->LEXI_end; + largest.LEXI_cluster_number = idx->LEXI_cluster_number; +/**** +fprintf (stdout, "init_by_size: largest: 0x%lX 0x%lX %ld\n", + largest.LEXI_begin, largest.LEXI_end, + largest.LEXI_end - largest.LEXI_begin +1L); +****/ + } + +#ifdef XXX + switch (used_sort_mode) + { + default: + break; + } +#endif + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int finish_by_size (FILE *fhyx, FILE *fo) +{ + +/**** +fprintf (stdout, "finish_by_size: largest: 0x%lX 0x%lX %ld\n", + largest.LEXI_begin, largest.LEXI_end, + largest.LEXI_end - largest.LEXI_begin +1L); +****/ + + if (largest.LEXI_begin < 0L) return 0; + fseek (fhyx, largest.LEXI_begin, 0); + ftransfer (fhyx, fo, largest.LEXI_end-largest.LEXI_begin+1L); + + return 0; +} diff --git a/app/lexicon/lexpr001.o b/app/lexicon/lexpr001.o new file mode 100644 index 0000000000000000000000000000000000000000..d278d82ae242d35824fc351a693a41109459d717 Binary files /dev/null and b/app/lexicon/lexpr001.o differ diff --git a/app/lexicon/lexproc.h b/app/lexicon/lexproc.h new file mode 100644 index 0000000000000000000000000000000000000000..64c8645f523a0efb349e7dbf6668964226fd1794 --- /dev/null +++ b/app/lexicon/lexproc.h @@ -0,0 +1,11 @@ +/* + * FILE ~/usr/lexicon/lexproc.h + * + * written: 1991 04 19 + * latest update: 1995-07-16 + * + */ + +int cdecl init_by_size (int sort_mode, int sort_cnt); +int cdecl process_by_size (struct LEXICON_INDEX *idx); +int cdecl finish_by_size (FILE *fhyx, FILE *fo); diff --git a/app/lexicon/lexut001.c b/app/lexicon/lexut001.c new file mode 100644 index 0000000000000000000000000000000000000000..3d5467f01c68b0c06362be850b5f541bf1e7cf05 --- /dev/null +++ b/app/lexicon/lexut001.c @@ -0,0 +1,234 @@ +/* + * FILE ~/usr/lexicon/lexut001.c + * + * lexicon utility functions + * ISPELL derivation + * + * written: 1991 04 27 + * latest update: 1995-07-16 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/lexutil.h> + +/* ------------------------------------------------------------------------ */ +int ISPELL_derive ( +char *orig, /* original word */ +int flag, /* ISPELL flag */ +char *deriv) /* derived word */ +{ + int last; + int last_upper; + int last1; + int lng; + + if (orig == (char *) 0) return -1; + strcpy (deriv, orig); + lng= strlen (orig); + if (lng <= 0) return 0; + last= orig[lng-1]; + last_upper= (last >= 'A' && last <= 'Z'); + + /* printf ("orig='%s' deriv='%s' flag=%c lng=%d last=%c last_upper=%d\n", */ + /* orig, deriv, flag, lng, last, last_upper); */ + + switch (flag) + { + case 'O': case 'o': + break; + + case 'V': case 'v': + if (last == 'E' || last == 'e') lng--; + strcpy (&deriv[lng], (last_upper) ? "IVE" : "ive"); + break; + + case 'N': case 'n': + if (last == 'E' || last == 'e') + strcpy (&deriv [lng-1], (last_upper) ? "ION" : "ion"); + else + if (last == 'Y' || last == 'y') + strcpy (&deriv [lng-1], (last_upper) ? "ICATION" : "ication"); + else strcpy (&deriv [lng], (last_upper) ? "EN" : "en"); + break; + + case 'X': case 'x': + if (last == 'E' || last == 'e') + strcpy (&deriv [lng-1], (last_upper) ? "IONS" : "ions"); + else if (last == 'Y' || last == 'y') + strcpy (&deriv [lng-1], (last_upper) ? "ICATIONS" : "ications"); + else strcpy (&deriv [lng], (last_upper) ? "ENS" : "ens"); + break; + + case 'H': case 'h': + if (last == 'Y' || last == 'y') + strcpy (&deriv [lng-1], (last_upper) ? "IETH" : "ieth"); + else strcpy (&deriv [lng], (last_upper) ? "TH" : "th"); + break; + + case 'Y': case 'y': + strcpy (&deriv [lng], (last_upper) ? "LY" : "ly"); + break; + + case 'G': case 'g': + if (last == 'E' || last == 'e') lng--; + strcpy (&deriv [lng], (last_upper) ? "ING" : "ing"); + break; + + case 'J': case 'j': + if (last == 'E' || last == 'e') lng--; + strcpy (&deriv [lng], (last_upper) ? "INGS" : "ings"); + break; + + case 'D': case 'd': + if (last == 'E' || last == 'e') + strcpy (&deriv [lng], (last_upper) ? "D" : "d"); + else + { + if (last == 'Y' || last == 'y') + { + last1= orig [lng-2]; + if ( last1 == 'A' || last1 == 'a' + || last1 == 'E' || last1 == 'e' + || last1 == 'I' || last1 == 'i' + || last1 == 'O' || last1 == 'o' + || last1 == 'U' || last1 == 'u') + goto SPECIAL_D; + else strcpy (&deriv [lng-1], (last_upper) ? "IED" : "ied"); + } + else + { +SPECIAL_D: + strcpy (&deriv [lng], (last_upper) ? "ED" : "ed"); + } + } + break; + + case 'T': case 't': + if (last == 'E' || last == 'e') + strcpy (&deriv[lng], (last_upper) ? "ST" : "st"); + else + { + if (last == 'Y' || last == 'y') + { + last1= orig [lng-2]; + if ( last1 == 'A' || last1 == 'a' + || last1 == 'E' || last1 == 'e' + || last1 == 'I' || last1 == 'i' + || last1 == 'O' || last1 == 'o' + || last1 == 'U' || last1 == 'u') + goto SPECIAL_T; + else strcpy (&deriv [lng-1], (last_upper) ? "IEST" : "iest"); + } + else + { +SPECIAL_T: + strcpy (&deriv [lng], (last_upper) ? "EST" : "est"); + } + } + break; + + case 'R': case 'r': + if (last == 'E' || last == 'e') + strcpy (&deriv[lng], (last_upper) ? "R" : "r"); + else + { + if (last == 'Y' || last == 'y') + { + last1= orig [lng-2]; + if ( last1 == 'A' || last1 == 'a' + || last1 == 'E' || last1 == 'e' + || last1 == 'I' || last1 == 'i' + || last1 == 'O' || last1 == 'o' + || last1 == 'U' || last1 == 'u') + goto SPECIAL_R; + else strcpy (&deriv [lng-1], (last_upper) ? "IER" : "ier"); + } + else + { +SPECIAL_R: + strcpy (&deriv [lng], (last_upper) ? "ER" : "er"); + } + } + break; + + case 'Z': case 'z': + if (last == 'E' || last == 'e') + strcpy (&deriv[lng], (last_upper) ? "RS" : "rs"); + else + { + if (last == 'Y' || last == 'y') + { + last1= orig [lng-2]; + if ( last1 == 'A' || last1 == 'a' + || last1 == 'E' || last1 == 'e' + || last1 == 'I' || last1 == 'i' + || last1 == 'O' || last1 == 'o' + || last1 == 'U' || last1 == 'u') + goto SPECIAL_Z; + else strcpy (&deriv [lng-1], (last_upper) ? "IERS" : "iers"); + } + else + { +SPECIAL_Z: + strcpy (&deriv [lng], (last_upper) ? "ERS" : "ers"); + } + } + break; + + case 'S': case 's': + if (last == 'Y' || last == 'y') + { + last1 = orig [lng-2]; + if ( last1 == 'A' || last1 == 'a' + || last1 == 'E' || last1 == 'e' + || last1 == 'I' || last1 == 'i' + || last1 == 'O' || last1 == 'o' + || last1 == 'U' || last1 == 'u') + goto SPECIAL_S; + else strcpy (&deriv [lng-1], (last_upper) ? "IES" : "ies"); + } + else + if ( last == 'S' || last == 's' + || last == 'X' || last == 'x' + || last == 'Z' || last == 'z') + strcpy (&deriv [lng], (last_upper) ? "ES" : "es"); + else + { +SPECIAL_S: + strcpy (&deriv[lng], (last_upper) ? "S" : "s"); + } + break; + + case 'P': case 'p': + if (last == 'Y' || last == 'y') + { + last1= orig [lng-2]; + if ( last1 == 'A' || last1 == 'a' + || last1 == 'E' || last1 == 'e' + || last1 == 'I' || last1 == 'i' + || last1 == 'O' || last1 == 'o' + || last1 == 'U' || last1 == 'u') + goto SPECIAL_P; + else strcpy (&deriv [lng-1], (last_upper) ? "INESS" : "iness"); + } + else + { +SPECIAL_P: + strcpy (&deriv [lng], (last_upper) ? "NESS" : "ness"); + } + break; + + case 'M': case 'm': + strcpy (&deriv [lng], (last_upper) ? "'S" : "'s"); + break; + + default: return -1; + } + + return 0; +} diff --git a/app/lexicon/lexut001.o b/app/lexicon/lexut001.o new file mode 100644 index 0000000000000000000000000000000000000000..53f192182f0b33f59ee2132d14936eeb28531250 Binary files /dev/null and b/app/lexicon/lexut001.o differ diff --git a/app/lexicon/lib b/app/lexicon/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/lexicon/make-dos b/app/lexicon/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..474baae8db27d09452d4986912b88b6cec21d766 --- /dev/null +++ b/app/lexicon/make-dos @@ -0,0 +1,87 @@ +# +# FILE %lexicon/makefile +# +# latest update: 1997-11-01 10:05:06 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$* /c +obj=objdec -w -d -m0 -sl 2 LEXICON_TEXT +inst=command /c inst-exe +bin=c:\bin\ + +all.exe : libr $(bin)dictadd.exe $(bin)pt.exe + +all2.exe : tst1.exe tst2.exe lex.exe $(bin)dictmod.exe + +lib.0 : lex00001.obj + +lib.1 : ! + parse007.obj parse008.obj parse014.obj parse016.obj ! + parse017.obj parse019.obj parse021.obj parse022.obj + +lib.2 : ! + dictadd1.obj dictadd2.obj dictadd3.obj dictadd4.obj ! + dictadd6.obj dictadd8.obj ! + dictadd9.obj ! + dict0001.obj dict0002.obj dict0003.obj dict0004.obj ! + dict0005.obj dict0006.obj dict0007.obj dict0008.obj ! + dict0009.obj dict0010.obj dict0011.obj dict0012.obj ! + dict0013.obj dict0014.obj dict0015.obj dict0016.obj ! + dict0018.obj ! + lexut001.obj ! + parsd008.obj parsd016.obj + +libr : lib.1 lib.2 lsbr.lib + +lsbr.lib : + llink -n0 -lc:\usr\sbr\lsbr.lib -dlexicon.mod + +clr1 : + del alexicon.lut + del alexicon.idx + del alexicon.hyx + del alexicon.@hx + del alexicon.@ix + +# --------------------------------------------------------------------------- +lexicon.sh : + shar -c -t lexicon.sh -fmakeshar.lst + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +# production programs: ------------------------------------------------------- +$(bin)dictadd.exe : dictadd.obj dictadd1.obj lexicon.mod + link dictadd dictadd1,$(bin)dictadd.exe,\dev\nul,! + c:\usr\sbr\lsbr/NOE/NOI; + $(inst) $(bin)dictadd.exe + +$(bin)dictmod.exe : dictmod.obj lexpr001.obj lexicon.mod + link dictmod lexpr001,$(bin)dictmod.exe,! + \dev\nul,c:\usr\sbr\lsbr/NOE/NOI; + $(inst) $(bin)dictmod.exe + +# diagnostic modules: -------------------------------------------------------- +parsd008.obj : parse008.c + $(cml) -DDIAGNOSTIC parse008.c + $(obj) + +parsd016.obj : parse016.c + $(cml) -DDIAGNOSTIC parse016.c + $(obj) + +# test programs: ------------------------------------------------------------- +lex.exe : lex.obj lex00001.obj + link lex lex00001,,\dev\nul,c:\usr\sbr\lsbr; + +$(bin)pt.exe : pt.obj parse017.obj ! + lexicon.mod + link pt parse017,$@,\dev\nul,c:\usr\sbr\lsbr/NOE; + +tst1.exe : tst1.obj + link tst1.obj,,\dev\nul,c:\usr\sbr\lsbr/NOE/NOI; + +tst2.exe : tst2.obj parse019.obj + link tst2.obj parse019,,\dev\nul,c:\usr\sbr\lsbr/NOE/NOI; diff --git a/app/lexicon/makeshar.lst b/app/lexicon/makeshar.lst new file mode 100644 index 0000000000000000000000000000000000000000..e5cdafe9f7f2218da6d53225829fcd620565fb79 --- /dev/null +++ b/app/lexicon/makeshar.lst @@ -0,0 +1,147 @@ +# +# File %lexicon/makeshar.lst (Contents) +# +# contents for shar file of the ~/usr/lexicon +# +# written: 1994-07-20 +# latest update: 1996-02-18 12:18:42 +# +# --------------------------------------------------------------------------- +a (dirinf).fm Files +a make-ux Makefile +a makefile makefile.c5 +a makeshar.lst Contents +a /etc/lexicon.tag lexicon.tags +a http4lex.pl http4lex.pl +#a /hyx-prv/lexicon/lexicon.hyx lexicon.hyx +#>echo "... but that's ok!" +# regular files +a dictadd.c dictadd.c +a dictadd1.c dictadd1.c +a dictadd2.c dictadd2.c +a dictadd3.c dictadd3.c +a dictadd4.c dictadd4.c +a dictadd6.c dictadd6.c +a dictadd8.c dictadd8.c +a dictadd9.c dictadd9.c +a dict0001.c dict0001.c +a dict0002.c dict0002.c +a dict0003.c dict0003.c +a dict0004.c dict0004.c +a dict0005.c dict0005.c +a dict0006.c dict0006.c +a dict0007.c dict0007.c +a dict0008.c dict0008.c +a dict0009.c dict0009.c +a dict0010.c dict0010.c +a dict0011.c dict0011.c +a dict0012.c dict0012.c +a dict0013.c dict0013.c +a dict0014.c dict0014.c +a dict0015.c dict0015.c +a dict0016.c dict0016.c +a dict0018.c dict0018.c +a dictmod.c dictmod.c +a lex.c lex.c +a lex00001.c lex00001.c +a lexpr001.c lexpr001.c +a lexproc.h lexproc.h +a lexut001.c lexut001.c +a parse007.c parse007.c +a parse008.c parse008.c +a parse014.c parse014.c +a parse016.c parse016.c +a parse017.c parse017.c +a parse019.c parse019.c +a parse021.c parse021.c +a parse022.c parse022.c +# TA package +a /usr/ta/ta.c atag.c +a /usr/ta/ta012.c ta012.c +a /usr/ta/ta015.c ta015.c +a /usr/ta/ta020.c ta020.c +a /usr/ta/ta101.c ta101.c +a /usr/ta/ta102.c ta102.c +a /usr/ds/strings/str_0041.c str_0041.c +a /usr/ds/strings/str_0041.tbl str_0041.tbl +a pt.c pt.c +a tst1.c tst1.c +a tst2.c tst2.c +# BBC package +a bbc.c bbc.c +a bbc01.c bbc01.c +a bbc02.c bbc02.c +a bbc03.c bbc03.c +a bbc04.c bbc04.c +a bbc05.c bbc05.c +a bbc06.c bbc06.c +a bbc07.c bbc07.c +a bbc08.c bbc08.c +a bbc09.c bbc09.c +a bbc10.c bbc10.c +a bbc11.c bbc11.c +a bbc12.c bbc12.c +a bbc13.c bbc13.c +a bbc14.c bbc14.c +a bbc15.c bbc15.c +# headers +>ln -fs ../gg +>if [ ! -d contrib ] +>then +> echo 'creating subdirectory contrib' +> mkdir contrib +>fi +a /c5/include/contrib/global.h contrib/global.h +a /c5/include/contrib/md5.h contrib/md5.h +a /c5/include/contrib/md5gg.h contrib/md5gg.h +>if [ ! -d _bak_ftr.ned ] +>then +> echo 'creating subdirectory _bak_ftr.ned' +> mkdir _bak_ftr.ned +>fi +a _bak_ftr.ned/(dirinf).ftr _bak_ftr.ned/'(dirinf)'.ftr +a _bak_ftr.ned/dict0001.ftr _bak_ftr.ned/dict0001.ftr +a _bak_ftr.ned/dict0002.ftr _bak_ftr.ned/dict0002.ftr +a _bak_ftr.ned/dict0003.ftr _bak_ftr.ned/dict0003.ftr +a _bak_ftr.ned/dict0004.ftr _bak_ftr.ned/dict0004.ftr +a _bak_ftr.ned/dict0005.ftr _bak_ftr.ned/dict0005.ftr +a _bak_ftr.ned/dict0006.ftr _bak_ftr.ned/dict0006.ftr +a _bak_ftr.ned/dict0007.ftr _bak_ftr.ned/dict0007.ftr +a _bak_ftr.ned/dict0008.ftr _bak_ftr.ned/dict0008.ftr +a _bak_ftr.ned/dict0009.ftr _bak_ftr.ned/dict0009.ftr +a _bak_ftr.ned/dict0010.ftr _bak_ftr.ned/dict0010.ftr +a _bak_ftr.ned/dictadd.ftr _bak_ftr.ned/dictadd.ftr +a _bak_ftr.ned/dictadd1.ftr _bak_ftr.ned/dictadd1.ftr +a _bak_ftr.ned/dictadd2.ftr _bak_ftr.ned/dictadd2.ftr +a _bak_ftr.ned/dictadd4.ftr _bak_ftr.ned/dictadd4.ftr +a _bak_ftr.ned/dictadd6.ftr _bak_ftr.ned/dictadd6.ftr +a _bak_ftr.ned/dictadd8.ftr _bak_ftr.ned/dictadd8.ftr +a _bak_ftr.ned/dictadd9.ftr _bak_ftr.ned/dictadd9.ftr +a _bak_ftr.ned/dictmod.ftr _bak_ftr.ned/dictmod.ftr +a _bak_ftr.ned/http4lex.ftr _bak_ftr.ned/http4lex.ftr +a _bak_ftr.ned/lex.ftr _bak_ftr.ned/lex.ftr +a _bak_ftr.ned/lex00001.ftr _bak_ftr.ned/lex00001.ftr +a _bak_ftr.ned/lexfile.ftr _bak_ftr.ned/lexfile.ftr +a _bak_ftr.ned/lexicon.ftr _bak_ftr.ned/lexicon.ftr +a _bak_ftr.ned/lexpr001.ftr _bak_ftr.ned/lexpr001.ftr +a _bak_ftr.ned/lexproc.ftr _bak_ftr.ned/lexproc.ftr +a _bak_ftr.ned/lexut001.ftr _bak_ftr.ned/lexut001.ftr +a _bak_ftr.ned/makefile.ftr _bak_ftr.ned/makefile.ftr +a _bak_ftr.ned/makeshar.ftr _bak_ftr.ned/makeshar.ftr +a _bak_ftr.ned/parse007.ftr _bak_ftr.ned/parse007.ftr +a _bak_ftr.ned/parse008.ftr _bak_ftr.ned/parse008.ftr +a _bak_ftr.ned/parse014.ftr _bak_ftr.ned/parse014.ftr +a _bak_ftr.ned/parse016.ftr _bak_ftr.ned/parse016.ftr +a _bak_ftr.ned/parse017.ftr _bak_ftr.ned/parse017.ftr +a _bak_ftr.ned/parse019.ftr _bak_ftr.ned/parse019.ftr +a _bak_ftr.ned/parse021.ftr _bak_ftr.ned/parse021.ftr +a _bak_ftr.ned/parse022.ftr _bak_ftr.ned/parse022.ftr +a _bak_ftr.ned/pt.ftr _bak_ftr.ned/pt.ftr +a _bak_ftr.ned/test1.ftr _bak_ftr.ned/test1.ftr +a _bak_ftr.ned/tst1.ftr _bak_ftr.ned/tst1.ftr +a _bak_ftr.ned/tst2.ftr _bak_ftr.ned/tst2.ftr +a _bak_ftr.ned/bbc.ftr _bak_ftr.ned/bbc.ftr +a _bak_ftr.ned/bbc01.ftr _bak_ftr.ned/bbc01.ftr +a _bak_ftr.ned/bbc02.ftr _bak_ftr.ned/bbc02.ftr +a _bak_ftr.ned/bbc03.ftr _bak_ftr.ned/bbc03.ftr +a _bak_ftr.ned/bbc04.ftr _bak_ftr.ned/bbc04.ftr diff --git a/app/lexicon/parsd008.o b/app/lexicon/parsd008.o new file mode 100644 index 0000000000000000000000000000000000000000..150de51c5f2d76119c953f6cd68a1c3e4a31f602 Binary files /dev/null and b/app/lexicon/parsd008.o differ diff --git a/app/lexicon/parsd016.o b/app/lexicon/parsd016.o new file mode 100644 index 0000000000000000000000000000000000000000..f45fccb3a4fd616a6525e9ee4672e584572a36d5 Binary files /dev/null and b/app/lexicon/parsd016.o differ diff --git a/app/lexicon/parse007.c b/app/lexicon/parse007.c new file mode 100644 index 0000000000000000000000000000000000000000..519e704b94f7bf8a41691802d0eba659f69c64af --- /dev/null +++ b/app/lexicon/parse007.c @@ -0,0 +1,28 @@ +/* + * FILE %usr/lexicon/parse007.c + * + * Text Liste ausgeben + * + * written: 1991 03 18 + * latest update: 2001-02-18 18:38:01 + * $Id: parse007.c,v 1.2 2001/02/19 00:27:18 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +void print_text_element_list (FILE *fo, struct TEXT_ELEMENT *t) +{ + for (; t != (struct TEXT_ELEMENT *) 0; t= t->TE_next) + { + if (t->sig == SIG_TEXT_ELEMENT) + { + fprintf (fo, "level=%3ld, type=%3ld def=0x%08lX: ", + t->TE_level, t->TE_type, t->TE_tag_definition); + print_text_segment_list (fo, t->TE_text_segment); + fputc ('\n', fo); + } + } +} diff --git a/app/lexicon/parse007.o b/app/lexicon/parse007.o new file mode 100644 index 0000000000000000000000000000000000000000..67b5ac8cdc6416aa3111a91d22cf09a86aa3fda7 Binary files /dev/null and b/app/lexicon/parse007.o differ diff --git a/app/lexicon/parse008.c b/app/lexicon/parse008.c new file mode 100644 index 0000000000000000000000000000000000000000..401dc9938c418c718858743137fc1924dcb9232f --- /dev/null +++ b/app/lexicon/parse008.c @@ -0,0 +1,100 @@ +/* + * FILE %lexicon/parse008.c + * + * Text Segment Liste ausgeben + * + * written: 1991 03 18 + * latest update: 1995-04-01 + * $Id: parse008.c,v 1.3 2004/05/08 15:40:34 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/parse.h> + +#ifdef DIAGNOSTIC +#define print_text_segment_list diag_print_text_segment_list +#define print_text_segment_list_stripped diag_print_text_segment_list_stripped +#endif /* DIAGNOSTIC */ + +/* ------------------------------------------------------------------------ */ +int print_text_segment_list (FILE *fo, struct TEXT_SEGMENT *ts) +{ + long l; + char *cp; + int first_char= -1; + + for (; + ts != (struct TEXT_SEGMENT *) 0; + ts= ts->TSEG_next) + { + cp= ts->TSEG_text_array; + if (first_char == -1) first_char= *cp; + +#ifdef DIAGNOSTIC + fputc ('{', fo); +#endif /* DIAGNOSTIC */ + + for (l= ts->TSEG_text_lng; l > 0; l--) fputc (*cp++, fo); + +#ifdef DIAGNOSTIC + fputc ('}', fo); +#endif /* DIAGNOSTIC */ + } + + return first_char; +} + +/* ------------------------------------------------------------------------ */ +int print_text_segment_list_stripped (FILE *fo, struct TEXT_SEGMENT *ts) +{ + long l; + char *cp; + int ch; + int first_char= -1; +/* BEGIN inserted */ + int spaces= 0; + int do_strip= 1; /* maybe a parameter */ + int is_space; +/* END inserted */ + + for (; + ts != (struct TEXT_SEGMENT *) 0; + ts= ts->TSEG_next) + { + cp= ts->TSEG_text_array; + if (first_char == -1) first_char= *cp; +#ifdef DIAGNOSTIC + fputc ('{', fo); +#endif /* DIAGNOSTIC */ + + for (l= ts->TSEG_text_lng; l > 0; l--) + { +/* BEGIN inserted */ + ch= *cp++; + is_space= (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n'); + + if (is_space && do_strip) + { + if (!spaces) fputc (' ', fo); + spaces++; + } + else + { + fputc (ch, fo); + spaces= 0; + } +/* END inserted */ + } + +#ifdef DIAGNOSTIC + fputc ('}', fo); +#endif /* DIAGNOSTIC */ + } + + return first_char; +} diff --git a/app/lexicon/parse008.o b/app/lexicon/parse008.o new file mode 100644 index 0000000000000000000000000000000000000000..462bd7531b3e08c17f9a07e555edefd14833cc1d Binary files /dev/null and b/app/lexicon/parse008.o differ diff --git a/app/lexicon/parse014.c b/app/lexicon/parse014.c new file mode 100644 index 0000000000000000000000000000000000000000..ab9a78476db54510f618739cc42f9588e85da00f --- /dev/null +++ b/app/lexicon/parse014.c @@ -0,0 +1,33 @@ +/* + * FILE %lexicon/parse014.c + * + * written: 1991 03 27 + * latest update: 1995-08-21 + * + */ + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int key_string_transform (char *s, int lng) +{ + int rv= 0; + int ch1, ch2; + int i; + + if (s == (char *) 0) return -1; + + for (i= 0; i < lng && (ch1= *s & 0x00FF) != 0; i++, s++) + { + ch2= lower_case (ch1); + if (ch1 != ch2) + { + if (rv == 0) rv= 1; + *s= (char) ch2; + } + } + + return rv; +} diff --git a/app/lexicon/parse014.o b/app/lexicon/parse014.o new file mode 100644 index 0000000000000000000000000000000000000000..e48ed034a7e2e967aaebc74f90ceb5a292e833ab Binary files /dev/null and b/app/lexicon/parse014.o differ diff --git a/app/lexicon/parse015.c b/app/lexicon/parse015.c new file mode 100644 index 0000000000000000000000000000000000000000..d9df10768d04ca61be7f509b4f8a69a882544ce8 --- /dev/null +++ b/app/lexicon/parse015.c @@ -0,0 +1,142 @@ +/* + * FILE %lexicon/parse015.c + * + * print markup structure + * + * written: 1991 03 31 + * 1995-08-17 (copied from display_markup) + * latest update: 1996-02-18 8:32:11 + * $Id: parse015.c,v 1.2 2004/05/08 15:40:34 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/strings.h> + +#ifdef DIAGNOSTIC +#define print_text_segment_list diag_print_text_segment_list +#define display_markup diag_display_markup +#endif + +/* ------------------------------------------------------------------------ */ +static void xx_print (FILE *fo, struct TEXT_ELEMENT *t, char *txt) +{ +#ifdef DIAGNOSTIC + struct TAG_DEFINITION *td; +#endif /* DIAGNOSTIC */ + + txt; + + if (t == (struct TEXT_ELEMENT *) 0) return; + + /* fprintf (fo, "%s: ", txt); */ + for (; t != (struct TEXT_ELEMENT *) 0; t= t->TE_next) + { +#ifdef DIAGNOSTIC + if ((td= t->TE_tag_definition) != (struct TAG_DEFINITION *) 0) + { + fputc ('[', fo); + display_tag_definition (fo, td); + fputc (']', fo); + } +#endif /* DIAGNOSTIC */ + + if (t->sig == SIG_TEXT_ELEMENT) + { + fprintf (fo, "<"); + print_text_segment_list (fo, t->TE_text_segment); + fprintf (fo, ">"); + } + } + fprintf (fo, "\n"); +} + +/* ------------------------------------------------------------------------ */ +void process_markup ( +struct HYX_PARSER_CLASS *hpc, +struct OUTPUT_DESCRIPTOR *od, +struct TEXT_ELEMENT *t) +/************* +int indent, +int verbosity, +int append_eoln, +int strip +) +*************/ +{ +#ifdef DIAGNOSTIC + struct TAG_DEFINITION *td; +#endif /* DIAGNOSTIC */ + struct MARKUP *m; + int item= 0; + + for (; t != (struct TEXT_ELEMENT *) 0; t= t->TE_next) + { + item++; + +#ifdef DIAGNOSTIC + if ((td= t->TE_tag_definition) != (struct TAG_DEFINITION *) 0) + { + fputc ('[', fo); + display_tag_definition (fo, td); + fputc (']', fo); + } +#endif /* DIAGNOSTIC */ + + blanks (fo, indent); + + if (t->sig == SIG_TEXT_ELEMENT) + { + /***** + fprintf (fo, "[%2d] TEXT_ELEMENT (%ld) ", item, t->TE_level); + *******/ + if (t->TE_level == 0) + { + print_text_segment_list (fo, t->TE_text_segment); + if (append_eoln) fputc ('\n', fo); + } else + if (t->TE_level == 1) + { + fputc ('<', fo); + print_text_segment_list (fo, t->TE_text_segment); + fputc ('>', fo); + if (append_eoln) fputc ('\n', fo); + } + } + else + if (t->sig == SIG_MARKUP) + { + m= (struct MARKUP *) t; + + if (verbosity > 1) + { + /* fprintf (fo, "[%2d] MARKUP\n", item); */ + /* blanks (fo, indent); */ + /* display_tag_definition (fo, m->tag_definition); */ + } + + if (verbosity > 0) + { + /* blanks (fo, indent); ... erfolgt bereits weiter vorne! */ + xx_print (fo, (struct TEXT_ELEMENT *) m->tag_open, "Start"); + } + + display_markup (fo, hpc, m->tagged_text, indent+2, verbosity, append_eoln, strip); + + if (m->tag_close != (void *) 0) + { + if (verbosity > 0) + { + blanks (fo, indent); /* ... here it's necessary to print blanks */ + xx_print (fo, (struct TEXT_ELEMENT *) m->tag_close, "Stop "); + } + } + } + else + { + fprintf (fo, "[%2d] unknown element in list! sig=%d\n", item, t->sig); + return; + } + } +} diff --git a/app/lexicon/parse016.c b/app/lexicon/parse016.c new file mode 100644 index 0000000000000000000000000000000000000000..fc2082fbd64afbe1a4e709590295bc57e92cb81f --- /dev/null +++ b/app/lexicon/parse016.c @@ -0,0 +1,174 @@ +/* + * FILE %lexicon/parse016.c + * + * print markup structure + * + * written: 1991 03 31 + * latest update: 1996-02-18 12:53:03 + * $Id: parse016.c,v 1.3 2004/05/08 15:40:34 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/strings.h> + +#ifdef DIAGNOSTIC +#define print_text_segment_list diag_print_text_segment_list +#define display_markup diag_display_markup +#define display_text_element diag_display_text_element +#endif + +/* ------------------------------------------------------------------------ */ +void display_text_element (FILE *fo, struct TEXT_ELEMENT *t, char *txt, int strip) +{ +#ifdef DIAGNOSTIC + struct TAG_DEFINITION *td; +#endif /* DIAGNOSTIC */ + char *cl= ""; + +#ifdef MSDOS + txt; +#endif + + if (t == (struct TEXT_ELEMENT *) 0) return; + + /* fprintf (fo, "%s: ", txt); */ + for (; t != (struct TEXT_ELEMENT *) 0; t= t->TE_next) + { + switch (t->TE_type) + { + case TEt_tag: cl= ""; break; + case TEt_declaration: cl= "!"; break; + case TEt_processing: cl= "?"; break; + default: cl= ""; break; + } + +#ifdef DIAGNOSTIC + fprintf (fo, "[lev=%ld%s]", t->TE_level, cl); + + if ((td= t->TE_tag_definition) != (struct TAG_DEFINITION *) 0) + { + fputc ('[', fo); + display_tag_definition (fo, td); + fputc (']', fo); + } +#endif /* DIAGNOSTIC */ + + if (t->sig == SIG_TEXT_ELEMENT) + { + fprintf (fo, "<%s", cl); + if (strip) + { + print_text_segment_list_stripped (fo, t->TE_text_segment); + } + else + { + print_text_segment_list (fo, t->TE_text_segment); + } + fprintf (fo, ">"); + } + } + + fprintf (fo, "\n"); +} + +/* ------------------------------------------------------------------------ */ +void display_markup ( +FILE *fo, +struct HYX_PARSER_CLASS *hpc, +struct TEXT_ELEMENT *t, +int indent, +int verbosity, +int append_eoln, +int strip) +{ +#ifdef DIAGNOSTIC + struct TAG_DEFINITION *td; +#endif /* DIAGNOSTIC */ + struct MARKUP *m; + int item= 0; + + for (; t != (struct TEXT_ELEMENT *) 0; t= t->TE_next) + { + item++; + + /**** fprintf (fo, "[sig=0x%04X]", t->sig); ****/ +#ifdef DIAGNOSTIC + if (t->sig == SIG_TEXT_ELEMENT) fprintf (fo, "(lev=%d)", t->TE_level); + if ((td= t->TE_tag_definition) != (struct TAG_DEFINITION *) 0) + { + fputc ('[', fo); + display_tag_definition (fo, td); + fputc (']', fo); + } +#endif /* DIAGNOSTIC */ + + blanks (fo, indent); + + if (t->sig == SIG_TEXT_ELEMENT) + { + /******* + fprintf (fo, "[%2d] TEXT_ELEMENT (%ld) ", item, t->TE_level); + *******/ + if (t->TE_level == 0) + { + print_text_segment_list (fo, t->TE_text_segment); + if (append_eoln) fputc ('\n', fo); + } + else + if (t->TE_level == 1) + { + char *cl; + + switch (t->TE_type) + { + case TEt_tag: cl= ""; break; + case TEt_declaration: cl= "!"; break; + case TEt_processing: cl= "?"; break; + default: cl= ""; break; + } + + fprintf (fo, "<%s", cl); + /**** print_text_segment_list_stripped (fo, t->TE_text_segment); ****/ + print_text_segment_list (fo, t->TE_text_segment); + fputc ('>', fo); + if (append_eoln) fputc ('\n', fo); + } + } + else + if (t->sig == SIG_MARKUP) + { + m= (struct MARKUP *) t; + + if (verbosity > 1) + { + /* fprintf (fo, "[%2d] MARKUP\n", item); */ + /* blanks (fo, indent); */ + /* display_tag_definition (fo, m->tag_definition); */ + } + + if (verbosity > 0) + { + /* blanks (fo, indent); ... erfolgt bereits weiter vorne! */ + display_text_element (fo, (struct TEXT_ELEMENT *) m->tag_open, "Start", strip); + } + + display_markup (fo, hpc, m->tagged_text, indent+2, verbosity, append_eoln, strip); + + if (m->tag_close != (void *) 0) + { + if (verbosity > 0) + { + blanks (fo, indent); /* ... here it's necessary to print blanks */ + display_text_element (fo, (struct TEXT_ELEMENT *) m->tag_close, "Stop ", strip); + } + } + } + else + { + fprintf (fo, "[%2d] unknown element in list! sig=%d\n", item, t->sig); + return; + } + } +} diff --git a/app/lexicon/parse016.o b/app/lexicon/parse016.o new file mode 100644 index 0000000000000000000000000000000000000000..582d261530789ccfd164daed8188a0a807405f10 Binary files /dev/null and b/app/lexicon/parse016.o differ diff --git a/app/lexicon/parse017.c b/app/lexicon/parse017.c new file mode 100644 index 0000000000000000000000000000000000000000..d58bc58ca60a661e3c9b279964c26e07282aee35 --- /dev/null +++ b/app/lexicon/parse017.c @@ -0,0 +1,34 @@ +/* + * FILE %usr/lexicon/parse017.c + * + * Tag Definition ausgeben + * + * written: 1991 03 31 + * 1995-03-31 + * latest update: 2001-02-18 19:32:43 + * $Id: parse017.c,v 1.2 2001/02/19 00:27:18 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +static char *TT [] = { "??", "rec", "nonrec", "end", "auto" } ; + +/* ------------------------------------------------------------------------ */ +void display_tag_definition (FILE *fo, struct TAG_DEFINITION *td) +{ + if (td->sig == SIG_TAG_DEFINITION) + { + fprintf (fo, + "TAGDEF '%s' id=0x%08lX tt=%s w=%ld mm=%d", + td->tag_name, + td->tag_id, + TT [td->tag_type], + td->tag_weight, + td->match_mode); + if (td->tag_comment != (char *) 0) + fprintf (fo, " cmt='%s'", td->tag_comment); + /* fputc ('\n', fo); */ + } +} diff --git a/app/lexicon/parse017.o b/app/lexicon/parse017.o new file mode 100644 index 0000000000000000000000000000000000000000..4cee0125c92ee855d90f43fac5412941d393bfab Binary files /dev/null and b/app/lexicon/parse017.o differ diff --git a/app/lexicon/parse019.c b/app/lexicon/parse019.c new file mode 100644 index 0000000000000000000000000000000000000000..668859b9fb2a6b50ebb375cb4d6f82ffb1b53b59 --- /dev/null +++ b/app/lexicon/parse019.c @@ -0,0 +1,121 @@ +/* + * FILE ~/usr/lexicon/parse019.c + * + * written: 1991 04 28 + * latest update: 1995-07-16 + * + */ + +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int parse_tag_sequence ( +char *tag_str, /* initial tag string to parse (without <>) */ +char *parse_string_array, /* character string to get parse array from */ +char *pt_array [], +int pt_type [], +int pt_max) +/* Return */ +/* < 0 ... error */ +/* -1 ... null-string to be parsed or null-string for parsing output */ +/* -2 ... parse_array to small */ +/* -99 ... internal parser error */ +/* 0 ... nothing parsed; */ +/* > 0 ... number of items found */ +{ + int parse_index, ch; + int items_found= 0; + int status= 0; +#define STATUS_start 0 +#define STATUS_tag_found 1 +#define STATUS_parameters 2 +#define STATUS_2parameter 3 +#define STATUS_attr_value 4 + int is_space; + + if (tag_str == (char *) 0) return -1; + + for (parse_index= 0; + (ch= tag_str [parse_index] & 0x00FF) != 0; + parse_index++) + { + is_space= (ch == 0x20 || ch == 0x09 || ch == 0x0A || ch == 0x0D); + switch (status) + { + case STATUS_start: + if (!is_space) + { + if (items_found >= pt_max) return -2; + status= STATUS_tag_found; + pt_array [items_found]= parse_string_array; + pt_type [items_found]= TAG_ITEM_TAG; + *parse_string_array++= (char) ch; + *parse_string_array= 0; + items_found++; + } + break; + + case STATUS_tag_found: + if (is_space) + { + parse_string_array++; + status= STATUS_parameters; + } else + { + *parse_string_array++= (char) ch; + *parse_string_array= 0; + } + break; + + case STATUS_parameters: + if (!is_space) + { + if (items_found >= pt_max) return -2; + status= STATUS_2parameter; + pt_array [items_found]= parse_string_array; + pt_type [items_found]= TAG_ITEM_PARAMETER; + *parse_string_array++= (char) ch; + *parse_string_array= 0; + items_found++; + } + break; + + case STATUS_2parameter: + if (is_space) + { + parse_string_array++; + status= STATUS_parameters; + } else + if (ch == '=') + { + *++parse_string_array= 0; + status= STATUS_attr_value; + pt_type [items_found-1]= TAG_ITEM_ATTR_NAME; + pt_array [items_found ]= parse_string_array; + pt_type [items_found ]= TAG_ITEM_ATTR_VALUE; + items_found++; + } else + { + *parse_string_array++= (char) ch; + *parse_string_array= 0; + } + break; + + case STATUS_attr_value: + if (is_space) + { + parse_string_array++; + status= STATUS_parameters; + } else + { + *parse_string_array++= (char) ch; + *parse_string_array= 0; + } + break; + + default: return -99; + } + } + + return items_found; +} diff --git a/app/lexicon/parse019.o b/app/lexicon/parse019.o new file mode 100644 index 0000000000000000000000000000000000000000..a44b947cfb43d93522cebf2712a5f8466abf2be2 Binary files /dev/null and b/app/lexicon/parse019.o differ diff --git a/app/lexicon/parse021.c b/app/lexicon/parse021.c new file mode 100644 index 0000000000000000000000000000000000000000..666d2b99a10c78831b4044bed5d3a98d8e14fdc1 --- /dev/null +++ b/app/lexicon/parse021.c @@ -0,0 +1,26 @@ +/* + * FILE ~/usr/lexicon/parse021.c + * + * Text Liste ausgeben + * + * written: 1994-11-16 + * latest update: 1995-08-19 + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +void dump_text_element_list (FILE *fo, struct TEXT_ELEMENT *t) +{ + for (; t != (struct TEXT_ELEMENT *) 0; t= t->TE_next) + { + if (t->sig == SIG_TEXT_ELEMENT) + { + fprintf (fo, "[%3ld", t->TE_level); + dump_text_segment_list (fo, t->TE_text_segment); + fputc (']', fo); + } + } +} diff --git a/app/lexicon/parse021.o b/app/lexicon/parse021.o new file mode 100644 index 0000000000000000000000000000000000000000..70a36845eaad301266a52b8dbabc631b8eb53fd3 Binary files /dev/null and b/app/lexicon/parse021.o differ diff --git a/app/lexicon/parse022.c b/app/lexicon/parse022.c new file mode 100644 index 0000000000000000000000000000000000000000..9be5d0d3d67a4263bb7b86ba6ca8d1cbdf9c56d7 --- /dev/null +++ b/app/lexicon/parse022.c @@ -0,0 +1,38 @@ +/* + * FILE ~/usr/lexicon/parse022.c + * + * Text Segment Liste ausgeben + * + * written: 1994-11-16 + * latest update: 1995-07-16 + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int dump_text_segment_list (FILE *fo, struct TEXT_SEGMENT *ts) +{ + long l; + char *cp; + int first_char= -1; + + if (ts != (struct TEXT_SEGMENT *) 0) + { + cp= ts->TSEG_text_array; + first_char= *cp; + goto PRINT_SEGMENT; + } + + while (ts != (void *) 0) + { + cp= ts->TSEG_text_array; +PRINT_SEGMENT: + fputc ('|', fo); + for (l= ts->TSEG_text_lng; l > 0; l--) fputc (*cp++, fo); + if ((ts= ts->TSEG_next) == (struct TEXT_SEGMENT *) 0) break; + } + + return first_char; +} diff --git a/app/lexicon/parse022.o b/app/lexicon/parse022.o new file mode 100644 index 0000000000000000000000000000000000000000..fe3cca73c4187bae95312e1859bb47b4dda3cf19 Binary files /dev/null and b/app/lexicon/parse022.o differ diff --git a/app/lexicon/possig.awk b/app/lexicon/possig.awk new file mode 100644 index 0000000000000000000000000000000000000000..8bccd5b6b9a547945ab71182df00b12cbc914029 --- /dev/null +++ b/app/lexicon/possig.awk @@ -0,0 +1,122 @@ +BEGIN { + fn=""; + fn2=""; + fp=0; + print "0 0 0 0 10 1 1 0" >"@$.ftr" + print "searching... [generated by possig.awk]" >"@$.pos" + al=2; +} +FILENAME!=fn2 { + print FILENAME + fn2=FILENAME; +} + + { wflg=0; } + +# include file checks -------------------------------------------------------- +#/include/ { +# x=$0; +# s1 = gsub (/\"/, "\"", x); +# s2 = gsub (/\\/, "/", x); +# s2+= gsub (/\//, "/", x); +# if (substr(x,1,1) == "#" && s1 > 0 && s2 > 0) prt(" \""); +#} +# /ed.h/ { next } +# /edhyx.h/ { next } +# /proto.h/ { next } +# /window.h/ { next } +# /message.h/ { next } +# /stdio.h/ { next } +# /string.h/ { next } +# /strings.h/ { next } +# /maus.h/ { next } +# /keys.h/ { next } +#/<malloc.h>/ { next } +# /include/ { prt("include"); } +# ---------------------------------------------------------------------------- + +#/FTR_display_replarray/ { prt("FTR_display_replarray"); } +#/ftr_replarray_size/ { prt("ftr_replarray_size"); } +#/highest_index/ { prt("highest_index"); } +#/next_index/ { prt("next_index"); } +#/IDX_REC_SIZE/ { prt("IDX_REC_SIZE"); } +#/12/ { prt("12"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/flclose_all/ { prt("flclose_all"); } +# /close_lexicon_filecache/ { prt("close_lexicon_filecache"); } +# /print_lexicon_filecache/ { prt("print_lexicon_filecache"); } +#/->/&&/next/ { prt("next"); } +#/index_file/ { prt("index_file"); } +#/s_p2o/ { prt("s_p2o"); } +#/s_o2p/ { prt("s_o2p"); } +#/dict_process_entry/ { prt("dict_process_entry"); } +# ------ Erweiterung um HYX_PARSER_CLASS +#/s_o2p/ { prt("s_o2p"); } +#/s_o2p/ { prt("s_o2p"); } +#/display_markup/ { prt("display_markup"); } +#/hyx_text_to_markup/ { prt("hyx_text_to_markup"); } +#/dict_restructure_new_entry/ { prt("dict_restructure_new_entry"); } +#/hyx_parse1_file/ { prt("hyx_parse1_file"); } +#/read_tag_definition/ { prt("read_tag_definition"); } +/DAMODE_DIVIDE/ { prt("DAMODE_DIVIDE"); } +# ------ Erweiterung um HYX_PARSER_CLASS II +#/dict_check_integrity/ { prt("dict_check_integrity"); } +#/find_tag_definition/ { prt("find_tag_definition "); } +#/new_tag_definition/ { prt("new_tag_definition"); } +#/process_tag_definition/ { prt("process_tag_definition"); } +#/find_tag_definition/ { prt("find_tag_definition"); } +#/dict_add_file/ { prt("dict_add_file"); } +#/dict_update_entry/ { prt("dict_update_entry"); } +#/dict_restructure2_entry/ { prt("dict_restructure2_entry"); } +#/process_markup/ { prt("process_markup"); } +#/hyx_parse_hyx_frame_file/ { prt("hyx_parse_hyx_frame_file"); } +#/hyx_text_to_markup/ { prt("hyx_text_to_markup"); } +# ------ Erweiterung um HYX_PARSER_CLASS III +#/identify_tag/ { prt("identify_tag"); } +#/dict_process_entry/ { prt("dict_process_entry"); } +#/hyx_parse_hyx_frame/ { prt("hyx_parse_hyx_frame"); } +#/hyx_ta_find_tag_definition/ { prt("hyx_ta_find_tag_definition"); } +# ------ Erweiterung um HYX_PARSER_CLASS IV +#/get_tag_definition/ { prt("get_tag_definition"); } +#/hyx_mktx_elem_and_segm/ { prt("hyx_mktx_elem_and_segm"); } +#/hyx_ta_store_node/ { prt("hyx_ta_store_node"); } +# ------ Erweiterung um HYX_PARSER_CLASS V +#/hyx_parse2_char/ { prt("hyx_parse2_char"); } +#/hyx_make_markup/ { prt("hyx_make_markup"); } +#/hyx_ta_parse_flush/ { prt("hyx_ta_parse_flush"); } +#/s_o2p/ { prt("s_o2p"); } +# ------------------------------------------- +#/dict_restructure2_entry/ { prt("dict_restructure2_entry"); } +#/<gg\// { prt("<gg/"); } +#hyx.l/ { prt("hyx.l"); } + +# ---------------------------------------------------------------------------- +wflg!=0 { + print FILENAME" ("FNR"): ", $0 >>"@$.pos"; + al++; +} + +function prt(t) { +# if (FILENAME != fn || fp != FNR) { + cs=1; + if (FNR >= 10) cs++; + if (FNR >= 100) cs++; + if (FNR >= 1000) cs++; + if (FNR >= 10000) cs++; + cl=length(t); + for (cx=length($0);cx>0;cx--) if (substr($0,cx,cl) == t) { + printf al" "cx+5+cs+length(FILENAME)" 1 " >>"@$.ftr"; + printf "<hyx.l file=\""FILENAME"\" ln="FNR" cn="cx-1 >>"@$.ftr"; + print " tdc=79 tdp="cl">" >>"@$.ftr"; + } + wflg=1; +# } + fn = FILENAME; + fp = FNR; +} diff --git a/app/lexicon/pt b/app/lexicon/pt new file mode 100755 index 0000000000000000000000000000000000000000..c74a6363dc085cba2ac1a2c88a4951fea8a02263 Binary files /dev/null and b/app/lexicon/pt differ diff --git a/app/lexicon/pt.c b/app/lexicon/pt.c new file mode 100644 index 0000000000000000000000000000000000000000..f9b4f07e8eacc3d3ebe91202234e9af40843b5a1 --- /dev/null +++ b/app/lexicon/pt.c @@ -0,0 +1,245 @@ +/* + * FILE %lexicon/pt.c + * + * written: 1991 03 12 + * latest update: 1996-02-18 9:53:23 + * $Id: pt.c,v 1.5 2004/05/08 15:40:34 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/array.h> +#include <gg/filename.h> +#include <gg/diagnose.h> +#include <gg/parse.h> +#include <gg/sgml.h> + +#ifdef MSDOS +#include <conio.h> +#endif + +/* ------------------------------------------------------------------------ */ +static char entry_key [ENTRY_KEY_SIZE]; + +static long end_tags [] = { SGML_TAG_endframe }; + +static int print_text_list= 0; +static int print_processed_list= 0; +static int print_markup_structure= 1; +static int print_diagnostic_mode= 0; +static int do_restructure= 1; +static int do_strip= 1; +static int do_strip_tags= 1; +static FILE *FO; +static char *fnm_out= (char *) 0; + +/* ------------------------------------------------------------------------ */ +#define GPL +static char *HELP []= +{ + "usage: pt [options] {file name}\n", + "normal options:\n", + " -X .. display everything\n", + " -H .. process HTML\n", + " -o<fnm> ... write output to file\n", + " -a<fnm> ... write output to file\n", + "toggle options: upper case=OFF, lower case=ON\n", + " -d .. turn on diagnose [DEF: off]\n", + " -m .. markup [DEF: on]\n", + " -p .. processed [DEF: off]\n", + " -t .. text [DEF: off]\n", + " -r .. restructure [DEF: on]\n", + " -s .. strip [DEF: on]\n", + " -z .. strip tags [DEF: on]\n", + "\n", + "(@)Apt.c 1.05 #D$2004-05-08 11:10:20\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv[]); +int cdecl read_file (struct HYX_PARSER_CLASS *hpc, char *fn); +int cdecl display_list (struct HYX_PARSER_CLASS *hpc, + struct TEXT_ELEMENT *te, int verbosity); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + int i; + int j; + char *tag_definitions; + struct HYX_PARSER_CLASS *hpc; + struct ARRAY_CONTROL *arguments; + char *arg; + FO= stdout; + tag_definitions= set_etc_filename ((char *) 0, "lexicon.tags"); + + if (argc <= 1 + || (hpc= hyx_init_parser_class ()) == (struct HYX_PARSER_CLASS *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) goto HLP; + +#ifdef DIAG + print_diagnostic_mode= 1; + print_processed_list= 1; + print_text_list= 1; +#endif /* DIAG */ + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + if (arg [0] == '-') + { + for (j= 1; arg [j]; j++) + switch (arg [j]) + { + case 'X': print_diagnostic_mode= 1; + print_markup_structure= 1; + print_processed_list= 1; + do_restructure= 1; + do_strip= 1; + do_strip_tags= 1; + print_text_list= 1; + break; + + case 'd': print_diagnostic_mode= 1; break; + case 'D': print_diagnostic_mode= 0; break; + case 'm': print_markup_structure= 1; break; + case 'M': print_markup_structure= 0; break; + case 'p': print_processed_list= 1; break; + case 'P': print_processed_list= 0; break; + case 'r': do_restructure= 1; break; + case 'R': do_restructure= 0; break; + case 's': do_strip= 1; break; + case 'S': do_strip= 0; break; + case 'z': do_strip_tags= 1; break; + case 'Z': do_strip_tags= 0; break; + case 't': print_text_list= 1; break; + case 'T': print_text_list= 0; break; + + case 'H': + hpc->HPC_minimization_char= 0; + hpc->HPC_meta_flags |= HPC_META_HTML; + break; + + case 'o': case 'a': + fnm_out= arg+2; + FO= fopen (fnm_out, (arg [j] == 'a') ? "a" : "w"); + goto DONE; + break; + +HLP: +#include <gg/help.inc> + } + +DONE: ; + } + else + { + array_push (arguments, (void *) arg); + } + } + + hyx_read_tag_definition (hpc, tag_definitions); + + while ((arg= (char *) array_shift (arguments)) != (char *) 0) + { + read_file (hpc, arg); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int read_file (struct HYX_PARSER_CLASS *hpc, char *fn) +{ + FILE *fi; + struct TEXT_ELEMENT *tx_new_entry; + struct MARKUP *markup_new; + long chars_read; + int rc; + + if ((fi= fopen (fn, "r")) == (FILE *) 0) return -1; + printf ("pt.c: reading file fn='%s'\n", fn); + + for (;;) + { + rc= hyx_parse1_file (hpc, fi, &tx_new_entry, end_tags, 1, + 0x7FFFFFFFL, &chars_read); + + if (tx_new_entry == (struct TEXT_ELEMENT *) 0) break; + + if (rc != 0 || chars_read == 0L) + { + printf ("hyx_parse_file: rc=%d chars_read=%ld diag=0x%08lX\n", + rc, chars_read, gg_diagnose); + if (gg_diagnose != LEX_RT_no_frame_close) break; + } + + if (print_text_list) + { + printf ("---------------- text list --------------------\n"); + display_list (hpc, tx_new_entry, 0); + } + + if (rc != 0 && (gg_diagnose == LEX_RT_no_frame_close)) break; + + if (do_restructure) + { + dict_restructure_new_entry (hpc, &tx_new_entry, + entry_key, ENTRY_KEY_SIZE, + do_strip, + (struct TEXT_ELEMENT *) 0, + (struct TEXT_ELEMENT *) 0); + + if (tx_new_entry == (struct TEXT_ELEMENT *) 0) + { + printf ("tx_new_entry == NIL\n"); + break; + } + + printf ("\nentry_key= '%s'\n", entry_key); + + if (*entry_key == 0) + { + printf ("ignoring empty entry\n"); + /* continue; */ + } + } + + if (print_processed_list) + { + printf ("------------ processed text list --------------\n"); + display_list (hpc, tx_new_entry, 0); + } + + if (print_markup_structure) + { + printf ("--- creating markup tree\n"); + rc= hyx_text_to_markup (hpc, tx_new_entry, &markup_new); + tx_new_entry= NULL; + if (rc == -1) break; + printf ("--------------- markup tree -------------------\n"); + display_list (hpc, (struct TEXT_ELEMENT *) markup_new, 1); + } + } +DONE: + fclose (fi); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int display_list ( +struct HYX_PARSER_CLASS *hpc, +struct TEXT_ELEMENT *te, +int verbosity) +{ + if (print_diagnostic_mode) + diag_display_markup (FO, hpc, te, 0, verbosity, 1, do_strip_tags); + else display_markup (FO, hpc, te, 0, verbosity, 1, do_strip_tags); + + return 0; +} diff --git a/app/lexicon/pt.o b/app/lexicon/pt.o new file mode 100644 index 0000000000000000000000000000000000000000..ee5f59a879f1a3f650fd8572a0284c04e6c06b67 Binary files /dev/null and b/app/lexicon/pt.o differ diff --git a/app/lexicon/test3a b/app/lexicon/test3a new file mode 100644 index 0000000000000000000000000000000000000000..7eaee6ff130dca62367aaacf4832801cd791a173 --- /dev/null +++ b/app/lexicon/test3a @@ -0,0 +1,5 @@ +<:ex1><LE>abcdef</LE>info test3a ex1<;> +<:ex2><LE>bcDefg</LE>info test3a ex2<;> +<:ex3><LE>cdefgh</LE>info test3a ex3<;> +<:ex4><LE>defgHi</LE>info test3a ex4<;> +<:ex5><LE>efghij</LE>info test3a ex5<;> diff --git a/app/lexicon/test3b b/app/lexicon/test3b new file mode 100644 index 0000000000000000000000000000000000000000..3f642079292ce6853f88d3ef0a2729e0480ed329 --- /dev/null +++ b/app/lexicon/test3b @@ -0,0 +1,5 @@ +<:ex1><LE>abcdef</LE>info test3b ex1<;> +<:ex2><LE>bcdefg</LE>info test3b ex2<;> +<:ex3><LE>cdefGh</LE>info test3b ex3<;> +<:ex4><LE>defghi</LE>info test3b ex4<;> +<:ex5><LE>efghij</LE>info test3b ex5<;> diff --git a/app/lexicon/testdata/test1.l b/app/lexicon/testdata/test1.l new file mode 100644 index 0000000000000000000000000000000000000000..b6bd2699e426e7babc0d212ce8a9d6ea2675d69a --- /dev/null +++ b/app/lexicon/testdata/test1.l @@ -0,0 +1,12 @@ +<:LX0000000><XE abc def><LE>this is an entry!</LE> +<;>text nach letzten frame +<:LXjunk>other text<ii>what's that< LE > +Word Number Two +</LE>< +-- take it or +leave it ... -- +> +<ISP xyz> yeah yeah</ISP><yeah> yeah to > be or not to > be +<SE<SE<SE>text in tag 1-3 +<tag/minimization/ +<;> diff --git a/app/lexicon/testdata/test2.l b/app/lexicon/testdata/test2.l new file mode 100644 index 0000000000000000000000000000000000000000..9c6a8c57459e11dfbb4567a7770b5a895cb0cc16 --- /dev/null +++ b/app/lexicon/testdata/test2.l @@ -0,0 +1,3 @@ +<:LX100><xLE>abc</xLE><F xx> +<SE>se1<F se1></SE> +<SE>se 2<JF @se2><SE>se2.2<IS xxx>abc<DT> ich kenn ihn nicht </SE></><;> diff --git a/app/lexicon/testdata/x1.l b/app/lexicon/testdata/x1.l new file mode 100644 index 0000000000000000000000000000000000000000..fba0bf72b48810896f76129b412648bea47ae82d --- /dev/null +++ b/app/lexicon/testdata/x1.l @@ -0,0 +1,3 @@ +<:> +<LE>LE</LE> +<;> diff --git a/app/lexicon/testdata/x2a.l b/app/lexicon/testdata/x2a.l new file mode 100644 index 0000000000000000000000000000000000000000..ad85104ebcd44bce2c6d3710649ba8f0e5c0b30c --- /dev/null +++ b/app/lexicon/testdata/x2a.l @@ -0,0 +1,24 @@ +<:> +<LE>arm</LE> +<II s=q561> +<F f=? l=e> +<TE l=d>arm +<TE l=g>arm +<;> + +<:> +<LE>arm</LE> +<II s=q561> +<F f=? l=d> +<TE l=e>arm +<TE l=g>arm +<;> + +<:> +<LE>arm</LE> +<II s=q561> +<F f=? l=g> +<TE l=d>arm +<TE l=e>arm +<;> + diff --git a/app/lexicon/testdata/x2b.l b/app/lexicon/testdata/x2b.l new file mode 100644 index 0000000000000000000000000000000000000000..34e157b7a872e52946cf011e6da23a8b3d12d1da --- /dev/null +++ b/app/lexicon/testdata/x2b.l @@ -0,0 +1,8 @@ +<:> +<LE>arm</LE> +<II s=q562> +<F f=? l=e> +<TE l=sp>brazo +<;> + + diff --git a/app/lexicon/tst1 b/app/lexicon/tst1 new file mode 100755 index 0000000000000000000000000000000000000000..84387c3c9d7eed8d98c21133116acea74cf16c7d Binary files /dev/null and b/app/lexicon/tst1 differ diff --git a/app/lexicon/tst1.c b/app/lexicon/tst1.c new file mode 100644 index 0000000000000000000000000000000000000000..231f04d3a2cef3ad819f1b337a941c5bf912442a --- /dev/null +++ b/app/lexicon/tst1.c @@ -0,0 +1,131 @@ +/* + * FILE ~/usr/lexicon/tst1.c + * + * Test fuer Modul lexut001.c + * + * written: 1991 04 28 + * latest update: 1995-07-16 + * + */ + + +#include <stdio.h> +#include <gg/sbr.h> +#include <gg/lexutil.h> + +#ifndef MSDOS +#ifndef cdecl +#define cdecl +#endif +#endif + +/* ------------------------------------------------------------------------ */ +#define LINE_SIZE 256 +static char line1 [LINE_SIZE]; +static char line2 [LINE_SIZE]; +static char word [LINE_SIZE]; +static char flags [LINE_SIZE]; +static char derived [LINE_SIZE]; + +static long records= 0L; +static long records_out= 0L; +static long flagged_records= 0L; + +int cdecl main (int argc, char *argv[]); +int cdecl read_ispell (FILE *fo, char *fn); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + int i; + FILE *fo; + int fo_open= 0; + + for (i= 1; i<argc; i++) + { + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'o': case 'O': + if (fo_open) fclose (fo); + fo_open= 0; + if ((fo= fopen (&argv[i][2], "wb")) != (FILE *) 0) fo_open= 1; + break; + } + else read_ispell ((fo_open) ? fo : (FILE *) stdout, argv[i]); + } + + fprintf (stderr, "# flagged records=%8ld\n", flagged_records); + fprintf (stderr, "# unflagged records=%8ld\n", records-flagged_records); + fprintf (stderr, " --------\n"); + fprintf (stderr, "# total records=%8ld\n", records); + fprintf (stderr, "# derivates =%8ld\n", records_out); + fprintf (stderr, "# output records =%8ld\n", records_out+flagged_records); + + return 0; + +} + +/* ------------------------------------------------------------------------ */ +int read_ispell (FILE *fo, char *fn) +{ + FILE *fi; + char *cp; + int i,rc; + int inflags; + + if ((fi= fopen (fn, "rb")) == (FILE *) 0) return -1; + + for (;;) + { + rc= fread_line (fi, line1, LINE_SIZE); + if (rc <= 0 && feof (fi)) break; + + cp= word; + flags[0]= 0; + inflags= 0; + for (i= 0; line1 [i]; i++) + { + if (line1 [i] == '/') + { + if (!inflags) + { + *cp= 0; + cp= flags; + inflags= 1; + } + } else *cp++= line1[i]; + } + + *cp= 0; + /* printf ("line1='%s'\n", line1); */ + /* printf ("word='%s' flags='%s'\n", word, flags); */ + records++; + if (flags[0]) + { + flagged_records++; + fprintf (fo, "<:><LE>%s</LE><F l=e wf=IS:O>", word); + } + + for (i= 0; flags[i]; i++) + { + rc= ISPELL_derive (word, flags[i], derived); + /******************* + printf ("word='%s' flag='%c' derived='%s' (rc=%d)\n", + word, flags[i], derived, rc); + *******************/ + fprintf (fo, "<WF l=e wf=IS:%c>%s</WF>", flags[i], derived); + records_out++; + } + if (flags[0]) fprintf (fo, "<;>\n"); + for (i=0; flags[i]; i++) + { + rc= ISPELL_derive (word, flags[i], derived); + fprintf (fo, "<:><LE>%s</LE><F l=e wf=IS:%c>", derived, flags[i]); + fprintf (fo, "<WF l=e wf=IS:O>%s</WF><;>\n", word); + } + } + + fclose (fi); + return 0; +} diff --git a/app/lexicon/tst2.c b/app/lexicon/tst2.c new file mode 100644 index 0000000000000000000000000000000000000000..e202f6569b08e1da64bf2781deeecb76dd3d0e18 --- /dev/null +++ b/app/lexicon/tst2.c @@ -0,0 +1,47 @@ +/* + * FILE ~/usr/lexicon/tst2.c + * + * Testmodul fuer parse0019.c + * + * written: 1991 04 28 + * latest update: 1995-07-16 + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +static char line [256]; +static char lin2 [256]; +static char *pts [ 64]; +static int ptt [ 64]; + +static char *str_types [] = { "???", "TAG", "PAR", "ANM", "AVL" } ; + +int cdecl main (void); + + +/* ------------------------------------------------------------------------ */ +int main () +{ + int parsed_items; + int i; + + for (;;) + { + printf ("tag sequence>"); + scanf ("%[^\n]", line); + if (feof (stdin)) break; + fgetc (stdin); + parsed_items= parse_tag_sequence (line, lin2, pts, ptt, 64); + printf ("parsed_items=%d\n", parsed_items); + for (i=0; i <parsed_items; i++) + { + printf ("item[%d] (%s) = '%s'\n", + i, str_types [ptt[i]], pts[i]); + } + } + + return 0; +} diff --git a/app/ned/(dirinf).fm b/app/ned/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..bcb0c2691c89eaf23c39a310e4b896a2783d8089 --- /dev/null +++ b/app/ned/(dirinf).fm @@ -0,0 +1,73 @@ +# +# FILE %ned/(dirinf).fm +# +# latest update: 2000-06-05 14:31:08 +# $Id: (dirinf).fm,v 1.10 2007/04/13 10:16:40 gonter Exp $ +# +. +------------------------------------------------------+ +.. | | +00 | globale Datenstrukturen | +01 | elementare Cursorsteuerung + Memorymanagement | +02 | Screen & Windows: Oeffnen, Schliessen, Verschieben | +03 | elementare Editierfunktionen | +04 | File I/O: Save- /Load-File | +05 | elementare Editierfunktionen | +06 | File- und Windowoperationen | +07 | Blockoperationen | +08 | Features, SGML, HyperText, Restart | +09 | NED-Setup, Makros und JOUR-File | +10 | Maus Steuerung | +11 | Find + Find/Switch | +12 | Context and Object Handling | +13 | Tools | +unix | adaptation modules for UN*X | +_bak_ftr.ned +------------------------------------------------------+ +(dirinf).fm | [ abbrev %ned/09/ned0925.c ] +readme.txt | compilation info and other stuff +release.txt | information about various releases +Makefile | Unix Makefile for the main module +# +# Headers -------------------------------------------------------------------- +ed.h | data structures; operation levels +edctx.h | context structures +edhyx.h | hypertext structures and definitions +edtcl.h | TCL interface +edtk.h | TK interface +proto.h | ANSI C Function Prototyping +# +# Editor Funktionen ---------------------------------------------------------- +ned00.c | NED Hauptmodul + Commandline Interpreter +# +# Portierungen --------------------------------------------------------------- +make-dos | current translation control +make-sbr | Unix Makefile for the sbr directory +make-l1.lst | list of NED core files to be packed in SHAR file +# test: q_ofile, hyx.l, q_join, stat p_1cross_ref split_string +int pq_feature_set (int what) ned_identify_feature +# +# Library -------------------------------------------------------------------- +ned.mod | list of library modules +ned.lib | NED Library +# +# NOTES ---------------------------------------------------------------------- +@fnd.sgm | recently found items +notes001.sgm | open/rename/... file +notes002.sgm | feature record editing +notes003.sgm | line callback +notes004.sgm | new features +notes005.sgm | hyx/ned calendar tools +notes006.sgm | window callbak +notes007.sgm | Blocks and Buffers +notes008.sgm | Docu Considerations +notes009.sgm | SGML tag handling +notes010.sgm | AGENDA +notes011.sgm | Suche nach mysterioesen Core Dumps +notes012.sgm | USE_TK und USE_CURSES +notes_tk.sgml +# +# sonstiges ------------------------------------------------------------------ +possig.pl | find things, new version +ned.stp | setup file +msdos | MSDOS adaption files and tools +_relics_.zip | Alte Versionen; Reste; etc. +* | diff --git a/app/ned/.cvsignore b/app/ned/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..05111e3faa902fc3de9ca8df65992f97f1515a9b --- /dev/null +++ b/app/ned/.cvsignore @@ -0,0 +1,16 @@ +n00_cur +n00_tk +n02_tk +n02_cur +n0*.core +ned00 +GPATH +GRTAGS +GSYMS +GTAGS +HTML +@* +test*.txt +test*.ftr +test*.sgm +test*.sgml diff --git a/app/ned/00/(dirinf).fm b/app/ned/00/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..ba51a2d43342283221de9ab7dc3ce2b74a981d60 --- /dev/null +++ b/app/ned/00/(dirinf).fm @@ -0,0 +1,43 @@ +# +# File %ned/00/(dirinf).fm +# +# latest update: 2000-08-24 15:10:21 +# $Id: (dirinf).fm,v 1.3 2002/06/15 04:35:20 gonter Exp $ +# +# ---------------------------------------------------------------------------- +Makefile | active Makefile (DOS or Unix) +make-dos | DOS Makefile + +ned0001.c | command table: main file +ned0001a.c | command table: main group +ned0001c.c | command table: function key group for curses +ned0001f.c | command table: function key group for PCs +ned0001k.c | command table: prefix group k +ned0001o.c | command table: prefix group o +ned0001q.c | command table: prefix group q +ned0001t.c | command table: function key group for Tk (X11) +ned0001u.c | command table: prefix group u +ned0001v.c | command table: vi commands +ned0001x.c | command table: dummy block +ned0001?.c | command table: ... +ned0002.c | Primitives Table +ned0003.c | Maus Menue Initialisierung +ned0004.c | global ds: windows, files +ned0005.c | global ds: blocks, marker +ned0006.c | global ds: console, input, macro, setup +ned0006b.c | global ds: input handler +ned0007.c | global ds: colour attribute + +ned0009.c | re-declaration of functions for editor commands +ned0010.c | global ds: additional screen control +ned0011.c | global ds: defaults and setup parameters + +ned0015.c | global ds: context related structures +ned0016v.c | vi table +ned0016w.c | wordstar table +ned0016p.c | pico table + +ned0031.c | hyx viewer, main command table +ned0031f.c | hyx viewer, function key command table + +* | diff --git a/app/ned/00/Makefile b/app/ned/00/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..6a5572ddb86cc8448b42c7e29d9308e6b798754c --- /dev/null +++ b/app/ned/00/Makefile @@ -0,0 +1,57 @@ +# +# FILE %ned/00/make-ux (Makefile) +# +# latest update: 2000-08-24 13:45:14 +# $Id: Makefile,v 1.6 2002/10/18 05:56:19 gonter Exp $ +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-c -g -I.. $(cf) +CC=cc +ccc=$(CC) $(OPTS) +objs=ned0003.o ned0004.o ned0005.o ned0006.o\ + ned0006b.o ned0007.o ned0010.o ned0011.o ned0015.o +objs_cur= ned0001_cur.o ned0002_cur.o +objs_tk= ned0001_tk.o ned0002_tk.o +lib_tk= ../ned_tk.a +lib_cur= ../ned_cur.a + +all: lib_tk lib_cur +clean : + rm *.o lib_tk lib_cur + +lib_tk : $(objs_tk) $(objs) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h + $(ccc) $*.c + +# --- Tk Version ------ +ned0001_tk.o : ../ed.h ned0001.c ned0009.c \ + ned0001a.c ned0001c.c ned0001k.c ned0001o.c ned0001q.c ned0001x.c\ + ned0001u.c ned0001v.c ned0001t.c ned0016w.c ned0016v.c ned0016p.c + $(ccc) -DUSE_TK -o ned0001_tk.o ned0001.c + +ned0002_tk.o : ../ed.h ned0002.c ned0009.c + $(ccc) -DUSE_TK -o ned0002_tk.o ned0002.c + +# --- Curses Version ------ +ned0001_cur.o : ../ed.h ned0001.c ned0009.c \ + ned0001a.c ned0001c.c ned0001k.c ned0001o.c ned0001q.c ned0001x.c\ + ned0001u.c ned0001t.c ned0016w.c ned0016v.c ned0016p.c + $(ccc) -o ned0001_cur.o ned0001.c + +ned0002_cur.o : ../ed.h ned0002.c ned0009.c + $(ccc) -o ned0002_cur.o ned0002.c + +# --- General Version ------ +ned0003.o : ../ed.h ned0003.c ned0009.c + $(ccc) ned0003.c + +ned0008.o : ../ed.h ../edhyx.h ned0008.c + $(ccc) ned0008.c diff --git a/app/ned/00/contrib b/app/ned/00/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/00/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/00/gg b/app/ned/00/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/00/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/00/lib_cur b/app/ned/00/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/00/lib_tk b/app/ned/00/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/00/make-dos b/app/ned/00/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..88b288e55825f66a8dea24fd12ac77bb11968c08 --- /dev/null +++ b/app/ned/00/make-dos @@ -0,0 +1,38 @@ +# +# FILE %ned/00/makefile +# +# GG's Night(mare) Editor System +# +# written: 1990-01-01 +# latest update: 1997-08-03 22:15:43 +# +# ============================================================================ +cc=cl -Os -AL /c +ccc=cl -Os -AL /W3 /Fo$@ -I.. /c +obj=objdec -m0 -w -sl 2 NED00_TEXT $@ + +lib : ! + ned0001.obj ned0002.obj ned0003.obj ned0004.obj ned0005.obj ! + ned0006.obj ned0006b.obj ned0007.obj ned0010.obj ned0011.obj ! + ned0015.obj ned0031.obj + +.c.obj : + $(ccc) $? + $(obj) + +# ============================================================================ +ned0001.obj : ..\ed.h ned0001.c ned0009.c ! + ned0001a.c ned0001f.c ned0001k.c ned0001o.c ned0001q.c ned0001x.c ! + ned0001v.c ned0001u.c ned0016v.c ned0016w.c ned0016p.c + $(ccc) ned0001.c + $(obj) + +ned0008.obj : ..\ed.h ..\edhyx.h ned0008.c + $(ccc) ned0008.c + $(obj) + +# +ned0031.obj : ..\ed.h ned0031.c ned0009.c ! + ned0031a.c ned0031f.c ned0031v.c + $(ccc) ned0031.c + $(obj) diff --git a/app/ned/00/ned0001.c b/app/ned/00/ned0001.c new file mode 100644 index 0000000000000000000000000000000000000000..9a1ad3807e9eb10141911db279f138f6228b2cda --- /dev/null +++ b/app/ned/00/ned0001.c @@ -0,0 +1,103 @@ +/* + * FILE %ned/00/ned0001.c + * + * Sprungtabelle fuer Editor ned.c + * bzw. ned[0-7].c + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * 1991 02 07: Revision + * 1991 06 01: Revision; Aenderung des Table Layouts + * 1993-08-01: include table for vi mode + * latest update: 1997-02-20 12:44:14 + * $Id: ned0001.c,v 1.2 2007/12/02 11:55:23 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifndef MSDOS +#ifndef cdecl +#define cdecl +#endif +#endif + +#include "ed.h" +#include "ned0009.c" /* Deklaration der primitiven Funktionen */ + +#define xx p_mac +#ifndef xx +static int cdecl xx (void); +static int xx () { return 0; } /* Dummyfunktion */ +#endif + +#ifdef MSDOS +#define TBL_SIZE 0x0480 +#define DOSPRIM(x) (x) /* use dummy primitive */ +#else +#define TBL_SIZE 0x0500 +#define DOSPRIM(x) (xx) /* use dummy primitive */ +#endif + +#ifndef TBL_CTRL_SIZE +#define TBL_CTRL_SIZE 32 +#endif /* TBL_CTRL_SIZE */ + +/* ------------------------------------------------------------------------ */ +#ifdef USE_TK +#define TK(x) (x) /* use stated primitive */ +#else +#define TK(x) (xx) /* use dummy primitive */ +#endif + +char *PFX_XX [] = + { "WS", "1?", "^Q", "^K", "^O", "^U", "VI", "@@", "7?", "^P" } ; + +char *PFX_QUOTE= "^P"; + +/* ------------------------------------------------------------------------ */ +int (*P_TBL [TBL_SIZE]) () = +{ +#include "ned0001a.c" /* * prefix group a: no prefix */ +, +#include "ned0001q.c" /* * prefix group q: ^Q */ +, +#include "ned0001k.c" /* * prefix group k: ^K */ +, +#include "ned0001o.c" /* * prefix group o: ^O */ +, +#include "ned0001u.c" /* * prefix group u: ^U */ +, +#include "ned0001v.c" /* * vi command table */ +, +#ifdef MSDOS +#include "ned0001f.c" /* * prefix group f: function keys */ +#else +#ifdef USE_TK +#include "ned0001t.c" /* * prefix group x: dummy group */ +#else +#include "ned0001c.c" /* * prefix group x: dummy group */ +#endif /* !USE_TK */ +#endif /* !MSDOS */ +} ; + +/* ------------------------------------------------------------------------ */ +int (*P_TBL_WordStar [TBL_CTRL_SIZE]) () = +{ +#include "ned0016w.c" +} ; + +/* ------------------------------------------------------------------------ */ +int (*P_TBL_VI [TBL_CTRL_SIZE]) () = +{ +#include "ned0016v.c" +} ; + +/* ------------------------------------------------------------------------ */ +int (*P_TBL_PICO [TBL_CTRL_SIZE]) () = +{ +#include "ned0016p.c" +} ; diff --git a/app/ned/00/ned0001a.c b/app/ned/00/ned0001a.c new file mode 100644 index 0000000000000000000000000000000000000000..67f5ed0934dccff7a83d47ae7339d15b220c6d4c --- /dev/null +++ b/app/ned/00/ned0001a.c @@ -0,0 +1,50 @@ +/* + * FILE %ned/00/ned0001a.c + * + * Sprungtabelle fuer Editor ned.c + * Praefix-Gruppe a (kein Praefix) + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * 1991 02 07: Revision + * 1991 06 01: Revision; Aenderung des Table Layouts + * 1992 01 16: Aufteilung in include Files fuer + * jede Praefix-Gruppe + * latest update: 1997-08-03 9:47:46 + * + */ + +/* WordStar default mode */ +#include "ned0016w.c" +, + +/* 20 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 28 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 30 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 38 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 40 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 48 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 50 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 58 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 60 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 68 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 70 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 78 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, ned_del_char_left, + +/* 80 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 88 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 90 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* 98 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* A0 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* A8 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* B0 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* B8 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* C0 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* C8 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* D0 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* D8 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* E0 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* E8 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* F0 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, +/* F8 */ p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins, p_ins diff --git a/app/ned/00/ned0001c.c b/app/ned/00/ned0001c.c new file mode 100644 index 0000000000000000000000000000000000000000..4cebccb0813e7d78c6258da3a87db9ed2ddc19d4 --- /dev/null +++ b/app/ned/00/ned0001c.c @@ -0,0 +1,269 @@ +/* + * FILE %ned/00/ned0001c.c + * + * jump table for editor NED: + * group c: curses keypad codes (256!) + * + * written: 1994-12-25 + * latest update: 2001-02-12 0:50:06 + * $Id: ned0001c.c,v 1.2 2001/02/12 00:03:14 gonter Exp $ + * + */ + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* 00 */ xx, /* 0400 KEY_0000: */ +/* 01 */ xx, /* 0401 KEY_BREAK: break key (unreliable) */ +/* 02 */ ned_cursor_down, /* 0402 KEY_DOWN: The four arrow keys ... */ +/* 03 */ ned_cursor_up, /* 0403 KEY_UP: */ +/* 04 */ ned_cursor_left, /* 0404 KEY_LEFT: */ +/* 05 */ ned_cursor_right, /* 0405 KEY_RIGHT: ... */ +/* 06 */ ned_jmp_boln,/* 0406 KEY_HOME: Home key (upward+left arrow) */ +/* 07 */ ned_del_char_left, /* 0407 KEY_BACKSPACE: (unreliable) */ +/* 08 */ xx, /* 0410 KEY_F0: Function keys. Space for 64 */ +/* 09 */ xx, /* 0411 KEY_F1: F1 */ +/* 0A */ xx, /* 0411 KEY_F2: F2 */ +/* 0B */ xx, /* 0411 KEY_F3: F3 */ +/* 0C */ xx, /* 0411 KEY_F4: F4 */ +/* 0D */ xx, /* 0411 KEY_F5: F5 */ +/* 0E */ xx, /* 0411 KEY_F6: F6 */ +/* 0F */ xx, /* 0411 KEY_F7: F7 */ +/* 10 */ p_ssave, /* 0411 KEY_F8: F8 */ +/* 11 */ ned_set_lookup_tag, /* 0411 KEY_F9: F9 */ +/* 12 */ p_activate_cl1, /* 0411 KEY_F10: F10 */ +/* 13 */ xx, /* 0411 KEY_F11: F11 */ +/* 14 */ xx, /* 0411 KEY_F12: F12 */ +/* 15 */ xx, /* 0411 KEY_F13: F13 */ +/* 16 */ xx, /* 0411 KEY_F14: F14 */ +/* 17 */ xx, /* 0411 KEY_F15: F15 */ +/* 18 */ xx, /* 0411 KEY_F16: F16 */ +/* 19 */ xx, /* 0411 KEY_F17: F17 */ +/* 1A */ xx, /* 0411 KEY_F18: F18 */ +/* 1B */ xx, /* 0411 KEY_F19: F19 */ +/* 1C */ xx, /* 0411 KEY_F20: F20 */ +/* 1D */ xx, /* 0411 KEY_F21: F21 */ +/* 1E */ xx, /* 0411 KEY_F22: F22 */ +/* 1F */ xx, /* 0411 KEY_F23: F23 */ +/* 20 */ xx, /* 0411 KEY_F24: F24 */ +/* 21 */ xx, /* 0411 KEY_F25: F25 */ +/* 22 */ xx, /* 0411 KEY_F26: F26 */ +/* 23 */ xx, /* 0411 KEY_F27: F27 */ +/* 24 */ xx, /* 0411 KEY_F28: F28 */ +/* 25 */ xx, /* 0411 KEY_F29: F29 */ +/* 26 */ xx, /* 0411 KEY_F30: F30 */ +/* 27 */ xx, /* 0411 KEY_F31: F31 */ +/* 28 */ xx, /* 0411 KEY_F32: F32 */ +/* 29 */ xx, /* 0411 KEY_F33: F33 */ +/* 2A */ xx, /* 0411 KEY_F34: F34 */ +/* 2B */ xx, /* 0411 KEY_F35: F35 */ +/* 2C */ xx, /* 0411 KEY_F36: F36 */ +/* 2D */ xx, /* 0411 KEY_F37: F37 */ +/* 2E */ xx, /* 0411 KEY_F38: F38 */ +/* 2F */ xx, /* 0411 KEY_F39: F39 */ +/* 30 */ xx, /* 0411 KEY_F40: F40 */ +/* 31 */ xx, /* 0411 KEY_F41: F41 */ +/* 32 */ xx, /* 0411 KEY_F42: F42 */ +/* 33 */ xx, /* 0411 KEY_F43: F43 */ +/* 34 */ xx, /* 0411 KEY_F44: F44 */ +/* 35 */ xx, /* 0411 KEY_F45: F45 */ +/* 36 */ xx, /* 0411 KEY_F46: F46 */ +/* 37 */ xx, /* 0411 KEY_F47: F47 */ +/* 38 */ xx, /* 0411 KEY_F48: F48 */ +/* 39 */ xx, /* 0411 KEY_F49: F49 */ +/* 3A */ xx, /* 0411 KEY_F50: F50 */ +/* 3B */ xx, /* 0411 KEY_F51: F51 */ +/* 3C */ xx, /* 0411 KEY_F52: F52 */ +/* 3D */ xx, /* 0411 KEY_F53: F53 */ +/* 3E */ xx, /* 0411 KEY_F54: F54 */ +/* 3F */ xx, /* 0411 KEY_F55: F55 */ +/* 40 */ xx, /* 0411 KEY_F56: F56 */ +/* 41 */ xx, /* 0411 KEY_F57: F57 */ +/* 42 */ xx, /* 0411 KEY_F58: F58 */ +/* 43 */ xx, /* 0411 KEY_F59: F59 */ +/* 44 */ xx, /* 0411 KEY_F60: F60 */ +/* 45 */ xx, /* 0411 KEY_F61: F61 */ +/* 46 */ xx, /* 0411 KEY_F62: F62 */ +/* 47 */ xx, /* 0411 KEY_F63: F63 */ +/* 48 */ xx, /* 0510 KEY_DL: Delete line */ +/* 49 */ xx, /* 0511 KEY_IL: Insert line */ +/* 4A */ ned_del_char_right, /* 0512 KEY_DC: Delete character */ +/* 4B */ p_ovins, /* 0513 KEY_IC: Insert char or enter insert mode */ +/* 4C */ xx, /* 0514 KEY_EIC: Exit insert char mode */ +/* 4D */ xx, /* 0515 KEY_CLEAR: Clear screen */ +/* 4E */ xx, /* 0516 KEY_EOS: Clear to end of screen */ +/* 4F */ xx, /* 0517 KEY_EOL: Clear to end of line */ +/* 50 */ xx, /* 0520 KEY_SF: Scroll 1 line forward */ +/* 51 */ xx, /* 0521 KEY_SR: Scroll 1 line backwards (reverse) */ +/* 52 */ ned_page_down, /* 0522 KEY_NPAGE: Next page */ +/* 53 */ ned_page_up, /* 0523 KEY_PPAGE: Previous page */ +/* 54 */ xx, /* 0524 KEY_STAB: Set tab */ +/* 55 */ xx, /* 0525 KEY_CTAB: Clear tab */ +/* 56 */ xx, /* 0526 KEY_CATAB: Clear all tabs */ +/* 57 */ xx, /* 0527 KEY_ENTER: Enter or send (unreliable) */ +/* 58 */ xx, /* 0530 KEY_SRESET: soft (partial) reset (unreliable) */ +/* 59 */ xx, /* 0531 KEY_RESET: reset or hard reset (unreliable) */ +/* 5A */ xx, /* 0532 KEY_PRINT: print or copy */ +/* 5B */ xx, /* 0533 KEY_LL: home down or bottom (lower left) */ +/* 5C */ xx, /* 0534 KEY_A1: Upper left of keypad */ +/* 5D */ xx, /* 0535 KEY_A3: Upper right of keypad */ +/* 5E */ xx, /* 0536 KEY_B2: Center of keypad */ +/* 5F */ xx, /* 0537 KEY_C1: Lower left of keypad */ +/* 60 */ xx, /* 0540 KEY_C3: Lower right of keypad */ +/* 61 */ xx, /* 0541 KEY_BTAB: Back tab key */ +/* 62 */ xx, /* 0542 KEY_BEG: beg(inning) key */ +/* 63 */ xx, /* 0543 KEY_CANCEL: cancel key */ +/* 64 */ xx, /* 0544 KEY_CLOSE: close key */ +/* 65 */ xx, /* 0545 KEY_COMMAND: cmd (command) key */ +/* 66 */ xx, /* 0546 KEY_COPY: copy key */ +/* 67 */ xx, /* 0547 KEY_CREATE: create key */ +/* 68 */ ned_jmp_eoln,/* 0550 KEY_END: end key */ +/* 69 */ xx, /* 0551 KEY_EXIT: exit key */ +/* 6A */ xx, /* 0552 KEY_FIND: find key */ +/* 6B */ xx, /* 0553 KEY_HELP: help key */ +/* 6C */ xx, /* 0554 KEY_MARK: mark key */ +/* 6D */ xx, /* 0555 KEY_MESSAGE: message key */ +/* 6E */ xx, /* 0556 KEY_MOVE: move key */ +/* 6F */ xx, /* 0557 KEY_NEXT: next object key */ +/* 70 */ xx, /* 0560 KEY_OPEN: open key */ +/* 71 */ xx, /* 0561 KEY_OPTIONS: options key */ +/* 72 */ xx, /* 0562 KEY_PREVIOUS: previous object key */ +/* 73 */ xx, /* 0563 KEY_REDO: redo key */ +/* 74 */ xx, /* 0564 KEY_REFERENCE: ref(erence) key */ +/* 75 */ xx, /* 0565 KEY_REFRESH: refresh key */ +/* 76 */ xx, /* 0566 KEY_REPLACE: replace key */ +/* 77 */ xx, /* 0567 KEY_RESTART: restart key */ +/* 78 */ xx, /* 0570 KEY_RESUME: resume key */ +/* 79 */ xx, /* 0571 KEY_SAVE: save key */ +/* 7A */ xx, /* 0572 KEY_SBEG: shifted beginning key */ +/* 7B */ xx, /* 0573 KEY_SCANCEL: shifted cancel key */ +/* 7C */ xx, /* 0574 KEY_SCOMMAND: shifted command key */ +/* 7D */ xx, /* 0575 KEY_SCOPY: shifted copy key */ +/* 7E */ xx, /* 0576 KEY_SCREATE: shifted create key */ +/* 7F */ xx, /* 0577 KEY_SDC: shifted delete char key */ +/* 80 */ xx, /* 0600 KEY_SDL: shifted delete line key */ +/* 81 */ xx, /* 0601 KEY_SELECT: select key */ +/* 82 */ xx, /* 0602 KEY_SEND: shifted end key */ +/* 83 */ xx, /* 0603 KEY_SEOL: shifted clear line key */ +/* 84 */ xx, /* 0604 KEY_SEXIT: shifted exit key */ +/* 85 */ xx, /* 0605 KEY_SFIND: shifted find key */ +/* 86 */ xx, /* 0606 KEY_SHELP: shifted help key */ +/* 87 */ xx, /* 0607 KEY_SHOME: shifted home key */ +/* 88 */ xx, /* 0610 KEY_SIC: shifted input key */ +/* 89 */ xx, /* 0611 KEY_SLEFT: shifted left arrow key */ +/* 8A */ xx, /* 0612 KEY_SMESSAGE: shifted message key */ +/* 8B */ xx, /* 0613 KEY_SMOVE: shifted move key */ +/* 8C */ xx, /* 0614 KEY_SNEXT: shifted next key */ +/* 8D */ xx, /* 0615 KEY_SOPTIONS: shifted options key */ +/* 8E */ xx, /* 0616 KEY_SPREVIOUS: shifted prev key */ +/* 8F */ xx, /* 0617 KEY_SPRINT: shifted print key */ +/* 90 */ xx, /* 0620 KEY_SREDO: shifted redo key */ +/* 91 */ xx, /* 0621 KEY_SREPLACE: shifted replace key */ +/* 92 */ xx, /* 0622 KEY_SRIGHT: shifted right arrow */ +/* 93 */ xx, /* 0623 KEY_SRSUME: shifted resume key */ +/* 94 */ xx, /* 0624 KEY_SSAVE: shifted save key */ +/* 95 */ xx, /* 0625 KEY_SSUSPEND: shifted suspend key */ +/* 96 */ xx, /* 0626 KEY_SUNDO: shifted undo key */ +/* 97 */ xx, /* 0627 KEY_SUSPEND: suspend key */ +/* 98 */ xx, /* 0630 KEY_UNDO: undo key */ +/* 99 */ xx, /* 0631 KEY_UNKN: */ +/* 9A */ xx, /* 0631 KEY_UNKN: */ +/* 9B */ xx, /* 0631 KEY_UNKN: */ +/* 9C */ xx, /* 0631 KEY_UNKN: */ +/* 9D */ xx, /* 0631 KEY_UNKN: */ +/* 9E */ xx, /* 0631 KEY_UNKN: */ +/* 9F */ xx, /* 0631 KEY_UNKN: */ +/* A0 */ xx, /* 0631 KEY_UNKN: */ +/* A1 */ xx, /* 0631 KEY_UNKN: */ +/* A2 */ xx, /* 0631 KEY_UNKN: */ +/* A3 */ xx, /* 0631 KEY_UNKN: */ +/* A4 */ xx, /* 0631 KEY_UNKN: */ +/* A5 */ xx, /* 0631 KEY_UNKN: */ +/* A6 */ xx, /* 0631 KEY_UNKN: */ +/* A7 */ xx, /* 0631 KEY_UNKN: */ +/* A8 */ xx, /* 0631 KEY_UNKN: */ +/* A9 */ xx, /* 0631 KEY_UNKN: */ +/* AA */ xx, /* 0631 KEY_UNKN: */ +/* AB */ xx, /* 0631 KEY_UNKN: */ +/* AC */ xx, /* 0631 KEY_UNKN: */ +/* AD */ xx, /* 0631 KEY_UNKN: */ +/* AE */ xx, /* 0631 KEY_UNKN: */ +/* AF */ xx, /* 0631 KEY_UNKN: */ +/* B0 */ xx, /* 0631 KEY_UNKN: */ +/* B1 */ xx, /* 0631 KEY_UNKN: */ +/* B2 */ xx, /* 0631 KEY_UNKN: */ +/* B3 */ xx, /* 0631 KEY_UNKN: */ +/* B4 */ xx, /* 0631 KEY_UNKN: */ +/* B5 */ xx, /* 0631 KEY_UNKN: */ +/* B6 */ xx, /* 0631 KEY_UNKN: */ +/* B7 */ xx, /* 0631 KEY_UNKN: */ +/* B8 */ xx, /* 0631 KEY_UNKN: */ +/* B9 */ xx, /* 0631 KEY_UNKN: */ +/* BA */ xx, /* 0631 KEY_UNKN: */ +/* BB */ xx, /* 0631 KEY_UNKN: */ +/* BC */ xx, /* 0631 KEY_UNKN: */ +/* BD */ xx, /* 0631 KEY_UNKN: */ +/* BE */ xx, /* 0631 KEY_UNKN: */ +/* BF */ xx, /* 0631 KEY_UNKN: */ +/* C0 */ xx, /* 0631 KEY_UNKN: */ +/* C1 */ xx, /* 0631 KEY_UNKN: */ +/* C2 */ xx, /* 0631 KEY_UNKN: */ +/* C3 */ xx, /* 0631 KEY_UNKN: */ +/* C4 */ xx, /* 0631 KEY_UNKN: */ +/* C5 */ xx, /* 0631 KEY_UNKN: */ +/* C6 */ xx, /* 0631 KEY_UNKN: */ +/* C7 */ xx, /* 0631 KEY_UNKN: */ +/* C8 */ xx, /* 0631 KEY_UNKN: */ +/* C9 */ xx, /* 0631 KEY_UNKN: */ +/* CA */ xx, /* 0631 KEY_UNKN: */ +/* CB */ xx, /* 0631 KEY_UNKN: */ +/* CC */ xx, /* 0631 KEY_UNKN: */ +/* CD */ xx, /* 0631 KEY_UNKN: */ +/* CE */ xx, /* 0631 KEY_UNKN: */ +/* CF */ xx, /* 0631 KEY_UNKN: */ +/* D0 */ xx, /* 0631 KEY_UNKN: */ +/* D1 */ xx, /* 0631 KEY_UNKN: */ +/* D2 */ xx, /* 0631 KEY_UNKN: */ +/* D3 */ xx, /* 0631 KEY_UNKN: */ +/* D4 */ xx, /* 0631 KEY_UNKN: */ +/* D5 */ xx, /* 0631 KEY_UNKN: */ +/* D6 */ xx, /* 0631 KEY_UNKN: */ +/* D7 */ xx, /* 0631 KEY_UNKN: */ +/* D8 */ xx, /* 0631 KEY_UNKN: */ +/* D9 */ xx, /* 0631 KEY_UNKN: */ +/* DA */ xx, /* 0631 KEY_UNKN: */ +/* DB */ xx, /* 0631 KEY_UNKN: */ +/* DC */ xx, /* 0631 KEY_UNKN: */ +/* DD */ xx, /* 0631 KEY_UNKN: */ +/* DE */ xx, /* 0631 KEY_UNKN: */ +/* DF */ xx, /* 0631 KEY_UNKN: */ +/* E0 */ xx, /* 0631 KEY_UNKN: */ +/* E1 */ xx, /* 0631 KEY_UNKN: */ +/* E2 */ xx, /* 0631 KEY_UNKN: */ +/* E3 */ xx, /* 0631 KEY_UNKN: */ +/* E4 */ xx, /* 0631 KEY_UNKN: */ +/* E5 */ xx, /* 0631 KEY_UNKN: */ +/* E6 */ xx, /* 0631 KEY_UNKN: */ +/* E7 */ xx, /* 0631 KEY_UNKN: */ +/* E8 */ xx, /* 0631 KEY_UNKN: */ +/* E9 */ xx, /* 0631 KEY_UNKN: */ +/* EA */ xx, /* 0631 KEY_UNKN: */ +/* EB */ xx, /* 0631 KEY_UNKN: */ +/* EC */ xx, /* 0631 KEY_UNKN: */ +/* ED */ xx, /* 0631 KEY_UNKN: */ +/* EE */ xx, /* 0631 KEY_UNKN: */ +/* EF */ xx, /* 0631 KEY_UNKN: */ +/* F0 */ xx, /* 0631 KEY_UNKN: */ +/* F1 */ xx, /* 0631 KEY_UNKN: */ +/* F2 */ xx, /* 0631 KEY_UNKN: */ +/* F3 */ xx, /* 0631 KEY_UNKN: */ +/* F4 */ xx, /* 0631 KEY_UNKN: */ +/* F5 */ xx, /* 0631 KEY_UNKN: */ +/* F6 */ xx, /* 0631 KEY_UNKN: */ +/* F7 */ xx, /* 0631 KEY_UNKN: */ +/* F8 */ xx, /* 0631 KEY_UNKN: */ +/* F9 */ xx, /* 0631 KEY_UNKN: */ +/* FA */ xx, /* 0631 KEY_UNKN: */ +/* FB */ xx, /* 0631 KEY_UNKN: */ +/* FC */ xx, /* 0631 KEY_UNKN: */ +/* FD */ xx, /* 0631 KEY_UNKN: */ +/* FE */ xx, /* 0631 KEY_UNKN: */ +/* FF */ xx /* 0777 KEY_MAX: Maximum curses key */ diff --git a/app/ned/00/ned0001f.c b/app/ned/00/ned0001f.c new file mode 100644 index 0000000000000000000000000000000000000000..30da3a11815d6a83621078e4e558bb2ddc8961c8 --- /dev/null +++ b/app/ned/00/ned0001f.c @@ -0,0 +1,290 @@ +/* + * FILE %ned/00/ned0001f.c + * + * jump table for editor NED: + * group f: IBM-PC function keys + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * 1991 02 07: Revision + * 1991 06 01: Revision; Aenderung des Table Layouts + * 1992 01 16: Aufteilung in include Files fuer jede + * Praefix-Gruppe + * latest update: 2001-02-12 0:37:48 + * $Id: ned0001f.c,v 1.3 2001/02/12 00:03:14 gonter Exp $ + * + */ + +/* 4. Praefix: Funktionstasten der IBM Tastatur - - - - - - - - - - - - - - */ +/* 00 */ xx, /* */ +/* 01 */ xx, /* ALT-ESC */ +/* 02 */ xx, /* */ +/* 03 */ xx, /* */ +/* 04 */ xx, /* */ +/* 05 */ xx, /* */ +/* 06 */ xx, /* */ +/* 07 */ xx, /* */ +/* 08 */ xx, /* */ +/* 09 */ xx, /* */ +/* 0A */ xx, /* */ +/* 0B */ xx, /* */ +/* 0C */ xx, /* */ +/* 0D */ xx, /* */ +/* 0E */ xx, /* */ +/* 0F */ ned_set_mark, /* Shift-TAB: set mark tag */ + +/* 10 */ ned_jmp_marker_1, /* ALT-Q: */ +/* 11 */ p_link_feature, /* ALT-W: Feature Window oeffnen */ +/* 12 */ p_edsetup, /* ALT-E: Setup File editieren */ +/* 13 */ p_rdsetup, /* ALT-R: Setup File einlesen */ +/* 14 */ p_window_menu, /* ALT-T: Window Menu */ +/* 15 */ ned_delete_word, /* ALT-Y: Delete Word Right */ +/* 16 */ ned_line_end_UNIX, /* ALT-U: -> UNIX Line End */ +/* 17 */ ned_line_end_MSDOS, /* ALT-I: -> MSDOS Line End */ +/* 18 */ ned_memorize_location, /* ALT-O: store frame or file */ +/* 19 */ p_feature_prev, /* ALT-P: Jump 2 Prev Feature */ +/* 1A */ p_find_higher_bracket, /* ALT-[ */ +/* 1B */ p_find_lower_bracket, /* ALT-] */ +/* 1C */ xx, /* */ +/* 1D */ xx, /* */ +/* 1E */ ned_show_author, /* ALT-A: Author ausgeben */ +/* 1F */ xx, /* ALT-S: */ + +/* 20 */ p_mac_define, /* ALT-D: Define Makro */ +/* 21 */ p_feature_set, /* ALT-F: Feature setzen */ +/* 22 */ p_feature_reset, /* ALT-G: Feature loeschen */ +/* 23 */ ned_set_hyx_l, /* ALT-H: hyx.l setzen */ +/* 24 */ ned_set_SGML_tag, /* ALT-J: SGML Tag setzen */ +/* 25 */ ned_set_SGML_entity, /* ALT-K: SGML Entity setzen */ +/* 26 */ DOSPRIM(p_switch_line_mode), /* ALT-L: lines ... */ +/* 27 */ xx, /* ALT-; */ +/* 28 */ xx, /* ALT-' */ +/* 29 */ ned_read_entity, /* ALT-(backtick) */ +/* 2A */ xx, /* */ +/* 2B */ p_find_matching_bracket,/*ALT-\ */ +/* 2C */ xx, /* ALT-Z: */ +/* 2D */ ned_eval_feature, /* ALT-X: Ausfuehrung eines Features */ +/* 2E */ p_cross_ref, /* ALT-C: Cross Referencing */ +/* 2F */ ned_eval_block, /* ALT-V: Ausfuehrung eines Blocks */ + +/* 30 */ xx, /* ALT-B: */ +/* 31 */ p_feature_next, /* ALT-N: Jump 2 Next Feature */ +/* 32 */ p_menue, /* ALT-M: Menue aktivieren */ +/* 33 */ xx, /* ALT-, */ +/* 34 */ xx, /* ALT-. */ +/* 35 */ xx, /* ALT-/ */ +/* 36 */ xx, /* */ +/* 37 */ xx, /* ALT-NKP-* */ +/* 38 */ xx, /* */ +/* 39 */ xx, /* */ +/* 3A */ xx, /* */ +/* 3B */ p_macro01, /* F1: Makro 01 */ +/* 3C */ p_macro02, /* F2 */ +/* 3D */ p_macro03, /* F3 */ +/* 3E */ p_macro04, /* F4 */ +/* 3F */ p_refresh, /* F5 */ + +/* 40 */ p_macro06, /* F6 */ +/* 41 */ p_sx, /* F7: save and exit */ +/* 42 */ p_ssave, /* F8: Save actual Window if Update, Close */ +/* 43 */ p_activate_fr_root, /* F9: root frame in local cluster */ +/* 44 */ p_activate_cl1, /* F10: special cluster 1 (help) */ +/* 45 */ xx, /* */ +/* 46 */ xx, /* */ +/* 47 */ ned_jmp_boln, /* HOME: Anfang der Zeile */ +/* 48 */ ned_cursor_up, /* CURSOR UP */ +/* 49 */ ned_page_up, /* PAGE UP */ +/* 4A */ xx, /* ALT-NKP-- */ +/* 4B */ ned_cursor_left, /* CURSOR LEFT */ +/* 4C */ xx, /* */ +/* 4D */ ned_cursor_right, /* CURSOR RIGHT */ +/* 4E */ xx, /* ALT-NKP-+ */ +/* 4F */ ned_jmp_eoln, /* END: Ende der Zeile */ + +/* 50 */ ned_cursor_down, /* CURSOR DOWN */ +/* 51 */ ned_page_down, /* PAGE DOWN */ +/* 52 */ p_ovins, /* INSERT */ +/* 53 */ ned_del_char_right, /* DELETE */ +/* 54 */ p_macro11, /* SF1 */ +/* 55 */ p_macro12, /* SF2 */ +/* 56 */ p_macro13, /* SF3 */ +/* 57 */ p_macro14, /* SF4 */ +/* 58 */ p_refresh_all, /* SF5 */ +/* 59 */ p_macro16, /* SF6 */ +/* 5A */ p_macro17, /* SF7 */ +/* 5B */ ned_ssave_all, /* SF8 */ +/* 5C */ p_activate_fr_notes, /* SF9: notes frame in local cluster */ +/* 5D */ p_activate_cl2, /* SF10: special cluster 2 (notes) */ +/* 5E */ p_macro21, /* CF1 */ +/* 5F */ p_macro22, /* CF2 */ + +/* 60 */ p_macro23, /* CF3 */ +/* 61 */ p_macro24, /* CF4 */ +/* 62 */ p_colornxt, /* CF5 */ +/* 63 */ p_macro26, /* CF6 */ +/* 64 */ p_macro27, /* CF7 */ +/* 65 */ p_macro28, /* CF8 */ +/* 66 */ p_activate_fr_help, /* CF9: help frame in local cluster */ +/* 67 */ p_activate_cl3, /* CF10: special cluster 3 */ +/* 68 */ p_macro31, /* AF1 */ +/* 69 */ p_macro32, /* AF2 */ +/* 6A */ p_macro33, /* AF3 */ +/* 6B */ p_macro34, /* AF4 */ +/* 6C */ p_backcolnxt, /* AF5 */ +/* 6D */ p_macro36, /* AF6 */ +/* 6E */ p_macro37, /* AF7 */ +/* 6F */ p_macro38, /* AF8 */ + +/* 70 */ ned_p_activate_cl_fr, /* AF9: prompt for cluster and frame */ +/* 71 */ p_activate_cl4, /* AF10: special cluster 4 */ +/* 72 */ xx, /* Ctrl-PrtScr */ +/* 73 */ p_word_left, /* Ctrl-Left */ +/* 74 */ p_word_right_beg, /* Ctrl-Right */ +/* 75 */ xx, /* Ctrl-End */ +/* 76 */ pq_dn, /* Ctrl-PgDn */ +/* 77 */ xx, /* Ctrl-Home */ +/* 78 */ p_macro41, /* ALT-1: */ +/* 79 */ p_macro42, /* ALT-2: */ +/* 7A */ p_macro43, /* ALT-3: */ +/* 7B */ p_macro44, /* ALT-4: */ +/* 7C */ p_macro45, /* ALT-5: */ +/* 7D */ p_macro46, /* ALT-6: */ +/* 7E */ p_macro47, /* ALT-7: */ +/* 7F */ p_macro48, /* ALT-8: */ + +/* 80 */ p_macro49, /* ALT-9: */ +/* 81 */ p_macro40, /* ALT-0: */ +/* 82 */ p_alt_minus, /* ALT--: Character 196, 0xC4 */ +/* 83 */ p_alt_gleich, /* ALT-=: Character 205, 0xCD */ +/* 84 */ pq_up, /* Ctrl-PgUp */ +/* 85 */ p_split_join, /* F11 */ +/* 86 */ xx, /* F12 */ +/* 87 */ xx, /* SF11 */ +/* 88 */ xx, /* SF12 */ +/* 89 */ xx, /* CF11 */ +/* 8A */ xx, /* CF12 */ +/* 8B */ xx, /* AF11 */ +/* 8C */ xx, /* AF12 */ +/* 8D */ ned_page_up, /* CTRL-CURSOR-UP */ +/* 8E */ xx, /* */ +/* 8F */ xx, /* */ + +/* 90 */ xx, /* */ +/* 91 */ ned_page_down, /* CTRL-CURSOR-DOWN */ +/* 92 */ xx, /* CTRL-Insert */ +/* 93 */ xx, /* CTRL-Delete */ +/* 94 */ ned_set_lookup_tag_fr, /* CTRL-TAB */ +/* 95 */ xx, /* */ +/* 96 */ xx, /* */ +/* 97 */ p_logic_link_up, /* ALT-HOME */ +/* 98 */ ned_page_up, /* ALT-CURSOR-UP */ +/* 99 */ p_logic_link_prev, /* ALT-PGUP */ +/* 9A */ xx, /* */ +/* 9B */ ned_jmp_boln, /* ALT-CURSOR-LEFT */ +/* 9C */ xx, /* */ +/* 9D */ ned_jmp_eoln, /* ALT-CURSOR-RIGHT */ +/* 9E */ xx, /* */ +/* 9F */ p_logic_link_menu, /* ALT-END */ + +/* A0 */ ned_page_down, /* ALT-CURSOR-DOWN */ +/* A1 */ p_logic_link_next, /* ALT-PGDN */ +/* A2 */ xx, /* ALT-INS */ +/* A3 */ xx, /* ALT-DEL */ +/* A4 */ xx, /* ALT-NKP-/ */ +/* A5 */ ned_set_lookup_tag, /* ALT-TAB: set tag after name lookup */ +/* A6 */ xx, /* ALT-NKP-ENTER */ +/* A7 */ xx, /* */ +/* A8 */ xx, /* */ +/* A9 */ xx, /* */ +/* AA */ xx, /* */ +/* AB */ xx, /* */ +/* AC */ xx, /* */ +/* AD */ xx, /* */ +/* AE */ xx, /* */ +/* AF */ xx, /* */ + +/* B0 */ xx, /* */ +/* B1 */ xx, /* */ +/* B2 */ xx, /* */ +/* B3 */ xx, /* */ +/* B4 */ xx, /* */ +/* B5 */ xx, /* */ +/* B6 */ xx, /* */ +/* B7 */ xx, /* */ +/* B8 */ xx, /* */ +/* B9 */ xx, /* */ +/* BA */ xx, /* */ +/* BB */ xx, /* */ +/* BC */ xx, /* */ +/* BD */ xx, /* */ +/* BE */ xx, /* */ +/* BF */ xx, /* */ + +/* C0 */ xx, /* */ +/* C1 */ xx, /* */ +/* C2 */ xx, /* */ +/* C3 */ xx, /* */ +/* C4 */ xx, /* */ +/* C5 */ xx, /* */ +/* C6 */ xx, /* */ +/* C7 */ xx, /* */ +/* C8 */ xx, /* */ +/* C9 */ xx, /* */ +/* CA */ xx, /* */ +/* CB */ xx, /* */ +/* CC */ xx, /* */ +/* CD */ xx, /* */ +/* CE */ xx, /* */ +/* CF */ xx, /* */ + +/* D0 */ xx, /* */ +/* D1 */ xx, /* */ +/* D2 */ xx, /* */ +/* D3 */ xx, /* */ +/* D4 */ xx, /* */ +/* D5 */ xx, /* */ +/* D6 */ xx, /* */ +/* D7 */ xx, /* */ +/* D8 */ xx, /* */ +/* D9 */ xx, /* */ +/* DA */ xx, /* */ +/* DB */ xx, /* */ +/* DC */ xx, /* */ +/* DD */ xx, /* */ +/* DE */ xx, /* */ +/* DF */ xx, /* */ + +/* E0 */ xx, /* */ +/* E1 */ xx, /* */ +/* E2 */ xx, /* */ +/* E3 */ xx, /* */ +/* E4 */ xx, /* */ +/* E5 */ xx, /* */ +/* E6 */ xx, /* */ +/* E7 */ xx, /* */ +/* E8 */ xx, /* */ +/* E9 */ xx, /* */ +/* EA */ xx, /* */ +/* EB */ xx, /* */ +/* EC */ xx, /* */ +/* ED */ xx, /* */ +/* EE */ xx, /* */ +/* EF */ xx, /* */ + +/* F0 */ xx, /* */ +/* F1 */ xx, /* */ +/* F2 */ xx, /* */ +/* F3 */ xx, /* */ +/* F4 */ xx, /* */ +/* F5 */ xx, /* */ +/* F6 */ xx, /* */ +/* F7 */ xx, /* */ +/* F8 */ xx, /* */ +/* F9 */ xx, /* */ +/* FA */ xx, /* */ +/* FB */ xx, /* */ +/* FC */ xx, /* */ +/* FD */ xx, /* */ +/* FE */ xx, /* */ +/* FF */ xx /* */ diff --git a/app/ned/00/ned0001k.c b/app/ned/00/ned0001k.c new file mode 100644 index 0000000000000000000000000000000000000000..ed8c16d96c09586ac7e267d1aefd159fda23bc73 --- /dev/null +++ b/app/ned/00/ned0001k.c @@ -0,0 +1,156 @@ +/* + * FILE %ned/00/ned0001k.c + * + * Sprungtabelle fuer Editor ned.c + * Praefix-Gruppe k: ^K + * see also: ned0001.c + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * 1991 02 07: Revision + * 1991 06 01: Revision; Aenderung des Table Layouts + * 1992 01 16: Aufteilung in include files fuer + * jede Praefix-Gruppe + * 1993-08-29 + * latest update: 2000-08-11 6:55:27 + * $Id: ned0001k.c,v 1.3 2001/02/12 00:03:14 gonter Exp $ + * + */ + +/* 2. Praefix Ctrl K: Block and File Operations - - - - - - - - - - - - - - */ +/* 00 */ xx, +/* 01 */ ned_blk_append, /* ^K^A: Block Append to File */ +/* 02 */ p_blkbeg, /* ^K^B: Block Begin Marker setzen */ +/* 03 */ ned_blk_copy, /* ^K^C: Block Copy */ +/* 04 */ p_ssave, /* ^K^D: Save File and Close Window */ +/* 05 */ ned_eval_str, /* ^K^E: eval string */ +/* 06 */ p_show_tag, /* ^K^F: reload but show tags as text */ +/* 07 */ p_fget, /* ^K^G: Lese File ein */ +/* 08 */ p_hideblk, /* ^K^H: Block Hide Toggle */ +/* 09 */ ned_blk_iconify, /* ^K^I: iconify block */ +/* 0A */ xx, /* ^K^J */ +/* 0B */ p_blkend, /* ^K^K: Block End Marker setzen */ +/* 0C */ p_link, /* ^K^L: Window auf File verketten */ +/* 0D */ xx, /* ^K^M */ +/* 0E */ ned_rename_object, /* ^K^N: File umbenennen */ +/* 0F */ xx, /* ^K^O */ + +/* 10 */ ned_blk_print, /* ^K^P: print block */ +/* 11 */ p_abandon, /* ^K^Q: File verwerfen */ +/* 12 */ ned_blk_read, /* ^K^R: Read Block from File */ +/* 13 */ p_save, /* ^K^S: Save File */ +/* 14 */ ned_pico_exit, /* ^K^T: Save As ... */ +/* 15 */ p_unlink, /* ^K^U unlink a window from window chain */ +/* 16 */ ned_blk_move, /* ^K^V: Block verschieben */ +/* 17 */ ned_blk_write, /* ^K^W: Write Block to File */ +/* 18 */ p_sx, /* ^K^X: Alle Files sichern und AUS */ +/* 19 */ ned_blk_delete, /* ^K^Y: Block loeschen */ +/* 1A */ p_qabandon, /* ^K^Z: Editieren abbrechen */ +/* 1B */ xx, /* ^K^ */ +/* 1C */ xx, /* ^K^ */ +/* 1D */ xx, /* ^K^ */ +/* 1E */ xx, /* ^K^ */ +/* 1F */ xx, /* ^K^ */ + +/* 20 */ xx, /* ^K-Blank: Reset Prefix */ +/* 21 */ ned_paste_file_name, /* ^K! */ +/* 22 */ ned_paste_user, /* ^K": for german keyboards */ +/* 23 */ ned_paste_date, /* ^K# */ +/* 24 */ ned_paste_date_time, /* ^K$ */ +/* 25 */ ned_group_set_marker, /* ^K% */ +/* 26 */ ned_paste_date_string, /* ^K& */ +/* 27 */ xx, /* ^K' */ +/* 28 */ ned_set_marker_key, /* ^K( */ +/* 29 */ ned_set_marker_key, /* ^K) */ +/* 2A */ ned_paste_seconds, /* ^K* */ +/* 2B */ ned_blk_mode, /* ^K+: Block Mode aendern */ +/* 2C */ xx, /* ^K, */ +/* 2D */ xx, /* ^K-: */ +/* 2E */ xx, /* ^K. */ +/* 2F */ p_extract, /* ^K/: extract current information */ + +/* 30 */ ned_set_marker_key, /* ^K0: Marker 0 setzen */ +/* 31 */ ned_set_marker_key, /* ^K1 */ +/* 32 */ ned_set_marker_key, /* ^K2 */ +/* 33 */ ned_set_marker_key, /* ^K3 */ +/* 34 */ ned_set_marker_key, /* ^K4 */ +/* 35 */ ned_set_marker_key, /* ^K5 */ +/* 36 */ ned_set_marker_key, /* ^K6 */ +/* 37 */ ned_set_marker_key, /* ^K7 */ +/* 38 */ ned_set_marker_key, /* ^K8 */ +/* 39 */ ned_set_marker_key, /* ^K9 */ +/* 3A */ xx, /* ^K: */ +/* 3B */ xx, /* ^K; */ +/* 3C */ TK(ned_tk_import_selection), /*^K< import current selection */ +/* 3D */ xx, /* ^K= */ +/* 3E */ TK(ned_tk_claim_selection),/* ^K> */ +/* 3F */ ned_paste_renamed_object, /* ^K? */ + +/* 40 */ ned_paste_user, /* ^K@ */ +/* 41 */ ned_blk_append, /* ^KA */ +/* 42 */ p_blkbeg, /* ^KB */ +/* 43 */ ned_blk_copy, /* ^KC */ +/* 44 */ p_ssave, /* ^KD */ +/* 45 */ ned_eval_str, /* ^KE */ +/* 46 */ p_show_tag_normally, /* ^KF: reload but show tags normally */ +/* 47 */ p_fget, /* ^KG */ +/* 48 */ p_hideblk, /* ^KH */ +/* 49 */ ned_blk_iconify, /* ^KI: iconify block */ +/* 4A */ xx, /* ^KJ */ +/* 4B */ p_blkend, /* ^KK */ +/* 4C */ p_link, /* ^KL */ +/* 4D */ xx, /* ^KM */ +/* 4E */ ned_rename_object, /* ^KN */ +/* 4F */ xx, /* ^KO */ + +/* 50 */ ned_blk_print, /* ^KP: print block */ +/* 51 */ p_abandon, /* ^KQ */ +/* 52 */ ned_blk_read, /* ^KR */ +/* 53 */ p_save, /* ^KS */ +/* 54 */ ned_pico_exit, /* ^KT */ +/* 55 */ p_unlink, /* ^KU */ +/* 56 */ ned_blk_move, /* ^KV */ +/* 57 */ ned_blk_write, /* ^KW */ +/* 58 */ p_sx, /* ^KX */ +/* 59 */ ned_blk_delete, /* ^KY */ +/* 5A */ p_qabandon, /* ^KZ */ +/* 5B */ ned_set_marker_key, /* ^K[ */ +/* 5C */ ned_group_set_marker, /* ^K\ */ +/* 5D */ ned_set_marker_key, /* ^K] */ +/* 5E */ xx, /* ^K^ */ +/* 5F */ xx, /* ^K_ */ + +/* 60 */ xx, /* ^K` */ +/* 61 */ ned_blk_append, /* ^Ka */ +/* 62 */ p_blkbeg, /* ^Kb */ +/* 63 */ ned_blk_copy, /* ^Kc */ +/* 64 */ p_ssave, /* ^Kd */ +/* 65 */ ned_eval_str, /* ^Ke */ +/* 66 */ p_save_reload, /* ^Kf: reload text; see also ^K^F, ^KF */ +/* 67 */ p_fget, /* ^Kg */ +/* 68 */ p_hideblk, /* ^Kh */ +/* 69 */ ned_blk_iconify, /* ^Ki: iconify block */ +/* 6A */ xx, /* ^Kj */ +/* 6B */ p_blkend, /* ^Kk */ +/* 6C */ p_link, /* ^Kl */ +/* 6D */ xx, /* ^Km */ +/* 6E */ ned_rename_object, /* ^Kn */ +/* 6F */ xx, /* ^Ko */ + +/* 70 */ ned_blk_print, /* ^Kp: print block */ +/* 71 */ p_abandon, /* ^Kq */ +/* 72 */ ned_blk_read, /* ^Kr */ +/* 73 */ p_save, /* ^Ks */ +/* 74 */ ned_pico_exit, /* ^Kt */ +/* 75 */ p_unlink, /* ^Ku */ +/* 76 */ ned_blk_move, /* ^Kv */ +/* 77 */ ned_blk_write, /* ^Kw */ +/* 78 */ p_sx, /* ^Kx */ +/* 79 */ ned_blk_delete, /* ^Ky */ +/* 7A */ p_qabandon, /* ^Kz */ +/* 7B */ ned_set_marker_key, /* ^K{ */ +/* 7C */ xx, /* ^K| */ +/* 7D */ ned_set_marker_key, /* ^K} */ +/* 7E */ xx, /* ^K~ */ +/* 7F */ xx /* ^K-Delete */ diff --git a/app/ned/00/ned0001o.c b/app/ned/00/ned0001o.c new file mode 100644 index 0000000000000000000000000000000000000000..3977463200c2fa586e72705de94d08390cec1bbe --- /dev/null +++ b/app/ned/00/ned0001o.c @@ -0,0 +1,155 @@ +/* + * FILE %ned/00/ned0001o.c + * + * Sprungtabelle fuer Editor ned.c + * Praefix-Gruppe o: ^O + * included by ned0001.c + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * 1991 02 07: Revision + * 1991 06 01: Revision; Aenderung des Table Layouts + * 1992 01 16: Aufteilung in include Files fuer + * jede Praefix-Gruppe + * latest update: 1997-06-13 14:08:28 + * $Id: ned0001o.c,v 1.2 2005/04/01 16:46:20 gonter Exp $ + * + */ + +/* 3. Praefix Ctrl O: On Screen Operations - - - - - - - - - - - - - - - - */ +/* 00 */ xx, /* ^O */ +/* 01 */ p_ww, /* ^O^A: Word Wrap togglen */ +/* 02 */ p_backcolnxt, /* ^O^B: Hintergrundfarbe aendern */ +/* 03 */ p_colornxt, /* ^O^C: Vordergrundfarbe aendern */ +/* 04 */ xx, /* ^O^D: */ +/* 05 */ xx, /* ^O^E: */ +/* 06 */ p_link_feature, /* ^O^F: Open Feature Winow */ +/* 07 */ p_refresh, /* ^O^G: Aktuelles Window Refreshen */ +/* 08 */ ned_set_lookup_tag, /* ^O^H: set tag after name lookup */ +/* 09 */ p_aitoggle, /* ^O^I: Toggle Auto Indent Mode */ +/* 0A */ xx, /* ^O^J */ +/* 0B */ xx, /* ^O^K */ +/* 0C */ p_clone_window, /* ^O^L */ +/* 0D */ ned_set_mark, /* ^O^M: set mark tag */ +/* 0E */ ned_pr_jump_to_line, /* ^O^N: Sprung auf Zeile # */ +/* 0F */ p_wdwopen, /* ^O^O: Open New Window (unnamed) */ + +/* 10 */ xx, /* ^O^P */ +/* 11 */ p_wdwqfile, /* ^O^Q: Abandon File / Close Window */ +/* 12 */ p_ofile2, /* ^O^R: Open Window / Read File */ +/* 13 */ p_rdsetup, /* ^O^S: Read Setup File */ +/* 14 */ p_refresh_all, /* ^O^T: Alle Windows Refreshen */ +/* 15 */ p_format_SGML, /* ^O^U: File Format SGML */ +/* 16 */ p_format_ASCII, /* ^O^V: File Format ASCII */ +/* 17 */ p_wdwsize, /* ^O^W: Window Groesse aendern */ +/* 18 */ xx, /* ^O^X */ +/* 19 */ ned_close_window, /* ^O^Y: Close Window (if possible) */ +/* 1A */ p_clone_window, /* ^O^Z: Open Window and Link */ +/* 1B */ xx, /* ^O^ */ +/* 1C */ xx, /* ^O^ */ +/* 1D */ xx, /* ^O^ */ +/* 1E */ xx, /* ^O^ */ +/* 1F */ xx, /* ^O^ */ + +/* 20 */ xx, /* ^O */ +/* 21 */ xx, /* ^O */ +/* 22 */ xx, /* ^O */ +/* 23 */ xx, /* ^O */ +/* 24 */ xx, /* ^O */ +/* 25 */ xx, /* ^O */ +/* 26 */ xx, /* ^O */ +/* 27 */ xx, /* ^O */ +/* 28 */ xx, /* ^O */ +/* 29 */ xx, /* ^O */ +/* 2A */ xx, /* ^O */ +/* 2B */ p_insblk, /* ^O+: Eingabe Sperren / Toggle */ +/* 2C */ TK(ned_tk_aw_iconify), /* ^O, */ +/* 2D */ QQdeb, /* ^O-: Debugger Zeile umschalten */ +/* 2E */ TK(ned_tk_aw_withdraw),/* ^O. */ +/* 2F */ TK(ned_tk_aw_deiconify),/* ^O/ (does this work??) */ + +/* 30 */ xx, /* ^O0 */ +/* 31 */ p_jmpwdw, /* ^O1: Sprung ins Window # 1 */ +/* 32 */ p_jmpwdw, /* ^O */ +/* 33 */ p_jmpwdw, /* ^O */ +/* 34 */ p_jmpwdw, /* ^O */ +/* 35 */ p_jmpwdw, /* ^O */ +/* 36 */ p_jmpwdw, /* ^O */ +/* 37 */ p_jmpwdw, /* ^O */ +/* 38 */ p_jmpwdw, /* ^O */ +/* 39 */ p_jmpwdw, /* ^O */ +/* 3A */ xx, /* ^O: */ +/* 3B */ xx, /* ^O; */ +/* 3C */ ned_markup_block_prompt, /* ^O< */ +/* 3D */ xx, /* ^O= */ +/* 3E */ xx, /* ^O> */ +/* 3F */ TK(ned_tk_aw_save_withdraw),/* ^O? */ + +/* 40 */ xx, /* ^O@ */ +/* 41 */ p_ww, /* ^OA Word Wrap togglen */ +/* 42 */ p_backcolnxt, /* ^OB */ +/* 43 */ p_colornxt, /* ^OC */ +/* 44 */ xx, /* ^OD */ +/* 45 */ xx, /* ^OE */ +/* 46 */ p_link_feature, /* ^OF Open Feature Winow */ +/* 47 */ p_refresh, /* ^OG */ +/* 48 */ ned_set_lookup_tag, /* ^OH: set tag after name lookup */ +/* 49 */ p_aitoggle, /* ^OI */ +/* 4A */ xx, /* ^OJ */ +/* 4B */ xx, /* ^OK */ +/* 4C */ p_clone_window, /* ^OL */ +/* 4D */ ned_set_mark, /* ^OM: set mark tag */ +/* 4E */ ned_pr_jump_to_line, /* ^ON */ +/* 4F */ p_wdwopen, /* ^OO */ + +/* 50 */ xx, /* ^OP */ +/* 51 */ p_wdwqfile, /* ^OQ */ +/* 52 */ p_ofile1, /* ^OR */ +/* 53 */ p_rdsetup, /* ^OS */ +/* 54 */ p_refresh_all, /* ^OT */ +/* 55 */ p_format_SGML, /* ^OU: File Format SGML */ +/* 56 */ p_format_ASCII, /* ^OV: File Format ASCII */ +/* 57 */ p_wdwsize, /* ^OW */ +/* 58 */ xx, /* ^OX */ +/* 59 */ ned_close_window, /* ^OY */ +/* 5A */ p_clone_window, /* ^OZ Open Window and Link */ +/* 5B */ xx, /* ^O[ */ +/* 5C */ xx, /* ^O\ */ +/* 5D */ xx, /* ^O] */ +/* 5E */ pico_mode, /* ^O^ */ +/* 5F */ xx, /* ^O_ */ + +/* 60 */ vi_mode, /* ^O` */ +/* 61 */ p_ww, /* ^Oa: Word Wrap togglen */ +/* 62 */ p_backcolnxt, /* ^Ob */ +/* 63 */ p_colornxt, /* ^Oc */ +/* 64 */ xx, /* ^Od */ +/* 65 */ xx, /* ^Oe */ +/* 66 */ p_link_feature, /* ^Of: Open Feature Window */ +/* 67 */ p_refresh, /* ^Og */ +/* 68 */ ned_set_lookup_tag, /* ^Oh: set tag after name lookup */ +/* 69 */ p_aitoggle, /* ^Oi */ +/* 6A */ xx, /* ^Oj */ +/* 6B */ xx, /* ^Ok */ +/* 6C */ p_clone_window, /* ^Ol */ +/* 6D */ ned_set_mark, /* ^Om: set mark tag */ +/* 6E */ ned_pr_jump_to_line, /* ^On */ +/* 6F */ p_wdwopen, /* ^Oo */ + +/* 70 */ xx, /* ^Op */ +/* 71 */ p_wdwqfile, /* ^Oq */ +/* 72 */ p_ofile1, /* ^Or */ +/* 73 */ p_rdsetup, /* ^Os */ +/* 74 */ p_refresh_all, /* ^Ot */ +/* 75 */ p_format_SGML, /* ^Ou: File Format SGML */ +/* 76 */ p_format_ASCII, /* ^Ov: File Format ASCII */ +/* 77 */ p_wdwsize, /* ^Ow */ +/* 78 */ xx, /* ^Ox */ +/* 79 */ ned_close_window, /* ^Oy */ +/* 7A */ p_clone_window, /* ^Oz: Open Window and Link */ +/* 7B */ xx, /* ^O{ */ +/* 7C */ xx, /* ^O| */ +/* 7D */ xx, /* ^O} */ +/* 7E */ wordstar_mode, /* ^O~ */ +/* 7F */ xx /* ^O */ diff --git a/app/ned/00/ned0001q.c b/app/ned/00/ned0001q.c new file mode 100644 index 0000000000000000000000000000000000000000..499f9f241d40472d7f0c5758de8f41aac2b71aef --- /dev/null +++ b/app/ned/00/ned0001q.c @@ -0,0 +1,155 @@ +/* + * FILE %ned/00/ned0001q.c + * + * Sprungtabelle fuer Editor ned.c + * Praefix-Gruppe q: ^Q + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * 1991 02 07: Revision + * 1991 06 01: Revision; Aenderung des Table Layouts + * 1992 01 16: Aufteilung in include Files fuer + * jede Praefix-Gruppe + * 1992 01 19: alternative Hypertext Navigation + * latest update: 1998-07-19 21:08:26 + * $Id: ned0001q.c,v 1.2 2005/04/01 16:46:20 gonter Exp $ + * + */ + +/* 1. Praefix Ctrl Q: Quick Menue - - - - - - - - - - - - - - - - - - - - - */ +/* 00 */ xx, /* */ +/* 01 */ p_replace, /* ^Q^A: Replace */ +/* 02 */ p_jmp_blkbeg, /* ^Q^B: Block Beginn anspringen */ +/* 03 */ pq_dn, /* ^Q^C: An das Ende des Files */ +/* 04 */ ned_jmp_eoln, /* ^Q^D: An das Ende der Zeile */ +/* 05 */ ned_vi_cursor_top, /* ^Q^E: */ +/* 06 */ p_find, /* ^Q^F: Find String */ +/* 07 */ ned_ws_aw_find_str, /* ^Q^G */ +/* 08 */ ned_ws_aw_find_str, /* ^Q^H */ +/* 09 */ p_activate_cl3, /* ^Q^I: special cluster 3 */ +/* 0A */ ned_lookup_thesaurus, /* ^Q^J: */ +/* 0B */ p_jmp_blkend, /* ^Q^K: Block Ende anspringen */ +/* 0C */ ned_lookup_lexicon, /* ^Q^L: */ +/* 0D */ p_dump_macro, /* ^Q^M: Makros ausdumpen */ +/* 0E */ p_activate_cl2, /* ^Q^N: special cluster 2 (notes) */ +/* 0F */ ned_p_activate_cl_fr, /* ^Q^O: prompt for cluster and frame */ + +/* 10 */ p_pfile, /* ^Q^P: print file */ +/* 11 */ xx, /* ^Q^Q */ +/* 12 */ pq_up, /* ^Q^R: An den Anfang des Files */ +/* 13 */ ned_jmp_boln, /* ^Q^S: An den Anfang der Zeile (S!) */ +/* 14 */ xx, /* ^Q^T */ +/* 15 */ p_activate_fr_root, /* ^Q^U: root frame in local cluster */ +/* 16 */ ned_jmp_marker_find, /* ^Q^V: follow logic link 'menu' */ +/* 17 */ ned_jmp_aktline_top, /* ^Q^W */ +/* 18 */ ned_vi_cursor_bot, /* ^Q^X: */ +/* 19 */ ned_del2eoln, /* ^Q^Y: Zeilenrest loeschen */ +/* 1A */ ned_jmp_aktline_bot, /* ^Q^Z */ +/* 1B */ xx, /* ^Q^ */ +/* 1C */ xx, /* ^Q^ */ +/* 1D */ xx, /* ^Q^ */ +/* 1E */ xx, /* ^Q^ */ +/* 1F */ xx, /* ^Q^ */ + +/* 20 */ xx, /* ^Q-Blank */ +/* 21 */ p_shell, /* ^Q! */ +/* 22 */ xx, /* ^Q" */ +/* 23 */ xx, /* ^Q# */ +/* 24 */ xx, /* ^Q$ */ +/* 25 */ xx, /* ^Q% */ +/* 26 */ xx, /* ^Q& */ +/* 27 */ p_logic_link_lang, /* ^Q': follow logic link 'lang' */ +/* 28 */ xx, /* ^Q( */ +/* 29 */ xx, /* ^Q) */ +/* 2A */ p_logic_link_more, /* ^Q*: select from all logic links */ +/* 2B */ xx, /* ^Q+ */ +/* 2C */ xx, /* ^Q, */ +/* 2D */ xx, /* ^Q- */ +/* 2E */ xx, /* ^Q. */ +/* 2F */ p_activate_fr_notes, /* ^Q/: notes frame in local cluster */ + +/* 30 */ ned_jmp_marker_key, /* ^Q0: Marker 0 anpringen */ +/* 31 */ ned_jmp_marker_key, /* ^Q */ +/* 32 */ ned_jmp_marker_key, /* ^Q */ +/* 33 */ ned_jmp_marker_key, /* ^Q */ +/* 34 */ ned_jmp_marker_key, /* ^Q */ +/* 35 */ ned_jmp_marker_key, /* ^Q */ +/* 36 */ ned_jmp_marker_key, /* ^Q */ +/* 37 */ ned_jmp_marker_key, /* ^Q */ +/* 38 */ ned_jmp_marker_key, /* ^Q */ +/* 39 */ ned_jmp_marker_key, /* ^Q9 */ +/* 3A */ xx, /* ^Q: */ +/* 3B */ xx, /* ^Q; */ +/* 3C */ p_logic_link_prev, /* ^Q<: follow logic link 'prev' */ +/* 3D */ xx, /* ^Q= */ +/* 3E */ p_logic_link_next, /* ^Q>: follow logic link 'next' */ +/* 3F */ p_activate_fr_help, /* ^Q?: help frame in local cluster */ + +/* 40 */ xx, /* ^Q@ */ +/* 41 */ p_replace, /* ^QA */ +/* 42 */ p_jmp_blkbeg, /* ^QB: Block Beginn anspringen */ +/* 43 */ pq_dn, /* ^QC */ +/* 44 */ ned_jmp_eoln, /* ^QD */ +/* 45 */ ned_vi_cursor_top, /* ^QE: */ +/* 46 */ p_find, /* ^QF */ +/* 47 */ ned_ws_aw_find_str, /* ^QG */ +/* 48 */ ned_ws_aw_find_str, /* ^QH */ +/* 49 */ p_activate_cl3, /* ^QI: special cluster 3 */ +/* 4A */ ned_lookup_thesaurus, /* ^QJ */ +/* 4B */ p_jmp_blkend, /* ^QK: Block Ende anspringen */ +/* 4C */ ned_lookup_lexicon, /* ^QL: */ +/* 4D */ xx, /* ^QM */ +/* 4E */ p_activate_cl2, /* ^QN: special cluster 2 (notes) */ +/* 4F */ ned_p_activate_cl_fr, /* ^QO: prompt for cluster and frame */ + +/* 50 */ p_pfile, /* ^QP: print file */ +/* 51 */ xx, /* ^QQ */ +/* 52 */ pq_up, /* ^QR */ +/* 53 */ ned_jmp_boln, /* ^QS */ +/* 54 */ xx, /* ^QT */ +/* 55 */ p_activate_fr_root, /* ^QU: root frame in local cluster */ +/* 56 */ ned_jmp_marker_find, /* ^QV: follow logic link 'menu' */ +/* 57 */ ned_jmp_aktline_top, /* ^QW */ +/* 58 */ ned_vi_cursor_bot, /* ^QX */ +/* 59 */ ned_del2eoln, /* ^QY */ +/* 5A */ ned_jmp_aktline_bot, /* ^QZ */ +/* 5B */ ned_jmp_marker_key, /* ^Q[ */ +/* 5C */ xx, /* ^Q\ */ +/* 5D */ ned_jmp_marker_key, /* ^Q] */ +/* 5E */ p_logic_link_up, /* ^Q^: follow logic link 'up' */ +/* 5F */ xx, /* ^Q_ */ + +/* 60 */ p_close_jou, /* ^Q`: Jour File schliessen */ +/* 61 */ p_replace, /* ^Qa */ +/* 62 */ p_jmp_blkbeg, /* ^Qb: Block Beginn anspringen */ +/* 63 */ pq_dn, /* ^Qc */ +/* 64 */ ned_jmp_eoln, /* ^Qd */ +/* 65 */ ned_vi_cursor_top, /* ^Qe: */ +/* 66 */ p_find, /* ^Qf */ +/* 67 */ ned_ws_aw_find_str, /* ^Qg */ +/* 68 */ ned_ws_aw_find_str, /* ^Qh */ +/* 69 */ p_activate_cl3, /* ^Qi: special cluster 3 */ +/* 6A */ ned_lookup_thesaurus, /* ^Qj */ +/* 6B */ p_jmp_blkend, /* ^Qk: Block Ende anspringen */ +/* 6C */ ned_lookup_lexicon, /* ^Ql: */ +/* 6D */ xx, /* ^Qm */ +/* 6E */ p_activate_cl2, /* ^Qn: special cluster 2 (notes) */ +/* 6F */ ned_p_activate_cl_fr, /* ^Qo: prompt for cluster and frame */ + +/* 70 */ p_pfile, /* ^Qp: print file */ +/* 71 */ xx, /* ^Qq */ +/* 72 */ pq_up, /* ^Qr */ +/* 73 */ ned_jmp_boln, /* ^Qs */ +/* 74 */ xx, /* ^Qt */ +/* 75 */ p_activate_fr_root, /* ^Qu: root frame in local cluster */ +/* 76 */ ned_jmp_marker_find, /* ^Qv: follow logic link 'menu' */ +/* 77 */ ned_jmp_aktline_top, /* ^Qw */ +/* 78 */ ned_vi_cursor_bot, /* ^Qx */ +/* 79 */ ned_del2eoln, /* ^Qy */ +/* 7A */ ned_jmp_aktline_bot, /* ^Qz */ +/* 7B */ xx, /* ^Q{ */ +/* 7C */ xx, /* ^Q| */ +/* 7D */ xx, /* ^Q} */ +/* 7E */ xx, /* ^Q~ */ +/* 7F */ xx /* ^Q */ diff --git a/app/ned/00/ned0001t.c b/app/ned/00/ned0001t.c new file mode 100644 index 0000000000000000000000000000000000000000..3b134369ce255b2e0e419fd3c7e563ede426c43f --- /dev/null +++ b/app/ned/00/ned0001t.c @@ -0,0 +1,275 @@ +/* + * FILE %ned/00/ned0001t.c + * + * jump table for editor NED: + * group t: X-Windows (Tk) model + * + * written: 1995-10-06 + * latest update: 2001-02-11 12:41:24 + * $Id: ned0001t.c,v 1.5 2001/04/01 22:45:01 gonter Exp $ + * + */ + +/* 0x00 */ xx, /* dummy key code */ +/* 0x01 */ ned_set_mark, /* SHIFT-TAB */ +/* 0x02 */ ned_set_lookup_tag_fr, /* CTRL-TAB */ +/* 0x03 */ ned_set_lookup_tag, /* ALT-TAB */ +/* 0x04 */ xx, +/* 0x05 */ xx, +/* 0x06 */ xx, +/* 0x07 */ xx, +/* 0x08 */ ned_del_char_left, /* XK_BackSpace back space */ +/* 0x09 */ tabulate, /* XK_Tab */ +/* 0x0A */ p_nl, /* XK_Linefeed Linefeed, LF */ +/* 0x0B */ xx, /* XK_Clear */ +/* 0x0C */ xx, +/* 0x0D */ p_nl, /* XK_Return Return, enter */ +/* 0x0E */ xx, +/* 0x0F */ xx, +/* 0x10 */ xx, +/* 0x11 */ xx, +/* 0x12 */ ned_read_entity, /* ALT-` */ +/* 0x13 */ xx, /* XK_Pause Pause, hold */ +/* 0x14 */ xx, /* XK_Scroll_Lock */ +/* 0x15 */ xx, /* ALT-{ */ +/* 0x16 */ xx, /* ALT-| */ +/* 0x17 */ xx, /* ALT-} */ +/* 0x18 */ xx, /* ALT-~ */ +/* 0x19 */ xx, +/* 0x1A */ xx, +/* 0x1B */ vi_on, /* XK_Escape */ +/* 0x1C */ xx, +/* 0x1D */ xx, +/* 0x1E */ xx, +/* 0x1F */ xx, + +/* 0x20 .. 0x4F: ALT-0 .. ALT-_ shifted down */ +/* 0x20 */ p_macro40, /* ALT-0 */ +/* 0x21 */ p_macro41, /* ALT-1 */ +/* 0x22 */ p_macro42, +/* 0x23 */ p_macro43, +/* 0x24 */ p_macro44, +/* 0x25 */ p_macro45, +/* 0x26 */ p_macro46, +/* 0x27 */ p_macro47, +/* 0x28 */ p_macro48, +/* 0x29 */ p_macro49, /* ALT-9 */ +/* 0x2A */ xx, /* XK_Zenkaku_Hankaku Zenkaku/Hankaku toggle */ +/* 0x2B */ xx, /* XK_Touroku Add to Dictionary */ +/* 0x2C */ xx, /* XK_Massyo Delete from Dictionary */ +/* 0x2D */ xx, /* XK_Kana_Lock Kana Lock */ +/* 0x2E */ xx, /* XK_Kana_Shift Kana Shift */ +/* 0x2F */ xx, /* XK_Eisu_Shift Alphanumeric Shift */ +/* 0x30 */ xx, /* XK_Eisu_toggle Alphanumeric toggle */ +/* 0x31 */ ned_show_author, /* ALT-A */ +/* 0x32 */ xx, /* ALT-B */ +/* 0x33 */ p_cross_ref, /* ALT-C */ +/* 0x34 */ p_mac_define, /* ALT-D */ +/* 0x35 */ p_edsetup, /* ALT-E */ +/* 0x36 */ p_feature_set, /* ALT-F */ +/* 0x37 */ p_feature_reset, /* ALT-G */ +/* 0x38 */ ned_set_hyx_l, /* ALT-H */ +/* 0x39 */ ned_line_end_MSDOS, /* ALT-I */ +/* 0x3A */ ned_set_SGML_tag, /* ALT-J */ +/* 0x3B */ ned_set_SGML_entity, /* ALT-K */ +/* 0x3C */ xx, /* ALT-L: DOS(Lines) */ +/* 0x3D */ xx, /* ALT-M: DOS(Menu) */ +/* 0x3E */ p_feature_next, /* ALT-N */ +/* 0x3F */ ned_memorize_location, /* ALT-O */ +/* 0x40 */ p_feature_prev, /* ALT-P */ +/* 0x41 */ ned_jmp_marker_1, /* ALT-Q */ +/* 0x42 */ p_rdsetup, /* ALT-R */ +/* 0x43 */ xx, /* ALT-S */ +/* 0x44 */ p_window_menu, /* ALT-T */ +/* 0x45 */ ned_line_end_UNIX, /* ALT-U */ +/* 0x46 */ ned_eval_block, /* ALT-V */ +/* 0x47 */ p_link_feature, /* ALT-W */ +/* 0x48 */ ned_eval_feature, /* ALT-X */ +/* 0x49 */ ned_delete_word, /* ALT-Y */ +/* 0x4A */ xx, /* ALT-Z */ +/* 0x4B */ p_find_higher_bracket, /* ALT-[ */ +/* 0x4C */ p_find_matching_bracket, /* ALT-\ */ +/* 0x4D */ p_find_lower_bracket, /* ALT-] */ +/* 0x4E */ xx, /* ALT-^ */ +/* 0x4F */ xx, /* ALT-_ */ +/* 0x50 */ ned_jmp_boln, /* XK_Home */ +/* 0x51 */ ned_cursor_left, /* XK_Left Move left, left arrow */ +/* 0x52 */ ned_cursor_up, /* XK_Up Move up, up arrow */ +/* 0x53 */ ned_cursor_right, /* XK_Right Move right, right arrow */ +/* 0x54 */ ned_cursor_down, /* XK_Down Move down, down arrow */ +/* 0x55 */ ned_page_up, /* XK_Prior Prior, previous */ +/* 0x56 */ ned_page_down, /* XK_Next Next */ +/* 0x57 */ ned_jmp_eoln, /* XK_End EOL */ +/* 0x58 */ ned_jmp_boln, /* XK_Begin BOL */ +/* 0x59 */ xx, /* ALT-: */ +/* 0x5A */ xx, /* ALT-; */ +/* 0x5B */ xx, /* ALT-< */ +/* 0x5C */ xx, /* ALT-= */ +/* 0x5D */ xx, /* ALT-> */ +/* 0x5E */ xx, /* ALT-? */ +/* 0x5F */ xx, /* ALT-@ */ +/* 0x60 */ xx, /* XK_Select Select, mark */ +/* 0x61 */ xx, /* XK_Print */ +/* 0x62 */ ned_eval_feature, /* XK_Execute Execute, run, do */ +/* 0x63 */ p_ovins, /* XK_Insert Insert, insert here */ +/* 0x64 */ xx, +/* 0x65 */ xx, /* XK_Undo Undo, oops */ +/* 0x66 */ xx, /* XK_Redo redo, again */ +/* 0x67 */ xx, /* XK_Menu */ +/* 0x68 */ p_find, /* XK_Find Find, search */ +/* 0x69 */ xx, /* XK_Cancel Cancel, stop, abort, exit */ +/* 0x6A */ p_activate_cl1, /* XK_Help Help, ? */ +/* 0x6B */ xx, /* XK_Break */ +/* 0x6C */ xx, +/* 0x6D */ xx, +/* 0x6E */ xx, /* ALT-Blank */ +/* 0x6F */ xx, /* ALT-! */ +/* 0x70 */ xx, /* ALT-" */ +/* 0x71 */ xx, /* ALT-# */ +/* 0x72 */ xx, /* ALT-$ */ +/* 0x73 */ xx, /* ALT-% */ +/* 0x74 */ xx, /* ALT-& */ +/* 0x75 */ xx, /* ALT-' */ +/* 0x76 */ xx, /* ALT-( */ +/* 0x77 */ xx, /* ALT-) */ +/* 0x78 */ xx, /* ALT-* */ +/* 0x79 */ xx, /* ALT-+ */ +/* 0x7A */ xx, /* ALT-, */ +/* 0x7B */ xx, /* ALT-- */ +/* 0x7C */ xx, /* ALT-. */ +/* 0x7D */ xx, /* ALT-/ */ +/* 0x7E */ xx, /* XK_script_switch Alias for mode_switch */ +/* 0x7F */ xx, /* XK_Num_Lock */ +/* 0x80 */ xx, /* XK_KP_Space space */ +/* 0x81 */ xx, +/* 0x82 */ xx, +/* 0x83 */ xx, +/* 0x84 */ xx, +/* 0x85 */ xx, +/* 0x86 */ xx, +/* 0x87 */ xx, +/* 0x88 */ xx, +/* 0x89 */ tabulate, /* XK_KP_Tab */ +/* 0x8A */ xx, +/* 0x8B */ xx, +/* 0x8C */ xx, +/* 0x8D */ p_nl, /* XK_KP_Enter enter */ +/* 0x8E */ xx, +/* 0x8F */ xx, +/* 0x90 */ xx, +/* 0x91 */ xx, /* XK_KP_F1 PF1, KP_A, ... */ +/* 0x92 */ xx, /* XK_KP_F2 */ +/* 0x93 */ xx, /* XK_KP_F3 */ +/* 0x94 */ xx, /* XK_KP_F4 */ +/* 0x95 */ xx, +/* 0x96 */ xx, +/* 0x97 */ xx, + +/* 0x98 - 0xA9: cursor pad with CTRL and ALT, shifted up */ +/* 0x98 */ xx, /* CTRL-Home */ +/* 0x99 */ p_word_left, /* CTRL-Left */ +/* 0x9A */ ned_ftr_shift_up, /* CTRL-Up */ +/* 0x9B */ p_word_right_beg, /* CTRL-Right */ +/* 0x9C */ ned_ftr_shift_down, /* CTRL-Down */ +/* 0x9D */ pq_up, /* CTRL-PGUP */ +/* 0x9E */ pq_dn, /* CTRL-PGDN */ +/* 0x9F */ xx, /* CTRL-End */ +/* 0xA0 */ xx, /* CTRL-Home (Begin) */ + +/* 0xA1 */ p_logic_link_up, /* ALT-Home */ +/* 0xA2 */ ned_jmp_boln, /* ALT-Left */ +/* 0xA3 */ ned_page_up, /* ALT-Up */ +/* 0xA4 */ ned_jmp_eoln, /* ALT-Right */ +/* 0xA5 */ ned_page_down, /* ALT-Down */ +/* 0xA6 */ p_logic_link_prev, /* ALT-PGUP */ +/* 0xA7 */ p_logic_link_next, /* ALT-PGDN */ +/* 0xA8 */ p_logic_link_menu, /* ALT-End */ +/* 0xA9 */ p_logic_link_up, /* ALT-Home (Begin) */ + +/* 0xAA..0xB9: numeric keypad symbols together with ALT */ +/* 0xAA */ xx, /* XK_KP_Multiply */ +/* 0xAB */ xx, /* XK_KP_Add */ +/* 0xAC */ xx, /* XK_KP_Separator separator, often comma */ +/* 0xAD */ xx, /* XK_KP_Subtract */ +/* 0xAE */ xx, /* XK_KP_Decimal */ +/* 0xAF */ xx, /* XK_KP_Divide */ +/* 0xB0 */ xx, /* XK_KP_0 */ +/* 0xB1 */ xx, /* XK_KP_1 */ +/* 0xB2 */ xx, /* XK_KP_2 */ +/* 0xB3 */ xx, /* XK_KP_3 */ +/* 0xB4 */ xx, /* XK_KP_4 */ +/* 0xB5 */ xx, /* XK_KP_5 */ +/* 0xB6 */ xx, /* XK_KP_6 */ +/* 0xB7 */ xx, /* XK_KP_7 */ +/* 0xB8 */ xx, /* XK_KP_8 */ +/* 0xB9 */ xx, /* XK_KP_9 */ +/* 0xBA */ xx, +/* 0xBB */ xx, +/* 0xBC */ xx, +/* 0xBD */ xx, /* XK_KP_Equal equals */ +/* 0xBE */ p_macro01, /* XK_F1 */ +/* 0xBF */ p_macro02, /* XK_F2 */ +/* 0xC0 */ p_macro03, /* XK_F3 */ +/* 0xC1 */ p_macro04, /* XK_F4 */ +/* 0xC2 */ p_refresh, /* XK_F5 */ +/* 0xC3 */ p_macro06, /* XK_F6 */ +/* 0xC4 */ p_sx, /* XK_F7 */ +/* 0xC5 */ p_ssave, /* XK_F8 */ +/* 0xC6 */ p_activate_fr_root, /* XK_F9 */ +/* 0xC7 */ p_activate_cl1, /* XK_F10 */ +/* 0xC8 */ p_split_join, /* F11 */ +/* 0xC9 */ xx, /* F12 */ +/* 0xCA */ p_macro11, /* SF1 */ +/* 0xCB */ p_macro12, /* SF2 */ +/* 0xCC */ p_macro13, /* SF3 */ +/* 0xCD */ p_macro14, /* SF4 */ +/* 0xCE */ p_refresh_all, /* SF5 */ +/* 0xCF */ p_macro16, /* SF6 */ +/* 0xD0 */ p_macro17, /* SF7 */ +/* 0xD1 */ ned_ssave_all, /* SF8 */ +/* 0xD2 */ p_activate_fr_notes, /* SF9 */ +/* 0xD3 */ p_activate_cl2, /* SF10 */ +/* 0xD4 */ xx, /* SF11 */ +/* 0xD5 */ xx, /* SF12 */ +/* 0xD6 */ p_macro21, /* CF1 */ +/* 0xD7 */ p_macro22, /* CF2 */ +/* 0xD8 */ p_macro23, /* CF3 */ +/* 0xD9 */ p_macro24, /* CF4 */ +/* 0xDA */ p_colornxt, /* CF5 */ +/* 0xDB */ p_macro26, /* CF6 */ +/* 0xDC */ p_macro27, /* CF7 */ +/* 0xDD */ p_macro28, /* CF8 */ +/* 0xDE */ p_activate_fr_help, /* CF9 */ +/* 0xDF */ p_activate_cl3, /* CF10 */ +/* 0xE0 */ xx, /* CF11 */ +/* 0xE1 */ xx, /* XK_Shift_L Left shift */ +/* 0xE2 */ xx, /* XK_Shift_R Right shift */ +/* 0xE3 */ xx, /* XK_Control_L Left control */ +/* 0xE4 */ xx, /* XK_Control_R Right control */ +/* 0xE5 */ xx, /* XK_Caps_Lock Caps lock */ +/* 0xE6 */ xx, /* XK_Shift_Lock Shift lock */ +/* 0xE7 */ xx, /* XK_Meta_L Left meta */ +/* 0xE8 */ xx, /* XK_Meta_R Right meta */ +/* 0xE9 */ xx, /* XK_Alt_L Left alt */ +/* 0xEA */ xx, /* XK_Alt_R Right alt */ +/* 0xEB */ xx, /* XK_Super_L Left super */ +/* 0xEC */ xx, /* XK_Super_R Right super */ +/* 0xED */ xx, /* XK_Hyper_L Left hyper */ +/* 0xEE */ xx, /* XK_Hyper_R Right hyper */ +/* 0xEF */ xx, /* CF12 */ +/* 0xF0 */ p_macro31, /* AF1 */ +/* 0xF1 */ p_macro32, /* AF2 */ +/* 0xF2 */ p_macro33, /* AF3 */ +/* 0xF3 */ p_macro34, /* AF4 */ +/* 0xF4 */ p_backcolnxt, /* AF5 */ +/* 0xF5 */ p_macro36, /* AF6 */ +/* 0xF6 */ p_macro37, /* AF7 */ +/* 0xF7 */ p_macro38, /* AF8 */ +/* 0xF8 */ ned_p_activate_cl_fr, /* AF9 */ +/* 0xF9 */ p_activate_cl4, /* AF10 */ +/* 0xFA */ xx, /* AF11 */ +/* 0xFB */ xx, /* AF12 */ +/* 0xFC */ xx, +/* 0xFD */ xx, +/* 0xFE */ xx, +/* 0xFF */ ned_del_char_right /* XK_Delete Delete, rubout */ diff --git a/app/ned/00/ned0001u.c b/app/ned/00/ned0001u.c new file mode 100644 index 0000000000000000000000000000000000000000..7bea94338721e60b5fac9396934d50f67ed12b4f --- /dev/null +++ b/app/ned/00/ned0001u.c @@ -0,0 +1,148 @@ +/* + * FILE %ned/00/ned0001u.c + * + * Sprungtabelle fuer Editor ned.c + * prefix-group u: special functions + * + * written: 1992 01 19 + * latest update: 2001-02-11 12:39:50 + * $Id: ned0001u.c,v 1.6 2005/04/01 16:46:20 gonter Exp $ + * + */ + +/* x. Praefix Ctrl U: special functions - - - - - - - - - - - - - - - - - - */ +/* 00 */ xx, /* ^U NULL */ +/* 01 */ ned_show_author, /* ^U^A: Author ausgeben */ +/* 02 */ xx, /* ^U^B */ +/* 03 */ p_cross_ref, /* ^U^C: Cross Referencing */ +/* 04 */ p_mac_define, /* ^U^D: Define Macro */ +/* 05 */ p_edsetup, /* ^U^E: Edit Setup file */ +/* 06 */ p_feature_set, /* ^U^F: Feature setzen */ +/* 07 */ p_feature_reset, /* ^U^G: Feature loeschen */ +/* 08 */ ned_set_hyx_l, /* ^U^H: hyx_l setzen */ +/* 09 */ ned_line_end_MSDOS, /* ^U^I: -> MSDOS Line End */ +/* 0A */ ned_set_SGML_tag, /* ^U^J: SGML Tag setzen */ +/* 0B */ ned_set_SGML_entity, /* ^U^K: SGML Entity setzen */ +/* 0C */ DOSPRIM(p_switch_line_mode), /* ^U^L: lines ... */ +/* 0D */ p_menue, /* ^U^M: Menue aktivieren */ +/* 0E */ p_feature_next, /* ^U^N: Jump 2 Next Feature */ +/* 0F */ ned_memorize_location, /* ^U^O: store frame or file */ + +/* 10 */ p_feature_prev, /* ^U^P: Jump 2 Prev Feature */ +/* 11 */ ned_jmp_marker_1, /* ^U^Q: jump to marker 1 */ +/* 12 */ p_rdsetup, /* ^U^R: Setup File einlesen */ +/* 13 */ xx, /* ^U^S */ +/* 14 */ p_window_menu, /* ^U^T: Window Menu */ +/* 15 */ ned_line_end_UNIX, /* ^U^U: -> UNIX Line End */ +/* 16 */ ned_eval_block, /* ^U^V: Ausfuehrung eines Blocks */ +/* 17 */ p_link_feature, /* ^U^W: Feature Window oeffnen */ +/* 18 */ ned_eval_feature, /* ^U^X: Ausfuehrung eines Features */ +/* 19 */ ned_delete_word, /* ^U^Y: Delete Word Right */ +/* 1A */ xx, /* ^U^Z: */ +/* 1B */ xx, /* ^U^[ (ESC) */ +/* 1C */ xx, /* ^U^\ */ +/* 1D */ xx, /* ^U^] */ +/* 1E */ xx, /* ^U^^ */ +/* 1F */ xx, /* ^U^_ */ + +/* 20 */ xx, /* ^U (BLANK): NO-OP */ +/* 21 */ xx, /* ^U! */ +/* 22 */ xx, /* ^U" */ +/* 23 */ p_find_matching_bracket,/*^U# */ +/* 24 */ xx, /* ^U$ */ +/* 25 */ ned_set_mark, /* ^U% */ +/* 26 */ ned_set_lookup_tag, /* ^U& */ +/* 27 */ xx, /* ^U' */ +/* 28 */ p_activate_fr_help, /* ^U( */ +/* 29 */ p_activate_fr_notes, /* ^U) */ +/* 2A */ ned_set_lookup_tag_fr, /* ^U* */ +/* 2B */ p_find_lower_bracket, /* ^U+ */ +/* 2C */ ned_set_lookup_tag_fr2,/* ^U, */ +/* 2D */ p_alt_minus, /* ^U- */ +/* 2E */ xx, /* ^U. */ +/* 2F */ xx, /* ^U/ */ + +/* 30 */ p_macro40, /* ^U0: Macro 40 ausfuehren */ +/* 31 */ p_macro41, /* ^U1 */ +/* 32 */ p_macro42, /* ^U2 */ +/* 33 */ p_macro43, /* ^U3 */ +/* 34 */ p_macro44, /* ^U4 */ +/* 35 */ p_macro45, /* ^U5 */ +/* 36 */ p_macro46, /* ^U6 */ +/* 37 */ p_macro47, /* ^U7 */ +/* 38 */ p_macro48, /* ^U8 */ +/* 39 */ p_macro49, /* ^U9 */ +/* 3A */ xx, /* ^U: */ +/* 3B */ xx, /* ^U; */ +/* 3C */ p_logic_link_prev, /* ^U< */ +/* 3D */ p_activate_fr_root, /* ^U= */ +/* 3E */ p_logic_link_next, /* ^U> */ +/* 3F */ xx, /* ^U? */ + +/* 40 */ xx, /* ^U@ */ +/* 41 */ ned_show_author, /* ^UA: Author ausgeben */ +/* 42 */ xx, /* ^UB */ +/* 43 */ p_cross_ref, /* ^UC: Cross Referencing */ +/* 44 */ p_mac_define, /* ^UD: Define Macro */ +/* 45 */ p_edsetup, /* ^UE: Edit Setup file */ +/* 46 */ p_feature_set, /* ^UF: Feature setzen */ +/* 47 */ p_feature_reset, /* ^UG: Feature loeschen */ +/* 48 */ ned_set_hyx_l, /* ^UH: hyx_l setzen */ +/* 49 */ ned_line_end_MSDOS, /* ^UI: -> MSDOS Line End */ +/* 4A */ ned_set_SGML_tag, /* ^UJ: SGML Tag setzen */ +/* 4B */ ned_set_SGML_entity, /* ^UK: SGML Entity setzen */ +/* 4C */ DOSPRIM(p_switch_line_mode), /* ^UL: lines ... */ +/* 4D */ p_menue, /* ^UM: Menue aktivieren */ +/* 4E */ p_feature_next, /* ^UN: Jump to Next Feature */ +/* 4F */ ned_memorize_location, /* ^UO: store frame or file */ + +/* 50 */ p_feature_prev, /* ^UP: Jump to Prev Feature */ +/* 51 */ ned_jmp_marker_1, /* ^UQ: jump to marker 1 */ +/* 52 */ p_rdsetup, /* ^UR: Setup File einlesen */ +/* 53 */ xx, /* ^US */ +/* 54 */ p_window_menu, /* ^UT: Window Menu */ +/* 55 */ ned_line_end_UNIX, /* ^UU: -> UNIX Line End */ +/* 56 */ ned_eval_block, /* ^UV: Ausfuehrung eines Blocks */ +/* 57 */ p_link_feature, /* ^UW: Feature Window oeffnen */ +/* 58 */ ned_eval_feature, /* ^UX: Ausfuehrung eines Features */ +/* 59 */ ned_delete_word, /* ^UY: Delete Word Right */ +/* 5A */ xx, /* ^UZ: */ +/* 5B */ p_activate_cl1, /* ^U[: */ +/* 5C */ p_find_matching_bracket,/*^U\: */ +/* 5D */ p_activate_cl2, /* ^U]: */ +/* 5E */ p_activate_cl0, /* ^U^ */ +/* 5F */ ned_p_activate_cl_fr, /* ^U_ */ + +/* 60 */ xx, /* ^U` */ +/* 61 */ ned_show_author, /* ^Ua: Author ausgeben */ +/* 62 */ xx, /* ^Ub */ +/* 63 */ p_cross_ref, /* ^Uc: Cross Referencing */ +/* 64 */ p_mac_define, /* ^Ud: Define Macro */ +/* 65 */ p_edsetup, /* ^Ue: Edit Setup file */ +/* 66 */ p_feature_set, /* ^Uf: Feature setzen */ +/* 67 */ p_feature_reset, /* ^Ug: Feature loeschen */ +/* 68 */ ned_set_hyx_l, /* ^Uh: hyx_l setzen */ +/* 69 */ ned_line_end_MSDOS, /* ^Ui: -> MSDOS Line End */ +/* 6A */ ned_set_SGML_tag, /* ^Uj: SGML Tag setzen */ +/* 6B */ ned_set_SGML_entity, /* ^Uk: SGML Entity setzen */ +/* 6C */ DOSPRIM(p_switch_line_mode), /* ^Ul: lines ... */ +/* 6D */ p_menue, /* ^Um: Menue aktivieren */ +/* 6E */ p_feature_next, /* ^Un: Jump 2 Next Feature */ +/* 6F */ ned_memorize_location, /* ^Uo: store frame or file */ + +/* 70 */ p_feature_prev, /* ^Up: Jump 2 Prev Feature */ +/* 71 */ ned_jmp_marker_1, /* ^U^Q: jump to marker 1 */ +/* 72 */ p_rdsetup, /* ^Ur: Setup File einlesen */ +/* 73 */ xx, /* ^Us */ +/* 74 */ p_window_menu, /* ^Ut: Window Menu */ +/* 75 */ ned_line_end_UNIX, /* ^Uu: -> UNIX Line End */ +/* 76 */ ned_eval_block, /* ^Uv: Ausfuehrung eines Blocks */ +/* 77 */ p_link_feature, /* ^Uw: Feature Window oeffnen */ +/* 78 */ ned_eval_feature, /* ^Ux: Ausfuehrung eines Features */ +/* 79 */ ned_delete_word, /* ^Uy: Delete Word Right */ +/* 7A */ xx, /* ^Uz: */ +/* 7B */ p_activate_cl3, /* ^U{ */ +/* 7C */ xx, /* ^U| */ +/* 7D */ p_activate_cl4, /* ^U} */ +/* 7E */ xx, /* ^U~ */ +/* 7F */ xx /* ^U */ diff --git a/app/ned/00/ned0001v.c b/app/ned/00/ned0001v.c new file mode 100644 index 0000000000000000000000000000000000000000..2b75f28a3da6580b0f371521b0eacdfad00a4a64 --- /dev/null +++ b/app/ned/00/ned0001v.c @@ -0,0 +1,149 @@ +/* + * FILE %ned/00/ned0001v.c + * + * jumptable for editor NED: vi jump table + * included by ned0001.c + * + * written: 1993-07-31 + * latest update: 1997-09-07 13:31:47 + * $Id: ned0001v.c,v 1.5 2007/12/02 11:55:23 gonter Exp $ + * + */ + +/* vi jump table - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* 00 */ xx, /* */ +/* 01 */ p_ctrlu, /* ^A: command_table_U UNUSED IN VI */ +/* 02 */ ned_page_up, /* ^B: page up */ +/* 03 */ xx, /* ^C: UNUSED IN VI */ +/* 04 */ ned_half_page_down, /* ^D: (half) page down */ +/* 05 */ p_upscr, /* ^E: */ +/* 06 */ ned_page_down, /* ^F: page down */ +/* 07 */ ned_line_info, /* ^G: */ +/* 08 */ ned_cursor_left, /* ^H: cursor left */ +/* 09 */ xx, /* ^I: UNUSED IN VI */ +/* 0A */ ned_cursor_down, /* ^J: */ +/* 0B */ p_ctrlk, /* ^K: command_table_K; UNUSED IN VI !!! */ +/* 0C */ p_refresh, /* ^L: redraw current window */ +/* 0D */ ned_cursor_down, /* ^M: cursor down */ +/* 0E */ xx, /* ^N: */ +/* 0F */ p_ctrlo, /* ^O: command_table_O; UNUSED IN VI !!! */ + +/* 10 */ ned_cursor_up, /* ^P: */ +/* 11 */ p_ctrlq, /* ^Q: commant_table_Q: UNUSED IN VI !!! */ +/* 12 */ p_refresh, /* ^R: */ +/* 13 */ xx, /* ^S UNUSED IN VI */ +/* 14 */ xx, /* ^T: UNUSED IN VI */ +/* 15 */ ned_half_page_up, /* ^U: (half) page up */ +/* 16 */ ned_ctrlp, /* ^V: insert literal next;NVI Extension */ +/* 17 */ vi_dkey, /* ^W: VIM extensions UNUSED IN VI !!! */ +/* 18 */ p_ctrlu, /* ^X: Command Table U UNUSED IN VI */ +/* 19 */ p_dnscr, /* ^Y: */ +/* 1A */ xx, /* ^Z: */ +/* 1B */ vi_bell, /* ^[: ESC */ +/* 1C */ p_ctrlu, /* ^\: */ +/* 1D */ q_eval_tag, /* ^]: interpret token as tag and go there */ +/* 1E */ xx, /* ^ */ +/* 1F */ xx, /* ^ */ + +/* 20 */ ned_cursor_right, /* SPACE: cursor right */ +/* 21 */ xx, /* */ +/* 22 */ xx, /* */ +/* 23 */ xx, /* */ +/* 24 */ ned_jmp_eoln, /* $: to end of line */ +/* 25 */ p_find_matching_bracket,/*%: */ +/* 26 */ xx, /* */ +/* 27 */ vi_dkey, /* ': jump to begin of line with marker */ +/* 28 */ xx, /* */ +/* 29 */ xx, /* */ +/* 2A */ xx, /* * UNUSED IN VI */ +/* 2B */ vi_jmp_next_boln, /* + */ +/* 2C */ ned_vi_find_next_rev, /* ,: find next character, reverse direction*/ +/* 2D */ vi_jmp_prev_boln, /* - */ +/* 2E */ vi_repeat_last_command,/* .: repeat last command */ +/* 2F */ vi_find_forward, /* /: find something */ + +/* 30 */ vi_digit, /* 0: */ +/* 31 */ vi_digit, /* 1 */ +/* 32 */ vi_digit, /* 2 */ +/* 33 */ vi_digit, /* 3 */ +/* 34 */ vi_digit, /* 4 */ +/* 35 */ vi_digit, /* 5 */ +/* 36 */ vi_digit, /* 6 */ +/* 37 */ vi_digit, /* 7 */ +/* 38 */ vi_digit, /* 8 */ +/* 39 */ vi_digit, /* 9 */ +/* 3A */ vi_ex, /* :: ex command line mode */ +/* 3B */ ned_vi_find_next, /* ; */ +/* 3C */ xx, /* < */ +/* 3D */ xx, /* = UNUSED IN VI */ +/* 3E */ xx, /* > */ +/* 3F */ vi_find_backward, /* ? */ + +/* 40 */ xx, /* @: */ +/* 41 */ vi_append_eol, /* A: */ +/* 42 */ p_word_left_2, /* B: move character right, ingnore punct. */ +/* 43 */ vi_change_2eoln, /* C: replace text until EOLN */ +/* 44 */ ned_del2eoln, /* D: delete rest of line */ +/* 45 */ p_word_right_end_2, /* E: */ +/* 46 */ vi_dkey, /* F: */ +/* 47 */ vi_jmp_2line, /* G: goto specified or line in file */ +/* 48 */ ned_vi_cursor_top, /* H: move cursor to top of the screen */ +/* 49 */ vi_insert_bol, /* I: */ +/* 4A */ vi_join, /* J: join line */ +/* 4B */ xx, /* K: UNUSED IN VI */ +/* 4C */ ned_vi_cursor_bot, /* L: move cursor to bottom of the screen */ +/* 4D */ ned_vi_cursor_mid, /* M: move cursor to mid screen */ +/* 4E */ xx, /* N: */ +/* 4F */ vi_insert_before_line, /* O: */ + +/* 50 */ ned_buffer_copy_before,/* P: */ +/* 51 */ xx, /* Q: */ +/* 52 */ vi_ovr, /* R: overwrite mode */ +/* 53 */ vi_change_line, /* S: delete current line and insert new 1 */ +/* 54 */ vi_dkey, /* T: */ +/* 55 */ xx, /* U: */ +/* 56 */ xx, /* V: UNUSED IN VI */ +/* 57 */ p_word_right_beg_2, /* W: move curse left one word */ +/* 58 */ ned_del_char_left, /* X: delete character left */ +/* 59 */ vi_yank, /* Y: */ +/* 5A */ vi_dkey, /* Z: */ +/* 5B */ xx, /* [: */ +/* 5C */ xx, /* \: UNUSED IN VI */ +/* 5D */ xx, /* ]: */ +/* 5E */ vi_jmp_boln, /* ^: to begin of line */ +/* 5F */ vi_jmp_boln, /* _: nvi: bold of cnt-1 line down, */ + /* UNUSED IN VI */ + +/* 60 */ vi_dkey, /* `: jump to named marker */ +/* 61 */ vi_append, /* a: */ +/* 62 */ p_word_left, /* b: word left */ +/* 63 */ vi_dkey, /* c: double: change word */ +/* 64 */ vi_dkey, /* d: double: delete line */ +/* 65 */ p_word_right_end, /* e: move cursor right to end of word */ +/* 66 */ vi_dkey, /* f: */ +/* 67 */ xx, /* g: UNUSED IN VI */ +/* 68 */ ned_cursor_left, /* h: cursor left */ +/* 69 */ vi_ins, /* i: insert mode */ +/* 6A */ ned_cursor_down, /* j: cursor down */ +/* 6B */ ned_cursor_up, /* k: cursor up */ +/* 6C */ ned_cursor_right, /* l: cursor right */ +/* 6D */ vi_dkey, /* m: set named marker */ +/* 6E */ p_fr_next, /* n: find next item */ +/* 6F */ vi_insert_after_line, /* o: */ + +/* 70 */ ned_buffer_copy, /* p: put, here it is copy block */ +/* 71 */ xx, /* q: UNUSED IN VI */ +/* 72 */ vi_dkey, /* r: double: replace one character */ +/* 73 */ vi_substitute, /* s: substitute character on cursor pos. */ +/* 74 */ vi_dkey, /* t: */ +/* 75 */ xx, /* u: */ +/* 76 */ xx, /* v: UNUSED IN VI */ +/* 77 */ p_word_right_beg, /* w: move cursor right to begin of word */ +/* 78 */ ned_del_char_right, /* x: delete character right */ +/* 79 */ vi_dkey, /* y: double key: yank */ +/* 7A */ vi_dkey, /* z: redraw and position cursor */ +/* 7B */ xx, /* {: */ +/* 7C */ vi_jmp_column, /* |: */ +/* 7D */ xx, /* }: */ +/* 7E */ p_toggle_case, /* ~: toggle character cases */ +/* 7F */ ned_cursor_left /* DEL */ diff --git a/app/ned/00/ned0001x.c b/app/ned/00/ned0001x.c new file mode 100644 index 0000000000000000000000000000000000000000..a3b15334ae0c2fdfc0304d805740491e5f028816 --- /dev/null +++ b/app/ned/00/ned0001x.c @@ -0,0 +1,34 @@ +/* + * FILE ~/usr/ned/00/ned0001x.c + * + * Sprungtabelle fuer Editor ned.c + * Praefix-Gruppe x: Dummy Block + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * 1991 02 07: Revision + * 1991 06 01: Revision; Aenderung des Table Layouts + * 1992 01 16: Aufteilung in include Files + * fuer jede Praefix-Gruppe + * latest update: 1993-08-01 + * + */ + +/* ------------------------------------------------------------------------ */ +/* 00 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 08 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 10 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 18 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 20 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 28 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 30 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 38 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 40 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 48 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 50 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 58 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 60 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 68 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 70 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 78 */ xx, xx, xx, xx, xx, xx, xx, xx diff --git a/app/ned/00/ned0002.c b/app/ned/00/ned0002.c new file mode 100644 index 0000000000000000000000000000000000000000..a28aba89f6fcee13de237e18b7e2a1ecf097d3b3 --- /dev/null +++ b/app/ned/00/ned0002.c @@ -0,0 +1,233 @@ +/* + * FILE %ned/00/ned0002.c + * + * table of ned's primitive names + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * latest update: 2001-02-11 12:42:17 + * $Id: ned0002.c,v 1.4 2001/02/12 00:03:15 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#define __NED_proto__ +#include "proto.h" + +#include "ned0009.c" /* Deklaration der primitiven Funktionen */ + +#ifndef MSDOS +#define cdecl +#endif + +/* ------------------------------------------------------------------------ */ +#ifdef JUNK +static int cdecl yy (void); +static int yy () { return 0; } /* Dummyfunktion */ +#endif + +/* see also: other NED Tcl commands */ +/* ------------------------------------------------------------------------ */ +struct NED_PRIMITIVES NED_PRIMITIVE_TABLE [] = +{ + { "insert", p_ins }, + { "tabulate", tabulate }, + { "split_join", p_split_join }, + { "cursor_up", ned_cursor_up }, + { "cursor_down", ned_cursor_down }, + { "cursor_left", ned_cursor_left }, + { "cursor_right", ned_cursor_right }, + { "word_left", p_word_left }, + { "word_right_beg", p_word_right_beg }, + { "word_right_end", p_word_right_end }, + { "page_down", ned_page_down }, + { "page_up", ned_page_up }, + { "half_page_down", ned_half_page_down }, + { "half_page_up", ned_half_page_up }, + { "delete_char_right", ned_del_char_right }, + { "delete_char_left", ned_del_char_left }, + { "delete_line", ned_delete_line }, + { "turn_line", p_turn_line }, + { "scroll_up", p_upscr }, + { "scroll_down", p_dnscr }, + { "delete_word", ned_delete_word }, + { "new_line", p_nl }, + { "break_line", p_nl2 }, + { "first_or_last", p_ax_lng }, + { "refresh", p_refresh }, + { "refresh_all", p_refresh_all }, + { "jump_to_window", p_jmpwdw }, + { "pushpage", p_pushpage }, + { "load_old_version", p_fget }, + { "save_reload", p_save_reload }, + { "open_file_in_context", p_ofile1 }, + { "open_file", p_ofile2 }, + { "wdwqfile", p_wdwqfile }, + { "abandon", p_abandon }, + { "qabandon", p_qabandon }, + { "rename_object", ned_rename_object }, + { "rename_and_save", ned_rename_and_save }, + { "link", p_link }, + { "unlink", p_unlink }, + { "save", p_save }, + { "ssave", p_ssave }, + { "sx", p_sx }, + { "pr_jump_to_line", ned_pr_jump_to_line }, + { "top", pq_up }, + { "bot", pq_dn }, + { "del2eoln", ned_del2eoln }, + { "aitoggle", p_aitoggle }, + { "rdsetup", p_rdsetup }, + { "edsetup", p_edsetup }, + { "blkbeg", p_blkbeg }, + { "blkend", p_blkend }, + { "hideblk", p_hideblk }, + { "ned_blk_mode", ned_blk_mode }, + { "ovins", p_ovins }, + { "ww", p_ww }, + { "block_copy", ned_blk_copy }, + { "block_move", ned_blk_move }, + { "block_delete", ned_blk_delete }, + { "block_iconify", ned_blk_iconify }, + { "block_read", ned_blk_read }, + { "block_write", ned_blk_write }, + { "block_append", ned_blk_append }, + { "block_print", ned_blk_print }, + { "jmp_boln", ned_jmp_boln }, + { "jml_eoln", ned_jmp_eoln }, + { "vi_jmp_boln", vi_jmp_boln }, + { "vi_jmp_prev_boln", vi_jmp_prev_boln }, + { "vi_jmp_next_boln", vi_jmp_next_boln }, + { "clone_window", p_clone_window }, + { "colornxt", p_colornxt }, + { "backcolnxt", p_backcolnxt }, + { "window_menu", p_window_menu }, + { "wdwfaecher", p_wdwfaecher }, + { "open_jou_rd", p_open_jou_rd }, + { "open_jou_wr", p_open_jou_wr }, + { "close_jou", p_close_jou }, + { "wdwopen", p_wdwopen }, + { "close_window", ned_close_window }, + { "wdwsize", p_wdwsize }, + { "ned_exit", p_exit }, + { "pico_exit", ned_pico_exit }, + { "insblk", p_insblk }, + { "ultra_panic", p_ultra_panic }, + { "feature_next", p_feature_next }, + { "feature_prev", p_feature_prev }, + { "feature_range", p_feature_range }, + { "feature_set", p_feature_set }, + { "feature_reset", p_feature_reset }, + { "link_feature", p_link_feature }, + { "show_author", ned_show_author }, + { "find", p_find }, + { "replace", p_replace }, + { "fr_next", p_fr_next }, + { "jmblkbeg", p_jmp_blkbeg }, + { "jmblkend", p_jmp_blkend }, + { "alt_minus", p_alt_minus }, + { "alt_gleich", p_alt_gleich }, + { "insert_null_char", p_alt_zero }, + { "line_end_MAC", ned_line_end_MAC }, + { "line_end_MSDOS", ned_line_end_MSDOS }, + { "line_end_UNIX", ned_line_end_UNIX }, + { "find_matching_bracket", p_find_matching_bracket }, + { "find_higher_bracket", p_find_higher_bracket }, + { "find_lower_bracket", p_find_lower_bracket }, + { "eval_str", ned_eval_str }, + { "eval_block", ned_eval_block }, + { "eval_feature", ned_eval_feature }, + { "cross_ref", p_cross_ref }, + { "link_more", p_link_more }, + { "logic_link_more", p_logic_link_more }, +#ifdef __NOT_USED__ /* 1998-08-15 18:24:06 */ + { "cl0", p_activate_cl0 }, + { "start", p_activate_cl0 }, + { "cl1", p_activate_cl1 }, + { "help", p_activate_cl1 }, + { "cl2", p_activate_cl2 }, + { "cl3", p_activate_cl3 }, + { "cl4", p_activate_cl4 }, + { "notes", p_activate_cl4 }, +#endif /* __NOT_USED__ 1998-08-15 18:24:06 */ + { "activate_crf", p_activate_crf }, + { "activate_cl_fr", ned_p_activate_cl_fr }, + { "activate_fr_root", p_activate_fr_root }, + { "activate_fr_notes", p_activate_fr_notes }, + { "activate_fr_help", p_activate_fr_help }, + { "logic_link_next", p_logic_link_next }, + { "logic_link_prev", p_logic_link_prev }, + { "logic_link_menu", p_logic_link_menu }, + { "logic_link_up", p_logic_link_up }, + { "logic_link", p_logic_link }, + { "logic_link_lang", p_logic_link_lang }, + { "logic_link_sort", p_logic_link_sort }, + { "logic_link_view", p_logic_link_view }, + { "mac_define", p_mac_define }, + { "memorize_location", ned_memorize_location }, + { "forget_location", ned_forget_location }, + { "pfile", p_pfile }, + { "vi_ins", vi_ins }, + { "vi_ovr", vi_ovr }, + { "vi_bell", vi_bell }, + { "vi_ex", vi_ex }, + { "vi_dkey", vi_dkey }, + { "vi_append", vi_append }, + { "vi_append_eol", vi_append_eol }, + { "vi_insert_bol", vi_insert_bol }, + { "vi_insert_before_line", vi_insert_before_line }, + { "vi_insert_after_line", vi_insert_after_line }, + { "vi_repeat_last_command", vi_repeat_last_command }, + { "change_2eoln", vi_change_2eoln }, + { "change_line", vi_change_line }, + { "vi_join", vi_join }, + { "toggle_case", p_toggle_case }, + { "set_mark", ned_set_mark }, + { "set_lookup_tag", ned_set_lookup_tag }, + { "set_lookup_tag_fr", ned_set_lookup_tag_fr }, + { "set_hyx_l", ned_set_hyx_l }, + { "set_SGML_tag", ned_set_SGML_tag }, + { "set_SGML_entity", ned_set_SGML_entity }, + { "read_entity", ned_read_entity }, + { "tag_disp_normal", p_show_tag_normally }, + { "tag_disp", p_show_tag }, + { "tag_disp_full", p_show_full_tag }, + { "reload_sgml", ned_reload_sgml }, + { "reload_ascii", ned_reload_ascii }, + { "format_SGML", p_format_SGML }, + { "format_ASCII", p_format_ASCII }, + { "pico", pico_mode }, + { "WordStar", wordstar_mode }, + { "vi_mode", vi_mode }, + { "paste_file_name", ned_paste_file_name }, + { "paste_user", ned_paste_user }, + { "paste_date", ned_paste_date }, + { "paste_date_time", ned_paste_date_time }, + { "paste_date_string", ned_paste_date_string }, + { "paste_seconds", ned_paste_seconds }, + { "paste_renamed_object", ned_paste_renamed_object }, + { "group_set_marker", ned_group_set_marker }, + + /*** unneeded ??? ***/ + { "subprocessor_q", p_ctrlq }, + { "subprocessor_k", p_ctrlk }, + { "subprocessor_o", p_ctrlo }, + { "subprocessor_u", p_ctrlu }, + { "subprocessor_w", p_ctrlw }, + /*** unneeded ??? ***/ + +#ifdef USE_TK + { "import_selection", ned_tk_import_selection }, + { "withdraw_current_window", ned_tk_aw_withdraw }, + { "save_withdraw_current_window", ned_tk_aw_save_withdraw }, + { "iconify_current_window", ned_tk_aw_iconify }, + { "deiconify_current_window", ned_tk_aw_deiconify }, +#endif /* USE_TK */ + + { (char *) 0, (ned_primitive *) 0 } +} ; diff --git a/app/ned/00/ned0003.c b/app/ned/00/ned0003.c new file mode 100644 index 0000000000000000000000000000000000000000..738348a9000b2ca2463042baa80c4ad406220d74 --- /dev/null +++ b/app/ned/00/ned0003.c @@ -0,0 +1,201 @@ +/* + * FILE %ned/00/ned0003.c + * + * mouse menus for the editor NED + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * 1992 07 12: Reorganisation der Menu Items + * latest update: 1998-08-15 12:28:24 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/maus.h> + +#include "ned0009.c" /* Deklaration der primitiven Funktionen */ + +void cdecl maus_setup (void); + +/* ------------------------------------------------------------------------ */ +static struct mm_item MMitem [] = +{ +/* 00 */ { 1, 0, (long) p_sx } , +/* 01 */ { 1, 0, (long) p_ssave } , +/* 02 */ { 1, 0, (long) p_save } , +/* 03 */ { 1, 0, (long) p_fget } , +/* 04 */ { 1, 0, (long) p_abandon } , +/* 05 */ { 1, 0, (long) p_qabandon } , +/* 06 */ { 1, 0, (long) p_activate_fr_root } , +/* 07 */ { 1, 0, (long) p_activate_fr_notes } , +/* 08 */ { 1, 0, (long) p_activate_fr_help } , +/* 09 */ { 1, 0, (long) ned_p_activate_cl_fr } , + +/* 10 */ { 1, 0, (long) p_activate_cl1 } , +/* 11 */ { 1, 0, (long) p_activate_cl2 } , +/* 12 */ { 1, 0, (long) p_activate_cl3 } , +/* 13 */ { 1, 0, (long) p_activate_cl4 } , +/* 14 */ { 1, 0, (long) p_ovins } , +/* 15 */ { 1, 0, (long) p_turn_line } , /* unused */ +/* 16 */ { 1, 0, (long) p_wdwopen } , +/* 17 */ { 1, 0, (long) p_ofile1} , +/* 18 */ { 1, 0, (long) p_link } , +/* 19 */ { 1, 0, (long) p_window_menu } , + +/* 20 */ { 1, 0, (long) p_wdwfaecher } , +/* 21 */ { 1, 0, (long) p_logic_link_next } , +/* 22 */ { 1, 0, (long) p_logic_link_prev } , +/* 23 */ { 1, 0, (long) p_logic_link_up } , +/* 24 */ { 1, 0, (long) p_logic_link_menu } , +/* 25 */ { 1, 0, (long) p_logic_link_lang } , +/* 26 */ { 1, 0, (long) p_logic_link } , +/* 27 */ { 1, 0, (long) p_link_more } , +/* 28 */ { 1, 0, (long) p_logic_link_more } , +/* 29 */ { 1, 0, (long) p_logic_link } , + +/* 30 */ { 1, 0, (long) ned_set_hyx_l } , +/* 31 */ { 1, 0, (long) ned_memorize_location } , +/* 32 */ { 1, 0, (long) ned_set_SGML_tag } , +/* 33 */ { 1, 0, (long) ned_set_SGML_entity } , +/* 34 */ { 1, 0, (long) p_link_feature } , +/* 35 */ { 1, 0, (long) p_edsetup } , +/* 36 */ { 1, 0, (long) p_rdsetup } , +/* 37 */ { 1, 0, (long) p_mac_define } , +/* 38 */ { 1, 0, (long) p_shell } , +/* 39 */ { 1, 0, (long) ned_show_author } , + +/* 40 */ { 1, 0, (long) p_pushpage } , +/* 41 */ { 1, 0, (long) vi_on } , +/* 42 */ { 1, 0, (long) vi_ins } , +/* 43 */ { 1, 0, (long) vi_ovr } , +/* 44 */ { 1, 0, (long) p_blkbeg } , +/* 45 */ { 1, 0, (long) p_blkend } , +/* 46 */ { 1, 0, (long) ned_blk_copy } , +/* 47 */ { 1, 0, (long) ned_blk_move } , +/* 48 */ { 1, 0, (long) ned_blk_iconify } , +/* 49 */ { 1, 0, (long) ned_blk_delete } , + +/* 50 */ { 1, 0, (long) ned_set_mark } , +/* 51 */ { 1, 0, (long) p_logic_link_sort } , +/* 52 */ { 1, 0, (long) p_logic_link_view } , +/* 53 */ { 1, 0, (long) p_feature_set } , +/* 54 */ { 1, 0, (long) p_feature_reset } , +/* 55 */ { 1, 0, (long) ned_set_lookup_tag } , +/* 56 */ { 1, 0, (long) p_save_reload } , +/* 57 */ { 1, 0, (long) p_activate_cl0 } , +/* 58 */ { 1, 0, (long) p_show_tag_normally } , +/* 59 */ { 1, 0, (long) p_show_tag } , + +/* 60 */ { 1, 0, (long) p_show_full_tag } , +/* 61 */ { 1, 0, (long) ned_forget_location } +} ; + +/* ------------------------------------------------------------------------ */ +static struct MMen_short MMs [] = +{ + { 0, 0, "File", -1L, 0, 1 } , + { 0, 1, "�Save & Reload�", (long) (&MMitem[56]), 0, 1 } , + { 0, 2, "�Save & Close �", (long) (&MMitem[ 1]), 0, 1 } , + { 0, 3, "�Save & Exit �", (long) (&MMitem[ 0]), 0, 1 } , + { 0, 4, "�Save �", (long) (&MMitem[ 2]), 0, 1 } , + { 0, 5, "�Restore File �", (long) (&MMitem[ 3]), 0, 1 } , + { 0, 6, "�������������ij", -1L, 0, 1 } , + { 0, 7, "�Abort �", (long) (&MMitem[ 4]), 0, 1 } , + { 0, 8, "�Panic �", (long) (&MMitem[ 5]), 0, 1 } , + { 0, 9, "���������������", -1L, 0, 1 } , + + { 1, 0, "Cluster", -1L, 0, 1 } , + { 1, 1, "�$$root �", (long) (&MMitem[ 6]), 0, 1 } , + { 1, 2, "�$$notes �", (long) (&MMitem[ 7]), 0, 1 } , + { 1, 3, "�$$help �", (long) (&MMitem[ 8]), 0, 1 } , + { 1, 4, "�cl? + fr? �", (long) (&MMitem[ 9]), 0, 1 } , + { 1, 5, "�%cl0:start�", (long) (&MMitem[57]), 0, 1 } , + { 1, 6, "�%cl1:help �", (long) (&MMitem[10]), 0, 1 } , + { 1, 7, "�%cl2:notes�", (long) (&MMitem[11]), 0, 1 } , + { 1, 8, "�%cl3: �", (long) (&MMitem[12]), 0, 1 } , + { 1, 9, "�%cl4:t2d �", (long) (&MMitem[13]), 0, 1 } , + { 1,10, "������������", -1L, 0, 1 } , + + { 2, 0, "Window", -1L, 0, 1 } , + { 2, 1, "�open �", (long) (&MMitem[16]), 0, 1 } , + { 2, 2, "�read �", (long) (&MMitem[17]), 0, 1 } , + { 2, 3, "�link �", (long) (&MMitem[18]), 0, 1 } , + { 2, 4, "�selection box�", (long) (&MMitem[19]), 0, 1 } , + { 2, 5, "�stack windows�", (long) (&MMitem[20]), 0, 1 } , + { 2, 6, "�������������ij", -1L, 0, 1 } , + { 2, 7, "�ins/ovr �", (long) (&MMitem[14]), 0, 1 } , + { 2, 8, "���������������", -1L, 0, 1 } , + + { 3, 0, "Block", -1L, 0, 1 } , + { 3, 1, "�mark begin�", (long) (&MMitem[44]), 0, 1 } , + { 3, 2, "�mark end �", (long) (&MMitem[45]), 0, 1 } , + { 3, 3, "�copy �", (long) (&MMitem[46]), 0, 1 } , + { 3, 4, "�move �", (long) (&MMitem[47]), 0, 1 } , + { 3, 5, "�delete �", (long) (&MMitem[49]), 0, 1 } , + { 3, 6, "�iconify �", (long) (&MMitem[48]), 0, 1 } , + { 3, 7, "������������", -1L, 0, 1 } , + +/* 4 ... frei */ +/* 5 ... frei */ + + { 6, 0, "Hyper", -1L, 0, 1 } , + { 6, 1, "�->next �", (long) (&MMitem[21]), 0, 1 } , + { 6, 2, "�->prev �", (long) (&MMitem[22]), 0, 1 } , + { 6, 3, "�->up �", (long) (&MMitem[23]), 0, 1 } , + { 6, 4, "�->menu �", (long) (&MMitem[24]), 0, 1 } , + { 6, 5, "�->lang �", (long) (&MMitem[25]), 0, 1 } , + { 6, 6, "�->sort �", (long) (&MMitem[51]), 0, 1 } , + { 6, 7, "�->view �", (long) (&MMitem[52]), 0, 1 } , + { 6, 8, "�->?? �", (long) (&MMitem[26]), 0, 1 } , + { 6, 9, "�links ?? �", (long) (&MMitem[27]), 0, 1 } , + { 6,10, "�logic links ?? �", (long) (&MMitem[28]), 0, 1 } , + { 6,11, "���������������ij", (long) (&MMitem[29]), 0, 1 } , + { 6,12, "�mem. location �", (long) (&MMitem[31]), 0, 1 } , + { 6,13, "�forget location�", (long) (&MMitem[61]), 0, 1 } , + { 6,14, "�����������������", -1L, 0, 1 } , + + { 7, 0, "SGML", -1L, 0, 1 } , + { 7, 1, "�set entity �", (long) (&MMitem[33]), 0, 1 } , + { 7, 2, "�set tag �", (long) (&MMitem[32]), 0, 1 } , + { 7, 3, "�set 'mark' tag �", (long) (&MMitem[50]), 0, 1 } , + { 7, 4, "�set 'hyx.l' tag �", (long) (&MMitem[30]), 0, 1 } , + { 7, 5, "�lookup+set link �", (long) (&MMitem[55]), 0, 1 } , + { 7, 6, "����������������ij", -1L, 0, 1 } , + { 7, 7, "�set feature �", (long) (&MMitem[53]), 0, 1 } , + { 7, 8, "�reset feature �", (long) (&MMitem[54]), 0, 1 } , + { 7, 9, "�edit features �", (long) (&MMitem[34]), 0, 1 } , + { 7,10, "����������������ij", -1L, 0, 1 } , + { 7,11, "�tag disp normal �", (long) (&MMitem[58]), 0, 1 } , + { 7,12, "�tag disp �", (long) (&MMitem[59]), 0, 1 } , + { 7,13, "�tag disp full �", (long) (&MMitem[60]), 0, 1 } , + { 7,14, "������������������", -1L, 0, 1 } , + + { 8, 0, "Setup", -1L, 0, 1 } , + { 8, 1, "�ED setup �", (long) (&MMitem[35]), 0, 1 } , + { 8, 2, "�RD setup �", (long) (&MMitem[36]), 0, 1 } , + { 8, 3, "�def macro�", (long) (&MMitem[37]), 0, 1 } , + { 8, 4, "�����������", -1L, 0, 1 } , + + { 9, 0, "Misc", -1L, 0, 1 } , + { 9, 1, "�Shell �", (long) (&MMitem[38]), 0, 1 } , + { 9, 2, "�Author �", (long) (&MMitem[39]), 0, 1 } , + { 9, 3, "�Window Page �", (long) (&MMitem[40]), 0, 1 } , + { 9, 4, "�VI mode �", (long) (&MMitem[41]), 0, 1 } , + { 9, 5, "�insert mode �", (long) (&MMitem[42]), 0, 1 } , + { 9, 6, "�overwrite mode�", (long) (&MMitem[43]), 0, 1 } , + { 9, 7, "����������������", -1L, 0, 1 } +} ; + +/* Maus + Menue Steuerung ------------------------------------------------- */ +void maus_setup () +{ + int x, y; + + x= sizeof (MMs) / sizeof (struct MMen_short); + for (y= 0; y < x; y++) mm_short_install_function (&MMs [y]); +} diff --git a/app/ned/00/ned0004.c b/app/ned/00/ned0004.c new file mode 100644 index 0000000000000000000000000000000000000000..8ec0c307ee5d5a90df69341f62ce45c97f342db5 --- /dev/null +++ b/app/ned/00/ned0004.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/00/ned0004.c + * + * Datenstrukturen fuer EDITOR NED + * + * written: 1987 09 09 + * latest update: 1996-05-16 19:08:49 + * + */ + +#include "ed.h" + +/* ------------------------------------------------------------------------ */ +/* list of currently active windoww */ +struct WINDOWCTRL *windows= (struct WINDOWCTRL *) 0; + +/* current working window */ +struct WINDOWCTRL *aw= (struct WINDOWCTRL *) 0; + +/* list of currently active files */ +struct FILECTRL *files= (struct FILECTRL *) 0; + +/* number of the displayed screen */ +int akt_page= 0; diff --git a/app/ned/00/ned0005.c b/app/ned/00/ned0005.c new file mode 100644 index 0000000000000000000000000000000000000000..55349210e15055624f46629ae6af5b8ccba2970f --- /dev/null +++ b/app/ned/00/ned0005.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/00/ned0005.c + * + * Datenstrukturen fuer EDITOR NED + * see Markers for the complete truth + * + * written: 1987 09 09 + * latest update: 1997-03-31 12:51:19 + * + */ + +#include "ed.h" + +/* ------------------------------------------------------------------------ */ +struct MARKER b_first= { (struct WINDOWCTRL *) 0, (struct LINE *) 0, 0 }; +struct MARKER b_last= { (struct WINDOWCTRL *) 0, (struct LINE *) 0, 0 }; +struct MARKER b_beg= { (struct WINDOWCTRL *) 0, (struct LINE *) 0, 0 }; +struct MARKER b_end= { (struct WINDOWCTRL *) 0, (struct LINE *) 0, 0 }; + +/* ------------------------------------------------------------------------ */ +int blk= 0; /* 1 -> Block angezeigt */ +int block_mode= BLOCK_MODE_standard; + /* 1 BLOCK_MODE_standard -> 'normaler' Modus*/ + /* 2 BLOCK_MODE_line -> LINE Modus */ + /* 3 BLOCK_MODE_box -> Box Modus */ diff --git a/app/ned/00/ned0006.c b/app/ned/00/ned0006.c new file mode 100644 index 0000000000000000000000000000000000000000..1dfc8a5bf1bf2151eaeeb254b7a3e8f00932eb02 --- /dev/null +++ b/app/ned/00/ned0006.c @@ -0,0 +1,46 @@ +/* + * FILE %ned/00/ned0006.c + * + * global ds: console, input, macro, setup + * + * written: 1987 09 09 + * latest update: 1997-09-07 12:56:54 + * $Id: ned0006.c,v 1.2 2005/09/04 19:03:16 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/filename.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int pfx= 0; /* Kommand Key Praefix */ +int key= 0; /* betaetigte Taste */ +int ptbl_offset= 0; /* offset in the primitives tables */ +int repeat= 0; /* repeat factor for commands */ + +/* ------------------------------------------------------------------------ */ +FILE *jou= (FILE *) 0; +int jou_flag= 0; /* 0 -> Jour File geschlossen */ + /* 1 -> . . beschreiben */ + /* 2 -> . . lesen */ +char jou_name [MAX_FNM_LENGTH]= "ned.jou"; /* Name des Journal Files */ +char stp_fnm [MAX_FNM_LENGTH]= "ned.stp"; /* Name des SETUP Files */ + +int maus_angeschlossen= 0; /* 0 .. keine Maus */ + /* >0 .. Maustyp */ + /* (siehe File MAUS.H) */ + +/* macro processing ------------------------------------------------------- */ +int MPflag= 0; /* 1 -> macro is currently expanded */ + +int oper_level= 0; /* Operations Level: */ + /* 0 -> Alle Privilegien */ + /* 32000 -> nur mehr Read Only */ + +int ned_werr_dont_complain= 0; /* 1 -> dont complain if file cant be */ + /* opened for writing */ + +/* something needs to be performed outside the event handler */ +ned_primitive_function *special_event= (ned_primitive_function *) 0; diff --git a/app/ned/00/ned0006b.c b/app/ned/00/ned0006b.c new file mode 100644 index 0000000000000000000000000000000000000000..490ae9839cf780f99f870b6bcaf7256b38b51d98 --- /dev/null +++ b/app/ned/00/ned0006b.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/00/ned0006b.c + * + * global ds: input handler + * + * written: 1997-08-03 [extracted frm ned0006.c] + * latest update: 1997-08-03 21:56:59 + * $Id: ned0006b.c,v 1.3 2005/09/04 19:03:16 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/filename.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +ned_input_handler *nextchar= /* Editor Eingabe: KBD | FILE .. */ +#ifdef EXPER + kbin; +#else + q_kbin; +#endif + +ned_input_handler *nxtchs; /* Zwischenspeicher fuer (*nextchar) */ diff --git a/app/ned/00/ned0007.c b/app/ned/00/ned0007.c new file mode 100644 index 0000000000000000000000000000000000000000..07d181988972c5b3cb22e4529b69461ad00779b5 --- /dev/null +++ b/app/ned/00/ned0007.c @@ -0,0 +1,42 @@ +/* + * FILE %ned/00/ned0007.c + * + * Default Farben + * + * written: 1991 05 26 + * latest update: 1996-09-29 9:39:54 + * $Id: ned0007.c,v 1.2 2005/06/14 02:36:06 gonter Exp $ + * + */ + +#include "ed.h" +#include <gg/window.h> + +/* Attribute fuer Windows: ------------------------------------------------ */ +int COL_TEXT = WV_HGRUEN; +int COL_BOX = WV_GELB; +int COL_BLOCK = WH_ROT|WV_GELB|W_HELL; +int COL_FEATURE = WV_WEISS|W_HELL; +int COL_MARKUP = WV_GRUEN|WH_WEISS; + +/* globale Attribute: ----------------------------------------------------- */ +int COL_SCROLL = WV_GELB; +int COL_CONFIRM = WV_VIOLETT|W_HELL; +int COL_ERROR = WV_VIOLETT|W_HELL; +int COL_WIN_NUM = WH_ROT|WV_KOBALT|W_HELL; +int COL_STATUS = WV_HKOBALT|WH_BRAUN; +int COL_ASK = WV_VIOLETT|W_HELL; + +/* hypertext attributes: -------------------------------------------------- */ +int COL_UNKNOWN_FEATURE= WV_BLAU|WH_WEISS; +int COL_FRAME_TAGS= WV_GELB|WH_BRAUN; + +#ifdef MSDOS +#define _DEF_UNKNOWN_FEATURE 0x0F +#else +#define _DEF_UNKNOWN_FEATURE '?' +#endif +int CHR_UNKNOWN_FEATURE= _DEF_UNKNOWN_FEATURE; +int CHR_FILLER= 0x20; /* used to fill up space at end of line */ +int CHR_TAB_FILLER= 0x1A; +int DISPLAY_TABS= 1; /* -> show tabs as a series of blanks */ diff --git a/app/ned/00/ned0009.c b/app/ned/00/ned0009.c new file mode 100644 index 0000000000000000000000000000000000000000..bace5e103cb8a15b3d75e44b8d6d9b411b778dec --- /dev/null +++ b/app/ned/00/ned0009.c @@ -0,0 +1,167 @@ +/* + * FILE %ned/00/ned0009.c + * + * Deklaration der primitiven Funktionen des Editors + * + * Include File fuer ned0001.c, ned0002.c und ned0003.c + * + * 1991 06 25: aus ned0001.c herausgeloest + * latest update: 2001-02-11 12:43:10 + * $Id: ned0009.c,v 1.6 2002/06/15 04:35:20 gonter Exp $ + * + */ + +#ifndef __NED_0009__ +#define __NED_0009__ + +/* ------------------------------------------------------------------------ */ +extern int + p_ins (), tabulate (), p_split_join (), + ned_cursor_left (), ned_cursor_right (), + ned_del_char_right (), ned_del_char_left (), + ned_delete_line (), p_turn_line (), + p_ctrlq (), p_ctrlk (), p_ctrlo (), + p_ctrlu (), p_ctrlw (), + p_funct (), + p_upscr (), p_dnscr (), ned_delete_word (), + p_nl (), p_nl2 (), p_ax_lng (), + p_refresh (), p_refresh_all (), + p_jmpwdw (), p_pushpage (), p_fget (), + p_ofile1 (), p_ofile2 (), p_wdwqfile (), + p_abandon (), p_qabandon (), + ned_rename_object (), p_link (), p_unlink (), p_save (), + p_ssave (), ned_ssave_all (), p_sx (), ned_pr_jump_to_line (), + pq_up (), pq_dn (), ned_del2eoln (), + p_aitoggle (), p_rdsetup (), p_edsetup (), + p_blkbeg (), p_blkend (), + p_hideblk (), ned_blk_mode (), p_ovins (), p_ww (), + p_clone_window (), + p_colornxt (), p_backcolnxt (), + p_window_menu (), p_wdwfaecher (), + p_open_jou_rd (), p_open_jou_wr (), p_close_jou (), + p_wdwopen (), ned_close_window (), p_wdwsize (), + p_wdwXup (), p_wdwXdn (), p_wdwXlt (), p_wdwXrt (), + p_wdwAup (), p_wdwAdn (), p_wdwAlt (), p_wdwArt (), + p_wdwBup (), p_wdwBdn (), p_wdwBlt (), p_wdwBrt (), + p_shell (), p_insblk (), QQdeb (), + p_ultra_panic (), p_save_restart (), p_load_restart (), + p_feature_next (), p_feature_prev (), p_feature_range (), + p_feature_set (), p_feature_reset (), p_link_feature (), + ned_show_author (), p_XX_break (), p_menue (), + p_find (), p_replace (), p_fr_next(), + p_jmp_blkbeg (),p_jmp_blkend (), + p_alt_minus (), p_alt_gleich (), p_alt_zero (), + ned_eval_str (), ned_eval_block (), ned_eval_feature (), + p_link_more (), p_logic_link_more (), + p_activate_cl0 (), + p_activate_cl1 (), p_activate_cl2 (), p_activate_cl3 (), + p_activate_cl4 (), p_activate_crf (), ned_p_activate_cl_fr (), + p_activate_fr_root (), p_activate_fr_notes (), p_activate_fr_help (); + +extern int ned_ctrlp (); +extern int p_cross_ref (), ned_lookup_lexicon (), ned_lookup_lib (); +extern int ned_lookup_thesaurus (); +extern int ned_group_set_marker (); +extern int p_find_matching_bracket (); +extern int p_find_higher_bracket (), p_find_lower_bracket (); + +extern int p_exit (), ned_pico_exit (), ned_rename_and_save (); +extern int ned_blk_copy (), ned_blk_copy_before (); +extern int ned_blk_move (), ned_blk_delete (); +extern int ned_blk_iconify (), ned_blk_read (), ned_blk_write (); +extern int ned_blk_append (), ned_blk_print (); +extern int ned_page_down (), ned_page_up (); +extern int ned_half_page_down (), ned_half_page_up (); +extern int ned_jmp_boln (), ned_jmp_eoln (); +extern int vi_jmp_boln (), vi_jmp_prev_boln (), vi_jmp_next_boln (); +extern int vi_digit (); +extern int p_word_left (), p_word_right_beg (), p_word_right_end (); +extern int p_word_left_2 (), p_word_right_beg_2 (), p_word_right_end_2 (); +extern int p_save_reload (), p_show_tag_normally (); +extern int p_show_tag (), p_show_full_tag (); +extern int ned_reload_ascii (), ned_reload_sgml (); +extern int p_logic_link_next (), p_logic_link_prev (), p_logic_link_menu (); +extern int p_logic_link_up (), p_logic_link (), p_logic_link_lang (); +extern int p_logic_link_sort (), p_logic_link_view (); +extern int ned_line_end_MAC (), ned_line_end_MSDOS (), ned_line_end_UNIX (); + +extern int ned_set_marker_key (), ned_jmp_marker_key (), ned_jmp_marker_1 (); +extern int ned_jmp_marker_find (); +extern int + ned_jmp_aktline_top (), ned_jmp_aktline_mid (), ned_jmp_aktline_bot (); + +extern int +p_macro00 (), p_macro01 (), p_macro02 (), p_macro03 (), p_macro04 (), +p_macro05 (), p_macro06 (), p_macro07 (), p_macro08 (), p_macro09 (), +p_macro10 (), p_macro11 (), p_macro12 (), p_macro13 (), p_macro14 (), +p_macro15 (), p_macro16 (), p_macro17 (), p_macro18 (), p_macro19 (), +p_macro20 (), p_macro21 (), p_macro22 (), p_macro23 (), p_macro24 (), +p_macro25 (), p_macro26 (), p_macro27 (), p_macro28 (), p_macro29 (), +p_macro30 (), p_macro31 (), p_macro32 (), p_macro33 (), p_macro34 (), +p_macro35 (), p_macro36 (), p_macro37 (), p_macro38 (), p_macro39 (), +p_macro40 (), p_macro41 (), p_macro42 (), p_macro43 (), p_macro44 (), +p_macro45 (), p_macro46 (), p_macro47 (), p_macro48 (), p_macro49 (); + +extern int p_mac_define (), p_mac (); +/* DEBUG only: */ extern int p_dump_macro (); + +extern int ned_memorize_location (); +extern int p_pfile (); +extern int q_eval_tag (); + +extern int p_extract (); +extern int vi_mode (); +extern int vi_on (), vi_ins (), vi_ovr (), vi_bell (), vi_ex (), vi_dkey (); +extern int vi_append (), vi_append_eol (), vi_insert_bol (); +extern int vi_insert_before_line (), vi_insert_after_line (); +extern int vi_repeat_last_command (), vi_join (); +extern int vi_substitute (), vi_change_line (), vi_change_2eoln (); +extern int vi_yank (); +extern int vi_find_forward (), vi_find_backward (); + +extern int pico_mode (), pico_help (), wordstar_mode (); +extern int pico_find (); +extern int p_toggle_case (); + +extern int ned_cursor_up (), ned_cursor_down (); +extern int ned_vi_cursor_top (), ned_vi_cursor_mid (), ned_vi_cursor_bot (); +extern int ned_ws_aw_find_str (); +extern int ned_vi_find_next (), ned_vi_find_next_rev (); + +extern int ned_set_mark (); +extern int ned_set_lookup_tag (), ned_set_lookup_tag_fr (); +extern int ned_set_hyx_l (); +extern int ned_set_SGML_tag (), ned_set_SGML_entity (); +extern int ned_read_entity (); +extern int p_format_SGML (), p_format_ASCII (); +extern int ned_forget_location (); + +extern int vi_jmp_2line (), vi_jmp_column (); +extern int ned_buffer_copy (), ned_buffer_copy_before (); +extern int ned_line_info (); + +/* non-recasting */ +extern int ned_paste_date (), ned_paste_seconds (); +extern int ned_paste_date_time (); +extern int ned_paste_date_string (); +extern int ned_paste_user (); +extern int ned_paste_renamed_object (); +extern int ned_paste_file_name (); +extern int ned_markup_block_prompt (); +extern int ned_ftr_shift_up (), ned_ftr_shift_down (); +extern int ned_set_lookup_tag_fr2 (); + +#ifdef MSDOS +extern int p_switch_line_mode (); +#endif + +#ifdef USE_TK +extern int ned_tk_import_selection (); +extern int ned_tk_aw_save_withdraw (); +extern int ned_tk_aw_withdraw (); +extern int ned_tk_aw_iconify (); +extern int ned_tk_aw_deiconify (); +extern int ned_tk_claim_selection (); +#endif /* USE_TK */ + +#endif /* __NED_0009__ */ diff --git a/app/ned/00/ned0010.c b/app/ned/00/ned0010.c new file mode 100644 index 0000000000000000000000000000000000000000..9d162e957e29c3c393fa4038b4b544a3f64caabc --- /dev/null +++ b/app/ned/00/ned0010.c @@ -0,0 +1,20 @@ +/* + * FILE %ned/00/ned0010.c + * + * additional screen control + * + * written: 1992 04 04 + * latest update: 1997-01-12 16:37:31 + * $Id: ned0010.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include "ed.h" + +/* ------------------------------------------------------------------------ */ +struct BUTTON_DESCRIPTOR *buttons= (struct BUTTON_DESCRIPTOR *) 0; + +int NED_TEXT_NIM_X= 0; +int NED_TEXT_MIN_Y= 0; +int NED_TEXT_MAX_X= 80; +int NED_TEXT_MAX_Y= 25; diff --git a/app/ned/00/ned0011.c b/app/ned/00/ned0011.c new file mode 100644 index 0000000000000000000000000000000000000000..aaa762f81f131c515d29ba50973c2730bea6982b --- /dev/null +++ b/app/ned/00/ned0011.c @@ -0,0 +1,119 @@ +/* + * FILE %ned/00/ned0011.c + * + * default values and setup + * + * written: 1996-05-16 + * latest update: 2001-02-11 22:09:02 + * $Id: ned0011.c,v 1.6 2001/02/12 00:03:16 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#define _DEF_HORIZ_SCROLL 1 +#define _DEF_VERT_SCROLL 1 +#else +#define _DEF_HORIZ_SCROLL 1 +#define _DEF_VERT_SCROLL 1 +#endif + +/* ------------------------------------------------------------------------ */ +/* normal editing and everything */ +int default_edit_mode= 0x00; +int default_tag_display_mode= WCTDM_normal; + +int global_file_format= FMT_ASCII; +int default_bin_eoln= 0x0A; /* End-Of-Line Code bei binaer */ +int default_bin_llng= LINE_LNG_TXT; /* Laenge von binaeren Zeilen */ +int default_cross_ref_fmt= FMT_SGML; +int default_cross_ref_local= 0; +char *default_cross_ref_template; +char *default_template_frame; +char *default_start_frame; +char *default_undef_frame; +char *default_cross_ref_prefix; +int default_cross_ref_to_lower= 1; + +int GHYOPT_close_on_logic_link= 1; + +/* HELP subsystem: -------------------------------------------------------- */ +char *default_help_cluster; +char *default_help_open_file; +char *default_help_jump_to_line; +char *default_help_rename_frame; +char *default_help_cross_ref; +char *default_help_prompt_attrib; + +/* HUH? What's that?? */ +#define URXN 256 +char default_urxn [URXN]; +int urxn_size= URXN; + +int word_wrap_count= LINE_LNG_TXT; /* automatischer Zeilenumbruch */ + +/* number of chars to scroll horizontally and vertically */ +int ned_horizontal_scroll_count= _DEF_HORIZ_SCROLL; +int ned_vertical_scroll_count= _DEF_VERT_SCROLL; +int ned_tabstop= 8; /* number of chars to expand one TAB max. */ + +/* ------------------------------------------------------------------------ */ +int ned_0011 () +{ + int i; + + default_cross_ref_template= strdup ("$$crf"); + default_template_frame= strdup ("$$template"); + default_start_frame= strdup ("$$root"); + default_undef_frame= strdup ("$$undef"); + default_cross_ref_prefix= strdup ("$"); + + default_help_cluster= strdup ("%cl1"); + default_help_open_file= strdup ("open_file"); + default_help_jump_to_line= strdup ("jump_to_line"); + default_help_rename_frame= strdup ("rename_frame"); + default_help_cross_ref= strdup ("cross_ref"); + default_help_prompt_attrib= strdup ("attrib"); /* T2D */ + + for (i= 0; i < URXN; i++) default_urxn[i]= 'x'; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int check_urxn (char *id) +{ + int i, err=0; + + for (i= 0; i < URXN; i++) + { + if (default_urxn[i] != 'x') err++; + } + + if (err > 0) + { + printf ("------------- fence '%s' err=%d --------\n", id, err); + dump (stdout, &default_cross_ref_template, urxn_size+44); + for (i= 0; i < URXN; i++) default_urxn[i]= 'x'; + } + + return err; +} + +/* ------------------------------------------------------------------------ */ +int ned_init_virtual_filename_table (void) +{ + _read_logic_filename_table ("/usr/local/lib/ned/ned.lp", (char *) 0, 1); + read_logic_filename_table ((char *) 0, 1); /* get the entry from etc */ + /*************** ~/etc/ned.lp is read twice!!! ****************** + tmp_ptr= translate_logic_filename ("~/etc/ned.lp"); + _read_logic_filename_table (tmp_ptr, (char *) 0, 1); + free (tmp_ptr); + ****************************************************************/ + + return 0; +} diff --git a/app/ned/00/ned0015.c b/app/ned/00/ned0015.c new file mode 100644 index 0000000000000000000000000000000000000000..add3e3e65ee455b02d00e059b32124d6d99f8f6a --- /dev/null +++ b/app/ned/00/ned0015.c @@ -0,0 +1,19 @@ +/* + * FILE %ned/00/ned0015.c + * + * context + * + * written: 1995-12-12 + * latest update: 1996-11-10 0:35:38 + * + */ + +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct NED_CONTEXT *ned_main_context= (struct NED_CONTEXT *) 0; + +char *ned_renamed_object= (char *) 0; + diff --git a/app/ned/00/ned0016p.c b/app/ned/00/ned0016p.c new file mode 100644 index 0000000000000000000000000000000000000000..2657adc88597e22eacd331ed7809bcf717fad8d5 --- /dev/null +++ b/app/ned/00/ned0016p.c @@ -0,0 +1,49 @@ +/* + * FILE %ned/00/ned0016p.c + * + * Sprungtabelle fuer Editor ned.c + * Praefix-Gruppe a (kein Praefix)/Control in PICO Mode + * + * written: 1996-05-16 + * latest update: 1999-05-01 10:39:30 + * + */ + +/* 0. normale Zeichen; keine Prefix-Codes - - - - - - - - - - - - - - - - - */ +/* 00 */ xx, /* Char 0x00: Funktionstasten-PFX bei PC */ +/* 01 */ ned_jmp_boln, /* ^A: * move to the beginning of the line */ +/* 02 */ ned_cursor_left, /* ^B: * move backward a character */ +/* 03 */ xx, /* ^C: */ +/* 04 */ ned_del_char_right, /* ^D: * delete character at cursor pos. */ +/* 05 */ ned_jmp_eoln, /* ^E: * move to the end of the line */ +/* 06 */ ned_cursor_right, /* ^F: * forward a character */ +/* 07 */ pico_help, /* ^G: * Get Help */ +/* 08 */ ned_del_char_left, /* DEL ^H: * ein Zeichen links loeschen */ +/* 09 */ tabulate, /* TAB ^I: * Tabulator */ +#ifdef MSDOS +/* 0A */ p_ax_lng, /* ^J: Ans Zeilenanfang/Zeilenende */ +#else +/* 0A */ p_nl, /* ^J: Leerzeile und naechste Zeile */ +#endif +/* 0B */ ned_delete_line, /* ^K: */ +/* 0C */ p_refresh, /* ^L: * refresh the display */ +/* 0D */ p_nl, /* ^M: Leerzeile und naechste Zeile */ +/* 0E */ ned_cursor_down,/* ^N: * move to the next line */ +/* 0F */ ned_rename_and_save, /* ^O: * write out */ + +/* 10 */ ned_cursor_up, /* ^P: * move to the previous line */ +/* 11 */ p_ctrlq, /* ^Q: Subprozessor ^Q: ned0001q.c */ +/* 12 */ ned_blk_read, /* ^R: * Read File */ +/* 13 */ xx, /* ^S: */ +/* 14 */ xx, /* ^T: */ +/* 15 */ ned_buffer_copy,/* ^U: */ +/* 16 */ ned_page_down, /* ^V: * Page Down */ +/* 17 */ pico_find, /* ^W: * Where Is (find) */ +/* 18 */ ned_pico_exit, /* ^X: * Exit */ +/* 19 */ ned_page_up, /* ^Y: * Page Up */ +/* 1A */ p_replace, /* ^Z: find/replace (from WordStar mode) */ +/* 1B */ vi_on, /* ESC see: ned0001v.c */ +/* 1C */ ned_cursor_right, /* CURSOR Cursor nach rechts */ +/* 1D */ ned_cursor_left, /* CURSOR Cursor nach links */ +/* 1E */ ned_cursor_up, /* CURSOR Cursor eine Zeile hinauf */ +/* 1F */ ned_cursor_down /* CURSOR Cursor eine Zeile hinunter */ diff --git a/app/ned/00/ned0016v.c b/app/ned/00/ned0016v.c new file mode 100644 index 0000000000000000000000000000000000000000..9f53072e845950eb7f56eb269784d583650f80bd --- /dev/null +++ b/app/ned/00/ned0016v.c @@ -0,0 +1,46 @@ +/* + * FILE %ned/00/ned0016v.c + * + * Sprungtabelle fuer Editor ned.c + * Praefix-Gruppe a (kein Praefix)/Control in real VI Mode + * + * written: 1996-12-03 + * latest update: 1997-08-03 9:50:35 + * $Id: ned0016v.c,v 1.2 2002/10/18 05:56:19 gonter Exp $ + * + */ + +/* 0. normale Zeichen; keine Prefix-Codes - - - - - - - - - - - - - - - - - */ +/* 00 */ xx, /* Char 0x00: Funktionstasten-PFX bei PC */ +/* 01 */ p_ctrlu, /* ^A: command_table_U UNUSED IN VI */ +/* 02 */ ned_page_up, /* ^B: page up UNUSED IN VI */ +/* 03 */ xx, /* ^C: UNUSED IN VI */ +/* 04 */ ned_half_page_down, /* ^D: (half) page down UNUSED IN VI */ +/* 05 */ p_upscr, /* ^E: */ +/* 06 */ ned_page_down, /* ^F: page down UNUSED IN VI */ +/* 07 */ xx, /* ^G: */ +/* 08 */ ned_del_char_left, /* DEL ^H: ein Zeichen links loeschen */ +/* 09 */ tabulate, /* TAB ^I: Tabulator */ +/* 0A */ p_nl, /* ^J: Leerzeile und naechste Zeile */ +/* 0B */ p_ctrlk, /* ^K: command_table_K; UNUSED IN VI !!! */ +/* 0C */ p_refresh, /* ^L: redraw current window */ +/* 0D */ p_nl, /* ^M: Leerzeile und naechste Zeile */ +/* 0E */ p_nl2, /* ^N: Leerzeile */ +/* 0F */ p_ctrlo, /* ^O: Subprozessor ^O: ned0001o.c */ + +/* 10 */ ned_cursor_up, /* ^P: */ +/* 11 */ p_ctrlq, /* ^Q: commant_table_Q: UNUSED IN VI !!! */ +/* 12 */ p_refresh, /* ^R: */ +/* 13 */ xx, /* ^S UNUSED IN VI */ +/* 14 */ xx, /* ^T: UNUSED IN VI */ +/* 15 */ ned_half_page_up, /* ^U: (half) page up UNUSED IN VI */ +/* 16 */ ned_ctrlp, /* ^V: quote next char UNUSED IN VI */ +/* 17 */ vi_dkey, /* ^W: VIM extensions UNUSED IN VI !!! */ +/* 18 */ p_ctrlu, /* ^X: UNUSED IN VI */ +/* 19 */ p_dnscr, /* ^Y: */ +/* 1A */ xx, /* ^Z: Eingabe von speziellen Tasten */ +/* 1B */ vi_on, /* ESC see: ned0001v.c */ +/* 1C */ xx, /* CURSOR Cursor nach rechts */ +/* 1D */ q_eval_tag, /* CURSOR Cursor nach links */ +/* 1E */ xx, /* CURSOR Cursor eine Zeile hinauf */ +/* 1F */ xx, /* CURSOR Cursor eine Zeile hinunter */ diff --git a/app/ned/00/ned0016w.c b/app/ned/00/ned0016w.c new file mode 100644 index 0000000000000000000000000000000000000000..007d72ebc8f72bf88116dd693d0add59f9f8957e --- /dev/null +++ b/app/ned/00/ned0016w.c @@ -0,0 +1,57 @@ +/* + * FILE %ned/00/ned0016w.c + * + * Sprungtabelle fuer Editor ned.c + * Praefix-Gruppe a (kein Praefix)/Control in WordStar Mode + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * 1991 02 07: Revision + * 1991 06 01: Revision; Aenderung des Table Layouts + * 1992 01 16: Aufteilung in include Files fuer + * jede Praefix-Gruppe + * 1996-05-16: isolated from ned0001a.c + * latest update: 1999-05-01 10:39:56 + * $ID: $ + * + */ + +/* 0. normale Zeichen; keine Prefix-Codes - - - - - - - - - - - - - - - - - */ +/* 00 */ xx, /* Char 0x00: Funktionstasten-PFX bei PC */ +/* 01 */ p_word_left, /* ^A: Wort nach links */ +/* 02 */ vi_ex, /* ^B: EX Mode */ +/* 03 */ ned_page_down, /* ^C: Seite hinunter */ +/* 04 */ ned_cursor_right, /* ^D: Cursor nach rechts */ +/* 05 */ ned_cursor_up, /* ^E: Cursor hinauf */ +/* 06 */ p_word_right_beg, /* ^F: Wort nach rechts */ +/* 07 */ ned_del_char_right,/* ^G: ein Zeichen rechts loeschen */ +/* 08 */ ned_del_char_left, /* DEL ^H: ein Zeichen links loeschen */ +/* 09 */ tabulate, /* TAB ^I: Tabulator */ +#ifdef MSDOS +/* 0A */ p_ax_lng, /* ^J: Ans Zeilenanfang/Zeilenende */ +#else +/* 0A */ p_nl, /* ^J: Leerzeile und naechste Zeile */ +#endif +/* 0B */ p_ctrlk, /* ^K: Subprozessor ^K: ned0001k.c */ +/* 0C */ p_fr_next, /* ^L: weiter suchen / ersetzen */ +/* 0D */ p_nl, /* ^M: Leerzeile und naechste Zeile */ +/* 0E */ p_nl2, /* ^N: Leerzeile */ +/* 0F */ p_ctrlo, /* ^O: Subprozessor ^O: ned0001o.c */ + +/* 10 */ ned_ctrlp, /* ^P: Eingabe von speziellen Tasten */ +/* 11 */ p_ctrlq, /* ^Q: Subprozessor ^Q: ned0001q.c */ +/* 12 */ ned_page_up, /* ^R: Eine Seite hinauf */ +/* 13 */ ned_cursor_left, /* ^S: Cursor nach links */ +/* 14 */ p_turn_line, /* ^T: Turn Line: 2 Zeilen vertausch */ +/* 15 */ p_ctrlu, /* ^U: Subprocessor ^U: ned0001u.c */ +/* 16 */ p_ovins, /* ^V: Toggle Insert/Overwrite */ +/* 17 */ p_upscr, /* ^W: Eine Zeile hinauf scrollen */ +/* 18 */ ned_cursor_down, /* ^X: Cursor eine Zeile hinunter */ +/* 19 */ ned_delete_line, /* ^Y: Eine Zeile loeschen */ +/* 1A */ p_dnscr, /* ^Z: Eine Zeile hinunter scrollen */ +/* 1B */ vi_on, /* ESC see: ned0001v.c */ +/* 1C */ ned_cursor_right, /* CURSOR Cursor nach rechts */ +/* 1D */ ned_cursor_left, /* CURSOR Cursor nach links */ +/* 1E */ ned_cursor_up, /* CURSOR Cursor eine Zeile hinauf */ +/* 1F */ ned_cursor_down /* CURSOR Cursor eine Zeile hinunter */ diff --git a/app/ned/00/ned0031.c b/app/ned/00/ned0031.c new file mode 100644 index 0000000000000000000000000000000000000000..cf4059aa4ea94d64aeca11961c310a0a2ce98f79 --- /dev/null +++ b/app/ned/00/ned0031.c @@ -0,0 +1,64 @@ +/* + * FILE ~/usr/ned/00/ned0031c + * + * Sprungtabelle fuer Editor ned.c + * bzw. ned[0-7].c + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * 1991 02 07: Revision + * 1991 06 01: Revision; Aenderung des Table Layouts + * 1993-08-01: include table for vi mode + * 1994-10-16: cloned from ned0001.c + * latest update: 1995-04-30 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifndef MSDOS +#ifndef cdecl +#define cdecl +#endif +#endif + +#include "ed.h" + +#include "ned0009.c" /* Deklaration der primitiven Funktionen */ + +static int cdecl xx (void); +static int xx () { return 0; } /* Dummyfunktion */ + +#ifdef MSDOS +#define TBL_SIZE 0x0480 +#define DOSPRIM(x) (x) /* use dummy primitive */ +#else +#define TBL_SIZE 0x0400 +#define DOSPRIM(x) (xx) /* use dummy primitive */ +#endif + +/* ------------------------------------------------------------------------ */ +int (*P_TBL [TBL_SIZE]) () = +{ +#include "ned0031a.c" /* * prefix group a: no prefix */ +, +#include "ned0001x.c" /* * prefix group q: ^Q */ +, +#include "ned0001x.c" /* * prefix group k: ^K */ +, +#include "ned0001x.c" /* * prefix group o: ^O */ +, +#include "ned0001x.c" /* * prefix group u: ^U */ +, +#include "ned0031v.c" /* * vi command table */ +#ifdef MSDOS +, +#include "ned0031f.c" /* * prefix group f: function keys */ +#else +, +#include "ned0001x.c" /* * prefix group x: dummy group */ +#endif +} ; diff --git a/app/ned/00/ned0031a.c b/app/ned/00/ned0031a.c new file mode 100644 index 0000000000000000000000000000000000000000..9f721d7aa9e5971e13aebde53c57bd13a8d0407a --- /dev/null +++ b/app/ned/00/ned0031a.c @@ -0,0 +1,82 @@ +/* + * FILE ~/usr/ned/00/ned0001a.c + * + * Sprungtabelle fuer Editor ned.c + * Praefix-Gruppe a (kein Praefix) + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * 1991 02 07: Revision + * 1991 06 01: Revision; Aenderung des Table Layouts + * 1992 01 16: Aufteilung in include Files fuer + * jede Praefix-Gruppe + * latest update: 2001-02-11 12:43:53 + * $Id: ned0031a.c,v 1.2 2001/02/12 00:03:16 gonter Exp $ + * + */ + +/* 0. normale Zeichen; keine Prefix-Codes - - - - - - - - - - - - - - - - - */ +/* 00 */ xx, /* Char 0x00: Funktionstasten-PFX bei PC */ +/* 01 */ p_word_left, /* ^A: Wort nach links */ +/* 02 */ xx, /* ^B */ +/* 03 */ ned_page_down, /* ^C: Seite hinunter */ +/* 04 */ ned_cursor_right, /* ^D: Cursor nach rechts */ +/* 05 */ ned_cursor_up, /* ^E: Cursor hinauf */ +/* 06 */ p_word_right_beg, /* ^F: Wort nach rechts */ +/* 07 */ xx, /* ^G: ein Zeichen rechts loeschen */ +/* 08 */ xx, /* DEL ^H: ein Zeichen links loeschen */ +/* 09 */ xx, /* TAB ^I: Tabulator */ +/* 0A */ p_ax_lng, /* ^J: Ans Zeilenanfang/Zeilenende */ +/* 0B */ xx, /* ^K: Subprozessor ^K */ +/* 0C */ p_fr_next, /* ^L: weiter suchen / ersetzen */ +/* 0D */ ned_eval_feature, /* ^M: Leerzeile und naechste Zeile */ +/* 0E */ xx, /* ^N: Leerzeile */ +/* 0F */ xx, /* ^O: Subprozessor ^O */ + +/* 10 */ xx, /* ^P: Eingabe von speziellen Tasten */ +/* 11 */ xx, /* ^Q: Subprozessor ^Q */ +/* 12 */ ned_page_up, /* ^R: Eine Seite hinauf */ +/* 13 */ ned_cursor_left, /* ^S: Cursor nach links */ +/* 14 */ xx, /* ^T: Turn Line: 2 Zeilen vertausch */ +/* 15 */ xx, /* ^U: */ +/* 16 */ xx, /* ^V: */ +/* 17 */ p_upscr, /* ^W: Eine Zeile hinauf scrollen */ +/* 18 */ ned_cursor_down,/* ^X: Cursor eine Zeile hinunter */ +/* 19 */ xx, /* ^Y: */ +/* 1A */ p_dnscr, /* ^Z: Eine Zeile hinunter scrollen */ +/* 1B */ vi_on, /* ESC */ +/* 1C */ ned_cursor_right, /* CURSOR Cursor nach rechts */ +/* 1D */ ned_cursor_left, /* CURSOR Cursor nach links */ +/* 1E */ ned_cursor_up, /* CURSOR Cursor eine Zeile hinauf */ +/* 1F */ ned_cursor_down,/* CURSOR Cursor eine Zeile hinunter */ + +/* 20 */ ned_cursor_right, xx, xx, xx, xx, xx, xx, xx, +/* 28 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 30 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 38 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 40 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 48 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 50 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 58 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 60 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 68 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 70 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 78 */ xx, xx, xx, xx, xx, xx, xx, xx, + +/* 80 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 88 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 90 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* 98 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* A0 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* A8 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* B0 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* B8 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* C0 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* C8 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* D0 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* D8 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* E0 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* E8 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* F0 */ xx, xx, xx, xx, xx, xx, xx, xx, +/* F8 */ xx, xx, xx, xx, xx, xx, xx, xx diff --git a/app/ned/00/ned0031f.c b/app/ned/00/ned0031f.c new file mode 100644 index 0000000000000000000000000000000000000000..6d19b0d37102562bfab1251674a7d9a6058e8ded --- /dev/null +++ b/app/ned/00/ned0031f.c @@ -0,0 +1,291 @@ +/* + * FILE %ned/00/ned0031f.c + * + * jump table for editor NED: + * group f: IBM-PC function keys + * + * written: 1987 03 21 + * 1988 ?? ??: Kommando System (fuer Setup) + * 1989 04 23: Maus Menu System + * 1991 02 07: Revision + * 1991 06 01: Revision; Aenderung des Table Layouts + * 1992 01 16: Aufteilung in include Files fuer jede + * Praefix-Gruppe + * 1994-10-16: cloned from ned0001f.c + * latest update: 2001-02-11 12:44:08 + * $Id: ned0031f.c,v 1.2 2001/02/12 00:03:16 gonter Exp $ + * + */ + +/* 4. Praefix: Funktionstasten der IBM Tastatur - - - - - - - - - - - - - - */ +/* 00 */ xx, /* */ +/* 01 */ xx, /* ALT-ESC */ +/* 02 */ xx, /* */ +/* 03 */ xx, /* */ +/* 04 */ xx, /* */ +/* 05 */ xx, /* */ +/* 06 */ xx, /* */ +/* 07 */ xx, /* */ +/* 08 */ xx, /* */ +/* 09 */ xx, /* */ +/* 0A */ xx, /* */ +/* 0B */ xx, /* */ +/* 0C */ xx, /* */ +/* 0D */ xx, /* */ +/* 0E */ xx, /* */ +/* 0F */ xx, /* Shift-TAB: set mark tag */ + +/* 10 */ ned_jmp_marker_1, /* ALT-Q: */ +/* 11 */ p_link_feature, /* ALT-W: Feature Window oeffnen */ +/* 12 */ xx, /* ALT-E: Setup File editieren */ +/* 13 */ p_rdsetup, /* ALT-R: Setup File einlesen */ +/* 14 */ p_window_menu, /* ALT-T: Window Menu */ +/* 15 */ xx, /* ALT-Y: Delete Word Right */ +/* 16 */ xx, /* ALT-U: -> UNIX Line End */ +/* 17 */ xx, /* ALT-I: -> MSDOS Line End */ +/* 18 */ ned_memorize_location, /* ALT-O: store frame or file */ +/* 19 */ p_feature_prev, /* ALT-P: Jump 2 Prev Feature */ +/* 1A */ p_find_higher_bracket, /* ALT-[ */ +/* 1B */ p_find_lower_bracket, /* ALT-] */ +/* 1C */ xx, /* */ +/* 1D */ xx, /* */ +/* 1E */ ned_show_author, /* ALT-A: Author ausgeben */ +/* 1F */ xx, /* ALT-S: */ + +/* 20 */ p_mac_define, /* ALT-D: Define Makro */ +/* 21 */ xx, /* ALT-F: Feature setzen */ +/* 22 */ xx, /* ALT-G: Feature loeschen */ +/* 23 */ ned_set_hyx_l, /* ALT-H: hyx.l setzen */ +/* 24 */ xx, /* ALT-J: SGML Tag setzen */ +/* 25 */ xx, /* ALT-K: SGML Entity setzen */ +/* 26 */ DOSPRIM(p_switch_line_mode), /* ALT-L: lines ... */ +/* 27 */ xx, /* ALT-; */ +/* 28 */ xx, /* ALT-' */ +/* 29 */ xx, /* ALT-(backquote) */ +/* 2A */ xx, /* */ +/* 2B */ p_find_matching_bracket,/*ALT-\ */ +/* 2C */ xx, /* ALT-Z: NULL Character eingeben */ +/* 2D */ ned_eval_feature, /* ALT-X: Ausfuehrung eines Features */ +/* 2E */ p_cross_ref, /* ALT-C: Cross Referencing */ +/* 2F */ xx, /* ALT-V: Ausfuehrung eines Blocks */ + +/* 30 */ xx, /* ALT-B: */ +/* 31 */ p_feature_next, /* ALT-N: Jump 2 Next Feature */ +/* 32 */ p_menue, /* ALT-M: Menue aktivieren */ +/* 33 */ xx, /* ALT-, */ +/* 34 */ xx, /* ALT-. */ +/* 35 */ xx, /* ALT-/ */ +/* 36 */ xx, /* */ +/* 37 */ xx, /* ALT-NKP-* */ +/* 38 */ xx, /* */ +/* 39 */ xx, /* */ +/* 3A */ xx, /* */ +/* 3B */ p_macro01, /* F1: Makro 01 */ +/* 3C */ p_macro02, /* F2 */ +/* 3D */ p_macro03, /* F3 */ +/* 3E */ p_macro04, /* F4 */ +/* 3F */ p_refresh, /* F5 */ + +/* 40 */ p_macro06, /* F6 */ +/* 41 */ xx, /* F7: save and exit */ +/* 42 */ p_ssave, /* F8: Save actual Window if Update, Close */ +/* 43 */ p_activate_fr_root, /* F9: root frame in local cluster */ +/* 44 */ p_activate_cl1, /* F10: special cluster 1 (help) */ +/* 45 */ xx, /* */ +/* 46 */ xx, /* */ +/* 47 */ ned_jmp_boln, /* HOME: Anfang der Zeile */ +/* 48 */ ned_cursor_up, /* CURSOR UP */ +/* 49 */ ned_page_up, /* PAGE UP */ +/* 4A */ xx, /* ALT-NKP-- */ +/* 4B */ ned_cursor_left, /* CURSOR LEFT */ +/* 4C */ xx, /* */ +/* 4D */ ned_cursor_right, /* CURSOR RIGHT */ +/* 4E */ xx, /* ALT-NKP-+ */ +/* 4F */ ned_jmp_eoln, /* END: Ende der Zeile */ + +/* 50 */ ned_cursor_down, /* CURSOR DOWN */ +/* 51 */ ned_page_down, /* PAGE DOWN */ +/* 52 */ xx, /* INSERT */ +/* 53 */ xx, /* DELETE */ +/* 54 */ p_macro11, /* SF1 */ +/* 55 */ p_macro12, /* SF2 */ +/* 56 */ p_macro13, /* SF3 */ +/* 57 */ p_macro14, /* SF4 */ +/* 58 */ p_refresh_all, /* SF5 */ +/* 59 */ p_macro16, /* SF6 */ +/* 5A */ p_macro17, /* SF7 */ +/* 5B */ p_macro18, /* SF8 */ +/* 5C */ p_activate_fr_notes, /* SF9: notes frame in local cluster */ +/* 5D */ p_activate_cl2, /* SF10: special cluster 2 (notes) */ +/* 5E */ p_macro21, /* CF1 */ +/* 5F */ p_macro22, /* CF2 */ + +/* 60 */ p_macro23, /* CF3 */ +/* 61 */ p_macro24, /* CF4 */ +/* 62 */ p_colornxt, /* CF5 */ +/* 63 */ p_macro26, /* CF6 */ +/* 64 */ p_macro27, /* CF7 */ +/* 65 */ p_macro28, /* CF8 */ +/* 66 */ p_activate_fr_help, /* CF9: help frame in local cluster */ +/* 67 */ p_activate_cl3, /* CF10: special cluster 3 */ +/* 68 */ p_macro31, /* AF1 */ +/* 69 */ p_macro32, /* AF2 */ +/* 6A */ p_macro33, /* AF3 */ +/* 6B */ p_macro34, /* AF4 */ +/* 6C */ p_backcolnxt, /* AF5 */ +/* 6D */ p_macro36, /* AF6 */ +/* 6E */ p_macro37, /* AF7 */ +/* 6F */ p_macro38, /* AF8 */ + +/* 70 */ ned_p_activate_cl_fr, /* AF9: prompt for cluster and frame */ +/* 71 */ p_activate_cl4, /* AF10: special cluster 4 */ +/* 72 */ xx, /* Ctrl-PrtScr */ +/* 73 */ p_word_left, /* Ctrl-Left */ +/* 74 */ p_word_right_beg, /* Ctrl-Right */ +/* 75 */ xx, /* Ctrl-End */ +/* 76 */ pq_dn, /* Ctrl-PgDn */ +/* 77 */ xx, /* Ctrl-Home */ +/* 78 */ p_macro41, /* ALT-1: */ +/* 79 */ p_macro42, /* ALT-2: */ +/* 7A */ p_macro43, /* ALT-3: */ +/* 7B */ p_macro44, /* ALT-4: */ +/* 7C */ p_macro45, /* ALT-5: */ +/* 7D */ p_macro46, /* ALT-6: */ +/* 7E */ p_macro47, /* ALT-7: */ +/* 7F */ p_macro48, /* ALT-8: */ + +/* 80 */ p_macro49, /* ALT-9: */ +/* 81 */ p_macro40, /* ALT-0: */ +/* 82 */ xx, /* ALT--: Character 196, 0xC4 */ +/* 83 */ xx, /* ALT-=: Character 205, 0xCD */ +/* 84 */ pq_up, /* Ctrl-PgUp */ +/* 85 */ xx, /* F11 */ +/* 86 */ xx, /* F12 */ +/* 87 */ xx, /* SF11 */ +/* 88 */ xx, /* SF12 */ +/* 89 */ xx, /* CF11 */ +/* 8A */ xx, /* CF12 */ +/* 8B */ xx, /* AF11 */ +/* 8C */ xx, /* AF12 */ +/* 8D */ xx, /* CTRL-CURSOR-UP */ +/* 8E */ xx, /* */ +/* 8F */ xx, /* */ + +/* 90 */ xx, /* */ +/* 91 */ xx, /* CTRL-CURSOR-DOWN */ +/* 92 */ xx, /* CTRL-Insert */ +/* 93 */ xx, /* CTRL-Delete */ +/* 94 */ xx, /* CTRL-TAB */ +/* 95 */ xx, /* */ +/* 96 */ xx, /* */ +/* 97 */ p_logic_link_up, /* ALT-HOME */ +/* 98 */ ned_page_up, /* ALT-CURSOR-UP */ +/* 99 */ p_logic_link_prev, /* ALT-PGUP */ +/* 9A */ xx, /* */ +/* 9B */ ned_jmp_boln, /* ALT-CURSOR-LEFT */ +/* 9C */ xx, /* */ +/* 9D */ ned_jmp_eoln, /* ALT-CURSOR-RIGHT */ +/* 9E */ xx, /* */ +/* 9F */ p_logic_link_menu, /* ALT-END */ + +/* A0 */ ned_page_down, /* ALT-CURSOR-DOWN */ +/* A1 */ p_logic_link_next, /* ALT-PGDN */ +/* A2 */ xx, /* ALT-INS */ +/* A3 */ xx, /* ALT-DEL */ +/* A4 */ xx, /* ALT-NKP-/ */ +/* A5 */ xx, /* ALT-TAB: set tag after name lookup */ +/* A6 */ xx, /* ALT-NKP-ENTER */ +/* A7 */ xx, /* */ +/* A8 */ xx, /* */ +/* A9 */ xx, /* */ +/* AA */ xx, /* */ +/* AB */ xx, /* */ +/* AC */ xx, /* */ +/* AD */ xx, /* */ +/* AE */ xx, /* */ +/* AF */ xx, /* */ + +/* B0 */ xx, /* */ +/* B1 */ xx, /* */ +/* B2 */ xx, /* */ +/* B3 */ xx, /* */ +/* B4 */ xx, /* */ +/* B5 */ xx, /* */ +/* B6 */ xx, /* */ +/* B7 */ xx, /* */ +/* B8 */ xx, /* */ +/* B9 */ xx, /* */ +/* BA */ xx, /* */ +/* BB */ xx, /* */ +/* BC */ xx, /* */ +/* BD */ xx, /* */ +/* BE */ xx, /* */ +/* BF */ xx, /* */ + +/* C0 */ xx, /* */ +/* C1 */ xx, /* */ +/* C2 */ xx, /* */ +/* C3 */ xx, /* */ +/* C4 */ xx, /* */ +/* C5 */ xx, /* */ +/* C6 */ xx, /* */ +/* C7 */ xx, /* */ +/* C8 */ xx, /* */ +/* C9 */ xx, /* */ +/* CA */ xx, /* */ +/* CB */ xx, /* */ +/* CC */ xx, /* */ +/* CD */ xx, /* */ +/* CE */ xx, /* */ +/* CF */ xx, /* */ + +/* D0 */ xx, /* */ +/* D1 */ xx, /* */ +/* D2 */ xx, /* */ +/* D3 */ xx, /* */ +/* D4 */ xx, /* */ +/* D5 */ xx, /* */ +/* D6 */ xx, /* */ +/* D7 */ xx, /* */ +/* D8 */ xx, /* */ +/* D9 */ xx, /* */ +/* DA */ xx, /* */ +/* DB */ xx, /* */ +/* DC */ xx, /* */ +/* DD */ xx, /* */ +/* DE */ xx, /* */ +/* DF */ xx, /* */ + +/* E0 */ xx, /* */ +/* E1 */ xx, /* */ +/* E2 */ xx, /* */ +/* E3 */ xx, /* */ +/* E4 */ xx, /* */ +/* E5 */ xx, /* */ +/* E6 */ xx, /* */ +/* E7 */ xx, /* */ +/* E8 */ xx, /* */ +/* E9 */ xx, /* */ +/* EA */ xx, /* */ +/* EB */ xx, /* */ +/* EC */ xx, /* */ +/* ED */ xx, /* */ +/* EE */ xx, /* */ +/* EF */ xx, /* */ + +/* F0 */ xx, /* */ +/* F1 */ xx, /* */ +/* F2 */ xx, /* */ +/* F3 */ xx, /* */ +/* F4 */ xx, /* */ +/* F5 */ xx, /* */ +/* F6 */ xx, /* */ +/* F7 */ xx, /* */ +/* F8 */ xx, /* */ +/* F9 */ xx, /* */ +/* FA */ xx, /* */ +/* FB */ xx, /* */ +/* FC */ xx, /* */ +/* FD */ xx, /* */ +/* FE */ xx, /* */ +/* FF */ xx /* */ diff --git a/app/ned/00/ned0031v.c b/app/ned/00/ned0031v.c new file mode 100644 index 0000000000000000000000000000000000000000..72e2e83b1fc11371a25c0c70988491b189cfd125 --- /dev/null +++ b/app/ned/00/ned0031v.c @@ -0,0 +1,147 @@ +/* + * FILE %ned/00/ned0031v.c + * + * jumptable for editor NED: vi jump table + * + * written: 1993-07-31 + * 1994-10-16: cloned from ned0001v.c + * latest update: 1997-08-03 9:41:49 + * + */ + +/* vi jump table - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* 00 */ xx, /* */ +/* 01 */ xx, /* ^A: */ +/* 02 */ ned_page_up, /* ^B: page up */ +/* 03 */ xx, /* ^C: */ +/* 04 */ ned_half_page_down, /* ^D: (half) page down */ +/* 05 */ p_upscr, /* ^E: */ +/* 06 */ ned_page_down, /* ^F: page down */ +/* 07 */ xx, /* ^G: */ +/* 08 */ ned_cursor_left, /* ^H: cursor left */ +/* 09 */ xx, /* ^I: */ +/* 0A */ ned_cursor_down, /* ^J: */ +/* 0B */ xx, /* ^K: */ +/* 0C */ p_refresh, /* ^L: redraw current window */ +/* 0D */ ned_cursor_down, /* ^M: cursor down */ +/* 0E */ xx, /* ^N: */ +/* 0F */ xx, /* ^O: */ + +/* 10 */ ned_cursor_up, /* ^P: */ +/* 11 */ xx, /* ^Q */ +/* 12 */ p_refresh, /* ^R: */ +/* 13 */ xx, /* ^S */ +/* 14 */ xx, /* ^T: */ +/* 15 */ ned_half_page_up, /* ^U: (half) page up */ +/* 16 */ xx, /* ^V: */ +/* 17 */ xx, /* ^W: */ +/* 18 */ xx, /* ^X: */ +/* 19 */ p_dnscr, /* ^Y: */ +/* 1A */ xx, /* ^Z: */ +/* 1B */ vi_bell, /* ESC: */ +/* 1C */ xx, /* ^ */ +/* 1D */ xx, /* ^ */ +/* 1E */ xx, /* ^ */ +/* 1F */ xx, /* ^ */ + +/* 20 */ ned_cursor_right, /* SPACE: cursor right */ +/* 21 */ xx, /* */ +/* 22 */ xx, /* */ +/* 23 */ xx, /* */ +/* 24 */ ned_jmp_eoln, /* $: to end of line */ +/* 25 */ p_find_matching_bracket,/*%: */ +/* 26 */ xx, /* */ +/* 27 */ xx, /* */ +/* 28 */ xx, /* */ +/* 29 */ xx, /* */ +/* 2A */ xx, /* * */ +/* 2B */ ned_cursor_down, /* + */ +/* 2C */ xx, /* */ +/* 2D */ ned_cursor_up, /* - */ +/* 2E */ xx /* vi_repeat_last_command */, /* .: repeat last command */ +/* 2F */ p_find, /* /: find something */ + +/* 30 */ xx, /* 0: */ +/* 31 */ xx, /* 1 */ +/* 32 */ xx, /* 2 */ +/* 33 */ xx, /* 3 */ +/* 34 */ xx, /* 4 */ +/* 35 */ xx, /* 5 */ +/* 36 */ xx, /* 6 */ +/* 37 */ xx, /* 7 */ +/* 38 */ xx, /* 8 */ +/* 39 */ xx, /* 9 */ +/* 3A */ xx /* vi_ex */, /* :: ex command line mode */ +/* 3B */ xx, /* */ +/* 3C */ xx, /* */ +/* 3D */ xx, /* = */ +/* 3E */ xx, /* */ +/* 3F */ xx, /* */ + +/* 40 */ xx, /* */ +/* 41 */ xx, /* A: */ +/* 42 */ p_word_left, /* B: wie W und b */ +/* 43 */ xx, /* C: */ +/* 44 */ xx, /* D: delete rest of line */ +/* 45 */ xx, /* E: */ +/* 46 */ xx, /* F: */ +/* 47 */ ned_pr_jump_to_line, /* G: goto specified line number */ +/* 48 */ xx, /* H: */ +/* 49 */ xx, /* I: */ +/* 4A */ xx, /* J: join line */ +/* 4B */ xx, /* K: */ +/* 4C */ xx, /* L: */ +/* 4D */ xx, /* M: */ +/* 4E */ xx, /* N: */ +/* 4F */ xx, /* O: */ + +/* 50 */ xx, /* P: */ +/* 51 */ xx, /* Q */ +/* 52 */ xx, /* R: overwrite mode */ +/* 53 */ xx, /* S */ +/* 54 */ xx, /* T: */ +/* 55 */ xx, /* U: */ +/* 56 */ xx, /* V: */ +/* 57 */ p_word_left, /* W: move curse left one word */ +/* 58 */ xx, /* X: delete character left */ +/* 59 */ xx, /* Y: */ +/* 5A */ vi_dkey, /* Z: */ +/* 5B */ xx, /* [: */ +/* 5C */ xx, /* \: */ +/* 5D */ xx, /* ]: */ +/* 5E */ ned_jmp_boln, /* ^: to begin of line */ +/* 5F */ xx, /* _ */ + +/* 60 */ xx, /* */ +/* 61 */ vi_append, /* a: */ +/* 62 */ p_word_left, /* b: word left */ +/* 63 */ xx, /* c: double: change word */ +/* 64 */ xx, /* d: double: delete line */ +/* 65 */ p_word_right_end, /* e: move cursor right to end of word */ +/* 66 */ xx, /* f: */ +/* 67 */ xx, /* g: */ +/* 68 */ ned_cursor_left, /* h: cursor left */ +/* 69 */ vi_ins, /* i: insert mode */ +/* 6A */ ned_cursor_down, /* j: cursor down */ +/* 6B */ ned_cursor_up, /* k: cursor up */ +/* 6C */ ned_cursor_right, /* l: cursor right */ +/* 6D */ xx, /* m: */ +/* 6E */ p_fr_next, /* n: find next item */ +/* 6F */ xx, /* o: */ + +/* 70 */ xx, /* p: put, here it is copy block */ +/* 71 */ xx, /* q */ +/* 72 */ xx, /* r: double: replace one character */ +/* 73 */ xx, /* s */ +/* 74 */ xx, /* t: */ +/* 75 */ xx, /* u: */ +/* 76 */ xx, /* v: */ +/* 77 */ p_word_right_beg, /* w: move cursor right to begin of word */ +/* 78 */ ned_del_char_right, /* x: delete character right */ +/* 79 */ xx, /* y: double key: yank */ +/* 7A */ xx, /* z: */ +/* 7B */ xx, /* */ +/* 7C */ xx, /* */ +/* 7D */ xx, /* */ +/* 7E */ xx, /* ~: toggle character cases */ +/* 7F */ xx /* */ diff --git a/app/ned/01/(dirinf).fm b/app/ned/01/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..a512a8d533ff0f1d24645998b0d46cbc63262dab --- /dev/null +++ b/app/ned/01/(dirinf).fm @@ -0,0 +1,79 @@ +# +# FILE %ned/01/(dirinf).fm +# +# latest update: 2000-08-24 14:22:23 +# $Id: (dirinf).fm,v 1.3 2001/02/12 00:03:19 gonter Exp $ +# +# ---------------------------------------------------------------------------- + +Makefile | current makefile +make-dos | MSDOS makefile + +ned0101.c | void wdw_rst (w) /* Window Default Values laden */ +ned0102.c | int ned_w_cursor_up (...) +ned0102m.c | int ned_vi_cursor_mid () +ned0102p.c | void ned_cursor_up () +ned0102v.c | int ned_vi_cursor_top () +ned0103.c | int ned_w_cursor_down () +ned0103p.c | void ned_cursor_down () +ned0103v.c | int ned_vi_cursor_bot () +ned0104.c | void chk_updown (w) + +ned0105.c | int ned_w_cursor_left (...) +ned0105a.c | int ned_q_cursor_left (struct WINDOWCTRL *w, int df) +ned0105p.c | void void ned_cursor_left () + +ned0106.c | void ned_w_cursor_right (...) +ned0106a.c | int ned_q_cursor_right (struct WINDOWCTRL *w, int df) +ned0106p.c | void void ned_cursor_right () + +ned0107.c | void p_word_left () { ned_wc_word_lr (JMPWRD_left_beg); } +ned0107b.c | void p_word_left_2 () { ned_wc_word_lr (JMPWRD_left_beg_2); } +ned0108a.c | void p_word_right_beg () { ned_wc_word_lr (JMPWRD_right_beg); } +ned0108b.c | void p_word_right_end () { ned_wc_word_lr (JMPWRD_right_end); } +ned0108c.c | void p_word_right_beg_2 () { ned_wc_word_lr (JMPWRD_right_beg_2); } +ned0108d.c | void p_word_right_end_2 () { ned_wc_word_lr (JMPWRD_right_end_2); } +ned0109.c | ned_wc_word_lr (mode) +ned0110.c | void ned_w_page_up (...) +ned0110a.c | void ned_page_up () +ned0110b.c | void ned_half_page_up () +ned0111.c | void ned_w_page_down () +ned0111a.c | void ned_page_down () +ned0111b.c | void ned_half_page_down () +ned0112.c | void p_ctrlq () { pfx = P_CTRLQ; } /* Submenues: Quick */ +ned0112w.c | void p_ctrlw () { pfx = P_NONE; } /* wordstart standard table */ +ned0113.c | void p_ctrlk () { pfx = P_CTRLK; } /* . Block & File */ +ned0114.c | void p_ctrlo () { pfx = P_CTRLO; } /* . On Screen */ +ned0115.c | void ned_ctrlp () +ned0115b.c | void ned_insert_special_char () +ned0116.c | void p_funct () { pfx = P_FUNCT; } /* Funktionstasten bei IBM-PC */ +ned0117.c | void p_nl2 () /* Ctrl N */ +ned0118.c | void p_nl () /* Ctrl M */ +ned0119.c | void p_ax_lng () /* CTRL-J: Spalte 0 oder letzte Spalte */ +ned0119a.c | int ned_w_jmp_in_line (...) +ned0120.c | void ned_jmp_boln () /* Spalte 0 */ +ned0121.c | void ned_jmp_eoln () /* letzte Spalte */ +ned0122.c | void p_ctrlg () +ned0123.c | void p_ctrlh () +ned0124.c | void background () +ned0124.c | void back2ground () /* Extended Status Line */ +ned0125c.c | CHAR: int show_ch_display_range (struct WINDOWCTRL *w) +ned0126.c | int q_isolate_word (char *wp, int max_lng, int mode); +ned0127.c | int qq_isolate_word (char *wp, int max_lng, int mode); +ned0128.c | void p_ctrlu () /* Screen and Window Operationen */ +ned0129.c | void p_split_join () +# +ned0131.c | struct LINE *alloc_line () +ned0132.c | struct TXT *txch_alloc (size, ch) +ned0133.c | struct TXT *tx_alloc (size) +ned0134.c | strfill (s, cnt, ch) +ned0135.c | struct WINDOWCTRL *wdw_alloc () +ned0136.c | struct FILECTRL *file_alloc () +ned0137.c | struct FEATURE *feature_alloc () +ned0138.c | void ned_lines_free (lp) /* Eine Liste von Zeilen freigeben */ +ned0138b.c | void ned_feature_free (f) /* Eine Liste von Features freigeben */ +ned0139.c | void txt_adj (lng, tp) /* Textsegmentliste auf aktuelle */ +ned0140.c | void tx_free (tp) /* Textsegmente NICHT rekursiv freigeben */ +ned0141.c | void file_free (struct FILECTRL *fc) +ned0142.c | int in_charset (int ch, int charset); +* | diff --git a/app/ned/01/Makefile b/app/ned/01/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..cbc86bf6624bcdbde3d9c5ff1cb903fdd5dd38f6 --- /dev/null +++ b/app/ned/01/Makefile @@ -0,0 +1,117 @@ +# +# FILE %ned/01/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# +# latest update: 2000-08-24 13:51:21 +# $Id: Makefile,v 1.5 2000/12/09 17:29:46 gonter Exp $ +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-c -g -I.. $(cf) +CC=cc +o= +objs= \ + ned0101.o ned0102m.o ned0102p.o ned0102v.o \ + ned0103p.o ned0103v.o ned0104.o ned0105p.o\ + ned0106p.o ned0107.o ned0107b.o \ + ned0108a.o ned0108b.o ned0108c.o \ + ned0108d.o ned0110.o ned0110a.o ned0110b.o \ + ned0111.o ned0111a.o ned0111b.o ned0112.o ned0112w.o \ + ned0113.o ned0114.o ned0115b.o ned0116.o \ + ned0117.o ned0118.o ned0119.o \ + ned0120.o ned0121.o ned0122.o ned0123.o \ + ned0126.o ned0127.o ned0128.o ned0129.o \ + ned0132.o ned0134.o ned0138.o ned0138b.o ned0139.o \ + ned0140.o ned0141.o ned0142.o +objs_tk= ned0102_tk.o ned0103_tk.o ned0105_tk.o ned0105a_tk.o \ + ned0106_tk.o ned0106a_tk.o \ + ned0109_tk.o ned0115_tk.o ned0119a_tk.o ned0124_tk.o ned0125c_tk.o +objs_cur= ned0102_cur.o ned0103_cur.o ned0105_cur.o ned0105a_cur.o \ + ned0106_cur.o ned0106a_cur.o \ + ned0109_cur.o ned0115_cur.o ned0119a_cur.o ned0124_cur.o ned0125c_cur.o +lib_tk= ../ned_tk.a +lib_cur= ../ned_cur.a + +all: lib_tk lib_cur +clean : + rm *.o lib_tk lib_cur + +lib_tk : $(objs_tk) $(objs) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h + $(CC) $(OPTS) $*.c + +# --- cur Modules ---------- +ned0102_cur.o : ../ed.h ned0102.c + $(CC) $(OPTS) -o ned0102_cur.o ned0102.c + +ned0103_cur.o : ../ed.h ned0103.c + $(CC) $(OPTS) -o ned0103_cur.o ned0103.c + +ned0105_cur.o : ../ed.h ned0105.c + $(CC) $(OPTS) -o ned0105_cur.o ned0105.c + +ned0105a_cur.o : ../ed.h ned0105a.c + $(CC) $(OPTS) -o ned0105a_cur.o ned0105a.c + +ned0106_cur.o : ../ed.h ned0106.c + $(CC) $(OPTS) -o ned0106_cur.o ned0106.c + +ned0106a_cur.o : ../ed.h ned0106a.c + $(CC) $(OPTS) -o ned0106a_cur.o ned0106a.c + +ned0109_cur.o : ../ed.h ned0109.c + $(CC) $(OPTS) -o ned0109_cur.o ned0109.c + +ned0115_cur.o : ../ed.h ned0115.c + $(CC) $(OPTS) -o ned0115_cur.o ned0115.c + +ned0119a_cur.o : ../ed.h ned0119a.c + $(CC) $(OPTS) -o ned0119a_cur.o ned0119a.c + +ned0124_cur.o : ../ed.h ned0124.c + $(CC) $(OPTS) -o ned0124_cur.o ned0124.c + +ned0125c_cur.o : ../ed.h ned0125c.c + $(CC) $(OPTS) -o ned0125c_cur.o ned0125c.c + +# --- tk Modules ---------- +ned0102_tk.o : ../ed.h ned0102.c + $(CC) $(OPTS) -DUSE_TK -o ned0102_tk.o ned0102.c + +ned0103_tk.o : ../ed.h ned0103.c + $(CC) $(OPTS) -DUSE_TK -o ned0103_tk.o ned0103.c + +ned0105_tk.o : ../ed.h ned0105.c + $(CC) $(OPTS) -DUSE_TK -o ned0105_tk.o ned0105.c + +ned0105a_tk.o : ../ed.h ned0105a.c + $(CC) $(OPTS) -DUSE_TK -o ned0105a_tk.o ned0105a.c + +ned0106_tk.o : ../ed.h ned0106.c + $(CC) $(OPTS) -DUSE_TK -o ned0106_tk.o ned0106.c + +ned0106a_tk.o : ../ed.h ned0106a.c + $(CC) $(OPTS) -DUSE_TK -o ned0106a_tk.o ned0106a.c + +ned0109_tk.o : ../ed.h ned0109.c + $(CC) $(OPTS) -DUSE_TK -o ned0109_tk.o ned0109.c + +ned0115_tk.o : ../ed.h ned0115.c + $(CC) $(OPTS) -DUSE_TK -o ned0115_tk.o ned0115.c + +ned0119a_tk.o : ../ed.h ned0119a.c + $(CC) $(OPTS) -DUSE_TK -o ned0119a_tk.o ned0119a.c + +ned0124_tk.o : ../ed.h ned0124.c + $(CC) $(OPTS) -DUSE_TK -o ned0124_tk.o ned0124.c + +ned0125c_tk.o : ../ed.h ned0125c.c + $(CC) $(OPTS) -DUSE_TK -o ned0125c_tk.o ned0125c.c diff --git a/app/ned/01/contrib b/app/ned/01/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/01/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/01/gg b/app/ned/01/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/01/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/01/lib_cur b/app/ned/01/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/01/lib_tk b/app/ned/01/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/01/make-dos b/app/ned/01/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..f81e6b466aa184df191df49705968d82c5a6380c --- /dev/null +++ b/app/ned/01/make-dos @@ -0,0 +1,34 @@ +# +# FILE %ned/01/makefile +# +# GG's Night(mare) Editor System +# +# latest update: 1997-08-28 10:44:21 +# +# ============================================================================ +cc=cl -Os -AL /c +ccc=cl -Os -AL /W3 /Fo$@ -I.. /c +obj=objdec -m0 -w -d -sl 2 NED01_TEXT $@ + +lib : ! + ned0101.obj ned0102.obj ned0102m.obj ned0102p.obj ned0102v.obj ! + ned0103.obj ned0103p.obj ned0103v.obj ned0104.obj ! + ned0105.obj ned0105a.obj ned0105p.obj ned0106.obj ned0106a.obj ! + ned0106p.obj ned0107.obj ned0107b.obj ! + ned0108a.obj ned0108b.obj ned0108c.obj ned0108d.obj ned0109.obj ! + ned0110.obj ned0110a.obj ned0110b.obj ! + ned0111.obj ned0111a.obj ned0111b.obj ! + ned0112w.obj ned0112.obj ! + ned0113.obj ned0114.obj ned0115.obj ned0115b.obj ned0116.obj ! + ned0117.obj ned0118.obj ned0119.obj ned0119a.obj ned0120.obj ! + ned0121.obj ned0122.obj ned0123.obj ned0124.obj ! + ned0125c.obj ned0126.obj ned0127.obj ned0128.obj ! + ned0129.obj ned0132.obj ned0134.obj ned0138.obj ned0138b.obj ! + ned0139.obj ned0140.obj ned0141.obj ned0142.obj + +lib_old : ned0135.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $*.c + $(obj) diff --git a/app/ned/01/ned0101.c b/app/ned/01/ned0101.c new file mode 100644 index 0000000000000000000000000000000000000000..c2f81bffadc093a3afec0dba396c790cddcf0ff1 --- /dev/null +++ b/app/ned/01/ned0101.c @@ -0,0 +1,62 @@ +/* + * FILE %ned/01/ned0101.c + * + * Window Control Block auf einen brauchbaren Wert setzen + * + * written: 1987 04 08 + * 1991 02 07: Revision + * latest update: 1997-08-03 16:37:21 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int akt_page; +extern int COL_TEXT; +extern int COL_BOX; +extern int word_wrap_count; +extern int default_edit_mode; +extern int default_tag_display_mode; + +/* Window Default Values laden -------------------------------------------- */ +void wdw_rst (register struct WINDOWCTRL *w) +{ + w->WC_act = (struct LINE *) 0; + w->WC_first = (struct LINE *) 0; + w->file_or_frame = (void *) 0; + w->ins_flg = INSFLG_insert; + w->w_upd = 1; + w->ai = 1; + w->wwc = word_wrap_count; + w->f_upd = 0; + w->file_type = FTY_PLAIN; + w->file_format = FMT_ASCII; + w->cx = w->ax; + w->cy = w->ay; + w->znr = 0; + w->tlines = 0; + w->hv = 0; + w->page = akt_page; + w->attr_text = COL_TEXT; + w->attr_box = COL_BOX; + w->box_type = BOX_TYPE_double; + w->wflags = 0; + w->WC_edit_mode = default_edit_mode; + w->bin_eoln = 0x0A; + w->bin_llng = LINE_LNG_TXT; + w->wc_ll_flags = 0; + + w->wc_tag_display_mode= default_tag_display_mode; + +#ifdef DEVEL1 + w->wc_new1 = 0; + w->wc_new2 = 0; + w->wc_new3 = 0; + w->wc_new4 = 0; +#endif +} diff --git a/app/ned/01/ned0102.c b/app/ned/01/ned0102.c new file mode 100644 index 0000000000000000000000000000000000000000..c17293b7ba0aa7aeb25196032a9eee87a6327d63 --- /dev/null +++ b/app/ned/01/ned0102.c @@ -0,0 +1,69 @@ +/* + * FILE %ned/01/ned0102.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1997-09-14 11:06:00 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int ned_vertical_scroll_count; + +/* ------------------------------------------------------------------------ */ +int ned_w_cursor_up ( +register struct WINDOWCTRL *w, +int num) +{ + register struct LINE *l; + int cnt= 0; + + for (; num > 0; num--) + { +#ifdef USE_TK + tk_resetcup (); /* T2D: specify correct window! */ +#endif + + if ((l= w->WC_act) == (struct LINE *) 0) break; + + if (l->prev == (struct LINE *) 0) + { + ned_show_display_range (w); + return 0; + } + + if (w->cy > w->ay) + { + w->cy--; + w->WC_act= l= l->prev; + } + else + { + if (ned_vertical_scroll_count <= 1) + { + w->WC_act= w->first= l= w->first->prev; + wd_dnscr (w); + } + else + { + ned_w_page_up (w, 0); + l= w->WC_act; + } + } + + w->znr--; + cnt++; + } + + chk_updown (w); + + return cnt; +} diff --git a/app/ned/01/ned0102m.c b/app/ned/01/ned0102m.c new file mode 100644 index 0000000000000000000000000000000000000000..3ca2098ab8b1d4e3aa144ccc53a500898f0af0c3 --- /dev/null +++ b/app/ned/01/ned0102m.c @@ -0,0 +1,35 @@ +/* + * FILE %ned/01/ned0102m.c + * + * move cursor to mid of screen + * + * written: 1997-01-05 + * latest update: 2001-02-11 11:56:31 + * $Id: ned0102m.c,v 1.2 2001/02/12 00:03:20 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_vi_cursor_mid () +{ + int where; + struct WINDOWCTRL *w; + + if ((w= aw) == (struct WINDOWCTRL *) 0) return; + + where= (w->by - w->ay) / 2 + w->ay - w->cy; + + if (where < 0) ned_w_cursor_up (w, -where); + if (where > 0) ned_w_cursor_down (w, where); + + vi_wc_jmp_boln (w); +} diff --git a/app/ned/01/ned0102p.c b/app/ned/01/ned0102p.c new file mode 100644 index 0000000000000000000000000000000000000000..1933a06ec2a69a5adde12611f7ddb739942dc249 --- /dev/null +++ b/app/ned/01/ned0102p.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/01/ned0102p.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1996-12-19 + * latest update: 1997-08-28 0:40:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int repeat; + +/* ------------------------------------------------------------------------ */ +void ned_cursor_up () +{ + ned_w_cursor_up (aw, REPEAT); +} diff --git a/app/ned/01/ned0102v.c b/app/ned/01/ned0102v.c new file mode 100644 index 0000000000000000000000000000000000000000..bdd75cdd48cfab573d2841d3d3345b0a2f0f2423 --- /dev/null +++ b/app/ned/01/ned0102v.c @@ -0,0 +1,37 @@ +/* + * FILE %ned/01/ned0102v.c + * + * move cursor to top of screen + * + * written: 1996-12-19 + * latest update: 2001-02-11 11:57:38 + * $Id: ned0102v.c,v 1.3 2001/02/12 00:03:20 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int repeat; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_vi_cursor_top () +{ + struct WINDOWCTRL *w; + int idx; + + if ((w= aw) == (struct WINDOWCTRL *) 0) return; + + idx= w->cy - w->ay - repeat; + if (idx < 0) + { + ned_w_cursor_down (w, -idx); /* BUG here: don't scroll! */ + } + else ned_w_cursor_up (w, idx); + vi_wc_jmp_boln (w); +} diff --git a/app/ned/01/ned0103.c b/app/ned/01/ned0103.c new file mode 100644 index 0000000000000000000000000000000000000000..fb9c3e497ff1d862391b6deb524b18f18953e257 --- /dev/null +++ b/app/ned/01/ned0103.c @@ -0,0 +1,70 @@ +/* + * FILE %ned/01/ned0103.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1987 04 08 + * 1991 01 31: Revision + * latest update: 1997-09-14 9:55:03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int ned_vertical_scroll_count; + +/* ------------------------------------------------------------------------ */ +int ned_w_cursor_down ( +register struct WINDOWCTRL *w, +int num) +{ + register struct LINE *l; + int cnt= 0; + + for (; num > 0; num--) + { +#ifdef USE_TK + tk_resetcup (); +#endif + + if ((l= w->WC_act) == (struct LINE *) 0) break; + + if (l->next == (struct LINE *) 0) + { + ned_show_display_range (w); + return 0; + } + + if (w->cy < w->by) + { + w->cy++; + w->WC_act= l= l->next; + } + else + { + if (ned_vertical_scroll_count <= 1) + { + w->WC_act= l= l->next; + w->first= w->first->next; + wd_upscr (w); + } + else + { + ned_w_page_down (w, 0); + l= w->WC_act; + } + } + + w->znr++; + cnt++; + } + + chk_updown (w); + + return cnt; +} diff --git a/app/ned/01/ned0103p.c b/app/ned/01/ned0103p.c new file mode 100644 index 0000000000000000000000000000000000000000..d2823e12fcfb5cf05f4abfa6b1539a2d877d929d --- /dev/null +++ b/app/ned/01/ned0103p.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/01/ned0103p.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1996-12-19 + * latest update: 1997-08-28 0:29:08 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int repeat; + +/* ------------------------------------------------------------------------ */ +void ned_cursor_down () +{ + ned_w_cursor_down (aw, REPEAT); +} diff --git a/app/ned/01/ned0103v.c b/app/ned/01/ned0103v.c new file mode 100644 index 0000000000000000000000000000000000000000..a8bd4c3ed5ea89c461ff608a78eb81a5dc305281 --- /dev/null +++ b/app/ned/01/ned0103v.c @@ -0,0 +1,38 @@ +/* + * FILE %ned/01/ned0103v.c + * + * move cursor to bottom of screen + * + * written: 1996-12-19 + * latest update: 2001-02-11 11:58:27 + * $Id: ned0103v.c,v 1.3 2001/02/12 00:03:20 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int repeat; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_vi_cursor_bot () +{ + struct WINDOWCTRL *w; + int idx; + + if ((w= aw) == (struct WINDOWCTRL *) 0) return; + + idx= w->cy - w->ay - repeat; + if (idx < 0) + { + ned_w_cursor_up (w, -idx); /* BUG here: don't scroll! */ + } + else ned_w_cursor_down (w, idx); + + vi_wc_jmp_boln (w); +} diff --git a/app/ned/01/ned0104.c b/app/ned/01/ned0104.c new file mode 100644 index 0000000000000000000000000000000000000000..fd50f1dcedff0db7bb62e9cf9af6bf7e10925bcf --- /dev/null +++ b/app/ned/01/ned0104.c @@ -0,0 +1,39 @@ +/* + * FILE %ned/01/ned0104.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1987 04 08 + * 1991 05 27: Revision + * latest update: 1996-07-26 2:42:33 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void chk_updown (register struct WINDOWCTRL *w) +{ + register struct LINE *l; + struct FEATURE **fp; + + if (w == (struct WINDOWCTRL *) 0 + || (l= w->WC_act) == (struct LINE *) 0 + ) return; + + if (l->lng < w->hv) + { + w->hv= l->lng - TXT_LNG; + if (w->hv < 0) w->hv= 0; + ned_display_window (w); + } + + /* EXP: 1996-03-10 13:13:58 */ + if ((fp= ned_feature_find2 (w, 1)) != (struct FEATURE **) 0) + show_feature (*fp); +} diff --git a/app/ned/01/ned0105.c b/app/ned/01/ned0105.c new file mode 100644 index 0000000000000000000000000000000000000000..9094770c070782f0443b46c73f0d17eb32e0c7fb --- /dev/null +++ b/app/ned/01/ned0105.c @@ -0,0 +1,43 @@ +/* + * FILE %ned/01/ned0105.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * see also: %ned/01/ned0105a.c + * + * written: 1987 04 08 + * latest update: 1997-08-28 10:38:11 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_w_cursor_left (register struct WINDOWCTRL *w, int num) +{ + if (w->WC_act == (struct LINE *) 0) return -1; + + while (num-- > 0) + { +#ifdef USE_TK + tk_resetcup (); +#endif + + if (w->hv + w->cx - w->ax > 0) + { + ned_q_cursor_left (w, 1); + } + else if (ned_w_cursor_up (w, 1) == 1) + { + w->cx= w->ax; + if (w->WC_act->lng > w->bx - w->ax) p_ax_lng (); + else w->cx= w->WC_act->lng + w->ax; + } + } + + return 0; +} diff --git a/app/ned/01/ned0105a.c b/app/ned/01/ned0105a.c new file mode 100644 index 0000000000000000000000000000000000000000..54b1ba9bf3e17557cbe2ec19420573f5232613a3 --- /dev/null +++ b/app/ned/01/ned0105a.c @@ -0,0 +1,59 @@ +/* + * FILE %ned/01/ned0105a.c + * + * move cursor one position to the right + * see also: %ned/01/ned0106a.c + * + * written: 1995-01-01: extracted from %ned/01/ned0105a.c + * latest update: 1996-07-26 2:44:32 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> +#include <gg/keys.h> + +extern int ned_horizontal_scroll_count; + +/* ------------------------------------------------------------------------ */ +int ned_q_cursor_left (struct WINDOWCTRL *w, int df) +{ + struct FEATURE **fp; + + if (w->cx > w->ax) w->cx--; + else + { + if (ned_horizontal_scroll_count <= 1) + { /* scroll horizontally */ + w->hv--; + if (df) + { + w_scrblk_right (w->page, w->ax, w->ay, w->bx, w->by, WV_GELB, 1); +#ifdef TEST /* 1995-10-29 */ + wd_coldis (w, w->ay, w->by, w->first, w->cx+w->hv-w->ax, w->ax); +#endif + wd_2setup (w, w->ax, w->ay, w->ax, w->by); + } + } + else + { /* jump scroll horizontally */ + int sc= ned_horizontal_scroll_count; + if (sc > w->hv) sc= w->hv; + w->hv -= sc; + w->cx += sc-1; + + if (df) ned_display_window (w); + } + } + + /* EXP: 1996-03-10 13:13:58 */ + if ((fp= ned_feature_find2 (w, 1)) != (struct FEATURE **) 0) + show_feature (*fp); + + return 0; +} diff --git a/app/ned/01/ned0105p.c b/app/ned/01/ned0105p.c new file mode 100644 index 0000000000000000000000000000000000000000..bd06be3f72b9644cbc0cbd6b2cb2670578a0dacf --- /dev/null +++ b/app/ned/01/ned0105p.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/01/ned0105p.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1997-08-28 + * latest update: 1997-08-28 10:38:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int repeat; + +/* ------------------------------------------------------------------------ */ +void ned_cursor_left () +{ + ned_w_cursor_left (aw, REPEAT); +} diff --git a/app/ned/01/ned0106.c b/app/ned/01/ned0106.c new file mode 100644 index 0000000000000000000000000000000000000000..c5b60eee022a64f37db2e01a15cb39850977e1c4 --- /dev/null +++ b/app/ned/01/ned0106.c @@ -0,0 +1,50 @@ +/* + * FILE %ned/01/ned0106.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * see also: %ned/01/ned0106a.c + * + * written: 1987 04 08 + * 1991 05 30: Revision + * 1991 09 15: Revision + * latest update: 1997-08-28 10:53:39 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_w_cursor_right (register struct WINDOWCTRL *w, int num) +{ + if (w->WC_act == (struct LINE *) 0) return -1; +#ifdef USE_TK + tk_resetcup (); +#endif + + while (num-- > 0) + if (w->hv + w->cx - w->ax < w->WC_act->lng) + { + ned_q_cursor_right (w, 1); + } + else + { + if (ned_w_cursor_down (w, 1) == 1) + { + w->cx= w->ax; + if (w->hv) + { + w->hv= 0; + ned_display_window (w); + } + } + } + + return 0; +} diff --git a/app/ned/01/ned0106a.c b/app/ned/01/ned0106a.c new file mode 100644 index 0000000000000000000000000000000000000000..05cb226eef98e8cebd51ae9adb1246bc948c9342 --- /dev/null +++ b/app/ned/01/ned0106a.c @@ -0,0 +1,57 @@ +/* + * FILE %ned/01/ned0106a.c + * + * move cursor one position to the right + * see also: %ned/01/ned0105a.c + * + * written: 1995-01-01: extracted from %ned/01/ned0106.c + * 1991 05 30: Revision + * 1991 09 15: Revision + * latest update: 1996-08-27 21:58:25 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern int akt_page; +extern int ned_horizontal_scroll_count; + +/* ------------------------------------------------------------------------ */ +int ned_q_cursor_right (struct WINDOWCTRL *w, int df) +{ + struct FEATURE **fp; + + if (w->cx < w->bx) w->cx++; + else + { + if (ned_horizontal_scroll_count <= 1) + { /* scroll horizontally */ + w->hv++; + + if (df) + { + w_scrblk_left (akt_page, w->ax, w->ay, w->bx, w->by, WV_GELB, 1); + wd_2setup (w, w->bx, w->ay, w->bx, w->by); + } + } + else + { /* jump scroll horizontally */ + w->hv += ned_horizontal_scroll_count; + w->cx -= ned_horizontal_scroll_count-1; + + if (df) ned_display_window (w); + } + } + + /* EXP: 1996-03-10 13:13:58 */ + if ((fp= ned_feature_find2 (w, 1)) != (struct FEATURE **) 0) + show_feature (*fp); + + return 0; +} diff --git a/app/ned/01/ned0106p.c b/app/ned/01/ned0106p.c new file mode 100644 index 0000000000000000000000000000000000000000..560cfcbe57f993d80a7cfe2f10676f7cbe9ab030 --- /dev/null +++ b/app/ned/01/ned0106p.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/01/ned0106p.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1997-08-28 + * latest update: 1997-08-28 10:38:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int repeat; + +/* ------------------------------------------------------------------------ */ +void ned_cursor_right () +{ + ned_w_cursor_right (aw, REPEAT); +} diff --git a/app/ned/01/ned0107.c b/app/ned/01/ned0107.c new file mode 100644 index 0000000000000000000000000000000000000000..3627207ce76d3e666164b77f3325c0b6275b8d66 --- /dev/null +++ b/app/ned/01/ned0107.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/01/ned0107.c + * + * Hilfsfunktionen, elementare Cursorbewegungen: + * Word Left + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 2001-02-11 11:52:06 + * $Id: ned0107.c,v 1.2 2001/02/12 00:03:20 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* Um ein Wort nach links bzw. rechts springen ---------------------------- */ +void p_word_left () { ned_wc_word_lr (aw, JMPWRD_left_beg); } diff --git a/app/ned/01/ned0107b.c b/app/ned/01/ned0107b.c new file mode 100644 index 0000000000000000000000000000000000000000..dc5c558f1ec9e82c9a6d7939d9f5d266fef884b0 --- /dev/null +++ b/app/ned/01/ned0107b.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/01/ned0107b.c + * + * Hilfsfunktionen, elementare Cursorbewegungen: + * Word Left + * + * written: 1996-05-23 + * latest update: 2001-02-11 11:50:26 + * $Id: ned0107b.c,v 1.2 2001/02/12 00:03:21 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* Um ein Wort nach links bzw. rechts springen ---------------------------- */ +void p_word_left_2 () { ned_wc_word_lr (aw, JMPWRD_left_beg_2); } diff --git a/app/ned/01/ned0108a.c b/app/ned/01/ned0108a.c new file mode 100644 index 0000000000000000000000000000000000000000..3e99e474fb5513a35fabafc6ceb547dc1647c352 --- /dev/null +++ b/app/ned/01/ned0108a.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/01/ned0108a.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 2001-02-11 11:51:30 + * $Id: ned0108a.c,v 1.2 2001/02/12 00:03:21 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* Um ein Wort nach links bzw. rechts springen ---------------------------- */ +void p_word_right_beg () { ned_wc_word_lr (aw, JMPWRD_right_beg); } diff --git a/app/ned/01/ned0108b.c b/app/ned/01/ned0108b.c new file mode 100644 index 0000000000000000000000000000000000000000..f23f52ff16a2b23d22c5f0754617371ee272a312 --- /dev/null +++ b/app/ned/01/ned0108b.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/01/ned0108b.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1994-08-20 + * latest update: 2001-02-11 11:51:25 + * $Id: ned0108b.c,v 1.2 2001/02/12 00:03:21 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* Um ein Wort nach links bzw. rechts springen ---------------------------- */ +void p_word_right_end () { ned_wc_word_lr (aw, JMPWRD_right_end); } diff --git a/app/ned/01/ned0108c.c b/app/ned/01/ned0108c.c new file mode 100644 index 0000000000000000000000000000000000000000..698d0362a51d410fc0314dffd338bbef753497d3 --- /dev/null +++ b/app/ned/01/ned0108c.c @@ -0,0 +1,20 @@ +/* + * FILE %ned/01/ned0108c.c + * + * written: 1996-05-23 + * latest update: 2001-02-11 11:50:53 + * $Id: ned0108c.c,v 1.2 2001/02/12 00:03:21 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* Um ein Wort nach links bzw. rechts springen ---------------------------- */ +void p_word_right_beg_2 () { ned_wc_word_lr (aw, JMPWRD_right_beg_2); } diff --git a/app/ned/01/ned0108d.c b/app/ned/01/ned0108d.c new file mode 100644 index 0000000000000000000000000000000000000000..291271fbe75e5b95bac8de0a6e5866f0c65d2fbb --- /dev/null +++ b/app/ned/01/ned0108d.c @@ -0,0 +1,20 @@ +/* + * FILE %ned/01/ned0108d.c + * + * written: 1996-05-23 + * latest update: 2001-02-11 11:50:35 + * $Id: ned0108d.c,v 1.2 2001/02/12 00:03:22 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* Um ein Wort nach links bzw. rechts springen ---------------------------- */ +void p_word_right_end_2 () { ned_wc_word_lr (aw, JMPWRD_right_end_2); } diff --git a/app/ned/01/ned0109.c b/app/ned/01/ned0109.c new file mode 100644 index 0000000000000000000000000000000000000000..4e4b29f970bff07125c5d898c20ba4f6fccd3481 --- /dev/null +++ b/app/ned/01/ned0109.c @@ -0,0 +1,149 @@ +/* + * FILE %ned/01/ned0109.c + * + * Hilfsfunktionen, elementare Cursorbewegungen: + * Word Left, Word Right + * + * written: 1987 04 08 + * 1991 01 31: Revision + * latest update: 2001-02-11 11:44:50 + * $Id: ned0109.c,v 1.2 2001/02/12 00:03:22 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_wc_word_lr (struct WINDOWCTRL *wc, int jump_mode) +/* JMPWRD_left_beg 1: left, beginning of word, ignoring punctuation */ +/* JMPWRD_right_beg 2: right, beginning of word, ignoring punctuation */ +/* JMPWRD_right_end 3: right, end of word, ignoring punctuation */ +/* JMPWRD_left_beg_2 4: left, beginning of word */ +/* JMPWRD_right_beg_2 5: right, beginning of word */ +/* JMPWRD_right_end_2 6: right, end of word */ +{ + int ch; + int off; /* Cursorposition in der Zeile */ + int llng; /* Laenge der Zeile */ +#define ST_start 0 +#define ST_stop 3 +#define ST_text 1 +#define ST_blank 2 +#define ST_re_text 4 +#define ST_re_blank 5 + int st= 0; /* Zustand des Automaten */ + register struct LINE *lp; + int mode1; /* general directional mode */ + int punctuation= 0; /* 1 -> dont ignore punctuation */ + int is_delimiter; /* 1 -> character is not part of token */ + + if (wc == (struct WINDOWCTRL *) 0 + || (lp= wc->WC_act) == (struct LINE *) 0 + ) return; + + off= wc->cx - wc->ax + wc->hv; + llng= lp->lng; + +#ifdef USE_TK + tk_resetcup (); +#endif + + switch (mode1= jump_mode) + { + case JMPWRD_left_beg_2: mode1= JMPWRD_left_beg; punctuation= 1; break; + case JMPWRD_right_beg_2: mode1= JMPWRD_right_beg; punctuation= 1; break; + case JMPWRD_right_end_2: mode1= JMPWRD_right_end; punctuation= 1; break; + } + + if (mode1 == JMPWRD_left_beg && off > 0) off--; + if (mode1 == JMPWRD_right_end) off++; + + for (;;) + { + if ((mode1 == JMPWRD_left_beg && off == 0) + || (mode1 == JMPWRD_right_beg && off > llng) + || (mode1 == JMPWRD_right_end && off >= llng) + ) break; + + ch= get_txt (lp, off); + is_delimiter= (ch == 0x20 || ch == 0x09) + ? 1 + : (punctuation) + ? 0 + : in_charset (ch, CHARSET_token) + ? 0 + : 1; + + switch (st) + { + case ST_start: + if (is_delimiter) + switch (mode1) + { + default: + st= ST_blank; + break; + case JMPWRD_right_end: + st= ST_re_blank; + break; + } + else + switch (mode1) + { + default: + st= ST_text; + break; + case JMPWRD_right_end: + st= ST_re_text; + break; + } + break; + + case ST_text: + if (is_delimiter) + st= (mode1 == JMPWRD_left_beg) ? ST_stop : ST_blank; + break; + + case ST_blank: + if (!is_delimiter) + st= (mode1 == JMPWRD_right_beg) ? ST_stop : ST_text; + break; + + case ST_re_blank: + if (!is_delimiter) st= ST_re_text; + break; + + case ST_re_text: + if (is_delimiter) st= ST_stop; + break; + } + + if (st == ST_stop) break; + + if (mode1 == JMPWRD_left_beg) off--; + else off++; + } + + if (mode1 == JMPWRD_left_beg && off) off++; + if (mode1 == JMPWRD_right_end && off) off--; + + if (off > wc->bx - wc->ax + wc->hv || + off < wc->ax + wc->hv) + { + wc->cx= (wc->bx - wc->ax)/2 + wc->ax; + wc->hv= off - wc->cx + wc->ax; + if (wc->hv < 0) + { + wc->cx += wc->hv; + wc->hv= 0; + } + + ned_display_window (wc); + } + else wc->cx= off - wc->hv + wc->ax; +} diff --git a/app/ned/01/ned0110.c b/app/ned/01/ned0110.c new file mode 100644 index 0000000000000000000000000000000000000000..13116a07e396a96df36bc2341aab3d8bb0092282 --- /dev/null +++ b/app/ned/01/ned0110.c @@ -0,0 +1,42 @@ +/* + * FILE %ned/01/ned0110.c + * + * page up + * + * written: 1987 04 08 + * 1991 05 27: Revision + * latest update: 1996-07-26 2:55:33 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_w_page_up (struct WINDOWCTRL *wc, int part) +{ + int i, lim; + register struct LINE *lp; + register struct LINE *lp_prev; + + if (wc->WC_act == (struct LINE *) 0) return; + + lim= wc->by - wc->ay; + if (part) lim /= 2; + lp= wc->first; + + /* ANM: Im Window sind wc->by - wc->ay + 1 Zeilen darstellbar ! */ + for (i= 0; i < lim; i++) + { + if ((lp_prev= lp->prev) == (struct LINE *) 0) break; + wc->first= lp= lp_prev; + wc->WC_act= wc->WC_act->prev; + wc->znr--; + } + + ned_display_window (wc); +} diff --git a/app/ned/01/ned0110a.c b/app/ned/01/ned0110a.c new file mode 100644 index 0000000000000000000000000000000000000000..b0d95c71c30427cb0b9e123124675ce8dd8cfe6d --- /dev/null +++ b/app/ned/01/ned0110a.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/01/ned0110a.c + * + * page up + * + * written: 1996-05-23 + * latest update: 1999-05-02 4:31:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_page_up () +{ + ned_w_page_up (aw, 0); +} diff --git a/app/ned/01/ned0110b.c b/app/ned/01/ned0110b.c new file mode 100644 index 0000000000000000000000000000000000000000..e1ebaf8c900bcd3db654092948866f02595d5eed --- /dev/null +++ b/app/ned/01/ned0110b.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/01/ned0110b.c + * + * half page up + * + * written: 1996-05-23 + * latest update: 1996-07-21 19:12:27 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_half_page_up () +{ + ned_w_page_up (aw, 1); +} diff --git a/app/ned/01/ned0111.c b/app/ned/01/ned0111.c new file mode 100644 index 0000000000000000000000000000000000000000..7475f355d2c624d30e9dd7245cfd7e7ec909d883 --- /dev/null +++ b/app/ned/01/ned0111.c @@ -0,0 +1,48 @@ +/* + * FILE %ned/01/ned0111.c + * + * flip to next page + * + * written: 1987 04 08 + * latest update: 1996-07-26 2:56:14 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_w_page_down (struct WINDOWCTRL *wc, int part) +{ + int i, lim; + register struct LINE *lp; + register struct LINE *lp_next; + register struct LINE *lp_act; + + if (wc->WC_act == (struct LINE *) 0 + || (lp= wc->first) == (struct LINE *) 0 + || (lp_act= wc->WC_act) == (struct LINE *) 0 + ) return; + + lim= wc->by - wc->ay; + if (part) lim /= 2; + + for (i= 0; i < lim; i++) + { + if ((lp_next= lp->next) == (struct LINE *) 0) break; + wc->first= lp= lp_next; + + if (lp_act->next != (struct LINE *) 0) + { + wc->WC_act= lp_act= lp_act->next; + wc->znr++; + } + else wc->cy--; + } + + ned_display_window (wc); +} diff --git a/app/ned/01/ned0111a.c b/app/ned/01/ned0111a.c new file mode 100644 index 0000000000000000000000000000000000000000..25501e3beee9f3e795c6205a1adcc734d485df7a --- /dev/null +++ b/app/ned/01/ned0111a.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/01/ned0111a.c + * + * page down + * + * written: 1996-05-23 + * latest update: 1996-05-23 13:44:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_page_down () +{ + ned_w_page_down (aw, 0); +} diff --git a/app/ned/01/ned0111b.c b/app/ned/01/ned0111b.c new file mode 100644 index 0000000000000000000000000000000000000000..c85ddcd9756385451346e7df5f307c49c1e48006 --- /dev/null +++ b/app/ned/01/ned0111b.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/01/ned0111b.c + * + * half page down + * + * written: 1996-05-23 + * latest update: 1996-07-21 19:12:37 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_half_page_down () +{ + ned_w_page_down (aw, 1); +} diff --git a/app/ned/01/ned0112.c b/app/ned/01/ned0112.c new file mode 100644 index 0000000000000000000000000000000000000000..71b5b7763435352e4a9f3bb6faf89db3ef83cc0e --- /dev/null +++ b/app/ned/01/ned0112.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/01/ned0112.c + * + * Aktivierung von Sub-Kommando Prozessoren + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1996-07-27 10:55:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int pfx; + +/* ------------------------------------------------------------------------ */ +void p_ctrlq () /* Quick Operationen */ +{ + pfx= P_CTRLQ; +} diff --git a/app/ned/01/ned0112w.c b/app/ned/01/ned0112w.c new file mode 100644 index 0000000000000000000000000000000000000000..e77c6e1a0476759d85d17bab74008ed0c17d3da3 --- /dev/null +++ b/app/ned/01/ned0112w.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/01/ned0112w.c + * + * WordStar standard table + * + * written: 1994-12-26 + * latest update: 1996-05-16 15:32:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int pfx; + +/* ------------------------------------------------------------------------ */ +void p_ctrlw () +{ + pfx= P_NONE; +} diff --git a/app/ned/01/ned0113.c b/app/ned/01/ned0113.c new file mode 100644 index 0000000000000000000000000000000000000000..bd544b49a859aef0e7615808b656c26dcd9b2e91 --- /dev/null +++ b/app/ned/01/ned0113.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/01/ned0113.c + * + * Aktivierung von Sub-Kommando Prozessoren + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1996-05-08 19:51:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int pfx; + +/* ------------------------------------------------------------------------ */ +void p_ctrlk () /* Block & File Operationen */ +{ + pfx= P_CTRLK; +} diff --git a/app/ned/01/ned0114.c b/app/ned/01/ned0114.c new file mode 100644 index 0000000000000000000000000000000000000000..860e621a07942c6c91f53bc79ed851a9f12a7a80 --- /dev/null +++ b/app/ned/01/ned0114.c @@ -0,0 +1,25 @@ +/* + * FILE ~/usr/ned/01/ned0114.c + * + * Aktivierung von Sub-Kommando Prozessoren + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1994-12-26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int pfx; + +/* ------------------------------------------------------------------------ */ +void p_ctrlo () /* Screen and Window Operationen */ +{ + pfx= P_CTRLO; +} diff --git a/app/ned/01/ned0115.c b/app/ned/01/ned0115.c new file mode 100644 index 0000000000000000000000000000000000000000..624abe133ecd470c1d21f5d893ce9763b5e2439d --- /dev/null +++ b/app/ned/01/ned0115.c @@ -0,0 +1,50 @@ +/* + * FILE %ned/01/ned0115.c + * + * Aktivierung von Sub-Kommando Prozessoren + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1997-02-20 12:41:30 + * $Id: ned0115.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> +#ifdef USE_MOUSE +#include <gg/maus.h> +#else +extern ned_input_handler *nextchar; /* Editor Eingabe: KBD | FILE .. */ +#endif + +extern int key; +extern int akt_page; +extern int COL_STATUS; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_ctrlp () +{ + char key_str [5]; + + key_str [0]= '^'; + key_str [1]= 'P'; + key_str [2]= 0; + + w_setstring (akt_page, aw->ax+4, aw->ay-1, aw->ax+7, aw->ay-1, + COL_STATUS, key_str, 0x01); + +#ifdef USE_MOUSE + key= ned_check_mouse (); +#else + key= (*nextchar) (); +#endif + + ned_insert_special_char (key); +} diff --git a/app/ned/01/ned0115b.c b/app/ned/01/ned0115b.c new file mode 100644 index 0000000000000000000000000000000000000000..2a60a1347f67aff72f504dd95851f822a6d69c61 --- /dev/null +++ b/app/ned/01/ned0115b.c @@ -0,0 +1,44 @@ +/* + * FILE %ned/01/ned0115b.c + * + * insert a special character into the text + * + * written: 1997-01-05 + * latest update: 1998-08-16 12:39:24 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_insert_special_char (int ins_code) +{ + char code [10]; + + switch (ins_code) + { + case '0': + ins_code= 0x00; + break; + + case 'e': + ins_code= 0x1B; + break; + + case 'p': /* ^P */ + ins_code= 0x10; + break; + } + + sprintf (code, "0x%04X", ins_code); + ned_message_2 ("ins_code: ", code); + + if (ins_code >= 0x00 && ins_code <= 0xFF) q_insert (ins_code, 1); +} diff --git a/app/ned/01/ned0116.c b/app/ned/01/ned0116.c new file mode 100644 index 0000000000000000000000000000000000000000..e5e6e94897e8e9b2102f0fb5e9afc742dd2118c4 --- /dev/null +++ b/app/ned/01/ned0116.c @@ -0,0 +1,25 @@ +/* + * FILE ~/usr/ned/01/ned0116.c + * + * Aktivierung von Sub-Kommando Prozessoren + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1994-12-28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int pfx; + +/* ------------------------------------------------------------------------ */ +void p_funct () /* Funktionstasten */ +{ + pfx= P_FUNCT; +} diff --git a/app/ned/01/ned0117.c b/app/ned/01/ned0117.c new file mode 100644 index 0000000000000000000000000000000000000000..e221c533a33818fe807c4c968dbb6c8e2ab2abc6 --- /dev/null +++ b/app/ned/01/ned0117.c @@ -0,0 +1,33 @@ +/* + * FILE %ned/01/ned0117.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1987 04 08 + * 1991 01 27: Revision + * latest update: 1997-01-19 0:27:28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_nl2 () /* Ctrl N */ +{ + int aif; + + if (aw->WC_edit_mode & EDIT_READ_ONLY) return; + + aif= aw->ai; + aw->ai= 0; + ned_wc_ins_nl (aw); + aw->ai= aif; + chk_updown (aw); +} diff --git a/app/ned/01/ned0118.c b/app/ned/01/ned0118.c new file mode 100644 index 0000000000000000000000000000000000000000..af4538bcfffc48c8d289fee27c6e57aa5e54a540 --- /dev/null +++ b/app/ned/01/ned0118.c @@ -0,0 +1,78 @@ +/* + * FILE %ned/01/ned0118.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1987 04 08 + * 1991 02 07: Revision + * latest update: 1997-09-14 11:01:06 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_nl () /* Ctrl M */ +{ + register struct WINDOWCTRL *w; + int flg_wd_setup= 0; + int cn; + + w= aw; + if (w->WC_edit_mode & EDIT_READ_ONLY) return; + +#ifdef USE_ABBREVIATIONS + ned_check_abbrev (); +#endif /* USE_ABBREVIATIONS */ + + /* NOTE: ev. ab hier als ned_wc_nl () auskoppeln */ + if (w->WC_act == (struct LINE *) 0) goto INS_NL; + + if (w->cy == w->by) + { + w->first= w->first->next; + wd_upscr (w); + w->cy--; + } + +INS_NL: + if ((cn= ned_wc_ins_nl (w)) < 0) return; /* error !! */ + w->cx= w->ax + cn; + if (cn < w->hv) + { + w->hv= 0; + w->cx= w->ax+cn; + flg_wd_setup= 1; + } + + if (w->WC_act->next == (struct LINE *) 0) return; /* ### ???? */ + + w->WC_act= w->WC_act->next; + + if (w->cy < w->by) + { + w->cy++; + } + else + { + w->first= w->first->next; + flg_wd_setup= 1; + } + + w->znr++; + +#ifndef MSDOS + flg_wd_setup= 1; /* ### make sure screen is redrawn even ### */ + w->w_upd |= 0x04; /* ### if this method is inefficient! ### */ +#endif + + if (flg_wd_setup) ned_display_window (w); + chk_updown (w); +} diff --git a/app/ned/01/ned0119.c b/app/ned/01/ned0119.c new file mode 100644 index 0000000000000000000000000000000000000000..de1538a2ecd093b00725c90718440efe40a3ea56 --- /dev/null +++ b/app/ned/01/ned0119.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/01/ned0119.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1987 04 08 + * 1991 02 07: Revision + * latest update: 1996-05-23 16:10:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_ax_lng () /* CTRL-J: Spalte 0 oder letzte Spalte */ +{ + ned_w_jmp_in_line (aw, NEDJMP_AXLNG, 0); +} diff --git a/app/ned/01/ned0119a.c b/app/ned/01/ned0119a.c new file mode 100644 index 0000000000000000000000000000000000000000..bc1b058fbe0e786715477531fb744449a5ab1bbe --- /dev/null +++ b/app/ned/01/ned0119a.c @@ -0,0 +1,63 @@ +/* + * FILE %ned/01/ned0119a.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1996-05-23 + * latest update: 1996-05-23 16:06:35 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_w_jmp_in_line (struct WINDOWCTRL *wc, int mode, int offset) +/* mode: */ +/* NEDJMP_BOLN 1: */ +/* NEDJMP_EOLN 2: */ +/* NEDJMP_AXLNG 3: */ +{ + int hvs; + +#ifdef MSDOS + offset; +#endif /* MSDOS */ + + if (wc == (struct WINDOWCTRL *) 0 + || wc->WC_act == (struct LINE *) 0 + || wc->WC_act->lng == 0 + ) return; + + hvs= wc->hv; + if (mode == NEDJMP_AXLNG) + mode= (wc->cx + hvs == wc->ax) ? NEDJMP_EOLN : NEDJMP_BOLN; + +#ifdef USE_TK + tk_resetcup (); +#endif + + switch (mode) + { + case NEDJMP_BOLN: + wc->cx= wc->ax; + wc->hv= 0; + break; + + case NEDJMP_EOLN: + if (wc->WC_act->lng >= wc->bx - wc->ax) + { + wc->hv= wc->WC_act->lng - wc->bx + wc->ax; + wc->cx= wc->bx; + } + else + wc->cx= wc->WC_act->lng + wc->ax - wc->hv; + break; + } + + if (hvs != wc->hv) ned_display_window (wc); +} diff --git a/app/ned/01/ned0120.c b/app/ned/01/ned0120.c new file mode 100644 index 0000000000000000000000000000000000000000..1e0f44363de176efc2904b3e70789db2c51f2135 --- /dev/null +++ b/app/ned/01/ned0120.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/01/ned0120.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1987 04 08 + * 1991 02 07: Revision + * latest update: 1996-05-23 16:16:58 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_jmp_boln () /* Spalte 0 */ +{ + ned_w_jmp_in_line (aw, NEDJMP_BOLN, 0); +} diff --git a/app/ned/01/ned0121.c b/app/ned/01/ned0121.c new file mode 100644 index 0000000000000000000000000000000000000000..a8fbc47964669a40ce1db18eeaa284906f62f10a --- /dev/null +++ b/app/ned/01/ned0121.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/01/ned0121.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1987 04 08 + * 1991 02 07: Revision + * latest update: 1997-02-09 17:21:04 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_jmp_eoln () /* letzte Spalte */ +{ + ned_w_jmp_in_line (aw, NEDJMP_EOLN, 0); +} diff --git a/app/ned/01/ned0122.c b/app/ned/01/ned0122.c new file mode 100644 index 0000000000000000000000000000000000000000..e75fc11c911d3daecde650aa541131669fce011b --- /dev/null +++ b/app/ned/01/ned0122.c @@ -0,0 +1,41 @@ +/* + * FILE %ned/01/ned0122.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1987 04 08 + * 1991 01 31: Revision + * latest update: 1997-09-07 13:15:37 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int repeat; + +/* ------------------------------------------------------------------------ */ +void ned_del_char_right () +{ + if (aw->WC_act == (struct LINE *) 0 + || (aw->WC_edit_mode & EDIT_READ_ONLY) + ) return; + + if (aw->cx + aw->hv - aw->ax == aw->WC_act->lng) + { + if (aw->WC_act->next == (struct LINE *) 0) return; + if (aw->WC_act->txt == (struct TXT *) 0) + { + if (ned_delete_current_line (aw) <= 0) return; + } + else ned_join3 (aw); + + ned_display_window (aw); + } + else ned_wc_delete (aw, 1); +} diff --git a/app/ned/01/ned0123.c b/app/ned/01/ned0123.c new file mode 100644 index 0000000000000000000000000000000000000000..b0561a8cba170963d71da29d5b7db01b0881b3ad --- /dev/null +++ b/app/ned/01/ned0123.c @@ -0,0 +1,74 @@ +/* + * FILE %ned/01/ned0123.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1987 04 08 + * 1991 01 31: Revision + * latest update: 1997-08-03 9:14:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern struct WINDOWCTRL *aw; +extern int akt_page; + +/* ---------------------------------------------------------------------- */ +void ned_del_char_left () +{ + int flg= 0; + + if (aw->WC_act == (struct LINE *) 0 + || (aw->WC_edit_mode & EDIT_READ_ONLY) + ) return; + +#ifdef USE_ABBREVIATIONS + ned_abbrev_reduce (); +#endif /* USE_ABBREVIATIONS */ + + if (aw->cx - aw->ax == 0) + { /* cursor at left side of the screen */ + + if (aw->hv > 0) + { /* horizontal view can be shifted */ + ned_q_cursor_left (aw, 1); + goto DEL; + } + + if (aw->WC_act->prev == (struct LINE *) 0) return; + aw->WC_act= aw->WC_act->prev; + + if (aw->cy == aw->ay) /* gdw. aw->WC_act == aw->first !! */ + aw->first= aw->first->prev; + else aw->cy--; + + if (aw->WC_act->lng > aw->bx - aw->ax) + { + aw->hv= aw->WC_act->lng; + aw->cx= aw->ax; + flg= 1; + } + else + { + aw->cx= aw->WC_act->lng + aw->ax; + aw->hv= 0; + } + + ned_join3 (aw); + aw->znr--; + if (flg) ned_display_window (aw); + } + else + { + aw->cx--; +DEL: + ned_wc_delete (aw, 1); + } +} diff --git a/app/ned/01/ned0124.c b/app/ned/01/ned0124.c new file mode 100644 index 0000000000000000000000000000000000000000..9fde0347cb3d82120e9fa5e2f623ff6053b588d0 --- /dev/null +++ b/app/ned/01/ned0124.c @@ -0,0 +1,185 @@ +/* + * FILE %ned/01/ned0124.c + * + * display status information (e.g. the status line) about a window + * + * written: 1987 04 08 + * 1991 01 31: Revision + * latest update: 2000-09-01 17:51:52 + * $Id: ned0124.c,v 1.2 2000/09/01 19:20:25 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdio.h> +#include <gg/keys.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" +#include <gg/window.h> + +extern int MPflag; +extern int mess_ttl; +extern int mess_lin; +extern char *PFX_XX []; +extern int akt_page; +extern int pfx; +extern int block_mode; +extern int COL_STATUS; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +static int DEBline = 0; /* Debug-Zeile */ + +static char *OFF_ON []= { "OFF", "ON" }; +static char *BLK_MD []= { "???", "STD", "LINE", "BOX" }; +static char *INS_MD []= { "OVR", "INS", "CW " }; + +static char status [100]; +static char *untitled= "<untitled>"; + +/* ------------------------------------------------------------------------ */ +void background () +{ + if (MPflag +#ifndef USE_TK + || kbhit () +#endif + ) return; + + window_status (aw); +} + +/* ------------------------------------------------------------------------ */ +void window_status (register struct WINDOWCTRL *w) +{ + char *fileentry; + register struct LINE *l; + int flg_0x0D= 'x'; + + if (w == (struct WINDOWCTRL *) 0) return; + + if ((l= w->WC_act) != (struct LINE *) 0) + flg_0x0D= (l->line_flg & LINE_CODE_0x0D) ? 'C' : 'c'; + + if (mess_ttl > 0) + { + if (mess_ttl == 1) restore_message_line (); + mess_ttl--; + } + + if (w->WC_title_short != (char *) 0) + { + fileentry= w->WC_title_short; + } + else + { + if (w->file_type == FTY_HYPER) + { + fileentry = ((struct FRAMECTRL *) w->file_or_frame == (void *) 0) + ? untitled + : ((struct FRAMECTRL *) w->file_or_frame)->frame_name; + } + else + { + fileentry = ((struct FILECTRL *) w->file_or_frame == (void *) 0) + ? untitled + : ((struct FILECTRL *) w->file_or_frame)->FC_fnm_txt; + } + w->WC_title_short= strdup (fileentry); /** ??? **/ +#ifdef USE_TK + ned_tk_set_window_name (w, w->WC_title_short); +#endif /* USE_TK */ + } + + sprintf (status, + "%s L:%4d %c:%4d (0x%02X) L=%3d %s %s %1.50s", + PFX_XX [pfx], + w->znr, + flg_0x0D, + w->cx + w->hv - w->ax, + get_txt_visible (l, w->cx + w->hv - w->ax), + (l == (struct LINE *) 0) ? 0 : l->lng, + INS_MD [w->ins_flg], + (w->ai) ? "AI" : " ", + fileentry); + +/* Note: File or frame information must be limited to 50 bytes here: */ +/* sizeof (status) = 100, 45 characters fixed status info, makes 55 */ +/* characters for the filename itself maximum. */ + +#ifdef USE_TK + tk_draw_string (w, NED_TK_GC_StatusLine, w->ax+4, w->ay-1, status); +#else + w_setstring (akt_page, w->ax+4, w->ay-1, w->bx, w->ay-1, + COL_STATUS, status, 0x01); +#endif + +#ifdef DEBUG + switch (DEBline) + { + case 0: + sprintf (status, + "F: %06lx ->n %06lx ->p %06lx || A: %06lx ->n %06lx ->p %06lx", + w->first, + (w->first == (struct LINE *) 0) ? (struct LINE *) 0 : (char *) w->first->next, + (w->first == (struct LINE *) 0) ? (struct LINE *) 0 : (char *) w->first->prev, + l, + (l == (struct LINE *) 0) ? (struct LINE *) 0 : (char *) l->next, + (l == (struct LINE *) 0) ? (struct LINE *) 0 : (char *) l->prev); + break; + case 1: + sprintf (status, + "ax %3d ay %3d bx %3d by %3d cx %3d cy %3d Z %3d", + w->ax, w->ay, w->bx, w->by, w->cx, w->cy, w->znr); + break; + case 2: + sprintf (status, + "BEG %6lx %5d END %6lx %5d, flags %04x", + b_beg.ptr, b_beg.offset, b_end.ptr, b_end.offset, + (w->WC_act == (struct LINE *) 0) ? 0 : w->WC_act->line_flg); + break; + } + + w_setstring (akt_page, 0, 1, 79, 0, COL_STATUS, status, 0x01); +#endif + + return; + +#ifdef JUNK +SHORT: + sprintf (status, "%4d Column %4d", w->znr, w->cx + w->hv - w->ax); + w_setstring (akt_page, 10, 0, 25, 0, COL_STATUS, status, 0x01); +#endif +} + +/* ------------------------------------------------------------------------ */ +void back2ground () /* Extended Status Line */ +{ + register struct WINDOWCTRL *w; + register struct LINE *l; + + if (kbhit ()) return; + if ((w= aw) != (struct WINDOWCTRL *) 0) l= w->WC_act; + sprintf (status, + "Indent=%-3.3s Block=%-4.4s HV=%4d f_upd=%2d edit_mode=%2d", + OFF_ON [w->ai % 2], + BLK_MD [block_mode], + w->hv, + w->f_upd, + w->WC_edit_mode); + + w_setstring (0, 0, mess_lin, 79, mess_lin, COL_STATUS, status, 0x01); + mess_ttl = 7; +} + +/* ------------------------------------------------------------------------ */ +void QQdeb () +{ + DEBline= (DEBline + 1) % 3; + w_setnchar (0, 0, 1, COL_STATUS, ' ', 80); +} diff --git a/app/ned/01/ned0125c.c b/app/ned/01/ned0125c.c new file mode 100644 index 0000000000000000000000000000000000000000..2571a65bff1bc56d1368a5361cac3b7fbf83aa5d --- /dev/null +++ b/app/ned/01/ned0125c.c @@ -0,0 +1,75 @@ +/* + * FILE %ned/01/ned0125c.c + * + * written: 1991 06 01 + * latest update: 1997-10-26 9:10:58 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#define CHAR_HOLLOW ':' +#define CHAR_FULL '#' + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern int akt_page; +extern int NED_TEXT_MAX_X; + +/* ------------------------------------------------------------------------ */ +int ned_ch_show_display_range (struct WINDOWCTRL *w) +{ + int zpb; /* number of lines represented by each block */ + int dlines; /* Zahl der Zeilen im Window */ + int xlines; /* Zahl der Zeilen im File */ + int first_line; /* Nummer der 1. Zeile am Schirm */ + int hollow= 0; /* Zahl der schattierten Zeilen am Anfang */ + int full; /* Zahl der ausgefuellt angezeigten Zeilen */ + int x, y; /* Koordinaten am Window Rand */ + int a; /* Colour Attribute der Anzeige */ + + if (w == (struct WINDOWCTRL *) 0) return -1; + if (w->box_type == BOX_TYPE_none + || (x= w->bx+1) >= NED_TEXT_MAX_X + ) return 0; + + xlines= w->tlines; + first_line= w->znr - w->cy + w->ay; + if (xlines <= 0 || first_line > xlines) + { /* xlines unplausibel; fehlerhafte Berechnung??? */ + xlines= w->tlines= ned_cnt_total_lines (w->WC_act); + /**** first_line= ned_cnt_line_2beg (w->first); ****/ + } + + dlines= w->by - w->ay + 1; + + zpb= xlines/dlines; + if (zpb<=0) + { + hollow= 0; + full= dlines; + } + else + { + hollow= first_line/zpb; + full= dlines/zpb; + if (full <= 0) full=1; + } + + /* x= w->ax-1 */ + y= w->ay; + a= w->attr_box; + + for (; y <= w->by && hollow-- > 0; y++) + w_setchar (akt_page, x, y, a, CHAR_HOLLOW); + for (; y <= w->by && full-- > 0; y++) + w_setchar (akt_page, x, y, a, CHAR_FULL); + for (; y <= w->by; y++) + w_setchar (akt_page, x, y, a, CHAR_HOLLOW); + + return 0; +} diff --git a/app/ned/01/ned0126.c b/app/ned/01/ned0126.c new file mode 100644 index 0000000000000000000000000000000000000000..873175f6ed44d288d71eabf3c70269db8cb78d22 --- /dev/null +++ b/app/ned/01/ned0126.c @@ -0,0 +1,51 @@ +/* + * FILE %ned/01/ned0126.c + * + * isolate a word at the current cursor postition + * + * written: 1991 10 23 + * 1994-04-10: qq_isolate_word() isolated from here + * latest update: 1997-12-05 11:41:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int blk; + +/* ------------------------------------------------------------------------ */ +int q_isolate_word (char *wp, int max_lng, int charset, int go_left) +{ + struct LINE *lp; + struct MARKER *mrk_beg; + struct MARKER *mrk_end; + int rc; + int x; + + if ((lp= aw->WC_act) == (struct LINE *) 0) return 0; + x= aw->cx - aw->ax + aw->hv; + + if (blk == 1 + && (mrk_beg= ned_get_marker (NED_MARKER_BEG, 0)) != (struct MARKER *) 0 + && mrk_beg->wptr == aw && mrk_beg->ptr == lp && mrk_beg->offset == x + && (mrk_end= ned_get_marker (NED_MARKER_END, 0)) != (struct MARKER *) 0 + && mrk_end->wptr == aw && mrk_end->ptr == lp + && ned_line_2_string (mrk_beg->ptr, mrk_beg->offset, + mrk_end->ptr, mrk_end->offset, + wp, max_lng, 0L, 0x0000) != (char *) 0 + ) + return strlen (wp); + + if ((rc= qq_isolate_word (wp, max_lng, charset, lp, x, lp->lng, go_left)) + > 0) + return rc; + + return 0; +} diff --git a/app/ned/01/ned0127.c b/app/ned/01/ned0127.c new file mode 100644 index 0000000000000000000000000000000000000000..566d04809c4629ae52cc2037485c4f1dfd2664a9 --- /dev/null +++ b/app/ned/01/ned0127.c @@ -0,0 +1,82 @@ +/* + * FILE %ned/01/ned0127.c + * + * isolate a word at the current cursor postition + * + * written: 1994-04-10: isolated from ned0126.c q_isolate_word() + * latest update: 1997-01-15 14:12:33 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int qq_isolate_word ( +char *wp, +int max_lng, +int charset, +struct LINE *lp, +int off, /* Cursorposition in der Zeile */ +int llng, /* Laenge der Zeile */ +int go_left) /* 1 -> search for the beginning of the word*/ +{ + int ch; + int st= 0; /* Zustand des Automaten */ + int wl= 0; /* length of isolated word */ + + for (;;) + { + if (off < 0 || off >= llng) goto DONE; + ch= get_txt (lp, off); + + switch (st) + { + case 0: /* check the opening character class */ + if (!in_charset (ch, charset)) return 0; + if (go_left) st= 1; + else { st= 2; goto ST2; } + + case 1: /* find the beginning of the word */ + if (!in_charset (ch, charset)) + { + off++; + st= 2; + break; + } + if (off>0) + { + off--; + break; + } + st= 2; + + case 2: /* copy the current word to the buffer */ +ST2: + if (!in_charset (ch, charset) || max_lng <= 1) goto DONE; + *wp++= (char) ch; + *wp= 0; + wl++; + off++; + max_lng--; + break; + } + } + +DONE: + if ((charset == CHARSET_filename || charset == CHARSET_include) + && wl > 1 + && *--wp == ':') + { + *wp= 0; + wl--; + } + + return wl; +} diff --git a/app/ned/01/ned0128.c b/app/ned/01/ned0128.c new file mode 100644 index 0000000000000000000000000000000000000000..8d98d3f5ad5246623f8220891e59dc1a75838b6b --- /dev/null +++ b/app/ned/01/ned0128.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/01/ned0128.c + * + * Aktivierung von Sub-Kommando Prozessoren + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1995-09-26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int pfx; + +/* ------------------------------------------------------------------------ */ +void p_ctrlu () +{ + pfx= P_CTRLU; +} diff --git a/app/ned/01/ned0129.c b/app/ned/01/ned0129.c new file mode 100644 index 0000000000000000000000000000000000000000..7bea6f7c48244b9839c8b419b8331771ab3af309 --- /dev/null +++ b/app/ned/01/ned0129.c @@ -0,0 +1,29 @@ +/* + * FILE %ned/01/ned0129.c + * + * Hilfsfunktionen, elementare Cursorbewegungen usw. + * + * written: 1987 04 08 + * 1991 02 07: Revision + * latest update: 1997-08-03 9:46:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_split_join () +{ + if (aw->WC_act == (struct LINE *) 0) return; + + if (aw->cx - aw->ax + aw->hv == aw->WC_act->lng) + ned_del_char_right (); + else p_nl2 (); +} diff --git a/app/ned/01/ned0131.c b/app/ned/01/ned0131.c new file mode 100644 index 0000000000000000000000000000000000000000..decb9e751400c6a03d756f608ce1f028d2fb8a58 --- /dev/null +++ b/app/ned/01/ned0131.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/01/ned0131.c + * + * Speicherverwaltung + * + * written: 1987 04 08 + * latest update: 1999-04-25 16:29:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifndef MSDOS +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct LINE *alloc_line () +{ + return (struct LINE *) calloc (sizeof (struct LINE), 1); +} diff --git a/app/ned/01/ned0132.c b/app/ned/01/ned0132.c new file mode 100644 index 0000000000000000000000000000000000000000..9b051ea1de25c2754b91472759110e9fc773976b --- /dev/null +++ b/app/ned/01/ned0132.c @@ -0,0 +1,36 @@ +/* + * FILE %ned/01/ned0132.c + * + * Speicherverwaltung + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1999-04-25 16:29:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct TXT *txch_alloc (int size, int ch) +{ + register struct TXT *tx; + + if (size > 255 + || (tx= (struct TXT *) malloc (sizeof (struct TXT)-3 + size)) + == (struct TXT *) 0 + ) return (struct TXT *) 0; + + tx->t_lng= (unsigned char) size; + strfill (tx->t, size, ch); + tx->next= (struct TXT *) 0; + + return tx; +} diff --git a/app/ned/01/ned0133.c b/app/ned/01/ned0133.c new file mode 100644 index 0000000000000000000000000000000000000000..808c1ce20fc3e6204872956ba0abdc903e7a9ab2 --- /dev/null +++ b/app/ned/01/ned0133.c @@ -0,0 +1,23 @@ +/* + * FILE ~/usr/ned/01/ned0133.c + * + * Speicherverwaltung + * + * written: 1987 04 08 + * latest update: 1997-10-26 10:27:20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct TXT *tx_alloc (int size) /* Laenge des gewuenschten Textsegments */ +{ + return txch_alloc (size, 0); +} + diff --git a/app/ned/01/ned0134.c b/app/ned/01/ned0134.c new file mode 100644 index 0000000000000000000000000000000000000000..5d26c87f03ebb11a723de79a98a806df6bef8885 --- /dev/null +++ b/app/ned/01/ned0134.c @@ -0,0 +1,23 @@ +/* + * FILE ~/usr/ned/01/ned0134.c + * + * Speicherverwaltung + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1994-12-28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void strfill (char *s, int cnt, int ch) +{ + while (cnt-- > 0) *s++= (char) ch; +} diff --git a/app/ned/01/ned0135.c b/app/ned/01/ned0135.c new file mode 100644 index 0000000000000000000000000000000000000000..4cfe0e471386055744c4e90b7f68ae2c86726cb6 --- /dev/null +++ b/app/ned/01/ned0135.c @@ -0,0 +1,25 @@ +/* + * FILE ~/usr/ned/01/ned0135.c + * + * Speicherverwaltung + * + * written: 1987 04 08 + * 1991 02 07: Revision + * latest update: 1999-04-25 16:29:18 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct WINDOWCTRL *wdw_alloc () +{ + return (struct WINDOWCTRL *) calloc (sizeof (struct WINDOWCTRL), 1); +} diff --git a/app/ned/01/ned0136.c b/app/ned/01/ned0136.c new file mode 100644 index 0000000000000000000000000000000000000000..9de5ce3730edb312b2a88c0f3663e347ca12846e --- /dev/null +++ b/app/ned/01/ned0136.c @@ -0,0 +1,25 @@ +/* + * FILE ~/usr/ned/01/ned0136.c + * + * Speicherverwaltung + * + * written: 1987 04 08 + * 1991 02 07: Revision + * latest update: 1999-04-25 16:29:23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct FILECTRL *file_alloc () +{ + return (struct FILECTRL *) calloc (sizeof (struct FILECTRL), 1); +} diff --git a/app/ned/01/ned0137.c b/app/ned/01/ned0137.c new file mode 100644 index 0000000000000000000000000000000000000000..b2e696a0993bf2d03f4a7b407b5f1bb306e21b13 --- /dev/null +++ b/app/ned/01/ned0137.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/01/ned0137.c + * + * Speicherverwaltung + * + * written: 1987 04 08 + * 1991 02 07: Revision + * latest update: 1999-04-25 16:29:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifndef MSDOS +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct FEATURE *ned_feature_alloc () +{ + return (struct FEATURE *) calloc (sizeof (struct FEATURE), 1); +} diff --git a/app/ned/01/ned0138.c b/app/ned/01/ned0138.c new file mode 100644 index 0000000000000000000000000000000000000000..77b68e2aa0fa2ad9a36ed432f5740b564d663dd4 --- /dev/null +++ b/app/ned/01/ned0138.c @@ -0,0 +1,40 @@ +/* + * FILE %ned/01/ned0138.c + * + * Speicherverwaltung + * + * written: 1987 04 08 + * 1991 02 07: Revision + * latest update: 1999-04-25 16:29:29 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_lines_free (register struct LINE *lp) /* Eine Liste von Zeilen */ + /* freigeben */ +{ + struct LINE *lp2; + + if ((lp= ned_find_first_line (lp)) == (struct LINE *) 0) return; + + while ((lp2= lp) != (struct LINE *) 0) + { + /* 'Anhaengsel' einer Zeile freigeben */ + tx_free (lp->txt); /* Text Segmente der Zeile freigeben */ + + ned_line_trigger_delete (lp, 1, 0); + ned_feature_free (lp->ftr); + + lp= lp->next; + free (lp2); + } +} diff --git a/app/ned/01/ned0138b.c b/app/ned/01/ned0138b.c new file mode 100644 index 0000000000000000000000000000000000000000..f7b11c7b1abd3448bfa3344269efad2a8e69a4d3 --- /dev/null +++ b/app/ned/01/ned0138b.c @@ -0,0 +1,44 @@ +/* + * FILE %ned/01/ned0138b.c + * + * Speicherverwaltung + * + * written: 1996-07-27 + * latest update: 1999-04-25 16:29:32 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_feature_free (register struct FEATURE *f) +{ + struct FEATURE *f2; + struct LINE *lp; + + while (f != (struct FEATURE *) 0) + { + f2= f; + f= f->ftr_next; + + if ((lp= (struct LINE *) f2->ftr_text_line) != (struct LINE *) 0) + { + tx_free (lp->txt); + + ned_line_trigger_delete (lp, 1, 1); + /* Note: is it possible, that feature lines */ + /* have registered callbacks? */ + + free (lp); + } + free (f2); + } +} diff --git a/app/ned/01/ned0139.c b/app/ned/01/ned0139.c new file mode 100644 index 0000000000000000000000000000000000000000..97ab00d8ea398fb60127adcd5f81e38c22fde637 --- /dev/null +++ b/app/ned/01/ned0139.c @@ -0,0 +1,67 @@ +/* + * FILE %ned/01/ned0139.c + * + * Speicherverwaltung: Anpassung von Text Segmenten + * + * Anmerkung: wenn llng == 0, dann wird die Text Segment Liste + * geloescht. Es ist also moeglich, dass Zeilen + * ohne Text Segmentliste existieren! + * + * written: 1987 04 08 + * 1991 01 29: Revision + * latest update: 1995-11-12 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void txt_adj ( +int llng, /* ... aktuelle Laenge anpassen */ +register struct TXT **tp) /* Textsegmentliste auf ... */ + /* ggf. verlaengern oder verkuerzen */ +{ + for (;;) + { + if (llng <= 0) + { + if (*tp != (struct TXT *) 0) + { + tx_free (*tp); + *tp= (struct TXT *) 0; + } + return; + } + + if (*tp == (struct TXT *) 0) +#ifndef ADVANCED_VERSION + { + if ((*tp= txch_alloc (TXT_LNG, 0x20)) == (struct TXT *) 0) return; + } +#else + { + int xlng; + + xlng= (llng > 256) ? 256 : (((llng + 20) & 0x7FF8) + 5); /* ######## */ + if ((*tp= txch_alloc (xlng, 0x20)) == (struct TXT *) 0) return; + + /* ANM: Es werden Blocks der Groesse k*16+11 =< 256 allociert, */ + /* sodass zusammen mit den 4 Byte fuer den Link und */ + /* 1 Byte Laengencode immer ein vielfaches eines */ + /* Paragraphs angefordert wird. */ + + /* ANM: Dieser Funktionsteil darf erst aktiviert werdern, wenn */ + /* alle anderen Funktionen auch mit Text Segmenten mit */ + /* einer anderen Laenge als TXT_LNG operieren koennen. */ + } +#endif + llng -= (*tp)->t_lng; + tp = &((*tp)->next); + } +} diff --git a/app/ned/01/ned0140.c b/app/ned/01/ned0140.c new file mode 100644 index 0000000000000000000000000000000000000000..a9d185107a42efe72b8b5649b57a01e8e95c803e --- /dev/null +++ b/app/ned/01/ned0140.c @@ -0,0 +1,32 @@ +/* + * FILE %ned/01/ned0140.c + * + * Speicherverwaltung + * + * written: 1987 04 08 + * 1991 02 07: Revision + * latest update: 1999-04-25 16:29:34 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void tx_free (register struct TXT *tp) /* Textsegmente freigeben */ +{ + register struct TXT *tp2; + + while (tp != (struct TXT *) 0) + { + tp2= tp->next; + free (tp); + tp= tp2; + } +} diff --git a/app/ned/01/ned0141.c b/app/ned/01/ned0141.c new file mode 100644 index 0000000000000000000000000000000000000000..6bb503d89d4c3fc2ff879d12a8cf9aaefce6cbb9 --- /dev/null +++ b/app/ned/01/ned0141.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/01/ned0141.c + * + * written: 1991 05 27 + * latest update: 1999-04-25 16:29:37 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifndef MSDOS +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +extern struct FILECTRL *files; + +/* ------------------------------------------------------------------------ */ +void file_free (struct FILECTRL *fc) +{ + struct FILECTRL **fcp; + + for (fcp= &files; *fcp != (struct FILECTRL *) 0; fcp= &(*fcp)->next) + if (*fcp == fc) + { + *fcp= fc->next; + free (fc); + return; + } +} diff --git a/app/ned/01/ned0142.c b/app/ned/01/ned0142.c new file mode 100644 index 0000000000000000000000000000000000000000..37d2f8c5c210c70780063fa2ede945270fef95d9 --- /dev/null +++ b/app/ned/01/ned0142.c @@ -0,0 +1,118 @@ +/* + * FILE %ned/01/ned0142.c + * + * check if a character belongs to a given(?) set of characters + * NOTE: currently there are only two charset, + * check if this could be enhanced by the new charset functions + * + * CHARSET_blank: white space characters + * CHARSET_non_blank: not white space characters + * CHARSET_token: default + * CHARSET_filename: for filenames + * CHARSET_include: for include filenames + * + * written: 1991 10 23 + * latest update: 1999-05-01 9:12:16 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int in_charset (int ch, int charset) +{ + switch (charset) + { + case CHARSET_blank: + switch (ch) + { + case ' ': + case '\t': + return 1; + default: + return 0; + } + break; + + case CHARSET_non_blank: + switch (ch) + { + case ' ': + case '\t': + return 0; + default: + return 1; + } + break; + + case CHARSET_filename: /* used for filenames */ + switch (ch) + { + case '%': /* for logic file names */ + case '.': + case ':': /* drive letters and URLs */ + case '\\': + case '/': + case '-': + case '_': + case '(': + case ')': + return 1; + default: goto DEFAULT; + } + break; + + case CHARSET_include: /* used for include filenames */ + switch (ch) + { + case '%': /* for logic file names */ + case '.': + case ':': + case '\\': + case '/': + case '<': + case '>': + /* case '\"': */ + return 1; + default: goto DEFAULT; + } + break; + + case CHARSET_token: + default: +DEFAULT: + switch (ch) + { + case 0x20: + case 0x09: + case ',': + case '<': + case '>': + case '&': + case '$': + case '@': + return 0; + case '~': + case '_': + case 225: + return 1; + default: + if ((ch >= 'A' && ch <= 'Z') + ||(ch >= 'a' && ch <= 'z') + ||(ch >= '0' && ch <= '9') +#ifdef MSDOS + ||(ch >= 128 && ch <= 154) + ||(ch >= 160 && ch <= 165) +#endif + ) return 1; + return 0; + } + } + + return 0; +} diff --git a/app/ned/02/(dirinf).fm b/app/ned/02/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..14632d7511d230d702aa375a1148bf996e864b05 --- /dev/null +++ b/app/ned/02/(dirinf).fm @@ -0,0 +1,85 @@ +# +# FILE %ned/02/(dirinf).fm +# +# latest update: 2000-08-24 14:26:57 +# $Id: (dirinf).fm,v 1.3 2002/06/10 06:17:42 gonter Exp $ +# +# ---------------------------------------------------------------------------- + +Makefile | current makefile +make-dos | MSDOS makefile + +ned0201.c | set_cup (x, y) +ned0202.c | void setcup () +ned0203.c | void wd_displine (w, l_ptr, l_num) +ned0204.c | void ned_display_window (w, wi) +ned0204b.c | void wd_2setup (struct WINDOWCTRL *w, int ya, int yb) +ned0204c.c | void ned_decorate_window (...) +ned0204g.c | void ned_line_info (w, wi) +ned0205.c | void wd_setup () +ned0206.c | void wda_setup () +ned0207.c | int wd_upscr () +ned0208.c | void p_upscr () +ned0209.c | void wd_dnscr () +ned0210.c | void p_dnscr () +ned0211.c | void p_wdwclose () +ned0211b.c | int ned_w_close_window (register struct WINDOWCTRL *wc) +ned0212.c | void p_wdwopen () +ned0213a.c | void p_wdwsize () +ned0213b.c | void q_wdwsize () +ned0213c.c | void q2_wdwsize (struct WINDOW_CTRL *w, int pos, ...); +ned0213d.c | int ned_tile_window (int argf) +ned0213e.c | p_wdwfaecher (); +ned0214.c | int pr_wdwsize (wc, p, f) +ned0215.c | int pr_wdwcreate (wc) +ned0215a.c | struct WINDOWCTRL *ned_create_editor_window (void); +ned0215b.c | struct WINDOWCTRL *ned_create_feature_window (void); +ned0215c.c | struct WINDOWCTRL *ned_create_window_pair (void); +ned0216.c | void p_wdwXup () +ned0217.c | void p_wdwXdn () +ned0218.c | void p_wdwXlt () +ned0219.c | void p_wdwXrt () +ned0220.c | void p_wdwAup () +ned0221.c | void p_wdwAdn () +ned0222.c | void p_wdwAlt () +ned0223.c | void p_wdwArt () +ned0224.c | void p_wdwBup () +ned0225.c | void p_wdwBdn () +ned0226.c | void p_wdwBlt () +ned0227.c | void p_wdwBrt () +ned0228.c | wd_show_wdnr (p, x, y, c, n) +ned0230.c | void q_wdwopen (); +ned0231.c | int p_wdwopen_link (); +ned0232.c | void p_switch_line_mode () +ned0232.c | memorize and restore window and line modes +ned0240.c | void vi_append (void); +ned0241.c | void vi_append_eol (void); +ned0242.c | void vi_insert_bol (void); +ned0243.c | void vi_bell () +ned0244.c | void vi_ex () +ned0245.c | void vi_dkey () +ned0246.c | void vi_insert_after_line (void); +ned0247.c | void vi_insert_before_line (void); +ned0248.c | void vi_repeat_last_command (void); +ned0248.c | int set_repeat_command (void (*fnc)(void)); +ned0249.c | void vi_join () +ned0250.c | int vi_change_text () +ned0251.c | void vi_substitute () +ned0252.c | void pico_mode () +ned0253.c | void wordstar_mode () +ned0253v.c | void vi_mode () +ned0254.c | void vi_change_2eoln () +ned0254b.c | void vi_change_2boln () +ned0255.c | void vi_change_line () +ned0256.c | void vi_jmp_boln () +ned0256a.c | void vi_jmp_column () +ned0257.c | void vi_jmp_prev_boln () +ned0258.c | void vi_jmp_next_boln () +ned0259.c | void ex_tag_command (char *s) +ned0260.c | struct MARKER *ned_get_marker (char *s) +ned0260b.c | int ned_jmp_marker (char *s, int flag) +ned0260c.c | int ned_set_marker (char *s) +ned0261.c | void vi_digit () +ned0262a.c | vi_jmp_2line +ned0263.c | ned_yank_block +* | diff --git a/app/ned/02/Makefile b/app/ned/02/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..7ff07e1de5d02036be2b4c138d0e28f608879042 --- /dev/null +++ b/app/ned/02/Makefile @@ -0,0 +1,140 @@ +# +# FILE %ned/02/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# see also: make-dos +# +# written: 1993-01-01 +# latest update: 2000-08-30 20:56:30 +# $Id: Makefile,v 1.11 2012/08/10 14:44:20 gonter Exp $ +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +PFX= /usr/local/include/ +# TCL_VER=8.0 +# TCL_VER=8.3 +# TCL_VER=8.4 +# OPTS2=-I/usr/X11R6/include -I$(PFX)tcl${TCL_VER} -I${PFX}tk${TCL_VER} +OPTS2=-I/usr/X11R6/include -I/usr/include/tcl8.4 +OPTS=-c -g -I.. $(cf) +CC=cc +objs= \ + ned0204.o ned0204b.o ned0204g.o \ + ned0206.o ned0208.o \ + ned0210.o ned0211.o ned0212.o \ + ned0213c.o ned0213d.o ned0213e.o \ + ned0214.o ned0215a.o ned0215b.o ned0215c.o ned0216.o \ + ned0217.o ned0218.o ned0219.o ned0220.o \ + ned0221.o ned0222.o ned0223.o ned0224.o \ + ned0225.o ned0226.o ned0227.o \ + ned0231.o ned0232.o \ + ned0240.o ned0241.o ned0242.o \ + ned0246.o ned0247.o \ + ned0248.o ned0249.o ned0250.o ned0251.o \ + ned0252.o ned0253.o ned0253v.o ned0254.o ned0254b.o \ + ned0255.o ned0256.o ned0256a.o ned0257.o \ + ned0258.o ned0259.o ned0260.o ned0260b.o ned0260c.o ned0261.o \ + ned0262a.o ned0263.o +objs_cur= ned0202_cur.o ned0203_cur.o ned0204c_cur.o ned0207_cur.o \ + ned0209_cur.o ned0211b_cur.o ned0213a_cur.o ned0213b_cur.o ned0228_cur.o \ + ned0230_cur.o ned0243_cur.o ned0244_cur.o ned0245_cur.o +objs_tk= ned0202_tk.o ned0203_tk.o ned0204c_tk.o ned0207_tk.o \ + ned0209_tk.o ned0211b_tk.o ned0213a_tk.o ned0213b_tk.o ned0228_tk.o \ + ned0230_tk.o ned0243_tk.o ned0244_tk.o ned0245_tk.o +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_cur lib_tk +clean : + rm -f *.o lib_tk lib_cur + +lib_tk : $(objs_tk) $(objs) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h + $(CC) $(OPTS) $*.c + +# --- cur Modules ---------- +ned0202_cur.o : ../ed.h ned0202.c + $(CC) $(OPTS) -o ned0202_cur.o ned0202.c + +ned0203_cur.o : ../ed.h ned0203.c + $(CC) $(OPTS) -o ned0203_cur.o ned0203.c + +ned0204c_cur.o : ../ed.h ned0204c.c + $(CC) $(OPTS) -o ned0204c_cur.o ned0204c.c + +ned0207_cur.o : ../ed.h ned0207.c + $(CC) $(OPTS) -o ned0207_cur.o ned0207.c + +ned0209_cur.o : ../ed.h ned0209.c + $(CC) $(OPTS) -o ned0209_cur.o ned0209.c + +ned0211b_cur.o : ../ed.h ned0211b.c + $(CC) $(OPTS) -o ned0211b_cur.o ned0211b.c + +ned0213a_cur.o : ../ed.h ned0213a.c + $(CC) $(OPTS) -o ned0213a_cur.o ned0213a.c + +ned0213b_cur.o : ../ed.h ned0213b.c + $(CC) $(OPTS) -o ned0213b_cur.o ned0213b.c + +ned0228_cur.o : ../ed.h ned0228.c + $(CC) $(OPTS) -o ned0228_cur.o ned0228.c + +ned0230_cur.o : ../ed.h ned0230.c + $(CC) $(OPTS) -o ned0230_cur.o ned0230.c + +ned0243_cur.o : ../ed.h ned0243.c + $(CC) $(OPTS) -o ned0243_cur.o ned0243.c + +ned0244_cur.o : ../ed.h ned0244.c + $(CC) $(OPTS) -o ned0244_cur.o ned0244.c + +ned0245_cur.o : ../ed.h ned0245.c + $(CC) $(OPTS) -o ned0245_cur.o ned0245.c + +# --- tk Modules ---------- +ned0202_tk.o : ../ed.h ned0202.c + $(CC) $(OPTS) $(OPTS2) -DUSE_TK -o ned0202_tk.o ned0202.c + +ned0203_tk.o : ../ed.h ned0203.c + $(CC) $(OPTS) $(OPTS2) -DUSE_TK -o ned0203_tk.o ned0203.c + +ned0204c_tk.o : ../ed.h ned0204c.c + $(CC) $(OPTS) -DUSE_TK -o ned0204c_tk.o ned0204c.c + +ned0207_tk.o : ../ed.h ned0207.c + $(CC) $(OPTS) -DUSE_TK -o ned0207_tk.o ned0207.c + +ned0209_tk.o : ../ed.h ned0209.c + $(CC) $(OPTS) -DUSE_TK -o ned0209_tk.o ned0209.c + +ned0211b_tk.o : ../ed.h ned0211b.c + $(CC) $(OPTS) -DUSE_TK -o ned0211b_tk.o ned0211b.c + +ned0213a_tk.o : ../ed.h ned0213a.c + $(CC) $(OPTS) -DUSE_TK -o ned0213a_tk.o ned0213a.c + +ned0213b_tk.o : ../ed.h ned0213b.c + $(CC) $(OPTS) -DUSE_TK -o ned0213b_tk.o ned0213b.c + +ned0228_tk.o : ../ed.h ned0228.c + $(CC) $(OPTS) -DUSE_TK -o ned0228_tk.o ned0228.c + +ned0230_tk.o : ../ed.h ned0230.c + $(CC) $(OPTS) -DUSE_TK -o ned0230_tk.o ned0230.c + +ned0243_tk.o : ../ed.h ned0243.c + $(CC) $(OPTS) -DUSE_TK -o ned0243_tk.o ned0243.c + +ned0244_tk.o : ../ed.h ned0244.c + $(CC) $(OPTS) -DUSE_TK -o ned0244_tk.o ned0244.c + +ned0245_tk.o : ../ed.h ned0245.c + $(CC) $(OPTS) -DUSE_TK -o ned0245_tk.o ned0245.c diff --git a/app/ned/02/contrib b/app/ned/02/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/02/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/02/gg b/app/ned/02/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/02/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/02/lib_cur b/app/ned/02/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/02/lib_tk b/app/ned/02/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/02/make-dos b/app/ned/02/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..7692742a0c557ee0c3f43861a06647fcf7bd22aa --- /dev/null +++ b/app/ned/02/make-dos @@ -0,0 +1,38 @@ +# +# FILE %ned/02/makefile +# +# GG's Night(mare) Editor System +# see also: make-ux +# +# latest update: 1997-09-07 12:32:38 +# +# ============================================================================ +cc=cl -Os -AL /c +ccc=cl -Os -AL /W3 /Fo$@ -I.. /c +obj=objdec -m0 -w -d -sl 2 NED02_TEXT $@ + +lib : ! + ned0202.obj ned0203.obj ned0204.obj ned0204b.obj ned0204c.obj ! + ned0206.obj ned0207.obj ned0208.obj ! + ned0209.obj ned0210.obj ned0211.obj ned0211b.obj ned0212.obj ! + ned0213a.obj ned0213b.obj ned0213c.obj ned0213d.obj ! + ned0213e.obj ! + ned0214.obj ned0215a.obj ned0215b.obj ned0215c.obj ! + ned0216.obj ! + ned0217.obj ned0218.obj ned0219.obj ned0220.obj ! + ned0221.obj ned0222.obj ned0223.obj ned0224.obj ! + ned0225.obj ned0226.obj ned0227.obj ned0228.obj ! + ned0230.obj ned0231.obj ned0232.obj ! + ned0240.obj ned0241.obj ned0242.obj ned0243.obj ! + ned0244.obj ned0245.obj ned0246.obj ned0247.obj ! + ned0248.obj ned0249.obj ned0250.obj ned0251.obj ! + ned0252.obj ned0253.obj ned0253v.obj ned0254.obj ned0254b.obj ! + ned0255.obj ned0256.obj ned0256a.obj ! + ned0257.obj ned0258.obj ned0259.obj ! + ned0260.obj ned0260b.obj ned0260c.obj ned0261.obj ned0262a.obj ! + ned0263.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $*.c + $(obj) diff --git a/app/ned/02/ned0202.c b/app/ned/02/ned0202.c new file mode 100644 index 0000000000000000000000000000000000000000..2f3a287ac2fde6561c4763edf37fa0da39e08849 --- /dev/null +++ b/app/ned/02/ned0202.c @@ -0,0 +1,50 @@ +/* + * FILE %ned/02/ned0202.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1997-01-12 16:51:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +struct WINDOWCTRL *aw; +extern int akt_page; + +/* ------------------------------------------------------------------------ */ +void setcup (register struct WINDOWCTRL *w) +{ + register int l; + + if (w == (struct WINDOWCTRL *) 0) return; + + l= (w->WC_act == (struct LINE *) 0) ? 0 : w->WC_act->lng; + + if (w->hv + w->cx - w->ax >= l) + w->cx= l - w->hv + w->ax; + + while (w->cx < 0) + { + w->hv -= w->cx; + w->cx= 0; + } + + if (w->hv < 0) + { + w->cx -= w->hv; + w->hv= 0; + } + + if (w->cx > w->bx || w->cy > w->by) return; + w_setcup (akt_page, w->cx, w->cy); +} diff --git a/app/ned/02/ned0203.c b/app/ned/02/ned0203.c new file mode 100644 index 0000000000000000000000000000000000000000..8e0ff696643a5b6434d7b35b3ed9a7591ef37504 --- /dev/null +++ b/app/ned/02/ned0203.c @@ -0,0 +1,385 @@ +/* + * FILE %ned/02/ned0203.c + * + * display one line + * - TK_VERSION + * + * written: 1987 04 08 + * 1991 05 26: Revision + * 1991 07 04: Vollstaendige Ueberarbeitung, BLIT Puffer + * latest update: 1999-07-17 19:35:39 + * $Id: ned0203.c,v 1.4 2005/06/14 02:36:06 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> + +#ifdef USE_TK +#include <tcl.h> +#include <tk.h> +#include "edtcl.h" +#include "edtk.h" +#endif /* USE_TK */ + +#include "proto.h" + +extern int CHR_FILLER; +extern int CHR_TAB_FILLER; +extern int DISPLAY_TABS; +extern int akt_page; +extern int blk, block_mode; +extern int COL_BLOCK, COL_FEATURE; +extern int ned_tabsize; +extern struct MARKER b_beg, b_end; + +#ifndef USE_TK +/* #define VERSION_OLD_001 */ +#endif +#define NEW_VERSION + +#ifdef _AIX +#define __FLIP_FILLER +#endif /* _AIX */ + +#ifdef __hpux +#define __FLIP_FILLER +#endif /* _AIX */ + +#ifdef __SINIX__ +#define __FLIP_FILLER +#endif + +/* ------------------------------------------------------------------------ */ +#ifdef NEW_VERSION + +#ifdef MSDOS +#define BLIT_LINE_SIZE 134 /* maximum line length to use */ +#else +#define BLIT_LINE_SIZE 1024 +#endif +#define BLIT_LINE_LNG 2*BLIT_LINE_SIZE + +static char blit_line [BLIT_LINE_LNG]; /* Struktur: (char,colour) *134 */ + +#ifdef USE_TK +/* BUG HERE */ +#define MAX_GCS 128 +static GC GC_table [MAX_GCS]; /* table of different GCs */ +static int GC_table_size; /* number of different GCs */ +static int GC_index [BLIT_LINE_LNG]; /* GC idx table for each char pos */ +#endif /* USE_TK */ + +/* ------------------------------------------------------------------------ */ +#ifdef USE_TK +int place_GC (GC gc) +{ + if (GC_table_size >= MAX_GCS) return -1; + + GC_table [GC_table_size]= gc; + return GC_table_size++; +} +#endif /* USE_TK */ + +/* ------------------------------------------------------------------------ */ +/* This function is used to display one horizontal region within a line. */ +/* The region may extend from the left edge to the right edge of the */ +/* window, however, it is also possible to display just a smaller portion */ +/* in response to a exposure event or something similar. */ +void wd_displine ( +register struct WINDOWCTRL *w, /* bearbeitetes Window */ +register struct LINE *l_ptr, /* Datenstruktur fuer eine Zeile */ + /* NOTE: NULL is a legal value !!! */ +int l_num, /* Line Number == Schirmzeile */ +int xa, /* horizontal region begin */ +int xb) /* horizontal region end */ +{ +#ifdef USE_TK + NED_Widget *nw; /* widget to be drawn */ + Drawable da; /* pixel area in widget to be drawn */ + Display *dpy; /* display control structure */ + int y_pos; /* vertical string position in pixels */ + int x_pos= 0; /* horizontal string position in pixels */ + int x_width; /* width of a single character */ + int *bip; /* pointer into GC_index */ +#define CHAR_SKIP 1 +#else + short *bip; /* 16-bit string transfer buffer pointer */ + int ap; +#define CHAR_SKIP 2 +#endif /* !USE_TK */ + + int i; + int idx; /* index in character and GC buffer */ + int colour; /* aktuelle Darstellungsfarbe */ + register struct TXT *tx; /* current text segment */ + register int ih; /* Index im Text Segment */ + register int ti; /* Index im Text Segment */ + int tlng; /* length of the current text segment */ + int wx; /* number of chars in display region */ + int ahx; /* region start position within the line */ + int l_lng; /* full line length */ + int xblock_mode; /* assumed block display mode */ + struct FEATURE *p_ftr; /* currently processed feature element */ + char *cp; /* text segment pointer */ + char *bp; /* char-wise transfer buffer pointer */ + int ch; /* character being examined */ + int f_pos; /* feature position */ + + if (xa < w->ax) xa= 0; + if (xb > w->bx) xb= w->bx; + if (xa > xb) return; /* actually, nothing to do ... */ + /* It's possible that xa == xb, e.g. for */ + /* redisplaying the character at cursor pos.*/ + wx= xb - xa + 1; + ahx= w->hv + xa - w->ax; + +#ifdef USE_TK + if ((nw= w->wc_widget) == (NED_Widget *) 0 + || nw->ned_window != w /* not linked, must be in error! */ + ) return; + + da= Tk_WindowId (nw->tkwin); + dpy= nw->display; + + y_pos= l_num * nw->line_height + nw->char_ascent; + x_width= nw->char_width; + x_pos= xa * x_width; + + GC_table_size= 0; + + colour= place_GC ((l_ptr != (struct LINE *) 0 + && (l_ptr->line_flg & LINE_HIDDEN) + ) + ? nw->hiddenTextGC + : nw->normalTextGC); + bip= GC_index; +#else /* ^ USE_TK ^ *** v !USE_TK v */ + ap= akt_page; + /* Blit Puffer mit Colour Codes initialisieren */ + + colour= (l_ptr != (struct LINE *) 0 && (l_ptr->line_flg & LINE_HIDDEN)) + ? 0x03 : w->attr_text; /* @@@ T2D */ +#ifdef __FLIP_FILLER + colour= (CHR_FILLER << 8) + colour; +#else + colour= CHR_FILLER + (colour << 8); +#endif /* __FLIP_FILLER */ + + bip= (short *) blit_line; +#endif /* !USE_TK */ + + /* reset colour index buffer and text buffer */ + bp= blit_line; + for (i= wx; i > 0; i--) *bp++= ' '; + if (l_ptr == (struct LINE *) 0) + { + for (i= wx; i > 0; i--) *bip++= colour; + goto REST; + } + + if (blk && (l_ptr->line_flg & LINE_inBLOCK)) + if (block_mode == BLOCK_MODE_standard) + if (b_beg.ptr == l_ptr) + if (b_end.ptr == l_ptr) + xblock_mode= 3; /* block begins and ends... */ + else xblock_mode= 4; /* block begins here */ + else if (b_end.ptr == l_ptr) + xblock_mode= 5; /* block ends here */ + else xblock_mode= 2; /* complete line in block */ + else xblock_mode= block_mode; + else xblock_mode= 0; + + if (xblock_mode == 2) /* the complete line is part of a marked */ + { /* block, so switch the text color to block */ + /* color and proceed in standard line */ + /* display mode. */ +#ifdef USE_TK + colour= place_GC (ned_get_blk_GC (nw)); +#else + colour= 0x20 + (COL_BLOCK << 8); +#endif + xblock_mode= 0; + } + + /* Colour Attribute eines active markups checken */ + /* T2D: @@@ not fully implemented */ + /* T2D: 2000-12-09 Core Dump in the next line! */ + if ((p_ftr= l_ptr->l_active_ftr) != (struct FEATURE *) 0 + && p_ftr->ftr_display_mode == FTR_display_region + && p_ftr->ftr_colour < 0x0100 + ) + { + xblock_mode= 0; +#ifdef USE_TK + colour= place_GC (ned_tk_get_GC (nw, p_ftr->ftr_colour)); +#else + colour= 0x20 + (p_ftr->ftr_colour << 8); +#endif /* !USE_TK */ + } + + /* reset colour index buffer and text buffer */ + for (i= wx; i > 0; i--) *bip++= colour; + + if (xblock_mode) /* marked block begins in just that line */ + { + int j; + +#ifdef USE_TK + colour= place_GC (ned_get_blk_GC (nw)); + bip= GC_index; +#else + colour= 0x20 + (COL_BLOCK << 8); + bip= (short *) blit_line; +#endif + + j= b_beg.offset - ahx; + switch (xblock_mode) + { + case 3: + if (j >= wx) goto NEXT1; + i= b_end.offset - b_beg.offset; + if (j < 0) + { + i += j; + j= 0; + } + bip += j; + break; + case 4: /* block begins here */ + if (j < 0) j= 0; /* hmpf? */ + bip += j; + i= wx - j; + break; + case 5: /* block ends here */ + i= b_end.offset - ahx; + break; + } + + if (i < 0) i= 0; + if (i > wx) i= wx; + for (; i > 0; i--) *bip++= colour; + } + +NEXT1: + /* zuletzt Colour Attribute von Markups in der Zeile einsetzen */ + for (p_ftr = l_ptr->ftr; + p_ftr != (struct FEATURE *) 0; + p_ftr = p_ftr->ftr_next) + { + f_pos= p_ftr->ftr_pos; + + switch (p_ftr->ftr_display_mode) + { + case FTR_display_hide: + continue; + case FTR_display_region: + i= wx - f_pos - ahx; + break; + case FTR_display_point: + if ((i= p_ftr->ftr_replarray_size) <= 0) i= 1; + break; + case FTR_display_replarray: + i= p_ftr->ftr_replarray_size; + break; + } + + /* if (i+f_pos > wx) i= wx - f_pos; ### HV !!! */ + +#ifdef USE_TK + colour= place_GC (ned_tk_get_GC (nw, p_ftr->ftr_colour)); + idx= f_pos - ahx; + + for (; i > 0; i--, idx++) if (idx >= 0) GC_index [idx]= colour; + +#else + bp= &blit_line [(f_pos - ahx)*2 + 1]; + colour= p_ftr->ftr_colour; + if (colour == 0x0100) colour= w->attr_text; else + if (colour == 0x0200 || colour == 0x0000) colour= COL_FEATURE; + for (; i > 0; i--, bp += 2) *bp= (char) colour; +#endif + } + + /* Start des Textes suchen */ + if (l_ptr->lng == 0 || (tx= l_ptr->txt) == (struct TXT *) 0) goto REST; + + tlng= tx->t_lng; + for (ti= ahx;;) + { + if (ti - tlng < 0) break; + ti -= tlng; + if ((tx= tx->next) == (struct TXT *) 0) + goto REST; /* Fehler: zuwenige Textsegmente */ + tlng= tx->t_lng; + } + + ih= ahx; + l_lng= l_ptr->lng; + cp= &(tx->t [ti]); + + /* Character Codes in Puffer eintragen */ + bp= blit_line; + i= wx; + while (i-- > 0 && ih++ < l_lng) + { + ch= *cp++ & 0x00FF; + +#ifdef __EXPERIMENTAL__ /* 1996-07-26 2:29:19 */ + if (ch == 0x09) + { + int num_tabs; + + num_tabs= ned_tabsize - (ahx % ned_tabsize); + + while (i-- > 0 && num_tabs-- > 0) + { + *bp= (char) CHR_TAB_FILLER; /* character code */ + bp += CHAR_SKIP; /* colour code ist ok */ + ahx++; + } + } + else +#endif /* __EXPERIMENTAL__ 1996-07-26 2:29:19 */ + { + *bp= (char) ch; /* character code */ + bp += CHAR_SKIP; /* colour code ist ok */ + ahx++; + } + + if (++ti >= tlng) + { + if ((tx= tx->next) == (struct TXT *) 0) break; + tlng= tx->t_lng; + ti= 0; + cp= tx->t; + } + } + +REST: + /* Puffer auf den Schirm knallen */ +#ifdef USE_TK + for (i= 0; i < wx;) + { + int j; + + bp= blit_line+i; + bip= GC_index+i; + colour= *bip; + for (j= 0; i+j < wx; j++) if (colour != *bip++) break; + + XDrawImageString (dpy, da, GC_table [colour], x_pos, y_pos, bp, j); + i += j; + x_pos += x_width * j; + } +#else + w_blit_line (ap, xa, l_num, wx, blit_line); +#endif + + w->l_upd= 0; +} +#endif /* NEW_VERSION */ diff --git a/app/ned/02/ned0204.c b/app/ned/02/ned0204.c new file mode 100644 index 0000000000000000000000000000000000000000..a49155202867c6557ad1ac5df1d0956e6698ea17 --- /dev/null +++ b/app/ned/02/ned0204.c @@ -0,0 +1,32 @@ +/* + * FILE %ned/02/ned0204.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1990 01 28: Revision + * 1991 05 25: Revision + * latest update: 1997-06-14 19:37:44 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_display_window (struct WINDOWCTRL *w) +{ + if (w == (struct WINDOWCTRL *) 0) return; + + wd_2setup (w, w->ax, w->ay, w->bx, w->by); + ned_decorate_window (w); + + setcup (w); + w->w_upd= 0; /* clear window update flags */ +} diff --git a/app/ned/02/ned0204b.c b/app/ned/02/ned0204b.c new file mode 100644 index 0000000000000000000000000000000000000000..fa4b9afd2e4974d926767a05eff0a8a11ebf89d4 --- /dev/null +++ b/app/ned/02/ned0204b.c @@ -0,0 +1,60 @@ +/* + * FILE %ned/02/ned0204b.c + * + * display the text section of a window + * T2D: hidden lines + * + * written: 1987 04 08 + * 1990 01 28: Revision + * 1991 05 25: Revision + * latest update: 1999-07-17 18:10:08 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void wd_2setup ( +struct WINDOWCTRL *w, +int xa, +int ya, +int xb, +int yb) +{ + register struct LINE *p; + int i; + + p= w->first; + + if (ya < w->ay) ya= w->ay; + if (yb > w->by) yb= w->by; /* clip */ + if (ya > yb) return; + + /* skip line pointer to first line drawn */ + for (i= w->ay; i < ya; i++) + if (p != (struct LINE *) 0) p= p->next; + + /* display each line in region */ + for (i= ya; i <= yb; ) + { + if (p != (struct LINE *) 0 + && (p->line_flg & LINE_HIDDEN) + && i != ya /* show first line */ + ) + goto NEXT; + + wd_displine (w, p, i++, xa, xb); + + if (p != (struct LINE *) 0) + { +NEXT: + p= p->next; + } + } +} diff --git a/app/ned/02/ned0204c.c b/app/ned/02/ned0204c.c new file mode 100644 index 0000000000000000000000000000000000000000..6cf948d53d911ad4404a5a1485e39152db580418 --- /dev/null +++ b/app/ned/02/ned0204c.c @@ -0,0 +1,59 @@ +/* + * FILE %ned/02/ned0204c.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1996-05-26 extracted from ned0204.c + * latest update: 1997-10-26 9:18:53 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern int COL_WIN_NUM; +#ifdef MSDOS +extern struct WINDOWCTRL *aw; +extern int akt_page; +#endif /* MSDOS */ + +/* ------------------------------------------------------------------------ */ +void ned_decorate_window (struct WINDOWCTRL *w) +{ + int wp; + int wi; /* Window Index (Nummer des Windows) */ + + if (w == (struct WINDOWCTRL *) 0) return; + + wi= w->wc_window_number; + +#ifdef MSDOS + if ((wp= w->page) != akt_page) w_selpage (wp= akt_page= aw->page); +#else + wp= 0; +#endif + +#ifndef USE_TK + if ((w->w_upd & 0x04) && w->box_type) + { + w_disp_box (wp, w->ax-1, w->ay-1, w->bx+1, w->by+1, + w->attr_box, w->box_type, 0x00FA); + if (w->box_type == BOX_TYPE_single + || w->box_type == BOX_TYPE_double) + wd_show_wdnr (wp, w->ax, w->ay-1, COL_WIN_NUM, wi); + /*** w_setcup (wp, 0, 0); ???? 1996-05-26 18:45:37 */ + } +#else + wd_show_wdnr (wp, w->ax, w->ay-1, COL_WIN_NUM, wi); +#endif + + window_status (w); /* show window status line */ + ned_show_display_range (w); /* show the window range within the file */ + show_buttons (w); /* also display the buttons */ +} diff --git a/app/ned/02/ned0204g.c b/app/ned/02/ned0204g.c new file mode 100644 index 0000000000000000000000000000000000000000..f485908889f35943d88a857b42f41a8c48deb0c8 --- /dev/null +++ b/app/ned/02/ned0204g.c @@ -0,0 +1,48 @@ +/* + * FILE %ned/02/ned0204g.c + * + * written: 2002-06-08 + * latest update: 2002-06-08 11:44:40 + * $Id: ned0204g.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_line_info (void) +{ + struct FILECTRL *fc; + char *fileentry; + char info[80]; + char *modinfo; + + if (aw == (struct WINDOWCTRL *) 0 + || (fc= (struct FILECTRL *) aw->file_or_frame) == (struct FILECTRL *) 0 + ) return; + + fileentry= aw->WC_title_short; + if (fileentry == (char *) 0) fileentry= "???"; + + aw->tlines= ned_cnt_total_lines (aw->WC_act); + if (aw->tlines) + { + sprintf (info, "%d of %d [%d%%]", aw->znr, aw->tlines, + aw->znr*100/aw->tlines); + } + else strcpy (info, "empty file"); + + modinfo= (aw->f_upd) ? ": " : ": un"; + + ned_message_4 (fileentry, modinfo, "modified: line ", info); +} diff --git a/app/ned/02/ned0205.c b/app/ned/02/ned0205.c new file mode 100644 index 0000000000000000000000000000000000000000..4b88d3d55b9c92cddef771bf5628ea4897488c01 --- /dev/null +++ b/app/ned/02/ned0205.c @@ -0,0 +1,29 @@ +/* + * FILE %ned/02/ned0205.c + * + * *** OBSOLETE *** + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * latest update: 1996-03-17 11:50:13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void wd_setup () +{ + *** OBSOLETE *** + wd_1setup (aw; + *** OBSOLETE *** +} diff --git a/app/ned/02/ned0206.c b/app/ned/02/ned0206.c new file mode 100644 index 0000000000000000000000000000000000000000..75579f42f98f13f1b9a95ca92a727d26dcbc3bc6 --- /dev/null +++ b/app/ned/02/ned0206.c @@ -0,0 +1,63 @@ +/* + * FILE %ned/02/ned0206.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1996-05-26 22:46:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern struct WINDOWCTRL *windows; +extern struct WINDOWCTRL *aw; +extern int akt_page; + +/* ------------------------------------------------------------------------ */ +void wda_setup () +{ + int wi= 1; + register struct WINDOWCTRL *w; + int xax, xay, xbx, xby; + + xax= aw->ax; xay= aw->ay; + xbx= aw->bx; xby= aw->by; + + for (w= windows; w != (struct WINDOWCTRL *) 0; w= w->WC_next) + { + w->wc_window_number= wi++; + + if (w->page == akt_page + && w != aw + && (w->ax < xax || w->ay < xay /* nur sichtbare Windows */ + || w->bx > xbx || w->by > xby /* werden neu aufgebaut! */ + ) + ) + { + if (w->w_upd & 0x02) + { + /**** ned_jmp_2line_by_nr (w, w->znr, 0x00); 1996-05-26 22:44:34 ****/ + ned_w_jmp_aktline (w, NEDJMP_LINE_3, 0, 0x00); + } + w->w_upd |= 0x05; + ned_display_window (w); + } + } + + if (aw->w_upd & 0x02) + { + /***** ned_jmp_2line_by_nr (aw, aw->znr, 0x00); 1996-05-26 22:45:56 */ + ned_w_jmp_aktline (aw, NEDJMP_LINE_3, 0, 0x00); + } + aw->w_upd |= 0x05; + ned_display_window (aw); +} diff --git a/app/ned/02/ned0207.c b/app/ned/02/ned0207.c new file mode 100644 index 0000000000000000000000000000000000000000..72da37d1f61c0977d7039907c1e46fa96a2034b6 --- /dev/null +++ b/app/ned/02/ned0207.c @@ -0,0 +1,38 @@ +/* + * FILE %ned/02/ned0207.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1991 05 26: Revision + * latest update: 1997-09-14 10:59:06 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int wd_upscr (struct WINDOWCTRL *wc) +{ + register struct LINE *lp; + int i; + + if ((lp= wc->first) == (struct LINE *) 0) return 0; + + w_scrblk_up (wc->ax, wc->ay, wc->bx, wc->by, wc->attr_text, 1); + + for (i= wc->ay; i < wc->by; i++) + if (lp != (struct LINE *) 0) lp= lp->next; + + wd_displine (wc, lp, i, wc->ax, wc->bx); + if ((wc->znr % 20) == 1) ned_show_display_range (wc); + + return 1; +} diff --git a/app/ned/02/ned0208.c b/app/ned/02/ned0208.c new file mode 100644 index 0000000000000000000000000000000000000000..1f6a0efa227d52863048301f921921795d1b435f --- /dev/null +++ b/app/ned/02/ned0208.c @@ -0,0 +1,37 @@ +/* + * FILE %ned/02/ned0208.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1997-09-14 11:01:00 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_upscr () +{ + if (aw->first == (struct LINE *) 0 + || aw->first->next == (struct LINE *) 0 + ) return; + + aw->first= aw->first->next; + wd_upscr (aw); + if (aw->cy != aw->ay) + aw->cy--; + else { + aw->WC_act= aw->WC_act->next; + aw->znr++; + } +} diff --git a/app/ned/02/ned0209.c b/app/ned/02/ned0209.c new file mode 100644 index 0000000000000000000000000000000000000000..5cd8b5f987d5fe11ad47447083dbc2f6ecee4659 --- /dev/null +++ b/app/ned/02/ned0209.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/02/ned0209.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1997-09-14 11:06:52 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void wd_dnscr (struct WINDOWCTRL *wc) +{ + w_scrblk_down (wc->ax, wc->ay, wc->bx, wc->by, wc->attr_text, 1); + wd_displine (wc, wc->first, wc->ay, wc->ax, wc->bx); + if ((wc->znr%20) == 1) ned_show_display_range (wc); +} diff --git a/app/ned/02/ned0210.c b/app/ned/02/ned0210.c new file mode 100644 index 0000000000000000000000000000000000000000..77ea730ad38f792a4e746f6f88ba06987eeae6d3 --- /dev/null +++ b/app/ned/02/ned0210.c @@ -0,0 +1,37 @@ +/* + * FILE %ned/02/ned0210.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1991 05 30: Revision + * latest update: 1997-09-14 11:09:17 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_dnscr () +{ + if (aw->WC_first == (struct LINE *) 0 + || aw->WC_first->prev == (struct LINE *) 0 + ) return; + + aw->WC_first= aw->WC_first->prev; + wd_dnscr (aw); + if (aw->cy == aw->by) + { + aw->WC_act= aw->WC_act->prev; + aw->znr--; + } + else aw->cy++; +} diff --git a/app/ned/02/ned0211.001 b/app/ned/02/ned0211.001 new file mode 100644 index 0000000000000000000000000000000000000000..040ebd6f9b165efc9023485be81f786971b57805 --- /dev/null +++ b/app/ned/02/ned0211.001 @@ -0,0 +1,104 @@ +/* + * FILE %ned/02/ned0211.c + * + * close a window + * + * written: 1987 04 08 + * 1991 02 03: Revision + * 1991 06 02: Revision + * latest update: 1996-05-26 17:56:34 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <malloc.h> +#include "ed.h" +#include "proto.h" + +#define WINSTACK +#ifdef WINSTACK +extern struct PLIST *winstack; +#endif + +extern struct WINDOWCTRL *windows; +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_wdwclose () /* aktuelles Window killen */ +{ + register struct WINDOWCTRL *wc; + register struct FILECTRL *fc; + + if (oper_level >= LEV_LINK + || (wc= aw) == (struct WINDOWCTRL *) 0 + ) + return; + + ned_reset_markers (wc); /* reset markers which are in the current window */ + + if ((struct FILECTRL *) wc->file_or_frame != (struct FILECTRL *) 0 + && ((struct FILECTRL *) wc->file_or_frame)->FC_links <= 1 + && !(wc->WC_edit_mode & EDIT_NOTOGGLE) /* ??? */ + ) + return; /* can't close window */ + +#ifdef USE_TK + ned_tk_delete_association (wc); +#endif + +#ifdef WINSTACK + if (windows == wc) + { + if (wc->WC_next == (struct WINDOWCTRL *) 0) return; + windows= wc->WC_next; + } + + if (wc->file_type == FTY_PLAIN + && (fc=((struct FILECTRL *) wc->file_or_frame)) != (struct FILECTRL *) 0 + ) + fc->FC_links--; + + if (wc->WC_prev != (struct WINDOWCTRL *) 0) + wc->WC_prev->WC_next= wc->WC_next; + if (wc->WC_next != (struct WINDOWCTRL *) 0) + wc->WC_next->WC_prev= wc->WC_prev; + + winstack_delete (wc); + free (wc); + aw= (winstack != (struct WINDOWCTRL *) 0 && winstack->PL_val != (struct WINDOWCTRL *) 0) + ? winstack->PL_val : windows; + q2_jmpwdw (aw); +#else + if (windows == wc) + { + aw= aw->WC_next; + if (aw == (struct WINDOWCTRL *) 0) + { + aw= wc; + return; /* zu loeschendes Window ist das einzige */ + } + windows= aw; + } + else + { + aw= wc->WC_prev; + } + + if (wc->file_type == FTY_PLAIN + && ((struct FILECTRL *) wc->file_or_frame) != (struct WINDOWCTRL *) 0) + ((struct FILECTRL *) wc->file_or_frame)->FC_links--; + + if (wc->WC_prev != (struct WINDOWCTRL *) 0) + wc->WC_prev->WC_next= wc->WC_next; + if (wc->WC_next != (struct WINDOWCTRL *) 0) + wc->WC_next->WC_prev= wc->WC_prev; + free (wc); +#endif + + p_refresh_all (); +} diff --git a/app/ned/02/ned0211.c b/app/ned/02/ned0211.c new file mode 100644 index 0000000000000000000000000000000000000000..e9faacd8f785a5fb61ed9ee87e75b0488b3e5871 --- /dev/null +++ b/app/ned/02/ned0211.c @@ -0,0 +1,46 @@ +/* + * FILE %ned/02/ned0211.c + * + * close a window + * + * written: 1987 04 08 + * 1991 02 03: Revision + * 1991 06 02: Revision + * latest update: 1999-04-25 16:29:41 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +#ifdef WINSTACK +extern struct PLIST *winstack; +#endif + +extern struct WINDOWCTRL *windows; +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void ned_close_window () /* aktuelles Window killen */ +{ + if (oper_level >= LEV_LINK || ned_w_close_window (aw)) return; + +#ifdef WINSTACK + aw= (winstack != (struct PLIST *) 0 + && winstack->PL_val != (void *) 0 + ) + ? winstack->PL_val : windows; +#else + aw= windows; +#endif + + q2_jmpwdw (aw); + p_refresh_all (); +} diff --git a/app/ned/02/ned0211b.c b/app/ned/02/ned0211b.c new file mode 100644 index 0000000000000000000000000000000000000000..3274323f3dee1b665065117cdf776007970b24d3 --- /dev/null +++ b/app/ned/02/ned0211b.c @@ -0,0 +1,74 @@ +/* + * FILE %ned/02/ned0211b.c + * + * close a window + * + * written: 1996-05-26 extracted from ned0211.c + * latest update: 1999-04-25 16:29:44 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <stdlib.h> +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *windows; + +/* ------------------------------------------------------------------------ */ +int ned_w_close_window (register struct WINDOWCTRL *wc) +{ + register struct FILECTRL *fc; + + if (wc == (struct WINDOWCTRL *) 0) return -1; + + if ((struct FILECTRL *) wc->file_or_frame != (struct FILECTRL *) 0 + && ((struct FILECTRL *) wc->file_or_frame)->FC_links <= 1 + && !(wc->WC_edit_mode & EDIT_NOTOGGLE) /* ??? */ + ) + return -1; /* can't close window */ + + ned_reset_markers (wc); /* reset markers which are in the current window */ + +#ifdef USE_TK + ned_tk_delete_association (wc); +#endif + +#ifdef WINSTACK + if (windows == wc) + { + if (wc->WC_next == (struct WINDOWCTRL *) 0) return -1; + windows= wc->WC_next; + } + + winstack_delete (wc); +#else + if (windows == wc) /* window is the first in line */ + { + if (wc->WC_next == (struct WINDOWCTRL *) 0) + return -1; /* zu loeschendes Window ist das einzige */ + windows= wc->WC_next; + } +#endif + + if (wc->file_type == FTY_PLAIN + && (fc=((struct FILECTRL *) wc->file_or_frame)) != (struct FILECTRL *) 0 + ) + fc->FC_links--; + + if (wc->WC_prev != (struct WINDOWCTRL *) 0) + wc->WC_prev->WC_next= wc->WC_next; + if (wc->WC_next != (struct WINDOWCTRL *) 0) + wc->WC_next->WC_prev= wc->WC_prev; + + free_or_what (wc->WC_title_short); + free_or_what (wc->WC_title_long); + free (wc); + + return 0; +} diff --git a/app/ned/02/ned0212.c b/app/ned/02/ned0212.c new file mode 100644 index 0000000000000000000000000000000000000000..62ccbc9d57ace1317f90a6708e882afd5e15dfcd --- /dev/null +++ b/app/ned/02/ned0212.c @@ -0,0 +1,35 @@ +/* + * FILE %ned/02/ned0212.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1991 09 03: Revision + * latest update: 1997-10-26 11:11:42 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +int p_wdwopen () +{ + int win_num; + struct WINDOWCTRL *wc; + + if (oper_level >= LEV_LINK) return -1; + + q_wdwopen (&wc, &win_num); + q2_jmpwdw (wc); + q0_jmpwdw (wc); + + return win_num; +} diff --git a/app/ned/02/ned0213a.c b/app/ned/02/ned0213a.c new file mode 100644 index 0000000000000000000000000000000000000000..8526475f82030fa1939faad7cf74c7ae451efde3 --- /dev/null +++ b/app/ned/02/ned0213a.c @@ -0,0 +1,32 @@ +/* + * FILE %ned/02/ned0213a.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * latest update: 1997-01-12 17:28:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern int akt_page; +extern int COL_STATUS; +extern struct WINDOWCTRL *aw; +extern ned_input_handler *nextchar; + +/* ------------------------------------------------------------------------ */ +void p_wdwsize () +{ + w_setstring (akt_page, aw->ax+4, aw->ay-1, aw->ax+7, aw->ay-1, + COL_STATUS, "^O^W", 0x01); + + q_wdwsize ((*nextchar) ()); +} diff --git a/app/ned/02/ned0213b.c b/app/ned/02/ned0213b.c new file mode 100644 index 0000000000000000000000000000000000000000..043b2c1a0424e38475e3dba25a8a64bf902c5f9d --- /dev/null +++ b/app/ned/02/ned0213b.c @@ -0,0 +1,96 @@ +/* + * FILE %ned/02/ned0213b.c + * + * Bildschirmaufbau + * - resize one ore more windows + * + * written: 1987 04 08 + * 1994-05-23: isolated from ned0213.c + * latest update: 2000-08-25 19:31:22 + * $Id: ned0213b.c,v 1.3 2000/08/25 18:05:45 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void q_wdwsize (int k) +{ + struct WINDOWCTRL *xw; + +#ifdef USE_TK + switch (k) + { + case '-': case '+': + case 's': case 'S': + case 't': case 'T': + if ((xw= winstack_get (1)) == (struct WINDOWCTRL *) 0) + break; + + switch (k) + { + case '-': + case 's': + case 't': + ned_tk_window_dock (xw, aw, 't'); + break; + default: + ned_tk_window_dock (aw, xw, 't'); + break; + } + break; + } +#else + int pos1, pos2; + + switch (k) + { + case '/': + case 'f': case 'F': + ned_clear_screen (); + p_wdwfaecher (); + break; + + case '-': case '+': + case 's': case 'S': + case 't': case 'T': + switch (k) + { + case '-': + case 's': + case 't': + pos1= 2; + pos2= 8; + break; + default: + pos1= 8; + pos2= 2; + break; + } + + if ((xw= winstack_get (1)) == (struct WINDOWCTRL *) 0) + pos2= 0; + else /* setup previous window */ + { + get_window_number (xw); + q2_wdwsize (xw, pos1); + } + + /* setup current window */ + q2_wdwsize (aw, pos2); + break; + + default: + if (k >= '0' && k <= '9') + q2_wdwsize (aw, k-'0'); + break; + } +#endif /* !USE_TK */ +} diff --git a/app/ned/02/ned0213c.c b/app/ned/02/ned0213c.c new file mode 100644 index 0000000000000000000000000000000000000000..41b880d13ee7f314d11b0f08f5a637f428633e05 --- /dev/null +++ b/app/ned/02/ned0213c.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/02/ned0213c.c + * + * Bildschirmaufbau + * - resize one ore more windows + * + * written: 1987 04 08 + * 1994-08-20: isolated from ned0213b.c + * latest update: 1997-10-26 10:54:11 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void q2_wdwsize (struct WINDOWCTRL *w, int pos) +{ + ned_window_size (w, pos, 1); + ned_w_jmp_aktline (w, NEDJMP_LINE_3, 0, NEDJMP_FLAG_REDRAW); +} diff --git a/app/ned/02/ned0213d.c b/app/ned/02/ned0213d.c new file mode 100644 index 0000000000000000000000000000000000000000..dddfd33defa70f6644b742065708c4bc002917b7 --- /dev/null +++ b/app/ned/02/ned0213d.c @@ -0,0 +1,78 @@ +/* + * FILE %ned/02/ned0213d.c + * + * Window Tiling Code, originally used in %ned/ned00.c to arrange + * windows for more than one window. + * + * written: 1995-10-01 + * latest update: 1997-10-26 11:09:45 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +#define TOP_LINE 2 +extern struct WINDOWCTRL *aw, *windows;; +extern int NED_TEXT_MAX_X, NED_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +int ned_tile_window (int argf) +{ + int window_top_line; + int lines_per_window; + int i; + + /* windows festlegen */ + aw= windows; + lines_per_window= (NED_TEXT_MAX_Y-2)/argf; + window_top_line= TOP_LINE+1; + + for (i= 0; i < argf; i++) + { + if (aw->w_upd & 0x80) + { + /* Window per Setup-File definiert */ + aw->hv= 0; + aw->cx= aw->ax; + aw->cy= aw->ay; + } + else + { /* Window noch undefiniert */ + aw->hv= 0; + aw->cy= + aw->ay= window_top_line; +#ifdef MAKE_WINDOW_FRAMES + aw->ax= 1; + aw->cx= 1; + aw->bx= NED_TEXT_MAX_X-2; + window_top_line += lines_per_window + + ((i) ? 0 : ((NED_TEXT_MAX_Y-2) % argf)); +#else + aw->ax= 0; + aw->cx= 0; + aw->bx= NED_TEXT_MAX_X-1; + window_top_line += lines_per_window + + ((i) ? 0 : ((NED_TEXT_MAX_Y-1) % argf)); +#endif /* !MAKE_WINDOW_FRAMES */ + aw->by= window_top_line - 3; + } + + if (aw->next == (struct WINDOWCTRL *) 0) break; + aw= aw->next; + } + + if (aw != (struct WINDOWCTRL *) 0 /* letztes Window bekommt */ + && !(aw->w_upd & 0x80)) /* den Rest des Schirms. */ +#ifdef MAKE_WINDOW_FRAMES + aw->by= NED_TEXT_MAX_Y-2; +#else + aw->by= NED_TEXT_MAX_Y-1; +#endif /* !MAKE_WINDOW_FRAMES */ + + return 0; +} diff --git a/app/ned/02/ned0213e.c b/app/ned/02/ned0213e.c new file mode 100644 index 0000000000000000000000000000000000000000..675a829208197e22f458f0706c11660c1cdd8103 --- /dev/null +++ b/app/ned/02/ned0213e.c @@ -0,0 +1,67 @@ +/* + * FILE %ned/02/ned0213e.c + * + * screen control + * - rearange the windows in a stacked mode + * + * written: 1987 04 08 + * latest update: 1997-10-26 11:10:21 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +#define H_OFFSET 5 + +extern struct WINDOWCTRL *aw, *windows; +extern int NED_TEXT_MAX_X, NED_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +void p_wdwfaecher () +{ + int ccx, ccy; + int aax, aay; + int w_text_max_x; + int w_text_max_y; + int w_cnt= 1; /* number of windows */ + int w_num; /* current window */ + + struct WINDOWCTRL *wc; + + w_text_max_x= NED_TEXT_MAX_X; + w_text_max_y= NED_TEXT_MAX_Y; + + for (wc= windows; + wc->WC_next != (struct WINDOWCTRL *) 0; + wc= wc->WC_next) w_cnt++; + + if (w_cnt <= 1 || w_cnt >= 10) goto DONE; + + for (w_num= w_cnt-1; + wc != (struct WINDOWCTRL *) 0; + wc= wc->WC_prev, w_num--) + { + ccx= wc->cx; ccy= wc->cy; + aax= wc->ax; aay= wc->ay; + + wc->ax= 1 + H_OFFSET*w_num; + wc->bx= w_text_max_x + 3 - H_OFFSET*(w_cnt - w_num); + wc->ay= 2 + w_cnt - w_num; + wc->by= w_text_max_y - 2 - w_num; + + wc->cx += wc->ax - aax; + wc->cy += wc->ay - aay; + wc->w_upd |= 0x05; + + ned_w_jmp_aktline (wc, NEDJMP_LINE_3, 0, NEDJMP_FLAG_REDRAW); + } + +DONE: + aw->w_upd |= 0x05; + ned_display_window (aw); +} diff --git a/app/ned/02/ned0214.c b/app/ned/02/ned0214.c new file mode 100644 index 0000000000000000000000000000000000000000..72a244600382fa9bb1f7b6cc19fd4cc691b7eef8 --- /dev/null +++ b/app/ned/02/ned0214.c @@ -0,0 +1,135 @@ +/* + * FILE %ned/02/ned0214.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1991 05 29: Revision + * latest update: 1997-10-26 11:11:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int W_TEXT_MAX_X; +extern int W_TEXT_MAX_Y; + +static int pr_flag= 0; +static int pr_ax, pr_ay; +static int pr_bx, pr_by; +extern int NED_TEXT_MAX_X, NED_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +int ned_window_size ( +register struct WINDOWCTRL *wc, +int p, /* Size Modus */ +int f) /* 1 -> Cursor Position anpassen */ +{ + int aax, aay; + int w_text_max_x; + int w_text_max_y; + + if (wc == (struct WINDOWCTRL *) 0) return -1; + + aax= wc->ax; + aay= wc->ay; + + w_text_max_x= NED_TEXT_MAX_X; + w_text_max_y= NED_TEXT_MAX_Y; + + if (pr_flag) + { + wc->ax= pr_ax; wc->ay= pr_ay; + wc->bx= pr_bx; wc->by= pr_by; + pr_flag= 0; + goto MORE; + } + + switch (p) /* ax */ + { + case 0: case 1: case 2: + case 4: case 7: case 8: + wc->ax= 1; + break; + case 3: case 6: case 9: + wc->ax= (w_text_max_x/2)+1; + break; + case 5: + wc->ax= 0; + break; + } + + switch (p) /* ay */ + { + case 0: case 4: case 5: + case 6: case 7: case 8: case 9: + wc->ay= 3; + break; + case 1: case 2: case 3: + wc->ay= (w_text_max_y/2)+2; + break; + } + + switch (p) /* bx */ + { + case 0: case 2: case 3: + case 6: case 8: case 9: + wc->bx= w_text_max_x-2; + break; + case 1: case 4: case 7: + wc->bx= (w_text_max_x/2)-2; + break; + case 5: + wc->bx= w_text_max_x-1; + break; + } + + switch (p) /* by */ + { + case 0: case 1: case 2: + case 3: case 4: case 6: + wc->by= w_text_max_y - 2; + break; + case 5: + wc->by= w_text_max_y - 1; + break; + case 7: case 8: case 9: + wc->by= (w_text_max_y/2) - 1; + break; + } + +MORE: + if (f) + { + wc->cx += wc->ax - aax; + wc->cy += wc->ay - aay; + wc->w_upd |= 0x05; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_window_size_preset (int pax, int pay, int pbx, int pby) +{ + if (pax < 0) + { + pr_flag= 0; + return 0; + } + + pr_flag= 1; + + pr_ax= pax; + pr_ay= pay; + pr_bx= pbx; + pr_by= pby; + + return 0; +} diff --git a/app/ned/02/ned0215a.c b/app/ned/02/ned0215a.c new file mode 100644 index 0000000000000000000000000000000000000000..21629831cc30c83bade8ff6a1fb9b37fa3860d95 --- /dev/null +++ b/app/ned/02/ned0215a.c @@ -0,0 +1,36 @@ +/* + * FILE %ned/02/ned0215a.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1991 05 29: Revision + * latest update: 1999-04-25 16:29:47 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct WINDOWCTRL *ned_create_editor_window () +{ + register struct WINDOWCTRL *wc; + + if ((wc= wdw_alloc ()) != (struct WINDOWCTRL *) 0 + && ned_window_size (wc, DEFAULT_WDW_MODE, 0) == 0 + ) + { + wdw_rst (wc); + } + + return wc; +} diff --git a/app/ned/02/ned0215b.c b/app/ned/02/ned0215b.c new file mode 100644 index 0000000000000000000000000000000000000000..dc04e32355a9ed5f18fec384c92dfbe6d73d6dac --- /dev/null +++ b/app/ned/02/ned0215b.c @@ -0,0 +1,33 @@ +/* + * FILE %ned/02/ned0215b.c + * + * create a feature window + * + * written: 1995-09-23 + * latest update: 1999-04-25 16:29:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct WINDOWCTRL *ned_create_feature_window () +{ + register struct WINDOWCTRL *wc; + + if ((wc= wdw_alloc ()) != (struct WINDOWCTRL *) 0) + { + wdw_rst (wc); + wc->page= -1; + } + + return wc; +} diff --git a/app/ned/02/ned0215c.c b/app/ned/02/ned0215c.c new file mode 100644 index 0000000000000000000000000000000000000000..2832921aed078505832db698516ac2bc4121c540 --- /dev/null +++ b/app/ned/02/ned0215c.c @@ -0,0 +1,41 @@ +/* + * FILE %ned/02/ned0215c.c + * + * create a feature window + * + * written: 1995-09-23 + * latest update: 1999-04-25 16:30:18 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct WINDOWCTRL *ned_create_window_pair () +{ + register struct WINDOWCTRL *w_new; + register struct WINDOWCTRL *w_ftr; + + if ((w_new= ned_create_editor_window ()) != (struct WINDOWCTRL *) 0) + { + if ((w_ftr= ned_create_feature_window ()) != (struct WINDOWCTRL *) 0) + { + w_new->feature_window= w_ftr; + } + else + { + free (w_new); + w_new= (struct WINDOWCTRL *) 0; + } + } + + return w_new; +} diff --git a/app/ned/02/ned0216.c b/app/ned/02/ned0216.c new file mode 100644 index 0000000000000000000000000000000000000000..934051d46a483067663efe36fdfb226c99a31243 --- /dev/null +++ b/app/ned/02/ned0216.c @@ -0,0 +1,35 @@ +/* + * FILE %ned/02/ned0216.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * latest update: 1997-10-26 10:59:20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_wdwXup () +{ + if (oper_level >= LEV_WDW + || aw->ay <= 1 + || (aw->box_type > 0 && aw->ay <= 2) + ) return; + + aw->ay--; + aw->by--; + aw->cy--; + aw->w_upd |= 0x05; + ned_display_window (aw); +} diff --git a/app/ned/02/ned0217.c b/app/ned/02/ned0217.c new file mode 100644 index 0000000000000000000000000000000000000000..5524d101914d6a782fbe8cccf049be43dd7ba132 --- /dev/null +++ b/app/ned/02/ned0217.c @@ -0,0 +1,39 @@ +/* + * FILE %ned/02/ned0217.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1991 06 25: Revision + * latest update: 1997-10-26 10:59:27 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; +extern int NED_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +void p_wdwXdn () +{ + if (oper_level >= LEV_WDW + || aw->by >= NED_TEXT_MAX_Y-1 + ) return; + + aw->ay++; + aw->by++; + aw->cy++; + + aw->w_upd |= 0x05; + + ned_display_window (aw); +} diff --git a/app/ned/02/ned0218.c b/app/ned/02/ned0218.c new file mode 100644 index 0000000000000000000000000000000000000000..4ffcf2b6d6b4ae6a9f820313c168a2e7c29eaee9 --- /dev/null +++ b/app/ned/02/ned0218.c @@ -0,0 +1,38 @@ +/* + * FILE %ned/02/ned0218.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1991 06 25: Revision + * latest update: 1997-10-26 10:59:34 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_wdwXlt () +{ + if (oper_level >= LEV_WDW + || aw->ax <= 0 + ) return; + + aw->ax--; + aw->bx--; + aw->cx--; + + aw->w_upd |= 0x05; + + ned_display_window (aw); +} diff --git a/app/ned/02/ned0219.c b/app/ned/02/ned0219.c new file mode 100644 index 0000000000000000000000000000000000000000..294c75dd712b8eb1e039f53a42cbb86f3e05fce8 --- /dev/null +++ b/app/ned/02/ned0219.c @@ -0,0 +1,37 @@ +/* + * FILE %ned/02/ned0219.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * 1991 09 15: Revision + * latest update: 1996-03-16 1:27:23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern int oper_level; +extern int NED_TEXT_MAX_X; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_wdwXrt () +{ + if (oper_level >= LEV_WDW) return; + if (aw->bx >= NED_TEXT_MAX_X-1) return; + + aw->ax++; + aw->bx++; + aw->cx++; + aw->w_upd |= 0x05; + + ned_display_window (aw); +} diff --git a/app/ned/02/ned0220.c b/app/ned/02/ned0220.c new file mode 100644 index 0000000000000000000000000000000000000000..87f12daf3c57f4d6bc3f04f3678bda1d85ec397f --- /dev/null +++ b/app/ned/02/ned0220.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/02/ned0220.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * latest update: 1997-10-26 10:59:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_wdwAup () +{ + if (oper_level >= LEV_WDW + || aw->ay < 1 + || (aw->box_type > 0 && aw->ay <= 2) + ) return; + + aw->ay--; + aw->cy--; + aw->w_upd |= 0x05; + ned_display_window (aw); +} diff --git a/app/ned/02/ned0221.c b/app/ned/02/ned0221.c new file mode 100644 index 0000000000000000000000000000000000000000..55a52835e0746b206e18e33586aebd41893fe9db --- /dev/null +++ b/app/ned/02/ned0221.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/02/ned0221.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * latest update: 1997-10-26 10:59:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_wdwAdn () +{ + if (oper_level >= LEV_WDW + || (aw->by - aw->ay) <= 3 + ) return; + + aw->ay++; + aw->cy++; + aw->w_upd |= 0x05; + + ned_display_window (aw); +} diff --git a/app/ned/02/ned0222.c b/app/ned/02/ned0222.c new file mode 100644 index 0000000000000000000000000000000000000000..d2e6a5ed23e82462d5052fbd912a11be056a2f13 --- /dev/null +++ b/app/ned/02/ned0222.c @@ -0,0 +1,30 @@ +/* + * FILE %ned/02/ned0222.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * latest update: 1997-10-26 10:59:41 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_wdwAlt () +{ + if (oper_level >= LEV_WDW) return; + if (aw->ax <= 0) return; + aw->ax--; aw->cx--; + aw->w_upd |= 0x05; + ned_display_window (aw); +} diff --git a/app/ned/02/ned0223.c b/app/ned/02/ned0223.c new file mode 100644 index 0000000000000000000000000000000000000000..69e582aac9cbe8e8a0c560cdff97607b9ce9b46b --- /dev/null +++ b/app/ned/02/ned0223.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/02/ned0223.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * latest update: 1996-03-16 0:40:14 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_wdwArt () +{ + if (oper_level >= LEV_WDW) return; + if ((aw->bx - aw->ax) <= 3) return; + + aw->ax++; + aw->cx++; + + aw->w_upd |= 0x05; + + ned_display_window (aw); +} diff --git a/app/ned/02/ned0224.c b/app/ned/02/ned0224.c new file mode 100644 index 0000000000000000000000000000000000000000..0a18cdf651ce60b14edce69792530bde8d8f8430 --- /dev/null +++ b/app/ned/02/ned0224.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/02/ned0224.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * latest update: 1997-10-26 10:59:44 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_wdwBup () +{ + if (oper_level >= LEV_WDW + || (aw->by - aw->ay) <= 3 + ) return; + + aw->by--; + aw->w_upd |= 0x05; + + ned_display_window (aw); +} + diff --git a/app/ned/02/ned0225.c b/app/ned/02/ned0225.c new file mode 100644 index 0000000000000000000000000000000000000000..478345cf73c7165df9f4bc2fac28e8a206ca7093 --- /dev/null +++ b/app/ned/02/ned0225.c @@ -0,0 +1,33 @@ +/* + * FILE %ned/02/ned0225.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * latest update: 1997-10-26 10:59:47 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; +extern int NED_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +void p_wdwBdn () +{ + if (oper_level >= LEV_WDW) return; + if (aw->by >= NED_TEXT_MAX_Y-1) return; + + aw->by++; + aw->w_upd |= 0x05; + + ned_display_window (aw); +} diff --git a/app/ned/02/ned0226.c b/app/ned/02/ned0226.c new file mode 100644 index 0000000000000000000000000000000000000000..48a2aa9c6d8f7393d29670ef2084fd1103ec1a32 --- /dev/null +++ b/app/ned/02/ned0226.c @@ -0,0 +1,32 @@ +/* + * FILE %ned/02/ned0226.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * latest update: 1997-10-26 10:59:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_wdwBlt () +{ + if (oper_level >= LEV_WDW) return; + if ((aw->bx - aw->ax) <= 3) return; + + aw->bx--; + aw->w_upd |= 0x05; + + ned_display_window (aw); +} diff --git a/app/ned/02/ned0227.c b/app/ned/02/ned0227.c new file mode 100644 index 0000000000000000000000000000000000000000..0e02d9c9a659bbe16c6faf81fd623cc42aefb049 --- /dev/null +++ b/app/ned/02/ned0227.c @@ -0,0 +1,33 @@ +/* + * FILE %ned/02/ned0227.c + * + * Bildschirmaufbau + * Windowoperation: Oeffnen, Schliessen, Verschieben + * + * written: 1987 04 08 + * latest update: 1997-10-26 10:55:28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; +extern int NED_TEXT_MAX_X; + +/* ------------------------------------------------------------------------ */ +void p_wdwBrt () +{ + if (oper_level >= LEV_WDW) return; + if (aw->bx >= NED_TEXT_MAX_X-1) return; + + aw->bx++; + aw->w_upd |= 0x05; + + ned_display_window (aw); +} diff --git a/app/ned/02/ned0228.c b/app/ned/02/ned0228.c new file mode 100644 index 0000000000000000000000000000000000000000..8fe401c5f294411abce7f682ce5693563fd91d08 --- /dev/null +++ b/app/ned/02/ned0228.c @@ -0,0 +1,33 @@ +/* + * FILE %ned/02/ned0228.c + * + * Ausgabe einer Zahl als Window Nummer + * + * written: 1987 04 08 + * 1990 01 28: Revision + * 1991 02 03: Revision + * latest update: 1995-09-30 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void wd_show_wdnr ( +int p, /* Window Page */ +int x, /* Window AX */ +int y, /* Window AY */ +int c, /* Color */ +int n) /* Number to Display */ +{ + w_setchar (p, x , y, c, ' '); + w_setchar (p, x+1, y, c, (n> 9)?(n/10)+'0':' '); + w_setchar (p, x+2, y, c, (n%10)+'0'); + w_setchar (p, x+3, y, c, ' '); +} diff --git a/app/ned/02/ned0230.c b/app/ned/02/ned0230.c new file mode 100644 index 0000000000000000000000000000000000000000..abef4631b6e1aec5a2d44a5a5b482318fb5d622a --- /dev/null +++ b/app/ned/02/ned0230.c @@ -0,0 +1,55 @@ +/* + * FILE %ned/02/ned0230.c + * + * Window Control Struktur aufbauen + * + * written: 1991 05 29 + * latest update: 2001-02-11 21:58:10 + * $Id: ned0230.c,v 1.3 2001/02/12 00:03:25 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *windows; + +/* ------------------------------------------------------------------------ */ +int q_wdwopen (struct WINDOWCTRL **wc, int *win_num) +{ + struct WINDOWCTRL *last_window; + + *win_num= 1; + + if ((*wc= ned_create_window_pair ()) == (struct WINDOWCTRL *) 0) return -1; + + (*wc)->next= (struct WINDOWCTRL *) 0; + (*wc)->file_type= FTY_PLAIN; + + if (windows == (struct WINDOWCTRL *) 0) + { /* Spezialfall: noch ueberhaupt kein Window erzeugt! */ + windows= *wc; + (*wc)->prev= (struct WINDOWCTRL *) 0; + } + else + { + for (last_window= windows; + last_window->next != (struct WINDOWCTRL *) 0; + last_window= last_window->next) (*win_num)++; + + (*wc)->prev= last_window; + last_window->next= *wc; + (*win_num)++; + } + +#ifdef USE_TK + ned_tk_associate_window (*wc); +#endif + + return 0; +} diff --git a/app/ned/02/ned0231.c b/app/ned/02/ned0231.c new file mode 100644 index 0000000000000000000000000000000000000000..7141984869671829dec375c5226b3ad8096dd461 --- /dev/null +++ b/app/ned/02/ned0231.c @@ -0,0 +1,29 @@ +/* + * FILE %ned/02/ned0231.c + * + * Window oeffnen und linken + * + * written: 1991 05 30 + * latest update: 1996-05-28 20:04:04 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_clone_window () +{ + struct WINDOWCTRL *w_old; + + w_old= aw; /* remember the previous window */ + p_wdwopen (); + q2_link (aw, w_old, NEDJMP_FLAG_REDRAW); + ned_display_window (aw); +} diff --git a/app/ned/02/ned0232.c b/app/ned/02/ned0232.c new file mode 100644 index 0000000000000000000000000000000000000000..0020663ed6879d99b6f917018825305f755c052b --- /dev/null +++ b/app/ned/02/ned0232.c @@ -0,0 +1,69 @@ +/* + * FILE %ned/02/ned0232.c + * + * switch number of line mode + * + * NOTE: Die Umschaltung des Line Modes funktioniert nicht richtig, wenn + * die Zeileneinstellung bie Aufruf von NED anders als standardmaessig + * eingestellt war und keine Umschaltung des Zeilenmodes waehrend + * des NED Laufs vorgenommen wurde. + * Grund: Der Zeilenmode kann zu diesem Zeitpunkt nicht ermittelt werden. + * Workaround: Es werden verschieden Zeilenmodi durchprobiert, bis + * ein brauchbarer gefunden wird. + * + * written: 1991 05 30 + * 1992 01 01: memorize and restore window and line mode + * latest update: 1996-10-29 20:10:23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern int W_TEXT_MAX_Y; + +static int line_mode= 0; +static int act_window_mode= -1; +static int w_text_max_y= -1; + +/* ------------------------------------------------------------------------ */ +void p_switch_line_mode () +{ + if (++line_mode > 5) line_mode = 1; + w_set_screen_mode (line_mode); +} + +/* ------------------------------------------------------------------------ */ +void restore_window_mode () +{ + if (act_window_mode < 0) return; + + if (w_get_mode () != act_window_mode) + w_init_mode (act_window_mode, 0x0001); + + if (line_mode) + { + w_set_screen_mode (line_mode); + } + else + if (w_text_max_y > 0) + { + for (line_mode= 1; line_mode <= 5; line_mode++) + { + w_set_screen_mode (line_mode); + if (W_TEXT_MAX_Y >= w_text_max_y) break; + } + } +} + +/* ------------------------------------------------------------------------ */ +void memorize_window_mode () +{ + act_window_mode= w_get_mode (); + w_text_max_y= W_TEXT_MAX_Y; +} diff --git a/app/ned/02/ned0240.c b/app/ned/02/ned0240.c new file mode 100644 index 0000000000000000000000000000000000000000..8ac653f69799804c2e7be2b02ac4855be87aa8c3 --- /dev/null +++ b/app/ned/02/ned0240.c @@ -0,0 +1,32 @@ +/* + * FILE %ned/02/ned0240.c + * + * vi emulation: append after character position + * + * written: 1993-07-31 + * latest update: 1999-05-01 13:47:51 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void vi_append () +{ + int pos; + + if (aw != (struct WINDOWCTRL *) 0) + { + pos= aw->cx + aw->hv - aw->ax; + if (aw->WC_act != (struct LINE *) 0 + && pos < aw->WC_act->lng) ned_cursor_right (); + } + ned_wc_ins_mode (aw, INSFLG_insert); +} diff --git a/app/ned/02/ned0241.c b/app/ned/02/ned0241.c new file mode 100644 index 0000000000000000000000000000000000000000..0fee21854aed1356aa3cf7b23eb3ca46ef1b87ee --- /dev/null +++ b/app/ned/02/ned0241.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/02/ned0241.c + * + * vi emulation: append at end of line + * + * written: 1993-07-31 + * latest update: 1996-05-23 14:51:05 + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +void vi_append_eol () +{ + ned_jmp_eoln (); + vi_ins (); +} diff --git a/app/ned/02/ned0242.c b/app/ned/02/ned0242.c new file mode 100644 index 0000000000000000000000000000000000000000..bc9b729d5418196b09da461f76d0fc516a784e7e --- /dev/null +++ b/app/ned/02/ned0242.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/02/ned0242.c + * + * vi emulation: append at end begin of line + * + * written: 1993-07-31 + * latest update: 1996-05-23 20:13:32 + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +void vi_insert_bol () +{ + vi_jmp_boln (); + vi_ins (); +} diff --git a/app/ned/02/ned0243.c b/app/ned/02/ned0243.c new file mode 100644 index 0000000000000000000000000000000000000000..57b67234adcf49736250c4cdd254ce708ef6f01f --- /dev/null +++ b/app/ned/02/ned0243.c @@ -0,0 +1,38 @@ +/* + * FILE %ned/02/ned0243.c + * + * Window oeffnen und linken + * + * written: 1995-10-01 + * latest update: 1997-01-26 12:34:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +static int vi_bell_mode= 1; + +/* ------------------------------------------------------------------------ */ +void vi_bell () +{ + switch (vi_bell_mode) + { + case 0: + break; + + default: + w_bell (); + } +} + +/* ------------------------------------------------------------------------ */ +void vi_set_bell_mode (int mode) +{ + vi_bell_mode= mode; +} diff --git a/app/ned/02/ned0244.c b/app/ned/02/ned0244.c new file mode 100644 index 0000000000000000000000000000000000000000..f63c0603ad37a83c8ba4708f30f1d73326af0c7b --- /dev/null +++ b/app/ned/02/ned0244.c @@ -0,0 +1,319 @@ +/* + * FILE %ned/02/ned0244.c + * + * vi emulation: read commands for ex mode + * + * written: 1993-07-31 + * latest update: 2000-12-09 12:55:41 + * $Id: ned0244.c,v 1.7 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +void vi_ex () +{ +#define B_SIZ 128 + char buffer [B_SIZ]; + + buffer [0]= 0; + if (rd_str (":", buffer, B_SIZ) == -1) return; + + if (vi_ex_interp (buffer) == -1) + { + ned_message_2 ("unsupported ex command: ", buffer); + } +} + +extern struct WINDOWCTRL *aw; +#define LOGIC_LINK(dir) eval_logic_link (aw, (dir)) +/* ------------------------------------------------------------------------ */ +int vi_ex_interp (char *buffer) +{ + int beg; + int lnr; +#define MAX_FIELDS 3 + char *fields [MAX_FIELDS]; + + if ((beg= (int) buffer [0]) == 0) return 0; + + if (beg == '!') q_shell (buffer+1); else + if (beg == '\"') mac_call_tcl (buffer+1); else + if (beg == '@') ned_tcl_run_file (buffer+1); else + if (beg == '<') ned_paste_tcl (buffer+1); else + if (beg == '=') ned_show_total_lines (); else + if (beg == '/') ned_jmp_pattern (aw, aw->WC_act, buffer+1, 0x0000); else + if (beg == '?') ned_jmp_pattern (aw, aw->WC_act, buffer+1, OPT_backward); else + if (beg == ':') ex_tag_command (buffer+1); else + + if (strcmp (buffer, "^k") == 0) p_ctrlk (); else + if (strcmp (buffer, "^o") == 0) p_ctrlo (); else + if (strcmp (buffer, "^q") == 0) p_ctrlq (); else + if (strcmp (buffer, "^s") == 0) ned_cursor_left (); else + if (strcmp (buffer, "^a") == 0 + || strcmp (buffer, "alt") == 0) p_ctrlu (); else + + if (strncmp (buffer, "tag ", 4) == 0 + ||strncmp (buffer, "tag!", 4) == 0) ex_tag_command (buffer+4); else + if (strncmp (buffer, "crf ", 4) == 0) + ned_cross_ref (buffer+4, 0, CRF_IN_CRF, CRF_GLOBAL_AND_LOCAL, 1); + else + if (strncmp (buffer, "all", 3) == 0) + { + int i; + int ch; + int c_mstr= 0; + int use_matching= 1; + char *mstr[2]; +#define MAX_WORD_BUFF 40 + char word_buff [MAX_WORD_BUFF]; + + for (i= 3; (ch= buffer [i]) != 0; i++) + { + if (ch == '!' && use_matching) { use_matching= 0; continue; } + if (!(ch == ' ' || ch == '/')) break; + } + + if (buffer [i] != 0) + { + if (buffer [i] == '`') + { + q_isolate_word (word_buff, MAX_WORD_BUFF-1, CHARSET_filename, 0); + mstr [0]= word_buff; + } + else mstr [0]= buffer+i; + c_mstr= 1; + } + + ned_all_lines (aw, use_matching, c_mstr, mstr); + p_refresh (); + } + else + if (strncmp (buffer, "abbrev ", 7) == 0 || strncmp (buffer, "ab ", 3) == 0) + { + if (isolate_tokens (buffer, fields, 3) >= 3) + ned_define_abbrev (fields [1], fields [2]); + } + else + if (strncmp (buffer, "unabbreviate ", 13) == 0 + || strncmp (buffer, "una ", 4) == 0) + { + if (isolate_tokens (buffer, fields, 2) >= 2) + ned_undefine_abbrev (fields [1]); + } + else + if (strncmp (buffer, "set", 3) == 0) ex_set_command (buffer); + else + +#ifdef __TEST_SYM_BMK__ /* 1998-07-19 17:51:27 */ +... replaced by note cluster system ... + if (strcmp (buffer, "cl0") == 0 + ||abbrev ("start", buffer, 3) == 1) p_activate_cl0 (); else + if (strcmp (buffer, "cl1") == 0 + ||abbrev ("help", buffer, 1) == 1) p_activate_cl1 (); else + if (strcmp (buffer, "cl2") == 0 + ||abbrev ("notes", buffer, 2) == 1) p_activate_cl2 (); else + if (strcmp (buffer, "cl3") == 0) p_activate_cl3 (); else + if (strcmp (buffer, "cl4") == 0 + ||abbrev ("t2d", buffer, 2) == 1) p_activate_cl4 (); else +#endif /* __TEST_SYM_BMK__ 1998-07-19 17:51:27 */ + + if (abbrev ("next", buffer, 2) == 1) LOGIC_LINK ("next"); else + if (abbrev ("prev", buffer, 2) == 1) LOGIC_LINK ("prev"); else + if (abbrev ("up", buffer, 2) == 1) LOGIC_LINK ("up"); else + if (abbrev ("up", buffer, 2) == 1) LOGIC_LINK ("lang"); else + if (abbrev ("down", buffer, 2) == 1) LOGIC_LINK ("menu"); else + if (abbrev ("root", buffer, 2) == 1) p_activate_fr_root (); else + if (strcmp (buffer, "o") == 0) p_wdwopen (); else + if (strncmp (buffer, "ow", 2) == 0) q_wdwsize (buffer[2]); else + if (strcmp (buffer, "e") == 0) p_ofile2 (); else + if (strncmp (buffer, "e ", 2) == 0) ex_e_command (buffer); else + if (strcmp (buffer, "q!") == 0 + ||abbrev ("qquit", buffer, 2) == 1) p_exit (); else + if (strcmp (buffer, "q") == 0 + ||abbrev ("quit", buffer, 2) == 1) p_abandon (); else + if (strcmp (buffer, "vi") == 0) vi_mode (); else + if (strcmp (buffer, "ws") == 0) wordstar_mode (); else + if (strcmp (buffer, "pico") == 0) pico_mode (); else + if (strcmp (buffer, "w") == 0 + ||strcmp (buffer, "w!") == 0) p_save (); else + if (strcmp (buffer, "wq") == 0 + ||abbrev ("xit", buffer, 1) + ||abbrev ("file", buffer, 2) + ||abbrev ("ffile", buffer, 2) ) p_ssave (); else + if (strcmp ("fffile", buffer) == 0) ned_ssave_all (); else + if (strcmp (buffer, "wq!") == 0) p_sx (); else + if (abbrev ("version", buffer, 2) ) ned_show_version (); else + if (strcmp (buffer, "$") == 0 + ||abbrev ("bottom", buffer, 3) ) pq_dn (); else + if (strcmp (buffer, "1") == 0 + ||strcmp (buffer, "top") == 0) pq_up (); else + if (strncmp (buffer, "D ", 2) == 0) + { + if (isolate_tokens (buffer, fields, 2) >= 2) + ned_debug_info (fields [1]); + } + else + if (verify (buffer, "1234567890") == 0) + { + lnr= (int) get_parameter_value (buffer); + ned_jmp_2line_by_nr (aw, lnr, 3); + } + else + if (strncmp (buffer, "defnote", 7) == 0) + { + int i; + int create_mode= 0; + int memorize= 0; + + for (i= 7; buffer [i]; i++) + { + switch (buffer [i]) + { + case '!': create_mode= 1; break; + case '?': memorize= 1; break; + case ' ': case '\t': goto DONE; + } + } + +DONE: + if (isolate_tokens (buffer, fields, 3) >= 3) + ned_define_note_cluster (fields [1], fields [2], create_mode, memorize); + } + else + { + char *b2; + int res; + + if ((b2= strdup (buffer)) == (char *) 0) + { + printf ("0244: out of memory!\n"); + return -1; + } + + /* ned_activate_note_cluster destroys the buffer! */ + res= ned_activate_note_cluster (b2); + free (b2); + if (res == 0) return 0; + +#ifdef USE_TCL + mac_call_tcl (buffer); +#else + return -1; +#endif /* USE_TK */ + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ex_e_command (char *buffer) +{ + int flags= NED_OPENF_HISTORY | NED_OPENF_REDRAW; + int fc, i; + char *fnm= (char *) 0; + char *arg; +#define MAX_E_FIELDS 3 + char *fields [MAX_E_FIELDS]; + int jmp_line= -1; + char *jmp_pattern= (char *) 0; + + if ((fc= isolate_tokens (buffer, fields, MAX_E_FIELDS)) >= 2) + { + for (i= 1; i < fc; i++) + { + arg= fields [i]; + if (strcmp (arg, "[sgml]") == 0) flags |= NED_OPENF_SGML; else + if (arg [0] == '+') + { + switch (arg [1]) + { + case 0: + case '$': + jmp_line= 32700; + break; + case '/': + case '?': + jmp_pattern= arg+1; + break; + default: + jmp_line= (int) get_parameter_value (arg+1); + break; + } + } else + if (fnm == (char *) 0) fnm= arg; + } + + if (fnm != (char *) 0) + { + ned_open_file (fnm, (char *) 0, (char *) 0, flags); + + /* from ned00.c; T2D: we have to assume that aw is now differnt! */ + ned_jmp_complex (aw, jmp_line, jmp_pattern); + + return 0; + } + } + + p_ofile2 (); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ex_set_command (char *buffer) +{ + char *wp; + + wp= locate_word (buffer, 1); + + if (wp == (char *) 0) + { + goto NOP; + } + else if (strcmp (wp, "ic") == 0 || strcmp (wp, "ignorecase") == 0) + { + ned_set_ic (1); + } + else if (strcmp (wp, "noic") == 0 || strcmp (wp, "noignorecase") == 0) + { + ned_set_ic (0); + } + else if (strcmp (wp, "ws") == 0 || strcmp (wp, "wrapscan") == 0) + { + ned_set_wrapscan (1); + } + else if (strcmp (wp, "nows") == 0 || strcmp (wp, "nowrapscan") == 0) + { + ned_set_wrapscan (0); + } + else if (abbrev ("create", wp, 4) == 1) + { + ned_set_create_special (1); + } + else if (abbrev ("nocreate", wp, 6) == 1) + { + ned_set_create_special (0); + } + else + { +NOP: +#ifdef USE_TK + mac_call_tcl ("show_settings"); +#else + ned_message_1 ("not yet implemented!"); +#endif + } + + return 0; +} diff --git a/app/ned/02/ned0245.c b/app/ned/02/ned0245.c new file mode 100644 index 0000000000000000000000000000000000000000..271d5387a434a72b43635e5e039f08c6c9c5014f --- /dev/null +++ b/app/ned/02/ned0245.c @@ -0,0 +1,236 @@ +/* + * FILE %ned/02/ned0245.c + * + * vi emulation: double key sequences + * see also: ned0319.c NED_interpreter + * + * written: 1993-08-01 + * latest update: 2001-02-11 11:48:09 + * $Id: ned0245.c,v 1.3 2001/02/12 00:03:25 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> +#ifdef USE_MOUSE +#include <gg/maus.h> +#endif + +extern struct WINDOWCTRL *aw; +extern int akt_page; +extern int COL_STATUS; +extern int key; +extern int block_mode; +extern ned_input_handler *nextchar; /* Editor Eingabe: KBD | FILE .. */ + +/* ------------------------------------------------------------------------ */ +void vi_dkey () +{ + int first_key; + int t1; + char key_str [5]; + + if (aw == (struct WINDOWCTRL *) 0) return; + + first_key= key; + + key_str [0]= 'V'; + key_str [1]= 'I'; + key_str [2]= (char) key; + key_str [3]= '?'; + key_str [4]= 0; + + w_setstring (akt_page, aw->ax+4, aw->ay-1, aw->ax+7, aw->ay-1, + COL_STATUS, key_str, 0x01); + +#ifdef USE_MOUSE + key= check_maus (); +#else + key= (*nextchar) (); +#endif + + switch (first_key) + { + case 0x17: /* ^W, VIM extension */ + switch (key) + { + case 'f': + p_ofile1 (); + break; + } + break; + + case 'm': + if (ned_set_marker (aw, key) == -1) vi_bell (); + break; + + case '`': + case '\'': + /*** TMP if (key != '`' && key != '\'') ned_set_marker (aw, '\''); ***/ + if (ned_jmp_marker (key, (first_key == '\'') ? 0x0001 : 0x0000) == -1) + vi_bell (); + break; + + case 'Z': + switch (key) + { + case 'Z': + p_ssave (); + break; + } + break; + + case 'c': + switch (key) + { + case 'c': + vi_change_line (); + break; + case 'w': /* cw and ce seem to be the same in VI */ + case 'e': + vi_change_text (aw, VI_CHG_WORD, 1); + set_repeat_command ((void *) 0); + break; + case 'W': /* cW and cE seem to be the same in VI */ + case 'E': + vi_change_text (aw, VI_CHG_WORD4, 1); + set_repeat_command ((void *) 0); + break; + case '$': + vi_change_2eoln (); + break; + case '^': + case '0': + vi_change_2boln (); + break; + } + break; + + case 'd': + switch (key) + { + case 'd': + /* fuer VI puristen, T2D: ned_fresh_buffer () */ + block_mode= BLOCK_MODE_line; + ned_delete_line (); + break; + case 'e': /* delete to end of word (OK) */ + ned_delete_word (); + break; + case 'E': /* delete to end of word (OK) */ + ned_delete_word_4 (); + break; + case 'w': /* as above including blanks at end of word */ + ned_delete_word_2 (); + break; + case 'W': /* as above including blanks at end of word */ + ned_delete_word_3 (); + break; + case '$': + ned_del2eoln (); + break; + case '^': + case '0': + ned_del2boln (); + break; + } + break; + + case 'f': case 'F': + case 't': case 'T': + key_str [0]= (char) key; + key_str [1]= 0; + if (ned_vi_wc_find_str (aw, key_str, 1, first_key) == -1) vi_bell (); + break; + + case 'r': + t1= aw->ins_flg; + aw->ins_flg= INSFLG_overwrite; + if (key == 0x0A || key == 0x0D) + { + ned_wc_delete (aw, 1); + p_nl (); + } + else + if (key != 0x1B) q_insert (key, 1); + aw->ins_flg= t1; + break; + + case 'y': + ned_set_marker (aw, '('); + switch (key) + { + case '$': + ned_jmp_eoln (); + ned_set_marker (aw, '}'); + ned_jmp_marker ('[', 0x0000); + break; + case '%': + ned_group_set_marker (); + ned_jmp_marker ('[', 0x0000); + break; + case 'e': + case 'w': + ned_wc_word_lr (aw, JMPWRD_right_end); + ned_cursor_right (); + ned_set_marker (aw, '}'); + ned_jmp_marker ('[', 0x0000); + break; + case 'E': + case 'W': + ned_wc_word_lr (aw, JMPWRD_right_end_2); + ned_cursor_right (); + ned_set_marker (aw, '}'); + ned_jmp_marker ('[', 0x0000); + break; + case 'y': + ned_set_marker (aw, ']'); + break; + } + + ned_yank_block (0); + break; + + case 'z': + /* Note: it is not necessary to count the current line number here */ + + switch (key) + { + case 0x0D: case 0x0A: /* original vi */ + case '/': case 't': /* ned extension */ + ned_w_jmp_aktline (aw, NEDJMP_LINE_TOP, 0, NEDJMP_FLAG_STD); + break; + case '+': /* vi: next page */ + ned_w_jmp_aktline (aw, NEDJMP_LINE_TOP, + aw->by - aw->ay, NEDJMP_FLAG_STD); + break; + case '.': /* vi */ + case 'm': /* ned */ + case 'z': /* vim? */ + ned_w_jmp_aktline (aw, NEDJMP_LINE_MID, 0, NEDJMP_FLAG_STD); + break; + case ',': /* non standard extension */ + ned_w_jmp_aktline (aw, NEDJMP_LINE_3, 0, NEDJMP_FLAG_STD); + break; + case '^': /* vi: prev page */ + ned_w_jmp_aktline (aw, NEDJMP_LINE_TOP, + aw->ay - aw->by, NEDJMP_FLAG_STD); + break; + case '-': /* vi */ + case 'b': /* ned */ + ned_w_jmp_aktline (aw, NEDJMP_LINE_BOT, 0, NEDJMP_FLAG_STD); + break; + } + break; + + } + +#ifdef USE_MOUSE + maus_enable (); +#endif +} diff --git a/app/ned/02/ned0246.c b/app/ned/02/ned0246.c new file mode 100644 index 0000000000000000000000000000000000000000..a968f70ca3f2e2f7d1fe8a2e304e4d1fb8300668 --- /dev/null +++ b/app/ned/02/ned0246.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/02/ned0246.c + * + * vi emulation: insert after line + * + * written: 1994-02-06 + * latest update: 1996-05-23 14:51:44 + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +void vi_insert_after_line () +{ + vi_ins (); /* insert mode on */ + ned_jmp_eoln (); /* goto end of line */ + p_nl (); /* insert new line and make it active */ +} diff --git a/app/ned/02/ned0247.c b/app/ned/02/ned0247.c new file mode 100644 index 0000000000000000000000000000000000000000..bd2cfe1bfe8c197820d118044e1b6794105c4521 --- /dev/null +++ b/app/ned/02/ned0247.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/02/ned0247.c + * + * vi emulation: insert before line + * + * written: 1994-02-06 + * latest update: 1999-09-12 22:31:20 + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +void vi_insert_before_line () +{ + vi_ins (); /* insert mode on */ + ned_jmp_boln (); /* goto beginning of line */ + p_nl2 (); /* insert new line */ +} diff --git a/app/ned/02/ned0248.c b/app/ned/02/ned0248.c new file mode 100644 index 0000000000000000000000000000000000000000..f990ed6a2f2911ae5bd753de635f662250a29822 --- /dev/null +++ b/app/ned/02/ned0248.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/02/ned0248.c + * + * vi emulation: repeat last command + * note: doesn't work for all commands! + * + * written: 1994-02-06 + * latest update: 1996-02-03 17:48:32 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* static void ((*cdecl last_fnc)()); */ +static void ((*last_fnc)(void))= (void *) 0; + +/* ------------------------------------------------------------------------ */ +void vi_repeat_last_command () +{ + if (last_fnc != (void *) 0) + (*last_fnc) (); +} + +/* ------------------------------------------------------------------------ */ +int set_repeat_command (void (*fnc)(void)) +{ + last_fnc= fnc; + return 0; +} diff --git a/app/ned/02/ned0249.c b/app/ned/02/ned0249.c new file mode 100644 index 0000000000000000000000000000000000000000..9f4d6aefb28e60e9506b7f2c00cbd2d650d520f1 --- /dev/null +++ b/app/ned/02/ned0249.c @@ -0,0 +1,45 @@ +/* + * FILE %ned/02/ned0249.c + * + * vi emulation: join current line with next line + * - goto end of line, delete line end char + * + * written: 1994-10-15 + * latest update: 1999-05-01 10:24:05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void vi_join () +{ + int cursor_index; + int ch; + int iflg; + + if (aw == (struct WINDOWCTRL *) 0) return; + + ned_jmp_eoln (); /* goto end of the line */ + ned_del_char_right (); /* join the next line */ + + cursor_index= aw->cx + aw->hv - aw->ax; + if ((ch= get_txt (aw->WC_act, cursor_index)) == -1) return; /* ok: EOLN */ + /* it's not necessary to delete or add anything at the End of a Line */ + + if (in_charset (ch, CHARSET_blank)) + ned_lp_delete_word (aw->WC_act, cursor_index, 0); + + iflg= aw->ins_flg; + aw->ins_flg= INSFLG_insert; + q_insert (0x20, 1); + ned_cursor_left (); + aw->ins_flg= iflg; +} diff --git a/app/ned/02/ned0250.c b/app/ned/02/ned0250.c new file mode 100644 index 0000000000000000000000000000000000000000..53f08ee654af90b18943b59d626558114a037f58 --- /dev/null +++ b/app/ned/02/ned0250.c @@ -0,0 +1,83 @@ +/* + * FILE %ned/02/ned0250.c + * + * vi emulation: change text block + * + * written: 1996-02-03 + * latest update: 1999-05-01 13:47:12 + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int vi_change_text (struct WINDOWCTRL *w, int mode, int count) +{ + int t1, idx; + struct LINE *lp; + + if (w == (struct WINDOWCTRL *) 0 + || (lp= w->WC_act) == (struct LINE *) 0 + || count < 0 + ) return -1; + + switch (mode) + { + case VI_CHG_WORD: /* change word */ + t1= get_txt (lp, idx= w->hv + w->cx - w->ax); + if (t1 == -1) return -1; + if (t1 == ' ' || t1 == '\t') + { + ned_wc_delete (w, 1); + } + else + { + ned_lp_delete_word (lp, idx, 0); +DISP_LINE: + w->f_upd= 1; + wd_displine (w, w->WC_act, w->cy, w->ax, w->bx); + } + break; + + case VI_CHG_WORD3: /* change big word */ + t1= get_txt (lp, idx= w->hv + w->cx - w->ax); + if (t1 == -1) return -1; + ned_lp_delete_word (lp, idx, 3); + goto DISP_LINE; + + case VI_CHG_WORD4: /* change big word */ + t1= get_txt (lp, idx= w->hv + w->cx - w->ax); + if (t1 == -1) return -1; + ned_lp_delete_word (lp, idx, 4); + goto DISP_LINE; + + case VI_CHG_2BOLN: /* change text until end of line */ + ned_w_del2boln (w, 1); + break; + + case VI_CHG_LINE: /* change complete line */ + ned_w_jmp_in_line (w, NEDJMP_BOLN, 0); + + case VI_CHG_2EOLN: /* change text until end of line */ + ned_w_del2boln (w, 2); + break; + + case VI_CHG_CHAR: /* substitute character */ + ned_wc_delete (w, count); +#ifdef __OLD__ /* 1997-08-03 9:30:33 */ + qq_delete (w->WC_act, w->hv + w->cx - w->ax, count); + wd_displine (w, w->WC_act, w->cy, w->ax, w->bx); + w->f_upd= 1; +#endif + break; + } + + ned_wc_ins_mode (w, INSFLG_insert); + + return 0; +} diff --git a/app/ned/02/ned0251.c b/app/ned/02/ned0251.c new file mode 100644 index 0000000000000000000000000000000000000000..025e0e08d748d2848e0bb79a889d70ffcab62fa0 --- /dev/null +++ b/app/ned/02/ned0251.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/02/ned0251.c + * + * vi emulation: insert after line + * + * written: 1996-02-03 + * latest update: 1996-05-17 1:09:59 + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void vi_substitute () +{ + vi_change_text (aw, VI_CHG_CHAR, 1); +} diff --git a/app/ned/02/ned0252.c b/app/ned/02/ned0252.c new file mode 100644 index 0000000000000000000000000000000000000000..b49a8daf3f6b001bd411e573426c2bf7b610424d --- /dev/null +++ b/app/ned/02/ned0252.c @@ -0,0 +1,39 @@ +/* + * FILE %ned/02/ned0252.c + * + * pico emulation on + * + * written: 1996-05-16 + * latest update: 1998-08-15 14:30:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <stdio.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/strings.h> + +extern int (*P_TBL []) (void); +extern int (*P_TBL_PICO []) (void); +extern char *PFX_XX []; +extern int block_mode; + +/* ------------------------------------------------------------------------ */ +void pico_mode () +{ + int i; + + for (i= 0; i < TBL_CTRL_SIZE; i++) + P_TBL [i]= P_TBL_PICO [i]; + + PFX_XX [0]= "PI"; + block_mode= BLOCK_MODE_line; + vi_ins (); /* or something else */ + ned_set_ic (1); +} diff --git a/app/ned/02/ned0253.c b/app/ned/02/ned0253.c new file mode 100644 index 0000000000000000000000000000000000000000..773edd2749baba334e1d082aec5f9461a4ef237d --- /dev/null +++ b/app/ned/02/ned0253.c @@ -0,0 +1,39 @@ +/* + * FILE %ned/02/ned0253.c + * + * compatibility mode: WordStar table for insert + * + * written: 1996-05-16 + * latest update: 1997-02-20 12:45:35 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <stdio.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/strings.h> + +extern int (*P_TBL []) (void); +extern int (*P_TBL_WordStar []) (void); +extern char *PFX_XX []; +extern char *PFX_QUOTE; + +/* ------------------------------------------------------------------------ */ +void wordstar_mode () +{ + int i; + + for (i= 0; i < TBL_CTRL_SIZE; i++) + P_TBL [i]= P_TBL_WordStar [i]; + + PFX_XX [0]= "WS"; + PFX_QUOTE= "^P"; + vi_ins (); /* just in case, also switch to insert mode */ +} + diff --git a/app/ned/02/ned0253v.c b/app/ned/02/ned0253v.c new file mode 100644 index 0000000000000000000000000000000000000000..e743862bf9bf8296bd50161e41817103f9144ac4 --- /dev/null +++ b/app/ned/02/ned0253v.c @@ -0,0 +1,38 @@ +/* + * FILE %ned/02/ned0253v.c + * + * compatibility mode: vi table for insert + * + * written: 1996-12-03 + * latest update: 1999-05-02 11:14:28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <stdio.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/strings.h> + +extern int (*P_TBL []) (void); +extern int (*P_TBL_VI []) (void); +extern char *PFX_XX []; +extern char *PFX_QUOTE; + +/* ------------------------------------------------------------------------ */ +void vi_mode () +{ + int i; + + for (i= 0; i < TBL_CTRL_SIZE; i++) + P_TBL [i]= P_TBL_VI [i]; + + PFX_XX [0]= "vi"; + PFX_QUOTE= "^V"; + vi_on (); +} diff --git a/app/ned/02/ned0254.c b/app/ned/02/ned0254.c new file mode 100644 index 0000000000000000000000000000000000000000..fcbd0434a6c8dc5d10582d67fc2db5cf9e7b7a45 --- /dev/null +++ b/app/ned/02/ned0254.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/02/ned0254.c + * + * change to end of line + * + * written: 1996-05-23 + * latest update: 1996-05-23 12:21:06 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void vi_change_2eoln () +{ + vi_change_text (aw, VI_CHG_2EOLN, 1); + set_repeat_command ((void *) 0); +} diff --git a/app/ned/02/ned0254b.c b/app/ned/02/ned0254b.c new file mode 100644 index 0000000000000000000000000000000000000000..5caf71cbb6327dddca054465134200d56b97f4e5 --- /dev/null +++ b/app/ned/02/ned0254b.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/02/ned0254b.c + * + * change to begin of line + * + * written: 1996-10-05 + * latest update: 1996-10-05 10:41:25 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void vi_change_2boln () +{ + vi_change_text (aw, VI_CHG_2BOLN, 1); + set_repeat_command ((void *) 0); +} diff --git a/app/ned/02/ned0255.c b/app/ned/02/ned0255.c new file mode 100644 index 0000000000000000000000000000000000000000..83c4bd8a3bfea201c691accc0a7f77ce08d548b5 --- /dev/null +++ b/app/ned/02/ned0255.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/02/ned0255.c + * + * change to end of line + * + * written: 1996-05-23 + * latest update: 1996-10-05 10:40:35 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void vi_change_line () +{ + vi_change_text (aw, VI_CHG_LINE, 1); + set_repeat_command ((void *) 0); +} diff --git a/app/ned/02/ned0256.c b/app/ned/02/ned0256.c new file mode 100644 index 0000000000000000000000000000000000000000..7bdf4a14ff1e8221826cebfe88b8c584f89c53f6 --- /dev/null +++ b/app/ned/02/ned0256.c @@ -0,0 +1,40 @@ +/* + * FILE %ned/02/ned0256.c + * + * vi emulation: place cursor at begin of line + * + * written: 1996-05-23 + * latest udpate: 2001-02-11 11:35:58 added vi_wc_jmp_boln + * $Id: ned0256.c,v 1.2 2001/02/12 00:03:25 gonter Exp $ + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void vi_jmp_boln () +{ + vi_wc_jmp_boln (aw); +} + +/* ------------------------------------------------------------------------ */ +void vi_wc_jmp_boln (struct WINDOWCTRL *wc) +{ + int ch; + + ned_w_jmp_in_line (wc, NEDJMP_BOLN, 0); + + if (wc != (struct WINDOWCTRL *) 0 + && ((ch= get_txt (wc->WC_act, 0)) == ' ' + || ch == '\t' + ) + ) + ned_wc_word_lr (wc, JMPWRD_right_beg_2); +} diff --git a/app/ned/02/ned0256a.c b/app/ned/02/ned0256a.c new file mode 100644 index 0000000000000000000000000000000000000000..fea232ab5fc656aae585988568ed6a639376ae4c --- /dev/null +++ b/app/ned/02/ned0256a.c @@ -0,0 +1,31 @@ +/* + * FILE %ned/02/ned0256a.c + * + * vi emulation: place cursor at given column + * T2D: adjust horizontal view + * + * written: 1997-09-07 + * latest update: 1997-09-07 13:27:07 + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +extern struct WINDOWCTRL *aw; +extern int repeat; + +/* ------------------------------------------------------------------------ */ +void vi_jmp_column () +{ + int col; + + col= repeat-1; + if (col < 0) col= 0; + + aw->cx= col - aw->hv + aw->ax; +} diff --git a/app/ned/02/ned0257.c b/app/ned/02/ned0257.c new file mode 100644 index 0000000000000000000000000000000000000000..2c818a339f08828a7adb1fb572b8dbf310d63184 --- /dev/null +++ b/app/ned/02/ned0257.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/02/ned0257.c + * + * vi emulation: go up one line and place cursor at first no-blank char + * + * written: 1993-07-31 + * latest update: 1996-12-19 21:15:03 + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +void vi_jmp_prev_boln () +{ + ned_cursor_up (); + vi_jmp_boln (); +} diff --git a/app/ned/02/ned0258.c b/app/ned/02/ned0258.c new file mode 100644 index 0000000000000000000000000000000000000000..3a22898ed81767b1e8341d6b070153158d648efe --- /dev/null +++ b/app/ned/02/ned0258.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/02/ned0258.c + * + * vi emulation: go down one line and place cursor at first no-blank char + * + * written: 1993-07-31 + * latest update: 1996-12-19 21:52:00 + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +void vi_jmp_next_boln () +{ + ned_cursor_down (); + vi_jmp_boln (); +} diff --git a/app/ned/02/ned0259.c b/app/ned/02/ned0259.c new file mode 100644 index 0000000000000000000000000000000000000000..f355ae41c07fd1d49ffe866ac58fc88d313e03a2 --- /dev/null +++ b/app/ned/02/ned0259.c @@ -0,0 +1,30 @@ +/* + * FILE %ned/02/ned0259.c + * + * vi emulation: find associated object for a given tag + * + * written: 1996-05-23 + * latest update: 1996-05-27 10:32:58 + * $Id: ned0259.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int ex_tag_command (const char *str) +{ + while (*str && *str == ' ') str++; + if (*str == 0) return -1; + + if (ned_eval_lookup_feature (str, 0) == 0 + || ned_eval_tag_entry (str) == 0 + ) return 0; + + return -1; +} diff --git a/app/ned/02/ned0260.c b/app/ned/02/ned0260.c new file mode 100644 index 0000000000000000000000000000000000000000..d42a88a18cbbf16739e87e31e3be77cf56cc5b23 --- /dev/null +++ b/app/ned/02/ned0260.c @@ -0,0 +1,261 @@ +/* + * FILE %ned/02/ned0260.c + * + * Marker Handling + * + * written: 1996-05-27 + * latest update: 1999-04-25 16:30:30 + * $Id: ned0260.c,v 1.3 2003/10/02 06:45:51 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> /* DEBUG ONLY */ +#include "ed.h" +#include "proto.h" + +#ifdef UX_DEBUG +#include <stdio.h> +#endif + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +extern struct MARKER b_beg, b_end; +extern struct MARKER b_first, b_last; +extern int block_mode; + +#define NUM_MARKER 128 +static struct MARKER **marker_list= (struct MARKER **) 0; + +/* ------------------------------------------------------------------------ */ +struct MARKER *ned_get_marker (int marker_id, int alloc) +{ + if (marker_id == '[' || marker_id == '{' + || marker_id == '(' || marker_id == '<' + ) + { + return &b_beg; + } + + if (marker_id == ']' || marker_id == '}' + || marker_id == ')' || marker_id == '>' + ) + { + return &b_end; + } + + if (marker_id == '`') marker_id= '\''; + + if (marker_list == (struct MARKER **) 0 && alloc) + marker_list= calloc (sizeof (struct MARKER *), NUM_MARKER); + + if (marker_list != (struct MARKER **) 0 + && marker_id >= 0x00 && marker_id < NUM_MARKER) + { + struct MARKER *mp; + + if ((mp= marker_list [marker_id]) == (struct MARKER *) 0 && alloc) + mp= marker_list [marker_id]= calloc (sizeof (struct MARKER), 1); + + return mp; + } + + return (struct MARKER *) 0; +} + +/* ------------------------------------------------------------------------ */ +/* adjust offset of marker on the line to the right of idx by cnt byte. */ +int ned_marker_callback ( +int event, +void *line, +void *cd, +int column, +void *op2) +{ + struct MARKER *mp; + int i; + +#ifdef MSDOS + line; +#endif + +#ifdef UX_DEBUG + printf ( + "0260 ned_marker_callback (event=%d, line=%08lX, cd=%08lX, col=%d op2=%08lX)\n", + event, line, cd, column, op2); +#endif + + if ((mp= (struct MARKER *) cd) == (struct MARKER *) 0) return -1; + + switch (event) + { + case LCB_edit: + if (mp->offset > column) mp->offset += (int) op2; + break; + + case LCB_delete: + /* 1997-06-18 12:40:48 Fix fuer crash beim Aufruf von p_blkbeg() ?? */ + if (mp == &b_beg || mp == &b_end || mp == &b_first || mp == &b_last) + { + mp->wptr= (struct WINDOWCTRL *) 0; + mp->ptr= (struct LINE *) 0; + break; + } + + if (marker_list != (struct MARKER **) 0) + for (i= 0; i < NUM_MARKER; i++) + { + if (mp == marker_list [i]) + { + free (mp); + marker_list [i]= (struct MARKER *) 0; + break; + } + } + break; + + case LCB_line_split: + if (mp->offset >= column) + { + struct LINE *nl, *pl; + + nl= (struct LINE *) op2; + pl= mp->ptr; + + /*** BEGIN block marker handling ***/ + if (mp == &b_beg) + { + if (column <= b_beg.offset) + { + nl->line_flg |= LINE_BLOCK_BEGEND; + pl->line_flg &= LINE_BLOCK_CLR; + } + else nl->line_flg |= LINE_BLOCK_INBLOCK; + } + + if (mp == &b_end) + { + if (column < b_end.offset) + { + nl->line_flg |= LINE_BLOCK_BEGEND; + pl->line_flg &= LINE_BLOCK_CLR_BEGEND; + pl->line_flg |= LINE_BLOCK_INBLOCK; + } + else pl->line_flg &= LINE_BLOCK_CLR; + } + /*** END block marker handling ***/ + + mp->ptr= nl; + mp->offset -= column; + + ned_marker_reg_cb (nl, mp); + } + return 1; + + case LCB_line_join: +{ + char bu [40]; + sprintf (bu, "column= %d", column); +ned_message_2 ("marker cb: join; ", bu); +} + + mp->ptr= (struct LINE *) op2; + mp->offset += column; + + ned_marker_reg_cb (mp->ptr, mp); + return 1; + + case LCB_chg_wdw: + mp->wptr= (struct WINDOWCTRL *) op2; + return 0; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +/* Reset all markers that belong to the given window. */ +/* If the window is NULL, all markers have to be reset. */ +int ned_reset_markers (struct WINDOWCTRL *w) +{ + struct MARKER *mp; + int i; + + if (w == (struct WINDOWCTRL *) 0 + || b_beg.wptr == w + || b_end.wptr == w + || b_first.wptr == w /* T2D: thats paranoid */ + || b_last.wptr == w + ) ned_blk_rst (); + + if (marker_list != (struct MARKER **) 0) + for (i= 0; i < NUM_MARKER; i++) + { + if ((mp= marker_list [i]) != (struct MARKER *) 0 + && (w == (struct WINDOWCTRL *) 0 || mp->wptr == w) + ) + { + free (mp); + marker_list [i]= (struct MARKER *) 0; + } + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +/* Reset a specified marker */ +int ned_reset_a_marker (int marker_id) +{ + struct MARKER *mp; + + if (marker_list != (struct MARKER **) 0 + && marker_id >= 0x00 && marker_id < NUM_MARKER + && (mp= marker_list [marker_id]) != (struct MARKER *) 0 + ) + { + free (mp); + marker_list [marker_id]= (struct MARKER *) 0; + return 1; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +/* Reset a specified marker */ +int ned_check_for_markers (struct LINE *lp, int all) +{ + struct MARKER *mp; + int marker_id; + + if (marker_list == (struct MARKER **) 0) return -1; + + while (lp != (struct LINE *) 0) + { + for (marker_id= 0; marker_id < NUM_MARKER; marker_id++) + if ((mp= marker_list [marker_id]) != (struct MARKER *) 0 + && mp->ptr == lp + ) + { + fprintf (stderr, + "0260: marker %c (0x%02X) found on line %08lX unexpectedly!\n", + marker_id, + (marker_id > ' ' && marker_id < 0x7F) ? marker_id : '.', + lp + ); + } + + lp= lp->next; + + if (lp != (struct LINE *) 0 && !all) + { + fprintf (stderr, "0260: lp->next is not NULL!\n"); + } + } + + return 0; +} diff --git a/app/ned/02/ned0260b.c b/app/ned/02/ned0260b.c new file mode 100644 index 0000000000000000000000000000000000000000..f3258c96050d6b1361984ec4884c486b83765b8d --- /dev/null +++ b/app/ned/02/ned0260b.c @@ -0,0 +1,30 @@ +/* + * FILE %ned/02/ned0260b.c + * + * vi emulation: jump to a marker + * + * written: 1996-05-27 + * latest update: 1997-05-30 17:51:26 + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int ned_jmp_marker (int marker_id, int flg) +{ + struct MARKER *mrk; + + if ((mrk= ned_get_marker (marker_id, 0)) == (struct MARKER *) 0) return -1; + + q_jmp_marker (mrk); + if (flg & 0x0001) vi_jmp_boln (); + if (flg & 0x0002) ned_jmp_boln (); + + return 0; +} diff --git a/app/ned/02/ned0260c.c b/app/ned/02/ned0260c.c new file mode 100644 index 0000000000000000000000000000000000000000..a16f929ae38914f1930c2efc5897f5b08905220a --- /dev/null +++ b/app/ned/02/ned0260c.c @@ -0,0 +1,47 @@ +/* + * FILE %ned/02/ned0260c.c + * + * vi emulation: set a marker + * + * written: 1996-05-27 + * latest update: 1997-07-04 16:10:32 + * + */ + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int ned_set_marker (struct WINDOWCTRL *wc, int marker_id) +{ + struct LINE *lp; + int offset; + + if (wc == (struct WINDOWCTRL *) 0 + || (lp= wc->WC_act) == (struct LINE *) 0 + ) + return -1; + + offset= wc->cx + wc->hv - wc->ax; + + if (marker_id == '{') ned_set_block_markers (wc, lp, offset, 0, BLOCK_MODE_standard); else + if (marker_id == '}') ned_set_block_markers (wc, lp, offset, 1, BLOCK_MODE_standard); else + if (marker_id == '[') ned_set_block_markers (wc, lp, offset, 0, BLOCK_MODE_line); else + if (marker_id == ']') ned_set_block_markers (wc, lp, offset, 1, BLOCK_MODE_line); else + if (marker_id == '<') ned_set_block_markers (wc, lp, offset, 0, BLOCK_MODE_box); else + if (marker_id == '>') ned_set_block_markers (wc, lp, offset, 1, BLOCK_MODE_box); else + if (marker_id == '(') ned_set_block_markers (wc, lp, offset, 0, 0); else + if (marker_id == ')') ned_set_block_markers (wc, lp, offset, 1, 0); else + { + struct MARKER *mrk; + + if ((mrk= ned_get_marker (marker_id, 1))==(struct MARKER *) 0) return -1; + ned_set_marker2 (wc, lp, offset, mrk); + } + + return 0; +} diff --git a/app/ned/02/ned0261.c b/app/ned/02/ned0261.c new file mode 100644 index 0000000000000000000000000000000000000000..a2d46c9cda507f42b8637092deb6a8134d2379d4 --- /dev/null +++ b/app/ned/02/ned0261.c @@ -0,0 +1,30 @@ +/* + * FILE %ned/02/ned0261.c + * + * written: 1997-08-28 + * latest update: 1997-08-28 0:18:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern int key; +extern int repeat; + +/* ------------------------------------------------------------------------ */ +void vi_digit () +{ + if (key == '0' && repeat == 0) + { + ned_jmp_boln (); + return; + } + + repeat= repeat * 10 + key - '0'; +} diff --git a/app/ned/02/ned0262a.c b/app/ned/02/ned0262a.c new file mode 100644 index 0000000000000000000000000000000000000000..8912c352c18f297071435a9e8e04746d040b0bbf --- /dev/null +++ b/app/ned/02/ned0262a.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/02/ned0262.c + * + * written: 1997-08-28 + * latest update: 1997-08-28 0:18:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int repeat; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void vi_jmp_2line () +{ + if (repeat) ned_jmp_2line_by_nr (aw, repeat, 0x03); + else pq_dn (); +} diff --git a/app/ned/02/ned0263.c b/app/ned/02/ned0263.c new file mode 100644 index 0000000000000000000000000000000000000000..7de55427fbba8e44dc7f09238735eeaa01b19775 --- /dev/null +++ b/app/ned/02/ned0263.c @@ -0,0 +1,50 @@ +/* + * FILE %ned/02/ned0263.c + * + * written: 1997-09-07 + * latest update: 1997-09-07 12:21:13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int block_mode; + +/* ------------------------------------------------------------------------ */ +int ned_yank_block (int add_mode) +{ + struct MARKER *mrk_beg, *mrk_end; + + mrk_beg= ned_get_marker (NED_MARKER_BEG, 0); + mrk_end= ned_get_marker (NED_MARKER_END, 0); + + return ned_yank_marked (mrk_beg, mrk_end, add_mode); +} + +/* ------------------------------------------------------------------------ */ +int ned_yank_marked ( +struct MARKER *mrk_beg, +struct MARKER *mrk_end, +int add_mode) +{ + struct LINE *la, *lb; + + if (mrk_beg == (struct MARKER *) 0 + || mrk_end == (struct MARKER *) 0 + || ned_blk_duplicate (mrk_beg->ptr, mrk_end->ptr, &la, &lb, + mrk_beg->offset, mrk_end->offset, block_mode) + == -1 + || la == (struct LINE *) 0 + || lb == (struct LINE *) 0 + ) + return -1; + + ned_store_line_to_buffer (-1, la, lb, add_mode); + + return 0; +} diff --git a/app/ned/03/(dirinf).fm b/app/ned/03/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..963cfb31be839530967bce2b7682347d92e13478 --- /dev/null +++ b/app/ned/03/(dirinf).fm @@ -0,0 +1,61 @@ +# +# FILE %ned/03/(dirinf).fm +# +# latest update: 2000-08-24 16:49:10 +# $Id: (dirinf).fm,v 1.3 2000/08/24 15:10:13 gonter Exp $ +# +# ---------------------------------------------------------------------------- + +Makefile | current makefile +make-dos | MSDOS makefile + +ned0301.c | void p_ovins () /* ^V: Toggle Insert Mode */ +ned0302.c | p_ww () /* ^O^A: Enter Word Wrap Count */ +ned0303.c | void p_ins () +ned0304.c | void q_insert (k, df) +ned0304b.c | void q_insert_string (char *s, int df) +ned0305.c | void insert (k, df) +ned0306.c | int delete (df) +ned0307.c | void p_insblk () /* Ctrl O+ */ +ned0308.c | char gettxt (lp, coln) +ned0308.c | struct LINE *lp; +ned0309.c | void wd_coldis (w, la, lz, lp, coln, colpos) +ned0310.c | void p_colornxt () +ned0311.c | void p_backcolnxt () +ned0312.c | int get_confirmation (char *message); +ned0313.c | void p_turn_line () /* Zwei Zeilen vertauschen */ +ned0314.c | void p_fget () /* ^K G: Get File */ +ned0315.c | void p_alt_minus () /* ALT--: einfacher Querstrich */ +ned0316.c | void p_alt_gleich () /* ALT-=: doppelter Querstrich */ +ned0319.c | NED_interpreter () +ned0320.c | void p_alt_zero () /* ALT-Z: Eingabe eines NULL char */ +ned0321.c | ned_line_end_MAC +ned0322.c | ned_line_end_MSDOS +ned0323.c | ned_line_end_UNIX +ned0324.c | NEDa1_interpreter () +ned0325.c | NEDa2_interpreter () +ned0326.c | Editor Window Controller +ned0327.c | int q_kbin () +ned0328.c | int qq_insert (...); +ned0329.c | int qq_delete (struct LINE *lp, int delete_idx, int delete_cnt) +ned0330.c | void ned_delete_word (void); ... +ned0331.c | void ned_lp_delete_word (struct LINE *lp, int delete_idx) +ned0332.c | int qq_insert_string (...) +ned0332b.c | int qq_insert_string_array (...) +ned0333.c | void ned_save_reload (struct WINDOWCTRL *wc, ...); +ned0333b.c | void p_save_reload (void) +ned0333c.c | void p_show_tag_normally (void) +ned0333d.c | void p_show_tag (void) +ned0333e.c | void p_show_full_tag (void) +ned0334.c | void ned_read_entity () +ned0334b.c | void ned_enter_entity () +ned0335.c | void p_toggle_case () + +# NED Line Events (1997-04-13 20:19:59) +ned0341a.c | int ned_line_trigger_change (lp, delete_idx, -delete_cnt); +ned0341b.c | int ned_line_trigger_split (...) +ned0341c.c | int ned_line_trigger_delete (...); +ned0342a.c | int ned_line_reg_cb () +ned0342b.c | int ned_line_rel_cb () +ned0342c.c | int ned_line_test_cb () +* | diff --git a/app/ned/03/Makefile b/app/ned/03/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..873a4e1b832a596a9195b3e2f526be5d9710dfc0 --- /dev/null +++ b/app/ned/03/Makefile @@ -0,0 +1,58 @@ +# +# FILE %ned/03/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# +# written: 1993-01-01 +# latest update: 2000-08-24 15:16:05 +# $Id: Makefile,v 1.5 2003/04/28 02:09:29 gonter Exp $ +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-c -g -I.. -I/usr/local/include $(cf) +CC=cc +objs=\ + ned0301.o ned0302.o ned0303.o ned0304.o ned0304b.o ned0305.o \ + ned0306.o ned0307.o ned0308.o ned0310.o \ + ned0311.o ned0312.o ned0313.o ned0314.o ned0315.o \ + ned0316.o ned0320.o \ + ned0321.o ned0322.o ned0323.o \ + ned0327.o ned0328.o ned0329.o ned0330.o ned0331.o \ + ned0332.o ned0332b.o ned0333.o ned0333b.o ned0333c.o ned0333d.o \ + ned0333e.o ned0334.o ned0334b.o ned0335.o \ + ned0341a.o ned0341b.o ned0341c.o ned0342a.o ned0342b.o ned0342c.o + +objs_cur= ned0309_cur.o ned0319_cur.o +objs_tk= ned0309_tk.o ned0319_tk.o + +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_cur lib_tk +clean : + rm -f *.o lib_tk lib_cur + +lib_tk : $(objs_tk) $(objs) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h + $(CC) $(OPTS) $*.c + +# --- cur Modules ---------- +ned0309_cur.o : ../ed.h ned0309.c + $(CC) $(OPTS) -o ned0309_cur.o ned0309.c + +ned0319_cur.o : ../ed.h ned0319.c + $(CC) $(OPTS) -o ned0319_cur.o ned0319.c + +# --- tk Modules ---------- +ned0309_tk.o : ../ed.h ned0309.c + $(CC) $(OPTS) -DUSE_TK -o ned0309_tk.o ned0309.c + +ned0319_tk.o : ../ed.h ned0319.c + $(CC) $(OPTS) -DUSE_TK -o ned0319_tk.o ned0319.c diff --git a/app/ned/03/contrib b/app/ned/03/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/03/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/03/gg b/app/ned/03/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/03/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/03/lib_cur b/app/ned/03/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/03/lib_tk b/app/ned/03/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/03/make-dos b/app/ned/03/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..60b05461d0871a8cae036de19ea8416be1519802 --- /dev/null +++ b/app/ned/03/make-dos @@ -0,0 +1,31 @@ +# +# FILE %ned/03/make-dos +# +# GG's Night(mare) Editor System +# +# written: +# latest update: 1997-07-27 11:20:01 +# +# ============================================================================ +cc=cl -Os -AL /c +ccc=cl -Os -AL /Fo$@ /W3 -I.. /c +obj=objdec -m0 -w -d -sl 2 NED03_TEXT $@ + +lib : ! + ned0301.obj ned0302.obj ned0303.obj ned0304.obj ned0304b.obj ! + ned0305.obj ned0306.obj ned0307.obj ned0308.obj ! + ned0309.obj ned0310.obj ned0311.obj ned0312.obj ! + ned0313.obj ned0314.obj ned0315.obj ned0316.obj ! + ned0319.obj ned0320.obj ! + ned0321.obj ned0322.obj ned0323.obj ned0324.obj ! + ned0325.obj ned0327.obj ned0328.obj ! + ned0329.obj ned0330.obj ned0331.obj ned0332.obj ned0332b.obj ! + ned0333.obj ned0333b.obj ned0333c.obj ned0333d.obj ! + ned0333e.obj ned0334.obj ned0334b.obj ned0335.obj ! + ned0341a.obj ned0341b.obj ned0341c.obj ned0342a.obj ned0342b.obj ! + ned0342c.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $*.c + $(obj) diff --git a/app/ned/03/ned0301.c b/app/ned/03/ned0301.c new file mode 100644 index 0000000000000000000000000000000000000000..7f8e0ef695cc6ef79f1b39549e510dfd67b3d8b2 --- /dev/null +++ b/app/ned/03/ned0301.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/03/ned0301.c + * + * Toggle Insert/Overwrite Mode + * + * written: 1987 04 08 + * latest update: 1996-02-16 10:22:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_ovins () +{ + ned_wc_ins_mode (aw, + (aw->ins_flg == INSFLG_insert) ? INSFLG_overwrite : INSFLG_insert); +} diff --git a/app/ned/03/ned0302.c b/app/ned/03/ned0302.c new file mode 100644 index 0000000000000000000000000000000000000000..1f9db6e8a05556486f027870452afe911863342a --- /dev/null +++ b/app/ned/03/ned0302.c @@ -0,0 +1,36 @@ +/* + * FILE %ned/03/ned0302.c + * + * elementare Editierfunktionen + * + * written: 1987 04 08 + * 1991 01 29: Revision + * latest update: 1996-07-26 3:34:42 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dpp.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int word_wrap_count; + +/* ------------------------------------------------------------------------ */ +void p_ww () /* ^O^A: Enter Word Wrap Count */ +{ + int xwwc; + char puffer [40]; + + if (aw->WC_act == (struct LINE *) 0) return; + + puffer [0]= 0; + if (rd_str ("Word Wrap Column: ", puffer, 40) == -1) return; + xwwc= (int) get_parameter_value (puffer); + aw->wwc= word_wrap_count= (xwwc <= 0) ? LINE_LNG_TXT : xwwc; +} diff --git a/app/ned/03/ned0303.c b/app/ned/03/ned0303.c new file mode 100644 index 0000000000000000000000000000000000000000..f63bef6c17cd6d85f1edab1133481b9fc4415f79 --- /dev/null +++ b/app/ned/03/ned0303.c @@ -0,0 +1,158 @@ +/* + * FILE %ned/03/ned0303.c + * + * elementare Editierfunktionen + * + * written: 1987 04 08 + * 1991 01 29: Revision + * latest update: 1999-04-25 16:30:34 + * $Id: ned0303.c,v 1.3 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +#ifdef USE_ABBREVIATIONS +#include <stdlib.h> +#include <string.h> +#include <gg/ytree.h> +#endif /* USE_ABBREVIATIONS */ + +extern int key; + +/* ------------------------------------------------------------------------ */ +#ifdef USE_ABBREVIATIONS +extern struct WINDOWCTRL *aw; + +static struct YTREE *abbreviations= (struct YTREE *) 0; + +#define MAX_LHS 50 +static char LHS [MAX_LHS]; +static int LHS_cnt= 0; +#endif /* USE_ABBREVIATIONS */ + +/* ------------------------------------------------------------------------ */ +void p_ins () +{ + int ch; + + ch= key; + +#ifdef USE_ABBREVIATIONS + if ((ch >= 'A' && ch <= 'Z') + || (ch >= 'a' && ch <= 'z') + || (ch >= '0' && ch <= '9') + || ch == '_' + ) + { + if (LHS_cnt < MAX_LHS) LHS [LHS_cnt++]= (char) ch; + } + else + { + ned_check_abbrev (); + } +#endif /* USE_ABBREVIATIONS */ + + q_insert (ch, 1); +} + +/* ------------------------------------------------------------------------ */ +#ifdef USE_ABBREVIATIONS +int ned_check_abbrev () +{ + char *rhs; + struct WINDOWCTRL *wc; + int rc= 0; + int insf; + + if (LHS_cnt > 0 + && LHS_cnt < MAX_LHS + && (wc= aw) != (struct WINDOWCTRL *) 0 + ) + { + LHS [LHS_cnt]= 0; + if ((rhs= (char *) ytree_get_value (abbreviations, (unsigned char *) LHS)) + != (char *) 0 + ) + { + wc->cx -= LHS_cnt; + insf= wc->ins_flg; + wc->ins_flg= INSFLG_insert; + + qq_delete (wc->WC_act, wc->hv + wc->cx - wc->ax, LHS_cnt); + ned_paste_string (rhs, 1, (char *) 0, (char *) 0); + wc->ins_flg= insf; + rc= 1; + } + } + + LHS_cnt= 0; + + return rc; +} + +/* ------------------------------------------------------------------------ */ +int ned_reset_abbrev () +{ + LHS_cnt= 0; + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_abbrev_reduce () +{ + if (LHS_cnt) LHS_cnt--; + return LHS_cnt; +} + +/* ------------------------------------------------------------------------ */ +int ned_define_abbrev (const char *lhs, const char *rhs) +{ + char *old_rhs; + int rc= 0; + + if (lhs == (char *) 0 || *lhs == 0 + || rhs == (char *) 0 || *rhs == 0 + ) return -1; + + if ((old_rhs= (char *) ytree_get_value (abbreviations, + (unsigned char *) lhs)) + != (char *) 0) + { + free (old_rhs); + rc= 1; + } + + ytree_set_value (&abbreviations, (unsigned char *) lhs, + (long) strdup (rhs)); + + return rc; +} + +/* ------------------------------------------------------------------------ */ +int ned_undefine_abbrev (const char *lhs) +{ + char *old_rhs; + int rc= 0; + + if (lhs == (char *) 0 || *lhs == 0) return -1; + + if ((old_rhs= (char *) ytree_get_value (abbreviations, + (unsigned char *) lhs)) + != (char *) 0) + { + free (old_rhs); + ytree_delete_word (&abbreviations, (unsigned char *) lhs); + rc= 1; + } + + return rc; +} + +#endif /* USE_ABBREVIATIONS */ diff --git a/app/ned/03/ned0304.c b/app/ned/03/ned0304.c new file mode 100644 index 0000000000000000000000000000000000000000..84ad3a540ea4ab95dabd81433b6dc503e9a904f9 --- /dev/null +++ b/app/ned/03/ned0304.c @@ -0,0 +1,59 @@ +/* + * FILE %ned/03/ned0304.c + * + * elementare Editierfunktionen + * + * written: 1987 04 08 + * 1991 01 29: Revision + * latest update: 1997-01-19 0:36:32 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void q_insert ( +int k, /* character to insert */ +int df) /* display flag: 1 -> display line after inserting */ +{ + register struct WINDOWCTRL *w; + int curx; + int insflg; + + w= aw; + curx= w->cx - w->ax + w->hv; + insflg= w->ins_flg; + + if (w->WC_edit_mode & EDIT_READ_ONLY) return; + if (w->wwc + && curx > w->wwc + && (k == 0x20 || k == 0x09)) + { + p_nl (); + return; + } + + if (k == 0x0100) /* toggle character value at cursor position */ + { + int ch; + + ch= get_txt (w->WC_act, curx); + if (ch < 0 || ch > 0xFF) return; + if (ch >= 'A' && ch <= 'Z') ch= ch - 'A' + 'a'; else + if (ch >= 'a' && ch <= 'z') ch= ch - 'a' + 'A'; + k= ch; + w->ins_flg= INSFLG_overwrite; + } + + ned_wc_insert (w, k, df); + w->ins_flg= insflg; + ned_q_cursor_right (w, df); +} diff --git a/app/ned/03/ned0304b.c b/app/ned/03/ned0304b.c new file mode 100644 index 0000000000000000000000000000000000000000..4b30586b7ccff24870e849dfaaafb594e0d9034b --- /dev/null +++ b/app/ned/03/ned0304b.c @@ -0,0 +1,28 @@ +/* + * FILE %ned/03/ned0304b.c + * + * elementare Editierfunktionen + * + * written: 1996-06-09 + * latest update: 1996-11-03 20:57:29 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void q_insert_string ( +char *s, /* character to insert */ +int df) /* display flag: 1 -> display line after inserting */ +{ + int k; + + if (s == (char *) 0) return; + + while ((k= *s++) != 0) q_insert (k, df); +} diff --git a/app/ned/03/ned0305.c b/app/ned/03/ned0305.c new file mode 100644 index 0000000000000000000000000000000000000000..6563aec905aac627ff9d351c93709f5e8dae4e07 --- /dev/null +++ b/app/ned/03/ned0305.c @@ -0,0 +1,37 @@ +/* + * FILE %ned/03/ned0305.c + * + * elementare Editierfunktionen + * + * written: 1987 04 08 + * 1991 01 29: Revision + * latest update: 1997-01-19 0:28:03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_wc_insert ( +register struct WINDOWCTRL *w, +int k, /* character to insert */ +int df) /* display flag: 1 -> display line after inserting */ +{ + if (w->WC_act == (struct LINE *) 0) + { + ned_wc_ins_nl (w); + if (w->WC_act == (struct LINE *) 0) return; + /* Error: zu wenig Speicher ? */ + } + + qq_insert (w->WC_act, w->hv + w->cx - w->ax, k, w->ins_flg); + + w->f_upd= 1; + + if (df) wd_displine (w, w->WC_act, w->cy, w->ax, w->bx); +} diff --git a/app/ned/03/ned0306.c b/app/ned/03/ned0306.c new file mode 100644 index 0000000000000000000000000000000000000000..516b3a884a9bcbcfc2dbd920887376c81923fde1 --- /dev/null +++ b/app/ned/03/ned0306.c @@ -0,0 +1,31 @@ +/* + * FILE %ned/03/ned0306.c + * + * elementare Editierfunktionen + * + * written: 1987 04 08 + * 1991 01 29: Revision + * latest update: 1997-08-03 9:26:24 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_wc_delete ( +struct WINDOWCTRL *w, +int df) /* Display Flag: 1 -> Zeile anzeigen */ +{ + if (w == (struct WINDOWCTRL *) 0) return; + + qq_delete (w->WC_act, w->hv + w->cx - w->ax, 1); + + w->f_upd= 1; + + if (df) wd_displine (w, w->WC_act, w->cy, w->ax, w->bx); +} diff --git a/app/ned/03/ned0307.c b/app/ned/03/ned0307.c new file mode 100644 index 0000000000000000000000000000000000000000..cb08c1f2131ca5863fa22f91a7746146d2df51be --- /dev/null +++ b/app/ned/03/ned0307.c @@ -0,0 +1,27 @@ +/* + * FILE ~/usr/ned/03/ned0307.c + * + * elementare Editierfunktionen + * toggle read only mode, if this is allowed in the first place + * + * written: 1987 04 08 + * 1991 01 29: Revision + * latest update: 1994-10-16 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_insblk () /* Ctrl O+ */ +{ + if (!(aw->WC_edit_mode & EDIT_NOTOGGLE)) + aw->WC_edit_mode ^= EDIT_READ_ONLY; +} diff --git a/app/ned/03/ned0308.c b/app/ned/03/ned0308.c new file mode 100644 index 0000000000000000000000000000000000000000..a905f7bcd96980f129beee8ab6771a9911074595 --- /dev/null +++ b/app/ned/03/ned0308.c @@ -0,0 +1,57 @@ +/* + * FILE %ned/03/ned0308.c + * + * elementare Editierfunktionen + * + * written: 1987 04 08 + * 1989 11 12: nicht mehr abhaengig von TXT_LNG + * 1991 01 29: Revision + * latest update: 1996-07-26 3:35:50 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int get_txt ( +struct LINE *lp, /* Zeile, in der gesucht werden soll */ +int coln) /* Spalten Nummer: 0..32000 */ +{ + struct TXT *tx; + + if (lp == (struct LINE *) 0 + || lp->lng <= coln + || (tx= lp->txt) == (struct TXT *) 0 + /* Error: Zeile enthaelt keinen Text, obwohl lp->lng >= coln ist */ + ) + return -1; + + if (coln < 0) return '>'; + + for (;;) + { + if (coln < tx->t_lng) + return tx->t [coln] & 0x00FF; /* gesuchtes Zeichen */ + + coln -= tx->t_lng & 0x00FF; + if ((tx= tx->next) == (struct TXT *) 0) + return -1; /* Error: Text Segment fehlt */ + } + + return -1; +} + +/* ------------------------------------------------------------------------ */ +int get_txt_visible ( +struct LINE *lp, /* Zeile, in der gesucht werden soll */ +int coln) /* Spalten Nummer: 0..32000 */ +{ + int ch; + + return ((ch= get_txt (lp, coln)) == -1) ? ' ' : ch; +} diff --git a/app/ned/03/ned0309.c b/app/ned/03/ned0309.c new file mode 100644 index 0000000000000000000000000000000000000000..1c5bb3834c2ab54a622048418b18583f81bc89bb --- /dev/null +++ b/app/ned/03/ned0309.c @@ -0,0 +1,56 @@ +/* + * FILE %ned/03/ned0309.c + * + * elementare Editierfunktionen + * + * written: 1987 04 08 + * 1991 01 29: Revision + * latest update: 1996-07-26 3:28:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern int akt_page; +extern int COL_SCROLL; + +/* ------------------------------------------------------------------------ */ +void wd_coldis ( +register struct WINDOWCTRL *w, +int la, /* 1. Zeile im Window */ +int lz, /* letzte Zeile(#); Inklusive */ +struct LINE *lp, /* 1. anzuzeigende Zeile */ +int coln, /* # des Zeichens im Text */ +int colpos) /* Spalten # fuer Ausgabe */ +/* ANM: diese Funktion scheint jetzt zu funktionieren siehe p_ins () */ +{ + int ch; + int att; + + att= (w == (struct WINDOWCTRL *) 0) ? COL_SCROLL : w->attr_text; + + for (;;) + { + if (lp == (struct LINE *) 0) w_setchar (0, colpos, la, att, ' '); + else + { + if (lp->ftr != (struct FEATURE *) 0 || (lp->line_flg & LINE_inBLOCK)) + { /* #### Korrekte Ausgabe der Farben ginge sicher effizienter! ##### */ + wd_displine (w, lp, la, w->ax, w->bx); + } + else + { + ch= get_txt (lp, coln); + w_setchar (akt_page, colpos, la, att, (ch == -1) ? ' ' : ch); + } + lp= lp->next; + } + if (la++ == lz) break; + } +} diff --git a/app/ned/03/ned0310.c b/app/ned/03/ned0310.c new file mode 100644 index 0000000000000000000000000000000000000000..833efd019923bbe53c2bd9d96e77bc940262e849 --- /dev/null +++ b/app/ned/03/ned0310.c @@ -0,0 +1,30 @@ +/* + * FILE %ned/03/ned0310.c + * + * elementare Editierfunktionen + * + * written: 1987 04 08 + * 1991 01 29: Revision + * latest update: 1996-03-16 1:36:17 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_colornxt () +{ + int color; + + color= (aw->attr_text + 1) & 0x0F; + aw->attr_text= (aw->attr_text & 0xF0) | color; + aw->w_upd |= 0x04; + ned_display_window (aw); +} diff --git a/app/ned/03/ned0311.c b/app/ned/03/ned0311.c new file mode 100644 index 0000000000000000000000000000000000000000..2f1b5ddddbca6a69ce9030f8dafcadc2b40fb307 --- /dev/null +++ b/app/ned/03/ned0311.c @@ -0,0 +1,31 @@ +/* + * FILE %ned/03/ned0311.c + * + * elementare Editierfunktionen + * + * written: 1987 04 08 + * 1991 01 29: Revision + * latest update: 1996-03-16 1:37:04 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_backcolnxt () +{ + int color; + + color= (aw->attr_text & 0x70) >> 4; + color= ((color + 1) << 4) & 0x70; + aw->attr_text= (aw->attr_text & 0x8F) | color; + aw->w_upd |= 0x04; + ned_display_window (aw); +} diff --git a/app/ned/03/ned0312.c b/app/ned/03/ned0312.c new file mode 100644 index 0000000000000000000000000000000000000000..dbcf509ecb8c5a96e8c5cef1a11b2c596a618782 --- /dev/null +++ b/app/ned/03/ned0312.c @@ -0,0 +1,41 @@ +/* + * FILE %ned/03/ned0312.c + * + * elementare Editierfunktionen + * + * written: 1991 01 29 + * latest update: 2001-02-11 12:57:37 + * $Id: ned0312.c,v 1.2 2001/02/12 00:03:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int get_confirmation (char *message, int std) +{ + int k; + + ned_message_1 (message); + +RETRY: + k= test_maus ('Y', 'N', 0); + if (k == 0x1B) return -1; + if (k == 'j' || k == 'J' || k == 0x09 || + k == 'y' || k == 'Y' || k == 0x19) return 1; + + if (k == 'n' || k == 'N' || k == 0x0E) return 0; + + if (std == -1) + { + vi_bell (); + goto RETRY; + } + + return std; +} diff --git a/app/ned/03/ned0313.c b/app/ned/03/ned0313.c new file mode 100644 index 0000000000000000000000000000000000000000..9f35ba254771065cb9d0c909a1d45c0d214d0822 --- /dev/null +++ b/app/ned/03/ned0313.c @@ -0,0 +1,83 @@ +/* + * FILE %ned/03/ned0313.c + * + * elementare Editierfunktionen + * + * written: 1987 04 08 + * 1991 01 29: Revision + * 1991 06 02: Revision + * latest update: 1997-10-26 10:27:04 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern struct MARKER b_beg, b_end; + +/* ------------------------------------------------------------------------ */ +void p_turn_line () /* Zwei Zeilen vertauschen */ +{ + struct LINE *ltmp; + struct LINE *aw_act; + int new_first= 0; + + if ((aw_act= aw->WC_act) == (struct LINE *) 0 + || (ltmp= aw_act->WC_next) == (struct LINE *) 0 + ) return; + + if (aw_act->WC_prev == (struct LINE *) 0) new_first= 1; + + /* handle block flags ... nasty, long work :(( */ + if (aw_act == b_beg.ptr) + { + if (ltmp == b_end.ptr) + { /* switch block begin and block end!!! */ + struct LINE *p; + int o; + + p= b_beg.ptr; + o= b_beg.offset; + b_beg.ptr= b_end.ptr; + b_beg.offset= b_end.offset; + b_end.ptr= p; + b_end.offset= o; + } + else + if (!(aw_act == b_end.ptr)) + ltmp->line_flg &= LINE_BLOCK_CLR; + } + else + if (ltmp == b_beg.ptr) + { + if (!(ltmp == b_end.ptr)) + aw_act->line_flg |= LINE_BLOCK_INBLOCK; + } + else + if (aw_act == b_end.ptr) + { + ltmp->line_flg |= LINE_BLOCK_INBLOCK; + } + else + if (ltmp == b_end.ptr) + { + aw_act->line_flg &= LINE_BLOCK_CLR; + } + + ltmp->prev= aw_act->prev; + aw_act->prev= ltmp; + if (ltmp->next != (struct LINE *) 0) ltmp->next->prev= aw_act; + if (!new_first) ltmp->prev->next= ltmp; + aw_act->next= ltmp->next; + ltmp->next= aw_act; + aw->WC_act= ltmp; + if (new_first) aw->first= ltmp; + + aw->f_upd= 1; + ned_display_window (aw); +} diff --git a/app/ned/03/ned0314.c b/app/ned/03/ned0314.c new file mode 100644 index 0000000000000000000000000000000000000000..1b889d7d589573d8ed50795317f8456815eb0c01 --- /dev/null +++ b/app/ned/03/ned0314.c @@ -0,0 +1,39 @@ +/* + * FILE %ned/03/ned0314.c + * + * elementare Editierfunktionen + * + * written: 1987 04 08 + * 1991 01 29: Revision + * 1991 05 29: revision + * latest update: 2001-02-11 12:55:49 + * $Id: ned0314.c,v 1.2 2001/02/12 00:03:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" +#include "message.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_fget () /* ^K G: Get File */ +{ + if (oper_level >= LEV_FNM) return; + + if (aw->f_upd) + { + if (get_confirmation (CNF_old_version, 0) <= 0) return; + aw->f_upd= 0; + } + + s_fget (aw); + ned_display_window (aw); +} diff --git a/app/ned/03/ned0315.c b/app/ned/03/ned0315.c new file mode 100644 index 0000000000000000000000000000000000000000..b13eb8bd65f33831a48a7c524055d7482675e4e3 --- /dev/null +++ b/app/ned/03/ned0315.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/03/ned0315.c + * + * ALT--: Eingabe eines einfachen Querstriches (Character 196, 0xC4) + * + * written: 1989 12 16 + * 1991 01 29: Revision + * latest update: 1997-01-19 0:50:59 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_alt_minus () +{ +#ifdef MSDOS + q_insert (0xC4, 1); +#endif +} diff --git a/app/ned/03/ned0316.c b/app/ned/03/ned0316.c new file mode 100644 index 0000000000000000000000000000000000000000..6ec968071959da125e4619cb81d6d857412b89aa --- /dev/null +++ b/app/ned/03/ned0316.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/03/ned0316.c + * + * ALT-=: Eingabe eines doppelten Querstriches (Character 205, 0xCD) + * + * written: 1989 12 16 + * 1991 01 29: Revision + * latest update: 1997-01-19 0:51:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_alt_gleich () +{ +#ifdef MSDOS + q_insert (0xCD, 1); +#endif +} diff --git a/app/ned/03/ned0319.c b/app/ned/03/ned0319.c new file mode 100644 index 0000000000000000000000000000000000000000..e2e38a3d08db0e3d4b4210bb9e58269592961e18 --- /dev/null +++ b/app/ned/03/ned0319.c @@ -0,0 +1,136 @@ +/* + * FILE %ned/03/ned0319.c + * + * NED_interpreter: main interpreter that handles all sorts of + * arriving events, such as key press, signals, mouse events etc. + * + * written: 1990 01 20: aus Modul NED00.C isoliert + * 1991 01 29: Revision + * 1991 06 01: Revision + * 1993-07-31: vi mode + * latest update: 1999-05-01 13:42:22 + * $Id: ned0319.c,v 1.4 2004/05/08 15:41:39 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +int (*cdecl P_TBL []) (void); +#endif + +#include <signal.h> +#include <stdio.h> +#include "ed.h" +#include "proto.h" +#ifdef USE_MOUSE +#include <gg/maus.h> +#endif +#include <gg/window.h> + +extern int (*P_TBL []) (void); +extern int pfx; +extern int key; +extern int repeat; +extern int ptbl_offset; +extern ned_input_handler *nextchar; /* Editor Eingabe: KBD | FILE .. */ +extern struct WINDOWCTRL *aw; + +static int std_pfx= P_NONE; /* normal editor mode */ + +static int signal_flag= 0; + +/* ------------------------------------------------------------------------ */ +void NED_interpreter () +{ + int pfx_c; + pfx= std_pfx; + + set_sig (); + + for (;;) /* Editor Hauptschleife: Tasten lesen und auswerten ----- */ + { + background (); + setcup (aw); + + if (signal_flag) + { + signal_flag= 0; + w_sig_winch (); + + setup_screen (); + ned_window_size (aw, 5, 1); + ned_w_jmp_aktline (aw, NEDJMP_LINE_3, 0, NEDJMP_FLAG_REDRAW); + } + +#ifdef USE_MOUSE + key= check_maus (); +#else + key= (*nextchar) (); +#endif /* USE_MOUSE */ + if (key < 0) continue; + + pfx_c= pfx; + pfx= std_pfx; + + if (pfx_c < N_PFX) + { + ptbl_offset= pfx_c*128 + key; + (*P_TBL [ptbl_offset]) (); + } +#ifdef __OLD__ /* 1997-01-05 11:49:24 */ + else p_ins (); /* ^P: Sondercode */ +#endif /* __OLD__ 1997-01-05 11:49:24 */ + +#ifdef USE_MOUSE + maus_enable (); +#endif + + if (key < '0' || key > '9') /* && in vi mode T2D */ + repeat= 0; + } +} + +/* ------------------------------------------------------------------------ */ +void vi_on () +{ +#ifdef USE_ABBREVIATIONS + ned_check_abbrev (); +#endif /* USE_ABBREVIATIONS */ + + ned_message_1 ("switching to vi mode!"); + std_pfx= pfx= P_VI; + ned_set_marker (aw, '.'); +} + +/* ------------------------------------------------------------------------ */ +void vi_ins () +{ + ned_wc_ins_mode (aw, INSFLG_insert); +} + +/* ------------------------------------------------------------------------ */ +void vi_ovr () +{ + ned_wc_ins_mode (aw, INSFLG_overwrite); +} + +/* ------------------------------------------------------------------------ */ +void ned_wc_ins_mode (struct WINDOWCTRL *wc, int mode) +{ + if (wc != (struct WINDOWCTRL *) 0) wc->ins_flg= mode; + std_pfx= pfx= P_NONE; + /*** ned_set_marker (wc, ','); ***/ +} + +/* ------------------------------------------------------------------------ */ +void misc_sig (int sig) +{ + signal_flag= sig; +} + +/* ------------------------------------------------------------------------ */ +int set_sig (void) +{ + signal (SIGWINCH, &misc_sig); + return 0; +} diff --git a/app/ned/03/ned0320.c b/app/ned/03/ned0320.c new file mode 100644 index 0000000000000000000000000000000000000000..45fccdbe222287743626b2ba1fcb8eea7a6eb0bf --- /dev/null +++ b/app/ned/03/ned0320.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/03/ned0320.c + * + * ALT-Z: Eingabe eines NULL-Characters (Character 0, 0x00) + * + * written: 1989 12 16 + * 1991 01 29: Revision + * latest update: 1997-01-05 12:06:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_alt_zero () +{ + ned_insert_special_char ('0'); +} diff --git a/app/ned/03/ned0321.c b/app/ned/03/ned0321.c new file mode 100644 index 0000000000000000000000000000000000000000..44e9c9477a3be41d6659e9257c9b7cdebb6df0b1 --- /dev/null +++ b/app/ned/03/ned0321.c @@ -0,0 +1,29 @@ +/* + * FILE %ned/03/ned0321.c + * + * Umschalten des 0x0D Flags in der aktuellen Zeile + * + * written: 1990 11 01 + * 1991 01 29: Revision + * latest update: 1996-05-23 17:46:40 + * $Id: ned0321.c,v 1.2 2001/08/26 23:27:14 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_line_end_MAC () +{ + if (aw == (struct WINDOWCTRL *) 0) return; + + ned_line_end_UNIX (); + aw->bin_eoln= 0x0D; +} diff --git a/app/ned/03/ned0322.c b/app/ned/03/ned0322.c new file mode 100644 index 0000000000000000000000000000000000000000..786a4b7778801248b6d3d594252ff84ec57d10ea --- /dev/null +++ b/app/ned/03/ned0322.c @@ -0,0 +1,46 @@ +/* + * FILE %ned/03/ned0322.c + * + * Text to DOS: Einschalten des 0x0D Flags im ganzen File + * + * written: 1990 11 04 + * 1991 01 29: Revision + * latest update: 1996-07-26 3:34:09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_line_end_MSDOS () +{ + register struct LINE *l1, *l2; + + if (aw == (struct WINDOWCTRL *) 0 + || (l1= l2= aw->WC_act) == (struct LINE *) 0 + || (aw->WC_edit_mode & EDIT_READ_ONLY) + ) return; + + aw->bin_eoln= 0x0A; + + while (l1 != (struct LINE *) 0) + { + l1->line_flg |= LINE_CODE_0x0D; + l1= l1->prev; + } + + while (l2 != (struct LINE *) 0) + { + l2->line_flg |= LINE_CODE_0x0D; + l2= l2->next; + } + + aw->f_upd= 1; +} diff --git a/app/ned/03/ned0323.c b/app/ned/03/ned0323.c new file mode 100644 index 0000000000000000000000000000000000000000..113c1231911078d6ea59509e386efd14edce0b31 --- /dev/null +++ b/app/ned/03/ned0323.c @@ -0,0 +1,48 @@ +/* + * FILE %ned/03/ned0323.c + * + * Text to Unix: Ausschalten des 0x0D Flags im ganzen File + * + * written: 1990 11 04 + * 1991 01 29: Revision + * latest update: 1996-07-26 3:34:33 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_line_end_UNIX () +{ + register struct LINE *l1, *l2; + int code; + + if (aw == (struct WINDOWCTRL *) 0 + || (l1= l2= aw->WC_act) == (struct LINE *) 0 + || (aw->WC_edit_mode & EDIT_READ_ONLY) + ) return; + + aw->bin_eoln= 0x0A; + code= ~LINE_CODE_0x0D; + + while (l1 != (struct LINE *) 0) + { + l1->line_flg &= code; + l1= l1->prev; + } + + while (l2 != (struct LINE *) 0) + { + l2->line_flg &= code; + l2= l2->next; + } + + aw->f_upd= 1; +} diff --git a/app/ned/03/ned0324.c b/app/ned/03/ned0324.c new file mode 100644 index 0000000000000000000000000000000000000000..d08ba89b7670f8b355c0710f530c18d622288d24 --- /dev/null +++ b/app/ned/03/ned0324.c @@ -0,0 +1,62 @@ +/* + * FILE %ned/03/ned0324.c + * + * NEDa1_interpreter + * + * written: 1990 01 20: aus Modul NED00.C isoliert + * 1991 01 29: Revision + * latest update: 1997-10-26 10:26:59 + * $Id: ned0324.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <signal.h> +#include "ed.h" +#include <gg/window.h> +#include "proto.h" +#ifdef USE_MOUSE +#include <gg/maus.h> +#endif + +extern int CMD_TBL []; +extern char PGM []; +extern int pfx; +extern int key; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void NEDa1_interpreter () +{ + int pfx_c= 0; + + for (;;) /* Editor Hauptschleife: Tasten lesen und auswerten ----- */ + { + if (pfx == P_FUNCT) pfx = 0; + if (pfx) if (pfx_c) pfx = pfx_c = 0; + else pfx_c++; + background (); + setcup (aw); + +#ifdef USE_MOUSE + key= ned_check_mouse (); +#else + key= (*nextchar) (); +#endif + + if (key < 0x0200) + if (pfx < N_PFX) + { + NEDa2_interpreter (& PGM [CMD_TBL [pfx* 0x0200 + key]]); + } + else p_ins (); /* ^P: Sondercode */ + +#ifdef USE_MOUSE + maus_enable (); +#endif + } +} diff --git a/app/ned/03/ned0325.c b/app/ned/03/ned0325.c new file mode 100644 index 0000000000000000000000000000000000000000..74181f0c3d68552b6023d9625ede12530b17a58d --- /dev/null +++ b/app/ned/03/ned0325.c @@ -0,0 +1,37 @@ +/* + * FILE ~/usr/ned/03/ned0325.c + * + * NED_interpreter + * + * written: 1990 01 20: aus Modul NED00.C isoliert + * 1991 01 29: Revision + * latest update: 1994-04-29 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +void cdecl ret (void); +int (*cdecl PRIMITIVE_code []) (void); +extern int (* PRIMITIVE_code []) (void); +extern int PRIMITIVE_size []; + +/* ------------------------------------------------------------------------ */ +void NEDa2_interpreter (char *IP) +{ + int dist; + + for (;;) + { + (*PRIMITIVE_code [*IP]) (); + if ((dist = PRIMITIVE_size [*IP]) == 0) break; + IP += dist; + } +} + +void ret (void) {} diff --git a/app/ned/03/ned0326.c b/app/ned/03/ned0326.c new file mode 100644 index 0000000000000000000000000000000000000000..fec853f51619eede8823c8d055ba741ff6c8cc8f --- /dev/null +++ b/app/ned/03/ned0326.c @@ -0,0 +1,26 @@ +/* + * FILE ~/usr/ned/03/ned0326.c + * + * written: 1987 08 19 + * 1991 01 29: Revision + * 1991 05 26: Revision + * latest update: 1994-12-28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern int akt_page; + +/* ------------------------------------------------------------------------ */ +void wd_init (struct WINDOWCTRL *w) +{ + if (akt_page != w->page) + w_selpage (akt_page= w->page); +} diff --git a/app/ned/03/ned0327.c b/app/ned/03/ned0327.c new file mode 100644 index 0000000000000000000000000000000000000000..cdc9ef2b89025539e8987442ac4c4586a87c1a51 --- /dev/null +++ b/app/ned/03/ned0327.c @@ -0,0 +1,43 @@ +/* + * FILE %ned/03/ned0327.c + * + * ======================================================== + * Einlesen von Tastencodes und Behandlung der + * Funktionstasten + * ======================================================== + * Dieses File wird nur unter MS_DOS benoetigt! + * Es ersetzt das File CONIO.S unter CPM68K. + * ======================================================== + * + * written: 1987 08 19 + * 1989 08 15: Revision + * 1991 01 29: Revision + * latest update: 1997-09-07 12:57:22 + * $Id: ned0327.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/keys.h> +#include "ed.h" +#include "proto.h" + +extern int pfx; + +/* ------------------------------------------------------------------------ */ +int q_kbin () +{ + int k; + + if ((k= kbin ()) == -1) return -1; + + if (k >= 0x0100) pfx= P_FUNCT; + + k &= 0x00FF; + + return k; +} diff --git a/app/ned/03/ned0328.c b/app/ned/03/ned0328.c new file mode 100644 index 0000000000000000000000000000000000000000..0f0270af509227df1c4cbb65a6099c351e5e12fb --- /dev/null +++ b/app/ned/03/ned0328.c @@ -0,0 +1,142 @@ +/* + * FILE %ned/03/ned0328.c + * + * insert or overwrite a character in a line structure + * + * written: 1991 01 29: aus ned0305.c extrahiert + * latest update: 1999-11-28 12:59:04 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct MARKER b_beg, b_end; + +/* ------------------------------------------------------------------------ */ +int qq_insert ( +struct LINE *lp, /* line structure where insertion takes place */ +int insert_idx, /* insert position within the line */ +int character, /* character to insert */ +int insert_flag) /* 0 -> overwrite modus; 1 -> insert modus; */ +/* RETURN -1 ... error; 0 ... no update, 1 .. update */ +{ + int i; /* index within the TXT-segment */ + int sav[2]; /* buffer for shifting text ahead one character */ + char *cpins; /* insert position pointer */ + char *cp1; /* text position 1 */ + char *cp2; /* text position 2 */ + int lsl1; /* line segment length 1 */ + int lsl2; /* line segment length 2 */ + + register struct TXT *tx1, *tx2; + register struct FEATURE *pftr= (struct FEATURE *) 0; + register struct FEATURE **ppftr; + + if (lp == (struct LINE *) 0) return -1; + if (lp->line_flg & LINE_PROTECTED) return 0; + + if ((ppftr= ned_feature_find (lp, insert_idx, 1)) != (struct FEATURE **) 0) + { + pftr= *ppftr; + if (pftr->ftr_edit_flags & (FTR_EDIT_NO_TEXT | FTR_EDIT_NO_INSERT)) + return 0; + } + + sav [0]= sav [1]= 0; + + if ((tx1= lp->txt) == (struct TXT *) 0) + tx1= lp->txt= txch_alloc (TXT_LNG, 0x20); + + for (i= insert_idx; i >= tx1->t_lng;) + { + i -= tx1->t_lng; + if (tx1->next == (struct TXT *) 0 + && (tx1->next= txch_alloc (TXT_LNG, 0x20)) == (struct TXT *) 0 + ) + return -1; + + tx1= tx1->next; + } + cpins= &tx1->t[i]; + + if (insert_flag == INSFLG_insert /* insert mode ... */ + || insert_idx == lp->lng /* ... or append at end of line */ + ) + { + tx2= tx1; + lsl1= tx1->t_lng-i; + cp1= cpins; + lsl2= lsl1-1; + cp2= cp1 +1; + + i= insert_idx; + sav [i % 2] = *cp1 & 0x00FF; + for (; i < lp->lng; i++) + { + if (lsl1 == 0) + { + if (tx1->next == (struct TXT *) 0) break; + tx1= tx1->next; + lsl1= tx1->t_lng; + cp1= tx1->t; + } + + if (lsl2 == 0) + { + if (tx2->next == (struct TXT *) 0) + tx2->next= txch_alloc (TXT_LNG, 0); + tx2= tx2->next; + lsl2= tx2->t_lng; + cp2= tx2->t; + } + + sav [(i+1) % 2] = (*cp2) & 0x00FF; + *cp2++= (char) sav [i % 2]; + cp1++; + lsl1--; + lsl2--; + } + lp->lng++; + } + + *cpins= (char) character; /* actual inserting of the character */ + + if (pftr != (struct FEATURE *) 0 + && insert_flag == INSFLG_insert + && pftr->ftr_pos < insert_idx + ) + { /* cursor was within a displayed feature, expand that area */ + pftr->ftr_replarray_size++; + } + + if (insert_flag == INSFLG_insert) + { + /* TAG_SHIFT: see * for details */ + for (pftr= lp->ftr; pftr != (struct FEATURE *) 0; pftr= pftr->ftr_next) + { + if (pftr->ftr_pos >= insert_idx) pftr->ftr_pos++; + +#ifdef __JUNK__ /* 1996-03-10 14:32:34 */ +... diese Funktion wird sowohl fuer das Inserten von normalen +Text als auch fuer Feature Segmente durch ned_wc_feature_create () +verwendet, daher kann es zu einer Ueberschneidung des replarray +kommen, was wiederum zu unerwuenschte Effekten fuehren wuerde... + + /* EXP: 1996-03-10 13:30:03 (see: *) */ + if (pftr->ftr_pos < insert_idx + && pftr->ftr_pos + pftr->ftr_replarray_size-1 >= insert_idx + ) + pftr->ftr_replarray_size++; +#endif /* __JUNK__ 1996-03-10 14:32:34 */ + } + + ned_line_trigger_change (lp, insert_idx, 1); + } + + return 1; +} diff --git a/app/ned/03/ned0329.c b/app/ned/03/ned0329.c new file mode 100644 index 0000000000000000000000000000000000000000..23a1ea2547a250a67019479346ec6524215c0a1c --- /dev/null +++ b/app/ned/03/ned0329.c @@ -0,0 +1,108 @@ +/* + * FILE %ned/03/ned0329.c + * + * elementare Editierfunktionen + * + * written: 1991 01 29: aus NED0306.C extrahiert + * latest update: 1997-08-28 7:09:12 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int qq_delete ( +struct LINE *lp, +int delete_idx, +int delete_cnt) +/* RETURN: -1 .. erorr; 0 .. no update; 1 .. update */ +{ + int i; /* Index innerhalb der Zeile */ + int lsl1; + int lsl2; + char *cp1; + char *cp2; + + register struct TXT *tx1, *tx2; + register struct FEATURE *pftr= (struct FEATURE *) 0; + register struct FEATURE **ppftr; + + if (lp == (struct LINE *) 0) return -1; + if (lp->line_flg & LINE_PROTECTED) return 0; + + if ((ppftr= ned_feature_find (lp, delete_idx, 1)) != (struct FEATURE **) 0) + { + pftr= *ppftr; + if (pftr->ftr_edit_flags & (FTR_EDIT_NO_TEXT | FTR_EDIT_NO_INSERT)) + return 0; + } + + if ((tx2= tx1= lp->txt) == (struct TXT *) 0) return -1; + + /* Positionierung des Destination Pointers */ + for (i= delete_idx; i >= tx1->t_lng;) + { + i -= tx1->t_lng; + if (tx1->next == (struct TXT *) 0) return 0; + tx1= tx1->next; + } + + cp1= &tx1->t [i]; + lsl1= tx1->t_lng-i; + + /* Positionierung des Source Pointers */ + for (i= delete_idx+delete_cnt; i >= tx2->t_lng;) + { + i -= tx2->t_lng; + if (tx2->next == (struct TXT *) 0) goto DONE; + tx2= tx2->next; + } + cp2= &tx2->t[i]; + lsl2= tx2->t_lng-i; + + for (i= lp->lng - delete_idx - delete_cnt; i > 0; i--) + { + if (lsl1 == 0) + { + if (tx1->next == (struct TXT *) 0) break; + tx1= tx1->next; + lsl1= tx1->t_lng; + cp1= tx1->t; + } + + if (lsl2 == 0) + { + if (tx2->next == (struct TXT *) 0) break; + tx2= tx2->next; + lsl2= tx2->t_lng; + cp2= tx2->t; + } + + *cp1++= *cp2++; + lsl1--; + lsl2--; + } + +DONE: + txt_adj (lp->lng -= delete_cnt, &lp->txt); + + if (pftr != (struct FEATURE *) 0 + && pftr->ftr_pos < delete_idx + ) + { /* cursor was within a displayed feature, shrink that area */ + pftr->ftr_replarray_size -= delete_cnt; + } + + /* Anpassung von Markern und Features */ + for (pftr= lp->ftr; pftr != (struct FEATURE *) 0; pftr= pftr->ftr_next) + if (pftr->ftr_pos > delete_idx) pftr->ftr_pos -= delete_cnt; + + ned_line_trigger_change (lp, delete_idx, -delete_cnt); + + return 1; +} diff --git a/app/ned/03/ned0330.c b/app/ned/03/ned0330.c new file mode 100644 index 0000000000000000000000000000000000000000..700ca82be5a077ac01367d74fe9b35a7c1fb3c41 --- /dev/null +++ b/app/ned/03/ned0330.c @@ -0,0 +1,85 @@ +/* + * FILE %ned/03/ned0330.c + * + * delete word modes: + * 0 .. vi de + * 1 .. like vi de but join lines if EOLN + * 2 .. vi dw + * 3 .. vi dW + * 4 .. vi dE + * + * written: 1991 01 31 + * latest update: 1999-05-01 9:58:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int COL_TEXT; + +/* ------------------------------------------------------------------------ */ +void ned_delete_word (void) /* former p_delete_word */ +{ + set_repeat_command (ned_delete_word); + ned_wc_delete_word (aw, 0); +} + +/* ------------------------------------------------------------------------ */ +void ned_delete_word_2 (void) +{ + set_repeat_command (ned_delete_word_2); + ned_wc_delete_word (aw, 2); +} + +/* ------------------------------------------------------------------------ */ +void ned_delete_word_3 (void) +{ + set_repeat_command (ned_delete_word_3); + ned_wc_delete_word (aw, 3); +} + +/* ------------------------------------------------------------------------ */ +void ned_delete_word_4 (void) +{ + set_repeat_command (ned_delete_word_4); + ned_wc_delete_word (aw, 4); +} + +/* ------------------------------------------------------------------------ */ +int ned_wc_delete_word (struct WINDOWCTRL *wc, int mode) +{ + int delete_idx; + + if (wc->WC_act == (struct LINE *) 0 + || (wc->WC_edit_mode & EDIT_READ_ONLY) + ) return -1; + + delete_idx= wc->cx + wc->hv - wc->ax; + + if (mode == 1) /* this is not used anywhere */ + { + /* Dieser Abschnitt dient dazu am Ende einer Zeile die Zeile */ + /* mit der naechsten Zeile zusammenzufuegen. (wie CTRL-G) */ + if (delete_idx == wc->WC_act->lng) + { + if (wc->WC_act->txt == (struct TXT *) 0) + ned_wc_delete_line (wc, 1, COL_TEXT); + else ned_join3 (wc); + ned_display_window (wc); + return 0; + } + mode= 0; /* else: perform normal delete operation im mode 0 */ + } + + ned_lp_delete_word (wc->WC_act, delete_idx, mode); + wc->f_upd= 1; + wd_displine (wc, wc->WC_act, wc->cy, wc->ax, wc->bx); + + return 0; +} diff --git a/app/ned/03/ned0331.c b/app/ned/03/ned0331.c new file mode 100644 index 0000000000000000000000000000000000000000..b146be685294c9d8331b3e86c52fbbf42195ab15 --- /dev/null +++ b/app/ned/03/ned0331.c @@ -0,0 +1,51 @@ +/* + * FILE %ned/03/ned0331.c + * + * written: 1991 01 31 + * latest update: 1999-05-01 9:14:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_lp_delete_word (struct LINE *lp, int delete_idx, int mode) +{ + int ch; + int current; + int charset= CHARSET_token; + int delete_blanks= 0; + + if ((ch= get_txt (lp, delete_idx)) == -1) return; /* nothing to do... */ + + current= in_charset (ch, (charset= CHARSET_blank)); + if (current == 0) + { + charset= (mode == 3 || mode == 4) ? CHARSET_non_blank : CHARSET_token; + current= in_charset (ch, charset); + + if (mode == 2 || mode == 3) delete_blanks= 1; + } + +AGAIN: + do + { + qq_delete (lp, delete_idx, 1); + ch= get_txt (lp, delete_idx); + } + while (in_charset (ch, charset) == current && ch != -1); + + if (delete_blanks && ch != -1) + { + current= in_charset (ch, (charset= CHARSET_blank)); + delete_blanks= 0; + if (current) goto AGAIN; + } +} diff --git a/app/ned/03/ned0332.c b/app/ned/03/ned0332.c new file mode 100644 index 0000000000000000000000000000000000000000..c334cc05b21b37706e10149a362ef567c31c64ca --- /dev/null +++ b/app/ned/03/ned0332.c @@ -0,0 +1,33 @@ +/* + * FILE %ned/03/ned0332.c + * + * elementare Editierfunktionen + * + * written: 1991 01 29: aus NED0305.C extrahiert + * latest update: 1999-07-17 19:29:35 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int qq_insert_string ( +struct LINE *lp, +int insert_idx, /* Einfuegeposition innerhalb der Zeile */ +const char *str, +int str_lng, +int insert_flag) /* 0 -> overwrite modus; 1 -> insert modus; */ +/* RETURN -1 ... error; 0 ... ok */ +{ +/** printf ("0332: insert_string='%s' lng=%d lp=%08lX\n", str, str_lng, lp); **/ + while (str_lng-- > 0) + if (qq_insert (lp, insert_idx++, (*str++) & 0x00FF, insert_flag) == -1) + return -1; + + return 0; +} diff --git a/app/ned/03/ned0332b.c b/app/ned/03/ned0332b.c new file mode 100644 index 0000000000000000000000000000000000000000..1eafdecda2ede51cfa3f2947a6e7f06a62d0b300 --- /dev/null +++ b/app/ned/03/ned0332b.c @@ -0,0 +1,42 @@ +/* + * FILE %ned/03/ned0332b.c + * + * elementare Editierfunktionen + * + * written: 1996-11-03 + * latest update: 1996-11-03 16:48:33 + * $Id: ned0332b.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int qq_insert_string_array ( +struct LINE *lp, +int insert_idx, /* Einfuegeposition innerhalb der Zeile */ +const char *ftxt[], +int t_cnt, +int insert_flag) /* 0 -> overwrite mode; 1 -> insert mode; */ +{ + int fc; /* insert pointer within feature text line */ + int fl; /* length of feature text line */ + int i; + + fc= insert_idx; + for (i= 0; i < t_cnt; i++) + if (ftxt [i] != (char *) 0) + { + fl= strlen (ftxt [i]); + qq_insert_string (lp, fc, ftxt [i], fl, insert_flag); + fc += fl; + } + + return 0; +} diff --git a/app/ned/03/ned0333.c b/app/ned/03/ned0333.c new file mode 100644 index 0000000000000000000000000000000000000000..4d7847b8a559e30ce8b5e491c30adbe5db35f652 --- /dev/null +++ b/app/ned/03/ned0333.c @@ -0,0 +1,50 @@ +/* + * FILE %ned/03/ned0333.c + * + * written: 1995-10-22 + * latest update: 1997-01-19 15:26:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_save_reload (struct WINDOWCTRL *wc, int change_tag_display_mode) +{ + if (wc == (struct WINDOWCTRL *) 0) return; + + if (wc->file_or_frame != (void *) 0 && wc->f_upd) ned_w_save (wc, 1); + + switch (change_tag_display_mode) + { + case WCTDM_no_change: + break; + case WCTDM_show_tag: + case WCTDM_show_full_tag: + wc->wc_tag_display_mode= change_tag_display_mode; + break; + + case WCTDM_SGML: + wc->file_format= FMT_SGML; + wc->wc_tag_display_mode= WCTDM_normal; + break; + case WCTDM_ASCII: + wc->file_format= FMT_ASCII; + wc->wc_tag_display_mode= WCTDM_normal; + break; + + case WCTDM_normal: + default: + wc->wc_tag_display_mode= WCTDM_normal; + break; + } + + ned_reset_markers (wc); + s_fget (wc); + ned_display_window (wc); +} diff --git a/app/ned/03/ned0333b.c b/app/ned/03/ned0333b.c new file mode 100644 index 0000000000000000000000000000000000000000..38a6590b0e2c35dfab9a5fed5077617c171c993b --- /dev/null +++ b/app/ned/03/ned0333b.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/03/ned0333b.c + * + * written: 1991 11 08 + * latest update: 1996-12-29 22:26:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_save_reload () +{ + ned_save_reload (aw, WCTDM_no_change); +} diff --git a/app/ned/03/ned0333c.c b/app/ned/03/ned0333c.c new file mode 100644 index 0000000000000000000000000000000000000000..a9b9f771a88499c317095e4ad193d3bde34a1668 --- /dev/null +++ b/app/ned/03/ned0333c.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/03/ned0333c.c + * + * written: 1995-10-22 + * latest update: 1998-08-16 12:26:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_show_tag_normally () +{ + ned_save_reload (aw, WCTDM_normal); + ned_message_1 ("turned tag display off"); +} diff --git a/app/ned/03/ned0333d.c b/app/ned/03/ned0333d.c new file mode 100644 index 0000000000000000000000000000000000000000..95af8343dfb8984a27b0628f2184088369ac4913 --- /dev/null +++ b/app/ned/03/ned0333d.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/03/ned0333d.c + * + * written: 1995-10-22 + * latest update: 1998-08-16 12:26:12 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_show_tag () +{ + ned_save_reload (aw, WCTDM_show_tag); + ned_message_1 ("turned tag display on"); +} diff --git a/app/ned/03/ned0333e.c b/app/ned/03/ned0333e.c new file mode 100644 index 0000000000000000000000000000000000000000..9cb1198298ed7917a8c9f32e503aa79a972191a7 --- /dev/null +++ b/app/ned/03/ned0333e.c @@ -0,0 +1,37 @@ +/* + * FILE %ned/03/ned0333e.c + * + * written: 1995-10-22 + * latest update: 1999-05-01 15:03:02 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_show_full_tag () +{ + ned_save_reload (aw, WCTDM_show_full_tag); + ned_message_1 ("turned tag display on"); +} + +/* ------------------------------------------------------------------------ */ +void ned_reload_ascii () +{ + ned_save_reload (aw, WCTDM_ASCII); + ned_message_1 ("turned tag display on"); +} + +/* ------------------------------------------------------------------------ */ +void ned_reload_sgml () +{ + ned_save_reload (aw, WCTDM_SGML); + ned_message_1 ("turned tag display on"); +} diff --git a/app/ned/03/ned0334.c b/app/ned/03/ned0334.c new file mode 100644 index 0000000000000000000000000000000000000000..77bca8863bda278a94b71403aa9b67021d660262 --- /dev/null +++ b/app/ned/03/ned0334.c @@ -0,0 +1,28 @@ +/* + * FILE %ned/03/ned0334.c + * + * ALT-`: enter an entity string and insert it as a character + * + * written: 1994-05-30 + * latest update: 1996-10-05 11:47:28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/convent.h> + +/* ------------------------------------------------------------------------ */ +void ned_read_entity () +{ +#define BULEN 40 + char bu [BULEN]; + + bu [0]= 0; + if (rd_str ("Entity: ", bu, BULEN) == -1) return; + ned_enter_entity (bu); +} diff --git a/app/ned/03/ned0334b.c b/app/ned/03/ned0334b.c new file mode 100644 index 0000000000000000000000000000000000000000..ff914eb91f68a5dbab68b34b12aa6b00e269cbdc --- /dev/null +++ b/app/ned/03/ned0334b.c @@ -0,0 +1,30 @@ +/* + * FILE %ned/03/ned0334b.c + * + * insert an entity string as a character + * + * written: 1996-06-09 + * latest update: 1998-08-16 12:26:47 + * $Id: ned0334b.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/convent.h> + +/* ------------------------------------------------------------------------ */ +int ned_enter_entity (const char *str) +{ + int ch; + + if ((ch= find_pc_sgml_entity (str)) == -1) + ned_message_1 ("unknown entity"); + else q_insert (ch, 1); + + return ch; +} diff --git a/app/ned/03/ned0335.c b/app/ned/03/ned0335.c new file mode 100644 index 0000000000000000000000000000000000000000..78549e6939d2866e78e36981275d353ce2314faf --- /dev/null +++ b/app/ned/03/ned0335.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/03/ned0335.c + * + * toggle character case at cursor postion + * + * written: 1994-07-20 + * latest update: 1997-01-19 0:51:59 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +/* ------------------------------------------------------------------------ */ +void p_toggle_case () +{ + q_insert (0x0100, 1); +} diff --git a/app/ned/03/ned0341a.c b/app/ned/03/ned0341a.c new file mode 100644 index 0000000000000000000000000000000000000000..d79d4f2c5f5d077e401b641b935a4e7f3d32dd3c --- /dev/null +++ b/app/ned/03/ned0341a.c @@ -0,0 +1,45 @@ +/* + * FILE %ned/03/ned0341a.c + * + * ned line callbacks + * + * written: 1997-04-12 + * latest update: 1997-07-03 20:54:33 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_line_trigger_change ( +struct LINE *lp, +int column, +int amount) +{ + struct LINE_CALLBACK *lcb; + line_callback *fnc; + int event; + + if (lp == (struct LINE *) 0) return -1; + + for (lcb= lp->callbacks; + lcb != (struct LINE_CALLBACK *) 0; + lcb= lcb->next) + { + event= lcb->event; + + if ((event & LCB_edit) + /***** && lcb->column > column ****/ + && (fnc= lcb->func) != (line_callback *) 0 + ) + (*fnc) (LCB_edit, (void *) lp, lcb->cd, + column, (void *) amount); + } + + return 0; +} diff --git a/app/ned/03/ned0341b.c b/app/ned/03/ned0341b.c new file mode 100644 index 0000000000000000000000000000000000000000..544df08a1fd2499b1d98d31205e17c6a89259f89 --- /dev/null +++ b/app/ned/03/ned0341b.c @@ -0,0 +1,59 @@ +/* + * FILE %ned/03/ned0341b.c + * + * ned line callbacks + * + * written: 1997-04-12 + * latest update: 1999-04-25 16:30:37 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_line_trigger_split_join ( +struct LINE *lp, +struct LINE *lp2, +int column, +int action) /* LCB_line_(split|join) */ +{ + struct LINE_CALLBACK *lcb, **lcbp; + line_callback *fnc; + int event; + int rc; + + if (lp == (struct LINE *) 0) return -1; + ned_message_1 ("ned0341b callback list"); + + for (lcbp= &lp->callbacks; + (lcb= *lcbp) != (struct LINE_CALLBACK *) 0; + ) + { + event= lcb->event; + rc= 0; + + if (( ((event & LCB_line_split) && action == LCB_line_split) + || ((event & LCB_line_join) && action == LCB_line_join) + ) + && (fnc= lcb->func) != (line_callback *) 0 + ) + rc= (*fnc) (action, (void *) lp, lcb->cd, column, (void *) lp2); + + if (rc == 1) + { + *lcbp= lcb->next; /* lcbp must stay there */ + free (lcb); + continue; + } + + lcbp= &lcb->next; + } + + return 0; +} diff --git a/app/ned/03/ned0341c.c b/app/ned/03/ned0341c.c new file mode 100644 index 0000000000000000000000000000000000000000..75f5b1daf6bea435e8c1b136bd3351301d35d9cd --- /dev/null +++ b/app/ned/03/ned0341c.c @@ -0,0 +1,68 @@ +/* + * FILE %ned/03/ned0341c.c + * + * ned line callbacks + * + * written: 1997-04-29 + * latest update: 1999-04-25 16:30:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* #define DEBUG */ +#ifdef DEBUG +#include <stdio.h> +#endif /* DEBUG */ + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_line_trigger_delete (struct LINE *lp, int destroy, int cycle) +{ + struct LINE_CALLBACK *lcb, **lcbp; + line_callback *fnc; + int event; + + while (lp != (struct LINE *) 0) + { + +#ifdef DEBUG +fprintf (stderr, "0341c: lcb trigger delete lp=%08lX\n", lp); +#endif /* DEBUG */ + + for (lcbp= &lp->callbacks; + (lcb= *lcbp) != (struct LINE_CALLBACK *) 0;) + { + event= lcb->event; + + if ((event & LCB_delete) + /***** && lcb->column > column ****/ + && (fnc= lcb->func) != (line_callback *) 0 + ) + { + (*fnc) (LCB_delete, (void *) lp, lcb->cd, 0, (void *) 0); + /* e.g. ned_marker_callback */ + } + + if (destroy) + { + *lcbp= lcb->next; + free (lcb); + } + else + { + lcbp= &lcb->next; + } + } + + if (!cycle) break; + lp= lp->next; + } + + return 0; +} diff --git a/app/ned/03/ned0342a.c b/app/ned/03/ned0342a.c new file mode 100644 index 0000000000000000000000000000000000000000..4e5b1d4f979b060b0791e1805b3ab803b1e887f5 --- /dev/null +++ b/app/ned/03/ned0342a.c @@ -0,0 +1,50 @@ +/* + * FILE %ned/03/ned0342a.c + * + * ned line callbacks + * + * written: 1997-04-13 + * latest update: 1999-04-25 16:30:42 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +#ifdef UX_DEBUG +#include <stdio.h> +#endif + +/* ------------------------------------------------------------------------ */ +int ned_line_reg_cb ( +struct LINE *lp, +line_callback *fnc, +int event_mask, +void *cd) +{ + struct LINE_CALLBACK *lcb; + +#ifdef UX_DEBUG + printf ("0342a ned_line_reg_cb (lp=%08lX fnc=%08lX event_mask=%d cd=%08lX)\n", + lp, fnc, event_mask, cd); +#endif + + if (lp == (struct LINE *) 0 + || (lcb= calloc (sizeof (struct LINE_CALLBACK), 1)) + == (struct LINE_CALLBACK *) 0 + ) return -1; + + lcb->func= fnc; + lcb->cd= cd; + lcb->event= event_mask; + + lcb->next= lp->callbacks; + lp->callbacks= lcb; + + return 0; +} diff --git a/app/ned/03/ned0342b.c b/app/ned/03/ned0342b.c new file mode 100644 index 0000000000000000000000000000000000000000..5807e56e80f3f10548ffcb0998e9c83e5d7be104 --- /dev/null +++ b/app/ned/03/ned0342b.c @@ -0,0 +1,56 @@ +/* + * FILE %ned/03/ned0342b.c + * + * ned line callbacks + * + * written: 1997-04-13 + * latest update: 1999-04-25 16:30:45 + * $Id: ned0342b.c,v 1.3 2003/10/02 06:45:51 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +#ifdef UX_DEBUG +#include <stdio.h> +#endif + +/* ------------------------------------------------------------------------ */ +int ned_line_rel_cb ( +struct LINE *lp, +line_callback *fnc, +int event_mask, +void *cd) +{ + struct LINE_CALLBACK *lcb, **lcbp; + +#ifdef UX_DEBUG + printf ("0342b ned_line_rel_cb (lp=%08lX fnc=%08lX event_mask=%d cd=%08lX)\n", + lp, fnc, event_mask, cd); +#endif + + if (lp == (struct LINE *) 0) return -1; + + for (lcbp= &lp->callbacks; + (lcb= *lcbp) != (struct LINE_CALLBACK *) 0; + lcbp= &lcb->next) + { + if (lcb->func == fnc /* BUG HERE: see %ned/crashes */ + && lcb->cd == cd + && lcb->event == event_mask + ) + { + *lcbp= lcb->next; + free (lcb); + break; /* just remove one matching handler */ + } + } + + return 0; +} diff --git a/app/ned/03/ned0342c.c b/app/ned/03/ned0342c.c new file mode 100644 index 0000000000000000000000000000000000000000..762ade69ea8d12c98c44ff2b24428ab0417daa42 --- /dev/null +++ b/app/ned/03/ned0342c.c @@ -0,0 +1,42 @@ +/* + * FILE %ned/03/ned0342c.c + * + * ned line callbacks + * + * written: 1997-07-27 + * latest update: 1999-04-25 16:30:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_line_test_cb (struct LINE *lp) +{ + struct LINE_CALLBACK *lcb; + char buff [80]; + + if (lp == (struct LINE *) 0 + || (lcb= lp->callbacks) == (struct LINE_CALLBACK *) 0 + ) return 0; + + sprintf (buff, "LINE %08lX has callbacks!\n", lp); + ned_error_message (buff); + + for (; + lcb != (struct LINE_CALLBACK *) 0; + lcb= lcb->next) + { + sprintf (buff, "+ callback %08lX\n", lcb); + ned_error_message (buff); + } + + return -1; +} diff --git a/app/ned/04/(dirinf).fm b/app/ned/04/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..d1e2ab28a6e2edf033c6c8f861aed8cfe6b4dac6 --- /dev/null +++ b/app/ned/04/(dirinf).fm @@ -0,0 +1,50 @@ +# +# FILE %ned/04/(dirinf).fm +# +# latest update: 2000-08-24 14:35:52 +# $Id: (dirinf).fm,v 1.2 2000/08/24 15:10:14 gonter Exp $ +# +# ---------------------------------------------------------------------------- + +Makefile | current makefile +make-dos | MSDOS makefile + +ned0401.c | void s_fget () +ned0402.c | int ned_f_read (w, fnm_txt, fnm_ftr, flag, laptr, lzptr, gcode) +ned0402b.c | int ned_stream_read (...) +ned0403.c | int ned_f_write (w, fnm_txt, fnm_ftr, flag, lz_flag, laptr, lzptr, flg2, gcode) +ned0404.c | int q_save (w, flg) +ned0405.c | int q_allsave (flg) +ned0406.c | void set_code (char *cp) /* set encryption code */ +ned0408.c | void p_sx () /* ^K X: Save ALL Windows and Exit */ +ned0409.c | void p_save () +ned0409b.c | void ned_rename_and_save () +ned0409c.c | void pico_exit () +ned0410.c | void p_ssave () +ned0411.c | void p_abandon () /* ^K Q: Abandon File at curr. Window */ +ned0412.c | void p_2abandon () +ned0413.c | void p_qabandon () +ned0414.c | void p_save_restart () +ned0415.c | void p_load_restart () +ned0416.c | void p_system () +ned0417.c | void p_link () /* ^K L: Link to File at Window */ +ned0417b.c | int q2_link (struct WINDOWCTRL *w_dest, struct WINDOWCTRL *w_src) +ned0418.c | void p_unlink () /* ^K I: Unlink linked File */ +ned0420.c | int editable_file (fnm) +ned0421.c | void p_XX_break () +ned0422.c | void ned_show_author () +ned0423.c | void ned_show_version () +ned0424.c | +ned0425.c | int find_file (char *str, ...) +ned0426.c | void q_system (char *command_line); +ned0427.c | void p_pfile () +ned0428.c | int access_gopher (char *hlink, char *fil); +ned0429.c | q_extract (char *filename, char *message) +ned0430.c | void p_extract () +ned0431.c | int dorothy_rw (...) +ned0432.c | IOA: int indirect_object_access (...) +ned0433.c | history handling +ned0433.c | int ned_history (...) +ned0434.c | char *ned_get_file_path (struct WINDOWCTRL *wc); +ned04t1.c | TEST: Test f�r ned0419.c ned0423.c ned0424.c +* | diff --git a/app/ned/04/Makefile b/app/ned/04/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..b65a883b49ce5ac36fec051fc3223781cfdf9c83 --- /dev/null +++ b/app/ned/04/Makefile @@ -0,0 +1,69 @@ +# +# FILE %ned/04/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# +# latest update: 2000-08-24 14:37:39 +# $Id: Makefile,v 1.4 2000/08/24 15:10:14 gonter Exp $ +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-c -g -I.. $(cf) +CC=cc +objs=ned0401.o ned0402.o ned0402b.o ned0403.o ned0404.o \ + ned0405.o ned0408.o ned0409.o ned0409b.o ned0409c.o \ + ned0410.o ned0411.o ned0412.o ned0413.o \ + ned0416.o ned0417.o \ + ned0418.o ned0421.o \ + ned0423.o ned0425.o ned0427.o \ + ned0428.o ned0429.o ned0430.o ned0431.o \ + ned0432.o ned0433.o ned0434.o + +objs_cur= ned0417b_cur.o ned0422_cur.o ned0426_cur.o +objs_tk= ned0417b_tk.o ned0422_tk.o ned0426_tk.o +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +# delayed processing for these modules: +objs2=ned0420.o + +all: lib_tk lib_cur +clean : + rm -f *.o lib_cur lib_tk + +lib_tk : $(objs_tk) $(objs) $(objs2) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs) $(objs2) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h + $(CC) $(OPTS) -c $*.c + +# ---------------------------------------------------------------------------- +ned04t1.exe : ned04t1.o ned0423.o ned0424.o ned0419.o + link ned04t1 ned0423 ned0424 ned0419; + +ned04t1.o : ned04t1.c + $(CC) $(OPTS) ned04t1.c +# --- cur Modules ---------- +ned0417b_cur.o : ../ed.h ned0417b.c + $(CC) $(OPTS) -o ned0417b_cur.o ned0417b.c + +ned0422_cur.o : ../ed.h ned0422.c + $(CC) $(OPTS) -o ned0422_cur.o ned0422.c + +ned0426_cur.o : ../ed.h ned0426.c + $(CC) $(OPTS) -o ned0426_cur.o ned0426.c + +# --- tk Modules ---------- +ned0417b_tk.o : ../ed.h ned0417b.c + $(CC) $(OPTS) -DUSE_TK -o ned0417b_tk.o ned0417b.c + +ned0422_tk.o : ../ed.h ned0422.c + $(CC) $(OPTS) -DUSE_TK -o ned0422_tk.o ned0422.c + +ned0426_tk.o : ../ed.h ned0426.c + $(CC) $(OPTS) -DUSE_TK -o ned0426_tk.o ned0426.c diff --git a/app/ned/04/contrib b/app/ned/04/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/04/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/04/gg b/app/ned/04/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/04/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/04/lib_cur b/app/ned/04/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/04/lib_tk b/app/ned/04/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/04/make-dos b/app/ned/04/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..b4f38fb882769207dd8ccb3ff96c02f575d17e16 --- /dev/null +++ b/app/ned/04/make-dos @@ -0,0 +1,33 @@ +# +# FILE %ned/04/makefile +# +# GG's Night(mare) Editor System +# +# latest update: 1997-01-12 17:19:11 +# +# ============================================================================ +ccc=cl -Os -AL /W3 /Fo$@ -I.. /c +obj=objdec -m0 -w -sl 2 NED04_TEXT $@ + +lib : ! + ned0401.obj ned0402.obj ned0402b.obj ned0403.obj ned0404.obj ! + ned0405.obj ned0406.obj ned0408.obj ned0409.obj ned0409b.obj ned0409c.obj ! + ned0410.obj ned0411.obj ned0412.obj ned0413.obj ! + ned0416.obj ned0417.obj ! + ned0417b.obj ned0418.obj ned0420.obj ned0421.obj ! + ned0422.obj ned0423.obj ned0425.obj ! + ned0426.obj ned0427.obj ned0428.obj ned0429.obj ! + ned0430.obj ned0431.obj ned0432.obj ned0433.obj ! + ned0434.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $*.c + $(obj) + +# ---------------------------------------------------------------------------- +ned04t1.exe : ned04t1.obj ned0423.obj ned0424.obj ned0419.obj + link ned04t1 ned0423 ned0424 ned0419; + +ned04t1.obj : ned04t1.c + $(ccc) ned04t1.c diff --git a/app/ned/04/ned0401.c b/app/ned/04/ned0401.c new file mode 100644 index 0000000000000000000000000000000000000000..fca13c892f38cad11e4a21bacb5991f6e5c3182b --- /dev/null +++ b/app/ned/04/ned0401.c @@ -0,0 +1,103 @@ +/* + * FILE %ned/04/ned0401.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1991 02 03: Revision + * 1993-01-18: remote file/frame read via dorothy + * 1993-01-31: removed dorothy and installed IOA + * (indirect object access) instead + * latest update: 1997-08-03 15:44:27 + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <gg/filename.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void s_fget (struct WINDOWCTRL *w) +{ + struct LINE *la= (struct LINE *) 0; + struct LINE *lb= (struct LINE *) 0; + struct FILECTRL *fc; + struct FRAMECTRL *frc; + struct CLUSTERCTRL *cc; + int rc= -1; + + w->cx= w->ax; + w->cy= w->ay; + w->hv= 0; + w->znr= 1; + w->ins_flg= INSFLG_insert; + + if (w->file_type == FTY_HYPER) + { + frc= (struct FRAMECTRL *) w->file_or_frame; + + if (frc != (struct FRAMECTRL *) 0 && frc->frame_lookup != FRAME_is_new) + { + cc= frc->cluster; + if (cc != (struct CLUSTERCTRL *) 0) + { + if (frc->links > 1) + frc->links--; /* ????????? */ + else ned_lines_free (w->WC_first); + + rc= ned_f_read (w, + cc->cluster_name_hyx, + (char *) 0, + 0, + &la, + &lb, + frc->frame_begin, + frc->frame_end); + } + } + } + else + { + fc= (struct FILECTRL *) w->file_or_frame; + if (fc != (struct FILECTRL *) 0) + { + if (fc->FC_links > 1) + fc->FC_links--; /* ????????? */ + else ned_lines_free (w->WC_first); + + rc= ned_f_read (w, + fc->FC_fnm_txt, + fc->FC_fnm_ftr, + 1, + &la, + &lb, + 0L, + 0x7FFFFFFFL); + } + } + + w->WC_act= w->first= la; + if (w->znr < 1) w->znr= 1; + w->w_upd |= 0x02; + + if (rc == 1 && la != (struct LINE *) 0) + { + rc= w->cx; + w->cx += w->ax - w->hv; + if (w->cx > w->bx || w->cx < w->ax) + { /* hv und cx neu einrichten */ + w->cx= (w->bx - w->ax)/2; + w->hv= rc - w->cx; + w->cx += w->ax; + } + + ned_jmp_2line_by_nr (w, w->znr, 0); + /* Note: line number is read from feature file, WC_act can point */ + /* to somewhere else */ + } +} diff --git a/app/ned/04/ned0402.c b/app/ned/04/ned0402.c new file mode 100644 index 0000000000000000000000000000000000000000..89eff184e5b9dbb3cf66363485d342a1999da871 --- /dev/null +++ b/app/ned/04/ned0402.c @@ -0,0 +1,136 @@ +/* + * FILE %ned/04/ned0402.c + * + * file I/O: load a file + * + * written: 1987 04 08 + * 1990 01 12: isolation + * 1991 02 03: revision + * 1991 09 18: use logic path names + * latest update: 2000-12-09 17:13:12 + * $Id: ned0402.c,v 1.3 2000/12/09 17:33:09 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#endif + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <gg/strings.h> +#define STREAM_FILE +#include <gg/streams.h> +#include <gg/filename.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_f_read ( +struct WINDOWCTRL *w, /* betroffenes Window */ +char *filenm_txt, /* Text File Name */ +char *filenm_ftr, /* Feature File Name */ +int f_rd_ftr, /* 1 -> Feature File suchen und einlesen */ +struct LINE **laptr, /* ^ erste eingelesene Zeile */ +struct LINE **lzptr, /* ^ letzte eingelesene Zeile */ +long la_offset, /* Anfang im File */ +long lz_offset) /* Ende im File */ +{ + int flcnt; /* line number for next feature */ + int fccnt; /* column number for next feature */ + + int format= FMT_ASCII; /* Default: ASCII Files einlesen */ + int ftr_read= 0; /* 1 -> feature setup eingelesen */ + FILE *ft; /* text file */ + FILE *ff= (FILE *) 0; /* feature file */ + char *adjusted_filename; /* physical filename after logic conversion */ + char *adjusted_ftrname= (char *) 0; + char *used_ftr_name= (char *) 0; + struct STREAM_OBJECT *so; /* input stream */ + +#ifndef MSDOS + struct stat st; +#endif + + if ((adjusted_filename= translate_logic_filename (filenm_txt)) + == (char *) 0) return -1; + + *laptr= *lzptr= (struct LINE *) 0; + + format= w->file_format; + if (format == FMT_BINARY || format == FMT_SGML) f_rd_ftr= 0; + + if (f_rd_ftr) + { + if (filenm_ftr [0] == 0) f_rd_ftr= 0; + else + { + adjusted_ftrname= translate_logic_filename (filenm_ftr); + used_ftr_name= generate_ned_name (adjusted_ftrname, ".ftr", 1); + ned_message_4 ("Reading File ", adjusted_filename, + " and ", used_ftr_name); + } + } + else + { + ned_message_2 ("Reading File ", adjusted_filename); + } + +#ifndef MSDOS + if (stat (adjusted_filename, &st) == 0) + { /* check for write permission and set to read-only mode if necessary */ + /* chmod (adjusted_filename, st.st_mode); */ + } +#endif /* MSDOS */ + + if ((ft= fopen (adjusted_filename, "rb")) == (FILE *) 0) + { + free (adjusted_filename); + return -1; + } + + so= new_stream_file_object (ft); + fseek (ft, la_offset, 0); + so->position= ftell (ft); + + if (f_rd_ftr) + { + if ((ff= fopen (used_ftr_name, "rt")) != (FILE *) 0) + { + fscanf (ff, "%d", &flcnt); + if (flcnt == 0) + { + fscanf (ff, "%d%d%d%d%d%d%d", + &w->cx, &w->znr, &w->hv, &w->attr_text, + &w->ins_flg, &w->ai, &w->wwc); + ftr_read= 1; + } + + fscanf (ff, "%d%d", &flcnt, &fccnt); + if (feof (ff)) + { + fclose (ff); + ff= (FILE *) 0; + } + } + } + + free_or_what (used_ftr_name); + + ned_stream_read (w, laptr, lzptr, lz_offset, format, + so, ff, flcnt, fccnt); + + if (ff != (FILE *) 0) fclose (ff); + fclose (ft); + free (so); + + free (adjusted_filename); + free_or_what (adjusted_ftrname); + + return ftr_read; +} diff --git a/app/ned/04/ned0402b.c b/app/ned/04/ned0402b.c new file mode 100644 index 0000000000000000000000000000000000000000..9c561e89fe01e875fda04d2be848aaf7ef11442e --- /dev/null +++ b/app/ned/04/ned0402b.c @@ -0,0 +1,316 @@ +/* + * FILE %ned/04/ned0402b.c + * + * file I/O: load a file + * + * written: 1987 04 08 + * 1990 01 12: isolation + * 1991 02 03: revision + * 1991 09 18: use logic path names + * 1996-11-03: extracted from ned0402.c + * latest update: 1999-04-25 16:30:57 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/streams.h> +#include "ed.h" +#include "message.h" +#include "proto.h" + +extern int ned_tabsize; + +#define repl_max 1024 /* T2D: constant sizes should be coordinated*/ +static char repl_array [repl_max]; + +/* ------------------------------------------------------------------------ */ +int ned_stream_read ( +struct WINDOWCTRL *w, /* betroffenes Window */ +struct LINE **laptr, /* ^ erste eingelesene Zeile */ +struct LINE **lzptr, /* ^ letzte eingelesene Zeile */ +long lz_offset, /* end postition in the stream */ +int format, /* Default: ASCII Files einlesen */ +struct STREAM_OBJECT *so, /* input stream */ +FILE *ff, /* feature file */ +int flcnt, /* line number for next feature */ +int fccnt) /* column number for next feature */ +{ + int tc; /* gelesenes Zeichen */ + int lcnt= 1; /* Zeilenezaehler im File */ + int ccnt= 0; /* column count im Binaer Modus */ + +#ifdef EXPAND_TABS + int tabcnt= 0; /* > 0 -> ein vorgetaeuschtes Blank */ +#endif + + int feof_f= 0; /* 1 -> EOF erreicht */ + int eoln; /* End-Of-Line Code bei Binaer Files */ + int bin_x_llng; /* Laenge von binaeren Zeilen */ + int rc; /* Return Code von read SGML sequence */ + int identify_eoln= 1; /* Zustand des EOLN Identifiers */ + int ignored_0x0D= 0; /* 1 -> mindestens ein 0x0D ignoriert */ + /* ##### dient fuer einen BUG-Fix #### */ + register struct LINE *lp; /* currently processed line */ + register struct TXT *tx= (struct TXT *) 0; + int repl_size= 0; /* replace TAGs and Entities with text */ + int repl_idx= 0; + STREAM_next_char *_fgetc; + STREAM_end *_feof; + + bin_x_llng= w->bin_llng; + if ((eoln= w->bin_eoln) != 0x0A) identify_eoln= 0; + + *laptr= lp= alloc_line (); + _fgetc= so->next_char; + _feof= so->is_end; + + if (lp != (struct LINE *) 0) + switch (format) + { + case FMT_BINARY: /* Binaer Modus: jedes Zeichen uninterpretiert */ + /* lesen und nach 70 Zeichen neue Zeile beginnen */ + ccnt= 0; + for (;;) + { + tc= (*_fgetc) (so); + + if ((*_feof) (so) || stream_position (so) >= lz_offset) feof_f= 1; + ccnt++; + + if ((lp->lng) % TXT_LNG == 0) /* Textsegment aufgebraucht */ + if (lp->lng == 0) /* 1. Textsegment */ + lp->txt= tx= txch_alloc (TXT_LNG, 0x00); + else + { + /* weitere Textsegmente */ + tx->next= txch_alloc (TXT_LNG, 0x00); + tx= tx->next; + } + + if (tx == (struct TXT *) 0) + { + *lzptr= lp; + ned_error_message (ERR_MEMORY); + break; + } + + if (!feof_f) + { + tx->t [lp->lng % TXT_LNG]= (char) tc; + lp->lng++; + } + + if (ccnt >= bin_x_llng || (tc == eoln && eoln) || feof_f) + { + lcnt++; + ccnt= 0; + /* neue Zeile anhaengen */ + txt_adj (lp->lng, &lp->txt); + *lzptr= lp; + if (feof_f) break; + + if ((lp->next= alloc_line ()) == (struct LINE *) 0) + { + ned_error_message (ERR_MEMORY); + break; + } + lp->next->prev= lp; + lp= lp->next; + } + } + break; + + case FMT_ASCII: + case FMT_SGML: + for (;;) + { +NEXT_TRY: + if (repl_size > 0) /* insert characters from */ + { /* the replacement array */ + tc= repl_array [repl_idx++] & 0x00FF; + if (repl_idx >= repl_size) repl_idx= repl_size= 0; + goto INS_CHAR; + } + + /* Features suchen und ggf einlesen */ + while (ff != (FILE *) 0 && flcnt && lcnt >= flcnt && ccnt >= fccnt) + { + rd_ftr (w, lp, ff, &lp->ftr, /* fccnt (1995-10-22) */ lp->lng, + repl_array, &repl_size, repl_max); + fscanf (ff, "%d%d", &flcnt, &fccnt); + if (feof (ff)) flcnt= 0; + if (repl_size > 0) + { + repl_idx= 0; + goto NEXT_TRY; + } + } + +#ifdef EXPAND_TABS + if (tabcnt > 0) + { + tc= 0x20; + tabcnt--; + } + else + { + tc= (*_fgetc) (so); + if ((*_feof) (so) || stream_position (so) >= lz_offset) feof_f= 1; + ccnt++; + if (tc == TAB_CHAR + && format == FMT_ASCII + /* && tab_expand << TAB ##### */ + ) + { + tabcnt= ned_tabsize-1 - (lp->lng % ned_tabsize); + tc= TAB_EXPN; /* -> es verbleiben noch 0..7 Blanks */ + } + } +#else + tc= (*_fgetc) (so); + if ((*_feof) (so) || stream_position (so) >= lz_offset) feof_f= 1; + ccnt++; +#endif + + switch (identify_eoln) + { + case 1: /* first character is a Carriage Return */ + if (tc == 0x0D) identify_eoln= 2; + break; + case 2: + if (tc == 0x0A) + { /* if next character is a Line Feed, then */ + /* we have a MSDOS text file (CR-LF pairs) */ + identify_eoln= 0; + } + else + { /* otherwise, this seems to be MAC where only */ + /* CR is used at end of lines */ + eoln= w->bin_eoln= 0x0D; + lp->line_flg ^= LINE_CODE_0x0D; + identify_eoln= 3; + goto EOLN; + } + break; + } + + if (tc == 0x0D && format != FMT_BINARY && tc != eoln) + { + lp->line_flg |= LINE_CODE_0x0D; + ignored_0x0D= 1; + continue; + } + + if (tc == eoln /* normales Zeilenende */ + || feof_f /* EOF => EOLN */ + || lp->lng >= LINE_LNG_TXT /* maximum line length reached */ + ) + { +EOLN: + lcnt++; + ccnt= 0; + /* neue Zeilensegment anhaengen */ + txt_adj (lp->lng, &lp->txt); + *lzptr= lp; + if (feof_f) + { + /* BUG FIX: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + if (ignored_0x0D) lp->line_flg |= LINE_CODE_0x0D; + /* wird gemacht, da bei MSDOS Files in der letzten */ + /* Zeile aus unerfindlichen Gruenden das 0x0D Flag */ + /* einfach 'liegenbleibt'... _______________________ */ + break; + } + + if ((lp->next= alloc_line ()) == (struct LINE *) 0) + { + ned_error_message (ERR_MEMORY); + break; + } + lp->next->prev= lp; + lp= lp->next; + if (identify_eoln == 3) + { /* gerade gelesenes Zeichen muss noch verarbeitet werden */ + identify_eoln= 0; + goto CHAR; + } + } + else + { +CHAR: + if (format == FMT_SGML) + { + switch (tc) + { + case '<': + rc= rd_sgml_tag (w, lp, so, &lp->ftr, lp->lng, + Ftype_SGML_TAG, '<', '>', + repl_array, &repl_size, repl_max); + repl_idx= 0; + break; + case '&': + rc= rd_sgml_tag (w, lp, so, &lp->ftr, lp->lng, + Ftype_SGML_ENTITY, '&', ';', + repl_array, &repl_size, repl_max); + repl_idx= 0; + break; + default: goto INS_CHAR; + } + + switch (rc) + { + default: + ned_error_message (ERR_SGML_READ); + repl_size= 0; + case 0: + case 1: + goto NEXT_TRY; + } + } + +#ifdef __JUNK__ /* 1996-03-16 10:04:34 */ +#define __JUNK__ /* 1996-07-25 21:03:35 */ + if (tc == '\t') /* T2D: && show tabs */ + { /* display tabs as a series of chars */ + int tabcnt= 0; /* > 0 -> ein vorgetaeuschtes Blank */ + + tabcnt= ned_tabsize-1 - (lp->lng % ned_tabsize); + strcpy (repl_array, "________"); + repl_size= tabcnt; + goto NEXT_TRY; + } +#endif /* __JUNK__ 1996-03-16 10:04:34 */ + +INS_CHAR: + if ((lp->lng%TXT_LNG) == 0) /* Textsegment aufgebraucht */ + if (lp->lng == 0) /* 1. Textsegment */ + lp->txt= tx= txch_alloc (TXT_LNG, 0x00); + else + { + /* weitere Textsegmente */ + tx->next= txch_alloc (TXT_LNG, 0x00); + tx= tx->next; + } + + if (tx == (struct TXT *) 0) + { + *lzptr= lp; + ned_error_message (ERR_MEMORY); + break; + } + tx->t [lp->lng % TXT_LNG]= (char) tc; + lp->lng++; + } + } + break; + } + + return 0; +} diff --git a/app/ned/04/ned0403.c b/app/ned/04/ned0403.c new file mode 100644 index 0000000000000000000000000000000000000000..f71b40e093ea3b0accd0d496c1cb0f1e1d38f18e --- /dev/null +++ b/app/ned/04/ned0403.c @@ -0,0 +1,379 @@ +/* + * FILE %ned/04/ned0403.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1990 01 12: Isolation + * 1991 01 28: Revision + * 1991 09 18: use logic path names + * latest update: 2000-12-09 17:12:39 + * $Id: ned0403.c,v 1.3 2000/12/09 17:33:10 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/hytxt.h> +#include <gg/filename.h> +#include <gg/sbr.h> +#include <gg/convent.h> +#include <gg/strings.h> +#include "ed.h" +#include "edhyx.h" +#include "message.h" +#include "proto.h" + +#define VARIANTE1 + +extern int ned_werr_dont_complain; +extern int block_mode; +extern struct MARKER b_beg, b_end; + +/* ------------------------------------------------------------------------ */ +static long cdecl WRITE_STR (char *s, FILE *ft); + +static long WRITE_STR (char *s, FILE *ft) +{ + long cnt= 0; + + while (*s) + { + fputc (*s++, ft); + cnt++; + } + return cnt; +} + +/* ------------------------------------------------------------------------ */ +int ned_f_write ( +struct WINDOWCTRL *w, /* betroffenes Window */ +char *filenm_txt, /* Text File NAME */ +char *filenm_ftr, /* Feature File NAME */ +int f_wr_ftr, /* 1 -> getrenntes Feature File schreiben */ +int lz_flag, /* 1 -> lzPtr nicht beachten */ +struct LINE *laptr, /* 1. Zeile */ +struct LINE *lzptr, /* letzte Zeile inklusiv */ +long *la_offset, /* begin of written file */ +long *lz_offset, /* end of written file */ +int flg2) /* various operation flags */ +{ + FILE *ft; /* Text File HANDLE */ + FILE *ff= (FILE *) 0; /* Feature File HANDLE */ + int column_idx; /* Spalte in der Zeile */ + int ll; /* Line Length */ + int lsl; /* Line Segment Length */ + int lcnt; /* Zeilenzaehler fuer FTR */ + int ccnt; /* column counter for feature */ + int vfccnt; /* column counter for feature written to ff */ + int fccnt= -1; /* column when feature was written last time*/ + int eoln; /* End-Of-Line Code */ + int write_mode; /* Block oder normal BIN/ASCII/SGML */ + int format; /* File Format: Binary/ASCII/SGML */ + long actual_pos= 0L; /* position in file */ + int repl_size= 0; /* number of chars as replace text to kill */ +#ifdef VARIANTE2 /* write only necessary items as entity */ + char *entity; /* SGML Entity string to write to file */ +#endif + int f_wr_stamp= 0;/*1*/ /* write a timestamp after first tag */ + char *adjusted_filename; /* physical filename after logic conversion */ + char *adjusted_ftrname= (char *) 0; + int f_adj_fnm= 0; + int f_adj_ftr= 0; + int rc= 0; + + register struct LINE *lp; + register struct TXT *tx; + struct FEATURE *fp; + char *used_ftr_name= (char *) 0; + char *used_bak_name= (char *) 0; + char *cp; + + if ((lp= laptr) == (struct LINE *) 0) return -1; /* keine leeren Files */ + + if ((adjusted_filename= translate_logic_filename (filenm_txt)) == (char *) 0) + adjusted_filename= filenm_txt; + else f_adj_fnm=1; + + format= w->file_format; + if (flg2 & FLG2_format_change) + { + switch (format) + { + case FMT_ASCII: + format= FMT_SGML; + break; + case FMT_SGML: + format= FMT_ASCII; + break; + } + } + + if (filenm_ftr == (char *) 0 + || *filenm_ftr == 0 + || (flg2 & (FLG2_append_mode | FLG2_block_mode)) + || format == FMT_BINARY + || format == FMT_SGML + ) f_wr_ftr= 0; + + if (f_wr_ftr) + { + if ((adjusted_ftrname= translate_logic_filename (filenm_ftr)) == (char *) 0) + adjusted_ftrname= filenm_ftr; + else f_adj_ftr= 1; + used_ftr_name= generate_ned_name (adjusted_ftrname, ".ftr", 1); + ned_message_4 ("Writing File ", adjusted_filename, + " and ", used_ftr_name); + } + else + { + ned_message_2 ("Writing File ", adjusted_filename); + } + eoln= w->bin_eoln; + + if (f_wr_ftr) /* 1. altes Feature File killen */ + { + unlink (used_ftr_name); + if ((ff= fopen (used_ftr_name, "w")) == (FILE *) 0) + f_wr_ftr= 0; + else + { /* File- und Windowctrl-Features schreiben */ + fprintf (ff, "0 %3d %4d %3d %3d %1d %1d %d\n", + w->cx - w->ax + w->hv, w->znr, w->hv, w->attr_text, + w->ins_flg, w->ai, w->wwc); + } + } + free_or_what (used_ftr_name); + + if (flg2 & FLG2_append_mode) + { /* Im Append Modus muss altes File erhalten bleiben !!!!! */ + /* Daher kein RENAME und kein UNLINK */ + ft= fopen (adjusted_filename, "ab"); + } + else + { /* neues File anlegen */ +#ifndef MSDOS + struct stat st; +#endif + used_bak_name= generate_ned_name (adjusted_filename, ".bak", 1); + unlink (used_bak_name); + rename (adjusted_filename, used_bak_name); + + ft= fopen (adjusted_filename, "wb"); +#ifndef MSDOS + if (stat (used_bak_name, &st) == 0) + { /* COPY_PERMISSIONS under Unix, copy permissions of old file! */ + chmod (adjusted_filename, st.st_mode); + } +#endif /* MSDOS */ + free_or_what (used_bak_name); + } + + if (ft == (FILE *) 0) + { + if (f_wr_ftr) fclose (ff); + + if (ned_werr_dont_complain == 0) /* if flag set, this is OK! */ + { + char buff [80]; + sprintf (buff, "File %.40s not open!", filenm_txt); + ned_error_message (buff); + rc= -1; + } + + goto STOP; + } + + if (flg2 & FLG2_append_mode) /* APPEND: Leerzeile einfuegen */ + { + if (lp->line_flg & LINE_CODE_0x0D) fputc (0x0D, ft); + fputc (eoln, ft); + fseek (ft, (long) 0, 1); + actual_pos= ftell (ft); + } + *la_offset= *lz_offset= actual_pos; + + write_mode= (flg2 & FLG2_block_mode) ? block_mode /* 1..3 */ : 0; + + /* now, write all text lines */ + for (lcnt= 1;; lcnt++) + { /* the beginning of a line */ + if ((tx= lp->txt) == (struct TXT *) 0) + { /* empty lines */ + ll= 0; + lsl= 0; + cp= (char *) 0; + } + else + { + ll= lp->lng; + lsl= tx->t_lng; + cp= tx->t; + } + + column_idx= 0; + vfccnt= ccnt= 0; + fp= lp->ftr; + repl_size= 0; /* replace text at the end of a line should */ + /* not eat up characters in the next line. */ + + while (ll-- > 0) + { + if (lsl == 0) + { + if ((tx= tx->next) == (struct TXT *) 0) break; + lsl= tx->t_lng; + cp= tx->t; + } + + switch (write_mode) + { + case 1: + if (b_beg.ptr == lp && column_idx < b_beg.offset) break; + if (b_end.ptr == lp && column_idx >= b_end.offset) break; + goto WRITE; + break; + case 3: + if (column_idx < b_beg.offset) break; + if (column_idx >= b_end.offset) break; + goto WRITE; + break; + case 0: + case 2: + default: +WRITE: + if (format == FMT_SGML) + { /* Im SGML Format ggf. Feature Segment als Tags schreiben */ + if (fp != (struct FEATURE *) 0) + { + repl_size += wr_sgml_tag (ft, fp, column_idx, &actual_pos); + /* Replacement Array uebergehen!! (ANM: += ???) */ + if (f_wr_stamp) + { + actual_pos += hyx_write_stamp (ft, (char *) 0); + f_wr_stamp= 0; + } + } + + if (repl_size == 0) + { +#ifdef VARIANTE1 /* write only necessary items as entity */ + switch (*cp & 0x00FF) + { + case '&': actual_pos += WRITE_STR ("&", ft); break; + case '<': actual_pos += WRITE_STR ("<", ft); break; + case '>': actual_pos += WRITE_STR (">", ft); break; + default: + fputc (*cp, ft); + actual_pos++; + break; + } +#endif +#ifdef VARIANTE2 /* write everything as entity if possible */ + entity= get_pc_sgml_entity (*cp & 0x00FF); + if (entity == (char *) 0) + { + fputc (*cp, ft); + actual_pos++; + } + else + { + fputc ('&', ft); + actual_pos += 2 + WRITE_STR (entity, ft); + fputc (';', ft); + } +#endif + } + else + { + repl_size--; + if (repl_size < 0) repl_size= 0; + } + break; + } + + if (f_wr_ftr + && fp != (struct FEATURE *) 0 + && ccnt != fccnt + /* otherwise we would repeat writing the same feature */ + /* element with replace text for the rest of the line. */ + && repl_size == 0 + /* but don't try it while skipping replace chars */ + ) + { + repl_size += wr_ftr (ff, lcnt, fp, ccnt, vfccnt); + fccnt= ccnt; + } + + if (repl_size == 0) + { + fputc (*cp, ft); + actual_pos++; + ccnt++; + vfccnt++; + } + else + { + repl_size--; + ccnt++; /* 1997-01-26 10:40:39 Test, BUG? */ + if (repl_size < 0) repl_size= 0; + } + break; + } + cp++; + lsl--; + column_idx++; + } + + if (fp != (struct FEATURE *) 0) + { + if (format == FMT_SGML) /* Im SGML Format ggf. Feature Segment am */ + { /* Zeilenende als Tags schreiben */ + wr_sgml_tag (ft, fp, column_idx, &actual_pos); + if (f_wr_stamp) + { + actual_pos += hyx_write_stamp (ft, (char *) 0); + f_wr_stamp= 0; + } + } + else + { + if (f_wr_ftr && fp != (struct FEATURE *) 0) + wr_ftr (ff, lcnt, fp, ccnt, vfccnt); + } + } + + if (!lz_flag && lzptr == lp) break; + if (format != FMT_BINARY && lp->next != (struct LINE *) 0) + { + /* im Binaer Modus werden CR und LF nur geschrieben, */ + /* wenn diese Zeichen in der Zeile abgespeichert sind !!! */ + if (lp->line_flg & LINE_CODE_0x0D || (flg2 & FLG2_write_crlf)) + { + fputc (0x0D, ft); + actual_pos++; + } + fputc (eoln, ft); + actual_pos++; + } + if ((lp= lp->next) == (struct LINE *) 0) break; + } + + *lz_offset= actual_pos -1L; + fclose (ft); + if (f_wr_ftr) fclose (ff); + +STOP: + if (f_adj_fnm) free (adjusted_filename); + if (f_adj_ftr) free (adjusted_ftrname); + + return rc; +} diff --git a/app/ned/04/ned0404.c b/app/ned/04/ned0404.c new file mode 100644 index 0000000000000000000000000000000000000000..34112c2224eab6d26af21a77bf3edfaeb7db4918 --- /dev/null +++ b/app/ned/04/ned0404.c @@ -0,0 +1,111 @@ +/* + * FILE %ned/04/ned0404.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1991 02 03: Revision + * 1993 01 18: remote file read and write via dorothy + * 1993-01-31: removed dorothy and installed IOA + * (indirect object access) instead + * latest update: 1997-08-03 15:46:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/filename.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_w_save (struct WINDOWCTRL *w, int flg) +/* RETURN: < 0 ... error */ +/* = 0 ... ok */ +{ + struct LINE *la; + struct FILECTRL *fc; + struct FRAMECTRL *frc; + struct CLUSTERCTRL *cc; + long la_offset, lz_offset; + int rc= 0; + char *outfile; + char *ftrfile; + int outmode; + + if (w->WC_edit_mode & EDIT_READ_ONLY) + return 0; /* OK: read only mode -> no save */ + + for (la= w->first; + la != (struct LINE *) 0 && la->prev != (struct LINE *) 0; + la= la->prev); + + if (w->file_type == FTY_HYPER) + { /* HyperText Frame */ + + if ((frc= (struct FRAMECTRL *) w->file_or_frame) == (void *) 0 + || (cc= frc->cluster) == (struct CLUSTERCTRL *) 0 + ) return -1; + + outfile= cc->cluster_name_hyx; + outmode= FLG2_append_mode; /* append to file! */ + + rc= ned_f_write (w, + outfile, + (char *) 0, + 0, + 1, + la, + (struct LINE *) 0, + &frc->frame_begin, + &frc->frame_end, + outmode); /* append !!! */ + + update_index (cc, frc->frame_index, + frc->frame_begin, frc->frame_end, 0L); + + if (frc->frame_lookup == FRAME_is_new) + { + FILE *xfn; + + frc->frame_lookup= FRAME_in_XFN; + if ((xfn= fopen (cc->cluster_name_xfn, "ab")) != (FILE *) 0) + { + fprintf (xfn, "%lx %s\n", frc->frame_index, frc->frame_name); + fclose (xfn); + } + } + + frc->upd= 0; + } + else + { /* normales File */ + + if ((fc= (struct FILECTRL *) w->file_or_frame) == (struct FILECTRL *) 0) + return -1; + + outfile= fc->FC_fnm_txt; + ftrfile= fc->FC_fnm_ftr; + + rc= ned_f_write (w, + outfile, + ftrfile, + flg, + 1, + la, + (struct LINE *) 0 /* Dummy */, + &la_offset, + &lz_offset, + FLG2_none); + + fc->FC_upd= 0; + } + + if (rc == 0) w->f_upd= 0; + + return rc; +} diff --git a/app/ned/04/ned0405.c b/app/ned/04/ned0405.c new file mode 100644 index 0000000000000000000000000000000000000000..1690f96c84fef1cadf1fa5f95a2f79d969c2bd33 --- /dev/null +++ b/app/ned/04/ned0405.c @@ -0,0 +1,57 @@ +/* + * FILE %ned/04/ned0405.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1990 01 12: Isolation + * 1991 02 03: Revision + * 1991 05 31: Revision + * latest update: 1997-01-08 10:34:29 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern struct WINDOWCTRL *windows; + +/* ------------------------------------------------------------------------ */ +int q_allsave (int flg) +/* RETURN: */ +/* -1: at least one window had an error */ +/* 0: at least one window could not be saved */ +/* 1: all files were saved ok */ +{ + struct WINDOWCTRL *w; + int done= 1; + + for (w= windows; w != (struct WINDOWCTRL *) 0; w= w->WC_next) + if (w->file_or_frame != (void *) 0) + { + if (w->file_type == FTY_HYPER) + ((struct FRAMECTRL *) w->file_or_frame)->upd= 1; + else ((struct FILECTRL *) w->file_or_frame)->FC_upd= 1; + } + + for (w= windows; w != (struct WINDOWCTRL *) 0; w= w->WC_next) + if (w->file_or_frame == (void *) 0 + && w->WC_first != (struct LINE *) 0) done= 0; + else + { + if ((w->file_type == FTY_PLAIN + && ((struct FILECTRL *) w->file_or_frame)->FC_upd) + ||(w->file_type == FTY_HYPER + && ((struct FRAMECTRL *) w->file_or_frame)->upd)) + { /* save linked files only once */ + if (ned_w_save (w, flg) != 0) done= -1; + } + } + + return done; +} diff --git a/app/ned/04/ned0406.c b/app/ned/04/ned0406.c new file mode 100644 index 0000000000000000000000000000000000000000..40409a1b66b086563216e15292b62e2cb79e79d9 --- /dev/null +++ b/app/ned/04/ned0406.c @@ -0,0 +1,119 @@ +/* + * FILE ~/usr/ned/04/ned0406.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1990 01 12: Isolation + * 1991 01 03: Revision + * latest update: 1994-12-28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/dirty.h> +#include "ed.h" +#include "proto.h" + +static void cdecl xx_fputc_code (int c, FILE *f); +static int cdecl xx_fgetc_code (FILE *f); +static int cdecl encode (int c); + +/* ------------------------------------------------------------------------ */ +static char G_CODE [30]; +static int G_PTR; +static int G_LAST=-1; /* letztes Zeichen Run Length encoded */ +static int G_CNT; /* Run Length Counter */ + +/* Patches: --------------------------------------------------------------- */ +void fputc_code (int ch, FILE *fo) { int x; ch; fo; x; } +int fgetc_code (FILE *fi) { int x; fi; x; return 0; } + +/* ------------------------------------------------------------------------ */ +static void xx_fputc_code (int c, FILE *f) +{ + if (!G_CODE [0]) + { + fputc (c, f); + return; + } + if (G_LAST != c || G_CNT==254) + { + flush_last (f); + G_LAST = c; + G_CNT = 1; + } + else G_CNT++; +} + +/* ------------------------------------------------------------------------ */ +static int xx_fgetc_code (FILE *f) +{ + int c; + + if (!G_CODE [0]) return fgetc (f) & 0x00FF; +RE_DO: + if (G_CNT > 0) + { + G_CNT--; + return G_LAST; + } + c = encode (fgetc (f) & 0x00FF); + if (c == 0x01) + { + G_LAST = encode (fgetc (f) & 0x00FF); + G_CNT = encode (fgetc (f) & 0x00FF); + goto RE_DO; + } + else return c; +} + +/* ------------------------------------------------------------------------ */ +void set_code (char *cp) /* set encryption code */ +{ + G_CODE [0] = 0; + G_PTR = 0; + G_LAST = -1; G_CNT = 0; + + if (cp == (char *) 0 || *cp == 0) + { + patch (fputc_code, fputc); + patch (fgetc_code, fgetc); + return; + } + + strncpy (G_CODE, cp, 28); + patch (fputc_code, xx_fputc_code); + patch (fgetc_code, xx_fgetc_code); +} + +/* ------------------------------------------------------------------------ */ +void flush_last (FILE *f) +{ + if (!G_CODE [0]) return; + switch (G_LAST) + { + default: if (G_CNT==1) + { + fputc (encode (G_LAST), f); + break; + } + case 1: fputc (encode (0x01), f); + fputc (encode (G_LAST), f); + fputc (encode (G_CNT), f); + case -1: break; + } +} + +/* ------------------------------------------------------------------------ */ +static int encode (int c) +{ + c= (c ^ (G_CODE [G_PTR++] & 0x00FF)) & 0x00FF; + if (G_CODE [G_PTR] == 0) G_PTR=0; + return c; +} diff --git a/app/ned/04/ned0408.c b/app/ned/04/ned0408.c new file mode 100644 index 0000000000000000000000000000000000000000..ef79df4d7efcb336100cb2ae1f89baa090ba49a0 --- /dev/null +++ b/app/ned/04/ned0408.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/04/ned0408.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1991 02 03: Revision + * latest update: 1996-01-06 11:27:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_sx () /* ^K X: Save ALL Windows and Exit */ +{ + if (oper_level < LEV_SEXIT) /* Abspeichern nicht immer */ + if (q_allsave (1) != 1) return; /* erlaubt; sonst nur EXIT */ + p_exit (); +} diff --git a/app/ned/04/ned0409.c b/app/ned/04/ned0409.c new file mode 100644 index 0000000000000000000000000000000000000000..33b34a8e020bb7e96a6862078632f0dff2d51fc4 --- /dev/null +++ b/app/ned/04/ned0409.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/04/ned0409.c + * + * save the current file + * + * written: 1987 04 08 + * 1991 02 03: Revision + * latest update: 1996-12-29 22:04:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_save () +{ + if (oper_level < LEV_FIO) ned_w_save (aw, 1); +} diff --git a/app/ned/04/ned0409b.c b/app/ned/04/ned0409b.c new file mode 100644 index 0000000000000000000000000000000000000000..6f844ed74edc23f16499225ada0d6645e5e73911 --- /dev/null +++ b/app/ned/04/ned0409b.c @@ -0,0 +1,31 @@ +/* + * FILE %ned/04/ned0409b.c + * + * save the current file after possibly renaming it + * + * This is used to emulate PICO's write out command. + * + * written: 1996-05-27 + * latest update: 1996-12-29 22:12:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void ned_rename_and_save () +{ + if (oper_level < LEV_FIO) + { + ned_rename_object (); + ned_w_save (aw, 1); + } +} diff --git a/app/ned/04/ned0409c.c b/app/ned/04/ned0409c.c new file mode 100644 index 0000000000000000000000000000000000000000..9db93315ffcbd702cfe000699844dce2681fbd2d --- /dev/null +++ b/app/ned/04/ned0409c.c @@ -0,0 +1,48 @@ +/* + * FILE %ned/04/ned0409c.c + * + * save the current file after possibly renaming it + * + * This is used to emulate PICO's stupid exit command. + * + * written: 1996-05-27 + * latest update: 1997-01-12 16:04:42 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include "message.h" + +extern struct WINDOWCTRL *aw, *windows; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void ned_pico_exit () +{ + int do_save= 0; + int rv; + + if (oper_level < LEV_FIO + && aw->file_or_frame != (void *) 0 + && aw->f_upd + ) + { + if ((rv= get_confirmation (CNF_pico_exit, -1)) == 0) + { + ned_wc_abandon (aw); + if (windows->next == (struct WINDOWCTRL *) 0) p_exit (); + else ned_close_window (); + } + else if (rv == 1) + { + do_save= (ned_rename_object () > 0); + } + } + + if (do_save) p_ssave (); +} diff --git a/app/ned/04/ned0410.c b/app/ned/04/ned0410.c new file mode 100644 index 0000000000000000000000000000000000000000..fcf32ef5e4d3efb1216225f0418539c813cd12f7 --- /dev/null +++ b/app/ned/04/ned0410.c @@ -0,0 +1,87 @@ +/* + * FILE %ned/04/ned0410.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1991 02 03: Revision + * latest update: 1998-08-16 12:31:37 + * $Id: ned0410.c,v 1.5 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +extern struct FILECTRL *files; +extern struct WINDOWCTRL *aw; +extern struct WINDOWCTRL *windows; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_ssave () +{ + int rc= 0; + + if (oper_level >= LEV_FIO) return; + +#ifdef JUNK +{ + char lin[80]; + sprintf (lin, "p_save: files=%08lX ->next=%08lX aw->f_upd=%d", + files, + (files == (struct FILECTRL *) 0) ? (struct FILECTRL *) 0 : files->next, + aw->f_upd); + ned_error_message (lin); +} +#endif + + if (aw->file_type == FTY_FTRWDW) + { + if (aw->f_upd && aw->feature_window != (struct WINDOWCTRL *) 0) + aw->feature_window->f_upd= 1; + } + else + { + if (active_feature_window (aw) != (struct WINDOWCTRL *) 0) + { /* aktuelles Window hat ein aktives(!) Feature Window! */ + ned_message_1 ("feature window is active!"); + return; + } + } + + if (windows->next == (struct WINDOWCTRL *) 0) + { + printf ("ned0410: windows->next == NULL; exiting...\n"); + if (aw->f_upd) p_sx (); + else p_exit (); + } + else + { + if (aw->file_or_frame != (void *) 0) + { + if (aw->f_upd) rc= ned_w_save (aw, 1); + if (rc == 0) ned_wc_abandon (aw); + } + + if (rc == 0) ned_close_window (); + } +} + +/* ------------------------------------------------------------------------ */ +void ned_ssave_all () +{ + struct WINDOWCTRL *wc1, *wc2= (struct WINDOWCTRL *) 0; + + while ((wc1= aw) != (struct WINDOWCTRL *) 0) + { + if (wc1 == wc2) break; /* no change since lanst call! */ + wc2= wc1; + p_ssave (); + } +} diff --git a/app/ned/04/ned0411.c b/app/ned/04/ned0411.c new file mode 100644 index 0000000000000000000000000000000000000000..ad658bbea381bcff77fb456606e828300f248eb4 --- /dev/null +++ b/app/ned/04/ned0411.c @@ -0,0 +1,37 @@ +/* + * FILE %ned/04/ned0411.c + * + * written: 1987 04 08 + * 1991 01 29: Revision + * latest update: 1997-01-12 16:04:25 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "message.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern struct WINDOWCTRL *windows; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_abandon () /* ^K Q: Abandon File at curr. Window */ +{ + if (oper_level >= LEV_FIO) return; + + if (aw->first != (struct LINE *) 0) + { + if (aw->f_upd) + if (get_confirmation (CNF_abandon, 0) <= 0) return; + + ned_wc_abandon (aw); + } + + if (windows->next == (struct WINDOWCTRL *) 0) p_exit (); + else ned_close_window (); +} diff --git a/app/ned/04/ned0412.c b/app/ned/04/ned0412.c new file mode 100644 index 0000000000000000000000000000000000000000..5d6e2dc1f319868a0201a91c21c324805954fee1 --- /dev/null +++ b/app/ned/04/ned0412.c @@ -0,0 +1,81 @@ +/* + * FILE %ned/04/ned0412.c + * + * abandon any text in the named window + * (former p_2abandon) + * + * written: 1987 04 08 + * 1991 02 03: Revision + * latest update: 1999-04-25 16:31:03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <stdlib.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern struct FILECTRL *files; + +/* ------------------------------------------------------------------------ */ +void ned_wc_abandon (struct WINDOWCTRL *wc) +{ + if (wc == (struct WINDOWCTRL *) 0) return; + + ned_reset_markers (wc); + + switch (wc->file_type) + { + case FTY_PLAIN: + { + struct FILECTRL *fc; + fc= (struct FILECTRL *) wc->file_or_frame; + + if (fc != (struct FILECTRL *) 0) + if (fc->FC_links > 1) + { + fc->FC_links--; + } + else + { + ned_lines_free (wc->first); + file_free (fc); + } + } + break; + + case FTY_HYPER: + { + struct FRAMECTRL *fc; + fc= (struct FRAMECTRL *) wc->file_or_frame; + + if (fc != (struct FRAMECTRL *) 0) + { + if (fc->links > 1) + { + fc->links--; + } + else + { + /* frame_free (fc); oder so aehnlich!!!! ########## */ + /* ...statt dessen: */ + fc->frame_status= FRAME_is_defined; /* free_frame_control */ + ned_lines_free (wc->first); + } + } + } + break; + + case FTY_FTRWDW: + /* ATTN: don't do anything, those lines belong to another window! */ + /* just close the control structures of the feature window. */ + break; + } + + wdw_rst (wc); +} diff --git a/app/ned/04/ned0413.c b/app/ned/04/ned0413.c new file mode 100644 index 0000000000000000000000000000000000000000..d903750f539ff3799bac98506505d838910f553e --- /dev/null +++ b/app/ned/04/ned0413.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/04/ned0413.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1991 01 29: Revision + * latest update: 1997-01-05 17:11:32 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "message.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_qabandon () +{ + if (get_confirmation (CNF_panic, 0) <= 0) return; + p_exit (); +} diff --git a/app/ned/04/ned0414.c b/app/ned/04/ned0414.c new file mode 100644 index 0000000000000000000000000000000000000000..cc505c33684e2648ff4156ae30b4feaf300fd80f --- /dev/null +++ b/app/ned/04/ned0414.c @@ -0,0 +1,28 @@ +/* + * FILE %ned/04/ned0414.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1991 02 03: Revision + * latest update: 1997-01-12 16:46:44 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_save_restart () +{ + /* Restart Info Schreiben */ + q_save_restart (); + q_allsave (1); + setcup (aw); +} diff --git a/app/ned/04/ned0415.c b/app/ned/04/ned0415.c new file mode 100644 index 0000000000000000000000000000000000000000..4368ffc32b1f2ede77571913ccb296f44a9024f3 --- /dev/null +++ b/app/ned/04/ned0415.c @@ -0,0 +1,33 @@ +/* + * FILE %ned/04/ned0415.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1991 02 03: Revision + * latest update: 1997-01-12 16:47:23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_load_restart () +{ + /* Restart Info Lesen */ + /* Files einlesen */ + /* Windows aufbauen+ Anzeige anpassen */ + + q_load_restart (); + p_rdsetup (); + wda_setup (); + setcup (aw); +} diff --git a/app/ned/04/ned0416.c b/app/ned/04/ned0416.c new file mode 100644 index 0000000000000000000000000000000000000000..02f02750372dcf9cbba03d2af97c2e59cc9d98ef --- /dev/null +++ b/app/ned/04/ned0416.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/04/ned0416.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1992 01 01: revision + * latest update: 1997-10-26 10:52:27 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_shell () +{ + if (oper_level >= LEV_SPECIAL) return; + q_shell ((char *) 0); +} diff --git a/app/ned/04/ned0417.c b/app/ned/04/ned0417.c new file mode 100644 index 0000000000000000000000000000000000000000..79b679cdbfe05b2c1c4a5199220f6235905dde5d --- /dev/null +++ b/app/ned/04/ned0417.c @@ -0,0 +1,51 @@ +/* + * FILE %ned/04/ned0417.c + * + * prompt for a window number to link to + * + * written: 1987 04 08 + * 1991 02 03: Revision + * 1995-10-30: extracted parts to ned0417b.c + * latest update: 1998-08-16 12:27:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "edhyx.h" +#include <gg/window.h> +#include "proto.h" + +extern struct WINDOWCTRL *aw, *windows; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_link () /* ^KL: Link to File at Window */ +{ + int k; + struct WINDOWCTRL *w; + + if (oper_level >= LEV_LINK) return; + if (aw->file_or_frame != (void *) 0) return; + + /* setchar (2, 0, 'L'); ??? */ + ned_message_1 ("Link current Window to Window #"); + + k= q_window_menu (); + + if (k <= 0) return; + k--; + + w= windows; + while (k-- && w != (struct WINDOWCTRL *) 0) w= w->next; + + if (w == (struct WINDOWCTRL *) 0 /* window not found */ + || w == aw /* or link to itself */ + ) return; /* is not such a smart idea */ + + q2_link (aw, w, NEDJMP_FLAG_REDRAW); +} diff --git a/app/ned/04/ned0417b.c b/app/ned/04/ned0417b.c new file mode 100644 index 0000000000000000000000000000000000000000..c775005d9f8982e010a9a0fdafdee13d10d8bcc2 --- /dev/null +++ b/app/ned/04/ned0417b.c @@ -0,0 +1,50 @@ +/* + * FILE %ned/04/ned0417b.c + * + * link two windows + * + * written: 1987 04 08 + * 1991 02 03: Revision + * 1995-10-30: extracted from ned0417.c + * latest update: 2000-12-09 13:16:07 + * $Id: ned0417b.c,v 1.2 2000/12/09 17:33:10 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int q2_link ( +struct WINDOWCTRL *w_dest, +struct WINDOWCTRL *w_src, +int flags) +{ + ned_lines_free (w_dest->first); + wdw_rst (w_dest); + + /* Link Count erhoehen */ + w_dest->file_or_frame= w_src->file_or_frame; + if ((w_dest->file_type= w_src->file_type) == FTY_HYPER) + ((struct FRAMECTRL *) w_dest->file_or_frame)->links++; + else ((struct FILECTRL *) w_dest->file_or_frame)->FC_links++; + + w_dest->WC_title_short= strdup_or_what (w_src->WC_title_short); + w_dest->WC_title_long= strdup_or_what (w_src->WC_title_long); + +#ifdef USE_TK + ned_tk_set_window_name (w_dest, w_dest->WC_title_short); +#endif /* USE_TK */ + + w_dest->first= w_dest->WC_act= w_src->WC_act; + ned_w_jmp_aktline (w_dest, NEDJMP_LINE_3, 0, flags); + + return 0; +} diff --git a/app/ned/04/ned0418.c b/app/ned/04/ned0418.c new file mode 100644 index 0000000000000000000000000000000000000000..01e72e6521f68c926a8aa9e9b1fcf97d11a26918 --- /dev/null +++ b/app/ned/04/ned0418.c @@ -0,0 +1,43 @@ +/* + * FILE %ned/04/ned0418.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1991 02 03: Revision + * latest update: 1997-10-26 10:51:55 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern int oper_level; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_unlink () /* ^K U: Unlink linked File */ +{ + if (oper_level >= LEV_LINK) return; + if (aw->file_or_frame == (void *) 0) return; + + if (aw->file_type == FTY_HYPER) + { + if (((struct FRAMECTRL *) aw->file_or_frame)->links <= 1) return; + ((struct FRAMECTRL *) aw->file_or_frame)->links--; + } + else + { + if (((struct FILECTRL *) aw->file_or_frame)->FC_links <= 1) return; + ((struct FILECTRL *) aw->file_or_frame)->FC_links--; + } + + wdw_rst (aw); + ned_display_window (aw); +} diff --git a/app/ned/04/ned0420.c b/app/ned/04/ned0420.c new file mode 100644 index 0000000000000000000000000000000000000000..a64a2be53716836a440a60bef22bcba6aafd64d0 --- /dev/null +++ b/app/ned/04/ned0420.c @@ -0,0 +1,55 @@ +/* + * FILE %ned/04/ned0420.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1991 02 03: Revision + * latest update: 1996-05-27 19:09:59 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#include "ed.h" +#include "proto.h" + +extern int errno; + +#ifndef MAX_FILESIZE +#define MAX_FILESIZE 350000L +#endif + +/* ------------------------------------------------------------------------ */ +int editable_file (char *fnm) +/* RETURN: */ +/* 0 -> File can't be edited */ +/* 1 -> File does not exist but can be possibly edited */ +/* 2 -> File exists and can also possibly be edited */ +{ + struct stat buf; + int ch; + + if (fnm == (char *) 0 || (ch= *fnm) == 0) return 0; + + if (ch == '%' || ch == '~' || ch == '$') return 1; + + if (stat (fnm, &buf) == -1) + { /* File nicht zugreifbar: Ursache? */ + if (errno == ENOENT) return 1; + return 0; + } + else + { /* File vorhanden; Directory ????? */ + if (buf.st_mode & S_IFDIR) return 0; +#ifdef MSDOS + if (buf.st_size > (off_t) MAX_FILESIZE) return 0; +#endif /* MSDOS */ + return 2; + } +} diff --git a/app/ned/04/ned0421.c b/app/ned/04/ned0421.c new file mode 100644 index 0000000000000000000000000000000000000000..7a10ec0b9847ef879d068e7376593c103520c3d9 --- /dev/null +++ b/app/ned/04/ned0421.c @@ -0,0 +1,40 @@ +/* + * FILE %ned/04/ned0421.c + * + * File I/O: Save- /Load-File + * + * written: 1987 04 08 + * 1991 02 03: Revision + * latest update: 1996-01-06 11:15:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +#ifdef MSDOS +#include <gg/keys.h> +#include <gg/window.h> + +extern int akt_page; +#endif /* MSDOS */ + +/* ------------------------------------------------------------------------ */ +void p_XX_break () +{ +#ifdef MSDOS + /* Keyboard Puffer entleeren */ + /* CTRL-BREAK bleibt sonst im Puffer */ + /* das fuehrt zu einem dead lock */ + + w_setstring (akt_page, 0, 2, 79, 2, + WV_ROT | W_HELL | W_BLINK | WH_WEISS, + "Hit any key", 0x01); + + kbin (); +#endif /* MSDOS */ +} diff --git a/app/ned/04/ned0422.c b/app/ned/04/ned0422.c new file mode 100644 index 0000000000000000000000000000000000000000..b9ccba717a52f4064599aaebfb00e66c62159b05 --- /dev/null +++ b/app/ned/04/ned0422.c @@ -0,0 +1,30 @@ +/* + * FILE %ned/04/ned0422.c + * + * written: 1990 01 12 + * latest update: 1996-05-23 18:17:47 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern int akt_page; +extern int mess_lin; +extern int mess_ttl; + +/* ------------------------------------------------------------------------ */ +void ned_show_author () +{ + w_setstring (akt_page, 0, mess_lin, 79, mess_lin, + WV_ROT | W_HELL | W_BLINK | WH_WEISS, +"This program was written by g.gonter@ieee.org /// distribute freely ///", + 0x01); + + mess_ttl= 16; +} diff --git a/app/ned/04/ned0423.c b/app/ned/04/ned0423.c new file mode 100644 index 0000000000000000000000000000000000000000..4c4d89541fc54048428f815c0365cfd84ef2fb8a --- /dev/null +++ b/app/ned/04/ned0423.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/04/ned0423.c + * + * written: 1996-05-23 + * latest update: 1998-08-16 12:39:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern char NED_VERSION []; + +/* ------------------------------------------------------------------------ */ +void ned_show_version () +{ + ned_message_2 ("Version ", NED_VERSION); +} diff --git a/app/ned/04/ned0425.c b/app/ned/04/ned0425.c new file mode 100644 index 0000000000000000000000000000000000000000..9a6a11c9fb62310084390e741463a9282cec33e0 --- /dev/null +++ b/app/ned/04/ned0425.c @@ -0,0 +1,60 @@ +/* + * FILE %ned/04/ned0425.c + * + * Window Control Block fuer gegebenes File suchen + * + * written: 1991 06 25: Revision + * latest update: 1997-06-11 14:22:06 + * $Id: ned0425.c,v 1.2 2004/05/08 15:41:39 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/filename.h> +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *windows; + +/* ------------------------------------------------------------------------ */ +int find_file ( +char *fnm, +char *current_path, +char **real_fnm, +char **virtual_fnm) +{ + struct WINDOWCTRL *w; + struct FILECTRL *fc; + int wn= 1; + int rv= -1; + char *r_fnm; + char *v_fnm; + + if (find_virtual_file (fnm, current_path, real_fnm, virtual_fnm) != 0) + return -1; + + r_fnm= *real_fnm; + v_fnm= *virtual_fnm; + + for (w= windows; w != (struct WINDOWCTRL *) 0; w= w->WC_next) + { + if (w->file_type == FTY_PLAIN + && (fc= (struct FILECTRL *) w->file_or_frame) != (struct FILECTRL *) 0 + ) + { + if (strcmp_nn (fc->FC_fnm_txt, r_fnm) == 0 + || strcmp_nn (w->WC_title_short, v_fnm) == 0 + ) + rv= wn; + } + + w->wc_window_number= wn++; + } + + return rv; +} diff --git a/app/ned/04/ned0426.c b/app/ned/04/ned0426.c new file mode 100644 index 0000000000000000000000000000000000000000..8ff9733f7ed731c473171761f2faddee25429235 --- /dev/null +++ b/app/ned/04/ned0426.c @@ -0,0 +1,44 @@ +/* + * FILE %ned/04/ned0426.c + * + * call command processor to execute program + * + * written: 1992 01 01 + * latest update: 1996-10-29 20:09:47 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern int W_TEXT_MAX_Y; +extern int akt_page; + +/* ------------------------------------------------------------------------ */ +void q_shell (char *command_line) +{ + if (command_line == (char *) 0 || *command_line == 0) +#ifdef MSDOS + command_line= "command"; /* MSDOS command line interpreter */ +#else +#ifdef USE_TK + return; /* TK would have to open a window for shell */ +#else + command_line= "sh"; /* T2D: setup for other shell ?? */ +#endif /* !USE_TK */ +#endif /* !MSDOS */ + + /* w_col80mode (); */ + w_setcup (akt_page, 0, W_TEXT_MAX_Y-1); + system (command_line); +#ifdef MSDOS + restore_window_mode (); +#endif /* MSDOS */ + p_refresh_all (); +} diff --git a/app/ned/04/ned0427.c b/app/ned/04/ned0427.c new file mode 100644 index 0000000000000000000000000000000000000000..528ebf6f31d04e0110c729b67e7db91009237dc1 --- /dev/null +++ b/app/ned/04/ned0427.c @@ -0,0 +1,45 @@ +/* + * FILE %ned/04/ned0427.c + * + * File I/O: print a file + * + * written: 1992 01 23 + * latest update: 1997-10-26 10:52:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_pfile () +{ + struct LINE *la; + long la_offset, lz_offset; + int f_write_mode= FLG2_none; + + for (la= aw->first; + la != (struct LINE *) 0 && la->prev != (struct LINE *) 0; + la= la->prev); + + if (aw->file_type == FTY_HYPER) f_write_mode= FLG2_format_change; + + ned_f_write (aw, + "/dev/prn", + (char *) 0, + 0, + 1, + la, + (struct LINE *) 0 /* Dummy */, + &la_offset, + &lz_offset, + f_write_mode); + +} diff --git a/app/ned/04/ned0428.c b/app/ned/04/ned0428.c new file mode 100644 index 0000000000000000000000000000000000000000..76f655682e38dd5e3acfe303c3098a3b26db64e9 --- /dev/null +++ b/app/ned/04/ned0428.c @@ -0,0 +1,123 @@ +/* + * FILE %ned/04/ned0428.c + * + * fetch an item from a GOPHER server + * + * written: 1992 02 24 + * latest update: 1998-08-16 12:52:06 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/filename.h> +#include <gg/hyx.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +#ifdef JUNK +struct GOPHER_item +{ + struct GOPHER_item *Gi_next; + char *Gi_host; + char *Gi_port; + char *Gi_type; + char *Gi_path; + char *Gi_file; +} ; + +static struct GOPHER_item *Gi= (struct GOPHER_item *) 0; +#endif + +/* ------------------------------------------------------------------------ */ +static char *SELFILE= "@5"; + +#define PATH_SIZE 2048 +#define PORT_SIZE 18 +#define LINE_SIZE 256 + +static char port [PORT_SIZE]; +static char ty [PORT_SIZE]; + +/* ------------------------------------------------------------------------ */ +int access_gopher (char *hlink, char *fil) +{ + char *path; + char *host; + char *lin; + char *search= (char *) 0; + FILE *fsearch; + int rc= -1; + char *selfile; + + if ((path= malloc (PATH_SIZE)) == (char *) 0) goto E1; + if ((host= malloc (LINE_SIZE)) == (char *) 0) goto E2; + if ((lin= malloc (LINE_SIZE)) == (char *) 0) goto E3; + if ((selfile= set_tmp_filename ((char *) 0, SELFILE)) == (char *) 0) + goto E4; + + if (find_attr_value (hlink, host, LINE_SIZE, "gh")==-1) goto ERROR; + if (find_attr_value (hlink, port, PORT_SIZE, "gp")==-1) strcpy (port,"70"); + if (find_attr_value (hlink, ty, 16, "gt")==-1) goto ERROR; + if (find_attr_value (hlink, path, PATH_SIZE, "gs")==-1) path [0]= 0; + +#ifdef DEB1 +{ +FILE *fx; +fx=fopen("@@@","at"); +hyx_write_stamp (fx, (char *) 0); +fprintf (fx, "\nHost=%s\n", host); +fprintf (fx, "Port=%s\n", port); +fprintf (fx, "Type=%s\n", ty); +fprintf (fx, "Path=%s\n\n", path); +fclose (fx); +} +#endif + + /* future: check out if item is already present */ + + /* search request? */ + if (strcmp (ty, "7") == 0 || strcmp (ty, "w") == 0) + { + if ((search= malloc (128)) == (char *) 0) goto ERROR; + search [0]= 0; + if (rd_str ("search: ", search, 80) == -1) goto ERROR; + } + + if (set_tmp_filename (fil, (char *) 0) == (char *) 0) + goto ERROR; + + if ((fsearch= fopen (selfile, "wt")) == (FILE *) 0) goto ERROR; + if (path != (char *) 0) fputs (path, fsearch); + if (search != (char *) 0) + { + if (path != (char *) 0 && path [0] != 0) fputc (0x09, fsearch); + fputs (search, fsearch); + free (search); + } + fputc ('\n', fsearch); + fclose (fsearch); + + sprintf (lin, "gophftch %s %s %s %s %s", fil, ty, host, port, selfile); + ned_message_3 ("accessing gopher ", host, "); hold on..."); + + rc= system (lin); +/* unlink (selfile); */ + +ERROR: + free (lin); +E4: + free (selfile); +E3: + free (host); +E2: + free (path); +E1: + return rc; +} diff --git a/app/ned/04/ned0429.c b/app/ned/04/ned0429.c new file mode 100644 index 0000000000000000000000000000000000000000..652be867161d1f04a1e406cd314ffc1d6013ce7a --- /dev/null +++ b/app/ned/04/ned0429.c @@ -0,0 +1,38 @@ +/* + * FILE %ned/04/ned0429.c + * + * write extraction information to file + * + * written: 1992 04 05 + * latest update: 1997-10-26 10:51:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/hytxt.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int q_extract (char *filename, char *message) +{ + FILE *fo; + + if ((fo= fopen (filename, "at")) == (FILE *) 0) return -1; + + fprintf (fo, "<extract appl=ned>\n"); + hyx_write_stamp (fo, (char *) 0); + fprintf (fo, "msg %s\ncor %d %d %d\n", + message, aw->znr, aw->cx+aw->hv-aw->ax, aw->hv); + + fprintf (fo, "</extract>\n"); + fclose (fo); + + return 0; +} diff --git a/app/ned/04/ned0430.c b/app/ned/04/ned0430.c new file mode 100644 index 0000000000000000000000000000000000000000..47863878dca0d2a222fb0ee5aa5519dab27e6bf5 --- /dev/null +++ b/app/ned/04/ned0430.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/04/ned0430.c + * + * write extraction information to file + * + * written: 1992 04 05 + * latest update: 1996-03-17 11:08:08 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_extract () +{ + char msg [80]; + + msg [0]= 0; + if (rd_str ("message: ", msg, 80) == -1) return; + q_extract ("$$appl.msg", msg); +} diff --git a/app/ned/04/ned0431.c b/app/ned/04/ned0431.c new file mode 100644 index 0000000000000000000000000000000000000000..ff6037e346fab2099008886bed62858d1a108588 --- /dev/null +++ b/app/ned/04/ned0431.c @@ -0,0 +1,54 @@ +/* + * FILE ~/usr/ned/04/ned0431.c + * + * THIS MODULE IS NOT USED ANYWHERE + * + * read file or frame from a dorothy server + * + * written: 1993 01 18 + * latest update: 1998-08-16 12:39:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +int kbin (void); + +/* ------------------------------------------------------------------------ */ +int dorothy_rw ( +char *tmpfnm, +char *server, +long port, +char *action, +char *cl_or_file, +char *fr) +{ + char cmd_line [150]; + char rc_str [20]; + int rc; + + if (fr == (char *) 0) fr=""; + + sprintf (cmd_line, + "dorothy -h%s -p%ld %s %s %s %s", + server, + port, + action, + tmpfnm, + cl_or_file, + fr); + + rc= system (cmd_line); + sprintf (rc_str, "*KEY* %d: ", rc), + ned_message_2 (rc_str, cmd_line); +kbin(); + + return rc; +} diff --git a/app/ned/04/ned0432.c b/app/ned/04/ned0432.c new file mode 100644 index 0000000000000000000000000000000000000000..6c483994f49c7989745f76720aa985f90ac33f18 --- /dev/null +++ b/app/ned/04/ned0432.c @@ -0,0 +1,175 @@ +/* + * FILE %ned/04/ned0432.c + * + * *** DEAD CODE *** + * + * IOA: indirect object access + * find method to access an object for reading or writing it. + * + * written: 1993 01 31 + * latest update: 1998-08-16 12:51:23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/sbr.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +static char search [128]; +static char prompt [80]; +static int do_search= 0; + +/* ------------------------------------------------------------------------ */ +struct ACCESS_METHOD +{ + struct ACCESS_METHOD *acm_next; + char *acm_selector; + char *acm_command; +} ; + +/* ------------------------------------------------------------------------ */ +static char *default_acm = "ned.acm"; +static char *PAR_FILE= "@@loc.par"; +static char *par_file= (char *) 0; +static char *acm_file= (char *) 0; +static int initialized= 0; +static char cmd_line [150]; + +static struct ACCESS_METHOD *acm= (struct ACCESS_METHOD *) 0; +static struct ACCESS_METHOD **acm_app= &acm; + +/* ------------------------------------------------------------------------ */ +int read_access_methods (char *fn) +{ + char sel [24]; + FILE *fi; + struct ACCESS_METHOD *nacm; + + if ((fi= fopen (fn, "r")) == (FILE *) 0) return -1; + ned_message_2 ("reading IOA methods: ", fn); + + for (;;) + { + sel[0]= (char) fgetc (fi) & 0x00FF; + if (feof (fi)) break; + if (sel [0] == '#') + { + trash_until_eol (fi); + continue; + } + fscanf (fi, "%s%*[ \t]%[^\n]", &sel[1], cmd_line); + if (feof (fi)) break; + fgetc (fi); + if ((nacm= calloc (sizeof (struct ACCESS_METHOD), 1)) + == (struct ACCESS_METHOD *) 0) + break; + + nacm->acm_selector= strdup (sel); + nacm->acm_command= strdup (cmd_line); + *acm_app= nacm; + acm_app= &nacm->acm_next; + } + fclose (fi); + + initialized= 1; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int do_prompt (char *str) +{ + if ((do_search= (str != (char *) 0))) strcpy (prompt, str); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int indirect_object_access ( +char *tmpfnm, +int read_or_write, /* 0 .. read; 1 .. write */ +int file_or_cluster, /* 0 .. file; 1 .. cluster */ +char *location, +char *cl_or_file, +char *fr) +{ + int rc; + struct ACCESS_METHOD *xacm; + FILE *par; + int write_search_string= 0; + + if (cl_or_file == (char *) 0) return -1; + if (fr == (char *) 0) fr= ""; + + if (!initialized) + { + acm_file= set_etc_filename ((char *) 0, default_acm); + read_access_methods (acm_file); + } + + for (xacm= acm; xacm != (struct ACCESS_METHOD *) 0; xacm= xacm->acm_next) + if (strncmp (xacm->acm_selector, location, + strlen (xacm->acm_selector)) == 0) break; + + if (xacm == (struct ACCESS_METHOD *) 0) + { + ned_error_message ("couldn't find an appropriate IOA handler!"); + return -1; + } + + if (do_search) + { + search[0]= 0; + if (rd_str (prompt, search, 80) == -1) return 0; + write_search_string= 1; + do_search= 0; + } + + if (par_file == (char *) 0) + par_file= set_tmp_filename ((char *) 0, PAR_FILE); + + if ((par= fopen (par_file, "wb")) == (FILE *) 0) return -1; + fprintf (par, "<hyx.ioa\n"); + if (file_or_cluster) + fprintf (par, "cl=\"%s\"\nfr=%s\n", cl_or_file, fr); + else + { + fprintf (par, "file=\"%s\"\n", cl_or_file); + if (*fr != 0) fprintf (par, "ftr=\"%s\"\n", fr); + } + + if (write_search_string) fprintf (par, "search=\"%s\"\n", search); + fprintf (par, "loc=\"%s\"\n>", location); + fclose (par); + + ned_message_3 (cl_or_file, " on ", location); + + sprintf (cmd_line, + "%s %s %s %d", + xacm->acm_command, + tmpfnm, + par_file, + read_or_write); + + rc= system (cmd_line); + +#ifdef __UNUSED__ +{ + char rc_str [60]; + sprintf (rc_str, "*KEY* %d: ", rc), + ned_message_2 (rc_str, cmd_line); + kbin(); +} +#endif + + return rc; +} diff --git a/app/ned/04/ned0433.c b/app/ned/04/ned0433.c new file mode 100644 index 0000000000000000000000000000000000000000..5e7d41c4359e2b43246ddbc5ca14cd7060212fd8 --- /dev/null +++ b/app/ned/04/ned0433.c @@ -0,0 +1,92 @@ +/* + * FILE %ned/04/ned0433.c + * + * history interface + * + * written: 1993-02-20 + * 1993-02-21: latest update + * latest update: 1995-11-26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/filename.h> +#include <gg/dates.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +static int history_initiated= 0; +static int history_enabled= 1; +static char *history_file= (char *) 0; +static char *HISTORY_FILE= "%history"; +static char *FMT []= { "binary", "ascii", "sgml" }; + +/* ------------------------------------------------------------------------ */ +void enable_ned_history () { history_enabled= 1; } +void disable_ned_history () { history_enabled= 0; } + +/* ------------------------------------------------------------------------ */ +int setup_ned_history () +{ + history_file= translate_logic_filename (HISTORY_FILE); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_history ( +char *file_or_cluster, +char *frame, +char *comment, +int f_type, +int f_format) +{ + FILE *fo; + + if (!history_enabled) return 0; + if (f_format < 0 || f_format > FMT_SGML) return -1; + if (!history_initiated) setup_ned_history (); + if (history_file == (char *) 0) goto NO_HISTORY; + + if ((fo= fopen (history_file, "a")) == (FILE *) 0) + { +NO_HISTORY: + history_enabled= 0; + return -1; + } + + fprintf (fo, "<hyx.l"); + switch (f_type) + { + default: + case FTY_PLAIN: + fprintf (fo, " file=\"%s\"", file_or_cluster); + break; + case FTY_HYPER: + fprintf (fo, " cl=\"%s\" fr=\"%s\"", file_or_cluster, frame); + break; + } + + if ((f_type == FTY_HYPER && f_format != FMT_SGML) + ||(f_type == FTY_PLAIN && f_format == FMT_SGML) + ||f_format == FMT_BINARY + ) + { + fprintf (fo, " fmt=%s", FMT [f_format]); + } + + fprintf (fo, ">* "); + print_date_time (fo); + fputc ('\n', fo); + if (comment != (char *) 0) fprintf (fo, " %s\n", comment); + if (f_type == FTY_HYPER) fprintf (fo, " %s\n", frame); + fprintf (fo, " %s\n", file_or_cluster); + + fclose (fo); + + return 0; +} diff --git a/app/ned/04/ned0434.c b/app/ned/04/ned0434.c new file mode 100644 index 0000000000000000000000000000000000000000..8303d668d10681fcf67a351570a9595eb9446475 --- /dev/null +++ b/app/ned/04/ned0434.c @@ -0,0 +1,41 @@ +/* + * FILE %ned/04/ned0434.c + * + * Get path name for the file specified in a window control structure + * This works by definition only for files, not for clusters! + * + * written: 1995-10-31 + * latest update: 1996-09-28 20:41:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/filename.h> +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" + +static char path_buffer [MAX_FNM_LENGTH]; + +/* ------------------------------------------------------------------------ */ +char *ned_get_file_path (struct WINDOWCTRL *wc) +{ + struct FILECTRL *fc; + char *cp; /* pointer to file name */ + int ii; /* position of last path seperator */ + + if (wc == (struct WINDOWCTRL *) 0 + || wc->file_type != 0 + || (fc= (struct FILECTRL *) wc->file_or_frame) == (struct FILECTRL *) 0 + || (cp= fc->FC_fnm_txt) == (char *) 0 + ) return (char *) 0; + + ii= isolate_path (cp); + strcpy_max (path_buffer, cp, ii+1); + + return path_buffer; +} diff --git a/app/ned/05/(dirinf).fm b/app/ned/05/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..6b1168e9e1451021a5e75fa7c1a5e3627668bc14 --- /dev/null +++ b/app/ned/05/(dirinf).fm @@ -0,0 +1,52 @@ +# +# FILE %ned/05/(dirinf).fm +# +# NED +# +# written: 1991-10-17 +# latest upate: 2000-08-24 15:58:55 +# $Id: (dirinf).fm,v 1.3 2000/08/24 15:10:15 gonter Exp $ +# +# ---------------------------------------------------------------------------- + +Makefile | current makefile +make-dos | MSDOS makefile + +ned0501.c | void p_aitoggle () /* Auto Indent Toggle */ +ned0502.c | void ned_del2eoln () delete to the end of line +ned0502b.c | int ned_w_del2eoln (register struct WINDOWCTRL *w) +ned0502c.c | void ned_del2boln () delete to the begin of line +ned0502d.c | int ned_w_del2boln (register struct WINDOWCTRL *w) +ned0503.c | void ned_pr_jump_to_line () +ned0503b.c | int ned_cb_jump_to_line (char *str, ...) +ned0504.c | struct LINE *ned_get_line_by_nr (lp, lnr) +ned0505.c | int ned_jmp_2line_by_nr (w, lnr, flg) +ned0506a.c | int ned_cnt_line_2beg (register struct LINE *a) +ned0506b.c | int ned_cnt_line_2end (register struct LINE *p) +ned0506c.c | int ned_cnt_total_lines (struct LINE *a) +ned0506d.c | void ned_cnt_act_line () +ned0506e.c | int ned_cnt_line_relative () +ned0507.c | int ned_show_total_lines () +ned0508.c | int ned_w_jmp_aktline (flg) +ned0508b.c | int ned_w_jmp_aktline_bot () +ned0508m.c | int ned_w_jmp_aktline_mid () +ned0508t.c | int ned_w_jmp_aktline_top () +ned0509.c | int ins_nl () +ned0510.c | int ned_delete_line () +ned0510b.c | int ned_delete_current_line (struct WINDOWCTRL *w) +ned0510c.c | int ned_delete_a_line (register struct WINDOWCTRL *w,...) +ned0511.c | void ned_join3 () +ned0512.c | void tabulate () +ned0513.c | void pq_up () +ned0514.c | void pq_dn () +ned0515.c | int ned_split (...); +ned0515b.c | int ned_split2 (...); +ned0516.c | int ned_join (struct LINE *lp1, struct LINE *lp2); +ned0516b.c | int ned_join2 (struct LINE *lp1, struct LINE *lp2); +ned0517.c | int copy_line (struct LINE *sl, struct LINE **dl); +ned0519.c | int jmpline_relative (...); +ned0520.c | int jmp2column (register struct WINDOWCTRL *w, int coln); +ned0521.c | int ned_copy_feature_list (struct FEATURE *fs, struct FEATURE **fd) +ned0522.c | int winstack_insert (struct WINDOWCTRL *w) +ned0522.c | int winstack_delete (struct WINDOWCTRL *w) +* | diff --git a/app/ned/05/Makefile b/app/ned/05/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..9011e5c8dea9d528d71b973eb436c9d363d3433f --- /dev/null +++ b/app/ned/05/Makefile @@ -0,0 +1,61 @@ +# +# FILE %ned/05/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# +# latest update: 1999-05-06 16:28:19 +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-c -g -I.. $(cf) +CC=cc +o= +objs=ned0501.o ned0502.o ned0502c.o ned0502d.o \ + ned0503.o ned0503b.o ned0504.o \ + ned0505.o ned0506a.o ned0506b.o ned0506c.o ned0506d.o ned0506e.o \ + ned0507.o ned0508.o ned0508b.o ned0508m.o ned0508t.o \ + ned0510b.o ned0510c.o \ + ned0512.o ned0513.o ned0514.o ned0515.o \ + ned0515b.o ned0516.o ned0516b.o \ + ned0517.o ned0519.o ned0520.o \ + ned0521.o ned0522.o +objs_cur= ned0509_cur.o ned0510_cur.o ned0511_cur.o +objs_tk= ned0509_tk.o ned0510_tk.o ned0511_tk.o +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_tk lib_cur +clean : + rm -f *.o lib_cur lib_tk + +lib_tk : $(objs_tk) $(objs) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs) + ar ru $(lib_cur) $? + touch lib_cur + + +.c.o: ../ed.h + $(CC) $(OPTS) -c $*.c + +# --- cur Modules ---------- +ned0509_cur.o : ../ed.h ned0509.c + $(CC) $(OPTS) -o ned0509_cur.o ned0509.c + +ned0510_cur.o : ../ed.h ned0510.c + $(CC) $(OPTS) -o ned0510_cur.o ned0510.c + +ned0511_cur.o : ../ed.h ned0511.c + $(CC) $(OPTS) -o ned0511_cur.o ned0511.c + +# --- tk Modules ---------- +ned0509_tk.o : ../ed.h ned0509.c + $(CC) $(OPTS) -DUSE_TK -o ned0509_tk.o ned0509.c + +ned0510_tk.o : ../ed.h ned0510.c + $(CC) $(OPTS) -DUSE_TK -o ned0510_tk.o ned0510.c + +ned0511_tk.o : ../ed.h ned0511.c + $(CC) $(OPTS) -DUSE_TK -o ned0511_tk.o ned0511.c diff --git a/app/ned/05/contrib b/app/ned/05/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/05/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/05/gg b/app/ned/05/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/05/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/05/lib_cur b/app/ned/05/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/05/lib_tk b/app/ned/05/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/05/make-dos b/app/ned/05/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..91766c7e3d01dbf6ae4f95a69c8dd26a6d3edd24 --- /dev/null +++ b/app/ned/05/make-dos @@ -0,0 +1,27 @@ +# +# FILE %ned/05/makefile +# +# GG's Night(mare) Editor System +# +# latest update: 1997-01-06 13:27:44 +# +# ============================================================================ +cc=cl -Os -AL /c +ccc=cl -Os -AL /W3 /Fo$@ -I.. /c +obj=objdec -m0 -w -d -sl 2 NED05_TEXT $@ +I=../ + +lib : ! + ned0501.obj ned0502.obj ned0502c.obj ned0502d.obj ned0503.obj ! + ned0503b.obj ned0504.obj ned0505.obj ned0506a.obj ned0506b.obj ! + ned0506c.obj ned0506d.obj ned0506e.obj ned0507.obj ! + ned0508.obj ned0508b.obj ned0508m.obj ned0508t.obj ! + ned0509.obj ned0510.obj ned0510b.obj ned0510c.obj ! + ned0511.obj ned0512.obj ned0513.obj ned0514.obj ned0515.obj ! + ned0515b.obj ned0516.obj ned0516b.obj ned0517.obj ned0519.obj ! + ned0520.obj ned0521.obj ned0522.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $*.c + $(obj) diff --git a/app/ned/05/ned0501.c b/app/ned/05/ned0501.c new file mode 100644 index 0000000000000000000000000000000000000000..c5917d0392cfde209431e9bd7a98b32e7604aa1f --- /dev/null +++ b/app/ned/05/ned0501.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/05/ned0501.c + * + * switch auto indent toggle + * + * written: 1987 04 08 + * latest update: 1995-09-26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_aitoggle () +{ + aw->ai= !aw->ai; +} diff --git a/app/ned/05/ned0502.c b/app/ned/05/ned0502.c new file mode 100644 index 0000000000000000000000000000000000000000..c55de98c878f09f3c8760037ff2ef224e6a2a771 --- /dev/null +++ b/app/ned/05/ned0502.c @@ -0,0 +1,28 @@ +/* + * FILE %ned/05/ned0502.c + * + * delete from the cursor position to the end of the line + * WS: ^QY + * VI: D, d$ + * + * written: 1987 04 08 + * latest update: 1996-10-05 9:22:06 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_del2eoln () +{ + set_repeat_command (ned_del2eoln); + /********* ned_w_del2eoln (aw); T2D: Test; OLD 1996-10-05 10:47:40 */ + ned_w_del2boln (aw, 2); +} diff --git a/app/ned/05/ned0502b.c b/app/ned/05/ned0502b.c new file mode 100644 index 0000000000000000000000000000000000000000..3a087b740e3e9719277f2d558576f0a8df0a2557 --- /dev/null +++ b/app/ned/05/ned0502b.c @@ -0,0 +1,74 @@ +/* + * FILE %ned/05/ned0502b.c + * + * *** THIS FUNCTION IS POSSIBLY OBSOLETE 1996-10-05 10:48:18 *** + * + * delete from the cursor position to the end of the line + * WS: ^QY + * VI: D, d$ + * + * written: 1996-02-03: extracted from ned0502.c + * latest update: 1997-10-26 10:26:20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_w_del2eoln (register struct WINDOWCTRL *w) +{ + struct LINE *act; + register struct FEATURE *pftr= (struct FEATURE *) 0; + register struct FEATURE **ppftr; + int idx; + + if (w == (struct WINDOWCTRL *) 0 + || (act= w->WC_act) == (struct LINE *) 0 + ) return -1; + + if (act->line_flg & LINE_PROTECTED) return 0; + + idx= w->cx + w->hv - w->ax; + + if ((ppftr= ned_feature_find (act, idx, 1)) != (struct FEATURE **) 0) + { + pftr= *ppftr; + if (pftr->ftr_edit_flags & (FTR_EDIT_NO_TEXT | FTR_EDIT_NO_INSERT)) + return 0; + } + + act->lng= idx; + + txt_adj (act->lng, &act->txt); + + /* TEST: adjusting feature record */ + for (ppftr= &act->ftr; + (pftr= *ppftr) != (struct FEATURE *) 0; + ppftr= &pftr->ftr_next) + { + int ftr_pos; + + if ((ftr_pos= pftr->ftr_pos) <= idx + && ftr_pos + pftr->ftr_replarray_size > idx /* T2D: +/- ??? */ + ) + { + pftr->ftr_replarray_size= idx - ftr_pos; + } + + if (ftr_pos >= idx) + { + ned_feature_free (pftr); + + *ppftr= (struct FEATURE *) 0; + break; + } + } + + wd_displine (w, act, w->cy, w->ax, w->bx); + w->f_upd= 1; +} diff --git a/app/ned/05/ned0502c.c b/app/ned/05/ned0502c.c new file mode 100644 index 0000000000000000000000000000000000000000..f0c1ec8dca31437ca50ac2eadc6fdb9a2762c688 --- /dev/null +++ b/app/ned/05/ned0502c.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/05/ned0502c.c + * + * delete from the cursor position to the begin of the line + * WS: ?? + * VI: d^ + * + * written: 1996-10-05 + * latest update: 1996-10-05 9:22:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_del2boln () +{ + set_repeat_command (ned_del2boln); + ned_w_del2boln (aw, 1); +} diff --git a/app/ned/05/ned0502d.c b/app/ned/05/ned0502d.c new file mode 100644 index 0000000000000000000000000000000000000000..d1b87e7c6fa1371ea20ad643e5cc304ea8ecbdc4 --- /dev/null +++ b/app/ned/05/ned0502d.c @@ -0,0 +1,98 @@ +/* + * FILE %ned/05/ned0502d.c + * + * delete from the cursor position to the begin of the line + * WS: ?? + * VI: d^, d0 + * + * written: 1996-10-05 + * latest update: 1997-08-28 11:41:44 + * $Id: ned0502d.c,v 1.2 2001/09/28 18:48:28 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_w_del2boln (register struct WINDOWCTRL *w, int opcode) +{ + struct LINE *act_beg; + struct LINE *act_rest; + struct LINE *lp; + register struct FEATURE *pftr= (struct FEATURE *) 0; + register struct FEATURE **ppftr; + int idx; + int flg_redraw= 0; /* 1 -> redraw the complete window */ + int flg_act_is_first= 0; + + if (w == (struct WINDOWCTRL *) 0 + || (act_beg= w->WC_act) == (struct LINE *) 0 + ) return -1; + + if (act_beg->line_flg & LINE_PROTECTED) return 0; + + if (act_beg == w->WC_first) flg_act_is_first= 1; + idx= w->cx + w->hv - w->ax; + + if ((ppftr= ned_feature_find (act_beg, idx, 1)) != (struct FEATURE **) 0) + { + pftr= *ppftr; + if (pftr->ftr_edit_flags & (FTR_EDIT_NO_TEXT | FTR_EDIT_NO_INSERT)) + return 0; + } + + if (ned_split (act_beg, &act_rest, idx, 0) < 0) return -1; + + /******************** BEGIN ***************************/ + /* possible operations here: */ + /* 1. delete first part OK */ + /* 2. delete second part OK */ + /* 3. flip both parts (Not Yet Implemented) */ + + switch (opcode) + { + case 1: + /* let the two parts switch places */ + act_rest->next= act_beg->next; + act_rest->prev= act_beg->prev; + if ((lp= act_rest->prev) != (struct LINE *) 0) lp->next= act_rest; + if ((lp= act_rest->next) != (struct LINE *) 0) lp->prev= act_rest; + + w->WC_act= act_rest; + w->cx= w->ax; + if (w->hv) + { + w->hv= 0; + flg_redraw= 1; + } + + if (flg_act_is_first) w->WC_first= w->WC_act; + /* drop the old line begin */ + act_beg->next= act_beg->prev= (struct LINE *) 0; + + ned_line_trigger_delete (act_beg, 1, 1); + ned_store_line_to_buffer (-1, act_beg, act_beg, 0); + break; + + case 2: + ned_line_trigger_delete (act_rest, 1, 1); + ned_store_line_to_buffer (-1, act_rest, act_rest, 0); + break; + } + /******************** END ***************************/ + + /* display the result */ + if (flg_redraw) + ned_display_window (w); + else + wd_displine (w, w->WC_act, w->cy, w->ax, w->bx); + + w->f_upd= 1; + + return 0; +} diff --git a/app/ned/05/ned0503.c b/app/ned/05/ned0503.c new file mode 100644 index 0000000000000000000000000000000000000000..74a241df87f7754800c71f79f2a2f0f324279da9 --- /dev/null +++ b/app/ned/05/ned0503.c @@ -0,0 +1,38 @@ +/* + * FILE %ned/05/ned0503.c + * + * elementare Editierfunktionen: TAB, NL, PGUP, PGDN + * + * written: 1987 04 08 + * 1991 09 19: Revision + * latest update: 1996-11-03 17:36:52 + * $Id: ned0503.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern char *default_help_cluster; +extern char *default_help_jump_to_line; + +/* ------------------------------------------------------------------------ */ +void ned_pr_jump_to_line () +{ +#define LN_SIZE 32 + char line_number [LN_SIZE]; + + if (aw->WC_act == (struct LINE *) 0) return; + + line_number [0]= 0; + ned_prompt_string ("Zeile #", line_number, LN_SIZE, + default_help_cluster, + default_help_jump_to_line, + ned_cb_jump_to_line, + (void *) aw); +} diff --git a/app/ned/05/ned0503b.c b/app/ned/05/ned0503b.c new file mode 100644 index 0000000000000000000000000000000000000000..d4059e83c5b03048df5cce5eb2b8d965cb3ee983 --- /dev/null +++ b/app/ned/05/ned0503b.c @@ -0,0 +1,37 @@ +/* + * FILE %ned/05/ned0503.c + * + * written: 1996-07-07 + * latest update: 1999-04-25 16:31:06 + * $Id: ned0503b.c,v 1.5 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/dpp.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_cb_jump_to_line (const char *str, void *cb_data) +{ + struct WINDOWCTRL *wc; + int lnr; + + if ((wc= (struct WINDOWCTRL *) cb_data) != (struct WINDOWCTRL *) 0 + && str != (char *) 0 + ) + { + lnr= (int) get_parameter_value (str); + ned_jmp_2line_by_nr (wc, lnr, 3); + aw= wc; /* T2D: change aw only if focused ... */ + } + + return 0; +} diff --git a/app/ned/05/ned0504.c b/app/ned/05/ned0504.c new file mode 100644 index 0000000000000000000000000000000000000000..2683cbd00b0afa31bed323b153374a807e9ca679 --- /dev/null +++ b/app/ned/05/ned0504.c @@ -0,0 +1,51 @@ +/* + * FILE %ned/05/ned0504.c + * + * get line pointer given the line number + * + * written: 1987 04 08 + * latest update: 2001-02-11 16:34:52 + * $Id: ned0504.c,v 1.2 2001/02/12 00:03:30 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct LINE *ned_get_line_by_nr ( +register struct LINE *lp, +int *lnr) /* target line: 1 .. first line in file */ + /* wenn das File kuerzer ist, */ + /* dann letzte Zeile im File !!! */ +/* RETURN: (struct LINE *) 0 -> Fehler; sonst -> OK */ +{ + struct LINE *lp_next; + int dlnr; + int xlnr= 1; + + if (lp == (struct LINE *) 0 + || *lnr < 0 + ) + { + *lnr= 0; + return (struct LINE *) 0; + } + + /* zurueckspulen */ + for (; lp->prev != (struct LINE *) 0; lp= lp->prev); + + for (dlnr= *lnr-1; dlnr > 0; dlnr--) + { + if ((lp_next= lp->next) == (struct LINE *) 0) break; + lp= lp_next; + xlnr++; + } + + *lnr= xlnr; + return lp; +} diff --git a/app/ned/05/ned0505.c b/app/ned/05/ned0505.c new file mode 100644 index 0000000000000000000000000000000000000000..27d6d91535345368a1f42dbb3864628b53c9c612 --- /dev/null +++ b/app/ned/05/ned0505.c @@ -0,0 +1,40 @@ +/* + * FILE %ned/05/ned0505.c + * + * elementare Editierfunktionen: Zeile anspringen und anzeigen + * + * written: 1987 04 08 + * 1990 05 20: Revision + * 1991 06 02: Revision + * latest update: 1997-06-28 22:45:53 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_jmp_2line_by_nr ( +register struct WINDOWCTRL *wc, +int lnr, /* Zielzeile: Return: 0 -> Fehler; 1 -> OK */ +int flg) /* Bit 0: Window neu aufbauen */ + /* 1: cx an den Rand setzen */ +{ + register struct LINE *lp; + + ned_set_marker (wc, '\''); + + if ((lp= ned_get_line_by_nr (wc->WC_act, &lnr)) != (struct LINE *) 0) + { + wc->WC_act= lp; + wc->znr= lnr; + + ned_w_jmp_aktline (wc, NEDJMP_LINE_MID, 0, flg | NEDJMP_FLAG_NO_CNT); + } + + return 1; +} diff --git a/app/ned/05/ned0506a.c b/app/ned/05/ned0506a.c new file mode 100644 index 0000000000000000000000000000000000000000..824e60ad0f07ca2cfb89c59198fc155b49d98e2f --- /dev/null +++ b/app/ned/05/ned0506a.c @@ -0,0 +1,28 @@ +/* + * FILE %ned/05/ned0506a.c + * + * get the number of lines to the top of the file + * first line := 1 + * + * written: 1987 04 08 + * 1991 06 01: Revision + * latest update: 1996-05-26 11:34:19 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* Zeilennummer einer Zeile berechnen: ------------------------------------ */ +int ned_cnt_line_2beg (register struct LINE *a) +{ + register int lin= 0; + + for (; a != (struct LINE *) 0; a= a->prev) lin++; + + return lin; +} diff --git a/app/ned/05/ned0506b.c b/app/ned/05/ned0506b.c new file mode 100644 index 0000000000000000000000000000000000000000..50285ae0fe93cc8db8754da3c6b92e531237591e --- /dev/null +++ b/app/ned/05/ned0506b.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/05/ned0506b.c + * + * get the number of lines to the bottom of the file + * last line := 1 + * + * written: 1987 04 08 + * latest update: 1997-10-26 10:26:10 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_cnt_line_2end (register struct LINE *p) +{ + register int cnt= 0; + + for (; p != (struct LINE *) 0; p= p->next) cnt++; + + return cnt; +} diff --git a/app/ned/05/ned0506c.c b/app/ned/05/ned0506c.c new file mode 100644 index 0000000000000000000000000000000000000000..40d1735f32db0863f379fb1e4e6b08a00e723afb --- /dev/null +++ b/app/ned/05/ned0506c.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/05/ned0506b.c + * + * Zahl aller Zeilen in einen Window ermitteln + * + * written: 1991 06 01 + * latest update: 1996-05-26 11:34:50 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* Zeilennummer einer Zeile berechnen: ------------------------------------ */ +int ned_cnt_total_lines (struct LINE *a) +{ + int cnt; + + cnt= ned_cnt_line_2beg (a) + ned_cnt_line_2end (a); + + return (cnt > 0) ? cnt-1 : 0; +} diff --git a/app/ned/05/ned0506d.c b/app/ned/05/ned0506d.c new file mode 100644 index 0000000000000000000000000000000000000000..edb2bb937a19563aadb79c408e204079b027dda1 --- /dev/null +++ b/app/ned/05/ned0506d.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/05/ned0506d.c + * + * Zeilennummer der aktuellen Zeile berechnen + * + * written: 1987 04 08 + * latest update: 1997-10-26 10:25:58 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_cnt_act_line () +{ + aw->znr= ned_cnt_line_2beg (aw->WC_act); +} diff --git a/app/ned/05/ned0506e.c b/app/ned/05/ned0506e.c new file mode 100644 index 0000000000000000000000000000000000000000..9e1f524761b5a0d5caa9296fb6df749c3d0cd0e3 --- /dev/null +++ b/app/ned/05/ned0506e.c @@ -0,0 +1,41 @@ +/* + * FILE %ned/05/ned0506a.c + * + * get the line number of LINE b relativ to the window where + * LINE a is located. + * + * first line := 1 + * -1 if line + * + * This function is used to verify if the line b is in the same + * window as line a. + * + * written: 1996-07-11 + * latest update: 1996-07-11 18:16:57 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* Zeilennummer einer Zeile berechnen: ------------------------------------ */ +int ned_cnt_line_relative (register struct LINE *a, register struct LINE *b) +{ + register int lin= 1; + register struct LINE *c; + + if (a == (struct LINE *) 0 || b == (struct LINE *) 0) return -1; + + for (; (c= a->prev) != (struct LINE *) 0; a= c); + for (; a != (struct LINE *) 0; a= a->next) + { + if (a == b) return lin; + lin++; + } + + return -1; +} diff --git a/app/ned/05/ned0507.c b/app/ned/05/ned0507.c new file mode 100644 index 0000000000000000000000000000000000000000..afa14d730c482b495e85a15766e75022350f920d --- /dev/null +++ b/app/ned/05/ned0507.c @@ -0,0 +1,33 @@ +/* + * FILE %ned/05/ned0507.c + * + * show the total number of lines + * + * written: 1996-05-26 + * latest update: 1998-08-16 12:31:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_show_total_lines () +{ + int cnt; + char buf [40]; + + if (aw == (struct WINDOWCTRL *) 0) return; + + cnt= ned_cnt_total_lines (aw->WC_act); + + sprintf (buf, "%d cy=%d ay=%d", cnt, aw->cy, aw->ay); + ned_message_1 (buf); +} diff --git a/app/ned/05/ned0508.c b/app/ned/05/ned0508.c new file mode 100644 index 0000000000000000000000000000000000000000..cc83a70c5b8283eaa9fb66e95ef175b2688201ac --- /dev/null +++ b/app/ned/05/ned0508.c @@ -0,0 +1,91 @@ +/* + * FILE %ned/05/ned0508.c + * + * jump to current line + * + * written: 1987 04 08 + * 1991 06 01: Revision + * latest update: 2001-02-11 11:33:30 + * $Id: ned0508.c,v 1.3 2001/02/12 00:03:30 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_w_jmp_aktline ( +struct WINDOWCTRL *wc, +int offset_mode, +int offset, +int flg) /* Bit 0: Window neu aufbauen */ + /* 1: cx an den Rand setzen */ +{ + int lin; + int distance; + struct LINE *first; + struct LINE *first_prev; + + if (wc == (struct WINDOWCTRL *) 0) return -1; + + /* Zeilennummer der akt. Zeile ermitteln */ + if (!(flg & NEDJMP_FLAG_NO_CNT)) + wc->znr= ned_cnt_line_2beg (wc->WC_act); + + /* wc->WC_act zeigt schon auf die aktuelle Zeile im File; */ + /* jetzt muss noch wc->first eingerichtet werden */ + first= wc->WC_act; /* NOTE: wc->WC_act can be (struct LINE *) 0! */ + distance= wc->by - wc->ay; + + switch (offset_mode) + { + case NEDJMP_LINE_TOP: distance= 0; break; + case NEDJMP_LINE_MID: distance /= 2; break; + default: + case NEDJMP_LINE_3: distance /= 3; break; + case NEDJMP_LINE_BOT: break; + } + + distance += offset; + + lin= 0; + if (first != (struct LINE *) 0) + for (; lin < distance; lin++) + { + if ((first_prev= first->prev) == (struct LINE *) 0) break; + else first= first_prev; + } + + wc->WC_first= first; + wc->cy= wc->ay + lin; + + if (flg & NEDJMP_FLAG_BOLN) + { + vi_wc_jmp_boln (wc); + } + else + { + if (wc->cx >= wc->bx || wc->cx < wc->ax) + { + wc->hv += wc->cx - wc->bx + 1; + wc->cx= wc->bx - 1; + if (wc->hv < 0) + { + wc->cx += wc->hv; + wc->hv= 0; + } + } + } + + if (flg & NEDJMP_FLAG_REDRAW) + { + wc->w_upd |= 0x04; + ned_display_window (wc); + } + + return 1; +} diff --git a/app/ned/05/ned0508b.c b/app/ned/05/ned0508b.c new file mode 100644 index 0000000000000000000000000000000000000000..ba96325ae4226e036b389a9d974ddeb9b205f124 --- /dev/null +++ b/app/ned/05/ned0508b.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/05/ned0508m.c + * + * jump to current line, place current line onto bottom of the screen + * + * written: 1997-01-06 + * latest update: 1997-06-11 14:49:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_jmp_aktline_bot () +{ + ned_w_jmp_aktline (aw, NEDJMP_LINE_BOT, 0, NEDJMP_FLAG_STD); +} diff --git a/app/ned/05/ned0508m.c b/app/ned/05/ned0508m.c new file mode 100644 index 0000000000000000000000000000000000000000..fcb3030416dc237d83bf1d4ee367fcb651cfea1c --- /dev/null +++ b/app/ned/05/ned0508m.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/05/ned0508m.c + * + * jump to current line, place current line into mid-screen + * + * written: 1996-12-19 + * latest update: 1997-06-11 14:49:50 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_jmp_aktline_mid () +{ + ned_w_jmp_aktline (aw, NEDJMP_LINE_MID, 0, NEDJMP_FLAG_STD); +} diff --git a/app/ned/05/ned0508t.c b/app/ned/05/ned0508t.c new file mode 100644 index 0000000000000000000000000000000000000000..ece1f6685e3342e50d174a944e3b960de3d9bdca --- /dev/null +++ b/app/ned/05/ned0508t.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/05/ned0508t.c + * + * jump to current line, place current line onto top of screen + * + * written: 1997-01-06 + * latest update: 1997-06-11 14:50:02 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_jmp_aktline_top () +{ + ned_w_jmp_aktline (aw, NEDJMP_LINE_TOP, 0, NEDJMP_FLAG_STD); +} diff --git a/app/ned/05/ned0509.c b/app/ned/05/ned0509.c new file mode 100644 index 0000000000000000000000000000000000000000..b99be658a4464b3cdbb4da52a147a712c574907f --- /dev/null +++ b/app/ned/05/ned0509.c @@ -0,0 +1,60 @@ +/* + * FILE %ned/05/ned0509.c + * + * insert a new line at the current cursor position, + * that is: divide two lines + * + * written: 1987 04 08 + * 1991 01 27: Split Funktion extrahiert + * 1991 06 25: Revision + * latest update: 1999-04-25 16:31:08 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_wc_ins_nl (struct WINDOWCTRL *wc) +{ + int rc= 0; + struct LINE *nl; + + if (wc->file_type == FTY_FTRWDW) return -1; + + wc->f_upd= 1; + if (wc->WC_act == (struct LINE *) 0) + { + wc->first= wc->WC_act= nl= alloc_line (); + wc->tlines= 1; +#ifdef MSDOS + if (wc->bin_eoln == 0x0A) nl->line_flg |= LINE_CODE_0x0D; + /* ANM: Leeres Window. Annahme, dass hier MSDOS Lines erzeugt */ + /* werden soll, mit 0x0D 0x0A */ +#endif + } + else + { + if ((rc= ned_split2 (wc->WC_act, &nl, wc->cx + wc->hv - wc->ax, wc->ai)) + >= 0) wc->tlines++; + } + + /* Screen Update */ + if (wc->cy+1 < wc->by) + w_scrblk_down (wc->ax, wc->cy+1, wc->bx, wc->by, wc->attr_text, 1); + + if (wc->cy < wc->by) + wd_displine (wc, wc->WC_act->next, wc->cy+1, wc->ax, wc->bx); + wd_displine (wc, wc->WC_act, wc->cy, wc->ax, wc->bx); + + setcup (wc); + if (rc >= 0) ned_show_display_range (wc); + + return rc; +} diff --git a/app/ned/05/ned0510.c b/app/ned/05/ned0510.c new file mode 100644 index 0000000000000000000000000000000000000000..b30f3aa97fd27334804017414b52b8dc092881a9 --- /dev/null +++ b/app/ned/05/ned0510.c @@ -0,0 +1,84 @@ +/* + * FILE %ned/05/ned0510.c + * + * delete the current line, primitive function + * see also: %ned/05/ned0510b.c + * + * written: 1987 04 08: as del_line + * 1991 02 07: Revision + * 1991 05 26: Revision + * 1994-12-27: isolated delete_line and renamed + * latest update: 1999-05-01 10:36:48 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int COL_TEXT; +extern int blk; + +/* ------------------------------------------------------------------------ */ +void ned_delete_line () /* former p_delete_line */ +{ + register struct WINDOWCTRL *w; /* current window */ + int rc; + int k; + int blk_save; + + blk_save= blk; + + set_repeat_command (ned_delete_line); + ned_wc_delete_line (aw, blk, COL_TEXT); +} + +/* ------------------------------------------------------------------------ */ +int ned_wc_delete_line ( +register struct WINDOWCTRL *w, /* current window */ +int blk_save, +int col_text) +{ + int rc; + int k; + + if ((rc= ned_delete_current_line (w)) <= 0) return -1; + + /* now display the whole mess... scroll */ + if (rc == 3) + { /* CLR_SINGLE_LINE: line was the only line on screen, blank screen... */ + /* ### T2D ### maybe this could be optimized, but what the heck... */ + w_setstring (0, w->ax, w->ay, w->bx, w->by, col_text, "", 0x03); + } + else + if (rc > 0) + { + if (blk_save != blk) + { /* p_refresh () */ + ned_display_window (w); + } + else + { + register struct LINE *lp; + + if (w->cy < w->by) + w_scrblk_up (w->ax, w->cy, w->bx, w->by, w->attr_text, 1); + + lp= w->WC_act; + for (k= w->cy; k < w->by; k++) + if (lp != (struct LINE *) 0) lp= lp->next; + + wd_displine (w, w->WC_act, w->cy, w->ax, w->bx); + wd_displine (w, lp, k, w->ax, w->bx); + } + } + + ned_show_display_range (w); + + return 0; +} diff --git a/app/ned/05/ned0510b.c b/app/ned/05/ned0510b.c new file mode 100644 index 0000000000000000000000000000000000000000..5899b0b243db9961cdb40b5ba0f4fed3ea18affc --- /dev/null +++ b/app/ned/05/ned0510b.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/05/ned0510b.c + * + * delete the current line in a window, no display + * see also: %ned/05/ned0510.c + * + * written: 1987 04 08: as del_line + * 1991 02 07: Revision + * 1991 05 26: Revision + * 1994-12-27: extracted from ned0510.c + * latest update: 1996-10-05 10:07:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_delete_current_line ( +register struct WINDOWCTRL *w) /* current window */ +/* return value: */ +/* -1: didn't do anything */ +/* bit 0: line was last on screen */ +/* bit 1: line was first on screen */ +{ + if (w == (struct WINDOWCTRL *) 0) return -1; + + return ned_delete_a_line (w, w->WC_act); +} diff --git a/app/ned/05/ned0510c.c b/app/ned/05/ned0510c.c new file mode 100644 index 0000000000000000000000000000000000000000..76030c067af38559920a2d5c4bcb69de03e2f1c4 --- /dev/null +++ b/app/ned/05/ned0510c.c @@ -0,0 +1,99 @@ +/* + * FILE %ned/05/ned0510b.c + * + * delete the current line in a window, no display + * see also: %ned/05/ned0510.c + * + * written: 1987 04 08: as del_line + * 1991 02 07: Revision + * 1991 05 26: Revision + * 1994-12-27: extracted from ned0510.c + * latest update: 1998-08-16 19:38:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_delete_a_line ( +register struct WINDOWCTRL *w, /* current window */ +register struct LINE *lp) /* pointer to current line */ + /* which will be deleted */ +/* return value: */ +/* -1: didn't do anything */ +/* 0: nothing has been changed */ +/* bit 0: line was last on screen */ +/* bit 1: line was first on screen */ +/* bit 2: something has been edited */ +{ + register struct LINE *lp_next; /* pointer to next line */ + register struct LINE *lp_prev; /* pointer to previous line */ + int rc= 0; + + if (w == (struct WINDOWCTRL *) 0 + || (w->WC_edit_mode & EDIT_READ_ONLY) + || w->file_type == FTY_FTRWDW + || lp == (struct LINE *) 0 + ) return -1; + + if (lp->line_flg & LINE_PROTECTED) return 0; + + w->f_upd= 1; + w->tlines--; + rc= 4; + + if ((lp_next= lp->next) == (struct LINE *) 0) + { /* last line on the screen */ + if (lp->prev == (struct LINE *) 0) + { /* last line on screen is also the first one, delete everything */ + w->WC_act= w->first= (struct LINE *) 0; + w->znr= 0; + w->tlines= 0; + w->cy= w->ay; + w->cx= w->ax; + + rc= 3; + } + else + { /* this is the last line but there are others before */ + + lp_prev= lp->prev; + lp_prev->next= (struct LINE *) 0; + w->WC_act= lp_prev; /* at last line, set current line to prev */ + if (w->first == lp) w->first= w->WC_act; + + ned_line_trigger_delete (lp, 1, 0); + + if (w->cy != w->ay) w->cy--; + else if (w->first->prev != (struct LINE *) 0) + w->first= w->first->prev; + + w->znr--; + rc= 1; + } + } + else + { /* this is any line on the screen, but could also be the first */ + /* thus lp_next is not (struct LINE *) 0 */ + lp_next->prev= lp->prev; + w->WC_act= lp_next; + if (lp->prev == (struct LINE *) 0) + rc= 2; + else lp->prev->next= lp_next; + + ned_line_trigger_delete (lp, 1, 0); + + if (w->first == lp) w->first= w->WC_act; + } + + lp->next= lp->prev= (struct LINE *) 0; + ned_store_line_to_buffer (-1, lp, lp, 1); + + return rc; +} diff --git a/app/ned/05/ned0511.c b/app/ned/05/ned0511.c new file mode 100644 index 0000000000000000000000000000000000000000..14c4e94e33b892a01ade1d428f7ae1285fa5e31d --- /dev/null +++ b/app/ned/05/ned0511.c @@ -0,0 +1,55 @@ +/* + * FILE %ned/05/ned0511.c + * + * join two lines by calling ned_join2 () and displays the result + * + * written: 1987 04 08 + * 1990 05 20: Revision + * 1991 02 07: Revision + * 1991 05 26: Revision + * latest update: 1997-08-03 9:54:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_join3 (struct WINDOWCTRL *wc) +{ + struct LINE *lp; /* current line */ + int k; + + if ((lp= wc->WC_act) == (struct LINE *) 0 + || wc->file_type == FTY_FTRWDW + || lp->next == (struct LINE *) 0 + || ned_join2 (lp, lp->next) == -1 + ) return; + + wc->f_upd= 1; + wc->tlines--; + + if (wc->ay != wc->cy || wc->first->prev == (struct LINE *) 0) + { + if (wc->cy+1 >= wc->by) + { + if (wc->cy+1 >= wc->by) + wd_displine (wc, wc->WC_act->next, wc->by, wc->ax, wc->bx); + } + else + { + w_scrblk_up (wc->ax, wc->cy+1, wc->bx, wc->by, wc->attr_text, 1); + for (k= wc->cy; k < wc->by; k++) + if (lp != (struct LINE *) 0) lp= lp->next; + wd_displine (wc, lp, k, wc->ax, wc->bx); + } + } + + wd_displine (wc, wc->WC_act, wc->cy, wc->ax, wc->bx); + ned_show_display_range (wc); +} diff --git a/app/ned/05/ned0512.c b/app/ned/05/ned0512.c new file mode 100644 index 0000000000000000000000000000000000000000..197251af22523b97b425913a13570082d94c260f --- /dev/null +++ b/app/ned/05/ned0512.c @@ -0,0 +1,99 @@ +/* + * FILE %ned/05/ned0512.c + * + * elementare Editierfunktionen: TAB + * + * written: 1987 04 08 + * 1990 05 20: Revision + * 1991 02 07: Revision + * 1991 09 15: Revision + * 1995-10-29: use horizontal scrolling more efficiently + * latest update: 1998-08-19 18:43:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +#define SPECIAL_TAB 76 +extern int akt_page; +extern int ned_tabstop; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void tabulate () +{ + int i; + int j; + int ins; + int pos; + +#ifdef USE_ABBREVIATIONS + ned_check_abbrev (); +#endif /* USE_ABBREVIATIONS */ + + ins= aw->ins_flg; + if (aw->file_format == FMT_BINARY) + { + ned_wc_insert (aw, '\t', 0); + j= 1; + } + else + { + pos= aw->hv + aw->cx - aw->ax; + j= ned_tabstop - (pos % ned_tabstop); + if (pos < SPECIAL_TAB + && pos + j >= SPECIAL_TAB) + j= SPECIAL_TAB-pos; /* special TAB position */ + aw->ins_flg= INSFLG_insert; /* TABs always insert (???) */ + for (i= 0; i < j; i++) ned_wc_insert (aw, ' ', 0); + } + + aw->f_upd= 1; + + if ((aw->cx+j) < aw->bx) + { + aw->cx += j; + wd_displine (aw, aw->WC_act, aw->cy, aw->ax, aw->bx); + } + else + { +#ifdef MSDOS +#define VERSION_2 /* 1995-10-29: everything else is OBSOLETE, I think */ +#else +#define VERSION_1 /* save bet; T2D @@@ TK with horizontal scroll? */ +#endif + +#ifdef VERSION_1 /* geht z.Z. nicht besser :(( */ + aw->hv += j; /* horiz. Scroll ###### */ + /* besser so, weil multicolumn horizontal scroll */ + /* benoetigt wird, um das scrolling effizient zu */ + /* implementieren. */ + /* dieser Abschnitt war vor 1995-10-29 verwendet */ + ned_display_window (aw); +#endif /* VERSION_1 */ + +#ifdef VERSION_2 /* 1995-10-29: efficient horizontal scroll */ + wd_displine (aw, aw->WC_act, aw->cy, aw->bx-j-1, aw->bx); + w_scrblk_left (akt_page, aw->ax, aw->ay, aw->bx, aw->by, WV_GELB, j); + aw->hv += j; + wd_2setup (aw, aw->bx-j, aw->ay, aw->bx, aw->by); + /* NOTE: when ned_q_cursor_right() uses a scroll count parameter, this */ + /* should be used as that would be more efficient code. */ +#endif /* VERSION_2 */ + +#ifdef VERSION_3 /* 1995-10-29: inefficient horizontal scroll */ + /* NOTE: (1995-10-29) multi column scrolls 2b implemented */ + wd_displine (aw, aw->WC_act, aw->cy, aw->bx-1, aw->bx); + for (i= 0; i < j; i++) ned_q_cursor_right (aw, 1); +#endif /* VERSION_3 */ + } + + /**** wd_displine (aw, aw->WC_act, aw->cy, aw->ax, aw->bx); 1995-10-29 ****/ + aw->ins_flg= ins; +} diff --git a/app/ned/05/ned0513.c b/app/ned/05/ned0513.c new file mode 100644 index 0000000000000000000000000000000000000000..9e2b5c3a01a234ac530b28500e2e3d45e8926169 --- /dev/null +++ b/app/ned/05/ned0513.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/05/ned0513.c + * + * elementare Editierfunktionen: TAB, NL, PGUP, PGDN + * + * written: 1987 04 08 + * latest update: 1997-06-28 22:46:04 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void pq_up () +{ + register struct LINE *lp1; + register struct WINDOWCTRL *w; + + ned_set_marker (aw, '\''); + w= aw; + if ((lp1= ned_find_first_line (w->WC_first)) == (struct LINE *) 0) return; + + w->WC_first= w->WC_act= lp1; + w->znr= 1; + w->cy= w->ay; + ned_display_window (aw); +} diff --git a/app/ned/05/ned0514.c b/app/ned/05/ned0514.c new file mode 100644 index 0000000000000000000000000000000000000000..3390f496f2bf2218998a79a7a7add8d78dbd66b0 --- /dev/null +++ b/app/ned/05/ned0514.c @@ -0,0 +1,51 @@ +/* + * FILE %ned/05/ned0514.c + * + * elementare Editierfunktionen: TAB, NL, PGUP, PGDN + * + * written: 1987 04 08 + * latest update: 1997-06-28 22:46:23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void pq_dn () +{ + register struct LINE *lp1; + register struct WINDOWCTRL *w; + int zeile; + int i; + + w= aw; + ned_set_marker (w, '\''); + if ((lp1= w->WC_act) == (struct LINE *) 0) return; + zeile= w->znr; + + while (lp1->next != (struct LINE *) 0) + { + lp1= lp1->next; + zeile++; + } + + w->znr= zeile; + w->WC_act= lp1; + + for (i= w->by - w->ay; i > 0; i--) + { + if (lp1->prev == (struct LINE *) 0) break; + lp1= lp1->prev; + } + + w->first= lp1; + w->cy= w->by - i; + ned_display_window (aw); +} diff --git a/app/ned/05/ned0515.c b/app/ned/05/ned0515.c new file mode 100644 index 0000000000000000000000000000000000000000..d0b932adddcc3a7a8cc4e7508617889e3d3e6c06 --- /dev/null +++ b/app/ned/05/ned0515.c @@ -0,0 +1,217 @@ +/* + * FILE %ned/05/ned0515.c + * + * split a line into two new lines + * + * written: 1991 01 27: extracted from ned0509.c + * 1991 10 13: revision: block flags + * latest update: 2001-09-28 16:47:13 + * $Id: ned0515.c,v 1.3 2001/09/28 18:48:28 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +extern struct MARKER b_beg, b_end; + +/* ------------------------------------------------------------------------ */ +int ned_split ( /* split a line into two lines */ +struct LINE *split_line, /* line to be splitted */ +struct LINE **splitted_part, /* line created after splitting */ +int split_position, /* position where splitting is done */ +int auto_indent) /* 1 -> auto indent for new line */ +/* RETURN: -1 ... error */ +/* >= 0 ... number of padded blanks, when auto indent was done */ +{ + int line_length; /* length of line to be splitted */ + int bai= 0; /* number of blanks for auto indent */ + register struct LINE *nl; /* newly created line */ + register struct TXT *tx1; /* text segments in old line */ + register struct TXT *tx2; /* text segments in new line */ + int lsl1; /* line segment length for line 1 */ + int lsl2= 0; /* line segment length for line 2 */ + char *cp1; /* text segment pointer for line 1 */ + char *cp2; /* text segment pointer for line 2 */ + struct FEATURE *ftr1; /* features are re-aranged too */ + struct FEATURE **pftr1; + struct FEATURE **pftr2; + int i; + + *splitted_part= (struct LINE *) 0; + if (split_line == (struct LINE *) 0 /* undefined line ... */ + || split_position < 0 /* ... or split position */ + || (split_line->line_flg & LINE_PROTECTED) + ) + return -1; /* result in an error */ + + /* T2D: check if cursor is on a feature replace array and deal */ + /* with it accordingly. */ + + line_length= split_line->lng; + if (split_position > line_length) split_position= line_length; + if ((nl= alloc_line ()) == (struct LINE *) 0) return -1; + + /* Note: when the line to be splitted is empty we get another empty line. */ + if ((tx1= split_line->txt) != (struct TXT *) 0) + { + lsl1= tx1->t_lng; + cp1= tx1->t; + if (auto_indent) + { + while (bai < line_length) /* erstes Zeichen != BLANK suchen */ + { + if (lsl1 == 0) + { + if ((tx1= tx1->next) == (struct TXT *) 0) break; + lsl1= tx1->t_lng; + cp1= tx1->t; + } + if (*cp1 != 0x20) break; + cp1++; + lsl1--; + bai++; + } + if (bai >= split_position) + bai= 0; /* Auto Indent nach */ + /* Leerzeilen vermeiden */ + if ((tx1= split_line->txt) != (struct TXT *) 0) + { + lsl1= tx1->t_lng; + cp1= tx1->t; + } /* else ???? ### (1994-12-27/20:20) */ + } + + txt_adj (bai+1, &nl->txt); /* create a new line with the right */ + /* number of blanks. */ + tx2= nl->txt; + cp2= tx2->t; /* should not be necessary... */ + + for (i= bai;;) /* search for character insert */ + { /* position in splitted part. */ + if (i < tx2->t_lng) + { + lsl2= tx2->t_lng-i; + cp2= &(tx2->t[i]); + break; + } + if (tx2->next == (struct TXT *) 0) break; + i -= tx2->t_lng; + tx2= tx2->next; + } + + for (i= split_position;;) /* search for character transfer */ + { /* position in original line. */ + if (i < tx1->t_lng) + { + lsl1= tx1->t_lng-i; + cp1= &(tx1->t[i]); + break; + } + if (tx1->next == (struct TXT *) 0) break; + i -= tx1->t_lng; + tx1= tx1->next; + } + + for (i= 0; i+split_position < line_length; i++) + { + if (lsl2 == 0) + { + if (tx2->next == (struct TXT *) 0) + tx2->next= txch_alloc (TXT_LNG, 0x20); + tx2= tx2->next; + if (tx2 == (struct TXT *) 0) return -1; + lsl2= tx2->t_lng; + cp2= tx2->t; + } + if (lsl1 == 0) + { + if ((tx1= tx1->next) == (struct TXT *) 0) break; + lsl1= tx1->t_lng; + cp1= tx1->t; + } + *cp2++= *cp1++; + lsl1--; + lsl2--; + } + + txt_adj (split_line->lng= split_position, &split_line->txt); + txt_adj (nl->lng= i+bai, &nl->txt); + } + + if ((split_line->line_flg & LINE_inBLOCK) == LINE_BLOCK_INBLOCK) + nl->line_flg |= LINE_BLOCK_INBLOCK; + /* Note: if line is begin or end, the callback function does the rest */ + + ned_line_trigger_split_join (split_line, nl, + split_position, LCB_line_split); + +#ifdef __T2D__ /* 1997-04-13 21:27:19 */ +NOTE: these code particles should be moved into the marker callback + function + + /* Block Flags - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + if (split_line->line_flg & LINE_inBLOCK) + { + if (split_line == b_beg.ptr) + { + if (split_position <= b_beg.offset) + { +#ifdef __OLD__ /* 1997-04-23 18:29:28 */ + b_beg.ptr= nl; + if (block_mode != BLOCK_MODE_box) b_beg.offset -= split_line->lng; +#endif /* __OLD__ 1997-04-23 18:29:28 */ + nl->line_flg |= LINE_BLOCK_BEGEND; + split_line->line_flg &= LINE_BLOCK_CLR; + } + else nl->line_flg |= LINE_BLOCK_INBLOCK; + } + + if (split_line == b_end.ptr) + { + if (split_position < b_end.offset) + { +#ifdef __OLD__ /* 1997-04-23 18:29:28 */ + b_end.ptr= nl; + if (block_mode != BLOCK_MODE_box) b_end.offset -= split_line->lng; +#endif /* __OLD__ 1997-04-23 18:29:28 */ + nl->line_flg |= LINE_BLOCK_BEGEND; + split_line->line_flg &= LINE_BLOCK_CLR_BEGEND; + split_line->line_flg |= LINE_BLOCK_INBLOCK; + } + else split_line->line_flg &= LINE_BLOCK_CLR; + } + + if (!(split_line->line_flg & LINE_BLOCK_BEGEND)) + nl->line_flg |= LINE_BLOCK_INBLOCK; + } +#endif /* __T2D__ 1997-04-13 21:27:19 */ + + /* Feature Records - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + pftr2= &nl->ftr; + for (pftr1= &split_line->ftr; (ftr1= *pftr1) != (struct FEATURE *) 0;) + { + if (ftr1->ftr_pos >= split_position) + { + ftr1->ftr_pos= ftr1->ftr_pos - split_position + bai; + *pftr2= ftr1; + *pftr1= ftr1->ftr_next; + pftr2= &ftr1->ftr_next; + *pftr2= (struct FEATURE *) 0; + } + else pftr1= &ftr1->ftr_next; + } + + /* Carriage Return Flag uebernehmen - - - - - - - - - - - - - - - - - - - */ + if (split_line->line_flg & LINE_CODE_0x0D) + nl->line_flg |= LINE_CODE_0x0D; + + *splitted_part= nl; + + return bai; +} diff --git a/app/ned/05/ned0515b.c b/app/ned/05/ned0515b.c new file mode 100644 index 0000000000000000000000000000000000000000..e74cda940365c9d1cd2f796c0ae76d3b08ba4c77 --- /dev/null +++ b/app/ned/05/ned0515b.c @@ -0,0 +1,49 @@ +/* + * FILE %ned/05/ned0515b.c + * + * split a line into two new lines and links the results into + * the current line list + * see also: ned_split () + * + * written: 1991 01 27: extracted from ned0509.c + * 1991 10 13: revision: block flags + * latest update: 1999-04-25 16:31:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_split2 ( /* split a line into two lines */ +struct LINE *split_line, /* line to be splitted */ +struct LINE **splitted_part, /* line created after splitting */ +int split_position, /* position where splitting is done */ +int auto_indent) /* 1 -> auto indent for new line */ +/* RETURN: -1 ... error */ +/* >= 0 ... number of padded blanks, when auto indent was done */ +{ + int rc; + + rc= ned_split (split_line, splitted_part, split_position, auto_indent); + + if (rc >= 0) + { + struct LINE *nl; + struct LINE *nl2; + + nl= *splitted_part; + + nl->prev= split_line; + nl->next= nl2= split_line->next; + if (nl2 != (struct LINE *) 0) nl2->prev= nl; + split_line->next= nl; + } + + return rc; +} diff --git a/app/ned/05/ned0516.c b/app/ned/05/ned0516.c new file mode 100644 index 0000000000000000000000000000000000000000..dd73f9edaaae4edadbfdf8632d099b310685b664 --- /dev/null +++ b/app/ned/05/ned0516.c @@ -0,0 +1,138 @@ +/* + * FILE %ned/05/ned0516.c + * + * join two lines to form a single line + * see also: ned_join2 () + * + * written: 1991 01 28: aus NED0511.c extrahiert + * latest update: 2000-08-11 5:39:33 + * $Id: ned0516.c,v 1.2 2000/08/11 03:59:16 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_join (struct LINE *lp1, struct LINE *lp2) +{ + register struct TXT *tx1; /* line (or text) segment */ + register struct TXT *tx2; + int lng1; /* length of line 1 */ + int lng2; /* length of line 2 */ + int lsl1= 0; /* line segment length */ + int lsl2; + char *cp1= (char *) 0; + char *cp2; + struct FEATURE **pftr1; + struct FEATURE *ftr2; + int i; + + if (lp1 == (struct LINE *) 0) return -1; + if (lp2 == (struct LINE *) 0) return 0; /* nichts zu tun, alles ok */ + + lng1= lp1->lng; + lng2= lp2->lng; + if (lng1+lng2 > LINE_LNG_TXT) return -1; /* Zeile dann zu lang ... */ + txt_adj (lng1+lng2, &lp1->txt); + tx1= lp1->txt; /* may be NULL */ + + for (i= lng1; tx1 != (struct TXT *) 0;) + { + if (i < tx1->t_lng) + { + lsl1= tx1->t_lng-i; + cp1= &(tx1->t[i]); + break; + } + if (tx1->next == (struct TXT *) 0) break; + i -= tx1->t_lng; + tx1= tx1->next; + } + + if ((tx2= lp2->txt) == (struct TXT *) 0) + { + lsl2= 0; + cp2= (char *) 0; + } + else + { + lsl2= tx2->t_lng; + cp2= tx2->t; + } + + /* NOTE: tx1 may be NULL at this point! */ + for (i= 0; i < lng2; i++) + { + if (lsl1 == 0) + { + if ((tx1= tx1->next) == (struct TXT *) 0) break; + lsl1= tx1->t_lng; + cp1= tx1->t; + } + if (lsl2 == 0) + { + if ((tx2= tx2->next) == (struct TXT *) 0) break; + lsl2= tx2->t_lng; + cp2= tx2->t; + } + *cp1++ = *cp2++; + lsl1--; + lsl2--; + } + + lp1->lng= i + lng1; + +ned_message_1 ("ned0516 vor callback"); + ned_line_trigger_split_join (lp2, lp1, lng1, LCB_line_join); + +#ifdef __OLD__ /* 1997-04-14 0:04:37 */ + /* Block Marker - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + if (lp2->line_flg & LINE_inBLOCK) + { + if (lp2 == b_beg.ptr || lp2 == b_end.ptr) + { + lp1->line_flg |= LINE_BLOCK_BEGEND; + if (b_beg.ptr == lp2) + { + if (block_mode != BLOCK_MODE_box) b_beg.offset += lng1; + b_beg.ptr= lp1; + } + + if (b_end.ptr == lp2) + { + if (block_mode != BLOCK_MODE_box) b_end.offset += lng1; + b_end.ptr= lp1; + } + } + } +#endif /* __OLD__ 1997-04-14 0:04:37 */ + + /* Feature Records - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + if ((ftr2= lp2->ftr) != (struct FEATURE *) 0) + { + for (pftr1= &lp1->ftr; + *pftr1 != (struct FEATURE *) 0; + pftr1= &(*pftr1)->ftr_next); + + *pftr1= ftr2; + for (; ftr2 != (struct FEATURE *) 0; ftr2= ftr2->ftr_next) + ftr2->ftr_pos += lng1; + lp2->ftr= (struct FEATURE *) 0; + } + + lp2->next= lp2->prev= (struct LINE *) 0; + + /* ASSERT: for lp2 there should be no line callbacks active now! */ +#ifdef LCB_DEBUG + ned_line_test_cb (lp2); +#endif + + ned_lines_free (lp2); + + return 0; +} diff --git a/app/ned/05/ned0516b.c b/app/ned/05/ned0516b.c new file mode 100644 index 0000000000000000000000000000000000000000..ab75104780d8af6bab6dae64660c8a7af54a1a4a --- /dev/null +++ b/app/ned/05/ned0516b.c @@ -0,0 +1,30 @@ +/* + * FILE %ned/05/ned0516b.c + * + * join two lines and link up the results + * + * written: 1995-03-22 + * latest update: 1996-10-17 10:07:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_join2 (struct LINE *lp1, struct LINE *lp2) +{ + struct LINE *lp3; + + if (lp2 == (struct LINE *) 0) return 0; + + lp3= lp2->next; + if (ned_join (lp1, lp2) == -1) return -1; + if ((lp1->next= lp3) != (struct LINE *) 0) lp3->prev= lp1; + + return 0; +} diff --git a/app/ned/05/ned0517.c b/app/ned/05/ned0517.c new file mode 100644 index 0000000000000000000000000000000000000000..b1de7b6c17bc1d00f436eac8d40ca6b3e0c1da43 --- /dev/null +++ b/app/ned/05/ned0517.c @@ -0,0 +1,63 @@ +/* + * FILE %ned/05/ned0517.c + * + * written: 1991 01 28: aus NED0726.C isoliert + * 1991 07 10: Revision + * latest update: 1999-04-25 16:31:47 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include "ed.h" +#include "proto.h" +#include "message.h" + +/* ------------------------------------------------------------------------ */ +int ned_copy_line ( +struct LINE **dl, /* Destination Line */ +struct LINE *sl) /* Source Line */ +/* RETURN: -1 ... error */ +/* 0 ... ok */ +{ + struct LINE *nl; /* New Line */ + register struct TXT **tx1, *tx1b, *tx2; + + /* 1. copy line control data */ + if (sl == (struct LINE *) 0 + || (nl= alloc_line ()) == (struct LINE *) 0 + ) goto ERROR; + + nl->lng= sl->lng; + nl->line_flg= sl->line_flg & LINE_BLOCK_CLR; /* reset Block Flags */ + + /* 2. copy all features */ + if (sl->ftr != (struct FEATURE *) 0 + && ned_copy_feature_list (&nl->ftr, sl->ftr) == -1 + ) goto ERROR; + + /* 3. copy text segments for the line */ + tx2= sl->txt; + tx1= &nl->txt; + while (tx2 != (struct TXT *) 0) + { + if ((*tx1= tx1b= txch_alloc (tx2->t_lng, 0x20)) == (struct TXT *) 0) + goto ERROR; + + memcpy (tx1b->t, tx2->t, tx2->t_lng); + tx1= &tx1b->next; + tx2= tx2->next; + } + + *dl= nl; + return 0; + +ERROR: + ned_error_message (ERR_MEMORY); + return -1; +} diff --git a/app/ned/05/ned0519.c b/app/ned/05/ned0519.c new file mode 100644 index 0000000000000000000000000000000000000000..e41be4b8d5d8ca8cad6c29cb816f22643ff481f2 --- /dev/null +++ b/app/ned/05/ned0519.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/05/ned0519.c + * + * Zeile relativ zu ihrer Position im Window anspringen + * + * written: 1991 06 02 + * latest update: 1996-09-07 10:11:06 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int jmpline_relative ( +register struct WINDOWCTRL *w, +double fraction) /* Zielzeile relativ zum Window */ +{ + long dlines; /* Zahl der Zeilen im Window */ + long xlines; /* Zahl der Zeilen im File */ + int alnr; /* errechnete absolute Zeilennummer */ + + dlines= (long) (w->by - w->ay + 1); + xlines= (long) ned_cnt_total_lines (w->WC_act); + + alnr= (int) (fraction * xlines); + if (alnr < 0) alnr= 0; + + return ned_jmp_2line_by_nr (w, alnr, 0x01); +} diff --git a/app/ned/05/ned0520.c b/app/ned/05/ned0520.c new file mode 100644 index 0000000000000000000000000000000000000000..a1561f59049d3d51c67f5786f49a34e9e7fef1d6 --- /dev/null +++ b/app/ned/05/ned0520.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/05/ned0520.c + * + * Spalte in Zeile anspringen + * + * written: 1991 07 01 + * latest update: 1997-01-12 16:48:05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int jmp2column (register struct WINDOWCTRL *w, int coln) +{ + int df= 0; + + if (coln < w->hv + w->ax || coln > w->hv + w->bx) + { /* adjust hv */ + w->hv = coln-5; + if (w->hv < 0) w->hv=0; + } + + w->cx= coln+w->ax-w->hv; + if (df) ned_display_window (w); + setcup (w); + + return 0; +} diff --git a/app/ned/05/ned0521.c b/app/ned/05/ned0521.c new file mode 100644 index 0000000000000000000000000000000000000000..bf5099f34901681ede68ebaedab55afa3e0f89f3 --- /dev/null +++ b/app/ned/05/ned0521.c @@ -0,0 +1,48 @@ +/* + * FILE %ned/05/ned0521.c + * + * written: 1991 07 10: Revision + * latest update: 1999-04-25 16:31:53 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <memory.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_copy_feature_list ( +struct FEATURE **fd, /* Feature Destination */ +struct FEATURE *fs) /* Feature Source */ +/* Return 0 ... ok */ +/* -1 ... Error */ +{ + struct FEATURE *fn; /* Feature New */ + + while (fs != (struct FEATURE *) 0) + { + if (1 /* TEST: COPY_FEATURE fs->ftr_duplication & FTR_dup_copy */) + { + if ((fn= ned_feature_alloc ()) == (struct FEATURE *) 0) return -1; + + /* Achtung: memcpy geht nur, wenn die Struktur nicht veraendert wird! */ + memcpy (&fn->ftr_pos, &fs->ftr_pos, + sizeof (struct FEATURE)-4*sizeof (void *)); + + if (fs->ftr_duplication & FTR_dup_copy) + ned_copy_line ((struct LINE **) &fn->ftr_text_line, + (struct LINE *) fs->ftr_text_line); + + *fd= fn; + fd= &fn->ftr_next; + } + fs= fs->ftr_next; + } + + return 0; +} diff --git a/app/ned/05/ned0522.c b/app/ned/05/ned0522.c new file mode 100644 index 0000000000000000000000000000000000000000..dc422219211253285a818fd576db42344fe3b358 --- /dev/null +++ b/app/ned/05/ned0522.c @@ -0,0 +1,89 @@ +/* + * FILE %ned/05/ned0522.c + * + * window stack management + * + * written: 1991 10 13 + * latest update: 1999-05-02 4:50:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct PLIST *winstack= (struct PLIST *) 0; + +/* ------------------------------------------------------------------------ */ +int winstack_push (struct WINDOWCTRL *w) +{ + struct PLIST *pl; + + if (winstack != (struct PLIST *) 0 + && winstack->PL_val == w) return 0; /* insert only once at top */ + + winstack_delete (w); + if ((pl= (struct PLIST *) calloc (sizeof (struct PLIST), 1)) == + (struct PLIST *) 0) return -1; + + pl->PL_val= w; + pl->PL_lnk= winstack; + winstack= pl; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef JUNK +struct WINDOWCTRL *winstack_pop () +{ + struct PLIST *pl; + struct WINDOWCTRL *wc; + + if ((pl= winstack) == (struct PLIST *) 0) return (struct WINDOWCTRL *) 0; + + wc= pl->PL_val; + winstack= pl->PL_lnk; + free (pl); + + return wc; +} +#endif + +/* ------------------------------------------------------------------------ */ +int winstack_delete (struct WINDOWCTRL *w) +{ + struct PLIST *pl, **ppl; + + for (ppl= &winstack; (pl= *ppl) != (struct PLIST *) 0;) + { + if (pl->PL_val == w) + { /* delete this entry */ + *ppl= pl->PL_lnk; + free (pl); + return 0; + } + else ppl= &pl->PL_lnk; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +struct WINDOWCTRL *winstack_get (int num) +{ + struct PLIST *pl; + + for (pl= winstack; pl != (struct PLIST *) 0; pl= pl->PL_lnk) + { + if (num <= 0) return pl->PL_val; + num--; + } + + return (struct WINDOWCTRL *) 0; +} diff --git a/app/ned/06/(dirinf).fm b/app/ned/06/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..b5468968d802b31e1859b038117090cb24e30a88 --- /dev/null +++ b/app/ned/06/(dirinf).fm @@ -0,0 +1,48 @@ +# +# FILE %ned/06/(dirinf).fm +# +# written: 1991 07 03 +# latest update: 2000-08-25 19:30:44 +# $Id: (dirinf).fm,v 1.3 2000/08/25 18:05:47 gonter Exp $ +# +# ---------------------------------------------------------------------------- +Makefile | active Makefile (DOS or Unix) +make-c5 | DOS Makefile + +ned0602.c | void ned_clear_screen () +ned0603.c | void p_refresh () /* ^O G */ +ned0604.c | void p_refresh_all () /* ^O T */ +ned0605.c | void p_jmpwdw () +ned0606.c | int q_jmpwdw (i) +ned0607.c | void p_pushpage () +ned0608.c | int q_pushpage (w, new_page) +ned0609.c | int maus_jmpwdw (x, y) +ned0610.c | int q_ofile () +ned0610a.c | int p_ofile1 () +ned0610b.c | int p_ofile2 () +ned0610c.c | int ned_open_file (char *fnm, int flags) +ned0610d.c | int ned_cb_open_file (char *fnm, ...) +ned0610e.c | int ned_open_file_2 (char *fnm, int flags) +ned0611.c | void p_wdwsfile () +ned0612.c | void p_wdwqfile () +ned0613.c | int rd_str (char *msg, char *str, int str_size) +ned0613b.c | int ned_rd_str2 (char *msg, char *str, int str_size) +ned0614.c | void q_rename (char *fnm, int max_fnm) +ned0615.c | q_fnm (fnm) +ned0616.c | void p_rename () /* ^K N: Rename File */ +ned0617.c | void p_garbling_code () /* ^K -: File Schluessel eingeben */ +ned0618.c | void p_exit () +ned0619.c | void p_ultra_panic () +ned0620.c | void debug (s) +ned0621.c | int ned_error_message (char *s) +ned0622.c | void ned_message_* (cnt, ss) +ned0623.c | void correct_pathname (char *s) +ned0624.c | save_message_line, restore_message_line +ned0625.c | void q2_jmpwdw (struct WINDOWCTRL *w); +ned0626.c | void q0_jmpwdw (); +ned0627.c | int open_file_and_window (char *filename, char *location); +ned0628.c | int take_history_notes (struct WINDOWCTRL *w); +ned0629.c | int get_window_number (struct WINDOWCTRL *w); +ned0630.c | char *FC_setup_filenames (struct FILECTRL *fc, ...) +ned0631.c | int ned_prompt_string +* | diff --git a/app/ned/06/Makefile b/app/ned/06/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..c96f2b4a3a0ae63626563f58b06b08251319d135 --- /dev/null +++ b/app/ned/06/Makefile @@ -0,0 +1,116 @@ +# +# FILE %ned/06/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# +# latest update: 2000-08-24 14:38:24 +# $Id: Makefile,v 1.6 2001/11/13 19:14:16 gonter Exp $ +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-c -g -I.. $(cf) +CC=cc +objs=ned0606.o \ + ned0607.o ned0608.o ned0609.o ned0610.o \ + ned0610a.o ned0610b.o ned0610c.o ned0610d.o ned0610e.o \ + ned0612.o ned0613.o ned0616.o \ + ned0619.o ned0623.o ned0624.o ned0625.o \ + ned0627.o ned0628.o ned0629.o ned0630.o +objs_cur= ned0602_cur.o ned0603_cur.o ned0604_cur.o ned0605_cur.o ned0613b_cur.o \ + ned0614_cur.o ned0615_cur.o ned0618_cur.o ned0621_cur.o \ + ned0622_cur.o ned0626_cur.o ned0631_cur.o +objs_tk= ned0602_tk.o ned0603_tk.o ned0604_tk.o ned0605_tk.o ned0613b_tk.o \ + ned0614_tk.o ned0615_tk.o ned0618_tk.o ned0621_tk.o \ + ned0622_tk.o ned0626_tk.o ned0631_tk.o +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_tk lib_cur +clean : + rm -f *.o lib_cur lib_tk + +lib_tk : $(objs_tk) $(objs) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h + $(CC) $(OPTS) -c $*.c + +# --- cur Modules ---------- +ned0602_cur.o : ../ed.h ned0602.c + $(CC) $(OPTS) -o ned0602_cur.o ned0602.c + +ned0603_cur.o : ../ed.h ned0603.c + $(CC) $(OPTS) -o ned0603_cur.o ned0603.c + +ned0604_cur.o : ../ed.h ned0604.c + $(CC) $(OPTS) -o ned0604_cur.o ned0604.c + +ned0613b_cur.o : ../ed.h ned0613b.c + $(CC) $(OPTS) -o ned0613b_cur.o ned0613b.c + +ned0614_cur.o : ../ed.h ned0614.c + $(CC) $(OPTS) -o ned0614_cur.o ned0614.c + +ned0615_cur.o : ../ed.h ned0615.c + $(CC) $(OPTS) -o ned0615_cur.o ned0615.c + +ned0618_cur.o : ../ed.h ned0618.c + $(CC) $(OPTS) -o ned0618_cur.o ned0618.c + +ned0626_cur.o : ../ed.h ned0626.c + $(CC) $(OPTS) -o ned0626_cur.o ned0626.c + +ned0631_cur.o : ../ed.h ned0631.c + $(CC) $(OPTS) -o ned0631_cur.o ned0631.c + +# --- tk Modules ---------- +ned0602_tk.o : ../ed.h ned0602.c + $(CC) $(OPTS) -DUSE_TK -o ned0602_tk.o ned0602.c + +ned0603_tk.o : ../ed.h ned0603.c + $(CC) $(OPTS) -DUSE_TK -o ned0603_tk.o ned0603.c + +ned0604_tk.o : ../ed.h ned0604.c + $(CC) $(OPTS) -DUSE_TK -o ned0604_tk.o ned0604.c + +ned0613b_tk.o : ../ed.h ned0613b.c + $(CC) $(OPTS) -DUSE_TK -o ned0613b_tk.o ned0613b.c + +ned0614_tk.o : ../ed.h ned0614.c + $(CC) $(OPTS) -DUSE_TK -o ned0614_tk.o ned0614.c + +ned0615_tk.o : ../ed.h ned0615.c + $(CC) $(OPTS) -DUSE_TK -o ned0615_tk.o ned0615.c + +ned0618_tk.o : ../ed.h ned0618.c + $(CC) $(OPTS) -DUSE_TK -o ned0618_tk.o ned0618.c + +ned0626_tk.o : ../ed.h ned0626.c + $(CC) $(OPTS) -DUSE_TK -o ned0626_tk.o ned0626.c + +ned0631_tk.o : ../ed.h ned0631.c + $(CC) $(OPTS) -DUSE_TK -o ned0631_tk.o ned0631.c +# --- cur Modules ---------- +ned0605_cur.o : ../ed.h ned0605.c + $(CC) $(OPTS) -o ned0605_cur.o ned0605.c + +ned0621_cur.o : ../ed.h ned0621.c + $(CC) $(OPTS) -o ned0621_cur.o ned0621.c + +ned0622_cur.o : ../ed.h ned0622.c + $(CC) $(OPTS) -o ned0622_cur.o ned0622.c + +# --- tk Modules ---------- +ned0605_tk.o : ../ed.h ned0605.c + $(CC) $(OPTS) -DUSE_TK -o ned0605_tk.o ned0605.c + +ned0621_tk.o : ../ed.h ned0621.c + $(CC) $(OPTS) -DUSE_TK -o ned0621_tk.o ned0621.c + +ned0622_tk.o : ../ed.h ned0622.c + $(CC) $(OPTS) -DUSE_TK -o ned0622_tk.o ned0622.c diff --git a/app/ned/06/contrib b/app/ned/06/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/06/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/06/gg b/app/ned/06/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/06/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/06/lib_cur b/app/ned/06/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/06/lib_tk b/app/ned/06/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/06/make-dos b/app/ned/06/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..8c7fee61933a6aa31c1232d5494412d4ed8b0f82 --- /dev/null +++ b/app/ned/06/make-dos @@ -0,0 +1,29 @@ +# +# FILE %ned/06/makefile +# +# GG's Night(mare) Editor System +# +# written: 1987-04-08 +# latest update: 1996-07-14 9:14:18 +# +# ============================================================================ +cc=cl -Os -AL /W3 /c +ccc=cl -Os -AL /W3 /Fo$@ -I.. /c +obj=objdec -m0 -w -d -sl 2 NED06_TEXT $@ + +lib : ned0602.obj ned0603.obj ned0604.obj ! + ned0605.obj ned0606.obj ned0607.obj ned0608.obj ! + ned0609.obj ned0610.obj ned0610a.obj ned0610b.obj ! + ned0610c.obj ned0610d.obj ned0610e.obj ! + ned0612.obj ned0613.obj ned0613b.obj ned0614.obj ned0615.obj ! + ned0616.obj ned0618.obj ! + ned0619.obj ned0620.obj ned0621.obj ned0622.obj ! + ned0623.obj ned0624.obj ned0625.obj ned0626.obj ! + ned0627.obj ned0628.obj ned0629.obj ned0630.obj ned0631.obj + +obsolete: ned0611.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $? + $(obj) diff --git a/app/ned/06/ned0602.c b/app/ned/06/ned0602.c new file mode 100644 index 0000000000000000000000000000000000000000..6b7f5bb0857dc0f49fce9c5cdb808cf5b230d772 --- /dev/null +++ b/app/ned/06/ned0602.c @@ -0,0 +1,29 @@ +/* + * FILE %ned/06/ned0602.c + * + * Refresh Screen + * + * written: 1994-05-23: isolated from ned0604.c + * latest update: 2000-08-25 19:29:47 + * $Id: ned0602.c,v 1.2 2000/08/25 18:05:48 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern int akt_buttons; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_clear_screen () +{ + w_cls (); + show_buttons (aw); + restore_message_line (); +} diff --git a/app/ned/06/ned0603.c b/app/ned/06/ned0603.c new file mode 100644 index 0000000000000000000000000000000000000000..a13ee84878a80c081885bcf0fad8ec680e69c2f7 --- /dev/null +++ b/app/ned/06/ned0603.c @@ -0,0 +1,30 @@ +/* + * FILE %ned/06/ned0603.c + * + * Refresh Window (= redraw contents of window) + * + * written: 1987 04 08 + * latest update: 1996-03-16 1:46:30 + * $Id: ned0603.c,v 1.3 2002/06/12 18:51:48 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_refresh () +{ +#ifdef W_MODEL_CURSES + /*** curses_cls (); ***/ + clear (); +#endif + aw->w_upd |= 0x04; + ned_display_window (aw); +} diff --git a/app/ned/06/ned0604.c b/app/ned/06/ned0604.c new file mode 100644 index 0000000000000000000000000000000000000000..86c428b59178d14d9cb42730a3ba2f4143f4e4ca --- /dev/null +++ b/app/ned/06/ned0604.c @@ -0,0 +1,38 @@ +/* + * FILE %ned/06/ned0604.c + * + * Refresh Screen + * + * written: 1987 04 08 + * 1990 04 01: Revision + * latest update: 2000-08-25 19:30:24 + * $Id: ned0604.c,v 1.2 2000/08/25 18:05:48 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern struct WINDOWCTRL *windows; + +/* ------------------------------------------------------------------------ */ +void p_refresh_all () +{ + register struct WINDOWCTRL *wc; + int wn= 1; + + ned_clear_screen (); + + for (wc= windows; wc != (struct WINDOWCTRL *) 0; wc= wc->WC_next) + { + wc->w_upd |= 0x04; + wc->wc_window_number= wn++; + } + + wda_setup (); +} diff --git a/app/ned/06/ned0605.c b/app/ned/06/ned0605.c new file mode 100644 index 0000000000000000000000000000000000000000..9540ce84743d13660435d931fb7dae8919b977af --- /dev/null +++ b/app/ned/06/ned0605.c @@ -0,0 +1,35 @@ +/* + * FILE %ned/06/ned0605.c + * + * File- und Windowoperationen + * + * written: 1987 04 08 + * latest update: 1997-10-26 10:25:32 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern struct WINDOWCTRL *aw; +extern int akt_page; +extern int oper_level; +extern int key; +extern int COL_STATUS; + +/* ------------------------------------------------------------------------ */ +void p_jmpwdw () /* ^O 1..9 */ +{ + if (oper_level >= LEV_WDW) return; + if (key <= '0' || key > '9') return; + + w_setstring (akt_page, aw->ax+4, aw->ay-1, aw->ax+7, aw->ay-1, + COL_STATUS, " ", 0x01); + + q_jmpwdw (key-'0'); +} diff --git a/app/ned/06/ned0606.c b/app/ned/06/ned0606.c new file mode 100644 index 0000000000000000000000000000000000000000..c2d2f38c28620b2da0dbc3495829ed2a4c3e98c9 --- /dev/null +++ b/app/ned/06/ned0606.c @@ -0,0 +1,32 @@ +/* + * FILE %ned/06/ned0606.c + * + * jump to the window number i + * window numbers are in the range 1 .. n + * + * written: 1987 04 08 + * 1991 05 22: Revision + * latest update: 1997-01-12 16:15:53 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern struct WINDOWCTRL *windows; + +/* ------------------------------------------------------------------------ */ +struct WINDOWCTRL *q_jmpwdw (int k) +{ + for (aw= windows; --k && aw->next != (struct WINDOWCTRL *) 0; aw= aw->next); + + winstack_push (aw); + q0_jmpwdw (aw); + + return aw; +} diff --git a/app/ned/06/ned0607.c b/app/ned/06/ned0607.c new file mode 100644 index 0000000000000000000000000000000000000000..146374dafac47f32d76a94d1ba22d96ff64b2f13 --- /dev/null +++ b/app/ned/06/ned0607.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/06/ned0607.c + * + * File- und Windowoperationen + * + * written: 1987 04 08 + * 1991 05 22: Revision + * latest update: 1997-10-26 10:25:25 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int oper_level; +extern ned_input_handler *nextchar; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_pushpage () /* ^OP 1..9 */ +{ + int k; + + if (oper_level >= LEV_WDW) return; + k= (*nextchar) (); + if (k < '0' || k > '7') return; + q_pushpage (aw, k-'0'); + wda_setup (); +} + diff --git a/app/ned/06/ned0608.c b/app/ned/06/ned0608.c new file mode 100644 index 0000000000000000000000000000000000000000..b91790070ed30e532abe67b45fc6e7eecc73d402 --- /dev/null +++ b/app/ned/06/ned0608.c @@ -0,0 +1,29 @@ +/* + * FILE %ned/06/ned0608.c + * + * File- und Windowoperationen + * + * written: 1987 04 08 + * 1991 05 22: Revision + * latest update: 1995-09-26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern int akt_page; + +/* ------------------------------------------------------------------------ */ +void q_pushpage (struct WINDOWCTRL *w, int new_page) +{ + if (w == (struct WINDOWCTRL *) 0 || new_page < 0 || new_page > 7) return; + akt_page= w->page= new_page; + w_selpage (new_page); + w->w_upd |= 0x05; +} diff --git a/app/ned/06/ned0609.c b/app/ned/06/ned0609.c new file mode 100644 index 0000000000000000000000000000000000000000..58bcd9beefc77a863682ebfff7e0bf7f24eafcb3 --- /dev/null +++ b/app/ned/06/ned0609.c @@ -0,0 +1,41 @@ +/* + * FILE %ned/06/ned0609.c + * + * jump to the window at the given mouse coordinates + * + * written: 1987 04 08 + * 1991 05 22: Revision + * latest update: 1997-01-12 16:30:42 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern struct PLIST *winstack; + +/* ------------------------------------------------------------------------ */ +int maus_jmpwdw (int x, int y) +{ + register struct WINDOWCTRL *awc; /* Refresh Screen */ + register struct PLIST *pl; + + for (pl= winstack;; pl= pl->PL_lnk) + { + if (pl == (struct PLIST *) 0) return 0; + if ((awc= (struct WINDOWCTRL *) pl->PL_val) == (struct WINDOWCTRL *) 0) + continue; + if (x+1 >= awc->ax && x-1 <= awc->bx && + y+1 >= awc->ay && y-1 <= awc->by) break; + } + + q2_jmpwdw (awc); + q0_jmpwdw (awc); + + return 9999; +} diff --git a/app/ned/06/ned0610.c b/app/ned/06/ned0610.c new file mode 100644 index 0000000000000000000000000000000000000000..594324faa497df1cac4b7bde57e0d71456786f0e --- /dev/null +++ b/app/ned/06/ned0610.c @@ -0,0 +1,40 @@ +/* + * FILE %ned/06/ned0610.c + * + * open a window and prompt for the file name + * + * test read: file://localhost/autoexec.bat + * + * written: 1987 04 08 + * 1993-02-21: take history notes + * latest update: 1999-04-25 16:32:03 + * $Id: ned0610.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/filename.h> +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" + +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +int q_ofile (int flags) /* NED_OPENF_* */ +{ + char fnm [MAX_FNM_LENGTH]; + + if (oper_level >= LEV_FNM) return -1; + + fnm [0]= 0; + if (flags & NED_OPENF_CONTEXT) + q_isolate_word (fnm, MAX_FNM_LENGTH-1, CHARSET_filename, 1); + + return ned_open_file (fnm, (char *) 0, (char *) 0, flags); +} diff --git a/app/ned/06/ned0610a.c b/app/ned/06/ned0610a.c new file mode 100644 index 0000000000000000000000000000000000000000..3efc833ed013ae0c19b3648378ed7f1580137d36 --- /dev/null +++ b/app/ned/06/ned0610a.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/06/ned0610a.c + * + * open a window and prompt for the file name + * + * written: 1994-12-02 + * latest update: 1996-05-25 10:00:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_ofile1 () +{ + q_ofile (NED_OPENF_REDRAW | NED_OPENF_CONTEXT + | NED_OPENF_HISTORY | NED_OPENF_PROMPT); +} diff --git a/app/ned/06/ned0610b.c b/app/ned/06/ned0610b.c new file mode 100644 index 0000000000000000000000000000000000000000..f7a77ddf34bc54f4ec059350e4d094eb64daf5da --- /dev/null +++ b/app/ned/06/ned0610b.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/06/ned0610b.c + * + * open a window and prompt for the file name + * + * written: 1994-12-02 + * latest update: 1996-05-25 10:02:58 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_ofile2 () +{ + q_ofile (NED_OPENF_REDRAW | NED_OPENF_HISTORY | NED_OPENF_PROMPT); +} diff --git a/app/ned/06/ned0610c.c b/app/ned/06/ned0610c.c new file mode 100644 index 0000000000000000000000000000000000000000..8b95af5d64bcb9fcbe7d28adb0832d5760eefa20 --- /dev/null +++ b/app/ned/06/ned0610c.c @@ -0,0 +1,53 @@ +/* + * FILE %ned/06/ned0610c.c + * + * open a window for a give filename + * + * written: 1995-11-26: isolated from ned0610.c + * latest update: 2000-08-11 6:32:06 + * $Id: ned0610c.c,v 1.6 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern char *default_help_cluster; +extern char *default_help_open_file; + +/* ------------------------------------------------------------------------ */ +int ned_open_file ( +const char *fnm, +const char *help_cluster, +const char *help_frame, +int flags) /* NED_OPENF_* */ +{ + if (help_cluster == (char *) 0) help_cluster= default_help_cluster; + if (help_frame == (char *) 0) help_frame= default_help_open_file; + + if (flags & NED_OPENF_PROMPT) + { + struct NED_CB_OF *cb; + + if ((cb= (struct NED_CB_OF *) calloc (sizeof (struct NED_CB_OF), 1)) + != (struct NED_CB_OF *) 0) + { + cb->wc= aw; + cb->flags= flags; + + /* see * for a discussion about an alternative file open dialog */ + ned_prompt_string ("Filename: ", fnm, MAX_FNM_LENGTH, + help_cluster, help_frame, + ned_cb_open_file, (void *) cb); + } + return 0; + } + + return ned_open_file_2 (aw, fnm, flags); +} diff --git a/app/ned/06/ned0610d.c b/app/ned/06/ned0610d.c new file mode 100644 index 0000000000000000000000000000000000000000..64e4315f938571a26148c6e5a1e9acf867ffc3d0 --- /dev/null +++ b/app/ned/06/ned0610d.c @@ -0,0 +1,35 @@ +/* + * FILE %ned/06/ned0610d.c + * + * written: 1996-07-07 + * latest update: 1999-04-25 16:32:10 + * $Id: ned0610d.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_cb_open_file (char *str, void *cb_data) +{ + struct NED_CB_OF *cb; + + if ((cb= (struct NED_CB_OF *) cb_data) != (struct NED_CB_OF *) 0) + { + ned_open_file_2 (cb->wc, str, cb->flags); + + free (cb); + } + + return 0; +} diff --git a/app/ned/06/ned0610e.c b/app/ned/06/ned0610e.c new file mode 100644 index 0000000000000000000000000000000000000000..47c10c0bcf68b48d79f4e0988bd5b2949843f38c --- /dev/null +++ b/app/ned/06/ned0610e.c @@ -0,0 +1,86 @@ +/* + * FILE %ned/ned0610e.c + * + * open a window for a give filename + * + * written: 1996-07-14 extracted from ned0610c.c + * latest update: 2001-02-11 21:23:57 + * $Id: ned0610e.c,v 1.4 2001/02/12 00:03:31 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/filename.h> +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int default_edit_mode; +extern int default_bin_eoln; +extern int default_bin_llng; + +/* ------------------------------------------------------------------------ */ +int ned_open_file_2 ( +struct WINDOWCTRL *wc, +char *fnm, +int flags) /* NED_OPENF_* */ +{ + char *real_fnm= (char *) 0; + char *virtual_fnm= (char *) 0; + int rc= -1; + int wn; + struct stat st; + + if (*fnm == 0) return -1; + + if ((wn= find_file (fnm, + (flags & NED_OPENF_NO_REL_PATH) + ? (char *) 0 + : ned_get_file_path (wc), + &real_fnm, &virtual_fnm)) != -1) + { + q_jmpwdw (wn); + goto CNT; + } + + if (real_fnm != (char *) 0) + { + if ((flags & NED_OPENF_EXISTS) && stat (real_fnm, &st) != 0) goto RETURN; + /* T2D: setup or so, open only existing files! */ + fnm= real_fnm; + } + + /* window with loadable file does not exist, so create one and load file */ + q_jmpwdw (p_wdwopen ()); + q_fnm (fnm); + + if (flags & NED_OPENF_SGML) aw->file_format= FMT_SGML; + else if (flags & NED_OPENF_BINARY) + { + aw->file_format= FMT_BINARY; + aw->bin_eoln= default_bin_eoln; /* End-Of-Line Code */ + aw->bin_llng= default_bin_llng; /* Laenge von binaeren Zeilen */ + } + aw->WC_edit_mode= default_edit_mode; + if (flags & NED_OPENF_READ_ONLY) aw->WC_edit_mode; + s_fget (aw); + +CNT: + if (flags & NED_OPENF_REDRAW) ned_display_window (aw); + if (flags & NED_OPENF_HISTORY) take_history_notes (aw); + rc= 0; + +RETURN: + free_or_what (real_fnm); + free_or_what (virtual_fnm); + + return rc; +} diff --git a/app/ned/06/ned0611.c b/app/ned/06/ned0611.c new file mode 100644 index 0000000000000000000000000000000000000000..c993537dfa395f119579363aa98496d6c676e567 --- /dev/null +++ b/app/ned/06/ned0611.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/06/ned0611.c + * + * save a file and close the window *OBSOLETE* + * + * written: 1987 04 08 + * latest update: 1996-05-26 22:00:53 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_wdwsfile () +{ + if (oper_level >= LEV_FNM) return; + p_ssave (); + ned_close_window (); +} diff --git a/app/ned/06/ned0612.c b/app/ned/06/ned0612.c new file mode 100644 index 0000000000000000000000000000000000000000..90262ce421c30ec576033934b16c5deac130c827 --- /dev/null +++ b/app/ned/06/ned0612.c @@ -0,0 +1,28 @@ +/* + * FILE %ned/06/ned0612.c + * + * abort a file and close the window + * + * written: 1987 04 08 + * latest update: 2001-02-12 0:28:46 + * $Id: ned0612.c,v 1.2 2001/02/12 00:03:31 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_wdwqfile () +{ + if (oper_level >= LEV_FNM) return; + p_abandon (); + ned_close_window (); +} + diff --git a/app/ned/06/ned0613.c b/app/ned/06/ned0613.c new file mode 100644 index 0000000000000000000000000000000000000000..14024e478310ba34b9779fb214f8e179a6160ad0 --- /dev/null +++ b/app/ned/06/ned0613.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/06/ned0613.c + * + * File- und Windowoperationen + * + * written: 1987 04 08 + * 1991 05 23: Revision + * latest update: 1996-11-03 15:30:59 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" + +extern int COL_ASK; +extern int mess_lin; +extern int mess_ttl; + +/* ------------------------------------------------------------------------ */ +int rd_str (char *msg, char *str, int str_lng) /* lese einen String */ +/* RETURN: -1 ... Editieren abgebrochen */ +/* 0 ... alles OK */ +{ + int last_key; + + mess_ttl= 3; + + return ned_rd_str2 (msg, str, str_lng, mess_lin, COL_ASK, &last_key); +} diff --git a/app/ned/06/ned0613b.c b/app/ned/06/ned0613b.c new file mode 100644 index 0000000000000000000000000000000000000000..d757a7096cbd3bb08b2e23962bb56d4972730f37 --- /dev/null +++ b/app/ned/06/ned0613b.c @@ -0,0 +1,128 @@ +/* + * FILE %ned/06/ned0613b.c + * + * prompt a string + * + * written: 1996-07-07: [extracted from ned0613.c] + * latest update: 1997-06-17 10:56:32 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include <gg/window.h> +#include <gg/keys.h> +#include "proto.h" + +extern int pfx; /* Kommand Key Praefix */ +extern ned_input_handler *nextchar; /* Editor Eingabe: KBD | FILE .. */ + +/* ------------------------------------------------------------------------ */ +int ned_rd_str2 ( +const char *msg, +char *str, +int str_lng, +int msg_lin, +int col_ask, +int *last_key) +/* RETURN: -1 ... Editieren abgebrochen */ +/* 0 ... alles OK */ +{ + int i; + int m= 0; /* length of string sofar */ + int k= 0; /* key entered */ + int modified= 0; /* 1 -> buffer has been modified */ + int st; + int spfx; + + if (str == (char *) 0 || (i= strlen (str)) >= str_lng) return -1; + + w_setstring (0, 0, msg_lin, 79, msg_lin, col_ask, msg, 0x01); + st= strlen (msg); + + while (k != 0x0D) + { + w_setstring (0, st, msg_lin, 79, msg_lin, col_ask, str, 0x01); + w_setcup (0, st+i, msg_lin); + if (m < i) m= i; + + spfx= pfx; /* save and restore the command prefix code */ + pfx= 0; /* for editing modes like vi */ + k= (*nextchar) (); + if (pfx == P_FUNCT) k |= 0x0100; + pfx= spfx; + + switch (k) + { + case 0x04: /* Ctrl-D */ + case K_CRIGHT: + if (i < m) i++; + break; + case 0x08: + case 0x7F: + if (!i) break; + str [--i]= 0; + m= i; + modified= 1; + break; + case 0x07: + case K_DEL: + str [i]= 0; + m= i; + modified= 1; + break; + + case 0x0A: + case 0x0D: + *last_key= k; + k= 0x0D; + break; + + case 0x13: /* Ctrl-S */ + case K_CLEFT: + if (i) i--; + break; + + case 0x0123: /* ALT-H: request help */ + case 0x18: /* CTRL-X: request help */ + *last_key= 0x18; + return -1; + + case 0x1B: /* ESC: abort editing */ + case 0x03: /* CTRL-C: abort editing */ + i= m= 0; + str [0]= 0; + *last_key= k; + return -1; + + case 0x01: /* Ctrl-A */ + case K_HOME: + i= 0; + break; + case 0x06: /* Ctrl-F */ + case K_END: + i= m; + break; + + case 0x19: /* Ctrl-Y: clear line */ + i= m= 0; + str [0]= 0; + break; + + default: + if (k < 0 || k > 0x00FF) break; + if (i >= str_lng) break; + str [i++]= (char) k; + if (m < i) m= i; + str [m]= 0; + modified= 1; + break; + } + } + + return modified; +} diff --git a/app/ned/06/ned0614.c b/app/ned/06/ned0614.c new file mode 100644 index 0000000000000000000000000000000000000000..74708c38ef859946ecf343c0876aaf3537cc2e38 --- /dev/null +++ b/app/ned/06/ned0614.c @@ -0,0 +1,79 @@ +/* + * FILE %ned/06/ned0614.c + * + * assign a name to a window, either for the first time or rename it. + * + * written: 1987 04 08 + * 1990 04 01: function of p_fnm (renaming of a unnamed + * window) rolled in. Thus, the function p_fnm + * itself became obsolete and was removed. See + * also changes in the editor tables ned0001?.c. + * 1991 02 03: revision + * 1994-06-19: renamed to ned0614.c as q_rename + * latest update: 2000-09-01 18:01:36 + * $Id: ned0614.c,v 1.3 2000/09/01 19:20:26 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/filename.h> +#include <gg/strings.h> +#include "ed.h" +#include "message.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +int ned_rename_file (char *fnm, int max_fnm) +{ + int mode= 1; + struct FILECTRL *fc; + int fst; /* file status */ + int modified; + + if (oper_level >= LEV_FNM) return 0; + + if ((fc= (struct FILECTRL *) aw->file_or_frame) != (struct FILECTRL *) 0) + { + mode= 0; + strcpy_max (fnm, fc->FC_fnm_txt, max_fnm); + } + +ASK_AGAIN: + /* new filename: get name of file on cursor position */ + if ((modified= rd_str ((mode) ? "Filename: " : "New Name: ", fnm, max_fnm)) + == -1 + || (fst= editable_file (fnm)) == 0 + ) + return 0; + + if (modified + && fst == 2 + && get_confirmation ("File exists; replace? (Y|N)", 0) == 1 + ) goto ASK_AGAIN; + + if (mode) + { /* Filenamen fuer ein unbenanntes Window angeben */ + q_fnm (fnm); + } + else + { /* change a filename */ + aw->WC_title_short= FC_setup_filenames (fc, fnm, (char *) 0); +#ifdef USE_TK + ned_tk_set_window_name (aw, aw->WC_title_short); +#endif /* USE_TK */ + /* Damit werden alle Windows, die auf dieses File */ + /* angehaengt sind, automatisch umbenannt !!!!! */ + } + + aw->f_upd= 1; /* ??? 1996-05-27 19:28:38 */ + + return 1; +} diff --git a/app/ned/06/ned0615.c b/app/ned/06/ned0615.c new file mode 100644 index 0000000000000000000000000000000000000000..67bd759d996f2ae21d5db1a19fce6b6eee9c6095 --- /dev/null +++ b/app/ned/06/ned0615.c @@ -0,0 +1,64 @@ +/* + * FILE %ned/06/ned0615.c + * + * File- und Windowoperationen: + * Filename ueberpruefen und Datenstruktur anlegen + * + * written: 1987 04 08 + * 1990 04 01: Revision + * 1991 02 03: Revision + * latest update: 2000-12-09 13:33:47 + * $Id: ned0615.c,v 1.3 2000/12/09 17:33:50 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include "ed.h" +#include "message.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern struct FILECTRL *files; + +/* ------------------------------------------------------------------------ */ +int q_fnm (char *fnm) +{ + struct FILECTRL *f; + + if (fnm [0] == 0 + || aw == (struct WINDOWCTRL *) 0 + || !editable_file (fnm) + || (f= file_alloc ()) == (struct FILECTRL *) 0 + ) + { + ned_error_message (ERR_OPEN_FILE); + return -1; + } + + aw->WC_title_short= FC_setup_filenames (f, fnm, (char *) 0); + /*** printf ("0615: title='%s'\n", aw->WC_title_short); ***/ +#ifdef USE_TK + ned_tk_set_window_name (aw, aw->WC_title_short); +#endif /* USE_TK */ + + f->FC_links= 1; + f->FC_prev= f->FC_next= (struct FILECTRL *) 0; + if (files != (struct FILECTRL *) 0) + { + f->FC_next= files; + files->FC_prev= f; + } + files= f; + + aw->file_or_frame= f; + aw->file_type= FTY_PLAIN; + + return 0; +} diff --git a/app/ned/06/ned0616.c b/app/ned/06/ned0616.c new file mode 100644 index 0000000000000000000000000000000000000000..9e39881238305fedd4da2cd736759931545ff228 --- /dev/null +++ b/app/ned/06/ned0616.c @@ -0,0 +1,68 @@ +/* + * FILE %ned/06/ned0616.c + * + * assign a name to a window, either for the first time or rename it. + * + * written: 1987 04 08 + * 1990 04 01: function of p_fnm (renaming of a unnamed + * window) rolled in. Thus, the function p_fnm + * itself became obsolete and was removed. See + * also changes in the editor tables ned0001?.c. + * 1991 02 03: revision + * 1994-06-19: ned_rename_file () isolated from this module + * latest update: 1999-04-25 16:32:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/filename.h> +#include <gg/strings.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern char *ned_renamed_object; +extern char *default_help_cluster; +extern char *default_help_rename_frame; + +/* ------------------------------------------------------------------------ */ +int ned_rename_object () /* ^K N: rename file or frame */ +{ + int rc= 0; + struct FRAMECTRL *fc; + + if (ned_renamed_object == (char *) 0) + { + if ((ned_renamed_object= malloc (MAX_FNM_LENGTH)) == (char *) 0) + return -1; + + ned_renamed_object [0]= 0; + } + + switch (aw->file_type) + { + case FTY_HYPER: + fc= (struct FRAMECTRL *) aw->file_or_frame; + strcpy_max (ned_renamed_object, fc->frame_name, MAX_FNM_LENGTH); + + ned_prompt_string ("New Frame Name:", ned_renamed_object, + MAX_FNM_LENGTH, + default_help_cluster, + default_help_rename_frame, + ned_cb_rename_frame, (void *) aw); + + break; + + case FTY_PLAIN: + rc= ned_rename_file (ned_renamed_object, MAX_FNM_LENGTH); + break; + /* case FTY_FTRWDW: don't rename ... */ + } + + return rc; +} diff --git a/app/ned/06/ned0617.c b/app/ned/06/ned0617.c new file mode 100644 index 0000000000000000000000000000000000000000..6d6b92c73ecbdbd24af224d9d4f6d9216821b29b --- /dev/null +++ b/app/ned/06/ned0617.c @@ -0,0 +1,42 @@ +/* + * FILE ~/usr/ned/06/ned0617.c + * + * File- and Windowoperations + * >> reads in the password used for garbling option. + * + * >>>> NOT USED ANY LONGER <<<< + * + * written: 1987 04 08 + * 1991 02 03: Revision + * latest update: 1997-06-17 10:57:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "message.h" +#include "proto.h" + +extern int oper_level; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_garbling_code () /* ^K -: File Schluessel eingeben */ +{ + char fnm [32]; + int i; + + if (oper_level >= LEV_FNM) return; + if (aw->file_or_frame == (void *) 0) return; /* siehe oben */ + if (aw->file_type == FTY_HYPER) return; + fnm [0]=0; + if (rd_str ("New Code: ", fnm, 32) == -1) return; + + for (i = 0; i < 30; i++) + ((struct FILECTRL *) aw->file_or_frame)->garbling_code [i] = fnm [i]; + /* Damit werden alle Windows, die auf dieses File angehaengt sind */ + /* automatisch anders codiert !! */ +} diff --git a/app/ned/06/ned0618.c b/app/ned/06/ned0618.c new file mode 100644 index 0000000000000000000000000000000000000000..98e6c5435741eb68283ab74e06cea366b13090cf --- /dev/null +++ b/app/ned/06/ned0618.c @@ -0,0 +1,44 @@ +/* + * FILE %ned/06/ned0618.c + * + * File- und Windowoperationen + * + * written: 1987 04 08 + * latest update: 1996-01-06 11:26:33 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include <gg/window.h> + +#ifdef W_MODEL_CURSES +#ifdef W_MODEL_NCURSES +#include <ncurses.h> +#else +#include <curses.h> +#endif +#endif + +#include "proto.h" + +extern int W_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +void p_exit () +{ +#ifndef USE_TK + w_selpage (0); + w_setcup (0, 0, W_TEXT_MAX_Y-1); +/* _dos_setvect (0x10, old_BBREAK); */ + w_setchar (0, 0, W_TEXT_MAX_Y-1, WV_GELB, ' '); +#ifdef W_MODEL_CURSES + endwin(); +#endif /* W_MODEL_CURSES */ +#endif /* !USE_TK */ + exit (0); +} diff --git a/app/ned/06/ned0619.c b/app/ned/06/ned0619.c new file mode 100644 index 0000000000000000000000000000000000000000..ebd9f2d2da47c3c6ec248b3937f41a6ae1073473 --- /dev/null +++ b/app/ned/06/ned0619.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/06/ned0619.c + * + * File- und Windowoperationen + * + * written: 1987 04 08 + * latest update: 1995-11-12 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_ultra_panic () +{ + exit (0); +} diff --git a/app/ned/06/ned0620.c b/app/ned/06/ned0620.c new file mode 100644 index 0000000000000000000000000000000000000000..8f89160a69898c83514e842603c34b4c55a8c60f --- /dev/null +++ b/app/ned/06/ned0620.c @@ -0,0 +1,25 @@ +/* + * FILE ~/usr/ned/06/ned0620.c + * + * File- und Windowoperationen + * + * written: 1987 04 08 + * latest update: 1994-04-02 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +extern int COL_ASK; + +/* ------------------------------------------------------------------------ */ +void debug (char *s) +{ + w_setstring (0, 0, 1, 79, 24, COL_ASK, s, 0x01); +} diff --git a/app/ned/06/ned0621.c b/app/ned/06/ned0621.c new file mode 100644 index 0000000000000000000000000000000000000000..817d35819f6fee760e7c6c38721854d0f8965abe --- /dev/null +++ b/app/ned/06/ned0621.c @@ -0,0 +1,42 @@ +/* + * FILE %ned/06/ned0621.c + * + * File- und Windowoperationen + * + * written: 1987 04 08 + * 1991 06 01: Revision + * latest update: 1997-10-26 10:25:17 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +#ifdef UX_DEBUG +#include <stdio.h> +#endif + +extern int COL_ASK; +extern int mess_ttl; +extern int mess_lin; +extern ned_input_handler *nextchar; + +/* ------------------------------------------------------------------------ */ +int ned_error_message (char *s) +{ +#ifdef UX_DEBUG + printf ("%s\n", s); +#endif + + w_setstring (0, 0, mess_lin, 79, mess_lin, COL_ASK, s, 0x01); + (*nextchar) (); + + mess_ttl= 2; + + return 0; +} diff --git a/app/ned/06/ned0622.c b/app/ned/06/ned0622.c new file mode 100644 index 0000000000000000000000000000000000000000..76db2d7c12343456c46ca2fe5593715d6aa93c18 --- /dev/null +++ b/app/ned/06/ned0622.c @@ -0,0 +1,103 @@ +/* + * FILE %ned/06/ned0622.c + * + * File- und Windowoperationen + * + * written: 1987 04 08 + * 1991 06 01: Revision + * latest update: 1998-08-16 12:58:31 + * $Id: ned0622.c,v 1.3 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +#ifdef UX2_DEBUG +#include <stdio.h> +#endif + +extern int COL_ASK; +extern int mess_ttl; +extern int mess_lin; + +/* ------------------------------------------------------------------------ */ +int ned_message_1 (const char *p1) +{ + w_setstring (0, 0, mess_lin, 79, mess_lin, COL_ASK, p1, 0x03); + mess_ttl= 6; + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_message_2 (const char *p1, const char *p2) +{ + const char *s[2]; + s [0]= p1; + s [1]= p2; + + return ned_message_X (2, s); +} + +/* ------------------------------------------------------------------------ */ +int ned_message_3 (const char *p1, const char *p2, const char *p3) +{ + const char *s[3]; + s [0]= p1; + s [1]= p2; + s [2]= p3; + + return ned_message_X (3, s); +} + +/* ------------------------------------------------------------------------ */ +int ned_message_4 (const char *p1, const char *p2, const char *p3, +const char *p4) +{ + const char *s[4]; + s [0]= p1; + s [1]= p2; + s [2]= p3; + s [3]= p4; + + return ned_message_X (4, s); +} + +/* ------------------------------------------------------------------------ */ +int ned_message_X (int cnt, const char *s[]) +{ + int i; + int j= 0; + +#ifdef UX_DEBUG + int do_p= 1; + if (p1[0] == '<') do_p= 0; +#endif + + if (cnt <= 0) return 0; + + for (i= 0; i+1 < cnt; i++) + { + w_setstring (0, j, mess_lin, 79, mess_lin, COL_ASK, s [i], 0x00); +#ifdef UX_DEBUG + if (do_p) printf ("%s ", s [i]); +#endif + j += strlen (s [i]); + } + + w_setstring (0, j, mess_lin, 79, mess_lin, COL_ASK, s [i], 0x03); + +#ifdef UX_DEBUG + if (do_p) printf ("%s\n", s [i]); +#endif + + mess_ttl= 6; + + return 0; +} diff --git a/app/ned/06/ned0623.c b/app/ned/06/ned0623.c new file mode 100644 index 0000000000000000000000000000000000000000..2d603c5283d5df2190f055e901ed8de1db7c3f67 --- /dev/null +++ b/app/ned/06/ned0623.c @@ -0,0 +1,27 @@ +/* + * FILE ~/usr/ned/06/ned0623.c + * + * File- und Windowoperationen: + * Filename ueberpruefen und Datenstruktur anlegen + * + * *** currently not used *** + * + * written: 1991 03 10 + * latest update: 1994-08-13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void correct_pathname (char *s) +{ + if (s == (char *) 0) return; + for (; *s; s++) + if (*s == '\\') *s= '/'; +} diff --git a/app/ned/06/ned0624.c b/app/ned/06/ned0624.c new file mode 100644 index 0000000000000000000000000000000000000000..cc62a7484ecafa143e72069e9815119cb757dd20 --- /dev/null +++ b/app/ned/06/ned0624.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/06/ned0624.c + * + * written: 1991 07 01 + * latest update: 1997-01-12 17:31:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern int akt_page; + +int mess_ttl= 0; +int mess_lin= 1; + +static char blit_mess [160]; + +/* ------------------------------------------------------------------------ */ +void save_message_line (void) +{ + w_blit_save (blit_mess, akt_page, 0, mess_lin, 79, mess_lin); +} + +/* ------------------------------------------------------------------------ */ +void restore_message_line (void) +{ + w_blit_load (blit_mess, akt_page, 0, mess_lin, 79, mess_lin); +} diff --git a/app/ned/06/ned0625.c b/app/ned/06/ned0625.c new file mode 100644 index 0000000000000000000000000000000000000000..5875d385be746775e43f08c37f6555e4d2faede4 --- /dev/null +++ b/app/ned/06/ned0625.c @@ -0,0 +1,31 @@ +/* + * FILE %ned/06/ned0625.c + * + * File- und Windowoperationen + * + * written: 1991 09 03 + * latest update: 1996-09-29 18:22:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int act_window_num; + +/* ------------------------------------------------------------------------ */ +int q2_jmpwdw (struct WINDOWCTRL *w) /* Sprung ins Window */ +{ + if (get_window_number (w) == -1) + return -1; /* apparently not a valid window */ + + aw= w; + winstack_push (aw); + + return 0; +} diff --git a/app/ned/06/ned0626.c b/app/ned/06/ned0626.c new file mode 100644 index 0000000000000000000000000000000000000000..872c394dbbbd686c2540042e4fb74d2792fc8c15 --- /dev/null +++ b/app/ned/06/ned0626.c @@ -0,0 +1,38 @@ +/* + * FILE %ned/06/ned0626.c + * + * activate given window + * + * written: 1991 09 03 + * latest update: 1997-01-12 16:25:57 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern int akt_page; + +/* ------------------------------------------------------------------------ */ +void q0_jmpwdw (struct WINDOWCTRL *wc) +{ + if (wc == (struct WINDOWCTRL *) 0) return; + +#ifdef USE_TK + ned_tk_wc_window_action (wc, WC_action_deiconify); +#endif /* USE_TK */ + + if (akt_page != wc->page) w_selpage (akt_page= wc->page); + show_buttons (wc); + + /* if (wc->wflags & 0x01) */ /* Nur bei ueberlappenden Windows */ + { + wc->w_upd |= 0x05; + ned_display_window (wc); + } +} diff --git a/app/ned/06/ned0627.c b/app/ned/06/ned0627.c new file mode 100644 index 0000000000000000000000000000000000000000..c886252724234d4f1fe8e017c3f6e654c19df898 --- /dev/null +++ b/app/ned/06/ned0627.c @@ -0,0 +1,32 @@ +/* + * FILE %ned/06/ned0627.c + * + * open a file in a window + * - never used!! + * + * written: 1993-02-21 + * latest update: 1996-03-16 1:48:24 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int oper_level; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int open_file_and_window (char *filename) +{ + q_jmpwdw (p_wdwopen ()); + q_fnm (filename); + s_fget (aw); + ned_display_window (aw); + take_history_notes (aw); + + return 0; +} diff --git a/app/ned/06/ned0628.c b/app/ned/06/ned0628.c new file mode 100644 index 0000000000000000000000000000000000000000..25f1bcdd0d2cbd8a2de67c2525405741022d1dbc --- /dev/null +++ b/app/ned/06/ned0628.c @@ -0,0 +1,43 @@ +/* + * FILE %ned/06/ned0628.c + * + * take history notes about the file or frame in a window + * + * written: 1993-02-21 + * latest update: 1995-04-30 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int take_history_notes (struct WINDOWCTRL *w) +{ + struct FILECTRL *fc; + struct FRAMECTRL *frc; + struct CLUSTERCTRL *cl; + + if ((fc= (struct FILECTRL *) w->file_or_frame) == (struct FILECTRL *) 0) + return -1; + + if (w->file_type == FTY_HYPER) + { + frc= (struct FRAMECTRL *) w->file_or_frame; + if ((cl= frc->cluster) == (void *) 0) return -1; + ned_history (cl->cluster_name_hyx, frc->frame_name, + cl->cluster_name_logic, w->file_type, w->file_format); + } + else + { + ned_history (fc->FC_fnm_txt, (char *) 0, + w->WC_title_short, w->file_type, w->file_format); + } + + return 0; +} diff --git a/app/ned/06/ned0629.c b/app/ned/06/ned0629.c new file mode 100644 index 0000000000000000000000000000000000000000..ff378139c5a1313f914445fa998620e41e05add1 --- /dev/null +++ b/app/ned/06/ned0629.c @@ -0,0 +1,37 @@ +/* + * FILE %ned/06/ned0629.c + * + * renumber all windows and return number of the given window + * + * The window specified as the parameter can be (struct WINDOWCTRL *) 0, + * this will effectively renumber all windows + * + * written: 1994-05-23 + * latest update: 1996-07-26 3:32:12 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *windows; + +/* ------------------------------------------------------------------------ */ +int get_window_number (struct WINDOWCTRL *w) +{ + int num= 1; + int rv= -1; + struct WINDOWCTRL *wc; + + for (wc= windows; wc != (struct WINDOWCTRL *) 0; wc= wc->WC_next) + { + if (wc == w) rv= num; + wc->wc_window_number= num++; + } + + return rv; +} diff --git a/app/ned/06/ned0630.c b/app/ned/06/ned0630.c new file mode 100644 index 0000000000000000000000000000000000000000..91a65a27f4d6aa818f119ccb073cee2cf42ae82d --- /dev/null +++ b/app/ned/06/ned0630.c @@ -0,0 +1,52 @@ +/* + * FILE %ned/06/ned0630.c + * + * File- und Windowoperationen: + * setup the file name in the FILECTRL structure + * + * written: 1994-08-12 + * latest update: 1999-04-25 16:32:25 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include "ed.h" +#include "message.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +char *FC_setup_filenames ( +struct FILECTRL *fc, +char *specified, +char *ftr_name) +{ + char *real_fnm, *virtual_fnm, *short_title; + + if (fc == (struct FILECTRL *) 0 + || filename_definition (specified, &real_fnm, &virtual_fnm, (char *) 0) + != 0 + ) + return (char *) 0; + + fc->FC_fnm_txt= real_fnm; + fc->FC_fnm_ftr= (ftr_name == (char *) 0) + ? fnmcpy2 (real_fnm, ".ftr") + : strdup (ftr_name); + fc->FC_fnm_bak= fnmcpy2 (real_fnm, ".bak"); + + if (virtual_fnm == (char *) 0) + { + virtual_fnm= strdup (specified); + short_title= (char *) 0; + } + else short_title= virtual_fnm; + + return short_title; +} diff --git a/app/ned/06/ned0631.c b/app/ned/06/ned0631.c new file mode 100644 index 0000000000000000000000000000000000000000..73321e7bf8c21fc5862ac6f0d6dad20dcfc3bcd9 --- /dev/null +++ b/app/ned/06/ned0631.c @@ -0,0 +1,63 @@ +/* + * FILE %ned/06/ned0631.c + * + * prompt a string + * + * written: 1996-07-07: [extracted from ned0613.c] + * latest update: 1998-08-15 11:33:44 + * $Id: ned0631.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" + +#ifndef USE_TK +extern int COL_ASK; +extern int mess_lin; +extern int mess_ttl; +#endif /* !USE_TK */ + +/* ------------------------------------------------------------------------ */ +int ned_prompt_string ( +const char *msg, +char *str, +int str_lng, +const char *help_cluster, +const char *help_frame, +NED_field_editor_callback *cb, +void *client_data) +/* RETURN: -1 ... Editieren abgebrochen */ +/* 0 ... alles OK */ +{ +#ifdef USE_TK + ned_tk_prompt_string (msg, str, help_cluster, help_frame, cb, client_data); +#else + int rc; + int last_key; + + mess_ttl= 3; + +RETRY: + rc= ned_rd_str2 (msg, str, str_lng, mess_lin, COL_ASK, &last_key); + if (rc == -1) + { + if (last_key == 0x18) /* CTRL-X or ALT-H */ + { + ned_activate_special (help_cluster, help_frame, 0x00); + goto RETRY; + } + } + else + { + (*cb) (str, client_data); + } +#endif /* !USE_TK */ + + return 0; +} diff --git a/app/ned/07/(dirinf).fm b/app/ned/07/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..66c325e82bb79aa90580634819cf37236e3e2998 --- /dev/null +++ b/app/ned/07/(dirinf).fm @@ -0,0 +1,83 @@ +# +# FILE %ned/07/(dirinf).fm +# +# marker, blocks and buffers +# +# latest update: 2000-08-24 14:39:15 +# $Id: (dirinf).fm,v 1.2 2000/08/24 15:10:16 gonter Exp $ +# + +Makefile | current makefile +make-dos | MSDOS makefile + +ned0701.c | int p2_set_marker (b) +ned0702.c | void ned_set_marker_key () +ned0703.c | void ned_group_set_marker () +# +ned0705.c | ned_get_buffer (...) +ned0705.c | *** UNDER CONSTRUCTION *** +# *** +ned0711.c | int vi_yank () +ned0712.c | void ned_blk_mode () +ned0713.c | void ned_set_block_markers () +ned0714.c | void p_blkbeg () +ned0715.c | void p_blkend () +ned0716.c | void p_hideblk () +ned0717.c | int ned_reset_block_flags () +ned0718.c | void ned_blk_rst () +ned0719.c | int ned_blk_setflg () /* Setze Block-Markierungen in allen Zeilen */ +ned0719b.c | int ned_swap_markers (struct MARKER *m1, struct MARKER *m2) +ned0719c.c | int ned_copy_markers (struct MARKER *dst, struct MARKER *src) +ned0720.c | int ned_blk_invalid () /* 1 -> Marker inkonsistent oder unvollstaendig */ +ned0721.c | void ned_blk_screen () +ned0722.c | int ned_blk_orientation (p) +ned0723.c | int ned_drop_buffer2 (struct NED_BUFFER *bu) +ned0723a.c | int ned_drop_buffer (int name) +ned0723b.c | int ned_store_line_to_buffer (...) +ned0724.c | int ned_blk_isolate (...) +ned0724a.c | int ned_blk_isolate2 (...) +ned0725.c | void ned_blk_insert (where, start, stop) /* Block einfaedeln */ +ned0725b.c | void ned_blk_insert2 (where, sp, start, stop) /* Block einfaedeln */ +ned0725c.c | int ned_blk_insert3 (...) +ned0726.c | void ned_blk_duplicate (...); +ned0727.c | void ned_wc_blk_copy (...) +ned0727a.c | void ned_blk_copy () +ned0727b.c | void ned_blk_copy_before () +ned0727c.c | void ned_wc_buffer_copy (...) +ned0727d.c | void ned_buffer_copy () +ned0727e.c | void ned_buffer_copy_before () +ned0728.c | void ned_blk_move () +ned0729.c | void ned_blk_delete () +ned0730.c | void ned_blk_read () +ned0731a.c | void ned_blk_append () +ned0731p.c | void ned_blk_print () +ned0731w.c | void ned_blk_write () +ned0732.c | void q_wablk (int mode) /* write or append block to file */ +ned0733.c | void q_jmp_marker (m) +ned0734.c | void p_jmp_blkbeg () +ned0735.c | void p_jmp_blkend () +ned0736.c | void ned_jmp_marker_key () +ned0737.c | void ned_jmp_marker_1 () +ned0738.c | char *ned_block_2_string (...) +# *** +ned0746.c | int ned_reset_markers (struct WINDOWCTRL *w) +ned0747.c | int ned_blk_critical () +ned0747b.c | int ned_blk_realign_if_critical () +ned0748.c | int ned_change_markers (w_old, w_new) +ned0749.c | void ned_blk_iconify () +ned0750.c | int ned_blk_mark_all (struct WINDOWCTRL *w) +ned0751.c | struct LINE *ned_find_first_line (struct LINE *lc); +ned0752.c | struct LINE *ned_find_last_line (struct LINE *lc); +ned0753.c | int ned_paste_string (char *buffer) +ned0754a.c | int ned_paste_date () +ned0754b.c | int ned_paste_seconds () +ned0754c.c | int ned_paste_date_time () +ned0754d.c | int ned_paste_date_string () +ned0756.c | int ned_paste_file_name () +ned0758.c | int ned_paste_user () +ned0759.c | int ned_markup_block (struct WINDOWCTRL *w, ...) +ned0760.c | int ned_markup_block_2 (struct WINDOWCTRL *w, char *start_tag) +ned0761.c | int ned_markup_block_prompt (struct WINDOWCTRL *w, char *start_tag) +ned0762.c | *** under construction *** +ned0763.c | int ned_paste_renamed_object () +* | diff --git a/app/ned/07/Makefile b/app/ned/07/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..ad299007be6888fb42019e16e44d2c985c19a0ec --- /dev/null +++ b/app/ned/07/Makefile @@ -0,0 +1,52 @@ +# +# FILE %ned/07/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# +# latest update: 1999-05-06 16:27:55 +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-c -g -I.. $(cf) +CC=cc +objs=ned0701.o ned0702.o ned0703.o ned0705.o ned0711.o ned0712.o \ + ned0714.o ned0715.o ned0716.o \ + ned0717.o ned0718.o ned0719.o ned0719b.o ned0719c.o ned0720.o \ + ned0721.o ned0722.o ned0723.o ned0723a.o ned0723b.o \ + ned0724.o ned0724a.o \ + ned0725.o ned0725b.o ned0725c.o ned0726.o \ + ned0727.o ned0727a.o ned0727b.o ned0727c.o ned0727d.o ned0727e.o \ + ned0728.o ned0729.o ned0730.o ned0731a.o ned0731w.o ned0731p.o \ + ned0732.o ned0733.o ned0734.o ned0735.o \ + ned0736.o ned0737.o ned0738.o \ + ned0747.o ned0747b.o ned0749.o ned0750.o ned0751.o \ + ned0752.o ned0753.o ned0754a.o ned0754b.o ned0754c.o ned0754d.o \ + ned0756.o ned0758.o ned0759.o ned0760.o ned0761.o \ + ned0763.o +objs_cur= ned0713_cur.o +objs_tk= ned0713_tk.o +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_tk lib_cur +clean : + rm -f *.o lib_cur lib_tk + +lib_tk : $(objs_tk) $(objs) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h ../edhyx.h + $(CC) $(OPTS) -c $*.c + +# --- cur Modules ---------- +ned0713_cur.o : ../ed.h ned0713.c + $(CC) $(OPTS) -o ned0713_cur.o ned0713.c + +# --- tk Modules ---------- +ned0713_tk.o : ../ed.h ned0713.c + $(CC) $(OPTS) -DUSE_TK -o ned0713_tk.o ned0713.c diff --git a/app/ned/07/contrib b/app/ned/07/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/07/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/07/gg b/app/ned/07/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/07/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/07/lib_cur b/app/ned/07/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/07/lib_tk b/app/ned/07/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/07/make-dos b/app/ned/07/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..76b2effc471524d466c16347ad3dfb81d78e4616 --- /dev/null +++ b/app/ned/07/make-dos @@ -0,0 +1,37 @@ +# +# FILE %ned/07/makefile +# +# GG's Night(mare) Editor System +# +# latest update: 1997-12-05 1:34:33 +# +# ============================================================================ +cc=cl -Os -AL /W3 /c +ccc=cl -Os -AL /Fo$@ /W3 -I.. /c +obj=objdec -m0 -w -d -sl 2 NED07_TEXT $@ + +lib : lib.1 lib.2 +lib.1 : ! + ned0701.obj ned0702.obj ned0703.obj ned0705.obj ned0711.obj ned0712.obj ! + ned0713.obj ned0714.obj ned0715.obj ned0716.obj ! + ned0717.obj ned0718.obj ned0719.obj ned0719b.obj ! + ned0719c.obj ned0720.obj ned0721.obj ned0722.obj ! + ned0723.obj ned0723a.obj ned0723b.obj ned0724.obj ned0724a.obj ! + ned0725.obj ned0725b.obj ned0725c.obj ned0726.obj ! + ned0727.obj ned0727a.obj ned0727b.obj ! + ned0727c.obj ned0727d.obj ned0727e.obj ! + ned0728.obj ned0729.obj + +lib.2 : ! + ned0730.obj ned0731a.obj ned0731w.obj ned0731p.obj ! + ned0732.obj ned0733.obj ned0734.obj ned0735.obj ! + ned0736.obj ned0737.obj ned0738.obj ned0747.obj ned0747b.obj ! + ned0749.obj ned0750.obj ned0751.obj ned0752.obj ned0753.obj ! + ned0754a.obj ned0754b.obj ned0754c.obj ned0754d.obj ! + ned0756.obj ned0758.obj ned0759.obj ! + ned0760.obj ned0761.obj ned0763.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $*.c + $(obj) diff --git a/app/ned/07/ned0701.c b/app/ned/07/ned0701.c new file mode 100644 index 0000000000000000000000000000000000000000..7b85d0a2df5990095927ad2958bd808a1c2f7252 --- /dev/null +++ b/app/ned/07/ned0701.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/07/ned0701.c + * + * set a marker at the given cursor position + * + * written: 1987 04 08 + * 1991 02 03: Revision + * latest update: 1997-09-07 9:30:49 + * $Id: ned0701.c,v 1.2 2003/10/02 06:45:51 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_set_marker2 ( +struct WINDOWCTRL *wc, /* T2D: NULL is valid ?? */ +struct LINE *lp, /* T2D: NULL is valid ?? */ +int offset, +struct MARKER *b) /* T2D: NULL is valid ?? */ +{ + if (b->ptr != (struct LINE *) 0) ned_marker_rel_cb (b->ptr, b); + + ned_marker_reg_cb (b->ptr= lp, b); + b->offset= offset; + b->wptr= wc; + + return 0; +} diff --git a/app/ned/07/ned0702.c b/app/ned/07/ned0702.c new file mode 100644 index 0000000000000000000000000000000000000000..7ca8a39560d08422e36114cfc68c0cf2493ff1b9 --- /dev/null +++ b/app/ned/07/ned0702.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/07/ned0702.c + * + * set a marker + * + * written: 1996-10-03 + * latest update: 1997-06-28 22:35:24 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int key; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_set_marker_key () +{ + ned_set_marker (aw, key); +} diff --git a/app/ned/07/ned0703.c b/app/ned/07/ned0703.c new file mode 100644 index 0000000000000000000000000000000000000000..831c79b48d24bf060c898c3948f2298cd0f75e80 --- /dev/null +++ b/app/ned/07/ned0703.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/07/ned0703.c + * + * set a marker at two opposing brackets + * + * written: 1996-12-29 + * latest update: 1997-08-28 11:28:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_group_set_marker () +{ + ned_set_marker (aw, '('); + ned_find_bracket (1); + ned_cursor_right (); + ned_set_marker (aw, '}'); +} diff --git a/app/ned/07/ned0705.c b/app/ned/07/ned0705.c new file mode 100644 index 0000000000000000000000000000000000000000..e494d09093ee72360736291f14b94e6c1fb3a276 --- /dev/null +++ b/app/ned/07/ned0705.c @@ -0,0 +1,43 @@ +/* + * FILE %ned/07/ned0705.c + * + * return pointer to buffer control structure + * + * written: 1997-03-31 + * latest update: 1999-12-19 15:16:19 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +#define NUM_NED_BUFFER 128 +static struct NED_BUFFER **buffer_list= (struct NED_BUFFER **) 0; + +/* ------------------------------------------------------------------------ */ +struct NED_BUFFER *ned_get_buffer (int buffer_id, int alloc) +/* heavily based on ned_get_marker (...) */ +{ + if (buffer_id <= 0x00 || buffer_id >= NUM_NED_BUFFER) buffer_id= 0; + if (buffer_id == 0x00) alloc= 1; + + if (buffer_list == (struct NED_BUFFER **) 0 && alloc) + buffer_list= calloc (sizeof (struct NED_BUFFER *), NUM_NED_BUFFER); + + if (buffer_list != (struct NED_BUFFER **) 0) + { + struct NED_BUFFER *bu; + + if ((bu= buffer_list [buffer_id]) == (struct NED_BUFFER *) 0 && alloc) + bu= buffer_list [buffer_id]= calloc (sizeof (struct NED_BUFFER), 1); + + return bu; + } + + return (struct NED_BUFFER *) 0; +} diff --git a/app/ned/07/ned0711.c b/app/ned/07/ned0711.c new file mode 100644 index 0000000000000000000000000000000000000000..106a9244dbc6e1ca2e5b34baf361bf3f54546ae6 --- /dev/null +++ b/app/ned/07/ned0711.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/07/ned0711.c + * + * set the block begin marker + * + * written: 1997-01-06 + * latest update: 1997-01-06 19:16:23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int block_mode; + +/* ------------------------------------------------------------------------ */ +void vi_yank () +{ + block_mode= BLOCK_MODE_line; + p_blkbeg (); + p_blkend (); +} diff --git a/app/ned/07/ned0712.c b/app/ned/07/ned0712.c new file mode 100644 index 0000000000000000000000000000000000000000..5778b12c347ce276e4e0deb9721d4d1f7b8ccebf --- /dev/null +++ b/app/ned/07/ned0712.c @@ -0,0 +1,29 @@ +/* + * FILE %ned/07/ned0712.c + * + * Operationen mit Blocks und Markern + * + * written: 1987 04 08 + * 1991 05 16: Revision + * latest update: 1997-10-26 10:51:02 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int block_mode; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_blk_mode () +{ + block_mode--; + if (block_mode < BLOCK_MODE_standard) block_mode= BLOCK_MODE_box; + ned_display_window (aw); + back2ground (); +} diff --git a/app/ned/07/ned0713.c b/app/ned/07/ned0713.c new file mode 100644 index 0000000000000000000000000000000000000000..5e0f8cba256054201b97283531868beff9226330 --- /dev/null +++ b/app/ned/07/ned0713.c @@ -0,0 +1,50 @@ +/* + * FILE %ned/07/ned0713.c + * + * set block begin and end markers + * + * written: 1987 04 08 + * latest update: 1997-09-28 10:31:25 + * $Id: ned0713.c,v 1.2 2003/10/02 06:45:51 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct MARKER b_first, b_last; +extern int blk; +extern int block_mode; + +/* ------------------------------------------------------------------------ */ +void ned_set_block_markers ( +struct WINDOWCTRL *wc, +struct LINE *lp, +int offset, +int what, /* 0: first marker, 1: last marker */ +int mode) /* unless 0, change block mode */ +{ + if (mode != 0) block_mode= mode; + + if (what == 0) + { + ned_reset_block_flags (b_first.wptr); /* T2D: BUG HERE */ + ned_set_marker2 (wc, lp, offset, &b_first); + } + + if (what == 0 || what == 1) ned_set_marker2 (wc, lp, offset, &b_last); + + ned_set_block_flags (); + blk= 1; + ned_display_window (wc); + + ned_fresh_buffer (); /* make sure buffer is emptied */ + +#ifdef USE_TK + ned_tk_block_export_flag (1); +#endif +} diff --git a/app/ned/07/ned0714.c b/app/ned/07/ned0714.c new file mode 100644 index 0000000000000000000000000000000000000000..9761b52bc3cb85c7c23427f211fce7b656d2573f --- /dev/null +++ b/app/ned/07/ned0714.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/07/ned0714.c + * + * set the block begin marker + * + * written: 1987 04 08 + * 1991 05 16: Revision + * latest update: 1997-06-29 12:41:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_blkbeg () +{ + ned_set_marker (aw, '('); +} diff --git a/app/ned/07/ned0715.c b/app/ned/07/ned0715.c new file mode 100644 index 0000000000000000000000000000000000000000..4813bdfb5bcfe020d04a6fd2e9fb59fd0ebb74f7 --- /dev/null +++ b/app/ned/07/ned0715.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/07/ned0715.c + * + * set the block end marker + * + * written: 1987 04 08 + * latest update: 1997-06-29 12:41:53 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_blkend () +{ + ned_set_marker (aw, ')'); +} diff --git a/app/ned/07/ned0716.c b/app/ned/07/ned0716.c new file mode 100644 index 0000000000000000000000000000000000000000..ea86fa595e831d40e61fa4bc0798f3e355b122f9 --- /dev/null +++ b/app/ned/07/ned0716.c @@ -0,0 +1,28 @@ +/* + * FILE %ned/07/ned0716.c + * + * Operationen mit Blocks und Markern + * + * written: 1987 04 08 + * 1991 05 16: Revision + * latest update: 1997-10-26 10:50:55 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int oper_level, blk; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_hideblk () +{ + if (oper_level >= LEV_BLK) return; + blk= !blk; + ned_display_window (aw); +} diff --git a/app/ned/07/ned0717.c b/app/ned/07/ned0717.c new file mode 100644 index 0000000000000000000000000000000000000000..84508b5694bd9ed7661913cb73a9ccce1f28a38c --- /dev/null +++ b/app/ned/07/ned0717.c @@ -0,0 +1,32 @@ +/* + * FILE %ned/07/ned0717.c + * + * loesche die Block-Markierungen aus den Zeilen + * + * written: 1987 04 08 + * latest update: 1997-09-28 10:24:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_reset_block_flags (struct WINDOWCTRL *w) +{ + register struct LINE *p; + + if (w == (struct WINDOWCTRL *) 0 + || (p= ned_find_first_line (w->WC_first)) == (struct LINE *) 0 + ) + return -1; + + for (; p != (struct LINE *) 0; p= p->next) + p->line_flg &= LINE_BLOCK_CLR; + + return 1; +} diff --git a/app/ned/07/ned0718.c b/app/ned/07/ned0718.c new file mode 100644 index 0000000000000000000000000000000000000000..8e2d26e563c340c1b78b8dd573df755cc93eb122 --- /dev/null +++ b/app/ned/07/ned0718.c @@ -0,0 +1,39 @@ +/* + * FILE %ned/07/ned0718.c + * + * Operationen mit Blocks und Markern + * + * T2D: retrieve b_beg, b_end using marker functions + * + * written: 1987 04 08 + * 1991 04 16: Revision + * latest update: 1997-09-28 10:36:52 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct MARKER b_beg, b_end; +extern struct MARKER b_first, b_last; +extern int block_mode, blk; + +/* ------------------------------------------------------------------------ */ +void ned_blk_rst () +{ + ned_reset_block_flags (b_beg.wptr); + + b_beg.wptr= b_end.wptr= (struct WINDOWCTRL *) 0; + b_beg.ptr= b_end.ptr= (struct LINE *) 0; + b_beg.offset= b_end.offset= 0; + + b_first.wptr= b_last.wptr= (struct WINDOWCTRL *) 0; + b_first.ptr= b_last.ptr= (struct LINE *) 0; + b_first.offset= b_last.offset= 0; + + blk= 0; +} diff --git a/app/ned/07/ned0719.c b/app/ned/07/ned0719.c new file mode 100644 index 0000000000000000000000000000000000000000..0dae030e5a7ffa6a4ac3da3c5eaa261602dc43a5 --- /dev/null +++ b/app/ned/07/ned0719.c @@ -0,0 +1,79 @@ +/* + * FILE %ned/07/ned0719.c + * + * set block flags in the current window + * + * written: 1987 04 08 + * latest update: 1997-09-28 10:35:18 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int blk; +extern struct MARKER b_beg, b_end; +extern struct MARKER b_first, b_last; +extern int block_mode; + +/* ------------------------------------------------------------------------ */ +int ned_set_block_flags () +{ + register struct LINE *p; /* pointer for current line */ + struct LINE *p_first, *p_last; + int state= 0; /* 0 before first marker */ + /* 1 in block */ + /* 2 behind the second marker */ + + if (b_first.wptr == (struct WINDOWCTRL *) 0 + || b_first.wptr != b_last.wptr + || (p_first= b_first.ptr) == (struct LINE *) 0 + || (p_last= b_last.ptr) == (struct LINE *) 0 + || (p= ned_find_first_line (p_first)) == (struct LINE *) 0 + ) return 0; + + blk= 1; + + for (; p != (struct LINE *) 0; p= p->next) + { + if (p == p_first || p == p_last) + { + p->line_flg |= LINE_BLOCK_INBLOCK | LINE_BLOCK_BEGEND; + + if (p == p_first && p == p_last) + { /* one line block */ + state= 2; + ned_copy_markers (&b_beg, + (b_first.offset <= b_last.offset) ? &b_first : &b_last); + ned_copy_markers (&b_end, + (b_first.offset >= b_last.offset) ? &b_first : &b_last); + } + else + { /* one marker of a multiline block */ + if (state == 0) + { + ned_copy_markers (&b_beg, (p == p_first) ? &b_first : &b_last); + state= 1; + } + else + { + ned_copy_markers (&b_end, (p == p_first) ? &b_first : &b_last); + state= 2; + } + } + } + else + { + if (state == 1) + p->line_flg |= LINE_BLOCK_INBLOCK; + else + p->line_flg &= LINE_BLOCK_CLR; + } + } + + return 1; +} diff --git a/app/ned/07/ned0719b.c b/app/ned/07/ned0719b.c new file mode 100644 index 0000000000000000000000000000000000000000..5bc8d276d65c49c9c31270ea43c41709d8a7ea2b --- /dev/null +++ b/app/ned/07/ned0719b.c @@ -0,0 +1,31 @@ +/* + * FILE %ned/07/ned0719b.c + * + * swap two markers + * T2D: does not handle line callbacks + * + * written: 1996-01-01 + * latest update: 1997-09-07 9:41:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_swap_markers (struct MARKER *m1, struct MARKER *m2) +{ + struct MARKER tmp; + + if (m1 == (struct MARKER *) 0 || m2 == (struct MARKER *) 0) return -1; + + tmp.wptr= m1->wptr; tmp.ptr= m1->ptr; tmp.offset= m1->offset; + m1->wptr= m2->wptr; m1->ptr= m2->ptr; m1->offset= m2->offset; + m2->wptr= tmp.wptr; m2->ptr= tmp.ptr; m2->offset= tmp.offset; + + return 0; +} diff --git a/app/ned/07/ned0719c.c b/app/ned/07/ned0719c.c new file mode 100644 index 0000000000000000000000000000000000000000..f50a53469d1241f629932dbaa29a224bb5b1f02c --- /dev/null +++ b/app/ned/07/ned0719c.c @@ -0,0 +1,32 @@ +/* + * FILE %ned/07/ned0719c.c + * + * swap two markers + * + * written: 1996-01-01 + * latest update: 1997-09-01 18:52:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_copy_markers (struct MARKER *dst, struct MARKER *src) +{ + if (dst == (struct MARKER *) 0 || src == (struct MARKER *) 0) return -1; + + ned_marker_rel_cb (dst->ptr, dst); + + dst->wptr= src->wptr; + dst->ptr= src->ptr; + dst->offset= src->offset; + + ned_marker_reg_cb (dst->ptr, dst); + + return 0; +} diff --git a/app/ned/07/ned0720.c b/app/ned/07/ned0720.c new file mode 100644 index 0000000000000000000000000000000000000000..cf71ebc4c54c49f0e064c40cf6e3e5f6ba9cd7b6 --- /dev/null +++ b/app/ned/07/ned0720.c @@ -0,0 +1,36 @@ +/* + * FILE %ned/07/ned0720.c + * + * Operationen mit Blocks und Markern + * + * written: 1987 04 08 + * 1991 04 16: Revision + * latest update: 1996-05-27 18:06:32 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int blk; +extern struct MARKER b_beg, b_end; + +/* ------------------------------------------------------------------------ */ +int ned_blk_invalid () /* 1 -> Block Marker inkonsistent oder unvollstaendig*/ +{ + if (!blk /* block not visible?? */ + || b_beg.wptr == (struct WINDOWCTRL *) 0 + || b_end.wptr == (struct WINDOWCTRL *) 0 + || b_beg.wptr != b_end.wptr + || b_beg.ptr == (struct LINE *) 0 + || b_end.ptr == (struct LINE *) 0 + || (b_beg.ptr->line_flg & LINE_inBLOCK) == 0 + || (b_end.ptr->line_flg & LINE_inBLOCK) == 0 + ) return 1; + + return 0; +} diff --git a/app/ned/07/ned0721.c b/app/ned/07/ned0721.c new file mode 100644 index 0000000000000000000000000000000000000000..87ec7c234bf88e1f1fe2d0ab5be7a19f40383742 --- /dev/null +++ b/app/ned/07/ned0721.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/07/ned0721.c + * + * Operationen mit Blocks und Markern + * + * written: 1987 04 08 + * latest update: 1996-05-26 9:35:14 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int blk; + +/* ------------------------------------------------------------------------ */ +void ned_blk_screen () +{ + blk= 1; + ned_display_window (aw); +} diff --git a/app/ned/07/ned0722.c b/app/ned/07/ned0722.c new file mode 100644 index 0000000000000000000000000000000000000000..a8bc581086e9ecfd434ccb237c2db75783525187 --- /dev/null +++ b/app/ned/07/ned0722.c @@ -0,0 +1,42 @@ +/* + * FILE %ned/07/ned0722.c + * + * Operationen mit Blocks und Markern + * + * written: 1987 04 08 + * latest update: 1996-05-27 13:56:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct MARKER b_beg, b_end; + +/* ------------------------------------------------------------------------ */ +int ned_blk_orientation (struct LINE *p) +{ + register struct LINE *pp; + int pos= 0; /* Bit 0: BEGIN nach p */ + /* 1: BEGIN vor p */ + /* 2: END nach p */ + /* 3: END vor p */ + + for (pp= p; pp != (struct LINE *) 0; pp= pp->next) + { + if (pp == b_beg.ptr) pos |= 0x01; + if (pp == b_end.ptr) pos |= 0x04; + } + + for (pp= p; pp != (struct LINE *) 0; pp= pp->prev) + { + if (pp == b_beg.ptr) pos |= 0x02; + if (pp == b_end.ptr) pos |= 0x08; + } + + return pos; +} diff --git a/app/ned/07/ned0723.c b/app/ned/07/ned0723.c new file mode 100644 index 0000000000000000000000000000000000000000..71a066a1a9560dbe96431a0813e73d86ff9deff0 --- /dev/null +++ b/app/ned/07/ned0723.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/07/ned0723.c + * + * Operationen mit Blocks und Markern + * + * written: 1996-05-27 + * latest update: 1997-07-27 12:07:00 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_drop_buffer2 (struct NED_BUFFER *bu) +{ + if (bu->l_beg != (struct LINE *) 0) ned_lines_free (bu->l_beg); + + bu->l_beg= bu->l_end= (struct LINE *) 0; + + return 0; +} diff --git a/app/ned/07/ned0723a.c b/app/ned/07/ned0723a.c new file mode 100644 index 0000000000000000000000000000000000000000..6b09df414e500f220a0427ee214be8ff3fb3aa8f --- /dev/null +++ b/app/ned/07/ned0723a.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/07/ned0723a.c + * + * Operationen mit Blocks und Markern + * + * written: 1997-03-31 + * latest update: 1997-03-31 12:31:59 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_drop_buffer (int name) +{ + return ned_drop_buffer2 (ned_get_buffer (name, 0)); +} diff --git a/app/ned/07/ned0723b.c b/app/ned/07/ned0723b.c new file mode 100644 index 0000000000000000000000000000000000000000..6e16464ccc31da072e9734d67e6972aca9f0cc50 --- /dev/null +++ b/app/ned/07/ned0723b.c @@ -0,0 +1,67 @@ +/* + * FILE %ned/07/ned0723b.c + * + * Operationen mit Blocks und Markern + * + * written: 1996-05-27 + * latest update: 1997-08-28 18:31:13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int block_mode; +extern int blk; +static int fresh_buffer= 1; + +/* ------------------------------------------------------------------------ */ +int ned_store_line_to_buffer ( +int buffer_id, +struct LINE *lp_b, +struct LINE *lp_e, +int add_mode) +{ + struct NED_BUFFER *bu; + + ned_line_trigger_delete (lp_b, 1, 1); + +/*** DEBUGGING T2D: sollte nichts mehr ausspucken! ***/ + ned_check_for_markers (lp_b, 1); +/*** DEBUGGING T2D ***/ + + bu= ned_get_buffer (buffer_id, 1); + + if (add_mode == 0 || fresh_buffer) + { + ned_drop_buffer2 (bu); +EMPTY: + bu->l_beg= lp_b; + bu->l_end= lp_e; + fresh_buffer= 0; + } + else + { /* T2D: add a line to buffer */ + struct LINE *lb_e; + + if ((lb_e= bu->l_end) == (struct LINE *) 0 + || lp_b == (struct LINE *) 0 + ) goto EMPTY; + + lb_e->next= lp_b; + lp_b->prev= lb_e; + bu->l_end= lp_e; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_fresh_buffer () +{ + return fresh_buffer= 1; +} diff --git a/app/ned/07/ned0724.c b/app/ned/07/ned0724.c new file mode 100644 index 0000000000000000000000000000000000000000..8efa780c7b493763431399433aed5e005e81993e --- /dev/null +++ b/app/ned/07/ned0724.c @@ -0,0 +1,94 @@ +/* + * FILE %ned/07/ned0724.c + * + * isolate a marked block + * + * After calling this function, the block will not be in the + * original window any longer. + * + * Realigns WC_act of all windows, if this is in the block and realigning + * is not prohibited. Realigning must not take place e.g. when blocks + * are moved, this wouldn't make sense but could cause strange + * effects if it's tried... + * + * written: 1987 04 08 + * latest update: 1997-09-07 9:34:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_blk_isolate ( +struct LINE *s_start, +struct LINE *s_stop, +struct LINE **d_start, +struct LINE **d_stop, +int sp1, +int sp2, +int copy_mode) +{ + struct LINE *a; /* last line before the block */ + struct LINE *b; /* first line after the block */ + int start_is_stop; /* 1 -> block begin and end in same line */ + + if (s_start == (struct LINE *) 0 + || s_stop == (struct LINE *) 0 + /****** || ned_blk_critical () 1996-05-27 14:09:29 */ + /****** T2D: realign other windows if necessary! */ + ) return 0; + + start_is_stop= (s_start == s_stop); + + /* extract the block from the window and get line list back again */ + switch (copy_mode) + { + default: + case BLOCK_MODE_standard: + a= s_start; + /* note: first split at end marker since both markers */ + /* can be in the same line and offsets would */ + /* have to be re-calculated. */ + if (ned_split2 (s_stop, &b, sp2, 0) < 0 + || ned_split2 (a, &s_start, sp1, 0) < 0 + ) return 0; + + /* adjust offsets and also begin marker */ + *d_stop= (start_is_stop) ? s_start : s_stop; + *d_start= s_start; + + s_start->prev= s_stop->next= (struct LINE *) 0; + + if (a != (struct LINE *) 0) a->next= b; + if (b != (struct LINE *) 0) b->prev= a; + ned_join2 (a, b); + break; + + case BLOCK_MODE_line: + case BLOCK_MODE_box: + a= s_start->prev; + b= s_stop->next; + s_start->prev= s_stop->next= (struct LINE *) 0; + if (a != (struct LINE *) 0) a->next= b; + if (b != (struct LINE *) 0) b->prev= a; + *d_start= s_start; + *d_stop= s_stop; + break; + } + +#ifdef __ + if (block_orientation == 0x06) + { /* cursor is in the block, re-align active line ! */ + wc->WC_act= a; + ned_w_jmp_aktline (wc, NEDJMP_LINE_3, 0, NEDJMP_FLAG_REDRAW); + } +#endif + ned_blk_realign_if_critical (a); + + return 1; +} diff --git a/app/ned/07/ned0724a.c b/app/ned/07/ned0724a.c new file mode 100644 index 0000000000000000000000000000000000000000..2f83777bb78a94cd7ac8247bec532cd587eb25d4 --- /dev/null +++ b/app/ned/07/ned0724a.c @@ -0,0 +1,80 @@ +/* + * FILE %ned/07/ned0724a.c + * + * isolate a marked block + * + * After calling this function, the block will not be part of the + * original window any longer. + * + * Realigns WC_act of all windows, if this is in the block and realigning + * is not prohibited. Realigning must not take place e.g. when blocks + * are moved, this wouldn't make sense but could cause strange + * effects if it's tried... + * + * written: 1987 04 08 + * latest update: 1999-05-01 19:33:41 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int block_mode; + +/* ------------------------------------------------------------------------ */ +int ned_blk_isolate2 ( +struct MARKER *m1, +struct MARKER *m2, +int no_realign) /* realigning WC_act is prohibithed!! */ +{ + struct WINDOWCTRL *wc; /* window where block is located */ + struct LINE *p1, *p2; /* isolated lines */ + int block_orientation; /* block-to-cursor orientation codes */ + int rc; + + if (m1 == (struct MARKER *) 0 + || (wc= m1->wptr) == (struct WINDOWCTRL *) 0 + || m2 == (struct MARKER *) 0 + || m2->wptr == (struct WINDOWCTRL *) 0 + ) return 0; + + /* NOTE: 1997-06-11 14:58:20 */ + /* wc should be window pointer from one of the markers, right? */ + wc->f_upd= 1; + + switch (block_orientation= ned_blk_orientation (wc->WC_act)) + { + case 0x06: /* Cursor Position mitten im Block */ + if (no_realign) return 0; + /* otherwise proceed */ + + case 0x00: /* Block in anderem Window */ + case 0x05: /* Cursor Position vor Block */ + case 0x0A: /* Cursor Position nach Block */ + + ned_marker_rel_cb (m1->ptr, m1); + ned_marker_rel_cb (m2->ptr, m2); + rc= ned_blk_isolate (m1->ptr, m2->ptr, &p1, &p2, + m1->offset, m2->offset, block_mode); + m1->ptr= p1; + m2->ptr= p2; + m1->offset= 0; + return rc; + + case 0x09: /* Beginn und Ende vertauscht */ + case 0x01: case 0x02: /* kein Block-Ende angegeben */ + case 0x04: case 0x08: /* kein Block-Beginn angegeben */ + case 0x03: case 0x07: + case 0x0B: case 0x0C: + case 0x0D: case 0x0E: + case 0x0F: /* Kombination nicht moeglich !!! */ + default: /* ungueltige Kombination */ + return 0; + } + + return 0; +} diff --git a/app/ned/07/ned0725.c b/app/ned/07/ned0725.c new file mode 100644 index 0000000000000000000000000000000000000000..64072503c6818ba94baa293df1551d26fcf51c2b --- /dev/null +++ b/app/ned/07/ned0725.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/07/ned0725.c + * + * insert a block in line mode + * + * written: 1987 04 08 + * latest update: 1997-06-29 14:05:28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_blk_insert ( /* Block einfaedeln */ +struct LINE *wh, /* Einfuegeposition in Zeilenliste */ +struct LINE *start, /* Begin des einzufuegenden Blocks */ +struct LINE *stop) /* Ende des einzufuegenden Blocks */ +{ + if (wh == (struct LINE *) 0 + || start == (struct LINE *) 0 + || stop == (struct LINE *) 0 + ) return -1; + + start->prev= wh; + if ((stop->next= wh->next) != (struct LINE *) 0) wh->next->prev= stop; + wh->next= start; + + return 0; +} diff --git a/app/ned/07/ned0725b.c b/app/ned/07/ned0725b.c new file mode 100644 index 0000000000000000000000000000000000000000..d6b0c2e192203b3751a43d2c75a95b925c80915f --- /dev/null +++ b/app/ned/07/ned0725b.c @@ -0,0 +1,65 @@ +/* + * FILE %ned/07/ned0725b.c + * + * insert a block into a line, taking block mode into consideration + * returns a pointer to the last line + * + * written: 1995-03-22 + * latest update: 1997-06-29 14:26:19 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int block_mode; + +/* ------------------------------------------------------------------------ */ +int ned_blk_insert2 ( /* Block einfaedeln */ +struct LINE *act_line, /* Einfuegeposition in Zeilenliste */ +int xcx, /* Einfuegeposition innerhalb der Zeile */ +struct LINE *la, /* Begin des einzufuegenden Blocks */ +struct LINE *lb) /* Ende des einzufuegenden Blocks */ +{ + struct LINE *line_splitted; + struct LINE *rv= (struct LINE *) 0; + int offset; + + switch (block_mode) + { + case BLOCK_MODE_box: + case BLOCK_MODE_line: + ned_blk_insert (act_line, la, lb); + rv= lb; + offset= lb->lng; + break; + + case BLOCK_MODE_standard: + if (ned_split2 (act_line, &line_splitted, xcx, 0) >= 0) + { + if (la == lb) + { + rv= act_line; + offset= xcx + la->lng; + } + else + { + rv= lb; + offset= lb->lng; + } + + ned_join2 (lb, line_splitted); + ned_join2 (act_line, la); + } + break; + } + + ned_set_marker2 ((struct WINDOWCTRL *) 0, rv, offset, + ned_get_marker (NED_TMARK_INSERT2, 1)); + + return 0; +} diff --git a/app/ned/07/ned0725c.c b/app/ned/07/ned0725c.c new file mode 100644 index 0000000000000000000000000000000000000000..8da7ef7fe402fc2539daab421a5498c126e8e7db --- /dev/null +++ b/app/ned/07/ned0725c.c @@ -0,0 +1,89 @@ +/* + * FILE %ned/07/ned0726c.c + * + * insert a block into a line, taking block mode into consideration + * + * written: 1996-05-27 + * latest update: 1997-08-28 11:11:08 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int block_mode; +extern int blk; + +#define JUMP + +/* ------------------------------------------------------------------------ */ +int ned_blk_insert3 ( /* Block einfaedeln */ +struct WINDOWCTRL *wc, /* window where everything happens */ +struct LINE *la, /* Begin des einzufuegenden Blocks */ +struct LINE *lb, /* Ende des einzufuegenden Blocks */ +int before) /* 0: insert after current line */ + /* 1: in line mode, insert before act. line */ +{ + int zn; + struct LINE *a; + + if (wc->WC_act == (struct LINE *) 0) + { + wc->WC_act= wc->WC_first= la; + } + else + { + if (before && block_mode == BLOCK_MODE_line) + { + if ((a= wc->WC_act->prev) == (struct LINE *) 0) + { + if (lb != (struct LINE *) 0) + { + lb->next= wc->WC_act; + wc->WC_act->prev= lb; + } + } + else + { + ned_blk_insert (a, la, lb); + ned_set_block_markers (wc, la, 0, 0, 0); + ned_set_block_markers (wc, lb, 0, 1, 0); + } + } + else + { + int offset; + struct MARKER *mrk; + struct LINE *lp; + + ned_blk_insert2 (wc->WC_act, offset= wc->cx + wc->hv - wc->ax, la, lb); + lp= wc->WC_act; + if (block_mode == BLOCK_MODE_line) lp= lp->next; + ned_set_block_markers (wc, lp, offset, 0, 0); + + if ((mrk= ned_get_marker (NED_TMARK_INSERT2, 0)) != (struct MARKER *) 0) + { + ned_set_block_markers (wc, mrk->ptr, mrk->offset, 1, 0); + mrk->wptr= wc; /* this was not set before */ + } + } + } + + wc->f_upd= 1; + wc->znr= zn= ned_cnt_line_2beg (a= wc->WC_act); + wc->tlines= ((zn > 1) ? zn-1 : 0) + ned_cnt_line_2end (a); + +#ifdef JUMP + ned_w_jmp_aktline (wc, NEDJMP_LINE_3, 0, + NEDJMP_FLAG_REDRAW|NEDJMP_FLAG_NO_CNT); +#else + wc->w_upd |= 0x04; + ned_display_window (wc); +#endif + + return 0; +} diff --git a/app/ned/07/ned0726.c b/app/ned/07/ned0726.c new file mode 100644 index 0000000000000000000000000000000000000000..d7f45930823fadeb3e0ef34a3f7939da71a8136b --- /dev/null +++ b/app/ned/07/ned0726.c @@ -0,0 +1,80 @@ +/* + * FILE %ned/07/ned0726.c + * + * Operationen mit Blocks und Markern + * + * written: 1987 04 08 + * 1991 02 07: Revision + * 1991 07 10: Revision + * latest update: 1998-08-16 12:31:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_blk_duplicate ( +register struct LINE *s_start, +struct LINE *s_stop, +struct LINE **d_start, +struct LINE **d_stop, +int sp1, +int sp2, +int copy_mode) +{ + register struct LINE **p; /* Kopierte Zeile */ + struct LINE *p2; /* Previous Line im copierten Block */ + struct LINE *p3; /* temporary line pointer */ + + *d_start= *d_stop= p2= (struct LINE *) 0; + if (s_start == (struct LINE *) 0 || s_stop == (struct LINE *) 0) return -1; + + p= d_start; + for (; s_start != (struct LINE *) 0; s_start= s_start->next) + { +#ifdef JUNK + if (s_start == s_stop + && copy_mode == BLOCK_MODE_standard + && sp2 == 0) break; +#endif + + if (ned_copy_line (p, s_start) < 0) break; + + (*p)->prev= p2; + if (p2 != (struct LINE *) 0) p2->next= *p; + p2= *p; + p= &p2->next; + if (s_start == s_stop) break; + } + *d_stop= p2; + + /* splice begin and end of lines of block, if in standard block mode */ + if (copy_mode == BLOCK_MODE_standard) + { + int start_is_stop= 0; + + if (*d_stop == *d_start) start_is_stop= 1; +if (start_is_stop) ned_message_1 ("start is stop"); + + if (sp2 >= 0 && ned_split2 (p3= *d_stop, &p2, sp2, 0) >= 0) + { + p3->next= p2->prev= (struct LINE *) 0; + ned_lines_free (p2); + } + + if (sp1 > 0 && ned_split2 (p3= *d_start, &p2, sp1, 0) >= 0) + { + *d_start= p2; + p3->next= p2->prev= (struct LINE *) 0; + ned_lines_free (p3); + } + if (start_is_stop) *d_stop= *d_start; + } + + return 0; +} diff --git a/app/ned/07/ned0727.c b/app/ned/07/ned0727.c new file mode 100644 index 0000000000000000000000000000000000000000..b812379f709250662ef264862fe4f19336604a4b --- /dev/null +++ b/app/ned/07/ned0727.c @@ -0,0 +1,39 @@ +/* + * FILE %ned/07/ned0727.c + * + * copy block + * + * written: 1987 04 08 + * 1991 05 16: Revision + * latest update: 1997-03-31 11:08:21 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int block_mode; +extern struct MARKER b_beg, b_end; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void ned_wc_blk_copy (struct WINDOWCTRL *wc, int before) +{ + struct LINE *la, *lb; + + if (oper_level >= LEV_BLK + || wc == (struct WINDOWCTRL *) 0 + || (wc->WC_edit_mode & EDIT_READ_ONLY) + || wc->file_type == FTY_FTRWDW + || ned_blk_invalid () + ) return; + + ned_blk_duplicate (b_beg.ptr, b_end.ptr, &la, &lb, + b_beg.offset, b_end.offset, block_mode); + + ned_blk_insert3 (wc, la, lb, before); +} diff --git a/app/ned/07/ned0727a.c b/app/ned/07/ned0727a.c new file mode 100644 index 0000000000000000000000000000000000000000..012854eb2516731b97e66323e96958e4c17d2af5 --- /dev/null +++ b/app/ned/07/ned0727a.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/07/ned0727a.c + * + * copy block + * + * written: 1997-01-19 + * latest update: 1997-03-31 11:01:44 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_blk_copy () +{ + set_repeat_command (ned_blk_copy); + ned_wc_blk_copy (aw, 0); +} diff --git a/app/ned/07/ned0727b.c b/app/ned/07/ned0727b.c new file mode 100644 index 0000000000000000000000000000000000000000..24f7ddccea66c9f3e8c25509a1aa9f4a6ee4b2db --- /dev/null +++ b/app/ned/07/ned0727b.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/07/ned0727b.c + * + * copy block + * + * written: 1997-01-19 + * latest update: 1997-01-19 14:08:09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_blk_copy_before () +{ + set_repeat_command (ned_blk_copy_before); + ned_wc_blk_copy (aw, 1); +} diff --git a/app/ned/07/ned0727c.c b/app/ned/07/ned0727c.c new file mode 100644 index 0000000000000000000000000000000000000000..fae9629981ebb1df09c58079e8cf2d6520418c6a --- /dev/null +++ b/app/ned/07/ned0727c.c @@ -0,0 +1,41 @@ +/* + * FILE %ned/07/ned0727c.c + * + * copy block + * + * written: 1997-03-31 (isolated from ned_wc_blk_copy) + * latest update: 1997-06-29 15:25:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int block_mode; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void ned_wc_buffer_copy (struct WINDOWCTRL *wc, int buffer_name, int before) +{ + struct LINE *la, *lb; + struct NED_BUFFER *bu; + + if (oper_level >= LEV_BLK + || wc == (struct WINDOWCTRL *) 0 + || (wc->WC_edit_mode & EDIT_READ_ONLY) + || wc->file_type == FTY_FTRWDW + || (bu= ned_get_buffer (buffer_name, 0)) == (struct NED_BUFFER *) 0 + || bu->l_beg == (struct LINE *) 0 + ) return; + + ned_blk_duplicate (bu->l_beg, bu->l_end, &la, &lb, + /*** bu->c_beg ***/ 0, + /*** bu->c_end ***/ bu->l_end->lng, /* T2D !! */ + BLOCK_MODE_line); + + ned_blk_insert3 (wc, la, lb, before); +} diff --git a/app/ned/07/ned0727d.c b/app/ned/07/ned0727d.c new file mode 100644 index 0000000000000000000000000000000000000000..eea1f092274a2dfc6c0a3d6ed8582a229db6daac --- /dev/null +++ b/app/ned/07/ned0727d.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/07/ned0727d.c + * + * copy block + * + * written: 1997-03-31 + * latest update: 1997-03-31 11:10:24 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_buffer_copy () +{ + set_repeat_command (ned_buffer_copy); + ned_wc_buffer_copy (aw, -1, 0); + ned_fresh_buffer (); +} diff --git a/app/ned/07/ned0727e.c b/app/ned/07/ned0727e.c new file mode 100644 index 0000000000000000000000000000000000000000..f230625793e497a5114bd14f86233a72eb175373 --- /dev/null +++ b/app/ned/07/ned0727e.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/07/ned0727e.c + * + * copy block + * + * written: 1997-03-31 + * latest update: 1997-06-29 18:09:47 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_buffer_copy_before () +{ + set_repeat_command (ned_buffer_copy_before); + ned_wc_buffer_copy (aw, 0, 1); +} diff --git a/app/ned/07/ned0728.c b/app/ned/07/ned0728.c new file mode 100644 index 0000000000000000000000000000000000000000..d83bce31443f6ba75d6ee4f8d3fbdc760317f7ba --- /dev/null +++ b/app/ned/07/ned0728.c @@ -0,0 +1,45 @@ +/* + * FILE %ned/07/ned0728.c + * + * move a block + * - see also: ned_blk_iconify () + * + * written: 1987 04 08 + * 1991 05 16: Revision + * latest update: 1997-09-07 9:40:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int block_mode; +extern struct WINDOWCTRL *aw; +extern struct MARKER b_beg, b_end; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void ned_blk_move () +{ + struct WINDOWCTRL *w_source; + struct LINE *la, *lb; + + if (oper_level >= LEV_BLK + || (aw->WC_edit_mode & EDIT_READ_ONLY) + || aw->file_type == FTY_FTRWDW + || ned_blk_invalid () /* T2D: b_beg and b_end checked therein */ + || ned_blk_isolate2 (&b_beg, &b_end, (aw == b_beg.wptr)) == 0 + ) return; + + if ((w_source= b_beg.wptr) != aw) + ned_w_jmp_aktline (w_source, NEDJMP_LINE_3, 0, NEDJMP_FLAG_REDRAW); + + la= b_beg.ptr; + lb= b_end.ptr; + + ned_blk_insert3 (aw, la, lb, 0); +} diff --git a/app/ned/07/ned0729.c b/app/ned/07/ned0729.c new file mode 100644 index 0000000000000000000000000000000000000000..6dac29a80cd72e4041c44cfdec5be95fbd4f0cf0 --- /dev/null +++ b/app/ned/07/ned0729.c @@ -0,0 +1,41 @@ +/* + * FILE %ned/07/ned0729.c + * + * Operationen mit Blocks und Markern + * + * written: 1987 04 08 + * 1991 05 16: Revision + * latest update: 1997-09-07 10:12:32 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern struct MARKER b_beg, b_end; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void ned_blk_delete () +{ + if (oper_level >= LEV_BLK + || (aw->WC_edit_mode & EDIT_READ_ONLY) + || aw->file_type == FTY_FTRWDW + || ned_blk_invalid () /* T2D: b_beg and b_end checked therein */ + || ned_blk_isolate2 (&b_beg, &b_end, 0) == 0 + ) return; + + aw->f_upd= 1; + aw->tlines= ned_cnt_total_lines (aw->WC_act); + + ned_store_line_to_buffer (0x00, b_beg.ptr, b_end.ptr, 0); + + ned_blk_rst (); + + ned_w_jmp_aktline (aw, NEDJMP_LINE_3, 0, NEDJMP_FLAG_REDRAW); +} diff --git a/app/ned/07/ned0730.c b/app/ned/07/ned0730.c new file mode 100644 index 0000000000000000000000000000000000000000..28273c580b1acfbe7d6984a0d88d8977c6d6717f --- /dev/null +++ b/app/ned/07/ned0730.c @@ -0,0 +1,68 @@ +/* + * FILE %ned/07/ned0730.c + * + * Operationen mit Blocks und Markern + * + * written: 1987 04 08 + * 1991 02 03: Revision + * 1991 05 16: Revision + * latest update: 1997-09-07 9:25:14 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/filename.h> +#include "ed.h" +#include "message.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void ned_blk_read () /* Read Block from File */ +{ + struct LINE *la, *lb; + struct WINDOWCTRL dummy; + char fnm [MAX_FNM_LENGTH]; + + if (oper_level >= LEV_FBLK || aw->file_type == FTY_FTRWDW) return; + + fnm [0]= 0; + if (rd_str ("Read Block: ", fnm, MAX_FNM_LENGTH) == -1) return; + + wdw_rst (&dummy); + ned_f_read (&dummy, fnm, + (char *) 0, /* T2D: specify feature file ?? */ + 0, &la, &lb, 0L, 0x7FFFFFFFL); + + if (la == (struct LINE *) 0 || lb == (struct LINE *) 0) + { /* READ ERROR */ + ned_error_message ("File not found! (ESC)"); + return; + } + + if (aw->first == (struct LINE *) 0) + { + aw->first= aw->WC_act= la; + } + else + { + struct MARKER *mrk_beg; + + if ((mrk_beg= ned_get_marker (NED_MARKER_BEG, 0)) != (struct MARKER *) 0) + ned_reset_block_flags (mrk_beg->wptr); + + ned_blk_insert2 (aw->WC_act, aw->cx + aw->hv - aw->ax, la, lb); + } + + aw->f_upd= 1; + aw->tlines= ned_cnt_total_lines (aw->WC_act); + ned_set_marker2 (aw, la, 0, ned_get_marker (NED_MARKER_BEG, 1)); + ned_set_marker2 (aw, lb, lb->lng, ned_get_marker (NED_MARKER_END, 1)); + ned_set_block_flags (); + ned_blk_screen (); +} diff --git a/app/ned/07/ned0731a.c b/app/ned/07/ned0731a.c new file mode 100644 index 0000000000000000000000000000000000000000..b4a12f84584edbaa763e68ada08471baa620c0d1 --- /dev/null +++ b/app/ned/07/ned0731a.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/07/ned0731a.c + * + * Operationen mit Blocks und Markern + * + * written: 1991 05 17 + * latest update: 1996-05-26 12:25:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_blk_append () /* Append Block to File */ +{ + q_wablk (1); +} diff --git a/app/ned/07/ned0731p.c b/app/ned/07/ned0731p.c new file mode 100644 index 0000000000000000000000000000000000000000..a0bc421bcea18e777553c040af0f6d9ea9585ea9 --- /dev/null +++ b/app/ned/07/ned0731p.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/07/ned0731p.c + * + * Print a Block + * + * written: 1992 01 23 + * latest update: 1996-05-26 12:25:09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_blk_print () /* print block */ +{ + q_wablk (2); +} diff --git a/app/ned/07/ned0731w.c b/app/ned/07/ned0731w.c new file mode 100644 index 0000000000000000000000000000000000000000..d72db7d95997bd21976a6ade0066f7c7c34dacb6 --- /dev/null +++ b/app/ned/07/ned0731w.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/07/ned0731w.c + * + * Operationen mit Blocks und Markern + * + * written: 1991 05 17 + * latest update: 1996-05-26 12:24:57 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_blk_write () /* Write Block to File */ +{ + q_wablk (0); +} diff --git a/app/ned/07/ned0732.c b/app/ned/07/ned0732.c new file mode 100644 index 0000000000000000000000000000000000000000..7842c5cbae4d4010aaa52926fdc8225990ae28ae --- /dev/null +++ b/app/ned/07/ned0732.c @@ -0,0 +1,62 @@ +/* + * FILE %ned/07/ned0732.c + * + * Operationen mit Blocks und Markern + * + * written: 1987 04 08 + * 1991 02 03: Revision + * 1991 05 17: Revision + * latest update: 1997-08-03 15:46:48 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/filename.h> +#include "ed.h" +#include "proto.h" + +extern int oper_level; +extern struct WINDOWCTRL *aw; +extern struct MARKER b_beg, b_end; + +/* ------------------------------------------------------------------------ */ +void q_wablk (int mode) /* 0: write; 1: append Block to File */ +{ + char fnm [MAX_FNM_LENGTH]; + char xfnm_ftr [MAX_FNM_LENGTH]; + char *pfnm; + char *pfnm_ftr; + long la_offset; + long lz_offset; + int f_write_mode= FLG2_block_mode; + + if (oper_level >= LEV_FBLK) return; + if (ned_blk_invalid ()) return; + + pfnm= fnm; + pfnm_ftr= xfnm_ftr; + + if (mode == 2) + { + pfnm= "/dev/prn"; + pfnm_ftr= (char *) 0; + if (aw->file_format == FMT_SGML) f_write_mode |= FLG2_format_change; + f_write_mode |= FLG2_write_crlf; + } + else + { + fnm [0]= 0; + if (rd_str ((mode == 1) ? "Append Block: " : "Write Block: ", + fnm, MAX_FNM_LENGTH) == -1) return; + fnmcpy (xfnm_ftr, fnm, ".ftr"); + if (mode == 1) f_write_mode |= FLG2_append_mode; + } + + ned_f_write (aw, pfnm, pfnm_ftr, 0, 0, + b_beg.ptr, b_end.ptr, + &la_offset, &lz_offset, + f_write_mode); +} diff --git a/app/ned/07/ned0733.c b/app/ned/07/ned0733.c new file mode 100644 index 0000000000000000000000000000000000000000..6445ab710d8f6e5419e9655e93bd3bd6134a695b --- /dev/null +++ b/app/ned/07/ned0733.c @@ -0,0 +1,60 @@ +/* + * FILE %ned/07/ned0733.c + * + * Operationen mit Blocks und Markern + * + * written: 1987 04 08 + * 1991 02 03: Revision + * 1991 12 30: revision + * latest update: 1997-10-26 10:50:34 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +#define Ret_Err /* -1 */ +#define Ret_OK /* 0 */ + +/* ------------------------------------------------------------------------ */ +void q_jmp_marker (struct MARKER *m) +{ + struct WINDOWCTRL *mw; + int lnr; + + if (m == (struct MARKER *) 0 + || (mw= m->wptr) == (struct WINDOWCTRL *) 0 + ) return Ret_Err; + + if (aw == mw) + { +JUMP: + aw->cx= m->offset - aw->hv + aw->ax; + + /* NOTE: m->ptr can be a pointer to a line which no longer is in the */ + /* window so the validity of the line should be verified. */ + if ((lnr= ned_cnt_line_relative (aw->WC_act, m->ptr)) > 0) + { + aw->WC_act= m->ptr; + aw->znr= lnr; + } + + ned_w_jmp_aktline (aw, NEDJMP_LINE_3, 0, + NEDJMP_FLAG_REDRAW|NEDJMP_FLAG_NO_CNT); + return Ret_OK; + } + + if (q2_jmpwdw (mw) == 0) + { + q0_jmpwdw (mw); + goto JUMP; + } + + return Ret_Err; +} diff --git a/app/ned/07/ned0734.c b/app/ned/07/ned0734.c new file mode 100644 index 0000000000000000000000000000000000000000..d702e0e458dd78313f8786fb8da5de8b2c2ae7ec --- /dev/null +++ b/app/ned/07/ned0734.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/07/ned0734.c + * + * Operationen mit Blocks und Markern + * + * written: 1987 04 08 + * latest update: 1997-06-28 22:48:25 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct MARKER b_beg; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_jmp_blkbeg () +{ + ned_set_marker (aw, '\''); + q_jmp_marker (&b_beg); +} diff --git a/app/ned/07/ned0735.c b/app/ned/07/ned0735.c new file mode 100644 index 0000000000000000000000000000000000000000..41863e78d6e791aa63165dc17809fe1da850d037 --- /dev/null +++ b/app/ned/07/ned0735.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/07/ned0735.c + * + * Operationen mit Blocks und Markern + * + * written: 1987 04 08 + * latest update: 1997-06-28 22:48:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct MARKER b_end; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_jmp_blkend () +{ + ned_set_marker (aw, '\''); + q_jmp_marker (&b_end); +} diff --git a/app/ned/07/ned0736.c b/app/ned/07/ned0736.c new file mode 100644 index 0000000000000000000000000000000000000000..e12c791ad5f04c9b750b7b5ec139881f059d4d4b --- /dev/null +++ b/app/ned/07/ned0736.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/07/ned0736.c + * + * jump to a marker + * + * written: 1996-10-03 + * latest update: 1996-10-20 17:19:53 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int key; /* last key pressed */ + +/* ------------------------------------------------------------------------ */ +void ned_jmp_marker_key () +{ + ned_jmp_marker (key, 0); +} diff --git a/app/ned/07/ned0737.c b/app/ned/07/ned0737.c new file mode 100644 index 0000000000000000000000000000000000000000..1a5db4bcab83cbdc4afedace10110100911347ee --- /dev/null +++ b/app/ned/07/ned0737.c @@ -0,0 +1,28 @@ +/* + * FILE %ned/07/ned0737.c + * + * jump to marker number 1 + * + * written: 1996-10-03 + * latest update: 1996-11-03 18:52:03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_jmp_marker_1 () +{ + ned_jmp_marker ('1', 0); +} + +/* ------------------------------------------------------------------------ */ +void ned_jmp_marker_find () +{ + ned_jmp_marker ('/', 0); +} diff --git a/app/ned/07/ned0738.c b/app/ned/07/ned0738.c new file mode 100644 index 0000000000000000000000000000000000000000..4130e88ff4b0c0085ab988d3f4a07403c3c5c977 --- /dev/null +++ b/app/ned/07/ned0738.c @@ -0,0 +1,58 @@ +/* + * FILE %ned/07/ned0738.c + * + * written: 1997-12-05 + * latest update: 1997-12-05 11:34:08 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int blk; +extern int block_mode; + +/* ------------------------------------------------------------------------ */ +char *ned_block_2_string ( +char *buffer, +int maxBytes, +long offset, +int flags) +{ + int beg_offset; + int end_offset; + struct MARKER *mrk_beg; + struct MARKER *mrk_end; + + if (blk == 0 + || (mrk_beg= ned_get_marker (NED_MARKER_BEG, 0)) == (struct MARKER *) 0 + || (mrk_end= ned_get_marker (NED_MARKER_END, 0)) == (struct MARKER *) 0 + ) return (char *) 0; + + switch (block_mode) + { + case BLOCK_MODE_standard: + case BLOCK_MODE_box: + beg_offset= mrk_beg->offset; + end_offset= mrk_end->offset; + break; + + case BLOCK_MODE_line: + default: + beg_offset= 0; + end_offset= 32700; /* @@@ T2D */ + break; + } + + return ned_line_2_string ( + mrk_beg->ptr, beg_offset, + mrk_end->ptr, end_offset, + buffer, + maxBytes, /* there is extra space for the 0-char */ + offset, + flags); +} diff --git a/app/ned/07/ned0747.c b/app/ned/07/ned0747.c new file mode 100644 index 0000000000000000000000000000000000000000..70890897db65d555908988d20eff592c0c75bcf0 --- /dev/null +++ b/app/ned/07/ned0747.c @@ -0,0 +1,36 @@ +/* + * FILE %ned/07/ned0747.c + * + * check if block has critical pointers like w->first or w->WC_act + * pointing into the block + * + * written: 1991-12-31 + * latest update: 1996-07-26 3:09:52 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *windows; + +/* ------------------------------------------------------------------------ */ +int ned_blk_critical () +/* 0 -> not critical */ +/* 1 -> critical */ +{ + register struct WINDOWCTRL *w; + + for (w= windows; w != (struct WINDOWCTRL *) 0; w= w->next) + { + if ( (w->WC_act != (struct LINE *) 0 && (w->WC_act ->line_flg & LINE_inBLOCK)) + ||(w->WC_first != (struct LINE *) 0 && (w->WC_first->line_flg & LINE_inBLOCK)) ) + return 1; + } + + return 0; +} diff --git a/app/ned/07/ned0747b.c b/app/ned/07/ned0747b.c new file mode 100644 index 0000000000000000000000000000000000000000..84a405ba3b650d449403f6d8d78e8a7b93aa17f9 --- /dev/null +++ b/app/ned/07/ned0747b.c @@ -0,0 +1,44 @@ +/* + * FILE %ned/07/ned0747b.c + * + * check if critical pointers exist in the window and realign + * them if necessary + * + * written: 1996-05-27 + * latest update: 1996-05-27 14:16:08 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *windows; + +/* ------------------------------------------------------------------------ */ +int ned_blk_realign_if_critical (struct LINE *new_line) +/* 0 -> not critical */ +/* 1 -> critical */ +{ + register struct WINDOWCTRL *wc; + + for (wc= windows; wc != (struct WINDOWCTRL *) 0; wc= wc->next) + { + if ( (wc->WC_act != (struct LINE *) 0 + && (wc->WC_act->line_flg & LINE_inBLOCK) + ) + ||(wc->WC_first != (struct LINE *) 0 + && (wc->WC_first->line_flg & LINE_inBLOCK) + ) + ) + { + wc->WC_act= new_line; + ned_w_jmp_aktline (wc, NEDJMP_LINE_3, 0, NEDJMP_FLAG_REDRAW); + } + } + + return 0; +} diff --git a/app/ned/07/ned0749.c b/app/ned/07/ned0749.c new file mode 100644 index 0000000000000000000000000000000000000000..73d53c2948c602a68bb660686c4dbd06193befc5 --- /dev/null +++ b/app/ned/07/ned0749.c @@ -0,0 +1,87 @@ +/* + * FILE %ned/07/ned0749.c + * + * iconify a block + * - see also: + * - ned_rename_frame () + * - ned_blk_move () + * - struct MARKER + * + * written: 1993-10-03 + * latest update: 1998-08-15 12:29:14 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/filename.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +extern int oper_level; +extern int block_mode; +extern int blk; +extern struct MARKER b_beg, b_end; +extern struct WINDOWCTRL *aw; + +static char fnm [MAX_FNM_LENGTH]= "$$clip"; + +/* ------------------------------------------------------------------------ */ +void ned_blk_iconify () +{ + struct FRAMECTRL *fc_new; + struct CLUSTERCTRL *cc; + struct WINDOWCTRL *wc; + struct WINDOWCTRL *w_source; + int search_mode= 0x02; + struct LINE *l_bot; + + if (oper_level >= LEV_BLK + || (w_source= b_beg.wptr) == (struct WINDOWCTRL *) 0 + || (w_source->WC_edit_mode & EDIT_READ_ONLY) + || ned_blk_invalid () /* T2D: b_beg and b_end checked therein */ + || rd_str ("destination frame: ", fnm, MAX_FNM_LENGTH) == -1 + || ned_blk_isolate2 (&b_beg, &b_end, 0) == 0 + ) return; + + w_source->f_upd= 1; + w_source->tlines= ned_cnt_total_lines (w_source->WC_act); + ned_w_jmp_aktline (w_source, NEDJMP_LINE_3, 0, NEDJMP_FLAG_REDRAW); + + if (w_source->file_type != FTY_HYPER + || (fc_new= (struct FRAMECTRL *) w_source->file_or_frame) + == (struct FRAMECTRL *) 0 + || (cc= fc_new->cluster) == (struct CLUSTERCTRL *) 0 + ) cc= ned_activate_cluster ("%cl0"); + + if (cc == (struct CLUSTERCTRL *) 0 + || (fc_new= ned_activate_frame (cc, fnm, (struct WINDOWCTRL *) 0, + search_mode, FMT_SGML, + (char *) 0, (char *) 0)) + == (struct FRAMECTRL *) 0 + || (wc= aw) == (struct WINDOWCTRL *) 0 + ) + return; + + l_bot= ned_find_last_line (wc->WC_act); + if (block_mode == BLOCK_MODE_line + && l_bot != (struct LINE *) 0 + && l_bot->prev != (struct LINE *) 0) l_bot= l_bot->prev; + + if ((wc->WC_act= l_bot) == (struct LINE *) 0) + wc->WC_act= wc->WC_first= b_beg.ptr; + else + ned_blk_insert2 (wc->WC_act, wdw_off(wc), b_beg.ptr, b_end.ptr); + + wc->f_upd= 1; + wc->tlines= ned_cnt_total_lines (wc->WC_act); + + blk= 1; + ned_w_jmp_aktline (wc, NEDJMP_LINE_3, 0, NEDJMP_FLAG_REDRAW); + + ned_memorize_location (); +} diff --git a/app/ned/07/ned0750.c b/app/ned/07/ned0750.c new file mode 100644 index 0000000000000000000000000000000000000000..8940d31aee9e4ce09b5db3ebc6d0739262394d2d --- /dev/null +++ b/app/ned/07/ned0750.c @@ -0,0 +1,42 @@ +/* + * FILE %ned/07/ned0750.c + * + * mark complete window as a block + * T2D: this function is apparently not used anywhere + * + * written: 1995-02-11 + * latest update: 1997-09-07 9:30:00 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_blk_mark_all (struct WINDOWCTRL *w) +{ + struct LINE *lc; + struct LINE *act; + struct MARKER *mrk_beg; + + if (w == (struct WINDOWCTRL *) 0 + || (act= w->WC_act) == (struct LINE *) 0 + ) return -1; + + if ((mrk_beg= ned_get_marker (NED_MARKER_BEG, 1)) != (struct MARKER *) 0) + ned_reset_block_flags (mrk_beg->wptr); + + lc= ned_find_first_line (act); + ned_set_marker2 (w, lc, 0, mrk_beg); + + lc= ned_find_last_line (act); + ned_set_marker2 (w, lc, 0, ned_get_marker (NED_MARKER_END, 1)); + + ned_set_block_flags (); + + return 0; +} diff --git a/app/ned/07/ned0751.c b/app/ned/07/ned0751.c new file mode 100644 index 0000000000000000000000000000000000000000..b8772d2acb560575b8d8c8574c775d0434e8a0a4 --- /dev/null +++ b/app/ned/07/ned0751.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/07/ned0751.c + * + * find first line in a list of lines + * + * written: 1995-02-11 + * latest update: 1998-08-16 14:26:10 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct LINE *ned_find_first_line (register struct LINE *lc) +{ + struct LINE *lp; + + if (lc != (struct LINE *) 0) + while ((lp= lc->prev) != (struct LINE *) 0) lc= lp; + + return lc; +} diff --git a/app/ned/07/ned0752.c b/app/ned/07/ned0752.c new file mode 100644 index 0000000000000000000000000000000000000000..98a9b8889801d4bee35eb4f8f3ddd4b59c118747 --- /dev/null +++ b/app/ned/07/ned0752.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/07/ned0752.c + * + * find first line in a list of lines + * + * written: 1995-02-11 + * latest update: 1998-08-16 14:25:41 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct LINE *ned_find_last_line (struct LINE *lc) +{ + struct LINE *lx; + + if (lc != (struct LINE *) 0) + while ((lx= lc->next) != (struct LINE *) 0) lc= lx; + + return lc; +} diff --git a/app/ned/07/ned0753.c b/app/ned/07/ned0753.c new file mode 100644 index 0000000000000000000000000000000000000000..14f56f68be1f6c3fd10ca40c2d4128f1161c6523 --- /dev/null +++ b/app/ned/07/ned0753.c @@ -0,0 +1,74 @@ +/* + * FILE %ned/07/ned0753.c + * + * paste a string into the current window + * + * written: 1995-11-09 + * latest update: 1997-06-11 15:01:37 + * $Id: ned0753.c,v 1.3 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_paste_string ( +const char *buffer, +int ai_mode, +char *line_prefix, +char *line_postfix) +/* RETURN: */ +/* -1 ... ERROR */ +/* 0 ... no change */ +/* >1 ... number of lines changed */ +{ + int ch; + int ai; + int i; + int lines_changed= 0; + int df= 0; + + if (aw == (struct WINDOWCTRL *) 0 + || buffer == (char *) 0 + ) return -1; + + ai= aw->ai; + aw->ai= 0; + + if (*buffer) lines_changed= 1; + + while ((ch= (*buffer++ & 0x00FF)) != 0) + { + switch (ch) + { + case '\n': + if (line_postfix != (char *) 0) q_insert_string (line_postfix, 0); + p_nl (); + if (*buffer) /* look ahead */ + { + if (line_prefix != (char *) 0) q_insert_string (line_prefix, 0); + for (i= ai_mode; i > 0; i--) q_insert (' ', 0); + } + lines_changed++; + df= 0; + break; + + default: + q_insert (ch, 0); + df= 1; + break; + } + } + + aw->ai= ai; + if (df) p_refresh (); + + return lines_changed; +} diff --git a/app/ned/07/ned0754a.c b/app/ned/07/ned0754a.c new file mode 100644 index 0000000000000000000000000000000000000000..2f5d6e5c0d27fad05a23de9c6b79e88d9c11cef8 --- /dev/null +++ b/app/ned/07/ned0754a.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/07/ned0754a.c + * + * paste the current date into the current window + * + * written: 1995-11-28 + * latest update: 1997-04-29 10:41:03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dates.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_paste_date () +{ + char d [80]; + actual_datim (d, DATIMfmt_date); + return ned_paste_string (d, 0, (char *) 0, (char *) 0); +} diff --git a/app/ned/07/ned0754b.c b/app/ned/07/ned0754b.c new file mode 100644 index 0000000000000000000000000000000000000000..d05080a5c59d7fe340c0f887aba2f78c50af18ba --- /dev/null +++ b/app/ned/07/ned0754b.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/07/ned0754b.c + * + * paste the current date into the current window + * + * written: 1997-04-29 + * latest update: 1997-04-29 10:34:37 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dates.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_paste_seconds () +{ + char d [80]; + actual_datim (d, DATIMfmt_seconds); + return ned_paste_string (d, 0, (char *) 0, (char *) 0); +} diff --git a/app/ned/07/ned0754c.c b/app/ned/07/ned0754c.c new file mode 100644 index 0000000000000000000000000000000000000000..bde410378b8ed1ad3e936c29c1db3da3ae1b2ebb --- /dev/null +++ b/app/ned/07/ned0754c.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/07/ned0754c.c + * + * paste the current date into the current window + * + * written: 1995-11-28 + * latest update: 1997-04-29 10:43:32 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dates.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_paste_date_time () +{ + char d [80]; + actual_datim (d, DATIMfmt_date_time); + return ned_paste_string (d, 0, (char *) 0, (char *) 0); +} diff --git a/app/ned/07/ned0754d.c b/app/ned/07/ned0754d.c new file mode 100644 index 0000000000000000000000000000000000000000..a8ba3ca6cd58dc6054b09e0ff5484df7cd05b9b2 --- /dev/null +++ b/app/ned/07/ned0754d.c @@ -0,0 +1,32 @@ +/* + * FILE %ned/07/ned0754d.c + * + * paste the current date into the current window + * + * written: 1995-11-28 + * latest update: 1997-11-28 12:39:33 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/dates.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_paste_date_string () +{ + char d [80]; + char *TZ; + + if ((TZ= getenv ("TZ")) == (char *) 0) TZ= "CET"; + + prepare_date (d, TZ, 80); + return ned_paste_string (d, 0, (char *) 0, (char *) 0); +} diff --git a/app/ned/07/ned0756.c b/app/ned/07/ned0756.c new file mode 100644 index 0000000000000000000000000000000000000000..8d35b54c662c097f387a09164d9df332d8e28c31 --- /dev/null +++ b/app/ned/07/ned0756.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/07/ned0756.c + * + * paste the current date into the current window + * + * written: 1995-11-28 + * latest update: 1996-06-09 17:21:37 + * $Id: ned0756.c,v 1.2 2002/06/15 04:35:20 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_paste_file_name () +{ + return ned_paste_string (aw->WC_title_short, 0, (char *) 0, (char *) 0); +} diff --git a/app/ned/07/ned0758.c b/app/ned/07/ned0758.c new file mode 100644 index 0000000000000000000000000000000000000000..37202e1dcc32099ef56f93c509642e6c44ffccee --- /dev/null +++ b/app/ned/07/ned0758.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/07/ned0758.c + * + * paste the current date into the current window + * + * written: 1995-12-26 + * latest update: 1996-06-09 17:21:57 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_paste_user () +{ + char *user; + if ((user= getenv ("EMAIL")) == (char *) 0) user= "unknown@somewhere"; + + return ned_paste_string (user, 0, (char *) 0, (char *) 0); +} diff --git a/app/ned/07/ned0759.c b/app/ned/07/ned0759.c new file mode 100644 index 0000000000000000000000000000000000000000..75e2cf3637fa567473f40a046f8e9833d93cadd5 --- /dev/null +++ b/app/ned/07/ned0759.c @@ -0,0 +1,45 @@ +/* + * FILE %ned/07/ned0759.c + * + * copy block + * + * written: 1996-03-06 + * latest update: 1997-10-26 10:49:40 + * $Id: ned0759.c,v 1.2 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int oper_level; +extern struct MARKER b_beg, b_end; + +/* ------------------------------------------------------------------------ */ +int ned_markup_block ( +struct WINDOWCTRL *w, +int start_tag_segments, +const char *start_tag [], +int stop_tag_segments, +const char *stop_tag []) +{ + if (oper_level >= LEV_BLK + || (w->WC_edit_mode & EDIT_READ_ONLY) + || ned_blk_invalid () + || w->file_type == FTY_FTRWDW + ) return -1; + + ned_feature_set (w, b_beg.ptr, b_beg.offset, Ftype_SGML_TAG, + start_tag_segments, start_tag); + + ned_feature_set (w, b_end.ptr, b_end.offset, Ftype_SGML_TAG, + stop_tag_segments, stop_tag); + + ned_display_window (w); + + return 0; +} diff --git a/app/ned/07/ned0760.c b/app/ned/07/ned0760.c new file mode 100644 index 0000000000000000000000000000000000000000..7792a9dc6744128768e5a43b2e12236e9166f96f --- /dev/null +++ b/app/ned/07/ned0760.c @@ -0,0 +1,40 @@ +/* + * FILE %ned/07/ned0760.c + * + * copy block + * + * written: 1996-03-06 + * latest update: 1999-04-25 16:32:30 + * $Id: ned0760.c,v 1.4 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/hytxt.h> + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_markup_block_2 ( +struct WINDOWCTRL *w, +const char *start_tag) +{ + const char *start_tag_list [1]; + const char *stop_tag_list [1]; + char *cp; + + if ((cp= hyx_make_stop_tag (start_tag)) == (char *) 0) return -1; + + start_tag_list [0]= start_tag; + stop_tag_list [0]= cp; + + ned_markup_block (w, 1, start_tag_list, 1, stop_tag_list); + free (cp); + + return 0; +} diff --git a/app/ned/07/ned0761.c b/app/ned/07/ned0761.c new file mode 100644 index 0000000000000000000000000000000000000000..d629f221124be85582050ffdbce0e3b8488e8f17 --- /dev/null +++ b/app/ned/07/ned0761.c @@ -0,0 +1,38 @@ +/* + * FILE %ned/07/ned0761.c + * + * copy block + * + * written: 1996-03-06 + * latest update: 1997-10-26 10:49:03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_markup_block_prompt () +{ +#define MAX_TAG 80 + char tagging_sequence [MAX_TAG]; + + tagging_sequence [0]= '<'; + tagging_sequence [1]= 0; + if (rd_str ("tag: ", tagging_sequence+1, MAX_TAG-2) != -1) + { + int i; + + i= strlen (tagging_sequence); + tagging_sequence [i++]= '>'; + tagging_sequence [i++]= 0; + ned_markup_block_2 (aw, tagging_sequence); + } +} diff --git a/app/ned/07/ned0762.c b/app/ned/07/ned0762.c new file mode 100644 index 0000000000000000000000000000000000000000..a1b3f67f11c2f96532d2eae2e58a54437c72796c --- /dev/null +++ b/app/ned/07/ned0762.c @@ -0,0 +1,43 @@ +/* + * FILE %ned/07/ned0762.c + * + * copy block + * + * written: 1996-03-07 + * latest update: 1997-10-26 10:48:52 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern int block_mode; + +/* ------------------------------------------------------------------------ */ +int ned_set_tag ( +struct WINDOWCTRL *w, +struct LINE *l, +int offset, +int start_tag_segments, +char *start_tag [], +int stop_tag_segments, +char *stop_tag []) +{ + if ((w->WC_edit_mode & EDIT_READ_ONLY) || w->file_type == FTY_FTRWDW) + return -1; + + w->f_upd= 1; + + q_feature_set (l, offset, Ftype_SGML_TAG, + start_tag_segments, start_tag); + + ... T2D 1996-03-07 9:11:52 + ned_identify_feature (w, l, offset, Ftype_SGML_TAG, start_tag [0], + buffer1a, buffer1b, &repl_size, MAX_BUFFER1); + + return 0; +} diff --git a/app/ned/07/ned0763.c b/app/ned/07/ned0763.c new file mode 100644 index 0000000000000000000000000000000000000000..5d93c5d0506c20f6323807b8f328aa2c886ce652 --- /dev/null +++ b/app/ned/07/ned0763.c @@ -0,0 +1,32 @@ +/* + * FILE %ned/07/ned0763.c + * + * paste the name of the last renamed object (file or frame) + * + * written: 1996-03-17 + * latest update: 1996-11-03 17:05:34 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern char *ned_renamed_object; +extern int block_mode; + +/* ------------------------------------------------------------------------ */ +int ned_paste_renamed_object () +{ + int rc; + + block_mode= BLOCK_MODE_standard; + p_blkbeg (); + rc= ned_paste_string (ned_renamed_object, 0, (char *) 0, (char *) 0); + p_blkend (); + + return rc; +} diff --git a/app/ned/08/(dirinf).fm b/app/ned/08/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..ebaced7a0bf30d4daa0ed0ef430277f6e6b4377c --- /dev/null +++ b/app/ned/08/(dirinf).fm @@ -0,0 +1,114 @@ +# +# FILE %ned/08/(dirinf).fm +# +# latest update: 2000-08-24 14:42:35 +# $Id: (dirinf).fm,v 1.4 2001/04/01 22:45:03 gonter Exp $ +# +# ---------------------------------------------------------------------------- +Makefile | current makefile +make-dos | MSDOS makefile + +ned0803.c | void p_feature_next () +ned0804.c | void p_feature_prev () +ned0805.c | void p_feature_range () +ned0806.c | void p_feature_set () +ned0807.c | void p_feature_reset () +ned0808.c | int ned_link_feature_lines (...) +ned0809.c | int ned_setup_feature_window (...) +ned0810.c | int q_save_restart () +ned0811.c | void q_save_marker (fo, m) +ned0812.c | int q_load_restart () +ned0813.c | void p_link_feature (...) /* ^O F: Open Feature Window */ +ned0814.c | struct WINDOWCTRL *active_feature_window (struct WINDOWCTRL *w) +# +ned0821.c | void wr_ftr (ff, ln, fp) +ned0822.c | void wr_ftr_txt (ff, fp) +ned0823.c | int rd_ftr (ff, fp) +ned0824.c | int wr_sgml_tag (ff, fp, column_idx); +ned0825.c | int rd_sgml_tag (...); +ned0826.c | int find_feature (...) +ned0827.c | int find_feature_with_attribute (...) +ned0828.c | int ned_identify_feature (...); +ned0829.c | int ned_insert_feature (*fp, f) +ned0830.c | int setup_sgml_entity_descriptors (char *setup_file_name) +ned0831.c | int setup_sgml_tag_descriptors (char *setup_file_name) +ned0832.c | void p_format_SGML (void); +ned0833.c | void p_format_ASCII (void); +ned0834.c | int ned_eval_string (char *str, int option); +ned0835.c | void ned_eval_str (void); +ned0836.c | int ned_eval_hlink (char *str, int option); +ned0837.c | int get_attr_value (char *src, char *dst); +ned0838.c | char *ned_line_2_string (...); +ned0838a.c | ind ned_line_list_size (); +ned0839.c | int ned_eval_line (...); +ned0840.c | void ned_eval_block (void); +ned0841.c | void ned_eval_feature (void); +ned0841b.c | int q_eval_tag (void); +ned0842.c | struct FEATURE **ned_feature_find3 (int range); +ned0842b.c | struct FEATURE **ned_feature_find (struct LINE *lp, int x, int range) +ned0842c.c | struct FEATURE **ned_feature_find2 (struct WINDOWCTRL *wc, int range) +ned0843.c | int eval_ned_macro (char *str, int option); +ned0844.c | int ned_activate_cluster (char *fn) +ned0844b.c | int ned_free_cluster (struct CLUSTERCTRL *cl) +ned0845.c | int ned_activate_frame (...) +ned0845a.c | int ned_deactivate_frame (...) +ned0846.c | struct FRAMECTRL *find_frame (...) +ned0847.c | struct FRAMECTRL *create_framectrl (...) +ned0848.c | int get_index (struct FRAMECTRL *fr); +ned0849.c | int update_index (...) +ned0850.c | struct FEATURE *q_feature_set (...) +ned0850b.c | struct FEATURE *ned_new_feature (...) +ned0851.c | int eval_window_parameters (...) +ned0852.c | **OBS** char *find_attr_name (char *str, char *name); +ned0853.c | int eval_logic_link (...); +ned0854a.c | void p_logic_link_next (); +ned0854b.c | void p_logic_link_prev (); +ned0854c.c | void p_logic_link_menu (); +ned0854d.c | void p_logic_link_up (); +ned0854e.c | void p_logic_link_lang () +ned0854f.c | void p_logic_link_sort (); +ned0854g.c | void p_logic_link_view (); +ned0854h.c | void p_logic_link (); +ned0856.c | int ned_lookup_current_feature (char *token, ...) +ned0857.c | int ned_lookup_feature (char *token, char *line_buffer, ...) +ned0857b.c | int ned_lookup_tag (char *token, char *line_buffer, ...) +ned0857c.c | int ned_lookup_feature_cache (...) +ned0858.c | int ned_rename_frame (struct WINDOWCTRL *w, char *fnm) +ned0858b.c | int ned_cb_rename_frame (...) +ned0859.c | void eval_ned_parameter (char *str, int option); +ned0860.c | int check_logic_links (struct WINDOWCTRL *w); +ned0861.c | void ned_set_SGML_tag () +ned0862.c | void ned_set_SGML_entity () +ned0863.c | int ned_wc_feature_create ( +ned0863b.c | int ned_wc_simple_feature_create ( +ned0864.c | int initialize_frame (struct WINDOWCTRL *w, char fr_name); +ned0865.c | void ned_set_hyx_l () +ned0866.c | int show_feature (struct FEATURE *fp); +ned0867.c | void ned_wc_memorize_location (struct WINDOCTRL *wc); +ned0867b.c | void ned_memorize_location (void); +ned0868.c | void p_logic_link_more (); +ned0869.c | struct FRAMECTRL *ned_activate_special (cl_name, fr_name) +ned0869b.c | struct FRAMECTRL *ned_activate_cl_fr (cl_name, fr_name) +ned0870.c | activate default symbolic bookmarks +ned0871.c | void p_activate_crf () +ned0872.c | +ned0873.c | bookmark subsystem +ned0874.c | +ned0875.c | void p_activate_fr_root () +ned0876.c | void p_activate_fr_notes () +ned0877.c | void p_activate_fr_help () +ned0878.c | void ned_p_activate_cl_fr () +ned0879.c | void p_cross_ref () +ned0879i.c | void ned_lookup_lib () +ned0879l.c | void ned_lookup_lexicon () +ned0879t.c | void ned_lookup_thesaurus () +ned0880.c | void ned_activate_cross_ref (char *str, ...) +ned0881.c | void p_2cross_ref (char *str, int MAX_STR) +ned0882.c | void ned_cross_ref (...) +ned0883.c | +ned0884.c | void ned_set_mark (void) +ned0885.c | void ned_set_lookup_tag (void) +ned0885b.c | void ned_set_lookup_tag_fr (void) +ned0886.c | struct FEATURE *ned_feature_set (struct WINDOWCTRL *w, ...) +ned0887.c | void ned_ftr_shift_up () +* | diff --git a/app/ned/08/Makefile b/app/ned/08/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..bb31d3cf362498ad6f22d3364053803d8d44099b --- /dev/null +++ b/app/ned/08/Makefile @@ -0,0 +1,80 @@ +# +# FILE %ned/08/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# +# latest update: 2000-08-24 14:45:49 +# $Id: Makefile,v 1.9 2012/08/10 14:44:20 gonter Exp $ +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +PFX= /usr/local/include/ +# TCL_VER=8.0 +# TCL_VER=8.3 +# TCL_VER=8.4 +# OPTS2=-I/usr/X11R6/include -I$(PFX)tcl$(TCL_VER) -I${PFX}tk$(TCL_VER) +OPTS2=-I/usr/X11R6/include -I/usr/include/tcl8.4 +OPTS=-c -g -I.. $(OPTS2) $(cf) +CC=cc + +objs1=ned0803.o ned0804.o ned0805.o ned0806.o ned0807.o ned0808.o \ + ned0809.o ned0811.o ned0813.o ned0814.o ned0821.o ned0822.o \ + ned0823.o ned0824.o ned0825.o ned0826.o ned0827.o ned0828.o \ + ned0829.o ned0830.o ned0831.o ned0832.o ned0833.o ned0834.o \ + ned0835.o ned0838.o ned0838a.o ned0839.o ned0840.o \ + ned0841.o ned0841b.o ned0842.o ned0842b.o ned0842c.o ned0843.o \ + ned0844.o ned0844b.o ned0845a.o + +objs2=ned0846.o ned0847.o ned0848.o ned0849.o ned0850.o ned0850b.o \ + ned0853.o ned0854a.o ned0854b.o ned0854c.o ned0854d.o \ + ned0854e.o ned0854f.o ned0854g.o ned0854h.o ned0856.o ned0857.o \ + ned0857b.o ned0857c.o ned0858.o ned0858b.o \ + ned0859.o ned0860.o ned0861.o \ + ned0862.o ned0863.o ned0863b.o ned0864.o ned0865.o ned0866.o ned0867.o \ + ned0867b.o ned0868.o ned0869.o ned0869b.o ned0870.o \ + ned0871.o ned0873.o ned0875.o \ + ned0876.o ned0877.o ned0878.o \ + ned0879.o ned0879i.o ned0879l.o ned0879t.o \ + ned0880.o ned0882.o ned0884.o ned0885.o ned0885b.o ned0886.o \ + ned0887.o + +objs_cur= ned0836_cur.o ned0845_cur.o ned0851_cur.o +objs_tk= ned0836_tk.o ned0845_tk.o ned0851_tk.o + +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_tk lib_cur +clean : + rm -f *.o lib_cur lib_tk + +lib_tk : $(objs_tk) $(objs1) $(objs2) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs1) $(objs2) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h ../edhyx.h + $(CC) $(OPTS) -c $*.c + +# --- cur Modules ---------- +ned0836_cur.o : ../ed.h ned0836.c + $(CC) $(OPTS) -o ned0836_cur.o ned0836.c + +ned0845_cur.o : ../ed.h ned0845.c + $(CC) $(OPTS) -o ned0845_cur.o ned0845.c + +ned0851_cur.o : ../ed.h ned0851.c + $(CC) $(OPTS) -o ned0851_cur.o ned0851.c + +# --- tk Modules ---------- +ned0836_tk.o : ../ed.h ned0836.c + $(CC) $(OPTS) -DUSE_TK -o ned0836_tk.o ned0836.c + +ned0845_tk.o : ../ed.h ned0845.c + $(CC) $(OPTS) -DUSE_TK -o ned0845_tk.o ned0845.c + +ned0851_tk.o : ../ed.h ned0851.c + $(CC) $(OPTS) -DUSE_TK -o ned0851_tk.o ned0851.c diff --git a/app/ned/08/contrib b/app/ned/08/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/08/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/08/gg b/app/ned/08/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/08/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/08/lib_cur b/app/ned/08/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/08/lib_tk b/app/ned/08/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/08/make-dos b/app/ned/08/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..1b445e1f4b86f806dc0479641462799406c5ba32 --- /dev/null +++ b/app/ned/08/make-dos @@ -0,0 +1,68 @@ +# +# FILE %ned/08/makefile +# +# GG's Night(mare) Editor System +# +# latest update: 1997-12-05 3:24:24 +# +# ============================================================================ +cc=cl -Os -AL -I.. /c +ccc=cl -Os -AL /W3 /Fo$@ -I.. /c +obj=objdec -m0 -w -sl 2 NED08_TEXT $@ + +lib : lib.1 lib.2 lib.3 lib.ro + +lib.1 : ned0803.obj ned0804.obj ! + ned0805.obj ned0806.obj ned0807.obj ned0808.obj ! + ned0809.obj ned0811.obj ned0812.obj ! + ned0813.obj ned0814.obj ! + ned0821.obj ned0822.obj ned0823.obj ned0824.obj ! + ned0825.obj ned0826.obj ned0827.obj ned0828.obj ned0829.obj ! + ned0830.obj ned0831.obj ned0832.obj ! + ned0833.obj ned0834.obj ned0835.obj ned0836.obj ! + ned0838.obj ned0838a.obj ned0839.obj ned0840.obj ! + ned0841.obj ned0841b.obj ned0842.obj ned0842b.obj ned0842c.obj ! + ned0843.obj ned0844.obj ned0844b.obj + +lib.2 : ned0845.obj ned0845a.obj ned0846.obj ! + ned0847.obj ned0848.obj ned0849.obj ned0850.obj ned0850b.obj ! + ned0851.obj ned0853.obj ned0856.obj ned0857.obj ! + ned0857b.obj ned0857c.obj ! + ned0858.obj ned0858b.obj ned0859.obj ned0860.obj ! + ned0861.obj ned0862.obj ned0863.obj ned0863b.obj ned0864.obj ! + ned0865.obj ned0866.obj ned0867.obj ned0867b.obj ned0868.obj ! + ned0869.obj ned0869b.obj ned0870.obj ned0871.obj ! + ned0873.obj ned0875.obj ned0876.obj ! + ned0877.obj ned0878.obj ! + ned0879.obj ned0879i.obj ned0879l.obj ned0879t.obj ! + ned0880.obj ned0882.obj ned0884.obj ! + ned0885.obj ned0885b.obj ned0886.obj + +lib.3 : ! + ned0854a.obj ned0854b.obj ned0854c.obj ned0854d.obj ! + ned0854e.obj ned0854f.obj ned0854g.obj ned0854h.obj + +lib.ro : ! + ner0831.obj ner0836.obj ner0844.obj ner0845.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $? + $(obj) + +# ---------------------------------------------------------------------------- +ner0831.obj : ..\ed.h ..\edhyx.h ned0831.c + $(ccc) -DNED_READ_ONLY ned0831.c + $(obj) + +ner0836.obj : ..\ed.h ..\edhyx.h ned0836.c + $(ccc) -DNED_READ_ONLY ned0836.c + $(obj) + +ner0844.obj : ..\ed.h ..\edhyx.h ned0844.c + $(ccc) -DNED_READ_ONLY ned0844.c + $(obj) + +ner0845.obj : ..\ed.h ..\edhyx.h ned0845.c + $(ccc) -DNED_READ_ONLY ned0845.c + $(obj) diff --git a/app/ned/08/ned0803.c b/app/ned/08/ned0803.c new file mode 100644 index 0000000000000000000000000000000000000000..14a5fee9b039d98369b37ccacb28a249de718a8e --- /dev/null +++ b/app/ned/08/ned0803.c @@ -0,0 +1,56 @@ +/* + * FILE %ned/08/ned0803.c + * + * jump to the next feature + * + * written: 1987 09 08 + * 1991 02 07: Revision + * latest update: 1998-08-16 12:32:06 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_feature_next () +{ + struct LINE *p; + struct FEATURE *f; + int x; + + if (aw == (struct WINDOWCTRL *) 0 || aw->WC_act == (struct LINE *) 0) + goto NF; + + p= aw->WC_act; + if (p->ftr != (struct FEATURE *) 0) + { + x= aw->cx + aw->hv - aw->ax; + for (f= p->ftr; f != (struct FEATURE *) 0; f= f->ftr_next) + if (f->ftr_pos > x) goto END; + } + + for (;;) + { + if ((p= p->next) == (struct LINE *) 0) goto NF; + if (p->ftr != (struct FEATURE *) 0) break; + } + + aw->WC_act= p; + f= p->ftr; + +END: + aw->cx= f->ftr_pos - aw->hv + aw->ax; + ned_w_jmp_aktline (aw, NEDJMP_LINE_MID, 0, NEDJMP_FLAG_REDRAW); + show_feature (f); + return; + +NF: + ned_message_1 ("no next feature"); +} diff --git a/app/ned/08/ned0804.c b/app/ned/08/ned0804.c new file mode 100644 index 0000000000000000000000000000000000000000..91b774fab22ea05ae580db411a4e88fa4d5652c7 --- /dev/null +++ b/app/ned/08/ned0804.c @@ -0,0 +1,65 @@ +/* + * FILE %ned/08/ned0804.c + * + * Bearbeitung des Feature Files und des Restart Files + * + * written: 1987 09 08 + * 1991 02 07: Revision + * latest update: 1998-08-16 12:32:14 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_feature_prev () +{ + struct LINE *p; + struct FEATURE *f; + int x; + int xx= -1; + + if (aw == (struct WINDOWCTRL *) 0 || aw->WC_act == (struct LINE *) 0) + goto NF; + + p= aw->WC_act; + if (p->ftr != (struct FEATURE *) 0) + { + x= aw->cx + aw->hv - aw->ax; + for (f= p->ftr; f != (struct FEATURE *) 0; f= f->ftr_next) + if (f->ftr_pos < x) + xx= f->ftr_pos - aw->hv + aw->ax; + + if (xx != -1) + { + aw->cx= xx; + goto END; + } + } + + for (;;) + { + if ((p= p->prev) == (struct LINE *) 0) goto NF; + if (p->ftr != (struct FEATURE *) 0) break; + } + + /* hinterstes Feature suchen */ + for (f= p->ftr; f->ftr_next != (struct FEATURE *) 0; f= f->ftr_next); + + aw->WC_act= p; + aw->cx= f->ftr_pos - aw->hv + aw->ax; +END: + ned_w_jmp_aktline (aw, NEDJMP_LINE_MID, 0, NEDJMP_FLAG_REDRAW); + show_feature (f); + return; + +NF: + ned_message_1 ("no previous feature"); +} diff --git a/app/ned/08/ned0805.c b/app/ned/08/ned0805.c new file mode 100644 index 0000000000000000000000000000000000000000..b70ed34f1d8bc428b7cbd53b1e8c7df1c776764b --- /dev/null +++ b/app/ned/08/ned0805.c @@ -0,0 +1,22 @@ +/* + * FILE ~/usr/ned/08/ned0805.c + * + * Bearbeitung des Feature Files und des Restart Files + * + * written: 1987 09 08 + * 1991 02 07: Revision + * latest update: 1994-12-28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_feature_range () +{ +} diff --git a/app/ned/08/ned0806.c b/app/ned/08/ned0806.c new file mode 100644 index 0000000000000000000000000000000000000000..f3b36b2fdb76e55a7e13dbada68370bb721f9086 --- /dev/null +++ b/app/ned/08/ned0806.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/08/ned0806.c + * + * Bearbeitung des Feature Files und des Restart Files + * + * written: 1987 09 08 + * 1991 02 07: Revision + * latest update: 1997-02-08 20:43:55 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_feature_set () +{ + ned_wc_feature_create (aw, 0, FTR_EDIT_NONE, (char *) 0); +} diff --git a/app/ned/08/ned0807.c b/app/ned/08/ned0807.c new file mode 100644 index 0000000000000000000000000000000000000000..864eca007bccd58b766ae04706881ae956a790cd --- /dev/null +++ b/app/ned/08/ned0807.c @@ -0,0 +1,39 @@ +/* + * FILE %ned/08/ned0807.c + * + * Bearbeitung des Feature Files und des Restart Files + * + * written: 1987 09 08 + * 1991 02 07: Revision + * latest update: 1999-04-25 16:32:33 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifndef MSDOS +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_feature_reset () +{ + struct FEATURE *f, **f2; + + if ((f2= ned_feature_find3 (0)) == (struct FEATURE **) 0) return; + + aw->f_upd= 1; + f= *f2; + *f2= f->ftr_next; + + /* Text Segmente und LINE freigeben ############# */ + free (f); + wd_displine (aw, aw->WC_act, aw->cy, aw->ax, aw->bx); +} diff --git a/app/ned/08/ned0808.c b/app/ned/08/ned0808.c new file mode 100644 index 0000000000000000000000000000000000000000..ee5bfb70ab2a5a771ae479a3bdf063de417673e7 --- /dev/null +++ b/app/ned/08/ned0808.c @@ -0,0 +1,120 @@ +/* + * FILE %ned/08/ned0808.c + * + * int ned_link_feature_lines (void) + * Verkettet alle Feature Zeilen eines Windows und ordnet diese + * Kette dem Feature Window des aktuellen Windows zu. + * Die aktuelle Zeile des Windows wird auf das Feature gesetzt, + * welches an der aktuellen Cursor Position ist (oder am naechsten + * dazu ist??) + * Falls Match-Strings angegeben sind (str_cnt > 0), dann werden + * nur solche Feature Lines beruecksichtigt, die den String enthalten. + * Letzteres Feature wird dazu verwendet, um nur Tags eines bestimmten + * Typs anzuzeigen. + * + * written: 1987 09 08 + * 1991 02 07: Revision + * 1991 05 29: Revision + * latest update: 1997-01-06 11:11:02 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_link_feature_lines ( /* Feature Text verketten */ +int ftr_types, /* range of features to include */ +int ftr_subtypes, /* range of subtypes if available */ +int str_cnt, /* number of strings to match */ +char *mstr[]) /* the strings themselves */ +{ + struct LINE *lp; /* currently examined text line */ + struct LINE *lpf; /* letzte Feature Zeile bei Verkettung */ + struct LINE *lp_ftr; /* text line of the feature record */ + struct FEATURE *ft; /* Features */ + struct WINDOWCTRL *fw; /* Feature Window */ + int flg_ftr= 0; /* 1 -> aktuelles Window hat Feautres */ + int flg_akt= 0; /* 1 -> aktuelle Zeile hat Feature */ + int curx; /* Spalte in der sich der Cursor befindet */ + + if ((lp= ned_find_first_line (aw->first)) == (struct LINE *) 0) return -1; + + curx= aw->cx + aw->hv - aw->ax; + fw= aw->feature_window; + + fw->first= (struct LINE *) 0; + + lpf= (struct LINE *) 0; + for (; lp != (struct LINE *) 0; lp= lp->next) + { + for (ft= lp->ftr; ft != (struct FEATURE *) 0; ft= ft->ftr_next) + { + /* check if this feature is to be used at all */ + if ((ftr_types != 0 && ftr_types != ft->ftr_type) + || (ftr_subtypes != 0 && ftr_subtypes != ft->ftr_type) + ) continue; + + /* MATCH FEATURE LINE - - - - - - - - - - - - - - - - - - - - - - - - */ + if (str_cnt > 0) /* if match strings are specified, check */ + { /* check if the current feature contains */ + int i; /* the given string, otherwise ignore */ + int rc; /* that feature. */ + int matches= 0; /* 1 -> this line matches specified string */ + int msp, mln; + struct LINE *mline; + struct LINE *aline; + + aline= (struct LINE *) ft->ftr_text_line; + for (i= 0; i < str_cnt; i++) + { + rc= ned_str_match (aline, 0, aline, + (unsigned char *) mstr [i], + (unsigned char *) 0, -1, + &mline, &msp, &mln, 0); + if (rc == 0) + { + matches= 1; + break; + } + } + + if (!matches) continue; + } + + /* doppelte Verkettung */ + lp_ftr= (struct LINE *) ft->ftr_text_line; + lp_ftr->prev= lpf; + if (lpf != (struct LINE *) 0) lpf->next= lp_ftr; + + /* check, if this feature can be edited or not */ + if (ft->ftr_edit_flags & FTR_EDIT_NO_EDIT) + lp_ftr->line_flg |= LINE_PROTECTED; + + /* Cursor Placement */ + if (flg_akt == 0) fw->first= fw->WC_act= lp_ftr; + + if (lp == aw->WC_act) + { + if (flg_akt == 0) fw->first= lp_ftr; + if (flg_akt == 0 || (flg_akt == 1 && ft->ftr_pos <= curx)) + { + fw->WC_act= lp_ftr; + flg_akt= 1; + } + if (ft->ftr_pos >= curx) flg_akt= 2; + } + + lpf= lp_ftr; + flg_ftr= 1; + } + } + + return flg_ftr; +} diff --git a/app/ned/08/ned0809.c b/app/ned/08/ned0809.c new file mode 100644 index 0000000000000000000000000000000000000000..deba046512aa2301fd331828ef9fd2efd36d242d --- /dev/null +++ b/app/ned/08/ned0809.c @@ -0,0 +1,75 @@ +/* + * FILE %ned/08/ned0809.c + * + * Bearbeitung des Feature Files und des Restart Files + * + * written: 1987 09 08 + * 1991 02 03: Revision + * 1991 09 03: Revision + * latest update: 1998-08-16 12:32:19 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *windows; +extern struct WINDOWCTRL *aw; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +int ned_setup_feature_window ( +int ftr_types, /* range of features to include */ +int ftr_subtypes, /* range of subtypes if available */ +int str_cnt, /* number of strings to match */ +char *mstr[]) /* the strings themselves */ +{ + struct WINDOWCTRL *fw; + struct WINDOWCTRL *ow; + struct WINDOWCTRL *w2; + + if (oper_level >= LEV_LINK + || (ow= aw) == (struct WINDOWCTRL *) 0 + || ow->file_or_frame == (void *) 0 + || ow->file_type == FTY_FTRWDW + || (fw= ow->feature_window) == (struct WINDOWCTRL *) 0 + /* || fw->page == 0 ################### */ + ) return -1; + + if ((w2= active_feature_window (ow)) != (struct WINDOWCTRL *) 0) + { + struct LINE *l; + struct FEATURE *f; + + ned_message_1 ("jumping to active feature window!"); + q2_jmpwdw (w2); + q0_jmpwdw (w2); + if ((f= ow->WC_act->ftr) != (struct FEATURE *) 0 + && (l= (struct LINE *) f->ftr_text_line) != (struct LINE *) 0) + aw->WC_act= l; + } + else + { + if (ned_link_feature_lines (ftr_types, ftr_subtypes, str_cnt, mstr) == 0) + return -1; /* keine Features im Window !! */ + + q_jmpwdw (p_wdwopen ()); /* das setzt aw neu!!! */ + + /* Link to Feature Window */ + wdw_rst (aw); + aw->WC_first= fw->WC_first; + aw->WC_act= fw->WC_act; + fw->page= 0; + aw->file_type= FTY_FTRWDW; + aw->WC_edit_mode= EDIT_NOLINEOPS; + aw->feature_window= ow; + } + + ned_w_jmp_aktline (aw, NEDJMP_LINE_MID, 0, NEDJMP_FLAG_REDRAW); + + return 0; +} diff --git a/app/ned/08/ned0810.c b/app/ned/08/ned0810.c new file mode 100644 index 0000000000000000000000000000000000000000..7aabdc6e9cf6d643f03e6faf81dfc3fce15c1b31 --- /dev/null +++ b/app/ned/08/ned0810.c @@ -0,0 +1,100 @@ +/* + * FILE %ned/08/ned0810.c + * + * Bearbeitung des Feature Files und des Restart Files + * + * *** NOT USED *** + * + * written: 1987 09 08 + * 1991 02 03: Revision + * latest update: 1997-10-26 10:24:35 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +/* Modul NED11: (Find & Replace) ------------------------------------------ */ +extern char find_str [], + repl_str [], + opt_str []; /* Optionen und Ersatz-String */ + +extern char stp_fnm []; + +extern int find_replace, /* 0 .. undefiniert */ + /* 1 .. Find */ + /* 2 .. Replace (Makro Execution) */ + option; /* bit 0: global */ + /* 1: ingore case */ + /* 2: Ask before replace */ + cnt; + +extern int akt_page; + +static char *signature [] = +{ + "NED 2.3 Restart" +} ; + +/* ------------------------------------------------------------------------ */ +void q_save_restart (void) +{ + FILE *fo; + struct FILECTRL *f; + struct WINDOWCTRL *w; + int i, fc= 0, wc= 0; + + for (f= files; f != (struct FILECTRL *) 0; f= f->FC_next) f->FC_num= ++fc; + for (w= windows; w != (struct WINDOWCTRL *) 0; w= w->WC_next) + { + wc++; + if (w == aw) i= wc; + } + + if ((fo= fopen ("NED.RST", "wt")) == (FILE *) 0) return; + + fprintf (fo, "%s\n%d %d %d %d %d\n", + signature[0], fc, wc, i, N_MARKER, w_get_mode ()); + + for (f= files; f != (struct FILECTRL *) 0; f= f->FC_next) + fprintf (fo, "%s\n%s\n", f->FC_fnm_txt, f->FC_fnm_ftr); + + for (w= windows; w != (struct WINDOWCTRL *) 0; w= w->WC_next) + { + if (w->file_type == FTY_HYPER) continue; + + fprintf (fo, "%2d %4d %4d %2d %2d %2d %2d %2d %2d %d %2d %d %d ", + ((struct FILECTRL *) w->file_or_frame)->FC_num, + ned_cnt_line_2beg (w->first), + w->znr, + w->ax, w->ay, + w->bx, w->by, + w->cx, w->cy, + w->page, w->attr_text, w->box_type, w->hv); + + fprintf (fo, "%d %d %d %d %d %d %d %d\n", + w->wflags, w->ins_flg, w->ai, w->wwc, w->f_upd, + w->WC_edit_mode, w->bin_eoln, w->bin_llng); + } + + q_save_marker (fo, &b_beg); + q_save_marker (fo, &b_end); + for (i= 0; i<10; i++) + q_save_marker (fo, &marker [i]); + + fprintf (fo, "%d %d %d %d\n", + blk, block_mode, oper_level, akt_page); + + fprintf (fo, "%s\n", stp_fnm); + + fprintf (fo, "%s\n%s\n%s\n%d %d %d\n", + find_str, repl_str, opt_str, find_replace, option, cnt); + + fclose (fo); +} diff --git a/app/ned/08/ned0811.c b/app/ned/08/ned0811.c new file mode 100644 index 0000000000000000000000000000000000000000..58321a75f5fb74577087ffd8cd4bd4eb9fd5d4ab --- /dev/null +++ b/app/ned/08/ned0811.c @@ -0,0 +1,31 @@ +/* + * FILE %ned/08/ned0811.c + * + * Bearbeitung des Feature Files und des Restart Files + * + * written: 1987 09 08 + * 1991 02 07: Revision + * latest update: 1996-07-26 3:14:19 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void q_save_marker (FILE *fo, struct MARKER *m) +{ + if (m->ptr == (struct LINE *) 0) + fprintf (fo, " 0 0 0\n"); + else fprintf (fo, "%2d %4d %3d\n", + /* m->fptr->num **** window ID **** */ 0, + ned_cnt_line_2beg (m->ptr), + m->offset); +} diff --git a/app/ned/08/ned0812.c b/app/ned/08/ned0812.c new file mode 100644 index 0000000000000000000000000000000000000000..31d79f6068d6ded42088e8299006e67c9d311e1c --- /dev/null +++ b/app/ned/08/ned0812.c @@ -0,0 +1,197 @@ +/* + * FILE %ned/08/ned0812.c + * + * Bearbeitung des Feature Files und des Restart Files + * + * *** NOT USED *** + * + * written: 1987 09 08 + * 1991 02 03: Revision + * latest update: 1999-04-25 16:32:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "ed.h" +#include <gg/window.h> +#include "proto.h" + +/* Modul NED11: (Find & Replace) ------------------------------------------ */ +extern char find_str [], + repl_str [], + opt_str []; /* Optionen und Ersatz-String */ + +extern char stp_fnm []; + +extern int find_replace, /* 0 .. undefiniert */ + /* 1 .. Find */ + /* 2 .. Replace (Makro Execution) */ + option; /* bit 0: global */ + /* 1: ingore case */ + /* 2: Ask before replace */ + cnt; + +extern int akt_page; + +/* ------------------------------------------------------------------------ */ +static char *signature [] = +{ + "NED 2.3 Restart" +} ; + +/* ------------------------------------------------------------------------ */ +void q_load_restart () +{ +#ifdef __THIS_SHOULD_GET_FIXED__ + FILE *fi; + struct FILECTRL *f; + struct WINDOWCTRL *w, *w2; + int i, fc, wc, awn; + int mc; /* Marker Counter */ + int xcx, xznr, xhv, xattr; /* Sicherungsvariablen; */ + int xins_flg, xai, xwwc; /* wird vom Feature File �berschrieben */ + char line [40]; + +return; /* ###################### FIX IT ########################## */ + if ((fi= fopen ("NED.RST", "rt")) == (FILE *) 0) goto AUS; + + fscanf (fi, "%[^\n]", line); + fgetc (fi); + if (feof (fi) || strcmp (line, signature [0]) != 0) goto AUS; + fscanf (fi, "%d%d%d%d%d", &fc, &wc, &awn, &mc, &i); + w_init_mode (i, 0x0001); + + for (i= 0; i< fc; i++) + { + if ((f= file_alloc ()) == (struct FILECTRL *)) goto AUS; + f->FC_next= files; + files= f; + } + + for (i= 0; i< wc; i++) + { + if ((w= ned_create_window_pair ()) == (struct WINDOWCTRL *) 0) + goto AUS; + + w->next= windows; + windows= w; + } + + for (w= windows, i=1; w != (struct WINDOWCTRL *) 0; w = w->next, i++) + if (i <= awn) + { + aw= w; + break; + } + + for (f= files; f != (struct FILECTRL *); f= f->next) + { + if (feof (fi)) goto AUS; fgetc (fi); + fscanf (fi, "%[^\n]", f->fnm_txt); fgetc (fi); /* ### alloc ### */ + fscanf (fi, "%[^\n]", f->fnm_ftr); /* ### alloc ### */ + } + + for (w= windows; w != (struct WINDOWCTRL *) 0; w= w->next) + { + if (feof (fi)) goto AUS; + fscanf (fi, "%d%d%d%d%d%d%d%d%d%d%d%d%d", + &fc, &wc, &xznr, + &w->ax, &w->ay, &w->bx, &w->by, &xcx, &w->cy, + &w->page, &xattr, &w->box_type, &xhv); + fscanf (fi, "%d%d%d%d%d%d%d%d", + &w->wflags, &xins_flg, &xai, &xwwc, &w->f_upd, + &w->WC_edit_mode, &w->bin_eoln, &w->bin_llng); + + for (f= files; f != (struct FILECTRL *); f= f->next, fc--) + if (fc == 1) + { + w->file_or_frame= f; + f->links++; + break; + } + + if (((struct FILECTRL *) w->file_or_frame)->links > 1) + { + for (w2=windows; w2 != (struct WINDOWCTRL *) 0; w2=w2->next) + if ((struct FILECTRL *) w2->file_or_frame == + (struct FILECTRL *) w->file_or_frame) + { + w->first = w2->first; + break; + } + } + else + { + ned_f_read (w, ((struct FILECTRL *) w->file_or_frame)->fnm_txt, + ((struct FILECTRL *) w->file_or_frame)->fnm_ftr, + 1, &w->first, &w->WC_act, 0L, 0x7FFFFFFFL); + } + + w->WC_act= ned_get_line_by_nr (w->first, &xznr); + w->first= ned_get_line_by_nr (w->first, &wc); + w->cx= xcx; + w->znr= xznr; + w->hv= xhv; + w->attr_text= xattr; + w->ins_flg= xins_flg; + w->ai= xai; + w->wwc= xwwc; + w->w_upd |= 0x04; + } + + if (feof (fi)) goto AUS; + q_load_marker (fi, &b_beg); + q_load_marker (fi, &b_end); + ned_set_block_flags (); + for (i=0; i<10; i++) + q_load_marker (fi, &marker [i]); + + if (feof (fi)) goto AUS; + fscanf (fi, "%d%d%d%d", + &blk, &block_mode, &oper_level, &akt_page); + + if (feof (fi)) goto AUS; + fscanf (fi, "%s", stp_fnm); fgetc (fi); + fscanf (fi, "%[^\n]", find_str); fgetc (fi); + fscanf (fi, "%[^\n]", repl_str); fgetc (fi); + fscanf (fi, "%[^\n]", opt_str); fgetc (fi); + fscanf (fi, "%d%d%d", &find_replace, &option, &cnt); + +AUS: + fclose (fi); +#endif +} + +/* ------------------------------------------------------------------------ */ +void q_load_marker (FILE *fi, struct MARKER *m) +{ +fi; m; +#ifdef __THIS_SHOULD_GET_FIXED__ + int i1, i2; + struct FILECTRL *f; + struct WINDOWCTRL *w; + + fscanf (fi, "%d%d%d", &i1, &i2, &m->offset); + m->ptr= (struct LINE *) 0; + + if (i1 != 0) + for (f= files; f != (struct FILECTRL *); f= f->next) + if (i1==1) + { + m->wptr = (struct WINDOWCTRL *) 0; /* m->fptr= f; WINDOWCTRL!!! */ + for (w= windows; w != (struct WINDOWCTRL *) 0; w= w->next) + if (f == (struct FILECTRL *) w->file_or_frame) + { + m->ptr= ned_get_line_by_nr (w->first, &i2); + break; + } + break; + } +#endif +} diff --git a/app/ned/08/ned0813.c b/app/ned/08/ned0813.c new file mode 100644 index 0000000000000000000000000000000000000000..4463dced0970cab5bd4687fc54614e731bc5d7ed --- /dev/null +++ b/app/ned/08/ned0813.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/08/ned0813.c + * + * Bearbeitung des Feature Files und des Restart Files + * + * written: 1991 09 11 + * latest update: 1996-07-27 9:45:18 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_link_feature () +{ + ned_setup_feature_window (0, 0, 0, (char **) 0); +} diff --git a/app/ned/08/ned0814.c b/app/ned/08/ned0814.c new file mode 100644 index 0000000000000000000000000000000000000000..8c1c76a0af3ee0ba4db096701c83631629bb5a21 --- /dev/null +++ b/app/ned/08/ned0814.c @@ -0,0 +1,35 @@ +/* + * FILE %ned/08/ned0814.c + * + * return the currently active feature window, if really active + * + * written: 1992 01 13 + * latest update: 1996-03-15 14:46:47 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *windows; + +/* ------------------------------------------------------------------------ */ +struct WINDOWCTRL *active_feature_window (struct WINDOWCTRL *w) +{ + struct WINDOWCTRL *w_rv= (struct WINDOWCTRL *) 0; + struct WINDOWCTRL *w2; + int wn= 1; + + for (w2= windows; w2 != (struct WINDOWCTRL *) 0; w2= w2->WC_next) + { + w2->wc_window_number= wn++; + if (w2->file_type == FTY_FTRWDW && w2->feature_window == w) + w_rv= w2; + } + + return w_rv; +} diff --git a/app/ned/08/ned0821.c b/app/ned/08/ned0821.c new file mode 100644 index 0000000000000000000000000000000000000000..edb6e27fd482d434a7391867b20f441641d677a5 --- /dev/null +++ b/app/ned/08/ned0821.c @@ -0,0 +1,40 @@ +/* + * FILE %ned/08/ned0821.c + * + * Bearbeitung des Feature Files und des Restart Files + * + * written: 1987 09 08 + * 1991 01 30: Revision + * 1991 06 01: Revision + * latest update: 1997-01-26 11:27:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int wr_ftr (FILE *ff, int ln, struct FEATURE *fp, int col, int vcol) +{ + long pos= 0; /* hier nur dummy! */ + int rv= 0; + + for (; fp != (struct FEATURE *) 0; fp= fp->ftr_next) + { + if (fp->ftr_pos == col) + { + fprintf (ff, "%3d %3d %3d ", ln, vcol, fp->ftr_type); + wr_ftr_txt (ff, fp, &pos); + if (fp->ftr_display_mode == FTR_display_replarray) + rv += fp->ftr_replarray_size; + fputc (0x0A, ff); + } + } + + return rv; +} diff --git a/app/ned/08/ned0822.c b/app/ned/08/ned0822.c new file mode 100644 index 0000000000000000000000000000000000000000..31810b8d7c6cfbc000993ad4e24c209fe8733c1a --- /dev/null +++ b/app/ned/08/ned0822.c @@ -0,0 +1,57 @@ +/* + * FILE %ned/08/ned0822.c + * + * Schreibt eine Feature Zeile auf ein File (ohne FTR-Codes) + * + * written: 1991 01 30 + * latest update: 1996-07-26 3:56:09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void wr_ftr_txt (FILE *ff, struct FEATURE *fp, long *position) +{ + register struct TXT *tx; + register char *cp; + int ll; /* Line Length */ + int lsl; /* Line Segment Length */ + struct LINE *lp; + long xpos; + + /* Feature Text schreiben */ + if ((lp= (struct LINE *) fp->ftr_text_line) == (struct LINE *) 0 + || (tx= lp->txt) == (struct TXT *) 0) return; + + ll= lp->lng; + lsl= tx->t_lng; + cp= tx->t; + + xpos= *position; + + while (ll-- > 0) + { + if (lsl == 0) + { + if ((tx= tx->next) == (struct TXT *) 0) + { + *position= xpos; + return; + } + lsl= tx->t_lng; + cp= tx->t; + } + fputc (*cp++, ff); + xpos++; + lsl--; + } + + *position= xpos; +} diff --git a/app/ned/08/ned0823.c b/app/ned/08/ned0823.c new file mode 100644 index 0000000000000000000000000000000000000000..b8854ea931b9b63f835ec12436b25080e58e52b5 --- /dev/null +++ b/app/ned/08/ned0823.c @@ -0,0 +1,98 @@ +/* + * FILE %ned/08/ned0823.c + * + * read a feature string + * + * written: 1987 09 08 + * 1991 02 07: Revision + * latest update: 1999-04-25 16:32:39 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include "ed.h" +#include "message.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +#define MAX_LINE 1024 /* T2D: should be global constant */ +static char lin [MAX_LINE]; + +/* ------------------------------------------------------------------------ */ +/* Feature Zeile bis an das Ende (inkl. CR) einlesen und verarbeiten */ +int rd_ftr ( +struct WINDOWCTRL *wc, /* associated window */ +struct LINE *lpt, /* line where feature is attached to */ +FILE *ff, /* input stream stream from .ftr file */ +struct FEATURE **fp, /* feature entry to be read */ +int p, /* Column Position */ +char *repl_array, /* replacement array produced */ +int *repl_size, /* length of replacement text */ +int repl_max) /* size of replacement array */ +{ + struct FEATURE *f; /* angelegtes Feature Record */ + register struct TXT *tx= /* Text Segment in der Zeile */ + (struct TXT *) 0; + struct LINE *lp; /* Feature Line */ + int ftr_type= 0; /* Feature Type */ + int tc; /* gelesenes Zeichen */ + int skip= 1; /* Blanks ueberspringen */ + int lin_idx= -1; /* index into lin */ + + fscanf (ff, "%d", &ftr_type); + + if (feof (ff) + || (f= ned_new_feature (p, ftr_type)) == (struct FEATURE *) 0 + ) return -1; + + lp= f->ftr_text_line; + + /* Feature Text einlesen */ + for (;;) + { + tc= fgetc (ff) & 0x00FF; + if (feof (ff) || tc == 0x0A) break; + + if (tc == 0x0D) continue; + if (skip && tc == 0x0020) continue; + skip= 0; + + if (lin_idx >= 0 && lin_idx < MAX_LINE) lin [lin_idx]= (char) tc; + lin_idx++; + + if ((lp->lng % TXT_LNG) == 0) /* Textsegment aufgebraucht */ + { + if (lp->lng == 0) + { /* 1. Textsegment */ + lp->txt= tx= txch_alloc (TXT_LNG, 0x20); + } + else + { /* weitere Textsegmente */ + tx->next= txch_alloc (TXT_LNG, 0x20); + tx= tx->next; + } + } + + if (tx == (struct TXT *) 0) + { + ned_error_message (ERR_MEMORY); + break; + } + tx->t [lp->lng % TXT_LNG] = (char) tc; + lp->lng++; + } + + if (lin_idx > 0) lin [lin_idx-1]= 0; + + ned_insert_feature (fp, f); + + ned_identify_feature (wc, lpt, p, ftr_type, f, lin, + repl_array, repl_size, repl_max); + + return 0; +} diff --git a/app/ned/08/ned0824.c b/app/ned/08/ned0824.c new file mode 100644 index 0000000000000000000000000000000000000000..8f3091af05cb2777cbecb42e8e12f288b8a8ad1f --- /dev/null +++ b/app/ned/08/ned0824.c @@ -0,0 +1,43 @@ +/* + * FILE %ned/08/ned0824.c + * + * Bearbeitung des Feature Files und des Restart Files + * + * written: 1991 02 07 + * latest update: 1997-01-26 11:21:32 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int wr_sgml_tag (FILE *ff, struct FEATURE *fp, int col_idx, long *position) +{ + int rv=0; + + for (; fp != (struct FEATURE *) 0; fp= fp->ftr_next) + { + if (fp->ftr_pos == col_idx) + { + wr_ftr_txt (ff, fp, position); + if (fp->ftr_display_mode == FTR_display_replarray) + rv += fp->ftr_replarray_size; + } + } + return rv; + + /* versteckte Features koennten mehrere auf einer */ + /* Column sitzen. Features mit Pseudo Character koennen immer */ + /* nur einzeln an einer Column Position sitzen. */ + /* Es kann der Fall eintreten, dass mehrere versteckte Features */ + /* an einer Column Position zusammen mit hoechstens einem Feature */ + /* mit Pseudo Character sitzt. In diesem Fall muss eben dieser */ + /* eine Pseudo Character entfernt werden. */ +} diff --git a/app/ned/08/ned0825.c b/app/ned/08/ned0825.c new file mode 100644 index 0000000000000000000000000000000000000000..f3b926d506a0188d323a6d26aed9f8ffdaac554a --- /dev/null +++ b/app/ned/08/ned0825.c @@ -0,0 +1,143 @@ +/* + * FILE %ned/08/ned0825.c + * + * Einlesen einer SGML Tagging Sequence + * + * written: 1991 02 07 + * 1991 06 01: Revision + * latest update: 1999-04-25 16:32:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/streams.h> +#include "ed.h" +#include "edhyx.h" +#include "message.h" +#include "proto.h" + +#ifdef __COMMENT__ /* 1993-06-29 09:30 */ +T2D: ++ flag: Blanks in Entity erlaubt oder nicht ++ maximale Laenge des Strings + -> Bei Fehler: Pufferinhalt als Replacement String + in diesem Fall: rc= 3 (transparent tag) +#endif /* __COMMENT__ */ + +/* ------------------------------------------------------------------------ */ +#define LIN_SIZ 1024 /* T2D: should be global constant */ +static char lin [LIN_SIZ]; /* intermediate buffer for up to LIN_SIZ */ + /* characters used to identify the tag */ + /* or entity. */ + +/* ------------------------------------------------------------------------ */ +int rd_sgml_tag ( +struct WINDOWCTRL *wc, /* betroffenes Window */ +struct LINE *lpt, /* line where feature is attached to */ +struct STREAM_OBJECT *so, /* Input file stream from .hyx file */ +struct FEATURE **fp, /* Feature Liste der bearbeiteten Zeile */ +int idx, /* Spaltennummer im eingelesenen File */ +int feature_type, /* Ftype_SGML_TAG | Ftype_SGML_ENTITY */ +int delimiter1, /* oeffnender Delimiter fuer Feature Text */ +int delimiter2, /* schliessender Delimiter fuer Feature Text*/ +char *repl_array, /* spaeter einzusetzender Replace Text */ +int *repl_size, /* Laenge des einzusetzenden Texts */ +int repl_max) /* Groesse des Replace Text Puffers */ +/* Return: -1 .. error */ +/* 0 .. tagging sequence read */ +/* 1 .. feature record destroyed again (some entities) */ +{ + struct FEATURE *f; /* angelegtes Feature Record */ + register struct TXT *tx= /* Text Segment in der Zeile */ + (struct TXT *) 0; + struct LINE *lp; /* Feature Line */ + int tc; /* gelesenes Zeichen */ + int xlng= 0; /* Laenge des Feature Texts */ + int watchout= 32000; /* watchout counter fuer Strukturfehler */ + int lin_idx= 0; + int rc; + STREAM_next_char *_fgetc; + STREAM_end *_feof; + + if ((f= ned_new_feature (idx, feature_type)) == (struct FEATURE *) 0) + return -1; + + lp= f->ftr_text_line; + _fgetc= so->next_char; + _feof= so->is_end; + + if (delimiter1 == '&') + { /* 64 chars entities is long enough! */ + /* actually, ISO 8879 defines that entity names must only */ + /* be 8 chracters long. This is much longer... */ + watchout= 64; + } + + /* read feature text */ + tc= delimiter1; /* first character is tag opener */ + goto FIRST_READ; + + while (1) + { + tc= (*_fgetc) (so) & 0x00FF; + if ((*_feof) (so)) break; + + if (lin_idx < LIN_SIZ) lin [lin_idx++]= (char) tc; + + if (watchout-- < 0) + { + switch (feature_type) + { + case Ftype_SGML_TAG: ned_error_message ("SGML Tag error!\n"); break; + case Ftype_SGML_ENTITY: ned_error_message ("SGML Entity error!\n"); break; + default: ned_error_message ("SGML error!\n"); break; + } + return -1; + } + +FIRST_READ: + if ((xlng % TXT_LNG) == 0) /* Textsegment aufgebraucht */ + if (xlng == 0) /* 1. Textsegment */ + { /* first text segment */ + lp->txt= tx= txch_alloc (TXT_LNG, 0x20); + } + else + { /* more text segments */ + tx->next= txch_alloc (TXT_LNG, 0x20); + tx= tx->next; + } + + if (tx == (struct TXT *) 0) + { + ned_error_message (ERR_MEMORY); + return -1; + } + + tx->t [xlng % TXT_LNG] = (char) tc; + xlng++; + if (tc == delimiter2 || (delimiter2 == ';' && tc <= 0x20)) break; + } + + lin [--lin_idx]= 0; + lp->lng= xlng; + + rc= ned_identify_feature (wc, lpt, idx, feature_type, f, lin, + repl_array, repl_size, repl_max); + + if (rc == 0) + { /* normal operation: sort in feature in list */ + ned_insert_feature (fp, f); + } + else + { /* error or no feature needed: destroy feature record again */ + ned_lines_free (lp); + free (f); + } + + return rc; +} diff --git a/app/ned/08/ned0826.c b/app/ned/08/ned0826.c new file mode 100644 index 0000000000000000000000000000000000000000..e9a22b0f281629341d2f4ce8e8ebbc76718655dc --- /dev/null +++ b/app/ned/08/ned0826.c @@ -0,0 +1,93 @@ +/* + * FILE %ned/08/ned0826.c + * + * written: 1991 06 25: Revision + * latest update: 1996-07-26 3:15:10 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int find_feature ( +struct LINE *lp, /* line to start from */ +int direction, /* Bit 0==0: up */ + /* 0==1: down */ + /* 1==0: Start @lp */ + /* 1==1: Start @(top|bottom) */ +char *feature_name, /* name of feature to search */ +struct LINE **found_line, /* line of found feature */ +int *nr_found_line, /* number of found feature (preset!!!) */ +struct FEATURE **found_feature) /* feature to start from if available */ +/* Return: -1 ... error */ +/* 0 ... feature not found */ +/* 1 ... feature found */ +{ + struct LINE *fl; + struct FEATURE *ft; + int lin_num; + int fnl; + char *tp; + + if (lp == (struct LINE *) 0) return -1; + + lin_num= *nr_found_line; + fnl= strlen (feature_name); + + if (direction & 0x02) /* lp an Anfang oder Ende stellen? */ + { + if (direction & 0x01) + { /* lp an den Anfang des Files stellen */ + for (; lp->prev != (struct LINE *) 0; lp= lp->prev); + lin_num= 1; + } + else + { /* lp an das Ende des Files stellen */ + for (; lp->next != (struct LINE *) 0; lp= lp->next) lin_num++; + } + } + + /* find next feature in same line, if a valid feature is given */ + if (lp != (struct LINE *) 0 && *found_feature != (struct FEATURE *) 0) + for (ft= lp->ftr; ft != (struct FEATURE *) 0; ft= ft->ftr_next) + if (ft == *found_feature) goto NEXT_IN_LINE; + + while (lp != (struct LINE *) 0) + { + for (ft= lp->ftr; ft != (struct FEATURE *) 0; ft= ft->ftr_next) + { +NEXT_IN_LINE: + fl= (struct LINE *) ft->ftr_text_line; + if (fl != (struct LINE *) 0 + && fl->txt != (struct TXT *) 0 + && (tp= fl->txt->t) != (char *) 0 + && strncmp (&tp[1], feature_name, fnl) == 0 + && (tp[fnl+1] == ' ' || tp[fnl+1] == '>')) + { + *found_line= lp; + *nr_found_line= lin_num; + *found_feature= ft; + return 1; + } + } + + if (direction & 0x01) + { + lp = lp->next; + lin_num++; + } + else + { + lp = lp->prev; + lin_num--; + } + } + + return 0; +} diff --git a/app/ned/08/ned0827.c b/app/ned/08/ned0827.c new file mode 100644 index 0000000000000000000000000000000000000000..7b6ff6da43c6c1a65de059a20ffbc4786de9b42d --- /dev/null +++ b/app/ned/08/ned0827.c @@ -0,0 +1,107 @@ +/* + * FILE %ned/08/ned0827.c + * + * written: 1991 06 25 + * latest update: 1997-12-05 11:42:55 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/hyx.h> +#include "ed.h" +#include "proto.h" + +#define LIN_SIZ 1024 + +/* ------------------------------------------------------------------------ */ +int find_feature_with_attribute ( +struct LINE *lp, /* line to start from */ +int direction, /* Bit 0==0: up */ + /* 0==1: down */ + /* 1==0: Start @lp */ + /* 1==1: Start @(top|bottom) */ +char *feature_name, /* name of the SGML tag to search */ +char *attribute_name, /* name of the attribute to search */ +char *attribute_value, /* value of the attribute to search */ + /* ? ... accept any value */ +struct LINE **found_line, /* line of found feature */ +int *nr_found_line, /* number of found feature (preset!!!) */ +struct FEATURE **found_feature) /* found feature record */ +/* Return: -1 ... error */ +/* 0 ... feature not found */ +/* 1 ... feature found */ +{ + struct LINE *fl; + int rc; + char lin [LIN_SIZ]; + char *id; + int avl; + + if (lp == (struct LINE *) 0) return -1; + + avl= strlen (attribute_value); + + while (lp != (struct LINE *) 0) + { + *found_feature= (struct FEATURE *) 0; +NEXT_IN_LINE: + rc= find_feature (lp, direction, feature_name, + found_line, nr_found_line, found_feature); + direction &= 0xFFFD; + + switch (rc) + { + case -1: + return -1; + + case 1: + fl= (struct LINE *) (*found_feature)->ftr_text_line; + if (ned_line_2_string (fl, 1, fl, fl->lng-1, lin, LIN_SIZ, + 0L, 0x0000) == (char *) 0) + break; + + id= find_attr_name (lin, attribute_name); + if (id != (char *) 0 + &&(strcmp (attribute_value, "?") == 0 + ||(strncmp (id, attribute_value, avl) == 0 + && ((rc=id[avl]) == ' ' || rc == 0) + ) + ||(*id=='\"' + && strncmp (id+1, attribute_value, avl) == 0 + && id[avl+1] == '\"' + ) + ) + ) + return 1; + + lp= *found_line; + + if (*found_feature != (struct FEATURE *) 0 + && (*found_feature= (*found_feature)->ftr_next) + != (struct FEATURE *) 0 + ) + goto NEXT_IN_LINE; + + if (direction & 0x01) + { + lp= lp->next; + (*nr_found_line)++; + } + else + { + lp= lp->prev; + (*nr_found_line)--; + } + break; + + case 0: + return 0; + } + } + + return 0; +} diff --git a/app/ned/08/ned0828.c b/app/ned/08/ned0828.c new file mode 100644 index 0000000000000000000000000000000000000000..fa368504eed59e1ca13f84f891b7a689d596b221 --- /dev/null +++ b/app/ned/08/ned0828.c @@ -0,0 +1,305 @@ +/* + * FILE %ned/08/ned0828.c + * + * Identifizieren eines SGML Tags oder einer Entity + * + * written: 1991 07 01 + * 1991 10 30: get external tag setup information + * latest update: 1997-08-03 22:10:29 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" +#include <gg/convent.h> +#include <gg/strings.h> +#include <gg/window.h> +#include <gg/hyx.h> +#include <gg/dpp.h> + +#define ATTR_VALUE_SIZE 60 +static char attr_value [ATTR_VALUE_SIZE]; + +extern struct SGML_TAG_DESCRIPTOR _STD_NULL; +extern struct SGML_TAG_DESCRIPTOR _STD_PSEUDO; +extern int COL_FRAME_TAGS; +extern int COL_UNKNOWN_FEATURE; +extern int CHR_UNKNOWN_FEATURE; + +/* ------------------------------------------------------------------------ */ +void copy_tag ( +char *dst, +char *src, +int max_dst, +int mode) +{ + int ch; + + if (max_dst < 3) goto STOP; + + *dst++ = '<'; + max_dst--; + while (--max_dst > 1) + { + if ((ch= *src++ & 0x00FF) == 0) break; + + if (mode == STD_display_tag_name + && (ch == ' ' || ch == '\t' || ch == 0x0A || ch == 0x0D) + ) break; + + *dst++= (char) ch; + } + + *dst++ = '>'; +STOP: + *dst = 0; + + return; +} + +/* ------------------------------------------------------------------------ */ +int ned_identify_feature ( +struct WINDOWCTRL *wc, /* window where all that happens */ +struct LINE *lp, /* line to which feature is attached */ +int offset, /* offset in line where */ +int feature_type, /* general class, such as Ftype_SGML_TAG */ +struct FEATURE *ft, /* feature to be identified */ +char *lin, /* buffer containing feature to identify */ +char *repl_array, /* buffer to place replacement code into */ +int *repl_size, /* used space in that buffer */ +int repl_max) /* maximum size of that buffer */ +/* Return: -1 .. error; 0 .. ok; 1 .. feature not needed (but defined) */ +{ + int ev; + struct SGML_TAG_DESCRIPTOR *tag_desc= (struct SGML_TAG_DESCRIPTOR *) 0; + int f_builtin_dispopt= 0; /* flag to indicate built in display option */ + int f_entity_valid; + + if (repl_max <= 0 || ft == (struct FEATURE *) 0) return -1; + + *repl_size= 0; + ft->ftr_colour= COL_DEF_FEATURE; + ft->ftr_display_mode= FTR_display_point; + ft->ftr_duplication= FTR_dup_allways; + ft->ftr_replarray_size= 1; + + switch (feature_type) + { + case Ftype_SGML_ENTITY: + ev= find_pc_sgml_entity (lin); + f_entity_valid= (ev >= 0x00 && ev <= 0xFF); + ft->ftr_colour= (f_entity_valid) + ? COL_DEF_TEXT : COL_UNKNOWN_FEATURE; + + if (!f_entity_valid) ev= CHR_UNKNOWN_FEATURE; + *repl_array= (char) ev; + *repl_size= 1; + ft->ftr_display_mode= FTR_display_replarray; + ft->ftr_replarray_size= 1; + return (f_entity_valid) ? 1 : 0; + + case Ftype_SGML_TAG: + /* Built in tag display options: hyx.l */ + if ((strncmp (lin, "hyx.l ", 6) == 0 + || strncmp (lin, "HLINK ", 6) == 0 + ) + && wc != (struct WINDOWCTRL *) 0 /* Logic Link Info */ + ) /* kommt ins WINDOW */ + { + ev= wc->wc_ll_flags; + if (find_attr_value (lin, attr_value, ATTR_VALUE_SIZE, "dir") != -1) + { + if (strcmp (attr_value, "next") == 0) ev |= LL_next; else + if (strcmp (attr_value, "prev") == 0) ev |= LL_prev; else + if (strcmp (attr_value, "up" ) == 0) ev |= LL_up; else + if (strcmp (attr_value, "lang") == 0) ev |= LL_lang; else + if (strcmp (attr_value, "sort") == 0) ev |= LL_sort; else + if (strcmp (attr_value, "view") == 0) ev |= LL_view; else + +#ifdef LL_BUTTONS_1 + if (strcmp (attr_value, "menu") == 0) + { /* only when there are no other logic links */ + if (!(ev & LL_more)) ev |= LL_menu; + } + else + { /* other logic links override menu link */ + ev |= LL_more; + ev &= ~LL_menu; + } +#endif + +#ifdef LL_BUTTONS_2 + if (strcmp (attr_value, "menu") == 0) ev |= LL_menu; else + ev |= LL_more; +#endif + } + else ev |= LL_; + + wc->wc_ll_flags= ev; + } + +#ifdef LATER /* testing out problems ... */ + if (strncmp (lin, "stamp ", 6) == 0) return 1; /* -> destroy tag */ +#endif + + /* Built in tag display options: Frame */ + if (strncmp (lin, "Frame ", 6) == 0 + || strncmp (lin, "hyx.f ", 6) == 0 + || lin [0] == ':' + ) + { + f_builtin_dispopt=1; + ft->ftr_colour= COL_FRAME_TAGS; + ft->ftr_display_mode= FTR_display_replarray; +#ifndef V1 + strcpy (repl_array, "<Frame>"); + ft->ftr_replarray_size= *repl_size = 7; +#else + if (strlen (lin) > repl_max-2) lin [strlen(lin)-3]= 0; + sprintf (repl_array, "<%s>", lin); + ft->ftr_replarray_size= *repl_size= strlen (repl_array); +#endif + ft->ftr_duplication= STD_dont_delete; /* thus: STD_no_dup!! */ + ft->ftr_edit_flags= FTR_EDIT_PROTECTED; + } /* <Frame> */ + + /* Built in tag display options: /Frame */ + if (strncmp (lin, "/Frame", 6) == 0 + || strncmp (lin, "/hyx.f", 6) == 0 + || lin [0] == ';' + ) + { + f_builtin_dispopt= 1; + ft->ftr_colour= COL_FRAME_TAGS; +#ifndef V1 + strcpy (repl_array, "</Frame>"); + ft->ftr_replarray_size= *repl_size= 8; +#else + if (strlen (lin) > repl_max-2) lin [strlen(lin)-3]= 0; + sprintf (repl_array, "<%s>", lin); + ft->ftr_replarray_size= *repl_size= strlen (repl_array); +#endif + ft->ftr_display_mode= FTR_display_replarray; + ft->ftr_duplication= STD_dont_delete; /* thus: STD_no_dup!! */ + ft->ftr_edit_flags= FTR_EDIT_PROTECTED; + } /* </Frame> */ + + /* externally defined display options for a tag */ + tag_desc= find_sgml_tag_descriptor (lin); + + if (tag_desc != (struct SGML_TAG_DESCRIPTOR *) 0 + && f_builtin_dispopt + && tag_desc->STD_tag_mm == 1 + ) + tag_desc= (struct SGML_TAG_DESCRIPTOR *) 0; + + if (tag_desc == (struct SGML_TAG_DESCRIPTOR *) 0 + && !f_builtin_dispopt + ) tag_desc= &_STD_NULL; + + if (tag_desc != (struct SGML_TAG_DESCRIPTOR *) 0) + { + ft->ftr_subtype= tag_desc->STD_tag_id; + ft->ftr_display_mode= tag_desc->STD_display_mode; + ft->ftr_colour= tag_desc->STD_display_colour; + ft->ftr_replarray_size= + *repl_size= tag_desc->STD_replarray_size; + + strcpy_max (repl_array, + (tag_desc->STD_replarray == (char *) 0) + ? "<?>" : tag_desc->STD_replarray, + repl_max); + + ft->ftr_weight= tag_desc->STD_weight; + ft->ftr_duplication= tag_desc->STD_duplication; + } + + /* override tag display mode, if configured this way */ + switch (wc->wc_tag_display_mode) + { /* T2D: coordinate names of constants */ + case WCTDM_show_tag: + ft->ftr_display_mode= STD_display_tag_name; + break; + case WCTDM_show_full_tag: + ft->ftr_display_mode= STD_display_tag; + break; + } + + if (ft->ftr_display_mode == STD_display_tag + || ft->ftr_display_mode == STD_display_tag_name + ) + { + copy_tag (repl_array, lin, repl_max, ft->ftr_display_mode); + ft->ftr_display_mode= STD_display_replarray; + ft->ftr_replarray_size= *repl_size= strlen (repl_array); + } + + /* explicitly declared display options */ + if (wc->wc_tag_display_mode == WCTDM_normal) + { + if (find_attr_value (lin, attr_value, ATTR_VALUE_SIZE, "td") != -1) + { + if (strcmp (attr_value, "h") == 0) + { + ft->ftr_display_mode= FTR_display_hide; + } else + if (strcmp (attr_value, "p") == 0) + { + ft->ftr_display_mode= FTR_display_point; + } else + if (strcmp (attr_value, "r") == 0) + { + ft->ftr_display_mode= FTR_display_region; + ft->ftr_replarray_size= 1; + } + *repl_size= 0; + } + + if (find_attr_value (lin, attr_value, ATTR_VALUE_SIZE, "tdp") != -1) + { + ft->ftr_replarray_size= (int) get_parameter_value (attr_value); + ft->ftr_display_mode= FTR_display_point; + *repl_size= 0; + } + } + + if (find_attr_value (lin, repl_array, repl_max, "tds") != -1) + { + *repl_size= ft->ftr_replarray_size= strlen (repl_array); + ft->ftr_display_mode= FTR_display_replarray; + } + + if (find_attr_value (lin, attr_value, ATTR_VALUE_SIZE, "tdc") != -1) + { + ft->ftr_colour= identify_colour_code (attr_value); + } + + if (find_attr_value (lin, attr_value, ATTR_VALUE_SIZE, "bgcol") != -1) + { + wc->attr_text= identify_colour_code (attr_value); + } + + if (find_attr_value (lin, attr_value, ATTR_VALUE_SIZE, "marker") != -1) + { + struct MARKER *m; + + if (lp != (struct LINE *) 0 + && (m= ned_get_marker (*attr_value & 0x00FF, 1)) + != (struct MARKER *) 0 + ) + ned_set_marker2 (wc, lp, offset, m); + } + + return 0; + + default: + return 0; + } +} diff --git a/app/ned/08/ned0829.c b/app/ned/08/ned0829.c new file mode 100644 index 0000000000000000000000000000000000000000..68675a76208ee952a0efefe778a6a74ed5c63f9e --- /dev/null +++ b/app/ned/08/ned0829.c @@ -0,0 +1,42 @@ +/* + * FILE %ned/08/ned0829.c + * + * insert a feature record into a feature list + * + * written: 1996-07-25 + * latest update: 1996-07-25 21:23:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_insert_feature ( +struct FEATURE **fp, /* feature list */ +struct FEATURE *f) /* feature entry to be inserted */ +{ + int insert_position= 0; + struct FEATURE *f2; + int ftr_pos; + + ftr_pos= f->ftr_pos; + + for (;; fp= &f2->ftr_next) + { + if ((f2= *fp) == (struct FEATURE *) 0 || f2->ftr_pos > ftr_pos) + { + f->ftr_next= f2; + *fp= f; + break; + } + + insert_position++; + } + + return insert_position; +} diff --git a/app/ned/08/ned0830.c b/app/ned/08/ned0830.c new file mode 100644 index 0000000000000000000000000000000000000000..b144bb398c2dd4f2d1eb46b3aa825ba8b4ce877e --- /dev/null +++ b/app/ned/08/ned0830.c @@ -0,0 +1,153 @@ +/* + * FILE %ned/08/ned0830.c + * + * ###### TO BE REVISED !!!!! ##### + * *** NOT USED *** + * + * written: 1991 07 01 + * latest update: 1999-04-25 16:32:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "ed.h" +#include "edhyx.h" +#include <gg/window.h> +#include "proto.h" + +#ifndef MAX_ENTITY_NAME +#define MAX_ENTITY_NAME 48 +#endif + +/* ------------------------------------------------------------------------ */ +static struct SGML_ENTITY_DESCRIPTOR *entity_table= + (struct SGML_ENTITY_DESCRIPTOR *) 0; +static struct SGML_ENTITY_DESCRIPTOR **entity_append= &entity_table; + +/* ------------------------------------------------------------------------ */ +int setup_sgml_entity_descriptors (char *setup_file_name) +{ +#ifdef MSDOS + setup_file_name; +#endif + +#ifdef JUNK + FILE *fi; + struct SGML_ENTITY_DESCRIPTOR *st; + + char tag_name [MAX_TAG_NAME]; + int tag_id; + int display_mode; + int display_colour; + int display_character; + int duplication; + + if (setup_file_name == (char *) 0 || *setup_file_name == 0) return -1; + fi = fopen (setup_file_name, FILE_TEXT_READ); + if (fi == (FILE *) 0) return -1; + + for (;;) + { + fscanf (fi, "%s", tag_name); + if (feof (fi)) break; + if (tag_name [0] == '#') + { + while (!feof(fi) && fgetc(fi)!='\n'); + continue; + } + fscanf (fi, "%x%x%x%x%x", + &tag_id, + &display_mode, + &display_colour, + &display_character, + &duplication); + if (feof (fi)) break; + + st = calloc (sizeof (struct SGML_ENTITY_DESCRIPTOR), 1); + if (st == (void *) 0) break; + st->STD_tag_name = strdup (tag_name); + st->STD_tag_id = tag_id; + st->STD_display_mode = display_mode; + st->STD_display_colour = display_colour; +/** st->STD_display_character=display_character; ############## */ + st->STD_duplication = duplication; + st->STD_next = (struct SGML_TAG_DESCRIPTOR *) 0; + + *entity_append = st; + entity_append = &st->STD_next; + } + fclose (fi); +#endif + + return 0; +} + +/* ------------------------------------------------------------------------ */ +void reset_sgml_entity_descriptors () +{ +#ifdef JUNK + struct SGML_ENTITY_DESCRIPTOR *st1, *st2; + + for (st1 = entity_table; (st2=st1) != (void *) 0;) + { + st1 = st1->STD_next; + free (st2); + } +#endif + + entity_table= (struct SGML_ENTITY_DESCRIPTOR *) 0; + entity_append= &entity_table; +} + +/* ------------------------------------------------------------------------ */ +struct SGML_ENTITY_DESCRIPTOR *get_sgml_entity_descriptor (int tag_id) +{ +#ifdef MSDOS + tag_id; +#endif + +#ifdef JUNK + struct SGML_ENTITY_DESCRIPTOR *st; + + for (st = entity_table; + st != (void *) 0; + st = st->STD_next) + if (st->STD_tag_id == tag_id) return st; +#endif + + return (void *) 0; +} + +/* ------------------------------------------------------------------------ */ +struct SGML_ENTITY_DESCRIPTOR *find_sgml_entity_descriptor (char *tag) +{ +#ifdef MSDOS + tag; +#endif + +#ifdef JUNK + struct SGML_ENTITY_DESCRIPTOR *st; + int ml, cml; + + for (st = entity_table; + st != (void *) 0; + st = st->STD_next) + { + if (st->STD_tag_name == (char *) 0) continue; + ml = st->STD_tag_ml; + cml = tag[ml]; + if (strncmp (st->STD_tag_name, tag, ml) == 0 + && (st->STD_tag_mm == 1 + || cml==0x20 || cml==0 || cml==0x09 || cml==0x0A || cml==0x0D)) + return st; + } +#endif + + return (void *) 0; +} diff --git a/app/ned/08/ned0831.c b/app/ned/08/ned0831.c new file mode 100644 index 0000000000000000000000000000000000000000..ac3458200dcc6c7000bbc77bb3c45c95e0b93a61 --- /dev/null +++ b/app/ned/08/ned0831.c @@ -0,0 +1,397 @@ +/* + * FILE %ned/08/ned0831.c + * + * written: 1991 01 30 + * latest update: 1999-04-25 16:32:53 + * $Id: ned0831.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include "ed.h" +#include "edhyx.h" +#include <gg/window.h> +#include "proto.h" + +#ifndef MAX_TAG_NAME +#define MAX_TAG_NAME 48 +#endif + +static int cdecl dummy (char *str, int opt); +static int dummy (char *str, int opt) { opt= *str; return 0; } + +/* ------------------------------------------------------------------------ */ +#define LAST_ONE _STD_NED_PARAMETER +static struct SGML_TAG_DESCRIPTOR _STD_NED_PARAMETER = +{ + (struct SGML_TAG_DESCRIPTOR *) 0, + "ned.par", + 7, + 0, + STID_NED_PARAMETER, + eval_ned_parameter, + dummy, + STD_display_hide, + WV_GELB, + STD_no_dup, /* STD_duplication */ + 0, /* STD_subtype */ + 100, + 0, + (char *) 0 +#ifdef DEVEL1 + , + 0,0,0,0 +#endif +} ; + +/* ------------------------------------------------------------------------ */ +#ifdef VW5 +static struct SGML_TAG_DESCRIPTOR _STD_SOPH_Ans = +{ + &_STD_NED_PARAMETER, + "Ans", + 3, + 0, + 1999, /* ID code */ + dummy, + dummy, + STD_display_hide, + WV_GELB, + STD_dup_copy, + 0, /* STD_subtype */ + 100, + 0, + (char *) 0 +#ifdef DEVEL1 + , + 0,0,0,0 +#endif +} ; + +#endif + +/* ------------------------------------------------------------------------ */ +static struct SGML_TAG_DESCRIPTOR _STD_NED_MACRO = +{ +#ifdef VW5 + &_STD_SOPH_Ans, +#else + &_STD_NED_PARAMETER, +#endif + "ned.mac", + 7, + 0, + STID_NED_MACRO, + eval_ned_macro, + dummy, + STD_display_hide, + WV_GELB, + STD_dup_copy, + 0, /* STD_subtype */ + 100, + 0, + (char *) 0 +#ifdef DEVEL1 + , + 0,0,0,0 +#endif +} ; + +/* ------------------------------------------------------------------------ */ +static struct SGML_TAG_DESCRIPTOR _STD_HLINK = +{ + &_STD_NED_MACRO, /* STD_next */ + "HLINK", /* STD_tag_name */ + 5, /* STD_tag_ml */ + 0, /* STD_tag_mm */ + STID_hyx_l, /* STD_tag_id */ + ned_eval_hlink, /* STD_activated */ + dummy, /* STD_scanned */ + STD_display_point, /* STD_display_mode */ + WV_WEISS|W_HELL, /* STD_display_colour */ + STD_dup_copy|STD_dup_write, /* STD_duplication */ + 0, /* STD_subtype */ + 100, /* STD_weight */ +#ifdef V1 + 1, /* STD_replarray_size */ + "*", /* STD_replarray */ +#else + 0, /* STD_replarray_size */ + (char *) 0 /* STD_replarray */ +#endif +#ifdef DEVEL1 + , + 0, + 0, + 0, + 0 /* STD_new# */ +#endif +} ; + +/* ------------------------------------------------------------------------ */ +static struct SGML_TAG_DESCRIPTOR _STD_hyx_l = +{ + &_STD_HLINK, /* STD_next */ + "hyx.l", /* STD_tag_name */ + 5, /* STD_tag_ml */ + 0, /* STD_tag_mm */ + STID_hyx_l, /* STD_tag_id */ + ned_eval_hlink, /* STD_activated */ + dummy, /* STD_scanned */ + STD_display_point, /* STD_display_mode */ + WV_WEISS|W_HELL, /* STD_display_colour */ + STD_dup_copy|STD_dup_write, /* STD_duplication */ + 0, /* STD_subtype */ + 100, /* STD_weight */ +#ifdef V1 + 1, /* STD_replarray_size */ + "*" /* STD_replarray */ +#else + 0, /* STD_replarray_size */ + (char *) 0 /* STD_replarray */ +#endif +#ifdef DEVEL1 + , + 0, + 0, + 0, + 0 /* STD_new# */ +#endif +} ; + +/* ------------------------------------------------------------------------ */ +static struct SGML_TAG_DESCRIPTOR _STD_a = /* HTML anchor */ +{ + &_STD_hyx_l, /* STD_next */ + "a", /* STD_tag_name */ + 1, /* STD_tag_ml */ + 0, /* STD_tag_mm */ + STID_hyx_l, /* STD_tag_id */ + ned_eval_hlink, /* STD_activated */ + dummy, /* STD_scanned */ + STD_display_point, /* STD_display_mode */ + WV_WEISS|W_HELL, /* STD_display_colour */ + STD_dup_copy|STD_dup_write, /* STD_duplication */ + 0x0001, /* STD_flags (formerly STD_subtype) */ + 100, /* STD_weight */ +#ifdef V1 + 1, /* STD_replarray_size */ + "*" /* STD_replarray */ +#else + 0, /* STD_replarray_size */ + (char *) 0 /* STD_replarray */ +#endif +#ifdef DEVEL1 + , + 0, + 0, + 0, + 0 /* STD_new# */ +#endif +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_TAG_DESCRIPTOR _STD_PSEUDO = +{ + &_STD_a, + (char *) 0, + 0, + 0, + STID_PSEUDO, + dummy, + dummy, + STD_display_replarray,/* Pseudo Character f�r Tag einsetzen */ + /* normalerweise ist das das evaluierte Zeichen */ + WV_GELB, /* ### */ + STD_no_dup, /* ### */ + 0, /* STD_subtype */ + 100, + 1, + "\x03" +#ifdef DEVEL1 + , + 0,0,0,0 +#endif +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_TAG_DESCRIPTOR _STD_NULL = +{ + &_STD_PSEUDO, + (char *) 0, + 0, + 0, + STID_NULL, + dummy, + dummy, + STD_display_point, + WV_GELB|W_HELL, + STD_dup_always, + 0, /* STD_subtype */ + 100, + 0, + (char *) 0 +#ifdef DEVEL1 + , + 0,0,0,0 +#endif +} ; + +/* ------------------------------------------------------------------------ */ +static struct SGML_TAG_DESCRIPTOR + *tag_table = &_STD_NULL, + **tag_append = &((LAST_ONE).STD_next); + +/* ------------------------------------------------------------------------ */ +int setup_sgml_tag_descriptors (const char *setup_file_name) +{ + FILE *fi; + struct SGML_TAG_DESCRIPTOR *st; + + char *tag_name; + char *repl_array; + int tag_id; + int tag_mm; + int display_mode; + int display_colour; + int duplication; + + int rc; + int sc; +#define MAX_BUFFER 128 +#define MAX_FIELDS 10 + char *buffer= (char *) 0; + char *fields [MAX_FIELDS]; + + if (setup_file_name == (char *) 0 + || *setup_file_name == 0 + || (fi= fopen (setup_file_name, "rb")) == (FILE *) 0 + || (buffer= malloc (MAX_BUFFER)) == (char *) 0 + ) return -1; + + for (;;) + { + rc= fread_line (fi, buffer, MAX_BUFFER); + if (rc <= 0 && feof (fi)) break; + if (buffer [0] == '#') continue; + + sc= isolate_tokens (buffer, fields, MAX_FIELDS); + if (sc < 6) continue; + + tag_name= fields [0]; + tag_id= (int) get_parameter_value (fields [1]); + tag_mm= (int) get_parameter_value (fields [2]); + display_mode= (int) get_parameter_value (fields [3]); + display_colour= (int) get_parameter_value (fields [4]); + duplication= (int) get_parameter_value (fields [5]); + repl_array= (sc >= 6) ? fields [6] : (char *) 0; + + st= find_sgml_tag_descriptor (tag_name); + if (st == (void *) 0) + { + if ((st= (struct SGML_TAG_DESCRIPTOR *) + calloc (sizeof (struct SGML_TAG_DESCRIPTOR), 1)) + == (struct SGML_TAG_DESCRIPTOR *) 0) break; + + if (strcmp (tag_name, "*") == 0) + { + st->STD_tag_name= ""; + st->STD_tag_ml= 0; + st->STD_tag_mm= 1; + } + else + { + st->STD_tag_name= strdup (tag_name); + st->STD_tag_ml= strlen (tag_name); + st->STD_tag_mm= tag_mm; + } + /* st->STD_next= (struct SGML_TAG_DESCRIPTOR *) 0; ... calloc'ed */ + *tag_append= st; + tag_append= &st->STD_next; + } + + st->STD_tag_id= tag_id; + st->STD_display_mode= display_mode; + st->STD_display_colour= display_colour; + st->STD_duplication= duplication; + + /* st->STD_replarray_size= 0; ... calloc'ed */ + /* st->STD_replarray= (char *) 0; ... calloc'ed */ + + if (repl_array != (char *) 0) + { + st->STD_replarray_size= strlen (repl_array); + st->STD_replarray= strdup (repl_array); + } + } + + fclose (fi); + free_or_what (buffer); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +void reset_sgml_tag_descriptors () +{ + struct SGML_TAG_DESCRIPTOR *st1, *st2; + + for (st1= (LAST_ONE).STD_next; + (st2= st1) != (struct SGML_TAG_DESCRIPTOR *) 0;) + { + st1= st1->STD_next; + free_or_what (st2->STD_tag_name); + free_or_what (st2->STD_replarray); + free (st2); + } + + tag_table= &_STD_NULL; + tag_append= &((LAST_ONE).STD_next); +} + +/* ------------------------------------------------------------------------ */ +struct SGML_TAG_DESCRIPTOR *get_sgml_tag_descriptor (int tag_id) +{ + struct SGML_TAG_DESCRIPTOR *st; + + for (st= tag_table; + st != (struct SGML_TAG_DESCRIPTOR *) 0; + st= st->STD_next) + if (st->STD_tag_id == tag_id) return st; + + return (struct SGML_TAG_DESCRIPTOR *) 0; +} + +/* ------------------------------------------------------------------------ */ +struct SGML_TAG_DESCRIPTOR *find_sgml_tag_descriptor (char *tag) +{ + struct SGML_TAG_DESCRIPTOR *st; + int ml, cml; + + if (tag == (char *) 0) return (struct SGML_TAG_DESCRIPTOR *) 0; + + for (st= tag_table; + st != (struct SGML_TAG_DESCRIPTOR *) 0; + st= st->STD_next) + { + if (st->STD_tag_name == (char *) 0) continue; + ml= st->STD_tag_ml; + cml= tag[ml]; + + if (strncmp (st->STD_tag_name, tag, ml) == 0 + && (st->STD_tag_mm == 1 + || cml==0x20 || cml==0 || cml==0x09 || cml==0x0A || cml==0x0D)) + return st; + } + + return (struct SGML_TAG_DESCRIPTOR *) 0; +} diff --git a/app/ned/08/ned0832.c b/app/ned/08/ned0832.c new file mode 100644 index 0000000000000000000000000000000000000000..e81b9b8891c452abd8afbdb36e74f269e6096737 --- /dev/null +++ b/app/ned/08/ned0832.c @@ -0,0 +1,24 @@ +/* + * FILE ~/usr/ned/08/ned0832.c + * + * Umschaltung in das File Format SGML + * + * written: 1991 02 07 + * latest update: 1994-04-10 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_format_SGML () +{ + aw->file_format= FMT_SGML; +} diff --git a/app/ned/08/ned0833.c b/app/ned/08/ned0833.c new file mode 100644 index 0000000000000000000000000000000000000000..11a935bef7f61852dab21f2443352d305116c5c9 --- /dev/null +++ b/app/ned/08/ned0833.c @@ -0,0 +1,24 @@ +/* + * FILE ~/usr/ned/08/ned0833.c + * + * Umschaltung in das File Format ASCII + * + * written: 1991 02 07 + * latest update: 1994-07-10 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_format_ASCII () +{ + aw->file_format= FMT_ASCII; +} diff --git a/app/ned/08/ned0834.c b/app/ned/08/ned0834.c new file mode 100644 index 0000000000000000000000000000000000000000..c7eda8bb1175f3d1c2fcbf4a24b91de2faa14ea2 --- /dev/null +++ b/app/ned/08/ned0834.c @@ -0,0 +1,32 @@ +/* + * FILE ~/usr/ned/08/ned0834.c + * + * Evaluierung eines Strings + * + * written: 1991 05 23 + * latest update: 1998-08-16 12:40:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_eval_string (char *str, int option) +{ + struct SGML_TAG_DESCRIPTOR *std; + +ned_message_2 ("eval_string: ", str); + /* Suchen der 'zustaendigen' Feature Type Definition */ + if ((std= find_sgml_tag_descriptor (str)) + == (struct SGML_TAG_DESCRIPTOR *) 0 + || std->STD_activated == (void *) 0) return 0; + + /* Aufruf der Handler Funktion */ + return (*std->STD_activated) (str, option); +} diff --git a/app/ned/08/ned0835.c b/app/ned/08/ned0835.c new file mode 100644 index 0000000000000000000000000000000000000000..5029c51abad5bb76827bc80488cba51701880988 --- /dev/null +++ b/app/ned/08/ned0835.c @@ -0,0 +1,28 @@ +/* + * FILE %ned/08/ned0835.c + * + * prompt for a string and evaluate it + * (hardly used function!) + * + * written: 1991 05 23 + * latest update: 2001-02-11 12:49:23 + * $Id: ned0835.c,v 1.2 2001/02/12 00:03:33 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_eval_str () +{ + char str [80]; + + str [0]= 0; + if (rd_str ("Eval: ", str, 80) == -1) return; + ned_eval_string (str, 0); +} diff --git a/app/ned/08/ned0836.c b/app/ned/08/ned0836.c new file mode 100644 index 0000000000000000000000000000000000000000..34c76b4a83a23ae637f4ab1a103a3c2c84e3a725 --- /dev/null +++ b/app/ned/08/ned0836.c @@ -0,0 +1,289 @@ +/* + * FILE %ned/08/ned0836.c + * + * Evaluierung eines hyx.l Tags + * see hyx link evaluation for a description of this function + * + * NOTE: this function can be called when aw == NULL! + * + * written: 1991 05 23 + * 1992-02-25: access to gopher servers + * 1993-01-18: dorothy object access method + * 1993-01-31: removed dorothy and installed IOA + * (indirect object access) instead + * latest update: 2001-02-11 12:25:13 + * $Id: ned0836.c,v 1.4 2001/02/12 00:03:33 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/hyx.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern int akt_buttons; +extern struct WINDOWCTRL *aw; +extern int GHYOPT_close_on_logic_link; +extern char *default_template_frame; +extern char *default_start_frame; + +#define P1_SIZ 4096 +#define LOCATION_SIZ 4096 + +static int recursion_counter= 0; +static char *YES= "yes"; +static char *NO= "no"; + +/* ------------------------------------------------------------------------ */ +int ned_eval_hlink (char *str, int option) +{ + struct CLUSTERCTRL *cl= (struct CLUSTERCTRL *) 0; + struct WINDOWCTRL *wc; + int w; + char *idx_file; /* position of file attribute */ + char *idx_fr; /* position of frame attribute */ + char *idx_cl; /* position of cluster attribute */ + char *idx; /* position of other attributes */ + int rc= 0; /* return code passed back to caller */ +#ifdef NED_READ_ONLY + int activation_mode= 0x00; +#else + int activation_mode= 0x02; +#endif /* !NED_READ_ONLY */ + char *p1= (char *) 0; + int close_actual_window= 0; + int save_reload_actual_window= 0; + int reload_target= 0; + int f_fmt= -1; + int flg_wd_setup= 0; + int flg_open_frame= 0; /* 1 -> link to some frame */ + int flg_clone= 0; /* clone the frame or file */ +#ifdef USE_GOPHER + int goph_f= 0; +#endif + +ned_message_2 ("eval_hlink: ", str); + + if ((p1= malloc (P1_SIZ)) == (char *) 0) return -1; + + if (find_attr_value (str, p1, P1_SIZ, "tcl") != -1) mac_call_tcl (p1); +#ifdef USE_TK + if (find_attr_value (str, p1, P1_SIZ, "tk") != -1) mac_call_tcl (p1); +#endif + + if ((idx= find_attr_name (str, "pgm")) != (char *) 0) + { + if (get_attr_value (idx, p1, P1_SIZ, 0x01) == -1) goto ERROR; + q_shell (p1); + } + + if (aw != (struct WINDOWCTRL *) 0 + && (idx= find_attr_name (str, "prc")) != (char *) 0 + ) + { /* process the current window somehow */ + if (aw->f_upd) ned_w_save (aw, 1); + + if (get_attr_value (idx, p1, P1_SIZ, 0x01) == -1) goto ERROR; + q_shell (p1); + ned_save_reload (aw, WCTDM_no_change); + } + + if (find_attr_value (str, p1, P1_SIZ, "lookup") != -1) + { + if (recursion_counter++ < 10) + rc= ned_eval_lookup_feature (p1, 0); + recursion_counter--; + goto RETURN_0; + } + + /* logic link -> close actual window (if wished) */ + if (option == HYOPT_logic_link + && GHYOPT_close_on_logic_link) close_actual_window= 1; + + /* SGML tag attribute: close=yes, close=no, close=condition */ + if (find_attr_value (str, p1, P1_SIZ, "close") != -1) + { + if (strcmp (p1, YES) == 0) close_actual_window= 1; else + if (strcmp (p1, NO) == 0) close_actual_window= 0; + /* other conditions: currently not defined */ + } + + if (find_attr_value (str, p1, P1_SIZ, "save") != -1) + { + if (strcmp (p1, YES) == 0) save_reload_actual_window= 1; else + if (strcmp (p1, NO) == 0) save_reload_actual_window= 0; + /* other conditions: currently not defined */ + } + + if (find_attr_value (str, p1, P1_SIZ, "reload_target") != -1) + { + if (strcmp (p1, YES) == 0) reload_target= 1; else + if (strcmp (p1, NO) == 0) reload_target= 0; + /* other conditions: currently not defined */ + } + +#ifndef NED_READ_ONLY + if (find_attr_value (str, p1, P1_SIZ, "clone") != -1 + && strcmp (p1, YES) == 0) flg_clone= 1; +#endif /* !NED_READ_ONLY */ + +#ifdef USE_GOPHER + if ((idx_file= find_attr_name (str, "gh")) != (char *) 0) + { + goph_f= 1; + if (access_gopher (str, p1) == 0) goto GOPHER_FILE; + } +#endif + + if (find_attr_value (str, p1, P1_SIZ, "prompt") != -1) do_prompt (p1); + + if (find_attr_value (str, p1, P1_SIZ, "fmt") != -1) + { + if (strcmp_c (p1, "hyx") == 0 + || strcmp_c (p1, "sgml") == 0 + ) f_fmt= FMT_SGML; + } + + if (save_reload_actual_window) ned_save_reload (aw, WCTDM_no_change); + + if ((idx_file= find_attr_name (str, "file")) != (char *) 0 + || (idx_file= find_attr_name (str, "href")) != (char *) 0 + ) + { /* Link auf ein File */ + char *real_fnm= (char *) 0; + char *virtual_fnm= (char *) 0; + + if (get_attr_value (idx_file, p1, P1_SIZ, 0x01) == -1) goto ERROR; +#ifdef USE_GOPHER +GOPHER_FILE: +#endif + + if ((w= find_file (p1, ned_get_file_path (aw), + &real_fnm, &virtual_fnm)) != -1) + { /* file already loaded */ + q_jmpwdw (w); /* NOTE: sets aw= w */ + if (reload_target) p_fget (); /* NOTE: operates on aw */ + } + else + { /* file not loaded yet */ + if (aw == (struct WINDOWCTRL *) 0) goto MK_NEW_WINDOW; + if (close_actual_window) + { + if (aw->f_upd) ned_w_save (aw, 1); + ned_wc_abandon (aw); + } + else + { + ned_window_size_preset (aw->ax, aw->ay, aw->bx, aw->by); +MK_NEW_WINDOW: + q_jmpwdw (p_wdwopen ()); + } + + q_fnm (real_fnm); /* real_fnm statt p1, 1995-10-31 */ +#ifdef USE_GOPHER + if (goph_f) aw->file_format= FMT_SGML; +#endif + if (f_fmt != -1) aw->file_format= f_fmt; + s_fget (aw); + take_history_notes (aw); + flg_wd_setup= 1; + } + + free_or_what (real_fnm); + free_or_what (virtual_fnm); + + if (eval_window_parameters (aw, str) > 0) flg_wd_setup= 1; + if (flg_wd_setup) ned_display_window (aw); + show_buttons (aw); + + goto RETURN_0; + } + + idx_fr= find_attr_name (str, "fr"); + idx_cl= find_attr_name (str, "cl"); + if (idx_fr != (char *) 0 || idx_cl != (char *) 0) flg_open_frame= 1; + + if (idx_cl != (char *) 0) + { /* Cluster Angabe im Link */ + if (get_attr_value (idx_cl, p1, P1_SIZ, 0x01) == -1 + || (cl= ned_activate_cluster (p1)) == (struct CLUSTERCTRL *) 0 + ) + goto ERROR; + } + else + { /* Frame im aktuellen Cluster */ + if (!(aw != (struct WINDOWCTRL *) 0 + && aw->file_type == FTY_HYPER + && aw->file_or_frame != (void *) 0 + && (cl= ((struct FRAMECTRL *) aw->file_or_frame)->cluster) + != (struct CLUSTERCTRL *) 0 + ) + ) + { + cl= ned_get_cluster_list (); +#ifdef NED_READ_ONLY + activation_mode= 0x01; +#else + activation_mode= 0x03; +#endif /* !NED_READ_ONLY */ + } + } + + if (idx_fr != (char *) 0) + { + if (get_attr_value (idx_fr, p1, P1_SIZ, 0x01) == -1) goto ERROR; + } + else + { + if (idx_cl != (char *) 0) strcpy (p1, default_start_frame); + } + + if (!flg_open_frame && idx_file == (char *) 0) close_actual_window= 0; + /* a menu within a file? no problem, just don't close the window */ + + wc= (struct WINDOWCTRL *) 0; + if (aw != (struct WINDOWCTRL *) 0) + { + if (close_actual_window) + { + if (aw->f_upd) ned_w_save (aw, 1); + ned_wc_abandon (aw); + if (flg_open_frame) wc= aw; + else ned_close_window (); + } + else + { + ned_window_size_preset (aw->ax, aw->ay, aw->bx, aw->by); + } + } + + if (flg_open_frame) + { + if (ned_activate_frame (cl, p1, wc, activation_mode, FMT_SGML, + default_template_frame, (char *) 0) + == (struct FRAMECTRL *) 0) goto ERROR; + } + +#ifndef NED_READ_ONLY + if (flg_clone) ned_rename_object (); +#endif /* !NED_READ_ONLY */ + + if (eval_window_parameters (aw, str) > 0) + ned_display_window (aw); + +RETURN_0: + free (p1); + return rc; + +ERROR: + free (p1); + + return -1; +} diff --git a/app/ned/08/ned0837.c b/app/ned/08/ned0837.c new file mode 100644 index 0000000000000000000000000000000000000000..c7e4b096d63cf9290c06eb1f6cf8b56d1b0171a2 --- /dev/null +++ b/app/ned/08/ned0837.c @@ -0,0 +1,54 @@ +/* + * FILE ~/usr/ned/08/ned0837.c + * + * ***** NOT USED, moved to library !!!! + * + * written: 1991 05 23 + * latest update: 1994-12-28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int get_attr_value (char *src, char *dst, int dst_lng, int flags) +/* flags: bit 0: 1 -> remove quotes */ +{ + int i=0, j=0, c; + int quoted=0; + int store=1; + + if (src == (char *) 0 || dst == (char *) 0 || dst_lng <= 0) return -1; + dst[0]=0; + + for (i=0;; i++) + { + c=src[i]; + if (c == 0) break; + if (c == '\"') + { + quoted= (quoted) ? 0 : 1; + if (flags & 0x01) store=0; + } else + if (quoted == 0 + && (c == 0x20 || c == 0x09 || c == 0x0D || c == 0x0A)) break; + if (store) + { + dst[j++] = (char) c; + if (j >= dst_lng) + { + dst[j-1]=0; + return -1; + } + } + store=1; + } + + dst[j]=0; + return 0; +} diff --git a/app/ned/08/ned0838.c b/app/ned/08/ned0838.c new file mode 100644 index 0000000000000000000000000000000000000000..79ad2f83b74e40835c81688ac67535a8c4515fb2 --- /dev/null +++ b/app/ned/08/ned0838.c @@ -0,0 +1,115 @@ +/* + * FILE %ned/08/ned0838.c + * + * Transfer a block of text beginning with (la, la_idx) up to + * (lz, lz_idx) into a string dst with a maximum size buffer_size. + * + * written: 1991 05 23 + * latest update: 1999-05-14 21:18:10 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +char *ned_line_2_string ( +struct LINE *la, +int la_idx, +struct LINE *lz, +int lz_idx, +char *buffer, /* malloc if (char *) 0 */ +int buffer_size, +long offset, /* skip <offset> bytes */ +int flags) /* bit 0: convert \n to blanks */ +{ + int idx; + struct TXT *tx; + int ll; + int lsl; + char *cp; + int malloced= 0; + char *dst; + + if ((dst= buffer) == (char *) 0 || buffer_size <= 0) + { + long MB; + + MB= ned_line_list_size (la, la_idx, lz, lz_idx, flags); + + MB += 5; /* T2D find out if this is necessary ! */ + + buffer_size= (MB > 32000L) ? 32000 : ((int) MB); + if ((buffer= malloc (buffer_size)) == (char *) 0) return (char *) 0; + malloced= 1; + dst= buffer; + } + + buffer_size--; /* need space for the 0-character too! */ + *dst= 0; + + for (; la != (struct LINE *) 0; la= la->next) + { + if ((tx= la->txt) == (struct TXT *) 0) + { + ll= lsl= 0; + cp= (char *) 0; + } + else + { + ll= la->lng; + lsl= tx->t_lng; + cp= tx->t; + } + + for (idx= 0; idx < ll; idx++) + { + if (la == lz && idx >= lz_idx) return buffer; + if (lsl == 0) + { + if ((tx= tx->next) == (struct TXT *) 0) + { /* ERROR: text segment shorter than expected !!! */ + if (malloced) free (buffer); + return (char *) 0; + } + + lsl= tx->t_lng; + cp= tx->t; + } + + if (idx >= la_idx) + { + if (offset <= 0L) + { + *dst++= *cp; + *dst= 0; + buffer_size--; + if (buffer_size <= 0) return buffer; + } + else offset--; + } + lsl--; + cp++; + } + + if (la == lz) return buffer; + + if (offset <= 0L) + { + *dst++= (char) ((flags & 0x0001) ? '\n' : ' '); + *dst= 0; + buffer_size--; + if (buffer_size <= 0) return buffer; + } + else offset--; + + la_idx= 0; + } + + return buffer; +} diff --git a/app/ned/08/ned0838a.c b/app/ned/08/ned0838a.c new file mode 100644 index 0000000000000000000000000000000000000000..27d1633e6d092c3e49fdfe698d22324e8509a8e5 --- /dev/null +++ b/app/ned/08/ned0838a.c @@ -0,0 +1,44 @@ +/* + * FILE %ned/08/ned0838a.c + * + * calculate the size of list of lines + * + * written: 1997-12-05 + * latest update: 1997-12-05 4:17:20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +long ned_line_list_size ( +struct LINE *la, +int la_idx, +struct LINE *lz, +int lz_idx, +int flags) +{ + long size= 0L; + int lng; + struct LINE *lp; + + for (lp= la; lp != (struct LINE *) 0; lp= lp->next) + { + lng= lp->lng; /* length of analyzed line */ + + if (lp == la) lng -= la_idx; /* first line in block */ + if (lp == lz && lz_idx < lng) lng= lz_idx; /* last line in block */ + + size += (long) lng; + if (flags & 0x0001) size++; + if (lp == lz) break; + } + size++; + + return size; +} diff --git a/app/ned/08/ned0839.c b/app/ned/08/ned0839.c new file mode 100644 index 0000000000000000000000000000000000000000..892a5fbf1ff99367c3d4b95b189f44d6ff41a32d --- /dev/null +++ b/app/ned/08/ned0839.c @@ -0,0 +1,96 @@ +/* + * FILE %ned/08/ned0839.c + * + * Evaluieren eines Zeilen-Abschnitts + * + * written: 1991 05 23 + * latest update: 2001-02-11 12:36:12 + * $Id: ned0839.c,v 1.3 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" + +#define LINE_SIZE 2048 +static char line [LINE_SIZE]; + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_eval_line ( +struct LINE *la, +int la_idx, +struct LINE *lz, +int lz_idx, +int option) +{ + if (ned_line_2_string (la, la_idx, lz, lz_idx, line, LINE_SIZE, 0L, 0x0000) + == (char *) 0) + return -1; + + return ned_eval_string (line, option); +} + +/* ------------------------------------------------------------------------ */ +int ned_eval_lookup_feature (const char *token, int option) +{ + char *feature_string= (char *) 0; + char *feature_type= (char *) 0; + int lng; + + if (ned_lookup_feature (token, line, &feature_string, &feature_type, + LINE_SIZE) == 0) + { + if (feature_string == (char *) 0 || feature_type == (char *) 0) return -1; + + if (strcmp (feature_type, "F") == 0) + { + if (*feature_string == '<') feature_string++; + if ((lng= strlen (feature_string) -1) <= 0) return -1; + if (feature_string [lng] == '>') feature_string [lng]= 0; + + ned_eval_string (feature_string, option); + } + + if (strcmp (feature_type, "T") == 0) mac_call_tcl (feature_string); + + return 0; + } + + return -1; +} + +/* ------------------------------------------------------------------------ */ +int ned_eval_tag_entry (const char *token) +{ + char *found_file= (char *) 0; + char *found_loc= (char *) 0; + + if (ned_lookup_tag (token, line, &found_file, &found_loc, LINE_SIZE) == 0) + { + if (ned_open_file (found_file, (char *) 0, (char *) 0, + NED_OPENF_DEF1) == 0) + { + /* T2D: jump to the location */ + if (found_loc [0] == '/' || found_loc [0] == '?') + { + char *cp; + cp= found_loc + strlen (found_loc) - 1; + if (*cp == '/') *cp--= 0; + + ned_jmp_pattern (aw, ned_find_first_line (aw->first), found_loc+1, + (found_loc [0] == '?') ? OPT_backward : 0x0000); + + } + return 0; + } + } + + return -1; +} diff --git a/app/ned/08/ned0840.c b/app/ned/08/ned0840.c new file mode 100644 index 0000000000000000000000000000000000000000..67b18d516ce20a42f8da27dd36f816c42f52a18f --- /dev/null +++ b/app/ned/08/ned0840.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/08/ned0840.c + * + * evaluate a marked block + * + * written: 1991 05 23 + * latest update: 2001-02-11 12:36:28 + * $Id: ned0840.c,v 1.2 2001/02/12 00:03:33 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct MARKER b_beg, b_end; + +/* ------------------------------------------------------------------------ */ +void ned_eval_block () +{ + if (ned_blk_invalid ()) return; + ned_eval_line (b_beg.ptr, b_beg.offset, b_end.ptr, b_end.offset, 0); +} + diff --git a/app/ned/08/ned0841.c b/app/ned/08/ned0841.c new file mode 100644 index 0000000000000000000000000000000000000000..3f0fc7a439b0d8e8650ede0c6c8a4422d700816e --- /dev/null +++ b/app/ned/08/ned0841.c @@ -0,0 +1,68 @@ +/* + * FILE %ned/08/ned0841.c + * + * Feature Zeile evaluieren + * + * written: 1991 05 23 + * latest update: 2001-02-11 12:36:45 + * $Id: ned0841.c,v 1.2 2001/02/12 00:03:33 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_eval_feature () +{ + struct LINE *lp; + + if (aw == (struct WINDOWCTRL *) 0) return; + + if (aw->file_type == FTY_FTRWDW) + { /* current window is a feature window */ + /* -> 1. save pointer to current line in the feature records */ + /* 2. abandon the feature window */ + /* 3. jump to the feature window's main window */ + + struct WINDOWCTRL *w; + + lp= aw->WC_act; + w= aw->feature_window; + ned_wc_abandon (aw); + ned_close_window (); + q2_jmpwdw (w); + /*** q0_jmpwdw (w); it's not necessary to display the window ***/ + ned_reset_a_marker ('1'); + } + else + { /* normales Window -> Markup suchen */ + /* ########### gueltiges Markup suchen !!!!!!!!! ########## */ + struct FEATURE **f2; + + ned_set_marker (aw, '1'); + if ((f2= ned_feature_find3 (1)) == (struct FEATURE **) 0 + || (lp= (struct LINE *) (*f2)->ftr_text_line) == (struct LINE *) 0 + ) + { /* no feature here, maybe a markup? (not yet) */ + + /* try also to find a word here */ + if (ned_find_bracket (1) == 0 + || q_eval_tag () == 0 + || q_ofile (NED_OPENF_REDRAW | NED_OPENF_CONTEXT + | NED_OPENF_HISTORY | NED_OPENF_EXISTS) == 0 + ) return; + + ned_cross_ref ((char *) 0, -1, 0, 0, 1); + return; + } + } + + ned_eval_line (lp, 1, lp, lp->lng-1, 0); +} diff --git a/app/ned/08/ned0841b.c b/app/ned/08/ned0841b.c new file mode 100644 index 0000000000000000000000000000000000000000..93f3ba8602c8b45c54d228a58527227ec5bb0823 --- /dev/null +++ b/app/ned/08/ned0841b.c @@ -0,0 +1,31 @@ +/* + * FILE %ned/08/ned0841b.c + * + * eval token in context as a :tag command + * + * written: 1997-01-06 + * latest update: 1997-06-28 22:49:06 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +#define MAX_STR 128 +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int q_eval_tag () +{ + char str [MAX_STR]; + + ned_set_marker (aw, '1'); + return (q_isolate_word (str, MAX_STR, CHARSET_token, 1) > 0 + && /* ned_eval_lookup_feature (str, 0) == 0 */ + ex_tag_command (str) == 0 + ) ? 0 : -1; +} diff --git a/app/ned/08/ned0842.c b/app/ned/08/ned0842.c new file mode 100644 index 0000000000000000000000000000000000000000..39aea846b1df5b9e0cf2c5521c1e18a5211435cc --- /dev/null +++ b/app/ned/08/ned0842.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/08/ned0842.c + * + * search for a feature record at the current cursor position + * + * returns the address of the pointer (!) where the found + * feature record is linked + * + * written: 1987 09 08 + * 1991 02 07: Revision + * latest update: 1996-07-25 21:45:36 + * + */ + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +struct FEATURE **ned_feature_find3 (int range) +{ + if (aw == (struct WINDOWCTRL *) 0) return (struct FEATURE **) 0; + + return ned_feature_find (aw->WC_act, aw->cx + aw->hv - aw->ax, range); +} diff --git a/app/ned/08/ned0842b.c b/app/ned/08/ned0842b.c new file mode 100644 index 0000000000000000000000000000000000000000..82871f50fc4b1d1239b0f612c938cdb88915cf1e --- /dev/null +++ b/app/ned/08/ned0842b.c @@ -0,0 +1,38 @@ +/* + * FILE %ned/08/ned0842b.c + * + * search for a feature record at the current cursor position + * + * returns the address of the pointer (!) where the found + * feature record is linked + * + * written: 1996-03-10 + * latest update: 1996-03-10 13:00:41 + * + */ + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct FEATURE **ned_feature_find (struct LINE *lp, int x, int range) +{ + struct FEATURE *f0; + struct FEATURE **f2; + struct FEATURE **f2_range= (struct FEATURE **) 0; + + if (lp == (struct LINE *) 0 + || x < 0 + ) return (struct FEATURE **) 0; + + for (f2= &lp->ftr;; f2= &((*f2)->ftr_next) ) + { + if ((f0= *f2) == (struct FEATURE *) 0 || f0->ftr_pos > x) return f2_range; + if (f0->ftr_pos == x) return f2; + + if (range == 1 && f0->ftr_pos + f0->ftr_replarray_size - 1 >= x) + f2_range= f2; + } + + return f2_range; +} diff --git a/app/ned/08/ned0842c.c b/app/ned/08/ned0842c.c new file mode 100644 index 0000000000000000000000000000000000000000..dc4e19ad82f5291290eac9f3e092d82c879b82ca --- /dev/null +++ b/app/ned/08/ned0842c.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/08/ned0842c.c + * + * search for a feature record at the current cursor position + * + * returns the address of the pointer (!) where the found + * feature record is linked + * + * written: 1996-07-26 + * latest update: 1996-07-26 2:34:51 + * + */ + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct FEATURE **ned_feature_find2 (struct WINDOWCTRL *wc, int range) +{ + if (wc == (struct WINDOWCTRL *) 0) return (struct FEATURE **) 0; + + return ned_feature_find (wc->WC_act, wc->cx + wc->hv - wc->ax, range); +} diff --git a/app/ned/08/ned0843.c b/app/ned/08/ned0843.c new file mode 100644 index 0000000000000000000000000000000000000000..2dfdae431e3d8e347f3c87bf6bd2688f19e914b4 --- /dev/null +++ b/app/ned/08/ned0843.c @@ -0,0 +1,63 @@ +/* + * FILE %ned/08/ned0843.c + * + * Evaluieren einer Makro Definiton + * + * written: 1991 05 24 + * latest update: 1996-11-03 18:24:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/hyx.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int eval_ned_macro (char *s, int option) +{ +#ifdef __SECURITY__PROBLEM__ /* 1996-11-03 18:23:38 */ + int mac_siz; + int mac_num= 0; + int evaluate_macro_immediately= 0; + int macro_type= MPt_key_sequence; + char *p; + + option= 0; + + if ((p= find_attr_name (s, "n")) != (char *) 0) + mac_num= (int) get_parameter_value (p); + mac_undef (mac_num); + + if ((p= find_attr_name (s, "ex")) != (char *) 0) + evaluate_macro_immediately= (int) get_parameter_value (p); + + if ((p= find_attr_name (s, "ty")) != (char *) 0 + && (strncmp (p, "tcl", 3) == 0 || strncmp (p, "\"tcl\"", 5) == 0)) + macro_type= MPt_tcl; + + if ((p= find_attr_name (s, "s")) == (char *) 0) return -1; + + /******************** ################### + if (*p == '\"') *p++; + p [strlen (p)-1]= 0; + ****************************************/ + + mac_siz= trans_str (p, p, 9999); + mac_define (mac_num, macro_type, p, mac_siz); + if (evaluate_macro_immediately == 1) p_macro (mac_num); + +#else +#ifdef MSDOS + s; option; +#endif +#endif /* !__SECURITY__PROBLEM__ 1996-11-03 18:23:38 */ + + return 0; +} diff --git a/app/ned/08/ned0844.c b/app/ned/08/ned0844.c new file mode 100644 index 0000000000000000000000000000000000000000..c6659e65e7448ba1e718a5cfdc3b41014910d2b2 --- /dev/null +++ b/app/ned/08/ned0844.c @@ -0,0 +1,172 @@ +/* + * FILE %ned/08/ned0844.c + * + * search for a cluster control block, create it if not found + * + * written: 1991 05 29 + * 1991 09 18: logic pathnames for clusters + * 1993-01-18: dorothy object access method + * 1993-01-31: removed dorothy access and installed IOA + * (indirect object access) instead + * latest update: 1999-04-25 16:33:05 + * $Id: ned0844.c,v 1.3 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <stdio.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/dpp.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/hytxt.h> +#include <gg/ytree.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern int errno; + +/* ------------------------------------------------------------------------ */ +/* list of active clusters */ +static struct CLUSTERCTRL *clusters= (struct CLUSTERCTRL *) 0; +static struct CLUSTERCTRL **clusters_append= &clusters; + +static struct YTREE /* name lookup tables */ + *cluster_by_used_name= (struct YTREE *) 0, + *cluster_by_real_name= (struct YTREE *) 0; + +/* ------------------------------------------------------------------------ */ +struct CLUSTERCTRL *ned_get_cluster_list () +{ + return clusters; +} + +/* ------------------------------------------------------------------------ */ +struct CLUSTERCTRL *ned_activate_cluster ( +const char *fn) /* name of the cluster file */ +{ + struct CLUSTERCTRL *cl; + char *idx_fnm; + struct stat st; + int rc; + char *real_fnm; /* physical name of the cluster file */ + char *virtual_fnm; /* virtual name of the cluster file */ + + if (fn == (char *) 0 || *fn == 0) return (struct CLUSTERCTRL *) 0; + + /* TEST: 1996-11-09 18:17:25 */ + if ((cl= (struct CLUSTERCTRL *) + ytree_get_value (cluster_by_used_name, (unsigned char *) fn)) + != (struct CLUSTERCTRL *) 0 + ) + goto END; + + if (filename_definition (fn, &real_fnm, &virtual_fnm, (char *) 0) != 0) + return (struct CLUSTERCTRL *) 0; + + /* TEST: 1996-11-09 18:17:25 */ + if ((cl= (struct CLUSTERCTRL *) + ytree_get_value (cluster_by_real_name, (unsigned char *) real_fnm)) + != (struct CLUSTERCTRL *) 0 + ) + { /* real filename was used before, but not so the name that was */ + /* used to activate the cluster, so store that info. */ + ytree_set_value (&cluster_by_used_name, (unsigned char *) fn, (long) cl); + free_or_what (real_fnm); + free_or_what (virtual_fnm); + goto END; + } + +#ifdef __OLD__ /* 1996-11-09 18:17:36 */ + for (cl= clusters; cl != (struct CLUSTERCTRL *) 0; cl= cl->next) + { + if (strcmp_c (cl->cluster_name_hyx, real_fnm) == 0) + goto END; /* cluster already activated */ + } +#endif /* __OLD__ 1996-11-09 18:17:36 */ + + /* Note: control structure for the named cluster was not found in */ + /* the look-up tables, so create one and add it to the tables. */ + + if ((cl= (struct CLUSTERCTRL *) calloc (sizeof (struct CLUSTERCTRL), 1)) + == (struct CLUSTERCTRL *) 0) goto END; + + cl->cluster_name_logic= virtual_fnm; + cl->cluster_name_hyx= real_fnm; + + cl->cluster_name_lut= fnmcpy2 (real_fnm, ".lut"); + cl->cluster_name_xfn= fnmcpy2 (real_fnm, ".xfn"); + cl->cluster_name_idx= idx_fnm= fnmcpy2 (real_fnm, ".idx"); + + rc= stat (idx_fnm, &st); /* index file */ + if (rc == -1) + { /* Cluster index does not exist yet, so create it unless this is the */ + /* read-only version. */ +#ifndef NED_READ_ONLY + if (errno == ENOENT) + { /* index file does not exist; create it. */ + FILE *f; + int i; + + if ((f= fopen (idx_fnm, "wb")) == (FILE *) 0) + { +RELEASE: + ned_free_clusterctrl (cl); + return (struct CLUSTERCTRL *) 0; + } + + for (i= 0; i < IDX_REC_SIZE; i++) fputc (0x00FF, f); + fclose (f); + cl->next_index= cl->highest_index= 1L; + } + else goto RELEASE; +#else +RELEASE_RO: + ned_free_clusterctrl (cl); + return (struct CLUSTERCTRL *) 0; +#endif /* NED_READ_ONLY */ + } + else + { + cl->next_index= cl->highest_index= st.st_size / IDX_REC_SIZE; + } + + rc= stat (real_fnm, &st); + if (rc == -1) + { /* Cluster text does not exist yet, so create it unless this is the */ + /* read-only version. */ +#ifndef NED_READ_ONLY + if (errno == ENOENT) + { + FILE *f; + + if ((f= fopen (real_fnm, "wb")) == (FILE *) 0) goto RELEASE; + fputs ("<SGML enc=\"HYX\" ed=\"ned:3.00.20\" cs=\"cp437\">\n", f); + hyx_write_stamp (f, (char *) 0); + fclose (f); + } + else goto RELEASE; +#else + goto RELEASE_RO; +#endif /* NED_READ_ONLY */ + } + + /* add to list of clusters only when everything is ok... */ + ytree_set_value (&cluster_by_used_name, (unsigned char *) fn, (long) cl); + ytree_set_value (&cluster_by_real_name, (unsigned char *) real_fnm, + (long) cl); + + *clusters_append= cl; + clusters_append= &cl->next; + +END: + return cl; +} diff --git a/app/ned/08/ned0844b.c b/app/ned/08/ned0844b.c new file mode 100644 index 0000000000000000000000000000000000000000..608349702074e2c91723201faff54f54a8d8b88f --- /dev/null +++ b/app/ned/08/ned0844b.c @@ -0,0 +1,35 @@ +/* + * FILE %ned/08/ned0844b.c + * + * destroy a cluster control block + * + * written: 1996-09-29 + * latest update: 1999-04-25 16:33:09 + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <stdlib.h> +#include <gg/strings.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_free_clusterctrl (struct CLUSTERCTRL *cl) +{ + if (cl == (struct CLUSTERCTRL *) 0) return -1; + + free_or_what (cl->cluster_name_logic); + free_or_what (cl->cluster_name_hyx); + free_or_what (cl->cluster_name_lut); + free_or_what (cl->cluster_name_xfn); + free_or_what (cl->cluster_name_idx); + + free (cl); + + return 0; +} diff --git a/app/ned/08/ned0845.c b/app/ned/08/ned0845.c new file mode 100644 index 0000000000000000000000000000000000000000..e7df0a46905b2d5def523a584964de4978f6351f --- /dev/null +++ b/app/ned/08/ned0845.c @@ -0,0 +1,175 @@ +/* + * FILE %ned/08/ned0845.c + * + * Frame aktivieren, d.h. Informationen laden oder Frame neu anlegen + * + * written: 1991 05 29 + * latest update: 2000-09-01 18:02:26 + * $Id: ned0845.c,v 1.6 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/hytxt.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern struct WINDOWCTRL *windows; +extern char *default_start_frame; + +/* ------------------------------------------------------------------------ */ +struct FRAMECTRL *ned_activate_frame ( +struct CLUSTERCTRL *cl, /* Liste der zu durchsuchenden Cluster */ +const char *fr_name, /* gesuchter Frame */ +struct WINDOWCTRL *wc, /* Window, das uebernommen werden soll */ +int search_mode, /* Bit 0: alle Cluster durchsuchen */ + /* Bit 1: Frame ggf. neu anlegen */ +int file_fmt, /* FMT_SGML | FMT_ASCII */ +const char *template_frame, /* frame to clone, if necessary */ +const char *alternative_frame) /* alternative frame to open, if not found */ +{ + struct FRAMECTRL *fr; + int win_num; + int rc; + int frame_new= 0; + char *cln; + char *title_short; +#ifndef NED_READ_ONLY + long new_index; +#endif /* !NED_READ_ONLY */ + char *tlt_frame= (char *) 0; + + if (cl == (struct CLUSTERCTRL *) 0) return (struct FRAMECTRL *) 0; + + /* check if frame name is specified... */ + if (fr_name == (char *) 0 || *fr_name == 0) fr_name= default_start_frame; + + if ((tlt_frame= hyx_translate_special_frame (fr_name)) != (char *) 0) + fr_name= tlt_frame; + + if ((fr= find_frame (cl, fr_name, search_mode)) == (struct FRAMECTRL *) 0) + { /* the frame name was not found in any of the clusters */ +#ifndef NED_READ_ONLY /* 1996-03-11 1:32:34 */ + + if (!(search_mode & 0x02)) + { /* frame does not exist and should not be created */ + if (alternative_frame != (char *) 0 + && (fr= find_frame (cl, fr_name= alternative_frame, search_mode)) + != (struct FRAMECTRL *) 0 + ) + goto FOUND; + + goto DONE; + } + + /* create a new frame */ + if (template_frame != (char *) 0 + && (fr= ned_activate_frame (cl, template_frame, wc, 0x00, file_fmt, + (char *) 0, (char *) 0)) + != (struct FRAMECTRL *) 0) + { + frame_new= 2; + + goto JMPWDW; + } + else + { /* create frame */ + new_index= (cl->next_index)++; + if ((fr= create_framectrl (cl, fr_name, new_index, FRAME_is_new)) + == (struct FRAMECTRL *) 0) goto DONE; + + fr->frame_begin= 0L; + fr->frame_end= 0L; + fr->frame_status= FRAME_is_defined; + frame_new= 1; + } +#else + template_frame; + alternative_frame; + goto DONE; +#endif /* NED_READ_ONLY */ + } + else + { +#ifndef NED_READ_ONLY +FOUND: +#endif + + if (fr->frame_status == FRAME_is_loaded) + { /* Frame in der Window Liste suchen und anspringen */ + if (wc != (struct WINDOWCTRL *) 0) ned_w_close_window (wc); + goto JMPWDW; + } + else + { /* Frame Info aus Index laden */ + get_index (fr); + fr->frame_status= FRAME_is_defined; + } + } + + if (wc == (struct WINDOWCTRL *) 0) + { /* Window erzeugen */ + if (q_wdwopen (&wc, &win_num) == -1) + { + fr= (struct FRAMECTRL *) 0; + goto DONE; + } + + /* ned_window_size (wc, DEFAULT_WDW_MODE, 1); * 1996-03-02 23:06:05 ?? **/ + } /* else: angegebenes Window verwenden */ + + /* Window mit Frame verkn�pfen */ + wc->file_or_frame= fr; + wc->file_type= FTY_HYPER; + wc->file_format= file_fmt; + + if ((cln= cl->cluster_name_logic) == (char *) 0 + && (cln= cl->cluster_name_hyx) == (char *) 0 + ) + cln= "unknown..."; + + /* store frame name */ + rc= strlen (cln); + title_short= malloc (rc + strlen (fr_name) + 5); + title_short [0] = '['; + strcpy (title_short + 1, cln); + strcpy (title_short + rc + 1, "] "); + strcpy (title_short + rc + 3, fr_name); + wc->WC_title_short= title_short; +#ifdef USE_TK + ned_tk_set_window_name (wc, wc->WC_title_short); +#endif /* USE_TK */ + + switch (frame_new) + { + case 0: s_fget (wc); break; /* File einlesen */ + case 1: initialize_frame (wc, fr_name); + break; + } + + take_history_notes (wc); + fr->frame_status= FRAME_is_loaded; + +JMPWDW: + for (wc= windows; wc != (struct WINDOWCTRL *) 0; wc= wc->WC_next) + if (wc->file_or_frame == fr) + { + if (frame_new == 2) ned_rename_frame (wc, fr_name, file_fmt); + + q2_jmpwdw (wc); + q0_jmpwdw (wc); + break; + } + +DONE: + free_or_what (tlt_frame); + + return fr; +} diff --git a/app/ned/08/ned0845a.c b/app/ned/08/ned0845a.c new file mode 100644 index 0000000000000000000000000000000000000000..90e3b3f0193e63b64af93bc3d923c0017a489718 --- /dev/null +++ b/app/ned/08/ned0845a.c @@ -0,0 +1,48 @@ +/* + * FILE %ned/08/ned0845a.c + * + * deactivate a frame + * + * written: 1996-03-16 + * latest update: 1999-04-25 16:33:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/strings.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_deactivate_frame (struct FRAMECTRL *fr) +{ + struct CLUSTERCTRL *cl; + struct FRAMECTRL *fr2; + struct FRAMECTRL **frp; + + if (fr == (struct FRAMECTRL *) 0 + || (cl= fr->cluster) == (struct CLUSTERCTRL *) 0 + ) + return -1; + + for (frp= &(cl->frames); + (fr2= *frp) != (struct FRAMECTRL *) 0; + frp= &fr2->next) + { + if (fr2 == fr) + { /* we have found the frame in the list of the cluster's frames */ + *frp= fr->next; + break; + } + } + + free_or_what (fr->frame_name); + free (fr); + + return 0; +} diff --git a/app/ned/08/ned0846.c b/app/ned/08/ned0846.c new file mode 100644 index 0000000000000000000000000000000000000000..ec3acf24dab007d845dc680f2e07c5ebdde0448c --- /dev/null +++ b/app/ned/08/ned0846.c @@ -0,0 +1,113 @@ +/* + * FILE %ned/08/ned0846.c + * + * search for frame control structure in currently active + * clusers, create it if the control structure was not found + * but only if the frame exists in any of the clusters. + * + * written: 1991 05 29 + * 1993-01-18: dorothy object access method + * 1993-01-31: removed dorothy and installed IOA + * (indirect object access) instead + * latest update: 1999-04-25 16:33:18 + * $Id: ned0846.c,v 1.3 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/lookup.h> +#include <gg/dpp.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct FRAMECTRL *find_frame ( +struct CLUSTERCTRL *xcl, +const char *fr_name, +int search_mode) /* Bit 0: search in all clusters */ +{ + struct FRAMECTRL *fc; + struct CLUSTERCTRL *cl= (struct CLUSTERCTRL *) 0; + FILE *lut; + long w_info; + int llng; + int rc; + int phase; + + for (phase= 1; phase <= 4; phase++) + { + if (phase >= 3 && !(search_mode & 0x01)) break; + + switch (phase) + { + case 1: case 2: cl= xcl; break; + case 3: case 4: cl= ned_get_cluster_list (); break; + default: return (struct FRAMECTRL *) 0; + } + + switch (phase) + { + case 1: /* aktuellen Cluster-Cache durchsuchen */ + case 3: /* alle Cluster-Caches durchsuchen */ + /* d.h: alle bisher aufgelaufenen Informationen auswerten */ + for (; cl != (struct CLUSTERCTRL *) 0; cl= cl->next) + { + if (phase == 3 && cl == xcl) continue; /* war schon mal ... */ + for (fc= cl->frames; fc != (struct FRAMECTRL *) 0; fc= fc->next) + if (strcmp (fc->frame_name, fr_name) == 0) return fc; + + if (phase == 1) break; + } + break; + + case 2: /* aktuellen Cluster durchsuchen und Frame in Cache eintragen */ + case 4: /* alle Cluster durchsuchen und Frame in Cache eintragen */ + /* d.h: alle noch nicht benuetzten Informationen verwenden */ + + for (; cl != (struct CLUSTERCTRL *) 0; cl= cl->next) + { + if (phase == 4 && cl == xcl) continue; /* war schon mal... */ + + if (fr_name [0] == '$' && fr_name [1] == '#') + { + if ((w_info= get_parameter_value (fr_name+2)) + <= cl->highest_index) + return create_framectrl (cl, fr_name, w_info, + FRAME_in_LUT /* well, not really (T2D: 1995-12-05 19:22:03) */); + } + + rc= LOOKUP_not_found; + if ((lut= fopen (cl->cluster_name_lut, "rb")) != (FILE *) 0) + { + rc= lookup_file (lut, fr_name, &w_info, &llng); + fclose (lut); + } + + if (rc & LOOKUP_found) + /* FRAMECTRL aufbauen und in CLUSTERCTRL einbauen */ + return create_framectrl (cl, fr_name, w_info, FRAME_in_LUT); + + if ((lut= fopen (cl->cluster_name_xfn, "rb")) != (FILE *) 0) + { + rc= lookup_file_xfn (lut, fr_name, &w_info); + fclose (lut); + } + + if (rc & LOOKUP_found) + return create_framectrl (cl, fr_name, w_info, FRAME_in_XFN); + + if (phase == 2) break; + } + break; + } + } + + return (struct FRAMECTRL *) 0; +} diff --git a/app/ned/08/ned0847.c b/app/ned/08/ned0847.c new file mode 100644 index 0000000000000000000000000000000000000000..c37b8df5a1a6d60f060606bc2cb02b41e1fe1b52 --- /dev/null +++ b/app/ned/08/ned0847.c @@ -0,0 +1,49 @@ +/* + * FILE %ned/08/ned0847.c + * + * Frame Control Struktur im angegebenen Cluster eintragen + * + * written: 1991 05 29 + * latest update: 1999-04-25 16:33:22 + * $Id: ned0847.c,v 1.3 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct FRAMECTRL *create_framectrl ( +struct CLUSTERCTRL *cl, +const char *fr_name, +long idx, +int where) +{ + struct FRAMECTRL *fc; + + if ((fc= (struct FRAMECTRL *) calloc (sizeof (struct FRAMECTRL), 1)) + == (struct FRAMECTRL *) 0) return (struct FRAMECTRL *) 0; + + fc->next= (cl == (struct CLUSTERCTRL *) 0) + ? (struct FRAMECTRL *) 0 + : cl->frames; + + if (cl != (struct CLUSTERCTRL *) 0) cl->frames= fc; + + fc->cluster= cl; + fc->frame_name= strdup (fr_name); + fc->frame_index= idx; + fc->frame_lookup= where; + fc->frame_status= FRAME_is_unindexed; + + return fc; +} diff --git a/app/ned/08/ned0848.c b/app/ned/08/ned0848.c new file mode 100644 index 0000000000000000000000000000000000000000..c3bb0e977751274326a43f72df630521f04cabf5 --- /dev/null +++ b/app/ned/08/ned0848.c @@ -0,0 +1,37 @@ +/* + * FILE ~/usr/ned/08/ned0848.c + * + * retrieve frame begin and end offsets from the index table + * + * written: 1991 05 29 + * latest update: 1994-03-16 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dpp.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int get_index (struct FRAMECTRL *fr) +{ + FILE *fidx; + + if (fr == (struct FRAMECTRL *) 0 + || fr->cluster == (struct CLUSTERCTRL *) 0 + || (fidx= fopen (fr->cluster->cluster_name_idx, "rb")) == (FILE *) 0) + return -1; + + fseek (fidx, fr->frame_index * IDX_REC_SIZE, 0); + fr->frame_begin = dpp_fread_long (fidx, 4); + fr->frame_end = dpp_fread_long (fidx, 4); + fclose (fidx); + + return 0; +} diff --git a/app/ned/08/ned0849.c b/app/ned/08/ned0849.c new file mode 100644 index 0000000000000000000000000000000000000000..34b06abb859fb5f78055dffc0995dae42d8d27f6 --- /dev/null +++ b/app/ned/08/ned0849.c @@ -0,0 +1,58 @@ +/* + * FILE ~/usr/ned/08/ned0849.c + * + * update an index entry for a frame in the index table file + * + * written: 1991 05 31 + * latest update: 1994-03-31 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dpp.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int update_index ( +struct CLUSTERCTRL *cl, +long idx, +long off_beg, +long off_end, +long cl_nr) +{ + FILE *fidx; + long cnt; + + if (idx <= 0L) return -1; + + if (cl->highest_index > idx) + { /* update for old index entry */ + if ((fidx= fopen (cl->cluster_name_idx, "r+b")) == (FILE *) 0) return -1; + fseek (fidx, idx * IDX_REC_SIZE, 0); + } + else + { /* append a new index entry */ + if ((fidx= fopen (cl->cluster_name_idx, "ab")) == (FILE *) 0) return -1; + if ((cnt= idx - cl->highest_index) > 0L) + { /* fille up space in table up to new index entry position */ + cl->highest_index= idx; + for (cnt *= IDX_REC_SIZE; cnt > 0L; cnt--) + fputc (0x00FF, fidx); + } + cl->highest_index++; + } + + dpp_fwrite_long (fidx, off_beg, 4); + dpp_fwrite_long (fidx, off_end, 4); + dpp_fwrite_long (fidx, cl_nr, 4); + + fclose (fidx); + + return 0; +} diff --git a/app/ned/08/ned0850.c b/app/ned/08/ned0850.c new file mode 100644 index 0000000000000000000000000000000000000000..b2e8d27e96be4992bad5c76e1542f5d447aeaa82 --- /dev/null +++ b/app/ned/08/ned0850.c @@ -0,0 +1,39 @@ +/* + * FILE %ned/08/ned0850.c + * + * written: 1991 06 02 + * latest update: 1999-04-25 16:33:26 + * $Id: ned0850.c,v 1.3 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct FEATURE *q_feature_set ( +struct LINE *lp, /* Zeile an die das Feature angehaengt wird */ +int cpos, /* Spalte in der sich das Feature befindet */ +int feature_type, /* Typ des Feature Records */ +int t_cnt, /* number of ... */ +const char *ftxt[]) /* string segments for feature ... */ +{ + struct FEATURE *f; /* newly generated feature */ + + if (lp == (struct LINE *) 0 + || (f= ned_new_feature (cpos, feature_type)) == (struct FEATURE *) 0 + ) + return (struct FEATURE *) 0; + + qq_insert_string_array (f->ftr_text_line, 0, ftxt, t_cnt, 1); + + ned_insert_feature (&lp->ftr, f); + + return f; +} diff --git a/app/ned/08/ned0850b.c b/app/ned/08/ned0850b.c new file mode 100644 index 0000000000000000000000000000000000000000..1dcc6e48852f4638526f2476942faca898e0c099 --- /dev/null +++ b/app/ned/08/ned0850b.c @@ -0,0 +1,35 @@ +/* + * FILE %ned/08/ned0850b.c + * + * written: 1996-07-25 + * latest update: 1999-04-25 16:33:31 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct FEATURE *ned_new_feature (int cpos, int feature_type) +{ + struct FEATURE *f; + + if ((f= ned_feature_alloc ()) == (struct FEATURE *) 0 + || (f->ftr_text_line= alloc_line ()) == (struct LINE *) 0 + ) + return (struct FEATURE *) 0; + + f->ftr_pos= cpos; + f->ftr_type= feature_type; + f->ftr_display_mode= FTR_display_point; + f->ftr_replarray_size= 1; + f->ftr_colour= COL_DEF_FEATURE; + f->ftr_duplication= FTR_dup_allways; + + return f; +} diff --git a/app/ned/08/ned0851.c b/app/ned/08/ned0851.c new file mode 100644 index 0000000000000000000000000000000000000000..88d11a202590730ed442879057616e00a8e75a2e --- /dev/null +++ b/app/ned/08/ned0851.c @@ -0,0 +1,87 @@ +/* + * FILE %ned/08/ned0851.c + * + * see docu + * + * written: 1991 06 25 + * latest update: 1997-07-27 11:37:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/hyx.h> +#include <gg/dpp.h> +#include "ed.h" +#include "proto.h" +#ifdef USE_TK +#include <tcl.h> +#include <tk.h> +#include "edtcl.h" +#include "edtk.h" +#endif /* USE_TK */ + +#define LIN_SIZ 80 + +/* ------------------------------------------------------------------------ */ +int eval_window_parameters ( +struct WINDOWCTRL *w, /* window to be modified */ +char *str) /* window parameters in string */ +/* return -1 ... error */ +/* 0 ... no parameters found */ +/* Bit 0: ... window parameters found */ +/* Bit 1: ... ln-parameters found */ +/* Bit 2: ... mark-paramter found */ +{ + int rc= 0; + int ln, cn; + char txt [LIN_SIZ]; + struct LINE *lp; + struct FEATURE *fp; + + if (find_attr_value (str, txt, LIN_SIZ, "ln") != -1) + { + ln= (int) get_parameter_value (txt); + ned_jmp_2line_by_nr (w, ln, 0x00); + rc |= 0x0002; + } + + if (find_attr_value (str, txt, LIN_SIZ, "mark") != -1 + && (find_feature_with_attribute (w->WC_act, 0x0003, + "hyx.l", "name", txt, &lp, &ln, &fp) == 1 + || find_feature_with_attribute (w->WC_act, 0x0003, + "mark", "id", txt, &lp, &ln, &fp) == 1 + ) + ) + { + ned_jmp_2line_by_nr (w, ln, 0x00); + jmp2column (w, fp->ftr_pos); + rc |= 0x0004; + } + + if (find_attr_value (str, txt, LIN_SIZ, "cn") != -1) + { + cn= (int) get_parameter_value (txt); + jmp2column (w, cn); + } + +#ifdef USE_TK + if (w->wc_taint_level == 0) + { + if (find_attr_value (str, txt, LIN_SIZ, "cmd_right_button") != -1) + ned_tk_setup_special (w, NED_TK_CMD_MOUSE_B2, txt); + + if (find_attr_value (str, txt, LIN_SIZ, "cmd_menu") != -1) + ned_tk_setup_special (w, NED_TK_CMD_MENU, txt); + + if (find_attr_value (str, txt, LIN_SIZ, "cmd_wins") != -1) + ned_tk_setup_special (w, NED_TK_CMD_WINS, txt); + } +#endif /* USE_TK */ + + return rc; +} diff --git a/app/ned/08/ned0853.c b/app/ned/08/ned0853.c new file mode 100644 index 0000000000000000000000000000000000000000..d71ea387b8f69bfad06ef00450ecebea18bd8227 --- /dev/null +++ b/app/ned/08/ned0853.c @@ -0,0 +1,45 @@ +/* + * FILE %ned/08/ned0853.c + * + * written: 1991 06 25 + * latest update: 2001-02-11 12:36:58 + * $Id: ned0853.c,v 1.2 2001/02/12 00:03:34 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int eval_logic_link ( +struct WINDOWCTRL *w, /* Window, in dem gesucht werden soll */ +char *direction) /* Richtungsangabe des Links */ +/* return -1 ... error */ +/* 0 ... not found */ +/* 1 ... found, ok */ +{ + struct LINE *lp; + struct FEATURE *fp= (struct FEATURE *) 0; + struct LINE *ftr_text; + int lin; + + if (find_feature_with_attribute (w->WC_act, 0x0003, + "hyx.l", "dir", direction, &lp, &lin, &fp) == 1 + ||find_feature_with_attribute (w->WC_act, 0x0003, + "HLINK", "dir", direction, &lp, &lin, &fp) == 1) + { + if (fp != (struct FEATURE *) 0 + && (ftr_text= (struct LINE *) fp->ftr_text_line) != (struct LINE *) 0) + { + ned_eval_line (ftr_text, 1, ftr_text, ftr_text->lng -1, HYOPT_logic_link); + return 1; + } + } + + return 0; +} diff --git a/app/ned/08/ned0854a.c b/app/ned/08/ned0854a.c new file mode 100644 index 0000000000000000000000000000000000000000..4345f89f5f77aae8ab81c5dd0e065ddebd0e90a3 --- /dev/null +++ b/app/ned/08/ned0854a.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/08/ned0854a.c + * + * written: 1991 06 25 + * latest update: 1996-05-25 10:43:58 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_logic_link_next () +{ + eval_logic_link (aw, "next"); +} diff --git a/app/ned/08/ned0854b.c b/app/ned/08/ned0854b.c new file mode 100644 index 0000000000000000000000000000000000000000..e83f82c00286330f6eb89cf4aee16d4dfb5763b2 --- /dev/null +++ b/app/ned/08/ned0854b.c @@ -0,0 +1,22 @@ +/* + * FILE ~/usr/ned/08/ned0855.c + * + * written: 1991 06 25 + * latest update: 1994-04-10 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_logic_link_prev () +{ + eval_logic_link (aw, "prev"); +} diff --git a/app/ned/08/ned0854c.c b/app/ned/08/ned0854c.c new file mode 100644 index 0000000000000000000000000000000000000000..1715b0417c3155fe47567838e2419d568bbb14f4 --- /dev/null +++ b/app/ned/08/ned0854c.c @@ -0,0 +1,26 @@ +/* + * FILE ~/usr/ned/08/ned0856.c + * + * written: 1991 06 25 + * latest update: 1994-04-10 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern int akt_buttons; + +/* ------------------------------------------------------------------------ */ +void p_logic_link_menu () +{ + if (akt_buttons & LL_menu) eval_logic_link (aw, "menu"); else + if (akt_buttons & LL_more) p_logic_link_more (); else + p_link_more (); +} diff --git a/app/ned/08/ned0854d.c b/app/ned/08/ned0854d.c new file mode 100644 index 0000000000000000000000000000000000000000..8eb24d1edb8bb6bfbde8c876e49ec1665bc80aad --- /dev/null +++ b/app/ned/08/ned0854d.c @@ -0,0 +1,22 @@ +/* + * FILE ~/usr/ned/08/ned0857.c + * + * written: 1991 06 25 + * latest update: 1994-12-28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_logic_link_up () +{ + eval_logic_link (aw, "up"); +} diff --git a/app/ned/08/ned0854e.c b/app/ned/08/ned0854e.c new file mode 100644 index 0000000000000000000000000000000000000000..07b06d75083f05af09e323d1cdbd3b13529fd552 --- /dev/null +++ b/app/ned/08/ned0854e.c @@ -0,0 +1,22 @@ +/* + * FILE ~/usr/ned/08/ned0874.c + * + * written: 1991 09 27 + * latest update: 1994-05-15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_logic_link_lang () +{ + eval_logic_link (aw, "lang"); +} diff --git a/app/ned/08/ned0854f.c b/app/ned/08/ned0854f.c new file mode 100644 index 0000000000000000000000000000000000000000..a1573fba46ad3e828c092876433694f6a1e2e6ac --- /dev/null +++ b/app/ned/08/ned0854f.c @@ -0,0 +1,22 @@ +/* + * FILE ~/usr/ned/08/ned0854f.c + * + * written: 1994-05-15 + * latest update: 1994-05-15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_logic_link_sort () +{ + eval_logic_link (aw, "sort"); +} diff --git a/app/ned/08/ned0854g.c b/app/ned/08/ned0854g.c new file mode 100644 index 0000000000000000000000000000000000000000..8740792f7028c945969ddc935ba928d1cffdb99b --- /dev/null +++ b/app/ned/08/ned0854g.c @@ -0,0 +1,22 @@ +/* + * FILE ~/usr/ned/08/ned0854g.c + * + * written: 1994-05-15 + * latest update: 1995-06-24 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_logic_link_view () +{ + eval_logic_link (aw, "view"); +} diff --git a/app/ned/08/ned0854h.c b/app/ned/08/ned0854h.c new file mode 100644 index 0000000000000000000000000000000000000000..e2045b7dc4efd8d9d2d3add0dcbd0341fad35191 --- /dev/null +++ b/app/ned/08/ned0854h.c @@ -0,0 +1,28 @@ +/* + * FILE %ned/08/ned0854h.c + * + * prompt for a logic link name and evaluate it + * + * written: 1991 06 25 + * latest update: 1996-11-03 17:40:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_logic_link () +{ + char str [80]; + + str [0]= 0; + if (rd_str ("Logic Link Direction: ", str, 80) == -1) return; + eval_logic_link (aw, str); +} diff --git a/app/ned/08/ned0856.c b/app/ned/08/ned0856.c new file mode 100644 index 0000000000000000000000000000000000000000..8814df57da871a6bdbce6fdbcdd73ce206962ee9 --- /dev/null +++ b/app/ned/08/ned0856.c @@ -0,0 +1,35 @@ +/* + * FILE %ned/08/ned0856.c + * + * written: 1995-04-22 + * latest update: 1997-01-15 14:29:25 + * $Id: ned0856.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <sys/types.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/tfb.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_lookup_current_feature ( +char *token, /* string to be searched */ +char *line_buffer, /* string to hold feature buffer */ +char **feature_string, /* pointer to feature string */ +char **feature_type, /* type of the the feature string */ +int MAX_TOKEN, /* size of token string */ +int MAX_BUFFER) /* size of line buffer */ +{ + if (q_isolate_word (token, MAX_TOKEN, CHARSET_include, 1) == 0) + return 2; + + return ned_lookup_feature (token, line_buffer, feature_string, + feature_type, MAX_BUFFER); +} diff --git a/app/ned/08/ned0857.c b/app/ned/08/ned0857.c new file mode 100644 index 0000000000000000000000000000000000000000..ffe35ed01fcdfa4791bb3e276b1d7bcabbda04ea --- /dev/null +++ b/app/ned/08/ned0857.c @@ -0,0 +1,99 @@ +/* + * FILE %ned/08/ned0857.c + * + * see also ned_lookup_tag () + * + * written: 1995-04-22 + * latest update: 1999-04-25 16:33:34 + * $Id: ned0857.c,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/tfb.h> +#include <gg/array.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +extern struct NED_CONTEXT *ned_main_context; + +/* ------------------------------------------------------------------------ */ +int ned_lookup_feature ( +const char *token, /* string to be searched */ +char *line_buffer, /* string to hold feature buffer */ +char **feature_string, /* pointer to feature string */ +char **feature_type, /* type of the the feature string */ +int MAX_BUFFER) /* size of line buffer */ +{ + struct ARRAY_ELEMENT *e_crf; + struct NED_TAG_RULE_DESCRIPTOR *trd; + NED_tag_rule *tr; + char *act_ftr_tfb= (char *) 0; + char *act_ftr_lut= (char *) 0; +#define MAX_FIELDS 3 + char *fields [MAX_FIELDS]; + int n_fields; + int rc; + + if (feature_string == (char **) 0 || feature_type == (char **) 0) return 1; + + *feature_string= *feature_type= (char *) 0; + + /* First: check the cache */ + if (ned_lookup_feature_cache (token, feature_string, feature_type) == 1) + return 0; + + /* Second: check if there is an applicable rule */ + for (e_crf= array_top (ned_main_context->NED_CTX_tag_rules); + e_crf != (struct ARRAY_ELEMENT *) 0; + e_crf= e_crf->next) + { + if ((trd= (struct NED_TAG_RULE_DESCRIPTOR *) e_crf->payload) + != (struct NED_TAG_RULE_DESCRIPTOR *) 0 + && (tr= trd->tr) != (NED_tag_rule *) 0 + && (*tr) (token, feature_string, feature_type, trd->client_data) == 1 + ) + { /* save the result for the next time */ + ned_store_feature_cache (token, *feature_string, *feature_type); + return 0; + } + } + + /* Third: check each registered feature table */ + for (e_crf= array_top (ned_main_context->NED_CTX_feature_tables); + e_crf != (struct ARRAY_ELEMENT *) 0; + e_crf= e_crf->next) + { + act_ftr_tfb= translate_logic_filename ((char *) e_crf->payload); + + /* T2D: move that up to the context structure */ + act_ftr_lut= fnmcpy2 (act_ftr_tfb, ".lut"); + + rc= tfb_get_entry (token, act_ftr_tfb, act_ftr_lut, + line_buffer, MAX_BUFFER); + + free_or_what (act_ftr_tfb); + free_or_what (act_ftr_lut); + + if (rc == 1 + && (n_fields= split_string (line_buffer, ':', fields, MAX_FIELDS))>=3) + { + ned_store_feature_cache (token, + *feature_string= fields [2], + *feature_type= fields [1]); + + return 0; + } + } + + return 1; +} diff --git a/app/ned/08/ned0857b.c b/app/ned/08/ned0857b.c new file mode 100644 index 0000000000000000000000000000000000000000..22ac88aa290bb9c9c0d261cbb10e2e3ab9800d3d --- /dev/null +++ b/app/ned/08/ned0857b.c @@ -0,0 +1,66 @@ +/* + * FILE %ned/08/ned0857b.c + * + * T2D: + * - caching of feature lookup results + * + * see also ned_lookup_feature () + * + * written: 1996-05-24 + * latest update: 1997-08-28 13:30:52 + * $Id: ned0857b.c,v 1.3 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <sys/types.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/tfb.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +extern struct NED_CONTEXT *ned_main_context; + +/* ------------------------------------------------------------------------ */ +int ned_lookup_tag ( +const char *token, /* string to be searched */ +char *line_buffer, /* string to hold feature buffer */ +char **field_fnm, /* pointer to feature string */ +char **field_location, /* type of the the feature string */ +int MAX_BUFFER) /* size of line buffer */ +{ + struct ARRAY_ELEMENT *e_crf; + char *act_tag_file; + int rc; + int token_length; + + if (field_fnm == (char **) 0 + || field_location == (char **) 0 + || ned_main_context == (struct NED_CONTEXT *) 0 + ) return -1; + + token_length= ned_main_context->NED_CTX_tag_length; + + for (e_crf= array_top (ned_main_context->NED_CTX_tag_files); + e_crf != (struct ARRAY_ELEMENT *) 0; + e_crf= e_crf->next) + { + act_tag_file= translate_logic_filename ((char *) e_crf->payload); + + rc= tfb_get_tag_entry (token, act_tag_file, (char *) 0, + line_buffer, field_fnm, field_location, + MAX_BUFFER, token_length); + + free_or_what (act_tag_file); + + if (rc == 1) return 0; + } + + return -1; +} diff --git a/app/ned/08/ned0857c.c b/app/ned/08/ned0857c.c new file mode 100644 index 0000000000000000000000000000000000000000..21ee702d064882a632e1905cc7b8425a16db68c3 --- /dev/null +++ b/app/ned/08/ned0857c.c @@ -0,0 +1,72 @@ +/* + * FILE %ned/08/ned0857c.c + * + * implements the cache for ned_lookup_feature () + * + * written: 1996-11-03 + * latest update: 1999-04-25 16:33:37 + * $Id: ned0857c.c,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/ytree.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/tfb.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct YTREE *features= (struct YTREE *) 0; + +/* ------------------------------------------------------------------------ */ +int ned_lookup_feature_cache ( +const char *token, /* string to be searched */ +char **feature_string, /* pointer to feature string */ +char **feature_type) /* type of the the feature string */ +{ + struct NED_FLC *flc; + + if ((flc= (struct NED_FLC *) + ytree_get_value (features, (unsigned char *) token)) + != (struct NED_FLC *) 0) + { + *feature_string= flc->str; + *feature_type= flc->ty; + + return 1; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_store_feature_cache ( +const char *token, /* string to be searched */ +const char *feature_string, /* pointer to feature string */ +const char *feature_type) /* type of the the feature string */ +{ + struct NED_FLC *flc; + + if ((flc= new_ned_flc ()) == (struct NED_FLC *) 0) return -1; + + flc->ty= strdup (feature_type); + flc->str= strdup (feature_string); + + if ((flc= (struct NED_FLC *) + ytree_set_value (&features, (unsigned char *) token, (long) flc)) + != (struct NED_FLC *) 0) + { /* something else was stored before */ + free_or_what (flc->ty); + free_or_what (flc->str); + free_or_what (flc); + } + + return 0; +} diff --git a/app/ned/08/ned0858.c b/app/ned/08/ned0858.c new file mode 100644 index 0000000000000000000000000000000000000000..49e9383d90baf5792c8c84245e233eee4eb6070b --- /dev/null +++ b/app/ned/08/ned0858.c @@ -0,0 +1,107 @@ +/* + * FILE %ned/08/ned0858.c + * + * see also: + * - ned_blk_iconify () + * - ned_rename_object () + * - ned_cb_rename_frame () + * + * written: 1995-02-09 + * latest update: 1999-05-14 21:22:09 + * $Id: ned0858.c,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_rename_frame (struct WINDOWCTRL *w, const char *fnm, int file_fmt) +{ + struct FRAMECTRL *fc; + struct CLUSTERCTRL *cc; + struct LINE *lc_act, *lc_first; /* pointers from WINDOWCTRL *w */ + + /* Hypertext frames are not only renamed in the window itself, instead, */ + /* their name must be changed in the text, that is in the frame-tag. */ + +printf ("0858: rename_frame: fnm='%s' file_fmt=%d\n", fnm, file_fmt); + if (w == (struct WINDOWCTRL *) 0 + /* || w->file_type == FTY_FTRWDW */ + || (fc= (struct FRAMECTRL *) w->file_or_frame) == (struct FRAMECTRL *) 0 + || (cc= fc->cluster) == (struct CLUSTERCTRL *) 0 + || fnm == (char *) 0 + || *fnm == 0 + ) return -1; + + /* save pointers of the old window control structure */ + lc_act= w->WC_act; + lc_first= w->WC_first; + + /* reset pointers in the old window and frame control structures */ + w->WC_act= w->WC_first= (struct LINE *) 0; + w->file_or_frame= (void *) 0; + + if (fc->links-- == 0) /* most likely, fc->links will now be 0 */ + ned_deactivate_frame (fc); + + if ((fc= ned_activate_frame (cc, fnm, w, 0x02, file_fmt, + (char *) 0, (char *) 0)) + == (struct FRAMECTRL *) 0) + { + /* T2D: this is a problem!!! */ + } + + w->f_upd= 1; + + /* if original frame didn't contain any lines, don't bother to */ + /* insert anything in the newly activated frame */ + if (lc_act != (struct LINE *) 0) + { + struct LINE *lc_insert; /* insert position in new window */ + struct LINE *lc_xx; + + /* 1a. find the end of the new frame, */ + /* 1b. remove last line, containing the end-of-frame tag */ + /* 2a. find the beginning of the old frame, */ + /* 2b. remove first line containing the begin-of-frame tag */ + /* 3. append old frame to new frame to produce a complete */ + /* frame with begin and end frame tags */ + + /* 1a. */ + if ((lc_insert= ned_find_last_line (w->WC_act)) != (struct LINE *) 0) + { + struct LINE *lc_top; /* top line of old w */ + + lc_xx= lc_insert; + if (lc_insert->prev != (struct LINE *) 0) + { /* 1b. */ + lc_insert= lc_insert->prev; + lc_xx->prev= (struct LINE *) 0; + ned_lines_free (lc_xx); + } + + /* 2a. */ + lc_xx= lc_top= ned_find_first_line (lc_act); + if (lc_top->next != (struct LINE *) 0) + { /* 2b. */ + lc_top= lc_top->next; + lc_xx->next= (struct LINE *) 0; + ned_lines_free (lc_xx); + } + + lc_insert->next= lc_top; + lc_top->prev= lc_insert; + } + + w->WC_act= w->WC_first= lc_insert; + } + + return 0; +} diff --git a/app/ned/08/ned0858b.c b/app/ned/08/ned0858b.c new file mode 100644 index 0000000000000000000000000000000000000000..fbe039f396f5573aec8b2a0a1e81c84736ac0103 --- /dev/null +++ b/app/ned/08/ned0858b.c @@ -0,0 +1,50 @@ +/* + * FILE %ned/08/ned0858b.c + * + * see also: + * - ned_rename_frame () + * + * written: 1996-07-28 + * latest update: 1999-04-25 16:33:39 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" + +extern char *ned_renamed_object; + +/* ------------------------------------------------------------------------ */ +int ned_cb_rename_frame (char *str, int size, int malloced, void *cb_data) +{ + struct WINDOWCTRL *wc; + +#ifdef MSDOS + size; +#endif /* MSDOS */ + + if ((wc= (struct WINDOWCTRL *) cb_data) != (struct WINDOWCTRL *) 0 + && str != (char *) 0 + ) + { + ned_rename_frame (wc, str, wc->file_format); + + if (ned_renamed_object != (char *) 0 + && str != ned_renamed_object /* str *can* point to that buffer */ + ) /* since this is a callback fnc. */ + strcpy_max (ned_renamed_object, str, MAX_FNM_LENGTH); + + ned_wc_memorize_location (wc); + ned_display_window (wc); + if (malloced) free (str); + } + + return 0; +} diff --git a/app/ned/08/ned0859.c b/app/ned/08/ned0859.c new file mode 100644 index 0000000000000000000000000000000000000000..8a23cc3319fd911fce2cb99c41b5689d7d80b5bd --- /dev/null +++ b/app/ned/08/ned0859.c @@ -0,0 +1,26 @@ +/* + * FILE ~/usr/ned/08/ned0859.c + * + * written: 1991 06 25 + * latest update: 1994-07-10 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int eval_ned_parameter (char *str, int option) +{ +#ifdef MSDOS + option; +#endif + + return eval_window_parameters (aw, str); +} diff --git a/app/ned/08/ned0860.c b/app/ned/08/ned0860.c new file mode 100644 index 0000000000000000000000000000000000000000..97fd345e26e5a70b528061998ffd88dc662fd520 --- /dev/null +++ b/app/ned/08/ned0860.c @@ -0,0 +1,39 @@ +/* + * FILE %ned/08/ned0860.c + * + * written: 1991 07 04 + * latest update: 1996-07-26 4:06:27 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +static char *dir [] = { "next", "prev", "menu", "up" }; +static int flgs [] = { LL_next, LL_prev, LL_menu, LL_up }; + +/* ------------------------------------------------------------------------ */ +int check_logic_links (struct WINDOWCTRL *w) +{ + struct LINE *lp; + struct FEATURE *fp; + int lin; + int i; + int rc= 0; + + for (i= 0;i<4;i++) + { + fp= (struct FEATURE *) 0; + if (find_feature_with_attribute (w->WC_act, 0x0003, + "HLINK", "dir", dir[i], &lp, &lin, &fp) == 1 + ||find_feature_with_attribute (w->WC_act, 0x0003, + "hyx.l", "dir", dir[i], &lp, &lin, &fp) == 1) + rc |= flgs[i]; + } + return rc; +} diff --git a/app/ned/08/ned0861.c b/app/ned/08/ned0861.c new file mode 100644 index 0000000000000000000000000000000000000000..bcc93b2883212b84f9b12088954879f47b2248cf --- /dev/null +++ b/app/ned/08/ned0861.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/08/ned0861.c + * + * written: 1991 07 05 + * latest update: 1998-08-15 12:42:37 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_set_SGML_tag () +{ + ned_wc_feature_create (aw, Ftype_SGML_TAG, 0, (char *) 0); +} diff --git a/app/ned/08/ned0862.c b/app/ned/08/ned0862.c new file mode 100644 index 0000000000000000000000000000000000000000..789dc63405f679091cefc72ae75005290701d3c2 --- /dev/null +++ b/app/ned/08/ned0862.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/08/ned0862.c + * + * written: 1991 07 05 + * latest update: 1998-08-15 12:42:48 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_set_SGML_entity () +{ + ned_wc_feature_create (aw, Ftype_SGML_ENTITY, 0, (char *) 0); +} diff --git a/app/ned/08/ned0863.c b/app/ned/08/ned0863.c new file mode 100644 index 0000000000000000000000000000000000000000..8c92f631b91b5800793c433d2bdd94306348dcdc --- /dev/null +++ b/app/ned/08/ned0863.c @@ -0,0 +1,425 @@ +/* + * $Id: ned0863.c,v 1.4 2002/06/15 04:35:21 gonter Exp $ + * FILE %ned/08/ned0863.c + * + * preset a feature + * see also: ned0884.c void ned_set_lookup_tag () + * ned0867.c void ned_memorize_location () + * + * T2D: sprintf (str, ..., int); sgml_add_attribute (name, str) + * umbauen! + * + * written: 1991 07 05 + * latest update: 2000-06-05 13:39:41 + * $Id: ned0863.c,v 1.4 2002/06/15 04:35:21 gonter Exp $ + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/tfb.h> + +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern char *default_start_frame; + +int ned_cb_feature_create (char *str, int size, int malloced, void *cb_data); + +/* ------------------------------------------------------------------------ */ +extern char *mem_file; +extern char *mem_frame; +extern char *mem_cluster; +extern char *mem_mark; +extern int mem_line; +extern int mem_column; + +extern char *default_help_cluster; +extern char *default_help_prompt_attrib; + +static char *_hyx_l= "hyx.l"; +static char *_tdc= "tdc"; +static char *_tdp= "tdp"; +static char *_mark= "mark"; + +/* ------------------------------------------------------------------------ */ +struct NED_CF_CB +{ + struct WINDOWCTRL *wc; + struct LINE *lp; + int idx; + + int what; + int rc; + int ftr_edit_mode; + + int mode; +#define CB_MODE_str 0 /* use str */ +#define CB_MODE_ot 1 /* use ot */ + + char *name; + char *str; + + struct SGML_BUILDUP *sgml_build; + struct SGML_OPENING_TAG *ot; +} ; + +/* ------------------------------------------------------------------------ */ +int ned_wc_feature_create ( +struct WINDOWCTRL *wc, +int what, /* type of tag to create */ +int ftr_edit_mode, /* FTR_EDIT_* */ +char *attribute) /* if FTR_EDIT_ATTRIBUTE */ +{ + struct LINE *lp; + void *ptr; + int ftr_segment_cnt= 0; /* number of feature parts */ +#define MAX_BUFFER1 160 +#define MAX_BUFFER2 16 + char *buffer1a; + char buffer1b [MAX_BUFFER1]; + char buffer2a [MAX_BUFFER2]; + char *feature_string= (char *) 0; + char *feature_type= (char *) 0; + char *hyx_l_attr= _mark; + struct NED_CF_CB *cb= (struct NED_CF_CB *) 0; + struct SGML_BUILDUP *sgml_build= (struct SGML_BUILDUP *) 0; + struct SGML_OPENING_TAG *ot= (struct SGML_OPENING_TAG *) 0; + struct SGML_ATTRIBUTE_LIST *attr; + int max_buffer1a; + int off_buffer1a; + + if (wc == (struct WINDOWCTRL *) 0 + || (lp= wc->WC_act) == (struct LINE *) 0 + || (cb= calloc (sizeof (struct NED_CF_CB), 1)) == (struct NED_CF_CB *) 0 + || (cb->str= buffer1a= malloc (MAX_BUFFER1)) == (char *) 0 + || (cb->sgml_build= sgml_build= sgml_initialize_buildup ()) + == (struct SGML_BUILDUP *) 0 + || (cb->ot= ot= sgml_new_opening_tag (sgml_build, _hyx_l)) + == (struct SGML_OPENING_TAG *) 0 + ) goto ERROR; + + cb->wc= wc; + cb->lp= lp; + + if (wc->file_type == FTY_FTRWDW) + { + ned_message_1 ("no features in feature window!"); + goto ERROR; + } + + switch (what) + { + /* T2D: Ftype_SGML_TAG + ENTITY wieder reinnehmen und als */ + /* string Type implementieren; siehe lookup */ + case Ftype_SGML_ENTITY: + strcpy (buffer1a, "&;"); + cb->mode= CB_MODE_str; + what= Ftype_SGML_entity_string; + break; + + case Ftype_SGML_TAG: + strcpy (buffer1a, "<>"); + cb->mode= CB_MODE_str; + what= Ftype_SGML_tag_string; + break; + + + case Ftype_hyx_l: /* set complete hyx.l, if possible with memorized */ + /* frame name, cluster name and frame coordinates */ +MAKE_HYX_L_TAG: + what= Ftype_SGML_tag_string; + cb->mode= CB_MODE_ot; + + /* insert link coordinates of a memorized frame or file */ + if (mem_file != (char *) 0) + { + if ((ptr= wc->file_or_frame) == (void *) 0) ptr= wc->WC_title_short; + + if (wc->file_type != FTY_PLAIN + || (wc->file_type == FTY_PLAIN + && ptr != (char *) 0 + && strcmp ((char *) ptr, mem_file) != 0 + ) + ) + { /* ommit the file= parameter if the filenames are the same */ + if ((attr= sgml_add_attribute (ot, + "file", + get_relative_path ((char *) ptr, mem_file))) + == (struct SGML_ATTRIBUTE_LIST *) 0) + goto ERROR; + } + cb->rc= 1; + } + else + if (mem_frame != (char *) 0) + { + if (mem_cluster != (char *) 0 + && (wc->file_type != FTY_HYPER + || (ptr= wc->file_or_frame) == (void *) 0 + || (ptr= ((struct FRAMECTRL *) ptr)->cluster) == (void *) 0 + || (ptr= ((struct CLUSTERCTRL *) ptr)->cluster_name_hyx) + == (struct CLUSTERCTRL *) 0 + || strcmp_c ((char *) ptr, mem_cluster) != 0 + ) + ) + { + if ((attr= sgml_add_attribute (ot, + "cl", + find_logic_filename (mem_cluster, buffer1a, MAX_BUFFER1) + ? buffer1a : mem_cluster)) + == (struct SGML_ATTRIBUTE_LIST *) 0) + goto ERROR; + } + + if ((attr= sgml_add_attribute (ot, "fr", mem_frame)) + == (struct SGML_ATTRIBUTE_LIST *) 0) + goto ERROR; + cb->rc= 1; + } + else + { + if ((attr= sgml_add_attribute (ot, "fr", default_start_frame)) + == (struct SGML_ATTRIBUTE_LIST *) 0) + goto ERROR; + } + + /* highlighting for the word at the character position */ + if (q_isolate_word (buffer1a, MAX_BUFFER1, CHARSET_token, 1) != 0) + { + if ((attr= sgml_add_attribute (ot, _tdc, _hyx_l)) + == (struct SGML_ATTRIBUTE_LIST *) 0 + || (attr= sgml_add_long_attribute (ot, _tdp, + (long) strlen (buffer1a))) + == (struct SGML_ATTRIBUTE_LIST *) 0 + ) goto ERROR; + } + + /* set the destination marker id or a line/colum number */ + if (mem_mark != (char *) 0) + { + if ((attr= sgml_add_attribute (ot, _mark, mem_mark)) + == (struct SGML_ATTRIBUTE_LIST *) 0) + goto ERROR; + } + else + { + if (mem_line > 1) + { + sprintf (buffer2a, "%d", mem_line); + if ((attr= sgml_add_attribute (ot, "ln", buffer2a)) + == (struct SGML_ATTRIBUTE_LIST *) 0) + goto ERROR; + if (mem_column > 0) + { + sprintf (buffer2a, "%d", mem_column); + if ((attr= sgml_add_attribute (ot, "cn", buffer2a)) + == (struct SGML_ATTRIBUTE_LIST *) 0) + goto ERROR; + } + } + } + + break; + + case Ftype_mark: /* SHIFT-TAB: set mark tag */ + what= Ftype_SGML_tag_string; + cb->mode= CB_MODE_ot; + if (q_isolate_word (buffer1a, MAX_BUFFER1, CHARSET_token, 1) == 0) + return -1; + + sprintf (buffer2a, "%d", strlen (buffer1a)); + cb->name= "name"; + if ((attr= sgml_add_attribute (ot, _tdc, _mark)) + == (struct SGML_ATTRIBUTE_LIST *) 0 + || (attr= sgml_add_attribute (ot, _tdp, buffer2a)) + == (struct SGML_ATTRIBUTE_LIST *) 0 + ) goto ERROR; + break; + + case Ftype_lookup_fr2: /* set hyx.l after *successful* lookup; use current frame */ + hyx_l_attr= "fr"; + what= Ftype_SGML_tag_string; + + max_buffer1a= MAX_BUFFER1; + off_buffer1a= 0; + + if (wc->file_type == FTY_HYPER + && (ptr= (struct FRAMECTRL *) wc->file_or_frame) != (void *) 0) + { + char *fn= ((struct FRAMECTRL *) ptr)->frame_name; + + strncpy (buffer1a, fn, MAX_BUFFER1); + off_buffer1a= strlen (fn); + buffer1a [off_buffer1a++]= ' '; + buffer1a [off_buffer1a]= 0; + max_buffer1a= MAX_BUFFER1 - off_buffer1a; + } + + if (q_isolate_word (buffer1a + off_buffer1a, max_buffer1a, + CHARSET_token, 1) == 0) goto MAKE_HYX_L_TAG; + sprintf (buffer2a, "%d", strlen (buffer1a + off_buffer1a)); +fprintf (stderr, "%s %d tdp=%s buffer1a='%s'\n", __FILE__, __LINE__, buffer2a, buffer1a); + goto MAKE_HYX_L_MARK2; + + case Ftype_lookup_fr: /* CTRL-TAB: set hyx.l after *successful* lookup */ + hyx_l_attr= "fr"; + + case Ftype_hyx_l_mark: /* SHIFT-TAB: set hyx.l after unsuccessful lookup */ + what= Ftype_SGML_tag_string; + if (q_isolate_word (buffer1a, MAX_BUFFER1, CHARSET_token, 1) == 0) + goto MAKE_HYX_L_TAG; + +MAKE_HYX_L_MARK: + sprintf (buffer2a, "%d", strlen (buffer1a)); + /* T2D: this length depends on buffer1a which can be edited later! */ + +MAKE_HYX_L_MARK2: + cb->mode= CB_MODE_ot; + cb->name= hyx_l_attr; + if ((attr= sgml_add_attribute (ot, _tdc, _hyx_l)) + == (struct SGML_ATTRIBUTE_LIST *) 0 + || (attr= sgml_add_attribute (ot, _tdp, buffer2a)) + == (struct SGML_ATTRIBUTE_LIST *) 0 + ) goto ERROR; + break; + + case Ftype_lookup: /* ALT-TAB: set hyx.l after *successful* lookup */ + what= Ftype_SGML_tag_string; + cb->mode= CB_MODE_str; + + switch (ned_lookup_current_feature (buffer1a, buffer1b, + &feature_string, &feature_type, MAX_BUFFER1, MAX_BUFFER1)) + { + case 0: + if (feature_string == (char *) 0 + || feature_type == (char *) 0 + || strcmp (feature_type, "F") != 0 + ) goto MAKE_HYX_L_MARK; + break; + case 1: + goto MAKE_HYX_L_MARK; + default: + /* case 2: */ + return -1; + } + + switch (feature_string [0]) + { + case '<': + what= Ftype_SGML_tag_string; + break; + case '&': + what= Ftype_SGML_entity_string; + break; + default: + what= Ftype_SGML_tag_string2; + break; + } + + strcpy_max (buffer1a, feature_string, MAX_BUFFER1); + break; + + default: + goto DISPOSE; + } + + cb->what= what; + cb->idx= wc->cx + wc->hv - wc->ax; + cb->ftr_edit_mode= ftr_edit_mode; + + if (ftr_edit_mode == FTR_EDIT_ATTRIBUTE) + /* T2D: 1997-06-15 10:18:50 REDISIGN !! */ + { /* T2D: this edits just a predefined attribute! */ + if (attribute == (char *) 0) attribute= "attr="; + + ned_prompt_string (attribute, buffer1a, MAX_BUFFER1, + default_help_cluster, default_help_prompt_attrib, + ned_cb_feature_create, (void *) cb); + + return 0; + } + + return ned_cb_feature_create (strdup (buffer1a), 0, 1, (void *) cb); + +ERROR: + /* T2D: free what's malloced */ + return -1; + +DISPOSE: + /* T2D: free what's malloced */ + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_cb_feature_create (char *str, int size, int malloced, void *cb_data) +{ + struct WINDOWCTRL *wc; + struct LINE *lp; + int ftr_edit_mode; + int rc; + struct NED_CF_CB *cb; + +#ifdef MSDOS + str; size; malloced; +#endif + + if ((cb= (struct NED_CF_CB *) cb_data) == (struct NED_CF_CB *) 0 + || (wc= cb->wc) == (struct WINDOWCTRL *) 0 + || (lp= cb->lp) == (struct LINE *) 0 + ) + return 0; + + ftr_edit_mode= cb->ftr_edit_mode; + rc= cb->rc; + + if (cb->mode == CB_MODE_str) + { + ned_wc_simple_feature_create (wc, lp, cb->idx, cb->what, cb->str); + } + else /** if (cb->mode == CB_MODE_ot) **/ + { + char *xstr; + + if (cb->name != (char *) 0) + sgml_add_attribute (cb->ot, cb->name, str); + + if ((xstr= sgml_tag_to_string (cb->ot, (char *) 0, 0, 0)) != (char *) 0) + { + ned_wc_simple_feature_create (wc, lp, cb->idx, cb->what, xstr); + free (xstr); + } + } + + /* T2D: wc does not have to be on display at this point any more */ + wd_displine (wc, lp, wc->cy, wc->ax, wc->bx); + + if (ftr_edit_mode == FTR_EDIT_ALL + || (ftr_edit_mode == FTR_EDIT_ALL_COND && !rc) + || ftr_edit_mode == FTR_EDIT_STRING /* not yet finished */ + || ftr_edit_mode == FTR_EDIT_STRUCTURED /* not yet finished */ + ) + p_link_feature (); + + if (malloced) free_or_what (str); + + sgml_destroy_tag (cb->ot); + free (cb->sgml_build); + free (cb->str); + /* NOTE: cb->name: static, not malloced!! */ + + free (cb); + + return rc; +} diff --git a/app/ned/08/ned0863b.c b/app/ned/08/ned0863b.c new file mode 100644 index 0000000000000000000000000000000000000000..e8cc19a8458dfab3c21c1ec40bda0898803e7b70 --- /dev/null +++ b/app/ned/08/ned0863b.c @@ -0,0 +1,74 @@ +/* + * FILE %ned/08/ned0863.c + * + * preset a feature + * + * written: 1997-06-16: extracted from ned0863.c + * latest update: 1999-04-25 16:33:45 + * $Id: ned0863b.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/tfb.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_wc_simple_feature_create ( +struct WINDOWCTRL *wc, +struct LINE *lp, +int idx, +int what, /* type of tag to create */ +char *str) +{ + int ftr_segment_cnt= 1; /* number of feature parts */ + char *ftr_segment [5]; + + if (wc == (struct WINDOWCTRL *) 0 + || lp == (struct LINE *) 0 + || idx < 0 + ) return -1; + + switch (what) + { + default: + return -1; + + case Ftype_SGML_entity_string: + ftr_segment [0]= str; + what= Ftype_SGML_ENTITY; + break; + + case Ftype_SGML_tag_string: + ftr_segment [0]= str; + what= Ftype_SGML_TAG; + break; + + case Ftype_SGML_tag_string2: + ftr_segment [0]= "<"; + ftr_segment [1]= str; + ftr_segment [2]= ">"; + what= Ftype_SGML_TAG; + ftr_segment_cnt= 3; + break; + } + + ned_feature_set (wc, lp, idx, what, + ftr_segment_cnt, (const char **) ftr_segment); + + /* T2D: wc does not have to be on display at this point any more */ + wd_displine (wc, lp, wc->cy, wc->ax, wc->bx); + + return 0; +} + diff --git a/app/ned/08/ned0864.c b/app/ned/08/ned0864.c new file mode 100644 index 0000000000000000000000000000000000000000..9d7b421090a276894f40eb2d49f9bfc4fb823dd4 --- /dev/null +++ b/app/ned/08/ned0864.c @@ -0,0 +1,91 @@ +/* + * FILE %ned/08/ned0864.c + * + * create the contents of an otherwise empty frame + * + * written: 1991 07 05 + * latest update: 1999-05-12 12:03:22 + * $Id: ned0864.c,v 1.7 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern char *ned_renamed_object; + +#define NEW_COLOUR (WV_GELB|WH_BRAUN) + +/* ------------------------------------------------------------------------ */ +int initialize_frame (struct WINDOWCTRL *w, const char *fr_name) +{ + struct LINE *l2, *l1; + struct FEATURE *f; + const char *frame_begin [3] = { "<Frame ", (char *) 0, ">" } ; + const char *frame_end [2] = { "</Frame>", (char *) 0 } ; + + if (w == (struct WINDOWCTRL *) 0 + || (l2= alloc_line ()) == (struct LINE *) 0 + || (l1= alloc_line ()) == (struct LINE *) 0 + ) + return -1; + + /* duplicated code from ned_rename_object () */ + if (ned_renamed_object == (char *) 0) + { + if ((ned_renamed_object= malloc (MAX_FNM_LENGTH)) == (char *) 0) + return -1; + + ned_renamed_object [0]= 0; + } + + qq_insert_string (l2, 0, frame_end [0], 8, 1); + frame_begin [1]= fr_name; + strcpy_max (ned_renamed_object, fr_name, MAX_FNM_LENGTH); + + if (w->file_format == FMT_SGML) + { + if ((f= q_feature_set (l2, 0, Ftype_SGML_TAG, 1, frame_end)) + != (struct FEATURE *) 0) + { + f->ftr_display_mode= FTR_display_replarray; + f->ftr_replarray_size= 8; + f->ftr_colour= NEW_COLOUR; + } + + qq_insert_string (l1, 0, "<Frame>", 7, 1); + + if ((f= q_feature_set (l1, 0, Ftype_SGML_TAG, 3, frame_begin)) + != (struct FEATURE *) 0) + { + f->ftr_display_mode= FTR_display_replarray; + f->ftr_replarray_size= 7; + f->ftr_colour= NEW_COLOUR; + } + } + else + { + qq_insert_string_array (l1, 0, frame_begin, 3, 1); + } + + l2->prev= l1; + l1->next= l2; + + w->WC_act= w->WC_first= l1; + w->znr= 1; + w->cx= w->ax; + w->cy= w->ay; + w->hv= 0; + w->ins_flg= INSFLG_insert; + w->f_upd= 1; + + + return 0; +} diff --git a/app/ned/08/ned0865.c b/app/ned/08/ned0865.c new file mode 100644 index 0000000000000000000000000000000000000000..a3525f3bb85967b00008c8151650bea6005cbb05 --- /dev/null +++ b/app/ned/08/ned0865.c @@ -0,0 +1,24 @@ +/* + * FILE %ned/08/ned0865.c + * + * written: 1991 07 05 + * 1994-04-10: renamed from p_set_HLINK to p_set_hyx_l + * latest update: 1998-08-15 12:43:02 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_set_hyx_l () +{ + ned_wc_feature_create (aw, Ftype_hyx_l, FTR_EDIT_ALL_COND, (char *) 0); + /* dont open the feature window if the link came from memory */ +} diff --git a/app/ned/08/ned0866.c b/app/ned/08/ned0866.c new file mode 100644 index 0000000000000000000000000000000000000000..2b95697260beff10373420c617d0f75ce5778bde --- /dev/null +++ b/app/ned/08/ned0866.c @@ -0,0 +1,45 @@ +/* + * FILE %ned/08/ned0866.c + * + * written: 1991 07 05 + * latest update: 2001-02-11 11:10:06 + * $Id: ned0866.c,v 1.2 2001/02/12 00:03:34 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* #define DEBUG */ +#ifdef DEBUG +#include <stdio.h> +#endif + +/* ------------------------------------------------------------------------ */ +int show_feature (struct FEATURE *fp) +{ +#define LIN_SIZ 80 + char lin [LIN_SIZ]; + struct LINE *l; + + if (fp == (struct FEATURE *) 0 + || (l= fp->ftr_text_line) == (struct LINE *) 0 + ) return -1; + +#ifdef DEBUG + sprintf (lin, "ty=%d w=%d dm=%d c=0x%04X ras=%d", + fp->ftr_type, fp->ftr_weight, fp->ftr_display_mode, + fp->ftr_colour, fp->ftr_replarray_size); + ned_message_1 (lin); +#else + if (ned_line_2_string (l, 0, l, l->lng, lin, LIN_SIZ, 0L, 0x0000) + != (char *) 0) + ned_message_1 (lin); +#endif + + return 0; +} diff --git a/app/ned/08/ned0867.c b/app/ned/08/ned0867.c new file mode 100644 index 0000000000000000000000000000000000000000..5fc06bf71d7422c0931ad576081ba942df07efe7 --- /dev/null +++ b/app/ned/08/ned0867.c @@ -0,0 +1,115 @@ +/* + * FILE %ned/08/ned0867.c + * + * written: 1991 07 18 + * latest update: 1998-08-16 12:39:59 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#include <gg/strings.h> +#endif + +#include <string.h> +#include <gg/hyx.h> +#include <gg/strings.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +#define LIN_SIZ 80 +#define MARK_SIZ 80 +static char xxx_mark [MARK_SIZ]; + +char *mem_file= (char *) 0; +char *mem_frame= (char *) 0; +char *mem_cluster= (char *) 0; +char *mem_mark= (char *) 0; +int mem_line= 0; +int mem_column= 0; + +/* ------------------------------------------------------------------------ */ +void ned_forget_location () +{ + free_or_what (mem_file); + free_or_what (mem_frame); + free_or_what (mem_cluster); + /**** free_or_what (mem_mark); ATTN: this pointer is not malloc'ed!!! */ + + mem_file= mem_frame= mem_cluster= mem_mark= (char *) 0; + mem_line= mem_column= 0; +} + +/* ------------------------------------------------------------------------ */ +void ned_wc_memorize_location (struct WINDOWCTRL *wc) +{ + char *ff= "??"; + void *ptr; + struct LINE *lp; + struct FEATURE *fp; + char lin [LIN_SIZ]; + struct FRAMECTRL *fc; + struct CLUSTERCTRL *cc; + + ned_forget_location (); + + if (wc == (struct WINDOWCTRL *) 0 + || wc->file_or_frame == (void *) 0 + || wc->WC_act == (struct LINE *) 0 + ) return; + + mem_line= wc->znr; + mem_column= wc->cx - wc->ax + wc->hv; + + switch (wc->file_type) + { + case FTY_PLAIN: + if ((mem_file= wc->WC_title_short) == (char *) 0) + mem_file= ((struct FILECTRL *) wc->file_or_frame)->FC_fnm_txt; + + if (mem_file != (char *) 0 + && (mem_file= strdup (mem_file)) != (char *) 0 + ) + { + ff= "file"; +#ifdef MSDOS + to_lower (mem_file); +#endif + } + break; + + case FTY_HYPER: + mem_frame= strdup ((fc= wc->file_or_frame)->frame_name); + if (fc != (struct FRAMECTRL *) 0 + && (cc= fc->cluster) != (struct CLUSTERCTRL *) 0) + mem_cluster= strdup (cc->cluster_name_hyx); + + ff= "frame"; + break; + + default: return; + } + + for (fp= wc->WC_act->ftr; fp != (struct FEATURE *) 0; fp= fp->ftr_next) + if (fp->ftr_pos == mem_column + && (lp= fp->ftr_text_line) != (struct LINE *) 0 + && (ptr= lp->txt) != (struct LINE *) 0 + && ((strncmp (&((struct TXT *) ptr)->t[1], "mark ", 5) == 0 + && ned_line_2_string (lp, 1, lp, lp->lng-1, lin, LIN_SIZ, + 0L, 0x0) != (char *) 0 + && find_attr_value (lin, xxx_mark, MARK_SIZ, "id") == 0 + ) + ||(strncmp (&((struct TXT *) ptr)->t[1], "hyx.l ", 6) == 0 + && ned_line_2_string (lp, 1, lp, lp->lng-1, lin, LIN_SIZ, + 0L, 0x0) != (char *) 0 + && find_attr_value (lin, xxx_mark, MARK_SIZ, "name") == 0 + ) + ) + ) + { /* <mark> gefunden */ + mem_mark= xxx_mark; + } + + ned_message_2 (ff, " memorized"); +} diff --git a/app/ned/08/ned0867b.c b/app/ned/08/ned0867b.c new file mode 100644 index 0000000000000000000000000000000000000000..e825707db3c76ede9a7f1aaac792af8b943b5302 --- /dev/null +++ b/app/ned/08/ned0867b.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/08/ned0867b.c + * + * written: 1996-07-28 + * latest update: 1998-08-15 12:30:50 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_memorize_location () +{ + ned_wc_memorize_location (aw); +} diff --git a/app/ned/08/ned0868.c b/app/ned/08/ned0868.c new file mode 100644 index 0000000000000000000000000000000000000000..ba304b06ced6cf86b29ac4f5daa9e8d040f1d04e --- /dev/null +++ b/app/ned/08/ned0868.c @@ -0,0 +1,28 @@ +/* + * FILE %ned/08/ned0868.c + * + * written: 1991 06 25 + * latest update: 1996-07-27 9:48:14 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +static char *LL[]= { "hyx.l ", " dir=" } ; + +/* ------------------------------------------------------------------------ */ +void p_logic_link_more () +{ + ned_setup_feature_window (1, 0, 2, LL); +} + +/* ------------------------------------------------------------------------ */ +void p_link_more () +{ + ned_setup_feature_window (1, 0, 1, LL); +} diff --git a/app/ned/08/ned0869.c b/app/ned/08/ned0869.c new file mode 100644 index 0000000000000000000000000000000000000000..890df5bfd0d59cbe7189d3a881b14e03af59be60 --- /dev/null +++ b/app/ned/08/ned0869.c @@ -0,0 +1,48 @@ +/* + * FILE %ned/08/ned0869.c + * + * activate a frame in a cluster but do not create it if it did + * not exist before. + * [Note: before 1998-07-19, the frame was created] + * T2D: frame creation should be possible upon request or by + * passing a flag as a parameter [1998-07-19] + * + * written: 1991 09 25 + * latest update: 1998-08-15 11:28:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +static int create_mode= 0x00; + +/* ------------------------------------------------------------------------ */ +int ned_set_create_special (int flg) +{ + create_mode= (flg) ? 0x02 : 0x00; + return 0; +} + +/* ------------------------------------------------------------------------ */ +struct FRAMECTRL *ned_activate_special ( +const char *cl_name, +const char *fr_name, +int cr_mode) /* -1.. use default; 0 .. don't create; 1.. create */ +{ + switch (cr_mode) + { + case -1: cr_mode= create_mode; break; + case 0: cr_mode= 0x00; break; + default: cr_mode= 0x02; break; + } + + return ned_activate_cl_fr (cl_name, fr_name, cr_mode, + FMT_SGML, (char *) 0, (char *) 0); +} diff --git a/app/ned/08/ned0869b.c b/app/ned/08/ned0869b.c new file mode 100644 index 0000000000000000000000000000000000000000..f1b84cadff12e0ca0dde8c501b8570ae1015edcc --- /dev/null +++ b/app/ned/08/ned0869b.c @@ -0,0 +1,72 @@ +/* + * $Id: ned0869b.c,v 1.4 2005/09/04 18:36:07 gonter Exp $ + * FILE %ned/08/ned0869.c + * + * written: 1991 09 25 + * latest update: 2000-06-05 18:58:07 + * $Id: ned0869b.c,v 1.4 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +struct FRAMECTRL *ned_activate_cl_fr ( +const char *cl_name, +const char *fr_name, +int search_mode, +int format, +const char *template_frame, +const char *alternative_frame) +{ + struct CLUSTERCTRL *cl; + struct FRAMECTRL *fr; + +/******* +printf ("ned0869b: activate_cl_fr fr_name='%s' tf='%s' 0x%08lX\n", + fr_name, template_frame, template_frame); +*******/ + + if (cl_name == (char *) 0 || *cl_name == 0) + { + struct WINDOWCTRL *w; + + cl_name= "this cluster"; + + w= (aw->file_type == FTY_FTRWDW) ? aw->feature_window : aw; + if (w->file_type != FTY_HYPER + || (cl= ((struct FRAMECTRL *) w->file_or_frame)->cluster) + == (struct CLUSTERCTRL *) 0 + ) + { + cl_name= "%cl0"; + goto CL0; + } + } + else + { +CL0: + if ((cl= ned_activate_cluster (cl_name)) == (struct CLUSTERCTRL *) 0) + goto ERR; + } + + if ((fr= ned_activate_frame (cl, fr_name, (struct WINDOWCTRL *) 0, + search_mode, format, + template_frame, alternative_frame)) + == (struct FRAMECTRL *) 0) + { +ERR: + ned_message_4 ("couldn't activate frame ", fr_name, " in ", cl_name); + return (struct FRAMECTRL *) 0; + } + + return fr; +} diff --git a/app/ned/08/ned0870.c b/app/ned/08/ned0870.c new file mode 100644 index 0000000000000000000000000000000000000000..835b9cb80126833bf88901969dbde85b1cc013ee --- /dev/null +++ b/app/ned/08/ned0870.c @@ -0,0 +1,203 @@ +/* + * FILE %ned/08/ned0870.c + * + * note cluster: used to contain frames related to a thematic complex + * examples: start, help and notes cluster + * + * T2D: + * 1. DEF_SYMS and DEF_CLUSTER could be slashed into one structure + * a. freeing the complete note-tree with statically allocated + * nodes + * + * written: 1991 09 25 + * latest update: 1999-04-25 16:33:51 + * $Id: ned0870.c,v 1.3 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/strings.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct DEF_SYMS +{ + char *symbolic; + char *cluster; + char *tag; + int create_mode; + int memorize; +} ; + +/* ------------------------------------------------------------------------ */ +struct DEF_CLUSTER +{ + char *symbolic; + char *cluster; + int create_mode; + int memorize; +} ; + +/* ------------------------------------------------------------------------ */ +/* predefined note clusters */ +#define N_DEF_SYMS 8 +static struct DEF_SYMS def_syms [N_DEF_SYMS]= +{ + { "start", "%cl0", "hyx.l cl=\"%cl0\"", 0, 0 }, + { "help", "%cl1", "hyx.l cl=\"%cl1\"", 0, 0 }, + { "manuals", "%cl2", "hyx.l cl=\"%cl2\"", 0, 0 }, + { "docs", "%cl3", "hyx.l cl=\"%cl3\"", 0, 0 }, + { "notes", "%cl4", "hyx.l cl=\"%cl4\"", 1, 1 }, + { "cal", "%cal", "hyx.l cl=\"%cal\"", 0, 0 }, + + { "today", "%cal", "hyx.l cl=\"%cal\" fr=\"$$today\"", 0, 0 }, + /* NOTE: pico_help must be the last entry */ + { "pico_help","%cl1", "hyx.l cl=\"%cl1\" fr=\"pico_help\"", 0, 0 }, +} ; + +/* ------------------------------------------------------------------------ */ +static struct YTREE *yt_clusters= (struct YTREE *) 0; + +/* ------------------------------------------------------------------------ */ +void p_activate_cl0 () +{ + ned_symbolic_bookmark (def_syms [0].symbolic, 0); +} + +void p_activate_cl1 () +{ + ned_symbolic_bookmark (def_syms [1].symbolic, 0); +} + +void p_activate_cl2 () +{ + ned_symbolic_bookmark (def_syms [2].symbolic, 0); +} + +void p_activate_cl3 () +{ + ned_symbolic_bookmark (def_syms [3].symbolic, 0); +} + +void p_activate_cl4 () +{ + ned_symbolic_bookmark (def_syms [4].symbolic, 0); +} + +void pico_help () +{ + ned_symbolic_bookmark (def_syms [N_DEF_SYMS-1].symbolic, 0); +} + +/* ------------------------------------------------------------------------ */ +int ned_activate_note_cluster (char *buffer) +{ + char *b2; + char *fields[2]; + + if ((b2= strdup (buffer)) != (char *) 0) + { + fields [1]= (char *) 0; /* who knows, maybe it is 0xdeadbeef */ + + if (isolate_tokens (buffer, fields, 2) >= 1) + { + char *cluster; + int i; + int create_mode= -1; + int memorize= 0; + + cluster= fields [0]; + + for (i= strlen (cluster)-1; i>=0; i--) + { /* interpret note options */ + switch (cluster [i]) + { + case '!': create_mode= 1; break; + case '?': memorize= 1; break; + default: goto DONE; + } + cluster [i]= 0; + } + +DONE: + if (ned_find_note_cluster (cluster, fields [1], create_mode, memorize) + == 0) return 0; + } + } + return -1; +} + +/* ------------------------------------------------------------------------ */ +int ned_find_note_cluster ( +const char *sym_cluster, +const char *frame, +int create_mode, +int memorize) +{ + struct DEF_CLUSTER *dc; + + if (sym_cluster == (char *) 0 + || (dc= (struct DEF_CLUSTER *) ytree_get_value (yt_clusters, + (unsigned char *) sym_cluster) + ) == (struct DEF_CLUSTER *) 0 + ) return -1; + + if (memorize || dc->memorize) ned_memorize_location (); + + if (create_mode == -1) create_mode= dc->create_mode; + + if (ned_activate_special (dc->cluster, frame, create_mode) + == (struct FRAMECTRL *) 0 + ) return -1; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_define_note_cluster ( +const char *symbolic, +const char *cluster, +int create_mode, +int memorize) +{ + struct DEF_CLUSTER *dc; + + if ((dc= (struct DEF_CLUSTER *) calloc (sizeof (struct DEF_CLUSTER), 1)) + == (struct DEF_CLUSTER *) 0 + || (dc->symbolic= strdup (symbolic)) == (char *) 0 + || (dc->cluster= strdup (cluster)) == (char *) 0 + ) return -1; + + dc->create_mode= create_mode; + dc->memorize= memorize; + + ytree_set_value (&yt_clusters, (unsigned char *) symbolic, (long) dc); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_init_sym_bookmarks () +{ + int i; + + for (i= 0; i < N_DEF_SYMS; i++) + { + ned_register_bookmark (def_syms[i].symbolic, (char *) 0, "_INTERNAL", + def_syms[i].tag); + + /* T2D: Register Frame als Command */ + ned_define_note_cluster (def_syms[i].symbolic, def_syms[i].cluster, + def_syms[i].create_mode, def_syms[i].memorize); + } + + return 0; +} diff --git a/app/ned/08/ned0871.c b/app/ned/08/ned0871.c new file mode 100644 index 0000000000000000000000000000000000000000..3b12d5af3a53dfc87911ff79cf65a73372103db3 --- /dev/null +++ b/app/ned/08/ned0871.c @@ -0,0 +1,28 @@ +/* + * FILE %ned/08/ned0871.c + * + * written: 1991 09 25 + * latest update: 1998-08-15 11:45:08 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "edctx.h" +#include "proto.h" + +extern struct NED_CONTEXT *ned_main_context; +extern char *default_start_frame; + +/* ------------------------------------------------------------------------ */ +void p_activate_crf () +{ + char *crf; + + if ((crf= ned_get_context (ned_main_context, NED_CTXitem_crf))!=(char *) 0) + ned_activate_special (crf, default_start_frame, -1); +} diff --git a/app/ned/08/ned0873.c b/app/ned/08/ned0873.c new file mode 100644 index 0000000000000000000000000000000000000000..85632ad71f33f4550824e93d6a38c93e2578f105 --- /dev/null +++ b/app/ned/08/ned0873.c @@ -0,0 +1,154 @@ +/* + * FILE %ned/08/ned0873.c + * + * Bookmark Subsystem + * + * written: 1997-08-30 + * latest update: 1999-04-25 16:33:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/strings.h> +#include <gg/sbr.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct NED_BOOKMARK +{ + struct NED_BOOKMARK *bmk_next; + struct NED_BOOKMARK *bmk_next_in_section; + + char *bmk_symbolic_name; + char *bmk_title; + char *bmk_section; + char *bmk_tag_string; +}; + +/* ------------------------------------------------------------------------ */ +struct NED_BOOKMARK_SECTION +{ + struct NED_BOOKMARK *bmk_list; + struct NED_BOOKMARK **bmk_append; + + char *bmk_section; +}; + +/* ------------------------------------------------------------------------ */ +static struct YTREE *sym_bmk= (struct YTREE *) 0; +static struct YTREE *sections= (struct YTREE *) 0; +static struct NED_BOOKMARK *all_bmk= (struct NED_BOOKMARK *) 0; +static struct NED_BOOKMARK **app_bmk= &all_bmk; + +/* ------------------------------------------------------------------------ */ +int ned_register_bookmark ( +char *symbolic_name, +char *title, +char *section, +char *tag_string) +{ + struct NED_BOOKMARK *bmk; + + if (tag_string == (char *) 0 || *tag_string == 0 + || (bmk= (struct NED_BOOKMARK *) + calloc (sizeof (struct NED_BOOKMARK), 1)) + == (struct NED_BOOKMARK *) 0 + ) return -1; + + str_assign (&bmk->bmk_symbolic_name, symbolic_name); + str_assign (&bmk->bmk_title, title); + str_assign (&bmk->bmk_section, section); + str_assign (&bmk->bmk_tag_string, tag_string); + + *app_bmk= bmk; + app_bmk= &bmk->bmk_next; + + if (section != (char *) 0 && *section) + { + struct NED_BOOKMARK_SECTION *sec_bmk; + + if ((sec_bmk= (struct NED_BOOKMARK_SECTION *) + ytree_get_value (sections, (unsigned char *) section)) + == (struct NED_BOOKMARK_SECTION *) 0) + { + if ((sec_bmk= (struct NED_BOOKMARK_SECTION *) + calloc (sizeof (struct NED_BOOKMARK_SECTION), 1)) + != (struct NED_BOOKMARK_SECTION *) 0) + sec_bmk->bmk_append= &sec_bmk->bmk_list; + } + + if (sec_bmk != (struct NED_BOOKMARK_SECTION *) 0) + { + *(sec_bmk->bmk_append)= bmk; + sec_bmk->bmk_append= &bmk->bmk_next_in_section; + } + } + + if (symbolic_name != (char *) 0 && *symbolic_name) + ytree_set_value (&sym_bmk, (unsigned char *) symbolic_name, (long) bmk); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_load_bookmarks (char *filename, char *section) +{ + FILE *fi; + char *bu; + int rc; +#define bu_siz 1024 +#define N_FIELDS 3 + char *fields [N_FIELDS]; + + if (filename == (char *) 0 + || *filename == (char) 0 + || (fi= fopen (filename, "rb")) == (FILE *) 0 + || (bu= malloc (bu_siz)) == (char *) 0 + ) + return -1; + + for (;;) + { + rc= fread_line (fi, bu, bu_siz); + if (rc < 0 && feof (fi)) break; + + /* T2D: format should be defined */ + rc= split_string (bu, ':', fields, N_FIELDS); + ned_register_bookmark (fields [0], fields [1], section, fields [2]); + } + fclose (fi); + free (bu); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_save_bookmarks (char *filename, char *section) +{ + fprintf (stderr, "0873: T2D saving bookmarks not yet implemented!\n"); + fprintf (stderr, " bookmarks for %s not saved to %s\n", section, filename); + return -1; +} + +/* ------------------------------------------------------------------------ */ +int ned_symbolic_bookmark (char *name, int option) +{ + struct NED_BOOKMARK *bmk; + + if (name != (char *) 0 && *name + && (bmk= (struct NED_BOOKMARK *) + ytree_get_value (sym_bmk, (unsigned char *) name)) + && ned_eval_string (bmk->bmk_tag_string, option) == 0 + ) + return 0; + + return -1; +} diff --git a/app/ned/08/ned0875.c b/app/ned/08/ned0875.c new file mode 100644 index 0000000000000000000000000000000000000000..84d19000fae5840d3940b620d7634bf8d513d1f8 --- /dev/null +++ b/app/ned/08/ned0875.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/08/ned0875.c + * + * written: 1991 10 12 + * latest update: 1999-12-20 21:48:57 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern char *default_start_frame; + +/* ------------------------------------------------------------------------ */ +void p_activate_fr_root () +{ + ned_activate_special ((char *) 0, default_start_frame, -1); +} diff --git a/app/ned/08/ned0876.c b/app/ned/08/ned0876.c new file mode 100644 index 0000000000000000000000000000000000000000..a12a0e27d5b97364b6bb265ef2c41f6b9a7fcce1 --- /dev/null +++ b/app/ned/08/ned0876.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/08/ned0876.c + * + * written: 1991 10 12 + * latest update: 1998-08-15 11:35:45 + * $Id: ned0876.c,v 1.2 2002/06/15 04:35:21 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_activate_fr_notes () +{ + ned_activate_special ((char *) 0, "$$notes", -1); +} diff --git a/app/ned/08/ned0877.c b/app/ned/08/ned0877.c new file mode 100644 index 0000000000000000000000000000000000000000..c22257f74afc35c5e63cdbebab282f38aeb2e0bb --- /dev/null +++ b/app/ned/08/ned0877.c @@ -0,0 +1,21 @@ +/* + * FILE %ned/08/ned0877.c + * + * written: 1991 10 12 + * latest update: 1998-08-15 11:35:50 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_activate_fr_help () +{ + ned_activate_special ((char *) 0, "$$help", -1); +} diff --git a/app/ned/08/ned0878.c b/app/ned/08/ned0878.c new file mode 100644 index 0000000000000000000000000000000000000000..a289ae88976d6d9a72f990b2a3c2633702fb9073 --- /dev/null +++ b/app/ned/08/ned0878.c @@ -0,0 +1,36 @@ +/* + * FILE %ned/08/ned0878.c + * + * written: 1991 10 12 + * latest update: 1995-11-28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +#define STR_SIZE 256 +static char str_cluster [STR_SIZE]; +static char str_frame [STR_SIZE]; +static int datinit= 0; + +/* ------------------------------------------------------------------------ */ +void ned_p_activate_cl_fr () +{ + if (!datinit) + { + str_cluster [0]= 0; + str_frame [0]= 0; + } + + if (rd_str ("cluster: ", str_cluster, STR_SIZE) == -1 + || rd_str ("frame: ", str_frame, STR_SIZE) == -1 + ) return; + + ned_activate_special (str_cluster, str_frame, 1); +} diff --git a/app/ned/08/ned0879.c b/app/ned/08/ned0879.c new file mode 100644 index 0000000000000000000000000000000000000000..1834f1feafdc880108c52c479384f532cf804d5f --- /dev/null +++ b/app/ned/08/ned0879.c @@ -0,0 +1,21 @@ +/* + * FILE %ned/08/ned0879.c + * + * written: 1991 10 23 + * latest update: 1997-02-23 10:35:54 + * $Id: ned0879.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_cross_ref () +{ + ned_cross_ref ((char *) 0, 0, CRF_IN_CRF, CRF_GLOBAL_AND_LOCAL, 1); +} diff --git a/app/ned/08/ned0879i.c b/app/ned/08/ned0879i.c new file mode 100644 index 0000000000000000000000000000000000000000..5748590eacd5bead9679ac334fef454a3588c06a --- /dev/null +++ b/app/ned/08/ned0879i.c @@ -0,0 +1,22 @@ +/* + * FILE %ned/08/ned0879i.c + * + * written: 1996-12-03 + * latest update: 1996-12-03 17:19:57 + * $Id: ned0879i.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_lookup_lib () +{ + set_repeat_command (ned_lookup_lib); + ned_cross_ref ((char *) 0, 0, CRF_IN_LIB, CRF_GLOBAL, 0); +} diff --git a/app/ned/08/ned0879l.c b/app/ned/08/ned0879l.c new file mode 100644 index 0000000000000000000000000000000000000000..a20ab704555e653b272a314116d5789234f63f01 --- /dev/null +++ b/app/ned/08/ned0879l.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/08/ned0879l.c + * + * written: 1996-12-03 + * latest update: 1996-12-03 17:19:57 + * $Id: ned0879l.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_lookup_lexicon () +{ + set_repeat_command (ned_lookup_lexicon); + ned_cross_ref ((char *) 0, 0, CRF_IN_LEX, CRF_GLOBAL, 1); +} diff --git a/app/ned/08/ned0879t.c b/app/ned/08/ned0879t.c new file mode 100644 index 0000000000000000000000000000000000000000..2320484ec8cf57abc6ed678c67294b4849b0f95a --- /dev/null +++ b/app/ned/08/ned0879t.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/08/ned0879t.c + * + * written: 1996-12-03 + * latest update: 1996-12-03 17:19:57 + * $Id: ned0879t.c,v 1.2 2005/04/01 16:46:20 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_lookup_thesaurus () +{ + set_repeat_command (ned_lookup_thesaurus); + ned_cross_ref ((char *) 0, 0, CRF_IN_THES, CRF_GLOBAL, 1); +} diff --git a/app/ned/08/ned0880.c b/app/ned/08/ned0880.c new file mode 100644 index 0000000000000000000000000000000000000000..1795107ba850aea9653904c77e1559d509aabbf6 --- /dev/null +++ b/app/ned/08/ned0880.c @@ -0,0 +1,108 @@ +/* + * FILE %ned/08/ned0880.c + * + * written: 1991 10 24 + * latest update: 1998-08-16 12:47:35 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "edhyx.h" +#include "edctx.h" +#include "proto.h" + +extern struct NED_CONTEXT *ned_main_context; + +extern struct WINDOWCTRL *aw; +extern int default_cross_ref_fmt; +extern int default_cross_ref_local; +extern char *default_cross_ref_template; + +#define CMP_SIZE 36 +static char cmp_buffer [CMP_SIZE+1]; +static int cmp_cnt= -1; + +/* ------------------------------------------------------------------------ */ +void ned_activate_cross_ref ( +char *str, +int flg_resize, /* 1 -> resize windows */ +int cluster_type, /* which clusters to search through */ +int local_or_global) /* include current cluster in search */ +{ + struct FRAMECTRL *fr= (struct FRAMECTRL *) 0; + struct CLUSTERCTRL *cl; + struct WINDOWCTRL *xaw; + struct ARRAY_ELEMENT *e_crf; + struct ARRAY_CONTROL *a_crf; + void *ptr; + int flags= 0x00; + int where; + char *crf; + + xaw= aw; + + ned_message_3 ("crf \'", str, "\'"); + + if ((local_or_global & CRF_LOCAL) + && aw->file_type == FTY_HYPER + && (ptr= aw->file_or_frame) != (void *) 0 + && (cl= ((struct FRAMECTRL *) ptr)->cluster) != (struct CLUSTERCTRL *) 0 + ) + { + if ((fr= ned_activate_frame (cl, str, (struct WINDOWCTRL *) 0, + (default_cross_ref_local) ? 0x02 : 0x00, + default_cross_ref_fmt, + default_cross_ref_template, (char *) 0)) + != (struct FRAMECTRL *) 0) + goto RESIZE; + } + + if (cmp_cnt >= 0 && strcmp (cmp_buffer, str) == 0) + { + cmp_cnt++; + } + else + { + strcpy_max (cmp_buffer, str, CMP_SIZE); + cmp_cnt= 0; + } + + if (cmp_cnt == 3) flags |= 0x02; + + for (where= 1; where < 0x4000; where= where << 1) + { + if (!(where & cluster_type)) continue; + a_crf= (struct ARRAY_CONTROL *) 0; + + if (where & CRF_IN_CRF) a_crf= ned_main_context->NED_CTX_crf; else + if (where & CRF_IN_LIB) a_crf= ned_main_context->NED_CTX_lib; else + if (where & CRF_IN_LEX) a_crf= ned_main_context->NED_CTX_lex; else + if (where & CRF_IN_THES) a_crf= ned_main_context->NED_CTX_thes; + + for (e_crf= array_top (a_crf); + e_crf != (struct ARRAY_ELEMENT *) 0; + e_crf= e_crf->next) + { /* activate the appropriate frame in the first possible crf cluster */ + if ((crf= (char *) e_crf->payload) != (char *) 0 + && (cl= ned_activate_cluster (crf)) != (struct CLUSTERCTRL *) 0 + && (fr= ned_activate_frame (cl, str, (struct WINDOWCTRL *) 0, + flags, + default_cross_ref_fmt, + default_cross_ref_template, (char *) 0)) + != (struct FRAMECTRL *) 0 + ) goto RESIZE; + } + } + +RESIZE: + if (fr != (struct FRAMECTRL *) 0 && flg_resize) q_wdwsize ('s'); + + q2_jmpwdw (xaw); + q0_jmpwdw (xaw); +} diff --git a/app/ned/08/ned0881.c b/app/ned/08/ned0881.c new file mode 100644 index 0000000000000000000000000000000000000000..1674c12efe7550315922350da5f51702adfd0716 --- /dev/null +++ b/app/ned/08/ned0881.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/08/ned0881.c + * + * *** NOT USED *** + * + * written: 1991 10 24 + * latest update: 1996-12-03 16:20:58 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_2cross_ref (char *str, int MAX_STR) +{ + str[0]= '$'; + str[1]= 0; + + if (rd_str ("search word: ", &str[1], MAX_STR-1) == -1) return; + ned_activate_cross_ref (str, 1, CRF_IN_CRF, CRF_GLOBAL_AND_LOCAL); +} diff --git a/app/ned/08/ned0882.c b/app/ned/08/ned0882.c new file mode 100644 index 0000000000000000000000000000000000000000..45de4740ba9572b12182950a323a996817cc6ade --- /dev/null +++ b/app/ned/08/ned0882.c @@ -0,0 +1,128 @@ +/* + * FILE %ned/08/ned0882.c + * + * select a name for the cross reference + * + * written: 1991 10 23 + * latest update: 1999-04-25 16:33:57 + * $Id: ned0882.c,v 1.3 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" + +#define MAX_STR 128 + +extern char *default_cross_ref_prefix; +extern int default_cross_ref_to_lower; +extern char *default_help_cluster; +extern char *default_help_cross_ref; + +/* ------------------------------------------------------------------------ */ +struct CB_DATA +{ + int ty; + int loc; + int lower; +} ; + +/* ------------------------------------------------------------------------ */ +int ned_cb_cross_ref ( +char *edited_string, +int size, +int malloced, +void *callback_data) +{ + int ty= CRF_IN_CRF; + int loc= CRF_GLOBAL_AND_LOCAL; + int lower= 1; + struct CB_DATA *cb; +#ifdef MSDOS + size; malloced; callback_data; +#endif + + if ((cb= (struct CB_DATA *) callback_data) != (struct CB_DATA *) 0) + { + ty= cb->ty; + loc= cb->loc; + lower= cb->lower; + free (cb); + } + + if (lower && default_cross_ref_to_lower) to_lower (edited_string); + ned_activate_cross_ref (edited_string, 1, ty, loc); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_cross_ref ( +const char *target, +int prompt, /* -1 .. never prompt */ + /* 0 .. dont prompt unless its necessary */ + /* 1 .. prompt in any case */ +int ty, +int loc, +int lower) +{ + char str [MAX_STR]; + int lng= 0; + int rv; + + if (ty == 0) ty= CRF_IN_CRF; + if (loc == 0) loc= CRF_GLOBAL_AND_LOCAL; + + if (default_cross_ref_prefix != (char *) 0 + && *default_cross_ref_prefix != 0 + && ty == CRF_IN_CRF + ) + { + strcpy_max (str, default_cross_ref_prefix, MAX_STR); + lng= strlen (default_cross_ref_prefix); + } + else str [0]= 0; + + if (target != (char *) 0) + { + if (*target == 0) { if (prompt == 0) prompt= 1; } + else strcpy_max (str+lng, target, MAX_STR-lng); + } + else + { + if ((rv= q_isolate_word (str+lng, MAX_STR-lng, CHARSET_token, 1)) == 0 + && prompt == 0 + ) + prompt= 1; + } + + if (prompt == 1) + { + struct CB_DATA *cb; + + if ((cb= (struct CB_DATA *) calloc (sizeof (struct CB_DATA), 1)) + != (struct CB_DATA *) 0) + { + cb->lower= lower; + cb->ty= ty; + cb->loc= loc; + } + + ned_prompt_string ("lookup: ", str, MAX_STR, + default_help_cluster, default_help_cross_ref, + ned_cb_cross_ref, (void *) cb); + return 0; + } + + if (lower && default_cross_ref_to_lower) to_lower (str); + ned_activate_cross_ref (str, 1, ty, loc); + + return 0; +} diff --git a/app/ned/08/ned0884.c b/app/ned/08/ned0884.c new file mode 100644 index 0000000000000000000000000000000000000000..3e779922a7764489c08a2c987d4c7bbd3a1602ed --- /dev/null +++ b/app/ned/08/ned0884.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/08/ned0884.c + * + * written: 1994-04-10 + * latest update: 1998-08-15 12:43:13 + * $Id: ned0884.c,v 1.2 2005/07/08 17:00:42 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_set_mark () +{ + ned_wc_feature_create (aw, Ftype_mark, FTR_EDIT_ATTRIBUTE, "name="); + /* p_link_feature (); */ +} diff --git a/app/ned/08/ned0885.c b/app/ned/08/ned0885.c new file mode 100644 index 0000000000000000000000000000000000000000..b9a3214352457ea552cca50e4dc3f96571ee3836 --- /dev/null +++ b/app/ned/08/ned0885.c @@ -0,0 +1,25 @@ +/* + * FILE %ned/08/ned0885.c + * + * written: 1994-04-10 + * latest update: 1998-08-15 12:36:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_set_lookup_tag () +{ + ned_wc_feature_create (aw, Ftype_lookup, FTR_EDIT_NONE, (char *) 0); + /* p_link_feature (); */ +} diff --git a/app/ned/08/ned0885b.c b/app/ned/08/ned0885b.c new file mode 100644 index 0000000000000000000000000000000000000000..d04f2bfa05bc085a80862ef4440a6ab023a07977 --- /dev/null +++ b/app/ned/08/ned0885b.c @@ -0,0 +1,31 @@ +/* + * FILE %ned/08/ned0885b.c + * + * written: 1996-07-01 + * latest update: 1998-08-15 12:37:04 + * $Id: ned0885b.c,v 1.2 2002/06/15 04:35:21 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_set_lookup_tag_fr () +{ + ned_wc_feature_create (aw, Ftype_lookup_fr, FTR_EDIT_ATTRIBUTE, "fr="); +} + +/* ------------------------------------------------------------------------ */ +void ned_set_lookup_tag_fr2 () +{ + ned_wc_feature_create (aw, Ftype_lookup_fr2, FTR_EDIT_ATTRIBUTE, "fr="); +} diff --git a/app/ned/08/ned0886.c b/app/ned/08/ned0886.c new file mode 100644 index 0000000000000000000000000000000000000000..81cd00cb06857fe1d6ce78f8becd0addcdf235d5 --- /dev/null +++ b/app/ned/08/ned0886.c @@ -0,0 +1,82 @@ +/* + * FILE %ned/08/ned0886.c + * + * written: 1996-03-07 + * latest update: 2001-02-11 11:13:09 + * $Id: ned0886.c,v 1.4 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <stdlib.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +#define MAX_BUFFER1 160 + +/* ------------------------------------------------------------------------ */ +struct FEATURE *ned_feature_set ( +struct WINDOWCTRL *w, +struct LINE *lp, +int offset, +int what, +int ftr_segment_cnt, +const char *ftr_segment []) +{ + struct FEATURE *fp; + struct LINE *lp_ftr; + char *buffer1a; + char *buffer1b; + int repl_size; + + if ((fp= q_feature_set (lp, offset, what, ftr_segment_cnt, ftr_segment)) + == (struct FEATURE *) 0 + || (lp_ftr= fp->ftr_text_line) == (struct LINE *) 0 + || (buffer1a= malloc (MAX_BUFFER1)) == (char *) 0 + ) return (struct FEATURE *) 0; + + if (ned_line_2_string (lp_ftr, 0, lp_ftr, lp_ftr->lng, buffer1a, MAX_BUFFER1, + 0L, 0x0000) != (char *) 0 + && (buffer1b= malloc (MAX_BUFFER1)) != (char *) 0 + ) + { + ned_message_1 (buffer1a); + ned_identify_feature (w, lp, offset, what, fp, + buffer1a, buffer1b, &repl_size, MAX_BUFFER1); + + free (buffer1b); + } + + free (buffer1a); + + w->f_upd= 1; + + return fp; +} + +/* ------------------------------------------------------------------------ */ +struct FEATURE *ned_feature_set2 ( +struct WINDOWCTRL *w, +int line, +int offset, +int what, +int ftr_segment_cnt, +const char *ftr_segment []) +{ + struct FEATURE *f; + struct LINE *l; + int l_jmp; + + if (w == (struct WINDOWCTRL *) 0 + || (l_jmp= line) <= 0 + || (l= ned_get_line_by_nr (w->WC_act, &l_jmp)) == (struct LINE *) 0 + || l_jmp != line + ) + return (struct FEATURE *) 0; + + return ned_feature_set (w, l, offset, what, ftr_segment_cnt, ftr_segment); +} diff --git a/app/ned/08/ned0887.c b/app/ned/08/ned0887.c new file mode 100644 index 0000000000000000000000000000000000000000..f34b5d36a958dc7c611cdd8dcf8036abd15549c1 --- /dev/null +++ b/app/ned/08/ned0887.c @@ -0,0 +1,61 @@ +/* + * FILE %ned/08/ned0887.c + * + * Shift feature records up and down by one line + * + * This is useful to repair feature files when the text file was + * edited with another editor. + * T2D, NOTE: + * 1. These functions leak memory! Unused feature lines + * are simply dropped and not discarded! + * 2. The update flag is not set! + * + * written: 2001-04-01 + * latest update: 2001-04-01 23:14:51 + * $Id: ned0887.c,v 1.1 2001/04/01 22:45:37 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_ftr_shift_up () +{ + struct LINE *lp1, *lp2; + struct FEATURE *fp1; + + for (lp1= aw->WC_act; lp1 != (struct LINE *) 0; lp1= lp2) + { + lp2= lp1->next; + fp1= (lp2 == (struct LINE *) 0) ? (struct FEATURE *) 0: lp2->ftr; + lp1->ftr= fp1; + } + + p_refresh (); +} + +/* ------------------------------------------------------------------------ */ +void ned_ftr_shift_down () +{ + struct LINE *lp_start, *lp1, *lp2; + struct FEATURE *fp1; + + lp_start= aw->WC_act; + for (lp1= ned_find_last_line (lp_start); + lp1 != (struct LINE *) 0 && lp1 != lp_start ; lp1= lp2) + { + lp2= lp1->prev; + fp1= (lp2 == (struct LINE *) 0 || lp2 == lp_start) + ? (struct FEATURE *) 0: lp2->ftr; + lp1->ftr= fp1; + } + + p_refresh (); +} diff --git a/app/ned/09/(dirinf).fm b/app/ned/09/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..02b66c14e6e37c48dd5333273d8b9bdb9c9418f7 --- /dev/null +++ b/app/ned/09/(dirinf).fm @@ -0,0 +1,81 @@ +# +# FILE %ned/09/(dirinf).fm +# +# written: 1987-09-10 +# latest update: 1997-12-05 2:52:02 +# +# ---------------------------------------------------------------------------- + +Makefile | current makefile +make-ux | Unix makefile +make-dos | MSDOS makefile + +ned0901.c | void def_setupfnm (s) +ned0902.c | void p_edsetup () +ned0903.c | int stp_whatcmd (s) +# +ned0905.c | int stp_whatprim (s) +ned0906.c | void stp_rtbl (fi, tn, f) +ned0907.c | void stp_func (fi, tn, f) +ned0908.c | void stp_macro (fi) +ned0909.c | void stp_window (fi) +ned0910.c | int stp_maus (fi) +ned0911.c | int trans_str (si, so) /* Return: Anzahl der Bytes im ZIEL */ +ned0911.c | int QQtrans_str (si, so) /* Return: Anzahl der Bytes im ZIEL */ +ned0912.c | int p_rdsetup () +ned0913.c | int kbin_jou () +ned0914.c | int jou_in () +ned0915.c | int p_open_jou_rd () /* Open Jour File for Read (Recover) */ +ned0916.c | void p_open_jou_wr () /* Open Jour File for Write (Backup) */ +ned0917.c | void p_close_jou () +ned0918.c | int mac_expand () +ned0919.c | void p_macro (num) +ned0921.c | p_macro00 () { p_macro ( 0); } +ned0922.c | int mac_call_tcl (char *rc_name) +ned0923.c | int ned_tcl_register (Tcl_Interp *interp) +ned0924.c | int ned_tcl_execute_primitive (ClientData client_data, ...) +ned0925.c | int _ned_tk_create_widget (ClientData clientData, ...) +ned0926.c | int ned_tk_create_widget (ClientData clientData, ...) +ned0927.c | int ned_tk_configure (Tcl_Interp *interp, NED_Widget *nw, ...) +ned0928.c | int _ned_tk_destroy_widget (NED_Widget *nw) +ned0929.c | int ned_tk_widget_cmd (ClientData clientData, Tcl_Interp *interp, ...) +ned0929s.c | int ned_tk_show_display_range (struct WINDOWCTRL *w) +ned0930.c | int ned_tk_widget_delete (ClientData clientData) +ned0931.c | void ned_tk_event_procedure (ClientData clientData, XEvent *eventPtr) +ned0932.c | int ned_tk_set_color (Tcl_Interp *interp, ...) +ned0933.c | int ned_tk_redraw_window (NED_Widget *nw) +ned0934.c | int ned_tk_exp_selection_procedure (...) +ned0935.c | int ned_tk_imp_selection_procedure (...) +ned0936.c | int ned_tcl_edit_file (__TCL_command_pars__); +ned0937.c | int ned_tcl_edit_frame (__TCL_command_pars__); +ned0937b.c | int ned_tcl_edit_crf (__TCL_command_pars__); +ned0938.c | int ned_tcl_preset (Tcl_Interp *interp) +ned0939.c | int ned_tcl_main (__TCL_command_pars__); +ned0940.c | int ned_tcl_set_markup (__TCL_command_pars__); +ned0941.c | int ned_tcl_paste_str (__TCL_command_pars__); +ned0942.c | int ned_tcl_submit_macro (__TCL_command_pars__); +ned0943.c | int ned_tcl_enter_entity (__TCL_command_pars__); +ned0944.c | int ned_tcl_jump_to_line (__TCL_command_pars__); +ned0945.c | int ned_tcl_eval_tag (__TCL_command_pars__); +ned0946.c | int ned_tcl_set_marker (__TCL_command_pars__); +ned0946b.c | int ned_tcl_activate_note (__TCL_command_pars__); +ned0947.c | int ned_tcl_jmp_marker (__TCL_command_pars__); +ned0948.c | int ned_tcl_mac_define (__TCL_command_pars__); +ned0949.c | int ned_tcl_define_feature (__TCL_command_pars__); +ned0950.c | int ned_tcl_reg_tag_rule (__TCL_command_pars__); +ned0951a.c | int ned_tcl_def_abbrev (__TCL_command_pars__); +ned0951b.c | int ned_tcl_undef_abbrev (__TCL_command_pars__); + +ned0952a.c | *** DOES NOT EXIST *** int ned_tcl_extract (__TCL_command_pars__); + +ned0972.c | void p_mac_define () +ned0973.c | void mac_clr () +ned0974.c | void mac_undef (num) +ned0975.c | void mac_define (num, str, lng) +ned0976.c | int submit_macro (char *s) +ned0977.c | int mac_parse (char *tokens) +ned0978.c | int mac_definition (char *tok_num, char *tok_text) +ned0979.c | generalized macro bindings +ned0980.c | void p_dump_macro () +ned0981.c | int stp_attr (FILE *fi, char *b, int max_b) +* | diff --git a/app/ned/09/Makefile b/app/ned/09/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..ec4f92483f9ada72674b61f546448afe9bece564 --- /dev/null +++ b/app/ned/09/Makefile @@ -0,0 +1,241 @@ +# +# FILE %ned/09/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# +# latest update: 2000-08-24 14:48:59 +# $Id: Makefile,v 1.9 2012/08/10 14:44:20 gonter Exp $ +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +PFX= /usr/local/include/ +# TCL_VER=8.0 +# TCL_VER=8.3 +# TCL_VER=8.4 +# OPTS2=-I/usr/X11R6/include -I$(PFX)tcl$(TCL_VER) -I${PFX}tk$(TCL_VER) +OPTS2=-I/usr/X11R6/include -I/usr/include/tcl8.4 +OPTS=-c -g -I.. $(OPTS2) $(cf) +CC=cc +ccc=$(CC) $(OPTS) + +# configuration +objects= $(o_1) $(o_mac) $(o_tcl) # $(o_tk) +# change if needed ^^^^^^^^^^^^^^^^^^ + +o_tcl=ned0923.o ned0924.o ned0936.o ned0937.o ned0937b.o \ + ned0938.o ned0940.o ned0941.o ned0942.o ned0943.o \ + ned0944.o ned0945.o ned0946.o ned0946b.o \ + ned0947.o ned0948.o ned0949.o \ + ned0950.o ned0951a.o ned0951b.o +o_tk= ned0925.o ned0926.o ned0927.o ned0928.o ned0929.o ned0929s.o \ + ned0930.o ned0931.o ned0932.o ned0933.o ned0934.o ned0935.o + +o_1= ned0901.o ned0902.o ned0903.o ned0908.o \ + ned0911.o ned0912.o ned0913.o ned0914.o ned0915.o \ + ned0916.o ned0917.o ned0918.o ned0919.o \ + ned0972.o ned0973.o ned0974.o \ + ned0975.o ned0976.o ned0977.o ned0978.o ned0979.o \ + ned0980.o ned0981.o + +o_mac=ned09m00.o ned09m01.o ned09m02.o ned09m03.o \ + ned09m04.o ned09m05.o ned09m06.o ned09m07.o \ + ned09m08.o ned09m09.o ned09m10.o ned09m11.o \ + ned09m12.o ned09m13.o ned09m14.o ned09m15.o \ + ned09m16.o ned09m17.o ned09m18.o ned09m19.o \ + ned09m20.o ned09m21.o ned09m22.o ned09m23.o \ + ned09m24.o ned09m25.o ned09m26.o ned09m27.o \ + ned09m28.o ned09m29.o ned09m30.o ned09m31.o \ + ned09m32.o ned09m33.o ned09m34.o ned09m35.o \ + ned09m36.o ned09m37.o ned09m38.o ned09m39.o \ + ned09m40.o ned09m41.o ned09m42.o ned09m43.o \ + ned09m44.o ned09m45.o ned09m46.o ned09m47.o \ + ned09m48.o ned09m49.o ned09m50.o + +objs_cur= ned0922_cur.o ned0939_cur.o +objs_tk= ned0922_tk.o ned0939_tk.o +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_cur lib_tk + +clean : + rm -f *.o lib_cur lib_tk + +lib_tk : $(objs_tk) $(o_tk) $(o_1) $(o_mac) $(o_tcl) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(o_1) $(o_mac) $(o_tcl) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h + $(CC) $(OPTS) -c $*.c + +# ---------------------------------------------------------------------------- +# macros +ned09m00.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro00 -DMACRO_NUM=0 ned0921.c + +ned09m01.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro01 -DMACRO_NUM=1 ned0921.c + +ned09m02.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro02 -DMACRO_NUM=2 ned0921.c + +ned09m03.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro03 -DMACRO_NUM=3 ned0921.c + +ned09m04.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro04 -DMACRO_NUM=4 ned0921.c + +ned09m05.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro05 -DMACRO_NUM=5 ned0921.c + +ned09m06.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro06 -DMACRO_NUM=6 ned0921.c + +ned09m07.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro07 -DMACRO_NUM=7 ned0921.c + +ned09m08.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro08 -DMACRO_NUM=8 ned0921.c + +ned09m09.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro09 -DMACRO_NUM=9 ned0921.c + +ned09m10.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro10 -DMACRO_NUM=10 ned0921.c + +ned09m11.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro11 -DMACRO_NUM=11 ned0921.c + +ned09m12.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro12 -DMACRO_NUM=12 ned0921.c + +ned09m13.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro13 -DMACRO_NUM=13 ned0921.c + +ned09m14.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro14 -DMACRO_NUM=14 ned0921.c + +ned09m15.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro15 -DMACRO_NUM=15 ned0921.c + +ned09m16.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro16 -DMACRO_NUM=16 ned0921.c + +ned09m17.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro17 -DMACRO_NUM=17 ned0921.c + +ned09m18.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro18 -DMACRO_NUM=18 ned0921.c + +ned09m19.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro19 -DMACRO_NUM=19 ned0921.c + +ned09m20.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro20 -DMACRO_NUM=20 ned0921.c + +ned09m21.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro21 -DMACRO_NUM=21 ned0921.c + +ned09m22.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro22 -DMACRO_NUM=22 ned0921.c + +ned09m23.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro23 -DMACRO_NUM=23 ned0921.c + +ned09m24.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro24 -DMACRO_NUM=24 ned0921.c + +ned09m25.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro25 -DMACRO_NUM=25 ned0921.c + +ned09m26.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro26 -DMACRO_NUM=26 ned0921.c + +ned09m27.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro27 -DMACRO_NUM=27 ned0921.c + +ned09m28.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro28 -DMACRO_NUM=28 ned0921.c + +ned09m29.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro29 -DMACRO_NUM=29 ned0921.c + +ned09m30.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro30 -DMACRO_NUM=30 ned0921.c + +ned09m31.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro31 -DMACRO_NUM=31 ned0921.c + +ned09m32.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro32 -DMACRO_NUM=32 ned0921.c + +ned09m33.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro33 -DMACRO_NUM=33 ned0921.c + +ned09m34.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro34 -DMACRO_NUM=34 ned0921.c + +ned09m35.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro35 -DMACRO_NUM=35 ned0921.c + +ned09m36.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro36 -DMACRO_NUM=36 ned0921.c + +ned09m37.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro37 -DMACRO_NUM=37 ned0921.c + +ned09m38.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro38 -DMACRO_NUM=38 ned0921.c + +ned09m39.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro39 -DMACRO_NUM=39 ned0921.c + +ned09m40.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro40 -DMACRO_NUM=40 ned0921.c + +ned09m41.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro41 -DMACRO_NUM=41 ned0921.c + +ned09m42.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro42 -DMACRO_NUM=42 ned0921.c + +ned09m43.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro43 -DMACRO_NUM=43 ned0921.c + +ned09m44.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro44 -DMACRO_NUM=44 ned0921.c + +ned09m45.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro45 -DMACRO_NUM=45 ned0921.c + +ned09m46.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro46 -DMACRO_NUM=46 ned0921.c + +ned09m47.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro47 -DMACRO_NUM=47 ned0921.c + +ned09m48.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro48 -DMACRO_NUM=48 ned0921.c + +ned09m49.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro49 -DMACRO_NUM=49 ned0921.c + +ned09m50.o : ned0921.c + $(ccc) -o $@ -DMACRO_PRIM=p_macro50 -DMACRO_NUM=50 ned0921.c +# --- cur Modules ---------- +ned0922_cur.o : ../ed.h ned0922.c + $(CC) $(OPTS) -o ned0922_cur.o ned0922.c + +ned0939_cur.o : ../ed.h ned0939.c + $(CC) $(OPTS) -o ned0939_cur.o ned0939.c + +# --- tk Modules ---------- +ned0922_tk.o : ../ed.h ned0922.c + $(CC) $(OPTS) -DUSE_TK -o ned0922_tk.o ned0922.c + +ned0939_tk.o : ../ed.h ned0939.c + $(CC) $(OPTS) -DUSE_TK -o ned0939_tk.o ned0939.c diff --git a/app/ned/09/contrib b/app/ned/09/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/09/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/09/gg b/app/ned/09/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/09/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/09/lib_cur b/app/ned/09/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/09/lib_tk b/app/ned/09/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/09/make-dos b/app/ned/09/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..a2fe9ee5f901b9e473e1b2b22ca67e824436b028 --- /dev/null +++ b/app/ned/09/make-dos @@ -0,0 +1,259 @@ +# +# FILE %ned/09/makefile +# +# GG's Night(mare) Editor System +# +# written: 1990-01-01 +# latest update: 1996-12-04 18:24:05 +# +# ============================================================================ +cc=cl -Os -AL /c +ccc=cl -Os -AL /Fo$@ /W3 -I.. /c +obj=objdec -m0 -w -d -sl 2 NED09_TEXT $@ + +lib : lib.1 lib.mac + +lib.1 : ! + ned0901.obj ned0902.obj ned0903.obj ! + ned0908.obj ned0911.obj ned0912.obj ! + ned0913.obj ned0914.obj ned0915.obj ned0916.obj ! + ned0917.obj ned0918.obj ned0919.obj ned0922.obj ! + ned0923.obj ned0924.obj ned0936.obj ned0937.obj ! + ned0937b.obj ned0938.obj ned0939.obj ned0940.obj ! + ned0941.obj ned0942.obj ned0943.obj ned0944.obj ned0945.obj ! + ned0946.obj ned0947.obj ned0948.obj ned0949.obj ned0950.obj ! + ned0972.obj ! + ned0973.obj ned0974.obj ned0975.obj ned0976.obj ! + ned0977.obj ned0978.obj ned0979.obj ned0980.obj ! + ned0981.obj + +lib.mac : ! + ned09m00.obj ned09m01.obj ned09m02.obj ned09m03.obj ! + ned09m04.obj ned09m05.obj ned09m06.obj ned09m07.obj ! + ned09m08.obj ned09m09.obj ned09m10.obj ned09m11.obj ! + ned09m12.obj ned09m13.obj ned09m14.obj ned09m15.obj ! + ned09m16.obj ned09m17.obj ned09m18.obj ned09m19.obj ! + ned09m20.obj ned09m21.obj ned09m22.obj ned09m23.obj ! + ned09m24.obj ned09m25.obj ned09m26.obj ned09m27.obj ! + ned09m28.obj ned09m29.obj ned09m30.obj ned09m31.obj ! + ned09m32.obj ned09m33.obj ned09m34.obj ned09m35.obj ! + ned09m36.obj ned09m37.obj ned09m38.obj ned09m39.obj ! + ned09m40.obj ned09m41.obj ned09m42.obj ned09m43.obj ! + ned09m44.obj ned09m45.obj ned09m46.obj ned09m47.obj ! + ned09m48.obj ned09m49.obj ned09m50.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $*.c + $(obj) + +# ---------------------------------------------------------------------------- +ned0924.obj : ned0924.c + $(cc) /Fo$@ /W2 -I.. ned0924.c + $(obj) + +# Macros +ned09m00.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro00 -DMACRO_NUM=0 ned0921.c + $(obj) + +ned09m01.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro01 -DMACRO_NUM=1 ned0921.c + $(obj) + +ned09m02.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro02 -DMACRO_NUM=2 ned0921.c + $(obj) + +ned09m03.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro03 -DMACRO_NUM=3 ned0921.c + $(obj) + +ned09m04.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro04 -DMACRO_NUM=4 ned0921.c + $(obj) + +ned09m05.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro05 -DMACRO_NUM=5 ned0921.c + $(obj) + +ned09m06.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro06 -DMACRO_NUM=6 ned0921.c + $(obj) + +ned09m07.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro07 -DMACRO_NUM=7 ned0921.c + $(obj) + +ned09m08.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro08 -DMACRO_NUM=8 ned0921.c + $(obj) + +ned09m09.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro09 -DMACRO_NUM=9 ned0921.c + $(obj) + +ned09m10.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro10 -DMACRO_NUM=10 ned0921.c + $(obj) + +ned09m11.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro11 -DMACRO_NUM=11 ned0921.c + $(obj) + +ned09m12.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro12 -DMACRO_NUM=12 ned0921.c + $(obj) + +ned09m13.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro13 -DMACRO_NUM=13 ned0921.c + $(obj) + +ned09m14.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro14 -DMACRO_NUM=14 ned0921.c + $(obj) + +ned09m15.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro15 -DMACRO_NUM=15 ned0921.c + $(obj) + +ned09m16.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro16 -DMACRO_NUM=16 ned0921.c + $(obj) + +ned09m17.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro17 -DMACRO_NUM=17 ned0921.c + $(obj) + +ned09m18.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro18 -DMACRO_NUM=18 ned0921.c + $(obj) + +ned09m19.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro19 -DMACRO_NUM=19 ned0921.c + $(obj) + +ned09m20.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro20 -DMACRO_NUM=20 ned0921.c + $(obj) + +ned09m21.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro21 -DMACRO_NUM=21 ned0921.c + $(obj) + +ned09m22.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro22 -DMACRO_NUM=22 ned0921.c + $(obj) + +ned09m23.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro23 -DMACRO_NUM=23 ned0921.c + $(obj) + +ned09m24.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro24 -DMACRO_NUM=24 ned0921.c + $(obj) + +ned09m25.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro25 -DMACRO_NUM=25 ned0921.c + $(obj) + +ned09m26.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro26 -DMACRO_NUM=26 ned0921.c + $(obj) + +ned09m27.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro27 -DMACRO_NUM=27 ned0921.c + $(obj) + +ned09m28.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro28 -DMACRO_NUM=28 ned0921.c + $(obj) + +ned09m29.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro29 -DMACRO_NUM=29 ned0921.c + $(obj) + +ned09m30.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro30 -DMACRO_NUM=30 ned0921.c + $(obj) + +ned09m31.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro31 -DMACRO_NUM=31 ned0921.c + $(obj) + +ned09m32.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro32 -DMACRO_NUM=32 ned0921.c + $(obj) + +ned09m33.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro33 -DMACRO_NUM=33 ned0921.c + $(obj) + +ned09m34.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro34 -DMACRO_NUM=34 ned0921.c + $(obj) + +ned09m35.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro35 -DMACRO_NUM=35 ned0921.c + $(obj) + +ned09m36.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro36 -DMACRO_NUM=36 ned0921.c + $(obj) + +ned09m37.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro37 -DMACRO_NUM=37 ned0921.c + $(obj) + +ned09m38.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro38 -DMACRO_NUM=38 ned0921.c + $(obj) + +ned09m39.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro39 -DMACRO_NUM=39 ned0921.c + $(obj) + +ned09m40.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro40 -DMACRO_NUM=40 ned0921.c + $(obj) + +ned09m41.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro41 -DMACRO_NUM=41 ned0921.c + $(obj) + +ned09m42.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro42 -DMACRO_NUM=42 ned0921.c + $(obj) + +ned09m43.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro43 -DMACRO_NUM=43 ned0921.c + $(obj) + +ned09m44.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro44 -DMACRO_NUM=44 ned0921.c + $(obj) + +ned09m45.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro45 -DMACRO_NUM=45 ned0921.c + $(obj) + +ned09m46.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro46 -DMACRO_NUM=46 ned0921.c + $(obj) + +ned09m47.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro47 -DMACRO_NUM=47 ned0921.c + $(obj) + +ned09m48.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro48 -DMACRO_NUM=48 ned0921.c + $(obj) + +ned09m49.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro49 -DMACRO_NUM=49 ned0921.c + $(obj) + +ned09m50.obj : ned0921.c + $(ccc) -DMACRO_PRIM=p_macro50 -DMACRO_NUM=50 ned0921.c + $(obj) + diff --git a/app/ned/09/ned0901.c b/app/ned/09/ned0901.c new file mode 100644 index 0000000000000000000000000000000000000000..04b20d40268af06f3400e4d99a52e73888d2a7be --- /dev/null +++ b/app/ned/09/ned0901.c @@ -0,0 +1,31 @@ +/* + * FILE %ned/09/ned0901.c + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1997-10-26 11:12:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/strings.h> +#include "proto.h" + +extern char stp_fnm []; + +/* ------------------------------------------------------------------------ */ +void def_setupfnm (char *s) +{ + strcpy_max (stp_fnm, s, MAX_FNM_LENGTH); +} diff --git a/app/ned/09/ned0902.c b/app/ned/09/ned0902.c new file mode 100644 index 0000000000000000000000000000000000000000..60acc95f152ed0cfc94f136965542955e2607e82 --- /dev/null +++ b/app/ned/09/ned0902.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/09/ned0902.c + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1996-07-13 20:45:09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern char stp_fnm []; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +void p_edsetup () +{ + if (oper_level >= LEV_STP) return; + + ned_open_file (stp_fnm, (char *) 0, (char *) 0, NED_OPENF_DEF_STP); +} + diff --git a/app/ned/09/ned0903.c b/app/ned/09/ned0903.c new file mode 100644 index 0000000000000000000000000000000000000000..30ba2c91db64c5c9ac27df5136fd3a4296b40afd --- /dev/null +++ b/app/ned/09/ned0903.c @@ -0,0 +1,206 @@ +/* + * FILE %ned/09/ned0903.c + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * 1991 02 07: Revision + * 1991 05 26: Revision + * 1992 04 04: buttons + * 1992 07 12: p_rdsetup() -> q_rdsetup + * 1996-12-04: q_rdsetup() -> ned_read_setup; rearangements + * latest update: 1998-08-16 12:40:19 + * $Id: ned0903.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +extern struct NED_CONTEXT *ned_main_context; + +/* --- SETUP -------------------------------------------------------------- */ +#define STP_stdtbl 0 +#define STP_pfxq 1 +#define STP_pfxk 2 +#define STP_pfxo 3 +#define STP_func 4 +#define STP_end 5 +#define STP_macro 6 +#define STP_window 7 +#define STP_ax 8 +#define STP_ay 9 +#define STP_bx 10 +#define STP_by 11 +#define STP_attr 12 +#define STP_btyp 13 +#define STP_page 14 /* Bildschirmseite */ +#define STP_maus 15 +#define STP_menu 15 /* new name vor STP_maus */ +#define STP_button 16 +#define STP_tcl 17 /* definition for tcl macros */ +#define STP_tag 18 /* definition for tag macros */ +#define STP_feature 19 /* definition for feature macros */ +#define STP_nobell 20 +#define STP_context 21 +#define STP_ned_main 22 +#define N_STP_CMD 23 /* number of known setup commadns */ + +/* ------------------------------------------------------------------------ */ +char *STP_CMD [N_STP_CMD] = /* Kommando Tabelle fuer SETUP */ +{ + "@stdtbl", "@pfx:q", "@pfx:k", "@pfx:o", "@func", + "@end", "@macro", "@window", "ax", "ay", + "bx", "by", "@attr", "btyp", "page", + "@menu", "@button", "@tcl", "@tag", "@feature", + "nobell", "context", "ned_main" +} ; + +/* ------------------------------------------------------------------------ */ +int ned_what_stp_cmd (char *s) +{ + int i; + + for (i= 0; i < N_STP_CMD; i++) + if (strcmp (STP_CMD [i], s) == 0) + return i; + + return -1; +} + +/* ------------------------------------------------------------------------ */ +int ned_read_setup (char *fnm) +{ + FILE *fi; + int rc; + int cmd_num; + +#define MAX_LINE 120 +#define MAX_FIELDS 3 + + char line [MAX_LINE]; + char *fields [MAX_FIELDS]; + char *token; + int num_fields; + + if ((fi= fopen (fnm, "rt")) == (FILE *) 0) return -1; + + ned_message_2 ("Reading Setup File ", fnm); +/* rst_button (); */ /* ##### dunno... shall we?? ... guess not! */ + + for (;;) + { + rc= fread_line (fi, line, MAX_LINE); +RETRY: + if (rc <= 0 && feof (fi)) break; + if (line [0] == '#') continue; + + num_fields= isolate_tokens (line, fields, MAX_FIELDS); + if (num_fields <= 0) continue; + + token= fields [0]; + if (token [0] == '#') continue; + + cmd_num= ned_what_stp_cmd (token); + switch (cmd_num) + { + case STP_end: + goto ENDE; + case STP_macro: + stp_macro (fi, line, MAX_LINE, MPt_key_sequence); + goto RETRY; + case STP_tcl: + stp_macro (fi, line, MAX_LINE, MPt_tcl); + goto RETRY; + case STP_tag: + stp_macro (fi, line, MAX_LINE, MPt_tag); + goto RETRY; + case STP_feature: + stp_macro (fi, line, MAX_LINE, MPt_feature); + goto RETRY; + case STP_button: + stp_button (fi, line, MAX_LINE); + goto RETRY; + case STP_menu: + stp_mm_item (fi, line, MAX_LINE); + goto RETRY; + case STP_attr: + stp_attr (fi, line, MAX_LINE); + goto RETRY; + + case STP_nobell: + vi_set_bell_mode (0); + break; + + case STP_context: + case STP_ned_main: + ned_add_context_list (ned_main_context, + (const char **) fields+1, + num_fields-1); + break; + +#ifdef USE_FULL_SETUP + case STP_stdtbl: + stp_rtbl (fi, 0, 0); + goto RETRY; + case STP_pfxq: + stp_rtbl (fi, 1, 0); + goto RETRY; + case STP_pfxk: + stp_rtbl (fi, 2, 0); + goto RETRY; + case STP_pfxo: + stp_rtbl (fi, 3, 0); + goto RETRY; + case STP_func: + stp_func (fi, 4, 0); + goto RETRY; + + case STP_window: + if (windows != (struct WINDOWCTRL *) 0) + { + stp_window (fi); + goto RETRY; + } + + case STP_ax: + case STP_ay: + case STP_bx: + case STP_by: + case STP_btyp: + case STP_page: + for (;;) /* Parameter ueberlesen */ + { + /* ### FIX THIS ### */ + if (line [0] == '#') continue; + break; + } + break; + + case STP_maus: + if (stp_maus (fi)==-1) goto ENDE; + goto RETRY; +#endif /* USE_FULL_SETUP */ + default: + break; + } + } + +ENDE: + fclose (fi); + + return 0; +} diff --git a/app/ned/09/ned0905.c b/app/ned/09/ned0905.c new file mode 100644 index 0000000000000000000000000000000000000000..5c70e864211e355378be3cb2711f6a5e74239167 --- /dev/null +++ b/app/ned/09/ned0905.c @@ -0,0 +1,34 @@ +/* + * FILE %ned/09/ned0905.c + * + * ** OBSOLETE ** + * + * Setup File processing + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1997-10-26 11:13:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int stp_whatprim (char *s) +{ + int i; + +#ifdef __OBSOLETE__ /* 1996-11-10 9:59:42 */ + for (i= 0; i < N_PRIMS; i++) + if (strcmp (CT1 [i], s) == 0) + return i; +#endif /* __OBSOLETE__ 1996-11-10 9:59:42 */ + + return -1; +} diff --git a/app/ned/09/ned0906.c b/app/ned/09/ned0906.c new file mode 100644 index 0000000000000000000000000000000000000000..ccac51e9607ea27de976246a65255f63b5024add --- /dev/null +++ b/app/ned/09/ned0906.c @@ -0,0 +1,88 @@ +/* + * FILE %ned/09/ned0906.c + * + * ** OBSOLETE ** + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1997-10-26 11:13:31 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void stp_rtbl ( +FILE *fi, +int tn, /* Table Nummer */ +int f) /* Flag */ +{ + int pr_num; + int tbl_off; + int s_char; /* 1 -> Sonderzeichen; z.b. ^O+ */ + + f= 0; /* ####### */ + + for (;;) + { + fscanf (fi, "%s", cmd); + if (feof (fi)) break; + if (cmd [0] == '#') + { + trash_until_eol (fi); + continue; + } + + if (ned_what_stp_cmd (cmd) >= 0) break; + s_char = 0; + if (cmd [0] >= 'a' || cmd [0] <= 'z') tbl_off = cmd [0] - 'a'+1; else + if (cmd [0] >= 'A' || cmd [0] <= 'Z') tbl_off = cmd [0] - 'A'+1; + if (cmd [0] >= '0' || cmd [0] <= '9') + { + tbl_off= (int) get_parameter_value (cmd); + s_char= 1; + } + else + { + tbl_off = cmd [0]; + s_char = 1; + } + + for (;;) + { + fscanf (fi, "%s", cmd); + if (feof (fi)) return; + if (cmd [0] == '#') continue; + if (ned_what_stp_cmd (cmd) >= 0) return; + break; + } + + pr_num = stp_whatprim (cmd); + trans_str (cmd, cmd, 9999); + if (pr_num < 0) continue; + + if (s_char || tn == 0 /* Standardtable: Nur CTRL erlaubt!!! */) + P_TBL [tn*256+ tbl_off ] = CT2 [pr_num]; + else + { + P_TBL [tn*256+ tbl_off ] = CT2 [pr_num]; + P_TBL [tn*256+ tbl_off+'a'-1] = CT2 [pr_num]; + P_TBL [tn*256+ tbl_off+'A'-1] = CT2 [pr_num]; + } + } +} diff --git a/app/ned/09/ned0907.c b/app/ned/09/ned0907.c new file mode 100644 index 0000000000000000000000000000000000000000..d307eebb2ad2ba0533b90f8998b89807d087cfab --- /dev/null +++ b/app/ned/09/ned0907.c @@ -0,0 +1,71 @@ +/* + * FILE %ned/09/ned0907.c + * + * ** OBSOLETE ** + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1997-10-26 11:13:39 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/keys.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void stp_func ( +FILE *fi, +int tn, /* Table Nummer */ +int f) /* Flag */ +{ + int pr_num; + int knum= 0; + + f= 0; + + for (;;) + { + fscanf (fi, "%s", cmd); + if (feof (fi)) break; + if (cmd [0] == '#') + { + trash_until_eol (fi); + continue; + } + if (ned_what_stp_cmd (cmd) >= 0) break; + + /* Code der eingegebenen Taste ermitteln */ + knum = identify_key (cmd); + + if (knum == 0) knum= (int) get_parameter_value (cmd); + knum %= 256; + + for (;;) + { + fscanf (fi, "%s", cmd); + if (feof (fi)) return; + if (cmd [0] == '#') continue; + if (ned_what_stp_cmd (cmd) >= 0) return; + break; + } + pr_num= stp_whatprim (cmd); + if (pr_num < 0) continue; + P_TBL [tn*256+ knum] = CT2 [pr_num]; + } +} + diff --git a/app/ned/09/ned0908.c b/app/ned/09/ned0908.c new file mode 100644 index 0000000000000000000000000000000000000000..c52b96ad29a986729c7c5eb45ec6bb5e89cb1735 --- /dev/null +++ b/app/ned/09/ned0908.c @@ -0,0 +1,37 @@ +/* + * FILE %ned/09/ned0908.c + * + * Operationen mit dem SETUP-File + * o Installation von Makros + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * 1991 05 26: Revision + * latest update: 1996-12-04 18:19:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/sbr.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void stp_macro (FILE *fi, char *token, int max_token, int mac_type) +{ + int rc; + + for (;;) + { + rc= fread_line (fi, token, max_token); + if (rc <= 0 && feof (fi)) break; + if (token [0] == '#') continue; + + if (ned_what_stp_cmd (token) >= 0) break; + mac_parse (token, mac_type); + } +} diff --git a/app/ned/09/ned0909.c b/app/ned/09/ned0909.c new file mode 100644 index 0000000000000000000000000000000000000000..104eed791245d079dcabffc8e72cd6741bacc369 --- /dev/null +++ b/app/ned/09/ned0909.c @@ -0,0 +1,109 @@ +/* + * FILE %ned/09/ned0909.c + * + * *** NOT USED *** + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1997-10-26 11:12:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include "ed.h" +#include "message.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void stp_window (FILE *fi) +{ + int i; + int win_num, scmd_num, value; + register struct WINDOWCTRL *wc; + + for (;;) + { + fscanf (fi, "%s", cmd); + if (feof (fi)) return; + if (cmd [0] == '#') continue; + if (ned_what_stp_cmd (cmd) >= 0) return; + break; + } + + win_num= (int) get_parameter_value (cmd); + if (win_num <= 0) win_num= 1; + if ((wc= windows) == (struct WINDOWCTRL *) 0) return; + for (i= 1; i < win_num; i++) + if ((wc= wc->WC_next) == (struct WINDOWCTRL *) 0) return; + + for (;;) + { + fscanf (fi, "%s", cmd); + if (feof (fi)) break; + if (cmd [0] == '#') + { + trash_until_eol (fi); + continue; + } + + scmd_num= ned_what_stp_cmd (cmd); + if (scmd_num < STP_ax || scmd_num > STP_page) + return; + + for (;;) + { + fscanf (fi, "%s", cmd); + if (feof (fi)) return; + if (cmd [0] == '#') continue; + if (ned_what_stp_cmd (cmd) >= 0) return; + break; + } + + value= (int) get_parameter_value (cmd); + switch (scmd_num) + { + case STP_ax: + if (value < 0) break; + wc->w_upd |= 0x80; + wc->cx= wc->ax = value; + break; + case STP_ay: + if (value < 1) break; + wc->w_upd |= 0x80; + wc->cy= wc->ay= value; + break; + case STP_bx: + if (value > 79 || value < wc->ax + 5) break; + wc->w_upd |= 0x80; + wc->bx= value; + break; + case STP_by : + if (value > 24 || value < wc->ay + 5) break; + wc->w_upd |= 0x80; + wc->by= value; + break; + case STP_attr: + wc->attr_text= value & 0xFF; + break; + case STP_btyp: + wc->box_type= (value > 2) ? 2 : value; + break; + case STP_page: + wc->page= (value > 7 || value < 0) ? 0 : value; + break; + } + } +} diff --git a/app/ned/09/ned0910.c b/app/ned/09/ned0910.c new file mode 100644 index 0000000000000000000000000000000000000000..ef98c4a9ebb6e4581782482da89f3bf8ed0db5b7 --- /dev/null +++ b/app/ned/09/ned0910.c @@ -0,0 +1,88 @@ +/* + * FILE %ned/09/ned0910.c + * + * ** OBSOLETE ** + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1997-10-26 11:12:27 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include <gg/maus.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include "message.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int stp_maus (FILE *fi) +{ + int status= 0; /* status of line parser */ + int spalte= 0; /* mouse menu column */ + int zeile= 0; /* mouse menu line */ + int pr_num= 0; /* NED primitive command for menu item */ + char *cp; /* token string duplicate string */ + + for (;;) + { + fscanf (fi, "%s", cmd); + if (feof (fi)) break; + if (cmd [0] == '#') + { + trash_until_eol (fi); + continue; + } + + if (ned_what_stp_cmd (cmd) >= 0) break; + + switch (status) + { + case 0: /* Spalten Nummer: 0 .. 9 */ + spalte= (int) get_parameter_value (cmd)-1; + status++; + break; + case 1: /* Zeilen Nummer 0 .. ?? */ + zeile= (int) get_parameter_value (cmd); + status++; + break; + case 2: /* Verbundenens Primitive */ + pr_num= stp_whatprim (cmd); + /* pr_num == -1 -> unbekanntes Primitive; */ + /* das ist jedoch erlaubt! */ + status++; + case 3: /* String im Menu */ + fscanf (fi, "%[ \t]", cmd); + fscanf (fi, "%[^\n]", cmd); + if (feof (fi)) break; fgetc (fi); + if ((cp= strdup (cmd)) == (char *) 0) + { + ned_error_message (ERR_MEMORY); + return -1; + } + if (spalte >= 0 && zeile >= 0) + mm_install_function (spalte, zeile, cp, + (pr_num<0) ? -1L : (long) CT2 [pr_num], + 0, 2); + status= 0; + break; + } + } + + return 0; +} diff --git a/app/ned/09/ned0911.c b/app/ned/09/ned0911.c new file mode 100644 index 0000000000000000000000000000000000000000..70fd356ab8ac64d1a321ad31e7be2cdc1ebc9dc2 --- /dev/null +++ b/app/ned/09/ned0911.c @@ -0,0 +1,94 @@ +/* + * FILE %ned/09/ned0911.c + * + * translate a key sequence into its binary representation + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1997-10-26 11:13:45 + * $Id: ned0911.c,v 1.2 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dpp.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int trans_str ( +const char *si, /* string input */ +char *so, /* output string */ +int size) /* maximum size in the destination buffer */ +/* return: number o bytes in the destination buffer */ +{ + int i= 0; + int o= 0; + int j; + + for (; size > 0; size--) + { + switch (si [i]) + { + case '^': + if (!(j= si [++i])) + { + so [o]= 0; + return o; + } + if (j >= 'a' && j <= 'z') j = j - 'a' + 1; else + if (j >= 'A' && j <= 'Z') j = j - 'A' + 1; + else break; + so [o++]= (char) j; + i++; + break; + + case '\\': + switch (j=si [++i]) + { + case '\\': so [o++]= '\\'; break; + case 'e' : so [o++]= 0x1B; break; + case 'n' : so [o++]= '\n'; break; + case '^' : so [o++]= '^'; break; + case '-' : so [o++]= ' '; break; + case '#' : so [o++]= '#'; break; + case 'x' : case 'X': + if (! si [++i]) + { + so [o]= 0; + return o; + } + so [o++]= (char) ARGeval (si, i, 2, 16); + for (j= 0; j < 2; j++) + if (! si [++i]) + { + so [--o]= 0; + return o-1; + } + i--; + break; + case '0' : case '1': case '2': case '3': + case '4' : case '5': case '6': case '7': + so [o++]= (char) ARGeval (si, i, 3, 8); + for (j= 0; j < 3; j++) + if (! si [++i]) + { + so [--o]= 0; + return o-1; + } + i--; + break; + } + i++; + break; + + default: + if (!(so [o++]= si [i++])) return o-1; + } + } + + return o; +} diff --git a/app/ned/09/ned0912.c b/app/ned/09/ned0912.c new file mode 100644 index 0000000000000000000000000000000000000000..c421bd5f5d8e232bf486f5cdaa6ff69f6f668443 --- /dev/null +++ b/app/ned/09/ned0912.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/09/ned0912.c + * + * written: 1992 07 12: aus ned0903.c abgeleitet + * latest update: 1997-10-26 11:12:58 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern char stp_fnm []; +extern int oper_level; + +/* ------------------------------------------------------------------------ */ +int p_rdsetup () +{ + if (oper_level >= LEV_STP) return -2; + /* rst_button (); */ /* ##### dunno... shall we?? */ + + return ned_read_setup (stp_fnm); +} diff --git a/app/ned/09/ned0913.c b/app/ned/09/ned0913.c new file mode 100644 index 0000000000000000000000000000000000000000..026904bbe673bde39d5c02dc899bae9782531108 --- /dev/null +++ b/app/ned/09/ned0913.c @@ -0,0 +1,44 @@ +/* + * FILE ~/usr/ned/09/ned0913.c + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1994-12-28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <stdio.h> +#include <gg/keys.h> +#include "proto.h" + +extern FILE *jou; + +/* Editoreingabe: --------------------------------------------------------- */ +int kbin_jou () +{ + int kv; + + kv= kbin (); + + if (kv & 0x0100) + { + kv &= 0x00FF; + fputc (0x00, jou); /* Variante 2 !!!! */ + } + + fputc (kv, jou); + + return kv & 0x00FF; +} diff --git a/app/ned/09/ned0914.c b/app/ned/09/ned0914.c new file mode 100644 index 0000000000000000000000000000000000000000..56e68d010b264f3b91ef88ad75aaf2ac82219c00 --- /dev/null +++ b/app/ned/09/ned0914.c @@ -0,0 +1,49 @@ +/* + * FILE ~/usr/ned/09/ned0914.c + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * 1991 06 01: Revision + * latest update: 1997-10-26 11:13:55 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +extern FILE *jou; +extern int pfx; + +/* ------------------------------------------------------------------------ */ +int jou_in () +{ + int kv; + + kv= fgetc (jou) & 0x00FF; + + if (feof (jou)) + { + p_close_jou (); + return q_kbin (); + } + + if (kv == 0) + { + pfx= P_FUNCT; + kv= fgetc (jou) & 0x00FF; + } + + return kv; +} diff --git a/app/ned/09/ned0915.c b/app/ned/09/ned0915.c new file mode 100644 index 0000000000000000000000000000000000000000..1355aae7e21a54fe178161d6e3c1b09011ac4e66 --- /dev/null +++ b/app/ned/09/ned0915.c @@ -0,0 +1,43 @@ +/* + * FILE %ned/09/ned0915.c + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * 1991 02 07: Revision + * latest update: 1997-10-26 11:14:23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "message.h" +#include "proto.h" + +extern FILE *jou; +extern char jou_name []; +extern int jou_flag; +extern ned_input_handler *nextchar; + +/* ------------------------------------------------------------------------ */ +int p_open_jou_rd () /* Open Jour File for Read (Recover) */ +{ + p_close_jou (); + + if ((jou= fopen (jou_name, "rb")) == (FILE *) 0) return -1; + + jou_flag= 2; + nextchar= jou_in; + + return 0; +} diff --git a/app/ned/09/ned0916.c b/app/ned/09/ned0916.c new file mode 100644 index 0000000000000000000000000000000000000000..8a77ff1d971d40aefec1f1d7917a2761bc3aaadc --- /dev/null +++ b/app/ned/09/ned0916.c @@ -0,0 +1,40 @@ +/* + * FILE %ned/09/ned0916.c + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * 1991 02 07: Revision + * latest update: 1997-10-26 11:15:06 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +extern FILE *jou; +extern char jou_name []; +extern int jou_flag; +extern ned_input_handler *nextchar; + +/* ------------------------------------------------------------------------ */ +void p_open_jou_wr () /* Open Jour File for Write (Backup) */ +{ + p_close_jou (); + + jou= fopen (jou_name, "wb"); + + jou_flag= 1; + nextchar= kbin_jou; +} diff --git a/app/ned/09/ned0917.c b/app/ned/09/ned0917.c new file mode 100644 index 0000000000000000000000000000000000000000..2a58bdc79119af02bcda34ac416739c5d91a82bb --- /dev/null +++ b/app/ned/09/ned0917.c @@ -0,0 +1,36 @@ +/* + * FILE ~/usr/ned/09/ned0917.c + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * 1991 06 01: Revision + * latest update: 1997-10-26 10:48:16 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +extern FILE *jou; +extern int jou_flag; +extern ned_input_handler *nextchar; + +/* ------------------------------------------------------------------------ */ +void p_close_jou () +{ + if (jou_flag == 1 || jou_flag == 2) fclose (jou); + jou_flag= 0; + nextchar= q_kbin; +} diff --git a/app/ned/09/ned0918.c b/app/ned/09/ned0918.c new file mode 100644 index 0000000000000000000000000000000000000000..d44b243c25b870122201d46a1e8219bd2a065150 --- /dev/null +++ b/app/ned/09/ned0918.c @@ -0,0 +1,51 @@ +/* + * FILE %ned/09/ned0918.c + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1997-10-26 10:59:52 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +extern int MPflag; +extern ned_input_handler *nxtchs, *nextchar; + +extern struct NED_CONTEXT *ned_main_context; + +/* Bedienprozeduren fuer Makroprozessor: ---------------------------------- */ +int mac_expand () +{ + int k= 0; + char *mp; + + if (ned_main_context == (struct NED_CONTEXT *) 0 + || (mp= ned_main_context->NED_macro_pointer) == (char *) 0 + || (k= *mp++ & 0x00FF) == 0 + || *mp == 0 + ) + { + nextchar= nxtchs; + MPflag= 0; + } + else + { + ned_main_context->NED_macro_pointer++; + } + + return k; +} diff --git a/app/ned/09/ned0919.c b/app/ned/09/ned0919.c new file mode 100644 index 0000000000000000000000000000000000000000..3df7bb9b813324f45ec34a9f42d3499e993d6bef --- /dev/null +++ b/app/ned/09/ned0919.c @@ -0,0 +1,80 @@ +/* + * FILE %ned/09/ned0919.c + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1997-02-11 23:56:45 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +extern int MPflag; +extern ned_input_handler *nextchar; /* Editor Eingabe: KBD | FILE .. */ +extern ned_input_handler *nxtchs; /* Zwischenspeicher fuer (*nextchar) */ + +extern struct NED_CONTEXT *ned_main_context; + +/* ------------------------------------------------------------------------ */ +void p_macro (int num) +{ + if ( num < 0 /* macro number ... */ + || num >= N_MACRO /* ... valid number? */ + || ned_main_context == (struct NED_CONTEXT *) 0 + ) + return; + + ned_q_macro (ned_main_context->NED_macro_table [num]); +} + +/* ------------------------------------------------------------------------ */ +void ned_q_macro (struct NED_MACRO *mp) +{ + char *mac_txt; + + if (mp == (struct NED_MACRO *) 0 + || MPflag /* macro already active? */ + || (mac_txt= mp->NED_mac_contents) == (char *) 0 + || *mac_txt == 0 + ) return; + + switch (mp->NED_mac_type) + { + case MPt_key_sequence: + nxtchs= nextchar; /* previous character function */ + nextchar= mac_expand; /* macro expander */ + MPflag= 1; /* ... mark as active */ + ned_main_context->NED_macro_pointer= mac_txt; + break; + + case MPt_tcl: + mac_call_tcl (mac_txt); /* hand string over to tcl interp. */ + break; + + case MPt_tag: + ex_tag_command (mac_txt); + break; + + case MPt_feature: + ned_eval_string (mac_txt, 0); + break; + + case MPt_undefined: + default: + break; + } + +} diff --git a/app/ned/09/ned0921.c b/app/ned/09/ned0921.c new file mode 100644 index 0000000000000000000000000000000000000000..6ee936bd75efd3dc4597b716dbbdab40b20917a0 --- /dev/null +++ b/app/ned/09/ned0921.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/09/ned0921.c + * + * macro functions: + * this module is a template that is used to generate the function + * modules for each macro. + * + * written: 1987 09 10 + * 1991 11 10: Revision + * latest update: 1994-07-09 + * $Id: ned0921.c,v 1.2 2005/04/01 16:46:20 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#ifndef cdecl +#define cdecl +#endif +#endif + +void cdecl MACRO_PRIM (void); +void cdecl p_macro (int); + +void MACRO_PRIM () { p_macro (MACRO_NUM); } diff --git a/app/ned/09/ned0922.c b/app/ned/09/ned0922.c new file mode 100644 index 0000000000000000000000000000000000000000..bb8a70468d8e586bbdeb5e6e58cd4e0c2e97f2d7 --- /dev/null +++ b/app/ned/09/ned0922.c @@ -0,0 +1,508 @@ +/* + * FILE %ned/09/ned0922.c + * + * call evaluation of a Tcl script and more Tcl interfacing + * + * written: 1995-01-04 + * latest update: 2000-12-09 13:17:40 + * $Id: ned0922.c,v 1.10 2011/12/18 12:17:48 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif /* MSDOS */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/strings.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +#ifdef USE_TCL +#include <gg/filename.h> +#include <tcl.h> +#include "edtcl.h" +#endif /* USE_TCL */ + +#ifdef USE_TK +#include <tk.h> +#include "edtk.h" +static Tk_Window ned_tk_main_window; +#include <X11/Xutil.h> /* used in _ned_tk_set_window_name */ +#include <X11/Xatom.h> +#endif /* USE_TK */ + +/* ------------------------------------------------------------------------ */ +extern struct NED_CONTEXT *ned_main_context; +extern struct WINDOWCTRL *aw; + +#ifdef USE_TCL +Tcl_Interp *main_interp= (Tcl_Interp *) 0; +#endif /* USE_TCL */ + +static int window_cnt= 0; + +/* ------------------------------------------------------------------------ */ +int ned_tcl_startup ( /* initialize TCL by ned */ +char *rc_names[], +char *tcl_glib) +{ +#ifdef USE_TCL + char *rc_name; + int i; + + if ((main_interp= Tcl_CreateInterp ()) == (Tcl_Interp *) 0 + || Tcl_Init (main_interp) == TCL_ERROR + ) + { +ERROR1: + fprintf (stderr, "error initializing TCL subsystem!\n"); + ned_message_1 ("error initializing TCL subsystem!"); + return -1; + } + + ned_tcl_register (main_interp); + ned_tcl_preset (main_interp, tcl_glib); + + Tcl_CreateCommand (main_interp, "ned_main", ned_tcl_context, + (ClientData) ned_main_context, + (Tcl_CmdDeleteProc *) 0); + +#ifdef USE_TK + if (Tk_Init (main_interp) == TCL_ERROR) goto ERROR1; + Tcl_CreateCommand (main_interp, "ned_current", ned_tk_current, + (ClientData) 0, + (Tcl_CmdDeleteProc *) 0); +#endif /* USE_TK */ + + for (i= 0; (rc_name= rc_names [i]) != (char *) 0; i++) + if (ned_tcl_run_file (rc_name) == TCL_OK) break; + +#ifdef USE_TK + ned_tk_main_window= Tk_MainWindow (main_interp); + Tk_SetClass (ned_tk_main_window, "Ned"); + Tk_SetAppName (ned_tk_main_window, "ned"); + Tk_MakeWindowExist (ned_tk_main_window); +#endif /* USE_TK */ + +#else /* USE_TCL */ + rc_names; + tcl_glib; +#endif + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_tcl_run_file (char *rc_name) +{ +#ifdef USE_TCL + if (main_interp == (Tcl_Interp *) 0) return -1; + + return Tcl_EvalFile (main_interp, translate_logic_filename (rc_name)); +#else + rc_name; + + return 0; +#endif +} + +/* ------------------------------------------------------------------------ */ +int ned_tcl_stop () /* stop TCL by ned */ +{ + +#ifdef USE_TCL + if (main_interp == (Tcl_Interp *) 0) return -1; + Tcl_DeleteInterp (main_interp); +#endif /* USE_TCL */ + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int mac_call_tcl (char *tcl_script) +{ +#ifdef USE_TCL + int code; + char *cp; +#endif /* USE_TCL */ + + /**** ned_message_3 ("tcl macro: '", tcl_script, "'"); *****/ + /**** printf ("0922 tcl macro: '%s'\n", tcl_script); ****/ + +#ifdef USE_TCL + if (main_interp == (Tcl_Interp *) 0) return -1; + + code= Tcl_Eval (main_interp, tcl_script); + if ((cp= main_interp->result) != (char *) 0 && *cp != 0) + ned_message_2 ("Tcl result: ", cp); +#else + ned_message_3 ("tcl macro: '", tcl_script, "'"); +#endif /* !USE_TCL */ + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_paste_tcl (char *tcl_script) +{ +#ifdef USE_TCL + int code; + char *cp; +#else +#ifdef MSDOS + tcl_script; +#endif /* MSDOS */ +#endif /* !USE_TCL */ + + /**** ned_message_3 ("tcl macro: '", tcl_script, "'"); *****/ + +#ifdef USE_TCL + if (main_interp == (Tcl_Interp *) 0) return -1; + + code= Tcl_Eval (main_interp, tcl_script); + if ((cp= main_interp->result) != (char *) 0 && *cp != 0) + { + ned_paste_string (cp, 0, (char *) 0, (char *) 0); + } +#endif /* !USE_TCL */ + + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef USE_TCL +#ifdef USE_TK +static char cmd_buffer [1024]; + +int ned_tk_associate_window (struct WINDOWCTRL *wc) +{ + const char *argv [2]; + char path[40]; + int rc; + + sprintf (path, ".ned%02d", ++window_cnt); + argv [0]= "ned"; + argv [1]= path; + + rc= _ned_tk_create_widget ((ClientData) ned_tk_main_window, + main_interp, 2, argv, wc); + ned_tk_set_window_name (wc, wc->WC_title_short); + + return rc; +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_delete_association (struct WINDOWCTRL *wc) +{ + NED_Widget *nw; + + if (wc == (struct WINDOWCTRL *) 0 + || (nw= (NED_Widget *) wc->wc_widget) == (NED_Widget *) 0 + ) return 0; /* someone else was here before ... */ + + sprintf (cmd_buffer, "remove_from_window_list %s", nw->window_path); + mac_call_tcl (cmd_buffer); + + wc->wc_widget= (void *) 0; + nw->ned_window= (struct WINDOWCTRL *) 0; + + _ned_tk_destroy_widget (nw); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_set_window_name (struct WINDOWCTRL *wc, char *name) +{ + if (wc == (struct WINDOWCTRL *) 0) return -1; + return _ned_tk_set_window_name (wc->wc_widget, name); +} + +/* ------------------------------------------------------------------------ */ +int _ned_tk_set_window_name (NED_Widget *nw, char *name) +{ +#ifdef V1 + XTextProperty tp; + + if (nw != (NED_Widget *) 0 + && XStringListToTextProperty (&name, 1, &tp) != 0 + ) + { + XSetWMName (nw->display, Tk_WindowId (nw->tkwin), &tp); + XFree ((char *) tp.value); + return 0; + } +#endif + + if (nw != (NED_Widget *) 0) + { + char *path; + + path= nw->window_path; + + sprintf (cmd_buffer, "wm title %s {%s}; wm iconname %s {%s}", + path, name, path, name); + /*** fprintf (stderr, "0922: set_window_name name='%s'\n", name); ***/ + Tcl_Eval (nw->interp, cmd_buffer); + + sprintf (cmd_buffer, "add_to_window_list %s {%s}", path, name); + Tcl_Eval (nw->interp, cmd_buffer); + +#ifdef __COMMENT__ +Note: add_to_window_list is a command in the main interpreters context +while the wm command could depend on the widget. +#endif /* __COMMENT__ */ + return 0; + } + + return -1; +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_import_selection () +{ + NED_Widget *nw; + int rc; + + if (aw == (struct WINDOWCTRL *) 0 + || (nw= (NED_Widget *) aw->wc_widget) == (NED_Widget *) 0 + ) return -1; + +#ifdef __NOT_OK__ /* 1997-10-26 8:54:02 */ + ned_set_marker (aw, '0'); +#endif /* __NOT_OK__ 1997-10-26 8:54:02 */ + + rc= Tk_GetSelection (main_interp, nw->tkwin, XA_PRIMARY, XA_STRING, + ned_tk_imp_selection_procedure, (ClientData) nw); + +#ifdef __JUNK__ + int offset1; +... dont use that section. + +This sets the marked block to the newly imported selection and +claims the selection. Importing the selection again could cause a +loop because the imported text is part of the exported selection as +well. Also, claiming the selection upon import is not very intuitive +for the user. + + b_beg.wptr= marker[0].wptr; /* T2D: eigene Funktion machen */ + b_beg.ptr= marker[0].ptr; + b_beg.offset= offset1; + block_mode= BLOCK_MODE_standard; /* switch to standard block mode */ + + p_blkend (); +#endif /* __JUNK__ */ + + return rc; +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_special_event (struct WINDOWCTRL *w, int what, int p1, int p2) +{ + NED_Widget *nw; + char *event_str= (char *) 0; + + if (w == (struct WINDOWCTRL *) 0) w= aw; + if (w == (struct WINDOWCTRL *) 0 + || (nw= w->wc_widget) == (NED_Widget *) 0 + ) return -1; + + switch (what) + { + case NED_TK_CMD_MOUSE_B2: + if ((event_str= nw->cmd_right_button) == (char *) 0) + event_str= "ned_mouse_b2"; + + sprintf (cmd_buffer, "%s %d %d", event_str, p1, p2); + mac_call_tcl (cmd_buffer); + return 0; + + case NED_TK_CMD_WINS: + if ((event_str= nw->cmd_WINS) == (char *) 0) + event_str= "ned_cmd_wins"; + break; + + case NED_TK_CMD_MENU: + if ((event_str= nw->cmd_MENU) == (char *) 0) + event_str= "ned_cmd_menu"; + break; + } + + if (event_str != (char *) 0) mac_call_tcl (event_str); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +struct prompt_callback +{ + NED_field_editor_callback *cb; + void *client_data; + char *var_name; +} ; + +/* ------------------------------------------------------------------------ */ +/* create a Tk window to prompt for a string, e.g. in a file open dialog */ +/* see * for a discussion about a modified file open dialog */ +int ned_tk_prompt_string ( +char *label, +char *string, +char *help_cluster, +char *help_frame, +NED_field_editor_callback *cb, +void *client_data) +{ + char *var_name; /* name of the temporary widget, */ + /* global variable and command !!! */ + struct prompt_callback *cbs; + + if ((var_name= (char *) malloc (40)) == (char *) 0 + || (cbs= (struct prompt_callback *) + calloc (sizeof (struct prompt_callback), 1)) + == (struct prompt_callback *) 0 + ) return -1; + + cbs->cb= cb; + cbs->client_data= client_data; + cbs->var_name= var_name; + + sprintf (var_name, "ned_tmp_%02d", ++window_cnt); + sprintf (cmd_buffer, + "ned_prompt_string %s {%s} %s %s {%s} {%s}", + var_name, label, var_name, var_name, + help_cluster, help_frame); + + Tcl_SetVar (main_interp, var_name, string, TCL_GLOBAL_ONLY); + Tcl_CreateCommand (main_interp, var_name, + (Tcl_CmdProc *) ned_tk_cb_prompt_string, + (ClientData) cbs, + (Tcl_CmdDeleteProc *) 0); + + Tcl_Eval (main_interp, cmd_buffer); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +/* tcl syntax: .... T2D */ +int ned_tk_cb_prompt_string ( +ClientData clientData, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + struct prompt_callback *cbs; + const char *var_name; + const char *var_value; + + if ((cbs= (struct prompt_callback *) clientData) + == (struct prompt_callback *) 0 + || (var_name= cbs->var_name) == (char *) 0 + ) + return TCL_ERROR; + + var_value= Tcl_GetVar (interp, var_name, TCL_GLOBAL_ONLY); + (*cbs->cb) ((char *) var_value, 0 /* T2D Not used! */, 0, cbs->client_data); + + Tcl_UnsetVar (interp, var_name, TCL_GLOBAL_ONLY); + Tcl_DeleteCommand (interp, var_name); + + /** free_or_what (var_name); duplicate free?? **/ + free_or_what (cbs); + + return TCL_OK; +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_wc_window_action (struct WINDOWCTRL *wc, int what) +{ + NED_Widget *nw; + char *action; + char *path; + + switch (what) + { + case WC_action_deiconify: + action= "wm deiconify %s;raise %s"; + break; + case WC_action_iconify: + action= "wm iconify %s"; + break; + case WC_action_withdraw: + action= "wm withdraw %s"; + break; + default: + return -1; + } + + if (wc == (struct WINDOWCTRL *) 0 + || (nw= (NED_Widget *) wc->wc_widget) == (NED_Widget *) 0 + || (path= nw->window_path) == (char *) 0 + ) return -1; + + sprintf (cmd_buffer, action, path, path); + Tcl_Eval (nw->interp, cmd_buffer); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_aw_save_withdraw () +{ + ned_save_reload (aw, WCTDM_no_change); + return ned_tk_wc_window_action (aw, WC_action_withdraw); +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_aw_withdraw () +{ + return ned_tk_wc_window_action (aw, WC_action_withdraw); +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_aw_iconify () +{ + return ned_tk_wc_window_action (aw, WC_action_iconify); +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_aw_deiconify () /* is this function really useful??? */ +{ + return ned_tk_wc_window_action (aw, WC_action_deiconify); +} + +/* ------------------------------------------------------------------------ */ +/* tcl syntax: ned_current <method> <pars>* */ +int ned_tk_current ( +ClientData clientData, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + NED_Widget *nw; + + if (aw == (struct WINDOWCTRL *) 0 + || (nw= (NED_Widget *) aw->wc_widget) == (NED_Widget *) 0 + ) + return TCL_ERROR; + + return ned_tk_widget_cmd ((ClientData) nw, interp, argc, argv); +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_start_mode (struct WINDOWCTRL *wc) +{ + const char *start_mode; + + if ((start_mode= Tcl_GetVar2 (main_interp, "ned", "start_mode", + TCL_GLOBAL_ONLY)) == (char *) 0) return -1; + + if (abbrev ("withdrawn", start_mode, 1) == 1) + ned_tk_wc_window_action (wc, WC_action_withdraw); else + if (abbrev ("iconic", start_mode, 1) == 1) + ned_tk_wc_window_action (wc, WC_action_iconify); +} +#endif /* USE_TK */ +#endif /* USE_TCL */ diff --git a/app/ned/09/ned0923.c b/app/ned/09/ned0923.c new file mode 100644 index 0000000000000000000000000000000000000000..f54b8911a87c6f6db4ec2dbe4ec1138a236a269e --- /dev/null +++ b/app/ned/09/ned0923.c @@ -0,0 +1,72 @@ +/* + * FILE %ned/09/ned0923.c + * + * NED's tcl application initialization + * + * written: 1995-01-08 + * latest update: 1999-05-01 18:49:51 + * + */ + +#include <tcl.h> + +#include <gg/ggtcl.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +extern struct NED_PRIMITIVES NED_PRIMITIVE_TABLE []; + +/* ------------------------------------------------------------------------ */ +static struct N2P NED_COMMAND_TABLE [] = +{ + { "edit_file", ned_tcl_edit_file }, + { "ned", ned_tcl_edit_file }, + { "edit_frame", ned_tcl_edit_frame }, + { "edit_crf", ned_tcl_edit_crf }, + + { "set_markup", ned_tcl_set_markup }, + { "paste_str", ned_tcl_paste_str }, + { "enter_entity", ned_tcl_enter_entity }, + + { "jump_to_line", ned_tcl_jump_to_line }, + { "tag", ned_tcl_eval_tag }, + { "set_marker", ned_tcl_set_marker }, + { "jmp_marker", ned_tcl_jmp_marker }, + + { "submit_macro", ned_tcl_submit_macro }, + { "define_macro", ned_tcl_mac_define }, + { "define_feature", ned_tcl_define_feature }, + { "define_note", ned_tcl_define_note }, + { "note", ned_tcl_activate_note }, + { "register_tag_rule", ned_tcl_reg_tag_rule }, + { "def_abbrev", ned_tcl_def_abbrev }, + { "undef_abbrev", ned_tcl_undef_abbrev }, + + { (char *) 0, (Tcl_CmdProc *) 0 } +} ; + +/* ------------------------------------------------------------------------ */ +int ned_tcl_register (Tcl_Interp *interp) +{ + int i; + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + for (i= 0;; i++) + { + if (NED_PRIMITIVE_TABLE [i].NP_name == (char *) 0) break; + + Tcl_CreateCommand (interp, + NED_PRIMITIVE_TABLE [i].NP_name, + (Tcl_CmdProc *) ned_tcl_execute_primitive, + (ClientData) NED_PRIMITIVE_TABLE [i].NP_func, + (Tcl_CmdDeleteProc *) 0); + } + + ggtcl_reg_services (interp, NED_COMMAND_TABLE); + ggtcl_reg_filename_services (interp); + ggtcl_reg_hyx_services (interp); + + return TCL_OK; +} diff --git a/app/ned/09/ned0924.c b/app/ned/09/ned0924.c new file mode 100644 index 0000000000000000000000000000000000000000..7059680ad77b6e884cd1a84e781c913825202a8e --- /dev/null +++ b/app/ned/09/ned0924.c @@ -0,0 +1,50 @@ +/* + * FILE %ned/09/ned0924.c + * + * NED's tcl application initialization + * + * written: 1995-01-08 + * latest update: 1997-10-26 10:24:11 + * $Id: ned0924.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tcl_execute_primitive ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + ned_primitive *ned_primitive_func; + +#ifdef MSDOS + argv; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (client_data == (ClientData) 0) + { + interp->result= "invalid NED function"; + return TCL_ERROR; + } + + if (argc != 1) /* argc: 0 .. n-1 */ + { + interp->result= "wrong # args"; + return TCL_ERROR; + } + + ned_primitive_func= (ned_primitive *) client_data; + + (*ned_primitive_func) (); + + return TCL_OK; +} diff --git a/app/ned/09/ned0925.c b/app/ned/09/ned0925.c new file mode 100644 index 0000000000000000000000000000000000000000..4b5fd95fb92ff7b5e8856b49e73940f481d63de4 --- /dev/null +++ b/app/ned/09/ned0925.c @@ -0,0 +1,284 @@ +/* + * FILE %ned/09/ned0925.c + * + * NED's tk widget stuff + * + * written: 1995-09-25 + * latest update: 1999-05-30 8:53:11 + * $Id: ned0925.c,v 1.6 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tk.h> +#include <tcl.h> + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include "ed.h" +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" +#include <X11/Xatom.h> + +/* ------------------------------------------------------------------------ */ +/* tcl syntax: ned <window_path> (<opt> <val>)* */ +int _ned_tk_create_widget ( +ClientData clientData, +Tcl_Interp *interp, +int argc, +const char *argv [], +struct WINDOWCTRL *wc) +{ + Tk_Window tkwin= (Tk_Window) clientData; + Tk_Window new_win; + NED_Widget *nw; + char *path_name; + const char *my_name; + + my_name= argv [1]; + + if (tkwin == (Tk_Window) 0) + { + fprintf (stderr, "tkwin not initialized! Is Tk propperly installed?\n"); + exit (0); + } + + if ((new_win= Tk_CreateWindowFromPath (interp, tkwin, my_name, "")) + == (Tk_Window) 0 + || (nw= (NED_Widget *) calloc (sizeof (NED_Widget), 1)) + == (NED_Widget *) 0 + ) + { + return TCL_ERROR; + } + + /* create one-to-one association between widget and window control */ + /* T2D: create a many-to-many association for future use */ + nw->ned_window= wc; + wc->wc_widget= nw; + + nw->window_path= strdup (my_name); + nw->tkwin= new_win; + nw->display= Tk_Display (new_win); + nw->interp= interp; + nw->widgetCmd= Tcl_CreateCommand ( + interp, + path_name= Tk_PathName (new_win), + ned_tk_widget_cmd, + (ClientData) nw, + ned_tk_widget_delete); + + nw->num_x_pix_extra= 20; + +/* @@@ BEGIN NEW */ + { + char *sc_name; + char *sc_yview; + char *sc_cmds [6]; + int rc; + Tk_Window sc_win; + + sc_name= (char *) malloc (strlen (my_name) + 4); + sc_yview= (char *) malloc (strlen (my_name) + /*8*/ 24); + sprintf (sc_name, "%s.sb", my_name); + sprintf (sc_yview, "%s yview", my_name); + + sc_cmds [0]= ""; + sc_cmds [1]= sc_name; + sc_cmds [2]= "-command"; + sc_cmds [3]= sc_yview; + sc_cmds [4]= "-takefocus"; + sc_cmds [5]= "0"; + + rc= Tk_ScrollbarCmd ((ClientData) new_win, interp, 6, sc_cmds); + nw->sc_win= sc_win= Tk_NameToWindow (interp, sc_name, new_win); + + free (sc_name); + free (sc_yview); + } +/* @@@ END NEW */ + + Tk_SetClass (new_win, "Ned"); + + if (ned_tk_set_font (nw, + Tcl_GetVar2 (interp, "ned", "font", TCL_GLOBAL_ONLY)) != 0 + || ned_tk_configure (interp, nw, argc-2, argv+2, 0) != TCL_OK + ) + { + Tk_DestroyWindow (new_win); + fprintf (stderr, "NED 0925 config err: '%s'\n", interp->result); + return TCL_ERROR; + } + + Tk_MapWindow (new_win); + Tk_MapWindow (nw->sc_win); + + Tk_CreateEventHandler (new_win, NED_WIDGET_EVENT_MASK, + ned_tk_event_procedure, (ClientData) nw); + + Tk_CreateSelHandler (new_win, XA_PRIMARY, XA_STRING, + ned_tk_exp_selection_procedure, (ClientData) nw, + XA_STRING); + + interp->result= path_name; + + return TCL_OK; +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_set_font (NED_Widget *nw, const char *font_name) +{ + Tk_Font tkf; + Tk_Window new_win; + Tcl_Interp *interp; + Tk_FontMetrics fm; + int width; + struct WINDOWCTRL *wc; + + /* Font Stuff */ + if (font_name == (char *) 0 + || (tkf= Tk_GetFont (nw->interp, nw->tkwin, Tk_GetUid (font_name))) + == (Tk_Font) 0 + || (wc= nw->ned_window) == (struct WINDOWCTRL *) 0 + || (new_win= nw->tkwin) == (Tk_Window) 0 + || (interp= nw->interp) == (Tcl_Interp *) 0 + ) return -1; + + Tk_GetFontMetrics (tkf, &fm); + Tk_MeasureChars (tkf, "0", 1, -1, 0x00, &width); + + nw->fontPtr= tkf; + nw->line_height= fm.linespace; + nw->char_ascent= fm.ascent; + nw->char_width= width; + +/******************** + printf ( +"ned0925.c: NED_widget: nw=0x%08lX tkf=0x%08lX char_width=%d (%d) line_height=%d\n", + nw, tkf, width, nw->char_width, fm.linespace); +********************/ + + nw->num_x_pixels= (wc->bx + 1) * nw->char_width + + nw->num_x_pix_offset + nw->num_x_pix_extra; + nw->num_y_pixels= (wc->by + 1) * nw->line_height + + nw->num_y_pix_offset + nw->num_y_pix_extra; + + /* Graphics Contexts: normal text and such */ + /* defaults are set by ned_tcl_preset */ + ned_tk_set_color (nw, &nw->normalTextGC, 1, "fg_text", "bg_text"); + ned_tk_set_color (nw, &nw->cursedTextGC, 1, "fg_curs", "bg_curs"); + ned_tk_set_color (nw, &nw->StatusLineGC, 1, "fg_stat", "bg_stat"); + ned_tk_set_color (nw, &nw->markedTextGC, 1, "fg_mark", "bg_mark"); + ned_tk_set_color (nw, &nw->selectedTextGC,1,"fg_sel", "bg_sel"); + ned_tk_set_color (nw, &nw->hiddenTextGC, 1, "fg_hidden", "bg_hidden"); + nw->attrib_cnt= 0; + + ned_tk_set_geometry (nw); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_set_geometry (NED_Widget *nw) +{ + int y_off; + + /* change geometry of parent and slave windows */ + Tk_GeometryRequest (nw->tkwin, nw->num_x_pixels, nw->num_y_pixels); + y_off= nw->line_height * 3; /* check: possibly not always ! */ + Tk_MoveResizeWindow (nw->sc_win, + nw->num_x_pixels - nw->num_x_pix_extra, y_off, + nw->num_x_pix_extra, nw->num_y_pixels - y_off); + + return 0; +} + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_tk_setup_special (struct WINDOWCTRL *w, int what, char *str) +{ + if (w == (struct WINDOWCTRL *) 0) w= aw; + if (w == (struct WINDOWCTRL *) 0) return -1; + + return _ned_tk_setup_special (w->wc_widget, what, str); +} + +/* ------------------------------------------------------------------------ */ +int _ned_tk_setup_special (NED_Widget *nw, int what, const char *str) +{ + char *s= (char *) 0; + + if (nw == (NED_Widget *) 0) return -1; + + if (str != (char *) 0) s= strdup (s); + + switch (what) + { + case NED_TK_CMD_MOUSE_B2: + nw->cmd_right_button= s; + break; + + case NED_TK_CMD_WINS: + nw->cmd_WINS= s; + break; + + case NED_TK_CMD_MENU: + nw->cmd_MENU= s; + break; + + default: + free_or_what (s); + return -1; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_window_dock ( +struct WINDOWCTRL *w1, +struct WINDOWCTRL *w2, +int pos) +{ + NED_Widget *nw1, *nw2; + Tk_Window tw1, tw2; + int x_p, y_p, x_w, y_w; + char buffer [80]; + + if (w1 == (struct WINDOWCTRL *) 0) w1= aw; + if (w1 == (struct WINDOWCTRL *) 0 + || w2 == (struct WINDOWCTRL *) 0 + || (nw1= w1->wc_widget) == (NED_Widget *) 0 + || (nw2= w2->wc_widget) == (NED_Widget *) 0 + || (tw1= nw1->tkwin) == (Tk_Window) 0 + ) return -1; + + switch (pos) + { + default: + x_p= Tk_X (tw1); + x_w= nw1->num_x_pixels; + y_w= 250; + y_p= Tk_Y (tw1) - y_w - 40; + break; + } + + if (y_p < 23) + { /* stacked window would be over the top => move lower down */ + sprintf (buffer, "wm geometry %s %dx%d+%d+%d\n", + nw1->window_path, x_w, nw1->num_y_pixels, x_p, + Tk_Y(tw1) - y_p + 23); + /*** printf ("0925: %s\n", buffer); ***/ + Tcl_Eval (nw1->interp, buffer); + y_p= 23; + } + + sprintf (buffer, "wm geometry %s %dx%d+%d+%d\n", + nw2->window_path, x_w, y_w, x_p, y_p); + /*** printf ("0925: %s\n", buffer); ***/ + Tcl_Eval (nw2->interp, buffer); + + return 0; +} diff --git a/app/ned/09/ned0926.c b/app/ned/09/ned0926.c new file mode 100644 index 0000000000000000000000000000000000000000..3891be71babd13928e5bad22b79cc9b8e52467f9 --- /dev/null +++ b/app/ned/09/ned0926.c @@ -0,0 +1,29 @@ +/* + * FILE %ned/09/ned0926.c + * + * NED's tk widget stuff + * + * written: 1995-09-25 + * latest update: 1997-10-26 10:24:05 + * $Id: ned0926.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tk.h> +#include <tcl.h> + +#include "ed.h" +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tk_create_widget ( +ClientData clientData, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + return _ned_tk_create_widget (clientData, interp, argc, argv, + (struct WINDOWCTRL *) 0 /* ###### */); +} diff --git a/app/ned/09/ned0927.c b/app/ned/09/ned0927.c new file mode 100644 index 0000000000000000000000000000000000000000..1c9beadd5692ff93b4d3f20589bbfb2aad475b80 --- /dev/null +++ b/app/ned/09/ned0927.c @@ -0,0 +1,91 @@ +/* + * FILE %ned/09/ned0927.c + * + * NED's tk widget stuff + * + * implements the NED widget command + * - description + * + * written: 1995-09-25 + * latest update: 1997-12-04 23:09:05 + * $Id: ned0927.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tk.h> +#include <tcl.h> + +#include "ed.h" +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +#ifdef __NOT_USED__ +... maybe ... +static Tk_ConfigSpec configSpecs [] = +{ + { TK_CONFIG_END, (char *) 0, (char *) 0, (char *) 0, (char *) 0, 0, 0 } +} ; +#endif /* __NOT_USED__ */ + +/* ------------------------------------------------------------------------ */ +int ned_tk_configure ( +Tcl_Interp *interp, +NED_Widget *nw, +int argc, +const char *argv [], +int flags) +{ + const char *str; + const char *par; + int geometry_changed= 0; + + if (interp == (Tcl_Interp *) 0 + || nw == (NED_Widget *) 0 + ) return TCL_ERROR; + + while (argc > 0) + { + str= *argv++; + argc--; + + if (argc <= 0) goto ERR; + par= *argv++; + argc--; + + if (strcmp (str, "-font") == 0) + { + if (ned_tk_set_font (nw, par) != 0) goto ERR; + geometry_changed= 1; + } + else + if (strcmp (str, "-cmd_button_2") == 0) + { + if (_ned_tk_setup_special (nw, NED_TK_CMD_MOUSE_B2, par) != 0) goto ERR; + } + else + if (strcmp (str, "-cmd_menu") == 0) + { + if (_ned_tk_setup_special (nw, NED_TK_CMD_MENU, par) != 0) goto ERR; + } + else + if (strcmp (str, "-cmd_wins") == 0) + { + if (_ned_tk_setup_special (nw, NED_TK_CMD_WINS, par) != 0) goto ERR; + } + else + { +ERR: + sprintf (interp->result, "illegal par or val '%s'", str); + return TCL_ERROR; + } + } + + if (TK_CONFIG_ARGV_ONLY && geometry_changed) + { + ned_tk_redraw_window (nw, 0, 0, nw->num_x_pixels, nw->num_y_pixels); + } + + return TCL_OK; +} diff --git a/app/ned/09/ned0928.c b/app/ned/09/ned0928.c new file mode 100644 index 0000000000000000000000000000000000000000..59bf126bc5bb4aaff32133be3e68d080fab36e59 --- /dev/null +++ b/app/ned/09/ned0928.c @@ -0,0 +1,53 @@ +/* + * FILE %ned/09/ned0928.c + * + * NED's tk widget stuff + * + * written: 1995-09-25 + * latest update: 1997-10-26 10:48:40 + * + */ + +#include <tk.h> +#include <tcl.h> + +#include <syslog.h> +#include "ed.h" +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int _ned_tk_destroy_widget (NED_Widget *nw) +{ + Tk_Window tkwin; + Display *disp; + int i; + + if (nw == (NED_Widget *) 0 + || (tkwin= nw->tkwin) == (Tk_Window) 0 + || (disp= nw->display) == (Display *) 0 + ) return -1; + + /* #### T2D @@@: Delete NED Widget, incomplete!! */ + Tk_FreeGC (disp, nw->normalTextGC); + Tk_FreeGC (disp, nw->cursedTextGC); + Tk_FreeGC (disp, nw->StatusLineGC); + Tk_FreeGC (disp, nw->markedTextGC); + Tk_FreeGC (disp, nw->selectedTextGC); + + for (i= nw->attrib_cnt-1; i >= 0; i--) + { + Tk_FreeGC (disp, nw->attrib_GC [i]); + } + nw->attrib_cnt= 0; + + Tk_DeleteEventHandler (tkwin, NED_WIDGET_EVENT_MASK, + ned_tk_event_procedure, (ClientData) nw); + + Tk_DestroyWindow (tkwin); + + /* T2D: destroy nw too ! (1996-07-21 16:37:28) */ + + return TCL_OK; +} diff --git a/app/ned/09/ned0929.c b/app/ned/09/ned0929.c new file mode 100644 index 0000000000000000000000000000000000000000..3524505f800c0acefdddf70115999c1cfe880e28 --- /dev/null +++ b/app/ned/09/ned0929.c @@ -0,0 +1,338 @@ +/* + * FILE %ned/09/ned0929.c + * + * NED's tk widget stuff + * + * implements the NED widget command + * - description + * + * written: 1995-09-25 + * latest update: 2001-02-11 16:49:49 + * $Id: ned0929.c,v 1.3 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tk.h> +#include <tcl.h> + +#include <syslog.h> +#include <gg/dpp.h> +#include <gg/strings.h> +#include "ed.h" +#include "edhyx.h" +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +static char *unknown= "<unknown>"; + + +/* ------------------------------------------------------------------------ */ +/* tcl syntax: <window_path> <method> <pars>* */ +int ned_tk_widget_cmd ( +ClientData clientData, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + NED_Widget *nw; /* current widget */ + struct WINDOWCTRL *w; /* current window */ + struct LINE *lp; + const char *sub_command; + char *res2; + long num; + long num_res; + char lval [40]; + + if ((nw= (NED_Widget *) clientData) == (NED_Widget *) 0 + || (w= nw->ned_window) == (struct WINDOWCTRL *) 0 + ) + return TCL_ERROR; + + if (argc <= 1 + || (sub_command= argv [1]) == (char *) 0 + || *sub_command == 0 + || abbrev ("path_name", sub_command, 4) + ) + { + interp->result= nw->window_path; + return TCL_OK; + } + + if (abbrev ("configure", sub_command, 4)) + return ned_tk_configure (nw->interp, nw, argc-2, argv+2, + TK_CONFIG_ARGV_ONLY); + + if (strcmp (sub_command, "line") == 0) + { + num_res= w->znr; + if (argc > 2 + && (num= get_parameter_value (argv [2])) >= 0 + ) + { + ned_jmp_2line_by_nr (w, (int) num, 3); + } + + goto NUM_RESULT; + } + + if (strcmp (sub_command, "ai") == 0) + { + num_res= w->ai; + if (argc > 2 + && (num= get_parameter_value (argv [2])) >= 0 + ) + { + w->ai= (int) num; + } + + goto NUM_RESULT; + } + + if (strcmp (sub_command, "ins") == 0) + { + num_res= w->ins_flg; + if (argc > 2 + && (num= get_parameter_value (argv [2])) >= 0 + ) + { + w->ins_flg= (int) num; + } + + goto NUM_RESULT; + } + + if (strcmp (sub_command, "wwc") == 0) + { + num_res= w->wwc; + if (argc > 2 + && (num= get_parameter_value (argv [2])) >= 0 + ) + { + w->wwc= (int) num; + } + + goto NUM_RESULT; + } + + if (strcmp (sub_command, "size") == 0 + || strcmp (sub_command, "tlines") == 0 + ) + { + num_res= (long) w->tlines; + goto NUM_RESULT; + } + + if (strcmp (sub_command, "hv") == 0) + { + num_res= (long) w->hv; + goto NUM_RESULT; + } + + if (strcmp (sub_command, "column") == 0) + { + num_res= (long) (aw->cx+aw->hv-aw->ax); + goto NUM_RESULT; + } + + if (strcmp (sub_command, "winnum") == 0) + { + num_res= (long) w->wc_window_number; + goto NUM_RESULT; + } + + if (strcmp (sub_command, "update") == 0) + { + num_res= (long) w->f_upd; + + if (argc > 2 + && (num= get_parameter_value (argv [2])) >= 0 + ) + w->f_upd= (int) num; + + goto NUM_RESULT; + } + + if (strcmp (sub_command, "taintlevel") == 0) + { + num_res= w->wc_taint_level; + + if (argc > 2 + && (num= get_parameter_value (argv [2])) >= 0 + ) + w->wc_taint_level= (int) num; + + goto NUM_RESULT; + } + + if (strcmp (sub_command, "format") == 0) + { + switch (w->file_format) + { + case FMT_BINARY: + res2= "binary"; + break; + case FMT_ASCII: + res2= "ascii"; + break; + case FMT_SGML: + res2= "sgml"; + break; + default: + res2= unknown; + break; + } + +STATIC_RESULT: + Tcl_SetResult (interp, res2, TCL_STATIC); + return TCL_OK; + } + + if (strcmp (sub_command, "type") == 0) + { + switch (w->file_type) + { + case FTY_PLAIN: + res2= "plain"; + break; + case FTY_HYPER: + res2= "hyper"; + break; + case FTY_FTRWDW: + res2= "ftrwdw"; + break; + default: + res2= unknown; + break; + } + + goto STATIC_RESULT; + } + + if (strcmp (sub_command, "active") == 0) + { + aw= w; + return TCL_OK; + } + + if (strcmp (sub_command, "file") == 0) + { + struct FILECTRL *fc; + res2= unknown; + + if (w->file_type == FTY_PLAIN + && (fc= (struct FILECTRL *) w->file_or_frame) != (struct FILECTRL *) 0 + ) + { + res2= fc->FC_fnm_txt; + } + goto VOLATILE_RESULT; + } + + if (strcmp (sub_command, "frame") == 0) + { + struct FRAMECTRL *fc; + res2= unknown; + + if (w->file_type == FTY_HYPER + && (fc= (struct FRAMECTRL *) w->file_or_frame) !=(struct FRAMECTRL *) 0 + ) + { + res2= fc->frame_name; + } + goto VOLATILE_RESULT; + } + + if (strcmp (sub_command, "cluster") == 0) + { + struct FRAMECTRL *fc; + struct CLUSTERCTRL *cc; + res2= unknown; + + if (w->file_type == FTY_HYPER + && (fc= (struct FRAMECTRL *) w->file_or_frame)!=(struct FRAMECTRL *) 0 + && (cc= fc->cluster) !=(struct CLUSTERCTRL *) 0 + ) + { + res2= cc->cluster_name_hyx; + } + goto VOLATILE_RESULT; + } + + if (strcmp (sub_command, "yview") == 0) + { + double fraction; + int lines; + int factor= 1; + int units; + int rc; + +/* ned_diag_argv (argc, argv); */ + lines= w->znr; + + if (argc < 3) + { + + num_res= (long) lines; + +NUM_RESULT: + sprintf (lval, "%ld", num_res); + res2= lval; + +VOLATILE_RESULT: + Tcl_SetResult (interp, res2, TCL_VOLATILE); + return TCL_OK; + } + + if (argc == 3) + { + units= (int) get_parameter_value (argv [2]); + goto SCROLL; + } + + rc= Tk_GetScrollInfo (interp, argc, argv, &fraction, &units); + + switch (rc) + { + case TK_SCROLL_MOVETO: + jmpline_relative (w, fraction); + return TCL_OK; + + case TK_SCROLL_PAGES: + factor= (w->by - 3); + + case TK_SCROLL_UNITS: +SCROLL: + lines += units*factor; + if (lines < 1) lines= 1; + ned_jmp_2line_by_nr (w, lines, 3); + return TCL_OK; + + case TK_SCROLL_ERROR: + return TCL_ERROR; + } + } + + if ((lp= w->WC_act) != (struct LINE *) 0) + { + char *cp; + + if (abbrev ("curline", sub_command, 4) + /* T2D: locate real line by displacement */ + && (cp= ned_line_2_string (lp, 0, lp, 32700, + (char *) 0, 0, 0L, 0)) != (char *) 0 + ) + { + Tcl_SetResult (interp, cp, TCL_DYNAMIC); + return TCL_OK; + } + else if (abbrev ("length", sub_command, 3)) + { + num_res= (long) lp->lng; + goto NUM_RESULT; + } + } + + return TCL_OK; +} diff --git a/app/ned/09/ned0929s.c b/app/ned/09/ned0929s.c new file mode 100644 index 0000000000000000000000000000000000000000..094650f09625ca0da9c3cefc547cea39c41e7e59 --- /dev/null +++ b/app/ned/09/ned0929s.c @@ -0,0 +1,63 @@ +/* + * FILE %ned/09/ned0929s.c + * + * written: 1996-07-22 + * latest update: 1996-10-29 16:32:34 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <tk.h> +#include <tcl.h> + +#include <stdio.h> +#include "ed.h" +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" +#include <gg/window.h> + +/* ------------------------------------------------------------------------ */ +int ned_tk_show_display_range (struct WINDOWCTRL *w) +{ + int xlines; /* Zahl der Zeilen im File */ + int first_line; /* Nummer der 1. Zeile am Schirm */ + int last_line; + double top, bottom; + char cmd_line [80]; + NED_Widget *nw; + + if (w == (struct WINDOWCTRL *) 0 + || (nw= w->wc_widget) == (NED_Widget *) 0 + ) return -1; + + xlines= w->tlines; + first_line= w->znr - w->cy; + if (xlines <= 0 || first_line > xlines) + { /* xlines unplausibel; fehlerhafte Berechnung??? */ + xlines= w->tlines= ned_cnt_total_lines (w->WC_act); + } + + last_line= first_line + w->by; + first_line += w->ay - 1; + + top= ((double) first_line) / ((double) xlines); + bottom= ((double) last_line) / ((double) xlines); + + sprintf (cmd_line, "%s.sb set %g %g", nw->window_path, top, bottom); +#ifdef DIAG +fprintf (stderr, + "ned0929s: first_line=%d xlines=%d last_line=%d\n", + first_line, xlines, last_line); +fprintf (stderr, + "ned0929s: cmd_line='%s'\n", + cmd_line); +#endif + + Tcl_Eval (nw->interp, cmd_line); + + return 0; +} diff --git a/app/ned/09/ned0930.c b/app/ned/09/ned0930.c new file mode 100644 index 0000000000000000000000000000000000000000..12f5feabd8781fa8c2014d9b52ae7ea84558e422 --- /dev/null +++ b/app/ned/09/ned0930.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/09/ned0930.c + * + * NED's tk widget stuff + * + * written: 1995-09-25 + * latest update: 1997-10-26 10:21:20 + * + */ + +#include <tk.h> +#include <tcl.h> + +#include <syslog.h> +#include "ed.h" +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void ned_tk_widget_delete (ClientData clientData) +{ + NED_Widget *nw= (NED_Widget *) clientData; + + _ned_tk_destroy_widget (nw); +} diff --git a/app/ned/09/ned0931.c b/app/ned/09/ned0931.c new file mode 100644 index 0000000000000000000000000000000000000000..6d3841d85796f29d2ced88262ae5361e9c8000a8 --- /dev/null +++ b/app/ned/09/ned0931.c @@ -0,0 +1,111 @@ +/* + * FILE %ned/09/ned0931.c + * + * NED's tk widget stuff + * + * written: 1995-09-25 + * latest update: 1999-07-17 17:18:05 + * + */ + + +#include <tk.h> +#include <tcl.h> +#include "ed.h" +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void ned_tk_event_procedure (ClientData clientData, XEvent *eventPtr) +{ + NED_Widget *nw; + + if ((nw= (NED_Widget *) clientData) == (NED_Widget *) 0) return; + aw= nw->ned_window; /* active window changes */ + + if (eventPtr->type == KeyPress) + { + NED_tk_key_pressed (clientData, eventPtr); + return; + } + + if (eventPtr->type == MapNotify) + { + ned_tk_redraw_window (nw, 0, 0, nw->num_x_pixels, nw->num_y_pixels); + return; + } + + if (eventPtr->type == DestroyNotify) + { + p_ssave (); /* save on close or setup... */ + return; + } + + if (eventPtr->type == Expose) + { + int pxa, pya, pxb, pyb; + + pxa= eventPtr->xexpose.x; + pya= eventPtr->xexpose.y; + pxb= eventPtr->xexpose.width + pxa; + pyb= eventPtr->xexpose.height + pya; + + ned_tk_redraw_window (nw, pxa, pya, pxb, pyb); + return; + } + + if (eventPtr->type == FocusIn) + { + setcup (aw); /* not even that should be necessary ... */ + return; + } + + if (eventPtr->type == ConfigureNotify) + { + nw->num_x_pixels= eventPtr->xconfigure.width; + nw->num_y_pixels= eventPtr->xconfigure.height; + aw->bx= ((nw->num_x_pixels - nw->num_x_pix_offset - nw->num_x_pix_extra) + / nw->char_width) -1; + aw->by= ((nw->num_y_pixels - nw->num_y_pix_offset - nw->num_y_pix_extra) + / nw->line_height) -1; + + ned_tk_set_geometry (nw); + ned_tk_redraw_window (nw, 0, 0, nw->num_x_pixels, nw->num_y_pixels); + return; + } + + if (eventPtr->type == MotionNotify + || eventPtr->type == ButtonPress + || eventPtr->type == ButtonRelease + ) + { + int t= 0; + int x, y; + int st; + + if (eventPtr->type == MotionNotify) + { + st= eventPtr->xmotion.state; + x= eventPtr->xmotion.x; + y= eventPtr->xmotion.y; + } + else + { + st= eventPtr->xbutton.state; + x= eventPtr->xbutton.x; + y= eventPtr->xbutton.y; + } + + if (st & Button1Mask) t |= 1; + if (st & Button2Mask) t |= 4; + if (st & Button3Mask) t |= 2; + + ned_mouse_event (ned_get_cx_pos (nw, x), ned_get_cy_pos (nw, y), t, + eventPtr->xbutton.x_root, eventPtr->xbutton.y_root); + + return; + } +} diff --git a/app/ned/09/ned0932.c b/app/ned/09/ned0932.c new file mode 100644 index 0000000000000000000000000000000000000000..deb1add99652cfc049c43f3a926541ee6851b512 --- /dev/null +++ b/app/ned/09/ned0932.c @@ -0,0 +1,117 @@ +/* + * FILE %ned/09/ned0932.c + * + * NED's tk widget stuff + * + * written: 1995-09-25 + * latest update: 1997-12-04 21:10:05 + * $Id: ned0932.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tk.h> +#include <tcl.h> + +#include <stdio.h> +#include "ed.h" +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tk_set_color ( +NED_Widget *nw, +GC *dGC, +int is_var, /* 1 -> colors are given as variable names */ +const char *fg_var, /* variable of name that contains forground */ +const char *bg_var) /* e.g. txt_fg and background color */ +{ + Tcl_Interp *interp; + Tk_Window new_win; + GC newGC; + XGCValues gcValues; + XColor *xc_background; + XColor *xc_foreground; + Tk_Uid fg; + Tk_Uid bg; + char *ned= "ned"; + int rc= 0; + + interp= nw->interp; + + if (is_var) + { + fg_var= Tcl_GetVar2 (interp, ned, fg_var, TCL_GLOBAL_ONLY); + bg_var= Tcl_GetVar2 (interp, ned, bg_var, TCL_GLOBAL_ONLY); + } + + if (fg_var == (char *) 0) { rc= 1; fg_var= "white"; /* @@@ T2D */ } + if (bg_var == (char *) 0) { rc= 1; bg_var= "red"; /* @@@ T2D */ } + + fg= Tk_GetUid (fg_var); + bg= Tk_GetUid (bg_var); + xc_foreground= Tk_GetColor (interp, new_win= nw->tkwin, fg); + xc_background= Tk_GetColor (interp, new_win, bg); + gcValues.font= Tk_FontId (nw->fontPtr); + gcValues.foreground= xc_foreground->pixel; + gcValues.background= xc_background->pixel; + + newGC= Tk_GetGC (new_win, GCForeground|GCBackground|GCFont, &gcValues); + + if (dGC != (GC *) 0) + { + if (*dGC != None && *dGC != (GC) 0) Tk_FreeGC (nw->display, *dGC); + *dGC= newGC; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +GC ned_tk_setup_GC (NED_Widget *nw, int a) +{ + int num; + int rc; + char fg_col [10]; + char bg_col [10]; + const char *fg, *bg; + Tcl_Interp *interp; + char *ned= "ned"; + + if (nw == (NED_Widget *) 0) return (GC) 0; + + if ((num= nw->attrib_cnt) >= NED_WIDGET_GC_CNT) + { + fprintf (stderr, + "note: setup_GC attrib table full for {fg,bg}_%03d\n", a); + return (GC) 0; + } + + interp= nw->interp; + + sprintf (fg_col, "fg_%03d", a); + if ((fg= Tcl_GetVar2 (interp, ned, fg_col, TCL_GLOBAL_ONLY)) == (char *) 0) + { + sprintf (fg_col, "col_%02d", a & 0x000F); + fg= Tcl_GetVar2 (interp, ned, fg_col, TCL_GLOBAL_ONLY); + } + + sprintf (bg_col, "bg_%03d", a); + if ((bg= Tcl_GetVar2 (interp, ned, bg_col, TCL_GLOBAL_ONLY)) == (char *) 0) + { + sprintf (bg_col, "col_%02d", (a >> 4) & 0x000F); + bg= Tcl_GetVar2 (interp, ned, bg_col, TCL_GLOBAL_ONLY); + } + + rc= ned_tk_set_color (nw, &nw->attrib_GC [num], 0, fg, bg); + nw->attrib_num [num]= a; + nw->attrib_cnt++; + + if (rc == 1) + { + fprintf (stderr, + "note: setup_GC no value found for {fg,bg}_%03d\n", a); + } + + return nw->attrib_GC [num]; +} diff --git a/app/ned/09/ned0933.c b/app/ned/09/ned0933.c new file mode 100644 index 0000000000000000000000000000000000000000..d2735510604ccfe07d1466ba39de03287caab4dd --- /dev/null +++ b/app/ned/09/ned0933.c @@ -0,0 +1,61 @@ +/* + * FILE %ned/09/ned0933.c + * + * NED's tk widget stuff + * + * written: 1995-09-25 + * latest update: 1997-06-13 13:18:32 + * + */ + +#include <tk.h> +#include <tcl.h> + +#include <syslog.h> +#include <stdio.h> +#include "ed.h" +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tk_redraw_window (NED_Widget *nw, int pxa, int pya, int pxb, int pyb) +{ + struct WINDOWCTRL *w; + int cya; + +#ifdef DEBUG + int cxa= ned_get_cx_pos (nw, pxa); + cya= ned_get_cy_pos (nw, pya); + int cxb= ned_get_cx_pos (nw, pxb); + int cyb= ned_get_cy_pos (nw, pyb); + +printf ("ned0933.c: nw=0x%08lX pxa=%d char_width=%d line_height=%d\n", + nw, pxa, nw->char_width, nw->line_height); + + printf ("cxa=%d cya=%d cxb=%d cyb=%d\n", cxa, cya, cxb, cyb); +#endif + + XFillRectangle (nw->display, Tk_WindowId (nw->tkwin), nw->cursedTextGC, + pxa, pya, pxb-pxa, pyb-pya); + + w= nw->ned_window; + wd_2setup (w, ned_get_cx_pos (nw, pxa), cya= ned_get_cy_pos (nw, pya), + ned_get_cx_pos (nw, pxb), ned_get_cy_pos (nw, pyb)); + + if (cya <= 2) ned_decorate_window (w); + + setcup (w); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_redraw_window2 (struct WINDOWCTRL *w) +{ + NED_Widget *nw; + + if ((nw= (NED_Widget *) w->wc_widget) == (NED_Widget *) 0) return -1; + + return ned_tk_redraw_window (nw, 0, 0, nw->num_x_pixels, nw->num_y_pixels); +} diff --git a/app/ned/09/ned0934.c b/app/ned/09/ned0934.c new file mode 100644 index 0000000000000000000000000000000000000000..9b1a5be7d3f0e33dda1f2c10d2c8c5df2ce89373 --- /dev/null +++ b/app/ned/09/ned0934.c @@ -0,0 +1,91 @@ +/* + * FILE %ned/09/ned0934.c + * + * NED's tk widget stuff + * handle the export of the selection + * + * written: 1995-11-08 + * latest update: 1998-08-16 12:33:16 + * $Id: ned0934.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#include <string.h> +#include <tk.h> +#include <tcl.h> +#include "ed.h" +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" +#include <X11/Xatom.h> + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_tk_exp_selection_procedure ( +ClientData clientData, +int offset, +char *buffer, +int maxBytes) +{ + NED_Widget *nw; + + /* NOTE: 1997-06-14 19:22:17: handling of offset/maxBytes seems to work */ + + ned_message_1 ("selection activated A"); + if ((nw= (NED_Widget *) clientData) == (NED_Widget *) 0 + || ned_block_2_string (buffer, + maxBytes+1, /* there is extra space for the 0-char */ + (long) offset, + 0x0001) == (char *) 0 + ) return -1; + + ned_message_1 ("selection activated B"); + + return strlen (buffer); +} + +/* ------------------------------------------------------------------------ */ +void ned_tk_lost_selection (ClientData cd) +{ + NED_Widget *nw; + + if ((nw= (NED_Widget *) cd) != (NED_Widget *) 0) /* ??? ****/ + { + nw->selection_active= 0; + ned_display_window (nw->ned_window); + } +} + +/* ------------------------------------------------------------------------ */ +int ned_tk_block_export_flag (int flag) +{ + NED_Widget *nw; + + if (aw == (struct WINDOWCTRL *) 0 + || (nw= (NED_Widget *) aw->wc_widget) == (NED_Widget *) 0 + ) return -1; + + switch (flag) + { + case 0: + nw->selection_active= 0; + Tk_ClearSelection (nw->tkwin, XA_PRIMARY); + return 0; + + case 1: + nw->selection_active= 1; + Tk_OwnSelection (nw->tkwin, XA_PRIMARY, ned_tk_lost_selection, + (ClientData) nw); + return 0; + + default: + return -1; + } +} + +/* ------------------------------------------------------------------------ */ +void ned_tk_claim_selection () +{ + ned_tk_block_export_flag (1); +} diff --git a/app/ned/09/ned0935.c b/app/ned/09/ned0935.c new file mode 100644 index 0000000000000000000000000000000000000000..0a58eb3e491746f9ee8656f04b2900871e071d84 --- /dev/null +++ b/app/ned/09/ned0935.c @@ -0,0 +1,31 @@ +/* + * FILE %ned/09/ned0935.c + * + * NED's tk widget stuff + * + * written: 1995-11-08 + * latest update: 1997-10-26 10:23:56 + * + */ + +#include <tk.h> +#include <tcl.h> +#include "ed.h" +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tk_imp_selection_procedure ( +ClientData clientData, +Tcl_Interp *interp, +char *buffer) +{ + NED_Widget *nw; + + if ((nw= (NED_Widget *) clientData) == (NED_Widget *) 0 + || ned_paste_string (buffer, 0, (char *) 0, (char *) 0) == -1 + ) return TCL_ERROR; + + return TCL_OK; +} diff --git a/app/ned/09/ned0936.c b/app/ned/09/ned0936.c new file mode 100644 index 0000000000000000000000000000000000000000..8fdb23b5c843a2221bf137862ec0e8895db9bcb8 --- /dev/null +++ b/app/ned/09/ned0936.c @@ -0,0 +1,87 @@ +/* + * FILE %ned/09/ned0936.c + * + * edit a file + * + * Docs: edit_file [-opts] [filename] + * + * written: 1995-11-27 + * latest update: 2001-02-11 21:28:19 + * $Id: ned0936.c,v 1.5 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include <stdlib.h> +#include <string.h> +#include <gg/filename.h> +#include <gg/strings.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +extern int ned_werr_dont_complain; + +/* ------------------------------------------------------------------------ */ +int ned_tcl_edit_file ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + int i; + int rc; + int flags= NED_OPENF_HISTORY|NED_OPENF_REDRAW; + char *fnm_allocated= (char *) 0; + const char *fnm= (char *) 0; + const char *arg; + const char *help_cluster= (char *) 0; + const char *help_frame= (char *) 0; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + if (strncmp (arg, "-cl", 3) == 0) help_cluster= arg + 3; else + if (strncmp (arg, "-fr", 3) == 0) help_frame= arg + 3; else + if (abbrev ("-nocomplain",arg, 5)) ned_werr_dont_complain= 1; else + if (abbrev ("-exists", arg, 2)) flags |= NED_OPENF_EXISTS; else + if (abbrev ("-nohistory", arg, 3)) flags ^= NED_OPENF_HISTORY; else + if (abbrev ("-prompt", arg, 2)) flags |= NED_OPENF_PROMPT; else + if (abbrev ("-norelativepath", arg, 5)) flags ^= NED_OPENF_NO_REL_PATH; else + if (abbrev ("-noctx", arg, 5)) flags ^= NED_OPENF_NO_REL_PATH; else + if (abbrev ("-sgml", arg, 3)) flags |= NED_OPENF_SGML; else + if (abbrev ("-ascii", arg, 3)) flags &= ~NED_OPENF_SGML; else + fnm= arg; + } + + if (fnm == (char *) 0) + { + if ((fnm_allocated= set_tmp_filename ((char *) 0, (char *) 0)) == (char *) 0) + { + interp->result= "no file specified"; + return TCL_ERROR; + } + fnm= (const char *) fnm_allocated; + } + + if (ned_open_file (fnm, help_cluster, help_frame, flags) == 0) + { + rc= TCL_OK; + } + else + { + interp->result= "could not edit"; + rc= TCL_ERROR; + } + + if (fnm_allocated != (char *) 0) free (fnm_allocated); + + return rc; +} diff --git a/app/ned/09/ned0937.c b/app/ned/09/ned0937.c new file mode 100644 index 0000000000000000000000000000000000000000..a873bb3616e03034234e326848a2b01a3d336d1f --- /dev/null +++ b/app/ned/09/ned0937.c @@ -0,0 +1,100 @@ +/* + * FILE %ned/09/ned0937.c + * + * edit a frame + * + * DOCU: edit_frame [-opts] [cluster [frame]*] + * + * no cluster name: %cl0 + * no frame name: $$root + * + * written: 1995-11-28 + * latest update: 1997-10-26 10:23:42 + * $Id: ned0937.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +extern char *default_template_frame; +extern char *default_undef_frame; +extern char *default_start_frame; +extern int ned_werr_dont_complain; + +/* ------------------------------------------------------------------------ */ +int ned_tcl_edit_frame ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + int i; + int frames_edited= 0; /* number of frames edited */ + int search_mode= 0x0002; + int format= FMT_SGML; + const char *arg; + const char *cluster_name= (char *) 0; + const char *template= (char *) 0; + const char *alternate= (char *) 0; + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + { + if (abbrev ("-global", arg, 3)) search_mode |= 0x0001; else + if (abbrev ("-exists", arg, 3)) search_mode ^= 0x0002; else + if (abbrev ("-nocomplain",arg, 5)) ned_werr_dont_complain= 1; else + if (strncmp ("-t", arg, 2) == 0) + { + template= arg + 2; + if (*template == 0) template= default_template_frame; + search_mode |= 0x0002; + } else + if (strncmp ("-a", arg, 2) == 0) + { + alternate= arg + 2; + if (*alternate == 0) alternate= default_undef_frame; + search_mode ^= 0x0002; + } + } + else + { + if (cluster_name == (char *) 0) cluster_name= arg; + else + { + if (ned_activate_cl_fr (cluster_name, arg, search_mode, format, + template, alternate) + == (struct FRAMECTRL *) 0) + { +ERROR: + interp->result= "could not edit"; + return TCL_ERROR; + } + + frames_edited++; + } + } + } + + if (!frames_edited + && ned_activate_cl_fr (cluster_name, default_start_frame, search_mode, + format, template, alternate) + == (struct FRAMECTRL *) 0 + ) goto ERROR; + + return TCL_OK; +} diff --git a/app/ned/09/ned0937b.c b/app/ned/09/ned0937b.c new file mode 100644 index 0000000000000000000000000000000000000000..d601d59f67371ebcb3dd74875b4f7f85708d8bab --- /dev/null +++ b/app/ned/09/ned0937b.c @@ -0,0 +1,46 @@ +/* + * FILE %ned/09/ned0937b.c + * + * edit a cross reference frame + * + * edit_crf keyword+ + * + * written: 1996-03-17 + * latest update: 1997-10-26 10:23:35 + * $Id: ned0937b.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tcl_edit_crf ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + int i; + const char *arg; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + for (i= 1; i < argc; i++) + { + if ((arg= argv [i]) == (char *) 0) continue; + + ned_cross_ref (arg, 0, CRF_IN_CRF, CRF_GLOBAL_AND_LOCAL, 1); + } + + return TCL_OK; +} diff --git a/app/ned/09/ned0938.c b/app/ned/09/ned0938.c new file mode 100644 index 0000000000000000000000000000000000000000..cb846725509498042e88c7287a45a1d5b8e601d8 --- /dev/null +++ b/app/ned/09/ned0938.c @@ -0,0 +1,89 @@ +/* + * FILE %ned/09/ned0938.c + * + * NED's tcl application initialization + * register Tcl variables and links to them + * see also: %ned/00/ned0011.c + * + * written: 1995-12-12 extracted from ned0923.c + * latest update: 1999-07-17 20:02:13 + * + */ + +#include <tcl.h> + +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +extern int ned_horizontal_scroll_count; +extern int ned_vertical_scroll_count; +extern int word_wrap_count; +extern int oper_level; + +extern char *default_cross_ref_template; +extern char *default_template_frame; +extern char *default_start_frame; +extern char *default_undef_frame; +extern char *default_cross_ref_prefix; +extern char *default_help_cluster; +extern char *default_help_open_file; +extern char *default_help_jump_to_line; +extern char *default_help_rename_frame; +extern char *default_help_cross_ref; + +#define LIV(n,v) Tcl_LinkVar (interp, n, (char *) &v, TCL_LINK_INT) +#define LSV(n,v) Tcl_LinkVar (interp, n, (char *) &v, TCL_LINK_STRING) +#define SV2(n,v) Tcl_SetVar2 (interp, ned, n, v, TCL_GLOBAL_ONLY); + +/* ------------------------------------------------------------------------ */ +int ned_tcl_preset (Tcl_Interp *interp, char *tcl_glib) +{ + char *ned= "ned"; + char *white= "white"; + char *gold1= "gold1"; + char *blue= "#3d3cca"; + char *black= "black"; + char *red= "red"; + char *green= "green"; + + /* setting up the default colors of a NED_Widget */ + /* setup default colors: */ + /* element color */ + SV2 ("fg_text", green); + SV2 ("bg_text", black); + SV2 ("fg_curs", black); + SV2 ("bg_curs", green); + SV2 ("fg_stat", black); + SV2 ("bg_stat", white); + SV2 ("fg_mark", gold1); + SV2 ("bg_mark", red); + SV2 ("fg_sel", gold1); + SV2 ("bg_sel", "orange"); + + SV2 ("fg_hidden", blue); + SV2 ("bg_hidden", black); + + SV2 ("font", "Rom11"); + SV2 ("glib", tcl_glib); + + /* linked integer variables */ + LIV ("ned_skip_horizontal", ned_horizontal_scroll_count); + LIV ("ned_skip_vertical", ned_vertical_scroll_count); + LIV ("ned_oper_level", oper_level); + LIV ("ned_ned_wrap_count", word_wrap_count); + + /* linked string variables */ + LSV ("ned_cross_ref_template", default_cross_ref_template); + LSV ("ned_template_frame", default_template_frame); + LSV ("ned_start_frame", default_start_frame); + LSV ("ned_undef_frame", default_undef_frame); + LSV ("ned_cross_ref_prefix", default_cross_ref_prefix); + LSV ("ned_help_cluster", default_help_cluster); + LSV ("ned_help_open_file", default_help_open_file); + LSV ("ned_help_jump_to_line", default_help_jump_to_line); + LSV ("ned_help_rename_frame", default_help_rename_frame); + LSV ("ned_help_cross_ref", default_help_cross_ref); + + return 0; +} diff --git a/app/ned/09/ned0939.c b/app/ned/09/ned0939.c new file mode 100644 index 0000000000000000000000000000000000000000..fcebab8fdfe7855c2d8600e9ced665baefb7f253 --- /dev/null +++ b/app/ned/09/ned0939.c @@ -0,0 +1,113 @@ +/* + * FILE %ned/09/ned0939.c + * + * ned application context handler + * + * <context> <subcommand> [-options] <pars>+ + * the main context is ned_main + * see description for more details + * + * written: 1995-12-12 + * latest update: 1997-08-04 8:16:31 + * + */ + +#include <tcl.h> + +#include <string.h> +#include <sys/utsname.h> +#include <gg/strings.h> +#include "ed.h" +#include "edtcl.h" +#ifdef USE_TK +#include <tk.h> +#include "edtk.h" +#endif /* USE_TK */ +#include "edctx.h" +#include "proto.h" + +extern char NED_VERSION []; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_tcl_context ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + struct NED_CONTEXT *ctx; + const char *sub_command; + + if ((ctx= (struct NED_CONTEXT *) client_data) == (struct NED_CONTEXT *) 0 + || argc <= 1 + || (sub_command= argv [1]) == (char *) 0 + || *sub_command == 0 + ) + return TCL_ERROR; + + if (strcmp ("sysname", sub_command) == 0) + { + struct utsname unm; + uname (&unm); + interp->result= unm.sysname; + return TCL_OK; + } + + if (strcmp ("machine", sub_command) == 0) + { + struct utsname unm; + uname (&unm); + interp->result= unm.machine; + + return TCL_OK; + } + + if (abbrev ("version", sub_command, 3)) + { + interp->result= NED_VERSION; + return TCL_OK; + } + + if (strcmp ("has_tk", sub_command) == 0) + { +#ifdef USE_TK + interp->result= "1"; +#else + interp->result= "0"; +#endif + return TCL_OK; + } + +#ifdef USE_TK + if (abbrev ("active", sub_command, 3)) + { + NED_Widget *nw; + if (aw == (struct WINDOWCTRL *) 0 + || (nw= aw->wc_widget) == (NED_Widget *) 0 + ) + interp->result= "NIL"; + else + interp->result= nw->window_path; + + return TCL_OK; + } +#endif /* USE_TK */ + + if (strcmp ("block", sub_command) == 0) + { + char *res2; + + if ((res2= ned_block_2_string ((char *) 0, 0, 0L, 0x0001)) == (char *) 0) + return TCL_ERROR; + + Tcl_SetResult (interp, res2, TCL_DYNAMIC); + return TCL_OK; + } + + if (ned_add_context_list (ctx, argv+1, argc-1)) return TCL_OK; + + interp->result= "unknown method"; + + return TCL_ERROR; +} diff --git a/app/ned/09/ned0940.c b/app/ned/09/ned0940.c new file mode 100644 index 0000000000000000000000000000000000000000..99812a835566cf281f1a6436f793f85047061204 --- /dev/null +++ b/app/ned/09/ned0940.c @@ -0,0 +1,50 @@ +/* + * FILE %ned/09/ned0940.c + * + * place a markup around a block + * + * set_markup <str> + * + * written: 1996-05-07 + * latest update: 1997-10-26 10:23:19 + * $Id: ned0940.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_tcl_set_markup ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc <= 1) + { + interp->result= "no tag given"; + return TCL_ERROR; + } + + if (ned_markup_block_2 (aw, argv [1]) != 0) + { + interp->result= "invalid tag given"; + return TCL_ERROR; + } + + return TCL_OK; +} diff --git a/app/ned/09/ned0941.c b/app/ned/09/ned0941.c new file mode 100644 index 0000000000000000000000000000000000000000..b76f73c821b81ab9f36c81d02711d6d0058b871c --- /dev/null +++ b/app/ned/09/ned0941.c @@ -0,0 +1,56 @@ +/* + * FILE %ned/09/ned0941.c + * + * paste one or more strings + * + * duco: paste_string [<-opts>|<str>]+ + * + * written: 1996-06-09 + * latest update: 1996-07-14 19:32:21 + * $Id: ned0941.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_tcl_paste_str ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + int i; + const char *arg; + int ai_mode= 0; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc <= 1) + { + interp->result= "no string given"; + return TCL_ERROR; + } + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + if (strcmp (arg, "-ai") == 0) ai_mode= wdw_off (aw); else + if (strcmp (arg, "-noai") == 0) ai_mode= 0; else + ned_paste_string (arg, ai_mode, (char *) 0, (char *) 0); + } + + return TCL_OK; +} diff --git a/app/ned/09/ned0942.c b/app/ned/09/ned0942.c new file mode 100644 index 0000000000000000000000000000000000000000..abc143b7ef828aab1ee19908f4f9f315f4e78232 --- /dev/null +++ b/app/ned/09/ned0942.c @@ -0,0 +1,81 @@ +/* + * FILE %ned/09/ned0942.c + * + * submit a macro + * + * submit_macro <str>+ + * + * written: 1996-06-09 + * latest update: 1996-12-12 21:02:53 + * $Id: ned0942.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tcl_submit_macro ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + int i; + int opts= 1; + const char *arg; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc <= 1) + { + interp->result= "no string given"; + return TCL_ERROR; + } + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + if (opts && *arg == '-') + { + if (strcmp (arg, "--") == 0) opts= 0; else + if (strcmp (arg, "-vi") == 0) + { + vi_on (); + } + else + if (strcmp (arg, "-ins") == 0) + { + vi_ins (); + } + else + if (strcmp (arg, "-VI") == 0) + { + vi_on (); + vi_mode (); + } + else + if (strcmp (arg, "-ws") == 0) + { + wordstar_mode (); + } + } + else + { + ned_submit_macro (arg); + } + } + + p_refresh (); + + return TCL_OK; +} diff --git a/app/ned/09/ned0943.c b/app/ned/09/ned0943.c new file mode 100644 index 0000000000000000000000000000000000000000..84bca1931d3d66c6d7f5917c935156bc8b88e28e --- /dev/null +++ b/app/ned/09/ned0943.c @@ -0,0 +1,42 @@ +/* + * FILE %ned/09/ned0943.c + * + * enter an entity + * + * enter_entity <str> + * + * written: 1996-06-09 + * latest update: 1996-07-14 10:43:51 + * $Id: ned0943.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tcl_enter_entity ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc <= 1) + { + interp->result= "no string given"; + return TCL_ERROR; + } + + ned_enter_entity (argv [1]); + + return TCL_OK; +} diff --git a/app/ned/09/ned0944.c b/app/ned/09/ned0944.c new file mode 100644 index 0000000000000000000000000000000000000000..adb7a4c0405358aac66eee8aa630e2da24341f2a --- /dev/null +++ b/app/ned/09/ned0944.c @@ -0,0 +1,44 @@ +/* + * FILE %ned/09/ned0944.c + * + * directly jump to a specified line + * + * jump_to_line <num> + * + * written: 1996-07-14 + * latest update: 1996-07-14 10:43:51 + * $Id: ned0944.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_tcl_jump_to_line ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc <= 1) + { + interp->result= "no line specified"; + return TCL_ERROR; + } + + ned_cb_jump_to_line (argv [1], (void *) aw); + + return TCL_OK; +} diff --git a/app/ned/09/ned0945.c b/app/ned/09/ned0945.c new file mode 100644 index 0000000000000000000000000000000000000000..ee8fce8e38cc25a7b742f8aba039c8e5cd16be48 --- /dev/null +++ b/app/ned/09/ned0945.c @@ -0,0 +1,44 @@ +/* + * FILE %ned/09/ned0945.c + * + * evaluate a tag + * + * tag <str> + * + * written: 1996-08-04 + * latest update: 1996-08-04 20:32:33 + * $Id: ned0945.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tcl_eval_tag ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + int i; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc <= 1) + { + interp->result= "no string given"; + return TCL_ERROR; + } + + for (i= 1; i < argc; i++) ex_tag_command (argv [i]); + + return TCL_OK; +} diff --git a/app/ned/09/ned0946.c b/app/ned/09/ned0946.c new file mode 100644 index 0000000000000000000000000000000000000000..7522893df6edd06808f2158e97b4300d3cea36d5 --- /dev/null +++ b/app/ned/09/ned0946.c @@ -0,0 +1,44 @@ +/* + * FILE %ned/09/ned0946.c + * + * set a marker + * + * set_marker <str> + * + * written: 1996-10-03 + * latest update: 1997-06-28 22:50:18 + * $Id: ned0946.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +int ned_tcl_set_marker ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc <= 1) + { + interp->result= "no string given"; + return TCL_ERROR; + } + + ned_set_marker (aw, argv [1][0]); + + return TCL_OK; +} diff --git a/app/ned/09/ned0946b.c b/app/ned/09/ned0946b.c new file mode 100644 index 0000000000000000000000000000000000000000..47f1f6e61675f84e24fe73421cb3978e83f64908 --- /dev/null +++ b/app/ned/09/ned0946b.c @@ -0,0 +1,110 @@ +/* + * FILE %ned/09/ned0946b.c + * + * activate a note + * + * note <area> [<topic>] + * + * written: 1998-08-18 + * latest update: 1998-08-18 15:42:31 + * $Id: ned0946b.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include <gg/strings.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +static int _get_topic_and_options ( +int argc, +const char *argv[], +const char **area, +const char **topic, +int *create_mode, +int *memorize) +{ + int cnt; + const char *arg; + + *area= *topic= (char*) 0; + *create_mode= *memorize= 0; + + for (cnt= 1; cnt < argc; cnt++) + { + arg= argv [cnt]; + if (arg [0] == '-') + { + if (abbrev ("-memorize", arg, 4) == 1) *memorize= 1; + else if (abbrev ("-create", arg, 3) == 1) *create_mode= 1; + else return -1; + } + else + { + if (*area == (char *) 0) *area= arg; + else if (*topic == (char *) 0) *topic= arg; + else return -1; + } + } + + return (*area == (char *) 0) ? -1 : 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_tcl_activate_note ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + const char *area, *topic; + int create_mode, memorize; + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (_get_topic_and_options (argc, argv, &area, &topic, + &create_mode, &memorize) != 0) + { + interp->result= "invalid arguments"; + return TCL_ERROR; + } + + ned_find_note_cluster (area, topic, create_mode, memorize); + + return TCL_OK; +} + +/* ------------------------------------------------------------------------ */ +int ned_tcl_define_note ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + const char *area, *topic; + int create_mode, memorize; + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (_get_topic_and_options (argc, argv, &area, &topic, + &create_mode, &memorize) != 0) + { + interp->result= "invalid arguments"; + return TCL_ERROR; + } + + ned_define_note_cluster (area, topic, create_mode, memorize); + + return TCL_OK; +} diff --git a/app/ned/09/ned0947.c b/app/ned/09/ned0947.c new file mode 100644 index 0000000000000000000000000000000000000000..941e02cafc73c8481ffc462398e07a6a582243ab --- /dev/null +++ b/app/ned/09/ned0947.c @@ -0,0 +1,61 @@ +/* + * FILE %ned/09/ned0947.c + * + * set_marker [-begin|-boln] <str> + * + * jump to named marker, + * if -begin is specified, jump to the first character at the + * begin of the line, not to the marker position itself + * if -boln is specified, jump to the begin of the line (column 0), + * not to the marker position itself + * + * written: 1996-10-03 + * latest update: 1996-10-03 10:52:09 + * $Id: ned0947.c,v 1.3 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#include <tcl.h> + +#include <gg/strings.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tcl_jmp_marker ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + const char *marker_name= (char *) 0; + const char *arg; + int boln= 0; + int i; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc <= 1) + { + interp->result= "no string given"; + return TCL_ERROR; + } + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (abbrev ("-begin", arg, 2)) boln= 1; + else if (abbrev ("-boln", arg, 2)) boln= 2; + else if (marker_name != (char *) 0) marker_name= arg; + } + + ned_jmp_marker (marker_name [0], boln); + + return TCL_OK; +} diff --git a/app/ned/09/ned0948.c b/app/ned/09/ned0948.c new file mode 100644 index 0000000000000000000000000000000000000000..37d460fc2320eb21e72b616ed8176bf7ac945188 --- /dev/null +++ b/app/ned/09/ned0948.c @@ -0,0 +1,64 @@ +/* + * FILE %ned/09/ned0948.c + * + * define a NED macro + * + * define_macro <num> <type> <str>+ + * + * written: 1996-11-03 + * latest update: 1996-11-03 18:27:27 + * $Id: ned0948.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include <stdio.h> +#include <gg/dpp.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tcl_mac_define ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + int i; + int mac_type; + long mac_num; + char mac_number [10]; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc <= 3) + { + interp->result= "no string given"; + return TCL_ERROR; + } + + mac_num= get_parameter_value (argv [1]); + switch (argv [2][0]) + { + case 't': case 'T': + mac_type= MPt_tcl; + break; + default: + mac_type= MPt_key_sequence; + break; + } + + for (i= 3; i < argc; i++) + { + sprintf (mac_number, "%ld", mac_num++); + mac_definition (mac_number, argv [i], mac_type); + } + + return TCL_OK; +} diff --git a/app/ned/09/ned0949.c b/app/ned/09/ned0949.c new file mode 100644 index 0000000000000000000000000000000000000000..09a7fc1c78e51a2d8423eb258fb25fd878138f79 --- /dev/null +++ b/app/ned/09/ned0949.c @@ -0,0 +1,46 @@ +/* + * FILE %ned/09/ned0949.c + * + * store something in the feature cache + * + * define_feature <name> <type> <str> + * + * written: 1996-11-03 + * latest update: 1996-11-10 13:32:23 + * $Id: ned0949.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include <stdio.h> +#include <gg/dpp.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tcl_define_feature ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc <= 3) + { + interp->result= "not enough parameters"; + return TCL_ERROR; + } + + ned_store_feature_cache (PAR (token, argv [1]), + PAR (feature_string, argv [3]), + PAR (feature_type, argv [2])); + + return TCL_OK; +} diff --git a/app/ned/09/ned0950.c b/app/ned/09/ned0950.c new file mode 100644 index 0000000000000000000000000000000000000000..87021c87456e0d4825d1e930671899764c80e7b7 --- /dev/null +++ b/app/ned/09/ned0950.c @@ -0,0 +1,91 @@ +/* + * FILE %ned/09/ned0950.c + * + * register a tagging rule + * + * register_tag_rule type rule_proc + * rule_proc string + * + * written: 1996-11-10 + * latest update: 1999-04-25 16:35:17 + * $Id: ned0950.c,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <tcl.h> +#include "ed.h" +#include "edctx.h" +#include "edtcl.h" +#include "proto.h" + +extern struct NED_CONTEXT *ned_main_context; + +/* ------------------------------------------------------------------------ */ +struct XYZ +{ + Tcl_Interp *interp; + char *type; + char *cmd; +} ; + +/* ------------------------------------------------------------------------ */ +int ned_tcl_cb_tag_rule ( /* tagging rule call back */ +const char *dir_path, +char **res_string, +char **res_type, +void *client_data) +{ + struct XYZ *xyz; + char *res; + Tcl_Interp *interp; + + if ((xyz= (struct XYZ *) client_data) == (struct XYZ *) 0 + || (interp= xyz->interp) == (Tcl_Interp *) 0 + || xyz->cmd == (char *) 0 + || Tcl_VarEval (interp, xyz->cmd, " ", dir_path, (char *) 0) != TCL_OK + || (res= interp->result) == (char *) 0 + || *res == 0 + ) return 0; + + *res_string= strdup (interp->result); + *res_type= strdup (xyz->type); + + return 1; +} + +/* ------------------------------------------------------------------------ */ +int ned_tcl_reg_tag_rule ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ + struct XYZ *xyz; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0 + || argc != 3 + || (xyz= (struct XYZ *) calloc (sizeof (struct XYZ), 1)) + == (struct XYZ *) 0 + ) + return TCL_ERROR; + + xyz->interp= interp; + xyz->type= strdup (argv [1]); + xyz->cmd= strdup (argv [2]); + + if (ned_add_tag_rule (ned_main_context, argv [2], + ned_tcl_cb_tag_rule, (void *) xyz) != 0) + return TCL_ERROR; + + return TCL_OK; +} diff --git a/app/ned/09/ned0951a.c b/app/ned/09/ned0951a.c new file mode 100644 index 0000000000000000000000000000000000000000..d17758acb3e8396381b72667bd3db330e73b8ecd --- /dev/null +++ b/app/ned/09/ned0951a.c @@ -0,0 +1,42 @@ +/* + * FILE %ned/09/ned0951a.c + * + * define_abbrev <lhs> <rhs> + * + * written: 1997-02-08 + * latest update: 1997-02-08 21:56:29 + * $Id: ned0951a.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include <stdio.h> +#include <gg/dpp.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tcl_def_abbrev ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc <= 2) + { + interp->result= "not enough parameters"; + return TCL_ERROR; + } + + ned_define_abbrev (argv [1], argv [2]); + + return TCL_OK; +} diff --git a/app/ned/09/ned0951b.c b/app/ned/09/ned0951b.c new file mode 100644 index 0000000000000000000000000000000000000000..402d1f1ae04b61069c7aa29862cdad51d9704c54 --- /dev/null +++ b/app/ned/09/ned0951b.c @@ -0,0 +1,42 @@ +/* + * FILE %ned/09/ned0951b.c + * + * define_abbrev <lhs> <rhs> + * + * written: 1997-02-08 + * latest update: 1997-02-08 21:56:29 + * $Id: ned0951b.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#include <tcl.h> + +#include <stdio.h> +#include <gg/dpp.h> +#include "ed.h" +#include "edtcl.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_tcl_undef_abbrev ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +const char *argv []) +{ +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc <= 1) + { + interp->result= "not enough parameters"; + return TCL_ERROR; + } + + ned_undefine_abbrev (argv [1]); + + return TCL_OK; +} diff --git a/app/ned/09/ned0972.c b/app/ned/09/ned0972.c new file mode 100644 index 0000000000000000000000000000000000000000..d9d9c592eb8973402cb8a47af28b22115836e89c --- /dev/null +++ b/app/ned/09/ned0972.c @@ -0,0 +1,69 @@ +/* + * FILE %ned/09/ned0972.c + * + * Operationen mit dem SETUP-File + * o Installation von Tastenkommandos + * o Installation von Makros + * o Installation von Maus Menu Eintraegen + * Makroprozessor + * Jour File Prozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * 1991 05 26: Revision + * latest update: 1997-10-26 10:46:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dpp.h> +#include "ed.h" +#include "message.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_mac_define () +{ + int mac_type= MPt_key_sequence; +#define NUM_TOKEN_SIZE 10 +#define CMD_SIZE 84 + char num_token [NUM_TOKEN_SIZE]; + char token [CMD_SIZE]; + + num_token [0]= 0; + if (rd_str (QST_MAC_NUM, num_token, NUM_TOKEN_SIZE) == -1) return; + +#ifdef USE_TCL + /* TCL_MACROS: Prompt user if the macro should be defined as tcl string. */ + /* see: NED tcl macros for more information about this stuff. */ + + token [0]= 0; + if (rd_str (QST_MAC_TYPE, token, CMD_SIZE) == -1) return; + switch (token [0]) + { + case 't': case 'T': + mac_type= MPt_tcl; + break; + default: + mac_type= MPt_key_sequence; + break; + } +#endif /* USE_TCL */ + + token [0]= 0; + if (rd_str (QST_MAC_TXT, token, CMD_SIZE) == -1) return; + + mac_definition (num_token, token, mac_type); + +#ifdef __OLD__ /* 1996-11-03 18:03:51 */ + int mac_num; + int mac_siz; + mac_num= (int) get_parameter_value (num_token); + mac_siz= trans_str (token, token, CMD_SIZE); + mac_undef (mac_num); + mac_define (mac_num, mac_type, token, mac_siz); +#endif +} diff --git a/app/ned/09/ned0973.c b/app/ned/09/ned0973.c new file mode 100644 index 0000000000000000000000000000000000000000..f2bcb4235c618482b4eb1ee9c07cd1e7370021f7 --- /dev/null +++ b/app/ned/09/ned0973.c @@ -0,0 +1,45 @@ +/* + * FILE %ned/09/ned0973.c + * + * clear out all macros from the table + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1999-04-25 16:35:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/strings.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +extern struct NED_CONTEXT *ned_main_context; + +/* ------------------------------------------------------------------------ */ +int mac_clr () +{ + struct NED_MACRO *mp; + int i; + + if (ned_main_context == (struct NED_CONTEXT *) 0) return -1; + + for (i= 0; i < N_MACRO; i++) + { + if ((mp= ned_main_context->NED_macro_table [i]) + != (struct NED_MACRO *) 0 + ) + { + free_or_what (mp->NED_mac_contents); + free (mp); + ned_main_context->NED_macro_table [i]= (struct NED_MACRO *) 0; + } + } + + return 0; +} diff --git a/app/ned/09/ned0974.c b/app/ned/09/ned0974.c new file mode 100644 index 0000000000000000000000000000000000000000..b70450d3a5281ea6a48a99eae1f03c64dbda3638 --- /dev/null +++ b/app/ned/09/ned0974.c @@ -0,0 +1,40 @@ +/* + * FILE %ned/09/ned0974.c + * + * Makroprozessor + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1999-04-25 16:36:04 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/strings.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +extern struct NED_CONTEXT *ned_main_context; + +/* ------------------------------------------------------------------------ */ +int mac_undef (int num) +{ + struct NED_MACRO *mp; + + if (num < 0 || num >= N_MACRO + || ned_main_context == (struct NED_CONTEXT *) 0 + || (mp= ned_main_context->NED_macro_table [num]) + == (struct NED_MACRO *) 0 + ) return -1; + + free_or_what (mp->NED_mac_contents); + free (mp); + ned_main_context->NED_macro_table [num]= (struct NED_MACRO *) 0; + + return 0; +} diff --git a/app/ned/09/ned0975.c b/app/ned/09/ned0975.c new file mode 100644 index 0000000000000000000000000000000000000000..3b2b924bd50b4339195b4d14de8a42643049e6d4 --- /dev/null +++ b/app/ned/09/ned0975.c @@ -0,0 +1,52 @@ +/* + * FILE %ned/09/ned0975.c + * + * makroprocessor: transfer a string into the macro buffer + * + * written: 1987 09 10 + * 1989 04 23: Maus Menue Setup + * latest update: 1999-04-25 16:36:10 + * $Id: ned0975.c,v 1.3 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +extern struct NED_CONTEXT *ned_main_context; + +/* ------------------------------------------------------------------------ */ +int mac_define (int num, int macro_type, const char *str, int lng) +{ + struct NED_MACRO *mp; + + if (num < 0 || num >= N_MACRO + || lng <= 0 + || ned_main_context == (struct NED_CONTEXT *) 0 + ) return -1; + + if ((mp= ned_main_context->NED_macro_table [num]) == (struct NED_MACRO *) 0) + { /* macro position not defined yet, do it now... */ + if ((mp= (struct NED_MACRO *) calloc (sizeof (struct NED_MACRO), 1)) + == (struct NED_MACRO *) 0) return -1; + + ned_main_context->NED_macro_table [num]= mp; + } + + /* drop old contents, if any */ + free_or_what (mp->NED_mac_contents); + + /* setup new contents */ + mp->NED_mac_contents= strdup (str); + mp->NED_mac_type= macro_type; + + return 0; +} diff --git a/app/ned/09/ned0976.c b/app/ned/09/ned0976.c new file mode 100644 index 0000000000000000000000000000000000000000..39c72fadc2ec438a2ac22c68463adb5b752946da --- /dev/null +++ b/app/ned/09/ned0976.c @@ -0,0 +1,39 @@ +/* + * FILE %ned/09/ned0976.c + * + * submit a macro string + * + * written: 1994-02-06 + * latest update: 1996-07-11 18:32:32 + * $Id: ned0976.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_submit_macro (const char *s) +{ + int mac_siz; +#ifdef MSDOS +#define CMD_SIZE 76 +#else +#define CMD_SIZE 1024 +#endif + char token [CMD_SIZE+2]; + + /* TCL_MACROS: an alternative function should submit a tcl function. */ + /* see: NED tcl macros for more information about this stuff. */ + + mac_siz= trans_str (s, token, CMD_SIZE); + mac_undef (MACRO_SUBMIT); + mac_define (MACRO_SUBMIT, MPt_key_sequence, token, mac_siz); + p_macro (MACRO_SUBMIT); + + return 0; +} diff --git a/app/ned/09/ned0977.c b/app/ned/09/ned0977.c new file mode 100644 index 0000000000000000000000000000000000000000..fdc19259503801e79dfdbcd8ddb0ddf2a887fb69 --- /dev/null +++ b/app/ned/09/ned0977.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/09/ned0977.c + * + * parse a macro definition string + * + * written: 1994-08-14: extracted from %ned/08/ned0908.c + * latest update: 1996-01-31 22:23:41 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int mac_parse (char *tokens, int mac_type) +{ + char *token [2]; + int n_tokens; + + if ((n_tokens= isolate_tokens (tokens, token, 2)) < 2) return -1; + return mac_definition (token [0], token [1], mac_type); +} diff --git a/app/ned/09/ned0978.c b/app/ned/09/ned0978.c new file mode 100644 index 0000000000000000000000000000000000000000..d5e79bf79273720e375f8afa9e263a96c48841aa --- /dev/null +++ b/app/ned/09/ned0978.c @@ -0,0 +1,47 @@ +/* + * FILE %ned/09/ned0978.c + * + * parse a macro definition string + * + * written: 1994-08-14: extracted from %ned/08/ned0908.c + * latest update: 1999-04-25 16:36:14 + * $Id: ned0978.c,v 1.4 2006/04/09 08:10:24 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int mac_definition (char *tok_num, const char *tok_text, int mac_type) +{ + int mac_num; + int mac_siz; + char *tmp= (char *) 0; + + mac_num= (int) get_parameter_value (tok_num); + if (mac_num < 0 || mac_num >= N_MACRO) return -1; + + if (mac_type == MPt_key_sequence) + { + tmp= malloc (strlen (tok_text)); + mac_siz= trans_str (tok_text, tmp, 9999); + tok_text= tmp; + } + else mac_siz= 1; /* dummy number, not really used */ + + mac_undef (mac_num); + mac_define (mac_num, mac_type, tok_text, mac_siz); + + free_or_what (tmp); + + return 0; +} diff --git a/app/ned/09/ned0979.c b/app/ned/09/ned0979.c new file mode 100644 index 0000000000000000000000000000000000000000..446fe203ca6f6d16055422de68e23224cb079d86 --- /dev/null +++ b/app/ned/09/ned0979.c @@ -0,0 +1,73 @@ +/* + * FILE %ned/09/ned0979.c + * + * universal macro binding + * currently not really used ... + * + * written: 1994-08-21 + * latest update: 1999-04-25 16:36:21 + * $Id: ned0979.c,v 1.3 2001/04/01 22:45:04 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/dpp.h> +#include <gg/ytree.h> +#include "ed.h" +#include "proto.h" + +extern int ptbl_offset; + +static struct YTREE *mb_table= (struct YTREE *) 0; + +/* ------------------------------------------------------------------------ */ +void p_mac () +{ + int num= -1; + unsigned char tbl_off [6]; + + long_to_hex ((long) ptbl_offset, (char *) tbl_off); +/************************ T2D */ + { + char xline [80]; + sprintf (xline, "[ptbl_offset=0x%s]", tbl_off); + ned_message_1 (xline); + } +/*****************************/ + + if ((num= (int) ytree_get_value (mb_table, tbl_off)) != 0) + p_macro (num); +} + +/* ------------------------------------------------------------------------ */ +int mac_bind (int n_ptbl_offset, int num) +{ + unsigned char tbl_off [6]; + + long_to_hex ((long) n_ptbl_offset, (char *) tbl_off); + ytree_set_value (&mb_table, tbl_off, (long) num); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int mac_unbind (int n_ptbl_offset) +{ + unsigned char tbl_off [6]; + + long_to_hex ((long) n_ptbl_offset, (char *) tbl_off); + + if (n_ptbl_offset == -1) /* delete all bindings! */ + { + ytree_free (mb_table); + mb_table= (struct YTREE *) 0; + } + else + ytree_delete_word (&mb_table, tbl_off); + + return 0; +} diff --git a/app/ned/09/ned0980.c b/app/ned/09/ned0980.c new file mode 100644 index 0000000000000000000000000000000000000000..bb8007c7a5020d2442fdf6fadbd3ecc47fef023d --- /dev/null +++ b/app/ned/09/ned0980.c @@ -0,0 +1,51 @@ +/* + * FILE %ned/09/ned0980.c + * + * dump the macro buffer + * + * written: 1987 04 08 + * latest update: 1996-02-01 10:45:05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dirty.h> +#include "ed.h" +#include "proto.h" + +#ifdef __JUNK__ /* 1996-02-01 10:44:48 */ +extern char MP []; +extern int MPo []; +extern int MPs []; +extern int MPwp; +#endif /* __JUNK__ 1996-02-01 10:44:48 */ + +/* ------------------------------------------------------------------------ */ +void p_dump_macro () +{ +#ifdef __JUNK__ /* 1996-02-01 10:44:48 */ + FILE *f; + struct NED_MACRO *mp; + int i, j; + + if ((f= fopen ("MACRO.$$$", "w")) == (FILE *) 0) return; + + dump (f, MP, MPwp); + + for (i= 0; i < N_MACRO; i++) + { + mp= ned_main_context->NED_macro_table [i]; ... + fprintf (f, "macro [%2d]: off=%4d lng=%4d\n", + i, MPo [i], MPs [i]); + for (j= 0; j < MPs [i]; j++) + fprintf (f, "%02x ", MP [MPo[i]+j] & 0xFF); + fprintf (f, "\n"); + } + + fclose (f); +#endif /* __JUNK__ 1996-02-01 10:44:48 */ +} diff --git a/app/ned/09/ned0981.c b/app/ned/09/ned0981.c new file mode 100644 index 0000000000000000000000000000000000000000..03337625b183eb430ad0dffed455746aabd5c9b3 --- /dev/null +++ b/app/ned/09/ned0981.c @@ -0,0 +1,49 @@ +/* + * FILE %ned/09/ned0981.c + * + * read various attributes + * + * called by ned0903.c ned_read_setup (char *fn) + * + * written: 1994-05-09 + * latest update: 1997-10-26 10:48:29 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern int COL_BLOCK; + +/* ------------------------------------------------------------------------ */ +int stp_attr (FILE *fi, char *b, int max_b) +{ + int rc; + char *w2; + long p2; + + for (;;) + { + b[0]= 0; + rc= fread_line (fi, b, max_b); + if (rc <= 0 && feof (fi)) break; + if (b[0] == '@') break; + + w2= locate_word (b, 1); + p2= (w2 != (char *) 0) ? get_parameter_value (w2) : 0L; + + if (strncmp (b, "COL_BLOCK", 9) == 0) COL_BLOCK= (int) p2; + if (strncmp (b, "CURSOR", 6) == 0) w_cursorsize (0x06, (int) p2); + } + return 0; +} diff --git a/app/ned/10/(dirinf).fm b/app/ned/10/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..cb902175984d4b13c627a9dfa5e960a84290e3a7 --- /dev/null +++ b/app/ned/10/(dirinf).fm @@ -0,0 +1,32 @@ +# +# FILE %ned/10/(dirinf).fm +# +# written: 1990 01 20 +# latest update: 2000-08-24 14:49:10 +# $Id: (dirinf).fm,v 1.2 2000/08/24 15:10:19 gonter Exp $ +# + +Makefile | current makefile +make-c5 | MSDOS makefile + +ned1001.c | int check_maus () +ned1002.c | void look1_for_maus () +ned1003.c | void look2_for_maus () +ned1004.c | void maus_wdw (int where) /* Gr�sse des aktuellen Windows �ndern */ +ned1005.c | void p_menue () /* Menueleiste(n) aktivieren */ +ned1006.c | void maus_menue (int mode) /* Menueleiste(n) aktivieren */ +ned1007.c | q_window_menu () /* Menue der Windows */ +ned1008.c | p_window_menu () /* Menue der Windows */ +ned1009.c | show_buttons () +ned1010.c | int test_maus (int left, int right, int left_right) +ned1011.c | int rst_button () +ned1012.c | int stp_button (FILE *fi, char *str) +ned1013.c | int def_button (int bdx, int bdy, int bdc, int bdm, int bdi) +ned1014.c | struct BUTTON_DESCRIPTOR *locate_button (...); +ned1015.c | int execute_mm_item (long fc); +ned1016.c | int stp_mm_item (FILE *fi, char *str); +ned1017.c | int ned_mouse_set_cursor (int x, int y, int t); +ned1018.c | int ned_mouse_event (int x, int y, int t) +ned1019.c | int ned_search_button_bar (int x, int y, int t) + +* | diff --git a/app/ned/10/Makefile b/app/ned/10/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..e9eeeacf10b2ed18aba7b0a187b640da232ae0ec --- /dev/null +++ b/app/ned/10/Makefile @@ -0,0 +1,67 @@ +# +# FILE %ned/10/make-ux +# +# written: 1990 01 20 +# latest update: 2000-08-24 14:49:19 +# $Id: Makefile,v 1.4 2000/08/24 15:10:19 gonter Exp $ +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-c -g -I.. $(cf) +CC=cc +objs=ned1001.o ned1002.o ned1003.o ned1004.o ned1005.o \ + ned1006.o ned1008.o ned1010.o \ + ned1011.o ned1012.o ned1013.o ned1014.o ned1015.o \ + ned1016.o +objs_cur= ned1007_cur.o ned1009_cur.o ned1017_cur.o ned1018_cur.o ned1019_cur.o +objs_tk= ned1007_tk.o ned1009_tk.o ned1017_tk.o ned1018_tk.o ned1019_tk.o + +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_tk lib_cur +clean : + rm -f *.o lib_cur lib_tk + +lib_tk : $(objs_tk) $(objs) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h ../edhyx.h + $(CC) $(OPTS) -c $*.c + +# --- cur Modules ---------- +ned1007_cur.o : ../ed.h ned1007.c + $(CC) $(OPTS) -o ned1007_cur.o ned1007.c + +ned1009_cur.o : ../ed.h ned1009.c + $(CC) $(OPTS) -o ned1009_cur.o ned1009.c + +ned1017_cur.o : ../ed.h ned1017.c + $(CC) $(OPTS) -o ned1017_cur.o ned1017.c + +ned1018_cur.o : ../ed.h ned1018.c + $(CC) $(OPTS) -o ned1018_cur.o ned1018.c + +ned1019_cur.o : ../ed.h ned1019.c + $(CC) $(OPTS) -o ned1019_cur.o ned1019.c + +# --- tk Modules ---------- +ned1007_tk.o : ../ed.h ned1007.c + $(CC) $(OPTS) -DUSE_TK -o ned1007_tk.o ned1007.c + +ned1009_tk.o : ../ed.h ned1009.c + $(CC) $(OPTS) -DUSE_TK -o ned1009_tk.o ned1009.c + +ned1017_tk.o : ../ed.h ned1017.c + $(CC) $(OPTS) -DUSE_TK -o ned1017_tk.o ned1017.c + +ned1018_tk.o : ../ed.h ned1018.c + $(CC) $(OPTS) -DUSE_TK -o ned1018_tk.o ned1018.c + +ned1019_tk.o : ../ed.h ned1019.c + $(CC) $(OPTS) -DUSE_TK -o ned1019_tk.o ned1019.c diff --git a/app/ned/10/contrib b/app/ned/10/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/10/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/10/gg b/app/ned/10/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/10/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/10/lib_cur b/app/ned/10/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/10/lib_tk b/app/ned/10/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/10/make-dos b/app/ned/10/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..c37d2dda0032a39dbb00bbd6082c5554da44e629 --- /dev/null +++ b/app/ned/10/make-dos @@ -0,0 +1,22 @@ +# +# FILE %ned/10/makefile +# +# written: 1990 01 20 +# latest update: 1996-05-27 11:09:48 +# +# ============================================================================ +cc=cl -Os -AL /c +ccc=cl -Os -AL /W3 /Fo$@ -I.. /c +obj=objdec -m0 -w -d -sl 2 NED10_TEXT $@ + +lib : ! + ned1001.obj ned1002.obj ned1003.obj ned1004.obj ! + ned1005.obj ned1006.obj ned1007.obj ned1008.obj ! + ned1009.obj ned1010.obj ned1011.obj ned1012.obj ! + ned1013.obj ned1014.obj ned1015.obj ned1016.obj ! + ned1017.obj ned1018.obj ned1019.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $*.c + $(obj) diff --git a/app/ned/10/ned1001.c b/app/ned/10/ned1001.c new file mode 100644 index 0000000000000000000000000000000000000000..16d50323a8c49a3c052e85f97e6b0e2e7ee5d693 --- /dev/null +++ b/app/ned/10/ned1001.c @@ -0,0 +1,61 @@ +/* + * FILE %ned/10/ned1001.c + * + * Maus Steuerung + * + * written: 1988 09 04 + * 1990 01 20: Modularisierung + * 1991 02 03: Revision + * 1991 05 27: Revision + * latest update: 1997-10-26 10:22:50 + * $Id: ned1001.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include <gg/maus.h> +#include <gg/keys.h> +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +extern int W_TEXT_CELL_X; /* Bildschirmgroesse */ +extern int W_TEXT_CELL_Y; + +extern int MPflag; /* Makro Prozessor Flag */ +extern int maus_angeschlossen; +extern int jou_flag; +extern ned_input_handler *nextchar; + +/* ------------------------------------------------------------------------ */ +int ned_check_mouse () +{ + int x, y, t; + + if (!maus_angeschlossen) return (*nextchar) (); + + for (;;) + { + if (kbhit () || jou_flag == 2 || MPflag) + { + maus_disable (); + return (*nextchar) (); + } + + maus_position (&x, &y, &t); + x /= W_TEXT_CELL_X; + y /= W_TEXT_CELL_Y; + + switch (ned_mouse_event (x, y, t, 0, 0)) + { + case 1: + case 2: return -1; + } + } + + return -1; +} diff --git a/app/ned/10/ned1002.c b/app/ned/10/ned1002.c new file mode 100644 index 0000000000000000000000000000000000000000..af58c9175c06d5970bb19a810eb72acbd7e7f1b7 --- /dev/null +++ b/app/ned/10/ned1002.c @@ -0,0 +1,41 @@ +/* + * FILE ~/usr/ned/10/ned1002.c + * + * Maus Steuerung + * + * written: 1988 09 04 + * 1990 01 20: Modularisierung + * 1991 02 03: Revision + * 1991 05 27: Revision + * latest update: 1994-07-09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include <gg/maus.h> +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +extern int maus_angeschlossen; +extern int W_TEXT_CELL_X; +extern int W_TEXT_CELL_Y; +extern int W_TEXT_MAX_X; +extern int W_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +void look1_for_maus () +{ + maus_setup (); + maus_angeschlossen= maus_reset (); + if (maus_angeschlossen == -1) maus_angeschlossen = 0; + else + { + maus_set_y_margins (0, W_TEXT_MAX_Y*W_TEXT_CELL_Y-1); + maus_set_x_margins (0, W_TEXT_MAX_X*W_TEXT_CELL_X-1); + } +} diff --git a/app/ned/10/ned1003.c b/app/ned/10/ned1003.c new file mode 100644 index 0000000000000000000000000000000000000000..9fd823dc86ff1c3a1b802225065c3a1da9509a8c --- /dev/null +++ b/app/ned/10/ned1003.c @@ -0,0 +1,32 @@ +/* + * FILE ~/usr/ned/10/ned1003.c + * + * Maus Steuerung + * + * written: 1988 09 04 + * 1990 01 20: Modularisierung + * 1991 02 03: Revision + * 1991 05 27: Revision + * latest update: 1994-07-09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/maus.h> +#include "proto.h" + +extern int maus_angeschlossen; + +/* ------------------------------------------------------------------------ */ +void look2_for_maus () +{ + if (maus_angeschlossen) + { + maus_setposition (0, 8); + maus_enable (); + } +} diff --git a/app/ned/10/ned1004.c b/app/ned/10/ned1004.c new file mode 100644 index 0000000000000000000000000000000000000000..4b1dccde57e10ddfa80054f3df95c7adb8064b3c --- /dev/null +++ b/app/ned/10/ned1004.c @@ -0,0 +1,85 @@ +/* + * FILE %ned/10/ned1004.c + * + * Maus Steuerung + * + * written: 1988 09 04 + * 1990 01 20: Modularisierung + * 1991 02 03: Revision + * 1991 05 27: Revision + * latest update: 1997-10-26 10:22:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/window.h> +#include <gg/maus.h> +#include "proto.h" + +extern int W_TEXT_CELL_X; +extern int W_TEXT_CELL_Y; +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void maus_wdw (int where) /* Groesse des aktuellen Windows aendern */ +{ + int x, y, t; + int ox, oy; + int w_text_cell_x; + int w_text_cell_y; + + w_text_cell_x = W_TEXT_CELL_X; + w_text_cell_y = W_TEXT_CELL_Y; + + for (;;) + { + maus_position (&x, &y, &t); + if (!(t & 0x02)) break; + } + + switch (where) + { + case 1: /* links oben */ + ox = aw->ax; oy = aw->ay; + aw->ax = x/w_text_cell_x + 1; + aw->ay = y/w_text_cell_y + 1; + if (aw->bx-aw->ax <= 3) aw->ax = aw->bx-4; + if (aw->by-aw->ay <= 3) aw->ay = aw->by-4; + if (aw->ay < 1) aw->ay = 1; + aw->cx += aw->ax-ox; + aw->cy += aw->ay-oy; + break; + case 2: /* rechts oben */ + oy = aw->ay; + aw->bx = x/w_text_cell_x -1; + aw->ay = y/w_text_cell_y +1; + if (aw->bx-aw->ax <= 3) aw->bx = aw->ax+4; + if (aw->by-aw->ay <= 3) aw->ay = aw->by-4; + if (aw->ay < 1) aw->ay = 1; + aw->cy += aw->ay-oy; + break; + case 3: /* links unten */ + ox = aw->ax; + aw->ax = x/w_text_cell_x +1; + aw->by = y/w_text_cell_y -1; + if (aw->bx-aw->ax <= 3) aw->ax = aw->bx-4; + if (aw->by-aw->ay <= 3) aw->by = aw->ay+4; + aw->cx += aw->ax-ox; + break; + case 4: /* rechts unten */ + aw->bx = x/w_text_cell_x -1; + aw->by = y/w_text_cell_y -1; + if (aw->bx-aw->ax <= 3) aw->bx = aw->ax+4; + if (aw->by-aw->ay <= 3) aw->by = aw->ay+4; + if (aw->ay < 1) aw->ay = 1; + break; + } + + maus_disable (); + aw->w_upd |= 0x05; + ned_display_window (aw); +} diff --git a/app/ned/10/ned1005.c b/app/ned/10/ned1005.c new file mode 100644 index 0000000000000000000000000000000000000000..b8036d1b26a86198a62023ff1e739344b6f3a6b3 --- /dev/null +++ b/app/ned/10/ned1005.c @@ -0,0 +1,30 @@ +/* + * FILE ~/usr/ned/10/ned1005.c + * + * Maus Steuerung + * + * written: 1988 09 04 + * 1990 01 20: Modularisierung + * 1991 02 03: Revision + * 1991 05 27: Revision + * latest update: 1995-04-29 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/maus.h> +#include "proto.h" + +extern int maus_angeschlossen; + +/* ------------------------------------------------------------------------ */ +void p_menue () /* Menueleiste(n) aktivieren */ +{ +#ifdef MSDOS + execute_mm_item (mm_maus_menu (0, maus_angeschlossen, 1)); +#endif +} diff --git a/app/ned/10/ned1006.c b/app/ned/10/ned1006.c new file mode 100644 index 0000000000000000000000000000000000000000..2c9eebc81534288a0e268c4718442ba24b5670a9 --- /dev/null +++ b/app/ned/10/ned1006.c @@ -0,0 +1,27 @@ +/* + * FILE ~/usr/ned/10/ned1006.c + * + * Maus Steuerung + * + * written: 1988 09 04 + * 1990 01 20: Modularisierung + * 1991 02 03: Revision + * 1991 05 27: Revision + * latest update: 1994-07-09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/maus.h> +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void maus_menue (int mode) /* Menueleiste(n) aktivieren */ +{ + execute_mm_item (mm_maus_menu (mode, 1, 1)); + maus_enable (); +} diff --git a/app/ned/10/ned1007.c b/app/ned/10/ned1007.c new file mode 100644 index 0000000000000000000000000000000000000000..ab317fa0e3206207f70f59d3b2e3c57b55ed6bb8 --- /dev/null +++ b/app/ned/10/ned1007.c @@ -0,0 +1,159 @@ +/* + * FILE %ned/10/ned1007.c + * + * Maus Steuerung + * + * written: 1990 01 28 + * 1991 02 03: Revision + * 1991 05 27: Revision + * latest update: 1999-04-25 16:36:25 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <stdio.h> /* HP/UX: defines size_t for malloc */ +#endif + +#include <stdlib.h> +#include "ed.h" +#include "edhyx.h" +#ifdef MSDOS +#include <gg/window.h> +#endif +#include <gg/maus.h> +#include <gg/keys.h> +#include "proto.h" + +extern int W_TEXT_CELL_X; +extern int W_TEXT_CELL_Y; + +extern struct WINDOWCTRL *windows; +extern int maus_angeschlossen; +extern int akt_page; + +#ifdef MSDOS +static char *blit_p1= (char *) 0; +static int blit_p1_size= 0; +#endif + +#define BOX_BX 60 +#define BOX_MEMORY 124 /* BOX_BX*2+4 Platzbedarf in Byte je Box-Zeile */ + +/* ------------------------------------------------------------------------ */ +int q_window_menu () +{ + int wn= -1; +#ifdef MSDOS + struct WINDOWCTRL *w; + int cnt= 0; + int m= 0; + int s; + int x, y, t; + char *fnm; + int color; /* Farbe der Frame Anzeige */ + + for (w= windows; w != (struct WINDOWCTRL *) 0; w= w->WC_next) cnt++; + + s= (cnt+2)*BOX_MEMORY; + if (s > blit_p1_size) + { + if (blit_p1_size) free (blit_p1); + blit_p1= (char *) malloc (blit_p1_size= s); + if (blit_p1 == (char *) 0) return -1; + } + + w_blit_save (blit_p1, akt_page, 0, 2, BOX_BX, cnt+3); + w_disp_bbox (akt_page, 0, 2, BOX_BX, cnt+3, WV_ROT|W_HELL|WH_VIOLETT, 2); + + s= 3; + for (w= windows; w != (struct WINDOWCTRL *) 0; w= w->WC_next) + { + wd_show_wdnr (akt_page, 1, s, WV_GELB | WH_VIOLETT, s-2); + + if (w->WC_title_short != (char *) 0) + { + fnm= w->WC_title_short; + } + else + if (w->file_or_frame != (void *) 0) + { + fnm= (w->file_type == FTY_HYPER) + ? ((struct FRAMECTRL *) w->file_or_frame)->frame_name + : ((struct FILECTRL *) w->file_or_frame)->FC_fnm_txt; + } + else fnm= "<untitled>"; + + color= (w->file_type == FTY_HYPER) + ? WV_KOBALT | W_HELL | WH_VIOLETT + : WV_WEISS | W_HELL | WH_VIOLETT; + + w_setstring (akt_page, 5, s, BOX_BX-1, s, color, fnm, 0x01); + s++; + } + + if (maus_angeschlossen) maus_enable (); + + for (;;) + { + if (maus_angeschlossen) + { + maus_position (&x, &y, &t); + x /= W_TEXT_CELL_X; + y /= W_TEXT_CELL_Y; + switch (t) + { + case -1: + maus_angeschlossen= 0; + break; + case 1: + if (x > 0 && x < BOX_BX && y > 2 && y < cnt+3) + { + wn= y-2; + } + case 2: + m= 1; + goto OVER; + } + } + + if (kbhit ()) + { + switch (t= kbin ()) + { + case 0x1B: + goto OVER; + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': case '9': + wn= t-'0'; + goto OVER; + case K_PF1: case K_PF2: case K_PF3: case K_PF4: + case K_PF5: case K_PF6: case K_PF7: case K_PF8: + case K_PF9: case K_PF10: + wn= t-K_PF1+1; + goto OVER; + case K_PF11: + wn= 11; + goto OVER; + case K_PF12: + wn= 12; + goto OVER; + } + } + } + +OVER: + if (maus_angeschlossen) maus_disable (); + w_blit_load (blit_p1, akt_page, 0, 2, BOX_BX, cnt+3); + if (maus_angeschlossen) maus_enable (); + if (m) while (t) maus_position (&x, &y, &t); +#else +#ifdef USE_TK + mac_call_tcl ("show_window_list"); +#endif /* USE_TK */ +#endif /* !MSDOS */ + + return wn; +} diff --git a/app/ned/10/ned1008.c b/app/ned/10/ned1008.c new file mode 100644 index 0000000000000000000000000000000000000000..4651bf4676da6e09dc93bdf6e1c9944eb98e1257 --- /dev/null +++ b/app/ned/10/ned1008.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/10/ned1008.c + * + * Maus Steuerung + * + * written: 1991 02 03 + * 1991 05 27: Revision + * latest update: 1995-12-31 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_window_menu () +{ + int wn; + + wn= q_window_menu (); + if (wn >= 0) q_jmpwdw (wn); +} diff --git a/app/ned/10/ned1009.c b/app/ned/10/ned1009.c new file mode 100644 index 0000000000000000000000000000000000000000..0f1c84ac1360a08042184e3f8de3f6eb4050cbd1 --- /dev/null +++ b/app/ned/10/ned1009.c @@ -0,0 +1,88 @@ +/* + * FILE %ned/10/ned1009.c + * + * Display buttons on the screen + * T2D: TK Version, use TK's buttons! + * + * written: 1991-07-03 + * latest update: 1997-10-26 10:21:44 + * $Id: ned1009.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include "proto.h" +#include <gg/window.h> + +int akt_buttons= 0x000F; +extern int akt_page; +extern int W_TEXT_MAX_X; +extern struct BUTTON_DESCRIPTOR *buttons; + +#define BUTTON_COLOR1 (WV_WEISS|W_HELL|WH_VIOLETT) +#define BUTTON_COLOR2 (WV_GELB|WH_VIOLETT) + +/* ------------------------------------------------------------------------ */ +void show_buttons (struct WINDOWCTRL *wc) +{ + struct BUTTON_DESCRIPTOR *bd; + + akt_buttons= wc->wc_ll_flags; + w_setnchar (akt_page, 0, 0, WV_SCHWARZ, ' ', 80); + + w_prntcol (akt_page, 0, 0, BUTTON_COLOR1, " MENU "); + w_prntcol (akt_page, 8, 0, BUTTON_COLOR1, " WINS "); + w_prntcol (akt_page, 16, 0, BUTTON_COLOR1, " close "); + w_prntcol (akt_page, 25, 0, BUTTON_COLOR1, " exec "); + w_prntcol (akt_page, 33, 0, BUTTON_COLOR1, " rel. "); + +#ifdef LL_BUTTONS_1 + if (akt_buttons & LL_prev) + w_prntcol (akt_page, 42, 0, BUTTON_COLOR2, "<<prev<<"); + if (akt_buttons & LL_up) + w_prntcol (akt_page, 52, 0, BUTTON_COLOR2, "^^ up ^^"); + if (akt_buttons & LL_more) + w_prntcol (akt_page, 62, 0, BUTTON_COLOR2, "* more *"); else + if (akt_buttons & LL_menu) + w_prntcol (akt_page, 62, 0, BUTTON_COLOR2, "v menu v"); else + w_prntcol (akt_page, 62, 0, BUTTON_COLOR2, "?? links"); + if (akt_buttons & LL_next) + w_prntcol (akt_page, 72, 0, BUTTON_COLOR2, ">>next>>"); +#endif + +#ifdef LL_BUTTONS_2 + if (akt_buttons & LL_view) + w_prntcol (akt_page, 54, 0, BUTTON_COLOR2, "AV"); + if (akt_buttons & LL_sort) + w_prntcol (akt_page, 57, 0, BUTTON_COLOR2, "AS"); + if (akt_buttons & LL_lang) + w_prntcol (akt_page, 60, 0, BUTTON_COLOR2, "AL"); + if (akt_buttons & LL_) + w_prntcol (akt_page, 63, 0, BUTTON_COLOR2, "??"); + if (akt_buttons & LL_more) + w_prntcol (akt_page, 66, 0, BUTTON_COLOR2, "**"); + if (akt_buttons & LL_menu) + w_prntcol (akt_page, 69, 0, BUTTON_COLOR2, "vv"); + + if (akt_buttons & LL_prev) + w_prntcol (akt_page, 72, 0, BUTTON_COLOR2, "<<"); + if (akt_buttons & LL_up) + w_prntcol (akt_page, 75, 0, BUTTON_COLOR2, "^^"); + if (akt_buttons & LL_next) + w_prntcol (akt_page, 78, 0, BUTTON_COLOR2, ">>"); +#endif + + for (bd= buttons; bd != (struct BUTTON_DESCRIPTOR *) 0; bd= bd->BD_next) + { + /************************** + if (bd->BD_x == 0 && bd->BD_y >= NED_TEXT_MAX_Y) + w_setnchar (akt_page, 0, bd->BD_y, 0, ' ', W_TEXT_MAX_X); + **************************/ + w_prntcol (akt_page, bd->BD_x, bd->BD_y, bd->BD_colour, bd->BD_text); + } +} diff --git a/app/ned/10/ned1010.c b/app/ned/10/ned1010.c new file mode 100644 index 0000000000000000000000000000000000000000..a4f2c14b6e381cb9bcfd4d79f11aba05558d1020 --- /dev/null +++ b/app/ned/10/ned1010.c @@ -0,0 +1,83 @@ +/* + * FILE %ned/10/ned1010.c + * + * Maus Steuerung + * + * written: 1988 09 04 + * 1990 01 20: Modularisierung + * 1991 02 03: Revision + * 1991 05 27: Revision + * latest update: 1997-10-26 10:22:18 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include <gg/keys.h> +#ifdef USE_MOUSE +#include <gg/maus.h> +#endif +#include "proto.h" + +extern int maus_angeschlossen; +extern ned_input_handler *nextchar; +extern int MPflag; +extern int jou_flag; + +/* ------------------------------------------------------------------------ */ +int test_maus (int left, int right, int left_right) +{ +#ifdef USE_MOUSE + int x, y, t; + int rc= 0; + + if (! maus_angeschlossen) return (*nextchar) (); + + maus_enable (); + for (;;) + { + if (kbhit () || jou_flag == 2 || MPflag) + { + maus_disable (); + return (*nextchar) (); + } + + maus_position (&x, &y, &t); + + switch (t & 0x07) + { + case 0x01: + rc= left; + goto STOP; + case 0x02: + rc= right; + goto STOP; + case 0x03: + rc= left_right; + goto STOP; + default: + break; + } + } + +STOP: + + do + { + maus_position (&x, &y, &t); + } while (t != 0); + + return rc; + +#else + +#ifdef MSDOS + left; right; left_right; +#endif + + return (*nextchar) (); +#endif +} diff --git a/app/ned/10/ned1011.c b/app/ned/10/ned1011.c new file mode 100644 index 0000000000000000000000000000000000000000..287e15f7055659ee5879d2fd13cd0a5a1a5b03dc --- /dev/null +++ b/app/ned/10/ned1011.c @@ -0,0 +1,36 @@ +/* + * FILE %ned/10/ned1011.c + * + * setup button definiton + * + * written: 1992 04 04 + * latest update: 1999-04-25 16:36:28 + * $Id: ned1011.c,v 1.3 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <stdlib.h> +#include "ed.h" +#include "proto.h" + +extern struct BUTTON_DESCRIPTOR *buttons; + +/* ------------------------------------------------------------------------ */ +int rst_button () +{ + struct BUTTON_DESCRIPTOR *bd; + struct BUTTON_DESCRIPTOR *bd2; + + for (bd= buttons; (bd2= bd) != (struct BUTTON_DESCRIPTOR *) 0;) + { + bd= bd->BD_next; + free (bd2->BD_text); + free (bd2); + } + + return 0; +} diff --git a/app/ned/10/ned1012.c b/app/ned/10/ned1012.c new file mode 100644 index 0000000000000000000000000000000000000000..620c340aac9cf03e6cb190e408d6b27974ad6b6a --- /dev/null +++ b/app/ned/10/ned1012.c @@ -0,0 +1,70 @@ +/* + * FILE %ned/10/ned1012.c + * + * setup button definiton + * format: + * x y colour type macro_num id text + * + * written: 1992 04 04 + * latest update: 1996-12-04 18:36:26 + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" + +extern int W_TEXT_MAX_Y; +extern int NED_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +int stp_button (FILE *fi, char *str, int max_str) +{ + int rc; +#define N_FIELDS 7 + char *fields [N_FIELDS]; + int n_fields; + int bdx, bdy, bdc, bdt, bdm, bdi; + + for (;;) + { + rc= fread_line (fi, str, max_str); + if (rc <= 0 && feof (fi)) break; + if (str [0] == '#') continue; + + n_fields= isolate_tokens (str, fields, N_FIELDS); + if (n_fields < 0) break; + if (n_fields > N_FIELDS) n_fields= N_FIELDS; + if (ned_what_stp_cmd (fields[0]) >= 0) break; + + bdx= (int) get_parameter_value (fields [0]); + /* y: line where button text appears */ + bdy= (int) get_parameter_value (fields [1]); + if (bdy < 0) + { /* negative values: button is in the lower screen area ... */ + /* reduce the size of possible screen text if necessary */ + int t; + + t= W_TEXT_MAX_Y+bdy; + if (t < NED_TEXT_MAX_Y) NED_TEXT_MAX_Y=t; + bdy= W_TEXT_MAX_Y+bdy; + } + + bdc= (int) get_parameter_value (fields [2]); + bdt= (int) get_parameter_value (fields [3]); + bdm= (int) get_parameter_value (fields [4]); + bdi= (int) get_parameter_value (fields [5]); + + def_button (bdx, bdy, bdc, bdt, bdm, bdi, fields [6]); + } + + return 0; +} diff --git a/app/ned/10/ned1013.c b/app/ned/10/ned1013.c new file mode 100644 index 0000000000000000000000000000000000000000..078e9bc422c9cc863db6a56112cad77cf3af8a2a --- /dev/null +++ b/app/ned/10/ned1013.c @@ -0,0 +1,54 @@ +/* + * FILE %ned/10/ned1013.c + * + * define button + * + * written: 1992 04 04 + * latest update: 1999-04-25 16:36:32 + * $Id: ned1013.c,v 1.3 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" + +extern struct BUTTON_DESCRIPTOR *buttons; + +/* ------------------------------------------------------------------------ */ +int def_button ( +int bdx, +int bdy, +int bdc, +int bdt, +int bdm, +int bdi, +char *bdtext) +{ + struct BUTTON_DESCRIPTOR *bd; + + if ((bd= (struct BUTTON_DESCRIPTOR *) + calloc (sizeof (struct BUTTON_DESCRIPTOR), 1)) + != (struct BUTTON_DESCRIPTOR *) 0) + { + bd->BD_x= bdx; + bd->BD_y= bdy; + bd->BD_id= bdi; + bd->BD_colour= bdc; + bd->BD_type= bdt; + bd->BD_macro_num= bdm; + bd->BD_text= strdup (bdtext); + + bd->BD_next= buttons; + buttons= bd; + } + + return 0; +} diff --git a/app/ned/10/ned1014.c b/app/ned/10/ned1014.c new file mode 100644 index 0000000000000000000000000000000000000000..daba691dee7cff3baf730922ded54cac62199f1e --- /dev/null +++ b/app/ned/10/ned1014.c @@ -0,0 +1,37 @@ +/* + * FILE %ned/10/ned1014.c + * + * locate a button + * + * written: 1992 04 04 + * latest update: 1997-10-26 10:23:04 + * $Id: ned1014.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" + +extern struct BUTTON_DESCRIPTOR *buttons; + +/* ------------------------------------------------------------------------ */ +struct BUTTON_DESCRIPTOR *locate_button (int bdx, int bdy) +{ + struct BUTTON_DESCRIPTOR *bd; + + for (bd= buttons; bd != (struct BUTTON_DESCRIPTOR *) 0; bd= bd->BD_next) + { + if (bdy == bd->BD_y + && bdx >= bd->BD_x + && bdx < bd->BD_x + strlen (bd->BD_text) + ) + return bd; + } + + return (struct BUTTON_DESCRIPTOR *) 0; +} diff --git a/app/ned/10/ned1015.c b/app/ned/10/ned1015.c new file mode 100644 index 0000000000000000000000000000000000000000..ce8da605054c0a24fe6ca693eff5ee0e23920b01 --- /dev/null +++ b/app/ned/10/ned1015.c @@ -0,0 +1,47 @@ +/* + * FILE %ned/10/ned1015.c + * + * exectue item from the mouse menu + * + * written: 1992 07 12 + * latest update: 1995-08-22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int execute_mm_item (long fc) +{ + struct mm_item *mi; + ned_primitive *np; + + if (fc == -1L || fc == 0L) return -1; + + /* NOTE: in the old days, fc was really the address of a */ + /* NED primitive function which was casted and called like this: */ + /* (*(int (*) ()) fc) (); */ + /* things have changed ... */ + + mi= (struct mm_item *) fc; + switch (mi->MMI_type) + { + case MMI_func: + /* (*(int (*) ()) mi->MMI_value) (); */ + np= (ned_primitive *) mi->MMI_value; + (*np) (); + break; + case MMI_macro: + p_macro ((int) mi->MMI_value); + break; + default: + return -1; + } + + return 0; +} diff --git a/app/ned/10/ned1016.c b/app/ned/10/ned1016.c new file mode 100644 index 0000000000000000000000000000000000000000..043354750aae64b5b04dc1f8bebffab42ca8ef34 --- /dev/null +++ b/app/ned/10/ned1016.c @@ -0,0 +1,68 @@ +/* + * FILE %ned/10/ned1016.c + * + * setup menu definiton + * + * format: + * x y macro_num text + * + * written: 1992 07 12 + * latest update: 1999-04-25 16:36:35 + * + */ + +#ifdef MSDOS +/* #pragma check_stack(off) */ +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" +#include <gg/maus.h> + +/* ------------------------------------------------------------------------ */ +int stp_mm_item (FILE *fi, char *str, int max_str) +{ + int bdx, bdy; + long bdm; + int rc; +#define N_FIELDS 4 + char *fields [N_FIELDS]; + int n_fields; + struct mm_item *mi= (void *) 0; + + for (;;) + { + rc= fread_line (fi, str, max_str); + if (rc <= 0 && feof (fi)) break; + if (str [0] == '#') continue; + + n_fields= isolate_tokens (str, fields, N_FIELDS); + if (n_fields < 0) break; + if (n_fields > N_FIELDS) n_fields= N_FIELDS; + if (ned_what_stp_cmd (fields [0]) >= 0) break; + + bdx= (int) get_parameter_value (fields [0]); + bdy= (int) get_parameter_value (fields [1]); + bdm= get_parameter_value (fields [2]); + + if (bdm >= 0L && bdm < (long) N_MACRO) + { + if ((mi= (struct mm_item *) calloc (sizeof (struct mm_item), 1)) + != (struct mm_item *) 0) + { + mi->MMI_type= MMI_macro; + mi->MMI_value= bdm; + } + } + + mm_install_function (bdx, bdy, strdup (fields [3]), (long) mi, 0, 1); + } + + return 0; +} diff --git a/app/ned/10/ned1017.c b/app/ned/10/ned1017.c new file mode 100644 index 0000000000000000000000000000000000000000..55c37f8bddc5fec46ba8c70e7f79f7506cadf633 --- /dev/null +++ b/app/ned/10/ned1017.c @@ -0,0 +1,81 @@ +/* + * FILE %ned/10/ned1017.c + * + * Maus Steuerung + * + * written: 1995-10-19 + * latest update: 1997-10-26 10:22:57 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "edhyx.h" +#include <gg/maus.h> +#include <gg/keys.h> +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +/* richtiges Window suchen und ggf. anspringen */ +/* return: */ +/* 0 ... cursor within window */ +/* 1 ... frame */ +/* 2 ... cursor out of window */ +int ned_mouse_set_cursor (int x, int y) +{ + int dy, dy2; + int rv= 0; + +#ifdef USE_TK + tk_resetcup (); +#else + if (x+1 < aw->ax || x-1 > aw->bx || + y+1 < aw->ay || y-1 > aw->by) + { /* Cursor ausserhalb der Grenzen des aktuellen Windows */ + /* -> anderes Window */ + maus_jmpwdw (x, y); + } +#endif /* !USE_TK */ + + if (x < aw->ax-1 || x > aw->bx+1 + || y < aw->ay-1 || y > aw->by+1 + ) + return 2; + + if (x < aw->ax || x > aw->bx + || y < aw->ay || y > aw->by + ) + rv= 1; + + for (dy2= 0; (dy= aw->cy - y) && dy != dy2; dy2= dy) + if (dy > 0) ned_cursor_up (); else ned_cursor_down (); + + if (x >= aw->ax && x <= aw->bx) + { + aw->cx= x; + setcup (aw); + } + else + if (x+1 == aw->ax && aw->hv) + { + aw->cx= aw->ax; + ned_cursor_left (); + } + else + if (x-1 == aw->bx) + { + aw->cx= aw->bx; + setcup (aw); + if (aw->cx-aw->ax+aw->hv < aw->WC_act->lng) + { + ned_cursor_right (); + } + } + + return rv; +} diff --git a/app/ned/10/ned1018.c b/app/ned/10/ned1018.c new file mode 100644 index 0000000000000000000000000000000000000000..1365ceb71e7065c658d97604934318d49a31a6d0 --- /dev/null +++ b/app/ned/10/ned1018.c @@ -0,0 +1,217 @@ +/* + * FILE %ned/10/ned1018.c + * + * Maus Steuerung + * + * written: 1988 09 04 + * 1990 01 20: Modularisierung + * 1991 02 03: Revision + * 1991 05 27: Revision + * 1995-10-19: extracted from 1001 + * latest update: 1998-08-16 12:33:38 + * $Id: ned1018.c,v 1.3 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <time.h> +#include "ed.h" +#include "edhyx.h" + +#ifndef USE_TK +#include <gg/maus.h> +#else +#define P1 STOP +#endif /* !USE_TK */ + +#include <gg/keys.h> +#include "proto.h" +extern struct WINDOWCTRL *aw; +static int block_mode; + +#ifdef DEBUG +#include <stdio.h> +static char bu [80]; +#endif /* DEBUG */ + +/* ------------------------------------------------------------------------ */ +static int last_x= -2; +static int last_y= -2; +static int first_x= -2; +static int first_y= -2; + +static time_t last_time= -1L; +static int last_dc_key= 0; +static int selection_active= 0; + +/* pointer device button states */ +#define BST_START 0 +#define BST_B1 1 +#define BST_B2 2 +#define BST_B3 3 +#define BST_WAIT 888 +static int bst= BST_START; + +/* ------------------------------------------------------------------------ */ +int ned_mouse_event (int x, int y, int t, int abs_x, int abs_y) +{ + time_t act_time; + int double_click= 0; /* 1 -> double click event */ + int rv= 0; + struct FEATURE **fp; + +#ifdef MSDOS + abs_x; abs_y; /* not used in MSDOS */ +#endif /* MSDOS */ + + switch (bst) + { + case BST_START: + if (!t) break; + + act_time= time ((time_t *) 0); + if (t == last_dc_key + && (act_time == last_time || act_time-1 == last_time) + && x == first_x + && y == first_y + ) + { + double_click= 1; + } + + last_time= act_time; + last_dc_key= t; + first_x= x; + first_y= y; + selection_active= 0; + bst= t; + +#ifdef DEBUG + sprintf (bu, "be: [x=%d y=%d t=%d] (dc=%d)", x, y, t, double_click); + ned_message_1 (bu); +#endif /* DEBUG */ + + switch (t) + { + case 0x0001: + switch (ned_mouse_set_cursor (x, y)) + { + case 0: /* cursor in main text window */ + if (!double_click) break; +#ifndef USE_TK + maus_disable (); +#endif /* !USE_TK */ + ned_eval_feature (); + bst= BST_WAIT; + break; + + case 1: /* cursor on window frame */ + break; + + case 2: /* cursor out of main text window */ + if (ned_search_button_bar (x, y, t)) bst= BST_WAIT; + break; + } + + rv= 1; + break; + + case 0x0002: +#ifdef USE_TK + /* TK: post a menu ... */ + ned_tk_special_event ((struct WINDOWCTRL *) 0, NED_TK_CMD_MOUSE_B2, + abs_x, abs_y); +#endif /* USE_TK */ + break; + + case 0x0004: /* middle button */ +#ifdef __DONT_DO_THAT__ /* 1996-03-17 19:17:41 */ + switch (ned_mouse_set_cursor (x, y)) + { + case 0: /* cursor in window */ +#ifdef USE_TK + if (!double_click) ned_tk_import_selection (); +#endif /* USE_TK */ + break; + } +#endif /* __DONT_DO_THAT__ 1996-03-17 19:17:41 */ + +#ifdef USE_TK + if (!double_click) ned_tk_import_selection (); +#endif /* USE_TK */ + rv= 1; + break; + } + break; + + case BST_B1: + if (t != 0x0001) + { + bst= t; + break; + } + + /* if (x == last_x && y == last_y) break; */ + + rv= 1; + if (!selection_active + && (first_x != x || first_y != y) + && x >= aw->ax && x <= aw->bx + && y >= aw->ay && y <= aw->by + ) + { + block_mode= BLOCK_MODE_standard; + ned_set_marker (aw, 0x7B); /* open brace */ + selection_active= 1; +#ifdef USE_TK + ned_tk_block_export_flag (1); +#endif /* USE_TK */ + last_time= -1L; /* reset double click timer */ + } + + ned_mouse_set_cursor (x, y); + + /* EXP: 1996-05-27 10:25:40 */ + if ((fp= ned_feature_find3 (1)) != (struct FEATURE **) 0) + show_feature (*fp); + + if (selection_active && (x != last_x || y != last_y)) p_blkend (); + +#ifndef USE_TK + maus_enable (); +#endif /* !USE_TK */ + break; + + case BST_B2: /* B2 still pressed */ + bst= t; + break; + + case BST_WAIT: + if (!t) + { + bst= BST_START; +#ifndef USE_TK + maus_enable (); +#endif /* !USE_TK */ + rv= 1; + } + break; + + default: + bst= t; + break; + } + +#ifdef DEBUG + sprintf (bu, "be: [x=%d y=%d t=%d]", x, y, t); + ned_message_1 (bu); +#endif /* DEBUG */ + + last_x= x; + last_y= y; + + return rv; +} diff --git a/app/ned/10/ned1019.c b/app/ned/10/ned1019.c new file mode 100644 index 0000000000000000000000000000000000000000..adaf604f324983a7b9d77fd38abcfbc42e387157 --- /dev/null +++ b/app/ned/10/ned1019.c @@ -0,0 +1,152 @@ +/* + * FILE %ned/10/ned1019.c + * + * find a button + * + * written: 1995-12-31 + * latest update: 2001-02-11 12:45:22 + * $Id: ned1019.c,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include "ed.h" +#include "edhyx.h" + +#ifndef USE_TK +#include <gg/maus.h> +#endif /* !USE_TK */ + +#include <gg/keys.h> +#include "proto.h" + +extern int akt_buttons; +extern ned_primitive_function *special_event; + +/* ------------------------------------------------------------------------ */ +int ned_search_button_bar (int x, int y, int t) +{ + struct BUTTON_DESCRIPTOR *bd; + +printf ("ned1019.c: x=%d y=%d t=%d\n", x, y, t); + if (y != 0) return 0; + +#ifndef USE_TK + if (x >= 0 && x <= 5) { maus_menue (t); return 1; } + maus_disable (); +#endif /* !USE_TK */ + + if (x >= 8 && x <= 13) { p_window_menu (); return 1; } + if (x >= 16 && x <= 22) + { +#ifdef USE_TK + special_event= &p_ssave; +#else + p_ssave (); +#endif /* USE_TK */ + return 1; + } + if (x >= 25 && x <= 32) { ned_eval_feature ();return 1; } + if (x >= 33 && x <= 38) { p_save_reload (); return 1; } + +#ifdef LL_BUTTONS_1 + if ((akt_buttons & LL_prev) && x >= 42 && x <= 49) + { + p_logic_link_prev (); + return 1; + } + + if ((akt_buttons & LL_up ) && x >= 52 && x <= 59) + { + p_logic_link_up (); + return 1; + } + + if (x >= 62 && x <= 69) + { + if (akt_buttons & LL_menu) p_logic_link_menu (); else + if (akt_buttons & LL_more) p_logic_link_more (); else + p_link_more (); + return 1; + } + + if ((akt_buttons & LL_next) && x >= 72 && x <= 79) + { + p_logic_link_next (); + return 1; + } +#endif + +#ifdef LL_BUTTONS_2 + if ((akt_buttons & LL_view) && x >= 54 && x <= 55) + { + p_logic_link_view (); + return 1; + } + + if ((akt_buttons & LL_sort) && x >= 57 && x <= 58) + { + p_logic_link_sort (); + return 1; + } + + if ((akt_buttons & LL_lang) && x >= 60 && x <= 61) + { + p_logic_link_lang (); + return 1; + } + + if ((akt_buttons & LL_) && x >= 63 && x <= 64) + { + p_link_more (); + return 1; + } + + if ((akt_buttons & LL_more) && x >= 66 && x <= 67) + { + p_logic_link_more (); + return 1; + } + + if ((akt_buttons & LL_menu) && x >= 69 && x <= 70) + { + p_logic_link_menu (); + return 1; + } + + if ((akt_buttons & LL_prev) && x >= 72 && x <= 73) + { + p_logic_link_prev (); + return 1; + } + + if ((akt_buttons & LL_up ) && x >= 75 && x <= 76) + { + p_logic_link_up (); + return 1; + } + + if ((akt_buttons & LL_next) && x >= 78 && x <= 79) + { + p_logic_link_next (); + return 1; + } +#endif + + if ((t & 0x03) + && (bd= locate_button (x, y)) != (struct BUTTON_DESCRIPTOR *) 0 + ) + { + p_macro (bd->BD_macro_num); + return 1; + } + +#ifndef USE_TK + maus_enable (); +#endif /* !USE_TK */ + return 0; +} diff --git a/app/ned/11/(dirinf).fm b/app/ned/11/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..f977ef5dd3ed9d2c4398c0e4595bce5d30773306 --- /dev/null +++ b/app/ned/11/(dirinf).fm @@ -0,0 +1,26 @@ +# +# FILE %ned/11/(dirinf).fm +# +# latest update: 2000-08-24 14:50:34 +# $Id: (dirinf).fm,v 1.2 2000/08/24 15:10:20 gonter Exp $ +# + +Makefile | current makefile +make-dos | MSDOS makefile + +ned1101.c | Find + Find/Switch: p_fr_next () +ned1102.c | Find + Find/Switch: p_find (); etc... +ned1103.c | Find + Find/Switch: p_replace () +ned1104.c | Find + Find/Switch: ned_ws_find_replace_dialog () +ned1105.c | Find + Find/Switch: ned_str_match () +ned1106.c | Find Bracket: q_find_bracket (int mode) +ned1107.c | Find Matching Bracket +ned1108.c | Find Higher Bracket +ned1109.c | Find Lower Bracket +ned1110.c | ned_wc_find_replace +ned1111.c | ned_all_lines (...); display all lines containing x +ned1112.c | ned_lp_find_str (...); +ned1112v.c | ned_vi_wc_find_str (...); +ned1112w.c | ned_ws_aw_find_str (...); +ned1113.c | ned_jmp_pattern (wc, char *pattern) +* | diff --git a/app/ned/11/Makefile b/app/ned/11/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..0e64d8f30fd3ddd017dadac9965031c0d0e1e8c0 --- /dev/null +++ b/app/ned/11/Makefile @@ -0,0 +1,40 @@ +# +# FILE %ned/11/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# +# latest update: 1999-05-06 16:27:11 +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-c -g -I.. $(cf) +CC=cc +objs= ned1101.o ned1102.o ned1103.o ned1104.o ned1105.o \ + ned1106.o ned1107.o ned1108.o ned1109.o ned1110.o \ + ned1111.o ned1112.o ned1112w.o ned1113.o +objs_cur= ned1112v_cur.o +objs_tk= ned1112v_tk.o +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_tk lib_cur +clean : + rm -f *.o lib_cur lib_tk + +lib_tk : $(objs_tk) $(objs) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h + $(CC) $(OPTS) -c $*.c +# --- cur Modules ---------- +ned1112v_cur.o : ../ed.h ned1112v.c + $(CC) $(OPTS) -o ned1112v_cur.o ned1112v.c + +# --- tk Modules ---------- +ned1112v_tk.o : ../ed.h ned1112v.c + $(CC) $(OPTS) -DUSE_TK -o ned1112v_tk.o ned1112v.c diff --git a/app/ned/11/contrib b/app/ned/11/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/11/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/11/gg b/app/ned/11/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/11/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/11/lib_cur b/app/ned/11/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/11/lib_tk b/app/ned/11/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/11/make-dos b/app/ned/11/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..e92f8241b128b67417e1e3cd87ec7b4b2752c128 --- /dev/null +++ b/app/ned/11/make-dos @@ -0,0 +1,21 @@ +# +# FILE %ned/11/makefile +# +# GG's Night(mare) Editor System +# +# latest update: 1997-01-12 18:16:11 +# +# ============================================================================ +cc=cl -Os -AL /c +ccc=cl -Os -AL /Fo$@ /W3 -I.. /c +obj=objdec -m0 -w -sl 2 NED11_TEXT $@ + +lib : ! + ned1101.obj ned1102.obj ned1103.obj ned1104.obj ned1105.obj ! + ned1106.obj ned1107.obj ned1108.obj ned1109.obj ned1110.obj ! + ned1111.obj ned1112.obj ned1112v.obj ned1112w.obj ned1113.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $*.c + $(obj) diff --git a/app/ned/11/ned1101.c b/app/ned/11/ned1101.c new file mode 100644 index 0000000000000000000000000000000000000000..1385c6f4657b0147197eaa778f4311f5d23d7be9 --- /dev/null +++ b/app/ned/11/ned1101.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/11/ned1101.c + * + * Such- und Ersetzungsfunktionen + * + * written: 1988 09 20 + * 1989 06 18 + * 1990 01 21: Revision + * 1991 09 11: Revision + * latest update: 1997-01-06 10:54:05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_fr_next () +{ + ned_ws_find_replace_dialog (aw, 0); +} diff --git a/app/ned/11/ned1102.c b/app/ned/11/ned1102.c new file mode 100644 index 0000000000000000000000000000000000000000..f164fa4b1fa53c0c87d474212fc6e4918e4120ed --- /dev/null +++ b/app/ned/11/ned1102.c @@ -0,0 +1,48 @@ +/* + * FILE %ned/11/ned1102.c + * + * Such- und Ersetzungsfunktionen + * + * written: 1988 09 20 + * 1989 06 18 + * 1991 09 11: Revision + * latest update: 1998-08-15 14:34:02 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_find () +{ + ned_ws_find_replace_dialog (aw, 1); +} + +/* ------------------------------------------------------------------------ */ +void vi_find_forward () +{ + vi_find (aw, 0); +} + +/* ------------------------------------------------------------------------ */ +void vi_find_backward () +{ + vi_find (aw, 1); +} + +/* ------------------------------------------------------------------------ */ +void pico_find () +{ + char *pattern; + + if ((pattern= ned_prompt_find ("Find: ")) == (char *) 0) return; + + ned_jmp_pattern (aw, aw->WC_act, pattern, 0); +} diff --git a/app/ned/11/ned1103.c b/app/ned/11/ned1103.c new file mode 100644 index 0000000000000000000000000000000000000000..21df53dd24150d174c123f268afda1dec96eddb3 --- /dev/null +++ b/app/ned/11/ned1103.c @@ -0,0 +1,26 @@ +/* + * FILE %ned/11/ned1103.c + * + * Such- und Ersetzungsfunktionen + * + * written: 1988 09 20 + * 1989 06 18 + * 1991 09 11: Revision + * latest update: 1997-01-06 10:54:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +void p_replace () +{ + ned_ws_find_replace_dialog (aw, 2); +} diff --git a/app/ned/11/ned1104.c b/app/ned/11/ned1104.c new file mode 100644 index 0000000000000000000000000000000000000000..325cd2f4d26bf79deb59e2abba075dbc1b819ab9 --- /dev/null +++ b/app/ned/11/ned1104.c @@ -0,0 +1,210 @@ +/* + * FILE %ned/11/ned1104.c + * + * Text search and replace functions + * see: C API documentation + * + * written: 1988 09 20 + * 1989 06 18 + * 1990 01 21: Revision + * 1991 02 02: Revision + * latest update: 1998-08-16 12:33:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#define __strrev_undefined__ +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" +#include <gg/window.h> +#include <gg/strings.h> + +extern struct MARKER b_beg, b_end; +extern int MPflag; + +/* statische Variablen fuer Find & Replace: ------------------------------- */ +#define FIND_STR_SIZE 82 +#define REPL_STR_SIZE 82 +#define OPT_STR_SIZE 20 +static char find_str [FIND_STR_SIZE]; +static char repl_str [REPL_STR_SIZE]; +static char opt_str [OPT_STR_SIZE]; /* Optionen und Ersatz-String */ + +static int find_replace= -1; /* -1 .. uninitialized */ + /* 0 .. undefiniert */ + /* 1 .. Find */ + /* 2 .. Replace (Makro Execution) */ + +static int option; +static int repeat_counter; + +/* ------------------------------------------------------------------------ */ +void ned_ws_find_replace_dialog ( +struct WINDOWCTRL *wc, +int fr) /* Find/Replace Mode: */ + /* 0: Find/Replace Next */ + /* 1: Find */ + /* 2: Replace */ +{ + struct LINE *z_start; /* line where searching starts */ + struct LINE *z_end; /* line where searching may stop */ + int c_start; /* column where searching starts */ + int something_found= 0; /* >1 -> something was found */ + int i, j; + + z_start= wc->WC_act; + c_start= get_coln (wc); + repeat_counter= 1; + + if (find_replace == -1 || MPflag) + { + find_str [0]= repl_str [0]= opt_str [0]= (char) 0; + find_replace= 0; + } + + ned_set_marker (wc, (fr == 0) ? '?' : '/'); + + if (fr != 0 || find_replace == 0) + { + if (fr == 0) fr= 1; + find_replace= fr; + + if (MPflag + || (q_isolate_word (find_str, FIND_STR_SIZE-1, CHARSET_token, 0) + == 0 + ) + ) + find_str [0]= 0; + + if (rd_str ("Find: ", find_str, FIND_STR_SIZE) == -1) goto ABORT; + if (fr == 2) + { + /** repl_str [0]= 0; TEST: 1996-07-28 11:48:07 */ + if (rd_str ("Replace: ", repl_str, REPL_STR_SIZE) == -1) goto ABORT; + } + + opt_str [0]= 0; + if (rd_str ("Option: ", opt_str, OPT_STR_SIZE) == -1) goto ABORT; + + /************ option String auswerten ***************/ + option= OPT_ask; /* Default Option ev. per Setup !!! */ + j= 0; + for (i= 0; opt_str [i]; i++) + switch (opt_str [i]) + { + case 'n': case 'N': option &= OPT_no_ask; break; /* No Asking */ + case 'a': case 'A': option |= OPT_ask; break; /* Asking */ + case 'i': case 'I': /* ign. Case */ + case 'l': case 'L': /* ign. Case */ + case 'u': case 'U': option |= OPT_upper; break; /* ign. Case */ + case 'm': case 'M': option &= OPT_mixed; break; /* Case */ + case 'g': case 'G': option |= OPT_global; break; /* Global */ + case 'r': case 'R': option &= OPT_local; break; /* Lokal */ + case 'b': case 'B': option |= OPT_backward; break; /* Reverse */ + case 'f': case 'F': option &= OPT_forward; break; /* Forward */ + case 'x': case 'X': option |= OPT_end_mark; break; /* Marker #1 */ + case 'y': case 'Y': /* Block */ + if (ned_blk_invalid () || wc != b_beg.wptr) break; + option |= OPT_beg_block | OPT_end_block; + break; + case '0': case '1': + case '2': case '3': + case '4': case '5': + case '6': case '7': + case '8': case '9': + j= j*10 + opt_str[i] - '0'; + break; + } + + if (option & OPT_global) + { + /** if (fr == 2) TEST: 1996-07-28 11:50:26 **/ + repeat_counter= 32200; + option &= OPT_forward; /* global -> forward */ + } + if (j) repeat_counter= j; + } /* prompt and evaluation of options */ + + /* set the begin and end position */ + z_end= (struct LINE *) 0; + if (option & OPT_end_mark) + { + struct MARKER *mp; + + if ((mp= ned_get_marker ('1', 0)) != (struct MARKER *) 0) + z_end= mp->ptr; + } + if (option & OPT_end_block) z_end= b_end.ptr; + + if (z_start == (struct LINE *) 0) goto GANZ_AUS; + + if (fr != 0 && (option & OPT_global)) + { + z_start= ned_find_first_line (z_start); + c_start= 0; + } + + if (option & OPT_beg_block + || ((option & OPT_end_block) && !(z_start->line_flg & LINE_inBLOCK)) + ) + { + z_start= b_beg.ptr; + c_start= 0; /* b_beg.offset */ + option &= OPT_no_ask; + } + + if (fr == 0) c_start++; + + /* BEGIN find-replace function: ---------------------- */ + something_found= ned_wc_find_replace (wc, z_start, c_start, z_end, + 999, 0, option, find_replace, + find_str, repl_str, + 999, repeat_counter, + ned_get_marker ('9', 1)); + /* END find-replace function: ------------------------ */ + +GANZ_AUS: + ned_message_1 ((something_found) + ? "search done ..." + : "nothing found ..."); + return; + +ABORT: + ned_message_1 ("aborted ..."); +} + +/* ------------------------------------------------------------------------ */ +char *ned_prompt_find (char *prompt) +{ + find_str [0]= 0; + find_replace= 1; + + if (rd_str (prompt, find_str, FIND_STR_SIZE) == -1) return (char *) 0; + return find_str; /* sigh ... */ +} + +/* ------------------------------------------------------------------------ */ +int ned_save_search_string (char *s) +{ + find_replace= 1; + + if (s == find_str) return 0; /* sigh... */ + + return (strcpy_max (find_str, s, FIND_STR_SIZE) == (char *) 0) ? -1 : 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_save_search_options (int opt) +{ + int rc; + + rc= option; + option= opt; + + return rc; +} diff --git a/app/ned/11/ned1105.c b/app/ned/11/ned1105.c new file mode 100644 index 0000000000000000000000000000000000000000..973a574e4fc147ae57e46175e70acfa9d03bae9a --- /dev/null +++ b/app/ned/11/ned1105.c @@ -0,0 +1,233 @@ +/* + * FILE %ned/11/ned1105.c + * + * Text search and replace functions + * see: C API documentation + * ned_str_match: Suchen eines Strings im NED Zeilen Speicher + * und Angabe der Position des gefundenen Strings + * + * written: 1988 09 20 + * 1989 06 18 + * 1990 01 21: Revision + * 1991 01 31: Revision + * 1991 12 31: revision: bracket match + * latest update: 1998-08-16 19:21:31 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_str_match ( +struct LINE *z_start, /* Start Zeile */ +int c_start, /* Start Spalte */ +struct LINE *z_end, /* Ende Zeile */ +unsigned char *mtch, /* Match String */ +unsigned char *ignore, /* Ignore String (matching brackets) */ +int matching_ignore_level, /* ev. Verschachtelungsebene */ +struct LINE **z_fnd, /* Zeile des gefundenen Strings */ +int *c_fnd, /* Spalte des gefundenen Strings */ +int *ml, /* laenge des gematchten Strings */ +int option) /* Find&Replace Optionen */ +/* RETURN: -1 ... Suchanfang undefiniert oder nicht gef. */ +/* 0 ... gefunden !!! */ +{ + int m_char= 0; /* Zeichen im Match String */ + int m_lng= 0; /* Laenge des gematchten Strings */ + int t_char; /* Zeichen im Text */ + int status= -1; /* Zustand des Match-Automaten */ + struct LINE *zz_start; /* untersuchte Zeile */ + struct LINE *zz_save; /* saved first line */ + int cc_start; /* untersuchte Spalte */ + unsigned char *mp= /* Match Pointer */ + (unsigned char *) 0; + int ignore_level= -1; /* number of ignored strings ... */ + /* bracket under cursor increments level! */ + int wrapped= 0; /* 1 -> started on top once already */ + + if ((zz_start= zz_save= z_start) == (struct LINE *) 0) return -1; + cc_start= c_start; + + if (z_end != (struct LINE *) 0) wrapped= 1; /* do not allow wrapping! */ + + while (1) + switch (status) + { + case -1: +WRAPPED: + mp= mtch; + + if (*mp == '^') + { /* ^ at the beginning of the match string means that */ + /* we are looking for that pattern at beginning of the line */ + if (c_start > 0) goto MATCH_FAILED; + mp++; + } + + m_lng= 0; + status= 0; + + case 0: /* Zeichen im Match String analysieren */ + if ((m_char= (*mp++ & 0x00FF)) == 0) goto FOUND; + if (z_start == (struct LINE *) 0) + { +NOT_FOUND: + if (!wrapped + && (option & OPT_wrapscan) + && zz_save != (struct LINE *) 0 + ) + { /* T2D: wrapscan does not work yet !! */ + wrapped= 1; + + z_end= zz_save; + if (option & OPT_backward) + { + z_start= ned_find_last_line (zz_save); + c_start= z_start->lng-1; + } + else + { + z_start= ned_find_first_line (zz_save); + c_start= 0; + } + status= -1; + zz_start= z_start; + cc_start= c_start; + + ned_message_1 ("wrapped ..."); + goto WRAPPED; + } + + *z_fnd= (struct LINE *) 0; + *c_fnd= -1; + *ml= -1; + return -1; + } + + switch (m_char) + { + case 0: /* Match String am Ende: -> Zeichen gefunden */ +FOUND: + if (ignore_level != matching_ignore_level) + { + ignore_level--; + goto MATCH_FAILED; + } + *z_fnd= zz_start; + *c_fnd= cc_start; + *ml= m_lng; + return 0; + +#ifdef SONDERBEHANDLUNG + /* Wildcards usw. werden irgendwann einmal */ + /* besonders behandelt werden .... */ + case '*': if (*mp == 0) goto FOUND; + case '\\': + status= 1; /* <<<<<<<<<<<<< vorlauefig */ + break; + case '?': goto NEXT_CHARACTER; +#endif + default: + status= 1; + goto STATUS1; + } + break; + + case 1: /* Zeichen im Text vergleichen */ +STATUS1: + /* T2D: inlining get_txt koennte hier einiges an */ + /* Geschwindigkeit rausholen, da das Duchsteppen */ + /* des txt Pointers wegfallen wuerde. 1998-08-16 */ + t_char= get_txt (z_start, c_start); + + if (option & OPT_upper) + { /* Option u (Uppercase): kein Case-Checking */ + if (t_char >= 'A' && t_char <= 'Z') t_char = t_char - 'A' + 'a'; + if (m_char >= 'A' && m_char <= 'Z') m_char = m_char - 'A' + 'a'; + } + + if (ignore != (unsigned char *) 0 && t_char == *ignore) + ignore_level++; + + if (t_char != m_char) + { /* auf eine neues; Zeichen passen nicht zusammen */ +MATCH_FAILED: + if (option & OPT_backward) + { + if (--cc_start < 0) + { + if (z_start == z_end + || (zz_start= zz_start->prev) == (struct LINE *) 0 + ) goto NOT_FOUND; + + cc_start= zz_start->lng -1; + } + } + else + { + if (++cc_start >= zz_start->lng) + { + if (z_start == z_end + || (zz_start= zz_start->next) == (struct LINE *) 0 + ) goto NOT_FOUND; + + cc_start= 0; + } + } + + z_start= zz_start; + c_start= cc_start; + status= -1; + } + else + { + m_lng++; + status= 0; /* naechstes Zeichen */ + if (option & OPT_backward) + { + if (c_start == 0 && + (*mp & 0x00FF) == 0) /* backward search where matchng */ + goto FOUND; /* string is at the begin of line */ + + if (--c_start < 0) + { + if (*mp) goto MATCH_FAILED; + if (z_start == z_end + || (z_start= z_start->prev) == (struct LINE *) 0 + ) goto NOT_FOUND; + + c_start= z_start->lng -1; + status= -1; + } + } + else + { + if (++c_start >= z_start->lng) + { /* at the end of the line, check if match string is at the */ + /* end too, if not, the match failed unless the remaining */ + /* match string is just a '$' */ + + if (*mp == 0 || (*mp == '$' && mp [1] == 0)) goto FOUND; + if (*mp) goto MATCH_FAILED; + + if (z_start == z_end + || (z_start= z_start->next) == (struct LINE *) 0 + ) goto NOT_FOUND; + + c_start= 0; + status= -1; + } + } + } + break; + } + + return -1; +} diff --git a/app/ned/11/ned1106.c b/app/ned/11/ned1106.c new file mode 100644 index 0000000000000000000000000000000000000000..bf102280a705ebb8cda109c5077ed3ecf26deff4 --- /dev/null +++ b/app/ned/11/ned1106.c @@ -0,0 +1,138 @@ +/* + * FILE %ned/11/ned1106.c + * + * written: 1991 02 02 + * 1991 12 31: revision and bug fix + * 1992 01 02: extension: find matching, higher level + * or lower level bracket + * latest update: 1997-06-13 13:36:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/window.h> +#include "ed.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +#define N_BRACKETS 10 +static unsigned char brackets[] = "()[]{}<>\256\257"; + +/* ------------------------------------------------------------------------ */ +int ned_is_bracket (int chx) +{ + int i; + + for (i= 0; i < N_BRACKETS; i++) + if ((int) brackets [i] == chx) return 1; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_find_bracket (int mode) +{ + int i; + int chx; + unsigned char search [10]; + unsigned char ignore [10]; + struct LINE *z_fnd; + int c_start; + int c_fnd; + int m_lng; + int match_level= 0; + int direction= 0x0000; /* 0 | OPT_backward */ + int search_valid= 0; /* 1 -> we can search */ + + if ((chx= get_txt (aw->WC_act, c_start= aw->cx + aw->hv - aw->ax)) == -1) + return -1; + + if (chx == '/' || chx == '*') + { + int chx_pre; + int chx_post; + + chx_pre= get_txt (aw->WC_act, c_start-1); + chx_post= get_txt (aw->WC_act, c_start+1); + + if ((chx == '/' && chx_post == '*') || (chx == '*' && chx_pre == '/')) + { /* opening c comment found */ + search_valid= 1; + strcpy ((char *) search, "*/"); + } + + if ((chx == '/' && chx_pre == '*') || (chx == '*' && chx_post == '/')) + { /* closing c comment found */ + search_valid= 1; + strcpy ((char *) search, "*/"); /* reversed string! */ + direction= OPT_backward; + } + + ignore [0]= 0; + match_level= -1; + goto DO_SEARCH; + } + + for (i= 0; i < N_BRACKETS; i++) + if ((int) brackets [i] == chx) + { + switch (mode) + { + case 1: /* matching bracket */ + search [0]= brackets [(i%2) ? i-1 : i+1]; + ignore [0]= (unsigned char) chx; + match_level= 0; + direction= (i%2) ? OPT_backward : 0x0000; + break; + + case 2: /* higher bracket */ + ignore [0]= brackets [(i%2) ? i-1 : i+1]; + search [0]= (unsigned char) chx; + match_level= -2; + direction= (i%2) ? OPT_backward : 0x0000; + break; + + case 3: /* lower bracket */ + ignore [0]= brackets [(i%2) ? i-1 : i+1]; + search [0]= (unsigned char) chx; + match_level= -2; + direction= (i%2) ? 0x0000 : OPT_backward; + break; + + default: + return -1; + } + + search [1]= 0; + ignore [1]= 0; + search_valid= 1; + } + + if (!search_valid) + { + /* T2D */ + } + +DO_SEARCH: + if (search_valid) + { + if (ned_str_match (aw->WC_act, c_start, (struct LINE *) 0, + search, ignore, match_level, + &z_fnd, &c_fnd, &m_lng, + direction) == 0) + { + aw->WC_act= z_fnd; + aw->cx= c_fnd - aw->hv + aw->ax; + ned_w_jmp_aktline (aw, NEDJMP_LINE_MID, 0, NEDJMP_FLAG_REDRAW); + } + return 0; + } + + return -1; +} diff --git a/app/ned/11/ned1107.c b/app/ned/11/ned1107.c new file mode 100644 index 0000000000000000000000000000000000000000..e4f5c773e052a1ae3970ad32023c6e62f94bc879 --- /dev/null +++ b/app/ned/11/ned1107.c @@ -0,0 +1,21 @@ +/* + * FILE %ned/11/ned1107.c + * + * written: 1991 02 02 + * 1991 12 31: revision and bug fix + * latest update: 1996-12-29 17:06:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_find_matching_bracket () +{ + ned_find_bracket (1); +} diff --git a/app/ned/11/ned1108.c b/app/ned/11/ned1108.c new file mode 100644 index 0000000000000000000000000000000000000000..3a961b6e860b5eac83beaae20e4e620cd24d33a9 --- /dev/null +++ b/app/ned/11/ned1108.c @@ -0,0 +1,20 @@ +/* + * FILE %ned/11/ned1108.c + * + * written: 1992 01 02 + * latest update: 1996-12-29 17:06:50 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_find_higher_bracket () +{ + ned_find_bracket (2); +} diff --git a/app/ned/11/ned1109.c b/app/ned/11/ned1109.c new file mode 100644 index 0000000000000000000000000000000000000000..74a41a7ac64df4797e0b314a122f507d8bd7db60 --- /dev/null +++ b/app/ned/11/ned1109.c @@ -0,0 +1,20 @@ +/* + * FILE ~/usr/ned/11/ned1109.c + * + * written: 1992 01 02 + * latest update: 1994-05-23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +void p_find_lower_bracket () +{ + ned_find_bracket (3); +} diff --git a/app/ned/11/ned1110.c b/app/ned/11/ned1110.c new file mode 100644 index 0000000000000000000000000000000000000000..0db12f301792301268bdbf8cce461b5ae52f8fe0 --- /dev/null +++ b/app/ned/11/ned1110.c @@ -0,0 +1,142 @@ +/* + * FILE %ned/11/ned1110.c + * + * Text search and replace functions + * see: C API documentation + * + * written: 1996-05-17 + * latest update: 1998-08-16 12:40:27 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#define __strrev_undefined__ +#include <gg/strings.h> +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +/* ------------------------------------------------------------------------ */ +int ned_wc_find_replace ( +struct WINDOWCTRL *wc, +struct LINE *z_start, +int c_start, +struct LINE *z_end, +int c_end, +int blck_mode, /* ???? */ +int option, +int find_replace, +char *find_str, +char *repl_str, +int repeat_within_line, +int repeat_counter, +struct MARKER *m_fnd) +{ + struct LINE *z_fnd; /* line where search hit target */ + int c_fnd; /* column where search hit target */ + int ovrins_store; /* Puffer fuer OVR INS Modus Flag */ + int disp_insert; /* 1 -> Display bei insert */ + int aktion; /* Ersetzung durchfuehren ja/nein */ + int m_lng; /* length of matched target */ + int something_found= 0; /* >1 -> something was found */ + int scr_ref= 1; /* Bildschirm neu aufbauen ?? */ + int i, j; + +#ifdef MSDOS + c_end; blck_mode; repeat_within_line; +#endif /* MSDOS */ + + ovrins_store= wc->ins_flg; + wc->ins_flg= INSFLG_insert; + + /* reverse find string again, when reverse search option is used */ + if (option & OPT_backward) strrev (find_str); + + for (; repeat_counter > 0; repeat_counter--) + { + ned_message_2 ("searching ", find_str); + if (ned_str_match (z_start, c_start, z_end, + (unsigned char *) find_str, + (unsigned char *) 0, + -1, &z_fnd, &c_fnd, &m_lng, option) == 0 + ) + { + if (m_fnd != (struct MARKER *) 0) + ned_set_marker2 (wc, z_fnd, c_fnd, m_fnd); + + wc->WC_act= z_fnd; + wc->cx= c_fnd - wc->hv + wc->ax; + if (option & OPT_backward) wc->cx -= m_lng-1; + something_found++; + + switch (find_replace) + { + case 1: + /* if (!(option & OPT_backward)) wc->cx += m_lng; */ + break; + + case 2: + aktion= 1; + disp_insert= 0; + if (option & OPT_ask) + { + background (); + ned_message_1 ("Replace: (Y|N) "); + ned_w_jmp_aktline (wc, NEDJMP_LINE_MID, 0, NEDJMP_FLAG_REDRAW); + scr_ref= 0; + disp_insert= 1; + setcup (wc); + switch (test_maus ('Y', 'N', 0)) + { + case 'j': case 'J': case 0x09: + case 'y': case 'Y': case 0x19: + aktion= 1; + break; + default: + aktion= 0; + break; + case 0x1B: + case 0x15: + aktion= -1; + break; + } + } + + switch (aktion) + { + case 1: /* Ersetzung Durchfuehren */ + for (i= 0; i < m_lng; i++) ned_wc_delete (wc, disp_insert); + for (j= strlen (repl_str)-1; j>=0; j--) + ned_wc_insert (wc, repl_str [j], disp_insert); + if (!(option & OPT_backward)) wc->cx += strlen (repl_str); + break; + case 0: /* NICHT ersetzen */ + if (!(option & OPT_backward)) wc->cx += m_lng; + break; + case -1: /* Abbrechen */ + goto AUS; + } + break; + } + } + else break; + + z_start= wc->WC_act; + c_start= wc->cx + wc->hv - wc->ax; + } + + /* reverse find string again, when searching backwards */ + /* was used to get back original find string ... */ + if (option & OPT_backward) strrev (find_str); + +AUS: + wc->ins_flg= ovrins_store; + if (scr_ref) ned_w_jmp_aktline (wc, NEDJMP_LINE_MID, 0, NEDJMP_FLAG_REDRAW); + + return something_found; +} diff --git a/app/ned/11/ned1111.c b/app/ned/11/ned1111.c new file mode 100644 index 0000000000000000000000000000000000000000..a20326b754c119f1341f2205f0d4ae303e796fb4 --- /dev/null +++ b/app/ned/11/ned1111.c @@ -0,0 +1,77 @@ +/* + * FILE %ned/11/ned1111.c + * + * Display all lines matching some string + * + * written: 1996-10-17 + * latest update: 1998-08-19 18:57:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_all_lines ( +struct WINDOWCTRL *wc, +int use_matching_lines, /* 1 -> use matching lines, otherwise not */ +int str_cnt, /* number of strings to match */ +char *mstr[]) /* the strings themselves */ +{ + struct LINE *lp; /* currently examined text line */ + int rv= 0; /* number of matched lines */ + + if (str_cnt > 0) ned_message_3 ("all: '", mstr[0], "'"); + else + { + ned_message_1 ("all!"); + use_matching_lines= 0; + } + + if (!use_matching_lines) + wc->wflags &= ~HIDE_LINES; + else wc->wflags |= HIDE_LINES; + + for (lp= ned_find_first_line (wc->WC_act); + lp != (struct LINE *) 0; + lp= lp->next) + { + lp->line_flg &= ~LINE_HIDDEN; + +/* BEGIN this section was copied from %ned/08/ned0808.c: MATCH FEATURE LINE */ + if (use_matching_lines) /* if match strings are specified, check */ + { /* check if the current feature contains */ + int i; /* the given string, otherwise ignore */ + int rc; /* that feature. */ + int matches= 0; /* 1 -> this line matches specified string */ + int msp, mln; + struct LINE *mline; + + for (i= 0; i < str_cnt; i++) + { + rc= ned_str_match (lp, 0, lp, + (unsigned char *) mstr [i], + (unsigned char *) 0, -1, + &mline, &msp, &mln, 0); + + if (rc == 0) + { + matches= 1; + break; + } + } + + if ((!matches && use_matching_lines) + || (matches && !use_matching_lines) + ) + lp->line_flg |= LINE_HIDDEN; + } +/* END this section was copied from %ned/08/ned0808.c: MATCH FEATURE LINE */ + } + + return rv; +} diff --git a/app/ned/11/ned1112.c b/app/ned/11/ned1112.c new file mode 100644 index 0000000000000000000000000000000000000000..58297f5aba071e4f16712a51c42f9e201baedbbd --- /dev/null +++ b/app/ned/11/ned1112.c @@ -0,0 +1,58 @@ +/* + * FILE %ned/11/ned1112.c + * + * Text search and replace functions + * see: C API documentation + * + * written: 1997-01-06 + * latest update: 1997-09-07 13:22:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <gg/strings.h> +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +/* ------------------------------------------------------------------------ */ +int ned_lp_find_str ( +struct WINDOWCTRL *wc, +struct LINE *lp, +char *mstr, +int option, +int cnt, +int skip) +{ + int rc= 0; + int msp, mln; + struct LINE *mline; + + msp= get_coln (wc); + if (option & OPT_backward) msp--; else msp++; + msp -= skip; + + for (; cnt > 0; cnt--) + { + rc= ned_str_match (lp, msp, lp, + (unsigned char *) mstr, + (unsigned char *) 0, + -1, &mline, &msp, &mln, option); + } + + if (rc == 0) + { /* string was found */ + + wc->WC_act= mline; + wc->cx= msp - wc->hv + wc->ax + skip; + + /*** if (option & OPT_backward) wc->cx -= mln-1; ***/ + } + + return rc; +} diff --git a/app/ned/11/ned1112v.c b/app/ned/11/ned1112v.c new file mode 100644 index 0000000000000000000000000000000000000000..a87c49afefd59e0ec58cd54fe39fd2ed32ebcefa --- /dev/null +++ b/app/ned/11/ned1112v.c @@ -0,0 +1,85 @@ +/* + * FILE %ned/11/ned1112v.c + * + * search for a string in the current line + * called from vi_dkey () + * + * Text search and replace functions + * see: C API documentation + * + * written: 1997-01-06 + * latest update: 1997-01-15 13:24:14 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "proto.h" +#include <gg/window.h> + +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +#define MAX_MSTR 10 +static char mstr2 [MAX_MSTR]; +static int option= 0x00; +static int skip= 0; + +/* ------------------------------------------------------------------------ */ +int ned_vi_wc_find_str ( +struct WINDOWCTRL *wc, +char *mstr, +int cnt, +int mode) +{ + if (wc == (struct WINDOWCTRL *) 0) return -1; + +#ifdef USE_TK + tk_resetcup (); +#endif + skip= 0; + option= 0; + + switch (mode) + { + case 't': + skip= -1; + break; + + case 'T': + skip= +1; + case 'F': + option |= OPT_backward; + break; + } + + strcpy_max (mstr2, mstr, MAX_MSTR); + return ned_lp_find_str (wc, wc->WC_act, mstr, option, cnt, skip); +} + +/* ------------------------------------------------------------------------ */ +void ned_vi_find_next () +{ +#ifdef USE_TK + tk_resetcup (); +#endif + + if (aw != (struct WINDOWCTRL *) 0 + && ned_lp_find_str (aw, aw->WC_act, mstr2, option, 1, skip) == -1 + ) + vi_bell (); +} + +/* ------------------------------------------------------------------------ */ +void ned_vi_find_next_rev () +{ + option= (option & OPT_backward) ? 0 : OPT_backward; + skip *= -1; + + ned_vi_find_next (); +} diff --git a/app/ned/11/ned1112w.c b/app/ned/11/ned1112w.c new file mode 100644 index 0000000000000000000000000000000000000000..ec89c69d4d8ffb9dd9725fe44705f4c4111d131e --- /dev/null +++ b/app/ned/11/ned1112w.c @@ -0,0 +1,60 @@ +/* + * FILE %ned/11/ned1112w.c + * + * Text search and replace functions + * see: C API documentation + * + * written: 1997-01-06 + * latest update: 1997-01-08 21:39:20 + * $Id: ned1112w.c,v 1.2 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#else +#include <gg/strings.h> +#endif + +#include <string.h> +#include "ed.h" +#include "proto.h" +#include <gg/window.h> +#ifdef USE_MOUSE +#include <gg/maus.h> +#else +extern ned_input_handler *nextchar; +#endif + +extern struct WINDOWCTRL *aw; +extern int key; + +/* ------------------------------------------------------------------------ */ +void ned_ws_aw_find_str () +{ + int first_key; + char key_str [2]; + + switch (key) + { + case 0x07: case 'G': case 'g': + first_key= 'f'; + break; + case 0x08: case 'H': case 'h': + first_key= 'F'; + break; + default: + return; + } + +#ifdef USE_MOUSE + key= ned_check_mouse (); +#else + key= (*nextchar) (); +#endif + + key_str [0]= (char) key; + key_str [1]= 0; + + if (ned_vi_wc_find_str (aw, key_str, 1, first_key) == -1) vi_bell (); +} diff --git a/app/ned/11/ned1113.c b/app/ned/11/ned1113.c new file mode 100644 index 0000000000000000000000000000000000000000..b3ef9eb34447fd539ef9af41d8a8b83609f4cbc3 --- /dev/null +++ b/app/ned/11/ned1113.c @@ -0,0 +1,84 @@ +/* + * FILE %ned/11/ned1113.c + * + * Text search and replace functions + * see: C API documentation + * + * written: 1997-01-12 + * latest update: 1998-08-16 19:15:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include "ed.h" +#include "proto.h" + +static int ignore_case= 0; +static int wrapscan= 1; + +/* ------------------------------------------------------------------------ */ +int ned_jmp_pattern ( +struct WINDOWCTRL *wc, +struct LINE *lp, +char *pattern, +int back) +{ + int options= 0; + + ned_set_marker (wc, '/'); + if (pattern != (char *) 0) ned_save_search_string (pattern); + + if (back) options |= OPT_backward; + if (ignore_case) options |= OPT_upper; + if (wrapscan) options |= OPT_wrapscan; + + ned_save_search_options (options); + + return ned_wc_find_replace (wc, lp, get_coln(wc), + (struct LINE *) 0, 12345, 0, + options, 1, pattern, (char *) 0, 1, 1, + ned_get_marker ('9', 1)); +} + +/* ------------------------------------------------------------------------ */ +int ned_jmp_complex ( +struct WINDOWCTRL *wc, +int jmp_line, +char *jmp_pattern) +{ + if (jmp_line > 0) ned_jmp_2line_by_nr (wc, jmp_line, 0x00); + + if (jmp_pattern != (char *) 0) + { + int opt; + opt= (*jmp_pattern == '?') ? OPT_backward : 0; + + ned_jmp_pattern (wc, (jmp_line > 0) + ? wc->WC_act + : ((opt) + ? ned_find_last_line (wc->WC_act) + : ned_find_first_line (wc->WC_act)), + jmp_pattern+1, opt); + jmp_pattern= (char *) 0; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int vi_find (struct WINDOWCTRL *wc, int back) +{ + char *pattern; + + if ((pattern= ned_prompt_find ((back) ? "?" : "/")) == (char *) 0) + return -1; + + return ned_jmp_pattern (wc, wc->WC_act, pattern, back); +} + +/* ------------------------------------------------------------------------ */ +void ned_set_ic (int mode) { ignore_case= mode; } +void ned_set_wrapscan (int mode) { wrapscan= mode; } diff --git a/app/ned/12/(dirinf).fm b/app/ned/12/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..3b8c17c0aec3659ae6415f4d191f4dc46ae1619b --- /dev/null +++ b/app/ned/12/(dirinf).fm @@ -0,0 +1,24 @@ +# +# FILE %ned/12/(dirinf).fm +# +# written: 1995-12-12 +# latest update: 1997-08-04 8:47:36 +# +Makefile | active Makefile (DOS or Unix) +make-dos | DOS Makefile +make-ux | UNIX Makefile + +ned1201.c | create new context +ned1202.c | initialize context +ned1203.c | destroy context +ned1204.c | add new {crf,lib,tag,ftr}-item to context +ned1204b.c | add new set of {crf,lib,tag,ftr}-items to context +ned1205.c | add new tagging rule to context +ned1206.c | get first cross reference cluster name +ned1207.c | push current input handler to stack +ned1208.c | pop input handler from stack +ned1209.c | **OBS** int ned_add_tag_file (...) +ned1210.c | **OBS** int ned_add_feature_table (...) +ned1211.c | int ned_create_field_context +ned1299.c | int ned_diag_argv (int argc, char *argv []) +* | diff --git a/app/ned/12/Makefile b/app/ned/12/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..ab52397f1be70c292b89fb854e847e62784aed57 --- /dev/null +++ b/app/ned/12/Makefile @@ -0,0 +1,33 @@ +# +# FILE %ned/12/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# +# written: 1995-12-12 +# latest update: 1999-05-06 16:27:04 +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-c -g -I.. $(cf) +CC=cc + +objs= ned1201.o ned1202.o ned1203.o ned1204.o ned1204b.o ned1205.o \ + ned1206.o ned1207.o ned1208.o ned1299.o + +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_cur lib_tk +clean : + rm -f *.o lib_tk lib_cur + +lib_tk : $(objs_tk) $(objs) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h + $(CC) $(OPTS) -c $*.c diff --git a/app/ned/12/contrib b/app/ned/12/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/12/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/12/gg b/app/ned/12/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/12/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/12/lib_cur b/app/ned/12/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/12/lib_tk b/app/ned/12/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/12/make-dos b/app/ned/12/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..5a8024c5b4cc8dddcb574ec0bfa1d83f4dee0c10 --- /dev/null +++ b/app/ned/12/make-dos @@ -0,0 +1,22 @@ +# +# FILE %ned/12/makefile +# +# GG's Night(mare) Editor System +# +# written: 1995-12-12 +# latest update: 1997-08-04 8:47:05 +# +# ============================================================================ +cc=cl -Os -AL /c +ccc=cl -Os -AL /Fo$@ /W3 -I.. /c +obj=objdec -m0 -w -sl 2 NED12_TEXT $@ + +lib : ! + ned1201.obj ned1202.obj ned1203.obj ned1204.obj ned1204b.obj ! + ned1205.obj ned1206.obj ned1207.obj ned1208.obj ned1211.obj ! + ned1299.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $? + $(obj) diff --git a/app/ned/12/ned1201.c b/app/ned/12/ned1201.c new file mode 100644 index 0000000000000000000000000000000000000000..ef523681b27700c98cc9e55d07191ce283f8265a --- /dev/null +++ b/app/ned/12/ned1201.c @@ -0,0 +1,29 @@ +/* + * FILE %ned/12/ned1201.c + * + * written: 1995-12-12 + * latest update: 1999-04-25 16:36:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct NED_CONTEXT *ned_create_context () +{ + struct NED_CONTEXT *ctx; + + if ((ctx= (struct NED_CONTEXT *) calloc (sizeof (struct NED_CONTEXT), 1)) + == (struct NED_CONTEXT *) 0 + ) + return (struct NED_CONTEXT *) 0; + + return ctx; +} diff --git a/app/ned/12/ned1202.c b/app/ned/12/ned1202.c new file mode 100644 index 0000000000000000000000000000000000000000..f0ea4ff9fe039412fe375208dd02924668ab96eb --- /dev/null +++ b/app/ned/12/ned1202.c @@ -0,0 +1,42 @@ +/* + * FILE %ned/12/ned1202.c + * + * written: 1995-12-12 + * latest update: 1997-04-08 8:42:21 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/hyx.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +#define ACTX(n,v) ned_add_context (ctx, (n), (v), 0) + +/* ------------------------------------------------------------------------ */ +int ned_default_context (struct NED_CONTEXT *ctx) +{ + if (ctx == (struct NED_CONTEXT *) 0) return -1; + + ctx->NED_IH_TOS= 0; /* next stack position */ + + if ( ACTX (NED_CTXitem_crf, "%crf") != 0 +#ifdef MSDOS + || ACTX (NED_CTXitem_crf, "%cl1") != 0 + || ACTX (NED_CTXitem_lib, "%lib") != 0 + || ACTX (NED_CTXitem_feature_table, "%feature") != 0 + || ACTX (NED_CTXitem_tag_file, "tags") != 0 + || ACTX (NED_CTXitem_lexicon, "%lex") != 0 + || ACTX (NED_CTXitem_thesaurus, "%thes") != 0 +#endif /* MSDOS */ + ) + return -1; + + ned_add_tag_rule (ctx, "calendar", hyx_rule_calendar, (void *) 0); + + return 0; +} diff --git a/app/ned/12/ned1203.c b/app/ned/12/ned1203.c new file mode 100644 index 0000000000000000000000000000000000000000..99e4da61315941edeab6edfa2ca35c4fbcb8c5b2 --- /dev/null +++ b/app/ned/12/ned1203.c @@ -0,0 +1,31 @@ +/* + * FILE %ned/12/ned1203.c + * + * written: 1995-12-12 + * latest update: 1999-04-25 16:36:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/strings.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_destroy_context (struct NED_CONTEXT *ctx) +{ + if (ctx == (struct NED_CONTEXT *) 0) return -1; + + array_dispose_string (ctx->NED_CTX_crf); + array_dispose_string (ctx->NED_CTX_lib); + array_dispose_string (ctx->NED_CTX_tag_files); + array_dispose_string (ctx->NED_CTX_feature_tables); + free (ctx); + + return 0; +} diff --git a/app/ned/12/ned1204.c b/app/ned/12/ned1204.c new file mode 100644 index 0000000000000000000000000000000000000000..82cf2b690605c48f62004cc8ab6be7c7fadde991 --- /dev/null +++ b/app/ned/12/ned1204.c @@ -0,0 +1,70 @@ +/* + * FILE %ned/12/ned1204.c + * + * written: 1995-12-12 + * latest update: 1999-04-25 16:36:42 + * $Id: ned1204.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_add_context ( +struct NED_CONTEXT *ctx, +int what, +const char *file_name, +int at_top) +{ + struct ARRAY_CONTROL **ac; + + if (ctx == (struct NED_CONTEXT *) 0) return -1; + + switch (what) + { + case NED_CTXitem_crf: + ac= &ctx->NED_CTX_crf; + break; + + case NED_CTXitem_lib: + ac= &ctx->NED_CTX_lib; + break; + + case NED_CTXitem_lexicon: + ac= &ctx->NED_CTX_lex; + break; + + case NED_CTXitem_thesaurus: + ac= &ctx->NED_CTX_thes; + break; + + case NED_CTXitem_tag_file: + ac= &ctx->NED_CTX_tag_files; + break; + + case NED_CTXitem_feature_table: + ac= &ctx->NED_CTX_feature_tables; + break; + + default: /* unknown item! */ + return -1; + } + + if (*ac == (struct ARRAY_CONTROL *) 0 + && (*ac= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) return -1; + + if (at_top) + array_unshift (*ac, (void *) strdup (file_name)); + else array_push (*ac, (void *) strdup (file_name)); + + return 0; +} diff --git a/app/ned/12/ned1204b.c b/app/ned/12/ned1204b.c new file mode 100644 index 0000000000000000000000000000000000000000..220fce9212636503a4ce5a90f91817543cb419a6 --- /dev/null +++ b/app/ned/12/ned1204b.c @@ -0,0 +1,98 @@ +/* + * FILE %ned/12/ned1204b.c + * + * written: 1997-08-04 + * latest update: 1999-04-25 16:36:44 + * $Id: ned1204b.c,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_add_context_list ( +struct NED_CONTEXT *ctx, +const char *argv[], +const int argc) +{ + const char *sub_command; + const char *arg; + int at_top= 0; + int item= -1; + int i; + + if (argc <= 1 + || (sub_command= argv [0]) == (char *) 0 + || *sub_command == 0 + ) + return -1; + + if (strcmp ("crf", sub_command) == 0 + || abbrev ("cross_reference", sub_command, 3) + ) + { + item= NED_CTXitem_crf; + } + else + if (abbrev ("library", sub_command, 3)) + { + item= NED_CTXitem_lib; + } + else + if (abbrev ("lexicon", sub_command, 3)) + { + item= NED_CTXitem_lexicon; + } + else + if (abbrev ("thesaurus", sub_command, 4)) + { + item= NED_CTXitem_thesaurus; + } + else + if (abbrev ("tags", sub_command, 3)) + { + item= NED_CTXitem_tag_file; + } + else + if (abbrev ("feature_table", sub_command, 4) + || abbrev ("ftr_tbl", sub_command, 3) + ) + { + item= NED_CTXitem_feature_table; + } + else + if (abbrev ("sgmltags", sub_command, 5)) + { /* not strictly a context element, but what the heck ... */ + for (i= 1; i < argc; i++) + setup_sgml_tag_descriptors (argv [i]); + return 99; + } + + if (item < 0) return -1; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (strcmp (arg, "-top") == 0 + || strcmp (arg, "-unshift") == 0 + ) at_top= 1; + else + if (strcmp (arg, "-end") == 0 + || strcmp (arg, "-push") == 0 + ) at_top= 0; + else + ned_add_context (ctx, item, arg, at_top); + } + + return item; +} diff --git a/app/ned/12/ned1205.c b/app/ned/12/ned1205.c new file mode 100644 index 0000000000000000000000000000000000000000..4d00299e1f076fe641ae92ea883d6e3132c66da8 --- /dev/null +++ b/app/ned/12/ned1205.c @@ -0,0 +1,43 @@ +/* + * FILE %ned/12/ned1205.c + * + * written: 1995-12-12 + * latest update: 1999-04-25 16:36:49 + * $Id: ned1205.c,v 1.3 2005/09/04 20:17:27 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_add_tag_rule ( +struct NED_CONTEXT *ctx, +const char *rule_name, +NED_tag_rule *tr, +void *client_data) +{ + struct NED_TAG_RULE_DESCRIPTOR *trd; + + if (ctx == (struct NED_CONTEXT *) 0 + || tr == (NED_tag_rule *) 0 + || (trd= (struct NED_TAG_RULE_DESCRIPTOR *) + calloc (sizeof (struct NED_TAG_RULE_DESCRIPTOR), 1)) + == (struct NED_TAG_RULE_DESCRIPTOR *) 0 + ) return -1; + + if (rule_name != (char *) 0) trd->name= strdup (rule_name); + trd->tr= tr; + trd->client_data= client_data; + + array_push2 (&ctx->NED_CTX_tag_rules, (void *) trd); + + return 0; +} diff --git a/app/ned/12/ned1206.c b/app/ned/12/ned1206.c new file mode 100644 index 0000000000000000000000000000000000000000..e2e2bcbe7c8a6805c0a8b7c3318d3d082093bec1 --- /dev/null +++ b/app/ned/12/ned1206.c @@ -0,0 +1,69 @@ +/* + * FILE %ned/12/ned1206.c + * + * written: 1995-12-12 + * latest update: 1996-12-03 17:11:09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +char *ned_get_context (struct NED_CONTEXT *ctx, int what) +{ + struct ARRAY_CONTROL *ac; + struct ARRAY_ELEMENT *e_crf; + char *crf; + + if (ctx == (struct NED_CONTEXT *) 0) return (char *) 0; + + switch (what) + { + case NED_CTXitem_crf: + ac= ctx->NED_CTX_crf; + break; + + case NED_CTXitem_lib: + ac= ctx->NED_CTX_lib; + break; + + case NED_CTXitem_lexicon: + ac= ctx->NED_CTX_lex; + break; + + case NED_CTXitem_thesaurus: + ac= ctx->NED_CTX_thes; + break; + + case NED_CTXitem_tag_file: + ac= ctx->NED_CTX_tag_files; + break; + + case NED_CTXitem_feature_table: + ac= ctx->NED_CTX_feature_tables; + break; + + default: + return (char *) 0; + } + + if (ac == (struct ARRAY_CONTROL *) 0) return (char *) 0; + + for (e_crf= ac->top; + e_crf != (struct ARRAY_ELEMENT *) 0; + e_crf= e_crf->next) + { + if ((crf= (char *) e_crf->payload) != (char *) 0 + && *crf != 0 + ) return crf; + } + + return (char *) 0; +} diff --git a/app/ned/12/ned1207.c b/app/ned/12/ned1207.c new file mode 100644 index 0000000000000000000000000000000000000000..bca11a2a72d2e51f0e1b0b3aae914eb48b474095 --- /dev/null +++ b/app/ned/12/ned1207.c @@ -0,0 +1,39 @@ +/* + * FILE %ned/12/ned1207.c + * + * push input handler to stack and return number of elements on stack + * + * written: 1996-01-31 22:47:32 + * latest update: 1996-11-10 1:06:37 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_push_input_handler ( +struct NED_CONTEXT *ctx, +ned_input_handler *ih, +void *client_data) +{ + int tos; + + if (ctx == (struct NED_CONTEXT *) 0 + || (tos= ctx->NED_IH_TOS) >= NED_IH_SIZE + || tos < 0 + ) return -1; + + ctx->NED_input_stack [tos]= ih; + ctx->NED_input_stack_cd [tos]= client_data; + tos++; + ctx->NED_IH_TOS= tos; + + return tos; +} diff --git a/app/ned/12/ned1208.c b/app/ned/12/ned1208.c new file mode 100644 index 0000000000000000000000000000000000000000..25dbefa8bbca411167fbbb6edec266e0f1644ff9 --- /dev/null +++ b/app/ned/12/ned1208.c @@ -0,0 +1,40 @@ +/* + * FILE %ned/12/ned1208.c + * + * pop input handler from stack and return number of elements on stack + * + * written: 1996-01-31 + * latest update: 1997-06-13 13:40:13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_pop_input_handler ( +struct NED_CONTEXT *ctx, +ned_input_handler **ih, +void **client_data) +{ + int tos; + + if (ctx == (struct NED_CONTEXT *) 0 + || ih == (ned_input_handler **) 0 + || client_data == (void **) 0 + || (tos= ctx->NED_IH_TOS) <= 0 + ) return -1; + + tos--; + *ih= ctx->NED_input_stack [tos]; + *client_data= ctx->NED_input_stack_cd [tos]; + ctx->NED_IH_TOS= tos; + + return tos; +} diff --git a/app/ned/12/ned1209.c b/app/ned/12/ned1209.c new file mode 100644 index 0000000000000000000000000000000000000000..c439f5aa89d7bb6c06edfe6d362a50bc0d56fc48 --- /dev/null +++ b/app/ned/12/ned1209.c @@ -0,0 +1,27 @@ +/* + * FILE %ned/12/ned1209.c + * + * written: 1996-05-25 + * latest update: 1996-11-10 1:14:02 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_add_tag_file ( +struct NED_CONTEXT *ctx, +char *tag_name) +{ + if (ctx == (struct NED_CONTEXT *) 0) return -1; + array_push2_dup (&ctx->NED_CTX_tag_files, tag_name); + + return 0; +} diff --git a/app/ned/12/ned1210.c b/app/ned/12/ned1210.c new file mode 100644 index 0000000000000000000000000000000000000000..92254b293c46b13219e3fc48f742b56267d89222 --- /dev/null +++ b/app/ned/12/ned1210.c @@ -0,0 +1,29 @@ +/* + * FILE %ned/12/ned1210.c + * + * add a feature table file to the current editor context + * + * written: 1996-05-25 + * latest update: 1996-11-10 1:15:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include "ed.h" +#include "edctx.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_add_feature_table ( +struct NED_CONTEXT *ctx, +char *feature_table) +{ + if (ctx == (struct NED_CONTEXT *) 0) return -1; + array_push2_dup (&ctx->NED_CTX_feature_tables, feature_table); + + return 0; +} diff --git a/app/ned/12/ned1211.c b/app/ned/12/ned1211.c new file mode 100644 index 0000000000000000000000000000000000000000..93381b76f6baf982c0efb70366539367223fabce --- /dev/null +++ b/app/ned/12/ned1211.c @@ -0,0 +1,74 @@ +/* + * FILE %ned/12/ned1211.c + * + * written: 1996-07-07 + * latest update: 1999-04-25 16:36:51 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +struct NED_FIELD_CONTEXT *ned_create_field_context ( +char *buffer, +int buffer_size, +int buffer_mode) +{ + struct NED_FIELD_CONTEXT *fc; + char *my_buffer; + int i; + + if ((fc= (struct NED_FIELD_CONTEXT *) + calloc (sizeof (struct NED_FIELD_CONTEXT), 1)) + != (struct NED_FIELD_CONTEXT *) 0 + ) + { + if (buffer == (char *) 0) buffer_mode= FCbm_allocate; + switch (buffer_mode) + { + case FCbm_allocate: + if ((my_buffer= malloc (buffer_size + 1)) != (char *) 0) + { + my_buffer [0]= 0; + buffer_mode= FCbm_dynamic; + } + break; + + case FCbm_volatile: + if ((i= strlen (buffer)) > buffer_size) buffer_size= i; + if ((my_buffer= malloc (buffer_size + 1)) != (char *) 0) + { + strcpy (my_buffer, buffer); + buffer_mode= FCbm_dynamic; + } + break; + + case FCbm_static: + my_buffer= buffer; + break; + + case FCbm_dynamic: + my_buffer= buffer; + break; + + default: + return (struct NED_FIELD_CONTEXT *) 0; + } + + if (my_buffer == (char *) 0) + return (struct NED_FIELD_CONTEXT *) 0; + + fc->buffer= my_buffer; + fc->buffer_size= buffer_size; + fc->buffer_mode= buffer_mode; + } + + return fc; +} diff --git a/app/ned/12/ned1299.c b/app/ned/12/ned1299.c new file mode 100644 index 0000000000000000000000000000000000000000..96d591eaaa248cc73b4c965abae9742960fd3e55 --- /dev/null +++ b/app/ned/12/ned1299.c @@ -0,0 +1,23 @@ +/* + * FILE %ned/12/ned1299.c + * + * NED's diagnostic stuff + * + * written: 1996-07-22 + * latest update: 1996-07-22 10:23:57 + * + */ + +#include <stdio.h> + +/* ------------------------------------------------------------------------ */ +int ned_diag_argv (int argc, char *argv []) +{ + int i; + + fprintf (stderr, "argc=%d\n", argc); + for (i= 0; i < argc; i++) + fprintf (stderr, "argv [%d]= '%s'\n", i, argv [i]); + + return 0; +} diff --git a/app/ned/13/(dirinf).fm b/app/ned/13/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..239ebade33ca706c3e03486ea08b43818178eecb --- /dev/null +++ b/app/ned/13/(dirinf).fm @@ -0,0 +1,18 @@ +# +# FILE %ned/13/(dirinf).fm +# +# written: 1997-08-03 +# latest update: 1997-08-03 15:48:08 +# $Id: (dirinf).fm,v 1.3 2002/06/10 06:17:42 gonter Exp $ +# +Makefile | active Makefile (DOS or Unix) +make-dos | DOS Makefile +make-ux | UNIX Makefile + +ned1301.c | text to sgml +ned1302.c | sgml to text +ned1303.c | ned_debug_info + +ned1391.c | message handling +ned1392.c | blind definitions +* | diff --git a/app/ned/13/Makefile b/app/ned/13/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..070c8a1a265c972ffce769316cb0fc620e111cb2 --- /dev/null +++ b/app/ned/13/Makefile @@ -0,0 +1,34 @@ +# +# FILE %ned/13/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# +# written: 1997-08-03 +# latest update: 2000-08-24 15:22:29 +# $Id: Makefile,v 1.5 2000/12/09 17:31:07 gonter Exp $ +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-c -g -I.. $(cf) +CC=cc + +objs1= ned1301.o ned1302.o ned1303.o +objs2= ned1391.o ned1392.o + +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_cur lib_tk $(objs2) +clean : + rm -f *.o lib_tk lib_cur + +lib_tk : $(objs_tk) $(objs1) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs1) + ar ru $(lib_cur) $? + touch lib_cur + +.c.o: ../ed.h + $(CC) $(OPTS) -c $*.c diff --git a/app/ned/13/contrib b/app/ned/13/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/13/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/13/gg b/app/ned/13/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/13/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/13/lib_cur b/app/ned/13/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/13/lib_tk b/app/ned/13/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/13/make-dos b/app/ned/13/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..95326ee3b752ede009f2561efc75b7e6f1e0bdcb --- /dev/null +++ b/app/ned/13/make-dos @@ -0,0 +1,21 @@ +# +# FILE %ned/13/make-dos +# +# GG's Night(mare) Editor System +# +# written: 1997-08-03 +# latest update: 1997-08-04 12:33:08 +# +# ============================================================================ +cc=cl -Os -AL /c +ccc=cl -Os -AL /Fo$@ /W3 -I.. /c +obj=objdec -m0 -w -sl 2 NED13_TEXT $@ + +lib : ! + ned1301.obj ned1302.obj ! + ned1391.obj ned1392.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $? + $(obj) diff --git a/app/ned/13/ned1301.c b/app/ned/13/ned1301.c new file mode 100644 index 0000000000000000000000000000000000000000..baabd1f3230dc733030a63789402459313c63173 --- /dev/null +++ b/app/ned/13/ned1301.c @@ -0,0 +1,66 @@ +/* + * FILE %ned/13/ned1301.c + * + * written: 1997-08-03 + * latest update: 1999-04-25 16:36:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_text_to_sgml ( +char *fnm_txt, +char *fnm_ftr, +char *fnm_sgml, +int f_append) /* 1 -> overwrite file; 0 -> append */ +{ + struct LINE *la, *lb; + struct WINDOWCTRL wc; /* temporary window */ + int flg2= 0; + int rc; + long la_offset; + long lb_offset; + + wdw_rst (&wc); + + rc= ned_f_read (&wc, + fnm_txt, fnm_ftr, + 1, /* f_rd_ftr */ + &la, &lb, + 0L, 0x7FFFFFFFL); + + printf ("reading (%s): rc=%d\n", fnm_txt, rc); + + if (la == (struct LINE *) 0 || lb == (struct LINE *) 0) + { /* READ ERROR */ + printf ("File not found! (ESC)"); + return -1; + } + + wc.file_format= FMT_SGML; + if (f_append) flg2 |= FLG2_append_mode; + + rc= ned_f_write (&wc, + fnm_sgml, (char *) 0, + 0, /* f_wr_ftr */ + 0, /* lz_flg */ + la, lb, + &la_offset, &lb_offset, + flg2); + + printf ("writing (%s): rc=%d\n", fnm_sgml, rc); + printf (" begin=0x%08lX end=0x%08lX bytes=%ld\n", + la_offset, lb_offset, lb_offset-la_offset+1); + + ned_lines_free (la); /* T2D: more memory leaks?? */ + + return 0; +} diff --git a/app/ned/13/ned1302.c b/app/ned/13/ned1302.c new file mode 100644 index 0000000000000000000000000000000000000000..b8919adcd98c31f23fa3e6b0450f8b9f85aa8e98 --- /dev/null +++ b/app/ned/13/ned1302.c @@ -0,0 +1,64 @@ +/* + * FILE %ned/13/ned1302.c + * + * written: 1997-08-04 + * latest update: 1999-04-25 16:36:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include "ed.h" +#include "proto.h" + +/* ------------------------------------------------------------------------ */ +int ned_sgml_to_text ( +char *fnm_txt, +char *fnm_ftr, +char *fnm_sgml) +{ + struct LINE *la, *lb; + struct WINDOWCTRL wc; /* temporary window */ + int flg2= 0; + int rc; + long la_offset; + long lb_offset; + + wdw_rst (&wc); + + wc.file_format= FMT_SGML; + rc= ned_f_read (&wc, + fnm_sgml, (char *) 0, + 0, /* f_rd_ftr */ + &la, &lb, + 0L, 0x7FFFFFFFL); + + printf ("reading (%s): rc=%d\n", fnm_txt, rc); + + if (la == (struct LINE *) 0 || lb == (struct LINE *) 0) + { /* READ ERROR */ + printf ("File not found! (ESC)"); + return -1; + } + + wc.file_format= FMT_ASCII; + rc= ned_f_write (&wc, + fnm_txt, fnm_ftr, + 1, /* f_wr_ftr */ + 0, /* lz_flg */ + la, lb, + &la_offset, &lb_offset, + flg2); + + printf ("writing (%s): rc=%d\n", fnm_sgml, rc); + printf (" begin=0x%08lX end=0x%08lX bytes=%ld\n", + la_offset, lb_offset, lb_offset-la_offset+1); + + ned_lines_free (la); /* T2D: more memory leaks?? */ + + return 0; +} diff --git a/app/ned/13/ned1303.c b/app/ned/13/ned1303.c new file mode 100644 index 0000000000000000000000000000000000000000..7f8dc7f4f56e170c24b60162f8e1e166d925f46e --- /dev/null +++ b/app/ned/13/ned1303.c @@ -0,0 +1,136 @@ +/* + * FILE %ned/13/ned1303.c + * + * written: 2000-12-09 + * latest update: 2001-02-11 14:06:21 + * $Id: ned1303.c,v 1.3 2003/10/01 21:51:06 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include "ed.h" +#include "edhyx.h" +#include "proto.h" + +extern struct WINDOWCTRL *aw; +extern struct WINDOWCTRL *windows; +extern struct FILECTRL *files; + +/* ------------------------------------------------------------------------ */ +int ned_debug_info (char *p1) +{ + printf ("\n--- BEGIN -----------------------\nned_debug_info: %s\n", p1); + + if (strcmp (p1, "W") == 0) + { + ned_debug_windowctrl (stdout, aw); + } + else if (strcmp (p1, "W*") == 0) + { + struct WINDOWCTRL *wc; + for (wc= windows; wc != (struct WINDOWCTRL *) 0; wc= wc->WC_next) + ned_debug_windowctrl (stdout, wc); + } + else if (strcmp (p1, "F*") == 0) + { + struct FILECTRL *fc; + for (fc= files; fc != (struct FILECTRL *) 0; fc= fc->FC_next) + ned_debug_filectrl (stdout, fc); + } + else if (strcmp (p1, "C*") == 0) + { + struct CLUSTERCTRL *cc; + for (cc= ned_get_cluster_list (); + cc != (struct CLUSTERCTRL *) 0; + cc= cc->FC_next) + ned_debug_clusterctrl (stdout, cc); + } + else if (strcmp (p1, "T") == 0) + { + print_virtual_filename_table (stdout); + } + else if (strcmp (p1, "TF") == 0) + { + flush_virtual_filename_table (stdout); + ned_init_virtual_filename_table (); + } + else return -1; + printf ("--- END -------------------------\n"); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_debug_windowctrl (FILE *fp, struct WINDOWCTRL *wc) +{ + fprintf (fp, "WINDOWCTRL=0x%08lX\n", wc); + fprintf (fp, "title_short='%s'\n", wc->WC_title_short); + fprintf (fp, "title_long='%s'\n", wc->WC_title_long); + fprintf (fp, "file_or_frame=0x%08lX file_type=%d file_format=%d\n", + wc->file_or_frame, wc->file_type, wc->file_format); + fprintf (fp, "ax=%d ay=%d bx=%d by=%d cx=%d cy=%d\n", + wc->ax, wc->ay, wc->bx, wc->by, wc->cx, wc->cy); + + if (wc->file_type == FTY_PLAIN) + ned_debug_filectrl (fp, (struct FILECTRL *) wc->file_or_frame); + else if (wc->file_type == FTY_HYPER) + ned_debug_framectrl (fp, (struct FRAMECTRL *) wc->file_or_frame, 0); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_debug_filectrl (FILE *fp, struct FILECTRL *fc) +{ + fprintf (fp, "FILECTRL=0x%08lX\n", fc); + fprintf (fp, "fnm_txt='%s'\n", fc->FC_fnm_txt); + fprintf (fp, "fnm_ftr='%s'\n", fc->FC_fnm_ftr); + fprintf (fp, "fnm_bak='%s'\n", fc->FC_fnm_bak); + fprintf (fp, "links=%d upd=%d num=%d flags=0x%04X\n", + fc->FC_links, fc->FC_upd, fc->FC_num, fc->FC_flags); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_debug_framectrl (FILE *fp, struct FRAMECTRL *fc, int show_cluster) +{ + fprintf (fp, "FRAMECTRL=0x%08lX\n", fc); + fprintf (fp, "name='%s'\n", fc->frame_name); + fprintf (fp, "cluster=0x%08lX\n", fc->cluster); + fprintf (fp, "idx=0x%08lX begin=0x%08lX end=0x%08lX\n", + fc->frame_index, fc->frame_begin, fc->frame_end); + fprintf (fp, "lookup=%d status=%d upd=%d links=%d\n", + fc->frame_lookup, fc->frame_status, fc->upd, fc->links); + if (show_cluster) ned_debug_clusterctrl (fp, fc->cluster, 0); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_debug_clusterctrl (FILE *fp, struct CLUSTERCTRL *cc, int show_frames) +{ + fprintf (fp, "CLUSTERCTRL=0x%08lX\n", cc); + fprintf (fp, "name_logic='%s'\n", cc->cluster_name_logic); + fprintf (fp, "name_hyx='%s'\n", cc->cluster_name_hyx); + fprintf (fp, "name_idx='%s'\n", cc->cluster_name_idx); + fprintf (fp, "name_lut='%s'\n", cc->cluster_name_lut); + fprintf (fp, "name_xfn='%s'\n", cc->cluster_name_xfn); + fprintf (fp, "read_only=%d locked=%d frames_complete=%d flags0x%04X\n", + cc->cluster_readonly, cc->cluster_locked, + cc->frames_complete, cc->CC_flags); + fprintf (fp, "next_index=0x%08lX highest_index=%08lX\n", + cc->next_index, cc->highest_index); + + if (show_frames) + { + struct FRAMECTRL *fc; + for (fc= cc->frames; fc != (struct FRAMECTRL *) 0; fc= fc->next) + ned_debug_framectrl (fp, fc, 0); + } + + return 0; +} diff --git a/app/ned/13/ned1391.c b/app/ned/13/ned1391.c new file mode 100644 index 0000000000000000000000000000000000000000..0f36717a311a8c26f628afdbe304cd194f1b44a5 --- /dev/null +++ b/app/ned/13/ned1391.c @@ -0,0 +1,52 @@ +/* + * FILE %ned/13/ned1391.c + * + * NED message handling for terminal programs + * + * written: 1997-08-03 + * latest update: 1999-04-25 16:36:58 + * $Id: ned1391.c,v 1.3 2002/06/10 06:17:42 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include "ed.h" + +static int show_level= 0; + +/* ------------------------------------------------------------------------ */ +int ned_message ( +int cnt, +char *p1, char *p2, char *p3, char *p4, char *p5, char *p6) +{ + int i; + char *s[6]; + + if (show_level > 0) return 0; + + s [0]= p1; + s [1]= p2; + s [2]= p3; + s [3]= p4; + s [4]= p5; + s [5]= p6; + + printf ("NOTE: "); + for (i= 0; i < cnt; i++) printf (" %s ", s [i]); + putchar ('\n'); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_error_message (char *s) +{ + printf ("ERROR: %s\n", s); + + return 0; +} diff --git a/app/ned/13/ned1392.c b/app/ned/13/ned1392.c new file mode 100644 index 0000000000000000000000000000000000000000..dabb24124440101bf4ea7574aa7a2bacabe6ae81 --- /dev/null +++ b/app/ned/13/ned1392.c @@ -0,0 +1,63 @@ +/* + * FILE %ned/13/ned1392.c + * + * blind definitions + * T2D: fix this !!! + * + * written: 1997-08-03 + * latest update: 1999-04-25 16:37:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <gg/convent.h> +#include "ed.h" +#include "proto.h" + +extern int COL_UNKNOWN_FEATURE; +extern int CHR_UNKNOWN_FEATURE; + +/* ------------------------------------------------------------------------ */ +/* see also: */ int ned_identify_feature ( +struct WINDOWCTRL *wc, /* window where all that happens */ +struct LINE *lp, /* line to which feature is attached */ +int offset, /* offset in line where */ +int feature_type, /* general class, such as Ftype_SGML_TAG */ +struct FEATURE *ft, /* feature to be identified */ +char *lin, /* buffer containing feature to identify */ +char *repl_array, /* buffer to place replacement code into */ +int *repl_size, /* used space in that buffer */ +int repl_max) /* maximum size of that buffer */ +/* Return: -1 .. error; 0 .. ok; 1 .. feature not needed (but defined) */ +{ + int ev; + int f_entity_valid; + +#ifdef MSDOS + wc; lp; offset; repl_max; +#endif /* MSDOS */ + + switch (feature_type) + { + case Ftype_SGML_ENTITY: + ev= find_pc_sgml_entity (lin); + f_entity_valid= (ev >= 0x00 && ev <= 0xFF); + ft->ftr_colour= (f_entity_valid) + ? COL_DEF_TEXT : COL_UNKNOWN_FEATURE; + + if (!f_entity_valid) ev= CHR_UNKNOWN_FEATURE; + *repl_array= (char) ev; + *repl_size= 1; + ft->ftr_display_mode= FTR_display_replarray; + ft->ftr_replarray_size= 1; + return (f_entity_valid) ? 1 : 0; + break; + } + + return 0; +} diff --git a/app/ned/Makefile b/app/ned/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..79ae518a58c711244fb28ef046aa2c6d8abd7e61 --- /dev/null +++ b/app/ned/Makefile @@ -0,0 +1,143 @@ +# +# FILE %ned/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# +# latest update: 2001-02-11 10:07:49 +# $Id: Makefile,v 1.18 2012/08/10 14:44:20 gonter Exp $ +# +# ============================================================================ +# +# ***FOR LINUX***: uncomment these defintitions!!! +# cf=-O -Wall -Wuninitialized -Wunused -pedantic -Wformat + +# configure as needed +curseslibs=-lcurses -ltermcap -lncurses +PFX= /usr/local/include/ + +# === BEGIN Tcl/Tk === +# Tcl an Tk Libraries, tested are version 8.0, 8.3, 8.4 and apparently sometime in history 7.5/4.1 +# note: either use curseslibs or tklibs +# tcllibs=-ltcl7.5 -lm -lld +# tklibs=-ltk4.1 -lX11 + +# TCL_VER=8.0 +# tcllibs=-ltcl80 -lm # -lld +# tklibs=-ltk80 -L/usr/X11R6/lib -lX11 + +# TCL_VER=8.3 +# tcllibs=-ltcl83 -lm # -lld +# tklibs=-ltk83 -L/usr/X11R6/lib -lX11 + +TCL_VER=8.4 +# tcllibs=-ltcl84 -lm # -lld +tcllibs=-ltcl -lm # -lld +# tklibs=-ltk84 -L/usr/X11R6/lib -lX11 + +# OPTS2=-I/usr/X11R6/include -I${PFX}tcl$(TCL_VER) -I${PFX}tk$(TCL_VER) +# === END Tcl/Tk === + + +gglib=../../lib/libgg.a + +CC=cc -c -g -I. $(cf) +all_libs=-L/usr/local/lib $(tcllibs) $(linuxlibs) + +all : n00_cur # n00_tk +all2 : all.lib n02_cur n02_tk +all0 : all.lib +# all0s : NOT WORKING sgmlflt + +clean : + rm -f *.o */*.o n0[02] n0[02]_{cur,tk} ned_cur.a ned_tk.a + +distclean : clean + @echo same as clean + +# NED - Hauptprogramm ======================================================== +n00_cur : ned00_cur.o ned_cur.a all.lib_cur $(gglib) + ranlib ned_cur.a + cc -o $@ ned00_cur.o ned_cur.a $(gglib) $(all_libs) $(curseslibs) + +n00_tk : ned00_tk.o ned_tk.a $(gglib) + ranlib ned_tk.a + cc -o $@ ned00_tk.o ned_tk.a $(gglib) $(all_libs) $(tklibs) + +# AIX with libld.a +n02_cur : ned00_cur.o ned_cur.a + ranlib ned_cur.a + cc -o $@ ned00_cur.o ned_cur.a $(gglib) $(all_libs) $(curseslibs) -lld + cp n02_cur n00_cur + +n02_tk : ned00_tk.o ned_tk.a + ranlib ned_tk.a + cc -o $@ ned00_tk.o ned_tk.a $(gglib) ${all_libs} $(tklibs) -lld + cp n02_tk n00_tk + +ned00_cur.o : ed.h ned00.c + $(CC) $(OPT_CUR) -o ned00_cur.o ned00.c + +ned00_tk.o : ed.h ned00.c + $(CC) $(OPT_TK) -DUSE_TK -o ned00_tk.o ned00.c + +sgmlflt.o : sgmlflt.c + $(CC) sgmlflt.c + +sgmlflt : sgmlflt.o ned.a + cc -o $@ sgmlflt.o ned.a $(gglib) ${all_libs} + +# ---------------------------------------------------------------------------- +all.lib : all.lib_cur all.lib_tk + +all.lib_tk : + ( cd 00 && make lib_tk ) + ( cd 01 && make lib_tk ) + ( cd 02 && make TCL_VER=${TCL_VER} lib_tk ) + ( cd 03 && make lib_tk ) + ( cd 04 && make lib_tk ) + ( cd 05 && make lib_tk ) + ( cd 06 && make lib_tk ) + ( cd 07 && make lib_tk ) + ( cd 08 && make TCL_VER=${TCL_VER} lib_tk ) + ( cd 09 && make TCL_VER=${TCL_VER} lib_tk ) + ( cd 10 && make lib_tk ) + ( cd 11 && make lib_tk ) + ( cd 12 && make lib_tk ) + ( cd 13 && make lib_tk ) + ( cd unix && make TCL_VER=${TCL_VER} lib_tk ) + +ned_cur.a : all.lib_cur +all.lib_cur : + ( cd 00 && make lib_cur ) + ( cd 01 && make lib_cur ) + ( cd 02 && make lib_cur ) + ( cd 03 && make lib_cur ) + ( cd 04 && make lib_cur ) + ( cd 05 && make lib_cur ) + ( cd 06 && make lib_cur ) + ( cd 07 && make lib_cur ) + ( cd 08 && make lib_cur ) + ( cd 09 && make TCL_VER=${TCL_VER} lib_cur ) + ( cd 10 && make lib_cur ) + ( cd 11 && make lib_cur ) + ( cd 12 && make lib_cur ) + ( cd 13 && make lib_cur ) + ( cd unix && make TCL_VER=${TCL_VER} lib_cur ) + +# ---------------------------------------------------------------------------- +all.test : fnmdef + +T_FNMDEF=sbr/t_fnmdef.o sbr/t_fnmreal.o sbr/t_logicfnm.o +T_FLAG=-DDEBUG +fnmdef : $(T_FNMDEF) + cc -o fnmdef $(T_FNMDEF) ned.a + +sbr/t_fnmdef.o : sbr/fnmdef.c + $(ccc) $(T_FLAG) -o sbr/t_fnmdef.o sbr/fnmdef.c + +sbr/t_fnmreal.o : sbr/fnmreal.c + $(ccc) $(T_FLAG) -o sbr/t_fnmreal.o sbr/fnmreal.c + +sbr/t_logicfnm.o : sbr/logicfnm.c + $(ccc) $(T_FLAG) -o sbr/t_logicfnm.o sbr/logicfnm.c + diff --git a/app/ned/SetupWork b/app/ned/SetupWork new file mode 100755 index 0000000000000000000000000000000000000000..071022d1e2b76f03cb6830b7d5edd8a13d9f4c3e --- /dev/null +++ b/app/ned/SetupWork @@ -0,0 +1,50 @@ +#!/usr/bin/perl + +my @SUBDIRS= qw( +00 01 02 03 04 05 06 07 08 09 +10 11 12 13 +unix +); + +my %OLD_LIST1= +( + 'include/gg' => 'gg', + 'include/contrib' => 'contrib', +); + +my %OLD_LIST2= +( +); + +my ($sub); +foreach $sub (@SUBDIRS) +{ + &mk_links ($sub); +} + + foreach $old (sort keys %OLD_LIST1) + { + $new= $OLD_LIST1{$old}; + print "ln -fs ../../lib/$old $new\n"; + } + +exit (0); + +sub mk_links +{ + my $dir= shift; + + my ($old, $new); + foreach $old (sort keys %OLD_LIST1) + { + $new= $OLD_LIST1{$old}; + print "ln -fs ../../../lib/$old $dir/$new\n"; + } + + foreach $old (sort keys %OLD_LIST2) + { + $new= $OLD_LIST2{$old}; + print "ln -fs $old $dir/$new\n"; + } + print "\n"; +} diff --git a/app/ned/contrib b/app/ned/contrib new file mode 120000 index 0000000000000000000000000000000000000000..6021a51ea9120394be7d8ebb813d5b9b5d4e575c --- /dev/null +++ b/app/ned/contrib @@ -0,0 +1 @@ +../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/crashes b/app/ned/crashes new file mode 100644 index 0000000000000000000000000000000000000000..cb322e9d84e6e5cc1ae9566d2df25a5c4268254c --- /dev/null +++ b/app/ned/crashes @@ -0,0 +1,79 @@ +$Id: crashes,v 1.3 2003/10/02 06:45:51 gonter Exp $ + +2003-10-02 8:09:09 auf FreeBSD 5.1 +nach ^KV + +[gdb] +#0 0x080609c3 in ned_line_rel_cb (lp=0x80d7a80, + fnc=0x8054918 <ned_marker_callback>, event_mask=31, cd=0x8099180) + at ned0342b.c:43 [siehe %ned/03/ned0342b.c] +43 if (lcb->func == fnc + + for (lcbp= &lp->callbacks; + (lcb= *lcbp) != (struct LINE_CALLBACK *) 0; + lcbp= &lcb->next) + { + if (lcb->func == fnc /* BUG HERE: see %ned/crashes */ + && lcb->cd == cd + && lcb->event == event_mask + ) + ... + } + + Demnach ist entweder lcb kein Pointer vom Typ LINE_CALLBACK, + oder lcb zeigt auf einen bereits freigegebenen Memory Bereich. + Es ist kein NULL-Pointer, aber fnc gehoert nicht mehr zum + Memory Bereich. + +(gdb) where +#0 0x080609c3 in ned_line_rel_cb (lp=0x80d7a80, + fnc=0x8054918 <ned_marker_callback>, event_mask=31, cd=0x8099180) + at ned0342b.c:43 +#1 0x08058b4c in ned_set_marker2 (wc=0x80a1800, lp=0x80daaa0, offset=15, + b=0x8099180) at ned0701.c:26 +#2 0x08054f67 in ned_set_marker (wc=0x80a1800, marker_id=49) at ned0260c.c:43 +#3 0x0805bd9b in ned_eval_feature () at ned0841.c:49 +#4 0x0804a88f in NED_interpreter () at ned0319.c:78 +#5 0x08049ec8 in main (argc=2, argv=0xbfbff760) at ned00.c:723 +#6 0x08049372 in _start () + +2001-03-04 15:00 +nach yy im VI-Mode (?, vorher stand jj, aber in vi_dkey ist an der Stell y): + +#0 0x8065273 in ned_line_rel_cb (lp=0x81365e0, fnc=0x805690c <ned_marker_callback>, event_mask=31, + cd=0x80781d0) at ned0342b.c:43 [siehe %ned/03/ned0342b.c] +43 if (lcb->func == fnc +(gdb) where +#0 0x8065273 in ned_line_rel_cb (lp=0x81365e0, fnc=0x805690c <ned_marker_callback>, event_mask=31, + cd=0x80781d0) at ned0342b.c:43 +#1 0x805bc02 in ned_set_marker2 (wc=0x813e700, lp=0x818f100, offset=0, b=0x80781d0) at ned0701.c:26 +#2 0x805bb7d in ned_set_block_markers (wc=0x813e700, lp=0x818f100, offset=0, what=0, mode=0) + at ned0713.c:35 +#3 0x8056f2a in ned_set_marker (wc=0x813e700, marker_id=40) at ned0260c.c:37 +#4 0x8055b08 in vi_dkey () at ned0245.c:165 + + ned_set_marker (aw, '('); + +#5 0x804a8dc in NED_interpreter () at ned0319.c:59 +#6 0x804a3c9 in main (argc=2, argv=0xbfbffb28) at ned00.c:723 +#7 0x8049859 in _start () +(gdb) + +2001-02-18 18:20:00 +nack ^KY + +#0 tx_free (tp=0x3134392e) at ned0140.c:28 +28 tp2= tp->next; +(gdb) where +#0 tx_free (tp=0x3134392e) at ned0140.c:28 +#1 0x805411c in ned_lines_free (lp=0x8165320) at ned0138.c:32 +#2 0x806708e in ned_drop_buffer2 (bu=0x813ecc0) at ned0723.c:21 +#3 0x805c0b0 in ned_store_line_to_buffer (buffer_id=-1, lp_b=0x819ef20, lp_e=0x819ef20, add_mode=0) at ned0723b.c:41 +#4 0x80570d7 in ned_yank_marked (mrk_beg=0x80781e8, mrk_end=0x80781f4, add_mode=0) at ned0263.c:47 +#5 0x8057052 in ned_yank_block (add_mode=0) at ned0263.c:26 +#6 0x8055c4a in vi_dkey () at ned0245.c:196 +#7 0x804a8dc in NED_interpreter () at ned0319.c:59 +#8 0x804a3c9 in main (argc=2, argv=0xbfbffb30) at ned00.c:723 +#9 0x8049859 in _start () +(gdb) pezi:gonter> + diff --git a/app/ned/demo.tcl b/app/ned/demo.tcl new file mode 100755 index 0000000000000000000000000000000000000000..329802b97b5f59702d39615a91b4d7c97bb75702 --- /dev/null +++ b/app/ned/demo.tcl @@ -0,0 +1,4 @@ +#!/usr/home/gonter/work/fbsd/gg/app/ned/n00_tk -z + +edit_file ned00.c +ned_current line 1 diff --git a/app/ned/disall.bat b/app/ned/disall.bat new file mode 100644 index 0000000000000000000000000000000000000000..5abb303db3df08785d034a8052432d31bc79e4c9 --- /dev/null +++ b/app/ned/disall.bat @@ -0,0 +1,406 @@ +call g:dis ned00 +goto DA02 +:: ------------------------------------- +cd 00 +call g:dis ned0001 +call g:dis ned0001A +call g:dis ned0001F +call g:dis ned0001K +call g:dis ned0001O +call g:dis ned0001Q +call g:dis ned0001U +call g:dis ned0001X +call g:dis ned0002 +call g:dis ned0003 +call g:dis ned0004 +call g:dis ned0005 +call g:dis ned0006 +call g:dis ned0007 +call g:dis ned0008 +call g:dis ned0009 +call g:dis ned0010 +call g:dis ned0011 +call g:dis ned0001$ +cd .. +:: ------------------------------------- +:DA01 +cd 01 +call g:dis ned0101 +call g:dis ned0102 +call g:dis ned0103 +call g:dis ned0104 +call g:dis ned0105 +call g:dis ned0106 +call g:dis ned0107 +call g:dis ned0108 +call g:dis ned0109 +call g:dis ned0110 +call g:dis ned0111 +call g:dis ned0112 +call g:dis ned0113 +call g:dis ned0114 +call g:dis ned0115 +call g:dis ned0116 +call g:dis ned0117 +call g:dis ned0118 +call g:dis ned0119 +call g:dis ned0120 +call g:dis ned0121 +call g:dis ned0122 +call g:dis ned0123 +call g:dis ned0124 +call g:dis ned0125 +call g:dis ned0126 +call g:dis ned0127 +call g:dis ned0128 +call g:dis ned0131 +call g:dis ned0132 +call g:dis ned0133 +call g:dis ned0134 +call g:dis ned0135 +call g:dis ned0136 +call g:dis ned0137 +call g:dis ned0138 +call g:dis ned0139 +call g:dis ned0140 +call g:dis ned0141 +call g:dis ned0129 +cd .. +goto END +:: ------------------------------------- +:DA02 +cd 02 +call g:dis ned0202 +call g:dis ned0203 +call g:dis ned0204 +call g:dis ned0205 +call g:dis ned0206 +call g:dis ned0207 +call g:dis ned0208 +call g:dis ned0209 +call g:dis ned0210 +call g:dis ned0211 +call g:dis ned0212 +call g:dis ned0213 +call g:dis ned0214 +call g:dis ned0215 +call g:dis ned0216 +call g:dis ned0217 +call g:dis ned0218 +call g:dis ned0219 +call g:dis ned0220 +call g:dis ned0221 +call g:dis ned0222 +call g:dis ned0223 +call g:dis ned0224 +call g:dis ned0225 +call g:dis ned0226 +call g:dis ned0227 +call g:dis ned0228 +call g:dis ned0229 +call g:dis ned0230 +call g:dis ned0231 +call g:dis ned0232 +cd .. +cd 03 +call g:dis ned0301 +call g:dis ned0302 +call g:dis ned0303 +call g:dis ned0304 +call g:dis ned0305 +call g:dis ned0306 +call g:dis ned0307 +call g:dis ned0308 +call g:dis ned0309 +call g:dis ned0310 +call g:dis ned0311 +call g:dis ned0312 +call g:dis ned0313 +call g:dis ned0314 +call g:dis ned0315 +call g:dis ned0316 +call g:dis ned0317 +call g:dis ned0318 +call g:dis ned0319 +call g:dis ned0320 +call g:dis ned0321 +call g:dis ned0322 +call g:dis ned0323 +call g:dis ned0324 +call g:dis ned0325 +call g:dis ned0326 +call g:dis ned0327 +call g:dis ned0328 +call g:dis ned0329 +call g:dis ned0330 +call g:dis ned0331 +call g:dis ned0332 +call g:dis ned0333 +cd .. +cd 04 +call g:dis ned0401 +call g:dis ned0402 +call g:dis ned0403 +call g:dis ned0404 +call g:dis ned0405 +call g:dis ned0406 +call g:dis ned0408 +call g:dis ned0409 +call g:dis ned0410 +call g:dis ned0411 +call g:dis ned0412 +call g:dis ned0413 +call g:dis ned0414 +call g:dis ned0415 +call g:dis ned0416 +call g:dis ned0417 +call g:dis ned0418 +call g:dis ned0419 +call g:dis ned0420 +call g:dis ned0421 +call g:dis ned0422 +call g:dis ned0423 +call g:dis ned0424 +call g:dis ned0425 +call g:dis ned0426 +call g:dis ned0427 +call g:dis ned0428 +call g:dis ned0429 +call g:dis ned0430 +cd .. +cd 05 +call g:dis ned0501 +call g:dis ned0502 +call g:dis ned0503 +call g:dis ned0504 +call g:dis ned0505 +call g:dis ned0506 +call g:dis ned0507 +call g:dis ned0508 +call g:dis ned0509 +call g:dis ned0510 +call g:dis ned0511 +call g:dis ned0512 +call g:dis ned0513 +call g:dis ned0514 +call g:dis ned0515 +call g:dis ned0516 +call g:dis ned0517 +call g:dis ned0518 +call g:dis ned0519 +call g:dis ned0520 +call g:dis ned0521 +call g:dis ned0522 +cd .. +cd 06 +call g:dis ned0603 +call g:dis ned0604 +call g:dis ned0605 +call g:dis ned0606 +call g:dis ned0607 +call g:dis ned0608 +call g:dis ned0609 +call g:dis ned0610 +call g:dis ned0611 +call g:dis ned0612 +call g:dis ned0613 +call g:dis ned0615 +call g:dis ned0616 +call g:dis ned0617 +call g:dis ned0618 +call g:dis ned0619 +call g:dis ned0620 +call g:dis ned0621 +call g:dis ned0622 +call g:dis ned0623 +call g:dis ned0624 +call g:dis ned0625 +call g:dis ned0626 +cd .. +cd 07 +call g:dis ned0701 +call g:dis ned0702 +call g:dis ned0703 +call g:dis ned0704 +call g:dis ned0705 +call g:dis ned0706 +call g:dis ned0707 +call g:dis ned0708 +call g:dis ned0709 +call g:dis ned0710 +call g:dis ned0711 +call g:dis ned0712 +call g:dis ned0713 +call g:dis ned0714 +call g:dis ned0715 +call g:dis ned0716 +call g:dis ned0717 +call g:dis ned0718 +call g:dis ned0719 +call g:dis ned0720 +call g:dis ned0721 +call g:dis ned0722 +call g:dis ned0723 +call g:dis ned0724 +call g:dis ned0725 +call g:dis ned0726 +call g:dis ned0727 +call g:dis ned0728 +call g:dis ned0729 +call g:dis ned0730 +call g:dis ned0731A +call g:dis ned0731P +call g:dis ned0731W +call g:dis ned0732 +call g:dis ned0733 +call g:dis ned0734 +call g:dis ned0735 +call g:dis ned0736 +call g:dis ned0737 +call g:dis ned0738 +call g:dis ned0739 +call g:dis ned0740 +call g:dis ned0741 +call g:dis ned0742 +call g:dis ned0743 +call g:dis ned0744 +call g:dis ned0745 +call g:dis ned0746 +call g:dis ned0747 +call g:dis ned0748 +cd .. +cd 08 +call g:dis ned0803 +call g:dis ned0804 +call g:dis ned0805 +call g:dis ned0806 +call g:dis ned0807 +call g:dis ned0808 +call g:dis ned0809 +call g:dis ned0810 +call g:dis ned0811 +call g:dis ned0812 +call g:dis ned0813 +call g:dis ned0814 +call g:dis ned0821 +call g:dis ned0822 +call g:dis ned0823 +call g:dis ned0824 +call g:dis ned0825 +call g:dis ned0826 +call g:dis ned0827 +call g:dis ned0828 +call g:dis ned0830 +call g:dis ned0831 +call g:dis ned0832 +call g:dis ned0833 +call g:dis ned0834 +call g:dis ned0835 +call g:dis ned0836 +call g:dis ned0837 +call g:dis ned0838 +call g:dis ned0839 +call g:dis ned0840 +call g:dis ned0841 +call g:dis ned0842 +call g:dis ned0843 +call g:dis ned0844 +call g:dis ned0845 +call g:dis ned0846 +call g:dis ned0847 +call g:dis ned0848 +call g:dis ned0849 +call g:dis ned0850 +call g:dis ned0851 +call g:dis ned0852 +call g:dis ned0853 +call g:dis ned0854 +call g:dis ned0855 +call g:dis ned0856 +call g:dis ned0857 +call g:dis ned0858 +call g:dis ned0859 +call g:dis ned0860 +call g:dis ned0861 +call g:dis ned0862 +call g:dis ned0863 +call g:dis ned0864 +call g:dis ned0865 +call g:dis ned0866 +call g:dis ned0867 +call g:dis ned0868 +call g:dis ned0869 +call g:dis ned0870 +call g:dis ned0871 +call g:dis ned0872 +call g:dis ned0873 +call g:dis ned0874 +call g:dis ned0875 +call g:dis ned0876 +call g:dis ned0877 +call g:dis ned0878 +call g:dis ned0879 +call g:dis ned0880 +call g:dis ned0881 +call g:dis ned0882 +cd .. +cd 09 +call g:dis ned0901 +call g:dis ned0902 +call g:dis ned0903 +call g:dis ned0904 +call g:dis ned0905 +call g:dis ned0906 +call g:dis ned0907 +call g:dis ned0908 +call g:dis ned0909 +call g:dis ned0910 +call g:dis ned0911 +call g:dis ned0913 +call g:dis ned0914 +call g:dis ned0915 +call g:dis ned0916 +call g:dis ned0917 +call g:dis ned0918 +call g:dis ned0919 +call g:dis ned0921 +call g:dis ned0972 +call g:dis ned0973 +call g:dis ned0974 +call g:dis ned0975 +call g:dis ned0976 +call g:dis ned0977 +call g:dis ned0978 +call g:dis ned0979 +cd .. +cd 10 +call g:dis ned1001 +call g:dis ned1002 +call g:dis ned1003 +call g:dis ned1004 +call g:dis ned1005 +call g:dis ned1006 +call g:dis ned1007 +call g:dis ned1008 +call g:dis ned1009 +call g:dis ned1010 +call g:dis ned1012 +call g:dis ned1011 +call g:dis ned1013 +call g:dis ned1014 +cd .. +:: ------------------------------------- +:DA11 +cd 11 +call g:dis ned1101 +call g:dis ned1102 +call g:dis ned1103 +call g:dis ned1104 +call g:dis ned1105 +call g:dis ned1106 +call g:dis ned1107 +call g:dis ned1108 +call g:dis ned1109 +cd .. +:: ------------------------------------- +:END diff --git a/app/ned/ed.h b/app/ned/ed.h new file mode 100644 index 0000000000000000000000000000000000000000..8d554566ccca96ebaa6bffd9ea8ccb8e3ac281f5 --- /dev/null +++ b/app/ned/ed.h @@ -0,0 +1,567 @@ +/* + * FILE %ned/ed.h + * + * written: 1987 03 20 + * 1990 05 12: Revision + * 1991 01 01: Revision + * 1991 02 03: Revision + * 1992 04 21: <g.gonter@ieee.org> revision + * 1993-01-18: revision + * 1999-05-14 20:00:36 + * latest update: 2001-02-11 22:06:54 + * $Id: ed.h,v 1.6 2002/06/15 04:35:20 gonter Exp $ + * + */ + +#ifndef __NED_ed__ +#define __NED_ed__ + +#ifndef MSDOS +#define UNIX + +#ifndef __SINIX__ +/* #define __SINIX__ */ /* well, if you want SINIX ... */ +#endif +#endif + +/* Debugging, Test, Development: ------------------------------------------ */ +/* #define DEVEL1 */ /* reserves additional space in most */ + /* data structures. */ + +/* configuration for MSDOS: ----------------------------------------------- */ +#ifdef MSDOS +#define W_MODEL_CGA /* Direkte Bildschirmsteuerung */ +/* #define W_MODEL_BIOS */ /* Bildschirmsteuerung via BIOS */ +#define USE_MOUSE /* Maus wird verwendet */ +/* #define USE_FULL_SETUP */ /* Setup auch mit Tastatur Redefinition etc.*/ +#endif + +/* configuration for UNIX: ------------------------------------------------ */ +#ifdef UNIX +/* #define USE_TK */ /* turn on TK tools too... */ +#ifdef USE_TK +#define USE_TCL /* turn on TCL scripting for macros */ +#define W_MODEL_TK /* for X with TK */ +#else +#define W_MODEL_CURSES /* use curses for screen management */ +#define USE_TCL /* turn on TCL scripting for macros */ +/* #define W_MODEL_NCURSES */ /* for linux, this can be defined also */ +#endif +/* #define USE_MOUSE */ /* Maus wird verwendet */ +/* #define USE_FULL_SETUP */ /* Setup auch mit Tastatur Redefinition etc.*/ +#endif + +/* environment specific definitions: -------------------------------------- */ +/* #define VW5 .. not used anymore */ + +/* other configuraable options: ------------------------------------------- */ +#define USE_GOPHER /* -> GOPHER links can be accessed */ +#define WINSTACK /* windows are pushed up/popped off a stack */ +#define USE_ABBREVIATIONS /* Abbreviations are enabled */ + +/* SGML Konfiguration: ---------------------------------------------------- */ +/* #define SGML_PARSE_STRIP */ +#define SGML_PARSE_NO_STRIP + +#ifdef MSDOS +#define SGML_32BIT_REPLACEMENT 0xF7 /* Character to represent codes */ + /* >= 0x0100 */ +#else +#define SGML_32BIT_REPLACEMENT '@' +#endif + +/* ------------------------------------------------------------------------ */ +#define TXT_LNG 19 /* Laenge eines Textsegments: */ + /* Das Speicherverwaltungssystem von MSC5.0 */ + /* vergibt immer eine gerade Anzahl von */ + /* Bytes als Speicher. Der fixe Teil von */ + /* TXT hat eine Laenge von 5 Byte, daher */ + /* kann jede ungerade Anzahl von Bytes fuer */ + /* Textsegmente verwendet werden. Tests */ + /* haben ergeben, dass Textfiles durch- */ + /* schnittlich 32 Zeichen/Zeile haben. */ + +#define minTXT_LNG 7 /* minimale Laenge eines Text Segments */ + /* kuerzer hat keinen Sinn (siehe oben) */ + +#define LINE_LNG_TXT 32760 /* Maximale Zeilenlaenge fuer Text Zeilen */ + /* ... das ist die absolute Obergrenze */ +#define LINE_LNG_BIN 70 /* Maximale Zeilenlaenge fuer Binaere Zeilen*/ + +#define TAB_CHAR 0x09 /* code of the TAB character */ +#define TAB_EXPN 0x20 /* character that TAB gets expanded to */ + +#define CHARSET_token 0 +#define CHARSET_normal 0 /* old name for token ... */ +#define CHARSET_filename 1 +#define CHARSET_include 2 +#define CHARSET_blank 3 +#define CHARSET_non_blank 4 + +/* jump tables: ----------------------------------------------------------- */ +#define N_CODES 128 /* number of key codes per jump table */ + +#ifndef TBL_CTRL_SIZE +#define TBL_CTRL_SIZE 32 /* size of the key table for the control */ + /* chars (WordStar, Pico, Vi Switch) */ +#endif /* TBL_CTRL_SIZE */ + +#ifdef MSDOS +#define N_PFX 8 /* number of jump tables, including f-keys */ +#else +#define N_PFX 8 /* number of jump tables, curses func. keys */ +#endif + +#define P_NONE 0 /* normal jump table */ +#define P_CTRLQ 2 /* jump table for prefix code Ctrl-Q */ +#define P_CTRLK 3 /* jump table for prefix code Ctrl-K */ +#define P_CTRLO 4 /* jump table for prefix code Ctrl-O */ +#define P_CTRLU 5 /* jump table for prefix code Ctrl-U */ +#define P_VI 6 /* jump table for vi mode */ +#define P_FUNCT 7 /* jump table for PC function keys */ + +/* ------------------------------------------------------------------------ */ +#define N_MARKER 10 /* Anzahl der Marker */ +#define N_MACRO 75 /* Anzahl der moeglichen Makros */ + +#define FILE_READ "rb" +#define FILE_WRITE "wb" +#define FILE_APPEND "ab" +#define FILE_TEXT_READ "rt" +#define FILE_TEXT_WRITE "wt" + + /* see NED_OPENF_* cross reference */ +#define NED_OPENF_REDRAW 0x0001 /* redraw window */ +#define NED_OPENF_CONTEXT 0x0002 /* get filename from cursor pos. */ +#define NED_OPENF_HISTORY 0x0004 /* take history notes */ +#define NED_OPENF_EXISTS 0x0008 /* check if file is accessible */ +#define NED_OPENF_PROMPT 0x0010 /* prompt for file name */ +#define NED_OPENF_NO_REL_PATH 0x0020 /* ignore relative path of file */ +#define NED_OPENF_SGML 0x0040 /* open in SGML format */ +#define NED_OPENF_BINARY 0x0080 /* open in binary format */ +#define NED_OPENF_READ_ONLY 0x0100 /* open in readonly mode */ + +#define NED_OPENF_RST_FORMAT 0xFF3F /* reset format flags */ +#define NED_OPENF_DEF_STP 0x0005 /* Setup file: REDRAW, HISTORY */ +#define NED_OPENF_DEF1 0x0027 /* REDRAW, CONTEXT, HISTORY, NO REL */ + +struct NED_CB_OF /* callback structure for open file */ +{ + struct WINDOWCTRL *wc; + int flags; +} ; + +#define wdw_off(wc) ((wc)->cx + (wc)->hv - (wc)->ax) +/* offset of cursor in window */ + +/* methods: --------------------------------------------------------------- */ +typedef int ned_input_handler (void); +typedef int ned_primitive (void); + +/* methods: --------------------------------------------------------------- */ +#ifndef __NED_proto_prim__ +#define __NED_proto_prim__ +struct NED_PRIMITIVES +{ + char *NP_name; + ned_primitive *NP_func; +} ; +#endif /* __NED_proto_prim__ */ + +/* ------------------------------------------------------------------------ */ +struct FEATURE +{ + struct FEATURE *ftr_next; + struct FEATURE *ftr_peer; /* dazugehoeriger open|close Tag */ + struct FEATURE *ftr_upper; /* uebergeordnetes Tag */ + void *ftr_text_line; /* struct LINE * txt_line */ + /* Feature Text */ + int ftr_pos; /* Zeilen-Offset des Features */ + + int ftr_type; /* type of the feature */ +#define Ftype_undefined 0 +#define Ftype_SGML_TAG 1 /* any SGML tag */ +#define Ftype_SGML_ENTITY 2 /* any SGML entity */ +#define Ftype_SGML_entity_string 2001 /* &something; */ +#define Ftype_SGML_tag_string 2002 /* <something> */ +#define Ftype_SGML_tag_string2 2003 /* something, <> to be added */ +#define Ftype_hidden_text 3 /* hidden text within regular text */ +#define Ftype_hyx_l 1000 /* a hyx.l tag */ +#define Ftype_mark 1001 /* a mark tag */ +#define Ftype_lookup 1002 /* lookup tag text from /etc/feature.tfb */ +#define Ftype_hyx_l_mark 1003 /* set hyx.l with mark */ +#define Ftype_lookup_fr 1004 /* set frame tag */ +#define Ftype_lookup_fr2 1005 /* set frame tag, reuse current frame name */ + + + int ftr_subtype; /* weitere Untergliederung des Features */ + int ftr_edit_flags; /* see FTR_EDIT_ */ +#define FTR_EDIT_NO_TEXT 0x0001 /* must not be edited in text form */ +#define FTR_EDIT_NO_EDIT 0x0002 /* feature must not be edited */ +#define FTR_EDIT_NO_INSERT 0x0004 /* no inserts immediately before */ + /* this feature */ + +#define FTR_EDIT_PROTECTED 0x0007 /* no editing anywhere */ + + int ftr_weight; /* Wichtungscode fuer dieses Feature */ + + int ftr_display_mode; /* Art der Anzeige des Features */ +#define FTR_display_hide 1 /* feature is not displayed at all */ +#define FTR_display_point 2 /* feature is displayed by single character */ +#define FTR_display_region 3 /* feature is displayed as a string */ +#define FTR_display_replarray 4 /* feature is displayed by a replacement */ + + int ftr_colour; /* Farbe des angezeigten Bereichs */ + int ftr_replarray_size; /* Laenge des Replacement Strings im Text */ + + int ftr_duplication; /* duplication control */ +#define FTR_dup_copy 0x0001 /* copied at 'Copy Block' */ +#define FTR_dup_write 0x0002 /* written at 'Write Block' */ +#define FTR_dup_allways 0x0003 +#define FTR_delete 0x0010 /* *DON'T* delete at 'Delete Block' */ + +#ifdef DEVEL1 + int ftr_new1; /* reserve */ + int ftr_new2; + int ftr_new3; + int ftr_new4; +#endif +} ; + +/* Sub Types: rarely used! */ +#define Ftype_SGML_closeTAG 0x01 /* close tag */ +#define Ftype_SGML_autoTAG 0x02 /* autonomes tag (empty element) */ +#define Ftype_SGML_openTAG 0x0C /* entweder recursiv oder non-rec */ +#define Ftype_SGML_recTAG 0x04 /* open tag/recursives Markup */ +#define Ftype_SGML_nonrecTAG 0x08 /* open tag/non-recursives Markup */ +#define Ftype_SGML_ENTITY1 0x01 /* extended character */ +#define Ftype_SGML_ENTITY2 0x02 + +#define FTR_EDIT_NONE 0 +#define FTR_EDIT_STRING 1 +#define FTR_EDIT_STRUCTURED 2 +#define FTR_EDIT_ATTRIBUTE 3 +#define FTR_EDIT_ALL 4 +#define FTR_EDIT_ALL_COND 5 + +/* ------------------------------------------------------------------------ */ +#ifdef MSDOS +#pragma pack(1) +#endif +struct TXT /* Textsegment einer Zeile */ +{ + struct TXT *next; + unsigned char t_lng; /* Laenge des Textsegments */ + char t [3]; /* 3 .. Dummywert */ +} ; +#ifdef MSDOS +#pragma pack() +#endif + +/* ------------------------------------------------------------------------ */ +typedef int line_callback (int event, void *line, void *cd, +int column, void *op2); + +/* ------------------------------------------------------------------------ */ +struct LINE_CALLBACK +{ + struct LINE_CALLBACK *next; + line_callback *func; + void *cd; + int event; +#define LCB_edit 0x0001 /* insert/delete in line at column */ +#define LCB_delete 0x0002 /* line was deleted */ +#define LCB_chg_line 0x0004 /* line was changed at column */ +#define LCB_chg_wdw 0x0008 /* window was changed */ + +#define LCB_standard 0x000F +} ; + +/* ------------------------------------------------------------------------ */ +struct LINE /* normale Zeile mit CTRL */ +{ + struct LINE *next; + struct LINE *prev; /* doppelte Verkettung */ + struct FEATURE *ftr; /* Attribute usw. */ + struct FEATURE *l_active_ftr; /* gueltiges Markup fuer diese Zeile */ + int lng; /* Laenge ueber alles */ + int line_flg; /* Flags: 1 == True */ + /* Bit 0: Block Beg | End */ + /* 1: im Block */ + /* Bit 7: 0x0D in Zeile gefunden */ + /* Text Modus !!! */ + struct TXT *txt; /* ^ 1. Textsegment */ + + struct LINE_CALLBACK *callbacks; +} ; + +/* LINE_: see $line_ ------------------------------------------------------ */ +#define LINE_BLOCK_BEGEND 0x0001 /* Zeile ist Block Anfang | Ende */ +#define LINE_BLOCK_INBLOCK 0x0002 /* Zeile (mitten) im Block */ +#define LINE_inBLOCK 0x0003 /* Zeile im Block */ +#define LINE_TAGGED_GLOBAL 0x0020 /* line was tagged in global cmd */ +#define LINE_PROTECTED 0x0040 /* no editing in this line */ +#define LINE_CODE_0x0D 0x0080 /* line ends with CR-LF pair */ +#define LINE_HIDDEN 0x0100 /* the line is not visible */ +#define LINE_FOLDED_AWAY 0x0200 /* line is not visible, fold closed */ +#define LINE_VIRTUAL 0x0400 /* text is not part of the file */ + +#define LINE_BLOCK_CLR 0xFFFC /* Block Flags loeschen */ +#define LINE_BLOCK_CLR_BEGEND 0xFFFE /* Block Marker Flags loeschen */ + +/* ------------------------------------------------------------------------ */ +struct FILECTRL /* Filesteuerung */ +{ + struct FILECTRL *next; + struct FILECTRL *prev; +#define FC_next next +#define FC_prev prev + int FC_links; /* Anzahl der Windows / File */ + int FC_upd; /* 1 x Save bei ^KX */ + int FC_num; /* Nummer des Filectrl Blocks */ + int FC_flags; /* FCflg_* */ +#define FCflg_RO 0x0001 /* read only */ + char *FC_fnm_txt; /* Text File Name */ + char *FC_fnm_ftr; /* Feature File Name */ + char *FC_fnm_bak; /* Feature File Name */ +} ; + +/* ------------------------------------------------------------------------ */ +typedef void window_callback (int event, void *window, void *cd); + +/* ------------------------------------------------------------------------ */ +struct WINDOW_CALLBACK +{ + struct WINDOW_CALLBACK *next; + window_callback *func; + void *cd; + int event; +#define WCB_close 0x0001 +#define WCB_save 0x0002 /* => recompile */ +#define WCB_abort 0x0004 +#define WCB_read 0x0008 +#define WCB_resize 0x0010 +#define WCB_iconify 0x0020 +#define WCB_withdraw 0x0040 +#define WCB_deiconify 0x0080 +} ; + +/* ------------------------------------------------------------------------ */ +struct WINDOWCTRL /* Windowsteuerung */ +{ + struct LINE *WC_act; /* Zeile mit Cursor */ + struct LINE *first; /* 1. angezeigte Zeile */ +#define WC_first first + void *file_or_frame; /* File oder Frame zum Window */ + struct WINDOWCTRL *next; /* Windows sind */ +#define WC_next next + struct WINDOWCTRL *prev; /* doppelt verkettet */ +#define WC_prev prev + struct WINDOWCTRL *feature_window; /* Window mit Feature Text */ + char *WC_title_short; /* name to be displayed */ + char *WC_title_long; /* name to be displayed */ + + int ax, ay; /* Koordinaten | inklusive */ + int bx, by; /* des Windows | Werte */ + int cx, cy; /* Aktuelle Cursor Position */ + int page; /* Bildschirmseite */ + /* -1 .. Window wird nicht angezeigt */ + int znr; /* Zeilennummer der akt. Zeile */ + int hv; /* Horizontal View */ + int tlines; /* Zahl der Zeilen im Window Text */ + + int attr_text; /* Colour-Attribut des Text */ + int attr_box; /* Colour-Attribut der Window-Umrandung */ + int box_type; /* Art der Windowumrandung */ +#define BOX_TYPE_none 0 /* keine Umrandung */ +#define BOX_TYPE_single 1 /* einfache Umrandung */ +#define BOX_TYPE_double 2 /* doppelte Umrandung */ + int attr_block; /* Attribut von Blocks */ + int attr_feature; /* Attribut von Feature Markern */ +#define COL_DEF_TEXT 0x0100 /* Feature -> Colour wie normaler Text */ +#define COL_DEF_FEATURE 0x0200 /* Feature -> Colour Feature Default */ + int attr_markup; /* default-Attribut von Markups */ + int attr_status; /* Attribut der Window-Status-Zeile */ + int wflags; /* Window Flags: */ + /* Bit 0: Window ueberlappend */ +#define HIDE_LINES 0x0200 /* do not show hidden lines */ + + int ins_flg; /* 1 -> Insert enabled */ +#define INSFLG_overwrite 0 +#define INSFLG_insert 1 +/* #define INSFLG_change_word 2 ... not used !!! */ + int ai; /* 1 -> Auto Ident Mode */ + int wwc; /* Word Wrap Count */ + int file_format; /* Format siehe FMT_xxxx */ +#define FMT_BINARY 0 +#define FMT_ASCII 1 +#define FMT_SGML 2 + int file_type; /* 1 -> HYX Strukturierung mit Frames */ +#define FTY_PLAIN 0 /* normal file */ +#define FTY_HYPER 1 /* Hypertext File */ +#define FTY_FTRWDW 17 /* Window ist ein Feature Window */ + /* feature_window zeigt auf Haupt-Window */ + int f_upd; /* 1 -> File Update */ + int l_upd; /* 1 -> Line Update */ + int w_upd; /* erforderliche Aktionen bei Window Update */ +#define W_UPD_WINDOW 0x01 /* Bit 0: Window Update */ +#define W_UPD_JMP2LINE 0x02 /* 1: jmp2line ausfuehren */ +#define W_UPD_WSHIFT 0x04 /* 2: Window Verschoben; -> Box */ +#define W_UPD_WSETUP 0x80 /* 7: Window per Setup definiert */ + + int WC_edit_mode; /* moegliche Editierfaehigkeit */ +#define EDIT_READ_ONLY 0x0001 /* Bit 0: Read Only */ +#define EDIT_NOTOGGLE 0x0002 /* 1: Bit 0 nicht togglen */ +#define EDIT_NOLINEOPS 0x0004 /* kein Operationen mit Zeilen */ +#define EDIT_LINENR 0x0010 /* show line numbers */ +#define EDIT_LINENR0 0x0020 /* show line numbers with leadin 0 */ + /* OBSOLETE: 2: Binary File Mode */ + + int bin_eoln; /* End-Of-Line im Binaer Modus */ + int bin_llng; /* Zeilenlaenge . . . */ + int wc_ll_flags; /* logic link flags */ + + int wc_window_number; /* number of the window */ + + void *wc_widget; /* TK widget control struct for that window */ + + int wc_tag_display_mode; +#define WCTDM_no_change 0 /* don't switch tag display mode */ +#define WCTDM_normal 1 /* standard way to display tags */ +#define WCTDM_show_tag 2 /* display all tags, but only the name */ +#define WCTDM_show_full_tag 3 /* display all tags with full text */ + +#define WCTDM_SGML 4 +#define WCTDM_ASCII 5 + + int wc_taint_level; /* degree of untrustworthyness of a window */ + void *wc_file_mode; /* editing mode depending on file type */ + int longest_line; /* length of longest line in this window */ + + struct WINDOW_CALLBACK *wcb_list; + +#ifdef DEVEL1 + int wc_new1; /* unused, temporary .... */ + int wc_new2; + int wc_new3; + int wc_new4; +#endif +} ; + +/* ------------------------------------------------------------------------ */ +struct MARKER +{ + struct WINDOWCTRL *wptr; /* File in dem Marker gueltig ist */ + struct LINE *ptr; /* Zeile mit Marker */ + int offset; /* Spalte des Markers */ +} ; + +/* marker with special purpose */ +#define NED_TMARK_INSERT2 4 /* block insertion [That's digit 4, ^D !] */ +#define NED_MARKER_BEG '(' /* block begin marker */ +#define NED_MARKER_END ')' /* block end marker */ + +/* Pointer Lists: --------------------------------------------------------- */ +struct PLIST /* used for: window stack */ +{ + struct PLIST *PL_lnk; + void *PL_val; +} ; + +/* Buttons: --------------------------------------------------------------- */ +struct BUTTON_DESCRIPTOR +{ + struct BUTTON_DESCRIPTOR *BD_next; + + int BD_id; + int (*BD_function)(long par1, int x, int y, int t); /* unused still */ + long BD_parameter; /* unused still */ + + int BD_type; /* button type: 1 -> macro */ + int BD_macro_num; /* number of macro to execute */ + int BD_x; + int BD_y; + char *BD_text; /* the button's text */ + int BD_colour; + +#ifdef DEVEL1 + int BD_new1; + int BD_new2; + int BD_new3; + int BD_new4; +#endif +} ; + +/* Menu Descriptors: ----------------------------------------------------- */ +struct mm_item /* item in the mouse menu */ +{ + int MMI_type; +#define MMI_undef 0 +#define MMI_func 1 +#define MMI_macro 2 + int MMI_flag; + long MMI_value; + int MMI_res1; + int MMI_res2; +} ; + +#define MACRO_SUBMIT 0 /* number of macro for submit function */ + +/* Macro Descriptors: ----------------------------------------------------- */ +struct NED_MACRO +{ + int NED_mac_type; + char *NED_mac_contents; +} ; + +/* Operation Levels ------------------------------------------------------- */ +#define LEV_SPECIAL 100 /* Z.B. Push to Command (Quick Exit) */ +#define LEV_STP 150 /* Read Setup File */ +#define LEV_FNM 150 /* Filename angeben, Feature Files */ +#define LEV_LINK 180 /* Windows oeffnen, verketten ... */ +#define LEV_FIO 200 /* File I/O */ +#define LEV_FBLK 250 /* Block-File-Operationen */ +#define LEV_BLK 500 /* Block-Operationen */ +#define LEV_WDW 950 /* Window Verschieben ... */ +#define LEV_SEXIT 1000 /* Save and Exit; sonst nur Exit */ + +/* macro types */ +#define MPt_undefined 0 +#define MPt_key_sequence 1 +#define MPt_tcl 2 +#define MPt_tag 3 +#define MPt_feature 4 + +#define BLOCK_MODE_standard 1 +#define BLOCK_MODE_line 2 +#define BLOCK_MODE_box 3 + +#ifdef MSDOS +#define DEFAULT_WDW_MODE 0 +#else +#define DEFAULT_WDW_MODE 5 +#endif + +#ifndef MAX_FNM_LENGTH +#ifdef MSDOS +#define MAX_FNM_LENGTH 66 +#else +#define MAX_FNM_LENGTH 1026 +#endif +#endif + +/* find and replace options */ +#define OPT_global 0x0001 /* global search */ +#define OPT_local 0xFFFE +#define OPT_upper 0x0002 /* ignore case */ +#define OPT_mixed 0xFFFD +#define OPT_ask 0x0004 /* ask before replace */ +#define OPT_no_ask 0xFFFB +#define OPT_backward 0x0008 /* search backward */ +#define OPT_wrapscan 0x0010 /* wrap scan enabled */ +#define OPT_forward 0xFFF7 +#define OPT_end_mark 0x0100 /* 8: end at marker #1 */ +#define OPT_end_block 0x0200 /* 9: end at block end */ +#define OPT_beg_block 0x0400 /* A: begin at block start */ + +#endif /* __NED_ed__ */ diff --git a/app/ned/edctx.h b/app/ned/edctx.h new file mode 100644 index 0000000000000000000000000000000000000000..fe9e0fbc9c872c3742b8400a2ae1eeeecc5a8e2e --- /dev/null +++ b/app/ned/edctx.h @@ -0,0 +1,92 @@ +/* + * FILE %ned/edctx.h + * + * NED context datastructures and algorithms + * + * written: 1996-11-10 + * latest update: 1997-08-04 8:52:05 + * $Id: edctx.h,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifndef __NED_edctx__ +#define __NED_edctx__ + +#include <gg/array.h> + +#ifndef MSDOS +#ifndef cdecl +#define cdecl +#endif +#endif + +/* Meta Class Descriptor for all NED variables ---------------------------- */ +#define NED_IH_SIZE 10 /* number of input redirections */ + +struct NED_CONTEXT +{ + int NED_IH_TOS; /* top of stack */ + ned_input_handler *NED_input_stack [NED_IH_SIZE]; /* handlers */ + void *NED_input_stack_cd [NED_IH_SIZE]; /* client data */ + + struct NED_MACRO *NED_macro_table [N_MACRO]; + char *NED_macro_pointer; + + /* lookup and cross reference tables of various kinds */ + struct ARRAY_CONTROL *NED_CTX_crf; + struct ARRAY_CONTROL *NED_CTX_lib; + struct ARRAY_CONTROL *NED_CTX_lex; + struct ARRAY_CONTROL *NED_CTX_thes; + struct ARRAY_CONTROL *NED_CTX_tag_files; + struct ARRAY_CONTROL *NED_CTX_feature_tables; + + int NED_CTX_tag_length; + + /* methods */ + struct ARRAY_CONTROL *NED_CTX_tag_rules; +} ; + +#define NED_CTXitem_crf 1 +#define NED_CTXitem_lib 2 +#define NED_CTXitem_tag_file 3 +#define NED_CTXitem_feature_table 4 +#define NED_CTXitem_lexicon 5 +#define NED_CTXitem_thesaurus 6 + +/* ------------------------------------------------------------------------ */ +/* Experimental, 1996-11-09 */ +typedef int NED_tag_rule (const char *lookup, + char **res_string, char **res_type, + void *client_data); +/* NOTE: res_string, res_type must be malloced by the method! */ + +struct NED_TAG_RULE_DESCRIPTOR +{ + char *name; /* informal name of the rule */ + NED_tag_rule *tr; + void *client_data; +} ; + +/* 12/ -------------------------------------------------------------------- */ +/* 1201 */ struct NED_CONTEXT *cdecl ned_create_context (void); +/* 1202 */ int cdecl ned_default_context (struct NED_CONTEXT *ctx); +/* 1203 */ int cdecl ned_destroy_context (struct NED_CONTEXT *ctx); +/* 1204 */ int cdecl ned_add_context (struct NED_CONTEXT *ctx, + int what, const char *file_name, int at_top); +/* 1204b */ int ned_add_context_list (struct NED_CONTEXT *ctx, + const char *argv[], int argc); +/* 1205 */ int cdecl ned_add_tag_rule (struct NED_CONTEXT *ctx, + const char *rule_name, NED_tag_rule *tr, void *client_data); +/* 1206 */ char *cdecl ned_get_context (struct NED_CONTEXT *ctx, int what); +/* 1207 */ int cdecl ned_push_input_handler (struct NED_CONTEXT *ctx, + ned_input_handler *ih, void *client_data); +/* 1208 */ int cdecl ned_pop_input_handler (struct NED_CONTEXT *ctx, + ned_input_handler **ih, void **client_data); +/* 1211 */ struct NED_FIELD_CONTEXT *ned_create_field_context ( + char *buffer, int buffer_size, int buffer_mode); + +/* generalized modules */ +/* 1209 */ int ned_add_tag_file (struct NED_CONTEXT *ctx, char *tag_name); +/* 1210 */ int ned_add_feature_table (struct NED_CONTEXT *ctx, + char *feature_table); +#endif /* !__NED_edctx__ */ diff --git a/app/ned/edhyx.h b/app/ned/edhyx.h new file mode 100644 index 0000000000000000000000000000000000000000..77bdcb90a689ab699192d06396d26f6f045b424b --- /dev/null +++ b/app/ned/edhyx.h @@ -0,0 +1,195 @@ +/* + * FILE %ned/edhyx.h + * + * NED SGML and Hypertext Datastructures etc... + * + * written: 1991 05 16 + * latest update: 1997-01-12 0:20:06 + * $Id: edhyx.h,v 1.2 2002/06/15 04:35:20 gonter Exp $ + * + */ + +#ifndef __NED_edhyx__ +#define __NED_edhyx__ + +/* ------------------------------------------------------------------------ */ +#ifdef __COMMENT__ +Most datastructures for Hypertext in NED are something like caches, since +we expect things to grow rather large and then it would be quite difficult +to get everything necessary into a poor MSDOS box while still doing useful +work ... +#endif /* __COMMENT__ */ + +/* ------------------------------------------------------------------------ */ +struct HISTORYCTRL +{ + struct HISTORYCTRL *next; + struct HYTXT_FRAME *frame; + int line; /* last cursor position in frame: line */ + int column; /* last cursor position in frame: column */ +} ; + +/* ------------------------------------------------------------------------ */ +struct CLUSTERCTRL /* control structure describing a currently */ +{ /* used cluster. there is such a */ + /* structure for all clusters in use. */ + struct CLUSTERCTRL *next; /* next cluster */ + struct FRAMECTRL *frames; /* information about *some* frames in this */ + /* cluster (cached!!!) */ + int frames_complete; /* 1 -> list of all frames in memory */ + struct HISTORYCTRL *history; /* history information for this cluster */ + long next_index; /* next valid index for a frame */ + long highest_index; /* highest index on the index file */ + char *cluster_name_logic; /* logic (virtual) name of cluster */ + char *cluster_name_hyx; /* name of the cluster file(s): */ + char *cluster_name_idx; /* name of the cluster file(s): */ + char *cluster_name_lut; /* name of the cluster file(s): */ + char *cluster_name_xfn; /* name of the cluster file(s): */ + /* extensions used: */ + /* .hyx ... the hypertext cluster */ + /* .idx ... the index file */ + /* .lut ... the main lookup table file */ + /* .xfn ... the extra framename table file */ + int cluster_readonly; /* 1 -> no modifications possible/allowed */ + int cluster_locked; /* 1 -> locked by another process */ + int CC_flags; /* same as FCflg_* */ +} ; + +/* ------------------------------------------------------------------------ */ +struct FRAMECTRL /* control structure describing a frame */ +{ /* this is cached info, usually for *some* */ + /* of the frames in the cluster */ + struct FRAMECTRL *next; /* next frame in this cluster */ + struct CLUSTERCTRL *cluster; /* cluster where frame belongs to */ + char *frame_name; /* name of the frame */ + long frame_index; /* index code of the frame */ +#define FRAME_INDEX_undef -1 /* no index code defined for the frame */ + long frame_begin; /* beginning position in cluster */ + long frame_end; /* ending position in cluster */ + int frame_lookup; /* frame name found in: */ +#define FRAME_is_new 0 /* nowhere, frame is newly created */ +#define FRAME_in_LUT 1 /* in .lut-file */ +#define FRAME_in_XFN 2 /* in .xfn-file */ + + int frame_status; /* status of the frame control block */ +#define FRAME_is_defined 1 /* frame is defined an can be used */ +#define FRAME_is_loaded 2 /* frame is somewhere in memory */ +#define FRAME_is_unindexed 3 /* frame is not indexed sofar */ + +#ifdef __CURRENTLY_NOT_DEFINED__ + int frame_is_latest; /* 0 ... frame is an older version */ + /* 1 ... frame is the newest version */ +#endif /* __CURRENTLY_NOT_DEFINED__ */ + + int links; /* number of windows linked to this frame */ + int upd; /* frame needs to be updated */ + int line; /* last cursor position in frame: line */ + int column; /* last cursor position in frame: column */ +} ; + +/* Tags: ------------------------------------------------------------------ */ +struct SGML_TAG_DESCRIPTOR /* description of a feature element */ +{ + struct SGML_TAG_DESCRIPTOR *STD_next; + + char *STD_tag_name; /* tag name */ + int STD_tag_ml; /* tag match length */ + int STD_tag_mm; /* tag match mode */ + int STD_tag_id; /* tag ID code; see STID_xxxxx */ + int (*STD_activated) (char *s, int op1); + /* function to execute activated tag */ + int (*STD_scanned) (char *s, int op1); + /* function to execute after tag is scanned */ + int STD_display_mode; /* mode to display a feature element */ +#define STD_display_hide 1 /* feature is not displayed at all */ +#define STD_display_point 2 /* feature is displayed by single character */ +#define STD_display_region 3 /* feature is displayed as a string */ +#define STD_display_replarray 4 /* feature is displayed by a replacement */ +#define STD_display_tag_name 5 /* feature is displayed by it's tag name */ +#define STD_display_tag 6 /* feature is displayed by it's full tag */ + /* this is mapped to replarray */ + /* character (STD_display_character) */ + int STD_display_colour; /* colour attribute of a feature display */ + int STD_duplication; /* copy-mode for the tag */ +#define STD_dup_copy 0x01 /* copied at 'Copy Block' */ +#define STD_dup_write 0x02 /* written at 'Write Block' */ +#define STD_dup_always 0x03 +#define STD_dont_delete 0x10 /* *DON'T* delete at 'Delete Block' */ +#define STD_no_dup 0x00 + int STD_flags; /* formerly STD_subtype */ +#define STD_f_none 0x00 /* no flags turned on */ +#define STD_f_ign_case 0x01 /* ignore case of tag name */ + int STD_weight; /* weight value for the feature */ + int STD_replarray_size; /* replacement array length */ + char *STD_replarray; /* replacement array */ + +#ifdef DEVEL1 + int STD_new1; /* reserve */ + int STD_new2; + int STD_new3; + int STD_new4; +#endif +} ; + +/* Entities: -------------------------------------------------------------- */ +struct SGML_ENTITY_DESCRIPTOR +{ + struct SGML_ENTITY_DESCRIPTOR *SED_next; + + char *SED_entity_name; /* name of the entity */ + int SED_entity_id; /* entity ID-codes -> SEID_xxxx */ + + int SED_display_mode; /* mode to display a feature element */ +#define SED_display_hide 1 /* feature is not displayed at all */ +#define SED_display_point 2 /* feature is displayed by single character */ +#define SED_display_region 3 /* feature is displayed as a string */ +#define SED_display_replarray 4 /* feature is displayed by a replacement */ + /* character (STD_display_character) */ + int SED_display_colour; /* colour attribute of a feature display */ + int SED_duplication; /* copy-mode for the tag */ +#define SED_dup_copy 0x01 /* copied at 'Copy Block' */ +#define SED_dup_write 0x02 /* written at 'Write Block' */ +#define SED_delete 0x10 /* *DON'T* delete at 'Delete Block' */ + int SED_weight; /* weight value for the feature */ + int SED_replarray_size; /* replacement array length */ + char *SED_replarray; /* replacement array */ + +#ifdef DEVEL1 + int SED_new1; /* reserve */ + int SED_new2; + int SED_new3; + int SED_new4; +#endif +} ; + +/* predefined Tag IDs: - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#define STID_NULL 0 /* standard tag */ +#define STID_PSEUDO 1 /* standard pseudo character */ +#define STID_hyx_l 2 /* hypertext link type 1 */ +#define STID_NED_MACRO 3 /* NED macro defintion/execution */ +#define STID_NED_PARAMETER 4 /* NED window parameter defintion */ + +/* predefined Entity IDs: - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/* Hypertext Options: - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#define HYOPT_logic_link 1234 /* Logic Link -> Close Window */ + +/* flags for logic links: - - - - - - - - - - - - - - - - - - - - - - - - - */ +#define LL_next 0x0001 +#define LL_prev 0x0002 +#define LL_menu 0x0004 +#define LL_up 0x0008 +#define LL_more 0x0010 +#define LL_ 0x0020 +#define LL_lang 0x0040 +#define LL_sort 0x0080 +#define LL_view 0x0100 + +/* style of button bar */ +/* #define LL_BUTTONS_1 ....... 4 large buttons */ +#define LL_BUTTONS_2 /* several small buttons */ + +/* Entities: -------------------------------------------------------------- */ +#define IDX_REC_SIZE 12L /* number of bytes for a record in .IDX */ + +#endif /* __NED_edhyx__ */ diff --git a/app/ned/edtcl.h b/app/ned/edtcl.h new file mode 100644 index 0000000000000000000000000000000000000000..d213ae531abb0a9804ba5be76966a38ec0d6a89a --- /dev/null +++ b/app/ned/edtcl.h @@ -0,0 +1,50 @@ +/* + * FILE %ned/edtcl.h + * + * various tcl stuff for NED + * see also: "edtk.h" + * + * written: 1995-01-08 + * latest update: 1998-08-18 15:56:47 + * $Id: edtcl.h,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifndef __NED_edtcl__ +#define __NED_edtcl__ + +#ifndef __TCL_command_pars__ +# define __TCL_command_pars__ \ + ClientData clientData, Tcl_Interp *interp, int argc, const char *argv [] +#endif /* ! __TCL_command_pars__ */ + +/* ------------------------------------------------------------------------ */ +/* ned0923.c */ int ned_tcl_register (Tcl_Interp *interp); +/* ned0950.c */ int ned_tcl_cb_tag_rule (const char *dir_path, char **res_string, + char **res_type, void *client_data); + +/* TCL commands procedures: ----------------------------------------------- */ +/* ned0924.c */ int ned_tcl_execute_primitive (__TCL_command_pars__); + +/* ned0936.c */ int ned_tcl_edit_file (__TCL_command_pars__); +/* ned0937.c */ int ned_tcl_edit_frame (__TCL_command_pars__); +/* ned0937b.c */ int ned_tcl_edit_crf (__TCL_command_pars__); +/* ned0939.c */ int ned_tcl_context (__TCL_command_pars__); +/* ned0940.c */ int ned_tcl_set_markup (__TCL_command_pars__); +/* ned0941.c */ int ned_tcl_paste_str (__TCL_command_pars__); +/* ned0942.c */ int ned_tcl_submit_macro (__TCL_command_pars__); +/* ned0943.c */ int ned_tcl_enter_entity (__TCL_command_pars__); +/* ned0944.c */ int ned_tcl_jump_to_line (__TCL_command_pars__); +/* ned0945.c */ int ned_tcl_eval_tag (__TCL_command_pars__); +/* ned0946.c */ int ned_tcl_set_marker (__TCL_command_pars__); +/* ned0946b.c */ int ned_tcl_activate_note (__TCL_command_pars__); + int ned_tcl_define_note (__TCL_command_pars__); +/* ned0947.c */ int ned_tcl_jmp_marker (__TCL_command_pars__); +/* ned0948.c */ int ned_tcl_mac_define (__TCL_command_pars__); +/* ned0949.c */ int ned_tcl_define_feature (__TCL_command_pars__); +/* ned0950.c */ int ned_tcl_reg_tag_rule (__TCL_command_pars__); +/* ned0951a.c */ int ned_tcl_def_abbrev (__TCL_command_pars__); +/* ned0951b.c */ int ned_tcl_undef_abbrev (__TCL_command_pars__); +/* ned0952a.c */ int ned_tcl_extract (__TCL_command_pars__); + +#endif /* __NED_edtcl__ */ diff --git a/app/ned/edtk.h b/app/ned/edtk.h new file mode 100644 index 0000000000000000000000000000000000000000..77e2d8b55ca610ad658cfa9ee2d733ac4a83dd1b --- /dev/null +++ b/app/ned/edtk.h @@ -0,0 +1,143 @@ +/* + * FILE %ned/edtk.h + * + * various tk stuff for NED + * - macros + * + * written: 1995-09-25 + * latest update: 1999-05-06 16:48:47 + * $Id: edtk.h,v 1.6 2005/09/04 18:36:07 gonter Exp $ + * + */ + +#ifndef __NED_edtk__ +#define __NED_edtk__ + +#ifndef __TCL_command_pars__ +# define __TCL_command_pars__ \ + ClientData clientData, Tcl_Interp *interp, int argc, const char *argv [] +#endif /* ! __TCL_command_pars__ */ + +/* ------------------------------------------------------------------------ */ +void NED_tk_key_pressed (ClientData clientData, XEvent *eventPtr); + +#define NED_WIDGET_GC_CNT 24 + +/* NED editor widget ------------------------------------------------------ */ +typedef struct +{ + /* standard widget-Tk-Tcl-interfacing pointers and hooks */ + Tk_Window tkwin; /* window for that particular item */ + Tk_Window sc_win; /* scroll bar window */ + Display *display; /* display where this widget is */ + Tcl_Interp *interp; /* parrent TCL interpreter */ + Tcl_Command widgetCmd; /* command name for this widget */ + char *window_path; /* TK window path name */ + + /* graphics contexts */ + GC normalTextGC; /* Perfectly Normal Text */ + GC cursedTextGC; /* text colour at cursor position */ + GC StatusLineGC; /* status line */ + GC markedTextGC; /* block marker colour */ + GC selectedTextGC; /* block marker colour with select */ + GC hiddenTextGC; /* text that should not be shown */ + + int selection_active; /* flag */ + + GC attrib_GC [NED_WIDGET_GC_CNT]; + int attrib_num [NED_WIDGET_GC_CNT]; + int attrib_cnt; /* number of entries in this table */ + + /* derived from font properties */ + Tk_Font fontPtr; /* Tk 8.0 font object */ + int char_width; /* character cell width in pixels */ + int char_ascent; /* number of pixels top to baseline */ + int line_height; /* character cell height in pixels */ + + int num_x_pixels; /* size of window in pixels */ + int num_y_pixels; + + int num_x_pix_offset; /* extra space on the left side */ + int num_x_pix_extra; /* extra space on the right side */ + int num_y_pix_offset; /* extra space on top */ + int num_y_pix_extra; /* extra space on the bottom */ + + /* context sensitive command handlers; executed on certain events */ + char *cmd_MENU; /* click on MENU button */ + char *cmd_WINS; /* click on WINS button */ + char *cmd_right_button; /* click with right mouse button */ + + struct WINDOWCTRL *ned_window; /* association with NED window desc.*/ + char *tcl_on_lost_selection; /* XXX window-path */ +} NED_Widget; /* IS_STRUCT */ + +/* macros: ---------------------------------------------------------------- */ +#define ned_get_x_pos(nw,x) ((x) * (nw)->char_width) +#define ned_get_y_pos(nw,y) ((y) * (nw)->line_height + (nw)->char_ascent) + +#define ned_get_cx_pos(nw,px) ((px) / ((nw)->char_width)) +#define ned_get_cy_pos(nw,py) ((py) / (nw)->line_height) + +#define ned_get_blk_GC(nw) (((nw)->selection_active) \ + ? (nw)->selectedTextGC : (nw)->markedTextGC) + +/* types of X events being processed in a NED editor widget */ +#define NED_WIDGET_EVENT_MASK \ + KeyPressMask \ + | ButtonPressMask \ + | ButtonReleaseMask \ + | PointerMotionMask \ + | PointerMotionHintMask \ + | ExposureMask \ + | StructureNotifyMask \ + | FocusChangeMask + +/* prototypes: ------------------------------------------------------------ */ +int ned_tk_associate_window (struct WINDOWCTRL *wc); + +/* ned0922.c */ int _ned_tk_set_window_name (NED_Widget *nw, char *name); + int ned_tk_setup_event (struct WINDOWCTRL *w, int what); + int ned_tk_cb_prompt_string (ClientData clientData, + Tcl_Interp *interp, int argc, char *argv []); + int ned_tk_current (__TCL_command_pars__); + int ned_tk_aw_save_withdraw (void); + int ned_tk_aw_withdraw (void); + int ned_tk_aw_iconify (void); + int ned_tk_aw_deiconify (void); + int ned_tk_start_mode (struct WINDOWCTRL *wc); + +/* ned0925.c */ int _ned_tk_create_widget ( + __TCL_command_pars__, struct WINDOWCTRL *wc); + int ned_tk_set_font (NED_Widget *nw, const char *font_name); + int ned_tk_set_geometry (NED_Widget *nw); + int ned_tk_setup_special (struct WINDOWCTRL *w, int what, + char *str); + int _ned_tk_setup_special (NED_Widget *nw, int what, + const char *str); + int ned_tk_window_dock (struct WINDOWCTRL *w1, + struct WINDOWCTRL *w2, int pos); +/* ned0926.c */ int ned_tk_create_widget (__TCL_command_pars__); +/* ned0927.c */ int ned_tk_configure (Tcl_Interp *interp, NED_Widget *nw, + int argc, const char *argv [], int flags); +/* ned0928.c */ int _ned_tk_destroy_widget (NED_Widget *nw); +/* ned0929.c */ int ned_tk_widget_cmd (__TCL_command_pars__); +/* ned0930.c */ void ned_tk_widget_delete (ClientData clientData); +/* ned0931.c */ void ned_tk_event_procedure (ClientData clientData, + XEvent *eventPtr); +/* ned0932.c */ int ned_tk_set_color (NED_Widget *nw, GC *dGC, + int is_var, const char *fg_var, const char *bg_var); + GC ned_tk_setup_GC (NED_Widget *nw, int a); +/* ned0933.c */ int ned_tk_redraw_window (NED_Widget *nw, int pxa, int pya, + int pxb, int pyb); +/* ned0934.c */ int ned_tk_exp_selection_procedure (ClientData clientData, + int offset, char *buffer, int maxBytes); + void ned_tk_lost_selection (ClientData cd); + int ned_tk_block_export_flag (int flag); +/* ned0935.c */ int ned_tk_imp_selection_procedure (ClientData clientData, + Tcl_Interp *interp, char *buffer); + +/* %ned/unix/tk2.c */ +GC ned_tk_get_GC (NED_Widget *nw, int a); +int tk_draw_string (struct WINDOWCTRL *w, int what, int x, int y, char *s); + +#endif /* __NED_edtk__ */ diff --git a/app/ned/flt-make.pl b/app/ned/flt-make.pl new file mode 100755 index 0000000000000000000000000000000000000000..d0e8f856bb66e68cacaef278984c63e840b75379 --- /dev/null +++ b/app/ned/flt-make.pl @@ -0,0 +1,21 @@ +#!/usr/local/bin/perl + +use strict; + +while (<>) +{ + s#\&#\&#g; + s#<#\<#g; + s#>#\>#g; + + if (m#(.+):(\d+): (error|warning)#) + { + my ($fnm, $line, $type)= ($1, $2, $3); + my $lng= length ($fnm) + length($line) + 1; + + $fnm= $1 .'/'.$fnm if ($fnm =~ /^ned(\d\d)/); + + $_= "<hyx.l file=\"$fnm\" ln=$line tdc=79 tdp=$lng>" . $_; + } + print $_; +} diff --git a/app/ned/gg b/app/ned/gg new file mode 120000 index 0000000000000000000000000000000000000000..7b7c80811f4d282d5ba38a29e0f67cf0b8335b96 --- /dev/null +++ b/app/ned/gg @@ -0,0 +1 @@ +../../lib/include/gg \ No newline at end of file diff --git a/app/ned/make-dos b/app/ned/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..6c174aa317512fbbad7582801f8a2337d1068be9 --- /dev/null +++ b/app/ned/make-dos @@ -0,0 +1,143 @@ +# +# FILE %ned/makefile +# +# GG's Night(mare) Editor System +# +# latest update: 1997-10-26 11:35:25 +# +# ============================================================================ +cc=cl -Os -AL /c +ccc=cl -Os -AL /W3 /Fo$@ /c +obj=objdec -m0 -w -d $@ +etc=c:\etc\ +bin=c:\bin\ + +all : $(bin)vi.exe sgmlflt.exe +all.2 : $(bin)n00.exe $(bin)hyxview.exe +all.sh : ned.sh ned_gg.sh + +# +# NED - Hauptprogramm ======================================================== +# +$(bin)vi.exe : n00.obj ned.lib + link n00,$(bin)vi.exe,ned.map/map,ned lsbr/NOE; +# command /c inst-exe $(bin)vi.exe + +$(bin)n00.exe : $(bin)vi.exe + copy $(bin)vi.exe $(bin)n00.exe + command /c inst-exe $(bin)n00.exe + +$(bin)hyxview.exe : n00.obj 00\obj\ned0031.obj ned.lib + link n00 00\obj\ned0031 08\obj\ner0831,$(bin)hyxview.exe,! + hyxview.map/map,ned lsbr/NOE; + command /c inst-exe $(bin)hyxview.exe + +ned.tri : $(bin)n00.exe + copy $(bin)n00.exe $(bin)ned.exe + copy $(bin)n00.exe g:\ned.exe + command /c inst-exe $(bin)ned.exe g:\ned.exe +# command /c inst-exe $(bin)n00.exe c:\usr\ned\n00.exe + +ned.dei : $(bin)n00.exe + copy $(bin)n00.exe $(bin)ned.exe + command /c inst-exe $(bin)ned.exe +# command /c inst-exe $(bin)n00.exe c:\usr\ned\n00.exe + +all2 : acc.exe nedxx.exe + +clean : + del cr.f + del cr.lst + + +ned.sh : + shar -c -t ned.sh -fmake-l1.lst + +ned_gg.sh : + shar -c -t ned_gg.sh -fmake-l2.lst + +# +# ============================================================================ +# +n00.obj : ed.h ned00.c + $(ccc) ned00.c + $(obj) + +# ---------------------------------------------------------------------------- +.c.obj : + $(ccc) $? + $(obj) + +# NEDXX - Hauptprogramm ======================================================== +nedxx.exe : ax00.obj a3.obj a4.obj nt3.obj + link ax00 a3 a4 nt3,nedxx.exe,nedxx.map/map,ned lsbr/NOE; + +ned.lib : + llink -v -lned.lib -dned.mod -n0 + del ned.bak + +# +# Tools ====================================================================== +# +BLND=13\ned1301.obj 13\ned1391.obj 13\ned1392.obj +sgmlflt.exe : sgmlflt.obj $(BLND) + link sgmlflt.obj $(BLND),$@,/map,ned lsbr/NOE; + +SGMLFLT= sgmlflt.obj $(BLND) ned.lib +sgmlflt.dia : $(SGMLFLT) + command /c objdec00 -c -m0 $(SGMLFLT) >$@ + +# +# experimentelle Module ====================================================== +# +ax00.obj : ed.h ned.h ned00.c + $(ccc) /DEXPER ned00.c + +a3.c : acc.exe command.tbl + acc command.tbl + +a3.obj : a3.c + $(ccc) a3.c + +a4.c : primitiv.tbl + command /c primitiv + +a4.obj : a4.c + $(ccc) a4.c + +a4b.obj : a4.c + $(ccc) /Fo$*.obj /DCOMPILER a4.c + +a5.obj : a5.c + $(ccc) a5.c + +a6.obj : a6.c + $(ccc) a6.c + +acc.obj : acc.c + $(ccc) acc.c + +acc.exe : acc.obj a6.obj a4b.obj + link acc a6 a4b,,,ned lsbr; + +# +# Testprogramme ============================================================== +# +key.exe : key.obj cio.obj + link key cio; + +key.obj : key.c + $(cc) key.c + +# +# Abwicklung von Tests mit NED =============================================== +# +test.exe : test.c + cl -Od -AS -H24 -Ic:\c5\include test.c + +testprnt.exe : testprnt.c + cl -Od -AS -H24 -Ic:\c5\include testprnt.c + +testpr02.exe : testpr02.c + cl -Od -AL -H24 -Ic:\c5\include testpr02.c c:\usr\fm\fnames.obj + diff --git a/app/ned/make-l1.lst b/app/ned/make-l1.lst new file mode 100644 index 0000000000000000000000000000000000000000..b0cd2981ec0e23747e8c84ac989fdcf3f83bece0 --- /dev/null +++ b/app/ned/make-l1.lst @@ -0,0 +1,806 @@ +# +# File %ned/make-l1.lst +# +# pack files for the NED open hypertext editor system in a shar file +# Note: header files are listed in file make-l2.lst +# +# goto [00|01|02|03|04|05|06|07|08|09|10|11|12|13|unix|sbr] +# +# written: 1992-12-01 +# latest update: 1997-12-05 3:49:58 +# +# ---------------------------------------------------------------------------- +>if [ ! -d _bak_ftr.ned ] +>then +> mkdir _bak_ftr.ned +>fi +>ln -fs ../gg gg +>ln -fs ../contrib contrib +# ---------------------------------------------------------------------------- +a Readme.txt Readme.txt +a make-l1.lst make-l1.lst +# ---------------------------------------------------------------------------- +a (dirinf).fm '(dirinf)'.fm +a ed.h ed.h +a edctx.h edctx.h +a edhyx.h edhyx.h +a edtcl.h edtcl.h +a edtk.h edtk.h +a proto.h proto.h +a message.h message.h +a make-ux make-ux +a make-dos make-dos +>ln -s make-ux Makefile +a ned00.c ned00.c +a sgmlflt.c sgmlflt.c +# -------------------------------------- +>if [ ! -d 00 ] +>then +> mkdir 00 +> mkdir 00/_bak_ftr.ned +>fi +a 00/(dirinf).fm 00/'(dirinf)'.fm +a 00/make-ux 00/make-ux +a 00/make-dos 00/make-dos +>ln -s make-ux 00/Makefile +a 00/ned0001.c 00/ned0001.c +a 00/ned0001a.c 00/ned0001a.c +a 00/ned0001f.c 00/ned0001f.c +a 00/ned0001c.c 00/ned0001c.c +a 00/ned0001k.c 00/ned0001k.c +a 00/ned0001o.c 00/ned0001o.c +a 00/ned0001q.c 00/ned0001q.c +a 00/ned0001t.c 00/ned0001t.c +a 00/ned0001u.c 00/ned0001u.c +a 00/ned0001v.c 00/ned0001v.c +a 00/ned0001x.c 00/ned0001x.c +a 00/ned0002.c 00/ned0002.c +a 00/ned0003.c 00/ned0003.c +a 00/ned0004.c 00/ned0004.c +a 00/ned0005.c 00/ned0005.c +a 00/ned0006.c 00/ned0006.c +a 00/ned0006b.c 00/ned0006b.c +a 00/ned0007.c 00/ned0007.c +a 00/ned0009.c 00/ned0009.c +a 00/ned0010.c 00/ned0010.c +a 00/ned0011.c 00/ned0011.c +a 00/ned0015.c 00/ned0015.c +a 00/ned0016v.c 00/ned0016v.c +a 00/ned0016w.c 00/ned0016w.c +a 00/ned0016p.c 00/ned0016p.c +# -------------------------------------- +>if [ ! -d 01 ] +>then +> mkdir 01 +> mkdir 01/_bak_ftr.ned +>fi +a 01/(dirinf).fm 01/'(dirinf)'.fm +a 01/make-ux 01/make-ux +a 01/make-dos 01/make-dos +>ln -s make-ux 01/Makefile +a 01/ned0101.c 01/ned0101.c +a 01/ned0102.c 01/ned0102.c +a 01/ned0102m.c 01/ned0102m.c +a 01/ned0102p.c 01/ned0102p.c +a 01/ned0102v.c 01/ned0102v.c +a 01/ned0103.c 01/ned0103.c +a 01/ned0103p.c 01/ned0103p.c +a 01/ned0103v.c 01/ned0103v.c +a 01/ned0104.c 01/ned0104.c +a 01/ned0105.c 01/ned0105.c +a 01/ned0105a.c 01/ned0105a.c +a 01/ned0105p.c 01/ned0105p.c +a 01/ned0106.c 01/ned0106.c +a 01/ned0106a.c 01/ned0106a.c +a 01/ned0106p.c 01/ned0106p.c +a 01/ned0107.c 01/ned0107.c +a 01/ned0107b.c 01/ned0107b.c +a 01/ned0108a.c 01/ned0108a.c +a 01/ned0108b.c 01/ned0108b.c +a 01/ned0108c.c 01/ned0108c.c +a 01/ned0108d.c 01/ned0108d.c +a 01/ned0109.c 01/ned0109.c +a 01/ned0110.c 01/ned0110.c +a 01/ned0110a.c 01/ned0110a.c +a 01/ned0110b.c 01/ned0110b.c +a 01/ned0111.c 01/ned0111.c +a 01/ned0111a.c 01/ned0111a.c +a 01/ned0111b.c 01/ned0111b.c +a 01/ned0112.c 01/ned0112.c +a 01/ned0112w.c 01/ned0112w.c +a 01/ned0113.c 01/ned0113.c +a 01/ned0114.c 01/ned0114.c +a 01/ned0115.c 01/ned0115.c +a 01/ned0115b.c 01/ned0115b.c +a 01/ned0116.c 01/ned0116.c +a 01/ned0117.c 01/ned0117.c +a 01/ned0118.c 01/ned0118.c +a 01/ned0119.c 01/ned0119.c +a 01/ned0119a.c 01/ned0119a.c +a 01/ned0120.c 01/ned0120.c +a 01/ned0121.c 01/ned0121.c +a 01/ned0122.c 01/ned0122.c +a 01/ned0123.c 01/ned0123.c +a 01/ned0124.c 01/ned0124.c +a 01/ned0125c.c 01/ned0125c.c +a 01/ned0126.c 01/ned0126.c +a 01/ned0127.c 01/ned0127.c +a 01/ned0128.c 01/ned0128.c +a 01/ned0129.c 01/ned0129.c +a 01/ned0131.c 01/ned0131.c +a 01/ned0132.c 01/ned0132.c +a 01/ned0133.c 01/ned0133.c +a 01/ned0134.c 01/ned0134.c +a 01/ned0135.c 01/ned0135.c +a 01/ned0136.c 01/ned0136.c +a 01/ned0137.c 01/ned0137.c +a 01/ned0138.c 01/ned0138.c +a 01/ned0138b.c 01/ned0138b.c +a 01/ned0139.c 01/ned0139.c +a 01/ned0140.c 01/ned0140.c +a 01/ned0141.c 01/ned0141.c +a 01/ned0142.c 01/ned0142.c +# -------------------------------------- +>if [ ! -d 02 ] +>then +> mkdir 02 +> mkdir 02/_bak_ftr.ned +>fi +a 02/(dirinf).fm 02/'(dirinf)'.fm +a 02/make-ux 02/make-ux +a 02/make-dos 02/make-dos +>ln -s make-ux 02/Makefile +a 02/ned0202.c 02/ned0202.c +a 02/ned0203.c 02/ned0203.c +a 02/ned0204.c 02/ned0204.c +a 02/ned0204b.c 02/ned0204b.c +a 02/ned0204c.c 02/ned0204c.c +a 02/ned0205.c 02/ned0205.c +a 02/ned0206.c 02/ned0206.c +a 02/ned0207.c 02/ned0207.c +a 02/ned0208.c 02/ned0208.c +a 02/ned0209.c 02/ned0209.c +a 02/ned0210.c 02/ned0210.c +a 02/ned0211.c 02/ned0211.c +a 02/ned0211b.c 02/ned0211b.c +a 02/ned0212.c 02/ned0212.c +a 02/ned0213a.c 02/ned0213a.c +a 02/ned0213b.c 02/ned0213b.c +a 02/ned0213c.c 02/ned0213c.c +a 02/ned0213d.c 02/ned0213d.c +a 02/ned0213e.c 02/ned0213e.c +a 02/ned0214.c 02/ned0214.c +a 02/ned0215a.c 02/ned0215a.c +a 02/ned0215b.c 02/ned0215b.c +a 02/ned0215c.c 02/ned0215c.c +a 02/ned0216.c 02/ned0216.c +a 02/ned0217.c 02/ned0217.c +a 02/ned0218.c 02/ned0218.c +a 02/ned0219.c 02/ned0219.c +a 02/ned0220.c 02/ned0220.c +a 02/ned0221.c 02/ned0221.c +a 02/ned0222.c 02/ned0222.c +a 02/ned0223.c 02/ned0223.c +a 02/ned0224.c 02/ned0224.c +a 02/ned0225.c 02/ned0225.c +a 02/ned0226.c 02/ned0226.c +a 02/ned0227.c 02/ned0227.c +a 02/ned0228.c 02/ned0228.c +# 02/ned0229.c 02/ned0229.c +a 02/ned0230.c 02/ned0230.c +a 02/ned0231.c 02/ned0231.c +a 02/ned0232.c 02/ned0232.c +a 02/ned0240.c 02/ned0240.c +a 02/ned0241.c 02/ned0241.c +a 02/ned0242.c 02/ned0242.c +a 02/ned0243.c 02/ned0243.c +a 02/ned0244.c 02/ned0244.c +a 02/ned0245.c 02/ned0245.c +a 02/ned0246.c 02/ned0246.c +a 02/ned0247.c 02/ned0247.c +a 02/ned0248.c 02/ned0248.c +a 02/ned0249.c 02/ned0249.c +a 02/ned0250.c 02/ned0250.c +a 02/ned0251.c 02/ned0251.c +a 02/ned0252.c 02/ned0252.c +a 02/ned0253.c 02/ned0253.c +a 02/ned0253v.c 02/ned0253v.c +a 02/ned0254.c 02/ned0254.c +a 02/ned0254b.c 02/ned0254b.c +a 02/ned0255.c 02/ned0255.c +a 02/ned0256.c 02/ned0256.c +a 02/ned0256a.c 02/ned0256a.c +a 02/ned0257.c 02/ned0257.c +a 02/ned0258.c 02/ned0258.c +a 02/ned0259.c 02/ned0259.c +a 02/ned0260.c 02/ned0260.c +a 02/ned0260b.c 02/ned0260b.c +a 02/ned0260c.c 02/ned0260c.c +a 02/ned0261.c 02/ned0261.c +a 02/ned0262a.c 02/ned0262a.c +a 02/ned0263.c 02/ned0263.c +# -------------------------------------- +>if [ ! -d 03 ] +>then +> mkdir 03 +> mkdir 03/_bak_ftr.ned +>fi +a 03/(dirinf).fm 03/'(dirinf)'.fm +a 03/make-ux 03/make-ux +a 03/make-dos 03/make-dos +>ln -s make-ux 03/Makefile +a 03/ned0301.c 03/ned0301.c +a 03/ned0302.c 03/ned0302.c +a 03/ned0303.c 03/ned0303.c +a 03/ned0304.c 03/ned0304.c +a 03/ned0304b.c 03/ned0304b.c +a 03/ned0305.c 03/ned0305.c +a 03/ned0306.c 03/ned0306.c +a 03/ned0307.c 03/ned0307.c +a 03/ned0308.c 03/ned0308.c +a 03/ned0309.c 03/ned0309.c +a 03/ned0310.c 03/ned0310.c +a 03/ned0311.c 03/ned0311.c +a 03/ned0312.c 03/ned0312.c +a 03/ned0313.c 03/ned0313.c +a 03/ned0314.c 03/ned0314.c +a 03/ned0315.c 03/ned0315.c +a 03/ned0316.c 03/ned0316.c +# 03/ned0317.c 03/ned0317.c +# 03/ned0318.c 03/ned0318.c +a 03/ned0319.c 03/ned0319.c +a 03/ned0320.c 03/ned0320.c +a 03/ned0321.c 03/ned0321.c +a 03/ned0322.c 03/ned0322.c +a 03/ned0323.c 03/ned0323.c +a 03/ned0324.c 03/ned0324.c +a 03/ned0325.c 03/ned0325.c +a 03/ned0326.c 03/ned0326.c +a 03/ned0327.c 03/ned0327.c +a 03/ned0328.c 03/ned0328.c +a 03/ned0329.c 03/ned0329.c +a 03/ned0330.c 03/ned0330.c +a 03/ned0331.c 03/ned0331.c +a 03/ned0332.c 03/ned0332.c +a 03/ned0332b.c 03/ned0332b.c +a 03/ned0333.c 03/ned0333.c +a 03/ned0333b.c 03/ned0333b.c +a 03/ned0333c.c 03/ned0333c.c +a 03/ned0333d.c 03/ned0333d.c +a 03/ned0333e.c 03/ned0333e.c +a 03/ned0334.c 03/ned0334.c +a 03/ned0334b.c 03/ned0334b.c +a 03/ned0335.c 03/ned0335.c +a 03/ned0341a.c 03/ned0341a.c +a 03/ned0341b.c 03/ned0341b.c +a 03/ned0341c.c 03/ned0341c.c +a 03/ned0342a.c 03/ned0342a.c +a 03/ned0342b.c 03/ned0342b.c +a 03/ned0342c.c 03/ned0342c.c +# -------------------------------------- +>if [ ! -d 04 ] +>then +> mkdir 04 +> mkdir 04/_bak_ftr.ned +>fi +a 04/(dirinf).fm 04/'(dirinf)'.fm +a 04/make-ux 04/make-ux +a 04/make-dos 04/make-dos +>ln -s make-ux 04/Makefile +a 04/ned0401.c 04/ned0401.c +a 04/ned0402.c 04/ned0402.c +a 04/ned0402b.c 04/ned0402b.c +a 04/ned0403.c 04/ned0403.c +a 04/ned0404.c 04/ned0404.c +a 04/ned0405.c 04/ned0405.c +a 04/ned0406.c 04/ned0406.c +a 04/ned0408.c 04/ned0408.c +a 04/ned0409.c 04/ned0409.c +a 04/ned0409b.c 04/ned0409b.c +a 04/ned0409c.c 04/ned0409c.c +a 04/ned0410.c 04/ned0410.c +a 04/ned0411.c 04/ned0411.c +a 04/ned0412.c 04/ned0412.c +a 04/ned0413.c 04/ned0413.c +a 04/ned0414.c 04/ned0414.c +a 04/ned0415.c 04/ned0415.c +a 04/ned0416.c 04/ned0416.c +a 04/ned0417.c 04/ned0417.c +a 04/ned0417b.c 04/ned0417b.c +a 04/ned0418.c 04/ned0418.c +# 04/ned0419.c 04/ned0419.c +a 04/ned0420.c 04/ned0420.c +a 04/ned0421.c 04/ned0421.c +a 04/ned0422.c 04/ned0422.c +a 04/ned0423.c 04/ned0423.c +a 04/ned0425.c 04/ned0425.c +a 04/ned0426.c 04/ned0426.c +a 04/ned0427.c 04/ned0427.c +a 04/ned0428.c 04/ned0428.c +a 04/ned0429.c 04/ned0429.c +a 04/ned0430.c 04/ned0430.c +a 04/ned0431.c 04/ned0431.c +a 04/ned0432.c 04/ned0432.c +a 04/ned0433.c 04/ned0433.c +a 04/ned0434.c 04/ned0434.c +# -------------------------------------- +>if [ ! -d 05 ] +>then +> mkdir 05 +> mkdir 05/_bak_ftr.ned +>fi +a 05/(dirinf).fm 05/'(dirinf)'.fm +a 05/make-ux 05/make-ux +a 05/make-dos 05/make-dos +>ln -s make-ux 05/Makefile +a 05/ned0501.c 05/ned0501.c +a 05/ned0502.c 05/ned0502.c +a 05/ned0502b.c 05/ned0502b.c +a 05/ned0502c.c 05/ned0502c.c +a 05/ned0502d.c 05/ned0502d.c +a 05/ned0503.c 05/ned0503.c +a 05/ned0503b.c 05/ned0503b.c +a 05/ned0504.c 05/ned0504.c +a 05/ned0505.c 05/ned0505.c +a 05/ned0506a.c 05/ned0506a.c +a 05/ned0506b.c 05/ned0506b.c +a 05/ned0506c.c 05/ned0506c.c +a 05/ned0506d.c 05/ned0506d.c +a 05/ned0506e.c 05/ned0506e.c +a 05/ned0507.c 05/ned0507.c +a 05/ned0508.c 05/ned0508.c +a 05/ned0508b.c 05/ned0508b.c +a 05/ned0508m.c 05/ned0508m.c +a 05/ned0508t.c 05/ned0508t.c +a 05/ned0509.c 05/ned0509.c +a 05/ned0510.c 05/ned0510.c +a 05/ned0510b.c 05/ned0510b.c +a 05/ned0510c.c 05/ned0510c.c +a 05/ned0511.c 05/ned0511.c +a 05/ned0512.c 05/ned0512.c +a 05/ned0513.c 05/ned0513.c +a 05/ned0514.c 05/ned0514.c +a 05/ned0515.c 05/ned0515.c +a 05/ned0515b.c 05/ned0515b.c +a 05/ned0516.c 05/ned0516.c +a 05/ned0516b.c 05/ned0516b.c +a 05/ned0517.c 05/ned0517.c +a 05/ned0519.c 05/ned0519.c +a 05/ned0520.c 05/ned0520.c +a 05/ned0521.c 05/ned0521.c +a 05/ned0522.c 05/ned0522.c +# -------------------------------------- +>if [ ! -d 06 ] +>then +> mkdir 06 +> mkdir 06/_bak_ftr.ned +>fi +a 06/(dirinf).fm 06/'(dirinf)'.fm +a 06/make-ux 06/make-ux +a 06/make-dos 06/make-dos +>ln -s make-ux 06/Makefile +a 06/ned0602.c 06/ned0602.c +a 06/ned0603.c 06/ned0603.c +a 06/ned0604.c 06/ned0604.c +a 06/ned0605.c 06/ned0605.c +a 06/ned0606.c 06/ned0606.c +a 06/ned0607.c 06/ned0607.c +a 06/ned0608.c 06/ned0608.c +a 06/ned0609.c 06/ned0609.c +a 06/ned0610.c 06/ned0610.c +a 06/ned0610a.c 06/ned0610a.c +a 06/ned0610b.c 06/ned0610b.c +a 06/ned0610c.c 06/ned0610c.c +a 06/ned0610d.c 06/ned0610d.c +a 06/ned0610e.c 06/ned0610e.c +# 06/ned0611.c 06/ned0611.c ... not used +a 06/ned0612.c 06/ned0612.c +a 06/ned0613.c 06/ned0613.c +a 06/ned0613b.c 06/ned0613b.c +a 06/ned0614.c 06/ned0614.c +a 06/ned0615.c 06/ned0615.c +a 06/ned0616.c 06/ned0616.c +# 06/ned0617.c 06/ned0617.c ... not used any more +a 06/ned0618.c 06/ned0618.c +a 06/ned0619.c 06/ned0619.c +a 06/ned0620.c 06/ned0620.c +a 06/ned0621.c 06/ned0621.c +a 06/ned0622.c 06/ned0622.c +a 06/ned0623.c 06/ned0623.c +a 06/ned0624.c 06/ned0624.c +a 06/ned0625.c 06/ned0625.c +a 06/ned0626.c 06/ned0626.c +a 06/ned0627.c 06/ned0627.c +a 06/ned0628.c 06/ned0628.c +a 06/ned0629.c 06/ned0629.c +a 06/ned0630.c 06/ned0630.c +a 06/ned0631.c 06/ned0631.c +# -------------------------------------- +>if [ ! -d 07 ] +>then +> mkdir 07 +> mkdir 07/_bak_ftr.ned +>fi +a 07/(dirinf).fm 07/'(dirinf)'.fm +a 07/make-ux 07/make-ux +a 07/make-dos 07/make-dos +>ln -s make-ux 07/Makefile +a 07/ned0701.c 07/ned0701.c +a 07/ned0702.c 07/ned0702.c +a 07/ned0703.c 07/ned0703.c +# +a 07/ned0705.c 07/ned0705.c +# +a 07/ned0711.c 07/ned0711.c +a 07/ned0712.c 07/ned0712.c +a 07/ned0713.c 07/ned0713.c +a 07/ned0714.c 07/ned0714.c +a 07/ned0715.c 07/ned0715.c +a 07/ned0716.c 07/ned0716.c +a 07/ned0717.c 07/ned0717.c +a 07/ned0718.c 07/ned0718.c +a 07/ned0719.c 07/ned0719.c +a 07/ned0719b.c 07/ned0719b.c +a 07/ned0719c.c 07/ned0719c.c +a 07/ned0720.c 07/ned0720.c +a 07/ned0721.c 07/ned0721.c +a 07/ned0722.c 07/ned0722.c +a 07/ned0723.c 07/ned0723.c +a 07/ned0723a.c 07/ned0723a.c +a 07/ned0723b.c 07/ned0723b.c +a 07/ned0724.c 07/ned0724.c +a 07/ned0724a.c 07/ned0724a.c +a 07/ned0725.c 07/ned0725.c +a 07/ned0725b.c 07/ned0725b.c +a 07/ned0725c.c 07/ned0725c.c +a 07/ned0726.c 07/ned0726.c +a 07/ned0727.c 07/ned0727.c +a 07/ned0727a.c 07/ned0727a.c +a 07/ned0727b.c 07/ned0727b.c +a 07/ned0727c.c 07/ned0727c.c +a 07/ned0727d.c 07/ned0727d.c +a 07/ned0727e.c 07/ned0727e.c +a 07/ned0728.c 07/ned0728.c +a 07/ned0729.c 07/ned0729.c +a 07/ned0730.c 07/ned0730.c +a 07/ned0731a.c 07/ned0731a.c +a 07/ned0731p.c 07/ned0731p.c +a 07/ned0731w.c 07/ned0731w.c +a 07/ned0732.c 07/ned0732.c +a 07/ned0733.c 07/ned0733.c +a 07/ned0734.c 07/ned0734.c +a 07/ned0735.c 07/ned0735.c +a 07/ned0736.c 07/ned0736.c +a 07/ned0737.c 07/ned0737.c +a 07/ned0738.c 07/ned0738.c +# +a 07/ned0747.c 07/ned0747.c +a 07/ned0747b.c 07/ned0747b.c +# +a 07/ned0749.c 07/ned0749.c +a 07/ned0750.c 07/ned0750.c +a 07/ned0751.c 07/ned0751.c +a 07/ned0752.c 07/ned0752.c +a 07/ned0753.c 07/ned0753.c +a 07/ned0754a.c 07/ned0754a.c +a 07/ned0754b.c 07/ned0754b.c +a 07/ned0754c.c 07/ned0754c.c +a 07/ned0754d.c 07/ned0754d.c +a 07/ned0756.c 07/ned0756.c +# +a 07/ned0758.c 07/ned0758.c +a 07/ned0759.c 07/ned0759.c +a 07/ned0760.c 07/ned0760.c +a 07/ned0761.c 07/ned0761.c +a 07/ned0762.c 07/ned0762.c +a 07/ned0763.c 07/ned0763.c +# -------------------------------------- +>if [ ! -d 08 ] +>then +> mkdir 08 +> mkdir 08/_bak_ftr.ned +>fi +a 08/(dirinf).fm 08/'(dirinf)'.fm +a 08/make-ux 08/make-ux +a 08/make-dos 08/make-dos +>ln -s make-ux 08/Makefile +a 08/ned0803.c 08/ned0803.c +a 08/ned0804.c 08/ned0804.c +a 08/ned0805.c 08/ned0805.c +a 08/ned0806.c 08/ned0806.c +a 08/ned0807.c 08/ned0807.c +a 08/ned0808.c 08/ned0808.c +a 08/ned0809.c 08/ned0809.c +a 08/ned0810.c 08/ned0810.c +a 08/ned0811.c 08/ned0811.c +a 08/ned0812.c 08/ned0812.c +a 08/ned0813.c 08/ned0813.c +a 08/ned0814.c 08/ned0814.c +a 08/ned0821.c 08/ned0821.c +a 08/ned0822.c 08/ned0822.c +a 08/ned0823.c 08/ned0823.c +a 08/ned0824.c 08/ned0824.c +a 08/ned0825.c 08/ned0825.c +a 08/ned0826.c 08/ned0826.c +a 08/ned0827.c 08/ned0827.c +a 08/ned0828.c 08/ned0828.c +a 08/ned0829.c 08/ned0829.c +a 08/ned0830.c 08/ned0830.c +a 08/ned0831.c 08/ned0831.c +a 08/ned0832.c 08/ned0832.c +a 08/ned0833.c 08/ned0833.c +a 08/ned0834.c 08/ned0834.c +a 08/ned0835.c 08/ned0835.c +a 08/ned0836.c 08/ned0836.c +a 08/ned0837.c 08/ned0837.c +a 08/ned0838.c 08/ned0838.c +a 08/ned0838a.c 08/ned0838a.c +a 08/ned0839.c 08/ned0839.c +a 08/ned0840.c 08/ned0840.c +a 08/ned0841.c 08/ned0841.c +a 08/ned0841b.c 08/ned0841b.c +a 08/ned0842.c 08/ned0842.c +a 08/ned0842b.c 08/ned0842b.c +a 08/ned0842c.c 08/ned0842c.c +a 08/ned0843.c 08/ned0843.c +a 08/ned0844.c 08/ned0844.c +a 08/ned0844b.c 08/ned0844b.c +a 08/ned0845.c 08/ned0845.c +a 08/ned0845a.c 08/ned0845a.c +a 08/ned0846.c 08/ned0846.c +a 08/ned0847.c 08/ned0847.c +a 08/ned0848.c 08/ned0848.c +a 08/ned0849.c 08/ned0849.c +a 08/ned0850.c 08/ned0850.c +a 08/ned0850b.c 08/ned0850b.c +a 08/ned0851.c 08/ned0851.c +a 08/ned0853.c 08/ned0853.c +a 08/ned0854a.c 08/ned0854a.c +a 08/ned0854b.c 08/ned0854b.c +a 08/ned0854c.c 08/ned0854c.c +a 08/ned0854d.c 08/ned0854d.c +a 08/ned0854e.c 08/ned0854e.c +a 08/ned0854f.c 08/ned0854f.c +a 08/ned0854g.c 08/ned0854g.c +a 08/ned0854h.c 08/ned0854h.c +# +a 08/ned0856.c 08/ned0856.c +a 08/ned0857.c 08/ned0857.c +a 08/ned0857b.c 08/ned0857b.c +a 08/ned0857c.c 08/ned0857c.c +a 08/ned0858.c 08/ned0858.c +a 08/ned0858b.c 08/ned0858b.c +a 08/ned0859.c 08/ned0859.c +a 08/ned0860.c 08/ned0860.c +a 08/ned0861.c 08/ned0861.c +a 08/ned0862.c 08/ned0862.c +a 08/ned0863.c 08/ned0863.c +a 08/ned0863b.c 08/ned0863b.c +a 08/ned0864.c 08/ned0864.c +a 08/ned0865.c 08/ned0865.c +a 08/ned0866.c 08/ned0866.c +a 08/ned0867.c 08/ned0867.c +a 08/ned0867b.c 08/ned0867b.c +a 08/ned0868.c 08/ned0868.c +a 08/ned0869.c 08/ned0869.c +a 08/ned0869b.c 08/ned0869b.c +a 08/ned0870.c 08/ned0870.c +a 08/ned0871.c 08/ned0871.c +# +a 08/ned0873.c 08/ned0873.c +# +a 08/ned0875.c 08/ned0875.c +a 08/ned0876.c 08/ned0876.c +a 08/ned0877.c 08/ned0877.c +a 08/ned0878.c 08/ned0878.c +a 08/ned0879.c 08/ned0879.c +a 08/ned0879i.c 08/ned0879i.c +a 08/ned0879l.c 08/ned0879l.c +a 08/ned0879t.c 08/ned0879t.c +a 08/ned0880.c 08/ned0880.c +a 08/ned0881.c 08/ned0881.c +a 08/ned0882.c 08/ned0882.c +a 08/ned0884.c 08/ned0884.c +a 08/ned0885.c 08/ned0885.c +a 08/ned0885b.c 08/ned0885b.c +a 08/ned0886.c 08/ned0886.c +# -------------------------------------- +>if [ ! -d 09 ] +>then +> mkdir 09 +> mkdir 09/_bak_ftr.ned +>fi +a 09/(dirinf).fm 09/'(dirinf)'.fm +a 09/make-ux 09/make-ux +a 09/make-dos 09/make-dos +>ln -s make-ux 09/Makefile +a 09/ned0901.c 09/ned0901.c +a 09/ned0902.c 09/ned0902.c +a 09/ned0903.c 09/ned0903.c +# +a 09/ned0905.c 09/ned0905.c +a 09/ned0906.c 09/ned0906.c +a 09/ned0907.c 09/ned0907.c +a 09/ned0908.c 09/ned0908.c +a 09/ned0909.c 09/ned0909.c +a 09/ned0910.c 09/ned0910.c +a 09/ned0911.c 09/ned0911.c +a 09/ned0912.c 09/ned0912.c +a 09/ned0913.c 09/ned0913.c +a 09/ned0914.c 09/ned0914.c +a 09/ned0915.c 09/ned0915.c +a 09/ned0916.c 09/ned0916.c +a 09/ned0917.c 09/ned0917.c +a 09/ned0918.c 09/ned0918.c +a 09/ned0919.c 09/ned0919.c +a 09/ned0921.c 09/ned0921.c +a 09/ned0922.c 09/ned0922.c +a 09/ned0923.c 09/ned0923.c +a 09/ned0924.c 09/ned0924.c +a 09/ned0925.c 09/ned0925.c +a 09/ned0926.c 09/ned0926.c +a 09/ned0927.c 09/ned0927.c +a 09/ned0928.c 09/ned0928.c +a 09/ned0929.c 09/ned0929.c +a 09/ned0929s.c 09/ned0929s.c +a 09/ned0930.c 09/ned0930.c +a 09/ned0931.c 09/ned0931.c +a 09/ned0932.c 09/ned0932.c +a 09/ned0933.c 09/ned0933.c +a 09/ned0934.c 09/ned0934.c +a 09/ned0935.c 09/ned0935.c +a 09/ned0936.c 09/ned0936.c +a 09/ned0937.c 09/ned0937.c +a 09/ned0937b.c 09/ned0937b.c +a 09/ned0938.c 09/ned0938.c +a 09/ned0939.c 09/ned0939.c +a 09/ned0940.c 09/ned0940.c +a 09/ned0941.c 09/ned0941.c +a 09/ned0942.c 09/ned0942.c +a 09/ned0943.c 09/ned0943.c +a 09/ned0944.c 09/ned0944.c +a 09/ned0945.c 09/ned0945.c +a 09/ned0946.c 09/ned0946.c +a 09/ned0947.c 09/ned0947.c +a 09/ned0948.c 09/ned0948.c +a 09/ned0949.c 09/ned0949.c +a 09/ned0950.c 09/ned0950.c +a 09/ned0951a.c 09/ned0951a.c +a 09/ned0951b.c 09/ned0951b.c +# -- +a 09/ned0972.c 09/ned0972.c +a 09/ned0973.c 09/ned0973.c +a 09/ned0974.c 09/ned0974.c +a 09/ned0975.c 09/ned0975.c +a 09/ned0976.c 09/ned0976.c +a 09/ned0977.c 09/ned0977.c +a 09/ned0978.c 09/ned0978.c +a 09/ned0979.c 09/ned0979.c +a 09/ned0980.c 09/ned0980.c +a 09/ned0981.c 09/ned0981.c +# -------------------------------------- +>if [ ! -d 10 ] +>then +> mkdir 10 +> mkdir 10/_bak_ftr.ned +>fi +a 10/(dirinf).fm 10/'(dirinf)'.fm +a 10/make-ux 10/make-ux +a 10/make-dos 10/make-dos +>ln -s make-ux 10/Makefile +a 10/ned1001.c 10/ned1001.c +a 10/ned1002.c 10/ned1002.c +a 10/ned1003.c 10/ned1003.c +a 10/ned1004.c 10/ned1004.c +a 10/ned1005.c 10/ned1005.c +a 10/ned1006.c 10/ned1006.c +a 10/ned1007.c 10/ned1007.c +a 10/ned1008.c 10/ned1008.c +a 10/ned1009.c 10/ned1009.c +a 10/ned1010.c 10/ned1010.c +a 10/ned1011.c 10/ned1011.c +a 10/ned1012.c 10/ned1012.c +a 10/ned1013.c 10/ned1013.c +a 10/ned1014.c 10/ned1014.c +a 10/ned1015.c 10/ned1015.c +a 10/ned1016.c 10/ned1016.c +a 10/ned1017.c 10/ned1017.c +a 10/ned1018.c 10/ned1018.c +a 10/ned1019.c 10/ned1019.c +# -------------------------------------- +>if [ ! -d 11 ] +>then +> mkdir 11 +> mkdir 11/_bak_ftr.ned +>fi +a 11/(dirinf).fm 11/'(dirinf)'.fm +a 11/make-ux 11/make-ux +a 11/make-dos 11/make-dos +>ln -s make-ux 11/Makefile +a 11/ned1101.c 11/ned1101.c +a 11/ned1102.c 11/ned1102.c +a 11/ned1103.c 11/ned1103.c +a 11/ned1104.c 11/ned1104.c +a 11/ned1105.c 11/ned1105.c +a 11/ned1106.c 11/ned1106.c +a 11/ned1107.c 11/ned1107.c +a 11/ned1108.c 11/ned1108.c +a 11/ned1109.c 11/ned1109.c +a 11/ned1110.c 11/ned1110.c +a 11/ned1111.c 11/ned1111.c +a 11/ned1112.c 11/ned1112.c +a 11/ned1112v.c 11/ned1112v.c +a 11/ned1112w.c 11/ned1112w.c +a 11/ned1113.c 11/ned1113.c +# -------------------------------------- +>if [ ! -d 12 ] +>then +> mkdir 12 +> mkdir 12/_bak_ftr.ned +>fi +a 12/(dirinf).fm 12/'(dirinf)'.fm +a 12/make-ux 12/make-ux +a 12/make-dos 12/make-dos +>ln -s make-ux 12/Makefile +a 12/ned1201.c 12/ned1201.c +a 12/ned1202.c 12/ned1202.c +a 12/ned1203.c 12/ned1203.c +a 12/ned1204.c 12/ned1204.c +a 12/ned1204b.c 12/ned1204b.c +a 12/ned1205.c 12/ned1205.c +a 12/ned1206.c 12/ned1206.c +a 12/ned1207.c 12/ned1207.c +a 12/ned1208.c 12/ned1208.c +a 12/ned1209.c 12/ned1209.c +a 12/ned1210.c 12/ned1210.c +a 12/ned1211.c 12/ned1211.c +# +a 12/ned1299.c 12/ned1299.c +# -------------------------------------- +>if [ ! -d 13 ] +>then +> mkdir 13 +> mkdir 13/_bak_ftr.ned +>fi +a 13/(dirinf).fm 13/'(dirinf)'.fm +a 13/make-ux 13/make-ux +a 13/make-dos 13/make-dos +>ln -s make-ux 13/Makefile +a 13/ned1301.c 13/ned1301.c +a 13/ned1302.c 13/ned1302.c +# +a 13/ned1391.c 13/ned1391.c +a 13/ned1392.c 13/ned1392.c +# ---------------------------------------------------------------------------- +>if [ ! -d unix ] +>then +> mkdir unix +> mkdir unix/_bak_ftr.ned +>fi +a unix/(dirinf).fm unix/'(dirinf)'.fm +a unix/make-ux unix/make-ux +# unix/make-dos unix/make-dos +>ln -s make-ux unix/Makefile +a unix/harness.c unix/harness.c +a unix/nedelm.c unix/nedelm.c +a unix/keyboard.c unix/keyboard.c +a unix/tk2.c unix/tk2.c +a unix/tk2_scr.c unix/tk2_scr.c +# unix/unix1.c unix/unix1.c +a unix/unix2.c unix/unix2.c +a unix/uxwindat.c unix/uxwindat.c +# +# ---------------------------------------------------------------------------- +>if [ ! -d sbr ] +>then +> mkdir sbr +> mkdir sbr/_bak_ftr.ned +>fi +a make-sbr make-sbr +>ln -s ../make-sbr sbr/Makefile +# +a c:/usr/window/1/win_0102.c sbr/win_0102.c +a c:/usr/window/1/win_0111.c sbr/win_0111.c +a c:/usr/window/1/win_0112.c sbr/win_0112.c +a c:/usr/window/1/win_0125.c sbr/win_0125.c + diff --git a/app/ned/make-sbr b/app/ned/make-sbr new file mode 100644 index 0000000000000000000000000000000000000000..50b7983ab3cefbeb2cc7ab14ecaf7c92ec445319 --- /dev/null +++ b/app/ned/make-sbr @@ -0,0 +1,32 @@ +# +# FILE %ned/make-sbr (%ned/sbr/Makefile) +# +# UNIX version only! +# +# GG's Night(mare) Editor System +# translate a couple of library functions that were moved out +# of their original places +# +# written: 1993-06-28 +# latest update: 1996-07-13 19:41:32 +# +# ============================================================================ +cf=#-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow + +# configuration +# wmodel=-DW_MODEL_CURSES +# wmodel=-DW_MODEL_NCURSES -I/usr/include/ncurses +wmodel=-DW_MODEL_TK -I/usr/local/include + +ccc=cc -c -I.. $(cf) $(wmodel) +objs= win_0102.o win_0111.o win_0112.o win_0125.o +lib=../ned.a + +all : lib + +lib : $(objs) + ar ru $(lib) $? + touch lib + +.c.o: + $(ccc) $*.c diff --git a/app/ned/makeall.bat b/app/ned/makeall.bat new file mode 100644 index 0000000000000000000000000000000000000000..d4cfdc7c6a825247e5026c9834a1ebc35c2ecc58 --- /dev/null +++ b/app/ned/makeall.bat @@ -0,0 +1,32 @@ +:: FILE %ned/makeall.bat +:: latest update: 1997-08-28 19:21:38 +cd \usr\ned\00 +make -i >\usr\ned\$00.mk +cd \usr\ned\01 +make -i >\usr\ned\$01.mk +cd \usr\ned\02 +make -i >\usr\ned\$02.mk +cd \usr\ned\03 +make -i >\usr\ned\$03.mk +cd \usr\ned\04 +make -i >\usr\ned\$04.mk +cd \usr\ned\05 +make -i >\usr\ned\$05.mk +cd \usr\ned\06 +make -i >\usr\ned\$06.mk +cd \usr\ned\07 +make -i >\usr\ned\$07.mk +cd \usr\ned\08 +make -i >\usr\ned\$08.mk +cd \usr\ned\09 +make -i >\usr\ned\$09.mk +cd \usr\ned\10 +make -i >\usr\ned\$10.mk +cd \usr\ned\11 +make -i >\usr\ned\$11.mk +cd \usr\ned\12 +make -i >\usr\ned\$12.mk +cd \usr\ned\13 +make -i >\usr\ned\$13.mk +cd \usr\ned +make -i >\usr\ned\$.mk diff --git a/app/ned/message.h b/app/ned/message.h new file mode 100644 index 0000000000000000000000000000000000000000..ede1686f7727ec5d31f1699ad93f843294818d6f --- /dev/null +++ b/app/ned/message.h @@ -0,0 +1,31 @@ +/* + * FILE %ned/message.h + * + * Fehlermeldungen und Mitteilungen + * + * written: 1989 02 21 + * 1991 01 29: Revision + * latest update: 1997-01-05 17:05:57 + * + */ + +#ifndef __NED_message__ +#define __NED_message__ + +#define ERR_OPEN_WDW "MEM: can't open window" +#define ERR_OPEN_FILE "can't open file" +#define ERR_WDW_SIZE "WDW: window size not ok" +#define ERR_MEMORY "MEM: file truncated!" +#define ERR_SGML_READ "error reading SGML tagging sequence" + +#define QST_MAC_NUM "macro #: " +#define QST_MAC_TXT "macro text: " +#define QST_MAC_TYPE "macro type: t)cl k)eys " + +#define CNF_old_version "load old version? (Y|N) " /* 0314 */ +#define CNF_abandon "abandon changed file? (Y|N) " /* 0411 */ +#define CNF_panic "immediately abort NED? (Y|N) " /* 0413 */ + +#define CNF_pico_exit "Save modified buffer (ANSWERING 'No' WILL DESTROY CHANGES) ? (Y|N)" + +#endif /* __NED_message__ */ diff --git a/app/ned/msdos/(dirinf).fm b/app/ned/msdos/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..6ce183948693ea89e17ea011e1b6a51de2edc60b --- /dev/null +++ b/app/ned/msdos/(dirinf).fm @@ -0,0 +1,10 @@ +##!/usr/local/bin/perl +# FILE .../app/ned/msdos/(dirinf).fm +# +# written: 1999-05-01 +# latest update: 1999-05-01 19:43:34 +# $Id: (dirinf).fm,v 1.2 2002/05/02 06:48:29 gonter Exp $ +# + +possig.bat | let things be found +possig.awk | find things diff --git a/app/ned/msdos/a.awk b/app/ned/msdos/a.awk new file mode 100644 index 0000000000000000000000000000000000000000..09c5c484684cfee31eaeac0b13eb8b946217bc02 --- /dev/null +++ b/app/ned/msdos/a.awk @@ -0,0 +1,25 @@ +BEGIN { + fo=0; +} + { + gsub ("\\\\", "/"); + gsub ("/usr/ned", "%ned"); +# print +} +$1=="@h" && $3!="%ned" { + if (fo) { + printf ("</Frame>\n"); + fo=1; + } + sub ("%", ""); + split ($3, dn, "/"); + dnn=dn[2]; + printf ("<Frame ned/%d>", dnn); + if (dnn > 1) printf ("<HLINK fr=\"ned/%d\" dir=prev>", dnn-1); + if (dnn < 11) printf ("<HLINK fr=\"ned/%d\" dir=next>", dnn+1); + printf "\n" + fo=1; +} +$1=="@f" && fo==1 { + printf ("<HLINK file=\"%s%s\"> * %s%s\n", $3, $4, $3, $4); +} diff --git a/app/ned/msdos/a2.awk b/app/ned/msdos/a2.awk new file mode 100644 index 0000000000000000000000000000000000000000..860bef6e3634e84aa326fcd09ec558f49528fe58 --- /dev/null +++ b/app/ned/msdos/a2.awk @@ -0,0 +1,26 @@ +BEGIN { + ldn=-1; + fo=0; +} +substr($0,1,3)=="ned" { + dnn=substr($0,4,2)+0; + sub ("\\.C ", ".c "); + if (ldn != dnn) { + if (fo) { + printf "</Frame>\n" + fo=0; + } + printf ("<Frame ned/%02d>", dnn); + printf ("<HLINK fr=\"$$root\" dir=up>"); +# if (dnn > 1) + printf ("<HLINK fr=\"ned/%02d\" dir=prev>", dnn-1); + if (dnn < 11) printf ("<HLINK fr=\"ned/%02d\" dir=next>", dnn+1); + printf "\n" + printf ("-----------------------\n"); + printf ("NED module package # %02d\n", dnn); + printf ("-----------------------\n\n"); + fo=1; + ldn=dnn; + } + printf ("<HLINK file=\"%%ned/%02d/%s\">* %02d/%s\n", dnn, $1, dnn, $0); +} diff --git a/app/ned/msdos/a3.awk b/app/ned/msdos/a3.awk new file mode 100644 index 0000000000000000000000000000000000000000..223070234f2058612ba3ed65fb36c8b265d8441d --- /dev/null +++ b/app/ned/msdos/a3.awk @@ -0,0 +1,27 @@ + { + Gr=substr($0,7,2); + Mm=substr($0,9,2); + Mp=Mm-1; + Mn=Mm+1; + if ($2=="x") Mn=0; + if ($2=="y") Mp=0; + fout=sprintf ("%02d\\_bak_ftr.ned\\ned%02d%02d.ftr", Gr, Gr, Mm); + printf ("%s\n", fout); +# fout="\\dev\\con"; + xout(); +} +# +function xout() { + printf ("0 0 1 0 10 1 1 32760\n")>fout; + if (Mp > 0) { + printf (" 1 1 1 <HLINK file=\"%%ned/%02d/ned%02d%02d.c\" dir=prev>\n", + Gr, Gr, Mp)>>fout; + } + printf (" 2 1 1 <HLINK cl=\"%%ned/nedall.hyx\" fr=\"ned/%02d\" dir=up>\n", + Gr)>>fout; + if (Mn > 0) { + printf (" 3 1 1 <HLINK file=\"%%ned/%02d/ned%02d%02d.c\" dir=next>\n", + Gr, Gr, Mn)>>fout; + } + close(fout); +} diff --git a/app/ned/msdos/crf.awk b/app/ned/msdos/crf.awk new file mode 100644 index 0000000000000000000000000000000000000000..28a60879d9a1a8482702e5b04ed153879c8cfc40 --- /dev/null +++ b/app/ned/msdos/crf.awk @@ -0,0 +1,145 @@ +# +# FILE ~/usr/ned/crf.awk +# +# Cross Reference Cluster Generator +# +# This script can be used for two purposes: +# 1. generating cross reference frame for the %crf cluster +# 2. generating lookup-tags for ALT-TAB markups +# +# The input can either be the output of a run of "crf" or a +# run of "objdec -a". Objdec will do if only lookup tags are +# generated, otherwise the output from crf would be more +# desireable. +# +# written: 1991 10 24 +# latest update: 1995-06-15 +# +# ---------------------------------------------------------------------------- +BEGIN { + # out_mode= "feature.tfb"; + out_mode= "crf.lex"; + # out_mode= "crf.hyx"; + + fo= 0; + xfilenm= ""; + pfx= "" + yfilenm= ""; + frame= ""; +} + +FILENAME== "/etc/feature.mod"&&/^#/ { next; } +FILENAME== "/etc/feature.mod" { + split ($0,xx,":"); + mods[xx[1]]= xx[2]; + next; +} + +$1=="TITLE" { + filenm($2); + yfilenm= $2; +} + +# definition of symbols +$1=="d"||$1=="D"||$1=="PUBLIC" { + if (fo) print "</Frame>" + fo= 0; + + if ($1=="PUBLIC") ss= substr($2,2); else ss= substr($3,2); + if (substr(ss,1,4) == "cga_") ss= "w_" substr(ss,5); + if (substr(ss,1,5) == "bios_") ss= "w_" substr(ss,6); + frame= ss; + + if (out_mode=="crf.hyx") { + print "<Frame $"ss">" + print "Symbol "ss + fo= 1; + } + + if ($1!="PUBLIC") { + filenm($4); + yfilenm= $4; + } + + if (out_mode=="crf.hyx") { + printf ("\ndefined in <hyx.l file=\"%s\">* %s\n", xfilenm, $4); + print "used in:" + } + + if (out_mode=="feature.tfb") { + printf ("%s:F:<hyx.l file=\"%s\" mark=\"%s\" tdc=\"hyx.l\" tdp=%d>\n", + ss, xfilenm, ss, length(ss)); + } + + if (out_mode=="crf.lex") { + print "<:><LE>"ss"</LE><SYM>"ss"\n<PUB>"xfilenm"<;>"; + # print "<:><LE>@@fnc</LE><hyx.l fr=\""ss"\">"ss"<;>"; + } +} + +# +$1=="EXTRN" && $2=="__acrtused" { next; } + +$1=="g"||$1=="G"||$1=="EXTRN" { + if (fo) print "</Frame>" + fo= 0; +# print out info about symbol in an unknown module: + + if ($1=="EXTRN") ss= substr($2,2); else ss= substr($3,2); + if (substr(ss,1,4) == "cga_") ss= "w_" substr(ss,5); + if (substr(ss,1,5) == "bios_") ss= "w_" substr(ss,6); + + if (out_mode=="crf.hyx") { + print "<Frame $"ss">" + print "Symbol "ss + fo= 1; + filenm($4); + print "defined somewhere..." + print "used in:" + } + + if (out_mode=="crf.lex") { + print "<:><LE>"ss"</LE><EXT>"xfilenm"<;>"; + } +} + +# +($1=="u"||$1=="U")&&fo==1 { + if (out_mode=="crf.hyx") { + for (i=2; i<=NF;i++) if ($(i) != yfilenm) { + filenm($(i)); + printf ("<hyx.l file=\"%s\">* %s\n", xfilenm, xfilenm); + } + } +} + +END { + if (fo) print "</Frame>" +} + +# +function filenm(s) { + xfilenm= ""; + if (substr(s,1,3) == "ned") { + if (s == "ned00.c") xfilenm= "%ned/ned00.c"; else { + xfilenm= "%ned/"substr(s,4,2)"/"s + } + } else if (substr(s,1,4) == "win_" || substr(s,1,4) == "WIN_") { + lev= substr(s,6,1); + if (lev=="0") { + if (substr(frame,1,3)=="cga") lev="cga"; else + if (substr(frame,1,4)=="_cga") lev="cga"; else + if (substr(frame,1,4)=="bios") lev="bios"; else + if (substr(frame,1,5)=="_bios") lev="bios"; else + lev="cga"; # hmmm.... + } else if (lev=="a") { + lev="0"; + } + xfilenm= "%win/"lev"/"s + } else { + for (mm in mods) { + if (substr(s,1,length(mm))==mm) xfilenm= mods[mm]"/"s; + } + } + if (xfilenm=="") xfilenm= "%sbr/"s; +} diff --git a/app/ned/msdos/gentex.bat b/app/ned/msdos/gentex.bat new file mode 100644 index 0000000000000000000000000000000000000000..12e034d80d568ae1aa6e1701cd6035d8c9220dc3 --- /dev/null +++ b/app/ned/msdos/gentex.bat @@ -0,0 +1,465 @@ +awk gentex01>nedsrc.tex +echo %% function labels>nedsrc01.tex + +goto Normal + +echo \section{Module Group 03}>>nedsrc.tex +echo \def\LPtopB{Module Group 03}>>nedsrc.tex +awk gentex03 01/ned0131.c>>nedsrc.tex +awk gentex03 01/ned0132.c>>nedsrc.tex +awk gentex03 03/ned0301.c>>nedsrc.tex +awk gentex03 03/ned0302.c>>nedsrc.tex +awk gentex03 03/ned0303.c>>nedsrc.tex +awk gentex03 03/ned0304.c>>nedsrc.tex +awk gentex03 03/ned0305.c>>nedsrc.tex +awk gentex03 03/ned0306.c>>nedsrc.tex +awk gentex03 03/ned0307.c>>nedsrc.tex +awk gentex03 03/ned0308.c>>nedsrc.tex +awk gentex03 03/ned0309.c>>nedsrc.tex +awk gentex03 03/ned0310.c>>nedsrc.tex +awk gentex03 04/ned0423.c>>nedsrc.tex +goto END + +:Normal +echo \section{Headers}>>nedsrc.tex +echo \def\LPtopB{Headers}>>nedsrc.tex +awk gentex03 ed.h>>nedsrc.tex +awk gentex03 edhyx.h>>nedsrc.tex +awk gentex03 ned.h>>nedsrc.tex +awk gentex03 message.h>>nedsrc.tex +awk gentex03 proto.h>>nedsrc.tex + +echo \section{Main Module}>>nedsrc.tex +awk gentex03 ned00.c>>nedsrc.tex + +echo \section{Module Group 00}>>nedsrc.tex +echo \def\LPtopB{Module Group00: Tables and Variables}>>nedsrc.tex +awk gentex03 00/ned0001.c>>nedsrc.tex +awk gentex03 00/ned0001a.c>>nedsrc.tex +awk gentex03 00/ned0001f.c>>nedsrc.tex +awk gentex03 00/ned0001k.c>>nedsrc.tex +awk gentex03 00/ned0001o.c>>nedsrc.tex +awk gentex03 00/ned0001q.c>>nedsrc.tex +awk gentex03 00/ned0001u.c>>nedsrc.tex +awk gentex03 00/ned0001x.c>>nedsrc.tex +awk gentex03 00/ned0002.c>>nedsrc.tex +awk gentex03 00/ned0003.c>>nedsrc.tex +awk gentex03 00/ned0004.c>>nedsrc.tex +awk gentex03 00/ned0005.c>>nedsrc.tex +awk gentex03 00/ned0006.c>>nedsrc.tex +awk gentex03 00/ned0007.c>>nedsrc.tex +awk gentex03 00/ned0008.c>>nedsrc.tex +awk gentex03 00/ned0009.c>>nedsrc.tex +awk gentex03 00/ned0010.c>>nedsrc.tex +awk gentex03 00/ned0011.c>>nedsrc.tex + +echo \section{Module Group 01}>>nedsrc.tex +echo \def\LPtopB{Module Group01: Basic Primitives}>>nedsrc.tex +awk gentex03 01/ned0101.c>>nedsrc.tex +awk gentex03 01/ned0102.c>>nedsrc.tex +awk gentex03 01/ned0103.c>>nedsrc.tex +awk gentex03 01/ned0104.c>>nedsrc.tex +awk gentex03 01/ned0105.c>>nedsrc.tex +awk gentex03 01/ned0106.c>>nedsrc.tex +awk gentex03 01/ned0107.c>>nedsrc.tex +awk gentex03 01/ned0108.c>>nedsrc.tex +awk gentex03 01/ned0109.c>>nedsrc.tex +awk gentex03 01/ned0110.c>>nedsrc.tex +awk gentex03 01/ned0111.c>>nedsrc.tex +awk gentex03 01/ned0112.c>>nedsrc.tex +awk gentex03 01/ned0113.c>>nedsrc.tex +awk gentex03 01/ned0114.c>>nedsrc.tex +awk gentex03 01/ned0115.c>>nedsrc.tex +awk gentex03 01/ned0116.c>>nedsrc.tex +awk gentex03 01/ned0117.c>>nedsrc.tex +awk gentex03 01/ned0118.c>>nedsrc.tex +awk gentex03 01/ned0119.c>>nedsrc.tex +awk gentex03 01/ned0120.c>>nedsrc.tex +awk gentex03 01/ned0121.c>>nedsrc.tex +awk gentex03 01/ned0122.c>>nedsrc.tex +awk gentex03 01/ned0123.c>>nedsrc.tex +awk gentex03 01/ned0124.c>>nedsrc.tex +awk gentex03 01/ned0125.c>>nedsrc.tex +awk gentex03 01/ned0126.c>>nedsrc.tex +awk gentex03 01/ned0127.c>>nedsrc.tex +awk gentex03 01/ned0128.c>>nedsrc.tex +awk gentex03 01/ned0129.c>>nedsrc.tex +awk gentex03 01/ned0131.c>>nedsrc.tex +awk gentex03 01/ned0132.c>>nedsrc.tex +awk gentex03 01/ned0133.c>>nedsrc.tex +awk gentex03 01/ned0134.c>>nedsrc.tex +awk gentex03 01/ned0135.c>>nedsrc.tex +awk gentex03 01/ned0136.c>>nedsrc.tex +awk gentex03 01/ned0137.c>>nedsrc.tex +awk gentex03 01/ned0138.c>>nedsrc.tex +awk gentex03 01/ned0139.c>>nedsrc.tex +awk gentex03 01/ned0140.c>>nedsrc.tex +awk gentex03 01/ned0141.c>>nedsrc.tex + +echo \section{Module Group 02}>>nedsrc.tex +echo \def\LPtopB{Module Group02: Basic Primitives}>>nedsrc.tex +awk gentex03 02/ned0202.c>>nedsrc.tex +awk gentex03 02/ned0203.c>>nedsrc.tex +awk gentex03 02/ned0204.c>>nedsrc.tex +awk gentex03 02/ned0205.c>>nedsrc.tex +awk gentex03 02/ned0206.c>>nedsrc.tex +awk gentex03 02/ned0207.c>>nedsrc.tex +awk gentex03 02/ned0208.c>>nedsrc.tex +awk gentex03 02/ned0209.c>>nedsrc.tex +awk gentex03 02/ned0210.c>>nedsrc.tex +awk gentex03 02/ned0211.c>>nedsrc.tex +awk gentex03 02/ned0212.c>>nedsrc.tex +awk gentex03 02/ned0213.c>>nedsrc.tex +awk gentex03 02/ned0214.c>>nedsrc.tex +awk gentex03 02/ned0215.c>>nedsrc.tex +awk gentex03 02/ned0216.c>>nedsrc.tex +awk gentex03 02/ned0217.c>>nedsrc.tex +awk gentex03 02/ned0218.c>>nedsrc.tex +awk gentex03 02/ned0219.c>>nedsrc.tex +awk gentex03 02/ned0220.c>>nedsrc.tex +awk gentex03 02/ned0221.c>>nedsrc.tex +awk gentex03 02/ned0222.c>>nedsrc.tex +awk gentex03 02/ned0223.c>>nedsrc.tex +awk gentex03 02/ned0224.c>>nedsrc.tex +awk gentex03 02/ned0225.c>>nedsrc.tex +awk gentex03 02/ned0226.c>>nedsrc.tex +awk gentex03 02/ned0227.c>>nedsrc.tex +awk gentex03 02/ned0228.c>>nedsrc.tex +awk gentex03 02/ned0229.c>>nedsrc.tex +awk gentex03 02/ned0230.c>>nedsrc.tex +awk gentex03 02/ned0231.c>>nedsrc.tex +awk gentex03 02/ned0232.c>>nedsrc.tex + +echo \section{Module Group 03}>>nedsrc.tex +echo \def\LPtopB{Module Group03: Primitives}>>nedsrc.tex +awk gentex03 03/ned0301.c>>nedsrc.tex +awk gentex03 03/ned0302.c>>nedsrc.tex +awk gentex03 03/ned0303.c>>nedsrc.tex +awk gentex03 03/ned0304.c>>nedsrc.tex +awk gentex03 03/ned0305.c>>nedsrc.tex +awk gentex03 03/ned0306.c>>nedsrc.tex +awk gentex03 03/ned0307.c>>nedsrc.tex +awk gentex03 03/ned0308.c>>nedsrc.tex +awk gentex03 03/ned0309.c>>nedsrc.tex +awk gentex03 03/ned0310.c>>nedsrc.tex +awk gentex03 03/ned0311.c>>nedsrc.tex +awk gentex03 03/ned0312.c>>nedsrc.tex +awk gentex03 03/ned0313.c>>nedsrc.tex +awk gentex03 03/ned0314.c>>nedsrc.tex +awk gentex03 03/ned0315.c>>nedsrc.tex +awk gentex03 03/ned0316.c>>nedsrc.tex +awk gentex03 03/ned0317.c>>nedsrc.tex +awk gentex03 03/ned0318.c>>nedsrc.tex +awk gentex03 03/ned0319.c>>nedsrc.tex +awk gentex03 03/ned0320.c>>nedsrc.tex +awk gentex03 03/ned0321.c>>nedsrc.tex +awk gentex03 03/ned0322.c>>nedsrc.tex +awk gentex03 03/ned0323.c>>nedsrc.tex +awk gentex03 03/ned0324.c>>nedsrc.tex +awk gentex03 03/ned0325.c>>nedsrc.tex +awk gentex03 03/ned0326.c>>nedsrc.tex +awk gentex03 03/ned0327.c>>nedsrc.tex +awk gentex03 03/ned0328.c>>nedsrc.tex +awk gentex03 03/ned0329.c>>nedsrc.tex +awk gentex03 03/ned0330.c>>nedsrc.tex +awk gentex03 03/ned0331.c>>nedsrc.tex +awk gentex03 03/ned0332.c>>nedsrc.tex +awk gentex03 03/ned0333.c>>nedsrc.tex + +echo \section{Module Group 04: Filehandling}>>nedsrc.tex +echo \def\LPtopB{Module Group04: Filehandling}>>nedsrc.tex +awk gentex03 04/ned0401.c>>nedsrc.tex +awk gentex03 04/ned0402.c>>nedsrc.tex +awk gentex03 04/ned0403.c>>nedsrc.tex +awk gentex03 04/ned0404.c>>nedsrc.tex +awk gentex03 04/ned0405.c>>nedsrc.tex +awk gentex03 04/ned0406.c>>nedsrc.tex +awk gentex03 04/ned0408.c>>nedsrc.tex +awk gentex03 04/ned0409.c>>nedsrc.tex +awk gentex03 04/ned0410.c>>nedsrc.tex +awk gentex03 04/ned0411.c>>nedsrc.tex +awk gentex03 04/ned0412.c>>nedsrc.tex +awk gentex03 04/ned0413.c>>nedsrc.tex +awk gentex03 04/ned0414.c>>nedsrc.tex +awk gentex03 04/ned0415.c>>nedsrc.tex +awk gentex03 04/ned0416.c>>nedsrc.tex +awk gentex03 04/ned0417.c>>nedsrc.tex +awk gentex03 04/ned0418.c>>nedsrc.tex +awk gentex03 04/ned0419.c>>nedsrc.tex +awk gentex03 04/ned0420.c>>nedsrc.tex +awk gentex03 04/ned0421.c>>nedsrc.tex +awk gentex03 04/ned0422.c>>nedsrc.tex +awk gentex03 04/ned0423.c>>nedsrc.tex +awk gentex03 04/ned0424.c>>nedsrc.tex +awk gentex03 04/ned0425.c>>nedsrc.tex +awk gentex03 04/ned0426.c>>nedsrc.tex +awk gentex03 04/ned0427.c>>nedsrc.tex +awk gentex03 04/ned0428.c>>nedsrc.tex +awk gentex03 04/ned0429.c>>nedsrc.tex +awk gentex03 04/ned0430.c>>nedsrc.tex + +echo \section{Module Group 05}>>nedsrc.tex +echo \def\LPtopB{Module Group05}>>nedsrc.tex +awk gentex03 05/ned0501.c>>nedsrc.tex +awk gentex03 05/ned0502.c>>nedsrc.tex +awk gentex03 05/ned0503.c>>nedsrc.tex +awk gentex03 05/ned0504.c>>nedsrc.tex +awk gentex03 05/ned0505.c>>nedsrc.tex +awk gentex03 05/ned0506.c>>nedsrc.tex +awk gentex03 05/ned0507.c>>nedsrc.tex +awk gentex03 05/ned0508.c>>nedsrc.tex +awk gentex03 05/ned0509.c>>nedsrc.tex +awk gentex03 05/ned0510.c>>nedsrc.tex +awk gentex03 05/ned0511.c>>nedsrc.tex +awk gentex03 05/ned0512.c>>nedsrc.tex +awk gentex03 05/ned0513.c>>nedsrc.tex +awk gentex03 05/ned0514.c>>nedsrc.tex +awk gentex03 05/ned0515.c>>nedsrc.tex +awk gentex03 05/ned0516.c>>nedsrc.tex +awk gentex03 05/ned0517.c>>nedsrc.tex +awk gentex03 05/ned0518.c>>nedsrc.tex +awk gentex03 05/ned0519.c>>nedsrc.tex +awk gentex03 05/ned0520.c>>nedsrc.tex +awk gentex03 05/ned0521.c>>nedsrc.tex +awk gentex03 05/ned0522.c>>nedsrc.tex + +echo \section{Module Group 06}>>nedsrc.tex +echo \def\LPtopB{Module Group06}>>nedsrc.tex +awk gentex03 06/ned0603.c>>nedsrc.tex +awk gentex03 06/ned0604.c>>nedsrc.tex +awk gentex03 06/ned0605.c>>nedsrc.tex +awk gentex03 06/ned0606.c>>nedsrc.tex +awk gentex03 06/ned0607.c>>nedsrc.tex +awk gentex03 06/ned0608.c>>nedsrc.tex +awk gentex03 06/ned0609.c>>nedsrc.tex +awk gentex03 06/ned0610.c>>nedsrc.tex +awk gentex03 06/ned0611.c>>nedsrc.tex +awk gentex03 06/ned0612.c>>nedsrc.tex +awk gentex03 06/ned0613.c>>nedsrc.tex +awk gentex03 06/ned0615.c>>nedsrc.tex +awk gentex03 06/ned0616.c>>nedsrc.tex +awk gentex03 06/ned0617.c>>nedsrc.tex +awk gentex03 06/ned0618.c>>nedsrc.tex +awk gentex03 06/ned0619.c>>nedsrc.tex +awk gentex03 06/ned0620.c>>nedsrc.tex +awk gentex03 06/ned0621.c>>nedsrc.tex +awk gentex03 06/ned0622.c>>nedsrc.tex +awk gentex03 06/ned0623.c>>nedsrc.tex +awk gentex03 06/ned0624.c>>nedsrc.tex +awk gentex03 06/ned0625.c>>nedsrc.tex +awk gentex03 06/ned0626.c>>nedsrc.tex + +echo \section{Module Group 07}>>nedsrc.tex +echo \def\LPtopB{Module Group07}>>nedsrc.tex +awk gentex03 07/ned0701.c>>nedsrc.tex +awk gentex03 07/ned0702.c>>nedsrc.tex +awk gentex03 07/ned0703.c>>nedsrc.tex +awk gentex03 07/ned0704.c>>nedsrc.tex +awk gentex03 07/ned0705.c>>nedsrc.tex +awk gentex03 07/ned0706.c>>nedsrc.tex +awk gentex03 07/ned0707.c>>nedsrc.tex +awk gentex03 07/ned0708.c>>nedsrc.tex +awk gentex03 07/ned0709.c>>nedsrc.tex +awk gentex03 07/ned0710.c>>nedsrc.tex +awk gentex03 07/ned0711.c>>nedsrc.tex +awk gentex03 07/ned0712.c>>nedsrc.tex +awk gentex03 07/ned0713.c>>nedsrc.tex +awk gentex03 07/ned0714.c>>nedsrc.tex +awk gentex03 07/ned0715.c>>nedsrc.tex +awk gentex03 07/ned0716.c>>nedsrc.tex +awk gentex03 07/ned0717.c>>nedsrc.tex +awk gentex03 07/ned0718.c>>nedsrc.tex +awk gentex03 07/ned0719.c>>nedsrc.tex +awk gentex03 07/ned0720.c>>nedsrc.tex +awk gentex03 07/ned0721.c>>nedsrc.tex +awk gentex03 07/ned0722.c>>nedsrc.tex +awk gentex03 07/ned0723.c>>nedsrc.tex +awk gentex03 07/ned0724.c>>nedsrc.tex +awk gentex03 07/ned0725.c>>nedsrc.tex +awk gentex03 07/ned0726.c>>nedsrc.tex +awk gentex03 07/ned0727.c>>nedsrc.tex +awk gentex03 07/ned0728.c>>nedsrc.tex +awk gentex03 07/ned0729.c>>nedsrc.tex +awk gentex03 07/ned0730.c>>nedsrc.tex +awk gentex03 07/ned0731a.c>>nedsrc.tex +awk gentex03 07/ned0731p.c>>nedsrc.tex +awk gentex03 07/ned0731w.c>>nedsrc.tex +awk gentex03 07/ned0732.c>>nedsrc.tex +awk gentex03 07/ned0733.c>>nedsrc.tex +awk gentex03 07/ned0734.c>>nedsrc.tex +awk gentex03 07/ned0735.c>>nedsrc.tex +awk gentex03 07/ned0736.c>>nedsrc.tex +awk gentex03 07/ned0737.c>>nedsrc.tex +awk gentex03 07/ned0738.c>>nedsrc.tex +awk gentex03 07/ned0739.c>>nedsrc.tex +awk gentex03 07/ned0740.c>>nedsrc.tex +awk gentex03 07/ned0741.c>>nedsrc.tex +awk gentex03 07/ned0742.c>>nedsrc.tex +awk gentex03 07/ned0743.c>>nedsrc.tex +awk gentex03 07/ned0744.c>>nedsrc.tex +awk gentex03 07/ned0745.c>>nedsrc.tex +awk gentex03 07/ned0746.c>>nedsrc.tex +awk gentex03 07/ned0747.c>>nedsrc.tex +awk gentex03 07/ned0748.c>>nedsrc.tex + +echo \section{Module Group 08: Features and Hypertext}>>nedsrc.tex +echo \def\LPtopB{Module Group08: Features and Hypertext}>>nedsrc.tex +awk gentex03 08/ned0803.c>>nedsrc.tex +awk gentex03 08/ned0804.c>>nedsrc.tex +awk gentex03 08/ned0805.c>>nedsrc.tex +awk gentex03 08/ned0806.c>>nedsrc.tex +awk gentex03 08/ned0807.c>>nedsrc.tex +awk gentex03 08/ned0808.c>>nedsrc.tex +awk gentex03 08/ned0809.c>>nedsrc.tex +awk gentex03 08/ned0810.c>>nedsrc.tex +awk gentex03 08/ned0811.c>>nedsrc.tex +awk gentex03 08/ned0812.c>>nedsrc.tex +awk gentex03 08/ned0813.c>>nedsrc.tex +awk gentex03 08/ned0814.c>>nedsrc.tex +awk gentex03 08/ned0821.c>>nedsrc.tex +awk gentex03 08/ned0822.c>>nedsrc.tex +awk gentex03 08/ned0823.c>>nedsrc.tex +awk gentex03 08/ned0824.c>>nedsrc.tex +awk gentex03 08/ned0825.c>>nedsrc.tex +awk gentex03 08/ned0826.c>>nedsrc.tex +awk gentex03 08/ned0827.c>>nedsrc.tex +awk gentex03 08/ned0828.c>>nedsrc.tex +awk gentex03 08/ned0830.c>>nedsrc.tex +awk gentex03 08/ned0831.c>>nedsrc.tex +awk gentex03 08/ned0832.c>>nedsrc.tex +awk gentex03 08/ned0833.c>>nedsrc.tex +awk gentex03 08/ned0834.c>>nedsrc.tex +awk gentex03 08/ned0835.c>>nedsrc.tex +awk gentex03 08/ned0836.c>>nedsrc.tex +awk gentex03 08/ned0837.c>>nedsrc.tex +awk gentex03 08/ned0838.c>>nedsrc.tex +awk gentex03 08/ned0839.c>>nedsrc.tex +awk gentex03 08/ned0840.c>>nedsrc.tex +awk gentex03 08/ned0841.c>>nedsrc.tex +awk gentex03 08/ned0842.c>>nedsrc.tex +awk gentex03 08/ned0843.c>>nedsrc.tex +awk gentex03 08/ned0844.c>>nedsrc.tex +awk gentex03 08/ned0845.c>>nedsrc.tex +awk gentex03 08/ned0846.c>>nedsrc.tex +awk gentex03 08/ned0847.c>>nedsrc.tex +awk gentex03 08/ned0848.c>>nedsrc.tex +awk gentex03 08/ned0849.c>>nedsrc.tex +awk gentex03 08/ned0850.c>>nedsrc.tex +awk gentex03 08/ned0851.c>>nedsrc.tex +awk gentex03 08/ned0852.c>>nedsrc.tex +awk gentex03 08/ned0853.c>>nedsrc.tex +awk gentex03 08/ned0854.c>>nedsrc.tex +awk gentex03 08/ned0855.c>>nedsrc.tex +awk gentex03 08/ned0856.c>>nedsrc.tex +awk gentex03 08/ned0857.c>>nedsrc.tex +awk gentex03 08/ned0858.c>>nedsrc.tex +awk gentex03 08/ned0859.c>>nedsrc.tex +awk gentex03 08/ned0860.c>>nedsrc.tex +awk gentex03 08/ned0861.c>>nedsrc.tex +awk gentex03 08/ned0862.c>>nedsrc.tex +awk gentex03 08/ned0863.c>>nedsrc.tex +awk gentex03 08/ned0864.c>>nedsrc.tex +awk gentex03 08/ned0865.c>>nedsrc.tex +awk gentex03 08/ned0866.c>>nedsrc.tex +awk gentex03 08/ned0867.c>>nedsrc.tex +awk gentex03 08/ned0868.c>>nedsrc.tex +awk gentex03 08/ned0869.c>>nedsrc.tex +awk gentex03 08/ned0870.c>>nedsrc.tex +awk gentex03 08/ned0871.c>>nedsrc.tex +awk gentex03 08/ned0872.c>>nedsrc.tex +awk gentex03 08/ned0873.c>>nedsrc.tex +awk gentex03 08/ned0874.c>>nedsrc.tex +awk gentex03 08/ned0875.c>>nedsrc.tex +awk gentex03 08/ned0876.c>>nedsrc.tex +awk gentex03 08/ned0877.c>>nedsrc.tex +awk gentex03 08/ned0878.c>>nedsrc.tex +awk gentex03 08/ned0879.c>>nedsrc.tex +awk gentex03 08/ned0880.c>>nedsrc.tex +awk gentex03 08/ned0881.c>>nedsrc.tex +awk gentex03 08/ned0882.c>>nedsrc.tex +awk gentex03 08/ned0883.c>>nedsrc.tex + +echo \section{Module Group 09}>>nedsrc.tex +echo \def\LPtopB{Module Group09}>>nedsrc.tex +awk gentex03 09/ned0901.c>>nedsrc.tex +awk gentex03 09/ned0902.c>>nedsrc.tex +awk gentex03 09/ned0903.c>>nedsrc.tex +awk gentex03 09/ned0904.c>>nedsrc.tex +awk gentex03 09/ned0905.c>>nedsrc.tex +awk gentex03 09/ned0906.c>>nedsrc.tex +awk gentex03 09/ned0907.c>>nedsrc.tex +awk gentex03 09/ned0908.c>>nedsrc.tex +awk gentex03 09/ned0909.c>>nedsrc.tex +awk gentex03 09/ned0910.c>>nedsrc.tex +awk gentex03 09/ned0911.c>>nedsrc.tex +awk gentex03 09/ned0912.c>>nedsrc.tex +awk gentex03 09/ned0913.c>>nedsrc.tex +awk gentex03 09/ned0914.c>>nedsrc.tex +awk gentex03 09/ned0915.c>>nedsrc.tex +awk gentex03 09/ned0916.c>>nedsrc.tex +awk gentex03 09/ned0917.c>>nedsrc.tex +awk gentex03 09/ned0918.c>>nedsrc.tex +awk gentex03 09/ned0919.c>>nedsrc.tex +awk gentex03 09/ned0921.c>>nedsrc.tex +awk gentex03 09/ned0972.c>>nedsrc.tex +awk gentex03 09/ned0973.c>>nedsrc.tex +awk gentex03 09/ned0974.c>>nedsrc.tex +awk gentex03 09/ned0975.c>>nedsrc.tex +awk gentex03 09/ned0976.c>>nedsrc.tex +awk gentex03 09/ned0977.c>>nedsrc.tex +awk gentex03 09/ned0978.c>>nedsrc.tex +awk gentex03 09/ned0979.c>>nedsrc.tex +awk gentex03 09/ned0980.c>>nedsrc.tex + +echo \section{Module Group 10}>>nedsrc.tex +echo \def\LPtopB{Module Group10}>>nedsrc.tex +awk gentex03 10/ned1001.c>>nedsrc.tex +awk gentex03 10/ned1002.c>>nedsrc.tex +awk gentex03 10/ned1003.c>>nedsrc.tex +awk gentex03 10/ned1004.c>>nedsrc.tex +awk gentex03 10/ned1005.c>>nedsrc.tex +awk gentex03 10/ned1006.c>>nedsrc.tex +awk gentex03 10/ned1007.c>>nedsrc.tex +awk gentex03 10/ned1008.c>>nedsrc.tex +awk gentex03 10/ned1009.c>>nedsrc.tex +awk gentex03 10/ned1010.c>>nedsrc.tex +awk gentex03 10/ned1011.c>>nedsrc.tex +awk gentex03 10/ned1012.c>>nedsrc.tex +awk gentex03 10/ned1013.c>>nedsrc.tex +awk gentex03 10/ned1014.c>>nedsrc.tex +awk gentex03 10/ned1015.c>>nedsrc.tex +awk gentex03 10/ned1016.c>>nedsrc.tex + +echo \section{Module Group 11}>>nedsrc.tex +echo \def\LPtopB{Module Group11}>>nedsrc.tex +awk gentex03 11/ned1101.c>>nedsrc.tex +awk gentex03 11/ned1102.c>>nedsrc.tex +awk gentex03 11/ned1103.c>>nedsrc.tex +awk gentex03 11/ned1104.c>>nedsrc.tex +awk gentex03 11/ned1105.c>>nedsrc.tex +awk gentex03 11/ned1106.c>>nedsrc.tex +awk gentex03 11/ned1107.c>>nedsrc.tex +awk gentex03 11/ned1108.c>>nedsrc.tex +awk gentex03 11/ned1109.c>>nedsrc.tex + +:END +echo \pagebreak[4]>>nedsrc.tex +echo \begin{appendix}>>nedsrc.tex +echo \section{Index}>>nedsrc.tex +echo \def\LPtopB{Index}>>nedsrc.tex +echo \def\LPtopC{~}>>nedsrc.tex +echo \def\LPtopD{~}>>nedsrc.tex +echo \begin{tabbing}>>nedsrc.tex +echo \rule{8cm}{0mm}\=\rule{8cm}{0mm}\= \kill>>nedsrc.tex +echo \input{nedsrc01}>>nedsrc.tex +echo \end{tabbing}>>nedsrc.tex +echo \end{appendix}>>nedsrc.tex +echo \end{document}>>nedsrc.tex + +translit -tgentextr.tbl nedsrc.tex +sort <nedsrc01.tex >$1.tex +copy $1.tex nedsrc01.tex +translit -tgentextr.tbl nedsrc01.tex + +copy nedsrc*.tex l: +list nedsrc.tex diff --git a/app/ned/msdos/gentex01.awk b/app/ned/msdos/gentex01.awk new file mode 100644 index 0000000000000000000000000000000000000000..2416c468ff88ccdca5c45568bc23d61482538bec --- /dev/null +++ b/app/ned/msdos/gentex01.awk @@ -0,0 +1,19 @@ +BEGIN { + print "\\documentstyle[lpr,appleps]{article}" + print "\\pagestyle{myheadings}" + print "\\parindent0mm" + print "\\hbadness=20000" + print "\\textwidth140mm" + print "\\begin{document}" + print "\\def\\LPtopA{{\\Large NED} --- {\\sl The Network Editor}}" + print "\\pagenumbering{roman}" + print "\\title{NED\\\\---\\\\The Network Editor}" + print "\\author{Gerhard Gonter}\\date{\\today}\\maketitle" + print "\\pagebreak[4]" + print "\\tableofcontents" + print "\\def\\LPtopB{Contents}" + print "\\pagebreak[4]" + print "\\pagenumbering{arabic}" + print "\\setcounter{page}{1}" + print "\\small\\tt" +} diff --git a/app/ned/msdos/gentex03.awk b/app/ned/msdos/gentex03.awk new file mode 100644 index 0000000000000000000000000000000000000000..9df15f52454292efb8d271245a68ad1ef229057a --- /dev/null +++ b/app/ned/msdos/gentex03.awk @@ -0,0 +1,89 @@ +# File /usr/ned/lpr03.awk +# process a NED source single file for line printing +BEGIN { + fnm=""; + ver=0; +} +fnm=="" { + print "\\subsection{\\tt "FILENAME"}"; + print "\\def\\LPtopC{\\tt "FILENAME"}"; + print "\\def\\LPtopD{~}"; + fnm=FILENAME; +} +$0=="" { + if (ver) { +# print "\\end{verbatim}"; + ver=0; + } + print; + next; +} +substr($0,1,1)!=" "&&substr($3,1,1)=="("&& + ($1=="void"||$1=="int"||$1=="char") { +# if (ver) { +# printf "\\end{verbatim}"; +# ver=0; +# } + xfunc=$2; + xtype=$1" "; + while (substr(xfunc,1,1)=="*") { + xfunc=substr(xfunc,2); + xtype=xtype"*"; + } + printf "\\label{"xfunc"}\\marginpar{$\\leftarrow$}" + printf "\\def\\LPtopD{"translit(xtype" "xfunc)"}" + printf translit(xfunc)" \\> "translit(xtype)>>"nedsrc01.tex"; + print "\\> \\pageref{"xfunc"}\\\\">>"nedsrc01.tex"; +} +substr($0,1,1)!=" "&&substr($4,1,1)=="("&&$1=="struct" { +# if (ver) { +# printf "\\end{verbatim}"; +# ver=0; +# } + xfunc=$3; + xtype=$1" "$2" "; + while (substr(xfunc,1,1)=="*") { + xfunc=substr(xfunc,2); + xtype=xtype"*"; + } + printf "\\label{"xfunc"}\\marginpar{$\\leftarrow$}" + printf "\\def\\LPtopD{"translit(xtype" "xfunc)"}" + printf translit(xfunc)" \\> "translit(xtype)>>"nedsrc01.tex"; + print "\\> \\pageref{"xfunc"}\\\\">>"nedsrc01.tex"; +} +ver==0 { +# print "\\begin{verbatim}"; + ver=1; +} + { + str=$0; + strip=0; + while (substr(str,1,1)==" ") { +# printf "\\rule{1ex}{0mm}"; + strip++; + str=substr(str,2); + } + if (strip>0) { printf ("\\rule{%3.2fex}{0mm}", strip*1.22); } + print "\\verb`"str"`\\\\"; +} + +END { + if (ver) { +# print "\\end{verbatim}"; + ver=0; + } +} + +function translit(x) { + gsub ("\\","\\backslash",x); + gsub ("#","\\#",x); + gsub ("$","\\$",x); + gsub ("&","\\\\&",x); + gsub ("~","\\~",x); + gsub ("_","\\_",x); + gsub ("\\^","\\^",x); # bug in awk? + gsub ("%","\\%",x); + gsub ("{","\\{",x); + gsub ("}","\\}",x); + return x; +} diff --git a/app/ned/msdos/gentextr.tbl b/app/ned/msdos/gentextr.tbl new file mode 100644 index 0000000000000000000000000000000000000000..b16d12995e5ba56c9276eda580d5c7e31756f75f --- /dev/null +++ b/app/ned/msdos/gentextr.tbl @@ -0,0 +1,3 @@ +@delete +x0D +@end diff --git a/app/ned/msdos/make4dos.awk b/app/ned/msdos/make4dos.awk new file mode 100644 index 0000000000000000000000000000000000000000..571a9fdc448bf575d640b137071cbe2777b7af86 --- /dev/null +++ b/app/ned/msdos/make4dos.awk @@ -0,0 +1,34 @@ +# MAKE4DOS.AWK 1992-01-17 +# makeup for MSDOS makefiles (zorland make) +# ---------------------------------------------------------------------------- +BEGIN { + st=0; # 0 .. nothing; 1 .. target, makro or rule; 2 .. t2d */ +} +substr($0,1,1)=="#" { + print; + next +} +substr($0,1,1)==" " { + printf (" "); + for (i=1;i<=NF;i++) printf (" %s", $(i)); + printf ("\n"); + next +} +substr($0,1,1)==" " { # UNIX + printf (" %s", $(1)); + for (i=2;i<=NF;i++) printf (" %s", $(i)); + printf ("\n"); + st=2; + next +} +NF>0 { + printf ("%s", $1); + for (i=2;i<=NF;i++) printf (" %s", $(i)); + printf ("\n"); + st=1; + next +} +NF==0 { + print; + st=0; +} diff --git a/app/ned/msdos/make4ux.awk b/app/ned/msdos/make4ux.awk new file mode 100644 index 0000000000000000000000000000000000000000..67187ffd5c759322b1c36ec7843fc1162b517757 --- /dev/null +++ b/app/ned/msdos/make4ux.awk @@ -0,0 +1,49 @@ +# MAKE4UX.AWK 1992-01-17 +# prepare UNIX makefiles from MSDOS make (zorland make) +# ---------------------------------------------------------------------------- +BEGIN { + st=0; # 0 .. nothing; 1 .. target, macro or rule; 2 .. t2d */ +} +substr($0,1,1)=="#" { + print; + next; +} +substr($0,1,1)==" " { + if (st==1) { + printf (" "); + for (i=1;i<NF;i++) printf (" %s", $(i)); + } else if (st==2) { + printf (" %s", $(1)); + for (i=2;i<NF;i++) printf (" %s", $(i)); + } else printf ("%s", $0); + if (NF>1) { + if ($(NF)=="!" || $(NF)=="\\") { + printf (" \\"); + } else printf (" %s", $(NF)); + } + printf ("\n"); + next; +} +substr($0,1,1)==" " { # UNIX + printf (" %s", $(1)); + for (i=2;i<=NF;i++) printf (" %s", $(i)); + printf ("\n"); + next; +} +NF>0 { + st=2; + printf ("%s", $1); + for (i=2;i<NF;i++) printf (" %s", $(i)); + if (NF>1) { + if ($(NF)=="!" || $(NF)=="\\") { + printf (" \\"); + st=1; + } else printf (" %s", $(NF)); + } + printf ("\n"); + next; +} +NF==0 { + print; + st=0; +} diff --git a/app/ned/msdos/multi.awk b/app/ned/msdos/multi.awk new file mode 100644 index 0000000000000000000000000000000000000000..56f6d4c93ce15ddaadf993768188a2c7553074c8 --- /dev/null +++ b/app/ned/msdos/multi.awk @@ -0,0 +1,24 @@ +# +# FILE %ned/multi.awk +# +# find multiply defined symbols +# +# written: 1995-06-15 +# latest update: 1995-06-15 +# +# ---------------------------------------------------------------------------- + +/^<:/ { + SYM= ""; + PUB= ""; +} + +/^<SYM>/ { + if (SYM != "") print SYM; + SYM= $0; +} + +/^<PUB>/ { + if (PUB != "") print PUB; + PUB= $0; +} diff --git a/app/ned/msdos/possig.bat b/app/ned/msdos/possig.bat new file mode 100644 index 0000000000000000000000000000000000000000..6f8c3718201310c94f0b4d0eb235d772bfd35627 --- /dev/null +++ b/app/ned/msdos/possig.bat @@ -0,0 +1,28 @@ +goto %1 + +:ALL +find *.c *.h *.fm n*.sgm >@file.lst + +:S +perl \usr\ned\possig.pl -f @file.lst +:: awk possig *.c *.h 00/*.c 01/*.c 02/*.c 03/*.c 04/*.c 05/*.c 06/*.c 07/*.c 08/*.c 09/*.c 10/*.c 11/*.c 12/*.c unix/*.? +:: copy @$.ftr _bak_ftr.ned +goto END + +:HDR +find *.c *.h >@file.lst +find -p\c5\include >>@file.lst +goto S + +:Q +find *.h *.fm n*.sgm >@file.lst +goto S + +:QQ +find *.h >@file.lst +goto S + +:UNLINK +rem perl possig.pl -unlink -f @file.lst + +:END diff --git a/app/ned/n00_cur b/app/ned/n00_cur new file mode 100755 index 0000000000000000000000000000000000000000..51a96e060c870359921ea63bb17621a8f4c55756 Binary files /dev/null and b/app/ned/n00_cur differ diff --git a/app/ned/n00_tk b/app/ned/n00_tk new file mode 100755 index 0000000000000000000000000000000000000000..bfae257e0eb1300cf83436c30402bfd6eef81d94 Binary files /dev/null and b/app/ned/n00_tk differ diff --git a/app/ned/ned.stp b/app/ned/ned.stp new file mode 100644 index 0000000000000000000000000000000000000000..63e9f61e366a266b3306a52ecdee7b9fb9b57978 --- /dev/null +++ b/app/ned/ned.stp @@ -0,0 +1,12 @@ +@macro +1 ^qaned_message (3, ^mned_message_3 (^mgn^m^ag +2 :1^m^qflatest update:^m^mf1R^k$\e +@feature +3 hyx.l pgm="cdcmd -e" tdc="hyx.l" tdp=5 marker="e" +@tag +4 NED +@end +@button +0 -1 111 1 1 1 ^n +@end + diff --git a/app/ned/ned00.c b/app/ned/ned00.c new file mode 100644 index 0000000000000000000000000000000000000000..0e393c55337af546598066456535279c1d2471f2 --- /dev/null +++ b/app/ned/ned00.c @@ -0,0 +1,733 @@ +/* + * $Id: ned00.c,v 1.20 2003/04/28 02:09:28 gonter Exp $ + * FILE %ned/ned00.c + * + * ned ... 'new editor'; a Full Screen Editor + * ned - main file + * + * hot spots in this file: + * - version number + * - HELP + * - main + * + * written: 1987 03 20: Uebernahme von med.c + * 1987 04 08: Modularisierung: ned.c: ned0.c - ned6.c + * 1990 01 20: weitere Modularisierung; Streamlining + * 1991 05 25: Revision; Streamlining + * 1994-10-16: viewer only configuration + * latest update: 2002-06-08 12:36:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <signal.h> +#include <string.h> +#include <stdlib.h> +#include "ed.h" +#include "message.h" +#include <gg/window.h> +#include <gg/filename.h> +#include <gg/keys.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/hyx.h> +#include <contrib/md5gg.h> +#ifdef MSDOS +#include <dos.h> +#include <conio.h> +#include <gg/dirty.h> +#define PATH_LENGTH 128 +#else +#define PATH_LENGTH 1024 +#endif +#ifdef USE_MOUSE +#include <gg/maus.h> +#endif +#include "edctx.h" +#include "proto.h" + +#ifdef MSDOS +#define MAKE_WINDOW_FRAMES +#endif + +#define ETC(x) set_etc_filename ((char *) 0, (x)) +/* NOTE: the returned string is malloc()'ed */ + +/* ------------------------------------------------------------------------ */ +extern int W_TEXT_MAX_X; +extern int W_TEXT_MAX_Y; +extern int global_file_format; +extern int akt_buttons; +extern int akt_page; +extern int word_wrap_count; +extern int default_edit_mode; +extern int default_tag_display_mode; +extern int default_bin_eoln; +extern int default_bin_llng; +extern int default_cross_ref_fmt; +extern int default_cross_ref_local; +extern int ned_werr_dont_complain; +extern char *default_cross_ref_prefix; +extern int default_cross_ref_to_lower; +extern char *default_start_frame; +extern char *default_template_frame; +extern char *default_undef_frame; +extern char stp_fnm []; +extern struct WINDOWCTRL *aw, *windows; +extern struct FILECTRL *files; +extern int oper_level; +extern int NED_TEXT_MAX_X, NED_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +void setup_screen (void); + +/* ------------------------------------------------------------------------ */ +#ifdef USE_TCL +#ifdef USE_TK +static char *tcl_rc_names []= +{ + "~/.ned/tk.rc", + "/usr/local/lib/ned/tk.rc", + (char *) 0 +} ; +#else +static char *tcl_rc_names []= +{ + "~/.ned/tcl.rc", + "/usr/local/lib/ned/tcl.rc", + (char *) 0 +} ; +#endif /* !USE_TK */ +static char *tcl_glib= "/usr/local/lib/ned"; +#endif /* USE_TCL */ + +extern struct NED_CONTEXT *ned_main_context; + +/* ------------------------------------------------------------------------ */ +#define STDHLP stdout +static char *HELP [] = +{ + "USAGE: ned ([-opt]* [<filename>]*)*\n", + "hypertext: ned -hy <cluster>\n", + "options:\n", + " +<n> ... line number in following file, overrides ftr info\n", + " :<str> ... activate tag\n", + " -- all remaining arguments are filenames\n", + " -h .. hypertext mode\n", + " -y .. SGML mode\n", + " -x<fr> .. define start frame (hypertext)\n", + " -m<fr> .. define start frame (hypertext) with MD5 transformation\n", + " -$[<crf>] .. cross reference activation (hypertext)\n", + " -s[<fnm>] .. define setup file [DEF: none; ned.stp]\n", + " -t .. text mode [DEF]\n", + " -b .. binary mode\n", + " -bl[<LLNG>] .. line length; [DEF: 70]\n", + " -bc[<EOLN>] .. EOLN-char; [DEF: none]\n", + " -D\"<num> <str>\" .. define key sequence macro\n", +#ifdef USE_TCL + " -e<str> .. evaluate Tcl string\n", + " -z<fnm> .. run Tcl File\n", + " -T\"<num> <str>\" .. define Tcl macro\n", +#ifdef USE_TK + " -S<fnm> .. read TCL setup file [DEF: ~/.ned/tk.rc]\n", +#else + " -S<fnm> .. read TCL setup file [DEF: ~/.ned/tcl.rc]\n", +#endif /* !USE_TK */ +#endif /* USE_TCL */ + " -C<clnm> ... add cross reference cluster name\n", + " -F<fnm> ... add feature table name\n", + " -:<fnm> ... add tags table name\n", + " -I<clnm> ... add library cluster name\n", + " -J<clnm> ... add thesaurus cluster name\n", + " -L<clnm> ... add lexicon cluster name\n", + " -1 ... context items following are added to the top of the list\n", + " -E .. edit mode [DEF]\n", + " -R .. read only mode\n", + " -v .. start in vi mode\n", + " -w<cnt> .. word wrap count [DEF: 32760]\n", + "\n", + "experimental features:\n", + " -Q ... show full tags\n", + " -c ... cross ref frames are processed as ASCII\n", + " -l ... create new cross ref frames locally\n", + " -V ... VKB mode, implies -Qclhy\n", /* ??? virtual knowledge base ??? */ + " -Z ... don\'t complain about unwritable files\n", + "\n", + "exotic features:\n", + " -p+ .. enable feature file [DEF]\n", + " -p- .. disable feature file\n", + " -f<fnm> .. name of feature file [DEF: extension .ftr]\n", + " -j .. generate journal file [DEF: don't make the journal]\n", + " -r .. recover using journal file\n", + " -o<level> .. define operation level [DEF: 0]\n", +#ifdef MSDOS + " -40 .. 40 char mode ) \n", + " -80 .. 80 char mode ) [DEF: 80 or actual text mode]\n", +#endif /* MSDOS */ + "\n", + "(@)Aned 3.21.05 #D$2002-10-16 7:07:24\n", + "\n", +#define REAL_AUTHOR +#include <gg/public.inc> +} ; +char NED_VERSION []= "3.21.05"; + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + int argf= 0; /* 1 .. ? Files laut Argumentliste geladen */ + int file_fmt= FMT_ASCII; /* Festlegung von file_format */ + int file_ty= FTY_PLAIN; /* Normales File */ + int openf_flags= NED_OPENF_NO_REL_PATH; + int filectrl_mode= 1; /* 1 -> Default Feature File */ + /* 2 -> selected Feature File */ + int ffnum= 0; /* Adr. des Feature File Namens */ + int jmp_line= -1; /* directly jump to line number */ + char *jmp_pattern= (char *) 0;/* pattern to search directly for */ +#ifdef __TRASH__ + struct WINDOWCTRL **wptr= &windows; +#endif /* __TRASH__ */ + int crf_flg= 0; /* 1 -> cross reference mode */ + char *tmp_ptr; /* used for screen dimensions etc */ + char *start_frame= default_start_frame; + char *arg; + int start_frame_search_mode= 0x0003; + int do_load_start_frame= 1; + int is_filename= 0; + int ctx_at_top= 0; + int special= 0; + +#ifndef USE_TK + signal (SIGINT, SIG_IGN); +#endif + + ned_0011 (); + if ((ned_main_context= ned_create_context ()) + == (struct NED_CONTEXT *) 0 + || ned_default_context (ned_main_context) != 0 + ) + { + fprintf (stderr, "can't create ned context!!\n"); + return 0; + } + ned_init_sym_bookmarks (); + + default_edit_mode= 0x00; /* Festlegung von edit_mode */ + + /* BEGIN initialize operational modes according to the program name ..... */ + arg= argv [0]; + if (strstr (arg, "hyxview") != (char *) 0 + || strstr (arg, "HYXVIEW") != (char *) 0 + ) + { + file_ty= FTY_HYPER; + file_fmt= FMT_SGML; + openf_flags &= NED_OPENF_RST_FORMAT; + openf_flags |= NED_OPENF_SGML | NED_OPENF_READ_ONLY; + default_edit_mode |= /* EDIT_NOTOGGLE | */ EDIT_READ_ONLY; + } + else + if (strstr (arg, "VIEW") != (char *) 0 + || strstr (arg, "view") != (char *) 0 + ) + { + default_edit_mode |= EDIT_READ_ONLY; + openf_flags |= NED_OPENF_READ_ONLY; + vi_on (); + } + else + if (strstr (arg, "VI") != (char *) 0 + || strstr (arg, "vi") != (char *) 0 + ) + { + vi_on (); + vi_mode (); + } + else + if (strstr (arg, "PIN00") != (char *) 0 + || strstr (arg, "pin00") != (char *) 0 + || strstr (arg, "pico") != (char *) 0 + ) pico_mode (); + /* END initialize operational modes according to the program name ....... */ + + /* BEGIN interface initialization ....................................... */ +#ifndef W_MODEL_TK + w_init (0x0000); + w_selpage (akt_page); + w_cursoron (); +#endif /* !W_MODEL_TK */ + +#ifdef MSDOS + set_cp (&tmp_ptr, 0, 0x40); + W_TEXT_MAX_X= *((int *) (tmp_ptr+0x4A)); + W_TEXT_MAX_Y= (tmp_ptr [0x84] & 0x00FF)+1; + /* Diese System Variable ist nur ab EGA aufwaerts definiert! */ + /* daher werden unplausible Werte auf den Standard-Wert modifiziert. */ + if (W_TEXT_MAX_Y < 20 || W_TEXT_MAX_Y > 61) W_TEXT_MAX_Y= 25; + if (kbtype ()) { kbin_set_AT (); kbhit_set_AT (); } +#endif + + setup_screen (); + save_message_line (); + +#ifdef USE_MOUSE + look1_for_maus (); +#endif + /* END interface initialization ......................................... */ + +#ifndef MSDOS + ned_init_virtual_filename_table (); + + /*** HUH? What's that?? */ + tmp_ptr= translate_logic_filename ("~/.ned/bookmarks/bmk"); + ned_load_bookmarks (tmp_ptr, "_default"); + free (tmp_ptr); +#endif /* !MSDOS */ + + mac_clr (); /* Alle Makros loeschen */ + setup_sgml_tag_descriptors (ETC ("sgmltags.def")); + ned_read_setup (ETC ("nedglobl.stp")); +#ifdef USE_TCL + ned_tcl_startup (tcl_rc_names, tcl_glib); +#endif /* USE_TCL */ + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + for (i= 1; i < argc; i++) /* evaluate command line arguments */ + { + arg= argv [i]; + + if (is_filename) goto IS_FILENAME; + + if (arg [0] == '-') /* command line options */ + switch (arg [1]) + { + case 'R': /* Read Only Mode */ + case 'E': /* Edit Mode */ + case 't': /* Format Text */ + case 'y': case 'Y': /* Format SGML */ + case 'h': case 'H': /* Hypertext */ + case 'j': /* Jour File anlegen */ + case 'r': /* Jour File lesen: RECOVER */ + case 'Q': /* tag display full */ + case 'c': /* cross ref frames not in SGML */ + case 'l': /* cross ref frames are local */ + case 'v': /* VI mode */ + case 'V': /* VKB mode */ + case 'Z': /* dont complain about non-write */ + case '1': /* add items to context at top */ + + for (j= 1; arg [j]; j++) + switch (arg [j]) + { + case 'R': /* Read Only Mode without toggle */ + default_edit_mode |= EDIT_READ_ONLY; + openf_flags |= NED_OPENF_READ_ONLY; + break; + case 'E': /* Edit Mode */ + default_edit_mode= 0x00; + openf_flags &= ~NED_OPENF_READ_ONLY; + break; + case 't': /* file type is ASCII */ + file_fmt= FMT_ASCII; + openf_flags &= NED_OPENF_RST_FORMAT; + break; + case 'h': case 'H': /* file type is Hypertext */ + file_ty= FTY_HYPER; + break; + case 'y': case 'Y': /* file format is SGML */ + file_fmt= FMT_SGML; + openf_flags &= NED_OPENF_RST_FORMAT; + openf_flags |= NED_OPENF_SGML; + break; + case 'v': /* start in VI mode */ + vi_on (); + break; + case 'X': /* ignore, if in -hyx option */ + start_frame_search_mode ^= 0x0002; + case 'x': + j++; + goto FRAME_NAME; + case 'j': case 'J': /* Journal File anlegen */ + p_open_jou_wr (); + break; + case 'r': /* Journal File lesen: RECOVER */ + p_open_jou_rd (); + break; + case 'Q': + default_tag_display_mode= WCTDM_show_full_tag; + break; + case 'Z': + ned_werr_dont_complain= 1; + break; + case 'c': + default_cross_ref_fmt= FMT_ASCII; + break; + case 'l': + default_cross_ref_local= 1; + break; + case '1': + ctx_at_top= 1; + break; + case 'V': /* VKB mode */ + file_ty= FTY_HYPER; + file_fmt= FMT_SGML; + openf_flags &= NED_OPENF_RST_FORMAT; + openf_flags |= NED_OPENF_SGML; + default_tag_display_mode= WCTDM_show_full_tag; + default_cross_ref_fmt= FMT_ASCII; + default_cross_ref_local= 1; + default_cross_ref_prefix= (char *) 0; + /** default_cross_ref_to_lower= 0; **/ + break; + default: goto HLP; + } + break; + + case '-': /* all parameters after -- are file names */ + is_filename= 1; + break; + + case 'p': case 'P': /* Pure Mode: Feature File ignored */ + filectrl_mode= (arg [2] == '+') ? 1 : 0; + break; + + case 'f': /* Feature File festlegen */ + if (arg [2] == 0) break; + ffnum= i; + filectrl_mode= 2; + break; + +#define ACTX(n) ned_add_context (ned_main_context, (n), arg+2, ctx_at_top) + case 'C': + ACTX (NED_CTXitem_crf); + break; + case 'F': + ACTX (NED_CTXitem_feature_table); + break; + case ':': + ACTX (NED_CTXitem_tag_file); + break; + case 'I': + ACTX (NED_CTXitem_lib); + break; + case 'J': + ACTX (NED_CTXitem_thesaurus); + break; + case 'L': + ACTX (NED_CTXitem_lexicon); + break; +#undef ACTX + + case 'D': + mac_parse (arg+2, MPt_key_sequence); + break; + +#ifdef USE_TCL + case 'T': + mac_parse (arg+2, MPt_tcl); + break; + + case 'e': + mac_call_tcl (arg+2); + break; + + case 'z': + if (arg[2]) + { + printf ("z: arg='%s'\n", arg+2); + ned_tcl_run_file (arg+2); + } + else special= 1; + break; +#endif /* USE_TCL */ + +#ifdef MSDOS + case '4': + w_init_mode (0x01, 0x0001); + break; + case '8': + w_init_mode (0x03, 0x0001); + break; +#endif + + case 'o': case 'O': /* Operation Level definieren */ + if (arg [2] == 0) break; + oper_level= (int) get_parameter_value (arg+2); + break; + + case 'w': case 'W': /* word wrap */ + if (arg [2] == 0) break; + word_wrap_count= (int) get_parameter_value (arg+2); + break; + + case 's': case 'S': /* Setupfile einlesen */ + if (arg [2] != 0) strcpy (stp_fnm, arg+2); + p_rdsetup (); + break; + + case 'M': /* define hypertext startframe as MD5 name */ + start_frame_search_mode ^= 0x0002; + + case 'm': + j= 2; + if (arg [j] == 0) break; + start_frame= MD5check_string ((unsigned char *) arg+j); + break; + + case 'X': + start_frame_search_mode ^= 0x0002; + + case 'x': /* define hypertext startframe */ + j= 2; +FRAME_NAME: + if (arg [j] == 0) break; + start_frame= arg+j; + break; + + case '$': + crf_flg= NED_CTXitem_crf; + file_fmt= FMT_SGML; + file_ty= FTY_HYPER; + openf_flags &= NED_OPENF_RST_FORMAT; + openf_flags |= NED_OPENF_SGML; + ned_cross_ref (arg+1, 0, CRF_IN_CRF, CRF_GLOBAL_AND_LOCAL, 1); + break; + + case 'b': case 'B': + switch (arg [2]) + { + case 'c': case 'C': /* Binaer: EOLN-Character */ + default_bin_eoln= (int) get_parameter_value (arg+3); + break; + case 'l': case 'L': /* Binaer: Zeilenlaenge */ + default_bin_llng= (int) get_parameter_value (arg+3); + if (default_bin_llng <= 0) default_bin_llng= LINE_LNG_BIN; + break; + default: + default_bin_eoln= 0; + default_bin_llng= LINE_LNG_BIN; + break; + } + file_fmt= FMT_BINARY; + openf_flags &= NED_OPENF_RST_FORMAT; + openf_flags |= NED_OPENF_BINARY; + break; + /* ANM: zur Verwendungsmoeglichkeit von -b und -t */ + /* siehe NEDNED.DOC unter 'ROTTEN' Tricks */ + +HLP: +#include <gg/help.inc> + } + else + if (arg [0] == '+') + { + switch (arg [1]) + { + case 0: + case '$': + jmp_line= 32700; + break; + case '/': + case '?': + jmp_pattern= arg+1; + break; + default: + jmp_line= (int) get_parameter_value (arg+1); + break; + } + } + else + if (arg [0] == ':') + { + do_load_start_frame= 0; + ex_tag_command (arg+1); + } + else + { /* FILE NAME */ +IS_FILENAME: + switch (special) + { + case 1: + ned_tcl_run_file (arg); + argf++; + break; + default: + if (file_ty == FTY_HYPER) + { /* Hypertext Files */ + ned_activate_cluster (arg); + } + else + { /* normale Files */ /* 06/ned0610e.c */ + + if (ned_open_file_2 ((struct WINDOWCTRL *) 0, arg, openf_flags) == 0) + { + argf++; + + ned_jmp_complex (aw, jmp_line, jmp_pattern); + + jmp_pattern= (char *) 0; + jmp_line= -1; + } +#ifdef __TRASH__ + struct FILECTRL *fptr; + struct WINDOWCTRL *w_new; + char *r_fnm; + char *v_fnm; + + if (find_file (arg, (char *) 0, &r_fnm, &v_fnm)== -1) + { + argf++; + if ((w_new= ned_create_window_pair ()) == (struct WINDOWCTRL *) 0) + { + ned_error_message (ERR_OPEN_WDW); + continue; + } + +#ifdef USE_TK + ned_tk_associate_window (w_new); +#endif /* USE_TK */ + + *wptr= w_new; + w_new->prev= aw; + aw= *wptr; + wptr= &aw->next; + + if ((fptr= file_alloc ()) == (struct FILECTRL *) 0) + { + ned_error_message (ERR_OPEN_FILE); + continue; + } + + /* GET_FILENAME */ + fptr->FC_links= 1; + aw->WC_title_short= FC_setup_filenames (fptr, r_fnm, + (filectrl_mode == 2) ? &argv [ffnum][2] : (char *) 0); +#ifdef USE_TK + ned_tk_set_window_name (aw, aw->WC_title_short); +#endif /* USE_TK */ + + switch (filectrl_mode) + { + case 1: + break; + case 2: + filectrl_mode= 0; + break; + default: + fptr->FC_fnm_ftr [0]= 0; /* not so neat ... */ + break; + } + + if (files != (struct FILECTRL *) 0) + { + files->FC_prev= fptr; + fptr->FC_next= files; + } + + aw->file_or_frame= files= fptr; + aw->file_type= FTY_PLAIN; + aw->WC_edit_mode= default_edit_mode;/* ggf. Read Only Flag */ + aw->file_format= file_fmt; /* Binary/ASCII/SGML... */ + aw->bin_eoln= eoln; /* End-Of-Line Code */ + aw->bin_llng= bin_x_llng; /* Laenge von binaeren Zeilen */ + + s_fget (aw); + winstack_push (aw); + + ned_jmp_complex (aw, jmp_line, jmp_pattern); + + jmp_pattern= (char *) 0; + jmp_line= -1; + + take_history_notes (aw); + } +#endif /* __TRASH__ */ + } + } + special= 0; + } /* FILE NAME */ + } /* Ende der Parameterauswertung */ + + global_file_format= file_fmt; +#ifdef MSDOS + memorize_window_mode (); +#endif /* MSDOS */ + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + if (argf) + { +#ifndef USE_TK + if (argf == 2) q_wdwsize ('-'); +#endif /* !USE_TK */ + } + else + { + if ((!crf_flg || windows == (struct WINDOWCTRL *) 0) + && do_load_start_frame + ) + { + struct CLUSTERCTRL *cl_list; + int is_default= 0; + + if ((cl_list= ned_get_cluster_list ()) == (struct CLUSTERCTRL *) 0) + { + char *cl_name= (char *) 0; + + if (crf_flg) + cl_name= ned_get_context (ned_main_context, crf_flg); + if (cl_name == (char *) 0) + { + cl_name= "%cl0"; + is_default= 1; + } + + cl_list= ned_activate_cluster (cl_name); + file_fmt= FMT_SGML; + } + + ned_activate_frame (cl_list, start_frame, + (struct WINDOWCTRL *) 0, + start_frame_search_mode, file_fmt, + default_template_frame, + default_undef_frame); + +#ifdef USE_TK + if (is_default) ned_tk_start_mode (aw); +#endif /* USE_TK */ + } + } + + if ((aw= windows) == (struct WINDOWCTRL *) 0) + { + if (do_load_start_frame == 0) return 0; + goto HLP; + } + +#ifdef USE_MOUSE + look2_for_maus (); +#endif + + if (akt_page != aw->page) w_selpage (akt_page= aw->page); + wda_setup (); + show_buttons (aw); + +#ifdef EXPER + NEDa1_interpreter (); +#else + NED_interpreter (); +#endif + return 0; +} + +/* ------------------------------------------------------------------------ */ +void setup_screen (void) +{ + NED_TEXT_MAX_X= W_TEXT_MAX_X; + NED_TEXT_MAX_Y= W_TEXT_MAX_Y; /* ####### test: buttons ###### */ +} diff --git a/app/ned/nedsrc01.tex b/app/ned/nedsrc01.tex new file mode 100644 index 0000000000000000000000000000000000000000..06766ea2e960bd7481336f1b47ada5a4a92adbcd --- /dev/null +++ b/app/ned/nedsrc01.tex @@ -0,0 +1,31 @@ +% function labels +strdup \> char *\> \pageref{strdup}\\ +strdup \> char *\> \pageref{strdup}\\ +main \> int \> \pageref{main}\\ +maus\_setup \> void \> \pageref{maus_setup}\\ +(*nextchar) \> int \> \pageref{(*nextchar)}\\ +(*nxtchs) \> int \> \pageref{(*nxtchs)}\\ +buttons= \> struct BUTTON\_DESCRIPTOR *\> \pageref{buttons=}\\ +wdw\_rst \> void \> \pageref{wdw_rst}\\ +p\_cup \> int \> \pageref{p_cup}\\ +p\_cdown \> int \> \pageref{p_cdown}\\ +chk\_updown \> void \> \pageref{chk_updown}\\ +p\_cleft \> void \> \pageref{p_cleft}\\ +p\_cright \> void \> \pageref{p_cright}\\ +p\_word\_left \> void \> \pageref{p_word_left}\\ +q\_word\_lr \> void \> \pageref{q_word_lr}\\ +p\_pgup \> void \> \pageref{p_pgup}\\ +p\_pgdn \> void \> \pageref{p_pgdn}\\ +p\_ctrlq \> void \> \pageref{p_ctrlq}\\ +p\_ctrlk \> void \> \pageref{p_ctrlk}\\ +p\_ctrlo \> void \> \pageref{p_ctrlo}\\ +p\_ctrlp \> void \> \pageref{p_ctrlp}\\ +p\_funct \> void \> \pageref{p_funct}\\ +p\_nl2 \> void \> \pageref{p_nl2}\\ +p\_nl \> void \> \pageref{p_nl}\\ + +p\_pgdn \> void \> \pageref{p_pgdn}\\ +p\_ctrlq \> void \> \pageref{p_ctrlq}\\ +p\_ctrlk \> void \> \pageref{p_ctrlk}\\ +p\_ctrlo \> void \> \pageref{p_ctrlo}\\ +p\_ctrlp \> void \> \pageref{p_ctrlp}\\ \ No newline at end of file diff --git a/app/ned/notes001.sgm b/app/ned/notes001.sgm new file mode 100644 index 0000000000000000000000000000000000000000..4073ef67f9f1b1f1bac2af91118a5c9f652c39d3 --- /dev/null +++ b/app/ned/notes001.sgm @@ -0,0 +1,30 @@ +FILE %ned/notes001.sgm + +latest update: 1997-08-15 10:38:12 +------------------------------------------------------------------------------ + +Festlegen eines zu aktivierenden Files, Beruecksichtigung des relativen +Pfades + +Genereller Vorgang: +1. tatsaechlichen Filenamen ermitteln unter Beruecksichtigung des + relativen Pfades in Bezug auf das gegenwaertig aktivierte Window +2. Window mit File in Window List suchen und ggf. anspringen oder laden + +In Modul 0610 <hyx.l file="%ned/06/ned0610.c" mark="q_ofile" tdc=hyx.l tdp=7>q_ofile() wird zuerst das File in der Window List gesucht +und dann ein der Filename mit <hyx.l file="%sbr/logicfnm.c" mark="translate_logic_filename" tdc="hyx.l" tdp=24>translate_logic_filename() bestimmt. + +In Modul 0836 <hyx.l file="%ned/08/ned0836.c" mark="eval_hlink" tdc=hyx.l tdp=10>eval_hlink() wird zuerst das File gesucht und anschliessend +der aktuelle Filename mit <hyx.l file="%ned/06/ned0615.c" mark="q_fnm" tdc=hyx.l tdp=5>q_fnm() ermittelt. q_fnm() verwendet +<hyx.l file="%ned/06/ned0630.c" mark="FC_setup_filenames" tdc=hyx.l tdp=18>FC_setup_filenames() was seinerseits <hyx.l file="%sbr/logicfnm.c" mark="translate_logic_filename" tdc=hyx.l tdp=24>translate_logic_filename() +aufruft. + +<hyx.l file="%ned/08/ned0841.c" mark="eval_feature" tdc=hyx.l tdp=12>eval_feature() entscheidet zwischen q_ofile und eval_hlink. + + Weiters findet ein aehnlicher Vorgang in <hyx.l file="%ned/ned00.c" tdc="hyx.l" tdp=7 mark="GET_FILENAME">ned00.c statt. + +activate_cluster, activate_frame +ned_activate_cluster, ned_activate_frame +ned_ro_activate_cluster, ned_ro_activate_frame +ned_rw_activate_cluster, ned_rw_activate_frame + diff --git a/app/ned/notes002.sgm b/app/ned/notes002.sgm new file mode 100644 index 0000000000000000000000000000000000000000..478117d846702bca230db29248f83b180780d17c --- /dev/null +++ b/app/ned/notes002.sgm @@ -0,0 +1,7 @@ + +see possig.pl + +feature editing +struct <hyx.l file="%ned/ed.h" mark="LINE" tdc="pgm.struct" tdp=4>LINE: flag for protected lines; -> no editing of that line, +this flag needs to be set during linking of features + diff --git a/app/ned/notes003.sgm b/app/ned/notes003.sgm new file mode 100644 index 0000000000000000000000000000000000000000..8175c3858f50f374087435f4071ea04fc6eb0c28 --- /dev/null +++ b/app/ned/notes003.sgm @@ -0,0 +1,118 @@ + +written: 1997-04-14 +latest update: 1997-07-27 10:16:35 + +-> <hyx.l tdc="hyx.l" tdp="8" mark="INTERNAL">INTERNAL, <hyx.l tdc="hyx.l" tdp="5" mark="C-API">C-API, <hyx.l tdc="hyx.l" tdp="4" mark="BUGS">BUGS + +"<hyx.l file="%ned/proto.h" tdc="pgm.incl" tdp=7>proto.h" +This file describes the line callback system as it evolves. + + +** <hyx.l tdc="mark" tdp="8" name="INTERNAL">INTERNAL ** +line callbacks INTERNAL + struct <hyx.l file="%ned/ed.h" mark="LINE_CALLBACK" tdc="pgm.struct" tdp=13>LINE_CALLBACK *lcb; +#define LCB_edit 0x0001 /* insert/delete in line at column */ +#define LCB_delete 0x0002 /* line was deleted */ +#define LCB_line_split 0x0004 /* line was splitted at column */ +#define LCB_line_join 0x0008 /* line was joined at column */ +#define LCB_chg_wdw 0x0010 /* window was changed */ + +trigger functions: + int <hyx.l file="%ned/03/ned0341a.c" tdc="hyx.l" tdp=23 mark="ned_line_trigger_change">ned_line_trigger_change (...) + int <hyx.l file="%ned/03/ned0341b.c" tdc="hyx.l" tdp=27 mark="ned_line_trigger_split_join">ned_line_trigger_split_join (...) + int <hyx.l file="%ned/03/ned0341c.c" tdc="hyx.l" tdp=23 mark="ned_line_trigger_delete">ned_line_trigger_delete (struct <hyx.l file="%ned/ed.h" mark="LINE" tdc="pgm.struct" tdp=4>LINE *lp, int destroy); + +** <hyx.l tdc="mark" tdp="5" name="C-API">C-API ** +registration functions + <hyx.l file="%ned/03/ned0342a.c" tdc="hyx.l" tdp=15 mark="ned_line_reg_cb">ned_line_reg_cb (b->ptr= aw->WC_act, <hyx.l file="%ned/02/ned0260.c" tdc="hyx.l" tdp=19 mark="ned_marker_callback">ned_marker_callback, LCB_edit, b); + <hyx.l file="%ned/03/ned0342b.c" tdc="hyx.l" tdp=15 mark="ned_line_rel_cb">ned_line_rel_cb (b->ptr= aw->WC_act, <hyx.l file="%ned/02/ned0260.c" tdc="hyx.l" tdp=19 mark="ned_marker_callback">ned_marker_callback, LCB_edit, b); + + convenience functions to register and release callbacks for + markers on lines + ned_marker_reg_cb(line, marker) + ned_marker_rel_cb(line, marker) + +obsolete: + ned_shift_markers () + ned_change_markers () + +used in + <hyx.l file="%ned/07/ned0701.c" tdc="hyx.l" tdp="15" mark="ned_set_marker2" "ned_set_marker2">ned_set_marker2 () [via ned_get_marker] + <hyx.l file="%ned/05/ned0515.c" mark="ned_split" tdc="pgm.func" tdp=9>ned_split () T2D: splitting with a block, block flags update + <hyx.l file="%ned/05/ned0516.c" mark="ned_join" tdc="pgm.func" tdp=8>ned_join () + <hyx.l file="%ned/01/ned0138.c" mark="ned_lines_free" tdc="pgm.func" tdp=14>ned_lines_free () + +** <hyx.l tdc="mark" tdp="8" name="EXAMPLES">EXAMPLES ** +callback functions: + void <hyx.l file="%ned/02/ned0260.c" tdc="hyx.l" tdp=19 mark="ned_marker_callback">ned_marker_callback () + +** <hyx.l tdc="mark" tdp="12" name="DESIGN NOTES">DESIGN NOTES ** +Event types +V1: register separate functions for each event type +V2: event handler has to identify the event type + +current solution: trigger selects correct function on event mask +but the event handler implements all functions and selects +event anyway. + +V2: Split and Join ++ b_first, b_last line makrers ++ set_block_bflags () +=> callback wird fuer b_first, b_last registriert + +b_first, b_last ) registrieren +b_beg, b_end ) + +wo b_beg, b_end gesetzt wird reg_cb und rel_cb einbauen + +** <hyx.l tdc="mark" tdp="4" name="BUGS">BUGS ** +<hyx.l file="%ned/02/ned0260c.c" mark="ned_set_marker" tdc="pgm.func" tdp=14>ned_set_marker () + -> <hyx.l file="%ned/07/ned0701.c" mark="ned_set_marker2" tdc="pgm.func" tdp=15>ned_set_marker2 () + -> <hyx.l file="%ned/03/ned0342b.c" mark="ned_line_rel_cb" tdc="pgm.func" tdp=15>ned_line_rel_cb => crash + +** <hyx.l tdc="mark" tdp="8" name="PROBLEMS">PROBLEMS ** +In the call back function of a Split and Join it is quite possible +that the pointer changes and thus a registered callback must +be unregistered before the change takes place and registered +again afterwards! + +Markers b_beg, b_end, b_first, b_last are handled slightly differently + +Transfering a group of lines into a buffer (e.g. line store). +the pointer to the window is then invalid!!!! + +<hyx.l file="%ned/07/ned0724a.c" mark="ned_blk_isolate2" tdc="pgm.func" tdp=16>ned_blk_isolate2 (): results in a loop during the split/join operation +for block moves in standard mode + +solution attempt 1: 1997-06-23 20:44:32 + unregister both markers and re-register after isolation + <hyx.l file="%ned/07/ned0728.c" mark="ned_blk_move" tdc="pgm.func" tdp=12>ned_blk_move + +** <hyx.l tdc="mark" tdp="13" name="TCL Interface">TCL Interface ** ++ registration function + => create callback structure + - interp + - Tcl function name + - client_data + reg_line_callback line_callback CD + proc line_callback {event LINE_ID CD op1 op2} {...} + ++ unreg. function + => destroy callback structure + + +** <hyx.l tdc="mark" tdp="10" name="MORE NOTES">MORE NOTES ** +ned_reset_markers wird vermutlich nicht mehr benoetigt, das +ueber ned_lines_free ebenfalls die Marker aufgehoben werden. + +proto.h 308: int <hyx.l file="proto.h" ln=308 cn=16 tdc=79 tdp=17>ned_reset_markers (struct WINDOWCTRL *w); +02/ned0260.c 221: int <hyx.l file="02/ned0260.c" ln=221 cn=4 tdc=79 tdp=17>ned_reset_markers (struct WINDOWCTRL *w) +02/ned0211b.c 30: <hyx.l file="02/ned0211b.c" ln=30 cn=2 tdc=79 tdp=17>ned_reset_markers (wc); /* reset markers which are in the current window */ +03/ned0333.c 36: <hyx.l file="03/ned0333.c" ln=36 cn=2 tdc=79 tdp=17>ned_reset_markers (wc); +04/ned0412.c 30: <hyx.l file="04/ned0412.c" ln=30 cn=2 tdc=79 tdp=17>ned_reset_markers (wc); + +proto.h 238: /* 0211b */ int <hyx.l file="proto.h" ln=238 cn=16 tdc=79 tdp=18>ned_w_close_window (register struct WINDOWCTRL *wc); +02/ned0211b.c 24: int <hyx.l file="02/ned0211b.c" ln=24 cn=4 tdc=79 tdp=18>ned_w_close_window (register struct WINDOWCTRL *wc) +02/ned0211.c 33: if (oper_level >= LEV_LINK || <hyx.l file="02/ned0211.c" ln=33 cn=32 tdc=79 tdp=18>ned_w_close_window (aw)) return; +08/ned0845.c 106: if (wc != (struct WINDOWCTRL *) 0) <hyx.l file="08/ned0845.c" ln=106 cn=41 tdc=79 tdp=18>ned_w_close_window (wc); + diff --git a/app/ned/notes004.sgm b/app/ned/notes004.sgm new file mode 100644 index 0000000000000000000000000000000000000000..2a3541f8e752cead2772c3b82053c78b2abb8650 --- /dev/null +++ b/app/ned/notes004.sgm @@ -0,0 +1,14 @@ + + +new stuff + + +^K^ 1997-04-13 21:46:24 +1. move block behind marker ^ +2. and set marker ^ at last line of moved block + +USAGE: +transfer a line to a different window +e.g. Mail folder sorting + + diff --git a/app/ned/notes005.sgm b/app/ned/notes005.sgm new file mode 100644 index 0000000000000000000000000000000000000000..232771bfcd5d7d1f8df4cb4233767fe1708eebcb --- /dev/null +++ b/app/ned/notes005.sgm @@ -0,0 +1,30 @@ + +Calendar Tools +1996-08-05 09:30:00 +cal -s ... create only specified frames + +cal -sYYYY ... only year overview +cal -sYYYY-MM ... only month overview +cal -sYYYY-MM-DD ... only day overview + + +1996-08-05 09:35:00 +fr="$$calendar YYYY" -> calendar overview, alle Links in tdc=text + +Tools: +[1] calendar overview erzeugen, wenn diese ev. noch nicht existiert +[2] dynamic template um kalender Eintrag fuer Monat/Tag zu erzeugen +[3] aendern der tdc=auf hyx.l, wenn ein Frame dazu existiert + + +HYX Tools +1996-09-11 08:52:00 + +Cluster Diff (Cluster A + B): +[1] Liste alle gleichnamigen Frames mit gleichem Inhalt +[2] Liste von allen gleichnamigen Frames mit unterschiedlichem Inhalt +[3] Liste von Frame, die in Cluster A, aber nicht in B vorkommen +[4] Liste von Frame, die in Cluster B, aber nicht in A vorkommen + + + diff --git a/app/ned/notes006.sgm b/app/ned/notes006.sgm new file mode 100644 index 0000000000000000000000000000000000000000..0b4c7caae8b5949bf1d1ed0ad3f0776c1047df63 --- /dev/null +++ b/app/ned/notes006.sgm @@ -0,0 +1,9 @@ + +FILE %ned/notes006.sgm + +written: 1997-06-14 +latest update: 1997-06-14 17:34:25 + +Window Callback + + diff --git a/app/ned/notes007.sgm b/app/ned/notes007.sgm new file mode 100644 index 0000000000000000000000000000000000000000..33f4332196438cb8342cdffa04bcd9ee61448616 --- /dev/null +++ b/app/ned/notes007.sgm @@ -0,0 +1,49 @@ + +FILE %ned/notes006.sgm + +written: 1997-06-14 +latest update: 1997-07-27 12:04:14 + +DESGIN NOTES: +implement buffers as windows with a special type ??? + + +Buffer Commands: +^K? copy block to named buffer +^K? move block to named buffer (^KY variant) +^K? insert named buffer (p variant) + +T2D: ++ save block is the buffer 0x00 ++ yanking Kommandos kopieren in den (unnamed) Buffer ++ delete Kommandos transferieren in den (unnamed) Buffer + +Selection Export: +Bei Beginn des Selection Exports Kopie in irgendeinen definierten +Buffer und weitere Export-Segmente daraus abwickeln. + +Hilfsmarker fuer Yanks: 0x02 und 0x03 ?? + +C-API: + line_to_block_store +07/ned0729.c blk_delete +07/ned0723.c clear_block_store + +Blocks and Buffers + +^KV, Cursor in Block problem: + + => cursor at end of block: + + if line_mode: +1 line; else +1 char + curor at begin of block: + + if line_mode: -1 line; else -1 char + + +struct <hyx.l file="proto.h" ln=39 cn=7 tdc=79 tdp=10>NED_BUFFER: +struct <hyx.l file="07/ned0705.c" ln=24 cn=7 tdc=79 tdp=10>NED_BUFFER *<hyx.l file="%ned/07/ned0705.c" mark="ned_get_buffer" tdc="pgm.func" tdp=14>ned_get_buffer (int name, int make) + +07/ned0723b.c 28: struct <hyx.l file="07/ned0723b.c" ln=28 cn=9 tdc=79 tdp=10>NED_BUFFER *bu; +07/ned0723.c 19: int ned_drop_buffer2 (struct <hyx.l file="07/ned0723.c" ln=19 cn=29 tdc=79 tdp=10>NED_BUFFER *bu) +07/ned0727c.c 25: struct <hyx.l file="07/ned0727c.c" ln=25 cn=9 tdc=79 tdp=10>NED_BUFFER *bu; +07/ned0727c.c 31: || (bu= ned_get_buffer (buffer_name, 0)) == (struct <hyx.l file="07/ned0727c.c" ln=31 cn=58 tdc=79 tdp=10>NED_BUFFER *) 0 +07/ned0705.c 20: static struct <hyx.l file="07/ned0705.c" ln=20 cn=14 tdc=79 tdp=10>NED_BUFFER anon_buffer; diff --git a/app/ned/notes008.sgm b/app/ned/notes008.sgm new file mode 100644 index 0000000000000000000000000000000000000000..50e23a6517e2c2408c4dbeda2a5197f9b4c9cef4 --- /dev/null +++ b/app/ned/notes008.sgm @@ -0,0 +1,13 @@ + +FILE %ned/notes008.sgm + +written: 1997-06-15 +latest update: 1997-06-15 9:51:53 + + +Docu Considerations + +Shift-Tab udgl: Help Frame Name +1. besserer Name +2. ev. in Abhaengigkeit vom Tag bzw. Attribut + diff --git a/app/ned/notes009.sgm b/app/ned/notes009.sgm new file mode 100644 index 0000000000000000000000000000000000000000..a0ad17af74c4de1c32418c19546b6ee383c981ca --- /dev/null +++ b/app/ned/notes009.sgm @@ -0,0 +1,47 @@ + +FILE %ned/notes009.sgm + +written: 1997-06-15 +latest update: 1997-06-15 9:51:53 + +SGML tag and feature handling + + +<hyx.l file="%ned/08/ned0886.c" mark="ned_feature_set" tdc="pgm.func" tdp=15>ned_feature_set () + <hyx.l file="%ned/08/ned0850.c" mark="q_feature_set" tdc="pgm.func" tdp=13>q_feature_set () + +w, lp, offset ... Position im File +what ... Typ des Features, z.B. SGML Tag, SGML Entity, Other + +struct FTR_SEGMENT *list + + +V1: +struct FTR_SEGMENT +{ + struct FTR_SEGMENT *next; + + ... + int type; /* tag, attrib_name, attrib_value */ + char str [2]; +}; + +V2: +struct FTR_SEGMENT +{ + struct FTR_SEGMENT *next; + + char *attrib_name; + char *attrib_value; +}; + +attrib_name == NULL => kein attrib name +autom. Quoten und Escapen von Attrib Value, wenn attrib_name gegeben ist + + +==> FTR_EDITOR + +Feature Editor: +add, delete attrib/value pair + + diff --git a/app/ned/notes010.sgm b/app/ned/notes010.sgm new file mode 100644 index 0000000000000000000000000000000000000000..bb34601fbfda7272d37f369bd2aa235c8407d581 --- /dev/null +++ b/app/ned/notes010.sgm @@ -0,0 +1,21 @@ +1999-05-02 13:22:35 + +Herkunft von @@TMP@@.@@ klaeren und sanieren + derzeitige Verdaechtige: + + %ds/hytxt/hytxt010.c int <hyx.l name="hyx_sequencer" tdc=106 tdp=13>hyx_sequencer (...) + + %ds/hytxt/hytxt030.c int <hyx.l name="hyx_threader" tdc="mark" tdp=12>hyx_threader (...) + dort wurden die Namen geaendert, damit sie leichter zugeordnet + werden koennen. + +------ +Menue fuer Tags mit Matching Pattern: + :tag urxn_* + +------ +neues Tk Window: Cursor reinsetzen + +------ +Template Frames mit Pattern: + z.B. "bug: .*" => Template Frame fuer Bugs aktivieren + + diff --git a/app/ned/possig.pl b/app/ned/possig.pl new file mode 100644 index 0000000000000000000000000000000000000000..0b8ebe55558375ebd4987a4b28b64310c60874a9 --- /dev/null +++ b/app/ned/possig.pl @@ -0,0 +1,223 @@ +#!/usr/local/bin/perl +# +# FILE %ned/possig.pl +# +# written: 1996-05-26 +# latest update: 1999-05-01 10:27:50 +# +# ---------------------------------------------------------------------------- + +open (FO, ">\@fnd.sgm") || die; +print FO <<EOF; +searching [ possig.pl ] <hyx.l prc="perl possig.pl" tdc=hyx.l tdp=7>Search! +EOF + +$do_unlink= 0; +@JOBS= (); + +# vi_dkey +ARGUMENT: while ($arg= shift (@ARGV)) +{ + print "arg= $arg\n"; + if ($arg =~ /^-(.*)/) + { + $opt= $1; + if ($opt eq 'f') { &read_file_list (shift (@ARGV)); } + elsif ($opt eq 'unlink') { $do_unlink= 1; } + else + { + &usage; + exit (0); + } + } + else + { + push (@JOBS, $arg); + } +} + +if ($#JOBS == -1) +{ + $cnt= &scan_dir ('.'); + # print FO "found $cnt files to scan\n\n", '-'x72, "\n"; +} + +foreach $arg (@JOBS) { &scan_file ($arg); } + +close (FO); +exit (0); + +# ---------------------------------------------------------------------------- +sub usage +{ + print <<EOX; +usage: $0 [-opts] + +Options: +-f <fnm> specify list of files to check +EOX +} + +# ---------------------------------------------------------------------------- +sub read_file_list +{ + my ($fnm)= @_; + + local (*LIST); + open (LIST, $fnm) || return -1; + while (<LIST>) + { + chop; + ($f)= split; + &scan_file ($f); + } + close (LIST); +} + +# ---------------------------------------------------------------------------- +sub scan_dir +{ + my $dir= shift; + + local (*DIR); + opendir (DIR, $dir) || die "can't read directory '$dir'"; + my @files= readdir (DIR); + closedir (DIR); + + my ($file, $cnt, @st, @dirs); + foreach $file (@files) + { + next if ($file eq '.' || $file eq '..' + || $file eq '_bak_ftr.ned' + || $file eq 'CVS' + || -l $file + ); + + # print ">>> '$file'\n"; + if (-d $file) + { + push (@dirs, "$dir/$file"); + next; + } + + next unless ($file =~ /\.(c|h|fm)$/); + push (@JOBS, "$dir/$file"); + $cnt++; + } + + # print FO "scanning dir '$dir': $cnt files to scan\n"; + # print "scanning dir '$dir': $cnt files to scan\n"; + + foreach $file (@dirs) + { + $cnt += &scan_dir ($file); + } + + $cnt; +} + +# ---------------------------------------------------------------------------- +sub scan_file +{ + my $fnm= shift; + my $line= 1; + + open (FI, $fnm) || return -1; + + $fnm=~ tr/A-Z/a-z/; + $fnm=~ s/\\/\//g; + # print "file: '$fnm'\n"; + +#define NIL (void *) 0 + while (<FI>) + { # ned_eval_hlink ned_eval_string ex_tag_command + # Search! + if ( + # /(BUTTON_DESCRIPTOR)/ || /(locate_button)/ + # /(ned_mouse_event)/ || /(check_maus)/ || /(ned_tk_event_procedure)/ + /(MPflag)/ + # || /(NED_Widget)/ + # || /(ned_get_cx_pos)/ +# /(NED_field_editor_callback)/ +# || /(ned_prompt_string)/ +# || /(ned_tk_prompt_string)/ +# || /(ned_tk_cb_prompt_string)/ + + # /((NED|W)_TEXT_MAX_(X|Y))/ + # /(curses_sig_winch)/||/(WINCH)/ + # /(ned_set_lookup_tag)/ + # /(curses_sig_winch)/||/(WINCH)/ + # /(p_ssave)/ || /(p_wdw(s|q)file)/ + # || /((vi|ned)_jmp_boln)/ + # || /((ned|ned_wc|q)_word_lr)/ + # + # /(ned_line_2_string)/ || + # /(eval_(line|block|feature|str))/ + # /(ned_set_mark)/ + # /(eval_(str))/ + # || /(ned_tk_(current|widget_cmd))/ + + # -------------------------------- + # /(ned_blk_(isolate|duplicate))/ + # /(ned_(shift|change)_markers)/ + # /(selection)/ || /(ned_tk_block_export_flag)/ + + # /(b_(beg|end|first|last))/ + # /(ned_blk_isolate)/ + # /(del_char_(left|right))/ + + # /(ned_activate_frame)/ + # /(default_template_frame)/ + # /(default_cross_ref_template)/ + # /(0x0*[Dd])/||/(13)/ + # /(default_tag_display_mode)/ + + # /(wd_upscr)/||/(ned_w_page_down)/ + # /(line.*(locate|target|find))/ || /((locate|target|find).*line)/ + # /(FC_(next|prev|fnm))/ + # /(bookmark)/ + + # !(/\wq_insert/||/q_insert\w/)&&/(q_insert)/ + # /(b_beg)/ || /(b_end)/ + # /(p_blk(beg|end|hide))/ + # /((memorize|restore)_window_mode)/ + # /(ned_get_cluster_list)/ # T2D: deactivate Cluster Control + # /(q_cross_ref)/ || /(p_1cross_ref)/ + # /(NED_CTX)/ || /(NED_CONTEXT)/ + # /(NED_field_editor_callback)/ + # /(hyx_translate_special_frame)/ + # /(^#[ \t]*include[ \t]+.+array.h)/ + # /(_set(n|)char|_prntcol|_draw_string)/ + # || /(ned_(set|reset)_block_flags)/ + # /(cnt_line|cnt_total_lines|count_lines|cnt_aktline)/ + ) + { + $fnd= $1; + $cn= length ($`); + $tdp= length ($fnd); + + s/&/&/g; + s/</</g; + s/>/>/g; + + s/$fnd/<hyx.l file="$fnm" ln=$line cn=$cn tdc=79 tdp=$tdp>$fnd/gi; + printf (FO "%-14s %5d: %s", $fnm, $line, $_); + + if ($do_unlink && $fnm =~ /(.+)\.c/) + { + $obj_file= $1 . '.obj'; + + if (!defined ($UNLINKED{$obj_file})) + { + print ">> rm $obj_file\n"; + unlink $obj_file; + $UNLINKED{$obj_file}= 1; + } + } + } + + $line++; + } + close (FI); + +} diff --git a/app/ned/proto.h b/app/ned/proto.h new file mode 100644 index 0000000000000000000000000000000000000000..8c225178c97863e3b54546274495a499b73e17ef --- /dev/null +++ b/app/ned/proto.h @@ -0,0 +1,1056 @@ +/* + * FILE %ned/proto.h + * + * function prototyping + * + * written: 1987 09 07 + * 1991 01 31: revision + * latest update: 2001-02-11 11:43:19 + * $Id: proto.h,v 1.10 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifndef __NED_proto__ +#define __NED_proto__ + +#include <gg/floskel.h> + +/* *** TEMP *** ----------------------------------------------------------- */ +#ifdef LCB_standard /* redefined from ed.h !! */ + +#undef LCB_standard +#undef LCB_line_split +#undef LCB_line_join +#undef LCB_chg_wdw + +#define LCB_line_split 0x0004 /* line was splitted at column */ +#define LCB_line_join 0x0008 /* line was joined at column */ +#define LCB_chg_wdw 0x0010 /* window was changed */ +#define LCB_standard 0x001F +#endif /* LCB_standard */ + +#define LCB_DEBUG /* 1997-07-27 11:19:09 */ + +#define NED_TMARK_INSERT2 4 + +#define NED_MARKER_BEG '(' +#define NED_MARKER_END ')' + +/* ------------------------------------------------------------------------ */ +struct NED_BUFFER +{ + struct WINDOWCTRL *wptr; /* File in dem Marker gueltig ist */ + struct LINE *l_beg; /* Zeile mit Marker */ + struct LINE *l_end; /* Zeile mit Marker */ + int c_beg; /* Spalte des Markers */ + int c_end; /* Spalte des Markers */ + int blk_mode; /* block mode for line and char oriented b. */ +} ; + +/* ------------------------------------------------------------------------ */ +/* Experimental, 1996-11-04 */ +struct NED_FLC /* feature lookup cache */ +{ + char *ty; /* feature type */ + char *str; /* feature text */ +} ; + +#define new_ned_flc() ((struct NED_FLC *) calloc (sizeof (struct NED_FLC), 1)) + +/* methods: --------------------------------------------------------------- */ +typedef int NED_field_editor_callback (char *edited_string, void *callback_data); +typedef void ned_primitive_function (void); + +struct NED_FIELD_CONTEXT +{ + char *label; /* message text */ + + char *buffer; /* string edit buffer and default */ + int buffer_size; + int buffer_mode; /* type of *buffer storage (1) */ +#define FCbm_allocate 0 /* allocate buffer yourself */ +#define FCbm_volatile 1 /* allocate and copy buffer */ +#define FCbm_static 2 /* buffer can be used, is static */ +#define FCbm_dynamic 3 /* buffer can be used, is malloc'ed */ + + NED_field_editor_callback *callback; + void *callback_data; + + char *help_cluster; + char *help_frame; + char *help_file; +} ; + +/* NOTES: */ +/* (1) the buffer in the structure should only be static or dynamic, */ +/* the other modes are only used during setting up of the buffer */ + +/* ------------------------------------------------------------------------ */ +#ifdef __HPUX__ +char *strdup (char *); /* for some reasons, not defined under HP/UX */ +#endif + +/* searching a better place for that ... (1995-10-28) */ +#define NED_TK_GC_cursedText 0x0100 +#define NED_TK_GC_normalText 0x0101 +#define NED_TK_GC_StatusLine 0x0102 +#define NED_TK_GC_markedText 0x0103 + +#define NED_TK_CMD_MOUSE_B2 1 +#define NED_TK_CMD_WINS 2 +#define NED_TK_CMD_MENU 3 + +/* read only version: ----------------------------------------------------- */ +#ifdef NED_READ_ONLY +# define ned_eval_hlink ned_ro_eval_hlink +# define ned_activate_cluster ned_ro_activate_cluster +# define ned_get_cluster_list ned_ro_get_cluster_list +# define ned_activate_frame ned_ro_activate_frame +#endif /* NED_READ_ONLY */ + +/* TK Version: ------------------------------------------------------------ */ +#ifdef USE_TK +#define ned_show_display_range ned_tk_show_display_range +int tk_resetcup (void); +#else +#define ned_show_display_range ned_ch_show_display_range +#endif /* USE_TK */ + +/* machine specific definitions: ------------------------------------------ */ +#ifdef __SINIX__ +char *strdup (char *s); +#endif + +/* usefull macros: -------------------------------------------------------- */ +#define get_coln(wc) ((wc)->cx + (wc)->hv - (wc)->ax) +#define REPEAT ((repeat) ? repeat : 1) + +/* ------------------------------------------------------------------------ */ +/* NED00 */ int main (int argc, char *argv[]); +/* NEDT3 */ void maus_setup (void); + +/* 00.. ------------------------------------------------------------------- */ +/* 0003 */ void maus_setup (void); +/* 0011 */ int ned_0011 (void); + +/* 01.. ------------------------------------------------------------------- */ +/* 0101 */ void wdw_rst (struct WINDOWCTRL *w); +/* 0102 */ int ned_w_cursor_up (register struct WINDOWCTRL *w, int num); +/* 0102p */ void ned_cursor_up (void); +/* 0102m */ void ned_vi_cursor_mid (void); +/* 0102v */ void ned_vi_cursor_top (void); +/* 0103 */ int ned_w_cursor_down (register struct WINDOWCTRL *w, int num); +/* 0103p */ void ned_cursor_down (void); +/* 0103v */ void ned_vi_cursor_bot (void); +/* 0104 */ void chk_updown (struct WINDOWCTRL *wc); + +/* 0105 */ int ned_w_cursor_left (register struct WINDOWCTRL *w, int num); +/* 0105a */ int ned_q_cursor_left (struct WINDOWCTRL *w, int df); +/* 0105p */ void ned_cursor_left (void); +/* 0106 */ int ned_w_cursor_right (register struct WINDOWCTRL *w, int num); +/* 0106a */ int ned_q_cursor_right (struct WINDOWCTRL *w, int df); +/* 0106p */ void ned_cursor_right (void); + +/* 0107 */ void p_word_left (void); +/* 0107b */ void p_word_left_2 (void); +/* 0108a */ void p_word_right_beg (void); +/* 0108b */ void p_word_right_end (void); +/* 0108c */ void p_word_right_beg_2 (void); +/* 0108d */ void p_word_right_end_2 (void); +/* 0109 */ void ned_wc_word_lr (struct WINDOWCTRL *wc, int mode); +#define JMPWRD_left_beg 1 +#define JMPWRD_right_beg 2 +#define JMPWRD_right_end 3 +#define JMPWRD_left_beg_2 4 +#define JMPWRD_right_beg_2 5 +#define JMPWRD_right_end_2 6 + +/* 0110 */ void ned_w_page_up (struct WINDOWCTRL *wc, int part); +/* 0110a */ void ned_page_up (void); +/* 0110b */ void ned_half_page_up (void); +/* 0111 */ void ned_w_page_down (struct WINDOWCTRL *wc, int part); +/* 0111a */ void ned_page_down (void); +/* 0111b */ void ned_half_page_down (void); +/* 0112 */ void p_ctrlq (void); +/* 0112w */ void p_ctrlw (void); +/* 0113 */ void p_ctrlk (void); +/* 0114 */ void p_ctrlo (void); +/* 0115 */ void ned_ctrlp (void); +/* 0115b */ void ned_insert_special_char (int insert); +/* 0116 */ void p_funct (void); +/* 0117 */ void p_nl2 (void); +/* 0118 */ void p_nl (void); +/* 0119 */ void p_ax_lng (void); +/* 0119a */ void ned_w_jmp_in_line (struct WINDOWCTRL *wc, + int mode, int offset); +#define NEDJMP_BOLN 1 +#define NEDJMP_EOLN 2 +#define NEDJMP_AXLNG 3 +/* 0120 */ void ned_jmp_boln (void); +/* 0121 */ void ned_jmp_eoln (void); +/* 0122 */ void ned_del_char_right (void); +/* 0123 */ void ned_del_char_left (void); +/* 0124 */ void background (void); +/* 0124 */ void window_status (register struct WINDOWCTRL *w); +/* 0124 */ void back2ground (void); +/* 0124 */ void QQdeb (void); +/* 0125 */ int ned_show_display_range (struct WINDOWCTRL *w); +/* 0126 */ int q_isolate_word (char *wp, int max_lng, int charset, + int go_left); +/* 0127 */ int qq_isolate_word (char *wp, int max_lng, int charset, + struct LINE *lp, int off, int llng, + int go_left); +/* 0128 */ void p_ctrlu (void); +/* 0129 */ void p_split_join (void); +#ifdef _THE_FUNCTION +/* 0131 */ struct LINE *alloc_line (void); +#else +#define alloc_line() ((struct LINE *) calloc (sizeof (struct LINE), 1)) +#endif +/* 0132 */ struct TXT *txch_alloc (int size, int ch); +/* 0133 */ struct TXT *tx_alloc (int size); +/* 0134 */ void strfill (char *s, int cnt, int ch); +#ifdef _THE_FUNCTION +/* 0135 */ struct WINDOWCTRL *wdw_alloc (void); +#else +#define wdw_alloc() ((struct WINDOWCTRL *) calloc (sizeof (struct WINDOWCTRL), 1)) +#endif +#ifdef _THE_FUNCTION +/* 0136 */ struct FILECTRL *file_alloc (void); +#else +#define file_alloc() ((struct FILECTRL *) calloc (sizeof (struct FILECTRL), 1)) +#endif +#ifdef _THE_FUNCTION +/* 0137 */ struct FEATURE *ned_feature_alloc (void); +#else +#define ned_feature_alloc() ((struct FEATURE *) calloc (sizeof (struct FEATURE), 1)) +#endif +/* 0138 */ void ned_lines_free (struct LINE *lp); +/* 0138b */ void ned_feature_free (register struct FEATURE *f); +/* 0139 */ void txt_adj (int lng, struct TXT **tp); +/* 0140 */ void tx_free (struct TXT *tp); +/* 0141 */ void file_free (struct FILECTRL *fc); +/* 0142 */ int in_charset (int ch, int charset); + +/* 02.. ------------------------------------------------------------------- */ +/* 0201 */ /* N/A */ +/* 0202 */ void setcup (register struct WINDOWCTRL *w); +/* 0203 */ void wd_displine (struct WINDOWCTRL *w, struct LINE *l_ptr, + int l_num, int xa, int xb); +/* 0204 */ void ned_display_window (struct WINDOWCTRL *w); +/* 0204b */ void wd_2setup (struct WINDOWCTRL *w, int xa, int ya, + int xb, int yb); +/* 0204c */ void ned_decorate_window (struct WINDOWCTRL *w); +/* 0205 */ /* N/A: void wd_setup (void); ... renamed! */ +/* 0206 */ void wda_setup (void); +/* 0207 */ int wd_upscr (struct WINDOWCTRL *wc); +/* 0208 */ void p_upscr (void); +/* 0209 */ void wd_dnscr (struct WINDOWCTRL *wc); +/* 0210 */ void p_dnscr (void); +/* 0211 */ void ned_close_window (void); +/* 0211b */ int ned_w_close_window (register struct WINDOWCTRL *wc); +/* 0212 */ int p_wdwopen (void); +/* 0213a */ void p_wdwsize (void); +/* 0213b */ void q_wdwsize (int k); +/* 0213c */ void q2_wdwsize (struct WINDOWCTRL *w, int pos); +/* 0214 */ int ned_window_size (struct WINDOWCTRL *wc, int p, int f); +/* 0214 */ int ned_window_size_preset (int pax, int pay, + int pbx, int pby); +/* 0215a */ struct WINDOWCTRL *ned_create_editor_window (void); +/* 0215b */ struct WINDOWCTRL *ned_create_feature_window (void); +/* 0215c */ struct WINDOWCTRL *ned_create_window_pair (void); +/* 0216 */ void p_wdwXup (void); +/* 0217 */ void p_wdwXdn (void); +/* 0218 */ void p_wdwXlt (void); +/* 0219 */ void p_wdwXrt (void); +/* 0220 */ void p_wdwAup (void); +/* 0221 */ void p_wdwAdn (void); +/* 0222 */ void p_wdwAlt (void); +/* 0223 */ void p_wdwArt (void); +/* 0224 */ void p_wdwBup (void); +/* 0225 */ void p_wdwBdn (void); +/* 0226 */ void p_wdwBlt (void); +/* 0227 */ void p_wdwBrt (void); +/* 0228 */ void wd_show_wdnr (int p, int x, int y, int c, int n); +/* 0229 */ void p_wdwfaecher (void); +/* 0230 */ int q_wdwopen (struct WINDOWCTRL **wc, int *win_num); +/* 0231 */ void p_clone_window (void); +#ifdef MSDOS +/* 0232 */ void p_switch_line_mode (void); +#endif /* MSDOS */ +/* 0232 */ void restore_window_mode (void); +/* 0232 */ void memorize_window_mode (void); +/* 0240 */ void vi_append (void); +/* 0241 */ void vi_append_eol (void); +/* 0242 */ void vi_insert_bol (void); +/* 0243 */ void vi_bell (void); + void vi_set_bell_mode (int mode); +/* 0244 */ void vi_ex (void); + int vi_ex_interp (char *buffer); + int ex_set_command (char *buffer); +/* 0245 */ void vi_dkey (void); +/* 0246 */ void vi_insert_after_line (void); +/* 0247 */ void vi_insert_before_line (void); +/* 0248 */ void vi_repeat_last_command (void); +/* 0248 */ int set_repeat_command (void (*fnc)(void)); +/* 0249 */ void vi_join (void); +/* 0250 */ int vi_change_text (struct WINDOWCTRL *w, int mode, + int count); +#define VI_CHG_WORD 1 +#define VI_CHG_CHAR 2 +#define VI_CHG_2EOLN 3 +#define VI_CHG_LINE 4 +#define VI_CHG_2BOLN 5 +#define VI_CHG_WORD3 6 +#define VI_CHG_WORD4 7 +/* 0251 */ void vi_substitute (void); +/* 0252 */ void pico_mode (void); +/* 0253 */ void wordstar_mode (void); +/* 0253v */ void vi_mode (void); +/* 0254 */ void vi_change_2eoln (void); +/* 0254b */ void vi_change_2boln (void); +/* 0255 */ void vi_change_line (void); +/* 0256 */ void vi_jmp_boln (void); + void vi_wc_jmp_boln (struct WINDOWCTRL *wc); +/* 0256a */ void vi_jmp_column (void); +/* 0257 */ void vi_jmp_prev_boln (void); +/* 0258 */ void vi_jmp_next_boln (void); +/* 0259 */ int ex_tag_command (const char *str); +/* 0260 */ struct MARKER *ned_get_marker (int marker_id, int alloc); + int ned_marker_callback (int event, void *line, void *cd, + int column, void *op2); + int ned_reset_markers (struct WINDOWCTRL *w); + int ned_reset_a_marker (int marker_id); + int ned_check_for_markers (struct LINE *lp, int all); + +#define ned_marker_rel_cb(pl,mp) \ + ned_line_rel_cb ((pl), ned_marker_callback, LCB_standard, (mp)) +#define ned_marker_reg_cb(pl,mp) \ + ned_line_reg_cb ((pl), ned_marker_callback, LCB_standard, (mp)) + +/* 0260b */ int ned_jmp_marker (int marker_id, int flg); +/* 0260c */ int ned_set_marker (struct WINDOWCTRL *wc, int marker_id); + +/* 0261 */ void vi_digit (void); +/* 0262a */ void vi_jmp_2line (void); +/* 0263 */ int ned_yank_block (int add_mode); + int ned_yank_marked (struct MARKER *mrk_beg, + struct MARKER *mrk_end, int add_mode); + +/* 03.. ------------------------------------------------------------------- */ +/* 0301 */ void p_ovins (void); +/* 0302 */ void p_ww (void); +/* 0303 */ void p_ins (void); +#ifdef USE_ABBREVIATIONS + int ned_check_abbrev (void); + int ned_reset_abbrev (void); + int ned_abbrev_reduce (void); + int ned_define_abbrev (const char *lhs, const char *rhs); + int ned_undefine_abbrev (const char *lhs); +#endif /* USE_ABBREVIATIONS */ + +/* 0304 */ void q_insert (int k, int df); +/* 0304b */ void q_insert_string (char *s, int df); +/* 0305 */ void ned_wc_insert (register struct WINDOWCTRL *w, int k, int df); +/* 0306 */ void ned_wc_delete (struct WINDOWCTRL *w, int df); +/* 0307 */ void p_insblk (void); +/* 0308 */ int get_txt (struct LINE *lp, int coln); + int get_txt_visible (struct LINE *lp, int coln); +/* 0309 */ void wd_coldis (struct WINDOWCTRL *w, int la, int lz, + struct LINE *lp, int coln, int colpos); +/* 0310 */ void p_colornxt (void); +/* 0311 */ void p_backcolnxt (void); +/* 0312 */ int get_confirmation (char *message, int std); +/* 0313 */ void p_turn_line (void); +/* 0314 */ void p_fget (void); +/* 0315 */ void p_alt_minus (void); +/* 0316 */ void p_alt_gleich (void); +/* 0319 */ void NED_interpreter (void); + void vi_on (void); + void vi_ins (void); + void ned_wc_ins_mode (struct WINDOWCTRL *wc, int mode); + void vi_ovr (void); +/* 0320 */ void p_alt_zero (void); +/* 0321 */ void ned_line_end_MAC (void); +/* 0322 */ void ned_line_end_MSDOS (void); +/* 0323 */ void ned_line_end_UNIX (void); +/* 0324 */ void NEDa1_interpreter (void); +/* 0325 */ void NEDa2_interpreter (char *IP); +/* 0326 */ void wd_init (struct WINDOWCTRL *w); +/* 0327 */ int q_kbin (void); +/* 0328 */ int qq_insert (struct LINE *lp, int insert_idx, int character, + int insert_flag); +/* 0329 */ int qq_delete (struct LINE *lp, int delete_idx, int delete_cnt); +/* 0330 */ void ned_delete_word (void); + void ned_delete_word_2 (void); + void ned_delete_word_3 (void); + int ned_wc_delete_word (struct WINDOWCTRL *wc, int mode); +/* 0331 */ void ned_lp_delete_word (struct LINE *lp, int delete_idx, int mode); +/* 0332 */ int qq_insert_string (struct LINE *lp, int insert_idx, + const char *str, int str_lng, int insert_flag); +/* 0332b */ int qq_insert_string_array (struct LINE *lp, int insert_idx, + const char *ftxt[], int t_cnt, int insert_flag); +/* 0333 */ void ned_save_reload (struct WINDOWCTRL *wc, + int change_tag_display_mode); +/* 0333b */ void p_save_reload (void); +/* 0333c */ void p_show_tag_normally (void); +/* 0333d */ void p_show_tag (void); +/* 0333e */ void p_show_full_tag (void); + void ned_reload_ascii (void); + void ned_reload_sgml (void); +/* 0334 */ void ned_read_entity (void); +/* 0334b */ int ned_enter_entity (const char *str); +/* 0335 */ void p_toggle_case (void); +/* 0341a */ int ned_line_trigger_change (struct LINE *lp, + int column, int amount); +/* 0341b */ int ned_line_trigger_split_join (struct LINE *lp, + struct LINE *lp2, int column, int action); +/* 0341c */ int ned_line_trigger_delete (struct LINE *lp, + int destroy, int cycle); +/* 0342a */ int ned_line_reg_cb (struct LINE *lp, line_callback *fnc, + int event_mask, void *cd); +/* 0342b */ int ned_line_rel_cb (struct LINE *lp, line_callback *fnc, + int event_mask, void *cd); +/* 0342c */ int ned_line_test_cb (struct LINE *lp); + +/* 04.. ------------------------------------------------------------------- */ +/* 0401 */ void s_fget (struct WINDOWCTRL *w); +/* 0402 */ int ned_f_read (struct WINDOWCTRL *w, char *filenm_txt, + char *filenm_ftr, int flag, + struct LINE **laptr, struct LINE **lzptr, + long la_offset, long lz_offset); +#ifdef _FILE_DEFINED +#ifdef __GG_streams__ +/* 0402b */ int ned_stream_read (struct WINDOWCTRL *w, + struct LINE **laptr, struct LINE **lzptr, + long lz_offset, int format, + struct STREAM_OBJECT *so, FILE *ff, int flcnt, int fccnt); +#endif /* __GG_streams__ */ +#endif /* _FILE_DEFINED */ +/* 0403 */ int ned_f_write (struct WINDOWCTRL *w, char *filenm_txt, + char *filenm_ftr, int flag, int lz_flag, + struct LINE *laptr, struct LINE *lzptr, + long *la_offset, long *lz_offset, int flg2); +#define FLG2_none 0x00 +#define FLG2_append_mode 0x01 /* Bit 0: Append Modus */ +#define FLG2_block_mode 0x02 /* 1: Block Modus */ +#define FLG2_format_change 0x04 /* 2: change file mode ASCII<->SGML */ +#define FLG2_write_crlf 0x08 /* 3: write CR LF Pairs */ + +/* 0404 */ int ned_w_save (struct WINDOWCTRL *w, int flg); +/* 0405 */ int q_allsave (int flg); +#ifdef _FILE_DEFINED +/* 0406 */ void fputc_code (int ch, FILE *fo); +/* 0406 */ int fgetc_code (FILE *fi); +/* 0406 */ void set_code (char *cp); +/* 0406 */ void flush_last (FILE *f); +#endif +/* 0407 gen_extension() -> fnmcpy() und fnmcpy2() (siehe sbr.h) */ +/* 0408 */ void p_sx (void); +/* 0409 */ void p_save (void); +/* 0409b */ void ned_rename_and_save (void); +/* 0409c */ void ned_pico_exit (void); +/* 0410 */ void p_ssave (void); + void ned_ssave_all (void); +/* 0411 */ void p_abandon (void); +/* 0412 */ void ned_wc_abandon (struct WINDOWCTRL *wc); +/* 0413 */ void p_qabandon (void); +/* 0414 */ void p_save_restart (void); +/* 0415 */ void p_load_restart (void); +/* 0416 */ void p_shell (void); +/* 0417 */ void p_link (void); +/* 0417b */ int q2_link (struct WINDOWCTRL *w_dest, + struct WINDOWCTRL *w_src, int flags); +/* 0418 */ void p_unlink (void); +/* 0419 */ +/* 0420 */ int editable_file (char *fnm); +/* 0421 */ void p_XX_break (void); +/* 0422 */ void ned_show_author (void); +/* 0423 */ void ned_show_version (void); +/* 0424 */ +/* 0425 */ int find_file (char *fnm, + char *current_path, char **real_fnm, char **virtual_fnm); +/* 0426 */ void q_shell (char *command_line); +/* 0427 */ void p_pfile (void); + +/* **** ** BEGIN mostly obsolete functions for access to networked objects */ +/* 0428 */ int access_gopher (char *hlink, char *fil); +/* 0429 */ int q_extract (char *filename, char *message); +/* 0430 */ void p_extract (void); +/* 0431 */ int dorothy_rw (char *tmpfnm, char *server, long port, + char *action, char *cl_or_file, char *fr); +/* 0432 */ int read_access_methods (char *fn); +/* 0432 */ int do_prompt (char *str); +/* 0432 */ int indirect_object_access (char *tmpfnm, int read_or_write, + int file_or_cluster, char *location, char *cl_or_file, + char *fr); +/* **** ** END mostly obsolete functions for access to networked objects */ + +/* 0433 */ void enable_ned_history (void); +/* 0433 */ void disable_ned_history (void); +/* 0433 */ int setup_ned_history (void); +/* 0433 */ int ned_history (char *file_or_cluster, char *frame, + char *comment, int f_type, int f_format); +/* 0434 */ char *ned_get_file_path (struct WINDOWCTRL *wc); + +/* 05.. ------------------------------------------------------------------- */ +/* 0501 */ void p_aitoggle (void); +/* 0502 */ void ned_del2eoln (void); +/* 0502b */ int ned_w_del2eoln (register struct WINDOWCTRL *w); +/* 0502c */ void ned_del2boln (void); +/* 0502d */ int ned_w_del2boln (register struct WINDOWCTRL *w, + int opcode); +/* 0503 */ void ned_pr_jump_to_line (void); + int ned_cb_jump_to_line (const char *str, void *cb_data); +/* 0504 */ struct LINE *ned_get_line_by_nr (register struct LINE *lp, + int *lnr); +/* 0505 */ int ned_jmp_2line_by_nr (struct WINDOWCTRL *w, + int lnr, int flg); +/* 0506a */ int ned_cnt_line_2beg (struct LINE *a); +/* 0506b */ int ned_cnt_line_2end (struct LINE *a); +/* 0506c */ int ned_cnt_total_lines (struct LINE *a); +/* 0506d */ void ned_cnt_act_line (void); +/* 0506e */ int ned_cnt_line_relative (register struct LINE *a, + register struct LINE *b); +/* 0507 */ void ned_show_total_lines (void); +/* 0508 */ int ned_w_jmp_aktline (struct WINDOWCTRL *wc, + int offset_mode, int offset, int flg); +#define NEDJMP_LINE_TOP 1 +#define NEDJMP_LINE_3 2 +#define NEDJMP_LINE_MID 3 +#define NEDJMP_LINE_BOT 4 +#define NEDJMP_FLAG_REDRAW 0x01 +#define NEDJMP_FLAG_BOLN 0x02 +#define NEDJMP_FLAG_NO_CNT 0x04 /* don't count current line number */ +#define NEDJMP_FLAG_STD (NEDJMP_FLAG_REDRAW|NEDJMP_FLAG_NO_CNT|NEDJMP_FLAG_BOLN) + +/* 0508b */ void ned_jmp_aktline_bot (void); +/* 0508m */ void ned_jmp_aktline_mid (void); +/* 0508t */ void ned_jmp_aktline_top (void); +/* 0509 */ int ned_wc_ins_nl (struct WINDOWCTRL *wc); +/* 0510 */ void ned_delete_line (void); + int ned_wc_delete_line (register struct WINDOWCTRL *w, + int blk_save, int col_text); +/* 0510b */ int ned_delete_current_line (register struct WINDOWCTRL *w); +/* 0510c */ int ned_delete_a_line (register struct WINDOWCTRL *w, + register struct LINE *lp); +/* 0511 */ void ned_join3 (struct WINDOWCTRL *wc); +/* 0512 */ void tabulate (void); +/* 0513 */ void pq_up (void); +/* 0514 */ void pq_dn (void); +/* 0515 */ int ned_split (struct LINE *split_line, + struct LINE **splitted_part, + int split_position, int auto_indent); +/* 0515b */ int ned_split2 (struct LINE *split_line, + struct LINE **splitted_part, + int split_position, int auto_indent); +/* 0516 */ int ned_join (struct LINE *lp1, struct LINE *lp2); +/* 0516b */ int ned_join2 (struct LINE *lp1, struct LINE *lp2); +/* 0517 */ int ned_copy_line (struct LINE **dl, struct LINE *sl); +/* 0518 */ +/* 0519 */ int jmpline_relative (register struct WINDOWCTRL *w, + double fraction); +/* 0520 */ int jmp2column (register struct WINDOWCTRL *w, int coln); +/* 0521 */ int ned_copy_feature_list (struct FEATURE **fd, + struct FEATURE *fs); +/* 0522 */ int winstack_push (struct WINDOWCTRL *w); +/* 0522 */ struct WINDOWCTRL *winstack_pop (void); +/* 0522 */ int winstack_delete (struct WINDOWCTRL *w); +/* 0522 */ struct WINDOWCTRL *winstack_get (int num); + +/* 06.. ------------------------------------------------------------------- */ +/* 0602 */ void ned_clear_screen (void); +/* 0603 */ void p_refresh (void); +/* 0604 */ void p_refresh_all (void); +/* 0605 */ void p_jmpwdw (void); +/* 0606 */ struct WINDOWCTRL *q_jmpwdw (int i); +/* 0607 */ void p_pushpage (void); +/* 0608 */ void q_pushpage (struct WINDOWCTRL *w, int new_page); +/* 0609 */ int maus_jmpwdw (int x, int y); +/* 0610 */ int q_ofile (int flags); +/* 0610a */ void p_ofile1 (void); +/* 0610b */ void p_ofile2 (void); +/* 0610c */ int ned_open_file (const char *fnm, + const char *help_cluster, const char *help_frame, int flags); +/* 0610d */ int ned_cb_open_file (char *str, void *cb_data); +/* 0610e */ int ned_open_file_2 (struct WINDOWCTRL *wc, + char *fnm, int flags); +/* 0611 */ void p_wdwsfile (void); +/* 0612 */ void p_wdwqfile (void); +/* 0613 */ int rd_str (char *msg, char *str, int str_size); +/* 0613b */ int ned_rd_str2 (const char *msg, char *str, int str_lng, + int msg_lin, int col_ask, int *last_key); +/* 0614 */ int ned_rename_file (char *fnm, int max_fnm); +/* 0615 */ int q_fnm (char *fnm); +/* 0616 */ int ned_rename_object (void); +/* 0617 */ /* void p_garbling_code (void); ... not used any more */ +/* 0618 */ void p_exit (void); +/* 0619 */ void p_ultra_panic (void); +/* 0620 */ void debug (char *s); +/* 0621 */ int ned_error_message (char *s); +/* 0622 */ int ned_message_1 (const char *p1); + int ned_message_2 (const char *p1, const char *p2); + int ned_message_3 (const char *p1, const char *p2, const char *p3); + int ned_message_4 (const char *p1, const char *p2, + const char *p3, const char *p4); + int ned_message_X (int cnt, const char *s[]); +/* 0623 */ void correct_pathname (char *s); +/* 0624 */ void save_message_line (void); +/* 0624 */ void restore_message_line (void); +/* 0625 */ int q2_jmpwdw (struct WINDOWCTRL *wc); +/* 0626 */ void q0_jmpwdw (struct WINDOWCTRL *wc); +/* 0627 */ int open_file_and_window (char *filename); +/* 0628 */ int take_history_notes (struct WINDOWCTRL *w); +/* 0629 */ int get_window_number (struct WINDOWCTRL *w); +/* 0630 */ char *FC_setup_filenames (struct FILECTRL *fc, + char *specified, char *ftr_name); +/* 0631 */ int ned_prompt_string (const char *msg, char *str, int str_lng, + const char *help_cluster, const char *help_frame, + NED_field_editor_callback *cb, void *client_data); + +/* 07.. ------------------------------------------------------------------- */ +/* 0701 */ int ned_set_marker2 (struct WINDOWCTRL *wc, struct LINE *lp, + int offset, struct MARKER *b); +/* 0702 */ void ned_set_marker_key (void); +/* 0703 */ void ned_group_set_marker (void); +/* .... */ +/* 0705 */ struct NED_BUFFER *ned_get_buffer (int buffer_id, int alloc); +/* .... */ +/* 0711 */ void vi_yank (void); +/* 0712 */ void ned_blk_mode (void); +/* 0713 */ void ned_set_block_markers (struct WINDOWCTRL *wc, + struct LINE *lp, int offset, int what, int mode); +/* 0714 */ void p_blkbeg (void); +/* 0715 */ void p_blkend (void); +/* 0716 */ void p_hideblk (void); +/* 0717 */ int ned_reset_block_flags (struct WINDOWCTRL *w); +/* 0718 */ void ned_blk_rst (void); +/* 0719 */ int ned_set_block_flags (void); +/* 0719b */ int ned_swap_markers (struct MARKER *m1, struct MARKER *m2); +/* 0719c */ int ned_copy_markers (struct MARKER *dst, struct MARKER *src); +/* 0720 */ int ned_blk_invalid (void); +/* 0721 */ void ned_blk_screen (void); +/* 0722 */ int ned_blk_orientation (struct LINE *p); +/* 0723 */ int ned_drop_buffer2 (struct NED_BUFFER *bu); +/* 0723a */ int ned_drop_buffer (int name); +/* 0723b */ int ned_store_line_to_buffer (int name, + struct LINE *lp_b, struct LINE *lp_e, int add_mode); + int ned_fresh_buffer (void); +/* 0724 */ int ned_blk_isolate ( + struct LINE *s_start, struct LINE *s_stop, + struct LINE **d_start, struct LINE **d_stop, + int sp1, int sp2, int copy_mode); +/* 0724a */ int ned_blk_isolate2 (struct MARKER *m1, struct MARKER *m2, + int no_realign); +/* 0725 */ int ned_blk_insert (struct LINE *where, + struct LINE *start, struct LINE *stop); +/* 0725b */ int ned_blk_insert2 (struct LINE *act_line, int xcx, + struct LINE *la, struct LINE *lb); +/* 0725c */ int ned_blk_insert3 (struct WINDOWCTRL *wc, + struct LINE *la, struct LINE *lb, int before); +/* 0726 */ int ned_blk_duplicate ( + register struct LINE *s_start, struct LINE *s_stop, + struct LINE **d_start, struct LINE **d_stop, + int sp1, int sp2, int copy_mode); +/* 0727 */ void ned_wc_blk_copy (struct WINDOWCTRL *wc, int before); +/* 0727a */ void ned_blk_copy (void); +/* 0727b */ void ned_blk_copy_before (void); +/* 0727c */ void ned_wc_buffer_copy (struct WINDOWCTRL *wc, + int buffer_id, int before); +/* 0727d */ void ned_buffer_copy (void); +/* 0727e */ void ned_buffer_copy_before (void); +/* 0728 */ void ned_blk_move (void); +/* 0729 */ void ned_blk_delete (void); +/* 0730 */ void ned_blk_read (void); +/* 0731a */ void ned_blk_append (void); +/* 0731p */ void ned_blk_print (void); +/* 0731w */ void ned_blk_write (void); +/* 0732 */ void q_wablk (int mode); +/* 0733 */ void q_jmp_marker (struct MARKER *m); +/* 0734 */ void p_jmp_blkbeg (void); +/* 0735 */ void p_jmp_blkend (void); +/* 0736 */ void ned_jmp_marker_key (void); +/* 0737 */ void ned_jmp_marker_1 (void); + void ned_jmp_marker_find (void); +/* 0738 */ char *ned_block_2_string (char *buffer, int maxBytes, + long offset, int flags); +/* .... */ +/* 0747 */ int ned_blk_critical (void); +/* 0747b */ int ned_blk_realign_if_critical (struct LINE *new_line); +/* 0749 */ void ned_blk_iconify (void); +/* 0750 */ int ned_blk_mark_all (struct WINDOWCTRL *w); +/* 0751 */ struct LINE *ned_find_first_line (struct LINE *lc); +/* 0752 */ struct LINE *ned_find_last_line (struct LINE *lc); +/* 0753 */ int ned_paste_string (const char *buffer, int ai_mode, + char *line_prefix, char *line_postfix); +/* 0754a */ int ned_paste_date (void); +/* 0754b */ int ned_paste_seconds (void); +/* 0754c */ int ned_paste_date_time (void); +/* 0754d */ int ned_paste_date_string (void); +/* 0756 */ int ned_paste_file_name (void); +/* 0758 */ int ned_paste_user (void); +/* 0759 */ int ned_markup_block (struct WINDOWCTRL *w, + int start_tag_segments, const char *start_tag [], + int stop_tag_segments, const char *stop_tag []); +/* 0760 */ int ned_markup_block_2 (struct WINDOWCTRL *w, const char *start_tag); +/* 0761 */ void ned_markup_block_prompt (void); +/* 0763 */ int ned_paste_renamed_object (void); + +/* 08.. ------------------------------------------------------------------- */ +/* 0803 */ void p_feature_next (void); +/* 0804 */ void p_feature_prev (void); +/* 0805 */ void p_feature_range (void); +/* 0806 */ void p_feature_set (void); +/* 0807 */ void p_feature_reset (void); +/* 0808 */ int ned_link_feature_lines (int ftr_types, + int ftr_subtypes, int str_cnt, char *mstr[]); +/* 0809 */ int ned_setup_feature_window (int ftr_types, + int ftr_subtypes, int str_cnt, char *mstr[]); +/* 0810 */ void q_save_restart (void); +#ifdef _FILE_DEFINED +/* 0811 */ void q_save_marker (FILE *fo, struct MARKER *m); +#endif +/* 0812 */ void q_load_restart (void); +#ifdef _FILE_DEFINED +/* 0812 */ void q_load_marker (FILE *fi, struct MARKER *m); +#endif +/* 0813 */ void p_link_feature (void); +/* 0814 */ struct WINDOWCTRL *active_feature_window ( + struct WINDOWCTRL *w); + +#ifdef _FILE_DEFINED +/* 0821 */ int wr_ftr (FILE *ff, int ln, struct FEATURE *fp, + int col, int vcol); +/* 0822 */ void wr_ftr_txt (FILE *ff, struct FEATURE *fp, + long *position); +/* 0823 */ int rd_ftr (struct WINDOWCTRL *wc, struct LINE *lp, FILE *ff, + struct FEATURE **fpp, int p, char *repl_array, int *repl_size, + int repl_max); +/* 0824 */ int wr_sgml_tag (FILE *ff, struct FEATURE *fp, int col_idx, + long *position); +#endif /* _FILE_DEFINED */ + +#ifdef __GG_streams__ +/* 0825 */ int rd_sgml_tag (struct WINDOWCTRL *wc, + struct LINE *lp, struct STREAM_OBJECT *so, + struct FEATURE **pf, int idx, int feature_type, + int delimiter1, int delimiter2, char *repl_array, + int *repl_size, int repl_max); +#endif /* __GG_streams__ */ + +/* 0826 */ int find_feature (struct LINE *lp, int direction, + char *feature_name, struct LINE **found_line, + int *nr_found_line, struct FEATURE **found_feature); +/* 0827 */ int find_feature_with_attribute (struct LINE *lp, + int direction, char *feature_name, char *attribute_name, + char *attribute_value, struct LINE **found_line, + int *nr_found_line, struct FEATURE **found_feature); +/* 0828 */ void copy_tag (char *dst, char *src, int max_dst, int mode); +/* 0828 */ int ned_identify_feature (struct WINDOWCTRL *wc, + struct LINE *lp, int offset, + int feature_type, struct FEATURE *ft, char *lin, + char *repl_array, int *repl_size, int repl_max); +/* 0829 */ int ned_insert_feature (struct FEATURE **fp, + struct FEATURE *f); + +/* 0830 */ int setup_sgml_entity_descriptors (char *setup_file_name); +/* 0830 */ void reset_sgml_entity_descriptors (void); +/* 0830 */ struct SGML_ENTITY_DESCRIPTOR *get_sgml_entity_descriptor ( + int tag_id); +/* 0830 */ struct SGML_ENTITY_DESCRIPTOR *find_sgml_entity_descriptor ( + char *tag); +/* 0831 */ int setup_sgml_tag_descriptors (const char *setup_file_name); +/* 0831 */ void reset_sgml_tag_descriptors (void); +/* 0831 */ struct SGML_TAG_DESCRIPTOR *get_sgml_tag_descriptor ( + int tag_id); +/* 0831 */ struct SGML_TAG_DESCRIPTOR *find_sgml_tag_descriptor ( + char *tag); +/* 0832 */ void p_format_SGML (void); +/* 0833 */ void p_format_ASCII (void); +/* 0834 */ int ned_eval_string (char *str, int option); +/* 0835 */ void ned_eval_str (void); +/* 0836 */ int ned_eval_hlink (char *str, int option); +#ifdef __NOT_LONGER_USED__ +/* 0837 */ int get_attr_value (char *src, char *dst, int dst_lng, + int flags); +#endif +/* 0838 */ char *ned_line_2_string (struct LINE *la, int la_idx, + struct LINE *lz, int lz_idz, char *dst, int dst_siz, + long offset, int flags); +/* 0838a */ long ned_line_list_size (struct LINE *la, int la_idx, + struct LINE *lz, int lz_idx, int flags); +/* 0839 */ int ned_eval_line (struct LINE *la, int la_idx, + struct LINE *lz, int lz_idx, int option); + int ned_eval_lookup_feature (const char *token, int option); + int ned_eval_tag_entry (const char *token); +/* 0840 */ void ned_eval_block (void); +/* 0841 */ void ned_eval_feature (void); +/* 0841b */ int q_eval_tag (void); +/* 0842 */ struct FEATURE **ned_feature_find3 (int range); +/* 0842b */ struct FEATURE **ned_feature_find (struct LINE *lp, int x, + int range); +/* 0842c */ struct FEATURE **ned_feature_find2 (struct WINDOWCTRL *wc, + int range); +/* 0843 */ int eval_ned_macro (char *str, int option); +/* 0844 */ struct CLUSTERCTRL *ned_get_cluster_list (void); + struct CLUSTERCTRL *ned_activate_cluster (const char *fn); +/* 0844b */ int ned_free_clusterctrl (struct CLUSTERCTRL *cl); +/* 0845 */ struct FRAMECTRL *ned_activate_frame (struct CLUSTERCTRL *cl, + const char *fr_name, struct WINDOWCTRL *w, int search_mode, + int file_fmt, const char *template_frame, + const char *alternative_frame); +/* 0845a */ int ned_deactivate_frame (struct FRAMECTRL *fr); +/* 0846 */ struct FRAMECTRL *find_frame (struct CLUSTERCTRL *cl, + const char *fr_name, int search_mode); +/* 0847 */ struct FRAMECTRL *create_framectrl (struct CLUSTERCTRL *cl, + const char *fr_name, long idx, int where); +/* 0848 */ int get_index (struct FRAMECTRL *fr); +/* 0849 */ int update_index (struct CLUSTERCTRL *cl, + long idx, long off_beg, long off_end, long cl_nr); +/* 0850 */ struct FEATURE *q_feature_set (struct LINE *lp, int cpos, + int feature_type, int t_cnt, const char *ftxt[]); +/* 0850b */ struct FEATURE *ned_new_feature (int cpos, int feature_type); +/* 0851 */ int eval_window_parameters (struct WINDOWCTRL *w, char *str); +#ifdef __NOT_LONGER_USED__ +/* 0852 */ char *find_attr_name (char *str, char *name); +#endif +/* 0853 */ int eval_logic_link (struct WINDOWCTRL *w, char *direction); +/* 0854a */ void p_logic_link_next (void); +/* 0854b */ void p_logic_link_prev (void); +/* 0854c */ void p_logic_link_menu (void); +/* 0854d */ void p_logic_link_up (void); +/* 0854e */ void p_logic_link_lang (void); +/* 0854f */ void p_logic_link_sort (void); +/* 0854g */ void p_logic_link_view (void); +/* 0854h */ void p_logic_link (void); +/* 0856 */ int ned_lookup_current_feature (char *token, + char *line_buffer, char **feature_string, char **feature_type, + int MAX_TOKEN, int MAX_BUFFER); +/* 0857 */ int ned_lookup_feature (const char *token, char *line_buffer, + char **feature_string, char **feature_type, int MAX_BUFFER); +/* 0857b */ int ned_lookup_tag (const char *token, char *line_buffer, + char **field_fnm, char **field_location, int MAX_BUFFER); +/* 0857c */ int ned_lookup_feature_cache (const char *token, + char **feature_string, char **feature_type); + int ned_store_feature_cache (const char *token, + const char *feature_string, const char *feature_type); +/* 0858 */ int ned_rename_frame (struct WINDOWCTRL *w, const char *fnm, + int file_fmt); +/* 0858b */ int ned_cb_rename_frame (char *str, int size, + int malloced, void *cb_data); +/* 0859 */ int eval_ned_parameter (char *str, int option); +/* 0860 */ int check_logic_links (struct WINDOWCTRL *w); +/* 0861 */ void ned_set_SGML_tag (void); +/* 0862 */ void ned_set_SGML_entity (void); +/* 0863 */ int ned_wc_feature_create (struct WINDOWCTRL *wc, int what, + int ftr_edit_mode, char *attribute); +/* 0863b */ int ned_wc_simple_feature_create (struct WINDOWCTRL *wc, + struct LINE *lp, int idx, int what, char *str); +/* 0864 */ int initialize_frame (struct WINDOWCTRL *w, const char *fr_name); +/* 0865 */ void ned_set_hyx_l (void); +/* 0866 */ int show_feature (struct FEATURE *fp); +/* 0867 */ void ned_wc_memorize_location (struct WINDOWCTRL *wc); + void ned_forget_location (void); +/* 0867b */ void ned_memorize_location (void); +/* 0868 */ void p_logic_link_more (void); +/* 0868 */ void p_link_more (void); +/* 0869 */ struct FRAMECTRL *ned_activate_special (const char *cl_name, + const char *fr_name, int cr_mode); + int ned_set_create_special (int flg); +/* 0869b */ struct FRAMECTRL *ned_activate_cl_fr (const char *cl_name, + const char *fr_name, int search_mode, int format, + const char *template_frame, const char *alternative_frame); +/* 0870 */ void p_activate_cl0 (void); + void p_activate_cl1 (void); + void p_activate_cl2 (void); + void p_activate_cl3 (void); + void p_activate_cl4 (void); + void pico_help (void); + int ned_activate_note_cluster (char *buffer); + int ned_find_note_cluster (const char *sym_cluster, const char *frame, + int create_mode, int memorize); + int ned_define_note_cluster (const char *symbolic, const char *cluster, + int create_mode, int memorize); + int ned_init_sym_bookmarks (void); +/* 0871 */ void p_activate_crf (void); +/* 0872 */ +/* 0873 */ int ned_register_bookmark (char *symbolic_name, + char *title, char *section, char *tag_string); + int ned_load_bookmarks (char *filename, char *section); + int ned_save_bookmarks (char *filename, char *section); + int ned_symbolic_bookmark (char *name, int option); +/* 0874 */ +/* 0875 */ void p_activate_fr_root (void); +/* 0876 */ void p_activate_fr_notes (void); +/* 0877 */ void p_activate_fr_help (void); +/* 0878 */ void ned_p_activate_cl_fr (void); + int ned_set_create_special (int flg); +/* 0879 */ void p_cross_ref (void); +/* 0879i */ void ned_lookup_lib (void); +/* 0879l */ void ned_lookup_lexicon (void); +/* 0879t */ void ned_lookup_thesaurus (void); +/* 0880 */ void ned_activate_cross_ref (char *str, int flg_resize, + int cluster_type, int local_or_global); +#define CRF_IN_CRF 0x01 +#define CRF_IN_LIB 0x02 +#define CRF_IN_LEX 0x04 +#define CRF_IN_THES 0x08 +#define CRF_EVERYWHERE 0x0F +#define CRF_LOCAL 0x01 +#define CRF_GLOBAL 0x02 +#define CRF_GLOBAL_AND_LOCAL 0x03 + +/* 0881 */ void p_2cross_ref (char *str, int MAX_STR); /* NOT USED */ +/* 0882 */ int ned_cross_ref (const char *target, int prompt, int ty, + int loc, int lower); + int ned_cb_cross_ref (char *edited_string, + int size, int malloced, void *callback_data); +/* 0883 */ struct CLUSTERCTRL *activate_remote_cluster (char *clus, + char *server, long port); +/* 0884 */ void ned_set_mark (void); +/* 0885 */ void ned_set_lookup_tag (void); +/* 0885b */ void ned_set_lookup_tag_fr (void); +/* 0886 */ struct FEATURE *ned_feature_set (struct WINDOWCTRL *w, + struct LINE *lp, int offset, int what, + int ftr_segment_cnt, const char *ftr_segment []); + struct FEATURE *ned_feature_set2 (struct WINDOWCTRL *w, + int line, int offset, int what, + int ftr_segment_cnt, const char *ftr_segment []); +/* 0887 */ void ned_ftr_shift_up (void); + void ned_ftr_shift_down (void); + +/* 09.. ------------------------------------------------------------------- */ +/* 0901 */ void def_setupfnm (char *s); +/* 0902 */ void p_edsetup (void); +/* 0903 */ int ned_read_setup (char *fnm); + int ned_what_stp_cmd (char *s); + +/* 0905 */ int stp_whatprim (char *s); +#ifdef _FILE_DEFINED +/* 0906 */ void stp_rtbl (FILE *fi, int tn, int f); +/* 0907 */ void stp_func (FILE *fi, int tn, int f); +/* 0908 */ void stp_macro (FILE *fi, char *token, int max_token, + int mac_type); +/* 0909 */ void stp_window (FILE *fi); +/* 0910 */ int stp_maus (FILE *fi); +#endif +/* 0911 */ int trans_str (const char *si, char *so, int size); +/* 0912 */ int p_rdsetup (void); +/* 0913 */ int kbin_jou (void); +/* 0914 */ int jou_in (void); +/* 0915 */ int p_open_jou_rd (void); +/* 0916 */ void p_open_jou_wr (void); +/* 0917 */ void p_close_jou (void); +/* 0918 */ int mac_expand (void); +/* 0919 */ void p_macro (int num); + void ned_q_macro (struct NED_MACRO *mp); +/* 0921 */ /* void p_macro00 (); */ +/* 0922 */ int ned_tcl_startup (char *rc_names [], char *tcl_glib); + int ned_tcl_run_file (char *rc_name); + int ned_paste_tcl (char *tcl_script); + int ned_tcl_stop (void); +/* */ int mac_call_tcl (char *tcl_script); + int ned_tk_import_selection (void); + int ned_tk_wc_window_action (struct WINDOWCTRL *wc, int what); +#define WC_action_deiconify 1 +#define WC_action_iconify 2 +#define WC_action_withdraw 3 +/* 0923 .. int ned_tcl_register (Tcl_Interp *interp) */ +/* 0933 */ int ned_tk_redraw_window2 (struct WINDOWCTRL *w); + int ned_tk_associate_window (struct WINDOWCTRL *wc); + int ned_tk_delete_association (struct WINDOWCTRL *wc); + int ned_tk_set_window_name (struct WINDOWCTRL *wc, char *name); +/* 0934 */ int ned_tk_block_export_flag (int flag); +/* .... .. .... ..... ......... ....... */ +/* 0972 */ void p_mac_define (void); +/* 0973 */ int mac_clr (void); +/* 0974 */ int mac_undef (int num); +/* 0975 */ int mac_define (int num, int macro_type, const char *str, int lng); +/* 0976 */ int ned_submit_macro (const char *s); +/* 0977 */ int mac_parse (char *tokens, int mac_type); +/* 0978 */ int mac_definition (char *tok_num, const char *tok_text, + int mac_type); +/* 0979 */ void p_mac (void); + int mac_bind (int n_ptbl_offset, int num); + int mac_unbind (int n_ptbl_offset); +#ifdef _FILE_DEFINED +/* 0980 */ void p_dump_macro (void); +/* 0981 */ int stp_attr (FILE *fi, char *b, int max_b); +#endif + +/* 10.. ------------------------------------------------------------------- */ +/* 1001 */ int ned_check_mouse (void); +/* 1002 */ void look1_for_maus (void); +/* 1003 */ void look2_for_maus (void); +/* 1004 */ void maus_wdw (int where); +/* 1004 */ void p_menue (void); +/* 1006 */ void maus_menue (int mode); +/* 1007 */ int q_window_menu (void); +/* 1008 */ void p_window_menu (void); +/* 1009 */ void show_buttons (struct WINDOWCTRL *wc); +/* 1010 */ int test_maus (int left, int right, int left_right); +/* 1011 */ int rst_button (void); +#ifdef _FILE_DEFINED +/* 1012 */ int stp_button (FILE *fi, char *str, int max_str); +#endif +/* 1013 */ int def_button (int bdx, int bdy, int bdc, int bdt, + int bdm, int bdi, char *bdtext); +/* 1014 */ struct BUTTON_DESCRIPTOR *locate_button (int bdx, int bdy); +/* 1015 */ int execute_mm_item (long fc); +#ifdef _FILE_DEFINED +/* 1016 */ int stp_mm_item (FILE *fi, char *str, int max_str); +#endif +/* 1017 */ int ned_mouse_set_cursor (int x, int t); +/* 1018 */ int ned_mouse_event (int x, int y, int t, int abs_x, + int abs_y); +/* 1019 */ int ned_search_button_bar (int x, int y, int t); + +/* 11/ -------------------------------------------------------------------- */ +/* 1101 */ void p_fr_next (void); +/* 1102 */ void p_find (void); + void vi_find_forward (void); + void vi_find_backward (void); + void pico_find (void); +/* 1103 */ void p_replace (void); +/* 1104 */ void ned_ws_find_replace_dialog (struct WINDOWCTRL *wc, int fr); + char *ned_prompt_find (char *prompt); + int ned_save_search_string (char *s); + int ned_save_search_options (int opt); +/* 1105 */ int ned_str_match (struct LINE *z_start, int c_start, + struct LINE *z_end, unsigned char *mtch, unsigned char *ignore, + int matching_ignore_level, + struct LINE **z_fnd, int *c_fnd, int *ml, int option); +/* 1106 */ int ned_is_bracket (int chx); +/* 1106 */ int ned_find_bracket (int mode); +/* 1107 */ void p_find_matching_bracket (void); +/* 1108 */ void p_find_higher_bracket (void); +/* 1109 */ void p_find_lower_bracket (void); +/* 1110 */ int ned_wc_find_replace (struct WINDOWCTRL *wc, + struct LINE *z_start, int c_start, struct LINE *z_end, int c_end, + int blck_mode, int option, int find_replace, char *find_str, + char *repl_str, int repeat_within_line, int repeat_counter, + struct MARKER *m_fnd); +/* 1111 */ int ned_all_lines (struct WINDOWCTRL *w, int use_matching_lines, + int str_cnt,char *mstr[]); +/* 1112 */ int ned_lp_find_str (struct WINDOWCTRL *wc, struct LINE *lp, + char *mstr, int option, int cnt, int skip); +/* 1112v */ int ned_vi_wc_find_str (struct WINDOWCTRL *wc, char *mstr, + int cnt, int mode); + void ned_vi_find_next (void); + void ned_vi_find_next_rev (void); +/* 1112w */ void ned_ws_aw_find_str (void); +/* 1113 */ int ned_jmp_pattern (struct WINDOWCTRL *wc, struct LINE *lp, + char *pattern, int options); + int ned_jmp_complex (struct WINDOWCTRL *wc, int jmp_line, + char *jmp_pattern); + int vi_find (struct WINDOWCTRL *wc, int back); + void ned_set_ic (int mode); + void ned_set_wrapscan (int mode); + +/* 13/ -------------------------------------------------------------------- */ +/* 1301 */ int ned_text_to_sgml (char *fnm_txt, char *fnm_ftr, + char *fnm_sgml, int f_append); +/* 1302 */ int ned_sgml_to_text (char *fnm_txt, char *fnm_ftr, + char *fnm_sgml); + +#endif /* __NED_proto__ */ diff --git a/app/ned/readme.txt b/app/ned/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..a87fda7df8745e63e2527f7019f45b32de613286 --- /dev/null +++ b/app/ned/readme.txt @@ -0,0 +1,31 @@ +# +# FILE %ned/Readme.txt +# +# written: 1995-11-12 +# latest update: 1999-04-10 18:21:16 +# $Id: readme.txt,v 1.3 2000/08/24 15:10:10 gonter Exp $ +# + +This is the source for Ned, a SGML-ish hypertext editor with a default +key binding as a mixture of WordStar(tm) and vi. + +These files currently need to be edited to adopted for a Unix compilation +run, e.g. with TK or Curses: + +Everything is set up for the Tk version. + + -------------------------------------------------------------------------- + filename Tags + -------------------------------------------------------------------------- + ed.h #define USE_TK + Makefile select curses, ncurses, tcl, tk libs + make-sbr select W_MODEL_{CURSES,NCURSES,TK} + 09/Makefile select objects + unix/Makefile select objects + -------------------------------------------------------------------------- + +If this is going to be compiled on HP/UX, set the environment variable +CCOPTS to -Ae. + +For more information, see also (dirinf).fm, NED hypertext information, +and the documentation cluster. diff --git a/app/ned/release.txt b/app/ned/release.txt new file mode 100644 index 0000000000000000000000000000000000000000..528f2d15a443596627552729cd79418a9c40874e --- /dev/null +++ b/app/ned/release.txt @@ -0,0 +1,17 @@ +# +# FILE %ned/release.txt +# +# written: 2000-12-09 +# latest update: 2000-12-09 13:38:29 +# $Id: release.txt,v 1.1 2000/12/09 17:34:13 gonter Exp $ +# + +ned 3.20.04 #D$2000-12-09 13:39:45 + +debugging version: ++ track down inconsistent window decorations ++ virtual filename debugging: DEBUG flag turned on + +ned 3.20.03 #D$2000-08-30 20:59:32 + +debugging or possibly released version diff --git a/app/ned/sgmlflt.c b/app/ned/sgmlflt.c new file mode 100644 index 0000000000000000000000000000000000000000..5e5c48320b32a196ca5cedf878894ea10b459ecf --- /dev/null +++ b/app/ned/sgmlflt.c @@ -0,0 +1,305 @@ +/* + * FILE %ned/sgmlflt.c + * + * template, standard command interpreter style + * - HELP + * - prototypes + * + * written: 1997-08-03 + * latest update: 1997-08-04 12:47:51 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/filename.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include "ed.h" +#include "proto.h" + +#define STDHLP stdout + +static char *NED_VERSION= "sgmlflt 0.00"; /* included by sbr */ + +/* ------------------------------------------------------------------------ */ +struct X_CONV +{ + int replace; + int verbose; + + char *buffer; + int buffer_size; +} ; + +/* ------------------------------------------------------------------------ */ +#define GPL +static char *HELP []= +{ + "USAGE: sgmlflt [options] {file name}\n", + "OPTIONS:\n", + " -t2s ... text to sgml\n", + " -s2t ... sgml to text\n", + " -batch ... arguments are names of batch files\n", + " -o ... overwrite original file\n", + " -f<fnm> ... list of files\n", + " -r ... subdirs\n", + " -v ... verbose mode\n", + "EXAMPLES:\n", + "\n", + "Batchfile format\n", + " text_to_sgml fnm-text fnm-sgml [fnm-ftr]\n", + " sgml_to_text fnm-sgml fnm-text [fnm-ftr]\n", + "NOTE: The name of the feature file is optional and will be\n", + " derived from the name of the text file if left unspecified.\n", + "\n", + "(@)Asgmlflt.c 0.00 #D$1997-08-03 16:47:30\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl ned_tool_text_to_sgml (char *fnm, void *cd); +int cdecl ned_tool_sgml_to_text (char *fnm, void *cd); +int cdecl ned_tool_batch_sgml_conv (char *fnm, void *cd); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + char *arg; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; +#define OP_undef 0 +#define OP_text_to_sgml 1 +#define OP_sgml_to_text 2 +#define OP_batch 3 + int op_mode= OP_undef; + struct X_CONV *x_conv; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + || (x_conv= (struct X_CONV *) calloc (sizeof (struct X_CONV), 1)) + == (struct X_CONV *) 0 + ) return 1; + + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + + case 't': + if (strcmp (arg, "-t2s") == 0) op_mode= OP_text_to_sgml; + break; + + case 's': + if (strcmp (arg, "-s2t") == 0) op_mode= OP_sgml_to_text; + break; + + case 'b': + if (strcmp (arg, "-batch") == 0) op_mode= OP_batch; + break; + + case 'o': case 'O': + case 'r': case 'R': + case 'v': case 'V': + for (j= 1; arg [j]; j++) + switch (arg [j]) + { + case 'r': case 'R': + wcrd2_set_subdirs (wcrd, 1); + break; + case 'v': case 'V': + x_conv->verbose++; + break; + case 'o': case 'O': + x_conv->replace= 1; + break; + default: + fprintf (stderr, "unknown option %c\n", arg[j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + + switch (op_mode) + { + case OP_text_to_sgml: + wcrd2_set_processor (wcrd, WCRD_set_file_processor, + ned_tool_text_to_sgml, (void *) x_conv); + break; + + case OP_sgml_to_text: + wcrd2_set_processor (wcrd, WCRD_set_file_processor, + ned_tool_sgml_to_text, (void *) x_conv); + break; + + case OP_batch: + wcrd2_set_processor (wcrd, WCRD_set_file_processor, + ned_tool_batch_sgml_conv, (void *) x_conv); + break; + + default: + fprintf (stderr, "undefined operation mode!\n"); + goto HLP; + } + + wcrd2_arguments (wcrd, arguments); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_tool_text_to_sgml (char *fnm, void *cd) +{ + char *ftr_name; + char *sgml_name= (char *) 0; + char *out_name; + struct X_CONV *x_conv; + + if ((x_conv= (struct X_CONV *) cd) == (struct X_CONV *) 0) return -1; + + ftr_name= fnmcpy2 (fnm, ".ftr"); + + if (x_conv->replace) + out_name= fnm; + else + out_name= sgml_name= fnmcpy2 (fnm, ".sgml"); + + ned_text_to_sgml (fnm, ftr_name, out_name, 0); + + free_or_what (ftr_name); + free_or_what (sgml_name); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_tool_sgml_to_text (char *fnm, void *cd) +{ + char *ftr_name; + char *txt_name= (char *) 0; + char *out_name; + struct X_CONV *x_conv; + + if ((x_conv= (struct X_CONV *) cd) == (struct X_CONV *) 0) return -1; + + ftr_name= fnmcpy2 (fnm, ".ftr"); + + if (x_conv->replace) + out_name= fnm; + else + out_name= txt_name= fnmcpy2 (fnm, ".txt"); + + ned_sgml_to_text (out_name, ftr_name, fnm); + + free_or_what (ftr_name); + free_or_what (txt_name); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ned_tool_batch_sgml_conv (char *fnm, void *cd) +{ +#define X_B_SIZE 1024 + struct X_CONV *x_conv; + int b_size; + char *buffer; + int rc; +#define MAX_FIELDS 10 + char *fields [MAX_FIELDS]; + int num_fields; + char *sub_command; + FILE *fi; + + if ((x_conv= (struct X_CONV *) cd) == (struct X_CONV *) 0) return -1; + + if ((buffer= x_conv->buffer) == (char *) 0) + { + if ((x_conv->buffer= buffer= malloc (X_B_SIZE)) == (char *) 0) return -1; + x_conv->buffer_size= b_size= X_B_SIZE; + } + else + { + b_size= x_conv->buffer_size; + } + + if ((fi= fopen (fnm, "rb")) == (FILE *) 0) return -1; + + for (;;) + { + rc= fread_line (fi, buffer, b_size); + if (rc <= 0 && feof (fi)) break; + + if (buffer [0] == '#') continue; + num_fields= isolate_tokens (buffer, fields, MAX_FIELDS); + if (num_fields <= 0) continue; + + sub_command= fields [0]; + if (sub_command [0] == '#') continue; + + if ((strcmp (sub_command, "t2s") == 0 + || strcmp (sub_command, "text_to_sgml") == 0 + || strcmp (sub_command, "text2sgml") == 0 + ) + && num_fields >= 3 + ) + { /* Format: text_to_sgml fnm-text fnm-sgml [fnm-ftr] */ + char *ftr_name; + + ftr_name= (num_fields > 3) + ? strdup (fields [3]) + : fnmcpy2 (fields [1], ".ftr"); + + ned_text_to_sgml (fields [1], ftr_name, fields [2], 0); + free_or_what (ftr_name); + } + else + if ((strcmp (sub_command, "s2t") == 0 + || strcmp (sub_command, "sgml_to_text") == 0 + || strcmp (sub_command, "sgml2text") == 0 + ) + && num_fields >= 3 + ) + { /* Format: sgml_to_text fnm-sgml fnm-text [fnm-ftr] */ + char *ftr_name; + + ftr_name= (num_fields > 3) + ? strdup (fields [3]) + : fnmcpy2 (fields [1], ".ftr"); + + ned_sgml_to_text (fields [2], fields [1], fnm); + free_or_what (ftr_name); + } + else + { + printf ("unknown batch command '%s'\n", sub_command); + } + } + + fclose (fi); + + return 0; +} diff --git a/app/ned/unix/(dirinf).fm b/app/ned/unix/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..c7d9aaeda8b88575d9f9b95d528f993aa0ab5844 --- /dev/null +++ b/app/ned/unix/(dirinf).fm @@ -0,0 +1,18 @@ +# +# FILE %ned/unix/(dirinf).fm +# +# written: 1995-11-11 +# latest update: 2000-08-24 12:54:39 +# $Id: (dirinf).fm,v 1.2 2000/08/24 15:10:24 gonter Exp $ +# +# ---------------------------------------------------------------------------- +Makefile | unix makefile + +keyboard.c | keyboard emulation +harness.c | dummy functions +unix2.c | curses stuff +nedelm.c | curses stuff +uxwindat.c | Window Data +tk2.c | TK specific screen output +tk2_scr.c | TK specific, scrolling + diff --git a/app/ned/unix/Makefile b/app/ned/unix/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..baad59a5c4ef223f50db2a19f76038fcb0a323a1 --- /dev/null +++ b/app/ned/unix/Makefile @@ -0,0 +1,53 @@ +# +# FILE %ned/unix/make-ux (Makefile) +# +# GG's Night(mare) Editor System +# translate a couple of library functions +# +# written: 1993-06-28 +# latest update: 2000-08-24 12:55:36 +# $Id: Makefile,v 1.10 2012/08/10 14:44:20 gonter Exp $ +# +# ============================================================================ +# cf=-O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +PFX= /usr/local/include/ +# TCL_VER=8.0 +# TCL_VER=8.3 +# TCL_VER=8.4 +# OPTS2=-I/usr/X11R6/include -I$(PFX)tcl$(TCL_VER) -I${PFX}tk$(TCL_VER) +OPTS2=-I/usr/X11R6/include -I/usr/include/tcl +CC=cc -c -g -I.. $(OPTS) $(OPTS2) $(cf) #-I/usr/include/ncurses + +src= uxwindat.c nedelm.c harness.c +objs= uxwindat.o harness.o +objs_cur= unix2.o keyboard_cur.o nedelm_cur.o +objs_tk= tk2.o tk2_scr.o keyboard_tk.o + +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_cur lib_tk +clean : + rm -f *.o lib_cur lib_tk + +.c.o: + $(CC) $*.c + +lib_tk : $(objs_tk) $(objs) + ar ru $(lib_tk) $? + touch lib_tk + +lib_cur : $(objs_cur) $(objs) + ar ru $(lib_cur) $? + touch lib_cur + +# --- cur Modules ---------- +keyboard_cur.o : ../ed.h keyboard.c + $(CC) $(OPTS) -o keyboard_cur.o keyboard.c + +nedelm_cur.o : ../ed.h nedelm.c + $(CC) $(OPTS) -o nedelm_cur.o nedelm.c + +# --- tk Modules ---------- +keyboard_tk.o : ../ed.h keyboard.c + $(CC) $(OPTS) -DUSE_TK -o keyboard_tk.o keyboard.c diff --git a/app/ned/unix/contrib b/app/ned/unix/contrib new file mode 120000 index 0000000000000000000000000000000000000000..9c018e7d03b81570e6e7b6217149fa40b265d808 --- /dev/null +++ b/app/ned/unix/contrib @@ -0,0 +1 @@ +../../../lib/include/contrib \ No newline at end of file diff --git a/app/ned/unix/gg b/app/ned/unix/gg new file mode 120000 index 0000000000000000000000000000000000000000..73cd63af6f91f38491c22361ffb1b428e30d279c --- /dev/null +++ b/app/ned/unix/gg @@ -0,0 +1 @@ +../../../lib/include/gg \ No newline at end of file diff --git a/app/ned/unix/harness.c b/app/ned/unix/harness.c new file mode 100644 index 0000000000000000000000000000000000000000..5b608e805f2d64dce951a166aeead2e679b62f47 --- /dev/null +++ b/app/ned/unix/harness.c @@ -0,0 +1,30 @@ +/* + * FILE %ned/unix/harness.c + * + * hack out unresolved symbols for testing purposes + * + * written: 1992-12-02 + * latest update: 1997-06-13 13:44:51 + * + */ + +/* GG's window library */ +int w_init_mode () { return 0; } +void w_selpage () {} +int w_blit_save () { return 0; } +int w_blit_load () { return 0; } +void w_cursoron () {} +int w_set_screen_mode () { return 0; } +int w_get_mode () { return 0; } + +/* mouse stuff */ +#ifdef NOT_USED +maus_enable () {} +maus_disable () {} +maus_position () {} +mmcga_maus_menu () {} +#endif +int mm_install_function () { return 0; } + +/* NEU: */ +void w_cursorsize () {} diff --git a/app/ned/unix/keyboard.c b/app/ned/unix/keyboard.c new file mode 100644 index 0000000000000000000000000000000000000000..2ce7be83217bf9b771fc6d441c359875fbbc92c5 --- /dev/null +++ b/app/ned/unix/keyboard.c @@ -0,0 +1,199 @@ +/* + * File %ned/unix/keyboard.c + * + * adaption of keyboard routines for Unix + * + * written: 1993-06-29 + * latest update: 2001-04-01 23:41:39 + * $Id: keyboard.c,v 1.3 2005/09/04 18:36:07 gonter Exp $ + * + */ + +/*** #define DEBUG_SHOW_KEYS ***/ + +#include "ed.h" +#include "proto.h" + +#ifdef W_MODEL_CURSES +#ifdef W_MODEL_NCURSES +#include <ncurses.h> +#else +#include <curses.h> +#endif /* W_MODEL_NCURSES */ +static int saved_key= ERR; +#endif /* W_MODEL_CURSES */ + +#ifdef USE_TK +#include <tk.h> +#include <X11/Xutil.h> +#include <X11/keysym.h> +#include "edtcl.h" +#endif /* USE_TK */ + +static int key; +extern int MPflag; +extern struct WINDOWCTRL *aw; +extern ned_primitive_function *special_event; + +/* ------------------------------------------------------------------------ */ +int kbtype () +{ + return 0; +} +void kbin_set_AT () { } +void kbhit_set_AT () { } + +/* ------------------------------------------------------------------------ */ +int kbin () +{ +#ifndef USE_TK + int rc; +#endif /* !USE_TK */ + + setcup (aw); +#ifdef USE_TK + for (key= 0; key == 0; ) + { + Tk_DoOneEvent (0); + if (MPflag) return -1; /* @@ 1996-11-03 12:59:21 */ + + /* see %ned/10/ned1019.c ned_search_button_bar () */ + if (special_event != (ned_primitive_function *) 0) + { + (*special_event) (); + special_event= (ned_primitive_function *) 0; + } + } + return key; +#else + if (saved_key != ERR) + { + rc= saved_key; + saved_key= ERR; + } + else while ((rc= getch ()) == ERR); + + return rc; +#endif /* !USE_TK */ +} + +/* ------------------------------------------------------------------------ */ +int kbhit () +{ +#ifndef USE_TK + setcup (aw); + if (saved_key != ERR) return 1; + if ((saved_key= getch ()) != ERR) return 1; +#endif /* !USE_TK */ + + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef USE_TK +void NED_tk_key_pressed (ClientData clientData, XEvent *eventPtr) +{ + XKeyEvent *ke; + KeySym keysym; + XComposeStatus compose; + char buffer [80]; + char buffer2 [80]; + int tl; + int shift_state; + + key= 0; + + if (eventPtr == (XEvent *) 0 + || eventPtr->type != KeyPress + || (ke= (XKeyEvent *) eventPtr) == (XKeyEvent *) 0 + ) + return; + + tl= XLookupString (ke, buffer, 60, &keysym, &compose); + buffer [tl]= 0; + shift_state= ke->state; + +#ifdef DEBUG_SHOW_KEYS +printf ("shift_state=0x%04X keysym=0x%04X\n", shift_state, keysym); ***/ +#endif + + if ((keysym & 0xFF00) == 0xFF00) /* function keys */ + { + key= keysym & 0x00FF; + + if (key >= 0xE1 && key <= 0xEF) + { /* EMACS-Keys */ + key= 0; + return; + goto DONE; + } + + if (shift_state & 0x0003) /* Shift or Caps-Lock */ + { + if (key == 0x0008) {} else + if (key == 0x0009) key= 0x0001; else + if (key >= 0x00BE && key <= 0x00C9) key= key + 0x000C; else + key= 0x0000; + } + else + if (shift_state & 0x0004) /* CTRL */ + { + if (key == 0x0008) {} else + if (key == 0x0009) key= 0x0002; else + if (key == 0x00C9) key= key + 0x0016; else + if (key >= 0x00BE && key <= 0x00C8) key= key + 0x0018; else + if (key >= 0x0050 && key <= 0x0057) key= key + 0x0048; else + key= 0x0000; + } + else + if (shift_state & 0x0018) /* Left-ALT or Right-ALT */ + { + if (key == 0x0008) {} else + if (key == 0x0009) key= 0x0003; else + if (key >= 0x00BE && key <= 0x00C9) key= key + 0x0032; else + if (key >= 0x0050 && key <= 0x0057) key= key + 0x0051; else + /* numeric keypad: 0xAA='*'; 0xAF='/'; 0xB0..0xB9=numbers */ + if (key >= 0x00AA && key <= 0x00B9) key= key + 0x0100; else + key= 0x0000; + } + else /* no shift key or anything else */ + { + /* numeric keypad: 0xAA='*'; 0xAF='/'; 0xB0..0xB9=numbers */ + if (key >= 0x00AA && key <= 0x00B9) { key= key - 0x80; goto DONE; } + } + + if (key != 0x000D && key != 0x0008 && key != 0x001B) + key |= 0x0100; + } + else + { + key= keysym; + + if (shift_state & 0x0004) /* CTRL */ + { + if (key >= 'a' && key <= 'z') key= key - 0x60; else + if (key >= 'A' && key <= '^') key= key - 0x40; + } + + if (shift_state & 0x0018) /* Left-ALT or Right-ALT */ + { + if (key >= 0x20 && key <= 0x2F) key= key + 0x014E; else + if (key >= 0x3A && key <= 0x40) key= key + 0x011F; else + if (key >= 0x30 && key <= 0x5F) key= key - 0x10 + 0x0100; else + if (key == 0x60) key= 0x0112; else + if (key >= 0x7B && key <= 0x7E) key= key + 0x009A; else + if (key >= 'a' && key <= 'z') key= key - 0x30 + 0x0100; else + key= 0; + } + } + +DONE: + if (key == 0) + { + sprintf (buffer2, + "tl=%d keysym=0x%04uX shift_state=0x%04X keyval=0x%04X '", + tl, keysym, shift_state, key); + ned_message_3 (buffer2, buffer, "'"); + } +} +#endif /* USE_TK */ diff --git a/app/ned/unix/lib_cur b/app/ned/unix/lib_cur new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/unix/lib_tk b/app/ned/unix/lib_tk new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/ned/unix/nedelm.c b/app/ned/unix/nedelm.c new file mode 100644 index 0000000000000000000000000000000000000000..684eaf59a58f18c54f15da1df1f997cc3221f000 --- /dev/null +++ b/app/ned/unix/nedelm.c @@ -0,0 +1,111 @@ +/* + * FILE %ned/unix/nedelm.c + * + * hack out unresolved symbols for testing purposes + * try to do it with elm routines + * + * written: 1994-12-24 + * latest update: 1996-08-08 20:10:28 + * + */ + +/* GG's window library */ +#include <stdio.h> +#include "ed.h" + +#ifdef W_MODEL_NCURSES +#include <ncurses.h> +#else +#include <curses.h> +#endif /* W_MODEL_NCURSES */ + +/* ------------------------------------------------------------------------ */ +extern int W_TEXT_MAX_X; +extern int W_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +extern WINDOW *stdscr; +extern WINDOW *curscr; +void curses_cls_col (int col) +{ + clearok (curscr,TRUE); +} + +/* ------------------------------------------------------------------------ */ +void curses_init (int mode) +{ + initscr (); + W_TEXT_MAX_X= COLS; + W_TEXT_MAX_Y= LINES; + leaveok (stdscr, FALSE); + scrollok (stdscr, FALSE); +#ifdef W_MODEL_NCURSES + meta (stdscr, TRUE); + keypad (stdscr, TRUE); + keypad (stdscr, TRUE); + notimeout (stdscr, FALSE); + timeout (1); +#endif + erase (); + /* wborder (stdscr, 0,0,0,0,0,0,0,0); */ + raw (); + noecho (); +#ifdef W_MODEL_NCURSES + start_color (); + init_attribs (); +#endif + refresh (); +} + +/* ------------------------------------------------------------------------ */ +/* window change signal received */ +void curses_sig_winch (void) +{ +#ifdef W_MODEL_NCURSES + _nc_update_screensize (); /* T2D: this is an ncurses internal function */ +#endif /* W_MODEL_NCURSES */ + W_TEXT_MAX_X= COLS; + W_TEXT_MAX_Y= LINES; +} + +/* ------------------------------------------------------------------------ */ +#ifdef W_MODEL_NCURSES +unsigned long ncurses_colors [8]= +{ + COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, + COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE +} ; + +unsigned long ATTRIBS [256]; + +/* ------------------------------------------------------------------------ */ +int init_attribs () +{ + int background; + int foreground; + int blink; + int bold; + int anum; + int pair; + + for (blink= 0; blink<2; blink++) + for (background= 0; background < 8; background++) + { + for (bold= 0; bold < 2; bold++) + { + for (foreground= 0; foreground < 8; foreground++) + { + anum= ((blink*8)+background)*16+(bold*8)+foreground; + pair= background*8+foreground; + init_pair (pair, ncurses_colors [foreground], + ncurses_colors [background]); + ATTRIBS [anum]= COLOR_PAIR (pair) + | ((bold == 1) ? A_BOLD : 0) + | ((blink == 1) ? A_BLINK : 0); + } + } + } + + return 0; +} +#endif /* W_MODEL_NCURSES */ diff --git a/app/ned/unix/tk2.c b/app/ned/unix/tk2.c new file mode 100644 index 0000000000000000000000000000000000000000..0d9c7163aaf9fd1559ddfc0b3a678562bd7955b8 --- /dev/null +++ b/app/ned/unix/tk2.c @@ -0,0 +1,190 @@ +/* + * FILE %ned/unix/tk2.c + * + * written: 1995-09-30 + * latest update: 2000-08-24 13:12:39 + * $Id: tk2.c,v 1.3 2007/04/13 10:15:28 gonter Exp $ + * + */ + +#include "ed.h" +#include <tcl.h> +#include <tk.h> +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" +/* see <gg/window.h> */ + +/* @@@ T2D ###: needs NED */ +extern struct WINDOWCTRL *aw; + +/* ------------------------------------------------------------------------ */ +GC ned_tk_get_GC (NED_Widget *nw, int a) +{ + GC x; + int i; + + switch (a) + { + case NED_TK_GC_cursedText: return nw->cursedTextGC; + case NED_TK_GC_StatusLine: return nw->StatusLineGC; + case NED_TK_GC_markedText: return nw->markedTextGC; + case NED_TK_GC_normalText: return nw->normalTextGC; + + default: + for (i= nw->attrib_cnt-1; i >= 0; i--) + { + if (nw->attrib_num [i] == a) return nw->attrib_GC [i]; + } + + if ((x= ned_tk_setup_GC (nw, a)) != (GC) 0) return x; + + return nw->normalTextGC; + } +} + +/* ------------------------------------------------------------------------ */ +int tk_setchar (int p, int x, int y, int a, int c) +{ + NED_Widget *nw; + Tk_Window tkwin; + Drawable da; + GC gc; + char b[2]; + + if (aw == (struct WINDOWCTRL *) 0 + || (nw= (NED_Widget *) aw->wc_widget) == (NED_Widget *) 0 + ) return 0; + + tkwin= nw->tkwin; + gc= ned_tk_get_GC (nw, a); + da= (Drawable) Tk_WindowId (tkwin); + + if (c < 0 || c > 255) c= 0x20; /* otherwise a ÿ character is displayed in X11 */ + b[0]= c; + + XDrawImageString (nw->display, da, gc, + ned_get_x_pos(nw,x), ned_get_y_pos(nw,y), + b, 1); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int tk_setnchar (int p, int x, int y, int a, int c, int cnt) +{ + NED_Widget *nw; + Tk_Window tkwin; + Drawable da; + GC gc; + char b[2]; + + if (aw == (struct WINDOWCTRL *) 0 + || (nw= (NED_Widget *) aw->wc_widget) == (NED_Widget *) 0 + ) return 0; + + tkwin= nw->tkwin; + gc= ned_tk_get_GC (nw, a); + da= (Drawable) Tk_WindowId (tkwin); + + b[0]= c; + + while (cnt-- > 0) + XDrawImageString (nw->display, da, gc, + ned_get_x_pos(nw,x), ned_get_y_pos(nw,y), + b, 1); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int tk_prntcol (int p, int x, int y, int a, char *s) +{ + NED_Widget *nw; + Tk_Window tkwin; + Drawable da; + GC gc; + + if (aw == (struct WINDOWCTRL *) 0 + || (nw= (NED_Widget *) aw->wc_widget) == (NED_Widget *) 0 + ) return 0; + + tkwin= nw->tkwin; + gc= ned_tk_get_GC (nw, a); + da= (Drawable) Tk_WindowId (tkwin); + + XDrawImageString (nw->display, da, gc, + ned_get_x_pos(nw,x), ned_get_y_pos(nw,y), + s, strlen (s)); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int tk_draw_string ( +struct WINDOWCTRL *w, +int what, +int x, int y, char *s) +{ + NED_Widget *nw; + GC gc; + Tk_Window tkwin; + Drawable da; + + if (w == (struct WINDOWCTRL *) 0 + || (nw= (NED_Widget *) w->wc_widget) == (NED_Widget *) 0 + ) return 0; + + tkwin= nw->tkwin; + da= (Drawable) Tk_WindowId (tkwin); + + gc= ned_tk_get_GC (nw, what); + + XDrawImageString (nw->display, da, gc, + ned_get_x_pos(nw,x), ned_get_y_pos(nw,y), + s, strlen (s)); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +static int last_x= -1, last_y= -1, last_c; +int tk_resetcup () +{ + if (last_x != -1 && last_y != -1) + { + /* tk_setchar (p, last_x, last_y, 0, last_c); 1995-10-27 */ + wd_2setup (aw, last_x, last_y, last_x, last_y); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int tk_setcup (int p, int x, int y) +{ + int c; + + c= get_txt (aw->WC_act, aw->cx - aw->ax + aw->hv); + tk_setchar (p, x, y, 0x0100, c); + + last_x= x; + last_y= y; + last_c= c; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int tk_init () { return 0; } +int tk_cls () { return 0; } + +/* ------------------------------------------------------------------------ */ +void tk_bell () +{ + NED_Widget *nw; + + if (aw == (struct WINDOWCTRL *) 0) return; + if ((nw= (NED_Widget *) aw->wc_widget) != (NED_Widget *) 0) + XBell (nw->display, 0); +} diff --git a/app/ned/unix/tk2_scr.c b/app/ned/unix/tk2_scr.c new file mode 100644 index 0000000000000000000000000000000000000000..b70d9e4f3767e6553e75732a991b9487029ebe85 --- /dev/null +++ b/app/ned/unix/tk2_scr.c @@ -0,0 +1,154 @@ +/* + * FILE %ned/unix/tk2_scr.c + * + * written: 1996-07-11 [extracted from tk2.c] + * latest update: 1996-08-08 19:57:25 + * $Id: tk2_scr.c,v 1.3 2005/06/14 02:36:07 gonter Exp $ + * + */ + +#include "ed.h" +#include <tcl.h> +#include <tk.h> +#include "edtcl.h" +#include "edtk.h" +#include "proto.h" +/* see <gg/window.h> */ + +/* @@@ T2D ###: needs NED */ +extern struct WINDOWCTRL *aw; + +/* ----- SCROLLING -------------------------------------------------------- */ +static GC scrollGC; +static int scrollGC_initialized= 0; + +GC get_scrollGC () +{ + XGCValues gcValues; + Tk_Window tkwin; + NED_Widget *nw; + + if (scrollGC_initialized) return scrollGC; + + if (aw == (struct WINDOWCTRL *) 0 + || (nw= (NED_Widget *) aw->wc_widget) == (NED_Widget *) 0 + ) return; + + tkwin= nw->tkwin; + + gcValues.graphics_exposures= True; + scrollGC= Tk_GetGC (tkwin, GCGraphicsExposures, &gcValues); + + return scrollGC; +} + +/* ------------------------------------------------------------------------ */ +int _tk_scrblk (int ax, int ay, int bx, int by, int dir, int cnt) +{ + GC scGC; + NED_Widget *nw; + Tk_Window tkwin; + Drawable da; + Display *dpy; + int x_pos; + int y_pos; + int x_pos2; + int y_pos2; + int width; + int height; + + if ((scGC= get_scrollGC ()) == (GC) 0) return -1; + + if (aw == (struct WINDOWCTRL *) 0 + || (nw= (NED_Widget *) aw->wc_widget) == (NED_Widget *) 0 + ) return -1; + + tkwin= nw->tkwin; + da= (Drawable) Tk_WindowId (tkwin); + dpy= nw->display; + + switch (dir) + { + case 1: /* down */ + x_pos= x_pos2= ax * nw->char_width; + width= (bx - ax + 1) * nw->char_width; + + y_pos= ay * nw->line_height; + y_pos2= (ay + cnt) * nw->line_height; + height= (by - ay - cnt + 1) * nw->line_height; + break; + + case 2: /* up */ + x_pos= x_pos2= ax * nw->char_width; + width= (bx - ax + 1) * nw->char_width; + + y_pos= (ay + cnt) * nw->line_height; + y_pos2= ay * nw->line_height; + height= (by - ay - cnt + 1) * nw->line_height; + break; + + case 3: /* left */ + x_pos= (ax + cnt) * nw->char_width; + x_pos2= ax * nw->char_width; + width= (bx - ax - cnt + 1) * nw->char_width; + + y_pos= ay * nw->line_height; + y_pos2= ay * nw->line_height; + height= (by - ay + 1) * nw->line_height; + break; + + case 4: /* right */ + x_pos= ax * nw->char_width; + x_pos2= (ax + cnt) * nw->char_width; + width= (bx - ax - cnt + 1) * nw->char_width; + + y_pos= ay * nw->line_height; + y_pos2= ay * nw->line_height; + height= (by - ay + 1) * nw->line_height; + break; + + default: return -1; + } + + XCopyArea (dpy, da, da, scGC, + x_pos, y_pos, + width, height, + x_pos2, y_pos2); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int tk_scrblk_down (int ax, int ay, int bx, int by, int attr, int cnt) +{ + if (_tk_scrblk (ax, ay, bx, by, 1, cnt) != 0) p_refresh (); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int tk_scrblk_up (int ax, int ay, int bx, int by, int attr, int cnt) +{ + if (_tk_scrblk (ax, ay, bx, by, 2, cnt) != 0) p_refresh (); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int tk_scrblk_left (int page, int ax, int ay, int bx, int by, int attr, int cnt) +{ + if (_tk_scrblk (ax, ay, bx, by, 3, cnt) != 0) p_refresh (); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int tk_scrblk_right (int page, int ax, int ay, int bx, int by, int attr, int cnt) +{ + if (_tk_scrblk (ax, ay, bx, by, 4, cnt) != 0) p_refresh (); + return 0; +} + +/* ------------------------------------------------------------------------ */ +void tk_sig_winch (void) +{ + /* dummy; this should not happen at all */ + tk_bell (); +} diff --git a/app/ned/unix/unix2.c b/app/ned/unix/unix2.c new file mode 100644 index 0000000000000000000000000000000000000000..d1e78fdd90802127163d0edb8246b3ad016125ce --- /dev/null +++ b/app/ned/unix/unix2.c @@ -0,0 +1,164 @@ +/* + * FILE %ned/unix/unix2.c + * + * some screen routines for unix curses and ncurses + * + * written: 1992-12-02 + * latest update: 1995-10-01 + * $Id: unix2.c,v 1.4 2002/06/12 18:10:40 gonter Exp $ + * + */ + +#include <stdio.h> +#include "ed.h" +/* see also: <gg/window.h> */ + +#ifdef W_MODEL_NCURSES +#include <ncurses.h> +#else +#include <curses.h> +#endif /* W_MODEL_NCURSES */ + +#define XSETCUP(x,y) move(y,x) +#define XWritechar addch + +extern unsigned long ATTRIBS[]; + +/* ------------------------------------------------------------------------ */ +void curses_blit_line (int page, int ax, int ay, int cnt, char *line) +{ +#ifdef W_MODEL_NCURSES + int last_attr= -1; + int new_attr; +#endif /* W_MODEL_NCURSES */ + int dispchar; + + XSETCUP (ax, ay); + /* clrtoeol (); */ + for (; cnt > 0; cnt--) + { +#ifdef W_MODEL_NCURSES + new_attr= (line[1] & 0x00FF); + if (last_attr != new_attr) + { + attron(ATTRIBS[new_attr]); + last_attr= new_attr; + } +#endif /* W_MODEL_NCURSES */ + dispchar= *line & 0x00FF; + if (dispchar < 0x20 || dispchar > 0x7E) dispchar= '.'; + XWritechar (dispchar); + line += 2; + } + refresh(); + noecho(); +} + +/* ------------------------------------------------------------------------ */ +int curses_prntcol (int p, int x, int y, int a, char *s) +{ + XSETCUP (x, y); +#ifdef W_MODEL_NCURSES + attron(ATTRIBS[a]); +#endif /* W_MODEL_NCURSES */ + while (*s) + XWritechar (*s++); + refresh(); +} + +/* ------------------------------------------------------------------------ */ +int curses_setnchar (int p, int x, int y, int a, int c, int cnt) +{ + XSETCUP (x, y); +#ifdef W_MODEL_NCURSES + attron(ATTRIBS[a]); +#endif /* W_MODEL_NCURSES */ + while (cnt-- > 0) + XWritechar (c); + refresh(); +} + +/* ------------------------------------------------------------------------ */ +int curses_setchar (int p, int x, int y, int a, int c) +{ + XSETCUP (x, y); +#ifdef W_MODEL_NCURSES + attron(ATTRIBS[a]); +#endif /* W_MODEL_NCURSES */ + XWritechar (c); + refresh(); +} + +/* ------------------------------------------------------------------------ */ +int curses_setcup (int p, int x, int y) +{ + XSETCUP (x, y); + refresh (); +} + +/* ------------------------------------------------------------------------ */ +int curses_scrblk_up (int ax, int ay, int bx, int by, int attr, int cnt) +{ +#ifdef JUNK + WINDOW *win; + scrollok (stdscr, TRUE); + win= derwin (stdscr, by-ay, bx-ax, ay, ax); + wsetscrreg (win, ay, by); + wscrl (win, cnt); + refresh (); + scrollok (stdscr, FALSE); + delwin (win); +#endif + p_refresh (); +} + +/* ------------------------------------------------------------------------ */ +int curses_scrblk_down (int ax, int ay, int bx, int by, int attr, int cnt) +{ +#ifdef JUNK + WINDOW *win; + scrollok (stdscr, TRUE); + win= derwin (stdscr, by-ay, bx-ax, ay, ax); + wsetscrreg (win, ay, by); + wscrl (win, -cnt); + refresh (); + scrollok (stdscr, FALSE); + delwin (win); +#endif + p_refresh (); +} + +/* ------------------------------------------------------------------------ */ +int curses_scrblk_left () +{ + p_refresh (); +} + +/* ------------------------------------------------------------------------ */ +int curses_scrblk_right () +{ + p_refresh (); +} + +/* ------------------------------------------------------------------------ */ +void curses_cls () +{ + /* clear (); */ + erase (); +} + +/* ------------------------------------------------------------------------ */ +#ifdef W_MODEL_CURSES +void curses_bell () +{ + beep (); +} +#endif /* W_MODEL_CURSES */ + +/* ------------------------------------------------------------------------ */ +#ifdef W_MODEL_NCURSES +void ncurses_bell () +{ + beep (); +} +#endif /* W_MODEL_NCURSES */ diff --git a/app/ned/unix/uxwindat.c b/app/ned/unix/uxwindat.c new file mode 100644 index 0000000000000000000000000000000000000000..fb29ad0c2269ff48c66cb98f22caebbb3536d8c6 --- /dev/null +++ b/app/ned/unix/uxwindat.c @@ -0,0 +1,16 @@ +/* + * FILE %ned/unix/uxwindat.c + * + * hack out unresolved symbols for testing purposes + * try to do it with elm routines + * + * written: 1996-08-08 + * latest update: 1996-08-08 20:10:28 + * + */ + +/* ------------------------------------------------------------------------ */ +int W_TEXT_CELL_X= 8; +int W_TEXT_CELL_Y= 8; +int W_TEXT_MAX_X= 80; +int W_TEXT_MAX_Y= 25; diff --git a/app/ned/x1.pl b/app/ned/x1.pl new file mode 100755 index 0000000000000000000000000000000000000000..e05f60caa391d530b681b93516dd95e9f0762d24 --- /dev/null +++ b/app/ned/x1.pl @@ -0,0 +1,25 @@ +#!/usr/local/bin/perl + +@FLAGS= @ARGV; +while (<>) +{ + ($fnm)= split (':'); + $F{$fnm}->{$ARGV}= 'X'; +} + + printf ("%-32s", 'Module'); + foreach $arg (@FLAGS) + { + printf ("%-10s", $arg); + } + print "\n"; + +foreach $fnm (sort keys %F) +{ + printf ("%-32s", $fnm); + foreach $arg (@FLAGS) + { + printf (" %-12s", $F{$fnm}->{$arg}); + } + print "\n"; +} diff --git a/app/ned/x2.pl b/app/ned/x2.pl new file mode 100755 index 0000000000000000000000000000000000000000..186d9e3eb730b88359affc98ec985c1766dc3af5 --- /dev/null +++ b/app/ned/x2.pl @@ -0,0 +1,76 @@ +#!/usr/local/bin/perl + +@modules= qw(00/ned0001 00/ned0002 00/ned0009 + 01/ned0102 01/ned0103 01/ned0105 01/ned0105a 01/ned0106 01/ned0106a + 01/ned0109 01/ned0119a 01/ned0124 01/ned0125c + 02/ned0202 02/ned0203 + 02/ned0204c 02/ned0207 02/ned0209 02/ned0211b + 02/ned0213b 02/ned0228 02/ned0230 02/ned0244 04/ned0417b + 03/ned0309 + 04/ned0426 + 05/ned0509 05/ned0510 05/ned0511 + 06/ned0605 06/ned0613b 06/ned0614 06/ned0615 06/ned0618 + 06/ned0621 06/ned0622 06/ned0626 06/ned0631 + 07/ned0713 08/ned0836 08/ned0845 08/ned0851 09/ned0922 09/ned0939 + 10/ned1007 10/ned1009 10/ned1017 10/ned1018 10/ned1019 11/ned1112v ned00 + unix/keyboard); + +my $section= shift; + +if (@ARGV) +{ + foreach $module (@ARGV) { $list{$module}++; } +} +else +{ +foreach $module (@modules) +{ + ($sect, $name)= split (/\//, $module); + + if ($sect eq $section) + { + $list{$name}++; + } +} +} + +# print join (' ', sort keys %list), "\n"; +%FLAGS= ('tk' => '-DUSE_TK', 'cur' => ''); +foreach $mode (sort keys %FLAGS) +{ + $flags= $FLAGS{$mode}; + @lib= (); + push (@rules, "# --- $mode Modules ----------"); + foreach $module (sort keys %list) + { + $obj= $module .'_'. $mode .'.o'; + + push (@lib, $obj); + push (@rules, <<EOX); +$obj : ../ed.h $module.c +\t\$(CC) \$(OPTS) $flags -o $obj $module.c +EOX + } + print "objs_$mode= ", join (' ', @lib), "\n"; +} + +print <<EOX; +lib_cur= ../ned_cur.a +lib_tk= ../ned_tk.a + +all: lib_tk lib_cur +clean : +\trm -f *.o lib_cur lib_tk + +lib_tk : \$(objs_tk) \$(objs) +\tar ru \$(lib_tk) \$? +\ttouch lib_tk + +lib_cur : \$(objs_cur) \$(objs) +\tar ru \$(lib_cur) \$? +\ttouch lib_cur + +EOX + +print join ("\n", @rules); + diff --git a/app/ned/x3.pl b/app/ned/x3.pl new file mode 100755 index 0000000000000000000000000000000000000000..f25cec789b65609f1c85fbc8f32205d2574e784d --- /dev/null +++ b/app/ned/x3.pl @@ -0,0 +1,30 @@ +#!/usr/local/bin/perl +# FILE /usr/home/gonter/work/fbsd/gg/app/ned/x3.pl +# +# written: 2000-12-09 +# latest update: 2000-12-09 13:44:38 +# + +while (<>) +{ + chop; + if (/^(ned.*)\.o:$/) + { + $fnm= $1; + ($module, $env)= split ('_', $fnm); + $env= 'all' unless ($env); + # print "module='$module' env='$env'\n"; + $MOD{$module}->{$env}= 1; + } +} + +my ($mod, $env); +foreach $mod (sort keys %MOD) +{ + my $mr= $MOD{$mod}; + my @e= sort keys %$mr; + my $comment; + $comment .= ' check' if (exists ($mr->{all}) + && (exists ($mr->{tk}) || exists ($mr->{cur}))); + print join (' ', $mod, @e, $comment), "\n"; +} diff --git a/app/nl_kr/(dirinf).fm b/app/nl_kr/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..afd37a317cf4b80d07abac10ef03ba613a4f37e3 --- /dev/null +++ b/app/nl_kr/(dirinf).fm @@ -0,0 +1,41 @@ +# +# FILE %nl_kr/(dirinf).fm +# +# written: 1989 04 15 +# latest update: 2001-08-03 15:46:33 +# $Id: (dirinf).fm,v 1.3 2001/08/03 16:00:16 gonter Exp $ +# +# Kennbuchstaben: +# E ... Entwurf +# A ... Aufbau von LUTs und DICTs +# R ... RUN-Modul(e) +# T ... Testmodul +# S ... Shell/Command-Module (Interfaces) + +. | | Natural Language and Knowledge Representation + +Makefile | | <<<< active Makefile +make-dos | | <<<< DOS Makefile +make-ux | | <<<< Unix Makefile +makeshar.lst | | <<<< create Unix shar distribution package +cmsmake.rex | | <<<< VM/CMS make script + +deref.c | SR | LMD lookup engine +lutmake.c | SR | LMD indexing engine +luttest.c | S T| search words in a LUT file +lutdump.c | S T| dump complete LUT file to stdout +lutprint.c | S T| read dump of a LUT file and print somethng *OBS* ?? +lmd.hyx | | description of the LMD engine and function +dic.hyx | | Beschreibung der Struktur von DIC-Files *OBS* ?? +_relics_.zip |*OBS*| obsolete material + +# text analysis +tasgml.c | | + +# ============================================================================ +*.c | | << ?????????????????? +*.h | | << ?????????????????? +*.awk | | < +*.doc | | < +*.hyx | | < +* | | diff --git a/app/nl_kr/.cvsignore b/app/nl_kr/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..b6b2d929d9baf1c6da3b129749419e4e63eb9b50 --- /dev/null +++ b/app/nl_kr/.cvsignore @@ -0,0 +1,38 @@ +# executables +deref +lutdump +lutmake +lutprint +luttest +ta +tasgml +tfbget +tfblut +# SWIG output and temporary files +Makefile-swig +tfb_wrap.c +tfb_wrap.doc +tfb.pm +# temporary and test files +lmd.idx +lmd.lut +*.wr +*.di +*.lt +*.log +blues.* +@* +# files from rfc2hyx.pl +rfc[0-9]*.txt +rfc[0-9]*.tmp +rfc[0-9]*.top +rfc[0-9]*.hyx +rfc[0-9]*.idx +rfc[0-9]*.lut +# Release Stages +distrib +lmd-3.10 +# Release Files +luttools-0.14 +*.tar +*.tar.gz diff --git a/app/nl_kr/Makefile b/app/nl_kr/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..0b145718adbe7caaab656a322036aaa188f77263 --- /dev/null +++ b/app/nl_kr/Makefile @@ -0,0 +1,95 @@ +# +# FILE %nl_kr/make-ux +# +# Makefile for the NL-KR system under Unix +# depends on %sgml/makefile.ux +# +# written: 1991 03 19: for AIX +# 1993-03-07: full revision +# latest update: 2001-08-25 23:28:48 +# $Id: Makefile,v 1.11 2005/03/11 23:41:43 gonter Exp $ +# +# ---------------------------------------------------------------------------- + +CC=cc +OPTS= -I. +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +lib=../../lib/libgg.a + +SYMS= new_TFB_HANDLE tfb_fetch_entry2 tfb_fetch_entry \ + new_HYX_CLUSTER_CONTROL \ + new_LMDQS lmd_deref1 lmd_print_doc_hit_list_stdout \ + lmd_print_document_info_list_stdout \ + WRL_string DIL_next + +# installation directory, e.g. for AFS +bindir=/usr/local/bin + +bins=deref lutmake lutdump luttest tfbget tfblut +bins2=ta tasgml + +# ---------------------------------------------------------------------------- +all : $(bins) $(bins2) + +all.2 : lutprint + +install : all + cp $(bins) $(bindir) + +clean : + rm -f *.o $(bins) $(bins2) + +distrib : + sh -c "mkdir -p distrib/gg" + sh -c "~/.ned/filelist.pl -dist distrib $(bins) -sym $(SYMS)" + cp tfb.i Makefile-swig.pl README.lmd distrib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $*.c + +# ---------------------------------------------------------------------------- +lutmake1=lutmake.o +lutdump1=lutdump.o +luttest1=luttest.o +lutprint1=lutprint.o +deref1=deref.o +ta1=ta.o +tasgml1=tasgml.o + +# ---------------------------------------------------------------------------- +lutmake : $(lutmake1) $(lib) + $(CC) -o lutmake $(lutmake1) $(lib) + +lutdump : $(lutdump1) $(lib) + $(CC) -o lutdump $(lutdump1) $(lib) + +luttest : $(luttest1) $(lib) + $(CC) -o luttest $(luttest1) $(lib) + +lutprint : $(lutprint1) $(lib) + $(CC) -o lutprint $(lutprint1) $(lib) + +deref : $(deref1) $(lib) + $(CC) -o deref $(deref1) $(lib) + +# ---------------------------------------------------------------------------- +ta : $(ta1) $(lib) + $(CC) -o ta $(ta1) $(lib) + +tasgml : $(tasgml1) $(lib) + $(CC) -o tasgml $(tasgml1) $(lib) + +# ---------------------------------------------------------------------------- +tfblut: tfblut.o $(lib) + $(CC) -o tfblut tfblut.o $(lib) + +tfbget: tfbget.o $(lib) + $(CC) -o tfbget tfbget.o $(lib) + +# ---------------------------------------------------------------------------- +Makefile-swig : Makefile-swig.pl + perl Makefile-swig.pl >Makefile-swig +all.3 : Makefile-swig + make -f Makefile-swig + diff --git a/app/nl_kr/Makefile-swig.pl b/app/nl_kr/Makefile-swig.pl new file mode 100755 index 0000000000000000000000000000000000000000..7d84ae62eec70adace4763401174581191dc8bdd --- /dev/null +++ b/app/nl_kr/Makefile-swig.pl @@ -0,0 +1,42 @@ +#!/usr/local/bin/perl +# +# $Id: Makefile-swig.pl,v 1.2 2002/07/04 18:08:49 gonter Exp $ +# + +my @MACH= grep m#/mach#, @INC; +my $MACH= shift @MACH; + +print <<EOX; +# this file was generated! + +INCL= -I. +INCL_PERL= -I$MACH/CORE +INCL_PYTHON= -I/usr/local/include/python1.6 + +PERL_OUT= tfb_perl_wrap.o tfb.so +all : \$(PERL_OUT) + +clean : + rm -f tfb_warp.c \$(PERL_OUT) + +# Perl +tfb_perl_wrap.c : tfb.i + swig -perl5 -o tfb_perl_wrap.c tfb.i + +tfb_perl_wrap.o : tfb_perl_wrap.c + cc -o \$@ \$(INCL) \$(INCL_PERL) -c tfb_perl_wrap.c + +tfb.so : tfb_perl_wrap.o libgg.a + ld -shared \$(LIB) tfb_perl_wrap.o -o tfb.so + +# Python +tfb_python_wrap.c : tfb.i + swig -python -o tfb_python_wrap.c tfb.i + +tfb_python_wrap.o : tfb_python_wrap.c + cc -o \$@ \$(INCL) \$(INCL_PYTHON) -c tfb_python_wrap.c + +tfb_python.so : tfb_python_wrap.o libgg.a + ld -shared libgg.a tfb_python_wrap.o -o tfb_python.so + +EOX diff --git a/app/nl_kr/README.lmd b/app/nl_kr/README.lmd new file mode 100644 index 0000000000000000000000000000000000000000..bf5f3a023d20b488f3d5780bfde23f2c4142cfe1 --- /dev/null +++ b/app/nl_kr/README.lmd @@ -0,0 +1,20 @@ +# $Id: README.lmd,v 1.2 2002/07/04 18:08:49 gonter Exp $ + +# This is LMD version 3.11 as of $Date: 2002/07/04 18:08:49 $ + +How to build: + + make + +If you want to build the Perl module and have SWIG on your machine, you +may want to try this: + + perl Makefile-swig.pl >>Makefile + make tfb.so + +To test if the module was built correctly, try this: + + perl -e 'use tfb;' + +This should not return anything (at least nothing that looks like an error). + diff --git a/app/nl_kr/cmsmake.rex b/app/nl_kr/cmsmake.rex new file mode 100644 index 0000000000000000000000000000000000000000..e3bddb6bb0583ae783bd79cb1586fdc9d6301808 --- /dev/null +++ b/app/nl_kr/cmsmake.rex @@ -0,0 +1,146 @@ +/* + * FILE cmsmake.rexx (CMSMAKE EXEC) + * + * compile and link all modules + * + * written: 1993-03-06 + * latest update: 1994-09-05 + * + */ + +parse upper arg what . + + /* modules: */ + lutmake1= 'lutmake'; + lutdump1= 'lutdump'; + luttest1= 'luttest'; + deref1= 'deref'; + + wordcr= 'wordcr03 wordcr04 wordcr05'; + lut1= 'lut_0001 lut_0002 lut_0004 lut_0005 lut_0008'; + lut2= 'lut_0009'; + cmslib= 'cms_acce'; + string1= 'str_0004 str_0006 str_0008 str_0016 str_0020'; + string2= 'str_0021 str_0022 str_0026 str_0027 str_0028'; + string3= 'str_0204 str_0301'; + files1= 'fnmcpy freadlin ftrans01 ftrans02 ftrans06 file2buf'; + dpp= 'param001 dpp_0001 dpp_0002 dpp_0003'; + hyx= 'hyxl0001 hyxl0002 hyxl0003'; + nl1= 'nl_00001 nl_00002 nl_00004'; + nl2= 'nl_00101 nl_00102 nl_00103 nl_00104 nl_00105'; + nl3= 'nl_00106 nl_00107 nl_00108 nl_00109 nl_00110'; + nl4= 'nl_00111 nl_00112 nl_00113 nl_00114 nl_00115'; + nl5= 'nl_00116 nl_00117 nl_00118 nl_00119 nl_00120'; + nl6= 'nl_00121 nl_00122 nl_00123 nl_00124 nl_00125'; + nl7= 'nl_00126 nl_00127 nl_00128 nl_00129 nl_00130' + nl8= 'nl_00131 nl_00201'; + yt1= 'yt_00001 yt_00003 yt_00004 yt_00005 yt_00006'; + yt2= 'yt_00007 yt_00008 yt_00009 yt_00010 yt_00011'; + yt3= 'yt_00012'; + + gglib= 'GGLIB'; + +select; + when what='GEN' then do; + rvg=cmpfuncs(lutmake1 lutdump1 luttest1 deref1, ''); + end; + when what='' then do; + /* compile the modules */ + say 'compiling: all modules' + rvg=cmpfuncs(lutmake1 lutdump1 luttest1 deref1, ''); + rvg=rvg+cmpfuncs(wordcr, 'GEN'); + rvg=rvg+cmpfuncs(lut1, 'ADD'); + rvg=rvg+cmpfuncs(lut2, 'ADD'); + rvg=rvg+cmpfuncs(cmslib, 'ADD'); + rvg=rvg+cmpfuncs(string1, 'ADD'); + rvg=rvg+cmpfuncs(string2, 'ADD'); + rvg=rvg+cmpfuncs(string3, 'ADD'); + rvg=rvg+cmpfuncs(files1, 'ADD'); + rvg=rvg+cmpfuncs(dpp, 'ADD'); + rvg=rvg+cmpfuncs(hyx, 'ADD'); + rvg=rvg+cmpfuncs(nl1, 'ADD'); + rvg=rvg+cmpfuncs(nl2, 'ADD'); + rvg=rvg+cmpfuncs(nl3, 'ADD'); + rvg=rvg+cmpfuncs(nl4, 'ADD'); + rvg=rvg+cmpfuncs(nl5, 'ADD'); + rvg=rvg+cmpfuncs(nl6, 'ADD'); + rvg=rvg+cmpfuncs(nl7, 'ADD'); + rvg=rvg+cmpfuncs(nl8, 'ADD'); + rvg=rvg+cmpfuncs(yt1, 'ADD'); + rvg=rvg+cmpfuncs(yt2, 'ADD'); + rvg=rvg+cmpfuncs(yt3, 'ADD'); + if (rvg/=0) then say 'errors in modules ...' + end; + otherwise do; + 'TXTLIB DEL' gglib what + rvg=cmpfuncs(what, 'ADD'); + end; +end/*select*/; + +/* 'GLOBAL TXTLIB CLIB' gglib */ +'GLOBAL TXTLIB EDCBASE IBMLIB CMSLIB' gglib; +'GLOBAL LOADLIB EDCLINK'; + +/* link the resulting programs */ +say 'now generating LUTMAKE MODULE' +'LOAD' lutmake1 +if rc=0 then do; + 'GENMOD LUTMAKE' + 'ERASE LUTMAKE MAP' + 'RENAME LOAD MAP * LUTMAKE = =' + say 'LUTMAKE MODULE generated...' +end; else; do; + say 'error generating LUTMAKE MODULE!' +end; + +say 'now generating LUTDUMP MODULE' +'LOAD' lutdump1 +if rc=0 then do; + 'GENMOD LUTDUMP' + 'ERASE LUTDUMP MAP' + 'RENAME LOAD MAP * LUTDUMP = =' + say 'LUTDUMP MODULE generated...' +end; else; do; + say 'error generating LUTDUMP MODULE!' +end; + +say 'now generating LUTTEST MODULE' +'LOAD' luttest1 +if rc=0 then do; + 'GENMOD LUTTEST' + 'ERASE LUTTEST MAP' + 'RENAME LOAD MAP * LUTTEST = =' + say 'LUTTEST MODULE generated...' +end; else; do; + say 'error generating LUTTEST MODULE!' +end; + +say 'now generating DEREF MODULE' +'LOAD' deref1 +if rc=0 then do; + 'GENMOD DEREF' + 'ERASE DEREF MAP' + 'RENAME LOAD MAP * DEREF = =' + say 'DEREF MODULE generated...' +end; else; do; + say 'error generating DEREF MODULE!' +end; + +exit(0); + +/* ---------------------------------------------------------------- */ +cmpfuncs: parse arg fns, libcmd +rv= 0; +xfns= ''; +do while fns/=''; + parse var fns fn fns + say 'compiling:' fn + 'CC' fn + if rc=0 then xfns= xfns fn; + if rc/=0 then rv= rv+1; +end; +if xfns/='' & libcmd/='' then do; + say 'TXTLIB' libcmd gglib xfns '(FILENAME' + 'TXTLIB' libcmd gglib xfns '(FILENAME' +end; +return rv; diff --git a/app/nl_kr/contrib b/app/nl_kr/contrib new file mode 120000 index 0000000000000000000000000000000000000000..6021a51ea9120394be7d8ebb813d5b9b5d4e575c --- /dev/null +++ b/app/nl_kr/contrib @@ -0,0 +1 @@ +../../lib/include/contrib \ No newline at end of file diff --git a/app/nl_kr/cpibm.awk b/app/nl_kr/cpibm.awk new file mode 100644 index 0000000000000000000000000000000000000000..db7ed31e60d549a386870818241e4a86044398c2 --- /dev/null +++ b/app/nl_kr/cpibm.awk @@ -0,0 +1,32 @@ +# FILE cpibm.awk +# written: 1992-02-06 +# latest update: 1994-08-01 +# modify c source file for compiling on a CMS system +# ---------------------------------------------------------------------------- +BEGIN { + print "#include \"ggcms.h\"" +} +/<gg\// { + sub("<gg\/", "\""); + sub(">", "\""); + print + next +} +/<contrib\// { + sub("<contrib\/", "\""); + sub(">", "\""); + print + next +} +/<malloc.h>/ { +# print "void *malloc(unsigned int);"; +# print "void *calloc(unsigned int, int);"; +# print "void *free(void *);"; + print "#include <stdlib.h>"; + next; +} + { print } +/<stdio.h>/ { + print "#define _FILE_DEFINED" + next; +} diff --git a/app/nl_kr/cpibm.bat b/app/nl_kr/cpibm.bat new file mode 100644 index 0000000000000000000000000000000000000000..727762bf04e2bc02cac74431620c0fb9a15bc4f8 --- /dev/null +++ b/app/nl_kr/cpibm.bat @@ -0,0 +1,127 @@ +:: +:: FILE ~/usr/nl_kr/cpibm.bat +:: +:: copy all necessary files onto temporary space +:: +:: written: 1993-03-03 +:: latest update: 1994-09-05 +:: +:: --------------------------------------------------------------------------- +goto %1 +echo no destination specified!!!!! +goto END +:F +:G +:H +:I +:J +:K +awk cpibm lutmake.c >%1:lutmake.c +awk cpibm deref.c >%1:deref.c +awk cpibm lutdump.c >%1:lutdump.c +awk cpibm luttest.c >%1:luttest.c +awk cpibm c:\etc\lexicon\top200.wrd >%1:top200.wrd +copy c:\c5\include\gg\ggcms.h %1: +awk " {print}" lmd.tex >%1:lmd.tex +awk " {print}" lmd.hyx >%1:lmd.hyx +copy c:\usr\sbr\cms_acce.c %1: +copy cmsmake.rex %1: +awk cpibm c:\c5\include\gg\sbr.h >%1:sbr.h +awk cpibm c:\c5\include\gg\dpp.h >%1:dpp.h +awk cpibm c:\c5\include\gg\strings.h >%1:strings.h +awk cpibm c:\c5\include\gg\lookup.h >%1:lookup.h +awk cpibm c:\c5\include\gg\hyx.h >%1:hyx.h +awk cpibm c:\c5\include\gg\ytree.h >%1:ytree.h +awk cpibm c:\c5\include\gg\ztree.h >%1:ztree.h +awk cpibm c:\c5\include\gg\fileio.h >%1:fileio.h +awk cpibm c:\c5\include\gg\filename.h >%1:filename.h +awk cpibm c:\c5\include\gg\public.inc >%1:public.inc +awk cpibm c:\c5\include\gg\help.inc >%1:help.inc +awk cpibm c:\usr\sbr\param001.c >%1:param001.c +awk cpibm c:\usr\sbr\ftrans01.c >%1:ftrans01.c +awk cpibm c:\usr\sbr\ftrans02.c >%1:ftrans02.c +awk cpibm c:\usr\sbr\ftrans06.c >%1:ftrans06.c +awk cpibm c:\usr\sbr\freadlin.c >%1:freadlin.c +awk cpibm c:\usr\sbr\file2buf.c >%1:file2buf.c +awk cpibm c:\usr\sbr\fnmcpy.c >%1:fnmcpy.c +awk cpibm c:\usr\sbr\dpp_0001.c >%1:dpp_0001.c +awk cpibm c:\usr\sbr\dpp_0002.c >%1:dpp_0002.c +awk cpibm c:\usr\sbr\dpp_0003.c >%1:dpp_0003.c +awk cpibm c:\usr\sbr\str_0004.c >%1:str_0004.c +awk cpibm c:\usr\sbr\str_0006.c >%1:str_0006.c +awk cpibm c:\usr\sbr\str_0008.c >%1:str_0008.c +awk cpibm c:\usr\sbr\str_0016.c >%1:str_0016.c +awk cpibm c:\usr\sbr\str_0020.c >%1:str_0020.c +awk cpibm c:\usr\sbr\str_0021.c >%1:str_0021.c +awk cpibm c:\usr\sbr\str_0022.c >%1:str_0022.c +awk cpibm c:\usr\sbr\str_0026.c >%1:str_0026.c +awk cpibm c:\usr\sbr\str_0027.c >%1:str_0027.c +awk cpibm c:\usr\sbr\str_0028.c >%1:str_0028.c +awk cpibm c:\usr\sbr\str_0301.c >%1:str_0301.c +awk cpibm c:\usr\sbr\str_0204.c >%1:str_0204.c +awk cpibm wordcrea.h >%1:wordcrea.h +awk cpibm wordcr03.c >%1:wordcr03.c +awk cpibm wordcr04.c >%1:wordcr04.c +awk cpibm wordcr05.c >%1:wordcr05.c +awk cpibm lib\lut_0001.c >%1:lut_0001.c +awk cpibm lib\lut_0002.c >%1:lut_0002.c +awk cpibm lib\lut_0004.c >%1:lut_0004.c +awk cpibm lib\lut_0005.c >%1:lut_0005.c +awk cpibm lib\lut_0008.c >%1:lut_0008.c +awk cpibm lib\lut_0009.c >%1:lut_0009.c +awk cpibm lib\nl_00001.c >%1:nl_00001.c +awk cpibm lib\nl_00002.c >%1:nl_00002.c +awk cpibm lib\nl_00004.c >%1:nl_00004.c +awk cpibm lib\nl_00101.c >%1:nl_00101.c +awk cpibm lib\nl_00102.c >%1:nl_00102.c +awk cpibm lib\nl_00103.c >%1:nl_00103.c +awk cpibm lib\nl_00104.c >%1:nl_00104.c +awk cpibm lib\nl_00105.c >%1:nl_00105.c +awk cpibm lib\nl_00106.c >%1:nl_00106.c +awk cpibm lib\nl_00107.c >%1:nl_00107.c +awk cpibm lib\nl_00108.c >%1:nl_00108.c +awk cpibm lib\nl_00109.c >%1:nl_00109.c +awk cpibm lib\nl_00110.c >%1:nl_00110.c +awk cpibm lib\nl_00111.c >%1:nl_00111.c +awk cpibm lib\nl_00112.c >%1:nl_00112.c +awk cpibm lib\nl_00113.c >%1:nl_00113.c +awk cpibm lib\nl_00114.c >%1:nl_00114.c +awk cpibm lib\nl_00115.c >%1:nl_00115.c +awk cpibm lib\nl_00116.c >%1:nl_00116.c +awk cpibm lib\nl_00117.c >%1:nl_00117.c +awk cpibm lib\nl_00118.c >%1:nl_00118.c +awk cpibm lib\nl_00119.c >%1:nl_00119.c +awk cpibm lib\nl_00120.c >%1:nl_00120.c +awk cpibm lib\nl_00121.c >%1:nl_00121.c +awk cpibm lib\nl_00122.c >%1:nl_00122.c +awk cpibm lib\nl_00123.c >%1:nl_00123.c +awk cpibm lib\nl_00124.c >%1:nl_00124.c +awk cpibm lib\nl_00125.c >%1:nl_00125.c +awk cpibm lib\nl_00126.c >%1:nl_00126.c +awk cpibm lib\nl_00127.c >%1:nl_00127.c +awk cpibm lib\nl_00128.c >%1:nl_00128.c +awk cpibm lib\nl_00129.c >%1:nl_00129.c +awk cpibm lib\nl_00130.c >%1:nl_00130.c +awk cpibm lib\nl_00131.c >%1:nl_00131.c +awk cpibm lib\nl_00201.c >%1:nl_00201.c +awk cpibm c:\usr\ds\ytree\yt_00001.c >%1:yt_00001.c +awk cpibm c:\usr\ds\ytree\yt_00002.c >%1:yt_00002.c +awk cpibm c:\usr\ds\ytree\yt_00003.c >%1:yt_00003.c +awk cpibm c:\usr\ds\ytree\yt_00004.c >%1:yt_00004.c +awk cpibm c:\usr\ds\ytree\yt_00005.c >%1:yt_00005.c +awk cpibm c:\usr\ds\ytree\yt_00006.c >%1:yt_00006.c +awk cpibm c:\usr\ds\ytree\yt_00007.c >%1:yt_00007.c +awk cpibm c:\usr\ds\ytree\yt_00008.c >%1:yt_00008.c +awk cpibm c:\usr\ds\ytree\yt_00009.c >%1:yt_00009.c +awk cpibm c:\usr\ds\ytree\yt_00010.c >%1:yt_00010.c +awk cpibm c:\usr\ds\ytree\yt_00011.c >%1:yt_00011.c +awk cpibm c:\usr\ds\ytree\yt_00012.c >%1:yt_00012.c +awk cpibm c:\usr\ds\hyx\hyxl0001.c >%1:hyxl0001.c +awk cpibm c:\usr\ds\hyx\hyxl0002.c >%1:hyxl0002.c +awk cpibm c:\usr\ds\hyx\hyxl0003.c >%1:hyxl0003.c +goto END +:C +:D +:E +echo temporary space on %1 ? sure?? +:END diff --git a/app/nl_kr/deref b/app/nl_kr/deref new file mode 100755 index 0000000000000000000000000000000000000000..c923ec36a6e60bc6a8d45cd0495dab9b2a6ab7f5 Binary files /dev/null and b/app/nl_kr/deref differ diff --git a/app/nl_kr/deref.c b/app/nl_kr/deref.c new file mode 100644 index 0000000000000000000000000000000000000000..7817170a9659114d9e877c8de11a6c8b5844a824 --- /dev/null +++ b/app/nl_kr/deref.c @@ -0,0 +1,494 @@ +/* + * FILE %nl_kr/deref.c + * + * lookup word reference tables and generate a 'hit list' + * - prototypes + * - HELP + * - T2D + * + * written: 1993-02-28 + * 1995-12-05 (angeblich letztes Update per 2001-08-03) + * latest update: 2001-08-03 16:59:11 + * $Id: deref.c,v 1.5 2002/07/04 18:08:49 gonter Exp $ + * + */ + +/* #define PRINT_CONTACT_INFORMATION */ /* Who is to blame... */ +#define REAL_AUTHOR + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#ifdef MSDOS +#include <io.h> +#include <conio.h> +#endif +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/filename.h> + +#define STDHLP stdout + +/* ------------------------------------------------------------------------ */ +static int verbose_mode= 0; +#define OM_min 0 +#define OM_gopher 1 +#define OM_hyx 2 +#define OM_veronica 3 +#define OM_cluster 4 +static int output_mode= OM_min; +static int print_dil= 1; + +static struct ARRAY_CONTROL *arguments; + +/* filenames: ------------------------------------------------------------- */ +#ifndef __CMS__ +static char *docdir_file= "docdir.dd"; +static char *veronica_file= "gophscan.out"; +static char *VERONICA_NOT_FOUND= "veronica.not.found"; +#define DOCDIR_DD "docdir.dd" +#else +static char *docdir_file= "docdir.dd.a"; +static char *veronica_file= "gophscan.out.a"; +static char *VERONICA_NOT_FOUND= "veronica.notfound.a"; +#define DOCDIR_DD "docdir.dd.a" +#endif + +/* ------------------------------------------------------------------------ */ +#define MAX_LINE 8192 +static char line [MAX_LINE]; +static char *hostname= "gopher.wu-wien.ac.at"; +static char *path_prefix= ""; +static long portnumber= (long) 70; +static char *outfile_name= (char *) 0; +static FILE *outfile= (FILE *) 0; +static int stdin_mode= 0; +static int min_wordlength= 1; +static int max_wordlength= 100; +static char *cluster_name= (char *) 0; + +/* ------------------------------------------------------------------------ */ +struct TERM_EVAL *term_list= (struct TERM_EVAL *) 0; +struct TERM_EVAL **term_append= &term_list; +static int term_evaluation= 0; +static long opcode_term_eval= WRint_logic_or; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = /* see also: [%nl_kr/lmd.hyx] deref usage */ +{ + "USAGE: deref [options] {file name}\n", + "OPTIONS:\n", +#ifndef __CMS__ + " - ... read words from stdin\n", +#endif + " -f<fnm> ... parameter file\n", + " -o<fnm> ... write output to file\n", + " -l<lut> ... name of the LUT file; .wr and .di file follow\n", + " -t[<fnm>] ... docdir table [DEF: docdir.dd]\n", + " -e[<opr>] ... evaluate results and interpret word sequences\n", + " as implicit 'and' or 'or' expression\n", + " -mh ... hyx mode\n", + " -mc<cl> ... hyx cluster mode; <cl> .. cluster name\n", + " -mg ... gopher mode\n", + " -mv<fnm> ... veronica mode\n", + " -min<n> ... minimal word length; [DEF: 1]\n", + " shorter words are ignored\n", + " -max<n> ... maximal word length; [DEF: 100]\n", + " longer words are truncated\n", + " -h<host> ... host name\n", + " -p<port> ... port number\n", + " -q<pfx> ... path prefix\n", + " -v ... verbose mode\n", + " -zvnf=<fnm> ... define file name for 'veronica not found' info\n", + " -zd ... dont read document info\n", + "\n", + "(@)Aderef.c 3.11 #D$2002-07-04 20:07:51\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +#ifdef __CMS__ +#define interpret_parameter ipa_ +#define interpret_parfile ipf_ +#endif + +int cdecl main (int argc, char *argv []); +int cdecl print_term_list (struct TERM_EVAL *te); +int cdecl write_deref_results (char *str, struct WORD_REF_LIST *wrl); +int cdecl interpret_parameter (struct LMD_QUERY_SET *lmdqs, char *par); +int cdecl interpret_parfile (struct LMD_QUERY_SET *lmdqs, char *fn, + char *section); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + char *area; /* part of line that holds area definition */ + char *xline; /* part of line that holds search words */ +#define N_WORDS 40 /* maximum number of words allowed */ + char *words [N_WORDS]; /* individual words in the line */ + int wc; /* number of words acutally found */ + int i, j; + int rc; + struct WORD_REF_LIST *wrl; + struct TERM_EVAL *te; + struct LMD_QUERY_SET *lmdqs; + char *arg; + + if (argc <= 1) goto HLP; + + if ((arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + || (lmdqs= lmd_new_query_set ()) == (struct LMD_QUERY_SET *) 0 + ) + { + fprintf (stderr, "fatal error: can't create control structure!\n"); + return 1; + } + +#ifndef __CMS__ + lmd_qs_setup_table_names (lmdqs, "xxx.lt"); +#else + lmd_qs_setup_table_names (lmdqs, "xxx.lt.a"); +#endif /* ! __CMS__ */ + + for (i= 1; i < argc; i++) + switch (interpret_parameter (lmdqs, argv [i])) + { + case 0: + break; +HLP: +#include <gg/help.inc> + } + + if (stdin_mode) + { + fclose (stderr); + fopen ("deref.log", "a"); + } + + lmd_deref_init (lmdqs); + + if (stdin_mode) + { + for (;;) + { + rc= fread_line (stdin, line, MAX_LINE); + if ((rc <= 0 && feof (stdin)) || strcmp (line, ".") == 0) + { + term_list= ((struct TERM_EVAL *) 0); + break; + } + + xline= line; + area= ""; + for (i= 0; line [i]; i++) + if (line [i] == '\t') + { + xline= &line[i+1]; + area= line; + break; + } + + fprintf (stderr, "** area=%s\n", area); + fprintf (stderr, "** xline=%s\n", xline); + + if ((wc= isolate_words (xline, words, N_WORDS)) > N_WORDS) wc= N_WORDS; + + for (i= 0; i < wc; i++) + { + wrl= lmd_deref1 (lmdqs, words [i], min_wordlength, max_wordlength); + if ((te= lmd_build_term_eval (words [i], wrl)) + != (struct TERM_EVAL *) 0) + { + *term_append= te; + term_append= &te->TE_right; + print_term_list (te); + } + } + + if (output_mode == OM_veronica || output_mode == OM_gopher) break; + } + } + else + { + while ((arg= (char *) array_shift (arguments)) != (char *) 0) + { + if (arg [0] == '-') + { + switch (arg [1]) + { + case 'f': case 'F': + interpret_parfile (lmdqs, arg+2, ""); + break; + default: + break; + } + } + else + { + wrl= lmd_deref1 (lmdqs, arg, min_wordlength, max_wordlength); + +#ifdef DEBUG +printf ("Versuch 1, wrl=...\n"); +write_deref_results (arg_v [i], wrl); +#endif /* DEBUG */ + + if ((te= lmd_build_term_eval (arg, wrl)) + != (struct TERM_EVAL *) 0) + { + *term_append= te; + term_append= &te->TE_right; + } + } + } + } + + lmd_deref_finish (lmdqs); + print_term_list (term_list); + + switch (output_mode) + { + case OM_gopher: + case OM_veronica: + fputs (".\n", outfile); + break; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int print_term_list (struct TERM_EVAL *te) +{ + if (term_evaluation) + { + struct TERM_EVAL *te_evaluated; + struct WORD_REF_LIST *wrl; + + te_evaluated= lmd_evaluate_terms (te, opcode_term_eval); + if ((wrl= lmd_new_word_ref_list ()) != (struct WORD_REF_LIST *) 0) + { + wrl->WRL_dil= te_evaluated->TE_dil; + write_deref_results (/* te_evaluated->TE_string */ "eval'd", wrl); + } + } + else + { + for (; te != (struct TERM_EVAL *) 0; te= te->TE_right) + write_deref_results (te->TE_string, te->TE_wrl); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int write_deref_results (char *str, struct WORD_REF_LIST *wrl) +{ + if (outfile_name != (char *) 0) + { + fprintf (stderr, "opening output file %s\n", outfile_name); + outfile= fopen (outfile_name, "w"); + } + + if (outfile == (FILE *) 0) + { + /************ + fprintf (stderr, "writing output to stdout\n"); + ************/ + outfile= stdout; + } + + switch (output_mode) + { + case OM_gopher: + if (lmd_print_gopher_hit_list (outfile, docdir_file, wrl, path_prefix, + "0", hostname, portnumber) <= 0) + goto VNF; + break; + + case OM_hyx: + lmd_print_hyx_hit_list (outfile, docdir_file, wrl); + break; + + case OM_cluster: + lmd_print_hyx_cluster_hit_list (outfile, wrl, cluster_name); + break; + + case OM_veronica: + if (lmd_print_veronica_hit_list (outfile, veronica_file, wrl) <= 0) + { +VNF: + if (f2transfer (VERONICA_NOT_FOUND, outfile, 0L, 0x7FFFFFFFL) == -1) + { + fprintf (outfile, + "0sorry, your search for '%s' didn't produce any result.\t\terr.host\t0\n", + str); + if (wrl != (struct WORD_REF_LIST *) 0) + fprintf (outfile, + "0'%s' was dropped from the index because it appeared too frequently.\t\terr.host\t0\n", + str); +#ifdef PRINT_CONTACT_INFORMATION + fprintf (outfile, + "0report bugs to Gerhard.Gonter@wu-wien.ac.at\t\terr.host\t0\n"); +#endif + } + } + break; + + default: + lmd_print_doc_hit_list (outfile, wrl, print_dil); + break; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int interpret_parameter (struct LMD_QUERY_SET *lmdqs, char *par) +{ + int j; + int ch; + + if (par[0] == '-') + switch (par[1]) + { + case 'e': case 'E': + term_evaluation= 1; + opcode_term_eval= WRint_logic_or; + if (par+2 == 0) break; + if (strcmp (par+2, "and") == 0 + || strcmp (par+2, "und") == 0) + opcode_term_eval= WRint_logic_and; + break; + + case 'f': case 'F': + if (par[2] == 0) break; + array_push (arguments, (void *) par); + break; + + case 'h': case 'H': + hostname= strdup (par+2); + break; + + case 'l': case 'L': + lmd_qs_setup_table_names (lmdqs, par+2); + break; + + case 'm': case 'M': + switch (par[2]) + { + case 'g': case 'G': + output_mode= OM_gopher; + break; + case 'h': case 'H': + output_mode= OM_hyx; + break; + case 'c': case 'C': + output_mode= OM_cluster; + cluster_name= par+3; + lmd_qs_setup_table_names (lmdqs, cluster_name); + fnmcpy3 (&lmdqs->LMDQS_fn_lut, cluster_name, ".lt"); + break; + case 'v': case 'V': + output_mode= OM_veronica; + if (par[3]) veronica_file= strdup (par+3); + break; + case 'a': case 'A': + ch= par[3]; + if (ch == 'x' || ch == 'X') + max_wordlength= (int) get_parameter_value (par+4); + break; + case 'i': case 'I': + ch= par[3]; + if (ch == 'n' || ch == 'N') + min_wordlength= (int) get_parameter_value (par+4); + break; + default: + output_mode= OM_min; + break; + } + break; + + case 'o': case 'O': + outfile_name= strdup (&par[2]); + break; + + case 'p': case 'P': + portnumber= get_parameter_value (par+2); + break; + + case 'q': case 'Q': + path_prefix= strdup (&par[2]); + break; + + case 't': case 'T': + docdir_file= strdup ((par[2] == 0) ? DOCDIR_DD : (par+2)); + break; + + case 'v': case 'V': + for (j= 1; par[j]; j++) + switch (par[j]) + { + case 'v': case 'V': + verbose_mode= 1; + break; + default: + fprintf (stderr, "unknown option %c\n", par[j]); + return -1; + } + break; + + case 'z': case 'Z': + if (strncmp (par, "-zvnf=", 6) == 0) + VERONICA_NOT_FOUND= strdup (par+6); + else if (strncmp (par, "-zd", 3) == 0) print_dil= 0; + break; + + case 0: + stdin_mode= 1; + break; + + default: + return -1; + } + else array_push (arguments, (void *) par); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int interpret_parfile (struct LMD_QUERY_SET *lmdqs, char *fn, char *section) +{ + FILE *parfile; + int j; + int readit= 0; + + if (section == (char *) 0) section= ""; + if (*section == 0) readit= 1; + + if ((parfile= fopen (fn, "r")) == (FILE *) 0) return -1; + fprintf (stderr, ">> reading par file %s, section %s\n", fn, section); + + for (;;) + { + j= fread_line (parfile, line, 100); + if (j <= 0 && feof (parfile)) break; + + if (*line == '#') continue; + if (*line == '[') + { + readit= 0; + if (strncmp (line, section, strlen (section)) == 0) readit= 1; + continue; + } + + if (readit) interpret_parameter (lmdqs, line); + } + fclose (parfile); + + return 0; +} diff --git a/app/nl_kr/deref.o b/app/nl_kr/deref.o new file mode 100644 index 0000000000000000000000000000000000000000..be8c0f9719a4aafa3ee6d6be989e60b632131131 Binary files /dev/null and b/app/nl_kr/deref.o differ diff --git a/app/nl_kr/deref.stp b/app/nl_kr/deref.stp new file mode 100644 index 0000000000000000000000000000000000000000..2e8db931acb5efb08ab22b57281a9925bad0935b --- /dev/null +++ b/app/nl_kr/deref.stp @@ -0,0 +1,11 @@ +# FILE deref.stp +# +# written: 1993-11-30 +# latest update: 1993-11-30 +# ------------------------- +-v + +[test] +-zvnf=xyz + + diff --git a/app/nl_kr/diff2ftr.pl b/app/nl_kr/diff2ftr.pl new file mode 100644 index 0000000000000000000000000000000000000000..747dcbb05005359ad6b8d375a4766adb1efcb002 --- /dev/null +++ b/app/nl_kr/diff2ftr.pl @@ -0,0 +1,73 @@ +# +# FILE %ta/diff2ftr.pl +# +# rewrite diff listing into hyx format for cross ref reading +# +# written: 1995-05-25 +# latest update: 1995-05-26 +# + +open (LEFT, ">_bak_ftr.ned/@left.ftr"); +open (RIGHT, ">_bak_ftr.ned/@right.ftr"); +print LEFT "0 6 9 0 10 1 1 32760\n"; +print RIGHT "0 6 9 0 10 1 1 32760\n"; + +while (<>) +{ + next if (/^< /||/^> /||/^---/); + chop; + + $l_r1= $l_r2= 0; + $l_l1= $l_l2= 0; + $l_l= ''; + $l_r= ''; + $c= ''; + + if (/a/) + { + ($l_l, $l_r)= split ('a'); + ($l_r1, $l_r2)= split (',', $l_r); + $c= 'a'; + } + + if (/d/) + { + ($l_l, $l_r)= split ('d'); + ($l_l1, $l_l2)= split (',', $l_l); + $c= 'd'; + } + + if (/c/) + { + ($l_l, $l_r)= split ('c'); + ($l_l1, $l_l2)= split (',', $l_l); + ($l_r1, $l_r2)= split (',', $l_r); + $c= 'c'; + } + + # print "$_: l=$l_l r=$l_r l1=$l_l1 l2=$l_l2 r1=$l_r1 r2=$l_r2\n"; + $l_l2= $l_l1 if ($l_l1 ne '' && $l_l2 eq ''); + $l_r2= $l_r1 if ($l_r1 ne '' && $l_r2 eq ''); + print "$_: l=$l_l r=$l_r l1=$l_l1 l2=$l_l2 r1=$l_r1 r2=$l_r2\n"; + + if ($l_r2 > 0) + { + for ($i= $l_r1; $i <= $l_r2; $i++) + { + print RIGHT "$i 0 1 <hyx.l tdc=12 tdp=78 name=\"$_\" file=\"@left\">\n"; + } + } + + if ($l_l2 > 0) + { + for ($i= $l_l1; $i <= $l_l2; $i++) + { + print LEFT "$i 0 1 <hyx.l tdc=12 tdp=78 name=\"$_\" file=\"@right\">\n"; + } + } + + print "$_\n" if ($c eq ''); +} + +close (LEFT); +close (RIGHT); diff --git a/app/nl_kr/docdir.awk b/app/nl_kr/docdir.awk new file mode 100644 index 0000000000000000000000000000000000000000..5eabb768225dee244b5d5b4b15e5bc293ba9fa6d --- /dev/null +++ b/app/nl_kr/docdir.awk @@ -0,0 +1,38 @@ +#!/bin/awk +# +# FILE docdir.awk +# +# generate docdir entries for given file names +# +# 1993-03-07 +# ---------------------------------------------------------------------------- +BEGIN { + docid=1001; +# def_sets=" set=\"nl_kr\""; + def_sets=""; + n_xsets=0; +} + { gsub ("\\\\","/"); } # don't ask my why my awk needs this! + { + pathc= split($1, path, "/"); + if (pathc > 1) { + sets=" set=\""path[1]"\""; + XSETS[path[1]]++; + if (XSETS[path[1]]==1) n_xsets++; + } else sets= def_sets; + hdr=" name=\"C source file "$1"\""; + printf ("<hyx.dd docid=\"%ld\" file=\"%s\"", docid, $1); + printf ("%s%s>\n", hdr, sets); + docid++; +} +END { + if (n_xsets > 0) { + printf ("# -------------------------------\n"); + printf ("# docs | set\n"); + printf ("# -------------------------------\n"); + for (s in XSETS) { + printf ("# %4d | %s\n", XSETS[s], s); + } + printf ("# -------------------------------\n"); + } +} diff --git a/app/nl_kr/gg b/app/nl_kr/gg new file mode 120000 index 0000000000000000000000000000000000000000..7b7c80811f4d282d5ba38a29e0f67cf0b8335b96 --- /dev/null +++ b/app/nl_kr/gg @@ -0,0 +1 @@ +../../lib/include/gg \ No newline at end of file diff --git a/app/nl_kr/lmd1.doc b/app/nl_kr/lmd1.doc new file mode 100644 index 0000000000000000000000000000000000000000..faf654f8993dd5fa2b123ae1ca7e7cddce64bd3d --- /dev/null +++ b/app/nl_kr/lmd1.doc @@ -0,0 +1,98 @@ + +FILE lmd1.doc + +Temporary documentation about the LM/D engine +in the Gopher environment. + +written: 1993-09-11 +latest update: 1993-09-29 + +------------------------------------------------------------------------------ + + +Embedding LM/D into Gopher as a Veronica-like service + +The LM/D (lutmake/deref) package can be embedded into gopher servers to +provide a veronica-style service, e.g. as a menu server for just one campus. + +The system consists of several modules, some are used to prepare data for +the server, others are called when someone initiates a search request. + +Major steps (overwiew): + + Phase Step Description +a. preparation GOPHSCAN scan complete servers for menus + + LUTMAKE generate lookup-tables and index + files from scanned gopher menus + +b. service DEREF return all items that match + a user's query + + +Notes: ++ GOPHSCAN is a REXX program that comes with the VieGOPHER package. ++ LUTMAKE, DEREF are part of a different package. They are written in + C and can be compiled for VM/CMS, various Unixes and MSDOS. + + + +------------------------------------------------------------------------------ +GOPHSCAN + +Gophscan is distributed with the VieGOPHER package. This program scans +through one or a group of gopher servers and produces one file named +GOPHSCAN.OUT. This file is essentially one large gopher menu. Servers +should be scanned from time to time or when major changes occur. + +Several files produced by GOPHSCAN can be combined into one larger +overall gopher menu just by concatinating them. + +The current version of GOPHSCAN runs only under VM/CMS, a version for +Unix will follow. + +Usage (#######) +GOPHSCAN <server>[:<port>] (1 or more) + +Each parameter for GOPHSCAN is the name and port of a gopher server. +If the port number is ommited, the standard port number 70 is assumed. +Gophscan will walk through all the menus of the named gopher servers. +It will not leave the area of the named servers. + + +------------------------------------------------------------------------------ +LUTMAKE + +LUTMAKE's role is to process one single (large) gopher menu produced +in the Gophscan-step to generate lookup tables and other index files +for the DEREF-phase. + +Usage +LUTMAKE -mv gophscan.out + +The flag -mv advises LUTMAKE to work in Veronica-mode, it will read +the input file and produces three files: +xxx.lut (lookup table) contains lexical information about + the words from gophscan.out and associates them with + an index into the xxx.wi file. +xxx.wi (word information) contains references for any indexed + word into the xxx.di structure +xxx.di (document information) contains identification codes + for any document indexed. + +In veronica mode, the document ID is the offset value of the beginning +of each line in the large gopher menu gophscan.out. Therefore, it's +not possible to index more than one file in veronica-mode at once. + + +------------------------------------------------------------------------------ +DEREF + +When a user formulates a search request, the program DEREF is called +to lookup the word in the lookup table (xxx.lut). With the word +information (xxx.wi) records pointing into the document identification +table, (xxx.di) the program will locate each line containing the +searched words in the large gopher menu file (gophscan.out) + +Usage: +DEREF -mvgophscan.out word diff --git a/app/nl_kr/lutdump b/app/nl_kr/lutdump new file mode 100755 index 0000000000000000000000000000000000000000..9c2db20c2272f517059bfa5c2f5cc70f3846dbca Binary files /dev/null and b/app/nl_kr/lutdump differ diff --git a/app/nl_kr/lutdump.c b/app/nl_kr/lutdump.c new file mode 100644 index 0000000000000000000000000000000000000000..37e94ee4bbc65760571992e4ba59af6b0c952034 --- /dev/null +++ b/app/nl_kr/lutdump.c @@ -0,0 +1,113 @@ +/* + * FILE %nl_kr/lutdump.c + * + * dump LUTs + * + * written: 1989 06 30 + * 1990 11 16: revision + * latest update: 1998-02-28 9:33:57 + * + */ +static char ID[]= "$Id: lutdump.c,v 1.2 2003/06/25 14:38:29 gonter Exp $"; + +#include <stdio.h> +#include <stdlib.h> +#ifdef MSDOS +#include <io.h> +#include <conio.h> +#endif +#include <gg/filename.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/sbr.h> +#include <gg/dpp.h> +#include <gg/lookup.h> + +#define STDHLP stdout +static int out_mode= 0; +static long dump_start= 0L; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: lutdump [options] {file name}\n", + "OPTIONS:\n", + " -r ... search recursively through the filesystem\n", + " -f<fnm> ... list of files\n", + " -s<pos> ... start of the dump in the file [DEF: 0x00000000]\n", + " -m<mode> ... format of the info value\n", + " ... 0: 0x%%08lX [DEF]\n", + " ... 1: %%5u %%5u\n", + " ... 2: nothing (just print the key string)\n", + "\n", + "(@)A lutdump.c 2.04 #D$2003-06-25 14:43:33\n", + ID, + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl lut_dump_main_fnc (char *wrd, void *client_data); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + char *arg; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; + + if (argc <= 1) goto HLP; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) return 1; + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, + lut_dump_main_fnc, (void *) 0); + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + + case 'm': case 'M': + out_mode= (int) get_parameter_value (arg+2); + break; + + case 's': case 'S': + dump_start= get_parameter_value (arg+2); + break; + + case 'r': case 'R': + wcrd2_set_subdirs (wcrd, 1); + break; + +HLP: +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + + wcrd2_arguments (wcrd, arguments); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int lut_dump_main_fnc (char *fn, void *cd) +{ +#ifdef MSDOS + cd; +#endif + + return lut_dump_file (fn, out_mode, dump_start); +} diff --git a/app/nl_kr/lutdump.o b/app/nl_kr/lutdump.o new file mode 100644 index 0000000000000000000000000000000000000000..2397bb60c9ed32c2c2d8a3256323ca6059a1007e Binary files /dev/null and b/app/nl_kr/lutdump.o differ diff --git a/app/nl_kr/lutmake b/app/nl_kr/lutmake new file mode 100755 index 0000000000000000000000000000000000000000..b33355b50953cab88e986787e5abf3078b546a02 Binary files /dev/null and b/app/nl_kr/lutmake differ diff --git a/app/nl_kr/lutmake.c b/app/nl_kr/lutmake.c new file mode 100644 index 0000000000000000000000000000000000000000..29a6c2cb344ff2c875eb273eb3d8ddf1248552fd --- /dev/null +++ b/app/nl_kr/lutmake.c @@ -0,0 +1,495 @@ +/* + * FILE %nl_kr/lutmake.c + * + * generate LUTs from different types of lookup tables and + * other files + * + * hot spots in this file: + * - HELP + * - prototypes + * - T2D + * + * written: 1989 03 29 + * 1990 11 16: Revision + * 1991 03 17: Revision; AIX + * 1993-02-28: complete redesign of the word reference system + * 1993-08-15: cooked stream mode + * latest update: 2001-01-28 22:33:46 + * $Id: lutmake.c,v 1.5 2002/07/04 18:08:49 gonter Exp $ + * + */ + +#define REAL_AUTHOR + +#include <stdio.h> +#include <stdlib.h> + +#ifdef MSDOS +#include <io.h> +#include <conio.h> +#endif + +#include <ctype.h> +#include <string.h> +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/hyx.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +#define STDHLP stdout + +#define MATCH_C_max 24 +static char *match_v [MATCH_C_max]; /* array of match sets */ +static int match_c= 0; /* number of sets to match */ + +#define FNM_SIZE 1024 +static char filenm [FNM_SIZE]; + +static int verbosity= 0; + +/* ------------------------------------------------------------------------ */ +static int read_mode= RM_words; + +/* statistics: ------------------------------------------------------------ */ +static long word_cnt= 0; +static long word_cnt_unique= 0; +static long total_bytes_read= 0; +extern long YTREE_ALLOCATED; +extern long YTREE_ALLOC_SIZE; +static int files_processed= 0; + +/* ------------------------------------------------------------------------ */ +static long fileid= 1L; +static int pre_read= 0; /* 1 -> LUT File vorher einlesen */ +static int tfb_position= 0; +static int tfb_delimiter= ':'; + +static struct LMDC_CONTROL *lmdc; +static struct WCRD *wcrd; +static struct ARRAY_CONTROL *arguments; + +/* filenames: ------------------------------------------------------------- */ +#ifndef __CMS__ +static char LUT_file [FNM_SIZE]= "xxx.lt"; /* lookup table */ +static char WR_file [FNM_SIZE]= "xxx.wr"; /* word reference */ +static char DI_file [FNM_SIZE]= "xxx.di"; /* document information */ +#define DOCDIR_DD "docdir.dd" +#else +static char LUT_file [FNM_SIZE]= "xxx.lt.a"; /* lookup table */ +static char WR_file [FNM_SIZE]= "xxx.wr.a"; /* word reference */ +static char DI_file [FNM_SIZE]= "xxx.di.a"; /* document information */ +#define DOCDIR_DD "docdir.dd.a" +#endif + +/* ------------------------------------------------------------------------ */ +static int alphabet [256]; +static char *default_alphabet= + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$"; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: lutmake [options] {file name}\n", + "OPTIONS:\n", + " -f<fnm> ... parameter file\n", + " -b<fnm> ... simple batch file format\n", + " -c<fnm> ... cooked data stream file format (see also: -ms)\n", + " -l<lut> ... name of the LUT file; .wr and .di file follow\n", + " -t[<fnm>] ... docdir table [DEF: docdir.dd]\n", + " -d<id> ... discard reference to document ids\n", + " -r ... pre read LUT\n", + " -mw ... read words [DEF]\n", + " -m2 ... read TOKENS (alpha pre-release version)\n", + " -mf ... read frequency table (set): code count word\n", + " -ml ... read long frequency table (add): count word\n", + " -mv ... read veronica file\n", + " -ms ... cooked stream mode\n", + " -mt ... read tfb file\n", + " -mc ... read hyx cluster\n", + " -min<n> ... minimal word length; [DEF: 3]\n", + " shorter words are ignored\n", + " -max<n> ... maximal word length; [DEF: 24]\n", + " longer words are truncated\n", + " -nh<n> ... number of maximum hits to drop a stop word [DEF: 1000]\n", + " -nr<n> ... highest rank of stop words [DEF: 1000]\n", + " -s<set> ... name of sets to process; [DEF: take everything]\n", + " -of<n> ... set TFB field number\n", + " -od<c> ... set TFB delimiter to <c>\n", + " -i<id> .. file id code:\n", + " id < 0 .. stop words\n", + " id = 0 .. hit words\n", + " id > 0 .. normal document for reference\n", + " -v ... increase verbosity\n", + " -xs<str> ... set alphabet string to <str> [DEF: a-z,A-Z,0-9,_,$,*]\n", + " -xa<str> ... add string <str> to alphabet\n", + " -xd<str> ... delete string <str> from alphabet\n", + "\n", + "(@)Alutmake.c 3.11 #D$2002-07-04 20:07:34\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl interpret_parameter (char *par); +int cdecl lut_make (char *fn, void *cd); +int cdecl set_alphabet (char *s); +int cdecl set_lut_file (char *fnm); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + long rv; + + if (argc <= 1) goto HLP; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + || (lmdc= lmd_create_control ()) == (struct LMDC_CONTROL *) 0 + ) + { + fprintf (stderr, "fatal error: can't create control structure!\n"); + return 1; + } + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, lut_make, + (void *) lmdc); + set_alphabet (default_alphabet); + + for (i= 1; i < argc; i++) + switch (interpret_parameter (argv [i])) + { + case 0: + break; + +HLP: +#include <gg/help.inc> + } + + /* Lese Vorbereitung ------- */ + switch (read_mode) + { + case RM_hyx_cluster: + case RM_tokens: + case RM_stream: + case RM_tfb: + case RM_veronica: + if (pre_read) + { + long words_in_wr_table; + + lmd_RL4 (lmdc, LUT_file); + words_in_wr_table= lmd_read_tables (lmdc, WR_file, DI_file); + } + break; + default: + if (pre_read) lmd_RL4 (lmdc, LUT_file); + break; + } + + lmdc->LMDC_verbosity= verbosity; + if (array_elements (arguments)) + { + char *arg; + + while ((arg= (char *) array_shift (arguments)) != (char *) 0) + { + if (arg [0] == '-') + { + switch (arg [1]) + { + case 'f': case 'F': + if ((fi2= fopen (arg+2, "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", arg+2); + break; + } + for (;;) + { + j= fread_line (fi2, filenm, FNM_SIZE); + if (j <= 0 && feof (fi2)) break; + if (filenm [0] == '-') + { + if (interpret_parameter (filenm) == -1) + goto HLP; + } + else wcrd2_wildcards (wcrd, filenm); + } + fclose (fi2); + break; + case 'd': case 'D': + lmd_discard_document_id (lmdc, get_parameter_value(arg+2)); + break; + case 'b': case 'B': + if ((rv= lmd_batch_process (lmdc, arg+2, verbosity)) > 0L) + word_cnt += rv; + break; + case 'i': case 'I': + fileid= get_parameter_value (arg+2); + break; + case 'c': case 'C': + if ((rv= lmd_read_stream (lmdc, arg+2)) > 0L) + word_cnt += rv; + break; + case 0: + lut_make ("-", (void *) lmdc); + } + } + else wcrd2_wildcards (wcrd, arg); + } + } + + printf ("%d files processed; %ld bytes_read\n", + files_processed, total_bytes_read); + + switch (read_mode) + { + case RM_hyx_cluster: + case RM_tokens: + case RM_veronica: + case RM_stream: + case RM_tfb: + printf ("processing word list and writing reference tables\n"); + lmd_write_tables (lmdc, WR_file, DI_file, LMDD_mode_full); + break; + } + + word_cnt_unique= (long) lmd_PL (lmdc->LMDC_ytree, LUT_file, (char *) 0); + printf ("%ld words, %ld unique\n", word_cnt, word_cnt_unique); + lmd_print_04statistics (lmdc, stdout); + + printf ("%ld YTREE-nodes using %ld byte\n", + YTREE_ALLOCATED, YTREE_ALLOC_SIZE); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int interpret_parameter (char *par) +{ + int j; + int ch; + long rv; + + if (par [0] == '-') + switch (par [1]) + { + case 'b': case 'B': + case 'd': case 'D': + case 'f': case 'F': + case 'i': case 'I': + case 'c': case 'C': + if (par [2] == 0) break; + array_push (arguments, (void *) par); + break; + + case 't': case 'T': + if ((rv= lmd_docdir_process (lmdc, + (par [2] == 0) ? DOCDIR_DD : par+2, + match_c, match_v, verbosity)) + > 0L) word_cnt += rv; + read_mode= RM_tokens; + break; + + case 'l': case 'L': + if (!par [2]) break; + set_lut_file (par+2); + break; + + case 'r': case 'R': + case 'v': case 'V': + for (j= 1; par [j]; j++) + switch (par [j]) + { + case 'r': + pre_read= 1; + break; + case 'v': case 'V': + verbosity++; + break; + case 'R': + wcrd2_set_subdirs (wcrd, 1); + break; + default: return -1; + } + break; + + case 'm': case 'M': + switch (par [2]) + { + case 'c': case 'C': read_mode= RM_hyx_cluster;break; + case 'w': case 'W': read_mode= RM_words; break; + case 'v': case 'V': read_mode= RM_veronica; break; + case 'f': case 'F': read_mode= RM_fcy; break; + case 'l': case 'L': read_mode= RM_lfcy; break; + case '2': read_mode= RM_tokens; break; + case 's': case 'S': read_mode= RM_stream; break; + case 't': case 'T': read_mode= RM_tfb; break; + break; + + case 'a': case 'A': + ch= par [3]; + if (ch == 'x' || ch == 'X') + lmdc->LMDC_max_wordlength= (int) get_parameter_value (par+4); + break; + case 'i': case 'I': + ch= par [3]; + if (ch == 'n' || ch == 'N') + lmdc->LMDC_min_wordlength= (int) get_parameter_value (par+4); + break; + default: return -1; + } + break; + + case 'n': case 'N': + switch (par [2]) + { + case 'h': case 'H': + lmdc->LMDC_max_word_count= get_parameter_value (par+3); + break; + case 'r': case 'R': + lmdc->LMDC_stop_word_limit= get_parameter_value (par+3); + break; + default: return -1; + } + break; + + case 'o': case 'O': + switch (par [2]) + { + case 'd': case 'D': + tfb_delimiter= par [3]; + break; + case 'f': case 'F': + tfb_position= (int) get_parameter_value (par+3); + break; + default: return -1; + } + break; + + case 's': case 'S': + if (match_c+1 < MATCH_C_max) match_v [match_c++]= par+2; + break; + + case 'x': case 'X': + switch (par [2]) + { + case 'a': case 'A': + put_chartable (alphabet, par+3, 1); + break; + case 'd': case 'D': + put_chartable (alphabet, par+3, 0); + break; + case 's': case 'S': + set_alphabet (par+3); + break; + default: return -1; + } + break; + + case 0: goto IS_PAR; /* - means stdin */ + default: return -1; + } + else + { +IS_PAR: + array_push (arguments, (void *) par); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int lut_make (char *fn, void *cd) +{ + long rv= 0L; + struct LMDC_CONTROL *lmdc; + + lmdc= (struct LMDC_CONTROL *) cd; + + switch (read_mode) + { + case RM_words: + rv= lmd_read_words (lmdc, fn); + break; + + case RM_fcy: + rv= lmd_read_fcy (lmdc, fn); + break; + + case RM_lfcy: + rv= lmd_read_long_fcy (lmdc, fn); + break; + + case RM_tokens: + { + char docid_str [10]; + + long_to_hex (fileid, docid_str); + rv= lmd_read_tokens (lmdc, fn, fileid, docid_str, 0L, 0L, + 0x7FFFFFFFL, verbosity); + if (fileid > 0L) fileid++; + } + break; + + case RM_veronica: + rv= lmd_veronica_process (lmdc, fn, alphabet); + break; + + case RM_stream: + rv= lmd_read_stream (lmdc, fn); + break; + + case RM_tfb: + rv= lmd_read_tfb (lmdc, fn, tfb_position, tfb_delimiter, alphabet); + break; + + case RM_hyx_cluster: + { + char *fn_idx; + + set_lut_file (fn); + fnmcpy (LUT_file, fn, ".lt"); + if ((fn_idx= fnmcpy2 (fn, ".idx")) != (char *) 0) + { + rv= lmd_read_hyx_cluster (lmdc, fn, fn_idx, alphabet); + free (fn_idx); + } + } + break; + + default: + return -1; + } + + if (rv > 0L) word_cnt += rv; + files_processed++; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int set_alphabet (char *s) +{ + int i; + + for (i= 0; i < 256; i++) alphabet [i]= 0; + return put_chartable (alphabet, s, 1); +} + +/* ------------------------------------------------------------------------ */ +int set_lut_file (char *fnm) +{ + strcpy (LUT_file, fnm); + fnmcpy (WR_file, LUT_file, ".wr"); + fnmcpy (DI_file, LUT_file, ".di"); + + return 0; +} diff --git a/app/nl_kr/lutmake.o b/app/nl_kr/lutmake.o new file mode 100644 index 0000000000000000000000000000000000000000..e1852393b0c162730c01f8554e7da83e83f1a280 Binary files /dev/null and b/app/nl_kr/lutmake.o differ diff --git a/app/nl_kr/lutprint.c b/app/nl_kr/lutprint.c new file mode 100644 index 0000000000000000000000000000000000000000..57d06b5cda959838e0066884c90ec1e0e1b6e084 --- /dev/null +++ b/app/nl_kr/lutprint.c @@ -0,0 +1,161 @@ +/* + * FILE %usr/nl_kr/lutprint.c + * + * Sortieren und Ausgeben von LUT-Dumps mit Analyse Info + * - HELP + * - prototypes + * + * written: 1991 02 16 + * 1991 03 19: Revision; AIX + * latest update: 1995-07-09 + * $Id: lutprint.c,v 1.2 2001/08/26 23:25:54 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/filename.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/lookup.h> + +#define STDHLP stdout + +/* ------------------------------------------------------------------------ */ +static int verbose_mode = 0; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: lutprint [options] {file name}\n", + "OPTIONS:\n", + " -f<fnm> ... list of files\n", +#ifdef SUBDIRS + " -s -r ... subdirs\n", +#endif + " -v ... verbose mode\n", + "\n", + "(@)Alutprint.c 2.03 #D$2001-08-25 23:32:13\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl lutprint (char *fn, void *cd); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + char *arg; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; + + + if (argc <= 1) goto HLP; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) return 1; + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, + lutprint, (void *) 0); + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + + case 'r': case 'R': + case 's': case 'S': + case 'v': case 'V': + for (j= 1; argv [i][j]; j++) + switch (argv [i][j]) + { + case 'r': case 'R': + case 's': case 'S': + wcrd2_set_subdirs (wcrd, 1); + break; + case 'v': case 'V': + verbose_mode++; + break; + default: + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + + wcrd2_arguments (wcrd, arguments); + +STOP: + print_sorted (stdout); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int lutprint (char *fn, void *cd) +{ + FILE *fi; + long word_count; +#define WORT_SIZE 256 + char wort [WORT_SIZE]; + int wc= 0; + int rc; + char *fields [2]; + long total_word_count= 0; + +#ifdef MSDOS + cd; +#endif + + fprintf (stderr, "Processing file %s\n", fn); + if ((fi= fopen (fn, "r")) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -2; + } + + for (;;) + { + rc= fread_line (fi, wort, WORT_SIZE); + if (rc <= 0 && feof (fi)) break; + + if (isolate_tokens (wort, fields, 2) != 2) continue; + + word_count= get_parameter_value (fields [0]); + sort_by_frequency (fields [1], word_count); + wc++; + total_word_count += word_count; + if ((wc % 100) == 0) fprintf (stderr, "Words: %6d\r", wc); + } + + fprintf (stderr, "Words: %6d\n... done\n", wc); + fprintf (stdout, "Words: %6d; total words: %7ld\n", + wc, total_word_count); + + fclose (fi); + + return 0; +} diff --git a/app/nl_kr/luttest b/app/nl_kr/luttest new file mode 100755 index 0000000000000000000000000000000000000000..ebcd257b23f6e28c720a3c28c520bc49f5e6999e Binary files /dev/null and b/app/nl_kr/luttest differ diff --git a/app/nl_kr/luttest.c b/app/nl_kr/luttest.c new file mode 100644 index 0000000000000000000000000000000000000000..a388696308b6c14eba6864712ab4f368081e8161 --- /dev/null +++ b/app/nl_kr/luttest.c @@ -0,0 +1,158 @@ +/* + * FILE %nl_kr/luttest.c + * + * Worte in LUT nachsehen + * - HELP + * + * written: 1989 04 17 + * latest update: 2000-01-06 18:50:48 + * $Id: luttest.c,v 1.3 2001/09/10 06:58:36 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/lookup.h> +#include <gg/filename.h> +#include <gg/array.h> +#include <gg/wildcard.h> + +#define MAX_LINE 4096 +static char line [MAX_LINE]; + +static int modus= 1; /* 0 -> LUT im RAM, sonst -> LUT auf FILE */ + +static char *lut_file_name= (char *) 0; +static char tfb_file_name [256]; +static struct LMDT_CONTROL *lmdt; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: luttest [options] {file name}\n", + "OPTIONS:\n", + " -m ... LUT in memory (must be done before -l<fnm>)\n", + " [DEF: LUT will be on file}\n", + " -f<fnm> ... list of files\n", + " -l<fnm> ... lookup table (binary)\n", + " -t[<fnm>] ... optional TFB file\n", + "\n", + "(@)Aluttest.c 3.03 #D$2000-01-06 18:51:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl luttest (char *fn, void *cd); +void cdecl luttest_manual (void); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + char *arg; + int i, j; + int lut_eingelesen= 0; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + || (lmdt= lmdt_control_new ()) == (struct LMDT_CONTROL *) 0) + { + fprintf (stderr, "fatal error: can't create control structure!!\n"); + return 1; + } + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, luttest, (void *) 0); + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + case 'm': case 'M': + modus= 0; + break; + case 'l': case 'L': + lut_file_name= arg+2; + lmd_RL3 (lmdt, lut_file_name, modus); + lut_eingelesen= 1; + break; + case 't': case 'T': + if (arg [2] == 0) + { + if (lut_eingelesen == 0) goto HLP; + fnmcpy (tfb_file_name, lut_file_name, ".tfb"); + lmd_RL3_set_tfb_file (lmdt, tfb_file_name); + } + else lmd_RL3_set_tfb_file (lmdt, arg+2); + break; + +HLP: +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + + if (!lut_eingelesen) lmd_RL3 (lmdt, "xxx.lut", modus); + + if (array_elements (arguments)) + { + wcrd2_arguments (wcrd, arguments); + } + else luttest_manual (); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int luttest (char *fn, void *cd) +{ + FILE *fi; + + if ((fi= fopen (fn, "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", fn); + return -1; + } + + for (;;) + { + int lng; + lng= fread_line (fi, line, MAX_LINE); + if (lng <= 0 || feof (fi)) break; + lmd_TWF (lmdt, line); + } + fclose (fi); + return 0; +} + +/* ------------------------------------------------------------------------ */ +void luttest_manual () +{ + for (;;) + { + printf ("Wort >"); + scanf ("%s", line); + + if (feof (stdin) + || line [0]=='\\' + || strcmp (line, ".") == 0 + ) break; + + lmd_TWF (lmdt, line); + if (strcmp (line, "quit") == 0) break; + } +} diff --git a/app/nl_kr/luttest.o b/app/nl_kr/luttest.o new file mode 100644 index 0000000000000000000000000000000000000000..e6869d5dafa289e01b8a05d64f306828adb0e03d Binary files /dev/null and b/app/nl_kr/luttest.o differ diff --git a/app/nl_kr/make-dos b/app/nl_kr/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..4ec66edb52e66738f95753282a9493e48f1dc4d9 --- /dev/null +++ b/app/nl_kr/make-dos @@ -0,0 +1,100 @@ +# +# FILE %nl_kr/make-dos +# +# makefile for MSDOS using MSC 5.0 and Zorland make +# +# Natural Language and Knowledge Representation +# + lutmake/deref fulltext retrieval engine +# +# written: 1989-03-29 +# latest update: 1996-12-22 21:19:34 +# +# ============================================================================ +cml=cl -Od -AL /Fo$@ /W3 /c +ccl=cl -Od -AL +obj=objdec -w -d -m0 -sl 2 NLKR_TEXT +map=\dev\nul +lib=c:\usr\sbr\lsbr +bin=c:\bin\ + +DS=\usr\ds\hyxta\ + +all : all.exe #all.doc + +all.exe : $(bin)lutmake.exe $(bin)luttest.exe $(bin)lutdump.exe ! + $(bin)lutprint.exe $(bin)deref.exe ! + $(bin)ta.exe $(bin)tasgml.exe + +all.obj : lutmake.obj luttest.obj lutdump.obj ! + lutprint.obj deref.obj + +all.doc : lmd.tex + +# ---------------------------------------------------------------------------- +nl_kr.sh : + shar -c -t nl_kr.sh -fmakeshar.lst + +# ---------------------------------------------------------------------------- +lmd.tex : lmd.hyx + hyxseq -vvvv -Olmd._01 lmd.hyx + chksgml -Olmd._02 lmd._01 + command /c awk " {print}" lmd._02 >lmd.tex + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +# ---------------------------------------------------------------------------- +# \usr\ds\lmd\nl_00501.c +$(bin)lutmake.exe : lutmake.obj \usr\ds\lmd\nl_00501.obj + link $**,$(bin)lutmake.exe,$(map),$(lib)/NOE/NOI; + +$(bin)luttest.exe : luttest.obj + link luttest,$(bin)luttest.exe,$(map),$(lib)/NOE/NOI; + +$(bin)lutdump.exe : lutdump.obj + link lutdump,$(bin)lutdump,$(map),$(lib)/NOE/NOI; + +$(bin)lutprint.exe : lutprint.obj + link lutprint,$(bin)lutprint,$(map),$(lib)/NOE/NOI; + +# ---------------------------------------------------------------------------- +$(bin)deref.exe : deref.obj \usr\ds\lmd\nl_00139.obj + link $**,$(bin)deref,$(map),$(lib)/NOE/NOI; + +# ---------------------------------------------------------------------------- +TA_MOD= $(DS)hyxta005.obj +$(bin)ta.exe : ta.obj $(TA_MOD) + link $**,$(bin)ta,$(map),$(lib)/NOE/NOI; + +$(bin)tasgml.exe : tasgml.obj + link $**,$(bin)tasgml,$(map),$(lib)/NOE/NOI; + +# _RELICS_ =================================================================== +all2.exe : $(bin)nltest.exe nl01.obj $(bin)dicmerge.exe + +# ---------------------------------------------------------------------------- +nltest.obj : nltest.c design.h + $(cml) nltest.c + $(obj) nltest.obj + +$(bin)nltest.exe : nltest.obj + link nltest,$(bin)nltest,$(map),$(lib)/NOE/NOI; + +# ---------------------------------------------------------------------------- +dicmerge.obj : dicmerge.c + $(cml) dicmerge.c + $(obj) dicmerge.obj + +$(bin)dicmerge.exe : dicmerge.obj + link dicmerge,$(bin)rdicmerge.exe,$(map),$(lib)/NOE/NOI; + +# ---------------------------------------------------------------------------- +lookup01.obj : lookup01.c + $(cml) lookup01.c + lib $(lib)-+lookup01; + +nl01.obj : nl.h nl01.c + $(cml) nl01.c + lib $(lib)-+nl01; diff --git a/app/nl_kr/makeshar.lst b/app/nl_kr/makeshar.lst new file mode 100644 index 0000000000000000000000000000000000000000..1c9fea3c03c89f475d0869e2c006458b11ef8918 --- /dev/null +++ b/app/nl_kr/makeshar.lst @@ -0,0 +1,33 @@ +# +# FILE %nl_kr/makeshar.lst +# +# copy all necessary files into a shar file +# +# written: 1993-03-07 +# latest update: 1996-12-12 12:41:40 +# +# --------------------------------------------------------------------------- +>mkdir _bak_ftr.ned +# docu... +a lmd.tex lmd.tex +a lmd.hyx lmd.hyx +>echo "... but that's ok!" +a lmd1.doc lmd1.doc +a makeshar.lst Contents +a make-ux make-ux +a make-dos make-dos +a (dirinf).fm '(dirinf)'.fm + +>ln -s make-ux Makefile +>ln -s '(dirinf).fm' Files +>ln -fs ../gg + +# main modules +a deref.c deref.c +a lutmake.c lutmake.c +a lutdump.c lutdump.c +a luttest.c luttest.c +a c:/etc/lexicon/top200.lst top200.lst + +a ta.c ta.c +a tasgml.c tasgml.c diff --git a/app/nl_kr/possig.awk b/app/nl_kr/possig.awk new file mode 100644 index 0000000000000000000000000000000000000000..9418fe997a1a92ba3b455e83e4488a2a6ae519ce --- /dev/null +++ b/app/nl_kr/possig.awk @@ -0,0 +1,109 @@ +BEGIN { + fn=""; + fn2=""; + fp=0; + print "0 0 0 0 10 1 1 0" >"@$.ftr" + print "searching..." >"@$.pos" + al=2; +} +FILENAME!=fn2 { + print FILENAME + fn2=FILENAME; +} + + { wflg=0; } + +# include file checks -------------------------------------------------------- +#/include/ { +# x=$0; +# s1 = gsub (/\"/, "\"", x); +# s2 = gsub (/\\/, "/", x); +# s2+= gsub (/\//, "/", x); +# if (substr(x,1,1) == "#" && s1 > 0 && s2 > 0) prt(" \""); +#} +# /ed.h/ { next } +# /edhyx.h/ { next } +# /proto.h/ { next } +# /window.h/ { next } +# /message.h/ { next } +# /stdio.h/ { next } +# /string.h/ { next } +# /strings.h/ { next } +# /maus.h/ { next } +# /keys.h/ { next } +# /malloc.h/ { next } +# /include/ { prt("include"); } +# ---------------------------------------------------------------------------- + +#/FTR_display_replarray/ { prt("FTR_display_replarray"); } +#/ftr_replarray_size/ { prt("ftr_replarray_size"); } +#/highest_index/ { prt("highest_index"); } +#/next_index/ { prt("next_index"); } +#/IDX_REC_SIZE/ { prt("IDX_REC_SIZE"); } +#/12/ { prt("12"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/DI_pos/ { prt("DI_pos"); } +#/set_location_code/ { prt("set_location_code"); } +# --- +# /LMDC_word_index/ { prt("LMDC_word_index"); } +#/<malloc.h>/ {next} +# /lmd_create_word_ref_list/ { prt("lmd_create_word_ref_list"); } +# WORD_REF and WORD_REF_LIST +/WR_count/ { prt("WR_count"); } +#/WR_docinfo_count/ { prt("WR_docinfo_count"); } +#/WORD_REF_SIZE/ { prt("WORD_REF_SIZE"); } +#/DOCUMENT_INFO_LIST/ { prt("DOCUMENT_INFO_LIST"); } +#/bin_to_hex/ { prt("bin_to_hex"); } +#/lmd_discard_doc/ { prt("lmd_discard_doc"); } +# ------ 1995-12-05 14:44:51 +# /MAX_DI_POS/ { prt("MAX_DI_POS"); } +# /DI_pos/ { prt("DI_pos"); } +#/LMDC_cnt_sw_idx/ { prt("LMDC_cnt_sw_idx"); } +# /lmd_insert_document_info/ { prt("lmd_insert_document_info"); } +# /lmd_set_location_code/ { prt("lmd_set_location_code"); } +# ------ 1995-12-05 14:44:51 +# later: +#/LMDC_cnt/ { prt("LMDC_cnt"); } +#/DIL_next/ { prt("DIL_next"); } +# --- +#/lmd_get_word_ref/ { prt("lmd_get_word_ref"); } +#/set_new_word_index/ { prt("set_new_word_index"); } +#/print_04statistics/ { prt("print_04statistics"); } +#/read_document_info_list/ { prt("read_document_info_list"); } +#/DI_hit_count/ { prt("DI_hit_count"); } +#/DI_document_id/ { prt("DI_document_id"); } +#/design.h/ { prt("design.h"); } +#/lut_word_match/ { prt("lut_word_match"); } +#/<gg\// { prt("<gg/"); } +#hyx.l/ { prt("hyx.l"); } + +# ---------------------------------------------------------------------------- +wflg!=0 { + print FILENAME" ("FNR"): ", $0 >>"@$.pos"; + al++; +} + +function prt(t) { +# if (FILENAME != fn || fp != FNR) { + cs=1; + if (FNR >= 10) cs++; + if (FNR >= 100) cs++; + if (FNR >= 1000) cs++; + if (FNR >= 10000) cs++; + cl=length(t); + for (cx=length($0);cx>0;cx--) if (substr($0,cx,cl) == t) { + printf al" "cx+5+cs+length(FILENAME)" 1 " >>"@$.ftr"; + printf "<hyx.l file=\""FILENAME"\" ln="FNR" cn="cx-1 >>"@$.ftr"; + print " tdc=79 tdp="cl">" >>"@$.ftr"; + } + wflg=1; +# } + fn = FILENAME; + fp = FNR; +} diff --git a/app/nl_kr/possig.bat b/app/nl_kr/possig.bat new file mode 100644 index 0000000000000000000000000000000000000000..965de5342cfdf8caeb824faf933bc54ae60693f7 --- /dev/null +++ b/app/nl_kr/possig.bat @@ -0,0 +1,2 @@ +awk possig /c5/include/gg/lookup.h /usr/ds/lmd/*.c *.c +copy @$.ftr _bak_ftr.ned diff --git a/app/nl_kr/rfc2hyx.awk b/app/nl_kr/rfc2hyx.awk new file mode 100644 index 0000000000000000000000000000000000000000..5ece74e99867fe5ad7f1716efb2bbffdfd394e44 --- /dev/null +++ b/app/nl_kr/rfc2hyx.awk @@ -0,0 +1,106 @@ +# +# FILE rfc2hyx.awk +# +# reformat a streamed RFC into HYX format +# +# written: 1994-04-15 +# latest update: 1995-05-11 +# +BEGIN { + fnm_top= "tmp/@1.t"; + fnm_hyx= "tmp/@1.h"; + fnm_crf= "tmp/@1.c"; + + print "<Frame $$root>">fnm_top; + printf "">fnm_hyx; + printf "">fnm_crf; + + st= 0; + frame_open= 0; + frame_counter= 0; + frame_name= ""; + last_frame= "$$root"; + +# cross references + server= "http://www.wu-wien.ac.at:8082/rfc/"; +} + +/^Status of [Tt]his [Mm]emo$/ \ + || /^Status of the Memo$/\ + || /^1./&&/Status of this Memo$/\ + || /^Status of [Tt]his [Dd]ocument$/ { + st= 1; +} + + { + gsub("\\\&", "\\&"); + gsub("<", "\\<"); + gsub(">", "\\>"); +} + +st==0 { + print >>fnm_top; + next; +} + +$0!="" && substr($0,1,1) != " " && substr($0,1,1) != "\t"\ + && !/--/ && !/^RFC-/\ + && substr($0,1,1) != "*"\ + && substr($0,1,1) != "\&" && substr($0,1,1) != "+" && substr($0,1,1) != "-"\ + && substr($0,1,1) != "\"" && substr($0,1,1) != "{" && substr($0,1,1) != "}"\ + && !/^Help: / && !/^Retrieve: / && !/^List: / \ + && !/^Record lease,/ \ + && substr($0,1,1) != "|" && substr($0,1,1) != "<" && substr($0,1,1) != "]" { + + # a new section means a new frame + # find out which section this is and generate a new frame name + section= $0; + print "section: "section + frame_name= FILENAME"."frame_counter++; + for (i= 1; i<=NF; i++) frame_name= frame_name" "$(i); + + # print closing info into previous frame + if (frame_open == 1) { + printf ("<hyx.l fr=\"%s\" dir=next>", frame_name)>>fnm_hyx; + print "</Frame>" >>fnm_hyx; + } + + # print opening info into new frame + printf "<Frame "frame_name">" >>fnm_hyx; + printf "<hyx.l fr=\""last_frame"\" dir=prev>" >>fnm_hyx; + print "<hyx.l fr=\"$$root\" dir=up>" >>fnm_hyx; + print "<title>"section"</title>" >>fnm_hyx; + print "<h2>"section"</h2>" >>fnm_hyx; + + # print a link into the $$root frame + printf "<hyx.l fr=\""frame_name"\" tdc=31">>fnm_top; + if (frame_counter == 1) printf " dir=next">>fnm_top; + print " tdp="length(section)">"section >>fnm_top; + + frame_open= 1; + last_frame= frame_name; + next; +} + + { + print >>fnm_hyx; +} + +END { + if (frame_open == 1) { + printf "<hyx.l fr=\"$$root\" dir=next>" >>fnm_hyx; + print "</Frame>" >>fnm_hyx; + } + + # write final links etc to the $$root frame + print "<hyx.l fr=\""last_frame"\" dir=prev>" >>fnm_top; + print "<hyx.l fr=\"$$index\" tdp=7>$$index">>fnm_top; + # printf "<hyx.l fr=\"$$notes\" tdp=7>$$notes">>fnm_top; + # print ", e.g. bookmarks and annotations">>fnm_top; + print "</Frame>" >> fnm_top; + + # write a dummy $$notes frame + print "<Frame $$notes>">>fnm_top; + print "* latest stop">>fnm_top; + print "</Frame>" >> fnm_top; +} diff --git a/app/nl_kr/rfc2hyx.bat b/app/nl_kr/rfc2hyx.bat new file mode 100644 index 0000000000000000000000000000000000000000..4629874734e2fc87980363e20a2fd5f52a9c9386 --- /dev/null +++ b/app/nl_kr/rfc2hyx.bat @@ -0,0 +1,4 @@ +awk stream2.awk %1.txt >%1 +awk rfc2hyx.awk %1 +copy/b tmp\@1.h + tmp\@1.t %1.hyx +hyxidx -i %1.hyx diff --git a/app/nl_kr/rfc2hyx.pl b/app/nl_kr/rfc2hyx.pl new file mode 100644 index 0000000000000000000000000000000000000000..548318e4b1e533cd5e6c68bd16922064d2de2ac9 --- /dev/null +++ b/app/nl_kr/rfc2hyx.pl @@ -0,0 +1,212 @@ +#!/usr/local/bin/perl +# +# FILE rfc2hyx.awk +# +# reformat a streamed RFC into HYX format +# +# written: 1994-04-15 +# 1995-07-14: rewritten from AWK to Perl +# latest update: 1995-07-14 +# $Id: rfc2hyx.pl,v 1.2 2012/08/10 15:21:00 gonter Exp $ +# +# ---------------------------------------------------------------------------- + +use strict; + +# $fnm_top= 'tmp/@1.t'; +# $fnm_hyx= 'tmp/@1.h'; +# $fnm_crf= 'tmp/@1.c'; + + +# cross references +my $server= 'http://www.wu-wien.ac.at:8082/rfc/'; +my $server2= 'http://www.wu-wien.ac.at:8082/rfc/rfc'; + +my @RFCs; + +while (my $arg= shift (@ARGV)) +{ + if ($arg =~ /^-/) + { + &usage; + } + else + { + push (@RFCs, $arg); + } +} + +while (my $arg= shift (@RFCs)) +{ + &convert_rfc ($arg); +} + +exit(0); + +sub convert_rfc +{ + my $fnm= shift; + + my $rfc_name; + + if ($fnm =~ /(RFC\d+)\.(txt|tmp)/i) { $rfc_name= $1; } + + unless ($rfc_name) + { + print "no RFC name dedected in [$fnm]\n"; + } + + print "converting RFC [$rfc_name]\n"; + + my $fnm_top= $rfc_name .'.top'; + my $fnm_hyx= $rfc_name .'.hyx'; + + open (FNM_TOP, '>' . $fnm_top); + open (FNM_HYX, '>' . $fnm_hyx); + # open (FNM_CRF, '>' . $rfc_name .'.crf'); + print FNM_TOP "<Frame \$\$root>\n"; + + open (FI, $fnm) or die; + + # variables for the state engine + my $st= 0; + my $st2= 0; + + my $frame_open= 0; + my $frame_counter= 0; + my $frame_name= ''; + my $last_frame= '$$root'; + +line: while (<FI>) +{ + chop; + + $st= 1 if (/^Status of [Tt]his [Mm]emo$/ + || /^Status of the Memo$/ + || (/^Abstract/ && $rfc_name eq 'rfc1305') + || /^1./ && /Status of this Memo$/i + || /^Status of [Tt]his [Dd]ocument$/i); + $st= 2 if (/^Appendix/); + + s/&/&/g; + s/</</g; + s/>/>/g; + + my @Fld= split(' ', $_, 9999); + + if ($st == 0) + { + s/(RFC[ \-]{0,1}(\d+))/<a href=$server2$2.hyx\/\$\$root>$1<\/a>/g; + print FNM_TOP $_."\n"; + next line; + } + + my $is_new_frame= 0; + + $is_new_frame= 1 + if ($_ ne '' + && $st == 1 + && (!((substr($_, 0, 1) =~ /[ \t\*&\+\-\"\{\}\<>\[\]]/) + || /\|/ + || /--/ || /^RFC-/ + || /^Help: / || /^Retrieve: / || /^List: / || /^Record lease,/))); + + if ($st == 1 + && ($rfc_name eq 'rfc1800' || $rfc_name eq 'rfc1035' || $rfc_name eq 'rfc1305' + || $rfc_name eq 'rfc1034' || $rfc_name eq 'rfc1123')) + { + $is_new_frame= (/^[ ]*[\d\.]+\. /) ? 1 : 0; + } + + if ($st == 1 + && ($rfc_name eq 'rfc1006' || $rfc_name eq 'rfc1801' || $rfc_name eq 'rfc1804' + || $rfc_name eq 'rfc1738')) + { + $is_new_frame= (/^[\d\.]+\. /||/^[A-Z] /) ? 1 : 0; + } + + if ($st == 1 && ($rfc_name eq 'rfc1807' || $rfc_name eq 'rfc1357')) + { + $st2= 1 if (/EXAMPLE$/); + $st2= 0 if (/End of Example/); + $is_new_frame= 0 if ($st2 == 1 || /^WITHDRAW/ || / -- /); + } + + if ($st == 2) + { # in the appendix only match on boundaries + $is_new_frame= (/Appendix/) ? 1 : 0; + } + + if ($is_new_frame == 1) + { # a new section means a new frame + # find out which section this is and generate a new frame name + my $section= $_; + print "section: [$section]\n"; + + $frame_name= "$rfc_name.$frame_counter"; + $frame_counter++; + for (my $i= 0; $i <= $#Fld; $i++) + { + $frame_name= $frame_name . ' ' . $Fld[$i]; + } + + # print closing info into previous frame + if ($frame_open == 1) + { + print FNM_HYX "<hyx.l fr=\"$frame_name\" dir=next></Frame>\n"; + } + + # print opening info into new frame + print FNM_HYX "<Frame $frame_name>"; + print FNM_HYX "<hyx.l fr=\"$last_frame\" dir=prev>"; + print FNM_HYX "<hyx.l fr=\"\$\$root\" dir=up>\n"; + print FNM_HYX "<title>$section</title>\n"; + print FNM_HYX "<h2>$section</h2>\n"; + + # print a link into the $$root frame + print FNM_TOP "<hyx.l fr=\"$frame_name\" tdc=31"; + print FNM_TOP ' dir=next' if ($frame_counter == 1); + print FNM_TOP ' tdp='.length($section).'>'.$section."\n"; + + $frame_open= 1; + $last_frame= $frame_name; + next line; + } # End of processing new frame begin + + s/((ftp|http|gopher|news|mailto):[A-Za-z0-9@\/\-\$\?\.\%_:~]*[A-Za-z0-9@\/\-\$\?\%_:~])/<a href=$1>$1<\/a>/g; + s/(RFC[ \-]{0,1}(\d+))/<a href=$server2$2.hyx\/\$\$root>$1<\/a>/g; + + print FNM_HYX $_, "\n"; +} # end while(<FI>); +close (FI); + +# END of input stream: +printf FNM_HYX "<hyx.l fr=\"\$\$root\" dir=next></Frame>\n" + if ($frame_open == 1); + +# write final links etc to the $$root frame +print FNM_TOP "<hyx.l fr=\"$last_frame\" dir=prev>\n"; +print FNM_TOP "<hyx.l fr=\"\$\$index\" tdp=7>\$\$index\n"; +# print FNM_TOP "<hyx.l fr=\"$$notes\" tdp=7>$$notes"; +# print FNM_TOP ", e.g. bookmarks and annotations"; +print FNM_TOP "</Frame>\n"; + +# write a dummy $$notes frame +print FNM_TOP "<Frame \$\$notes>\n"; +print FNM_TOP "* latest stop\n"; +print FNM_TOP "</Frame>\n"; + close (FNM_TOP); + + open (FNM_TOP, $fnm_top) or die; + while (<FNM_TOP>) + { + print FNM_HYX $_; + } + close (FNM_TOP); + close (FNM_HYX); + # close (FNM_CRF); + + system ("chksgml $fnm_hyx"); + system ("hyxidx -i $fnm_hyx"); +} + diff --git a/app/nl_kr/stream2.awk b/app/nl_kr/stream2.awk new file mode 100644 index 0000000000000000000000000000000000000000..b9b615cc2efed9b614d8479d6454073d9c03d8e5 --- /dev/null +++ b/app/nl_kr/stream2.awk @@ -0,0 +1,39 @@ +#!/usr/bin/awk -f +# FILE stream2.awk +# +# 'deformat' a RFC and remove pagination lines +# ... a more general approach than stream.awk +# +# written: 1994-05-01 +# latest update: 1995-05-11 +# $Id: stream2.awk,v 1.2 2012/08/10 15:21:00 gonter Exp $ +# ------------------------- + +BEGIN { + lc= 0; +} + +$0=="ISO Transport Services on Top of the TCP" { next; } +$0=="Bootstrap Protocol" { next; } + + { + B[lc++]= $0; +} + +substr($0,1,1)=="" { + for (lb= 0; B[lb] == "" && lb < lc; lb++); + if (substr(B[lb],1,3) == "RFC") { lb++; } + for (; B[lb] == "" && lb < lc; lb++); + + le_strip= 0; + for (le= lc-3; B[le] == "" && le >= 0; le--) le_strip++; + + lines_printed= 0; + for (i= lb; i<= le; i++) { + print B[i]; + lines_printed++; + } + if (le_strip > 3 && lines_printed > 0) print ""; + + lc= 0; +} diff --git a/app/nl_kr/ta b/app/nl_kr/ta new file mode 100755 index 0000000000000000000000000000000000000000..5efac7c78e06c7ee0bf3b3798a79e4e6c1308315 Binary files /dev/null and b/app/nl_kr/ta differ diff --git a/app/nl_kr/ta.c b/app/nl_kr/ta.c new file mode 100644 index 0000000000000000000000000000000000000000..74bf4e5ea7efa4b863c29a1824fb463b658f41fb --- /dev/null +++ b/app/nl_kr/ta.c @@ -0,0 +1,176 @@ +/* + * FILE %ta/ta.c + * + * Textul Analysis + * + * written: 1990 11 11 + * 1992 11 15 + * latest update: 1996-12-22 20:31:22 + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/parse.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/ta.h> + +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/filename.h> + +#define STDHLP stderr + +/* ------------------------------------------------------------------------ */ +static char filenm [256]; +static int verbose_mode= 0; +static struct HYX_PARSER_CLASS *hpc= (struct HYX_PARSER_CLASS *) 0; +static struct HYX_PARSER_STATUS *hps= (struct HYX_PARSER_STATUS *) 0; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn, void *cd); + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: ta [options] {file name}\n", + "OPTIONS:\n", + " -f<filename> ... list of files\n", + " -R ... recurse through the subdirectories\n", + " -v ... verbose mode\n", + " -m<n> .. set output mode=n\n", + " 4 ... place ta.* sgml tags\n", + "\n", + "(@)Ata.c 1.04 #D$1996-12-22 20:32:04\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + int tm= 4; + char *arg; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) return 1; + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, main_fnc, (void *) 0); + if (argc <= 1) goto HLP; + + if ((hpc= hyx_init_parser_class ()) == (struct HYX_PARSER_CLASS *) 0 + || (hps= hyx_parser_reset (hpc)) == (struct HYX_PARSER_STATUS *) 0 + ) + { + fprintf (stderr, "fatal error: can't create control structure!\n"); + return 1; + } + + /* ta_transmit_mode (tm= 2); */ + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + case 'm': case 'M': + /* ta_transmit_mode (tm= (int) get_parameter_value (arg+2)); */ + break; + + case 'r': case 'R': + case 's': case 'S': + case 'v': case 'V': + for (j= 1; arg [j]; j++) + switch (arg [j]) + { + case 'r': case 'R': + case 's': case 'S': + wcrd2_set_subdirs (wcrd, 1); + break; + case 'v': case 'V': + verbose_mode++; + break; + } + break; + +HLP: +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + + hyx_read_tag_definition (hpc, set_etc_filename ((char *) 0, "lexicon.tags")); + + while ((arg= (char *) array_shift (arguments)) != (char *) 0) + { + if (arg [0] == '-') + { + if ((fi2= fopen (arg+2, "rt")) == (FILE *) 0) + { + fprintf (stderr, "couldn't open file %s!\n", arg+2); + break; + } + + for (;;) + { + fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; + if (wcrd2_wildcards (wcrd, filenm) == -1) + { + fclose (fi2); + goto STOP; + } + } + fclose (fi2); + } + else + { + if (wcrd2_wildcards (wcrd, arg) == -1) goto STOP; + } + } + +STOP: + + if (tm == 4) + { +#ifdef DIAG + printf ("-------------------- BEGIN DIAGNOSE ------------------------\n"); + diag_display_markup (stdout, hps->HPS_tx_list, 0, 1); + printf ("-------------------- END DIAGNOSE ------------------------\n"); +#endif /* DIAG */ + hyx_ta_flush_node_list (hps); + ta012_finish (stdout); +#ifdef REDESIGN + ta_print_toc (stdout, "$$root"); +#endif /* REDESIGN */ + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn, void *cd) +{ +#ifdef MSDOS + cd; +#endif + + return (int) hyx_ta_parse_file (hps, fn, (long) 0, 0x7FFFFFFFL); +} diff --git a/app/nl_kr/ta.o b/app/nl_kr/ta.o new file mode 100644 index 0000000000000000000000000000000000000000..738c0a5c934c2cee8a710c31472f9393981cc934 Binary files /dev/null and b/app/nl_kr/ta.o differ diff --git a/app/nl_kr/ta2hyx.awk b/app/nl_kr/ta2hyx.awk new file mode 100644 index 0000000000000000000000000000000000000000..66477fc1278c3f79f1293aee5473c55fa0b030c9 --- /dev/null +++ b/app/nl_kr/ta2hyx.awk @@ -0,0 +1,76 @@ +# +# FILE ~/usr/ta/ta2hyx.awk +# +# NOTE: The form of the output from "ta -m4 etc.." has changed, +# as a result, this script will not work properly! +# +# written: 1994-03-13 +# latest update: 1994-04-03 +# ---------------------------------------------------------------------------- +BEGIN { + frame_open= 0; + xtype= 0; + pfx= "xx"; + frame_num= 1; + toc_cnt= 0; + sec_used= 0; + tbl_used= 0; + fig_used= 0; + first_frame= ""; + print "<Frame @sec>">"@sec"; + print "<Frame @tbl>">"@tbl"; + print "<Frame @fig>">"@fig"; +} + +$0=="<ta.par.sec>" || $0=="<ta.par.tbl>" || $0=="<ta.par.fig>" { + if ($0=="<ta.par.sec>") { toc_file= "@sec"; sec_used= 1; } + if ($0=="<ta.par.tbl>") { toc_file= "@tbl"; tbl_used= 1; } + if ($0=="<ta.par.fig>") { toc_file= "@fig"; fig_used= 1; } + last_frame= ""; + if (frame_open) last_frame= frame_name; + frame_name= pfx"."frame_num++; + if (frame_open) { + print "<hyx.l fr=\""frame_name"\" dir=next></Frame>"; + } else { + first_frame= frame_name; + } + printf "<Frame "frame_name">"; + if (last_frame != "") printf "<hyx.l fr=\""last_frame"\" dir=prev>"; + print ""; + frame_open= 1; + head= 1; + print; + next; +} + +$0=="</ta.par.sec>" || $0=="</ta.par.tbl>" || $0=="</ta.par.fig>" { + head= 0; + print; + next; +} + +head==1 || head==2 { + if (head==1) { + print "<hyx.l fr=\""frame_name"\">* "$0>>toc_file; + head= 2; + } else { + print " "$0>>toc_file; + } +} + + {print;} + +END { + if (frame_open) print "</Frame>"; + + print "<Frame $$root><hyx.l fr=\""first_frame"\" dir=next>\n" + print "Table of contents\n"; + if (sec_used == 1) print "<hyx.l fr=\"@sec\">* Sections"; + if (tbl_used == 1) print "<hyx.l fr=\"@tbl\">* Tables"; + if (fig_used == 1) print "<hyx.l fr=\"@fig\">* Figures"; + print "</Frame>"; + + print "</Frame>">>"@sec"; + print "</Frame>">>"@tbl"; + print "</Frame>">>"@fig"; +} diff --git a/app/nl_kr/tasgml b/app/nl_kr/tasgml new file mode 100755 index 0000000000000000000000000000000000000000..334864e65a0665f2b932af8855121290a8601856 Binary files /dev/null and b/app/nl_kr/tasgml differ diff --git a/app/nl_kr/tasgml.c b/app/nl_kr/tasgml.c new file mode 100644 index 0000000000000000000000000000000000000000..5cc7f2cb65dc0154dca78d2afb75795b21933092 --- /dev/null +++ b/app/nl_kr/tasgml.c @@ -0,0 +1,31 @@ +/* + * FILE %nl_kr/tasgml.c + * + * textual analysis with TA_OBJECT + * + * written: 1994-06-01 + * latest update: 1999-11-28 13:06:43 + * + */ + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/ta.h> + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + FILE *fi; + struct TA_SOURCE tas; + + if (argc < 2) return 0; + + if ((fi= fopen (argv[1], "rb")) == (FILE *) 0) return 0; +printf ("opening %s\n", argv[1]); + tas.TAS_filename= argv[1]; + tas.TAS_file= fi; + tao_rd_sgml_body (&tas); + fclose (fi); + + return 0; +} diff --git a/app/nl_kr/tasgml.o b/app/nl_kr/tasgml.o new file mode 100644 index 0000000000000000000000000000000000000000..837a542d30a13827905a86904c1e9d57e793fe3e Binary files /dev/null and b/app/nl_kr/tasgml.o differ diff --git a/app/nl_kr/tfb.i b/app/nl_kr/tfb.i new file mode 100644 index 0000000000000000000000000000000000000000..d2055d17c1cd0c2fdc955ec2e293b3fb2a916c3f --- /dev/null +++ b/app/nl_kr/tfb.i @@ -0,0 +1,31 @@ +// %gg/work/fbsd/gg/swig/misc/tfb.i +// $Id: tfb.i,v 1.2 2002/07/17 07:03:52 gonter Exp $ +%module tfb +%{ +#include <gg/tfb.h> +#include <gg/ytree.h> +#include <gg/hytxt.h> +#include <gg/lookup.h> +%} +TFB_HANDLE *new_TFB_HANDLE (char *INPUT, char *INPUT); +char *tfb_fetch_entry2 (TFB_HANDLE *INPUT, char *key); + +HYX_CLUSTER_CONTROL *new_HYX_CLUSTER_CONTROL (char *fnm_hyx); + +LMDQS *new_LMDQS (char *INPUT); +WRL *lmd_deref1 (LMDQS *INPUT, char *INPUT, int wl_min, int wl_max); +lmd_print_doc_hit_list_stdout (WRL *INPUT, int print_dil); +lmd_print_document_info_list_stdout (DIL *INPUT); +char *WRL_string (WRL *INPUT); +long WRL_index (WRL *INPUT); +long WRL_count (WRL *INPUT); +long WRL_docs (WRL *INPUT); +long WRL_offset (WRL *INPUT); +DIL *WRL_DIL (WRL *INPUT); + +DIL *DIL_next (DIL *INPUT); +long DIL_document_id (DIL *INPUT); +long DIL_hit_count (DIL *INPUT); +long DIL_document_ptr (DIL *INPUT); +long DIL_pos (DIL *INPUT, int INPUT); + diff --git a/app/nl_kr/tfbget b/app/nl_kr/tfbget new file mode 100755 index 0000000000000000000000000000000000000000..911fa0f9820d91fa23e88b312f2168a1106faf4c Binary files /dev/null and b/app/nl_kr/tfbget differ diff --git a/app/nl_kr/tfbget.c b/app/nl_kr/tfbget.c new file mode 100644 index 0000000000000000000000000000000000000000..82941510f1908868be563ae39a2610f263028bc7 --- /dev/null +++ b/app/nl_kr/tfbget.c @@ -0,0 +1,129 @@ +/* + * FILE %ds/tfb/tfbget.c + * + * get entries from a tfb + * - HELP + * + * written: 1995-10-20 + * latest update: 1996-08-13 16:02:23 + * $Id: tfbget.c,v 1.4 2005/03/11 23:58:28 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/sbr.h> +#include <gg/lookup.h> +#include <gg/array.h> +#include <gg/tfb.h> +#include <gg/filename.h> + +#define STDHLP stdout + +/* ------------------------------------------------------------------------ */ +static int verbose_mode= 0; +static char filenm [MAX_FNM_LENGTH]; + +/* ------------------------------------------------------------------------ */ +#define GPL +static char *HELP []= +{ + "USAGE: tfbget [options] filename keys*\n", + "OPTIONS:\n", + " -f<fnm> ... list of files\n", + " -r ... subdirs\n", + " -v ... verbose mode\n", + "\n", + "(@)Atfbget.c 1.14 #D$2005-03-12 0:56:54\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl tfb_set_name (char *fn); +int cdecl tfb_lookup_string (char *str); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + char *arg; + int rc; + struct TFB_HANDLE *tfb_handle; + struct ARRAY_CONTROL *arguments; + + if ((arguments= array_new ()) == (struct ARRAY_CONTROL *) 0) return 1; + + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + + case 'v': case 'V': + for (j= 1; arg [j]; j++) + switch (arg [j]) + { + case 'v': case 'V': + verbose_mode++; + break; + default: + fprintf (stderr, "unknown option %c\n", arg [j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + + if (array_elements (arguments) + && (tfb_handle= tfb_create_handle ((char *) array_shift (arguments), + (char *) 0)) + != (struct TFB_HANDLE *) 0 + ) + { + while ((arg= (char *) array_shift (arguments)) != (char *) 0) + { + if (arg [0] == '-') + { + if ((fi2= fopen (arg +2, "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", arg +2); + break; + } + + for (;;) + { + rc= fread_line (fi2, filenm, MAX_FNM_LENGTH); + if (rc <= 0 && feof (fi2)) break; + tfb_transfer_entry (stdout, tfb_handle, filenm); + } + fclose (fi2); + } + else + { + tfb_transfer_entry (stdout, tfb_handle, arg); + } + } + tfb_close_handle (tfb_handle); + } + + + return 0; +} diff --git a/app/nl_kr/tfbget.o b/app/nl_kr/tfbget.o new file mode 100644 index 0000000000000000000000000000000000000000..edd17e2bbfe88ddc29c3ccb86550bdee3c94bbf5 Binary files /dev/null and b/app/nl_kr/tfbget.o differ diff --git a/app/nl_kr/tfblut b/app/nl_kr/tfblut new file mode 100755 index 0000000000000000000000000000000000000000..59dd8714c0b9699a9a455d0db542301bf051c749 Binary files /dev/null and b/app/nl_kr/tfblut differ diff --git a/app/nl_kr/tfblut.c b/app/nl_kr/tfblut.c new file mode 100644 index 0000000000000000000000000000000000000000..80a0c64e17f1a366c92e4e96eef429f1906f77be --- /dev/null +++ b/app/nl_kr/tfblut.c @@ -0,0 +1,225 @@ +/* + * FILE %ds/tfb/tfblut.c + * + * Generate and manipulate TFB index files + * - HELP + * - prototypes + * + * written: 1993-10-19 + * latest update: 2003-06-15 21:59:49 + * $Id: tfblut.c,v 1.6 2005/03/11 23:58:28 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <gg/dpp.h> +#include <gg/tfb.h> +#include <gg/sbr.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/filename.h> + +#define STDHLP stderr + +#ifdef MSDOS +/* #include <io.h> */ +#include <conio.h> +#endif + +/* ------------------------------------------------------------------------ */ +#define MAX_FILENM 256 +static char filenm_lut [MAX_FILENM]; +static int verbosity= 0; +static int ambigous_key= AK_complain; +static int field_number= 0; +static int field_delimiter= ':'; +static int open_quote= '\"'; +static int close_quote= '\"'; +static int escape_char= '\\'; +static int modification= MK_none; +static int truncation= -1; /* no truncation */ +static int use_pos= -1; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: tfblut [options] {file name}\n", + "OPTIONS:\n", + " -d<c> ... use <c> as field delimiter [DEF: ':']\n", + " -dTAB ... isolate fields by TABs\n", + " -d ... isolate fields by white space\n", + " -f<fnm> ... list of files\n", + " -n<n> ... field number to use [DEF: 0]\n", + " -u<n> ... field number to be used as value [DEF: -1]\n", + " -p<x> ... key is record position (offset in byte)\n", + " -l<x> ... key is record line number\n", + " <x>= d..decimal, no leading 0 (%%ld)\n", + " D..decimal, 8 chars fixed with leading 0 (%%08ld)\n", + " x..HEX (%%lX)\n", + " X..HEX with leading 0 (%%08lX)\n", + " -t<n> ... truncate indexed field after <n> characters\n", + " -mn ... modify key: none [DEF]\n", + " -mu ... modify key: to upper\n", + " -ml ... modify key: to lower\n", + " -a<mode>+ ... ambigous keys\n", + " c ... complain [DEF]\n", + " n ... don't complain\n", + " f ... use first [DEF]\n", + " l ... use last\n", + " -r ... subdirs\n", + " -v ... increase verbosity\n", + "\n", + "(@)Atfblut.c 1.14 #D$2005-03-12 0:57:13\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn, void *cd); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + char *arg, *arg2; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) return 1; + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, main_fnc, (void *) 0); + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + { + arg2= arg + 2; + + switch (arg [1]) + { + case 'd': + if (strcmp (arg2, "TAB") == 0) + { + field_delimiter= (int) '\t'; + } + else + { + field_delimiter= (int) ((*arg2) ? *arg2 : -1); + } + break; + + case 'f': case 'F': + if (!*arg2) break; + array_push (arguments, (void *) arg); + break; + + case 'n': case 'N': + field_number= (int) get_parameter_value (arg2); + break; + + case 'u': case 'U': + use_pos= (int) get_parameter_value (arg2); +/** printf ("use_pos=%ld\n", use_pos); **/ + break; + + case 't': case 'T': + if (strcmp (arg, "-TAB") == 0) + { + field_delimiter= (int) '\t'; + } + else + { + truncation= (int) get_parameter_value (arg2); + } + break; + + case 'a': case 'A': + for (j= 2; arg [j]; j++) + switch (arg [j]) + { + case 'c': case 'C': ambigous_key |= AK_complain; break; + case 'n': case 'N': ambigous_key &= ~AK_complain; break; + case 'f': case 'F': ambigous_key &= ~AK_last; break; + case 'l': case 'L': ambigous_key |= AK_last; break; + } + break; + + case 'm': case 'M': + switch (*arg2) + { + case 'n': case 'N': modification= MK_none; break; + case 'l': case 'L': modification= MK_tolower; break; + case 'u': case 'U': modification= MK_toupper; break; + } + break; + + case 'l': case 'L': + switch (*arg2) + { + case 'd': field_number= -1; break; + case 'D': field_number= -2; break; + case 'x': field_number= -3; break; + case 'X': field_number= -4; break; + } + break; + + case 'p': case 'P': + switch (*arg2) + { + case 'd': field_number= -5; break; + case 'D': field_number= -6; break; + case 'x': field_number= -7; break; + case 'X': field_number= -8; break; + } + break; + + case 'r': case 'R': + case 'v': case 'V': + for (j= 1; argv [i][j]; j++) + switch (argv [i][j]) + { + case 'r': case 'R': + wcrd2_set_subdirs (wcrd, 1); + break; + case 'v': case 'V': + verbosity++; + break; + default: + fprintf (stderr, "unknown option %c\n", arg[j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + } + else array_push (arguments, (void *) arg); + } + + wcrd2_arguments (wcrd, arguments); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn, void *cd) +{ +#ifdef MSDOS + cd; +#endif + + fnmcpy (filenm_lut, fn, ".lut"); + + return + tfb_make_lut_file (fn, filenm_lut, field_number, field_delimiter, + open_quote, close_quote, escape_char, ambigous_key, + modification, truncation, verbosity, use_pos); +} diff --git a/app/nl_kr/tfblut.o b/app/nl_kr/tfblut.o new file mode 100644 index 0000000000000000000000000000000000000000..767c38598dc2e38b9d96a0dc5b8263feedadf916 Binary files /dev/null and b/app/nl_kr/tfblut.o differ diff --git a/app/nl_kr/x.awk b/app/nl_kr/x.awk new file mode 100644 index 0000000000000000000000000000000000000000..eade1e16e9e0fb7cc377be851afdf6f18f46995b --- /dev/null +++ b/app/nl_kr/x.awk @@ -0,0 +1,40 @@ +# 1990 11 10 +# Grobe Categorisierung der Character Tables f�r den IBMPC +BEGIN { + hex [ 0] = "0"; + hex [ 1] = "1"; + hex [ 2] = "2"; + hex [ 3] = "3"; + hex [ 4] = "4"; + hex [ 5] = "5"; + hex [ 6] = "6"; + hex [ 7] = "7"; + hex [ 8] = "8"; + hex [ 9] = "9"; + hex [10] = "A"; + hex [11] = "B"; + hex [12] = "C"; + hex [13] = "D"; + hex [14] = "E"; + hex [15] = "F"; + print "char TAG_CAT_IBMPC [256] =\n{"; + for (i=0; i<256; i++) { + if ((i%16) == 0) hex1 = hex [i/16]; + cat = "control2"; + if (i >= 32) ch=i; else ch=46; + if (i >= 48 && i <= 57) cat = "digit"; + if (i >= 65 && i <= 90) cat = "capital"; + if (i >= 97 && i <= 122) cat = "small"; + if (i >= 128 && i <= 167) cat = "nat_small"; + if (i >= 176 && i <= 223) cat = "graphic"; + if (i >= 224 && i <= 235) cat = "greek"; + if (i >= 236 && i <= 253) cat = "math2"; + printf (" /* %3d 0x%s%s %c */ TA_CAT_%s,\n", + i, hex1, hex[i%16], ch, cat); + } + print "} ;" +} + + + + diff --git a/app/nl_kr/xt1 b/app/nl_kr/xt1 new file mode 100644 index 0000000000000000000000000000000000000000..a796da28e2f0b0a94ccd50c1afc323f19faa4a68 --- /dev/null +++ b/app/nl_kr/xt1 @@ -0,0 +1,17 @@ +# file xt1 +# test for lutmake stream mode +# STOPWORDS +# and +# the +# . +DOCID 2423 +DATA +gerhard +gonter +blabla +. +DOCID 4711 +DATA +urxn1 +gerhard +. diff --git a/app/nl_kr/xt2 b/app/nl_kr/xt2 new file mode 100644 index 0000000000000000000000000000000000000000..319646e166ee9a2ed5b6b358cda71b46c5ecfc09 --- /dev/null +++ b/app/nl_kr/xt2 @@ -0,0 +1,8 @@ + +DOCID 0 +data +This +is +a +test +. diff --git a/app/sgml/(dirinf).fm b/app/sgml/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..59c1ed59924cf53916c755713c9ce4a87e3444bb --- /dev/null +++ b/app/sgml/(dirinf).fm @@ -0,0 +1,101 @@ +# +# FILE %sgml/(dirinf).fm +# +# written: 1989 11 04 +# latest update: 1999-04-24 12:06:59 +# +# ---------------------------------------------------------------------------- +. SGML und HyperText +. SGML Standard Generalized Markup Language + +Makefile <<<< active Makefile +make-dos <<<< DOS Makefile +make-ux <<<< Unix Makefile +makeshar.lst <<<< create Unix shar distribution package + +# ---------------------------------------------------------------------------- +# Toplevel Hypertext Tools: +# chksgml.c, hyxidx.c, hyxthr.c, hyxpurge.c, hyxscan.c + +# ---------------------------------------------------------------------------- +chksgml.c SGML checker +chksgml1.c SGML checker: int hoc_print_counter (FILE *fo, ...); +chksgml2.c SGML checker: int chksgml (FILE *fo, ...); +chksgml3.c SGML checker: int chksgml_stream (FILE *fo, ...); +chksgml4.c SGML checker: int analyze_tag (char *tag, ...); +chksgml5.c SGML checker: int analyze_entity (char *entity, ...); +chksgml6.c SGML checker: int hoc_reset_counter (...); + +hyxidx.c HYX indexer +hyxidx01.c HYX indexer + +hyxadd.c HYX add frames +hyxpurge.c HYX purge and cleanup +hyxseq.c HYX sequencer +hyxthr.c HYX thread sequencer (should be rolled back into hyxseq) +hyxscan.c HYX scanner +translit.c Zeichen umwandeln + +# unix tools, mostly: -------------------------------------------------------- +msrvh.h Mail Server: datastructures and constants +msrv.c Mail Server: main module +msrv01.c Mail Server: dispatch incoming requests +msrv02.c Mail Server: get a frame from the database and ship it +msrv03.c Mail Server: read default setup +msrv04.c Mail Server: pick an email address to reply to +msrv05.c Mail Server: create an authorization record +msrv06.c Mail Server: check a given authorization against the config +msrv07.c Mail Server: int msrv_prepare_reply_header (...) + +http4hyx.c HTTP daemon +httpsf.c HTTP SGML filter stage + +hyx.pm perl 5 module implementing hash tie to hyx cluster +hyxtest.pl perl 5 program to test hyx.pm + +hyxd.c Hypertext daemon +hyxd01.c int hyxd_daemon (...) +hyxd02.c int hyxd_extract (FILE *fo, char *cluster, ...) +hyxd03.c int hyxd_command (FILE *fo, char *line, int mode) +hyxd04.c int http4hyx_command (FILE *fo, char *line, int mode) +hyxd05.c int http4hyx_daemon (...) + +sf01.c SGML filter: int hytxt_filter (FILE *fi, FILE *fo, long transfer_length) +sf02.c SGML filter: long hytxt_hyx2http (FILE *fo, char *tag_buffer) +sf03.c SGML filter: int frame_name2url (char *frame, char *url, int max_url) +sf04.c SGML filter: int url2frame_name (char *url, char *frame, int max_frame) +sf05.c SGML filter: tables for frame to url translation + +# main library modules: ------------------------------------------------------ +sgml_a.mod LLINK Steuerfile fuer c:/usr/sbr/lsbr.lib +sgml_b.mod LLINK Steuerfile fuer c:/usr/sbr/ai.lib + +# experimental hypertext engine: --------------------------------------------- +hyxeng01.c HyperText Engine: Command Line Interpreter +hyxeng01.h HyperText Engine: aus HYXENG01.CMD erzeugte Konstanten +hyxeng02.c HyperText Engine: Interpreter +hyxeng03.c HyperText Engine: hy_purge +hyxeng04.c HyperText Engine: hyx_engine_list +hyxeng05.c HyperText Engine: hyx_engine_export +hyxold.c HyperText Engine: Steuermodul (obsolete) +hy*.c HyperText +*.hyx HyperText Cluster + +# ancient tools: ------------------------------------------------------------- +sgml0001.c SGML-Filter +sgml0002.c SGML-Filter; selbstmodifizierender Code +sgml0003.c SGML -> TEXT,FTR +sgml0004.c TEXT,FTR -> SGML +sgml0005.c SGML List Elements +sgml0006.c SGML List processor +sgml0007.c SGML Variablen +sgml0008.c SGML list -> LaTeX Konverter +sgml0009.c SGML data -> LaTeX Konverter +sgml0010.c SGML processor configuration +sgml0011.c int sgml_0011_config_processor (int processor_code) +sgml0012.c void sgml_report_list (struct SGML_LIST *sl) +sgml0013.c Identifikation von Tags +sgmlkonv.c Konverter: SGML -> NED-(TXT, FTR) und umgekehrt +temp.c SGML-Test-Konverter +sgmlt1.c SGML Parser +sgmlt2.c SGML Umformulierung diff --git a/app/sgml/.cvsignore b/app/sgml/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..a45eff140913eae55edd2b7201cb22c3df8be43e --- /dev/null +++ b/app/sgml/.cvsignore @@ -0,0 +1,11 @@ +chksgml +msrv +translit +hyxidx +hyxadd +hyxseq +hyxpurge +hyxd +hyxscan +http4hyx +httpsf diff --git a/app/sgml/Makefile b/app/sgml/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..cabe55283160fcdf5b4bfac9dcf24200a9b2c1d0 --- /dev/null +++ b/app/sgml/Makefile @@ -0,0 +1,102 @@ +# +# FILE %sgml/make-ux (Makefile) +# +# written: 1992 12 14 +# latest update: 1999-05-08 10:12:27 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +BIN=/usr/local/bin +# BIN=/afs/.wu-wien.ac.at/rs_aix32/usr/afsws/local/bin +# BIN=/afs/.wu-wien.ac.at/pmax_ul43a/usr/afsws/local/bin + +# ---------------------------------------------------------------------------- +LIB=../../lib/libgg.a +ALL=chksgml msrv translit \ + hyxidx hyxadd hyxseq hyxpurge hyxd hyxscan http4hyx httpsf + +all: lib $(ALL) + +clean: + rm -f *.o $(ALL) + +install: $(ALL) + cp $(ALL) $(BIN) + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + chksgml1.o chksgml2.o chksgml3.o chksgml4.o chksgml5.o chksgml6.o \ + hyxadd01.o \ + hyxd01.o hyxd02.o hyxd03.o hyxd04.o hyxd05.o \ + hyxidx01.o \ + msrv01.o msrv02.o msrv03.o msrv04.o msrv05.o msrv06.o \ + msrv07.o sf01.o sf02.o sf03.o sf04.o sf05.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) $(LIBOBJS1) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $*.c + +# ---------------------------------------------------------------------------- +hyxd: hyxd.o $(LIB) + $(CC) -o hyxd hyxd.o $(LIB) + +http4hyx: http4hyx.o $(LIB) + $(CC) -o http4hyx http4hyx.o $(LIB) + +httpsf: httpsf.o $(LIB) + $(CC) -o httpsf httpsf.o $(LIB) + +chksgml: chksgml.o $(LIB) + $(CC) -o chksgml chksgml.o $(LIB) + +hyxidx: hyxidx.o $(LIB) + $(CC) -o hyxidx hyxidx.o $(LIB) + +hyxadd: hyxadd.o $(LIB) + $(CC) -o hyxadd hyxadd.o $(LIB) + +hyxseq: hyxseq.o $(LIB) + $(CC) -o hyxseq hyxseq.o $(LIB) + +hyxthr: hyxthr.o $(LIB) + $(CC) -o hyxthr hyxthr.o $(LIB) + +hyxscan: hyxscan.o $(LIB) + $(CC) -o hyxscan hyxscan.o $(LIB) + +hyxpurge: hyxpurge.o $(LIB) + $(CC) -o hyxpurge hyxpurge.o $(LIB) + +translit: translit.o $(LIB) + $(CC) -o translit translit.o $(LIB) + +# ---------------------------------------------------------------------------- +ggcryp13.o: ggcryp13.c + $(CC) $(OPTS) -DMODE_ECB -c $*.c + +ggcryq13.o: ggcryp13.c + $(CC) $(OPTS) -DMODE_CFB -o $@ -c ggcryp13.c + +ggcryp15.o: ggcryp15.c + $(CC) $(OPTS) -DMODE_ECB -c $*.c + +ggcryq15.o: ggcryp15.c + $(CC) $(OPTS) -DMODE_CFB -o $@ -c ggcryp15.c + +dyb_0008.o: dyb_0008.c + $(CC) $(OPTS) -DMODE_ECB -c $*.c + +dyb_0009.o: dyb_0008.c + $(CC) $(OPTS) -DMODE_CFB -o $@ -c dyb_0008.c + +# ---------------------------------------------------------------------------- +MSRV=msrv.o +msrv: ${MSRV} $(LIB) + cc -o msrv ${MSRV} $(LIB) + diff --git a/app/sgml/chksgml b/app/sgml/chksgml new file mode 100755 index 0000000000000000000000000000000000000000..e54be097d89f7c85a6e7cf8551f288fcf11f859f Binary files /dev/null and b/app/sgml/chksgml differ diff --git a/app/sgml/chksgml.c b/app/sgml/chksgml.c new file mode 100644 index 0000000000000000000000000000000000000000..c060150cd421d920fea03550e718088767dbd4e0 --- /dev/null +++ b/app/sgml/chksgml.c @@ -0,0 +1,203 @@ +/* + * FILE %sgml/chksgml.c + * + * Check SGML files + * - HELP + * + * written: 1991 07 14 + * latest update: 1996-10-13 21:06:38 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/filename.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +#define REAL_AUTHOR +#define STDHLP stdout +#define FILENM_SIZE 1024 +static char filenm [FILENM_SIZE]; + +/* ------------------------------------------------------------------------ */ +static int verbose_level= 0; +static FILE *outfile= (FILE *) 0; +static int outfile_is_stdout= 0; +static int files_checked= 0; +static int files_errors= 0; +static int flags= 0x000; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: chksgml [options] {file name}\n", + "OPTIONS:\n", + " -f<fnm> ... list of files\n", + " -r ... subdirs\n", + " -t ... print totals\n", + " -i ... ignore case\n", + " -v[<n>] ... verbose level [DEF: 0]\n", + " 0 ... print summary only\n", + " 1 ... print statistics\n", + " 2 ... print warnings\n", + " -o<fnm> ... write stripped output to file (append)\n", + " -O<fnm> ... write stripped output to file (overwrite)\n", + " fnm=- ... stdout\n", + "\n", + "(@)Achksgml.c 2.08 #D$1996-10-13 11:24:34\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl chksgml_main_fnc (char *fn, void *cd); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + char *afn; + char *arg; + char ch2; + int print_totals= 0; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; + + if (argc <= 1) goto HLP; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) return 1; + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, + chksgml_main_fnc, (void *) 0); + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + + case 'o': case 'O': + if (outfile != (FILE *) 0 && !outfile_is_stdout) fclose (outfile); + if (arg [2] == 0) break; + if (strcmp (arg+2, "-") == 0) + { + outfile= stdout; + outfile_is_stdout= 1; + } + else + { + if ((afn= translate_logic_filename (arg+2)) == (char *) 0) + afn= arg+2; + outfile= fopen (afn, (arg [1] == 'O') ? "wb" : "ab"); + } + break; + + case 'v': case 'V': + ch2= arg [2]; + if ((ch2 >= '0' && ch2 <= '9') || ch2 == '-') + verbose_level= (int) get_parameter_value (arg+2); + else goto VERBINC; +printf (">>> verbose_level= %d\n", verbose_level); + break; + + case 'i': case 'I': + case 'r': case 'R': + case 't': case 'T': +VERBINC: + for (j= 1; arg [j]; j++) + switch (arg [j]) + { + case 'i': case 'I': + flags |= CHKSGML_Fign_case; + break; + case 'r': case 'R': + wcrd2_set_subdirs (wcrd, 1); + break; + case 't': case 'T': + print_totals= 1; + break; + case 'v': case 'V': + verbose_level++; + break; + default: + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + + if (array_elements (arguments)) + { + int rc; + + while ((arg= (char *) array_shift (arguments)) != (char *) 0) + if (arg [0] == '-') + { + if ((afn= translate_logic_filename (arg+2)) == (void *) 0) + afn= arg+2; + if ((fi2= fopen (afn, "rt")) == (FILE *) 0) continue; + for (;;) + { + rc= fread_line (fi2, filenm, FILENM_SIZE); + if (rc <= 0 && feof (fi2)) break; + if (wcrd2_wildcards (wcrd, filenm) == -1) + { + fclose (fi2); + goto STOP; + } + } + fclose (fi2); + } + else + { + if (wcrd2_wildcards (wcrd, arg) == -1) goto STOP; + } + } + +STOP: + + if (outfile != (FILE *) 0 && !outfile_is_stdout) fclose (outfile); + + if (print_totals) chksgml_print_total_counter (stdout); + + return (files_errors > 0) ? 1 : 0; +} + +/* ------------------------------------------------------------------------ */ +int chksgml_main_fnc (char *fn, void *cd) +{ + int rv; + +#ifdef MSDOS + cd; +#endif + + files_checked++; + if ((rv= chksgml_file (outfile, stdout, fn, verbose_level, 0L, 0x7FFFFFFFL, + flags)) != 0) files_errors++; + + return rv; +} diff --git a/app/sgml/chksgml.o b/app/sgml/chksgml.o new file mode 100644 index 0000000000000000000000000000000000000000..2d4c04c2d0e27a2bea161e731a5f1bcc476c24bc Binary files /dev/null and b/app/sgml/chksgml.o differ diff --git a/app/sgml/chksgml1.c b/app/sgml/chksgml1.c new file mode 100644 index 0000000000000000000000000000000000000000..337e61327a4645aad0773ea83ac8b77fcfecd9f4 --- /dev/null +++ b/app/sgml/chksgml1.c @@ -0,0 +1,64 @@ +/* + * FILE %sgml/chksgml1.c + * + * Identify (analyze) tags and entities, count them and report + * + * written: 1991 07 14 + * 1992 12 08: revision + * latest update: 1999-04-24 11:59:19 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +static char *HOC_TEXT1 [] = +{ + "undef", + "Tags", + "Entities", + "Tags (total)", + "Entities (total)" +} ; + +/* ------------------------------------------------------------------------ */ +static char *HOC_TEXT2 [] = +{ + "undef", + "tag", + "entity", + "tag", + "entity" +} ; + +/* ------------------------------------------------------------------------ */ +int hoc_print_counter (FILE *fo, struct HYX_OBJECT_COUNTER *x, int what) +{ + if (what < 1 || what > 4) return -1; + + fprintf (fo, "------ %s:\n", HOC_TEXT1 [what]); + for (; x != (struct HYX_OBJECT_COUNTER *) 0; x= x->HOC_next) + { + if (x->HOC_cnt1 && (what == 1 || what == 2)) + { + fprintf (fo, "%6ld %s \'%s\'", + x->HOC_cnt1, HOC_TEXT2 [what], x->HOC_str); + if (x->HOC_cnt1b) fprintf (fo, " (%ld within tags)", x->HOC_cnt1b); + fputc ('\n', fo); + } + + if (x->HOC_cnt2 && (what == 3 || what == 4)) + { + fprintf (fo, "%6ld %s \'%s\'", + x->HOC_cnt2, HOC_TEXT2 [what], x->HOC_str); + if (x->HOC_cnt2b) fprintf (fo, " (%ld within tags)", x->HOC_cnt2b); + fputc ('\n', fo); + } + } + + return 0; +} diff --git a/app/sgml/chksgml1.o b/app/sgml/chksgml1.o new file mode 100644 index 0000000000000000000000000000000000000000..73d548faa65f48d5bc53e89cf8b3384ab885ad10 Binary files /dev/null and b/app/sgml/chksgml1.o differ diff --git a/app/sgml/chksgml2.c b/app/sgml/chksgml2.c new file mode 100644 index 0000000000000000000000000000000000000000..758881faa3a203d5d1900276f7a5d0ea58f1c3f5 --- /dev/null +++ b/app/sgml/chksgml2.c @@ -0,0 +1,57 @@ +/* + * FILE %sgml/chksgml2.c + * + * check SGML files + * + * written: 1991 07 14 + * 1992 12 07: revision; extra buffers + * 1993-01-03: entity lookup via code table + * 1994-12-10: chksgml3.c isolated from here + * latest update: 1999-04-24 11:59:29 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/filename.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int chksgml_file ( +FILE *fo, +FILE *fo_report, +char *fn, +int verbose_level, +long byte_offset, +long byte_count, +int flags) +{ + FILE *fi; + char *afn; + int rv; + char *xbuffer= (char *) 0; +#define XBUFFER_SIZE 4096 + + if ((afn= translate_logic_filename (fn)) == (char *) 0) afn= fn; + + if (verbose_level > 0) printf ("CHKSGML: Testing %s (%s)\n", afn, fn); + + if ((fi= fopen (afn, "rb")) == (FILE *) 0) + { + if (verbose_level > 0) printf ("- not opened!\n"); + return -2; + } + + if ((xbuffer= malloc (XBUFFER_SIZE)) != (char *) 0) + setvbuf (fi, xbuffer, _IOFBF, XBUFFER_SIZE); + + fseek (fi, byte_offset, 0); + + rv= chksgml_stream (fo, fo_report, fi, fn, verbose_level, + byte_offset, byte_count, flags); + fclose (fi); + + if (xbuffer != (char *) 0) free (xbuffer); + + return rv; +} diff --git a/app/sgml/chksgml2.o b/app/sgml/chksgml2.o new file mode 100644 index 0000000000000000000000000000000000000000..e3387f230baef7559c21b9939f4337873d035ac6 Binary files /dev/null and b/app/sgml/chksgml2.o differ diff --git a/app/sgml/chksgml3.c b/app/sgml/chksgml3.c new file mode 100644 index 0000000000000000000000000000000000000000..b8f196615f83acabbd5f1c80a21ff0efdfb72642 --- /dev/null +++ b/app/sgml/chksgml3.c @@ -0,0 +1,606 @@ +/* + * FILE %sgml/chksgml3.c + * + * check a SGML file stream + * + * this module is stateless + * + * written: 1991 07 14 + * 1992 12 07: revision; extra buffers + * 1993-01-03: entity lookup via code table + * 1994-12-10: isolated from chksgml2.c + * latest update: 1996-10-13 11:25:27 + * + */ + +#include <stdio.h> +#include <string.h> +#define USE_CODE_TABLE +#ifdef USE_CODE_TABLE +#include <gg/codes.h> +#endif +#include <gg/strings.h> +#include <gg/convent.h> +#include <gg/filename.h> +#include <gg/hytxt.h> + +#define LEVEL_WARNING (verbose_level > 1) + +/* various STATES of the chksgml scanner */ +#define STAT_start 0 +#define STAT_tag 1 +#define STAT_entity 2 +#define STAT_tag_entity 3 +#define STAT_tag_begin 4 +#define STAT_declaration 5 + +/* ------------------------------------------------------------------------ */ +#define ENTITY_PUFFER_SIZE 32 +static long MAX_ENTITY_SIZE= 16L; +static char entity_puffer [ENTITY_PUFFER_SIZE]; +static int entity_idx= 0; + +#define TAG_PUFFER_SIZE 1024 +static long MAX_TAG_SIZE= 1024L; +static char tag_puffer [TAG_PUFFER_SIZE]; +static char frame_name_puffer [TAG_PUFFER_SIZE]; +static int tag_idx= 1; + +static struct HYX_OBJECT_COUNTER + *tag_counter= (struct HYX_OBJECT_COUNTER *) 0, + *entity_counter= (struct HYX_OBJECT_COUNTER *) 0; + +/* ------------------------------------------------------------------------ */ +int chksgml_stream ( +FILE *fo, +FILE *fo_report, +FILE *fi, +char *fn, +int verbose_level, +long byte_offset, +long byte_count, +int flags) +{ + int ch; + int ch2; + int state= STAT_start; /* possible STATES of the engine */ + int rc; + long off= 0L; + long tag_open_off= 0L; + long entity_open_off= 0L; + long linenr= 1L; + long open_linenr= 0L; + long cnt_warning= 0L; + long cnt_error= 0L; + long cnt_entity= 0L; + long cnt_tag= 0L; + long cnt_tag_entity= 0L; + long cnt_hyx_err= 0L; + int flg_hyx= 0; + int watch_entity= 0; + int watch_tag= 0; + int tag_code; + long frame_line= 0L; /* line number within frame */ + int frame_column= 0; + int frame_state= 0; /* frame open or closed */ + int in_frame= 0; + int nesting_level= 0; /* number of nested decl. structs. */ + + frame_name_puffer [0]= 0; + + for (off= byte_offset; byte_count-- > 0L; off++) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + + switch (state) + { + case STAT_start: + open_linenr= linenr; + switch (ch) + { + case '&': + state= STAT_entity; + cnt_entity++; + watch_entity= 1; + entity_idx= 0; + entity_open_off= off; + break; + + case '<': + state= STAT_tag_begin; + cnt_tag++; + watch_tag= 1; + tag_idx= 0; + tag_open_off= off; + break; + + case '>': + fprintf (fo_report, +"- off=0x%08lX line=%5ld: ERROR: tag close in normal text!\n", + off, linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + cnt_error++; + break; + + default: +PLAIN_TEXT: + if (fo != (FILE *) 0) fputc (ch, fo); + if (ch == 0x0A) + { + frame_column= 0; + frame_line++; + } else frame_column++; + break; + } + break; + + case STAT_entity: + switch (ch) + { + case ';': + state= STAT_start; + rc= analyze_entity (entity_puffer, 1, &entity_counter); +#ifdef USE_CODE_TABLE + ch2= find_sgml_entity (entity_puffer); +#else + ch2= find_pc_sgml_entity (entity_puffer); + if (ch2 == -1) ch2= find_typographic_sgml_entity (entity_puffer); +#endif + if (ch2 == -1) + { + if (rc == 0 && LEVEL_WARNING) + { + fprintf (fo_report, +"- off=0x%08lX line=%5ld: WARNING: unknown ENTITY \'%s\'!\n", + entity_open_off, open_linenr, entity_puffer); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + } + cnt_warning++; + } + else + { + if (fo != (FILE *) 0) fputc (ch2, fo); + frame_column++; + } + break; + + case '<': + fprintf (fo_report, +"- off=0x%08lX line=%5ld: ERROR: tag open within ENTITY!\n", + entity_open_off, open_linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + state= STAT_tag; + cnt_error++; + break; + + case '>': + fprintf (fo_report, +"- off=0x%08lX line=%5ld: ERROR: tag close within ENTITY!\n", + entity_open_off, open_linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + state= STAT_start; + cnt_error++; + break; + + case '&': + fprintf (fo_report, +"- off=0x%08lX line=%5ld: ERROR: entity open within ENTITY!\n", + entity_open_off, open_linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + cnt_error++; + break; + + case 0x0A: + fprintf (fo_report, +"- off=0x%08lX line=%5ld: ERROR: new line within ENTITY!\n", + entity_open_off, open_linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + cnt_error++; + state= STAT_start; + break; + + default: + if (entity_idx == 0 + && !((ch >= 'A' && ch <= 'Z') + || (ch >= 'a' && ch <= 'z') + || ch == '#' /* &#number; */ + || ch == '(' /* &(name,name)name; is possible */ + ) + ) + { /* ERO-Char not followed by a name start character */ + state= STAT_start; + if (fo != (FILE *) 0) fputc ('&', fo); + goto PLAIN_TEXT; + } + + if (off - entity_open_off > MAX_ENTITY_SIZE && watch_entity) + { + if (LEVEL_WARNING) + { + fprintf (fo_report, +"- off=0x%08lX line=%5ld: WARNING: ENTITY longer than %ld bytes!\n", + entity_open_off, open_linenr, MAX_ENTITY_SIZE); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + } + cnt_warning++; + watch_entity= 0; + } + + if (entity_idx+1 < ENTITY_PUFFER_SIZE) + { + entity_puffer [entity_idx++]= (char) ch; + entity_puffer [entity_idx]= 0; + } + break; + } + break; + + case STAT_tag_begin: + switch (ch) + { + case '!': + fprintf (fo_report, "NOTE: declaration start\n"); + nesting_level= 1; + state= STAT_declaration; + if (LEVEL_WARNING) + { + fprintf (fo_report, +"- off=0x%08lX line=%5ld: NOTE: nesting level %d\n", + tag_open_off, open_linenr, nesting_level); + } + break; + default: + state= STAT_tag; + goto _STAT_tag; + } + break; + + case STAT_tag: +_STAT_tag: + switch (ch) + { + case '<': + fprintf (fo_report, +"- off=0x%08lX line=%5ld: ERROR: tag open within TAG!\n", + tag_open_off, open_linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + state= STAT_tag; + cnt_error++; + break; + + case '>': + state= STAT_start; + if (flags & CHKSGML_Fign_case) to_lower (tag_puffer); + rc= analyze_tag (tag_puffer, &tag_code, &tag_counter, &frame_state); + switch (rc) + { + case 1: + flg_hyx= 1; + fprintf (fo_report, +"- off=0x%08lX line=%5ld: ERROR: 2 <Frame ...> without </Frame>!\n", + tag_open_off, open_linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + cnt_hyx_err++; + break; + case 2: + flg_hyx= 1; + fprintf (fo_report, +"- off=0x%08lX line=%5ld: ERROR: 2 </Frame> without <Frame ...>!\n", + tag_open_off, open_linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + cnt_hyx_err++; + break; + case 3: + flg_hyx= 1; + break; + } + + switch (tag_code) + { + case TAGo_Frame: + case TAGso_Frame: + strcpy (frame_name_puffer, tag_puffer); + frame_line= 1L; + frame_column= 0; + in_frame= 1; + break; + } + break; + + case 0x0A: + if (LEVEL_WARNING) + { + fprintf (fo_report, +"- off=0x%08lX line=%5ld: WARNING: new line within tag! (open in line=%ld)\n", + tag_open_off, linenr, open_linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + } + cnt_warning++; + ch= ' '; + linenr++; + goto STAT_TAG_default; + break; + + case '&': + state= STAT_tag_entity; + cnt_tag_entity++; + watch_entity= 1; + entity_idx= 0; + entity_open_off= off; + + default: +STAT_TAG_default: + if (off-tag_open_off > MAX_TAG_SIZE && watch_tag) + { + if (LEVEL_WARNING) + { + fprintf (fo_report, +"- off=0x%08lX line=%5ld: WARNING: TAG longer than %ld bytes!\n", + tag_open_off, open_linenr, MAX_TAG_SIZE); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + } + cnt_warning++; + watch_tag= 0; + } + if (tag_idx+1 < TAG_PUFFER_SIZE) + { + tag_puffer [tag_idx++]= (char) ch; + tag_puffer [tag_idx]= 0; + } + break; + } + break; + + case STAT_tag_entity: + switch (ch) + { + case ';': + case '.': + state= STAT_tag; + rc= analyze_entity (entity_puffer, 2, &entity_counter); + +#ifdef USE_CODE_TABLE + ch2= find_sgml_entity (entity_puffer); +#else + ch2= find_pc_sgml_entity (entity_puffer); + if (ch2 == -1) ch2= find_typographic_sgml_entity (entity_puffer); +#endif + + if (ch2 == -1) + { + if (rc == 0 && LEVEL_WARNING) + { + fprintf (fo_report, +"- off=0x%08lX line=%5ld: WARNING: unknown ENTITY (within tag) \'%s\'!\n", + entity_open_off, open_linenr, entity_puffer); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + } + cnt_warning++; + } + goto STAT_TAG_default; /* store data in tag too */ + + case '<': + fprintf (fo_report, +"- off=0x%08lX line=%5ld: ERROR: tag open within TAG-ENTITY!\n", + entity_open_off, open_linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + state= STAT_tag; + cnt_error++; + break; + + case '>': + fprintf (fo_report, +"- off=0x%08lX line=%5ld: ERROR: tag close within TAG-ENTITY!\n", + entity_open_off, open_linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + state= STAT_start; + cnt_error++; + break; + + case '&': + fprintf (fo_report, +"- off=0x%08lX line=%5ld: ERROR: entity open within TAG-ENTITY!\n", + entity_open_off, open_linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + cnt_error++; + break; + + case 0x0A: + fprintf (fo_report, +"- off=0x%08lX line=%5ld: ERROR: new line within TAG-ENTITY!\n", + entity_open_off, open_linenr); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + cnt_error++; + break; + + default: + if (off-entity_open_off > MAX_ENTITY_SIZE && watch_entity) + { + if (LEVEL_WARNING) + { + fprintf (fo_report, +"- off=0x%08lX line=%5ld: WARNING: TAG-ENTITY longer than %ld bytes!\n", + entity_open_off, open_linenr, MAX_ENTITY_SIZE); + if (frame_name_puffer [0] != 0) + fprintf (fo_report, + " frame_line=%ld frame='%s'\n", + frame_line, frame_name_puffer); + } + cnt_warning++; + watch_entity= 0; + } + if (entity_idx+1 < ENTITY_PUFFER_SIZE) + { + entity_puffer [entity_idx++]= (char) ch; + entity_puffer [entity_idx]= 0; + } + goto STAT_TAG_default; /* store data in tag too */ + } + break; + + case STAT_declaration: + switch (ch) + { + case '<': + nesting_level++; + if (LEVEL_WARNING) + { + fprintf (fo_report, +"- off=0x%08lX line=%5ld: NOTE: nesting level %d\n", + tag_open_off, open_linenr, nesting_level); + } + break; + case '>': + nesting_level--; + if (LEVEL_WARNING) + { + fprintf (fo_report, +"- off=0x%08lX line=%5ld: NOTE: nesting level %d\n", + tag_open_off, open_linenr, nesting_level); + } + break; + } + if (nesting_level <= 0) state= STAT_start; + break; + + default: + fprintf (fo_report,"- internal error: state=%d\n", state); + return -1; + } + if (ch == 0x0A) linenr++; + } + + switch (state) + { + case STAT_start: + if (verbose_level > 0) + fprintf (fo_report, + "- off=0x%08lX line=%5ld: EOF: parser state OK!\n", + off, linenr); + break; + + case STAT_entity: + cnt_error++; + fprintf (fo_report, + "- off=0x%08lX line=%5ld: EOF: error: parser state: entity open\n", + off, linenr); + break; + + case STAT_tag_entity: + cnt_error++; + fprintf (fo_report, +"- off=0x%08lX line=%5ld: EOF: error: parser state: entity open\n", +off, linenr); + + case STAT_tag: + cnt_error++; + fprintf (fo_report, +"- off=0x%08lX line=%5ld: EOF: error: parser state: tagging sequence open\n", +off, linenr); + break; + + default: + cnt_error++; + fprintf (fo_report, +"- off=0x%08lX line=%5ld: EOF: error: parser state=%d\n", off, linenr, state); + break; + } + + if (verbose_level > 0) + { + hoc_print_counter (fo_report, tag_counter, 1); + hoc_print_counter (fo_report, entity_counter, 2); + + fprintf (fo_report, "-- %ld entities\n", cnt_entity); + fprintf (fo_report, "-- %ld tags\n", cnt_tag); + fprintf (fo_report, "-- %ld entities within tags\n", cnt_tag_entity); + fprintf (fo_report, "-- %ld warnings\n", cnt_warning); + if (flg_hyx) + { + fprintf (fo_report, "--- hypertext structure detected\n"); + fprintf (fo_report, "--- %ld hypertext errors\n", cnt_hyx_err); + } + fprintf (fo_report, "-- %ld errors\n", cnt_error); + } + + if (verbose_level >= 0) + { + fprintf (fo_report,"** SUMMARY ** %s: ", fn); + if (cnt_error > 0L) fprintf (fo_report,"SGML not ok!\n"); + else + { + fputs ("SGML ok!", fo_report); + if (flg_hyx) + if (cnt_hyx_err) + fprintf (fo_report, " Hypertext structure not ok!\n"); + else fprintf (fo_report, " Hypertext structure ok!\n"); + else fputc ('\n', fo_report); + } + } + + hoc_reset_counter (tag_counter); + hoc_reset_counter (entity_counter); + + return (cnt_error > 0L) ? 1 : 0; +} + +/* ------------------------------------------------------------------------ */ +int chksgml_print_total_counter (FILE *fo) +{ + hoc_print_counter (fo, tag_counter, 3); + hoc_print_counter (fo, entity_counter, 4); + + return 0; +} diff --git a/app/sgml/chksgml3.o b/app/sgml/chksgml3.o new file mode 100644 index 0000000000000000000000000000000000000000..2302cc216563a28b5647cdb9aa0c9302c5fdef9f Binary files /dev/null and b/app/sgml/chksgml3.o differ diff --git a/app/sgml/chksgml4.c b/app/sgml/chksgml4.c new file mode 100644 index 0000000000000000000000000000000000000000..ffafc0f99f1e15001df6926dd7a20442c5624841 --- /dev/null +++ b/app/sgml/chksgml4.c @@ -0,0 +1,94 @@ +/* + * FILE %sgml/chksgml4.c + * + * Identify (analyze) tags and entities, count them and report + * + * written: 1991 07 14 + * 1992 12 08: revision + * latest update: 1999-04-24 11:59:38 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int analyze_tag ( +char *tag, +int *tag_code, +struct HYX_OBJECT_COUNTER **x_app, +int *frame_state) +{ + struct HYX_OBJECT_COUNTER *x; + char *cp; + int rv= 0; + int tagl= 0; + int rc; + + *tag_code= 0; + for (cp= tag;; cp++, tagl++) + if (*cp == 0 || *cp == ' ' || *cp == 0x09 || *cp == 0x0A || *cp == 0x0D) + break; + + /* check if it's a frame open */ + if ((strncmp (tag, "Frame", tagl) == 0 && tagl == 5) + ||(strncmp (tag, "hyx.f", tagl) == 0 && tagl == 5) + ||tag [0] == ':') + { + rv= (*frame_state == 1) ? 1 : 3; + *frame_state= 1; + *tag_code= (tag [0] == ':') ? TAGso_Frame : TAGo_Frame; + } + + /* check if it's a frame close */ + if ((strncmp (tag, "/Frame", tagl) == 0 && tagl == 6) + ||(strncmp (tag, "/hyx.f", tagl) == 0 && tagl == 6) + ||tag [0] == ';') + { + if (*frame_state == 0) rv= 2; + *frame_state= 0; + *tag_code= (tag [0] == ';') ? TAGsc_Frame : TAGc_Frame; + } + + /* increment counters for that tag */ + for (; + (x= *x_app) != (struct HYX_OBJECT_COUNTER *) 0; + x_app= &x->HOC_next) + { + rc= strncmp (x->HOC_str, tag, tagl); + if ((rc == 0 && x->HOC_str[tagl] == 0) + ||(x->HOC_str[0] == ':' && tag[0] == ':') + ||(x->HOC_str[0] == ';' && tag[0] == ';')) + { + x->HOC_cnt1++; + x->HOC_cnt2++; + return rv; + } + if (rc > 0) break; + } + + /* create a new counter record for the tag */ + if (tag [0] == ':' || tag [0] == ';') tagl= 1; + + if ((x= (struct HYX_OBJECT_COUNTER *) + calloc (sizeof (struct HYX_OBJECT_COUNTER), 1)) + == (struct HYX_OBJECT_COUNTER *) 0) return -1; + +#ifdef _OLD_ + if ((x->HOC_str= malloc (tagl+1)) == (char *) 0) return -1; + memcpy (x->HOC_str, tag, tagl); /* strdup() is not appropriate */ + x->HOC_str[tagl]= 0; +#else + if ((x->HOC_str= strndup (tag, tagl)) == (char *) 0) return -1; +#endif + + x->HOC_cnt1= 1L; + x->HOC_cnt2= 1L; + x->HOC_next= *x_app; + *x_app= x; + + return rv; +} diff --git a/app/sgml/chksgml4.o b/app/sgml/chksgml4.o new file mode 100644 index 0000000000000000000000000000000000000000..403eea173c2c788c754937476dbd184e674b30b1 Binary files /dev/null and b/app/sgml/chksgml4.o differ diff --git a/app/sgml/chksgml5.c b/app/sgml/chksgml5.c new file mode 100644 index 0000000000000000000000000000000000000000..1ab6e3845b1066411343623510987a0c76b54eac --- /dev/null +++ b/app/sgml/chksgml5.c @@ -0,0 +1,60 @@ +/* + * FILE %sgml/chksgml5.c + * + * Identify (analyze) tags and entities, count them and report + * + * written: 1991 07 14 + * 1992 12 08: revision + * latest update: 1999-04-24 11:59:47 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int analyze_entity ( +char *entity, +int what, +struct HYX_OBJECT_COUNTER **x_app) +{ + struct HYX_OBJECT_COUNTER *x; + int rc; + + for (; (x= *x_app) != (struct HYX_OBJECT_COUNTER *) 0; x_app= &x->HOC_next) + { + if ((rc= strcmp (x->HOC_str, entity)) == 0) + { + x->HOC_cnt1++; + x->HOC_cnt2++; + if (what == 2) + { + x->HOC_cnt1b++; + x->HOC_cnt2b++; + } + return 1; + } + if (rc > 0) break; + } + + if ((x= (struct HYX_OBJECT_COUNTER *) + calloc (sizeof (struct HYX_OBJECT_COUNTER), 1)) + == (struct HYX_OBJECT_COUNTER *) 0) return -1; + + x->HOC_str= strdup (entity); + x->HOC_cnt1= 1L; + x->HOC_cnt2= 1L; + if (what == 2) + { + x->HOC_cnt1b= 1L; + x->HOC_cnt2b= 1L; + } + + x->HOC_next= *x_app; + *x_app= x; + + return 0; +} diff --git a/app/sgml/chksgml5.o b/app/sgml/chksgml5.o new file mode 100644 index 0000000000000000000000000000000000000000..1f0153b0a7c6d1dfb527eb4fd7fd9c9e0d4f1c14 Binary files /dev/null and b/app/sgml/chksgml5.o differ diff --git a/app/sgml/chksgml6.c b/app/sgml/chksgml6.c new file mode 100644 index 0000000000000000000000000000000000000000..ee603d43409e51759bd5eeb45381827c274fedec --- /dev/null +++ b/app/sgml/chksgml6.c @@ -0,0 +1,24 @@ +/* + * FILE ~/usr/sgml/chksgml6.c + * + * Identify (analyze) tags and entities, count them and report + * + * written: 1991 07 14 + * 1992 12 08: revision + * latest update: 1995-03-12 + * + */ + +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hoc_reset_counter (struct HYX_OBJECT_COUNTER *x) +{ + for (; x != (struct HYX_OBJECT_COUNTER *) 0; x= x->HOC_next) + { + x->HOC_cnt1= 0L; + x->HOC_cnt1b= 0L; + } + + return 0; +} diff --git a/app/sgml/chksgml6.o b/app/sgml/chksgml6.o new file mode 100644 index 0000000000000000000000000000000000000000..1de94f20aae59040d99d9e43b56b0cad35f14f55 Binary files /dev/null and b/app/sgml/chksgml6.o differ diff --git a/app/sgml/contrib b/app/sgml/contrib new file mode 120000 index 0000000000000000000000000000000000000000..6021a51ea9120394be7d8ebb813d5b9b5d4e575c --- /dev/null +++ b/app/sgml/contrib @@ -0,0 +1 @@ +../../lib/include/contrib \ No newline at end of file diff --git a/app/sgml/gg b/app/sgml/gg new file mode 120000 index 0000000000000000000000000000000000000000..7b7c80811f4d282d5ba38a29e0f67cf0b8335b96 --- /dev/null +++ b/app/sgml/gg @@ -0,0 +1 @@ +../../lib/include/gg \ No newline at end of file diff --git a/app/sgml/http4hyx b/app/sgml/http4hyx new file mode 100755 index 0000000000000000000000000000000000000000..c940d6f0aee2df646e29605dcfc7452097c4e955 Binary files /dev/null and b/app/sgml/http4hyx differ diff --git a/app/sgml/http4hyx.c b/app/sgml/http4hyx.c new file mode 100644 index 0000000000000000000000000000000000000000..94c44c66886d9db90a5238b3532c83902607fee0 --- /dev/null +++ b/app/sgml/http4hyx.c @@ -0,0 +1,116 @@ +/* + * FILE %sgml/http4hyx.c + * + * HTTP server for HYX + * + * written: 1994-04-09 + * latest update: 1997-09-14 19:17:55 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#ifdef MSDOS +#include <io.h> +#include <conio.h> +#endif +#include <gg/filename.h> +#include <gg/hyxd.h> + +#define STDHLP stderr + +/* ------------------------------------------------------------------------ */ +static int verbose_mode= 0; +static char *hostname= ""; +static char *portnumber= ""; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: http4hyx [options] {file name}\n", + "OPTIONS:\n", + " -d<dir> ... directory prefix\n", + " -h<name> ... set host name\n", + " -p<port> ... set port number\n", + " -s ... single transaction mode\n", + " -t ... ticket mode\n", + " -md5 ... turn on MD5 transformation of request strings\n", + " -l ... lexicon server mode\n", + " -v ... verbose level\n", + " -x ... preformatted\n", + "EXAMPLES: \n", + "\n", + "(@)Ahttp4hyx.c 0.04 #D$1997-09-14 19:17:52\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + int http_flags= 0; + + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'd': case 'D': + http4hyx_set_path (&argv[i][2]); + break; + case 'h': case 'H': + hostname= &argv[i][2]; + break; + case 'p': case 'P': + portnumber= &argv[i][2]; + break; + + case 'v': case 'V': + case 'l': case 'L': + case 'm': case 'M': + case 's': case 'S': + case 't': case 'T': + case 'x': case 'X': + for (j= 1; argv [i][j]; j++) + switch (argv [i][j]) + { + case 'v': case 'V': + verbose_mode++; + http_flags |= HYXD_verbose; + break; + case 'd': case 'D': case '5': + break; + case 'l': case 'L': + http_flags |= HYXD_lexicon_server; + break; + case 'm': case 'M': + http_flags |= HYXD_md5_transformation; + break; + case 's': case 'S': + http_flags |= HYXD_single_transaction; + break; + case 't': case 'T': + http_flags |= HYXD_ticket_required; + break; + case 'x': case 'X': + http_flags |= HYXD_preformatted; + break; + default: + fprintf (stderr, "unknown option %c\n", argv[i][j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + + http4hyx_daemon (stdin, stdout, http_flags); + + return 0; +} diff --git a/app/sgml/http4hyx.o b/app/sgml/http4hyx.o new file mode 100644 index 0000000000000000000000000000000000000000..e60ab8c4313883bb2e2e85a3b54dfd7e6ad583ee Binary files /dev/null and b/app/sgml/http4hyx.o differ diff --git a/app/sgml/httpsf b/app/sgml/httpsf new file mode 100755 index 0000000000000000000000000000000000000000..06a3031f02475e3bb6e97ea2236743e9f48d4cc9 Binary files /dev/null and b/app/sgml/httpsf differ diff --git a/app/sgml/httpsf.c b/app/sgml/httpsf.c new file mode 100644 index 0000000000000000000000000000000000000000..90a96d6a40ad22347303659aa02df740f6bcba6f --- /dev/null +++ b/app/sgml/httpsf.c @@ -0,0 +1,97 @@ +/* + * FILE ~/usr/sgml/httpsf.c + * + * HTTP SGML filter stage + * + * written: 1994-04-12 + * latest update: 1995-03-25 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <gg/hytxt.h> +#ifdef MSDOS +#include <conio.h> +#endif + +/* ------------------------------------------------------------------------ */ +static int verbose_mode= 0; +static int translit_entities= 1; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: httpsf [options] {file name}\n", + "OPTIONS:\n", + " -v ... verbose mode\n", + " -p ... insert <PRE> and </PRE> tags\n", + " -r ... raw; don't insert entities for chars over 0x80\n", + "\n", + "(@)Ahttpsf.c 0.03 #D$1995-03-25 18:00:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + FILE *fi; + FILE *fo; + int infile= 0; + int i, j; + int preformatted= 0; + + fo= stdout; + + for (i= 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'v': case 'V': + case 'p': case 'P': + case 'r': case 'R': + for (j= 1; argv [i][j]; j++) + switch (argv [i][j]) + { + case 'v': case 'V': + verbose_mode++; + break; + case 'p': case 'P': + preformatted= 1; + break; + case 'r': case 'R': + translit_entities= 0; + break; + default: + fprintf (stderr, "unknown option %c\n", argv[i][j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else + { + if ((fi= fopen (argv[i], "r")) != (FILE *) 0) + { + if (preformatted) fprintf (fo, "<PRE>\n"); + hytxt_filter (fi, fo, 0x7FFFFFFFL, translit_entities); + if (preformatted) fprintf (fo, "</PRE>\n"); + fclose (fi); + } + } + + if (infile == 0) + { + if (preformatted) fprintf (fo, "<PRE>\n"); + hytxt_filter (stdin, fo, 0x7FFFFFFFL, translit_entities); + if (preformatted) fprintf (fo, "</PRE>\n"); + } + + return 0; +} diff --git a/app/sgml/httpsf.o b/app/sgml/httpsf.o new file mode 100644 index 0000000000000000000000000000000000000000..3ae5452e11b05b4b55cec4c125a61ef037785006 Binary files /dev/null and b/app/sgml/httpsf.o differ diff --git a/app/sgml/hyx.pm b/app/sgml/hyx.pm new file mode 100644 index 0000000000000000000000000000000000000000..7b309b2f2c0fbc365721d404f606fbb1e09aaecd --- /dev/null +++ b/app/sgml/hyx.pm @@ -0,0 +1,252 @@ +#!/usr/local/bin/perl +# FILE %usr/unixonly/iris/hyx.pm +# +# This is hyx.pm which implements a hash tie for hyx clusters. +# +# The standard hash tie functions implemented are: +# TIEHASH objectname, clustername create a connection to a cluster +# DESTROY this break the connection to the object +# FETCH this, frame retrieve a particular frame +# STORE this, frame, contents store (add or update) a frame +# DELETE this, frame delete a frame (NOTE 1) +# EXISTS this, frame check the existence of a frame +# FIRSTKEY this, frame get the first frame name (NOTE 2) +# NEXTKEY this (, frame) get the next frame name (NOTE 3) +# +# Additonaly, these functions are available: +# frames this return list of frames +# last this return index of last frame +# reindex this recreate the lut +# fullindex this recreate the lut by scanning the cluster +# purge this remove updated frames +# check this run a check against the cluster +# diag this run a diagnostic check against the cluster +# execute this, command execute a subcommand on the cluster +# FETCH_vec this, frame same as FETCH, result is an array +# STORE_vec this, frame, @D same as STORE, contents is an array +# +# Notes: +# 1. Frames are not really removed, just references to them. +# To get rid of such frames permanently, it is necessary to issue: +# hyx::purge ($cluster); hyx::reindex ($cluster); +# 2. The returned list is not necessaryly sorted. +# 3. The frame parameter is ignored. +# +# test: hyxtest.pl +# +# written: 1996-10-09 +# latest update: 1996-10-14 0:12:10 +# + +package hyx; + +use IPC::Open2; + +# ---------------------------------------------------------------------------- +sub TIEHASH +{ + local ($self, $hyx_name)= @_; + local ($hyx_base)= $hyx_name; + local ($pid); + + $hyx_base= $1 if ($hyx_base =~ /(.+)\.hyx$/); + $pid= open2 (RD_HYXD, WR_HYXD, "hyxd $hyx_name"); + + my $object = + { + 'FNM_HYX' => $hyx_name, + 'RD_HYXD' => RD_HYXD, + 'WR_HYXD' => WR_HYXD, + 'PID' => PID, + 'FRAMES' => [] + } ; + + return bless $object, $self; +} + +# ---------------------------------------------------------------------------- +sub DESTROY +{ + my $self= shift; + my $frame= $self->{FNM_HYX}; + # print "DESTROY connection to $frame\n"; + print {$self->{WR_HYXD}} "quit\n"; + close ($self->{WR_HYXD}); + close ($self->{RD_HYXD}); +} + +# ---------------------------------------------------------------------------- +sub FETCH +{ + my $self= shift; + my $frame= shift; + + print {$self->{'WR_HYXD'}} "fetch $frame\n"; + return &read_hyxd ($self->{'RD_HYXD'}, 0); +} + +# ---------------------------------------------------------------------------- +sub STORE +{ + my $self= shift; + my $frame= shift; + my @contents= split ('\n', shift); + + &STORE_vec ($self, $frame, @contents); +} + +# ---------------------------------------------------------------------------- +sub DELETE +{ + my $self= shift; + return shift (@{$self->{'FRAMES'}}); +} + +# ---------------------------------------------------------------------------- +sub EXISTS +{ + my $self= shift; + my $frame= shift; + my $res; + + # print ">> EXISTS $frame\n"; + print {$self->{'WR_HYXD'}} "exists $frame\n"; + $res= &read_hyxd ($self->{'RD_HYXD'}, 0); + # print ">> res='$res'\n"; + return $1 if ($res =~ /^OK (\d+)/); + return 0; +} + +# ---------------------------------------------------------------------------- +sub FIRSTKEY +{ + my $self= shift; + + print {$self->{'WR_HYXD'}} "frames\n"; + @{$self->{'FRAMES'}}= &read_hyxd ($self->{'RD_HYXD'}, 2); + return shift (@{$self->{'FRAMES'}}); +} + +# ---------------------------------------------------------------------------- +sub NEXTKEY +{ + my $self= shift; + return shift (@{$self->{'FRAMES'}}); +} + +# ---------------------------------------------------------------------------- +sub frames { &execute (shift, 'frames', 1); } +sub check { &execute (shift, 'check', 0); } +sub diag { &execute (shift, 'diag', 0); } +sub reindex { &execute (shift, 'reindex', 0); } +sub fullindex { &execute (shift, 'fullindex', 0); } +sub purge { &execute (shift, 'purge', 0); } + +# ---------------------------------------------------------------------------- +sub last +{ + $res= &execute (shift, 'last', 0); + return $1 if ($res =~ /^OK (\d+)/); + return 0; +} + +# ---------------------------------------------------------------------------- +sub execute +{ + my $self= shift; + my $command= shift; + my $fmt= shift; + + # print "cmd='$command'\n"; + print {$self->{'WR_HYXD'}} "$command\n"; + &read_hyxd ($self->{'RD_HYXD'}, $fmt); +} + +# ---------------------------------------------------------------------------- +sub FETCH_vec +{ + my $self= shift; + my $frame= shift; + + print {$self->{'WR_HYXD'}} "fetch $frame\n"; + return &read_hyxd ($self->{'RD_HYXD'}, 1); +} + +# ---------------------------------------------------------------------------- +sub STORE_vec +{ + my $self= shift; + my $frame= shift; + my @contents= @_; + local ($l); + local ($fo); + + $fo= $self->{'WR_HYXD'}; + # print ">> store $frame\n"; + print $fo "store $frame\n"; + foreach $l (@contents) + { + # print ">>> '$l'\n"; + if ($l =~ /^\.+$/) + { + print $fo $l, ".\n"; + } + else + { + print $fo $l, "\n"; + } + } + + return &read_hyxd ($self->{'RD_HYXD'}, 1);; +} + +# ---------------------------------------------------------------------------- +sub read_hyxd +{ + local ($fi, $fmt)= @_; + + local ($l, $index, $frame); + local (@res, $res); + local ($data)= 0; + + while (1) + { + $l= <$fi>; + chop ($l); + # print ">> '$l'\n"; + + return $l if ($l =~ /^ERROR/ || $l =~ /^OK/); + + if ($l eq '.') + { + return @res if ($fmt); + return $res; + } + + if ($l =~ /^DATA/) + { + $data= 1; + next; + } + + next unless ($data); + $l= $1 if ($l =~ /\.(\.+)$/); # reduce escaped dots + + if ($fmt == 1) # prepare result vector + { + push (@res, $l); + } + elsif ($fmt == 2) # prepare list of frames as result + { + ($index, $frame)= split (' ', $l, 2); + push (@res, $frame); + } + else # result is one string + { + $res .= $l . "\n"; + } + } +} + +# ---------------------------------------------------------------------------- +1; diff --git a/app/sgml/hyxadd b/app/sgml/hyxadd new file mode 100755 index 0000000000000000000000000000000000000000..932424a7a8f7c9e8dd173fa434701b86c3366e95 Binary files /dev/null and b/app/sgml/hyxadd differ diff --git a/app/sgml/hyxadd.c b/app/sgml/hyxadd.c new file mode 100644 index 0000000000000000000000000000000000000000..b1414234e1929440b0cb2a2f698af110aa7d3415 --- /dev/null +++ b/app/sgml/hyxadd.c @@ -0,0 +1,269 @@ +/* + * FILE %sgml/hyxadd.c + * + * add files as frames to a HYX cluster + * - prototypes + * - HELP + * + * written: 1994-06-04 + * latest update: 1996-12-12 13:03:00 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/filename.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/hytxt.h> + +#define STDHLP stderr + +/* ------------------------------------------------------------------------ */ +#define FILENM_SIZE 1024 +static char filenm [FILENM_SIZE]; +static int verbose_mode= 0; +static long index_number= 0L; + +static struct FILE_SEGMENT *segments= (struct FILE_SEGMENT *) 0; +static struct FILE_SEGMENT **app_segments= &segments; + +static char *fn_hyx= "_dummy_.hyx"; +static int t2d= 0; + +/* ------------------------------------------------------------------------ */ +#define GPL +static char *HELP [] = +{ + "USAGE: hyxadd [options] {file name}\n", + "OPTIONS:\n", + " -c<fnm> ... name of the cluster\n", + " -f<fnm> ... list of files\n", + " -i<num> ... index number [DEF: 0, undefined]\n", + " -d<frame> ... mark frame as deleted (place empty data)\n", + " -p<frame> ... add named frame by reading contents from pipe (stdin)\n", + " -e<beg>;<end>;<file>;<frame> ... explicit specification of segment\n", + " -r ... subdirs\n", + " -v ... verbose mode\n", + "\n", + "(@)A hyxadd.c 1.17 #D$1996-12-12 13:02:57\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl hyx_add_main (char *fn, void *cd); +int cdecl explicit_segment_specification (char *ex); +int cdecl stdin_segment_specification (char *frame_name); +int cdecl deletion_segment (char *frnm); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + char *arg; + int rc; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) return 1; + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, + hyx_add_main, (void *) 0); + + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'c': case 'C': + fn_hyx= arg+2; + break; + + case 'd': case 'D': + deletion_segment (arg+2); + break; + + case 'e': case 'E': + explicit_segment_specification (arg+2); + break; + + case 'p': case 'P': + stdin_segment_specification (arg+2); + break; + + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + + case 'i': case 'I': + index_number= get_parameter_value (arg+2); + break; + + case 'r': case 'R': + case 'v': case 'V': + for (j=1; arg [j]; j++) + switch (arg [j]) + { + case 'r': case 'R': + wcrd2_set_subdirs (wcrd, 1); + break; + case 'v': case 'V': + verbose_mode++; + break; + default: + fprintf (stderr, "unknown option %c\n", arg [j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + + while ((arg= (char *) array_shift (arguments)) != (char *) 0) + { + if (arg [0] == '-') + { + if ((fi2= fopen (arg+2, "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", arg+2); + break; + } + + for (;;) + { + rc= fread_line (fi2, filenm, FILENM_SIZE); + if (rc <= 0 && feof (fi2)) break; + + if (filenm [0] == '-') + { + switch (filenm [1]) + { + case 'e': case 'E': + explicit_segment_specification (&filenm [2]); + break; + case 'd': case 'D': + deletion_segment (&filenm [2]); + break; + } + } + else + { + if (wcrd2_wildcards (wcrd, filenm) == -1) + { + fclose (fi2); + goto STOP; + } + } + } + fclose (fi2); + } + else + { + if (wcrd2_wildcards (wcrd, arg) == -1) goto STOP; + } + } + + hyx_print_segment (stdout, segments); + if (t2d) hyx_add (fn_hyx, segments, verbose_mode); + +STOP: + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int hyx_add_main (char *fn_in, void *cd) +{ + struct FILE_SEGMENT *fs; + +#ifdef MSDOS + cd; +#endif + + if (fn_in == (char *) 0) return -1; + if (*fn_in == 0) return 0; + + if ((fs= hyx_make_segment (app_segments, fn_in, (char *) 0, + &index_number, FSop_update, 0L, 0x7FFFFFFEL)) + == (struct FILE_SEGMENT *) 0) return -1; + + for (; fs->FS_next != (struct FILE_SEGMENT *) 0; fs= fs->FS_next); + app_segments= &fs->FS_next; + t2d++; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int explicit_segment_specification (char *ex) +{ + struct FILE_SEGMENT *fs; + + if (hyx_setup_segment (app_segments, &fs, ex, &index_number) != 0) + return -1; + + for (fs= *app_segments; + fs->FS_next != (struct FILE_SEGMENT *) 0; + fs= fs->FS_next); + + app_segments= &fs->FS_next; + t2d++; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int stdin_segment_specification (char *frame_name) +{ + struct FILE_SEGMENT *fs; + + if (hyx_setup_stdin_segment (app_segments, &fs, frame_name, + &index_number) != 0) + return -1; + + for (fs= *app_segments; + fs->FS_next != (struct FILE_SEGMENT *) 0; + fs= fs->FS_next); + + app_segments= &fs->FS_next; + t2d++; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int deletion_segment (char *frnm) +{ + struct FILE_SEGMENT *fs; + +printf ("deletion_segment: frnm='%s'\n", frnm); + if (hyx_setup_delete_segment (app_segments, &fs, frnm, &index_number) != 0) + return -1; + + for (fs= *app_segments; + fs->FS_next != (struct FILE_SEGMENT *) 0; + fs= fs->FS_next); + + app_segments= &fs->FS_next; + t2d++; + + return 0; +} diff --git a/app/sgml/hyxadd.o b/app/sgml/hyxadd.o new file mode 100644 index 0000000000000000000000000000000000000000..1f4a4b767f166b00ecad96ebc8b41d9c755cb6b2 Binary files /dev/null and b/app/sgml/hyxadd.o differ diff --git a/app/sgml/hyxadd01.c b/app/sgml/hyxadd01.c new file mode 100644 index 0000000000000000000000000000000000000000..1a9ac8f4ba32716c693ade946b3a18da576495ac --- /dev/null +++ b/app/sgml/hyxadd01.c @@ -0,0 +1,43 @@ +/* + * FILE %sgml/hyxadd01.c + * + * add files as frames to a HYX cluster + * - used in hyxadd.c + * + * written: 1994-06-04 + * latest update: 1999-04-24 11:59:55 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/filename.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hyx_add (char *fn_hyx, struct FILE_SEGMENT *segments, int verbose_mode) +{ + char *afn; + char *fnm_idx; + char *fnm_lut; + char *fnm_xfn; + int rc; + + if (fn_hyx == (char *) 0 || !*fn_hyx) return -2; + +printf ("hyx_add: %s\n", fn_hyx); + + if ((afn= translate_logic_filename (fn_hyx)) == (char *) 0) afn= fn_hyx; + + fnm_idx= fnmcpy2 (afn, ".idx"); + fnm_lut= fnmcpy2 (afn, ".lut"); + fnm_xfn= fnmcpy2 (afn, ".xfn"); + + rc= hyx_update (afn, fnm_idx, fnm_lut, fnm_xfn, segments, verbose_mode); + + free (fnm_idx); + free (fnm_lut); + free (fnm_xfn); + + return rc; +} diff --git a/app/sgml/hyxadd01.o b/app/sgml/hyxadd01.o new file mode 100644 index 0000000000000000000000000000000000000000..5cb44bfdc70b81bdde973c13c31b309421db1fa9 Binary files /dev/null and b/app/sgml/hyxadd01.o differ diff --git a/app/sgml/hyxd b/app/sgml/hyxd new file mode 100755 index 0000000000000000000000000000000000000000..ccbd0034ac51da77416fba1a6b08a29c4d2e9725 Binary files /dev/null and b/app/sgml/hyxd differ diff --git a/app/sgml/hyxd.c b/app/sgml/hyxd.c new file mode 100644 index 0000000000000000000000000000000000000000..8a87777701526599e56a3fbd836b78938a8bf3c1 --- /dev/null +++ b/app/sgml/hyxd.c @@ -0,0 +1,67 @@ +/* + * FILE %sgml/hyxd.c + * + * Hypertext daemon + * + * written: 1992 12 08 + * latest update: 1997-06-10 16:47:24 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#ifdef MSDOS +#include <conio.h> +#define _KREDENZ_TFB "_kredenz.tfb" +#else +#define _KREDENZ_TFB ".kredenz.tfb" +#endif +#include <gg/hyxd.h> + +/* ------------------------------------------------------------------------ */ +#define STDHLP stdout +static char *HELP [] = +{ + "USAGE: hyxd [options] [cluster]\n", + "OPTIONS:\n", + " -c<cluster> ... name cluster to use\n", + " -X<fnm> ... CHEX credential file, authentication implicitly required\n", + "\n", + "(@)Ahyxd.c 1.04 #D$1997-06-10 16:47:31\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + char *arg; + char *cluster= (char *) 0; + char *credential_file= (char *) 0; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'c': case 'C': + cluster= arg+2; + break; + + case 'X': + credential_file= (arg[2]) ? arg+2 : _KREDENZ_TFB; + break; + +#include <gg/help.inc> + } + else cluster= arg; + } + + return hyx_d_daemon (stdin, stdout, cluster, credential_file); +} diff --git a/app/sgml/hyxd.o b/app/sgml/hyxd.o new file mode 100644 index 0000000000000000000000000000000000000000..4546c951f549090ec00f2d7dd370785f90179644 Binary files /dev/null and b/app/sgml/hyxd.o differ diff --git a/app/sgml/hyxd01.c b/app/sgml/hyxd01.c new file mode 100644 index 0000000000000000000000000000000000000000..4fe894eb58ca5707f6635e78f50ee881271d91e8 --- /dev/null +++ b/app/sgml/hyxd01.c @@ -0,0 +1,129 @@ +/* + * FILE %sgml/hyxd01.c + * + * Hypertext daemon + * + * written: 1992 12 08 + * latest update: 1999-04-24 11:53:13 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/ggcrypt.h> +#include <gg/hyxd.h> + +/* ------------------------------------------------------------------------ */ +int hyx_d_daemon ( +FILE *fi, /* input stream */ +FILE *fo, /* output stream */ +char *cluster, +char *credential_file) +{ + int rc; + struct HYXD_THREAD *thr; + char *line; + int authenticated= 0; + int authentication_phase= 0; +#define N_TOKENS 4 + char *tokens [N_TOKENS]; +#define CHALLENGE_SIZE 16 + char challenge [CHALLENGE_SIZE+1]; + char *challenge_string= (char *) 0; + char *user_from, *user_to, *resource; + + if ((thr= hyx_d_new_thread ()) == (struct HYXD_THREAD *) 0 + || (thr->hcc= hyx_new_cluster_control ()) + == (struct HYX_CLUSTER_CONTROL *) 0 + ) + return -1; + + thr->fi= fi; + thr->fo= fo; + line= thr->line; + + if (credential_file == (char *) 0) authenticated= 1; + + if (cluster != (char *) 0) + { + char *afn; + + if ((afn= translate_logic_filename (cluster)) == (char *) 0) return -1; + hcc_set_cluster_name (thr->hcc, afn); + free_or_what (afn); + thr->hcc_defined= 1; + } + + for (;;) + { + rc= fread_line (fi, line, HYXD_LINE_SIZE); + if (rc <= 0 && feof (fi)) break; + if (line [0] == '#') continue; + + if (!authenticated) + { + rc= isolate_tokens (line, tokens, N_TOKENS); + if (rc <= 0 || strcmp (tokens [0], "CHEX") != 0) break; + + switch (authentication_phase) + { + case 0: + /* Protocol: */ + /* Request: CHEX from to resource */ + /* Answer: OK challenge | ERROR */ + authentication_phase= -1; + + if (rc != 4) break; + + user_from= tokens [1]; + user_to= tokens [2]; + resource= tokens [3]; + + mk_PassWord (challenge, CHALLENGE_SIZE); + fprintf (fo, "OK %s\n", challenge); + authentication_phase= 1; + break; + + case 1: + /* Protocol: */ + /* Request: CHEX chex-string */ + /* Answer: OK | ERROR */ + authentication_phase= -1; + + if (rc == 2 + && (challenge_string= + agettok_get_challenge (credential_file, + user_from, user_to, resource, challenge)) + != (char *) 0 + && strcmp (challenge_string, tokens [1]) == 0 + ) + { + authenticated= 1; + authentication_phase= 2; + fprintf (fo, "OK\n"); + } + break; + } + + if (authentication_phase == -1) + { + fprintf (fo, "ERROR\n"); + break; + } + continue; + } + + if (hyx_d_command (thr, line) == 1) break; + } + + /* destroy thread */ + hcc_close (thr->hcc); + hcc_destroy (thr->hcc); + free (thr); + + return 0; +} diff --git a/app/sgml/hyxd01.o b/app/sgml/hyxd01.o new file mode 100644 index 0000000000000000000000000000000000000000..011329b6d434e5fd92f0888391b4e201f7b994ec Binary files /dev/null and b/app/sgml/hyxd01.o differ diff --git a/app/sgml/hyxd02.c b/app/sgml/hyxd02.c new file mode 100644 index 0000000000000000000000000000000000000000..999f5367cee51832497ac63a5f1705d45bd9af3b --- /dev/null +++ b/app/sgml/hyxd02.c @@ -0,0 +1,91 @@ +/* + * FILE %sgml/hyxd02.c + * + * hypertext daemon + * + extract a frame + * + * written: 1992-12-08 + * latest update: 1999-04-24 12:00:04 + * $Id: hyxd02.c,v 1.3 2002/01/27 23:01:33 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/hytxt.h> +#include <gg/hyxd.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +int hyx_d_extract ( +FILE *fo, +char *cluster, +char *frame, +char *default_path, +int mode) +{ + struct FILE_SEGMENT *fs= (struct FILE_SEGMENT *) 0; + char *afn_hyx; + char *fnm_idx; + char *fnm_lut; + char *fnm_xfn; + int rc= 0; + long index_number= 0L; + + fprintf (stderr, + "hyx_d_extract: cluster='%s' frame='%s'\n", cluster, frame); + + if (cluster == (char *) 0 || !*cluster + || frame == (char *) 0 || !*frame) return -2; + + if (cluster [0] != '/' + && default_path != (char *) 0 + && *default_path != 0) + { + afn_hyx= malloc (strlen (default_path) + strlen (cluster) + 2); + sprintf (afn_hyx, "%s/%s", default_path, cluster); + } + else + { + if ((afn_hyx= translate_logic_filename (cluster)) == (char *) 0) + afn_hyx= cluster; + } + + fnm_idx= fnmcpy2 (afn_hyx, ".idx"); + fnm_lut= fnmcpy2 (afn_hyx, ".lut"); + fnm_xfn= fnmcpy2 (afn_hyx, ".xfn"); + + fprintf (stderr, "hyx_d_extract: afn_hyx=%s\n", afn_hyx); + fprintf (stderr, "hyx_d_extract: fnm_idx=%s\n", fnm_idx); + fprintf (stderr, "hyx_d_extract: fnm_lut=%s\n", fnm_lut); + fprintf (stderr, "hyx_d_extract: fnm_xfn=%s\n", fnm_xfn); + + if (mode & HYXD_lexicon_server) + { + /* BEGIN Lexicon Server: This section can be used for */ + /* lexicon specific code to hack the lexicon server. */ + /* see T2D for more details about this topic. */ + + /* END Lexicon Server */ + } + else + { + hyx_make_segment (&fs, (char *) 0, frame, &index_number, FSop_extract, + 0L, 0L); + + rc= hyx_sequencer ( + (fo == (FILE *) 0) ? (FILE *) stdout : fo, + afn_hyx, fnm_idx, fnm_lut, fnm_xfn, fs, 0, 0); + } + + flclose_all (); + + free (fnm_idx); + free (fnm_lut); + free (fnm_xfn); + + return rc; +} diff --git a/app/sgml/hyxd02.o b/app/sgml/hyxd02.o new file mode 100644 index 0000000000000000000000000000000000000000..30502c2586892b6d20336c1cc6f37fae0838aeb2 Binary files /dev/null and b/app/sgml/hyxd02.o differ diff --git a/app/sgml/hyxd03.c b/app/sgml/hyxd03.c new file mode 100644 index 0000000000000000000000000000000000000000..ce097682ee3d63cb018c268a1e7086ced227e7b8 --- /dev/null +++ b/app/sgml/hyxd03.c @@ -0,0 +1,252 @@ +/* + * FILE %sgml/hyxd03.c + * + * Hypertext engine + * + * commands: + * cluster <name> ... OK + * fetch <frame> ... DATA size + data + * store <frame> ... OK + * delete <frame> ... OK + * exists <frame> ... OK size + * translate <frame> ... OK real name + * last ... OK last index + * frames ... DATA + list of frames + * translate <frame> ... OK real frame name + * check + * diag + * reindex + * fullindex + * purge + * quit ... no reply + * + * see also: + * hyx.pm ... perl 5 module implementing a hash tie + * hyxtest.pl ... perl 5 test program for hyx.pm + * + * written: 1992 12 08 + * latest update: 1999-04-24 12:01:58 + * $Id: hyxd03.c,v 1.3 2002/01/27 23:01:34 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/hytxt.h> +#include <gg/hyxd.h> + +/* ------------------------------------------------------------------------ */ +#define N_COMMANDS 16 +static char *commands [N_COMMANDS+1] = +{ + "quit", +#define CMD_quit 0 + "cluster", +#define CMD_cluster 1 + "fetch", +#define CMD_fetch 2 + "store", +#define CMD_store 3 + "delete", +#define CMD_delete 4 + "exists", +#define CMD_exists 5 + "last", +#define CMD_last_index 6 + "check", +#define CMD_check 7 + "diag", +#define CMD_diag 8 + "reindex", +#define CMD_reindex 9 + "fullindex", +#define CMD_fullindex 10 + "md5table", +#define CMD_md5table 11 + "purge", +#define CMD_purge 12 + "frames", +#define CMD_frames 13 + "translate", +#define CMD_translate 14 + "parse", +#define CMD_parse 15 + (char *) 0 +} ; + +/* ------------------------------------------------------------------------ */ +int hyx_d_command ( +struct HYXD_THREAD *thr, +char *line) +{ + int cmd; + char *wp= (char *) 0; + char *afn; + char *line2; + char *tfn; /* translated frame name */ + long size; + int rc; + struct HYX_CLUSTER_CONTROL *hcc; + struct FILE_SEGMENT *fseg, *fseg_new; + + /*** fprintf (stderr, ">> hyx_d_command: line=%s\n", line); ***/ + if (line [0] == '#' || line [0] == 0) return 0; + + if (thr == (struct HYXD_THREAD *) 0 + || (hcc= thr->hcc) == (struct HYX_CLUSTER_CONTROL *) 0 + ) + return -1; + + line2= thr->line2; + + cmd= find_command (line, commands, 0, N_COMMANDS-1); + wp= locate_word (line, 1); + + switch (cmd) + { + case CMD_cluster: + if (thr->hcc_defined) + { + fprintf (thr->fo, "ERROR cluster already set!\n"); + break; /* set cluster only once! */ + } + + if ((afn= translate_logic_filename (wp)) == (char *) 0) break; + hcc_set_cluster_name (hcc, afn); + free_or_what (afn); + thr->hcc_defined= 1; + + fprintf (thr->fo, "OK cluster set\n"); + break; + + case CMD_quit: + return 1; + + case CMD_fetch: + if (hcc_open (hcc, HCC_om_read) != 0 + || hyx_extract (thr->fo, hcc->HCC_f_hyx, hcc->HCC_f_idx, + hcc->HCC_f_lut, hcc->HCC_f_xfn, + wp, 0, HYXEF_add_dot) != 0 + ) + fprintf (thr->fo, "ERROR frame not found\n"); + break; + + case CMD_parse: + if (hcc_open (hcc, HCC_om_read) != 0 + || hyx_extract (thr->fo, hcc->HCC_f_hyx, hcc->HCC_f_idx, + hcc->HCC_f_lut, hcc->HCC_f_xfn, + wp, 0, HYXEF_add_dot) != 0 + ) + fprintf (thr->fo, "ERROR frame not found\n"); + break; + + case CMD_store: + case CMD_delete: + hcc_close (hcc); + fseg= (struct FILE_SEGMENT *) 0; + size= 0L; + + if (cmd == CMD_delete) + rc= hyx_setup_delete_segment (&fseg, &fseg_new, wp, &size); + else + rc= hyx_setup_stdin_segment (&fseg, &fseg_new, wp, &size); + + if (rc == 0) + fprintf (thr->fo, "OK %ld\n", size); + else + fprintf (thr->fo, "ERROR frame not found\n"); + + fflush (thr->fo); /* flush now, if client waits for OK */ + + if (!rc) + { + hyx_update (hcc->HCC_fnm_hyx, hcc->HCC_fnm_idx, hcc->HCC_fnm_lut, + hcc->HCC_fnm_xfn, fseg, 0); + hyx_destroy_segments (fseg); + } + break; + + case CMD_translate: + if ((tfn= hyx_translate_special_frame (wp)) != (char *) 0) + { + fprintf (thr->fo, "OK %s\n", tfn); + free_or_what (tfn); + } + else + fprintf (thr->fo, "ERROR\n"); + break; + + case CMD_exists: + if (hcc_open (hcc, HCC_om_read) != 0 + || (size= hyx_seek_by_name (hcc->HCC_f_hyx, hcc->HCC_f_idx, + hcc->HCC_f_lut, hcc->HCC_f_xfn, wp)) < 0L + ) + fprintf (thr->fo, "ERROR frame not found\n"); + else + fprintf (thr->fo, "OK %ld\n", size); + break; + + case CMD_last_index: + if ((size= hyx_get_last_index (hcc->HCC_fnm_idx)) <= 0L) + fprintf (thr->fo, "OK 0\n"); + else + fprintf (thr->fo, "OK %ld\n", size); + break; + + case CMD_frames: + if (hcc_open (hcc, HCC_om_read) != 0) + { + fprintf (thr->fo, "ERROR\n"); + return -1; + } + fprintf (thr->fo, "DATA\n"); + hyx_dump_frame_list (hcc->HCC_f_lut, hcc->HCC_f_xfn); + fputs (".\n", thr->fo); + break; + + case CMD_check: + case CMD_diag: + case CMD_reindex: + case CMD_fullindex: + case CMD_md5table: + case CMD_purge: + hcc_close (hcc); + switch (cmd) + { + case CMD_check: + sprintf (line2, "chksgml %s", hcc->HCC_fnm_hyx); + break; + case CMD_diag: + sprintf (line2, "chksgml -v %s", hcc->HCC_fnm_hyx); + break; + case CMD_reindex: + sprintf (line2, "hyxidx %s", hcc->HCC_fnm_hyx); + break; + case CMD_fullindex: + sprintf (line2, "hyxidx -i %s", hcc->HCC_fnm_hyx); + break; + case CMD_md5table: + sprintf (line2, "hyxidx -m %s", hcc->HCC_fnm_hyx); + break; + case CMD_purge: + sprintf (line2, "hyxpurge %s", hcc->HCC_fnm_hyx); + break; + } + + fprintf (thr->fo, "DATA\n%s\n", line2); + fflush (thr->fo); + + system (line2); + fputs ("\n.\n", thr->fo); + break; + + default: + fprintf (thr->fo, "ERROR unknown command\n"); + break; + } + fflush (thr->fo); + + return 0; +} diff --git a/app/sgml/hyxd03.o b/app/sgml/hyxd03.o new file mode 100644 index 0000000000000000000000000000000000000000..980b8f79da3669344233ef8e3c65d17a8b575287 Binary files /dev/null and b/app/sgml/hyxd03.o differ diff --git a/app/sgml/hyxd04.c b/app/sgml/hyxd04.c new file mode 100644 index 0000000000000000000000000000000000000000..380db4b1647fcf1107f8b8fc9ef745f56385a744 --- /dev/null +++ b/app/sgml/hyxd04.c @@ -0,0 +1,126 @@ +/* + * FILE %sgml/hyxd04.c + * + * Hypertext daemon + * - Ticket Operation + * + * written: 1994-04-09 + * latest update: 1997-09-14 18:34:16 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/hyxd.h> +#include <gg/hytxt.h> +#include <contrib/md5gg.h> + +/* ------------------------------------------------------------------------ */ +#define MAX_LINE 1024 +static char cluster [MAX_LINE]; +static char frame [MAX_LINE]; +static char ticket [MAX_LINE]; +static char *path_prefix= ""; + +/* ------------------------------------------------------------------------ */ +int http4hyx_command (FILE *fo, char *line, int mode) +{ + char *used_frame_name; +#define N_FIELDS 24 + char *fields [N_FIELDS]; + char *path_fields [N_FIELDS]; + int n_fields; + int n_path_fields; + int i; + int cluster_lng; + +fprintf (stderr, "http4hyx: line=%s\n", line); + + n_fields= isolate_tokens (line, fields, N_FIELDS); + if (n_fields < 1) return 0; + + for (i= 0; i<n_fields; i++) + fprintf (stderr, "*** http4hyx (hyxd04): fields[%d]=%s\n", i, fields[i]); + + to_upper (fields [0]); + if (abbrev ("QUIT", fields [0], 1) + || abbrev ("EXIT", fields [0], 1) + ) return 1; + + if (strcmp (fields [0], "GET") == 0) + { + if (strncmp (fields [2], "HTTP/", 5)) + { + fprintf (fo, "HTTP/1.0 200 OK\r\n"); + fprintf (fo, "Content-Type: text/html\r\n\r\n"); + } + + n_path_fields= split_string (fields[1], '/', path_fields, N_FIELDS); +fprintf (stderr, "n_path_fields=%d\n", n_path_fields); + if (n_path_fields < 1 + || ((mode & HYXD_ticket_required) && n_path_fields < 2) ) + { + fprintf (stderr, "http4hyx (hyxd04): GET not enough fields!\n"); + return 1; + } + + for (i= 0; i < n_path_fields; i++) + fprintf (stderr, + "*** http4hyx (hyxd04): path_fields[%d]=%s\n", + i, path_fields[i]); + + if (n_path_fields < 2 + || ((mode & HYXD_ticket_required) && n_path_fields < 3) + ) + { + strcpy (frame, "$$root"); + } + else + { + url2frame_name (path_fields [n_path_fields-1], frame, MAX_LINE); + n_path_fields--; + } + + if (mode & HYXD_ticket_required) + { + strncpy (ticket, path_fields [n_path_fields-1], MAX_LINE-2); + /* #### TICKET CHECKING HERE #### */ + n_path_fields--; + } + + sprintf (cluster, "%s", path_fields [1]); + for (i= 2; i < n_path_fields; i++) + { + cluster_lng= strlen (cluster); + if (strcmp (path_fields [i], ".") == 0 + || strcmp (path_fields [i], "..") == 0) continue; + sprintf (cluster+cluster_lng, "/%s", path_fields [i]); + } + + used_frame_name= (mode & HYXD_md5_transformation && *frame != '$') + ? MD5check_string ((unsigned char *) frame) + : frame; + + fprintf (stderr, "*** http4hyx (hyxd04): cluster=%s\n", cluster); + fprintf (stderr, "*** http4hyx (hyxd04): frame=%s\n", used_frame_name); + if (mode & HYXD_ticket_required) + fprintf (stderr, "*** http4hyx (hyxd04): ticket=%s\n", ticket); + + if (mode & HYXD_preformatted) fprintf (fo, "<PRE>\r\n"); + hyx_d_extract (fo, cluster, used_frame_name, path_prefix, mode); + if (mode & HYXD_preformatted) fprintf (fo, "</PRE>\r\n"); + + fflush (fo); + if (mode & HYXD_single_transaction) return 1; + } /* end GET command */ + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int http4hyx_set_path (char *pfx) +{ + path_prefix= pfx; + return 0; +} diff --git a/app/sgml/hyxd04.o b/app/sgml/hyxd04.o new file mode 100644 index 0000000000000000000000000000000000000000..163242d795daeb57198d1b6d39c2344b1ce25957 Binary files /dev/null and b/app/sgml/hyxd04.o differ diff --git a/app/sgml/hyxd05.c b/app/sgml/hyxd05.c new file mode 100644 index 0000000000000000000000000000000000000000..5d639c92886a06043f2e01c5c9ae8eda9a47a667 --- /dev/null +++ b/app/sgml/hyxd05.c @@ -0,0 +1,35 @@ +/* + * FILE ~/usr/sgml/hyxd05.c + * + * Hypertext daemon + * + * written: 1994-04-09 + * latest update: 1995-07-02 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> +#include <gg/hyxd.h> + +#define LINE_SIZE 1024 +static char line [LINE_SIZE]; + +/* ------------------------------------------------------------------------ */ +int http4hyx_daemon ( +FILE *fi, /* input stream */ +FILE *fo, /* output stream */ +int mode) +{ + int rc; + + for (;;) + { + rc= fread_line (fi, line, LINE_SIZE); + if (rc <= 0 && feof (fi)) break; + if (line [0] == '#') continue; + if (http4hyx_command (fo, line, mode) == 1) break; + } + + return 0; +} diff --git a/app/sgml/hyxd05.o b/app/sgml/hyxd05.o new file mode 100644 index 0000000000000000000000000000000000000000..0139d7fe9e825cfe491a4624985ebdc6640ca180 Binary files /dev/null and b/app/sgml/hyxd05.o differ diff --git a/app/sgml/hyxeng.h b/app/sgml/hyxeng.h new file mode 100644 index 0000000000000000000000000000000000000000..47ee49d9c087ffea19a10d7dc719afc095f10549 --- /dev/null +++ b/app/sgml/hyxeng.h @@ -0,0 +1,26 @@ +/* + * FILE E:\usr\sgml\hyxeng.h + * + * Prototypes f�r die HyperText Engine + * + * 1990 07 01 + * 1991 02 03: Revision + * + */ + +#ifndef __GG_hyxeng__ +#define __GG_hyxeng__ + +int cdecl hyx_engine_command (char *command); +void cdecl hyx_engine_opcode (int *command); +int cdecl hy_purge (char *fn, int verbose_mode); +int cdecl hyx_engine_list (FILE *fo, char *fn, + struct HYTXT_FRAME **hytxt_frame, + int list_mode, int scan_mode, int sort_mode, + int prnt_mode); +int cdecl hyx_engine_export (FILE *fo, char *fn, + struct HYTXT_FRAME **hytxt_frame, + int list_mode, char *frame, + void (*export_function) (int ch)); + +#endif diff --git a/app/sgml/hyxeng01.awk b/app/sgml/hyxeng01.awk new file mode 100644 index 0000000000000000000000000000000000000000..3965fe71b1f0d32461b70f6da27cf8e3f7dcee49 --- /dev/null +++ b/app/sgml/hyxeng01.awk @@ -0,0 +1,16 @@ +# Kommandos f�r die HyperText Engine in C Struktur umwandeln +# 1990 04 12 +BEGIN { + print "#ifndef __GG_hyxeng01_awk__" >>"$2"; + print "#define __GG_hyxeng01_awk__" >>"$2"; + +} +$1=="#" { next } + + { + print $1, $2, $3 >>"$1"; + print "# define HYXENG_"$3" "$1 >>"$2"; +} +END { + print "#endif" >>"$2"; +} \ No newline at end of file diff --git a/app/sgml/hyxeng01.bat b/app/sgml/hyxeng01.bat new file mode 100644 index 0000000000000000000000000000000000000000..101345708d04a983f35da25eb0e00c92655b2675 --- /dev/null +++ b/app/sgml/hyxeng01.bat @@ -0,0 +1,7 @@ +del $1 +del $2 +awk hyxeng01 hyxeng01.cmd +lutmake -mf $1 +copy $2 hyxeng01.h +echo static unsigned char hyxeng_cmd [] = >hyxeng01.inc +dump xxx.lut >>hyxeng01.inc diff --git a/app/sgml/hyxeng01.c b/app/sgml/hyxeng01.c new file mode 100644 index 0000000000000000000000000000000000000000..93052bdca10aaf453c4320391364995874b9f03b --- /dev/null +++ b/app/sgml/hyxeng01.c @@ -0,0 +1,86 @@ +/* + * FILE ~/usr/sgml/hyxeng01.c + * + * HyperText Engine + * + * written: 1990 04 12 + * latest update: 1994-12-11 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/hytxt.h> +#include <gg/lookup.h> +#include <gg/ztree.h> +#include "hyxeng.h" + +#include "hyxeng01.inc" + +static char hyx_cmd [256]; + +/* ------------------------------------------------------------------------ */ +int hyx_engine_command (char *command) +{ + int rv; /* erhaltener Funktionswert */ + int ret_val= 0; /* gelieferter Funktionswert */ + int lng; /* Laenge des gefundenen Worts, nicht ausgewertet */ + int cmd= 0; /* Beginn des zu ueberpruefenden Eintrags (=Command)*/ + int pars; /* Beginn der Parameter (ev. weitere Parameter) */ + int check; /* Zahl der zu ueberpruefenden Eintraege */ + int cp= 2; /* Code Pointer: Eintragung fuer weiteren Layer */ + /* der HyperEngine */ + struct WORD_INFO wi; /* wi.word_number ... HyperEngine OpCode */ + /* wi.word_frequency ... Mindestzahl der Parameter */ + + for (check= 1; check > 0; check--) + { + for (; command [cmd]; cmd++) + if (command [cmd] != ' ') break; + if (command [cmd] == 0) return -1; + + for (pars= cmd; command [pars]; pars++) + if (command [pars] == ' ') { command [pars++] = 0; break; } + + for (; command [pars]; pars++) + if (command [pars] != ' ') break; + + rv= lookup_char (hyxeng_cmd, &command [cmd], + (long *) &wi, /* ################## */ + &lng); + check += (wi.word_frequency / 256); + +/******************************* + printf (">> check=%d cmd=`%s' pars=`%s'\n", + check, &command [cmd], &command [pars]); + printf ("<< rv=%d lng=%d OpCode=%d Parameter: checked=%d unchecked=%d\n", + rv, lng, wi.word_number, + wi.word_frequency / 256, wi.word_frequency % 256); +*******************************/ + + if (!(rv & 0x0007)) return -1; + if (cp == 2) ret_val= wi.word_number; + hyx_cmd [cp++]= (char) (wi.word_number / 256); /* OpCode abspeichern */ + hyx_cmd [cp++]= (char) (wi.word_number % 256); /* OpCode abspeichern */ + cmd= pars; + } + + /* Unchecked Parameter werden nur auf Vorhandensein geprueft */ + if ((wi.word_frequency % 256) > 0 && command [pars] == 0) return -1; + strcpy (&hyx_cmd [cp], &command [pars]); + cp += strlen (&command [pars]); + hyx_cmd [0]= (char) (cp / 256); + hyx_cmd [1]= (char) (cp % 256); + +/************************* + printf (">>"); + if (rv & LOOKUP_found) printf (" exakt"); + if (rv & LOOKUP_prefix) printf (" zu lang"); + if (rv & LOOKUP_prefix_3) printf (" Abkuerzung"); + printf ("\n"); +*************************/ + + hyx_engine_opcode ((int *) hyx_cmd); + + return ret_val; +} diff --git a/app/sgml/hyxeng01.cmd b/app/sgml/hyxeng01.cmd new file mode 100644 index 0000000000000000000000000000000000000000..337a56a1737d36ea007a19135d2ddc96040f2bf9 --- /dev/null +++ b/app/sgml/hyxeng01.cmd @@ -0,0 +1,42 @@ +# Verzeichnis der Kommandos der HyperText Engine +# +# 1990 04 12 +# +# ---------------------------------------------------------------------------- +# Aufbau der Eintr�ge in diesem File: +# +# <code> <pars> <command> +# � � ����������� Name des Kommandos +# � �������������������� Mindestanzahl der Parameter +# ��������������������������� OpCode f�r die HyperText Maschine +# +# Class 0: ------------------------------------------------------------------- + 1 0 help +# Class 1: ------------------------------------------------------------------- + 101 1 cluster <clustername> + 102 1 frame <framename> + 103 0 delete + 104 0 undelete + 105 1 rename <new-framename> + 106 1 move <new-clustername> + 107 1 output <out-file> + 110 1 format core|raw|NED|text + 111 1 processor <processor-name> +# Class 2: ------------------------------------------------------------------- + 201 1 attr <attributename> [<attributvalue>] + 202 1 delattr <attributename> + 203 0 touch +# Class 3: ------------------------------------------------------------------- + 301 0 purge + 302 0 export + 303 1 import <in-file> + 304 1 string +# Class 4: ------------------------------------------------------------------- + 401 0 list + 402 0 new + 499 0 quit +# Optionen: ------------------------------------------------------------------ + 1301 0 core + 1302 0 raw + 1303 0 NED + 1304 0 text diff --git a/app/sgml/hyxeng01.cni b/app/sgml/hyxeng01.cni new file mode 100644 index 0000000000000000000000000000000000000000..7adb624dc316744bcec4a55457fdc327b706dd0d --- /dev/null +++ b/app/sgml/hyxeng01.cni @@ -0,0 +1,29 @@ +static unsigned char hyxeng_cmd [] = +{ + 0x01, 0x08, 0x4E, 0x45, 0x44, 0x00, 0x17, 0x05, 0x00, 0x00, 0x01, + 0x09, 0x61, 0x74, 0x74, 0x72, 0x00, 0xC9, 0x00, 0x01, 0x00, 0x01, + 0x16, 0x63, 0x01, 0x0B, 0x6C, 0x75, 0x73, 0x74, 0x65, 0x72, 0x00, + 0x65, 0x00, 0x01, 0x00, 0x6F, 0x72, 0x65, 0x00, 0x15, 0x05, 0x00, + 0x00, 0x01, 0x16, 0x64, 0x65, 0x6C, 0x01, 0x09, 0x61, 0x74, 0x74, + 0x72, 0x00, 0xCA, 0x00, 0x01, 0x00, 0x65, 0x74, 0x65, 0x00, 0x67, + 0x00, 0x00, 0x00, 0x01, 0x0B, 0x65, 0x78, 0x70, 0x6F, 0x72, 0x74, + 0x00, 0x2E, 0x01, 0x00, 0x00, 0x01, 0x16, 0x66, 0x01, 0x0A, 0x6F, + 0x72, 0x6D, 0x61, 0x74, 0x00, 0x6E, 0x00, 0x01, 0x00, 0x72, 0x61, + 0x6D, 0x65, 0x00, 0x66, 0x00, 0x01, 0x00, 0x01, 0x09, 0x68, 0x65, + 0x6C, 0x70, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x0B, 0x69, 0x6D, + 0x70, 0x6F, 0x72, 0x74, 0x00, 0x2F, 0x01, 0x01, 0x00, 0x01, 0x09, + 0x6C, 0x69, 0x73, 0x74, 0x00, 0x91, 0x01, 0x00, 0x00, 0x01, 0x09, + 0x6D, 0x6F, 0x76, 0x65, 0x00, 0x6A, 0x00, 0x01, 0x00, 0x01, 0x08, + 0x6E, 0x65, 0x77, 0x00, 0x92, 0x01, 0x00, 0x00, 0x01, 0x0B, 0x6F, + 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x6B, 0x00, 0x01, 0x00, 0x01, + 0x19, 0x70, 0x01, 0x0D, 0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x6F, + 0x72, 0x00, 0x6F, 0x00, 0x01, 0x00, 0x75, 0x72, 0x67, 0x65, 0x00, + 0x2D, 0x01, 0x00, 0x00, 0x01, 0x09, 0x71, 0x75, 0x69, 0x74, 0x00, + 0xF3, 0x01, 0x00, 0x00, 0x01, 0x14, 0x72, 0x01, 0x07, 0x61, 0x77, + 0x00, 0x16, 0x05, 0x00, 0x00, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0x69, 0x00, 0x01, 0x00, 0x01, 0x14, 0x74, 0x01, 0x08, 0x65, 0x78, + 0x74, 0x00, 0x18, 0x05, 0x00, 0x00, 0x6F, 0x75, 0x63, 0x68, 0x00, + 0xCB, 0x00, 0x00, 0x00, 0x75, 0x6E, 0x64, 0x65, 0x6C, 0x65, 0x74, + 0x65, 0x00, 0x68, 0x00, 0x00, 0x00 +} ; + diff --git a/app/sgml/hyxeng01.h b/app/sgml/hyxeng01.h new file mode 100644 index 0000000000000000000000000000000000000000..a5900832bfbbc3cb8b29e606f3eb60f1f6b00901 --- /dev/null +++ b/app/sgml/hyxeng01.h @@ -0,0 +1,27 @@ +#ifndef __GG_hyxeng01_awk__ +#define __GG_hyxeng01_awk__ +# define HYXENG_help 1 +# define HYXENG_cluster 101 +# define HYXENG_frame 102 +# define HYXENG_delete 103 +# define HYXENG_undelete 104 +# define HYXENG_rename 105 +# define HYXENG_move 106 +# define HYXENG_output 107 +# define HYXENG_format 110 +# define HYXENG_processor 111 +# define HYXENG_attr 201 +# define HYXENG_delattr 202 +# define HYXENG_touch 203 +# define HYXENG_purge 301 +# define HYXENG_export 302 +# define HYXENG_import 303 +# define HYXENG_string 304 +# define HYXENG_list 401 +# define HYXENG_new 402 +# define HYXENG_quit 499 +# define HYXENG_core 1301 +# define HYXENG_raw 1302 +# define HYXENG_NED 1303 +# define HYXENG_text 1304 +#endif diff --git a/app/sgml/hyxeng01.inc b/app/sgml/hyxeng01.inc new file mode 100644 index 0000000000000000000000000000000000000000..7332ed180c78d7d4ac753393a61bef122f70b406 --- /dev/null +++ b/app/sgml/hyxeng01.inc @@ -0,0 +1,30 @@ +static unsigned char hyxeng_cmd [] = +{ + 0x01, 0x08, 0x4E, 0x45, 0x44, 0x00, 0x17, 0x05, 0x00, 0x00, 0x01, + 0x09, 0x61, 0x74, 0x74, 0x72, 0x00, 0xC9, 0x00, 0x01, 0x00, 0x01, + 0x16, 0x63, 0x01, 0x0B, 0x6C, 0x75, 0x73, 0x74, 0x65, 0x72, 0x00, + 0x65, 0x00, 0x01, 0x00, 0x6F, 0x72, 0x65, 0x00, 0x15, 0x05, 0x00, + 0x00, 0x01, 0x16, 0x64, 0x65, 0x6C, 0x01, 0x09, 0x61, 0x74, 0x74, + 0x72, 0x00, 0xCA, 0x00, 0x01, 0x00, 0x65, 0x74, 0x65, 0x00, 0x67, + 0x00, 0x00, 0x00, 0x01, 0x0B, 0x65, 0x78, 0x70, 0x6F, 0x72, 0x74, + 0x00, 0x2E, 0x01, 0x00, 0x00, 0x01, 0x16, 0x66, 0x01, 0x0A, 0x6F, + 0x72, 0x6D, 0x61, 0x74, 0x00, 0x6E, 0x00, 0x01, 0x00, 0x72, 0x61, + 0x6D, 0x65, 0x00, 0x66, 0x00, 0x01, 0x00, 0x01, 0x09, 0x68, 0x65, + 0x6C, 0x70, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x0B, 0x69, 0x6D, + 0x70, 0x6F, 0x72, 0x74, 0x00, 0x2F, 0x01, 0x01, 0x00, 0x01, 0x09, + 0x6C, 0x69, 0x73, 0x74, 0x00, 0x91, 0x01, 0x00, 0x00, 0x01, 0x09, + 0x6D, 0x6F, 0x76, 0x65, 0x00, 0x6A, 0x00, 0x01, 0x00, 0x01, 0x08, + 0x6E, 0x65, 0x77, 0x00, 0x92, 0x01, 0x00, 0x00, 0x01, 0x0B, 0x6F, + 0x75, 0x74, 0x70, 0x75, 0x74, 0x00, 0x6B, 0x00, 0x01, 0x00, 0x01, + 0x19, 0x70, 0x01, 0x0D, 0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x6F, + 0x72, 0x00, 0x6F, 0x00, 0x01, 0x00, 0x75, 0x72, 0x67, 0x65, 0x00, + 0x2D, 0x01, 0x00, 0x00, 0x01, 0x09, 0x71, 0x75, 0x69, 0x74, 0x00, + 0xF3, 0x01, 0x00, 0x00, 0x01, 0x14, 0x72, 0x01, 0x07, 0x61, 0x77, + 0x00, 0x16, 0x05, 0x00, 0x00, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x00, + 0x69, 0x00, 0x01, 0x00, 0x01, 0x0B, 0x73, 0x74, 0x72, 0x69, 0x6E, + 0x67, 0x00, 0x30, 0x01, 0x01, 0x00, 0x01, 0x14, 0x74, 0x01, 0x08, + 0x65, 0x78, 0x74, 0x00, 0x18, 0x05, 0x00, 0x00, 0x6F, 0x75, 0x63, + 0x68, 0x00, 0xCB, 0x00, 0x00, 0x00, 0x75, 0x6E, 0x64, 0x65, 0x6C, + 0x65, 0x74, 0x65, 0x00, 0x68, 0x00, 0x00, 0x00 +} ; + diff --git a/app/sgml/hyxeng02.c b/app/sgml/hyxeng02.c new file mode 100644 index 0000000000000000000000000000000000000000..c7621d4f4632ba65d68e78565a408eef030bd374 --- /dev/null +++ b/app/sgml/hyxeng02.c @@ -0,0 +1,254 @@ +/* + * FILE .../app/sgml/hyxeng02.c + * + * HyperText Engine + * + * written: 1990 04 13 + * latest update: 1999-04-24 12:00:17 + * $Id: hyxeng02.c,v 1.3 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/hytxt.h> +#include "hyxeng.h" +#include "hyxeng01.h" /* automatisch erzeugt aus HYXENG01.CMD */ + +#ifdef NIL +#undef NIL +#endif +#define NIL (char *) 0 + +#pragma check_stack(off) + +/* Prototypes von externen Funktionen: ------------------------------------ */ +void cdecl flip_int (int *); +void cdecl dump (FILE *fo, char *str, int lng); +void cdecl sgml_filter (int); +int cdecl sgml_0010_config_processor (int code); + +/* Prototypes von lokalen Funktionen: ------------------------------------- */ +void cdecl assign_string (char **dest, char *source, int lng); +void cdecl get_list_parameters (char *s, int *par3); + +/* ------------------------------------------------------------------------ */ +static char *cluster= NIL; +static char *frame= NIL; +static char *new_frame= NIL; +static char *new_cluster= NIL; +static char *out_file= NIL; + +static int agenda= 0; +static struct HYTXT_FRAME *hytxt_frame; +static int hytxt_frame_scanned= 0; + +static int out_file_open= 0; +static FILE *out_file_ptr; + +static int processor_code= -1; + +/* ------------------------------------------------------------------------ */ +static void out2_stdout (int ch) { fputc (ch, stdout); } +static void out2_outfile (int ch) { fputc (ch, out_file_ptr); } + +static void (*out_function) (int ch) = out2_stdout; +static void (*export_function) (int ch) = out2_stdout; + +void sgml_fputc (int ch) { (*out_function) (ch); } +void sgml_fputs (char *s) { for (; *s; s++) (*out_function) (*s); } + +/* ------------------------------------------------------------------------ */ +void hyx_engine_opcode (int *command) +{ + int rv; + int cp= 1; + int opcode; + int lng; + int par2; + int par3; + + lng= command [0]; + flip_int (&lng); + +/****************** + dump (stdout, (char *) command, lng); +******************/ + + opcode = command [cp++]; + flip_int (&opcode); + + switch (opcode) + { + case HYXENG_cluster: + assign_string (&cluster, (char *) &command [cp], lng-cp); + hytxt_frame_scanned = 0; + break; + case HYXENG_frame: + assign_string (&frame, (char *) &command [cp], lng-cp); + break; + case HYXENG_delete: + agenda |= 0x01; + break; + case HYXENG_undelete: + agenda |= 0x02; + break; + case HYXENG_rename: + assign_string (&new_frame, (char *) &command [cp], lng-cp); + break; + case HYXENG_move: + assign_string (&new_cluster, (char *) &command [cp], lng-cp); + break; + case HYXENG_output: /* output */ + assign_string (&out_file, (char *) &command [cp], lng-cp); + if (out_file_open) + { + fclose (out_file_ptr); + out_file_open=0; + if (*out_function == *export_function) + export_function = out2_stdout; + out_function = out2_stdout; + } + if (out_file [0]) + { + out_file_ptr = fopen (out_file, "ab"); + if (out_file_ptr != (FILE *) 0) out_file_open = 1; + if (*out_function == *export_function) + export_function = out2_outfile; + out_function = out2_outfile; + } + break; + + case HYXENG_touch: + agenda |= 0x04; + break; + case HYXENG_purge: + agenda |= 0x08; + break; + case HYXENG_export: /* export */ +/* printf (">> export\n"); */ + rv = hyx_engine_export (stdout, cluster, &hytxt_frame, + hytxt_frame_scanned, frame, + export_function); + if (rv >= 0) hytxt_frame_scanned=1; + break; + + case HYXENG_string: + { + char *_cp; + int _lng; + int _ch; + + _cp=(char *) &command [cp]; + _lng=lng-4; + cp++; + while (_lng > 0) + { + _lng--; + switch (_ch = *_cp++) + { + case '\\': + if (_lng <= 0) break; + _lng--; + switch (_ch = *_cp++) + { + case 'n': + sgml_fputc ('\n'); + break; + default: + sgml_fputc (_ch); + break; + } + break; + default: + sgml_fputc (_ch); + break; + } + } + } + break; + + case HYXENG_processor: + { + char *_cp; + int _lng; + + _cp=(char *) &command [cp]; + _lng=lng-4; + if (strncmp (_cp, "raw", _lng) == 0) processor_code = 0; else + if (strncmp (_cp, "LaTeX", _lng) == 0) processor_code = 1; else break; + switch (processor_code) + { + case 0: + export_function = out_function; + break; + case 1: + sgml_0010_config_processor (1); + export_function = sgml_filter; + break; + default: + break; + } + } + break; + + case HYXENG_list: /* list */ + /* Parameter auswerten */ +printf (">> list\n"); + par2= 2; + par3= 0x0001; + get_list_parameters ((char *) &command [cp], &par3); + rv = hyx_engine_list ((out_file_open) ? out_file_ptr : (FILE *) stdout, + cluster, &hytxt_frame, + hytxt_frame_scanned, + 0, par2, par3); + if (rv >= 0) hytxt_frame_scanned=1; + break; + + case HYXENG_new: /* new */ + hytxt_frame_scanned=0; + if (cluster != NIL) free (cluster); cluster = NIL; + if (frame != NIL) free (frame); frame = NIL; + if (new_cluster != NIL) free (new_cluster); new_cluster = NIL; + if (new_frame != NIL) free (new_frame); new_frame = NIL; + break; + } + +/****************** + printf ("<<< cluster=%s frame=%s agenda=%04X\n", cluster, frame, agenda); +******************/ +} + +/* ------------------------------------------------------------------------ */ +void assign_string ( +char **dest, +char *source, +int lng) +{ + char *cp; + if (*dest != NIL) free (*dest); + *dest = cp = malloc (lng+1); + while (lng-- > 0) *cp++ = *source++; + *cp = 0; +} + +/* ------------------------------------------------------------------------ */ +void get_list_parameters ( +char *s, +int *par3) +{ + for (; *s; s++) + switch (*s) + { + case 'a': /* print attributes */ + *par3 |= 0x0002; + break; + case '*': /* Print All Version */ + *par3 |= 0x4000; + break; + case 'p': /* Print Position of Frame */ + *par3 |= 0x8000; + break; + } +} diff --git a/app/sgml/hyxeng03.c b/app/sgml/hyxeng03.c new file mode 100644 index 0000000000000000000000000000000000000000..2216f8fb8354a2408337a8ae2fc9c72c42b2ab2a --- /dev/null +++ b/app/sgml/hyxeng03.c @@ -0,0 +1,101 @@ +/* + * FILE ~/usr/sgml/hyxeng03.c + * + * written: 1990 04 13: aus File HYX.C isoliert + * latest update: 1994-12-11 + * + */ + +#include <stdio.h> +#include <io.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/keys.h> +#include <gg/hytxt.h> +#include <gg/strings.h> +#include "hyxeng.h" + +static char filenm2 [66]; +static char filenmt [66]; + +/* ------------------------------------------------------------------------ */ +int hy_purge ( +char *fn, +int verbose_mode) +{ + struct stat buf; + int i, j, rv; + + if (access (fn, 0) != 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -2; + } + + for (i= strlen (fn) -1; i >= 0; i--) + if (fn [i] == '\\' || fn [i] == ':') break; + + if (i >= 0) + { + i++; + strncpy (filenm2, fn, i); + filenm2 [i] = 0; + } + else i= j= 0; + + strcpy (&filenm2 [i], "_BAK_FTR.NED"); + if (stat (filenm2, &buf) == -1 || + !(buf.st_mode & S_IFDIR)) /* Directory ??? */ + { + j= i; + } + else + { + j= strlen (filenm2); + filenm2 [j++] = '\\'; + filenm2 [j ] = 0; + } + + for (;;) + { + if (fn [i] == '.' || fn [i] == 0) break; + filenm2 [j++] = fn [i++]; + } + + strcpy (&filenm2 [j], ".@HY"); + strcpy ( filenmt, fn); + strcpy (&filenmt [i], ".$Y$"); + + if (verbose_mode > 1) + { + printf ("i=%d j=%d\n", i, j); + printf ("%s\n", fn); + + blanks (stdout, i); + fputc ('^', stdout); + fputc ('\n', stdout); + printf ("%s\n", filenm2); + + blanks (stdout, j); + fputc ('^', stdout); + fputc ('\n', stdout); + } + + if (verbose_mode > 0) + { + printf ("Purge %s -> %s (%s) -: ", fn, filenm2, filenmt); + i = kbin (); + if (i == 0x1B) { printf ("ESC\n"); return -1; } + if (i == 'n' || i == 'N') { printf ("NO\n"); return -2; } + } + + rv= hytxt_purge (fn, filenm2, filenmt); + if (verbose_mode > 0) printf ("%d\n", rv); + if (rv == 0) + { + unlink (fn); + rename (filenmt, fn); + } + return 0; +} diff --git a/app/sgml/hyxeng04.c b/app/sgml/hyxeng04.c new file mode 100644 index 0000000000000000000000000000000000000000..574dae3b862b56e6838b33281ef8ab2c5a40c5c2 --- /dev/null +++ b/app/sgml/hyxeng04.c @@ -0,0 +1,84 @@ +/* + * FILE E:\usr\sgml\hyxeng04.c + * + * 1990 04 13: aus File HYX.C isoliert + * + */ + +# pragma check_stack(off) +# include <stdio.h> +# include <gg/hytxt.h> +# include "hyxeng.h" + +/* ------------------------------------------------------------------------ */ +int hyx_engine_list ( +FILE *fo, +char *fn, /* Cluster Name */ +struct HYTXT_FRAME **hytxt_frame, /* Frame Liste */ +int list_mode, /* 0: Frame Liste scannen */ + /* 1: Frame Liste bereits gescannt */ +int scan_mode, +int sort_mode, +int prnt_mode) /* Bit 0: Frame Names */ + /* Bit 1: Attributes */ +{ + int rv; + struct HYTXT_FRAME *ht; + struct HYTXT_ATTR *ha; + + ht = (struct HYTXT_FRAME *) 0; + + switch (list_mode) + { + case 0: + rv = hytxt_scan (fn, &ht, scan_mode); + if (rv < 0) + { + /* fprintf (stderr, "Error scanning file %s\n", fn); ### */ + return -1; + } + *hytxt_frame = ht; + break; + case 1: + ht = *hytxt_frame; + break; + } + +/**************************** +printf ("<<< sort_mode=%d scan_mode=%d list=%08lX\n", +sort_mode, scan_mode, ht); +****************************/ + + hytxt_sort (&ht, sort_mode); + *hytxt_frame = ht; + + fprintf (fo, "Cl %s\n", fn); + for (; + ht != (struct HYTXT_FRAME *) 0; + ht = ht->hytxt_frame_next) + { + if (ht->hytxt_frame_newer != (struct HYTXT_FRAME *) 0 + && !(prnt_mode & 0x4000)) continue; + if ((ht->hytxt_frame_flags & HYTXT_FRFLAG_TOPURGE) + && !(prnt_mode & 0x4000)) continue; + + if (prnt_mode & 0x0001) + fprintf (fo, "Fr %s\n", ht->hytxt_frame_name); + if (prnt_mode & 0x8000) + fprintf (fo, "Bo 0x%08lX 0x%08lX\n", + ht->hytxt_frame_pos_beg, ht->hytxt_frame_pos_end); + if (prnt_mode & 0x0002) + { + fprintf (fo, "FF %04X\n", ht->hytxt_frame_flags); + for (ha = ht->hytxt_attr; + ha != (struct HYTXT_ATTR *) 0; + ha = ha->hytxt_attr_next) + { + fprintf (fo, "At %s := %s\n", + ha->hytxt_attr_id, ha->hytxt_attr_pars); + } + } + } + fprintf (fo, "-- ----------------\n"); + return 0; +} diff --git a/app/sgml/hyxeng05.c b/app/sgml/hyxeng05.c new file mode 100644 index 0000000000000000000000000000000000000000..c6ed3b06b8c3c24fd76d8f7816a29279f9e82757 --- /dev/null +++ b/app/sgml/hyxeng05.c @@ -0,0 +1,86 @@ +/* + * FILE ~/usr/sgml/hyxeng05.c + * + * written: 1990 04 13: aus File HYX.C isoliert + * latest update: 1994-07-23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/hytxt.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include "hyxeng.h" + +/* ------------------------------------------------------------------------ */ +int hyx_engine_export ( +FILE *fo, /* Fehler Ausgabe ??? */ +char *fn, /* Cluster Name */ +struct HYTXT_FRAME **hytxt_frame, /* Frame Liste */ +int list_mode, /* 0: Frame Liste scannen */ + /* 1: Frame Liste bereits gescannt */ +char *frame, /* Name des auszugebenden Frames */ +void (*export_function) (int ch)) /* Ausgabe Funktion */ +{ + int rv, ch; + struct HYTXT_FRAME *ht; + FILE *fi; /* Hypertext File Input */ + int fi_opened= 0; + long cpy_size; + int copied= 0; + + ht= (struct HYTXT_FRAME *) 0; + + switch (list_mode) + { + case 0: + rv = hytxt_scan (fn, &ht, 0x0003); + if (rv < 0) + { + fprintf (fo, "** Error scanning file %s\n", fn); + return rv; + } + *hytxt_frame = ht; + break; + case 1: + ht = *hytxt_frame; + break; + } + + for (; + ht != (struct HYTXT_FRAME *) 0; + ht = ht->hytxt_frame_next) + { + if (ht->hytxt_frame_newer != (struct HYTXT_FRAME *) 0 + || (ht->hytxt_frame_flags & HYTXT_FRFLAG_TOPURGE)) continue; + if (match (frame, ht->hytxt_frame_name) > 0) + { + if (!fi_opened) fi = fopen (fn, "rb"); + if (fi == (FILE *) 0) break; + fi_opened = 1; + cpy_size = ht->hytxt_frame_pos_end - ht->hytxt_frame_pos_beg + 1L; + fseek (fi, ht->hytxt_frame_pos_beg, 0); + /* ftransfer (fi, out_file_ptr, cpy_size); ***/ + while (cpy_size-- > 0L) + { + ch = fgetc (fi) & 0x00FF; + if (feof (fi)) break; + (*export_function) (ch); + } + copied=1; + } + } + + if (fi_opened) fclose (fi); + if (!copied) + { + fprintf (fo, "** Frame `%s' not found in %s\n", frame, fn); + } + + return 0; +} diff --git a/app/sgml/hyxidx b/app/sgml/hyxidx new file mode 100755 index 0000000000000000000000000000000000000000..ef659416771157098cf024b9762047603d736bac Binary files /dev/null and b/app/sgml/hyxidx differ diff --git a/app/sgml/hyxidx.c b/app/sgml/hyxidx.c new file mode 100644 index 0000000000000000000000000000000000000000..894150842bf315ba1dcd00511a1a8438eddde466 --- /dev/null +++ b/app/sgml/hyxidx.c @@ -0,0 +1,191 @@ +/* + * FILE %sgml/hyxidx.c + * + * indexing of NED's .HYX HyperText files + * - prototypes + * - HELP + * + * written: 1991 05 17 + * 1992 12 07: revision + * latest update: 1997-01-05 18:20:34 + * $Id: hyxidx.c,v 1.2 2002/07/17 07:19:40 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <gg/filename.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/hytxt.h> + +#ifdef MSDOS +#include <io.h> +#include <conio.h> +#endif + +/* ------------------------------------------------------------------------ */ +#define REAL_AUTHOR +#define STDHLP stderr +#define FILENM_SIZE 1024 + +static char filenm [FILENM_SIZE]; +static int verbose_level= 0; +static char *index_frame= (char *) 0; +static char *md5_frame= (char *) 0; +static int index_flags= HYXIDX_FLAG_default; +static int index_format= HYXIDX_FMT_NORMAL; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: hyxidx [options] {file name}\n", + "OPTIONS:\n", + " -f<filename> ... list of files\n", + " -i[<index_frame>] ... generate index frame; [DEF: $$index]\n", + " -m[<md5_frame>] ... generate md5 frame; [DEF: $$md5]\n", + " -t<n> ... format of index frame\n", + " 0 ... normal format:\n", + " MD5 Checksum, length, link, name\n", + " 1 ... link format (?)\n", + " 2 ... docdir format (not available yet)\n", + " -x ... force scan through cluster\n", + " -r ... subdirs\n", + " -v ... verbose mode\n", + "EXAMPLES:\n", + " hyxidx -i %%crf create a new index for the cross ref cluster\n", + "NOTES:\n", + " option -i causes a full scan through the cluster and the generation\n", + " of MD5 checksums over each frame. This can be used to identify\n", + " changed frames later on.\n", + " \"RSA Data Security, Inc. MD5 Message-Digest Algorithm\"\n", + " This algorithm was specified in rfc1321.\n", + "\n", + "(@)Ahyxidx.c 1.29 #D$1997-01-05 18:20:43\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl hyxidx_main_fnc (char *fn, void *cd); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + char *arg; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; + + if (argc <= 1) goto HLP; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) return 1; + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, + hyxidx_main_fnc, (void *) 0); + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + + case 'i': case 'I': + index_frame= (arg [2] == 0) ? "$$index" : arg+2; + index_flags |= HYXIDX_FLAG_full_scan; + break; + case 'm': case 'M': + md5_frame= (arg [2] == 0) ? "$$md5" : arg+2; + index_flags |= HYXIDX_FLAG_full_scan; + break; + case 't': case 'T': + /* this parameter should be symbolic! */ + index_format= (int) get_parameter_value (arg+2); + break; + + case 'v': case 'V': + if (arg [2] >= '0' && arg [2] <= '9') + verbose_level= (int) get_parameter_value (arg+2); + else goto VERBINC; + break; + + case 'r': case 'R': + case 'x': case 'X': +VERBINC: + for (j= 1; arg [j]; j++) + switch (arg [j]) + { + case 'r': case 'R': + wcrd2_set_subdirs (wcrd, 1); + break; + case 'v': case 'V': + verbose_level++; + break; + case 'x': case 'X': + index_flags |= HYXIDX_FLAG_full_scan; + break; + default: + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + + while ((arg= (char *) array_shift (arguments)) != (char *) 0) + if (arg [0] == '-') + { + if ((fi2= fopen (translate_logic_filename (arg+2), "rt")) + == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", arg+2); + break; + } + + for (;;) + { + j= fread_line (fi2, filenm, FILENM_SIZE); + if (j <= 0 && feof (fi2)) break; + + if (wcrd2_wildcards (wcrd, filenm) == -1) + { + fclose (fi2); + goto STOP; + } + } + fclose (fi2); + } + else + { + if (wcrd2_wildcards (wcrd, arg) == -1) goto STOP; + } + +STOP: + return 0; +} + +/* ------------------------------------------------------------------------ */ +int hyxidx_main_fnc (char *fn, void *cd) +{ +#ifdef MSDOS + cd; +#endif + + return hyx_index (fn, index_frame, md5_frame, index_format, + index_flags, verbose_level); +} diff --git a/app/sgml/hyxidx.o b/app/sgml/hyxidx.o new file mode 100644 index 0000000000000000000000000000000000000000..11aeefcc43577c0a1626cacab4ecc543d0629631 Binary files /dev/null and b/app/sgml/hyxidx.o differ diff --git a/app/sgml/hyxidx01.c b/app/sgml/hyxidx01.c new file mode 100644 index 0000000000000000000000000000000000000000..97d8c1558fb77496a1cf2cbc6fc95de99c283af6 --- /dev/null +++ b/app/sgml/hyxidx01.c @@ -0,0 +1,535 @@ +/* + * FILE %sgml/hyxidx01.c + * + * make index for hyx-hypertext cluster + * + * written: 1991 05 17 + * latest update: 1999-04-24 12:00:33 + * $Id: hyxidx01.c,v 1.3 2002/07/17 07:19:40 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#include <io.h> +#else +#include <unistd.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/ytree.h> +#include <gg/lookup.h> +#include <gg/hytxt.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +static char *name_hyx; +static char *name_idx; +static char *name_lut; +static char *name_xfn; + +static int ex_hyx; +static int ex_idx; +static int ex_lut; +static int ex_xfn; + +static int index_format; +static char *index_frame= (char *) 0; +static char *x_md5_frame= (char *) 0; + +static struct HYTXT_FRAME frame; +static char frame_name [1024]; + +/* ------------------------------------------------------------------------ */ +static struct YTREE *ytree= (struct YTREE *) 0; + +/* limitations: ----------------------------------------------------------- */ +#ifdef MSDOS +#define LEX_IDX_BLOCKS 128 +#define LEX_IDX_BLOCKSIZE 1024 +#else +#define LEX_IDX_BLOCKS 2048 +#define LEX_IDX_BLOCKSIZE 2048 +#endif + +static long lex_idx_cnt= 1L; +static int lex_idx_block_cnt= 0; +static int initialized= 0; + +/* ------------------------------------------------------------------------ */ +struct LEXICON_INDEX +{ + long LEXI_begin; + long LEXI_end; +} ; + +static struct LEXICON_INDEX *lex_idxs [LEX_IDX_BLOCKS]; + +/* Note: Frame begin and end coordinates (byte counts incremented by 1) */ +/* are stored in struct LEXICON_INDEX. */ +/* lex_idxs is a table that points to up to 128 tables */ +/* of LEXICON_INDEX tables which can store 1024 such entries. */ +/* Complicated? Uh, is it? */ +/* ------------------------------------------------------------------------ */ +struct SORT_LIST +{ + struct SORT_LIST *sl_next; + char *sl_name; + long sl_index; + long sl_size; + char *sl_md5; +} ; + +struct SORT_LIST *s_list= (struct SORT_LIST *) 0; + +/* ------------------------------------------------------------------------ */ +int hyx_index ( +char *fn, +char *idx_frame, +char *md5_frame, +int idx_format, +int idx_flags, +int verbose_mode) +{ + char *afn; + int rv= 0; + + if (fn == (char *) 0 || *fn == 0) return -1; + + if ((afn= translate_logic_filename (fn)) == (char *) 0) afn= fn; + + if (!initialized) + { + int i; + + initialized= 1; + for (i= 0; i < LEX_IDX_BLOCKS; i++) lex_idxs [0]= (void *) 0; + } + + /* setup frame names used for indexes */ + if (idx_frame != (char *) 0 && *idx_frame == 0) idx_frame= (char *) 0; + index_frame= idx_frame; + index_format= idx_format; + if (md5_frame != (char *) 0 && *md5_frame == 0) md5_frame= (char *) 0; + x_md5_frame= md5_frame; + + name_hyx= strdup (afn); + name_idx= fnmcpy2 (afn, ".idx"); + name_lut= fnmcpy2 (afn, ".lut"); + name_xfn= fnmcpy2 (afn, ".xfn"); + + ex_hyx= access (name_hyx, 0) ? 0 : 1; + ex_idx= access (name_idx, 0) ? 0 : 1; + ex_lut= access (name_lut, 0) ? 0 : 1; + ex_xfn= access (name_xfn, 0) ? 0 : 1; + + if (verbose_mode) + { + printf ("HYX (%d): %s\n", ex_hyx, name_hyx); + printf ("IDX (%d): %s\n", ex_idx, name_idx); + printf ("LUT (%d): %s\n", ex_lut, name_lut); + printf ("XFN (%d): %s\n", ex_xfn, name_xfn); + } + + if (!ex_hyx) return -1; + + if ((idx_flags & HYXIDX_FLAG_full_scan) + || !ex_idx + || !ex_lut + ) rv= hyx_index_full_scan (verbose_mode); + else + if (ex_xfn) rv= hyx_index_rescan (); + + /* else: nothing to do! */ + + free (name_hyx); + free (name_idx); + free (name_lut); + free (name_xfn); + + return rv; +} + +/* ------------------------------------------------------------------------ */ +int hyx_index_insert (char *frnm, long idx, void *client_data) +{ + struct YTREE *yt; + +#ifdef MSDOS + client_data; +#endif + + if (frnm == (char *) 0) return -1; + + if ((yt= (struct YTREE *) ytree_insert_word (&ytree, + (unsigned char *) frnm)) + == (struct YTREE *) 0) + { + fprintf (stderr, "error: yt==0 !!!\n"); + return -1; + } + + if (index_frame != (char *) 0) sort_frame (frnm, idx, 123L, (char *) 0); + + yt->YT_flags |= YTflag_EOW; + yt->YT_info= idx; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int sort_frame (char *fn, long idx, long siz, char *md5) +{ + struct SORT_LIST **slp, *sl; + int x; + + for (slp= &s_list;; slp= &(*slp)->sl_next) + { + if (*slp != (struct SORT_LIST *) 0 + && strcmp ((*slp)->sl_name, fn) == 0) + { /* update */ + sl= *slp; + goto UPDATE; + } + + if (*slp == (struct SORT_LIST *) 0 + || (x= strcmp_c ((*slp)->sl_name, fn)) > 0 + || (x == 0 && strcmp ((*slp)->sl_name, fn) > 0)) + { + if ((sl= (struct SORT_LIST *) calloc (sizeof (struct SORT_LIST), 1)) + == (struct SORT_LIST *) 0) + { + fprintf (stderr, "sort_frame: out of memory!\n"); + return -1; + } + + sl->sl_name= strdup (fn); + if (md5 != (char *) 0) sl->sl_md5= strdup (md5); + sl->sl_next= *slp; + *slp= sl; +UPDATE: + sl->sl_index= idx; + sl->sl_size= siz; + return 0; + } + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int hyx_index_dump_frame (FILE *fo, char *idx_frame, int idx_format) +{ + struct SORT_LIST *sl; + char *frnm; + + fprintf (fo, "<Frame %s>", idx_frame); + hyx_write_stamp (fo, "p=\"hyxidx\""); + if (strcmp (idx_frame, "$$root") != 0) + fprintf (fo, "<hyx.l dir=up fr=\"$$root\">\n"); + else fputc ('\n', fo); + + switch (idx_format) + { + default: + fprintf (fo, " This is \'%s\', the index of all frames\n", idx_frame); + fprintf (fo, " in the hypertext cluster \'%s\'\n", name_hyx); + fprintf (fo, " as generated by hyxidx.\n\n"); + break; + } + + switch (idx_format) + { + case HYXIDX_FMT_LINK: + fprintf (fo, " frame name\n"); + fprintf (fo, "---------------------------------------------------\n"); + fprintf (fo, "<hyx.index fmt=%d>\n", idx_format); + for (sl= s_list; sl != (struct SORT_LIST *) 0; sl = sl->sl_next) + { + frnm= sl->sl_name; + fprintf (fo, "<hyx.l fr=\"%s\" tdc=index tdp=%d>%s\n", + frnm, strlen (frnm), frnm); + } + fprintf (fo, "</hyx.index>\n"); + break; + + case HYXIDX_FMT_MD5: + fprintf (fo, +"MD5 Checksum index num. size frame name\n"); + fprintf (fo, +"--------------------------------------------------------------\n"); + fprintf (fo, "<hyx.index fmt=%d>\n", idx_format); + for (sl= s_list; sl != (struct SORT_LIST *) 0; sl= sl->sl_next) + { + frnm= sl->sl_name; + fprintf (fo, "%s 0x%08lX %6ld <hyx.l fr=\"%s\" tdc=index tdp=%d>%s\n", + (sl->sl_md5 == (char *) 0) + ? "................................" + : sl->sl_md5, + sl->sl_index, sl->sl_size, + frnm, strlen (frnm), frnm); + } + fprintf (fo, "</hyx.index>\n"); + break; + + case HYXIDX_FMT_NORMAL: + default: + fprintf (fo, "index num. size frame name\n"); + fprintf (fo, "----------------------------\n"); + fprintf (fo, "<hyx.index fmt=%d>\n", idx_format); + for (sl= s_list; sl != (struct SORT_LIST *) 0; sl= sl->sl_next) + { + frnm= sl->sl_name; + fprintf (fo, "0x%08lX %6ld <hyx.l fr=\"%s\" tdc=index tdp=%d>%s\n", + sl->sl_index, sl->sl_size, + frnm, strlen (frnm), frnm); + } + fprintf (fo, "</hyx.index>\n"); + break; + } + fprintf (fo, "</Frame>\n"); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +/* scan hyx file completely and produce idx and lut files */ +int hyx_index_full_scan (int verbose_mode) +{ + FILE *hyx; + FILE *lut; + FILE *idx; + long hyx_pos= 0L; + struct YTREE *yt; + int rc; + long act_index; + long act_length; + int block_num; + int block_idx; + int i; + long ii; + struct LEXICON_INDEX *lex_idx; + char md5_str [34]; + char *md5_ptr; + int index_dumps= 0; + char *idx_frame= (char *) 0; + int idx_format= 0; + + ytree= (struct YTREE *) 0; + frame.hytxt_frame_name= frame_name; + + md5_str [0]= 0; + md5_ptr= (x_md5_frame == (char *) 0) ? (char *) 0 : md5_str; + + ii= hyx_get_last_index (name_idx); + printf ("hyxidx: index=%s last_index=0x%08lX\n", name_idx, ii-1); + + if ((hyx= fopen (name_hyx, "rb")) == (FILE *) 0) return -1; + + for (;;) + { + rc= hytxt_scan_entry (hyx, &hyx_pos, &frame, + HYXSM_no_attributes|HYXSM_no_allocation, + md5_ptr); + + if (rc != 0) + { + fclose (hyx); + idx_frame= (char *) 0; + idx_format= 0; + +DUMP_INDEX: + if (index_dumps >= 2 || index_dumps < 0 + || s_list == (void *) 0) break; + + switch (index_dumps) + { + case 0: + idx_frame= index_frame; + idx_format= index_format; + break; + case 1: + idx_frame= x_md5_frame; + idx_format= HYXIDX_FMT_MD5; + break; + } + if (idx_frame == (char *) 0) break; + + /* als letztes den Index Frame einbauen */ + strcpy (frame_name, idx_frame); + if ((hyx= fopen (name_hyx, "ab")) != (FILE *) 0) + { + fputc ('\n', hyx); + fseek (hyx, 0L, 2); + frame.hytxt_frame_pos_beg= ftell (hyx); + hyx_index_dump_frame (hyx, idx_frame, idx_format); + frame.hytxt_frame_pos_end= ftell (hyx) -1L; + fclose (hyx); + } + index_dumps++; + } + + if (*frame_name == 0) continue; /* don't want empty frame names */ + + if ((yt= (struct YTREE *) ytree_insert_word (&ytree, + (unsigned char *) frame_name)) + == (struct YTREE *) 0) + { + printf ("error: yt == 0 !!!\n"); + return -1; + } + + if (yt->YT_info == 0L) + { + yt->YT_flags |= YTflag_EOW; + yt->YT_info= act_index= lex_idx_cnt; + lex_idx_cnt++; + } + else + { + act_index= yt->YT_info; + } + + act_length= frame.hytxt_frame_pos_end - frame.hytxt_frame_pos_beg + 1L; + if (index_frame != (char *) 0) + sort_frame (frame_name, act_index, act_length, md5_ptr); + + if (verbose_mode > 1) + { + printf ("0x%08lX 0x%08lX 0x%08lX %s %s\n", + act_index, frame.hytxt_frame_pos_beg, + act_length, md5_str, frame_name); + } + + if (act_index > lex_idx_cnt) + { + fprintf (stderr, + "act_index > lex_idx_cnt: %ld > %ld\n", act_index, lex_idx_cnt); + fprintf (stderr, + "... this should not happen, I guess, isn't it?\n"); + fclose (hyx); + return -1; + } + + block_num= (int) (act_index/((long)LEX_IDX_BLOCKSIZE)); + block_idx= (int) (act_index%((long)LEX_IDX_BLOCKSIZE)); + if (block_num >= lex_idx_block_cnt) + { + if (lex_idx_block_cnt >= LEX_IDX_BLOCKS) + lex_idx= (void *) 0; + else + { + lex_idx= lex_idxs[block_num] + = (struct LEXICON_INDEX *) + calloc (sizeof (struct LEXICON_INDEX), LEX_IDX_BLOCKSIZE); + lex_idx_block_cnt++; + } + } + else lex_idx= lex_idxs[block_num]; + + if (lex_idx == (void *) 0) + { + fprintf (stderr, "index block %d not available for %ld\n", + block_num, act_index); + fclose (hyx); + return -1; + } + lex_idx [block_idx].LEXI_begin= frame.hytxt_frame_pos_beg; + lex_idx [block_idx].LEXI_end= frame.hytxt_frame_pos_end; + + if (rc != 0) goto DUMP_INDEX; + } + + /* write LUT file */ + if ((lut= fopen (name_lut, "wb")) == (FILE *) 0) return -1; + ytree_size (ytree); + ytree_dump (lut, ytree); + fclose (lut); + + /* write IDX file */ + if ((idx= fopen (name_idx, "wb")) == (FILE *) 0) return -1; + dpp_fwrite_long (idx, -1L, 4); /* Dummy Index # 0 */ + dpp_fwrite_long (idx, -1L, 4); + dpp_fwrite_long (idx, -1L, 4); + lex_idx= lex_idxs[0]; + block_num= 1; + i= 1; + for (ii= 1; ii < lex_idx_cnt; ii++, i++) + { + if (i == LEX_IDX_BLOCKSIZE) + { + lex_idx=lex_idxs[block_num++]; + i=0; + } + dpp_fwrite_long (idx, lex_idx[i].LEXI_begin, 4); + dpp_fwrite_long (idx, lex_idx[i].LEXI_end, 4); + dpp_fwrite_long (idx, 0L, 4); + } + fclose (idx); + + fprintf (stderr, "highest index: %ld; index blocks: %d\n", + lex_idx_cnt, lex_idx_block_cnt); + + if (ex_xfn) unlink (name_xfn); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +/* scan lut file and include the xfn file into it */ +int hyx_index_rescan () +{ + ytree= (struct YTREE *) 0; + lut_process (name_lut, hyx_index_insert, (void *) 0, 0L); + xfn_process (name_xfn, hyx_index_insert, (void *) 0, 0L); + ytree_dump_to_lut_file (name_lut, ytree); + unlink (name_xfn); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef OLD_VERSION +int hyx_index_rescan () +{ + FILE *lut; + FILE *xfn; + long idx; + + /* scan lut file ... */ + if ((lut= fopen (name_lut, "rb")) == (FILE *) 0) return -1; + ytree_full_scan (lut, &ytree, (void *) 0, 0, (void *) 0, 0); + fclose (lut); + + /* scan extended frame name file */ + if ((xfn= fopen (name_xfn, "rb")) == (FILE *) 0) return -1; + for (;;) + { + fscanf (xfn, "%lx", &idx); + if (feof (xfn)) break; + fscanf (xfn, "%*[ \t]"); + fscanf (xfn, "%[^\n]", frame_name); + if (feof (xfn)) break; + fgetc (xfn); + + hyx_index_insert (frame_name, idx, (void *) 0); + } + fclose (xfn); + + /* write lut file back */ + if ((lut= fopen (name_lut, "wb")) == (FILE *) 0) return -1; + ytree_size (ytree); + ytree_dump (lut, ytree); + fclose (lut); + + unlink (name_xfn); + + return 0; +} +#endif diff --git a/app/sgml/hyxidx01.o b/app/sgml/hyxidx01.o new file mode 100644 index 0000000000000000000000000000000000000000..dcc18dfddf2a2ae8239d5e1a5fa3a95971025539 Binary files /dev/null and b/app/sgml/hyxidx01.o differ diff --git a/app/sgml/hyxm.c b/app/sgml/hyxm.c new file mode 100644 index 0000000000000000000000000000000000000000..6f4421a54b84f65df9fc51fa999a1e81397fe8b4 --- /dev/null +++ b/app/sgml/hyxm.c @@ -0,0 +1,45 @@ +/* + * FILE E:\usr\sgml\hyxx.c + * + * HyperText Extract - f�r FM + * + * 1990 04 13 + * + */ + +# include <stdio.h> +# include <io.h> + +void cdecl main (int argc, char *argv []); + +/* ------------------------------------------------------------------------ */ +void main (int argc, char *argv []) +{ + + FILE *fi, + *fo; + int i, ch; + long pos_from=0L, + pos_to=0L; + + if (access (argv [1], 0) != 0) return; + fo = fopen (argv [1], "ab"); + if (fo == (FILE *) 0) return; + + for (i=2;i<argc; i++) + { + fi = fopen (argv [i], "rb"); + if (fi == (FILE *) 0) goto ST; + + for (;;) + { + ch = fgetc (fi) & 0x00FF; + if (feof (fi)) break; + fputc (ch, fo); + } + fclose (fi); + } + +ST: + fclose (fo); +} diff --git a/app/sgml/hyxold.c b/app/sgml/hyxold.c new file mode 100644 index 0000000000000000000000000000000000000000..fa183bb1f12fa99c6306e5bc1243df288c63da1e --- /dev/null +++ b/app/sgml/hyxold.c @@ -0,0 +1,207 @@ +/* + * FILE %sgml/hyxold.c + * + * *** OBSOLETE ***, at least more or less ... + * + * Purgen von Hypertext Files + * - HELP + * + * written: 1990 02 16 + * latest update: 1994-12-11 (1996-10-14 0:21:23) + * + */ + +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/hytxt.h> +#include <gg/filename.h> + +#define STDHLP stderr +#define ARG_C_max 24 +static char *arg_v [ARG_C_max]; +static int arg_c= 0; + +static char filenm [66]; +static char line [512]; + +/* ------------------------------------------------------------------------ */ +static int verbose_mode= 0; +static int action= 0; /* 0 .. list contentents */ + /* 1 .. purge old version */ + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: hyx [options] {file name}\n", + "OPTIONS:\n", + " -f<fnm> ... List of Files\n", + " @[<fnm>] ... Execute HYX Script\n", + " -p[<m>] ... Purge\n", + " <m> frame seperator:\n", + " DEF ... no seperator [DEF]\n", + " n ... Newline: CR LF\n", + " -s -r ... Subdirs\n", + " -v ... Verbose Mode\n", + "(@)Ahyx.c 1.15 #D$1994-12-11 20:00:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +main (argc, argv) +int argc; +char *argv []; +{ FILE *fi2; + int i, j; + + for (i = 1; i < argc; i++) + if (argv [i][0] == '-' || argv [i][0] == '/') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + + case 'r': case 'R': + case 's': case 'S': + case 'v': case 'V': + for (j=1; argv [i][j]; j++) + switch (argv [i][j]) + { + case 'r': case 'R': + case 's': case 'S': + wcrd_set_subdirs (1); + break; + case 'v': case 'V': + verbose_mode++; + break; + } + break; + + case 'p': case 'P': + action=1; + switch (argv [i][2]) + { + case 'n': case 'N': + hytxt_purge_seperator ("\x0D\x0A", 2); + break; + default: + hytxt_purge_seperator ((char *) 0, 0); + break; + } + break; + +HLP: +#include <gg/help.inc> + } + else { + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + } + + if (arg_c) + { + for (i = 0; i < arg_c; i++) + { + if (arg_v [i][0] == '-') + { + if ((fi2= fopen (&arg_v [i][2], "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", &arg_v [i][2]); + break; + } + for (;;) + { + fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; + if (wcrd_wildcards_or_rec (filenm) == -1) + { + fclose (fi2); + goto STOP; + } + } + fclose (fi2); + } + else + { + if (arg_v [i][0] == '@') hyx_script (&arg_v [i][1]); + else + { + if (wcrd_wildcards_or_rec (arg_v [i]) == -1) goto STOP; + } + } + } + } + else hyx_script (""); + +STOP: + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn) +{ + struct HYTXT_FRAME *hyt; + + switch (action) + { + default: + case 0: + hyx_engine_list (stdout, fn, &hyt, 0, 0x0003, 2, 0x0003); + break; + case 1: + hy_purge (fn, 0); + break; + } +} + +/* ------------------------------------------------------------------------ */ +hyx_script (char *fn) +{ + FILE *fi; + int fi_open= 0; + int rv; + char *QUIT= "quit"; + + if (*fn == 0) + { + printf ("HYX Script shell ready\n"); + } + else + { + if ((fi= fopen (fn, "rt")) == (FILE *) 0) + { + fprintf (stderr, "Script File %s not opened!\n", fn); + return -1; + } + fi_open= 1; + } + + for (;;) + { + if (fi_open) + { + fscanf (fi, "%[^\n]", line); + if (feof (fi)) + { + strcpy (line, QUIT); + break; + } + fgetc (fi); + } + else + { + printf ("$ "); + scanf ("%[^\n]", line); + getchar (); + } + + rv= hyx_engine_command (line); + if (rv == 499) break; + } + + return 0; +} diff --git a/app/sgml/hyxpurge b/app/sgml/hyxpurge new file mode 100755 index 0000000000000000000000000000000000000000..06f68acde7376792dc9b18d1671bea8d5d900a14 Binary files /dev/null and b/app/sgml/hyxpurge differ diff --git a/app/sgml/hyxpurge.c b/app/sgml/hyxpurge.c new file mode 100644 index 0000000000000000000000000000000000000000..11de267b91cbb7e0c6c887bee529b6aa47230785 --- /dev/null +++ b/app/sgml/hyxpurge.c @@ -0,0 +1,176 @@ +/* + * FILE %sgml/hyxpurge.c + * + * purge hypertext clusters + * - HELP + * - prototypes + * + * written: 1991 02 16 + * 1992 12 07: revision + * latest update: 1995-11-19 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#ifdef MSDOS +#include <io.h> +#include <conio.h> +#else +#include <unistd.h> +#endif +#include <gg/hytxt.h> +#include <gg/filename.h> +#include <gg/sbr.h> +#include <gg/dpp.h> + +#define REAL_AUTHOR +#define STDHLP stderr +#ifdef MSDOS +#define ARG_C_max 24 +#else +#define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c= 0; + +/* Quick Hack: ------------------------------------------------------------ */ +#ifdef MSDOS +#define SUBDIRS /* Rekusive Suche durch das */ + /* Filesystem moeglich */ +#define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ +#else +#define wcrd_wildcards main_fnc +#endif + +/* ------------------------------------------------------------------------ */ +#define FILENM_SIZE 1024 +static char filenm [FILENM_SIZE]; +static int verbose_level= 0; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: hyxpurge [options] {file name}\n", + "OPTIONS:\n", + " -f<fnm> ... list of files\n", +#ifdef SUBDIRS + " -s -r ... subdirs\n", +#endif + " -v ... verbose mode\n", + "EXAMPLES:\n", + "\n", + "(@)Ahyxpurge.c 1.18 #D$1995-11-19 12:00:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + char *afn; + + if (argc <= 1) goto HLP; + + for (i = 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + + case 'v': case 'V': + if (argv[i][2] >= '0' && argv[i][2] <= '9') + verbose_level= (int) get_parameter_value (&argv[i][2]); + else goto VERBINC; + break; + +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': +#endif +VERBINC: + for (j= 1; argv [i][j]; j++) + switch (argv [i][j]) + { +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': + wcrd_set_subdirs (1); + break; +#endif + case 'v': case 'V': + verbose_level++; + break; + } + break; + +HLP: +#include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++]= argv [i]; + + if (arg_c) + { + int rc; + + for (i= 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if ((afn= translate_logic_filename (&arg_v[i][2])) == (void *) 0) + afn= &arg_v [i][2]; + if ((fi2= fopen (afn, "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", &arg_v [i][2]); + break; + } + + for (;;) + { + rc= fread_line (fi2, filenm, FILENM_SIZE); + if (rc <= 0 && feof (fi2)) break; +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (filenm) == -1) + { + fclose (fi2); + goto STOP; + } +#else + wcrd_wildcards (filenm); +#endif + } + fclose (fi2); + } + else + { +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (arg_v [i]) == -1) goto STOP; +#else + wcrd_wildcards (arg_v [i]); +#endif + } + } + +#ifdef SUBDIRS +STOP: +#endif + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *hyx_in) +{ + return hyx_purge (hyx_in, verbose_level); +} diff --git a/app/sgml/hyxpurge.o b/app/sgml/hyxpurge.o new file mode 100644 index 0000000000000000000000000000000000000000..46a75222d96cb79fc60b77d1a5f660aa35307475 Binary files /dev/null and b/app/sgml/hyxpurge.o differ diff --git a/app/sgml/hyxscan b/app/sgml/hyxscan new file mode 100755 index 0000000000000000000000000000000000000000..d9fb833d5b35b13d189cfbef4aaafc782b47fcba Binary files /dev/null and b/app/sgml/hyxscan differ diff --git a/app/sgml/hyxscan.c b/app/sgml/hyxscan.c new file mode 100644 index 0000000000000000000000000000000000000000..390a57909b91c8154eca24158b4962a9ab423f8a --- /dev/null +++ b/app/sgml/hyxscan.c @@ -0,0 +1,175 @@ +/* + * FILE %sgml/hyxscan.c + * + * scan a hyx file and report it's structure + * + * written: 1994-07-17 + * latest update: 1995-11-19 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/filename.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/hytxt.h> + +#define STDHLP stderr +#ifdef MSDOS +#define ARG_C_max 24 +#else +#define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c= 0; + +/* Quick Hack: ------------------------------------------------------------ */ +#ifdef MSDOS +#define SUBDIRS /* Rekursive Suche durch das */ + /* Filesystem moeglich */ +#define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ +#else +#define wcrd_wildcards main_fnc +#endif + +/* ------------------------------------------------------------------------ */ +#define FILENM_SIZE 1024 +static char filenm [FILENM_SIZE]; +static int verbose_level= 0; + +/* ------------------------------------------------------------------------ */ +#define GPL +static char *HELP []= +{ + "USAGE: hyxscan [options] {file name}\n", + "OPTIONS:\n", + " -f<fnm> ... list of files\n", +#ifdef SUBDIRS + " -s -r ... subdirs\n", +#endif + " -v ... verbose mode\n", + "EXAMPLES: \n", + "\n", + "(@)Ahyxscan.c 1.06 #D$1995-11-19 22:00:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= argv [i]; + break; + + case 'v': case 'V': + if (argv[i][2] >= '0' && argv[i][2] <= '9') + verbose_level= (int) get_parameter_value (&argv[i][2]); + else goto VERBINC; + break; + +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': +#endif +VERBINC: + for (j= 1; argv [i][j]; j++) + switch (argv [i][j]) + { +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': + wcrd_set_subdirs (1); + break; +#endif + case 'v': case 'V': + verbose_level++; + break; + default: + fprintf (stderr, "unknown option %c\n", argv[i][j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= argv [i]; + + if (arg_c) + { + int rc; + + for (i= 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if ((fi2= fopen (& arg_v [i][2], "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", &arg_v [i][2]); + break; + } + + for (;;) + { + rc= fread_line (fi2, filenm, FILENM_SIZE); + if (rc <= 0 && feof (fi2)) break; +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (filenm) == -1) + { + fclose (fi2); + goto STOP; + } +#else + wcrd_wildcards (filenm); +#endif + } + fclose (fi2); + } + else + { +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (arg_v [i]) == -1) goto STOP; +#else + wcrd_wildcards (arg_v [i]); +#endif + } + } + else + { +#ifdef SUBDIRS + wcrd_wildcards_or_rec ("*.*"); +#else + main_fnc ("Default.fil"); +#endif + } + +#ifdef MSDOS +STOP: +#endif + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn) +{ + return hytxt_scan_file (stdout, fn); +} diff --git a/app/sgml/hyxscan.o b/app/sgml/hyxscan.o new file mode 100644 index 0000000000000000000000000000000000000000..f2b15d7c2e9f974ebf83b5f60810e01b62e795ef Binary files /dev/null and b/app/sgml/hyxscan.o differ diff --git a/app/sgml/hyxseq b/app/sgml/hyxseq new file mode 100755 index 0000000000000000000000000000000000000000..e584ffda1a06c77b6e50787f5fd8fd3ce80aeee3 Binary files /dev/null and b/app/sgml/hyxseq differ diff --git a/app/sgml/hyxseq.c b/app/sgml/hyxseq.c new file mode 100644 index 0000000000000000000000000000000000000000..0a1a5534e970501d6e39a1304122a891784b45c6 --- /dev/null +++ b/app/sgml/hyxseq.c @@ -0,0 +1,213 @@ +/* + * FILE %sgml/hyxseq.c + * + * linearize hypertext frames + * see t2d for information about future enhancements + * - HELP + * + * written: 1991 07 20 + * 1992 12 07: revision + * latest update: 1996-03-24 17:45:09 + * $Id: hyxseq.c,v 1.2 2002/01/27 23:01:35 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#ifdef MSDOS +#include <io.h> +#include <conio.h> +#endif +#include <gg/hytxt.h> +#include <gg/sbr.h> +#include <gg/dpp.h> +#include <gg/filename.h> + +#define REAL_AUTHOR +#define STDHLP stderr +#ifdef MSDOS +#define ARG_C_max 24 +#else +#define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c= 0; + +/* quick hack: ------------------------------------------------------------ */ +#ifdef MSDOS +#define SUBDIRS /* Rekusive Suche durch das */ + /* Filesystem moeglich */ +#define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ +#else +#define wcrd_wildcards main_fnc +#endif + +/* ------------------------------------------------------------------------ */ +static int verbose_level= 0; +static int extract_flags= 0; +static char fnm_out [66]= "@hyxseq.@@@"; /* logic fnm translation!!! */ +static FILE *fo= (FILE *) 0; +static char *fo_mode= "wb"; + +static struct FILE_SEGMENT *fs_list= (struct FILE_SEGMENT *) 0; +static struct FILE_SEGMENT **fs_append= &fs_list; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: hyxseq [options] {cluster name}\n", + " hypertext sequencer\n", + "OPTIONS:\n", + " -c<cluster> ... name of HYX cluster to extract from\n", + " -l<filename> ... list of frames in a file\n", + " -f<framename> ... list of frames in a frame [DEF: $$sequence]\n", + " -x<framename> ... extract specified frame\n", + " -m<framename> ... extract specified frame after applying md5 hashing\n", + " -t ... total recall: extract all frames\n", + " -n ... write frame numbers before each frame\n", + " -e ... write eoln character after each frame\n", + " -o<fnm> ... append output to file\n", + " -O<fnm> ... overwrite output to file\n", + " -o- ... write to stdout\n", +#ifdef SUBDIRS + " -s -r ... subdirs\n", +#endif + " -v ... verbose mode\n", + "EXAMPLES:\n", + "\n", + "(@)Ahyxseq.c 1.29 #D$1996-03-24 17:45:42\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + char *afn; + struct FILE_SEGMENT *fs; + long index_number= 0L; + + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'f': case 'F': + case 'l': case 'L': + case 't': case 'T': + case 'x': case 'X': + case 'm': case 'M': + if ((fs= hyx_make_segment (fs_append, (char *) 0, &argv[i][2], + &index_number, + (int) argv[i][1] & 0x00FF, 0L, 0L)) + != (struct FILE_SEGMENT *) 0) + { + fs_append= &fs->FS_next; + } + else + { + fprintf (stderr, "error: to many items specified\n"); + break; + } + break; + + case 'c': case 'C': + if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= &argv [i][2]; + break; + + case 'n': case 'N': + extract_flags |= HYXEF_write_frame_number; + break; + + case 'e': case 'E': + extract_flags |= HYXEF_append_eoln; + break; + + case 'o': case 'O': + strcpy (fnm_out, &argv[i][2]); + fo_mode= (argv[i][1] == 'O') ? "wb" : "ab"; + break; + + case 'v': case 'V': + if (argv[i][2] >= '0' && argv[i][2] <= '9') + verbose_level= (int) get_parameter_value (&argv[i][2]); + else goto VERBINC; + break; + +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': +#endif +VERBINC: + for (j= 1; argv [i][j]; j++) + switch (argv [i][j]) + { +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': + wcrd_set_subdirs (1); + break; +#endif + case 'v': case 'V': + verbose_level++; + break; + } + break; + +HLP: +#include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + if (fs_list == (struct FILE_SEGMENT *) 0) + { + if ((fs= hyx_make_segment (fs_append, (char *) 0, "$$sequence", + &index_number, FSop_frame, 0L, 0L)) + != (struct FILE_SEGMENT *) 0) + fs_append= &fs->FS_next; + } + + if (arg_c) + { + if (strcmp (fnm_out, "-") == 0) + fo= stdout; + else + if (*fnm_out) + { + if ((afn= translate_logic_filename (fnm_out)) == (char *) 0) + afn= fnm_out; + fo= fopen (afn, fo_mode); + } + + for (i= 0; i < arg_c; i++) + { +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (arg_v [i]) == -1) goto STOP; +#else + wcrd_wildcards (arg_v [i]); +#endif + } + } + +#ifdef SUBDIRS +STOP: +#endif + + if (fo != (FILE *) 0) fclose (fo); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fnm_hyx) +{ + return hyx_seq (fo, fnm_hyx, fs_list, verbose_level, extract_flags); +} diff --git a/app/sgml/hyxseq.o b/app/sgml/hyxseq.o new file mode 100644 index 0000000000000000000000000000000000000000..87b7b4949b485cb88e8e13a5f107a29e4ea2d649 Binary files /dev/null and b/app/sgml/hyxseq.o differ diff --git a/app/sgml/hyxtest.pl b/app/sgml/hyxtest.pl new file mode 100644 index 0000000000000000000000000000000000000000..b57cf7df359ff3f4d5831bd658b4098c4859b04e --- /dev/null +++ b/app/sgml/hyxtest.pl @@ -0,0 +1,51 @@ +#!/usr/local/bin/perl +# FILE %usr/unixonly/iris/hyxtest.pl +# +# written: 1996-10-09 +# latest update: 1996-10-09 19:49:43 +# + +use hyx; + +@TEST= ( '$$root', 'urxn444' ); + +$cluster= tie (%HYX, hyx, 'test.hyx'); + +print "cluster='$cluster'\n"; +$last= hyx::last ($cluster); +print "last: $last\n"; +$str= $HYX{'$$root'}; +print "str='$str'\n"; + +foreach $frame (@TEST) +{ + $ex= exists ($HYX{$frame}); + $size= hyx::EXISTS ($cluster, $frame); + print "exists: '$frame' -> $ex, $size\n"; +} + +$res= hyx::check ($cluster); +print "check: '$res'\n"; + +# $res= hyx::diag ($cluster); +$res= $cluster->diag; +print "diag: '$res'\n"; + +$HYX{'perl frame'}= <<EOF; +<Frame perl frame> +This is the PERL frame! +</Frame> +EOF +exit (0); + +foreach $frame (sort keys %HYX) +{ + print "frame: '$frame'\n"; +} + +exit (0); +exit (0); + + + + diff --git a/app/sgml/hyxthr.c b/app/sgml/hyxthr.c new file mode 100644 index 0000000000000000000000000000000000000000..b5da8286c7cc5596021524ca6677f9eb4f001ffc --- /dev/null +++ b/app/sgml/hyxthr.c @@ -0,0 +1,227 @@ +/* + * FILE %sgml/hyxthr.c + * + * linearize hypertext frames + * see t2d for information about future enhancements + * + * written: 1995-05-21 + * latest update: 1995-11-19 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#ifdef MSDOS +#include <io.h> +#include <conio.h> +#endif +#include <gg/hytxt.h> +#include <gg/sbr.h> +#include <gg/dpp.h> +#include <gg/parse.h> +#include <gg/filename.h> + +#define REAL_AUTHOR +#define STDHLP stderr +#ifdef MSDOS +#define ARG_C_max 24 +#else +#define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c= 0; + +/* quick hack: ------------------------------------------------------------ */ +#ifdef MSDOS +#define SUBDIRS /* Rekusive Suche durch das */ + /* Filesystem moeglich */ +#define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ +#else +#define wcrd_wildcards main_fnc +#endif + +/* ------------------------------------------------------------------------ */ +static int verbose_level= 0; +static int extract_flags= 0; +static char fnm_out [66]= "@hyxseq.@@@"; /* logic fnm translation!!! */ +static FILE *fo= (FILE *) 0; +static char *fo_mode= "wb"; +static char *thread_name= "inetk"; + +static struct FILE_SEGMENT *fs_list= (struct FILE_SEGMENT *) 0; +static struct FILE_SEGMENT **fs_append= &fs_list; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: hyxthr [options] {cluster name}\n", + " hypertext threader\n", + "OPTIONS:\n", + " -c<cluster> ... name of HYX cluster to extract from\n", + " -l<filename> ... list of frames in a file\n", + " -f<framename> ... list of frames in a frame [DEF: $$sequence]\n", + " -x<framename> ... extract specified frame\n", + " -m<framename> ... extract specified frame after applying md5 hashing\n", + " -t ... total recall: extract all frames\n", + " -n ... write frame numbers before each frame\n", + " -e ... write eoln character after each frame\n", + " -o<fnm> ... append output to file\n", + " -O<fnm> ... overwrite output to file\n", + " -o- ... write to stdout\n", + " -q<name> ... thread name\n", + " -u ... write frame names to stdout\n", +#ifdef SUBDIRS + " -s -r ... subdirs\n", +#endif + " -v ... verbose mode\n", + "\n", + "(@)Ahyxthr.c 1.04 #D$1995-11-19 12:00:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + char *afn; + struct FILE_SEGMENT *fs; + long index_number= 0L; + char *tag_definitions; + + tag_definitions= set_etc_filename ((char *) 0, "lexicon.tags"); + + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'f': case 'F': + case 'l': case 'L': + case 't': case 'T': + case 'x': case 'X': + case 'm': case 'M': + if ((fs= hyx_make_segment (fs_append, (char *) 0, &argv[i][2], + &index_number, + (int) argv[i][1] & 0x00FF, 0L, 0L)) + != (struct FILE_SEGMENT *) 0) + { + fs_append= &fs->FS_next; + } + else + { + fprintf (stderr, "error: to many items specified\n"); + break; + } + break; + + case 'c': case 'C': + if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= &argv [i][2]; + break; + + case 'n': case 'N': + extract_flags |= HYXEF_write_frame_number; + break; + + case 'e': case 'E': + extract_flags |= HYXEF_append_eoln; + break; + + case 'q': case 'Q': + thread_name= &argv [i][2]; + break; + + case 'u': case 'U': + extract_flags |= HYXEF_write_frame_name; + break; + + case 'o': case 'O': + strcpy (fnm_out, &argv[i][2]); + fo_mode= (argv[i][1] == 'O') ? "wb" : "ab"; + break; + + case 'v': case 'V': + if (argv[i][2] >= '0' && argv[i][2] <= '9') + verbose_level= (int) get_parameter_value (&argv[i][2]); + else goto VERBINC; + break; + +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': +#endif +VERBINC: + for (j= 1; argv [i][j]; j++) + switch (argv [i][j]) + { +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': + wcrd_set_subdirs (1); + break; +#endif + case 'v': case 'V': + verbose_level++; + break; + } + break; + +HLP: +#include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + if (fs_list == (struct FILE_SEGMENT *) 0) + { + if ((fs= hyx_make_segment (fs_append, (char *) 0, "$$sequence", + &index_number, FSop_frame, 0L, 0L)) + != (struct FILE_SEGMENT *) 0) + fs_append= &fs->FS_next; + } + + read_tag_definition (tag_definitions); + + if (arg_c) + { + if (strcmp (fnm_out, "-") == 0) + fo= stdout; + else + if (*fnm_out) + { + if ((afn= translate_logic_filename (fnm_out)) == (char *) 0) + afn= fnm_out; + fo= fopen (afn, fo_mode); + } + + for (i= 0; i < arg_c; i++) + { +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (arg_v [i]) == -1) goto STOP; +#else + wcrd_wildcards (arg_v [i]); +#endif + } + } + +#ifdef SUBDIRS +STOP: +#endif + + if (fo != (FILE *) 0) fclose (fo); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fnm_hyx) +{ + return hyx_thr (fo, fnm_hyx, fs_list, verbose_level, extract_flags, + thread_name); +} diff --git a/app/sgml/hyxx.c b/app/sgml/hyxx.c new file mode 100644 index 0000000000000000000000000000000000000000..5c767f0a30f2ef3a51447b18776e248021faf058 --- /dev/null +++ b/app/sgml/hyxx.c @@ -0,0 +1,75 @@ +/* + * FILE E:\usr\sgml\hyxx.c + * + * HyperText Extract - f�r FM + * + * 1990 04 13 + * + */ + +# include <stdio.h> +# include <string.h> +# include <io.h> + +void cdecl main (int, char *[]); + +static char aut [66]; + +void main (int argc, char *argv []) +{ + + FILE *fi, + *fo; + int i, + c; + long pos_from=0L, + pos_to=0L; + + for (i=0;i<6;i++) + { + c= argv [2][i]; + if (c >= 'a' && c <= 'f') c = c-'a'+10; else + if (c >= 'A' && c <= 'F') c = c-'A'+10; else + if (c >= '0' || c <= '9') c = c-'0'; else return; + pos_from = pos_from*16L + (long) c; + } + for (i=7;i<12;i++) + { + c= argv [2][i]; + if (c >= 'a' && c <= 'f') c = c-'a'+10; else + if (c >= 'A' && c <= 'F') c = c-'A'+10; else + if (c >= '0' || c <= '9') c = c-'0'; else return; + pos_to = pos_to*16L + (long) c; + } + + if (argc < 3) return; + + if (argc > 3) + { + if (argv [3][strlen (argv [3])-1] == '\\') + sprintf (aut, "%s%s", argv [3], argv [2]); + else sprintf (aut, "%s\\%s", argv [3], argv [2]); + } + else { + strcpy (aut, argv [2]); + } + +/****************** +printf ("arc=%s pos_from=%lx pos_to=%lx out=%s\n", + argv [1], pos_from, pos_to, aut); +getch (); +******************/ + + if (access (argv [1], 0) != 0) return; + fi = fopen (argv [1], "rb"); + if (fi == (FILE *) 0) return; + fo = fopen (aut, "wb"); + if (fo == (FILE *) 0) goto ST; + + fseek (fi, pos_from, 0); + for (; pos_from <= pos_to && ! feof (fi); pos_from++) + fputc (fgetc (fi), fo); + fclose (fo); +ST: + fclose (fi); +} diff --git a/app/sgml/lib b/app/sgml/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/sgml/make-dos b/app/sgml/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..87e8c62c93c57e38d7b076afaeb566fb9de592e1 --- /dev/null +++ b/app/sgml/make-dos @@ -0,0 +1,433 @@ +# +# FILE %sgml/makefile +# +# SGML and HyperText +# +# 1990 10 08: update ... +# latest update: 1996-10-13 13:05:41 +# +# ============================================================================ +cml=cl -Od -AL /Fo$* /c +cml3=cl -Od -AL /W3 /Fo$* /c +cms=cl -Od -AS /Fo$* /c +ccl=cl -Od -AL +ccs=cl -Od -AS +obj=objdec -w -d -m0 $*.obj +inst=command /c inst-exe +bin=c:\bin\ +lib=c:\usr\sbr\lsbr.lib +map=\dev\nul + +# --------------------------------------------------------------------------- +all.exe : lib_a ! + $(bin)chksgml.exe $(bin)hyxidx.exe $(bin)hyxseq.exe $(bin)hyxthr.exe ! + $(bin)hyxpurge.exe ! + $(bin)hyxd.exe $(bin)http4hyx.exe $(bin)httpsf.exe $(bin)hyxadd.exe ! + $(bin)hyxx.exe $(bin)hyxm.exe $(bin)sgmlproc.exe ! + $(bin)hyxscan.exe ! + msrv.exe + +all2.exe : sf05t.exe $(bin)hyx.exe + +# --------------------------------------------------------------------------- +HYXD= obj\hyxd01.obj obj\hyxd02.obj obj\hyxd03.obj obj\hyxd04.obj ! + obj\hyxd05.obj +CHKSGML=obj\chksgml1.obj obj\chksgml2.obj obj\chksgml3.obj obj\chksgml4.obj ! + obj\chksgml5.obj obj\chksgml6.obj +MSRV= obj\msrv01.obj obj\msrv02.obj obj\msrv03.obj obj\msrv04.obj ! + obj\msrv05.obj obj\msrv06.obj obj\msrv07.obj +HYXSF= obj\sf01.obj obj\sf02.obj obj\sf03.obj obj\sf04.obj ! + obj\sf05.obj + +lib_a: lib_a2 lib_a3 lsbr.lib + +lib_a2: $(CHKSGML) $(MSRV) $(HYXSF) $(HYXD) + +lib_a3: obj\hyxeng01.obj obj\hyxeng02.obj obj\hyxeng03.obj obj\hyxeng04.obj ! + obj\hyxeng05.obj obj\hyxidx01.obj obj\hyxadd01.obj ! + obj\sgml0001.obj obj\sgml0003.obj obj\sgml0004.obj ! + obj\sgml0005.obj obj\sgml0006.obj obj\sgml0007.obj obj\sgml0008.obj ! + obj\sgml0009.obj obj\sgml0010.obj obj\sgml0011.obj obj\sgml0012.obj ! + obj\sgml0013.obj + +lsbr.lib : + llink -v -l$(lib) -dsgml_a.mod -n0 + +# --------------------------------------------------------------------------- +sgml.sh : + shar -c -t sgml.sh -fmakeshar.lst + +# Hypertext Index: ----------------------------------------------------------- +obj\hyxidx.obj : hyxidx.c + $(cml3) hyxidx.c + $(obj) -sl 2 HYPER_TEXT + +obj\hyxidx01.obj : hyxidx01.c + $(cml3) hyxidx01.c + $(obj) -sl 2 HYPER_TEXT + +$(bin)hyxidx.exe : obj\hyxidx.obj obj\hyxidx01.obj + link obj\hyxidx obj\hyxidx01,$@,$(map),$(lib)/NOE/NOI; + $(inst) $@ + +# Hypertext Add: ------------------------------------------------------------- +obj\hyxadd.obj : hyxadd.c + $(cml3) hyxadd.c + $(obj) -sl 2 HYPER_TEXT + +obj\hyxadd01.obj : hyxadd01.c + $(cml3) hyxadd01.c + $(obj) -sl 2 HYPER_TEXT + +HYXADD=obj\hyxadd.obj obj\hyxadd01.obj +$(bin)hyxadd.exe : $(HYXADD) + link $(HYXADD),$@,$(map),$(lib)/NOE/NOI; + $(inst) $@ + +# Hypertext Sequencer: ------------------------------------------------------- +obj\hyxseq.obj : hyxseq.c + $(cml3) hyxseq.c + $(obj) -sl 2 HYPER_TEXT + +$(bin)hyxseq.exe : obj\hyxseq.obj + link obj\hyxseq,$@,$(map),$(lib)/NOE/NOI; + $(inst) $@ + +# Hypertext Threader: -------------------------------------------------------- +obj\hyxthr.obj : hyxthr.c + $(cml3) hyxthr.c + $(obj) -sl 2 HYPER_TEXT + +$(bin)hyxthr.exe : obj\hyxthr.obj + link obj\hyxthr,$@,$(map),$(lib)/NOE/NOI; + $(inst) $@ + +# Hypertext Purge: ----------------------------------------------------------- +obj\hyxpurge.obj : hyxpurge.c + $(cml3) hyxpurge.c + $(obj) -sl 2 HYPER_TEXT + +$(bin)hyxpurge.exe : obj\hyxpurge.obj + link obj\hyxpurge,$@,$(map),$(lib)/NOE/NOI; + $(inst) $@ + +# SGML Checker: -------------------------------------------------------------- +obj\chksgml.obj : chksgml.c + $(cml3) chksgml.c + $(obj) -sl 2 HYPER_TEXT + +$(bin)chksgml.exe : obj\chksgml.obj $(CHKSGML) + link obj\chksgml,$@,$(map),$(lib)/NOE/NOI; + $(inst) $@ + +obj\chksgml1.obj : chksgml1.c + $(cml3) chksgml1.c + $(obj) -sl 2 HYPER_TEXT + +obj\chksgml2.obj : chksgml2.c + $(cml3) chksgml2.c + $(obj) -sl 2 HYPER_TEXT + +obj\chksgml3.obj : chksgml3.c + $(cml3) chksgml3.c + $(obj) -sl 2 HYPER_TEXT + +obj\chksgml4.obj : chksgml4.c + $(cml3) chksgml4.c + $(obj) -sl 2 HYPER_TEXT + +obj\chksgml5.obj : chksgml5.c + $(cml3) chksgml5.c + $(obj) -sl 2 HYPER_TEXT + +obj\chksgml6.obj : chksgml6.c + $(cml3) chksgml6.c + $(obj) -sl 2 HYPER_TEXT + +# Hypertext daemon: ---------------------------------------------------------- +obj\hyxd.obj : hyxd.c + $(cml3) hyxd.c + $(obj) -sl 2 HYPER_TEXT + +HYXD=obj\hyxd.obj obj\hyxd01.obj obj\hyxd03.obj +$(bin)hyxd.exe : $(HYXD) + link $(HYXD),$@,$(map),$(lib)/NOE/NOI; + $(inst) $@ + +# Hypertext daemon: ---------------------------------------------------------- +obj\http4hyx.obj : http4hyx.c + $(cml3) http4hyx.c + $(obj) -sl 2 HYPER_TEXT + +$(bin)http4hyx.exe : obj\http4hyx.obj obj\hyxd04.obj obj\hyxd05.obj ! + obj\sf04.obj + link obj\http4hyx obj\hyxd04.obj obj\hyxd05.obj obj\sf04.obj,! + $@,$(map),$(lib)/NOE/NOI; + $(inst) $@ + +# Hypertext daemon: ---------------------------------------------------------- +obj\httpsf.obj : httpsf.c + $(cml3) httpsf.c + $(obj) -sl 2 HYPER_TEXT + +$(bin)httpsf.exe : obj\httpsf.obj $(HYXSF) + link obj\httpsf,$@,$(map),$(lib)/NOE/NOI; + $(inst) $@ + +# HyperText daemon: ---------------------------------------------------------- +obj\hyxd01.obj : hyxd01.c + $(cml3) hyxd01.c + $(obj) -sl 2 HYPER_TEXT + +obj\hyxd02.obj : hyxd02.c + $(cml3) hyxd02.c + $(obj) -sl 2 HYPER_TEXT + +obj\hyxd03.obj : hyxd03.c + $(cml3) hyxd03.c + $(obj) -sl 2 HYPER_TEXT + +obj\hyxd04.obj : hyxd04.c + $(cml3) hyxd04.c + $(obj) -sl 2 HYPER_TEXT + +obj\hyxd05.obj : hyxd05.c + $(cml3) hyxd05.c + $(obj) -sl 2 HYPER_TEXT + +# HyperText Filter ----------------------------------------------------------- +obj\sf01.obj : sf01.c + $(cml3) sf01.c + $(obj) -sl 2 HYPER_TEXT + +obj\sf02.obj : sf02.c + $(cml3) sf02.c + $(obj) -sl 2 HYPER_TEXT + +obj\sf03.obj : sf03.c + $(cml3) sf03.c + $(obj) -sl 2 HYPER_TEXT + +obj\sf04.obj : sf04.c + $(cml3) sf04.c + $(obj) -sl 2 HYPER_TEXT + +obj\sf05.obj : sf05.c + $(cml3) sf05.c + $(obj) -sl 2 HYPER_TEXT + +obj\sf05t.obj : sf05t.c + $(cml3) sf05t.c + $(obj) -sl 2 HYPER_TEXT + +sf05t.exe : obj\sf05t.obj obj\sf03.obj obj\sf04.obj obj\sf05.obj + link obj\sf05t obj\sf03 obj\sf04 obj\sf05,sf05t.exe,,c:\usr\sbr\lsbr/NOE/NOI; + +# HyperText Engine ----------------------------------------------------------- +obj\hyxeng01.obj : hyxeng.h hyxeng01.c hyxeng01.inc + $(cml3) hyxeng01.c + $(obj) -sl 2 HYPER_TEXT + +hyxeng01.inc : hyxeng01.cmd + command /c hyxeng01 + +obj\hyxeng02.obj : hyxeng.h hyxeng01.h hyxeng02.c + $(cml3) hyxeng02.c + $(obj) -sl 2 HYPER_TEXT + +obj\hyxeng03.obj : hyxeng.h hyxeng03.c + $(cml3) hyxeng03.c + $(obj) -sl 2 HYPER_TEXT + +obj\hyxeng04.obj : hyxeng.h hyxeng04.c + $(cml3) hyxeng04.c + $(obj) -sl 2 HYPER_TEXT + +obj\hyxeng05.obj : hyxeng.h hyxeng05.c + $(cml3) hyxeng05.c + $(obj) -sl 2 HYPER_TEXT + +# --------------------------------------------------------------------------- +test : sgmlt1a.exe sgmlt1b.exe sgmlt2a.exe sgmlt2b.exe + +obj\sgmlt1.obj : sgmlt1.c + $(cml3) sgmlt1.c + +obj\sgmlt2.obj : sgmlt2.c + $(cml) sgmlt2.c + +sgmlt1a.exe : obj\sgmlt1.obj + link obj\sgmlt1,sgmlt1a.exe,,c:\usr\sbr\lsbr/NOE/NOI; + +sgmlt1b.exe : obj\sgmlt1.obj obj\sgml0002.obj + link obj\sgmlt1 obj\sgml0002,sgmlt1b.exe,,c:\usr\sbr\lsbr/NOE/NOI; + +sgmlt2a.exe : obj\sgmlt2.obj + link obj\sgmlt2,sgmlt2a.exe,,c:\usr\sbr\lsbr/NOE/NOI; + +sgmlt2b.exe : obj\sgmlt2.obj obj\sgml0002.obj + link obj\sgmlt2 obj\sgml0002,sgmlt2b.exe,,c:\usr\sbr\lsbr/NOE/NOI; + +obj\sgmlproc.obj : sgmlproc.c + $(cml) sgmlproc.c + +$(bin)sgmlproc.exe : obj\sgmlproc.obj + link obj\sgmlproc,c:\bin\sgmlproc.exe,$(map),c:\usr\sbr\lsbr/NOE/NOI; + $(inst) c:\bin\sgmlproc.exe + +# ---------------------------------------------------------------------------- +obj\msrv.obj : msrv.c + $(cml3) /W3 msrv.c + $(obj) -sl 2 HYPER_TEXT + +obj\msrv01.obj : msrv01.c + $(cml3) /W3 msrv01.c + $(obj) -sl 2 HYPER_TEXT + +obj\msrv02.obj : msrv02.c + $(cml3) /W3 msrv02.c + $(obj) -sl 2 HYPER_TEXT + +obj\msrv03.obj : msrv03.c + $(cml3) /W3 msrv03.c + $(obj) -sl 2 HYPER_TEXT + +obj\msrv04.obj : msrv04.c + $(cml3) /W3 msrv04.c + $(obj) -sl 2 HYPER_TEXT + +obj\msrv05.obj : msrv05.c + $(cml3) /W3 msrv05.c + $(obj) -sl 2 HYPER_TEXT + +obj\msrv06.obj : msrv06.c + $(cml3) /W3 msrv06.c + $(obj) -sl 2 HYPER_TEXT + +obj\msrv07.obj : msrv07.c + $(cml3) /W3 msrv07.c + $(obj) -sl 2 HYPER_TEXT + +msrv.exe : obj\msrv.obj obj\msrv01.obj obj\msrv02.obj ! + obj\msrv03.obj obj\msrv04.obj obj\msrv05.obj obj\msrv06.obj ! + obj\msrv07.obj + link obj\msrv,,,$(lib); + +# SGML-Library --------------------------------------------------------------- +obj\sgml0001.obj : sgml0001.c + $(cml3) sgml0001.c + $(obj) -sl 2 SGML_TEXT + +obj\sgml0002.obj : sgml0002.c + $(cml3) sgml0002.c + $(obj) -sl 2 SGML_TEXT + +obj\sgml0003.obj : sgml0003.c + $(cml) sgml0003.c + $(obj) -sl 2 SGML_TEXT + +obj\sgml0004.obj : sgml0004.c + $(cml) sgml0004.c + $(obj) -sl 2 SGML_TEXT + +obj\sgml0005.obj : sgml0005.c + $(cml) sgml0005.c + $(obj) -sl 2 SGML_TEXT + +obj\sgml0006.obj : sgml0006.c + $(cml) sgml0006.c + $(obj) -sl 2 SGML_TEXT + +obj\sgml0007.obj : sgml0007.c + $(cml) sgml0007.c + $(obj) -sl 2 SGML_TEXT + +obj\sgml0008.obj : sgml0008.c + $(cml) sgml0008.c + $(obj) -sl 2 SGML_TEXT + +obj\sgml0009.obj : sgml0009.c + $(cml) sgml0009.c + $(obj) -sl 2 SGML_TEXT + +obj\sgml0010.obj : sgml0010.c + $(cml) sgml0010.c + $(obj) -sl 2 SGML_TEXT + +obj\sgml0011.obj : sgml0011.c + $(cml) sgml0011.c + $(obj) -sl 2 SGML_TEXT + +obj\sgml0012.obj : sgml0012.c + $(cml) sgml0012.c + $(obj) -sl 2 SGML_TEXT + +obj\sgml0013.obj : sgml0013.c + $(cml) sgml0013.c + $(obj) -sl 2 SGML_TEXT + +# ---------------------------------------------------------------------------- +obj\hyxold.obj : hyxold.c + $(cml) hyxold.c + $(obj) + +$(bin)hyxold.exe : obj\hyxold.obj + link obj\h0yxold,$@,$(map),c:\usr\sbr\lsbr/NOE/NOI; + $(inst) c:\bin\hyx.exe + +obj\hyxx.obj : hyxx.c + $(cml3) hyxx.c + $(obj) + +$(bin)hyxx.exe : obj\hyxx.obj + link obj\hyxx,c:\bin\hyxx.exe,\dev\nul,c:\usr\sbr\lsbr/NOE/NOI; + $(inst) c:\bin\hyxx.exe + +obj\hyxm.obj : hyxm.c + $(cml3) hyxm.c + $(obj) + +$(bin)hyxm.exe : obj\hyxm.obj + link obj\hyxm,c:\bin\hyxm,\dev\nul,c:\usr\sbr\lsbr/NOE/NOI; + $(inst) c:\bin\hyxm.exe + +# ---------------------------------------------------------------------------- +obj\hyxscan.obj : hyxscan.c + $(cml3) hyxscan.c + $(obj) + +$(bin)hyxscan.exe : obj\hyxscan.obj + link obj\hyxscan,c:\bin\hyxscan.exe,\dev\nul,c:\usr\sbr\lsbr/NOE/NOI; + $(inst) c:\bin\hyxscan.exe + +# +# RELICS ===================================================================== +# +relics.exe : hyb.exe frt1.exe sgmlkonv.exe + +obj\arc2hyx.obj : arc2hyx.c + $(cml) arc2hyx.c + $(obj) + +arc2hyx.exe : obj\arc2hyx.obj + link obj\arc2hyx,,,c:\usr\sbr\lsbr/NOE/NOI; + copy arc2hyx.exe c:\bin + +frt1.exe : frt1.obj + link frt1.obj,,\dev\nul,c:\usr\sbr\lsbr/NOE/NOI; + +frt1.obj : frt1.c + $(cml) frt1.c + +obj\hyb.obj : hyb.c + $(cml) hyb.c + +hyb.exe : obj\hyb.obj + link obj\hyb,,$(map),c:\usr\sbr\lsbr/NOE/NOI; + copy hyb.exe c:\bin + +obj\sgmlkonv.obj : sgmlkonv.c + $(cml) sgmlkonv.c + +sgmlkonv.exe : obj\sgmlkonv.obj + link obj\sgmlkonv,,$(map),c:\usr\sbr\lsbr/NOE/NOI; diff --git a/app/sgml/makeshar.lst b/app/sgml/makeshar.lst new file mode 100644 index 0000000000000000000000000000000000000000..1609c23e324a045b6ed52a7e1a93055a37b5ce48 --- /dev/null +++ b/app/sgml/makeshar.lst @@ -0,0 +1,59 @@ +# +# File %sgml/makeshar.lst (Contents) +# +# contents for shar file of the %sgml package +# +# written: 1992-12-14 +# latest update: 1999-04-24 12:07:22 +# +# ---------------------------------------------------------------------------- +# create link to dir with header files +>ln -fs ../gg gg +>ln -fs ../contrib contrib +>mkdir _bak_ftr.ned +a make-ux make-ux +a make-dos make-dos +>ln -s make-ux Makefile +a (dirinf).fm Files +a makeshar.lst Contents +# +a chksgml.c chksgml.c +a hyxd.c hyxd.c +a http4hyx.c http4hyx.c +a hyxidx.c hyxidx.c +a hyxadd.c hyxadd.c +a hyxseq.c hyxseq.c +a hyxthr.c hyxthr.c +a hyxpurge.c hyxpurge.c +a httpsf.c httpsf.c +a hyxscan.c hyxscan.c +a translit.c translit.c +# local library modules - - - - - - - - - - +a chksgml1.c chksgml1.c +a chksgml2.c chksgml2.c +a chksgml3.c chksgml3.c +a chksgml4.c chksgml4.c +a chksgml5.c chksgml5.c +a chksgml6.c chksgml6.c +a hyxidx01.c hyxidx01.c +a hyxadd01.c hyxadd01.c +a hyxd01.c hyxd01.c +a hyxd02.c hyxd02.c +a hyxd03.c hyxd03.c +a hyxd04.c hyxd04.c +a hyxd05.c hyxd05.c +a sf01.c sf01.c +a sf02.c sf02.c +a sf03.c sf03.c +a sf04.c sf04.c +a sf05.c sf05.c +a msrvh.h msrvh.h +a msrv.c msrv.c +a msrv01.c msrv01.c +a msrv02.c msrv02.c +a msrv03.c msrv03.c +a msrv04.c msrv04.c +a msrv05.c msrv05.c +a msrv06.c msrv06.c +a msrv07.c msrv07.c +# diff --git a/app/sgml/msrv b/app/sgml/msrv new file mode 100755 index 0000000000000000000000000000000000000000..2c0d14fec6a23746ea69e420228ee0acbf6b054b Binary files /dev/null and b/app/sgml/msrv differ diff --git a/app/sgml/msrv.c b/app/sgml/msrv.c new file mode 100644 index 0000000000000000000000000000000000000000..3658f4e06835fd06651bccf009a8b97d865df1d7 --- /dev/null +++ b/app/sgml/msrv.c @@ -0,0 +1,180 @@ +/* + * FILE ~/usr/gophtool/msrv.c + * + * template, standard command interpreter style + * - HELP + * - t2d + * - Menu + * + * written: 1994-06-18 + * latest update: 1995-04-30 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#ifdef MSDOS +#include <conio.h> +#include <gg/filename.h> +#define syslog fprintf +#define LOG_INFO stderr +#else +#include <syslog.h> +#include <unistd.h> +#endif +#include <gg/sbr.h> +#include "msrvh.h" + +#define STDHLP stdout +#ifdef MSDOS +#define ARG_C_max 24 +#else +#define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c= 0; + +/* Quick Hack: ------------------------------------------------------------ */ +#ifdef MSDOS +#define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ +#else +#define wcrd_wildcards main_fnc +#endif + +/* ------------------------------------------------------------------------ */ +#define FILENM_SIZE 1024 +static char filenm [FILENM_SIZE]; +static int verbose_mode= 0; +static int my_pid= 4711; + +static struct MSRV_defaults *Mdef= (struct MSRV_defaults *) 0; + +/* ------------------------------------------------------------------------ */ +#define GPL +static char *HELP []= +{ + "USAGE: msrv [options] {file name}\n", + "OPTIONS:\n", + " -f<filename> ... list of files\n", + " -v ... verbose mode\n", + " -d<fnm> ... read default settings from file; *** required ***\n", + "EXAMPLES: \n", + "\n", + "(@)Amsrv.c 1.05 #D$1995-04-27 09:00:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []); +int main_fnc (char *fn); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + + if (argc <= 1) goto HLP; + +#ifndef MSDOS + my_pid= getpid (); +#endif + + syslog (LOG_INFO, "msrv [%d]: starting up\n", my_pid); + + for (i= 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 0: + if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= "-"; + break; + case 'd': case 'D': + Mdef= msrv_get_defaults (&argv[i][2]); + break; + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= argv [i]; + break; + + case 'v': case 'V': + for (j=1; argv [i][j]; j++) + switch (argv [i][j]) + { + case 'v': case 'V': + verbose_mode= 1; + break; + default: + fprintf (stderr, "unknown option %c\n", argv[i][j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= argv [i]; + + if (Mdef == (struct MSRV_defaults *) 0) + { + fprintf (stderr, "no configuration file, can't proceed!\n"); + return 0; + } + printf ("database='%s'\n", Mdef->MD_database); + + if (arg_c) + { + int rc; + + for (i= 0; i < arg_c; i++) + if (arg_v [i][0] == '-' && arg_v [i][1] != 0) + { + if ((fi2= fopen (& arg_v [i][2], "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", &arg_v [i][2]); + break; + } + for (;;) + { + rc= fread_line (fi2, filenm, FILENM_SIZE); + if (rc <= 0 && feof (fi2)) break; + wcrd_wildcards (filenm); + } + fclose (fi2); + } + else + { + wcrd_wildcards (arg_v [i]); + } + } + else + { + main_fnc ("Default.fil"); + } + + syslog (LOG_INFO, "msrv [%d]: shutting down\n", my_pid); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn) +{ + FILE *fi; + + if ((fi= (strcmp (fn, "-") == 0) + ? (FILE *) stdin + : fopen (fn, "rb")) + == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", fn); + return -2; + } + + msrv_process_requests (fi, Mdef); + if (strcmp (fn, "-") != 0) fclose (fi); + + return 0; +} diff --git a/app/sgml/msrv.o b/app/sgml/msrv.o new file mode 100644 index 0000000000000000000000000000000000000000..a146c28d5a57a80cee0899dde2805c2a93494cce Binary files /dev/null and b/app/sgml/msrv.o differ diff --git a/app/sgml/msrv01.c b/app/sgml/msrv01.c new file mode 100644 index 0000000000000000000000000000000000000000..3e459e8fc325c2eb08e3288c03838ae00285acfb --- /dev/null +++ b/app/sgml/msrv01.c @@ -0,0 +1,256 @@ +/* + * FILE ~/usr/sgml/msrv01.c + * + * written: 1994-06-18 + * latest update: 1995-06-25 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/sbr.h> +#include <syslog.h> +#include <gg/strings.h> +#include "msrvh.h" +#ifndef MSDOS +#include <unistd.h> +#endif + +/* ------------------------------------------------------------------------ */ +static char line [LINE_SIZE]; +static char cmdline [LINE_SIZE]; + +static char From [FIELD_SIZE]; +static char Reply_To [FIELD_SIZE]; +static char Date [FIELD_SIZE]; +static char Subject [FIELD_SIZE]; + +static char tmp [FIELD_SIZE]; + +static int alphabet [256]; + +static struct MSRV_request Mrq; + +/* ------------------------------------------------------------------------ */ +static char *MSRV_transcript= "/tmp/msrv01.tmp"; +static char *MCMD_retrieve= "retrieve"; +static char *MCMD_help= "help"; +static char *MCMD_get= "get"; + +/* ------------------------------------------------------------------------ */ +static int reset_fields (void); +static int send_transcript (int transcript_status, + struct MSRV_defaults *msrv_def, struct MSRV_request *mrq); + +/* ------------------------------------------------------------------------ */ +int msrv_process_requests ( +FILE *fi, +struct MSRV_defaults *msrv_def) +{ + FILE *f_transcript= (FILE *) 0; + int transcript_ok= 0; + int rc; + char *fields[2]; + char *kw; + char *parm; + char *repl_addr; + int nfields; + int i; +#define STAT_undef 0 +#define STAT_header 1 +#define STAT_body 2 + int stat= STAT_header; + int auth_stat= MRas_anonymous; + + for (i= 0; i < 256; i++) alphabet [i]= 1; + put_chartable (alphabet, " \t", 0); + reset_fields (); + + Mrq.MR_From= From; + Mrq.MR_Subject= Subject; + Mrq.MR_Date= Date; + Mrq.MR_Reply_To= Reply_To; + Mrq.MR_authorization_status= auth_stat; + + for (;;) + { + rc= fread_line (fi, line, LINE_SIZE); + if (rc <= 0 && feof (fi)) break; + + if (strncmp (line, "From ", 5) == 0) + { + if (f_transcript != (FILE *) 0) + { + fclose (f_transcript); + send_transcript (transcript_ok, msrv_def, &Mrq); + } + stat= STAT_header; + reset_fields (); + f_transcript= fopen (MSRV_transcript, "w"); + continue; + } + + if (f_transcript != (FILE *) 0 && stat == STAT_body) + fprintf (f_transcript, "> %s\n", line); + + nfields= isolate2words (line, fields, 2, alphabet); + if (nfields > 2) nfields= 2; + if (nfields == 0) + { + if ((repl_addr= + msrv_pick_reply_address (Mrq.MR_From, Mrq.MR_Reply_To)) + == (char *) 0) + { + stat= STAT_undef; + continue; + } + Mrq.MR_reply_address= repl_addr; + printf ("repl_addr='%s'\n", repl_addr); + if (f_transcript != (FILE *) 0) + { + msrv_prepare_reply_header (f_transcript, msrv_def, &Mrq); + fprintf (f_transcript, + "Subject: Re: %s\n", Mrq.MR_Subject); + fputc ('\n', f_transcript); + fprintf (f_transcript, "TRANSCRIPT\n"); + transcript_ok= 1; + } + stat= STAT_body; + continue; + } + + kw= fields[0]; + Mrq.MR_action= kw; + + if (strcmp (kw, "reply") == 0 + || strcmp (kw, "transcript") == 0) + { /* ignore anything else after that point */ + stat= STAT_undef; + transcript_ok= 0; + continue; + } + + if (strcmp (kw, "quit") == 0 + || strcmp (kw, "bye") == 0 + || strcmp (kw, "thanks") == 0 + || strcmp (kw, "end") == 0) + { /* ignore anything else after that point */ + stat= STAT_undef; + if (f_transcript != (FILE *) 0) + { + fclose (f_transcript); + if (transcript_ok) + { /* ship the transcript */ + send_transcript (transcript_ok, msrv_def, &Mrq); + } + f_transcript= (FILE *) 0; + } + continue; + } + + if (nfields == 1) + { + if (stat == STAT_body) + { + if (abbrev (MCMD_help, kw, 1) == 1) + { + Mrq.MR_action= MCMD_get; + Mrq.MR_transformation= MRtr_simple; + msrv_send_dbentry (f_transcript, msrv_def, &Mrq, "help"); + } + } + + if (stat == STAT_body) + { + if (abbrev (MCMD_get, kw, 1) == 1) + msrv_send_dbentry (f_transcript, msrv_def, &Mrq, "$$root"); + } + } /* was: if (nfields == 1) */ + + if (nfields == 2) + { + parm= fields[1]; + to_lower (kw); + if (stat == STAT_header) + { + if (strcmp (kw, "from:") == 0) strcpy (From, parm); + if (strcmp (kw, "date:") == 0) strcpy (Date, parm); + if (strcmp (kw, "subject:") == 0) strcpy (Subject, parm); + if (strcmp (kw, "reply-to:") == 0) strcpy (Reply_To, parm); + } + + if (stat == STAT_body) + { + if (strcmp ("auth", kw) == 0) + { + auth_stat= msrv_check_authorization (f_transcript, msrv_def, parm); + Mrq.MR_authorization_status= auth_stat; + } + + if (abbrev (MCMD_get, kw, 1) == 1) + { + to_lower (parm); + Mrq.MR_transformation= MRtr_simple; + msrv_send_dbentry (f_transcript, msrv_def, &Mrq, parm); + } + + if (abbrev (MCMD_retrieve, kw, 4) == 1) + { + Mrq.MR_transformation= MRtr_none; + msrv_send_dbentry (f_transcript, msrv_def, &Mrq, parm); + } + + if (abbrev ("help", kw, 1) == 1) + { + to_lower (parm); + sprintf (tmp, "help %s", parm); + Mrq.MR_action= MCMD_get; + Mrq.MR_transformation= MRtr_simple; + msrv_send_dbentry (f_transcript, msrv_def, &Mrq, tmp); + } + + } /* was: if (stat == STAT_body) */ + } /* was: if (nfields == 2) */ + } /* was: for (;;) */ + + return 0; +} + +/* ------------------------------------------------------------------------ */ +static int reset_fields () +{ + From [0]= 0; + Date [0]= 0; + Reply_To [0]= 0; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +static int send_transcript ( +int transcript_ok, +struct MSRV_defaults *msrv_def, +struct MSRV_request *mrq) +{ +#ifndef MSDOS + int my_pid; + + my_pid= getpid(); + syslog (LOG_INFO, "msrv [%d] transcript to %s\n", + getpid (), mrq->MR_reply_address); +#else + mrq; +#endif + + if (transcript_ok) + sprintf (cmdline, "/usr/lib/sendmail -t <%s", MSRV_transcript); + else + sprintf (cmdline, "/usr/lib/sendmail -bm %s <%s", + msrv_def->MD_errors_to, MSRV_transcript); + + printf ("cmd=%s\n", cmdline); + system (cmdline); + + return 0; +} diff --git a/app/sgml/msrv01.o b/app/sgml/msrv01.o new file mode 100644 index 0000000000000000000000000000000000000000..da1dbdf5121fe7394c2b00a9e2af426014cc2aa0 Binary files /dev/null and b/app/sgml/msrv01.o differ diff --git a/app/sgml/msrv02.c b/app/sgml/msrv02.c new file mode 100644 index 0000000000000000000000000000000000000000..133dc1dfada8062831bb4ff3c9bab4b20584ec7b --- /dev/null +++ b/app/sgml/msrv02.c @@ -0,0 +1,107 @@ +/* + * FILE %sgml/msrv02.c + * + * get a frame from the database and ship it + * - t2d + * + * written: 1994-06-19 + * latest update: 1995-12-09 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/hyxd.h> +#include <gg/hytxt.h> +#include "msrvh.h" + +#ifndef MSDOS +#include <syslog.h> +#include <unistd.h> +#endif + +/* ------------------------------------------------------------------------ */ +static char cmdline [LINE_SIZE]; +static char *tmp_file1= "/tmp/msrv02a.tmp"; +static char *tmp_file2= "/tmp/msrv02b.tmp"; + +/* ------------------------------------------------------------------------ */ +int msrv_send_dbentry ( +FILE *f_transcript, +struct MSRV_defaults *mdef, +struct MSRV_request *mrq, +char *frame_name) +{ + FILE *fo1; /* output for the complete returned mail */ + FILE *fo2; /* temporary file for the extracted frame */ + int retr_rc; /* return code from the retrieve operation */ +#ifndef MSDOS + int my_pid; +#endif + +#ifdef DIAGNOSTICS + printf ("From: %s\n", mrq->MR_From); + printf ("Reply-To: %s\n", mrq->MR_Reply_To); + printf ("Date: %s\n", mrq->MR_Date); + printf ("Database: %s\n", mdef->MD_database); + printf ("Command: %s %s\n", mrq->MR_action, frame_name); +#endif /* DIAGNOSTICS */ + + /* prepare the header of the reply */ + if ((fo1= fopen (tmp_file1, "w")) == (FILE *) 0) return -1; + msrv_prepare_reply_header (fo1, mdef, mrq); + fprintf (fo1, "Subject: Re: %s %s\n", mrq->MR_action, frame_name); + fputc ('\n', fo1); + fprintf (fo1, "REPLY\n"); + + /* fetch the requested frame */ + if (f_transcript != (FILE *) 0) + fprintf (f_transcript, "database %s, retrieving frame '%s'\n", + mdef->MD_database, frame_name); + + switch (mrq->MR_transformation) + { + case MRtr_simple: + if ((fo2= fopen (tmp_file2, "w")) == (FILE *) 0) return -1; + retr_rc= hyx_d_extract (fo2, mdef->MD_database, frame_name, + (char *) 0, 0x00); + fclose (fo2); + /* strip the frame and append it to the header file */ + if (retr_rc == 0) + { + if (f_transcript != (FILE *) 0) + fprintf (f_transcript, "... stripping it\n"); + chksgml_file (fo1, stdout, tmp_file2, 0, 0L, 0x7FFFFFFFL, 0); + } + break; + + default: + retr_rc= hyx_d_extract (fo1, mdef->MD_database, frame_name, + (char *) 0, 0x00); + break; + } + + if (retr_rc != 0) + { + if (f_transcript != (FILE *) 0) + fprintf (f_transcript, "sorry, can't find frame '%s'\n", frame_name); + } + + fclose (fo1); + +#ifndef MSDOS + my_pid= getpid(); + syslog (LOG_INFO, "msrv [%d] sending (%s) '%s'\n", + getpid (), mdef->MD_database, frame_name); + syslog (LOG_INFO, "msrv [%d] to %s\n", getpid (), mrq->MR_reply_address); +#endif + + sprintf (cmdline, "/usr/lib/sendmail -t <%s", tmp_file1); + printf ("cmd=%s\n", cmdline); + system (cmdline); + + return 0; +} diff --git a/app/sgml/msrv02.o b/app/sgml/msrv02.o new file mode 100644 index 0000000000000000000000000000000000000000..60327e4d82cc116e036285a1fc9d84ba192387ec Binary files /dev/null and b/app/sgml/msrv02.o differ diff --git a/app/sgml/msrv03.c b/app/sgml/msrv03.c new file mode 100644 index 0000000000000000000000000000000000000000..8add019b74d2a7ef79e73d40aa0c65ff23d77c23 --- /dev/null +++ b/app/sgml/msrv03.c @@ -0,0 +1,93 @@ +/* + * FILE ~/usr/sgml/msrv03.c + * + * written: 1994-06-19 + * latest update: 1999-04-24 12:00:41 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include "msrvh.h" + +/* ------------------------------------------------------------------------ */ +static char line [LINE_SIZE]; + +/* ------------------------------------------------------------------------ */ +struct MSRV_defaults *msrv_get_defaults (char *fnm) +{ + FILE *fi; + struct MSRV_defaults *msrv_def; + struct MSRV_authorization *msrv_auth; +#define N_FIELDS 5 + char *fields [N_FIELDS]; + char *kw; + int n_fields; + int rc; + + if ((msrv_def= (struct MSRV_defaults *) + calloc (sizeof (struct MSRV_defaults), 1)) + == (struct MSRV_defaults *) 0) + { + fprintf (stderr, "msrv_get_defaults: can't allocate memory\n"); + return (struct MSRV_defaults *) 0; + } + + if ((fi= fopen (fnm, "r")) == (FILE *) 0) + { + fprintf (stderr, "msrv_get_defaults: can't read %s\n", fnm); + return (struct MSRV_defaults *) 0; + } + + for (;;) + { + rc= fread_line (fi, line, LINE_SIZE); + if (rc <= 0 && feof (fi)) break; + + if (line [0] == '#') continue; + n_fields= split_string (line, '|', fields, N_FIELDS); + if (n_fields == 0) continue; + + kw= fields[0]; + to_lower (kw); + + if (strcmp (kw, "database") == 0) + { + str_assign (&msrv_def->MD_database, fields[1]); + } + else + if (strcmp (kw, "sender") == 0) + { + str_assign (&msrv_def->MD_sender, fields[1]); + } + else + if (strcmp (kw, "errors-to") == 0) + { + str_assign (&msrv_def->MD_errors_to, fields[1]); + } + else + if (strcmp (kw, "cc") == 0) + { + str_assign (&msrv_def->MD_cc, fields[1]); + } + else + if (strcmp (kw, "name") == 0) + { + str_assign (&msrv_def->MD_name, fields[1]); + } + else + if (strcmp (kw, "authorize") == 0) + { + msrv_auth= msrv_make_authorization (fields[1], fields[2]); + msrv_auth->MA_next= msrv_def->MD_authorization; + msrv_def->MD_authorization= msrv_auth; + } + } + + fclose (fi); + + return msrv_def; +} diff --git a/app/sgml/msrv03.o b/app/sgml/msrv03.o new file mode 100644 index 0000000000000000000000000000000000000000..a279f2d6020164083d68f2d81db989d4f6ec8311 Binary files /dev/null and b/app/sgml/msrv03.o differ diff --git a/app/sgml/msrv04.c b/app/sgml/msrv04.c new file mode 100644 index 0000000000000000000000000000000000000000..271f5449a4fdb809250be9ab6867197ef57dc235 --- /dev/null +++ b/app/sgml/msrv04.c @@ -0,0 +1,23 @@ +/* + * FILE ~/usr/gophtool/msrv04.c + * + * written: 1994-06-20 + * latest update: 1999-04-25 16:39:50 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include "msrvh.h" + +/* ------------------------------------------------------------------------ */ +char *msrv_pick_reply_address ( +char *from, +char *reply_to) +{ + if (reply_to != (char *) 0 && *reply_to != 0) return reply_to; + return from; +} diff --git a/app/sgml/msrv04.o b/app/sgml/msrv04.o new file mode 100644 index 0000000000000000000000000000000000000000..463f36987e8b9bec332d2e2db8ad16bbb8be6b32 Binary files /dev/null and b/app/sgml/msrv04.o differ diff --git a/app/sgml/msrv05.c b/app/sgml/msrv05.c new file mode 100644 index 0000000000000000000000000000000000000000..a568bf53d8dbcb6fbf447a188b027a13ff75f3dc --- /dev/null +++ b/app/sgml/msrv05.c @@ -0,0 +1,30 @@ +/* + * FILE ~/usr/sgml/msrv05.c + * + * written: 1994-07-03 + * latest update: 1999-04-24 12:00:49 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include "msrvh.h" + +/* ------------------------------------------------------------------------ */ +struct MSRV_authorization *msrv_make_authorization (char *user, char *key) +{ + struct MSRV_authorization *msrv_auth; + + if ((msrv_auth= (struct MSRV_authorization *) + calloc (sizeof (struct MSRV_authorization), 1)) + != (struct MSRV_authorization *) 0) + { + msrv_auth->MA_user= strdup (user); + msrv_auth->MA_key= strdup (key); + } + + return msrv_auth; +} diff --git a/app/sgml/msrv05.o b/app/sgml/msrv05.o new file mode 100644 index 0000000000000000000000000000000000000000..30bd22201cb603e4a35104a467f25012c6bdccf1 Binary files /dev/null and b/app/sgml/msrv05.o differ diff --git a/app/sgml/msrv06.c b/app/sgml/msrv06.c new file mode 100644 index 0000000000000000000000000000000000000000..5a40df49b2837590e275f312394bcb222b0830bd --- /dev/null +++ b/app/sgml/msrv06.c @@ -0,0 +1,67 @@ +/* + * FILE .../app/sgml/msrv06.c + * + * see also: Mail Server Authorization + * + * written: 1994-07-03 + * latest update: 1999-04-25 17:03:53 + * $Id: msrv06.c,v 1.5 2006/04/09 08:10:24 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <contrib/md5gg.h> +#include "msrvh.h" + +#ifndef MSDOS +#include <syslog.h> +#include <unistd.h> +#endif + +/* ------------------------------------------------------------------------ */ +int msrv_check_authorization ( +FILE *f_transcript, +struct MSRV_defaults *msd, +char *auth) +{ + int rv= MRas_wrong; + struct MSRV_authorization *msrv_auth; + char *md5_string; + char *fields[2]; + + if ((md5_string= MD5check_string ((unsigned char *) auth)) + == (char *) 0) goto REPORT; + + for (msrv_auth= msd->MD_authorization; + msrv_auth != (struct MSRV_authorization *) 0; + msrv_auth= msrv_auth->MA_next) + { + if (strcmp (msrv_auth->MA_key, md5_string) == 0) + { + rv= MRas_ok; + break; + } + } + + if (f_transcript != (FILE *) 0) + { + fprintf (f_transcript, + (rv != MRas_ok) + ? "ATTENTION: authorization %s not ok!!\n" + : "authorization ok", + auth); + } + +REPORT: + isolate_words (auth, fields, 2); +#ifndef MSDOS + syslog (LOG_INFO, "msrv [%d] authorization %s/%d\n", + getpid(), fields[0], rv); +#endif + + return rv; +} diff --git a/app/sgml/msrv06.o b/app/sgml/msrv06.o new file mode 100644 index 0000000000000000000000000000000000000000..5f39399e454235a418f54bac6c2820be74775ec0 Binary files /dev/null and b/app/sgml/msrv06.o differ diff --git a/app/sgml/msrv07.c b/app/sgml/msrv07.c new file mode 100644 index 0000000000000000000000000000000000000000..1b5f3bdf404427c4770942e7de36b9fdae7ea98f --- /dev/null +++ b/app/sgml/msrv07.c @@ -0,0 +1,31 @@ +/* + * FILE ~/usr/gophtool/msrv02.c + * + * write the header of a mail server reply + * + * written: 1994-07-14 + * latest update: 1994-07-14 + * + */ + +#include <stdio.h> +#include <gg/hytxt.h> +#include "msrvh.h" + +/* ------------------------------------------------------------------------ */ +int msrv_prepare_reply_header ( +FILE *fo, +struct MSRV_defaults *mdef, +struct MSRV_request *mrq) +{ + fprintf (fo, "From: %s\n", mdef->MD_sender); + fprintf (fo, "To: %s\n", mrq->MR_reply_address); + if (mdef->MD_cc != (char *) 0) + fprintf (fo, "Cc: %s\n", mdef->MD_cc); + if (mdef->MD_errors_to != (char *) 0) + fprintf (fo, "Errors-To: %s\n", mdef->MD_errors_to); + if (mdef->MD_name != (char *) 0) + fprintf (fo, "Comment: %s\n", mdef->MD_name); + + return 0; +} diff --git a/app/sgml/msrv07.o b/app/sgml/msrv07.o new file mode 100644 index 0000000000000000000000000000000000000000..391acda43c7208b426ad78a22a41206a240abce3 Binary files /dev/null and b/app/sgml/msrv07.o differ diff --git a/app/sgml/msrvh.h b/app/sgml/msrvh.h new file mode 100644 index 0000000000000000000000000000000000000000..b6c6a57fa654da80dc57b424d3a641217f48844e --- /dev/null +++ b/app/sgml/msrvh.h @@ -0,0 +1,74 @@ +/* + * FILE ~/usr/sgml/msrvh.h + * + * datastructures and constants for the HYX mail server + * - t2d + * + * written: 1994-06-19 + * latest update: 1995-06-25 + * + */ + +#ifndef __GG_msrvh__ +#define __GG_msrvh__ + +/* ------------------------------------------------------------------------ */ +struct MSRV_request /* description of a request */ +{ + char *MR_From; /* originator of the request */ + char *MR_Date; /* date found in the mail header */ + char *MR_Subject; /* sender's subject line */ + char *MR_Reply_To; /* reply-to address, if given */ + + char *MR_reply_address; /* address where reply goes to */ + char *MR_action; /* currently processed action */ + + int MR_transformation; /* type of output processing */ +#define MRtr_none 0 /* no transformation at all */ +#define MRtr_simple 1 /* simply use chksgml, remove tags */ + + int MR_authorization_status; /* authorization flag */ +#define MRas_anonymous 0 /* no authorization done */ +#define MRas_ok 1 /* authorization done ok */ +#define MRas_wrong 2 /* authorization done but no ok */ +} ; + +/* ------------------------------------------------------------------------ */ +struct MSRV_authorization +{ + struct MSRV_authorization *MA_next; /* next auth record for this base */ + char *MA_user; /* authorized user name */ + char *MA_key; /* encrypted user key */ +} ; + +/* ------------------------------------------------------------------------ */ +struct MSRV_defaults +{ + char *MD_database; /* database file name */ + char *MD_name; /* descriptive name of the database */ + char *MD_sender; /* email address of database results */ + char *MD_errors_to; /* email address for error processing */ + char *MD_cc; /* email address for carbon copy */ + + struct MSRV_authorization *MD_authorization; /* list of auth records */ +} ; + +/* constants used in the modules: ----------------------------------------- */ +#define LINE_SIZE 1024 +#define FIELD_SIZE 256 + +/* prototypes: ------------------------------------------------------------ */ +/* msrv01.c */ int msrv_process_requests (FILE *fi, struct MSRV_defaults *msrv_def); +/* msrv02.c */ int msrv_send_dbentry (FILE *f_transcript, + struct MSRV_defaults *msrv_def, + struct MSRV_request *mrq, char *frame_name); +/* msrv03.c */ struct MSRV_defaults *msrv_get_defaults (char *fnm); +/* msrv04.c */ char *msrv_pick_reply_address (char *from, char *reply_to); +/* msrv05.c */ struct MSRV_authorization *msrv_make_authorization ( + char *user, char *key); +/* msrv06.c */ int msrv_check_authorization (FILE *f_transcript, + struct MSRV_defaults *msd, char *auth); +/* msrv07.c */ int msrv_prepare_reply_header (FILE *fo, + struct MSRV_defaults *mdef, struct MSRV_request *mrq); + +#endif /* __GG_msrvh__ */ diff --git a/app/sgml/possig.awk b/app/sgml/possig.awk new file mode 100644 index 0000000000000000000000000000000000000000..090ce29714510abc4c6b581bec14f35af4620b9b --- /dev/null +++ b/app/sgml/possig.awk @@ -0,0 +1,78 @@ +BEGIN { + fn=""; + fn2=""; + fp=0; + print "0 0 0 0 10 1 1 0" >"@$.ftr" + print "searching..." >"@$.pos" + al=2; +} +FILENAME!=fn2 { + print FILENAME + fn2=FILENAME; +} + + { wflg=0; } + +# include file checks -------------------------------------------------------- +#/include/ { +# x=$0; +# s1 = gsub (/\"/, "\"", x); +# s2 = gsub (/\\/, "/", x); +# s2+= gsub (/\//, "/", x); +# if (substr(x,1,1) == "#" && s1 > 0 && s2 > 0) prt(" \""); +#} +# /ed.h/ { next } +# /edhyx.h/ { next } +# /proto.h/ { next } +# /window.h/ { next } +# /message.h/ { next } +# /stdio.h/ { next } +# /string.h/ { next } +# /strings.h/ { next } +# /maus.h/ { next } +# /keys.h/ { next } +# /malloc.h/ { next } +# /include/ { prt("include"); } +# ---------------------------------------------------------------------------- + +#/FTR_display_replarray/ { prt("FTR_display_replarray"); } +#/ftr_replarray_size/ { prt("ftr_replarray_size"); } +#/highest_index/ { prt("highest_index"); } +#/next_index/ { prt("next_index"); } +#/IDX_REC_SIZE/ { prt("IDX_REC_SIZE"); } +#/12/ { prt("12"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +#/�/ { prt("�"); } +/\$/ { prt("$"); } +#/<gg\// { prt("<gg/"); } +#hyx.l/ { prt("hyx.l"); } + +# ---------------------------------------------------------------------------- +wflg!=0 { + print al" 0 1 <HLINK file=\""FILENAME"\" ln="FNR">" >>"@$.ftr"; + print "*"FILENAME" ("FNR"): ", $0 >>"@$.pos"; + al++; +} + +function prt(t) { +# if (FILENAME != fn || fp != FNR) { + cs=1; + if (FNR >= 10) cs++; + if (FNR >= 100) cs++; + if (FNR >= 1000) cs++; + if (FNR >= 10000) cs++; + cl=length(t); + for (cx=length($0);cx>0;cx--) if (substr($0,cx,cl)==t) { + printf al" "cx+6+cs+length(FILENAME)" 1 " >>"@$.ftr"; + print "<xy tdc=79 tdp="cl">" >>"@$.ftr"; + } + wflg=1; +# } + fn = FILENAME; + fp = FNR; +} diff --git a/app/sgml/sf01.c b/app/sgml/sf01.c new file mode 100644 index 0000000000000000000000000000000000000000..b09b82a848b913014c2e456bd4bc2ac1f2fd923b --- /dev/null +++ b/app/sgml/sf01.c @@ -0,0 +1,112 @@ +/* + * FILE ~/usr/sgml/sf01.c + * + * written: 1994-04-12 + * latest update: 1995-03-25 + * + */ + +#include <stdio.h> +#include <gg/hytxt.h> +#include <gg/convent.h> + +#define TAG_BUFFER_SIZE 10240 +static char tag_buffer [TAG_BUFFER_SIZE]; + +/* ------------------------------------------------------------------------ */ +int hytxt_filter (FILE *fi, FILE *fo, long transfer_length, +int translit_entities) +{ +#define ST_start 0 +#define ST_tag 1 +#define ST_entity 2 + int st= ST_start; + int tagsiz= TAG_BUFFER_SIZE-1;/* init just to be on the safe side ... */ + char *tagp= tag_buffer; /* init just to be on the safe side ... */ + char *ch_entity; /* entity string for a character code */ + long look_ahead= -1L; + int ch; + + if (fi == (FILE *) 0 || fo == (FILE *) 0) return -1; + + while (transfer_length-- > 0L) + { + if (look_ahead == 0L) fprintf (fo, "</a>"); + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + + switch (st) + { + case ST_start: + /* tag opener found */ + if (ch == '<') + { + tagsiz= TAG_BUFFER_SIZE-1; + tagp= tag_buffer; + st= ST_tag; + break; + } + + /* entity opener found */ + if (ch == '&') + { + tagsiz= TAG_BUFFER_SIZE-1; + tagp= tag_buffer; + st= ST_entity; + break; + } + + /* characters over 0x80 must be converted to entities */ + if (translit_entities + && (ch_entity= get_pc_sgml_entity (ch)) != (char *) 0) + { + fputc ('&', fo); + fputs (ch_entity, fo); + fputc (';', fo); + } + else fputc (ch, fo); + break; + + case ST_tag: + /* processing a tagging sequence */ + if (ch == '>') + { + st= ST_start; + *tagp= 0; + look_ahead= hytxt_hyx2html (fo, tag_buffer); + if (look_ahead == 0) look_ahead= -1L; + if (look_ahead > 0) look_ahead++; + break; + } + if (tagsiz <= 0) break; + *tagp++= (char) ch; + tagsiz--; + break; + + case ST_entity: + /* processing an entity sequence */ + if (ch == ';') + { + st= ST_start; + *tagp= 0; + fputc ('&', fo); + fputs (tag_buffer, fo); + fputc (';', fo); + break; + } + if (tagsiz <= 0) break; + *tagp++= (char) ch; + tagsiz--; + break; + + default: + fprintf (stderr, "hytxt_filter: internal error!\n"); + return -1; + } + if (look_ahead >= 0L) look_ahead--; + } + + hyx_print_relational_links (fo); + + return 0; +} diff --git a/app/sgml/sf01.o b/app/sgml/sf01.o new file mode 100644 index 0000000000000000000000000000000000000000..67cfb1c3beee8d04c3895de47dba6fb686e92f6f Binary files /dev/null and b/app/sgml/sf01.o differ diff --git a/app/sgml/sf02.c b/app/sgml/sf02.c new file mode 100644 index 0000000000000000000000000000000000000000..cd4a1cd4cd3367389308fb87434499a8d2ccc717 --- /dev/null +++ b/app/sgml/sf02.c @@ -0,0 +1,135 @@ +/* + * FILE ~/usr/sgml/sf02.c + * + * transform HYX tags into HTML tags + * processed are: + * HLINK and hyx.l into a (anchors) + * w3.* strip w3. prefix off (also closing tags) + * Frame etc are removed + * + * written: 1994-04-12 + * latest update: 1995-06-23 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/hyx.h> +#include <gg/hytxt.h> + +#define AV_SIZ 256 +static char av1 [AV_SIZ]; +static char av2 [AV_SIZ]; +static char url [AV_SIZ]; +static char av3 [AV_SIZ]; +static char av4 [AV_SIZ]; + +#define NUM_RELATIONAL_LINKS 10 +static char *relational_link_dest [NUM_RELATIONAL_LINKS]; +static char *relational_link_rel [NUM_RELATIONAL_LINKS]; +static char *relational_link_name [NUM_RELATIONAL_LINKS]; +static int relational_link_count= 0; + +/* ------------------------------------------------------------------------ */ +long hytxt_hyx2html (FILE *fo, char *tag_buffer) +{ + int rc1; + int rc2; + int rc3; + int rc4; + + if (strncmp (tag_buffer, "Frame ", 6) == 0 + ||strcmp (tag_buffer, "/Frame") == 0 + ||strncmp (tag_buffer, ":", 1) == 0 + ||strncmp (tag_buffer, ";", 1) == 0) return 0L; + + if (strncmp (tag_buffer, "HLINK ", 6) == 0 + ||strncmp (tag_buffer, "hyx.l ", 6) == 0) + { + rc1= find_attr_value (tag_buffer, av1, AV_SIZ, "dir"); + rc4= find_attr_value (tag_buffer, av4, AV_SIZ, "tdp"); + rc2= find_attr_value (tag_buffer, av2, AV_SIZ, "file"); + if (rc2 == 0) + { + fprintf (fo, "<a href=\"%s\">", av2); + } + else + { + rc2= find_attr_value (tag_buffer, av2, AV_SIZ, "fr"); + rc3= find_attr_value (tag_buffer, av3, AV_SIZ, "cl"); + if (rc2 == 0) + { + frame_name2url (av2, url, AV_SIZ); + } + else strcpy (url, "$$root"); + + fprintf (fo, "<a href=\""); + if (rc3 == 0) fprintf (fo, "/%s/", av3); + fprintf (fo, "%s", url); + fprintf (fo, "\">"); + } + + if (rc1 == 0 /* relational link found */ + && relational_link_count < NUM_RELATIONAL_LINKS) + { + relational_link_rel [relational_link_count]= strdup (av1); + relational_link_dest [relational_link_count]= strdup (url); + relational_link_name [relational_link_count]= strdup (av2); + relational_link_count++; + } + + if (rc4 == 0) return get_parameter_value (av4); + return 2L; + } + + if (strncmp (tag_buffer, "db.", 3) == 0) + { + fprintf (fo, "%s: ", tag_buffer+3); + return 0L; + } + + if (strncmp (tag_buffer, "w3.", 3) == 0) + { + fputc ('<', fo); + fputs (tag_buffer+3, fo); + fputc ('>', fo); + return 0L; + } + + if (strncmp (tag_buffer, "/w3.", 4) == 0) + { + fputc ('<', fo); + fputc ('/', fo); + fputs (tag_buffer+4, fo); + fputc ('>', fo); + return 0L; + } + + /* default: */ + fputc ('<', fo); + fputs (tag_buffer, fo); + fputc ('>', fo); + + return 0L; +} + +/* ------------------------------------------------------------------------ */ +int hyx_print_relational_links (FILE *fo) +{ + int i; + + if (relational_link_count <= 0) return 0; + fprintf (fo, "<HR>\n"); + + for (i= 0; i < relational_link_count; i++) + fprintf (fo, + "<a href=%s>[%s:%s]</a>\n", + relational_link_dest [i], + relational_link_rel [i], + relational_link_name [i]); + + fprintf (fo, "<HR>\n"); + + return 0; +} diff --git a/app/sgml/sf02.o b/app/sgml/sf02.o new file mode 100644 index 0000000000000000000000000000000000000000..5bb75e82eb8c7238d66db2f4b2bb53c119d2621f Binary files /dev/null and b/app/sgml/sf02.o differ diff --git a/app/sgml/sf03.c b/app/sgml/sf03.c new file mode 100644 index 0000000000000000000000000000000000000000..b53396a175e1e0259f6e7067c1646671990860cf --- /dev/null +++ b/app/sgml/sf03.c @@ -0,0 +1,44 @@ +/* + * FILE %sgml/sf03.c + * + * see also: + * sf04.c int cdecl url2frame_name (char *url, char *frame, int max_frame); + * sf05.c contains the translation tables SFCHR_FRAME and SFCHR_URL + * + * written: 1994-04-12 + * latest update: 1999-08-01 12:19:53 + * + */ + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/hytxt.h> + +extern char *SFCHR_FRAME; +extern char *SFCHR_URL; + +/* ------------------------------------------------------------------------ */ +int frame_name2url (char *frame, char *url, int max_url) +{ + int ch; + int idx; + + if (max_url <= 2 || url == (char *) 0) return -1; + + for (; (ch= *frame++ & 0x00FF) != 0 && max_url > 2;) + { + if ((idx= chr_index (SFCHR_FRAME, ch)) >= 0) + { + *url++= '_'; + *url++= SFCHR_URL [idx]; + max_url -= 2; + } + else + { + *url++= (char) ch; + max_url--; + } + } + *url= 0; + return 0; +} diff --git a/app/sgml/sf03.o b/app/sgml/sf03.o new file mode 100644 index 0000000000000000000000000000000000000000..30dfab960ac7532b0bb6d9b6866d179aca0e2d67 Binary files /dev/null and b/app/sgml/sf03.o differ diff --git a/app/sgml/sf04.c b/app/sgml/sf04.c new file mode 100644 index 0000000000000000000000000000000000000000..ec77abbe2a1069d1833891f9e6f83522ff5c6ab0 --- /dev/null +++ b/app/sgml/sf04.c @@ -0,0 +1,93 @@ +/* + * FILE %sgml/sf04.c + * + * see also: + * sf03.c int cdecl frame_name2url (char *frame, char *url, int max_url); + * sf05.c contains the translation tables SFCHR_FRAME and SFCHR_URL + * + * written: 1994-04-12 + * latest update: 1999-08-01 12:17:36 + * + */ + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/hytxt.h> + +extern char *SFCHR_FRAME; +extern char *SFCHR_URL; + +/* ------------------------------------------------------------------------ */ +int url2frame_name (char *url, char *frame, int max_frame) +{ + int ch; + int ch_val= 0; + int st= 0; + int idx; + + if (max_frame < 2 || frame == (char *) 0) return -1; + + for (; (ch= *url++ & 0x00FF) != 0 && max_frame > 1;) + { + switch (st) + { + case 0: + if (ch == '_') st= 1; + else + if (ch == '%') + { + st= 3; + ch_val= 0; + } + else + { + *frame++= (char) ch; + max_frame--; + } + break; + + case 1: + if ((idx= chr_index (SFCHR_URL, ch)) >= 0) + { + *frame++= SFCHR_FRAME [idx]; + } + else + { + *frame++= (char) ch; + } + max_frame--; + st= 0; + break; + + case 3: + case 4: + if (ch >= '0' && ch <= '9') + { + ch_val= ch_val*16 + ch - '0'; + } + else + if (ch >= 'a' && ch <= 'f') + { + ch_val= ch_val*16 + ch - 'a' + 10; + } + else + if (ch >= 'A' && ch <= 'F') + { + ch_val= ch_val*16 + ch - 'A' + 10; + } + if (st == 3) + { + st= 4; + } + else + { + st= 0; + *frame++= (char) ch_val; + } + break; + } + } + *frame= 0; + + return 0; +} diff --git a/app/sgml/sf04.o b/app/sgml/sf04.o new file mode 100644 index 0000000000000000000000000000000000000000..12607e10c6bb04740fdf2f66fa89ff0561ae8a96 Binary files /dev/null and b/app/sgml/sf04.o differ diff --git a/app/sgml/sf05.c b/app/sgml/sf05.c new file mode 100644 index 0000000000000000000000000000000000000000..b0d8565ab4ed72389e64696cff923f7e58b4e852 --- /dev/null +++ b/app/sgml/sf05.c @@ -0,0 +1,19 @@ +/* + * FILE ~/usr/sgml/sf05.c + * + * tables for frame name to url translation + * + * see also: + * sf03.c int cdecl frame_name2url (char *frame, char *url, int max_url); + * sf04.c int cdecl url2frame_name (char *url, char *frame, int max_frame); + * + * written: 1994-08-06 + * latest update: 1994-09-10 + * + */ + +#include <stdio.h> +#include <gg/hytxt.h> + +char *SFCHR_FRAME= "#& :_/{}[]()|\"\\"; +char *SFCHR_URL= "nabcusQRSTUVPqB"; diff --git a/app/sgml/sf05.o b/app/sgml/sf05.o new file mode 100644 index 0000000000000000000000000000000000000000..f4db6559434a787735e0f700ae7bc32e6b6c5364 Binary files /dev/null and b/app/sgml/sf05.o differ diff --git a/app/sgml/sf05t.c b/app/sgml/sf05t.c new file mode 100644 index 0000000000000000000000000000000000000000..346a96be90cfc90ba05103570d608952079cd347 --- /dev/null +++ b/app/sgml/sf05t.c @@ -0,0 +1,40 @@ +/* + * FILE ~/usr/sgml/sf05t.c + * + * Test modules sf03.c, sf04.c and sf05.c + * + * written: 1994-08-06 + * latest update: 1994-08-06 + * + */ + +#include <stdio.h> +#include <gg/hytxt.h> + +extern char *SFCHR_FRAME; + +static char line1[100]; +static char line2[100]; +static char line3[100]; + +int testit (char *s) +{ + frame_name2url (s, line2, 100); + url2frame_name (line2, line3, 100); + printf ("original : %s\n", s); + printf ("URL : %s\n", line2); + printf ("frame again: %s\n", line3); +} + +main () +{ + testit (SFCHR_FRAME); + for (;;) + { + printf ("frame name : "); + scanf ("%[^\n]", line1); + getchar (); + testit (line1); + } + return 0; +} diff --git a/app/sgml/sgml.dd b/app/sgml/sgml.dd new file mode 100644 index 0000000000000000000000000000000000000000..3a067941250dac3b910fd0ab0934d20472077167 --- /dev/null +++ b/app/sgml/sgml.dd @@ -0,0 +1,54 @@ +<hyx.dd docid="1001" file="CHKSGML.H" name="C source file CHKSGML.H"> +<hyx.dd docid="1002" file="CHKSGML.C" name="C source file CHKSGML.C"> +<hyx.dd docid="1003" file="CHKSGML1.C" name="C source file CHKSGML1.C"> +<hyx.dd docid="1004" file="CHKSGML2.C" name="C source file CHKSGML2.C"> +<hyx.dd docid="1005" file="HYTXT001.C" name="C source file HYTXT001.C"> +<hyx.dd docid="1006" file="HYTXT002.C" name="C source file HYTXT002.C"> +<hyx.dd docid="1007" file="HYTXT003.C" name="C source file HYTXT003.C"> +<hyx.dd docid="1008" file="HYTXT004.C" name="C source file HYTXT004.C"> +<hyx.dd docid="1009" file="HYTXT005.C" name="C source file HYTXT005.C"> +<hyx.dd docid="1010" file="HYTXT006.C" name="C source file HYTXT006.C"> +<hyx.dd docid="1011" file="HYTXT007.C" name="C source file HYTXT007.C"> +<hyx.dd docid="1012" file="HYTXT008.C" name="C source file HYTXT008.C"> +<hyx.dd docid="1013" file="HYTXT009.C" name="C source file HYTXT009.C"> +<hyx.dd docid="1014" file="HYTXT010.C" name="C source file HYTXT010.C"> +<hyx.dd docid="1015" file="HYTXT011.C" name="C source file HYTXT011.C"> +<hyx.dd docid="1016" file="HYTXT012.C" name="C source file HYTXT012.C"> +<hyx.dd docid="1017" file="HYTXT013.C" name="C source file HYTXT013.C"> +<hyx.dd docid="1018" file="HYTXT014.C" name="C source file HYTXT014.C"> +<hyx.dd docid="1019" file="HYTXT015.C" name="C source file HYTXT015.C"> +<hyx.dd docid="1020" file="HYX.C" name="C source file HYX.C"> +<hyx.dd docid="1021" file="HYXIDX01.C" name="C source file HYXIDX01.C"> +<hyx.dd docid="1022" file="HYXD.C" name="C source file HYXD.C"> +<hyx.dd docid="1023" file="HYXD.H" name="C source file HYXD.H"> +<hyx.dd docid="1024" file="HYXD01.C" name="C source file HYXD01.C"> +<hyx.dd docid="1025" file="HYXD02.C" name="C source file HYXD02.C"> +<hyx.dd docid="1026" file="HYXENG.H" name="C source file HYXENG.H"> +<hyx.dd docid="1027" file="HYXENG01.C" name="C source file HYXENG01.C"> +<hyx.dd docid="1028" file="HYXENG01.H" name="C source file HYXENG01.H"> +<hyx.dd docid="1029" file="HYXENG02.C" name="C source file HYXENG02.C"> +<hyx.dd docid="1030" file="HYXENG03.C" name="C source file HYXENG03.C"> +<hyx.dd docid="1031" file="HYXENG04.C" name="C source file HYXENG04.C"> +<hyx.dd docid="1032" file="HYXENG05.C" name="C source file HYXENG05.C"> +<hyx.dd docid="1033" file="HYXIDX.C" name="C source file HYXIDX.C"> +<hyx.dd docid="1034" file="HYXM.C" name="C source file HYXM.C"> +<hyx.dd docid="1035" file="HYXPURGE.C" name="C source file HYXPURGE.C"> +<hyx.dd docid="1036" file="HYXSEQ.C" name="C source file HYXSEQ.C"> +<hyx.dd docid="1037" file="HYXX.C" name="C source file HYXX.C"> +<hyx.dd docid="1038" file="SGML0001.C" name="C source file SGML0001.C"> +<hyx.dd docid="1039" file="SGML0002.C" name="C source file SGML0002.C"> +<hyx.dd docid="1040" file="SGML0003.C" name="C source file SGML0003.C"> +<hyx.dd docid="1041" file="SGML0004.C" name="C source file SGML0004.C"> +<hyx.dd docid="1042" file="SGML0005.C" name="C source file SGML0005.C"> +<hyx.dd docid="1043" file="SGML0006.C" name="C source file SGML0006.C"> +<hyx.dd docid="1044" file="SGML0007.C" name="C source file SGML0007.C"> +<hyx.dd docid="1045" file="SGML0008.C" name="C source file SGML0008.C"> +<hyx.dd docid="1046" file="SGML0009.C" name="C source file SGML0009.C"> +<hyx.dd docid="1047" file="SGML0010.C" name="C source file SGML0010.C"> +<hyx.dd docid="1048" file="SGML0011.C" name="C source file SGML0011.C"> +<hyx.dd docid="1049" file="SGML0012.C" name="C source file SGML0012.C"> +<hyx.dd docid="1050" file="SGML0013.C" name="C source file SGML0013.C"> +<hyx.dd docid="1051" file="SGMLPROC.C" name="C source file SGMLPROC.C"> +<hyx.dd docid="1052" file="SGMLT1.C" name="C source file SGMLT1.C"> +<hyx.dd docid="1053" file="SGMLT2.C" name="C source file SGMLT2.C"> +<hyx.dd docid="1054" file="HYTXT016.C" name="C source file HYTXT016.C"> diff --git a/app/sgml/sgml0001.c b/app/sgml/sgml0001.c new file mode 100644 index 0000000000000000000000000000000000000000..0d93a591b5ef5c6ab32651663cd665bf9eecc389 --- /dev/null +++ b/app/sgml/sgml0001.c @@ -0,0 +1,256 @@ +/* + * FILE ~/usr/sgml/sgml0001.c + * + * sgml_filter: SGML-Dokument in + * (a) eigentlichen Text + * (b) SGML-Tags mit Parametern + * (c) SGML-Kommentar + * aufsplitten. + * + * written: 1989 11 03 + * 1990 09 23: Umstellung der Filter Ausgabe in LONGs + * latest update: 1994-06-04 + * + */ + +#pragma check_stack(off) + +/* Prototypes f�r hier definierte Funktionen: ----------------------------- */ +void cdecl sgml_filter_reset (void); +void cdecl sgml_filter (int ch); + +void cdecl sgml_filter_tag_chr (long); +void cdecl sgml_filter_tag_beg (void); +void cdecl sgml_filter_tag_end (void); + +void cdecl sgml_filter_com_chr (long); +void cdecl sgml_filter_com_beg (void); +void cdecl sgml_filter_com_end (void); + +void cdecl sgml_filter_chr (long); + +/* ------------------------------------------------------------------------ */ +/* Schnittstellen: +/* sgml_filter_reset () reset the SGML filter system */ +/* sgml_filter (ch) character to be processed */ +void sgml_filter_tag_chr (long ch) {ch;}/* Ausgabe eines gelesenen Tags mit Parametern */ +void sgml_filter_tag_beg () {} /* Beginn eines Tags festgestellt */ +void sgml_filter_tag_end () {} /* Ende eines Tags festgestellt */ +void sgml_filter_com_chr (long ch) {ch;}/* Ausgabe eines gelesenen Kommentar-Zeichens */ +void sgml_filter_com_beg () {} /* Beginn eines Kommentars festgestellt */ +void sgml_filter_com_end () {} /* Ende eines Kommentars festgestellt */ +void sgml_filter_chr (long ch) {ch;}/* Ausgabe eines gelesenen Text-Zeichens */ + +/* ------------------------------------------------------------------------ */ +static int sgml_filter_status = 0; +static int state_at_end_of_comment; + +static long val; /* Character Code in Oct, Dec, Hex */ + +/* ------------------------------------------------------------------------ */ +void sgml_filter_reset (void) +{ + sgml_filter_status = 0; +} + +/* ------------------------------------------------------------------------ */ +void sgml_filter (int ch) +{ + switch (sgml_filter_status) + { + case 0: /* normal text so far ... */ + if (ch == '<') + sgml_filter_status = 1; + else sgml_filter_chr ((long) ch); + break; + case 1: /* beginning of a tagged sequence */ + val = 0L; + switch (ch) + { + case '0': + sgml_filter_status = 2; + break; + case '1': case '2': case '3': /* character code in decimal */ + case '4': case '5': case '6': + case '7': case '8': case '9': + val = (long) (ch - '0'); + sgml_filter_status = 4; + break; + case '-': /* this could be the beginning of a SGML-comment */ + sgml_filter_status = 7; + state_at_end_of_comment=1; + break; + case '>': /* this was an empty tagging sequence */ + sgml_filter_status = 0; + break; +# ifdef JUNK /* filter this out at this state may not be optimal ... */ + case ' ': /* white spaces are ignored */ + case 0x09: + case 0x0D: + case 0x0A: + break; +# endif + case '\"': + sgml_filter_tag_beg (); + sgml_filter_tag_chr ((long) ch); + sgml_filter_status = 10; + break; + case '\\': + sgml_filter_tag_beg (); + sgml_filter_tag_chr ((long) ch); + sgml_filter_status = 12; + break; + default: /* a normal tagging sequence starts */ + sgml_filter_tag_beg (); + sgml_filter_tag_chr ((long) ch); + sgml_filter_status = 6; + break; + } + break; + case 2: /* character code, beginning with 0 */ + switch (ch) + { + case 'x': case 'X': + sgml_filter_status = 3; + break; + case '0': case '1': + case '2': case '3': + case '4': case '5': + case '6': case '7': + val = (long) (ch - '0'); + sgml_filter_status = 5; + break; + case '>': + sgml_filter_status = 0; + sgml_filter_chr ((long) 0); + break; + default: + sgml_filter_status = 6; + sgml_filter_tag_beg (); + sgml_filter_tag_chr ((long) '0'); + break; + } + break; + case 3: /* character code in hexadecimal */ + if (ch >= '0' && ch <= '9') val= 16L*val+(long)(ch-'0'); + else if (ch >= 'a' && ch <= 'f') val= 16L*val+(long)(ch-'a'+10); + else if (ch >= 'A' && ch <= 'F') val= 16L*val+(long)(ch-'A'+10); + else if (ch == '>') + { + sgml_filter_chr (val); + sgml_filter_status = 0; + } + else { /* this case is *ILLEGAL* ... we handle this later! */ + sgml_filter_tag_beg (); + sgml_filter_tag_chr (val); + sgml_filter_status = 6; + } + break; + case 4: /* character code in decimal */ + if (ch >= '0' && ch <= '9') val= 10L*val+(long)(ch-'0'); + else if (ch == '>') + { + sgml_filter_chr (val); + sgml_filter_status = 0; + } + else { /* this case is *ILLEGAL* ... we handle this later! */ + sgml_filter_tag_beg (); + sgml_filter_tag_chr (val); + sgml_filter_status = 6; + } + break; + case 5: /* character code in octal */ + if (ch >= '0' && ch <= '7') val= 8L*val+(long)(ch-'0'); + else if (ch == '>') + { + sgml_filter_chr (val); + sgml_filter_status = 0; + } + else { /* this case is *ILLEGAL* ... we handle this later! */ + sgml_filter_tag_beg (); + sgml_filter_tag_chr (val); + sgml_filter_status = 6; + } + break; + case 6: /* a normal tagging sequence */ + switch (ch) + { + case '>': + sgml_filter_tag_end (); + sgml_filter_status = 0; + break; + case '-': + sgml_filter_status=7; + state_at_end_of_comment=6; + break; + case '\"': + sgml_filter_tag_chr ((long) ch); + sgml_filter_status=10; + break; + case '\\': + sgml_filter_tag_chr ((long) ch); + sgml_filter_status=12; + break; + default: + sgml_filter_tag_chr ((long) ch); + break; + } + break; + case 7: /* maybe the begginning of a SGML comment */ + switch (ch) + { + case '-': /* yes, second - we see... this is a SGML comment */ + sgml_filter_status = 8; + sgml_filter_com_beg (); + break; + case '>': /* this was only one - as a SGML tag! */ + sgml_filter_status = 0; + sgml_filter_tag_beg (); + sgml_filter_tag_chr ((long) '-'); + sgml_filter_tag_end (); + break; + default: /* this is now a regular SGML tag */ + sgml_filter_status = 6; + if (state_at_end_of_comment == 1) + sgml_filter_tag_beg (); + sgml_filter_tag_chr ((long) '-'); + sgml_filter_tag_chr ((long) ch); + break; + } + break; + case 8: /* inside of a SGML comment */ + if (ch == '-') + { + sgml_filter_status = 9; + } + else { + sgml_filter_com_chr ((long) ch); + } + break; + case 9: /* maybe the end of a SGML comment */ + if (ch == '-') + { /* yes, the second - that's the end of the comment */ + sgml_filter_status = state_at_end_of_comment; + sgml_filter_com_end (); + } + else { + sgml_filter_com_chr ((long) '-'); + sgml_filter_com_chr ((long) ch); + sgml_filter_status = 8; + } + break; + case 10: /* tag sequence under quote */ + sgml_filter_tag_chr ((long) ch); + if (ch=='\"') sgml_filter_status=6; else + if (ch=='\\') sgml_filter_status=11; + break; + case 11: /* backslash inside a quoted tag sequence */ + sgml_filter_tag_chr ((long) ch); + sgml_filter_status=10; + break; + case 12: /* backslash inside a tag sequence */ + sgml_filter_tag_chr ((long) ch); + sgml_filter_status=6; + break; + } +} diff --git a/app/sgml/sgml0002.c b/app/sgml/sgml0002.c new file mode 100644 index 0000000000000000000000000000000000000000..b7585d3c485314c7fb57dbdbbb2399a3c58ffcc6 --- /dev/null +++ b/app/sgml/sgml0002.c @@ -0,0 +1,233 @@ +/* + * FILE E:\usr\sgml\sgml0002.c + * + * sgml_filter: SGML-Dokument in + * (a) eigentlichen Text + * (b) SGML-Tags mit Parametern + * (c) SGML-Kommentar + * aufsplitten. + * + * 1989 11 03 + * 1990 10 xx: >>>>> DIESE VERSION WIRD Z.Z. NICHT UNTERST�TZT!!!! <<<<< + * + */ + +/* ------------------------------------------------------------------------ */ +/* Schnittstellen: +/* sgml_filter_reset () Filtersystem zur�cksetzen */ +sgml_filter () {} /* gelesenes Zeichen */ +sgml_filter_tag_chr () {} /* Ausgabe eines gelesenen Tag-Zeichens */ +sgml_filter_tag_beg () {} /* Beginn eines Tags festgestellt */ +sgml_filter_tag_end () {} /* Ende eines Tags festgestellt */ +sgml_filter_com_chr () {} /* Ausgabe eines gelesenen Kommentar-Zeichens */ +sgml_filter_com_beg () {} /* Beginn eines Kommentars festgestellt */ +sgml_filter_com_end () {} /* Ende eines Kommentars festgestellt */ +sgml_filter_chr () {} /* Ausgabe eines gelesenen Text-Zeichens */ + +/* ------------------------------------------------------------------------ */ + +# pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +static int val; /* Character Code in Oct, Dec, Hex */ + +/* ------------------------------------------------------------------------ */ +sgml_filter_reset () +{ + int sgml_filter_00 (); + + patch (sgml_filter, sgml_filter_00); +} + +/* ------------------------------------------------------------------------ */ +static sgml_filter_00 (ch) +int ch; +{ + int sgml_filter_01 (); + + if (ch == '<') + patch (sgml_filter, sgml_filter_01); + else sgml_filter_chr (ch); +} + +/* ------------------------------------------------------------------------ */ +/* '<' gelesen; jetzt wird untersucht, um was es sich handelt */ +static sgml_filter_01 (ch) +int ch; +{ + int sgml_filter_02 (), + sgml_filter_04 (), + sgml_filter_06 (), + sgml_filter_07 (); + + val = 0; + + switch (ch) + { + case '0': patch (sgml_filter, sgml_filter_02); break; + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': case '9': + val = ch - '0'; + patch (sgml_filter, sgml_filter_04); break; + case '-': patch (sgml_filter, sgml_filter_07); break; + case '>': patch (sgml_filter, sgml_filter_00); break; + default: sgml_filter_tag_beg (); + sgml_filter_tag_chr (ch); + patch (sgml_filter, sgml_filter_06); break; + } +} + +/* ------------------------------------------------------------------------ */ +static sgml_filter_02 (ch) +int ch; +{ + int sgml_filter_03 (), + sgml_filter_05 (), + sgml_filter_06 (); + + switch (ch) + { + case 'x': case 'X': patch (sgml_filter, sgml_filter_03); + break; + case '0': case '1': + case '2': case '3': + case '4': case '5': + case '6': case '7': + val = ch - '0'; + patch (sgml_filter, sgml_filter_05); + break; + case '>': patch (sgml_filter, sgml_filter_00); + sgml_filter_chr (0); + break; + default : patch (sgml_filter, sgml_filter_06); + sgml_filter_tag_beg (); + sgml_filter_tag_chr ('0'); + break; + } +} + +/* ------------------------------------------------------------------------ */ +static sgml_filter_03 (ch) +int ch; +{ + int sgml_filter_06 (); + + if (ch >= '0' && ch <= '9') val = 16*val + ch - '0'; + else if (ch >= 'a' && ch <= 'f') val = 16*val + ch - 'a' + 10; + else if (ch >= 'A' && ch <= 'F') val = 16*val + ch - 'A' + 10; + else if (ch == '>') + { + sgml_filter_chr (val); + patch (sgml_filter, sgml_filter_00); + } + else { + sgml_filter_tag_beg (); + sgml_filter_tag_chr (val); + patch (sgml_filter, sgml_filter_06); + } +} + +/* ------------------------------------------------------------------------ */ +static sgml_filter_04 (ch) +int ch; +{ + int sgml_filter_06 (); + + if (ch >= '0' && ch <= '9') val = 10*val + ch - '0'; + else if (ch == '>') + { + sgml_filter_chr (val); + patch (sgml_filter, sgml_filter_00); + } + else { + sgml_filter_tag_beg (); + sgml_filter_tag_chr (val); + patch (sgml_filter, sgml_filter_06); + } +} + +/* ------------------------------------------------------------------------ */ +static sgml_filter_05 (ch) +int ch; +{ + int sgml_filter_06 (); + + if (ch >= '0' && ch <= '7') val = 8*val + ch - '0'; + else if (ch == '>') + { + sgml_filter_chr (val); + patch (sgml_filter, sgml_filter_00); + } + else { + sgml_filter_tag_beg (); + sgml_filter_tag_chr (val); + patch (sgml_filter, sgml_filter_06); + } +} + +/* ------------------------------------------------------------------------ */ +static sgml_filter_06 (ch) +int ch; +{ + if (ch == '>') + { + patch (sgml_filter, sgml_filter_00); + sgml_filter_tag_end (); + } + else sgml_filter_tag_chr (ch); +} + +/* ------------------------------------------------------------------------ */ +static sgml_filter_07 (ch) +int ch; +{ + int sgml_filter_08 (); + + switch (ch) + { + case '-': patch (sgml_filter, sgml_filter_08); + sgml_filter_com_beg (); + break; + case '>': patch (sgml_filter, sgml_filter_00); + sgml_filter_tag_beg (); + sgml_filter_tag_chr ('-'); + sgml_filter_tag_end (); + break; + default: patch (sgml_filter, sgml_filter_06); + sgml_filter_tag_beg (); + sgml_filter_tag_chr ('-'); + sgml_filter_tag_chr (ch); + break; + } +} + +/* ------------------------------------------------------------------------ */ +static sgml_filter_08 (ch) +int ch; +{ + int sgml_filter_09 (); + + if (ch == '-') + { + patch (sgml_filter, sgml_filter_09); + } + else { + sgml_filter_com_chr (ch); + } +} + +/* ------------------------------------------------------------------------ */ +static sgml_filter_09 (ch) +int ch; +{ + if (ch == '-') + { + patch (sgml_filter, sgml_filter_01); + sgml_filter_com_end (); + } + else { + sgml_filter_com_chr ('-'); + sgml_filter_com_chr (ch); + } +} diff --git a/app/sgml/sgml0003.c b/app/sgml/sgml0003.c new file mode 100644 index 0000000000000000000000000000000000000000..86c18ad5e04bbe940a66bf0b413cbd7dd767f443 --- /dev/null +++ b/app/sgml/sgml0003.c @@ -0,0 +1,140 @@ +/* + * FILE E:\usr\sgml\sgml0003.c + * + * File mit SGML-Tags in NED-File umwandeln + * + * 1990 04 07: aus File SGML2NED.C isoliert + * + */ + +# include <stdio.h> +# pragma check_stack(off) + +static int line_nr, column; + +static FILE *f_txt, /* Text des SGML-Dokuments */ + *f_ftr; /* Feature */ + +/* ------------------------------------------------------------------------ */ +static do_nothing () {} + +/* ------------------------------------------------------------------------ */ +sgml_to_text ( +char *fn_in, /* Name des Input-Files */ +char *fn_txt, /* Name des Output-Text-Files */ +char *fn_ftr, /* Name des Output-Feature-Files */ +int out_mode, /* 0 .. write new, 1 .. append */ +long pos_from, /* Teil des Frames */ +long pos_to) +{ + FILE *fi; + int ch; + int f_ftr_mode=0; /* closed */ + int return_value=0; + long lng; + + /* */ + int sgml_filter_tag_beg (), x_tag_beg (), + sgml_filter_tag_end (), x_tag_end (), + sgml_filter_tag_chr (), x_tag_chr (), + sgml_filter_com_beg (), + sgml_filter_com_end (), + sgml_filter_com_chr (), + sgml_filter_chr (), x_out_char(); + + if (fn_txt == (char *) 0) return -1; + if ((f_txt = fopen (fn_txt, (out_mode)?"ab":"wb")) == (FILE *) 0) return -1; + if (fn_ftr == (char *) 0) + { + patch (sgml_filter_tag_beg, do_nothing); + patch (sgml_filter_tag_end, do_nothing); + patch (sgml_filter_tag_chr, do_nothing); + patch (sgml_filter_com_beg, do_nothing); + patch (sgml_filter_com_end, do_nothing); + patch (sgml_filter_com_chr, do_nothing); + } + else { + patch (sgml_filter_tag_beg, x_tag_beg); + patch (sgml_filter_tag_end, x_tag_end); + patch (sgml_filter_tag_chr, x_tag_chr); + patch (sgml_filter_com_beg, x_tag_beg); + patch (sgml_filter_com_end, x_tag_end); + patch (sgml_filter_com_chr, x_tag_chr); + + if ((f_ftr = fopen (fn_ftr, (out_mode)?"ab":"wb")) == (FILE *) 0) + { + fclose (f_txt); + return -1; + } + f_ftr_mode = 1; + fprintf (f_ftr, "0 0 0 0 10 1 1 0\n"); + line_nr=1; + column=0; + } + + patch (sgml_filter_chr, x_out_char); + sgml_filter_reset (); + + if (access (fn_in, 0) != 0 + || (fi = fopen (fn_in, "rb")) == (FILE *) 0) + { + return_value = -1; + goto STOP2; + } + + fseek (fi, pos_from, 0); + for (lng = pos_to-pos_from+1L; lng > 0L; lng--) + { + ch = fgetc (fi) & 0x00FF; + if (feof (fi)) break; + sgml_filter (ch); + } + + fclose (fi); +STOP2: + if (f_ftr_mode > 0) fclose (f_ftr); + fclose (f_txt); + return return_value; +} + +/* ------------------------------------------------------------------------ */ +static x_out_char (long ch) +{ + int chr; + + chr = (int) ch; + + fputc (chr, f_txt); + column++; + if (ch == 0x0A) + { + line_nr++; + column = 0; + } +} + +/* ------------------------------------------------------------------------ */ +static x_tag_beg () +{ + fprintf (f_ftr, "%d %d 0 ", line_nr, column); + fputc (0x04, f_txt); column++; +} + +/* ------------------------------------------------------------------------ */ +static x_tag_end () +{ + fputc (0x0D, f_ftr); + fputc (0x0A, f_ftr); +} + +/* ------------------------------------------------------------------------ */ +static x_tag_chr (long ch) +{ + switch ((int) ch) + { + case 0x0D: fputc ('\\', f_ftr); fputc ('D', f_ftr); break; + case 0x0A: fputc ('\\', f_ftr); fputc ('A', f_ftr); break; + case '\\': fputc ('\\', f_ftr); fputc ('\\', f_ftr); break; + default : fputc (ch, f_ftr); break; + } +} diff --git a/app/sgml/sgml0004.c b/app/sgml/sgml0004.c new file mode 100644 index 0000000000000000000000000000000000000000..02563f29c52693c2c71fd738d4b24cf229544067 --- /dev/null +++ b/app/sgml/sgml0004.c @@ -0,0 +1,137 @@ +/* + * FILE E:\usr\sgml\sgml0004.c + * + * NED-File in File mit SGML-Tags umwandeln + * + * 1990 04 07 + * + */ + +# include <stdio.h> +# pragma check_stack(off) + +extern long ftell (); + +static int line_nr, column; + +static FILE *f_txt, /* Text des SGML-Dokuments */ + *f_ftr; /* Feature */ + +/* ------------------------------------------------------------------------ */ +text_to_sgml ( +char *fn_out, /* Name des Output-Hyptertext-Files */ +char *fn_txt, /* Name des Input-Text-Files */ +char *fn_ftr, /* Name des Input-Feature-Files */ +int out_mode, /* 0 .. write new, 1 .. append */ +long *pos_from, /* Teil des Frames */ +long *pos_to) +{ + FILE *f_out, + *f_txt, + *f_ftr; + + int cht, chf, dummy, + return_value=0, + ftr_line=-1, + ftr_col=-1, + txt_line=1, + txt_col=0; + + long pos, + fchar (); + + if (fn_txt == (char *) 0) return -1; + if ((f_txt = fopen (fn_txt, "rb")) == (FILE *) 0) return -1; + if (fn_ftr != (char *) 0) + { + if ((f_ftr = fopen (fn_ftr, "rb")) == (FILE *) 0) + { + fclose (f_txt); + return -1; + } + while ((fgetc (f_ftr) & 0x00FF) != 0x0A); /* Status-Zeile �berlesen */ + fscanf (f_ftr, "%d%d%d", &ftr_line, &ftr_col, &dummy); + fgetc (f_ftr); + } + + if (out_mode) + { + if ((f_out = fopen (fn_out, "ab")) == (FILE *) 0) + { + return_value=-1; + goto STOP1; + } + fseek (f_out, (long) 0, 2); + *pos_from = pos = ftell (f_out); + } + else { + if ((f_out = fopen (fn_out, "wb")) == (FILE *) 0) return -1; + { + return_value=-1; + goto STOP1; + } + *pos_from = pos = 0L; + } + + for (;;) + { + cht = fgetc (f_txt) & 0x00FF; + if (feof (f_txt)) break; + if (ftr_line == txt_line && ftr_col == txt_col) + { /* Feature gefunden; umwandeln in ein Tag */ + if (cht != 0x04) pos += fchar (cht, f_out); + fputc ('<', f_out); + pos++; + while ((chf=fgetc (f_ftr) & 0x00FF) != 0x0A) + if (chf != 0x0D) + { + fputc (chf, f_out); + pos++; + } + fputc ('>', f_out); + pos++; + fscanf (f_ftr, "%d%d%d", &ftr_line, &ftr_col, &dummy); + if (feof (f_ftr)) ftr_line=-1; + else fgetc (f_ftr); + } + else { + pos += fchar (cht, f_out); + } + txt_col++; + if (cht==0x0A) + { + txt_col=0; + txt_line++; + } + } + + *pos_to = pos-1L; + + fclose (f_out); +STOP1: + if (fn_ftr != (char *) 0) fclose (f_ftr); + fclose (f_txt); + return 0; +} + +/* ------------------------------------------------------------------------ */ +long fchar (int character, FILE *file_out) +{ + switch (character) + { + case '<': + fputs ("<0x3C>", file_out); + return 6L; + case '>': + fputs ("<0x3E>", file_out); + return 6L; + default: + fputc (character, file_out); + return 1L; + } +} + + + + + diff --git a/app/sgml/sgml0005.c b/app/sgml/sgml0005.c new file mode 100644 index 0000000000000000000000000000000000000000..642ee1c0c9738f38b0d815888cb8b3e823e8e9ab --- /dev/null +++ b/app/sgml/sgml0005.c @@ -0,0 +1,179 @@ +/* + * FILE ~/usr/sgml/sgml0005.c + * + * written: 1990 09 27 + * latest update: 1999-04-25 16:40:04 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/sgml.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +struct SGML_TAG *cdecl get_sgml_tag (char *); + +/* HOOK: ------------------------------------------------------------------ */ +sgml_list_element () { int i; } /* weitergereichtes SGML List-Element */ + +/* ------------------------------------------------------------------------ */ +# define BUFFER_SIZE 1024 +static char buffer [BUFFER_SIZE]; /* collected tag und text string */ + +static int buffer_lng=0; +static int mode=0; /* 0 ... text; 1 ... tag */ +static int tag_state=0; /* state of the tag scanner */ +static int tag_cnt=0; /* count of tag elements */ + +static struct SGML_LIST *list, **listptr; + +/* ------------------------------------------------------------------------ */ +x_out_char (long ch) +{ + buffer [buffer_lng++]=(char) ch; + if (buffer_lng >= BUFFER_SIZE) swap_text (); +} + +/* ------------------------------------------------------------------------ */ +x_tag_beg () +{ + if (buffer_lng) swap_text (); + mode=1; + tag_state=0; + tag_cnt=0; + buffer_lng=0; + list=(struct SGML_LIST *) 0; + listptr = &list; +} + +/* ------------------------------------------------------------------------ */ +x_tag_end () +{ + swap_tag (); + mode=0; + buffer_lng=0; + sgml_list_element (list); +} + +/* ------------------------------------------------------------------------ */ +x_tag_chr (long ch) +{ + int chr; + chr = (int) ch; + + switch (tag_state) + { + case 0: + switch (chr) + { + case '\"': + tag_state=3; + break; + case '\\': + tag_state=2; + break; + case ':': + case ';': + buffer[0]=chr; + buffer_lng=1; + swap_tag (); + break; + default: + buffer[0]=chr; + buffer_lng=1; + tag_state=1; + break; + } + break; + case 1: + switch (chr) + { + case '\"': + if (buffer_lng < BUFFER_SIZE) buffer [buffer_lng++]=chr; + tag_state=3; + break; + case '\\': + tag_state=2; + break; + case ' ': + case 0x09: + case 0x0A: + case 0x0D: + swap_tag (); + tag_state=0; + break; + default: + if (buffer_lng < BUFFER_SIZE) buffer[buffer_lng++]=chr; + tag_state=1; + break; + } + break; + case 2: + if (buffer_lng < BUFFER_SIZE) buffer[buffer_lng++]=chr; + tag_state=1; + break; + case 3: + if (ch=='\\') tag_state=4; else + { + if (ch=='\"') tag_state=1; + if (buffer_lng < BUFFER_SIZE) buffer[buffer_lng++]=chr; + } + break; + case 4: + if (buffer_lng < BUFFER_SIZE) buffer[buffer_lng++]=chr; + tag_state=3; + break; + } +} + +/* ------------------------------------------------------------------------ */ +static swap_text () +{ + struct SGML_INFO_BYTE *ib; + + if (buffer_lng==0) return; + ib = (struct SGML_INFO_BYTE *) + calloc (sizeof (struct SGML_INFO_BYTE) - 2 + buffer_lng, 1); + ib->sig = SIG_INFO_BYTE; + ib->size = buffer_lng; + memcpy (ib->info, buffer, buffer_lng); + buffer_lng=0; + sgml_list_element (ib); +} + +/* ------------------------------------------------------------------------ */ +static swap_tag () +{ + struct SGML_TAG *t; + struct SGML_INFO_BYTE *ib; + struct SGML_LIST *ls; + + if (buffer_lng==0) return; + buffer [buffer_lng]=0; + + ls = (struct SGML_LIST *) calloc (sizeof (struct SGML_LIST), 1); + ls->sig = SIG_LIST; + ls->cdr = (struct SGML_LIST *) 0; + *listptr = ls; + listptr = &(ls->cdr); + + if (tag_cnt==0) + { + t=get_sgml_tag (buffer); + ls->car=t; + } + else { + ib = (struct SGML_INFO_BYTE *) + calloc (sizeof (struct SGML_INFO_BYTE) - 1 + buffer_lng, 1); + ib->sig = SIG_PARAMETER; + ib->size = buffer_lng; + ls->car = ib; + memcpy (ib->info, buffer, buffer_lng+1); + } + + buffer_lng = 0; + tag_cnt++; +} diff --git a/app/sgml/sgml0006.c b/app/sgml/sgml0006.c new file mode 100644 index 0000000000000000000000000000000000000000..7958cec3e81b4eadb9db3501957a773d6c025209 --- /dev/null +++ b/app/sgml/sgml0006.c @@ -0,0 +1,146 @@ +/* + * FILE ~/usr/sgml/sgml0006.c + * + * written: 1990 09 27 + * latest update: 1999-04-25 16:40:12 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/sgml.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +sgml_list_out () { int i; } /* Hook f�r Weiterleitung */ + /* eines SGML Elementes */ + +/* ------------------------------------------------------------------------ */ +# define MAX_TRANS_STACK 100 +static int trans_mode= 0; +static int trans_stack [MAX_TRANS_STACK]; +static int trans_case [MAX_TRANS_STACK]; /* switch: case match */ +static int trans_sp=0; + +/* ------------------------------------------------------------------------ */ +sgml_transmit_segment (void *segment) +{ + struct SGML_TAG *st; + struct SGML_LIST *sl, *sl2; + void *p1, *p2; + int rc; + + sl = segment; + + switch (trans_mode) + { + case 0: /* no control structure ) */ + case 1: /* if-section when condition true ) process information */ + case 4: /* else-section when condition false ) */ + if (sl->sig == SIG_INFO_BYTE) + sgml_list_out (segment); + if (sl->sig==SIG_LIST) + { + st=sl->car; + if (st->sig==SIG_TAG) + { + switch (st->sgml_tag_id) + { + case SGML_TAG_case: /* SYNTAX ERROR !!! */ + case SGML_TAG_default: /* SYNTAX ERROR !!! */ + case SGML_TAG_break: /* SYNTAX ERROR !!! */ + case SGML_TAG_endswitch: /* SYNTAX ERROR !!! */ + free_tag_list (sl); + break; + case SGML_TAG_else: + if (trans_mode==1) trans_mode=3; + free_tag_list (sl); + break; + case SGML_TAG_endif: + if (trans_mode==1) trans_mode = trans_stack[--trans_sp]; + free_tag_list (sl); + break; + case SGML_TAG_set: /* evaluate what to set */ + sgml_set_variable (sl->cdr, 1); + sl->cdr= (void *) 0; + free_tag_list (sl); + break; + case SGML_TAG_if: /* evaluate the condition */ + trans_stack [trans_sp++]=trans_mode; + rc= sgml_test_variable (sl->cdr); + trans_mode= (rc) ? 1 : 2; + free_tag_list (sl); + break; + case SGML_TAG_switch: /* evaluate the selector */ + free_tag_list (sl); + break; + case SGML_TAG_frame: /* frame tags are deleted here */ + case SGML_TAG_endframe: + case SGML_TAG_Sframe: + case SGML_TAG_Sendframe: + /* break; transmit tag segments to next processor !!! */ + /* he will be happy about that :-)) */ + default: + sgml_list_out (segment); + break; + } + } + } + break; + + case 2: /* if-section when condition false ) ignore information */ + case 3: /* else-section when condition true ) */ + case 5: /* if construct, when already ignoring information */ + if (sl->sig==SIG_LIST) + { + st=sl->car; + if (st->sig==SIG_TAG) + { + switch (st->sgml_tag_id) + { + case SGML_TAG_else: + if (trans_mode==2) trans_mode=4; + break; + case SGML_TAG_endif: + trans_mode = trans_stack[--trans_sp]; + break; + case SGML_TAG_if: + trans_stack [trans_sp++]=trans_mode; + trans_mode=5; + break; + } + } + } + free_tag_list (); + break; + } +} + +/* ------------------------------------------------------------------------ */ +free_tag_list (void *segment) +{ + struct SGML_LIST *sl, *sl2; + + if (segment == (void *) 0) return; + sl = segment; +AGAIN: + + switch (sl->sig) + { + case SIG_LIST: /* follow the list */ + free_tag_list (sl->car); + sl2=sl; + sl = sl->cdr; + free (sl2); + if (sl != (struct SGML_LIST *) 0) goto AGAIN; + break; + case SIG_TAG: /* don't delete TAG records */ + break; + default: /* other records can be deleted */ + free (sl); + break; + } +} diff --git a/app/sgml/sgml0007.c b/app/sgml/sgml0007.c new file mode 100644 index 0000000000000000000000000000000000000000..0b22b6e24870409ce4368b55b033722bdcc5ed50 --- /dev/null +++ b/app/sgml/sgml0007.c @@ -0,0 +1,132 @@ +/* + * FILE ~/usr/sgml/sgml0007.c + * + * written: 1990 09 28 + * latest update: 1999-04-25 16:40:22 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/sgml.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +static struct SGML_VARIABLE *variable_list; + +/* ------------------------------------------------------------------------ */ +static struct SGML_INFO_BYTE *deref_ptr (void *ptr) +{ + struct SGML_INFO_BYTE *par; + + switch (((struct SGML_LIST *) ptr)->sig) + { + case SIG_LIST: + par= ((struct SGML_LIST *) ptr)->car; + if (par == (void *) 0 + || par->sig != SIG_PARAMETER) + return (void *) 0; + break; + case SIG_PARAMETER: + par=ptr; + break; + default: return (void *) 0; + } +} + +/* ------------------------------------------------------------------------ */ +struct SGML_VARIABLE *sgml_get_variable (void *ptr) +{ + struct SGML_VARIABLE *var; + struct SGML_INFO_BYTE *par; + + par = deref_ptr (ptr); + if (par == (void *) 0) return (void *) 0; + + for (var = variable_list; + var != (struct SGML_VARIABLE *) 0; + var = var->sgml_variable_next) + { + if (strcmp (((struct SGML_INFO_BYTE *) var->sgml_variable_name)->info, + par->info) == 0) + return var; + } + + return (void *) 0; +} + +/* ------------------------------------------------------------------------ */ +struct SGML_INFO_BYTE *sgml_get_value (void *ptr) +{ + struct SGML_VARIABLE *var; + + var = sgml_get_variable (ptr); + if (var == (void *) 0) return (void *) 0; + return var->sgml_variable_value; +} + +/* ------------------------------------------------------------------------ */ +int sgml_test_variable (void *ptr) +{ + struct SGML_VARIABLE *var; + struct SGML_INFO_BYTE *par1, *par2; + + var = sgml_get_variable (ptr); + if (var == (void *) 0) return 0; + if ((par2=var->sgml_variable_value) == (void *) 0) return 0; + + if (((struct SGML_INFO_BYTE *) ptr)->sig + == SIG_PARAMETER) return 1; + /* ... nur variablen name angegeben? */ + if (((struct SGML_LIST *) ptr)->sig == SIG_LIST) + { + if (((struct SGML_LIST *) ptr)->cdr == (void *) 0) return 1; + /* ... nur Test auf Vorhandensein der Variable */ + /* das ist hiermit erf�llt */ + + par1= ((struct SGML_LIST *) ptr)->cdr->car; + if (par1->sig != SIG_PARAMETER) return 0; + /* ... der Parameter der Bedingung ist hier nicht interpretierbar */ + if (strcmp (par1->info, par2->info) == 0) return 1; + /* ... der Parameter der Bedingung matcht mit dem Variablenwert */ + /* dieser Test m�sste in Zukunft weiter ausgebaut werden! ###### */ + } + return 0; /* ... kein match, oder Parameter nicht verst�ndlich. usw. */ +} + +/* ------------------------------------------------------------------------ */ +sgml_set_variable (void *ptr, int ptr_mode) +/* ptr_mode: 0 ... nichts */ +/* 1 ... Pointer in der �bergebenen Liste auf NIL setzen */ +/* 2 ... VAR & Value kopieren ###### NICHT IMPLEMENTIERT ######## */ +{ + struct SGML_VARIABLE *var; + struct SGML_INFO_BYTE *val; + + if (((struct SGML_LIST *) ptr)->sig != SIG_LIST) return; + var = sgml_get_variable (ptr); + if (var == (void *) 0) + { + var = (struct SGML_VARIABLE *) + calloc (sizeof (struct SGML_VARIABLE), 1); + var->sgml_variable_next = variable_list; + variable_list = var; + var->sgml_variable_name = ((struct SGML_LIST *) ptr)->car; + if (ptr_mode == 1) ((struct SGML_LIST *) ptr)->car = (void *) 0; + } + else { + free_tag_list (var->sgml_variable_value); + } + + if (((struct SGML_LIST *) ptr)->cdr == (void *) 0) + { + var->sgml_variable_value = (void *) 0; + } + else { + var->sgml_variable_value = ((struct SGML_LIST *) ptr)->cdr->car; + if (ptr_mode == 1) ((struct SGML_LIST *) ptr)->cdr->car = (void *) 0; + } +} diff --git a/app/sgml/sgml0008.c b/app/sgml/sgml0008.c new file mode 100644 index 0000000000000000000000000000000000000000..2942a9117e720a19ffb2af7b362583163baee372 --- /dev/null +++ b/app/sgml/sgml0008.c @@ -0,0 +1,710 @@ +/* + * FILE ~/usr/sgml/sgml0008.c + * + * written: 1990 10 01 + * latest update: 1999-04-25 16:40:28 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/sgml.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +static struct SGML_LIST *segments= (struct SGML_SEGMENT *) 0; +static struct SGML_LIST **append_segments= &segments; +static struct SGML_LIST *actual_frame= (struct SGML_SEGMENT *) 0; + +/* ------------------------------------------------------------------------ */ +static int processor_code= 1; +static int italic_correction= 0; +static int process_data= 1; /* Daten ausgeben */ + +/* ------------------------------------------------------------------------ */ +static int paragraph_depth= 0; /* Zahl der offenen paragraphs */ +static int hervorhebung_depth= 0; /* Zahl der offenen hervorhebungen */ +static int formel_depth= 0; +static int gleichung_depth= 0; +static int definition_depth= 0; +static int verbatim_depth= 0; +static int inhibit_hyphenation= 0; +static int inhibit_hyphenation2= 0; +static int errors_in_frame= 0; +static int slanted= 0; +static int math_mode= 0; /* 1 -> 'billiges' math */ + /* 2 -> 'teures' math */ + +static int quote_type= 0; /* 1 -> english double quotes */ + /* 2 -> german double quotes */ +static int quote_depth= 0; +static int quote_stack[10]; /* #### */ + +static int note_type= 0; /* 1 -> footnote */ + +static int typographic_type= 0; /* 1 -> ty=legato */ + /* Bindestrich */ + /* 2 -> ty=cont(inuation) */ + /* 'Fortsetzungsstich' */ + /* 3 -> ty=dash */ + /* Gedankenstrich */ + /* 4 -> ty=hyphen */ + /* moegliche Abteilungsposition*/ + /* 5 -> ty=space */ + /* Unteilbarer Zwischenraum */ + +/* prototypes: ------------------------------------------------------------ */ +/* global: void sgml_transmit_2segment (void *segment); */ +/* global: void flush_segments (void); */ +static process_segments (void *segment, int level); +static void process_1segment (void *segment, int level); +static void print_tag_sequence (struct SGML_LIST *sl, int mode); +static int process_tag_sequence (struct SGML_LIST *tl); +static void report_tagging_error (struct SGML_LIST *tl, + char *message, int p1); + +/* ------------------------------------------------------------------------ */ +/* SGML List Segment uebernehmen, und am Ende eines Frames das */ +/* Verarbeiten (flushen) der bisherigen Liste ausloesen. */ +void sgml_transmit_2segment (void *segment) +{ + struct SGML_LIST *nl; + struct SGML_TAG *tg; + + if (segment == (void *) 0) return; + nl = (struct SGML_LIST *) calloc (sizeof (struct SGML_LIST), 1); + nl->sig= SIG_LIST; + nl->car = segment; + nl->cdr = (void *) 0; + *append_segments=nl; + append_segments = &(nl->cdr); + + if (((struct SGML_LIST *) segment)->sig == SIG_LIST) + { + tg = (struct SGML_TAG *) ((struct SGML_LIST *) segment)->car; + if (tg->sig == SIG_TAG) + { + if (tg->sgml_tag_id == SGML_TAG_endframe + || tg->sgml_tag_id == SGML_TAG_Sendframe) + { /* make output every time, when a frame ends ... */ + flush_segments (); + } + } + } +} + +/* ------------------------------------------------------------------------ */ +void flush_segments () +{ + printf ("*** flush segments ***\n"); + process_segments (segments, 1); + free_tag_list (segments); + segments=(struct SGML_SEGMENT *) 0; + append_segments= &segments; +} + +/* ------------------------------------------------------------------------ */ +static process_segments (void *segment, int level) +{ + struct SGML_LIST *sl; + + if (segment == (void *) 0) + { + printf ("*** segment list empty ***\n"); + return; + } + sl = segment; +AGAIN: + process_1segment (sl, level); + + if (sl->sig==SIG_LIST) + { + if (((struct SGML_TAG *) sl->car)->sig == SIG_TAG) + { /* Process Tag and his parameters */ + process_tag_sequence (sl); + } + else { /* process this list */ + process_segments (sl->car, level+1); + sl = sl->cdr; + if (sl != (struct SGML_LIST *) 0) goto AGAIN; + } + } +} + +/* ------------------------------------------------------------------------ */ +static void process_1segment (void *segment, int level) +{ + struct SGML_LIST *sl; + struct SGML_INFO_BYTE *sib; + struct SGML_TAG *st; + int mode; + + sl = segment; + /* printf ("segment (%d) 0x%02X\n", level, sl->sig); */ + + if (sl->sig==SIG_INFO_BYTE && process_data) + { /* send information block to the output; */ + /* tex-symbols must be processed, if we are not in verbatim-mode !!! */ + sib = segment; + mode = (verbatim_depth>0) ? 0x00 : 0x01; + mode |= (inhibit_hyphenation) ? 0x02 : 0x00; + if (italic_correction) + { + mode |= 0x04; + italic_correction= 0; + } + sgml_data_block (processor_code, mode, sib->info, sib->size); + } + if (sl->sig==SIG_TAG) + { + st = segment; + printf ("* TAG %s\n", st->sgml_tag_name); + dump (stdout, st, sizeof (struct SGML_TAG)); + } + if (sl->sig==SIG_PARAMETER) + { + printf ("* PARAMETER\n"); + sib = segment; + dump (stdout, sib, sib->size+4); + } +} + +/* ------------------------------------------------------------------------ */ +static void print_tag_sequence (struct SGML_LIST *sl, int mode) +/* mode: bit 0: output full tag information */ +/* bit 1: send output to the information stream, */ +/* otherwise send it to stdout */ +/* bit 2: the tag sequence must be processed for TeX */ +{ + struct SGML_TAG *st; + struct SGML_INFO_BYTE *sp; + int done=0; + int i; + char *cp; + int quoted; + + for (; sl != (void *) 0 && sl->sig == SIG_LIST; sl=sl->cdr) + { + st = sl->car; + if ((mode & 0x01) && st->sig==SIG_TAG) + { + printf ("<%s", st->sgml_tag_name); + done=1; + } + sp=sl->car; + if (sp->sig==SIG_PARAMETER) + { + if (mode & 0x02) + { + if (done) sgml_data_byte (SGML_PROC_verbatim, 0x00, ' '); + sgml_data_block ((mode & 0x04) ? processor_code + : SGML_PROC_verbatim, + (mode & 0x04) ? 0x01 + : 0x00, + sp->info, sp->size); + } + else { + if (done) fputc (' ', stdout); + cp=sp->info; + for (i=sp->size; i > 0; i--) fputc (*cp++, stdout); + } + done=1; + } + } + if (done && (mode & 0x01)) printf (">\n"); +} + +/* ------------------------------------------------------------------------ */ +static int process_tag_sequence (struct SGML_LIST *tl) +{ + struct SGML_TAG *tag; + struct SGML_INFO_BYTE *par; + struct SGML_LIST *tl2; + int title_type; + + if (tl == (void *) 0) return 0; + + tag= tl->car; + if (tag->sig != SIG_TAG) return -1; + + switch (tag->sgml_tag_id) + { + case SGML_TAG_frame: /* frame tags are deleted here */ + case SGML_TAG_Sframe: + actual_frame = tl; + errors_in_frame=0; + /* ausgabe des Frame names als TeX Makro, fuer debugging ... */ + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\framemark{", 11); + print_tag_sequence (tl, 0x06); /* Frame tag sequence must be */ + /* prepared for use with TeX */ + sgml_data_byte (SGML_PROC_verbatim, 0x00, '}'); + break; + case SGML_TAG_endframe: + case SGML_TAG_Sendframe: + if (errors_in_frame > 0) + printf ("*** %d errors here!\n\n", errors_in_frame); + actual_frame = (void *) 0; + break; + case SGML_TAG_paragraph: + if (++paragraph_depth != 1) + report_tagging_error (tl, "* Error %d paragraphs are open after ", + paragraph_depth); + break; + case SGML_TAG_endparagraph: + if (--paragraph_depth != 0) + { + if (errors_in_frame++ == 0) print_tag_sequence (actual_frame, 0x01); + printf ("* Error %d paragraphs are open after ", paragraph_depth); + print_tag_sequence (tl, 0x01); + } + sgml_data_byte (SGML_PROC_verbatim, 0x00, '\n'); + break; + case SGML_TAG_Titel: + if (!process_data) break; + title_type=-1; + if (tl->cdr != (void *) 0) + { + par= tl->cdr->car; + if (par->sig == SIG_PARAMETER) + { + if (strncmp (par->info, "K",1) == 0) title_type=1; + if (strncmp (par->info, "A",1) == 0) title_type=2; + if (strncmp (par->info, "B",1) == 0) title_type=3; + if (strncmp (par->info, "C",1) == 0) title_type=4; + if (strncmp (par->info, "D",1) == 0) title_type=5; + if (strncmp (par->info, "E",1) == 0) title_type=6; + } + } + switch (title_type) + { + case 1: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\chapter{", 9); + break; + case 2: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\section{", 9); + break; + case 3: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\subsection{", 12); + break; + case 4: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\subsubsection{", 15); + break; + case 5: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\paragraph{", 11); + break; + case 6: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\subparagraph{", 14); + break; + default: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\subparagraph{(??) ", 19); + break; + } + inhibit_hyphenation2 = inhibit_hyphenation; + inhibit_hyphenation = 1; + processor_code = SGML_PROC_text; + /* processor_code = SGML_PROC_title_1; */ + /* processor_code = SGML_PROC_title_2; */ + break; + case SGML_TAG_endTitel: + if (!process_data) break; + inhibit_hyphenation = inhibit_hyphenation2; + switch (processor_code) + { + case SGML_PROC_text: + sgml_data_byte (SGML_PROC_verbatim, 0x00, '}'); + break; + case SGML_PROC_title_1: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\-}", 3); + break; + case SGML_PROC_title_2: + sgml_data_block (SGML_PROC_verbatim, 0x00, "}}", 2); + break; + } + processor_code = SGML_PROC_text; + break; + + case SGML_TAG_BodyText: + case SGML_TAG_endBodyText: + case SGML_TAG_OverheadText: + case SGML_TAG_endOverheadText: + /* simply ignore these things ... */ + break; + + case SGML_TAG_Hervorhebung: + if (++hervorhebung_depth != 1) + { + if (errors_in_frame++ == 0) print_tag_sequence (actual_frame, 0x01); + printf ("* Error %d \'hervorhebung\' are open after ", hervorhebung_depth); + print_tag_sequence (tl, 0x01); + } + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\it{}", 5); + break; + case SGML_TAG_endHervorhebung: + if (--hervorhebung_depth != 0) + { + if (errors_in_frame++ == 0) print_tag_sequence (actual_frame, 0x01); + printf ("* Error %d \'hervorhebung\' are open after ", hervorhebung_depth); + print_tag_sequence (tl, 0x01); + } + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\rm{}", 5); + italic_correction=1; + break; + + case SGML_TAG_Definition: +#ifdef NOT_USED_NOW + if (++definition_depth != 1) + { + if (errors_in_frame++ == 0) print_tag_sequence (actual_frame, 0x01); + printf ("* Error %d \'definition\' are open after ", definition_depth); + print_tag_sequence (tl, 0x01); + } + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\bf{}", 5); +#endif + break; + case SGML_TAG_endDefinition: +#ifdef NOT_USED_NOW + if (--definition_depth != 0) + { + if (errors_in_frame++ == 0) print_tag_sequence (actual_frame, 0x01); + printf ("* Error %d \'definition\' are open after ", definition_depth); + print_tag_sequence (tl, 0x01); + } + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\rm{}", 5); +#endif + break; + + case SGML_TAG_Gleichung: + if (++gleichung_depth != 1) + { + if (errors_in_frame++ == 0) print_tag_sequence (actual_frame, 0x01); + printf ("* Error %d \'gleichung\' are open after ", gleichung_depth); + print_tag_sequence (tl, 0x01); + } + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\[", 2); + math_mode=2; + break; + case SGML_TAG_endGleichung: + if (--gleichung_depth != 0) + { + if (errors_in_frame++ == 0) print_tag_sequence (actual_frame, 0x01); + printf ("* Error %d \'gleichung\' are open after ", gleichung_depth); + print_tag_sequence (tl, 0x01); + } + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\]", 2); + math_mode=0; + break; + + case SGML_TAG_Formel: + if (++formel_depth != 1) + { + if (errors_in_frame++ == 0) print_tag_sequence (actual_frame, 0x01); + printf ("* Error %d \'formel\' are open after ", formel_depth); + print_tag_sequence (tl, 0x01); + } + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\(", 2); + math_mode=1; + break; + case SGML_TAG_endFormel: + if (--formel_depth != 0) + { + if (errors_in_frame++ == 0) print_tag_sequence (actual_frame, 0x01); + printf ("* Error %d \'formel\' are open after ", formel_depth); + print_tag_sequence (tl, 0x01); + } + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\)", 2); + math_mode=0; + break; + + case SGML_TAG_slant: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\sl{}", 5); + break; + case SGML_TAG_endslant: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\rm{}", 5); + italic_correction=1; + break; + + case SGML_TAG_Tex: + if (!process_data) break; + if (math_mode == 0) + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\(", 2); + sgml_data_byte (SGML_PROC_verbatim, 0x00, '{'); + print_tag_sequence (tl, 0x02); /* Tex tag sequence must not */ + /* be prepared for use with TeX */ + sgml_data_byte (SGML_PROC_verbatim, 0x00, '}'); + if (math_mode == 0) + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\)", 2); + break; + + case SGML_TAG_verbatim: + if (++verbatim_depth != 1) + { + if (errors_in_frame++ == 0) print_tag_sequence (actual_frame, 0x01); + printf ("* Error %d verbatim are open after ", verbatim_depth); + print_tag_sequence (tl, 0x01); + } + /* #### verbatim ty=xxxx checken; #### ggf. process_data=0 setzen ### */ + processor_code = SGML_PROC_verbatim; + break; + case SGML_TAG_endverbatim: + if (--verbatim_depth != 0) + { + if (errors_in_frame++ == 0) print_tag_sequence (actual_frame, 0x01); + printf ("* Error %d \'verbatim\' are open after ", verbatim_depth); + print_tag_sequence (tl, 0x01); + } + /* #### verbatim ty=xxxx checken; #### ggf. process_data=1 setzen ### */ + processor_code = SGML_PROC_text; + break; + + case SGML_TAG_quote: + if (!process_data) break; + quote_stack [quote_depth++] = quote_type; + quote_type = 0; + tl2 = tl->cdr; + while (tl2 != (void *) 0) + { + par= tl2->car; + tl2= tl2->cdr; + if (par->sig == SIG_PARAMETER) + { + if (strncmp (par->info, "lang=english", 12) == 0) quote_type=1; + if (strncmp (par->info, "lang=german", 11) == 0) + quote_type = (quote_depth == 1) ? 2 : 3; + } + } + switch (quote_type) + { + case 2: + sgml_data_block (SGML_PROC_verbatim, 0x00, "{\\glqq}", 7); + break; + case 3: + sgml_data_block (SGML_PROC_verbatim, 0x00, "{\\glq}", 6); + break; + case 0: + break; + default: + sgml_data_block (SGML_PROC_verbatim, 0x00, "``", 2); + break; + } + break; + case SGML_TAG_endquote: + if (!process_data) break; + if (quote_depth <= 0) break; + if (italic_correction) + { + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\/", 2); + italic_correction = 0; + } + switch (quote_type) + { + case 2: + sgml_data_block (SGML_PROC_verbatim, 0x00, "{\\grqq}", 7); + break; + case 3: + sgml_data_block (SGML_PROC_verbatim, 0x00, "{\\grq}", 6); + break; + case 0: + break; + default: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\'\'", 2); + break; + } + quote_type = quote_stack [--quote_depth]; + break; + + case SGML_TAG_note: + if (!process_data) break; + note_type = 0; + tl2 = tl->cdr; + while (tl2 != (void *) 0) + { + par= tl2->car; + tl2= tl2->cdr; + if (par->sig == SIG_PARAMETER) + { + if (strncmp (par->info, "ty=footnote", 11) == 0) note_type=1; + } + } + switch (note_type) + { + case 1: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\footnote{", 10); + break; + default: + break; + } + break; + case SGML_TAG_endnote: + if (!process_data) break; + switch (note_type) + { + case 1: + sgml_data_byte (SGML_PROC_verbatim, 0x00, '}'); + break; + default: + break; + } + note_type=0; + break; + + case SGML_TAG_typographic: + if (!process_data) break; + typographic_type=-1; + if (tl->cdr != (void *) 0) + { + par= tl->cdr->car; + if (par->sig == SIG_PARAMETER) + { + if (strncmp (par->info, "ty=legato", 9) == 0) typographic_type=1; + if (strncmp (par->info, "ty=minus", 8) == 0) typographic_type=1; + if (strncmp (par->info, "ty=cont", 7) == 0) typographic_type=2; + if (strncmp (par->info, "ty=dash", 7) == 0) typographic_type=3; + if (strncmp (par->info, "ty=hyphen", 9) == 0) typographic_type=4; + if (strncmp (par->info, "ty=space", 8) == 0) typographic_type=5; + if (strncmp (par->info, "ty=linebreak",12) == 0) typographic_type=6; + if (strncmp (par->info, "ty=linebreak[0]",12) == 0) typographic_type=7; + if (strncmp (par->info, "ty=linebreak[1]",12) == 0) typographic_type=8; + if (strncmp (par->info, "ty=linebreak[2]",12) == 0) typographic_type=9; + if (strncmp (par->info, "ty=linebreak[3]",12) == 0) typographic_type=10; + if (strncmp (par->info, "ty=linebreak[4]",12) == 0) typographic_type=11; + } + } + switch (typographic_type) + { + case 1: + sgml_data_block (SGML_PROC_verbatim, 0x00, "--", 2); + break; + case 2: + sgml_data_byte (SGML_PROC_verbatim, 0x00, '-'); + break; + case 3: + sgml_data_block (SGML_PROC_verbatim, 0x00, "---", 3); + break; + case 4: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\-", 2); + break; + case 5: + sgml_data_byte (SGML_PROC_verbatim, 0x00, '~'); + break; + case 6: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\linebreak ", 11); + break; + case 7: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\linebreak[0] ", 14); + break; + case 8: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\linebreak[1] ", 14); + break; + case 9: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\linebreak[2] ", 14); + break; + case 10: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\linebreak[3] ", 14); + break; + case 11: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\linebreak[4] ", 14); + break; + default: /* keine Aktion */ + break; + } + break; + + case SGML_TAG_link: + if (!process_data) break; + { + int link_type=-1; + int link_id_size; + char *link_id=(char *) 0; + int link_type_lng; + char *link_type_str; + + tl2 = tl->cdr; + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\linkmark{link", 10); + while (tl2 != (void *) 0) + { + par= tl2->car; + tl2= tl2->cdr; + if (par->sig == SIG_PARAMETER) + { + sgml_data_byte (SGML_PROC_verbatim, 0x00, ' '); + sgml_data_block (SGML_PROC_verbatim, 0x00, + par->info, par->size); + if (strncmp (par->info, "ty=label", 8) == 0) link_type=1; + if (strncmp (par->info, "ty=ref", 6) == 0) link_type=2; + if (strncmp (par->info, "ty=pageref", 10) == 0) link_type=3; + if (strncmp (par->info, "ty=TeX:", 7) == 0) + { + link_type=4; + link_type_str = par->info + 7; + link_type_lng = par->size - 7; + } + if (strncmp (par->info, "ty=LaTeX:", 9) == 0) + { + link_type=4; + link_type_str = par->info + 9; + link_type_lng = par->size - 9; + } + if (strncmp (par->info, "id=", 3) == 0) + { + link_id = par->info + 3; + link_id_size = par->size - 3; + } + } + } + sgml_data_byte (SGML_PROC_verbatim, 0x00, '}'); + if (link_type == -1 || link_id == (char *) 0) break; + switch (link_type) + { + case 1: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\label{", 7); + break; + case 2: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\ref{", 5); + break; + case 3: + sgml_data_block (SGML_PROC_verbatim, 0x00, "\\pageref{", 9); + break; + case 4: + sgml_data_byte (SGML_PROC_verbatim, 0x00, '\\'); + sgml_data_block (SGML_PROC_verbatim, 0x00, link_type_str, link_type_lng); + sgml_data_byte (SGML_PROC_verbatim, 0x00, '{'); + break; + default: /* keine Aktion */ + break; + } + sgml_data_block (SGML_PROC_verbatim, 0x01, link_id, link_id_size); + sgml_data_byte (SGML_PROC_verbatim, 0x00, '}'); + } + break; + + case SGML_TAG_Ref: + case SGML_TAG_SIG1: + case SGML_TAG_SIG2: + case SGML_TAG_FrAttr: + case SGML_TAG_name: + case SGML_TAG_endname: + case SGML_TAG_reference: + case SGML_TAG_endreference: + /* simply ignore these things ########## NOW ######## */ + break; + default: + report_tagging_error (tl, "* unknown TAG: ", 0); + break; + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +static void report_tagging_error ( +struct SGML_LIST *tl, +char *message, +int p1) +{ + if (errors_in_frame++ == 0) print_tag_sequence (actual_frame, 0x01); + printf (message, p1); + print_tag_sequence (tl, 0x01); +} + diff --git a/app/sgml/sgml0009.c b/app/sgml/sgml0009.c new file mode 100644 index 0000000000000000000000000000000000000000..a245da4c5a39473a1d6574b0abc9f1b8151fb277 --- /dev/null +++ b/app/sgml/sgml0009.c @@ -0,0 +1,232 @@ +/* + * FILE ~/usr/sgml/sgml0009.c + * + * SGML -> LaTeX: process Characters + * + * written: 1990 10 09 + * latest update: 1999-04-25 16:40:42 + * + */ + +# include <stdio.h> +# include <stdlib.h> +# include <gg/sgml.h> +# include <gg/ta.h> + +# pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +/* processor codes: */ +/* SGML_PROC_verbatim: unprozessed */ +/* SGML_PROC_text: normal Text */ +/* SGML_PROC_title_1: titles -> Abteilungsschutz */ +/* SGML_PROC_title_2: titles -> wortweise mbox{} */ + +/* processing mode: */ +/* bit 3: Italic Korrektur einsetzen */ + +/* ------------------------------------------------------------------------ */ +static int last_cat_code = -1; +static int italic_correction=0; + +/* ------------------------------------------------------------------------ */ +sgml_to_list (char *fnam) +{ + FILE *fi; + int ch; + + sgml_0010_config_processor (1); +/* if (initialized==0) initialize_sgml_0006 (); */ + last_cat_code = -1; + italic_correction = 0; + + fi = fopen (fnam, "rb"); + for (;;) + { + ch = fgetc (fi) & 0x00FF; + if (feof (fi)) break; + sgml_filter (ch); + } + fclose (fi); +} + +/* ------------------------------------------------------------------------ */ +sgml_data_block (int proz, int mode, char *dat, int siz) +{ + if (mode & 0x04) italic_correction=1; + while (siz-- > 0) _sgml_data_byte (proz, (*dat++) & 0x00FF); +} + +/* ------------------------------------------------------------------------ */ +sgml_data_byte (int proz, int mode, int ch) +{ + if (mode & 0x04) italic_correction=1; + _sgml_data_byte (proz, ch); +} + +/* ------------------------------------------------------------------------ */ +_sgml_data_byte (int proz, int ch) +{ + int cat; + + /* QUICK HACK STARTS HERE !!!! */ + /* produce text, which can be used on a MAC for LaTeX !!!! */ + + if (proz != 0) cat= get_cat_code (ch); + + if (proz == 2) /* Title Text */ + { + if ((last_cat_code == TA_CAT_small + || last_cat_code == TA_CAT_capital + || last_cat_code == TA_CAT_nat_small + || last_cat_code == TA_CAT_nat_capital + ) + && (cat == TA_CAT_space1 || cat == TA_CAT_space2) + ) + { /* im Text Mode und Abteilungsschutz: Worte nicht abteilen lassen */ + sgml_fputs ("\\-"); + } + last_cat_code= cat; + } + + if (proz == 3) /* Title Text: -> mbox */ + { + if ((last_cat_code == TA_CAT_space1 || last_cat_code == TA_CAT_space2) + && (cat == TA_CAT_small + || cat == TA_CAT_capital + || cat == TA_CAT_nat_small + || cat == TA_CAT_nat_capital + ) + ) + { /* im Text Mode und Abteilungsschutz: Worte nicht abteilen lassen */ + sgml_fputs ("\\mbox{"); + } + + if ((last_cat_code == TA_CAT_small + || last_cat_code == TA_CAT_capital + || last_cat_code == TA_CAT_nat_small + || last_cat_code == TA_CAT_nat_capital + ) + && (cat == TA_CAT_space1 || cat == TA_CAT_space2) + ) + { /* im Text Mode und Abteilungsschutz: Worte nicht abteilen lassen */ + sgml_fputs ("}"); + } + } + + if (proz != 0) + { + if (italic_correction + && (last_cat_code == TA_CAT_small + || last_cat_code == TA_CAT_capital + || last_cat_code == TA_CAT_nat_small + || last_cat_code == TA_CAT_nat_capital + ) + && ((cat == TA_CAT_satz1 && (ch == '!' || ch == '?')) + || cat == TA_CAT_small + || cat == TA_CAT_capital + || cat == TA_CAT_nat_small + || cat == TA_CAT_nat_capital + || cat == TA_CAT_digit + ) + ) + { /* im Text Mode und Italic-Korrectur: kleiner Zwischenraum */ + sgml_fputs ("\\/"); + } + italic_correction=0; + } + + switch (proz) + { + case 0: + switch (ch) + { + case 0x0D: /* this passage is still rotten :-(( */ + break; + case 0x0A: + ch = 0x0D; + default: + sgml_fputc (ch); + break; + } + break; + case 1: + case 2: + case 3: + switch (ch) + { + /* standard TeX translations */ + case '\\': + sgml_fputs ("{\\backslash}"); + break; + case '{': + sgml_fputs ("\\{"); + break; + case '}': + sgml_fputs ("\\}"); + break; + case '$': + sgml_fputs ("\\$"); + break; + case '&': + sgml_fputs ("\\&"); + break; + case '#': + sgml_fputs ("\\#"); + break; + case '^': + sgml_fputs ("\\^ "); /* ????? */ + break; + case '_': + sgml_fputs ("\\_"); + break; + case '%': + sgml_fputs ("\\%"); + break; + case '~': + sgml_fputs ("\\~ "); /* ???? */ + break; + case '\"': + sgml_fputs ("\'\'"); + break; + + /* german TeX translations */ + case '�': + sgml_fputs ("\"a"); + break; + case '�': + sgml_fputs ("\"A"); + break; + case '�': + sgml_fputs ("\"o"); + break; + case '�': + sgml_fputs ("\"O"); + break; + case '�': + sgml_fputs ("\"u"); + break; + case '�': + sgml_fputs ("\"U"); + break; + case '�': + sgml_fputs ("\"s"); + break; + default: + switch (ch) + { + case 0x0D: /* this passage is still rotten :-(( */ + break; + case 0x0A: + ch = 0x0D; + default: + sgml_fputc (ch); + break; + } + break; + break; + } + } + + if (proz != 0) last_cat_code = cat; +} diff --git a/app/sgml/sgml0010.c b/app/sgml/sgml0010.c new file mode 100644 index 0000000000000000000000000000000000000000..ff87ef4847f52733ccad14af7fe9fab56a4cbd3e --- /dev/null +++ b/app/sgml/sgml0010.c @@ -0,0 +1,64 @@ +/* + * FILE ~/usr/sgml/sgml0010.c + * + * written: 1990 10 09: SGML processor configuration isolated + * into this module + * latest update: 1999-04-25 16:40:51 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/sgml.h> + +/* ------------------------------------------------------------------------ */ +static do_nothing () {} + +/* ------------------------------------------------------------------------ */ +int sgml_0010_config_processor (int processor_code) +{ + int sgml_filter_tag_beg (), x_tag_beg (); + int sgml_filter_tag_end (), x_tag_end (); + int sgml_filter_tag_chr (), x_tag_chr (); + int sgml_filter_com_beg (); + int sgml_filter_com_end (); + int sgml_filter_com_chr (); + int sgml_filter_chr (), x_out_char (); + int sgml_list_element (), sgml_transmit_segment (); + int sgml_list_out (); +#ifdef JUNK + int sgml_transmit_2segment (); +#endif + + switch (processor_code) + { + case 1: /* SGML to LaTeX */ + /* we ignore comment completely here */ + patch (sgml_filter_com_beg, do_nothing); + patch (sgml_filter_com_end, do_nothing); + patch (sgml_filter_com_chr, do_nothing); + + /* tags will be processed */ + patch (sgml_filter_tag_beg, x_tag_beg); + patch (sgml_filter_tag_end, x_tag_end); + patch (sgml_filter_tag_chr, x_tag_chr); + + /* characters will be processed */ + patch (sgml_filter_chr, x_out_char); + + sgml_filter_reset (); + + patch (sgml_list_element, sgml_transmit_segment); + patch (sgml_list_out, sgml_transmit_2segment); + break; + + default: + return -1; + } + + return 0; +} diff --git a/app/sgml/sgml0011.c b/app/sgml/sgml0011.c new file mode 100644 index 0000000000000000000000000000000000000000..f738aa356ecd686a8cd2f5367b2a3abc473c187f --- /dev/null +++ b/app/sgml/sgml0011.c @@ -0,0 +1,58 @@ +/* + * FILE ~/usr/sgml/sgml0011.c + * + * written: 1991 03 03 + * latest update: 1999-04-25 16:40:59 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/sgml.h> + +/* ------------------------------------------------------------------------ */ +static do_nothing () {} + +/* ------------------------------------------------------------------------ */ +int sgml_0011_config_processor (int processor_code) +{ + int sgml_filter_tag_beg (), x_tag_beg (); + int sgml_filter_tag_end (), x_tag_end (); + int sgml_filter_tag_chr (), x_tag_chr (); + int sgml_filter_com_beg (); + int sgml_filter_com_end (); + int sgml_filter_com_chr (); + int sgml_filter_chr (), x_out_char (); + int sgml_list_element (), sgml_report_list (); + + switch (processor_code) + { + case 2: + /* we ignore comment completely here */ + patch (sgml_filter_com_beg, do_nothing); + patch (sgml_filter_com_end, do_nothing); + patch (sgml_filter_com_chr, do_nothing); + + /* tags will be processed */ + patch (sgml_filter_tag_beg, x_tag_beg); + patch (sgml_filter_tag_end, x_tag_end); + patch (sgml_filter_tag_chr, x_tag_chr); + + /* characters will be processed */ + patch (sgml_filter_chr, x_out_char); + + sgml_filter_reset (); + + patch (sgml_list_element, sgml_report_list); + break; + + default: + return -1; + } + + return 0; +} diff --git a/app/sgml/sgml0012.c b/app/sgml/sgml0012.c new file mode 100644 index 0000000000000000000000000000000000000000..b8309c312b612e1a7be9c3730b705547ba6be09b --- /dev/null +++ b/app/sgml/sgml0012.c @@ -0,0 +1,64 @@ +/* + * FILE ~/usr/sgml/sgml0012.c + * + * written: 1991 03 03 + * latest update: 1999-04-25 16:41:08 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/sgml.h> + +static int recursion_level= 0; + +/* ------------------------------------------------------------------------ */ +void sgml_report_list (struct SGML_LIST *sl) +{ + char *cp; + int signature; + int run; + + do + { + run= 0; + signature= sl->sig; + + switch (signature) + { + case 0x0001: cp = "LIST"; break; + case 0x0011: cp = "BYTE"; break; + case 0x0021: cp = "TAG"; break; + case 0x0022: cp = "ATTRIBUTE"; break; + } + + blanks (stdout, recursion_level*2); + printf ("list signature: 0x%04X \'%s\'\n", signature, cp); + + switch (signature) + { + case 0x0001: + recursion_level++; + sgml_report_list (sl->car); + recursion_level--; + sl=sl->cdr; + run=1; + break; + + case 0x0011: + case 0x0021: + case 0x0022: + { + struct SGML_INFO_BYTE *ib; + + ib = (struct SGML_INFO_BYTE *) sl; + dump (stdout, ib->info, ib->size); + } + break; + } + } while (run); +} diff --git a/app/sgml/sgml0013.c b/app/sgml/sgml0013.c new file mode 100644 index 0000000000000000000000000000000000000000..a66190bda081d123133d89cccf7f4a16c89423c4 --- /dev/null +++ b/app/sgml/sgml0013.c @@ -0,0 +1,149 @@ +/* + * FILE ~/usr/sgml/sgml0013.c + * + * Identifikation von Tags + * + * written: 1991 03 12: aus sgml0006.c isoliert + * latest update: 1999-04-25 16:41:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/sgml.h> + +/* ------------------------------------------------------------------------ */ +static struct SGML_LIST *built_in_tags = (struct SGML_LIST *) 0; +static struct SGML_LIST *new_tags = (struct SGML_LIST *) 0; + +static int initialized=0; + +/* ------------------------------------------------------------------------ */ +#ifdef TeX_VERSION +# define CNT_predefined_tags 54 +#else +# define CNT_predefined_tags 31 +#endif + +static struct SGML_TAG predefined_tags [CNT_predefined_tags] = +{ + { SIG_TAG, SGML_TAG_frame, "Frame" } , + { SIG_TAG, SGML_TAG_endframe, "/Frame" } , + { SIG_TAG, SGML_TAG_Sframe, ":" } , + { SIG_TAG, SGML_TAG_Sendframe, ";" } , + { SIG_TAG, SGML_TAG_if, "if" } , + { SIG_TAG, SGML_TAG_else, "else" } , + { SIG_TAG, SGML_TAG_endif, "endif" } , + { SIG_TAG, SGML_TAG_switch, "switch" } , + { SIG_TAG, SGML_TAG_case, "case" } , + { SIG_TAG, SGML_TAG_default, "default" } , + { SIG_TAG, SGML_TAG_break, "break" } , + { SIG_TAG, SGML_TAG_endswitch, "endswitch" } , + { SIG_TAG, SGML_TAG_set, "set" } , + { SIG_TAG, SGML_TAG_paragraph, "p" } , + { SIG_TAG, SGML_TAG_endparagraph,"/p" } , + { SIG_TAG, SGML_TAG_Link, "Link" } , + { SIG_TAG, SGML_TAG_endLink, "/Link" } , + { SIG_TAG, SGML_TAG_Ref, "Ref" } , + { SIG_TAG, SGML_TAG_endRef, "/Ref" } , + { SIG_TAG, SGML_TAG_verbatim, "verbatim" } , + { SIG_TAG, SGML_TAG_endverbatim, "/verbatim" } , + { SIG_TAG, SGML_TAG_FrAttr, "FrAttr" } , + { SIG_TAG, SGML_TAG_SIG1, "SGML/TS00" } , + { SIG_TAG, SGML_TAG_SIG2, "SGML/TS00/HYX" } , + { SIG_TAG, SGML_TAG_typographic,"typographic" } , + { SIG_TAG, SGML_TAG_link, "link" } , + { SIG_TAG, SGML_TAG_endlink, "/link" } , + { SIG_TAG, SGML_TAG_name, "name" } , + { SIG_TAG, SGML_TAG_endname, "/name" } , + { SIG_TAG, SGML_TAG_reference, "reference" } , + { SIG_TAG, SGML_TAG_endreference,"/reference" } +#ifdef TeX_VERSION +, { SIG_TAG, SGML_TAG_Titel, "Titel" } , + { SIG_TAG, SGML_TAG_endTitel, "/Titel" } , + { SIG_TAG, SGML_TAG_Hervorhebung,"Hervorhebung" } , + { SIG_TAG, SGML_TAG_endHervorhebung,"/Hervorhebung" } , + { SIG_TAG, SGML_TAG_OverheadText, "Overhead-Text" } , + { SIG_TAG, SGML_TAG_endOverheadText, "/Overhead-Text" } , + { SIG_TAG, SGML_TAG_Definition, "Definition" } , + { SIG_TAG, SGML_TAG_endDefinition, "/Definition" } , + { SIG_TAG, SGML_TAG_Formel, "Formel" } , + { SIG_TAG, SGML_TAG_endFormel, "/Formel" } , + { SIG_TAG, SGML_TAG_Gleichung, "Gleichung" } , + { SIG_TAG, SGML_TAG_endGleichung, "/Gleichung" } , + { SIG_TAG, SGML_TAG_Tabelle, "Tabelle" } , + { SIG_TAG, SGML_TAG_endTabelle, "/Tabelle" } , + { SIG_TAG, SGML_TAG_BodyText, "Body-Text" } , + { SIG_TAG, SGML_TAG_endBodyText,"/Body-Text" } , + { SIG_TAG, SGML_TAG_slant, "slant" } , + { SIG_TAG, SGML_TAG_endslant,"/slant" } , + { SIG_TAG, SGML_TAG_Tex, "Tex" } , + { SIG_TAG, SGML_TAG_quote, "quote" } , + { SIG_TAG, SGML_TAG_endquote, "/quote" } , + { SIG_TAG, SGML_TAG_note, "note" } , + { SIG_TAG, SGML_TAG_endnote, "/note" } +#endif +} ; + +/* ------------------------------------------------------------------------ */ +void initialize_sgml_0013 () +{ + struct SGML_LIST *sl; + int i; + + initialized=1; + for (i=0;i<CNT_predefined_tags;i++) + { + sl= (struct SGML_LIST *) calloc (sizeof (struct SGML_LIST), 1); + sl->sig = SIG_LIST; + sl->car=&(predefined_tags[i]); + sl->cdr=built_in_tags; + built_in_tags=sl; + } +} + +/* ------------------------------------------------------------------------ */ +struct SGML_TAG *get_sgml_tag (char *tag_name) +{ + struct SGML_TAG *st; + struct SGML_LIST *sl; + char *nm; + + if (initialized==0) initialize_sgml_0013 (); + + for (sl = built_in_tags; + sl != (struct SGML_LIST *) 0; + sl = sl->cdr) + { + if (strcmp (((struct SGML_TAG *) sl->car)->sgml_tag_name, tag_name) == 0) + return sl->car; + } + + for (sl = new_tags; + sl != (struct SGML_LIST *) 0; + sl = sl->cdr) + { + if (strcmp (((struct SGML_TAG *) sl->car)->sgml_tag_name, tag_name) == 0) + return sl->car; + } + + if ((nm= calloc (strlen (tag_name) + 1, 1)) == (char *) 0) + return (struct SGML_TAG *) 0; + strcpy (nm, tag_name); + + st= (struct SGML_TAG *) calloc (sizeof (struct SGML_TAG), 1); + st->sig= SIG_TAG; + st->sgml_tag_name= nm; + + sl= (struct SGML_LIST *) calloc (sizeof (struct SGML_LIST), 1); + sl->sig= SIG_LIST; + sl->car= st; + sl->cdr= new_tags; + new_tags=sl; + + return st; +} diff --git a/app/sgml/sgmlproc.c b/app/sgml/sgmlproc.c new file mode 100644 index 0000000000000000000000000000000000000000..8d84f16a3068912eed158886a6ef6906dd76a502 --- /dev/null +++ b/app/sgml/sgmlproc.c @@ -0,0 +1,285 @@ +/* + * FILE ~/usr/sgml/sgml_process.c + * + * general (old) SGML processor + * + * written: 1990 05 26 + * latest update: 1996-07-17 + * + */ + +#include <stdio.h> +#include <gg/fnames.h> + +#define STDHLP stderr +#define ARG_C_max 24 +static char *arg_v [ARG_C_max]; +static int arg_c = 0; + +/* Quick Hack: ------------------------------------------------------------ */ +#define SUBDIRS /* Rekursive Suche durch das */ + /* Filesystem moeglich */ +#define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ + +static char filenm [66]; + +#ifdef SUBDIRS +/* Where to search: recursion through directory tree: --------------------- */ +static char actual_filenm [128]; +static char actual_drive [ 2]; +static char actual_path [128]; +static char actual_pattern [ 30]; +static int subdirs = 0; +#endif + +/* ------------------------------------------------------------------------ */ +static int verbose_mode = 0; + +static FILE *out_file = (FILE *) 0; +static int out_open = 0; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: sgmlproc [options] {file name}\n", + "OPTIONS: -f<filename> ... List of Files\n", +#ifdef SUBDIRS + " -s -r ... Subdirs\n", +#endif + " -v ... Verbose Mode\n", + "EXAMPLES: \n", + "\n", + "(@)Asgmlproc.c 1.11 #D$1994-06-04 16:00:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + + if (argc <= 1) goto HLP; + + for (i = 1; i < argc; i++) + if (argv [i][0] == '-' || argv [i][0] == '/') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': +#endif + case 'v': case 'V': + for (j=1; argv [i][j]; j++) + switch (argv [i][j]) + { +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': + subdirs = 1; + break; +#endif + case 'v': case 'V': + verbose_mode = 1; + break; + } + break; + +HLP: +#include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + if ((out_file= fopen ("SGML.@@", "wb")) != (FILE *) 0) out_open = 1; + + if (arg_c) + for (i = 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if (access (& arg_v [i][2], 0) != 0) + { fprintf (stderr, "File %s not found!\n", + &arg_v [i][2]); + break; + } + fi2 = fopen (& arg_v [i][2], "rt"); + for (;;) + { fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; +#ifdef SUBDIRS + if (wildcards_or_rec (filenm) == -1) + { + fclose (fi2); + goto STOP; + } +#else + wildcards (filenm); +#endif + } + fclose (fi2); + } +#ifdef SUBDIRS + else { if (wildcards_or_rec (arg_v [i]) == -1) goto STOP; } + else wildcards_or_rec ("*.*"); +#else + else wildcards (arg_v [i]); + else sgml_process ("Default.fil"); +#endif + + flush_segments (); + +STOP: + if (out_open) fclose (out_file); + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef SUBDIRS +static rec_wildcards (int lev) +{ + struct dta_buff l_dta; + int actual_path_length; + int look; + + Fsetdta (&l_dta); + +/* fprintf (stderr, "%2d RC1: actual_path=%s\n", lev, actual_path); */ + actual_path_length = strlen (actual_path); + if (actual_path_length) + sprintf (actual_filenm, "%s\\%s", actual_path, actual_pattern); + else sprintf (actual_filenm, "%s", actual_pattern); + if (wildcards (actual_filenm) == -1) return -1; + + if (actual_path_length) + sprintf (actual_filenm, "%s\\*.*", actual_path); + else strcpy (actual_filenm, "*.*"); + + Fsetdta (&l_dta); + for (look=Fsfirst (actual_filenm, 0x10); + !look; + look=Fsnext ()) + { + if ((l_dta.att & 0x10) == 0 || + strcmp (l_dta.name, ".") == 0 || + strcmp (l_dta.name, "..") == 0) + continue; + if (actual_path_length) + sprintf (& actual_path [actual_path_length], "\\%s", l_dta.name); + else sprintf (& actual_path [actual_path_length], "%s", l_dta.name); + if (rec_wildcards (lev+1) == -1) return -1; + Fsetdta (&l_dta); + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +wildcards_or_rec (char *fn) +{ + int i; + int drive_letter, path_length; + + if (subdirs) + { + for (i=strlen (fn) -1; i >= 0; i--) + if (fn [i] == '\\' || fn [i] == ':') break; + strcpy (actual_path, fn); + if (i>=0) + if (actual_path [i] == ':') + actual_path [i+1]= 0; + else actual_path [i ]= 0; + else actual_path [ 0]= 0; + strcpy (actual_pattern, &fn [i+1]); + if (actual_pattern [0] == 0) + strcpy (actual_pattern, "*.*"); + path_length = strlen (actual_path); + if (actual_path [1] == ':' && actual_path [0] == '*') + { + i = bdos (0x19, 0x00, 0x00); /* aktuelles Drive ermitteln */ + drive_letter = bdos (0x0E, i, 0x00) & 0x00FF; + drive_letter += 'A'; i &= 0x00FF; + for (i = (i >= 2) ? 'C' : i+'A' ; + i < drive_letter; + i++) + { + actual_path [0] = i; + if (rec_wildcards (1) == -1) return -1; + actual_path [path_length] = 0; + } + } + else { + if (rec_wildcards (1) == -1) return -1; + } + } + else { + path_length = strlen (fn); + if (fn [1] == ':' && fn [0] == '*') + { + i = bdos (0x19, 0x00, 0x00); /* aktuelles Drive ermitteln */ + drive_letter = bdos (0x0E, i, 0x00) & 0x00FF; + drive_letter += 'A'; i &= 0x00FF; + for (i = (i >= 2) ? 'C' : i+'A' ; + i < drive_letter; + i++) + { + fn [0] = i; + if (wildcards (fn) == -1) return -1; + fn [path_length] = 0; + } + } + else { + if (wildcards (fn) == -1) return -1; + } + } + return 0; +} +#endif + +/* ------------------------------------------------------------------------ */ +wildcards (char *fn) +{ + char *nm; + int wild=0; + + for (nm=fn; *nm && !wild; nm++) + if (*nm == '*' || *nm == '?') wild=1; + + if (wild) + { +#ifdef BETTER_FILENAME_MATCH + to_upper (fn); + while ((nm=Fname_find ("*.*", FA_FILE)) != (char *) 0) + if (match (fn, nm) > 0) sgml_process (nm); +#else + while ((nm=Fname_find (fn, FA_FILE)) != (char *) 0) + sgml_process (nm); +#endif + } + else sgml_process (fn); +} + +/* ------------------------------------------------------------------------ */ +sgml_process (char *fn) +{ + FILE *fi; + int ch; + + if (access (fn, 0) != 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -2; + } + + sgml_to_list (fn); +} + +/* ------------------------------------------------------------------------ */ +sgml_fputs (char *s) { if (out_open) fputs (s, out_file); } +sgml_fputc (int c) { if (out_open) fputc (c, out_file); } diff --git a/app/sgml/sgmlt1.c b/app/sgml/sgmlt1.c new file mode 100644 index 0000000000000000000000000000000000000000..1184f8fdaad1091c629d0259e907b9ae3029005e --- /dev/null +++ b/app/sgml/sgmlt1.c @@ -0,0 +1,191 @@ +/* + * FILE E:\usr\sgml\sgmlt1.c + * + * Convert SGML-Document into Text and NED-Feature files + * + * 1990 01 28 + * + */ + +# include <stdio.h> +# include <gg/fnames.h> + + +# define STDHLP stderr +# define ARG_C_max 24 +static char *arg_v [ARG_C_max]; +static int arg_c = 0; + +static char filenm [64]; + +static int line_nr=1, column=0; + +static FILE *f_out; +static long f_position=0L; + + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ "USAGE: SGMLT1 [options] {file name}\n", + "OPTIONS: -f<filename> ... List of Files\n", + "EXAMPLES: \n", + "\n", + "Converts SGML Document into Text with NED-Feature Files\n", + "\n", + "(@)ASGML2NED.c 0.0 #D$1989-02-14 15:45:00\n", + "\n", +# include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +main (argc, argv) +int argc; +char *argv []; +{ FILE *fi2; + int i, j; + int sgml_filter_tag_beg (), x_tag_beg (), + sgml_filter_tag_end (), x_tag_end (), + sgml_filter_tag_chr (), x_tag_chr (), + sgml_filter_com_beg (), + sgml_filter_com_end (), + sgml_filter_com_chr (), + sgml_filter_chr (), x_out_char(); + + patch (sgml_filter_tag_beg, x_tag_beg); + patch (sgml_filter_tag_end, x_tag_end); + patch (sgml_filter_tag_chr, x_tag_chr); +/*patch (sgml_filter_com_beg, x_tag_beg); + patch (sgml_filter_com_end, x_tag_end); + patch (sgml_filter_com_chr, x_tag_chr);*/ + patch (sgml_filter_chr, x_out_char); + sgml_filter_reset (); + + if (argc <= 1) goto HLP; + for (i = 1; i < argc; i++) + if (argv [i][0] == '-' || argv [i][0] == '/') + switch (argv [i][1]) + { case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + + case 'a': case 'A': +HLP: +# include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + f_out = stdout; + + if (arg_c) + for (i = 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if (access (& arg_v [i][2], 0) != 0) + { fprintf (stderr, "File %s not found!\n", + &arg_v [i][2]); + break; + } + fi2 = fopen (& arg_v [i][2], "rt"); + for (;;) + { fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; + wildcards (filenm); + } + fclose (fi2); + } + else wildcards (arg_v [i]); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +wildcards (fn) +char *fn; +{ char *nm; int wild=0; + for (nm=fn; *nm && !wild; nm++) + if (*nm == '*' || *nm == '?') wild=1; + if (wild) + while ((nm=Fname_find (fn, FA_FILE)) != (char *) 0) + sgml_to_ned (nm); + else sgml_to_ned (fn); +} + +/* ------------------------------------------------------------------------ */ +sgml_to_ned (fn) +char *fn; +{ FILE *fi; + int ch; + + f_position=0L; + + if (access (fn, 0) != 0) + { fprintf (stderr, "File %s not found!\n", fn); + return -1; + } + fi = fopen (fn, "rb"); + for (;;) + { + ch = fgetc (fi) & 0x00FF; + if (feof (fi)) break; + sgml_filter (ch); + f_position++; + } + fclose (fi); +} + +/* ------------------------------------------------------------------------ */ +x_out_char (ch) +int ch; +{ + if (ch == 0x0D) return; + fputc (ch, f_out); column++; + if (ch == 0x0A) + { + line_nr++; + column = 0; + } +} + +/* ------------------------------------------------------------------------ */ +static char tag_name [40]; +static int tag_lng; +static int tag_type; + +x_tag_beg () +{ + fprintf (f_out, "[%d %d tag beg]\n", line_nr, column); + column++; + tag_lng=0; + tag_type=0; +} + +x_tag_end () +{ + fprintf (f_out, + "[%d %d tag end; type=%d lng=%d]\n", + line_nr, column, tag_type, tag_lng); +} + +x_tag_chr (ch) +int ch; +{ + if (tag_lng == 0) + switch (ch) + { + case '/': tag_type = 1; break; + case '!': tag_type = 2; break; + default : tag_lng++; break; + } + else tag_lng++; + + switch (ch) + { + case 0x0D: fputc ('\\', f_out); fputc ('D', f_out); break; + case 0x0A: fputc ('\\', f_out); fputc ('A', f_out); break; + case '\\': fputc ('\\', f_out); fputc ('\\', f_out); break; + default : fputc (ch, f_out); break; + } +} diff --git a/app/sgml/sgmlt2.c b/app/sgml/sgmlt2.c new file mode 100644 index 0000000000000000000000000000000000000000..b512f7a86823462d564eea8bbf852e14826dbd91 --- /dev/null +++ b/app/sgml/sgmlt2.c @@ -0,0 +1,138 @@ +/* + * FILE XXXX.c + * + * + * 1988 11 17 + * + */ + +# include <stdio.h> +# include <gg/fnames.h> + + +# define STDHLP stderr +# define ARG_C_max 24 +static char *arg_v [ARG_C_max]; +static int arg_c = 0; + +# define XXXX xxxx /* Name der Programmfunktion */ + +static char filenm [64]; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ "USAGE: XXXX [options] {file name}\n", + "OPTIONS: -f<filename> ... List of Files\n", + "EXAMPLES: \n", + "\n", + "(@)AXXXX.c 0.0 #D$1989-02-14 15:45:00\n", + "\n", +# include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +main (argc, argv) +int argc; +char *argv []; +{ FILE *fi2; + int i, j; + int sgml_filter_tag_beg (), xsgml_tag_begin (), + sgml_filter_tag_end (), xsgml_tag_end (), + sgml_filter_tag_chr (), + sgml_filter_chr (), xout_char (); + + patch (sgml_filter_tag_beg, xsgml_tag_begin); + patch (sgml_filter_tag_end, xsgml_tag_end); + patch (sgml_filter_tag_chr, xout_char); + patch (sgml_filter_chr, xout_char); + sgml_filter_reset (); + + if (argc <= 1) goto HLP; + for (i = 1; i < argc; i++) + if (argv [i][0] == '-' || argv [i][0] == '/') + switch (argv [i][1]) + { case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + + case 'a': case 'A': +HLP: +# include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + if (arg_c) + for (i = 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if (access (& arg_v [i][2], 0) != 0) + { fprintf (stderr, "File %s not found!\n", + &arg_v [i][2]); + break; + } + fi2 = fopen (& arg_v [i][2], "rt"); + for (;;) + { fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; + wildcards (filenm); + } + fclose (fi2); + } + else wildcards (arg_v [i]); + else XXXX ("Default.fil"); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +wildcards (fn) +char *fn; +{ char *nm; int wild=0; + for (nm=fn; *nm && !wild; nm++) + if (*nm == '*' || *nm == '?') wild=1; + if (wild) + while ((nm=Fname_find (fn, FA_FILE)) != (char *) 0) + XXXX (nm); + else XXXX (fn); +} + +/* ------------------------------------------------------------------------ */ +XXXX (fn) +char *fn; +{ FILE *fi; + int ch; + + if (access (fn, 0) != 0) + { fprintf (stderr, "File %s not found!\n", fn); + return -1; + } + fi = fopen (fn, "rt"); + for (;;) + { ch = fgetc (fi) & 0x00FF; + if (feof (fi)) break; + sgml_filter (ch); + } + fclose (fi); +} + +/* ------------------------------------------------------------------------ */ + +xout_char (ch) +int ch; +{ + fputc (ch, stdout); +} + +xsgml_tag_begin () +{ + printf ("�"); +} + +xsgml_tag_end () +{ + printf ("�"); +} + diff --git a/app/sgml/tags.awk b/app/sgml/tags.awk new file mode 100644 index 0000000000000000000000000000000000000000..31c4ade7f9f5b81a066bbd3641b851aefc36e959 --- /dev/null +++ b/app/sgml/tags.awk @@ -0,0 +1,57 @@ +# File TAGS.AWK +# Ausgabe von Tags, die in einen File vorkommen. +BEGIN { + FS="<"; + fnm="" + aktframe=""; + aktfrprt=0; +} +/\\ref{/ { report("REF: ") } +/\\label{/ { report("LABEL: ") } +/{figure}/ { report("FIGURE: ") } +/{table}/ { report("TABLE: ") } +/\\glqq/ { report("GLQQ: ") } +/\\grqq/ { report("GRQQ: ") } +# FILENAME!=fnm { +# if (fnm!="") showtags(); +# print "** FILE " FILENAME " ***************" +# fnm=FILENAME +# } + { + x=y=$0; + if (sub("<","",y) != sub(">","",y)) + { + print "* ACHTUNG: Tag open != Tag close in File "FILENAME" Zeile "FNR + print "* "$0 + } + for (i=1;i<=NF;i++) { + x=y=$(i); + if (x!="" && sub(">","",y)>0) { + spi=split (x, sp, ">"); + if (spi >= 1) { + if (substr(sp[1],1,1)==":") sp[1]=":..."; + if (substr(sp[1],1,2)=="--") sp[1]="--...--"; + if (substr(sp[1],1,6)=="Frame ") { + aktframe=sp[1]; + aktfrprt=0; + sp[1]="Frame ..."; + } + if (substr(sp[1],1,6)=="stamp ") sp[1]="stamp ..."; + if (substr(sp[1],1,6)=="HLINK ") sp[1]="HLINK ..."; +# if (substr(sp[1],1,5)=="Link ") sp[1]="Link ..."; + tag[sp[1]]++; + } + } + } +} +END { showtags() } + +function showtags() { + for (t in tag) printf ("%5d <%s>\n", tag[t], t); +} + +function report(s) { + if (aktfrprt==0) print "\n"s" ## <"aktframe">" + aktfrprt=1; + print s" -- " $0 +} diff --git a/app/sgml/translit b/app/sgml/translit new file mode 100755 index 0000000000000000000000000000000000000000..bc4ef5fd9e13e054d7f8c9b311e2a5a2cd129222 Binary files /dev/null and b/app/sgml/translit differ diff --git a/app/sgml/translit.c b/app/sgml/translit.c new file mode 100644 index 0000000000000000000000000000000000000000..943bc029452084f200d8594e729499c9ec553fd9 --- /dev/null +++ b/app/sgml/translit.c @@ -0,0 +1,794 @@ +/* + * FILE %usr/utl/translit.c + * + * Zeichensatzumwandlung und Textdecodierung (Umlaute usw.) + * - prototypes + * - VERSION + * - HELP + * + * written: 1987 12 01 + * 1990 01 25: Wildcards + * 1991 02 12: Revision + * 1992 08 30: revision + * latest update: 1999-04-25 16:41:22 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/dpp.h> +#include <gg/filename.h> +#include <gg/convent.h> +#include <gg/codes.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#include <conio.h> +#include <io.h> +#define EXTRA_BUFFERS +#define FNM_LENGTH 66 +#else +#include <unistd.h> +#define FNM_LENGTH 4096 +#endif + +#define REAL_AUTHOR +#define STDHLP stderr +#define TMP "tmptmp.tmp" + +static char TEMP [FNM_LENGTH]; +static char filenm [FNM_LENGTH]; + +#ifdef EXTRA_BUFFERS +#define BUF_SIZE 0x7000 +static char *buf1= (char *) 0, *buf2= (char *) 0; +#endif + +/* ------------------------------------------------------------------------ */ +#define mSTR 8196 /* Groesse des Stringpuffers */ + +#define MAP_copy 0 /* -> Zeichen kopieren */ +#define MAP_delete 1 /* -> Zeichen loeschen */ +#define MAP_translate 2 /* -> Zeichen umwandeln */ +#define MAP_string 3 /* -> Zeichen durch String ersetzen */ +#define MAP_rle 4 /* Zaehler */ +#define MAP_rle2 5 /* Zaehler */ + +/* ------------------------------------------------------------------------ */ +static char maptable [ 256]; +static char transtable [ 256]; +static char stringlng [ 256]; +static char stringpuffer [mSTR]; +static int stringptr= 0; +static int escape_char= ':'; /* Decodierung */ +static int output_file= 0; /* 1 -> Output File umbenennen */ +static char *output; /* Name des Output Files */ + +static int kroemer_code= 0x07; + +/* ------------------------------------------------------------------------ */ +static int verbose_mode= 0; +static int mode= 0; + +/* SGML entity transaltion level */ +static int entity_level= CONVENT_amp|CONVENT_lt_gt; +static char *code_set_files= CSF_PC_STRINGS; +static struct CS_ET8 *et8= (struct CS_ET8 *) 0; + +/* ------------------------------------------------------------------------ */ +static char VERSION []= "(@)Atranslit.c 1.24 #D$1997-10-24 13:57:47\n"; + +static char *HELP [] = +{ + "USAGE: translit [-Opt] <Filename>\n", + "OPTIONS:\n", + " -f<fnm> ... list of files\n", + " -o<fnm> ... output to file\n", + " -d<n> ... default table <n> (see below)\n", + " -k<x> ... kroemer code [DEF: 0x08] (implies -d4)\n", + " -v ... verbose mode\n", + " -t[<fnm>] ... specify translation table (DEF: translit.tbl)\n", + " -e[<c>] ... escape: <c> as escape character for decoding\n", +#ifdef MSDOS + " -r ... recursion through subdirectories\n", +#endif + " -s[<x>*] ... apply SGML entity conversion; [DEF: &<>]\n", + " & ... convert &\n", + " ! ... convert < and >\n", + " 8 ... convert chars >= 128 according to the codes set (flag -c)\n", + " -c<set> ... setup codes set\n", + " i ... ISO 8859-1\n", + " p ... PC Code Page 437 [DEFAULT]\n", + "\n", + "Commands in TRANSLIT.TBL:\n", + " @translate ... translate code-pairs\n", + " @delete ... codes to delete\n", + " @string ... translate code to codes sequences\n", + " @default0 ... default table 0: don't change anything [Default-Default :-) ]\n", + " @default1 ... default table 1\n", + " @default2 ... default table 2: mask bit 7 + delete control chars\n", + " @default3 ... default table 3: mask bit 7\n", + " @end ... end of translit table\n", + " -d4 ... kroemer\n", + " # ... comment\n", + "\n", + VERSION, + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl translit_or_escape (char *fn, void *cd); +int cdecl translit (char *fnm); +int cdecl escape (char *fnm); +int cdecl entities (char *fnm); +int cdecl read_table (char *fnm); +int cdecl get_keyval (char *s, int *i); +void cdecl default0 (void); +void cdecl default1 (void); +void cdecl default2 (void); +void cdecl default3 (void); +void cdecl kroemer (void); +void cdecl default_escape (void); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + char *arg; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) return 1; + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, + translit_or_escape, (void *) 0); + + default0 (); + + if (strstr (argv [0], "iso2html") == (char *) 0) + { + mode= 3; + output= "-"; + output_file= 1; + code_set_files= CSF_8859_1_STRINGS; + entity_level |= CONVENT_8bit; + } + +#ifdef JUNK + if (strstr (argv [0], "translit") == (char *) 0) + { + read_table (argv [0]); + mode= 1; + } +#endif + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'c': case 'C': + switch (arg [2]) + { + case 'i': case 'I': + code_set_files= CSF_8859_1_STRINGS; + break; + default: + code_set_files= CSF_PC_STRINGS; + break; + } + break; + + case 'd': case 'D': + switch (arg [2]) + { + case '0': default0 (); break; + case '1': default1 (); break; + case '2': default2 (); break; + case '3': default3 (); break; + case '4': kroemer (); break; + } + mode= 1; + break; + + case 'e': case 'E': + mode= 2; + if (arg [2]) escape_char = arg [2]; + break; + + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + + case 'k': case 'K': + kroemer_code= (int) get_parameter_value (arg +2); + kroemer (); + break; + + case 's': case 'S': + mode= 3; + if (!arg [2]) break; + entity_level= 0; + for (j= 2; arg [j]; j++) + { + switch (arg [j]) + { + case '&': entity_level |= CONVENT_amp; break; + case '!': entity_level |= CONVENT_lt_gt; break; + case '8': entity_level |= CONVENT_8bit; break; + } + } + break; + + case 'o': case 'O': + output_file= 0; + if (arg [2] == 0) break; + output= arg+2; + output_file= 1; + break; + + case 't': case 'T': /* Translation Table */ + if (arg [2] == 0) arg= argv [++i]; + read_table (arg+2); + mode= 1; + break; + + case 'v': case 'V': + case 'r': case 'R': + for (j= 1; arg [j]; j++) + switch (arg [j]) + { + case 'r': case 'R': + wcrd2_set_subdirs (wcrd, 1); + break; + case 'v': case 'V': + verbose_mode++; + break; + } + break; + +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + +#ifdef EXTRA_BUFFERS + buf1= malloc (BUF_SIZE); + buf2= malloc (BUF_SIZE); +#endif + + fprintf (stderr, VERSION); + + wcrd2_arguments (wcrd, arguments); + + cs_et8_destroy_table (et8); /* JFF */ + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int translit_or_escape (char *fn, void *cd) +{ + int rv= 0; + +#ifdef MSDOS + cd; +#endif + + if (fn [1] == ':') + sprintf (TEMP, "%c:%s", fn [0], TMP); + else strcpy (TEMP, TMP); + + switch (mode) + { + case 1: rv= translit (fn); break; + case 2: rv= escape (fn); break; + case 3: rv= entities (fn); break; + default: fprintf (stderr, "Huh?? What shall I do with %s?\n", fn); break; + } + + return rv; +} + +/* ------------------------------------------------------------------------ */ +int translit (char *fnm) +{ + int i; + int ch= 0; + long cnt1, cnt2, cnt3; + FILE *fi, *fo; + int rle_counter= 0; + int to_read= 1; + + if ((fi= fopen (fnm, "rb")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", fnm); + return -1; + } + + if (output_file && strcmp (output, "-") == 0) + { + fo= stdout; + } + else + { + if ((fo= fopen ((output_file) ? output : TEMP, "wb")) == (FILE *) 0) + { + fprintf (stderr, "Output file %s not opened!\n", + (output_file) ? output : TEMP); + } + } + fprintf (stderr, "%s -> %s\n", fnm, (output_file) ? output : TEMP); + +#ifdef EXTRA_BUFFERS + setvbuf (fi, buf1, _IOFBF, BUF_SIZE); + setvbuf (fo, buf2, _IOFBF, BUF_SIZE); + fprintf (stderr, "setvbuf: %d bytes each\n", BUF_SIZE); +#endif + + cnt1= cnt2= cnt3= (long) 0; + for (;;) + { + if (to_read) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + ch &= 0x00FF; + } + else + { + if (--rle_counter == 0) to_read= 1; + } + if (rle_counter > 0) to_read= 0; + + cnt1++; + if (verbose_mode > 0 && (cnt1%1000) == 0) + fprintf (stderr, "%ld\r", cnt1); + + switch (maptable [ch]) + { + case MAP_copy: + fputc (ch, fo); + cnt3++; + break; + case MAP_translate: + fputc (transtable [ch], fo); + cnt3++; + case MAP_delete: + break; + case MAP_string: + for (i= 0; i < stringlng [ch]; i++) + { + fputc (stringpuffer [transtable [ch] + i], fo); + cnt3++; + } + break; + + case MAP_rle: + rle_counter= ch-1; + to_read= 1; + break; + case MAP_rle2: + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + ch &= 0x00FF; + rle_counter= transtable [ch]; + to_read= 1; + break; + default: + break; + } + } + fclose (fi); + if (!(output_file && strcmp (output, "-") == 0)) fclose (fo); + if (verbose_mode > 0) fprintf (stderr, "%ld\r", cnt1); + + if (output_file) + { + output_file = 0; + fprintf (stderr, "File %s -> %s Translit: %8ld Char -> %8ld Char\n", + fnm, output, cnt1, cnt3); + } + else + { + unlink (fnm); + rename (TEMP, fnm); + fprintf (stderr, "File %s Translit: %8ld Char -> %8ld Char\n", + fnm, cnt1, cnt3); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int escape (char *fnm) +{ + int ch; + int esc_mode= 0; + int code_value= 0; + long cnt1, cnt2, cnt3; + FILE *fi, *fo; + + if ((fi= fopen (fnm, "rb")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", fnm); + return -1; + } + + if ((fo= fopen ((output_file) ? output : TEMP, "wb")) == (FILE *) 0) + { + fprintf (stderr, "Output file %s not opened!\n", + (output_file) ? output : TEMP); + } + + cnt1= cnt2= cnt3= (long) 0; + for (;;) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + ch &= 0x00FF; + cnt1++; + + switch (esc_mode) + { + case 0: + if (ch == escape_char) esc_mode = 1; + else + { + fputc (ch, fo); + cnt3++; + } + break; + case 1: + esc_mode = 0; + switch (ch) + { + /* x45 */ case 'E': ch = 0x1B; break; + /* x4C */ case 'L': ch = 0x0C; break; + /* x5A */ case 'Z': ch = 0x1A; break; + /* x73 */ case 's': ch = 0xE1; break; + /* x61 */ case 'a': ch = 0x84; break; + /* x41 */ case 'A': ch = 0x8E; break; + /* x6F */ case 'o': ch = 0x94; break; + /* x4F */ case 'O': ch = 0x99; break; + /* x75 */ case 'u': ch = 0x81; break; + /* x55 */ case 'U': ch = 0x9A; break; + /* x52 */ case 'R': ch = 0x21; break; + /* x78 */ case 'x': + ch= -1; + code_value= 0; + esc_mode= 2; /* Zeichencode */ + break; + } + if (ch < 0) break; + fputc (ch, fo); + cnt3++; + break; + case 2: /* Zeichencode: genau 2 HEX-Ziffern */ + esc_mode = 3; + if (ch >= '0' && ch <= '9') code_value= ch -'0'; else + if (ch >= 'a' && ch <= 'f') code_value= ch -'a'+10; else + if (ch >= 'A' && ch <= 'F') code_value= ch -'A'+10; else + esc_mode = 0; + break; + case 3: /* Zeichencode: letzte HEX-Ziffer */ + esc_mode= 0; + if (ch >= '0' && ch <= '9') + code_value= 16*code_value + ch -'0'; else + if (ch >= 'a' && ch <= 'f') + code_value= 16*code_value + ch -'a'+10; else + if (ch >= 'A' && ch <= 'F') + code_value= 16*code_value + ch -'A'+10; else break; + fputc (code_value, fo); + cnt3++; + break; + } + } + fclose (fi); + fclose (fo); + if (output_file) + { + output_file = 0; + fprintf (stderr, "File %s -> %s Escape: %8ld Char -> %8ld Char\n", + fnm, output, cnt1, cnt3); + } + else + { + unlink (fnm); + rename (TEMP, fnm); + fprintf (stderr, "File %s Escape: %8ld Char -> %8ld Char\n", + fnm, cnt1, cnt3); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int entities (char *fnm) +{ + int rc; + char *out_name; + + out_name= (output_file) ? output : TEMP; + + if (entity_level & CONVENT_8bit) + { + char *csfnm; + + if (et8 == (struct CS_ET8 *) 0) + { + fprintf (stderr, "creating entity translation table '%s'\n", + code_set_files); + + if ((et8= cs_et8_create_table (0L, + csfnm= set_etc_filename ((char *) 0, + code_set_files), + (char *) 0, (char *) 0)) + == (struct CS_ET8 *) 0) + { + fprintf (stderr, "could not create entity translation table!\n"); + return -1; + } + + free (csfnm); + } + + rc= (cs_et8_encode (et8, fnm, out_name, 0x7FFFFFFFL) < 0L) ? -1 : 0; + } + else + { + rc= sgml_entity_conversion (fnm, out_name, entity_level); + } + + if (rc == -1) + { + fprintf (stderr, "Error processing file %s!\n", fnm); + return -1; + } + + if (output_file) + { + output_file = 0; + fprintf (stderr, "File %s -> %s SGML Entities\n", fnm, output); + } + else + { + unlink (fnm); + rename (TEMP, fnm); + fprintf (stderr, "File %s SGML Entities\n", fnm); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int read_table (char *fnm) +{ + FILE *fi; + int state= 0; + int val1= 0; + int val2; + int i; + int j; + int j2; + char puffer [80]; + char *app; + char *tmp; + + tmp= getenv ("TMP"); + + if (access (fnm, 0) == 0) + { + app= fnm; + goto DOIT; + } + + if (fnm [0] == '%' || fnm [0] == '~') + { + app= translate_logic_filename (fnm); + goto DOIT; + } + + if ((app= env_file_search (fnm, "APPEND")) != (char *) 0 + || (app= env_file_search (fnm, "AWK")) != (char *) 0 + || (app= env_file_search (fnm, "PATH")) != (char *) 0 + ) goto DOIT; + + return 0; + +DOIT: + printf ("table=%s\n", app); + if ((fi= fopen (app, "rt")) == (FILE *) 0) + { + fprintf (stderr, "Translit Table %s not found!\n", fnm); + return -1; + } + + for (;;) + { + fscanf (fi, "%s", puffer); + if (feof (fi)) break; + + j= 0; + if (strncmp (puffer, "#", 1) == 0) + { + for (;;) + { + i= fgetc (fi) & 0x00FF; + if (i == '\n') break; + } + continue; + } + + if (strcmp (puffer, "@translate") == 0) state= 1; else + if (strcmp (puffer, "@delete") == 0) state= 3; else + if (strcmp (puffer, "@string") == 0) state= 4; else + if (strcmp (puffer, "@end") == 0) break; else + if (strcmp (puffer, "@default0") == 0) default0 (); else + if (strcmp (puffer, "@default1") == 0) default1 (); else + if (strcmp (puffer, "@default2") == 0) default2 (); else + if (strcmp (puffer, "@default3") == 0) default3 (); else + if (strcmp (puffer, "@kroemer") == 0) kroemer (); + else + switch (state) + { + case 1: + val1= get_keyval (puffer, &j); + state= 2; + break; + case 2: + val2= get_keyval (puffer, &j); + state= 1; + maptable [val1] = MAP_translate; + transtable [val1] = (char) val2; + break; + + case 3: + val1= get_keyval (puffer, &j); + maptable [val1] = MAP_delete; + break; + + case 4: + val1= get_keyval (puffer, &j); + state= 5; + break; + + case 5: + state= 4; + maptable [val1] = MAP_string; + transtable [val1] = (char) stringptr; + j2= 0; + for (i= 0;; i++) + { + val2= get_keyval (puffer, &j); + if (j == j2) break; j2 = j; + stringpuffer [stringptr++] = (char) val2; + } + stringlng [val1] = (char) i; + break; + } + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int get_keyval (char *s, int *i) +{ + int v= 0; + int b= 10; + int si; + + for (; (si= s [*i] & 0x00FF) != 0; (*i)++) + { + switch (si) + { + case '\'': + if (!v) + { + (*i)++; + return s [(*i)++]; + } + return v; + case 'x' : + case 'X' : + if (v == 0) b= 16; + else return v; + break; +/* case ',' : (*i)++; return v; */ + default : + /* if (cf) return si; */ + if (si >= '0' && si <= '9') v= v*b + si - '0' ; else + if (si >= 'a' && si <= 'f' && b == 16) v= v*b + si - 'a' + 10; else + if (si >= 'A' && si <= 'F' && b == 16) v= v*b + si - 'A' + 10; else + return v; + } + } + return v; +} + +/* Default 0: do not change anything -------------------------------------- */ +void default0 () +{ + int i; + + for (i = 0; i < 256; i++) maptable [i] = MAP_copy; +} + +/* Default 1: Characters �ber 127 und Control Chars l�schen --------------- */ +void default1 () +{ + int i; + + for (i = 0; i < 32; i++) + maptable [i] = MAP_delete; + for ( ; i < 127; i++) + maptable [i] = MAP_copy; + for ( ; i < 256; i++) + maptable [i] = MAP_delete; + maptable [0x0A] = + maptable [0x0D] = MAP_copy; +} + +/* Default 2: Bit 7 l�schen und Control Chars l�schen --------------------- */ +void default2 () +{ + int i; + + for (i = 0; i < 32; i++) maptable [i] = MAP_delete; + for ( ; i < 127; i++) maptable [i] = MAP_copy; + for ( ; i < 160; i++) maptable [i] = MAP_delete; + for ( ; i < 256; i++) + { + maptable [i] = MAP_translate; + transtable [i] = (char) (i - 128); + } + maptable [0x0A] = + maptable [0x0D] = MAP_copy; +} + +/* Default 3: mask bit 7 -------------------------------------------------- */ +void default3 () +{ + int i; + + for (i = 0; i < 128; i++) maptable [i] = MAP_copy; + for ( ; i < 256; i++) + { + maptable [i] = MAP_translate; + transtable [i] = (char) i - 128; + } +} + +/* kroemer: --------------------------------------------------------------- */ +void kroemer () +{ + int i; + + for (i= 0x00; i < 0x20; i++) maptable [i]= MAP_rle; + + for (i= 0x20; i < 256; i++) + { + maptable [i] = MAP_translate; + transtable [i] = (char) (kroemer_code - i) & 0x00FF; + } + maptable [0x0002]= MAP_rle2; + maptable [0x00FF]= MAP_translate; + transtable [0x00FF]= 0x0A; +} + +/* ------------------------------------------------------------------------ */ +void default_escape () +{ +} diff --git a/app/sgml/translit.o b/app/sgml/translit.o new file mode 100644 index 0000000000000000000000000000000000000000..e2a05be40f2278234adebbd4c3cfe08d75ada6b4 Binary files /dev/null and b/app/sgml/translit.o differ diff --git a/homepage/htdocs/index.php b/homepage/htdocs/index.php new file mode 100644 index 0000000000000000000000000000000000000000..da69004d684349e500972b7787ca09be4f3a859a --- /dev/null +++ b/homepage/htdocs/index.php @@ -0,0 +1,70 @@ +<?php +// Default Web Page for groups that haven't setup their page yet +// Please replace this file with your own website +// +// $Id: index.php,v 1.2 2004/05/19 12:45:31 gonter Exp $ +// +$headers = getallheaders(); +?> +<HTML> +<HEAD> +<TITLE>SourceForge: Welcome</TITLE> +<LINK rel="stylesheet" href="http://sourceforge.net/sourceforge.css" type="text/css"> +</HEAD> + +<BODY bgcolor=#FFFFFF topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" marginheight="0" marginwidth="0"> + +<!-- top strip --> +<TABLE width="100%" border=0 cellspacing=0 cellpadding=2 bgcolor="737b9c"> + <TR> + <TD><SPAN class=maintitlebar> + <A class=maintitlebar href="http://sourceforge.net/"><B>Home</B></A> | + <A class=maintitlebar href="http://sourceforge.net/about.php"><B>About</B></A> | + <A class=maintitlebar href="http://sourceforge.net/partners.php"><B>Partners</B></a> | + <A class=maintitlebar href="http://sourceforge.net/contact.php"><B>Contact Us</B></A></SPAN></TD> + </TD> + </TR> +</TABLE> +<!-- end top strip --> + +<!-- top title table --> +<TABLE width="100%" border=0 cellspacing=0 cellpadding=0 bgcolor="" valign="center"> + <TR valign="top" bgcolor="#eeeef8"> + <TD> + <A href="http://sourceforge.net/"><IMG src="http://sourceforge.net/images/sflogo2-steel.png" vspace="0" border=0 width="143" height="70"></A> + </TD> + <TD width="99%"><!-- right of logo --> + <a href="http://www.valinux.com"><IMG src="http://sourceforge.net/images/va-btn-small-light.png" align="right" alt="VA Linux Systems" hspace="5" vspace="7" border=0 width="136" height="40"></A> + </TD><!-- right of logo --> + </TR> + <TR><TD bgcolor="#543a48" colspan=2><IMG src="http://sourceforge.net/images/blank.gif" height=2 vspace=0></TD></TR> +</TABLE> +<!-- end top title table --> + +<!-- center table --> +<TABLE width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#FFFFFF" align="center"> + <TR> + <TD> + <H1>Welcome to http://<?php print $headers[Host]; ?>/</H1> + +<ul> +<li><a href="http://sourceforge.net/projects/hyx-tools/">hyx-tools overview</a> +</ul> + + </TD> + </TR> +</TABLE> +<!-- end center table --> + +<!-- footer table --> +<TABLE width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="737b9c"> + <TR> + <TD align="center"><FONT color="#ffffff"><SPAN class="titlebar"> + All trademarks and copyrights on this page are properties of their respective owners. Forum comments are owned by the poster. The rest is copyright �1999-2000 VA Linux Systems, Inc.</SPAN></FONT> + </TD> + </TR> +</TABLE> + +<!-- end footer table --> +</BODY> +</HTML> diff --git a/lib/(dirinf).fm b/lib/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..3e4eb404bb23b293bd0f370b00744ee45753d8c5 --- /dev/null +++ b/lib/(dirinf).fm @@ -0,0 +1,19 @@ +#!/usr/local/bin/perl +# FILE .../lib/(dirinf).fm +# +# Library +# written: 1999-04-17 +# latest update: 1999-04-17 11:52:34 +# $Id: (dirinf).fm,v 1.3 2002/05/02 06:48:29 gonter Exp $ +# + +Makefile +SetupWork +libgg.a main library +contrib contributed libraries +ds data structures +include header files +sbr miscellaneous functions +window windowing functions, mostly for MSDOS + +# msdos MSDOS specific library functions \ No newline at end of file diff --git a/lib/.cvsignore b/lib/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..5f97da0ac656a8dde1e337e88bfe01cf353d37b8 --- /dev/null +++ b/lib/.cvsignore @@ -0,0 +1,5 @@ +libgg.a.i386_linux +libgg.a.i386_freebsd +libgg.a.hp800_ux100 +libgg.a.rs_aix32 +libgg.a.rs_aix42 diff --git a/lib/Makefile b/lib/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..f7b5c5cd4e382cb7caf33bcf51cb1ccd27819876 --- /dev/null +++ b/lib/Makefile @@ -0,0 +1,19 @@ +# +# $Id: Makefile,v 1.8 2007/06/10 21:10:15 gonter Exp $ +# + +all: + (cd contrib/md5 && make) + (cd ds && make) + (cd sbr/misc && make) + (cd window && make) + +all2: all + (cd ds && make all.using-tcl) + +clean: + (cd contrib/md5 && make clean) + (cd ds && make clean) + (cd sbr/misc && make clean) + (cd window && make clean) + rm -f libgg.a diff --git a/lib/SetupWork b/lib/SetupWork new file mode 100755 index 0000000000000000000000000000000000000000..7b39741bb1652c36a9325c0c21926c303e78dbbe --- /dev/null +++ b/lib/SetupWork @@ -0,0 +1,72 @@ +#!/usr/local/bin/perl +# FILE %workf/lib/./SetupWork +# +# written: 2000-01-02 +# latest update: 2000-01-02 15:51:45 +# + +my @SUBDIRS= qw( +ds/array +ds/attlist +ds/bbc +ds/cal +ds/codes +ds/dbx +ds/dyb +ds/entity +ds/ggcrypt +ds/hytxt +ds/hyxdb +ds/hyxl +ds/hyxp +ds/hyxta +ds/irdb +ds/lmd +ds/lmd5 +ds/lut +ds/lxs +ds/mail +ds/mime +ds/rdtp +ds/rtf +ds/streams +ds/strings +ds/tcl +ds/tfb +ds/url +ds/varspace +ds/vieos +ds/ytree +ds/zip +sbr/misc +window/1 +contrib/md5 +); + +my %OLD_LIST1= +( + 'include/gg' => 'gg', + 'include/contrib' => 'contrib', + 'libgg.a' => 'libgg.a', +); + +my ($sub); +foreach $sub (@SUBDIRS) +{ + &mk_links ($sub); +} +exit (0); + +sub mk_links +{ + my $dir= shift; + + my ($old, $new); + foreach $old (sort keys %OLD_LIST1) + { + $new= $OLD_LIST1{$old}; + print "ln -fs ../../$old $dir/$new\n"; + } + + print "\n"; +} diff --git a/lib/aisbr/make-dos b/lib/aisbr/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..b4b6b825a78a1b3bcbdca8976cc88144f0a295e4 --- /dev/null +++ b/lib/aisbr/make-dos @@ -0,0 +1,20 @@ +# +# FILE usr/aisbr/makefile +# +# Subroutines for AI +# +# 1991 05 01 +# +# ======================================================================== +cml=cl -Od -AL /W3 /Fo$* /c +obj=objdec -w -d -m0 -sl 2 AISBR_TEXT $*.obj +unify=unify\obj\unify +lib=c:\usr\sbr\lsbr + +library : + llink -n0 -l$(lib).lib -daisbr.mod + +unify.lbr : $(unify)001.obj $(unify)002.obj $(unify)003.obj ! + $(unify)004.obj $(unify)005.obj $(unify)006.obj ! + $(unify)007.obj $(unify)008.obj + touch unify.lbr diff --git a/lib/aisbr/unify/arge.ufy b/lib/aisbr/unify/arge.ufy new file mode 100644 index 0000000000000000000000000000000000000000..d173a2bef8e828bfbf9f433515a6c36e787204a8 --- /dev/null +++ b/lib/aisbr/unify/arge.ufy @@ -0,0 +1,168 @@ +# +# ARGE NLU +# +# 1991 05 01 +# +# ---------------------------------------------------------------------------- +rules:{ r1a r1b r1c r2a r2b r3 } + +# catrules: Verzeichnis von Rules, bei denen die angegeben Kategroie +# auf der rechten Seite der Regeln stehen. +catrules:[NP: { r1b r1c r3 } + V: { r1a r1b r1c } + DET:{ r2a } + VP: { r3 } + N: { r2a r2b }] + +lexicon:{ hans maria + kommt liebt hilft gibt + der ein mann buch } + +# +# ---------------------------------------------------------------------------- +# Rule 1: VP -> V (NP1 (NP2)) +r1a:[syn:[cat:VP + head:[agr:[gnd pers cas num]] + dtrs:[hdtr:[syn:[cat:V + head:[agr:@syn@head@agr]]] + sdtr1:[syn:[cat:NP + head:[agr:@syn@head@agr]]] + sdtr2:[syn:[cat:NP + head:[agr:@syn@head@agr]]] ]]] + +r1b:[syn:[cat:VP + head:[agr:[gnd pers cas num]] + dtrs:[hdtr:[syn:[cat:V + head:[agr:@syn@head@agr]]] + sdtr:[syn:[cat:NP + head:[agr:@syn@head@agr]]] ]]] + +r1c:[syn:[cat:VP + head:[agr:[gnd pers cas num]] + dtrs:[hdtr:[syn:[cat:V + head:[agr:@syn@head@agr]]] ]]] + +# +# ---------------------------------------------------------------------------- +# Rule 2: NP -> (Det) N +r2a:[syn:[cat:NP + head:[agr:[gnd pers cas num]] + dtrs:[hdtr:[syn:[cat:N + head:[agr:@syn@head@agr]]] + sdtr:[syn:[cat:DET + head:[agr:@syn@head@agr]]] ]]] + +r2a:[syn:[cat:NP + head:[agr:[gnd pers cas num]] + dtrs:[hdtr:[syn:[cat:N + head:[agr:@syn@head@agr]]] ]]] + +# +# ---------------------------------------------------------------------------- +# Rule 3: S -> NP VP +r3:[syn:[cat:s + head:[agr:[gnd pers cas num]] + dtrs:[hdtr:[syn:[cat:NP + head:[agr:@syn@head@agr]]] + sdtr:[syn:[cat:VP + head:[agr:@syn@head@agr]]] ]]] +# +# LEXICON: ------------------------------------------------------------------- +hans:[syn:[str:hans + nf:hans + cat:N + subcat:PN + head:[agr:[gnd:masc + pers:third + num:sing]]]] + +maria:[syn:[str:maria + nf:maria + cat:N + subcat:pn + head:[agr:[gnd:fem + pers:third + num:sing]]]] + +kommt:[syn:[str:kommt + nf:kommen + cat:V + head:[agr:[pers:third + num:sing + cas:akk]]]] + +liebt:[syn:[str:liebt + nf:lieben + cat:V + head:[agr:[pers:third + num:sing + cas:akk]]]] + +hilft:[syn:[str:hilft + nf:helfen + cat:V + head:[agr:[pers:third + num:sing + cas:akk]]]] + +gibt:[syn:[str:gibt + nf:geben + cat:V + head:[agr:[pers:third + num:sing + cas:akk]]] + semref:{geben_transfer geben_existence geben_metaphor}] + +der:[syn:[str:der + nf:der + cat:DET + subcat:def + head:[agr:[num:sing + cas:akk]]]] + +ein:[syn:[str:ein + nf:ein + cat:DET + subcat:indef + head:[agr:[num:sing + cas:akk]]]] + +mann:[syn:[str:mann + nf:mann + cat:N + head:[agr:[num:sing + gnd:masc + cas:akk]]]] + +buch:[syn:[str:buch + nf:buch + cat:N + head:[agr:[num:sing + gnd:n + cas:akk]]]] + +# +# ---------------------------------------------------------------------------- +geben_transfer:[sem:[actor_active:[cat:NP] + actor_passiv:[cat:NP] + object:[cat:NP]] + pat:[x:@sem@actor_acitve + verb:geben + y:@sem@actor_passive + z:@sem@object] ] + +geben_existence:[sem:[object:[cat:NP] + pat:[es:es + verb:geben + x:@sem@object] ] + +geben_metaphor:[sem:[actor:[cat:NP] + object:[cat:NP]] + pat:[x:@sem@actor + verb:geben + y:@sem@object]] + +kommen1:[sem:[actor:[cat NP]] + pat:[x:@sem@actor + verb:kommen]] + diff --git a/lib/aisbr/unify/make-dos b/lib/aisbr/unify/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..228509f1dc9a8719b4e959968e55536c942e46e3 --- /dev/null +++ b/lib/aisbr/unify/make-dos @@ -0,0 +1,70 @@ +# +# FILE ~/usr/aisbr/unify/makefile +# +# Subroutines for AI +# +# written: 1991 05 01 +# latest update: 1994-08-12 +# +# ======================================================================== +cml=cl -Od -AL /W3 /Fo$* /c +obj=objdec -w -d -m0 -sl 2 AISBR_TEXT $*.obj +UNIFY_H=c:\c5\include\gg\unify.h + +all.exe : library ut1.exe # ut2.exe + +library : obj\unify001.obj obj\unify002.obj obj\unify003.obj ! + obj\unify004.obj obj\unify005.obj obj\unify006.obj ! + obj\unify007.obj obj\unify008.obj +# llink -n0 -lc:\usr\sbr\ai.lib -daisbr.mod + +# test modules: -------------------------------------------------------------- +ut1.exe : obj\ut1.obj obj\unify003.obj obj\unify004.obj ! + obj\unify005.obj obj\unify006.obj obj\unify007.obj + link obj\ut1 obj\unify003 obj\unify004 obj\unify005 obj\unify006! + obj\unify007,,\dev\nul,c:\usr\sbr\lsbr/NOI/NOE; + +obj\ut1.obj : ut1.c $(UNIFY_H) + $(cml) ut1.c + +ut2.exe : obj\ut2.obj obj\unify001.obj obj\unify002.obj obj\unify003.obj ! + obj\unify004.obj obj\unify005.obj obj\unify006.obj obj\unify008.obj + link obj\ut2 obj\unify001 obj\unify002 obj\unify003 obj\unify004! + obj\unify005 obj\unify006 obj\unify008,,\dev\nul,c:\usr\sbr\lsbr/NOI/NOE; + +obj\ut2.obj : ut2.c $(UNIFY_H) + $(cml) ut2.c + +# library modules: ----------------------------------------------------------- +obj\unify001.obj : unify001.c $(UNIFY_H) + $(cml) unify001.c + $(obj) + +obj\unify002.obj : unify002.c $(UNIFY_H) + $(cml) unify002.c + $(obj) + +obj\unify003.obj : unify003.c $(UNIFY_H) + $(cml) unify003.c + $(obj) + +obj\unify004.obj : unify004.c $(UNIFY_H) + $(cml) unify004.c + $(obj) + +obj\unify005.obj : unify005.c $(UNIFY_H) + $(cml) unify005.c + $(obj) + +obj\unify006.obj : unify006.c $(UNIFY_H) + $(cml) unify006.c + $(obj) + +obj\unify007.obj : unify007.c $(UNIFY_H) + $(cml) unify007.c + $(obj) + +obj\unify008.obj : unify008.c $(UNIFY_H) + $(cml) unify008.c + $(obj) + diff --git a/lib/aisbr/unify/ned.stp b/lib/aisbr/unify/ned.stp new file mode 100644 index 0000000000000000000000000000000000000000..67e676d0c26905d216f4b4ade3c9370d538bea46 --- /dev/null +++ b/lib/aisbr/unify/ned.stp @@ -0,0 +1,3 @@ +@macro +1 ^qae:/usr/aisbr^musr/aisbr/unify^mn^m +@end diff --git a/lib/aisbr/unify/unify001.c b/lib/aisbr/unify/unify001.c new file mode 100644 index 0000000000000000000000000000000000000000..6a3fa6f2ee38aa42098f93ded6eacbdf68b006b5 --- /dev/null +++ b/lib/aisbr/unify/unify001.c @@ -0,0 +1,59 @@ +/* + * FILE ~/usr/aisbr/unify/unify001.c + * + * written: 1991 05 01 + * latest update: 1994-12-24 + * + */ + +#include <gg/unify.h> + +/* ------------------------------------------------------------------------ */ +struct FEATURE_STRUCTURE *fs_unify ( +struct FEATURE_STRUCTURE *fs1, +struct FEATURE_STRUCTURE *fs2) +{ + int sub1, sub2; + + if (fs1 == (struct FEATURE_STRUCTURE *) 0 + || fs2 == (struct FEATURE_STRUCTURE *) 0) + return (struct FEATURE_STRUCTURE *) 0; + + sub1= fs_subsumption (fs1, fs2); + sub2= fs_subsumption (fs2, fs1); + +/****************************************************************************/ +/* possible cases: */ +/* a) error */ +/* -> return empty structure */ +/* b) unimplemented types */ +/* -> return empty structure */ +/* c) conflicting values */ +/* -> return empty structure */ +/* */ +/* d) remaining forms can be unified */ +/* da) both subsumption relations hold */ +/* -> both structures are equivalent */ +/* -> return first one */ +/* db) one subsumption relation holds */ +/* -> one structure contains all information of the other one */ +/* -> return the one with all information */ +/* dc) no subsumption relation holds */ +/* -> either structure contains information which can't be found */ +/* in the other one */ +/* -> match both structures and return the matched structure */ +/****************************************************************************/ + + if ((sub1 & FS_sub_type) || (sub2 & FS_sub_type) + ||(sub1 & FS_sub_value) || (sub2 & FS_sub_value)) + return (struct FEATURE_STRUCTURE *) 0; + + if (sub1 == FS_sub_holds && sub2 == FS_sub_holds) + return fs1; + + if (sub1 == FS_sub_holds) return fs2; + if (sub2 == FS_sub_holds) return fs1; + + return fs_merge (fs1, fs2); +} + diff --git a/lib/aisbr/unify/unify002.c b/lib/aisbr/unify/unify002.c new file mode 100644 index 0000000000000000000000000000000000000000..0559e50d46052e2c71c264a0ac724dac1be3ee00 --- /dev/null +++ b/lib/aisbr/unify/unify002.c @@ -0,0 +1,94 @@ +/* + * FILE ~/usr/aisbr/unify/unify002.c + * + * written: 1991 05 01 + * latest update: 1994-08-12 + * + */ + +#include <string.h> +#include <gg/unify.h> + +/* ------------------------------------------------------------------------ */ +int fs_subsumption ( +struct FEATURE_STRUCTURE *fs1, +struct FEATURE_STRUCTURE *fs2) +/* RETURN: */ +/* bit 0 ... fs1 contains features which are not contained in fs2 */ +/* bit 1 ... fs1 and fs2 contain features which are not compatible */ +{ + struct FEATURE_STRUCTURE *fs1a; + struct FEATURE_STRUCTURE *fs2a; + int fs1a_in_fs2; + int rv=0; + int rc; + + for (fs1a = fs1; + fs1a != (struct FEATURE_STRUCTURE *) 0; + fs1a = fs1a->fs_next) + { + fs1a_in_fs2=0; + fs1a->fs_sub1=FS_sub_holds; + + for (fs2a = fs2; + fs2a != (struct FEATURE_STRUCTURE *) 0; + fs2a = fs2a->fs_next) + { + if ((fs1a->fs_head_type == FS_type_atomic + && fs2a->fs_head_type == FS_type_atomic + && fs1a->fs_head == fs2a->fs_head) + ||(fs1a->fs_head_type == FS_type_string + && fs2a->fs_head_type == FS_type_string + && strcmp ((char *) fs1a->fs_head, (char *) fs2a->fs_head) == 0)) + { + fs1a_in_fs2=1; + /* both sturctures contain the same feature */ + /* now compare values */ + if (fs1a->fs_tail_type == FS_type_atomic + && fs2a->fs_tail_type == FS_type_atomic) + { + if (fs1a->fs_tail != fs2a->fs_tail) + fs1a->fs_sub1 = FS_sub_value; + break; + } else + if (fs1a->fs_tail_type == FS_type_string + && fs2a->fs_tail_type == FS_type_string) + { + if (strcmp ((char *) fs1a->fs_tail, (char *) fs2a->fs_tail) != 0) + { + fs1a->fs_sub1 = FS_sub_value; + rv |= FS_sub_value; + } + break; + } else + if (fs1a->fs_tail_type == FS_type_feature + && fs2a->fs_tail_type == FS_type_feature) + { + rc= fs_subsumption (fs1a->fs_tail, fs2a->fs_tail); + rv |= rc; + fs1a->fs_sub1 = rc; + break; + } else + if (fs1a->fs_tail_type == FS_type_number + && fs2a->fs_tail_type == FS_type_number) + { /* numbers can be subsumed */ + break; + } else + { + rv |= FS_sub_type; + fs1a->fs_sub1 = FS_sub_type; + break; + } + } + } + + if (fs1a_in_fs2 == 0) + { /* a feature in fs1 was never found in fs2 */ + /* thus the subsumption relation does not hold */ + rv |= FS_sub_feature; + fs1a->fs_sub1= FS_sub_feature; + } + } + + return rv; +} diff --git a/lib/aisbr/unify/unify003.c b/lib/aisbr/unify/unify003.c new file mode 100644 index 0000000000000000000000000000000000000000..9176fc7434ade8c16832583e1303ada8136a1890 --- /dev/null +++ b/lib/aisbr/unify/unify003.c @@ -0,0 +1,114 @@ +/* + * FILE ~/usr/aisbr/unify/unify003.c + * + * written: 1991 05 01 + * latest update: 1994-08-12 + * + */ + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/unify.h> + +/* ------------------------------------------------------------------------ */ +int fs_print_feature_element ( +FILE *fo, +int fe_type, +struct FEATURE_STRUCTURE *fe, +struct FEATURE_STRUCTURE *root, +int indent, +int flags) +{ + int indent_plus= 0; + int mbqf; + + if (fe_type == FS_type_unknown) + fprintf (fo, "[]", fe); else + if (fe_type == FS_type_atomic) + fprintf (fo, "%08X", fe); else + if (fe_type == FS_type_string + ||fe_type == FS_type_pointer) + { + if (mbqf= fs_mbq ((char *) fe)) fputc ('\"', fo); + indent_plus= fprintf (fo, "%s", fe); + if (mbqf) fputc ('\"', fo); + } else + if (fe_type == FS_type_feature) + { + fputc ('[', fo); + fs_print_feature_structure (fo, fe, root, indent+1, flags, 1); + fputc (']', fo); + } else + if (fe_type == FS_type_set) + { + fputc ('{', fo); + fs_print_feature_structure (fo, fe, root, indent+1, flags, 1); + fputc ('}', fo); + } else + if (fe_type == FS_type_number) + { + fprintf (fo, "%ld", (long) fe); + } else fprintf (fo, "????????"); + return indent_plus; +} + +/* ------------------------------------------------------------------------ */ +int fs_print_feature_structure ( +FILE *fo, +struct FEATURE_STRUCTURE *xfs, +struct FEATURE_STRUCTURE *root, +int indent, +int flags, +int list) +{ + int item=0; + struct FEATURE_STRUCTURE *fsd; + struct FEATURE_STRUCTURE *fs; + int indent_plus=0; + int newline_flag=0; + + for (fs=xfs; fs != (struct FEATURE_STRUCTURE *) 0; fs = fs->fs_next) + if (fs->fs_tail_type == FS_type_feature + ||fs->fs_tail_type == FS_type_set) newline_flag=1; + + for (fs=xfs; fs != (struct FEATURE_STRUCTURE *) 0; fs = fs->fs_next) + { + if (item++) + { + if (newline_flag) + { + fputc ('\n', fo); + blanks (fo, indent); + } + else fputc (' ', fo); + } + + if ((flags & 0x0100) && fs->fs_sub1 > 0) + fprintf (fo, "�1:%d�", fs->fs_sub1); + /**** if ((flags & 0x0200) && fs->fs_sub2 > 0) + fprintf (fo, "�2:%d�", fs->fs_sub2); ****/ + + if (fs->fs_head_type != FS_type_unknown) + { + indent_plus= fs_print_feature_element (fo, fs->fs_head_type, + fs->fs_head, root, indent, flags); + fprintf (fo, ":"); + } + + if (fs->fs_tail_type == FS_type_pointer + && (flags & 0x0001)) + { + fsd= fs_trace_path (root, (char *) fs->fs_tail); + if (fsd == (void *) 0) + fprintf (fo, "[]"); + else fs_print_feature_element (fo, fsd->fs_tail_type, + fsd->fs_tail, root, + indent+indent_plus+1, flags); + } else + fs_print_feature_element (fo, fs->fs_tail_type, fs->fs_tail, + root, indent+indent_plus+1, flags); + if (!list) break; + } + + return 0; +} diff --git a/lib/aisbr/unify/unify004.c b/lib/aisbr/unify/unify004.c new file mode 100644 index 0000000000000000000000000000000000000000..955012ea2a90c70dfb73dbfedf434a19921d0ed0 --- /dev/null +++ b/lib/aisbr/unify/unify004.c @@ -0,0 +1,374 @@ +/* + * FILE ~/usr/aisbr/unify/unify004.c + * + * written: 1991 05 01 + * latest update: 1994-08-12 + * + */ + +#include <stdio.h> +#include <malloc.h> +#include <string.h> +#include <gg/unify.h> + +#define MAX_STR 256 +static char str [MAX_STR]; + +static long value; +static int value_signum; + +/* ------------------------------------------------------------------------ */ +int fs_scan ( +FILE *fi, +FILE *err, +struct FEATURE_STRUCTURE **act, +int act_mode, /* 0 ... allocate *act */ + /* 1 ... (*act)->head to scan */ + /* 2 ... (*act)->tail to scan */ +int list_mode) /* 1 ... scan list of feature pairs */ + /* 2 ... scan list of values */ +{ + int ch; + int pushback=-1; +#define STATUS_start 0 +#define STATUS_name 1 +#define STATUS_expect_colon 2 +#define STATUS_option 3 +#define STATUS_number 4 + int status=STATUS_start; + int str_size=0; + int option=0; + + if (fi == (FILE *) 0) return SCAN_error; + if (feof (fi)) return SCAN_EOF; + + for (;;) + { + if (pushback == -1) + { + ch = fgetc (fi) & 0x00FF; + if (feof (fi)) ch = -1; + + if (ch == '#') + { + for (;;) + { + ch=fgetc (fi) & 0x00FF; + if (feof (fi) || ch == 0x0A) break; + } + continue; + } + + if (ch == '�') + { + for (;;) + { + ch=fgetc (fi) & 0x00FF; + if (feof (fi) || ch == '�') break; + } + continue; + } + } + else + { + ch=pushback; + pushback=-1; + } + + /************************************************** + printf ("FS: st=%d act_mode=%d ch='%c'\n", + status, act_mode, (ch >= 0x20) ? ch : '.'); + **************************************************/ + + switch (status) + { + case STATUS_start: + switch (ch) + { + case 0x20: + case 0x09: + case 0x0D: + case 0x0A: + case -1: + break; + case '$': + status=STATUS_option; + break; + case '-': + value_signum=1; + value=0L; + status=STATUS_number; + break; + case '+': + value_signum=0; + value=0L; + status=STATUS_number; + break; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + value_signum= 0; + value= (long) (ch - '0'); + status= STATUS_number; + break; + case ']': + case '}': + return SCAN_EOS; + case '[': + case '{': +X1: + switch (act_mode) + { + case 0: + *act= fs_allocate_FEATURE_STRUCTURE (); + if (*act == (void *) 0) + { + fprintf (err, "out of memory\n"); + return SCAN_error; + } + (*act)->fs_next = (void *) 0; + act_mode = list_mode; + goto X1; + case 1: + (*act)->fs_head_type = (ch == '[') + ? FS_type_feature + : FS_type_set; + fs_scan (fi, err, &(*act)->fs_head, 0, (ch=='[')?1:2); + act_mode=2; + status=STATUS_expect_colon; + break; + case 2: + (*act)->fs_tail_type = (ch == '[') + ? FS_type_feature + : FS_type_set; + fs_scan (fi, err, &(*act)->fs_tail, 0, (ch=='[')?1:2); + act = &(*act)->fs_next; + act_mode=0; + break; + default: + fprintf (err, "unknown act_mode in status 0: %d\n", + act_mode); + return SCAN_error; + } + break; + default: +START_default: + if ((ch >= 'a' && ch <= 'z') + ||(ch >= 'A' && ch <= 'Z') + || ch == '_' + || ch == '@') + { + switch (act_mode) + { + case 0: + *act= fs_allocate_FEATURE_STRUCTURE (); + if (*act == (void *) 0) + { + fprintf (err, "out of memory\n"); + return SCAN_error; + } + act_mode = list_mode; + goto START_default; + case 1: + (*act)->fs_head_type = (ch == '@') + ? FS_type_pointer + : FS_type_string; + break; + case 2: + (*act)->fs_tail_type = (ch == '@') + ? FS_type_pointer + : FS_type_string; + break; + default: + fprintf (err, "unknown act_mode in status 0: %d\n", + act_mode); + return SCAN_error; + } + status = STATUS_name; + str [0] = (char) ch; + str_size=1; + str [str_size]=0; + } else + { + fprintf (err, + "feature scan: invalid character in status 0: 0x%02X\n", + ch); + return SCAN_error; + } + break; + } + break; + + case STATUS_name: + switch (ch) + { + case 0x20: + case 0x09: + case 0x0D: + case 0x0A: + case -1: + switch (act_mode) + { + case 1: + status = STATUS_expect_colon; +ATTACH_HEAD: + if (((*act)->fs_head= (struct FEATURE_STRUCTURE *) strdup (str)) + == (char *) 0) return SCAN_error; + break; + case 2: + status=STATUS_start; + option=0; + if (((*act)->fs_tail= (void *) strdup (str)) + == (char *) 0) return SCAN_error; + act = &(*act)->fs_next; + act_mode=0; + break; + default: + fprintf (err, + "feature scan: internal error in status 1: act_mode != 1,2\n"); + return SCAN_error; + } + break; + case ':': + switch (act_mode) + { + case 1: + status = STATUS_start; + option=0; + act_mode=2; + goto ATTACH_HEAD; + default: + fprintf (err, + "feature scan: error in status 1: act_mode != 1\n"); + return SCAN_error; + } + break; + case ']': + case '}': + switch (act_mode) + { + case 1: + status = STATUS_start; + option=0; + act_mode=2; + if (((*act)->fs_head= (void *) strdup (str)) + == (char *) 0) return SCAN_error; + return SCAN_EOS; + case 2: + status = STATUS_start; + option=0; + if (((*act)->fs_tail= (void *) strdup (str)) + == (char *) 0) return SCAN_error; + strcpy ((char *) (*act)->fs_tail, str); + act = &(*act)->fs_next; + act_mode=0; + return SCAN_EOS; + default: + fprintf (err, + "feature scan: error in STATUS_name: act_mode != 1\n"); + return SCAN_error; + } + break; + default: + if ((ch >= 'a' && ch <= 'z') + ||(ch >= 'A' && ch <= 'Z') + ||(ch >= '0' && ch <= '9') + || ch == '_' + || ch == '@') + { + if (str_size >= MAX_STR) return SCAN_error; + str [str_size++] = (char) ch; + str [str_size]=0; + } else + { + fprintf (err, + "feature scan: invalid character in status 1: 0x%02X\n", + ch); + return SCAN_error; + } + break; + } + break; + + case STATUS_expect_colon: + switch (ch) + { + case 0x20: + case 0x09: + case 0x0D: + case 0x0A: + case -1: + break; + case ':': + status=STATUS_start; + option=0; + act_mode=2; + break; + default: + if (act_mode) + { + act_mode=0; + act = &(*act)->fs_next; + } + goto START_default; + } + break; + + case STATUS_option: + switch (ch) + { + default: + option=0; + break; + } + status=STATUS_start; + break; + + case STATUS_number: + if (ch >= '0' && ch <= '9') + { + value=value*10L + ((long) (ch - '0')); + } + else { + if (value_signum==1) value = -value; +X2: + switch (act_mode) + { + case 0: + *act= fs_allocate_FEATURE_STRUCTURE (); + if (*act == (void *) 0) + { + fprintf (err, "out of memory\n"); + return SCAN_error; + } + (*act)->fs_next = (void *) 0; + act_mode = list_mode; + goto X2; + case 1: + (*act)->fs_head_type = FS_type_number; + (*act)->fs_head = (void *) value; + status=STATUS_expect_colon; + break; + case 2: + (*act)->fs_tail_type = FS_type_number; + (*act)->fs_tail = (void *) value; + act = &(*act)->fs_next; + act_mode=0; + status=STATUS_start; + option=0; + break; + default: + fprintf (err, + "feature scan: error in STATUS_number: act_mode != 0,1,2\n"); + return SCAN_error; + } + pushback=ch; + } + break; + + default: + fprintf (err, "feature scan: invalid scanner state %d\n", status); + return SCAN_error; + } + if (feof (fi)) return SCAN_EOF; + } +} diff --git a/lib/aisbr/unify/unify005.c b/lib/aisbr/unify/unify005.c new file mode 100644 index 0000000000000000000000000000000000000000..eba12eab1272ad3d01dfbc22c50a18b58e304ed1 --- /dev/null +++ b/lib/aisbr/unify/unify005.c @@ -0,0 +1,23 @@ +/* + * FILE ~/usr/aisbr/unify/unify005.c + * + * written: 1991 05 01 + * latest update: 1994-08-12 + * + */ + +#include <malloc.h> +#include <gg/unify.h> + +long FEATURE_STRUCTURE_allocated=0L; + +/* ------------------------------------------------------------------------ */ +struct FEATURE_STRUCTURE *fs_allocate_FEATURE_STRUCTURE () +{ + struct FEATURE_STRUCTURE *x; + + if ((x= calloc (sizeof (struct FEATURE_STRUCTURE), 1)) + != (void *) 0) FEATURE_STRUCTURE_allocated++; + + return x; +} diff --git a/lib/aisbr/unify/unify006.c b/lib/aisbr/unify/unify006.c new file mode 100644 index 0000000000000000000000000000000000000000..ae422aa060b3391193fd8e7d8dc893d9fca21843 --- /dev/null +++ b/lib/aisbr/unify/unify006.c @@ -0,0 +1,56 @@ +/* + * FILE ~/usr/aisbr/unify/unify006.c + * + * written: 1991 05 01 + * latest update: 1994-08-12 + * + */ + +#include <gg/unify.h> + +/* ------------------------------------------------------------------------ */ +struct FEATURE_STRUCTURE *fs_trace_path ( +struct FEATURE_STRUCTURE *fs, +char *path) +{ + char *cp1, *cp2; + + if (path == (char *) 0 || *path != '@') + return (struct FEATURE_STRUCTURE *) 0; + + if (path[1] == 0) return fs; /* @ -> root */ + + for (; fs != (void *) 0; fs=fs->fs_next) + { +TOP: + if (fs->fs_head_type == FS_type_string) + { + cp1 = (char *) fs->fs_head; + cp2 = &path [1]; + for (;;) + { + if (*cp1 == 0) + { + switch (*cp2) + { + case 0: return fs; /* complete path walked down */ + case '@': /* just a part of the path walked down */ + path=cp2; + if (fs->fs_tail_type == FS_type_feature + ||fs->fs_tail_type == FS_type_set) + { + fs = fs->fs_tail; + goto TOP; + } + /* otherwise walk_down fails */ + default: return (struct FEATURE_STRUCTURE *) 0; + } + } + if (*cp1 != *cp2) break; + cp1++; + cp2++; + } + } + } + return (struct FEATURE_STRUCTURE *) 0; +} diff --git a/lib/aisbr/unify/unify007.c b/lib/aisbr/unify/unify007.c new file mode 100644 index 0000000000000000000000000000000000000000..be2cd1a4366b9572e8254724067724711b8a130e --- /dev/null +++ b/lib/aisbr/unify/unify007.c @@ -0,0 +1,27 @@ +/* + * FILE ~/usr/aisbr/unify/unify007.c + * + * written: 1991 05 01 + * latest update: 1994-08-12 + * + */ + +#include <stdio.h> +#include <gg/unify.h> + +/* ------------------------------------------------------------------------ */ +int fs_mbq (char *s) +/* Return: 1 if string must be quoted for printing; 0 otherwise */ +{ + int ch, i; + + for (i= 0; (ch= *s) != 0; s++,i++) + { + if ((ch < 'a' || ch > 'z') + &&(ch < 'A' || ch > 'Z') + && ch != '@' + && ch != '_' + &&(i == 0 || ch < '0' || ch > '9')) return 1; + } + return 0; +} diff --git a/lib/aisbr/unify/unify008.c b/lib/aisbr/unify/unify008.c new file mode 100644 index 0000000000000000000000000000000000000000..d69bc6cf13bd2841dca8bc8435df729a587b562e --- /dev/null +++ b/lib/aisbr/unify/unify008.c @@ -0,0 +1,126 @@ +/* + * FILE ~/usr/aisbr/unify/unify008.c + * + * written: 1991 05 01 + * latest update: 1994-08-13 + * + */ + +#include <string.h> +#include <malloc.h> +#include <gg/unify.h> + +/* ------------------------------------------------------------------------ */ +struct FEATURE_STRUCTURE *fs_merge ( +struct FEATURE_STRUCTURE *fs1, +struct FEATURE_STRUCTURE *fs2) +{ + struct FEATURE_STRUCTURE *fs1a; + struct FEATURE_STRUCTURE **fs2a; + struct FEATURE_STRUCTURE *fs3; + struct FEATURE_STRUCTURE *merged= (struct FEATURE_STRUCTURE *) 0; + struct FEATURE_STRUCTURE **append= &merged; + int fs1a_in_fs2; + int rv= 0; + + for (fs1a= fs1; fs1a != (struct FEATURE_STRUCTURE *) 0;) + { + fs1a_in_fs2=0; + + for (fs2a= &fs2; *fs2a != (struct FEATURE_STRUCTURE *) 0;) + { + if ((fs1a->fs_head_type == FS_type_atomic + && (*fs2a)->fs_head_type == FS_type_atomic + && fs1a->fs_head == (*fs2a)->fs_head) + ||(fs1a->fs_head_type == FS_type_string + && (*fs2a)->fs_head_type == FS_type_string + && strcmp ((char *) fs1a->fs_head, (char *) (*fs2a)->fs_head) == 0)) + { + fs1a_in_fs2= 1; + /* both sturctures contain the same feature */ + /* now compare values */ + if (fs1a->fs_tail_type == FS_type_atomic + && (*fs2a)->fs_tail_type == FS_type_atomic) + { + if (fs1a->fs_tail != (*fs2a)->fs_tail) + { +TAKE_BOTH: + /* different values; take both (### and make set! ###) */ + fs1a_in_fs2= 0; + *append= *fs2a; + *fs2a= (*fs2a)->fs_next; + append=&(*append)->fs_next; + *append = (struct FEATURE_STRUCTURE *) 0; + } else + { +DISCARD_EQUAL: + fs3= *fs2a; + *fs2a = fs3->fs_next; + if (fs3->fs_head_type == FS_type_string) free (fs3->fs_head); + free (fs3); + } + break; + } else + if (fs1a->fs_tail_type == FS_type_string + && (*fs2a)->fs_tail_type == FS_type_string) + { + if (strcmp ((char *) fs1a->fs_tail, (char *) (*fs2a)->fs_tail) != 0) + { + goto TAKE_BOTH; + } else + { + goto DISCARD_EQUAL; + } + break; + } else + if (fs1a->fs_tail_type == FS_type_feature + && (*fs2a)->fs_tail_type == FS_type_feature) + { + fs3= *fs2a; + fs1a->fs_tail= fs_merge (fs1a->fs_tail, fs3->fs_tail); + *append = fs1a; + append = &fs1a->fs_next; + fs1a=fs1a->fs_next; + *append = (struct FEATURE_STRUCTURE *) 0; + *fs2a = fs3->fs_next; + if (fs3->fs_head_type == FS_type_string) free (fs3->fs_head); + free (fs3); + break; + } else + if (fs1a->fs_tail_type == FS_type_number + && (*fs2a)->fs_tail_type == FS_type_number) + { /* add numbers */ + long tmpval; + tmpval = (long) fs1a->fs_tail; + tmpval += (long) (*fs2a)->fs_tail; + fs1a->fs_tail = (struct FEATURE_STRUCTURE *) tmpval; + fs1a_in_fs2=0; + goto DISCARD_EQUAL; + } else goto TAKE_BOTH; + } else + { /* head not matching, the next one.... */ + fs2a = &(*fs2a)->fs_next; + } + } + + if (fs1a_in_fs2 == 0) + { /* a feature in fs1 was never found in fs2 */ + *append= fs1a; + append= &fs1a->fs_next; + fs1a= fs1a->fs_next; + *append= (struct FEATURE_STRUCTURE *) 0; + } + } + + /* feature elements from second list, which are still not used */ + /* should be merged */ + while (fs2 != (struct FEATURE_STRUCTURE *) 0) + { + *append = fs2; + append = &fs2->fs_next; + fs2 = fs2->fs_next; + *append = (struct FEATURE_STRUCTURE *) 0; + } + + return merged; +} diff --git a/lib/aisbr/unify/ut1.001 b/lib/aisbr/unify/ut1.001 new file mode 100644 index 0000000000000000000000000000000000000000..e9a858522279d93676e878af64d86af1f7c38cba --- /dev/null +++ b/lib/aisbr/unify/ut1.001 @@ -0,0 +1,4 @@ +name:value +name:value +name:value + diff --git a/lib/aisbr/unify/ut1.002 b/lib/aisbr/unify/ut1.002 new file mode 100644 index 0000000000000000000000000000000000000000..2ec5e68a56a37caadb0e0d34b24189d7e775158c --- /dev/null +++ b/lib/aisbr/unify/ut1.002 @@ -0,0 +1,5 @@ +name:[sub1:value1 sub2:[sub2sub1:sub2value1 sub2sub2:sub2value2]] +[a:b]:[c:d] +set:{m1 m2 m3 18 0 1 m4} +hugo:@name@sub2 +last:[x:[]] diff --git a/lib/aisbr/unify/ut1.c b/lib/aisbr/unify/ut1.c new file mode 100644 index 0000000000000000000000000000000000000000..a16169ed22dac41b9f201d4cc8d016b01cafc11a --- /dev/null +++ b/lib/aisbr/unify/ut1.c @@ -0,0 +1,31 @@ +/* + * File ~/usr/aisbr/unify/ut1.c + * + * written: 1991 05 01 + * latest update: 1994-08-11 + * + */ + +#include <stdio.h> +#include <gg/unify.h> + +int cdecl main (int argc, char *argv[]); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + int i; + FILE *fi; + struct FEATURE_STRUCTURE *fs; + + for (i=1; i<argc; i++) + { + fi= fopen (argv[i], "rb"); + fs_scan (fi, stdout, &fs, 0, 1); + fclose (fi); + + printf ("#\n# ------------------\n"); + fs_print_feature_structure (stdout, fs, fs, 0, 0x0001, 1); + } + return 0; +} diff --git a/lib/aisbr/unify/ut2.001 b/lib/aisbr/unify/ut2.001 new file mode 100644 index 0000000000000000000000000000000000000000..6a22118e1371c0ae46dd9b9d02c982a51921de88 --- /dev/null +++ b/lib/aisbr/unify/ut2.001 @@ -0,0 +1,3 @@ +fs1:[n1:v1 n2:[v2n1:v2v1 v2n2:v2v2] n3:v3a n5:v5 n6:7] +fs2:[n1:v1 n2:[v2n1:v2v1 v2n2:v2v2 v2n3:v2v3] n3:v3a n4:v4 n6:8] + diff --git a/lib/aisbr/unify/ut2.c b/lib/aisbr/unify/ut2.c new file mode 100644 index 0000000000000000000000000000000000000000..a1006efd6d713b9139ae413f3fba83d1ca059016 --- /dev/null +++ b/lib/aisbr/unify/ut2.c @@ -0,0 +1,63 @@ +/* + * File ~/usr/aisbr/unify/ut1.c + * + * written: 1991 05 01 + * latest update: 1994-08-12 + * + */ + +#include <stdio.h> +#include <gg/unify.h> + +int cdecl main (int argc, char *argv[]); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + int i; + FILE *fi; + struct FEATURE_STRUCTURE *fs; + struct FEATURE_STRUCTURE *fs1; + struct FEATURE_STRUCTURE *fs2; + struct FEATURE_STRUCTURE *fs_unified; + int sr1_2, sr2_1; + + for (i= 1; i<argc; i++) + { + fi = fopen (argv[i], "rb"); + fs_scan (fi, stdout, &fs, 0, 1); + fclose (fi); + + fs1= fs_trace_path (fs, "@fs1"); + fs2= fs_trace_path (fs, "@fs2"); + if (fs1 == (void *) 0) printf ("@fs1=[]\n"); + if (fs2 == (void *) 0) printf ("@fs2=[]\n"); + if (fs1 == (void *) 0 || fs2 == (void *) 0) continue; + + printf ("test unification for file %s\n", argv[i]); + + fs1=fs1->fs_tail; + fs2=fs2->fs_tail; + + printf ("fs1 := ["); + fs_print_feature_structure (stdout, fs1, fs1, 8, 0x0300, 1); + printf ("]\n"); + printf ("fs2 := ["); + fs_print_feature_structure (stdout, fs2, fs2, 8, 0x0300, 1); + printf ("]\n"); + + sr1_2= fs_subsumption (fs1, fs2); + sr2_1= fs_subsumption (fs2, fs1); + + printf ("sr1_2=%d sr2_1=%d\n", sr1_2, sr2_1); + + printf ("result -----------\n"); + print_feature_structure (stdout, fs, fs, 0, 0x0300, 1); + printf ("\nunified ------------\n"); + + fs_unified= fs_unify (fs1, fs2); + if (fs_unified == (void *) 0) printf ("*FAIL*"); else + fs_print_feature_structure (stdout, fs_unified, fs_unified, 0, 0x0300, 1); + } + return 0; +} diff --git a/lib/contrib/(dirinf).fm b/lib/contrib/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..8a7624e91e2aa572d2e0d3c83c6e0319d41950f0 --- /dev/null +++ b/lib/contrib/(dirinf).fm @@ -0,0 +1,7 @@ +# automagically GENERATED directory listing of /home/gonter/work/sf/hyx-tools/lib/contrib +# filename size T mode owner group +. 512 d 040755 3222 3000 +.. 1024 d 040755 3222 3000 +(dirinf).fm 0 f 100644 3222 3000 +CVS 512 d 040755 3222 3000 +md5 1024 d 040755 3222 3000 diff --git a/lib/contrib/md5/Makefile b/lib/contrib/md5/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..c609e35f534d97a7a54dc7bbab303f8dd86b250a --- /dev/null +++ b/lib/contrib/md5/Makefile @@ -0,0 +1,87 @@ +# +# FILE %sbr/make-ux +# +# written: 1995-12-28 +# latest update: 1999-05-08 9:36:36 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a +ccc=$(CC) $(OPTS) -c + +all: lib +all.bin: fnmdef fndvfile + +# ---------------------------------------------------------------------------- +sbr_1= md5c.o md5d2s.o md5s2d.o md5chkb.o md5chks.o \ + md5chk2a.o md5chk2b.o + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib + +# ---------------------------------------------------------------------------- +lib: $(sbr_1) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $? + +# ---------------------------------------------------------------------------- +dirt_012.o: dirt_012.c + $(CC) $(OPTS) -o $@ -c dirt_012.c + +dirt_i12.o: dirt_012.c + $(CC) $(OPTS) -o $@ -c -DTLT_INT $? + +dirt_l12.o: dirt_012.c + $(CC) $(OPTS) -o $@ -c -DTLT_LONG $? + +dirt_013.o: dirt_013.c + $(CC) $(OPTS) -o $@ -c dirt_013.c + +dirt_i13.o: dirt_013.c + $(CC) $(OPTS) -o $@ -c -DTLT_INT $? + +dirt_l13.o: dirt_013.c + $(CC) $(OPTS) -o $@ -c -DTLT_LONG $? + +dirt_i14.o: dirt_014.c + $(CC) $(OPTS) -o $@ -c -DDTYPE_int $? + +dirt_l14.o: dirt_014.c + $(CC) $(OPTS) -o $@ -c -DDTYPE_long $? + +dirt_i16.o: dirt_016.c + $(CC) $(OPTS) -o $@ -c -DDTYPE_int $? + +dirt_l16.o: dirt_016.c + $(CC) $(OPTS) -o $@ -c -DDTYPE_long $? + +frmaclin.o: freadlin.c + $(CC) $(OPTS) -o $@ -c -DMAC_MODE $? + +# ---------------------------------------------------------------------------- +FNMDEF= _fnmdef.o _fnmreal.o _logicfnm.o +fnmdef : $(FNMDEF) + cc -o fnmdef $(FNMDEF) $(LIB) + +_fnmdef.o : fnmdef.c + $(ccc) -o $@ -DDEBUG -DDEBUG_main fnmdef.c + +_fnmreal.o : fnmreal.c + $(ccc) -o $@ -DDEBUG fnmreal.c + +_logicfnm.o : logicfnm.c + $(ccc) -o $@ -DDEBUG logicfnm.c + +# ---------------------------------------------------------------------------- +FNDVFILE= _fndvfile.o +fndvfile : $(FNDVFILE) + cc -o fndvfile $(FNDVFILE) $(LIB) + +_fndvfile.o : fndvfile.c + $(ccc) -o $@ -DDEBUG -DDEBUG_main fndvfile.c diff --git a/lib/contrib/md5/contrib b/lib/contrib/md5/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/contrib/md5/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/contrib/md5/gg b/lib/contrib/md5/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/contrib/md5/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/contrib/md5/global.h b/lib/contrib/md5/global.h new file mode 100644 index 0000000000000000000000000000000000000000..5e5f5028828fb5b9dc827b9d6ceacf821aa66872 --- /dev/null +++ b/lib/contrib/md5/global.h @@ -0,0 +1,32 @@ +/* GLOBAL.H - RSAREF types and constants + * This file was extracted from rfc1321.txt + */ + +/* PROTOTYPES should be set to one if and only if the compiler supports + function argument prototyping. + The following makes PROTOTYPES default to 0 if it has not already + been defined with C compiler flags. + */ +#define PROTOTYPES 1 +#ifndef PROTOTYPES +#define PROTOTYPES 0 +#endif + +/* POINTER defines a generic pointer type */ +typedef unsigned char *POINTER; + +/* UINT2 defines a two byte word */ +typedef unsigned short int UINT2; + +/* UINT4 defines a four byte word */ +typedef unsigned long int UINT4; + +/* PROTO_LIST is defined depending on how PROTOTYPES is defined above. +If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it + returns an empty list. + */ +#if PROTOTYPES +#define PROTO_LIST(list) list +#else +#define PROTO_LIST(list) () +#endif diff --git a/lib/contrib/md5/lib b/lib/contrib/md5/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/contrib/md5/libgg.a b/lib/contrib/md5/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/contrib/md5/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/contrib/md5/make-dos b/lib/contrib/md5/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..5a86ca9f0038c853a09b724306156e26552ede06 --- /dev/null +++ b/lib/contrib/md5/make-dos @@ -0,0 +1,35 @@ +# +# FILE %contrib/md5/makefile +# +# written: 1993-01-01 +# latest update: 1995-09-01 +# +# ======================================================================== +cml=cl -AL /W3 /c +cms=cl -AS /W3 /c +ccl=cl -AL /W3 +ccs=cl -AS /W3 +obj=objdec -w -d -m0 -sl 2 MD5_TEXT +bin=c:\bin\ +lib=c:\usr\sbr\lsbr + +all.obj : ! + md5c.obj md5d2s.obj md5s2d.obj ! + md5chkb.obj md5chk2a.obj md5chk2b.obj md5chks.obj md5chk2s.obj ! + md5chk1f.obj md5chk2f.obj + +test.exe : mddriver.exe md5t1.exe + +.c.obj : + $(cml) $? + $(obj) $@ + +inc.md5.h : + copy global.h + md5.h + md5gg.h \c5\include\contrib\md5.h + +# +mddriver.exe : mddriver.obj md5c.obj + link mddriver md5c; + +md5t1.exe : md5t1.obj + link md5t1,,,$(lib); diff --git a/lib/contrib/md5/md5.h b/lib/contrib/md5/md5.h new file mode 100644 index 0000000000000000000000000000000000000000..ff3e9fafb3022c9d437b84c88dc104a448c24e53 --- /dev/null +++ b/lib/contrib/md5/md5.h @@ -0,0 +1,36 @@ +/* MD5.H - header file for MD5C.C + * This file was extracted from rfc1321.txt + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +/* MD5 context. */ +typedef struct { + UINT4 state[4]; /* state (ABCD) */ + UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} MD5_CTX; + +void MD5Init PROTO_LIST ((MD5_CTX *)); +void MD5Update PROTO_LIST ((MD5_CTX *, unsigned char *, unsigned int)); +void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); diff --git a/lib/contrib/md5/md5c.c b/lib/contrib/md5/md5c.c new file mode 100644 index 0000000000000000000000000000000000000000..e3204c5e5a253d1af9b8d44064cb9284ba67d403 --- /dev/null +++ b/lib/contrib/md5/md5c.c @@ -0,0 +1,314 @@ +/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + * This file was extracted from rfc1321.txt + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +#include <contrib/global.h> +#include <contrib/md5.h> + +/* Constants for MD5Transform routine. */ +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + +static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64])); +static void Encode PROTO_LIST ((unsigned char *, UINT4 *, unsigned int)); +static void Decode PROTO_LIST ((UINT4 *, unsigned char *, unsigned int)); +static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int)); +static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int)); + +static unsigned char PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* F, G, H and I are basic MD5 functions. */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +/* ROTATE_LEFT rotates x left n bits. */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. */ +/* Rotation is separate from addition to prevent recomputation. */ +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } + +/* MD5 initialization. Begins an MD5 operation, writing a new context. */ +void MD5Init (context) +MD5_CTX *context; /* context */ +{ + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +/* MD5 block update operation. Continues an MD5 message-digest operation, */ +/* processing another message block, and updating the context. */ +void MD5Update (context, input, inputLen) +MD5_CTX *context; /* context */ +unsigned char *input; /* input block */ +unsigned int inputLen; /* length of input block */ +{ + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int)((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += ((UINT4)inputLen << 3)) + < ((UINT4)inputLen << 3)) + context->count[1]++; + context->count[1] += ((UINT4)inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. */ + if (inputLen >= partLen) { + MD5_memcpy + ((POINTER)&context->buffer[index], (POINTER)input, partLen); + MD5Transform (context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD5Transform (context->state, &input[i]); + + index = 0; + } + else + i = 0; + + /* Buffer remaining input */ + MD5_memcpy + ((POINTER)&context->buffer[index], (POINTER)&input[i], + inputLen-i); +} + +/* MD5 finalization. Ends an MD5 message-digest operation, writing the */ +/* the message digest and zeroizing the context. */ +void MD5Final (digest, context) +unsigned char digest[16]; /* message digest */ +MD5_CTX *context; /* context */ +{ + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + Encode (bits, context->count, 8); + + /* Pad out to 56 mod 64. */ + index = (unsigned int)((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + MD5Update (context, PADDING, padLen); + + /* Append length (before padding) */ + MD5Update (context, bits, 8); + + /* Store state in digest */ + Encode (digest, context->state, 16); + + /* Zeroize sensitive information. */ + MD5_memset ((POINTER)context, 0, sizeof (*context)); +} + +/* MD5 basic transformation. Transforms state based on block. */ +static void MD5Transform (state, block) +UINT4 state[4]; +unsigned char block[64]; +{ + UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode (x, block, 64); + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ + FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ + FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ + FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ + FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ + FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ + FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ + FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ + FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ + FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ + FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ + GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ + GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ + GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ + GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ + GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ + GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ + GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ + GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ + GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ + GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ + HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ + HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ + HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ + HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ + HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ + HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ + HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ + HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ + II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ + II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ + II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ + II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ + II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ + II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ + II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ + II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ + II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + /* Zeroize sensitive information. */ + MD5_memset ((POINTER)x, 0, sizeof (x)); +} + +/* Encodes input (UINT4) into output (unsigned char). Assumes len is */ +/* a multiple of 4. */ +static void Encode (output, input, len) +unsigned char *output; +UINT4 *input; +unsigned int len; +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char)(input[i] & 0xff); + output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); + output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); + output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); + } +} + +/* Decodes input (unsigned char) into output (UINT4). Assumes len is */ +/* a multiple of 4. */ +static void Decode (output, input, len) +UINT4 *output; +unsigned char *input; +unsigned int len; +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | + (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); +} + +/* Note: Replace "for loop" with standard memcpy if possible. */ +static void MD5_memcpy (output, input, len) +POINTER output; +POINTER input; +unsigned int len; +{ + unsigned int i; + + for (i = 0; i < len; i++) + output[i] = input[i]; +} + +/* Note: Replace "for loop" with standard memset if possible. */ +static void MD5_memset (output, value, len) +POINTER output; +int value; +unsigned int len; +{ + unsigned int i; + + for (i = 0; i < len; i++) + ((char *)output)[i] = (char)value; +} diff --git a/lib/contrib/md5/md5c.o b/lib/contrib/md5/md5c.o new file mode 100644 index 0000000000000000000000000000000000000000..25f8844fdfb913227d594cb4aa201fd012005d8b Binary files /dev/null and b/lib/contrib/md5/md5c.o differ diff --git a/lib/contrib/md5/md5chk1f.c b/lib/contrib/md5/md5chk1f.c new file mode 100644 index 0000000000000000000000000000000000000000..58e5d8b81757947edecb20d5eae77a5556925e22 --- /dev/null +++ b/lib/contrib/md5/md5chk1f.c @@ -0,0 +1,30 @@ +/* + * FILE %contrib/md5/md5chk1f.c + * + * return a MD5 digest block for a given block + * + * written: 1995-09-01 + * latest update: 1995-09-01 + * + */ + +#include <stdio.h> +#include <contrib/md5gg.h> + +/* ------------------------------------------------------------------------ */ +unsigned char *MD5chk_file_block (char *fnm, long beg, long size) +{ + FILE *fi; + unsigned char *digest; + + if (fnm == (char *) 0 + || *fnm == 0 + || (fi= fopen (fnm, "rb")) == (FILE *) 0 + ) return (unsigned char *) 0; + + fseek (fi, beg, 0); + digest= MD5chk_stream (fi, size); + fclose (fi); + + return digest; +} diff --git a/lib/contrib/md5/md5chk2a.c b/lib/contrib/md5/md5chk2a.c new file mode 100644 index 0000000000000000000000000000000000000000..ca94111d4917d9b2892199d187270c89b6373350 --- /dev/null +++ b/lib/contrib/md5/md5chk2a.c @@ -0,0 +1,39 @@ +/* + * FILE ~/usr/contrib/md5/md5chk2a.c + * + * return a MD5 digest block for a given array of memory blocks + * see also MD5chk2_block () + * + * written: 1995-05-10 + * latest update: 1995-05-10 + * + */ + +#include <string.h> +#include <contrib/global.h> +#include <contrib/md5.h> +#include <contrib/md5gg.h> + +static unsigned char digest [16]; /* message digest */ + +/* ------------------------------------------------------------------------ */ +unsigned char *MD5chk2_block_array ( +unsigned char *str [], +int lng [], +int cnt) +{ + MD5_CTX context; + unsigned char *cp; + int i; + int l; + + MD5Init (&context); + for (i= 0; i < cnt; i++) + { + if ((cp= str [i]) == (unsigned char *) 0 || (l= lng [i]) == 0) break; + MD5Update (&context, cp, l); + } + MD5Final (digest, &context); + + return digest; +} diff --git a/lib/contrib/md5/md5chk2a.o b/lib/contrib/md5/md5chk2a.o new file mode 100644 index 0000000000000000000000000000000000000000..fa5f82e9cbb5ba3c43ac05276f589bc0da66a5c2 Binary files /dev/null and b/lib/contrib/md5/md5chk2a.o differ diff --git a/lib/contrib/md5/md5chk2b.c b/lib/contrib/md5/md5chk2b.c new file mode 100644 index 0000000000000000000000000000000000000000..3d0e7cc3d3f197209d9368492713df770943e10d --- /dev/null +++ b/lib/contrib/md5/md5chk2b.c @@ -0,0 +1,28 @@ +/* + * FILE ~/usr/contrib/md5/md5chk2b.c + * + * return a MD5 digest block for a given block + * + * written: 1994-06-24 + * latest update: 1995-05-10 + * + */ + +#include <string.h> +#include <contrib/global.h> +#include <contrib/md5.h> +#include <contrib/md5gg.h> + +static unsigned char digest [16]; /* message digest */ + +/* ------------------------------------------------------------------------ */ +unsigned char *MD5chk2_block (unsigned char *str, int lng) +{ + MD5_CTX context; + + MD5Init (&context); + MD5Update (&context, str, lng); + MD5Final (digest, &context); + + return digest; +} diff --git a/lib/contrib/md5/md5chk2b.o b/lib/contrib/md5/md5chk2b.o new file mode 100644 index 0000000000000000000000000000000000000000..34d0b603ddbbf713e3a071d16e97d973478fef45 Binary files /dev/null and b/lib/contrib/md5/md5chk2b.o differ diff --git a/lib/contrib/md5/md5chk2f.c b/lib/contrib/md5/md5chk2f.c new file mode 100644 index 0000000000000000000000000000000000000000..0867cf24bf04cc0dc9b9c19a1719fe50adb7c2a6 --- /dev/null +++ b/lib/contrib/md5/md5chk2f.c @@ -0,0 +1,42 @@ +/* + * FILE %contrib/md5/md5chk2f.c + * + * return a MD5 digest block for a given block + * + * written: 1995-09-01 + * latest update: 1995-09-01 + * + */ + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <contrib/global.h> +#include <contrib/md5.h> +#include <contrib/md5gg.h> + +static unsigned char digest [16]; /* message digest */ + +#define BS 4096 + +/* ------------------------------------------------------------------------ */ +unsigned char *MD5chk_stream (FILE *fi, long size) +{ + MD5_CTX context; + char *block; + int lng; + + if ((block= malloc (BS)) == (char *) 0) return (unsigned char *) 0; + + MD5Init (&context); + while (size > 0L) + { + lng= (size > BS) ? BS : ((int) size); + lng= fread (block, 1, lng, fi); + if (lng <= 0) break; + MD5Update (&context, block, lng); + } + MD5Final (digest, &context); + + return digest; +} diff --git a/lib/contrib/md5/md5chk2s.c b/lib/contrib/md5/md5chk2s.c new file mode 100644 index 0000000000000000000000000000000000000000..163d4e47c1de8c7533f393ca86ae88a9999487c7 --- /dev/null +++ b/lib/contrib/md5/md5chk2s.c @@ -0,0 +1,18 @@ +/* + * FILE ~/usr/contrib/md5/md5chks.c + * + * return the md5 digest string for a given input string + * + * written: 1994-06-24 + * latest update: 1995-02-20 + * + */ + +#include <string.h> +#include <contrib/md5gg.h> + +/* ------------------------------------------------------------------------ */ +unsigned char *MD5chk2_string (unsigned char *str) +{ + return MD5chk2_block (str, strlen (str)); +} diff --git a/lib/contrib/md5/md5chkb.c b/lib/contrib/md5/md5chkb.c new file mode 100644 index 0000000000000000000000000000000000000000..5a8c49a44ce85420554b21bf6c5faf82954895a2 --- /dev/null +++ b/lib/contrib/md5/md5chkb.c @@ -0,0 +1,28 @@ +/* + * FILE ~/usr/contrib/md5/md5chkb.c + * + * return a MD5 digest string for a given block + * + * written: 1994-06-24 + * latest update: 1995-08-06 + * + */ + +#include <string.h> +#include <gg/dpp.h> +#include <contrib/global.h> +#include <contrib/md5.h> +#include <contrib/md5gg.h> + +static char MD5_str [34]; + +/* ------------------------------------------------------------------------ */ +char *MD5check_block (unsigned char *str, int lng) +{ + unsigned char *digest; + + digest= MD5chk2_block (str, lng); + bin_to_hex ((char *) digest, MD5_str, 16); + + return MD5_str; +} diff --git a/lib/contrib/md5/md5chkb.o b/lib/contrib/md5/md5chkb.o new file mode 100644 index 0000000000000000000000000000000000000000..b0172d13f2a81f1e355f572059cf2bb54462ee78 Binary files /dev/null and b/lib/contrib/md5/md5chkb.o differ diff --git a/lib/contrib/md5/md5chks.c b/lib/contrib/md5/md5chks.c new file mode 100644 index 0000000000000000000000000000000000000000..f89fa9fd1a7268df78313ef87cc15d87b3865c1a --- /dev/null +++ b/lib/contrib/md5/md5chks.c @@ -0,0 +1,18 @@ +/* + * FILE ~/usr/contrib/md5/md5chks.c + * + * return the md5 digest string for a given input string + * + * written: 1994-06-24 + * latest update: 1995-08-06 + * + */ + +#include <string.h> +#include <contrib/md5gg.h> + +/* ------------------------------------------------------------------------ */ +char *MD5check_string (unsigned char *str) +{ + return MD5check_block (str, strlen ((char *) str)); +} diff --git a/lib/contrib/md5/md5chks.o b/lib/contrib/md5/md5chks.o new file mode 100644 index 0000000000000000000000000000000000000000..fa1b060c932684588ef5b0c5b148edb699843c89 Binary files /dev/null and b/lib/contrib/md5/md5chks.o differ diff --git a/lib/contrib/md5/md5d2s.c b/lib/contrib/md5/md5d2s.c new file mode 100644 index 0000000000000000000000000000000000000000..65af9bc31c48191d4993c5a1c5379027333427e9 --- /dev/null +++ b/lib/contrib/md5/md5d2s.c @@ -0,0 +1,27 @@ +/* + * FILE ~/usr/contrib/md5/md5d2s.c + * + * convert an MD5 digest string into a printable string + * + * written: 1993-01-06: <Gerhard.Gonter@wu-wien.ac.at> + * latest update: 1995-04-01 + * + */ + +#include <stdio.h> +#include <contrib/md5gg.h> + +/* ------------------------------------------------------------------------ */ +int MD5Digest2String (char *digest, char *string) +{ + int i; + + for (i= 0; i<16; i++) + { + sprintf (string, "%02x", *digest & 0x00FF); + string += 2; + digest++; + } + + return 0; +} diff --git a/lib/contrib/md5/md5d2s.o b/lib/contrib/md5/md5d2s.o new file mode 100644 index 0000000000000000000000000000000000000000..16b02aade11b4c8e3865932a717797a02328c3b8 Binary files /dev/null and b/lib/contrib/md5/md5d2s.o differ diff --git a/lib/contrib/md5/md5s2d.c b/lib/contrib/md5/md5s2d.c new file mode 100644 index 0000000000000000000000000000000000000000..f7760a8c30bb684fcee43a4f9377854c7883dd00 --- /dev/null +++ b/lib/contrib/md5/md5s2d.c @@ -0,0 +1,33 @@ +/* + * FILE ~/usr/contrib/md5/md5d2s.c + * + * convert an printable MD5 string into digest format + * + * written: 1993-12-05: <Gerhard.Gonter@wu-wien.ac.at> + * latest update: 1995-02-20 + * + */ + +#include <contrib/md5gg.h> + +/* ------------------------------------------------------------------------ */ +int MD5String2Digest (char *digest, char *string) +{ + int i; + int ch; + int v= 0; + + for (i= 0; i < 32; i++) + { + ch= *string++ & 0x00FF; + if (ch >= '0' && ch <= '9') ch= ch - '0'; else + if (ch >= 'a' && ch <= 'f') ch= ch - 'a' + 10; else + if (ch >= 'A' && ch <= 'F') ch= ch - 'A' + 10; else + return -1; + if (i%2) + *digest++ = (char) (v+ch); + else v= 16*ch; + } + + return 0; +} diff --git a/lib/contrib/md5/md5s2d.o b/lib/contrib/md5/md5s2d.o new file mode 100644 index 0000000000000000000000000000000000000000..ac211a3c6be1c04d78dbb61d67875c90ac38eddd Binary files /dev/null and b/lib/contrib/md5/md5s2d.o differ diff --git a/lib/contrib/md5/md5t1.c b/lib/contrib/md5/md5t1.c new file mode 100644 index 0000000000000000000000000000000000000000..8d915dd52d424206686696758534eed0622b8f0d --- /dev/null +++ b/lib/contrib/md5/md5t1.c @@ -0,0 +1,35 @@ +/* + * FILE ~/usr/contrib/md5/md5t1.c + * + * written: 1994-07-17 + * latest update: 1994-07-17 + * + */ + +#include <stdio.h> +#include <contrib/md5gg.h> + +int test_md5s (char *s) +{ + char *md5; + md5= MD5check_string (s); + printf ("%s \"%s\"\n", md5, s); + return 0; +} + +int main (void); + +int main () +{ + test_md5s ("1 2 3"); + test_md5s (""); + test_md5s ("1 2 3"); + test_md5s ("1 2 3"); + test_md5s (""); + + test_md5s ("e"); + test_md5s ("b"); + + return 0; +} + diff --git a/lib/contrib/md5/mddriver.c b/lib/contrib/md5/mddriver.c new file mode 100644 index 0000000000000000000000000000000000000000..4ccf0cbed567791b1fc406a9c5fb055b6784f368 --- /dev/null +++ b/lib/contrib/md5/mddriver.c @@ -0,0 +1,229 @@ +/* MDDRIVER.C - test driver for MD2, MD4 and MD5 + * This file was extracted from rfc1321.txt + */ + +/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All +rights reserved. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +/* The following makes MD default to MD5 if it has not already been + defined with C compiler flags. + */ +#ifndef MD +#define MD 5 +#endif + +#include <stdio.h> +#include <time.h> +#include <string.h> +#include "global.h" +#if MD == 2 +#include "md2.h" +#endif +#if MD == 4 +#include "md4.h" +#endif +#if MD == 5 +#include "md5.h" +#endif + +/* Length of test block, number of test blocks. + */ +#define TEST_BLOCK_LEN 1000 +#define TEST_BLOCK_COUNT 1000 + +static void MDString PROTO_LIST ((char *)); +static void MDTimeTrial PROTO_LIST ((void)); +static void MDTestSuite PROTO_LIST ((void)); +static void MDFile PROTO_LIST ((char *)); +static void MDFilter PROTO_LIST ((void)); +static void MDPrint PROTO_LIST ((unsigned char [16])); + +#if MD == 2 +#define MD_CTX MD2_CTX +#define MDInit MD2Init +#define MDUpdate MD2Update +#define MDFinal MD2Final +#endif +#if MD == 4 +#define MD_CTX MD4_CTX +#define MDInit MD4Init +#define MDUpdate MD4Update +#define MDFinal MD4Final +#endif +#if MD == 5 +#define MD_CTX MD5_CTX +#define MDInit MD5Init +#define MDUpdate MD5Update +#define MDFinal MD5Final +#endif + +/* Main driver. + +Arguments (may be any combination): + -sstring - digests string + -t - runs time trial + -x - runs test script + filename - digests file + (none) - digests standard input + */ +int main (int argc, char *argv[]); +int main (argc, argv) +int argc; +char *argv[]; +{ + int i; + + if (argc > 1) + for (i = 1; i < argc; i++) + if (argv[i][0] == '-' && argv[i][1] == 's') + MDString (argv[i] + 2); + else if (strcmp (argv[i], "-t") == 0) + MDTimeTrial (); + else if (strcmp (argv[i], "-x") == 0) + MDTestSuite (); + else + MDFile (argv[i]); + else + MDFilter (); + + return (0); +} + +/* Digests a string and prints the result. + */ +static void MDString (string) +char *string; +{ + MD_CTX context; + unsigned char digest[16]; + unsigned int len = strlen (string); + + MDInit (&context); + MDUpdate (&context, string, len); + MDFinal (digest, &context); + + printf ("MD%d (\"%s\") = ", MD, string); + MDPrint (digest); + printf ("\n"); +} + +/* Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte + blocks. + */ +static void MDTimeTrial () +{ + MD_CTX context; + time_t endTime, startTime; + unsigned char block[TEST_BLOCK_LEN], digest[16]; + unsigned int i; + + printf + ("MD%d time trial. Digesting %d %d-byte blocks ...", MD, + TEST_BLOCK_LEN, TEST_BLOCK_COUNT); + + /* Initialize block */ + for (i = 0; i < TEST_BLOCK_LEN; i++) + block[i] = (unsigned char)(i & 0xff); + + /* Start timer */ + time (&startTime); + + /* Digest blocks */ + MDInit (&context); + for (i = 0; i < TEST_BLOCK_COUNT; i++) + MDUpdate (&context, block, TEST_BLOCK_LEN); + MDFinal (digest, &context); + + /* Stop timer */ + time (&endTime); + + printf (" done\n"); + printf ("Digest = "); + MDPrint (digest); + printf ("\nTime = %ld seconds\n", (long)(endTime-startTime)); + printf + ("Speed = %ld bytes/second\n", + (long)TEST_BLOCK_LEN * (long)TEST_BLOCK_COUNT/(endTime-startTime)); +} + +/* Digests a reference suite of strings and prints the results. + */ +static void MDTestSuite () +{ + printf ("MD%d test suite:\n", MD); + + MDString (""); + MDString ("a"); + MDString ("abc"); + MDString ("message digest"); + MDString ("abcdefghijklmnopqrstuvwxyz"); + MDString + ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); + MDString + ("1234567890123456789012345678901234567890\ +1234567890123456789012345678901234567890"); +} + +/* Digests a file and prints the result. + */ +static void MDFile (filename) +char *filename; +{ + FILE *file; + MD_CTX context; + int len; + unsigned char buffer[1024], digest[16]; + + if ((file = fopen (filename, "rb")) == NULL) + printf ("%s can't be opened\n", filename); + + else { + MDInit (&context); + while (len = fread (buffer, 1, 1024, file)) + MDUpdate (&context, buffer, len); + MDFinal (digest, &context); + + fclose (file); + + printf ("MD%d (%s) = ", MD, filename); + MDPrint (digest); + printf ("\n"); + } +} + +/* Digests the standard input and prints the result. + */ +static void MDFilter () +{ + MD_CTX context; + int len; + unsigned char buffer[16], digest[16]; + + MDInit (&context); + while (len = fread (buffer, 1, 16, stdin)) + MDUpdate (&context, buffer, len); + MDFinal (digest, &context); + + MDPrint (digest); + printf ("\n"); +} + +/* Prints a message digest in hexadecimal. + */ +static void MDPrint (digest) +unsigned char digest[16]; +{ + unsigned int i; + + for (i = 0; i < 16; i++) + printf ("%02x", digest[i]); +} diff --git a/lib/contrib/md5/ned.stp b/lib/contrib/md5/ned.stp new file mode 100644 index 0000000000000000000000000000000000000000..070a1d48761411c499425703f911323bd9b0b259 --- /dev/null +++ b/lib/contrib/md5/ned.stp @@ -0,0 +1,3 @@ +@macro +1 ^qs^n * This file was extracted from rfc1321.txt +@end \ No newline at end of file diff --git a/lib/contrib/md5/rfc1321.txt b/lib/contrib/md5/rfc1321.txt new file mode 100644 index 0000000000000000000000000000000000000000..85543a5b28ab5104fcd37ece71c47ffae0942121 --- /dev/null +++ b/lib/contrib/md5/rfc1321.txt @@ -0,0 +1,1179 @@ + + + + + + +Network Working Group R. Rivest +Request for Comments: 1321 MIT Laboratory for Computer Science + and RSA Data Security, Inc. + April 1992 + + + The MD5 Message-Digest Algorithm + +Status of this Memo + + This memo provides information for the Internet community. It does + not specify an Internet standard. Distribution of this memo is + unlimited. + +Acknowlegements + + We would like to thank Don Coppersmith, Burt Kaliski, Ralph Merkle, + David Chaum, and Noam Nisan for numerous helpful comments and + suggestions. + +Table of Contents + + 1. Executive Summary 1 + 2. Terminology and Notation 2 + 3. MD5 Algorithm Description 3 + 4. Summary 6 + 5. Differences Between MD4 and MD5 6 + References 7 + APPENDIX A - Reference Implementation 7 + Security Considerations 21 + Author's Address 21 + +1. Executive Summary + + This document describes the MD5 message-digest algorithm. The + algorithm takes as input a message of arbitrary length and produces + as output a 128-bit "fingerprint" or "message digest" of the input. + It is conjectured that it is computationally infeasible to produce + two messages having the same message digest, or to produce any + message having a given prespecified target message digest. The MD5 + algorithm is intended for digital signature applications, where a + large file must be "compressed" in a secure manner before being + encrypted with a private (secret) key under a public-key cryptosystem + such as RSA. + + + + + + + +Rivest [Page 1] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + + The MD5 algorithm is designed to be quite fast on 32-bit machines. In + addition, the MD5 algorithm does not require any large substitution + tables; the algorithm can be coded quite compactly. + + The MD5 algorithm is an extension of the MD4 message-digest algorithm + 1,2]. MD5 is slightly slower than MD4, but is more "conservative" in + design. MD5 was designed because it was felt that MD4 was perhaps + being adopted for use more quickly than justified by the existing + critical review; because MD4 was designed to be exceptionally fast, + it is "at the edge" in terms of risking successful cryptanalytic + attack. MD5 backs off a bit, giving up a little in speed for a much + greater likelihood of ultimate security. It incorporates some + suggestions made by various reviewers, and contains additional + optimizations. The MD5 algorithm is being placed in the public domain + for review and possible adoption as a standard. + + For OSI-based applications, MD5's object identifier is + + md5 OBJECT IDENTIFIER ::= + iso(1) member-body(2) US(840) rsadsi(113549) digestAlgorithm(2) 5} + + In the X.509 type AlgorithmIdentifier [3], the parameters for MD5 + should have type NULL. + +2. Terminology and Notation + + In this document a "word" is a 32-bit quantity and a "byte" is an + eight-bit quantity. A sequence of bits can be interpreted in a + natural manner as a sequence of bytes, where each consecutive group + of eight bits is interpreted as a byte with the high-order (most + significant) bit of each byte listed first. Similarly, a sequence of + bytes can be interpreted as a sequence of 32-bit words, where each + consecutive group of four bytes is interpreted as a word with the + low-order (least significant) byte given first. + + Let x_i denote "x sub i". If the subscript is an expression, we + surround it in braces, as in x_{i+1}. Similarly, we use ^ for + superscripts (exponentiation), so that x^i denotes x to the i-th + power. + + Let the symbol "+" denote addition of words (i.e., modulo-2^32 + addition). Let X <<< s denote the 32-bit value obtained by circularly + shifting (rotating) X left by s bit positions. Let not(X) denote the + bit-wise complement of X, and let X v Y denote the bit-wise OR of X + and Y. Let X xor Y denote the bit-wise XOR of X and Y, and let XY + denote the bit-wise AND of X and Y. + + + + + +Rivest [Page 2] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + +3. MD5 Algorithm Description + + We begin by supposing that we have a b-bit message as input, and that + we wish to find its message digest. Here b is an arbitrary + nonnegative integer; b may be zero, it need not be a multiple of + eight, and it may be arbitrarily large. We imagine the bits of the + message written down as follows: + + m_0 m_1 ... m_{b-1} + + The following five steps are performed to compute the message digest + of the message. + +3.1 Step 1. Append Padding Bits + + The message is "padded" (extended) so that its length (in bits) is + congruent to 448, modulo 512. That is, the message is extended so + that it is just 64 bits shy of being a multiple of 512 bits long. + Padding is always performed, even if the length of the message is + already congruent to 448, modulo 512. + + Padding is performed as follows: a single "1" bit is appended to the + message, and then "0" bits are appended so that the length in bits of + the padded message becomes congruent to 448, modulo 512. In all, at + least one bit and at most 512 bits are appended. + +3.2 Step 2. Append Length + + A 64-bit representation of b (the length of the message before the + padding bits were added) is appended to the result of the previous + step. In the unlikely event that b is greater than 2^64, then only + the low-order 64 bits of b are used. (These bits are appended as two + 32-bit words and appended low-order word first in accordance with the + previous conventions.) + + At this point the resulting message (after padding with bits and with + b) has a length that is an exact multiple of 512 bits. Equivalently, + this message has a length that is an exact multiple of 16 (32-bit) + words. Let M[0 ... N-1] denote the words of the resulting message, + where N is a multiple of 16. + +3.3 Step 3. Initialize MD Buffer + + A four-word buffer (A,B,C,D) is used to compute the message digest. + Here each of A, B, C, D is a 32-bit register. These registers are + initialized to the following values in hexadecimal, low-order bytes + first): + + + + +Rivest [Page 3] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + + word A: 01 23 45 67 + word B: 89 ab cd ef + word C: fe dc ba 98 + word D: 76 54 32 10 + +3.4 Step 4. Process Message in 16-Word Blocks + + We first define four auxiliary functions that each take as input + three 32-bit words and produce as output one 32-bit word. + + F(X,Y,Z) = XY v not(X) Z + G(X,Y,Z) = XZ v Y not(Z) + H(X,Y,Z) = X xor Y xor Z + I(X,Y,Z) = Y xor (X v not(Z)) + + In each bit position F acts as a conditional: if X then Y else Z. + The function F could have been defined using + instead of v since XY + and not(X)Z will never have 1's in the same bit position.) It is + interesting to note that if the bits of X, Y, and Z are independent + and unbiased, the each bit of F(X,Y,Z) will be independent and + unbiased. + + The functions G, H, and I are similar to the function F, in that they + act in "bitwise parallel" to produce their output from the bits of X, + Y, and Z, in such a manner that if the corresponding bits of X, Y, + and Z are independent and unbiased, then each bit of G(X,Y,Z), + H(X,Y,Z), and I(X,Y,Z) will be independent and unbiased. Note that + the function H is the bit-wise "xor" or "parity" function of its + inputs. + + This step uses a 64-element table T[1 ... 64] constructed from the + sine function. Let T[i] denote the i-th element of the table, which + is equal to the integer part of 4294967296 times abs(sin(i)), where i + is in radians. The elements of the table are given in the appendix. + + Do the following: + + /* Process each 16-word block. */ + For i = 0 to N/16-1 do + + /* Copy block i into X. */ + For j = 0 to 15 do + Set X[j] to M[i*16+j]. + end /* of loop on j */ + + /* Save A as AA, B as BB, C as CC, and D as DD. */ + AA = A + BB = B + + + +Rivest [Page 4] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + + CC = C + DD = D + + /* Round 1. */ + /* Let [abcd k s i] denote the operation + a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ + /* Do the following 16 operations. */ + [ABCD 0 7 1] [DABC 1 12 2] [CDAB 2 17 3] [BCDA 3 22 4] + [ABCD 4 7 5] [DABC 5 12 6] [CDAB 6 17 7] [BCDA 7 22 8] + [ABCD 8 7 9] [DABC 9 12 10] [CDAB 10 17 11] [BCDA 11 22 12] + [ABCD 12 7 13] [DABC 13 12 14] [CDAB 14 17 15] [BCDA 15 22 16] + + /* Round 2. */ + /* Let [abcd k s i] denote the operation + a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ + /* Do the following 16 operations. */ + [ABCD 1 5 17] [DABC 6 9 18] [CDAB 11 14 19] [BCDA 0 20 20] + [ABCD 5 5 21] [DABC 10 9 22] [CDAB 15 14 23] [BCDA 4 20 24] + [ABCD 9 5 25] [DABC 14 9 26] [CDAB 3 14 27] [BCDA 8 20 28] + [ABCD 13 5 29] [DABC 2 9 30] [CDAB 7 14 31] [BCDA 12 20 32] + + /* Round 3. */ + /* Let [abcd k s t] denote the operation + a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ + /* Do the following 16 operations. */ + [ABCD 5 4 33] [DABC 8 11 34] [CDAB 11 16 35] [BCDA 14 23 36] + [ABCD 1 4 37] [DABC 4 11 38] [CDAB 7 16 39] [BCDA 10 23 40] + [ABCD 13 4 41] [DABC 0 11 42] [CDAB 3 16 43] [BCDA 6 23 44] + [ABCD 9 4 45] [DABC 12 11 46] [CDAB 15 16 47] [BCDA 2 23 48] + + /* Round 4. */ + /* Let [abcd k s t] denote the operation + a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ + /* Do the following 16 operations. */ + [ABCD 0 6 49] [DABC 7 10 50] [CDAB 14 15 51] [BCDA 5 21 52] + [ABCD 12 6 53] [DABC 3 10 54] [CDAB 10 15 55] [BCDA 1 21 56] + [ABCD 8 6 57] [DABC 15 10 58] [CDAB 6 15 59] [BCDA 13 21 60] + [ABCD 4 6 61] [DABC 11 10 62] [CDAB 2 15 63] [BCDA 9 21 64] + + /* Then perform the following additions. (That is increment each + of the four registers by the value it had before this block + was started.) */ + A = A + AA + B = B + BB + C = C + CC + D = D + DD + + end /* of loop on i */ + + + +Rivest [Page 5] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + +3.5 Step 5. Output + + The message digest produced as output is A, B, C, D. That is, we + begin with the low-order byte of A, and end with the high-order byte + of D. + + This completes the description of MD5. A reference implementation in + C is given in the appendix. + +4. Summary + + The MD5 message-digest algorithm is simple to implement, and provides + a "fingerprint" or message digest of a message of arbitrary length. + It is conjectured that the difficulty of coming up with two messages + having the same message digest is on the order of 2^64 operations, + and that the difficulty of coming up with any message having a given + message digest is on the order of 2^128 operations. The MD5 algorithm + has been carefully scrutinized for weaknesses. It is, however, a + relatively new algorithm and further security analysis is of course + justified, as is the case with any new proposal of this sort. + +5. Differences Between MD4 and MD5 + + The following are the differences between MD4 and MD5: + + 1. A fourth round has been added. + + 2. Each step now has a unique additive constant. + + 3. The function g in round 2 was changed from (XY v XZ v YZ) to + (XZ v Y not(Z)) to make g less symmetric. + + 4. Each step now adds in the result of the previous step. This + promotes a faster "avalanche effect". + + 5. The order in which input words are accessed in rounds 2 and + 3 is changed, to make these patterns less like each other. + + 6. The shift amounts in each round have been approximately + optimized, to yield a faster "avalanche effect." The shifts in + different rounds are distinct. + + + + + + + + + + +Rivest [Page 6] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + +References + + [1] Rivest, R., "The MD4 Message Digest Algorithm", RFC 1320, MIT and + RSA Data Security, Inc., April 1992. + + [2] Rivest, R., "The MD4 message digest algorithm", in A.J. Menezes + and S.A. Vanstone, editors, Advances in Cryptology - CRYPTO '90 + Proceedings, pages 303-311, Springer-Verlag, 1991. + + [3] CCITT Recommendation X.509 (1988), "The Directory - + Authentication Framework." + +APPENDIX A - Reference Implementation + + This appendix contains the following files taken from RSAREF: A + Cryptographic Toolkit for Privacy-Enhanced Mail: + + global.h -- global header file + + md5.h -- header file for MD5 + + md5c.c -- source code for MD5 + + For more information on RSAREF, send email to <rsaref@rsa.com>. + + The appendix also includes the following file: + + mddriver.c -- test driver for MD2, MD4 and MD5 + + The driver compiles for MD5 by default but can compile for MD2 or MD4 + if the symbol MD is defined on the C compiler command line as 2 or 4. + + The implementation is portable and should work on many different + plaforms. However, it is not difficult to optimize the implementation + on particular platforms, an exercise left to the reader. For example, + on "little-endian" platforms where the lowest-addressed byte in a 32- + bit word is the least significant and there are no alignment + restrictions, the call to Decode in MD5Transform can be replaced with + a typecast. + +A.1 global.h + +/* GLOBAL.H - RSAREF types and constants + */ + +/* PROTOTYPES should be set to one if and only if the compiler supports + function argument prototyping. +The following makes PROTOTYPES default to 0 if it has not already + + + +Rivest [Page 7] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + + been defined with C compiler flags. + */ +#ifndef PROTOTYPES +#define PROTOTYPES 0 +#endif + +/* POINTER defines a generic pointer type */ +typedef unsigned char *POINTER; + +/* UINT2 defines a two byte word */ +typedef unsigned short int UINT2; + +/* UINT4 defines a four byte word */ +typedef unsigned long int UINT4; + +/* PROTO_LIST is defined depending on how PROTOTYPES is defined above. +If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it + returns an empty list. + */ +#if PROTOTYPES +#define PROTO_LIST(list) list +#else +#define PROTO_LIST(list) () +#endif + +A.2 md5.h + +/* MD5.H - header file for MD5C.C + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + + + + +Rivest [Page 8] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +/* MD5 context. */ +typedef struct { + UINT4 state[4]; /* state (ABCD) */ + UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} MD5_CTX; + +void MD5Init PROTO_LIST ((MD5_CTX *)); +void MD5Update PROTO_LIST + ((MD5_CTX *, unsigned char *, unsigned int)); +void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); + +A.3 md5c.c + +/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +#include "global.h" +#include "md5.h" + +/* Constants for MD5Transform routine. + */ + + + +Rivest [Page 9] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + +static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64])); +static void Encode PROTO_LIST + ((unsigned char *, UINT4 *, unsigned int)); +static void Decode PROTO_LIST + ((UINT4 *, unsigned char *, unsigned int)); +static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int)); +static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int)); + +static unsigned char PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* F, G, H and I are basic MD5 functions. + */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +/* ROTATE_LEFT rotates x left n bits. + */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. +Rotation is separate from addition to prevent recomputation. + */ +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + + + +Rivest [Page 10] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } + +/* MD5 initialization. Begins an MD5 operation, writing a new context. + */ +void MD5Init (context) +MD5_CTX *context; /* context */ +{ + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. +*/ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +/* MD5 block update operation. Continues an MD5 message-digest + operation, processing another message block, and updating the + context. + */ +void MD5Update (context, input, inputLen) +MD5_CTX *context; /* context */ +unsigned char *input; /* input block */ +unsigned int inputLen; /* length of input block */ +{ + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int)((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += ((UINT4)inputLen << 3)) + + + +Rivest [Page 11] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + + < ((UINT4)inputLen << 3)) + context->count[1]++; + context->count[1] += ((UINT4)inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. +*/ + if (inputLen >= partLen) { + MD5_memcpy + ((POINTER)&context->buffer[index], (POINTER)input, partLen); + MD5Transform (context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD5Transform (context->state, &input[i]); + + index = 0; + } + else + i = 0; + + /* Buffer remaining input */ + MD5_memcpy + ((POINTER)&context->buffer[index], (POINTER)&input[i], + inputLen-i); +} + +/* MD5 finalization. Ends an MD5 message-digest operation, writing the + the message digest and zeroizing the context. + */ +void MD5Final (digest, context) +unsigned char digest[16]; /* message digest */ +MD5_CTX *context; /* context */ +{ + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + Encode (bits, context->count, 8); + + /* Pad out to 56 mod 64. +*/ + index = (unsigned int)((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + MD5Update (context, PADDING, padLen); + + /* Append length (before padding) */ + MD5Update (context, bits, 8); + + + +Rivest [Page 12] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + + /* Store state in digest */ + Encode (digest, context->state, 16); + + /* Zeroize sensitive information. +*/ + MD5_memset ((POINTER)context, 0, sizeof (*context)); +} + +/* MD5 basic transformation. Transforms state based on block. + */ +static void MD5Transform (state, block) +UINT4 state[4]; +unsigned char block[64]; +{ + UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode (x, block, 64); + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ + FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ + FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ + FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ + FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ + FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ + FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ + FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ + FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ + FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ + FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ + GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ + GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ + GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ + GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ + GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ + GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ + + + +Rivest [Page 13] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + + GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ + GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ + GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ + GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ + HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ + HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ + HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ + HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ + HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ + HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ + HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ + HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ + II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ + II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ + II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ + II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ + II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ + II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ + II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ + II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ + II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + /* Zeroize sensitive information. + + + +Rivest [Page 14] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + +*/ + MD5_memset ((POINTER)x, 0, sizeof (x)); +} + +/* Encodes input (UINT4) into output (unsigned char). Assumes len is + a multiple of 4. + */ +static void Encode (output, input, len) +unsigned char *output; +UINT4 *input; +unsigned int len; +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char)(input[i] & 0xff); + output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); + output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); + output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); + } +} + +/* Decodes input (unsigned char) into output (UINT4). Assumes len is + a multiple of 4. + */ +static void Decode (output, input, len) +UINT4 *output; +unsigned char *input; +unsigned int len; +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | + (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); +} + +/* Note: Replace "for loop" with standard memcpy if possible. + */ + +static void MD5_memcpy (output, input, len) +POINTER output; +POINTER input; +unsigned int len; +{ + unsigned int i; + + for (i = 0; i < len; i++) + + + +Rivest [Page 15] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + + output[i] = input[i]; +} + +/* Note: Replace "for loop" with standard memset if possible. + */ +static void MD5_memset (output, value, len) +POINTER output; +int value; +unsigned int len; +{ + unsigned int i; + + for (i = 0; i < len; i++) + ((char *)output)[i] = (char)value; +} + +A.4 mddriver.c + +/* MDDRIVER.C - test driver for MD2, MD4 and MD5 + */ + +/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All +rights reserved. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +/* The following makes MD default to MD5 if it has not already been + defined with C compiler flags. + */ +#ifndef MD +#define MD MD5 +#endif + +#include <stdio.h> +#include <time.h> +#include <string.h> +#include "global.h" +#if MD == 2 +#include "md2.h" +#endif +#if MD == 4 + + + +Rivest [Page 16] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + +#include "md4.h" +#endif +#if MD == 5 +#include "md5.h" +#endif + +/* Length of test block, number of test blocks. + */ +#define TEST_BLOCK_LEN 1000 +#define TEST_BLOCK_COUNT 1000 + +static void MDString PROTO_LIST ((char *)); +static void MDTimeTrial PROTO_LIST ((void)); +static void MDTestSuite PROTO_LIST ((void)); +static void MDFile PROTO_LIST ((char *)); +static void MDFilter PROTO_LIST ((void)); +static void MDPrint PROTO_LIST ((unsigned char [16])); + +#if MD == 2 +#define MD_CTX MD2_CTX +#define MDInit MD2Init +#define MDUpdate MD2Update +#define MDFinal MD2Final +#endif +#if MD == 4 +#define MD_CTX MD4_CTX +#define MDInit MD4Init +#define MDUpdate MD4Update +#define MDFinal MD4Final +#endif +#if MD == 5 +#define MD_CTX MD5_CTX +#define MDInit MD5Init +#define MDUpdate MD5Update +#define MDFinal MD5Final +#endif + +/* Main driver. + +Arguments (may be any combination): + -sstring - digests string + -t - runs time trial + -x - runs test script + filename - digests file + (none) - digests standard input + */ +int main (argc, argv) +int argc; + + + +Rivest [Page 17] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + +char *argv[]; +{ + int i; + + if (argc > 1) + for (i = 1; i < argc; i++) + if (argv[i][0] == '-' && argv[i][1] == 's') + MDString (argv[i] + 2); + else if (strcmp (argv[i], "-t") == 0) + MDTimeTrial (); + else if (strcmp (argv[i], "-x") == 0) + MDTestSuite (); + else + MDFile (argv[i]); + else + MDFilter (); + + return (0); +} + +/* Digests a string and prints the result. + */ +static void MDString (string) +char *string; +{ + MD_CTX context; + unsigned char digest[16]; + unsigned int len = strlen (string); + + MDInit (&context); + MDUpdate (&context, string, len); + MDFinal (digest, &context); + + printf ("MD%d (\"%s\") = ", MD, string); + MDPrint (digest); + printf ("\n"); +} + +/* Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte + blocks. + */ +static void MDTimeTrial () +{ + MD_CTX context; + time_t endTime, startTime; + unsigned char block[TEST_BLOCK_LEN], digest[16]; + unsigned int i; + + + + +Rivest [Page 18] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + + printf + ("MD%d time trial. Digesting %d %d-byte blocks ...", MD, + TEST_BLOCK_LEN, TEST_BLOCK_COUNT); + + /* Initialize block */ + for (i = 0; i < TEST_BLOCK_LEN; i++) + block[i] = (unsigned char)(i & 0xff); + + /* Start timer */ + time (&startTime); + + /* Digest blocks */ + MDInit (&context); + for (i = 0; i < TEST_BLOCK_COUNT; i++) + MDUpdate (&context, block, TEST_BLOCK_LEN); + MDFinal (digest, &context); + + /* Stop timer */ + time (&endTime); + + printf (" done\n"); + printf ("Digest = "); + MDPrint (digest); + printf ("\nTime = %ld seconds\n", (long)(endTime-startTime)); + printf + ("Speed = %ld bytes/second\n", + (long)TEST_BLOCK_LEN * (long)TEST_BLOCK_COUNT/(endTime-startTime)); +} + +/* Digests a reference suite of strings and prints the results. + */ +static void MDTestSuite () +{ + printf ("MD%d test suite:\n", MD); + + MDString (""); + MDString ("a"); + MDString ("abc"); + MDString ("message digest"); + MDString ("abcdefghijklmnopqrstuvwxyz"); + MDString + ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); + MDString + ("1234567890123456789012345678901234567890\ +1234567890123456789012345678901234567890"); +} + +/* Digests a file and prints the result. + + + +Rivest [Page 19] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + + */ +static void MDFile (filename) +char *filename; +{ + FILE *file; + MD_CTX context; + int len; + unsigned char buffer[1024], digest[16]; + + if ((file = fopen (filename, "rb")) == NULL) + printf ("%s can't be opened\n", filename); + + else { + MDInit (&context); + while (len = fread (buffer, 1, 1024, file)) + MDUpdate (&context, buffer, len); + MDFinal (digest, &context); + + fclose (file); + + printf ("MD%d (%s) = ", MD, filename); + MDPrint (digest); + printf ("\n"); + } +} + +/* Digests the standard input and prints the result. + */ +static void MDFilter () +{ + MD_CTX context; + int len; + unsigned char buffer[16], digest[16]; + + MDInit (&context); + while (len = fread (buffer, 1, 16, stdin)) + MDUpdate (&context, buffer, len); + MDFinal (digest, &context); + + MDPrint (digest); + printf ("\n"); +} + +/* Prints a message digest in hexadecimal. + */ +static void MDPrint (digest) +unsigned char digest[16]; +{ + + + +Rivest [Page 20] + +RFC 1321 MD5 Message-Digest Algorithm April 1992 + + + unsigned int i; + + for (i = 0; i < 16; i++) + printf ("%02x", digest[i]); +} + +A.5 Test suite + + The MD5 test suite (driver option "-x") should print the following + results: + +MD5 test suite: +MD5 ("") = d41d8cd98f00b204e9800998ecf8427e +MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661 +MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72 +MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0 +MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b +MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = +d174ab98d277d9f5a5611c2c9f419d9f +MD5 ("123456789012345678901234567890123456789012345678901234567890123456 +78901234567890") = 57edf4a22be3c955ac49da2e2107b67a + +Security Considerations + + The level of security discussed in this memo is considered to be + sufficient for implementing very high security hybrid digital- + signature schemes based on MD5 and a public-key cryptosystem. + +Author's Address + + Ronald L. Rivest + Massachusetts Institute of Technology + Laboratory for Computer Science + NE43-324 + 545 Technology Square + Cambridge, MA 02139-1986 + + Phone: (617) 253-5880 + EMail: rivest@theory.lcs.mit.edu + + + + + + + + + + + + +Rivest [Page 21] + diff --git a/lib/ds/(dirinf).fm b/lib/ds/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..57bd112d76d93099fa1c1547d5d2fedc79989216 --- /dev/null +++ b/lib/ds/(dirinf).fm @@ -0,0 +1,51 @@ +# +# FILE %ds/(dirinf).fm +# +# written: 1994-11-20 +# latest update: 1999-04-10 11:53:23 +# $Id: (dirinf).fm,v 1.4 2002/01/27 23:01:37 gonter Exp $ +# +# ---------------------------------------------------------------------------- + +(dirinf).fm manipulation of datastructures +Makefile active Makefile (DOS or Unix) +make-ux Makefile (Unix) +make-dos Makefile (MSDOS) +makeshar.lst list of files to be transfered to Unix +# mkshar.pl create shar file segment +ds.mod MSDOS module list + +array perl like array processing +attlist attribute lists +bbc black board connections +cal date, time, calendar and planner functions +codes code translation routines +dbx database stuff +dyb dynamic blocks +entity SGML Entities +ggcrypt simple encryption routines +hytxt SGML and Hypertext Functions +hyxdb HYX Database +hyxl HYX attributes in SGML tag strings +hyxp HYX SGML Parser +hyxta HYX TA Parser +irdb irrelational database +lmd LM/D Engine +lmd5 LM/D Engine Version 5 +lut lookup table handling +lutctl lookup table control +lxs Lexical Subsystem +mail mail handling subroutines +mime Multimedia Internet Mail Extensions +rdtp restructured dynamic text parser +rtf Rich Text Format (not much...) +streams stream processing framework +strings string processing subroutines +tcl TCL command library +tfb Text File Base +url URL processing +varspace variable space managment +vieos Vienna Objective SGML, TCL Library +ytree YTREE: binary skip tree +zip ZIP file processing + diff --git a/lib/ds/Makefile b/lib/ds/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..d63e33928f56d0518ac1fe7e21cdacc379c01d30 --- /dev/null +++ b/lib/ds/Makefile @@ -0,0 +1,95 @@ +# +# FILE %ds/make-ux +# +# written: 1995-12-12 +# latest update: 1999-04-10 11:53:49 +# $Id: Makefile,v 1.9 2007/11/11 11:27:31 gonter Exp $ +# +# ---------------------------------------------------------------------------- + +all: all.simple all.exp # all.using-tcl all.exp2 + +# things that should work +all.simple: + (cd array && make) + (cd attlist && make) + (cd cal && make) + (cd codes && make) + (cd dyb && make) + (cd ggcrypt && make) + (cd hytxt && make) + (cd hyxl && make) + (cd irdb && make) + (cd lmd && make) + (cd lmd5 && make) + (cd lut && make) + (cd mime && make) + (cd rdtp && make) + (cd streams && make) + (cd strings && make) + (cd tfb && make) + (cd url && make) + (cd varspace && make) + (cd ytree && make) + (cd zip && make) + +# things that use TCL +all.using-tcl: + (cd tcl && make) + (cd vieos && make) + +# things that might work +all.exp: + (cd bbc && make) + (cd hyxp && make) + (cd hyxta && make) + +# things that most certainly do not work! +all.exp2: + (cd lxs && make) + (cd rtf && make) + +all.bin: + (cd codes && make all.bin) + (cd tfb && make all.bin) + (cd lmd5 && make all.bin) + (cd vieos && make all.bin) + +# ---------------------------------------------------------------------------- +clean: clean.simple clean.exp # clean.using-tcl clean.exp2 + +clean.simple: + (cd array && make clean) + (cd attlist && make clean) + (cd cal && make clean) + (cd codes && make clean) + (cd dyb && make clean) + (cd ggcrypt && make clean) + (cd hytxt && make clean) + (cd hyxl && make clean) + (cd irdb && make clean) + (cd lmd && make clean) + (cd lmd5 && make clean) + (cd lut && make clean) + (cd rdtp && make clean) + (cd streams && make clean) + (cd strings && make clean) + (cd tfb && make clean) + (cd url && make clean) + (cd varspace && make clean) + (cd ytree && make clean) + (cd zip && make clean) + +clean.exp: + (cd bbc && make clean) + (cd hyxp && make clean) + (cd hyxta && make clean) + +clean.exp2: + (cd lxs && make clean) + (cd rtf && make clean) + +clean.using-tcl: + (cd tcl && make clean) + (cd vieos && make clean) + diff --git a/lib/ds/array/(dirinf).fm b/lib/ds/array/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..ccb19f9e0f2b1c1f611836a4f63e6460c1ce273d --- /dev/null +++ b/lib/ds/array/(dirinf).fm @@ -0,0 +1,35 @@ +# +# FILE %ds/array/(dirinf).fm +# +# written: 1996-08-11 +# latest update: 1997-03-30 9:36:50 +# + +# see also: <gg/array.h> + +(dirinf).fm Contents +Makefile current version of Makefile +make-dos DOS version of Makefile +make-ux Unix version of Makefile + +array000.c template + +array001.c replacement for %sbr/fnmqueue.c +array002.c int array_dispose (struct ARRAY_CONTROL *ac); + +array003.c int array_push (struct ARRAY_CONTROL *ac, void *pl); +array004.c int array_unshift (struct ARRAY_CONTROL *ac, void *pl); +array005.c void *array_pop (struct ARRAY_CONTROL *ac); +array006.c void *array_shift (struct ARRAY_CONTROL *ac); +array007.c int array_push2 (struct ARRAY_CONTROL **ac, void *pl); +array008.c int array_unshift2 (struct ARRAY_CONTROL **ac, void *pl); +array009.c int array_push2_dup (struct ARRAY_CONTROL **ac, char *pl); + +array010.c int array_dispose2 (struct ARRAY_CONTROL *ac, ...); +array011.c int array_dispose_string (struct ARRAY_CONTROL *ac); + +array012.c struct ARRAY_CONTROL *array_append_split_destructive (...); +array013.c char *array_join (...); + +array014.c char *array_dup_tmp (*ac); + diff --git a/lib/ds/array/Makefile b/lib/ds/array/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..2825ab5fbe961c9291ac60c4047cb168fb269aaf --- /dev/null +++ b/lib/ds/array/Makefile @@ -0,0 +1,31 @@ +# +# FILE %ds/array/make-ux +# +# written: 1996-08-11 +# latest update: 1999-04-10 12:23:03 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + array001.o array002.o array003.o array004.o array005.o array006.o \ + array007.o array008.o array009.o array010.o array011.o array012.o \ + array013.o array014.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o diff --git a/lib/ds/array/array000.c b/lib/ds/array/array000.c new file mode 100644 index 0000000000000000000000000000000000000000..f1a7da83c23a87d30f88758b6ae7270ad6d37293 --- /dev/null +++ b/lib/ds/array/array000.c @@ -0,0 +1,18 @@ +/* + * FILE %ds/array/array000.c + * + * processing of arrays (similar to perl) + * + * written: 1996-08-11 + * latest update: 1997-03-30 9:13:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ diff --git a/lib/ds/array/array001.c b/lib/ds/array/array001.c new file mode 100644 index 0000000000000000000000000000000000000000..aadd22894468ead785a6b4b580440d48c051bcfb --- /dev/null +++ b/lib/ds/array/array001.c @@ -0,0 +1,65 @@ +/* + * FILE %sbr/array.c + * + * processing of arrays (similar to perl) + * + * written: 1996-08-11 + * latest update: 1999-04-25 16:56:08 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +static struct ARRAY_CONTROL *ac= (struct ARRAY_CONTROL *) 0; + +/* ------------------------------------------------------------------------ */ +int string_push (char *fn) +{ + if (ac == (struct ARRAY_CONTROL *) 0) ac= array_new (); + if (ac == (struct ARRAY_CONTROL *) 0) return -1; + + return array_push (ac, (void *) strdup (fn)); +} + +/* ------------------------------------------------------------------------ */ +int string_unshift (char *fn) +{ + if (ac == (struct ARRAY_CONTROL *) 0) ac= array_new (); + if (ac == (struct ARRAY_CONTROL *) 0) return -1; + + return array_unshift (ac, (void *) strdup (fn)); +} + +/* ------------------------------------------------------------------------ */ +char *string_pop () +{ + if (ac == (struct ARRAY_CONTROL *) 0) return (char *) 0; + + return (char *) array_pop (ac); +} + +/* ------------------------------------------------------------------------ */ +char *string_shift () +{ + if (ac == (struct ARRAY_CONTROL *) 0) return (char *) 0; + + return (char *) array_shift (ac); +} + +/* ------------------------------------------------------------------------ */ +void string_reset () +{ + if (ac != (struct ARRAY_CONTROL *) 0) + { + array_dispose (ac); + ac->element_destructor= free; + ac= (struct ARRAY_CONTROL *) 0; + } +} diff --git a/lib/ds/array/array001.o b/lib/ds/array/array001.o new file mode 100644 index 0000000000000000000000000000000000000000..0f17ef5eeaca757a18aa0b1781e806065ca88188 Binary files /dev/null and b/lib/ds/array/array001.o differ diff --git a/lib/ds/array/array002.c b/lib/ds/array/array002.c new file mode 100644 index 0000000000000000000000000000000000000000..15f3dc339a8efc85bdec5fb499c814cd696735e4 --- /dev/null +++ b/lib/ds/array/array002.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/array/array002.c + * + * processing of arrays (similar to perl) + * + * written: 1996-08-11 + * latest update: 1997-11-09 12:15:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +int array_dispose (struct ARRAY_CONTROL *ac) +{ + struct ARRAY_ELEMENT *ae, *ae2; + array_element_destructor *ad; + + if (ac == (struct ARRAY_CONTROL *) 0) return -1; + ad= ac->element_destructor; + + for (ae= ac->top; + ae != (struct ARRAY_ELEMENT *) 0; + ae= ae2) + { + ae2= ae->next; + if (ad != (array_element_destructor *) 0) (*ad) (ae->payload); + free (ae); + } + + free (ac); + + return 0; +} diff --git a/lib/ds/array/array002.o b/lib/ds/array/array002.o new file mode 100644 index 0000000000000000000000000000000000000000..9d600591d22ce0934385533051961b5b98051418 Binary files /dev/null and b/lib/ds/array/array002.o differ diff --git a/lib/ds/array/array003.c b/lib/ds/array/array003.c new file mode 100644 index 0000000000000000000000000000000000000000..ad0f395fc6910b20bbb0bbe349b3956ded50dc34 --- /dev/null +++ b/lib/ds/array/array003.c @@ -0,0 +1,45 @@ +/* + * FILE %ds/array/array003.c + * + * processing of arrays (similar to perl) + * + * written: 1996-08-11 + * latest update: 1997-03-30 9:25:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +long array_push (struct ARRAY_CONTROL *ac, void *pl) +{ + struct ARRAY_ELEMENT *ae; + struct ARRAY_ELEMENT *ae_last; + + if (ac == (struct ARRAY_CONTROL *) 0 + || (ae= array_new_element ()) == (struct ARRAY_ELEMENT *) 0 + ) return -1L; + + ae->payload= pl; + + if (ac->elements > 0L) + { /* there were already a few elements */ + ae_last= ac->last; + ae_last->next= ae; + ae->prev= ae_last; + ac->last= ae; + ac->elements++; + } + else + { + ac->elements= 1L; + ac->top= ac->last= ae; + } + + return ac->elements; +} diff --git a/lib/ds/array/array003.o b/lib/ds/array/array003.o new file mode 100644 index 0000000000000000000000000000000000000000..da90bd152191e5ecbd2c260b2ceec1e52488c82b Binary files /dev/null and b/lib/ds/array/array003.o differ diff --git a/lib/ds/array/array004.c b/lib/ds/array/array004.c new file mode 100644 index 0000000000000000000000000000000000000000..232371fc593dae398abddf8efe764db7e99efe66 --- /dev/null +++ b/lib/ds/array/array004.c @@ -0,0 +1,45 @@ +/* + * FILE %ds/array/array004.c + * + * processing of arrays (similar to perl) + * + * written: 1996-08-11 + * latest update: 1996-11-10 0:59:23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +long array_unshift (struct ARRAY_CONTROL *ac, void *pl) +{ + struct ARRAY_ELEMENT *ae; + struct ARRAY_ELEMENT *ae_top; + + if (ac == (struct ARRAY_CONTROL *) 0 + || (ae= array_new_element()) == (struct ARRAY_ELEMENT *) 0 + ) return -1L; + + ae->payload= pl; + + if (ac->elements > 0L) + { /* there were already a few elements */ + ae_top= ac->top; + ae_top->prev= ae; + ae->next= ae_top; + ac->top= ae; + ac->elements++; + } + else + { + ac->elements= 1L; + ac->top= ac->last= ae; + } + + return ac->elements; +} diff --git a/lib/ds/array/array004.o b/lib/ds/array/array004.o new file mode 100644 index 0000000000000000000000000000000000000000..cc96e88f9cbb9a19021c51f94fedd249dc7a234a Binary files /dev/null and b/lib/ds/array/array004.o differ diff --git a/lib/ds/array/array005.c b/lib/ds/array/array005.c new file mode 100644 index 0000000000000000000000000000000000000000..8c3cc3f7e918c9a0b3390168369f2c3c6d804282 --- /dev/null +++ b/lib/ds/array/array005.c @@ -0,0 +1,47 @@ +/* + * FILE %ds/array/array005.c + * + * processing of arrays (similar to perl) + * + * written: 1996-08-11 + * latest update: 1996-08-11 12:10:34 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +void *array_pop (struct ARRAY_CONTROL *ac) +{ + struct ARRAY_ELEMENT *ae_last; + struct ARRAY_ELEMENT *ae_prev; + void *pl; + + if (ac == (struct ARRAY_CONTROL *) 0 + || ac->elements <= 0L /* 0 is ok, ERROR if less! */ + || (ae_last= ac->last) == (struct ARRAY_ELEMENT *) 0 /* ERROR!!! */ + ) return (void *) 0; + + pl= ae_last->payload; + + if (ac->elements == 1L) + { + ac->top= ac->last= (struct ARRAY_ELEMENT *) 0; + } + else + { + ae_prev= ae_last->prev; + ac->last= ae_prev; + ae_prev->next= (struct ARRAY_ELEMENT *) 0; + } + + ac->elements--; + free (ae_last); + + return pl; +} diff --git a/lib/ds/array/array005.o b/lib/ds/array/array005.o new file mode 100644 index 0000000000000000000000000000000000000000..399247817b943d133431a1643995329bc50fd5c4 Binary files /dev/null and b/lib/ds/array/array005.o differ diff --git a/lib/ds/array/array006.c b/lib/ds/array/array006.c new file mode 100644 index 0000000000000000000000000000000000000000..294c5dee10bfecb5ada4d3dc0d1f2c3d65878ad7 --- /dev/null +++ b/lib/ds/array/array006.c @@ -0,0 +1,47 @@ +/* + * FILE %ds/array/array006.c + * + * processing of arrays (similar to perl) + * + * written: 1996-08-11 + * latest update: 1996-08-11 12:10:34 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +void *array_shift (struct ARRAY_CONTROL *ac) +{ + struct ARRAY_ELEMENT *ae_top; + struct ARRAY_ELEMENT *ae_next; + void *pl; + + if (ac == (struct ARRAY_CONTROL *) 0 + || ac->elements <= 0L + || (ae_top= ac->top) == (struct ARRAY_ELEMENT *) 0 + ) return (void *) 0; + + pl= ae_top->payload; + + if (ac->elements == 1L) + { + ac->top= ac->last= (struct ARRAY_ELEMENT *) 0; + } + else + { + ae_next= ae_top->next; + ac->top= ae_next; + ae_next->prev= (struct ARRAY_ELEMENT *) 0; + } + + ac->elements--; + free (ae_top); + + return pl; +} diff --git a/lib/ds/array/array006.o b/lib/ds/array/array006.o new file mode 100644 index 0000000000000000000000000000000000000000..6d2fb5adb54b9e7f0db0f03cfc3dd36009f3bc77 Binary files /dev/null and b/lib/ds/array/array006.o differ diff --git a/lib/ds/array/array007.c b/lib/ds/array/array007.c new file mode 100644 index 0000000000000000000000000000000000000000..1a183a8221914b8f5e75569032b60605ac51dd9f --- /dev/null +++ b/lib/ds/array/array007.c @@ -0,0 +1,28 @@ +/* + * FILE %ds/array/array007.c + * + * processing of arrays (similar to perl) + * + * written: 1996-11-10 + * latest update: 1996-11-10 0:55:30 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +long array_push2 (struct ARRAY_CONTROL **ac, void *pl) +{ + if (ac == (struct ARRAY_CONTROL **) 0 + || (*ac == (struct ARRAY_CONTROL *) 0 + && (*ac= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) + ) return -1L; + + return array_push (*ac, pl); +} diff --git a/lib/ds/array/array007.o b/lib/ds/array/array007.o new file mode 100644 index 0000000000000000000000000000000000000000..9e98d28173b1011a2509c957502ab6f42541805a Binary files /dev/null and b/lib/ds/array/array007.o differ diff --git a/lib/ds/array/array008.c b/lib/ds/array/array008.c new file mode 100644 index 0000000000000000000000000000000000000000..5818b1e384c37b9e5eae30c4be392e2a5db823ff --- /dev/null +++ b/lib/ds/array/array008.c @@ -0,0 +1,28 @@ +/* + * FILE %ds/array/array008.c + * + * processing of arrays (similar to perl) + * + * written: 1996-11-10 + * latest update: 1996-11-10 0:55:30 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +long array_unshift2 (struct ARRAY_CONTROL **ac, void *pl) +{ + if (ac == (struct ARRAY_CONTROL **) 0 + || (*ac == (struct ARRAY_CONTROL *) 0 + && (*ac= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) + ) return -1L; + + return array_unshift (*ac, pl); +} diff --git a/lib/ds/array/array008.o b/lib/ds/array/array008.o new file mode 100644 index 0000000000000000000000000000000000000000..18e52b1fef2c57d827a0bd0d971dee60aaac88d0 Binary files /dev/null and b/lib/ds/array/array008.o differ diff --git a/lib/ds/array/array009.c b/lib/ds/array/array009.c new file mode 100644 index 0000000000000000000000000000000000000000..18986a62eec995f2b0d1fad37d102adb3e032f71 --- /dev/null +++ b/lib/ds/array/array009.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/array/array009.c + * + * processing of arrays (similar to perl) + * + * written: 1996-11-10 + * latest update: 1996-11-10 11:24:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +long array_push2_dup (struct ARRAY_CONTROL **ac, char *pl) +{ + if (ac == (struct ARRAY_CONTROL **) 0 + || (*ac == (struct ARRAY_CONTROL *) 0 + && (*ac= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) + ) return -1L; + + return array_push (*ac, (void *) strdup (pl)); +} diff --git a/lib/ds/array/array009.o b/lib/ds/array/array009.o new file mode 100644 index 0000000000000000000000000000000000000000..d8b29dbfaca9414d217b9e9da8be1a10e71466c5 Binary files /dev/null and b/lib/ds/array/array009.o differ diff --git a/lib/ds/array/array010.c b/lib/ds/array/array010.c new file mode 100644 index 0000000000000000000000000000000000000000..f506b7881b3e6a7aa47606dac14b2e9e998efd75 --- /dev/null +++ b/lib/ds/array/array010.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/array/array010.c + * + * processing of arrays (similar to perl) + * + * written: 1996-11-10 + * latest update: 1996-11-10 1:17:19 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +int array_dispose2 (struct ARRAY_CONTROL *ac, array_element_destructor *ad) +{ + struct ARRAY_ELEMENT *ae, *ae2; + + if (ac == (struct ARRAY_CONTROL *) 0) return -1; + + for (ae= ac->top; + ae != (struct ARRAY_ELEMENT *) 0; + ae= ae2) + { + ae2= ae->next; + if (ad != (array_element_destructor *) 0) (*ad) (ae->payload); + free (ae); + } + + free (ac); + + return 0; +} diff --git a/lib/ds/array/array010.o b/lib/ds/array/array010.o new file mode 100644 index 0000000000000000000000000000000000000000..a7854d02b84b5823158040d2a8c9234f21afd8de Binary files /dev/null and b/lib/ds/array/array010.o differ diff --git a/lib/ds/array/array011.c b/lib/ds/array/array011.c new file mode 100644 index 0000000000000000000000000000000000000000..4f2a7f3df16df2151c25fcbdb3a63314bd71cf8b --- /dev/null +++ b/lib/ds/array/array011.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/array/array011.c + * + * processing of arrays (similar to perl) + * + * written: 1996-11-10 + * latest update: 1996-12-11 12:40:13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +int array_dispose_string (struct ARRAY_CONTROL *ac) +{ + struct ARRAY_ELEMENT *ae, *ae2; + + if (ac == (struct ARRAY_CONTROL *) 0) return -1; + + for (ae= ac->top; + ae != (struct ARRAY_ELEMENT *) 0; + ae= ae2) + { + ae2= ae->next; + if (ae->payload != (void *) 0) free (ae->payload); + free (ae); + } + + free (ac); + + return 0; +} diff --git a/lib/ds/array/array011.o b/lib/ds/array/array011.o new file mode 100644 index 0000000000000000000000000000000000000000..4109408ba013ab7a24d945ed5b2d654cd7f76b88 Binary files /dev/null and b/lib/ds/array/array011.o differ diff --git a/lib/ds/array/array012.c b/lib/ds/array/array012.c new file mode 100644 index 0000000000000000000000000000000000000000..e6f9e82b5498e3c6ee223a947e689a9d89a05b73 --- /dev/null +++ b/lib/ds/array/array012.c @@ -0,0 +1,49 @@ +/* + * FILE %ds/array/array012.c + * + * processing of arrays (similar to perl) + * + * written: 1997-03-30 + * latest update: 1997-11-02 13:43:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +struct ARRAY_CONTROL *array_append_split_destructive ( +struct ARRAY_CONTROL *ac, +char *str, +int split_char, +int max_fields) +{ + char *fields [MAX_ARRAY_SPLIT]; + int n_fields; + int i; + + if (str == (char *) 0 + || (ac == (struct ARRAY_CONTROL *) 0 + && (ac= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) + ) + return ac; + + if (max_fields > MAX_ARRAY_SPLIT) max_fields= MAX_ARRAY_SPLIT; + + n_fields= split_string (str, split_char, fields, max_fields); + if (n_fields > max_fields) n_fields= max_fields; + + for (i= 0; i < n_fields; i++) + { + array_push (ac, strdup (fields [i])); + } + + return ac; +} diff --git a/lib/ds/array/array012.o b/lib/ds/array/array012.o new file mode 100644 index 0000000000000000000000000000000000000000..a5999a07b57ab66334d8238786ca63888057a8c5 Binary files /dev/null and b/lib/ds/array/array012.o differ diff --git a/lib/ds/array/array013.c b/lib/ds/array/array013.c new file mode 100644 index 0000000000000000000000000000000000000000..a708e4f509d9d44e65be2459c6f0e9a5d2bf1958 --- /dev/null +++ b/lib/ds/array/array013.c @@ -0,0 +1,85 @@ +/* + * FILE %ds/array/array013.c + * + * processing of arrays (similar to perl) + * + * written: 1997-03-30 + * latest update: 1997-03-30 9:38:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +char *array_join ( +struct ARRAY_CONTROL *ac, +char *out_str, +int out_size, +char *conc_str) +{ + struct ARRAY_ELEMENT *ae; + int conc_size= 0; + int pl_size; + char *pl; + char *out_ptr; + + if (ac == (struct ARRAY_CONTROL *) 0 + || (ae= array_top (ac)) == (struct ARRAY_ELEMENT *) 0 + ) return (char *) 0; + + if (conc_str != (char *) 0) conc_size= strlen (conc_str); + if (out_size < 0) out_size= 0; + + if (out_str == (char *) 0) + { /* output string is not allocated, calculate necessary size ! */ + int required_size= 1; /* one extra char for the null character */ + + while (1) + { + if ((pl= ae->payload) != (char *) 0) required_size += strlen (pl); + + if ((ae= ae->next) == (struct ARRAY_ELEMENT *) 0) break; + required_size += conc_size; + } + + required_size += out_size; /* by convention, add this much extra space */ + + if ((out_str= malloc (required_size)) == (char *) 0) return (char *) 0; + out_size= required_size; + } + + out_ptr= out_str; + out_size--; /* reserve for the null char */ + + for (ae= array_top (ac); ae != (struct ARRAY_ELEMENT *) 0;) + { + if ((pl= (char *) ae->payload) != (char *) 0) + { + pl_size= strlen (pl); + if (out_size < pl_size) break; /* don't add element if it does */ + /* not fit entirely */ + strcpy (out_ptr, pl); + out_ptr += pl_size; + out_size -= pl_size; + } + + if ((ae= ae->next) == (struct ARRAY_ELEMENT *) 0 + || out_size < conc_size + ) break; + + if (conc_size > 0) + { + strcpy (out_ptr, conc_str); + out_ptr += conc_size; + out_size -= conc_size; + } + } + + return out_str; +} diff --git a/lib/ds/array/array013.o b/lib/ds/array/array013.o new file mode 100644 index 0000000000000000000000000000000000000000..a1a9ddd738f2f4ea6c0588d887eac98db0c0e13e Binary files /dev/null and b/lib/ds/array/array013.o differ diff --git a/lib/ds/array/array014.c b/lib/ds/array/array014.c new file mode 100644 index 0000000000000000000000000000000000000000..d376cf0431bd1814e2cdda360dc0ca8ce7b6639f --- /dev/null +++ b/lib/ds/array/array014.c @@ -0,0 +1,40 @@ +/* + * FILE %ds/array/array014.c + * + * create a temporary duplicate of an array + * but without duplicating the payload!! + * + * T2D: this could be implemented faster by avoiding the array_push () + * + * written: 1997-11-09 + * latest update: 1997-11-09 12:15:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/array.h> + +/* ------------------------------------------------------------------------ */ +struct ARRAY_CONTROL *array_dup_tmp (struct ARRAY_CONTROL *ac) +{ + struct ARRAY_CONTROL *dup= (struct ARRAY_CONTROL *) 0; + struct ARRAY_ELEMENT *ae; + + if (ac == (struct ARRAY_CONTROL *) 0 + || (dup= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) goto DONE; + + for (ae= ac->top; + ae != (struct ARRAY_ELEMENT *) 0; + ae= ae->next) + { + array_push (dup, ae->payload); + } + +DONE: + return dup; +} diff --git a/lib/ds/array/array014.o b/lib/ds/array/array014.o new file mode 100644 index 0000000000000000000000000000000000000000..03df720d8e15aad9215398db5269a9fb2e092f21 Binary files /dev/null and b/lib/ds/array/array014.o differ diff --git a/lib/ds/array/contrib b/lib/ds/array/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/array/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/array/gg b/lib/ds/array/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/array/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/array/lib b/lib/ds/array/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/array/libgg.a b/lib/ds/array/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/array/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/array/make-dos b/lib/ds/array/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..cf1461babf73cef5000c8f49a25bc6b0c9d633a2 --- /dev/null +++ b/lib/ds/array/make-dos @@ -0,0 +1,23 @@ +# +# FILE %ds/array/makefile +# +# manipulation of array +# +# written: 1996-08-11 +# latest update: 1997-11-09 12:27:20 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : ! + array001.obj array002.obj array003.obj array004.obj array005.obj ! + array006.obj array007.obj array008.obj array009.obj array010.obj ! + array011.obj array012.obj array013.obj array014.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/attlist/(dirinf).fm b/lib/ds/attlist/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..c36aaba132febd19be64826c465c9d2aad141848 --- /dev/null +++ b/lib/ds/attlist/(dirinf).fm @@ -0,0 +1,18 @@ +# +# FILE %ds/attlist/(dirinf).fm +# +# written: 1994-03-28 +# latest update: 1997-11-02 12:50:50 +# $Id: (dirinf).fm,v 1.2 2002/05/02 06:48:29 gonter Exp $ +# +# ---------------------------------------------------------------------------- +attl0001.c struct ATTRIBUTE_LIST *al_create_attribute (...) +attl0002.c struct ATTRIBUTE_LIST **al_getp_attribute (...) +attl0003.c struct ATTRIBUTE_LIST *al_set_attribut (...) +attl0004.c struct ATTRIBUTE_LIST *al_find_attribute (...) +attl0005.c int al_find_name (...) +attl0006.c void *al_find_attribute_value (...) +attl0007.c NOT FINISHED al_parse_stream +attl0008.c al_add_attribute (ATTLIST *l, ...); +attl0009.c new_ATTLIST (ATTLIST *l, ...); + diff --git a/lib/ds/attlist/Makefile b/lib/ds/attlist/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..43a04eaf65690840a87e31459d3848cb2a1abe86 --- /dev/null +++ b/lib/ds/attlist/Makefile @@ -0,0 +1,32 @@ +# +# FILE %ds/attlist/make-ux +# +# written: 1995-12-20 +# latest update: 1999-05-08 9:36:57 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow + +# ---------------------------------------------------------------------------- +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + attl0001.o attl0002.o attl0003.o attl0004.o attl0005.o attl0006.o \ + attl0008.o attl0009.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $? diff --git a/lib/ds/attlist/attl0000.c b/lib/ds/attlist/attl0000.c new file mode 100644 index 0000000000000000000000000000000000000000..2645a45745b61a8f97a47e6e4413a35bfdf58ab3 --- /dev/null +++ b/lib/ds/attlist/attl0000.c @@ -0,0 +1,14 @@ +/* + * FILE %ds/attlist/attl0000.c + * + * manipulation of attribute lists + * + * written: 1994-10-30 + * latest update: 1997-11-02 17:43:44 + * + */ + +#include <gg/attlist.h> + +/* ------------------------------------------------------------------------ */ + diff --git a/lib/ds/attlist/attl0001.c b/lib/ds/attlist/attl0001.c new file mode 100644 index 0000000000000000000000000000000000000000..852b766c6a11c455d9bd8290964e7a06d2c05582 --- /dev/null +++ b/lib/ds/attlist/attl0001.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/attlist/attl0001.c + * + * manipulation of attribute lists + * + creation of new attribute elements + * + * written: 1994-03-26 + * latest update: 1997-11-02 12:49:57 + * $Id: attl0001.c,v 1.3 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/attlist.h> + +/* ------------------------------------------------------------------------ */ +struct ATTRIBUTE_LIST *al_create_attribute ( +char *name, +char *attl, +long type, +void *value) +{ + struct ATTRIBUTE_LIST *al; + + if ((al= (struct ATTRIBUTE_LIST *) + calloc (sizeof (struct ATTRIBUTE_LIST), 1)) + == (struct ATTRIBUTE_LIST *) 0) + { + return (struct ATTRIBUTE_LIST *) 0; + } + +/*** fprintf (stderr, ">>> attrib %s created\n", name); ***/ + al->AL_attl= attl; + al->AL_name= name; + al->AL_value= ((al->AL_type= type) == ALty_string_dup) + ? (void *) strdup ((char *) value) + : value; + + return al; +} diff --git a/lib/ds/attlist/attl0001.o b/lib/ds/attlist/attl0001.o new file mode 100644 index 0000000000000000000000000000000000000000..4630a0ed20394dae7b95661d12f19d68a4f2126d Binary files /dev/null and b/lib/ds/attlist/attl0001.o differ diff --git a/lib/ds/attlist/attl0002.c b/lib/ds/attlist/attl0002.c new file mode 100644 index 0000000000000000000000000000000000000000..1ac098c97b91e3eed6b2e6488646f546376f1c05 --- /dev/null +++ b/lib/ds/attlist/attl0002.c @@ -0,0 +1,33 @@ +/* + * FILE %ds/attlist/attl0002.c + * + * manipulation of attribute lists + * + get a pointer to a pointer to an attribute element + * + * written: 1994-03-26 + * latest update: 1997-11-02 12:51:13 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/attlist.h> + +/* ------------------------------------------------------------------------ */ +struct ATTRIBUTE_LIST **al_getp_attribute ( +struct ATTRIBUTE_LIST **alp, +char *name) +{ + struct ATTRIBUTE_LIST *al; + + for (; (al= *alp) != (struct ATTRIBUTE_LIST *) 0; alp= &al->AL_next) + { + if (strcmp (al->AL_name, name) == 0) + { +fprintf (stderr, ">>> attrib %s found\n", name); + return alp; + } + } + + return alp; +} diff --git a/lib/ds/attlist/attl0002.o b/lib/ds/attlist/attl0002.o new file mode 100644 index 0000000000000000000000000000000000000000..4521c21ef31c14f57d117e5029c4e4a48bd8f4f3 Binary files /dev/null and b/lib/ds/attlist/attl0002.o differ diff --git a/lib/ds/attlist/attl0003.c b/lib/ds/attlist/attl0003.c new file mode 100644 index 0000000000000000000000000000000000000000..e3d5ba0e69b20747f84685eecce35ef1e69d1210 --- /dev/null +++ b/lib/ds/attlist/attl0003.c @@ -0,0 +1,47 @@ +/* + * FILE %ds/attlist/attl0003.c + * + * manipulation of attribute lists + * + set an attribute value + * + * written: 1994-03-26 + * latest update: 1997-11-02 12:51:45 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/attlist.h> + +/* ------------------------------------------------------------------------ */ +struct ATTRIBUTE_LIST *al_set_attribute ( +struct ATTRIBUTE_LIST **alp, +char *name, +char *attl, +long type, +void *value) +{ + struct ATTRIBUTE_LIST *al; + + if (alp == (struct ATTRIBUTE_LIST **) 0) return (struct ATTRIBUTE_LIST *) 0; + + alp= al_getp_attribute (alp, name); + al= *alp; + + if (al == (struct ATTRIBUTE_LIST *) 0) + { + *alp= al= al_create_attribute (name, attl, type, value); + } + else + { + if (al->AL_value != (void *) 0 + && al->AL_type == ALty_string_dup) free ((char *) al->AL_value); + + al->AL_value= ((al->AL_type= type) == ALty_string_dup) + ? (void *) strdup (value) + : value; + } + + return al; +} diff --git a/lib/ds/attlist/attl0003.o b/lib/ds/attlist/attl0003.o new file mode 100644 index 0000000000000000000000000000000000000000..9ce2baa6385c5ca0ea6d4c7b75744030da9aebda Binary files /dev/null and b/lib/ds/attlist/attl0003.o differ diff --git a/lib/ds/attlist/attl0004.c b/lib/ds/attlist/attl0004.c new file mode 100644 index 0000000000000000000000000000000000000000..51c0fe1aebf3b27fccfd068d6c65217802dd85f8 --- /dev/null +++ b/lib/ds/attlist/attl0004.c @@ -0,0 +1,25 @@ +/* + * FILE %ds/attlist/attl0004.c + * + * manipulation of attribute lists + * + find an attribute element + * + * written: 1994-03-26 + * latest update: 1997-11-02 12:52:16 + * + */ + +#include <gg/attlist.h> + +/* ------------------------------------------------------------------------ */ +struct ATTRIBUTE_LIST *al_find_attribute ( +struct ATTRIBUTE_LIST *al, +char *name) +{ + struct ATTRIBUTE_LIST **alp; + + if ((alp= al_getp_attribute (&al, name)) == (struct ATTRIBUTE_LIST **) 0) + return (struct ATTRIBUTE_LIST *) 0; + + return *alp; +} diff --git a/lib/ds/attlist/attl0004.o b/lib/ds/attlist/attl0004.o new file mode 100644 index 0000000000000000000000000000000000000000..e39135a189a0830edeec3daa5ac1ee7bc9f09d56 Binary files /dev/null and b/lib/ds/attlist/attl0004.o differ diff --git a/lib/ds/attlist/attl0005.c b/lib/ds/attlist/attl0005.c new file mode 100644 index 0000000000000000000000000000000000000000..c0219020c7875f9248fc2a0928aacafe4aa51f1d --- /dev/null +++ b/lib/ds/attlist/attl0005.c @@ -0,0 +1,99 @@ +/* + * FILE %ds/attlist/attl0005.c + * + * looking up info in a names file and convert it into a attribute list, + * but only attributes of a preset attribute list are filled in. + * + * written: 1992 04 07: as ~/usr/pctcp/namefile.c + * latest update: 1999-04-25 16:57:14 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/attlist.h> + +#define MAX_LINE 1024 +static char line [MAX_LINE]; +static char line2 [MAX_LINE]; +static char line3 [MAX_LINE]; + +/* ------------------------------------------------------------------------ */ +int al_find_name ( +char *name_file, +char *first_attribute, +char *nick, +struct ATTRIBUTE_LIST *ntl) +{ + FILE *fi; + int llng; + int nick_found= 0; + int items_found= 0; + char *tag; + int nick_length; + struct ATTRIBUTE_LIST *ntl2; + int AL_name_lng; + int i, j, j1; + + nick_length= strlen (nick); + if (nick_length <= 0) return -1; + + if ((fi= fopen (name_file, "rt")) == (FILE *) 0) return -1; + + for (;;) + { + fgets (line, MAX_LINE, fi); + if (feof (fi)) break; + if (line[0] == '*') continue; + + llng= strlen (line); + if (llng > 0 && line [llng-1] == '\n') line[--llng]=0; + strcpy (line2, line); + to_lower (line2); + + if ((tag= strstr (line2, first_attribute)) != (char *) 0) + { + tag += 6; + strcpy (line3, nick); + to_lower (line3); + nick_found= (strncmp (tag, line3, nick_length) == 0 + && (tag[nick_length] == ' ' || tag[nick_length] == 0)); + } + + if (nick_found) + { + for (i= 0; i<llng; i++) + if (line2[i] == ':') + { + for (ntl2 = ntl; + ntl2 != (struct ATTRIBUTE_LIST *) 0; + ntl2 = ntl2->AL_next) + { + AL_name_lng= strlen (ntl2->AL_name); + if (strncmp (&line2[i+1], ntl2->AL_name, AL_name_lng) == 0 + && line2 [i+AL_name_lng+1] == '.') + { + for (j1= j= i+AL_name_lng+2; line2[j] && line2[j] != ':'; j++); + for (j--; j>j1; j--) if (line2[j] != ' ') break; + tag= (void *) calloc (j-j1+5, 1); /* +1 sould do it... */ + strncpy (tag, &line[j1], j-j1+1); + tag [j-j1+1]= 0; + if (ntl2->AL_type == ALty_string_dup) + { + free ((char *) ntl2->AL_value); + } + ntl2->AL_value= (void *) tag; + ntl2->AL_type= ALty_string_dup; + items_found++; + } + } + } + } + } + + fclose (fi); + + return items_found; +} diff --git a/lib/ds/attlist/attl0005.o b/lib/ds/attlist/attl0005.o new file mode 100644 index 0000000000000000000000000000000000000000..f68a82ed8ad1e38865bf13036abd7c2ec2477e1c Binary files /dev/null and b/lib/ds/attlist/attl0005.o differ diff --git a/lib/ds/attlist/attl0006.c b/lib/ds/attlist/attl0006.c new file mode 100644 index 0000000000000000000000000000000000000000..8b59ae0db431745cfed0ba9dd9379a75a01cea51 --- /dev/null +++ b/lib/ds/attlist/attl0006.c @@ -0,0 +1,28 @@ +/* + * FILE %ds/attlist/attl0006.c + * + * manipulation of attribute lists + * + find an attribute element + * + * written: 1994-10-30 + * latest update: 1997-11-02 12:54:50 + * $Id: attl0006.c,v 1.2 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#include <gg/attlist.h> + +/* ------------------------------------------------------------------------ */ +void *al_find_attribute_value ( +struct ATTRIBUTE_LIST *al, +char *name) +{ + struct ATTRIBUTE_LIST **alp; + + if ((alp= al_getp_attribute (&al, name)) == (struct ATTRIBUTE_LIST **) 0 + || (al= *alp) == (struct ATTRIBUTE_LIST *) 0 + ) + return (void *) 0; + + return al->AL_value; +} diff --git a/lib/ds/attlist/attl0006.o b/lib/ds/attlist/attl0006.o new file mode 100644 index 0000000000000000000000000000000000000000..ddb154646da3dab0784a8db05ae3943fff91b8c6 Binary files /dev/null and b/lib/ds/attlist/attl0006.o differ diff --git a/lib/ds/attlist/attl0007.c b/lib/ds/attlist/attl0007.c new file mode 100644 index 0000000000000000000000000000000000000000..6d84487a925b03ec847656c379eede3ce1a18ab0 --- /dev/null +++ b/lib/ds/attlist/attl0007.c @@ -0,0 +1,167 @@ +/* + * FILE %ds/attlist/attl0007.c + * + * manipulation of attribute lists + * + parse an SGML like stream and produce a attribute list + * + * written: 1994-10-30 + * latest update: 1997-11-02 12:54:50 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/attlist.h> + +#define DEFAULT_BUFFER 2048 +#define TAGO '<' +#define TAGC '>' + +/* ------------------------------------------------------------------------ */ +struct ATTRIBUTE_LIST *al_parse_sgml_stream ( +FILE *fi, +long size, +char *buffer, +int buffer_size) +{ + struct ATTRIBUTE_LIST *al_rv= (struct ATTRIBUTE_LIST *) 0; + struct ATTRIBUTE_LIST *al_new; + int ba= 0; + int ch; + int idx; +#define STATE_START 0 +#define STATE_TAGO 1 +#define STATE_TAGCH 2 +#define STATE_ATTL1 3 +#define STATE_ATTL2 4 +#define STATE_TAGCL 5 +#define STATE_TEXT 6 + int state= STATE_START; + + char *name= (char *) 0; + char *attl= (char *) 0; + + if (buffer == (char *) 0 || buffer_size <= 0) + { + if ((buffer= malloc (buffer_size= DEFAULT_BUFFER)) == (char *) 0) + goto END; + ba= 1; + } + + for (;;) + { + if (size > 0L) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) ch= -1; + size--; + if (ch == '\015') continue; + } + else ch= -1; + + if (ch == -1) + { + /*************************** + if (state != STATE_START && state != STATE_TAGCL + && state != STATE_TEXT) + -> ERROR + ***************************/ + + goto END; + } + + switch (state) + { + case STATE_START: + switch (ch) + { + case ' ': case '\t': case '\n': break; + case TAGO: state= STATE_TAGO; break; + default: /* text before the first tag! */ break; + } + break; + + case STATE_TAGO: + switch (ch) + { + case ' ': case '\t': case '\n': + /* this should not really happen; TAGO as part of text! */ + break; + case TAGC: /* empty tag like m#< *># */ + state= STATE_TAGCL; + break; + default: + buffer [idx= 0]= (char) ch; + state= STATE_TAGCH; + break; + } + break; + + case STATE_TAGCH: + switch (ch) + { + case ' ': case '\t': case '\n': + state= STATE_ATTL1; + buffer [idx]= 0; + name= strdup (buffer); + break; + case TAGC: + state= STATE_TAGCL; + buffer [idx]= 0; + name= strdup (buffer); + break; + default: + buffer [idx++]= (char) ch; + break; + } + break; + + case STATE_ATTL1: + switch (ch) + { + case ' ': case '\t': case '\n': break; + case TAGC: /* no attribute list, like m#<xyz +># */ + state= STATE_TAGCL; + break; + default: + buffer [idx= 0]= (char) ch; + state= STATE_ATTL2; + break; + } + break; + + case STATE_TAGCH: + switch (ch) + { + case TAGC: + state= STATE_TAGCL; + buffer [idx]= 0; + attl= strdup (buffer); + break; + default: + buffer [idx++]= (char) ch; + break; + } + break; + + case STATE_TAGCL: + switch (ch) + { + default: + state= STATE_TEXT; + buffer [idx= 0]= (char) ch; + break; + } + break; + + al_new= al_create_attribute ( + } + + if (ch == -1) break; + } + +END: + if (ba) free (buffer); + + return al_rv; +} diff --git a/lib/ds/attlist/attl0008.c b/lib/ds/attlist/attl0008.c new file mode 100644 index 0000000000000000000000000000000000000000..203ebc53aea46881019d2146f530d87986b95741 --- /dev/null +++ b/lib/ds/attlist/attl0008.c @@ -0,0 +1,41 @@ +/* + * FILE %ds/attlist/attl0008.c + * + * manipulation of attribute lists + * + creation of new attribute elements + * + * written: 2002-04-20 + * latest update: 2002-04-20 18:37:36 + * $Id: attl0008.c,v 1.1 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/attlist.h> + +/* ------------------------------------------------------------------------ */ +int al_add_attribute ( +ATTLIST *al, +char *name, +char *attl, +long type, +void *value) +{ + struct ATTRIBUTE_LIST *al2; + + if (al == (ATTLIST *) 0 + || (al2= al_create_attribute (name, attl, type, value)) + == (struct ATTRIBUTE_LIST *) 0 + ) + { + return -1; + } + + *(al->AL_append)= al2; + al->AL_append= &al2->AL_next; + + return 0; +} diff --git a/lib/ds/attlist/attl0008.o b/lib/ds/attlist/attl0008.o new file mode 100644 index 0000000000000000000000000000000000000000..e2005293fc4b5674830979a272e1d01559ea7e50 Binary files /dev/null and b/lib/ds/attlist/attl0008.o differ diff --git a/lib/ds/attlist/attl0009.c b/lib/ds/attlist/attl0009.c new file mode 100644 index 0000000000000000000000000000000000000000..682105f41b5e97abdbe9b91ad3268bed5f4a9b7a --- /dev/null +++ b/lib/ds/attlist/attl0009.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/attlist/attl0009.c + * + * manipulation of attribute lists + * + creation of new attribute lists + * + * written: 2002-04-20 + * latest update: 2002-04-20 18:37:36 + * $Id: attl0009.c,v 1.1 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/attlist.h> + +/* ------------------------------------------------------------------------ */ +ATTLIST *new_ATTLIST (void) +{ + ATTLIST *al; + + if ((al= (ATTLIST *) calloc (sizeof (ATTLIST), 1)) == (ATTLIST *) 0) + return (ATTLIST *) 0; + + al->AL_append= &al->AL_start; + + return al; +} + diff --git a/lib/ds/attlist/attl0009.o b/lib/ds/attlist/attl0009.o new file mode 100644 index 0000000000000000000000000000000000000000..242bcd8604c8f41eb319a94b10638f4cf95ef1e3 Binary files /dev/null and b/lib/ds/attlist/attl0009.o differ diff --git a/lib/ds/attlist/contrib b/lib/ds/attlist/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/attlist/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/attlist/gg b/lib/ds/attlist/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/attlist/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/attlist/lib b/lib/ds/attlist/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/attlist/libgg.a b/lib/ds/attlist/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/attlist/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/attlist/make-dos b/lib/ds/attlist/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..eb01585fecc5dfe6c0a657cea5af716bd41e7429 --- /dev/null +++ b/lib/ds/attlist/make-dos @@ -0,0 +1,22 @@ +# +# FILE %ds/attlist/makefile +# +# manipulation of attribute lists +# +# written: 1994-03-26 +# latest update: 1995-12-20 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : ! + attl0001.obj attl0002.obj attl0003.obj attl0004.obj attl0005.obj ! + attl0006.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/bbc/(dirinf).fm b/lib/ds/bbc/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..e076fcdf4bba49cc0c6fc26ae80514e4cc4608d5 --- /dev/null +++ b/lib/ds/bbc/(dirinf).fm @@ -0,0 +1,42 @@ +# +# FILE %ds/bbc/(dirinf).fm +# +. Black Board Controller +# +# written: 1996-03-25 +# latest update: 1996-12-01 16:03:36 +# $Id: (dirinf).fm,v 1.2 2003/06/25 03:09:53 gonter Exp $ +# + +# see also: <gg/bbch.h> +(dirinf).fm Contents +Makefile current version of Makfile +make-dos DOS version of Makefile +make-ux Unix version of Makefile + +bbcd.doc current docs + +bbc.c black board controller: main program + +bbc01.c int bbc_main (struct BBC_SESSION *bbcs, ...) +bbc02.c void inet_netnames (int sockfd, char *host_name, char *ipnum); +bbc03.c struct BBC_CONNECTION *bbc_init_connection (...) +bbc04.c int bbc_authentication_protocol (void *client_data, ...) +bbc05.c int bbc_chex (struct BBC_SESSION *bbcs, ...) +bbc06.c int bbc_diag_conn (FILE *fo, struct BBC_CONNECTION *bbcc); +bbc07.c int bbc_lexicon_processor (void *client_data, ...) +bbc08.c int bbc_get_request (struct BBC_CONNECTION *bbcc, char *buffer); +bbc09.c struct BBC_LISTEN *bbc_server (int port); +bbc10.c struct BBC_CONNECTION *bbc_connect (...) +bbc11.c int bbc_challenge (struct BBC_SESSION *bbcs, ...) +bbc12.c int bbc_to_stdout (void *client_data, ...) +bbc13.c int bbc_transmit_text (void *cd, struct TEXT_ELEMENT *te); +bbc14.c struct BBC_SESSION *bbc_new_session () +bbc15.c int bbc_acceptor (void *client_data) + +bbc16.c ... fehlt + +bbct1.c test program 1 + +bbc*.c black board controller +# diff --git a/lib/ds/bbc/.cvsignore b/lib/ds/bbc/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..f4988069593e50b7b2f763a6095047155d1515aa --- /dev/null +++ b/lib/ds/bbc/.cvsignore @@ -0,0 +1,3 @@ +bbc +bbct1 +.kredenz.tfb diff --git a/lib/ds/bbc/Makefile b/lib/ds/bbc/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..1c66a1745daec52a6c64bc572de34e0e0f000bb1 --- /dev/null +++ b/lib/ds/bbc/Makefile @@ -0,0 +1,49 @@ +# +# FILE %ds/bbc/make-ux (Makefile) +# +# Makefile fuer Unix +# +# written: 1996-03-25 +# latest update: 1999-05-08 9:37:10 +# $Id: Makefile,v 1.4 2003/10/01 21:52:01 gonter Exp $ +# +# ============================================================================ +CC=cc +OPTS=-I. -g #-DDEBUGG1 -DDIAGNOSTICS +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +# BIN=/usr/local/bin +DEST=/usr/local/bin +BINS=bbc# bbcinetd +lib=../../libgg.a +LIBS= +# For SINIX 5.41 you need also these: +# LIBS=-lnsl -lresolv -lsocket -lksocket + +all : lib + +all.exe : lib $(BINS) $(BINS2) + +install : ${BINS} + cp ${BINS} ${DEST} + +clean : + rm -f *.o lib + +# ---------------------------------------------------------------------------- +lib1=bbc01.o bbc02.o bbc03.o bbc04.o bbc05.o bbc06.o \ + bbc07.o bbc08.o bbc09.o bbc10.o bbc11.o bbc12.o \ + bbc13.o bbc14.o bbc15.o + +lib : $(lib1) + ar ru $(lib) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $? + +# production programs: ------------------------------------------------------- +bbc: bbc.o ${lib} + cc -o bbc bbc.o ${lib} ${LIBS} + +bbct1: bbct1.o ${lib} + cc -o bbct1 bbct1.o ${lib} ${LIBS} diff --git a/lib/ds/bbc/bbc.c b/lib/ds/bbc/bbc.c new file mode 100644 index 0000000000000000000000000000000000000000..699968cd169f40028705edff621576ce1f10ca29 --- /dev/null +++ b/lib/ds/bbc/bbc.c @@ -0,0 +1,160 @@ +/* + * FILE %ds/bbc/bbc.c + * + * Black Board Controller + * - HELP + * + * written: 1995-08-03 + * latest update: 1999-05-09 18:03:20 + * $Id: bbc.c,v 1.4 2003/06/25 10:11:44 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/dpp.h> +#include <gg/bbch.h> + +/* ------------------------------------------------------------------------ */ +#define GPL +static char *HELP []= +{ + "USAGE: bbc [options]\n", + " Black Board Controller\n", + "OPTIONS:\n", + " -a ... anonymous (PUBLIC challenge, OPEN encryption)\n", + " -h<host> ... host name to connect to\n", + " -p<num> ... port number\n", + " -d ... operate as daemon\n", + " -i ... ignore stdin\n", + " -k<fnm> ... key file name\n", + " -f<name> ... name of my object (from)\n", + " -t<name> ... name of the target object (to)\n", + " -r<name> ... name of the target resource (what)\n", + " -v ... verbose mode\n", + "\n", + "(@)Abbc.c 1.03 #D$1995-08-21 12:00:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + struct BBC_SESSION *bbcs; + int verbose_mode= 0; +#define OP_MODE_undef 0 +#define OP_MODE_daemon 1 +#define OP_MODE_client 2 + int op_mode= OP_MODE_undef; + int port_number= 12345; + int proc_stdin= 1; + int is_public= 0; + char *arg; + char *key_file= ".kredenz.tfb"; + char *host_name= (char *) 0; + char *my_name= "bbc.c"; + char *target_name= (char *) 0; + char *target_resource= (char *) 0; + char *my_resource= (char *) 0; + char *public_resource= "urxn"; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + { + char *arg2= arg+2; + + switch (arg [1]) + { + case 'a': case 'A': + is_public= 1; + break; + + case 'h': case 'H': + op_mode= OP_MODE_client; + host_name= arg2; + break; + + case 'k': case 'K': + key_file= arg2; + break; + + case 'f': case 'F': + my_name= arg2; + break; + + case 't': case 'T': + target_name= arg2; + break; + + case 'r': case 'R': + target_resource= arg2; + break; + + case 'p': case 'P': + if (*arg2 == 0) break; + port_number= (int) get_parameter_value (arg2); + break; + + case 'd': case 'D': + case 'i': case 'I': + case 'v': case 'V': + for (j= 1; arg [j]; j++) + switch (arg [j]) + { + case 'd': case 'D': + op_mode= OP_MODE_daemon; + break; + case 'i': case 'I': + proc_stdin= 0; + break; + case 'v': case 'V': + verbose_mode++; + break; + default: + fprintf (stderr, "unknown option %c\n", arg [j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + } + } + + if ((bbcs= bbc_new_session ()) == (struct BBC_SESSION *) 0) + { + fprintf (stderr, "could not establish BBC session\n"); + return -1; + } + + switch (op_mode) + { + case OP_MODE_daemon: + case OP_MODE_client: + bbcs->BBCS_key_file= key_file; + bbcs->BBCS_my_name= my_name; + bbcs->BBCS_my_resource= my_resource; + bbcs->BBCS_public_resource= public_resource; + + bbc_main (bbcs, host_name, port_number, proc_stdin, + target_name, target_resource); + break; + + default: + goto HLP; + } + + return 0; +} diff --git a/lib/ds/bbc/bbc01.c b/lib/ds/bbc/bbc01.c new file mode 100644 index 0000000000000000000000000000000000000000..ad90198b14c0a65a5d661c462942da030b6cb927 --- /dev/null +++ b/lib/ds/bbc/bbc01.c @@ -0,0 +1,245 @@ +/* + * FILE %ds/bbc/bbc01.c + * + * open a TCP connection and transfer data in both directions + * + * externaly defined macros: + * - DIAGNOSTICS write transfer protocol to stderr + * + * written: 1995-08-03 + * latest update: 1999-11-28 10:03:00 + * $Id: bbc01.c,v 1.9 2003/10/01 21:52:01 gonter Exp $ + * + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <time.h> +#include <signal.h> + +#include <sys/types.h> +#ifdef _AIX32 +#include <sys/select.h> /* AIX 3 defines fd_set there, */ + /* AIX 4 defines fd_set in <sys/time.h> ! */ +#endif +#include <sys/socket.h> +#include <netinet/in.h> +#include <netdb.h> + +#include <gg/ggcrypt.h> +#include <gg/dirty.h> +#include <gg/bbch.h> + +/* #define DIAGNOSTICS */ + +static int shutdown_flag= 0; /* 1 -> shutdown asap */ + +/* ------------------------------------------------------------------------ */ +void bbc_sig_term (int sig) +{ + shutdown_flag= 1; +} + +/* ------------------------------------------------------------------------ */ +int bbc_main ( /* main network event loop processor */ +struct BBC_SESSION *bbcs, /* session descriptor */ +char *server, /* host name to connect to or NIL, if srv. */ +int port, /* port to connect to or listen on */ +int proc_stdin, /* 1 -> stdin needs to be watched */ +char *target_name, /* name of opposite object entity */ +char *target_resource) /* name of opposite object resource */ +{ /* */ + int num_in_socks= 0; /* number of currently established conns. */ + int doit= 1; /* event loop keeps running */ + int rv= 0; /* return code of this function */ + int rc; /* return code obtained by called functions */ + int primary_socket= -1; /* peer socket, first on, if defined ... */ + /* ... peer socket receives data from stdin */ + char *buffer; /* buffer to keep incoming data */ +#ifdef _AIX42 /* addr_len is int in FreeBSD, Linux */ + size_t addr_len; /* length of peer socket address record */ +#else + int addr_len; /* length of peer socket address record */ +#endif + struct sockaddr_in other; /* peer socket address record from accept */ + struct BBC_CONNECTION *bbcc; /* examined peer connection */ + struct BBC_CONNECTION *prim; /* primary peer connection */ + struct BBC_LISTEN *bbcl= /* socket where server listens on, ... */ + (struct BBC_LISTEN *) 0; /* ... if operating as a server */ + BBC_input *input_handler; /* processor to hand incoming data over */ + fd_set mask; /* currently returned fd mask */ + fd_set mask_save; /* save fd mask */ + +#ifdef DIAGNOSTICS + fprintf (stderr, "bbc_main (): proc_stdin=%d\n", proc_stdin); +#endif + + if (bbcs == (struct BBC_SESSION *) 0) return -1; + buffer= bbcs->BBCS_buffer; + + FD_ZERO (&mask_save); + + if (server == (char *) 0 || *server == 0) + { + if ((bbcl= bbc_server (port)) == (struct BBC_LISTEN *) 0) return -1; + +printf ("socket: listen %d\n", bbcl->BBCL_socket); + FD_SET (bbcl->BBCL_socket, &mask_save); + num_in_socks++; + } + else + { + if ((bbcc= bbc_connect (bbcs, server, port, target_name, target_resource)) + == (struct BBC_CONNECTION *) 0) return -1; + +printf ("socket: connect %d\n", bbcc->BBCC_socket); + FD_SET (bbcc->BBCC_socket, &mask_save); + num_in_socks++; + } + + if (doit) + { + signal (SIGTERM, bbc_sig_term); + } + + while (doit && !shutdown_flag) + { +#ifdef DIAGNOSTICS + fprintf (stderr, "bbc_main (): main loop 1\n"); +#endif + + memcpy (&mask, &mask_save, sizeof (fd_set)); + rc= select (32, &mask, (fd_set *) 0, (fd_set *) 0, (struct timeval *) 0); + +#ifdef DIAGNOSTICS + fprintf (stderr, "bbc_main (): main loop 2; rc=%d\n", rc); +#endif + + if (bbcl != (struct BBC_LISTEN *) 0 + && FD_ISSET (bbcl->BBCL_socket, &mask) + ) + { /* established server connections */ + rc= accept (bbcl->BBCL_socket, (struct sockaddr *) &other, &addr_len); + if (rc == -1) + { + fprintf (stderr, "accept: rc=%d errno=%d shutdown_flag=%d\n", + rc, errno, shutdown_flag); + } + else + { + if ((bbcc= bbc_init_connection (bbcs, rc)) + != (struct BBC_CONNECTION *) 0) + { + fprintf (stderr, "connection [%d] from %s (%s)\n", + num_in_socks++, + bbcc->BBCC_peer_host, bbcc->BBCC_peer_ipnum); + + printf ("socket: incoming %d; shutdown_flag=%d\n", + bbcc->BBCC_socket, shutdown_flag); + + FD_SET (bbcc->BBCC_socket, &mask_save); + bbcc->BBCC_connection_mode= BBCCcm_called; + + } + } + } + + /* check established incoming connections */ + for (bbcc= bbcs->BBCS_connections; + bbcc != (struct BBC_CONNECTION *) 0; + bbcc= bbcc->BBCC_next) + { + int s; + s= bbcc->BBCC_socket; +/** fprintf (stderr, "s='%d'\n", s); **/ + if (s == -1) + { /* T2D: removed dead connection */ + continue; + } + + if (FD_ISSET (bbcc->BBCC_socket, &mask)) + { + rc= read (bbcc->BBCC_socket, buffer, BBCS_BUFFER_SIZE); +/** fprintf (stderr, "s='%d' ISSET rc=%d\n", s, rc); **/ + + if (rc > 0) + { + if ((input_handler= bbcc->BBCC_input1) != (BBC_input *) 0) + (*input_handler) ((void *) bbcc, buffer, rc); + + switch (bbcc->BBCC_t2d) + { + case BBCCt2d_shutdown: rc= -1; break; + case BBCCt2d_pushup: + if (proc_stdin && primary_socket == -1) + { + FD_SET (0, &mask_save); + primary_socket= bbcc->BBCC_socket; + prim= bbcc; + } + break; + } + } + + if (rc <= 0) /* rc == 0: EOF; rc == -1: ERROR */ + { /* *** T2D: close that connection */ + fprintf (stderr, "closing connection from %s (%s) [rc=%d]\n", + bbcc->BBCC_peer_host, bbcc->BBCC_peer_ipnum, rc); + + num_in_socks--; + if (num_in_socks == 0) doit= 0; + + if (bbcc->BBCC_socket == primary_socket) + { /* T2D: check if this makes sense */ + primary_socket= -1; + prim= (struct BBC_CONNECTION *) 0; + + /* don't shut down server if client goes away, but the client */ + /* should shut down, if the server closes the connection. */ + if (server != (char *) 0) doit= 0; + } + + FD_CLR (bbcc->BBCC_socket, &mask_save); + close (bbcc->BBCC_socket); + bbcc->BBCC_socket= -1; + } + } + } + + if (FD_ISSET (0, &mask)) /* pipe from stdin */ + { + rc= read (0, buffer, BBCS_BUFFER_SIZE); + if (rc <= 0) doit= 0; + +#ifdef DIAGNOSTICS + fprintf (stderr, "<<<< DIAG: %d bytes stdin to net\n", rc); + dump (stderr, buffer, rc); +#endif + + if (primary_socket > -1) + { + ggc_block_cfb (&prim->BBCC_s_o2p, buffer, rc); + write (primary_socket, buffer, rc); + } + } + } + + printf ("bbc01: shutdown_flag=%d\n", shutdown_flag); + if (bbcl != (struct BBC_LISTEN *) 0) close (bbcl->BBCL_socket); + + for (bbcc= bbcs->BBCS_connections; + bbcc != (struct BBC_CONNECTION *) 0; + bbcc= bbcc->BBCC_next) + { + if (bbcc->BBCC_socket >= 0) + { + close (bbcc->BBCC_socket); + bbcc->BBCC_socket= -1; + } + } + + return rv; +} diff --git a/lib/ds/bbc/bbc01.o b/lib/ds/bbc/bbc01.o new file mode 100644 index 0000000000000000000000000000000000000000..bcc2dc13f5c54f2fa453a083455575a4f1c17506 Binary files /dev/null and b/lib/ds/bbc/bbc01.o differ diff --git a/lib/ds/bbc/bbc02.c b/lib/ds/bbc/bbc02.c new file mode 100644 index 0000000000000000000000000000000000000000..2b97b78e2a6c1bff5a4d7e42255c9d41b7fb9e15 --- /dev/null +++ b/lib/ds/bbc/bbc02.c @@ -0,0 +1,58 @@ +/* + * FILE %ds/bbc/bbc02.c + * + * Code stolen from nntp by gopherd developers..... + * + * written: 1995-08-03 + * latest update: 1996-12-15 18:13:08 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <time.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <netdb.h> + +/* + * + * inet_netnames -- return the network, subnet, and host names of + * our peer process for the Internet domain. + * + * Parameters: "sock" is our socket + * "host_name" + * is filled in by this routine with the + * corresponding ASCII names of our peer. + * + * if there doesn't exist a hostname in DNS etal, + * the IP# will be inserted for the host_name + * + * "ipnum" is filled in with the ascii IP# + * Returns: Nothing. + * Side effects: None. + */ + +void inet_netnames ( +int sockfd, +char *host_name, +char *ipnum) +{ + struct sockaddr_in sa; + int length; + struct hostent *hp; + + length= sizeof(sa); + getpeername (sockfd, (struct sockaddr *) &sa, &length); + strcpy (ipnum, inet_ntoa (sa.sin_addr)); + strcpy (host_name, ipnum); + + hp= gethostbyaddr ((char *) &sa.sin_addr, + sizeof (sa.sin_addr.s_addr), AF_INET); + + if (hp != NULL) (void) strcpy (host_name, hp->h_name); +} diff --git a/lib/ds/bbc/bbc02.o b/lib/ds/bbc/bbc02.o new file mode 100644 index 0000000000000000000000000000000000000000..4f9b5a34109e32131c35b8f0f1ba397d1ff873b2 Binary files /dev/null and b/lib/ds/bbc/bbc02.o differ diff --git a/lib/ds/bbc/bbc03.c b/lib/ds/bbc/bbc03.c new file mode 100644 index 0000000000000000000000000000000000000000..e9451f949010fd678c57cfbde8ad6958feed3a5a --- /dev/null +++ b/lib/ds/bbc/bbc03.c @@ -0,0 +1,58 @@ +/* + * FILE %ds/bbc/bbc03.c + * + * Setup connection descriptor for an established connection. + * This function is used for incoming and outgoing connections. + * + * written: 1995-08-03 + * latest update: 1999-05-12 15:11:27 + * $Id: bbc03.c,v 1.4 2003/06/25 03:09:53 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/bbch.h> + +/* ------------------------------------------------------------------------ */ +struct BBC_CONNECTION *bbc_init_connection ( +struct BBC_SESSION *bbcs, +int sock) +{ + struct BBC_CONNECTION *nbc; + char peer_host [MAX_HN_LNG]; + char peer_ipnum [MAX_HN_LNG]; + + if ((nbc= bbc_new_connection ()) == (struct BBC_CONNECTION *) 0) + return (struct BBC_CONNECTION *) 0; + + inet_netnames (sock, peer_host, peer_ipnum); + + /* link new connection into session control and vica versa */ + nbc->BBCC_bbcs= (void *) bbcs; + nbc->BBCC_next= bbcs->BBCS_connections; + bbcs->BBCS_connections= nbc; + + nbc->BBCC_peer_host= strdup (peer_host); + nbc->BBCC_peer_ipnum= strdup (peer_ipnum); + + nbc->BBCC_socket= sock; + + /* inheritance of various methods */ + nbc->BBCC_accept= bbcs->BBCS_accept; + nbc->BBCC_input1= bbcs->BBCS_input1; + nbc->BBCC_input2= bbcs->BBCS_input2; + nbc->BBCC_client_data1= bbcs->BBCS_client_data1; + nbc->BBCC_op= bbcs->BBCS_op; + + /* setup challenges just to be on the safe side */ + mk_PassWord (peer_host, 16); + nbc->BBCC_opening_challenge= strdup (peer_host); + mk_PassWord (peer_host, 16); + nbc->BBCC_s_o2p.GGC_challenge= strdup (peer_host); + mk_PassWord (peer_host, 16); + nbc->BBCC_s_p2o.GGC_challenge= strdup (peer_host); + + return nbc; +} diff --git a/lib/ds/bbc/bbc03.o b/lib/ds/bbc/bbc03.o new file mode 100644 index 0000000000000000000000000000000000000000..e1ca6ea2c3fe719c0eda181d5f724165a0ad58d5 Binary files /dev/null and b/lib/ds/bbc/bbc03.o differ diff --git a/lib/ds/bbc/bbc04.c b/lib/ds/bbc/bbc04.c new file mode 100644 index 0000000000000000000000000000000000000000..c25e8e5774a2fb99ba81744d4411a89c836a5e42 --- /dev/null +++ b/lib/ds/bbc/bbc04.c @@ -0,0 +1,220 @@ +/* + * FILE %ds/bbc/bbc04.c + * + * BBC core authentication protocl + * + * This is the main protocol engine for the target as + * well as the initiator that + * - takes care of the initial exchange of credentials + * - sets up the session keys + * - exchanges a block of random data + * - receives incoming data + * + * written: 1995-08-03 + * latest update: 1997-03-23 10:41:37 + * $Id: bbc04.c,v 1.5 2003/10/01 21:52:01 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <unistd.h> +#include <gg/dirty.h> +#include <gg/ggcrypt.h> +#include <gg/bbch.h> +#include <gg/strings.h> + +/* #define DEBUGG1 */ + +/* ------------------------------------------------------------------------ */ +int bbc_authentication_protocol ( +void *client_data, +char *buffer, +int buffer_size) +{ + struct BBC_CONNECTION *bbcc; /* connection currently processed */ + struct BBC_SESSION *bbcs; + BBC_input *input_handler; + int rc; + char *cp; + char *xmit_buffer; + + if ((bbcc= (struct BBC_CONNECTION *) client_data) + == (struct BBC_CONNECTION *) 0 + || (bbcs= (struct BBC_SESSION *) bbcc->BBCC_bbcs) + == (struct BBC_SESSION *) 0 + ) return -1; + + xmit_buffer= bbcs->BBCS_buffer; + bbcc->BBCC_t2d= BBCCt2d_nothing; + +#ifdef DEBUGG1 + fprintf (stderr, ">>>> DIAG: %d bytes from %s\n", + buffer_size, bbcc->BBCC_peer_host); + + dump (stderr, buffer, (int) buffer_size); + /* write (1, buffer, (int) buffer_size); */ +#endif /* DEBUGG1 */ + + switch (bbcc->BBCC_status) + { + case BBCCst_target: + buffer [buffer_size]= 0; +#ifdef DEBUGG1 + fprintf (stderr, ">>> opening string: '%s'\n", buffer); +#endif /* DEBUGG1 */ + rc= bbc_get_request (bbcc, buffer); +#ifdef DEBUGG1 + fprintf (stderr, ">>> rc=%d\n", rc); +#endif /* DEBUGG1 */ + if (rc != 0) goto FAILED; + + sprintf (xmit_buffer, + "BBC:ACCEPT:%s:%s:pleased to meet you, %.32s.\n", + bbcc->BBCC_opening_challenge, + bbcc->BBCC_s_o2p.GGC_challenge, + bbcc->BBCC_peer_host); + + write (bbcc->BBCC_socket, xmit_buffer, strlen (xmit_buffer)); + bbcc->BBCC_status= BBCCst_target2; + break; + + case BBCCst_target2: + buffer [buffer_size]= 0; +#ifdef DEBUGG1 + fprintf (stderr, ">>> opening string: '%s'\n", buffer); +#endif /* DEBUGG1 */ + rc= bbc_chex (bbcs, bbcc, buffer); +#ifdef DEBUGG1 + fprintf (stderr, ">>> rc=%d\n", rc); +#endif /* DEBUGG1 */ + + if (rc == 0) + { +#ifdef DEBUGG1 + bbc_diag_conn (stdout, bbcc); +#endif /* DEBUGG1 */ + bbcc->BBCC_status= BBCCst_target_wait_random; + cp= "BBC:OK:let's go...\n"; + } + else + { +FAILED: + bbcc->BBCC_status= BBCCst_failed; + bbcc->BBCC_t2d= BBCCt2d_shutdown; + cp= "BBC:FAILED:sorry.\n"; + } + write (bbcc->BBCC_socket, cp, strlen (cp)); + return 0; + + case BBCCst_target_wait_random: + /* This is the target which receives a block of random data */ + /* and answers with another block of random data. */ + /* After that, the communication channel is set up completely. */ + + ggc_block_cfb (&bbcc->BBCC_s_p2o, buffer, buffer_size); + mk_PassWord (xmit_buffer, RANDOM_SIZE); + xmit_buffer [RANDOM_SIZE]= '\n'; + ggc_block_cfb (&bbcc->BBCC_s_o2p, buffer, RANDOM_SIZE+1); + write (bbcc->BBCC_socket, xmit_buffer, RANDOM_SIZE+1); + + bbcc->BBCC_status= BBCCst_ok; + bbcc->BBCC_t2d= BBCCt2d_pushup; + + /* T2D: flush method! */ + /* T2D: shutdown method! */ + if (strcmp (bbcc->BBCC_resource, "shutdown") == 0) + { + bbc_sig_term (15); + printf ("shutdown_flag set!\n"); + bbcc->BBCC_t2d= BBCCt2d_shutdown; + } + + break; + + case BBCCst_initiator: + buffer [buffer_size]= 0; +#ifdef DEBUGG1 + fprintf (stderr, ">>> opening string: '%s'\n", buffer); +#endif /* DEBUGG1 */ + rc= bbc_challenge (bbcs, bbcc, buffer); +#ifdef DEBUGG1 + fprintf (stderr, ">>> rc=%d\n", rc); +#endif /* DEBUGG1 */ + + if (rc != 0) goto FAILED; + + /* BBC_CONNECTION */ + bbcc->BBCC_status= BBCCst_wait; + sprintf (xmit_buffer, + "BBC:CONNECT:%s:%s:%s:%s:%s:hi.\n", + bbcc->BBCC_from, bbcc->BBCC_to, + bbcc->BBCC_resource, bbcc->BBCC_chex_string, + bbcc->BBCC_s_o2p.GGC_challenge); + write (bbcc->BBCC_socket, xmit_buffer, strlen (xmit_buffer)); + return 0; + + case BBCCst_wait: + if (strncmp (buffer, "BBC:OK:", 7) != 0) goto FAILED; + + /* set session key for communication from peer to this object */ + ggc_set_session_key (&bbcc->BBCC_s_p2o, bbcs->BBCS_key_file, + bbcc->BBCC_from, bbcc->BBCC_to, + bbcc->BBCC_resource); + + /* set session key for communication from this object to peer */ + ggc_set_session_key (&bbcc->BBCC_s_o2p, bbcs->BBCS_key_file, + bbcc->BBCC_from, bbcc->BBCC_to, + bbcc->BBCC_resource); + + bbcc->BBCC_status= BBCCst_initiator_wait_random; + + mk_PassWord (xmit_buffer, RANDOM_SIZE); + xmit_buffer [RANDOM_SIZE]= '\n'; + ggc_block_cfb (&bbcc->BBCC_s_o2p, buffer, RANDOM_SIZE+1); + write (bbcc->BBCC_socket, xmit_buffer, RANDOM_SIZE+1); +#ifdef DEBUGG1 + bbc_diag_conn (stdout, bbcc); +#endif /* DEBUGG1 */ + return 0; + + case BBCCst_initiator_wait_random: + /* This is the initiatar which waits for the target to send */ + /* its block of random data. */ + /* After that, the communication channel is set up completely. */ + + /* T2D: does not check if the buffer has the right size! */ + + ggc_block_cfb (&bbcc->BBCC_s_p2o, buffer, buffer_size); + bbcc->BBCC_status= BBCCst_ok; + bbcc->BBCC_t2d= BBCCt2d_pushup; + break; + + case BBCCst_ok: /* incoming data */ + ggc_block_cfb (&bbcc->BBCC_s_p2o, buffer, buffer_size); + +#ifdef DEBUGG1 + buffer [buffer_size]= 0; + fprintf (stderr, ">>> data: %s\n", buffer); +#endif /* DEBUGG1 */ + if ((input_handler= bbcc->BBCC_input2) != (BBC_input *) 0) + { +/** fprintf (stderr, "input_handler=0x%08lX\n", input_handler); **/ + (*input_handler) (client_data, buffer, buffer_size); + } + return 0; + + case BBCCst_failed: + buffer [buffer_size]= 0; + fprintf (stderr, ">>> junk: %d bytes\n", buffer_size); + dump (stderr, buffer, buffer_size); + return 0; + + default: + fprintf (stderr, "bbc04: internal error\n"); + return -1; + } + + return 0; +} diff --git a/lib/ds/bbc/bbc04.o b/lib/ds/bbc/bbc04.o new file mode 100644 index 0000000000000000000000000000000000000000..b3dad51bda2d620dcef1f316e4a3889b845e0a5e Binary files /dev/null and b/lib/ds/bbc/bbc04.o differ diff --git a/lib/ds/bbc/bbc05.c b/lib/ds/bbc/bbc05.c new file mode 100644 index 0000000000000000000000000000000000000000..61b5b5c965206ed953b96cb109f79586de9be8b4 --- /dev/null +++ b/lib/ds/bbc/bbc05.c @@ -0,0 +1,90 @@ +/* + * FILE %ds/bbc/bbc05.c + * + * written: 1995-08-04 + * latest update: 1996-12-01 15:52:59 + * $Id: bbc05.c,v 1.4 2003/06/25 10:11:44 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/filename.h> +#include <gg/strings.h> +#include <gg/ggcrypt.h> +#include <gg/dpp.h> +#include <gg/bbch.h> + +static char PUBLIC []= "PUBLIC"; + +/* ------------------------------------------------------------------------ */ +#ifdef DIAGNOSTICS +#define STRCMP(s1,s2) _strcmp(s1,s2,__LINE__) +#endif + +#ifdef STRCMP +static int _strcmp (char *s1, char *s2, int l) +{ + int rc; + fprintf (stderr, "strcmp [%d]: s1='%s'\n", l, s1); + fprintf (stderr, "strcmp [%d]: s2='%s'\n", l, s2); + rc= strcmp (s1, s2); + fprintf (stderr, "strcmp [%d]: rc='%d'\n", l, rc); + return rc; +} +#else +#define STRCMP strcmp +#endif + +/* ------------------------------------------------------------------------ */ +int bbc_chex ( +struct BBC_SESSION *bbcs, +struct BBC_CONNECTION *bbcc, +char *buffer) +{ + char *chex_string; +#define N_FIELDS 10 + char *fields [N_FIELDS]; + int field_count; + + fprintf (stderr, "# key_file= '%s'\n", bbcs->BBCS_key_file); + fprintf (stderr, "buffer='%s'\n", buffer); + + if ((field_count= split_string (buffer, ':', fields, N_FIELDS)) < 7 + || STRCMP (fields [0], "BBC") != 0 + || STRCMP (fields [1], "CONNECT") != 0 + ) return -1; + + /** fprintf (stderr, "op_ch='%s'\n", bbcc->BBCC_opening_challenge); **/ + /* T2D */ + if (STRCMP (bbcc->BBCC_opening_challenge, PUBLIC) != 0) + { + chex_string= agettok_get_challenge (bbcs->BBCS_key_file, + fields [2], fields [3], fields [4], + bbcc->BBCC_opening_challenge); + /*** fprintf (stderr, "chex_string='%s'\n", chex_string); ***/ + + if (chex_string == (char *) 0 + || STRCMP (fields [5], chex_string) != 0 + ) return -1; + } + + bbcc->BBCC_from= strdup (fields [2]); + bbcc->BBCC_to= strdup (fields [3]); + bbcc->BBCC_resource= strdup (fields [4]); + bbcc->BBCC_chex_string= strdup (fields [5]); + + bbcc->BBCC_s_p2o.GGC_challenge= strdup (fields [6]); + + /* set session key for communication from peer to this object */ + ggc_set_session_key (&bbcc->BBCC_s_p2o, bbcs->BBCS_key_file, + fields [2], fields [3], fields [4]); + + /* set session key for communication from this object to peer */ + ggc_set_session_key (&bbcc->BBCC_s_o2p, bbcs->BBCS_key_file, + fields [2], fields [3], fields [4]); + + + return 0; +} diff --git a/lib/ds/bbc/bbc05.o b/lib/ds/bbc/bbc05.o new file mode 100644 index 0000000000000000000000000000000000000000..65fc2686fa5c409625a9f8c4410754a7ac73e28a Binary files /dev/null and b/lib/ds/bbc/bbc05.o differ diff --git a/lib/ds/bbc/bbc06.c b/lib/ds/bbc/bbc06.c new file mode 100644 index 0000000000000000000000000000000000000000..89ef914d97173eddeefc53e1526290e259628401 --- /dev/null +++ b/lib/ds/bbc/bbc06.c @@ -0,0 +1,48 @@ +/* + * FILE %lexicon/bbc06.c + * + * written: 1995-08-04 + * latest update: 1995-08-17 + * $Id: bbc06.c,v 1.2 2003/06/25 03:09:53 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/ggcrypt.h> +#include <gg/dpp.h> +#include <gg/bbch.h> + +/* ------------------------------------------------------------------------ */ +int bbc_diag_conn_sess (FILE *fo, struct GG_CRYPT *ggc) +{ + char t [40]; + + fprintf (fo, "challenge: '%s'\n", ggc->GGC_challenge); + + if (ggc->GGC_key != (char *) 0) + { + fprintf (fo, "key_string: '%s'\n", ggc->GGC_key_str); + + bin_to_hex (ggc->GGC_key, t, 16); + fprintf (fo, "key_str (test): '%s'\n", t); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int bbc_diag_conn (FILE *fo, struct BBC_CONNECTION *bbcc) +{ + fprintf (fo, "from: '%s'\n", bbcc->BBCC_from); + fprintf (fo, "to: '%s'\n", bbcc->BBCC_to); + fprintf (fo, "resource: '%s'\n", bbcc->BBCC_resource); + fprintf (fo, "challenge: '%s'\n", bbcc->BBCC_opening_challenge); + fprintf (fo, "chex_string: '%s'\n", bbcc->BBCC_chex_string); + + fprintf (fo, "encryption object to peer:\n"); + bbc_diag_conn_sess (fo, &bbcc->BBCC_s_o2p); + fprintf (fo, "encryption peer to object:\n"); + bbc_diag_conn_sess (fo, &bbcc->BBCC_s_p2o); + + return 0; +} diff --git a/lib/ds/bbc/bbc06.o b/lib/ds/bbc/bbc06.o new file mode 100644 index 0000000000000000000000000000000000000000..7d51587f06cde6cec126e1f9ec6a97bb62503f64 Binary files /dev/null and b/lib/ds/bbc/bbc06.o differ diff --git a/lib/ds/bbc/bbc07.c b/lib/ds/bbc/bbc07.c new file mode 100644 index 0000000000000000000000000000000000000000..e4799d45427fa18c0eeed1c5edcc75ce4e4a37fd --- /dev/null +++ b/lib/ds/bbc/bbc07.c @@ -0,0 +1,112 @@ +/* + * FILE %lexicon/bbc07.c + * + * written: 1995-08-03 + * latest update: 1996-10-10 0:13:35 + * $Id: bbc07.c,v 1.5 2003/10/01 21:52:01 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <unistd.h> +#include <signal.h> +#include <gg/dirty.h> +#include <gg/sbr.h> +#include <gg/hytxt.h> +#include <gg/parse.h> +#include <gg/bbch.h> + +/* ------------------------------------------------------------------------ */ +int bbc_lexicon_processor ( +void *client_data, +char *buffer, +int buffer_size) /* @@@ T2D ### buffer_size should be defined as long or so */ +{ + struct BBC_CONNECTION *bbcc; + struct LEX_SESSION *lexs; + struct HYX_CLUSTER_CONTROL *hcc; + struct HYX_PARSER_STATUS *hps; + struct HYX_PARSER_CLASS *hpc; + struct LEXICON_CONTROL *lcc; + long chars_read; + int rv= 0; + int rc; + + if ((bbcc= (struct BBC_CONNECTION *) client_data) + == (struct BBC_CONNECTION *) 0 + ||(lexs= (struct LEX_SESSION *) bbcc->BBCC_client_data1) + == (struct LEX_SESSION *) 0 + ||(hcc= lexs->LEXS_hcc) == (struct HYX_CLUSTER_CONTROL *) 0 + || !hcc->HCC_dictadd1_inited + ||(lcc= lexs->LEXS_lcc) == (struct LEXICON_CONTROL *) 0 + /** ||(hpc= hyx_init_parser_class ()) == (struct HYX_PARSER_CLASS *) 0 **/ + ||(hpc= lexs->LEXS_hpc) == (struct HYX_PARSER_CLASS *) 0 + ) + { + fprintf (stdout, "lexicon system not initialized!!!\n"); + return -1; + } + + /* T2D: debugging only? */ + hpc->HPC_meta_flags |= HPC_META_show_new_tags; + + while (buffer_size > 0 && rv == 0) + { +/** fprintf (stderr, "bbc07: buffer_size=%d\n", buffer_size); **/ + if ((hps= lexs->LEXS_hps) == (struct HYX_PARSER_STATUS *) 0) + { + if ((hps= hyx_parser_reset (hpc)) == (struct HYX_PARSER_STATUS *) 0) + { + fprintf (stdout, "hps_parser_reset failed!\n"); + return -1; + } + lexs->LEXS_hps= hps; + } + + /* parse incoming block */ + lexs->LEXS_tx_new_entry= (struct TEXT_ELEMENT *) 0; + rc= hyx_parse2_block (hps, buffer, &lexs->LEXS_tx_new_entry, + lcc->LC_end_tags, lcc->LC_end_tag_count, + (long) buffer_size, &chars_read); +/** fprintf (stderr, "bbc07: hyx_parse2_block rc=%d chars_read=%ld\n", rc, chars_read); **/ + + if (rc < 0 || chars_read == 0L) + { + fprintf (stdout, + "note: bbc_lexicon_processor: rc=%d chars_read=%ld srv=%s/%s\n", + rc, chars_read, bbcc->BBCC_peer_host, bbcc->BBCC_from); + rv= -1; + goto END; + } + + if (rc == 0) break; /* incomplete block, wait for rest */ + buffer_size -= (int) chars_read; + buffer += (int) chars_read; + + /* if (strcmp (bbcc->BBCC_resource, "lookup") == 0) */ + hcc->HCC_dict_mode= DAMODE_LOOKUP; /* default*/ + if (strcmp (bbcc->BBCC_resource, "dictadd") == 0) + hcc->HCC_dict_mode= DAMODE_MERGE; + + rc= dict_process_entry (hpc, hcc, lcc, lexs->LEXS_tx_new_entry, + bbcc->BBCC_op, (void *) bbcc, 0); +/** fprintf (stderr, "bbc07: dict_process_entry rc=%d\n", rc); **/ + + if (rc == -1) rv= -1; + if (rc == 0) + { + lexs->LEXS_record_counter++; + if ((lexs->LEXS_record_counter % 0x00010000L) == 0) + memory_statistics (stdout, lexs->LEXS_record_counter); + } + +END: + free (hps); + lexs->LEXS_hps= (struct HYX_PARSER_STATUS *) 0; + lexs->LEXS_tx_new_entry= (struct TEXT_ELEMENT *) 0; + } + + return 0; +} diff --git a/lib/ds/bbc/bbc07.o b/lib/ds/bbc/bbc07.o new file mode 100644 index 0000000000000000000000000000000000000000..9421a13d809d8d531be09366ba3981e9e99a1490 Binary files /dev/null and b/lib/ds/bbc/bbc07.o differ diff --git a/lib/ds/bbc/bbc08.c b/lib/ds/bbc/bbc08.c new file mode 100644 index 0000000000000000000000000000000000000000..4412a2bf723810b69c78e087b100d957a90ff4b6 --- /dev/null +++ b/lib/ds/bbc/bbc08.c @@ -0,0 +1,38 @@ +/* + * FILE %lexicon/bbc08.c + * + * written: 1995-08-21 + * latest update: 1995-08-21 + * $Id: bbc08.c,v 1.3 2003/06/25 03:09:53 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/strings.h> +#include <gg/bbch.h> + +/* ------------------------------------------------------------------------ */ +int bbc_get_request ( +struct BBC_CONNECTION *bbcc, +char *buffer) +{ +#define N_FIELDS 10 + char *fields [N_FIELDS]; + int field_count; + BBC_accept *accept_handler; + + if ((field_count= split_string (buffer, ':', fields, N_FIELDS)) < 3 + || strcmp (fields [0], "BBC") != 0 + || strcmp (fields [1], "REQUEST") != 0 + ) return -1; + + bbcc->BBCC_resource= strdup (fields [2]); + + if ((accept_handler= bbcc->BBCC_accept) == (BBC_accept *) 0 + || (*accept_handler) (bbcc) != 0 + ) return -1; + + return 0; +} diff --git a/lib/ds/bbc/bbc08.o b/lib/ds/bbc/bbc08.o new file mode 100644 index 0000000000000000000000000000000000000000..35906ed062f7f0bae577e34705cd37ea933b92b3 Binary files /dev/null and b/lib/ds/bbc/bbc08.o differ diff --git a/lib/ds/bbc/bbc09.c b/lib/ds/bbc/bbc09.c new file mode 100644 index 0000000000000000000000000000000000000000..98abd425aa8c88640110bafcfee43e4bd85957f7 --- /dev/null +++ b/lib/ds/bbc/bbc09.c @@ -0,0 +1,73 @@ +/* + * FILE %ds/bbc/bbc09.c + * + * listen on a port + * + * written: 1995-08-07 + * latest update: 1999-05-09 18:08:38 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <time.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <netdb.h> +#include <gg/bbch.h> + +/* ------------------------------------------------------------------------ */ +struct BBC_LISTEN *bbc_server (int port) +{ + struct sockaddr_in sock_addr; + struct BBC_LISTEN *bbcl; + int sock_listen; + int one= 1; + int rc; + + if ((bbcl= (struct BBC_LISTEN *) calloc (sizeof (struct BBC_LISTEN), 1)) + == (struct BBC_LISTEN *) 0) +ERROR: + return (struct BBC_LISTEN *) 0; + + /* set up listening socket */ + sock_listen= socket (AF_INET, SOCK_STREAM, 0); + + /* fprintf (stderr, "gethostid(): %ld\n", gethostid()); */ + sock_addr.sin_family= AF_INET; + sock_addr.sin_addr.s_addr= htonl (INADDR_ANY); + sock_addr.sin_port= 0; + + /* work as server and wait until someone else connects ... */ + fprintf (stderr, "listening on port %d\n", port); + sock_addr.sin_port= htons (port); + + if (setsockopt (sock_listen, (int) SOL_SOCKET, (int) SO_REUSEADDR, + (char *) &one, sizeof (int)) == -1) + { + fprintf (stderr, "can't setsockopt for listen sockfd"); + goto ERROR; + } + + if ((rc= bind (sock_listen, (struct sockaddr *) &sock_addr, + sizeof (struct sockaddr))) == -1) + { + fprintf (stderr, "bind: rc=%d errno=%d\n", rc, errno); + goto ERROR; + } + + if ((rc= listen (sock_listen, 1)) == -1) + { + fprintf (stderr, "listen: rc=%d errno=%d\n", rc, errno); + goto ERROR; + } + + fprintf (stderr, "listen on port %d: rc=%d\n", port, rc); + + bbcl->BBCL_socket= sock_listen; + + return bbcl; +} diff --git a/lib/ds/bbc/bbc09.o b/lib/ds/bbc/bbc09.o new file mode 100644 index 0000000000000000000000000000000000000000..f01268726b2a82d4f7318cba078f7a99b95113d9 Binary files /dev/null and b/lib/ds/bbc/bbc09.o differ diff --git a/lib/ds/bbc/bbc10.c b/lib/ds/bbc/bbc10.c new file mode 100644 index 0000000000000000000000000000000000000000..2dd3e5bf1c9f1114f5ddaad397b8b5ca15ef9516 --- /dev/null +++ b/lib/ds/bbc/bbc10.c @@ -0,0 +1,90 @@ +/* + * FILE %ds/bbc/bbc10.c + * + * listen on a port + * + * written: 1995-08-07 + * latest update: 1996-12-01 12:58:12 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <time.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <netdb.h> +#include <gg/strings.h> +#include <gg/bbch.h> + +/* ------------------------------------------------------------------------ */ +struct BBC_CONNECTION *bbc_connect ( +struct BBC_SESSION *bbcs, +char *host, +int port, +char *target_name, +char *target_resource) +{ + struct BBC_CONNECTION *bbcc= (struct BBC_CONNECTION *) 0; + struct sockaddr_in sock_addr; + struct sockaddr_in other; + int one= 1; + int sock; + int rc; + char *cp; + + if (host == (char *) 0 || *host == 0 || port < 0) goto END; + + sock= socket (AF_INET, SOCK_STREAM, 0); + sock_addr.sin_family= AF_INET; + sock_addr.sin_port= 0; + + other.sin_family= AF_INET; + other.sin_port= htons (port); + + if (verify (host, "0123456789.")) + { + u_long adr; + struct hostent *hostentry; + + if ((hostentry= gethostbyname (host)) == (struct hostent *) 0) goto END; + + adr= ((struct in_addr *) hostentry->h_addr_list[0])->s_addr, + other.sin_addr.s_addr= adr; + } + else + { + other.sin_addr.s_addr= inet_addr (host); + } + + /* fprintf (stderr, "connect to %s(%d)\n", host, port); */ + if ((rc= connect (sock, + (struct sockaddr *) &other, + sizeof (struct sockaddr_in))) + == -1) + { + fprintf (stderr, "connect: errno=%d\n", errno); + goto END; + } + + if ((bbcc= bbc_init_connection (bbcs, sock)) != (struct BBC_CONNECTION *) 0) + { + bbcc->BBCC_status= BBCCst_initiator; + bbcc->BBCC_connection_mode= BBCCcm_initiator; + + bbcc->BBCC_from= bbcs->BBCS_my_name; + bbcc->BBCC_to= target_name; + bbcc->BBCC_resource= target_resource; + + cp= bbcs->BBCS_buffer; + sprintf (cp, "BBC:REQUEST:%s:hi.\n", target_resource); + write (bbcc->BBCC_socket, cp, strlen (cp)); + } + +END: + return bbcc; +} diff --git a/lib/ds/bbc/bbc10.o b/lib/ds/bbc/bbc10.o new file mode 100644 index 0000000000000000000000000000000000000000..6021403d19e269bcf859fd07bae58f8aa990b464 Binary files /dev/null and b/lib/ds/bbc/bbc10.o differ diff --git a/lib/ds/bbc/bbc11.c b/lib/ds/bbc/bbc11.c new file mode 100644 index 0000000000000000000000000000000000000000..fab1a2601acce4791d46c8cd359e1b8bc501a338 --- /dev/null +++ b/lib/ds/bbc/bbc11.c @@ -0,0 +1,66 @@ +/* + * FILE %lexicon/bbc11.c + * + * send a challenge to a bbc target + * + * written: 1995-08-14 + * latest update: 1995-08-17 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/filename.h> +#include <gg/strings.h> +#include <gg/ggcrypt.h> +#include <gg/dpp.h> +#include <gg/bbch.h> + +static char PUBLIC []= "PUBLIC"; + +/* ------------------------------------------------------------------------ */ +int bbc_challenge ( +struct BBC_SESSION *bbcs, +struct BBC_CONNECTION *bbcc, +char *buffer) +{ + char *chex_string; +#define N_FIELDS 10 + char *fields [N_FIELDS]; + char tmp_pass [20]; + int field_count; + + /* printf ("# key_file= '%s'\n", bbcs->BBCS_key_file); */ + + if ((field_count= split_string (buffer, ':', fields, N_FIELDS)) < 4 + || strcmp (fields [0], "BBC") != 0 + || strcmp (fields [1], "ACCEPT") != 0) return -1; + + bbcc->BBCC_opening_challenge= strdup (fields [2]); + bbcc->BBCC_s_p2o.GGC_challenge= strdup (fields [3]); + bbcc->BBCC_s_o2p.GGC_challenge= "OPEN"; + + if (strcmp (fields [2], PUBLIC) != 0) + { + if ((chex_string= agettok_get_challenge (bbcs->BBCS_key_file, + bbcc->BBCC_from, bbcc->BBCC_to, bbcc->BBCC_resource, + bbcc->BBCC_opening_challenge)) + == (char *) 0) + return -1; + + if (!bbcs->BBCS_is_public) + { + mk_PassWord (tmp_pass, 16); + bbcc->BBCC_s_o2p.GGC_challenge= strdup (tmp_pass); + } + } + else + { + chex_string= fields [2]; + } + + bbcc->BBCC_chex_string= strdup (chex_string); + + return 0; +} diff --git a/lib/ds/bbc/bbc11.o b/lib/ds/bbc/bbc11.o new file mode 100644 index 0000000000000000000000000000000000000000..9b301052215126b63489ab895fc29b8906182e1b Binary files /dev/null and b/lib/ds/bbc/bbc11.o differ diff --git a/lib/ds/bbc/bbc12.c b/lib/ds/bbc/bbc12.c new file mode 100644 index 0000000000000000000000000000000000000000..fd165e8786ea65dc04dc16bc8895744ef8bbc569 --- /dev/null +++ b/lib/ds/bbc/bbc12.c @@ -0,0 +1,28 @@ +/* + * FILE %ds/bbc/bbc12.c + * + * written: 1995-08-14 + * latest update: 1995-08-22 + * $Id: bbc12.c,v 1.2 2003/06/25 10:11:44 gonter Exp $ + * + */ + +#include <unistd.h> +#include <gg/bbch.h> + +/* ------------------------------------------------------------------------ */ +int bbc_to_stdout ( +void *client_data, +char *buffer, +int buffer_size) +{ + struct BBC_CONNECTION *bbcc; + + if ((bbcc= (struct BBC_CONNECTION *) client_data) + == (struct BBC_CONNECTION *) 0) return -1; + + if (write (1, buffer, buffer_size) <= 0) + bbcc->BBCC_t2d= BBCCt2d_shutdown; + + return 0; +} diff --git a/lib/ds/bbc/bbc12.o b/lib/ds/bbc/bbc12.o new file mode 100644 index 0000000000000000000000000000000000000000..a181d38e7d6b4f525046b0bb93ecdf2a9b18954c Binary files /dev/null and b/lib/ds/bbc/bbc12.o differ diff --git a/lib/ds/bbc/bbc13.c b/lib/ds/bbc/bbc13.c new file mode 100644 index 0000000000000000000000000000000000000000..a7b16d98968d6f0977deac9c7fa0b414b7117db6 --- /dev/null +++ b/lib/ds/bbc/bbc13.c @@ -0,0 +1,46 @@ +/* + * FILE %lexicon/bbc13.c + * + * restructure text elements according to lexicon control + * see bbc07.c + * + * written: 1995-08-19 + * latest update: 1995-08-26 + * + */ + +#include <stdio.h> +#include <gg/ggcrypt.h> +#include <gg/dyb.h> +#include <gg/parse.h> +#include <gg/bbch.h> + +/* ------------------------------------------------------------------------ */ +int bbc_transmit_text ( +void *cd, +struct TEXT_ELEMENT *te) +{ + struct BBC_CONNECTION *bbcc; + struct DYNAMIC_BLOCK *db; + + if ((bbcc= (struct BBC_CONNECTION *) cd) == (struct BBC_CONNECTION *) 0 + || (db= dyb_new_block (0)) == (struct DYNAMIC_BLOCK *) 0 + ) return -1; + + dyb_append_string (db, "<:>"); + hyx_unroll_text (db, te, 0, 0, 0); + dyb_append_string (db, "<;>\n"); + +printf ("bbc13: sending lexicon entry accross the line\n"); +printf ("----- BEGIN -------------------------\n"); +dyb_write (1, db); +printf ("\n----- END ---------------------------\n"); + + dyb_encrypt_cfb (&bbcc->BBCC_s_o2p, db); + if (dyb_write (bbcc->BBCC_socket, db) != 0) + bbcc->BBCC_t2d= BBCCt2d_shutdown; + + dyb_destroy_block (db); + + return 0; +} diff --git a/lib/ds/bbc/bbc13.o b/lib/ds/bbc/bbc13.o new file mode 100644 index 0000000000000000000000000000000000000000..9d51ff0be5b74ee58835484d6745d449a811023e Binary files /dev/null and b/lib/ds/bbc/bbc13.o differ diff --git a/lib/ds/bbc/bbc14.c b/lib/ds/bbc/bbc14.c new file mode 100644 index 0000000000000000000000000000000000000000..8624c5b59e3fdc2280f51cfb5ce97d847e657e38 --- /dev/null +++ b/lib/ds/bbc/bbc14.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/bbc/bbc14.c + * + * written: 1995-08-21 + * latest update: 1996-12-01 11:41:24 + * $Id: bbc14.c,v 1.3 2003/06/25 10:11:44 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <gg/bbch.h> + +/* ------------------------------------------------------------------------ */ +struct BBC_SESSION *bbc_new_session () +{ + struct BBC_SESSION *bbcs; + + if ((bbcs= (struct BBC_SESSION *) calloc (sizeof (struct BBC_SESSION), 1)) + != (struct BBC_SESSION *) 0) + { + bbcs->sig= SIG_BBC_SESSION; + + /* standard methods */ + bbcs->BBCS_accept= bbc_acceptor; + bbcs->BBCS_input1= bbc_authentication_protocol; + bbcs->BBCS_input2= bbc_to_stdout; + } + + return bbcs; +} diff --git a/lib/ds/bbc/bbc14.o b/lib/ds/bbc/bbc14.o new file mode 100644 index 0000000000000000000000000000000000000000..b9b1a41e4af1655202321b5bcfad2bda89fa2c58 Binary files /dev/null and b/lib/ds/bbc/bbc14.o differ diff --git a/lib/ds/bbc/bbc15.c b/lib/ds/bbc/bbc15.c new file mode 100644 index 0000000000000000000000000000000000000000..8de460caa38c036b27c2022b7118e71db8e0dfd8 --- /dev/null +++ b/lib/ds/bbc/bbc15.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/bbc/bbc15.c + * + * written: 1995-08-21 + * latest update: 1996-12-01 11:42:05 + * $Id: bbc15.c,v 1.3 2003/06/25 03:09:53 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/bbch.h> + +/* ------------------------------------------------------------------------ */ +int bbc_acceptor (void *client_data) +{ + struct BBC_SESSION *bbcs; + struct BBC_CONNECTION *bbcc; + + if ((bbcc= (struct BBC_CONNECTION *) client_data) + == (struct BBC_CONNECTION *) 0 + || (bbcs= (struct BBC_SESSION *) bbcc->BBCC_bbcs) + == (struct BBC_SESSION *) 0 + || bbcs->sig != SIG_BBC_SESSION + ) return -1; + + if (bbcs->BBCS_is_public + || (bbcs->BBCS_public_resource != (char *) 0 + && strcmp (bbcs->BBCS_public_resource, bbcc->BBCC_resource) == 0) + ) + { + bbcc->BBCC_opening_challenge= "PUBLIC"; + bbcc->BBCC_s_o2p.GGC_challenge= "OPEN"; + bbcc->BBCC_s_p2o.GGC_challenge= "OPEN"; + } + + return 0; +} diff --git a/lib/ds/bbc/bbc15.o b/lib/ds/bbc/bbc15.o new file mode 100644 index 0000000000000000000000000000000000000000..25d6232902f1b400c8bdfc54eb6512743fec077b Binary files /dev/null and b/lib/ds/bbc/bbc15.o differ diff --git a/lib/ds/bbc/bbcd.doc b/lib/ds/bbc/bbcd.doc new file mode 100644 index 0000000000000000000000000000000000000000..65db59dd40d5504c8861a786ce3e44ad739acf68 --- /dev/null +++ b/lib/ds/bbc/bbcd.doc @@ -0,0 +1,205 @@ + +BBC doc + +written: 1995-08-04 +latest update: 1996-12-01 9:20:03 + +[protocl | API | DESIGN | NOTES | BBCINETD | T2D | DICTADD | TEST ] + +--- protocol ----------------------------------------------------------------- +Each connection involves two principals, the target which waits for +incoming connections, the initiator which opens the connection to +the target. + +The startup phase of the protocol is described as follows: +1. target listens on port +2. initiator connects to target +3. target accepts the connection +4. initiator sends a REQUEST Message +5. target sends a ACCPET Message +6. initiator sends a CONNECT Message +7. target checks all credentionals transmitted in the CONNECT Message + to authenticate the initiator and replies either with an OK or + FAILED Message. +8. initiator sends a block of random data +9. target receives and ignores the block of random data + +REQUEST Message: +BBC:REQUEST:resource:comment +0 1 2 3 + +ACCEPT Message: +BBC:ACCEPT:challenge:session_challenge:comment +0 1 2 3 4 + +CONNECT Message: (opening message) +BBC:CONNECT:from:to:resource:chex_string:session_challenge:comment +0 1 2 3 4 5 6 7 + +Akzeptierte Verbindung: +BBC:OK:comment + +Zurueckgewiesene Verbindung: +BBC:FAILED:comment + + +challenge == 'PUBLIC': +=> Server erlaubt unauthentisierte Clients + +session_challenge == 'OPEN': +=> kein session key und Verschluesselung verwendet + +Bei der Accept Message teilt das Target dem Initiator seine session +challenge mit, die fuer die Verschluesselung des in weiterer Folge vom +Target an den Initiator uebermittletn Datenstrom benutzt werden soll. + +Umgekehrt teilt der Initiator dem Target seine Session challenge +mit, die in der Folge fuer die Verschluesselung des seinerseits +uebermittleten Datenstrom verwendet wird. + +Credential Mix: + +sym A B C D E description +EC x x x x entity from (client) +ES x x x x entity to (server) +RE x x x x ressource +AC x x accept/connect challenge +CX x chex string +S1 x x session challenge 1 +S2 x x session challenge 2 +PW x x x password (shared secret) + +A ... klarschriftliche Uebermittlung in ACCPET Message +B ... klarschriftliche Uebermittlung in CONNECT Message +C ... Ermittlung des chex_string +D ... Ermittlung des Session Key 1 +E ... Ermittlung des Session Key 2 + +Die opening challenge wird vom Server an den Client uebermittelt, +dieser muss anhand dessen den Chex String ermitteln. +Die Challenge PUBLIC zeigt an, dass kein Passwort noetig ist. +In diesem Fall kann auch keine Verschluesselung der Datenstroeme +erfolgen, da es kein gemeinsam bekanntes Passwort gibt. + +--- API %ds/bbc/ ------------------------------------------------------------- +bbc_diagnostic_output (): +Target Mode: +geprueft in bbc_chex () (see chex.c) + +Die Connection wird zu Beginn mit 'BBCCst_target' markiert um anzudeuten, +dass die Authentisierung erwartet wird. Nach deren Ueberpruefung wird +entweder 'BBCCst_failed' oder 'BBCCst_ok' eingetragen. + +Daten werden in beiden Faellen angenommen aber nur im 'ok'-Fall +tatsaechlich verarbeitet. + +Initiator Mode: +Die Connection wird mit 'BBCCst_initiator' markiert, was bedeutet, +dass die ACCEPT Message vom Target erwaret wird. Daraufhin versucht +sich der Initiator gegegenueber zu authentisieren und uebermittelt +die entsprchechende CONNECT Message. Die Connection wird zu diesem +Zeitpunkt mit 'BBCCst_wait' markiert, was bedeutet, dass vom Target +entweder eine OK oder FAILED Nachricht erwartet wird. + + +Das Session Password wird verwendet um einen Session Key zu erzeugen, +der in der Folge fuer die Verschluesselung verwendet wird. Das Session +Password 'OPEN' bringt zum Ausdruck, dass keine Verschluesselung erfolgen +soll. + +Alle folgenden Datentransfers werden mit dem definierten Session Key +verschluesselt. + + +--- DESIGN ------------------------------------------------------------------- +Symmetrisches Client/Server Design +* offene Listen Calls in Control Structure eintragen + (es koennen ja auch mehrere Server simmultan bedient werden). + bbc_server (bbc_session, port) -> erzeugt einen BBC_LISTEN Eintrag. + +* TCL mit incrementellen Parser?? + +* Meta Queue + Requests, die Verbindungsauf- und -abbau betreffen, z.B: + - connect + - listen + - shutdown (connection|listen) + +* bbc_main (...) + Main event loop: + while (doit) + { + event := next_event (...); + switch (event) + { + case incoming_connection: ***OK*** + ACCEPT(); + add server slot; + break; + case incoming_data: ***OK*** + process_data(); + break; + case incoming_from_pipe: ***OK*** + process_pipe(); + break; + case create_connect: + LISTEN(); + add listen slot; + break; + case shutdown: + CLOSE(); + remove connection slot; + break; + case TIMEOUT: + drop connections, if timed-out + break; + } + } + +--- NOTES -------------------------------------------------------------------- +bbc_init_connection erzeugt nur fuer die connection challenge and die +beiden session challenges nur Strings, die fuer anonyme und unverschluesselte +Verbindungen verwendet werden koennen. Die ev. noetigen Strings muessen +durch die Aufrufende Applikation festgelegt werden. + +Der Name bbc_diagnostic_output() ist irrefuehrend und sollte geandert +werden. + +--- BBCINETD ----------------------------------------------------------------- +T2D: ++ closed/crashed network connection ++ closed/crashed child ++ Angabe des Ports direkt im conf file + +--- T2D ---------------------------------------------------------------------- +bbc02.c: ++ check, ob Portnummer ermittelt werden kann. ++ HP-UX: Warnings (1996-08-12) + +variante zu display_markup (char *buffer, ...) mit datentransfer in +einen Puffer statt Ausgabe auf Stream! + +Moeglichkeit zur reinen Abfrage von Daten ohne Update der Lexion +Struktur vorsehen. + +(re)design einer allgemeinen Protocol Engine: +Session Descriptor + input_channel_descriptor + output_channel_descriptor + connection_descriptor + protocol_descriptor + void *meta_descriptor + + +--- DICTADD ------------------------------------------------------------------ +Ressources: ++ dictadd (DAMODE_MERGE) ... merge mit bestehenden Eintraegen ++ lookup (DAMODE_LOOKUP) ... nur Ausgabe + + +--- TEST --------------------------------------------------------------------- +generic encryption routines <gg/ggcrypt.h> + +ggc_block_cfb und ggc_block_ecb + + diff --git a/lib/ds/bbc/bbct1.c b/lib/ds/bbc/bbct1.c new file mode 100644 index 0000000000000000000000000000000000000000..6819f7de09c5592aa8271302dbc4772b3920f43f --- /dev/null +++ b/lib/ds/bbc/bbct1.c @@ -0,0 +1,180 @@ +/* + * FILE %ds/bbc/bbct1.c + * + * blackboard controller test + * -- incomplete -- + * + * written: 1996-08-11 + * latest update: 1996-12-01 21:50:36 + * $Id: bbct1.c,v 1.2 2003/06/25 03:09:53 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/filename.h> +#include <gg/fileio.h> +#include <gg/wildcard.h> +#include <gg/array.h> +#include <gg/sbr.h> +#include <gg/bbch.h> +#ifdef MSDOS +#include <conio.h> +#endif /* MSDOS */ + +#define STDHLP stderr + +#define MAX_FILENM 80 +static char filenm [MAX_FILENM]; +static int verbose_mode= 0; + +/* ------------------------------------------------------------------------ */ +#define MAX_TEST_BUFFER 1024 +static char test_buffer [MAX_TEST_BUFFER]; +static struct BBC_SESSION *bbcs; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ +#ifdef TO_UPPER + "USAGE: bbct1 [options] {file name}\n", +#endif /* TO_UPPER */ +#ifdef TO_LOWER + "USAGE: bbct1 [options] {file name}\n", +#endif /* TO_LOWER */ + "OPTIONS:\n", + " -f<fnm> ... list of files\n", + " -r ... recursive\n", + " -v ... verbose: tell filename\n", + "\n", +#ifdef TO_UPPER + "(@)Atoupper.c 1.02 #D$1996-08-11 22:07:35\n", +#endif /* TO_UPPER */ +#ifdef TO_LOWER + "(@)Atolower.c 1.02 #D$1996-08-11 22:07:39\n", +#endif /* TO_LOWER */ + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl bbc_test (char *fn, void *cd); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + int rc; + char *arg; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) return 1; + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, + bbc_test, (void *) 0); + + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + + case 'r': case 'R': + case 'v': case 'V': + for (j= 1; arg [j]; j++) + { + switch (arg [j]) + { + case 'r': case 'R': + wcrd2_set_subdirs (wcrd, 1); + break; + case 'v': case 'V': + verbose_mode++; + break; + } + } + break; + + case 'a': case 'A': +HLP: +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + + if ((bbcs= bbc_new_session ()) == (struct BBC_SESSION *) 0) + { + fprintf (stderr, "could not establish BBC session\n"); + return 1; + } + + bbcs->BBCS_key_file= ".kredenz.tfb"; + bbcs->BBCS_my_name= "bbct1"; + bbcs->BBCS_my_resource= "test1"; + bbcs->BBCS_public_resource= "test1"; + + while ((arg= (char *) array_shift (arguments)) != (char *) 0) + { + if (arg [0] == '-') + { + if ((fi2= fopen (arg+2, "rt")) == (FILE *) 0) + { + fprintf (stderr, "can't open file %s!\n", arg+2); + break; + } + for (;;) + { + rc= fread_line (fi2, filenm, MAX_FILENM); + if (feof (fi2)) break; + wcrd2_wildcards (wcrd, filenm); + } + fclose (fi2); + } + else wcrd2_wildcards (wcrd, arg); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int bbc_test (char *fn, void *cd) +{ + FILE *fi; + int rc; + struct BBC_CONNECTION *bbc1; + struct BBC_CONNECTION *bbc2; + + bbc1= bbc_init_connection (bbcs, 1); + bbc2= bbc_init_connection (bbcs, 1); + +#ifdef MSDOS + cd; +#endif + + if (verbose_mode > 0) printf ("\n%s:\n", fn); + if ((fi= fopen (fn, "rb")) == (FILE *) 0) return -1; + + for (;;) + { + rc= fread_line (fi, test_buffer, MAX_TEST_BUFFER); + if (rc <= 0 && feof (fi)) break; + + test_buffer [rc++]= '\n'; + printf ("1: '%s'", test_buffer); + } + fclose (fi); + return 0; +} diff --git a/lib/ds/bbc/contrib b/lib/ds/bbc/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/bbc/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/bbc/gg b/lib/ds/bbc/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/bbc/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/bbc/lib b/lib/ds/bbc/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/bbc/libgg.a b/lib/ds/bbc/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/bbc/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/bbc/make-dos b/lib/ds/bbc/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..1ce2dc3811c1c3fb8546d3a67386f59a678cf349 --- /dev/null +++ b/lib/ds/bbc/make-dos @@ -0,0 +1,35 @@ +# +# FILE %ds/bbc/makefile +# +# written: 1996-03-25 +# latest update: 1996-08-11 22:20:25 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$* /c +obj=objdec -w -d -m0 -sl 2 BBC_TEXT +inst=command /c inst-exe +bin=c:\bin\ + +all.exe : libr test + +lib.1 : ! + bbc01.obj bbc02.obj bbc03.obj bbc04.obj ! + bbc05.obj bbc06.obj bbc07.obj bbc08.obj ! + bbc09.obj bbc10.obj bbc11.obj bbc12.obj ! + bbc13.obj bbc14.obj bbc15.obj + +test : ! + bbc.obj bbct1.exe + +libr : lib.1 + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +# production programs: ------------------------------------------------------- +# test programs: ------------------------------------------------------------- +OBJS= bbc04.obj +bbct1.exe : bbct1.obj + link bbct1 $(OBJS),,,c:\usr\sbr\lsbr; diff --git a/lib/ds/cal/(dirinf).fm b/lib/ds/cal/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..d72b1400b0551553c74a363607b705500a3b9efd --- /dev/null +++ b/lib/ds/cal/(dirinf).fm @@ -0,0 +1,64 @@ +# +# FILE %ds/cal/(dirinf).fm +# +. | Date, Time, Calendar and Planner functions +# +# written: 1988 09 03 +# latest update: 1997-01-15 21:59:56 +# $Id: (dirinf).fm,v 1.2 2005/12/19 10:33:45 gonter Exp $ +# +# ---------------------------------------------------------------------------- +large | Objektfiles LARGE Model +small | Objektfiles SMALL Model + +Makefile | active Makefile +make-ux | Makefile (Unix) +make-dos | Makefile (MSDOS) + +dt001.c | int actual_datim (char *datum, int format); +dt001b.c | int _actual_datim (char *datum, int format, long tt); +dt002.c | int actual_datim_int (int *jahr, ...) +dt002b.c | int get_current_year () +dt003.c | int print_date_time (FILE *fo); +dt004.c | void prepare_date (char *datum); +dt006.c | int days_of_month (int year, int month); +dt007.c | int is_leap_year (int year); +dt008.c | int modify_date (struct tm *d, int delta); +dt010.c | long day_number (int jahr, int mon, int tag); +dt011.c | int weekday (int jahr, int mon, int tag); +dt014a.c | char *DAY_OF_WEEK3 [] = ... +dt014b.c | char *DAY_OF_WEEK2 [] = ... +dt015a.c | char *MONTH_NAME [13] = ... + +dt021.c | int chk_datum (char *sb, char *se, ...) +dt022.c | int get_datum (char *s, int zone_begin, ...) +dt023.c | int get_jahr_mon_tag (char *s, int *ii, ...) +dt024.c | int delta_datum (int bjahr, int bmon, ...) +dt025.c | int valid_datum (int jahr, int mon, ...) + +dt031t.c | test for int analyze_date (...) +dt031.c | int analyze_date (char *s, int *jahr, ...) +dt032.c | int analyze_dat_str (char *name, ...) +dt033.c | int check_for_timezone (int *v, int *s, char *str); +dt034.c | int get_easter (int year, int *month, int *day) +dt035.c | int get_day_index (struct YEAR_INFO *yi, int mon, int day) +dt036.c | struct DAY_INFO_EXTRA *create_day_info_extra (...); +dt037.c | struct DAY_INFO *cdecl fixup_day (struct YEAR_INFO *yi, ...) +dt038.c | int get_wday_index (struct YEAR_INFO *yi, int mon, ...) + +dt041.c | int setup_year_info (struct YEAR_INFO *yi, int year) +dt042.c | int cal_reset_year_info (struct YEAR_INFO *yi) + +cal01.c | int print_yi_year (FILE *fo, struct YEAR_INFO *yi, int year); +cal02.c | int print_yi_months (FILE *fo, struct YEAR_INFO *yi); +cal03.c | int print_yi_days (FILE *fo, struct YEAR_INFO *yi); +cal04.c | extern struct DAY_INFO_EXTRA AT_holiday []; +cal04exp.c | int export_DE () +cal05.c | int fixup_extra_information (struct YEAR_INFO *yi, ...) +cal06.c | int get_day_string (char *day_frame, struct DAY_INFO *di); +cal07.c | int print_calendar (FILE *fo, int year_from, ...) +cal08.c | int cal_reset_alternative_view (struct YEAR_INFO *yi); +cal09.c | int cal_setup_alternative_view (struct YEAR_INFO *yi); +cal10.c | int cal_print_alternative_view (FILE *fo, struct YEAR_INFO *yi); + +* | diff --git a/lib/ds/cal/.cvsignore b/lib/ds/cal/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..46c241aaf051f57049d9f03f2e6696b4b503dff2 --- /dev/null +++ b/lib/ds/cal/.cvsignore @@ -0,0 +1,2 @@ +dt003b +dt003c diff --git a/lib/ds/cal/@ b/lib/ds/cal/@ new file mode 100644 index 0000000000000000000000000000000000000000..3b600eb3eb0ebbac33588dd486f6621e1beb927c --- /dev/null +++ b/lib/ds/cal/@ @@ -0,0 +1,9 @@ +a setacl "INBOX.JOINT-STUDY" gg none +a setacl "INBOX.JOINT-STUDY.AUSTRALIEN" gg none +a setacl "INBOX.JOINT-STUDY.CHINA" gg none +a setacl "INBOX.JOINT-STUDY.FA Moskau" gg none +a setacl "INBOX.JOINT-STUDY.KANADA" gg none +a setacl "INBOX.JOINT-STUDY.KANADA.INCO-KANADA" gg none +a setacl "INBOX.JOINT-STUDY.NEUSEELAND" gg none +a setacl "INBOX.JOINT-STUDY.SingaporeMU" gg none +a setacl "INBOX.JOINT-STUDY.mexiko" gg none diff --git a/lib/ds/cal/Makefile b/lib/ds/cal/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..10a047ca6247e6e76c1501970883e83f750b0d73 --- /dev/null +++ b/lib/ds/cal/Makefile @@ -0,0 +1,45 @@ +# +# FILE %ds/cal/make-ux +# +# written: 1995-12-20 +# latest update: 1999-05-08 9:37:56 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib +all.bin : dt003b dt003c + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + cal01.o cal02.o cal03.o cal04.o cal05.o cal06.o cal07.o cal08.o cal09.o \ + cal10.o + +LIBOBJS1= \ + dt001.o dt001b.o dt002.o dt002b.o dt003.o dt003b.o dt004.o dt006.o dt007.o \ + dt008.o dt010.o dt011.o dt014a.o dt014b.o dt015a.o \ + dt021.o dt022.o dt023.o dt024.o dt025.o \ + dt031.o dt032.o dt033.o dt034.o dt035.o dt036.o dt037.o dt038.o \ + dt041.o dt042.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) $(LIBOBJS1) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $? + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib + +dt003b: dt003b.c + $(CC) -o $@ $(OPTS) -DMAIN $? + +dt003c: dt003c.c + $(CC) -o $@ $(OPTS) -DMAIN $? + diff --git a/lib/ds/cal/cal01.bup b/lib/ds/cal/cal01.bup new file mode 100644 index 0000000000000000000000000000000000000000..6b125f8bc72a0d8be555394ce3c4b0f7934b11ab --- /dev/null +++ b/lib/ds/cal/cal01.bup @@ -0,0 +1,75 @@ +/* + * FILE ~/usr/planner/cal01.c + * + * CAL generator + * + * written: 1994-10-17 + * latest update: 1994-10-19 + * + */ + +#include <stdio.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +static char day_frame_name [256]; + +/* ------------------------------------------------------------------------ */ +int print_year_info (FILE *fo, struct YEAR_INFO *yi, int year) +{ + struct DAY_INFO *di; /* information about a day */ + int num; /* number of days in particular month */ + int wnum= 1; /* week number */ + int dnum= 0; /* day of year; 0..364 (365) */ + int wday; /* day of week; 0..6 */ + char *dow3; /* name of day week */ + int mon; /* current month */ + int day; /* current day in month */ + + num= (yi->YI_is_leap_year) ? 366 : 365; + + fprintf (fo, "<Frame %d>\n", year); + fprintf (fo, "%d\n\n", year); + for (mon= 0; mon < 12; mon++) + { + fprintf (fo, "<hyx.l fr=\"%d-%02d\" tdc=hyx.l tdp=2>%2d %s\n", + year, mon+1, mon+1, MONTH_NAME[mon+1]); + } + fprintf (fo, "\n</Frame>\n"); + + for (mon= 0; mon < 12; mon++) + { + dnum= yi->YI_month_beg [mon]; + num= yi->YI_days_of_month [mon]; + di= &(yi->YI_day_info [dnum]); + + fprintf (fo, "<Frame %d-%02d>\n", di->DAYI_year, di->DAYI_month); + fprintf (fo, "%d-%02d %s\n\n", + di->DAYI_year, di->DAYI_month, MONTH_NAME [di->DAYI_month]); + + fprintf (fo, "------ week %2d\n", wnum); + for (day= 0; day < num; day++) + { + di= &(yi->YI_day_info [dnum++]); + wday= di->DAYI_wday; + dow3= (wday >= 0 && wday <= 6) ? DAY_OF_WEEK3 [wday] : "XXX"; + sprintf (day_frame_name, + "%d-%02d-%02d %s", + di->DAYI_year, + di->DAYI_month, + di->DAYI_day, + dow3); + /*************** + fprintf (fo, "<hyx.l fr=\"%s\" tdc=hyx.l tdp=6>%2d %s %66s[%3d]\n", + day_frame_name, di->DAYI_day, dow3, " ", dnum); + ************/ + fprintf (fo, + "[%3d] <hyx.l fr=\"%s\" tdc=hyx.l tdp=6>%2d %s\n", + dnum, day_frame_name, di->DAYI_day, dow3); + if (wday == 0) fprintf (fo, "------ week %2d\n", ++wnum); + } + fprintf (fo, "\n</Frame>\n"); + + } + return 0; +} diff --git a/lib/ds/cal/cal01.c b/lib/ds/cal/cal01.c new file mode 100644 index 0000000000000000000000000000000000000000..450936b92d562287b6cdb53b8fb69b32b1dc43d5 --- /dev/null +++ b/lib/ds/cal/cal01.c @@ -0,0 +1,59 @@ +/* + * FILE %ds/cal/cal01.c + * + * CAL generator + * + * written: 1994-10-17 + * latest update: 1997-01-15 23:05:00 + * + */ + +#include <stdio.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +int print_yi_year ( +FILE *fo, +struct YEAR_INFO *yi, +int year, +char *frame_name, +int year_prev, +int year_next, +char *pfx) +{ + int num; /* number of days in particular month */ + int wnum= 1; /* week number */ + int dnum= 0; /* day of year; 0..364 (365) */ + int mon; /* current month */ + + num= (yi->YI_is_leap_year) ? 366 : 365; + + if (frame_name == (char *) 0) + { + fprintf (fo, "<Frame %d%s>", year, pfx); + fprintf (fo, "<hyx.l dir=view fr=\"%d%s overview\">", year, pfx); + if (year_prev != 0) + fprintf (fo, "<hyx.l dir=prev fr=\"%d%s\">", year_prev, pfx); + if (year_next != 0) + fprintf (fo, "<hyx.l dir=next fr=\"%d%s\">", year_next, pfx); + } + else + { + if (frame_name [0]) + fprintf (fo, "<Frame %s>", frame_name); + } + fprintf (fo, "<hyx.l dir=up fr=$$root>\n"); + + fprintf (fo, "%d\n\n", year); + for (mon= 0; mon < 12; mon++) + { + fprintf (fo, "<hyx.l fr=\"%d-%02d%s\" tdc=hyx.l tdp=6>%2d %s\n", + year, mon+1, pfx, mon+1, MONTH_NAME[mon+1]); + } + + fputc ('\n', fo); + if (frame_name == (char *) 0 || frame_name [0]) + fprintf (fo, "</Frame>\n"); + + return 0; +} diff --git a/lib/ds/cal/cal01.o b/lib/ds/cal/cal01.o new file mode 100644 index 0000000000000000000000000000000000000000..fa3a6e0f32fd2a1ed7b2107d28cf8f9a02e95da0 Binary files /dev/null and b/lib/ds/cal/cal01.o differ diff --git a/lib/ds/cal/cal02.c b/lib/ds/cal/cal02.c new file mode 100644 index 0000000000000000000000000000000000000000..92f2f91d11855e247b2b0e7b6828c1ec05bb28aa --- /dev/null +++ b/lib/ds/cal/cal02.c @@ -0,0 +1,132 @@ +/* + * FILE %ds/cal/cal02.c + * + * CAL generator + * + * written: 1994-10-17 + * latest update: 1997-01-15 23:07:59 + * $Id: cal02.c,v 1.5 2011/08/25 01:24:33 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +static char day_frame_name [128]; + +/* ------------------------------------------------------------------------ */ +int print_yi_months ( +FILE *fo, +struct YEAR_INFO *yi, +int year_prev, +int year_next, +char *pfx) +{ + struct DAY_INFO *di; /* information about a day */ + struct DAY_INFO_EXTRA *de; + int num; /* number of days in particular month */ + int wnum; /* week number */ + int wyear; /* given week number's year */ + int dnum= 0; /* day of year; 0..364 (365) */ + int wday; /* day of week; 0..6 */ + char *dow3; /* name of day week */ + int mon; /* current month */ + int day; /* current day in month */ + + if (yi == (struct YEAR_INFO *) 0) return -1; + + num= (yi->YI_is_leap_year) ? 366 : 365; + + di= &(yi->YI_day_info [0]); + switch (di->DAYI_wday) + { + case 0: wnum= 52; wyear= yi->YI_year-1; break; + case 1: + case 2: + case 3: + case 4: wnum= 1; wyear= yi->YI_year; break; + case 5: + case 6: wnum= 52; wyear= yi->YI_year-1; break; + } + + for (mon= 0; mon < 12; mon++) + { + dnum= yi->YI_month_beg [mon]; + num= yi->YI_days_of_month [mon]; + di= &(yi->YI_day_info [dnum]); + + fprintf (fo, "<Frame %d-%02d%s>", di->DAYI_year, di->DAYI_month, pfx); + + if (mon > 0) + { + fprintf (fo, "<hyx.l fr=\"%d-%02d%s\" dir=prev>", + di->DAYI_year, di->DAYI_month-1, pfx); + } + else + { + if (year_prev != 0) + fprintf (fo, "<hyx.l fr=\"%d-12%s\" dir=prev>", year_prev, pfx); + } + + if (mon < 11) + { + fprintf (fo, "<hyx.l fr=\"%d-%02d%s\" dir=next>", + di->DAYI_year, di->DAYI_month+1, pfx); + } + else + { + if (year_next != 0) + fprintf (fo, "<hyx.l fr=\"%d-01%s\" dir=next>", year_next, pfx); + } + + fprintf (fo, "<hyx.l fr=\"%d%s\" dir=up>\n", di->DAYI_year, pfx); + + fprintf (fo, "%d-%02d %s\n\n", + di->DAYI_year, di->DAYI_month, MONTH_NAME [di->DAYI_month]); + + fprintf (fo, + "------ <mark id=\"%d-W%02d\" tdc=mark tdp=7>week %2d ------\n", + wyear, wnum, wnum); + + for (day= 0; day < num; day++) + { + di= &(yi->YI_day_info [dnum++]); + wday= di->DAYI_wday; + dow3= (wday >= 0 && wday <= 6) ? DAY_OF_WEEK3 [wday] : "XXX"; + get_day_string (day_frame_name, di); + + /*************** + fprintf (fo, "<hyx.l fr=\"%s%s\" tdc=hyx.l tdp=6>%2d %s %66s[%3d]\n", + day_frame_name, pfx, di->DAYI_day, dow3, " ", dnum); + ***************/ + fprintf (fo, + "<hyx.l fr=\"%s%s\" tdc=hyx.l tdp=6>%2d %s", + day_frame_name, pfx, di->DAYI_day, dow3); + if ((de= di->DAYI_extra) != (struct DAY_INFO_EXTRA *) 0) + printf (" (%s) %s", de->DAYIE_country, de->DAYIE_description); + fputc ('\n', fo); + + if (wday == 0) + { + wnum++; + if (wnum >= 53) + { /* new year */ + wnum= 1; + wyear++; + fprintf (fo, + "------ <mark id=\"%d-W%02d\" tdc=mark tdp=7>week %2d ------\n", + di->DAYI_year+1, 1, 1); + } + else + { + fprintf (fo, + "------ <mark id=\"%d-W%02d\" tdc=mark tdp=7>week %2d ------\n", + di->DAYI_year, wnum, wnum); + } + } + } + fprintf (fo, "</Frame>"); + } + return 0; +} diff --git a/lib/ds/cal/cal02.o b/lib/ds/cal/cal02.o new file mode 100644 index 0000000000000000000000000000000000000000..c8d994137040347cff5d1c10696c2283bc7d0374 Binary files /dev/null and b/lib/ds/cal/cal02.o differ diff --git a/lib/ds/cal/cal03.c b/lib/ds/cal/cal03.c new file mode 100644 index 0000000000000000000000000000000000000000..c14b140a44ac03ba5c7a96934afb2b8ee2180d14 --- /dev/null +++ b/lib/ds/cal/cal03.c @@ -0,0 +1,92 @@ +/* + * FILE %ds/cal/cal03.c + * + * CAL generator + * + * written: 1994-10-17 + * latest update: 1997-02-25 19:47:47 + * $Id: cal03.c,v 1.3 2011/08/25 01:24:33 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +static char day_frame_name [64]; +static char day_frame_before [64]; +static char day_frame_next [64]; + +/* ------------------------------------------------------------------------ */ +int print_yi_days (FILE *fo, struct YEAR_INFO *yi, char *pfx) +{ + struct DAY_INFO *di; /* information about a day */ + struct DAY_INFO_EXTRA *de; + int num; /* number of days in particular month */ + int ynum; /* number of days in this year */ + int wnum; /* week number */ + int dnum= 0; /* day of year; 0..364 (365) */ + int mon; /* current month */ + int day; /* current day in month */ + int wday; + char *dow3; /* day of week, three chars */ + + if (yi == (struct YEAR_INFO *) 0) return -1; + + ynum= (yi->YI_is_leap_year) ? 366 : 365; + + di= &(yi->YI_day_info [0]); + wnum= (di->DAYI_wday == 1) ? 1 : 0; + + for (mon= 0; mon < 12; mon++) + { + dnum= yi->YI_month_beg [mon]; + num= yi->YI_days_of_month [mon]; + di= &(yi->YI_day_info [dnum]); + + for (day= 0; day < num; day++) + { + day_frame_before [0]= 0; + day_frame_next [0]= 0; + if (dnum > 0) + { + di= &(yi->YI_day_info [dnum-1]); + get_day_string (day_frame_before, di); + } + + di= &(yi->YI_day_info [dnum]); + get_day_string (day_frame_name, di); + + if (di->DAYI_month != 12 || di->DAYI_day != 31) + { + di= &(yi->YI_day_info [dnum+1]); + get_day_string (day_frame_next, di); + } + + di= &(yi->YI_day_info [dnum]); + + fprintf (fo, "<Frame %s%s>", day_frame_name, pfx); + if (day_frame_before [0] != 0) + fprintf (fo, "<hyx.l fr=\"%s%s\" dir=prev>", day_frame_before, pfx); + if (day_frame_next [0] != 0) + fprintf (fo, "<hyx.l fr=\"%s%s\" dir=next>", day_frame_next, pfx); + fprintf (fo, "<hyx.l fr=\"%d-%02d%s\" dir=up>\n", + di->DAYI_year, di->DAYI_month, pfx); + + wday= di->DAYI_wday; + dow3= (wday >= 0 && wday <= 6) ? DAY_OF_WEEK3 [wday] : "XXX"; + + fprintf (fo, "<date>%s</date> %-50s [W %2d/D %3d/DL %3d]\n", + day_frame_name, dow3, wnum, dnum+1, ynum-dnum-1); + for (de= di->DAYI_extra; + de != (struct DAY_INFO_EXTRA *) 0; + de= de->DAYIE_next) + printf ("(%s) %s\n", de->DAYIE_country, de->DAYIE_description); + fprintf (fo, "\n</Frame>\n"); + if (di->DAYI_wday == 0) ++wnum; + dnum++; + } + + } + return 0; +} diff --git a/lib/ds/cal/cal03.o b/lib/ds/cal/cal03.o new file mode 100644 index 0000000000000000000000000000000000000000..f7a08c2e5831f5a3e2dd085cb1a78b3e86588d79 Binary files /dev/null and b/lib/ds/cal/cal03.o differ diff --git a/lib/ds/cal/cal04.c b/lib/ds/cal/cal04.c new file mode 100644 index 0000000000000000000000000000000000000000..f79e7869f689058213ba3d72e08cd53a57fe56b2 --- /dev/null +++ b/lib/ds/cal/cal04.c @@ -0,0 +1,129 @@ +/* + * FILE %ds/cal/cal04.c + * + * written: 1994-10-20 + * latest update: 1998-08-04 13:15:46 + * + */ + +#include <gg/dates.h> + +#ifdef NIL +#undef NIL +#endif +#define NIL ((struct DAY_INFO_EXTRA *) 0) + +/* ------------------------------------------------------------------------ */ +static char AT []= "AT"; +static char DE []= "DE"; +static char BE []= "BE"; /* Belgium */ + +static char UK []= "UK"; /* United Kingdom */ +static char GB []= "GB"; /* Great Britain */ +static char SCOT []= "SCOT"; /* Schottland */ +static char IR []= "IR"; /* Irland */ + +static char FR []= "FR"; +static char ES []= "ES"; +static char IT []= "IT"; + +static char US []= "US"; +static char CA []= "CA"; /* Canada */ + +struct DAY_INFO_EXTRA AT_holiday [] = +{ + { NIL, AT, "Neujahr", DAYIET_fixed, DAYIEC_holiday, 1, 1, 0, 9999 } , + { NIL, DE, "Neujahr", DAYIET_fixed, DAYIEC_holiday, 1, 1, 0, 9999 } , + { NIL, US, "New Year's Day", DAYIET_fixed, DAYIEC_holiday, 1, 1, 0, 9999 } , + { NIL, UK, "New Year's Day", DAYIET_fixed, DAYIEC_holiday, 1, 1, 0, 9999 } , + { NIL, IT, "Capodanno", DAYIET_fixed, DAYIEC_holiday, 1, 1, 0, 9999 } , + { NIL, FR, "Jour de l'An", DAYIET_fixed, DAYIEC_holiday, 1, 1, 0, 9999 } , + { NIL, ES, "?", DAYIET_fixed, DAYIEC_holiday, 1, 1, 0, 9999 } , + + { NIL, GB, "Public Holiday", DAYIET_fixed, DAYIEC_holiday, 1, 2, 0, 9999 } , +/******** vermutlich nicht korrekt! + { NIL, US, "Public Holiday", DAYIET_fixed, DAYIEC_holiday, 1, 2, 0, 9999 } , +**********************************/ + { NIL, IR, "Public Holiday", DAYIET_fixed, DAYIEC_holiday, 1, 2, 0, 9999 } , + { NIL, SCOT, "Public Holiday", DAYIET_fixed, DAYIEC_holiday, 1, 3, 0, 9999 } , + + { NIL, AT, "Heilige Drei Koenige", DAYIET_fixed, DAYIEC_holiday, 1, 6, 0, 9999 } , + { NIL, DE, "Heilige Drei Koenige", DAYIET_fixed, DAYIEC_holiday, 1, 6, 0, 9999 } , + { NIL, UK, "Epiphany", DAYIET_fixed, DAYIEC_holiday, 1, 6, 0, 9999 } , + { NIL, FR, "Epiphanie", DAYIET_fixed, DAYIEC_holiday, 1, 6, 0, 9999 } , + { NIL, IT, "Epifania N.S.", DAYIET_fixed, DAYIEC_holiday, 1, 6, 0, 9999 } , + { NIL, ES, "?", DAYIET_fixed, DAYIEC_holiday, 1, 6, 0, 9999 } , + + { NIL, IR, "St. Patrick's Day", DAYIET_fixed, DAYIEC_holiday, 3, 17, 0, 9999 } , + { NIL, ES, "?", DAYIET_fixed, DAYIEC_holiday, 3, 19, 0, 9999 } , + + { NIL, IT, "Anniversario della Liberazione", DAYIET_fixed, DAYIEC_holiday, 4, 25, 0, 9999 } , + + { NIL, AT, "Staatsfeiertag", DAYIET_fixed, DAYIEC_holiday, 5, 1, 0, 9999 } , + { NIL, DE, "Maifeiertag", DAYIET_fixed, DAYIEC_holiday, 5, 1, 0, 9999 } , + { NIL, IT, "Festa del Lavoro", DAYIET_fixed, DAYIEC_holiday, 5, 1, 0, 9999 } , + { NIL, FR, "Fete du Travail", DAYIET_fixed, DAYIEC_holiday, 5, 1, 0, 9999 } , + { NIL, GB, "May Day", DAYIET_fixed, DAYIEC_holiday, 5, 1, 0, 9999 } , + { NIL, ES, "?", DAYIET_fixed, DAYIEC_holiday, 5, 1, 0, 9999 } , + + { NIL, UK, "?", DAYIET_fixed, DAYIEC_holiday, 5, 2, 0, 9999 } , + + { NIL, FR, "Fete de l'Armistice 1945",DAYIET_fixed, DAYIEC_holiday, 5, 8, 0, 9999 } , /* MO, 1995 */ + { NIL, FR, "?", DAYIET_fixed, DAYIEC_holiday, 5, 12, 0, 9999 } , +#ifdef __T2_CHECK__ +... vermutlich nicht korrekt! + { NIL, US, "Armed Forces Day", DAYIET_fixed, DAYIEC_holiday, 5, 20, 0, 9999 } , /* SA, 1995 */ +#endif /* __T2_CHECK__ */ + { NIL, CA, "Victoria Day", DAYIET_fixed, DAYIEC_holiday, 5, 22, 0, 9999 } , /* MO, 1995 */ + + { NIL, IT, "Proclam. Republica", DAYIET_fixed, DAYIEC_holiday, 6, 4, 0, 9999 } , + { NIL, IR, "June Holiday", DAYIET_fixed, DAYIEC_holiday, 6, 5, 0, 9999 } , /* MO, 1995 */ +#ifdef __T2_CHECK__ +... vermutlich nicht korrekt! + { NIL, US, "Flag Day", DAYIET_fixed, DAYIEC_holiday, 6, 14, 0, 9999 } , /* MI, 1995 */ +#endif /* __T2_CHECK__ */ + + { NIL, CA, "Canada Day", DAYIET_fixed, DAYIEC_holiday, 7, 1, 0, 9999 } , + { NIL, US, "Independence Day", DAYIET_fixed, DAYIEC_holiday, 7, 4, 0, 9999 } , /* korrekt */ + { NIL, FR, "Fete Nationale", DAYIET_fixed, DAYIEC_holiday, 7, 14, 0, 9999 } , + { NIL, BE, "Fete Nationale", DAYIET_fixed, DAYIEC_holiday, 7, 21, 0, 9999 } , + + { NIL, AT, "Maria Himmelfahrt", DAYIET_fixed, DAYIEC_holiday, 8, 15, 0, 9999 } , + { NIL, DE, "Maria Himmelfahrt", DAYIET_fixed, DAYIEC_holiday, 8, 15, 0, 9999 } , + { NIL, IT, "?", DAYIET_fixed, DAYIEC_holiday, 8, 15, 0, 9999 } , + { NIL, ES, "?", DAYIET_fixed, DAYIEC_holiday, 8, 15, 0, 9999 } , + { NIL, FR, "?", DAYIET_fixed, DAYIEC_holiday, 8, 15, 0, 9999 } , + + { NIL, DE, "Tag der deutschen Einheit",DAYIET_fixed,DAYIEC_holiday, 10, 3, 1992, 9999 } , + /* Tag der deutschen Einheit seit 1992 ??? */ + { NIL, AT, "Nationalfeiertag", DAYIET_fixed, DAYIEC_holiday, 10, 26, 1956, 9999 } , + + { NIL, AT, "Allerheiligen", DAYIET_fixed, DAYIEC_holiday, 11, 1, 0, 9999 } , + { NIL, DE, "Buss und Bettag", DAYIET_fixed, DAYIEC_holiday, 11, 16, 0, 9999 } , + + { NIL, AT, "Maria Empfaengnis", DAYIET_fixed, DAYIEC_holiday, 12, 8, 0, 9999 } , + { NIL, IT, "?", DAYIET_fixed, DAYIEC_holiday, 12, 8, 0, 9999 } , + { NIL, ES, "?", DAYIET_fixed, DAYIEC_holiday, 12, 8, 0, 9999 } , + + { NIL, AT, "Christtag", DAYIET_fixed, DAYIEC_holiday, 12, 25, 0, 9999 } , + { NIL, DE, "Christtag", DAYIET_fixed, DAYIEC_holiday, 12, 25, 0, 9999 } , + { NIL, US, "Christmas Day", DAYIET_fixed, DAYIEC_holiday, 12, 25, 0, 9999 } , + { NIL, UK, "?", DAYIET_fixed, DAYIEC_holiday, 12, 25, 0, 9999 } , + { NIL, IT, "?", DAYIET_fixed, DAYIEC_holiday, 12, 25, 0, 9999 } , + { NIL, FR, "?", DAYIET_fixed, DAYIEC_holiday, 12, 25, 0, 9999 } , + { NIL, ES, "?", DAYIET_fixed, DAYIEC_holiday, 12, 25, 0, 9999 } , + + { NIL, AT, "Stefanitag", DAYIET_fixed, DAYIEC_holiday, 12, 26, 0, 9999 } , + { NIL, DE, "Stefanitag", DAYIET_fixed, DAYIEC_holiday, 12, 26, 0, 9999 } , +#ifdef __T2D_CHECK__ +... vermutlich nicht korrekt! + { NIL, US, "?", DAYIET_fixed, DAYIEC_holiday, 12, 26, 0, 9999 } , +#endif /* __T2D_CHECK__ */ + { NIL, UK, "?", DAYIET_fixed, DAYIEC_holiday, 12, 26, 0, 9999 } , + { NIL, IT, "?", DAYIET_fixed, DAYIEC_holiday, 12, 26, 0, 9999 } , + + { NIL, UK, "Boxing Day", DAYIET_fixed, DAYIEC_holiday, 12, 27, 0, 9999 } , + { NIL, AT, "Sylvester", DAYIET_fixed, DAYIEC_note, 12, 31, 0, 9999 } , + + { NIL, (char *) 0, (char *) 0, 0, DAYIEC_standard, 0, 0, 0, 0 } +} ; diff --git a/lib/ds/cal/cal04.o b/lib/ds/cal/cal04.o new file mode 100644 index 0000000000000000000000000000000000000000..981d8794afe9d535809f9ce71bb35c727b192056 Binary files /dev/null and b/lib/ds/cal/cal04.o differ diff --git a/lib/ds/cal/cal04exp.c b/lib/ds/cal/cal04exp.c new file mode 100644 index 0000000000000000000000000000000000000000..701947c72a7aeb6edf0aa4e4f609996313d49664 --- /dev/null +++ b/lib/ds/cal/cal04exp.c @@ -0,0 +1,55 @@ +/* + * FILE %ds/cal/cal04exp.c + * + * written: 1998-08-22 + * latest update: 1998-08-22 20:51:38 + * + */ + +#include <stdio.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +static char *TY []= { "?", "F", "V" }; +static char *CL []= { "S", "N", "H" }; + +/* ------------------------------------------------------------------------ */ +int export_holidays ( +FILE *fo, +struct DAY_INFO_EXTRA de []) +{ + struct DAY_INFO_EXTRA *dep; + int de_num; + + for (de_num= 0;; de_num++) + { + dep= &de [de_num]; + + if (dep->DAYIE_country == (char *) 0) break; + fprintf (fo, "%s:%s:%s:%s:%d:%d:%d:%d\n", + dep->DAYIE_country, + dep->DAYIE_description, + TY [dep->DAYIE_type], + CL [dep->DAYIE_class], + dep->DAYIE_month, + dep->DAYIE_day, + dep->DAYIE_year_first, + dep->DAYIE_year_last); + } + + return de_num; +} + +int main (int argc, char *argv []) +{ + FILE *fo; +#ifdef MSDOS + argc; argv; +#endif + + fo= fopen ("@cal.exp", "wb"); + export_holidays (fo, AT_holiday); + fclose (fo); + + return 0; +} diff --git a/lib/ds/cal/cal05.c b/lib/ds/cal/cal05.c new file mode 100644 index 0000000000000000000000000000000000000000..bdeecafe9c08c009090595bc84ffb400bcbb897d --- /dev/null +++ b/lib/ds/cal/cal05.c @@ -0,0 +1,121 @@ +/* + * FILE %usr/ds/cal/cal05.c + * + * written: 1994-10-20 + * latest update: 1998-08-04 13:19:58 + * + */ + +#include <stdio.h> +#include <gg/dates.h> + +static char *AT= "AT"; +static char *US= "US"; +static char *EU= "EU"; + +/* ------------------------------------------------------------------------ */ +int fixup_extra_information ( +struct YEAR_INFO *yi, +struct DAY_INFO_EXTRA de []) +{ + struct DAY_INFO *di; + struct DAY_INFO_EXTRA *dep; + int de_num; + int idx; + int current_year; + int mon_easter; + int day_easter; + + if (yi == (struct YEAR_INFO *) 0) return -1; + + current_year= yi->YI_year; + + /* unbewegliche Feiertage */ + for (de_num= 0;; de_num++) + { + dep= &de [de_num]; + + if (dep->DAYIE_country == (char *) 0) break; + dep->DAYIE_next= (struct DAY_INFO_EXTRA *) 0; + + if (current_year < dep->DAYIE_year_first + || current_year > dep->DAYIE_year_last + ) continue; + + switch (dep->DAYIE_type) + { + case DAYIET_fixed: + idx= get_day_index (yi, dep->DAYIE_month, dep->DAYIE_day); + fixup_day (yi, idx, dep); + break; + } + } + + /* bewegliche Feiertage um Ostern */ + get_easter (current_year, &mon_easter, &day_easter); + idx= get_day_index (yi, mon_easter, day_easter); + + /* NOTE: (1996-02-11 11:23:06) Aschermittwoch korrekt errechnet fuer 1995/96 */ + fixup_day (yi, idx-46, create_day_info_extra (AT, DAYIEC_note, "Aschermittwoch")); + fixup_day (yi, idx-46, create_day_info_extra ("FR", DAYIEC_note, "Les Cenderes")); + fixup_day (yi, idx-46, create_day_info_extra ("IT", DAYIEC_note, "Le Ceneri")); + fixup_day (yi, idx-46, create_day_info_extra ("UK", DAYIEC_note, "Ash Wednesday")); + + fixup_day (yi, idx- 7, create_day_info_extra (AT, DAYIEC_holiday, "Palmsonntag")); + fixup_day (yi, idx- 3, create_day_info_extra (AT, DAYIEC_holiday, "Gruendonnerstag")); + fixup_day (yi, idx- 2, create_day_info_extra (AT, DAYIEC_holiday, "Karfreitag")); + fixup_day (yi, idx, create_day_info_extra (AT, DAYIEC_holiday, "Ostersonntag")); + fixup_day (yi, idx+ 1, create_day_info_extra (AT, DAYIEC_holiday, "Ostermontag")); + fixup_day (yi, idx+39, create_day_info_extra (AT, DAYIEC_holiday, "Christi Himmelfahrt")); + fixup_day (yi, idx+49, create_day_info_extra (AT, DAYIEC_holiday, "Pfingstsonntag")); + fixup_day (yi, idx+50, create_day_info_extra (AT, DAYIEC_holiday, "Pfingstmontag")); + fixup_day (yi, idx+60, create_day_info_extra (AT, DAYIEC_holiday, "Fronleichnam")); + + /* bewegliche Feiertage um Weihnachten */ + /* Advent: 4 Sonntage vor dem 25. Dez. */ + idx= get_day_index (yi, 12, 25); + for (di= &yi->YI_day_info [idx]; di->DAYI_wday != 0; di--) idx--; + fixup_day (yi, idx-21, create_day_info_extra (AT, DAYIEC_note, "1. Advent")); + fixup_day (yi, idx-14, create_day_info_extra (AT, DAYIEC_note, "2. Advent")); + fixup_day (yi, idx- 7, create_day_info_extra (AT, DAYIEC_note, "3. Advent")); + fixup_day (yi, idx, create_day_info_extra (AT, DAYIEC_note, "4. Advent")); + + idx= get_day_index (yi, 12, 24); + fixup_day (yi, idx, create_day_info_extra (AT, DAYIEC_note, "Heiliger Abend")); + + /* Muttertag; 2. Sonntag im Mai */ +#ifdef __OLD__ /* 1997-01-15 22:03:50 */ + idx= get_day_index (yi, 5, 1); + for (di= &yi->YI_day_info [idx]; di->DAYI_wday != 0; di++) idx++; + di++; idx++; + for ( ; di->DAYI_wday != 0; di++) idx++; +#endif /* __OLD__ 1997-01-15 22:03:50 */ + + /* US holidays on mondays */ + idx= get_wday_index (yi, 5, DAYI_sunday, 2); + fixup_day (yi, idx, create_day_info_extra (EU, DAYIEC_note, "Muttertag")); + + idx= get_wday_index (yi, 1, DAYI_monday, 3); + fixup_day (yi, idx, create_day_info_extra (US, DAYIEC_holiday, "Martin Luther King's Birthday(sp?)")); + + idx= get_wday_index (yi, 2, DAYI_monday, 3); + fixup_day (yi, idx, create_day_info_extra (US, DAYIEC_holiday, "Washington's Birthday(sp?)")); + + idx= get_wday_index (yi, 10, DAYI_monday, 2); + fixup_day (yi, idx, create_day_info_extra (US, DAYIEC_holiday, "Columbus Day")); + + /* Sommerzeit */ + idx= get_wday_index (yi, 3, DAYI_sunday, 5); + fixup_day (yi, idx, create_day_info_extra (EU, DAYIEC_note, "Sommerzeitanfang")); + + idx= -1; + if (current_year >= 1996) + idx= get_wday_index (yi, 10, DAYI_sunday, 5); + if (current_year < 1996 && current_year > 1970) /* T2D: Sommerzeitende */ + idx= get_wday_index (yi, 9, DAYI_sunday, 5); + + if (idx != -1) + fixup_day (yi, idx, create_day_info_extra (EU, DAYIEC_note, "Sommerzeitende")); + + return 0; +} diff --git a/lib/ds/cal/cal05.o b/lib/ds/cal/cal05.o new file mode 100644 index 0000000000000000000000000000000000000000..539a465bee12200079d5f72cabcd43b940080c70 Binary files /dev/null and b/lib/ds/cal/cal05.o differ diff --git a/lib/ds/cal/cal06.c b/lib/ds/cal/cal06.c new file mode 100644 index 0000000000000000000000000000000000000000..7e675c8f7d12eab18c3b71313640aca52e5d7d01 --- /dev/null +++ b/lib/ds/cal/cal06.c @@ -0,0 +1,24 @@ +/* + * FILE %ds/cal/cal06.c + * + * CAL generator + * + * written: 1994-10-20 + * latest update: 1996-03-24 17:17:30 + * + */ + +#include <stdio.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +int get_day_string (char *day_frame, struct DAY_INFO *di) +{ + sprintf (day_frame, + "%d-%02d-%02d", + di->DAYI_year, + di->DAYI_month, + di->DAYI_day); + + return 0; +} diff --git a/lib/ds/cal/cal06.o b/lib/ds/cal/cal06.o new file mode 100644 index 0000000000000000000000000000000000000000..ff29e43a926b53a79cfcdef10d31e143f75b6375 Binary files /dev/null and b/lib/ds/cal/cal06.o differ diff --git a/lib/ds/cal/cal07.c b/lib/ds/cal/cal07.c new file mode 100644 index 0000000000000000000000000000000000000000..be53e1eaba498302031fe06fdde751e0352d9186 --- /dev/null +++ b/lib/ds/cal/cal07.c @@ -0,0 +1,80 @@ +/* + * FILE %ds/cal/cal07.c + * + * written: 1994-12-05 + * latest update: 1998-08-04 12:49:53 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +int print_calendar ( +FILE *fo, +int year_from, +int year_to, +int print_what, +char *pfx) +{ + int year; + int year_prev; + int year_next; + struct YEAR_INFO *year_info; + + if (print_what & CAL_PRINT_root_frame) + { + fprintf (fo, "<Frame $$root>\n"); + for (year= year_from; year <= year_to; year++) + { + /* print_yi_year (fo, year_info, year, "", 0, 0); */ + fprintf (fo, "<hyx.l fr=\"%d%s\" tdc=hyx.l tdp=4>%d", + year, pfx, year); + if (print_what & CAL_PRINT_alternative_view) + fprintf (fo, " <hyx.l fr=\"%d%s overview\" tdc=hyx.l tdp=8>overview", + year, pfx); + fputc ('\n', fo); + } + + fprintf (fo, "<hyx.l fr=\"$$index\" tdc=hyx.l tdp=7>$$index"); + /* fprintf (fo, " <hyx.l fr=\"$$md5\" tdc=hyx.l tdp=5>$$md5"); */ + fprintf (fo, "\n</Frame>\n"); + } + + for (year= year_from; year <= year_to; year++) + { + year_prev= (year > year_from) ? year-1 : 0; + year_next= (year < year_to) ? year+1 : 0; + + if ((year_info= calloc (sizeof (struct YEAR_INFO), 1)) + == (struct YEAR_INFO *) 0) + { + fprintf (stderr, "can't allocated YEAR_INFO data structure!\n"); + break; + } + + setup_year_info (year_info, year); + fixup_extra_information (year_info, AT_holiday); + + if (print_what & CAL_PRINT_year) + print_yi_year (fo, year_info, year, (char *) 0, year_prev, year_next, + pfx); + if (print_what & CAL_PRINT_months) + print_yi_months (fo, year_info, year_prev, year_next, pfx); + if (print_what & CAL_PRINT_days) + print_yi_days (fo, year_info, pfx); + + if (print_what & CAL_PRINT_alternative_view) + { + cal_reset_alternative_view (year_info); + cal_setup_alternative_view (year_info); + cal_print_alternative_view (fo, year_info, pfx); + } + + cal_reset_year_info (year_info); + free (year_info); + } + + return 0; +} diff --git a/lib/ds/cal/cal07.o b/lib/ds/cal/cal07.o new file mode 100644 index 0000000000000000000000000000000000000000..8a09ad67c2f5cb6862c35f514a9082173ca9342f Binary files /dev/null and b/lib/ds/cal/cal07.o differ diff --git a/lib/ds/cal/cal08.c b/lib/ds/cal/cal08.c new file mode 100644 index 0000000000000000000000000000000000000000..6cb91c0553c503d520564d106f9d12af03252aa2 --- /dev/null +++ b/lib/ds/cal/cal08.c @@ -0,0 +1,24 @@ +/* + * FILE ~/usr/planner/cal08.c + * + * written: 1995-06-10 + * latest update: 1995-06-10 + * + */ + +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +int cal_reset_alternative_view (struct YEAR_INFO *yi) +{ + int z; + int s; + + if (yi == (struct YEAR_INFO *) 0) return -1; + + for (z= 0; z < YI_AV_LINES; z++) + for (s= 0; s < YI_AV_COLUMNS; s++) + yi->YI_av [z][s]= (struct DAY_INFO *) 0; + + return 0; +} diff --git a/lib/ds/cal/cal08.o b/lib/ds/cal/cal08.o new file mode 100644 index 0000000000000000000000000000000000000000..f6527872fad67c751020885100579f850c058b98 Binary files /dev/null and b/lib/ds/cal/cal08.o differ diff --git a/lib/ds/cal/cal09.c b/lib/ds/cal/cal09.c new file mode 100644 index 0000000000000000000000000000000000000000..a8a5b9349f81eb0e9d9046640b7acf937cc46e8f --- /dev/null +++ b/lib/ds/cal/cal09.c @@ -0,0 +1,53 @@ +/* + * FILE %ds/cal/cal09.c + * + * written: 1995-06-10 + * latest update: 1995-12-03 + * + */ + +#include <gg/dates.h> + +#include <stdio.h> + +/* ------------------------------------------------------------------------ */ +int cal_setup_alternative_view (struct YEAR_INFO *yi) +{ + int m; + int day; + int dm; + int dnum; + int z; + int sp; + int spo; + struct DAY_INFO *di; + + if (yi == (struct YEAR_INFO *) 0) return -1; + + for (m= 0; m < 12; m++) + { + dnum= yi->YI_month_beg [m]; + dm= yi->YI_days_of_month [m]; + di= &(yi->YI_day_info [dnum]); + z= (m/3)*6; + sp= di->DAYI_wday-1; + if (sp < 0) sp= 6; + spo= (m%3)*7; +/***** 1995-12-03 22:25:44 +printf ("m=%d dm=%d z=%d sp=%d spo=%d\n", m, dm, z, sp, spo); +*************************/ + + for (day= 0; day < dm; day++) + { + di= &(yi->YI_day_info [dnum++]); + yi->YI_av [z][sp+spo]= di; + if (++sp >= 7) + { + z++; + sp= 0; + } + } + } + + return 0; +} diff --git a/lib/ds/cal/cal09.o b/lib/ds/cal/cal09.o new file mode 100644 index 0000000000000000000000000000000000000000..dfcbea471a50a84f6b9298fe54895b080815afcb Binary files /dev/null and b/lib/ds/cal/cal09.o differ diff --git a/lib/ds/cal/cal10.c b/lib/ds/cal/cal10.c new file mode 100644 index 0000000000000000000000000000000000000000..bf645bfd7df15d7e4662f541920cda1508eaec71 --- /dev/null +++ b/lib/ds/cal/cal10.c @@ -0,0 +1,74 @@ +/* + * FILE %ds/cal/cal10.c + * + * written: 1995-06-10 + * latest update: 1996-03-24 17:21:19 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +int cal_print_alternative_view (FILE *fo, struct YEAR_INFO *yi, char *pfx) +{ + int m; + int z; + int s; + int j; + struct DAY_INFO *di; + struct DAY_INFO_EXTRA *de; + + if (fo == (FILE *) 0 || yi == (struct YEAR_INFO *) 0) return -1; + + fprintf (fo, "<Frame %d%s overview>", yi->YI_year, pfx); + fprintf (fo, "<hyx.l dir=view fr=\"%d%S\">", yi->YI_year, pfx); + fprintf (fo, "<hyx.l dir=up fr=$$root>\n"); + fprintf (fo, "%d overview\n\n", yi->YI_year); + + for (z= 0; z < YI_AV_LINES; z++) + { + if ((z%6) == 0) + { + for (j= 0; j < 3; j++) + { + m= (z/6)*3+j+1; + fprintf (fo, "<hyx.l fr=\"%d-%02d%s\" tdp=3 tdc=hyx.l>%s", + yi->YI_year, m, pfx, MONTH_NAME [m]); + for (s= 1; s <= 7; s++) + fprintf (fo, " %s", DAY_OF_WEEK2 [s%7]); + if (j < 2) fprintf (fo, " |"); + } + fputc ('\n', fo); + } + + for (s= 0; s < YI_AV_COLUMNS; s++) + { + if (s == 0) fprintf (fo, " "); + if (s == 7 || s == 14) fprintf (fo, " | "); + + di= yi->YI_av [z][s]; + if (di == (struct DAY_INFO *) 0) + { + printf (" "); + continue; + } + + printf (" <hyx.l fr=\"%d-%02d-%02d%s\" tdp=2 tdc=%s>%2d", + di->DAYI_year, di->DAYI_month, di->DAYI_day, pfx, + ((de= di->DAYI_extra) != (struct DAY_INFO_EXTRA *) 0 + && strcmp (de->DAYIE_country, "AT") == 0 + && de->DAYIE_class == DAYIEC_holiday + ) ? "mark" : "hyx.l", + di->DAYI_day); + } + + fputc ('\n', fo); + + if ((z%6) == 5) fputc ('\n', fo); + } + fprintf (fo, "</Frame>\n"); + + return 0; +} diff --git a/lib/ds/cal/cal10.o b/lib/ds/cal/cal10.o new file mode 100644 index 0000000000000000000000000000000000000000..5ba012c672dac36a632a4f221178b48e84b1d5df Binary files /dev/null and b/lib/ds/cal/cal10.o differ diff --git a/lib/ds/cal/contrib b/lib/ds/cal/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/cal/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/cal/dt001.c b/lib/ds/cal/dt001.c new file mode 100644 index 0000000000000000000000000000000000000000..97014c9af03ff918c986993c96982dbdd6280611 --- /dev/null +++ b/lib/ds/cal/dt001.c @@ -0,0 +1,26 @@ +/* + * FILE %ds/cal/dt001.c + * + * Ermittlung der Datums und der Zeit + * + * written: 1989 03 18: extrahiert aus e:/xerox/cr.c + * 1994-07-18: extrahiert in /usr/sbr/dt001.c + * latest update: 1997-04-29 10:30:11 + * + */ + +#include <time.h> +#include <stdio.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int actual_datim ( +char *datum, /* destination string for the formated date and time values */ +int format) /* see date_and_time_formats for more details */ +{ + return _actual_datim (datum, format, time ((time_t *) 0)); +} diff --git a/lib/ds/cal/dt001.o b/lib/ds/cal/dt001.o new file mode 100644 index 0000000000000000000000000000000000000000..1cc4e09e4c5036752ed432ee790cb3afa75e049b Binary files /dev/null and b/lib/ds/cal/dt001.o differ diff --git a/lib/ds/cal/dt001b.c b/lib/ds/cal/dt001b.c new file mode 100644 index 0000000000000000000000000000000000000000..f1a1eec714fb5b5a59abfa272a52c8b7d64a536a --- /dev/null +++ b/lib/ds/cal/dt001b.c @@ -0,0 +1,134 @@ +/* + * FILE %ds/cal/dt001b.c + * + * Ermittlung der Datums und der Zeit + * + * written: 1989 03 18: extrahiert aus e:/xerox/cr.c + * 1994-07-18: extrahiert aus /usr/sbr/dt001.c + * latest update: 1998-07-19 10:04:20 + * + */ + +#include <time.h> +#include <stdio.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +extern char *DAY_OF_WEEK3 []; +extern char *MONTH_NAME []; + +/* ------------------------------------------------------------------------ */ +int _actual_datim ( +char *datum, /* destination string for the formated date and time values */ +int format, /* see date_and_time_formats for more details */ +time_t tt) /* actual time value to be formatted */ +{ + struct tm *tm_s; + int mon; + int year; + + if (datum == (char *) 0 || tt < 0L) return -1; + + if (format & DATIMfmt_GMT) + { + tm_s= gmtime (&tt); + format ^= DATIMfmt_GMT; + } + else + { + tm_s= localtime (&tt); + } + + switch (format) + { + case DATIMfmt_none: + datum [0]= 0; + break; + + case DATIMfmt_date_time: /* 1989-03-18 14:04:40 */ + sprintf (datum, "%04d-%02d-%02d %2d:%02d:%02d", + 1900+tm_s->tm_year, tm_s->tm_mon+1, tm_s->tm_mday, + tm_s->tm_hour, tm_s->tm_min, tm_s->tm_sec); + break; + + case DATIMfmt_date: /* 1989-03-18 */ + sprintf (datum, "%04d-%02d-%02d", + 1900+tm_s->tm_year, tm_s->tm_mon+1, tm_s->tm_mday); + break; + + case DATIMfmt_this_month: /* 1989-03 */ + case DATIMfmt_next_month: /* 1989-03 */ + case DATIMfmt_last_month: /* 1989-03 */ + year= 1900+tm_s->tm_year; + mon= tm_s->tm_mon+1; + + switch (format) + { + case DATIMfmt_next_month: + if (mon >= 12) { mon= 1; year++; } + else mon++; + break; + case DATIMfmt_last_month: + if (mon <= 1) { mon= 12; year--; } + else mon--; + break; + } + + sprintf (datum, "%04d-%02d", year, mon); + break; + + case DATIMfmt_dos_date: /* mm-dd-yyyy */ + sprintf (datum, "%02d-%02d-%04d", + tm_s->tm_mon+1, tm_s->tm_mday, 1900+tm_s->tm_year); + break; + + case DATIMfmt_time: /* 14:04:40 */ + sprintf (datum, "%2d:%02d:%02d", + tm_s->tm_hour, tm_s->tm_min, tm_s->tm_sec); + break; + + case DATIMfmt_time2: /* 04:04:40 */ + sprintf (datum, "%02d:%02d:%02d", + tm_s->tm_hour, tm_s->tm_min, tm_s->tm_sec); + break; + + case DATIMfmt_touch: /* mmddhhmmyy */ + sprintf (datum, "%02d%02d%02d%02d%02d", + tm_s->tm_mon+1, tm_s->tm_mday, + tm_s->tm_hour, tm_s->tm_min, tm_s->tm_year); + break; + + case DATIMfmt_touch_gnu: /* mm dd hh mm ccyy.ss */ + sprintf (datum, "%02d%02d%02d%02d%04d.%02d", + tm_s->tm_mon+1, tm_s->tm_mday, + tm_s->tm_hour, tm_s->tm_min, tm_s->tm_year+1900, + tm_s->tm_sec); + break; + + case DATIMfmt_touch_aix: /*ccyy mm dd hh mm . ss */ + sprintf (datum, "%02d%02d%02d%02d%02d.%02d", + tm_s->tm_year+1900, + tm_s->tm_mon+1, tm_s->tm_mday, + tm_s->tm_hour, tm_s->tm_min, + tm_s->tm_sec); + break; + + case DATIMfmt_elm_mbox: /* Mon May 19 19:39:25 1994 */ + sprintf (datum, "%s %s %2d %2d:%02d:%02d %4d", + DAY_OF_WEEK3 [tm_s->tm_wday%7], + MONTH_NAME [(tm_s->tm_mon%12)+1], + tm_s->tm_mday, + tm_s->tm_hour, tm_s->tm_min, tm_s->tm_sec, + tm_s->tm_year+1900); + break; + + case DATIMfmt_seconds: + sprintf (datum, "%ld", tt); + break; + } + + return 0; +} diff --git a/lib/ds/cal/dt001b.o b/lib/ds/cal/dt001b.o new file mode 100644 index 0000000000000000000000000000000000000000..157243bbdd84f4be81cac3a444293e5e0e52a104 Binary files /dev/null and b/lib/ds/cal/dt001b.o differ diff --git a/lib/ds/cal/dt001t.c b/lib/ds/cal/dt001t.c new file mode 100644 index 0000000000000000000000000000000000000000..b28dea37fe061de27f2ab8674ecd170ee57d5a7b --- /dev/null +++ b/lib/ds/cal/dt001t.c @@ -0,0 +1,25 @@ +/* + * FILE ~/usr/sbr/dt001t.c + * + * module for testing printing of the current date and time + * + * written: 1994-07-23 + * latest update: 1994-07-23 + * + */ + +#include <time.h> +#include <gg/sbr.h> + +static char line [256]; +main () +{ + long tt; + + tt= time ((long *) 0); + printf ("tt=0x%08lX\n", tt); + _actual_datim (line, 1, tt); + printf ("line=%s\n", line); + return 0; +} + diff --git a/lib/ds/cal/dt002.c b/lib/ds/cal/dt002.c new file mode 100644 index 0000000000000000000000000000000000000000..1e565ba942a0b550a67539f31a2fc82b1c74bece --- /dev/null +++ b/lib/ds/cal/dt002.c @@ -0,0 +1,42 @@ +/* + * FILE ~/usr/sbr/dt002.c + * + * Ermittlung der Datums und der Zeit + * + * written: 1989 03 18: extrahiert aus e:\xerox\cr.c + * latest update: 1995-06-11 + * + */ + +#include <time.h> +#include <stdio.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int actual_datim_int ( +int *jahr, +int *monat, +int *tag, +int *stunde, +int *minute, +int *sekunde) +{ + struct tm *tm_s; + time_t tt; + + tt= time ((time_t *) 0); + tm_s= localtime (&tt); + + *jahr = tm_s->tm_year; + *monat = tm_s->tm_mon+1; + *tag = tm_s->tm_mday; + *stunde = tm_s->tm_hour; + *minute = tm_s->tm_min; + *sekunde= tm_s->tm_sec; + + return 0; +} diff --git a/lib/ds/cal/dt002.o b/lib/ds/cal/dt002.o new file mode 100644 index 0000000000000000000000000000000000000000..8ad49c512994be88ab1140fee46b2145157548d9 Binary files /dev/null and b/lib/ds/cal/dt002.o differ diff --git a/lib/ds/cal/dt002b.c b/lib/ds/cal/dt002b.c new file mode 100644 index 0000000000000000000000000000000000000000..94feffce41e8f61cf21e9b5fbd3cfaf422cabd9d --- /dev/null +++ b/lib/ds/cal/dt002b.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/cal/dt002b.c + * + * Ermittlung des aktuelle Jahres + * + * written: 1994-12-05 + * latest update: 1998-08-04 12:31:22 + * + */ + +#include <time.h> +#include <stdio.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int get_current_year () +{ + struct tm *tm_s; + time_t tt; + + tt= time ((time_t *) 0); + tm_s= localtime (&tt); + + return 1900+tm_s->tm_year; +} diff --git a/lib/ds/cal/dt002b.o b/lib/ds/cal/dt002b.o new file mode 100644 index 0000000000000000000000000000000000000000..613386d237671fc6f5d715265d997cd2575e3e4f Binary files /dev/null and b/lib/ds/cal/dt002b.o differ diff --git a/lib/ds/cal/dt003.c b/lib/ds/cal/dt003.c new file mode 100644 index 0000000000000000000000000000000000000000..af052f6b00acc9ddcdff522f2319caf7c2593394 --- /dev/null +++ b/lib/ds/cal/dt003.c @@ -0,0 +1,33 @@ +/* + * FILE ~/usr/sbr/dt003.c + * + * print current date in a readable format + * + * written: 1990 11 03 + * latest update: 1995-08-03 + * + */ + +#include <stdio.h> +#include <time.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int print_date_time (FILE *fo) +{ + time_t tt; + struct tm *tm_s; + + tt= time ((time_t *) 0); + tm_s= localtime (&tt); + + fprintf (fo, "%04d-%02d-%02d %2d:%02d:%02d", + 1900+tm_s->tm_year, tm_s->tm_mon+1, tm_s->tm_mday, + tm_s->tm_hour, tm_s->tm_min, tm_s->tm_sec); + + return 0; +} diff --git a/lib/ds/cal/dt003.o b/lib/ds/cal/dt003.o new file mode 100644 index 0000000000000000000000000000000000000000..4c2415efb5dcf70856269fe833aae95decafe4b2 Binary files /dev/null and b/lib/ds/cal/dt003.o differ diff --git a/lib/ds/cal/dt003b.c b/lib/ds/cal/dt003b.c new file mode 100644 index 0000000000000000000000000000000000000000..8af461e953c7110c0d8b6f6172a06258f29622c2 --- /dev/null +++ b/lib/ds/cal/dt003b.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/cal/dt003b.c + * + * print current date in a readable format in + * one large word + * + * written: 2000-01-16 + * latest update: 2000-01-16 20:19:00 + * + */ + +#include <stdio.h> +#include <time.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int print_date_time_token (FILE *fo) +{ + time_t tt; + struct tm *tm_s; + + tt= time ((time_t *) 0); + tm_s= localtime (&tt); + + fprintf (fo, "%04d-%02d-%02d_%02d:%02d:%02d", + 1900+tm_s->tm_year, tm_s->tm_mon+1, tm_s->tm_mday, + tm_s->tm_hour, tm_s->tm_min, tm_s->tm_sec); + + return 0; +} + +#ifdef MAIN +int main (int argc, char *argv []) +{ + print_date_time_token (stdout); + fputc ('\n', stdout); +} +#endif + diff --git a/lib/ds/cal/dt003b.o b/lib/ds/cal/dt003b.o new file mode 100644 index 0000000000000000000000000000000000000000..4b31ff972ea7ec3494e4f4df742fbff3347e82e8 Binary files /dev/null and b/lib/ds/cal/dt003b.o differ diff --git a/lib/ds/cal/dt003c.c b/lib/ds/cal/dt003c.c new file mode 100644 index 0000000000000000000000000000000000000000..2a431e13edece2e4c08ea2e58619a4c972a0dd7f --- /dev/null +++ b/lib/ds/cal/dt003c.c @@ -0,0 +1,24 @@ +/* + * FILE %ds/cal/dt003b.c + * + * print current date in a readable format in + * one large word + * + * written: 2000-01-16 + * latest update: 2000-01-16 20:19:00 + * + */ + +#include <stdio.h> +#include <time.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +int main (int argc, char *argv []) +{ + printf ("%ld\n", time ((long *) 0)); +} + diff --git a/lib/ds/cal/dt004.c b/lib/ds/cal/dt004.c new file mode 100644 index 0000000000000000000000000000000000000000..bc4c1c7768ce39d59ef5ef8cd9197839c9664c67 --- /dev/null +++ b/lib/ds/cal/dt004.c @@ -0,0 +1,50 @@ +/* + * FILE %ds/cal/dt004.c + * + * prepare a RFC 822 date string + * + * written: 1992 04 07 + * latest update: 1997-11-26 13:24:13 + * + */ + +#include <stdio.h> +#include <time.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +static char *MONTHS [] = +{ + "Jan", "Feb", "Mar", + "Apr", "May", "Jun", + "Jul", "Aug", "Sep", + "Oct", "Nov", "Dec" +}; + +/* ------------------------------------------------------------------------ */ +static char *WEEK_DAYS [] = +{ + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Huh" +} ; + +/* ------------------------------------------------------------------------ */ +void prepare_date (char *datum, char *tz, int max_line) +{ + struct tm *tm_s; + time_t tt; + + if (max_line < 60) return; + + tt= time ((time_t *) 0); + tm_s= localtime (&tt); + + sprintf (datum, "%s, %d %s %04d %2d:%02d:%02d %s", + WEEK_DAYS [tm_s->tm_wday], + tm_s->tm_mday, MONTHS [tm_s->tm_mon], 1900+tm_s->tm_year, + tm_s->tm_hour, tm_s->tm_min, tm_s->tm_sec, + tz); +} diff --git a/lib/ds/cal/dt004.o b/lib/ds/cal/dt004.o new file mode 100644 index 0000000000000000000000000000000000000000..ea6a667a8a46392fa4b503604879f0e1ca62c1c6 Binary files /dev/null and b/lib/ds/cal/dt004.o differ diff --git a/lib/ds/cal/dt006.c b/lib/ds/cal/dt006.c new file mode 100644 index 0000000000000000000000000000000000000000..3520727802dca65eed1862669e63f068d61817ea --- /dev/null +++ b/lib/ds/cal/dt006.c @@ -0,0 +1,42 @@ +/* + * FILE %ds/cal/dt006.c + * + * get then number of days in the given month + * + * written: 1992 08 30 + * latest update: 1997-01-16 9:47:44 + * + */ + +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +static int DAYS_OF_MONTH [] = +{ +/* (invalid) */ -1, +/* January */ 31, +/* Februar */ 28, +/* March */ 31, +/* April */ 30, +/* May */ 31, +/* June */ 30, +/* July */ 31, +/* August */ 31, +/* September */ 30, +/* October */ 31, +/* November */ 30, +/* December */ 31 +} ; + +/* ------------------------------------------------------------------------ */ +int days_of_month (int year, int month) +{ + if (month <= 0 || month > 12) return -1; + + if (month == 2) return (is_leap_year (year)) ? 29 : 28; + return DAYS_OF_MONTH [month]; +} diff --git a/lib/ds/cal/dt006.o b/lib/ds/cal/dt006.o new file mode 100644 index 0000000000000000000000000000000000000000..4855d4ae52c7d4437a1869272e2d23a5f7f9fe84 Binary files /dev/null and b/lib/ds/cal/dt006.o differ diff --git a/lib/ds/cal/dt007.c b/lib/ds/cal/dt007.c new file mode 100644 index 0000000000000000000000000000000000000000..61ad583af0c66a2e2bdff7b48cb01aa8761e9739 --- /dev/null +++ b/lib/ds/cal/dt007.c @@ -0,0 +1,27 @@ +/* + * FILE %ds/cal/dt007.c + * + * find out if given year is a leap year + * + * written: 1992 08 30 + * latest update: 1998-08-04 12:34:09 + * + */ + +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int is_leap_year (int year) +{ + if (year < 1582) return (year % 4) ? 0 : 1; + + if ((year%4) != 0) return 0; + if ((year%100) != 0) return 1; + if ((year%400) != 0) return 0; + + return 1; +} diff --git a/lib/ds/cal/dt007.o b/lib/ds/cal/dt007.o new file mode 100644 index 0000000000000000000000000000000000000000..ccf7ed9f70d8336d0e44de1c1b4889c39fd7e076 Binary files /dev/null and b/lib/ds/cal/dt007.o differ diff --git a/lib/ds/cal/dt008.c b/lib/ds/cal/dt008.c new file mode 100644 index 0000000000000000000000000000000000000000..d6f6b1625b0672b15ced864e56200e48587bdf07 --- /dev/null +++ b/lib/ds/cal/dt008.c @@ -0,0 +1,62 @@ +/* + * FILE ~/usr/sbr/dt008.c + * + * modify a given date by a number of days + * + * written: 1992 08 30 + * latest update: 1994-10-16 + * + */ + +#include <sys/types.h> +#include <time.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int modify_date (struct tm *d, int delta) +{ + int dom; + + if (delta == 0) return 0; + + if (delta < 0) + { + delta= -delta; + d->tm_wday= (d->tm_wday-(delta%7)+7)%7; + while (delta > d->tm_mday) + { + delta -= d->tm_mday; + if (d->tm_mon == 0) + { + d->tm_year--; + d->tm_mon= 11; + } + else d->tm_mon--; + d->tm_mday= days_of_month (d->tm_year, d->tm_mon+1); + } + d->tm_mday -= delta; + } + else + { + d->tm_wday= (d->tm_wday+(delta%7))%7; + for (;;) + { + dom= days_of_month (d->tm_year, d->tm_mon+1); + if (delta + d->tm_mday <= dom) break; + delta -= dom - d->tm_mday + 1; + if (d->tm_mon == 11) + { + d->tm_year++; + d->tm_mon= 0; + } + else d->tm_mon++; + d->tm_mday= 1; + } + d->tm_mday += delta; + } + return 0; +} diff --git a/lib/ds/cal/dt008.o b/lib/ds/cal/dt008.o new file mode 100644 index 0000000000000000000000000000000000000000..44caab1aae7f449407b2a8f6fa0e5e5792bcc74e Binary files /dev/null and b/lib/ds/cal/dt008.o differ diff --git a/lib/ds/cal/dt010.c b/lib/ds/cal/dt010.c new file mode 100644 index 0000000000000000000000000000000000000000..3b415fa78e596209f6346402b78e16bbf5e1a5b6 --- /dev/null +++ b/lib/ds/cal/dt010.c @@ -0,0 +1,46 @@ +/* + * FILE %ds/cal/dt010.c + * + * written: 1992 04 07 + * latest update: 1997-01-16 9:44:20 + * + */ + +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long day_number (int jahr, int mon, int tag) +{ + long x1, x2, x3, x4, x4a, v; + + if (jahr <= 1582 + || mon < 1 || mon > 12 + || tag < 1 || tag > 31 + ) return -1L; + + x1 = 365L*((long) jahr) + (long) (31*(mon-1) + tag); + + if (mon <= 2) + { + x2 = 0L; + x3 = (long) ((jahr-1)/4); + x4a = (long) ((jahr-1)/100+1); + } + else + { + x2 = (long) ((mon*4 + 23)/10); + x3 = (long) (jahr/4); + x4a = (long) (jahr/100+1); + } + + x4 = (x4a*3L)/4L; + v = x1 - x2; + v += x3; + v -= x4; + + return v; +} diff --git a/lib/ds/cal/dt010.o b/lib/ds/cal/dt010.o new file mode 100644 index 0000000000000000000000000000000000000000..b43baa4a74dd42bbc639611d1ea48284d2b4ddd2 Binary files /dev/null and b/lib/ds/cal/dt010.o differ diff --git a/lib/ds/cal/dt011.c b/lib/ds/cal/dt011.c new file mode 100644 index 0000000000000000000000000000000000000000..d9ca4c1396e8a7f339d792c6f841b7de4c16786f --- /dev/null +++ b/lib/ds/cal/dt011.c @@ -0,0 +1,23 @@ +/* + * FILE %ds/cal/dt011.c + * + * written: 1992 04 07 + * latest update: 1997-01-16 9:44:06 + * + */ + +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int weekday (int jahr, int mon, int tag) +{ + long v; + + v= day_number (jahr, mon, tag); + if (v < 0L) return -1; + return (int) ((v+6L)%7L); /* 0..Sun, 6..Sat */ +} diff --git a/lib/ds/cal/dt011.o b/lib/ds/cal/dt011.o new file mode 100644 index 0000000000000000000000000000000000000000..ae7c06b12aef3555c56acaaf9c59311d145745bd Binary files /dev/null and b/lib/ds/cal/dt011.o differ diff --git a/lib/ds/cal/dt011t.c b/lib/ds/cal/dt011t.c new file mode 100644 index 0000000000000000000000000000000000000000..c7a5c3f137214064f99200472fd6994542c39c47 --- /dev/null +++ b/lib/ds/cal/dt011t.c @@ -0,0 +1,44 @@ +/* + * FILE ~/usr/ds/cal/dt011t.c + * + * written: 1992 04 07 + * latest update: 1995-06-25 + * + */ + +#include <stdio.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + int year, month, day; + int m_easter, d_easter; + long v; + int d; + char *dow3; + + argc; argv; + + for (;;) + { + printf ("enter date: (yyyy mm dd) "); + scanf ("%d", &year); + scanf ("%d", &month); + scanf ("%d", &day); + v= day_number (year, month, day); + d= weekday (year, month, day); + + get_easter (year, &m_easter, &d_easter); + + dow3= (d >= 0 && d <= 6) ? DAY_OF_WEEK3 [d] : "Schlingel ;)"; + printf ("%d %02d %02d = %7ld = %d %s\n", year, month, day, v, d, dow3); + printf ("Ostern: %d %d\n", m_easter, d_easter); + } + + return 0; +} diff --git a/lib/ds/cal/dt014a.c b/lib/ds/cal/dt014a.c new file mode 100644 index 0000000000000000000000000000000000000000..d96fa343fb09f2351990d0e592a192d90d3df391 --- /dev/null +++ b/lib/ds/cal/dt014a.c @@ -0,0 +1,21 @@ +/* + * FILE ~/usr/sbr/dt014a.c + * + * written: 1994-10-17 + * latest update: 1995-06-10 + * + */ + +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +char *DAY_OF_WEEK3 [] = +{ + "Sun", + "Mon", "Tue", "Wed", + "Thu", "Fri", "Sat" +} ; diff --git a/lib/ds/cal/dt014a.o b/lib/ds/cal/dt014a.o new file mode 100644 index 0000000000000000000000000000000000000000..b860e14fc83bdf6ee51b54c0620ab1a646538762 Binary files /dev/null and b/lib/ds/cal/dt014a.o differ diff --git a/lib/ds/cal/dt014b.c b/lib/ds/cal/dt014b.c new file mode 100644 index 0000000000000000000000000000000000000000..8eaccc4b0a2dad16638466ba5b1e3d4b3f514745 --- /dev/null +++ b/lib/ds/cal/dt014b.c @@ -0,0 +1,21 @@ +/* + * FILE ~/usr/sbr/dt014b.c + * + * written: 1995-06-10 + * latest update: 1995-06-10 + * + */ + +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +char *DAY_OF_WEEK2 [] = +{ + "SU", + "MO", "TU", "WE", + "TH", "FR", "SA" +} ; diff --git a/lib/ds/cal/dt014b.o b/lib/ds/cal/dt014b.o new file mode 100644 index 0000000000000000000000000000000000000000..9b5cd8f6ee4ecdd05673d5e3b16f7ccb5026bbb4 Binary files /dev/null and b/lib/ds/cal/dt014b.o differ diff --git a/lib/ds/cal/dt015a.c b/lib/ds/cal/dt015a.c new file mode 100644 index 0000000000000000000000000000000000000000..136f14a2f067c95c858d8e66f5e2f6a14c85a267 --- /dev/null +++ b/lib/ds/cal/dt015a.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/cal/dt015a.c + * + * written: 1994-10-17 + * latest update: 1996-08-19 12:50:31 + * + */ + +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +char *MONTH_NAME [13] = +{ + "unknown", + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" +} ; diff --git a/lib/ds/cal/dt015a.o b/lib/ds/cal/dt015a.o new file mode 100644 index 0000000000000000000000000000000000000000..0f057ddbf1713783b71672f1b340c53b58cbb2b6 Binary files /dev/null and b/lib/ds/cal/dt015a.o differ diff --git a/lib/ds/cal/dt021.c b/lib/ds/cal/dt021.c new file mode 100644 index 0000000000000000000000000000000000000000..7a7edd0728f9318c9d2811226f61b3d197452fdf --- /dev/null +++ b/lib/ds/cal/dt021.c @@ -0,0 +1,69 @@ +/* + * FILE ~/usr/sbr/dt021.c + * + * operations with date and time + * + * written: 1988 03 28: (as datum.c) + * 1991 06 24: revision + * latest update: 1994-05-07: revision: split up in more modules + * + */ + +#include <stdio.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int chk_datum ( +char *sb, /* String: Beginn-Datum; Format JJJJ-MM-TT */ +char *se, /* . Ende -Datum */ +int sl, /* max. String-Laenge (nicht ausgewertet!!!) */ +int *d, /* Dauer in Tagen zw. Beginn und Ende */ +int *e, /* Fehler Code: 0 .. ok; */ + /* 1 .. Beginn, 2 .. Ende falsch */ +int *beg_jahr) /* 1. Jahr, falls identifiziert */ +/* RETURN: -1 .. Fehler; 0 .. korrekte Daten */ +{ + int ib= 0; + int ie= 0; + int bjahr, bmon, btag; + int ejahr, emon, etag; + long v1, v2; + int t1, t2; + + while (sb [ib] == ' ') ib++; + while (se [ie] == ' ') ie++; + if (sb [ib] == ':') + { sscanf (& sb [ib+1], "%d", d); + return 0; + } + if (se [ie] == ':') + { sscanf (& se [ib+1], "%d", d); + return 0; + } + if (get_datum (sb, ib, sl, &bjahr, &bmon, &btag) == -1) + { *e = 1; + return -1; + } + if (get_datum (se, ie, sl, &ejahr, &emon, &etag) == -1) + { *e = 2; + return -1; + } + if (bjahr < 100) bjahr += 1900; + if (ejahr < 100) ejahr += 1900; + if (delta_datum (bjahr, bmon, btag, &v1, &t1, + ejahr, emon, etag, &v2, &t2, d, e) == -1) + return -1; +/* w_setcup (0,0,3); + printf ("BEGINN: %4d-%2d-%2d -> %ld %d\n", + bjahr, bmon, btag, v1, t1); + printf ("ENDE: %4d-%2d-%2d -> %ld %d\n", + ejahr, emon, etag, v2, t2); */ + (*d)++; + *beg_jahr= bjahr; + + return 0; +} diff --git a/lib/ds/cal/dt021.o b/lib/ds/cal/dt021.o new file mode 100644 index 0000000000000000000000000000000000000000..556f5a1f4989bfc3e43557438bebe500a809604c Binary files /dev/null and b/lib/ds/cal/dt021.o differ diff --git a/lib/ds/cal/dt022.c b/lib/ds/cal/dt022.c new file mode 100644 index 0000000000000000000000000000000000000000..7aec740a07c2c7162628b4c18383807e4bfdec2d --- /dev/null +++ b/lib/ds/cal/dt022.c @@ -0,0 +1,182 @@ +/* + * FILE %ds/cal/dt022.c + * + * operations with date and time + * + * written: 1988 03 28: (as datum.c) + * 1991 06 24: revision + * 1994-05-07: revision: split up in more modules + * latest update: 1996-11-10 15:06:26 + * + */ + +#include <string.h> +#include <gg/strings.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +#define N_mon 19 +static char *monate [N_mon] = +{ + "j�n", "feb", "m�r", "apr", "mai", "jun", + "jul", "aug", "sep", "okt", "nov", "dez", + "jae", "jan", "mae", + "mar", "may", "oct", "dec" +} ; + +/* ------------------------------------------------------------------------ */ +static int monatnum [N_mon] = +{ + 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, + 1, 1, 3, + 3, 5, 10, 12 +} ; + +/* ------------------------------------------------------------------------ */ +int get_datum ( +char *s, /* Datumsstring */ +int zone_begin, +int zone_end, /* Laenge von s */ +int *jahr, +int *mon, +int *tag) +{ + int i, c; + int ms= -1; + int mi= 1; + char monat [20]; + + *jahr= *mon= *tag= 0; + + for (i= 0; (c= s [i]) && mi; i++) + if (c < '0' || c > '9') mi= 0; + + if (mi) + { + mi= 0; + for (i= zone_begin; s [i] && i < zone_end; i++) + { + c= s [i] -'0'; + switch (i) + { + case 0: *jahr = c; break; + case 1: *jahr = 10*(*jahr) + c; break; + case 2: *mon = c; break; + case 3: *mon = 10*(*mon) + c; break; + case 4: *tag = c; break; + case 5: *tag = 10*(*tag) + c; break; + case 6: mi = c; break; + case 7: mi = 10*mi + c; break; + } + } + + if (*jahr > 31) + { + *jahr += 1900; + return 0; + } + + if (*mon > 31 && *jahr >= 15 && *jahr <= 21) + { + *jahr= (*jahr) * 100 + (*mon); + *mon = *tag; + *tag = mi; + return 0; + } + + if (*tag > 31) + { + mi = *tag; + *tag = *jahr; + *jahr = mi + 1900; + return 0; + } + + if (mi > 31 && *tag >= 15 && *tag <= 21) + { + c = *tag; + *tag = *jahr; + *jahr = mi + c*100; + return 0; + } + return -1; + } + + i= 0; + get_jahr_mon_tag (s, &i, jahr, monat, 0, &ms); + get_jahr_mon_tag (s, &i, mon, monat, 1, &ms); + get_jahr_mon_tag (s, &i, tag, monat, 2, &ms); + + if (ms != -1) + { + to_lower (monat); + for (i = 0; i < N_mon; i++) + if (strncmp (monate [i], monat, 3) == 0) + { + mi = monatnum [i]; + break; + } + if (i == N_mon) return -1; + } + + i = 0; + if (*jahr == 0) i++; + if (*mon == 0) i++; + if (*tag == 0) i++; + + if (ms == -1) + { + if (i > 0) return -1; + if (*tag > 31) + { + i = *tag; + *tag = *jahr; + *jahr = i; + } + return 0; + } + else + { + if (i > 1) return -1; + switch (ms) + { + case 0: + if (*tag > 31) + { + *jahr = *tag; + *tag = *mon; + } + else *jahr = *mon; + break; + case 1: + if (*tag > 31) + { + i = *jahr; + *jahr = *tag; + *tag = i; + } + break; + case 2: + if (*jahr > 31) + *tag = *mon; + else + { + i = *jahr; + *jahr = *mon; + *tag = i; + } + break; + default: + return -1; + } + *mon = mi; + return 0; + } + + return 0; +} diff --git a/lib/ds/cal/dt022.o b/lib/ds/cal/dt022.o new file mode 100644 index 0000000000000000000000000000000000000000..a6522a04908db2c7efd501ba49d3ac7393040b6a Binary files /dev/null and b/lib/ds/cal/dt022.o differ diff --git a/lib/ds/cal/dt023.c b/lib/ds/cal/dt023.c new file mode 100644 index 0000000000000000000000000000000000000000..b79add780fdf5166b36908d17bd96228d7978e50 --- /dev/null +++ b/lib/ds/cal/dt023.c @@ -0,0 +1,62 @@ +/* + * FILE %ds/cal/dt023.c + * + * operations with date and time + * + * written: 1988 03 28: (as datum.c) + * 1991 06 24: revision + * 1994-05-07: revision: split up in more modules + * latest update: 1996-11-10 15:05:54 + * + */ + +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int get_jahr_mon_tag ( +char *s, /* I: Datumsstring */ +int *ii, /* I/O: Scanner Index */ +int *vv, /* O: Jahr / Monat / Tag als Integer */ +char *m, /* O: Monat als String*/ +int ms, /* I: ??? */ +int *msr) /* O: ??? */ +{ + int i; + int v= 0; /* numberic value of some items */ + int mi= 0; + int c; + + i= *ii; + + while ((c= s [i]) == ' ' || c == ':' || c == '_' || + c == '-' || c == '+' || c == '=' || c == '|' || + c == ',' || c == '.' || c == ';' || c == '/') i++; + + if ((c= s [i]) >= '0' && c <= '9') + { + for (; c = s [i]; i++) + if (c >= '0' && c <= '9') + v= v*10+ s [i] - '0'; + else break; + } + else + { + for (; c = s [i]; i++) + if (c >= 'a' && c <= 'z') + { + m [mi++]= (char) c; + m [mi]= 0; + *msr= ms; + } + else break; + } + + *ii= i; + *vv= v; + + return 0; +} diff --git a/lib/ds/cal/dt023.o b/lib/ds/cal/dt023.o new file mode 100644 index 0000000000000000000000000000000000000000..c6acccf9844fcc4154050053b603bb87add255a0 Binary files /dev/null and b/lib/ds/cal/dt023.o differ diff --git a/lib/ds/cal/dt024.c b/lib/ds/cal/dt024.c new file mode 100644 index 0000000000000000000000000000000000000000..123f2ba02fc58389b0d7dafda3714d581e345076 --- /dev/null +++ b/lib/ds/cal/dt024.c @@ -0,0 +1,47 @@ +/* + * FILE ~/usr/sbr/dt024.c + * + * operations with date and time + * + * written: 1988 03 28: (as datum.c) + * 1991 06 24: revision + * 1994-05-07: revision: split up in more modules + * latest update: 1994-07-23 + * + */ + +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* Differenz zwischen 2 Tagen: -------------------------------------------- */ +int delta_datum ( +int bjahr, /* first day */ +int bmon, +int btag, +long *v1, +int *t1, +int ejahr, /* last day */ +int emon, +int etag, +long *v2, /* Datumswert */ +int *t2, /* Wochentag */ +int *d, +int *e) /* error code: 0 .. ok; 1 .. error in date 1; 2 .. @d2 */ +{ + int sj; + + *e= 1; + if (valid_datum (bjahr, bmon, btag, v1, t1, &sj, &sj) == -1) return -1; + + *e= 2; + if (valid_datum (ejahr, emon, etag, v2, t2, &sj, &sj) == -1) return -1; + + if (((long) *v2) < ((long) *v1)) return -1; + *d= (int) (((long) *v2) - ((long) *v1)); + *e= 0; + + return 0; +} diff --git a/lib/ds/cal/dt024.o b/lib/ds/cal/dt024.o new file mode 100644 index 0000000000000000000000000000000000000000..29c5ffaef716fe0e7233f0b6e0936ee144df8bbb Binary files /dev/null and b/lib/ds/cal/dt024.o differ diff --git a/lib/ds/cal/dt025.c b/lib/ds/cal/dt025.c new file mode 100644 index 0000000000000000000000000000000000000000..aeb7e471be2d797a0990c22f6694f2ecfa381d4b --- /dev/null +++ b/lib/ds/cal/dt025.c @@ -0,0 +1,94 @@ +/* + * FILE %ds/cal/dt025.c + * + * operations with date and time + * + * written: 1988 03 28: (as datum.c) + * 1991 06 24: revision + * 1994-05-07: revision: split up in more modules + * latest update: 1997-09-03 18:06:17 + * $Id: dt025.c,v 1.2 2010/05/03 23:43:28 gonter Exp $ + * + */ + +#include <gg/dates.h> +#include <stdio.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* Datum moeglich: (32. Dezember ... ) ------------------------------------ */ +int valid_datum ( +int jahr, +int mon, +int tag, +long *v, /* Datumswert */ +int *t, /* Wochentag */ +int *xsj, /* 1 -> Schaltjahr */ +int *xt) /* Zahl der Tage in diesem Monat */ +{ + int sj = 0; + long x1, x2, x3; + double y1, y2; + long vv; + + if (tag < 1 || + mon < 1 || mon > 12) return -1; + if ((jahr % 4) == 0) + if ((jahr % 100) == 0) + if ((jahr % 400) == 0) + sj = 1; + else sj = 0; + else sj = 1; + else sj = 0; + + *xsj= sj; + + switch (mon) + { + case 1: case 3: case 5: case 7: + case 8: case 10: case 12: + if (tag > (*xt = 31)) return -1; + break; + case 4: case 6: case 9: + case 11: if (tag > (*xt = 30)) return -1; + break; + case 2: if (sj) + { if (tag > (*xt = 29)) return -1; + } + else if (tag > (*xt = 28)) return -1; + break; + } + + x1 = (long) ((long) 365 * (long) jahr) + + (long) tag + (long) (31*(mon-1)); + + if (mon == 1 || mon == 2) + { x2 = (long) ((jahr-1)/100+1); + y1 = (double) (((double) (x2*(long)3))/4.0); + x3 = (long) ((jahr-1)/4); + vv = x1 + x3; + vv = vv - ((long) y1); +/* printf ("%ld; x1=%ld x2=%ld x3=%ld y1=%g \n", + vv, x1, x2, x3, y1); */ + } + else { x2 = (long) (jahr/100+1); + y1 = (double) (((double) (x2*(long)3))/4.0); + x3 = (long) (jahr/4); + y2 = ((double) mon) * 0.4 + 2.3; + vv = x1 + x3; + vv = vv - ((long) y1); + vv = vv - ((long) y2); +/* printf ("%ld; x1=%ld x2=%ld x3=%ld y1=%g y2=%g\n", + vv, x1, x2, x3, y1, y2); */ + } + + x1= vv - ( (-vv)/(long) 7)* (long) 7; + /*** *t= (int) (x1 % 7); ***/ + *t= (int) (vv % 7); + *v= vv; + printf ("x1=%ld t=%ld v=%ld\n", (long) x1, (long) *t, (long) *v); + + return 0; +} diff --git a/lib/ds/cal/dt025.o b/lib/ds/cal/dt025.o new file mode 100644 index 0000000000000000000000000000000000000000..7885c0ec17fec6285b22e8c00121e33b59df1193 Binary files /dev/null and b/lib/ds/cal/dt025.o differ diff --git a/lib/ds/cal/dt031.c b/lib/ds/cal/dt031.c new file mode 100644 index 0000000000000000000000000000000000000000..de55a69d5e2201d574c7329aa3abc99c1ed2aede --- /dev/null +++ b/lib/ds/cal/dt031.c @@ -0,0 +1,255 @@ +/* + * FILE %ds/cal/dt031.c + * + * analyze a string in a Date: line + * + * written: 1989 10 13 + * 1991 09 16: Revision + * 1991 09 21: timezones + * 1994-05-14: restructuring and renaming + * (was: ~/usr/mail/datanal.c) + * latest update: 1997-08-20 18:18:14 + * $Id: dt031.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/dates.h> + +#define STACK_SIZE 20 + +/* ------------------------------------------------------------------------ */ +int analyze_date ( +const char *s, +int *jahr, +int *mon, +int *tag, +int *std, +int *minutes, +int *sek, +int *x_timezone) /* time zone offset */ +{ +#define STAT_start 0 +#define STAT_string 1 +#define STAT_integer 2 + int stat=STAT_start; + int ch, sidx; + int value; + int signum= 0; + int f_jahr= 0; + int dat_stack= 0; + int dat_typ [STACK_SIZE]; + int dat_val [STACK_SIZE]; + int dat_sgn [STACK_SIZE]; + char dat_name [40]; + + *mon= -1; *tag= -1; *jahr= -1; + *std= -1; *minutes= -1; *sek= -1; + *x_timezone= 0; + if (s == (char *) 0 || *s == 0) return -1; + + for (;; s++) + { + ch= *s; + + switch (stat) + { + case STAT_start: + if (ch >= 'A' && ch <= 'Z') + { + ch= ch + 'a' - 'A'; + signum= 0; + goto X0; + } + + if (ch >= 'a' && ch <= 'z') + { +X0: sidx= 0; + dat_name [sidx++]= (char) ch; + stat= STAT_string; + signum= 0; + } else + if (ch >= '0' && ch <= '9') + { + value= ch - '0'; + stat= STAT_integer; + sidx= 0; + dat_name [sidx++]= (char) ch; + } else + if (ch == '-') signum= 1; else + if (ch == '+') signum= 2; else + signum= 0; + break; + + case STAT_string: + if (ch >= 'A' && ch <= 'Z') + { + ch = ch + 'a' - 'A'; + goto X1; + } + if (ch >= 'a' && ch <= 'z') + { +X1: if (sidx >= STACK_SIZE) stat=0; + else dat_name [sidx++]= (char) ch; + } + else + if (ch >= '0' && ch <= '9') + { + dat_name [sidx]= 0; + analyze_dat_str (dat_name,dat_val,dat_typ, &dat_stack,STACK_SIZE); + value= ch - '0'; + stat= 2; + } + else + { + stat= 0; + dat_name [sidx]= 0; + analyze_dat_str (dat_name,dat_val,dat_typ, &dat_stack,STACK_SIZE); + } + break; + + case STAT_integer: + if (ch >= 'A' && ch <= 'Z') + { + ch= ch + 'a' - 'A'; + goto X3; + } + if (ch >= 'a' && ch <= 'z') + { +X3: if (dat_stack >= STACK_SIZE) break; + dat_name [sidx]= 0; + dat_typ [dat_stack]= check_for_timezone (&value, &signum, dat_name); + dat_sgn [dat_stack]= signum; + dat_val [dat_stack]= value; + dat_stack++; + signum= 0; + sidx= 0; + dat_name [sidx++]= (char) ch; + stat= 1; + } + else + if (ch >= '0' && ch <= '9') + { + value= value*10 + ch - '0'; + dat_name [sidx++]= (char) ch; + dat_name [sidx]= 0; + } + else + { + stat= 0; + if (dat_stack >= STACK_SIZE) break; + dat_name [sidx]=0; + dat_typ [dat_stack] = + check_for_timezone (&value, &signum, dat_name); + dat_sgn [dat_stack] = signum; signum=0; + dat_val [dat_stack++] = value; + } + break; + } + if (ch == 0) break; + } + + for (stat= 0; stat < dat_stack; stat++) + if (dat_typ [stat] == DT_str_mon) /* month string; expected format: */ + /* dd mmm (yy)yy */ + { + if (stat > 0 && dat_typ [stat-1] == 1 && dat_val [stat-1] <= 31) + dat_typ [stat-1]= DT_int_day; + + if (stat+1 < dat_stack + && dat_typ [stat+1] == 1 + && dat_val [stat+1] < 2000 + ) + { + if (dat_val [stat+1] <= 31 && dat_val [stat+1] >= 1) + dat_typ [stat+1]= DT_int_day; + else + { + dat_typ [stat+1]= DT_int_year; + f_jahr=1; + } + stat+=2; + } + break; /* ... */ + } + + /* hours */ + if (stat < dat_stack) + if (dat_typ [stat] == 1 && dat_val [stat] <= 24) + dat_typ [stat++]= 301; + + /* minutes */ + if (stat < dat_stack) + if (dat_typ [stat] == 1 && dat_val [stat] <= 59) + dat_typ [stat++]= 302; + + /* seconds */ + if (stat < dat_stack) + if (dat_typ [stat] == 1 && dat_val [stat] <= 59) + dat_typ [stat++]= 303; + + if (f_jahr == 0) + for (stat= 0; stat < dat_stack; stat++) + { + if (dat_typ [stat] == DT_int + && ((dat_val [stat] > 31 && dat_val [stat] <= 99) + || dat_val [stat] > 1900 + ) + ) + { + if (dat_val [stat] > 31 && dat_val [stat] <= 99) + dat_val [stat] += 1900; + dat_typ [stat]= DT_int_year; + f_jahr= 1; + break; + } + } + +#ifdef DEBUG + for (stat=0; stat < dat_stack; stat++) + { + printf ("[%2d] typ=%3d val=%4d sgn=%d", + stat, dat_typ [stat], dat_val [stat], dat_sgn [stat]); + switch (dat_typ [stat]) + { + case DT_str_mon: printf (" <-- Monat"); break; + case 201: printf (" <-- Tag"); break; + case DT_int_year: printf (" <-- Jahr"); break; + case 301: printf (" <-- Stunde"); break; + case 302: printf (" <-- Minute"); break; + case 303: printf (" <-- Sekunde");break; + case DT_str_tz: printf (" <-- timezone"); break; + case DT_str_tzm: printf (" <-- timezone modifier"); break; + } + putchar ('\n'); + } +#endif + + for (stat= 0; stat < dat_stack; stat++) + switch (dat_typ [stat]) + { + case DT_str_mon: *mon = dat_val [stat]; break; + case DT_str_tz: *x_timezone = dat_val [stat]; break; + case DT_str_tzm: *x_timezone += dat_val [stat]; break; + case 201: *tag = dat_val [stat]; break; + case DT_int_year: *jahr = dat_val [stat]; break; + case 301: *std = dat_val [stat]; break; + case 302: *minutes = dat_val [stat]; break; + case 303: *sek = dat_val [stat]; break; + } + + /* assign remaining integers to remaining slots */ + for (stat= 0; stat < dat_stack; stat++) + { + if (dat_typ [stat] == 1) + { + if (*mon == -1) *mon= dat_val [stat]; else + if (*tag == -1) *tag= dat_val [stat]; else + if (*std == -1) *std= dat_val [stat]; else + if (*minutes == -1) *minutes= dat_val [stat]; else + if (*sek == -1) *sek= dat_val [stat]; + } + } + + return 0; +} diff --git a/lib/ds/cal/dt031.o b/lib/ds/cal/dt031.o new file mode 100644 index 0000000000000000000000000000000000000000..2a2f576765c9f58e2507958a6699973969dbc328 Binary files /dev/null and b/lib/ds/cal/dt031.o differ diff --git a/lib/ds/cal/dt031t.c b/lib/ds/cal/dt031t.c new file mode 100644 index 0000000000000000000000000000000000000000..f3f983a28eddb6406711cac046734b556afe39c0 --- /dev/null +++ b/lib/ds/cal/dt031t.c @@ -0,0 +1,47 @@ +/* + * FILE %ds/cal/dt031t.c + * + * written: 1996-11-10 + * latest update: 1996-11-10 15:15:19 + * + */ + +#include <stdio.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +char *examples [] = +{ + "1996-11-20", + "Feb 12, 1996", + "11/12/96", + "22.3.97", + "3.27.97", + "25. August 1996, 18:00:20", + "1996-11-10 15:49:50", + (char *) 0 +} ; + +/* ------------------------------------------------------------------------ */ +int main (void); +int main () +{ + char *ex; + int k; + int jahr, mon, tag, std, minutes, sek, x_timezone; + long v; + int t, xsj, xt; + + for (k= 0; (ex= examples [k]) != (char *) 0; k++) + { + analyze_date (ex, &jahr, &mon, &tag, &std, &minutes, &sek, &x_timezone); + printf ("string: '%s'\n", ex); + printf (" jahr=%d mon=%d tag=%d\n", jahr, mon, tag); + printf (" std=%d min=%d sek=%d tz=%d\n\n", std, minutes, sek,x_timezone); + + valid_datum (jahr, mon, tag, &v, &t, &xsj, &xt); + printf (" v=%ld t=%d xsj=%d xt=%d\n", v, t, xsj, xt); + } + + return 0; +} diff --git a/lib/ds/cal/dt032.c b/lib/ds/cal/dt032.c new file mode 100644 index 0000000000000000000000000000000000000000..542b35ce7a525e83c30cec153bf120eb118edcfc --- /dev/null +++ b/lib/ds/cal/dt032.c @@ -0,0 +1,94 @@ +/* + * FILE %ds/cal/dt032.c + * + * analyze a string in a Date: line + * + * written: 1989 10 13 + * 1991 09 16: Revision + * 1991 09 21: timezones + * 1994-05-14: restructuring and renaming + * (was: ~/usr/mail/datanal.c) + * latest update: 1997-07-03 21:31:23 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +#define N_date_strings 28 +static struct DATE_str date_strings [N_date_strings] = +{ + { DT_str_junk, 1, 4, "date" }, + { DT_str_mon, 1, 3, "jan" }, + { DT_str_mon, 2, 3, "feb" }, + { DT_str_mon, 3, 3, "mar" }, + { DT_str_mon, 4, 3, "apr" }, + { DT_str_mon, 5, 3, "may" }, + { DT_str_mon, 5, 3, "mai" }, + { DT_str_mon, 6, 3, "jun" }, + { DT_str_mon, 7, 3, "jul" }, + { DT_str_mon, 8, 3, "aug" }, + { DT_str_mon, 9, 3, "sep" }, + { DT_str_mon, 10, 3, "oct" }, + { DT_str_mon, 10, 3, "okt" }, + { DT_str_mon, 11, 3, "nov" }, + { DT_str_mon, 12, 3, "dec" }, + { DT_str_mon, 12, 3, "dez" }, + { DT_str_tz, 1, 3, "cet" }, + { DT_str_tz, 1, 3, "mez" }, + { DT_str_tz, 1, 6, "metdst" }, + { DT_str_tz, 1, 3, "met" }, + { DT_str_tz, 1, 3, "wut" }, /* WU time ???? */ + { DT_str_tz, 0, 3, "bst" }, /* british standard time? */ + { DT_str_tz, 0, 3, "gmt" }, + { DT_str_tz, -4, 3, "edt" }, + { DT_str_tz, -5, 3, "cdt" }, + { DT_str_tz, -6, 3, "mdt" }, + { DT_str_tz, -7, 3, "pdt" }, + { DT_str_tzm, 1, 3, "dst" } /* daylight savings time */ +} ; + +/* ------------------------------------------------------------------------ */ +int analyze_dat_str ( +char *name, +int dat_val [], +int dat_typ [], +int *dat_stack, +int STACK_SIZE) +{ + int typ, value; + int i; + + typ= -1; + if (*dat_stack >= STACK_SIZE) return -1; + +# ifdef DEBUG + printf ("[%2d]='%s'\n", *dat_stack, name); +# endif + for (i= 0; i < N_date_strings; i++) + { + if (strncmp (name, + date_strings[i].DStr_str, + date_strings[i].DStr_min_str) == 0) + { + typ= date_strings[i].DStr_type; + value= date_strings[i].DStr_value; + break; + } + } + + switch (typ) + { + case DT_str_tz: + case DT_str_tzm: + case 3: + case DT_str_mon: + dat_typ [*dat_stack ]= typ; + dat_val [(*dat_stack)++]= value; + return 0; + default: + return -1; + } +} diff --git a/lib/ds/cal/dt032.o b/lib/ds/cal/dt032.o new file mode 100644 index 0000000000000000000000000000000000000000..88a06e3e263ba2f721701f2f59dc990afd5588d0 Binary files /dev/null and b/lib/ds/cal/dt032.o differ diff --git a/lib/ds/cal/dt033.c b/lib/ds/cal/dt033.c new file mode 100644 index 0000000000000000000000000000000000000000..2a59e231cab92c6974bec5f6f1e45e314e82bb4a --- /dev/null +++ b/lib/ds/cal/dt033.c @@ -0,0 +1,57 @@ +/* + * FILE ~/usr/sbr/dt033.c + * + * analyze a string in a Date: line + * + * written: 1989 10 13 + * 1991 09 16: Revision + * 1991 09 21: timezones + * 1994-05-14: restructuring and renaming + * (was: ~/usr/mail/datanal.c) + * latest update: 1995-06-11 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +int check_for_timezone ( +int *v, +int *s, +char *str) +{ + int vv; + int ss; + + vv= *v; + ss= *s; + + if ((vv % 100) == 0 /* a timezone as offset in minutes */ + /* of 100-minutes per hour */ + && (vv / 100) <= 12 + && (ss == 1 || ss == 2) /* either + or - must be dedected */ + && (strlen (str) == 3 /* +100 -0400 */ + || strlen (str) == 4) + && (str[0] == '0' + || str[0] == '1')) + { + *v= (ss==1) ? -(vv/100) : (vv/100); + *s= 0; + return DT_int_tz; + } + + if (vv <= 12 + && (ss == 1 || ss == 2) /* either + or - must be dedected */ + && (strlen (str) == 1 /* +1 -04 */ + || (strlen (str) == 2 + && str[0] == '1'))) + { + *v= (ss == 1) ? -vv : vv; + *s= 0; + return DT_int_tz; + } + + return DT_int; +} diff --git a/lib/ds/cal/dt033.o b/lib/ds/cal/dt033.o new file mode 100644 index 0000000000000000000000000000000000000000..d7bd9756e1ea6dcb0114933d6e4998fc2a301572 Binary files /dev/null and b/lib/ds/cal/dt033.o differ diff --git a/lib/ds/cal/dt034.c b/lib/ds/cal/dt034.c new file mode 100644 index 0000000000000000000000000000000000000000..2255798df7ab87a973aca7921c8f42884f8457a7 --- /dev/null +++ b/lib/ds/cal/dt034.c @@ -0,0 +1,55 @@ +/* + * FILE %ds/cal/dt034.c + * + * return month and day of easter + * see: calendar.hyx + * + * written: 1995-06-25 + * latest update: 1995-10-23 + * + */ + +#include <stdio.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +int get_easter (int year, int *month, int *day) +{ + int A, B, C, D, E, F, G, H, I, K, L, M, N, P; + + A= year%19; + B= year/100; + C= year%100; + + if (year <= 1583) + { + D= (19*A+15)%30; + E= (D+C+C/4-B)%7; + } + else + { + D= B/4; + E= B%4; + } + + F= (B+8)/25; + G= (B-F+1)/3; + H= (19*A+B-D-G+15)%30; + I= C/4; + K= C%4; + L= (2*E-H+2*I-K+32)%7; + M= (A+11*H+22*L)/451; + N= (H+L-7*M+114)/31; + P= (H+L-7*M+114)%31; + + *month= N; + *day= P+1; + +#ifdef DEBUG + printf ("A=%2d B=%2d C=%2d D=%2d E=%2d F=%2d G=%2d\n", A, B, C, D, E, F, G); + printf ("H=%2d I=%2d K=%2d L=%2d M=%2d N=%2d P=%2d\n", H, I, K, L, M, N, P); + printf ("year=%d month=%d day=%d\n", year, *month, *day); +#endif + + return 0; +} diff --git a/lib/ds/cal/dt034.o b/lib/ds/cal/dt034.o new file mode 100644 index 0000000000000000000000000000000000000000..37321e7e90b1c3dacb147ef6c13b26cb11f0fcde Binary files /dev/null and b/lib/ds/cal/dt034.o differ diff --git a/lib/ds/cal/dt035.c b/lib/ds/cal/dt035.c new file mode 100644 index 0000000000000000000000000000000000000000..1a382fc14737c46ed0a20ab44890c38092e1783f --- /dev/null +++ b/lib/ds/cal/dt035.c @@ -0,0 +1,26 @@ +/* + * FILE %ds/cal/dt035.c + * + * return julian day of a given day in a month + * + * written: 1995-06-25 + * latest update: 1997-01-15 21:54:24 + * + */ + +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +int get_day_index (struct YEAR_INFO *yi, int mon, int day) +{ + int de_mon; + int idx; + + de_mon= mon - 1; + if (de_mon < 0 || de_mon > 11) return -1; + + idx= yi->YI_month_beg [de_mon]; + idx += day - 1; + + return idx; +} diff --git a/lib/ds/cal/dt035.o b/lib/ds/cal/dt035.o new file mode 100644 index 0000000000000000000000000000000000000000..0a133f90633f1d9b261d210bdd0f35e4f4266204 Binary files /dev/null and b/lib/ds/cal/dt035.o differ diff --git a/lib/ds/cal/dt036.c b/lib/ds/cal/dt036.c new file mode 100644 index 0000000000000000000000000000000000000000..e62ddde72f8085f209569ba6dbbb18f5cf7977f0 --- /dev/null +++ b/lib/ds/cal/dt036.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/cal/dt036.c + * + * return month and day of easter + * + * written: 1995-06-25 + * latest update: 1996-02-04 11:28:30 + * + */ + +#include <string.h> +#include <stdlib.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +struct DAY_INFO_EXTRA *create_day_info_extra ( +char *country, +int d_class, +char *description) +{ + struct DAY_INFO_EXTRA *di; + + if ((di= (struct DAY_INFO_EXTRA *) + calloc (sizeof (struct DAY_INFO_EXTRA), 1)) + == (struct DAY_INFO_EXTRA *) 0) + return (struct DAY_INFO_EXTRA *) 0; + + di->DAYIE_country= strdup (country); + di->DAYIE_description= strdup (description); + di->DAYIE_type= DAYIET_variable; + di->DAYIE_class= d_class; + di->DAYIE_month= 0; + di->DAYIE_day= 0; + di->DAYIE_year_first= 0; + di->DAYIE_year_last= 0; + + return di; +} diff --git a/lib/ds/cal/dt036.o b/lib/ds/cal/dt036.o new file mode 100644 index 0000000000000000000000000000000000000000..eed3da2940d977533fb37895801cfdf52fd16765 Binary files /dev/null and b/lib/ds/cal/dt036.o differ diff --git a/lib/ds/cal/dt037.c b/lib/ds/cal/dt037.c new file mode 100644 index 0000000000000000000000000000000000000000..db50cbc153211f578b0253f42ff1e330f0a2ef5d --- /dev/null +++ b/lib/ds/cal/dt037.c @@ -0,0 +1,40 @@ +/* + * FILE %ds/cal/dt037.c + * + * fixup one day entry + * + * written: 1995-06-25 + * latest update: 1998-08-04 13:24:38 + * + */ + +#include <string.h> +#include <stdlib.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +struct DAY_INFO *fixup_day ( +struct YEAR_INFO *yi, +int idx, +struct DAY_INFO_EXTRA *dep) +{ + struct DAY_INFO *di; + struct DAY_INFO_EXTRA *dp, **ap; + + if (idx < 0 + || idx > 365 + || dep == (struct DAY_INFO_EXTRA *) 0 + ) + return (struct DAY_INFO *) 0; + + di= &yi->YI_day_info [idx]; + ap= &di->DAYI_extra; + while ((dp= *ap) != (struct DAY_INFO_EXTRA *) 0) + { + ap= &dp->DAYIE_next; + } + + *ap= dep; + + return di; +} diff --git a/lib/ds/cal/dt037.o b/lib/ds/cal/dt037.o new file mode 100644 index 0000000000000000000000000000000000000000..f1fd9f324c691ae14e28f99522c14bceebdf3134 Binary files /dev/null and b/lib/ds/cal/dt037.o differ diff --git a/lib/ds/cal/dt038.c b/lib/ds/cal/dt038.c new file mode 100644 index 0000000000000000000000000000000000000000..8dd95a2656384ecea18d1369333a725cee7e59ed --- /dev/null +++ b/lib/ds/cal/dt038.c @@ -0,0 +1,46 @@ +/* + * FILE %ds/cal/dt038.c + * + * return day of the n-th given weekday in a month + * + * written: 1997-01-15 + * latest update: 1998-08-04 12:42:45 + * + */ + +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +int get_wday_index (struct YEAR_INFO *yi, int mon, int wday, int num) +{ + int idx; + int days_of_month; + int wday_idx= -1; + struct DAY_INFO *di; + + if (yi == (struct YEAR_INFO *) 0 + || mon < 1 + || mon > 12 + ) + return -1; + + idx= get_day_index (yi, mon, 1); + days_of_month= yi->YI_days_of_month [mon-1]; + di= &yi->YI_day_info [idx];; + + while (num-- > 0) + { + while (di->DAYI_wday != wday) { di++; idx++; days_of_month--; } + + if (days_of_month < 0) break; /* 5.th means last weekday */ + + wday_idx= idx; + if (num == 0) break; + + di++; + idx++; + days_of_month--; + } + + return wday_idx; +} diff --git a/lib/ds/cal/dt038.o b/lib/ds/cal/dt038.o new file mode 100644 index 0000000000000000000000000000000000000000..8502155d63616193070e6e15845470ab1bbd70a1 Binary files /dev/null and b/lib/ds/cal/dt038.o differ diff --git a/lib/ds/cal/dt041.c b/lib/ds/cal/dt041.c new file mode 100644 index 0000000000000000000000000000000000000000..361044c6b393461d7e909ea07180d80967daab06 --- /dev/null +++ b/lib/ds/cal/dt041.c @@ -0,0 +1,56 @@ +/* + * FILE %ds/cal/dt041.c + * + * written: 1994-10-17 + * latest update: 1997-01-16 9:45:31 + * + */ + +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int setup_year_info (struct YEAR_INFO *yi, int year) +{ + int i; + int j; + int dom; + int beg= 0; + int dnum= 0; + int mon; + int wday; + struct DAY_INFO *di; + + if (yi == (struct YEAR_INFO *) 0) return -1; + + yi->YI_year= year; + yi->YI_is_leap_year= is_leap_year (year); + wday= weekday (year, 1, 1); + + for (i= 0; i < 12; i++) + { + mon= i+1; + dom= days_of_month (year, mon); + + yi->YI_month_beg [i]= beg; + yi->YI_days_of_month [i]= dom; + beg += dom; + + for (j= 0; j < dom; j++) + { + di= &(yi->YI_day_info [dnum]); + di->DAYI_year= year; + di->DAYI_month= mon; + di->DAYI_day= j+1; + di->DAYI_wday= wday; + di->DAYI_extra= (struct DAY_INFO_EXTRA *) 0; + wday= (wday == 6) ? 0 : wday+1; + dnum++; + } + } + + return 0; +} diff --git a/lib/ds/cal/dt041.o b/lib/ds/cal/dt041.o new file mode 100644 index 0000000000000000000000000000000000000000..44a3886d1605e3ec0b1a6d9f9a1e44c2f85d1f73 Binary files /dev/null and b/lib/ds/cal/dt041.o differ diff --git a/lib/ds/cal/dt042.c b/lib/ds/cal/dt042.c new file mode 100644 index 0000000000000000000000000000000000000000..66acdd722f573c59dae40b4cad9b50872aed3c27 --- /dev/null +++ b/lib/ds/cal/dt042.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/cal/dt042.c + * + * written: 1995-06-10 + * latest update: 1995-12-03 + * + */ + +#include <stdlib.h> +#include <memory.h> +#include <gg/strings.h> +#include <gg/dates.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int cal_reset_year_info (struct YEAR_INFO *yi) +{ + int i; + struct DAY_INFO_EXTRA *de1, *de2; + + for (i= 0; i < YI_DI_cnt; i++) + { + for (de1= yi->YI_day_info [i].DAYI_extra; + de1 != (struct DAY_INFO_EXTRA *) 0; + de1= de2) + { + de2= de1->DAYIE_next; + if (de1->DAYIE_type == DAYIET_variable) + { + free_or_what (de1->DAYIE_country); + free_or_what (de1->DAYIE_description); + free (de1); + } + } + + memset (&yi->YI_day_info [i], 0, sizeof (struct DAY_INFO)); + } + + return 0; +} diff --git a/lib/ds/cal/dt042.o b/lib/ds/cal/dt042.o new file mode 100644 index 0000000000000000000000000000000000000000..677b21329515626d8b631d5728d54769f3a357a5 Binary files /dev/null and b/lib/ds/cal/dt042.o differ diff --git a/lib/ds/cal/gg b/lib/ds/cal/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/cal/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/cal/lib b/lib/ds/cal/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/cal/libgg.a b/lib/ds/cal/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/cal/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/cal/make-dos b/lib/ds/cal/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..caf997b8bc2181c5744241c45d913e69d7e900de --- /dev/null +++ b/lib/ds/cal/make-dos @@ -0,0 +1,299 @@ +# +# FILE %ds/cal/makefile +# +# Diverse Unterprogramme und Libraries +# +# written: 1985-06-25 (extracted from %sbr/makefile) +# latest update: 1998-08-22 20:59:08 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$*.obj /c +cms=cl -AS /W3 /Fo$*.obj /c +ccl=cl -AL +ccs=cl -AS +obj=objdec -w -d -m0 +incl=c:\c5\include\gg\ +bin=c:\bin\ + +all : large.dt +test.exe : dt031t.exe dt011t.exe + +# LARGE Library -------------------------------------------------------------- +large.dt : ! + large\dt001b.obj ! + large\dt001.obj large\dt002.obj large\dt002b.obj ! + large\dt003.obj large\dt004.obj large\dt006.obj large\dt007.obj ! + large\dt008.obj large\dt010.obj large\dt011.obj ! + large\dt014a.obj large\dt014b.obj large\dt015a.obj ! + large\dt021.obj large\dt022.obj large\dt023.obj large\dt024.obj ! + large\dt025.obj ! + large\dt031.obj large\dt032.obj large\dt033.obj large\dt034.obj ! + large\dt035.obj large\dt036.obj large\dt037.obj large\dt038.obj ! + large\dt041.obj large\dt042.obj ! + large\cal01.obj large\cal02.obj large\cal03.obj large\cal04.obj ! + large\cal05.obj large\cal06.obj large\cal07.obj large\cal08.obj ! + large\cal09.obj large\cal10.obj + +cal04exp.exe : large\cal04exp.obj large\cal04.obj + link large\cal04exp large\cal04.obj; + +# SMALL Library -------------------------------------------------------------- +lib.ssbr : small.dt ssbr.lib + +ssbr.lib : + llink -v -lssbr.lib -dssbr.mod -n0 + del ssbr.bak + +small.dt : ! + small\dt001.obj small\dt001b.obj small\dt002.obj small\dt003.obj ! + +# Datum/Zeit ermitteln ------------------------------------------------------- +large\dt001.obj : dt001.c + $(cml) dt001.c + $(obj) -sl 2 DATUM_TEXT large\dt001.obj + +large\dt001b.obj : dt001b.c + $(cml) dt001b.c + $(obj) -sl 2 DATUM_TEXT large\dt001b.obj + +large\dt002.obj : dt002.c + $(cml) dt002.c + $(obj) -sl 2 DATUM_TEXT large\dt002.obj + +large\dt002b.obj : dt002b.c + $(cml) dt002b.c + $(obj) -sl 2 DATUM_TEXT large\dt002b.obj + +# Datum/Zeit drucken --------------------------------------------------------- +large\dt003.obj : dt003.c + $(cml) dt003.c + $(obj) -sl 2 DATUM_TEXT large\dt003.obj + +large\dt004.obj : dt004.c + $(cml) dt004.c + $(obj) -sl 2 DATUM_TEXT large\dt004.obj + +large\dt005.obj : dt005.c + $(cml) dt005.c + $(obj) -sl 2 DATUM_TEXT large\dt005.obj + +large\dt006.obj : dt006.c + $(cml) dt006.c + $(obj) -sl 2 DATUM_TEXT large\dt006.obj + +large\dt007.obj : dt007.c + $(cml) dt007.c + $(obj) -sl 2 DATUM_TEXT large\dt007.obj + +large\dt008.obj : dt008.c + $(cml) dt008.c + $(obj) -sl 2 DATUM_TEXT large\dt008.obj + +large\dt009.obj : dt009.c + $(cml) dt009.c + $(obj) -sl 2 DATUM_TEXT large\dt009.obj + +large\dt010.obj : dt010.c + $(cml) dt010.c + $(obj) -sl 2 DATUM_TEXT large\dt010.obj + +large\dt011.obj : dt011.c + $(cml) dt011.c + $(obj) -sl 2 DATUM_TEXT large\dt011.obj + +large\dt014a.obj : dt014a.c + $(cml) dt014a.c + $(obj) -sl 2 DATUM_TEXT large\dt014a.obj + +large\dt014b.obj : dt014b.c + $(cml) dt014b.c + $(obj) -sl 2 DATUM_TEXT large\dt014b.obj + +large\dt015a.obj : dt015a.c + $(cml) dt015a.c + $(obj) -sl 2 DATUM_TEXT large\dt015a.obj + +large\dt011t.obj : dt011t.c + $(cml) dt011t.c + $(obj) -sl 2 DATUM_TEXT large\dt011t.obj + +dt011t.exe : large\dt011t.obj large\dt034.obj + link large\dt011t large\dt034,$@,\dev\nul,lsbr/NOE/NOI; + +# Datumsmanipulationen ------------------------------------------------------- +large\dt021.obj : dt021.c + $(cml) dt021.c + $(obj) -sl 2 DATUM_TEXT large\dt021.obj + +large\dt022.obj : dt022.c + $(cml) dt022.c + $(obj) -sl 2 DATUM_TEXT large\dt022.obj + +large\dt023.obj : dt023.c + $(cml) dt023.c + $(obj) -sl 2 DATUM_TEXT large\dt023.obj + +large\dt024.obj : dt024.c + $(cml) dt024.c + $(obj) -sl 2 DATUM_TEXT large\dt024.obj + +large\dt025.obj : dt025.c + $(cml) dt025.c + $(obj) -sl 2 DATUM_TEXT large\dt025.obj + +large\dt031.obj : dt031.c + $(cml) dt031.c + $(obj) -sl 2 DATUM_TEXT $@ + +large\dt032.obj : dt032.c + $(cml) dt032.c + $(obj) -sl 2 DATUM_TEXT $@ + +large\dt033.obj : dt033.c + $(cml) dt033.c + $(obj) -sl 2 DATUM_TEXT large\dt033.obj + +large\dt034.obj : dt034.c + $(cml) dt034.c + $(obj) -sl 2 DATUM_TEXT large\dt034.obj + +large\dt035.obj : dt035.c + $(cml) dt035.c + $(obj) -sl 2 DATUM_TEXT large\dt035.obj + +large\dt036.obj : dt036.c + $(cml) dt036.c + $(obj) -sl 2 DATUM_TEXT large\dt036.obj + +large\dt037.obj : dt037.c + $(cml) dt037.c + $(obj) -sl 2 DATUM_TEXT large\dt037.obj + +large\dt038.obj : dt038.c + $(cml) dt038.c + $(obj) -sl 2 DATUM_TEXT large\dt038.obj + +# +large\dt041.obj : dt041.c + $(cml) dt041.c + $(obj) -sl 2 DATUM_TEXT large\dt041.obj + +large\dt042.obj : dt042.c + $(cml) dt042.c + $(obj) -sl 2 DATUM_TEXT large\dt042.obj + +# Datum/Zeit Diagnose -------------------------------------------------------- +dt031.obj : dt031.c + $(cml) -DDEBUG dt031.c + $(obj) -sl 2 DATUM_TEXT $@ + +dt032.obj : dt032.c + $(cml) -DDEBUG dt032.c + $(obj) -sl 2 DATUM_TEXT $@ + +dt031t.obj : dt031t.c + $(cml) dt031t.c + $(obj) -sl 2 DATUM_TEXT $@ + +DT031T=dt031t.obj dt031.obj dt032.obj large\dt025.obj +dt031t.exe : $(DT031T) + link $(DT031T),$@,\dev\nul,lsbr/NOE/NOI; + +# Datum/Zeit ermitteln ------------------------------------------------------- +small\dt001.obj : dt001.c + $(cms) dt001.c + +small\dt001b.obj : dt001b.c + $(cms) dt001b.c + +small\dt002.obj : dt002.c + $(cms) dt002.c + +# Datum/Zeit drucken --------------------------------------------------------- +small\dt003.obj : dt003.c + $(cms) dt003.c + +small\dt004.obj : dt004.c + $(cms) dt004.c + +small\dt005.obj : dt005.c + $(cms) dt005.c + +small\dt006.obj : dt006.c + $(cms) dt006.c + +small\dt007.obj : dt007.c + $(cms) dt007.c + +small\dt008.obj : dt008.c + $(cms) dt008.c + +small\dt009.obj : dt009.c + $(cms) dt009.c + +small\dt010.obj : dt010.c + $(cms) dt010.c + +small\dt011.obj : dt011.c + $(cms) dt011.c + +# Datumsmanipulationen ------------------------------------------------------- +small\dt021.obj : dt021.c + $(cms) dt021.c + +small\dt022.obj : dt022.c + $(cms) dt022.c + +small\dt023.obj : dt023.c + $(cms) dt023.c + +small\dt024.obj : dt024.c + $(cms) dt024.c + +small\dt025.obj : dt025.c + $(cms) dt025.c + +# ---------------------------------------------------------------------------- +large\cal01.obj : cal01.c + $(cml) /Fo$* cal01.c + $(obj) -sl 2 PLANNER_TEXT large\cal01.obj + +large\cal02.obj : cal02.c + $(cml) /Fo$* cal02.c + $(obj) -sl 2 PLANNER_TEXT large\cal02.obj + +large\cal03.obj : cal03.c + $(cml) /Fo$* cal03.c + $(obj) -sl 2 PLANNER_TEXT large\cal03.obj + +large\cal04.obj : cal04.c + $(cml) /Fo$* cal04.c + $(obj) -sl 2 PLANNER_TEXT large\cal04.obj + +large\cal04exp.obj : cal04exp.c + $(cml) /Fo$* cal04exp.c + $(obj) -sl 2 PLANNER_TEXT large\cal04exp.obj + +large\cal05.obj : cal05.c + $(cml) /Fo$* cal05.c + $(obj) -sl 2 PLANNER_TEXT large\cal05.obj + +large\cal06.obj : cal06.c + $(cml) /Fo$* cal06.c + $(obj) -sl 2 PLANNER_TEXT large\cal06.obj + +large\cal07.obj : cal07.c + $(cml) /Fo$* cal07.c + $(obj) -sl 2 PLANNER_TEXT large\cal07.obj + +large\cal08.obj : cal08.c + $(cml) /Fo$* cal08.c + $(obj) -sl 2 PLANNER_TEXT large\cal08.obj + +large\cal09.obj : cal09.c + $(cml) /Fo$* cal09.c + $(obj) -sl 2 PLANNER_TEXT large\cal09.obj + +large\cal10.obj : cal10.c + $(cml) /Fo$* cal10.c + $(obj) -sl 2 PLANNER_TEXT large\cal10.obj diff --git a/lib/ds/codes/(dirinf).fm b/lib/ds/codes/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..593db3daa74de7a893626bc95fb4820758760470 --- /dev/null +++ b/lib/ds/codes/(dirinf).fm @@ -0,0 +1,60 @@ +# +# File %ds/codes/(dirinf).fm +# +# code table handling facility +# +# written: 1993-01-01 +# latest update: 1996-02-24 11:08:03 +# +# ---------------------------------------------------------------------------- +# +# Utilities: +# see also <gg/codes.h> +(dirinf).fm Contents +makefile DOS version of Makefile +make-ux Unix version of Makefile + +codes.c pre-process code table for various purposes +codeconv.c universal characterset converter +codetbl.c code table processor +# +# test programs +xmerge.c merge data files +cst006.c test cs006.c +# +makefile DOS Makefile +make-ux Unix Makefile +# +# library functions: +cs000.c template +cs001.c struct CS_record *cs_parse_code_table (char *fn) +cs002.c long cs_print_records (FILE *fo, struct CS_record *recs) +cs003.c long cs_print_fields (FILE *fo, struct CS_field *fields) +cs004.c int cs_records2ytree (...) +cs005.c int cs_records2index (...) +cs006.c int cs_records2table (...) +cs007.c struct CS_field *cs_find_field (...) +cs008.c int cs_free_fields (...) +cs009.c int cs_count_attribute (...) +cs010.c int cs_print_statistics (FILE *fo) +cs011.c long cs_print_frames (FILE *fo, struct CS_record *recs) +cs012.c long cs_print_frame (FILE *fo, struct CS_field *fields) +# +cs101.c char *get_sgml_entity (int ch) +cs102.c int find_sgml_entity (char *entity) +cs103.c struct CS_ET8 *cs_et8_create_table (long id, char *fnm, ...) +cs104.c int cs_et8_destroy_table (struct CS_ET8 *et8) +cs105.c char *cs_et8_code2entity (struct CS_ET8 *et8, int code) +cs106.c int cs_et8_entity2code (struct CS_ET8 *et8, char *entity) +cs107.c int cs_et8_fputc (struct CS_ET8 *et8, int ch, FILE *fo) +cs108.c int cs_et8_fputs (struct CS_ET8 *et8, char *str, FILE *fo) +cs109.c int cs_et8_ftransfer (struct CS_ET8 *et8, FILE *fi, FILE *fo) +cs110.c int cs_et8_encode (struct CS_ET8 *et8, char *fnm_in, char *fnm_out); +# +cs201.c long cs_convert_stream (...) +cs202.c long cs_convert_file (...) +cs203.c long cs_convert_string (char *str, long *table) +cs204.c int cs_string_tlate (...) +cs205.c int cs_load_tlate_table (...) +cs206.c int cs_print_tlate_table (...) +cs207.c long cs_convert_block (char *str, long size, long *table) diff --git a/lib/ds/codes/.cvsignore b/lib/ds/codes/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..ecbf213a442836ba96ff082d198fe7db9bba3f03 --- /dev/null +++ b/lib/ds/codes/.cvsignore @@ -0,0 +1,5 @@ +# $Id: .cvsignore,v 1.3 2011/05/31 16:43:41 gonter Exp $ +codes +codeconv +codetbl +trans.bin diff --git a/lib/ds/codes/Makefile b/lib/ds/codes/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..bbbdb791b8cd7e7b0afe1489c2ec11dcb31f4618 --- /dev/null +++ b/lib/ds/codes/Makefile @@ -0,0 +1,55 @@ +# +# FILE %ds/codes/make-ux (Makefile) +# +# written: 1994-03-29 +# latest update: 1999-05-08 9:38:03 +# +# ============================================================================ +CC=cc +OPTS= -I. +# OPTS= -I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a +bin= + +all : lib +all.bin: $(bin)codes $(bin)codeconv $(bin)codetbl +all.0 : ebcdic xmerge + +# ---------------------------------------------------------------------------- +obs= cs001.o cs002.o cs003.o cs004.o cs005.o cs006.o cs007.o cs008.o \ + cs009.o cs010.o cs011.o cs012.o \ + cs101.o cs102.o cs103.o cs104.o cs105.o cs106.o cs107.o cs108.o \ + cs109.o cs110.o \ + cs201.o cs202.o cs203.o cs204.o cs205.o \ + cs206.o cs207.o + +lib : $(obs) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $? + +clean : + rm -f *.o lib + +# ---------------------------------------------------------------------------- +$(bin)codes : codes.o $(LIB) + $(CC) -o $@ codes.o $(LIB) + +$(bin)codeconv : codeconv.o $(LIB) + $(CC) -o $@ codeconv.o $(LIB) + +$(bin)codetbl : codetbl.o $(LIB) + $(CC) -o $@ codetbl.o $(LIB) + +ebcdic : ebcdic.o + $(CC) -o $@ ebcdic.o $(LIB) + +xmerge : xmerge.o + $(CC) -o $@ xmerge.o $(LIB) + +# ---------------------------------------------------------------------------- +cst006obj=cst006.o cs006.o cs001.o cs007.o +cst006 : $(cst006obj) + $(CC) -o $@ $(cst006obj) $(LIB) diff --git a/lib/ds/codes/codeconv.c b/lib/ds/codes/codeconv.c new file mode 100644 index 0000000000000000000000000000000000000000..fb91bed8a00c82aed98ceaf73a7ae4dc1fc474a2 --- /dev/null +++ b/lib/ds/codes/codeconv.c @@ -0,0 +1,365 @@ +/* + * FILE %ds/codes/codeconv.c + * + * universal characterset converter + * - HELP + * - prototypes + * - see also codetbl.c + * + * LINKS: + * man page $codeconv + * + * written: 1992-12-30 + * latest update: 1997-10-24 11:12:37 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <time.h> +#include <gg/filename.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/codes.h> +#include <gg/sbr.h> +#include <gg/dirty.h> +#include <gg/dpp.h> + +#define STDHLP stdout + +/* ------------------------------------------------------------------------ */ +struct CONVERTER +{ + char *fno; + long *table; +}; + +/* ------------------------------------------------------------------------ */ +static long init_value= 0L; +static long converter_table [256]; +static char *table_name= (char *) 0; +static char *C_array_name= "static long TLT [256]"; + +#define MAX_LIST 40 +static char *src [MAX_LIST] = { "pc", "ascii" }; +static char *dst [MAX_LIST] = { "iso8859_1", "ascii" }; +static int src_cnt= 2; +static int dst_cnt= 2; +static int src_predef= 1; /* 1 -> table is predefined */ +static int dst_predef= 1; + +#define MAX_ALL_FIELDS 100 +static char *all_fields [MAX_ALL_FIELDS] = +{ + "def", "val" /* we also need definitions! */ +} ; +static int all_fields_cnt= 2; +static struct ARRAY_CONTROL *arguments; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: codeconv [options] {file name}\n", + "OPTIONS:\n", + " -f<fnm> ... list of files\n", +#ifdef SUBDIRS + " -r ... recursive into sub directories\n", +#endif + " -t<fnm> ... name of the file containing the code tables\n", + " -s<id> ... source code [Def: pc, ascii]\n", + " -d<id> ... destination code [Def: iso8859_1, ascii]\n", + " -o<fnm> ... outfile\n", + " -w<m><fnm> ... write table to file\n", + " m=b ... binary\n", +/*" m=p ... portable binary\n", */ + " m=c ... C, C ... C Array\n", + " m=r ... REXX expression\n", + " m=R ... REXX translate expression\n", + " m=A ... IBM/370 ASSEMBLE\n", + " m=P ... Perl\n", + " -a<name> ... C array declaration, e.g. \"-along TLT_PC2ISO [256]\"\n", + " -i<val> ... initial value for the converter table\n", + "NOTES:\n", + " Several -s and/or -d options might be present.\n", + "\n", + "(@)Acodeconv.c 1.06 #D$1996-02-23 11:11:08\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl write_comment (FILE *fo, int mode, char *lsrc[], int lsrc_cnt, + char *ldst[], int ldst_cnt); +int cdecl main_cvt (char *fn, void *cd); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + char *outfile= (char *) 0; + int rc; + char *arg; + struct CS_record *records; + int write_mode= WRITE_MODE_undef; + char *write_to_file= (char *) 0; + struct CONVERTER cvt; + struct WCRD *wcrd; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) return 1; + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, + main_cvt, (void *) &cvt); + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'a': case 'A': + if (arg [2] == 0) break; + C_array_name= arg+2; + break; + + case 'd': case 'D': + if (arg [2] == 0) break; + if (dst_predef) + { + dst_predef= 0; + dst_cnt= 0; + } + dst [dst_cnt++]= arg+2; + break; + + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + + case 'i': case 'I': + init_value= get_parameter_value (arg+2); + break; + + case 'o': case 'O': + outfile= arg+2; + break; + + case 's': case 'S': + if (arg [2] == 0) break; + if (src_predef) + { + src_predef= 0; + src_cnt= 0; + } + src [src_cnt++]= arg+2; + break; + + case 't': case 'T': + if (arg [2] == 0) break; + table_name= arg+2; + break; + + case 'w': case 'W': + switch (arg [2]) + { + case 'b': case 'B': + write_mode= WRITE_MODE_binary; + break; + case 'c': + write_mode= WRITE_MODE_C; + break; + case 'C': + write_mode= WRITE_MODE_C_ARRAY; + break; + case 'r': + write_mode= WRITE_MODE_rexx; + break; + case 'R': + write_mode= WRITE_MODE_REXX; + break; + case 'A': + write_mode= WRITE_MODE_ASSEMBLE; + break; + case 'P': + write_mode= WRITE_MODE_PERL; + break; + default: + goto HLP; + } + write_to_file= arg+3; + if (*write_to_file == 0) goto HLP; + break; + +#ifdef SUBDIRS + case 'r': case 'R': +#endif + for (j= 1; arg [j]; j++) + switch (arg [j]) + { +#ifdef SUBDIRS + case 'r': case 'R': + wcrd_set_subdirs (1); + break; +#endif + } + break; + +HLP: +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + + /* setup converter tables */ + if (table_name == (char *) 0) + table_name= set_etc_filename ((char *) 0, CSF_TABLE); + + /* initialize table */ + for (i= 0; i < 256; i++) converter_table [i]= init_value; + + for (i= 0; i < src_cnt; i++) all_fields [all_fields_cnt++] = src [i]; + for (i= 0; i < dst_cnt; i++) all_fields [all_fields_cnt++] = dst [i]; + if ((records= cs_parse_code_table (table_name, all_fields, all_fields_cnt, + 1, 25)) + == (struct CS_record *) 0) + { + fprintf (stderr, "error parsing table %s!\n", table_name); + goto HLP; + } + + if ((rc= cs_records2table (records, src, src_cnt, dst, dst_cnt, + CSft_number, converter_table)) == -1) + { + fprintf (stderr, + "couldn\'t setup converter table from information in %s", + table_name); + fprintf (stderr, "for conversion (%s", src[0]); + for (i= 1; i < src_cnt; i++) fprintf (stderr, ",%s", src[i]); + fprintf (stderr, ") -> (%s", dst[0]); + for (i= 1; i < dst_cnt; i++) fprintf (stderr, ",%s", dst[i]); + fprintf (stderr, ")\n"); + goto HLP; + } + + if (write_mode) + { + FILE *ft; + + if (strcmp (write_to_file, "-") == 0) + ft= stdout; + else ft= fopen (write_to_file, "wb"); + + if (ft == (FILE *) 0) + { + fprintf (stderr, "error: couldnt write to: %s\n", write_to_file); + return 1; + } + + write_comment (ft, write_mode, src, src_cnt, dst, dst_cnt); + + switch (write_mode) + { + case WRITE_MODE_C_ARRAY: + fprintf (ft, "%s =\n", C_array_name); + break; + + case WRITE_MODE_REXX: + fprintf (ft, "return(translate(arg(1), ,\n"); + break; + } + + print_long_table2 (ft, write_mode, converter_table, 256); + + if (ft != stdout) fclose (ft); + } + + cvt.table= converter_table; + cvt.fno= outfile; + wcrd2_arguments (wcrd, arguments); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int write_comment ( +FILE *fo, +int mode, +char *lsrc[], +int lsrc_cnt, +char *ldst[], +int ldst_cnt) +{ + struct tm *tm_s; + long tt; + char prefix [20]; + int i; + + if (lsrc_cnt < 1 || ldst_cnt < 1) return -1; + + tt= time ((long *) 0); + tm_s= localtime (&tt); + + switch (mode) + { + case WRITE_MODE_C_ARRAY: + case WRITE_MODE_C: + case WRITE_MODE_REXX: + case WRITE_MODE_rexx: + case WRITE_MODE_PERL: + fprintf (fo, "/*\n"); + strcpy (prefix, " * "); + break; + case WRITE_MODE_ASSEMBLE: + fprintf (fo, "*\n"); + strcpy (prefix, "* "); + break; + default: + return 0; + } + + fprintf (fo, "%sconversion table\n%sfrom: %s", + prefix, prefix, lsrc [0]); + for (i= 1; i < lsrc_cnt; i++) + fprintf (fo, ", %s", lsrc[i]); + fprintf (fo, "\n%s to: %s", prefix, ldst [0]); + for (i= 1; i < ldst_cnt; i++) + fprintf (fo, ", %s", ldst[i]); + + fprintf (fo, "\n%sas generated on 19%02d-%02d-%02d/%02d:%02d:%02d\n%s\n", + prefix, + tm_s->tm_year, tm_s->tm_mon+1, tm_s->tm_mday, + tm_s->tm_hour, tm_s->tm_min, tm_s->tm_sec, + prefix); + + switch (mode) + { + case WRITE_MODE_C_ARRAY: + case WRITE_MODE_C: + case WRITE_MODE_REXX: + case WRITE_MODE_rexx: + case WRITE_MODE_PERL: + fprintf (fo, " */\n"); + break; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main_cvt (char *fn, void *cd) +{ + struct CONVERTER *cnv; + + if ((cnv= (struct CONVERTER *) cd) == (struct CONVERTER *) 0) return -1; + + return cs_convert_file (fn, cnv->fno, cnv->table); +} diff --git a/lib/ds/codes/codes.c b/lib/ds/codes/codes.c new file mode 100644 index 0000000000000000000000000000000000000000..02103a47fe0ba61931ba681446deb91d1a08ab86 --- /dev/null +++ b/lib/ds/codes/codes.c @@ -0,0 +1,236 @@ +/* + * FILE %dpp/codes/codes.c + * + * pre-process code table for various purposes + * - HELP + * - prototypes + * - filenames + * + * written: 1992 02 19 + * latest update: 1995-12-09 + * $Id: codes.c,v 1.2 2011/05/31 16:43:41 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/dpp.h> +#include <gg/filename.h> +#include <gg/codes.h> + +#define STDHLP stderr + +/* ------------------------------------------------------------------------ */ +static int verbose_mode = 0; +static int include_all = 0; + +/* ------------------------------------------------------------------------ */ +#define N_PC_FIELDS 3 +#define N_MAC_FIELDS 1 +#define N_FIELDS 11 +#define POS_ISO_FIELD 7 + +/* ------------------------------------------------------------------------ */ +static char *FIELDS [N_FIELDS] = +{ +/* 0 */ "pc", +/* 1 */ "pc437", +/* 2 */ "ascii", +/* 3 */ "pc850", +/* 4 */ "mac", + +/* 5 */ "ebcdic", +/* 6 */ "iso8859", +/* 7 */ "iso8859_1", +/* 8 */ "iso10646", +/* 9 */ "tex", +/* 10 */ "latex" +} ; + +/* ------------------------------------------------------------------------ */ +static long TAGS [N_FIELDS] = +{ + CSfid_pc, + CSfid_pc437, + CSfid_ascii, + CSfid_pc850, + CSfid_mac, + + CSfid_ebcdic, + CSfid_iso8859, + CSfid_iso8859_1, + CSfid_iso10646, + CSfid_tex, + CSfid_latex +} ; + +/* ------------------------------------------------------------------------ */ +#define N_MATCH_FIELDS 256 +static char *match_fields[N_MATCH_FIELDS] = { "iso8859*" }; +static int cnt_match_fields= 1; +static int filter_mode= 1; +static int max_warnings= 10; + +/* filenames: ------------------------------------------------------------- */ +static char *PC_LUT_FILE= "entity.lut"; +static char *DATA_FILE= "entity.dat"; +static char *PC_INDEX_FILE= "entpc437.idx"; +static char *PC_STRING_FILE= "entpc437.str"; +static char *MAC_INDEX_FILE= "entmac.idx"; +static char *MAC_STRING_FILE= "entmac.str"; +static char *ISO_INDEX_FILE= "ent88591.idx"; +static char *ISO_STRING_FILE= "ent88591.str"; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: codes [options] {file name}\n", + " process code table /etc/codes/table in various ways...\n", + "OPTIONS:\n", + " -a ... write all entities to LUT and DATA file\n", + " -d<fnm> ... data file to write to\n", + " -i<fnm> ... index file for pc code page 437\n", + " -l<fnm> ... lut file name to write to\n", + " -s<fnm> ... string file name\n", + " -m<n> ... mode; [DEF: 0]\n", + " 0 ... diagnostic\n", + " 1 ... compact LUT\n", + " 2 ... LUT and entity DATA\n", + " 3 ... PC index file\n", + " 4 ... MAC index file\n", + " 5 ... ISO 8859-1 index file\n", + " 6 ... ISO 8859-1 lut file\n", + " 98 ... -> 0, all data\n", + " 99 ... -> 2, 3, 4\n" + " -v ... verbose mode\n", + "\n", + "(@)Acodes.c 1.05 #D$1996-02-24 11:01:43\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, j; + int mode= 0; + struct CS_record *records; + char *table_name= (char *) 0; + + for (i= 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'a': case 'A': + include_all= 1; + break; + case 'd': case 'D': + DATA_FILE= &argv[i][2]; + break; + case 'i': case 'I': + PC_INDEX_FILE= &argv[i][2]; + MAC_INDEX_FILE= &argv[i][2]; + ISO_INDEX_FILE= &argv[i][2]; + break; + case 'l': case 'L': + PC_LUT_FILE= &argv[i][2]; + break; + case 'm': case 'M': + mode= (int) get_parameter_value (&argv[i][2]); + break; + case 's': case 'S': + PC_STRING_FILE = &argv [i][2]; + MAC_STRING_FILE = &argv [i][2]; + ISO_STRING_FILE = &argv [i][2]; + break; + case 'v': case 'V': + for (j= 1; argv [i][j]; j++) + switch (argv [i][j]) + { + case 'v': case 'V': + verbose_mode= 1; + break; + } + break; + +HLP: +#include <gg/help.inc> + } + else table_name= argv [i]; + + if (table_name == (char *) 0) + table_name= set_etc_filename ((char *) 0, CSF_TABLE); + + if (mode != 0) + { /* this should be optimized sometime in the future, */ + /* but for now it's more important to have the program */ + /* operational for the purpose of creating specialized */ + /* tables, indexes, luts etc.... */ + match_fields [0]= "*"; + cnt_match_fields= 1; + filter_mode= 0; + } + + records= cs_parse_code_table (table_name, match_fields, + cnt_match_fields, filter_mode, max_warnings); + + if (records == (struct CS_record *) 0) + { + fprintf (stderr, "error parsing table %s!\n", table_name); + goto HLP; + } + + cs_print_statistics (stderr); + + switch (mode) + { + case 0: + cs_print_records (stdout, records); + break; + case 1: /* compact lut */ + case 2: /* lut and data file */ + cs_records2ytree (records, FIELDS, TAGS, N_PC_FIELDS, + PC_LUT_FILE, DATA_FILE, + verbose_mode, (mode == 1) /* -> compact */, include_all); + break; + case 3: + cs_records2index (records, FIELDS, N_PC_FIELDS, + PC_INDEX_FILE, PC_STRING_FILE, verbose_mode); + break; + case 4: + cs_records2index (records, &FIELDS [N_PC_FIELDS], N_MAC_FIELDS, + MAC_INDEX_FILE, MAC_STRING_FILE, verbose_mode); + break; + case 5: + cs_records2index (records, &FIELDS [N_PC_FIELDS], N_FIELDS, + ISO_INDEX_FILE, ISO_STRING_FILE, verbose_mode); + break; + case 6: /* lut and data file */ + cs_records2ytree (records, FIELDS + POS_ISO_FIELD, TAGS, 1, + PC_LUT_FILE, DATA_FILE, + verbose_mode, (mode == 6) /* -> compact */, include_all); + break; + case 98: + cs_print_frames (stdout, records); + break; + case 99: + cs_records2ytree (records, FIELDS, TAGS, N_FIELDS, + PC_LUT_FILE, DATA_FILE, + verbose_mode, 0, include_all); + cs_records2index (records, FIELDS, N_PC_FIELDS, + PC_INDEX_FILE, PC_STRING_FILE, verbose_mode); + cs_records2index (records, &FIELDS [N_PC_FIELDS], N_MAC_FIELDS, + MAC_INDEX_FILE, MAC_STRING_FILE, verbose_mode); + cs_records2index (records, &FIELDS [POS_ISO_FIELD], 1, + ISO_INDEX_FILE, ISO_STRING_FILE, verbose_mode); + break; + } + + return 0; +} diff --git a/lib/ds/codes/codetbl.c b/lib/ds/codes/codetbl.c new file mode 100644 index 0000000000000000000000000000000000000000..56c003c31f906fc00ee16ecd093994fb50f576e3 --- /dev/null +++ b/lib/ds/codes/codetbl.c @@ -0,0 +1,371 @@ +/* + * FILE %dpp/codes/codetbl.c + * + * write code translation tables or so + * + * - HELP + * - prototypes + * - see also codeconv.c + * + * NOTE: this program can not be portet to CMS, + * because explicit references to & < and > exist. + * + * written: 1993-06-10 + * latest update: 1995-12-10 + * $Id: codetbl.c,v 1.2 2011/05/31 16:43:41 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <time.h> +#include <gg/filename.h> +#include <gg/codes.h> +#include <gg/sbr.h> +#include <gg/dpp.h> + +#define MODE2 + +#define STDHLP stdout +#ifdef MSDOS +#define ARG_C_max 24 +#else +#define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c= 0; + +/* Quick Hack: ------------------------------------------------------------ */ +#ifdef MSDOS +#define SUBDIRS /* recursive walk through the */ + /* filesystem is possible */ +#define BETTER_FILENAME_MATCH /* own match function */ + /* otherwise DOS match function */ +#endif + +/* ------------------------------------------------------------------------ */ +static char filenm [66]; + +static long init_value= 0L; +static long converter_table [256]; +static long entity_table [256]; +static char *table_name= (char *) 0; + +static int verbose_mode= 0; + +#define MAX_LIST 40 +static char *src [MAX_LIST] = { "pc", "ascii" }; +static char *dst [MAX_LIST] = { "iso8859_1", "ascii" }; +static char *dst_ent []= { "entity" }; +static int src_cnt= 2; +static int dst_cnt= 2; +static int dst_ent_cnt= 1; +static int src_predef= 1; /* 1 -> table is predefined */ +static int dst_predef= 1; + +#define MAX_ALL_FIELDS 100 +static char *all_fields [MAX_ALL_FIELDS] = +{ + "def", "val" /* we also need definitions! */ +} ; + +static int all_fields_cnt= 2; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: codetbl [options] {file name}\n", + " write code translation tables or so\n", + "OPTIONS:\n", + " -f<fnm> ... list of files\n", + " -t<fnm> ... name of the file containing the code tables\n", + " -s<id> ... source code [Def: pc, ascii]\n", + " -d<id> ... destination code [Def: mac, ascii]\n", + " -o<fnm> ... outfile\n", + " -w<m><fnm> ... write table to file\n", + " m=b ... binary\n", +/*" m=p ... portable binary\n", */ + " m=c ... C\n", + " m=r ... REXX expression\n", + " m=R ... REXX translate expression\n", + " m=A ... IBM/370 ASSEMBLE\n", + " -i<val> ... initial value for the converter table\n", + "NOTES:\n", + " Several -s and/or -d options might be present.\n", + "\n", + "(@)Acodetbl.c 1.03 #D$1995-12-10 0:16:40\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + FILE *ft; + int i, j; + char *outfile= (char *) 0; + int rc; +#ifdef MODE1 + long table_idx; + long entry_size; +#endif + struct CS_record *records; +#define WRITE_MODE_undef 0 +#define WRITE_MODE_C 1 +#define WRITE_MODE_binary 2 +#define WRITE_MODE_rexx 4 +#define WRITE_MODE_REXX 5 +#define WRITE_MODE_ASSEMBLE 6 + int write_mode= WRITE_MODE_C; + char *write_to_file= "trans.bin"; + + for (i= 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) arg_v [arg_c++] = argv [i]; + break; + + case 'd': case 'D': + if (argv [i][2] == 0) break; + if (dst_predef) + { + dst_predef= 0; + dst_cnt= 0; + } + dst [dst_cnt++]= &argv[i][2]; + break; + + case 'i': case 'I': + init_value= get_parameter_value (&argv[i][2]); + break; + + case 'o': case 'O': + outfile= &argv [i][2]; + break; + + case 's': case 'S': + if (argv [i][2] == 0) break; + if (src_predef) + { + src_predef= 0; + src_cnt= 0; + } + src [src_cnt++]= &argv[i][2]; + break; + + case 't': case 'T': + if (argv[i][2] == 0) break; + table_name= &argv [i][2]; + break; + + case 'w': case 'W': + switch (argv [i][2]) + { + case 'b': case 'B': + write_mode= WRITE_MODE_binary; + break; + case 'c': case 'C': + write_mode= WRITE_MODE_C; + break; + case 'r': + write_mode= WRITE_MODE_rexx; + break; + case 'R': + write_mode= WRITE_MODE_REXX; + break; + case 'A': + write_mode= WRITE_MODE_ASSEMBLE; + break; + default: + goto HLP; + } + write_to_file= &argv[i][3]; + if (*write_to_file == 0) goto HLP; + break; + + case 'v': case 'V': + verbose_mode++; + break; + +HLP: +#include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) arg_v [arg_c++] = argv [i]; + + if (arg_c) + { + for (i= 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if ((fi2= fopen (& arg_v [i][2], "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", &arg_v [i][2]); + break; + } + for (;;) + { + fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; + } + fclose (fi2); + } + } + + /* setup converter tables */ + if (table_name == (char *) 0) + table_name= set_etc_filename ((char *) 0, CSF_TABLE); + + /* initialize table */ + for (i= 0; i<256; i++) + { + converter_table[i]= init_value; + entity_table[i]= 0L; + } + + for (i=0; i<src_cnt; i++) all_fields [all_fields_cnt++] = src [i]; + for (i=0; i<dst_cnt; i++) all_fields [all_fields_cnt++] = dst [i]; + for (i=0; i<dst_ent_cnt; i++) all_fields [all_fields_cnt++] = dst_ent [i]; + records= cs_parse_code_table (table_name, all_fields, all_fields_cnt, + 1, 25); + if (records == (struct CS_record *) 0) + { + fprintf (stderr, "error parsing table %s!\n", table_name); + goto HLP; + } + + set_common_base (0); + rc= cs_records2table (records, src, src_cnt, dst, dst_cnt, + CSft_number, converter_table); + rc= cs_records2table (records, src, src_cnt, dst_ent, dst_ent_cnt, + CSft_string, entity_table); + + if (rc == -1) + { + fprintf (stderr, + "couldn\'t setup converter table from information in %s", + table_name); + + fprintf (stderr, "for conversion (%s", src[0]); + for (i=1; i<src_cnt; i++) fprintf (stderr, ",%s", src[i]); + fprintf (stderr, ") -> (%s", dst[0]); + for (i=1; i<dst_cnt; i++) fprintf (stderr, ",%s", dst[i]); + fprintf (stderr, ")\n"); + + goto HLP; + } + + ft= fopen (write_to_file, "wb"); + if (ft == (FILE *) 0) + { + fprintf (stderr, "error: couldnt write to: %s\n", write_to_file); + return 1; + } + +#ifdef MODE1 + /* generate transfer table */ + table_idx= 0L; + + /* part 1: write index into string table */ + for (i= 0; i<256; i++) + { + entry_size= 0L; + if (converter_table [i] != init_value) + { + entry_size= 2L; + } + else + { + if (entity_table [i] != 0L) + entry_size= 1 + strlen ((char *) entity_table[i]); + } + if (entry_size > 0L) + { + dpp_fwrite_long (ft, table_idx, 2); + table_idx += entry_size; + } + else + dpp_fwrite_long (ft, -1L, 2); + } + + /* part 2: write strings */ + for (i= 0; i<256; i++) + { + if (converter_table [i] != init_value) + { + fputc ((char) converter_table [i], ft); + fputc (0, ft); + } + else + { + if (entity_table [i] != 0L) + { + fputs ((char *) entity_table[i], ft); + fputc (0, ft); + } + } + } +#endif + +#ifdef MODE2 + for (i= 0; i < 256; i++) + { + if (converter_table [i] != init_value) + { + switch ((int) converter_table [i]) + { /* ASCII ONLY !!!, not portable to EBCDIC */ + case 0x26: /* &; ampersand */ + case 0x3C: /* <; less than */ + case 0x3E: /* >; greater than */ + if ((char *) entity_table[i] != (char *) 0) + { + fprintf (stdout, "0x%02X (0x%02X) -> &%s;\n", + i, + (int) converter_table [i], + (char *) entity_table[i]); + fprintf (ft, "&%s;", (char *) entity_table[i]); + } + else + { + fprintf (stderr, "can\'t convert entity!\n"); + fprintf (stderr, + "0x%02X (0x%02X) -> &%s;\n", + i, + (int) converter_table [i], + (char *) entity_table[i]); + fprintf (ft, "&0x%02lX;", converter_table[i]); + } + break; + default: + fputc ((char) converter_table [i], ft); + break; + } + } + else + { + if (entity_table [i] != 0L) + { /* ASCII ONLY !!!, not portable to EBCDIC */ + fprintf (ft, "&%s;", (char *) entity_table[i]); + } + } + fputc (0, ft); + } +#endif + + fclose (ft); + + if (verbose_mode > 0) + cs_print_tlate_table (stdout, write_to_file, "tlate"); + + return 0; +} diff --git a/lib/ds/codes/contrib b/lib/ds/codes/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/codes/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/codes/cs000.c b/lib/ds/codes/cs000.c new file mode 100644 index 0000000000000000000000000000000000000000..176c712ad4113bfc5773335d83c73c52d8615755 --- /dev/null +++ b/lib/ds/codes/cs000.c @@ -0,0 +1,11 @@ +/* + * File %dpp/codes/cs000.c + * + * written: 1993-01-06: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ diff --git a/lib/ds/codes/cs001.c b/lib/ds/codes/cs001.c new file mode 100644 index 0000000000000000000000000000000000000000..630141c91e2204f127336c245d0c12792ca9dcd5 --- /dev/null +++ b/lib/ds/codes/cs001.c @@ -0,0 +1,333 @@ +/* + * File %dpp/codes/cs001.c + * + * parse the code set table + * + * written: 1992-12-25: g.gonter@ieee.org + * 1993-01-06: GG, match fields, filter + * latest update: 1995-12-10 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/fileio.h> +#include <gg/dpp.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +static long tnum_records= 0L; +static long unum_records= 0L; +static long alloc_record= 0L; +static long alloc_field= 0L; +static char *out_of_memory= "out of memory!\n"; + +/* ------------------------------------------------------------------------ */ +struct CS_record *cs_parse_code_table ( +char *fn, +char *matching_field [], +int field_cnt, +int filter, +int max_warnings) +{ + FILE *fi= (FILE *) 0; + struct CS_field **fapp; + struct CS_field *csf= (struct CS_field *) 0; + struct CS_record *csr= (struct CS_record *) 0; + struct CS_record *first= (struct CS_record *) 0; + struct CS_record **rapp= &first; + char *lin; + char *nam; + int ch; +#define STAT_start 0 +#define STAT_name 1 +#define STAT_equal 2 +#define STAT_number 3 +#define STAT_string 4 +#define STAT_backslash 5 +#define STAT_endfield 6 +#define STAT_endline 7 +#define STAT_identifier 8 + int status= STAT_start; + int idx= 0; + int line_num= 1; + int use_record= 0; + int use_field= 0; + + if ((lin= malloc (1024)) == (char *) 0 + || (nam= malloc (1024)) == (char *) 0 + || (fi= fopen (fn, "rb")) == (FILE *) 0 + ) goto ERR; + + tnum_records= 0L; + unum_records= 0L; + + if ((csr= calloc (sizeof (struct CS_record), 1)) == (struct CS_record *) 0) + goto STOP; + + alloc_record++; + fapp= &csr->CSr_fields; + + for (;;) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) ch= '\n'; + + if (ch == '\r') continue; + if (ch == '#') + { + while (ch != '\n' && !feof (fi)) ch= fgetc (fi) & 0x00FF; + /* continue; */ /* note: the parser below must see the line feed!! */ + if (feof (fi)) ch= '\n'; + } + +/** printf ("### status=%d ch=%c idx=%d\n", status, ch, idx); **/ + + switch (status) + { + case STAT_start: + if (ch == '\n' || ch == ' ' || ch == '\t') break; +NEW_RECORD: + use_record= 0; + tnum_records++; +NEW_FIELD: + use_field= 0; + status= STAT_name; + idx= 0; + + case STAT_name: + if (ch == ' ' || ch == '\t') break; /* ingore spaces here */ + if (ch == '=') + { + nam [idx]= (char) 0; + status= STAT_equal; + csf= (struct CS_field *) 0; + idx= 0; + + /* find out if this field should be used at all. */ + if (!filter) + { + use_field= 1; /* if unfiltered, then */ + use_record= 1; /* use everything for now */ + } + else + { + if (match_array (matching_field, field_cnt, nam) >= 0) + { + use_field= 1; + use_record= 1; + } + } + if (!use_field) break; + + if ((csf= calloc (sizeof (struct CS_field), 1)) + == (struct CS_field *) 0) goto STOP; + alloc_field++; + csf->CSf_name= strdup (nam); + *fapp= csf; + fapp= &csf->CSf_next; + csr->CSr_count++; + break; + } + nam [idx++]= (char) ch; + break; + + case STAT_equal: + if (ch == ' ' || ch == '\t') break; + if (ch >= '0' && ch <= '9') + { + lin [idx++]= (char) ch; + status= STAT_number; + break; + } + if (ch == '\"') + { + status= STAT_string; + break; + } + if ((ch >= 'A' && ch <= 'Z') + ||(ch >= 'a' && ch <= 'z') + || ch >= '_' + || ch == '$' ) + { + lin [idx++]= (char) ch; + status= STAT_identifier; + break; + } + break; + + case STAT_number: + if (ch == ' ' || ch == '\t' || ch == '\n') + { + lin [idx]= 0; + if (csf != (struct CS_field *) 0) + { + csf->CSf_type= CSft_number; + csf->CSf_number= get_parameter_value (lin); +/*** printf ("## [%d] field: name=\'%s\' type=number number=%ld\n", + line_num, csf->CSf_name, csf->CSf_number); ***/ + } + cs_count_attribute (nam, CSft_number, csf != (void *) 0); + status= (ch == '\n') ? STAT_endline : STAT_endfield; + break; + } + + if ((ch >= '0' && ch <= '9') + ||(ch >= 'a' && ch <= 'f') + ||(ch >= 'A' && ch <= 'F') + || ch == 'x' || ch == 'X') + { + lin [idx++]= (char) ch; + } + /* else: syntax error! #### */ + break; + + case STAT_string: + switch (ch) + { + case '\"': + case '\n': +TREAT_AS_STRING: + lin [idx]= 0; + if (csf != (struct CS_field *) 0) + { + csf->CSf_type= CSft_string; + csf->CSf_string= strdup (lin); +/*** printf ("## [%d] field: name=\'%s\' type=string string=\'%s\'\n", + line_num, csf->CSf_name, csf->CSf_string); ***/ + } + cs_count_attribute (nam, CSft_string, csf != (void *) 0); + status= (ch == '\n') ? STAT_endline : STAT_endfield; + break; + case '\\': + status=STAT_backslash; + break; + default: + lin [idx++] = (char) ch; + break; + } + break; + + case STAT_backslash: + lin [idx++]= (char) ch; + status= STAT_string; + break; + + case STAT_identifier: + if (ch == ' ' || ch == '\t' || ch == '\n') + { + struct CS_field *id_csf; + + lin [idx]= 0; + status= (ch == '\n') ? STAT_endline : STAT_endfield; + cs_count_attribute (nam, CSft_identifier, csf != (void *) 0); + if (csf == (struct CS_field *) 0) break; + + if ((id_csf= cs_find_field (first, "def", CSft_string, lin, + 0L, "val")) == (struct CS_field *) 0) + { + if (max_warnings-- > 0) + { + fprintf (stderr, + "warning: %s(%d) identifier \'%s\' undefined; treated as string!\n", + fn, line_num, lin); + if (max_warnings == 0) + fprintf (stderr, + "warning: *** no further warnings are issued!\n"); + } + goto TREAT_AS_STRING; + } + + csf->CSf_type= id_csf->CSf_type; + csf->CSf_number= id_csf->CSf_number; + csf->CSf_string= id_csf->CSf_string; +/*** printf ("## [%d] field: name=\'%s\' type=number number=%ld\n", + line_num, csf->CSf_name, csf->CSf_number); ***/ + break; + } + + if ((ch >= '0' && ch <= '9') + ||(ch >= 'a' && ch <= 'z') + ||(ch >= 'A' && ch <= 'Z') + || ch == '_' || ch == '$' ) + { + lin [idx++]= (char) ch; + } + /* else: syntax error! #### */ + break; + + case STAT_endfield: + if (ch == ' ' || ch == '\t') break; + if (ch == '\n') + { + status= STAT_endline; + break; + } + goto NEW_FIELD; + break; + + case STAT_endline: + if (ch == '\n') break; + if (ch == ' ' || ch == '\t') + { + status = STAT_endfield; + break; + } + if (use_record) + { + *rapp= csr; + rapp= &csr->CSr_next; + unum_records++; + csr= calloc (sizeof (struct CS_record), 1); + alloc_record++; + if (csr == (struct CS_record *) 0) goto STOP; + fapp= &csr->CSr_fields; + } + else + { + cs_free_fields (csr->CSr_fields, /* ((void *)()), */ 1, 1); + memset (csr, 0, sizeof (struct CS_record)); + } + goto NEW_RECORD; + break; + } + + if (ch == '\n') line_num++; + if (feof (fi)) + { + if (use_record) + { + *rapp= csr; + rapp= &csr->CSr_next; + unum_records++; + } + break; + } + } + + free (csr); /* last record structure was not used */ + if (0) + { +STOP: + fprintf (stderr, out_of_memory); + } + +ERR: + fclose_or_what (fi); + free_or_what (lin); + free_or_what (nam); + + fprintf (stderr, "%ld records = %ld bytes\n", + alloc_record, alloc_record*(sizeof (struct CS_record)) ); + fprintf (stderr, "%ld fields = %ld bytes\n", + alloc_field, alloc_field*(sizeof (struct CS_field)) ); + + return first; +} + +/* ------------------------------------------------------------------------ */ +long cs_tnum_records () { return tnum_records; } +long cs_unum_records () { return unum_records; } diff --git a/lib/ds/codes/cs001.o b/lib/ds/codes/cs001.o new file mode 100644 index 0000000000000000000000000000000000000000..339cd6fa80f79feac555551e95f0e378f2a0500c Binary files /dev/null and b/lib/ds/codes/cs001.o differ diff --git a/lib/ds/codes/cs002.c b/lib/ds/codes/cs002.c new file mode 100644 index 0000000000000000000000000000000000000000..fd06457682729a30502929367a638438fa8be980 --- /dev/null +++ b/lib/ds/codes/cs002.c @@ -0,0 +1,24 @@ +/* + * File %ds/codes/cs002.c + * + * written: 1992-12-25: g.gonter@ieee.org + * latest update: 1996-02-24 10:53:45 + * + */ + +#include <stdio.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +long cs_print_records (FILE *fo, struct CS_record *recs) +{ + long c= 0L; + + for (; recs != (struct CS_record *) 0; recs= recs->CSr_next) + { + fprintf (fo, "record[%ld]: count=%ld\n", ++c, recs->CSr_count); + cs_print_fields (fo, recs->CSr_fields); + } + + return c; +} diff --git a/lib/ds/codes/cs002.o b/lib/ds/codes/cs002.o new file mode 100644 index 0000000000000000000000000000000000000000..d5611bce628e5cdb9d0c218c0a2716fe5b96d8b1 Binary files /dev/null and b/lib/ds/codes/cs002.o differ diff --git a/lib/ds/codes/cs003.c b/lib/ds/codes/cs003.c new file mode 100644 index 0000000000000000000000000000000000000000..7e03ae8bb54539685dce34ef8e198140e06f4430 --- /dev/null +++ b/lib/ds/codes/cs003.c @@ -0,0 +1,30 @@ +/* + * File %ds/codes/cs003.c + * + * written: 1992-12-25: g.gonter@ieee.org + * latest update: 1996-02-24 11:02:26 + * + */ + +#include <stdio.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +long cs_print_fields (FILE *fo, struct CS_field *fields) +{ + long c= 0L; + + for (; fields != (struct CS_field *) 0; fields= fields->CSf_next) + { + fprintf (fo, " field[%ld]:", ++c); + fprintf (fo, " name=\'%s\' type=%ld", + fields->CSf_name, fields->CSf_type); + if (fields->CSf_type == CSft_number) + fprintf (fo, " number=0x%04lX", fields->CSf_number); + if (fields->CSf_type == CSft_string) + fprintf (fo, " string=\'%s\'", fields->CSf_string); + fputc ('\n', fo); + } + + return c; +} diff --git a/lib/ds/codes/cs003.o b/lib/ds/codes/cs003.o new file mode 100644 index 0000000000000000000000000000000000000000..a7de524d303c878b7637750d319707d88cda975b Binary files /dev/null and b/lib/ds/codes/cs003.o differ diff --git a/lib/ds/codes/cs004.c b/lib/ds/codes/cs004.c new file mode 100644 index 0000000000000000000000000000000000000000..6534dff0159654fa83bd1fab00aed63679fe3753 --- /dev/null +++ b/lib/ds/codes/cs004.c @@ -0,0 +1,163 @@ +/* + * File %dpp/codes/cs004.c + * + * written: 1992-12-25: g.gonter@ieee.org + * latest update: 1995-12-09 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/ytree.h> +#include <gg/dpp.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +int cs_records2ytree ( +struct CS_record *recs, /* records to be processed */ +char *field [], /* names of fields to use */ +long tags [], /* tag codes for field names */ +int fields, /* number of fields */ +char *lut_file, /* name of LUT file to be written */ +char *data_file, /* name of data file to be written */ +int verbose, /* 1 -> be chatty while compiling info */ +int compact, /* 1 -> compact LUT, info contains code */ + /* of first matching field */ +int all) /* 1 -> use all entities, even without code */ +{ + FILE *fo= (FILE *) 0; + int rv= 0; +#define MAX_entity_names 24 + char *entity_name [MAX_entity_names]; + int entity_names; + long value; + long position= 0L; + long out_size; + int i; + struct CS_field *fld; + struct YTREE *ytree= (struct YTREE *) 0; + struct YTREE *yt; + + if (!compact) + { + if (data_file != (char *) 0 && *data_file != 0) + { + fo= fopen (data_file, "wb"); + if (verbose) + fprintf (stderr, "opening %s for writing entity data.\n", + data_file); + if (fo == (FILE *) 0) + { + fprintf (stderr, "error: couldnt open %s for writing entity data!\n", + data_file); + } + } + } + + for (; recs != (struct CS_record *) 0; recs= recs->CSr_next) + { + entity_names= 0; + value= -1L; + out_size= 0L; + + for (fld = recs->CSr_fields; + fld != (struct CS_field *) 0; + fld = fld->CSf_next) + { + if (strcmp (fld->CSf_name, "entity") == 0 + && fld->CSf_type == CSft_string) + { + entity_name [entity_names++]= fld->CSf_string; + } + + for (i= 0; i < fields; i++) + { + if (strcmp (fld->CSf_name, field[i]) == 0) + { /* matching field name found */ + if (compact) + { + if (value == -1L && fld->CSf_type==CSft_number) + value= fld->CSf_number; + } + else + { /* write to data file ############ */ + if (fo != (FILE *) 0) + { + if (fld->CSf_type == CSft_number) + { + dpp_fwrite_long (fo, 4L, 2); + dpp_fwrite_long (fo, tags [i], 4); + dpp_fwrite_long (fo, fld->CSf_number, 4); + out_size += 10L; + } + else + { + long lng; + + lng= (long) (strlen (fld->CSf_string)+1); + dpp_fwrite_long (fo, lng, 2); + dpp_fwrite_long (fo, tags [i], 4); + fwrite (fld->CSf_string, (int) lng, 1, fo); + out_size += lng + 6L; + } + } + } + } + } + } + + /* further processing only if ... */ + if (entity_names != 0 /* ... there is a entity name */ + &&(!compact /* and the file is not compact */ + || all /* or the all-option */ + || value != -1L /* or a value is given */ + ) + ) + { + for (i= 0; i < entity_names; i++) + { + if (verbose) + printf ("adding: %-24s pos=0x%08lX val=0x%08lX\n", + entity_name [i], position, value); + + if ((yt= ytree_insert_word (&ytree, + (unsigned char *) entity_name [i])) + == (struct YTREE *) 0) + { + fprintf (stderr, "error: yt==0 !!!\n"); + return -1; + } + + yt->YT_flags |= YTflag_EOW; + yt->YT_info= (compact) ? value : ((out_size) ? position : -1L); + } + recs->CSr_offset_dat= position; + position += out_size; + } + } + + ytree_size (ytree); + if (fo != (FILE *) 0) fclose (fo); + + fo= (FILE *) 0; + if (lut_file != (char *) 0 && *lut_file != 0) + { + fo= fopen (lut_file, "wb"); + if (verbose) + fprintf (stderr, "opening %s for writing entity lut.\n", + lut_file); + } + + if (fo == (FILE *) 0) + { + fprintf (stderr, "error: couldnt open file %s to dump the entity lut!\n", + lut_file); + } + else + { + ytree_dump (fo, ytree); + fclose (fo); + } + + return rv; +} diff --git a/lib/ds/codes/cs004.o b/lib/ds/codes/cs004.o new file mode 100644 index 0000000000000000000000000000000000000000..7f089189e7a45c7ac521853654f174211ab027d1 Binary files /dev/null and b/lib/ds/codes/cs004.o differ diff --git a/lib/ds/codes/cs005.c b/lib/ds/codes/cs005.c new file mode 100644 index 0000000000000000000000000000000000000000..f723737db1f76c9252b9d8def7d561a2d13af5a9 --- /dev/null +++ b/lib/ds/codes/cs005.c @@ -0,0 +1,117 @@ +/* + * File %dpp/codes/cs005.c + * + * written: 1992-12-25: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +static long index_str [256]; +static long index_dat [256]; + +/* ------------------------------------------------------------------------ */ +int cs_records2index ( +struct CS_record *recs, /* records to be processed */ +char *field[], /* names of fields to use */ +int fields, /* number of fields */ +char *index_file, /* name of file that holds index */ +char *data_file, /* name of file that holds the entity names */ +int verbose) /* 1 -> be chatty on writing */ +{ + FILE *fo= (FILE *) 0; + int rv= 0; + char *entity_name; + long value; + long position= 0L; + long out_size; + int i; + struct CS_field *fld; + + for (i=0; i<256; i++) index_str [i]= -1L; + for (i=0; i<256; i++) index_dat [i]= -1L; + + if (data_file != (char *) 0 && *data_file != 0) + { + fo = fopen (data_file, "wb"); + if (verbose) + fprintf (stderr, "opening %s for writing entity data\n", data_file); + if (fo == (FILE *) 0) + { + fprintf (stderr, "error: couldnt open %s for writing entity data!\n", + data_file); + } + } + + for (; recs != (struct CS_record *) 0; recs= recs->CSr_next) + { + entity_name= (char *) 0; + value= -1L; + out_size= 0L; + + for (fld = recs->CSr_fields; + fld != (struct CS_field *) 0; + fld = fld->CSf_next) + { + if (strcmp (fld->CSf_name, "entity") == 0 + && fld->CSf_type == CSft_string) + { + entity_name= fld->CSf_string; + } + + for (i= 0; i < fields; i++) + { + if (strcmp (fld->CSf_name, field[i]) == 0) + { /* matching field name found */ + if (value == -1L && fld->CSf_type==CSft_number) + value= fld->CSf_number; + } + } + } + + if (entity_name != (char *) 0) + { + if (verbose) + printf ("adding: %-24s pos=0x%08lX val=0x%08lX\n", + entity_name, position, value); + + if (fo != (FILE *) 0) + { + recs->CSr_offset_str = position; + position += (long) fwrite (entity_name, 1, strlen(entity_name)+1, fo); + } + + if (value != -1L) + { + index_str [value] = recs->CSr_offset_str; + index_dat [value] = recs->CSr_offset_dat; + } + } + } + + fo= (FILE *) 0; + if (index_file != (char *) 0 && *index_file != 0) + { + if (verbose) + fprintf (stderr, "opening index file %s for writing\n", index_file); + fo = fopen (index_file, "wb"); + } + + if (fo == (FILE *) 0) + { + fprintf (stderr, "error: couldnt open file %s to dump the index file!\n", + index_file); + } + else + { + fwrite ((char *) index_str, 256, 4, fo); + fclose (fo); + } + + return rv; +} diff --git a/lib/ds/codes/cs005.o b/lib/ds/codes/cs005.o new file mode 100644 index 0000000000000000000000000000000000000000..51db96b92ccff8b6406dc2111cd7e1622cb7c136 Binary files /dev/null and b/lib/ds/codes/cs005.o differ diff --git a/lib/ds/codes/cs006.c b/lib/ds/codes/cs006.c new file mode 100644 index 0000000000000000000000000000000000000000..3b4136ece687eaa159c7d38af1e80bb24dbbcebb --- /dev/null +++ b/lib/ds/codes/cs006.c @@ -0,0 +1,149 @@ +/* + * File %dpp/codes/cs006.c + * + * written: 1992-12-25: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +static int flag_common_base= 1; + +/* ------------------------------------------------------------------------ */ +int cs_records2table( +struct CS_record *recs, +char *src_attr [], +int src_attr_cnt, +char *dst_attr [], +int dst_attr_cnt, +int table_type, +long *table) +{ + int common_base= 0; /* 1 -> both charsets have the same comon */ + /* base character set. */ + struct CS_field *fld; + struct CS_field *src_fld; + struct CS_field *dst_fld; + int src_prio; + int dst_prio; + long src_code; + int *spt; /* source priority table */ + int *dpt; /* destination priority table */ + int rv= 0; + int i= 0; + int j= 0; + int k; + + if (table == (long *) 0) return -1; + + if (flag_common_base) + { + for (i= 0; i<src_attr_cnt; i++) + for (j= 0; j<dst_attr_cnt; j++) + if (strcmp (src_attr[i], dst_attr[j]) == 0) + { + common_base= 1; + goto NEXT; + } + } + +NEXT: + if (common_base) + { + for (k= 0; k < 256; k++) table [k] = (long) k; + fprintf (stderr, + "info: common base translation from %s (%d) to %s (%d)\n", + src_attr [i], i, dst_attr [j], j); + + if (i == j && i == 0) + { + fprintf (stderr, + "info: translation from %s to %s is trivial...\n", + src_attr [i], dst_attr [j]); + return 0; + } + /* if a translation of (ascii,...) -> (ascii,...) is given, */ + /* then the conversion table is: table[i]=i without any */ + /* thinkable modification, thus we can return immediately */ + } + else + { + i= j= 32000; + } + + if ((spt= malloc (256*sizeof (int))) == (int *) 0) return -1; + if ((dpt= malloc (256*sizeof (int))) == (int *) 0) + { + rv= -1; + goto ERR; + } + + for (k= 0; k < 256; k++) spt [k]= i; + for (k= 0; k < 256; k++) dpt [k]= j; + + for (; recs != (struct CS_record *) 0; recs = recs->CSr_next) + { + src_fld= (struct CS_field *) 0; + dst_fld= (struct CS_field *) 0; + src_prio= 32000; + dst_prio= 32000; + + for (fld = recs->CSr_fields; + fld != (struct CS_field *) 0; + fld = fld->CSf_next) + { + for (i= 0; i < src_attr_cnt; i++) + if (strcmp (src_attr [i], fld->CSf_name) == 0 + && src_prio > i) + { + src_fld= fld; + src_prio= i; + } + + for (i= 0; i < dst_attr_cnt; i++) + if (strcmp (dst_attr [i], fld->CSf_name) == 0 + && dst_prio > i) + { + dst_fld= fld; + dst_prio= i; + } + } + + if (src_fld != (struct CS_field *) 0 + && src_fld->CSf_type == CSft_number + && dst_fld != (struct CS_field *) 0 + && dst_fld->CSf_type == table_type) + { + src_code= src_fld->CSf_number; + if (src_code >= 0L && src_code < 256L + &&src_prio <= spt [src_code] + &&dst_prio <= dpt [src_code]) + { + table [src_code]= (table_type == CSft_number) + ? dst_fld->CSf_number + : (long) dst_fld->CSf_string; + spt [src_code]= src_prio; + dpt [src_code]= dst_prio; + } + } + } + + free (dpt); +ERR: + free (spt); + + return rv; +} + +/* ------------------------------------------------------------------------ */ +int set_common_base (int flag) +{ + flag_common_base= flag; + + return 0; +} diff --git a/lib/ds/codes/cs006.o b/lib/ds/codes/cs006.o new file mode 100644 index 0000000000000000000000000000000000000000..fbb29321311dbc2d266a25f031494f7083f0fca6 Binary files /dev/null and b/lib/ds/codes/cs006.o differ diff --git a/lib/ds/codes/cs007.c b/lib/ds/codes/cs007.c new file mode 100644 index 0000000000000000000000000000000000000000..1efb1a50fc1b41fe162a4d1c35dcaa271bbf3b0e --- /dev/null +++ b/lib/ds/codes/cs007.c @@ -0,0 +1,50 @@ +/* + * File %dpp/codes/cs007.c + * + * written: 1992-12-25: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <string.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +struct CS_field *cs_find_field ( +struct CS_record *first, +char *f1_name, +int f1_type, +char *f1_string, +long f1_number, +char *f2_name) +{ + struct CS_field *fld0; + struct CS_field *fld1; + struct CS_field *fld2; + + if (f1_name == (char *) 0 || *f1_name == 0 + || f2_name == (char *) 0 || *f2_name == 0 + ) return (struct CS_field *) 0; + + for (; first != (struct CS_record *) 0; first= first->CSr_next) + { + fld1= fld2= (struct CS_field *) 0; + + for (fld0 = first->CSr_fields; + fld0 != (struct CS_field *) 0; + fld0 = fld0->CSf_next) + { + if (strcmp (fld0->CSf_name, f1_name) == 0 + && fld0->CSf_type == f1_type + && ((f1_type == CSft_string) + ? (strcmp (fld0->CSf_string, f1_string) == 0) + : (fld0->CSf_number == f1_number))) fld1= fld0; + if (strcmp (fld0->CSf_name, f2_name) == 0) fld2= fld0; + } + + if (fld1 != (struct CS_field *) 0 + &&fld2 != (struct CS_field *) 0) return fld2; + } + + return (struct CS_field *) 0; +} diff --git a/lib/ds/codes/cs007.o b/lib/ds/codes/cs007.o new file mode 100644 index 0000000000000000000000000000000000000000..7b770d7acd47d344b193baccb62e03e5d0b114eb Binary files /dev/null and b/lib/ds/codes/cs007.o differ diff --git a/lib/ds/codes/cs008.c b/lib/ds/codes/cs008.c new file mode 100644 index 0000000000000000000000000000000000000000..065bcbfdeff9258c1b8e0e4cb0ce592c6d5afd89 --- /dev/null +++ b/lib/ds/codes/cs008.c @@ -0,0 +1,36 @@ +/* + * %dpp/codes/cs008.c + * + * written: 1993-01-06: g.gonter@ieee.org + * latet update: 1995-12-10 + * + */ + +#include <stdlib.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +int cs_free_fields ( +struct CS_field *csf, +/* void ((*free_info) (void *info)), */ +int free_names, +int free_values) +{ + struct CS_field *csf2; + + while (csf != (struct CS_field *) 0) + { + if (free_names && csf->CSf_name != (char *) 0) free (csf->CSf_name); + if (free_values && csf->CSf_string != (char *) 0) free (csf->CSf_string); +/********* + if (free_info != (void (*free_info) (void *)) 0) + (*free_info) (csf->CSf_info); +*********/ + + csf2= csf; + csf= csf->CSf_next; + free (csf2); + } + + return 0; +} diff --git a/lib/ds/codes/cs008.o b/lib/ds/codes/cs008.o new file mode 100644 index 0000000000000000000000000000000000000000..4bc110791c7d009be6df714367a3fe505cc4b5a7 Binary files /dev/null and b/lib/ds/codes/cs008.o differ diff --git a/lib/ds/codes/cs009.c b/lib/ds/codes/cs009.c new file mode 100644 index 0000000000000000000000000000000000000000..8c25facaceecebc3d583cfcc2f28efc12c77ae23 --- /dev/null +++ b/lib/ds/codes/cs009.c @@ -0,0 +1,56 @@ +/* + * File %dpp/codes/cs009.c + * + * written: 1993-01-06: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <string.h> +#include <stdlib.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +static struct CS_attribute_statistics *CSattr= (void *) 0; + +/* ------------------------------------------------------------------------ */ +int cs_count_attribute (char *attribute, int atype, int used) +{ + struct CS_attribute_statistics *csa; + struct CS_attribute_statistics **CSa_app; + int cmp; + + if (atype >= CSft_count || atype < 0) atype= 0; + + CSa_app= &CSattr; + for (csa= CSattr; csa != (void *) 0; csa= csa->CSa_next) + { + cmp= strcmp (csa->CSa_name, attribute); + if (cmp == 0) goto CNT; + if (cmp > 0) break; + CSa_app= &csa->CSa_next; + } + + csa= calloc (sizeof (struct CS_attribute_statistics), 1); + csa->CSa_name= strdup (attribute); + csa->CSa_next= *CSa_app; + *CSa_app= csa; + +CNT: + csa->CSa_tcnt [atype]++; + if (used) csa->CSa_ucnt [atype]++; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +struct CS_attribute_statistics *cs_get_attribute_statistics () +{ + return CSattr; +} + +/* ------------------------------------------------------------------------ */ +void cs_reset_attribute_statistics () +{ + CSattr= (void *) 0; +} diff --git a/lib/ds/codes/cs009.o b/lib/ds/codes/cs009.o new file mode 100644 index 0000000000000000000000000000000000000000..1d17896cf7c05aa05501f6ab3ffa3d2b962feef0 Binary files /dev/null and b/lib/ds/codes/cs009.o differ diff --git a/lib/ds/codes/cs010.c b/lib/ds/codes/cs010.c new file mode 100644 index 0000000000000000000000000000000000000000..94ef7d0916aba0abcdfd41af92288f2170599567 --- /dev/null +++ b/lib/ds/codes/cs010.c @@ -0,0 +1,42 @@ +/* + * File %dpp/codes/cs010.c + * + * written: 1993-01-06: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdio.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +int cs_print_statistics (FILE *fo) +{ + struct CS_attribute_statistics *csa; + long tnum_records; + long unum_records; + + tnum_records= cs_tnum_records (); + unum_records= cs_unum_records (); + + fprintf (fo, "number of records: %ld, used: %ld, ignored: %ld\n", + tnum_records, unum_records, tnum_records-unum_records); + + fprintf (fo, + "%-32s %12s %12s %12s\n", + "attribute name", + "strings", "numbers", "ids"); + + for (csa= cs_get_attribute_statistics (); + csa != (void *) 0; + csa= csa->CSa_next) + { + fprintf (fo, "%-32s %5ld(%5ld) %5ld(%5ld) %5ld(%5ld)\n", + csa->CSa_name, + csa->CSa_tcnt [CSft_string], csa->CSa_ucnt [CSft_string], + csa->CSa_tcnt [CSft_number], csa->CSa_ucnt [CSft_number], + csa->CSa_tcnt [CSft_identifier], csa->CSa_ucnt [CSft_identifier]); + } + + return 0; +} diff --git a/lib/ds/codes/cs010.o b/lib/ds/codes/cs010.o new file mode 100644 index 0000000000000000000000000000000000000000..f036f77f2cc612b6f29c726f0ee1e1dd15f81756 Binary files /dev/null and b/lib/ds/codes/cs010.o differ diff --git a/lib/ds/codes/cs011.c b/lib/ds/codes/cs011.c new file mode 100644 index 0000000000000000000000000000000000000000..8d04a67744bdbee4e0c6e0986d0884461477bf79 --- /dev/null +++ b/lib/ds/codes/cs011.c @@ -0,0 +1,24 @@ +/* + * File %ds/codes/cs011.c + * + * written: 1996-02-24: g.gonter@ieee.org + * latest update: 1996-02-24 11:03:38 + * + */ + +#include <stdio.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +long cs_print_frames (FILE *fo, struct CS_record *recs) +{ + long c= 0L; + + for (; recs != (struct CS_record *) 0; recs= recs->CSr_next) + { + /* fprintf (fo, "record[%ld]: count=%ld\n", ++c, recs->CSr_count); */ + cs_print_frame (fo, recs->CSr_fields); + } + + return c; +} diff --git a/lib/ds/codes/cs011.o b/lib/ds/codes/cs011.o new file mode 100644 index 0000000000000000000000000000000000000000..5e122fb6f2ba517e2bad4c2f43d4202387987f89 Binary files /dev/null and b/lib/ds/codes/cs011.o differ diff --git a/lib/ds/codes/cs012.c b/lib/ds/codes/cs012.c new file mode 100644 index 0000000000000000000000000000000000000000..98d8b59c783ebadeddf10700d73ff9f27efe3a24 --- /dev/null +++ b/lib/ds/codes/cs012.c @@ -0,0 +1,183 @@ +/* + * File %ds/codes/cs012.c + * + * written: 1996-02-24: g.gonter@ieee.org + * latest update: 1996-02-24 11:04:52 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/codes.h> + +static long x_cnt= 1; +static char tmp1 [512]; +static char tmp2 [512]; + +/* ------------------------------------------------------------------------ */ +long cs_print_frame (FILE *fo, struct CS_field *fields) +{ + long c= 0L; + struct CS_field *f2; + long iso_code= -1L; + char *name; + char *tag_name; + char *attr_name; + char *attr_value; + int num_size= 2; + char *eset= (char *) 0; + char *entity= (char *) 0; + + f2= fields; + + for (; fields != (struct CS_field *) 0; fields= fields->CSf_next) + { + if (strcmp (fields->CSf_name, "iso10646") == 0 + && fields->CSf_type == CSft_number + ) + iso_code= fields->CSf_number; + + if (strcmp (fields->CSf_name, "def") == 0) return 0; + } + + if (iso_code != -1L) + { + fprintf (fo, "<Frame 0x%08lX>\n", iso_code); + } + else + { + fprintf (fo, "<Frame XX 0x%08lX>\n", x_cnt++); + } + + for (fields= f2; fields != (struct CS_field *) 0; fields= fields->CSf_next) + { + /**************************************** + fprintf (fo, " field[%ld]:", ++c); + fprintf (fo, " name=\'%s\' type=%ld", + fields->CSf_name, fields->CSf_type); + ****************************************/ + name= fields->CSf_name; + num_size= 2; + attr_name= attr_value= (char *) 0; + + if (strcmp (name, "ascii") == 0 + || strcmp (name, "ebcdic") == 0 + || strcmp (name, "ebcdic") == 0 + || strcmp (name, "mac") == 0 + || strcmp (name, "pc") == 0 + ) + { + tag_name= "c"; + attr_name= "n"; + attr_value= name; + num_size= 1; + } + else + if (strcmp (name, "iso8859") == 0 + || strcmp (name, "iso8859_1") == 0 + ) + { + tag_name= "c"; + attr_name= "n"; + attr_value= "iso8859-1"; + num_size= 1; + } + else + if (strcmp (name, "iso10646") == 0) + { + tag_name= "c"; + attr_name= "n"; + attr_value= "iso10646"; + num_size= 4; + } + else + if (strcmp (name, "name") == 0) + { + tag_name= "n"; + } + else + if (strcmp (name, "name_en") == 0) + { + tag_name= "n"; + attr_name= "l"; + attr_value= "en"; + } + else + if (strcmp (name, "name_gr") == 0) + { + tag_name= "n"; + attr_name= "l"; + attr_value= "gr"; + } + else + if (strcmp (name, "name_iso") == 0) + { + tag_name= "n"; + attr_name= "l"; + attr_value= "iso"; + } + else + if (strcmp (name, "tex") == 0) + { + tag_name= "r"; + attr_name= "n"; + attr_value= "tex"; + } + else + if (strcmp (name, "eset") == 0) + { + eset= fields->CSf_string; + continue; + } + else + if (strcmp (name, "entity") == 0) + { + tag_name= "e"; + if (eset != (char *) 0) + { + attr_name= "s"; + attr_value= eset; + } + } + else + { + tag_name= name; + } + + fprintf (fo, "<%s", tag_name); + if (attr_name != (char *) 0 && attr_value != (char *) 0) + fprintf (fo, " %s=%s", attr_name, attr_value); + fputc ('>', fo); + + if (fields->CSf_type == CSft_number) + { + switch (num_size) + { + case 1: + fprintf (fo, "0x%02lX", fields->CSf_number); + break; + default: + case 2: + fprintf (fo, "0x%04lX", fields->CSf_number); + break; + case 4: + fprintf (fo, "0x%08lX", fields->CSf_number); + break; + } + } + + if (fields->CSf_type == CSft_string) + { + strcpy (tmp1, fields->CSf_string); + sgml_encode (tmp1, tmp2, 510); + fputs (tmp1, fo); + } + + fputc ('\n', fo); + } + + fprintf (fo, "</Frame>\n"); + + return c; +} diff --git a/lib/ds/codes/cs012.o b/lib/ds/codes/cs012.o new file mode 100644 index 0000000000000000000000000000000000000000..5994f029c6eeef81e15ba9048bf1529c12db4fe7 Binary files /dev/null and b/lib/ds/codes/cs012.o differ diff --git a/lib/ds/codes/cs101.c b/lib/ds/codes/cs101.c new file mode 100644 index 0000000000000000000000000000000000000000..baefa1be6b1c2472bd9e3701ea90290ed56c3158 --- /dev/null +++ b/lib/ds/codes/cs101.c @@ -0,0 +1,132 @@ +/* + * File %dpp/codes/cs101.c + * + * *** OBSOLOETE *** + * + * entity translation + * + * written: 1992-12-27: g.gonter@ieee.org + * latest update: 1995-12-09 + * + */ + +#include <stdlib.h> +#include <gg/fileio.h> +#include <gg/filename.h> +#include <gg/codes.h> + +/* #define DEBUG */ +#ifdef DEBUG +#include <stdio.h> +#include <gg/diagnose.h> +#endif + +/* ------------------------------------------------------------------------ */ +static int module_uninitialized= 1; +static long *index= (long *) 0; +static char *strings= (char *) 0; +static long string_size; + +/* ------------------------------------------------------------------------ */ +struct LIST +{ + struct LIST *next; + char *str; +} ; + +static struct LIST *buffer_list= (struct LIST *) 0; + +/* ------------------------------------------------------------------------ */ +int INIT_get_sgml_entity (char *fnm_idx, char *fnm_str) +{ + long rc; + + if (!module_uninitialized) + { /* The module had initialized its data objects before. The */ + /* re-initialization can only be called explicitly, so this */ + /* must be on purpose. The string table might still be */ + /* referenced from outside, so this object will be kept. */ + + struct LIST *nl; + + if ((nl= (struct LIST *) calloc (sizeof (struct LIST), 1)) + != (struct LIST *) 0) + { + nl->next= buffer_list; + nl->str= strings; + buffer_list= nl; + } + + strings= (char *) 0; /* a new buffer will be allocated */ + } + + rc= read_file2buffer ((char **) &index, fnm_idx, 1024L); +#ifdef DEBUG +fprintf (stderr, ">>> reading %s -> %ld diag=%d\n", fnm_idx, rc, gg_diagnose); +#endif + if (rc == -1L) return -1; + string_size= read_file2buffer (&strings, fnm_str, 32000L); +#ifdef DEBUG +fprintf (stderr, ">>> reading %s -> %ld diag=%d\n", fnm_str, rc, gg_diagnose); +#endif + if (string_size == -1L) return -1; + + module_uninitialized= 0; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int KILL_get_sgml_entity () +{ + struct LIST *l; + + if (module_uninitialized) return 0; + + if (index != (long *) 0) free (index); + if (strings != (char *) 0) free (strings); + index= (long *) 0; + strings= (char *) 0; + + while ((l= buffer_list) != (struct LIST *) 0) + { + buffer_list= buffer_list->next; + free (l->str); + free (l); + } + + module_uninitialized= 1; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +char *get_sgml_entity (int ch) +{ + int rc; + long offset; + + if (ch < 0 || ch > 255) return (char *) 0; +#ifdef DEBUG +fprintf (stderr, ">> convert: 0x%02X %c\n", ch, ch); +#endif + + if (module_uninitialized) + { + rc= INIT_get_sgml_entity ( + set_etc_filename ((char *) 0, CSF_PC_INDEX), + set_etc_filename ((char *) 0, CSF_PC_STRINGS)); + if (rc == -1) return (char *) 0; + } + + offset= index [ch]; +#ifdef DEBUG +fprintf (stderr, ">> offset= 0x%08lX\n", offset); +#endif + if (offset < 0L || offset >= string_size) return (char *) 0; + +#ifdef DEBUG +fprintf (stderr, ">> is %c->%s\n", ch, &strings [offset]); +#endif + return &strings [offset]; +} diff --git a/lib/ds/codes/cs101.o b/lib/ds/codes/cs101.o new file mode 100644 index 0000000000000000000000000000000000000000..3d49d133894a8891d981164943a45ac79b070c6a Binary files /dev/null and b/lib/ds/codes/cs101.o differ diff --git a/lib/ds/codes/cs102.c b/lib/ds/codes/cs102.c new file mode 100644 index 0000000000000000000000000000000000000000..adab049a4c5e8c646090af48f6d421a857b2c8d4 --- /dev/null +++ b/lib/ds/codes/cs102.c @@ -0,0 +1,88 @@ +/* + * File %dpp/codes/cs102.c + * + * *** OBSOLOETE *** + * + * entity translation + * + * written: 1992-12-27: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/fileio.h> +#include <gg/filename.h> +#include <gg/lookup.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +static int module_uninitialized= 1; +static int auto_initialized= 0; +static char *lut= (char *) 0; +static long lut_size= 0L; + +/* ------------------------------------------------------------------------ */ +int INIT_find_sgml_entity (char *fnm_lut) +{ + if (!module_uninitialized) + { + free (lut); + lut= (char *) 0; /* a new buffer will be allocated */ + lut_size= 0L; + } + + if ((lut_size= read_file2buffer (&lut, fnm_lut, 32000L)) == -1L) return -1; + + module_uninitialized= 0; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int KILL_find_sgml_entity () +{ + if (module_uninitialized) return 0; + + if (lut != (char *) 0) free (lut); + lut= (char *) 0; + lut_size= 0L; + + module_uninitialized= 1; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int find_sgml_entity (char *entity) +{ + int rc; + long info; + int lng; + + if (entity == (char *) 0 || *entity == 0) return -1; + + if (module_uninitialized) + { + rc= (auto_initialized) + ? -1 + : INIT_find_sgml_entity ( + set_etc_filename ((char *) 0, CSF_PC_COMPACT_LUT)); + + auto_initialized= 1; + + if (rc == -1) + { /* default values if really nothing is available */ + if (strcmp (entity, "lt") == 0) return 0x3C; + if (strcmp (entity, "gt") == 0) return 0x3E; + if (strcmp (entity, "amp") == 0) return 0x26; + return -1; + } + } + + if (lookup_char (lut, entity, &info, &lng) != LOOKUP_found) return -1; + + return (int) info; +} diff --git a/lib/ds/codes/cs102.o b/lib/ds/codes/cs102.o new file mode 100644 index 0000000000000000000000000000000000000000..96094946789b58f4db256ede56404932f74a40a8 Binary files /dev/null and b/lib/ds/codes/cs102.o differ diff --git a/lib/ds/codes/cs103.c b/lib/ds/codes/cs103.c new file mode 100644 index 0000000000000000000000000000000000000000..bc34590e81b01e4008d778f43057d780d317ecac --- /dev/null +++ b/lib/ds/codes/cs103.c @@ -0,0 +1,40 @@ +/* + * File %dpp/codes/cs103.c + * + * CS_ET8: entity translation functions + * + * written: 1995-12-10: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +struct CS_ET8 *cs_et8_create_table ( +long table_id, +char *fnm_dat, +char *fnm_idx, +char *fnm_lut) +{ + struct CS_ET8 *et8; + + if (fnm_dat == (char *) 0 + || *fnm_dat == 0 + || (et8= ((struct CS_ET8 *) calloc (sizeof (struct CS_ET8), 1))) + == (struct CS_ET8 *) 0 + || (et8->CS_et8_string_fnm= strdup (fnm_dat)) == (char *) 0 + || (et8->CS_et8_index_fnm= fnmcpy4 (fnm_idx, fnm_dat, ".idx")) + == (char *) 0 + || (et8->CS_et8_lut_fnm= fnmcpy4 (fnm_lut, fnm_dat, ".lut")) + == (char *) 0 + ) return (struct CS_ET8 *) 0; + + et8->CS_et8_table_id= table_id; + + return et8; +} diff --git a/lib/ds/codes/cs103.o b/lib/ds/codes/cs103.o new file mode 100644 index 0000000000000000000000000000000000000000..3e31f44c1443dbdf225aec8928c193ed340b90d7 Binary files /dev/null and b/lib/ds/codes/cs103.o differ diff --git a/lib/ds/codes/cs104.c b/lib/ds/codes/cs104.c new file mode 100644 index 0000000000000000000000000000000000000000..9a8c49bf13164044d1b74fb9d489dbce448c96d6 --- /dev/null +++ b/lib/ds/codes/cs104.c @@ -0,0 +1,35 @@ +/* + * File %dpp/codes/cs104.c + * + * CS_ET8: entity translation functions + * + * written: 1995-12-10: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +int cs_et8_destroy_table (struct CS_ET8 *et8) +{ + if (et8 == (struct CS_ET8 *) 0) return -1; + + /* get rid of the lookup table */ + free_or_what (et8->CS_et8_lut_fnm); + free_or_what (et8->CS_et8_lut); + + /* get rid of the index table */ + free_or_what (et8->CS_et8_index_fnm); + free_or_what (et8->CS_et8_index); + + /* get rid of the string buffer */ + free_or_what (et8->CS_et8_string_fnm); + free_or_what (et8->CS_et8_string_buffer); + + free (et8); + + return 0; +} diff --git a/lib/ds/codes/cs104.o b/lib/ds/codes/cs104.o new file mode 100644 index 0000000000000000000000000000000000000000..c4bd5cf157008359f378fdd78d481bd5653fef40 Binary files /dev/null and b/lib/ds/codes/cs104.o differ diff --git a/lib/ds/codes/cs105.c b/lib/ds/codes/cs105.c new file mode 100644 index 0000000000000000000000000000000000000000..869eac39113196edd88e20a4a7a021cfe5d3184b --- /dev/null +++ b/lib/ds/codes/cs105.c @@ -0,0 +1,96 @@ +/* + * File %dpp/codes/cs105.c + * + * CS_ET8: entity translation functions + * + * written: 1995-12-10: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdlib.h> +#include <gg/fileio.h> +#include <gg/strings.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +char *cs_et8_code2entity (struct CS_ET8 *et8, int ch) +{ + long rc; + long offset; + long *index; + char *strings; + long string_size; + char *entity_name= (char *) 0; + + if (et8 == (struct CS_ET8 *) 0 + || et8->CS_et8_error_flag != 0 /* table can't be used! */ + || ch < 0x00 + || ch > 0xFF + ) + goto END; + + /* load translation tables now if they are not already loaded */ + if ((index= et8->CS_et8_index) == (long *) 0) + { + rc= read_file2buffer ((char **) &et8->CS_et8_index, + et8->CS_et8_index_fnm, 1024L); + +#ifdef DEBUG + fprintf (stderr, ">>> reading %s -> %ld diag=%d\n", + et8->CS_et8_index_fnm, rc, gg_diagnose); +#endif + + if (rc == -1L) + { + et8->CS_et8_error_flag= 1; + goto END; + } + index= et8->CS_et8_index; + } + + if ((strings= et8->CS_et8_string_buffer) == (char *) 0) + { + string_size= read_file2buffer (&et8->CS_et8_string_buffer, + et8->CS_et8_string_fnm, MAX_CS_ET8_SIZE); + +#ifdef DEBUG + fprintf (stderr, ">>> reading %s -> %ld diag=%d\n", fnm_str, rc, gg_diagnose); +#endif + if (string_size == -1L) + { + et8->CS_et8_error_flag= 2; + goto END; + } + + strings= et8->CS_et8_string_buffer; + et8->CS_et8_string_size= string_size; + } + else string_size= et8->CS_et8_string_size; + + offset= index [ch]; +#ifdef DEBUG + fprintf (stderr, ">> offset= 0x%08lX\n", offset); +#endif + if (offset < 0L || offset >= string_size) goto END; + +#ifdef DEBUG + fprintf (stderr, ">> is %c->%s\n", ch, &strings [offset]); +#endif + + entity_name= &strings [offset]; + +END: + if (entity_name == (char *) 0) + { + switch (ch) + { + case 0: entity_name= "null"; break; + case '&': entity_name= "amp"; break; + case '<': entity_name= "lt"; break; + case '>': entity_name= "gt"; break; + } + } + + return entity_name; +} diff --git a/lib/ds/codes/cs105.o b/lib/ds/codes/cs105.o new file mode 100644 index 0000000000000000000000000000000000000000..d1ee849e0f6dbf2df1bd19a589590531d5f756de Binary files /dev/null and b/lib/ds/codes/cs105.o differ diff --git a/lib/ds/codes/cs106.c b/lib/ds/codes/cs106.c new file mode 100644 index 0000000000000000000000000000000000000000..1a7392d1e5c1e47cadd89330fd13cb15c7122f4c --- /dev/null +++ b/lib/ds/codes/cs106.c @@ -0,0 +1,59 @@ +/* + * File %ds/codes/cs106.c + * + * CS_ET8: entity translation functions + * + * written: 1995-12-10: g.gonter@ieee.org + * latest update: 1995-12-29 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/fileio.h> +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +int cs_et8_entity2code (struct CS_ET8 *et8, char *entity) +{ + long rc; + char *lut; + long info; + int lng; + + if (et8 == (struct CS_ET8 *) 0 + || et8->CS_et8_error_flag != 0 /* table can't be used! */ + ) + { + if (entity == (char *) 0 || *entity == 0) return -1; + if (strcmp (entity, "lt") == 0) return 0x3C; + if (strcmp (entity, "gt") == 0) return 0x3E; + if (strcmp (entity, "amp") == 0) return 0x26; + return -1; + } + + /* load lookup table now if its not already loaded */ + if ((lut= et8->CS_et8_lut) == (char *) 0) + { + rc= read_file2buffer ((char **) &et8->CS_et8_lut, + et8->CS_et8_lut_fnm, MAX_CS_ET8_SIZE); + +#ifdef DEBUG + fprintf (stderr, ">>> reading %s -> %ld diag=%d\n", + et8->CS_et8_index_fnm, rc, gg_diagnose); +#endif + + if (rc == -1L) + { + et8->CS_et8_error_flag= 3; + return -1; + } + lut= et8->CS_et8_lut; + } + + if (lookup_char (lut, entity, &info, &lng) != LOOKUP_found) return -1; + + return (int) info; +} diff --git a/lib/ds/codes/cs106.o b/lib/ds/codes/cs106.o new file mode 100644 index 0000000000000000000000000000000000000000..a47fa1b1560e04ee7646f7af47f65d27429e4cbf Binary files /dev/null and b/lib/ds/codes/cs106.o differ diff --git a/lib/ds/codes/cs107.c b/lib/ds/codes/cs107.c new file mode 100644 index 0000000000000000000000000000000000000000..696755c361951244e9495ff9ecb826fffc12eebe --- /dev/null +++ b/lib/ds/codes/cs107.c @@ -0,0 +1,37 @@ +/* + * File %dpp/codes/cs107.c + * + * CS_ET8: entity translation functions + * + * written: 1995-12-10: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +long cs_et8_fputc (struct CS_ET8 *et8, int ch, FILE *fo) +{ + char *entity_name; + + if ((ch >= 0x80 && ch <= 0xFF) + ||(ch >= 0x00 && ch <= 0x09) + ||(ch >= 0x0B && ch <= 0x0C) + ||(ch >= 0x0E && ch <= 0x1F) + ) + { + if ((entity_name= cs_et8_code2entity (et8, ch)) != (char *) 0) + { + fputc ('&', fo); + fputs (entity_name, fo); + fputc (';', fo); + return (long) (strlen (entity_name) + 2); + } + } + + fputc (ch, fo); + return 1L; +} diff --git a/lib/ds/codes/cs107.o b/lib/ds/codes/cs107.o new file mode 100644 index 0000000000000000000000000000000000000000..6d5bdea600ccd781d9b6633ef44e115b78d80b73 Binary files /dev/null and b/lib/ds/codes/cs107.o differ diff --git a/lib/ds/codes/cs108.c b/lib/ds/codes/cs108.c new file mode 100644 index 0000000000000000000000000000000000000000..44e25a2e6fadb279717da08cd540cc683c37890d --- /dev/null +++ b/lib/ds/codes/cs108.c @@ -0,0 +1,25 @@ +/* + * File %dpp/codes/cs108.c + * + * CS_ET8: entity translation functions + * + * written: 1995-12-10: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdio.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +long cs_et8_fputs (struct CS_ET8 *et8, char *str, FILE *fo) +{ + int ch; + long siz= 0L; + + if (str == (char *) 0) return -1; + + while (ch= (*str++) & 0x00FF) siz += cs_et8_fputc (et8, ch, fo); + + return siz; +} diff --git a/lib/ds/codes/cs108.o b/lib/ds/codes/cs108.o new file mode 100644 index 0000000000000000000000000000000000000000..dc5c9fc3edd2f77397a5e52c96cd939188cc7c38 Binary files /dev/null and b/lib/ds/codes/cs108.o differ diff --git a/lib/ds/codes/cs109.c b/lib/ds/codes/cs109.c new file mode 100644 index 0000000000000000000000000000000000000000..3c01241ae5d5cfd9d9f378ae162d05b7a57308c2 --- /dev/null +++ b/lib/ds/codes/cs109.c @@ -0,0 +1,30 @@ +/* + * File %dpp/codes/cs109.c + * + * CS_ET8: entity translation functions + * + * written: 1995-12-10: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdio.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +long cs_et8_ftransfer (struct CS_ET8 *et8, FILE *fi, FILE *fo, long cpy_size) +{ + int ch; + long fsiz= 0L; + + if (fi == (FILE *) 0 || fo == (FILE *) 0) return -1L; + + for (; cpy_size > 0L; cpy_size--) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + fsiz += cs_et8_fputc (et8, ch, fo); + } + + return fsiz; +} diff --git a/lib/ds/codes/cs109.o b/lib/ds/codes/cs109.o new file mode 100644 index 0000000000000000000000000000000000000000..528dc18fccb45e8f6ae27b082bc51e38244c42dd Binary files /dev/null and b/lib/ds/codes/cs109.o differ diff --git a/lib/ds/codes/cs110.c b/lib/ds/codes/cs110.c new file mode 100644 index 0000000000000000000000000000000000000000..e3e90031d48ea677a1920d8bac73bcb381eefd1c --- /dev/null +++ b/lib/ds/codes/cs110.c @@ -0,0 +1,37 @@ +/* + * File %dpp/codes/cs110.c + * + * CS_ET8: entity translation functions + * + * written: 1995-12-10: g.gonter@ieee.org + * latest update: 1997-10-24 12:09:48 + * + */ + +#include <stdio.h> +#include <gg/fileio.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +long cs_et8_encode ( +struct CS_ET8 *et8, +char *fni, +char *fno, +long cpy_size) +{ + FILE *fi; + FILE *fo; + int fi_opened= 0; + int fo_opened= 0; + long fsiz= 0L; + + FXOPEN (fni, fi, stdin, "rb", fi_opened); + FXOPEN (fno, fo, stdout, "wb", fo_opened); + + fsiz= cs_et8_ftransfer (et8, fi, fo, cpy_size); + + FXCLOSE (fi, fi_opened); + FXCLOSE (fo, fo_opened); + + return 0; +} diff --git a/lib/ds/codes/cs110.o b/lib/ds/codes/cs110.o new file mode 100644 index 0000000000000000000000000000000000000000..5da641ed2afd00af933002b602b298b6b96c43d4 Binary files /dev/null and b/lib/ds/codes/cs110.o differ diff --git a/lib/ds/codes/cs201.c b/lib/ds/codes/cs201.c new file mode 100644 index 0000000000000000000000000000000000000000..3e3c0d2f0f6e122aeadf6c4299a6f504008edde3 --- /dev/null +++ b/lib/ds/codes/cs201.c @@ -0,0 +1,34 @@ +/* + * File %dpp/codes/cs201.c + * + * written: 1992-12-30: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdio.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +long cs_convert_stream (FILE *fi, FILE *fo, long *table, long limit) +{ + long count= 0L; + int ch; + long tr; + + if (fi == (FILE *) 0 || fo == (FILE *) 0) return -1L; + + for (; limit > 0L; limit--) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + tr= table [ch]; + if (tr >= 0L && tr < 256L) + { + count++; + fputc ((int) tr, fo); + } + } + + return count; +} diff --git a/lib/ds/codes/cs201.o b/lib/ds/codes/cs201.o new file mode 100644 index 0000000000000000000000000000000000000000..73f4d07b95e43c7856e398644dd5507ca59a0442 Binary files /dev/null and b/lib/ds/codes/cs201.o differ diff --git a/lib/ds/codes/cs202.c b/lib/ds/codes/cs202.c new file mode 100644 index 0000000000000000000000000000000000000000..892191a007a9be6b1e5201284e0aba702c2d8c34 --- /dev/null +++ b/lib/ds/codes/cs202.c @@ -0,0 +1,56 @@ +/* + * File %dpp/codes/cs202.c + * + * written: 1992-12-25: g.gonter@ieee.org + * latest update: 1996-04-11 12:44:02 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/codes.h> + +#ifndef MSDOS +#include <unistd.h> +#endif + +static char *_tmpfile= "$$cs202$.$$"; + +/* ------------------------------------------------------------------------ */ +int cs_convert_file (char *fni, char *fno, long *table) +{ + FILE *fi; + FILE *fo; + int rv= 0; + + if (fni == (char *) 0 + || *fni == 0 + || table == (long *) 0 + ) return -1; + + if ((fi= fopen (fni, "rb")) == (FILE *) 0) return -1; + + if (strcmp (fno, "-") == 0) + fo= stdout; + else fo= fopen ((fno == (char *) 0 || *fno == 0) ? _tmpfile : fno, "wb"); + + if (fo == (FILE *) 0) + { + rv= -1; + goto ERR; + } + + cs_convert_stream (fi, fo, table, 0x7FFFFFF0); + + if (fo != stdout) fclose (fo); +ERR: + fclose (fi); + + if (rv == 0 && (fno == (char *) 0 || *fno == 0)) + { + unlink (fni); + rename (_tmpfile, fni); + } + + return rv; +} diff --git a/lib/ds/codes/cs202.o b/lib/ds/codes/cs202.o new file mode 100644 index 0000000000000000000000000000000000000000..30f0632335a1feb223f8c4257c02f70a669db038 Binary files /dev/null and b/lib/ds/codes/cs202.o differ diff --git a/lib/ds/codes/cs203.c b/lib/ds/codes/cs203.c new file mode 100644 index 0000000000000000000000000000000000000000..88fcc16467c75940a8179ab6ee5f92e89efcf12c --- /dev/null +++ b/lib/ds/codes/cs203.c @@ -0,0 +1,29 @@ +/* + * File %dpp/codes/cs203.c + * + * written: 1993-04-18: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +long cs_convert_string (char *str, long *table) +{ + long count= 0L; + long tr; + int ch; + + for (; (ch= (*str & 0x00FF)) != 0; str++) + { + tr= table [ch]; + if (tr >= 0L && tr < 256L) + { + count++; + *str= (char) tr; + } + } + + return count; +} diff --git a/lib/ds/codes/cs203.o b/lib/ds/codes/cs203.o new file mode 100644 index 0000000000000000000000000000000000000000..c687db10efd299207ca303fded9d10fdb3785776 Binary files /dev/null and b/lib/ds/codes/cs203.o differ diff --git a/lib/ds/codes/cs204.c b/lib/ds/codes/cs204.c new file mode 100644 index 0000000000000000000000000000000000000000..4972667cc0398da3eb3a0a1196063c0c92cb3dad --- /dev/null +++ b/lib/ds/codes/cs204.c @@ -0,0 +1,36 @@ +/* + * File %dpp/codes/cs204.c + * + * translate a string according to a character-to-string table + * + * written: 1993-06-11: g.gonter@ieee.org + * latest update: 1994-10-02 + * + */ + +#include <string.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +int cs_string_tlate ( +char *dst, +char *src, +int dst_siz, +struct CS_tlate_table *tt) +{ + int ch; + int l; + char *s; + + while ((ch= *src++ & 0x00FF) != (char) 0) + { + s= tt->CStt_table [ch]; + l= strlen (s); + if (l > dst_siz) return -1; + strcpy (dst, s); + dst= dst+l; + dst_siz -= l; + } + + return 0; +} diff --git a/lib/ds/codes/cs204.o b/lib/ds/codes/cs204.o new file mode 100644 index 0000000000000000000000000000000000000000..605e186da8bc7d02b180b52a48f9c29dfd06f533 Binary files /dev/null and b/lib/ds/codes/cs204.o differ diff --git a/lib/ds/codes/cs205.c b/lib/ds/codes/cs205.c new file mode 100644 index 0000000000000000000000000000000000000000..7f796ae562ac5f105aa32d724f1d866b80e6bbd7 --- /dev/null +++ b/lib/ds/codes/cs205.c @@ -0,0 +1,50 @@ +/* + * File %dpp/codes/cs205.c + * + * written: 1993-06-11: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +struct CS_tlate_table *cs_load_tlate_table (char *file_name, char *table_name) +{ +#define MAX_ENTITY 40 + char entity [MAX_ENTITY+1]; + struct CS_tlate_table *ttbl= (void *) 0; + FILE *fi; + int i, j, ch; + + if (file_name == (char *) 0 + || *file_name == 0 + || (fi= fopen (file_name, "rb")) == (FILE *) 0) + goto STOP; + + if ((ttbl= calloc (sizeof (struct CS_tlate_table), 1)) + == (void *) 0) goto ERR; + + ttbl->CStt_table_name= strdup (table_name); + ttbl->CStt_file_name= strdup (file_name); + + for (i= 0; i < 256; i++) + { + entity [MAX_ENTITY]= 0; + for (j= 0; j < MAX_ENTITY; j++) + { + ch= fgetc (fi) & 0x00FF; + entity[j]= (char) ch; + if (ch == 0x00) break; + } + ttbl->CStt_table [i]= strdup (entity); + } + +ERR: + fclose (fi); +STOP: + return ttbl; +} diff --git a/lib/ds/codes/cs205.o b/lib/ds/codes/cs205.o new file mode 100644 index 0000000000000000000000000000000000000000..79b578423e6eb57bacc9efd2735a6af5b219bf5e Binary files /dev/null and b/lib/ds/codes/cs205.o differ diff --git a/lib/ds/codes/cs206.c b/lib/ds/codes/cs206.c new file mode 100644 index 0000000000000000000000000000000000000000..048f7a4b07519a58826f6b3c9d12ccfa2b2e329b --- /dev/null +++ b/lib/ds/codes/cs206.c @@ -0,0 +1,51 @@ +/* + * File %dpp/codes/cs206.c + * + * written: 1993-06-12: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/codes.h> + +static char *XX = "------------------------------\n"; + +/* ------------------------------------------------------------------------ */ +int cs_print_tlate_table (FILE *fo, char *file_name, char *table_name) +{ +#define MAX_ENTITY 40 + char entity [MAX_ENTITY+1]; + FILE *fi; + int i, j, ch; + + if (file_name == (char *) 0 + || *file_name == 0 + || (fi= fopen (file_name, "rb")) == (FILE *) 0) + return -1; + + fprintf (fo, "file %s; translation table %s\n", file_name, table_name); + fprintf (fo, XX); + fprintf (fo, "code | entity\n"); + fprintf (fo, XX); + + for (i= 0; i < 256; i++) + { + entity [MAX_ENTITY]= 0; + for (j= 0; j < MAX_ENTITY; j++) + { + ch= fgetc (fi) & 0x00FF; + entity[j]= (char) ch; + if (ch == 0x00) break; + } + fprintf (fo, "0x%02X | %s\n", i, entity); + } + + fprintf (fo, XX); + + fclose (fi); + + return 0; +} diff --git a/lib/ds/codes/cs206.o b/lib/ds/codes/cs206.o new file mode 100644 index 0000000000000000000000000000000000000000..8f3cc871e0490bff97aa98ed7c72aab68eb1ccc1 Binary files /dev/null and b/lib/ds/codes/cs206.o differ diff --git a/lib/ds/codes/cs207.c b/lib/ds/codes/cs207.c new file mode 100644 index 0000000000000000000000000000000000000000..01c5264b551498ea9e080e0a94b02cd57ded5bb0 --- /dev/null +++ b/lib/ds/codes/cs207.c @@ -0,0 +1,30 @@ +/* + * File %dpp/codes/cs207.c + * + * written: 1993-04-18: g.gonter@ieee.org + * latest update: 1995-12-10 + * + */ + +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +long cs_convert_block (char *str, long size, long *table) +{ + long count= 0L; + long tr; + int ch; + + for (; size > 0L; str++, size--) + { + ch= *str & 0x00FF; + tr= table [ch]; + if (tr >= 0L && tr < 256L) + { + count++; + *str= (char) tr; + } + } + + return count; +} diff --git a/lib/ds/codes/cs207.o b/lib/ds/codes/cs207.o new file mode 100644 index 0000000000000000000000000000000000000000..e64160983938606cc99a76751b39b6d65b7c0ff0 Binary files /dev/null and b/lib/ds/codes/cs207.o differ diff --git a/lib/ds/codes/cst006.c b/lib/ds/codes/cst006.c new file mode 100644 index 0000000000000000000000000000000000000000..6fc6a5dceed5e8a1f201d84accb3d02f6ebdd96e --- /dev/null +++ b/lib/ds/codes/cst006.c @@ -0,0 +1,116 @@ +/* + * File %dpp/codes/cst006.c + * + * test module for cs006.c + * + * written: 1992-12-29: <Gerhard.Gonter@wu-wien.ac.at> + * latest update: 1995-12-10 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <gg/codes.h> + +/* ------------------------------------------------------------------------ */ +#ifdef TEST1 +#define JUNK_CNT 1 +static char *junk_list [JUNK_CNT] = { "junk" }; + +#define NONSENSE_CNT 1 +static char *nonsense_list [NONSENSE_CNT] = { "nonsense" }; + +#define EBCDIC_CNT 1 +static char *ebcdic_list [EBCDIC_CNT] = { "ebcdic" }; +#endif + +#define PC_CNT 2 +static char *pc_list [PC_CNT] = { "pc", "ascii" }; + +#define MAC_CNT 2 +static char *mac_list [MAC_CNT] = { "mac", "ascii" }; + +#define ENTITY_CNT 1 +static char *entity_list [ENTITY_CNT] = { "entity" }; + +/* ------------------------------------------------------------------------ */ +static long table[256]; +static struct CS_record *recs; + +#define N_MATCH_TABLE 1 +static char *MATCH_TABLE [N_MATCH_TABLE] = +{ + "*" +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv[]); +int cdecl test_table (char *src[], int sc, char *dst[], int dc, int ttype); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + argc= argv[0][0]; + + recs= cs_parse_code_table ("c:/etc/codes/table", MATCH_TABLE, + N_MATCH_TABLE, 1, 0, 10); + + if (recs == (struct CS_record *) 0) + { + printf ("error parsing table!\n"); + exit(0); + } + +#ifdef TEST1 + test_table (junk_list, JUNK_CNT, nonsense_list, NONSENSE_CNT, CSft_number); + test_table (junk_list, JUNK_CNT, junk_list, JUNK_CNT, CSft_number); + test_table (pc_list, PC_CNT, mac_list, MAC_CNT, CSft_number); + test_table (pc_list, 1, mac_list, 1 , CSft_number); + test_table (mac_list, MAC_CNT, pc_list, PC_CNT, CSft_number); +#endif /* TEST1 */ + + test_table (mac_list, 1, pc_list, 1 , CSft_number); + test_table (mac_list, MAC_CNT, entity_list, ENTITY_CNT, CSft_string); + +#ifdef TEST1 + test_table (pc_list, PC_CNT, ebcdic_list, EBCDIC_CNT, CSft_number); +#endif /* TEST1 */ + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int test_table (char *src[], int sc, char *dst[], int dc, int ttype) +{ + int rc; + int i; + + printf ("testing: ("); + for (i=0; i<sc; i++) printf (" %s", src[i]); + printf (" ) to ("); + for (i=0; i<dc; i++) printf (" %s", dst[i]); + printf (" ):\n"); + + rc= cs_records2table (recs, src, sc, dst, dc, ttype, table); + printf ("records2table: rc=%d\n", rc); + + if (ttype == CSft_number) + { + for (i= 0; i < 256; i++) + printf ("table[0x%02X]=0x%02lX%s\n", i, table[i], + ((table[i] == -1L) ? " <----" : "")); + } + else if (ttype == CSft_string) + { + for (i= 0; i < 256; i++) + printf ("table[0x%02X]=%s%s\n", i, + ((((char *) table[i]) == ((char *) 0)) ? "" : ((char *) table[i])), + ((((char *) table[i]) == ((char *) 0)) ? " <----" : "")); + } + else + { + fprintf (stderr, "invalid table type %d\n", ttype); + } + + return 0; +} diff --git a/lib/ds/codes/ebcdic.c b/lib/ds/codes/ebcdic.c new file mode 100644 index 0000000000000000000000000000000000000000..f9343c28642cd644d6430174cc92713f8c7462a3 --- /dev/null +++ b/lib/ds/codes/ebcdic.c @@ -0,0 +1,35 @@ +/* + * File ~/usr/dpp/codes/ebcdic.c + * + * written: 1992-12-25 + * latest update: 1994-04-03 + * + */ + +#include <stdio.h> +#include <gg/asc2ebc.inc> +#include <gg/ebc2asc.inc> + +/* ------------------------------------------------------------------------ */ +int main () +{ + int ascii; + int ebcdic; + int a2; + + for (ascii=0; ascii<256; ascii++) + { + ebcdic = CODE_ASCII_to_EBCDIC [ascii]; + if ((a2= CODE_EBCDIC_to_ASCII [ebcdic]) != ascii) + { + printf ("# warning: ascii 0x%02X -> ebcdic 0x%02X -> ascii 0x%02X\n", + ascii, ebcdic, a2); + } + else + { + printf ("ascii=0x%02X\tebcdic=0x%02X\n", ascii, ebcdic); + } + } + + return 0; +} diff --git a/lib/ds/codes/gg b/lib/ds/codes/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/codes/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/codes/lib b/lib/ds/codes/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/codes/libgg.a b/lib/ds/codes/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/codes/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/codes/make-dos b/lib/ds/codes/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..52dc15b7e59556282905316b0b130b88dc20d4ba --- /dev/null +++ b/lib/ds/codes/make-dos @@ -0,0 +1,55 @@ +# +# FILE %ds/codes/makefile +# +# written: 1992-12-25 +# latest update: 1996-02-24 11:38:20 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DPP_TEXT +lib=c:\usr\sbr\lsbr +o= +bin=c:\bin\ +nomap=\dev\nul + +all : all.l1 +all.bin : $(bin)codes.exe $(bin)codeconv.exe $(bin)codetbl.exe +all.ex0 : ebcdic.exe xmerge.exe + +all.l1 : cs001.obj cs002.obj cs003.obj cs004.obj ! + cs005.obj cs006.obj cs007.obj cs008.obj cs009.obj ! + cs010.obj cs011.obj cs012.obj ! + cs101.obj cs102.obj cs103.obj cs104.obj cs105.obj cs106.obj ! + cs107.obj cs108.obj cs109.obj cs110.obj ! + cs201.obj cs202.obj cs203.obj cs204.obj cs205.obj ! + cs206.obj cs207.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +# ---------------------------------------------------------------------------- +$(bin)codes.exe : codes.obj cs012.obj + link codes cs012,$@,$(nomap),$(lib)/NOI; + +# ---------------------------------------------------------------------------- +$(bin)codeconv.exe : codeconv.obj + link codeconv,$@,$(nomap),$(lib)/NOI; + +# ---------------------------------------------------------------------------- +$(bin)codetbl.exe : codetbl.obj + link codetbl,$@,$(nomap),$(lib)/NOI; + +# ---------------------------------------------------------------------------- +ebcdic.exe : ebcdic.obj + link ebcdic,$@,$(nomap); + +# ---------------------------------------------------------------------------- +xmerge.exe : xmerge.obj + link xmerge,$@,$(nomap); + +# ---------------------------------------------------------------------------- +cst006.exe : cst006.obj cs006.obj cs001.obj cs007.obj + link cst006 cs006 cs001 cs007,,$(nomap),$(lib); diff --git a/lib/ds/codes/xmerge.c b/lib/ds/codes/xmerge.c new file mode 100644 index 0000000000000000000000000000000000000000..948f39f69f6ec26d693d3773f266e14b55f22e04 --- /dev/null +++ b/lib/ds/codes/xmerge.c @@ -0,0 +1,148 @@ +/* + * FILE ~/usr/dpp/codes/xmerge.c + * + * merge two files + * + * written: 1993-01-01: <Gerhard.Gonter@wu-wien.ac.at> + * latest update: 1999-04-25 16:57:30 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define MAX_LINESIZE 78 + +/* ------------------------------------------------------------------------ */ +struct ATT +{ + struct ATT *ATT_next; + + char *ATT_match; + char *ATT_add; + int ATT_printed; +} ; + +/* ------------------------------------------------------------------------ */ +static struct ATT *attlist= (struct ATT *) 0; +static struct ATT **aatt= &attlist; + +#define L_SIZE 256 +static char l1 [L_SIZE]; +static char l2 [L_SIZE]; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv[]); +int cdecl read_attlist (char *fn); +int cdecl add_up (char *fn); +int cdecl new_ones (void); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + if (argc < 2) + { + fprintf (stderr, "error: to few parameters!\n"); + return 1; + } + + read_attlist (argv[1]); + add_up (argv[2]); + new_ones (); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int read_attlist (char *fn) +{ + FILE *fi; + struct ATT *natt; + + fi = fopen (fn, "r"); + if (fi == (FILE *) 0) + { + fprintf (stderr, "error: can't open '%s' for reading!\n", fn); + return -1; + } + + for (;;) + { + fscanf (fi, "%s%[^\n]", l1, l2); + if (feof (fi)) break; + fgetc (fi); + + if ((natt= (struct ATT *) calloc (sizeof (struct ATT), 1)) + == (struct ATT *) 0) + { + fprintf (stderr, "error: can't allocate memory!\n"); + return -1; + } + natt->ATT_match= strdup (l1); + natt->ATT_add= strdup (l2); + *aatt= natt; + aatt= &natt->ATT_next; + } + fclose (fi); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int add_up (char *fn) +{ + FILE *fi; + char *matchstr; + int matching; + struct ATT *xa; + + fi = fopen (fn, "r"); + if (fi == (FILE *) 0) + { + fprintf (stderr, "error: can't open '%s' for reading!\n", fn); + return -1; + } + + for (;;) + { + fscanf (fi, "%[^\n]", l1); + if (feof (fi)) break; + fgetc (fi); + + matching=0; + for (xa= attlist; xa != (struct ATT *) 0; xa= xa->ATT_next) + { + if ((matchstr= strstr (l1, xa->ATT_match)) != (char *) 0) + { + matching=1; + xa->ATT_printed=1; + break; + } + } + fputs (l1, stdout); + if (matching) + { + if (strlen (l1) + strlen (xa->ATT_add) > MAX_LINESIZE) + fputs ("\n ", stdout); + fputs (xa->ATT_add, stdout); + } + putchar ('\n'); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int new_ones () +{ + struct ATT *xa; + + for (xa= attlist; xa != (struct ATT *) 0; xa= xa->ATT_next) + if (xa->ATT_printed == 0) + { + printf ("#>>> %s%s\n", xa->ATT_match, xa->ATT_add); + } + + return 0; +} diff --git a/lib/ds/dbx/(dirinf).fm b/lib/ds/dbx/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..60ed5b56d7e61dd64d67dbc69e710971a0cec9e5 --- /dev/null +++ b/lib/ds/dbx/(dirinf).fm @@ -0,0 +1,19 @@ +# +# FILE %ds/dbx/(dirinf).fm +# +# written: 1996-11-26 +# latest update: 1996-11-26 17:38:59 +# + +# see also: <gg/dbx.h> and dbx +(dirinf).fm Contents +Makefile current version of Makefile +make-dos DOS version of Makefile +make-ux Unix version of Makefile + +dbx_0000.c TEMPLATE +dbx_0001.c dbx: new schema + +dbx_1001.c dbf: open dbf + +dbf.c DBF: test and dump diff --git a/lib/ds/dbx/Makefile b/lib/ds/dbx/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..8d72d6361611855311b85f9a5d932c4d7c2900cb --- /dev/null +++ b/lib/ds/dbx/Makefile @@ -0,0 +1,30 @@ +# +# FILE %ds/dbx/make-ux +# +# written: 1996-11-26 +# latest update: 1999-05-08 9:38:12 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + dbx_0001.o dbx_0002.o dbx_0003.o dbx_0004.o dbx_0005.o dbx_0006.o \ + dbx_0007.o dbx_0008.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib diff --git a/lib/ds/dbx/cntref.pl b/lib/ds/dbx/cntref.pl new file mode 100644 index 0000000000000000000000000000000000000000..2230b02ea391b48a0a15ba6111ed491ca4b21e0b --- /dev/null +++ b/lib/ds/dbx/cntref.pl @@ -0,0 +1,26 @@ +#!/usr/local/bin/perl +# FILE %ds/dbx/cntref.pl +# +# written: 1996-11-26 +# latest update: 1996-11-26 22:15:27 +# + +while (<>) +{ + chop; + s/\015//g; + + if (/<refnum>(\d+)/) + { + $refnum= $1; + $refnum= "0$refnum" if ($refnum < 10); + $refnum{$refnum}++; + } +} + +foreach $refnum (sort keys %refnum) +{ + $val= $refnum{$refnum}; + next unless ($val); + print "[$refnum] $val\n"; +} diff --git a/lib/ds/dbx/contrib b/lib/ds/dbx/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/dbx/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/dbx/dbf.c b/lib/ds/dbx/dbf.c new file mode 100644 index 0000000000000000000000000000000000000000..7ddd3c0b9ffe3b83f6d485cf6b73fc9a877e7abe --- /dev/null +++ b/lib/ds/dbx/dbf.c @@ -0,0 +1,279 @@ +/* + * FILE %usr/inc/temp.c + * + * template, standard command interpreter style + * - HELP + * - prototypes + * + * written: 1992 02 19 + * latest update: 1996-09-24 11:08:41 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/filename.h> +#include <gg/array.h> +#include <gg/wildcard.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/dbx.h> + +#define STDHLP stdout + +static char *dbf_class= (char *) 0; +static int output_mode= 0; + +/* ------------------------------------------------------------------------ */ +#define GPL +static char *HELP []= +{ + "USAGE: XXXX [options] {file name}\n", + "OPTIONS:\n", + " -f<fnm> ... list of files\n", + " -r ... subdirs\n", + " -v ... verbose mode\n", + "EXAMPLES:\n", + "\n", + "(@)AXXXX.c 0.02 #D$1996-08-11 16:54:16\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn, void *cd); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + char *arg; + int i, j; + int rc; + struct WCRD *wcrd; + struct ARRAY_CONTROL *arguments; +#define MAX_FILENM 66 + char filenm [MAX_FILENM]; + int verbose_mode= 0; + + if ((wcrd= wcrd2_new ()) == (struct WCRD *) 0 + || (arguments= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) return 1; + + wcrd2_set_processor (wcrd, WCRD_set_file_processor, main_fnc, (void *) 0); + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'f': case 'F': + if (arg [2] == 0) break; + array_push (arguments, (void *) arg); + break; + + case 'r': case 'R': + case 'v': case 'V': + for (j= 1; arg [j]; j++) + switch (arg [j]) + { + case 'r': case 'R': + wcrd2_set_subdirs (wcrd, 1); + break; + case 'v': case 'V': + verbose_mode++; + break; + default: + fprintf (stderr, "unknown option %c\n", arg[j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else array_push (arguments, (void *) arg); + } + + if (array_elements (arguments)) + { + while ((arg= (char *) array_shift (arguments)) != (char *) 0) + { + if (arg [0] == '-') + { + if ((fi2= fopen (arg+2, "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", arg+2); + break; + } + + for (;;) + { + rc= fread_line (fi2, filenm, MAX_FILENM); + if (rc <= 0 && feof (fi2)) break; + if (wcrd2_wildcards (wcrd, filenm) == -1) + { + fclose (fi2); + goto STOP; + } + } + fclose (fi2); + } + else + { + if (wcrd2_wildcards (wcrd, arg) == -1) goto STOP; + } + } + } + +STOP: + return 0; +} + +/* ------------------------------------------------------------------------ */ +int dbx_dbf_puts ( +FILE *fo, +struct DBX_FIELD_DESCRIPTOR *fdesc, +char *ptr) +{ + int i; + int s; + int ch; + int x= 0; + + s= fdesc->size; + for (i= 0; i < s; i++) + { + if ((ch= *ptr++ & 0x00FF) == 0) break; + + switch (x) + { + case 0: + if (ch != ' ' && ch != '\t') + { + x= 1; + fputc ('<', fo); + fputs (fdesc->name, fo); + fputc ('>', fo); + fputc (ch, fo); + } + break; + + case 1: + if (ch != ' ' && ch != '\t') + { + if (ch == ';') + { + x= 0; + fputc ('\n', fo); + } + else + fputc (ch, fo); + } + else + x= 2; + break; + + case 2: + if (ch != ' ' && ch != '\t') + { + fputc (' ', fo); + fputc (ch, fo); + x= 1; + } + } + } + + if (x) fputc ('\n', fo); + return fdesc->size; +} + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn, void * cd) +{ + struct DBX_FILE_DESCRIPTOR *dbx; + struct DBX_SCHEMA *schema; + FILE *fi; + char *buffer, *ptr; + int rec_siz; + int fld_cnt; + int i; + long num_rec= 0L; + +#ifdef MSDOS + cd; +#endif /* MSDOS */ + + printf ("dbf: fnm='%s'\n", fn); + + if ((dbx= dbx_open_dbf (fn, dbf_class)) == (struct DBX_FILE_DESCRIPTOR *) 0 + || (fi= (FILE *) dbx->fi1) == (FILE *) 0 + || (schema= dbx->schema) == (struct DBX_SCHEMA *) 0 + ) + return -1; + + printf ("dbf: header read; header_size=%ld record_size=%ld\n", + dbx->header_size, dbx->record_size); + + if (dbx->record_size >= 0x00010000L) + { + fprintf (stderr, "can't handle buffers with a size of %ld bytes!\n", + dbx->record_size); + return -1; + } + + rec_siz= (int) dbx->record_size; + fld_cnt= (int) schema->n_fields; + +printf ("rec_siz=%d fld_cnt=%d\n", rec_siz, fld_cnt); + + if ((buffer= malloc (rec_siz)) == (char *) 0) + { + fprintf (stderr, "can't allocate buffer of %d bytes!\n", rec_siz); + return -1; + } + + fseek (fi, dbx->header_size, 0); + + for (i= 0; i < fld_cnt; i++) + { + to_lower (schema->fields[i]->name); + } + + for (num_rec= 0L;; num_rec++) + { + fread (buffer, 1, rec_siz, fi); + if (feof (fi)) break; + + switch (output_mode) + { + default: + fputs ("<rec>\n", stdout); + ptr= buffer; + for (i= 0; i < fld_cnt; i++) + { + /*** if (i != 0) fputs ("<>", stdout); ***/ + ptr += dbx_dbf_puts (stdout, schema->fields [i], ptr); + /*** fputc ('\n', stdout); ***/ + } + fputs ("</rec>\n", stdout); + break; + } + } + + printf ("%ld records processed!\n", num_rec); + + fclose (fi); + dbx->fi1= (void *) 0; + + /* T2D: free complete dbx file descriptor!! */ + + return 0; +} diff --git a/lib/ds/dbx/dbx_0000.c b/lib/ds/dbx/dbx_0000.c new file mode 100644 index 0000000000000000000000000000000000000000..e210bce3e500867f898f1e3a9bcc7fb10aa1403d --- /dev/null +++ b/lib/ds/dbx/dbx_0000.c @@ -0,0 +1,17 @@ +/* + * FILE %ds/dbx/dbx_0000.c + * + * database processing + * + * written: 1996-11-26 + * latest update: 1996-11-26 17:53:44 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dbx.h> + +/* ------------------------------------------------------------------------ */ diff --git a/lib/ds/dbx/dbx_0001.c b/lib/ds/dbx/dbx_0001.c new file mode 100644 index 0000000000000000000000000000000000000000..96ac6a1de31136c6590ce7584dd3c6594fb6f6c4 --- /dev/null +++ b/lib/ds/dbx/dbx_0001.c @@ -0,0 +1,40 @@ +/* + * FILE %ds/dbx/dbx_0001.c + * + * database processing + * + * written: 1996-11-26 + * latest update: 1996-11-26 17:53:44 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/dbx.h> + +/* ------------------------------------------------------------------------ */ +struct DBX_SCHEMA *dbx_new_schema ( +int n_fields, +char *name) +{ + struct DBX_SCHEMA *schema; + int size; + + size= sizeof (struct DBX_SCHEMA) + + (n_fields-2)*(sizeof (struct DBX_FIELD_DESCRIPTOR *)); + +printf (">> schema: n_fields=%d size=%d\n", n_fields, size); + + if ((schema= (struct DBX_SCHEMA *) calloc (size, 1)) + != (struct DBX_SCHEMA *) 0) + { + schema->n_fields= n_fields; + schema->name= (name == (char *) 0) ? (char *) 0 : strdup (name); + } + + return schema; +} diff --git a/lib/ds/dbx/dbx_1001.c b/lib/ds/dbx/dbx_1001.c new file mode 100644 index 0000000000000000000000000000000000000000..3946a5ebf6e02b442ddf6da6cb2e82673f39b4e1 --- /dev/null +++ b/lib/ds/dbx/dbx_1001.c @@ -0,0 +1,108 @@ +/* + * FILE %ds/dbx/dbx_1001.c + * + * database processing: open a DBF file + * + * Machine Specifics: Only for MSDOS! + * + * written: 1996-11-26 + * latest update: 1996-11-26 17:53:44 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/dirty.h> +#include <gg/dpp.h> +#include <gg/dbx.h> + +#define DEBUG + +/* ------------------------------------------------------------------------ */ +struct DBX_FILE_DESCRIPTOR *dbx_open_dbf (char *fnm, char *name) +{ + FILE *fi; + struct DBX_FILE_DESCRIPTOR *dbxf; + struct DBX_SCHEMA *schema; + struct DBX_FIELD_DESCRIPTOR *dbx_fdesc; + char pfx [DBX_DBF_PFX_SIZE]; + char dbf_fdesc [DBX_DBF_FDESC_SIZE]; + int hdr_size; + int fld_cnt; + int i, ch; + + if ((fi= fopen (fnm, "rb")) == (FILE *) 0) + { + fprintf (stderr, "dbx/dbf: cant read '%s'\n", fnm); + return (struct DBX_FILE_DESCRIPTOR *) 0; + } + + if ((dbxf= dbx_new_file_descriptor()) == (struct DBX_FILE_DESCRIPTOR *) 0) + { +NO_MEM: + fclose (fi); + fprintf (stderr, "dbx/dbf: no memory\n", fnm); + return (struct DBX_FILE_DESCRIPTOR *) 0; + } + + dbxf->fi1= (void *) fi; + + fread (pfx, 1, DBX_DBF_PFX_SIZE, fi); + + hdr_size= msdos_get_int (pfx + DBX_DBF_off_hdr_size); + dbxf->header_size= (long) (hdr_size+1); + dbxf->record_size= (long) msdos_get_int (pfx + DBX_DBF_off_rec_size); + dbxf->is_fixed_record_size= 1; + fld_cnt= hdr_size / 32 - 1; + +#ifdef DEBUG + printf (">> hdr_size= %d n_rec= %d\n", hdr_size, fld_cnt); + dump (stdout, pfx, DBX_DBF_PFX_SIZE); +#endif /* DEBUG */ + + schema= dbx_new_schema (fld_cnt, name); + dbxf->schema= schema; + + for (i= 0; i < fld_cnt; i++) + { + fread (dbf_fdesc, 1, DBX_DBF_FDESC_SIZE, fi); + + if ((dbx_fdesc= dbx_new_field_descriptor()) + == (struct DBX_FIELD_DESCRIPTOR *) 0) goto NO_MEM; + + schema->fields [i]= dbx_fdesc; + dbx_fdesc->size= msdos_get_int (dbf_fdesc + DBX_DBF_off_fld_size); + dbx_fdesc->name= strdup_max (dbf_fdesc, DBX_DBF_NAME_SIZE); + + switch (ch= dbf_fdesc [DBX_DBF_off_fld_type]) + { + case 'C': + dbx_fdesc->type= DBX_Fty_long; + break; + case 'N': + dbx_fdesc->type= DBX_Fty_string; + break; + default: + printf ("dbx/dbf: unknown field type '%c' (0x%02X)\n", ch, ch); + break; + } + + /**** T2D: all data elements are strings! *****/ + dbx_fdesc->type= DBX_Fty_string; + +#ifdef DEBUG + printf (">> field [%d]; name='%s' size=%d type=%c\n", + i, dbx_fdesc->name, dbx_fdesc->size, + dbf_fdesc [DBX_DBF_off_fld_type]); + dump (stdout, dbf_fdesc, DBX_DBF_FDESC_SIZE); +#endif /* DEBUG */ + } + +printf (">> return dbxf\n"); + return dbxf; +} diff --git a/lib/ds/dbx/gg b/lib/ds/dbx/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/dbx/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/dbx/libgg.a b/lib/ds/dbx/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/dbx/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/dbx/make-dos b/lib/ds/dbx/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..b33d1dec524fdaf26ffec2d81d23f640e733e391 --- /dev/null +++ b/lib/ds/dbx/make-dos @@ -0,0 +1,29 @@ +# +# FILE %ds/dbx/make-dos +# +# manipulation of database elements +# +# written: 1996-11-26 +# latest update: 1996-11-26 17:39:49 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all : all.exe + +all.2 : ! + dbx_0001.obj dbx_1001.obj + +all.exe : dbf.exe + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +dbf.exe : dbf.obj dbx_0001.obj dbx_1001.obj + link dbf dbx_0001 dbx_1001,$@,,$(lib); + diff --git a/lib/ds/dyb/(dirinf).fm b/lib/ds/dyb/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..0149306123c09ce624b4e7bb60d0bf492243ffa7 --- /dev/null +++ b/lib/ds/dyb/(dirinf).fm @@ -0,0 +1,23 @@ +# +# FILE %ds/dyb/(dirinf).fm +# +# written: 1995-08-19 +# latest update: 1995-12-29 +# +# ---------------------------------------------------------------------------- +(dirinf).fm Contents +makefile DOS version of Makefile +make-ux Unix version of Makefile + +dyb_0001.c struct DYB_SEGMENT *dyb_new_segment (void) +dyb_0002.c struct DYNAMIC_BLOCK *dyb_new_block (void) +dyb_0003.c int dyb_append_block (struct DYNAMIC_BLOCK *dyb, block, ...) +dyb_0004.c int dyb_append_string (struct DYNAMIC_BLOCK *dyb, string) +dyb_0005.c int dyb_destroy_block (struct DYNAMIC_BLOCK *dyb); +dyb_0006.c int dyb_reference (struct DYNAMIC_BLOCK *dyb); +dyb_0007.c long dyb_truncate (struct DYNAMIC_BLOCK *dyb, long size); +dyb_0008.c int dyb_encrypt_ecb (struct GG_CRYPT *ggc, struct DYNAMIC_BLOCK *dyb); +dyb_0008.c int dyb_encrypt_cfb (struct GG_CRYPT *ggc, struct DYNAMIC_BLOCK *dyb); +dyb_0010.c int dyb_write (int fd, struct DYNAMIC_BLOCK *dyb) +dyb_0011.c int dyb_append_blanks (struct DYNAMIC_BLOCK *dyb, long num_blanks); + diff --git a/lib/ds/dyb/Makefile b/lib/ds/dyb/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..47b29211050ec2d88cb3ec714bd4916523ea33a9 --- /dev/null +++ b/lib/ds/dyb/Makefile @@ -0,0 +1,36 @@ +# +# FILE %ds/dyb/make-ux +# +# written: 1995-12-20 +# latest update: 1999-05-08 9:38:31 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + dyb_0001.o dyb_0002.o dyb_0003.o dyb_0004.o dyb_0005.o dyb_0006.o \ + dyb_0007.o dyb_0008.o dyb_0009.o dyb_0010.o dyb_0011.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $? + +dyb_0008.o : dyb_0008.c + $(CC) $(OPTS) -DMODE_ECB -o $@ -c dyb_0008.c + +dyb_0009.o : dyb_0008.c + $(CC) $(OPTS) -DMODE_CFB -o $@ -c dyb_0008.c diff --git a/lib/ds/dyb/contrib b/lib/ds/dyb/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/dyb/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/dyb/dyb_0000.c b/lib/ds/dyb/dyb_0000.c new file mode 100644 index 0000000000000000000000000000000000000000..53df735759e61b4d39da776bcae7c5c77838d0f3 --- /dev/null +++ b/lib/ds/dyb/dyb_0000.c @@ -0,0 +1,19 @@ +/* + * FILE %ds/dyb/dyb_0000.c + * + * manipulation of dynamic blocks + * + * written: 1995-08-19 + * latest update: 1995-08-19 + * + */ + +#include <gg/dyb.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ + + diff --git a/lib/ds/dyb/dyb_0001.c b/lib/ds/dyb/dyb_0001.c new file mode 100644 index 0000000000000000000000000000000000000000..4e793cb1ed2efc411079ba3ccc297ce4c7bfe842 --- /dev/null +++ b/lib/ds/dyb/dyb_0001.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/dyb/dyb_0001.c + * + * manipulation of dynamic blocks + * + * written: 1995-08-19 + * latest update: 1995-08-26 + * + */ + +#include <stdlib.h> +#include <gg/dyb.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +struct DYB_SEGMENT *dyb_new_segment (int segment_size) +{ + struct DYB_SEGMENT *ds; + + if (segment_size <= 0) segment_size= DYB_SEGMENT_SIZE; + + if ((ds= (struct DYB_SEGMENT *) + calloc (sizeof (struct DYB_SEGMENT) + segment_size, 1)) + != (struct DYB_SEGMENT *) 0) + { + ds->DYBS_size= ds->DYBS_free= segment_size; + ds->DYBS_append= ds->DYBS_block; + } + + return ds; +} diff --git a/lib/ds/dyb/dyb_0001.o b/lib/ds/dyb/dyb_0001.o new file mode 100644 index 0000000000000000000000000000000000000000..7978dd2814df68fa1d744082f126542652fa90e0 Binary files /dev/null and b/lib/ds/dyb/dyb_0001.o differ diff --git a/lib/ds/dyb/dyb_0002.c b/lib/ds/dyb/dyb_0002.c new file mode 100644 index 0000000000000000000000000000000000000000..2330dc11e2e5c4732b0ce44e1da3bd5cde022614 --- /dev/null +++ b/lib/ds/dyb/dyb_0002.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/dyb/dyb_0002.c + * + * manipulation of dynamic blocks + * + * written: 1995-08-19 + * latest update: 1995-12-16 + * + */ + +#include <stdlib.h> +#include <gg/dyb.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +struct DYNAMIC_BLOCK *dyb_new_block (int segment_size) +{ + struct DYNAMIC_BLOCK *dyb; + + if (segment_size <= 0) segment_size= 256; + + if ((dyb= (struct DYNAMIC_BLOCK *) + calloc (sizeof (struct DYNAMIC_BLOCK), 1)) + != (struct DYNAMIC_BLOCK *) 0) + { + dyb->DYB_reference_counter= 1L; + dyb->DYB_segment_size= segment_size; + dyb->DYB_append= &dyb->DYB_begin; + } + + return dyb; +} diff --git a/lib/ds/dyb/dyb_0002.o b/lib/ds/dyb/dyb_0002.o new file mode 100644 index 0000000000000000000000000000000000000000..8d39184c87adc4c62e72556dd31810c0dd895f07 Binary files /dev/null and b/lib/ds/dyb/dyb_0002.o differ diff --git a/lib/ds/dyb/dyb_0003.c b/lib/ds/dyb/dyb_0003.c new file mode 100644 index 0000000000000000000000000000000000000000..0b426ee7342fe24a57c450f86c7ab593a96ccc69 --- /dev/null +++ b/lib/ds/dyb/dyb_0003.c @@ -0,0 +1,61 @@ +/* + * FILE %ds/dyb/dyb_0003.c + * + * manipulation of dynamic blocks + * + * written: 1995-08-19 + * latest update: 1995-08-26 + * + */ + +#include <memory.h> +#include <gg/dyb.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int dyb_append_block ( +struct DYNAMIC_BLOCK *dyb, +char *block, +long block_size) +{ + struct DYB_SEGMENT *ds; + long fr; + long cps; + + if (dyb == (struct DYNAMIC_BLOCK *) 0 + || block == (char *) 0) return -1; + + while (block_size > 0L) + { + if ((ds= dyb->DYB_last) == (struct DYB_SEGMENT *) 0 + || (fr= ds->DYBS_free) == 0L) + { + if ((ds= dyb_new_segment (dyb->DYB_segment_size)) + == (struct DYB_SEGMENT *) 0) return -1; + + *dyb->DYB_append= ds; + dyb->DYB_append= &ds->DYBS_next; + dyb->DYB_last= ds; + if (dyb->DYB_begin == (struct DYB_SEGMENT *) 0) + dyb->DYB_begin= ds; + + fr= ds->DYBS_free; + } + + /* ds now points to the last dynamic block segment */ + /* with space for fr (at least one) character... */ + cps= (block_size > fr) ? fr : block_size; + memcpy ((char *) ds->DYBS_append, (char *) block, (int) cps); + + block_size -= cps; + ds->DYBS_free -= cps; + ds->DYBS_append += cps; + dyb->DYB_total_size += cps; + } + + + return 0; +} diff --git a/lib/ds/dyb/dyb_0003.o b/lib/ds/dyb/dyb_0003.o new file mode 100644 index 0000000000000000000000000000000000000000..ec1c89f3884495c139ee18528e1ae9a838922c8f Binary files /dev/null and b/lib/ds/dyb/dyb_0003.o differ diff --git a/lib/ds/dyb/dyb_0004.c b/lib/ds/dyb/dyb_0004.c new file mode 100644 index 0000000000000000000000000000000000000000..5f9a1165cfb9adc8867661cc142b4229b1aebe7d --- /dev/null +++ b/lib/ds/dyb/dyb_0004.c @@ -0,0 +1,27 @@ +/* + * FILE %ds/dyb/dyb_0004.c + * + * manipulation of dynamic blocks + * + * written: 1995-08-19 + * latest update: 1995-08-26 + * + */ + +#include <string.h> +#include <gg/dyb.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int dyb_append_string ( +struct DYNAMIC_BLOCK *dyb, +char *string) +{ + if (dyb == (struct DYNAMIC_BLOCK *) 0 + || string == (char *) 0) return -1; + + return dyb_append_block (dyb, string, (long) strlen (string)); +} diff --git a/lib/ds/dyb/dyb_0004.o b/lib/ds/dyb/dyb_0004.o new file mode 100644 index 0000000000000000000000000000000000000000..52a5bca9e72faf461692408d085c43958fc40344 Binary files /dev/null and b/lib/ds/dyb/dyb_0004.o differ diff --git a/lib/ds/dyb/dyb_0005.c b/lib/ds/dyb/dyb_0005.c new file mode 100644 index 0000000000000000000000000000000000000000..eb31c5390edd31d1766f19d54a7d94cc2b39adc0 --- /dev/null +++ b/lib/ds/dyb/dyb_0005.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/dyb/dyb_0005.c + * + * manipulation of dynamic blocks + * + * written: 1995-08-19 + * latest update: 1997-06-16 18:34:02 + * + */ + +#include <stdlib.h> +#include <gg/dyb.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int dyb_destroy_block (struct DYNAMIC_BLOCK *dyb) +{ + struct DYB_SEGMENT *ds; + struct DYB_SEGMENT *ds2; + + if (dyb == (struct DYNAMIC_BLOCK *) 0 + || --dyb->DYB_reference_counter > 0) return 0; + + for (ds= dyb->DYB_begin; + ds != (struct DYB_SEGMENT *) 0; + ds= ds2) + { + ds2= ds->DYBS_next; + free (ds); + } + + free (dyb); + + return 0; +} diff --git a/lib/ds/dyb/dyb_0005.o b/lib/ds/dyb/dyb_0005.o new file mode 100644 index 0000000000000000000000000000000000000000..dec33184daaf2192dc9f08b4c4910b7229f8bc5e Binary files /dev/null and b/lib/ds/dyb/dyb_0005.o differ diff --git a/lib/ds/dyb/dyb_0006.c b/lib/ds/dyb/dyb_0006.c new file mode 100644 index 0000000000000000000000000000000000000000..56808e9cd59d722238132c4058995f5c2b333883 --- /dev/null +++ b/lib/ds/dyb/dyb_0006.c @@ -0,0 +1,26 @@ +/* + * FILE ~/usr/ds/dyb/dyb_0006.c + * + * manipulation of dynamic blocks: + * increment reference counter for a block + * + * written: 1995-08-19 + * latest update: 1995-08-19 + * + */ + +#include <gg/dyb.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int dyb_reference (struct DYNAMIC_BLOCK *dyb) +{ + if (dyb == (struct DYNAMIC_BLOCK *) 0) return -1; + + dyb->DYB_reference_counter++; + + return 0; +} diff --git a/lib/ds/dyb/dyb_0006.o b/lib/ds/dyb/dyb_0006.o new file mode 100644 index 0000000000000000000000000000000000000000..44c1a3d3ec45626ea62a8696cbf7d8d3ffa33ee0 Binary files /dev/null and b/lib/ds/dyb/dyb_0006.o differ diff --git a/lib/ds/dyb/dyb_0007.c b/lib/ds/dyb/dyb_0007.c new file mode 100644 index 0000000000000000000000000000000000000000..0ba231590053332f5efa8b218abad78ea4879b19 --- /dev/null +++ b/lib/ds/dyb/dyb_0007.c @@ -0,0 +1,57 @@ +/* + * FILE ~/usr/ds/dyb/dyb_0007.c + * + * manipulation of dynamic blocks: + * *** TEST @@@ TEST ### + * truncate a dynamic block at a certain position + * *** TEST @@@ TEST ### + * + * written: 1995-08-19 + * latest update: 1995-08-20 + * + */ + +#include <stdlib.h> +#include <gg/dyb.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long dyb_truncate (struct DYNAMIC_BLOCK *dyb, long size) +{ + struct DYB_SEGMENT *ds; + struct DYB_SEGMENT *ds2; + long s; + int cut_off= 0; + + if (dyb == (struct DYNAMIC_BLOCK *) 0) return -1L; + + for (ds= dyb->DYB_begin; + ds != (struct DYB_SEGMENT *) 0; + ds= ds2) + { + ds2= ds->DYBS_next; + + if (cut_off) + { + free (ds); + continue; + } + + s= ds->DYBS_size - ds->DYBS_free; + + if (size - s >= 0L) goto NEXT; + + cut_off= 1; + ds->DYBS_append= ds->DYBS_block + size; + ds->DYBS_free= ds->DYBS_size - size; + +NEXT: + size -= s; + dyb->DYB_total_size -= s; + } + + return (size > 0L) ? size : 0L; +} diff --git a/lib/ds/dyb/dyb_0007.o b/lib/ds/dyb/dyb_0007.o new file mode 100644 index 0000000000000000000000000000000000000000..b82390a98bc5176791b98a99786799e2396c7f29 Binary files /dev/null and b/lib/ds/dyb/dyb_0007.o differ diff --git a/lib/ds/dyb/dyb_0008.c b/lib/ds/dyb/dyb_0008.c new file mode 100644 index 0000000000000000000000000000000000000000..73d49fdb97ff9d5e476a03945a58a0fdcc992c20 --- /dev/null +++ b/lib/ds/dyb/dyb_0008.c @@ -0,0 +1,53 @@ +/* + * FILE %ds/dyb/dyb_0008.c + * + * manipulation of dynamic blocks: + * + * written: 1995-08-19 + * latest update: 1996-05-06 1:08:49 + * + */ + +#include <gg/ggcrypt.h> +#include <gg/dyb.h> + +#ifdef MODE_ECB +/* electronic coodebook mode */ +#define dyb_encrypt dyb_encrypt_ecb +#define ggc_block_encrypt ggc_block_ecb +#endif + +#ifdef MODE_CFB +/* cipher feedback mode */ +#define dyb_encrypt dyb_encrypt_cfb +#define ggc_block_encrypt ggc_block_cfb +#endif + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int dyb_encrypt ( +struct GG_CRYPT *ggc, +struct DYNAMIC_BLOCK *dyb) +{ + struct DYB_SEGMENT *ds; + + if (dyb == (struct DYNAMIC_BLOCK *) 0 + || ggc == (struct GG_CRYPT *) 0 + ) return -1; + + if (ggc->GGC_key == (char *) 0) return 0; /* no encryption, ok... */ + + for (ds= dyb->DYB_begin; + ds != (struct DYB_SEGMENT *) 0; + ds= ds->DYBS_next) + { + if (ggc_block_encrypt (ggc, ds->DYBS_block, + (int) (ds->DYBS_size - ds->DYBS_free)) != 0) + return -1; + } + + return 0; +} diff --git a/lib/ds/dyb/dyb_0008.o b/lib/ds/dyb/dyb_0008.o new file mode 100644 index 0000000000000000000000000000000000000000..6cd09735d932ef6094791e0b724168a91aa91d1a Binary files /dev/null and b/lib/ds/dyb/dyb_0008.o differ diff --git a/lib/ds/dyb/dyb_0009.o b/lib/ds/dyb/dyb_0009.o new file mode 100644 index 0000000000000000000000000000000000000000..631b7c9510b61f8c40f62759cc508df9bc5c23b7 Binary files /dev/null and b/lib/ds/dyb/dyb_0009.o differ diff --git a/lib/ds/dyb/dyb_0010.c b/lib/ds/dyb/dyb_0010.c new file mode 100644 index 0000000000000000000000000000000000000000..081caf70e3647f87f9cf6f5e347dc7acbb79505e --- /dev/null +++ b/lib/ds/dyb/dyb_0010.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/dyb/dyb_0010.c + * + * manipulation of dynamic blocks + * + * written: 1995-08-19 + * latest update: 1995-08-26 + * + */ + +#include <unistd.h> +#include <gg/dyb.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int dyb_write (int fd, struct DYNAMIC_BLOCK *dyb) +{ + struct DYB_SEGMENT *ds; + int s; + + if (fd < 0) return 0; + if (dyb == (struct DYNAMIC_BLOCK *) 0) return -1; + + for (ds= dyb->DYB_begin; + ds != (struct DYB_SEGMENT *) 0; + ds= ds->DYBS_next) + { + s= (int) (ds->DYBS_size - ds->DYBS_free); + + if (write (fd, ds->DYBS_block, s) != s) return -1; + } + + return 0; +} diff --git a/lib/ds/dyb/dyb_0010.o b/lib/ds/dyb/dyb_0010.o new file mode 100644 index 0000000000000000000000000000000000000000..eb2a04aa9b972bdccbec0d8dc196e1179213021d Binary files /dev/null and b/lib/ds/dyb/dyb_0010.o differ diff --git a/lib/ds/dyb/dyb_0011.c b/lib/ds/dyb/dyb_0011.c new file mode 100644 index 0000000000000000000000000000000000000000..92600dec9f843f98c245a732c0b405eba7992542 --- /dev/null +++ b/lib/ds/dyb/dyb_0011.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/dyb/dyb_0011.c + * + * manipulation of dynamic blocks + * + * written: 1995-08-19 + * latest update: 1995-08-19 + * + */ + +#include <string.h> +#include <gg/dyb.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ + /*0123456789*/ +static char _blanks []= " "; + +/* ------------------------------------------------------------------------ */ +int dyb_append_blanks ( +struct DYNAMIC_BLOCK *dyb, +long num_blanks) +{ + long s; + + if (dyb == (struct DYNAMIC_BLOCK *) 0) return -1; + + while (num_blanks > 0L) + { + s= (num_blanks > 10L) ? 10L : num_blanks; + num_blanks -= s; + dyb_append_block (dyb, _blanks, s); + } + + return 0; +} diff --git a/lib/ds/dyb/dyb_0011.o b/lib/ds/dyb/dyb_0011.o new file mode 100644 index 0000000000000000000000000000000000000000..057b662288c61f51e123fe0b59e5914a030f31cd Binary files /dev/null and b/lib/ds/dyb/dyb_0011.o differ diff --git a/lib/ds/dyb/gg b/lib/ds/dyb/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/dyb/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/dyb/lib b/lib/ds/dyb/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/dyb/libgg.a b/lib/ds/dyb/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/dyb/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/dyb/make-dos b/lib/ds/dyb/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..d0421dfd60803d33632526183202e871802fd43f --- /dev/null +++ b/lib/ds/dyb/make-dos @@ -0,0 +1,32 @@ +# +# FILE %ds/dyb/makefile +# +# manipulation of dynamic blocks +# +# written: 1995-08-19 +# latest update: 1995-12-20 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : ! + dyb_0001.obj dyb_0002.obj dyb_0003.obj dyb_0004.obj ! + dyb_0005.obj dyb_0006.obj dyb_0007.obj dyb_0008.obj ! + dyb_0009.obj dyb_0010.obj dyb_0011.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +dyb_0008.obj : dyb_0008.c + $(cml) -DMODE_ECB $? + $(obj) $@ + +dyb_0009.obj : dyb_0008.c + $(cml) -DMODE_CFB $? + $(obj) $@ + diff --git a/lib/ds/entity/(dirinf).fm b/lib/ds/entity/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..08aa2ba870c823fc6c36fd2d451d60cdb5b9d74f --- /dev/null +++ b/lib/ds/entity/(dirinf).fm @@ -0,0 +1,23 @@ +# +# FILE %ds/entity/(dirinf).fm +# +# written: 1996-06-09 +# latest update: 1996-06-09 11:17:22 +# + +# see also: <gg/entity.h> and entity +(dirinf).fm Contents +makefile DOS version of Makefile +make-ux Unix version of Makefile + +ent_0000.c TEMPLATE + +ent_0001.c create entity context +ent_0002.c destroy entity context + +ent_0003.c entity_find_by_name +ent_0004.c entity_find_by_code +ent_0005.c entity_register + + + diff --git a/lib/ds/entity/Makefile b/lib/ds/entity/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..d7e7c9c0d81c53d20ba604797577f51704957dcd --- /dev/null +++ b/lib/ds/entity/Makefile @@ -0,0 +1,30 @@ +# +# FILE %ds/entity/make-ux +# +# written: 1996-06-09 +# latest update: 1999-05-08 9:38:48 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + ent_0001.o ent_0002.o ent_0003.o ent_0004.o +# ent_0005.o ent_0006.o ent_0007.o ent_0008.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib diff --git a/lib/ds/entity/contrib b/lib/ds/entity/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/entity/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/entity/ent_0000.c b/lib/ds/entity/ent_0000.c new file mode 100644 index 0000000000000000000000000000000000000000..70a36690c03af9e856bf80b74e3ff84e970843a9 --- /dev/null +++ b/lib/ds/entity/ent_0000.c @@ -0,0 +1,20 @@ +/* + * FILE %ds/entity/ent_0000.c + * + * entity management + * + * written: 1996-06-09 + * latest update: 1996-06-09 11:22:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/entity.h> + +/* ------------------------------------------------------------------------ */ + + + diff --git a/lib/ds/entity/ent_0001.c b/lib/ds/entity/ent_0001.c new file mode 100644 index 0000000000000000000000000000000000000000..7a36b120c132223c4ba93964ab924d942f23601d --- /dev/null +++ b/lib/ds/entity/ent_0001.c @@ -0,0 +1,33 @@ +/* + * FILE %ds/entity/ent_0001.c + * + * entity management + * + * written: 1996-06-09 + * latest update: 1996-06-09 11:22:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/entity.h> + +/* ------------------------------------------------------------------------ */ +struct ENTITY_CONTEXT *entity_create_context (char *name) +{ + struct ENTITY_CONTEXT *ec= (struct ENTITY_CONTEXT *) 0; + + if ((ec= calloc (sizeof (struct ENTITY_CONTEXT), 1)) + != (struct ENTITY_CONTEXT *) 0 + ) + { + ec->edl_append= &ec->edl; + if (name != (char *) 0) ec->ec_name= strdup (name); + } + + return ec; +} diff --git a/lib/ds/entity/ent_0002.c b/lib/ds/entity/ent_0002.c new file mode 100644 index 0000000000000000000000000000000000000000..932871eb8d80f28d12f9f8bff0480990ac1fff03 --- /dev/null +++ b/lib/ds/entity/ent_0002.c @@ -0,0 +1,46 @@ +/* + * FILE %ds/entity/ent_0002.c + * + * entity management + * + * written: 1996-06-09 + * latest update: 1996-06-09 11:22:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/entity.h> + +/* ------------------------------------------------------------------------ */ +int entity_destroy_context (struct ENTITY_CONTEXT *ec) +{ + struct ENTITY_DESCRIPTOR_LIST *el, *el2; + struct ENTITY_DESCRIPTOR *ed; + + if (ec == (struct ENTITY_CONTEXT *) 0) return -1; + + for (el= ec->edl; el != (struct ENTITY_DESCRIPTOR_LIST *) 0; el= el2) + { + el2= el->next; + + if ((ed= el->ed) != (struct ENTITY_DESCRIPTOR *) 0) + { + free_or_what (ed->name); + free_or_what (ed->string); + free (ed); + } + + free (el); + } + + ytree_free (ec->ec_names); + ytree_free (ec->ec_codes); + free_or_what (ec->ec_name); + + return 0; +} diff --git a/lib/ds/entity/ent_0003.c b/lib/ds/entity/ent_0003.c new file mode 100644 index 0000000000000000000000000000000000000000..da3b660efd4d676ff9a2026a68e9fa928f9055eb --- /dev/null +++ b/lib/ds/entity/ent_0003.c @@ -0,0 +1,32 @@ +/* + * FILE %ds/entity/ent_0003.c + * + * entity management + * + * written: 1996-06-09 + * latest update: 1996-06-09 11:22:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/entity.h> + +/* ------------------------------------------------------------------------ */ +struct ENTITY_DESCRIPTOR *entity_find_by_name ( +struct ENTITY_CONTEXT *ctx, +char *name) +{ + struct ENTITY_DESCRIPTOR *ed= (struct ENTITY_DESCRIPTOR *) 0; + struct YTREE *yt; + + if (ctx != (struct ENTITY_CONTEXT *) 0 + && (yt= ytree_lookup_word (ctx->ec_names, name)) != (struct YTREE *) 0 + && (yt->YT_flags & YTflag_EOW) + ) + ed= (struct ENTITY_DESCRIPTOR *) yt->YT_info; + + return ed; +} diff --git a/lib/ds/entity/ent_0004.c b/lib/ds/entity/ent_0004.c new file mode 100644 index 0000000000000000000000000000000000000000..4b4b960707f20fca9172a339aa590a8f1c7a57f1 --- /dev/null +++ b/lib/ds/entity/ent_0004.c @@ -0,0 +1,46 @@ +/* + * FILE %ds/entity/ent_0004.c + * + * entity management + * + * written: 1996-06-09 + * latest update: 1996-06-09 11:22:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dpp.h> +#include <gg/entity.h> + +/* ------------------------------------------------------------------------ */ +struct ENTITY_DESCRIPTOR *entity_find_by_code ( +struct ENTITY_CONTEXT *ctx, +long code) +{ + struct ENTITY_DESCRIPTOR *ed= (struct ENTITY_DESCRIPTOR *) 0; + struct YTREE *yt; + char code_str [10]; + + if (ctx != (struct ENTITY_CONTEXT *) 0) + { + if (code >= 0L && code <= 0x00FFL) + { + ed= ctx->ec_tbl [(int) code]; + } + else + { + long_to_hex (code, code_str); + + if ((yt= ytree_lookup_word (ctx->ec_codes, code_str)) + != (struct YTREE *) 0 + && (yt->YT_flags & YTflag_EOW) + ) + ed= (struct ENTITY_DESCRIPTOR *) yt->YT_info; + } + } + + return ed; +} diff --git a/lib/ds/entity/ent_0005.c b/lib/ds/entity/ent_0005.c new file mode 100644 index 0000000000000000000000000000000000000000..70a36690c03af9e856bf80b74e3ff84e970843a9 --- /dev/null +++ b/lib/ds/entity/ent_0005.c @@ -0,0 +1,20 @@ +/* + * FILE %ds/entity/ent_0000.c + * + * entity management + * + * written: 1996-06-09 + * latest update: 1996-06-09 11:22:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/entity.h> + +/* ------------------------------------------------------------------------ */ + + + diff --git a/lib/ds/entity/gg b/lib/ds/entity/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/entity/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/entity/libgg.a b/lib/ds/entity/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/entity/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/entity/make-dos b/lib/ds/entity/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..8fe481aa4268c09f279bc93e02a8138ef53538dd --- /dev/null +++ b/lib/ds/entity/make-dos @@ -0,0 +1,22 @@ +# +# FILE %ds/entity/makefile +# +# manipulation of entities +# +# written: 1996-06-09 +# latest update: 1996-06-09 11:19:07 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : ! + ent_0001.obj ent_0002.obj ent_0003.obj ent_0004.obj +# ent_0005.obj ent_0006.obj ent_0007.obj ent_0008.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/ggcrypt/(dirinf).fm b/lib/ds/ggcrypt/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..44baa6bfebb0d23388bf91ca4e7e59bf873eaaf3 --- /dev/null +++ b/lib/ds/ggcrypt/(dirinf).fm @@ -0,0 +1,42 @@ +# +# FILE %ds/ggcrypt/(dirinf).fm +# +# written: 1995-12-29 +# latest update: 1997-10-09 4:29:05 +# $Id: (dirinf).fm,v 1.3 2007/12/02 11:58:07 gonter Exp $ +# + +# see also: <gg/url.h> and url +(dirinf).fm Contents +Makefile Unix version of Makefile + +ggcryp01.c int cdecl ggcrypt_very_simple (char *fn, ...) +ggcryp02.c int cdecl gg_encrypt (char *fn, ...) +ggcryp03.c int cdecl gg_decrypt (char *fn, ...) +ggcryp04.c garbling code (was %usr/inc/garbling.inc) +ggcryp05.c int ggcrypt_block (...); +ggcryp06.c int ggcrypt_string (...); +ggcryp07.c char *sec_generate_key (char *principal, ...) +ggcryp08.c char *agettok_get_resource_password (char *file_name, ...) +ggcryp09.c char *agettok_get_challenge (char *password_file, ...) +ggcryp10.c char *sca_get_sigfile (char *username); +ggcryp11.c char *sca_get_signature (char *username, char *password); +ggcryp12.c int sca_check_signature (char *sca_sig_file, char *sca_signature); +ggcryp13.c int ggc_block_ecb (struct GG_CRYPT *ggc, ...); +ggcryp13.c int ggc_block_cfb (struct GG_CRYPT *ggc, ...); +ggcryp14.c int ggc_set_session_key (struct GG_CRYPT *ggc, ...); +ggcryp15.c int ggc_file_ecb (struct GG_CRYPT *ggc, ...); +ggcryp15.c int ggc_file_cfb (struct GG_CRYPT *ggc, ...); +ggcryp16.c int ggc_set_key (struct GG_CRYPT *ggc, ...); +ggcryp17.c int ggc_dispose_key (struct GG_CRYPT *ggc); +ggcryp18.c int ggc_dispose_block (char **cp, int size); +ggcryp19.c int ggc_dispose (struct GG_CRYPT *ggc); +ggcryp20.c int ggc_stream_encrypt (struct GG_CRYPT *ggc, ...); +ggcryp21.c int ggc_stream_2encrypt (struct GG_CRYPT *ggc, ...); +ggcryp22.c int ggc_stream_2decrypt (struct GG_CRYPT *ggc, ...); +ggcryp23.c int ggc_pad (*ggc, FILE *fo, long size); +ggcryp24.c int ggc_file_2enc (struct GG_CRYPT *ggc, ...); +ggcryp25.c int ggc_file_2dec (struct GG_CRYPT *ggc, ...); +ggcryp26.c int ggc_wr_tag_block (struct GG_CRYPT *ggc, ...); +ggcryp27.c int ggc_pad_md5 (*ggc, *md5, FILE *fo, long size); + diff --git a/lib/ds/ggcrypt/Makefile b/lib/ds/ggcrypt/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..75d5bdf57986f86bbb0ebb3c64002de560b8c1a7 --- /dev/null +++ b/lib/ds/ggcrypt/Makefile @@ -0,0 +1,90 @@ +# +# FILE %ds/ggcrypt/make-ux +# +# written: 1995-12-29 +# latest update: 1999-05-08 9:38:53 +# $Id: Makefile,v 1.4 2007/12/02 11:58:07 gonter Exp $ +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -g +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + ggcryp02.o ggcryq02.o ggcryr02.o ggcryp04.o \ + ggcryp05.o ggcryp06.o ggcryp07.o ggcryp08.o \ + ggcryp09.o ggcryp10.o ggcryp11.o ggcryp12.o \ + ggcryp14.o ggcryp16.o ggcryp17.o ggcryp18.o ggcryp19.o \ + ggcryp21.o ggcryp22.o ggcryp24.o ggcryp25.o ggcryp26.o \ + ggcryp27.o + +LIBOBJS1= \ + ggcryp13.o ggcryq13.o ggcryp15.o ggcryq15.o ggcryp20.o ggcryq20.o \ + ggcryp23.o ggcryq23.o ggcryq27.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) $(LIBOBJS1) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib + +# simple encryption routines ------------------------------------------------- +cml=$(CC) $(OPTS) -o $@ -c + +ggcryp02.o : ggcryp02.c + $(cml) -DMODE_ENCRYPT ggcryp02.c + +ggcryq02.o : ggcryp02.c + $(cml) -DMODE_DECRYPT ggcryp02.c + +ggcryr02.o : ggcryp02.c + $(cml) -DMODE_SIMPLE ggcryp02.c + +ggcryp13.o : ggcryp13.c + $(cml) -DMODE_ECB ggcryp13.c + +ggcryq13.o : ggcryp13.c + $(cml) -DMODE_CFB ggcryp13.c + +ggcryp15.o : ggcryp15.c + $(cml) -DMODE_ECB ggcryp15.c + +ggcryq15.o : ggcryp15.c + $(cml) -DMODE_CFB ggcryp15.c + +ggcryp20.o : ggcryp20.c + $(cml) -DMODE_ECB ggcryp20.c + +ggcryq20.o : ggcryp20.c + $(cml) -DMODE_CFB ggcryp20.c + +ggcryp21.o : ggcryp21.c + $(cml) -DMODE_CFB ggcryp21.c + +ggcryp22.o : ggcryp22.c + $(cml) -DMODE_CFB ggcryp22.c + +ggcryp23.o : ggcryp23.c + $(cml) -DMODE_ECB ggcryp23.c + +ggcryq23.o : ggcryp23.c + $(cml) -DMODE_CFB ggcryp23.c + +ggcryp26.o : ggcryp26.c + $(cml) -DMODE_CFB ggcryp26.c + +ggcryp27.o : ggcryp27.c + $(cml) -DMODE_ECB ggcryp27.c + +ggcryq27.o : ggcryp27.c + $(cml) -DMODE_CFB ggcryp27.c diff --git a/lib/ds/ggcrypt/contrib b/lib/ds/ggcrypt/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/ggcrypt/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/ggcrypt/gg b/lib/ds/ggcrypt/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/ggcrypt/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/ggcrypt/ggcryp02.c b/lib/ds/ggcrypt/ggcryp02.c new file mode 100644 index 0000000000000000000000000000000000000000..8f57c68edf76423fddd2b3c5b06a51334a853ea2 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp02.c @@ -0,0 +1,98 @@ +/* + * FILE %sbr/ggcryp02.c + * + * simple file encryption algorithms + * + * written: 1990 08 25 + * 1994-09-18: extracted from %usr/utl/crypt.c + * latest update: 1995-08-15 + * + */ + +#include <stdio.h> +#include <gg/ggcrypt.h> + +#ifdef MODE_ENCRYPT +#define gg_xxx_crypt gg_encrypt +#endif /* MODE_ENCRYPT */ + +#ifdef MODE_DECRYPT +#define gg_xxx_crypt gg_decrypt +#endif /* MODE_DECRYPT */ + +#ifdef MODE_SIMPLE +#define gg_xxx_crypt ggcrypt_very_simple +#endif /* MODE_SIMPLE */ + +/* ------------------------------------------------------------------------ */ +int gg_xxx_crypt ( +char *fn, +#ifdef MODE_SIMPLE +char *crypt_code, +#endif /* MODE_SIMPLE */ +int crypt_length, +char *crypt_tmp, +char *buffer1, +char *buffer2, +int BUFFER_SIZE) +{ + FILE *fi, *fo; + int ch; + int crypt_idx= 0; + + if (crypt_length <= 0) + { + fprintf (stderr, "no encryption code specified for %s!\n", fn); + return -1; + } + + if ((fi= fopen (fn, "rb")) == (FILE *) 0) + { + fprintf (stderr, "can't read from file %s!\n", fn); + return -2; + } + + if ((fo= fopen (crypt_tmp, "wb")) == (FILE *) 0) + { + fprintf (stderr, "can't write to file %s!\n", crypt_tmp); + return -2; + } + + setvbuf (fi, buffer1, _IOFBF, BUFFER_SIZE); + setvbuf (fo, buffer2, _IOFBF, BUFFER_SIZE); + + for (;;) + { +#ifdef MODE_ENCRYPT + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + ggcrypt_fputc_code (ch, fo); +#endif /* MODE_ENCRYPT */ + +#ifdef MODE_DECRYPT + ch= ggcrypt_fgetc_code (fi) & 0x00FF; + if (feof (fi)) break; + fputc (ch, fo); +#endif /* MODE_DECRYPT */ + +#ifdef MODE_SIMPLE + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + ch ^= crypt_code [crypt_idx++]; + if (crypt_idx >= crypt_length) crypt_idx= 0; + fputc (ch, fo); +#endif /* MODE_SIMPLE */ + } + +#ifdef MODE_ENCRYPT + ggcrypt_flush_last (fo); +#endif /* MODE_ENCRYPT */ + + fclose (fi); + fclose (fo); + + unlink (fn); + rename (crypt_tmp, fn); + + return 0; +} diff --git a/lib/ds/ggcrypt/ggcryp02.o b/lib/ds/ggcrypt/ggcryp02.o new file mode 100644 index 0000000000000000000000000000000000000000..5e757bf7d81a08ca2ac1597ea394ac2313ab05a5 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp02.o differ diff --git a/lib/ds/ggcrypt/ggcryp04.c b/lib/ds/ggcrypt/ggcryp04.c new file mode 100644 index 0000000000000000000000000000000000000000..69dea491c73dbe8ad53d2cf11b4021c46a4c7139 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp04.c @@ -0,0 +1,100 @@ +/* + * FILE %ds/ggcrypt/ggcryp04.c + * + * written: 1990 08 25: as %usr/inc/garbling.inc + * 1994-09-18: reorganized to %sbr/ggcryp04.c + * latest update: 1995-08-15 + * $Id: ggcryp04.c,v 1.2 2007/12/02 11:58:08 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +static char G_CODE [30]; +static int G_PTR; +static int G_LAST= -1; /* last character run length encoded */ +static int G_CNT; /* run length counter */ + +/* ------------------------------------------------------------------------ */ +int ggcrypt_set_code (char *cp) +{ + G_CODE [0]= 0; + G_PTR= 0; + G_LAST= -1; + G_CNT= 0; + if (cp == (char *) 0 || *cp == 0) return -1; + strncpy (G_CODE, cp, 28); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ggcrypt_fputc_code (int c, FILE *f) +{ + if (!G_CODE [0]) return fputc (c, f); + if (G_LAST != c) + { + ggcrypt_flush_last (f); + G_LAST= c; + G_CNT= 1; + } + else G_CNT++; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ggcrypt_fgetc_code (FILE *f) +{ + int c; + + if (!G_CODE [0]) return fgetc (f) & 0x00FF; +RE_DO: + if (G_CNT > 0) + { + G_CNT--; + return G_LAST; + } + + c= ggcrypt_encode (fgetc (f) & 0x00FF); + if (c == 0x01) + { + G_LAST= ggcrypt_encode (fgetc (f) & 0x00FF); + G_CNT= ggcrypt_encode (fgetc (f) & 0x00FF); + goto RE_DO; + } + else return c; +} + +/* ------------------------------------------------------------------------ */ +int ggcrypt_flush_last (FILE *f) +{ + switch (G_LAST) + { + default: + if (G_CNT == 1) + { + fputc (ggcrypt_encode (G_LAST), f); + break; + } + case 1: + fputc (ggcrypt_encode (0x01), f); + fputc (ggcrypt_encode (G_LAST), f); + fputc (ggcrypt_encode (G_CNT), f); + case -1: + break; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ggcrypt_encode (int c) +{ + c= (c ^ (G_CODE [G_PTR++] & 0x00FF)) & 0x00FF; + if (G_CODE [G_PTR] == 0) G_PTR= 0; + return c; +} diff --git a/lib/ds/ggcrypt/ggcryp04.o b/lib/ds/ggcrypt/ggcryp04.o new file mode 100644 index 0000000000000000000000000000000000000000..51adeb95a376560838d545cda2daea7607259a8e Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp04.o differ diff --git a/lib/ds/ggcrypt/ggcryp05.c b/lib/ds/ggcrypt/ggcryp05.c new file mode 100644 index 0000000000000000000000000000000000000000..78bd07fc035dbf95d6bf05592e00e59195f6f89a --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp05.c @@ -0,0 +1,42 @@ +/* + * FILE ~/usr/sbr/ggcryp05.c + * + * written: 1994-10-23 + * latest update: 1995-04-27 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +int ggcrypt_block ( +unsigned char *block, +int block_lng, +unsigned char *key, +int key_lng) +{ + unsigned char *kp; + int kl; + + if (block == (unsigned char *) 0 || key == (unsigned char *) 0) return -1; + if (key_lng == 0) return 0; + + kp= key; + kl= key_lng; + + while (block_lng-- > 0) + { + *block= *block ^ *kp; + if (--kl == 0) + { + kp= key; + kl= key_lng; + } + block++; + kp++; + } + + return 0; +} diff --git a/lib/ds/ggcrypt/ggcryp05.o b/lib/ds/ggcrypt/ggcryp05.o new file mode 100644 index 0000000000000000000000000000000000000000..9871bef0334ae5ac205a6055ee3d393f20634ce9 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp05.o differ diff --git a/lib/ds/ggcrypt/ggcryp06.c b/lib/ds/ggcrypt/ggcryp06.c new file mode 100644 index 0000000000000000000000000000000000000000..c051bf7f679ed63a2f25a1b9c7aa5ec7ebfe1885 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp06.c @@ -0,0 +1,20 @@ +/* + * FILE %ds/ggcrypt/ggcryp06.c + * + * written: 1994-10-23 + * latest update: 1996-08-08 16:44:56 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +int ggcrypt_string ( +unsigned char *string, +unsigned char *key, +int key_lng) +{ + return ggcrypt_block (string, strlen ((char *) string), key, key_lng); +} diff --git a/lib/ds/ggcrypt/ggcryp06.o b/lib/ds/ggcrypt/ggcryp06.o new file mode 100644 index 0000000000000000000000000000000000000000..00a78b6742d33a94c2b72078e8c3a7607f5e9cda Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp06.o differ diff --git a/lib/ds/ggcrypt/ggcryp07.c b/lib/ds/ggcrypt/ggcryp07.c new file mode 100644 index 0000000000000000000000000000000000000000..f29c404dd2e23b6b30096131a2c9f1b01f6d8930 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp07.c @@ -0,0 +1,44 @@ +/* + * FILE %ds/ggcrypt/ggcryp07.c + * + * written: 1995-04-27 + * latest update: 1996-08-08 17:19:45 + * + */ + +#include <string.h> +#include <gg/dpp.h> +#include <gg/ggcrypt.h> +#include <contrib/global.h> +#include <contrib/md5.h> +#include <contrib/md5gg.h> + +static char *delim= ":"; +static int delim_size= 1; + +/* ------------------------------------------------------------------------ */ +char *sec_generate_key ( +char *principal, /* who is it */ +char *resource, /* what is wanted */ +char *identifier, /* challenge */ +char *secret) /* actuall password */ +{ + MD5_CTX context; + unsigned char digest [16]; /* message digest */ + char md5_str [34]; /* token */ + + MD5Init (&context); + + MD5Update (&context, (unsigned char *) principal, strlen (principal)); + MD5Update (&context, (unsigned char *) delim, delim_size); + MD5Update (&context, (unsigned char *) resource, strlen (resource)); + MD5Update (&context, (unsigned char *) delim, delim_size); + MD5Update (&context, (unsigned char *) identifier, strlen (identifier)); + MD5Update (&context, (unsigned char *) delim, delim_size); + MD5Update (&context, (unsigned char *) secret, strlen (secret)); + + MD5Final (digest, &context); + bin_to_hex ((char *) digest, md5_str, 16); + + return strdup (md5_str); +} diff --git a/lib/ds/ggcrypt/ggcryp07.o b/lib/ds/ggcrypt/ggcryp07.o new file mode 100644 index 0000000000000000000000000000000000000000..d8ba1baf6dc2ca280fb7c000db8e1b578510f80e Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp07.o differ diff --git a/lib/ds/ggcrypt/ggcryp08.c b/lib/ds/ggcrypt/ggcryp08.c new file mode 100644 index 0000000000000000000000000000000000000000..b5523ae402866d22d61d2c1d7e4b10ea16a6b4ae --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp08.c @@ -0,0 +1,241 @@ +/* + * FILE %ds/ggcrypt/ggcryp08.c + * + * written: 1995-05-02 + * latest update: 1997-01-25 14:53:11 + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/sbr.h> +#include <gg/dpp.h> +#include <gg/strings.h> +#include <gg/ggcrypt.h> +#include <contrib/md5gg.h> + +/* #define DEBUG */ + +/* ------------------------------------------------------------------------ */ +#define AGETTOK_HASH_SIZE 4 /* number of bytes used for hash */ +#define MAX_BUFFER 40 /* 32 Byte max minus 4 at most */ +#define MAX_LINE 256 /* a bit more space for other stuff */ + +static char AGETTOK_HASH [MAX_BUFFER]; /* lookup hash string */ +static char AGETTOK_KEY [MAX_BUFFER]; /* encryption key */ +static char pAGETTOK_HASH [MAX_BUFFER]; /* printable hash string */ + +static char AGETTOK_PASS [MAX_LINE]; /* resource password */ +static char pAGETTOK_PASS [MAX_LINE]; /* printable password */ +static char cAGETTOK_PASS [MAX_LINE]; /* encrypted password */ + +static char NAME_BUFFER [MAX_LINE]; /* unix:afs:resource name triple */ +static char LINE_BUFFER [MAX_LINE]; /* buffer for entries from file */ + +static char DELETED []= "deleted"; + +/* ------------------------------------------------------------------------ */ +int agettok_get_hash_key ( +char *user_from, +char *user_to, +char *resource_name, +char *hash, +char *key, +int hash_size) +{ + int i; + char *cp; + unsigned char *digest; + + if (user_from == (char *) 0 || *user_from == 0 + || user_to == (char *) 0 || *user_to == 0 + || resource_name == (char *) 0 || *resource_name == 0 + ) + return -1; + + if (hash_size <= 0 || hash_size >= 32) return -1; + + sprintf (NAME_BUFFER, "%s:%s:%s", user_from, user_to, resource_name); +#ifdef DEBUG +printf ("hash base: '%s'\n", NAME_BUFFER); +#endif + digest= MD5chk2_block ((unsigned char *) NAME_BUFFER, strlen (NAME_BUFFER)); + + cp= (char *) digest; + for (i= 0; i < AGETTOK_HASH_SIZE; i++) *hash++= *cp++; + for (; i < 16; i++) *key++= *cp++; + *hash= *key= 0; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +char *agettok_get_resource_password ( +char *file_name, +char *user_from, +char *user_to, +char *resource_name, +int get_flags) +{ + int rc; + char *rv= (char *) 0; + FILE *fi; +#define MAX_FIELDS 2 + char *fields [MAX_FIELDS]; + + if (agettok_get_hash_key (user_from, user_to, resource_name, + AGETTOK_HASH, AGETTOK_KEY, AGETTOK_HASH_SIZE) + != 0) return (char *) 0; + + bin_to_hex (AGETTOK_HASH, pAGETTOK_HASH, AGETTOK_HASH_SIZE); + +#ifdef DEBUG +printf ("hash string: '%s'\n", pAGETTOK_HASH); +#endif + + if ((fi= fopen (file_name, "r")) == (FILE *) 0) + { +#ifdef DEBUG +printf ("passwd_file not open: '%s'\n", file_name); +#endif + return (char *) 0; + } + + for (;;) + { + rc= fread_line (fi, LINE_BUFFER, MAX_LINE); + if (rc <= 0 && feof (fi)) break; + if (LINE_BUFFER [0] == '#') continue; + + rc= split_string (LINE_BUFFER, ':', fields, MAX_FIELDS); + if (rc != 2) continue; + if (strcmp (fields [0], pAGETTOK_HASH) == 0) + { + strcpy (pAGETTOK_PASS, fields [1]); + rv= pAGETTOK_PASS; + /* don't break the loop, the latest entry is valid */ + } + } + fclose (fi); + + if (rv != (char *) 0) + { + if (strcmp (pAGETTOK_PASS, DELETED) == 0) return (char *) 0; + + hex_to_bin (pAGETTOK_PASS, AGETTOK_PASS, strlen (pAGETTOK_PASS)); + + if (!(get_flags & AGETTOK_clear_password)) + ggcrypt_block ((unsigned char *) AGETTOK_PASS, + strlen (pAGETTOK_PASS)/2, + (unsigned char *) AGETTOK_KEY, + 16-AGETTOK_HASH_SIZE); + + rv= AGETTOK_PASS; +#ifdef DEBUG +printf ("password: %s\n", rv); +#endif + } + + return rv; +} + +/* ------------------------------------------------------------------------ */ +char *agettok_get_resource_entry ( +char *file_name, +char *user_from, +char *user_to, +char *resource_name) +{ + int rc; + char *rv= (char *) 0; + FILE *fi; + int p_hash_size= AGETTOK_HASH_SIZE*2; + + if (agettok_get_hash_key (user_from, user_to, resource_name, + AGETTOK_HASH, AGETTOK_KEY, AGETTOK_HASH_SIZE) + != 0) return (char *) 0; + + bin_to_hex (AGETTOK_HASH, pAGETTOK_HASH, AGETTOK_HASH_SIZE); + +#ifdef DEBUG +printf ("hash string: '%s'\n", pAGETTOK_HASH); +#endif + + if ((fi= fopen (file_name, "r")) == (FILE *) 0) return (char *) 0; + + for (;;) + { + rc= fread_line (fi, LINE_BUFFER, MAX_LINE); + if (rc <= 0 && feof (fi)) break; + if (LINE_BUFFER [0] == '#') continue; + + if (strncmp (LINE_BUFFER, pAGETTOK_HASH, p_hash_size) == 0 + && LINE_BUFFER [p_hash_size] == ':' + ) + { + rv= LINE_BUFFER; + /* don't break the loop, the latest entry is valid */ + } + } + fclose (fi); + + return (rv == (char *) 0) ? (char *) 0 : strdup (rv); +} + +/* ------------------------------------------------------------------------ */ +int agettok_set_resource_password ( +char *file_name, +char *user_from, +char *user_to, +char *resource_name, +char *resource_password, +int set_flags) +{ + FILE *fo; + int lng; + + if (resource_password == (char *) 0 + || *resource_password == 0 + || strlen (resource_password) <= 3 + || agettok_get_hash_key (user_from, user_to, resource_name, + AGETTOK_HASH, AGETTOK_KEY, + AGETTOK_HASH_SIZE) != 0 + ) + return -1; + + bin_to_hex (AGETTOK_HASH, pAGETTOK_HASH, AGETTOK_HASH_SIZE); + +#ifdef DEBUG +printf ("hash string: '%s'\n", pAGETTOK_HASH); +#endif + + if (strcmp (resource_password, DELETED) == 0) + { + strcpy (pAGETTOK_PASS, resource_password); + } + else + { + lng= strlen (resource_password); + strcpy (cAGETTOK_PASS, resource_password); + if (!(set_flags & AGETTOK_clear_password)) + ggcrypt_block ((unsigned char *) cAGETTOK_PASS, lng, + (unsigned char *) AGETTOK_KEY, 16-AGETTOK_HASH_SIZE); + + bin_to_hex (cAGETTOK_PASS, pAGETTOK_PASS, lng); + +#ifdef DEBUG +printf ("password string: '%s'\n", pAGETTOK_PASS); +#endif + } + + if ((fo= fopen (file_name, "a")) == (FILE *) 0) return -1; + + fprintf (fo, "%s:%s\n", pAGETTOK_HASH, pAGETTOK_PASS); + fclose (fo); + + if (set_flags & AGETTOK_write_entry) + printf ("%s:%s\n", pAGETTOK_HASH, pAGETTOK_PASS); + + return 0; +} diff --git a/lib/ds/ggcrypt/ggcryp08.o b/lib/ds/ggcrypt/ggcryp08.o new file mode 100644 index 0000000000000000000000000000000000000000..8130fea2da10bfb898911e2a7703c16d65881d46 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp08.o differ diff --git a/lib/ds/ggcrypt/ggcryp09.c b/lib/ds/ggcrypt/ggcryp09.c new file mode 100644 index 0000000000000000000000000000000000000000..78bf0a4ef542f63fdfce32823167d692159c36d5 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp09.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/ggcrypt/ggcryp09.c + * + * generate a chex string for a given set of credentials and a challenge + * + * written: 1995-05-02 + * latest update: 1996-01-17 13:14:03 + * $Id: ggcryp09.c,v 1.2 2003/06/25 10:12:50 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/ggcrypt.h> +#include <contrib/md5gg.h> + +/* ------------------------------------------------------------------------ */ +#define MAX_LINE 512 +static char CHALLENGE_STRING [MAX_LINE]; + +/* ------------------------------------------------------------------------ */ +char *agettok_get_challenge ( +char *password_file, +char *user_from, +char *user_to, +char *resource_name, +char *challenge) +{ + char *afs_password; + + afs_password= agettok_get_resource_password (password_file, + user_from, user_to, resource_name, 0); + + if (afs_password == (char *) 0) return (char *) 0; + + sprintf (CHALLENGE_STRING, "%s:%s:%s:%s:%s", user_from, user_to, + resource_name, challenge, afs_password); + + return MD5check_string ((unsigned char *) CHALLENGE_STRING); +} diff --git a/lib/ds/ggcrypt/ggcryp09.o b/lib/ds/ggcrypt/ggcryp09.o new file mode 100644 index 0000000000000000000000000000000000000000..20d708ae6908086514d6974a0b3ecbe6b30b21a4 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp09.o differ diff --git a/lib/ds/ggcrypt/ggcryp10.c b/lib/ds/ggcrypt/ggcryp10.c new file mode 100644 index 0000000000000000000000000000000000000000..38d099f43497fa9608393cd677a52e010c312d4b --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp10.c @@ -0,0 +1,35 @@ +/* + * FILE ~/usr/sbr/ggcryp10.c + * + * AFS shortcut authentication + * + * written: 1995-05-10 + * latest update: 1995-05-10 + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/ggcrypt.h> + +static char *default_sca_directory= "/usr/spool/sca/"; + +/* ------------------------------------------------------------------------ */ +char *sca_get_sigfile (char *username) +{ + char *m; + int l1; + int l; + + if (username == (char *) 0 || *username == 0) return (char *) 0; + + l= (l1= strlen (default_sca_directory)) + strlen (username) + 2; + if ((m= (char *) malloc (l)) != (char *) 0) + { + strcpy (m, default_sca_directory); + strcpy (m+l1, username); + } + + return m; +} diff --git a/lib/ds/ggcrypt/ggcryp10.o b/lib/ds/ggcrypt/ggcryp10.o new file mode 100644 index 0000000000000000000000000000000000000000..8d2ebbd754f0b5c9ea76a30b830066ca6cf9af35 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp10.o differ diff --git a/lib/ds/ggcrypt/ggcryp11.c b/lib/ds/ggcrypt/ggcryp11.c new file mode 100644 index 0000000000000000000000000000000000000000..c8e82a21081ea9b5ba62c0acbd16fada4ecdc1f2 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp11.c @@ -0,0 +1,40 @@ +/* + * FILE %ds/ggcrypt/ggcryp11.c + * + * AFS shortcut authentication + * + * written: 1995-05-10 + * latest update: 1999-05-30 18:32:49 + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/ggcrypt.h> +#include <gg/dpp.h> +#include <contrib/md5gg.h> + +/* ------------------------------------------------------------------------ */ +char *sca_get_signature (char *username, char *password) +{ + char *sig; + unsigned char *dig; +#define N_STR 3 + unsigned char *str [N_STR]; + int lng [N_STR]; + + if (username == (char *) 0 || *username == 0 + || password == (char *) 0 || *password == 0 + || (sig= (char *) malloc (34)) == (char *) 0 + ) return (char *) 0; + + str [0]= (unsigned char *) username; lng [0]= strlen (username); + str [1]= (unsigned char *) ":"; lng [1]= 1; + str [2]= (unsigned char *) password; lng [2]= strlen (password); + + dig= MD5chk2_block_array (str, lng, N_STR); + bin_to_hex ((char *) dig, sig, 16); + + return sig; +} diff --git a/lib/ds/ggcrypt/ggcryp11.o b/lib/ds/ggcrypt/ggcryp11.o new file mode 100644 index 0000000000000000000000000000000000000000..d56a6505fcb3c19cc4c331dff7d7e1933fd4cc8f Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp11.o differ diff --git a/lib/ds/ggcrypt/ggcryp12.c b/lib/ds/ggcrypt/ggcryp12.c new file mode 100644 index 0000000000000000000000000000000000000000..93e8ae991b786f8ed407f8737ec25655509345bb --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp12.c @@ -0,0 +1,44 @@ +/* + * FILE %ds/ggcrypt/ggcryp12.c + * + * AFS shortcut authentication + * + * written: 1995-05-10 + * latest update: 1999-05-30 18:33:29 + * + */ + +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> + +/* ------------------------------------------------------------------------ */ +int sca_check_signature (char *sca_sig_file, char *sca_signature) +{ + struct stat st; +#define SIG_SIZE 34 + char stored_signature [SIG_SIZE]; + FILE *fs; + int rv= 0; + time_t now; + + now= time((time_t *) 0); + + if (stat (sca_sig_file, &st) != 0 + || now - st.st_mtime > 86400 /* max 1 day */ + || now - st.st_mtime < 0 /* file will be written in future! */ + || (fs= fopen (sca_sig_file, "rb")) == (FILE *) 0 + ) + return -1; + + if (fread (stored_signature, 1, 32, fs) == 32) + { + stored_signature[32]= 0; + if (strcmp (stored_signature, sca_signature) == 0) rv= 1; + } + + fclose (fs); + + return rv; +} diff --git a/lib/ds/ggcrypt/ggcryp12.o b/lib/ds/ggcrypt/ggcryp12.o new file mode 100644 index 0000000000000000000000000000000000000000..fad0e13401ea9e2bf284203cc8b3d330c796ebe1 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp12.o differ diff --git a/lib/ds/ggcrypt/ggcryp13.c b/lib/ds/ggcrypt/ggcryp13.c new file mode 100644 index 0000000000000000000000000000000000000000..16de00a803dcd49b99aeb0a82867e3279c9d3241 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp13.c @@ -0,0 +1,48 @@ +/* + * FILE %ds/ggcrypt/ggcryp13.c + * + * written: 1995-08-02 + * latest update: 1997-10-05 9:49:45 + * $Id: ggcryp13.c,v 1.2 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +int ggc_block_encrypt ( +struct GG_CRYPT *ggc, +char *buffer, +int size) +{ + int idx; + int u, e, k; + char *key; + + if (ggc == (struct GG_CRYPT *) 0) return -1; + + if ((key= ggc->GGC_key) == (char *) 0) return 0; /* no encryption */ + + if ((idx= ggc->GGC_index) < 0) idx= 0; /* well... */ + + for (; size > 0; size--) + { + if (idx >= 16) idx= 0; + + e= *buffer & 0x00FF; + k= key [idx] & 0x00FF; + + u= e ^ k; + +#ifdef MODE_CFB + key [idx]= (char) (k+1 & 0x00FF); +#endif + + *buffer++= (char) u; + idx++; + } + + ggc->GGC_index= idx; + + return 0; +} diff --git a/lib/ds/ggcrypt/ggcryp13.o b/lib/ds/ggcrypt/ggcryp13.o new file mode 100644 index 0000000000000000000000000000000000000000..21a21464faad42de587f3772ffaef3ac89ad8200 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp13.o differ diff --git a/lib/ds/ggcrypt/ggcryp14.c b/lib/ds/ggcrypt/ggcryp14.c new file mode 100644 index 0000000000000000000000000000000000000000..a99a088208af453b078ece7c8cc00b5ed212e3e3 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp14.c @@ -0,0 +1,49 @@ +/* + * FILE %ds/ggcrypt/ggcryp14.c + * + * written: 1995-08-06 + * latest update: 1996-05-06 1:17:46 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/ggcrypt.h> + +static char OPEN []= "OPEN"; + +/* ------------------------------------------------------------------------ */ +int ggc_set_session_key ( +struct GG_CRYPT *ggc, +char *key_file, +char *from, +char *to, +char *resource) +{ + char *challenge; + char *chex_string; + char *session_key; + + if (ggc == (struct GG_CRYPT *) 0) return -1; + + challenge= ggc->GGC_challenge; + ggc->GGC_key= (char *) 0; + ggc->GGC_index= 0; + + if (strcmp (challenge, OPEN) != 0) + { /* generate session key */ + if ((session_key= malloc (20)) == (char *) 0) return -1; + + if ((chex_string= agettok_get_challenge (key_file, from, to, + resource, challenge)) == (char *) 0) + return -1; + + hex_to_bin (chex_string, session_key, 32); + + ggc->GGC_key= session_key; + ggc->GGC_key_str= strdup (chex_string); + } + + return 0; +} diff --git a/lib/ds/ggcrypt/ggcryp14.o b/lib/ds/ggcrypt/ggcryp14.o new file mode 100644 index 0000000000000000000000000000000000000000..d8814d8cb7ebbe7acab1511bb9b237fbcd4616f4 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp14.o differ diff --git a/lib/ds/ggcrypt/ggcryp15.c b/lib/ds/ggcrypt/ggcryp15.c new file mode 100644 index 0000000000000000000000000000000000000000..f85dde33bcb4baf44bfcfe88117b5fa4baea3130 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp15.c @@ -0,0 +1,64 @@ +/* + * FILE %ds/ggcrypt/ggcryp15.c + * + * simple file encryption algorithms + * see: ggc_block_ecb, ggc_block_cfb + * + * written: 1995-08-15 + * latest update: 1997-10-05 9:42:17 + * $Id: ggcryp15.c,v 1.3 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/fileio.h> +#include <gg/strings.h> +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +int ggc_file_encrypt ( +struct GG_CRYPT *ggc, +char *fn, /* name of file to encrypt/decrypt */ +char *crypt_tmp, /* name of temporary file */ +long padding) /* > 0L: add this many bytes at the */ + /* beginning of the encrypted */ + /* stream */ + /* < 0L: decrypt and discard this many */ + /* bytes from the beginning of */ + /* the stream */ +{ + FILE *fi= (FILE *) 0; + FILE *fo= (FILE *) 0; + int rv= -2; + int fi_open= 0; + int fo_open= 0; + + if (strcmp (fn, "-") == 0) fi= stdin; + else + if ((fi= fopen (fn, "rb")) != (FILE *) 0) fi_open= 1; + else + { + fprintf (stderr, "can't read from file %s!\n", fn); + goto STOP; + } + + if (strcmp (crypt_tmp, "-") == 0) fo= stdout; + else + if ((fo= fopen (crypt_tmp, "wb")) != (FILE *) 0) fo_open= 1; + else + { + fprintf (stderr, "can't write to file %s!\n", crypt_tmp); + goto STOP; + } + + /* [1997-10-05] encryption engine isolated */ + rv= ggc_stream_encrypt (ggc, fi, fo, padding); + +STOP: + if (fi_open && fi != (FILE *) 0) fclose (fi); + if (fo_open && fo != (FILE *) 0) fclose (fo); + + return rv; +} diff --git a/lib/ds/ggcrypt/ggcryp15.o b/lib/ds/ggcrypt/ggcryp15.o new file mode 100644 index 0000000000000000000000000000000000000000..b7228cebb20c4e97416ae71a28f4a3486df16c3f Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp15.o differ diff --git a/lib/ds/ggcrypt/ggcryp16.c b/lib/ds/ggcrypt/ggcryp16.c new file mode 100644 index 0000000000000000000000000000000000000000..443f831bc8aa2ea01230f417d4af7f670d0dec63 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp16.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/ggcrypt/ggcryp16.c + * + * written: 1996-05-06 + * latest update: 1996-08-12 19:04:58 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <contrib/global.h> +#include <contrib/md5.h> +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +struct GG_CRYPT *ggc_set_key ( +struct GG_CRYPT *ggc, +char *key) +{ + unsigned char *digest; + MD5_CTX context; + + if ((ggc == (struct GG_CRYPT *) 0 + && (ggc= calloc (sizeof (struct GG_CRYPT), 1)) == (struct GG_CRYPT *) 0 + ) + || (digest= malloc (KEYED_MD5_SIZE)) == (unsigned char *) 0 + ) + return (struct GG_CRYPT *) 0; + + MD5Init (&context); + MD5Update (&context, (unsigned char *) key, strlen (key)); + MD5Final (digest, &context); + + ggc->GGC_key= (char *) digest; + ggc->GGC_index= 0; + + return ggc; +} diff --git a/lib/ds/ggcrypt/ggcryp16.o b/lib/ds/ggcrypt/ggcryp16.o new file mode 100644 index 0000000000000000000000000000000000000000..99b420a40249c1ed218d3600a97c232778b04359 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp16.o differ diff --git a/lib/ds/ggcrypt/ggcryp17.c b/lib/ds/ggcrypt/ggcryp17.c new file mode 100644 index 0000000000000000000000000000000000000000..09ffac6b1acb181c971467e56713a16315b7ab48 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp17.c @@ -0,0 +1,21 @@ +/* + * FILE %ds/ggcrypt/ggcryp17.c + * + * written: 1996-08-11 + * latest update: 1997-02-28 0:05:35 + * + */ + +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +int ggc_dispose_key (struct GG_CRYPT *ggc) +{ + if (ggc == (struct GG_CRYPT *) 0) return -1; + + ggc_dispose_block (&ggc->GGC_key, KEYED_MD5_SIZE-1); + ggc_dispose_block (&ggc->GGC_key_str, 0); + ggc_dispose_block (&ggc->GGC_challenge, 0); + + return 0; +} diff --git a/lib/ds/ggcrypt/ggcryp17.o b/lib/ds/ggcrypt/ggcryp17.o new file mode 100644 index 0000000000000000000000000000000000000000..6ece06b321826a6412e290886313caf3a7472f6d Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp17.o differ diff --git a/lib/ds/ggcrypt/ggcryp18.c b/lib/ds/ggcrypt/ggcryp18.c new file mode 100644 index 0000000000000000000000000000000000000000..58fe457a61953c1f2bb273890899a1847ff66adb --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp18.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/ggcrypt/ggcryp18.c + * + * written: 1996-08-11 + * latest update: 1996-08-11 18:53:59 + * + */ + +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +int ggc_dispose_block (char **cpp, int lng) +{ + char *cp; + + if (cpp == (char **) 0) return -1; + + if ((cp= *cpp) != (char *) 0) + { + if (lng <= 0) lng= strlen (cp); + mk_PassWord (cp, lng); + free (cp); + *cpp= (char *) 0; + } + + return 0; +} diff --git a/lib/ds/ggcrypt/ggcryp18.o b/lib/ds/ggcrypt/ggcryp18.o new file mode 100644 index 0000000000000000000000000000000000000000..02bbcd5c731b1bd1edf432fa1f3b5398ba49f8f6 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp18.o differ diff --git a/lib/ds/ggcrypt/ggcryp19.c b/lib/ds/ggcrypt/ggcryp19.c new file mode 100644 index 0000000000000000000000000000000000000000..3fb540fe7b80dfe9627b5dfad6392a5abfadaa56 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp19.c @@ -0,0 +1,18 @@ +/* + * FILE %ds/ggcrypt/ggcryp19.c + * + * written: 1996-08-11 + * latest update: 1996-08-11 18:53:59 + * + */ + +#include <stdlib.h> +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +int ggc_dispose (struct GG_CRYPT *ggc) +{ + if (ggc_dispose_key (ggc) == 0) free (ggc); + + return 0; +} diff --git a/lib/ds/ggcrypt/ggcryp19.o b/lib/ds/ggcrypt/ggcryp19.o new file mode 100644 index 0000000000000000000000000000000000000000..a450ef8cb606f81ac7426120284517cd7eeb788c Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp19.o differ diff --git a/lib/ds/ggcrypt/ggcryp20.c b/lib/ds/ggcrypt/ggcryp20.c new file mode 100644 index 0000000000000000000000000000000000000000..0b5333be2a3b6eee8fe43a95ad07e8696db1be02 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp20.c @@ -0,0 +1,80 @@ +/* + * FILE %ds/ggcrypt/ggcryp20.c + * + * simple file encryption algorithms + * see: ggc_block_ecb, ggc_block_cfb, ggc_file_ecb, ggc_file_cfb + * + * written: 1997-10-05 [extracted from ggcryp15.c] + * latest update: 1997-10-05 9:36:36 + * $Id: ggcryp20.c,v 1.3 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/fileio.h> +#include <gg/strings.h> +#include <gg/ggcrypt.h> + +#define BS GGC_BUFFER_SIZE + +/* ------------------------------------------------------------------------ */ +int ggc_stream_encrypt ( +struct GG_CRYPT *ggc, +FILE *fi, /* input stream */ +FILE *fo, /* output stream */ +long padding) /* > 0L: add this many bytes at the */ + /* beginning of the encrypted */ + /* stream */ + /* < 0L: decrypt and discard this many */ + /* bytes from the beginning of */ + /* the stream */ +{ + char *buffer= (char *) 0; + int rv= -2; + int rc; + + if ((buffer= malloc (BS)) == (char *) 0) + { + fprintf (stderr, "can't allocate buffer!\n"); + goto STOP; + } + + ggc_pad (ggc, fo, buffer, padding, BS); + + /* negative padding value: decrypt cyphertext and discard it */ + if (padding < 0L) + { + padding= -padding; + for (; padding > 0L; padding -= (long) rc) + { + rc= (padding > BS) ? BS : (int) padding; + rc= fread (buffer, 1, rc, fi); + + if (rc <= 0) + { + fprintf (stderr, "can't remove padded block!\n"); + goto STOP; + } + + ggc_block_encrypt (ggc, buffer, rc); + } + } + + for (;;) + { + rc= fread (buffer, 1, BS, fi); + if (rc <= 0) break; + + ggc_block_encrypt (ggc, buffer, rc); + fwrite (buffer, 1, rc, fo); + } + + rv= 0; /* all went fine, set OK result code */ + +STOP: + free_or_what (buffer); + + return rv; +} diff --git a/lib/ds/ggcrypt/ggcryp20.o b/lib/ds/ggcrypt/ggcryp20.o new file mode 100644 index 0000000000000000000000000000000000000000..5774c7f4374c49e3cea06214e90ca91da1d7cb93 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp20.o differ diff --git a/lib/ds/ggcrypt/ggcryp21.c b/lib/ds/ggcrypt/ggcryp21.c new file mode 100644 index 0000000000000000000000000000000000000000..3839cbb24be40eeb68bb5980b10c5a1d48e085a5 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp21.c @@ -0,0 +1,64 @@ +/* + * FILE %ds/ggcrypt/ggcryp21.c + * + * simple file encryption algorithms + * see: ggc_block_cfb + * + * written: 1997-10-05 + * latest update: 1997-10-05 9:36:36 + * $Id: ggcryp21.c,v 1.1 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/fileio.h> +#include <gg/strings.h> +#include <gg/attlist.h> +#include <gg/ggcrypt.h> + +#define BS GGC_BUFFER_SIZE + +/* ------------------------------------------------------------------------ */ +int ggc_stream_2encrypt ( +struct GG_CRYPT *ggc, +FILE *fi, /* input stream */ +FILE *fo, /* output stream */ +ATTLIST *al_pre, +ATTLIST *al_post, +long padding1, +long padding2) +{ + char *buffer= (char *) 0; + int rv= -1; + int rc; + + if ((buffer= malloc (BS)) == (char *) 0) + { + fprintf (stderr, "can't allocate buffer!\n"); + goto STOP; + } + + ggc_pad (ggc, fo, buffer, padding1, BS); + ggc_wr_tag_block (ggc, fo, "CH", al_pre, buffer); + + for (;;) + { + rc= fread (buffer, 1, BS, fi); + if (rc <= 0) break; + + ggc_block_encrypt (ggc, buffer, rc); + fwrite (buffer, 1, rc, fo); + } + + ggc_wr_tag_block (ggc, fo, "CT", al_post, buffer); + ggc_pad (ggc, fo, buffer, padding2, BS); + + rv= 0; /* all went fine, set OK result code */ + +STOP: + free_or_what (buffer); + + return rv; +} diff --git a/lib/ds/ggcrypt/ggcryp21.o b/lib/ds/ggcrypt/ggcryp21.o new file mode 100644 index 0000000000000000000000000000000000000000..4189829b2f0e54e5f927040b0bebdef49e097ec9 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp21.o differ diff --git a/lib/ds/ggcrypt/ggcryp22.c b/lib/ds/ggcrypt/ggcryp22.c new file mode 100644 index 0000000000000000000000000000000000000000..ae8a5a5bf6dd17564a3c5371ee89d8315528d7e4 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp22.c @@ -0,0 +1,164 @@ +/* + * FILE %ds/ggcrypt/ggcryp22.c + * + * simple file encryption algorithms + * see: ggc_block_cfb + * + * written: 1997-10-05 + * latest update: 1997-10-05 9:36:36 + * $Id: ggcryp22.c,v 1.4 2006/11/08 06:40:09 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/fileio.h> +#include <gg/strings.h> +#include <gg/attlist.h> +#include <gg/dpp.h> +#include <gg/ggcrypt.h> + +#define BS GGC_BUFFER_SIZE + +static int analyze_block (char *c, char *tag, int size, long *fs); + +/* ------------------------------------------------------------------------ */ +int ggc_stream_2decrypt ( +struct GG_CRYPT *ggc, +FILE *fi, /* input stream */ +FILE *fo) /* output stream */ +{ + char *buffer= (char *) 0; +#define ST_pre 0 +#define ST_file 1 +#define ST_post 2 + int state= ST_pre; + int rv= -2; + int rc; + int i; + char *cp; + long file_size= -1; + + if ((buffer= malloc (BS)) == (char *) 0) + { + fprintf (stderr, "can't allocate buffer!\n"); + goto STOP; + } + + for (;;) + { + rc= fread (buffer, 1, BS, fi); + if (rc <= 0) break; + + ggc_block_encrypt (ggc, buffer, rc); + + switch (state) + { + case ST_pre: + cp= buffer; + for (i= 0; i < rc; i++) + { + if ( cp [0] == '<' && i+3 < rc /* uh, this is ugly! */ + && cp [1] == 'C' + && cp [2] == 'H' + && cp [3] == '>' + ) + { + int skip; + int block_size; + + skip= analyze_block (cp, "CH", rc-i, &file_size); +/** fprintf (stderr, "skip='%d' file_size=%ld\n", skip, file_size); **/ + block_size= rc-i-skip; + if (block_size > file_size) block_size= file_size; + file_size -= block_size; + fwrite (cp+skip, 1, block_size, fo); + state= ST_file; + + break; + } + + cp++; + } + break; + + case ST_file: + if (rc > file_size) rc= file_size; + fwrite (buffer, 1, rc, fo); + file_size -= rc; + if (file_size <= 0L) goto DONE; + break; + + cp= buffer; + for (i= 0; i < rc; i++) + { + if (*cp == '<' && strncmp (cp+1, "CT>", 3) == 0) + { + int skip; + long fs; + fwrite (buffer, 1, rc-i, fo); + analyze_block (cp, "CT", rc-i, &fs); +fprintf (stderr, "skip='%d'\n", skip); + goto DONE; + } + + cp++; + } + + fwrite (buffer, 1, rc, fo); + break; + } + } + +DONE: + if (state == ST_file) + { + rv= 0; /* all went fine, set OK result code */ + } + else + { + fprintf (stderr, "decoder did not find data!\n"); + rv= -2; + } + +STOP: + free_or_what (buffer); + + return rv; +} + +/* ------------------------------------------------------------------------ */ +static int analyze_block (char *c, char *tag, int size, long *fs) +{ + int i= 0; + char *cp; + int l; + + l= strlen (tag); + cp= c; + for (i= 0; i < size; i++) + { + if (strncmp (cp, "<size>", 6) == 0) + { + int y; + for (y= 6;; y++) + { + if (cp[y] == '\n') { cp[y]= 0; break; } + } + *fs= get_parameter_value (cp+6); + /*** fprintf (stderr, ">>> size: %ld\n", *fs); ***/ + } + + if (cp[0] == '<' && cp[1] == '/' + && strncmp (cp+2, tag, l) == 0 + && cp[l+2] == '>' + ) + return i+l+3; + cp++; + } + + fprintf (stderr, "ERROR: did not find end tag '%s'\n", tag); + + return -1; +} diff --git a/lib/ds/ggcrypt/ggcryp22.o b/lib/ds/ggcrypt/ggcryp22.o new file mode 100644 index 0000000000000000000000000000000000000000..c40e111dc565018ee7d6b2300b0a79b643ddced0 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp22.o differ diff --git a/lib/ds/ggcrypt/ggcryp23.c b/lib/ds/ggcrypt/ggcryp23.c new file mode 100644 index 0000000000000000000000000000000000000000..a9ca5af341d2e60eb1d755c292e51117db60661c --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp23.c @@ -0,0 +1,33 @@ +/* + * FILE %ds/ggcrypt/ggcryp23.c + * + * simple file encryption algorithms + * + * written: 1997-10-05 + * latest update: 1997-10-05 9:36:36 + * $Id: ggcryp23.c,v 1.2 2007/12/02 11:58:09 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/fileio.h> +#include <gg/strings.h> +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +void ggc_pad (struct GG_CRYPT *ggc, FILE *fo, char *buffer, long padding, long BS) +{ + long len; + + /* positive padding value: generate random clear text */ + for (; padding > 0L; padding -= (long) len) + { + len= (padding > BS) ? BS : (int) padding; + mk_PassWord (buffer, len); + + ggc_block_encrypt (ggc, buffer, len); + fwrite (buffer, 1, len, fo); + } +} diff --git a/lib/ds/ggcrypt/ggcryp23.o b/lib/ds/ggcrypt/ggcryp23.o new file mode 100644 index 0000000000000000000000000000000000000000..e55381469e2958865e1fadf42d6c8db16dacd98e Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp23.o differ diff --git a/lib/ds/ggcrypt/ggcryp24.c b/lib/ds/ggcrypt/ggcryp24.c new file mode 100644 index 0000000000000000000000000000000000000000..4ffaa87dc7087cf66dfa9b87a7f467339f33c585 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp24.c @@ -0,0 +1,78 @@ +/* + * FILE %ds/ggcrypt/ggcryp24.c + * + * simple file encryption algorithms + * see: ggc_block_ecb, ggc_block_cfb + * + * written: 1995-08-15 + * latest update: 1997-10-05 9:42:17 + * $Id: ggcryp24.c,v 1.1 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/fileio.h> +#include <gg/strings.h> +#include <gg/attlist.h> +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +int ggc_file_2enc ( +struct GG_CRYPT *ggc, +char *fn, /* name of file to encrypt/decrypt */ +char *crypt_tmp, /* name of temporary file */ +long padding1, +long padding2) +{ + FILE *fi= (FILE *) 0; + FILE *fo= (FILE *) 0; + ATTLIST *al_pre= (ATTLIST *) 0; + ATTLIST *al_post= (ATTLIST *) 0; + int rv= -2; + int fi_open= 0; + int fo_open= 0; + struct stat sb; + + if (strcmp (fn, "-") == 0) fi= stdin; + else + if ((fi= fopen (fn, "rb")) != (FILE *) 0) + { + fi_open= 1; + stat (fn, &sb); + } + else + { + fprintf (stderr, "can't read from file %s!\n", fn); + goto STOP; + } + + if (strcmp (crypt_tmp, "-") == 0) fo= stdout; + else + if ((fo= fopen (crypt_tmp, "wb")) != (FILE *) 0) fo_open= 1; + else + { + fprintf (stderr, "can't write to file %s!\n", crypt_tmp); + goto STOP; + } + + /* initialize attribute lists */ + al_pre= new_ATTLIST (); + al_add_attribute (al_pre, "name", (char *) 0, ALty_string_dup, fn); + if (fi_open) + { + al_add_attribute (al_pre, "size", (char *) 0, ALty_long, (void *) sb.st_size); + } + + /* [1997-10-05] encryption engine isolated */ + rv= ggc_stream_2encrypt (ggc, fi, fo, al_pre, al_post, padding1, padding2); + +STOP: + if (fi_open && fi != (FILE *) 0) fclose (fi); + if (fo_open && fo != (FILE *) 0) fclose (fo); + + return rv; +} diff --git a/lib/ds/ggcrypt/ggcryp24.o b/lib/ds/ggcrypt/ggcryp24.o new file mode 100644 index 0000000000000000000000000000000000000000..d708de37c1a9f230fb8dd2b5352cbecd33fecb36 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp24.o differ diff --git a/lib/ds/ggcrypt/ggcryp25.c b/lib/ds/ggcrypt/ggcryp25.c new file mode 100644 index 0000000000000000000000000000000000000000..731dd77f9ef7c0768b3c5ac63ba67c9553560bb2 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp25.c @@ -0,0 +1,60 @@ +/* + * FILE %ds/ggcrypt/ggcryp25.c + * + * simple file encryption algorithms + * see: ggc_block_ecb, ggc_block_cfb + * + * written: 1995-08-15 + * latest update: 1997-10-05 9:42:17 + * $Id: ggcryp25.c,v 1.1 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/fileio.h> +#include <gg/strings.h> +#include <gg/attlist.h> +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +int ggc_file_2dec ( +struct GG_CRYPT *ggc, +char *fn, /* name of file to encrypt/decrypt */ +char *crypt_tmp) /* name of temporary file */ +{ + FILE *fi= (FILE *) 0; + FILE *fo= (FILE *) 0; + int fi_open= 0, fo_open= 0; + int rv; + + if (strcmp (fn, "-") == 0) fi= stdin; + else + if ((fi= fopen (fn, "rb")) != (FILE *) 0) fi_open= 1; + else + { + fprintf (stderr, "can't read from file %s!\n", fn); + goto STOP; + } + + if (strcmp (crypt_tmp, "-") == 0) fo= stdout; + else + if ((fo= fopen (crypt_tmp, "wb")) != (FILE *) 0) fo_open= 1; + else + { + fprintf (stderr, "can't write to file %s!\n", crypt_tmp); + goto STOP; + } + + /* [1997-10-05] encryption engine isolated */ + rv= ggc_stream_2decrypt (ggc, fi, fo); + +STOP: + if (fi_open && fi != (FILE *) 0) fclose (fi); + if (fo_open && fo != (FILE *) 0) fclose (fo); + + return rv; +} diff --git a/lib/ds/ggcrypt/ggcryp25.o b/lib/ds/ggcrypt/ggcryp25.o new file mode 100644 index 0000000000000000000000000000000000000000..714802b20f2316b45f2e8809d7d546db33075147 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp25.o differ diff --git a/lib/ds/ggcrypt/ggcryp26.c b/lib/ds/ggcrypt/ggcryp26.c new file mode 100644 index 0000000000000000000000000000000000000000..e6343c32b0b7aaebcc8bad5a8226063b1ee95f20 --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp26.c @@ -0,0 +1,66 @@ +/* + * FILE %ds/ggcrypt/ggcryp21.c + * + * simple file encryption algorithms + * see: ggc_block_cfb + * + * written: 1997-10-05 + * latest update: 1997-10-05 9:36:36 + * $Id: ggcryp26.c,v 1.1 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/fileio.h> +#include <gg/strings.h> +#include <gg/attlist.h> +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +int ggc_wr_tag_block ( +struct GG_CRYPT *ggc, +FILE *fo, +char *tag_name, +ATTLIST *al, +char *buffer) +{ + int cnt= 0; + struct ATTRIBUTE_LIST *alp; + int c; + + c= sprintf (buffer, "<%.32s>\n", tag_name); + ggc_block_encrypt (ggc, buffer, c); + fwrite (buffer, 1, c, fo); + cnt += c; + + if (al != (ATTLIST *) 0) + { + for (alp= al->AL_start; alp != (struct ATTRIBUTE_LIST *) 0; alp= alp->AL_next) + { + switch (alp->AL_type) + { + case ALty_string: + case ALty_string_dup: + c= sprintf (buffer, "<%.32s>%.8100s\n", alp->AL_name, (char *) alp->AL_value); + break; + + case ALty_long: + c= sprintf (buffer, "<%.32s>%ld\n", alp->AL_name, (long) alp->AL_value); + break; + } + + ggc_block_encrypt (ggc, buffer, c); + fwrite (buffer, 1, c, fo); + cnt += c; + } + } + + c= sprintf (buffer, "</%.32s>", tag_name); + ggc_block_encrypt (ggc, buffer, c); + fwrite (buffer, 1, c, fo); + cnt += c; + + return cnt; +} diff --git a/lib/ds/ggcrypt/ggcryp26.o b/lib/ds/ggcrypt/ggcryp26.o new file mode 100644 index 0000000000000000000000000000000000000000..a0b52969c560ecfdd91b14b6063063af82c95b9b Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp26.o differ diff --git a/lib/ds/ggcrypt/ggcryp27.c b/lib/ds/ggcrypt/ggcryp27.c new file mode 100644 index 0000000000000000000000000000000000000000..2a4925ffe568689bae93be44f89595dcf0b334af --- /dev/null +++ b/lib/ds/ggcrypt/ggcryp27.c @@ -0,0 +1,55 @@ +/* + * FILE %ds/ggcrypt/ggcryp27.c + * + * simple file encryption algorithms, see ggc_pad in ggcryp23.c + * + * written: 2007-12-02 + * latest update: 2007-12-02 11:11:33 + * $Id: ggcryp27.c,v 1.2 2007/12/02 12:30:57 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <contrib/global.h> +#include <contrib/md5.h> +#include <contrib/md5gg.h> +#include <gg/fileio.h> +#include <gg/strings.h> +#include <gg/ggcrypt.h> + +/* ------------------------------------------------------------------------ */ +long ggc_pad_md5 +( + struct GG_CRYPT *ggc, + MD5_CTX *md5, + FILE *fo, + char *buffer, + long padding, + long BS +) +{ + long len; + long rc= 0L; + + /* positive padding value: generate random clear text */ + for (; padding > 0L; padding -= (long) len) + { + long wl; + + len= (padding > BS) ? BS : (int) padding; + + mk_PassWord (buffer, (int) len); + ggc_block_encrypt (ggc, buffer, len); + + rc += wl= fwrite (buffer, 1, len, fo); + + /* update after write to get correct md5 sum when filesystem is full */ + MD5Update (md5, buffer, wl); + + if (wl != len) break; + } + + return rc; +} diff --git a/lib/ds/ggcrypt/ggcryp27.o b/lib/ds/ggcrypt/ggcryp27.o new file mode 100644 index 0000000000000000000000000000000000000000..4973c6356dd076836019f0183fbce07a7bab0cd2 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryp27.o differ diff --git a/lib/ds/ggcrypt/ggcryq02.o b/lib/ds/ggcrypt/ggcryq02.o new file mode 100644 index 0000000000000000000000000000000000000000..0a47ff77163512403c42772083b7939621f4a1a3 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryq02.o differ diff --git a/lib/ds/ggcrypt/ggcryq13.o b/lib/ds/ggcrypt/ggcryq13.o new file mode 100644 index 0000000000000000000000000000000000000000..8b0c427a6fe28c564706dcef66ea19fb0a7faf8d Binary files /dev/null and b/lib/ds/ggcrypt/ggcryq13.o differ diff --git a/lib/ds/ggcrypt/ggcryq15.o b/lib/ds/ggcrypt/ggcryq15.o new file mode 100644 index 0000000000000000000000000000000000000000..5904416f58bc741f81def8a302f00be6e5ddc7da Binary files /dev/null and b/lib/ds/ggcrypt/ggcryq15.o differ diff --git a/lib/ds/ggcrypt/ggcryq20.o b/lib/ds/ggcrypt/ggcryq20.o new file mode 100644 index 0000000000000000000000000000000000000000..5e38b263e6a17743fd74ce201e51d7b9a9c61c82 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryq20.o differ diff --git a/lib/ds/ggcrypt/ggcryq23.o b/lib/ds/ggcrypt/ggcryq23.o new file mode 100644 index 0000000000000000000000000000000000000000..aedae2814f35ddb0bdf101ace6adfa52fd3393b3 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryq23.o differ diff --git a/lib/ds/ggcrypt/ggcryq27.o b/lib/ds/ggcrypt/ggcryq27.o new file mode 100644 index 0000000000000000000000000000000000000000..a7e27a9de97135b1e0c95ec8f77d271b17745490 Binary files /dev/null and b/lib/ds/ggcrypt/ggcryq27.o differ diff --git a/lib/ds/ggcrypt/ggcryr02.o b/lib/ds/ggcrypt/ggcryr02.o new file mode 100644 index 0000000000000000000000000000000000000000..f02ae6fc954193f224bf0556cb07df7e05686f1c Binary files /dev/null and b/lib/ds/ggcrypt/ggcryr02.o differ diff --git a/lib/ds/ggcrypt/lib b/lib/ds/ggcrypt/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/ggcrypt/libgg.a b/lib/ds/ggcrypt/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/ggcrypt/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/ggcrypt/make-dos b/lib/ds/ggcrypt/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..50fc71ba722d44df5cb7bfe69c973f8fc6d511ad --- /dev/null +++ b/lib/ds/ggcrypt/make-dos @@ -0,0 +1,64 @@ +# +# FILE %ds/ggcrypt/makefile +# +# manipulation of attribute lists +# +# written: 1995-12-29 +# latest update: 1997-10-05 9:53:15 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all.obj : ! + ggcryp02.obj ggcryq02.obj ggcryr02.obj ggcryp04.obj ! + ggcryp05.obj ggcryp06.obj ggcryp07.obj ggcryp08.obj ! + ggcryp09.obj ggcryp10.obj ggcryp11.obj ggcryp12.obj ! + ggcryp13.obj ggcryq13.obj ggcryp14.obj ! + ggcryp15.obj ggcryq15.obj ggcryp16.obj ! + ggcryp17.obj ggcryp18.obj ggcryp19.obj ggcryp20.obj ggcryq20.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +# simple encryption routines ------------------------------------------------- +ggcryp02.obj : ggcryp02.c + $(cml) -DMODE_ENCRYPT ggcryp02.c + $(obj) $@ + +ggcryq02.obj : ggcryp02.c + $(cml) -DMODE_DECRYPT ggcryp02.c + $(obj) $@ + +ggcryr02.obj : ggcryp02.c + $(cml) -DMODE_SIMPLE ggcryp02.c + $(obj) $@ + +# ecb and cfb encryption routines -------------------------------------------- +ggcryp13.obj : ggcryp13.c + $(cml) -DMODE_ECB ggcryp13.c + $(obj) $@ + +ggcryq13.obj : ggcryp13.c + $(cml) -DMODE_CFB ggcryp13.c + $(obj) $@ + +ggcryp15.obj : ggcryp15.c + $(cml) -DMODE_ECB ggcryp15.c + $(obj) $@ + +ggcryq15.obj : ggcryp15.c + $(cml) -DMODE_CFB ggcryp15.c + $(obj) $@ + +ggcryp20.obj : ggcryp20.c + $(cml) -DMODE_ECB ggcryp20.c + $(obj) $@ + +ggcryq20.obj : ggcryp20.c + $(cml) -DMODE_CFB ggcryp20.c + $(obj) $@ diff --git a/lib/ds/hytxt/(dirinf).fm b/lib/ds/hytxt/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..d1758513fccfc93641a6981bcf3605768286dfd5 --- /dev/null +++ b/lib/ds/hytxt/(dirinf).fm @@ -0,0 +1,56 @@ +# +# FILE %ds/hytxt/(dirinf).fm +# +# written: 1996-01-01 +# latest update: 1996-10-13 12:58:57 +# $Id: (dirinf).fm,v 1.2 2002/01/27 23:01:39 gonter Exp $ +# + +# see also: <gg/hytxt.h> and hyx +(dirinf).fm Contents +make-dos DOS version of Makefile +make-ux Unix version of Makefile + +hytxt001.c HyperText: Frame Scanner: ein ganzes File +hytxt002.c HyperText: Frame Scanner: ein Eintrag +hytxt003.c HyperText: Purge +hytxt003.c *** obsolete *** ?? +hytxt004.c HyperText: Sort Frame List +hytxt005.c HyperText: Free Frame Struktur +hytxt006.c HyperText: hide earlier +hytxt007.c HyperText: Framestruktur -> Directory +hytxt008.c int hytxt_report_frame (..., struct HYTXT_FRAME *fd, ...) +hytxt009.c int hyx_purge2 (char *fni, char *fni_tmp, char *fnh, char *fnh_tmp) + +hytxt010.c hyx_sequencer (FILE *fo, ...) +hytxt011.c long find_frame_lut (FILE *lut, char *fr_name); +hytxt012.c long find_frame_xfn (FILE *lut, char *fr_name); +hytxt013.c int deref_index (...); +hytxt014.c long hyx_write_stamp (FILE *fo, char *sig) +hytxt015.c int sgml_write_data (FILE *fo, ...) +hytxt016.c int hyx_extract (FILE *fo, ...) +hytxt017.c long hyx_get_last_index (char *fnm) +hytxt018.c long hyx_get_random_index (FILE *fi_idx) +hytxt019.c int hyx_update (char *fn_hyx, char *fn_idx, ...) +hytxt020.c struct FILE_SEGMENT *hyx_make_segment (...) +hytxt021.c int hyx_destroy_segments (struct FILE_SEGMENT *fs) +hytxt022.c long hyx_get_index (FILE *fi_idx, FILE *fi_lut, ...) +hytxt023.c int hytxt_scan_file (FILE *fo, char *fn) +hytxt024.c int hyx_seq (FILE *fo, ...); +hytxt025.c int hyx_purge (char *hyx_in, int verbose_level) +hytxt026.c long hyx_seek_by_name (...); +hytxt027.c int hyx_print_segment (FILE *fo, struct FILE_SEGMENT *fs); +hytxt028.c int hyx_setup_segment (...); +hytxt029.c int hyx_thr (...) +hytxt030.c int hyx_threader (...) +hytxt031.c int hyx_thr_extract (...) +hytxt032.c void hyx_thr_process (...) +hytxt033.c int hyx_update_index (...) +hytxt034.c int hyx_setup_delete_segment (...) +hytxt035.c long hyx_seek_by_index (FILE *fi_hyx, FILE *fi_idx, long idx); +hytxt036.c int hyx_setup_stdin_segment (...) +hytxt037.c int hyx_dump_frame_list (FILE *fi_lut, FILE *fi_xfn) + +hytxt038.c DONT USE: long find_frame_lut_or_xfn (...) + + diff --git a/lib/ds/hytxt/Makefile b/lib/ds/hytxt/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..65f8dde78a062be33e475e7c5cbe20f78fa8c628 --- /dev/null +++ b/lib/ds/hytxt/Makefile @@ -0,0 +1,34 @@ +# +# FILE %ds/hytxt/make-ux +# +# written: 1996-01-01 +# latest update: 1999-05-08 9:39:05 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + hytxt001.o hytxt002.o hytxt005.o hytxt009.o hytxt010.o hytxt011.o \ + hytxt012.o hytxt013.o hytxt014.o hytxt015.o hytxt016.o hytxt017.o \ + hytxt018.o hytxt019.o hytxt020.o hytxt021.o hytxt022.o hytxt023.o \ + hytxt024.o hytxt025.o hytxt026.o hytxt027.o hytxt028.o hytxt029.o \ + hytxt030.o hytxt031.o hytxt032.o hytxt033.o hytxt034.o hytxt035.o \ + hytxt036.o hytxt037.o hytxt038.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib diff --git a/lib/ds/hytxt/contrib b/lib/ds/hytxt/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/hytxt/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/hytxt/gg b/lib/ds/hytxt/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/hytxt/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/hytxt/hytxt001.c b/lib/ds/hytxt/hytxt001.c new file mode 100644 index 0000000000000000000000000000000000000000..3cfe8d363de5d9f5f9a975e374fdb5730eec6371 --- /dev/null +++ b/lib/ds/hytxt/hytxt001.c @@ -0,0 +1,130 @@ +/* + * FILE %ds/hytxt/hytxt001.c + * + * scan a file for frame entries + * + * written: 1990 02 14 + * latest update: 1996-10-09 21:29:28 + * $Id: hytxt001.c,v 1.3 2002/01/27 23:01:39 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hytxt_scan ( +char *fname, /* Hypertext File Name */ +struct HYTXT_FRAME **fl, /* gescannte Frame Liste */ +int scan_mode) /* Bit 0: don't include earlier versions */ + /* Bit 1: don't include purgable versions */ + /* Bit 4: don't scan frame attributes */ + /* Bit 8-F: reserved fuer untergeordnete */ + /* Funktionen */ +{ + FILE *fi; + int ret_val= 0; /* Return Value dieser Funktion */ + + long pos; /* aktuelle Position im File */ + struct HYTXT_FRAME **fpp; + struct HYTXT_FRAME *fd; /* aktueller Frame-Descriptor */ + struct HYTXT_FRAME *fp; /* vorheriger Frame-Descriptor */ + + if ((fi= fopen (fname, "rb")) == (FILE *) 0) return -1; + fp= (struct HYTXT_FRAME *) 0; + fpp= fl; + + for (pos= 0L;;) + { + if (feof (fi)) break; + + if ((fd= (struct HYTXT_FRAME *) + calloc (sizeof (struct HYTXT_FRAME), 1)) + == (struct HYTXT_FRAME *) 0) + { + ret_val= -1; + break; + } + + ret_val= hytxt_scan_entry (fi, &pos, fd, scan_mode, (char *) 0); + /* hytxt_report_frame (stdout, "SCAN (1)", ret_val, fd); */ + if (ret_val != 0) break; + + *fpp = fd; + fpp = &(fd->hytxt_frame_next); + fd->hytxt_frame_prev=fp; + fp = fd; + + /* aeltere Frames und purgebare Frames suchen: */ + /* Problem: purgeable Frames duerfen nicht sofort entfernt werden, */ + /* da von diesem Frame aeltere Versionen existieren koennen. */ + /* Daher muss zuerst die Liste abgearbeitet werden, dann */ + /* wird der purgeable Frame entfernt. */ + for (fd = fd->hytxt_frame_prev; + fd != (struct HYTXT_FRAME *) 0; + fd = fd->hytxt_frame_prev) + { + /* fp ... zuletzt gelesener Frame */ + /* fd ... betrachteter Frame aus der bisherigen Frame Liste */ + + /* hytxt_report_frame (stdout, "SCAN (2)", 0, fd); */ + + if (strcmp (fd->hytxt_frame_name, fp->hytxt_frame_name) == 0) + { + if (scan_mode & HYXSM_hide_earlier) + { + /* aeltere Version aus Liste entfernen */ + if (fd->hytxt_frame_prev != (struct HYTXT_FRAME *) 0) + fd->hytxt_frame_prev->hytxt_frame_next + = fd->hytxt_frame_next; + if (fd->hytxt_frame_next != (struct HYTXT_FRAME *) 0) + fd->hytxt_frame_next->hytxt_frame_prev + = fd->hytxt_frame_prev; + if (*fl == fd) *fl = fd->hytxt_frame_next; + free_HYTXT_FRAME (fd); + break; + } + else + { + fd->hytxt_frame_newer = fp; + fp->hytxt_frame_earlier = fd; + } + break; + } + } + + } + + /* zum Abschluss purgeable Frames rauswerfen (wenn verlangt) */ + if (scan_mode & HYXSM_hide_purged) + { + for (fd = *fl; + fd != (struct HYTXT_FRAME *) 0; + fd = fd->hytxt_frame_next) + { + /* fd ... betrachteter Frame aus der bisherigen Frame Liste */ + + if (fd->hytxt_frame_flags & HYTXT_FRFLAG_TOPURGE) + { + /* purgeable Version aus Liste entfernen */ + if (fd->hytxt_frame_prev != (struct HYTXT_FRAME *) 0) + fd->hytxt_frame_prev->hytxt_frame_next + = fd->hytxt_frame_next; + if (fd->hytxt_frame_next != (struct HYTXT_FRAME *) 0) + fd->hytxt_frame_next->hytxt_frame_prev + = fd->hytxt_frame_prev; + if (*fl == fd) *fl = fd->hytxt_frame_next; + free_HYTXT_FRAME (fd); + } + } + } + + fclose (fi); + return ret_val; +} diff --git a/lib/ds/hytxt/hytxt001.o b/lib/ds/hytxt/hytxt001.o new file mode 100644 index 0000000000000000000000000000000000000000..a0718e8bc5c9ec8562d63500a1ec3af49298a3cd Binary files /dev/null and b/lib/ds/hytxt/hytxt001.o differ diff --git a/lib/ds/hytxt/hytxt002.c b/lib/ds/hytxt/hytxt002.c new file mode 100644 index 0000000000000000000000000000000000000000..7257317570608eef81ea31aea8ffe826839bc8bf --- /dev/null +++ b/lib/ds/hytxt/hytxt002.c @@ -0,0 +1,423 @@ +/* + * FILE ~/usr/sgml/hytxt002.c + * + * scan one frame entry from a file stream + * + * written: 1990 02 14 + * 1991 03 02: frame buffering + * 1992 12 14: revision + * 1994-06-23: MD5 checksum + * latest update: 1994-12-11 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#ifndef NO_MD5 +#include <contrib/global.h> +#include <contrib/md5.h> +#include <contrib/md5gg.h> +#endif +#include <gg/hytxt.h> + +static char FRAME_BEGIN [] = "Frame"; +static char FRAME_END [] = "/Frame"; +static char FRAME_ATTR [] = "FrAttr"; + +static char FRAME_NAME [FRAME_NAME_LNG]; + +static char *ERR_MSG= "hytxt_scan_entry: out of memory!\n"; + +/* STATUS_CODES: ---------------------------------------------------------- */ +#define STAT_start 0 /* initial state of the scanner */ +#define STAT_tag_open 101 /* tag open found */ +#define STAT_frame 1 /* scanning through a 'Frame' tag. */ +#define STAT_frame_ok 2 /* 'Frame' tag identified, scan rest of tag */ +#define STAT_frame_name 3 /* reading the frame name */ +#define STAT_frame_space 4 /* a white space within a frame name */ +#define STAT_frame_done 5 /* 'Frame' tag completetly scanned in */ +#define STAT_in_frame 6 /* text within a frame */ +#define STAT_701 701 +#define STAT_7 7 +#define STAT_770 770 +#define STAT_781 781 +#define STAT_782 782 +#define STAT_783 783 +#define STAT_784 784 +#define STAT_785 785 +#define STAT_789 789 +#define STAT_8 8 +#define STAT_eframe_name 9 /* read over frame name in end tag */ +#define STAT_end_of_frame 10 /* end of frame found */ + +/* ------------------------------------------------------------------------ */ +int hytxt_scan_entry ( +FILE *fi, /* hypertext file: opened binary */ +long *fi_pos, /* actual position in the file */ +struct HYTXT_FRAME *fd, /* scanned frame entry */ +int scan_mode, /* HYXSM_no_attributes: don't scan frame attributes */ + /* HYXSM_no_allocation: don't allocate string space */ +char *md5_cks) /* finger print of a frame, generated on the fly */ +{ + int ch; /* character just read */ + int ret_val= 0; /* return value of this function */ + long pos; /* actual position in the file */ + long pos_beg= 0L; /* position of the FRAME_BEGIN -tag */ + long pos_end= 0L; /* position of the FRAME_END -tag */ + int status= STAT_start; /* state of the scanner automaton */ + int cmp_idx= 0; /* index in the compare-string */ + int name_lng= 0; /* length of frame name */ + struct HYTXT_ATTR *attr= /* actual hypertext attribute */ + (struct HYTXT_ATTR *) 0; + char *buffer= (char *) 0; + int buffer_size; +#ifndef NO_MD5 + MD5_CTX context; + char md5_buf [2]; + unsigned char digest [16]; /* message digest */ +#endif + + if ((buffer_size= fd->hytxt_frame_bsize) > 0) + if ((buffer= fd->hytxt_frame_buffer) == (char *) 0) + buffer_size= 0; + +#ifndef NO_MD5 + if (md5_cks != (char *) 0) MD5Init (&context); +#else + md5_cks; +#endif + + for (pos= *fi_pos;; pos++) + { + ch= fgetc (fi) & 0x00FF; +#ifndef NO_MD5 + if (md5_cks != (char *) 0) + { + md5_buf[0]= (char) ch; + MD5Update (&context, (unsigned char *) md5_buf, 1); + } +#endif + + + if (feof (fi)) + { + if (status == STAT_in_frame) /* frame opened but not closed */ + goto STATUS_10; + ret_val= 1; + break; + } + + if (buffer_size > 0 && status != STAT_start) + { + *buffer++= (char) ch; + buffer_size--; + } + + switch (status) + { + case STAT_start: /* TEXT; looking for a TAG-start */ + if (ch == '<') /* '<' */ + { + pos_beg= pos; + status= STAT_tag_open; + if (buffer_size > 0) + { + *buffer++= (char) ch; + buffer_size--; + } + } + break; + case STAT_tag_open: /* TAG; suche nach Frame-Tag */ + if (ch == ':') /* das ist die Kurzform fuer das Frame-Tag */ + { /* darauf folgt sofort der Frame Name */ + name_lng= 0; + status= STAT_frame_space; + break; + } + if (ch == FRAME_BEGIN [0]) /* '<F' */ + { + cmp_idx= 1; + status= STAT_frame; + break; + } + if (ch == ' ' || ch == '\t' || ch == 0x0D || ch == 0x0A) break; + status= STAT_start; + break; + case STAT_frame: + if (ch == FRAME_BEGIN [cmp_idx]) + { + cmp_idx++; + if (FRAME_BEGIN [cmp_idx] == 0) status= STAT_frame_ok; + } + else + { + cmp_idx=0; + status= STAT_start; + } + break; + case STAT_frame_ok: + name_lng= 0; + switch (ch) + { + case ' ' : + case '\t': + case 0x0D: + case 0x0A: + status= STAT_frame_name; + break; + case '>': + goto STATUS_5; + default : + cmp_idx=0; + status= STAT_start; + break; + } + break; + case STAT_frame_name: + if (ch == '>') goto STATUS_5; + if (ch != ' ' && ch != '\t' && ch != 0x0D && ch != 0x0A) + { + status= STAT_frame_space; + if (name_lng+1 < FRAME_NAME_LNG) + FRAME_NAME [name_lng++] = (char) ch; + } + break; + case STAT_frame_space: + if (ch == '>') goto STATUS_5; + if (ch == '\t' || ch == 0x0D || ch == 0x0A) ch = ' '; + if (ch == ' ') status= STAT_frame_name; /* store only one space */ + if (name_lng+1 < FRAME_NAME_LNG) + FRAME_NAME [name_lng++]= (char) ch; + break; + case STAT_frame_done: /* Frame Tag abgeschlossen; */ +STATUS_5: /* in Liste(n) eintragen */ + status= STAT_in_frame; + FRAME_NAME [name_lng]= 0; + if (!(scan_mode & HYXSM_no_allocation)) + if ((fd->hytxt_frame_name= malloc (name_lng + 1)) == (char *) 0) + { + ret_val= -1; + fprintf (stderr, ERR_MSG); + goto STOP; + } + + fd->hytxt_frame_next= + fd->hytxt_frame_prev= + fd->hytxt_frame_earlier= + fd->hytxt_frame_newer= (struct HYTXT_FRAME *) 0; + fd->hytxt_frame_pos_beg= pos_beg; + fd->hytxt_attr_append= &(fd->hytxt_attr); + if (fd->hytxt_frame_name != (char *) 0) + strcpy (fd->hytxt_frame_name, FRAME_NAME); +/******************************************************************** +printf ("SCAN (0): rc=%d %s\n", ret_val, fd->hytxt_frame_name); +printf (" %08lX %08lX %08lX %08lX\n", + fd->hytxt_frame_prev, fd->hytxt_frame_next, + fd->hytxt_frame_earlier, fd->hytxt_frame_newer); +printf (" %08lX %08lX\n", + fd->hytxt_frame_pos_beg, fd->hytxt_frame_pos_end); +********************************************************************/ + break; + + case STAT_in_frame: /* Frame Ende suchen */ + if (ch == '<') + { + pos_end= pos; + status= STAT_701; + } + break; + case STAT_701: + if (ch == ';') /* Kurzform fuer das Frame-End */ + { + status= STAT_eframe_name; + break; + } + if (ch == FRAME_END [0]) + { + cmp_idx= 1; + status= STAT_7; + break; + } + if (ch == FRAME_ATTR [0]) + { + cmp_idx= 1; + status= STAT_770; + break; + } + if (ch == ' ' || ch == '\t' || ch == 0x0D || ch == 0x0A) break; + status= STAT_in_frame; + break; + case STAT_7: + if (ch == FRAME_END [cmp_idx]) + { + cmp_idx++; + if (FRAME_END [cmp_idx] == 0) status= STAT_8; + } + else + { + cmp_idx= 0; + status= STAT_in_frame; + } + break; + case STAT_770: + if (ch == FRAME_ATTR [cmp_idx]) + { + cmp_idx++; + if (FRAME_ATTR [cmp_idx] == 0) status= STAT_781; + } + else + { + cmp_idx= 0; + status= STAT_in_frame; + } + break; + case STAT_781: + name_lng= 0; + switch (ch) + { + case ' ': /* '<FrAttr ' */ + status= STAT_782; + break; + case '>': /* '<FrAttr>' */ + status= STAT_in_frame; + break; + default : /* '<FrAttr?' */ + cmp_idx= 0; + status= STAT_in_frame; + break; + } + break; + case STAT_782: + if (ch == '>') /* '<FrAttr >' */ + { + status= STAT_in_frame; + break; + } + if (ch != ' ' && ch != '\t') /* '<FrAttr n' */ + { + status= STAT_783; + if (name_lng+1 < FRAME_NAME_LNG) + FRAME_NAME [name_lng++] = (char) ch; + } + break; + case STAT_783: /* '<FrAttr nam...' */ + if (ch == '>') /* '<FrAttr name>' */ + { + status= STAT_in_frame; + goto STATUS_783b; + } + if (ch == ' ' || ch == '\t' || ch == 0x0D || ch == 0x0A) + { + status= STAT_784; /* '<FrAttr name ' */ +STATUS_783b: + if (!(scan_mode & HYXSM_no_attributes)) + { + if ((attr= (struct HYTXT_ATTR *) + calloc (sizeof (struct HYTXT_ATTR),1)) + == (struct HYTXT_ATTR *) 0) + { + ret_val= -1; + fprintf (stderr, ERR_MSG); + goto STOP; + } + *(fd->hytxt_attr_append)= attr; + fd->hytxt_attr_append = &(attr->hytxt_attr_next); + if ((attr->hytxt_attr_id= malloc (name_lng + 1)) == (char *) 0) + { + ret_val= -1; + fprintf (stderr, ERR_MSG); + goto STOP; + } + FRAME_NAME [name_lng]= 0; + strcpy (attr->hytxt_attr_id, FRAME_NAME); + } + if (strcmp (FRAME_NAME, "Deleted") == 0) + fd->hytxt_frame_flags |= HYTXT_FRFLAG_Deleted; + if (strcmp (FRAME_NAME, "Rename") == 0) + fd->hytxt_frame_flags |= HYTXT_FRFLAG_Rename; + if (strcmp (FRAME_NAME, "Move") == 0) + fd->hytxt_frame_flags |= HYTXT_FRFLAG_Move; + name_lng= 0; + break; + } + if (name_lng+1 < FRAME_NAME_LNG) + FRAME_NAME [name_lng++] = (char) ch; + break; + case STAT_784: /* Attribut Parameter einlesen */ + if (ch == '>') goto STATUS_789; + if (ch != ' ' && ch != '\t' && ch != 0x0D && ch != 0x0A) + { + status= STAT_785; + if (name_lng+1 < FRAME_NAME_LNG) + FRAME_NAME [name_lng++] = (char) ch; + } + break; + case STAT_785: + if (ch == '>') goto STATUS_789; + if (ch == '\t' || ch == 0x0D || ch == 0x0A) ch= ' '; + if (ch == ' ') status= STAT_784; /* nur ein Blank aufnehmen */ + if (name_lng+1 < FRAME_NAME_LNG) + FRAME_NAME [name_lng++] = (char) ch; + break; + case STAT_789: +STATUS_789: + if (!(scan_mode & HYXSM_no_attributes)) + { + if ((attr->hytxt_attr_pars= malloc (name_lng + 1)) == (char *) 0) + { + ret_val= -1; + fprintf (stderr, ERR_MSG); + goto STOP; + } + FRAME_NAME [name_lng]= 0; + strcpy (attr->hytxt_attr_pars, FRAME_NAME); + } + name_lng= 0; + status= STAT_in_frame; + break; + + case STAT_8: + switch (ch) + { + case ' ' : + case '\t': + case 0x0D: + case 0x0A: + status= STAT_eframe_name; + break; + case '>': + goto STATUS_10; + default : + cmp_idx= 0; + status= STAT_in_frame; + break; + } + break; + case STAT_eframe_name: /* Frame Name im Tag-End ueberlesen */ + if (ch == '>') goto STATUS_10; + break; + case STAT_end_of_frame: /* Ende des Frames gefunden */ +STATUS_10: + fd->hytxt_frame_pos_end= pos; + goto STOP; + } + } + +STOP: + +#ifndef NO_MD5 + if (md5_cks != (char *) 0) + { + MD5Final (digest, &context); + MD5Digest2String ((char *) digest, md5_cks); + } +#endif + + *fi_pos= pos + 1L; + return ret_val; +} diff --git a/lib/ds/hytxt/hytxt002.o b/lib/ds/hytxt/hytxt002.o new file mode 100644 index 0000000000000000000000000000000000000000..2220c42ed6ccff131aaa564ecc37659a31be3925 Binary files /dev/null and b/lib/ds/hytxt/hytxt002.o differ diff --git a/lib/ds/hytxt/hytxt003.c b/lib/ds/hytxt/hytxt003.c new file mode 100644 index 0000000000000000000000000000000000000000..f2c1a0161597702b90f952aac6601cb1966b7c4e --- /dev/null +++ b/lib/ds/hytxt/hytxt003.c @@ -0,0 +1,182 @@ +/* + * FILE ~/usr/sgml/hytxt003.c + * + * writtne: 1990 02 14 + * latest update: 1995-07-09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <io.h> +#include <stdlib.h> +#include <memory.h> +#include <gg/hytxt.h> +#include <gg/sbr.h> + +static char *frame_seperator= (char *) 0; +static int frame_seperator_size= 0; + +/* ------------------------------------------------------------------------ */ +int hytxt_purge ( +char *hypertext_file, +char *purge_file, +char *temp_file) +/* Return: < 0 ... Error */ +/* 0 ... OK */ +/* 1 ... File already purged; purge not necessary */ +{ + FILE *fh; /* Hypertext Main File */ + FILE *fp; /* Purge File */ + FILE *ft; /* Temporaeres Hypertext File */ + /* == neues Main File */ + int rv; + int ch; + int purge_new= 0; + int status= 0; + int frame_counter= 0; /* number of frames in the new cluster */ + struct HYTXT_FRAME *frames; /* Frame Liste */ + struct HYTXT_FRAME *f2; + long cpy_size; /* Hypertext Header *VOR* dem ersten Frame */ + + rv= hytxt_scan (hypertext_file, &frames, 0x0000); + /* Frame List: a) Alle Frames, auch upgedatete */ + /* b) Frame Attribute einlesen */ + + if (rv == -1) return -1; + + for (f2 = frames; + ; + f2 = f2->hytxt_frame_next) + { + if (f2 == (struct HYTXT_FRAME *) 0) return 1; + if (f2->hytxt_frame_newer != (struct HYTXT_FRAME *) 0 + || (f2->hytxt_frame_flags & HYTXT_FRFLAG_TOPURGE)) break; + } + + if ((fh= fopen (hypertext_file, "rb")) == (FILE *) 0) return -1; + if ((ft= fopen (temp_file, "wb")) == (FILE *) 0) + { + fclose (fh); + return -1; + } + + cpy_size= frames->hytxt_frame_pos_beg; + + if (access (purge_file, 0) != 0) + { /* Purge File neu anlegen */ + if ((fp= fopen (purge_file, "wb")) == (FILE *) 0) + { + fclose (fh); + fclose (ft); + return -1; + } + for (; cpy_size > 0L; cpy_size--) + { + ch= fgetc (fh) & 0x00FF; + if (feof (fh)) goto STOP; + fputc (ch, ft); + fputc (ch, fp); + } + } + else + { + if ((fp= fopen (purge_file, "ab")) == (FILE *) 0) + { + fclose (fh); + fclose (ft); + return -1; + } + + for (; cpy_size > 0L; cpy_size--) + { + ch= fgetc (fh) & 0x00FF; + if (feof (fh)) goto STOP; + fputc (ch, ft); + } + } + + for (; + frames != (struct HYTXT_FRAME *) 0; + frames = frames->hytxt_frame_next) + { + cpy_size = frames->hytxt_frame_pos_end - + frames->hytxt_frame_pos_beg + 1L; + if (frames->hytxt_frame_newer != (struct HYTXT_FRAME *) 0 + || (frames->hytxt_frame_flags & HYTXT_FRFLAG_TOPURGE)) + ftransfer (fh, fp, cpy_size); /* purge */ + else + { + if (frame_seperator_size > 0 && frame_counter++ > 0) + fwrite (frame_seperator, frame_seperator_size, 1, ft); + ftransfer (fh, ft, cpy_size); /* keep */ + } + +#ifdef JUNK + { /* Frame in neuen Main Cluster uebernehmen */ + for (; cpy_size > 0L; cpy_size--) + { + ch = fgetc (fh) & 0x00FF; + if (feof (fh)) goto STOP; + fputc (ch, ft); + } + } + else { /* Frame purgen */ + for (; cpy_size > 0L; cpy_size--) + { + ch = fgetc (fh) & 0x00FF; + if (feof (fh)) goto STOP; + fputc (ch, fp); + } + } +#endif + + /* Zwischenraum zwischen Frames, bzw. nach dem letzten Frame */ + if (frames->hytxt_frame_next == (struct HYTXT_FRAME *) 0) + cpy_size= 0x0FFFFFFF; + else cpy_size= frames->hytxt_frame_next->hytxt_frame_pos_beg - + frames->hytxt_frame_pos_end - 1L; + ftransfer (fh, fp, cpy_size); +#ifdef JUNK + for (; cpy_size > 0L; cpy_size--) + { + ch= fgetc (fh) & 0x00FF; + if (feof (fh)) goto STOP; + fputc (ch, fp); + } +#endif + } + +STOP: + fclose (fp); + fclose (ft); + fclose (fh); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int hytxt_purge_seperator (char *seperator, int seperator_size) +{ + if (frame_seperator != (char *) 0) + { + if (seperator_size && frame_seperator_size >= seperator_size) goto DOIT; + else + { + free (frame_seperator); + frame_seperator_size = 0; + frame_seperator = (char *) 0; + } + } + if (seperator_size == 0) return 0; + + if ((frame_seperator= malloc (seperator_size)) == (char *) 0) return -1; + +DOIT: + memcpy (frame_seperator, seperator, frame_seperator_size= seperator_size); + + return 0; +} diff --git a/lib/ds/hytxt/hytxt004.c b/lib/ds/hytxt/hytxt004.c new file mode 100644 index 0000000000000000000000000000000000000000..928e810b8e597918e9b0b57d2e53d3f50b7210e4 --- /dev/null +++ b/lib/ds/hytxt/hytxt004.c @@ -0,0 +1,78 @@ +/* + * FILE ~/usr/sgml/hytxt004.c + * + * Frame Liste sortieren + * + * written: 1990 02 17 + * latest update: 1994-06-03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/hytxt.h> + +#ifdef NIL +#undef NIL +#endif +#define NIL (struct HYTXT_FRAME *) 0 + +/* ------------------------------------------------------------------------ */ +int hytxt_sort ( +struct HYTXT_FRAME **liste, +int sort_mode) /* 0 .. unsortiert */ + /* 1 .. reversed */ + /* 2 .. Frame Namen */ + /* 3 .. Frame Namen reversed */ + /* usw.......... */ +{ + struct HYTXT_FRAME + *f1, /* Arbeitespointer */ + *f1b, + *f2, /* Neue Liste */ + **f3, + **fp; + + if (liste == (void *) 0) return -1; + if ((f1=*liste) == NIL || + sort_mode < 1 || sort_mode > 4) return 0; /* #### */ + + f2= NIL; + fp= &f2; + + /* 1. Neusortierung */ + for (; f1 != NIL; f1 = f1b) + { + /* Sort Modes!!!!!!!!!!!!!! #################### */ + for (f3 = &f2; *f3 != NIL; f3 = &((*f3)->hytxt_frame_next)) + if (strcmp ((*f3)->hytxt_frame_name, f1->hytxt_frame_name) > 0) + break; + + f1b = f1->hytxt_frame_next; + if (*f3 == NIL) + { + *fp = f1; + fp = &(f1->hytxt_frame_next); + *fp = NIL; + } + else { + f1->hytxt_frame_next = *f3; + *f3 = f1; + } + } + + /* 2. Rueckverkettung */ + f2->hytxt_frame_prev = NIL; + for (f1 = f2; f1 != NIL; f1 = f1->hytxt_frame_next) + { + if (f1->hytxt_frame_next == NIL) break; + f1->hytxt_frame_next->hytxt_frame_prev = f1; + } + + *liste = f2; + return 0; +} diff --git a/lib/ds/hytxt/hytxt005.c b/lib/ds/hytxt/hytxt005.c new file mode 100644 index 0000000000000000000000000000000000000000..65daa81edb21c7bf7b316eaabf1fec1a81d7cb51 --- /dev/null +++ b/lib/ds/hytxt/hytxt005.c @@ -0,0 +1,32 @@ +/* + * FILE %ds/hytxt/hytxt005.c + * + * Datenstruktur fuer HyperText Frame freigeben + * + * written: 1990 04 12 + * latest update: 1996-10-09 21:40:39 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +void free_HYTXT_FRAME (struct HYTXT_FRAME *fd) +{ + struct HYTXT_ATTR *a1, *a2; + + for (a1= fd->hytxt_attr; (a2= a1) != (struct HYTXT_ATTR *) 0;) + { + a1= a1->hytxt_attr_next; + free (a2); + } + + if (fd != (struct HYTXT_FRAME *) 0) free (fd->hytxt_frame_name); + free (fd); +} diff --git a/lib/ds/hytxt/hytxt005.o b/lib/ds/hytxt/hytxt005.o new file mode 100644 index 0000000000000000000000000000000000000000..88a1fa1df2c15739067faec8ac4c4483533e500d Binary files /dev/null and b/lib/ds/hytxt/hytxt005.o differ diff --git a/lib/ds/hytxt/hytxt006.c b/lib/ds/hytxt/hytxt006.c new file mode 100644 index 0000000000000000000000000000000000000000..6cd9d4b35a95ed7e30ec19cf36cc215ba7b915ff --- /dev/null +++ b/lib/ds/hytxt/hytxt006.c @@ -0,0 +1,36 @@ +/* + * FILE ~/usr/sgml/hytxt006.c + * + * written: 1990 02 14 + * latest update: 1994-06-03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +void hytxt_hide_earlier ( +struct HYTXT_FRAME **fl) /* gescannte Frame Liste */ +{ + struct HYTXT_FRAME *f1, *f2; + + f2= (struct HYTXT_FRAME *) 0; + + for (f1 = *fl; + f1 != (struct HYTXT_FRAME *) 0; + f1 = f1->hytxt_frame_next) + if (f1->hytxt_frame_newer == (struct HYTXT_FRAME *) 0) + { + f1->hytxt_frame_prev = f2; + f2 = f1; + *fl = f1; + fl = &(f1->hytxt_frame_next); + } + + *fl= (struct HYTXT_FRAME *) 0; +} diff --git a/lib/ds/hytxt/hytxt007.c b/lib/ds/hytxt/hytxt007.c new file mode 100644 index 0000000000000000000000000000000000000000..0ea282ba40f5805b884d02b06252cad1fc6b4eb5 --- /dev/null +++ b/lib/ds/hytxt/hytxt007.c @@ -0,0 +1,39 @@ +/* + * FILE ~/usr/sgml/hytxt007.c + * + * written: 1990 04 13 + * latest update: 1994-06-03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/hytxt.h> +#include <gg/fnames.h> + +/* ------------------------------------------------------------------------ */ +int hytxt_frame2dta2 ( +struct HYTXT_FRAME *fr, +struct dta2_buff **d2) +{ + struct dta2_buff *d; + *d2 = d = (struct dta2_buff *) calloc (sizeof (struct dta2_buff), 1); + if (d == (struct dta2_buff *) 0) return -1; + + d->size = fr->hytxt_frame_pos_end - fr->hytxt_frame_pos_beg + 1L; + sprintf (d->name, "%06lX%06lX", + fr->hytxt_frame_pos_beg, + fr->hytxt_frame_pos_end); + + d->infos [0] = malloc (strlen (fr->hytxt_frame_name)+1); + d->info_allocated = 1; + d->info_cnt = 1; + strcpy (d->infos [0], fr->hytxt_frame_name); + + return 0; +} diff --git a/lib/ds/hytxt/hytxt008.c b/lib/ds/hytxt/hytxt008.c new file mode 100644 index 0000000000000000000000000000000000000000..c0114f6f7650922ccaae82d62db0aca500086bea --- /dev/null +++ b/lib/ds/hytxt/hytxt008.c @@ -0,0 +1,36 @@ +/* + * FILE ~/usr/sgml/hytxt008.c + * + * written: 1991 03 02 + * latest update: 1994-06-03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hytxt_report_frame ( +FILE *fo, +char *txt, +struct HYTXT_FRAME *fd, +int ret_val) +{ + + fprintf (fo, "%s: rc=%d %s\n", txt, ret_val, fd->hytxt_frame_name); + fprintf (fo, "%s: %08lX %08lX %08lX %08lX\n", + txt, + fd->hytxt_frame_prev, fd->hytxt_frame_next, + fd->hytxt_frame_earlier, fd->hytxt_frame_newer); + fprintf (fo, "%s: %08lX %08lX\n", + txt, + fd->hytxt_frame_pos_beg, fd->hytxt_frame_pos_end); + + return 0; +} diff --git a/lib/ds/hytxt/hytxt009.c b/lib/ds/hytxt/hytxt009.c new file mode 100644 index 0000000000000000000000000000000000000000..092b619cb10ba92b846c3a2705cbeeccd37d64d6 --- /dev/null +++ b/lib/ds/hytxt/hytxt009.c @@ -0,0 +1,150 @@ +/* + * FILE ~/usr/sgml/hytxt009.c + * + * Purge a hypertext cluster, given are the filenames of the + * input cluster, input index, output cluster and output index. + * The calling routing must/will take care to erase/rename these files. + * + * written: 1991 07 18 + * 1992 12 07: extra buffers as a compile time option + * latest update: 1995-07-09 + * + */ + +#include <stdio.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/sbr.h> +#include <gg/hytxt.h> +#include <gg/lookup.h> +#include <gg/dpp.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +extern int errno; +#define EXTRA_BUFFERS +#ifdef EXTRA_BUFFERS +#include <stdlib.h> +#define BUFFER_SIZE 4096 +#endif + +/* ------------------------------------------------------------------------ */ +int hyx_purge2 ( +char *fni, +char *fni_tmp, +char *fnh, +char *fnh_tmp, +int verbose_level) +{ + FILE *fi_idx; + FILE *fo_idx; + FILE *fi_hyx; + FILE *fo_hyx; + long next_index; + long current_index; + long idxi_beg; + long idxi_end; + long idxi_cln; + long idxo_beg; + long idxo_end; + long idxo_cln; + struct stat st; + int rv= -2; +#ifdef EXTRA_BUFFERS + int extra_buffers= 0; + char *buf_iidx= (char *) 0; + char *buf_oidx= (char *) 0; + char *buf_ihyx= (char *) 0; + char *buf_ohyx= (char *) 0; +#endif + + if (stat (fni, &st) && errno == ENOENT) + { + fprintf (stderr, "error: index file is empty; nothing to do...\n"); + return -2; + } + next_index= st.st_size / 12L; + + if ((fi_idx= fopen (fni, "rb")) == (FILE *) 0) goto ERR1; + if ((fo_idx= fopen (fni_tmp, "wb")) == (FILE *) 0) goto ERR2; + if ((fi_hyx= fopen (fnh, "rb")) == (FILE *) 0) goto ERR3; + if ((fo_hyx= fopen (fnh_tmp, "wb")) == (FILE *) 0) goto ERR4; + + rv= 0; + +#ifdef EXTRA_BUFFERS + buf_iidx= malloc (BUFFER_SIZE); + buf_oidx= malloc (BUFFER_SIZE); + buf_ihyx= malloc (BUFFER_SIZE); + buf_ohyx= malloc (BUFFER_SIZE); + if (buf_iidx && buf_oidx && buf_ihyx && buf_ohyx) + { + extra_buffers= 1; + setvbuf (fi_idx, buf_iidx, _IOFBF, BUFFER_SIZE); + setvbuf (fo_idx, buf_oidx, _IOFBF, BUFFER_SIZE); + setvbuf (fi_hyx, buf_ihyx, _IOFBF, BUFFER_SIZE); + setvbuf (fo_hyx, buf_ohyx, _IOFBF, BUFFER_SIZE); + } +#endif + + fprintf (fo_hyx, "<ned.sgml enc=\"HYX\" ed=\"ned:3.00.20\" cs=\"IBM-PC\">\n"); + hyx_write_stamp (fo_hyx, "pgm=\"hyxpurge\""); + fputc ('\n', fo_hyx); + + for (current_index = 0L; + current_index < next_index; + current_index++) + { + idxi_beg= dpp_fread_long (fi_idx, 4); + idxi_end= dpp_fread_long (fi_idx, 4); + idxi_cln= dpp_fread_long (fi_idx, 4); + + if (idxi_beg == -1L || (idxi_beg == 0L && idxi_end == 0L)) + { + if (verbose_level >= 1) + fprintf (stderr, + "[0x%08lX] *dummy* begin=0x%08lX end=0x%08lX cluster=0x%lX\n", + current_index, idxi_beg, idxi_end, idxi_cln); + + dpp_fwrite_long (fo_idx, idxi_beg, 4); + dpp_fwrite_long (fo_idx, idxi_end, 4); + dpp_fwrite_long (fo_idx, idxi_cln, 4); + continue; + } + + fseek (fi_hyx, idxi_beg, 0); + idxo_beg= ftell (fo_hyx); + ftransfer (fi_hyx, fo_hyx, idxi_end-idxi_beg+1L); + idxo_end= ftell (fo_hyx)-1L; + idxo_cln= idxi_cln; + fputc (0x0A, fo_hyx); + + dpp_fwrite_long (fo_idx, idxo_beg, 4); + dpp_fwrite_long (fo_idx, idxo_end, 4); + dpp_fwrite_long (fo_idx, idxo_cln, 4); + } + + fclose (fo_hyx); +ERR4: + fclose (fi_hyx); +ERR3: + fclose (fo_idx); +ERR2: + fclose (fi_idx); +ERR1: + +#ifdef EXTRA_BUFFERS + if (extra_buffers) + { + free (buf_iidx); + free (buf_oidx); + free (buf_ihyx); + free (buf_ohyx); + } +#endif + + return rv; +} diff --git a/lib/ds/hytxt/hytxt009.o b/lib/ds/hytxt/hytxt009.o new file mode 100644 index 0000000000000000000000000000000000000000..d87028cb20922b81f94271e51aaeeb19856d06d2 Binary files /dev/null and b/lib/ds/hytxt/hytxt009.o differ diff --git a/lib/ds/hytxt/hytxt010.c b/lib/ds/hytxt/hytxt010.c new file mode 100644 index 0000000000000000000000000000000000000000..c9dadd1fd56168f0d099bf7b9803b237288b4e17 --- /dev/null +++ b/lib/ds/hytxt/hytxt010.c @@ -0,0 +1,178 @@ +/* + * FILE %ds/hytxt/hytxt010.c + * + * written: 1991 07 20 + * 1994-06-03: old version sequencer removed + * 1994-06-19: sequencer uses list of FILE_SEGMENTs + * latest update: 1996-03-24 17:40:22 + * $Id: hytxt010.c,v 1.3 2002/01/27 23:01:39 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/hytxt.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/filename.h> +#include <contrib/md5gg.h> + +static char tmp []= "@@TMP@@.SEQ"; + +/* ------------------------------------------------------------------------ */ +int hyx_sequencer ( +FILE *fo, +char *fnm_hyx, +char *fnm_idx, +char *fnm_lut, +char *fnm_xfn, +struct FILE_SEGMENT *fseg, +int verbose_mode, +int extract_flags) +{ + int rv; + int rc; + int ch; + FILE *fo_tmp; /* temporary output file */ + FILE *fi; /* file containing frame list */ + FILE *fi_hyx= (FILE *) 0; /* cluster file */ + FILE *fi_idx= (FILE *) 0; /* index file */ + FILE *fi_lut= (FILE *) 0; /* lookup table file */ + FILE *fi_xfn= (FILE *) 0; /* extra lookup table file */ +#define FRAME_strlng 260 + char frame [FRAME_strlng]; /* buffer for a frame name from list */ + char *frame_ptr; + char *fseg_name; + int fseg_op; + long last_index; + long cnt; + + rv= -1; + if ((last_index= hyx_get_last_index (fnm_idx)) <= 0L + ||(fi_hyx= flopen (fnm_hyx, "rb")) == (FILE *) 0) goto END1; + if ((fi_idx= flopen (fnm_idx, "rb")) == (FILE *) 0) goto END2; + fi_lut= flopen (fnm_lut, "rb"); + fi_xfn= flopen (fnm_xfn, "rb"); + if (fi_lut == (FILE *) 0 && fi_xfn == (FILE *) 0) goto END5; + rv= 0; + + for (; fseg != (struct FILE_SEGMENT *) 0; fseg= fseg->FS_next) + { + fseg_name= fseg->FS_frame_name; + fseg_op= fseg->FS_operation; + if (verbose_mode > 0) printf ("%c: %s\n", fseg_op, fseg_name); + /* print operation code and name of first extracted frame */ + + switch (fseg_op) + { + case 'l': case 'L': /* list of frames in a file */ + if (verbose_mode > 0) + printf ("transfering frames from logic file '%s'\n", fseg_name); + if ((fi= (strcmp (fseg_name, "-") == 0) + ? ((FILE *) stdin) + : fopen (translate_logic_filename (fseg_name), "rt")) + == (FILE *) 0) return -1; +PROC_LIST: + for (;;) + { +NEXT: + rc= fread_line (fi, frame, FRAME_strlng); + if ((rc <= 0 && feof (fi)) || strcmp (frame, ".") == 0) break; + frame_ptr= frame; +NEXT_TRY: + switch (*frame_ptr) + { + case '<': /* ############ */ + do + { + ch= *frame_ptr++ & 0x00FF; + if (ch == 0) goto NEXT; + } while (ch != '>'); + goto NEXT_TRY; + + case 0: + case '#': + case 0x0D: + case 0x0A: + goto NEXT; + } + + if (hyx_extract (fo, fi_hyx, fi_idx, fi_lut, fi_xfn, frame_ptr, + verbose_mode, extract_flags) != 0) + { + fprintf (stderr, "error: frame \"%s\" not found in %s!\n", + frame, fnm_hyx); + continue; + } + } + if (strcmp (fseg_name, "-") != 0) fclose (fi); + break; + + case 'f': case 'F': /* list of frames is in the frame */ + if (verbose_mode > 0) + printf ("transfering frames from frame '%s', tmp_file=%s\n", + fseg_name, tmp); + if ((fo_tmp= fopen (tmp, "wb")) == (FILE *) 0) + { +ERR1: + fprintf (stderr, "error: can\'t open tmpfile\n"); + goto END5; + } + if (hyx_extract (fo_tmp, fi_hyx, fi_idx, fi_lut, fi_xfn, + fseg_name, verbose_mode, extract_flags) != 0) + fflush (fo_tmp); + rc= fclose (fo_tmp); + if ((fi= fopen (tmp, "rt")) == (FILE *) 0) goto ERR1; + goto PROC_LIST; + break; + + case 'm': case 'M': + fseg_name= MD5check_string ((unsigned char *) fseg_name); + + case 'x': case 'X': /* extract just one named frame */ + if (verbose_mode > 0) + printf ("transfering single frame '%s'\n", fseg_name); + if (hyx_extract (fo, fi_hyx, fi_idx, fi_lut, fi_xfn, + fseg_name, verbose_mode, extract_flags) != 0) + { + fprintf (stderr, + "error: frame \"%s\" not found in %s!\n", + fseg_name, fnm_hyx); + goto END5; + } + break; + + case 't': case 'T': /* total recall: extract all frames */ + if (verbose_mode > 0) + printf ("transfering *ALL* frames\n"); + for (cnt= 1L; cnt <= last_index; cnt++) + { + sprintf (frame, "$#%ld", cnt); + if (hyx_extract (fo, fi_hyx, fi_idx, fi_lut, fi_xfn, + frame, verbose_mode, extract_flags) != 0) + { + fprintf (stderr, + "error: frame \"%s\" not found in %s!\n", + fseg_name, fnm_hyx); + goto END5; + } + } + break; + } + } + +END5: +#ifndef NOT_USED + if (fi_xfn != (FILE *) 0) fclose (fi_xfn); + if (fi_lut != (FILE *) 0) fclose (fi_lut); + fclose (fi_idx); +#endif + +END2: +#ifndef NOT_USED + fclose (fi_hyx); +#endif + +END1: + return rv; +} diff --git a/lib/ds/hytxt/hytxt010.o b/lib/ds/hytxt/hytxt010.o new file mode 100644 index 0000000000000000000000000000000000000000..b7c0773cbd8a3f06736f48ba76b44187c28b4e19 Binary files /dev/null and b/lib/ds/hytxt/hytxt010.o differ diff --git a/lib/ds/hytxt/hytxt011.c b/lib/ds/hytxt/hytxt011.c new file mode 100644 index 0000000000000000000000000000000000000000..52fe07328bd40b6c0b1a92bff159cf268c0abf8b --- /dev/null +++ b/lib/ds/hytxt/hytxt011.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/hytxt/hytxt011.c + * + * written: 1991 07 20 + * latest update: 1997-11-01 10:38:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/hytxt.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +long find_frame_lut (FILE *lut, char *fr_name) +{ + int rc; + long w_info; + int lng; + + if (lut == (FILE *) 0) return -1L; + + fseek (lut, 0L, 0); + rc= lookup_file (lut, fr_name, &w_info, &lng); + + return (rc & LOOKUP_found) ? w_info : -1L; +} diff --git a/lib/ds/hytxt/hytxt011.o b/lib/ds/hytxt/hytxt011.o new file mode 100644 index 0000000000000000000000000000000000000000..fa7eadcb8ae401fa8e93c313b0edab886330702d Binary files /dev/null and b/lib/ds/hytxt/hytxt011.o differ diff --git a/lib/ds/hytxt/hytxt012.c b/lib/ds/hytxt/hytxt012.c new file mode 100644 index 0000000000000000000000000000000000000000..59b507cf8466182110536c201016e8e4c91e95a0 --- /dev/null +++ b/lib/ds/hytxt/hytxt012.c @@ -0,0 +1,28 @@ +/* + * FILE %ds/hytxt/hytxt012.c + * + * written: 1991 07 20 + * latest update: 1996-03-24 17:42:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/hytxt.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +long find_frame_xfn (FILE *xfn, char *fr_name) +{ + int rc; + long w_info; + + if (xfn == (FILE *) 0) return -1L; + + rc= lookup_file_xfn (xfn, fr_name, &w_info); + + return (rc & LOOKUP_found) ? w_info : -1L; +} diff --git a/lib/ds/hytxt/hytxt012.o b/lib/ds/hytxt/hytxt012.o new file mode 100644 index 0000000000000000000000000000000000000000..960250b17b1c923145e82be63c803c1f8eea9577 Binary files /dev/null and b/lib/ds/hytxt/hytxt012.o differ diff --git a/lib/ds/hytxt/hytxt013.c b/lib/ds/hytxt/hytxt013.c new file mode 100644 index 0000000000000000000000000000000000000000..4694983bb97dfb69c4a0bd0e3675b32429e2fdfc --- /dev/null +++ b/lib/ds/hytxt/hytxt013.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/hytxt/hytxt013.c + * + * written: 1991 07 20 + * latest update: 1996-03-24 18:44:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/hytxt.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int deref_index (FILE *fidx, long idx, long *p1, long *p2, long *p3) +{ + if (fidx == (FILE *) 0) return -1; + + fseek (fidx, idx * ((long) HYXIDX_REC_SIZE), 0); + *p1= dpp_fread_long (fidx, 4); + *p2= dpp_fread_long (fidx, 4); + *p3= dpp_fread_long (fidx, 4); + if (feof (fidx)) return -1; + + return 0; +} diff --git a/lib/ds/hytxt/hytxt013.o b/lib/ds/hytxt/hytxt013.o new file mode 100644 index 0000000000000000000000000000000000000000..bae4ebbbb267c8502d4d513c4db1753fe8e24561 Binary files /dev/null and b/lib/ds/hytxt/hytxt013.o differ diff --git a/lib/ds/hytxt/hytxt014.c b/lib/ds/hytxt/hytxt014.c new file mode 100644 index 0000000000000000000000000000000000000000..8840c2b6bdbd8ada04997a1a21ebc575594bd9cf --- /dev/null +++ b/lib/ds/hytxt/hytxt014.c @@ -0,0 +1,50 @@ +/* + * FILE %ds/hytxt/hytxt014.c + * + * written: 1991 07 20 + * 1995-12-30 + * latest update: 2001-02-18 19:10:33 (y2k bug) + * $Id: hytxt014.c,v 1.3 2003/09/30 09:57:33 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +long hyx_write_stamp (FILE *fo, char *sig) +{ + struct tm *tm_s; + time_t tt; + int rc; + char *user; + + tt= time ((time_t *) 0); + tm_s= localtime (&tt); + + if ((user= getenv ("NAME")) == (char *) 0) user= "user@unknown"; + + rc= fprintf (fo, + "<hyx.stamp d=\"%04d-%02d-%02d\" t=\"%02d:%02d:%02d\" u=\"%s\"", + tm_s->tm_year+1900, tm_s->tm_mon+1, tm_s->tm_mday, + tm_s->tm_hour, tm_s->tm_min, tm_s->tm_sec, user); + + if (sig != (char *) 0) + { + fputc (' ', fo); + fputs (sig, fo); + rc += strlen (sig) + 1; + } + + fputc ('>', fo); + rc++; + + return (long) rc; +} diff --git a/lib/ds/hytxt/hytxt014.o b/lib/ds/hytxt/hytxt014.o new file mode 100644 index 0000000000000000000000000000000000000000..1d7c71973141b8eb71531f2fe63b956a29baf61b Binary files /dev/null and b/lib/ds/hytxt/hytxt014.o differ diff --git a/lib/ds/hytxt/hytxt015.c b/lib/ds/hytxt/hytxt015.c new file mode 100644 index 0000000000000000000000000000000000000000..83d65c7ae83a45396c9b513280d15dec4fb59c32 --- /dev/null +++ b/lib/ds/hytxt/hytxt015.c @@ -0,0 +1,52 @@ +/* + * FILE %ds/hytxt/hytxt015.c + * + * written: 1993-01-21 + * latest update: 1996-12-22 21:05:42 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int sgml_write_data ( +FILE *fo, +char *open_tag, +char *close_tag, +char *buffer, +int buffer_size) +{ + int ch; + int outc= 0; + +/************************************** + if (open_tag == (char *) 0) && close_tag == (char *) 0) + return fwrite (buffer, 1, buffer_size, fo); +**************************************/ + + if (open_tag != (char *) 0) + outc += fwrite (open_tag, 1, strlen (open_tag), fo); + + while (buffer_size-- > 0) + { + ch= *buffer++ & 0x00FF; + switch (ch) + { + case '<': outc += fputs ("<", fo); break; + case '>': outc += fputs (">", fo); break; + case '&': outc += fputs ("&", fo); break; + case 0: outc += fputs ("&null;", fo); break; + default: + fputc (ch, fo); + outc++; + break; + } + } + + if (close_tag != (char *) 0) + outc += fwrite (close_tag, 1, strlen (close_tag), fo); + + return outc; +} diff --git a/lib/ds/hytxt/hytxt015.o b/lib/ds/hytxt/hytxt015.o new file mode 100644 index 0000000000000000000000000000000000000000..7cdc21d6f84b77f89dd258653e6e0b40bcbabbf0 Binary files /dev/null and b/lib/ds/hytxt/hytxt015.o differ diff --git a/lib/ds/hytxt/hytxt016.c b/lib/ds/hytxt/hytxt016.c new file mode 100644 index 0000000000000000000000000000000000000000..0291c6bfa3c80b5d7394c4cf975df8087fd4e465 --- /dev/null +++ b/lib/ds/hytxt/hytxt016.c @@ -0,0 +1,49 @@ +/* + * FILE %ds/hytxt/hytxt016.c + * + * written: 1993-12-26 + * latest update: 1996-10-13 12:02:58 + * $Id: hytxt016.c,v 1.2 2002/01/27 23:01:40 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/hytxt.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +int hyx_extract ( +FILE *fo, +FILE *fi_hyx, +FILE *fi_idx, +FILE *fi_lut, +FILE *fi_xfn, +char *frame_name, +int verbose_mode, +int extract_flags) +{ + long size; /* size of the searched frame */ + + if (verbose_mode > 0) printf ("frame \'%s\';", frame_name); + + if ((size= hyx_seek_by_name (fi_hyx, fi_idx, fi_lut, fi_xfn, frame_name)) + < 0L) + return -1; + + if (verbose_mode > 0) printf (" transfering (%ld)...", size); + + if (extract_flags & HYXEF_add_dot) + { + fprintf (fo, "DATA %ld\n", size); + ftransfer_add_dot (fi_hyx, fo, size); + } + else + { + ftransfer (fi_hyx, fo, size); + if (extract_flags & HYXEF_append_eoln) fputc ('\n', fo); + } + + if (verbose_mode > 0) fputs (" done\n", stdout); + + return 0; +} diff --git a/lib/ds/hytxt/hytxt016.o b/lib/ds/hytxt/hytxt016.o new file mode 100644 index 0000000000000000000000000000000000000000..98e2a4385a195d96a9f1196a73d63bb5525a36d6 Binary files /dev/null and b/lib/ds/hytxt/hytxt016.o differ diff --git a/lib/ds/hytxt/hytxt017.c b/lib/ds/hytxt/hytxt017.c new file mode 100644 index 0000000000000000000000000000000000000000..e2edb28eb269f77c6865a228d0861f490e785424 --- /dev/null +++ b/lib/ds/hytxt/hytxt017.c @@ -0,0 +1,23 @@ +/* + * FILE %ds/hytxt/hytxt017.c + * + * written: 1994-02-04 + * latest update: 1996-01-01 + * + */ + +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +long hyx_get_last_index (char *fnm) +{ + struct stat st; + int rc; + + rc= stat (fnm, &st); /* index file */ + if (rc == -1) return -1L; + return (st.st_size / HYXIDX_REC_SIZE) -1L; +} diff --git a/lib/ds/hytxt/hytxt017.o b/lib/ds/hytxt/hytxt017.o new file mode 100644 index 0000000000000000000000000000000000000000..9bdf6fb4363d16a57675954a64cdbe650d3cd497 Binary files /dev/null and b/lib/ds/hytxt/hytxt017.o differ diff --git a/lib/ds/hytxt/hytxt018.c b/lib/ds/hytxt/hytxt018.c new file mode 100644 index 0000000000000000000000000000000000000000..f07c6fc20cc614186fc835d8df9ba62a38f079b3 --- /dev/null +++ b/lib/ds/hytxt/hytxt018.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/hytxt/hytxt018.c + * + * written: 1994-02-04 + * latest update: 1996-03-24 17:44:43 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <time.h> +#include <gg/dpp.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +long hyx_get_random_index (FILE *fi_idx) +{ + long siz; + long x; + + if (fi_idx == (FILE *) 0) return -1L; + + fseek (fi_idx, (long) 0, 2); + siz= ftell (fi_idx); + siz /= HYXIDX_REC_SIZE; + + x= random_long (); + + return (x % siz) + 1L; +} diff --git a/lib/ds/hytxt/hytxt018.o b/lib/ds/hytxt/hytxt018.o new file mode 100644 index 0000000000000000000000000000000000000000..94ea522e506adea10ff95f83234df1df63487a3d Binary files /dev/null and b/lib/ds/hytxt/hytxt018.o differ diff --git a/lib/ds/hytxt/hytxt019.c b/lib/ds/hytxt/hytxt019.c new file mode 100644 index 0000000000000000000000000000000000000000..4d99528ed3d72d0806abb2ab72369d3494bd912d --- /dev/null +++ b/lib/ds/hytxt/hytxt019.c @@ -0,0 +1,193 @@ +/* + * FILE %ds/hytxt/hytxt019.c + * + * update or create a frame in a HYX cluster + * + * written: 1994-06-03 + * latest update: 1996-12-03 22:14:51 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> +#include <gg/dpp.h> +#include <gg/fileio.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hyx_update ( +char *fn_hyx, +char *fn_idx, +char *fn_lut, +char *fn_xfn, +struct FILE_SEGMENT *segments, +int verbose_mode) +{ + FILE *fi_lut; + FILE *fi_xfn; + FILE *fi_idx; + FILE *fo_hyx; + struct FILE_SEGMENT *sg; + int rc= -1; + int cnt_new= 0; + int cnt_upd= 0; + long idx; + long last_idx; + long real_last_idx; + int i; + + /* check out, if something has to be done at all */ + if (segments == (struct FILE_SEGMENT *) 0) return 0; + + if ((fo_hyx= fopen (fn_hyx, "ab")) == (FILE *) 0) + { + fprintf (stderr, + "hyx_update: can\'t append to cluster file %s\n", + fn_hyx); + goto ERR1; + } + fseek (fo_hyx, (long) 0, 1); + + real_last_idx= last_idx= hyx_get_last_index (fn_idx); +/*** printf ("hyx_update: last_idx=0x%08lX\n", last_idx); ***/ + + if ((fi_idx= fopen (fn_idx, "rb")) == (FILE *) 0) + { +#ifdef JUNK + fprintf (stderr, + "hyx_update: note: can\'t read index file %s! creating it...\n", + fn_idx); +#endif /* JUNK */ + real_last_idx= last_idx= 0L; + } + + fi_lut= fopen (fn_lut, "rb"); + fi_xfn= fopen (fn_xfn, "rb"); + + /* Phase 1: find index number and transfer data to HYX file */ + for (sg= segments; sg != (struct FILE_SEGMENT *) 0; sg= sg->FS_next) + { + /* Phase 1a: get the current index of the frame, if there's any */ + idx= (sg->FS_index > 0L && sg->FS_index <= last_idx) + ? sg->FS_index + : hyx_get_index (fi_idx, fi_lut, fi_xfn, sg->FS_frame_name); + + if (idx <= 0L) /* this frame was not found in the lookup */ + { /* files, so it must be a new one... */ + idx= ++last_idx; + cnt_new++; + } + else + { + /* update handling */ + cnt_upd++; + } + + sg->FS_index= idx; + + /* Phase 1b: transfer the data to the cluster */ + if (sg->FS_size > 0L) + { + fputc ('\n', fo_hyx); + sg->FS_begin= ftell (fo_hyx); + f2transfer (sg->FS_file_name, fo_hyx, sg->FS_from, sg->FS_size); + sg->FS_end= ftell (fo_hyx) - 1L; + } + else + { +/*** printf (" DELETE\n"); ***/ + sg->FS_begin= 0L; + sg->FS_end= 0L; + } + sg->FS_cluster= 0L; + } + + fclose (fo_hyx); + fclose_or_what (fi_lut); + fclose_or_what (fi_xfn); + fclose_or_what (fi_idx); + +/*** printf ("hyx_update: upd=%d new=%d\n", cnt_upd, cnt_new); ***/ + + if (cnt_upd > 0) + { + if (verbose_mode >= 1) printf ("updating %d entries\n", cnt_upd); + + if ((fi_idx= fopen (fn_idx, "r+b")) == (FILE *) 0) + { + fprintf (stderr, + "hyx_update: error: can\'t update index file %s!\n", + fn_idx); + goto ERR1; + } + + /* Phase 2: update existing index entries */ + for (sg= segments; sg != (struct FILE_SEGMENT *) 0; sg= sg->FS_next) + { + if (sg->FS_index >= 1 && sg->FS_index <= real_last_idx) + { +/**************** +printf ("hyx_update: seeking entry 0x%lx at positition 0x%lx\n", +sg->FS_index, sg->FS_index*((long) HYXIDX_REC_SIZE)); +****************/ + fseek (fi_idx, sg->FS_index*((long) HYXIDX_REC_SIZE), 0); + dpp_fwrite_long (fi_idx, sg->FS_begin, 4); + dpp_fwrite_long (fi_idx, sg->FS_end, 4); + dpp_fwrite_long (fi_idx, sg->FS_cluster, 4); + } + } + fclose (fi_idx); + } + + if (cnt_new > 0) + { + if (verbose_mode >= 1) printf ("appending %d entries\n", cnt_new); + + if ((fi_idx= fopen (fn_idx, "ab")) == (FILE *) 0) + { + fprintf (stderr, + "hyx_update: error: can\'t append to index file %s!\n", + fn_idx); + goto ERR1; + } + + if ((fi_xfn= fopen (fn_xfn, "ab")) == (FILE *) 0) + { + fclose (fi_idx); + fprintf (stderr, + "hyx_update: error: can\'t append to xfn file %s!\n", + fn_xfn); + goto ERR1; + } + + if (real_last_idx == 0L) + for (i= 0; i < 3; i++) /* create dummy index #0 */ + dpp_fwrite_long (fi_idx, -1L, 4); + + /* Phase 3: append new index and xfn entries to those two files */ + /* note: the entries in the list should be in the right order! */ + for (sg= segments; sg != (struct FILE_SEGMENT *) 0; sg= sg->FS_next) + { +/******************** +printf ("hyx_update: sg->FS_index=%ld real_last_idx=%ld\n", +sg->FS_index, real_last_idx); +********************/ + + if (sg->FS_index > real_last_idx) + { + dpp_fwrite_long (fi_idx, sg->FS_begin, 4); + dpp_fwrite_long (fi_idx, sg->FS_end, 4); + dpp_fwrite_long (fi_idx, sg->FS_cluster, 4); + fprintf (fi_xfn, "%lx %s\n", sg->FS_index, sg->FS_frame_name); + } + } + + fclose (fi_idx); + fclose (fi_xfn); + } + + rc= 0; + +ERR1: + return rc; +} diff --git a/lib/ds/hytxt/hytxt019.o b/lib/ds/hytxt/hytxt019.o new file mode 100644 index 0000000000000000000000000000000000000000..5be72344587f18d6d72757090c4179efb3852a03 Binary files /dev/null and b/lib/ds/hytxt/hytxt019.o differ diff --git a/lib/ds/hytxt/hytxt020.c b/lib/ds/hytxt/hytxt020.c new file mode 100644 index 0000000000000000000000000000000000000000..a1a49d6c61a25b7b1947ef0d93868515670a66e5 --- /dev/null +++ b/lib/ds/hytxt/hytxt020.c @@ -0,0 +1,92 @@ +/* + * FILE %ds/hytxt/hytxt020.c + * + * create a list of frame segments by scanning a file + * + * notes: + * - frame name and file name are strdup'ed, if they're specified + * + * written: 1994-06-04 + * latest update: 1996-10-13 16:04:34 + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/hytxt.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +struct FILE_SEGMENT *hyx_make_segment ( +struct FILE_SEGMENT **fs_app, +char *fn, /* contents source file name */ +char *frame_name, /* selected frame name */ +long *index_number, /* index number chosen for the frame */ +int operation, +long fs_from, +long fs_size) +{ + struct FILE_SEGMENT *fs= (struct FILE_SEGMENT *) 0; + struct HYTXT_FRAME *fd= (struct HYTXT_FRAME *) 0; + struct HYTXT_FRAME *fd2; + long index_nmbr; + int rc; + + index_nmbr= (index_number == (long *) 0) ? 0L : *index_number; + + if (frame_name == (char *) 0) + { +printf ("hyx_make_segment: fn='%s'\n", fn); + rc= hytxt_scan (fn, &fd, HYXSM_hide_earlier|HYXSM_no_attributes); +printf ("rc=%d\n", rc); + + if (rc >= 0) + { + while ((fd2= fd) != (struct HYTXT_FRAME *) 0) + { + if ((fs= hyx_new_file_segment ()) == (struct FILE_SEGMENT *) 0) + { +ERR: + fprintf (stderr, "hyx_make_segment: no memory!\n"); + return (struct FILE_SEGMENT *) 0; + } + + fs->FS_frame_name= fd->hytxt_frame_name; + fs->FS_file_name= strdup (fn); + fs->FS_from= fd->hytxt_frame_pos_beg; + fs->FS_size= fd->hytxt_frame_pos_end - fd->hytxt_frame_pos_beg + 1L; + fs->FS_operation= operation; + if (index_nmbr > 0L) fs->FS_index= index_nmbr++; + + *fs_app= fs; + fs_app= &fs->FS_next; + + fd->hytxt_frame_name= (char *) 0; /* dont free! frame name */ + /* gets reused */ + fd= fd->hytxt_frame_next; + free_HYTXT_FRAME (fd2); + } + } + } + else + { + if ((fs= hyx_new_file_segment ()) == (struct FILE_SEGMENT *) 0) goto ERR; + + if ((fs->FS_frame_name= hyx_translate_special_frame (frame_name)) + == (char *) 0) + fs->FS_frame_name= strdup (frame_name); + + fs->FS_operation= operation; + if (fn != (char *) 0) fs->FS_file_name= strdup (fn); + if (index_nmbr > 0L) fs->FS_index= index_nmbr++; + + fs->FS_from= fs_from; + fs->FS_size= fs_size; + *fs_app= fs; + } + + if (index_number != (long *) 0) *index_number= index_nmbr; + + return fs; +} diff --git a/lib/ds/hytxt/hytxt020.o b/lib/ds/hytxt/hytxt020.o new file mode 100644 index 0000000000000000000000000000000000000000..8761fcdd11c1eef42687ad2ddfbea44499c35156 Binary files /dev/null and b/lib/ds/hytxt/hytxt020.o differ diff --git a/lib/ds/hytxt/hytxt021.c b/lib/ds/hytxt/hytxt021.c new file mode 100644 index 0000000000000000000000000000000000000000..12e3caa440d7801e1dc91c548f3ce475ee153616 --- /dev/null +++ b/lib/ds/hytxt/hytxt021.c @@ -0,0 +1,29 @@ +/* + * FILE ~/usr/sgml/hytxt021.c + * + * destroy a list of frame segments (just the data structures) + * + * written: 1994-06-19 + * latest update: 1995-07-09 + * + */ + +#include <stdlib.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hyx_destroy_segments (struct FILE_SEGMENT *fs) +{ + struct FILE_SEGMENT *fs2; + + while (fs != (struct FILE_SEGMENT *) 0) + { + fs2= fs->FS_next; + if (fs->FS_frame_name != (char *) 0) free (fs->FS_frame_name); + if (fs->FS_file_name != (char *) 0) free (fs->FS_file_name); + free (fs); + fs= fs2; + } + + return 0; +} diff --git a/lib/ds/hytxt/hytxt021.o b/lib/ds/hytxt/hytxt021.o new file mode 100644 index 0000000000000000000000000000000000000000..48186f6d15bad2dde5afb3701aec584b62b5c221 Binary files /dev/null and b/lib/ds/hytxt/hytxt021.o differ diff --git a/lib/ds/hytxt/hytxt022.c b/lib/ds/hytxt/hytxt022.c new file mode 100644 index 0000000000000000000000000000000000000000..97a922fa61cf80a0ee1eb7952f4b2202d72c29b5 --- /dev/null +++ b/lib/ds/hytxt/hytxt022.c @@ -0,0 +1,42 @@ +/* + * FILE %ds/hytxt/hytxt022.c + * + * written: 1994-07-10 extracted from %sgml/hytxt016.c + * latest update: 1996-03-24 17:42:25 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +long hyx_get_index ( +FILE *fi_idx, +FILE *fi_lut, +FILE *fi_xfn, +char *frame_name) +{ + long idx= -1L; + + if (strcmp ("$$random", frame_name) == 0) + { + idx= hyx_get_random_index (fi_idx); + } + else + if (frame_name [0] == '$' && frame_name [1] == '#') + { + idx= get_parameter_value (frame_name+2); + } + else + { + if (fi_lut != (FILE *) 0) + idx= find_frame_lut (fi_lut, frame_name); + + if (idx == -1L && fi_xfn != (FILE *) 0) + idx= find_frame_xfn (fi_xfn, frame_name); + } + + return idx; +} diff --git a/lib/ds/hytxt/hytxt022.o b/lib/ds/hytxt/hytxt022.o new file mode 100644 index 0000000000000000000000000000000000000000..91547c5a81af07e4951aaa1a6b7cc94481667bf0 Binary files /dev/null and b/lib/ds/hytxt/hytxt022.o differ diff --git a/lib/ds/hytxt/hytxt023.c b/lib/ds/hytxt/hytxt023.c new file mode 100644 index 0000000000000000000000000000000000000000..3233c3a260389e010f2084e1f8ffa4f53d2882bc --- /dev/null +++ b/lib/ds/hytxt/hytxt023.c @@ -0,0 +1,53 @@ +/* + * FILE ~/usr/sgml/hytxt023.c + * + * written: 1994-07-17 + * latest update: 1994-07-17 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +static struct HYTXT_FRAME frame; +static char frame_name [1024]; + +/* ------------------------------------------------------------------------ */ +int hytxt_scan_file (FILE *fo, char *fn) +{ + FILE *hyx; /* HYX file currently scanned */ + long hyx_pos= 0L; /* position of frame beginning in file */ + long act_length; /* length of the scanned frame */ + long act_index; /* the number of the frame within the */ + /* cluster without taking note of */ + /* duplicated frames */ + int rc; /* return code from frame scanning */ + char md5_str [34]; /* MD5 checksum for the given frame */ + + if ((hyx= fopen (fn, "rb")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", fn); + return -2; + } + + frame.hytxt_frame_name= frame_name; + + for (act_index= 1L;; act_index++) + { + rc= hytxt_scan_entry (hyx, &hyx_pos, &frame, + HYXSM_no_attributes|HYXSM_no_allocation, + md5_str); + if (rc != 0) break; + + act_length= frame.hytxt_frame_pos_end - frame.hytxt_frame_pos_beg + 1L; + fprintf (fo, "0x%08lX 0x%08lX 0x%08lX %s %s\n", + act_index, frame.hytxt_frame_pos_beg, + act_length, md5_str, frame_name); + } + + fclose (hyx); + + return 0; +} diff --git a/lib/ds/hytxt/hytxt023.o b/lib/ds/hytxt/hytxt023.o new file mode 100644 index 0000000000000000000000000000000000000000..017b66950627dafb53446cc551282d4f8c6c310c Binary files /dev/null and b/lib/ds/hytxt/hytxt023.o differ diff --git a/lib/ds/hytxt/hytxt024.c b/lib/ds/hytxt/hytxt024.c new file mode 100644 index 0000000000000000000000000000000000000000..75e7aac0dc0f682a371ab8f9d467ad9b0b741d00 --- /dev/null +++ b/lib/ds/hytxt/hytxt024.c @@ -0,0 +1,65 @@ +/* + * FILE %ds/hytxt/hytxt024.c + * + * linearize hypertext frames + * see t2d for information about future enhancements + * + * written: 1991 07 20 + * 1992 12 07: revision + * latest update: 1999-04-25 16:57:39 + * $Id: hytxt024.c,v 1.3 2002/01/27 23:01:40 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/hytxt.h> +#include <gg/sbr.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +int hyx_seq ( +FILE *fo, +char *fnm_hyx, +struct FILE_SEGMENT *fs_list, +int verbose_level, +int extract_flags) +{ + int rc; + char *afn_hyx; + char *fnm_idx; + char *fnm_lut; + char *fnm_xfn; + + if (fnm_hyx == (char *) 0 || !*fnm_hyx) return -2; + + if ((afn_hyx= translate_logic_filename (fnm_hyx)) == (char *) 0) + afn_hyx= fnm_hyx; + + fnm_idx= fnmcpy2 (afn_hyx, ".idx"); + fnm_lut= fnmcpy2 (afn_hyx, ".lut"); + fnm_xfn= fnmcpy2 (afn_hyx, ".xfn"); + + if (verbose_level > 0) + { + printf ("HYX (?): %s\n", afn_hyx); + printf ("IDX (?): %s\n", fnm_idx); + printf ("LUT (?): %s\n", fnm_lut); + printf ("XFN (?): %s\n", fnm_xfn); + } + + rc= hyx_sequencer ( + (fo == (FILE *) 0) ? (FILE *) stdout : fo, + afn_hyx, fnm_idx, fnm_lut, fnm_xfn, + fs_list, verbose_level, extract_flags); + + flclose_all (); + + free (afn_hyx); + free (fnm_idx); + free (fnm_lut); + free (fnm_xfn); + + return rc; +} diff --git a/lib/ds/hytxt/hytxt024.o b/lib/ds/hytxt/hytxt024.o new file mode 100644 index 0000000000000000000000000000000000000000..33d2f558bc4e1eeb8e58bbafdff234a001ccc66b Binary files /dev/null and b/lib/ds/hytxt/hytxt024.o differ diff --git a/lib/ds/hytxt/hytxt025.c b/lib/ds/hytxt/hytxt025.c new file mode 100644 index 0000000000000000000000000000000000000000..2c21e9dd4cf23f689081af55ba40c83e1aaa9e0e --- /dev/null +++ b/lib/ds/hytxt/hytxt025.c @@ -0,0 +1,62 @@ +/* + * FILE %sgml/hytxt025.c + * + * purge hypertext clusters + * + * written: 1991 02 16 + * 1992 12 07: revision + * 1994-10-23: isolated from hyxpurge.c + * latest update: 1999-04-25 16:57:48 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/hytxt.h> +#include <gg/filename.h> + +#ifndef MSDOS +#include <unistd.h> +#endif + +/* ------------------------------------------------------------------------ */ +int hyx_purge (char *hyx_in, int verbose_level) +{ + int rc; + char *afn; + char *hyx_out; + char *idx_in; + char *idx_out; + char *xx; + + if (hyx_in == (char *) 0 || !*hyx_in) return -2; + + if ((afn= translate_logic_filename (hyx_in)) == (char *) 0) afn= hyx_in; + hyx_out= fnmcpy2 (afn, ".h@x"); + idx_in= fnmcpy2 (afn, ".idx"); + idx_out= fnmcpy2 (afn, ".i@x"); + + rc= hyx_purge2 (idx_in, idx_out, afn, hyx_out, verbose_level); + + if (rc == 0) + { + xx= fnmcpy2 (afn, ".@hx"); + unlink (xx); + rename (afn, xx); + rename (hyx_out, afn); + free (xx); + + xx= fnmcpy2 (hyx_out, ".@ix"); + unlink (xx); + rename (idx_in, xx); + rename (idx_out, idx_in); + free (xx); + } + + free (afn); + free (hyx_out); + free (idx_in); + free (idx_out); + + return rc; +} diff --git a/lib/ds/hytxt/hytxt025.o b/lib/ds/hytxt/hytxt025.o new file mode 100644 index 0000000000000000000000000000000000000000..b7c65c442fb8097a4e0671417740edfd03857e56 Binary files /dev/null and b/lib/ds/hytxt/hytxt025.o differ diff --git a/lib/ds/hytxt/hytxt026.c b/lib/ds/hytxt/hytxt026.c new file mode 100644 index 0000000000000000000000000000000000000000..868cdf3cf8c49b01d6e0960a0afc866cb21a42c4 --- /dev/null +++ b/lib/ds/hytxt/hytxt026.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/hytxt/hytxt026.c + * + * seek a frame by name + * + * see also: hyx_seek_by_index () + * hcc_seek_by_name () + * + * written: 1993-12-26 + * latest update: 1996-03-24 18:46:41 + * $Id: hytxt026.c,v 1.2 2002/01/27 23:01:40 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +long hyx_seek_by_name ( +FILE *fi_hyx, +FILE *fi_idx, +FILE *fi_lut, +FILE *fi_xfn, +char *frame_name) +{ + long size= -1L; + long idx; + char *alt_name= (char *) 0; + + if ((alt_name= hyx_translate_special_frame (frame_name)) != (char *) 0) + frame_name= alt_name; + + if ((idx= hyx_get_index (fi_idx, fi_lut, fi_xfn, frame_name)) > 0L) + size= hyx_seek_by_index (fi_hyx, fi_idx, idx); + + free_or_what (alt_name); + return size; +} diff --git a/lib/ds/hytxt/hytxt026.o b/lib/ds/hytxt/hytxt026.o new file mode 100644 index 0000000000000000000000000000000000000000..42ba20b86e54aa28454a253eaf1c9f90806bc445 Binary files /dev/null and b/lib/ds/hytxt/hytxt026.o differ diff --git a/lib/ds/hytxt/hytxt027.c b/lib/ds/hytxt/hytxt027.c new file mode 100644 index 0000000000000000000000000000000000000000..d19cd8b5a0688496119c5a89979d7e7e569f367c --- /dev/null +++ b/lib/ds/hytxt/hytxt027.c @@ -0,0 +1,42 @@ +/* + * FILE ~/usr/sgml/hytxt027.c + * + * written: 1994-11-30 + * latest update: 1995-07-09 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hyx_print_segment ( +FILE *fo, +struct FILE_SEGMENT *fs) +{ + char *last_file_name= (char *) 0; + char *fs_fnm; + + for (; fs != (struct FILE_SEGMENT *) 0; fs= fs->FS_next) + { + if ((fs_fnm= fs->FS_file_name) != (char *) 0 + && (last_file_name == (char *) 0 + || (last_file_name != (char *) 0 + && strcmp (last_file_name, fs_fnm) != 0))) + fprintf (fo, "FILE %s\n", fs_fnm); + + last_file_name= fs_fnm; + + fprintf (fo, "0x%08lX 0x%08lX 0x%08lX 0x%08lX 0x%08lX 0x%08lX %c", + fs->FS_index, fs->FS_begin, fs->FS_end, fs->FS_cluster, + fs->FS_from, fs->FS_size, fs->FS_operation); + + if ((fs_fnm= fs->FS_frame_name) != (char *) 0) + fprintf (fo, " %s", fs_fnm); + + fputc ('\n', fo); + } + + return 0; +} diff --git a/lib/ds/hytxt/hytxt027.o b/lib/ds/hytxt/hytxt027.o new file mode 100644 index 0000000000000000000000000000000000000000..e748af4df734c394c6939e2e05567493dc3c58bd Binary files /dev/null and b/lib/ds/hytxt/hytxt027.o differ diff --git a/lib/ds/hytxt/hytxt028.c b/lib/ds/hytxt/hytxt028.c new file mode 100644 index 0000000000000000000000000000000000000000..153e3c10629596ddc70371c96c84d84485e9bd0d --- /dev/null +++ b/lib/ds/hytxt/hytxt028.c @@ -0,0 +1,65 @@ +/* + * FILE %ds/hytxt/hytxt028.c + * + * written: 1994-12-11 + * latest update: 1996-10-09 21:27:54 + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/dpp.h> +#include <gg/strings.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +static char *buffer= (char *) 0; +static int buffer_size= 0; + +/* ------------------------------------------------------------------------ */ +int hyx_setup_segment ( +struct FILE_SEGMENT **app_segments, +struct FILE_SEGMENT **fs_new, +char *x_line, +long *index_number) +{ + struct FILE_SEGMENT *fs; + int xl; +#define N_FIELDS 4 + char *fields [N_FIELDS]; + int cnt_fields; + long f_beg; + long f_end; + long f_siz; + + if ((xl= strlen (x_line)) > buffer_size) + { + if (buffer != (char *) 0) free (buffer); + buffer= malloc (xl+1); + buffer_size= xl; + } + + if (buffer == (char *) 0) return -1; + strcpy (buffer, x_line); + cnt_fields= split_string (buffer, ';', fields, N_FIELDS); + + if (cnt_fields < 4) return -1; + f_beg= (strcmp (fields [0], "-") == 0) + ? 0L : get_parameter_value (fields [0]); + f_end= (strcmp (fields [1], "-") == 0) + ? 0x7FFFFFFEL : get_parameter_value (fields [0]); + f_siz= f_end - f_beg +1L; + +printf ("hyx_setup_segment: file=%s\n", fields [2]); +printf ("hyx_setup_segment: frame=%s\n", fields [3]); +printf ("hyx_setup_segment: begin=0x%08lX size=0x%08lX\n", f_beg, f_siz); + + if ((fs= hyx_make_segment (app_segments, fields [2], fields [3], + index_number, FSop_update, f_beg, f_siz)) + == (struct FILE_SEGMENT *) 0) return -1; + + *fs_new= fs; + + return 0; +} diff --git a/lib/ds/hytxt/hytxt028.o b/lib/ds/hytxt/hytxt028.o new file mode 100644 index 0000000000000000000000000000000000000000..981b71e6bd929d7610d78f6775d6dd90c90d45d5 Binary files /dev/null and b/lib/ds/hytxt/hytxt028.o differ diff --git a/lib/ds/hytxt/hytxt029.c b/lib/ds/hytxt/hytxt029.c new file mode 100644 index 0000000000000000000000000000000000000000..81e26d5c11e4c675cb46e0e0663ea11ebbdf7710 --- /dev/null +++ b/lib/ds/hytxt/hytxt029.c @@ -0,0 +1,65 @@ +/* + * FILE %ds/hytxt/hytxt029.c + * + * linearize hypertext frames + * see t2d for information about future enhancements + * + * written: 1991 07 20 + * 1992 12 07: revision + * latest update: 1999-04-25 16:57:53 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/hytxt.h> +#include <gg/sbr.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +int hyx_thr ( +FILE *fo, +char *fnm_hyx, +struct FILE_SEGMENT *fs_list, +int verbose_level, +int extract_flags, +char *wanted_thread) +{ + int rc; + char *afn_hyx; + char *fnm_idx; + char *fnm_lut; + char *fnm_xfn; + + if (fnm_hyx == (char *) 0 || !*fnm_hyx) return -2; + + if ((afn_hyx= translate_logic_filename (fnm_hyx)) == (char *) 0) + afn_hyx= fnm_hyx; + + fnm_idx= fnmcpy2 (afn_hyx, ".idx"); + fnm_lut= fnmcpy2 (afn_hyx, ".lut"); + fnm_xfn= fnmcpy2 (afn_hyx, ".xfn"); + + if (verbose_level > 0) + { + printf ("HYX (?): %s\n", afn_hyx); + printf ("IDX (?): %s\n", fnm_idx); + printf ("LUT (?): %s\n", fnm_lut); + printf ("XFN (?): %s\n", fnm_xfn); + } + + rc= hyx_threader ( + (fo == (FILE *) 0) ? (FILE *) stdout : fo, + afn_hyx, fnm_idx, fnm_lut, fnm_xfn, + fs_list, verbose_level, extract_flags, wanted_thread); + + flclose_all (); + + free (afn_hyx); + free (fnm_idx); + free (fnm_lut); + free (fnm_xfn); + + return rc; +} diff --git a/lib/ds/hytxt/hytxt029.o b/lib/ds/hytxt/hytxt029.o new file mode 100644 index 0000000000000000000000000000000000000000..cf46847a1ad6ecc63b8d22f9d4b5f69a103c0259 Binary files /dev/null and b/lib/ds/hytxt/hytxt029.o differ diff --git a/lib/ds/hytxt/hytxt030.c b/lib/ds/hytxt/hytxt030.c new file mode 100644 index 0000000000000000000000000000000000000000..8bce200e135f644e9b10eee7262a8faabe91c78b --- /dev/null +++ b/lib/ds/hytxt/hytxt030.c @@ -0,0 +1,180 @@ +/* + * FILE %ds/hytxt/hytxt030.c + * + * written: 1991 07 20 + * 1994-06-03: old version sequencer removed + * 1994-06-19: sequencer uses list of FILE_SEGMENTs + * latest update: 1999-05-02 13:18:46 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/hytxt.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/fileio.h> +#include <gg/filename.h> +#include <contrib/md5gg.h> + +static char tmp []= "@@TMP@@.THR"; + +/* ------------------------------------------------------------------------ */ +int hyx_threader ( +FILE *fo, +char *fnm_hyx, +char *fnm_idx, +char *fnm_lut, +char *fnm_xfn, +struct FILE_SEGMENT *fseg, +int verbose_mode, +int extract_flags, +char *wanted_thread) +{ + int rv; + int rc; + int ch; + FILE *fo_tmp= (FILE *) 0; /* temporary output file */ + FILE *fi= (FILE *) 0; /* file containing frame list */ + FILE *fi_hyx= (FILE *) 0; /* cluster file */ + FILE *fi_idx= (FILE *) 0; /* index file */ + FILE *fi_lut= (FILE *) 0; /* lookup table file */ + FILE *fi_xfn= (FILE *) 0; /* extra lookup table file */ +#define FRAME_strlng 260 + char frame [FRAME_strlng]; /* buffer for a frame name from list */ + char *frame_ptr; + char *fseg_name; + int fseg_op; + long last_index; + long cnt; + + rv= -1; + if ((last_index= hyx_get_last_index (fnm_idx)) <= 0L + || (fi_hyx= flopen (fnm_hyx, "rb")) == (FILE *) 0 + || (fi_idx= flopen (fnm_idx, "rb")) == (FILE *) 0 + || ((fi_lut= flopen (fnm_lut, "rb")) == (FILE *) 0 + && (fi_xfn= flopen (fnm_xfn, "rb")) == (FILE *) 0 + ) + ) goto END; + + rv= 0; + + for (; fseg != (struct FILE_SEGMENT *) 0; fseg= fseg->FS_next) + { + fseg_name= fseg->FS_frame_name; + fseg_op= fseg->FS_operation; + if (verbose_mode > 0) printf ("%c: %s\n", fseg_op, fseg_name); + /* print operation code and name of first extracted frame */ + + switch (fseg_op) + { + case 'l': case 'L': /* list of frames in a file */ + if (verbose_mode > 0) + printf ("transfering frames from logic file '%s'\n", fseg_name); + if ((fi= (strcmp (fseg_name, "-") == 0) + ? ((FILE *) stdin) + : fopen (translate_logic_filename (fseg_name), "rt")) + == (FILE *) 0) return -1; +PROC_LIST: + for (;;) + { +NEXT: + rc= fread_line (fi, frame, FRAME_strlng); + if ((rc <= 0 && feof (fi)) || strcmp (frame, ".") == 0) break; + frame_ptr= frame; +NEXT_TRY: + switch (*frame_ptr) + { + case '<': /* ############ */ + do + { + ch= *frame_ptr++ & 0x00FF; + if (ch == 0) goto NEXT; + } while (ch != '>'); + goto NEXT_TRY; + + case 0: + case '#': + case 0x0D: + case 0x0A: + goto NEXT; + } + + if (hyx_thr_extract (fo, fi_hyx, fi_idx, fi_lut, fi_xfn, frame_ptr, + verbose_mode, extract_flags, wanted_thread) != 0) + { + fprintf (stderr, "error: frame \"%s\" not found in %s!\n", + frame, fnm_hyx); + continue; + } + } + if (strcmp (fseg_name, "-") != 0) fclose (fi); + break; + + case 'f': case 'F': /* list of frames is in the frame */ + if (verbose_mode > 0) + printf ("transfering frames from frame '%s', tmp_file=%s\n", + fseg_name, tmp); + + if ((fo_tmp= fopen (tmp, "wb")) == (FILE *) 0) + { +ERR1: + fprintf (stderr, "error: can\'t open tmpfile\n"); + goto END; + } + if (hyx_thr_extract (fo_tmp, fi_hyx, fi_idx, fi_lut, fi_xfn, + fseg_name, verbose_mode, extract_flags, + wanted_thread) != 0) + fflush (fo_tmp); + rc= fclose (fo_tmp); + if ((fi= fopen (tmp, "rt")) == (FILE *) 0) goto ERR1; + goto PROC_LIST; + break; + + case 'm': case 'M': + fseg_name= MD5check_string ((unsigned char *) fseg_name); + + case 'x': case 'X': /* extract just one named frame */ + if (verbose_mode > 0) + printf ("transfering single frame '%s'\n", fseg_name); + if (hyx_thr_extract (fo, fi_hyx, fi_idx, fi_lut, fi_xfn, + fseg_name, verbose_mode, extract_flags, + wanted_thread) != 0) + { + fprintf (stderr, + "error: frame \"%s\" not found in %s!\n", + fseg_name, fnm_hyx); + goto END; + } + break; + + case 't': case 'T': /* total recall: extract all frames */ + if (verbose_mode > 0) + printf ("transfering *ALL* frames\n"); + for (cnt= 1L; cnt <= last_index; cnt++) + { + sprintf (frame, "$#%ld", cnt); + if (hyx_thr_extract (fo, fi_hyx, fi_idx, fi_lut, fi_xfn, + frame, verbose_mode, extract_flags, + wanted_thread) != 0) + { + fprintf (stderr, + "error: frame \"%s\" not found in %s!\n", + fseg_name, fnm_hyx); + goto END; + } + } + break; + } + } + +END: +#ifndef NOT_USED + fclose_or_what (fi_xfn); + fclose_or_what (fi_lut); + fclose_or_what (fi_idx); + fclose_or_what (fi_hyx); +#endif + + return rv; +} diff --git a/lib/ds/hytxt/hytxt030.o b/lib/ds/hytxt/hytxt030.o new file mode 100644 index 0000000000000000000000000000000000000000..f07900b336af879c062199441505dcc4134ed1b7 Binary files /dev/null and b/lib/ds/hytxt/hytxt030.o differ diff --git a/lib/ds/hytxt/hytxt031.c b/lib/ds/hytxt/hytxt031.c new file mode 100644 index 0000000000000000000000000000000000000000..0b7c31a7d370ea397c80834a566fe0059794a302 --- /dev/null +++ b/lib/ds/hytxt/hytxt031.c @@ -0,0 +1,69 @@ +/* + * FILE %ds/hytxt/hytxt031.c + * + * written: 1995-05-21 + * latest update: 1996-03-24 17:47:31 + * $Id: hytxt031.c,v 1.2 2002/01/27 23:01:41 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/sbr.h> +#include <gg/sgml.h> +#include <gg/parse.h> +#include <gg/hytxt.h> + +static long end_tags [] = { SGML_TAG_endframe }; + +/* ------------------------------------------------------------------------ */ +int hyx_thr_extract ( +FILE *fo, +FILE *fi_hyx, +FILE *fi_idx, +FILE *fi_lut, +FILE *fi_xfn, +char *frame_name, +int verbose_mode, +int extract_flags, +char *wanted_thread) +{ + struct TEXT_ELEMENT *te= (struct TEXT_ELEMENT *) 0; + struct HYX_PARSER_CLASS *hpc; + long chars_read; + long size; + int rc; + + if (verbose_mode > 0) printf ("frame \'%s\';", frame_name); + + if ((size= hyx_seek_by_name (fi_hyx, fi_idx, fi_lut, fi_xfn, frame_name)) + < 0L + || (hpc= hyx_init_parser_class ()) == (struct HYX_PARSER_CLASS *) 0 + ) + return -1; + + if (verbose_mode > 0) printf (" transfering (%ld)...", size); + + if (extract_flags & HYXEF_write_frame_name) + { + fputs (frame_name, stdout); + fputc ('\n', stdout); + } + + rc= hyx_parse1_file (hpc, fi_hyx, &te, end_tags, 1, size, &chars_read); + + if (rc == 0 && chars_read > 0L) + { + hyx_thr_process (fo, fi_hyx, fi_idx, fi_lut, fi_xfn, + verbose_mode, extract_flags, wanted_thread, + te, 0, 0); + + /* ftransfer (fi_hyx, fo, size); */ + + if (extract_flags & HYXEF_append_eoln) fputc ('\n', fo); + } + + if (verbose_mode > 0) fputs (" done\n", stdout); + hyx_frtx_elem_list (te); + + return 0; +} diff --git a/lib/ds/hytxt/hytxt031.o b/lib/ds/hytxt/hytxt031.o new file mode 100644 index 0000000000000000000000000000000000000000..d3e21bdfb0efff2a7b858bea5eca6baed41e9973 Binary files /dev/null and b/lib/ds/hytxt/hytxt031.o differ diff --git a/lib/ds/hytxt/hytxt032.c b/lib/ds/hytxt/hytxt032.c new file mode 100644 index 0000000000000000000000000000000000000000..3b33e146d710c8d4d625bfe167d62c4a3482abcf --- /dev/null +++ b/lib/ds/hytxt/hytxt032.c @@ -0,0 +1,145 @@ +/* + * FILE %sgml/hytxt032.c + * + * print markup structure + * + * written: 1991 03 31 + * latest update: 1995-08-21 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/parse.h> +#include <gg/strings.h> +#include <gg/hyx.h> +#include <gg/hytxt.h> + +#ifdef DIAGNOSTIC +#define print_text_segment_list diag_print_text_segment_list +#define display_markup diag_display_markup +#endif + +static char thread_name [1024]; +static char frame_name [1024]; + +/* ------------------------------------------------------------------------ */ +static void xx_print (FILE *fo, struct TEXT_ELEMENT *t, char *txt) +{ +#ifdef DIAGNOSTIC + struct TAG_DEFINITION *td; +#endif /* DIAGNOSTIC */ + + txt; + + if (t == (struct TEXT_ELEMENT *) 0) return; + + /* fprintf (fo, "%s: ", txt); */ + for (; t != (struct TEXT_ELEMENT *) 0; t= t->TE_next) + { +#ifdef DIAGNOSTIC + if ((td= t->TE_tag_definition) != (struct TAG_DEFINITION *) 0) + { + fputc ('[', fo); + display_tag_definition (fo, td); + fputc (']', fo); + } +#endif /* DIAGNOSTIC */ + + if (t->sig == SIG_TEXT_ELEMENT) + { + fprintf (fo, "<"); + print_text_segment_list (fo, t->TE_text_segment); + fprintf (fo, ">"); + } + } + fprintf (fo, "\n"); +} + +/* ------------------------------------------------------------------------ */ +void hyx_thr_process ( +FILE *fo, +FILE *fi_hyx, +FILE *fi_idx, +FILE *fi_lut, +FILE *fi_xfn, +int verbose_mode, +int extract_flags, +char *wanted_thread, +struct TEXT_ELEMENT *t, +int verbosity, +int append_eoln) +{ +#ifdef DIAGNOSTIC + struct TAG_DEFINITION *td; +#endif /* DIAGNOSTIC */ + struct MARKUP *m; + int item= 0; + struct TEXT_SEGMENT *ts; + char *cp; + + for (; t != (struct TEXT_ELEMENT *) 0; t= t->TE_next) + { + item++; + + if (t->sig == SIG_TEXT_ELEMENT) + { + /***** + fprintf (fo, "[%2d] TEXT_ELEMENT (%ld) ", item, t->TE_level); + *******/ + if (t->TE_level == 0) + { + print_text_segment_list (fo, t->TE_text_segment); + if (append_eoln) fputc ('\n', fo); + } else + if (t->TE_level == 1) + { + fputc ('<', fo); + ts= t->TE_text_segment; + print_text_segment_list (fo, ts); + fputc ('>', fo); +/* fputs ("*********", fo); */ + if (ts != (struct TEXT_SEGMENT *) 0 + && (cp= ts->TSEG_text_array) != (char *) 0 + && strncmp (cp, "hyx.l ", 6) == 0 + && find_attr_value (cp, frame_name, 256, "fr") == 0 + && find_attr_value (cp, thread_name, 256, "thr") == 0 + && strcmp (thread_name, wanted_thread) == 0) + { + fputc ('\n', fo); + hyx_thr_extract (fo, fi_hyx, fi_idx, fi_lut, fi_xfn, frame_name, + verbose_mode, extract_flags, wanted_thread); + fputs ("\n%%", fo); + } + if (append_eoln) fputc ('\n', fo); + } + } + else + if (t->sig == SIG_MARKUP) + { + m= (struct MARKUP *) t; + + if (verbosity > 0) + { + xx_print (fo, (struct TEXT_ELEMENT *) m->tag_open, "Start"); + } + + hyx_thr_process (fo, fi_hyx, fi_idx, fi_lut, fi_xfn, + verbose_mode, extract_flags, wanted_thread, + m->tagged_text, verbosity, append_eoln); + + if (m->tag_close != (void *) 0) + { + if (verbosity > 0) + { + xx_print (fo, (struct TEXT_ELEMENT *) m->tag_close, "Stop "); + } + } + } + else + { + fprintf (fo, "[%2d] unknown element in list! sig=%d\n", item, t->sig); + return; + } + } +} diff --git a/lib/ds/hytxt/hytxt032.o b/lib/ds/hytxt/hytxt032.o new file mode 100644 index 0000000000000000000000000000000000000000..f2123f4115479d804e4bd889175f3acca5c9bb75 Binary files /dev/null and b/lib/ds/hytxt/hytxt032.o differ diff --git a/lib/ds/hytxt/hytxt033.c b/lib/ds/hytxt/hytxt033.c new file mode 100644 index 0000000000000000000000000000000000000000..86fadbcb34f49df18359649512622695323fae57 --- /dev/null +++ b/lib/ds/hytxt/hytxt033.c @@ -0,0 +1,56 @@ +/* + * FILE %ds/hytxt/hytxt033.c + * + * written: 1995-06-25 + * latest update: 1997-11-01 12:43:41 + * + */ + +#include <stdio.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hyx_update_index ( +char *index_file, +long li_begin, +long li_end, +long li_cluster_number, +long *frame_index, +long *next_index) +{ + FILE *fidx; /* Index File */ + + if (*frame_index < *next_index) + { /* Update fuer alten Index */ + long position; /* Filepointer Position innerhalb des */ + /* Index Files, bzw. des Lexicon Files */ + + if ((fidx= flopen (index_file, "r+b")) == (FILE *) 0) return -1; + + position= *frame_index * ((long) HYXIDX_REC_SIZE); + fseek (fidx, position, 0); + dpp_fwrite_long (fidx, li_begin, 4); + dpp_fwrite_long (fidx, li_end, 4); + dpp_fwrite_long (fidx, li_cluster_number, 4); + } + else + { + if ((fidx= flopen (index_file, "ab")) == (FILE *) 0) return -1; + + for (; *next_index < *frame_index; (*next_index)++) + { + dpp_fwrite_long (fidx, -1L, 4); + dpp_fwrite_long (fidx, -1L, 4); + dpp_fwrite_long (fidx, -1L, 4); + } + + dpp_fwrite_long (fidx, li_begin, 4); + dpp_fwrite_long (fidx, li_end, 4); + dpp_fwrite_long (fidx, li_cluster_number, 4); + (*next_index)++; + } + + return 0; +} diff --git a/lib/ds/hytxt/hytxt033.o b/lib/ds/hytxt/hytxt033.o new file mode 100644 index 0000000000000000000000000000000000000000..1df6bf69d2e97e650d8e808d4df68d019829ce72 Binary files /dev/null and b/lib/ds/hytxt/hytxt033.o differ diff --git a/lib/ds/hytxt/hytxt034.c b/lib/ds/hytxt/hytxt034.c new file mode 100644 index 0000000000000000000000000000000000000000..d112f0b288062f2afa03eac652d9f7603bccfa33 --- /dev/null +++ b/lib/ds/hytxt/hytxt034.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/hytxt/hytxt034.c + * + * written: 1996-07-09 + * latest update: 1996-10-09 21:31:18 + * + */ + +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hyx_setup_delete_segment ( +struct FILE_SEGMENT **app_segments, +struct FILE_SEGMENT **fs_new, +char *frame_name, +long *index_number) +{ + struct FILE_SEGMENT *fs; + + if (frame_name == (char *) 0) return -1; + + if ((fs= hyx_make_segment (app_segments, (char *) 0, frame_name, + index_number, FSop_delete, 0L, 0L)) + == (struct FILE_SEGMENT *) 0) return -1; + + *fs_new= fs; + + return 0; +} diff --git a/lib/ds/hytxt/hytxt034.o b/lib/ds/hytxt/hytxt034.o new file mode 100644 index 0000000000000000000000000000000000000000..511e229cde4c00aeb495016560d00ba7d9907888 Binary files /dev/null and b/lib/ds/hytxt/hytxt034.o differ diff --git a/lib/ds/hytxt/hytxt035.c b/lib/ds/hytxt/hytxt035.c new file mode 100644 index 0000000000000000000000000000000000000000..09a2672f50bfcee9f4cda12ebee5ca50b2e6c4ee --- /dev/null +++ b/lib/ds/hytxt/hytxt035.c @@ -0,0 +1,36 @@ +/* + * FILE %ds/hytxt/hytxt035.c + * + * seek a frame by index + * see also: hyx_seek_by_name () + * + * written: 1995-12-05 + * latest update: 1996-10-13 15:40:28 + * + */ + +#include <stdio.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +long hyx_seek_by_index ( +FILE *fi_hyx, +FILE *fi_idx, +long idx) +{ + long beg; /* begin position in cluster */ + long end; /* end position in cluster */ + long cln; /* cluster number */ + + if (deref_index (fi_idx, idx, &beg, &end, &cln) == 0 + && beg >= 0L + && end >= 0L + && end > beg + ) + { + fseek (fi_hyx, beg, 0); + return end-beg+1L; + } + + return -1L; +} diff --git a/lib/ds/hytxt/hytxt035.o b/lib/ds/hytxt/hytxt035.o new file mode 100644 index 0000000000000000000000000000000000000000..d26375d3777c5891dffd91cb10d55d414e0225a0 Binary files /dev/null and b/lib/ds/hytxt/hytxt035.o differ diff --git a/lib/ds/hytxt/hytxt036.c b/lib/ds/hytxt/hytxt036.c new file mode 100644 index 0000000000000000000000000000000000000000..8a3f5ac14e79de3635c16fa66f3e0e4e36578851 --- /dev/null +++ b/lib/ds/hytxt/hytxt036.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/hytxt/hytxt036.c + * + * setup a segment that a frame can be taken from stdin + * + * written: 1996-10-09 + * latest update: 1996-10-09 21:27:54 + * + */ + +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hyx_setup_stdin_segment ( +struct FILE_SEGMENT **app_segments, +struct FILE_SEGMENT **fs_new, +char *frame_name, +long *index_number) +{ + struct FILE_SEGMENT *fs; + long f_beg; + long f_siz; + + f_beg= 0L; + f_siz= 0x7FFFFFFFL; + + if ((fs= hyx_make_segment (app_segments, "-", frame_name, + index_number, FSop_update, f_beg, f_siz)) + == (struct FILE_SEGMENT *) 0) return -1; + + *fs_new= fs; + + return 0; +} diff --git a/lib/ds/hytxt/hytxt036.o b/lib/ds/hytxt/hytxt036.o new file mode 100644 index 0000000000000000000000000000000000000000..626a842b66d8b59ca76273322908678dcaa1a72c Binary files /dev/null and b/lib/ds/hytxt/hytxt036.o differ diff --git a/lib/ds/hytxt/hytxt037.c b/lib/ds/hytxt/hytxt037.c new file mode 100644 index 0000000000000000000000000000000000000000..326854ca82a180e0dbfef9b1177c02649dc3982f --- /dev/null +++ b/lib/ds/hytxt/hytxt037.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/hytxt/hytxt037.c + * + * processing of LUT-files + * + * written: 1996-10-12 + * latest update: 1996-10-13 12:18:48 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lookup.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hyx_dump_frame_list (FILE *fi_lut, FILE *fi_xfn) +{ + int rc; + + if (fi_lut != (FILE *) 0) + { + fseek (fi_lut, 0L, 0); + rc= lut_process_block (fi_lut, lut_dump_entry, (void *) 0); + } + + if (fi_xfn != (FILE *) 0) + { + fseek (fi_xfn, 0L, 0); + rc= xfn_process_block (fi_xfn, lut_dump_entry, (void *) 0); + } + + return 0; +} diff --git a/lib/ds/hytxt/hytxt037.o b/lib/ds/hytxt/hytxt037.o new file mode 100644 index 0000000000000000000000000000000000000000..b7cf24fc0c9536c570093beab7e3c4fb5d08818a Binary files /dev/null and b/lib/ds/hytxt/hytxt037.o differ diff --git a/lib/ds/hytxt/hytxt038.c b/lib/ds/hytxt/hytxt038.c new file mode 100644 index 0000000000000000000000000000000000000000..f07d5937c693ce174b70afc20de9c9d4fd398ab8 --- /dev/null +++ b/lib/ds/hytxt/hytxt038.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/hytxt/hytxt038.c + * + * find a frame in the lut or xfn file + * *** DONT USE *** hyx_get_index does more ... + * + * written: 1997-11-01 + * latest update: 1997-11-02 14:00:11 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/hytxt.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +long find_frame_lut_or_xfn (FILE *lut, FILE *xfn, char *fr_name) +{ + int rc; + int lng; + long w_info; + long rv= -1; + + if (lut != (FILE *) 0) + { + fseek (lut, 0L, 0); + rc= lookup_file (lut, fr_name, &w_info, &lng); + if (rc & LOOKUP_found) rv= w_info; + } + + if (rv != -1 && xfn != (FILE *) 0) + { + /* Note: fseek (xfn, 0L, 0) is done inside lookup_file_xfn */ + rc= lookup_file_xfn (xfn, fr_name, &w_info); + if (rc & LOOKUP_found) rv= w_info; + } + + return rv; +} diff --git a/lib/ds/hytxt/hytxt038.o b/lib/ds/hytxt/hytxt038.o new file mode 100644 index 0000000000000000000000000000000000000000..1ceb6c0014f2ebd04466d46bfaf2a2396f9e9a0c Binary files /dev/null and b/lib/ds/hytxt/hytxt038.o differ diff --git a/lib/ds/hytxt/lib b/lib/ds/hytxt/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/hytxt/libgg.a b/lib/ds/hytxt/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/hytxt/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/hytxt/make-dos b/lib/ds/hytxt/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..fbdc46c12cc9a5a4bfb5ff63176c4f89ca248f22 --- /dev/null +++ b/lib/ds/hytxt/make-dos @@ -0,0 +1,29 @@ +# +# FILE %ds/hytxt/makefile +# +# manipulation of attribute lists +# +# written: 1996-01-01 +# latest update: 1997-11-01 10:47:00 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +lib_a1: hytxt001.obj hytxt002.obj hytxt003.obj hytxt004.obj ! + hytxt005.obj hytxt006.obj hytxt007.obj hytxt008.obj ! + hytxt009.obj hytxt010.obj hytxt011.obj hytxt012.obj ! + hytxt013.obj hytxt014.obj hytxt015.obj hytxt016.obj ! + hytxt017.obj hytxt018.obj hytxt019.obj hytxt020.obj ! + hytxt021.obj hytxt022.obj hytxt023.obj hytxt024.obj ! + hytxt025.obj hytxt026.obj hytxt027.obj hytxt028.obj ! + hytxt029.obj hytxt030.obj hytxt031.obj hytxt032.obj ! + hytxt033.obj hytxt034.obj hytxt035.obj hytxt036.obj ! + hytxt037.obj hytxt038.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/hyxdb/(dirinf).fm b/lib/ds/hyxdb/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..4d05991d077ad821abadb18fedc3429fbd1e13e8 --- /dev/null +++ b/lib/ds/hyxdb/(dirinf).fm @@ -0,0 +1,23 @@ +# +# FILE %ds/hyxdb/(dirinf).fm +# +# written: 1996-01-22 +# latest update: 1997-11-09 11:17:44 +# + +# see also: <gg/hyxdb.h> +(dirinf).fm Contents +make-dos DOS version of Makefile +make-ux Unix version of Makefile + +hyxdb000.c TEMPLATE +hyxdb001.c new database +hyxdb002.c new object +hyxdb003.c insert attribute to object +hyxdb004.c retrieve attribute values from an object +hyxdb005.c load object from a frame +hyxdb006.c load object from a stream +hyxdb007.c new value + + + diff --git a/lib/ds/hyxdb/Makefile b/lib/ds/hyxdb/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..5c9ef1475eb47a5b74c88e2ea5002d44e71166f8 --- /dev/null +++ b/lib/ds/hyxdb/Makefile @@ -0,0 +1,30 @@ +# +# FILE %ds/hyxdb/make-ux +# +# written: 1997-11-09 +# latest update: 1999-05-08 9:39:15 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + hyxdb001.o hyxdb002.o hyxdb003.o hyxdb004.o hyxdb005.o hyxdb006.o \ + hyxdb007.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib diff --git a/lib/ds/hyxdb/contrib b/lib/ds/hyxdb/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/hyxdb/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/hyxdb/gg b/lib/ds/hyxdb/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/hyxdb/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/hyxdb/hyxdb000.c b/lib/ds/hyxdb/hyxdb000.c new file mode 100644 index 0000000000000000000000000000000000000000..d0be0c805dc52e85e26b98781d0c4cae800b41ee --- /dev/null +++ b/lib/ds/hyxdb/hyxdb000.c @@ -0,0 +1,21 @@ +/* + * FILE %ds/hyxdb/hyxdb000.c + * + * hyxdb: HYX Database Management + * + * written: 1997-11-09 + * latest update: 1997-11-09 11:22:17 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/hyxdb.h> + +/* ------------------------------------------------------------------------ */ + + diff --git a/lib/ds/hyxdb/hyxdb001.c b/lib/ds/hyxdb/hyxdb001.c new file mode 100644 index 0000000000000000000000000000000000000000..37febcd755fc856f6299c8b0bfa251bd60ed1fb8 --- /dev/null +++ b/lib/ds/hyxdb/hyxdb001.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/hyxdb/hyxdb001.c + * + * hyxdb: HYX Database Management + * create a new dabase handle + * + * written: 1997-11-09 + * latest update: 1997-11-09 11:22:17 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <gg/hyxdb.h> + +/* ------------------------------------------------------------------------ */ +struct HYXDB_CONTROL *hyxdb_new_handle ( +char *cluster_name, +int open_mode) +{ + struct HYXDB_CONTROL *hdl= (struct HYXDB_CONTROL *) 0; + struct HYX_CLUSTER_CONTROL *hcc; + + if ((hdl= (struct HYXDB_CONTROL *) calloc (sizeof (struct HYXDB_CONTROL), 1)) + == (struct HYXDB_CONTROL *) 0) + return (struct HYXDB_CONTROL *) 0; + + /** T2D: remote clusteres **/ + hdl->HYXDB_clc= hcc= hyx_new_cluster_control (); + hcc_set_cluster_name (hcc, cluster_name); + hcc_open (hcc, open_mode); + + return hdl; +} diff --git a/lib/ds/hyxdb/hyxdb002.c b/lib/ds/hyxdb/hyxdb002.c new file mode 100644 index 0000000000000000000000000000000000000000..6ed091b6f28bf4f53ad7e784ed6d43a8d6adea7f --- /dev/null +++ b/lib/ds/hyxdb/hyxdb002.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/hyxdb/hyxdb002.c + * + * hyxdb: HYX Database Management + * create a new object + * + * written: 1997-11-09 + * latest update: 1997-11-09 11:22:17 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/hyxdb.h> + +/* ------------------------------------------------------------------------ */ +struct HYXDB_OBJECT *hyxdb_new_object ( +struct HYXDB_CONTROL *ctrl, +char *frame_name, +long id) +{ + struct HYXDB_OBJECT *obj; + + if ((obj= (struct HYXDB_OBJECT *) calloc (sizeof (struct HYXDB_OBJECT), 1)) + == (struct HYXDB_OBJECT *) 0) + return (struct HYXDB_OBJECT *) 0; + + if (frame_name != (char *) 0) obj->frame_name= strdup (frame_name); + obj->OID= id; + obj->element_destructor= ctrl->element_destructor; + + return obj; +} + diff --git a/lib/ds/hyxdb/hyxdb003.c b/lib/ds/hyxdb/hyxdb003.c new file mode 100644 index 0000000000000000000000000000000000000000..4d6337b5bf1c7dcc7c98936a242c10f9888e4d29 --- /dev/null +++ b/lib/ds/hyxdb/hyxdb003.c @@ -0,0 +1,59 @@ +/* + * FILE %ds/hyxdb/hyxdb003.c + * + * hyxdb: HYX Database Management + * insert a (new) attribute to a given object + * return number of values for the attribute + * + * written: 1997-11-09 + * latest update: 1997-11-09 11:22:17 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/hyxdb.h> + +/* ------------------------------------------------------------------------ */ +long hyxdb_insert_attribute ( +struct HYXDB_OBJECT *obj, +char *attr_name, +struct HYXDB_VALUE *attr_value, +int insert_mode) +{ + struct YTREE *yt; + struct ARRAY_CONTROL *values; + + if (obj == (struct HYXDB_OBJECT *) 0 || attr_name == (char *) 0) + return -1L; + + /* locate attribute value list for the given attribute name */ + yt= ytree_insert_word (&obj->attr, (unsigned char *) attr_name); + + if (yt->YT_flags & YTflag_EOW) + { /* attribute has already been defined */ + values= (struct ARRAY_CONTROL *) yt->YT_info; + if (insert_mode == HYXDB_replace) { array_dispose (values); goto NEW; } + } + else + { /* attribute is new */ + if (insert_mode == HYXDB_update) + { /* there should already be some values under this attribute ! */ + return -1L; + } + +NEW: + values= array_new (); + values->element_destructor= obj->element_destructor; + yt->YT_info= (long) values; + yt->YT_flags |= YTflag_EOW; + } + + array_push (values, (void *) attr_value); + + return array_elements (values); +} diff --git a/lib/ds/hyxdb/hyxdb004.c b/lib/ds/hyxdb/hyxdb004.c new file mode 100644 index 0000000000000000000000000000000000000000..65a50417b1df622379b18f0aa1a47f3abf32844d --- /dev/null +++ b/lib/ds/hyxdb/hyxdb004.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/hyxdb/hyxdb004.c + * + * hyxdb: HYX Database Management + * retrieve the values for an attribute in an object + * + * written: 1997-11-09 + * latest update: 1997-11-09 11:22:17 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/hyxdb.h> + +/* ------------------------------------------------------------------------ */ +struct ARRAY_CONTROL *hyxdb_get_attribute_values ( +struct HYXDB_OBJECT *obj, +char *attr_name) +{ + struct ARRAY_CONTROL *values= (struct ARRAY_CONTROL *) 0; + + if (obj != (struct HYXDB_OBJECT *) 0 + && attr_name != (char *) 0) + { + values= (struct ARRAY_CONTROL *) + ytree_get_value (obj->attr, (unsigned char *) attr_name); + } + + return values; +} diff --git a/lib/ds/hyxdb/hyxdb005.c b/lib/ds/hyxdb/hyxdb005.c new file mode 100644 index 0000000000000000000000000000000000000000..a01f210e8af813ed74de42f35ada7e2e1c7a8a92 --- /dev/null +++ b/lib/ds/hyxdb/hyxdb005.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/hyxdb/hyxdb005.c + * + * hyxdb: HYX Database Management + * load a object from a frame + * + * written: 1997-11-09 + * latest update: 1997-11-09 11:22:17 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/hyxdb.h> + +/* ------------------------------------------------------------------------ */ +struct HYXDB_OBJECT *hyxdb_load_object_frame ( +struct HYXDB_CONTROL *ctrl, +char *frame_name) +{ + struct HYX_CLUSTER_CONTROL *hcc; + long size; + + if (ctrl == (struct HYXDB_CONTROL *) 0 + || (hcc= ctrl->HYXDB_clc) == (struct HYX_CLUSTER_CONTROL *) 0 + || frame_name == (char *) 0 || *frame_name == 0 + ) + return (struct HYXDB_OBJECT *) 0; + + size= hcc_seek_by_name (hcc, frame_name); + + return hyxdb_parse_stream (ctrl, hcc->HCC_f_hyx, size, frame_name); +} diff --git a/lib/ds/hyxdb/hyxdb006.c b/lib/ds/hyxdb/hyxdb006.c new file mode 100644 index 0000000000000000000000000000000000000000..a5552102dec18d638022aa9cc082b748d79b0874 --- /dev/null +++ b/lib/ds/hyxdb/hyxdb006.c @@ -0,0 +1,80 @@ +/* + * FILE %ds/hyxdb/hyxdb005.c + * + * hyxdb: HYX Database Management + * load a object from a frame + * + * written: 1997-11-09 + * latest update: 1997-11-09 13:01:35 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/hyxdb.h> + +/* ------------------------------------------------------------------------ */ +struct HYXDB_OBJECT *hyxdb_parse_stream ( +struct HYXDB_CONTROL *ctrl, +FILE *fi, +long size, +char *frame_name) +{ + struct HYXDB_OBJECT *obj= (struct HYXDB_OBJECT *) 0; + struct HYXDB_VALUE *value; + char *buffer; +#define N_FIELDS 2 + char *fields [N_FIELDS]; + char *vs; + int buffer_size; + int rc; + int n_fields; + + if (feof (fi) + || (obj= hyxdb_new_object (ctrl, frame_name, 0L)) + == (struct HYXDB_OBJECT *) 0 + ) + return (struct HYXDB_OBJECT *) 0; + + if ((buffer= ctrl->buffer) == (char *) 0) + { + buffer= ctrl->buffer= malloc (ctrl->buffer_size= HYXDB_BUFFER_SIZE); + } + else buffer_size= ctrl->buffer_size; + + if (buffer == (char *) 0) return (struct HYXDB_OBJECT *) 0; + + while (size > 0L) + { + rc= fread_line (fi, buffer, buffer_size); + if (rc <= 0 && feof (fi)) break; + + if (buffer [0] == '#' + || strncmp ("<Frame ", buffer, 7) == 0 + || strncmp ("</Frame>", buffer, 8) == 0 + || strncmp ("<hyx.f ", buffer, 7) == 0 + || strncmp ("</hyx.f>", buffer, 8) == 0 + ) + continue; + + n_fields= split_string (buffer, '=', fields, N_FIELDS); + + if (n_fields != 2 + || (vs= fields [1]) == (char *) 0 + || *vs == 0 + || (value= hyxdb_new_value (HYXDB_string, vs, (long) strlen (vs))) + == (struct HYXDB_VALUE *) 0 + ) continue; + + hyxdb_insert_attribute (obj, fields [0], value, HYXDB_insert); + } + + return obj; +} diff --git a/lib/ds/hyxdb/hyxdb007.c b/lib/ds/hyxdb/hyxdb007.c new file mode 100644 index 0000000000000000000000000000000000000000..c31d80f4d3957fbe7bf74043330d3b66983bf87b --- /dev/null +++ b/lib/ds/hyxdb/hyxdb007.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/hyxdb/hyxdb007.c + * + * hyxdb: new value + * + * written: 1997-11-09 + * latest update: 1997-11-09 13:01:35 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/sbr.h> +#include <gg/hyxdb.h> + +/* ------------------------------------------------------------------------ */ +struct HYXDB_VALUE *hyxdb_new_value ( +int format, +void *value, +long size) +{ + struct HYXDB_VALUE *val; + + if ((val= (struct HYXDB_VALUE *) calloc (sizeof (struct HYXDB_VALUE), 1)) + == (struct HYXDB_VALUE *) 0 + ) + return (struct HYXDB_VALUE *) 0; + + val->format= format; + val->size= size; + val->value= value; + + return val; +} diff --git a/lib/ds/hyxdb/libgg.a b/lib/ds/hyxdb/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/hyxdb/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/hyxdb/make-dos b/lib/ds/hyxdb/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..b23a45f798697f122be9ec9aea02d22b2f782365 --- /dev/null +++ b/lib/ds/hyxdb/make-dos @@ -0,0 +1,22 @@ +# +# FILE %ds/hyxdb/make-dos +# +# manipulation of hyxdb object +# +# written: 1997-11-09 +# latest update: 1997-11-09 11:29:13 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : ! + hyxdb001.obj hyxdb002.obj hyxdb003.obj hyxdb004.obj hyxdb005.obj ! + hyxdb006.obj hyxdb007.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/hyxl/(dirinf).fm b/lib/ds/hyxl/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..fdef96d6fa2b181f4da717992eeca5b78f093632 --- /dev/null +++ b/lib/ds/hyxl/(dirinf).fm @@ -0,0 +1,29 @@ +# +# FILE %ds/hyxl/(dirinf).fm +# +# written: 1994-11-13 +# latest update: 1997-11-09 12:48:24 +# $Id: (dirinf).fm,v 1.4 2002/07/17 07:04:35 gonter Exp $ +# +# ---------------------------------------------------------------------------- +Makefile active make file +make-ux Makefile (Unix) +make-dos Makefile (MSDOS) + +hyxl0001.c char *find_attr_name (char *str, char *name); +hyxl0002.c int get_attr_value (char *src, char *dst, int dst_lng, +hyxl0003.c int find_attr_value (char *src, char *dst, int dst_size, +hyxl0004.c int hyx_identify_color_code (char *colour_value); +hyxl0005.c int hcc_set_cluster_name (struct HYX_CLUSTER_CONTROL *hcc, ...) +hyxl0006.c int print_hyx_link (...) +hyxl0007.c int hcc_destroy (struct HYX_CLUSTER_CONTROL *hcc); +hyxl0008.c char *hyx_make_stop_tag (char *s) +hyxl0009.c char *hyx_translate_special_frame (char *s) +hyxl0010.c int hcc_open (struct HYX_CLUSTER_CONTROL *hcc, int mode); +hyxl0011.c int hcc_update_index (...); +hyxl0012.c int hcc_seek_by_name (...); +hyxl0013.c int new_HYX_CLUSTER_CONTROL (...); +hyxl0014.c hcc_add_frame (...); + +hyxl0101.c int hyx_rule_calendar (...) + diff --git a/lib/ds/hyxl/Makefile b/lib/ds/hyxl/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..bf1fda95ccf9e5947c31fca92f112a05cdc718db --- /dev/null +++ b/lib/ds/hyxl/Makefile @@ -0,0 +1,35 @@ +# +# FILE %ds/hyxl/make-ux +# +# written: 1995-03-19 +# latest update: 2001-02-18 18:00:01 +# $Id: Makefile,v 1.5 2002/07/17 07:04:35 gonter Exp $ +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-g -I. +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow + +# ---------------------------------------------------------------------------- +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + hyxl0001.o hyxl0002.o hyxl0003.o hyxl0004.o hyxl0005.o hyxl0006.o \ + hyxl0007.o hyxl0008.o hyxl0009.o hyxl0010.o hyxl0011.o hyxl0012.o \ + hyxl0013.o hyxl0014.o \ + hyxl0101.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $(LIBOBJS0) + touch lib + +.c.o: + $(CC) $(OPTS) -c $*.c diff --git a/lib/ds/hyxl/contrib b/lib/ds/hyxl/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/hyxl/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/hyxl/gg b/lib/ds/hyxl/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/hyxl/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/hyxl/hyxl0001.c b/lib/ds/hyxl/hyxl0001.c new file mode 100644 index 0000000000000000000000000000000000000000..7f00f4e2c65769cceb3f3a8d17a4595653ab3473 --- /dev/null +++ b/lib/ds/hyxl/hyxl0001.c @@ -0,0 +1,72 @@ +/* + * FILE %ds/hyxl/hyxl0001.c + * + * find an attribute name in a string + * + * written: 1991 06 25: (original name: usr/ned/08/ned0837.c) + * 1993-03-07: renamed to usr/ds/hyx/hyxl0002.c + * latest update: 1997-06-16 10:55:34 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/hyx.h> + +/* ------------------------------------------------------------------------ */ +char *find_attr_name (char *str, char *name) +{ +#define STAT_start 0 +#define STAT_match 1 +#define STAT_dquote 2 +#define STAT_squote 3 +#define STAT_nomatch 4 + int status= STAT_start; + int ch; + char *np; /* name pointer */ + + if (str == (char *) 0) return (char *) 0; + + np= name; + + for (; (ch= (*str & 0x00FF)) != 0; str++) + { + switch (status) + { + case STAT_start: + if (ch == (*name & 0x00FF)) + { + np= name; + status= STAT_match; + } else + if (ch == '\"') status= STAT_dquote; else + if (ch == '\'') status= STAT_squote; else + if (ch != ' ' && ch != '\t') status= STAT_nomatch; + break; + + case STAT_match: + np++; + if (ch == '=' && (*np & 0x00FF) == 0) return str+1; + if (*np == 0) return (char *) 0; + if (ch == (*np & 0x00FF)) break; + status= STAT_nomatch; + + case STAT_nomatch: + if (ch == ' ' || ch == '\t') status= STAT_start; + if (ch == '\"') status= STAT_dquote; else + if (ch == '\'') status= STAT_dquote; + break; + + case STAT_dquote: + if (ch == '\"') status= STAT_nomatch; + break; + case STAT_squote: + if (ch == '\'') status= STAT_nomatch; + break; + } + } + + return (char *) 0; +} diff --git a/lib/ds/hyxl/hyxl0001.o b/lib/ds/hyxl/hyxl0001.o new file mode 100644 index 0000000000000000000000000000000000000000..aa7783abbf9d79b1d1c15c3d41f45a8e6c247c5e Binary files /dev/null and b/lib/ds/hyxl/hyxl0001.o differ diff --git a/lib/ds/hyxl/hyxl0002.c b/lib/ds/hyxl/hyxl0002.c new file mode 100644 index 0000000000000000000000000000000000000000..5cf48e28be54e21208ef7afecea9d659402b88d6 --- /dev/null +++ b/lib/ds/hyxl/hyxl0002.c @@ -0,0 +1,72 @@ +/* + * FILE %ds/hyxl/hyxl0002.c + * + * return the value of an attribute assignment + * + * written: 1991 05 23: (original name: usr/ned/08/ned0837.c) + * 1993-03-07: renamed to usr/ds/hyx/hyxl0002.c + * latest update: 1997-12-18 12:54:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/hyx.h> + +/* ------------------------------------------------------------------------ */ +int get_attr_value (char *src, char *dst, int dst_lng, int flags) +/* flags: bit 0: 1 -> remove quotes */ +{ + int j= 0; /* desintation index */ + int c; /* examined character */ + int i; /* examined character index */ + int quoted= 0; /* 1 -> string is quoted */ + int store= 1; /* 1 -> examined character to be stored */ + + if (src == (char *) 0 || dst == (char *) 0 || dst_lng <= 0) return -1; + dst [0]= 0; + + for (i= 0;; i++) + { + c= src [i]; + if (c == 0) break; + + if (c == '\"' || c == '\'') + { + if (flags & 0x01) + { + if (i == 0) + { + quoted= c; + store= 0; + } + else + if (quoted == c) + { + break; /* end of strimg! */ + } + } + } + else + if (quoted == 0 + && (c == ' ' || c == '\t' + || c == '\r' || c == '\n' + || c == '>')) break; + + if (store) + { + dst [j++]= (char) c; + if (j >= dst_lng) + { + dst [j-1]= 0; + return -1; + } + } + store= 1; + } + + dst [j]= 0; + return 0; +} diff --git a/lib/ds/hyxl/hyxl0002.o b/lib/ds/hyxl/hyxl0002.o new file mode 100644 index 0000000000000000000000000000000000000000..dc26598e2bf75205d8fc6eab42cefdf5846969f0 Binary files /dev/null and b/lib/ds/hyxl/hyxl0002.o differ diff --git a/lib/ds/hyxl/hyxl0003.c b/lib/ds/hyxl/hyxl0003.c new file mode 100644 index 0000000000000000000000000000000000000000..9f6d30a13bc756c8a4e661d3c93a8522f740482c --- /dev/null +++ b/lib/ds/hyxl/hyxl0003.c @@ -0,0 +1,27 @@ +/* + * FILE ~/usr/ds/hyxl/hyxl0003.c + * + * find and return the value of an attribute assignment + * + * written: 1991 05 23: (original name: ~/usr/ned/08/ned0837.c) + * 1993-03-07: renamed to ~/usr/ds/hyx/hyxl0002.c + * latest update: 1995-05-21 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/hyx.h> + +/* ------------------------------------------------------------------------ */ +int find_attr_value (char *src, char *dst, int dst_size, char *name) +{ + char *idx; + + if ((idx= find_attr_name (src, name)) != (char *) 0) + if (get_attr_value (idx, dst, dst_size, 0x01) == 0) return 0; + + return -1; +} diff --git a/lib/ds/hyxl/hyxl0003.o b/lib/ds/hyxl/hyxl0003.o new file mode 100644 index 0000000000000000000000000000000000000000..d50801eee9db76d1a7e7ce4e087b41752f3328b6 Binary files /dev/null and b/lib/ds/hyxl/hyxl0003.o differ diff --git a/lib/ds/hyxl/hyxl0004.c b/lib/ds/hyxl/hyxl0004.c new file mode 100644 index 0000000000000000000000000000000000000000..eeca8e2344bdfb71f218b6e367034ca11239fcdc --- /dev/null +++ b/lib/ds/hyxl/hyxl0004.c @@ -0,0 +1,92 @@ +/* + * FILE %ds/hyxl/hyxl0004.c + * + * return the colour value of the code in the string + * T2D: this is closely related to DOS! + * + * written: 1994-07-03 + * latest update: 1997-01-15 11:20:39 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/dpp.h> +#include <gg/ytree.h> +#include <gg/hyx.h> + +/* ------------------------------------------------------------------------ */ +struct HYXL0004_color_table +{ + unsigned char *name; + long value; +} ; + +/* ------------------------------------------------------------------------ */ +struct YTREE *color_codes= (struct YTREE *) 0; + +/* ------------------------------------------------------------------------ */ +static unsigned char __default[]= "$$default"; +static struct HYXL0004_color_table CT []= +{ + { "hyx.l", 31 }, + { "mark", 106 }, + { "index", 15 }, + + /* programming, e.g. in C */ + { "incl", 13 }, + { "pgm.incl", 13 }, + { "pgm.data", 14 }, + { "pgm.struct", 15 }, + { "pgm.func", 31 }, + + { "$$text", 0x0100 }, /* default text color */ + { "$$ftr", 0x0200 }, /* default feature colour */ + + { __default, 12 }, /* default color code */ + + { (unsigned char *) 0, 0 } +} ; + +/* ------------------------------------------------------------------------ */ +static int hyxl0004_init (void); +static int hyxl0004_init () +{ + int i; + + for (i= 0;; i++) + { + if (CT[i].name == (unsigned char *) 0) break; + ytree_set_value (&color_codes, CT[i].name, CT[i].value); + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +long hyx_identify_color_code (unsigned char *s) +{ + long cv; + + if ((cv= get_parameter_value ((char *) s)) == 0L) + { /* color code is not numeric, so look it up */ + if (color_codes == (struct YTREE *) 0) hyxl0004_init (); + + if ((cv= ytree_get_value (color_codes, s)) == 0L) + cv= ytree_get_value (color_codes, __default); + } + + return cv; +} + +/* ------------------------------------------------------------------------ */ +long hyx_set_color_code (unsigned char *name, long value) +{ + if (name == (unsigned char *) 0 || *name == (unsigned char) 0) return 0L; + + if (color_codes == (struct YTREE *) 0) hyxl0004_init (); + + return ytree_set_value (&color_codes, name, value); +} diff --git a/lib/ds/hyxl/hyxl0004.o b/lib/ds/hyxl/hyxl0004.o new file mode 100644 index 0000000000000000000000000000000000000000..f00b4ee77f0d47b1185d1280c68ab2c2722ee528 Binary files /dev/null and b/lib/ds/hyxl/hyxl0004.o differ diff --git a/lib/ds/hyxl/hyxl0005.c b/lib/ds/hyxl/hyxl0005.c new file mode 100644 index 0000000000000000000000000000000000000000..156c7c31063cc87b07403122bd581acbabc86b1a --- /dev/null +++ b/lib/ds/hyxl/hyxl0005.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/hyxl/hyxl0005.c + * + * written: 1994-12-10 + * latest update: 1996-10-10 0:12:56 + * $Id: hyxl0005.c,v 1.3 2002/01/27 23:01:44 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hcc_set_cluster_name (struct HYX_CLUSTER_CONTROL *hcc, char *fnm_hyx) +{ + if (hcc == (struct HYX_CLUSTER_CONTROL *) 0 + || fnm_hyx == (char *) 0 + ) return -1; + + free_or_what (hcc->HCC_fnm_hyx); + + hcc->HCC_fnm_hyx= strdup (fnm_hyx); + + fnmcpy3 (&hcc->HCC_fnm_lut, fnm_hyx, ".lut"); + fnmcpy3 (&hcc->HCC_fnm_idx, fnm_hyx, ".idx"); + fnmcpy3 (&hcc->HCC_fnm_xfn, fnm_hyx, ".xfn"); + fnmcpy3 (&hcc->HCC_fnm_kill_by_id, fnm_hyx, ".kid"); + fnmcpy3 (&hcc->HCC_fnm_kill_by_lx, fnm_hyx, ".klx"); + + return 0; +} diff --git a/lib/ds/hyxl/hyxl0005.o b/lib/ds/hyxl/hyxl0005.o new file mode 100644 index 0000000000000000000000000000000000000000..6f9145c79d94181e55d2e2f791d7210adc4cc6a7 Binary files /dev/null and b/lib/ds/hyxl/hyxl0005.o differ diff --git a/lib/ds/hyxl/hyxl0006.c b/lib/ds/hyxl/hyxl0006.c new file mode 100644 index 0000000000000000000000000000000000000000..c5c82598e7c06a1f75490dd491c60ba28265619b --- /dev/null +++ b/lib/ds/hyxl/hyxl0006.c @@ -0,0 +1,61 @@ +/* + * FILE %ds/hyxl/hyxl0006.c + * + * written: 1994-12-11 + * latest update: 1995-12-16 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int print_hyx_link ( +FILE *fo, +char *destination_frame, +char *destination_cluster, +char *destination_file, +char *color, +char *text) +{ + int size= 0; + int txs= 0; + + fputs ("<hyx.l", fo); + size= 6; + + if (destination_file != (char *) 0) + { + size += fprintf (fo, " file=\"%s\"", destination_file); + } + else + { + if (destination_cluster != (char *) 0) + size += fprintf (fo, " cl=\"%s\"", destination_cluster); + if (destination_frame != (char *) 0) + size += fprintf (fo, " fr=\"%s\"", destination_frame); + } + + if (color != (char *) 0) + size += fprintf (fo, " tdc=\"%s\"", color); + + if (text != (char *) 0) + { + txs= strlen (text); + size += fprintf (fo, " tdp=%d", txs); + } + + fputc ('>', fo); + size++; + + if (text != (char *) 0) + { + fputs (text, fo); + size += txs; + } + + return size; +} diff --git a/lib/ds/hyxl/hyxl0006.o b/lib/ds/hyxl/hyxl0006.o new file mode 100644 index 0000000000000000000000000000000000000000..e4558e5375362314d6c7b783f853e85d6c329a48 Binary files /dev/null and b/lib/ds/hyxl/hyxl0006.o differ diff --git a/lib/ds/hyxl/hyxl0007.c b/lib/ds/hyxl/hyxl0007.c new file mode 100644 index 0000000000000000000000000000000000000000..52005dc823f553eea720b8e41de8aca305b62a1b --- /dev/null +++ b/lib/ds/hyxl/hyxl0007.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/hyxl/hyxl0007.c + * + * written: 1995-12-16 + * latest update: 1996-10-10 0:13:06 + * $Id: hyxl0007.c,v 1.3 2002/01/27 23:01:44 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hcc_destroy (struct HYX_CLUSTER_CONTROL *hcc) +{ + if (hcc == (struct HYX_CLUSTER_CONTROL *) 0) return -1; + + free_or_what (hcc->HCC_fnm_hyx); + free_or_what (hcc->HCC_fnm_lut); + free_or_what (hcc->HCC_fnm_idx); + free_or_what (hcc->HCC_fnm_xfn); + free_or_what (hcc->HCC_fnm_kill_by_id); + free_or_what (hcc->HCC_fnm_kill_by_lx); + + free (hcc); + + return 0; +} diff --git a/lib/ds/hyxl/hyxl0007.o b/lib/ds/hyxl/hyxl0007.o new file mode 100644 index 0000000000000000000000000000000000000000..8313f92264e5f3b2b6afe2bf812c44331a3d86c4 Binary files /dev/null and b/lib/ds/hyxl/hyxl0007.o differ diff --git a/lib/ds/hyxl/hyxl0008.c b/lib/ds/hyxl/hyxl0008.c new file mode 100644 index 0000000000000000000000000000000000000000..ce0d06af5ecdb784969a1a23fe625130215f22dd --- /dev/null +++ b/lib/ds/hyxl/hyxl0008.c @@ -0,0 +1,86 @@ +/* + * FILE %ds/hyxl/hyxl0008.c + * + * written: 1996-03-07 + * latest update: 1996-03-15 + * $Id: hyxl0008.c,v 1.3 2005/09/04 20:27:37 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +char *hyx_make_stop_tag (const char *s) +{ + int i, ch; +#define STAT_BEGIN 0 +#define STAT_TAG 1 +#define STAT_IN_TAG 2 + int status= STAT_BEGIN; + int t_beg, t_end; + int siz; + char *cp; + + if (s == (char *) 0 || *s == 0) return (char *) 0; + + for (i= 0; (ch= s [i] & 0x00FF) != 0; i++) + { + switch (status) + { + case STAT_BEGIN: + status= (ch == '<') ? STAT_TAG : -1; + break; + case STAT_TAG: + if ((ch >= 'a' && ch <= 'z') + || (ch >= 'A' && ch <= 'Z') + || (ch >= '0' && ch <= '9') + || ch == '.' || ch == '_' + ) + { + t_beg= i; + t_end= i; + status= STAT_IN_TAG; + } + break; + + case STAT_IN_TAG: + if ((ch >= 'a' && ch <= 'z') + || (ch >= 'A' && ch <= 'Z') + || (ch >= '0' && ch <= '9') + || ch == '.' || ch == '_' || ch == '-' + ) + { + t_end= i; + } + else + goto DONE; + break; + + default: + return (char *) 0; + } + } + +DONE: + siz= t_end-t_beg+1; + if (siz < 64 + && (cp= malloc (siz+6)) != (char *) 0 + ) + { + strncpy (cp+2, s+t_beg, siz); + cp [0]= '<'; + cp [1]= '/'; + cp [siz+2]= '>'; + cp [siz+3]= 0; + return cp; + } + + return (char *) 0; +} diff --git a/lib/ds/hyxl/hyxl0008.o b/lib/ds/hyxl/hyxl0008.o new file mode 100644 index 0000000000000000000000000000000000000000..faab69a16883c982a5a378bfccb7fbe15eeee3ac Binary files /dev/null and b/lib/ds/hyxl/hyxl0008.o differ diff --git a/lib/ds/hyxl/hyxl0009.c b/lib/ds/hyxl/hyxl0009.c new file mode 100644 index 0000000000000000000000000000000000000000..e6a6737aa948a2ea878a4e5521b46c4ebe701e38 --- /dev/null +++ b/lib/ds/hyxl/hyxl0009.c @@ -0,0 +1,97 @@ +/* + * FILE %ds/hyxl/hyxl0009.c + * + * written: 1996-03-24 + * latest update: 1996-10-13 16:43:20 + * $Id: hyxl0009.c,v 1.4 2005/09/04 20:27:37 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <gg/dates.h> +#include <gg/strings.h> +#include <gg/hytxt.h> + +#define ONE_DAY 86400L + +/* ------------------------------------------------------------------------ */ +char *hyx_translate_special_frame (const char *s) +{ +#define _today 1 +#define _tomorrow 2 +#define _yesterday 3 +#define _this_month 4 +#define _next_month 5 +#define _last_month 6 + int mode= 0; + long xtime; + long time_offset= 0L; + char *cp= (char *) 0; +#define fmt_date 1 + int fmt= 0; + int date_fmt; + + if (strcmp (s, "$$today") == 0) mode= _today; else + if (strcmp (s, "$$tomorrow") == 0) mode= _tomorrow; else + if (strcmp (s, "$$yesterday") == 0) mode= _yesterday; else + if (strcmp (s, "$$this_month") == 0) mode= _this_month; else + if (strcmp (s, "$$next_month") == 0) mode= _next_month; else + if (strcmp (s, "$$last_month") == 0) mode= _last_month; + + switch (mode) + { + case _today: + date_fmt= DATIMfmt_date; + time_offset= 0L; + fmt= fmt_date; + break; + + case _tomorrow: + date_fmt= DATIMfmt_date; + time_offset= ONE_DAY; + fmt= fmt_date; + break; + + case _yesterday: + date_fmt= DATIMfmt_date; + time_offset= -ONE_DAY; + fmt= fmt_date; + break; + + case _this_month: + date_fmt= DATIMfmt_this_month; + time_offset= 0L; + fmt= fmt_date; + break; + + case _next_month: + date_fmt= DATIMfmt_next_month; + time_offset= 0L; + fmt= fmt_date; + break; + + case _last_month: + date_fmt= DATIMfmt_last_month; + time_offset= 0L; + fmt= fmt_date; + break; + } + + switch (fmt) + { + case fmt_date: + xtime= time ((time_t *) 0); + xtime += time_offset; + + if ((cp= malloc (12)) != (char *) 0) + _actual_datim (cp, date_fmt, xtime); + } + + return cp; +} diff --git a/lib/ds/hyxl/hyxl0009.o b/lib/ds/hyxl/hyxl0009.o new file mode 100644 index 0000000000000000000000000000000000000000..667c7648d9fbfd948448c80f8dc2239e2ed1f464 Binary files /dev/null and b/lib/ds/hyxl/hyxl0009.o differ diff --git a/lib/ds/hyxl/hyxl0010.c b/lib/ds/hyxl/hyxl0010.c new file mode 100644 index 0000000000000000000000000000000000000000..943a34cefd7e4c53ef36b80d6aca1b150c5d801a --- /dev/null +++ b/lib/ds/hyxl/hyxl0010.c @@ -0,0 +1,59 @@ +/* + * FILE %ds/hyxl/hyxl0010.c + * + * written: 1996-10-12 + * latest update: 1996-10-12 12:43:07 + * $Id: hyxl0010.c,v 1.2 2002/01/27 23:01:44 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/fileio.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hcc_open (struct HYX_CLUSTER_CONTROL *hcc, int mode) +{ + if (hcc == (struct HYX_CLUSTER_CONTROL *) 0) return -1; + + /* indicate success if requested open mode matches current state */ + if (hcc->HCC_open_mode == mode) return 0; + + /* otherwise close the cluster */ + fclose_or_what (hcc->HCC_f_hyx); + fclose_or_what (hcc->HCC_f_idx); + fclose_or_what (hcc->HCC_f_lut); + fclose_or_what (hcc->HCC_f_xfn); + hcc->HCC_f_hyx= + hcc->HCC_f_idx= + hcc->HCC_f_lut= + hcc->HCC_f_xfn= (FILE *) 0; + hcc->HCC_open_mode= HCC_om_closed; + + switch (mode) + { + case HCC_om_closed: + break; + + case HCC_om_read: + hcc->HCC_f_hyx= fopen (hcc->HCC_fnm_hyx, "rb"); + hcc->HCC_f_idx= fopen (hcc->HCC_fnm_idx, "rb"); + hcc->HCC_f_lut= fopen (hcc->HCC_fnm_lut, "rb"); + hcc->HCC_f_xfn= fopen (hcc->HCC_fnm_xfn, "rb"); + hcc->HCC_open_mode= HCC_om_read; + break; + + case HCC_om_update: + hcc->HCC_f_hyx= fopen (hcc->HCC_fnm_hyx, "ab"); + hcc->HCC_f_idx= fopen (hcc->HCC_fnm_idx, "a+b"); + hcc->HCC_f_lut= fopen (hcc->HCC_fnm_lut, "rb"); + hcc->HCC_f_xfn= fopen (hcc->HCC_fnm_xfn, "ab"); + hcc->HCC_open_mode= HCC_om_update; + break; + + default: + return -1; + } + + return 0; +} diff --git a/lib/ds/hyxl/hyxl0010.o b/lib/ds/hyxl/hyxl0010.o new file mode 100644 index 0000000000000000000000000000000000000000..f82e7c3f0e1e1675dd0147e3a9da1261e9f1ce53 Binary files /dev/null and b/lib/ds/hyxl/hyxl0010.o differ diff --git a/lib/ds/hyxl/hyxl0011.c b/lib/ds/hyxl/hyxl0011.c new file mode 100644 index 0000000000000000000000000000000000000000..eda7dd534ba8078a62995cb4ee4850f293475652 --- /dev/null +++ b/lib/ds/hyxl/hyxl0011.c @@ -0,0 +1,67 @@ +/* + * FILE %ds/hyxl/hyxl0011.c + * + * written: 1997-11-01 + * latest update: 2001-02-18 17:59:27 + * $Id: hyxl0011.c,v 1.2 2001/02/19 00:39:52 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/fileio.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +long hcc_update_index ( +struct HYX_CLUSTER_CONTROL *hcc, +YTREE_PROCESSOR *lut_processor, +YTREE_PROCESSOR *xfn_processor) +{ + FILE *fo; + long unique; + + if (hcc == (struct HYX_CLUSTER_CONTROL *) 0) return -1L; + + if (hcc->HCC_lut_mode == HCC_lm_full_write) + { +printf ("hyxl0011.c e\n"); + ytree_process (hcc->HCC_ytree, lut_processor, (void *) 0); + ytree_size (hcc->HCC_ytree); +printf ("hyxl0011.c f\n"); + + if ((fo= fopen (hcc->HCC_fnm_lut, "wb")) == (FILE *) 0) + { + fprintf (stdout, "%ds/hyxl/hyxl0011.c: error opening lut file %s\n", + hcc->HCC_fnm_lut); + } + else + { + unique= ytree_dump (fo, hcc->HCC_ytree); + fclose (fo); + } + } + else + if (hcc->HCC_lut_mode == HCC_lm_incremental) + { + if ((fo= fopen (hcc->HCC_fnm_xfn, "a")) == (FILE *) 0) + { + fprintf (stdout, "%ds/hyxl/hyxl0011.c: error opening xfn file %s\n", + hcc->HCC_fnm_xfn); + } + else + { + ytree_process (hcc->HCC_ytree, xfn_processor, (void *) fo); + fclose (fo); + } + } + else + { + fprintf (stderr, "unknown lut_mode: %d\n", hcc->HCC_lut_mode); + return -1; + } + + ytree_free (hcc->HCC_ytree); + hcc->HCC_ytree= (struct YTREE *) 0; + + return unique; +} diff --git a/lib/ds/hyxl/hyxl0011.o b/lib/ds/hyxl/hyxl0011.o new file mode 100644 index 0000000000000000000000000000000000000000..aeee51134099cb7c3a2febb18a1db85c0202af20 Binary files /dev/null and b/lib/ds/hyxl/hyxl0011.o differ diff --git a/lib/ds/hyxl/hyxl0012.c b/lib/ds/hyxl/hyxl0012.c new file mode 100644 index 0000000000000000000000000000000000000000..fb2d96a0eb32201f825d7bef3f2122aaa004e314 --- /dev/null +++ b/lib/ds/hyxl/hyxl0012.c @@ -0,0 +1,32 @@ +/* + * FILE %ds/hyxl/hyxl0012.c + * + * seek to a frame referenced + * return size of the frame + * + * see: also: hyx_seek_by_name () + * + * written: 1997-11-09 + * latest update: 1997-11-09 12:41:55 + * $Id: hyxl0012.c,v 1.2 2002/01/27 23:01:44 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/fileio.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +long hcc_seek_by_name (struct HYX_CLUSTER_CONTROL *hcc, char *frame_name) +{ + if (hcc == (struct HYX_CLUSTER_CONTROL *) 0 + || hcc->HCC_open_mode == HCC_om_error + || (hcc->HCC_open_mode == HCC_om_closed + && hcc_open (hcc, HCC_om_read) == -1 + ) + ) return -1L; + + return hyx_seek_by_name (hcc->HCC_f_hyx, hcc->HCC_f_idx, + hcc->HCC_f_lut, hcc->HCC_f_xfn, + frame_name); +} diff --git a/lib/ds/hyxl/hyxl0012.o b/lib/ds/hyxl/hyxl0012.o new file mode 100644 index 0000000000000000000000000000000000000000..33a414b4603efccb795ce87b56e6d97790979a10 Binary files /dev/null and b/lib/ds/hyxl/hyxl0012.o differ diff --git a/lib/ds/hyxl/hyxl0013.c b/lib/ds/hyxl/hyxl0013.c new file mode 100644 index 0000000000000000000000000000000000000000..be2a204aef3a82fbee326033c14a26ad02e95c54 --- /dev/null +++ b/lib/ds/hyxl/hyxl0013.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/hyxl/hyxl0013.c + * + * written: 2002-01-28 + * latest update: 2002-01-28 19:09:11 + * $Id: hyxl0013.c,v 1.3 2010/05/04 00:03:22 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +HYX_CLUSTER_CONTROL *new_HYX_CLUSTER_CONTROL (char *fnm_hyx) +{ + struct HYX_CLUSTER_CONTROL *p; + + if ((p= hyx_new_cluster_control ()) == (struct HYX_CLUSTER_CONTROL *) 0) + { +ERROR: + return (struct HYX_CLUSTER_CONTROL *) 0; + } + + if (hcc_set_cluster_name (p, fnm_hyx) == -1) + { + hcc_destroy (p); + p->HCC_next_index= 1L; + goto ERROR; + } + + return p; +} diff --git a/lib/ds/hyxl/hyxl0013.o b/lib/ds/hyxl/hyxl0013.o new file mode 100644 index 0000000000000000000000000000000000000000..79ae32c176617dc1aefc94abb035820fad7d3d49 Binary files /dev/null and b/lib/ds/hyxl/hyxl0013.o differ diff --git a/lib/ds/hyxl/hyxl0014.c b/lib/ds/hyxl/hyxl0014.c new file mode 100644 index 0000000000000000000000000000000000000000..75a108ae7393949756819e33d523b2ead3dd8f57 --- /dev/null +++ b/lib/ds/hyxl/hyxl0014.c @@ -0,0 +1,22 @@ +/* + * FILE %ds/hyxl/hyxl0014.c + * + * written: 2002-07-16 + * $Id: hyxl0014.c,v 1.1 2002/07/17 07:19:40 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hcc_add_frame ( +struct HYX_CLUSTER_CONTROL *hcc, +char *frame_name) +{ + return ytree_set_value (&hcc->HCC_ytree, frame_name, hcc->HCC_next_index++); +} diff --git a/lib/ds/hyxl/hyxl0014.o b/lib/ds/hyxl/hyxl0014.o new file mode 100644 index 0000000000000000000000000000000000000000..8460204cf261ebb3ed73f0c6e156a64625dce5ec Binary files /dev/null and b/lib/ds/hyxl/hyxl0014.o differ diff --git a/lib/ds/hyxl/hyxl0101.c b/lib/ds/hyxl/hyxl0101.c new file mode 100644 index 0000000000000000000000000000000000000000..0bc1fb2678277919af6564cc204af2e3fa4d7dce --- /dev/null +++ b/lib/ds/hyxl/hyxl0101.c @@ -0,0 +1,54 @@ +/* + * FILE %ds/hyxl/hyxl0101.c + * + * analyze a string if it contains a date + * + * written: 1996-11-10 + * latest update: 1996-11-10 16:31:09 + * $Id: hyxl0101.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* see: #include "edctx.h" */ +#include <stdio.h> +#include <string.h> +#include <gg/dates.h> +#include <gg/hyx.h> + +/* ------------------------------------------------------------------------ */ +int hyx_rule_calendar ( +const char *token, +char **res_string, +char **res_type, +void *client_data) +{ + int jahr, mon, tag, std, minutes, sek, x_timezone; + char str1 [80]; + +#ifdef MSDOS + client_data; +#endif + + if (analyze_date (token, + &jahr, &mon, &tag, + &std, &minutes, &sek, + &x_timezone) == -1 + || jahr == -1 + || mon == -1 + || tag == -1 + ) + return 0; + + sprintf (str1, + "<hyx.l cl=\"%%cal-%04d\" fr=\"%04d-%02d-%02d\" tdp=%d>", + jahr, jahr, mon, tag, strlen (token)); + + *res_string= strdup (str1); + *res_type= strdup ("F"); + + return 1; +} diff --git a/lib/ds/hyxl/hyxl0101.o b/lib/ds/hyxl/hyxl0101.o new file mode 100644 index 0000000000000000000000000000000000000000..fe0b337ec09ca6ed637e9c5cfcaa65897a679e5c Binary files /dev/null and b/lib/ds/hyxl/hyxl0101.o differ diff --git a/lib/ds/hyxl/lib b/lib/ds/hyxl/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/hyxl/libgg.a b/lib/ds/hyxl/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/hyxl/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/hyxl/make-dos b/lib/ds/hyxl/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..bd1e4f3a2a2be89aa97a1f262ababde666b70921 --- /dev/null +++ b/lib/ds/hyxl/make-dos @@ -0,0 +1,23 @@ +# +# FILE %ds/hyxl/makefile +# +# written: 1993-03-07 +# latest update: 1997-11-09 12:48:48 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 HYPER_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : hyxl0001.obj hyxl0002.obj hyxl0003.obj hyxl0004.obj hyxl0005.obj ! + hyxl0006.obj hyxl0007.obj hyxl0008.obj hyxl0009.obj hyxl0010.obj ! + hyxl0011.obj hyxl0012.obj ! + hyxl0101.obj + +# llink -n0 -l$(lib).lib -dhyxlib.mod + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/hyxp/(dirinf).fm b/lib/ds/hyxp/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..460b349a9020f0b2d6bea3f9709aaaef82d04adb --- /dev/null +++ b/lib/ds/hyxp/(dirinf).fm @@ -0,0 +1,52 @@ +# +# FILE %ds/hyxp/(dirinf).fm +# +# hyx parser subroutines +# +# written: 1995-03-19 +# latest update: 2001-02-18 17:31:16 +# $Id: (dirinf).fm,v 1.2 2001/02/19 00:27:52 gonter Exp $ +# +# ---------------------------------------------------------------------------- +Makefile active Makefile +make-ux Makefile (Unix) +make-c5 Makefile (MSDOS) + +# see also %lexicon/pt.c + +hyxp0001.c struct HYX_PARSER_STATUS *hyx_parser_reset (void); +hyxp0002.c struct TEXT_ELEMENT *hyx_parse_char (...) +hyxp0003.c int hyx_parse2_char (struct HYX_PARSER_STATUS *hps, ...) +hyxp0004.c int hyx_parse1_file (FILE *fhyx,...) +hyxp0005.c int hyx_parse2_file (...) +hyxp0006.c int hyx_parse1_string (char *str,...) +hyxp0007.c int hyx_parse2_string (...) +hyxp0008.c int hyx_parse2_block (struct HYX_PARSER_STATUS *hps, ...) +hyxp0009.c struct TEXT_SEGMENT *hyx_mktx_segm (char *s,...) +hyxp0010.c struct TEXT_ELEMENT *hyx_mktx_elem (long lev); +hyxp0011.c struct TEXT_ELEMENT *hyx_mktx_elem_and_segm (char *str, +hyxp0012.c int hyx_frtx_elem_list (...) +hyxp0013.c int hyx_frtx_segm_list (...) +hyxp0014.c int hyx_strip_text_elem (struct TEXT_ELEMENT *t); +hyxp0015.c struct MARKUP *hyx_make_markup (void *start_tag,...) +hyxp0016.c int hyx_text_to_markup (...) +hyxp0017.c int hyx_copy_tx_segm_list (char *dest, int size,...) +hyxp0018.c struct TEXT_ELEMENT *hyx_append_tx_elem_list (...) +hyxp0019.c struct TEXT_ELEMENT **hyx_find_last_tx_elem_ptr (...) +hyxp0020.c long hyx_tx_segm_count_char (...) +hyxp0021.c struct TEXT_ELEMENT *hyx_parse_block (...) +hyxp0022.c struct TEXT_ELEMENT *hyx_parse_string (...) +hyxp0023.c int hyx_parse_hyx_frame (char *lexicon_file,...) +hyxp0024.c int hyx_parse_hyx_frame_file (FILE *fhyx, FILE *fidx,...) +hyxp0025.c int hyx_transfer_details (struct HYX_PARSER_STATUS *hps, tt) +hyxp0026.c int hyx_parser_add_char +hyxp0027.c int hyx_parser_finish +hyxp0028.c int hyx_parser_finish_segment +hyxp0029.c struct HYX_PARSER_CLASS *hyx_init_parser_class () +hyxp0030.c int hyx_read_tag_definition (struct HYX_PARSER_CLASS *hpc, char *fn) +hyxp0031.c int hyx_process_tag_definition (struct HYX_PARSER_CLASS *hpc, char *line) +hyxp0032.c struct TAG_DEFINITION *hyx_identify_tag (...) +hyxp0033.c struct TAG_DEFINITION *hyx_make_tag_definition (...) +hyxp0034.c struct TAG_DEFINITION *hyx_find_tag_definition (...) +hyxp0035.c long hyx_get_tag_definition (...) + diff --git a/lib/ds/hyxp/Makefile b/lib/ds/hyxp/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..0861a49f2de5c80405c2fea8b7ed4a52d470786f --- /dev/null +++ b/lib/ds/hyxp/Makefile @@ -0,0 +1,37 @@ +# +# FILE %ds/hyxp/make-ux +# +# written: 1995-12-20 +# latest update: 2001-02-18 17:40:11 +# $Id: Makefile,v 1.3 2001/02/19 00:27:52 gonter Exp $ +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-g -I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow + +# ---------------------------------------------------------------------------- +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + hyxp0001.o hyxp0002.o hyxp0003.o hyxp0004.o hyxp0005.o hyxp0006.o \ + hyxp0007.o hyxp0008.o hyxp0009.o hyxp0010.o hyxp0011.o hyxp0012.o \ + hyxp0013.o hyxp0014.o hyxp0015.o hyxp0016.o hyxp0017.o hyxp0018.o \ + hyxp0019.o hyxp0020.o hyxp0021.o hyxp0022.o hyxp0023.o hyxp0024.o \ + hyxp0025.o hyxp0026.o hyxp0027.o hyxp0028.o hyxp0029.o hyxp0030.o \ + hyxp0031.o hyxp0032.o hyxp0033.o hyxp0034.o hyxp0035.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $? diff --git a/lib/ds/hyxp/contrib b/lib/ds/hyxp/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/hyxp/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/hyxp/gg b/lib/ds/hyxp/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/hyxp/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/hyxp/gg01.sgm b/lib/ds/hyxp/gg01.sgm new file mode 100644 index 0000000000000000000000000000000000000000..9e2d5732ad7ec6fe7fea019f2d8bda5cec5c45dc --- /dev/null +++ b/lib/ds/hyxp/gg01.sgm @@ -0,0 +1,20 @@ +<!-- FILE %ds/hyxp/gg01.sgm 1996-02-19 21:18:44 --> + +<test> +The following elements are recognized or not: +- YES <minimized/text/ +- YES <emph meth=urxn /minimized/ +- YES <emph meth=urxn/minimized/ +- YES <emph meth="urxn"/minimized/ +- YES <emph meth="urxn/minimized"/urxn/ +- YES <emph meth="urxn/minimized/"/urxn/ +- YES <emph meth="urxn/minimized/" /urxn/ +- YES <emph meth='urxn/minimized/' /urxn/ +- YES and <tag1<tag2>asdfasdf</</> +- YES <h1>this is a header</h1> +- YES <?bold>urxn +- ? x > y +- ? x < y +</test> + + diff --git a/lib/ds/hyxp/hyxp0001.c b/lib/ds/hyxp/hyxp0001.c new file mode 100644 index 0000000000000000000000000000000000000000..a52ca500c6006d7611d2180d86a4811dbcc6d09f --- /dev/null +++ b/lib/ds/hyxp/hyxp0001.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/hyxp/hyxp0001.c + * + * initialize a virtual SGML parser + * + * written: 1991-03-12 + * latest update: 1996-02-18 10:47:20 + * + */ + +#include <stdlib.h> +#include <gg/parse.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +struct HYX_PARSER_STATUS *hyx_parser_reset (struct HYX_PARSER_CLASS *hpc) +{ + struct HYX_PARSER_STATUS *hps; + + if ((hps= hyx_new_parser_status ()) != (struct HYX_PARSER_STATUS *) 0) + { + hps->HPS_hpc= hpc; + + hps->HPS_ptx= &hps->HPS_tx_list; + hps->HPS_level_changed= 1; + + hps->HPS_last_cat_code= -1; + } + + return hps; +} diff --git a/lib/ds/hyxp/hyxp0001.o b/lib/ds/hyxp/hyxp0001.o new file mode 100644 index 0000000000000000000000000000000000000000..a2c61add11d68a423dcd408301d51d97d5fa879c Binary files /dev/null and b/lib/ds/hyxp/hyxp0001.o differ diff --git a/lib/ds/hyxp/hyxp0002.c b/lib/ds/hyxp/hyxp0002.c new file mode 100644 index 0000000000000000000000000000000000000000..510a4a917ccb2974bba10fe0a72696be0859d01d --- /dev/null +++ b/lib/ds/hyxp/hyxp0002.c @@ -0,0 +1,311 @@ +/* + * FILE %ds/hyxp/hyxp0002.c + * + * Parse SGML sequences and generate attributed text segments. + * The attribute of a segment contains the text level, incremented + * or decremented by the '<' and '>' metacharacters respectively. + * level 0: normal text + * level 1: SGML sequence + * Other levels are used in declarations, not handled currently + * + * For details about the operation and the future direction + * see struct HYX_PARSER_STATUS and the notes about ongoing + * ongoing restructuring of the parser. + * + * written: 1991-03-12 + * latest update: 1996-02-26 0:53:06 + * $Id: hyxp0002.c,v 1.4 2004/05/08 15:40:18 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/parse.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* states: ---------------------------------------------------------------- */ +#define HPSst_start 0 +#define HPSst_markup_open 1 +#define HPSst_markup_declaration 2 +#define HPSst_markup_element 3 +#define HPSst_markup_element_quoted 4 +#define HPSst_processing_instruction 5 +#define HPSst_minimized_text 6 +#define HPSst_markup_open2 7 +#define HPSst_md_c1 8 /* first comment char in decl. */ +#define HPSst_md_c2 9 /* first comment char in decl. */ +#define HPSst_md_c3 10 /* first comment char in decl. */ + +/* #define PARSER_DEBUG 1 */ + +/* ------------------------------------------------------------------------ */ +struct TEXT_ELEMENT *hyx_parse_char ( +struct HYX_PARSER_STATUS *lps, +int ch) +{ + struct TEXT_ELEMENT *tt= (struct TEXT_ELEMENT *) 0; + struct HYX_PARSER_CLASS *hpc; + int is_minimization_begin= 0; + int is_minimization_end= 0; + int segment_finished= 0; + +#ifdef PARSER_DEBUG + if (PARSER_DEBUG >= 0) + { + /**** printf ("BEGIN hyxp0002.c SGML parser\n"); ****/ + printf ("state=%d ch=0x%02X '%c'\n", + lps->HPS_state, ch, (ch >= 0x20) ? ch : '.'); + } +#endif /* PARSER_DEBUG */ + + hpc= lps->HPS_hpc; + + switch (lps->HPS_state) + { + case HPSst_start: + if (ch == hpc->HPC_tag_open) + { + /************** + tt= hyx_parser_finish (lps); + segment_finished= 1; + lps->HPS_parser_level++; + **************/ + lps->HPS_state= HPSst_markup_open; + } + else + { + hyx_parser_add_char (lps, ch); + } + break; + + case HPSst_markup_open: + if (ch == hpc->HPC_declaration_start) + { + tt= hyx_parser_finish (lps); + segment_finished= 1; + lps->HPS_parser_level++; + + lps->HPS_element_type= TEt_declaration; + lps->HPS_state= HPSst_markup_declaration; + } + else + if (ch == hpc->HPC_processing_start) + { + tt= hyx_parser_finish (lps); + segment_finished= 1; + lps->HPS_parser_level++; + + lps->HPS_element_type= TEt_processing; + lps->HPS_state= HPSst_processing_instruction; + } + else + if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') + { /* not a tag begin according to the standard */ + hyx_parser_add_char (lps, '<'); + hyx_parser_add_char (lps, ch); + lps->HPS_state= HPSst_start; + /* lps->HPS_parser_level--; */ + } + else + if ((ch >= 'A' && ch <= 'Z') + || (ch >= 'a' && ch <= 'z') + || ch == '/' /* markup close */ + || ch == '-' /* !! uncorrect comment */ + || ch == ':' || ch == ';' /* !! HYX */ + ) + { + tt= hyx_parser_finish (lps); + segment_finished= 1; + lps->HPS_parser_level++; + + lps->HPS_state= HPSst_markup_element; + lps->HPS_element_type= TEt_tag; + hyx_parser_add_char (lps, ch); + } + else + { + /* T2D: ERROR */ + } + break; + + case HPSst_markup_open2: + if (ch == hpc->HPC_declaration_start) + { + lps->HPS_element_type= TEt_declaration; + lps->HPS_state= HPSst_markup_declaration; + } + else + if (ch == hpc->HPC_processing_start) + { + lps->HPS_element_type= TEt_processing; + lps->HPS_state= HPSst_processing_instruction; + } + else + if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') + { /* not a tag begin according to the standard */ + hyx_parser_add_char (lps, '<'); + hyx_parser_add_char (lps, ch); + lps->HPS_state= HPSst_start; + /* lps->HPS_parser_level--; */ + } + else + if ((ch >= 'A' && ch <= 'Z') + || (ch >= 'a' && ch <= 'z') + || ch == '/' /* markup close */ + || ch == '-' /* !! uncorrect comment */ + || ch == ':' || ch == ';' /* !! HYX */ + ) + { + lps->HPS_state= HPSst_markup_element; + lps->HPS_element_type= TEt_tag; + hyx_parser_add_char (lps, ch); + } + else + { + /* T2D: ERROR */ + } + break; + + case HPSst_markup_element: /* characters of a tag name */ + if (ch == hpc->HPC_tag_open) + { /* T2D: minimzation!!!! */ + tt= hyx_parser_finish (lps); + segment_finished= 1; + lps->HPS_state= HPSst_markup_open2; + } + else + if (ch == hpc->HPC_tag_close) + { + tt= hyx_parser_finish (lps); + segment_finished= 1; + /* T2D: drop back context */ + lps->HPS_state= HPSst_start; + lps->HPS_parser_level--; + } + else + if (ch == hpc->HPC_minimization_char) + { + tt= hyx_parser_finish (lps); + segment_finished= 1; + /* T2D: drop back context */ + lps->HPS_state= HPSst_minimized_text; + lps->HPS_parser_level--; + } + else + if (ch == '\"' || ch == '\'') + { + hyx_parser_add_char (lps, ch); + lps->HPS_state= HPSst_markup_element_quoted; + lps->HPS_other_quote= ch; + } + else + { + hyx_parser_add_char (lps, ch); + } + break; + + case HPSst_markup_element_quoted: + if (ch == lps->HPS_other_quote) + { + hyx_parser_add_char (lps, ch); + lps->HPS_state= HPSst_markup_element; + } + else + { + hyx_parser_add_char (lps, ch); + } + break; + + case HPSst_markup_declaration: /* not OK */ + if (ch == hpc->HPC_tag_close) + { + tt= hyx_parser_finish (lps); + segment_finished= 1; + /* T2D: drop back context */ + lps->HPS_state= HPSst_start; + lps->HPS_parser_level--; + } + else + { + if (ch == '-') /* T2D: formalize! */ + { + lps->HPS_state= HPSst_md_c1; + } + hyx_parser_add_char (lps, ch); + } + break; + + case HPSst_md_c1: + hyx_parser_add_char (lps, ch); + lps->HPS_state= (ch == '-') ? HPSst_md_c2 : HPSst_markup_declaration; + break; + + case HPSst_md_c2: + hyx_parser_add_char (lps, ch); + if (ch == '-') /* T2D: formalize! */ + { + lps->HPS_state= HPSst_md_c3; + } + break; + + case HPSst_md_c3: + hyx_parser_add_char (lps, ch); + lps->HPS_state= (ch == '-') ? HPSst_markup_declaration : HPSst_md_c2; + break; + + case HPSst_processing_instruction: /* OK */ + if (ch == hpc->HPC_tag_close) + { + tt= hyx_parser_finish (lps); + segment_finished= 1; + /* T2D: drop back context */ + lps->HPS_state= HPSst_start; + lps->HPS_parser_level--; + } + else + { + hyx_parser_add_char (lps, ch); + } + break; + + case HPSst_minimized_text: + if (ch == hpc->HPC_minimization_char) + { + tt= hyx_parser_finish (lps); + + lps->HPS_state= HPSst_markup_element; + lps->HPS_element_type= TEt_tag; + lps->HPS_parser_level++; + hyx_parser_add_char (lps, '/'); + tt= hyx_parser_finish (lps); + + lps->HPS_parser_level--; + segment_finished= 1; + lps->HPS_state= HPSst_start; + } + else + { + hyx_parser_add_char (lps, ch); + } + break; + + default: + fprintf (stderr, "internal error, state not know! %d\n", + lps->HPS_state); + break; + } + +#ifdef PARSER_DEBUG +if (segment_finished) +{ + printf (">>>>>>>>>\n"); +diag_display_markup (stdout, hpc, lps->HPS_tx_list, 0, 0, 0); +printf ("\n<<<<<<<<<\n"); +} +#endif /* PARSER_DEBUG */ + + return tt; +} diff --git a/lib/ds/hyxp/hyxp0002.o b/lib/ds/hyxp/hyxp0002.o new file mode 100644 index 0000000000000000000000000000000000000000..11dcfa148db877275316c78916b9a34031b3a28c Binary files /dev/null and b/lib/ds/hyxp/hyxp0002.o differ diff --git a/lib/ds/hyxp/hyxp0003.c b/lib/ds/hyxp/hyxp0003.c new file mode 100644 index 0000000000000000000000000000000000000000..40a1cefb9b7f1e91af12e20c564c72c33b97a0e4 --- /dev/null +++ b/lib/ds/hyxp/hyxp0003.c @@ -0,0 +1,59 @@ +/* + * FILE %ds/hyxp/hyxp0003.c + * + * read one lexicon entry + * + * written: 1995-07-04 + * 1996-02-18 12:29:27 + * latest update: 2001-02-18 18:55:17 + * $Id: hyxp0003.c,v 1.5 2004/05/08 15:40:19 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int hyx_parse2_char ( +struct HYX_PARSER_STATUS *hps, +struct TEXT_ELEMENT **le, /* datastructure to be built */ +int ch, /* character to be processed */ +long end_tags [], /* set of possible end tags */ +int end_tag_count) /* number of possible endtags */ +{ + struct HYX_PARSER_CLASS *hpc; + struct TEXT_ELEMENT *tt; /* read tagging text */ + long t_id; /* tag id of the read taggin text */ + int i; /* end tag index */ + + if ((tt= hyx_parse_char (hps, ch)) != (struct TEXT_ELEMENT *) 0) + { + hpc= hps->HPS_hpc; +#ifdef PARSER_DEBUG +printf ("hyxp0003: po_id_tag=%d po_strip=%d\n", + hpc->HPC_po_id_tag, hpc->HPC_po_strip); +#endif + + if (hpc->HPC_po_strip) hyx_strip_text_elem (tt); + + if (hpc->HPC_po_id_tag + && (t_id= hyx_get_tag_definition (hpc, tt, 1)) > 0L + ) + { + for (i= 0; i < end_tag_count; i++) + if (t_id == end_tags [i]) + { + *le= hyx_parser_get_text_list (hps); + return 1; /* there's nothing else to read for now ... */ + } + } + } + + if (ch == -1) + { + *le= hyx_parser_get_text_list (hps); + return 1; + } + + return 0; +} diff --git a/lib/ds/hyxp/hyxp0003.o b/lib/ds/hyxp/hyxp0003.o new file mode 100644 index 0000000000000000000000000000000000000000..37e96cfb3d006c966edbd609e2171abcaf460521 Binary files /dev/null and b/lib/ds/hyxp/hyxp0003.o differ diff --git a/lib/ds/hyxp/hyxp0004.c b/lib/ds/hyxp/hyxp0004.c new file mode 100644 index 0000000000000000000000000000000000000000..73d16eb272e46b4d68a5d8f2b44c8d91ade3102f --- /dev/null +++ b/lib/ds/hyxp/hyxp0004.c @@ -0,0 +1,53 @@ +/* + * FILE %ds/hyxp/hyxp0004.c + * + * read one lexicon entry + * + * written: 1991 03 26 + * 1996-06-09 10:52:52 + * latest update: 2001-02-18 19:00:07 + * $Id: hyxp0004.c,v 1.4 2002/01/22 03:07:35 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/parse.h> +#include <gg/diagnose.h> + +/* ------------------------------------------------------------------------ */ +int hyx_parse1_file ( +struct HYX_PARSER_CLASS *hpc, +FILE *fi, /* file to be read from */ +struct TEXT_ELEMENT **le, /* datastructure to be built */ +long end_tags [], /* set of possible end tags */ +int end_tag_count, /* number of possible endtags */ +long max_to_read, /* number of bytes to be read at most */ +long *bytes_read) /* number of bytes actually read */ +{ + struct HYX_PARSER_STATUS *hps; + int rc; + + gg_diagnose= LEX_RT_no_frame_close; + + if ((hps= hyx_parser_reset (hpc)) == (struct HYX_PARSER_STATUS *) 0) + { + gg_diagnose= LEX_RT_init_error; + return -1; + } + + *le= (struct TEXT_ELEMENT *) 0; + gg_diagnose= 0L; + + rc= hyx_parse2_file (hps, fi, le, end_tags, end_tag_count, + max_to_read, bytes_read); + +#ifdef PARSER_DEBUG + printf (">>> hyxp0004: hps->HPS_tx_cnt= %ld\n", hps->HPS_tx_cnt); + diag_display_markup (stdout, hpc, hps->HPS_tx_list, 1, 1, 1); +#endif /* PARSER_DEBUG */ + + free (hps); + + return rc; +} diff --git a/lib/ds/hyxp/hyxp0004.o b/lib/ds/hyxp/hyxp0004.o new file mode 100644 index 0000000000000000000000000000000000000000..ded630e9ed49203b65b3b925986cb0048e39ff33 Binary files /dev/null and b/lib/ds/hyxp/hyxp0004.o differ diff --git a/lib/ds/hyxp/hyxp0005.c b/lib/ds/hyxp/hyxp0005.c new file mode 100644 index 0000000000000000000000000000000000000000..a1137664627dfe2815d81cc2afd67f164663470c --- /dev/null +++ b/lib/ds/hyxp/hyxp0005.c @@ -0,0 +1,73 @@ +/* + * FILE 1996-02-11 12:59:28 + * + * read one lexicon entry + * + * written: 1995-03-19 + * latest update: 1996-02-11 12:59:39 + * $Id: hyxp0005.c,v 1.3 2003/06/25 10:11:56 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/diagnose.h> + +/* ------------------------------------------------------------------------ */ +int hyx_parse2_file ( +struct HYX_PARSER_STATUS *hps, +FILE *fi, /* file to be read from */ +struct TEXT_ELEMENT **le, /* datastructure to be built */ +long end_tags [], /* set of possible end tags */ +int end_tag_count, /* number of possible endtags */ +long max_to_read, /* number of bytes to be read at most */ +long *bytes_read) /* number of bytes actually read */ +{ + int rc= 0; + int ch; /* character read */ + long byte_count= 0L; /* number of bytes read sofar */ + + gg_diagnose= LEX_RT_no_frame_close; + + if (bytes_read == (long *) 0 || le == (struct TEXT_ELEMENT **) 0) + { + gg_diagnose= LEX_RT_init_error; + return -1; + } + + if (max_to_read <= 0L) goto STOP; + + for (;; max_to_read--) + { + if (max_to_read > 0L) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) + { + if (byte_count == 0L) break; + ch= -1; + } + else + { + byte_count++; + } + } + else ch= -1; + + rc= hyx_parse2_char (hps, le, ch, end_tags, end_tag_count); +/** +fprintf (stderr, "hyxp0005.c: parse2_char ch='%c' 0x%02X rc=%d cnt=%d\n", + ch, ch, rc, end_tag_count); +**/ + if (rc != 0) + { + if (rc > 0) rc= 0; + break; + } + } + +STOP: + *bytes_read= byte_count; + + return rc; +} diff --git a/lib/ds/hyxp/hyxp0005.o b/lib/ds/hyxp/hyxp0005.o new file mode 100644 index 0000000000000000000000000000000000000000..78f795ac44c57f8da81b45bdcfbffc834255f1d4 Binary files /dev/null and b/lib/ds/hyxp/hyxp0005.o differ diff --git a/lib/ds/hyxp/hyxp0006.c b/lib/ds/hyxp/hyxp0006.c new file mode 100644 index 0000000000000000000000000000000000000000..9e0d96bafb5c3b74120f81a4007a3c87f42b7816 --- /dev/null +++ b/lib/ds/hyxp/hyxp0006.c @@ -0,0 +1,46 @@ +/* + * FILE %ds/hyxp/hyxp0006.c + * + * read one lexicon entry + * + * written: 1991 03 26 + * latest update: 1996-02-18 12:04:10 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/parse.h> +#include <gg/diagnose.h> + +/* ------------------------------------------------------------------------ */ +int hyx_parse1_string ( +struct HYX_PARSER_CLASS *hpc, +char *str, /* string to be read */ +struct TEXT_ELEMENT **le, /* datastructure to be built */ +long end_tags [], /* set of possible end tags */ +int end_tag_count, /* number of possible endtags */ +long max_to_read, /* number of bytes to be read at most */ +long *bytes_read) /* number of bytes actually read */ +{ + struct HYX_PARSER_STATUS *hps; + int rc; + + gg_diagnose= LEX_RT_no_frame_close; + + if ((hps= hyx_parser_reset (hpc)) == (struct HYX_PARSER_STATUS *) 0) + { + gg_diagnose= LEX_RT_init_error; + return -1; + } + + *le= (struct TEXT_ELEMENT *) 0; + gg_diagnose= 0L; + + rc= hyx_parse2_string (hps, str, le, end_tags, end_tag_count, + max_to_read, bytes_read); + + free (hps); + + return rc; +} diff --git a/lib/ds/hyxp/hyxp0006.o b/lib/ds/hyxp/hyxp0006.o new file mode 100644 index 0000000000000000000000000000000000000000..c5ec5b004900778e81d509aaa721e5a524449da8 Binary files /dev/null and b/lib/ds/hyxp/hyxp0006.o differ diff --git a/lib/ds/hyxp/hyxp0007.c b/lib/ds/hyxp/hyxp0007.c new file mode 100644 index 0000000000000000000000000000000000000000..40eb9d87255ca7033ce83ea61c8d353c97725e52 --- /dev/null +++ b/lib/ds/hyxp/hyxp0007.c @@ -0,0 +1,71 @@ +/* + * FILE ~/usr/ds/hyxp/hyxp0007.c + * + * read one lexicon entry + * + * written: 1995-03-19 + * latest update: 1995-08-05 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/parse.h> +#include <gg/diagnose.h> + +/* ------------------------------------------------------------------------ */ +int hyx_parse2_string ( +struct HYX_PARSER_STATUS *hps, /* currently processed SGML structure */ +char *str, /* string to be read */ +struct TEXT_ELEMENT **le, /* datastructure to be built */ +long end_tags [], /* set of possible end tags */ +int end_tag_count, /* number of possible endtags */ +long max_to_read, /* number of bytes to be read at most */ +long *bytes_read) /* number of bytes actually read */ +{ + int rc= 0; + int ch; /* character read */ + long byte_count= 0L; /* number of bytes read sofar */ + + gg_diagnose= LEX_RT_no_frame_close; + + if (bytes_read == (long *) 0 + || str == (char *) 0 + || hps == (struct HYX_PARSER_STATUS *) 0 + || le == (struct TEXT_ELEMENT **) 0) + { + gg_diagnose= LEX_RT_init_error; + return -1; + } + + if (max_to_read <= 0L) goto STOP; + + for (;; max_to_read--) + { + if (max_to_read > 0L) + { + ch= *str++ & 0x00FF; + if (ch == 0) + { + if (byte_count == 0L) break; + ch= -1; + } + else + { + byte_count++; + } + } + else ch= -1; + + if ((rc= hyx_parse2_char (hps, le, ch, end_tags, end_tag_count)) != 0) + { + if (rc > 0) rc= 0; + break; + } + } + +STOP: + *bytes_read= byte_count; + + return rc; +} diff --git a/lib/ds/hyxp/hyxp0007.o b/lib/ds/hyxp/hyxp0007.o new file mode 100644 index 0000000000000000000000000000000000000000..cff1ebaf9387e70777a9da6f9f387efd5ac99fab Binary files /dev/null and b/lib/ds/hyxp/hyxp0007.o differ diff --git a/lib/ds/hyxp/hyxp0008.c b/lib/ds/hyxp/hyxp0008.c new file mode 100644 index 0000000000000000000000000000000000000000..0b182c2b692325dcf3db304724af8d8d92a7fccb --- /dev/null +++ b/lib/ds/hyxp/hyxp0008.c @@ -0,0 +1,65 @@ +/* + * FILE %ds/hyxp/hyxp0008.c + * + * incrementally parse a block of data a SGML structure + * + * written: 1995-08-05: derived from hyx_parse2_string () + * latest update: 1995-08-05 + * $Id: hyxp0008.c,v 1.3 2003/06/25 10:11:56 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/parse.h> +#include <gg/diagnose.h> + +/* ------------------------------------------------------------------------ */ +int hyx_parse2_block ( +struct HYX_PARSER_STATUS *hps, /* currently processed SGML structure */ +char *str, /* string to be read */ +struct TEXT_ELEMENT **le, /* datastructure to be built */ +long end_tags [], /* set of possible end tags */ +int end_tag_count, /* number of possible endtags */ +long max_to_read, /* number of bytes to be read at most */ +long *bytes_read) /* number of bytes actually read */ +{ + int rc= 0; + int ch; /* character read */ + long byte_count= 0L; /* number of bytes read sofar */ + + gg_diagnose= LEX_RT_no_frame_close; + + if (bytes_read == (long *) 0 + || str == (char *) 0 + || hps == (struct HYX_PARSER_STATUS *) 0 + || le == (struct TEXT_ELEMENT **) 0 + ) + { + gg_diagnose= LEX_RT_init_error; + return -1; + } + + if (max_to_read <= 0L) goto STOP; + + for (; max_to_read > 0L; max_to_read--) + { + if ((ch= *str++ & 0x00FF) == 0) continue; + byte_count++; + + rc= hyx_parse2_char (hps, le, ch, end_tags, end_tag_count); +/** +fprintf (stderr, "hyxp0008.c: parse2_char ch='%c' 0x%02X rc=%d cnt=%d\n", + ch, ch, rc, end_tag_count); +**/ + if (rc != 0) + { + break; + } + } + +STOP: + *bytes_read= byte_count; + + return rc; +} diff --git a/lib/ds/hyxp/hyxp0008.o b/lib/ds/hyxp/hyxp0008.o new file mode 100644 index 0000000000000000000000000000000000000000..31e07c4daea28e8887214344864fed86b2c6cce1 Binary files /dev/null and b/lib/ds/hyxp/hyxp0008.o differ diff --git a/lib/ds/hyxp/hyxp0009.c b/lib/ds/hyxp/hyxp0009.c new file mode 100644 index 0000000000000000000000000000000000000000..ad572308b6e8a3649be2c3610bfd371c820e5fe1 --- /dev/null +++ b/lib/ds/hyxp/hyxp0009.c @@ -0,0 +1,48 @@ +/* + * FILE %ds/hyxp/hyxp0009.c + * + * Erzeugung von Text Segmenten + * + * written: 1991 03 12 + * 1991 03 27 + * 1995-03-30: moved to %ds/hyxp + * latest update: 1995-07-02 + * $Id: hyxp0009.c,v 1.3 2004/05/08 15:40:21 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +long _hyx_text_segment_allocated= 0L; +long _hyx_text_segment_alloc_size= 0L; + +/* ------------------------------------------------------------------------ */ +struct TEXT_SEGMENT *hyx_mktx_segm (char *s, long lng) +{ + struct TEXT_SEGMENT *seg; + int siz; + + if (lng == 0L || s == (char *) 0) return (struct TEXT_SEGMENT *) 0; + + siz= sizeof (struct TEXT_SEGMENT) + (int) lng; + + if ((seg= (struct TEXT_SEGMENT *) calloc (siz+1, 1)) + == (struct TEXT_SEGMENT *) 0) return (struct TEXT_SEGMENT *) 0; + + _hyx_text_segment_allocated++; + _hyx_text_segment_alloc_size += (long) (siz+1); + + seg->sig= SIG_TEXT_SEGMENT; + + seg->TSEG_next= (struct TEXT_SEGMENT *) 0; + seg->TSEG_text_lng= lng; + + memcpy (seg->TSEG_text_array, s, (int) lng); + seg->TSEG_text_array [lng]= 0; + + return seg; +} diff --git a/lib/ds/hyxp/hyxp0009.o b/lib/ds/hyxp/hyxp0009.o new file mode 100644 index 0000000000000000000000000000000000000000..257952207cb11fbff0fce2d7e6c8f2a85c09f04b Binary files /dev/null and b/lib/ds/hyxp/hyxp0009.o differ diff --git a/lib/ds/hyxp/hyxp0010.c b/lib/ds/hyxp/hyxp0010.c new file mode 100644 index 0000000000000000000000000000000000000000..706e793f28e864a5e4aa4369c5b2703e06cef1f9 --- /dev/null +++ b/lib/ds/hyxp/hyxp0010.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/hyxp/hyxp0010.c + * + * Erzeugung von Text Elementen + * + * written: 1991 03 12 + * 1991 03 27 + * 1995-03-30: moved to %ds/hyxp + * latest update: 1996-02-18 21:21:44 + * $Id: hyxp0010.c,v 1.3 2004/05/08 15:40:21 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <memory.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +long _hyx_text_allocated= 0L; + +/* ------------------------------------------------------------------------ */ +struct TEXT_ELEMENT *hyx_mktx_elem (long lev, int typ) +{ + struct TEXT_ELEMENT *tx; + + if ((tx= (struct TEXT_ELEMENT *) calloc (sizeof (struct TEXT_ELEMENT), 1)) + != (struct TEXT_ELEMENT *) 0) + { + _hyx_text_allocated++; + + tx->sig= SIG_TEXT_ELEMENT; + tx->TE_level= lev; + tx->TE_link_count= 1; + tx->TE_type= typ; + } + + return tx; +} diff --git a/lib/ds/hyxp/hyxp0010.o b/lib/ds/hyxp/hyxp0010.o new file mode 100644 index 0000000000000000000000000000000000000000..ac548a639c922f88ad7f29a4768035ac032cdb45 Binary files /dev/null and b/lib/ds/hyxp/hyxp0010.o differ diff --git a/lib/ds/hyxp/hyxp0011.c b/lib/ds/hyxp/hyxp0011.c new file mode 100644 index 0000000000000000000000000000000000000000..e0c5af869b11fa3f0cdff368a3f48fdaedc8c922 --- /dev/null +++ b/lib/ds/hyxp/hyxp0011.c @@ -0,0 +1,58 @@ +/* + * FILE %ds/hyxp/hyxp0011.c + * + * Text Node und Text Segment Erzeugen + * + * written: 1991 03 27 + * latest update: 2001-02-18 18:16:58 + * $Id: hyxp0011.c,v 1.3 2003/06/25 10:11:56 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +struct TEXT_ELEMENT *hyx_mktx_elem_and_segm ( +struct HYX_PARSER_CLASS *hpc, +char *str, +long lng, +long level, +int typ, +int get_tag_def, +int append) +{ + struct TEXT_ELEMENT *t; + struct TEXT_SEGMENT *ts; + int l; + +/** printf ("hyxp0011: str='%s', lng=%ld, level=%ld\n", str, lng, level); **/ + + if (str == (char *) 0 || *str == 0 + || (ts= hyx_mktx_segm (str, lng)) == (struct TEXT_SEGMENT *) 0 + || (t= hyx_mktx_elem (level, typ)) == (struct TEXT_ELEMENT *) 0 + ) + return (struct TEXT_ELEMENT *) 0; + + t->TE_text_segment= ts; + + if (get_tag_def && level == 1L) + { + char *name; + + for (l= 0; str [l]; l++) + { + if (str [l] == ' ' + || str [l] == '\t' + || str [l] == 0x0D + || str [l] == 0x0A + ) break; + } + + t->TE_tag_name= name= strndup (str, l); + t->TE_tag_definition= hyx_identify_tag (hpc, name, append); + } + + return t; +} diff --git a/lib/ds/hyxp/hyxp0011.o b/lib/ds/hyxp/hyxp0011.o new file mode 100644 index 0000000000000000000000000000000000000000..f6c2d40b5adc10436cc43b202707d2859c932610 Binary files /dev/null and b/lib/ds/hyxp/hyxp0011.o differ diff --git a/lib/ds/hyxp/hyxp0012.c b/lib/ds/hyxp/hyxp0012.c new file mode 100644 index 0000000000000000000000000000000000000000..aa833f2798bd86bf065cd58c9118c046a0b445d0 --- /dev/null +++ b/lib/ds/hyxp/hyxp0012.c @@ -0,0 +1,49 @@ +/* + * FILE ~/usr/ds/hyxp/hyxp0012.c + * + * written: 1991 03 18 + * 1995-03-30: moved to %ds/hyxp + * latest update: 1995-08-19 + * + */ + +#include <stdlib.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +long _hyx_text_freed= 0L; +long _hyx_markup_freed= 0L; + +/* ------------------------------------------------------------------------ */ +int hyx_frtx_elem_list (struct TEXT_ELEMENT *t1) +{ + struct TEXT_ELEMENT *t2; + struct MARKUP *m; + + while (t1 != (struct TEXT_ELEMENT *) 0) + { + t2= t1->TE_next; + + if (--(t1->TE_link_count) <= 0) + { + if (t1->sig == SIG_TEXT_ELEMENT) + { + hyx_frtx_segm_list (t1->TE_text_segment); + _hyx_text_freed++; + } + else + if (t1->sig == SIG_MARKUP) + { + m= (struct MARKUP *) t1; + hyx_frtx_elem_list (m->tag_open); + hyx_frtx_elem_list (m->tagged_text); + hyx_frtx_elem_list (m->tag_close); + _hyx_markup_freed++; + } + free (t1); + } + t1= t2; + } + + return 0; +} diff --git a/lib/ds/hyxp/hyxp0012.o b/lib/ds/hyxp/hyxp0012.o new file mode 100644 index 0000000000000000000000000000000000000000..afa905bb0e6b8ca6ff042fa1f22c6a05aa0ff7e7 Binary files /dev/null and b/lib/ds/hyxp/hyxp0012.o differ diff --git a/lib/ds/hyxp/hyxp0013.c b/lib/ds/hyxp/hyxp0013.c new file mode 100644 index 0000000000000000000000000000000000000000..c1cb2b086cd1f259a2944a864543e49b1f4d5ef7 --- /dev/null +++ b/lib/ds/hyxp/hyxp0013.c @@ -0,0 +1,35 @@ +/* + * FILE ~/usr/ds/hyxp/hyxp0013.c + * + * written: 1991 03 18 + * latest update: 1995-03-30: moved to %ds/hyxp + * + */ + +#include <stdlib.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +long _hyx_txsegm_freed= 0L; +long _hyx_txsegm_free_size= 0L; + +/* ------------------------------------------------------------------------ */ +int hyx_frtx_segm_list (struct TEXT_SEGMENT *ts1) +{ + struct TEXT_SEGMENT *ts2; + + while (ts1 != (struct TEXT_SEGMENT *) 0) + { + ts2= ts1->TSEG_next; + + _hyx_txsegm_free_size += ts1->TSEG_text_lng + + 1L + + (long) sizeof (struct TEXT_SEGMENT); + _hyx_txsegm_freed++; + + free (ts1); + ts1= ts2; + } + + return 0; +} diff --git a/lib/ds/hyxp/hyxp0013.o b/lib/ds/hyxp/hyxp0013.o new file mode 100644 index 0000000000000000000000000000000000000000..4c145e21f893c69f59d4ed1fd063cd7c827ce750 Binary files /dev/null and b/lib/ds/hyxp/hyxp0013.o differ diff --git a/lib/ds/hyxp/hyxp0014.c b/lib/ds/hyxp/hyxp0014.c new file mode 100644 index 0000000000000000000000000000000000000000..1d4497a8c9a92434dede7f4b18f653a18ed4028b --- /dev/null +++ b/lib/ds/hyxp/hyxp0014.c @@ -0,0 +1,118 @@ +/* + * FILE %ds/hyxp/hyxp0014.c + * + * remove white space characters at the beginning and end + * of a text segment and excessive white spaces inbetween + * a text segment. + * + * written: 1991 03 27 + * 1995-03-30: moved to %ds/hyxp + * latest update: 1996-02-11 12:53:47 + * $Id: hyxp0014.c,v 1.2 2003/06/25 10:11:56 gonter Exp $ + * + */ + +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +extern long _hyx_txsegm_free_size; + +/* ------------------------------------------------------------------------ */ +int hyx_strip_text_elem (struct TEXT_ELEMENT *t) +{ + struct TEXT_SEGMENT *ts1; + struct TEXT_SEGMENT *ts2; + char *cp1; + char *cp2; + long lng1; + long lng2; + int status= 0; + long discarded= 0L; + + ts1= t->TE_text_segment; + cp1= ts1->TSEG_text_array; + lng1= ts1->TSEG_text_lng; + ts2= t->TE_text_segment; + cp2= ts2->TSEG_text_array; + lng2= ts2->TSEG_text_lng; + + while (ts1 != (struct TEXT_SEGMENT *) 0) + { + if (lng1 == 0L) + { + if ((ts1= ts1->TSEG_next) == (struct TEXT_SEGMENT *) 0) + { + if (ts2 != (struct TEXT_SEGMENT *) 0 && discarded > 0L) + { + ts2->TSEG_text_lng -= discarded; + hyx_frtx_segm_list (ts2->TSEG_next); + } + break; + } + cp1= ts1->TSEG_text_array; + lng1= ts1->TSEG_text_lng; + } + +XXX: + if (lng2 == 0L) + { + if ((ts2= ts2->TSEG_next) == (struct TEXT_SEGMENT *) 0) + break; /* Fehler!! */ + cp1= ts2->TSEG_text_array; + lng1= ts2->TSEG_text_lng; + } + + switch (status) + { + case 0: + switch (*cp1 & 0x00FF) + { + case 0x20: case 0x09: + case 0x0A: case 0x0D: + discarded++; + break; + default: + *cp2++ = *cp1; + lng2--; + status= 1; + break; + } + break; + case 1: + switch (*cp1 & 0x00FF) + { + case 0x20: case 0x09: + case 0x0A: case 0x0D: + status= 2; + discarded++; + break; + default: + *cp2++= *cp1; + lng2--; + break; + } + break; + case 2: + switch (*cp1 & 0x00FF) + { + case 0x20: case 0x09: + case 0x0A: case 0x0D: + discarded++; + break; + default: + *cp2++= ' '; + lng2--; + discarded--; + status= 1; + goto XXX; /* character einsetzen */ + } + break; + } + cp1++; + lng1--; + } + + _hyx_txsegm_free_size += discarded; + + return (status == 0) ? 1 : 0; +} diff --git a/lib/ds/hyxp/hyxp0014.o b/lib/ds/hyxp/hyxp0014.o new file mode 100644 index 0000000000000000000000000000000000000000..607b6d027fe1628bd285b3641038ff7935499e9c Binary files /dev/null and b/lib/ds/hyxp/hyxp0014.o differ diff --git a/lib/ds/hyxp/hyxp0015.c b/lib/ds/hyxp/hyxp0015.c new file mode 100644 index 0000000000000000000000000000000000000000..8239d086f6507656f767eab43caaf3c2febd30a5 --- /dev/null +++ b/lib/ds/hyxp/hyxp0015.c @@ -0,0 +1,73 @@ +/* + * FILE %ds/hyxp/hyxp0015.c + * + * Text Node und Text Segment Erzeugen + * + * written: 1991 03 28 + * latest update: 1996-02-18 12:07:22 + * $Id: hyxp0015.c,v 1.3 2004/05/08 15:40:21 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +long _hyx_markup_allocated= 0L; /* T2D: -> HYX_PARSER_CLASS */ + +/* ------------------------------------------------------------------------ */ +struct MARKUP *hyx_make_markup ( +struct HYX_PARSER_CLASS *hpc, +void *start_tag, /* Stop Tag; String oder Struktur */ +void *marked_text, /* Markup Text; String oder Struktur */ +void *stop_tag, /* Stop Tag; String oder Struktur */ +struct TAG_DEFINITION *tag_def, /* moegliche Tag Defintion fuer Markup */ +int flags) /* Bit 0: Start Tag als Struktur */ + /* Bit 1: Markup Text als Struktur */ + /* Bit 2: Stop Tag als Struktur */ +{ + struct MARKUP *m; + struct TEXT_ELEMENT *t; + struct TAG_DEFINITION *td= (void *) 0; + + if ((m= hyx_new_markup ()) == (struct MARKUP *) 0) + return (struct MARKUP *) 0; + + _hyx_markup_allocated++; + m->sig= SIG_MARKUP; + + if (start_tag != (void *) 0) + { + m->tag_open= t= (flags & 0x0001) + ? (struct TEXT_ELEMENT *) start_tag + : hyx_mktx_elem_and_segm (hpc, (char *) start_tag, + (long) strlen ((char *) start_tag), + 1L, TEt_tag, 1, 1); + if (t != (void *) 0) td = t->TE_tag_definition; + } + + if (marked_text != (void *) 0) + { + m->tagged_text = (flags & 0x0002) + ? (struct TEXT_ELEMENT *) marked_text + : hyx_mktx_elem_and_segm (hpc, (char *) marked_text, + (long) strlen ((char *) marked_text), + 0L, TEt_text, 0, 0); + } + + if (stop_tag != (void *) 0) + { + m->tag_open = (flags & 0x0004) + ? (struct TEXT_ELEMENT *) stop_tag + : hyx_mktx_elem_and_segm (hpc, (char *) stop_tag, + (long) strlen ((char *) stop_tag), + 1L, TEt_tag, 1, 1); + } + + m->tag_definition= (tag_def != (struct TAG_DEFINITION *) 0) + ? tag_def : td; + + return m; +} diff --git a/lib/ds/hyxp/hyxp0015.o b/lib/ds/hyxp/hyxp0015.o new file mode 100644 index 0000000000000000000000000000000000000000..909054683abeac259ac10b4090d6032847ca1375 Binary files /dev/null and b/lib/ds/hyxp/hyxp0015.o differ diff --git a/lib/ds/hyxp/hyxp0016.c b/lib/ds/hyxp/hyxp0016.c new file mode 100644 index 0000000000000000000000000000000000000000..f4db1cac8a82dada89396a65965b776510bfba2f --- /dev/null +++ b/lib/ds/hyxp/hyxp0016.c @@ -0,0 +1,319 @@ +/* + * FILE %ds/hyxp/hyxp0016.c + * + * make a markup structure from a text list + * + * written: 1991 03 27 + * 1991 03 30 + * latest update: 1996-02-18 12:10:06 + * $Id: hyxp0016.c,v 1.4 2004/05/08 15:40:21 gonter Exp $ + * + */ + +#include <stdio.h> +#include <memory.h> +#include <stdlib.h> +#include <gg/parse.h> + +/** #define DEBUG_001 **/ + +#ifdef NIL +#undef NIL +#endif +#define NIL ((void *) 0) + +static void cdecl POP_mus (void); +static int cdecl PUSH_mus (struct TAG_DEFINITION *td); +static int cdecl POP_mus_lt (long w); +static int cdecl POP_mus_le (long w); + +/* ------------------------------------------------------------------------ */ +struct MUS /* markup stack */ +{ + struct MUS *prev; + struct MARKUP **mup; /* stacked value of muapp */ + int stat; /* what does *muapp point to???? */ +#define STAT_NULL 0 /* *muapp == NIL */ +#define STAT_TEXT 1 /* *muapp == pointer to struct TEXT_ELEMENT */ +#define STAT_MARKUP 2 /* *muapp == pointer to struct MARKUP */ + long weight; + struct TAG_DEFINITION *td; +} ; + +static struct MUS *mus= (void *) 0; +static long mus_stack_size= 0L; + +static struct MARKUP *mu, **muapp; +static long last_tag_weight; +static int muapp_stat; + +/* ------------------------------------------------------------------------ */ +#ifdef DEBUG_001 +static void cdecl dump_stack (FILE *fo); +static char *MS [] = { "NULL", "TEXT", "MARKUP" } ; + +static void dump_stack (FILE *fo) +{ + struct MUS *m; + int i= 0; + + for (m= mus; m != NIL; m= m->prev) + { + fprintf (fo, "MUS[%d]: w=%ld s=%s [", i++, m->weight, MS[m->stat]); + display_tag_definition (fo, m->td); + fputc (']', fo); + fputc ('\n', fo); + } +} +#endif + +/* ------------------------------------------------------------------------ */ +static void POP_mus () +{ + struct MUS *m; + + if (mus == NIL) return; + + muapp= mus->mup; + /* last_tag_weight= mus->weight; ... dont pop it !!! */ + muapp_stat= mus->stat; + m= mus; + mus= mus->prev; + mus_stack_size--; + free (m); +} + +/* ------------------------------------------------------------------------ */ +static int PUSH_mus (struct TAG_DEFINITION *td) +{ + struct MUS *m; + + if ((m= (struct MUS *) calloc (sizeof (struct MUS), 1)) == NIL) return -1; + + m->mup= muapp; + m->weight= last_tag_weight; + m->prev= mus; + m->stat= muapp_stat; + m->td= td; + mus= m; + mus_stack_size++; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +static int POP_mus_lt (long w) /* Pop open markups from the stack if their */ + /* weight is less than the given one. */ +{ + if (mus == NIL) return 0; + +#ifdef DEBUG_001 +printf ("POP_mus_lt: mw=%ld w=%ld ", mus->weight, w); +#endif + + if (mus->weight < w) + { + POP_mus (); +#ifdef DEBUG_001 +printf (" -> POP .lt.\n"); +#endif + return 1; + } +#ifdef DEBUG_001 +printf ("\n"); +#endif + + return 0; +} + +/* ------------------------------------------------------------------------ */ +static int POP_mus_le (long w) /* Pop open markups from the stack if their */ + /* weight is lighter or equal than the */ + /* given one. */ +{ + if (mus == NIL) return 0; + +#ifdef DEBUG_001 +printf ("POP_mus_le: mw=%ld w=%ld ", mus->weight, w); +#endif + + if (mus->weight == w) + { + POP_mus (); +#ifdef DEBUG_001 +printf (" -> POP .eq.\n"); +#endif + return 2; + } + + if (mus->weight < w) + { + POP_mus (); +#ifdef DEBUG_001 +printf (" -> POP .lt.\n"); +#endif + return 1; + } + +#ifdef DEBUG_001 +printf ("\n"); +#endif + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int hyx_text_to_markup ( +struct HYX_PARSER_CLASS *hpc, +struct TEXT_ELEMENT *tx_list, +struct MARKUP **pmarkup) +{ + long last_tag_id= -1L; + struct TEXT_ELEMENT *tx; + struct TEXT_ELEMENT *tx_next; + struct TAG_DEFINITION *td; + struct MARKUP *markup; + +if (mus_stack_size) +{ + printf ("text list to markup structure;"); + printf (" mus_stack_size=%ld", mus_stack_size); + while (POP_mus_lt (0x7FFFFFFFL)); + printf (" mus_stack_size=%ld\n", mus_stack_size); +} + + *pmarkup= NIL; + if (tx_list == NIL) return 0; /* empty text -> empty markup; ok */ + + mu= NIL; + muapp= μ + muapp_stat= STAT_NULL; + + for (tx= tx_list; tx != NIL; tx= tx_next) + { + tx_next= tx->TE_next; + tx->TE_next= NIL; + if (tx->sig == SIG_TEXT_ELEMENT) + { + switch ((int) tx->TE_level) + { + case 0: /* possibly tagged text */ + /* if (hyx_strip_text_elem (tx) == 1) goto DISCARD; */ + *muapp= (void *) tx; + muapp= (struct MARKUP **) &tx->TE_next; + muapp_stat= STAT_NULL; + break; + + case 1: /* tag */ + last_tag_id= -1L; + td= tx->TE_tag_definition; + if (td != NIL) + { + last_tag_id= td->tag_id; + last_tag_weight= td->tag_weight; + switch (td->tag_type) + { + case TAG_TYPE_recursive: + case TAG_TYPE_nonrecursive: + if (td->tag_type == TAG_TYPE_recursive) + while (POP_mus_lt (last_tag_weight)); + else while (POP_mus_le (last_tag_weight)); + + case TAG_TYPE_HTML: + markup= hyx_make_markup (hpc, tx, NIL, NIL, td, 0x0001); + if (markup == NIL) goto ERROR; + if (muapp_stat == STAT_MARKUP) muapp= &(*muapp)->M_next; + *muapp= (void *) markup; + muapp_stat= STAT_MARKUP; + if (PUSH_mus (td) == -1) goto ERROR; + muapp= (struct MARKUP **) &markup->tagged_text; + muapp_stat= STAT_NULL; + break; + + case TAG_TYPE_endtag: + if (mus == NIL) + { + if (!(hpc->HPC_meta_flags & HPC_META_HTML)) + { +printf ("end tag, empty stack, not HTML\n"); + goto DISCARD; + } + } + +#ifdef DEBUG_001 +printf ("END: "); +display_tag_definition (stdout, td); +fputc ('\n', stdout); +dump_stack (stdout); +#endif + + if (last_tag_weight == 0L) /* empty end tag </> */ + POP_mus(); + else { + +#ifdef DEBUG_001 +printf ("%d AQF [", __LINE__); +display_tag_definition (stdout, td); +fputc (']', stdout); +fputc ('\n', stdout); +#endif + + while (POP_mus_lt (last_tag_weight) == 1); + if (POP_mus_le (last_tag_weight) != 2 + && !(hpc->HPC_meta_flags & HPC_META_HTML) + ) + { +printf ("end tag, too light\n"); /* this should be a notice or so */ + goto DISCARD; /* given end tag is too light now */ + } + } + + /* does *muapp now point to a markup??? */ + if (muapp_stat == STAT_MARKUP) + { + (*muapp)->tag_close= tx; + muapp= &(*muapp)->M_next; + muapp_stat= STAT_NULL; + } + break; + + case TAG_TYPE_autonomous: + /* autonomous tag: put it into the */ + /* active markup structure */ + markup= hyx_make_markup (hpc, tx, NIL, NIL, td, 0x0001); + if (markup == NIL) goto ERROR; + *muapp= (void *) markup; + muapp= (struct MARKUP **) &markup->M_next; + muapp_stat= STAT_NULL; + break; + } + } + break; + + default: /* other tag-level; e.g.: <<xyz>> */ + /* thats invalid here -> trash */ +DISCARD: + printf ("discarding text element: "); + diag_display_text_element (stdout, tx, "", 1); + hyx_frtx_elem_list (tx); + break; + } + } + else + if (tx->sig == SIG_MARKUP) + { + *muapp= (void *) tx; + muapp= (struct MARKUP **) &tx->TE_next; + muapp_stat= STAT_MARKUP; + } + } + + printf (" ... done\n"); + *pmarkup= mu; + return 0; + +ERROR: + fprintf (stdout, "ERROR: lexicon_text_to_markup: out of memory\n"); + + return -1; +} diff --git a/lib/ds/hyxp/hyxp0016.o b/lib/ds/hyxp/hyxp0016.o new file mode 100644 index 0000000000000000000000000000000000000000..389ad8ba172a16bbdfa4659d45681647f07803cc Binary files /dev/null and b/lib/ds/hyxp/hyxp0016.o differ diff --git a/lib/ds/hyxp/hyxp0017.c b/lib/ds/hyxp/hyxp0017.c new file mode 100644 index 0000000000000000000000000000000000000000..d4c9538ea087d81b1ebb7b7dfd477042d99e91e3 --- /dev/null +++ b/lib/ds/hyxp/hyxp0017.c @@ -0,0 +1,44 @@ +/* + * FILE ~/usr/ds/hyxp/hyxp0017.c + * + * Text Segment in ein Character Array uebertragen + * + * written: 1991 03 18 + * latest update: 1995-03-30 + * + */ + +#include <memory.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +int hyx_copy_tx_segm_list (char *dest, int size, struct TEXT_SEGMENT *ts) +/* Return: Zahl der kopierten Zeichen */ +{ + int cnt= 0; + int lng; + + if (dest == (char *) 0 + || --size <= 0) return -1; /* Fehler; ueberhaupt kein Platz vorhanden */ + /* Platz fuer abschliessende Null vorsehen */ + + while (ts != (struct TEXT_SEGMENT *) 0) + { + lng= (int) ts->TSEG_text_lng; + if (size < lng) + { /* aktuelles Textsegment geht sich nicht mehr ganz aus ... */ + memcpy (dest, ts->TSEG_text_array, size); + dest [size]= 0; + return cnt + size; + } + + memcpy (dest, ts->TSEG_text_array, lng); + cnt += lng; + size -= lng; + dest [lng]= 0; + dest= &dest[lng]; + ts= ts->TSEG_next; + } + + return cnt; +} diff --git a/lib/ds/hyxp/hyxp0017.o b/lib/ds/hyxp/hyxp0017.o new file mode 100644 index 0000000000000000000000000000000000000000..65f2f0d4479327486b40b19cf6b46fc77855eabb Binary files /dev/null and b/lib/ds/hyxp/hyxp0017.o differ diff --git a/lib/ds/hyxp/hyxp0018.c b/lib/ds/hyxp/hyxp0018.c new file mode 100644 index 0000000000000000000000000000000000000000..76804e245e8aa6b42a09f7643f8df6c72f205398 --- /dev/null +++ b/lib/ds/hyxp/hyxp0018.c @@ -0,0 +1,31 @@ +/* + * FILE ~/usr/ds/hyxp/hyxp0018.c + * + * insert TEXT_ELEMENT list at given position + * + * written: 1991 04 07 + * latest update: 1995-03-30 + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +struct TEXT_ELEMENT *hyx_append_tx_elem_list ( +struct TEXT_ELEMENT **d, /* destination */ +struct TEXT_ELEMENT *s) /* source */ +{ + if (d == (struct TEXT_ELEMENT **) 0 + || s == (struct TEXT_ELEMENT *) 0) return (struct TEXT_ELEMENT *) 0; + + while (s != (struct TEXT_ELEMENT *) 0) + { + *d= s; + d= &s->TE_next; + if (s->TE_next == (struct TEXT_ELEMENT *) 0) return s; + s= s->TE_next; + } + + return (struct TEXT_ELEMENT *) 0; +} diff --git a/lib/ds/hyxp/hyxp0018.o b/lib/ds/hyxp/hyxp0018.o new file mode 100644 index 0000000000000000000000000000000000000000..fa6e40e7379bf16515f3c85e500388a1ad71e587 Binary files /dev/null and b/lib/ds/hyxp/hyxp0018.o differ diff --git a/lib/ds/hyxp/hyxp0019.c b/lib/ds/hyxp/hyxp0019.c new file mode 100644 index 0000000000000000000000000000000000000000..0b1515b7e15e9c5bd500265bffcb0c23593ce24b --- /dev/null +++ b/lib/ds/hyxp/hyxp0019.c @@ -0,0 +1,27 @@ +/* + * FILE ~/usr/ds/hyxp/hyxp0019.c + * + * insert TEXT_ELEMENT list at given position + * + * written: 1994-11-18 + * latest update: 1995-03-30 + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +struct TEXT_ELEMENT **hyx_find_last_tx_elem_ptr ( +struct TEXT_ELEMENT **d) +{ + if (d == (struct TEXT_ELEMENT **) 0) + return (struct TEXT_ELEMENT **) 0; + + while (*d != (struct TEXT_ELEMENT *) 0) + { + d= &(*d)->TE_next; + } + + return d; +} diff --git a/lib/ds/hyxp/hyxp0019.o b/lib/ds/hyxp/hyxp0019.o new file mode 100644 index 0000000000000000000000000000000000000000..a40b7b7d0cc9d09d0058bc37685726e82bcfba8e Binary files /dev/null and b/lib/ds/hyxp/hyxp0019.o differ diff --git a/lib/ds/hyxp/hyxp0020.c b/lib/ds/hyxp/hyxp0020.c new file mode 100644 index 0000000000000000000000000000000000000000..756db11acc22891573dce4435b2aae055f1cabe8 --- /dev/null +++ b/lib/ds/hyxp/hyxp0020.c @@ -0,0 +1,23 @@ +/* + * FILE %ds/hyxp/hyxp0020.c + * + * written: 1994-11-12 + * latest update: 1995-07-02 + * $Id: hyxp0020.c,v 1.2 2005/09/04 09:24:39 gonter Exp $ + * + */ + +#include <sys/types.h> +#include <gg/strings.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +long hyx_tx_segm_count_char (struct TEXT_SEGMENT *ts, int code) +{ + long cnt= 0L; + + for (; ts != (struct TEXT_SEGMENT *) 0; ts= ts->TSEG_next) + cnt += (long) count_char (code, ts->TSEG_text_array, ts->TSEG_text_lng); + + return cnt; +} diff --git a/lib/ds/hyxp/hyxp0020.o b/lib/ds/hyxp/hyxp0020.o new file mode 100644 index 0000000000000000000000000000000000000000..51f4ac7a5ed44e7d5eaa0e6172b2b05e4aee0fd4 Binary files /dev/null and b/lib/ds/hyxp/hyxp0020.o differ diff --git a/lib/ds/hyxp/hyxp0021.c b/lib/ds/hyxp/hyxp0021.c new file mode 100644 index 0000000000000000000000000000000000000000..d6d6ff12c9886bf546397d162c9fe7decad3cfa3 --- /dev/null +++ b/lib/ds/hyxp/hyxp0021.c @@ -0,0 +1,23 @@ +/* + * FILE ~/usr/ds/hyxp/hyxp0021.c + * + * written: 1995-07-02 + * latest update: 1995-07-02 + * + */ + +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +struct TEXT_ELEMENT *hyx_parse_block ( +struct HYX_PARSER_STATUS *lps, +char *block, +long size) +{ + struct TEXT_ELEMENT *te; + + while (size-- > 0L) + te= hyx_parse_char (lps, *block++ & 0x00FF); + + return te; +} diff --git a/lib/ds/hyxp/hyxp0021.o b/lib/ds/hyxp/hyxp0021.o new file mode 100644 index 0000000000000000000000000000000000000000..4ce36c880b4a4bdb4088396f7bf466c284241982 Binary files /dev/null and b/lib/ds/hyxp/hyxp0021.o differ diff --git a/lib/ds/hyxp/hyxp0022.c b/lib/ds/hyxp/hyxp0022.c new file mode 100644 index 0000000000000000000000000000000000000000..760387f80ff3fc1a8d05758394d08b357c1a2c31 --- /dev/null +++ b/lib/ds/hyxp/hyxp0022.c @@ -0,0 +1,18 @@ +/* + * FILE ~/usr/ds/hyxp/hyxp0022.c + * + * written: 1995-07-02 + * latest update: 1995-07-02 + * + */ + +#include <string.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +struct TEXT_ELEMENT *hyx_parse_string ( +struct HYX_PARSER_STATUS *lps, +char *string) +{ + return hyx_parse_block (lps, string, (long) strlen (string)); +} diff --git a/lib/ds/hyxp/hyxp0022.o b/lib/ds/hyxp/hyxp0022.o new file mode 100644 index 0000000000000000000000000000000000000000..1de71ca5cb519c304e04dd438c31bbd4b5d0bdd5 Binary files /dev/null and b/lib/ds/hyxp/hyxp0022.o differ diff --git a/lib/ds/hyxp/hyxp0023.c b/lib/ds/hyxp/hyxp0023.c new file mode 100644 index 0000000000000000000000000000000000000000..d95822e965c6ef142b3640b613ab16fc907f345f --- /dev/null +++ b/lib/ds/hyxp/hyxp0023.c @@ -0,0 +1,46 @@ +/* + * FILE ~/usr/ds/hyxp/hyxp0023.c + * + * read a lexicon entry + * + * written: 1991 03 19 + * 1995-01-23: renamed from dictadd3.c + * latest update: 1995-07-04 + * + */ + + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +int hyx_parse_hyx_frame ( +struct HYX_PARSER_CLASS *hpc, +char *lexicon_file, +char *index_file, +long frame_index, +struct TEXT_ELEMENT **lexicon_entry, +long end_tags [], +int num_end_tags) +/* Return: 0 ... OK; wenn *lexicon_entry == (char *) 0, dann existiert */ +/* kein Eintrag zum angegebenen Index (leerer Eintrag) */ +/* -1 ... Error */ +{ + FILE *fhyx; /* Lexicon File */ + FILE *fidx; /* Index File */ + char *fnm2open; + + if ((fidx= flopen (fnm2open= index_file, "rb")) == (FILE *) 0 + || (fhyx= flopen (fnm2open= lexicon_file, "rb")) == (FILE *) 0) + { + fprintf (stdout, + "ERROR: dict0031: file %s could not be opened\n", + fnm2open); + return -1; + } + + return hyx_parse_hyx_frame_file (hpc, fhyx, fidx, + frame_index, lexicon_entry, + end_tags, num_end_tags); +} diff --git a/lib/ds/hyxp/hyxp0023.o b/lib/ds/hyxp/hyxp0023.o new file mode 100644 index 0000000000000000000000000000000000000000..f135fe0e7b47f98be8756ec58da7363a57dc24d8 Binary files /dev/null and b/lib/ds/hyxp/hyxp0023.o differ diff --git a/lib/ds/hyxp/hyxp0024.c b/lib/ds/hyxp/hyxp0024.c new file mode 100644 index 0000000000000000000000000000000000000000..14e41c446ef9aa8c06c13980a08d67fe59c16190 --- /dev/null +++ b/lib/ds/hyxp/hyxp0024.c @@ -0,0 +1,52 @@ +/* + * FILE %ds/hyxp/hyxp0024.c + * + * read a lexicon entry + * + * written: 1991 03 19 + * latest update: 1996-02-18 8:32:35 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hyx_parse_hyx_frame_file ( +struct HYX_PARSER_CLASS *hpc, +FILE *fhyx, /* Lexicon File */ +FILE *fidx, /* Index File */ +long frame_index, +struct TEXT_ELEMENT **lexicon_entry, +long end_tags [], +int num_end_tags) +/* Return: 0 ... OK; wenn *lexicon_entry == (char *) 0, dann existiert */ +/* kein Eintrag zum angegebenen Index (leerer Eintrag) */ +/* -1 ... Error */ +{ + long li_begin; /* information from the index file */ + long li_end; + long li_cluster; + long bytes_read; /* number of bytes read from lexicon file */ + + *lexicon_entry= (struct TEXT_ELEMENT *) 0; + + if (deref_index (fidx, frame_index, &li_begin, &li_end, &li_cluster) != 0 + || li_begin <= 0L + ) return -1; + + /* Lexicon Eintrag lesen */ + fseek (fhyx, li_begin, 0); + if (hyx_parse1_file (hpc, fhyx, lexicon_entry, end_tags, num_end_tags, + li_end-li_begin+1L, &bytes_read) != 0) + { + fprintf (stdout, "WARNING: dictadd3: lexicon entry not read cleanly\n"); + } + + return 0; +} diff --git a/lib/ds/hyxp/hyxp0024.o b/lib/ds/hyxp/hyxp0024.o new file mode 100644 index 0000000000000000000000000000000000000000..a5c6972aafa30a9e0fbefddc665dad689e5a13af Binary files /dev/null and b/lib/ds/hyxp/hyxp0024.o differ diff --git a/lib/ds/hyxp/hyxp0025.c b/lib/ds/hyxp/hyxp0025.c new file mode 100644 index 0000000000000000000000000000000000000000..d3cebd058dc3ee67ee62edc201d50b83b393c217 --- /dev/null +++ b/lib/ds/hyxp/hyxp0025.c @@ -0,0 +1,32 @@ +/* + * FILE %ds/hyxp/hyxp0025.c + * + * transfer flags from the parser context to a (newly created) text element + * + * written: 1995-12-21 + * latest update: 1995-12-21 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hyx_transfer_details ( +struct HYX_PARSER_STATUS *hps, +struct TEXT_ELEMENT *tt) +{ + if (hps == (struct HYX_PARSER_STATUS *) 0 + || tt == (struct TEXT_ELEMENT *) 0 + ) + return -1; + + tt->TE_type= hps->HPS_element_type; + + return 0; +} diff --git a/lib/ds/hyxp/hyxp0025.o b/lib/ds/hyxp/hyxp0025.o new file mode 100644 index 0000000000000000000000000000000000000000..23131ec983a06d8fc59c0ee3ea5c5cb696106915 Binary files /dev/null and b/lib/ds/hyxp/hyxp0025.o differ diff --git a/lib/ds/hyxp/hyxp0026.c b/lib/ds/hyxp/hyxp0026.c new file mode 100644 index 0000000000000000000000000000000000000000..0cb315dd9ce7b76253087cfec7395e8f1f1bd19b --- /dev/null +++ b/lib/ds/hyxp/hyxp0026.c @@ -0,0 +1,33 @@ +/* + * FILE %ds/hyxp/hyxp0026.c + * + * add character to text segment buffer + * + * written: 1995-12-21 + * latest update: 1995-12-21 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hyx_parser_add_char ( +struct HYX_PARSER_STATUS *lps, +int ch) +{ + if (lps == (struct HYX_PARSER_STATUS *) 0) return -1; + + lps->HPS_segment [lps->HPS_segment_length++]= (char) ch; + lps->HPS_segment [lps->HPS_segment_length]= 0; + + if (lps->HPS_segment_length >= MAX_SEGMENT_LENGTH) + hyx_parser_finish_segment (lps); + + return 0; +} diff --git a/lib/ds/hyxp/hyxp0026.o b/lib/ds/hyxp/hyxp0026.o new file mode 100644 index 0000000000000000000000000000000000000000..31ea69eaf34d7c025865dc20b5c934e4ef42d772 Binary files /dev/null and b/lib/ds/hyxp/hyxp0026.o differ diff --git a/lib/ds/hyxp/hyxp0027.c b/lib/ds/hyxp/hyxp0027.c new file mode 100644 index 0000000000000000000000000000000000000000..af2289b5b67c00692a07f271aa0faf708bcbac06 --- /dev/null +++ b/lib/ds/hyxp/hyxp0027.c @@ -0,0 +1,32 @@ +/* + * FILE %ds/hyxp/hyxp0027.c + * + * add character to text segment buffer + * + * written: 1995-12-21 + * latest update: 1995-12-21 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +struct TEXT_ELEMENT *hyx_parser_finish (struct HYX_PARSER_STATUS *lps) +{ + struct TEXT_SEGMENT *seg; + + if (lps == (struct HYX_PARSER_STATUS *) 0 + || (seg= hyx_parser_finish_segment (lps)) == (struct TEXT_SEGMENT *) 0 + ) + return (struct TEXT_ELEMENT *) 0; + + lps->HPS_text_alloc_flag= 0; + + return lps->HPS_tx_last; +} diff --git a/lib/ds/hyxp/hyxp0027.o b/lib/ds/hyxp/hyxp0027.o new file mode 100644 index 0000000000000000000000000000000000000000..acd5c2053f9f172536020e3ab922468fc5d9ef39 Binary files /dev/null and b/lib/ds/hyxp/hyxp0027.o differ diff --git a/lib/ds/hyxp/hyxp0028.c b/lib/ds/hyxp/hyxp0028.c new file mode 100644 index 0000000000000000000000000000000000000000..16f5edf3f0fef17a77e0be2e39c6e9c875b62372 --- /dev/null +++ b/lib/ds/hyxp/hyxp0028.c @@ -0,0 +1,69 @@ +/* + * FILE %ds/hyxp/hyxp0028.c + * + * a new text element can be created with buffered data + * + * written: 1995-12-21 + * latest update: 1997-11-02 22:38:19 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/hytxt.h> + +/* #define PARSER_DEBUG */ + +/* ------------------------------------------------------------------------ */ +struct TEXT_SEGMENT *hyx_parser_finish_segment ( +struct HYX_PARSER_STATUS *lps) +{ + struct TEXT_SEGMENT *seg= (struct TEXT_SEGMENT *) 0; + struct TEXT_ELEMENT *tt= (struct TEXT_ELEMENT *) 0; + + if (lps == (struct HYX_PARSER_STATUS *) 0) + return (struct TEXT_SEGMENT *) 0; + + if ((seg= hyx_mktx_segm (lps->HPS_segment, lps->HPS_segment_length)) + != (struct TEXT_SEGMENT *) 0) + { +#ifdef PARSER_DEBUG + printf ("flushing 1 text segment\n"); +#endif /* PARSER_DEBUG */ + + if (!lps->HPS_text_alloc_flag) + { +#ifdef PARSER_DEBUG + printf ("flushing 2 text element\n"); +#endif /* PARSER_DEBUG */ + + /* create new text element node and add it to the context */ + *lps->HPS_ptx= tt= + hyx_mktx_elem (lps->HPS_parser_level, lps->HPS_element_type); + + lps->HPS_ptxs= &tt->TE_text_segment; + lps->HPS_ptx= &tt->TE_next; + lps->HPS_tx_cnt++; + lps->HPS_text_alloc_flag= 1; +/* printf ("tt->TE_type=%d\n", tt->TE_type); */ + } + + *lps->HPS_ptxs= seg; + lps->HPS_ptxs= &seg->TSEG_next; + lps->HPS_tx_cnt++; + +#ifdef PARSER_DEBUG + diag_display_text_element (stdout, tt, (char *) 0); + fputc ('\n', stdout); +#endif /* PARSER_DEBUG */ + } + + lps->HPS_segment_length= 0; + lps->HPS_tx_last= tt; + + return seg; +} diff --git a/lib/ds/hyxp/hyxp0028.o b/lib/ds/hyxp/hyxp0028.o new file mode 100644 index 0000000000000000000000000000000000000000..59bb57af072935d73ec8612d475809ae29db4389 Binary files /dev/null and b/lib/ds/hyxp/hyxp0028.o differ diff --git a/lib/ds/hyxp/hyxp0029.c b/lib/ds/hyxp/hyxp0029.c new file mode 100644 index 0000000000000000000000000000000000000000..6cbfc8c6b1f8d5c93c86d7120c4f22d9ac340c59 --- /dev/null +++ b/lib/ds/hyxp/hyxp0029.c @@ -0,0 +1,46 @@ +/* + * FILE %ds/hyxp/hyxp0029.c + * + * initialize a parser class + * + * written: 1996-02-18 9:42:46 + * latest update: 2001-02-18 17:43:56 + * $Id: hyxp0029.c,v 1.3 2001/02/19 00:27:53 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +struct HYX_PARSER_CLASS *hyx_init_parser_class (void) +{ + struct HYX_PARSER_CLASS *hpc; + + if ((hpc= hyx_new_parser_class ()) != (struct HYX_PARSER_CLASS *) 0) + { + hpc->HPC_tag_append= &hpc->HPC_tag_list; + + hpc->HPC_tag_open= '<'; + hpc->HPC_tag_close= '>'; + hpc->HPC_entity_open= '&'; + hpc->HPC_entity_close= ';'; + hpc->HPC_minimization_char= '/'; + hpc->HPC_declaration_start= '!'; + hpc->HPC_processing_start= '?'; + + hpc->HPC_entity_tag_open= "lt"; + hpc->HPC_entity_tag_close= "gt"; + hpc->HPC_entity_entity_open= "amp"; + + hpc->HPC_next_tag_id= 0x100000L; + + hpc->HPC_po_id_tag= 1; + } + + return hpc; +} diff --git a/lib/ds/hyxp/hyxp0029.o b/lib/ds/hyxp/hyxp0029.o new file mode 100644 index 0000000000000000000000000000000000000000..ced70d84e9cee1dffa50f5d42bfdbbf7a67f015f Binary files /dev/null and b/lib/ds/hyxp/hyxp0029.o differ diff --git a/lib/ds/hyxp/hyxp0030.c b/lib/ds/hyxp/hyxp0030.c new file mode 100644 index 0000000000000000000000000000000000000000..3e8a19bf107e5be0f60f605ee29d67b70d62c0d2 --- /dev/null +++ b/lib/ds/hyxp/hyxp0030.c @@ -0,0 +1,41 @@ +/* + * FILE %ds/hyxp/hyxp0030.c + * + * Verwaltung von TAG Defintionen + * + * written: 1994-12-22 + * latest update: 2001-02-18 17:40:38 + * $Id: hyxp0030.c,v 1.2 2001/02/19 00:27:53 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +int hyx_read_tag_definition (struct HYX_PARSER_CLASS *hpc, char *fn) +{ + FILE *fi; + int rc; +#define LINE_SIZE 128 + char line [LINE_SIZE]; + + fprintf (stderr, "note: reading tag definition file %s\n", fn); + + if ((fi= fopen (fn, "r")) == (FILE *) 0) + { + fprintf (stdout, "warning: file %s could not be opened\n", fn); + return -1; + } + + for (;;) + { + rc= fread_line (fi, line, LINE_SIZE); + if (rc <= 0 && feof (fi)) break; + hyx_process_tag_definition (hpc, line); + } + fclose (fi); + + return 0; +} diff --git a/lib/ds/hyxp/hyxp0030.o b/lib/ds/hyxp/hyxp0030.o new file mode 100644 index 0000000000000000000000000000000000000000..997d764f4a1c9a7b35656a3da2cac6d559aa2af4 Binary files /dev/null and b/lib/ds/hyxp/hyxp0030.o differ diff --git a/lib/ds/hyxp/hyxp0031.c b/lib/ds/hyxp/hyxp0031.c new file mode 100644 index 0000000000000000000000000000000000000000..91d7882f11aa33e1441c26078d0cef4fd6e40a5d --- /dev/null +++ b/lib/ds/hyxp/hyxp0031.c @@ -0,0 +1,48 @@ +/* + * FILE %ds/hyxp/hyxp0031.c + * + * Verwaltung von TAG Defintionen + * + * written: 1994-12-22 + * latest update: 1997-11-02 23:21:34 + * + */ + +#include <string.h> +#include <gg/strings.h> +#include <gg/parse.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int hyx_process_tag_definition (struct HYX_PARSER_CLASS *hpc, char *line) +{ + long id; + long weight; + int mode; + int ty; + int n_fields; +#define N_FIELDS 7 + char *fields [N_FIELDS]; + + if (line [0] == '#') return 0; + + n_fields= isolate_tokens (line, fields, N_FIELDS); + + if (strcmp (fields [0], "D") == 0) + { + if (n_fields < N_FIELDS-1) return -1; + if (n_fields > N_FIELDS) n_fields= N_FIELDS; + if (n_fields == N_FIELDS-1) fields [N_FIELDS-1]= (char *) 0; + + id= get_parameter_value (fields [1]); + mode= (int) get_parameter_value (fields [2]); + ty= (int) get_parameter_value (fields [3]); + weight= get_parameter_value (fields [4]); + + /* fscanf (fi, "%lx%d%d%ld%s", &id, &mode, &ty, &weight, temp); */ + hyx_make_tag_definition (hpc, fields [5], id, mode, + weight, ty, fields [6]); + } + + return 0; +} diff --git a/lib/ds/hyxp/hyxp0031.o b/lib/ds/hyxp/hyxp0031.o new file mode 100644 index 0000000000000000000000000000000000000000..6af7a7966dfe533748db2dcc453d071836eecd88 Binary files /dev/null and b/lib/ds/hyxp/hyxp0031.o differ diff --git a/lib/ds/hyxp/hyxp0032.c b/lib/ds/hyxp/hyxp0032.c new file mode 100644 index 0000000000000000000000000000000000000000..72de3e6d6b17bbacebecff3619862cb915fbb5cf --- /dev/null +++ b/lib/ds/hyxp/hyxp0032.c @@ -0,0 +1,70 @@ +/* + * FILE %ds/hyxp/hyxp0032.c + * + * Verwaltung von TAG Defintionen + * + * written: 1994-12-22: isolated from parse002.c + * latest update: 1997-11-02 18:38:49 + * $Id: hyxp0032.c,v 1.3 2004/05/08 15:40:21 gonter Exp $ + * + */ + +#include <gg/parse.h> + +#define MAX_TAG_STR 256 /* T2D: global constant! */ + +/* ------------------------------------------------------------------------ */ +struct TAG_DEFINITION *hyx_identify_tag ( +struct HYX_PARSER_CLASS *hpc, +char *str, +int append) /* 1 -> append, if not found */ +{ + struct TAG_DEFINITION *t; + char tag_str [MAX_TAG_STR]; + +#ifdef PARSER_DEBUG +printf ("hyxp0032.c: hyx_identify_tag (str='%s', append=%d')\n", str, append); +#endif /* PARSER_DEBUG */ + + hyx_copy_tag (str, tag_str, MAX_TAG_STR, hpc->HPC_meta_flags & HPC_META_HTML); + + if ((t= hyx_find_tag_definition (hpc, tag_str)) + != (struct TAG_DEFINITION *) 0 + || !append /* if tag was not found and append is off, return NIL */ + ) + return t; + + t= hyx_make_tag_definition (hpc, tag_str, hpc->HPC_next_tag_id++, 0, 0L, + (str [0] == '/') ? TAG_TYPE_endtag + : TAG_TYPE_nonrecursive, + (char *) 0); + + return t; +} + +/* ------------------------------------------------------------------------ */ +int hyx_copy_tag ( +char *src, +char *dst, +int size, +int lower) +{ + int ch; + int lng= 0; + + size--; + for (;;) + { + ch= *src++; + if (ch == 0 + || size <= 0 + || ch == ' ' || ch == '\t' + || ch == '\r' || ch == '\n' + ) break; /* T2D: space general! */ + *dst++= ch; + lng++; + } + *dst= 0; + + return lng; +} diff --git a/lib/ds/hyxp/hyxp0032.o b/lib/ds/hyxp/hyxp0032.o new file mode 100644 index 0000000000000000000000000000000000000000..60b44e67c46f059a00f5875c1d3b945849645c04 Binary files /dev/null and b/lib/ds/hyxp/hyxp0032.o differ diff --git a/lib/ds/hyxp/hyxp0033.c b/lib/ds/hyxp/hyxp0033.c new file mode 100644 index 0000000000000000000000000000000000000000..302b445b7b8634584ed85fd033cd1038e2ba3c6a --- /dev/null +++ b/lib/ds/hyxp/hyxp0033.c @@ -0,0 +1,56 @@ +/* + * FILE %ds/hyxp/hyxp0033.c + * + * Verwaltung von TAG Defintionen + * + * written: 1991 03 12 + * latest update: 2001-02-18 18:44:54 + * $Id: hyxp0033.c,v 1.5 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +struct TAG_DEFINITION *hyx_make_tag_definition ( +struct HYX_PARSER_CLASS *hpc, +char *str, +long id, +int mm, +long weight, +int ty, +char *comment) +{ + struct TAG_DEFINITION *t; + + if ((t= hyx_new_tag_definition ()) == (struct TAG_DEFINITION *) 0) + return (struct TAG_DEFINITION *) 0; + + hpc->HPC_TAG_DEFINITION_allocated++; + + if (hpc->HPC_meta_flags & HPC_META_show_new_tags) + { + printf ("[0x%08lX] new tag str='%s' id=%ld mm=%d\n", t, str, id, mm); + } + + t->sig= SIG_TAG_DEFINITION; + t->TAG_DEF_next= (struct TAG_DEFINITION *) 0; + t->match_mode= mm; + t->tag_id= id; + t->tag_type= ty; + t->tag_weight= weight; + t->tag_name= strdup (str); + if (comment != (char *) 0) t->tag_comment= strdup (comment); + + *(hpc->HPC_tag_append)= t; + hpc->HPC_tag_append= &t->TAG_DEF_next; + + ytree_set_value (&hpc->HPC_tags, t->tag_name, (long) t); + + return t; +} diff --git a/lib/ds/hyxp/hyxp0033.o b/lib/ds/hyxp/hyxp0033.o new file mode 100644 index 0000000000000000000000000000000000000000..74492b4870b743ed2dcc7975faecd2c5d14de535 Binary files /dev/null and b/lib/ds/hyxp/hyxp0033.o differ diff --git a/lib/ds/hyxp/hyxp0034.c b/lib/ds/hyxp/hyxp0034.c new file mode 100644 index 0000000000000000000000000000000000000000..eecef5065ebb2980951977ce370b77e428b5268e --- /dev/null +++ b/lib/ds/hyxp/hyxp0034.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/hyxp/hyxp0034.c + * + * Verwaltung von TAG Defintionen + * + * written: 1991 03 12 + * 1996-02-18 extracted from parse027.c + * latest update: 2001-02-18 19:36:54 + * $Id: hyxp0034.c,v 1.3 2001/02/19 00:27:54 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +struct TAG_DEFINITION *hyx_find_tag_definition ( +struct HYX_PARSER_CLASS *hpc, +char *str) +{ + struct YTREE *yt; + char *str_lookup; + + str_lookup= (*str == ':') ? ":" : str; /* special frame start tag */ + + if ((yt= ytree_lookup_word (hpc->HPC_tags, str_lookup)) != (struct YTREE *) 0 + && (yt->YT_flags & YTflag_EOW)) + return (struct TAG_DEFINITION *) yt->YT_info; + + return (struct TAG_DEFINITION *) 0; +} diff --git a/lib/ds/hyxp/hyxp0034.o b/lib/ds/hyxp/hyxp0034.o new file mode 100644 index 0000000000000000000000000000000000000000..48374c6d91c46d28487ee51b3ff36cf5d13b98e5 Binary files /dev/null and b/lib/ds/hyxp/hyxp0034.o differ diff --git a/lib/ds/hyxp/hyxp0035.c b/lib/ds/hyxp/hyxp0035.c new file mode 100644 index 0000000000000000000000000000000000000000..e1c462550709e8a8296160f15352536732c37bd2 --- /dev/null +++ b/lib/ds/hyxp/hyxp0035.c @@ -0,0 +1,44 @@ +/* + * FILE %ds/hyxp/hyxp0035.c + * + * written: 1991 03 17 + * latest update: 1997-11-02 23:22:28 + * $Id: hyxp0035.c,v 1.2 2003/06/25 10:11:56 gonter Exp $ + * + */ + +#include <gg/parse.h> + +/* ------------------------------------------------------------------------ */ +long hyx_get_tag_definition ( +struct HYX_PARSER_CLASS *hpc, +struct TEXT_ELEMENT *tx, +int append) +{ + struct TEXT_SEGMENT *txs; + struct TAG_DEFINITION *td; + + switch ((int) tx->sig) + { + case SIG_TEXT_ELEMENT: + txs= tx->TE_text_segment; + break; + case SIG_TEXT_SEGMENT: + txs= (struct TEXT_SEGMENT *) tx; + break; + default: + return -1L; + } + + if (tx->sig == SIG_TEXT_ELEMENT + && tx->TE_level > 0 + && (td= hyx_identify_tag (hpc, txs->TSEG_text_array, append)) + != (struct TAG_DEFINITION *) 0 + ) + { + tx->TE_tag_definition= td; + return td->tag_id; + } + + return 0L; +} diff --git a/lib/ds/hyxp/hyxp0035.o b/lib/ds/hyxp/hyxp0035.o new file mode 100644 index 0000000000000000000000000000000000000000..fa0b64374d11684b469e2382b127fac06dff83a1 Binary files /dev/null and b/lib/ds/hyxp/hyxp0035.o differ diff --git a/lib/ds/hyxp/junk0002.c b/lib/ds/hyxp/junk0002.c new file mode 100644 index 0000000000000000000000000000000000000000..5ed18a664ed56d275b5644a9e6497e35b1655204 --- /dev/null +++ b/lib/ds/hyxp/junk0002.c @@ -0,0 +1,165 @@ + +/* ------------------------------------------------------------------------ */ +#ifdef OBSOLETE /* 1995-12-21 13:20:30 */ + if (lps->HPS_parser_level == 1 + && ch == lps->HPS_minimization_char + && lps->HPS_segment_length > 0 + && lps->HPS_white_spaces == 0 + ) + { + is_minimization_begin= 1; +#ifdef PARSER_DEBUG + printf ("is_minimization_begin\n"); +#endif /* PARSER_DEBUG */ + } + + if (lps->HPS_parser_level == 0 + && lps->HPS_minimization_seen == 1 + && ch == lps->HPS_minimization_char + ) + { + is_minimization_end= 1; +#ifdef PARSER_DEBUG + printf ("is_minimization_end\n"); +#endif /* PARSER_DEBUG */ + } + + if (ch == lps->HPS_tag_open + || (ch == lps->HPS_tag_close && lps->HPS_parser_level >= 1) + || is_minimization_begin + || is_minimization_end + || ch == -1 /* end of SGML stream !! */ + ) + { /* finish latest SGML text segment */ +#ifdef PARSER_DEBUG + printf ("finish text segment\n"); +#endif /* PARSER_DEBUG */ + + if ((seg= hyx_mktx_segm (lps->HPS_segment, lps->HPS_segment_length)) + != (struct TEXT_SEGMENT *) 0) + { + if (!lps->HPS_text_alloc_flag) + { /* create a text element if there was not already one */ +#ifdef PARSER_DEBUG + printf ("finish text element\n"); +#endif /* PARSER_DEBUG */ + + *lps->HPS_ptx= tt= hyx_mktx_elem (lps->HPS_parser_level); + hyx_transfer_details (lps, tt); + lps->HPS_ptxs= &tt->TE_text_segment; + lps->HPS_ptx= &tt->TE_next; + lps->HPS_tx_cnt++; + } + + /* link newly created text segment into current text element */ + *lps->HPS_ptxs= seg; + lps->HPS_ptxs= &seg->TSEG_next; + lps->HPS_tx_cnt++; + +#ifdef PARSER_DEBUG + diag_display_markup (stdout, hpc, tt, 0, 0, 0); +#endif /* PARSER_DEBUG */ + } + + lps->HPS_segment_length= 0; + lps->HPS_level_changed= 1; + if (lps->HPS_parser_level == 0) tt= (struct TEXT_ELEMENT *) 0; + if (ch == lps->HPS_tag_close && lps->HPS_parser_level > 0) + lps->HPS_parser_level--; + if (ch == lps->HPS_tag_open) lps->HPS_parser_level++; + lps->HPS_white_spaces= 0; + lps->HPS_minimization_seen= 0; + + if (is_minimization_begin) + { + lps->HPS_parser_level= 0; + lps->HPS_minimization_seen= 1; + } + + if (is_minimization_end) + { /* the end of a minimized markup section is handled like */ + /* a unnamed markup close tag. */ +#ifdef PARSER_DEBUG + printf ("finish text element and segment, insert tag end\n"); +#endif /* PARSER_DEBUG */ + + *lps->HPS_ptx= tt= hyx_mktx_elem_and_segm (hpc, "/", 1L, 1L, 1, 1); + hyx_transfer_details (lps, tt); + lps->HPS_ptxs= &tt->TE_text_segment; + lps->HPS_ptx= &tt->TE_next; + lps->HPS_tx_cnt++; + lps->HPS_parser_level= 0; + lps->HPS_minimization_seen= 0; + } + +#ifdef PARSER_DEBUG + diag_display_markup (stdout, hpc, tt, 0, 0, 0); + if (PARSER_DEBUG > 10) + { + printf ("TEXT_ELEMENT finished\n"); + printf ("END hyxp0002.c SGML parser ----------------------\n"); + } +#endif /* PARSER_DEBUG */ + + return tt; + } + else + { /* any text character */ +#ifdef NOT_USED_NOW + if (lps->HPS_segment_length == 0 /* at the beginning of the list, */ + && lps->HPS_level_changed == 1 /* after a tag open or close, */ + && (ch == ' ' /* strip off white space characters */ + || ch == '\t' /* but don't do that within a */ + || ch == '\n' /* segmented text block */ + ) + ) + { + /******************* + fputc ('*', stdout); + *******************/ + goto END; + } +#endif /* NOT_USED_NOW */ + + if (ch == ' ' || ch == '\t' || ch == '\n') lps->HPS_white_spaces++; + + if (lps->HPS_segment_length == 0) + { + if (lps->HPS_parser_level >= 1) + { + if (ch == '!') + { +#ifdef PARSER_DEBUG + printf ("declaration begin\n"); +#endif /* PARSER_DEBUG */ + lps->HPS_element_type= TEt_declaration; + } + else + { +#ifdef PARSER_DEBUG + printf ("tag begin\n"); +#endif /* PARSER_DEBUG */ + lps->HPS_element_type= TEt_tag; + } + } + else + { +#ifdef PARSER_DEBUG + printf ("text begin\n"); +#endif /* PARSER_DEBUG */ + lps->HPS_element_type= TEt_text; + } + } + + lps->HPS_level_changed= 0; + lps->HPS_segment [lps->HPS_segment_length++]= (char) ch; + lps->HPS_segment [lps->HPS_segment_length]= 0; + + } + +#ifdef NOT_USED_NOW +END: +#endif + + return (struct TEXT_ELEMENT *) 0; +#endif /* OBSOLETE 1995-12-21 13:20:50 */ diff --git a/lib/ds/hyxp/lib b/lib/ds/hyxp/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/hyxp/libgg.a b/lib/ds/hyxp/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/hyxp/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/hyxp/make-dos b/lib/ds/hyxp/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..dec703f538533b50ded7c38e86b44e9f97bbf7e6 --- /dev/null +++ b/lib/ds/hyxp/make-dos @@ -0,0 +1,35 @@ +# +# FILE %ds/hyxp/makefile +# +# written: 1995-03-19 +# latest update: 1996-02-18 11:49:30 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 HYPER_TEXT +lib=c:\usr\sbr\lsbr + +all : all.2 \bin\pt.exe + +all.2 : hyxp0001.obj hyxp0002.obj hyxp0003.obj hyxp0004.obj hyxp0005.obj ! + hyxp0006.obj hyxp0007.obj hyxp0008.obj hyxp0009.obj hyxp0010.obj ! + hyxp0011.obj hyxp0012.obj hyxp0013.obj hyxp0014.obj hyxp0015.obj ! + hyxp0016.obj hyxp0017.obj hyxp0018.obj hyxp0019.obj hyxp0020.obj ! + hyxp0021.obj hyxp0022.obj hyxp0023.obj hyxp0024.obj hyxp0025.obj ! + hyxp0026.obj hyxp0027.obj hyxp0028.obj hyxp0029.obj hyxp0030.obj ! + hyxp0031.obj hyxp0032.obj hyxp0033.obj hyxp0034.obj hyxp0035.obj + +# llink -n0 -l$(lib).lib -dhyxpib.mod + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +pt.obj : \usr\lexicon\pt.c + $(cml) -DDIAG $? + $(obj) $@ + +\bin\pt.exe : pt.obj hyxp0002.obj hyxp0026.obj hyxp0027.obj hyxp0028.obj + link $**,$@,\dev\nul,c:\usr\sbr\lsbr/NOE; diff --git a/lib/ds/hyxta/(dirinf).fm b/lib/ds/hyxta/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..3ee9bec6daad72ca4146e35b571426a8a7a77660 --- /dev/null +++ b/lib/ds/hyxta/(dirinf).fm @@ -0,0 +1,30 @@ +# +# FILE %ds/hyxta/(dirinf).fm +# +# written: 1995-03-30 +# latest update: 1999-11-28 13:29:39 +# +# ---------------------------------------------------------------------------- +Makefile active Makefile +make-ux Makefile (Unix) +make-dos Makefile (MSDOS) + +hyxta001.c int hyx_ta_parse_char (struct HYX_PARSER_STATUS *hps, ...) +hyxta002.c int hyx_ta_parse_flush (struct HYX_PARSER_STATUS *hps, ...) +hyxta003.c int hyx_ta_get_break_code (int last_cat_code, ...) +hyxta004.c long hyx_ta_get_cat_flags (int cat); +hyxta004.c int hyx_ta_set_cat_flags (int cat, long catf); +hyxta005.c long hyx_ta_parse_file (struct HYX_PARSER_STATUS *hps, ...) +hyxta006.c long hyx_ta_parse_stream (...) +hyxta007.c int hyx_ta_store_node (struct HYX_PARSER_STATUS *hps, ...) +hyxta008.c struct TAG_DEFINITION *hyx_ta_find_tag_definition (long cat_flags) + + +# --- CLEANUP --- +hyxta012.c int hyx_ta_print_paragraph (FILE *fo, struct TA_TEXT *li, long ncnt) +hyxta015.c int hyx_ta_print_text_segments (FILE *fo, ...) +hyxta020.c int cdecl hyx_ta_flush_node_list (...) + +hyxta101.c static struct TA_OBJECT *finishup () +hyxta102.c struct TA_OBJECT *tao_mk_string (char *str, int size) +hyxtax01.c int ta_transmit_node (...) diff --git a/lib/ds/hyxta/Makefile b/lib/ds/hyxta/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..334dd66c04c18d768914ab35678cbcf707ff577f --- /dev/null +++ b/lib/ds/hyxta/Makefile @@ -0,0 +1,31 @@ +# +# FILE %ds/hyxta/make-ux +# +# written: 1995-12-20 +# latest update: 1999-05-08 9:41:02 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + hyxta001.o hyxta002.o hyxta003.o hyxta004.o hyxta005.o hyxta006.o \ + hyxta007.o hyxta008.o \ + hyxta012.o hyxta015.o hyxta020.o hyxta101.o hyxta102.o hyxtax01.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $? + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib diff --git a/lib/ds/hyxta/contrib b/lib/ds/hyxta/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/hyxta/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/hyxta/gg b/lib/ds/hyxta/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/hyxta/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/hyxta/hyxta001.c b/lib/ds/hyxta/hyxta001.c new file mode 100644 index 0000000000000000000000000000000000000000..3a3f0f85a47f7e1c2c17daa2e7045ca4734c7bf5 --- /dev/null +++ b/lib/ds/hyxta/hyxta001.c @@ -0,0 +1,108 @@ +/* + * FILE %ds/hyxta/hyxta001.c + * + * textual analysis: + * data stream segmentation + * + * T2D: + * - if ch is '<', '>' or '&', something should be done with it... + * that should be taken care off now... + * + * written: 1990 11 11 + * 1994-12-24: isolated from ta003.c + * 1995-03-30: moved to %ds/hyxta + * latest udpate: 1997-11-02 23:43:20 + * + */ + +#include <memory.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/parse.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif /* MSDOS */ + +/* ------------------------------------------------------------------------ */ +int hyx_ta_parse_char ( +struct HYX_PARSER_STATUS *hps, +int ch, +struct TEXT_ELEMENT **generated_node) +/* Return: -1 ... error */ +/* 0 ... ok */ +/* 1 ... node was generated */ +{ + int act_cat_code; + long act_cat_flag; + char *entity; + int rv= 0; + struct HYX_PARSER_CLASS *hpc; + + if (generated_node == (struct TEXT_ELEMENT **) 0) return -1; + + hpc= hps->HPS_hpc; + + act_cat_code= get_cat_code (ch); + act_cat_flag= hyx_ta_get_cat_flags (act_cat_code); + + if (hps->HPS_segment_length == 0L) /* buffer is empty */ + { +XX: + hps->HPS_segment_length= 0; + hps->HPS_last_cat_code = act_cat_code; + hps->HPS_cat_flags = act_cat_flag; + goto INSERT_CHARACTER; + } + + switch (hyx_ta_get_break_code (hps->HPS_last_cat_code, act_cat_code)) + { + case 0: /* character can be combined with data in buffer */ + hps->HPS_last_cat_code= act_cat_code; + hps->HPS_cat_flags |= act_cat_flag; + +INSERT_CHARACTER: + switch (ch) + { + case 0: + entity= "null"; + goto INSERT_ENTITY; + case '<': + entity= "lt"; + goto INSERT_ENTITY; + case '>': + entity= "gt"; + goto INSERT_ENTITY; + case '&': + entity= "amp"; +INSERT_ENTITY: + if (hps->HPS_segment_length+6 < MAX_SEGMENT_LENGTH) + { + hps->HPS_segment [hps->HPS_segment_length++]= + (char) hpc->HPC_entity_open; + while ((ch= *entity++ & 0x00FF) != 0) + hps->HPS_segment [hps->HPS_segment_length++]= (char) ch; + hps->HPS_segment [hps->HPS_segment_length++]= + (char) hpc->HPC_entity_close; + } + break; + default: + hps->HPS_segment [hps->HPS_segment_length++]= (char) ch; + break; + } + + if (hps->HPS_segment_length+7 >= MAX_SEGMENT_LENGTH) + { /* in reality, a new text segment should be created in this */ + /* situation, not a whole text element!!! (1994-11-15) */ + rv= hyx_ta_parse_flush (hps->HPS_hpc, hps, generated_node); + } + return rv; + + case 1: /* character can't be combined with data in buffer */ + rv= hyx_ta_parse_flush (hps->HPS_hpc, hps, generated_node); + goto XX; + + default: + return -1; + } +} diff --git a/lib/ds/hyxta/hyxta001.o b/lib/ds/hyxta/hyxta001.o new file mode 100644 index 0000000000000000000000000000000000000000..825b686cf05fa1fe806eb3af008563f1a1447df7 Binary files /dev/null and b/lib/ds/hyxta/hyxta001.o differ diff --git a/lib/ds/hyxta/hyxta002.c b/lib/ds/hyxta/hyxta002.c new file mode 100644 index 0000000000000000000000000000000000000000..988c054c0211aa411d6c8b5023f06265f286414f --- /dev/null +++ b/lib/ds/hyxta/hyxta002.c @@ -0,0 +1,45 @@ +/* + * FILE %ds/hyxta/hyxta002.c + * + * textual analysis: + * data stream segmentation + * + * written: 1990 11 11 + * 1994-12-24: isolated from ta003.c + * 1995-03-30: moved to %ds/hyxta + * latest udpate: 1996-12-22 18:30:14 + * + */ + +#include <memory.h> +#include <stdlib.h> +#include <gg/parse.h> +#include <gg/ta.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif /* MSDOS */ + +/* ------------------------------------------------------------------------ */ +int hyx_ta_parse_flush ( +struct HYX_PARSER_CLASS *hpc, +struct HYX_PARSER_STATUS *hps, +struct TEXT_ELEMENT **generated_node) +{ + struct TEXT_ELEMENT *te; + + if (hps->HPS_segment_length == 0L) return 0; /* no data in buffer */ + + if ((te= hyx_mktx_elem_and_segm (hpc, hps->HPS_segment, + hps->HPS_segment_length, + 0L, TEt_text, 0, 0)) + == (struct TEXT_ELEMENT *) 0) return -1; + + te->TE_cat_flags= hps->HPS_cat_flags; + *generated_node= te; + + hps->HPS_segment_length= 0L; + hps->HPS_cat_flags= 0L; + + return 1; +} diff --git a/lib/ds/hyxta/hyxta002.o b/lib/ds/hyxta/hyxta002.o new file mode 100644 index 0000000000000000000000000000000000000000..efd3211a346975cd195f1617cd2dd5fa456e9f86 Binary files /dev/null and b/lib/ds/hyxta/hyxta002.o differ diff --git a/lib/ds/hyxta/hyxta003.c b/lib/ds/hyxta/hyxta003.c new file mode 100644 index 0000000000000000000000000000000000000000..4940cadbd4e72d97b82784d9247d5fb96d57599f --- /dev/null +++ b/lib/ds/hyxta/hyxta003.c @@ -0,0 +1,151 @@ +/* + * FILE ~/usr/ds/hyxta/hyxta003.c + * + * textual analysis: + * break codes + * + * written: 1990 11 11 + * latest update: 1995-03-30: moved to %ds/hyxta + * + */ + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/ta.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#define MATRIX_SIZE 36 + +static int initialized= 0; +static int BREAK_TABLE [MATRIX_SIZE][MATRIX_SIZE]; + +/* ------------------------------------------------------------------------ */ +#define OVERLAY1_size 34 +static int BREAK_overlay1 [OVERLAY1_size] = +{ +/*TA_CAT_space1, TA_CAT_space2, */ +/*TA_CAT_space2, TA_CAT_space1, */ + + TA_CAT_small, TA_CAT_small, + TA_CAT_small, TA_CAT_capital, + TA_CAT_small, TA_CAT_nat_small, + TA_CAT_small, TA_CAT_nat_capital, + TA_CAT_capital, TA_CAT_small, + TA_CAT_capital, TA_CAT_capital, + TA_CAT_capital, TA_CAT_nat_small, + TA_CAT_capital, TA_CAT_nat_capital, + TA_CAT_nat_small, TA_CAT_small, + TA_CAT_nat_small, TA_CAT_capital, + TA_CAT_nat_small, TA_CAT_nat_small, + TA_CAT_nat_small, TA_CAT_nat_capital, + TA_CAT_nat_capital, TA_CAT_small, + TA_CAT_nat_capital, TA_CAT_capital, + TA_CAT_nat_capital, TA_CAT_nat_small, + TA_CAT_nat_capital, TA_CAT_nat_capital +} ; + +/* ------------------------------------------------------------------------ */ +int hyx_ta_get_break_code (int last_cat_code, int act_cat_code) +/* Return: -1 ... error */ +/* 0 ... no break */ +/* 1 ... break; 'phasechange' */ +{ + if (!initialized) hyx_ta_break_table_init (BREAK_DEFAULT_init); + + if (last_cat_code < 0 || act_cat_code < 0) return 1; + if (last_cat_code >= MATRIX_SIZE + || act_cat_code >= MATRIX_SIZE) + return (last_cat_code != act_cat_code); + + return BREAK_TABLE [last_cat_code][act_cat_code]; + +#ifdef STATIC_TABLE /* not used any longer */ + return (last_cat_code == act_cat_code) + ? 0 + : ((( last_cat_code == TA_CAT_small + || last_cat_code == TA_CAT_capital + || last_cat_code == TA_CAT_nat_small + || last_cat_code == TA_CAT_nat_capital) + &&( act_cat_code == TA_CAT_small + || act_cat_code == TA_CAT_capital + || act_cat_code == TA_CAT_nat_small + || act_cat_code == TA_CAT_nat_capital)) + ? 0 : 1); +#endif + +} + +/* ------------------------------------------------------------------------ */ +int hyx_ta_break_table_init (int mode) +{ + int i, j; + int v1= 0; + int v2= 0; + + switch (mode & 0x03) + { + case 0: v1= v2= 0; break; + case 1: v1= v2= 1; break; + case 2: v1= 0; v2= 1; break; + case 3: v1= 1; v2= 0; break; + } + + for (i= 0; i < MATRIX_SIZE; i++) + for (j= 0; j < MATRIX_SIZE; j++) + BREAK_TABLE [i][j]= (i==j) ? v1 : v2; + + initialized= 1; + + switch (mode & 0x0C) + { + case 4: + hyx_ta_break_table_overlay (BREAK_overlay1, OVERLAY1_size, 0); + break; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +void hyx_ta_break_table_dump (char *s) +{ + int i,j; + + printf ("break table: (%s)\n", s); + for (i= 0; i < MATRIX_SIZE; i++) + { + printf ("[%2d] ", i); + for (j= 0; j < MATRIX_SIZE; j++) + printf (" %d", BREAK_TABLE [i][j]); + printf ("\n"); + } +} + +/* ------------------------------------------------------------------------ */ +void hyx_ta_break_table_overlay (int pairs [], int cnt, int code) +{ + if (!initialized) hyx_ta_break_table_init (BREAK_DEFAULT_init); + + for (; cnt > 1; cnt -= 2) + { + hyx_ta_set_break_code (pairs [0], pairs [1], code); + pairs += 2; + } +} + +/* ------------------------------------------------------------------------ */ +int hyx_ta_set_break_code (int last_cat_code, int act_cat_code, int code) +{ + if (!initialized) hyx_ta_break_table_init (BREAK_DEFAULT_init); + + if (last_cat_code < 0 || act_cat_code < 0 + || last_cat_code >= MATRIX_SIZE + || act_cat_code >= MATRIX_SIZE) return -1; + + BREAK_TABLE [last_cat_code][act_cat_code] = code; + + return 0; +} diff --git a/lib/ds/hyxta/hyxta003.o b/lib/ds/hyxta/hyxta003.o new file mode 100644 index 0000000000000000000000000000000000000000..a7e7cc8aeec9e8aa859e46b096417ae70199cd0e Binary files /dev/null and b/lib/ds/hyxta/hyxta003.o differ diff --git a/lib/ds/hyxta/hyxta004.c b/lib/ds/hyxta/hyxta004.c new file mode 100644 index 0000000000000000000000000000000000000000..e1282a4cccba75410d2f7de10e3e61a5429e8b46 --- /dev/null +++ b/lib/ds/hyxta/hyxta004.c @@ -0,0 +1,65 @@ +/* + * FILE ~/usr/ds/hyxta/hyxta004.c + * + * textual analysis: + * category flags + * + * written: 1990 11 11 + * latest update: 1995-03-30: moved to %ds/hyxta + * + */ + +#include <gg/parse.h> +#include <gg/ta.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +static long CAT_BITS [TA_CAT_CODES] = +{ + TA_CATF_other, + TA_CATF_control1, + TA_CATF_control2, + TA_CATF_small, + TA_CATF_capital, + TA_CATF_digit, + TA_CATF_nat_small, + TA_CATF_nat_capital, + TA_CATF_nat_currency, + TA_CATF_greek, + TA_CATF_graphic, + TA_CATF_math1, + TA_CATF_math2, + TA_CATF_sond1, + TA_CATF_sond2, + TA_CATF_sond3, + TA_CATF_nat_satz, + TA_CATF_satz1, + TA_CATF_satz2, + TA_CATF_satz3, + TA_CATF_satz4, + TA_CATF_space1, + TA_CATF_space2, + TA_CATF_space3, + TA_CATF_ligature +} ; + +/* ------------------------------------------------------------------------ */ +long hyx_ta_get_cat_flags (int cat) +{ + if (cat < 0) return 0L; + if (cat >= TA_CAT_CODES) return TA_CATF_other; + + return CAT_BITS [cat]; +} + +/* ------------------------------------------------------------------------ */ +int hyx_ta_set_cat_flags (int cat, long catf) +{ + if (cat < 0 || cat >= TA_CAT_CODES) return -1; + CAT_BITS [cat]= catf; + + return 0; +} diff --git a/lib/ds/hyxta/hyxta004.o b/lib/ds/hyxta/hyxta004.o new file mode 100644 index 0000000000000000000000000000000000000000..fb0bbf348038a3ef8de88f9927d933cb1ab13bc5 Binary files /dev/null and b/lib/ds/hyxta/hyxta004.o differ diff --git a/lib/ds/hyxta/hyxta005.c b/lib/ds/hyxta/hyxta005.c new file mode 100644 index 0000000000000000000000000000000000000000..cd076fc945264bc46cc9a6c1b0a9c941c34c521e --- /dev/null +++ b/lib/ds/hyxta/hyxta005.c @@ -0,0 +1,41 @@ +/* + * FILE %ds/hyxta/hyxta005.c + * + * written: 1994-11-12 + * latest update: 1996-12-22 18:49:34 + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif /* MSDOS */ + +/* ------------------------------------------------------------------------ */ +long hyx_ta_parse_file ( +struct HYX_PARSER_STATUS *hps, +char *fn, +long pos_offset, +long max_to_read) +{ + FILE *fi; + long rc; + struct TEXT_ELEMENT *ta_text_element= (struct TEXT_ELEMENT *) 0; + + if ((fi= fopen (fn, "r")) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -2L; + } + +fprintf (stderr, ">>> ta_parse_file %s\n", fn); + fseek (fi, pos_offset, 0); + + rc= hyx_ta_parse_stream (hps->HPS_hpc, hps, fi, max_to_read); + + fclose (fi); + + return rc; +} diff --git a/lib/ds/hyxta/hyxta005.o b/lib/ds/hyxta/hyxta005.o new file mode 100644 index 0000000000000000000000000000000000000000..c919118d11282faf4685b1e5e9384106acd26892 Binary files /dev/null and b/lib/ds/hyxta/hyxta005.o differ diff --git a/lib/ds/hyxta/hyxta006.c b/lib/ds/hyxta/hyxta006.c new file mode 100644 index 0000000000000000000000000000000000000000..d12a3805dcdd18a7ef94ab3f8ffe8076a8c2d70d --- /dev/null +++ b/lib/ds/hyxta/hyxta006.c @@ -0,0 +1,49 @@ +/* + * FILE %ds/hyxta/hyxta006.c + * + * written: 1994-03-30: extracted from %ds/hyxta/hyxta005.c + * latest update: 1996-12-22 18:30:06 + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif /* MSDOS */ + +/* ------------------------------------------------------------------------ */ +long hyx_ta_parse_stream ( +struct HYX_PARSER_CLASS *hpc, +struct HYX_PARSER_STATUS *hps, +FILE *fi, +long max_to_read) +{ + int ch; + int segment_ready; + long bytes_read= 0L; + struct TEXT_ELEMENT *ta_text_element= (struct TEXT_ELEMENT *) 0; + + hps->HPS_last_cat_code= -1; + + while (max_to_read-- > 0L) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + bytes_read++; + + ta_text_element= (struct TEXT_ELEMENT *) 0; + segment_ready= hyx_ta_parse_char (hps, ch, &ta_text_element); + + if (segment_ready < 0) break; + if (segment_ready == 1) hyx_ta_store_node (hpc, hps, ta_text_element); + } + + ta_text_element= (struct TEXT_ELEMENT *) 0; + + segment_ready= hyx_ta_parse_flush (hpc, hps, &ta_text_element); + if (segment_ready == 1) hyx_ta_store_node (hpc, hps, ta_text_element); + + return bytes_read; +} diff --git a/lib/ds/hyxta/hyxta006.o b/lib/ds/hyxta/hyxta006.o new file mode 100644 index 0000000000000000000000000000000000000000..6550e58f113d9a2f3255e182282c2338fbf39464 Binary files /dev/null and b/lib/ds/hyxta/hyxta006.o differ diff --git a/lib/ds/hyxta/hyxta007.c b/lib/ds/hyxta/hyxta007.c new file mode 100644 index 0000000000000000000000000000000000000000..6ad49b7a140e27503636802758855753077fd138 --- /dev/null +++ b/lib/ds/hyxta/hyxta007.c @@ -0,0 +1,49 @@ +/* + * FILE %ds/hyxta/hyxta007.c + * + * written: 1994-03-25 + * 1994-12-24: isolated from ta011.c + * 1995-03-30: moved to %ds/hyxta + * latest update: 1996-12-22 18:50:12 + * + */ + +#include <stdio.h> +#include <gg/parse.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif /* MSDOS */ + +/* ------------------------------------------------------------------------ */ +int hyx_ta_store_node ( +struct HYX_PARSER_CLASS *hpc, +struct HYX_PARSER_STATUS *hps, +struct TEXT_ELEMENT *node) +{ + +#ifdef JUNK + if (hps->HPS_tx_cnt > MAX_BUFFERED_NODES + ||((node->TE_cat_flags & TA_CATF_space2) + && hyx_tx_segm_count_char (node->TE_text_segment, '\n') > 1)) + { + hyx_ta_flush_node_list (hps); + printf ("\n\n"); + /**** + sgml_write_data (stdout, "", "", node->ta_data, (int) node->ta_data_size); + ****/ + } + + if ((node->TE_cat_flags & TA_CATF_space2) + && hyx_tx_segm_count_char (node->TE_text_segment, '\n') > 1) + return 0; +#endif /* JUNK */ + + node->TE_tag_definition= hyx_ta_find_tag_definition (hpc, node->TE_cat_flags); + + *hps->HPS_ptx= node; + hps->HPS_ptx= &node->TE_next; + hps->HPS_tx_cnt++; + + return 0; +} diff --git a/lib/ds/hyxta/hyxta007.o b/lib/ds/hyxta/hyxta007.o new file mode 100644 index 0000000000000000000000000000000000000000..a4ffd9b8a987c5b6cb2b831f36e86773c5834a10 Binary files /dev/null and b/lib/ds/hyxta/hyxta007.o differ diff --git a/lib/ds/hyxta/hyxta008.c b/lib/ds/hyxta/hyxta008.c new file mode 100644 index 0000000000000000000000000000000000000000..c6ae6cde25f5f538a28ded6e13821f63ac1fb9aa --- /dev/null +++ b/lib/ds/hyxta/hyxta008.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/hyxta/hyxta008.c + * + * see also: %etc/lexicon.tags + * + * written: 1995-03-31 + * latest update: 1997-11-02 23:40:09 + * + */ + +#include <stdio.h> +#include <gg/parse.h> +#include <gg/ta.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif /* MSDOS */ + +/* ------------------------------------------------------------------------ */ +struct TAG_DEFINITION *hyx_ta_find_tag_definition ( +struct HYX_PARSER_CLASS *hpc, +long cat_flags) +{ + if (cat_flags & TA_CATF_space) + return hyx_find_tag_definition (hpc, "ta.space"); + + if (cat_flags & TA_CATF_letter) + return hyx_find_tag_definition (hpc, "ta.word"); + + if (cat_flags & TA_CATF_digit) + return hyx_find_tag_definition (hpc, "ta.number"); + + if (cat_flags & TA_CATF_satz) + return hyx_find_tag_definition (hpc, "ta.punkt"); + + return hyx_find_tag_definition (hpc, "ta.otok"); +} diff --git a/lib/ds/hyxta/hyxta008.o b/lib/ds/hyxta/hyxta008.o new file mode 100644 index 0000000000000000000000000000000000000000..e2508abdd5527a63fa1ace432548e1b81a0c51f0 Binary files /dev/null and b/lib/ds/hyxta/hyxta008.o differ diff --git a/lib/ds/hyxta/hyxta012.c b/lib/ds/hyxta/hyxta012.c new file mode 100644 index 0000000000000000000000000000000000000000..804a7a62c26fc8f9617cdcde12be3f74cc1823f7 --- /dev/null +++ b/lib/ds/hyxta/hyxta012.c @@ -0,0 +1,180 @@ +/* + * FILE %ds/hyxta/hyxta012.c + * + * written: 1994-03-25 + * latest update: 1997-11-02 17:16:32 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/hytxt.h> +#include <gg/dirty.h> +#include <gg/attlist.h> +#include <gg/parse.h> +#include <gg/ta.h> + +/* ------------------------------------------------------------------------ */ +static int frame_is_open= 0; +static long frame_counter= 0L; +static long par_counter= 0L; +static char frame_name [82]; +static char frame_name_prev [82]; + +struct ATTRIBUTE_LIST *al= (struct ATTRIBUTE_LIST *) 0; + +/* ------------------------------------------------------------------------ */ +static char *PAR_TYPE [N_PAR_TYPE] = +{ +/* PAR_TYPE_text */ "par", +/* PAR_TYPE_section_head */ "par.sec", +/* PAR_TYPE_table_head */ "par.tbl", +/* PAR_TYPE_figure_head */ "par.fig", +/* PAR_TYPE_chapter */ "par.chap" +} ; + +/* ------------------------------------------------------------------------ */ +int ta_print_paragraph (FILE *fo, struct TEXT_ELEMENT *li, long ncnt) +{ + int par_type; + int rv= 0; + int prev= 0; + + if (li == (struct TEXT_ELEMENT *) 0) return 0; + +fprintf (stderr, "ta_print_paragraph\n"); + par_type= ta_identify_par_type (li); + if (par_type >= N_PAR_TYPE) par_type= PAR_TYPE_text; + + if (par_type > 0 || !frame_is_open) + sprintf (frame_name, "fr%05ld.ta", ++frame_counter); + + if (par_type > 0 && frame_is_open) + { + fprintf (fo, "<hyx.l dir=next fr=\"%s\">", frame_name); + fprintf (fo, "</Frame>\n"); + frame_is_open= 0; + prev= 1; + } + + if (!frame_is_open) + { + fprintf (fo, "<Frame %s>\n", frame_name); + fprintf (fo, "<hyx.l dir=up fr=\"$$root\">"); + if (prev == 1) + fprintf (fo, "<hyx.l dir=prev fr=\"%s\">", frame_name_prev); + strcpy (frame_name_prev, frame_name); + frame_is_open= 1; + al_set_attribute (&al, strdup ("frame_name"), strdup (frame_name), + (long) ALty_opaque, (void *) li); + rv= 1; + } + + ta_print_nodelist (fo, li, ncnt, par_type); + + return rv; +} + +/* ------------------------------------------------------------------------ */ +int ta_print_nodelist ( +FILE *fo, +struct TEXT_ELEMENT *li, +long ncnt, +int par_type) +{ + fprintf (fo, "<ta.%s id=%ld ncnt=%ld>", + PAR_TYPE [par_type], ++par_counter, ncnt); + + for (; li != (struct TEXT_ELEMENT *) 0; li= li->TE_next) + hyx_ta_print_text_segments (fo, li->TE_text_segment); + + fprintf (fo, "</ta.%s>", PAR_TYPE [par_type]); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ta_identify_par_type (struct TEXT_ELEMENT *li) +{ +#define beg_undef -1 + int beg= beg_undef; + int lines= 0; + + for (; li != (struct TEXT_ELEMENT *) 0; li= li->TE_next) + { + if (li->TE_cat_flags & TA_CATF_space2) lines++; + if (li->TE_cat_flags & TA_CATF_space) continue; + + if (beg == beg_undef) + { + if (li->TE_cat_flags & TA_CATF_digit) beg= PAR_TYPE_section_head; + if (li->TE_cat_flags & TA_CATF_letter) + { + struct TEXT_SEGMENT *ts; + char *ts_data; + + ts= li->TE_text_segment; + ts_data= ts->TSEG_text_array; + + if (strncmp (ts_data, "Chapter", 7) == 0 + ||strncmp (ts_data, "CHAPTER", 7) == 0 + ||strncmp (ts_data, "chapter", 7) == 0) beg= PAR_TYPE_chapter; + else + if (strncmp (ts_data, "Table", 5) == 0 + ||strncmp (ts_data, "TABLE", 5) == 0 + ||strncmp (ts_data, "table", 5) == 0) beg= PAR_TYPE_table_head; + else + if (strncmp (ts_data, "Fig", 3) == 0 + ||strncmp (ts_data, "fig", 5) == 0 + ||strncmp (ts_data, "FIG", 5) == 0) beg= PAR_TYPE_figure_head; + else + if (strncmp (ts_data, "App", 3) == 0 + ||strncmp (ts_data, "app", 5) == 0 + ||strncmp (ts_data, "APP", 5) == 0) beg= PAR_TYPE_section_head; + else + beg= PAR_TYPE_text; + } + } + } + + if (lines > 3) return PAR_TYPE_text; + if (beg >= 0) return beg; + + return PAR_TYPE_text; +} + +/* ------------------------------------------------------------------------ */ +int ta012_finish (FILE *fo) +{ + if (frame_is_open) + { + fprintf (fo, "</Frame>\n"); + frame_is_open= 0; + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +int ta_print_toc (FILE *fo, char *frame_name) +{ + struct ATTRIBUTE_LIST *al2; + struct TEXT_ELEMENT *li; + + fprintf (fo, "<Frame %s>\n", frame_name); + + for (al2= al; + al2 != (struct ATTRIBUTE_LIST *) 0; + al2= al2->AL_next) + { + printf ("<hyx.l fr=\"%s\">* ", al2->AL_name); + + li= (struct TEXT_ELEMENT *) al2->AL_value; + for (; li != (struct TEXT_ELEMENT *) 0; li= li->TE_next) + hyx_ta_print_text_segments (fo, li->TE_text_segment); + + fputc ('\n', fo); + } + fprintf (fo, "</Frame>\n"); + + return 0; +} diff --git a/lib/ds/hyxta/hyxta012.o b/lib/ds/hyxta/hyxta012.o new file mode 100644 index 0000000000000000000000000000000000000000..0ce3450ce1e02c32f11010603c99b850761b2c43 Binary files /dev/null and b/lib/ds/hyxta/hyxta012.o differ diff --git a/lib/ds/hyxta/hyxta015.c b/lib/ds/hyxta/hyxta015.c new file mode 100644 index 0000000000000000000000000000000000000000..ea16c42a38e43395a40f99dfab5f405af3cf69bb --- /dev/null +++ b/lib/ds/hyxta/hyxta015.c @@ -0,0 +1,32 @@ +/* + * FILE %ta/ta015.c + * + * written: 1994-11-12 + * latest update: 1996-12-22 20:49:43 + * + */ + +#include <stdio.h> +#include <gg/hytxt.h> +#include <gg/attlist.h> +#include <gg/parse.h> +#include <gg/ta.h> + +/* ------------------------------------------------------------------------ */ +int hyx_ta_print_text_segments (FILE *fo, struct TEXT_SEGMENT *ts) +{ + for (; + ts != (struct TEXT_SEGMENT *) 0; + ts= ts->TSEG_next) + { + /* fputc ('[', fo); */ + /***************** + sgml_write_data (fo, "", "", + ts->TSEG_text_array, (int) ts->TSEG_text_lng); + *****************/ + fputs (ts->TSEG_text_array, fo); + /* fputc (']', fo); */ + } + + return 0; +} diff --git a/lib/ds/hyxta/hyxta015.o b/lib/ds/hyxta/hyxta015.o new file mode 100644 index 0000000000000000000000000000000000000000..dd38a7e578fe9ba852515c9b0191c5984a5fbf04 Binary files /dev/null and b/lib/ds/hyxta/hyxta015.o differ diff --git a/lib/ds/hyxta/hyxta020.c b/lib/ds/hyxta/hyxta020.c new file mode 100644 index 0000000000000000000000000000000000000000..678264eb9356dad239ddce6323f9e3eb55a2540d --- /dev/null +++ b/lib/ds/hyxta/hyxta020.c @@ -0,0 +1,31 @@ +/* + * FILE %ta/ta020.c + * + * written: 1994-03-25 + * 1994-12-24: isolated from ta011.c + * latest update: 1999-11-28 13:28:39 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/parse.h> +#include <gg/ta.h> +#include <gg/hytxt.h> + +/* ------------------------------------------------------------------------ */ +int hyx_ta_flush_node_list (struct HYX_PARSER_STATUS *hps) +{ + if (hps->HPS_tx_list == (struct TEXT_ELEMENT *) 0) return 0; + + if (ta_print_paragraph (stdout, hps->HPS_tx_list, hps->HPS_tx_cnt) <= 0) + hyx_frtx_elem_list (hps->HPS_tx_list); + + hps->HPS_tx_list= (struct TEXT_ELEMENT *) 0; + hps->HPS_ptx= &hps->HPS_tx_list; + hps->HPS_tx_cnt= 0L; + + return 0; +} diff --git a/lib/ds/hyxta/hyxta020.o b/lib/ds/hyxta/hyxta020.o new file mode 100644 index 0000000000000000000000000000000000000000..2683ea04298af4ff48d886ad6363004cc1cd519f Binary files /dev/null and b/lib/ds/hyxta/hyxta020.o differ diff --git a/lib/ds/hyxta/hyxta100.c b/lib/ds/hyxta/hyxta100.c new file mode 100644 index 0000000000000000000000000000000000000000..cb8f8621ea2e7ecb1609be83e81d4c52c89b18c2 --- /dev/null +++ b/lib/ds/hyxta/hyxta100.c @@ -0,0 +1,16 @@ +/* + * FILE ~/usr/ta/ta100.c + * + * textual analysis with TA_OBJECT + * + * written: 1994-06-01 + * latest update: 1994-06-01 + * + */ + +#include <gg/ta.h> + +/* ------------------------------------------------------------------------ */ + + + diff --git a/lib/ds/hyxta/hyxta101.c b/lib/ds/hyxta/hyxta101.c new file mode 100644 index 0000000000000000000000000000000000000000..9cca9b623eac8214fe828a4d10f3ce0d07f097f0 --- /dev/null +++ b/lib/ds/hyxta/hyxta101.c @@ -0,0 +1,98 @@ +/* + * FILE %ds/hyxta/hyxta101.c + * + * textual analysis with TA_OBJECT + * - read the body of a SGML object + * - this function can be calling itself recurively + * + * written: 1994-05-31 + * latest update: 1999-05-07 16:34:56 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/parse.h> +#include <gg/ta.h> + +#define TB_Size 4096 +static char txt_buffer [TB_Size]; +static int TB_index= 0; + +/* ------------------------------------------------------------------------ */ +static struct TA_OBJECT *cdecl finishup (void); + +/* ------------------------------------------------------------------------ */ +static struct TA_OBJECT *finishup () +{ + struct TA_OBJECT *ttao; + + ttao= tao_mk_string (txt_buffer, TB_index); + if (ttao == (struct TA_OBJECT *) 0) + { + fprintf (stderr, "ta101: error: out memory!\n"); + return (struct TA_OBJECT *) 0; + } + TB_index= 0; + + return ttao; +} + +/* ------------------------------------------------------------------------ */ +struct TA_OBJECT *tao_rd_sgml_body (struct TA_SOURCE *source) +{ + struct TA_OBJECT *tao; + struct TA_OBJECT *ttao; + struct TA_OBJECT **tao_body; + FILE *fi; + int ch; + + TB_index= 0; +printf ("tao101: reading from %s\n", source->TAS_filename); + + if (source == (struct TA_SOURCE *) 0 + || (fi= source->TAS_file) == (FILE *) 0) + return (struct TA_OBJECT *) 0; + +printf ("tao101: reading from %s\n", source->TAS_filename); + + if ((tao= calloc (sizeof (struct TA_OBJECT), 1)) + == (struct TA_OBJECT *) 0) return (struct TA_OBJECT *) 0; + + tao_body= (struct TA_OBJECT **) &tao->TAO_body; + +printf ("tao101: reading from %s\n", source->TAS_filename); + + for (;;) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) + { +printf ("EOF!!!!\n"); + source->TAS_is_eof= 1; + goto FINISH; + } + +printf ("ch=0x%02X\n", ch); + switch (ch) + { + case '<': + case '&': + break; + default: + txt_buffer [TB_index++]= (char) ch; + if (TB_index >= TB_Size) + { +FINISH: +printf ("Finish!!!!\n"); + ttao= finishup (); + *tao_body= ttao; + tao_body= &(ttao->TAO_next); + } + break; + } + if (feof (fi)) break; + } + + return tao; +} diff --git a/lib/ds/hyxta/hyxta101.o b/lib/ds/hyxta/hyxta101.o new file mode 100644 index 0000000000000000000000000000000000000000..50364eff21898befcb8c9298364aca393756a4de Binary files /dev/null and b/lib/ds/hyxta/hyxta101.o differ diff --git a/lib/ds/hyxta/hyxta102.c b/lib/ds/hyxta/hyxta102.c new file mode 100644 index 0000000000000000000000000000000000000000..b00e6ddf054abebf242718277ba13e6a58112b80 --- /dev/null +++ b/lib/ds/hyxta/hyxta102.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/hyxta/hyxta102.c + * + * textual analysis with TA_OBJECT + * + * written: 1994-06-01 + * latest update: 1999-11-28 13:29:21 + * + */ + +#include <stdlib.h> +#include <memory.h> +#include <stdio.h> +#include <gg/parse.h> +#include <gg/ta.h> +#include <gg/dirty.h> + +/* ------------------------------------------------------------------------ */ +struct TA_OBJECT *tao_mk_string (char *str, int size) +{ + struct TA_OBJECT *tao; + char *cp; + +printf ("tao_mk_string: size=%d\n", size); +dump (stderr, str, size); + + if ((tao= (struct TA_OBJECT *) calloc (sizeof (struct TA_OBJECT), 1)) + == (struct TA_OBJECT *) 0 + || (cp= malloc (size+1)) == (char *) 0) + return (struct TA_OBJECT *) 0; + + memcpy (cp, str, size); + cp [size]= 0; + tao->TAO_type= TAOT_string; + tao->TAO_size= (int) size; + tao->TAO_body= cp; + + return tao; +} diff --git a/lib/ds/hyxta/hyxta102.o b/lib/ds/hyxta/hyxta102.o new file mode 100644 index 0000000000000000000000000000000000000000..1bce766d46951278c8bf224d643d19a1ceeac97b Binary files /dev/null and b/lib/ds/hyxta/hyxta102.o differ diff --git a/lib/ds/hyxta/hyxtax01.c b/lib/ds/hyxta/hyxtax01.c new file mode 100644 index 0000000000000000000000000000000000000000..e64d6e0557782f6b8acdb22888c0b8416fff1d5d --- /dev/null +++ b/lib/ds/hyxta/hyxtax01.c @@ -0,0 +1,85 @@ +/* + * FILE %ds/hyxta/hyxtax01.c + * + * written: 1990 11 11 + * 1992 11 15: revision + * latest update: 1996-12-22 21:24:39 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/parse.h> +#include <gg/ta.h> +#include <gg/hytxt.h> +#include <gg/dirty.h> + +static int tm= 0; + +/* ------------------------------------------------------------------------ */ +void ta_transmit_mode (int mode) +{ + tm= mode; +} + +/* ------------------------------------------------------------------------ */ +int ta_transmit_node ( +struct HYX_PARSER_STATUS *hps, +struct TEXT_ELEMENT *node) +{ + switch (tm) + { +#ifdef __JUNK__ + case 1: + printf ("--------------------------------------\n"); + printf ("Node; lng=%ld size=%ld cat_flags=0x%08lX\n", + node->ta_data_lng, + node->ta_data_size, + node->ta_cat_flags); + dump (stdout, node->ta_data, (int) node->ta_data_size); + break; + + case 2: +/*************** + if (node->ta_cat_flags & 0x0300000) + { + fwrite (node->ta_data, (int) node->ta_data_size, 1, stdout); + break; + } +****************/ + fprintf (stdout, "<ta.n l=%ld c=0x%lx>", + node->ta_data_lng, node->ta_cat_flags); + sgml_write_data (stdout, "", "", node->ta_data, (int) node->ta_data_size); + fprintf (stdout, "</ta.n>"); + break; + + case 3: + fwrite (node->ta_data, (int) node->ta_data_size, 1, stdout); + break; + + case 4711: + fputc ('�', stdout); + fwrite (node->ta_data, (int) node->ta_data_size, 1, stdout); + fputc ('�', stdout); + break; +#endif + + case 4: + ta_collect_node (hps, node); + break; + + case 5: + display_markup (stdout, hps->HPS_hpc, node, 2, 0, 0, 1); + hyx_frtx_elem_list (node); + break; + + default: + dump_text_element_list (stdout, node); + hyx_frtx_elem_list (node); + break; + } + + + return 0; +} diff --git a/lib/ds/hyxta/hyxtax01.o b/lib/ds/hyxta/hyxtax01.o new file mode 100644 index 0000000000000000000000000000000000000000..33fd5a42856dabbf75df24e3e9a5f1f3f9dde93c Binary files /dev/null and b/lib/ds/hyxta/hyxtax01.o differ diff --git a/lib/ds/hyxta/lib b/lib/ds/hyxta/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/hyxta/libgg.a b/lib/ds/hyxta/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/hyxta/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/hyxta/make-dos b/lib/ds/hyxta/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..95e90fedf8c97688c8270c9f60469b58010b3de2 --- /dev/null +++ b/lib/ds/hyxta/make-dos @@ -0,0 +1,25 @@ +# +# FILE %ds/hyxta/makefile +# +# written: 1995-03-30 +# latest update: 1996-12-22 21:23:21 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 HYPER_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : hyxta001.obj hyxta002.obj hyxta003.obj hyxta004.obj ! + hyxta005.obj hyxta006.obj hyxta007.obj hyxta008.obj ! + hyxta012.obj hyxta015.obj hyxta020.obj ! + hyxta101.obj hyxta102.obj hyxtax01.obj + +# hyxta009.obj hyxta010.obj hyxta011.obj hyxta012.obj ! +# hyxta013.obj hyxta014.obj hyxta015.obj hyxta016.obj ! +# hyxta017.obj hyxta018.obj hyxta019.obj hyxta020.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/irdb/(dirinf).fm b/lib/ds/irdb/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..d8db91b47bcb426a25aa1352a2cee72ec3cb9c40 --- /dev/null +++ b/lib/ds/irdb/(dirinf).fm @@ -0,0 +1,61 @@ +# +# FILE %ds/irdb/(dirinf).fm +# +# written: 1996-04-01 +# latest update: 1996-05-07 12:30:11 +# + +# see also: <gg/irdb.h> and irdb +(dirinf).fm Contents +Makefile DOS version of Makefile +make-ux Unix version of Makefile + +irdb0000.c TEMPLATE + +irdb0001.c dump to file +irdb0002.c dump to stream +irdb0003.c dump payload +irdb0004.c dump string +irdb0005.c dump struct +irdb0006.c commit pos +irdb0007.c get dumped form +irdb0008.c get core form +irdb0009.c create pos handle +irdb0010.c create irdb handle + +irdb0011.c create irdb struct handle +irdb0012.c store to structure +irdb0013.c replace string to structure +irdb0014.c locate info address +irdb0015.c check if record exists +irdb0016.c replace string +irdb0017.c locate handle +irdb0018.c set long value +irdb0019.c post increment long value +irdb0020.c pre increment long value + +irdb0021.c fixup pos header +irdb0022.c load handle +irdb0023.c load string +irdb0024.c get pos file pointer +irdb0025.c restore from pos +irdb0026.c restore handles +irdb0027.c restore strings +irdb0028.c get long value + +irdb0101.c diag dump to file +irdb0102.c diag dump to stream +irdb0103.c diag dump payload +irdb0104.c diag dump string +irdb0105.c diag dump struct +irdb0106.c get type name +irdb0107.c long irdb_dbg_show_slot_names (...) + +irdb0112.c debugging: store to structure +irdb0116.c debugging: replace string +irdb0118.c debugging: set long value +irdb0119.c debugging: post increment long value +irdb0120.c debugging: pre increment long value + + +it1.c Test 1 diff --git a/lib/ds/irdb/Makefile b/lib/ds/irdb/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..87f13d1f9dd98e83a7795a0dfd372fc9018c4e8c --- /dev/null +++ b/lib/ds/irdb/Makefile @@ -0,0 +1,41 @@ +# +# FILE %ds/irdb/make-ux +# +# written: 1996-04-01 +# latest update: 1999-05-08 9:43:29 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all : lib + +all.00= \ + irdb0001.o irdb0002.o irdb0003.o irdb0004.o irdb0005.o \ + irdb0006.o irdb0007.o irdb0008.o irdb0009.o irdb0010.o \ + irdb0011.o irdb0012.o irdb0013.o irdb0014.o irdb0015.o \ + irdb0016.o irdb0017.o irdb0018.o irdb0019.o irdb0020.o \ + irdb0021.o irdb0022.o irdb0023.o irdb0024.o irdb0025.o \ + irdb0026.o irdb0027.o irdb0028.o + +all.01= \ + irdb0101.o irdb0102.o irdb0103.o irdb0104.o irdb0105.o \ + irdb0106.o irdb0107.o \ + irdb0112.o \ + irdb0116.o irdb0118.o irdb0119.o irdb0120.o + +all.test : it1.exe + +# ---------------------------------------------------------------------------- +lib: $(all.00) $(all.01) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib diff --git a/lib/ds/irdb/contrib b/lib/ds/irdb/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/irdb/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/irdb/gg b/lib/ds/irdb/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/irdb/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/irdb/irdb0000.c b/lib/ds/irdb/irdb0000.c new file mode 100644 index 0000000000000000000000000000000000000000..a5b3f58cc63f9b189d7a67526e6f7624bbe8cfc6 --- /dev/null +++ b/lib/ds/irdb/irdb0000.c @@ -0,0 +1,24 @@ +/* + * FILE %ds/irdb/irdb0000.c + * + * irrelational database + * + * written: 1996-04-05 + * latest update: 1996-04-28 12:17:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int irdb_do_whatever ( +struct IRDB_HANDLE *handle, +char *filename) +{ + handle; filename; +} diff --git a/lib/ds/irdb/irdb0001.c b/lib/ds/irdb/irdb0001.c new file mode 100644 index 0000000000000000000000000000000000000000..7bef4ca9f9818da25eee15181f8a497101cadefa --- /dev/null +++ b/lib/ds/irdb/irdb0001.c @@ -0,0 +1,46 @@ +/* + * FILE %ds/irdb/irdb0001.c + * + * irrelational database + * + * written: 1996-04-05 + * latest update: 1996-05-07 13:41:45 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dpp.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_dump_to_file ( +char *filename, +struct IRDB_HANDLE *handle) +{ + FILE *fo; + long rc= 0L; + + if ((fo= fopen (filename, "wb")) == (FILE *) 0) return -1L; + if (handle == (struct IRDB_HANDLE *) 0) return 0L; + + /* write structure's header */ + dpp_fwrite_long (fo, handle->IRDB_type, 4); + dpp_fwrite_long (fo, handle->IRDB_payload_size, 4); + dpp_fwrite_long (fo, 0x123489ABL, 4); + dpp_fwrite_long (fo, handle->IRDB_payload_type, 4); + +#ifdef IRDB_USE_CLASS_NAME + irdb_dump_string (fo, handle->IRDB_class_name); +#endif /* IRDB_USE_CLASS_NAME */ + + irdb_dump_payload (fo, handle); + fclose (fo); + + irdb_fixup_pos_header (filename, handle); + + return rc; +} diff --git a/lib/ds/irdb/irdb0001.o b/lib/ds/irdb/irdb0001.o new file mode 100644 index 0000000000000000000000000000000000000000..e8a7088575f8ebc57f9112434a52ca7ac82f853c Binary files /dev/null and b/lib/ds/irdb/irdb0001.o differ diff --git a/lib/ds/irdb/irdb0002.c b/lib/ds/irdb/irdb0002.c new file mode 100644 index 0000000000000000000000000000000000000000..9c14522b0eb1fa003a831e00ba72ad60abb40eb2 --- /dev/null +++ b/lib/ds/irdb/irdb0002.c @@ -0,0 +1,42 @@ +/* + * FILE %ds/irdb/irdb0002.c + * + * irrelational database + * + * written: 1996-04-05 + * latest update: 1996-04-27 14:07:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dpp.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_dump_to_stream (FILE *fo, struct IRDB_HANDLE *handle) +{ + long pos; + + if (fo == (FILE *) 0) return -1L; + if (handle == (struct IRDB_HANDLE *) 0) return 0L; + + /* first dump the payload, then dump the header! */ + irdb_dump_payload (fo, handle); + + /* write structure's header */ + pos= ftell (fo); + dpp_fwrite_long (fo, handle->IRDB_type, 4); + dpp_fwrite_long (fo, handle->IRDB_payload_size, 4); + dpp_fwrite_long (fo, handle->IRDB_payload, 4); + dpp_fwrite_long (fo, handle->IRDB_payload_type, 4); + +#ifdef IRDB_USE_CLASS_NAME + irdb_dump_string (fo, handle->IRDB_class_name); +#endif /* IRDB_USE_CLASS_NAME */ + + return pos; +} diff --git a/lib/ds/irdb/irdb0002.o b/lib/ds/irdb/irdb0002.o new file mode 100644 index 0000000000000000000000000000000000000000..fc3d349ab65c471ac295d92d5c915d2f0c758375 Binary files /dev/null and b/lib/ds/irdb/irdb0002.o differ diff --git a/lib/ds/irdb/irdb0003.c b/lib/ds/irdb/irdb0003.c new file mode 100644 index 0000000000000000000000000000000000000000..a856ef07462200b1c55f10ff4a2716f527c0363b --- /dev/null +++ b/lib/ds/irdb/irdb0003.c @@ -0,0 +1,120 @@ +/* + * FILE %ds/irdb/irdb0003.c + * + * irrelational database + * + * written: 1996-04-05 + * latest update: 1996-04-27 14:10:17 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_dump_payload ( +FILE *fo, +struct IRDB_HANDLE *handle) +{ + long rc= 0L; + long pos= 0L; + long size; + long ty; + char *cp; + struct YTREE *yt; + struct IRDB_DUMP dmp; +#define BUFFER_SIZE 256 + + if (fo == (FILE *) 0) return -1L; + + if (handle == (struct IRDB_HANDLE *) 0) goto DONE; + +#ifdef DEBUG2 +printf ("irdb0003: cln='%s' type=%s\n", +#ifdef IRDB_USE_CLASS_NAME +handle->IRDB_class_name, +#else +"anon", +#endif /* !IRDB_USE_CLASS_NAME */ +irdb_type (handle->IRDB_type)); +#endif /* DEBUG2 */ + + switch ((int) handle->IRDB_type) + { + case IRDBty_int: + dpp_fwrite_long (fo, handle->IRDB_payload, 4); + handle->IRDB_payload_size= 4; + break; + + case IRDBty_string: + pos= ftell (fo); + cp= (char *) handle->IRDB_payload; + size= irdb_dump_string (fo, cp); + free_or_what (cp); + + handle->IRDB_payload_size= size; + handle->IRDB_payload= pos; + handle->IRDB_type= IRDBty_string_dumped; + break; + + case IRDBty_float: + case IRDBty_block: + case IRDBty_array: + fprintf (stderr, "irdb0003: T2D!\n"); + break; + + case IRDBty_struct: + yt= (struct YTREE *) handle->IRDB_payload; + +#ifdef DEBUG2 +printf ("irdb0003: struct; payload_type=%s\n", +irdb_type (handle->IRDB_payload_type)); +#endif /* DEBUG2 */ + + if ((ty= handle->IRDB_payload_type) != IRDBty_int) + { + char *buffer= (char *) 0; + + if ((buffer= malloc (BUFFER_SIZE)) == (char *) 0) goto DONE; + dmp.fo= fo; + dmp.type= ty; + + ytree_track (yt, + buffer, BUFFER_SIZE, 0, + irdb_dump_struct, (void *) &dmp); + free_or_what (buffer); + + handle->IRDB_payload_type= irdb_dumped_form (ty); + } + + pos= ftell (fo); + size= ytree_size (yt); + ytree_dump (fo, yt); + ytree_free (yt); + + handle->IRDB_payload_size= size; + handle->IRDB_payload= pos; + handle->IRDB_type= IRDBty_struct_dumped; + +#ifdef DEBUG2 +printf ("irdb0003: ytree position for '%s' at 0x%08lX, size=0x%04lX\n", +#ifdef IRDB_USE_CLASS_NAME +handle->IRDB_class_name, +#else +"anon", +#endif /* !IRDB_USE_CLASS_NAME */ +pos, size); +#endif /* DEBUG2 */ + break; + } + +DONE: + return pos; +} diff --git a/lib/ds/irdb/irdb0003.o b/lib/ds/irdb/irdb0003.o new file mode 100644 index 0000000000000000000000000000000000000000..734c2135f621c469dfb45d52d93b5be206d59107 Binary files /dev/null and b/lib/ds/irdb/irdb0003.o differ diff --git a/lib/ds/irdb/irdb0004.c b/lib/ds/irdb/irdb0004.c new file mode 100644 index 0000000000000000000000000000000000000000..4c2149efca4f67eb04ee225a643295273d195546 --- /dev/null +++ b/lib/ds/irdb/irdb0004.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/irdb/irdb0004.c + * + * irrelational database + * + * written: 1996-04-05 + * latest update: 1996-08-08 17:35:24 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dpp.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_dump_string ( +FILE *fo, +char *s) +{ + long rc= 0; + + if (s != (char *) 0) rc= (long) fputs (s, fo); + fputc (0x00, fo); + rc++; + + return rc; +} diff --git a/lib/ds/irdb/irdb0004.o b/lib/ds/irdb/irdb0004.o new file mode 100644 index 0000000000000000000000000000000000000000..937715be8744555152b34528b473c7548fd6bb5f Binary files /dev/null and b/lib/ds/irdb/irdb0004.o differ diff --git a/lib/ds/irdb/irdb0005.c b/lib/ds/irdb/irdb0005.c new file mode 100644 index 0000000000000000000000000000000000000000..197e7f076c50c340ee1da4f99e8a3a49e5058891 --- /dev/null +++ b/lib/ds/irdb/irdb0005.c @@ -0,0 +1,90 @@ +/* + * FILE %ds/irdb/irdb0005.c + * + * irrelational database + * + * written: 1996-04-05 + * latest update: 1996-04-14 15:09:24 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int irdb_dump_struct ( +struct YTREE *yt, +char *str, +void *cd) +{ + int rc= 0; + struct IRDB_DUMP *dmp; + long pos; + FILE *fo; + + if (yt == (struct YTREE *) 0 + || (dmp= (struct IRDB_DUMP *) cd) == (struct IRDB_DUMP *) 0 + || (fo= dmp->fo) == (FILE *) 0 + ) + return -1; + + if (!(yt->YT_flags & YTflag_EOW)) return 0; + +#ifdef DEBUG2 +printf ("irdb0005: str='%s', type=%s\n", str, irdb_type (dmp->type)); +#endif /* DEBUG2 */ +#ifdef MSDOS + str; +#endif /* MSDOS */ + + switch ((int) dmp->type) + { + case IRDBty_int: + /* this case should't show up here anyway because */ + /* it's dumped together with the YTREE */ + break; + + case IRDBty_string: + pos= irdb_dump_string (fo, (char *) yt->YT_info); + free_or_what ((void *) yt->YT_info); + yt->YT_info= pos; + break; + + case IRDBty_float: + case IRDBty_block: + case IRDBty_array: + fprintf (stderr, "irdb0005: T2D!\n"); + break; + + case IRDBty_struct: + { + struct IRDB_HANDLE *hnd; + + if ((hnd= (struct IRDB_HANDLE *) yt->YT_info) + != (struct IRDB_HANDLE *) 0) + { +#ifdef DEBUG2 +printf ("irdb0005: dump struct\n"); +#endif /* DEBUG2 */ + pos= irdb_dump_to_stream (fo, hnd); + +#ifdef IRDB_USE_CLASS_NAME + free_or_what (hnd->IRDB_class_name); +#endif /* IRDB_USE_CLASS_NAME */ + + free (hnd); + yt->YT_info= pos; + } + } + break; + } + + return rc; +} diff --git a/lib/ds/irdb/irdb0005.o b/lib/ds/irdb/irdb0005.o new file mode 100644 index 0000000000000000000000000000000000000000..d6247a4bf25bdafe9ca1978cde2ff9928e032d2e Binary files /dev/null and b/lib/ds/irdb/irdb0005.o differ diff --git a/lib/ds/irdb/irdb0006.c b/lib/ds/irdb/irdb0006.c new file mode 100644 index 0000000000000000000000000000000000000000..efcbbf1eb4a6fc29a2847e9e137a172e19aa650c --- /dev/null +++ b/lib/ds/irdb/irdb0006.c @@ -0,0 +1,48 @@ +/* + * FILE %ds/irdb/irdb0006.c + * + * irrelational database + * - commit changes to disk file + * + * written: 1996-04-27 + * latest update: 1996-04-28 12:11:39 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dpp.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_commit (struct IRDB_POS *pos) +{ + struct IRDB_HANDLE *handle; + FILE *fo; + + if (pos == (struct IRDB_POS *) 0 + || (handle= pos->IRDB_handle) == (struct IRDB_HANDLE *) 0 + ) return -1L; + + irdb_get_pos_file_pointer (pos, IRDBom_closed); + + if (pos->IRDB_is_new) + { + irdb_dump_to_file (pos->IRDB_file_name, handle); + pos->IRDB_is_new= 0; /* the POS is not new anymore now ... */ + } + else + { + if ((fo= fopen (pos->IRDB_file_name, "ab")) == (FILE *) 0) + return -1L; + + irdb_dump_payload (fo, handle); + fclose (fo); + irdb_fixup_pos_header (pos->IRDB_file_name, handle); + } + + return 0L; +} diff --git a/lib/ds/irdb/irdb0006.o b/lib/ds/irdb/irdb0006.o new file mode 100644 index 0000000000000000000000000000000000000000..9b5679845014b607adbb7e4cbf59c9c4408a3cf1 Binary files /dev/null and b/lib/ds/irdb/irdb0006.o differ diff --git a/lib/ds/irdb/irdb0007.c b/lib/ds/irdb/irdb0007.c new file mode 100644 index 0000000000000000000000000000000000000000..5193e919c4033731b94e588e72b5bebd290cf197 --- /dev/null +++ b/lib/ds/irdb/irdb0007.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/irdb/irdb0007.c + * + * irrelational database + * + * written: 1996-04-14 + * latest update: 1996-04-14 19:55:02 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_dumped_form (long type) +{ + switch ((int) type) + { + case IRDBty_string: return IRDBty_string_dumped; + case IRDBty_block: return IRDBty_block_dumped; + case IRDBty_array: return IRDBty_array_dumped; + case IRDBty_struct: return IRDBty_struct_dumped; + } + + return type; +} diff --git a/lib/ds/irdb/irdb0007.o b/lib/ds/irdb/irdb0007.o new file mode 100644 index 0000000000000000000000000000000000000000..37917d102e6ae691882b450a698eeac3dcc5ee00 Binary files /dev/null and b/lib/ds/irdb/irdb0007.o differ diff --git a/lib/ds/irdb/irdb0008.c b/lib/ds/irdb/irdb0008.c new file mode 100644 index 0000000000000000000000000000000000000000..0325536e675e97bb9ddb5d9042ba34794ba28861 --- /dev/null +++ b/lib/ds/irdb/irdb0008.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/irdb/irdb0008.c + * + * irrelational database + * + * written: 1996-04-14 + * latest update: 1996-04-14 19:55:02 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_core_form (long type) +{ + switch ((int) type) + { + case IRDBty_string_dumped: return IRDBty_string; + case IRDBty_block_dumped: return IRDBty_block; + case IRDBty_array_dumped: return IRDBty_array; + case IRDBty_struct_dumped: return IRDBty_struct; + } + + return type; +} diff --git a/lib/ds/irdb/irdb0008.o b/lib/ds/irdb/irdb0008.o new file mode 100644 index 0000000000000000000000000000000000000000..3fbfdfbdbda47a896d02765e25d347dd07834f03 Binary files /dev/null and b/lib/ds/irdb/irdb0008.o differ diff --git a/lib/ds/irdb/irdb0009.c b/lib/ds/irdb/irdb0009.c new file mode 100644 index 0000000000000000000000000000000000000000..91bb476610d69b0fa711417d9334aa8ec5218839 --- /dev/null +++ b/lib/ds/irdb/irdb0009.c @@ -0,0 +1,58 @@ +/* + * FILE %ds/irdb/irdb0009.c + * + * irrelational database + * + * written: 1996-04-27 + * latest update: 1996-04-28 12:16:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +struct IRDB_POS *irdb_new_pos (char *fnm, char *cln, int is_new) +{ + struct IRDB_HANDLE *handle; + struct IRDB_POS *pos; + FILE *f; + + if ((pos= calloc (sizeof (struct IRDB_POS), 1)) == (struct IRDB_POS *) 0) + { + return (struct IRDB_POS *) 0; + } + + if (is_new) + { + if ((f= fopen (fnm, "wb")) == (FILE *) 0) + { +ERROR: + free (pos); + return (struct IRDB_POS *) 0; + } + + if ((handle= irdb_new_struct_handle (cln, (long) IRDBty_struct)) + == (struct IRDB_HANDLE *) 0) + goto ERROR; + } + else + { + if ((f= fopen (fnm, "wb")) == (FILE *) 0) goto ERROR; + handle= irdb_load_handle (f); + } + fclose (f); + + pos->IRDB_handle= handle; + pos->IRDB_file_name= strdup (fnm); + pos->IRDB_open_mode= IRDBom_closed; + pos->IRDB_is_new= is_new; + + return pos; +} diff --git a/lib/ds/irdb/irdb0009.o b/lib/ds/irdb/irdb0009.o new file mode 100644 index 0000000000000000000000000000000000000000..27a0446c943c33dd55b07c54ebe936cefb4d1388 Binary files /dev/null and b/lib/ds/irdb/irdb0009.o differ diff --git a/lib/ds/irdb/irdb0010.c b/lib/ds/irdb/irdb0010.c new file mode 100644 index 0000000000000000000000000000000000000000..736079a412061acb173ded37a1cd7214d2e385f3 --- /dev/null +++ b/lib/ds/irdb/irdb0010.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/irdb/irdb0010.c + * + * irrelational database + * + * written: 1996-04-05 + * latest update: 1996-04-27 14:12:10 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +struct IRDB_HANDLE *irdb_new_handle (long ty, char *cln) +{ + struct IRDB_HANDLE *handle; + + if ((handle= calloc (sizeof (struct IRDB_HANDLE), 1)) + != (struct IRDB_HANDLE *) 0) + { + handle->IRDB_type= ty; +#ifdef IRDB_USE_CLASS_NAME + if (cln != (char *) 0 && *cln != 0) + handle->IRDB_class_name= strdup (cln); +#else +#ifdef MSDOS + cln; +#endif /* MSDOS */ +#endif /* !IRDB_USE_CLASS_NAME */ + } + + return handle; +} diff --git a/lib/ds/irdb/irdb0010.o b/lib/ds/irdb/irdb0010.o new file mode 100644 index 0000000000000000000000000000000000000000..a7fc9b1b4dbf153e39141fc5d353a71ffecc81fc Binary files /dev/null and b/lib/ds/irdb/irdb0010.o differ diff --git a/lib/ds/irdb/irdb0011.c b/lib/ds/irdb/irdb0011.c new file mode 100644 index 0000000000000000000000000000000000000000..5df43f6e3acb916f4220f89e741c15eea0a016c2 --- /dev/null +++ b/lib/ds/irdb/irdb0011.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/irdb/irdb0011.c + * + * irrelational database + * + * written: 1996-04-06 + * latest update: 1996-04-06 8:27:12 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +struct IRDB_HANDLE *irdb_new_struct_handle (char *cln, long payload_type) +{ + struct IRDB_HANDLE *handle; + + if ((handle= irdb_new_handle ((long) IRDBty_struct, cln)) + != (struct IRDB_HANDLE *) 0) + { + handle->IRDB_payload_type= payload_type; + } + + return handle; +} diff --git a/lib/ds/irdb/irdb0011.o b/lib/ds/irdb/irdb0011.o new file mode 100644 index 0000000000000000000000000000000000000000..32dcf0a20ea76ca79ca6e72fb55941ec7f623362 Binary files /dev/null and b/lib/ds/irdb/irdb0011.o differ diff --git a/lib/ds/irdb/irdb0012.c b/lib/ds/irdb/irdb0012.c new file mode 100644 index 0000000000000000000000000000000000000000..b3181e8f82f4cd786a5de0312ca41e5f964cad4a --- /dev/null +++ b/lib/ds/irdb/irdb0012.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/irdb/irdb0012.c + * + * irrelational database + * + * written: 1996-04-06 + * latest update: 1996-04-14 20:28:28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/ytree.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int irdb_store_to_struct ( +struct IRDB_HANDLE *hnd, +char *slot, +long value) +{ + int rc= 0; + + if (hnd == (struct IRDB_HANDLE *) 0 + || hnd->IRDB_type != IRDBty_struct + ) + return -1; + + ytree_set_value ((struct YTREE **) &hnd->IRDB_payload, + (unsigned char *) slot, + value); + + return rc; +} diff --git a/lib/ds/irdb/irdb0012.o b/lib/ds/irdb/irdb0012.o new file mode 100644 index 0000000000000000000000000000000000000000..36f428a4808ea7bce0b179fea29e6bb48b0f45cc Binary files /dev/null and b/lib/ds/irdb/irdb0012.o differ diff --git a/lib/ds/irdb/irdb0013.c b/lib/ds/irdb/irdb0013.c new file mode 100644 index 0000000000000000000000000000000000000000..d93c4cff81704c1480666a3dc89ae8884b91759d --- /dev/null +++ b/lib/ds/irdb/irdb0013.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/irdb/irdb0013.c + * + * irrelational database + * + * written: 1996-04-06 + * latest update: 1996-04-14 20:29:20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int irdb_strdup_to_struct ( +struct IRDB_HANDLE *hnd, +char *slot, +char *value) +{ + int rc= 0; + struct YTREE *yt; + + if (hnd == (struct IRDB_HANDLE *) 0 + || hnd->IRDB_type != IRDBty_struct + || (yt= ytree_insert_word ((struct YTREE **) &hnd->IRDB_payload, + (unsigned char *) slot)) + == (struct YTREE *) 0 + ) + return -1; + + if (yt->YT_flags & YTflag_EOW) free_or_what ((char *) yt->YT_info); + + yt->YT_flags |= YTflag_EOW; + yt->YT_info= (long) strdup (value); + + return rc; +} diff --git a/lib/ds/irdb/irdb0013.o b/lib/ds/irdb/irdb0013.o new file mode 100644 index 0000000000000000000000000000000000000000..d2a6046b9923582d3e30efe5aa234062795949d1 Binary files /dev/null and b/lib/ds/irdb/irdb0013.o differ diff --git a/lib/ds/irdb/irdb0014.c b/lib/ds/irdb/irdb0014.c new file mode 100644 index 0000000000000000000000000000000000000000..b10d8a52948ee563aea343c80ed096de1aef2804 --- /dev/null +++ b/lib/ds/irdb/irdb0014.c @@ -0,0 +1,155 @@ +/* + * FILE %ds/irdb/irdb0014.c + * + * irrelational database + * + * written: 1996-04-06 + * latest update: 1996-05-05 11:17:20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/irdb.h> + +#ifdef DEBUG0 +#define DEBUG2 +#endif + +/* ------------------------------------------------------------------------ */ +long *irdb_locate_info ( +struct IRDB_POS *pos, +char *slots[], +int slot_cnt, +int create, +long ty) /* type of last dimenstion, if created */ +{ + struct YTREE *yt= (struct YTREE *) 0; + struct IRDB_HANDLE *hnd; + char *slot; + + if (pos == (struct IRDB_POS *) 0 + || slot_cnt <= 0 + ) return (long *) 0; + + hnd= pos->IRDB_handle; + + while (slot_cnt > 0) + { + slot= *slots++; + slot_cnt--; + + if (hnd == (struct IRDB_HANDLE *) 0) + return (long *) 0; + + if (hnd->IRDB_type == IRDBty_struct_dumped) + { + int rc; + + rc= irdb_restore (pos, hnd); +printf ("irdb0014: restore, rc=%d\n", rc); + } + + if (hnd->IRDB_type != IRDBty_struct) + return (long *) 0; + + if (create) + { +#ifdef DEBUG2 +printf ("irdb0014: check slot_cnt=%d slot='%s' ", slot_cnt, slot); +#endif /* DEBUG2 */ + if ((yt= ytree_insert_word ((struct YTREE **) &hnd->IRDB_payload, + (unsigned char *) slot)) + == (struct YTREE *) 0) + return (long *) 0; + + if (!(yt->YT_flags & YTflag_EOW)) + { /* create new substructure, since it doesn't already exist */ +#ifdef DEBUG2 +fputs ("created", stdout); +#endif /* DEBUG2 */ + yt->YT_flags |= YTflag_EOW; + + if (slot_cnt > 1) + yt->YT_info= (long) irdb_new_struct_handle ((char *) 0, + (long) IRDBty_struct); + + if (slot_cnt == 1) + { + yt->YT_info= (long) irdb_new_struct_handle ((char *) 0, ty); +#ifdef DEBUG2 +printf (" **pl_ty=%s**", irdb_type (ty)); +#endif /* DEBUG2 */ + } + +#ifdef DEBUG2 + if (slot_cnt == 0) + fputs (" ***final element***", stdout); +#endif /* DEBUG2 */ + } +#ifdef DEBUG2 +fputc ('\n', stdout); +#endif /* DEBUG2 */ + } + else + { +#ifdef DEBUG2 +printf ("irdb0014: get slot_cnt=%d slot='%s'\n", slot_cnt, slot); +#endif /* DEBUG2 */ + yt= ytree_lookup_word ((struct YTREE *) hnd->IRDB_payload, + (unsigned char *) slot); + } + + if (yt == (struct YTREE *) 0 || !(yt->YT_flags & YTflag_EOW)) + return (long *) 0; + + if (slot_cnt == 0) + { + if (hnd->IRDB_payload_type == IRDBty_string_dumped) + { + int rc; + + rc= irdb_restore (pos, hnd); +printf ("irdb0014: restore payload, ty=%s rc=%d\n", +irdb_type (hnd->IRDB_payload_type), rc); + } + + if (hnd->IRDB_payload_type != ty) + { +#ifdef DEBUG0 +printf ("*** type mismatch, IRDB_payload_type=%s ty=%s\n", +irdb_type (hnd->IRDB_payload_type), irdb_type (ty)); +#endif /* DEBUG2 */ + return (long *) 0; + } + break; + } + + /* descend the structure, if it's indeed a structure */ + if (hnd->IRDB_payload_type == IRDBty_struct_dumped) + { + int rc; + + rc= irdb_restore (pos, hnd); +printf ("irdb0014: restore payload, rc=%d\n", rc); + } + + if (hnd->IRDB_payload_type != IRDBty_struct) + { +#ifdef DEBUG0 +printf ("*** not a structure, IRDB_payload_type=%s ty=%s\n", +irdb_type (hnd->IRDB_payload_type), irdb_type (ty)); +#endif /* DEBUG2 */ + return (long *) 0; + } + hnd= (struct IRDB_HANDLE *) yt->YT_info; + } + + return &yt->YT_info; +} diff --git a/lib/ds/irdb/irdb0014.o b/lib/ds/irdb/irdb0014.o new file mode 100644 index 0000000000000000000000000000000000000000..e84b3b2b765c2d568b944495553b3df35fdc8536 Binary files /dev/null and b/lib/ds/irdb/irdb0014.o differ diff --git a/lib/ds/irdb/irdb0015.c b/lib/ds/irdb/irdb0015.c new file mode 100644 index 0000000000000000000000000000000000000000..fddf282fa00354a74da901b1b62c7a011efeb89f --- /dev/null +++ b/lib/ds/irdb/irdb0015.c @@ -0,0 +1,28 @@ +/* + * FILE 1996-04-06 + * + * irrelational database + * + * written: 1996-04-06 + * latest update: 1996-04-26 22:41:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int irdb_exists ( +struct IRDB_POS *pos, +char *slots[], +int slot_cnt) +{ + long *loc; + + loc= irdb_locate_info (pos, slots, slot_cnt, 0, 0L); + + return (loc == (long *) 0) ? 0 : 1; +} diff --git a/lib/ds/irdb/irdb0015.o b/lib/ds/irdb/irdb0015.o new file mode 100644 index 0000000000000000000000000000000000000000..04e4dcd93f983af3ea7a5b629dfd05516f0b9a8d Binary files /dev/null and b/lib/ds/irdb/irdb0015.o differ diff --git a/lib/ds/irdb/irdb0016.c b/lib/ds/irdb/irdb0016.c new file mode 100644 index 0000000000000000000000000000000000000000..d96f12dc7c496326d9005a7ec5bc9e10264e5248 --- /dev/null +++ b/lib/ds/irdb/irdb0016.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/irdb/irdb0016.c + * + * irrelational database + * + * written: 1996-04-06 + * latest update: 1996-08-08 17:35:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdio.h> +#include <gg/strings.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int irdb_replace_string ( +struct IRDB_POS *pos, +char *slots[], +int slot_cnt, +char *value) +{ + int rc= 0; + long *info; + char *str; + + if ((info= irdb_locate_info (pos, slots, slot_cnt, 1, (long) IRDBty_string)) + == (long *) 0 + ) + return -1; + + str= (char *) *info; + free_or_what (str); + + str= strdup (value); + *info= (long) str; + + return rc; +} diff --git a/lib/ds/irdb/irdb0016.o b/lib/ds/irdb/irdb0016.o new file mode 100644 index 0000000000000000000000000000000000000000..c345f9bd4374b642f0963cfad566a1b8164934d2 Binary files /dev/null and b/lib/ds/irdb/irdb0016.o differ diff --git a/lib/ds/irdb/irdb0017.c b/lib/ds/irdb/irdb0017.c new file mode 100644 index 0000000000000000000000000000000000000000..5d7449c2a3611db3cc850c1e5c579856f72f2b10 --- /dev/null +++ b/lib/ds/irdb/irdb0017.c @@ -0,0 +1,50 @@ +/* + * FILE %ds/irdb/irdb0017.c + * + * irrelational database + * same as irdb_locate_info () except that the name of the last + * dimension is always a structure which is created, if necessary. + * + * written: 1996-04-08 + * latest update: 1996-04-26 22:42:24 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +struct IRDB_HANDLE *irdb_locate_handle ( +struct IRDB_POS *pos, +char *slots[], +int slot_cnt, +int create, +long ty) +{ + long *addr; + struct IRDB_HANDLE *rv= (struct IRDB_HANDLE *) 0; + + if ((addr= irdb_locate_info (pos, slots, slot_cnt, create, + (long) IRDBty_struct)) + != (long *) 0 + ) + { + if ((rv= (struct IRDB_HANDLE *) *addr) == (struct IRDB_HANDLE *) 0 + && create + ) + { +printf ("[creating handle for %s, type=%ld]\n", slots [slot_cnt-1], ty); + rv= irdb_new_struct_handle ((char *) 0, ty); + *addr= (long) rv; + } + } + + return rv; +} diff --git a/lib/ds/irdb/irdb0017.o b/lib/ds/irdb/irdb0017.o new file mode 100644 index 0000000000000000000000000000000000000000..44a1293dfc9faa793d69232d79f5a63e84d30b3f Binary files /dev/null and b/lib/ds/irdb/irdb0017.o differ diff --git a/lib/ds/irdb/irdb0018.c b/lib/ds/irdb/irdb0018.c new file mode 100644 index 0000000000000000000000000000000000000000..a8f325545fd523466423a3fbf0e3896416e91939 --- /dev/null +++ b/lib/ds/irdb/irdb0018.c @@ -0,0 +1,44 @@ +/* + * FILE %ds/irdb/irdb0018.c + * + * irrelational database + * + * written: 1996-04-08 + * latest update: 1996-04-26 22:43:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/irdb.h> + +#ifdef DEBUG2 +#include <stdio.h> +#endif /* DEBUG2 */ + +/* ------------------------------------------------------------------------ */ +long irdb_set_long ( +struct IRDB_POS *pos, +char *slots[], +int slot_cnt, +long value) +{ + long rc= 0; + long *info; + + if ((info= irdb_locate_info (pos, slots, slot_cnt, 1, (long) IRDBty_int)) + == (long *) 0 + ) + return 0L; + +#ifdef DEBUG2 +printf ("irdb0018: setting value\n"); +#endif /* DEBUG2 */ + + rc= *info; + *info= value; + + return rc; +} diff --git a/lib/ds/irdb/irdb0018.o b/lib/ds/irdb/irdb0018.o new file mode 100644 index 0000000000000000000000000000000000000000..dc1c1229219ce63dc20432f2215f801afddb58d3 Binary files /dev/null and b/lib/ds/irdb/irdb0018.o differ diff --git a/lib/ds/irdb/irdb0019.c b/lib/ds/irdb/irdb0019.c new file mode 100644 index 0000000000000000000000000000000000000000..2dd47fcc148738bb7af31e92c6ae06469599ce18 --- /dev/null +++ b/lib/ds/irdb/irdb0019.c @@ -0,0 +1,44 @@ +/* + * FILE %ds/irdb/irdb0019.c + * + * irrelational database + * + * written: 1996-04-08 + * latest update: 1996-04-26 22:43:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/irdb.h> + +#ifdef DEBUG2 +#include <stdio.h> +#endif /* DEBUG2 */ + +/* ------------------------------------------------------------------------ */ +long irdb_post_increment_long ( +struct IRDB_POS *pos, +char *slots[], +int slot_cnt, +long value) +{ + long rc= 0; + long *info; + + if ((info= irdb_locate_info (pos, slots, slot_cnt, 1, (long) IRDBty_int)) + == (long *) 0 + ) + return 0L; + +#ifdef DEBUG2 +printf ("irdb0019: setting value\n"); +#endif /* DEBUG2 */ + + rc= *info; + *info += value; + + return rc; +} diff --git a/lib/ds/irdb/irdb0019.o b/lib/ds/irdb/irdb0019.o new file mode 100644 index 0000000000000000000000000000000000000000..f596f1ad89e3466c652e9258514a32aa0af79c9b Binary files /dev/null and b/lib/ds/irdb/irdb0019.o differ diff --git a/lib/ds/irdb/irdb0020.c b/lib/ds/irdb/irdb0020.c new file mode 100644 index 0000000000000000000000000000000000000000..a0b0e49e23d584091e28448bfca9346bb559f1ce --- /dev/null +++ b/lib/ds/irdb/irdb0020.c @@ -0,0 +1,42 @@ +/* + * FILE %ds/irdb/irdb0020.c + * + * irrelational database + * + * written: 1996-04-08 + * latest update: 1996-04-26 22:43:14 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/irdb.h> + +#ifdef DEBUG2 +#include <stdio.h> +#endif /* DEBUG2 */ + +/* ------------------------------------------------------------------------ */ +long irdb_pre_increment_long ( +struct IRDB_POS *pos, +char *slots[], +int slot_cnt, +long value) +{ + long *info; + + if ((info= irdb_locate_info (pos, slots, slot_cnt, 1, (long) IRDBty_int)) + == (long *) 0 + ) + return 0L; + +#ifdef DEBUG2 +printf ("irdb0020: >>> setting value\n"); +#endif /* DEBUG2 */ + + *info += value; + + return *info; +} diff --git a/lib/ds/irdb/irdb0020.o b/lib/ds/irdb/irdb0020.o new file mode 100644 index 0000000000000000000000000000000000000000..12496557b8f0f75746b62205946662e9c3be462a Binary files /dev/null and b/lib/ds/irdb/irdb0020.o differ diff --git a/lib/ds/irdb/irdb0021.c b/lib/ds/irdb/irdb0021.c new file mode 100644 index 0000000000000000000000000000000000000000..236768c92b67232578666b0833132763d14cdf35 --- /dev/null +++ b/lib/ds/irdb/irdb0021.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/irdb/irdb0001.c + * + * irrelational database + * + * written: 1996-04-05 + * latest update: 1996-04-05 11:23:48 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dpp.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_fixup_pos_header ( +char *filename, +struct IRDB_HANDLE *handle) +{ + FILE *fo; + + /* fixup header information */ + if ((fo= fopen (filename, "r+b")) == (FILE *) 0) return -1L; +printf ("fixing header: size=0x%08lX position=0x%08lX\n", +handle->IRDB_payload_size, handle->IRDB_payload); + + dpp_fwrite_long (fo, handle->IRDB_type, 4); + dpp_fwrite_long (fo, handle->IRDB_payload_size, 4); + dpp_fwrite_long (fo, handle->IRDB_payload, 4); + dpp_fwrite_long (fo, handle->IRDB_payload_type, 4); + fclose (fo); + + return 0L; +} diff --git a/lib/ds/irdb/irdb0021.o b/lib/ds/irdb/irdb0021.o new file mode 100644 index 0000000000000000000000000000000000000000..f8034c254e011b91b73f4c7829adaa8033bfa34e Binary files /dev/null and b/lib/ds/irdb/irdb0021.o differ diff --git a/lib/ds/irdb/irdb0022.c b/lib/ds/irdb/irdb0022.c new file mode 100644 index 0000000000000000000000000000000000000000..b0f930bb9bf191f12a96a64d433585d3068cbdc7 --- /dev/null +++ b/lib/ds/irdb/irdb0022.c @@ -0,0 +1,47 @@ +/* + * FILE %ds/irdb/irdb0022.c + * + * irrelational database + * - load an irdb handle from the file at current position + * + * written: 1996-04-27 + * latest update: 1996-05-05 12:01:00 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <gg/dpp.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +struct IRDB_HANDLE *irdb_load_handle (FILE *fi) +{ + struct IRDB_HANDLE *hnd= (struct IRDB_HANDLE *) 0; +#ifdef IRDB_USE_CLASS_NAME +#define BSIZ 128 + char buffer [BSIZ]; +#endif /* IRDB_USE_CLASS_NAME */ + + if (fi != (FILE *) 0 + && (hnd= calloc (sizeof (struct IRDB_HANDLE), 1)) + != (struct IRDB_HANDLE *) 0 + ) + { +printf ("irdb0022: restoring handle\n"); + hnd->IRDB_type= dpp_fread_long (fi, 4); + hnd->IRDB_payload_size= dpp_fread_long (fi, 4); + hnd->IRDB_payload= dpp_fread_long (fi, 4); + hnd->IRDB_payload_type= dpp_fread_long (fi, 4); + +#ifdef IRDB_USE_CLASS_NAME + hnd->IRDB_class_name= irdb_load_string (fi, buffer, BSIZ); +#endif /* IRDB_USE_CLASS_NAME */ + } + + return hnd; +} diff --git a/lib/ds/irdb/irdb0022.o b/lib/ds/irdb/irdb0022.o new file mode 100644 index 0000000000000000000000000000000000000000..982da7ff6d9e66f99269287050f8078e9bf109af Binary files /dev/null and b/lib/ds/irdb/irdb0022.o differ diff --git a/lib/ds/irdb/irdb0023.c b/lib/ds/irdb/irdb0023.c new file mode 100644 index 0000000000000000000000000000000000000000..32164dadf2cc89bb552ec5501a7fa9f85f871cd7 --- /dev/null +++ b/lib/ds/irdb/irdb0023.c @@ -0,0 +1,51 @@ +/* + * FILE %ds/irdb/irdb0023.c + * + * irrelational database + * - load an irdb handle from the file at current position + * + * written: 1996-04-27 + * latest update: 1996-04-27 13:47:51 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +char *irdb_load_string (FILE *fi, char *buffer, int bsize) +{ + int buffer_allocated= 0; + int ch; + int bpos= 0; + char *rv; + + if (fi == (FILE *) 0) return (char *) 0; + + if (buffer == (char *) 0) + { + if (bsize <= 0) bsize= 128; + if ((buffer= malloc (bsize)) == (char *) 0) return (char *) 0; + buffer_allocated= 1; + } + + while (bsize > 1) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi) || ch == 0) break; + buffer [bpos++]= (char) ch; + } + buffer [bpos]= 0; + + rv= strdup (buffer); + if (buffer_allocated) free_or_what (buffer); + return rv; +} diff --git a/lib/ds/irdb/irdb0023.o b/lib/ds/irdb/irdb0023.o new file mode 100644 index 0000000000000000000000000000000000000000..13323346f7119b63ade8b78d32d5471f4db7f254 Binary files /dev/null and b/lib/ds/irdb/irdb0023.o differ diff --git a/lib/ds/irdb/irdb0024.c b/lib/ds/irdb/irdb0024.c new file mode 100644 index 0000000000000000000000000000000000000000..dfa33a1ebab8f900090b9df83e57486cac270cf8 --- /dev/null +++ b/lib/ds/irdb/irdb0024.c @@ -0,0 +1,61 @@ +/* + * FILE %ds/irdb/irdb0024.c + * + * irrelational database + * + * written: 1996-04-28 + * latest update: 1996-04-28 12:01:51 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +FILE *irdb_get_pos_file_pointer ( +struct IRDB_POS *pos, +int open_mode) +{ + FILE *fp= (FILE *) 0; + int current_mode; + + if (pos != (struct IRDB_POS *) 0) + { + if ((current_mode= pos->IRDB_open_mode) == open_mode) + return pos->IRDB_file; + + if (current_mode == IRDBom_read + || current_mode == IRDBom_write + || current_mode == IRDBom_overwrite + ) + fclose (pos->IRDB_file); + + pos->IRDB_file= (FILE *) 0; + pos->IRDB_open_mode= IRDBom_closed; + + switch (open_mode) + { + case IRDBom_read: + fp= fopen (pos->IRDB_file_name, "rb"); + break; + case IRDBom_write: + fp= fopen (pos->IRDB_file_name, "wb"); + break; + case IRDBom_overwrite: + fp= fopen (pos->IRDB_file_name, "r+b"); + break; + } + + if (fp != (FILE *) 0) + { + pos->IRDB_file= fp; + pos->IRDB_open_mode= open_mode; + } + } + + return fp; +} diff --git a/lib/ds/irdb/irdb0024.o b/lib/ds/irdb/irdb0024.o new file mode 100644 index 0000000000000000000000000000000000000000..105ca92e2f966cf5c99390468f9360b164258690 Binary files /dev/null and b/lib/ds/irdb/irdb0024.o differ diff --git a/lib/ds/irdb/irdb0025.c b/lib/ds/irdb/irdb0025.c new file mode 100644 index 0000000000000000000000000000000000000000..02c379155536562d53da086bd3c6ae6506c55cd1 --- /dev/null +++ b/lib/ds/irdb/irdb0025.c @@ -0,0 +1,85 @@ +/* + * FILE %ds/irdb/irdb0025.c + * + * irrelational database + * + * written: 1996-04-28 + * latest update: 1996-05-06 0:28:50 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int irdb_restore ( +struct IRDB_POS *pos, +struct IRDB_HANDLE *hnd) +{ + FILE *fi; + long KBI [1]; + char *KBS [1]; + struct YTREE *yt= (struct YTREE *) 0; + int rc; + long pp; + char *cp; + + if ((fi= irdb_get_pos_file_pointer (pos, IRDBom_read)) == (FILE *) 0 + || (pp= hnd->IRDB_payload) == 0L + ) + return -1; + + fseek (fi, pp, 0); + switch ((int) hnd->IRDB_type) + { + case IRDBty_struct_dumped: +printf ("irdb0025: restoring dumped struct: pp=0x%08lX\n", pp); + + rc= ytree_full_scan (fi, &yt, KBI, 0, KBS, 0); + if (rc == 0 && yt != (struct YTREE *) 0) + { + hnd->IRDB_payload= (long) yt; + hnd->IRDB_type= (long) IRDBty_struct; +/* T2D: ev. an dieser Stelle die Payload zurueckladen??? */ + } + break; + + case IRDBty_struct: + yt= (struct YTREE *) hnd->IRDB_payload; + + switch ((int) hnd->IRDB_payload_type) + { + case IRDBty_string_dumped: + ytree_process (yt, irdb_restore_strings, (void *) fi); + hnd->IRDB_payload_type= IRDBty_string; + break; + + case IRDBty_struct_dumped: + ytree_process (yt, irdb_restore_handle, (void *) fi); + hnd->IRDB_payload_type= IRDBty_struct; + break; + } + break; + + case IRDBty_string_dumped: +printf ("irdb0025: restoring dumped string: pp=0x%08lX\n", pp); + if ((cp= irdb_load_string (fi, (char *) 0, 0)) != (char *) 0) + { + hnd->IRDB_payload= (long) cp; + hnd->IRDB_type= (long) IRDBty_string; + } + break; + + default: + printf ("irdb0025: error, can't restore type %ld, (%s)\n", + hnd->IRDB_type, irdb_type (hnd->IRDB_type)); + return -1; + } + + return 0; +} diff --git a/lib/ds/irdb/irdb0025.o b/lib/ds/irdb/irdb0025.o new file mode 100644 index 0000000000000000000000000000000000000000..ef1667cff5a5101c61a84363fa0592cf03436d63 Binary files /dev/null and b/lib/ds/irdb/irdb0025.o differ diff --git a/lib/ds/irdb/irdb0026.c b/lib/ds/irdb/irdb0026.c new file mode 100644 index 0000000000000000000000000000000000000000..e23d50826a7a02c0aa28c2dc2ff584b5783eb8b0 --- /dev/null +++ b/lib/ds/irdb/irdb0026.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/irdb/irdb0026.c + * + * irrelational database + * called as a YTREE_PROCESSOR method + * + * written: 1996-05-05 + * latest update: 1996-05-05 12:09:30 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int irdb_restore_handle ( +struct YTREE *yt_node, +void *client_data) +{ + FILE *fi; + struct IRDB_HANDLE *hnd; + + if (yt_node != (struct YTREE *) 0 + && (yt_node->YT_flags & YTflag_EOW) + && (fi= (FILE *) client_data) != (FILE *) 0 + ) + { + fseek (fi, yt_node->YT_info, 0); + hnd= irdb_load_handle (fi); + yt_node->YT_info= (long) hnd; + } + + return 0; +} diff --git a/lib/ds/irdb/irdb0026.o b/lib/ds/irdb/irdb0026.o new file mode 100644 index 0000000000000000000000000000000000000000..c79e57670e9a8fe106fa78606f3d9bad19ab5fef Binary files /dev/null and b/lib/ds/irdb/irdb0026.o differ diff --git a/lib/ds/irdb/irdb0027.c b/lib/ds/irdb/irdb0027.c new file mode 100644 index 0000000000000000000000000000000000000000..333f99f4ddbc26ddc21378088bd0f0f78d337e49 --- /dev/null +++ b/lib/ds/irdb/irdb0027.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/irdb/irdb0027.c + * + * irrelational database + * called as a YTREE_PROCESSOR method + * + * written: 1996-05-06 + * latest update: 1996-05-06 0:25:47 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int irdb_restore_strings ( +struct YTREE *yt_node, +void *client_data) +{ + FILE *fi; + char *str; + + if (yt_node != (struct YTREE *) 0 + && (yt_node->YT_flags & YTflag_EOW) + && (fi= (FILE *) client_data) != (FILE *) 0 + ) + { + fseek (fi, yt_node->YT_info, 0); + str= irdb_load_string (fi, (char *) 0, 0); + yt_node->YT_info= (long) str; + } + + return 0; +} diff --git a/lib/ds/irdb/irdb0027.o b/lib/ds/irdb/irdb0027.o new file mode 100644 index 0000000000000000000000000000000000000000..8751a588942ddad3271240882d93f88782e41899 Binary files /dev/null and b/lib/ds/irdb/irdb0027.o differ diff --git a/lib/ds/irdb/irdb0028.c b/lib/ds/irdb/irdb0028.c new file mode 100644 index 0000000000000000000000000000000000000000..35e8de9e2c9777c84f954df7d1fd4fa1c5e48c62 --- /dev/null +++ b/lib/ds/irdb/irdb0028.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/irdb/irdb0028.c + * + * irrelational database + * + * written: 1996-05-06 + * latest update: 1996-05-06 0:57:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/irdb.h> + +#ifdef DEBUG2 +#include <stdio.h> +#endif /* DEBUG2 */ + +/* ------------------------------------------------------------------------ */ +long irdb_get_increment_long ( +struct IRDB_POS *pos, +char *slots[], +int slot_cnt) +{ + long *info; + + if ((info= irdb_locate_info (pos, slots, slot_cnt, 1, (long) IRDBty_int)) + == (long *) 0 + ) + return 0L; + +#ifdef DEBUG2 +printf ("irdb0019: setting value\n"); +#endif /* DEBUG2 */ + + return *info; +} diff --git a/lib/ds/irdb/irdb0028.o b/lib/ds/irdb/irdb0028.o new file mode 100644 index 0000000000000000000000000000000000000000..6a243acb29be42b33106bf2e0bdbded72fcb83fa Binary files /dev/null and b/lib/ds/irdb/irdb0028.o differ diff --git a/lib/ds/irdb/irdb0101.c b/lib/ds/irdb/irdb0101.c new file mode 100644 index 0000000000000000000000000000000000000000..dd530bb40173c6ceb5ef89c0882b60eb76c0ea82 --- /dev/null +++ b/lib/ds/irdb/irdb0101.c @@ -0,0 +1,49 @@ +/* + * FILE %ds/irdb/irdb0101.c + * + * irrelational database + * + * written: 1996-04-14 + * latest update: 1996-04-28 11:41:30 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_diag ( +FILE *fo, +struct IRDB_HANDLE *handle) +{ + long rc= 0L; + long ty; + + if (fo == (FILE *) 0) return -1L; + if (handle == (struct IRDB_HANDLE *) 0) return 0L; + ty= handle->IRDB_type; + + fputs ("\n*************************************************\n[101] ", fo); +#ifdef IRDB_USE_CLASS_NAME + fputs ("class_name=", fo); + irdb_diag_string (fo, handle->IRDB_class_name); + fputc ('\n', fo); +#endif /* IRDB_USE_CLASS_NAME */ + + fprintf (fo, "type=%s", irdb_type (ty)); + if (ty == (long) IRDBty_struct || ty == (long) IRDBty_array) + fprintf (fo, " of %s", irdb_type (handle->IRDB_payload_type)); + fputc ('\n', fo); + + irdb_diag_payload (fo, handle, 2); + + /* write structure's header */ + fprintf (fo, "pl_size=%ld\n", handle->IRDB_payload_size); + fputs ("*************************************************\n\n", fo); + + return rc; +} diff --git a/lib/ds/irdb/irdb0101.o b/lib/ds/irdb/irdb0101.o new file mode 100644 index 0000000000000000000000000000000000000000..d0ba115d74811e9c470b0cd26ad6fccdf44d5887 Binary files /dev/null and b/lib/ds/irdb/irdb0101.o differ diff --git a/lib/ds/irdb/irdb0102.c b/lib/ds/irdb/irdb0102.c new file mode 100644 index 0000000000000000000000000000000000000000..59d0490005c633d6c369bef0e68c5a5c5d7c8603 --- /dev/null +++ b/lib/ds/irdb/irdb0102.c @@ -0,0 +1,50 @@ +/* + * FILE %ds/irdb/irdb0102.c + * + * irrelational database + * + * written: 1996-04-14 + * latest update: 1996-04-14 17:10:05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_diag_to_stream (FILE *fo, struct IRDB_HANDLE *handle, int indent) +{ + long ty; + + if (fo == (FILE *) 0) return -1L; + if (handle == (struct IRDB_HANDLE *) 0) return 0L; + + ty= handle->IRDB_type; + /* write structure's header, part 1 */ + blanks (fo, indent); + fprintf (fo, "[102] type=%s", irdb_type (ty)); + if (ty == (long) IRDBty_struct || ty == (long) IRDBty_array) + fprintf (fo, " of %s", irdb_type (handle->IRDB_payload_type)); + fputc ('\n', fo); + + /* first dump the payload, then dump the header! */ + irdb_diag_payload (fo, handle, indent+2); + + /* write structure's header; part 2 */ + blanks (fo, indent); + fprintf (fo, "size=%ld\n", handle->IRDB_payload_size); + +#ifdef IRDB_USE_CLASS_NAME + blanks (fo, indent); + fputs ("class_name=", fo); + irdb_diag_string (fo, handle->IRDB_class_name); + fputc ('\n', fo); +#endif /* IRDB_USE_CLASS_NAME */ + + return 0L; +} diff --git a/lib/ds/irdb/irdb0102.o b/lib/ds/irdb/irdb0102.o new file mode 100644 index 0000000000000000000000000000000000000000..ea516e7709234d1c6e3d7b4374291043a4145c11 Binary files /dev/null and b/lib/ds/irdb/irdb0102.o differ diff --git a/lib/ds/irdb/irdb0103.c b/lib/ds/irdb/irdb0103.c new file mode 100644 index 0000000000000000000000000000000000000000..e12ed78ee4075243e9ec7cc75c865bd0daf80850 --- /dev/null +++ b/lib/ds/irdb/irdb0103.c @@ -0,0 +1,95 @@ +/* + * FILE %ds/irdb/irdb0103.c + * + * irrelational database + * + * written: 1996-04-14 + * latest update: 1996-04-27 12:51:00 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_diag_payload ( +FILE *fo, +struct IRDB_HANDLE *handle, +int indent) +{ + long rc= 0L; + long pos= 0L; + long size; + struct YTREE *yt; +#define BUFFER_SIZE 256 + + if (fo == (FILE *) 0) return -1L; + + if (handle == (struct IRDB_HANDLE *) 0) goto DONE; + + blanks (fo, indent); + fprintf (fo, "[103] type=%s", irdb_type (handle->IRDB_type)); + + switch ((int) handle->IRDB_type) + { + case IRDBty_int: + fprintf (fo, " val=0x%08lX\n", handle->IRDB_payload); + handle->IRDB_payload_size= 4; + break; + + case IRDBty_string: + fputs (" val=", fo); + size= irdb_diag_string (fo, (char *) handle->IRDB_payload); + handle->IRDB_payload_size= size; + break; + + case IRDBty_struct: + yt= (struct YTREE *) handle->IRDB_payload; + + fprintf (fo, " of %s\n", irdb_type (handle->IRDB_payload_type)); + + { + char *buffer= (char *) 0; + struct IRDB_DUMP dmp; + + if ((buffer= malloc (BUFFER_SIZE)) == (char *) 0) goto DONE; + dmp.fo= fo; + dmp.type= handle->IRDB_payload_type; + dmp.indent= indent+2; + + ytree_track (yt, + buffer, BUFFER_SIZE, 0, + irdb_diag_struct, (void *) &dmp); + free_or_what (buffer); + } + break; + + case IRDBty_struct_dumped: + fprintf (fo, " of %s", irdb_type (handle->IRDB_payload_type)); + + case IRDBty_string_dumped: + case IRDBty_array_dumped: + case IRDBty_block_dumped: + fprintf (fo, " dumped at 0x%08lX, size=%ld\n", + handle->IRDB_payload, + handle->IRDB_payload_size); + break; + + case IRDBty_float: + case IRDBty_block: + case IRDBty_array: + default: + fputs (" T2D!\n", fo); + break; + } + +DONE: + return pos; +} diff --git a/lib/ds/irdb/irdb0103.o b/lib/ds/irdb/irdb0103.o new file mode 100644 index 0000000000000000000000000000000000000000..0b590384e6e9df0b51e0add71c96929ef1485cdf Binary files /dev/null and b/lib/ds/irdb/irdb0103.o differ diff --git a/lib/ds/irdb/irdb0104.c b/lib/ds/irdb/irdb0104.c new file mode 100644 index 0000000000000000000000000000000000000000..16305cdf8b599adb2b83d6c6875107cc257664fb --- /dev/null +++ b/lib/ds/irdb/irdb0104.c @@ -0,0 +1,33 @@ +/* + * FILE %ds/irdb/irdb0104.c + * + * irrelational database + * + * written: 1996-04-14 + * latest update: 1996-04-14 13:05:58 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/dpp.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_diag_string ( +FILE *fo, +char *s) +{ + long rc= 0; + + fputc ('\'', fo); + if (s != (char *) 0) rc= (long) fputs (s, fo); + fputc ('\'', fo); + rc++; + + return rc; +} diff --git a/lib/ds/irdb/irdb0104.o b/lib/ds/irdb/irdb0104.o new file mode 100644 index 0000000000000000000000000000000000000000..1f99e918e6b25e50e486023af6b98d126fa6be4f Binary files /dev/null and b/lib/ds/irdb/irdb0104.o differ diff --git a/lib/ds/irdb/irdb0105.c b/lib/ds/irdb/irdb0105.c new file mode 100644 index 0000000000000000000000000000000000000000..aa9a41687203956131ff4f3ad783db9021f5e148 --- /dev/null +++ b/lib/ds/irdb/irdb0105.c @@ -0,0 +1,74 @@ +/* + * FILE %ds/irdb/irdb0105.c + * + * irrelational database + * + * written: 1996-04-14 + * latest update: 1996-04-14 13:59:41 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int irdb_diag_struct ( +struct YTREE *yt, +char *str, +void *cd) +{ + int rc= 0; + struct IRDB_DUMP *dmp; + long pos; + FILE *fo; + int indent; + + if (yt == (struct YTREE *) 0 + || (dmp= (struct IRDB_DUMP *) cd) == (struct IRDB_DUMP *) 0 + || (fo= dmp->fo) == (FILE *) 0 + ) + return -1; + + if (!(yt->YT_flags & YTflag_EOW)) return 0; + + indent= dmp->indent; + blanks (fo, indent); + fprintf (fo, "[105] str='%s' := (%s) ", str, irdb_type (dmp->type)); + + switch ((int) dmp->type) + { + case IRDBty_int: + fprintf (fo, "%ld\n", yt->YT_info); + /***** fputs ("this case should't show up here anyway\n", fo); ??? ***/ + break; + + case IRDBty_string: + irdb_diag_string (fo, (char *) yt->YT_info); + fputc ('\n', fo); + break; + + case IRDBty_float: + case IRDBty_block: + case IRDBty_array: + fputs (">>> irdb0105: T2D! <<<\n", fo); + break; + + case IRDBty_struct: + fputc ('\n', fo); + blanks (fo, indent); + fputs ("{\n", fo); + pos= irdb_diag_to_stream (fo, (struct IRDB_HANDLE *) yt->YT_info, + indent+2); + blanks (fo, indent); + fputs ("};\n", fo); + break; + } + + return rc; +} diff --git a/lib/ds/irdb/irdb0105.o b/lib/ds/irdb/irdb0105.o new file mode 100644 index 0000000000000000000000000000000000000000..03ac670a7f51e5677cc698bcf6cddae519249b8c Binary files /dev/null and b/lib/ds/irdb/irdb0105.o differ diff --git a/lib/ds/irdb/irdb0106.c b/lib/ds/irdb/irdb0106.c new file mode 100644 index 0000000000000000000000000000000000000000..17704653d7a3b626d7d682ca9347a5205c770979 --- /dev/null +++ b/lib/ds/irdb/irdb0106.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/irdb/irdb0106.c + * + * irrelational database + * + * written: 1996-04-14 + * latest update: 1996-04-14 19:03:47 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +char *irdb_type (long type) +{ + switch ((int) type) + { + case IRDBty_int: return "int"; + case IRDBty_float: return "float"; + case IRDBty_string: return "string"; + case IRDBty_block: return "block"; + case IRDBty_array: return "array"; + case IRDBty_struct: return "struct"; + case IRDBty_struct_dumped: return "struct_dumped"; + case IRDBty_string_dumped: return "string_dumped"; + case IRDBty_array_dumped: return "array_dumped"; + } + + return "(unknown)"; +} diff --git a/lib/ds/irdb/irdb0106.o b/lib/ds/irdb/irdb0106.o new file mode 100644 index 0000000000000000000000000000000000000000..38a8ed9fff2a83612cd8f701152d239812983791 Binary files /dev/null and b/lib/ds/irdb/irdb0106.o differ diff --git a/lib/ds/irdb/irdb0107.c b/lib/ds/irdb/irdb0107.c new file mode 100644 index 0000000000000000000000000000000000000000..fa658b39507ccf8009101c43a1b7d1091db14efe --- /dev/null +++ b/lib/ds/irdb/irdb0107.c @@ -0,0 +1,36 @@ +/* + * FILE %ds/irdb/irdb0107.c + * + * irrelational database + * + * written: 1996-04-27 + * latest update: 1996-04-27 11:00:16 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_dbg_show_slot_names ( +FILE *fo, +char *slots[], +int slot_cnt) +{ + int i= 0; + + for (; slot_cnt > 1; slot_cnt--) + { + fputs (slots [i++], fo); + fputc ('.', fo); + } + + if (slot_cnt > 0) fputs (slots [i++], fo); + + return 0; +} diff --git a/lib/ds/irdb/irdb0107.o b/lib/ds/irdb/irdb0107.o new file mode 100644 index 0000000000000000000000000000000000000000..6e669d24fc1250c2f81c6e259d2b7e09668af772 Binary files /dev/null and b/lib/ds/irdb/irdb0107.o differ diff --git a/lib/ds/irdb/irdb0112.c b/lib/ds/irdb/irdb0112.c new file mode 100644 index 0000000000000000000000000000000000000000..45a4bc4178e0c9cd2afb0585f192dd5170d1ba03 --- /dev/null +++ b/lib/ds/irdb/irdb0112.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/irdb/irdb0112.c + * + * irrelational database + * + * written: 1996-04-06 + * latest update: 1996-04-06 12:53:45 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int irdb_dbg_store_to_struct ( +struct IRDB_HANDLE *hnd, +char *slot, +long value) +{ + int rc; + + rc= irdb_store_to_struct (hnd, slot, value); + + printf ("store to struct '%s': slot='%s' value='%s' rc=%d\n", +#ifdef IRDB_USE_CLASS_NAME + XSTR (hnd->IRDB_class_name), +#else + "anon", +#endif /* !IRDB_USE_CLASS_NAME */ + slot, value, rc); + + return rc; +} diff --git a/lib/ds/irdb/irdb0112.o b/lib/ds/irdb/irdb0112.o new file mode 100644 index 0000000000000000000000000000000000000000..65004b91d60cc7d83ffc23423e662c8fa1b26674 Binary files /dev/null and b/lib/ds/irdb/irdb0112.o differ diff --git a/lib/ds/irdb/irdb0116.c b/lib/ds/irdb/irdb0116.c new file mode 100644 index 0000000000000000000000000000000000000000..42788ae93a7d0c6e9d165caa8625125745fc5029 --- /dev/null +++ b/lib/ds/irdb/irdb0116.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/irdb/irdb0116.c + * + * irrelational database + * + * written: 1996-04-06 + * latest update: 1996-04-26 22:44:42 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int irdb_dbg_replace_string ( +struct IRDB_POS *pos, +char *slots[], +int slot_cnt, +char *value) +{ + int rc; + + rc= irdb_replace_string (pos, slots, slot_cnt, value); + + fputs ("replace string '", stdout); + irdb_dbg_show_slot_names (stdout, slots, slot_cnt); + printf ("': value='%s' rc=%d\n", value, rc); + + return rc; +} diff --git a/lib/ds/irdb/irdb0116.o b/lib/ds/irdb/irdb0116.o new file mode 100644 index 0000000000000000000000000000000000000000..6b5ef0a2c3743db36eb7f3d9a91c59e67e81b1d1 Binary files /dev/null and b/lib/ds/irdb/irdb0116.o differ diff --git a/lib/ds/irdb/irdb0118.c b/lib/ds/irdb/irdb0118.c new file mode 100644 index 0000000000000000000000000000000000000000..3039c0b2c00a56de2247adfb34322239c6a76224 --- /dev/null +++ b/lib/ds/irdb/irdb0118.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/irdb/irdb0118.c + * + * irrelational database + * + * written: 1996-04-27 + * latest update: 1996-04-27 11:00:16 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_dbg_set_long ( +struct IRDB_POS *pos, +char *slots[], +int slot_cnt, +long value) +{ + long rc; + + rc= irdb_set_long (pos, slots, slot_cnt, value); + + fputs ("set_long '", stdout); + irdb_dbg_show_slot_names (stdout, slots, slot_cnt); + printf ("':= value=%ld (rc=%ld)\n", value, rc); + + return rc; +} diff --git a/lib/ds/irdb/irdb0118.o b/lib/ds/irdb/irdb0118.o new file mode 100644 index 0000000000000000000000000000000000000000..bae2f62ebb43c2e72a85c505d6307de4503b31a9 Binary files /dev/null and b/lib/ds/irdb/irdb0118.o differ diff --git a/lib/ds/irdb/irdb0119.c b/lib/ds/irdb/irdb0119.c new file mode 100644 index 0000000000000000000000000000000000000000..3e58b24986566b6c1baf1ec0a7179bdaefc0e72c --- /dev/null +++ b/lib/ds/irdb/irdb0119.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/irdb/irdb0118.c + * + * irrelational database + * + * written: 1996-04-27 + * latest update: 1996-04-27 11:00:16 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_dbg_pre_increment_long ( +struct IRDB_POS *pos, +char *slots[], +int slot_cnt, +long value) +{ + long rc; + + rc= irdb_pre_increment_long (pos, slots, slot_cnt, value); + + fputs ("pre_increment_long '", stdout); + irdb_dbg_show_slot_names (stdout, slots, slot_cnt); + printf ("':= value=%ld (rc=%ld)\n", value, rc); + + return rc; +} diff --git a/lib/ds/irdb/irdb0119.o b/lib/ds/irdb/irdb0119.o new file mode 100644 index 0000000000000000000000000000000000000000..2d04a8de6d41e1a3d245f2f9001d1da4bfb0f0c5 Binary files /dev/null and b/lib/ds/irdb/irdb0119.o differ diff --git a/lib/ds/irdb/irdb0120.c b/lib/ds/irdb/irdb0120.c new file mode 100644 index 0000000000000000000000000000000000000000..fa437e8b5dbbf872d67c18647bbe21b68e6b2495 --- /dev/null +++ b/lib/ds/irdb/irdb0120.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/irdb/irdb0120.c + * + * irrelational database + * + * written: 1996-04-27 + * latest update: 1996-04-27 11:00:16 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +long irdb_dbg_post_increment_long ( +struct IRDB_POS *pos, +char *slots[], +int slot_cnt, +long value) +{ + long rc; + + rc= irdb_post_increment_long (pos, slots, slot_cnt, value); + + fputs ("post_increment_long '", stdout); + irdb_dbg_show_slot_names (stdout, slots, slot_cnt); + printf ("':= value=%ld (rc=%ld)\n", value, rc); + + return rc; +} diff --git a/lib/ds/irdb/irdb0120.o b/lib/ds/irdb/irdb0120.o new file mode 100644 index 0000000000000000000000000000000000000000..b3030ba30b2c82ac67ff889feadd721b43765712 Binary files /dev/null and b/lib/ds/irdb/irdb0120.o differ diff --git a/lib/ds/irdb/it1.c b/lib/ds/irdb/it1.c new file mode 100644 index 0000000000000000000000000000000000000000..0972de8c32cf2f4c1f7e36f8ed2d9e767f5de0a4 --- /dev/null +++ b/lib/ds/irdb/it1.c @@ -0,0 +1,150 @@ +/* + * FILE %ds/irdb/it1.c + * + * written: 1996-04-06 + * lateslt update: 1996-04-06 8:28:55 + * + */ + +#include <stdio.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []); +int lmd2_cnt (struct IRDB_HANDLE *hnd, char *word, char *docid); +int lmd2_meta (struct IRDB_HANDLE *hnd, char *slot, char *value); +int irdb_t1 (void); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + irdb_t1 (); + +#ifdef MSDOS + argc; + argv; +#endif /* MSDOS */ + + return 0; +} + +/* ------------------------------------------------------------------------ */ +#define LMD1_CNT 2 +static char *LMD1 [LMD1_CNT] = +{ + "wordcount", + (char *) 0 +} ; + +#define LMD1b_CNT 2 +static char *LMD1b [LMD1b_CNT] = +{ + "docs", + (char *) 0 +} ; + +/* ------------------------------------------------------------------------ */ +int lmd2_cnt ( +struct IRDB_HANDLE *hnd, +char *word, +char *docid) +/* wordcount.<word>.docs.<docid>++ */ +{ + struct IRDB_HANDLE *wi; + long *inf; + + LMD1 [1]= word; + LMD1b [1]= docid; + +printf ("\n****************\n** wordcount.%s.docs.%s++\n", word, docid); + + if ((wi= irdb_locate_handle (hnd, LMD1, LMD1_CNT, 1, (long) IRDBty_struct)) + == (struct IRDB_HANDLE *) 0 + || (inf= irdb_locate_info (wi, LMD1b, LMD1b_CNT, 1, (long) IRDBty_int)) + == (long *) 0 + ) return -1; + + (*inf)++; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +#define LMD2_CNT 2 +static char *LMD2 [LMD2_CNT]= +{ + "meta", + (char *) 0 +} ; + +/* ------------------------------------------------------------------------ */ +int lmd2_meta ( +struct IRDB_HANDLE *hnd, +char *slot, +char *value) +{ + LMD2 [1]= slot; + + irdb_dbg_replace_string (hnd, LMD2, LMD2_CNT, value); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +#define LMD3_CNT 3 +static char *LMD3 [LMD3_CNT]= +{ + "zcounter", + (char *) 0, + (char *) 0 +} ; + +/* ------------------------------------------------------------------------ */ +int irdb_t1 () +{ + struct IRDB_HANDLE *hnd; + char *docid; + + if ((hnd= irdb_new_struct_handle ("lmd3_test", (long) IRDBty_struct)) + == (struct IRDB_HANDLE *) 0) + { + printf ("can't get struct handle!\n"); + return -1; + } + + lmd2_meta (hnd, "urxn", "urxn_value"); + lmd2_meta (hnd, "urxn2", "urxn_2value"); + lmd2_meta (hnd, "junk", "maier"); + + docid= "01"; + lmd2_cnt (hnd, "franz", docid); + lmd2_cnt (hnd, "iris", docid); + lmd2_cnt (hnd, "iris", docid); lmd2_cnt (hnd, "iris", docid); + lmd2_cnt (hnd, "iris", docid); lmd2_cnt (hnd, "iris", docid); + lmd2_cnt (hnd, "irina", docid); + lmd2_cnt (hnd, "gerhard", docid); + lmd2_cnt (hnd, "karl", docid); + + printf ("\n*********************** TEST *********************\n"); + LMD1 [1]= "iris"; + irdb_set_long (hnd, LMD1, LMD1_CNT, 4711L); + LMD1 [1]= "gerhard"; + irdb_pre_increment_long (hnd, LMD1, LMD1_CNT, 4711L); + LMD1 [1]= "gerald"; + irdb_post_increment_long (hnd, LMD1, LMD1_CNT, 4711L); + + printf ("\n*********************** TEST *********************\n"); + LMD3 [1]= "iris"; + irdb_set_long (hnd, LMD3, 2, 4711L); + LMD3 [1]= "gerhard"; + irdb_pre_increment_long (hnd, LMD3, 2, 4711L); + LMD3 [2]= "gerhard"; + irdb_pre_increment_long (hnd, LMD3, 3, 4711L); + LMD3 [1]= "gerald"; + irdb_post_increment_long (hnd, LMD3, 2, 4711L); + + printf ("-----------------\ndumping\n"); + irdb_dump_to_file ("@@irdb.dmp", hnd); + + return 0; +} diff --git a/lib/ds/irdb/lib b/lib/ds/irdb/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/irdb/libgg.a b/lib/ds/irdb/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/irdb/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/irdb/make-dos b/lib/ds/irdb/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..a137adebe79e13e027e6b505e31730d88bc4a138 --- /dev/null +++ b/lib/ds/irdb/make-dos @@ -0,0 +1,42 @@ +# +# FILE %ds/irdb/makefile +# +# manipulation of attribute lists +# +# written: 1996-04-05 +# latest update: 1996-05-06 0:28:21 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all : all.00 all.01 # all.02 # all.test + +all.00 : ! + irdb0001.obj irdb0002.obj irdb0003.obj irdb0004.obj irdb0005.obj ! + irdb0006.obj irdb0007.obj irdb0008.obj irdb0009.obj irdb0010.obj ! + irdb0011.obj irdb0012.obj irdb0013.obj irdb0014.obj irdb0015.obj ! + irdb0016.obj irdb0017.obj irdb0018.obj irdb0019.obj irdb0020.obj ! + irdb0021.obj irdb0022.obj irdb0023.obj irdb0024.obj irdb0025.obj ! + irdb0026.obj irdb0027.obj irdb0028.obj + +all.01 : ! + irdb0101.obj irdb0102.obj irdb0103.obj irdb0104.obj irdb0105.obj ! + irdb0106.obj irdb0107.obj ! + irdb0112.obj ! + irdb0116.obj irdb0118.obj irdb0119.obj irdb0120.obj + +all.test : it1.exe + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +# ---------------------------------------------------------------------------- +TEST= irdb0001.obj irdb0003.obj irdb0005.obj irdb0012.obj irdb0014.obj irdb0017.obj + +it1.exe : it1.obj $(TEST) + link it1 $(TEST),,,c:\usr\sbr\lsbr; diff --git a/lib/ds/irdb/possig.awk b/lib/ds/irdb/possig.awk new file mode 100644 index 0000000000000000000000000000000000000000..b33e3b72c3d3f6ef9889c01482072edd3e332369 --- /dev/null +++ b/lib/ds/irdb/possig.awk @@ -0,0 +1,74 @@ +BEGIN { + fn=""; + fn2=""; + fp=0; + print "0 0 0 0 10 1 1 0" >"@$.ftr" + print "searching..." >"@$.pos" + al=2; +} +FILENAME!=fn2 { + print FILENAME + fn2=FILENAME; +} + + { wflg=0; } + +# include file checks -------------------------------------------------------- +#/include/ { +# x=$0; +# s1 = gsub (/\"/, "\"", x); +# s2 = gsub (/\\/, "/", x); +# s2+= gsub (/\//, "/", x); +# if (substr(x,1,1) == "#" && s1 > 0 && s2 > 0) prt(" \""); +#} +# /ed.h/ { next } +# /edhyx.h/ { next } +# /proto.h/ { next } +# /window.h/ { next } +# /message.h/ { next } +# /stdio.h/ { next } +# /string.h/ { next } +# /strings.h/ { next } +# /maus.h/ { next } +# /keys.h/ { next } +# /malloc.h/ { next } +# /include/ { prt("include"); } +# ---------------------------------------------------------------------------- + +#/FTR_display_replarray/ { prt("FTR_display_replarray"); } +#/ftr_replarray_size/ { prt("ftr_replarray_size"); } +#/highest_index/ { prt("highest_index"); } +#/next_index/ { prt("next_index"); } +#/IDX_REC_SIZE/ { prt("IDX_REC_SIZE"); } +#/12/ { prt("12"); } +# /irdb_new_handle/ { prt("irdb_new_handle"); } +# /irdb_new_struct_handle/ { prt("irdb_new_struct_handle"); } +/IRDB_data/ { prt("IRDB_data"); } +/IRDB_payload_position/ { prt("IRDB_payload_position"); } +#/<gg\// { prt("<gg/"); } +#hyx.l/ { prt("hyx.l"); } + +# ---------------------------------------------------------------------------- +wflg!=0 { + print FILENAME" ("FNR"): ", $0 >>"@$.pos"; + al++; +} + +function prt(t) { +# if (FILENAME != fn || fp != FNR) { + cs=1; + if (FNR >= 10) cs++; + if (FNR >= 100) cs++; + if (FNR >= 1000) cs++; + if (FNR >= 10000) cs++; + cl=length(t); + for (cx=length($0);cx>0;cx--) if (substr($0,cx,cl) == t) { + printf al" "cx+5+cs+length(FILENAME)" 1 " >>"@$.ftr"; + printf "<hyx.l file=\""FILENAME"\" ln="FNR" cn="cx-1 >>"@$.ftr"; + print " tdc=79 tdp="cl">" >>"@$.ftr"; + } + wflg=1; +# } + fn = FILENAME; + fp = FNR; +} diff --git a/lib/ds/lmd/(dirinf).fm b/lib/ds/lmd/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..0a6f38547facd8e225db14b8876299aab8719d47 --- /dev/null +++ b/lib/ds/lmd/(dirinf).fm @@ -0,0 +1,110 @@ +# +# FILE %ds/lmd/(dirinf).fm +# +# LM/D library +# +# latest update: 1996-12-22 17:41:47 +# $Id: (dirinf).fm,v 1.4 2002/02/04 08:13:07 gonter Exp $ +# +# ---------------------------------------------------------------------------- + +# administrative files +(dirinf).fm Contents +Makefile active version of Makefile +make-ux Unix version of Makefile +make-dos MSDOS version of Makefile + +# ---------------------------------------------------------------------------- +# Natural Language Utilities +nl_00001.c nl_get_str +nl_00002.c nl_key_valid +nl_00004.c nl_get_token (fi, s, mode, push_back) +nl_00009.c lookup_insert: Manipulation der kompakten LUT Struktur +nl_00009.c >>>>>>>>>>>>>> FUNKTIONIERT NICHT <<<<<<<<<<<<<<<<< +# +nl_00101.c lmd_find_document_info (...) +nl_00102.c lmd_dump_document_info_list (...) +nl_00104.c lmd_deref_word() etc, lut, word ref and document info tables +nl_00105.c struct WORD_REF_LIST *lmd_deref1 (char *str, ...); +nl_00106.c int lmd_deref_word_ref (...) +nl_00107.c long lmd_read_word_ref_list (...) +nl_00108.c long lmd_read_word_ref (FILE *fi_word_ref, struct WORD_REF *wr) +nl_00109.c long lmd_read_document_info_list (...) +nl_00111.c int lmd_discard_doc_id (...); +nl_00112.c int lmd_free_docdir_list (struct DOCDIR_LIST *dl1) +nl_00113.c struct DOCDIR_LIST *lmd_read_docdir_info (...) +nl_00114.c struct DOCDIR_LIST *lmd_get_docdir_info (...); +nl_00115.c int lmd_find_word_ref (FILE *f_wr, long w_info, ...) +nl_00116.c int lmd_print_word_ref_info (FILE *fo, struct WORD_REF *wr) +nl_00117.c int lmd_print_doc_hit_list (...) +nl_00118.c int lmd_print_document_info_list (FILE *fo, ...); +nl_00119.c int lmd_print_veronica_hit_list (...); +nl_00120.c int lmd_print_veronica_docinfo_list (FILE *fo, FILE *vf, ...); +nl_00121.c int lmd_print_hyx_hit_list (FILE *fo, char *document_dir, ...); +nl_00122.c int lmd_print_docdir_hyx (FILE *fo, struct DOCDIR_LIST *docdir) +nl_00123.c int lmd_print_gopher_hit_list (...); +nl_00124.c int lmd_print_docdir_gopher (FILE *fo,struct DOCDIR_LIST *dl2,...) +nl_00125.c long lmd_write_word_ref (FILE *fo_word_ref, struct WORD_REF *wr, ..) +nl_00126.c int lmd_docid_list_insert (...); +nl_00127.c struct TERM_EVAL *lmd_build_term_eval (struct WORD_REF_LIST *wrl) +nl_00128.c struct TERM_EVAL *lmd_evaluate_terms (struct TERM_EVAL *te_list) +nl_00129.c struct DOCUMENT_INFO_LIST *lmd_dil_accumulate (...) +nl_00130.c struct DOCUMENT_INFO_LIST *lmd_dil_dup (struct DOCUMENT_INFO_LIST *org) +nl_00131.c struct DOCUMENT_INFO_LIST *lmd_dil_operator (...) +nl_00132.c struct DOCUMENT_INFO_LIST *lmd_find_document_info (struct WORD_REF *wr, ...) +nl_00133.c struct DOCUMENT_INFO_LIST *lmd_insert_document_info (struct WORD_REF *wr, ...) +nl_00134.c int lmd_create_dil (struct YTREE *yt, void *client_data) +nl_00135.c int lmd_qs_setup_table_names (struct LMD_QUERY_SET *lmdq, s); +nl_00136.c int lmd_deref_init (struct LMD_QUERY_SET *lmdqs); +nl_00137.c int lmd_deref_finish (struct LMD_QUERY_SET *lmdqs); +nl_00138.c int lmd_store_word_ref (char *str, long info, void *client_data) +nl_00139.c int lmd_print_hyx_cluster_hit_list (FILE *fo, struct WORD_REF_LIST *wrl, ...) +nl_00140.c new_LMDQS (...): +nl_00141.c WRL methods +nl_00142.c DIL methods +# +nl_00201.c int lmd_set_location_code (struct DOCUMENT_INFO *di, ...) +# +nl_00301.c int lmd_lmd_TWF (struct LMDT_CONTROL *lmdt, char *w); +nl_00302.c int lmd_report_tfb (struct LMDT_CONTROL *lmdt, long inf); +nl_00303.c int lmd_report2 (char *str, long inf, void *client_data); +nl_00304.c int lmd_report (struct LMDT_CONTROL *lmdt, char *w,...) +nl_00305.c int lmd_RL3 (struct LMDT_CONTROL *lmdt, char *fn, ...) +nl_00306.c int lmd_RL3_set_tfb_file (struct LMDT_CONTROL *lmdt, ...) +# +nl_00401.c int lmd_score (struct LMDC_CONTROL *lmdc, char *s,...) +nl_00402.c int lmd_idx (struct LMDC_CONTROL *lmdc, char *s,...) +nl_00403.c struct WORD_REF *lmd_lookup_entry (lmdc, string); +nl_00404.c long lmd_PL (struct LMDC_CONTROL *lmdc, char *LUT_out,...) +nl_00405.c int lmd_RL4 (struct LMDC_CONTROL *lmdc, char *LUT_in,...) +nl_00407.c void lmd_initialize_control (struct LMDC_CONTROL *lmdc) +nl_00408.c void lmd_error04 (char *msg); +nl_00409.c void lmd_print_04statistics (struct LMDC_CONTROL *lmdc,...) +nl_00410.c int ytree_wr_ptr2idx (struct YTREE *yt, void *lmdc); +nl_00411.c int ytree_wr_idx2ptr (struct YTREE *yt, void *lmdc); +# +nl_00500.c struct LMDC_CONTROL *lmd_create_control (void) +nl_00501.c int lmd_word_statistics (struct LMDC_CONTROL *lmdc,...) +nl_00502.c int lmd_write_tables (struct LMDC_CONTROL *lmdc,...) +nl_00503.c long lmd_read_tables (struct LMDC_CONTROL *lmdc,...) +nl_00504.c int lmd_discard_document_id (struct LMDC_CONTROL *lmdc,...) +nl_00510.c int lmd_dump_word_entry (struct YTREE *yt, void *client_data); +nl_00511.c int lmd_print_lmdd (FILE *fo, struct LMDD_CONTROL *lmdd); +nl_00512.c long lmd_get_interpretation (char *s); +nl_00514.c int lmd_discard_document_node (struct YTREE *yt, void *cd) +# +nl_00600.c functions from lutmake.c; *** obsolete *** +nl_00601.c long lmd_read_stream (struct LMDC_CONTROL *lmdc, char *fn, ...) +nl_00602.c long lmd_read_tokens (struct LMDC_CONTROL *lmdc, char *fn, ...) +nl_00603.c long lmd_batch_process (struct LMDC_CONTROL *lmdc, char *fn) +nl_00604.c long lmd_docdir_process (struct LMDC_CONTROL *lmdc, char *fn) +nl_00605.c long lmd_veronica_process (struct LMDC_CONTROL *lmdc, char *fn); +nl_00606.c long lmd_read_tfb (struct LMDC_CONTROL *lmdc, char *fn,...) +nl_00607.c long lmd_read_words (struct LMDC_CONTROL *lmdc, char *fn); +nl_00608.c long lmd_read_fcy (struct LMDC_CONTROL *lmdc, char *fn); +nl_00609.c long lmd_read_long_fcy (struct LMDC_CONTROL *lmdc, char *fn); +nl_00610.c long lmd_read_hyx_cluster (struct LMDC_CONTROL *lmdc, ...); +# +util_001.c int sort_by_frequency (char *wort, long frequency); +# +rdtoken.c Testmodul fuer NL_00004.c diff --git a/lib/ds/lmd/Makefile b/lib/ds/lmd/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..daf770af20bc7e7438fdc0d2b66453a13a38c05d --- /dev/null +++ b/lib/ds/lmd/Makefile @@ -0,0 +1,46 @@ +# +# FILE %ds/lmd/make-ux +# +# written: 1995-12-20 +# latest update: 1999-05-08 9:49:31 +# $Id: Makefile,v 1.6 2002/12/24 07:00:50 gonter Exp $ +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include # -DDEBUG +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= nl_00001.o nl_00002.o nl_00004.o +LIBOBJS1= nl_00102.o nl_00104.o nl_00105.o nl_00106.o nl_00107.o nl_00108.o \ + nl_00109.o nl_00111.o nl_00112.o nl_00113.o nl_00114.o nl_00115.o \ + nl_00116.o nl_00117.o nl_00118.o nl_00119.o nl_00120.o nl_00121.o \ + nl_00122.o nl_00123.o nl_00124.o nl_00125.o nl_00126.o nl_00127.o \ + nl_00128.o nl_00129.o nl_00130.o nl_00131.o nl_00132.o nl_00133.o \ + nl_00134.o nl_00135.o nl_00136.o nl_00137.o nl_00138.o nl_00139.o \ + nl_00140.o nl_00141.o nl_00142.o +LIBOBJS2= nl_00201.o +LIBOBJS3= nl_00301.o nl_00302.o nl_00303.o nl_00304.o nl_00305.o nl_00306.o +LIBOBJS4= nl_00401.o nl_00402.o nl_00403.o nl_00404.o nl_00405.o nl_00407.o \ + nl_00408.o nl_00409.o +LIBOBJS5= nl_00500.o nl_00501.o nl_00502.o nl_00503.o nl_00504.o nl_00510.o \ + nl_00511.o nl_00512.o nl_00514.o +LIBOBJS6= nl_00601.o nl_00602.o nl_00603.o nl_00604.o nl_00605.o nl_00606.o \ + nl_00607.o nl_00608.o nl_00609.o nl_00610.o +LIBOBJS9= nl_01001.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) $(LIBOBJS1) $(LIBOBJS2) $(LIBOBJS3) $(LIBOBJS4) $(LIBOBJS5) \ + $(LIBOBJS6) $(LIBOBJS9) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -g -c $? + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib diff --git a/lib/ds/lmd/NOTES b/lib/ds/lmd/NOTES new file mode 100644 index 0000000000000000000000000000000000000000..cd3648ab497368e861d2b295ea42997094b67810 --- /dev/null +++ b/lib/ds/lmd/NOTES @@ -0,0 +1,13 @@ +$Id: NOTES,v 1.1 2001/10/08 17:07:57 gonter Exp $ +Notes about bugs and problems. + +Loop: + +(dbx) where +lmd_dil_operator(0x22088af8, 0x2168cee8, 0x1002) at 0x10004890 +lmd_dil_accumulate(0x206c8958) at 0x10004728 +lmd_evaluate_terms(0x21fac8e8, 0x1001) at 0x1000463c +print_term_list(0x21fac8e8) at 0x100007d0 +main(0x4, 0x2ff7fde8) at 0x1000073c + + diff --git a/lib/ds/lmd/contrib b/lib/ds/lmd/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/lmd/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/lmd/gg b/lib/ds/lmd/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/lmd/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/lmd/lib b/lib/ds/lmd/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/lmd/libgg.a b/lib/ds/lmd/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/lmd/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/lmd/make-dos b/lib/ds/lmd/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..24394b68c8def044a4ead80e14411605422aae12 --- /dev/null +++ b/lib/ds/lmd/make-dos @@ -0,0 +1,56 @@ +# +# FILE %ds/lmd/makefile +# +# natural language and knowledge representation library +# +# written: 1989 03 29 +# latest update: 1997-08-02 8:48:57 +# +# ============================================================================ +# add -DDEBUG for debugging +cml=cl -AL /W3 /Fo$*.obj /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 NLKR_TEXT + +all.0 : all.1 all.2 all.3 all.4 all.5 all.6 + +all.1 : nl_00001.obj nl_00002.obj nl_00004.obj ! + nl_00102.obj nl_00104.obj nl_00105.obj ! + nl_00106.obj nl_00107.obj nl_00108.obj nl_00109.obj ! + nl_00111.obj nl_00112.obj nl_00113.obj ! + nl_00114.obj nl_00115.obj nl_00116.obj nl_00117.obj ! + nl_00118.obj nl_00119.obj nl_00120.obj nl_00121.obj ! + nl_00122.obj nl_00123.obj nl_00124.obj nl_00125.obj ! + nl_00126.obj nl_00127.obj nl_00128.obj nl_00129.obj ! + nl_00130.obj nl_00131.obj nl_00132.obj nl_00133.obj ! + nl_00134.obj nl_00135.obj nl_00136.obj nl_00137.obj ! + nl_00138.obj nl_00139.obj + +all.2: nl_00201.obj +all.3: nl_00301.obj nl_00302.obj nl_00303.obj nl_00304.obj nl_00305.obj ! + nl_00306.obj +all.4: nl_00401.obj nl_00402.obj nl_00403.obj nl_00404.obj nl_00405.obj ! + nl_00407.obj nl_00408.obj nl_00409.obj +all.5: nl_00500.obj nl_00501.obj nl_00502.obj nl_00503.obj nl_00504.obj ! + nl_00510.obj nl_00511.obj nl_00512.obj nl_00514.obj + +all.6: nl_00601.obj nl_00602.obj nl_00603.obj nl_00604.obj ! + nl_00605.obj nl_00606.obj nl_00607.obj nl_00608.obj ! + nl_00609.obj nl_00610.obj ! + nl_01001.obj + +all.relics : ! + dic_0001.obj dic_0002.obj dic_0003.obj dic_0004.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +# ---------------------------------------------------------------------------- +test1.exe : test1.obj dic_0004.obj + link test1 dic_0004; + +# ---------------------------------------------------------------------------- +rdtoken.exe : rdtoken.obj nl_00004.obj + link rdtoken nl_00004,,,c:\usr\sbr\lsbr; diff --git a/lib/ds/lmd/nl_00001.c b/lib/ds/lmd/nl_00001.c new file mode 100644 index 0000000000000000000000000000000000000000..86f4567ef5ad39b3ea88d535f047360cf4e47e50 --- /dev/null +++ b/lib/ds/lmd/nl_00001.c @@ -0,0 +1,70 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00001.c + * + * nl_get_str (fi, s) + * + * Wort-String aus einem File lesen + * + * written: 1989 09 10 + * latest update: 1995-04-01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> + +/* ------------------------------------------------------------------------ */ +int nl_get_str ( +FILE *fi, +char *s) +{ + int ch; + int cnt= 0; + + /* Spaces, Satzzeichen usw. ueberlesen */ + for (;;) + { + ch= fgetc (fi) & 0x00FF; + if (feof(fi)) + { + *s= 0; + return cnt; + } + cnt++; + + if ((ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') || + (ch >= '0' && ch <= '9') || + ch == '_' || + (ch >= 0x80 && ch <= 0xA5) || /* Umlaute, nationale Zeichen */ + (ch >= 0xE0 && ch <= 0xEF)) /* Umlaute, griechische Zeichen */ + break; + } + + /* Wort einlesen */ + for (;;) + { + *s++ = (char) ch; + ch= fgetc (fi) & 0x00FF; + if (feof(fi)) + { + *s= 0; + return cnt; + } + cnt++; + + if ((ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') || + (ch >= '0' && ch <= '9') || + ch == '_' || + (ch >= 0x80 && ch <= 0xA5) || /* Umlaute, nationale Zeichen */ + (ch >= 0xE0 && ch <= 0xEF)) /* Umlaute, griechische Zeichen */ + continue; + + *s= 0; + return cnt; + } +} diff --git a/lib/ds/lmd/nl_00001.o b/lib/ds/lmd/nl_00001.o new file mode 100644 index 0000000000000000000000000000000000000000..a882d672b7dff89b561b16d3cf71055bfdc73e1f Binary files /dev/null and b/lib/ds/lmd/nl_00001.o differ diff --git a/lib/ds/lmd/nl_00002.c b/lib/ds/lmd/nl_00002.c new file mode 100644 index 0000000000000000000000000000000000000000..574e51c01bb1a7651ecdc57a99865da0190878d8 --- /dev/null +++ b/lib/ds/lmd/nl_00002.c @@ -0,0 +1,36 @@ +/* + * FILE %ds/lmd/nl_00002.c + * + * nl_key_valid (w) + * + * Pruefen, ob ein Wort als Schluessel verwendet werden kann + * + * written: 1989 09 10 + * latest update: 1996-12-22 12:40:53 + * $Id: nl_00002.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lookup.h> + +/* Pruefen, ob ein Wort als Schluessel verwendet werden kann. --------------- */ +int nl_key_valid (const char *w) +/* RETURN: 0 .. ok; -1 .. w kann nicht als Key verwendet werden */ +{ + int idx, ch; + + if (w == (char *) 0) return -1; + + for (idx= 0; (ch= w [idx] & 0x00FF) != 0; idx++) + if (ch < 0x05 || ch == 0x00FF) return -1; + + if (idx == 0 || /* Leerstring */ + idx > MAX_LUT_KEY_LENGTH) return -1; /* Wort zu lang */ + + return 0; +} diff --git a/lib/ds/lmd/nl_00002.o b/lib/ds/lmd/nl_00002.o new file mode 100644 index 0000000000000000000000000000000000000000..84905b76ce777addadbb15875e82d0cf4ed9b2e0 Binary files /dev/null and b/lib/ds/lmd/nl_00002.o differ diff --git a/lib/ds/lmd/nl_00004.c b/lib/ds/lmd/nl_00004.c new file mode 100644 index 0000000000000000000000000000000000000000..a173e308e714b357326e38ce85f922c70c41cfc5 --- /dev/null +++ b/lib/ds/lmd/nl_00004.c @@ -0,0 +1,146 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00004.c + * + * nl_get_token (fi, s, mode, push_back) + * + * Token-String aus einem File lesen + * + * written: 1990 01 21: Erweiterung von nl_get_str [NL_00004.C] + * 1993-03-02: latest update; NOTE: CMS needs to be revised! + * latest update: 1995-04-01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lookup.h> + +/* Control Vektor: -------------------------------------------------------- */ +/* Bit 0: A..Z, a..z 41 .. 5A, 61 .. 7A */ +/* Bit 1: 0..9 30 .. 39 */ +/* Bit 2: Nationale Sonderzeichen: 80 .. A8 */ +/* Bit 3: Symbole: E0, E2 .. FF */ +/* Bit 4: Graphische Characters: B0 .. DF */ +/* Bit 5: $ _ 24 40 5F */ +/* Bit 6: Satzzeichen: ! " ' , . : ; ? ` @ 21,22,27,2C,2E,3A,3B,3F,60 */ +/* Bit 7: sonstige Zeichen */ + +/* Ein Token einlesen: ---------------------------------------------------- */ +int nl_get_token ( +FILE *fi, /* Input File */ +char *s, /* gelesenes Token */ +int mode, /* Controlvektor */ +int *push_back, /* zuletzt gelesenes Zeichen */ +long *filepos_beg) /* Beginn des Wortes im File */ +/* Return: Controlvektor ... Das Bit gibt an warum abgebrochen wurde; */ +/* 0 -> EOF */ +{ + int ch; + int rv= 0; + int idx= 0; + + if (*push_back) /* what was the last character ?? */ + { + ch= *push_back; + *push_back= 0; + goto A; + } + + /* Spaces ueberlesen */ + for (;;) + { + *filepos_beg= ftell (fi); + ch= fgetc (fi) & 0x00FF; + if (feof(fi)) + { + *s= 0; + return 0; + } +A: + if (ch > ' ') break; + } + +goto B; + /* Wort einlesen */ + for (;;idx++) + { + if (idx == 0) *filepos_beg= ftell (fi); + ch= fgetc (fi) & 0x00FF; + if (feof(fi)) + { + *s= 0; + return rv; + } +B: + *s++= (char) ch; + *s= 0; + if ((mode & 0x0001) && ( +#ifdef __CMS__ + (ch >= 'a' && ch <= 'i') || + (ch >= 'j' && ch <= 'r') || + (ch >= 's' && ch <= 'z') || + (ch >= 'A' && ch <= 'I') || + (ch >= 'J' && ch <= 'R') || + (ch >= 'S' && ch <= 'Z') +#else + (ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') +#endif + )) { rv |= 0x0001; continue; } + if ((mode & 0x0002) && ch >= '0' && ch <= '9') { rv |= 0x0002; continue; } +#ifndef __CMS__ + if ((mode & 0x0004) && ch>=0x80 && ch<=0xA8) { rv |= 0x0004; continue; } + if ((mode & 0x0004) && ch==0xE1) { rv |= 0x0004; continue; } + if ((mode & 0x0008) && ch>=0xE0 && ch<=0xEF) { rv |= 0x0008; continue; } + if ((mode & 0x0010) && ch>=0xB0 && ch<=0xDF) { rv |= 0x0010; continue; } +#endif + if ((mode & 0x0020) && + (ch=='_' || ch=='$')) { rv |= 0x0020; continue; } + if ((mode & 0x0040) && + (ch=='!' || ch=='\"' || ch=='\'' || + ch=='`' || ch==',' || ch=='.' || + ch=='@' || + ch==':' || ch==';' || ch=='?')) { rv |= 0x0040; continue; } + break; + } + + if (idx == 0) + { + if ( +#ifdef __CMS__ + (ch >= 'a' && ch <= 'i') || + (ch >= 'j' && ch <= 'r') || + (ch >= 's' && ch <= 'z') || + (ch >= 'A' && ch <= 'I') || + (ch >= 'J' && ch <= 'R') || + (ch >= 'S' && ch <= 'Z') +#else + (ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') +#endif + ) { rv |= 0x0001; goto X; } + if ( ch >= '0' && ch <= '9') { rv |= 0x0002; goto X; } +#ifndef __CMS__ + if ( ch>=0x80 && ch<=0xA8) { rv |= 0x0004; goto X; } + if ( ch==0xE1) { rv |= 0x0004; goto X; } + if ( ch>=0xE0 && ch<=0xEF) { rv |= 0x0008; goto X; } + if ( ch>=0xB0 && ch<=0xDF) { rv |= 0x0010; goto X; } +#endif + if ( ch=='_' || ch=='$' ) { rv |= 0x0020; goto X; } + if ( ch=='!' || ch=='\"' || ch=='\'' || + ch=='`' || ch==',' || ch=='.' || + ch=='@' || + ch==':' || ch==';' || ch=='?' ) { rv |= 0x0040; goto X; } + rv |= 0x0080; + } + else { + --s; + *s= 0; + *push_back= ch; + } +X: + return rv; +} diff --git a/lib/ds/lmd/nl_00004.o b/lib/ds/lmd/nl_00004.o new file mode 100644 index 0000000000000000000000000000000000000000..3dd6ffc7aa6899ead5e826244b71ff8a46449684 Binary files /dev/null and b/lib/ds/lmd/nl_00004.o differ diff --git a/lib/ds/lmd/nl_00009.c b/lib/ds/lmd/nl_00009.c new file mode 100644 index 0000000000000000000000000000000000000000..b5d11f1784c982be7359ac8451ecf6c92d2523a4 --- /dev/null +++ b/lib/ds/lmd/nl_00009.c @@ -0,0 +1,47 @@ +/* + * FILE /usr/nl_kr/lib/nl_00009.c + * + * 1990 01 28 + * + */ + +# include <stdio.h> +# inlcude <gg/lookup.h> + +static char LUT [4000]; + +static int LUT_IDX =0; + + +/* ------------------------------------------------------------------------ */ +lookup_insert (char *w) +{ + int i; + + if (LUT_IDX == 0) + { + strcpy (LUT, w); + LUT_IDX = strlen (w)+1; + printf ("First Word %s\n", w); + return 0; + } + + for (i=0; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +main () +{ + char line [400]; + + for (;;) + { + printf ("Wort: "); scanf ("%s", line); + lookup_insert (line); + } +} + + + diff --git a/lib/ds/lmd/nl_00101.c b/lib/ds/lmd/nl_00101.c new file mode 100644 index 0000000000000000000000000000000000000000..b62883642df1987e91309465418cb371ecd75aa9 --- /dev/null +++ b/lib/ds/lmd/nl_00101.c @@ -0,0 +1,26 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00101.c + * + * find a document in a list + * + * written: 1993-02-28 + * latest update: 1995-07-22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct DOCUMENT_INFO_LIST *lmd_find_document_info_list ( +struct DOCUMENT_INFO_LIST *start, +long doc_id) +{ + for (; start != (struct DOCUMENT_INFO_LIST *) 0; start= start->DIL_next) + if (start->DIL->DI_document_id == doc_id) return start; + + return (struct DOCUMENT_INFO_LIST *) 0; +} diff --git a/lib/ds/lmd/nl_00102.c b/lib/ds/lmd/nl_00102.c new file mode 100644 index 0000000000000000000000000000000000000000..3aac3f842990e01e374626ff5cfc77f18091b462 --- /dev/null +++ b/lib/ds/lmd/nl_00102.c @@ -0,0 +1,53 @@ +/* + * FILE %nl_kr/lib/nl_00102.c + * + * dump a document info list + * + * written: 1993-02-28 + * latest update: 1995-12-05 + * $Id: nl_00102.c,v 1.4 2001/09/10 06:58:37 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <gg/lookup.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int lmd_dump_document_info_list (struct YTREE *yt, void *client_data) +{ + struct LMDD_CONTROL *lmdd; + struct DOCUMENT_INFO *di; + FILE *fo; + + if (yt == (struct YTREE *) 0 + || (lmdd= (struct LMDD_CONTROL *) client_data) + == (struct LMDD_CONTROL *) 0 + || (di= (struct DOCUMENT_INFO *) yt->YT_info) + == (struct DOCUMENT_INFO *) 0 + || (fo= lmdd->LMDD_fo_di) == (FILE *) 0 + ) + return -1; + + dpp_fwrite_long (fo, di->DI_document_id, 4); + dpp_fwrite_long (fo, di->DI_hit_count, 4); + +#ifdef LMD_EXTENDED_MODEL + { + int i; + + dpp_fwrite_long (fo, di->DI_document_ptr, 4); + for (i= 0; i < MAX_DI_POS; i++) + dpp_fwrite_long (fo, di->DI_pos [i], 4); + } +#endif /* LMD_EXTENDED_MODEL */ + + /* release no longer needed data */ + free (di); + yt->YT_info= (long) 0; + + lmdd->LMDD_doc_items_written++; + + return 0; +} diff --git a/lib/ds/lmd/nl_00102.o b/lib/ds/lmd/nl_00102.o new file mode 100644 index 0000000000000000000000000000000000000000..f68ffd5e93b0fcd59a9c9a98bfca6c1c43eab740 Binary files /dev/null and b/lib/ds/lmd/nl_00102.o differ diff --git a/lib/ds/lmd/nl_00104.c b/lib/ds/lmd/nl_00104.c new file mode 100644 index 0000000000000000000000000000000000000000..8c28730bd3897bedaee380deae40375deab5c1cd --- /dev/null +++ b/lib/ds/lmd/nl_00104.c @@ -0,0 +1,55 @@ +/* + * FILE %ds/lmd/nl_00104.c + * + * deref a word + * + * written: 1993-02-28 + * latest update: 1995-07-31 + * $Id: nl_00104.c,v 1.4 2002/01/29 08:01:41 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/dpp.h> +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct WORD_REF_LIST *lmd_deref_word ( +struct LMD_QUERY_SET *lmdqs, +char *w, +int exact) +{ + struct WORD_REF_LIST *wrl= (struct WORD_REF_LIST *) 0; + struct WORD_REF_LIST *xwrl; + struct DEREF_CONTROL dc; + int rc; + +#ifdef DEBUG +printf ("nl_00104: w='%s' exact=%d init=%d\n", w, exact, lmdqs->LMDQS_initialized); +#endif /* DEBUG */ + + if (!lmdqs->LMDQS_initialized + ||(rc= lmd_deref_word_ref (lmdqs, w, exact, &wrl)) != 0) + return (struct WORD_REF_LIST *) 0; + +#ifdef DEBUG +printf ("nl_00104: reading di list\n"); +#endif /* DEBUG */ + + for (xwrl= wrl; xwrl != (struct WORD_REF_LIST *) 0; xwrl= xwrl->WRL_next) + { + lmd_read_document_info_list (lmdqs->LMDQS_F_di, + &xwrl->WRL.WR_ytree, + xwrl->WRL.WR_docinfo_offset, + xwrl->WRL.WR_docinfo_count); + + dc.DC_dil= (struct DOCUMENT_INFO_LIST *) 0; + dc.DC_dil_app= &dc.DC_dil; + ytree_process (xwrl->WRL.WR_ytree, lmd_create_dil, (void *) &dc); + xwrl->WRL_dil= dc.DC_dil; + } + + return wrl; +} diff --git a/lib/ds/lmd/nl_00104.o b/lib/ds/lmd/nl_00104.o new file mode 100644 index 0000000000000000000000000000000000000000..26ec9486fb8ac214848191002ce9f677cb0861e0 Binary files /dev/null and b/lib/ds/lmd/nl_00104.o differ diff --git a/lib/ds/lmd/nl_00105.c b/lib/ds/lmd/nl_00105.c new file mode 100644 index 0000000000000000000000000000000000000000..14b9c11cd70c42556cd554395915719983fdda18 --- /dev/null +++ b/lib/ds/lmd/nl_00105.c @@ -0,0 +1,54 @@ +/* + * FILE %ds/lmd/nl_00105.c + * + * dereferenciate a word + * + * written: 1994-07-31 + * latest update: 1995-07-30 + * $Id: nl_00105.c,v 1.2 2002/01/29 08:01:42 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct WORD_REF_LIST *lmd_deref1 ( +struct LMD_QUERY_SET *lmdqs, +char *str, +int min_wordlength, +int max_wordlength) +{ + int exact= 1; + int wl; + int ch; + +#ifdef DEBUG +printf ("nl_00105: str='%s'\n", str); +#endif /* DEBUG */ + + for (wl= 0;; wl++) + { + ch= str [wl] & 0x00FF; + lmdqs->LMDQS_ext_pattern [wl]= (char) ch; + if (ch == '*' || ch == '?') + { + str [wl]= 0; + exact= 0; + } + if (ch == 0) break; + } + + if (wl < min_wordlength) return (struct WORD_REF_LIST *) 0; + if (wl > max_wordlength) str [max_wordlength]= 0; + to_lower (str); + + if (exact) lmdqs->LMDQS_ext_pattern [0]= 0; +#ifdef DEBUG +printf ("nl_00105: str=%s ext=%s\n", str, lmdqs->LMDQS_ext_pattern); +#endif /* DEBUG */ + + return lmd_deref_word (lmdqs, str, exact); +} diff --git a/lib/ds/lmd/nl_00105.o b/lib/ds/lmd/nl_00105.o new file mode 100644 index 0000000000000000000000000000000000000000..ccd1a29e932cf57dee0b5f61d61025fa5b4a81a3 Binary files /dev/null and b/lib/ds/lmd/nl_00105.o differ diff --git a/lib/ds/lmd/nl_00106.c b/lib/ds/lmd/nl_00106.c new file mode 100644 index 0000000000000000000000000000000000000000..629816fa4314a42e79b1552313942dd1c493dbd3 --- /dev/null +++ b/lib/ds/lmd/nl_00106.c @@ -0,0 +1,85 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00106.c + * + * deref a word + * + * written: 1993-03-27: extracted from nl_00104.c + * latest update: 1995-07-30 + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/lookup.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int lmd_deref_word_ref ( +struct LMD_QUERY_SET *lmdqs, +char *w, +int exact, +struct WORD_REF_LIST **wrl) +{ + long w_info; + int lng; + int rc; + FILE *f_lut; + +#ifdef DEBUG +printf ("nl_00106: w='%s' exact=%d\n", w, exact); +#endif /* DEBUG */ + + f_lut= lmdqs->LMDQS_F_lt; + lmdqs->LMDQS__wrl= wrl; + lmdqs->LMDQS__error_flag= 0; + + fseek (f_lut, 0L, 0); + + if (w != (char *) 0 && *w == 0 && !exact) + { + lmdqs->LMDQS_pfx= ""; + lmdqs->LMDQS_pfx_lng= 0; + goto PROCESS; + } + + if ((rc= lookup_file (f_lut, w, &w_info, &lng)) < 0) return -1; + +#ifdef DEBUG +printf ("nl_00106: lookup('%s') =: rc=%d, lng=%d\n", w, rc, lng); +#endif /* DEBUG */ + + if (((rc & LOOKUP_found) && exact) + || ((rc & LOOKUP_prefix_3) && !exact)) + { + char *wrd; + + wrd= lut_file_get_word_buffer (); + lmdqs->LMDQS_pfx= (char *) 0; + lmdqs->LMDQS_pfx_lng= 0; + +#ifdef DEBUG +printf ("nl_00106: store exact word info\n", w, rc, lng); +#endif /* DEBUG */ + + lmd_store_word_ref (wrd, w_info, (void *) lmdqs); + } + + if (!exact && ((rc & LOOKUP_prefix_4) || ((rc & LOOKUP_found)))) + { + long off; + + if ((off= lut_file_get_dump_beg ()) != -1L) + { + lmdqs->LMDQS_pfx= lut_file_get_word_buffer (); + lmdqs->LMDQS_pfx_lng= strlen (lmdqs->LMDQS_pfx); + fseek (f_lut, off, 0); +PROCESS: + lut_process_block (f_lut, lmd_store_word_ref, (void *) lmdqs); + } + } + + if (lmdqs->LMDQS__error_flag != 0) return -1; + + return 0; +} diff --git a/lib/ds/lmd/nl_00106.o b/lib/ds/lmd/nl_00106.o new file mode 100644 index 0000000000000000000000000000000000000000..3946dd2a033b14b12b86aabd7a5ac43e235023c4 Binary files /dev/null and b/lib/ds/lmd/nl_00106.o differ diff --git a/lib/ds/lmd/nl_00107.c b/lib/ds/lmd/nl_00107.c new file mode 100644 index 0000000000000000000000000000000000000000..3ec7e60a4d035b75680c96a2d866debd9dbf0f25 --- /dev/null +++ b/lib/ds/lmd/nl_00107.c @@ -0,0 +1,56 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00107.c + * + * scan in a word ref list together with the document info list + * + * written: 1993-02-28 + * latest update: 1995-07-22 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/lookup.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int lmd_read_word_ref_list ( +struct YTREE *yt, +void *client_data) +{ + struct WORD_REF *wr; + struct LMDD_CONTROL *lmdd; + FILE *f_wr; + FILE *f_di; + long doc_items_read; + + if (yt == (struct YTREE *) 0 + || (lmdd= (struct LMDD_CONTROL *) client_data) + == (struct LMDD_CONTROL *) 0 + || (f_wr= lmdd->LMDD_fo_wr) == (FILE *) 0 + || (f_di= lmdd->LMDD_fo_di) == (FILE *) 0) + return -1; + +#ifdef DEBUG +printf ("nl_00107.c:\n"); +#endif + + if ((wr= lmd_new_word_ref ()) == (struct WORD_REF *) 0) return -1L; + + if (lmd_find_word_ref (f_wr, yt->YT_info, wr) == 0) + { +#ifdef DEBUG +printf ("nl_00107.c: word_ref gefunden, reading docinfo list\n"); +#endif + + yt->YT_info= (long) wr; + doc_items_read= lmd_read_document_info_list (f_di, + &wr->WR_ytree, + wr->WR_docinfo_offset, + wr->WR_docinfo_count); + + lmdd->LMDD_doc_items_written += doc_items_read; + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00107.o b/lib/ds/lmd/nl_00107.o new file mode 100644 index 0000000000000000000000000000000000000000..aae2e20b0bac2088eb7ac6e0ea8e709c53dd65c6 Binary files /dev/null and b/lib/ds/lmd/nl_00107.o differ diff --git a/lib/ds/lmd/nl_00108.c b/lib/ds/lmd/nl_00108.c new file mode 100644 index 0000000000000000000000000000000000000000..306e9b04c8e3e5b01945481b1fe892c51f336948 --- /dev/null +++ b/lib/ds/lmd/nl_00108.c @@ -0,0 +1,44 @@ +/* + * FILE %ds/lmd/nl_00108.c + * + * scan in a word ref item + * + * written: 1994-02-21 + * latest update: 1995-07-30 + * $Id: nl_00108.c,v 1.3 2002/12/24 07:00:51 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/lookup.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int lmd_read_word_ref (FILE *fi_word_ref, struct WORD_REF *wr) +{ +#ifdef DEBUG +printf ("nl_00108:\n"); +#endif /* DEBUG */ + + if (wr == (struct WORD_REF *) 0) return -1; + + wr->WR_count= dpp_fread_long (fi_word_ref, 4); + + /* CLEANUP: these variables are only used temporarily */ + wr->WR_docinfo_offset= dpp_fread_long (fi_word_ref, 4); + wr->WR_docinfo_count= dpp_fread_long (fi_word_ref, 4); + +#ifdef DEBUG +printf ("nl_00108: cnt=%ld doc_off=0x%08lX doc_cnt=%ld\n", +wr->WR_count, wr->WR_docinfo_offset, wr->WR_docinfo_count); +#endif /* DEBUG */ + + if (feof (fi_word_ref)) return 0; + + return 1; +} diff --git a/lib/ds/lmd/nl_00108.o b/lib/ds/lmd/nl_00108.o new file mode 100644 index 0000000000000000000000000000000000000000..050d9c723ab362b81489c140817e702fd43b5118 Binary files /dev/null and b/lib/ds/lmd/nl_00108.o differ diff --git a/lib/ds/lmd/nl_00109.c b/lib/ds/lmd/nl_00109.c new file mode 100644 index 0000000000000000000000000000000000000000..940837efb9234cde2eb867d564f3af089b8d17ee --- /dev/null +++ b/lib/ds/lmd/nl_00109.c @@ -0,0 +1,83 @@ +/* + * FILE %nl_kr/lib/nl_00109.c + * + * read a document info list + * + * written: 1993-02-28 + * latest update: 1995-12-06 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/lookup.h> +#include <gg/dpp.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +long lmd_read_document_info_list ( +FILE *fi, +struct YTREE **wrl_ytree, +long offset, +long cnt) +{ + struct DOCUMENT_INFO *di; + long items_read= 0L; + char docid_str [10]; + long doc_id; + long hit_count; + long pos; + + pos= (sizeof (struct DOCUMENT_INFO)) * offset; + fseek (fi, pos, 0); + +#ifdef DEBUG +printf ("nl_00109: read doc info: offset=%ld pos=0x%08lX\n", offset, pos); +#endif + + for (; cnt > 0L; cnt--) + { + for (;;) + { + doc_id= dpp_fread_long (fi, 4); + hit_count= dpp_fread_long (fi, 4); + + if (feof (fi)) return -1; + if (doc_id != 0xFFFFFFFE) break; + + /* partial dump continuation entry */ + fseek (fi, hit_count, 0); + } + + if ((di= lmd_new_document_info ()) == (struct DOCUMENT_INFO *) 0) + return -1; + + long_to_hex (doc_id, docid_str); +#ifdef DEBUG +printf ("nl_00109: doc_id=0x%08lX -> %s (%ld)\n", doc_id, docid_str, doc_id); +#endif + + di->DI_document_id= doc_id; + di->DI_hit_count= hit_count; + +#ifdef LMD_EXTENDED_MODEL + { + int i; + long doc_ptr; + + doc_ptr= dpp_fread_long (fi, 4); + di->DI_document_ptr= doc_ptr; + for (i= 0; i < MAX_DI_POS; i++) + di->DI_pos [i]= dpp_fread_long (fi, 4); + } +#endif /* LMD_EXTENDED_MODEL */ + + /* SORT_DOCID: sortieren nach document_id */ + lmd_docid_list_insert (di, wrl_ytree, docid_str); + + items_read++; + } + + return items_read; +} diff --git a/lib/ds/lmd/nl_00109.o b/lib/ds/lmd/nl_00109.o new file mode 100644 index 0000000000000000000000000000000000000000..237c757952c0dbc06570786ac52c18456c6fc601 Binary files /dev/null and b/lib/ds/lmd/nl_00109.o differ diff --git a/lib/ds/lmd/nl_00111.c b/lib/ds/lmd/nl_00111.c new file mode 100644 index 0000000000000000000000000000000000000000..7b366634d74ca46a67fa43b0c02221596e5c2d10 --- /dev/null +++ b/lib/ds/lmd/nl_00111.c @@ -0,0 +1,31 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00111.c + * + * delete all references do a specified document from the + * associated with a certain word reference + * + * written: 1993-02-28 + * latest update: 1995-07-22 + * + */ + +#include <gg/ytree.h> +#include <gg/lookup.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int lmd_discard_doc_id (struct YTREE *yt, void *client_data) +{ + struct WORD_REF *wr; + + if (yt != (struct YTREE *) 0 + && (wr= (struct WORD_REF *) yt->YT_info) != (struct WORD_REF *) 0) + { + ytree_process (wr->WR_ytree, lmd_discard_document_node, client_data); + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00111.o b/lib/ds/lmd/nl_00111.o new file mode 100644 index 0000000000000000000000000000000000000000..029a0c0432fe015027871cd0961915e060c86680 Binary files /dev/null and b/lib/ds/lmd/nl_00111.o differ diff --git a/lib/ds/lmd/nl_00112.c b/lib/ds/lmd/nl_00112.c new file mode 100644 index 0000000000000000000000000000000000000000..7dfea8c2eecaf6c1532c6428021258d9d6c0fb05 --- /dev/null +++ b/lib/ds/lmd/nl_00112.c @@ -0,0 +1,30 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00112.c + * + * free a list of docdir records + * + * written: 1993-03-07 + * latest update: 1995-07-16 + * + */ + +#include <stdlib.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_free_docdir_list (struct DOCDIR_LIST *dl1) +{ + struct DOCDIR_LIST *dl2; + + for (dl2= dl1; dl2 != (struct DOCDIR_LIST *) 0;) + { + dl1= dl2->DL_next; + if (dl2->DL_name != (char *) 0) free (dl2->DL_name); + if (dl2->DL_path != (char *) 0) free (dl2->DL_path); + if (dl2->DL_file != (char *) 0) free (dl2->DL_file); + free (dl2); + dl2= dl1; + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00112.o b/lib/ds/lmd/nl_00112.o new file mode 100644 index 0000000000000000000000000000000000000000..06c1493ed76d67bc83f2a195596e6a4d8eff0ef1 Binary files /dev/null and b/lib/ds/lmd/nl_00112.o differ diff --git a/lib/ds/lmd/nl_00113.c b/lib/ds/lmd/nl_00113.c new file mode 100644 index 0000000000000000000000000000000000000000..3da1864cf42822c2405c6f956b1ec00e4f954217 --- /dev/null +++ b/lib/ds/lmd/nl_00113.c @@ -0,0 +1,70 @@ +/* + * FILE %nl_kr/lib/nl_00113.c + * + * print a document hit list as gopher index + * + * written: 1993-03-07 + * latest update: 1995-12-05 + * $Id: nl_00113.c,v 1.3 2001/09/10 06:58:38 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/hyx.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct DOCDIR_LIST *lmd_read_docdir_info ( +char *document_dir, +struct WORD_REF_LIST *wrl) +{ + struct DOCDIR_LIST *dl1= (void *) 0; + struct DOCDIR_LIST *dl2; + struct DOCDIR_LIST **dlapp; + FILE *fi; + int rc; + long docid; + char *line1= (char *) 0; + char *line2= (char *) 0; +#define MAX_LINE 2048 + + if (document_dir == (char *) 0 + || *document_dir == 0 + || (line1= malloc (MAX_LINE)) == (char *) 0 + || (line2= malloc (MAX_LINE)) == (char *) 0 + || (fi= fopen (document_dir, "r")) == (FILE *) 0 + ) goto END; + + dlapp= &dl1; + + for (;;) + { +NEXT: + rc= fread_line (fi, line1, MAX_LINE); + if (rc < 0 && feof (fi)) break; + if (rc == 0) continue; + + if (find_attr_value (line1, line2, MAX_LINE, "docid") != 0) goto NEXT; + docid= get_parameter_value (line2); + + if ((dl2= lmd_get_docdir_info (line1, line2, MAX_LINE, docid, wrl)) + != (void *) 0) + { + *dlapp= dl2; + dlapp= &dl2->DL_next; + } + } + + fclose (fi); + +END: + free_or_what (line1); + free_or_what (line2); + + return dl1; +} diff --git a/lib/ds/lmd/nl_00113.o b/lib/ds/lmd/nl_00113.o new file mode 100644 index 0000000000000000000000000000000000000000..45a9928a30ca7a5138785fc750f343805edf7966 Binary files /dev/null and b/lib/ds/lmd/nl_00113.o differ diff --git a/lib/ds/lmd/nl_00114.c b/lib/ds/lmd/nl_00114.c new file mode 100644 index 0000000000000000000000000000000000000000..dc309916259eb0a830a2124ff7f84e3eac4eb125 --- /dev/null +++ b/lib/ds/lmd/nl_00114.c @@ -0,0 +1,80 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00114.c + * + * print a document hit list as gopher index + * + * written: 1994-08-01: isolated from nl_00110.c + * latest update: 1995-07-22 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/hyx.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct DOCDIR_LIST *lmd_get_docdir_info ( +char *line1, +char *line2, +int MAX_LINE, +long docid, +struct WORD_REF_LIST *wrl) +{ + struct DOCUMENT_INFO_LIST *start; + struct DOCDIR_LIST *dl1= (struct DOCDIR_LIST *) 0; + struct DOCDIR_LIST *dl2; + struct DOCDIR_LIST **dlapp; + + dlapp= &dl1; + + for (; wrl != (struct WORD_REF_LIST *) 0; wrl= wrl->WRL_next) + for (start= wrl->WRL_dil; + start != (struct DOCUMENT_INFO_LIST *) 0; + start= start->DIL_next) + if (start->DIL->DI_document_id == docid) + { + if (find_attr_value (line1, line2, MAX_LINE, "name") != 0) + return (struct DOCDIR_LIST *) 0; + + dl2= (struct DOCDIR_LIST *) calloc (sizeof (struct DOCDIR_LIST), 1); + dl2->DL_di= start->DIL; + + dl2->DL_name= strdup (line2); + + if (find_attr_value (line1, line2, MAX_LINE, "path") == 0) + dl2->DL_path= strdup (line2); + + if (find_attr_value (line1, line2, MAX_LINE, "file") == 0) + dl2->DL_file= strdup (line2); + + if (find_attr_value (line1, line2, MAX_LINE, "from") == 0) + dl2->DL_from= get_parameter_value (line2); + + if (find_attr_value (line1, line2, MAX_LINE, "to") == 0) + dl2->DL_to= get_parameter_value (line2); + + if (find_attr_value (line1, line2, MAX_LINE, "size") == 0) + dl2->DL_size= get_parameter_value (line2); + + if (find_attr_value (line1, line2, MAX_LINE, "lfrom") == 0) + dl2->DL_lfrom= get_parameter_value (line2); + + if (find_attr_value (line1, line2, MAX_LINE, "lto") == 0) + dl2->DL_lto= get_parameter_value (line2); + + if (find_attr_value (line1, line2, MAX_LINE, "lines") == 0) + dl2->DL_lines= get_parameter_value (line2); + + *dlapp= dl2; + + dlapp= &dl2->DL_next; + break; /* ???? */ + } + + free (line2); + + return dl1; +} diff --git a/lib/ds/lmd/nl_00114.o b/lib/ds/lmd/nl_00114.o new file mode 100644 index 0000000000000000000000000000000000000000..e9bd527a477ced7e2101dc2790993636b73998ab Binary files /dev/null and b/lib/ds/lmd/nl_00114.o differ diff --git a/lib/ds/lmd/nl_00115.c b/lib/ds/lmd/nl_00115.c new file mode 100644 index 0000000000000000000000000000000000000000..15ea9491abbe65badddaa31df627672b88173114 --- /dev/null +++ b/lib/ds/lmd/nl_00115.c @@ -0,0 +1,32 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00115.c + * + * seek word ref information by index + * + * written: 1994-07-31: isolated from nl_00114.c + * latest update: 1995-07-30 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_find_word_ref ( +FILE *f_wr, +long w_info, +struct WORD_REF *wr) +{ + long pos; + + pos= WORD_REF_SIZE * w_info; + +#ifdef DEBUG +printf ("nl_00115: w_info=0x%08lX, pos=0x%08lX\n", w_info, pos); +#endif /* DEBUG */ + + fseek (f_wr, pos, 0); + if (lmd_read_word_ref (f_wr, wr) != 1) return -1; + + return 0; +} diff --git a/lib/ds/lmd/nl_00115.o b/lib/ds/lmd/nl_00115.o new file mode 100644 index 0000000000000000000000000000000000000000..39afdc045ad3955d99fa8aaa76a66e7c9bc5b9be Binary files /dev/null and b/lib/ds/lmd/nl_00115.o differ diff --git a/lib/ds/lmd/nl_00116.c b/lib/ds/lmd/nl_00116.c new file mode 100644 index 0000000000000000000000000000000000000000..b1a4947ccd13a7d5701e8ef336c19f12b89b565f --- /dev/null +++ b/lib/ds/lmd/nl_00116.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/lmd/nl_00116.c + * + * print word reference information + * + * written: 1994-07-31 + * latest update: 1995-12-26 + * $Id: nl_00116.c,v 1.2 2001/08/26 23:26:02 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_print_word_ref_info (FILE *fo, struct WORD_REF *wr) +{ + if (fo == (FILE *) 0 || wr == (struct WORD_REF *) 0) return -1; + + fprintf (fo, + "count: %ld\n", + wr->WR_count); + + /* CLEANUP: these variables are only used temporarily */ + fprintf (fo, + "doc_offset: 0x%08lX\ncnt: %ld\n", + wr->WR_docinfo_offset, + wr->WR_docinfo_count); + + return 0; +} diff --git a/lib/ds/lmd/nl_00116.o b/lib/ds/lmd/nl_00116.o new file mode 100644 index 0000000000000000000000000000000000000000..28c29f1e41c07742a7c0cec94949ef3aee6ae465 Binary files /dev/null and b/lib/ds/lmd/nl_00116.o differ diff --git a/lib/ds/lmd/nl_00117.c b/lib/ds/lmd/nl_00117.c new file mode 100644 index 0000000000000000000000000000000000000000..7bd1df38054535d9ae684dac96754d20dc8d70ba --- /dev/null +++ b/lib/ds/lmd/nl_00117.c @@ -0,0 +1,42 @@ +/* + * FILE %nl_kr/lib/nl_00117.c + * + * print a document hit list + * + * written: 1993-02-28 + * latest update: 1995-12-05 + * $Id: nl_00117.c,v 1.3 2002/01/29 08:01:42 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_print_doc_hit_list_stdout ( +struct WORD_REF_LIST *wrl, +int print_dil) +{ + lmd_print_doc_hit_list (stdout, wrl, print_dil); +} + +/* ------------------------------------------------------------------------ */ +int lmd_print_doc_hit_list ( +FILE *fo, +struct WORD_REF_LIST *wrl, +int print_dil) +{ + struct DOCUMENT_INFO_LIST *start; + + for (; wrl != (struct WORD_REF_LIST *) 0; wrl= wrl->WRL_next) + { + printf ("\n--------------------\n"); + printf ("word: %s\n", wrl->WRL_string); + lmd_print_word_ref_info (fo, &wrl->WRL); + + if (print_dil && (start= wrl->WRL_dil) != (struct DOCUMENT_INFO_LIST *) 0) + lmd_print_document_info_list (fo, wrl->WRL_dil); + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00117.o b/lib/ds/lmd/nl_00117.o new file mode 100644 index 0000000000000000000000000000000000000000..59b9c55c96b2c3242e4378133c33dcb13ec81568 Binary files /dev/null and b/lib/ds/lmd/nl_00117.o differ diff --git a/lib/ds/lmd/nl_00118.c b/lib/ds/lmd/nl_00118.c new file mode 100644 index 0000000000000000000000000000000000000000..de051981be461acca84b20f268fa2758dc4d14a6 --- /dev/null +++ b/lib/ds/lmd/nl_00118.c @@ -0,0 +1,64 @@ +/* + * FILE %nl_kr/lib/nl_00118.c + * + * print a document hit list + * + * written: 1993-02-28 + * latest update: 1995-12-05 + * $Id: nl_00118.c,v 1.4 2002/02/04 08:13:08 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_print_document_info_list_stdout (struct DOCUMENT_INFO_LIST *start) +{ + return lmd_print_document_info_list (stdout, start); +} + +/* ------------------------------------------------------------------------ */ +int lmd_print_document_info_list ( +FILE *fo, +struct DOCUMENT_INFO_LIST *start) +{ + struct DOCUMENT_INFO *di; + + fprintf (fo, "rem: hits doc_id"); + +#ifdef LMD_EXTENDED_MODEL + { + int i; + fprintf (fo, " doc_ptr"); + for (i= 0; i < MAX_DI_POS; i++) fprintf (fo, " position"); + } +#endif /* LMD_EXTENDED_MODEL */ + + fputc ('\n', fo); + + for (; start != (struct DOCUMENT_INFO_LIST *) 0; start= start->DIL_next) + { + if ((di= start->DIL) == (struct DOCUMENT_INFO *) 0) continue; +/********** +fprintf (fo, ">>> dil=0x%08LX di=0x%08lX next=%08lX\n", +start, di, start->DIL_next); +*********/ + + fprintf (fo, "hit: %5ld %8ld", di->DI_hit_count, di->DI_document_id); + +#ifdef LMD_EXTENDED_MODEL + { + int i; + + fprintf (fo, " 0x%08lX", di->DI_document_ptr); + for (i= 0; i < MAX_DI_POS; i++) + fprintf (fo, " 0x%08lX", di->DI_pos [i]); + } +#endif /* LMD_EXTENDED_MODEL */ + + fputc ('\n', fo); + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00118.o b/lib/ds/lmd/nl_00118.o new file mode 100644 index 0000000000000000000000000000000000000000..c3ab2e178496f4832fafb32fc5480fd314e0afe0 Binary files /dev/null and b/lib/ds/lmd/nl_00118.o differ diff --git a/lib/ds/lmd/nl_00119.c b/lib/ds/lmd/nl_00119.c new file mode 100644 index 0000000000000000000000000000000000000000..8d316557cbfebda7de8fa6a0c885e889486b0dad --- /dev/null +++ b/lib/ds/lmd/nl_00119.c @@ -0,0 +1,39 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00119.c + * + * print veronica style results + * + * written: 1993-05-01 + * latest update: 1995-07-19 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_print_veronica_hit_list ( +FILE *fo, +char *veronica_file, +struct WORD_REF_LIST *wrl) +{ + FILE *vf; + int lines= 0; + + if (wrl == (struct WORD_REF_LIST *) 0) return 0; + + if ((vf= fopen (veronica_file, "rb")) == (FILE *) 0) + { + fprintf (stderr, "can't open veronica file %s\n", veronica_file); + return -1; + } + + for (; wrl != (struct WORD_REF_LIST *) 0; wrl= wrl->WRL_next) + { + lines += lmd_print_veronica_docinfo_list (fo, vf, wrl->WRL_dil); + } + + fclose (vf); + + return lines; +} diff --git a/lib/ds/lmd/nl_00119.o b/lib/ds/lmd/nl_00119.o new file mode 100644 index 0000000000000000000000000000000000000000..f78457d643790a15fa10789edf78b3be90afdc1d Binary files /dev/null and b/lib/ds/lmd/nl_00119.o differ diff --git a/lib/ds/lmd/nl_00120.c b/lib/ds/lmd/nl_00120.c new file mode 100644 index 0000000000000000000000000000000000000000..a06c631a92892335851910cbd9aea710fc989c13 --- /dev/null +++ b/lib/ds/lmd/nl_00120.c @@ -0,0 +1,44 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00120.c + * + * print veronica style results + * + * written: 1993-05-01 + * 1994-08-01: isolated from print_veronica_hit_list + * latest update: 1995-07-16 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +int lmd_print_veronica_docinfo_list ( +FILE *fo, +FILE *vf, +struct DOCUMENT_INFO_LIST *start) +{ + long offset; + int lines= 0; + struct DOCUMENT_INFO *di; + + for (; + start != (struct DOCUMENT_INFO_LIST *) 0; + start= start->DIL_next) + { + if ((di= start->DIL) == (struct DOCUMENT_INFO *) 0) continue; + + offset= di->DI_document_id -1L; + fseek (vf, offset, 0L); + +#ifdef DEBUG + printf ("nl_00120: offset=%ld (0x%08lX)\n", offset, offset); +#endif + + ftransfer_line (vf, fo, 0x7FFFFFFFL); + lines++; + } + + return lines; +} diff --git a/lib/ds/lmd/nl_00120.o b/lib/ds/lmd/nl_00120.o new file mode 100644 index 0000000000000000000000000000000000000000..f8f640038a715b9b2c7eb527c419194fbd33e61b Binary files /dev/null and b/lib/ds/lmd/nl_00120.o differ diff --git a/lib/ds/lmd/nl_00121.c b/lib/ds/lmd/nl_00121.c new file mode 100644 index 0000000000000000000000000000000000000000..d3c299f1dc6b149ab9d69f31f833e6f5a87091c7 --- /dev/null +++ b/lib/ds/lmd/nl_00121.c @@ -0,0 +1,36 @@ +/* + * FILE %nl_kr/lib/nl_00121.c + * + * print a document hit list as hypertext link page + * + * written: 1993-03-07 + * latest update: 1995-12-05 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_print_hyx_hit_list ( +FILE *fo, +char *document_dir, +struct WORD_REF_LIST *wrl) +{ + struct DOCDIR_LIST *dl1= (struct DOCDIR_LIST *) 0; + + if (wrl == (struct WORD_REF_LIST *) 0) return -1; + + if ((dl1= lmd_read_docdir_info (document_dir, wrl)) + != (struct DOCDIR_LIST *) 0) + { + lmd_print_docdir_hyx (fo, dl1); + lmd_free_docdir_list (dl1); + } + else + { + lmd_print_hyx_cluster_hit_list (fo, wrl, (char *) 0); + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00121.o b/lib/ds/lmd/nl_00121.o new file mode 100644 index 0000000000000000000000000000000000000000..c87f42e2a2d871ae7ce0520b4ba22b4e82959970 Binary files /dev/null and b/lib/ds/lmd/nl_00121.o differ diff --git a/lib/ds/lmd/nl_00122.c b/lib/ds/lmd/nl_00122.c new file mode 100644 index 0000000000000000000000000000000000000000..ca1e2ab19c1ce0d39df0afe15188dee5c7786e71 --- /dev/null +++ b/lib/ds/lmd/nl_00122.c @@ -0,0 +1,29 @@ +/* + * FILE %nl_kr/lib/nl_00122.c + * + * print a document hit list as hypertext link page + * + * written: 1994-08-01 + * latest update: 1995-12-05 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_print_docdir_hyx (FILE *fo, struct DOCDIR_LIST *docdir) +{ + fprintf (fo, " (hits) name\n------------------\n"); + + for (; docdir != (struct DOCDIR_LIST *) 0;) + { + fprintf (fo, + "<hyx.l file=\"%s\">* (%4ld) %s\n", + docdir->DL_file, + docdir->DL_di->DI_hit_count, + docdir->DL_name); + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00122.o b/lib/ds/lmd/nl_00122.o new file mode 100644 index 0000000000000000000000000000000000000000..401d0e8e8ff7962bde64d08462045685d90aa198 Binary files /dev/null and b/lib/ds/lmd/nl_00122.o differ diff --git a/lib/ds/lmd/nl_00123.c b/lib/ds/lmd/nl_00123.c new file mode 100644 index 0000000000000000000000000000000000000000..d436d5a60f0219339808cef0561890b55ff0251c --- /dev/null +++ b/lib/ds/lmd/nl_00123.c @@ -0,0 +1,36 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00123.c + * + * print a document hit list as gopher index + * + * written: 1993-03-07 + * latest update: 1995-07-16 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_print_gopher_hit_list ( +FILE *fo, +char *document_dir, +struct WORD_REF_LIST *wrl, +char *path_prefix, +char *item_type, +char *host_name, +long port_number) +{ + struct DOCDIR_LIST *dl1; + int lines= 0; + + if (wrl == (struct WORD_REF_LIST *) 0 + || (dl1= lmd_read_docdir_info (document_dir, wrl)) + == (struct DOCDIR_LIST *) 0) return -1; + + lines= lmd_print_docdir_gopher (fo, dl1, path_prefix, item_type, + host_name, port_number); + lmd_free_docdir_list (dl1); + + return lines; +} diff --git a/lib/ds/lmd/nl_00123.o b/lib/ds/lmd/nl_00123.o new file mode 100644 index 0000000000000000000000000000000000000000..c2b394aaf1b2f01d958004961b1f55741161f16c Binary files /dev/null and b/lib/ds/lmd/nl_00123.o differ diff --git a/lib/ds/lmd/nl_00124.c b/lib/ds/lmd/nl_00124.c new file mode 100644 index 0000000000000000000000000000000000000000..95e7177731939533dd6ce9b444fd3b367cf5c8e6 --- /dev/null +++ b/lib/ds/lmd/nl_00124.c @@ -0,0 +1,64 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00124.c + * + * print a document hit list as gopher index + * + * written: 1993-03-07 + * latest update: 1995-07-16 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_print_docdir_gopher ( +FILE *fo, +struct DOCDIR_LIST *dl2, +char *path_prefix, +char *item_type, +char *host_name, +long port_number) +{ + int lines= 0; + + while (dl2 != (struct DOCDIR_LIST *) 0) + { + fprintf (fo, "%s[%ld] %s\t", + item_type, + dl2->DL_di->DI_hit_count, + dl2->DL_name); + + if (dl2->DL_path != (char *) 0) + { /* use predefined gopher path string */ + fprintf (fo, "%s", dl2->DL_path); + } + else + { /* generate a gopher path string */ + if (dl2->DL_from != 0L + && (dl2->DL_to != 0L || dl2->DL_size != 0L)) + { + fprintf (fo, "R%08ld-%08ld-", + dl2->DL_from, + (dl2->DL_to != 0L) ? dl2->DL_to : (dl2->DL_from + dl2->DL_size)); + } + + fprintf (fo, "%s%ld", + path_prefix, + dl2->DL_di->DI_document_id); + + if (dl2->DL_lfrom != 0L + && (dl2->DL_lto != 0L || dl2->DL_lines != 0L)) + { + fprintf (fo, ":%ld:%ld", + dl2->DL_lfrom, + (dl2->DL_lto != 0L) ? dl2->DL_lto : (dl2->DL_lfrom + dl2->DL_lines)); + } + } + + fprintf (fo, "\t%s\t%ld\n", host_name, port_number); + lines++; + } + + return lines; +} diff --git a/lib/ds/lmd/nl_00124.o b/lib/ds/lmd/nl_00124.o new file mode 100644 index 0000000000000000000000000000000000000000..8d012d2eb8e533a18aa2d56411c7425822cae004 Binary files /dev/null and b/lib/ds/lmd/nl_00124.o differ diff --git a/lib/ds/lmd/nl_00125.c b/lib/ds/lmd/nl_00125.c new file mode 100644 index 0000000000000000000000000000000000000000..30c87e894626086de29b54bb0b7ff983f9dc6eba --- /dev/null +++ b/lib/ds/lmd/nl_00125.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/lmd/nl_00125.c + * + * dump a word ref record + * + * written: 1994-08-03 + * latest update: 1995-12-26 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +long lmd_write_word_ref ( +FILE *fo_word_ref, +struct WORD_REF *wr, +long doc_items_offset, +long doc_items_written) +{ + if (fo_word_ref == (FILE *) 0 || wr == (struct WORD_REF *) 0) return -1; + + dpp_fwrite_long (fo_word_ref, wr->WR_count, 4); + + /* CLEANUP: these variables are only used temporarily */ + dpp_fwrite_long (fo_word_ref, doc_items_offset, 4); + dpp_fwrite_long (fo_word_ref, doc_items_written, 4); + + return 0; +} diff --git a/lib/ds/lmd/nl_00125.o b/lib/ds/lmd/nl_00125.o new file mode 100644 index 0000000000000000000000000000000000000000..85651109658a546e9c0ebef4ed6b0475a932e36c Binary files /dev/null and b/lib/ds/lmd/nl_00125.o differ diff --git a/lib/ds/lmd/nl_00126.c b/lib/ds/lmd/nl_00126.c new file mode 100644 index 0000000000000000000000000000000000000000..bac9b5035672072b556467bb613363cc24512984 --- /dev/null +++ b/lib/ds/lmd/nl_00126.c @@ -0,0 +1,40 @@ +/* + * FILE %ds/lmd/nl_00126.c + * + * read a document info list + * + * written: 1994-08-23 + * latest update: 1996-08-08 17:22:59 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/lookup.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int lmd_docid_list_insert ( +struct DOCUMENT_INFO *element, +struct YTREE **wrl_ytree, +char *docid_str) +{ + struct YTREE *yt; + + if (element == (struct DOCUMENT_INFO *) 0) return -1; + +#ifdef DEBUG + printf ("nl_00126: docid_str='%s'\n", docid_str); +#endif + + if (wrl_ytree != (struct YTREE **) 0 + && (yt= ytree_insert_word (wrl_ytree, (unsigned char *) docid_str)) + != (struct YTREE *) 0) + { + yt->YT_flags |= YTflag_EOW; + yt->YT_info= (long) element; + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00126.o b/lib/ds/lmd/nl_00126.o new file mode 100644 index 0000000000000000000000000000000000000000..5f4ead9848c0af329b51aedc8c4f89961807b7bf Binary files /dev/null and b/lib/ds/lmd/nl_00126.o differ diff --git a/lib/ds/lmd/nl_00127.c b/lib/ds/lmd/nl_00127.c new file mode 100644 index 0000000000000000000000000000000000000000..b4ee104e70c4351ad0c7178f3e624b9ac13eed9d --- /dev/null +++ b/lib/ds/lmd/nl_00127.c @@ -0,0 +1,41 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00127.c + * + * construct a TERM structure + * + * written: 1994-08-24 + * latest update: 1995-07-31 + * + */ + +#ifdef DEBUG +#include <stdio.h> +#endif +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct TERM_EVAL *lmd_build_term_eval (char *str, struct WORD_REF_LIST *wrl) +{ + struct TERM_EVAL *te; + + if ((te= lmd_new_term_eval ()) != (struct TERM_EVAL *) 0) + { + te->TE_string= strdup (str); + te->TE_wrl= wrl; + te->TE_operator= lmd_get_interpretation (str); + +#ifdef DEBUG + printf ("lmd_build_term_eval: op=0x%08lX\n", te->TE_operator); +#endif /* DEBUG */ + + if (wrl != (struct WORD_REF_LIST *) 0) + { + te->TE_dil= wrl->WRL_dil; + } + } + + return te; +} diff --git a/lib/ds/lmd/nl_00127.o b/lib/ds/lmd/nl_00127.o new file mode 100644 index 0000000000000000000000000000000000000000..41c729bfdb49398fe061b6532a194cc3fb2587ed Binary files /dev/null and b/lib/ds/lmd/nl_00127.o differ diff --git a/lib/ds/lmd/nl_00128.c b/lib/ds/lmd/nl_00128.c new file mode 100644 index 0000000000000000000000000000000000000000..cd6edce12a02e863dda6516b72b8539024369911 --- /dev/null +++ b/lib/ds/lmd/nl_00128.c @@ -0,0 +1,94 @@ +/* + * FILE %ds/lmd/nl_00128.c + * + * construct a TERM structure + * + * written: 1994-08-24 + * latest update: 1995-12-26 + * $Id: nl_00128.c,v 1.4 2001/08/27 15:29:02 gonter Exp $ + * + */ + +/** #define DEBUG **/ +#ifdef DEBUG +#include <stdio.h> +#endif /* DEBUG */ + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct TERM_EVAL *lmd_evaluate_terms ( +struct TERM_EVAL *te_list, +long opcode) +{ + struct TERM_EVAL *te; + struct TERM_EVAL *tte; + struct DOCUMENT_INFO_LIST *dil_opr; + struct DOCUMENT_INFO_LIST *dil_acc= (struct DOCUMENT_INFO_LIST *) 0; + struct WORD_REF_LIST *wrl; + long interpr; + int elements= 0; + + if ((tte= lmd_new_term_eval ()) == (struct TERM_EVAL *) 0) goto END; + + for (te= te_list; te != (struct TERM_EVAL *) 0; te= te->TE_right) + { +#ifdef DEBUG + printf ("evaluate: %s %ld\n", te->TE_string, te->TE_operator); +#endif /* DEBUG */ + + if ((interpr= te->TE_operator) == WRint_ignore) continue; + + if (interpr == WRint_logic_and || interpr == WRint_logic_or) + { + opcode= interpr; + continue; /* don't perform operations involving the operator!!! */ + } + + if ((wrl= te->TE_wrl) != (struct WORD_REF_LIST *) 0) + { +#ifdef DEBUG +printf ("wrl=0x%08lX wrl->WRL_string='%s', WRL=...\n", wrl, wrl->WRL_string); +lmd_print_word_ref_info (stdout, &wrl->WRL); +#endif /* DEBUG */ + + if (wrl->WRL.WR_count < 0 /* huh? seems like dead code */ + || wrl->WRL.WR_docinfo_count == 0 + ) + { /* Stop Word? Don't use Stop Words in the evaluation */ + /* GG 1995-12-15 14:23:42 */ + continue; + } + } + + dil_opr= lmd_dil_accumulate (te->TE_wrl); + +#ifdef DEBUG +printf ("=========================\n"); +printf ("accumulator:\n"); +lmd_print_document_info_list (stdout, dil_acc); +printf ("-------------------------\n"); +printf ("add:\n"); +lmd_print_document_info_list (stdout, dil_opr); +printf ("-------------------------\n"); +#endif /* DEBUG */ + + dil_acc= (elements++ > 0) + ? lmd_dil_operator (dil_acc, dil_opr, opcode) + : dil_opr; + +#ifdef DEBUG +printf ("result:\n"); +lmd_print_document_info_list (stdout, dil_acc); +printf ("=========================\n"); +#endif /* DEBUG */ + } + + tte->TE_dil= dil_acc; + +END: + return tte; +} diff --git a/lib/ds/lmd/nl_00128.o b/lib/ds/lmd/nl_00128.o new file mode 100644 index 0000000000000000000000000000000000000000..07ad0ba7e34824de62c89406f5eadb944a53e974 Binary files /dev/null and b/lib/ds/lmd/nl_00128.o differ diff --git a/lib/ds/lmd/nl_00129.c b/lib/ds/lmd/nl_00129.c new file mode 100644 index 0000000000000000000000000000000000000000..f1024be4ed48f6db1ab3a309e9171b3119686f50 --- /dev/null +++ b/lib/ds/lmd/nl_00129.c @@ -0,0 +1,44 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00129.c + * + * construct a TERM structure + * + * written: 1994-08-27 + * latest update: 1995-07-31 + * + */ + +#ifdef DEBUG +#include <stdio.h> +#endif /* DEBUG */ + +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct DOCUMENT_INFO_LIST *lmd_dil_accumulate (struct WORD_REF_LIST *wrl) +{ + struct DOCUMENT_INFO_LIST *dil= (struct DOCUMENT_INFO_LIST *) 0; + + for (; wrl != (struct WORD_REF_LIST *) 0; wrl= wrl->WRL_next) + { +#ifdef DEBUG +printf ("=========================\n"); +printf ("accumulator:\n"); +lmd_print_document_info_list (stdout, dil); +printf ("-------------------------\n"); +printf ("add:\n"); +lmd_print_document_info_list (stdout, wrl->WRL_dil); +printf ("-------------------------\n"); +#endif /* DEBUG */ + + dil= lmd_dil_operator (dil, wrl->WRL_dil, (long) WRint_logic_or); + +#ifdef DEBUG +printf ("result:\n"); +lmd_print_document_info_list (stdout, dil); +printf ("=========================\n"); +#endif /* DEBUG */ + } + + return dil; +} diff --git a/lib/ds/lmd/nl_00129.o b/lib/ds/lmd/nl_00129.o new file mode 100644 index 0000000000000000000000000000000000000000..dba58e48990033cec9e9a199dc6ebfdba151c5cb Binary files /dev/null and b/lib/ds/lmd/nl_00129.o differ diff --git a/lib/ds/lmd/nl_00130.c b/lib/ds/lmd/nl_00130.c new file mode 100644 index 0000000000000000000000000000000000000000..34e0b2cbba452457b4f03adf4bc46e297a3c24ed --- /dev/null +++ b/lib/ds/lmd/nl_00130.c @@ -0,0 +1,47 @@ +/* + * FILE %ds/lmd/nl_00130.c + * + * duplicate a TERM structure + * + * written: 1994-08-27 + * latest update: 1995-07-31 + * $Id: nl_00130.c,v 1.3 2001/08/03 15:51:42 gonter Exp $ + * + */ + +#include <stdlib.h> +#ifndef __GG_CMS__ +#include <memory.h> +#endif +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct DOCUMENT_INFO_LIST *lmd_dil_dup (struct DOCUMENT_INFO_LIST *org) +{ + struct DOCUMENT_INFO_LIST *dup; + + if ((dup= (struct DOCUMENT_INFO_LIST *) malloc ( + sizeof (struct DOCUMENT_INFO_LIST))) + != (struct DOCUMENT_INFO_LIST *) 0) + { + dup->DIL= lmd_di_dup ((struct DOCUMENT_INFO *) org->DIL); + dup->DIL_next= (struct DOCUMENT_INFO_LIST *) 0; + } + + return dup; +} + +/* ------------------------------------------------------------------------ */ +struct DOCUMENT_INFO *lmd_di_dup (struct DOCUMENT_INFO *org) +{ + struct DOCUMENT_INFO *dup; + + if ((dup= (struct DOCUMENT_INFO *) malloc ( + sizeof (struct DOCUMENT_INFO))) + != (struct DOCUMENT_INFO *) 0) + { + memcpy (dup, org, sizeof (struct DOCUMENT_INFO)); + } + + return dup; +} diff --git a/lib/ds/lmd/nl_00130.o b/lib/ds/lmd/nl_00130.o new file mode 100644 index 0000000000000000000000000000000000000000..acf683192fc2964b48074577e4db844002bac13d Binary files /dev/null and b/lib/ds/lmd/nl_00130.o differ diff --git a/lib/ds/lmd/nl_00131.c b/lib/ds/lmd/nl_00131.c new file mode 100644 index 0000000000000000000000000000000000000000..d4806a125de9eb80a32df3141411de5689f3b225 --- /dev/null +++ b/lib/ds/lmd/nl_00131.c @@ -0,0 +1,155 @@ +/* + * FILE %ds/lmd/nl_00131.c + * + * construct a TERM structure by evaluating two term structures + * + * The first list is an accumulator, the second list is the + * added structure. The elements of the second list have to + * be copied, if they are added to the accumulator. + * + * Elements of the accumulator are dropped without freeing. (T2D) + * + * written: 1994-08-27 + * latest update: 1995-07-31 + * $Id: nl_00131.c,v 1.2 2001/08/03 15:51:42 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct DOCUMENT_INFO_LIST *lmd_dil_operator ( +struct DOCUMENT_INFO_LIST *dil_op1, +struct DOCUMENT_INFO_LIST *dil_op2, +long operation) +{ + struct DOCUMENT_INFO_LIST *dil_res= (struct DOCUMENT_INFO_LIST *) 0; + struct DOCUMENT_INFO_LIST **dp= &dil_res; + struct DOCUMENT_INFO_LIST *dd; + struct DOCUMENT_INFO *di1, *di2; + long v1, v2; + long diff; + + for (;;) + { + if (dil_op1 == (struct DOCUMENT_INFO_LIST *) 0 + && dil_op2 == (struct DOCUMENT_INFO_LIST *) 0) + break; + + if (dil_op1 == (struct DOCUMENT_INFO_LIST *) 0) + { + if (operation == WRint_logic_or) + { + for (; + dil_op2 != (struct DOCUMENT_INFO_LIST *) 0; + dil_op2= dil_op2->DIL_next) + { + if ((dd= lmd_dil_dup (dil_op2)) == (struct DOCUMENT_INFO_LIST *) 0) + break; + *dp= dd; + dp= &dd->DIL_next; + } + } + break; + } + + if (dil_op2 == (struct DOCUMENT_INFO_LIST *) 0) + { + *dp= (struct DOCUMENT_INFO_LIST *) 0; + if (operation == WRint_logic_or) *dp= dil_op1; + return dil_res; + } + + if ((di1= dil_op1->DIL) == (struct DOCUMENT_INFO *) 0) + { + fprintf (stderr, "nl_00131(66): internal error, no DI!\n"); + dil_op1= dil_op1->DIL_next; + continue; + } + + if ((di2= dil_op2->DIL) == (struct DOCUMENT_INFO *) 0) + { + fprintf (stderr, "nl_00131(73): internal error, no DI!\n"); + dil_op1= dil_op2->DIL_next; + continue; + } + + v1= di1->DI_document_id; + v2= di2->DI_document_id; + diff= v1 - v2; + +#ifdef DEBUG + printf ("nl_00131: id1=%ld id2=%ld =: diff=%ld, op=0x%lX\n", + v1, v2, diff, operation); +#endif /* DEBUG */ + + if (diff == 0L && (operation == WRint_logic_and + || operation == WRint_logic_or) + ) + { /* the documents is in both lists */ +#ifdef DEBUG + printf ("nl_00131: take 1, adv 1, adv 2\n"); +#endif /* DEBUG */ + + /* add the dil-info from the first list to the result */ + *dp= dil_op1; + dp= &dil_op1->DIL_next; + +#ifdef LMD_EXTENDED_MODEL + di1->DI_pos[0] |= di2->DI_pos[0]; + /* T2D: 2001-08-03 this is used in the freedb search engine! + * There needs to be a more general apporach than this! + */ +#endif /* LMD_EXTENDED_MODEL */ + + dil_op1= dil_op1->DIL_next; + dil_op2= dil_op2->DIL_next; + continue; + } + + if (diff < 0L) + { + if (operation == WRint_logic_or) + { +#ifdef DEBUG + printf ("nl_00131: take 1\n"); +#endif /* DEBUG */ + *dp= dil_op1; + dp= &dil_op1->DIL_next; + } +#ifdef DEBUG + printf ("nl_00131: adv 1\n"); +#endif /* DEBUG */ + dil_op1= dil_op1->DIL_next; + continue; + } + + if (diff > 0L) + { + if (operation == WRint_logic_or) + { +#ifdef DEBUG + printf ("nl_00131: dup 2\n"); +#endif /* DEBUG */ + if ((dd= lmd_dil_dup (dil_op2)) == (struct DOCUMENT_INFO_LIST *) 0) + break; + + *dp= dd; + dp= &dd->DIL_next; + } +#ifdef DEBUG + printf ("nl_00131: adv 2\n"); +#endif /* DEBUG */ + dil_op2= dil_op2->DIL_next; + continue; + } + + fprintf (stderr, "nl_00131: internal error!!!\n"); + break; + } + + *dp= (struct DOCUMENT_INFO_LIST *) 0; + + return dil_res; +} diff --git a/lib/ds/lmd/nl_00131.o b/lib/ds/lmd/nl_00131.o new file mode 100644 index 0000000000000000000000000000000000000000..8a36b413ca178e90777c5c0cda005a7ae5507cb4 Binary files /dev/null and b/lib/ds/lmd/nl_00131.o differ diff --git a/lib/ds/lmd/nl_00132.c b/lib/ds/lmd/nl_00132.c new file mode 100644 index 0000000000000000000000000000000000000000..e9c1b2bc9a542f676d2572c200c2fb511b834e48 --- /dev/null +++ b/lib/ds/lmd/nl_00132.c @@ -0,0 +1,30 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00132.c + * + * find a document in a list + * + * written: 1995-04-01 + * latest update: 1995-07-22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct DOCUMENT_INFO *lmd_find_document_info ( +struct WORD_REF *wr, +char *doc_id_str) +{ + struct YTREE *yt; + + if ((yt= ytree_lookup_word (wr->WR_ytree, (unsigned char *) doc_id_str)) + != (struct YTREE *) 0) + return (struct DOCUMENT_INFO *) yt->YT_info; + + return (struct DOCUMENT_INFO *) 0; +} diff --git a/lib/ds/lmd/nl_00132.o b/lib/ds/lmd/nl_00132.o new file mode 100644 index 0000000000000000000000000000000000000000..ac7bcc012de70882a9742f0f776ca46596cf80f9 Binary files /dev/null and b/lib/ds/lmd/nl_00132.o differ diff --git a/lib/ds/lmd/nl_00133.c b/lib/ds/lmd/nl_00133.c new file mode 100644 index 0000000000000000000000000000000000000000..56790c90bce7162c9664dd2e595f17783923467f --- /dev/null +++ b/lib/ds/lmd/nl_00133.c @@ -0,0 +1,41 @@ +/* + * FILE %nl_kr/lib/nl_00133.c + * + * insert a document in a list + * + * written: 1995-04-01 + * latest update: 1995-12-05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct DOCUMENT_INFO *lmd_insert_document_info ( +struct WORD_REF *wr, +long doc_id, +char *doc_id_str) +{ + struct YTREE *yt; + struct DOCUMENT_INFO *di; + + if ((di= lmd_new_document_info ()) != (struct DOCUMENT_INFO *) 0) + { + di->DI_document_id= doc_id; + + if ((yt= ytree_insert_word (&wr->WR_ytree, (unsigned char *) doc_id_str)) + != (struct YTREE *) 0) + { + yt->YT_info= (long) di; + yt->YT_flags |= YTflag_EOW; + } + } + + return di; +} diff --git a/lib/ds/lmd/nl_00133.o b/lib/ds/lmd/nl_00133.o new file mode 100644 index 0000000000000000000000000000000000000000..77f6e57f2a454d2019c109e0e047af2791cb9eba Binary files /dev/null and b/lib/ds/lmd/nl_00133.o differ diff --git a/lib/ds/lmd/nl_00134.c b/lib/ds/lmd/nl_00134.c new file mode 100644 index 0000000000000000000000000000000000000000..ce3045d9f3a6f50ba9c7fdc11b434f99ee07e64c --- /dev/null +++ b/lib/ds/lmd/nl_00134.c @@ -0,0 +1,48 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00134.c + * + * create a list of document info nodes by traversing a YTREE + * + * written: 1995-07-22 + * latest update: 1995-07-31 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifdef DEBUG +#include <stdio.h> +#endif + +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_create_dil (struct YTREE *yt, void *client_data) +{ + struct DEREF_CONTROL *dc; + struct DOCUMENT_INFO_LIST *dil; + + if (yt == (struct YTREE *) 0) return -1; + if (!(yt->YT_flags & YTflag_EOW)) return 0; + + if ((dc= (struct DEREF_CONTROL *) client_data) + == (struct DEREF_CONTROL *) 0 + || (dil= lmd_new_document_info_list()) + == (struct DOCUMENT_INFO_LIST *) 0) + return -1; + +#ifdef DEBUG + printf ("nl_00134: info=%ld (0x%08lX) flags=0x%04X\n", + yt->YT_info, yt->YT_info, yt->YT_flags); +#endif + + dil->DIL= (struct DOCUMENT_INFO *) yt->YT_info; + *dc->DC_dil_app= dil; + dc->DC_dil_app= &dil->DIL_next; + + return 0; +} diff --git a/lib/ds/lmd/nl_00134.o b/lib/ds/lmd/nl_00134.o new file mode 100644 index 0000000000000000000000000000000000000000..16d20f8f2ddddedf2621aeac4bdfb2fb8aa8d5c7 Binary files /dev/null and b/lib/ds/lmd/nl_00134.o differ diff --git a/lib/ds/lmd/nl_00135.c b/lib/ds/lmd/nl_00135.c new file mode 100644 index 0000000000000000000000000000000000000000..8ac3c477deb9573414a8d34023076cde3926797b --- /dev/null +++ b/lib/ds/lmd/nl_00135.c @@ -0,0 +1,27 @@ +/* + * FILE %nl_kr/lib/nl_00135.c + * + * + * written: 1995-07-30 + * latest update: 1995-12-05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_qs_setup_table_names (struct LMD_QUERY_SET *lmdqs, char *s) +{ + str_assign (&lmdqs->LMDQS_fn_lut, s); + fnmcpy3 (&lmdqs->LMDQS_fn_wr, s, ".wr"); + fnmcpy3 (&lmdqs->LMDQS_fn_di, s, ".di"); + + return 0; +} diff --git a/lib/ds/lmd/nl_00135.o b/lib/ds/lmd/nl_00135.o new file mode 100644 index 0000000000000000000000000000000000000000..3fa916743a85c2d1ee84ee7585e63d4264575392 Binary files /dev/null and b/lib/ds/lmd/nl_00135.o differ diff --git a/lib/ds/lmd/nl_00136.c b/lib/ds/lmd/nl_00136.c new file mode 100644 index 0000000000000000000000000000000000000000..7b117b04afb4263770863847961a0eadfa31525c --- /dev/null +++ b/lib/ds/lmd/nl_00136.c @@ -0,0 +1,30 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00136.c + * + * deref a word + * + * written: 1995-07-30 + * latest update: 1995-07-30 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_deref_init (struct LMD_QUERY_SET *lmdqs) +{ +#ifdef DEBUG + fprintf (stderr, "query set: lt=%s wr=%s di=%s\n", + lmdqs->LMDQS_fn_lut, lmdqs->LMDQS_fn_wr, lmdqs->LMDQS_fn_di); +#endif + + if ( (lmdqs->LMDQS_F_lt= fopen (lmdqs->LMDQS_fn_lut, "rb")) == (FILE *) 0 + ||(lmdqs->LMDQS_F_wr= fopen (lmdqs->LMDQS_fn_wr, "rb")) == (FILE *) 0 + ||(lmdqs->LMDQS_F_di= fopen (lmdqs->LMDQS_fn_di, "rb")) == (FILE *) 0 ) + return -1; + + lmdqs->LMDQS_initialized= 1; + + return 0; +} diff --git a/lib/ds/lmd/nl_00136.o b/lib/ds/lmd/nl_00136.o new file mode 100644 index 0000000000000000000000000000000000000000..fd511b8404835730696908115a4f4b07daa960da Binary files /dev/null and b/lib/ds/lmd/nl_00136.o differ diff --git a/lib/ds/lmd/nl_00137.c b/lib/ds/lmd/nl_00137.c new file mode 100644 index 0000000000000000000000000000000000000000..446c6c7a9720f73e8303b2095a77a3a6a21a8b28 --- /dev/null +++ b/lib/ds/lmd/nl_00137.c @@ -0,0 +1,30 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00137.c + * + * deref a word + * + * written: 1995-07-30 + * latest update: 1995-07-30 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_deref_finish (struct LMD_QUERY_SET *lmdqs) +{ + if (!lmdqs->LMDQS_initialized) return -1; + + fclose (lmdqs->LMDQS_F_lt); + fclose (lmdqs->LMDQS_F_wr); + fclose (lmdqs->LMDQS_F_di); + + lmdqs->LMDQS_F_lt= (FILE *) 0; + lmdqs->LMDQS_F_wr= (FILE *) 0; + lmdqs->LMDQS_F_di= (FILE *) 0; + + lmdqs->LMDQS_initialized= 0; + + return 0; +} diff --git a/lib/ds/lmd/nl_00137.o b/lib/ds/lmd/nl_00137.o new file mode 100644 index 0000000000000000000000000000000000000000..75b3fa1dc0f688c1389128e901bc59d09ed1fbcb Binary files /dev/null and b/lib/ds/lmd/nl_00137.o differ diff --git a/lib/ds/lmd/nl_00138.c b/lib/ds/lmd/nl_00138.c new file mode 100644 index 0000000000000000000000000000000000000000..d50a6fbab579b9e0b37ab64d6823d85ca41920cc --- /dev/null +++ b/lib/ds/lmd/nl_00138.c @@ -0,0 +1,69 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00138.c + * + * deref a word + * + * written: 1993-07-30 + * latest update: 1995-07-30 + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/lookup.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int lmd_store_word_ref ( +char *str, +long info, +void *client_data) +{ + struct WORD_REF_LIST *new_wrl; + struct LMD_QUERY_SET *lmdqs; + +#ifdef DEBUG +printf ("nl_00138: str='%s' info=0x%08lX\n", str, info); +#endif /* DEBUG */ + + if ((lmdqs= (struct LMD_QUERY_SET *) client_data) + == (struct LMD_QUERY_SET *) 0) return -1; + + lmdqs->LMDQS_found_string [0]= 0; + if (lmdqs->LMDQS_pfx != (char *) 0) + strcpy (lmdqs->LMDQS_found_string, lmdqs->LMDQS_pfx); + if (str != (char *) 0) + strcpy (lmdqs->LMDQS_found_string + lmdqs->LMDQS_pfx_lng, str); + + /* In case if an extra match pattern is definied, take the word only */ + /* if it matches with that pattern. */ + if (lmdqs->LMDQS_ext_pattern [0] != 0) + { + if (match (lmdqs->LMDQS_ext_pattern, lmdqs->LMDQS_found_string) <= 0) + return 0; + } + +#ifdef DEBUG +printf ("nl_00138: store_word_ref (%s, 0x%08lX) [%s]\n", +str, info, lmdqs->LMDQS_found_string); +#endif /* DEBUG */ + + if ((new_wrl= lmd_new_word_ref_list ()) == (struct WORD_REF_LIST *) 0) + { + lmdqs->LMDQS__error_flag= 1; + return 0; + } + + if (lmd_find_word_ref (lmdqs->LMDQS_F_wr, info, &new_wrl->WRL) == -1) + lmdqs->LMDQS__error_flag= 1; + + if (lmdqs->LMDQS_found_string [0] != 0) + new_wrl->WRL_string= strdup (lmdqs->LMDQS_found_string); + + new_wrl->WRL_next= *lmdqs->LMDQS__wrl; + *lmdqs->LMDQS__wrl= new_wrl; + lmdqs->LMDQS__wrl= &new_wrl->WRL_next; + + return 0; +} diff --git a/lib/ds/lmd/nl_00138.o b/lib/ds/lmd/nl_00138.o new file mode 100644 index 0000000000000000000000000000000000000000..dd220c7de93a6a6fd05235ca409732cc43323177 Binary files /dev/null and b/lib/ds/lmd/nl_00138.o differ diff --git a/lib/ds/lmd/nl_00139.c b/lib/ds/lmd/nl_00139.c new file mode 100644 index 0000000000000000000000000000000000000000..2d000c2de4070c13db3a9dfd2609bd40e8e1fd1e --- /dev/null +++ b/lib/ds/lmd/nl_00139.c @@ -0,0 +1,51 @@ +/* + * FILE %nl_kr/lib/nl_00139.c + * + * print a document hit list + * + * written: 1993-02-28 + * latest update: 1995-12-05 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_print_hyx_cluster_hit_list ( +FILE *fo, +struct WORD_REF_LIST *wrl, +char *cluster_name) +{ + struct DOCUMENT_INFO_LIST *start; + struct DOCUMENT_INFO *di; + + if (cluster_name != (char *) 0 && *cluster_name == 0) + cluster_name= (char *) 0; + + for (; wrl != (struct WORD_REF_LIST *) 0; wrl= wrl->WRL_next) + { + fprintf (fo, "\n--------------------\n"); + fprintf (fo, "word: %s\n", wrl->WRL_string); + lmd_print_word_ref_info (fo, &wrl->WRL); + + fprintf (fo, "frnum hits\n"); + if ((start= wrl->WRL_dil) != (struct DOCUMENT_INFO_LIST *) 0) + { + for (start= wrl->WRL_dil; + start != (struct DOCUMENT_INFO_LIST *) 0; + start= start->DIL_next) + { + if ((di= start->DIL) == (struct DOCUMENT_INFO *) 0) continue; + + fprintf (fo, "<hyx.l fr=\"$#%ld\"", di->DI_document_id); + if (cluster_name != (char *) 0) + fprintf (fo, " cl=\"%s\"", cluster_name); + fprintf (fo, " tdc=hyx.l tdp=5>%5ld %5ld\n", + di->DI_document_id, di->DI_hit_count); + } + } + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00139.o b/lib/ds/lmd/nl_00139.o new file mode 100644 index 0000000000000000000000000000000000000000..b93e57a9efb8511f888b2834a60669c6aa531e7d Binary files /dev/null and b/lib/ds/lmd/nl_00139.o differ diff --git a/lib/ds/lmd/nl_00140.c b/lib/ds/lmd/nl_00140.c new file mode 100644 index 0000000000000000000000000000000000000000..db741fdcb7b1cc540abba1cf7ce22acb924dac64 --- /dev/null +++ b/lib/ds/lmd/nl_00140.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/lmd/nl_00140.c + * + * create a query set object + * + * written: 2002-01-20 + * latest update: 2002-02-03 1:40:40 + * $Id: nl_00140.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +LMDQS *new_LMDQS (char *fnm) +{ + struct LMD_QUERY_SET *p; + if ((p= lmd_new_query_set ()) == (struct LMD_QUERY_SET *) 0) + { +ERROR: + return (struct LMD_QUERY_SET *) 0; + } + + lmd_qs_setup_table_names (p, fnm); + if (lmd_deref_init (p) != 0) + { + free (p); + goto ERROR; + } + + return p; +} diff --git a/lib/ds/lmd/nl_00140.o b/lib/ds/lmd/nl_00140.o new file mode 100644 index 0000000000000000000000000000000000000000..900c4e6a0a6cea0abc976afe5826ced59db14070 Binary files /dev/null and b/lib/ds/lmd/nl_00140.o differ diff --git a/lib/ds/lmd/nl_00141.c b/lib/ds/lmd/nl_00141.c new file mode 100644 index 0000000000000000000000000000000000000000..70c692340a55407412cb4621eea2ba979b1247cf --- /dev/null +++ b/lib/ds/lmd/nl_00141.c @@ -0,0 +1,55 @@ +/* + * FILE %ds/lmd/nl_00141.c + * + * methods for the WRL object + * + * written: 2002-02-03 + * latest update: 2002-02-03 1:40:25 + * $Id: nl_00141.c,v 1.1 2002/02/04 08:13:08 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +long WRL_index (WRL *p) +{ + if (p != (WRL *) 0) return p->WRL_index; + return 0L; +} + +/* ------------------------------------------------------------------------ */ +char *WRL_string (WRL *p) +{ + if (p != (WRL *) 0) return p->WRL_string; + return (char *) 0; +} + +/* ------------------------------------------------------------------------ */ +long WRL_count (WRL *p) +{ + if (p != (WRL *) 0) return p->WRL.WR_count; + return 0L; +} + +/* ------------------------------------------------------------------------ */ +long WRL_offset (WRL *p) +{ + if (p != (WRL *) 0) return p->WRL.WR_docinfo_offset; + return 0L; +} + +/* ------------------------------------------------------------------------ */ +long WRL_docs (WRL *p) +{ + if (p != (WRL *) 0) return p->WRL.WR_docinfo_count; + return 0L; +} + +/* ------------------------------------------------------------------------ */ +DIL *WRL_DIL (WRL *p) +{ + if (p != (WRL *) 0) return p->WRL_dil; + return (DIL *) 0; +} diff --git a/lib/ds/lmd/nl_00141.o b/lib/ds/lmd/nl_00141.o new file mode 100644 index 0000000000000000000000000000000000000000..669683b5be43b4d77310be74833a53c8b592d21f Binary files /dev/null and b/lib/ds/lmd/nl_00141.o differ diff --git a/lib/ds/lmd/nl_00142.c b/lib/ds/lmd/nl_00142.c new file mode 100644 index 0000000000000000000000000000000000000000..d696ecf22835cb303d0b95b1dce0e646a20442d0 --- /dev/null +++ b/lib/ds/lmd/nl_00142.c @@ -0,0 +1,60 @@ +/* + * FILE %ds/lmd/nl_00142.c + * + * methods for the DIL object + * + * written: 2002-02-03 + * latest update: 2002-02-03 1:40:25 + * $Id: nl_00142.c,v 1.1 2002/02/04 08:13:08 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +DIL *DIL_next (DIL *p) +{ + if (p == (DIL *) 0) return (DIL *) 0; + return p->DIL_next; +} + +/* ------------------------------------------------------------------------ */ +long DIL_document_id (DIL *p) +{ + if (p == (DIL *) 0 || p->DIL == (struct DOCUMENT_INFO *) 0) return 0L; + return p->DIL->DI_document_id; +} + +/* ------------------------------------------------------------------------ */ +long DIL_hit_count (DIL *p) +{ + if (p == (DIL *) 0 || p->DIL == (struct DOCUMENT_INFO *) 0) return 0L; + return p->DIL->DI_hit_count; +} + +/* ------------------------------------------------------------------------ */ +long DIL_document_ptr (DIL *p) +{ +#ifdef LMD_EXTENDED_MODEL + if (p == (DIL *) 0 || p->DIL == (struct DOCUMENT_INFO *) 0) return 0L; + return p->DIL->DI_document_ptr; +#else + return 0L; +#endif /* LMD_EXTENDED_MODEL */ +} + +/* ------------------------------------------------------------------------ */ +long DIL_pos (DIL *p, int idx) +{ +#ifdef LMD_EXTENDED_MODEL + if (p == (DIL *) 0 + || p->DIL == (struct DOCUMENT_INFO *) 0 + || idx >= MAX_DI_POS + ) return 0L; + + return p->DIL->DI_pos [idx]; +#else + return 0L; +#endif /* LMD_EXTENDED_MODEL */ +} diff --git a/lib/ds/lmd/nl_00142.o b/lib/ds/lmd/nl_00142.o new file mode 100644 index 0000000000000000000000000000000000000000..eadac99278bccd27694c818c2a9ffa3db38f8497 Binary files /dev/null and b/lib/ds/lmd/nl_00142.o differ diff --git a/lib/ds/lmd/nl_00201.c b/lib/ds/lmd/nl_00201.c new file mode 100644 index 0000000000000000000000000000000000000000..a04a9cfadb0c1b71301ea686db7e201e83d5bc2d --- /dev/null +++ b/lib/ds/lmd/nl_00201.c @@ -0,0 +1,59 @@ +/* + * FILE %nl_kr/lib/nl_00201.c + * + * set location records in a DOCUMENT_INFO structure + * + * written: 1994-08-05 + * latest update: 1995-12-05 + * $Id: nl_00201.c,v 1.2 2001/08/03 15:51:43 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_set_location_code ( +struct DOCUMENT_INFO *di, +int loc_operator, +int loc_number, +long loc_code) +{ +#ifdef LMD_EXTENDED_MODEL + int i; + + switch (loc_operator) + { + case LOC_CODE_SET: + if (loc_number >= 0 && loc_number < MAX_DI_POS) + { +SETIT: + di->DI_pos [loc_number]= loc_code; + break; + } + + if (loc_code == 0L) break; + for (i= 0; i < MAX_DI_POS; i++) + if (di->DI_pos [i] == 0L) + goto SETIT; + break; + + case LOC_CODE_ADD: + if (loc_number < 0 || loc_number >= MAX_DI_POS) break; + di->DI_pos [loc_number] += loc_code; + break; + + case LOC_CODE_OR: + if (loc_number < 0 || loc_number >= MAX_DI_POS) break; + di->DI_pos [loc_number] |= loc_code; + break; + } + +#else +#ifdef MSDOS + di; loc_operator; loc_number; loc_code; +#endif /* MSDOS */ +#endif /* !LMD_EXTENDED_MODEL */ + + return 0; +} diff --git a/lib/ds/lmd/nl_00201.o b/lib/ds/lmd/nl_00201.o new file mode 100644 index 0000000000000000000000000000000000000000..47f1ebdd3432ffb38c5a1849a9703951ba1706fa Binary files /dev/null and b/lib/ds/lmd/nl_00201.o differ diff --git a/lib/ds/lmd/nl_00301.c b/lib/ds/lmd/nl_00301.c new file mode 100644 index 0000000000000000000000000000000000000000..cf4b38248ab64ec67d25f04aee7ae016cea0bdc4 --- /dev/null +++ b/lib/ds/lmd/nl_00301.c @@ -0,0 +1,61 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00301.c + * + * Datenkapsel + * - Funktionen zum Ueberpruefen von Worten in einer LUT + * + * written: 1989 03 29 + * 1990 02 14: Revision + * 1994-12-19: isolated from wordcr03.c + * latest update: 1995-07-16 + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/lookup.h> +#include <gg/fileio.h> +#include <gg/sbr.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +int lmd_TWF (struct LMDT_CONTROL *lmdt, char *w)/* Test Word; Suche auf FILE*/ +{ + long wi; + int rv, lng; + int i; + int ch; + int flg= 0; /* 1 -> wildcard */ + + for (i= 0;; i++) + { + ch= w[i] & 0x00FF; + lmdt->LMDT_ext_pattern [i]= (char) ch; + if (ch == '*' || ch == '?') + { + w [i]= 0; + flg= 1; + } + if (ch == 0) break; + } + + if (lmdt->LMDT_LUT_FILE == (FILE *) 0) + { + rv= lookup_char (lmdt->LMDT_LUT, w, &wi, &lng); + } + else + { + fseek (lmdt->LMDT_LUT_FILE, 0L, 0); + rv= lookup_file (lmdt->LMDT_LUT_FILE, w, &wi, &lng); + } + + if (flg) printf ("set match pattern '%s'\n", lmdt->LMDT_ext_pattern); + else lmdt->LMDT_ext_pattern [0]= 0; + + lmd_report (lmdt, w, rv, lng, wi); + + return 0; +} diff --git a/lib/ds/lmd/nl_00301.o b/lib/ds/lmd/nl_00301.o new file mode 100644 index 0000000000000000000000000000000000000000..d2b10f3254b8e30e43f7b8346a84ea20abb7c9be Binary files /dev/null and b/lib/ds/lmd/nl_00301.o differ diff --git a/lib/ds/lmd/nl_00302.c b/lib/ds/lmd/nl_00302.c new file mode 100644 index 0000000000000000000000000000000000000000..b59eb0386f0e1602e6ac96786c9e5dceceb98d4b --- /dev/null +++ b/lib/ds/lmd/nl_00302.c @@ -0,0 +1,32 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00302.c + * + * Datenkapsel + * - Funktionen zum Ueberpruefen von Worten in einer LUT + * + * written: 1989 03 29 + * 1990 02 14: Revision + * 1994-12-19: isolated from wordcr03.c + * latest update: 1995-07-16 + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/lookup.h> +#include <gg/fileio.h> +#include <gg/sbr.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +int lmd_report_tfb (struct LMDT_CONTROL *lmdt, long inf) +{ + if (lmdt->LMDT_TFB_FILE == (FILE *) 0) return 0; + fseek (lmdt->LMDT_TFB_FILE, inf-1L, 0); + printf ("[%d] TFB: ", lmdt->LMDT_rep2_cnt); + ftransfer_line (lmdt->LMDT_TFB_FILE, stdout, 0x7FFFFFFFL); + return 0; +} diff --git a/lib/ds/lmd/nl_00302.o b/lib/ds/lmd/nl_00302.o new file mode 100644 index 0000000000000000000000000000000000000000..5fcdbfd09dd74eaf9b19510e622b37bcdca071e4 Binary files /dev/null and b/lib/ds/lmd/nl_00302.o differ diff --git a/lib/ds/lmd/nl_00303.c b/lib/ds/lmd/nl_00303.c new file mode 100644 index 0000000000000000000000000000000000000000..a99cb73a02d9cde7e4424070e3c16f8d1ca47ea0 --- /dev/null +++ b/lib/ds/lmd/nl_00303.c @@ -0,0 +1,40 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00303.c + * + * Datenkapsel + * - Funktionen zum Ueberpruefen von Worten in einer LUT + * + * written: 1989 03 29 + * 1990 02 14: Revision + * 1994-12-19: isolated from wordcr03.c + * latest update: 1995-07-16 + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/lookup.h> +#include <gg/fileio.h> +#include <gg/sbr.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +int lmd_report2 (char *str, long inf, void *client_data) +{ + struct LMDT_CONTROL *lmdt; + + if ((lmdt= (struct LMDT_CONTROL *) client_data) == (void *) 0) return -1; + + sprintf (lmdt->LMDT_complete_key, "%s%s", lmdt->LMDT_pfx, str); + if (lmdt->LMDT_ext_pattern [0] != 0 && match (lmdt->LMDT_ext_pattern, lmdt->LMDT_complete_key) + <= 0) return 0; + + lmdt->LMDT_rep2_cnt++; + printf ("[%d] INF: 0x%08lX %s\n", lmdt->LMDT_rep2_cnt, inf, lmdt->LMDT_complete_key); + lmd_report_tfb (lmdt, inf); + + return 0; +} diff --git a/lib/ds/lmd/nl_00303.o b/lib/ds/lmd/nl_00303.o new file mode 100644 index 0000000000000000000000000000000000000000..27936ef47fbde491a983f5515c8ab69a12ad32c9 Binary files /dev/null and b/lib/ds/lmd/nl_00303.o differ diff --git a/lib/ds/lmd/nl_00304.c b/lib/ds/lmd/nl_00304.c new file mode 100644 index 0000000000000000000000000000000000000000..3530ef232e54487c87f1b980b489657a6f09debb --- /dev/null +++ b/lib/ds/lmd/nl_00304.c @@ -0,0 +1,118 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00304.c + * + * Datenkapsel + * - Funktionen zum Ueberpruefen von Worten in einer LUT + * + * written: 1989 03 29 + * 1990 02 14: Revision + * 1994-12-19: isolated from wordcr03.c + * latest update: 1995-07-16 + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/lookup.h> +#include <gg/fileio.h> +#include <gg/sbr.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +int lmd_report (struct LMDT_CONTROL *lmdt, char *w, int rv, int lng, long wi) +{ + int i; + char *cp; + long dump_beg; + long dump_end; + + if (rv < 0) + { + fprintf (stderr, "ERROR: %d; w=%s\n", rv, w); + if (*w == 0 && *lmdt->LMDT_ext_pattern) + { + lmdt->LMDT_pfx= ""; + lmdt->LMDT_rep2_cnt= 0; + fseek (lmdt->LMDT_LUT_FILE, 0L, 0); + printf ("weitere Worte:\n"); + lut_process_block (lmdt->LMDT_LUT_FILE, lmd_report2, lmdt); + } + return 0; + } + else + if (rv == LOOKUP_not_found) + { + printf ("%s nicht gefunden\n", w); + return 0; + } + else + { + if (lmdt->LMDT_LUT_FILE == (FILE *) 0) + { + cp= lut_char_get_word_buffer (); + dump_beg= (long) lut_char_get_dump_beg (); + dump_end= (long) lut_char_get_dump_end (); + } + else + { + cp= lut_file_get_word_buffer (); + dump_beg= lut_file_get_dump_beg (); + dump_end= lut_file_get_dump_end (); + } + + printf ("cp='%s'\n", cp); + printf ("beg=0x%08lX end=0x%08lX\n", dump_beg, dump_end); + + if ((rv & LOOKUP_found) /* && lmdt->LMDT_LUT_FILE == (FILE *) 0*/) + { + printf (" Wort: %s -> WI=%8lX\n", w, wi); + lmd_report_tfb (lmdt, wi); + } + + if (rv == LOOKUP_prefix) + { + printf ("kuerzeres Wort: "); + for (i= 0; i < lng; i++) fputc (w [i], stdout); + printf (" -> WI=%8lX\n", wi); + lmdt->LMDT_rep2_cnt= 0; + lmdt->LMDT_pfx= ""; + lmd_report2 (cp, wi, (void *) lmdt); + } + + if (rv & LOOKUP_prefix_3) + { + printf ("laengeres Wort: %s -> WI=%8lX\n", cp, wi); + lmdt->LMDT_rep2_cnt= 0; + lmdt->LMDT_pfx= ""; + lmd_report2 (cp, wi, (void *) lmdt); + } + + if (rv & LOOKUP_prefix_4) + { + printf ("mehrere Worte die mit '%s\' beginnen. (%s)\n", w, cp); + } + + if (lmdt->LMDT_LUT_FILE != (FILE *) 0 + && (((rv & LOOKUP_prefix_4) && *lmdt->LMDT_ext_pattern) + ||(rv & LOOKUP_found))) + { + long doff; + + lmdt->LMDT_pfx= cp; + lmdt->LMDT_rep2_cnt= 0; + if ((doff= lut_file_get_dump_beg ()) >= 0L) + { + fseek (lmdt->LMDT_LUT_FILE, doff, 0); + printf ("weitere Worte:\n"); + lut_process_block (lmdt->LMDT_LUT_FILE, lmd_report2, lmdt); + } + } + + return 1; + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00304.o b/lib/ds/lmd/nl_00304.o new file mode 100644 index 0000000000000000000000000000000000000000..e61a8e2ae843e45adaef9cc3c0c613713a82fcda Binary files /dev/null and b/lib/ds/lmd/nl_00304.o differ diff --git a/lib/ds/lmd/nl_00305.c b/lib/ds/lmd/nl_00305.c new file mode 100644 index 0000000000000000000000000000000000000000..084bd7a994b12e52877f9c6493a69ff7a3b32615 --- /dev/null +++ b/lib/ds/lmd/nl_00305.c @@ -0,0 +1,78 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00305.c + * + * Datenkapsel + * - Funktionen zum Ueberpruefen von Worten in einer LUT + * + * written: 1989 03 29 + * 1990 02 14: Revision + * 1994-12-19: isolated from wordcr03.c + * latest update: 1995-07-16 + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/lookup.h> +#include <gg/fileio.h> +#include <gg/sbr.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +int lmd_RL3 ( /* Read Look Up Table */ +struct LMDT_CONTROL *lmdt, +char *fn, /* name of LUT to read */ +int mode) /* 0 -> RAM; sonst -> FILE */ +{ + long lng; + char *t_fn; + + if (fn == (char *) 0 + || *fn == 0 + || (t_fn= translate_logic_filename (fn)) == (char *) 0) + return -1; + + if (*t_fn == 0) t_fn= strdup (fn); /* well, this should be done by trans */ + printf (">>> RL3: fn=%s t_fn=%s\n", fn, t_fn); + + lmdt->LMDT_LUT_FILE= (FILE *) 0; + + if (lmdt->LMDT_LUT != (char *) 0) + { + free (lmdt->LMDT_LUT); + lmdt->LMDT_LUT= (char *) 0; + } + + if (mode != 0) + { + printf (((lmdt->LMDT_LUT_FILE= fopen (t_fn, "rb")) == (FILE *) 0) + ? "error opening LUT file %s (%s)\n" + : "LUT %s (%s) fuer FILE-Test eroeffnet\n", + fn, t_fn); + + return 0; + } + +#ifndef __CMS__ +/* LUT in memory is not supported for CMS ... */ +#ifdef MSDOS +#define MAX_LUT 65000L +#else +#define MAX_LUT 6500000L +#endif + + if ((lng= read_file2buffer (&lmdt->LMDT_LUT, t_fn, MAX_LUT)) <= 0L) + { + printf ("error reading LUT file %s (%s)\n", fn, t_fn); + return -1; + } + printf ("LUT file size: %ld bytes\n", lng); + lmdt->LMDT_LUT_FILE= (FILE *) 0; +#endif /* __CMS__ */ + + free (t_fn); + return 0; +} diff --git a/lib/ds/lmd/nl_00305.o b/lib/ds/lmd/nl_00305.o new file mode 100644 index 0000000000000000000000000000000000000000..f1fb73969cd12d260ed20b791db08003b8d672ab Binary files /dev/null and b/lib/ds/lmd/nl_00305.o differ diff --git a/lib/ds/lmd/nl_00306.c b/lib/ds/lmd/nl_00306.c new file mode 100644 index 0000000000000000000000000000000000000000..8a928b09e2bc585eb54355ec90f1866b42ed2b33 --- /dev/null +++ b/lib/ds/lmd/nl_00306.c @@ -0,0 +1,22 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00306.c + * + * Datenkapsel + * - Funktionen zum Ueberpruefen von Worten in einer LUT + * + * written: 1989 03 29 + * 1990 02 14: Revision + * 1994-12-19: isolated from wordcr03.c + * latest update: 1995-07-16 + * + */ + + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_RL3_set_tfb_file (struct LMDT_CONTROL *lmdt, char *fn) +{ + return ((lmdt->LMDT_TFB_FILE= fopen (fn, "rb")) == (FILE *) 0); +} diff --git a/lib/ds/lmd/nl_00306.o b/lib/ds/lmd/nl_00306.o new file mode 100644 index 0000000000000000000000000000000000000000..51b9adf95d47dcebfd2d09154256edd0d86cc43d Binary files /dev/null and b/lib/ds/lmd/nl_00306.o differ diff --git a/lib/ds/lmd/nl_00401.c b/lib/ds/lmd/nl_00401.c new file mode 100644 index 0000000000000000000000000000000000000000..6707e2fae52be431a6913fbbe6db4f01f2640357 --- /dev/null +++ b/lib/ds/lmd/nl_00401.c @@ -0,0 +1,46 @@ +/* + * FILE %ds/lmd/nl_00401.c + * + * data + * - functions to create LUTs -- using YTREE + * - see also: wordcr05.c (word reference system) + * + * written: 1990 06 04 + * 1990 11 16: revision + * 1991 03 16: revision; AIX + * 1993-02-28: complete redesign of the refenece system + * 1994-12-19: isolated from wordcr04.c + * latest update: 1996-12-22 17:41:34 + * + */ + +#include <string.h> +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_score ( +struct LMDC_CONTROL *lmdc, +char *s, /* word to be placed in lookup table */ +long cnt, /* counter or code */ +int mode) /* bit 0 .. set counter to this value */ + /* bit 1 .. record code in word number field */ +{ + struct YTREE *p; + + if (nl_key_valid (s) == -1) return -1; + if ((p= ytree_insert_word (&lmdc->LMDC_ytree, (unsigned char *) s)) + == (struct YTREE *) 0) + { + lmd_error04 ("Out of Memory"); + return -1; + } + + p->YT_flags |= YTflag_EOW; + + if (mode & 0x0001) + p->YT_info += cnt; + else p->YT_info = cnt; + + return 0; +} diff --git a/lib/ds/lmd/nl_00401.o b/lib/ds/lmd/nl_00401.o new file mode 100644 index 0000000000000000000000000000000000000000..5cac9e5a013d6d2443899513ce4a36fab1c1fe50 Binary files /dev/null and b/lib/ds/lmd/nl_00401.o differ diff --git a/lib/ds/lmd/nl_00402.c b/lib/ds/lmd/nl_00402.c new file mode 100644 index 0000000000000000000000000000000000000000..12b4650be078fc254ca1a065bd728b7590a4cd5e --- /dev/null +++ b/lib/ds/lmd/nl_00402.c @@ -0,0 +1,114 @@ +/* + * FILE %ds/lmd/nl_00402.c + * + * create a word reference entry + * + * written: 1990 06 04 + * 1990 11 16: revision + * 1991 03 16: revision; AIX + * 1993-02-28: complete redesign of the refenece system + * 1994-12-19: isolated from wordcr04.c + * latest update: 2001-02-04 21:09:50 + * $Id: nl_00402.c,v 1.6 2001/10/08 15:01:25 gonter Exp $ + * + */ + +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/lookup.h> +#include <gg/dirty.h> + +/* ------------------------------------------------------------------------ */ +int lmd_idx ( +struct LMDC_CONTROL *lmdc, +char *string, /* word */ +long document_id, /* document identification code */ + /* < 0L ... the word is a stop word */ + /* = 0L ... the word is a hit word, no document yet */ + /* > 0L ... the word comes from a document */ +long document_ptr, /* document pointer code to be placed into DOCID */ +char *document_id_str, /* id string for document */ +int loc_operator, /* mode for using the loc_code */ +int loc_number, /* which location code to use */ +long loc_code) /* position code */ +{ + struct YTREE *p; + int rc; + + lmdc->LMDC_act_word_ref= (struct WORD_REF *) 0; + + if (nl_key_valid (string) == -1) + { + lmd_error04 ("invalid key"); + dump (stdout, string, strlen (string)); + return -2; /* this is done twice! */ + } + + lmdc->LMDC_cnt_sw_idx++; + + if ((p= ytree_insert_word (&lmdc->LMDC_ytree, (unsigned char *) string)) + == (struct YTREE *) 0) + { +NO_MEMORY: + lmd_error04 ("Out of Memory"); + return -1; + } + + p->YT_flags |= YTflag_EOW; + +#ifdef JUNK + if (p->YT_info < 0L) return 0; /* stop word, so stop ... */ +#endif + + /* otherwise it's a new word */ + if ((lmdc->LMDC_word_index= p->YT_info) == 0L) + { /* an new word was found */ + if (document_id >= 0L) + { + if ((lmdc->LMDC_act_word_ref= lmd_new_word_ref ()) + == (struct WORD_REF *) 0) + goto NO_MEMORY; + + p->YT_info= (long) lmdc->LMDC_act_word_ref; + } + else p->YT_info= 0L; + } + else + { + lmdc->LMDC_act_word_ref= (struct WORD_REF *) p->YT_info; + } + + if ((lmdc->LMDC_word_index= p->YT_info) != 0L) + { + if (document_id >= 0L) + { /* store word information */ + rc= lmd_word_statistics (lmdc, lmdc->LMDC_act_word_ref, string, + document_id, document_ptr, document_id_str, + ADD_WORD_REF, + loc_operator, loc_number, loc_code); + + if (rc != 0) + { + lmd_error04 ("Out of Memory"); + return -1; + } + +#ifdef __COMMENT__ +Does it make sense to delete a word from the document list again? +#endif /* _COMMENT */ + } + else + if (document_id < 0L) + { /* now a stop word, but previously there was info for the word */ + lmd_word_statistics (lmdc, lmdc->LMDC_act_word_ref, string, + document_id, document_ptr, document_id_str, + DEL_WORD_REF, + loc_operator, loc_number, loc_code); + p->YT_info= 0L; + } + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00402.o b/lib/ds/lmd/nl_00402.o new file mode 100644 index 0000000000000000000000000000000000000000..1085b81a8027429e6ae3e8ed218acdb2b6dfe13d Binary files /dev/null and b/lib/ds/lmd/nl_00402.o differ diff --git a/lib/ds/lmd/nl_00403.c b/lib/ds/lmd/nl_00403.c new file mode 100644 index 0000000000000000000000000000000000000000..c8abebf18c778e77c6d4fe4588c8c290944ac788 --- /dev/null +++ b/lib/ds/lmd/nl_00403.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/lmd/nl_00403.c + * + * lookup a word reference entry + * + * written: 1996-12-22 + * latest update: 1996-12-22 17:54:52 + * + */ + +#include <string.h> +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct WORD_REF *lmd_lookup_entry ( +struct LMDC_CONTROL *lmdc, +char *string) /* word */ +{ + struct YTREE *p; + struct WORD_REF *rv= (struct WORD_REF *) 0; + + if (nl_key_valid (string) != -1 + && (p= ytree_lookup_word (lmdc->LMDC_ytree, (unsigned char *) string)) + != (struct YTREE *) 0 + && (p->YT_flags & YTflag_EOW) + && (rv= (struct WORD_REF *) p->YT_info) != (struct WORD_REF *) 0 + ) + { + lmdc->LMDC_act_word_ref= rv; + } + + return rv; +} diff --git a/lib/ds/lmd/nl_00403.o b/lib/ds/lmd/nl_00403.o new file mode 100644 index 0000000000000000000000000000000000000000..c6a552eeb07ece350bcf79ae427c221ac533528e Binary files /dev/null and b/lib/ds/lmd/nl_00403.o differ diff --git a/lib/ds/lmd/nl_00404.c b/lib/ds/lmd/nl_00404.c new file mode 100644 index 0000000000000000000000000000000000000000..0d2d876eac4041a3ef18072cc50626b8da9f4aaf --- /dev/null +++ b/lib/ds/lmd/nl_00404.c @@ -0,0 +1,71 @@ +/* + * FILE %ds/lmd/nl_00404.c + * + * data + * - functions to create LUTs -- using YTREE + * - see also: wordcr05.c (word reference system) + * + * written: 1990 06 04 + * 1990 11 16: revision + * 1991 03 16: revision; AIX + * 1993-02-28: complete redesign of the refenece system + * 1994-12-19: isolated from wordcr04.c + * latest update: 1996-12-22 17:42:22 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +long lmd_PL ( +struct YTREE *yt, +char *LUT_out, /* Name des Files mit LUT (Binaer) */ +char *TABLE_out) /* . . . . Woerterbuch (ASCII) */ +/* return: number of entries in the lut dumped, if any */ +{ + FILE *fo; + long word_cnt= 0L; + + ytree_size (yt); + if (LUT_out != (char *) 0 && *LUT_out) + { + if (strcmp (LUT_out, "-") == 0) + { + word_cnt= ytree_dump (stdout, yt); + } + else + { + if ((fo= fopen (LUT_out, "wb")) == (FILE *) 0) + { + fprintf (stderr, "can't open %s to write LUT!\n", LUT_out); + return -1; + } + word_cnt= ytree_dump (fo, yt); + fclose (fo); + } + } + + if (TABLE_out != (char *) 0 && *TABLE_out) + { + if (strcmp (TABLE_out, "-") == 0) + { + ytree_print (stdout, yt, 0); + } + else + { + if ((fo= fopen (TABLE_out, "wt")) == (FILE *) 0) + { + fprintf (stderr, "can't open %s to write ytree-info!\n", TABLE_out); + return -1; + } + + ytree_print (fo, yt, 0); + fclose (fo); + } + } + + return word_cnt; +} diff --git a/lib/ds/lmd/nl_00404.o b/lib/ds/lmd/nl_00404.o new file mode 100644 index 0000000000000000000000000000000000000000..d0383c644d29914b8438463324b0541d8700db31 Binary files /dev/null and b/lib/ds/lmd/nl_00404.o differ diff --git a/lib/ds/lmd/nl_00405.c b/lib/ds/lmd/nl_00405.c new file mode 100644 index 0000000000000000000000000000000000000000..7702c7380e67f7caee163ceb0a4f0b6a8ac4330b --- /dev/null +++ b/lib/ds/lmd/nl_00405.c @@ -0,0 +1,48 @@ +/* + * FILE %ds/lmd/nl_00405.c + * + * data + * - functions to create LUTs -- using YTREE + * - see also: wordcr05.c (word reference system) + * + * written: 1990 06 04 + * 1990 11 16: revision + * 1991 03 16: revision; AIX + * 1993-02-28: complete redesign of the refenece system + * 1994-12-19: isolated from wordcr04.c + * latest update: 1996-12-22 17:42:14 + * + */ + +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +static int kill_id_cnt= 0; +static int kill_word_cnt= 0; +static long kill_ids[]= { 0L }; +static char *kill_words[]= { "" } ; + +/* ------------------------------------------------------------------------ */ +int lmd_RL4 ( +struct LMDC_CONTROL *lmdc, +char *LUT_in) /* Name des Files mit LUT (Binaer) */ +{ + FILE *fi; + int rc; + + if ((fi= fopen (LUT_in, "rb")) == (FILE *) 0) + { + fprintf (stderr, "can't open %s to read LUT!\n", LUT_in); + return -1; + } + + rc= ytree_full_scan (fi, &lmdc->LMDC_ytree, + kill_ids, kill_id_cnt, + kill_words, kill_word_cnt); + + fclose (fi); + + return rc; +} diff --git a/lib/ds/lmd/nl_00405.o b/lib/ds/lmd/nl_00405.o new file mode 100644 index 0000000000000000000000000000000000000000..b5bf50d3921d2fb34352f04c483e5ece1eedb6a6 Binary files /dev/null and b/lib/ds/lmd/nl_00405.o differ diff --git a/lib/ds/lmd/nl_00407.c b/lib/ds/lmd/nl_00407.c new file mode 100644 index 0000000000000000000000000000000000000000..73293a8b96533bdfb69ef939a938f87b1a53adf0 --- /dev/null +++ b/lib/ds/lmd/nl_00407.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/lmd/nl_00407.c + * + * initialize a LMD indexer dictionary context + * + * written: 1990 06 04 + * 1990 11 16: revision + * 1991 03 16: revision; AIX + * 1993-02-28: complete redesign of the refenece system + * 1994-12-19: isolated from wordcr04.c + * latest update: 1996-12-22 17:20:54 + * + */ + +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +void lmd_initialize_control (struct LMDC_CONTROL *lmdc) +{ + lmdc->LMDC_ytree= (struct YTREE *) 0; + lmdc->LMDC_act_word_ref= (struct WORD_REF *) 0; + + lmdc->LMDC_word_index= 0L; + lmdc->LMDC_cnt_sw_idx= 0L; + lmdc->LMDC_stop_word_limit= STOP_WORD_LIMIT; + lmdc->LMDC_max_word_count= MAX_WORD_COUNT; + lmdc->LMDC_min_wordlength= MIN_WORDLENGTH; + lmdc->LMDC_max_wordlength= MAX_WORDLENGTH; +} diff --git a/lib/ds/lmd/nl_00407.o b/lib/ds/lmd/nl_00407.o new file mode 100644 index 0000000000000000000000000000000000000000..5bc0c541518fe560204790acc0c2bb157937ef00 Binary files /dev/null and b/lib/ds/lmd/nl_00407.o differ diff --git a/lib/ds/lmd/nl_00408.c b/lib/ds/lmd/nl_00408.c new file mode 100644 index 0000000000000000000000000000000000000000..c02edb6b7bdaf543aeef1432468608ea1f62e4cf --- /dev/null +++ b/lib/ds/lmd/nl_00408.c @@ -0,0 +1,24 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00408.c + * + * data + * - functions to create LUTs -- using YTREE + * - see also: wordcr05.c (word reference system) + * + * written: 1990 06 04 + * 1990 11 16: revision + * 1991 03 16: revision; AIX + * 1993-02-28: complete redesign of the refenece system + * latest update: 1994-12-19: isolated from wordcr04.c + * $Id: nl_00408.c,v 1.2 2001/02/06 20:06:33 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +void lmd_error04 (char *msg) +{ + printf ("ERROR: %s\n", msg); +} diff --git a/lib/ds/lmd/nl_00408.o b/lib/ds/lmd/nl_00408.o new file mode 100644 index 0000000000000000000000000000000000000000..21653a6dbbbf66d5688f3937d301431fef779f3b Binary files /dev/null and b/lib/ds/lmd/nl_00408.o differ diff --git a/lib/ds/lmd/nl_00409.c b/lib/ds/lmd/nl_00409.c new file mode 100644 index 0000000000000000000000000000000000000000..87fa498d7f3a9812f2e5cd9f368373edb9bf74bc --- /dev/null +++ b/lib/ds/lmd/nl_00409.c @@ -0,0 +1,26 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00409.c + * + * data + * - functions to create LUTs -- using YTREE + * - see also: wordcr05.c (word reference system) + * + * written: 1990 06 04 + * 1990 11 16: revision + * 1991 03 16: revision; AIX + * 1993-02-28: complete redesign of the refenece system + * 1994-12-19: isolated from wordcr04.c + * latest update: 1995-07-24 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +void lmd_print_04statistics ( +struct LMDC_CONTROL *lmdc, +FILE *fo) +{ + fprintf (fo, "sw_idx=%ld\n", lmdc->LMDC_cnt_sw_idx); +} diff --git a/lib/ds/lmd/nl_00409.o b/lib/ds/lmd/nl_00409.o new file mode 100644 index 0000000000000000000000000000000000000000..c08ed88ad2767b12735283c423c27bea0d04c46b Binary files /dev/null and b/lib/ds/lmd/nl_00409.o differ diff --git a/lib/ds/lmd/nl_00410.c b/lib/ds/lmd/nl_00410.c new file mode 100644 index 0000000000000000000000000000000000000000..874f42266b32eb74cd18d4a5cfc815edd3db1951 --- /dev/null +++ b/lib/ds/lmd/nl_00410.c @@ -0,0 +1,34 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00410.c + * + * data + * - functions to create LUTs -- using YTREE + * - see also: wordcr05.c (word reference system) + * + * written: 1990 06 04 + * 1990 11 16: revision + * 1991 03 16: revision; AIX + * 1993-02-28: complete redesign of the refenece system + * 1994-12-19: isolated from wordcr04.c + * latest update: 1995-04-01 + * + */ + +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int ytree_wr_ptr2idx (struct YTREE *yt, void *lmdc) +{ + struct WORD_REF_LIST *wrl; + + lmdc; /* not used here but ytree_process passes data along */ + + if ((wrl= (struct WORD_REF_LIST *) yt->YT_info) + != (struct WORD_REF_LIST *) 0) + { + yt->YT_info= wrl->WRL_index; + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00411.c b/lib/ds/lmd/nl_00411.c new file mode 100644 index 0000000000000000000000000000000000000000..c4210aca22995cd192107b793edefcbf6a9f78ff --- /dev/null +++ b/lib/ds/lmd/nl_00411.c @@ -0,0 +1,30 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00411.c + * + * data + * - functions to create LUTs -- using YTREE + * - see also: wordcr05.c (word reference system) + * + * written: 1990 06 04 + * 1990 11 16: revision + * 1991 03 16: revision; AIX + * 1993-02-28: complete redesign of the refenece system + * 1994-12-19: isolated from wordcr04.c + * latest update: 1995-07-16 + * + */ + +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int ytree_wr_idx2ptr (struct YTREE *yt, void *lmdc) +{ + long wrd_idx; + + if ((wrd_idx= yt->YT_info) >= 0L) + yt->YT_info= (long) lmd_get_word_ref_list ((struct LMDC_CONTROL *) lmdc, + wrd_idx); + + return 0; +} diff --git a/lib/ds/lmd/nl_00500.c b/lib/ds/lmd/nl_00500.c new file mode 100644 index 0000000000000000000000000000000000000000..01d828d5112a5897c8f4934222fea5fd0df17141 --- /dev/null +++ b/lib/ds/lmd/nl_00500.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/lmd/nl_00500.c + * + * create LM/D construction control structor + * + * written: 1994-12-18 + * latest update: 1996-12-22 13:16:37 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct LMDC_CONTROL *lmd_create_control () +{ + struct LMDC_CONTROL *lmdc; + char *cp1; + char *cp2; + + if ((lmdc= (struct LMDC_CONTROL *) calloc (sizeof (struct LMDC_CONTROL), 1)) + != (struct LMDC_CONTROL *) 0 + && (cp1= malloc (LMD_BUFFER_SIZE)) != (char *) 0 + && (cp2= malloc (LMD_BUFFER_SIZE)) != (char *) 0) + { + lmd_initialize_control (lmdc); + + lmdc->LMDC_buffer1= cp1; + lmdc->LMDC_buffer2= cp2; + lmdc->LMDC_buffer_size= LMD_BUFFER_SIZE; + } + + return lmdc; +} diff --git a/lib/ds/lmd/nl_00500.o b/lib/ds/lmd/nl_00500.o new file mode 100644 index 0000000000000000000000000000000000000000..41a331d8df06d1ba0e884297b5f02d0d7e751e61 Binary files /dev/null and b/lib/ds/lmd/nl_00500.o differ diff --git a/lib/ds/lmd/nl_00501.c b/lib/ds/lmd/nl_00501.c new file mode 100644 index 0000000000000000000000000000000000000000..4786d30945d3ff4f06943344b2c8584e3f74ffd0 --- /dev/null +++ b/lib/ds/lmd/nl_00501.c @@ -0,0 +1,100 @@ +/* + * FILE %ds/lmd/nl_00501.c + * + * manipulate word information data structures + * + * written: 1993-02-28 + * 1994-12-18: isolated from wordcr05.c + * latest update: 2001-02-04 20:33:38 + * $Id: nl_00501.c,v 1.3 2001/02/06 20:06:34 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/lookup.h> + +extern long YTREE_ALLOCATED; + +/* ------------------------------------------------------------------------ */ +int lmd_word_statistics ( +struct LMDC_CONTROL *lmdc, +struct WORD_REF *wi, +char *string, +long document_id, +long document_ptr, +char *document_id_str, +int operation, +int loc_operator, +int loc_number, +long loc_code) +{ + struct DOCUMENT_INFO *di; + struct YTREE *yt; + + if (document_id < 0L + || wi->WR_count == -1L /* don't count stop words */ + ) return 0; + + if (++wi->WR_count >= lmdc->LMDC_max_word_count + || document_id == 0L + ) + { + if (document_id > 0L && wi->WR_count == lmdc->LMDC_max_word_count) + printf ("dropping stop word: '%s' count=%ld\n", + (string == (char *) 0) ? "?" : string, + wi->WR_count); + + if (operation == ADD_WORD_REF) operation= DEL_WORD_REF; + } + + switch (operation) + { + case ADD_WORD_REF: + if ((di= lmd_find_document_info (wi, document_id_str)) + == (struct DOCUMENT_INFO *) 0) + { + if ((di= lmd_insert_document_info (wi, document_id, document_id_str)) + == (struct DOCUMENT_INFO *) 0) + return -1; + + wi->WR_docinfo_count++; +#ifdef LMD_EXTENDED_MODEL + di->DI_document_ptr= document_ptr; +#endif /* LMD_EXTENDED_MODEL */ + } + di->DI_hit_count++; + /*** wi->WR_count++; ***/ + +#ifdef LMD_EXTENDED_MODEL + /* put position code into place: */ + /* see implementation notes about details */ + lmd_set_location_code (di, loc_operator, loc_number, loc_code); +#else +#ifdef MSDOS + document_ptr; loc_operator; loc_number; loc_code; +#endif /* MSDOS */ +#endif /* !LMD_EXTENDED_MODEL */ + break; + + case DEL_WORD_REF: + if ((yt= wi->WR_ytree) != (struct YTREE *) 0) + { + long prev= YTREE_ALLOCATED; + ytree_process (yt, lmd_discard_document_node, (void *) 0); + ytree_free (yt); + printf ("discarding WR_ytree ytree prev=%ld now=%ld\n", + prev, YTREE_ALLOCATED); + wi->WR_ytree= (struct YTREE *) 0; + } + /*** wi->WR_count= -1L; ***/ + break; + + default: + return -1; + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00501.o b/lib/ds/lmd/nl_00501.o new file mode 100644 index 0000000000000000000000000000000000000000..b6ca728ec3ec146ad6eaa32191d97cac022189ca Binary files /dev/null and b/lib/ds/lmd/nl_00501.o differ diff --git a/lib/ds/lmd/nl_00502.c b/lib/ds/lmd/nl_00502.c new file mode 100644 index 0000000000000000000000000000000000000000..d218820e0e22b974027e548665fbc0e0f78f49ad --- /dev/null +++ b/lib/ds/lmd/nl_00502.c @@ -0,0 +1,91 @@ +/* + * FILE %nl_kr/lib/nl_00502.c + * + * write word information structures + * - see lmd_read_tables (), handling of lmdd structure used there too + * + * written: 1993-02-28 + * 1994-12-18: isolated from wordcr05.c + * latest update: 1996-12-22 17:48:59 + * $Id: nl_00502.c,v 1.3 2001/08/26 23:26:03 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_write_tables ( +struct LMDC_CONTROL *lmdc, +char *fn_wr, +char *fn_di, +int mode) +{ + FILE *fo_wr= (FILE *) 0; + FILE *fo_di; + struct LMDD_CONTROL *lmdd; + int i; + int rv= -1; + + if ((lmdd= (struct LMDD_CONTROL *) + calloc (sizeof (struct LMDD_CONTROL), 1)) + == (struct LMDD_CONTROL *) 0 + ) return -1; + + if (mode == LMDD_mode_full) + { + if ((fo_wr= fopen (fn_wr, "wb")) == (FILE *) 0 + || (fo_di= fopen (fn_di, "wb")) == (FILE *) 0 + ) goto ERROR; + + /* write table headers */ + dpp_fwrite_long (fo_wr, (long) WORD_REF_SIZE, 4); + for (i= WORD_REF_SIZE - 4; i > 0; i--) fputc (0xFF, fo_wr); + + dpp_fwrite_long (fo_di, (long) DOCUMENT_INFO_SIZE, 4); + for (i= DOCUMENT_INFO_SIZE - 4; i > 0; i--) fputc (0xFF, fo_di); + + lmdd->LMDD_doc_items_offset= 1L; + } + else + { + struct stat st; + int rc; + long siz; + + if ((rc= stat (fn_di, &st)) != 0) goto ERROR; + siz= st.st_size; + siz /= DOCUMENT_INFO_SIZE; + lmdd->LMDD_doc_items_offset= siz; + if ((fo_di= fopen (fn_di, "ab")) == (FILE *) 0) goto ERROR; + } + + /* initialize dump control structure */ + lmdd->LMDD_lmdc= lmdc; + lmdd->LMDD_fo_wr= fo_wr; + lmdd->LMDD_fo_di= fo_di; + lmdd->LMDD_doc_items_offset= 1L; + lmdd->LMDD_items_written= 0L; + lmdd->LMDD_word_index= 1L; + lmdd->LMDD_mode= mode; + + lmd_print_lmdd (stdout, lmdd); + ytree_process (lmdc->LMDC_ytree, lmd_dump_word_entry, lmdd); + lmd_print_lmdd (stdout, lmdd); + + rv= 0; + + fclose (fo_di); + fclose (fo_wr); + +ERROR: + free (lmdd); + + return rv; +} diff --git a/lib/ds/lmd/nl_00502.o b/lib/ds/lmd/nl_00502.o new file mode 100644 index 0000000000000000000000000000000000000000..b26f1fdcbf65d9a64a0391d5bc49cd977df31b5b Binary files /dev/null and b/lib/ds/lmd/nl_00502.o differ diff --git a/lib/ds/lmd/nl_00503.c b/lib/ds/lmd/nl_00503.c new file mode 100644 index 0000000000000000000000000000000000000000..be9eec78a9b9fb308ec53d31fb2298063077ecaa --- /dev/null +++ b/lib/ds/lmd/nl_00503.c @@ -0,0 +1,65 @@ +/* + * FILE %ds/lmd/nl_00503.c + * + * read word information structures + * - see lmd_write_tables () handling of lmdd structure take from there + * + * written: 1993-02-28 + * 1994-12-18: isolated from wordcr05.c + * latest update: 1996-12-22 17:47:03 + * $Id: nl_00503.c,v 1.4 2002/01/29 08:01:42 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +long lmd_read_tables ( +struct LMDC_CONTROL *lmdc, +char *fn_wr, +char *fn_di) +{ + FILE *fo_wr; + FILE *fo_di; + long word_ids; + struct LMDD_CONTROL *lmdd; + +#ifdef DEBUG +printf ("nl_00503.c: fn_wr='%s' fn_di='%s'\n", fn_wr, fn_di); +#endif + + if ((fo_wr= fopen (fn_wr, "rb")) == (FILE *) 0 + ||(fo_di= fopen (fn_di, "rb")) == (FILE *) 0 + ) return -1L; + +/******************* + word_ids= lmd_read_word_ref_list (fo_wr, fo_di, lmdc->LMDC_ytree +*****************/ + + if ((lmdd= (struct LMDD_CONTROL *) calloc (sizeof (struct LMDD_CONTROL), 1)) + == (struct LMDD_CONTROL *) 0) return -1; + + /* setup dump control structure */ + lmdd->LMDD_lmdc= lmdc; + lmdd->LMDD_fo_wr= fo_wr; + lmdd->LMDD_fo_di= fo_di; + lmdd->LMDD_doc_items_offset= 1L; + lmdd->LMDD_items_written= 0L; + lmdd->LMDD_word_index= 1L; + + lmd_print_lmdd (stdout, lmdd); + ytree_process (lmdc->LMDC_ytree, lmd_read_word_ref_list, lmdd); + lmd_print_lmdd (stdout, lmdd); + + fclose (fo_di); + fclose (fo_wr); + + word_ids= lmdd->LMDD_doc_items_written; + free (lmdd); + + return word_ids; +} diff --git a/lib/ds/lmd/nl_00503.o b/lib/ds/lmd/nl_00503.o new file mode 100644 index 0000000000000000000000000000000000000000..069b9d078591b6573c09fbdfb29aeed64a023d70 Binary files /dev/null and b/lib/ds/lmd/nl_00503.o differ diff --git a/lib/ds/lmd/nl_00504.c b/lib/ds/lmd/nl_00504.c new file mode 100644 index 0000000000000000000000000000000000000000..78c28f0672f38960637f7364911ca6d00750fc62 --- /dev/null +++ b/lib/ds/lmd/nl_00504.c @@ -0,0 +1,25 @@ +/* + * FILE %ds/lmd/nl_00504.c + * + * delete all references to a certain document from the + * complete word tree + * + * written: 1993-02-28 + * 1994-12-18: isolated from wordcr05.c + * latest update: 1995-07-22 + * $Id: nl_00504.c,v 1.2 2001/08/26 23:26:03 gonter Exp $ + * + */ + +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_discard_document_id ( +struct LMDC_CONTROL *lmdc, +long doc_id) +{ + ytree_process (lmdc->LMDC_ytree, lmd_discard_doc_id, (void *) doc_id); + + return 0; +} diff --git a/lib/ds/lmd/nl_00504.o b/lib/ds/lmd/nl_00504.o new file mode 100644 index 0000000000000000000000000000000000000000..160fb5a1816dda7cedfce8c9ee887669707a4da2 Binary files /dev/null and b/lib/ds/lmd/nl_00504.o differ diff --git a/lib/ds/lmd/nl_00510.c b/lib/ds/lmd/nl_00510.c new file mode 100644 index 0000000000000000000000000000000000000000..d47f629c8133b1b765b18d1cff6f07dca5ef8473 --- /dev/null +++ b/lib/ds/lmd/nl_00510.c @@ -0,0 +1,74 @@ +/* + * FILE %nl_kr/lib/nl_00510.c + * + * write word info attached to a ytree node into their files + * used while dumping the complete ytree in lmd_write_tables() + * + * written: 1995-07-18 + * latest update: 1995-12-06 + * $Id: nl_00510.c,v 1.3 2001/08/26 23:26:03 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_dump_word_entry (struct YTREE *yt, void *client_data) +{ + struct LMDD_CONTROL *lmdd; + struct WORD_REF *wr; + struct YTREE *doc_infos; + long doc_items_written; + + if (yt == (struct YTREE *) 0 + || (lmdd= (struct LMDD_CONTROL *) client_data) + == (struct LMDD_CONTROL *) 0 + ) + return -1; + + if ((wr= (struct WORD_REF *) yt->YT_info) != (struct WORD_REF *) 0) + { + doc_infos= wr->WR_ytree; + + if (lmdd->LMDD_mode == LMDD_mode_partial + && doc_infos != (struct YTREE *) 0 /* is this possible? */ + && doc_infos->YT_next == (struct YTREE *) 0 + && doc_infos->YT_down == (struct YTREE *) 0 + ) /* only one entry, nothing to do in partial mode ... */ + return 0; + + lmdd->LMDD_doc_items_written= 0L; + ytree_process (doc_infos, lmd_dump_document_info_list, lmdd); + doc_items_written= lmdd->LMDD_doc_items_written; + + if (lmdd->LMDD_mode == LMDD_mode_partial) + { /* create the chaining entry after a partial dump */ + struct DOCUMENT_INFO *di; + + ytree_free (doc_infos); + wr->WR_ytree= (struct YTREE *) 0; + if ((di= lmd_insert_document_info (wr, 0xFFFFFFFE, + "FFFFFFFE" /* this smells buggy, see nl_00601.c */)) + != (struct DOCUMENT_INFO *) 0) + di->DI_hit_count= lmdd->LMDD_doc_items_offset; + } + else + { + lmd_write_word_ref (lmdd->LMDD_fo_wr, wr, + lmdd->LMDD_doc_items_offset, + doc_items_written); + + yt->YT_info= lmdd->LMDD_word_index++; + } + + lmdd->LMDD_doc_items_offset += doc_items_written; + lmdd->LMDD_items_written++; + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00510.o b/lib/ds/lmd/nl_00510.o new file mode 100644 index 0000000000000000000000000000000000000000..7b319770a37bd9e16311f5b83950ac554d7b6796 Binary files /dev/null and b/lib/ds/lmd/nl_00510.o differ diff --git a/lib/ds/lmd/nl_00511.c b/lib/ds/lmd/nl_00511.c new file mode 100644 index 0000000000000000000000000000000000000000..3641dcaafaae0360f3d7d2b7e93913b0db5cb03d --- /dev/null +++ b/lib/ds/lmd/nl_00511.c @@ -0,0 +1,22 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00511.c + * + * manipulate word information data structures + * + * written: 1995-07-18 + * latest update: 1995-07-18 + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_print_lmdd (FILE *fo, struct LMDD_CONTROL *lmdd) +{ + fprintf (fo, "word_index=%ld doc_offset=%ld items_written= %ld\n", + lmdd->LMDD_word_index, lmdd->LMDD_doc_items_offset, + lmdd->LMDD_items_written); + + return 0; +} diff --git a/lib/ds/lmd/nl_00511.o b/lib/ds/lmd/nl_00511.o new file mode 100644 index 0000000000000000000000000000000000000000..1201526638c4b97d60ad2d254eb958a5bb353d08 Binary files /dev/null and b/lib/ds/lmd/nl_00511.o differ diff --git a/lib/ds/lmd/nl_00512.c b/lib/ds/lmd/nl_00512.c new file mode 100644 index 0000000000000000000000000000000000000000..4f17c41115b251441f171f22bc20da17db306bbf --- /dev/null +++ b/lib/ds/lmd/nl_00512.c @@ -0,0 +1,72 @@ +/* + * FILE %ds/lmd/nl_00512.c + * + * manipulate word information data structures + * + * written: 1995-07-18 + * latest update: 1996-08-08 17:23:51 + * $Id: nl_00512.c,v 1.2 2001/08/26 23:26:04 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct INTPR +{ + char *I_name; + long I_code; +} ; + +/* ------------------------------------------------------------------------ */ +static struct YTREE *ytree= (struct YTREE *) 0; +static int initialized= 0; + +/* ------------------------------------------------------------------------ */ +static struct INTPR intpr [] = +{ + { "and", WRint_logic_and } , + { "or", WRint_logic_or } , + { "und", WRint_logic_and } , + { "oder", WRint_logic_or } , + { (char *) 0, 0L } +} ; + +/* ------------------------------------------------------------------------ */ +long lmd_get_interpretation (char *s) +{ + struct YTREE *yt; + int i; + + if (!initialized) + { +#ifdef DEBUG + printf ("lmd_get_interpretation: initializing lexicon\n"); +#endif /* DEBUG */ + + initialized= 1; + for (i= 0; intpr [i].I_name != (char *) 0; i++) + { + if ((yt= ytree_insert_word (&ytree, (unsigned char *) intpr [i].I_name)) + != (struct YTREE *) 0) + { + yt->YT_info= intpr [i].I_code; + yt->YT_flags |= YTflag_EOW; + } + } + } + + if ((yt= ytree_lookup_word (ytree, (unsigned char *) s)) + != (struct YTREE *) 0 + && (yt->YT_flags & YTflag_EOW)) + { +#ifdef DEBUG + printf ("lmd_get_interpretation: code=0x%08lX\n", yt->YT_info); +#endif /* DEBUG */ + return yt->YT_info; + } + + return WRint_null; +} diff --git a/lib/ds/lmd/nl_00512.o b/lib/ds/lmd/nl_00512.o new file mode 100644 index 0000000000000000000000000000000000000000..1aa36a0b6cefa5b4ac0660756a6ffcb8d6d46213 Binary files /dev/null and b/lib/ds/lmd/nl_00512.o differ diff --git a/lib/ds/lmd/nl_00514.c b/lib/ds/lmd/nl_00514.c new file mode 100644 index 0000000000000000000000000000000000000000..aa2195eb8e2844e7bff4f87952b58a2aaffb3726 --- /dev/null +++ b/lib/ds/lmd/nl_00514.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/lmd/nl_00514.c + * + * delete all document info pointers in the document tree + * associated with a WORD_REF structure if document id matches + * or is 0L. + * + * written: 1995-07-19 + * latest update: 2001-02-04 20:36:43 + * $Id: nl_00514.c,v 1.4 2001/09/10 06:58:41 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lmd_discard_document_node (struct YTREE *yt, void *cd) +{ + struct DOCUMENT_INFO *di; + long doc_id; + + doc_id= (long) cd; + + if (yt != (struct YTREE *) 0 + && (yt->YT_flags & YTflag_EOW) + && (di= (struct DOCUMENT_INFO *) yt->YT_info) + != (struct DOCUMENT_INFO *) 0 + && (doc_id <= 0L || doc_id == di->DI_document_id) /* ????? */ + ) + { + free (di); + yt->YT_info= 0L; + } + + return 0; +} diff --git a/lib/ds/lmd/nl_00514.o b/lib/ds/lmd/nl_00514.o new file mode 100644 index 0000000000000000000000000000000000000000..b584a3b32bbf74a506733c37403b7394739bc151 Binary files /dev/null and b/lib/ds/lmd/nl_00514.o differ diff --git a/lib/ds/lmd/nl_00600.c b/lib/ds/lmd/nl_00600.c new file mode 100644 index 0000000000000000000000000000000000000000..91a0c5377046ef4e571a0ac549e07d93238becf8 --- /dev/null +++ b/lib/ds/lmd/nl_00600.c @@ -0,0 +1,84 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00600.c + * + * written: 1995-03-08: extracted from lutmake.c + * latest update: 1995-03-08 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> + +#ifdef JUNK +/* ------------------------------------------------------------------------ */ +/* Dictonary File einlesen */ +read_dic (char *fn) +{ + FILE *fi; + int add, ok; + + if ((fi= fopen (fn, "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -1; + } + + for (;;) + { + ok = dic_get_entry (fi, line, &add, klasse, ispell_info); + if (ok == -1) break; +printf ("wort=%s fcy=%d kl=%s ii=%s\n", line, add, klasse, ispell_info); + SWT (line, add); + word_cnt += (long) add; + } + fclose (fi); +} + +/* ------------------------------------------------------------------------ */ +read_thesaurus (char *fn) +{ + FILE *fi; + + if ((fi= fopen (fn, READ_MODE)) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -1; + } + + for (;;) + { + xx_get_str (fi, line); + if (feof (fi)) break; + SW (line); + word_cnt++; + } + fclose (fi); +} + +/* ------------------------------------------------------------------------ */ +xx_get_str (FILE *fi, char *s) /* Thesaurus Daten File: 54 Byte fixed */ +{ + int ch; + int i; + + for (i=0;i<54;i++) + { + ch=fgetc (fi) & 0x00FF; + if (feof(fi)) { s [0] = 0; return; } + s[i]=ch; + } + + for (i= 0; i < 53; i++) + { + ch= s[i]; + if (ch == ' ' || ch == '\t' || + ch == 0x0A || ch == 0x0D) + break; + } + s[i]=0; +} +#endif diff --git a/lib/ds/lmd/nl_00601.c b/lib/ds/lmd/nl_00601.c new file mode 100644 index 0000000000000000000000000000000000000000..907478288c99909d4a41c0c386cfbee76bbb1995 --- /dev/null +++ b/lib/ds/lmd/nl_00601.c @@ -0,0 +1,191 @@ +/* + * FILE %ds/lmd/nl_00601.c + * + * read a cooked data stream for indexing + * + * written: 1995-03-08: extracted from lutmake.c + * latest update: 2001-02-04 21:05:19 + * $Id: nl_00601.c,v 1.7 2001/10/08 15:01:26 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +static char *stream_commands [] = +{ + "DOCID", + "DOCDEL", + "DOCPTR", + "STOPWORDS", + "DATA", + "data", + "LOCOP", + "LOCNUM", + "LOCCODE" +#define strcmd_docid 0 +#define strcmd_docdel 1 +#define strcmd_docptr 2 +#define strcmd_stopwords 3 +#define strcmd_data 4 +#define strcmd_data_tolower 5 +#define strcmd_locop 6 +#define strcmd_locnum 7 +#define strcmd_loccode 8 +} ; + +/* ------------------------------------------------------------------------ */ +static int l2s (long l, char *s) +{ + int ch; + s[4]= 0; + ch= l % 64; l /= 64; s[3]= (char) 33+ch; + ch= l % 64; l /= 64; s[2]= (char) 33+ch; + ch= l % 64; l /= 64; s[1]= (char) 33+ch; + ch= l % 64; l /= 64; s[0]= (char) 33+ch; + return 0; +} + +/* (description) ---------------------------------------------------------- */ +long lmd_read_stream (struct LMDC_CONTROL *lmdc, char *fn) +{ + FILE *fi; + int fi_open= 0; + int j; + int ll; + long docid= 1L; + long docptr= -1L; + char docid_str [10]; +#define MODE_META 0 +#define MODE_DATA 1 +#define MODE_Data 2 + int mode= MODE_META; + int cmd; + int locop= LOC_CODE_SET; + int locnum= 0; + long loccode= 0L; + long word_count= 0L; + int min_wordlength; + int max_wordlength; + char *line; + int LINE_SIZE; + int rc; + + if (lmdc == (struct LMDC_CONTROL *) 0 + || (line= lmdc->LMDC_buffer1) == (char *) 0 + ) return -1L; + + min_wordlength= lmdc->LMDC_min_wordlength; + max_wordlength= lmdc->LMDC_max_wordlength; + LINE_SIZE= lmdc->LMDC_buffer_size; + + if (strcmp (fn, "-") == 0) fi= stdin; + else + { + fi= fopen (fn, "r"); + fi_open= 1; + } + + if (fi == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -1L; + } + + for (;;) + { + j= fread_line (fi, line, LINE_SIZE); + if (j <= 0 && feof (fi)) break; + if (*line == 0) continue; + + switch (mode) + { + case MODE_META: + if (line[0] == '#') break; + +#ifdef NOT_NOW + if (line[0] == '-') + { + interpret_parameter (line); + break; + } +#endif + + cmd= find_command (line, stream_commands, 0, strcmd_loccode); + switch (cmd) + { + case strcmd_docid: + docid= get_parameter_value (&line[6]); + /**** long_to_hex (docid, docid_str); ***/ + l2s (docid, docid_str); +/*** printf ("docid=%ld docid_str='%s'\n", docid, docid_str); ***/ + break; + case strcmd_docdel: +printf (">>> deleting document id: %ld\n", docid); + lmd_discard_document_id (lmdc, docid); + break; + case strcmd_docptr: + docptr= get_parameter_value (&line[7]); +printf ("docptr=%ld\n", docptr); + break; + case strcmd_data: + mode= MODE_DATA; + break; + case strcmd_data_tolower: + mode= MODE_Data; + break; + case strcmd_stopwords: + mode= MODE_DATA; + docid= 0L; /* document id code for stop words */ + break; + case strcmd_locop: + locop= (int) get_parameter_value (&line[6]); +/*** printf ("locop=%d\n", locop); ***/ + break; + case strcmd_locnum: + locnum= (int) get_parameter_value (&line[7]); +/*** printf ("locnum=%d\n", locnum); ***/ + break; + case strcmd_loccode: + loccode= get_parameter_value (&line[8]); +/*** printf ("loccode=%ld\n", loccode); ***/ + break; + default: + printf ("unknown stream command: %s\n", line); + break; + } + break; + + case MODE_Data: + to_lower (line); + case MODE_DATA: + if (strcmp (line, ".") == 0) + { + mode= MODE_META; + break; + } + ll= strlen (line); + if (ll < min_wordlength) continue; + if (ll > max_wordlength) line [max_wordlength]= 0; + rc= lmd_idx (lmdc, line, docid, docptr, docid_str+4/*** TMP ***/, + locop, locnum, loccode); + if (rc == -1) + { + printf ("error in lmd_idx, stopping! docid_str='%s'\n", docid_str); + goto STOP; + } + if (rc == 0) word_count++; + break; + } + } + +STOP: + if (fi_open == 1) fclose (fi); + + return word_count; +} diff --git a/lib/ds/lmd/nl_00601.o b/lib/ds/lmd/nl_00601.o new file mode 100644 index 0000000000000000000000000000000000000000..98cbea3fed8b7a5f746e17b686f940d2eaa58364 Binary files /dev/null and b/lib/ds/lmd/nl_00601.o differ diff --git a/lib/ds/lmd/nl_00602.c b/lib/ds/lmd/nl_00602.c new file mode 100644 index 0000000000000000000000000000000000000000..5a8fa37ca1bf22f63bdbb0a94ffdca36070bafa4 --- /dev/null +++ b/lib/ds/lmd/nl_00602.c @@ -0,0 +1,95 @@ +/* + * FILE %ds/lmd/nl_00602.c + * + * read and process a text file + * + * written: 1995-03-08: extracted from lutmake.c + * latest update: 1996-12-22 13:02:48 + * $Id: nl_00602.c,v 1.2 2001/08/26 23:26:04 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +static long total_bytes_read= 0L; + +/* ------------------------------------------------------------------------ */ +long lmd_read_tokens ( +struct LMDC_CONTROL *lmdc, +char *fn, +long docid, +char *docid_str, +long f_from, +long f_size, +long f_end, +int verbosity) +{ + FILE *fi; + int rv; + int ll; + int push= 0; + long pos= 0L; + long byr; + long word_count= 0L; + int min_wordlength; + int max_wordlength; + char *line; + + if (lmdc == (struct LMDC_CONTROL *) 0 + || (line= lmdc->LMDC_buffer1) == (char *) 0 + ) return -1L; + + min_wordlength= lmdc->LMDC_min_wordlength; + max_wordlength= lmdc->LMDC_max_wordlength; + + if ((fi= fopen (fn, "r")) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -1L; + } + + fseek (fi, f_from, 0); + if (f_end <= 0L && f_size <= 0L) f_end= 0x7FFFFFFFL; + else if (f_end <= 0L) f_end= f_from+f_size; + + if (verbosity) + fprintf (stderr, "reading tokens from %s, docid=%ld %ld-%ld\n", + fn, docid, f_from, f_end); + + while (pos < f_end) + { + byr= pos; + rv= nl_get_token (fi, line, 0x002F, &push, &pos); + + byr= pos-byr; + total_bytes_read += byr; + if (rv == 0 || pos >= f_end) break; + + if (rv & 0x0003) + { + to_lower (line); + /* printf ("%02X %s\n", rv, line); */ + ll= strlen (line); + if (ll < min_wordlength) continue; + if (ll > max_wordlength) line [max_wordlength]= 0; + lmd_idx (lmdc, line, docid, -1L, docid_str, 0, 0, pos); + } + word_count++; + } + fclose (fi); + +/* ANM: ******************************************************************* */ +/* 0x002F bei nl_get_token: Wort bestehend aus Buchstaben, Ziffern, */ +/* nationalen Sonderzeichen, Symbolen, Underliner. */ +/* 0x0003 bei if ( ) SW( ): Wort muss zumindestens einen Buchstaben oder */ +/* Ziffer haben, um gescort werden zu koennen. */ +/* ************************************************************************ */ + + return word_count; +} diff --git a/lib/ds/lmd/nl_00602.o b/lib/ds/lmd/nl_00602.o new file mode 100644 index 0000000000000000000000000000000000000000..cb3852f494834d746808d67a7244357224e52f8e Binary files /dev/null and b/lib/ds/lmd/nl_00602.o differ diff --git a/lib/ds/lmd/nl_00603.c b/lib/ds/lmd/nl_00603.c new file mode 100644 index 0000000000000000000000000000000000000000..42e4bd8ea19fdcb932942d6ee3c23092c14906d2 --- /dev/null +++ b/lib/ds/lmd/nl_00603.c @@ -0,0 +1,80 @@ +/* + * FILE %ds/lmd/nl_00603.c + * + * read a list of documents for indexing + * + * written: 1995-03-08: extracted from lutmake.c + * latest update: 1995-07-31 + * $Id: nl_00603.c,v 1.2 2001/08/26 23:26:04 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +static char *batch_commands[] = +{ + "add", /* add <docid> <filename> */ + "del", /* del <docid> */ + "upd" /* upd <docid> <filename> */ +#define BATCH_add 0 +#define BATCH_del 1 +#define BATCH_upd 2 +} ; + +/* ------------------------------------------------------------------------ */ +long lmd_batch_process (struct LMDC_CONTROL *lmdc, char *fn, int verbosity) +{ + long docid; + FILE *fb; + int cmd_code; + int rc; + long rv; + char *cmd_str; + long word_count= 0L; + int MAX_STR; + char docid_str [10]; + + if (lmdc == (struct LMDC_CONTROL *) 0 + || (cmd_str= lmdc->LMDC_buffer2) == (char *) 0) return -1L; + + if ((fb= fopen (fn, "r")) == (FILE *) 0) return -1L; + printf ("reading batch from %s\n", fn); + MAX_STR= lmdc->LMDC_buffer_size; + + for (;;) + { + rc= fread_line (fb, cmd_str, MAX_STR); + if (rc <= 0 && feof (fb)) break; + if (cmd_str [0] == '#' + || (cmd_code= find_command (cmd_str, batch_commands, 0, BATCH_upd)) == -1 + ) + continue; + + docid= get_parameter_value (locate_word (cmd_str, 1)); + + long_to_hex (docid, docid_str); /* T2D, Bug: see nl_00601.c */ + + switch (cmd_code) + { + case BATCH_del: + case BATCH_upd: + lmd_discard_document_id (lmdc, docid); + if (cmd_code == BATCH_del) break; + case BATCH_add: + if ((rv= lmd_read_tokens (lmdc, locate_word (cmd_str, 2), + docid, docid_str, 0L, + 0L, 0x7FFFFFFFL, verbosity)) + > 0L) word_count += rv; + break; + } + } + fclose (fb); + + return word_count; +} diff --git a/lib/ds/lmd/nl_00603.o b/lib/ds/lmd/nl_00603.o new file mode 100644 index 0000000000000000000000000000000000000000..9d88ef73f8d91bd56e723e7589d221ae49e226a8 Binary files /dev/null and b/lib/ds/lmd/nl_00603.o differ diff --git a/lib/ds/lmd/nl_00604.c b/lib/ds/lmd/nl_00604.c new file mode 100644 index 0000000000000000000000000000000000000000..3e166a3c77b893f12d0592b5633f67191c2ab590 --- /dev/null +++ b/lib/ds/lmd/nl_00604.c @@ -0,0 +1,103 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00604.c + * + * read and process a text file + * + * written: 1995-03-08: extracted from lutmake.c + * latest update: 1995-07-31 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/hyx.h> + +/* ------------------------------------------------------------------------ */ +static char *LEVEL [] = { "note", "warning", "error" }; + +/* ------------------------------------------------------------------------ */ +long lmd_docdir_process ( +struct LMDC_CONTROL *lmdc, +char *fn, +int match_c, +char *match_v [], +int verbosity) +{ + FILE *fb; + long docid; + long f_from; + long f_to; + long f_size; + char *reason; + int reason_level; + long rv; + char *str1, *str2; + int MAX_STR; + long word_count= 0L; + char docid_str [10]; + + if (lmdc == (struct LMDC_CONTROL *) 0 + || (str1= lmdc->LMDC_buffer1) == (char *) 0 + || (str2= lmdc->LMDC_buffer2) == (char *) 0) return -1L; + + MAX_STR= lmdc->LMDC_buffer_size; + if ((fb= fopen (fn, "r")) == (FILE *) 0) return -1L; + printf ("reading document directory from %s\n", fn); + + for (;;) + { + fread_line (fb, str1, MAX_STR); + if (feof (fb)) break; + + if (str1 [0] == '#') continue; + reason= "no hyx.dd tag"; + reason_level= 1; + if (strncmp (str1, "<hyx.dd ", 8) != 0) + { +REPORT: + fprintf (stderr, + "%s: didn\'t process %s, reason: %s\n", + LEVEL [reason_level], + str1, reason); + continue; + } + + reason= "no docid attribute"; + if (find_attr_value (str1, str2, MAX_STR, "docid") != 0) goto REPORT; + docid= get_parameter_value (str2); + long_to_hex (docid, docid_str); + + f_from= f_size= f_to= 0L; + if (find_attr_value (str1, str2, MAX_STR, "from") == 0) + f_from= get_parameter_value (str2); + + if (find_attr_value (str1, str2, MAX_STR, "size") == 0) + f_size= get_parameter_value (str2); + + if (find_attr_value (str1, str2, MAX_STR, "to") == 0) + f_to= get_parameter_value (str2); + + if (match_c > 0) + { + reason= "no set attribute, but sets are checked"; + if (find_attr_value (str1, str2, MAX_STR, "set") != 0) goto REPORT; + reason_level= 0; + reason= "not included in set"; + if (match_array (match_v, match_c, str2) < 0) goto REPORT; + } + + reason= "no file attribute"; + if (find_attr_value (str1, str2, MAX_STR, "file") != 0) goto REPORT; + + if ((rv= lmd_read_tokens (lmdc, str2, docid, docid_str, + f_from, f_size, f_to, verbosity)) > 0L) + word_count += rv; + } + fclose (fb); + + return word_count; +} diff --git a/lib/ds/lmd/nl_00604.o b/lib/ds/lmd/nl_00604.o new file mode 100644 index 0000000000000000000000000000000000000000..609df6d48a4d4c69a652a82d90239b698445c3af Binary files /dev/null and b/lib/ds/lmd/nl_00604.o differ diff --git a/lib/ds/lmd/nl_00605.c b/lib/ds/lmd/nl_00605.c new file mode 100644 index 0000000000000000000000000000000000000000..afb606a12af3403379fae4bd05ef9700167492db --- /dev/null +++ b/lib/ds/lmd/nl_00605.c @@ -0,0 +1,94 @@ +/* + * FILE %nl_kr/lib/nl_00605.c + * + * read and process a text file + * + * written: 1995-03-08: extracted from lutmake.c + * latest update: 1995-12-05 + * $Id: nl_00605.c,v 1.2 2001/10/08 15:01:26 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +long lmd_veronica_process ( +struct LMDC_CONTROL *lmdc, +char *fn, +int *alphabet) +{ + FILE *fi; + int ls; +#define N_FIELDS 20 + char *fields [N_FIELDS]; + char *w1; +#define N_WORDS 40 /* maximum number of isolated words on line */ + char *words [N_WORDS]; /* isolated words */ + char *wrd; /* currently processed word */ + int fc; + int wc; + long pos= 0L; + int i; + int ll; + int min_wordlength; + int max_wordlength; + long word_count= 0L; + char *str1; + int MAX_STR; + char docid_str [10]; + + if (lmdc == (struct LMDC_CONTROL *) 0 + || (str1= lmdc->LMDC_buffer1) == (char *) 0 + ) return -1L; + + if ((fi= fopen (fn, "r")) == (FILE *) 0) + { + fprintf (stderr, "can't read veronica directory %s\n", fn); + return -1L; + } + + MAX_STR= lmdc->LMDC_buffer_size; + min_wordlength= lmdc->LMDC_min_wordlength; + max_wordlength= lmdc->LMDC_max_wordlength; + + for (;;) + { + ls= fread_line (fi, str1, MAX_STR); + if (ls <= 0L && feof (fi)) break; + +/* printf ("line=%s\n", line); */ + if (str1 [0] == 'i') goto NEXT; /* no info items */ + + fc= split_string (str1, '\t', fields, N_FIELDS); + if (fc < 4) continue; + w1= &str1[1]; + wc= isolate2words (w1, words, N_WORDS, alphabet); + if (wc > N_WORDS) wc= N_WORDS; + + pos++; + long_to_hex (pos, docid_str); + for (i= 0; i<wc; i++) + { + wrd= words [i]; + to_lower (wrd); +/* printf (" word=%s\n", wrd); */ + ll= strlen (wrd); + if (ll < min_wordlength) continue; + if (ll > max_wordlength) wrd [max_wordlength]= 0; + lmd_idx (lmdc, wrd, pos, -1L, docid_str, 0, 0, 0L); + word_count++; + } + +NEXT: + pos= ftell (fi); + } + + fclose (fi); + + return word_count; +} diff --git a/lib/ds/lmd/nl_00605.o b/lib/ds/lmd/nl_00605.o new file mode 100644 index 0000000000000000000000000000000000000000..a6abffed700c44db2aa4783a77de7f8191c7632e Binary files /dev/null and b/lib/ds/lmd/nl_00605.o differ diff --git a/lib/ds/lmd/nl_00606.c b/lib/ds/lmd/nl_00606.c new file mode 100644 index 0000000000000000000000000000000000000000..300835b3473766d340ab1de44e3c46c5b3da69b6 --- /dev/null +++ b/lib/ds/lmd/nl_00606.c @@ -0,0 +1,95 @@ +/* + * FILE %nl_kr/lib/nl_00606.c + * + * read and process a text file + * + * written: 1995-03-08: extracted from lutmake.c + * latest update: 1995-12-05 + * $Id: nl_00606.c,v 1.2 2001/10/08 15:01:26 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +long lmd_read_tfb ( +struct LMDC_CONTROL *lmdc, +char *fn, +int position, +int TFB_delimiter, +int *alphabet) +{ + FILE *fi; + int ls; +#define N_FIELDS 20 + char *fields [N_FIELDS]; + char *w1; +#define N_WORDS 40 + char *words [N_WORDS]; + char *wrd; + int fc; + int wc; + long pos= 0L; + int i; + int ll; + int min_wordlength; + int max_wordlength; + char *str1; + int MAX_STR; + long word_count= 0L; + char docid_str [10]; + int rc; + + if (lmdc == (struct LMDC_CONTROL *) 0 + || (str1= lmdc->LMDC_buffer1) == (char *) 0 + ) return -1L; + + MAX_STR= lmdc->LMDC_buffer_size; + min_wordlength= lmdc->LMDC_min_wordlength; + max_wordlength= lmdc->LMDC_max_wordlength; + + if ((fi= fopen (fn, "r")) == (FILE *) 0) + { + fprintf (stderr, "can't read tfb file %s\n", fn); + return -1L; + } + + for (;;) + { + ls= fread_line (fi, str1, MAX_STR); + if (ls <= 0L && feof (fi)) break; +/* printf ("line=%s\n", line); */ + + if ((fc= split_string (str1, TFB_delimiter, fields, N_FIELDS)) < 1) + continue; + + w1= fields [position]; + if ((wc= isolate2words (w1, words, N_WORDS, alphabet)) > N_WORDS) + wc= N_WORDS; + + pos++; + long_to_hex (pos, docid_str); + for (i= 0; i < wc; i++) + { + wrd= words [i]; + ll= strlen (wrd); + if (ll < min_wordlength) continue; + if (ll > max_wordlength) wrd [max_wordlength]= 0; + to_lower (wrd); + + rc= lmd_idx (lmdc, wrd, pos, -1L, docid_str, 0, 0, 0L); + if (rc == 0) word_count++; + } + + pos= ftell (fi); + } + + fclose (fi); + + return word_count; +} diff --git a/lib/ds/lmd/nl_00606.o b/lib/ds/lmd/nl_00606.o new file mode 100644 index 0000000000000000000000000000000000000000..12d028f3ff590837f48f59d9476891ff54d4dc45 Binary files /dev/null and b/lib/ds/lmd/nl_00606.o differ diff --git a/lib/ds/lmd/nl_00607.c b/lib/ds/lmd/nl_00607.c new file mode 100644 index 0000000000000000000000000000000000000000..e904448c05539fe4fa0ba6695e373796879f676a --- /dev/null +++ b/lib/ds/lmd/nl_00607.c @@ -0,0 +1,65 @@ +/* + * FILE %ds/lmd/nl_00607.c + * + * read and process a text file + * + * ** OBSOLETE ** + * + * written: 1995-03-08: extracted from lutmake.c + * latest update: 1996-12-22 13:59:04 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +static long total_bytes_read= 0L; + +/* ------------------------------------------------------------------------ */ +long lmd_read_words ( +struct LMDC_CONTROL *lmdc, +char *fn) +{ + FILE *fi; + int ll; + int min_wordlength; + int max_wordlength; + char *line; + int MAX_STR; + long word_count= 0L; + + if (lmdc == (struct LMDC_CONTROL *) 0 + || (line= lmdc->LMDC_buffer1) == (char *) 0) return -1L; + + MAX_STR= lmdc->LMDC_buffer_size; + min_wordlength= lmdc->LMDC_min_wordlength; + max_wordlength= lmdc->LMDC_max_wordlength; + + if ((fi= fopen (fn, "r")) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -1L; + } + + for (;;) + { + total_bytes_read += (long) nl_get_str (fi, line); + if (feof (fi)) break; + + ll= strlen (line); + if (ll < min_wordlength) continue; + if (ll > max_wordlength) line [max_wordlength]= 0; + to_lower (line); + + lmd_SW (lmdc, line); + word_count++; + } + fclose (fi); + + return word_count; +} diff --git a/lib/ds/lmd/nl_00607.o b/lib/ds/lmd/nl_00607.o new file mode 100644 index 0000000000000000000000000000000000000000..66fc0ba626434409fc5f5c715b07e6a15b6232b2 Binary files /dev/null and b/lib/ds/lmd/nl_00607.o differ diff --git a/lib/ds/lmd/nl_00608.c b/lib/ds/lmd/nl_00608.c new file mode 100644 index 0000000000000000000000000000000000000000..bee46627cfd61ee3b9e04250c2252f23a13906fd --- /dev/null +++ b/lib/ds/lmd/nl_00608.c @@ -0,0 +1,50 @@ +/* + * FILE %ds/lmd/nl_00608.c + * + * read and process a text file + * + * written: 1995-03-08: extracted from lutmake.c + * latest update: 1996-03-17 19:39:18 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +/* read frequency table */ +long lmd_read_fcy ( +struct LMDC_CONTROL *lmdc, +char *fn) +{ + FILE *fi; + int v1, v2; + char *line; + long word_count= 0L; + + if (lmdc == (struct LMDC_CONTROL *) 0 + || (line= lmdc->LMDC_buffer1) == (char *) 0 + ) return -1L; + + if ((fi= fopen (fn, "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -1L; + } + + for (;;) + { + fscanf (fi, "%d%d%s", &v1, &v2, line); + if (feof (fi)) break; + + lmd_SWX (lmdc, line, ((long) v1) + (((long) v2)*0x10000L)); + word_count += v1; + } + fclose (fi); + + return word_count; +} diff --git a/lib/ds/lmd/nl_00608.o b/lib/ds/lmd/nl_00608.o new file mode 100644 index 0000000000000000000000000000000000000000..ae13a3d726bf60b1102a2c93fda9b4f91541cd61 Binary files /dev/null and b/lib/ds/lmd/nl_00608.o differ diff --git a/lib/ds/lmd/nl_00609.c b/lib/ds/lmd/nl_00609.c new file mode 100644 index 0000000000000000000000000000000000000000..792926c5a5ea5958f70f29175bf6e83de6324f66 --- /dev/null +++ b/lib/ds/lmd/nl_00609.c @@ -0,0 +1,56 @@ +/* + * FILE ~/usr/nl_kr/lib/nl_00609.c + * + * read and process a text file + * + * written: 1995-03-08: extracted from lutmake.c + * latest update: 1995-07-09 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/lookup.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +/* Frequency table einlesen */ +long lmd_read_long_fcy ( +struct LMDC_CONTROL *lmdc, +char *fn) +{ + FILE *fi; + long fcy; + char *line; + int MAX_STR; + int rc; + long word_count= 0L; + char *fields [2]; + + if (lmdc == (struct LMDC_CONTROL *) 0 + || (line= lmdc->LMDC_buffer1) == (char *) 0) return -1L; + + MAX_STR= lmdc->LMDC_buffer_size; + + if ((fi= fopen (fn, "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -1L; + } + + for (;;) + { + rc= fread_line (fi, line, MAX_STR); + if (rc <= 0 && feof (fi)) break; + if (isolate_tokens (line, fields, 2) < 2) continue; + fcy= get_parameter_value (fields [0]); + + lmd_SWT (lmdc, fields [1], fcy); + word_count += fcy; + } + fclose (fi); + + return word_count; +} diff --git a/lib/ds/lmd/nl_00609.o b/lib/ds/lmd/nl_00609.o new file mode 100644 index 0000000000000000000000000000000000000000..11120278b2a9cf56b763b1bdee7d5be73f1ee734 Binary files /dev/null and b/lib/ds/lmd/nl_00609.o differ diff --git a/lib/ds/lmd/nl_00610.c b/lib/ds/lmd/nl_00610.c new file mode 100644 index 0000000000000000000000000000000000000000..d373005ca0449e93321ae7f19bcad9d76ee7332e --- /dev/null +++ b/lib/ds/lmd/nl_00610.c @@ -0,0 +1,141 @@ +/* + * FILE %nl_kr/lib/nl_00610.c + * + * read and process a hypertext cluster + * + * written: 1995-12-05 + * latest update: 1995-12-05 + * $Id: nl_00610.c,v 1.2 2001/10/08 15:01:26 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/fileio.h> +#include <gg/hytxt.h> +#include <gg/sbr.h> +#include <gg/dpp.h> +#include <gg/strings.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +long lmd_read_hyx_cluster ( +struct LMDC_CONTROL *lmdc, +char *fnm_hyx, +char *fnm_idx, +int *alphabet) +{ + long last_frame; /* highest index in the hypertext clustr */ + long frame_number; /* current cluster number */ + long size; /* size of current frame */ + int rc; /* read count */ +#define N_WORDS 80 /* maximum number of isolated words on line */ + char *words [N_WORDS]; /* isolated words */ + char *wrd; /* currently processed word */ + int wc; /* number of words actually isolated */ + int word_number; /* index of the currently processed word */ + int word_length; /* length of the currently processed word */ + char docid_str [10]; /* document id as string, cluster number */ + char *bu; /* line buffer */ + int MAX_STR; /* size of line buffer */ + int min_wordlength; + int max_wordlength; + long word_count= 0L; /* overall total number of words processed */ + long pos; /* filepointer position in cluster */ + int first_line; /* flag to indicate the first line in frame */ + + FILE *fi_hyx= (FILE *) 0; + FILE *fi_idx= (FILE *) 0; + + if (lmdc == (struct LMDC_CONTROL *) 0 + || (bu= lmdc->LMDC_buffer1) == (char *) 0 + || (last_frame= hyx_get_last_index (fnm_idx)) <= 0L + || (fi_hyx= flopen (fnm_hyx, "rb")) == (FILE *) 0 + || (fi_idx= flopen (fnm_idx, "rb")) == (FILE *) 0 + ) + goto END; + + MAX_STR= lmdc->LMDC_buffer_size; + min_wordlength= lmdc->LMDC_min_wordlength; + max_wordlength= lmdc->LMDC_max_wordlength; + + for (frame_number= 1L; frame_number <= last_frame; frame_number++) + { + size= hyx_seek_by_index (fi_hyx, fi_idx, frame_number); + +#ifdef __COMMENT__ +1995-12-05 17:28:16 +T2D, strategic desgin +Well, that is not really a nice way to treat a SGML file, but let us +start and change that stuff as soon as there is a need to change +it or the functions to do the dirty jobs are there.... +#endif /* __COMMENT__ */ + + long_to_hex (frame_number, docid_str); + + if (lmdc->LMDC_verbosity > 1) + printf ("frame number: %s, size=%ld\n", docid_str, size); + + first_line= 1; + while (size > 0L) + { + pos= ftell (fi_hyx); + rc= fread_line (fi_hyx, bu, MAX_STR); + if (rc <= 0 && feof (fi_hyx)) break; + pos= ftell (fi_hyx) - pos; + if (pos > size) bu [(int) size]= 0; + size -= pos; + + if (first_line) + { +#ifdef __COMMENT__ +1995-12-05 20:46:25 +T2D, tactical desgin +At this point we could record the frame name anywhere since it is +already right at our hands ... +#endif /* __COMMENT__ */ + if (lmdc->LMDC_verbosity > 1) + { + fputs (bu, stdout); + fputc ('\n', stdout); + } + + if (strstr (bu, "Frame $$index") != (char *) 0 + || strstr (bu, "Frame $$md5") != (char *) 0 + ) /* dont need that stuff... */ + break; + + first_line= 0; + } + + wc= isolate2words (bu, words, N_WORDS, alphabet); + if (wc > N_WORDS) wc= N_WORDS; + + for (word_number= 0; word_number < wc; word_number++) + { + wrd= words [word_number]; + to_lower (wrd); + +/* OK, 1995-12-05 19:54:03 ************* +printf ("word=%s", wrd); +***************************************/ + + word_length= strlen (wrd); + if (word_length < min_wordlength) continue; + if (word_length > max_wordlength) wrd [max_wordlength]= 0; + rc= lmd_idx (lmdc, wrd, frame_number, -1L, docid_str, 0, 0, 0L); + if (rc == 0) word_count++; +/* printf (" cnt=%ld\n", word_count); */ + } + } + } + + if (lmdc->LMDC_verbosity > 0) + printf ("processed %ld frames from cluster '%s'\n", last_frame, fnm_hyx); + +END: + fclose_or_what (fi_hyx); + fclose_or_what (fi_idx); + + return word_count; +} diff --git a/lib/ds/lmd/nl_00610.o b/lib/ds/lmd/nl_00610.o new file mode 100644 index 0000000000000000000000000000000000000000..385ac5c33d3035cc8aab5395ccbed8b111f41f81 Binary files /dev/null and b/lib/ds/lmd/nl_00610.o differ diff --git a/lib/ds/lmd/nl_01001.c b/lib/ds/lmd/nl_01001.c new file mode 100644 index 0000000000000000000000000000000000000000..20de69ee33303522759831c3dc6447c8ad211311 --- /dev/null +++ b/lib/ds/lmd/nl_01001.c @@ -0,0 +1,103 @@ +/* + * FILE %ds/lmd/nl_01001.c + * + * written: 1991 02 16 + * latest update: 1997-08-28 13:23:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +struct FCY +{ + struct FCY *next; + long freq; + char w[2]; +} ; + +/* ------------------------------------------------------------------------ */ +static struct FCY *fcy_list= (void *) 0; + +static long total_words= 0L; +static long total_unique= 0L; + +/* ------------------------------------------------------------------------ */ +int sort_by_frequency (char *wort, long frequency) +{ + struct FCY *fl; + struct FCY **flp; + + total_words += frequency; + + /* 1. gleiche Worte aufsuchen */ +#ifdef NOT_USED + for (flp = &fcy_list; (fl = *flp) != (void *) 0; flp = &fl->next) + if (strcmp (fl->w, wort) == 0) + { + fl->freq += frequency; + return 0; + } +#endif + + /* 2. einsortieren nach Frequenz */ + for (flp = &fcy_list; (fl = *flp) != (void *) 0; flp = &fl->next) + if (fl->freq < frequency + || (fl->freq == frequency + && strcmp (fl->w, wort) > 0)) break; + + /* Wort nicht gefunden -> hinten an die Liste anfuegen */ + fl = malloc (sizeof (struct FCY) + strlen (wort)-1); + fl->next = *flp; + fl->freq = frequency; + strcpy (fl->w, wort); + *flp = fl; + total_unique++; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int print_sorted (FILE *fo) +{ + struct FCY *fl; + long wc=0L; + long fcy=0L; + long fcy_acc=0L; + double pct; + double pct_acc; + + fprintf (fo, "rank (pct) freq. (pct) accum. word\n"); + for (fl = fcy_list; fl != (void *) 0; fl = fl->next) + { + wc++; +#ifdef JUNK + if (fcy != fl->freq) + { +#endif + fcy = fl->freq; + pct = (double) (fcy*100L); + pct = pct / (double) total_words; + fprintf (fo, "%4ld %3ld%% %6ld %6.2f%% ", + wc, wc*100L/total_unique, fcy, pct); +#ifdef JUNK + } + else { + fprintf (fo, " "); + } +#endif + + fcy_acc += fcy; + pct_acc = (double) (fcy_acc*100L); + pct_acc = pct_acc / (double) total_words; + fprintf (fo, "%6.2f%% %s\n", pct_acc, fl->w); + } + return 0; +} diff --git a/lib/ds/lmd/nl_01001.o b/lib/ds/lmd/nl_01001.o new file mode 100644 index 0000000000000000000000000000000000000000..e400520f1d187f53e77eec45a2783d5d06642d79 Binary files /dev/null and b/lib/ds/lmd/nl_01001.o differ diff --git a/lib/ds/lmd/rdtoken.c b/lib/ds/lmd/rdtoken.c new file mode 100644 index 0000000000000000000000000000000000000000..2f895b1612b0355dcd93927cd16a9d637f0b652d --- /dev/null +++ b/lib/ds/lmd/rdtoken.c @@ -0,0 +1,274 @@ +/* + * FILE E:\usr\nl_kr\lib\rdtoken.c + * + * Testmodul zum Lesen von Tokens (Module NL_00004.C) + * + * 1990 01 21 + * + */ + +# include <stdio.h> +# include <gg/fnames.h> + +extern long ftell (); + +# define STDHLP stderr +# define ARG_C_max 24 +static char *arg_v [ARG_C_max]; +static int arg_c = 0; + +# define SUBDIRS /* Rekusive Suche durch das Filesystem moeglich */ +# define XXXX xxxx /* Name der Programmfunktion */ + +static char filenm [64]; +static char line [400]; + +# ifdef SUBDIRS +/* Where to search: recursion through directory tree: --------------------- */ +static char actual_filenm [128]; +static char actual_drive [ 2]; +static char actual_path [128]; +static char actual_pattern [ 30]; +static int subdirs = 0; +#endif + +/* ------------------------------------------------------------------------ */ +static int verbose_mode = 0; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ "USAGE: XXXX [options] {file name}\n", + "OPTIONS: -f<filename> ... List of Files\n", +# ifdef SUBDIRS + " -s -r ... Subdirs\n", +#endif + " -v ... Verbose Mode\n", + "EXAMPLES: \n", + "\n", + "(@)AXXXX.c 0.0 #D$1989-02-14 15:45:00\n", + "\n", +# include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +main (argc, argv) +int argc; +char *argv []; +{ FILE *fi2; + int i, j; + + if (argc <= 1) goto HLP; + for (i = 1; i < argc; i++) + if (argv [i][0] == '-' || argv [i][0] == '/') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + +# ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': +#endif + case 'v': case 'V': + for (j=1; argv [i][j]; j++) + switch (argv [i][j]) + { +# ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': + subdirs = 1; + break; +#endif + case 'v': case 'V': + verbose_mode = 1; + break; + } + break; + +HLP: +# include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + if (arg_c) + for (i = 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if (access (& arg_v [i][2], 0) != 0) + { fprintf (stderr, "File %s not found!\n", + &arg_v [i][2]); + break; + } + fi2 = fopen (& arg_v [i][2], "rt"); + for (;;) + { fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; + wildcards (filenm); +# ifdef SUBDIRS + if (wildcards_or_rec (filenm) == -1) + { + fclose (fi2); + goto STOP; + } +#else + wildcards (filenm); +#endif + } + fclose (fi2); + } +# ifdef SUBDIRS + else { if (wildcards_or_rec (arg_v [i]) == -1) goto STOP; } + else wildcards_or_rec ("*.*"); +# else + else wildcards (arg_v [i]); + else XXXX ("Default.fil"); +# endif + +STOP: + return 0; +} + +/* ------------------------------------------------------------------------ */ +# ifdef SUBDIRS +static rec_wildcards (int lev) +{ + struct dta_buff l_dta; + int actual_path_length; + int look; + + Fsetdta (&l_dta); + +/* fprintf (stderr, "%2d RC1: actual_path=%s\n", lev, actual_path); */ + actual_path_length = strlen (actual_path); + if (actual_path_length) + sprintf (actual_filenm, "%s\\%s", actual_path, actual_pattern); + else sprintf (actual_filenm, "%s", actual_pattern); + if (wildcards (actual_filenm) == -1) return -1; + + if (actual_path_length) + sprintf (actual_filenm, "%s\\*.*", actual_path); + else strcpy (actual_filenm, "*.*"); + + Fsetdta (&l_dta); + for (look=Fsfirst (actual_filenm, 0x10); + !look; + look=Fsnext ()) + { + if ((l_dta.att & 0x10) == 0 || + strcmp (l_dta.name, ".") == 0 || + strcmp (l_dta.name, "..") == 0) + continue; + if (actual_path_length) + sprintf (& actual_path [actual_path_length], "\\%s", l_dta.name); + else sprintf (& actual_path [actual_path_length], "%s", l_dta.name); + if (rec_wildcards (lev+1) == -1) return -1; + Fsetdta (&l_dta); + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +wildcards_or_rec (fn) +char *fn; +{ + int i; + int drive_letter, path_length; + + if (subdirs) + { + for (i=strlen (fn) -1; i >= 0; i--) + if (fn [i] == '\\' || fn [i] == ':') break; + strcpy (actual_path, fn); + if (i>=0) + if (actual_path [i] == ':') + actual_path [i+1]= 0; + else actual_path [i ]= 0; + else actual_path [ 0]= 0; + strcpy (actual_pattern, &fn [i+1]); + if (actual_pattern [0] == 0) + strcpy (actual_pattern, "*.*"); + path_length = strlen (actual_path); + if (actual_path [1] == ':' && actual_path [0] == '*') + { + i = bdos (0x19, 0x00, 0x00); /* aktuelles Drive ermitteln */ + drive_letter = bdos (0x0E, i, 0x00) & 0x00FF; + drive_letter += 'A'; i &= 0x00FF; + for (i = (i >= 2) ? 'C' : i+'A' ; + i < drive_letter; + i++) + { + actual_path [0] = i; + if (rec_wildcards (1) == -1) return -1; + actual_path [path_length] = 0; + } + } + else { + if (rec_wildcards (1) == -1) return -1; + } + } + else { + path_length = strlen (fn); + if (fn [1] == ':' && fn [0] == '*') + { + i = bdos (0x19, 0x00, 0x00); /* aktuelles Drive ermitteln */ + drive_letter = bdos (0x0E, i, 0x00) & 0x00FF; + drive_letter += 'A'; i &= 0x00FF; + for (i = (i >= 2) ? 'C' : i+'A' ; + i < drive_letter; + i++) + { + fn [0] = i; + if (wildcards (fn) == -1) return -1; + fn [path_length] = 0; + } + } + else { + if (wildcards (fn) == -1) return -1; + } + } + return 0; +} +#endif + +/* ------------------------------------------------------------------------ */ +wildcards (fn) +char *fn; +{ char *nm; int wild=0; + for (nm=fn; *nm && !wild; nm++) + if (*nm == '*' || *nm == '?') wild=1; + if (wild) + while ((nm=Fname_find (fn, FA_FILE)) != (char *) 0) + XXXX (nm); + else XXXX (fn); +} + +/* ------------------------------------------------------------------------ */ +XXXX (fn) +char *fn; +{ + FILE *fi; + int ch, rv; + long pos=0L; + + if (access (fn, 0) != 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -2; + } + + ch = 0; + fi = fopen (fn, "rb"); + for (;;) + { + printf ("%6lX ", ftell (fi)); + rv = nl_get_token (fi, line, 0x0007, &ch, &pos); + if (rv == 0) break; + printf ("@0x%08lX 0x%04X: 0x%02X `%s'\n", pos, rv, ch, line); + } + printf ("EOF\n"); + fclose (fi); +} diff --git a/lib/ds/lmd5/(dirinf).fm b/lib/ds/lmd5/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..8db90d8c9a3919c409c00b7b9d5d3e234c2196d1 --- /dev/null +++ b/lib/ds/lmd5/(dirinf).fm @@ -0,0 +1,22 @@ +# +# FILE %ds/lmd5/(dirinf).fm +# +# written: 1996-04-12 +# latest update: 1996-05-07 11:55:59 +# + +# see also: <gg/lmd5.h> and irdb +(dirinf).fm Contents +makefile DOS version of Makefile +make-ux Unix version of Makefile + +lm5.c indexer +lmd5.doc preliminary documentation + +lmd50000.c TEMPLATE + +lmd50001.c create control structure +lmd50002.c increment word counter +lmd50003.c process stream +lmd50004.c increment document counter +lmd50005.c set info attribute/value diff --git a/lib/ds/lmd5/.cvsignore b/lib/ds/lmd5/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..ba35394952add3f1d3243a874fbcc6ac78c17e91 --- /dev/null +++ b/lib/ds/lmd5/.cvsignore @@ -0,0 +1 @@ +lm5 diff --git a/lib/ds/lmd5/Makefile b/lib/ds/lmd5/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..25e96f26972956ec9264022a742e288f54194ea9 --- /dev/null +++ b/lib/ds/lmd5/Makefile @@ -0,0 +1,34 @@ +# +# FILE %ds/lmd5/make-ux +# +# written: 1996-04-01 +# latest update: 1999-05-08 9:49:43 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib +all.bin: lm5 + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + lmd50001.o lmd50002.o lmd50003.o lmd50004.o lmd50005.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +lm5: lm5.o $(LIB) + $(CC) -o lm5 lm5.o $(LIB) + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib diff --git a/lib/ds/lmd5/contrib b/lib/ds/lmd5/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/lmd5/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/lmd5/gg b/lib/ds/lmd5/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/lmd5/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/lmd5/lib b/lib/ds/lmd5/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/lmd5/libgg.a b/lib/ds/lmd5/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/lmd5/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/lmd5/lm5.c b/lib/ds/lmd5/lm5.c new file mode 100644 index 0000000000000000000000000000000000000000..9b61b8710e3d1c245afff01feae42acd6638be6d --- /dev/null +++ b/lib/ds/lmd5/lm5.c @@ -0,0 +1,225 @@ +/* + * FILE %ds/lmd5/lm5.c + * + * template, standard command interpreter style + * - HELP + * - prototypes + * + * written: 1992 02 19 + * latest update: 1996-05-05 11:41:49 + * $Id: lm5.c,v 1.2 2011/05/31 16:35:28 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/lmd5.h> +#include <gg/filename.h> + +#define STDHLP stdout +#ifdef MSDOS +#define ARG_C_max 24 +#else +#define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c= 0; + +/* Quick Hack: ------------------------------------------------------------ */ +#ifdef MSDOS +#define SUBDIRS /* Rekursive Suche durch das */ + /* Filesystem moeglich */ +#define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ +#else +#define wcrd_wildcards main_fnc +#endif + +/* ------------------------------------------------------------------------ */ +static char filenm [66]; +static int verbose_mode= 0; + +#define PMODE_NONE 0 +#define PMODE_STREAM 1 +static int processing_mode= PMODE_STREAM; + +static struct LMD5_CONTROL *lm5_control= (struct LMD5_CONTROL *) 0; +static char *lm5_outfile= "@lm5out.dmp"; + +/* ------------------------------------------------------------------------ */ +#define GPL +static char *HELP []= +{ + "USAGE: lm5 [options] {file name}\n", + "OPTIONS:\n", + " -f<fnm> ... list of files\n", +#ifdef SUBDIRS + " -s -r ... subdirs\n", +#endif + " -v ... verbose mode\n", + "EXAMPLES:\n", + "\n", + "(@)Alm5.c 0.01 #D$1996-04-14 9:46:43\n", + "\n", +#include <gg/public.inc> +} ; + +/* prototypes: ------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + char *arg; + int i, j; + + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + if (arg [0] == '-') + switch (arg [1]) + { + case 'f': case 'F': + if (arg [2] == 0) break; + if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= arg ; + break; + +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': +#endif + case 'v': case 'V': + for (j= 1; arg [j]; j++) + switch (arg [j]) + { +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': + wcrd_set_subdirs (1); + break; +#endif + case 'v': case 'V': + verbose_mode++; + break; + default: + fprintf (stderr, "unknown option %c\n", arg[j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= arg; + } + + if (arg_c) + { + /* preparations */ + if ((lm5_control= lmd5_create_control (lm5_outfile, 1)) + == (struct LMD5_CONTROL *) 0) + { + fprintf (stderr, "error: can't create control handle!\n"); + goto STOP; + } + + for (i= 0; i < arg_c; i++) + { + arg= arg_v [i]; + + if (arg [0] == '-') + { + if ((fi2= fopen (arg+2, "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", arg+2); + break; + } + + for (;;) + { + fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (filenm) == -1) + { + fclose (fi2); + goto STOP; + } +#else + wcrd_wildcards (filenm); +#endif + } + fclose (fi2); + } + else + { +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (arg) == -1) goto STOP; +#else + wcrd_wildcards (arg); +#endif + } + } + + /* wrapup */ + irdb_diag (stdout, lm5_control->LMD5_db); + irdb_commit (lm5_control->LMD5_pos); + /**** irdb_dump_to_file (lm5_outfile, lm5_control->LMD5_db); ****/ + irdb_diag (stdout, lm5_control->LMD5_db); + +{ +char *slots [10]; +slots [0]= "wordcount"; +slots [1]= "mausi"; +slots [2]= "cnt"; +slots [3]= "total"; +irdb_post_increment_long (lm5_control->LMD5_pos, slots, 4, 17L); + +slots [1]= "schnucki"; +irdb_post_increment_long (lm5_control->LMD5_pos, slots, 4, 17L); +} + + lmd5_set_info_attribute_value (lm5_control, "schnucki", "mucki"); + + irdb_diag (stdout, lm5_control->LMD5_db); + irdb_commit (lm5_control->LMD5_pos); + } + +STOP: + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn) +{ + FILE *fi; + + if ((fi= fopen (fn, "rb")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", fn); + return -2; + } + + switch (processing_mode) + { + case PMODE_STREAM: + lmd5_process_stream (lm5_control, fi); + break; + + default: + fprintf (stderr, "illegal processing mode %d for '%s'\n", processing_mode, fn); + break; + } + + fclose (fi); + + return 0; +} diff --git a/lib/ds/lmd5/lmd5.doc b/lib/ds/lmd5/lmd5.doc new file mode 100644 index 0000000000000000000000000000000000000000..3e182bdcd88fd9a6d9e1f853ed14879903d61626 --- /dev/null +++ b/lib/ds/lmd5/lmd5.doc @@ -0,0 +1,47 @@ +# +# FILE %ds/lmd5/lmd5.doc +# +# written: 1996-04-14 +# latest update: 1996-04-14 12:03:29 +# + +persistent data structure: + +wordcount.<word> ... information about individual words + docs.<docid>= <cnt> ... reference counter per document + cnt.total= <cnt> ... all-over counter + +docs.<docid> ... document directory + cnt.upd= <cnt> ... number of times this docid was updated + cnt.begin= <pos> ... begin position within document + cnt.end= <pos> ... end position within document + fref.name= <fref> ... file reference (name) + + Note: fref.name, cnt.begin, cnt.end are set together + +info.<attribute>= <value> ... various information attributs + + +stream format: + +DOCID <docid> [<fref> [<begin> [<end>]]] + +INFO +<attribute> <value> +. + +DATA +<word> +. + +data +<Word> +. + +DATAPOINTS +<inc> <word> +. + +datapoints +<inc> <Word> +. diff --git a/lib/ds/lmd5/lmd50000.c b/lib/ds/lmd5/lmd50000.c new file mode 100644 index 0000000000000000000000000000000000000000..fe24d9f3d5e78c15e73129d5550877939d67b066 --- /dev/null +++ b/lib/ds/lmd5/lmd50000.c @@ -0,0 +1,23 @@ +/* + * FILE %ds/lmd5/lmd50000.c + * + * LM/D Engine Version 5 + * + * written: 1996-04-14 + * latest update: 1996-04-14 0:17:55 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/lmd5.h> + +/* ------------------------------------------------------------------------ */ +int lmd5_do_whatever ( +struct LMD5_CONTROL *l5, +char *filename) +{ + handle; filename; +} diff --git a/lib/ds/lmd5/lmd50001.c b/lib/ds/lmd5/lmd50001.c new file mode 100644 index 0000000000000000000000000000000000000000..62229aed1ee51d9ed547b5c4a887f86c5824853c --- /dev/null +++ b/lib/ds/lmd5/lmd50001.c @@ -0,0 +1,51 @@ +/* + * FILE %ds/lmd5/lmd50001.c + * + * LM/D Engine Version 5 + * + * written: 1996-04-14 + * latest update: 1996-05-28 19:47:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/irdb.h> +#include <gg/lmd5.h> + +/* ------------------------------------------------------------------------ */ +struct LMD5_CONTROL *lmd5_create_control (char *fnm, int is_new) +{ + struct LMD5_CONTROL *l5= (struct LMD5_CONTROL *) 0; + struct IRDB_HANDLE *ihw; + struct IRDB_POS *ipos; + + if ((l5= (struct LMD5_CONTROL *) calloc (sizeof (struct LMD5_CONTROL), 1)) + != (struct LMD5_CONTROL *) 0 + && (ipos= irdb_new_pos (fnm, "lmd5", is_new)) != (struct IRDB_POS *) 0 + ) + { + l5->LMD5_pos= ipos; + + l5->LMD5_db= ipos->IRDB_handle; + l5->LMD5_word_table [0]= "wordcount"; + l5->LMD5_docs_table [0]= "docs"; + l5->LMD5_info_table [0]= "info"; + + /* get the subtree for the word info */ + if ((ihw= irdb_locate_handle (ipos, l5->LMD5_word_table, 1, + 1, (long) IRDBty_struct)) + != (struct IRDB_HANDLE *) 0 + ) + { + l5->LMD5_words= ihw; + return l5; + } + } + + return (struct LMD5_CONTROL *) 0; +} diff --git a/lib/ds/lmd5/lmd50001.o b/lib/ds/lmd5/lmd50001.o new file mode 100644 index 0000000000000000000000000000000000000000..113f212d832da7baa22d1da397171b262f2647ea Binary files /dev/null and b/lib/ds/lmd5/lmd50001.o differ diff --git a/lib/ds/lmd5/lmd50002.c b/lib/ds/lmd5/lmd50002.c new file mode 100644 index 0000000000000000000000000000000000000000..87771d0e9f338ba87c118928ac460d0f3feca25b --- /dev/null +++ b/lib/ds/lmd5/lmd50002.c @@ -0,0 +1,47 @@ +/* + * FILE %ds/lmd5/lmd50002.c + * + * LM/D Engine Version 5 + * + * written: 1996-04-14 + * latest update: 1996-04-14 12:12:28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lmd5.h> + +/* ------------------------------------------------------------------------ */ +long lmd5_increment_word_count ( +struct LMD5_CONTROL *l5, +char *word, +char *docid, +long cnt) +/* wordcount.<word>.docs.<docid> += cnt; */ +{ + struct IRDB_POS *ipos; + long acc_cnt; + + if (l5 == (struct LMD5_CONTROL *) 0 + || (ipos= l5->LMD5_pos) == (struct IRDB_POS *) 0 + ) + return -1L; + + l5->LMD5_word_table [1]= word; + l5->LMD5_word_table [2]= "docs"; + l5->LMD5_word_table [3]= docid; + + acc_cnt= irdb_dbg_post_increment_long (ipos, l5->LMD5_word_table, 4, cnt); + + l5->LMD5_word_table [1]= word; + l5->LMD5_word_table [2]= "cnt"; + l5->LMD5_word_table [3]= "total"; + + irdb_dbg_post_increment_long (ipos, l5->LMD5_word_table, 4, cnt); + + return acc_cnt; +} diff --git a/lib/ds/lmd5/lmd50002.o b/lib/ds/lmd5/lmd50002.o new file mode 100644 index 0000000000000000000000000000000000000000..6243e4346eb69264e32e576be36baa37c6be2fcf Binary files /dev/null and b/lib/ds/lmd5/lmd50002.o differ diff --git a/lib/ds/lmd5/lmd50003.c b/lib/ds/lmd5/lmd50003.c new file mode 100644 index 0000000000000000000000000000000000000000..65143a501745e35618372cde8dbc8183b4a5a671 --- /dev/null +++ b/lib/ds/lmd5/lmd50003.c @@ -0,0 +1,143 @@ +/* + * FILE %ds/lmd5/lmd50003.c + * + * LM/D Engine Version 5 + * + * written: 1996-04-14 + * latest update: 1996-05-19 10:34:44 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/sbr.h> +#include <gg/dpp.h> +#include <gg/dates.h> +#include <gg/lmd5.h> + +#define MAX_BUFFER 1024 +#define PV(x) get_parameter_value(x) + +/* ------------------------------------------------------------------------ */ +int lmd5_process_stream ( +struct LMD5_CONTROL *l5, +FILE *fi) +{ + char *buffer; +#define SECTION_commands 0 +#define SECTION_data 1 +#define SECTION_DATA 2 +#define SECTION_datapoints 3 +#define SECTION_DATAPOINTS 4 +#define SECTION_INFO 5 + int section= SECTION_commands; + int rc; + int fc; +#define MAX_FIELDS 10 + char *fields [MAX_FIELDS]; + char *cmd; + char *docid= (char *) 0; + char date_string [40]; + long cnt; + + if (l5 == (struct LMD5_CONTROL *) 0 + || (buffer= malloc (MAX_BUFFER)) == (char *) 0 + ) + return -1; + + actual_datim (date_string, DATIMfmt_date_time); + lmd5_set_info_attribute_value (l5, "latest_indexing", date_string); + + while (1) + { + rc= fread_line (fi, buffer, MAX_BUFFER); + if (rc <= 0 && feof (fi)) break; + if (*buffer == '#' || *buffer == 0) continue; + + switch (section) + { + case SECTION_commands: + fc= isolate_tokens (buffer, fields, MAX_FIELDS); + if (fc <= 0) continue; + cmd= fields [0]; + + if (strcmp (cmd, "DOCID") == 0) + { + if (fc >= 1) + { + char *fref_nam; + long fref_beg; + long fref_end; + + free_or_what (docid); + docid= strdup (fields [1]); + fref_nam= (fc < 2) ? (char *) 0 : fields [2]; + fref_beg= (fc < 3) ? 0L : PV (fields [3]); + fref_end= (fc < 4) ? 0x7FFFFFFFL : PV (fields [4]); + + lmd5_increment_document_count (l5, docid, + fref_nam, fref_beg, fref_end, + (char *) 0); + } + } + else + if (strcmp (cmd, "INFO") == 0) section= SECTION_INFO; else + if (strcmp (cmd, "DATA") == 0) section= SECTION_DATA; else + if (strcmp (cmd, "data") == 0) section= SECTION_data; else + if (strcmp (cmd, "DATAPOINTS") == 0) section= SECTION_DATAPOINTS; else + if (strcmp (cmd, "datapoints") == 0) section= SECTION_datapoints; + break; + + case SECTION_data: + to_lower (buffer); + case SECTION_DATA: + if (strcmp (buffer, ".") == 0) + { + section= SECTION_commands; + break; + } + lmd5_increment_word_count (l5, buffer, docid, 1L); + break; + + case SECTION_datapoints: + case SECTION_DATAPOINTS: + if (strcmp (buffer, ".") == 0) + { + section= SECTION_commands; + break; + } + + fc= isolate_tokens (buffer, fields, 2); + if (fc < 2) continue; + + cnt= PV (fields [0]); + cmd= fields [1]; + if (section == SECTION_datapoints) to_lower (cmd); + lmd5_increment_word_count (l5, cmd, docid, cnt); + break; + + case SECTION_INFO: + if (strcmp (buffer, ".") == 0) + { + section= SECTION_commands; + break; + } + + fc= isolate_tokens (buffer, fields, 2); + if (fc < 2) continue; + + lmd5_set_info_attribute_value (l5, fields [0], fields [1]); + break; + } + + } + + free (buffer); + return 0; +} diff --git a/lib/ds/lmd5/lmd50003.o b/lib/ds/lmd5/lmd50003.o new file mode 100644 index 0000000000000000000000000000000000000000..9d1368a477b08e6b755c73f5bb61bc60d7deec49 Binary files /dev/null and b/lib/ds/lmd5/lmd50003.o differ diff --git a/lib/ds/lmd5/lmd50004.c b/lib/ds/lmd5/lmd50004.c new file mode 100644 index 0000000000000000000000000000000000000000..bca0be72b9b62a01e338486af1e8c254d9f7f600 --- /dev/null +++ b/lib/ds/lmd5/lmd50004.c @@ -0,0 +1,64 @@ +/* + * FILE %ds/lmd5/lmd50004.c + * + * LM/D Engine Version 5 + * + * written: 1996-04-14 + * latest update: 1996-05-19 10:30:32 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lmd5.h> + +/* ------------------------------------------------------------------------ */ +long lmd5_increment_document_count ( +struct LMD5_CONTROL *l5, +char *docid, +char *fref_name, +long fref_begin, +long fref_end, +char *date_string) +/* docs.<docid>.cnt.upd++ */ +{ + struct IRDB_POS *ipos; + long cnt; + + if (l5 == (struct LMD5_CONTROL *) 0 + || (ipos= l5->LMD5_pos) == (struct IRDB_POS *) 0 + ) + return -1L; + + l5->LMD5_docs_table [1]= docid; + l5->LMD5_docs_table [2]= "cnt"; + l5->LMD5_docs_table [3]= "upd"; + +printf ("\n***** 50004 *****\n"); + + irdb_dbg_post_increment_long (ipos, l5->LMD5_docs_table, 4, 1L); + + if (fref_name != (char *) 0) + { + l5->LMD5_docs_table [3]= "begin"; + irdb_dbg_set_long (ipos, l5->LMD5_docs_table, 4, fref_begin); + + l5->LMD5_docs_table [3]= "end"; + irdb_dbg_set_long (ipos, l5->LMD5_docs_table, 4, fref_end); + + l5->LMD5_docs_table [2]= "fref"; + l5->LMD5_docs_table [3]= "name"; + irdb_dbg_replace_string (ipos, l5->LMD5_docs_table, 4, fref_name); + + if (date_string != (char *) 0) + { + l5->LMD5_docs_table [3]= "name"; + irdb_dbg_replace_string (ipos, l5->LMD5_docs_table, 4, date_string); + } + } + + return cnt; +} diff --git a/lib/ds/lmd5/lmd50004.o b/lib/ds/lmd5/lmd50004.o new file mode 100644 index 0000000000000000000000000000000000000000..9b9b95ece8b69cf26e4c6a9257a3a7c99b7d584b Binary files /dev/null and b/lib/ds/lmd5/lmd50004.o differ diff --git a/lib/ds/lmd5/lmd50005.c b/lib/ds/lmd5/lmd50005.c new file mode 100644 index 0000000000000000000000000000000000000000..2fcac0d3d93b3b2f666a56f0ffd574076c61d2e9 --- /dev/null +++ b/lib/ds/lmd5/lmd50005.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/lmd5/lmd50005.c + * + * LM/D Engine Version 5 + * + * written: 1996-04-14 + * latest update: 1996-05-06 0:16:09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lmd5.h> + +/* ------------------------------------------------------------------------ */ +int lmd5_set_info_attribute_value ( +struct LMD5_CONTROL *l5, +char *attribute_name, +char *attribute_value) +/* info.<attribute>= <value> */ +{ + struct IRDB_POS *ipos; + + if (l5 == (struct LMD5_CONTROL *) 0 + || (ipos= l5->LMD5_pos) == (struct IRDB_POS *) 0 + ) + return -1; + + l5->LMD5_info_table [1]= attribute_name; + +printf ("\n****************\n"); + + return irdb_dbg_replace_string (ipos, l5->LMD5_info_table, 2, attribute_value); +} diff --git a/lib/ds/lmd5/lmd50005.o b/lib/ds/lmd5/lmd50005.o new file mode 100644 index 0000000000000000000000000000000000000000..e093fd6a74534ce7ff5292a9a6ac317b05bf2bae Binary files /dev/null and b/lib/ds/lmd5/lmd50005.o differ diff --git a/lib/ds/lmd5/make-dos b/lib/ds/lmd5/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..16c380daae429624c34051d735161ddf39c831d7 --- /dev/null +++ b/lib/ds/lmd5/make-dos @@ -0,0 +1,38 @@ +# +# FILE %ds/lmd5/makefile +# +# manipulation of attribute lists +# +# written: 1996-04-05 +# latest update: 1996-05-05 11:48:20 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all : all.00 # all.01 # all.02 # all.test + +all.00 : ! + lmd50001.obj lmd50002.obj lmd50003.obj lmd50004.obj lmd50005.obj +# lmd50010.obj lmd50011.obj lmd50012.obj lmd50013.obj lmd50014.obj ! +# lmd50015.obj lmd50016.obj lmd50017.obj lmd50018.obj lmd50019.obj ! +# lmd50020.obj + +all.01 : ! + lmd50101.obj #lmd50102.obj + +all.test : lm5.exe + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +# ---------------------------------------------------------------------------- +TEST= lmd50001.obj lmd50002.obj lmd50003.obj lmd50004.obj ! + ..\irdb\irdb0103.obj ..\irdb\irdb0014.obj + +lm5.exe : lm5.obj $(TEST) + link lm5 $(TEST),,,c:\usr\sbr\lsbr; diff --git a/lib/ds/lmd5/test.doc b/lib/ds/lmd5/test.doc new file mode 100644 index 0000000000000000000000000000000000000000..8812f5382c2dd1005f07d8e13eaa122fb9aa606f --- /dev/null +++ b/lib/ds/lmd5/test.doc @@ -0,0 +1,23 @@ + +INFO +FILE %ds/lmd5/test.doc +written 1996-04-14 +latest_update 1996-04-14 10:34:40 +. + + +DOCID urxn urxn.txt 0x1234 0x4321 +data +iris +karl +Franz +mausi +. + +DOCID urxn2 urxn2.txt 0x1234 0x4321 +data +iris +karl2 +Franz2 +mausi2 +. diff --git a/lib/ds/lut/(dirinf).fm b/lib/ds/lut/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..58e161522a6bc7a77eef7f058f52a17e841f5bba --- /dev/null +++ b/lib/ds/lut/(dirinf).fm @@ -0,0 +1,34 @@ +# +# FILE %ds/lut/(dirinf).fm +# +# lookup table +# +# written: 1995-12-20 +# latest update: 1996-10-13 12:16:58 +# $Id: (dirinf).fm,v 1.2 2003/06/25 14:38:29 gonter Exp $ +# +# ---------------------------------------------------------------------------- + +# administrative files +(dirinf).fm Contents +Makefile active version of Makefile +make-ux Unix version of Makefile +make-dos MSDOS version of Makefile + +# ---------------------------------------------------------------------------- +# Lookup Table +lut_0001.c int lookup_char (lut, struktur, w, w_info, lng) +lut_0002.c int lookup_file (lut, struktur, w, w_info, lng) +lut_0003.c +lut_0004.c int lut_print (fo, lut_name, struktur, start, length) +lut_0005.c int lut_print_block (fo, lut_name, struktur, length) +lut_0006.c +lut_0007.c int lookup_file_xfn (char *xfn, w, w_info) +lut_0008.c int lut_process (lut_name, (*processor) ()) +lut_0009.c int lut_process_block (lut_name, (*processor) ()) +lut_0010.c int xfn_process (char *xfn_name, ...) +lut_0011.c int xfn_process_block (FILE *xfn, ...) +lut_0012.c int lut_dump_file (char *fnm, ...) +lut_0013.c int lut_dump_entry (...) +lut_0014.c int xfn_dump_file (char *fnm, ...) +lut_0015.c int lut_scan_ytree (char *fnm, ...) diff --git a/lib/ds/lut/Makefile b/lib/ds/lut/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..f3237aa488496df275dfcc82a58d23e6c04ceb3e --- /dev/null +++ b/lib/ds/lut/Makefile @@ -0,0 +1,32 @@ +# +# FILE %ds/lut/make-ux +# +# written: 1995-12-20 +# latest update: 2000-09-01 11:57:00 +# $Id: Makefile,v 1.6 2003/06/25 14:38:29 gonter Exp $ +# +# ---------------------------------------------------------------------------- +CC=cc +cf=-g# -pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-I. -I/usr/local/include -O $(cf) +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + lut_0001.o lut_0002.o lut_0004.o lut_0005.o \ + lut_0007.o lut_0008.o lut_0009.o lut_0010.o lut_0011.o lut_0012.o \ + lut_0013.o lut_0014.o lut_0015.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) $(LIBOBJS1) $(LIBOBJS2) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c -g $? + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib diff --git a/lib/ds/lut/contrib b/lib/ds/lut/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/lut/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/lut/gg b/lib/ds/lut/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/lut/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/lut/lib b/lib/ds/lut/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/lut/libgg.a b/lib/ds/lut/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/lut/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/lut/lut_0001.c b/lib/ds/lut/lut_0001.c new file mode 100644 index 0000000000000000000000000000000000000000..b503d5673f60ad674a7f504c6d4699909e894943 --- /dev/null +++ b/lib/ds/lut/lut_0001.c @@ -0,0 +1,180 @@ +/* + * FILE %ds/lut/lut_0001.c + * + * Funktionen zum Durchsuchen von LUT-Woerterbuechern + * see also: lookup_file + * + * written: 1989 06 11: aus WORDCR01.C isolierte Funktionen: + * check_word -> lookup_char + * check_word_file -> lookup_file + * 1990 01 20: zerlegt in Library-Module + * 1990 05 31: lut_word_match + * 1991 03 15: Revision; AIX + * latest update: 1995-12-20 + * + */ + +/* #define DEBUG_001 */ +/* #define DEBUG_002 */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lookup.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +static char lut_word_buffer [MAX_LUT_KEY_LENGTH]; + /* Puffer fuer gefundenes Wort */ +static char *lut_dump_beg= (char *) 0; /* begin of dump window */ +static char *lut_dump_end= (char *) 0; /* end of dump window */ + +/* ------------------------------------------------------------------------ */ +int lookup_char ( +char *lut, /* Look Up Table */ +const char *w, /* string to be found */ +long *w_info, /* -> informationen about the word */ +int *lng) /* length of matching word */ + /* important for LOOKUP_prefix */ +/* RETURN: siehe File LOOKUP.H */ +{ + int ret_val= 0; /* return code: bitmapped values */ + int idx= 0; /* untersuchte Stelle im Key (Suchwort) */ + register char *cp; /* untersuchte Stelle in der LUT */ + char *retry_position; /* resync position for another alternative */ + long offset_value; /* value of a offset code for skip entry */ + char *prev_offset= (char *) 0;/* frame position for alternative key dumps */ + + if ((cp= lut) == (char *) 0 || *cp == 0x00) return LOOKUP_empty; + if (nl_key_valid (w) == -1) return LOOKUP_error; + + retry_position= (char *) 0; + + for (; cp != (char *) 0;) + { + switch (*cp) + { + case 0x00: /* Wortende; -> Information einmal sicherstellen */ + if (w [idx] == 0) + { /* gesuchtes Wort gefunden */ + *w_info= dpp_get_long (&cp[1], 4); + *lng= idx; + return ret_val | LOOKUP_found; + } + else + { /* o hier wurde ein Wort gefunden, welches */ + /* auch im gesuchten Wort auftritt */ + /* o Da eine lexikalische Sortierung vor- */ + /* liegt, muss weiter gesucht werden. */ + *lng= idx; + *w_info= dpp_get_long (&cp[1], 4); + ret_val |= LOOKUP_prefix; + goto TRY_ANOTHER; + } + break; + + default: + if (*cp != (w [idx] & 0x00FF)) + { + if (w [idx] == 0) + { + if (retry_position != (char *) 0) + { + goto LONG2; + } + else + { /* o w is a prefix for at least one other word */ + /* -> search can be stopped here */ + /* -> it can be found out if just one other word follows */ + /* -> info codes for more following words can be idetified */ + for (; cp != (char *) 0; cp++) + switch (*cp) + { + case 0x00: /* Wortende; */ + *w_info= dpp_get_long (&cp[1], 4); + *lng= idx; + return ret_val | LOOKUP_prefix_3; + case 0x01: + case 0x02: + case 0x03: + case 0x04: +LONG2: + lut_dump_beg= cp; /* back_step??? see lookup_file */ + lut_dump_end= prev_offset-1; + *lng= idx; + return ret_val | LOOKUP_prefix_4; + default: + if (idx+1 < MAX_LUT_KEY_LENGTH) + { + lut_word_buffer [idx++]= *cp; + lut_word_buffer [idx]= 0; + } + else + idx++; + break; + } + return -4; /* das duerfte nicht auftreten */ + } + } +TRY_ANOTHER: + cp= retry_position; + if (retry_position != (char *) 0) prev_offset= retry_position; + retry_position= (char *) 0; + } + else + { /* bisheriger Wortteil in LUT */ + if (idx+1 < MAX_LUT_KEY_LENGTH) + { + lut_word_buffer [idx++]= *cp; + lut_word_buffer [idx]= 0; + } + else + idx++; + cp++; + if (retry_position != (char *) 0) prev_offset= retry_position; + retry_position= (char *) 0; + } + break; + + /* Offset Codes */ + case 4: + case 3: +#ifdef MSDOS + return LOOKUP_error_size; +#endif + case 2: + case 1: + offset_value= dpp_get_long (&cp[1], *cp); + cp += (*cp)+1; + retry_position= cp + offset_value; +/********** +printf ("cp=0x%lX offset_value=0x%X retry_position=0x%lX\n", +cp, offset_value, retry_position); +**********/ + break; + } + } + + /* Wort nicht gefunden */ + return ret_val; +} + +/* ------------------------------------------------------------------------ */ +char *lut_char_get_word_buffer () +{ + return lut_word_buffer; +} + +/* ------------------------------------------------------------------------ */ +char *lut_char_get_dump_beg () +{ + return lut_dump_beg; +} + +/* ------------------------------------------------------------------------ */ +char *lut_char_get_dump_end () +{ + return lut_dump_end; +} diff --git a/lib/ds/lut/lut_0001.o b/lib/ds/lut/lut_0001.o new file mode 100644 index 0000000000000000000000000000000000000000..0b74c3a224529f75a4bf31d9e6868d9559af9406 Binary files /dev/null and b/lib/ds/lut/lut_0001.o differ diff --git a/lib/ds/lut/lut_0002.c b/lib/ds/lut/lut_0002.c new file mode 100644 index 0000000000000000000000000000000000000000..37ca4806a1fd665fe6776d6144684026e78bb75b --- /dev/null +++ b/lib/ds/lut/lut_0002.c @@ -0,0 +1,185 @@ +/* + * FILE %nl_kr/lib/lut_0002.c + * + * Funktionen zum Durchsuchen von LUT-Woerterbuechern + * see also: lookup_char + * + * written: 1989 06 11: aus WORDCR01.C isolierte Funktionen: + * check_word -> lookup_char + * check_word_file -> lookup_file + * 1990 01 20: zerlegt in Library-Module + * 1991 03 15: Revision; AIX + * latest update: 1995-12-03 + * $Id: lut_0002.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +/* #define DEBUG_001 */ +/* #define DEBUG_002 */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lookup.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +static char lut_word_buffer [MAX_LUT_KEY_LENGTH]; + /* Puffer fuer gefundenes Wort */ +static long lut_dump_beg= -1L; /* begin of dump window */ +static long lut_dump_end= -1L; /* end of dump window */ + +/* ------------------------------------------------------------------------ */ +int lookup_file ( +FILE *lut, /* Look Up Table; binaer eroeffnet */ + /* und ev. an den Anfang positioniert */ +const char *w, /* Word */ +long *w_info, /* -> Informationen ueber Word */ +int *lng) /* Laenge des gematchten Wortes */ + /* Wichtig bei LOOKUP_prefix */ +/* RETURN: siehe File LOOKUP.H */ +{ + int ret_val= 0; /* Return Code: bitmapped values */ + int idx= 0; /* untersuchte Stelle im Key (Suchwort) */ + int cp; /* untersuchtes Zeichen aus LUT */ + long retry_position; /* resync position for another alternative */ + long offset_value; /* value of a offset code for skip entry */ + long prev_offset= -1L; /* frame position for alternative key dumps */ + long back_step= 0L; /* number of bytes to step back */ + + if (nl_key_valid (w) == -1) return LOOKUP_error; + + /* 1. Zeichen einlesen */ + cp= fgetc (lut) & 0x00FF; + if (feof (lut) || cp == 0x00) return LOOKUP_empty; + + retry_position= -1L; + for (;;) + { + switch (cp) + { + case 0: /* Wortende */ + if (w [idx] == 0) + { /* Wort gefunden */ + lut_dump_beg= (retry_position == -1L) + ? -1L : ftell (lut) - back_step; + *w_info= dpp_fread_long (lut, 4); + *lng= idx; + return ret_val | LOOKUP_found; + } + else + { /* hier wurde ein Wort gefunden, welches */ + /* auch im gesuchten Wort auftritt */ + *lng= idx; + *w_info= dpp_fread_long (lut, 4); + ret_val |= LOOKUP_prefix; + goto TRY_ANOTHER; + } + break; + + default: + if (cp != (w [idx] & 0x00FF)) + { + if (w [idx] == 0) /* WHAT???? */ + { + if (retry_position != -1L) + { + lut_dump_beg= ftell (lut) - back_step; + goto LONG2; + } + else + { /* o w is a prefix for at least one other word */ + /* -> search can be stopped here */ + /* -> it can be found out if just one other word follows */ + /* -> info codes for more following words can be idetified */ + for (; !feof (lut); cp= fgetc (lut) & 0x00FF) + switch (cp) + { + case 0x00: /* Wortende; */ + *w_info= dpp_fread_long (lut, 4); + *lng= idx; + return ret_val | LOOKUP_prefix_3; + case 0x01: + case 0x02: + case 0x03: + case 0x04: + lut_dump_beg= ftell (lut) - 1L; +LONG2: + lut_dump_end= prev_offset -1L; + *lng= idx; + return ret_val | LOOKUP_prefix_4; + default: + if (idx+1 < MAX_LUT_KEY_LENGTH) + { + lut_word_buffer [idx++]= (char) cp; + lut_word_buffer [idx]= 0; + } + else + idx++; + break; + } + return -4; /* das duerfte nicht auftreten */ + } + } +TRY_ANOTHER: + if (retry_position == -1L) goto NOT_FOUND; + fseek (lut, retry_position, 0); + } + else + { /* bisheriger Wortteil in LUT */ + if (idx+1 < MAX_LUT_KEY_LENGTH) + { + lut_word_buffer [idx++]= (char) cp; + lut_word_buffer [idx]= 0; + } + else + idx++; + } + if (retry_position != -1L) prev_offset= retry_position; + retry_position= -1L; + break; + + /* Offset Codes */ + case 1: + case 2: + case 3: + case 4: + back_step= (long) (2+cp); + offset_value= dpp_fread_long (lut, cp); + retry_position= ftell (lut) + offset_value; +/*********** +printf ("cp=0x%lX offset_value=0x%X retry_position=0x%lX\n", +cp, offset_value, retry_position); +***********/ + break; + } + + /* read next character from the LUT */ + cp= fgetc (lut) & 0x00FF; + if (feof (lut)) break; + } + +NOT_FOUND: + /* word could not be found ... */ + return ret_val; +} + +/* ------------------------------------------------------------------------ */ +char *lut_file_get_word_buffer () +{ + return lut_word_buffer; +} + +/* ------------------------------------------------------------------------ */ +long lut_file_get_dump_beg () +{ + return lut_dump_beg; +} + +/* ------------------------------------------------------------------------ */ +long lut_file_get_dump_end () +{ + return lut_dump_end; +} diff --git a/lib/ds/lut/lut_0002.o b/lib/ds/lut/lut_0002.o new file mode 100644 index 0000000000000000000000000000000000000000..a197de24f2d89304157d4b8f4b73efa3b1dc1a29 Binary files /dev/null and b/lib/ds/lut/lut_0002.o differ diff --git a/lib/ds/lut/lut_0004.c b/lib/ds/lut/lut_0004.c new file mode 100644 index 0000000000000000000000000000000000000000..b4ec5944c0058635b1cee3128cab31d6d3e42b5a --- /dev/null +++ b/lib/ds/lut/lut_0004.c @@ -0,0 +1,44 @@ +/* + * FILE ~/usr/nl_kr/lib/lut_0004.c + * + * Funktionen zum Durchsuchen von LUT-Woerterbuechern + * + * written: 1989 06 11: aus WORDCR01.C isolierte Funktionen: + * check_word -> lookup_char + * check_word_file -> lookup_file + * 1990 01 20: zerlegt in Library-Module + * 1991 03 15: Revision; AIX + * 1994-07-31: lut_print_block isolted from this module + * latest update: 1994-12-19 + * + */ + +/* #define DEBUG_001 */ +/* #define DEBUG_002 */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/lookup.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int lut_print ( +FILE *fo, /* Ausgabe File */ +char *lut_name, /* Look Up Table */ +char *format, /* Format der Informationsausgabe */ +long start) /* begin of the dump */ +{ + FILE *lut; + int rc; + + if ((lut= fopen (lut_name, "rb")) == (FILE *) 0) return -1; + fseek (lut, start, 0); + rc= lut_print_block (fo, lut, format); + fclose (lut); + + return rc; +} diff --git a/lib/ds/lut/lut_0004.o b/lib/ds/lut/lut_0004.o new file mode 100644 index 0000000000000000000000000000000000000000..e70f9f2480f90340408178f204567d9e66221d69 Binary files /dev/null and b/lib/ds/lut/lut_0004.o differ diff --git a/lib/ds/lut/lut_0005.c b/lib/ds/lut/lut_0005.c new file mode 100644 index 0000000000000000000000000000000000000000..1082585007196b5cdbda4c090e63a0c8a4e6753e --- /dev/null +++ b/lib/ds/lut/lut_0005.c @@ -0,0 +1,102 @@ +/* + * FILE %ds/lut/lut_0005.c + * + * Funktionen zum Durchsuchen von LUT-Woerterbuechern + * + * written: 1989 06 11: aus WORDCR01.C isolierte Funktionen: + * check_word -> lookup_char + * check_word_file -> lookup_file + * 1990 01 20: zerlegt in Library-Module + * 1991 03 15: Revision; AIX + * 1994-07-31: isolated from lut_0004.c + * latest update: 2000-09-01 12:47:50 + * $Id: lut_0005.c,v 1.3 2000/09/01 19:17:57 gonter Exp $ + * + */ + +/* #define DEBUG_001 */ +/* #define DEBUG_002 */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/lookup.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int lut_print_block ( +FILE *fo, /* Ausgabe File */ +FILE *lut, /* Look Up Table */ +char *format) /* Format der Informationsausgabe */ +{ + int idx= 0; /* untersuchte Stelle im Key (Suchwort) */ + int cp; /* untersuchtes Zeichen aus LUT */ + long retry_position; /* resync position for another alternative */ + long offset_value; /* value of a offset code for skip entry */ + struct LUT_STACK *lut_stack; /* Suchpfad */ + long info; /* info value from the found key entry */ + int i; /* index for key string printout */ + + lut_stack= malloc (sizeof (struct LUT_STACK)*MAX_LUT_KEY_LENGTH); + if (lut_stack == (void *) 0) return -1; + lut_stack[0].offset= ftell (lut); + + retry_position= -1L; + for (;;) + { + cp= fgetc (lut) & 0x00FF; + if (feof (lut)) break; + switch (cp) + { + case 0: /* Wortende gefunden */ + info= dpp_fread_long (lut, 4); + + fprintf (fo, format, info); + for (i= 0; i<idx; i++) fputc (lut_stack [i].key, fo); + fputc ('\n', fo); + + while (lut_stack [idx].offset == 0L) + { + idx--; + if (idx < 0) goto NOT_FOUND; + } + fseek (lut, lut_stack [idx].offset, 0); + lut_stack [idx].offset= 0L; + break; + + default: + if (idx >= MAX_LUT_KEY_LENGTH) break; + lut_stack [idx].key= cp; + idx++; + if (idx >= MAX_LUT_KEY_LENGTH) + { + fprintf (stderr, "LUT key length exceed; stopping\n"); + goto NOT_FOUND; + } + lut_stack [idx].offset= 0L; + break; + + /* Offset Codes */ + case 1: + case 2: + case 3: + case 4: + offset_value= dpp_fread_long (lut, cp); + retry_position= ftell (lut) + offset_value; + lut_stack [idx].offset= retry_position; +/************ +printf ("cp=0x%lx offset_value=0x%x retry_position=0x%lx\n", +cp, offset_value, retry_position); +************/ + break; + } + } + +NOT_FOUND: + free (lut_stack); + + return 0; +} diff --git a/lib/ds/lut/lut_0005.o b/lib/ds/lut/lut_0005.o new file mode 100644 index 0000000000000000000000000000000000000000..e5f431f230aa02de9e90f0739693e89e091af43c Binary files /dev/null and b/lib/ds/lut/lut_0005.o differ diff --git a/lib/ds/lut/lut_0007.c b/lib/ds/lut/lut_0007.c new file mode 100644 index 0000000000000000000000000000000000000000..904fbbe8e24072695f2d6cfb809f3e550d30b909 --- /dev/null +++ b/lib/ds/lut/lut_0007.c @@ -0,0 +1,57 @@ +/* + * FILE %ds/lut/lut_0007.c + * + * Funktionen zum Durchsuchen von XFN-Woerterbuechern + * + * written: 1991 05 29 + * latest update: 1996-03-24 17:42:57 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/dpp.h> +#include <gg/strings.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +static char lut_word_buffer [MAX_LUT_KEY_LENGTH+2]; + +/* ------------------------------------------------------------------------ */ +int lookup_file_xfn ( +FILE *xfn, /* Look Up Table; binaer eroeffnet */ + /* und an den Anfang positioniert */ +const char *w, /* Word */ +long *w_info) /* -> Informationen ueber Word */ +/* return values: see file <gg/lookup.h> */ +{ + int rc; +#define MAX_FIELDS 2 + char *fields [MAX_FIELDS]; + + if (nl_key_valid (w) == -1) return LOOKUP_error; + + fseek (xfn, (long) 0, 0); + + lut_word_buffer [0]= '0'; /* frame number is in hex withou 0x, */ + lut_word_buffer [1]= 'x'; /* so place it in string to use it later */ + + for (;;) + { + rc= fread_line (xfn, lut_word_buffer+2, MAX_LUT_KEY_LENGTH); + if (rc <= 0 && feof (xfn)) break; + + rc= isolate_tokens (lut_word_buffer, fields, MAX_FIELDS); + if (rc < 2) continue; + + *w_info= get_parameter_value (fields [0]); + if (strcmp (fields [1], w) == 0) return LOOKUP_found; + } + + return LOOKUP_not_found; +} diff --git a/lib/ds/lut/lut_0007.o b/lib/ds/lut/lut_0007.o new file mode 100644 index 0000000000000000000000000000000000000000..331048d4fc55109245779e3f34e5b529fdbedb74 Binary files /dev/null and b/lib/ds/lut/lut_0007.o differ diff --git a/lib/ds/lut/lut_0008.c b/lib/ds/lut/lut_0008.c new file mode 100644 index 0000000000000000000000000000000000000000..cbd20e3ee226369f8a7751588b811a57ebc82627 --- /dev/null +++ b/lib/ds/lut/lut_0008.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/lut/lut_0008.c + * + * Verarbeiten von LUT-Files + * + * written: 1989 06 11: aus WORDCR01.C isolierte Funktionen: + * check_word -> lookup_char + * check_word_file -> lookup_file + * 1990 01 20: zerlegt in Library-Module + * 1991 03 15: Revision; AIX + * latest update: 1996-10-13 12:16:39 + * $Id: lut_0008.c,v 1.2 2003/06/25 14:38:29 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lut_process ( +char *lut_name, /* Look Up Table */ +int (*processor) (char *w, long i, void *client_data), +void *client_data, +long start) +{ + FILE *lut; + int rc; + + if ((lut= fopen (lut_name, "rb")) == (FILE *) 0) return -1; + fseek (lut, start, 0); + rc= lut_process_block (lut, processor, client_data); + fclose (lut); + + return rc; +} diff --git a/lib/ds/lut/lut_0008.o b/lib/ds/lut/lut_0008.o new file mode 100644 index 0000000000000000000000000000000000000000..e9a6cb6f8b724f4224345fdcec8cd4aece5a860c Binary files /dev/null and b/lib/ds/lut/lut_0008.o differ diff --git a/lib/ds/lut/lut_0009.c b/lib/ds/lut/lut_0009.c new file mode 100644 index 0000000000000000000000000000000000000000..4796081b3a093ea79dd77503bfb55b250334f737 --- /dev/null +++ b/lib/ds/lut/lut_0009.c @@ -0,0 +1,105 @@ +/* + * FILE %ds/lut/lut_0009.c + * + * Funktionen zum Durchsuchen von LUT-Woerterbuechern + * + * written: 1989 06 11: aus WORDCR01.C isolierte Funktionen: + * check_word -> lookup_char + * check_word_file -> lookup_file + * 1990 01 20: zerlegt in Library-Module + * 1991 03 15: Revision; AIX + * 1994-07-31: isolated from lut_0008.c + * latest update: 2000-09-01 12:43:40 + * $Id: lut_0009.c,v 1.4 2003/06/25 14:38:29 gonter Exp $ + * + */ + +/* #define DEBUG_001 */ +/* #define DEBUG_002 */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/lookup.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int lut_process_block ( +FILE *lut, /* Look Up Table */ +int (*processor) (char *w, long i, void *client_data), +void *client_data) +{ + int idx= 0; /* untersuchte Stelle im Key (Suchwort) */ + int cp; /* untersuchtes Zeichen aus LUT */ + long retry_position; /* resync position for another alternative */ + long offset_value; /* value of a offset code for skip entry */ + struct LUT_STACK *lut_stack; /* Suchpfad */ + long info; /* info value from the found key entry */ + int i; /* index for key string printout */ + char lut_word_buffer [MAX_LUT_KEY_LENGTH]; + + if ((lut_stack= malloc (sizeof (struct LUT_STACK)*MAX_LUT_KEY_LENGTH)) + == (struct LUT_STACK *) 0) return -1; + lut_stack[0].offset= ftell (lut); + + retry_position= -1L; + for (;;) + { + cp= fgetc (lut) & 0x00FF; + if (feof (lut)) break; + + switch (cp) + { + case 0: /* Wortende gefunden */ + info= dpp_fread_long (lut, 4); + + for (i= 0; i < idx; i++) lut_word_buffer[i]= (char) lut_stack[i].key; + lut_word_buffer[i]= 0; + (*processor) (lut_word_buffer, info, client_data); + + while (lut_stack [idx].offset == 0L) + { + idx--; + if (idx < 0) goto NOT_FOUND; + } + + fseek (lut, lut_stack [idx].offset, 0); + lut_stack [idx].offset= 0L; + break; + + default: + if (idx >= MAX_LUT_KEY_LENGTH) break; + lut_stack [idx].key= cp; + idx++; + if (idx >= MAX_LUT_KEY_LENGTH) + { + fprintf (stderr, "LUT key length exceed; stopping\n"); + goto NOT_FOUND; + } + lut_stack [idx].offset= 0L; + break; + + /* Offset Codes */ + case 1: + case 2: + case 3: + case 4: + offset_value= dpp_fread_long (lut, cp); + retry_position= ftell (lut) + offset_value; + lut_stack [idx].offset= retry_position; +/************ +printf ("cp=0x%lx offset_value=0x%x retry_position=0x%lx\n", +cp, offset_value, retry_position); +************/ + break; + } + } + +NOT_FOUND: + free (lut_stack); + + return 0; +} diff --git a/lib/ds/lut/lut_0009.o b/lib/ds/lut/lut_0009.o new file mode 100644 index 0000000000000000000000000000000000000000..e9cf7c8b726266a51e9fedb61301de58ed5c4f69 Binary files /dev/null and b/lib/ds/lut/lut_0009.o differ diff --git a/lib/ds/lut/lut_0010.c b/lib/ds/lut/lut_0010.c new file mode 100644 index 0000000000000000000000000000000000000000..e4516cd22eaa906827423b61a5454201300eb02b --- /dev/null +++ b/lib/ds/lut/lut_0010.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/lut/lut_0010.c + * + * processing of XFN-files + * + * written: 1995-01-07 + * latest update: 1996-10-13 12:21:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int xfn_process ( +char *xfn_name, /* XFN file name */ +int (*processor) (char *w, long i, void *client_data), +void *client_data, +long start) +{ + FILE *xfn; + int rc; + + if ((xfn= fopen (xfn_name, "rb")) == (FILE *) 0) return -1; + fseek (xfn, start, 0); + rc= xfn_process_block (xfn, processor, client_data); + fclose (xfn); + + return rc; +} diff --git a/lib/ds/lut/lut_0010.o b/lib/ds/lut/lut_0010.o new file mode 100644 index 0000000000000000000000000000000000000000..050aba0213ae181de69df3a64e5207fba8d08b6b Binary files /dev/null and b/lib/ds/lut/lut_0010.o differ diff --git a/lib/ds/lut/lut_0011.c b/lib/ds/lut/lut_0011.c new file mode 100644 index 0000000000000000000000000000000000000000..15d217411e5abafd887377f10b7bb140115c5b27 --- /dev/null +++ b/lib/ds/lut/lut_0011.c @@ -0,0 +1,42 @@ +/* + * FILE %ds/lut/lut_0011.c + * + * processing of XFN-files + * + * written: 1995-01-07 + * latest update: 1996-10-13 12:18:48 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int xfn_process_block ( +FILE *xfn, /* XFN file stream */ +int (*processor) (char *w, long i, void *client_data), +void *client_data) +{ + long idx; + char xfn_word_buffer [MAX_LUT_KEY_LENGTH]; + + if (xfn == (FILE *) 0) return 0; + + for (;;) + { + fscanf (xfn, "%lx", &idx); + if (feof (xfn)) break; + fscanf (xfn, "%*[ \t]"); + fscanf (xfn, "%[^\n]", xfn_word_buffer); + if (feof (xfn)) break; + fgetc (xfn); + + (*processor) (xfn_word_buffer, idx, client_data); + } + + return 0; +} diff --git a/lib/ds/lut/lut_0011.o b/lib/ds/lut/lut_0011.o new file mode 100644 index 0000000000000000000000000000000000000000..b1676a8d47d2aeb760815fe8725448e1e2566100 Binary files /dev/null and b/lib/ds/lut/lut_0011.o differ diff --git a/lib/ds/lut/lut_0012.c b/lib/ds/lut/lut_0012.c new file mode 100644 index 0000000000000000000000000000000000000000..b45b6b2ad91c4853e19d709a40114df25a8a528a --- /dev/null +++ b/lib/ds/lut/lut_0012.c @@ -0,0 +1,23 @@ +/* + * FILE %ds/lut/lut_0012.c + * + * processing of LUT-files + * + * written: 1996-10-12 + * latest update: 1996-10-13 12:18:48 + * $Id: lut_0012.c,v 1.2 2001/09/10 06:58:43 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lut_dump_file (char *fn, int out_mode, long dump_start) +{ + return lut_process (fn, lut_dump_entry, (void *) out_mode, dump_start); +} diff --git a/lib/ds/lut/lut_0012.o b/lib/ds/lut/lut_0012.o new file mode 100644 index 0000000000000000000000000000000000000000..b0c6bf12f398e068f0523350e4709a671d93d414 Binary files /dev/null and b/lib/ds/lut/lut_0012.o differ diff --git a/lib/ds/lut/lut_0013.c b/lib/ds/lut/lut_0013.c new file mode 100644 index 0000000000000000000000000000000000000000..1d1c110253e60da158af910c217556b152a2f314 --- /dev/null +++ b/lib/ds/lut/lut_0013.c @@ -0,0 +1,44 @@ +/* + * FILE %ds/lut/lut_0013.c + * + * processing of XFN-files + * + * written: 1996-10-12 + * latest update: 1996-10-13 12:18:48 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int lut_dump_entry (char *wrd, long info, void *client_data) +{ + unsigned int int1, int2; + int out_mode; + int *ip; + + out_mode= (int) client_data; + + switch (out_mode) + { + default: + printf ("0x%08lX %s\n", info, wrd); + break; + case 1: + ip= (int *) &info; + int1= *ip++; + int2= *ip; + printf ("%5u %5u %s\n", int1, int2, wrd); + break; + case 2: + printf ("%s\n", wrd); + break; + } + + return 0; +} diff --git a/lib/ds/lut/lut_0013.o b/lib/ds/lut/lut_0013.o new file mode 100644 index 0000000000000000000000000000000000000000..fe23f7fec96f05228109a9f94e6139243cf7519c Binary files /dev/null and b/lib/ds/lut/lut_0013.o differ diff --git a/lib/ds/lut/lut_0014.c b/lib/ds/lut/lut_0014.c new file mode 100644 index 0000000000000000000000000000000000000000..8d53694ad59d933a1386a6724cb4a0f1fca90904 --- /dev/null +++ b/lib/ds/lut/lut_0014.c @@ -0,0 +1,22 @@ +/* + * FILE %ds/lut/lut_0014.c + * + * processing of XFN-files + * + * written: 1996-10-12 + * latest update: 1996-10-13 12:18:48 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int xfn_dump_file (char *fn, int out_mode, long dump_start) +{ + return xfn_process (fn, lut_dump_entry, (void *) out_mode, dump_start); +} diff --git a/lib/ds/lut/lut_0014.o b/lib/ds/lut/lut_0014.o new file mode 100644 index 0000000000000000000000000000000000000000..934ef1c6bda630d2e12d0c9575a633abde02a88d Binary files /dev/null and b/lib/ds/lut/lut_0014.o differ diff --git a/lib/ds/lut/lut_0015.c b/lib/ds/lut/lut_0015.c new file mode 100644 index 0000000000000000000000000000000000000000..3c4b8e2ff2cd4bd3137cb3cc0d3e98e8c9d206c8 --- /dev/null +++ b/lib/ds/lut/lut_0015.c @@ -0,0 +1,48 @@ +/* + * FILE %ds/lut/lut_0015.c + * + * processing of LUT-files: convert LUT file to YTREE + * + * written: 2003-06-25 + * latest update: 2003-06-25 15:41:53 + * $Id: lut_0015.c,v 1.2 2003/10/01 21:52:01 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/lookup.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +int lut_ytree_entry (char *wrd, long info, void *client_data) +{ + struct YTREE **ytp= (struct YTREE **) client_data; + + ytree_set_value (ytp, wrd, info); + return 0; +} + +/* ------------------------------------------------------------------------ */ +struct YTREE *lut_scan_ytree (char *fn, long start) +{ + struct YTREE *yt= (struct YTREE *) 0; + int rc; + + rc= lut_process (fn, lut_ytree_entry, (void *) &yt, start); + return yt; +} + +/* ------------------------------------------------------------------------ */ +struct YTREE *lut_scan_ytree_file (FILE *lut, long start) +{ + struct YTREE *yt= (struct YTREE *) 0; + int rc; + + fseek (lut, start, 0); + rc= lut_process_block (lut, lut_ytree_entry, (void *) &yt); + return yt; +} diff --git a/lib/ds/lut/lut_0015.o b/lib/ds/lut/lut_0015.o new file mode 100644 index 0000000000000000000000000000000000000000..c056d7fff8f74edeb2dffe0428536bfd1674fa5e Binary files /dev/null and b/lib/ds/lut/lut_0015.o differ diff --git a/lib/ds/lut/make-dos b/lib/ds/lut/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..5d092f65390d9f7898948fa6b8d69141638eb284 --- /dev/null +++ b/lib/ds/lut/make-dos @@ -0,0 +1,23 @@ +# +# FILE %ds/lut/makefile +# +# lookup table handling +# +# written: 1989 03 29 +# latest update: 1996-10-13 12:46:33 +# +# ============================================================================ +# add -DDEBUG for debugging +cml=cl -AL /W3 /Fo$*.obj /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 NLKR_TEXT + +all.1: lut_0001.obj lut_0002.obj lut_0004.obj ! + lut_0005.obj lut_0007.obj lut_0008.obj ! + lut_0009.obj lut_0010.obj lut_0011.obj lut_0012.obj ! + lut_0013.obj lut_0014.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/lutctl/(dirinf).fm b/lib/ds/lutctl/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..f6d2fb716e7bb45c86c247cc4173ab4d5e4d9db2 --- /dev/null +++ b/lib/ds/lutctl/(dirinf).fm @@ -0,0 +1,14 @@ +#!/usr/local/bin/perl +# FILE /old/usr/home/gonter/work/fbsd/gg/lib/ds/lutctl/(dirinf).fm +# +# include <gg/lutctl.h> +# +# written: 2001-11-20 +# latest update: 2001-11-20 19:09:07 +# $Id: (dirinf).fm,v 1.1 2001/11/20 19:32:39 gonter Exp $ +# + +Makefile +lutctl01.c lutctl_alloc (), lutctl_free () +lutctl02.c lutctl_open (), lutctl_close (); + diff --git a/lib/ds/lutctl/Makefile b/lib/ds/lutctl/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..bfe92aadd8d04cea6b1da882094a8deb4f120d3b --- /dev/null +++ b/lib/ds/lutctl/Makefile @@ -0,0 +1,35 @@ +# +# FILE %ds/lutctl/Makefile +# +# written: 2001-11-20 +# latest update: 2001-11-20 19:23:30 +# $Id: Makefile,v 1.1 2001/11/20 19:32:39 gonter Exp $ +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow + +# ---------------------------------------------------------------------------- +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + lutctl01.o lutctl02.o # lutctl03.o lutctl04.o lutctl05.o lutctl06.o \ + # lutctl07.o lutctl08.o lutctl09.o lutctl10.o lutctl11.o lutctl12.o \ + # lutctl13.o lutctl14.o lutctl15.o lutctl16.o lutctl17.o lutctl18.o \ + # lutctl19.o lutctl20.o lutctl21.o lutctl22.o lutctl23.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $? diff --git a/lib/ds/lutctl/lutctl01.c b/lib/ds/lutctl/lutctl01.c new file mode 100644 index 0000000000000000000000000000000000000000..cc150a3e48f584e7f6712b04b59caeacbd5ac85c --- /dev/null +++ b/lib/ds/lutctl/lutctl01.c @@ -0,0 +1,35 @@ +/* + * FILE %gg/work/gg/lib/ds/lutctl/lutctl01.c + * + * written: 2001-11-20 + * latest update: 2001-11-20 19:33:18 + * $Id: lutctl01.c,v 1.1 2001/11/20 19:32:40 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <gg/lutctl.h> + +/* ------------------------------------------------------------------------ */ +LUTCTL *lutctl_alloc (void) +{ + LUTCTL *p; + p= calloc (sizeof (LUTCTL), 1); + return p; +} + +/* ------------------------------------------------------------------------ */ +int lutctl_free (LUTCTL *p) +{ + if (p == (LUTCTL *) 0) return 0; + + if (p->filename != (char *) 0) free (p->filename); + if (p->fp != (FILE *) 0) fclose (p->fp); + + if (p->mem != (char *) 0) free (p->mem); + if (p->yt != (struct YTREE *) 0) ytree_free (p->yt); + + free (p); + + return 0; +} diff --git a/lib/ds/lutctl/lutctl02.c b/lib/ds/lutctl/lutctl02.c new file mode 100644 index 0000000000000000000000000000000000000000..fdb83aab9c890ce322b6816c603b2fa9b3c11aed --- /dev/null +++ b/lib/ds/lutctl/lutctl02.c @@ -0,0 +1,82 @@ +/* + * FILE %gg/work/gg/lib/ds/lutctl/lutctl02.c + * + * written: 2001-11-20 + * latest update: 2001-11-20 19:33:18 + * $Id: lutctl02.c,v 1.1 2001/11/20 19:32:43 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/lutctl.h> + +/* ------------------------------------------------------------------------ */ +int lutctl_set_filename (struct LUTCTL *p, char *fnm) +{ + if (p == (LUTCTL *) 0) return -1; + if (p->filename != (char *) 0) free (p->filename); + + if ((p->filename= strdup (fnm)) == (char *) 0) return -1; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int lutctl_open (struct LUTCTL *p) +{ + FILE *fp; + + if (p == (LUTCTL *) 0 + || (fp= fopen (p->filename, "rb")) == (FILE *) 0 + ) return -1; + + p->state= LUTCTL_state_file; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int lutctl_close (struct LUTCTL *p) +{ + if (p == (LUTCTL *) 0) return -1; + + /* T2D: error, if fp == NULL ?? */ + if (p->fp != (FILE *) 0) { fclose (p->fp); p->fp= (FILE *) 0; } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int lutctl_load (struct LUTCTL *p, long limit) +{ + char *buffer= (char *) 0; + long bytes; + + if (p == (LUTCTL *) 0 + || p->filename == (char *) 0 + /** || p->state != LUTCTL_state_file ??? */ + ) return -1; + + if (limit != 0L) p->limit= limit; + + if (p->mem != (char *) 0) + { + free (p->mem); + p->mem= (char *) 0; + } + + bytes= read_file2buffer (&buffer, p->filename, p->limit); + if (bytes == -1) + { + if (buffer != (char *) 0) free (buffer); + /* NOTE: read_file2buffer may allocate the buffer, */ + /* even if it returns an error. */ + return -1; + } + p->mem= buffer; + p->size= bytes; + p->state= LUTCTL_state_mem; + + return 0; +} diff --git a/lib/ds/lxs/(dirinf).fm b/lib/ds/lxs/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..9f6e015b615c9b5d3d3fc967118ca0e00d851922 --- /dev/null +++ b/lib/ds/lxs/(dirinf).fm @@ -0,0 +1,27 @@ +# +# FILE %ds/lxs/(dirinf).fm +# +. | lexicon services subsystem +# +# written: 1995-11-11 +# latest update: 1996-12-22 11:49:33 +# +# ---------------------------------------------------------------------------- + +#include <gg/lxs.h> +#include <gg/lxs2.h> + +(dirinf).fm Contents +Makefile current version of Makefile +make-dos DOS version of Makefile +make-ux Unix version of Makefile + +lxs_0000.c template +lxs_0001.c . + +lxs_2001.c lxs_new_context () +lxs_2002.c lxs_record (struct LEXICON_CONTEXT *lxc, char *word); + +/* Diagnostic Functions */ +lxs_2003.c lxs_dump_context () +lxs_2004.c lxs_dump_entry () diff --git a/lib/ds/lxs/Makefile b/lib/ds/lxs/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..01d8c5f8a2ad756236235ee4306dc8661bd3f534 --- /dev/null +++ b/lib/ds/lxs/Makefile @@ -0,0 +1,33 @@ +# +# FILE %ds/lxs/make-ux +# +# written: 1995-03-19 +# latest update: 1999-05-08 9:50:05 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow + +# ---------------------------------------------------------------------------- +LIB=../../libgg.a + +all: + echo 'lxs is not ready yet' + +all.2: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + tclhyx01.o tclhyx02.o tclhyx03.o tclhyx04.o tclhyx05.o tclhyx06.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) $(LIBOBJS1) $(LIBOBJS2) $(LIBOBJS3) + ar ru $(LIB) $(LIBOBJS0) + touch lib + +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib diff --git a/lib/ds/lxs/contrib b/lib/ds/lxs/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/lxs/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/lxs/gg b/lib/ds/lxs/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/lxs/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/lxs/libgg.a b/lib/ds/lxs/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/lxs/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/lxs/lxs_0000.c b/lib/ds/lxs/lxs_0000.c new file mode 100644 index 0000000000000000000000000000000000000000..7338fb8ddba00681c5b850502edf95637f36b159 --- /dev/null +++ b/lib/ds/lxs/lxs_0000.c @@ -0,0 +1,14 @@ +/* + * FILE %ds/lxs/lxs_0000.c + * + * lexicon services + * + * written: 1994-03-27 + * latest update: 1996-12-22 11:52:32 + * + */ + +#include <gg/lxs2.h> + +/* ------------------------------------------------------------------------ */ + diff --git a/lib/ds/lxs/lxs_0001.c b/lib/ds/lxs/lxs_0001.c new file mode 100644 index 0000000000000000000000000000000000000000..fad008f8fb550043878b22ce7043f05dacdc6cc3 --- /dev/null +++ b/lib/ds/lxs/lxs_0001.c @@ -0,0 +1,151 @@ +/* + * FILE ~/usr/ds/lxs/lxs_0001.c + * + * lexicon services + * + * written: 1994-03-27 + * latest update: 1995-07-18 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/lxs.h> +#include <gg/attlist.h> + +/* ------------------------------------------------------------------------ */ +/* a cache of already requested words is kept in a ytree structure */ + +static int max_lexicons= 0; +static struct YTREE *lxs_ytree= (struct YTREE *) 0; + +static char **lut_file; +static char **word_ref_file; +static FILE **f_lut; +static FILE **f_wr; + +/* ------------------------------------------------------------------------ */ +struct LXS_OLD_ENTRY *lxs_get_word ( +int lexicon_number, /* lexicon to be used */ +unsigned char *wrd, /* word to be lookup up */ +int cr_flag) /* insert in temporary structures */ +{ + struct YTREE *yt; + int yt_update= 0; /* 1 -> yt pointer must be updated */ + int flg_word_ref= 0; /* 1 -> word_ref found */ + + /* datastructures created and returned */ + struct LXS_OLD_ENTRY *lxse= (struct LXS_OLD_ENTRY *) 0; + struct WORD_REF *wref= (struct WORD_REF *) 0; +/* struct ATTRIBUTE_LIST *attl= (struct ATTRIBUTE_LIST *) 0; ****/ + + if (lexicon_number < 0 + || lexicon_number >= max_lexicons) return (struct LXS_OLD_ENTRY *) 0; + + if (cr_flag) + { + if ((yt= ytree_insert_word (&lxs_ytree, wrd)) == (struct YTREE *) 0) + return (struct LXS_OLD_ENTRY *) 0; /* error */ + + yt->YT_flags |= YTflag_EOW; + if (yt->YT_info != 0L) return (struct LXS_OLD_ENTRY *) yt->YT_info; + yt_update= 1; + } + else + { + if ((yt= ytree_lookup_word (lxs_ytree, wrd)) != (struct YTREE *) 0) + return (struct LXS_OLD_ENTRY *) yt->YT_info; + } + + if (f_lut [lexicon_number] != (FILE *) 0 + && f_wr [lexicon_number] != (FILE *) 0) + { + if ((wref= calloc (sizeof (struct WORD_REF), 1)) == (void *) 0) + goto NO_MEMORY; + + if (lmd_deref_word_ref (f_lut [lexicon_number], + f_wr [lexicon_number], wrd, 1, wref) == 0) + flg_word_ref= 1; + } + + if (flg_word_ref) + { + if ((lxse= calloc (sizeof (struct LXS_OLD_ENTRY), 1)) == (void *) 0) + { +NO_MEMORY: + fprintf (stderr, "error: lxs_get_word() no memory!\n"); + return (struct LXS_OLD_ENTRY *) 0; + } + + lxse->lxs_entry_type= LXS_ty_word_ref; + lxse->lxs_entry_size= sizeof (struct WORD_REF *) 0; + lxse->lxs_entry= wref; + + if (!yt_update) + { /* created only if found */ + if ((yt= ytree_insert_word (&lxs_ytree, wrd)) == (struct YTREE *) 0) + return (struct LXS_OLD_ENTRY *) 0; + yt->YT_flags |= YTflag_EOW; + } + + yt->YT_info= (long) lxse; + } + + return lxse; +} + +/* ------------------------------------------------------------------------ */ +int lxs_set_word_ref ( +int lexicon_number, /* lexicon to be used */ +char *fnm_lut, +char *fnm_wr) +{ + if (lexicon_number < 0 + || lexicon_number >= max_lexicons) return -1; + + if ((f_lut[lexicon_number]= + fopen (lut_file[lexicon_number]= fnm_lut, "rb")) + == (FILE *) 0) goto ERROR; + + if ((f_wr[lexicon_number]= + fopen (word_ref_file[lexicon_number]= fnm_wr, "rb")) + == (FILE *) 0) + { + fclose (f_lut[lexicon_number]); + f_lut[lexicon_number]= (FILE *) 0; +ERROR: + return -1; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int lxs_shutdown_word_ref ( +int lexicon_number) /* lexicon to be used */ +{ + if (lexicon_number < 0 + || lexicon_number >= max_lexicons) return -1; + + if (f_lut[lexicon_number] != (FILE *) 0) fclose (f_lut[lexicon_number]); + if (f_wr[lexicon_number] != (FILE *) 0) fclose (f_wr[lexicon_number]); + f_lut[lexicon_number]= f_wr[lexicon_number]= (FILE *) 0; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int lxs_intialize (int num) +{ + if (num < 0) return -1; + + lut_file= (char **) calloc (sizeof (char *), num); + word_ref_file= (char **) calloc (sizeof (char *), num); + f_lut= (FILE **) calloc (sizeof (FILE *), num); + f_wr= (FILE **) calloc (sizeof (FILE *), num); + + max_lexicons= num; + + return 0; +} diff --git a/lib/ds/lxs/lxs_2001.c b/lib/ds/lxs/lxs_2001.c new file mode 100644 index 0000000000000000000000000000000000000000..c0a82d1995f1c54143765eba26f2c34d91c24f9a --- /dev/null +++ b/lib/ds/lxs/lxs_2001.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/lxs/lxs_2001.c + * + * lexicon services + * + * written: 1996-12-20 + * latest update: 1996-12-22 11:47:57 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/lxs2.h> + +/* ------------------------------------------------------------------------ */ +struct LEXICON_CONTEXT *lxs_new_context (char *name) +{ + struct LEXICON_CONTEXT *lxc; + + if ((lxc= (struct LEXICON_CONTEXT *) + calloc (sizeof (struct LEXICON_CONTEXT), 1)) + != (struct LEXICON_CONTEXT *) 0) + { + lxc->to_lower= 1; /* T2D */ + + lxc->name= strdup (name); + } + + return lxc; +} diff --git a/lib/ds/lxs/lxs_2002.c b/lib/ds/lxs/lxs_2002.c new file mode 100644 index 0000000000000000000000000000000000000000..e402c001e50bf6018a735d8d486d1502df997acf --- /dev/null +++ b/lib/ds/lxs/lxs_2002.c @@ -0,0 +1,121 @@ +/* + * FILE %ds/lxs/lxs_2002.c + * + * lexicon services + * + * written: 1996-12-20 + * latest update: 1996-12-22 11:48:01 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/lxs2.h> + +/* ------------------------------------------------------------------------ */ +static struct LEXICON_ENTRY *ins_entry (struct YTREE **ytp, char **sp); + +/* ------------------------------------------------------------------------ */ +struct LEXICON_ENTRY *lxs_record ( +struct LEXICON_CONTEXT *lxc, +char *str, +int is_mixed) +{ + struct LEXICON_ENTRY *lxe= (struct LEXICON_ENTRY *) 0; + struct LEXICON_ENTRY *lxe_mixed= (struct LEXICON_ENTRY *) 0; + struct LEXICON_ENTRY *lxe_lower= (struct LEXICON_ENTRY *) 0; + char *w_mixed; + char *w_lower; + int ref= 0; + + if (lxc == (struct LEXICON_CONTEXT *) 0 + || str == (char *) 0 + || (w_lower= strdup (str)) == (char *) 0 + ) + { +DONE: + fprintf (stderr, "lxs_2002: error or no memory! (ref=%d)\n", ref); + + return (struct LEXICON_ENTRY *) 0; + } + ref++; + + if (is_mixed == -1) + is_mixed= (verify (str, "abcdefghijklmnopqrstuvwxyz")) ? 1 : 0; + + if (is_mixed && lxc->to_lower) + { + to_lower (w_lower); + is_mixed= 0; + } + + if (is_mixed) + { + if ((w_mixed= strdup (w_lower)) == (char *) 0) goto DONE; + to_lower (w_lower); + } + + if ((lxe_lower= ins_entry (&lxc->lower_case, &w_lower)) + == (struct LEXICON_ENTRY *) 0 + ) goto DONE; + + if (is_mixed) + { + if ((lxe_mixed= ins_entry (&lxc->mixed_case, &w_mixed)) + == (struct LEXICON_ENTRY *) 0 + ) goto DONE; + + lxe= lxe_mixed; + lxc->num_entries_mixed++; + } + else + { + lxe= lxe_lower; + lxc->num_entries_lower++; + } + + lxe->ref_count++; + + return lxe; +} + +/* ------------------------------------------------------------------------ */ +static struct LEXICON_ENTRY *ins_entry ( +struct YTREE **ytp, +char **sp) +{ + struct LEXICON_ENTRY *lxe= (struct LEXICON_ENTRY *) 0; + struct YTREE *yt; + + if ((yt= ytree_insert_word (ytp, (unsigned char *) *sp)) + == (struct YTREE *) 0 + ) + { +ERR: + return (struct LEXICON_ENTRY *) 0; + } + + if (yt->YT_flags & YTflag_EOW) + { + if ((lxe= (struct LEXICON_ENTRY *) yt->YT_info) + == (struct LEXICON_ENTRY *) 0) goto ERR; + + free (*sp); + *sp= lxe->entry; + } + else + { + if ((lxe= (struct LEXICON_ENTRY *) + calloc (sizeof (struct LEXICON_ENTRY), 1)) + == (struct LEXICON_ENTRY *) 0) goto ERR; + + yt->YT_info= (long) *sp; + yt->YT_flags |= YTflag_EOW; + + lxe->entry= *sp; + } + + return lxe; +} diff --git a/lib/ds/lxs/lxs_2003.c b/lib/ds/lxs/lxs_2003.c new file mode 100644 index 0000000000000000000000000000000000000000..492d4da1128eb07e261d6bbc14383a64bfa79f5a --- /dev/null +++ b/lib/ds/lxs/lxs_2003.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/lxs/lxs_2003.c + * + * dump a complete lexicon context + * + * written: 1996-12-22 + * latest update: 1996-12-22 11:52:25 + * + */ + +#include <stdio.h> +#include <gg/lxs2.h> + +/* ------------------------------------------------------------------------ */ +int lxs_dump_context (struct LEXICON_CONTEXT *lxc, FILE *fo) +{ + if (lxc == (struct LEXICON_CONTEXT *) 0) return -1; + + fprintf (fo, "\nLexicon Context Name: %s (%s)\n", + lxc->name, (lxc->to_lower) ? "lower" : "mixed"); + + fprintf (fo, "BEGIN lower case dictionary\n"); + ytree_process_info (lxc->lower_case, lxs_dump_entry2, (void *) fo); + fprintf (fo, "END lower case dictionary\n"); + + fprintf (fo, "BEGIN mixed case dictionary\n"); + ytree_process_info (lxc->mixed_case, lxs_dump_entry2, (void *) fo); + fprintf (fo, "END mixed case dictionary\n"); + + return 0; +} diff --git a/lib/ds/lxs/lxs_2004.c b/lib/ds/lxs/lxs_2004.c new file mode 100644 index 0000000000000000000000000000000000000000..35357791767278fdfbce87eae4c43f36b9c5bb1a --- /dev/null +++ b/lib/ds/lxs/lxs_2004.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/lxs/lxs_2004.c + * + * dump a single lexicon entry + * + * written: 1996-12-22 + * latest update: 1996-12-22 11:52:25 + * + */ + +#include <stdio.h> +#include <gg/lxs2.h> + +/* ------------------------------------------------------------------------ */ +int lxs_dump_entry (struct LEXICON_ENTRY *lxe, FILE *fo) +{ + if (lxe == (struct LEXICON_ENTRY *) 0) return -1; + + fprintf (fo, "%7ld %s\n", lxe->ref_count, lxe->entry); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int lxs_dump_entry2 (long entry_ref, void *cd) +{ + return lxs_dump_entry ((struct LEXICON_ENTRY *) entry_ref, + (FILE *) cd); +} diff --git a/lib/ds/lxs/make-dos b/lib/ds/lxs/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..85288515d2cddd67897cbe8496cecc1e8eedff85 --- /dev/null +++ b/lib/ds/lxs/make-dos @@ -0,0 +1,24 @@ +# +# FILE %ds/lxs/makefile +# +# lexicon services +# +# written: 1984-03-27 +# latest update: 1995-12-20 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all : all.2 + +all.0 : # lxs_0001.obj lxs_0002.obj lxs_0003.obj lxs_0004.obj + +all.2 : lxs_2001.obj lxs_2002.obj lxs_2003.obj lxs_2004.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/mail/(dirinf).fm b/lib/ds/mail/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..442c9013aa9c4f8babf4efde54019918749ab2d3 --- /dev/null +++ b/lib/ds/mail/(dirinf).fm @@ -0,0 +1,34 @@ +# +# FILE %ds/mail/(dirinf).fm +# +. Mail handling subroutines +# +# written: 1997-11-26 +.. latest update: 1997-11-26 13:04:13 +# + +# see also: <gg/mail.h> +(dirinf).fm Contents +make-dos DOS version of Makefile +make-ux Unix version of Makefile + +mail0000.c TEMPLATE +mail0001.c int RFC822_chk_keyword (char *s, int lng); +mail0002.c int mk_fnm_from_date (char *fnm_string, ...) +mail0003.c int message_delimiter (char *p, int delim_mode); +mail0004.c int breakup (char *fn, struct BREAKUP_CONTROL *bc); +mail0005.c int record_mails (struct BREAKUP_CONTROL *bc, ...) +mail0006.c int sort_mail (struct YTREE **ytr, ...) +mail0007.c struct BREAKUP_CONTROL *create_breakup_control (void); +mail0008.c int print_mail_description_link (FILE *fo, ...) +mail0009.c int print_mail_description_list (FILE *fo, ...) +mail0010.c int cdecl mk_frame_name_from_date (char *fnm_string, ...); + +mail0011.c int mail_verify_address (char *s, ...) +mail0012.c int mail_verify_domain_name (char *s, ...) +mail0013.c int mail_valid_tld (char *s) +mail0014.c int mail_verify_message_id (char *s, ...) + + +mt1.c mail test 1 + diff --git a/lib/ds/mail/Makefile b/lib/ds/mail/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..03e97e75da3f131e10a9f5b8ba119b24b6004e31 --- /dev/null +++ b/lib/ds/mail/Makefile @@ -0,0 +1,45 @@ +# +# FILE %ds/mail/make-ux +# +# written: 1997-11-27 +# latest update: 1999-05-08 9:50:34 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + mail0001.o mail0002.o mail0003.o mail0004.o mail0005.o \ + mail0006.o mail0007.o mail0008.o mail0009.o mail0010.o \ + mail0011.o mail0012.o mail0013.o mail0014.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib + +# ---------------------------------------------------------------------------- +MOD1= mail0011.o mail0012.o mail0013.o mail0014.o +mt1.o : mt1.c + $(CC) $(OPTS) -c -DMT1 $? + +mt1 : mt1.o $(MOD1) + cc -o $@ mt1.o $(MOD1) $(LIB) + +mt2.o : mt1.c + $(CC) $(OPTS) -c -DMT2 $? + +mt2 : mt2.o $(MOD1) + cc -o $@ mt2.o $(MOD1) $(LIB) diff --git a/lib/ds/mail/contrib b/lib/ds/mail/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/mail/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/mail/gg b/lib/ds/mail/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/mail/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/mail/libgg.a b/lib/ds/mail/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/mail/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/mail/mail0000.c b/lib/ds/mail/mail0000.c new file mode 100644 index 0000000000000000000000000000000000000000..f7d4cd19ff6deb3f492dfebd8058082e9b80642d --- /dev/null +++ b/lib/ds/mail/mail0000.c @@ -0,0 +1,15 @@ +/* + * FILE %ds/mail/mail0000.c + * + * convert a date string into a filename + * + * written: 1997-11-26 + * latest update: 1997-11-26 13:07:29 + * + */ + +#include <gg/strings.h> +#include <gg/rfc822.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ diff --git a/lib/ds/mail/mail0001.c b/lib/ds/mail/mail0001.c new file mode 100644 index 0000000000000000000000000000000000000000..8d0824d07cbb4c2ec8f66aeff182879106ccb4d5 --- /dev/null +++ b/lib/ds/mail/mail0001.c @@ -0,0 +1,119 @@ +/* + * FILE %usr/mail/mail0001.c + * + * RFC822 Keywords aus einer Zeile extrahieren + * + * written: 1990 12 01: aus DISTMAIL.C extrahiert + * latest update: 1997-01-25 18:48:19 + * + */ + +#include <string.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/rfc822.h> + +/* ------------------------------------------------------------------------ */ +struct RFC822_KEYWORD RFC822_keywords [] = +{ + { "Approved:", RFC822_Approved }, + { "Approved-By:", RFC822_Approved_By }, + { "Control:", RFC822_Control }, + { "Date:", RFC822_Date }, + { "From:", RFC822_From }, + { "Keywords:", RFC822_Keywords }, + { "Newsgroups", RFC822_Newsgroups }, + { "Path:", RFC822_Path }, + { "Received:", RFC822_Received }, + { "Subject:", RFC822_Subject }, + { "Subj:", RFC822_Subject }, + { "Summary:", RFC822_Summary }, + { "To:", RFC822_To }, + { "Via:", RFC822_Via }, + { (char *) 0, 0 } + } ; + +/* ------------------------------------------------------------------------ */ +static struct YTREE *keywords= (struct YTREE *) 0; + +/* ------------------------------------------------------------------------ */ +int RFC822_reg_keyword_table (struct RFC822_KEYWORD *tbl) +{ + int i; + + for (i= 0;; i++) + { + if (tbl [i].kw == (unsigned char *) 0) break; + ytree_set_value (&keywords, tbl [i].kw, tbl [i].code); + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int RFC822_reg_keyword (unsigned char *kw, long code) +{ + if (kw != (unsigned char *) 0) + ytree_set_value (&keywords, kw, code); + + return 0; +} + +/* Keywords suchen: ------------------------------------------------------- */ +long RFC822_chk_keyword (char *s, int lng) +/* Return Values: */ +/* RFC822_unknown ... unidentifzierter Inhalt */ +/* RFC822_continue ... Zeile beginnt mit Blank; */ +/* -> Fortsetzung des letzten Records */ +/* RFC822_blank ... Leerzeile oder Zeile aus Blanks und Tabs; */ +/* -> Ende des RFC822 Headers */ +/* RFC822_sep1 ... Zeile aus ======= bestehend; */ +/* -> NOTEBOOK seperator */ +/* RFC822_sep2 ... Zeile aus ------- bestehend; */ +/* -> NOTEBOOK seperator */ +{ + int i; +#define MAX_TMP 20 + unsigned char line3 [MAX_TMP+1]; + int ch; + + switch (s [0]) + { + case 0: return (long) RFC822_blank; + + case ' ': + case '\t': + for (i= 1; (ch= s [i] & 0x00FF); i++) + if (ch != ' ' && ch != '\t') return (long) RFC822_continue; + return (long) RFC822_blank; + + case '=': + for (i= 0; (ch= s [i] & 0x00FF); i++) + if (ch != '=') break; + if (i > 60) return (long) RFC822_sep1; + return (long) RFC822_unknown; + + case '-': + for (i= 0; (ch= s [i] & 0x00FF); i++) + if (ch != '-') break; + if (i > 60) return (long) RFC822_sep2; + return (long) RFC822_unknown; + + case 'F': + if (strncmp (s, "From ", 5) == 0) return (long) RFC822_sep_elm; + + default: + if (keywords == (struct YTREE *) 0) + RFC822_reg_keyword_table (RFC822_keywords); + + for (i= 0; i < MAX_TMP && i < lng && (ch= s [i] & 0x00FF); i++) + { + if (ch == ' ' || ch == '\t') break; + if (ch >= 'A' && ch <= 'Z') ch= ch - 'a' + 'A'; + line3 [i]= (unsigned char) ch; + } + line3 [i]= 0; + + return ytree_get_value (keywords, line3); + } +} diff --git a/lib/ds/mail/mail0002.c b/lib/ds/mail/mail0002.c new file mode 100644 index 0000000000000000000000000000000000000000..4b9c2b57a056cdf029a12659571a0ed3889c0a97 --- /dev/null +++ b/lib/ds/mail/mail0002.c @@ -0,0 +1,41 @@ +/* + * FILE ~/usr/mail/mail0002.c + * + * convert a date string into a filename + * + * written: 1994-05-20: aus DISTMAIL.C extrahiert + * latest update: 1995-01-29 + * + */ + +#include <gg/strings.h> +#include <gg/rfc822.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +int mk_fnm_from_date (char *fnm_string, char *date_string, int normalize) +{ + int jahr, mon, tag; + int std, min, sek; + int tz; + int rrc; + + analyze_date (date_string, &jahr, &mon, &tag, &std, &min, &sek, &tz); + + if (normalize) + { + std -= tz; /* -0400 means it's already 4 hours later */ + if (std < 0) std= 0; /* :(( well.. something to be solved.. */ + } + + rrc = enter_value (fnm_string, 0, jahr, 2); + rrc += enter_value (fnm_string, 2, mon, 2); + rrc += enter_value (fnm_string, 4, tag, 2); + rrc += enter_value (fnm_string, 6, std, 2); + rrc += enter_value (fnm_string, 9, min, 2); + /* rrc += enter_value (fnm_string, 11, sek, 2); */ + fnm_string [ 8]= '.'; + fnm_string [11]= 0; + + return rrc; +} diff --git a/lib/ds/mail/mail0003.c b/lib/ds/mail/mail0003.c new file mode 100644 index 0000000000000000000000000000000000000000..97f7048f88da033866a9de4a48ebb9aa708a67d7 --- /dev/null +++ b/lib/ds/mail/mail0003.c @@ -0,0 +1,57 @@ +/* + * FILE %usr/mail/mail0003.c + * + * check if the current line is a mail delimiter + * + * written: 1995-01-29: aus DISTMAIL.C extrahiert + * latest update: 1997-01-25 19:38:00 + * + */ + +#include <string.h> +#include <gg/strings.h> +#include <gg/rfc822.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +static char OLDMAIL_LOG_sep [] = "+++++++ +++++++ +++++++"; + +/* ------------------------------------------------------------------------ */ +int message_delimiter (char *p, int delim_mode) +{ + int i; + + switch (delim_mode) + { + case DELIMIT_NOTEBOOK: + for (i= 0;; i++) if (p [i] != '=') break; + if (i >= 70) return 1; + break; + case DELIMIT_OCCAM_archive: /* OCCAM ARCHIVE */ + if (strncmp (p, "From daemonprgv", 16) == 0) return 1; + break; + case DELIMIT_LISTSERV_DB: /* LISTSERV Database Output */ + if (strncmp (p, ">>> Item number ", 16) == 0) return 1; + break; + case DELIMIT_3: + for (i=1;; i++) if (p [i] != '=') break; + if (i >= 64) return 1; + break; + case DELIMIT_Love_Hounds: + for (i=0;; i+= 2) + if (((int) (p[i]&0x00FF)) != 0x00D5 + || (((int) p[i+1]&0x00FF)) != 0x00FE) break; + if (i >= 32) return 1; + break; + case DELIMIT_card_oldmail: + if (strncmp (p, OLDMAIL_LOG_sep, 23) == 0) return 1; + break; + case DELIMIT_Unix: + if (strncmp (p, "From ", 5) == 0) return 1; + break; + default: + return -1; + } + + return 0; +} diff --git a/lib/ds/mail/mail0004.c b/lib/ds/mail/mail0004.c new file mode 100644 index 0000000000000000000000000000000000000000..ed537e84dc1ac1dc9cf0bb0b56975f50ad91c271 --- /dev/null +++ b/lib/ds/mail/mail0004.c @@ -0,0 +1,185 @@ +/* + * FILE %usr/mail/mail0004.c + * + * convert a date string into a filename + * + * written: 1995-01-29: aus DISTMAIL.C extrahiert + * latest update: 1997-11-27 19:58:43 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/convent.h> +#include <gg/rfc822.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +static FILE *fo; +static int fo_open= 0; + +#define LOG_MODE_distmail 0 +#define LOG_MODE_dirinf 1 +static int log_mode= LOG_MODE_dirinf; + +#define FIELD_LENGTH 512 +static char Addr [FIELD_LENGTH]; +static char Date [FIELD_LENGTH]; +static char Subject [FIELD_LENGTH]; +static int cnt_lines= 0; + +#define FNM_SIZE 80 +static char fo_name [FNM_SIZE]; +static char new_fnm [FNM_SIZE]; + +/* ------------------------------------------------------------------------ */ +#define LINE_SIZE 512 +static char LINE [LINE_SIZE]; + +/* ------------------------------------------------------------------------ */ +int breakup (char *fn, struct BREAKUP_CONTROL *bc) +{ + FILE *fi; + int rv, i; + int remove_counter= 0; + int in_header= 0; + int header_field; + + if ((fi= fopen (fn, "rb")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", fn); + return -1; + } + + for (;;) + { + rv= fread_line (fi, LINE, LINE_SIZE); + if (rv < 0 && feof (fi)) break; + + if (rv >= 20 && message_delimiter (LINE, bc->BC_delimiter_mode)) + { /* Grenze einer Message identifiziert ??? */ + close_current_file (bc); + new_file (bc); + for (i= 0; i < bc->BC_dummy_lines; i++) + fprintf (fo, "DUMMY %d\r\n", i); + remove_counter= bc->BC_remove_lines; + in_header= 1; + Addr [0]= 0; + Date [0]= 0; + Subject [0]= 0; + cnt_lines= 0; + continue; + } + + if (remove_counter > 0) + { + remove_counter--; + continue; + } + + if (in_header) + { + header_field= (int) RFC822_chk_keyword (LINE, rv); + switch (header_field) + { + case RFC822_blank: + in_header= 0; + break; + case RFC822_From: + case RFC822_To: + if (bc->BC_use_addr == header_field && Addr [0] == 0) + strnscpy (Addr, LINE, FIELD_LENGTH); + break; + case RFC822_Date: + if (Date [0] == 0) + strnscpy (Date, LINE, FIELD_LENGTH); + break; + case RFC822_Subject: + if (Subject [0] == 0) + strnscpy (Subject, LINE, FIELD_LENGTH); + break; + } + } + + if (fo_open) + { + if (bc->BC_is_hyx) + fputs_entity (LINE, fo, CONVENT_pc_text); + else fputs (LINE, fo); + fputc ('\n', fo); + cnt_lines++; + } + } + + fclose (fi); + close_current_file (bc); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int close_current_file (struct BREAKUP_CONTROL *bc) +{ + BC_REPORT_MAIL *report; + + if (bc->BC_is_hyx) + { + if (fo_open) + { + char *p_addr; + char *p_subj; + + normalize_date (new_fnm, Date, 1); + p_addr= locate_word (Addr, 1); + p_subj= locate_word (Subject, 1); + if ((report= bc->BC_report_mail) != (BC_REPORT_MAIL *) 0) + (*report) (bc, fo_name, p_addr, new_fnm, p_subj, cnt_lines); + fprintf (bc->BC_hyx, "</Frame>\n"); + } + } + else + { + if (fo_open) fclose (fo); + + if (bc->BC_f_rename_file && Date [0] != 0) + { + mk_fnm_from_date (new_fnm, Date, 1); + unlink (new_fnm); + rename (fo_name, new_fnm); + } + } + + fo_open= 0; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int new_file (struct BREAKUP_CONTROL *bc) +{ + sprintf (fo_name, bc->BC_format, bc->BC_counter); + + if (log_mode == LOG_MODE_distmail && bc->BC_log != (FILE *) 0) + { + fprintf (bc->BC_log, + "%s 1 MAILER %04d M PUN 0 001 NONE xx/xx yy/yy/yy %s %s qqq\n", + fo_name, bc->BC_counter, bc->BC_f_name, bc->BC_f_type); + } + + bc->BC_counter++; + + if (bc->BC_is_hyx) + { + fo= bc->BC_hyx; + fprintf (bc->BC_hyx, "<Frame %s>\n", fo_name); + } + else + { + if ((fo= fopen (fo_name, "wb")) == (FILE *) 0) return -1; + } + fo_open= 1; + + return 0; +} diff --git a/lib/ds/mail/mail0005.c b/lib/ds/mail/mail0005.c new file mode 100644 index 0000000000000000000000000000000000000000..8dd3bb43900927a50e82504673fcf1eeeb3ad8f5 --- /dev/null +++ b/lib/ds/mail/mail0005.c @@ -0,0 +1,47 @@ +/* + * FILE ~/usr/mail/mail0007.c + * + * convert a date string into a filename + * + * written: 1995-01-29 + * latest update: 1995-01-29 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/rfc822.h> + +/* ------------------------------------------------------------------------ */ +int record_mails ( +struct BREAKUP_CONTROL *bc, +char *frame, +char *addr, +char *date, +char *subj, +int cnt) +{ + struct MAIL_DESCRIPTION *md; + + if ((md= (struct MAIL_DESCRIPTION *) + calloc (sizeof (struct MAIL_DESCRIPTION), 1)) + == (struct MAIL_DESCRIPTION *) 0) + return -1; + + str_assign (&md->MD_frame, frame); + str_assign (&md->MD_subj, subj); + str_assign (&md->MD_addr, addr); + str_assign (&md->MD_date, date); + md->MD_cnt= cnt; + *bc->BC_MD_append= md; + bc->BC_MD_append= &md->MD_next; + + sort_mail (&bc->BC_yt_addr, md, &md->MD_by_addr, str_or_undef (addr)); + sort_mail (&bc->BC_yt_date, md, &md->MD_by_date, str_or_undef (date)); + sort_mail (&bc->BC_yt_subj, md, &md->MD_by_subj, str_or_undef (subj)); + + return 0; +} diff --git a/lib/ds/mail/mail0006.c b/lib/ds/mail/mail0006.c new file mode 100644 index 0000000000000000000000000000000000000000..d0082517b2afb15b38783cf58cf08a8e50369c8c --- /dev/null +++ b/lib/ds/mail/mail0006.c @@ -0,0 +1,30 @@ +/* + * FILE %usr/mail/mail0006.c + * + * convert a date string into a filename + * + * written: 1995-01-29 + * latest update: 1997-01-25 18:56:20 + * + */ + +#include <gg/ytree.h> +#include <gg/rfc822.h> + +/* ------------------------------------------------------------------------ */ +int sort_mail ( +struct YTREE **ytr, +struct MAIL_DESCRIPTION *md, +struct MAIL_DESCRIPTION **md_app, +char *str) +{ + struct YTREE *yt; + + if ((yt= ytree_insert_word (ytr, str)) == (struct YTREE *) 0) return -1; + + yt->YT_flags |= YTflag_EOW; + *md_app= (struct MAIL_DESCRIPTION *) yt->YT_info; + yt->YT_info= (long) md; + + return 0; +} diff --git a/lib/ds/mail/mail0007.c b/lib/ds/mail/mail0007.c new file mode 100644 index 0000000000000000000000000000000000000000..fb389b89cb0aedd85cc34a466abf09702047285a --- /dev/null +++ b/lib/ds/mail/mail0007.c @@ -0,0 +1,39 @@ +/* + * FILE ~/usr/mail/mail0007.c + * + * create a breakup control structure + * + * written: 1995-01-29 + * latest update: 1995-01-29 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/rfc822.h> + +/* ------------------------------------------------------------------------ */ +struct BREAKUP_CONTROL *create_breakup_control () +{ + struct BREAKUP_CONTROL *bc; + + if ((bc= (struct BREAKUP_CONTROL *) + calloc (sizeof (struct BREAKUP_CONTROL), 1)) + != (struct BREAKUP_CONTROL *) 0) + { + bc->BC_delimiter_mode= DELIMIT_Unix; + bc->BC_f_rename_file= 1; + bc->BC_counter= 1; /* message counter */ + bc->BC_dummy_lines= 0; /* number of lines to be inserted in header */ + bc->BC_remove_lines= 0; /* number of lines to be removed in header */ + bc->BC_is_hyx= 1; + bc->BC_hyx= stdout; + bc->BC_use_addr= RFC822_From; + bc->BC_report_mail= record_mails; + bc->BC_MD_append= &bc->BC_MD_list; + bc->BC_format= "XQQQ%04d.chk"; + } + + return bc; +} diff --git a/lib/ds/mail/mail0008.c b/lib/ds/mail/mail0008.c new file mode 100644 index 0000000000000000000000000000000000000000..4a824c41cc08c7b9be68012cabc8367cf78f40ff --- /dev/null +++ b/lib/ds/mail/mail0008.c @@ -0,0 +1,44 @@ +/* + * FILE %usr/mail/mail0008.c + * + * convert a date string into a filename + * + * written: 1995-01-29 + * latest update: 1996-06-09 11:14:39 + * + */ + +#include <stdio.h> +#include <gg/convent.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/rfc822.h> + +/* ------------------------------------------------------------------------ */ +int print_mail_description_link ( +FILE *fo, +struct MAIL_DESCRIPTION *md) +{ + char *s; + int cnt; + int ch; + + fprintf (fo, + "<hyx.l tdc=hyx.l tdp=14 fr=\"%s\">%14s %4d ", + str_or_undef (md->MD_frame), + str_or_undef (md->MD_date), + md->MD_cnt); + + cnt= 24; + for (s= str_or_undef (md->MD_addr); + (ch= *s & 0x00FF) != 0 && cnt > 0; + s++, cnt--) + fputc_entity (ch, fo, CONVENT_pc_text); + + blanks (fo, cnt); + + fputs_entity (str_or_undef (md->MD_subj), fo, CONVENT_pc_text); + fputc ('\n', fo); + + return 0; +} diff --git a/lib/ds/mail/mail0009.c b/lib/ds/mail/mail0009.c new file mode 100644 index 0000000000000000000000000000000000000000..53e31c258eb9bd9dbcc3571116c39c04ecd3184b --- /dev/null +++ b/lib/ds/mail/mail0009.c @@ -0,0 +1,51 @@ +/* + * FILE %ds/mail/mail0009.c + * + * convert a date string into a filename + * + * written: 1995-01-29 + * latest update: 1997-11-27 19:59:06 + * + */ + +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/rfc822.h> + +/* ------------------------------------------------------------------------ */ +int print_mail_description_list ( +FILE *fo, +struct MAIL_DESCRIPTION *md, +int sort_mode) +{ + while (md != (struct MAIL_DESCRIPTION *) 0) + { + print_mail_description_link (fo, md); + + switch (sort_mode) + { + case 0: + md= md->MD_next; + break; + + case RFC822_From: + case RFC822_To: + md= md->MD_by_addr; + break; + + case RFC822_Date: + md= md->MD_by_date; + break; + + case RFC822_Subject: + md= md->MD_by_subj; + break; + + default: + goto STOP; + } + } + +STOP: + return 0; +} diff --git a/lib/ds/mail/mail0010.c b/lib/ds/mail/mail0010.c new file mode 100644 index 0000000000000000000000000000000000000000..1939bc58ae871f62603ee8b08344354dbf629fd7 --- /dev/null +++ b/lib/ds/mail/mail0010.c @@ -0,0 +1,44 @@ +/* + * FILE ~/usr/mail/mail0010.c + * + * convert a date string into a filename + * + * written: 1995-01-29: variation of mail0002.c + * latest update: 1995-01-29 + * + */ + +#include <gg/strings.h> +#include <gg/rfc822.h> +#include <gg/dates.h> + +/* ------------------------------------------------------------------------ */ +int normalize_date (char *fnm_string, char *date_string, int normalize) +{ + int jahr, mon, tag; + int std, min, sek; + int tz; + int rrc; + + analyze_date (date_string, &jahr, &mon, &tag, &std, &min, &sek, &tz); + + if (normalize) + { + std -= tz; /* -0400 means it's already 4 hours later */ + if (std < 0) std= 0; /* :(( well.. something to be solved.. */ + } + + rrc = enter_value (fnm_string, 0, jahr, 2); + rrc += enter_value (fnm_string, 3, mon, 2); + rrc += enter_value (fnm_string, 6, tag, 2); + rrc += enter_value (fnm_string, 9, std, 2); + rrc += enter_value (fnm_string, 12, min, 2); + + fnm_string [ 2]= + fnm_string [ 5]= '-'; + fnm_string [ 8]= ' '; + fnm_string [11]= ':'; + fnm_string [14]= 0; + + return rrc; +} diff --git a/lib/ds/mail/mail0011.c b/lib/ds/mail/mail0011.c new file mode 100644 index 0000000000000000000000000000000000000000..4b4652d981dd73f7d922333e7d5f10836367f6ae --- /dev/null +++ b/lib/ds/mail/mail0011.c @@ -0,0 +1,96 @@ +/* + * FILE %ds/mail/mail0011.c + * + * verify an email address + * + * written: 1997-11-26 + * latest update: 1997-11-27 12:45:50 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/rfc822.h> + +/* ------------------------------------------------------------------------ */ +int mail_verify_address ( +char *addr, +int dup, +struct MAIL_VERIFY_DB *db) +{ + int rc= 0; + char *user, *domain, *f[2]; + int nf; + int ch, i; + int lng_user, lng_domain; + DB_lookup *dbq; + + if (addr == (char *) 0 + || (dup && (addr= strdup (addr)) == (char *) 0) + ) return -1; + + to_lower (addr); + + /* lookup address in goodaddr database, return ok if found */ + if ((dbq= db->goodaddr) != (DB_lookup *) 0 + && (*dbq) (addr, db->cd_goodaddr) > 0 + ) + { + rc= 0; + goto DONE; + } + + /* lookup address in spammer database, return spammer if found */ + if ((dbq= db->spammers) != (DB_lookup *) 0 + && (*dbq) (addr, db->cd_spammers) > 0 + ) + { + rc= ADDR_SPAMMER; + goto DONE; + } + + nf= split_string (addr, '@', f, 2); + if (nf != 2 + || (lng_user= strlen (user= f[0])) <= 0 + || (lng_domain= strlen (domain= f[1])) <= 0 + ) + { + rc= ADDR_SYNTAX; + goto DONE; + } + + /* certain well known domains have their special naming rules */ + if (strcmp (domain, "aol.com") == 0) + { + if (lng_user < 3 + || lng_user > 20 /* as of 1997-11-26: max 10 chars, to be changed */ + ) + { +FAKED: + rc= ADDR_INVALID; + goto DONE; + } + + for (i= 0; ch= user [i] & 0x00FF; i++) + { + if (!((ch >= 'a' && ch <= 'z') + || (ch >= 'A' && ch <= 'Z') + || (ch >= '0' && ch <= '9' && i > 0) + || (ch == '+' && i > 0) + ) + ) goto FAKED; + } + } + else + { + rc= mail_verify_domain_name (domain, 0, db); + if (rc != 0) goto DONE; + } + + rc= 0; + +DONE: + if (dup) free (addr); + return rc; +} diff --git a/lib/ds/mail/mail0012.c b/lib/ds/mail/mail0012.c new file mode 100644 index 0000000000000000000000000000000000000000..358f2ad377f1a57b3e13d3594ea085407c28728f --- /dev/null +++ b/lib/ds/mail/mail0012.c @@ -0,0 +1,83 @@ +/* + * FILE %ds/mail/mail0012.c + * + * verify an email address + * + * written: 1997-11-26 + * latest update: 1997-11-27 12:39:52 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/rfc822.h> + +/* ------------------------------------------------------------------------ */ +int mail_verify_domain_name ( +char *addr, +int dup, +struct MAIL_VERIFY_DB *db) +{ + int nsd; + int i, rc, ch; + int flg; +#define MAX_SD 10 + char *sd [MAX_SD]; + char *asd; + DB_lookup *dbq; + + if (addr == (char *) 0 || *addr == 0 + || (dup && (addr= strdup (addr)) == (char *) 0) + ) return -1; + + nsd= split_string (addr, '.', sd, MAX_SD); + if (nsd >= MAX_SD || nsd <= 1) + { +SYNTAX: + rc= ADDR_SYNTAX; + goto DONE; + } + + if (!mail_valid_tld (sd [nsd-1])) + { + rc= ADDR_INVALID; + goto DONE; + } + + /* look at each segment of the domain name */ + for (i= nsd-2; i >= 0; i--) + { + asd= sd[i]; + if (*asd == 0) goto SYNTAX; + + flg= 0; + while (ch= *asd++ & 0x00FF) + { + if (ch >= '0' && ch <= '9') flg |= 0x01; + else if (ch >= 'a' && ch <= 'z') flg |= 0x02; + else if (ch >= 'A' && ch <= 'Z') flg |= 0x02; + else if (ch == '-') flg |= 0x04; + else goto SYNTAX; /* any other char is not allowed */ + } + + if (!(flg & 0x02)) goto SYNTAX; /* numeric only domain not allowed */ + + /* domain name segment is ok, re-join it with the following semgent */ + sd[i+1][-1]= '.'; + + /* T2D: lookup domain in spammer database and return error */ + if ((dbq= db->spamsites) != (DB_lookup *) 0 + && (*dbq) (addr, db->cd_spamsites) > 0 + ) + { + rc= ADDR_SPAMSITE; + goto DONE; + } + } + + rc= 0; +DONE: + if (dup) free (addr); + return rc; +} diff --git a/lib/ds/mail/mail0013.c b/lib/ds/mail/mail0013.c new file mode 100644 index 0000000000000000000000000000000000000000..98d9a6f22d1a817db519293485c08e1d6b18dfce --- /dev/null +++ b/lib/ds/mail/mail0013.c @@ -0,0 +1,46 @@ +/* + * FILE %ds/mail/mail0013.c + * + * verify the correctness of a toplevel domain + * + * written: 1997-11-26 + * latest update: 1997-11-26 13:07:29 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/rfc822.h> + +/* ------------------------------------------------------------------------ */ +#define N_TLD 14 +static char *TLD [N_TLD] = /* registered top level domains */ +{ + "com", "edu", "gov", "mil", "net", "org", "int", + + "firm", "store", "web", "arts", "rec", "info", "nom" /* not yet ... */ +} ; + +/* ------------------------------------------------------------------------ */ +#define N_vTLD 3 +static char *vTLD [N_vTLD] = /* virtual top level domains */ +{ + "bitnet", "arpa", "uucp" +} ; + +/* ------------------------------------------------------------------------ */ +int mail_valid_tld (char *tld) +{ + int ch; + + if (find_command (tld, TLD, 0, N_TLD) >= 0 + || (strlen (tld) == 2 + && ((ch= tld [0]) >= 'a' && ch <= 'z' + && (ch= tld [1]) >= 'a' && ch <= 'z') + ) /* country code */ + || find_command (tld, vTLD, 0, N_vTLD) >= 0 + ) return 1; + + return 0; +} diff --git a/lib/ds/mail/mail0014.c b/lib/ds/mail/mail0014.c new file mode 100644 index 0000000000000000000000000000000000000000..f2b5d43b2da825696f7ac8efd0cf98ab8d8d9120 --- /dev/null +++ b/lib/ds/mail/mail0014.c @@ -0,0 +1,69 @@ +/* + * FILE %ds/mail/mail0014.c + * + * verify a message id + * + * written: 1997-11-27 + * latest update: 1997-11-28 10:54:57 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/rfc822.h> + +/* ------------------------------------------------------------------------ */ +int mail_verify_message_id ( +char *msgid, +int dup, +int defocus, /* strip off the angle brackets */ +struct MAIL_VERIFY_DB *db) +{ + int rc= ADDR_SYNTAX; + char *local, *domain, *f[2]; + int nf; + int i; + int lng_local, lng_domain; + + if (msgid == (char *) 0 + || (dup && (msgid= strdup (msgid)) == (char *) 0) + ) return -1; + + /* message ids must have exactly one pair of angel brackets */ + if (defocus) + { + if (*msgid++ != '<' + || (i= strlen (msgid)-1) < 1 + || msgid[i] != '>' + ) + goto DONE; + + msgid [i]= 0; + } + + + to_lower (msgid); + nf= split_string (msgid, '@', f, 2); + + if (nf != 2 + || (lng_local= strlen (local= f[0])) <= 0 + || (lng_domain= strlen (domain= f[1])) <= 0 + ) + goto DONE; + + /* domain part must be valid! */ + rc= mail_verify_domain_name (domain, 0, db); + if (rc != 0) goto DONE; + + /* we are very rigid about the looks of the local part ;) */ + if (verify (local, "abcdefghijklmnopqrstuvwxyz0123456789-+./_=$")) + { + rc= ADDR_SYNTAX; + goto DONE; + } + +DONE: + if (dup) free (msgid); + return rc; +} diff --git a/lib/ds/mail/make-dos b/lib/ds/mail/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..b8912736267235909cf09e60fc676ee78052382e --- /dev/null +++ b/lib/ds/mail/make-dos @@ -0,0 +1,41 @@ +# +# FILE %ds/mail/makefile +# +# mail operations +# +# written: 1997-11-26 +# latest update: 1997-11-27 14:44:58 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : ! + mail0001.obj mail0002.obj mail0003.obj mail0004.obj mail0005.obj ! + mail0006.obj mail0007.obj mail0008.obj mail0009.obj mail0010.obj ! + mail0011.obj mail0012.obj mail0013.obj mail0014.obj + +all.test : mt1.exe mt2.exe + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +# ---------------------------------------------------------------------------- +MOD1= mail0011.obj mail0012.obj mail0013.obj mail0014.obj + +mt1.obj : mt1.c + $(cml) -DMT1 mt1.c + +mt1.exe : mt1.obj $(MOD1) + link mt1 $(MOD1),$@,\dev\nul,$(lib); + +mt2.obj : mt1.c + $(cml) -DMT2 mt1.c + +mt2.exe : mt2.obj $(MOD1) + link mt2 $(MOD1),$@,\dev\nul,$(lib); + diff --git a/lib/ds/mail/mt1.c b/lib/ds/mail/mt1.c new file mode 100644 index 0000000000000000000000000000000000000000..87a0512493f01ac4169254d62513ca1513287e08 --- /dev/null +++ b/lib/ds/mail/mt1.c @@ -0,0 +1,54 @@ +/* + * FILE %ds/mail/mt1.c + * + * test address check function + * + * written: 1997-11-26 + * latest update: 1997-11-26 13:07:29 + * + */ + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/rfc822.h> + +#ifdef MT1 +#define CHECK(s,f,db) mail_verify_address(s,f,db) +#endif + +#ifdef MT2 +#define CHECK(s,f,db) mail_verify_message_id(s,f,1,db) +#endif + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + int i, rc; + char *arg; + int done= 0; + struct MAIL_VERIFY_DB *db= (struct MAIL_VERIFY_DB *) 0; + + for (i= 1; i < argc; i++) + { + arg= argv[i]; + + rc= CHECK (arg, 1, db); + printf ("CHECK %d <- '%s'\n", rc, arg); + done++; + } + + if (!done) + { + char line [128]; + + for (;;) + { + scanf ("%s", line); + + rc= CHECK (line, 1, db); + printf ("CHECK %d <- '%s'\n", rc, line); + } + } + + return 0; +} diff --git a/lib/ds/make-dos b/lib/ds/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..ce9f97a8760324b49021f338b1dd53e8c3297759 --- /dev/null +++ b/lib/ds/make-dos @@ -0,0 +1,17 @@ +# +# FILE %ds/make-dos +# +# written: 1994-03-26 +# latest update: 1996-09-28 11:44:01 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 NLKR_TEXT +lib=c:\usr\sbr\lsbr + +all : + llink -n0 -l$(lib).lib -dds.mod + +ds.sh : + shar -c -t $@ -fmakeshar.lst diff --git a/lib/ds/makeshar.lst b/lib/ds/makeshar.lst new file mode 100644 index 0000000000000000000000000000000000000000..54d542ae729700f969cceacf96a9adbb8694b1c8 --- /dev/null +++ b/lib/ds/makeshar.lst @@ -0,0 +1,1030 @@ +# +# FILE %ds/makeshar.lst +# +# library of datastructure manipulation routines +# array, attlist, bbc, cal, codes, dyb, entity, +# ggcrypt, hytxt, hyxl, hyxp, hyxta, +# irdb, lmd, lmd5, lut, lxs, mail, mime, rdtp, rtf, streams, strings, +# tcl, tfb, url, varspace, vieos, ytree, zip +# +# written: 1995-12-12 +# latest update: 1997-11-26 13:18:39 +# +# ---------------------------------------------------------------------------- +>mkdir _bak_ftr.ned +a (dirinf).fm '(dirinf)'.fm +>ln -s '(dirinf)'.fm Contents +a makeshar.lst makeshar.lst +a make-ux make-ux +a make-dos make-dos +>ln -s make-ux Makefile +# ---------------------------------------------------------------------------- +>if [ ! -d array ] +>then +> echo 'creating subdirectory array' +> mkdir array +> mkdir array/_bak_ftr.ned +>fi +>ln -fs ../../gg array/gg +a array/(dirinf).fm array/'(dirinf)'.fm +>ln -s 'array/(dirinf).fm' array/Contents +a array/make-ux array/Makefile +a array/make-dos array/make-dos +a array/array000.c array/array000.c +a array/array001.c array/array001.c +a array/array002.c array/array002.c +a array/array003.c array/array003.c +a array/array004.c array/array004.c +a array/array005.c array/array005.c +a array/array006.c array/array006.c +a array/array007.c array/array007.c +a array/array008.c array/array008.c +a array/array009.c array/array009.c +a array/array010.c array/array010.c +a array/array011.c array/array011.c +a array/array012.c array/array012.c +a array/array013.c array/array013.c +a array/array014.c array/array014.c +# ---------------------------------------------------------------------------- +>if [ ! -d attlist ] +>then +> echo 'creating subdirectory attlist' +> mkdir attlist +> mkdir attlist/_bak_ftr.ned +>fi +>ln -fs ../../gg attlist/gg +a attlist/(dirinf).fm attlist/'(dirinf)'.fm +>ln -s 'attlist/(dirinf).fm' attlist/Contents +a attlist/make-ux attlist/Makefile +a attlist/make-dos attlist/make-dos +a attlist/attl0000.c attlist/attl0000.c +a attlist/attl0001.c attlist/attl0001.c +a attlist/attl0002.c attlist/attl0002.c +a attlist/attl0003.c attlist/attl0003.c +a attlist/attl0004.c attlist/attl0004.c +a attlist/attl0005.c attlist/attl0005.c +a attlist/attl0006.c attlist/attl0006.c +# ---------------------------------------------------------------------------- +>if [ ! -d bbc ] +>then +> echo 'creating subdirectory bbc' +> mkdir bbc +> mkdir bbc/_bak_ftr.ned +>fi +>ln -fs ../../gg bbc/gg +a bbc/(dirinf).fm bbc/'(dirinf)'.fm +a bbc/make-ux bbc/make-ux +a bbc/make-dos bbc/make-dos +>ln -fs make-ux bbc/Makefile +a bbc/bbcd.doc bbc/bbcd.doc +a bbc/bbc.c bbc/bbc.c +a bbc/bbct1.c bbc/bbct1.c +# +a bbc/bbc01.c bbc/bbc01.c +a bbc/bbc02.c bbc/bbc02.c +a bbc/bbc03.c bbc/bbc03.c +a bbc/bbc04.c bbc/bbc04.c +a bbc/bbc05.c bbc/bbc05.c +a bbc/bbc06.c bbc/bbc06.c +a bbc/bbc07.c bbc/bbc07.c +a bbc/bbc08.c bbc/bbc08.c +a bbc/bbc09.c bbc/bbc09.c +a bbc/bbc10.c bbc/bbc10.c +a bbc/bbc11.c bbc/bbc11.c +a bbc/bbc12.c bbc/bbc12.c +a bbc/bbc13.c bbc/bbc13.c +a bbc/bbc14.c bbc/bbc14.c +a bbc/bbc15.c bbc/bbc15.c +# ---------------------------------------------------------------------------- +>if [ ! -d cal ] +>then +> echo 'creating subdirectory cal' +> mkdir cal +> mkdir cal/_bak_ftr.ned +>fi +>ln -fs ../../gg cal/gg +a cal/(dirinf).fm cal/'(dirinf)'.fm +a cal/make-ux cal/Makefile +a cal/make-dos cal/make-dos +a cal/cal01.c cal/cal01.c +a cal/cal02.c cal/cal02.c +a cal/cal03.c cal/cal03.c +a cal/cal04.c cal/cal04.c +a cal/cal05.c cal/cal05.c +a cal/cal06.c cal/cal06.c +a cal/cal07.c cal/cal07.c +a cal/cal08.c cal/cal08.c +a cal/cal09.c cal/cal09.c +a cal/cal10.c cal/cal10.c +# +a cal/dt001.c cal/dt001.c +a cal/dt001b.c cal/dt001b.c +a cal/dt001t.c cal/dt001t.c +a cal/dt002.c cal/dt002.c +a cal/dt002b.c cal/dt002b.c +a cal/dt003.c cal/dt003.c +a cal/dt004.c cal/dt004.c +a cal/dt006.c cal/dt006.c +a cal/dt007.c cal/dt007.c +a cal/dt008.c cal/dt008.c +a cal/dt010.c cal/dt010.c +a cal/dt011.c cal/dt011.c +a cal/dt011t.c cal/dt011t.c +a cal/dt014a.c cal/dt014a.c +a cal/dt014b.c cal/dt014b.c +a cal/dt015a.c cal/dt015a.c +a cal/dt021.c cal/dt021.c +a cal/dt022.c cal/dt022.c +a cal/dt023.c cal/dt023.c +a cal/dt024.c cal/dt024.c +a cal/dt025.c cal/dt025.c +a cal/dt031.c cal/dt031.c +a cal/dt032.c cal/dt032.c +a cal/dt033.c cal/dt033.c +a cal/dt034.c cal/dt034.c +a cal/dt035.c cal/dt035.c +a cal/dt036.c cal/dt036.c +a cal/dt037.c cal/dt037.c +a cal/dt038.c cal/dt038.c +a cal/dt041.c cal/dt041.c +a cal/dt042.c cal/dt042.c +# ---------------------------------------------------------------------------- +>if [ ! -d codes ] +>then +> echo 'creating subdirectory codes' +> mkdir codes +> mkdir codes/_bak_ftr.ned +>fi +>ln -fs ../../gg codes/gg +# codes/readme codes/README +a codes/(dirinf).fm codes/Files +a codes/make-ux codes/Makefile +a codes/make-dos codes/make-dos +# +a codes/codeconv.c codes/codeconv.c +a codes/codetbl.c codes/codetbl.c +a codes/codes.c codes/codes.c +a codes/cst006.c codes/cst006.c +a codes/ebcdic.c codes/ebcdic.c +a codes/xmerge.c codes/xmerge.c +# +a codes/cs000.c codes/cs000.c +a codes/cs001.c codes/cs001.c +a codes/cs002.c codes/cs002.c +a codes/cs003.c codes/cs003.c +a codes/cs004.c codes/cs004.c +a codes/cs005.c codes/cs005.c +a codes/cs006.c codes/cs006.c +a codes/cs007.c codes/cs007.c +a codes/cs008.c codes/cs008.c +a codes/cs009.c codes/cs009.c +a codes/cs010.c codes/cs010.c +a codes/cs011.c codes/cs011.c +a codes/cs012.c codes/cs012.c +a codes/cs101.c codes/cs101.c +a codes/cs102.c codes/cs102.c +a codes/cs103.c codes/cs103.c +a codes/cs104.c codes/cs104.c +a codes/cs105.c codes/cs105.c +a codes/cs106.c codes/cs106.c +a codes/cs107.c codes/cs107.c +a codes/cs108.c codes/cs108.c +a codes/cs109.c codes/cs109.c +a codes/cs110.c codes/cs110.c +a codes/cs201.c codes/cs201.c +a codes/cs202.c codes/cs202.c +a codes/cs203.c codes/cs203.c +a codes/cs204.c codes/cs204.c +a codes/cs205.c codes/cs205.c +a codes/cs206.c codes/cs206.c +a codes/cs207.c codes/cs207.c +# ---------------------------------------------------------------------------- +>if [ ! -d dyb ] +>then +> echo 'creating subdirectory dyb' +> mkdir dyb +> mkdir dyb/_bak_ftr.ned +>fi +>ln -fs ../../gg dyb/gg +a dyb/(dirinf).fm dyb/'(dirinf)'.fm +a dyb/make-ux dyb/Makefile +a dyb/make-dos dyb/make-dos +a dyb/dyb_0000.c dyb/dyb_0000.c +a dyb/dyb_0001.c dyb/dyb_0001.c +a dyb/dyb_0002.c dyb/dyb_0002.c +a dyb/dyb_0003.c dyb/dyb_0003.c +a dyb/dyb_0004.c dyb/dyb_0004.c +a dyb/dyb_0005.c dyb/dyb_0005.c +a dyb/dyb_0006.c dyb/dyb_0006.c +a dyb/dyb_0007.c dyb/dyb_0007.c +a dyb/dyb_0008.c dyb/dyb_0008.c +a dyb/dyb_0010.c dyb/dyb_0010.c +a dyb/dyb_0011.c dyb/dyb_0011.c +# ---------------------------------------------------------------------------- +>if [ ! -d entity ] +>then +> echo 'creating subdirectory entity' +> mkdir entity +> mkdir entity/_bak_ftr.ned +>fi +>ln -fs ../../gg entity/gg +a entity/(dirinf).fm entity/'(dirinf)'.fm +a entity/make-ux entity/Makefile +a entity/make-dos entity/make-dos +a entity/ent_0000.c entity/ent_0000.c +a entity/ent_0001.c entity/ent_0001.c +a entity/ent_0002.c entity/ent_0002.c +a entity/ent_0003.c entity/ent_0003.c +a entity/ent_0004.c entity/ent_0004.c +a entity/ent_0005.c entity/ent_0005.c +# ---------------------------------------------------------------------------- +>if [ ! -d ggcrypt ] +>then +> echo 'creating subdirectory ggcrypt' +> mkdir ggcrypt +> mkdir ggcrypt/_bak_ftr.ned +>fi +>ln -fs ../../gg ggcrypt/gg +>ln -fs ../../contrib ggcrypt/contrib +a ggcrypt/(dirinf).fm ggcrypt/'(dirinf)'.fm +a ggcrypt/make-ux ggcrypt/Makefile +a ggcrypt/make-dos ggcrypt/make-dos +a ggcrypt/ggcryp02.c ggcrypt/ggcryp02.c +a ggcrypt/ggcryp04.c ggcrypt/ggcryp04.c +a ggcrypt/ggcryp05.c ggcrypt/ggcryp05.c +a ggcrypt/ggcryp06.c ggcrypt/ggcryp06.c +a ggcrypt/ggcryp07.c ggcrypt/ggcryp07.c +a ggcrypt/ggcryp08.c ggcrypt/ggcryp08.c +a ggcrypt/ggcryp09.c ggcrypt/ggcryp09.c +a ggcrypt/ggcryp10.c ggcrypt/ggcryp10.c +a ggcrypt/ggcryp11.c ggcrypt/ggcryp11.c +a ggcrypt/ggcryp12.c ggcrypt/ggcryp12.c +a ggcrypt/ggcryp13.c ggcrypt/ggcryp13.c +a ggcrypt/ggcryp14.c ggcrypt/ggcryp14.c +a ggcrypt/ggcryp15.c ggcrypt/ggcryp15.c +a ggcrypt/ggcryp16.c ggcrypt/ggcryp16.c +a ggcrypt/ggcryp17.c ggcrypt/ggcryp17.c +a ggcrypt/ggcryp18.c ggcrypt/ggcryp18.c +a ggcrypt/ggcryp19.c ggcrypt/ggcryp19.c +a ggcrypt/ggcryp20.c ggcrypt/ggcryp20.c +# ---------------------------------------------------------------------------- +>if [ ! -d hytxt ] +>then +> echo 'creating subdirectory hytxt' +> mkdir hytxt +> mkdir hytxt/_bak_ftr.ned +>fi +>ln -fs ../../gg hytxt/gg +>ln -fs ../../contrib hytxt/contrib +a hytxt/(dirinf).fm hytxt/'(dirinf)'.fm +a hytxt/make-ux hytxt/Makefile +a hytxt/make-dos hytxt/make-dos +a hytxt/hytxt001.c hytxt/hytxt001.c +a hytxt/hytxt002.c hytxt/hytxt002.c +a hytxt/hytxt003.c hytxt/hytxt003.c +a hytxt/hytxt004.c hytxt/hytxt004.c +a hytxt/hytxt005.c hytxt/hytxt005.c +a hytxt/hytxt006.c hytxt/hytxt006.c +a hytxt/hytxt007.c hytxt/hytxt007.c +a hytxt/hytxt008.c hytxt/hytxt008.c +a hytxt/hytxt009.c hytxt/hytxt009.c +a hytxt/hytxt010.c hytxt/hytxt010.c +a hytxt/hytxt011.c hytxt/hytxt011.c +a hytxt/hytxt012.c hytxt/hytxt012.c +a hytxt/hytxt013.c hytxt/hytxt013.c +a hytxt/hytxt014.c hytxt/hytxt014.c +a hytxt/hytxt015.c hytxt/hytxt015.c +a hytxt/hytxt016.c hytxt/hytxt016.c +a hytxt/hytxt017.c hytxt/hytxt017.c +a hytxt/hytxt018.c hytxt/hytxt018.c +a hytxt/hytxt019.c hytxt/hytxt019.c +a hytxt/hytxt020.c hytxt/hytxt020.c +a hytxt/hytxt021.c hytxt/hytxt021.c +a hytxt/hytxt022.c hytxt/hytxt022.c +a hytxt/hytxt023.c hytxt/hytxt023.c +a hytxt/hytxt024.c hytxt/hytxt024.c +a hytxt/hytxt025.c hytxt/hytxt025.c +a hytxt/hytxt026.c hytxt/hytxt026.c +a hytxt/hytxt027.c hytxt/hytxt027.c +a hytxt/hytxt028.c hytxt/hytxt028.c +a hytxt/hytxt029.c hytxt/hytxt029.c +a hytxt/hytxt030.c hytxt/hytxt030.c +a hytxt/hytxt031.c hytxt/hytxt031.c +a hytxt/hytxt032.c hytxt/hytxt032.c +a hytxt/hytxt033.c hytxt/hytxt033.c +a hytxt/hytxt034.c hytxt/hytxt034.c +a hytxt/hytxt035.c hytxt/hytxt035.c +a hytxt/hytxt036.c hytxt/hytxt036.c +a hytxt/hytxt037.c hytxt/hytxt037.c +a hytxt/hytxt038.c hytxt/hytxt038.c +# ---------------------------------------------------------------------------- +>if [ ! -d hyxl ] +>then +> echo 'creating subdirectory hyxl' +> mkdir hyxl +> mkdir hyxl/_bak_ftr.ned +>fi +>ln -fs ../../gg hyxl/gg +a hyxl/(dirinf).fm hyxl/'(dirinf)'.fm +a hyxl/make-ux hyxl/Makefile +a hyxl/make-dos hyxl/make-dos +a hyxl/hyxl0001.c hyxl/hyxl0001.c +a hyxl/hyxl0002.c hyxl/hyxl0002.c +a hyxl/hyxl0003.c hyxl/hyxl0003.c +a hyxl/hyxl0004.c hyxl/hyxl0004.c +a hyxl/hyxl0005.c hyxl/hyxl0005.c +a hyxl/hyxl0006.c hyxl/hyxl0006.c +a hyxl/hyxl0007.c hyxl/hyxl0007.c +a hyxl/hyxl0008.c hyxl/hyxl0008.c +a hyxl/hyxl0009.c hyxl/hyxl0009.c +a hyxl/hyxl0010.c hyxl/hyxl0010.c +a hyxl/hyxl0011.c hyxl/hyxl0011.c +a hyxl/hyxl0012.c hyxl/hyxl0012.c +# +a hyxl/hyxl0101.c hyxl/hyxl0101.c +# ---------------------------------------------------------------------------- +>if [ ! -d hyxp ] +>then +> echo 'creating subdirectory hyxp' +> mkdir hyxp +> mkdir hyxp/_bak_ftr.ned +>fi +>ln -fs ../../gg hyxp/gg +a hyxp/(dirinf).fm hyxp/'(dirinf)'.fm +a hyxp/make-ux hyxp/Makefile +a hyxp/make-dos hyxp/make-dos +a hyxp/hyxp0001.c hyxp/hyxp0001.c +a hyxp/hyxp0002.c hyxp/hyxp0002.c +a hyxp/hyxp0003.c hyxp/hyxp0003.c +a hyxp/hyxp0004.c hyxp/hyxp0004.c +a hyxp/hyxp0005.c hyxp/hyxp0005.c +a hyxp/hyxp0006.c hyxp/hyxp0006.c +a hyxp/hyxp0007.c hyxp/hyxp0007.c +a hyxp/hyxp0008.c hyxp/hyxp0008.c +a hyxp/hyxp0009.c hyxp/hyxp0009.c +a hyxp/hyxp0010.c hyxp/hyxp0010.c +a hyxp/hyxp0011.c hyxp/hyxp0011.c +a hyxp/hyxp0012.c hyxp/hyxp0012.c +a hyxp/hyxp0013.c hyxp/hyxp0013.c +a hyxp/hyxp0014.c hyxp/hyxp0014.c +a hyxp/hyxp0015.c hyxp/hyxp0015.c +a hyxp/hyxp0016.c hyxp/hyxp0016.c +a hyxp/hyxp0017.c hyxp/hyxp0017.c +a hyxp/hyxp0018.c hyxp/hyxp0018.c +a hyxp/hyxp0019.c hyxp/hyxp0019.c +a hyxp/hyxp0020.c hyxp/hyxp0020.c +a hyxp/hyxp0021.c hyxp/hyxp0021.c +a hyxp/hyxp0022.c hyxp/hyxp0022.c +a hyxp/hyxp0023.c hyxp/hyxp0023.c +a hyxp/hyxp0024.c hyxp/hyxp0024.c +a hyxp/hyxp0025.c hyxp/hyxp0025.c +a hyxp/hyxp0026.c hyxp/hyxp0026.c +a hyxp/hyxp0027.c hyxp/hyxp0027.c +a hyxp/hyxp0028.c hyxp/hyxp0028.c +a hyxp/hyxp0029.c hyxp/hyxp0029.c +a hyxp/hyxp0030.c hyxp/hyxp0030.c +a hyxp/hyxp0031.c hyxp/hyxp0031.c +a hyxp/hyxp0032.c hyxp/hyxp0032.c +a hyxp/hyxp0033.c hyxp/hyxp0033.c +a hyxp/hyxp0034.c hyxp/hyxp0034.c +a hyxp/hyxp0035.c hyxp/hyxp0035.c +# ---------------------------------------------------------------------------- +>if [ ! -d hyxta ] +>then +> echo 'creating subdirectory hyxta' +> mkdir hyxta +> mkdir hyxta/_bak_ftr.ned +>fi +>ln -fs ../../gg hyxta/gg +a hyxta/(dirinf).fm hyxta/'(dirinf)'.fm +a hyxta/make-ux hyxta/Makefile +a hyxta/make-dos hyxta/make-dos +a hyxta/hyxta001.c hyxta/hyxta001.c +a hyxta/hyxta002.c hyxta/hyxta002.c +a hyxta/hyxta003.c hyxta/hyxta003.c +a hyxta/hyxta004.c hyxta/hyxta004.c +a hyxta/hyxta005.c hyxta/hyxta005.c +a hyxta/hyxta006.c hyxta/hyxta006.c +a hyxta/hyxta007.c hyxta/hyxta007.c +a hyxta/hyxta008.c hyxta/hyxta008.c +a hyxta/hyxta012.c hyxta/hyxta012.c +a hyxta/hyxta015.c hyxta/hyxta015.c +a hyxta/hyxta020.c hyxta/hyxta020.c +a hyxta/hyxta101.c hyxta/hyxta101.c +a hyxta/hyxta102.c hyxta/hyxta102.c +a hyxta/hyxtax01.c hyxta/hyxtax01.c +# ---------------------------------------------------------------------------- +>if [ ! -d irdb ] +>then +> echo 'creating subdirectory irdb' +> mkdir irdb +> mkdir irdb/_bak_ftr.ned +>fi +>ln -fs ../../gg irdb/gg +a irdb/(dirinf).fm irdb/'(dirinf)'.fm +a irdb/make-ux irdb/Makefile +a irdb/make-dos irdb/make-dos +a irdb/irdb0000.c irdb/irdb0000.c +a irdb/irdb0001.c irdb/irdb0001.c +a irdb/irdb0002.c irdb/irdb0002.c +a irdb/irdb0003.c irdb/irdb0003.c +a irdb/irdb0004.c irdb/irdb0004.c +a irdb/irdb0005.c irdb/irdb0005.c +a irdb/irdb0006.c irdb/irdb0006.c +a irdb/irdb0007.c irdb/irdb0007.c +a irdb/irdb0008.c irdb/irdb0008.c +a irdb/irdb0009.c irdb/irdb0009.c +a irdb/irdb0010.c irdb/irdb0010.c +a irdb/irdb0011.c irdb/irdb0011.c +a irdb/irdb0012.c irdb/irdb0012.c +a irdb/irdb0013.c irdb/irdb0013.c +a irdb/irdb0014.c irdb/irdb0014.c +a irdb/irdb0015.c irdb/irdb0015.c +a irdb/irdb0016.c irdb/irdb0016.c +a irdb/irdb0017.c irdb/irdb0017.c +a irdb/irdb0018.c irdb/irdb0018.c +a irdb/irdb0019.c irdb/irdb0019.c +a irdb/irdb0020.c irdb/irdb0020.c +a irdb/irdb0021.c irdb/irdb0021.c +a irdb/irdb0022.c irdb/irdb0022.c +a irdb/irdb0023.c irdb/irdb0023.c +a irdb/irdb0024.c irdb/irdb0024.c +a irdb/irdb0025.c irdb/irdb0025.c +a irdb/irdb0026.c irdb/irdb0026.c +a irdb/irdb0027.c irdb/irdb0027.c +a irdb/irdb0028.c irdb/irdb0028.c +a irdb/irdb0101.c irdb/irdb0101.c +a irdb/irdb0102.c irdb/irdb0102.c +a irdb/irdb0103.c irdb/irdb0103.c +a irdb/irdb0104.c irdb/irdb0104.c +a irdb/irdb0105.c irdb/irdb0105.c +a irdb/irdb0106.c irdb/irdb0106.c +a irdb/irdb0107.c irdb/irdb0107.c +a irdb/irdb0112.c irdb/irdb0112.c +a irdb/irdb0116.c irdb/irdb0116.c +a irdb/irdb0118.c irdb/irdb0118.c +a irdb/irdb0119.c irdb/irdb0119.c +a irdb/irdb0120.c irdb/irdb0120.c +a irdb/it1.c irdb/it1.c +# ---------------------------------------------------------------------------- +>if [ ! -d lmd ] +>then +> echo 'creating subdirectory lmd' +> mkdir lmd +> mkdir lmd/_bak_ftr.ned +>fi +>ln -fs ../../gg lmd/gg +a lmd/(dirinf).fm lmd/'(dirinf)'.fm +a lmd/make-ux lmd/Makefile +a lmd/make-dos lmd/make-dos +a lmd/nl_00001.c lmd/nl_00001.c +a lmd/nl_00002.c lmd/nl_00002.c +a lmd/nl_00004.c lmd/nl_00004.c +a lmd/nl_00009.c lmd/nl_00009.c +a lmd/nl_00101.c lmd/nl_00101.c +a lmd/nl_00102.c lmd/nl_00102.c +a lmd/nl_00104.c lmd/nl_00104.c +a lmd/nl_00105.c lmd/nl_00105.c +a lmd/nl_00106.c lmd/nl_00106.c +a lmd/nl_00107.c lmd/nl_00107.c +a lmd/nl_00108.c lmd/nl_00108.c +a lmd/nl_00109.c lmd/nl_00109.c +a lmd/nl_00111.c lmd/nl_00111.c +a lmd/nl_00112.c lmd/nl_00112.c +a lmd/nl_00113.c lmd/nl_00113.c +a lmd/nl_00114.c lmd/nl_00114.c +a lmd/nl_00115.c lmd/nl_00115.c +a lmd/nl_00116.c lmd/nl_00116.c +a lmd/nl_00117.c lmd/nl_00117.c +a lmd/nl_00118.c lmd/nl_00118.c +a lmd/nl_00119.c lmd/nl_00119.c +a lmd/nl_00120.c lmd/nl_00120.c +a lmd/nl_00121.c lmd/nl_00121.c +a lmd/nl_00122.c lmd/nl_00122.c +a lmd/nl_00123.c lmd/nl_00123.c +a lmd/nl_00124.c lmd/nl_00124.c +a lmd/nl_00125.c lmd/nl_00125.c +a lmd/nl_00126.c lmd/nl_00126.c +a lmd/nl_00127.c lmd/nl_00127.c +a lmd/nl_00128.c lmd/nl_00128.c +a lmd/nl_00129.c lmd/nl_00129.c +a lmd/nl_00130.c lmd/nl_00130.c +a lmd/nl_00131.c lmd/nl_00131.c +a lmd/nl_00132.c lmd/nl_00132.c +a lmd/nl_00133.c lmd/nl_00133.c +a lmd/nl_00134.c lmd/nl_00134.c +a lmd/nl_00135.c lmd/nl_00135.c +a lmd/nl_00136.c lmd/nl_00136.c +a lmd/nl_00137.c lmd/nl_00137.c +a lmd/nl_00138.c lmd/nl_00138.c +a lmd/nl_00139.c lmd/nl_00139.c +a lmd/nl_00201.c lmd/nl_00201.c +a lmd/nl_00301.c lmd/nl_00301.c +a lmd/nl_00302.c lmd/nl_00302.c +a lmd/nl_00303.c lmd/nl_00303.c +a lmd/nl_00304.c lmd/nl_00304.c +a lmd/nl_00305.c lmd/nl_00305.c +a lmd/nl_00306.c lmd/nl_00306.c +a lmd/nl_00401.c lmd/nl_00401.c +a lmd/nl_00402.c lmd/nl_00402.c +a lmd/nl_00403.c lmd/nl_00403.c +a lmd/nl_00404.c lmd/nl_00404.c +a lmd/nl_00405.c lmd/nl_00405.c +a lmd/nl_00407.c lmd/nl_00407.c +a lmd/nl_00408.c lmd/nl_00408.c +a lmd/nl_00409.c lmd/nl_00409.c +a lmd/nl_00410.c lmd/nl_00410.c +a lmd/nl_00411.c lmd/nl_00411.c +a lmd/nl_00500.c lmd/nl_00500.c +a lmd/nl_00501.c lmd/nl_00501.c +a lmd/nl_00502.c lmd/nl_00502.c +a lmd/nl_00503.c lmd/nl_00503.c +a lmd/nl_00504.c lmd/nl_00504.c +a lmd/nl_00510.c lmd/nl_00510.c +a lmd/nl_00511.c lmd/nl_00511.c +a lmd/nl_00512.c lmd/nl_00512.c +a lmd/nl_00514.c lmd/nl_00514.c +a lmd/nl_00600.c lmd/nl_00600.c +a lmd/nl_00601.c lmd/nl_00601.c +a lmd/nl_00602.c lmd/nl_00602.c +a lmd/nl_00603.c lmd/nl_00603.c +a lmd/nl_00604.c lmd/nl_00604.c +a lmd/nl_00605.c lmd/nl_00605.c +a lmd/nl_00606.c lmd/nl_00606.c +a lmd/nl_00607.c lmd/nl_00607.c +a lmd/nl_00608.c lmd/nl_00608.c +a lmd/nl_00609.c lmd/nl_00609.c +a lmd/nl_00610.c lmd/nl_00610.c +a lmd/nl_01001.c lmd/nl_01001.c +a lmd/rdtoken.c lmd/rdtoken.c +# ---------------------------------------------------------------------------- +>if [ ! -d lmd5 ] +>then +> echo 'creating subdirectory lmd5' +> mkdir lmd5 +> mkdir lmd5/_bak_ftr.ned +>fi +>ln -fs ../../gg lmd5/gg +a lmd5/(dirinf).fm lmd5/'(dirinf)'.fm +a lmd5/make-ux lmd5/Makefile +a lmd5/make-dos lmd5/make-dos +a lmd5/lm5.c lmd5/lm5.c +a lmd5/lmd5.doc lmd5/lmd5.doc +a lmd5/lmd50000.c lmd5/lmd50000.c +a lmd5/lmd50001.c lmd5/lmd50001.c +a lmd5/lmd50002.c lmd5/lmd50002.c +a lmd5/lmd50003.c lmd5/lmd50003.c +a lmd5/lmd50004.c lmd5/lmd50004.c +a lmd5/lmd50005.c lmd5/lmd50005.c +a lmd5/test.doc lmd5/test.doc +# ---------------------------------------------------------------------------- +>if [ ! -d lut ] +>then +> echo 'creating subdirectory lut' +> mkdir lut +> mkdir lut/_bak_ftr.ned +>fi +>ln -fs ../../gg lut/gg +a lut/(dirinf).fm lut/'(dirinf)'.fm +a lut/make-ux lut/Makefile +a lut/make-dos lut/make-dos +a lut/lut_0001.c lut/lut_0001.c +a lut/lut_0002.c lut/lut_0002.c +a lut/lut_0004.c lut/lut_0004.c +a lut/lut_0007.c lut/lut_0007.c +a lut/lut_0008.c lut/lut_0008.c +a lut/lut_0005.c lut/lut_0005.c +a lut/lut_0009.c lut/lut_0009.c +a lut/lut_0010.c lut/lut_0010.c +a lut/lut_0011.c lut/lut_0011.c +a lut/lut_0012.c lut/lut_0012.c +a lut/lut_0013.c lut/lut_0013.c +a lut/lut_0014.c lut/lut_0014.c +# ---------------------------------------------------------------------------- +>if [ ! -d lxs ] +>then +> echo 'creating subdirectory lxs' +> mkdir lxs +> mkdir lxs/_bak_ftr.ned +>fi +>ln -fs ../../gg lxs/gg +a lxs/(dirinf).fm lxs/'(dirinf)'.fm +a lxs/make-ux lxs/Makefile +a lxs/make-dos lxs/make-dos +a lxs/lxs_0000.c lxs/lxs_0000.c +a lxs/lxs_0001.c lxs/lxs_0001.c +# +# ---------------------------------------------------------------------------- +>if [ ! -d mail ] +>then +> echo 'creating subdirectory mail' +> mkdir mail +> mkdir mail/_bak_ftr.ned +>fi +>ln -fs ../../gg mail/gg +a mail/(dirinf).fm mail/'(dirinf)'.fm +a mail/make-ux mail/Makefile +a mail/make-dos mail/make-dos +a mail/mt1.c mail/mt1.c +# +a mail/mail0000.c mail/mail0000.c +a mail/mail0001.c mail/mail0001.c +a mail/mail0002.c mail/mail0002.c +a mail/mail0003.c mail/mail0003.c +a mail/mail0004.c mail/mail0004.c +a mail/mail0005.c mail/mail0005.c +a mail/mail0006.c mail/mail0006.c +a mail/mail0007.c mail/mail0007.c +a mail/mail0008.c mail/mail0008.c +a mail/mail0009.c mail/mail0009.c +a mail/mail0010.c mail/mail0010.c +a mail/mail0011.c mail/mail0011.c +a mail/mail0012.c mail/mail0012.c +a mail/mail0013.c mail/mail0013.c +a mail/mail0014.c mail/mail0014.c +# +# ---------------------------------------------------------------------------- +>if [ ! -d mime ] +>then +> echo 'creating subdirectory mime' +> mkdir mime +> mkdir mime/_bak_ftr.ned +>fi +>ln -fs ../../gg mime/gg +a mime/(dirinf).fm mime/'(dirinf)'.fm +a mime/make-ux mime/Makefile +a mime/make-dos mime/make-dos +a mime/mime0000.c mime/mime0000.c +a mime/mime0001.c mime/mime0001.c +# +# ---------------------------------------------------------------------------- +>if [ ! -d rdtp ] +>then +> echo 'creating subdirectory rdtp' +> mkdir rdtp +> mkdir rdtp/_bak_ftr.ned +>fi +>ln -fs ../../gg rdtp/gg +a rdtp/(dirinf).fm rdtp/'(dirinf)'.fm +a rdtp/make-ux rdtp/Makefile +a rdtp/make-dos rdtp/make-dos +a rdtp/rt1.c rdtp/rt1.c +a rdtp/rdtp0001.c rdtp/rdtp0001.c +a rdtp/rdtp0002.c rdtp/rdtp0002.c +a rdtp/rdtp0003.c rdtp/rdtp0003.c +a rdtp/rdtp0004.c rdtp/rdtp0004.c +a rdtp/rdtp0005.c rdtp/rdtp0005.c +a rdtp/rdtp0101.c rdtp/rdtp0101.c +a rdtp/rdtp0102.c rdtp/rdtp0102.c +a rdtp/rdtp0103.c rdtp/rdtp0103.c +a rdtp/rdtp0104.c rdtp/rdtp0104.c +a rdtp/rdtp0105.c rdtp/rdtp0105.c +a rdtp/rdtp0106.c rdtp/rdtp0106.c +a rdtp/rdtp0107.c rdtp/rdtp0107.c +a rdtp/rdtp0108.c rdtp/rdtp0108.c +a rdtp/rdtp0109.c rdtp/rdtp0109.c +a rdtp/rdtp0110.c rdtp/rdtp0110.c +a rdtp/rdtp0111.c rdtp/rdtp0111.c +a rdtp/rdtp0112.c rdtp/rdtp0112.c +a rdtp/rdtp0113.c rdtp/rdtp0113.c +a rdtp/rdtp0114.c rdtp/rdtp0114.c +a rdtp/rdtp0115.c rdtp/rdtp0115.c +a rdtp/rdtp0116.c rdtp/rdtp0116.c +a rdtp/rdtp0201.c rdtp/rdtp0201.c +a rdtp/rdtp0202.c rdtp/rdtp0202.c +a rdtp/rdtp0203.c rdtp/rdtp0203.c +a rdtp/rdtp0204.c rdtp/rdtp0204.c +a rdtp/rdtp0205.c rdtp/rdtp0205.c +a rdtp/rdtp0206.c rdtp/rdtp0206.c +a rdtp/rdtp0207.c rdtp/rdtp0207.c +a rdtp/rdtp0204.c rdtp/rdtp0208.c +a rdtp/rdtp0301.c rdtp/rdtp0301.c +a rdtp/rdtp0302.c rdtp/rdtp0302.c +a rdtp/rdtp0303.c rdtp/rdtp0303.c +a rdtp/rdtp0304.c rdtp/rdtp0304.c +a rdtp/rdtp0305.c rdtp/rdtp0305.c +a rdtp/rdtp0306.c rdtp/rdtp0306.c +a rdtp/rdtp0307.c rdtp/rdtp0307.c +a rdtp/rdtp0308.c rdtp/rdtp0308.c +a rdtp/rdtp0309.c rdtp/rdtp0309.c +a rdtp/rdtp0310.c rdtp/rdtp0310.c +a rdtp/rdtp0311.c rdtp/rdtp0311.c +a rdtp/rdtp0312.c rdtp/rdtp0312.c +a rdtp/rdtp0313.c rdtp/rdtp0313.c +a rdtp/rdtp0314.c rdtp/rdtp0314.c +a rdtp/rdtp0315.c rdtp/rdtp0315.c +a rdtp/rdtp0316.c rdtp/rdtp0316.c +a rdtp/rdtp0317.c rdtp/rdtp0317.c +a rdtp/rdtp0318.c rdtp/rdtp0318.c +a rdtp/rdtp0319.c rdtp/rdtp0319.c +a rdtp/rdtp0320.c rdtp/rdtp0320.c +a rdtp/rdtp0321.c rdtp/rdtp0321.c +a rdtp/rdtp0322.c rdtp/rdtp0322.c +# +a rdtp/rdtp0341.c rdtp/rdtp0341.c +a rdtp/rdtp0342.c rdtp/rdtp0342.c +a rdtp/rdtp0343.c rdtp/rdtp0343.c +a rdtp/rdtp0344.c rdtp/rdtp0344.c +a rdtp/rdtp0345.c rdtp/rdtp0345.c +a rdtp/rdtp0346.c rdtp/rdtp0346.c +a rdtp/rdtp0347.c rdtp/rdtp0347.c +a rdtp/rdtp0348.c rdtp/rdtp0348.c +# +a rdtp/rdtp0403.c rdtp/rdtp0403.c +a rdtp/rdtp0413.c rdtp/rdtp0413.c +a rdtp/rdtp0421.c rdtp/rdtp0421.c +a rdtp/rdtp0422.c rdtp/rdtp0422.c +a rdtp/rdtp0423.c rdtp/rdtp0423.c +# ---------------------------------------------------------------------------- +>if [ ! -d rtf ] +>then +> echo 'creating subdirectory rtf' +> mkdir rtf +> mkdir rtf/_bak_ftr.ned +>fi +>ln -fs ../../gg rtf/gg +a rtf/(dirinf).fm rtf/'(dirinf)'.fm +a rtf/make-ux rtf/Makefile +a rtf/make-dos rtf/make-dos +a rtf/rtf00.c rtf/rtf00.c +a rtf/rtf01.c rtf/rtf01.c +# ---------------------------------------------------------------------------- +>if [ ! -d streams ] +>then +> echo 'creating subdirectory streams' +> mkdir streams +> mkdir streams/_bak_ftr.ned +>fi +>ln -fs ../../gg streams/gg +a streams/(dirinf).fm streams/'(dirinf)'.fm +a streams/make-ux streams/make-ux +a streams/make-dos streams/make-dos +>ln -s '(dirinf).fm' streams/Contents +>ln -s make-ux streams/Makefile +a streams/strm_f01.c streams/strm_f01.c +a streams/strm_f02.c streams/strm_f02.c +a streams/strm_f03.c streams/strm_f03.c +# ---------------------------------------------------------------------------- +>if [ ! -d strings ] +>then +> echo 'creating subdirectory strings' +> mkdir strings +> mkdir strings/_bak_ftr.ned +>fi +>ln -fs ../../gg strings/gg +a strings/(dirinf).fm strings/'(dirinf)'.fm +a strings/make-ux strings/Makefile +a strings/make-dos strings/make-dos +a strings/strings.c strings/strings.c +a strings/str_0001.c strings/str_0001.c +a strings/str_0002.c strings/str_0002.c +a strings/str_0003.c strings/str_0003.c +a strings/str_0004.c strings/str_0004.c +a strings/str_0005.c strings/str_0005.c +a strings/str_0006.c strings/str_0006.c +a strings/str_0007.c strings/str_0007.c +a strings/str_0008.c strings/str_0008.c +a strings/str_0009.c strings/str_0009.c +a strings/str_0010.c strings/str_0010.c +a strings/str_0011.c strings/str_0011.c +a strings/str_0012.c strings/str_0012.c +a strings/str_0013.c strings/str_0013.c +a strings/str_0014.c strings/str_0014.c +a strings/str_0015.c strings/str_0015.c +a strings/str_0016.c strings/str_0016.c +a strings/str_0017.c strings/str_0017.c +a strings/str_0018.c strings/str_0018.c +a strings/str_0019.c strings/str_0019.c +a strings/str_0020.c strings/str_0020.c +a strings/str_0021.c strings/str_0021.c +a strings/str_0022.c strings/str_0022.c +a strings/str_0023.c strings/str_0023.c +a strings/str_0024.c strings/str_0024.c +a strings/str_0025.c strings/str_0025.c +a strings/str_0026.c strings/str_0026.c +a strings/str_0027.c strings/str_0027.c +a strings/str_0028.c strings/str_0028.c +a strings/str_0029.c strings/str_0029.c +a strings/str_0030.c strings/str_0030.c +a strings/str_0031.c strings/str_0031.c +a strings/str_0032.c strings/str_0032.c +a strings/str_0033.c strings/str_0033.c +a strings/str_0034.c strings/str_0034.c +a strings/str_0035.c strings/str_0035.c +a strings/str_0036.c strings/str_0036.c +a strings/str_0037.c strings/str_0037.c +a strings/str_0038.c strings/str_0038.c +a strings/str_0039.c strings/str_0039.c +a strings/str_0040.c strings/str_0040.c +a strings/str_0041.c strings/str_0041.c +a strings/str_0041.tbl strings/str_0041.tbl +a strings/str_0042.c strings/str_0042.c +a strings/str_0042.tbl strings/str_0042.tbl +a strings/str_0043.c strings/str_0043.c +a strings/str_0044.c strings/str_0044.c +a strings/str_0045.c strings/str_0045.c +a strings/str_0046.c strings/str_0046.c +a strings/str_0047.c strings/str_0047.c +a strings/str_0048.c strings/str_0048.c +a strings/str_0049.c strings/str_0049.c +a strings/str_0050.c strings/str_0050.c +a strings/str_0051.c strings/str_0051.c +a strings/str_0052.c strings/str_0052.c +a strings/str_0053.c strings/str_0053.c +# +a strings/str_0107.c strings/str_0107.c +a strings/str_0108.c strings/str_0108.c +a strings/str_0109.c strings/str_0109.c +a strings/str_0201.c strings/str_0201.c +a strings/str_0202.c strings/str_0202.c +a strings/str_0203.c strings/str_0203.c +a strings/str_0204.c strings/str_0204.c +a strings/str_0301.c strings/str_0301.c +a strings/str_0302.c strings/str_0302.c +a strings/str_0303.c strings/str_0303.c +a strings/str_0304.c strings/str_0304.c +a strings/stt.c strings/stt.c +a strings/stt_0020.c strings/stt_0020.c +# ---------------------------------------------------------------------------- +>if [ ! -d tcl ] +>then +> echo 'creating subdirectory tcl' +> mkdir tcl +> mkdir tcl/_bak_ftr.ned +>fi +>ln -fs ../../gg tcl/gg +a tcl/(dirinf).fm tcl/'(dirinf)'.fm +a tcl/make-ux tcl/Makefile +a tcl/make-dos tcl/make-dos +a tcl/tclreg00.c tcl/tclreg00.c +a tcl/tclreg01.c tcl/tclreg01.c +a tcl/tclreg02.c tcl/tclreg02.c +a tcl/tcl_0000.c tcl/tcl_0000.c +a tcl/tcl_0001.c tcl/tcl_0001.c +a tcl/tcl_0002.c tcl/tcl_0002.c +a tcl/tcl_0003.c tcl/tcl_0003.c +a tcl/tcl_0004.c tcl/tcl_0004.c +a tcl/tcl_0005.c tcl/tcl_0005.c +a tcl/tcl_0006.c tcl/tcl_0006.c +a tcl/tcl_0007.c tcl/tcl_0007.c +a tcl/tcl_0008.c tcl/tcl_0008.c +a tcl/tcl_0009.c tcl/tcl_0009.c +a tcl/tcl_0010.c tcl/tcl_0010.c +a tcl/tcl_0101.c tcl/tcl_0101.c +# ---------------------------------------------------------------------------- +>if [ ! -d tfb ] +>then +> echo 'creating subdirectory tfb' +> mkdir tfb +> mkdir tfb/_bak_ftr.ned +>fi +>ln -fs ../../gg tfb/gg +a tfb/(dirinf).fm tfb/'(dirinf)'.fm +a tfb/make-ux tfb/Makefile +a tfb/make-dos tfb/make-dos +a tfb/d3164.c tfb/d3164.c +a tfb/dbf2tfb.c tfb/dbf2tfb.c +a tfb/plz2tfb.c tfb/plz2tfb.c +a tfb/tfb01.c tfb/tfb01.c +a tfb/tfb02.c tfb/tfb02.c +a tfb/tfb03.c tfb/tfb03.c +a tfb/tfb04.c tfb/tfb04.c +a tfb/tfb05.c tfb/tfb05.c +a tfb/tfb06.c tfb/tfb06.c +a tfb/tfbget.c tfb/tfbget.c +a tfb/tfblut.c tfb/tfblut.c +a tfb/tfblut01.c tfb/tfblut01.c +# ---------------------------------------------------------------------------- +>if [ ! -d url ] +>then +> echo 'creating subdirectory url' +> mkdir url +> mkdir url/_bak_ftr.ned +>fi +>ln -fs ../../gg url/gg +a url/(dirinf).fm url/'(dirinf)'.fm +a url/make-ux url/Makefile +a url/make-dos url/make-dos +a url/url_0000.c url/url_0000.c +a url/url_0001.c url/url_0001.c +a url/url_0002.c url/url_0002.c +a url/url_0003.c url/url_0003.c +a url/url_0004.c url/url_0004.c +a url/url_0005.c url/url_0005.c +a url/url_0006.c url/url_0006.c +a url/url_0007.c url/url_0007.c +a url/url_0008.c url/url_0008.c +# ---------------------------------------------------------------------------- +>if [ ! -d varspace ] +>then +> echo 'creating subdirectory varspace' +> mkdir varspace +> mkdir varspace/_bak_ftr.ned +>fi +>ln -fs ../../gg varspace/gg +a varspace/(dirinf).fm varspace/'(dirinf)'.fm +a varspace/make-ux varspace/Makefile +a varspace/make-dos varspace/make-dos +a varspace/varsp000.c varspace/varsp000.c +a varspace/varsp001.c varspace/varsp001.c +a varspace/varsp002.c varspace/varsp002.c +a varspace/varsp003.c varspace/varsp003.c +a varspace/varsp004.c varspace/varsp004.c +a varspace/varsp005.c varspace/varsp005.c +a varspace/varsp006.c varspace/varsp006.c +a varspace/varsp007.c varspace/varsp007.c +a varspace/varsp008.c varspace/varsp008.c +a varspace/vspt.c varspace/vspt.c +# ---------------------------------------------------------------------------- +>if [ ! -d vieos ] +>then +> echo 'creating subdirectory vieos' +> mkdir vieos +> mkdir vieos/_bak_ftr.ned +>fi +>ln -fs ../../gg vieos/gg +a vieos/(dirinf).fm vieos/'(dirinf)'.fm +>ln -s 'vieos/(dirinf).fm' vieos/Contents +a vieos/make-ux vieos/Makefile +a vieos/make-dos vieos/make-dos +a vieos/vieos.c vieos/vieos.c +a vieos/vieos001.c vieos/vieos001.c +a vieos/vieos002.c vieos/vieos002.c +a vieos/vieos003.c vieos/vieos003.c +a vieos/vieos101.c vieos/vieos101.c +a vieos/vieos102.c vieos/vieos102.c +a vieos/vieos103.c vieos/vieos103.c +a vieos/vieos201.c vieos/vieos201.c +a vieos/vieos202.c vieos/vieos202.c +a vieos/vieos203.c vieos/vieos203.c +a vieos/vieos301.c vieos/vieos301.c +a vieos/vieos302.c vieos/vieos302.c +a vieos/vieos303.c vieos/vieos303.c +a vieos/vieos401.c vieos/vieos401.c +a vieos/vieos402.c vieos/vieos402.c +a vieos/vieos403.c vieos/vieos403.c +a vieos/vieosg01.c vieos/vieosg01.c +a vieos/vieosg02.c vieos/vieosg02.c +a vieos/vieosg03.c vieos/vieosg03.c +# ---------------------------------------------------------------------------- +>if [ ! -d ytree ] +>then +> echo 'creating subdirectory ytree' +> mkdir ytree +> mkdir ytree/_bak_ftr.ned +>fi +>ln -fs ../../gg ytree/gg +a ytree/(dirinf).fm ytree/'(dirinf)'.fm +>ln -s 'ytree/(dirinf).fm' ytree/Contents +a ytree/make-ux ytree/Makefile +a ytree/make-dos ytree/make-dos +a ytree/yt_00001.c ytree/yt_00001.c +a ytree/yt_00002.c ytree/yt_00002.c +a ytree/yt_00003.c ytree/yt_00003.c +a ytree/yt_00004.c ytree/yt_00004.c +a ytree/yt_00005.c ytree/yt_00005.c +a ytree/yt_00006.c ytree/yt_00006.c +a ytree/yt_00007.c ytree/yt_00007.c +a ytree/yt_00008.c ytree/yt_00008.c +a ytree/yt_00009.c ytree/yt_00009.c +a ytree/yt_00010.c ytree/yt_00010.c +a ytree/yt_00011.c ytree/yt_00011.c +a ytree/yt_00012.c ytree/yt_00012.c +a ytree/yt_00013.c ytree/yt_00013.c +a ytree/yt_00014.c ytree/yt_00014.c +a ytree/yt_00015.c ytree/yt_00015.c +a ytree/yt_00016.c ytree/yt_00016.c +a ytree/yt_00017.c ytree/yt_00017.c +a ytree/yt_00018.c ytree/yt_00018.c +a ytree/yt_00019.c ytree/yt_00019.c +a ytree/yt_00020.c ytree/yt_00020.c +a ytree/yt_00021.c ytree/yt_00021.c +a ytree/yt_00022.c ytree/yt_00022.c +a ytree/yt_00023.c ytree/yt_00023.c +# +a ytree/yt_00101.c ytree/yt_00101.c +a ytree/yt_00102.c ytree/yt_00102.c +# +a ytree/ytt.c ytree/ytt.c +# ---------------------------------------------------------------------------- +>if [ ! -d zip ] +>then +> echo 'creating subdirectory zip' +> mkdir zip +> mkdir zip/_bak_ftr.ned +>fi +>ln -fs ../../gg zip/gg +a zip/(dirinf).fm zip/'(dirinf)'.fm +a zip/make-ux zip/make-ux +a zip/make-dos zip/make-dos +>ln -s '(dirinf).fm' zip/Contents +>ln -s make-ux zip/Makefile +a zip/zs.c zip/zs.c +a zip/zip_0001.c zip/zip_0001.c +a zip/zip_0002.c zip/zip_0002.c +a zip/zip_0003.c zip/zip_0003.c +a zip/zip_0004.c zip/zip_0004.c +a zip/zip_0005.c zip/zip_0005.c +a zip/zip_0006.c zip/zip_0006.c +a zip/zip_0007.c zip/zip_0007.c +a zip/zip_0008.c zip/zip_0008.c diff --git a/lib/ds/mime/(dirinf).fm b/lib/ds/mime/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..d9fbb97185673ab4a0992e6e743fef5087d9a094 --- /dev/null +++ b/lib/ds/mime/(dirinf).fm @@ -0,0 +1,19 @@ +# +# FILE %ds/mime/(dirinf).fm +# +. Multipurpose Internet Mail Extension +# +# written: 1996-02-23 +.. latest update: 1996-03-17 19:38:39 +# $Id: (dirinf).fm,v 1.2 2001/12/24 16:21:11 gonter Exp $ +# + +# see also: <gg/mail.h> +(dirinf).fm Contents +Makefile + +mime0000.c TEMPLATE +mime0001.c int mime_convert_line (char *line, char *line2, int MAX_LINE, int mime_mode) +mime0002.c int mime_convert_url (char *line, char *line2, int MAX_LINE) +mime0003.c +mime0004.c diff --git a/lib/ds/mime/Makefile b/lib/ds/mime/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..18c6aa7d1bf184a4a5081f6c613d956eb4ad7a13 --- /dev/null +++ b/lib/ds/mime/Makefile @@ -0,0 +1,30 @@ +# +# FILE %ds/mime/make-ux +# +# written: 1996-02-23 +# latest update: 2001-12-24 12:45:29 +# $Id: Makefile,v 1.4 2001/12/31 08:31:28 gonter Exp $ +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + mime0001.o mime0002.o mime0003.o # mime0004.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib diff --git a/lib/ds/mime/contrib b/lib/ds/mime/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/mime/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/mime/gg b/lib/ds/mime/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/mime/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/mime/lib b/lib/ds/mime/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/mime/libgg.a b/lib/ds/mime/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/mime/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/mime/make-dos b/lib/ds/mime/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..50378cbe1c2b8f18bf3728eabcefc955d1d3cc18 --- /dev/null +++ b/lib/ds/mime/make-dos @@ -0,0 +1,21 @@ +# +# FILE %ds/mime/makefile +# +# mime operations +# +# written: 1996-02-23 +# latest update: 1996-02-23 12:52:30 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : ! + mime0001.obj # mime0002.obj mime0003.obj mime0004.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/mime/mime0000.c b/lib/ds/mime/mime0000.c new file mode 100644 index 0000000000000000000000000000000000000000..4aa99583edf3481b6838975905c20398ea44a5bd --- /dev/null +++ b/lib/ds/mime/mime0000.c @@ -0,0 +1,19 @@ +/* + * FILE %ds/mime/mime0000.c + * + * mime operations + * + * written: 1996-02-23 + * latest update: 1996-02-23 12:54:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/mail.h> + +/* ------------------------------------------------------------------------ */ + + diff --git a/lib/ds/mime/mime0001.c b/lib/ds/mime/mime0001.c new file mode 100644 index 0000000000000000000000000000000000000000..dc1aaebe3e511f89570707b9fa352d8aa3439957 --- /dev/null +++ b/lib/ds/mime/mime0001.c @@ -0,0 +1,118 @@ +/* + * FILE %ds/mime/mime0001.c + * + * mime operations + * + * written: 1996-02-23 + * latest update: 1996-08-15 12:14:15 + * $Id: mime0001.c,v 1.2 2001/12/24 16:21:12 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/mail.h> + +extern char sixel_table []; + +/* ------------------------------------------------------------------------ */ +int mime_convert_line (char *line, char *line2, int MAX_LINE, int mime_mode) +{ + int ch; + int cnt= 0; + int b64_phase= 0; + int sixel_v1= 0; + int sixel_v2= 0; + + if (line == (char *) 0 || line2 == (char *) 0 || MAX_LINE <= 0) return -1; + + for (;;) + { + ch= *line++ & 0x00FF; + if (MAX_LINE <= 3) + { + *line2= 0; + goto DONE; + } + + if (ch >= 0x007F) + { + switch (mime_mode) + { + case MIME_quoted_printable: + sprintf (line2, "=%02X", ch); + cnt += 3; + MAX_LINE -= 3; + line2 += 3; + break; + + case MIME_base64: + switch (b64_phase) + { + case 0: + sixel_v1= (ch >> 2) & 0x3F; + sixel_v2= (ch & 0x03) << 4; + + *line2++= sixel_table [sixel_v1]; + MAX_LINE--; + cnt++; + b64_phase++; + break; + + case 1: + sixel_v1= (ch >> 4) & 0x0F; + sixel_v1 |= sixel_v2; + sixel_v2= (ch & 0x0F) << 2; + + *line2++= sixel_table [sixel_v1]; + MAX_LINE--; + cnt++; + b64_phase++; + break; + + case 2: + sixel_v1= (ch >> 6) & 0x03; + sixel_v1 |= sixel_v2; + sixel_v2= (ch & 0x3F); + + *line2++= sixel_table [sixel_v1]; + *line2++= sixel_table [sixel_v2]; + MAX_LINE -= 2; + cnt += 2; + b64_phase= 0; + break; + } + break; + + default: + goto NOPE; + } + } + else + { +NOPE: + *line2++= (char) ch; + MAX_LINE--; + cnt++; + } + + if (ch == 0x00) break; + } + + switch (mime_mode) + { + case MIME_base64: + for (; b64_phase > 0; b64_phase--) + { + *line2++= '='; + cnt++; + } + break; + } + +DONE: + return cnt; +} diff --git a/lib/ds/mime/mime0001.o b/lib/ds/mime/mime0001.o new file mode 100644 index 0000000000000000000000000000000000000000..6fdcb9c389d9a74a064af24c160b1aa0c57cfb55 Binary files /dev/null and b/lib/ds/mime/mime0001.o differ diff --git a/lib/ds/mime/mime0002.c b/lib/ds/mime/mime0002.c new file mode 100644 index 0000000000000000000000000000000000000000..b700de4a16f82f9880b9b9412a6ad4e7740285a8 --- /dev/null +++ b/lib/ds/mime/mime0002.c @@ -0,0 +1,64 @@ +/* + * FILE %ds/mime/mime0001.c + * + * mime operations + * + * written: 2001-12-24 + * latest update: 2001-12-24 12:43:19 + * $Id: mime0002.c,v 1.1 2001/12/24 16:21:12 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/mail.h> + +/* ------------------------------------------------------------------------ */ +int mime_convert_url (char *line, char *line2, int MAX_LINE) +{ + int ch; + int cnt= 0; + int sixel_v1= 0; + int sixel_v2= 0; + int mime_mode= MIME_url_encoded; + + if (line == (char *) 0 || line2 == (char *) 0 || MAX_LINE <= 0) return -1; + + for (;;) + { + ch= *line++ & 0x00FF; + if (ch == 0x00 || MAX_LINE <= 3) + { + *line2= 0; + break; /* these are URLs */ + } + + if (ch >= 0x007F || ch <= 0x20 || ch == '%') + { + switch (mime_mode) + { + case MIME_url_encoded: + sprintf (line2, "%%%02X", ch); + cnt += 3; + MAX_LINE -= 3; + line2 += 3; + break; + + default: + goto NOPE; + } + } + else + { +NOPE: + *line2++= (char) ch; + MAX_LINE--; + cnt++; + } + } + + return cnt; +} diff --git a/lib/ds/mime/mime0002.o b/lib/ds/mime/mime0002.o new file mode 100644 index 0000000000000000000000000000000000000000..72bafd4f78a5a87d581011f97e78e3b988ed0e7d Binary files /dev/null and b/lib/ds/mime/mime0002.o differ diff --git a/lib/ds/mime/mime0003.c b/lib/ds/mime/mime0003.c new file mode 100644 index 0000000000000000000000000000000000000000..f86a4f9b5bdc63b340cf2ca312dfe6c59be1531c --- /dev/null +++ b/lib/ds/mime/mime0003.c @@ -0,0 +1,55 @@ +/* + * FILE %ds/mime/mime0001.c + * + * mime operations + * + * written: 2001-12-24 + * latest update: 2001-12-24 12:43:19 + * $Id: mime0003.c,v 1.2 2002/01/02 09:10:25 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/mail.h> + +/* ------------------------------------------------------------------------ */ +int mime_convert_xurl (char *line, char *line2, int MAX_LINE, int escape) +{ + int ch; + int cnt= 0; + int sixel_v1= 0; + int sixel_v2= 0; + int mime_mode= MIME_url_encoded; + + if (line == (char *) 0 || line2 == (char *) 0 || MAX_LINE <= 0) return -1; + + for (;;) + { + ch= *line++ & 0x00FF; + if (ch == 0x00 || MAX_LINE <= 3) + { + *line2= 0; + break; /* these are URLs */ + } + + if (ch >= 0x007F || ch <= 0x20 || ch == escape) + { + sprintf (line2, "%c%02X", escape, ch); + cnt += 3; + MAX_LINE -= 3; + line2 += 3; + } + else + { + *line2++= (char) ch; + MAX_LINE--; + cnt++; + } + } + + return cnt; +} diff --git a/lib/ds/mime/mime0003.o b/lib/ds/mime/mime0003.o new file mode 100644 index 0000000000000000000000000000000000000000..bbbb8e7859180945ed047433436535ba50e35264 Binary files /dev/null and b/lib/ds/mime/mime0003.o differ diff --git a/lib/ds/rdtp/(dirinf).fm b/lib/ds/rdtp/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..3ca6de581d4429dd6a54037046b4deb683532be4 --- /dev/null +++ b/lib/ds/rdtp/(dirinf).fm @@ -0,0 +1,104 @@ +# +# $Id: (dirinf).fm,v 1.2 2000/06/05 17:05:11 gonter Exp $ +# FILE %ds/rdtp/(dirinf).fm +# +# written: 1996-04-01 +# latest update: 2000-06-05 18:49:52 +# + +# see also: <gg/rdtp.h> and rdtp + +(dirinf).fm Contents +make-dos DOS version of Makefile +make-ux Unix version of Makefile + +rt1.c test rtf parser +rt2.c test sgml parser + +rdtp0000.c TEMPLATE + +rdtp00*.c parser engine +rdtp0001.c dynamic parser engine +rdtp0002.c struct RDTP_THREAD *rdtp_new_thread (struct RDTP_CLASS *cl) +rdtp0003.c int rdtp_parse_file (thread, char *fnm, ...) +rdtp0004.c int rdtp_parse_stream (thread, FILE *fi, ...) +rdtp0005.c int rdtp_bad_thread (int code) + +# more standard parser functions +# collect characters +# create text segment +# place text segment into parse tree + +rdtp01*.c table generator +rdtp0101.c define transition entry +rdtp0102.c process static state table +rdtp0103.c find state entry +rdtp0104.c print generator information +rdtp0105.c print generator states +rdtp0106.c generate transition table +rdtp0107.c drop tables +rdtp0108.c unmark state table +rdtp0109.c mark state table +rdtp0110.c process one state table, pass 1 +rdtp0111.c process one state table, pass 2 +rdtp0112.c process one state table, pass 3 +rdtp0113.c transformation pass 2 +rdtp0114.c transformation pass 3 +rdtp0115.c drop old tables +rdtp0116.c int rdtp_print_state_entry (FILE *fo, ...) + +rdtp02*.c RTF concrete syntax +rdtp0201.c setup RTF syntax +rdtp0202.c RTF nop +rdtp0203.c RTF error +rdtp0204.c RTF name begin +rdtp0205.c RTF name +rdtp0206.c RTF name end +rdtp0207.c RTF print statistics +rdtp0208.c RTF print name statistics + +# see also: <gg/rdtp03.h> and rdtp +rdtp03*.c SGML concrete syntax +rdtp0300.c SGML template +rdtp0301.c SGML setup syntax +rdtp0302.c SGML nop +rdtp0303.c SGML error +rdtp0304.c SGML name begin +rdtp0305.c SGML collect, collect2 +rdtp0306.c SGML name end +rdtp0307.c SGML print statistics +rdtp0308.c SGML print name statistics +rdtp0309.c SGML tag name end +rdtp0310.c SGML entity name end +rdtp0311.c SGML initialize buildup +rdtp0312.c SGML flush buffer +rdtp0313.c SGML new tag name +rdtp0314.c SGML new element +rdtp0315.c SGML declaration +rdtp0316.c SGML begin declaration token +rdtp0317.c SGML end declaration token +rdtp0318.c SGML tokenizer +rdtp0319.c SGML symbol tokenizer +rdtp0320.c SGML declaration entities +rdtp0321.c SGML declaration processing +rdtp0322.c SGML add tag + +rdtp0341.c SGML new opening tag +rdtp0342.c SGML add new attribute name/value pair to an tag +rdtp0343.c SGML diagnostic output for tag structure +rdtp0344.c SGML destroy attribute +rdtp0345.c SGML destroy tag structure +rdtp0346.c SGML tag structure to string +rdtp0347.c SGML calculate space requirement for a tag +rdtp0348.c SGML add new attribute name/long-value pair to an tag + +rdtp04*.c SGML document type definition +rdtp0403.c SGML element declaration + +rdtp0413.c SGML print element declaration + +rdtp0421.c SGML get a name group +rdtp0422.c SGML get content model +rdtp0423.c SGML get attribute list + + diff --git a/lib/ds/rdtp/Makefile b/lib/ds/rdtp/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..50d60e50a714bf3a39c9d4fd51114c8e281ae793 --- /dev/null +++ b/lib/ds/rdtp/Makefile @@ -0,0 +1,68 @@ +# +# FILE %ds/rdtp/make-ux +# +# written: 1996-04-01 +# latest update: 1999-05-08 9:50:49 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include -g +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +all.00= \ + rdtp0001.o rdtp0002.o rdtp0003.o rdtp0004.o rdtp0005.o + +all.01= \ + rdtp0101.o rdtp0102.o rdtp0103.o rdtp0104.o rdtp0105.o \ + rdtp0106.o rdtp0107.o rdtp0108.o rdtp0109.o rdtp0110.o \ + rdtp0111.o rdtp0112.o rdtp0113.o rdtp0114.o rdtp0115.o \ + rdtp0116.o + +all.02= \ + rdtp0201.o rdtp0202.o rdtp0203.o rdtp0204.o rdtp0205.o \ + rdtp0206.o rdtp0207.o rdtp0208.o + +all.03= \ + rdtp0301.o rdtp0302.o rdtp0303.o rdtp0304.o rdtp0305.o \ + rdtp0306.o rdtp0307.o rdtp0308.o rdtp0309.o rdtp0310.o \ + rdtp0311.o rdtp0312.o rdtp0313.o rdtp0314.o rdtp0315.o \ + rdtp0316.o rdtp0317.o rdtp0318.o rdtp0319.o rdtp0320.o \ + rdtp0321.o rdtp0322.o \ + rdtp0341.o rdtp0342.o rdtp0343.o rdtp0344.o rdtp0345.o \ + rdtp0346.o rdtp0347.o rdtp0348.o + +all.04= \ + rdtp0403.o rdtp0413.o rdtp0421.o rdtp0422.o rdtp0423.o + +all.test : rt1_rtf.exe rt1_sgml.exe + +# ---------------------------------------------------------------------------- +lib: $(all.00) $(all.01) $(all.02) $(all.03) $(all.04) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib + +# ---------------------------------------------------------------------------- +rt1_rtf.o : rt1.c + $(CC) $(OPTS) -DRTF -c $? + +rt1_rtf : rt1_rtf.o $(all.00) $(all.01) $(all.02) + $(CC) -o $@ $? + +# ---------------------------------------------------------------------------- +rt1_sgml.o : rt1.c + $(CC) $(OPTS) -DRTF -c $? + +rt1_sgml : rt1_sgml.o $(all.00) $(all.01) $(all.03) + $(CC) -o $@ $? + diff --git a/lib/ds/rdtp/a1 b/lib/ds/rdtp/a1 new file mode 100644 index 0000000000000000000000000000000000000000..17452239c7c2d020234f7c03ec6160da2f5fa46f --- /dev/null +++ b/lib/ds/rdtp/a1 @@ -0,0 +1,1641 @@ +<!-- A model for a Set of Books --> + +<!ELEMENT Set - - ((Title, TitleAbbrev?)?, SetInfo?, ToC?, (%book.gp;), + (%book.gp;)+, SetIndex?) +(%ubiq.gp;) > +<!ATTLIST Set + %commonatts; + FPI CDATA #IMPLIED +> + +<!ELEMENT SetInfo - - ((%bookinfo.content.gp;)+) -(%ubiq.gp;) > +<!ATTLIST SetInfo + %commonatts; + -- Contents points to the IDs of the book pieces (from + book.gp) in the order of their appearance -- + Contents IDREFS #IMPLIED +> + +<!-- A prescriptive model for a Book --> + +<!ELEMENT Book - - ((Title, TitleAbbrev?)?, BookInfo?, ToC?, LoT*, Preface*, + (((%chapter.gp;)+, Reference*) | Part+ | Reference+ | + Article+), (%appendix.gp;)*, Glossary?, Bibliography?, + (%index.gp;)*, LoT*, ToC? ) +(%ubiq.gp;) > +<!ATTLIST Book + %commonatts; + FPI CDATA #IMPLIED + Label CDATA #IMPLIED +> + +<!ELEMENT BookInfo - - (BookBiblio, LegalNotice*, ModeSpec*) -(%ubiq.gp;) > +<!ATTLIST BookInfo + %commonatts; + -- Contents points to the IDs of the book pieces (from + book.gp) in the order of their appearance -- + Contents IDREFS #IMPLIED +> + +<!-- + + PageNums is the pages contained in a given issue or volume. + + --> + +<!ELEMENT BookBiblio - - (Title, TitleAbbrev?, Subtitle?, Edition?, + AuthorGroup+, ((ISBN, VolumeNum?) | (ISSN, VolumeNum?, + IssueNum?, PageNums?))?, InvPartNumber?, ProductNumber?, + ProductName?, PubsNumber?, ReleaseInfo?, PubDate*, Publisher*, + Copyright?, SeriesInfo?, Abstract*, ConfGroup*, (ContractNum | + ContractSponsor)*, PrintHistory?, RevHistory?) -(%ubiq.gp;) > +<!ATTLIST BookBiblio + %commonatts; +> + +<!-- Most of the book component elements --> + +<!ELEMENT Appendix - - (DocInfo?, Title, TitleAbbrev?, (%sect1.gp;)) + +(%ubiq.gp;) > +<!ATTLIST Appendix + %commonatts; + Label CDATA #IMPLIED +> + +<!ELEMENT Chapter - - (DocInfo?, Title, TitleAbbrev?, (%sect1.gp;), (Index | + Glossary | Bibliography)*) +(%ubiq.gp;) > +<!ATTLIST Chapter + %commonatts; + Label CDATA #IMPLIED +> + +<!ELEMENT DocInfo - - (Title, TitleAbbrev?, Subtitle?, AuthorGroup+, + Abstract*, RevHistory?, LegalNotice*) -(%ubiq.gp;) > +<!ATTLIST DocInfo + %commonatts; +> + +<!ELEMENT Part - - (DocInfo?, Title, TitleAbbrev?, PartIntro?, + (%bookcontent.gp;)+) +(%ubiq.gp;) > +<!ATTLIST Part + %commonatts; + Label CDATA #IMPLIED +> + +<!ELEMENT PartIntro - - ((Title, TitleAbbrev?)?, (%sect1.gp;)) +(%ubiq.gp;) > +<!ATTLIST PartIntro + %commonatts; + Label CDATA #IMPLIED +> + +<!ELEMENT Preface - - (DocInfo?, Title, TitleAbbrev?, (%sect1.gp;)) + +(%ubiq.gp;) > +<!ATTLIST Preface + %commonatts; +> + +<!ELEMENT Reference - - (DocInfo?, Title, TitleAbbrev?, PartIntro?, RefEntry+) + +(%ubiq.gp;) > +<!ATTLIST Reference + %commonatts; + Label CDATA #IMPLIED +> + +<!ELEMENT SeriesInfo - - (Title, TitleAbbrev?, Subtitle?, AuthorGroup*, ISBN?, + VolumeNum?, IssueNum?, SeriesVolNums, PubDate*, Publisher*, + Copyright?) -(%ubiq.gp;) > +<!ATTLIST SeriesInfo + %commonatts; +> + +<!ELEMENT Title - - ((%inlinechar.gp;)+) > +<!ATTLIST Title + %commonatts; + Pagenum CDATA #IMPLIED +> + +<!ELEMENT TitleAbbrev - - ((%inlinechar.gp;)+) > +<!ATTLIST TitleAbbrev + %commonatts; +> + +<!ELEMENT Subtitle - - ((%inlinechar.gp;)+) > +<!ATTLIST Subtitle + %commonatts; +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- SECTIONS --> +<!-- ===================================================================== --> + +<!ELEMENT Sect1 - - (Title, TitleAbbrev?, (%nav.gp;)*, (((%component.gp;)+, + (RefEntry* | Sect2*)) | RefEntry+ | Sect2+), (%nav.gp;)*) + +(%ubiq.gp;) > +<!ATTLIST Sect1 + %commonatts; + Label CDATA #IMPLIED + Renderas (Sect2 | Sect3 | Sect4 | Sect5) + #IMPLIED +> + +<!ELEMENT Sect2 - - (Title, TitleAbbrev?, (%nav.gp;)*, (((%component.gp;)+, + (RefEntry* | Sect3*)) | RefEntry+ | Sect3+), (%nav.gp;)*) > +<!ATTLIST Sect2 + %commonatts; + Label CDATA #IMPLIED + Renderas (Sect1 | Sect3 | Sect4 | Sect5) + #IMPLIED +> + +<!ELEMENT Sect3 - - (Title, TitleAbbrev?, (%nav.gp;)*, (((%component.gp;)+, + (RefEntry* | Sect4*)) | RefEntry+ | Sect4+), (%nav.gp;)*) > +<!ATTLIST Sect3 + %commonatts; + Label CDATA #IMPLIED + Renderas (Sect1 | Sect2 | Sect4 | Sect5) + #IMPLIED +> + +<!ELEMENT Sect4 - - (Title, TitleAbbrev?, (%nav.gp;)*, (((%component.gp;)+, + (RefEntry* | Sect5*)) | RefEntry+ | Sect5+), (%nav.gp;)*) > +<!ATTLIST Sect4 + %commonatts; + Label CDATA #IMPLIED + Renderas (Sect1 | Sect2 | Sect3 | Sect5) + #IMPLIED +> + +<!ELEMENT Sect5 - - (Title, TitleAbbrev?, (%nav.gp;)*, (((%component.gp;)+, + RefEntry*) | RefEntry+), (%nav.gp;)*) > +<!ATTLIST Sect5 + %commonatts; + Label CDATA #IMPLIED + Renderas (Sect1 | Sect2 | Sect3 | Sect4) + #IMPLIED +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- OTHER SECTION-ISH ELEMENTS --> +<!-- ===================================================================== --> + +<!ELEMENT MsgSet - - (MsgEntry+) > +<!ATTLIST MsgSet + %commonatts; +> + +<!ELEMENT MsgEntry - - (Msg+, MsgInfo?, MsgExplan*) > +<!ATTLIST MsgEntry + %commonatts; +> + +<!ELEMENT Msg - - (Title?, MsgMain, (MsgSub | MsgRel)*) > +<!ATTLIST Msg + %commonatts; +> + +<!ELEMENT MsgMain - - (Title?, MsgText) > +<!ATTLIST MsgMain + %commonatts; +> + +<!ELEMENT MsgSub - - (Title?, MsgText) > +<!ATTLIST MsgSub + %commonatts; +> + +<!ELEMENT MsgRel - - (Title?, MsgText) > +<!ATTLIST MsgRel + %commonatts; +> + +<!ELEMENT MsgText - - ((%component.gp;)+) > +<!ATTLIST MsgText + %commonatts; +> + +<!ELEMENT MsgInfo - - ((MsgLevel | MsgOrig | MsgAud)*) > +<!ATTLIST MsgInfo + %commonatts; +> + +<!ELEMENT MsgLevel - - (#PCDATA) > +<!ATTLIST MsgLevel + %commonatts; +> + +<!ELEMENT MsgOrig - - (#PCDATA) > +<!ATTLIST MsgOrig + %commonatts; +> + +<!ELEMENT MsgAud - - (#PCDATA) > +<!ATTLIST MsgAud + %commonatts; +> + +<!ELEMENT MsgExplan - - (Title?, (%component.gp;)+) > +<!ATTLIST MsgExplan + %commonatts; +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> + +<!ELEMENT Procedure - - ((Title, TitleAbbrev?)?, (%component.gp;)*, Step+) > +<!ATTLIST Procedure + %commonatts; +> + +<!ELEMENT Step - - (Title?, (((%component.gp;)+, (SubSteps, + (%component.gp;)*)?) | (SubSteps, (%component.gp;)*))) > +<!ATTLIST Step + %commonatts; + Performance (Optional|Required) + Required +> + +<!ELEMENT SubSteps - - (Step+) > +<!ATTLIST SubSteps + %commonatts; + Performance (Optional|Required) + Required +> + +<!-- + + Components not included in Sidebar are: Abstract, AuthorBlurb, + Epigraph, Highlights, and Sidebar. + + --> + +<!ELEMENT Sidebar - - ((Title, TitleAbbrev?)?, (%para.gp; | %list.gp; | + %object.gp; | %admonition.gp; | %formalobject.gp; | Highlights + | BridgeHead | Procedure | Comment | Anchor)+) > +<!ATTLIST Sidebar + %commonatts; +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- PARAGRAPH-RELATED ELEMENTS --> +<!-- ===================================================================== --> + +<!ELEMENT (Abstract | AuthorBlurb) - - (Title?, (%para.gp;)+) > +<!ATTLIST (Abstract | AuthorBlurb) + %commonatts; +> + +<!ELEMENT BlockQuote - - (Title?, (%component.gp;)+) > +<!ATTLIST BlockQuote + %commonatts; +> + +<!ELEMENT BridgeHead - - ((%inlinechar.gp;)+) > +<!ATTLIST BridgeHead + %commonatts; + Renderas (Other | Sect1 | Sect2 | Sect3 | Sect4 | + Sect5) #IMPLIED +> + +<!ELEMENT Comment - - ((%inlinechar.gp;)+) -(%ubiq.gp;) > + +<!ELEMENT Epigraph - - ((%para.gp;)+) > +<!ATTLIST Epigraph + %commonatts; +> + +<!ELEMENT Footnote - - ((%para.gp; | %list.gp; | %object.gp;)+) -(Footnote) > +<!ATTLIST Footnote + %commonatts; +> + +<!ELEMENT Highlights - - ((%para.gp; | %list.gp; | %admonition.gp;)+) + -(%ubiq.gp;) > +<!ATTLIST Highlights + %commonatts; +> + +<!ELEMENT FormalPara - - (Title, Para) > +<!ATTLIST FormalPara + %commonatts; +> + +<!ELEMENT Para - - ((%inlinechar.gp; | InlineGraphic | InlineEquation | + %list.gp; | %object.gp;)+) > +<!ATTLIST Para + %commonatts; +> + +<!ELEMENT SimPara - - ((%inlineobj.gp;)+) > +<!ATTLIST SimPara + %commonatts; +> + +<!-- + + Components not included are: Abstract, AuthorBlurb, other admonitions, + Epigraph, and Highlights. + + --> + +<!ELEMENT (%admonition.gp;) - - (Title?, (Anchor | BridgeHead | Comment | + %formalobject.gp; | %list.gp; | %object.gp; | + %para.gp; | Procedure | Sidebar)+) -(%admonition.gp;) > +<!ATTLIST (%admonition.gp;) + %commonatts; +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- LISTS --> +<!-- ===================================================================== --> + +<!ELEMENT GlossList - - (GlossEntry+) > +<!ATTLIST GlossList + %commonatts; +> + +<!-- + The Mark attribute specifies the mark that should appear + before each ListItem, such as Bullet, Dash, Box, Check. + --> + +<!ELEMENT ItemizedList - - (ListItem+) > +<!ATTLIST ItemizedList + %commonatts; + Mark CDATA #IMPLIED +> + +<!ELEMENT ListItem - - ((%component.gp;)+) > +<!ATTLIST ListItem + %commonatts; + Override CDATA #IMPLIED +> + +<!ELEMENT OrderedList - - (ListItem+) > +<!ATTLIST OrderedList + %commonatts; + Numeration (Arabic | Upperalpha | Loweralpha + | Upperroman | Lowerroman) + #IMPLIED + InheritNum (Inherit | Ignore) + Ignore + Continuation (Continues | Restarts) + Restarts +> + +<!ELEMENT SegmentedList - - ((Title, TitleAbbrev?)?, SegTitle*, SegListItem+) + > +<!ATTLIST SegmentedList + %commonatts; +> + +<!ELEMENT SegTitle - - ((%inlinechar.gp;)+) -(%ubiq.gp;) > +<!ATTLIST SegTitle + %commonatts; +> + +<!ELEMENT SegListItem - - (Seg, Seg+) > +<!ATTLIST SegListItem + %commonatts; +> + +<!ELEMENT Seg - - ((%inlinechar.gp;)+) > +<!ATTLIST Seg + %commonatts; +> + +<!ELEMENT VariableList - - ((Title, TitleAbbrev?)?, VarListEntry+) > +<!ATTLIST VariableList + %commonatts; +> + +<!ELEMENT VarListEntry - - (TermGrp, ListItem) > +<!ATTLIST VarListEntry + %commonatts; +> + +<!ELEMENT TermGrp O O (Term+) > +<!ATTLIST TermGrp + %commonatts; +> + +<!ELEMENT Term - - ((%inlinechar.gp;)+) > +<!ATTLIST Term + %commonatts; +> + +<!-- ===================================================================== --> +<!-- + + SimpleList allows you to list short strings (Members) in an array or + in a normal sentence. The "inline" value of the Type attribute + presents the Members inline (you have to generate commas + and the "and" if need be). "Horiz" means set up as many columns + as are specified by the value of the Columns attribute, of equal + width, indented as for a BlockQuote, and enter the Members in + these slots from L to R, top to bottom, left justified. "Vert" means + calculate the columns the same way and determine the number of rows + as if you were using Horiz; then just fill in the positions from + top to bottom, L to R left-justified. In other words, you + don't set the number of rows, only the number of columns. + (This way, when on-line and the window resizes, you don't have to + readjust the text unless the window gets so narrow you can't + display the specified number of columns, then a renderer might + reduce the number of columns.) When Column = 1, Vert and Horiz + provide the same rendition. + + --> + +<!ELEMENT SimpleList - - (Member+) > +<!ATTLIST SimpleList + %commonatts; + Columns NUMBER #IMPLIED + Type (Inline | Vert | Horiz) + Vert +> + +<!ELEMENT Member - - ((%inlinechar.gp;)+) > +<!ATTLIST Member + %commonatts; +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- OBJECTS --> +<!-- ===================================================================== --> + +<!-- ===================================================================== --> +<!-- EXAMPLE --> +<!-- ===================================================================== --> + +<!ELEMENT Example - - (Title, TitleAbbrev?, (%para.gp; | %list.gp; | + %object.gp;)+) > +<!ATTLIST Example + %commonatts; + Label CDATA #IMPLIED +> + +<!ELEMENT ProgramListing - - ((LineAnnotation | %inlinechar.gp;)+) > +<!ATTLIST ProgramListing + %commonatts; + Format NOTATION + (linespecific) linespecific + Width NUMBER #IMPLIED +> + +<!ELEMENT LiteralLayout - - ((LineAnnotation | %inlinechar.gp;)+) > +<!ATTLIST LiteralLayout + %commonatts; + Format NOTATION + (linespecific) linespecific + Width NUMBER #IMPLIED +> + +<!ELEMENT Screen - - ((LineAnnotation | %inlinechar.gp;)+) > +<!ATTLIST Screen + %commonatts; + Format NOTATION + (linespecific) linespecific + Width NUMBER #IMPLIED +> + +<!ELEMENT ScreenShot - - (ScreenInfo?, Graphic) > +<!ATTLIST ScreenShot + %commonatts; +> + +<!ELEMENT ScreenInfo - - (#PCDATA) -(%ubiq.gp;) > +<!ATTLIST ScreenInfo + %commonatts; +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- FIGURE --> +<!-- ===================================================================== --> +<!-- + + N.B.: Graphic occurs in object.gp, so does not appear + explicitly in Figure. + + --> + +<!ELEMENT Figure - - (Title, TitleAbbrev?, (%object.gp; | %links.gp;)+) > +<!ATTLIST Figure + %commonatts; + Float %yesorno; %no; + Label CDATA #IMPLIED +> + +<!-- + + Graphical data can be the content of Graphic, or you can + reference an external file through the Fileref attribute, + either as an entity or a filename. + + --> + +<!ELEMENT Graphic - - CDATA > +<!ATTLIST Graphic + Entityref ENTITY #IMPLIED + Fileref CDATA #IMPLIED + Format NOTATION + (%notationtypes;) + #IMPLIED + Id ID #IMPLIED + SrcCredit CDATA #IMPLIED +> + +<!ELEMENT InlineGraphic - - CDATA > +<!ATTLIST InlineGraphic + Entityref ENTITY #IMPLIED + Fileref CDATA #IMPLIED + Format NOTATION + (%notationtypes;) + #IMPLIED + Id ID #IMPLIED + SrcCredit CDATA #IMPLIED +> + + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- EQUATION --> +<!-- ===================================================================== --> + +<!ELEMENT Equation - - ((Title, TitleAbbrev?)?, (InformalEquation | + %eqncontent.gp;)+) > +<!ATTLIST Equation + %commonatts; + Label CDATA #IMPLIED +> + +<!ELEMENT InformalEquation - - ((%eqncontent.gp;)+) > +<!ATTLIST InformalEquation + %commonatts; +> + +<!ELEMENT InlineEquation - - ((%eqncontent.gp;)+) > +<!ATTLIST InlineEquation + %commonatts; +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- TABLE --> +<!-- ===================================================================== --> + +<!-- + + The CALS table specification derived from MIL-M-28001B. The only + difference is the content of Entry. InformalTable was derived + from Table by removing titling and the attributes: Label, + ShortEntry, and Tocentry. + + --> + +<!ELEMENT Table - - (Title, TitleAbbrev?, (%tblcontent.gp;)) + -(Table|InformalTable)> +<!ATTLIST Table + %commonatts; + Colsep %yesorno; #IMPLIED + Frame (Top|Bottom|Topbot|All|Sides|None) + #IMPLIED + Label CDATA #IMPLIED + Orient (Port | Land) #IMPLIED + Pgwide %yesorno; #IMPLIED + Rowsep %yesorno; #IMPLIED + Shortentry %yesorno; #IMPLIED + Tabstyle NMTOKEN #IMPLIED + Tocentry %yesorno; %yes; +> + +<!ELEMENT InformalTable - - ((%tblcontent.gp;)) -(Table|InformalTable)> +<!ATTLIST InformalTable + %commonatts; + Colsep %yesorno; #IMPLIED + Frame (Top|Bottom|Topbot|All|Sides|None) + #IMPLIED + Orient (Port | Land) #IMPLIED + Pgwide %yesorno; #IMPLIED + Rowsep %yesorno; #IMPLIED + Tabstyle NMTOKEN #IMPLIED +> + +<!ELEMENT TGroup - O (ColSpec*, SpanSpec*, THead?, TFoot?, TBody) > +<!ATTLIST TGroup + %commonatts; + Align (Left|Right|Center|Justify|Char) + Left + Char CDATA "" + Charoff NUTOKEN "50" + Cols NUMBER #REQUIRED + Colsep %yesorno; #IMPLIED + Rowsep %yesorno; #IMPLIED + TGroupStyle NMTOKEN #IMPLIED +> + +<!ELEMENT ColSpec - O EMPTY > +<!ATTLIST ColSpec + %commonatts; + Align (Left|Right|Center|Justify|Char) + #IMPLIED + Char CDATA #IMPLIED + Charoff NUTOKEN #IMPLIED + Colname NMTOKEN #IMPLIED + Colnum NUMBER #IMPLIED + Colsep %yesorno; #IMPLIED + Colwidth CDATA #IMPLIED + Rowsep %yesorno; #IMPLIED +> + +<!ELEMENT SpanSpec - O EMPTY > +<!ATTLIST SpanSpec + %commonatts; + Align (Left|Right|Center|Justify|Char) + "Center" + Char CDATA #IMPLIED + Charoff NUTOKEN #IMPLIED + Colsep %yesorno; #IMPLIED + Nameend NMTOKEN #REQUIRED + Namest NMTOKEN #REQUIRED + Rowsep %yesorno; #IMPLIED + Spanname NMTOKEN #REQUIRED +> + +<!ELEMENT THead - O (ColSpec*, Row+) -(EntryTbl) > +<!ATTLIST THead + %commonatts; + VAlign (Top | Middle | Bottom) + "Bottom" +> + +<!ELEMENT TFoot - O (ColSpec*, Row+) -(EntryTbl) > +<!ATTLIST TFoot + %commonatts; + VAlign (Top | Middle | Bottom) + "Top" +> + +<!ELEMENT TBody - O (Row+) > +<!ATTLIST TBody + %commonatts; + VAlign (Top | Middle | Bottom) + "Top" +> + +<!ELEMENT Row - O ((Entry | EntryTbl)+) > +<!ATTLIST Row + %commonatts; + Rowsep %yesorno; #IMPLIED + VAlign (Top | Middle | Bottom) + #IMPLIED +> + +<!-- + + The content model of Entry is broken into two possibilities: + paragraph-like elements (Para, Note, LiteralLayout, lists, + etc., and inline text elements (PCDATA, Command, Link, etc.). + Because of the possibility that PCDATA can occur without + being contained, you can not allow for spurious record ends + to occur between the paragraph-like elements. If the inline + text elements were contained in another element, e.g., Cell, + (it could be a sibling of Entry or part of the content model + for Entry), this issue would disappear. + + --> +<!ELEMENT Entry - O ((%para.gp; | %admonition.gp; | %code.example.gp; | + %list.gp; | Graphic)+ | (%inlineobj.gp;)+) > +<!ATTLIST Entry + %commonatts; + Align (Left|Right|Center|Justify|Char) + #IMPLIED + Char CDATA #IMPLIED + Charoff NUTOKEN #IMPLIED + Colname NMTOKEN #IMPLIED + Colsep %yesorno; #IMPLIED + Morerows NUMBER "0" + Nameend NMTOKEN #IMPLIED + Namest NMTOKEN #IMPLIED + Rotate %yesorno; %no; + Rowsep %yesorno; #IMPLIED + Spanname NMTOKEN #IMPLIED + VAlign (Top | Middle | Bottom) + #IMPLIED +> + +<!ELEMENT EntryTbl - - ((ColSpec*, SpanSpec*, THead?, TBody)+) + -(EntryTbl) > +<!ATTLIST EntryTbl + %commonatts; + Align (Left|Right|Center|Justify|Char) + #IMPLIED + Char CDATA #IMPLIED + Charoff NUTOKEN #IMPLIED + Colname NMTOKEN #IMPLIED + Cols NUMBER #REQUIRED + Colsep %yesorno; #IMPLIED + Nameend NMTOKEN #IMPLIED + Namest NMTOKEN #IMPLIED + Rowsep %yesorno; #IMPLIED + Spanname NMTOKEN #IMPLIED + TGroupStyle NMTOKEN #IMPLIED +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- LINKS --> +<!-- ===================================================================== --> + +<!ELEMENT Anchor - O EMPTY > +<!ATTLIST Anchor + Id ID #REQUIRED + Pagenum CDATA #IMPLIED + Remap CDATA #IMPLIED + Role CDATA #IMPLIED + XRefLabel CDATA #IMPLIED +> + +<!-- + + The PageNum attribute of BeginPage, if given, specifies + the number of the page that begins at that point. + + --> + +<!ELEMENT BeginPage - O EMPTY > +<!ATTLIST BeginPage + %commonatts; + Pagenum CDATA #IMPLIED +> + +<!-- + + IndexTerms occur in the text flow for generating or linking an + Index. + + --> + +<!ELEMENT IndexTerm - O (Primary, ((Secondary, ((Tertiary, (See | SeeAlso+)?) + | See | SeeAlso+)?) | See | SeeAlso+)?) -(%ubiq.gp;) > +<!ATTLIST IndexTerm + %commonatts; + Pagenum CDATA #IMPLIED + Significance (Preferred | Normal) + Normal + SpanEnd IDREF #CONREF +> + +<!ELEMENT (Primary | Secondary | Tertiary ) - - ((%inlinechar.gp;)+) > +<!ATTLIST (Primary | Secondary | Tertiary ) + %commonatts; + SortAs CDATA #IMPLIED +> + +<!ELEMENT (See | SeeAlso) - - ((%inlinechar.gp;)+) > +<!ATTLIST (See | SeeAlso) + %commonatts; +> + +<!-- ===================================================================== --> +<!-- + + Use of the HyTime terms Linkend and Endterm does not indicate + that HyTime processing is required. Link has both Endterm and + Linkend attributes: Linkend is the spot linked to, Endterm + identifies information that may be used by the Link. You + might, for example, make the Linkend a Sect2 and make the + Endterm its Title. + + --> + + +<!ELEMENT Link - - ((%inlineobj.gp;)+) > +<!ATTLIST Link + Endterm IDREF #IMPLIED + Linkend IDREF #REQUIRED + Type CDATA #IMPLIED +> + +<!-- ===================================================================== --> +<!-- + + Hytimeish link, after Eliot Kimber. TargetDocEnt points + to an entity in the manner of HyTime's Docorsub; this could + be an FPI inside a text entity or could be a data entity. + LinkMode points to a ModeSpec, which may contain + application-specific information and may appear only in + DocInfo and BookInfo. + + --> + +<!ELEMENT OLink - - ((%inlineobj.gp;)+) > +<!ATTLIST OLink + TargetDocEnt ENTITY #IMPLIED + LinkMode IDREF #IMPLIED + LocalInfo CDATA #IMPLIED + Type CDATA #IMPLIED +> + +<!ELEMENT ModeSpec - - (#PCDATA) -(%ubiq.gp;) > +<!ATTLIST ModeSpec + %commonatts; + Application NOTATION + (%notationtypes;) + #IMPLIED +> + +<!-- + URL link. To point to a filename, use "file://pathname/filename" as + the value of the URL attribute + --> + +<!ELEMENT ULink - - ((%inlineobj.gp;)+) > +<!ATTLIST ULink + URL CDATA #REQUIRED + Type CDATA #IMPLIED +> + +<!ELEMENT FootnoteRef - O (#PCDATA) -(%ubiq.gp;) > +<!ATTLIST FootnoteRef + id ID #IMPLIED + Linkend IDREF #REQUIRED + Mark CDATA #CONREF +> + +<!ELEMENT XRef - O EMPTY > +<!ATTLIST XRef + Endterm IDREF #IMPLIED + Linkend IDREF #REQUIRED +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- DOCINFO --> +<!-- ===================================================================== --> + +<!-- + + DOCINFO elements; some appear in BiblioEntry, too + + --> + +<!ELEMENT (Author | Editor | OtherCredit) - - ((Honorific | Firstname | + Surname | Lineage | OtherName | Affiliation | AuthorBlurb | + Contrib)+) > + +<!ELEMENT (AuthorInitials | Contrib | CorpAuthor | CorpName | Date | Edition | + Firstname | Holder | Honorific | ISBN | InvPartNumber | + Lineage | OtherName | ProductNumber | ReleaseInfo | RevNumber + | RevRemark | Surname | Year ) - - (#PCDATA) > + +<!ELEMENT Affiliation - - (ShortAffil?, JobTitle*, OrgName?, OrgDiv*, + Address*) > + +<!ELEMENT JobTitle - - (#PCDATA) > + +<!-- ShortAffil is for places like ToCs --> +<!ELEMENT ShortAffil - - (#PCDATA) > + +<!ELEMENT Copyright - - (Year+, Holder*) > + +<!ELEMENT LegalNotice - - (Title?, ( %admonition.gp; | BlockQuote | + %code.example.gp; | %list.gp; | %para.gp;)+) > + +<!ELEMENT PrintHistory - - ((%para.gp;)+) > + +<!ELEMENT ProductName - - ((%inlinechar.gp;)+) > +<!ATTLIST ProductName + %commonatts; + Class (Service|Trade|Registered|Copyright) + Trade +> + +<!ELEMENT RevHistory - - (Revision*) > + +<!ELEMENT Revision - - (RevNumber, Date, AuthorInitials+, RevRemark) > + +<!ATTLIST (Author | AuthorInitials | CorpAuthor | OtherCredit | RevHistory) + %commonatts; +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- COMPUTER TERM INLINES --> +<!-- ===================================================================== --> + +<!ELEMENT Application - - ((%inlinechar.gp;)+) > +<!ATTLIST Application + %commonatts; + Class (Hardware|Software) + #IMPLIED + MoreInfo (RefEntry|None) None +> + +<!ELEMENT Database - - ((%cptrphrase.gp;)+) > +<!ATTLIST Database + %commonatts; + Class (Name|Table|Field|Key1|Key2|Record) + #IMPLIED + MoreInfo (RefEntry|None) None +> + +<!ELEMENT Interface - - ((%cptrphrase.gp;)+) > +<!ATTLIST Interface + %commonatts; + Class (Button|Icon|Menu|MenuItem) + #IMPLIED + MoreInfo (RefEntry|None) None +> + +<!ELEMENT MediaLabel - - (#PCDATA) > +<!ATTLIST MediaLabel + %commonatts; + Class (Cartridge|CDRom|Disk|Tape) + #IMPLIED +> + +<!ELEMENT Parameter - - ((%cptrphrase.gp;)+) > +<!ATTLIST Parameter + %commonatts; + Class (Command|Function|Option) + #IMPLIED + MoreInfo (RefEntry|None) None +> + +<!ELEMENT Replaceable - - ((%phrase.gp;)+) > +<!ATTLIST Replaceable + %commonatts; + Class (Command | Function | Option | Parameter) + #IMPLIED +> + +<!ELEMENT SystemItem - - ((%cptrphrase.gp;)+) > +<!ATTLIST SystemItem + %commonatts; + Class + (Constant|EnvironVar|Macro|OSname|Prompt|Resource|SystemName) + #IMPLIED + MoreInfo (RefEntry|None) None +> + +<!ELEMENT (Command | Literal) - - ((%cptrphrase.gp;)+) > +<!ATTLIST (Command | Literal) + %commonatts; + MoreInfo (RefEntry|None) None +> + +<!ELEMENT (Action | Filename | Function | Hardware | KeyCap | + InterfaceDefinition | Property) - - ((%cptrphrase.gp;)+) > +<!ATTLIST (Action | Filename | Function | Hardware | KeyCap | + InterfaceDefinition | Property) + + %commonatts; + MoreInfo (RefEntry|None) None +> + +<!ELEMENT ComputerOutput - - ((%cptrphrase.gp;)+) > +<!ATTLIST ComputerOutput + %commonatts; + MoreInfo (RefEntry|None) None +> + +<!ELEMENT UserInput - - ((%cptrphrase.gp;)+) > +<!ATTLIST UserInput + %commonatts; + MoreInfo (RefEntry|None) None +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> + +<!ELEMENT CiteTitle - - ((%inlinechar.gp;)+) > +<!ATTLIST CiteTitle + %commonatts; + -- The kind of title in a published work being cited. -- + Pubwork (Article|Book|Chapter|Part|RefEntry|Section) + #IMPLIED +> + +<!ELEMENT CiteRefEntry - - (RefEntryTitle, ManVolNum?) > +<!ATTLIST CiteRefEntry + %commonatts; +> + +<!ELEMENT Option - - ((%cptrphrase.gp;)+) > +<!ATTLIST Option + %commonatts; +> + +<!ELEMENT Quote - - ((%inlinechar.gp;)+) > +<!ATTLIST Quote + %commonatts; +> + +<!ELEMENT Trademark - - ((%cptrphrase.gp;)+) > +<!ATTLIST Trademark + %commonatts; + Class (Service|Trade|Registered|Copyright) + Trade +> + +<!ELEMENT (Subscript | Superscript) - - ((%phrase.gp; | Emphasis | + Replaceable)+) -(%ubiq.gp;) > +<!ATTLIST (Subscript | Superscript) + %commonatts; +> + +<!ELEMENT SGMLTag - - (#PCDATA) > +<!ATTLIST SGMLTag + %commonatts; + Class (Attribute|Element|GenEntity|ParamEntity) + #IMPLIED +> + +<!ELEMENT (Abbrev | Acronym | Citation | Classname | Emphasis | ErrorName | + ErrorType | FirstTerm | ForeignPhrase | KeySym | KeyCode | + LineAnnotation | Markup | PubsNumber | ReturnValue | + StructField | StructName | Symbol | Token | Type | VolumeNum | + WordAsWord) - - (#PCDATA) > +<!ATTLIST (Abbrev | Acronym | Citation | Classname | Emphasis | ErrorName | + ErrorType | FirstTerm | ForeignPhrase | KeySym | KeyCode | + LineAnnotation | Markup | PubsNumber | ReturnValue | + StructField | StructName | Symbol | Token | Type | VolumeNum | + WordAsWord) + + %commonatts; +> + +<!-- + + The element named Optional is for use in syntax lines, as in a + RefEntry, where optional parameters are shown in square + brackets. Optional should replace those brackets. + + --> + +<!ELEMENT Optional - - ((%cptrphrase.gp;)+) > +<!ATTLIST Optional + %commonatts; +> + + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- NAVIGATION --> +<!-- ===================================================================== --> + +<!ELEMENT ToC - - (DocInfo?, (Title, TitleAbbrev?)?, ToCfront*, (ToCpart+ | + ToCchap+), ToCback*) > +<!ATTLIST ToC + %commonatts; +> + +<!ELEMENT ToCfront - - ((%inlinechar.gp;)+) > +<!ATTLIST ToCfront + %commonatts; + Label CDATA #IMPLIED + Pagenum CDATA #IMPLIED +> + +<!ELEMENT ToCentry - - ((%inlinechar.gp;)+) > +<!ATTLIST ToCentry + %commonatts; + Linkend IDREF #IMPLIED + Pagenum CDATA #IMPLIED +> + +<!ELEMENT ToCpart - - (ToCentry+, ToCchap*) > +<!ATTLIST ToCpart + %commonatts; +> + +<!ELEMENT ToCchap - - (ToCentry+, ToClevel1*) > +<!ATTLIST ToCchap + %commonatts; + Label CDATA #IMPLIED +> + +<!ELEMENT ToClevel1 - - (ToCentry+, ToClevel2*) > +<!ATTLIST ToClevel1 + %commonatts; +> + +<!ELEMENT ToClevel2 - - (ToCentry+, ToClevel3*) > +<!ATTLIST ToClevel2 + %commonatts; +> + +<!ELEMENT ToClevel3 - - (ToCentry+, ToClevel4*) > +<!ATTLIST ToClevel3 + %commonatts; +> + +<!ELEMENT ToClevel4 - - (ToCentry+, ToClevel5*) > +<!ATTLIST ToClevel4 + %commonatts; +> + +<!ELEMENT ToClevel5 - - (ToCentry+) > +<!ATTLIST ToClevel5 + %commonatts; +> + +<!ELEMENT ToCback - - ((%inlinechar.gp;)+) > +<!ATTLIST ToCback + %commonatts; + Label CDATA #IMPLIED + Pagenum CDATA #IMPLIED +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> + +<!ELEMENT LoT - - (DocInfo?, (Title, TitleAbbrev?)?, LoTentry+) > +<!ATTLIST LoT + %commonatts; + Label CDATA #IMPLIED +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> + +<!ELEMENT Bibliography - - (DocInfo?, (Title, TitleAbbrev?)?, + (%component.gp;)*, (BiblioDiv+ | BiblioEntry+)) > +<!ATTLIST Bibliography + %commonatts; +> + +<!ELEMENT BiblioDiv - - ((Title, TitleAbbrev?)?, (%component.gp;)*, + BiblioEntry+) > +<!ATTLIST BiblioDiv + %commonatts; +> + +<!-- + N.B. this model of BiblioEntry produces info in the order + "title, author"; TEI prefers "author, title". + --> +<!ELEMENT BiblioEntry - - (BiblioMisc?, (ArtHeader | BookBiblio | SeriesInfo), + BiblioMisc?) > +<!ATTLIST BiblioEntry + %commonatts; +> + +<!ELEMENT BiblioMisc - - (#PCDATA) > +<!ATTLIST BiblioMisc + %commonatts; +> + + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> + +<!ELEMENT Glossary - - (DocInfo?, (Title, TitleAbbrev?)?, (%component.gp;)*, + (GlossDiv+ | GlossEntry+), Bibliography?) > +<!ATTLIST Glossary + %commonatts; +> + +<!ELEMENT GlossDiv - - (Title, TitleAbbrev?, (%component.gp;)*, + GlossEntry+) > +<!ATTLIST GlossDiv + %commonatts; +> + +<!ELEMENT GlossEntry - - (GlossTerm, Acronym?, Abbrev?, (GlossSee | + GlossDef+)) > +<!ATTLIST GlossEntry + %commonatts; + SortAs CDATA #IMPLIED +> + +<!ELEMENT GlossTerm - - ((%inlineobj.gp;)+) > +<!ATTLIST GlossTerm + %commonatts; +> + +<!ELEMENT GlossDef - - ((Comment | %para.gp; | %list.gp; | %object.gp;)+, + GlossSeeAlso*) > +<!ATTLIST GlossDef + %commonatts; + Subject CDATA #IMPLIED +> + +<!ELEMENT GlossSee - O ((%inlineobj.gp;)+) > +<!ATTLIST GlossSee + %commonatts; + OtherTerm IDREF #CONREF +> + +<!ELEMENT GlossSeeAlso - O ((%inlineobj.gp;)+) > +<!ATTLIST GlossSeeAlso + %commonatts; + OtherTerm IDREF #CONREF +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> + +<!ELEMENT (SetIndex | Index) - - (DocInfo?, (Title, TitleAbbrev?)?, + (%component.gp;)*, (IndexDiv+ | IndexEntry+)) -(%ubiq.gp;) > +<!ATTLIST (SetIndex | Index) + %commonatts; +> + +<!-- + + The IndexDiv model allows a SegmentedList as the content of + IndexDiv so SegmentedList can be used for permuted indices. + + --> + +<!ELEMENT IndexDiv - - ((Title, TitleAbbrev?)?, ((Anchor | Comment | + %links.gp; | ItemizedList | OrderedList | VariableList | + %object.gp; | %para.gp;)*, (IndexEntry+ | SegmentedList))) > +<!ATTLIST IndexDiv + %commonatts; +> + +<!-- + + IndexEntries appear in the Index, not the text. + + --> + +<!ELEMENT IndexEntry - - (%primsee;, (%secsee;)*) > +<!ATTLIST IndexEntry + %commonatts; +> + +<!ELEMENT PrimaryIE - - ((%inlinechar.gp;)+) > +<!ATTLIST PrimaryIE + %commonatts; + Linkends IDREFS #IMPLIED +> + +<!ELEMENT SecondaryIE - - ((%inlinechar.gp;)+) > +<!ATTLIST SecondaryIE + %commonatts; + Linkends IDREFS #IMPLIED +> + +<!ELEMENT TertiaryIE - - ((%inlinechar.gp;)+) > +<!ATTLIST TertiaryIE + %commonatts; + Linkends IDREFS #IMPLIED +> + +<!ELEMENT SeeIE - - ((%inlinechar.gp;)+) > +<!ATTLIST SeeIE + %commonatts; + Linkend IDREF #IMPLIED +> + +<!ELEMENT SeeAlsoIE - - ((%inlinechar.gp;)+) > +<!ATTLIST SeeAlsoIE + %commonatts; + Linkends IDREFS #IMPLIED +> + +<!ELEMENT LoTentry - - ((%inlinechar.gp;)+ ) -(%ubiq.gp;) > +<!ATTLIST LoTentry + %commonatts; + Pagenum CDATA #IMPLIED + SrcCredit CDATA #IMPLIED +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- REFERENCE ENTRIES --> +<!-- ===================================================================== --> + +<!ELEMENT RefEntry - - (DocInfo?, RefMeta?, (Comment | %links.gp;)*, + RefNameDiv, RefSynopsisDiv?, RefSect1+) +(%ubiq.gp;) > +<!ATTLIST RefEntry + %commonatts; +> + +<!ELEMENT RefMeta - - (RefEntryTitle, ManVolNum?, RefMiscInfo*) -(BeginPage) > +<!ATTLIST RefMeta + %commonatts; +> + +<!ELEMENT RefEntryTitle - - ((%inlinechar.gp;)+) > +<!ATTLIST RefEntryTitle + %commonatts; +> + +<!ELEMENT ManVolNum - - (#PCDATA) > +<!ATTLIST ManVolNum + %commonatts; +> + +<!ELEMENT RefMiscInfo - - (#PCDATA) > +<!ATTLIST RefMiscInfo + %commonatts; + Class CDATA #IMPLIED +> + +<!ELEMENT RefNameDiv - - (RefDescriptor?, RefName+, RefPurpose, RefClass*, + (Comment | %links.gp;)*) > +<!ATTLIST RefNameDiv + %commonatts; +> + +<!ELEMENT RefDescriptor - - (#PCDATA) > +<!ATTLIST RefDescriptor + %commonatts; +> + +<!ELEMENT RefName - - ((#PCDATA | %computerterms.gp;)+) > +<!ATTLIST RefName + %commonatts; +> + +<!ELEMENT RefPurpose - - ((%inlinechar.gp;)+) > +<!ATTLIST RefPurpose + %commonatts; +> + +<!ELEMENT RefClass - - ((%refclass.gp;)+) > +<!ATTLIST RefClass + %commonatts; +> + +<!ELEMENT RefSynopsisDiv - - ((Title, TitleAbbrev?)?, (((%synop.gp;)+, + RefSect2*) | (RefSect2+))) > +<!ATTLIST RefSynopsisDiv + %commonatts; +> + +<!ELEMENT RefSect1 - - (Title, TitleAbbrev?, (((%component.gp;)+, RefSect2*) | + RefSect2+)) > +<!ATTLIST RefSect1 + %commonatts; +> + +<!ELEMENT RefSect2 - - (Title, TitleAbbrev?, (((%component.gp;)+, RefSect3*) | + RefSect3+)) > +<!ATTLIST RefSect2 + %commonatts; +> + +<!ELEMENT RefSect3 - - (Title, TitleAbbrev?, (%component.gp;)+) > +<!ATTLIST RefSect3 + %commonatts; +> + +<!ELEMENT Synopsis - - ((LineAnnotation | %inlinechar.gp; | Graphic)+) > +<!ATTLIST Synopsis + %commonatts; + Format NOTATION + (linespecific) linespecific + Label CDATA #IMPLIED +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> + +<!-- Example command synopsis in typical UNIX(tm) format: + + rm [-f] [-r] [-i] [-] {filename|dirname}... + ^ ^ ^ ^ ^ ^ ^ ^ ^ + | | | | | | | | | + | optional args | | | repeat indicator + | (contain options)| | | + | | | second child of group + command name | | + | first child of group + | + required repeatable group + + SGML source for this example: + + <CMDSYNOPSIS> + <COMMAND>rm</COMMAND> + <ARG Choice="opt">-f</ARG> (<OPTION> not required for arg + contents unless doing extra-special + processing) + <ARG Choice="opt">-r</ARG> + <ARG Choice="opt">-i</ARG> + <ARG Choice="opt">-</ARG> (UNIX(tm) synopsis format or other + format can be generated) + <GROUP Choice="req" Rep="repeat"> + <REPLACEABLE>filename</REPLACEABLE> + <REPLACEABLE>dirname</REPLACEABLE> + </GROUP> + </CMDSYNOPSIS> +--> + +<!ELEMENT CmdSynopsis - - ((Arg | Group)*, Command, (Arg | Group)*, + SynopFragment*) > +<!ATTLIST CmdSynopsis + %commonatts; + Label CDATA #IMPLIED + Sepchar CDATA " " +> + +<!ELEMENT Arg - - ((#PCDATA | Arg | Group | Option | SynopFragmentRef | + Replaceable)+) > +<!ATTLIST Arg + %commonatts; + %argchcatt; + %repatt; +> + +<!ELEMENT Group - - ((Arg | Group | SynopFragmentRef | Replaceable)+) > +<!ATTLIST Group + %commonatts; + %grpchcatt; + %repatt; +> + +<!ELEMENT SynopFragmentRef - - RCDATA > +<!ATTLIST SynopFragmentRef + %commonatts; + Linkend IDREF #REQUIRED -- to Fragment -- +> + +<!ELEMENT SynopFragment - - ((Arg | Group)+) > +<!ATTLIST SynopFragment + Id ID #REQUIRED + Lang CDATA #IMPLIED + Remap CDATA #IMPLIED + Role CDATA #IMPLIED + XRefLabel CDATA #IMPLIED +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> + +<!ELEMENT FuncSynopsis - - (FuncSynopsisInfo?, ((FuncDef, (void | varargs | + ParamDef+)))+ ) > +<!ATTLIST FuncSynopsis + %commonatts; + Label CDATA #IMPLIED +> + +<!ELEMENT FuncSynopsisInfo - - ((LineAnnotation | %cptrphrase.gp;)* ) > +<!ATTLIST FuncSynopsisInfo + %commonatts; + Format NOTATION + (linespecific) linespecific +> + +<!ELEMENT FuncDef - - ((#PCDATA | Replaceable | Function)*) > +<!ATTLIST FuncDef + %commonatts; +> + +<!ELEMENT void - O EMPTY > +<!ATTLIST void + %commonatts; +> + +<!ELEMENT varargs - O EMPTY > +<!ATTLIST varargs + %commonatts; +> + +<!-- + + Processing assumes that only one Parameter will appear in a + ParamDef, and that funcparams will be used at most once, for + providing information on the "inner parameters" for parameters + that are pointers to functions. + + --> + +<!ELEMENT ParamDef - - ((#PCDATA | Replaceable | Parameter | FuncParams)*) > +<!ATTLIST ParamDef + %commonatts; +> + +<!ELEMENT FuncParams - - ((%cptrphrase.gp;)*) > +<!ATTLIST FuncParams + %commonatts; +> + +<!-- ===================================================================== --> +<!-- ##################################################################### --> +<!-- ===================================================================== --> +<!-- ARTICLE --> +<!-- ===================================================================== --> + +<!-- This Article model is derived from the MAJOUR header DTD. + + CHANGES from MAJOUR: + - Gnomic element names (oad, onm, odv, oid, kwdg, cgn, cgs, cnm . . .) + have been replaced by understandable ones. + - Quite a few elements have been dropped; others that already exist + in Docbook have been substituted for the Majour ones. + - Some of the modularity has been suppressed, empty elements + containing pointers have been eliminated, and occurrence + indicators have been changed ad lib. + - Affiliation has been nested inside Author, instead of inside + AuthorGroup. + - JournalInfo info has been folded into BookBiblio inside BookInfo, + cf. also BiblioEntry. Some of this info lies elsewhere in + the Majour model. + + A journal or anthology is a Book in Docbook, and the meta for + a journal is permitted in BookInfo. Articles (Chapters) + within a journal or anthology have ArtHeaders, which may + contain the same info. +--> + +<!ELEMENT Article - - (ArtHeader, (%sect1.gp;), ((%nav.gp;) | (%appendix.gp;) + | Ackno)*) +(%ubiq.gp;) > +<!ATTLIST Article + %commonatts; + ParentBook IDREF #IMPLIED +> + +<!-- + + ArtPageNums are the page numbers of the article as published. + --> + +<!ELEMENT ArtHeader - - (Title, TitleAbbrev?, Subtitle?, AuthorGroup+, + BookBiblio?, ArtPageNums, Abstract*, ConfGroup*, (ContractNum + | ContractSponsor)*) > +<!ATTLIST ArtHeader + %commonatts; +> + +<!ELEMENT ArtPageNums - - (#PCDATA) > + +<!ELEMENT Ackno - - (#PCDATA) > + +<!ELEMENT Address - - (Street | POB | Postcode | City | State | Country | + Phone | Fax | Email | OtherAddr)*> + +<!ELEMENT (Street | POB | Postcode | City | State | Country | Phone | Fax | + Email | OtherAddr) - - (#PCDATA) > + +<!ELEMENT (OrgName | OrgDiv) - - (#PCDATA) > + +<!ELEMENT AuthorGroup - - ((Author | Editor | Collab | CorpAuthor | + OtherCredit)+) > + +<!ELEMENT Collab - - (CollabName, Affiliation*) > + +<!ELEMENT CollabName - - (#PCDATA) > + +<!ELEMENT ConfDates - - (#PCDATA) > + +<!ELEMENT ConfGroup - - ((ConfDates | ConfTitle | ConfNum | Address | + ConfSponsor)*) > + +<!ELEMENT ConfNum - - (#PCDATA) > + +<!ELEMENT ConfSponsor - - (#PCDATA) > + +<!ELEMENT ConfTitle - - (#PCDATA) > + +<!ELEMENT ContractNum - - (#PCDATA) > + +<!ELEMENT ContractSponsor - - (#PCDATA) > + +<!ELEMENT ISSN - - (#PCDATA) > + +<!ELEMENT IssueNum - - (#PCDATA) > + +<!ELEMENT PageNums - - (#PCDATA) > + +<!ELEMENT PubDate - - (#PCDATA) > + +<!ELEMENT Publisher - - (PublisherName, Address*) > + +<!ELEMENT PublisherName - - (#PCDATA) > + +<!ELEMENT SeriesVolNums - - (#PCDATA) > + +<!-- ===================================================================== --> +<!-- End of the DocBook DTD --> +<!-- ===================================================================== --> + diff --git a/lib/ds/rdtp/a1b b/lib/ds/rdtp/a1b new file mode 100644 index 0000000000000000000000000000000000000000..ebe03cb5c2e448d44bed177b26b6b52ab8cb5ac1 --- /dev/null +++ b/lib/ds/rdtp/a1b @@ -0,0 +1,16 @@ +<!ELEMENT Graphic - - CDATA > +<!ATTLIST Graphic + Entityref ENTITY #IMPLIED + Fileref CDATA #IMPLIED + Id ID #IMPLIED + SrcCredit CDATA #IMPLIED +> + +<!ELEMENT InlineGraphic - - CDATA > +<!ATTLIST InlineGraphic + Entityref ENTITY #IMPLIED + Fileref CDATA #IMPLIED + Id ID #IMPLIED + SrcCredit CDATA #IMPLIED +> + diff --git a/lib/ds/rdtp/contrib b/lib/ds/rdtp/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/rdtp/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/rdtp/demo.rtf b/lib/ds/rdtp/demo.rtf new file mode 100644 index 0000000000000000000000000000000000000000..a614d36261d97d4caaf2d33717fde43ac339bf17 --- /dev/null +++ b/lib/ds/rdtp/demo.rtf @@ -0,0 +1,51 @@ +{\rtf${\footnote \pard\plain \sl240 \fs20{\plain \f3 $ TXT2RTF}} +K{\footnote \pard\plain \sl240 \fs20{\plain \f3 K txt2rtf}} +#{\footnote \pard\plain \sl240 \fs20{\plain \f3 # main_index}} +{\f2TXT2RTF Text to Rich File Format\par +\par +This following is a list of available topics:\par +\par +{\ul Control Codes } + {\v control_codes } +\par +{\ul File format } + {\v file_format } +\par +{\uldb Bitmaps } + {\v bitmap_ref } +\par +}{\plain \page} +${\footnote \pard\plain \sl240 \fs20{\plain \f3 $ Control Codes}} +#{\footnote \pard\plain \sl240 \fs20{\plain \f3 # control_codes}} +\par +{\f2Control Codes\par +\par +The following is a list of control code characters:\par +\par +\tab * - Build Tag\par +\tab # - Context String\par +\tab $ - Title\par +\tab K - Keyword\par +\tab + - Browse Sequence\par +}{\plain \page} +${\footnote \pard\plain \sl240 \fs20{\plain \f3 $ File Format}} +#{\footnote \pard\plain \sl240 \fs20{\plain \f3 # file_format}} +\par +{\f2File Format\par +\par +The text file should began with the control footnotes.\par +The body of text should come next.\par +A formfeed must be placed at the end of each topic.\par +}{\plain \page} +${\footnote \pard\plain \sl240 \fs20{\plain \f3 $ Bitmaps}} +K{\footnote \pard\plain \sl240 \fs20{\plain \f3 K Bitmap Reference}} +#{\footnote \pard\plain \sl240 \fs20{\plain \f3 # bitmap_ref}} +\par +{\f2Bitmap Reference\par +\par +Bitmaps {\uldb \{bmc txt2rtf.bmp\} } + {\v control_codes } + can be included in your help file.\par +Press the bitmap to jump to the control code topic.\par +}{\plain \page} +} diff --git a/lib/ds/rdtp/gg b/lib/ds/rdtp/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/rdtp/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/rdtp/gg01.sgm b/lib/ds/rdtp/gg01.sgm new file mode 100644 index 0000000000000000000000000000000000000000..7b9241360942aaf2e51bded73690ca735f492ac0 --- /dev/null +++ b/lib/ds/rdtp/gg01.sgm @@ -0,0 +1,23 @@ +<!-- FILE %ds/hyxp/gg01.sgm 1996-02-19 21:18:44 --> + +<test> +The following elements are recognized or not: +- YES <minimized/text/ +- YES <emph meth=urxn /minimized/ +- YES <emph meth=urxn/minimized/ +- YES <emph meth="urxn"/minimized/ +- YES <emph meth="urxn/minimized"/urxn/ +- YES <emph meth="urxn/minimized/"/urxn/ +- YES <emph meth="urxn/minimized/" /urxn/ +- YES <emph meth='urxn/minimized/' /urxn/ +- YES and <tag1<tag2>asdfasdf</</> +- YES <h1>this is a header</h1> +- YES <?bold>urxn +- ? x > y +- ? x < y +- ? <!> +- ? <![ CDATA [adfdfsd ]]> + +</test> + + diff --git a/lib/ds/rdtp/lib b/lib/ds/rdtp/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/rdtp/libgg.a b/lib/ds/rdtp/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/rdtp/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/rdtp/make-dos b/lib/ds/rdtp/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..92504ce710fb0877f224dfabc89b164ca1abde71 --- /dev/null +++ b/lib/ds/rdtp/make-dos @@ -0,0 +1,75 @@ +# +# FILE %ds/rdtp/makefile +# +# manipulation of attribute lists +# +# written: 1996-04-01 +# latest update: 1997-07-14 21:25:13 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all : all.00 all.01 all.02 all.03 all.04 # all.bin + +all.00 : ! + rdtp0001.obj rdtp0002.obj rdtp0003.obj rdtp0004.obj rdtp0005.obj + +all.01 : ! + rdtp0101.obj rdtp0102.obj rdtp0103.obj rdtp0104.obj rdtp0105.obj ! + rdtp0106.obj rdtp0107.obj rdtp0108.obj rdtp0109.obj rdtp0110.obj ! + rdtp0111.obj rdtp0112.obj rdtp0113.obj rdtp0114.obj rdtp0115.obj ! + rdtp0116.obj + +all.02 : ! + rdtp0201.obj rdtp0202.obj rdtp0203.obj rdtp0204.obj rdtp0205.obj ! + rdtp0206.obj rdtp0207.obj rdtp0208.obj + +all.03 : ! + rdtp0301.obj rdtp0302.obj rdtp0303.obj rdtp0304.obj rdtp0305.obj ! + rdtp0306.obj rdtp0307.obj rdtp0308.obj rdtp0309.obj rdtp0310.obj ! + rdtp0311.obj rdtp0312.obj rdtp0313.obj rdtp0314.obj rdtp0315.obj ! + rdtp0316.obj rdtp0317.obj rdtp0318.obj rdtp0319.obj rdtp0320.obj ! + rdtp0321.obj rdtp0322.obj ! + rdtp0341.obj rdtp0342.obj rdtp0343.obj rdtp0344.obj rdtp0345.obj ! + rdtp0346.obj rdtp0347.obj rdtp0348.obj + +all.04 : ! + rdtp0403.obj ! + rdtp0413.obj ! + rdtp0421.obj rdtp0422.obj rdtp0423.obj + +all.bin : rt1_rtf.exe rt1_sgml.exe rt2.exe + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ + +# ---------------------------------------------------------------------------- +TEST_RTF= rdtp0001.obj rdtp0004.obj rdtp0106.obj rdtp0109.obj rdtp0110.obj ! + rdtp0201.obj rdtp0206.obj + +rt1_rtf.obj : rt1.c + $(cml) -DRTF rt1.c + +rt1_rtf.exe : rt1_rtf.obj $(TEST_RTF) + link rt1_rtf $(TEST_RTF),,,c:\usr\sbr\lsbr; + +# ---------------------------------------------------------------------------- +TEST_SGML= rdtp0301.obj rdtp0321.obj rdtp0403.obj rdtp0413.obj rdtp0421.obj ! + rdtp0423.obj + +rt1_sgml.obj : rt1.c + $(cml) -DSGML rt1.c + +rt1_sgml.exe : rt1_sgml.obj $(TEST_SGML) + link rt1_sgml $(TEST_SGML),,,c:\usr\sbr\lsbr; + +# see rt2.c rdtp0343.c +RT2= rdtp0322.obj rdtp0341.obj rdtp0346.obj rdtp0347.obj + +rt2.exe : rt2.obj $(RT2) + link rt2 $(RT2),,,c:\usr\sbr\lsbr; diff --git a/lib/ds/rdtp/rdtp0001.c b/lib/ds/rdtp/rdtp0001.c new file mode 100644 index 0000000000000000000000000000000000000000..23b7a586b75d4ec19887359160b82741ac061669 --- /dev/null +++ b/lib/ds/rdtp/rdtp0001.c @@ -0,0 +1,100 @@ +/* + * FILE %ds/rdtp/rdtp0001.c + * + * restructured dynamic text parser + * + * written: 1996-04-01 + * latest update: 1997-01-15 10:45:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> +#include <gg/rdtp.h> + +#ifdef RDTP_DEBUG +#include <stdio.h> +#endif /* RDTP_DEBUG */ + +/* ------------------------------------------------------------------------ */ +int rdtp_parse_char ( +struct RDTP_THREAD *thread, +int ch) +{ + struct RDTP_CLASS *cl; + struct RDTP_STATE *st, *new_state; + RDTP_state_transition *method; + int char_class; + int rc= 0; + + if (thread == (struct RDTP_THREAD *) 0 + || ch < 0 + || ch > 255 + || (cl= thread->class) == (struct RDTP_CLASS *) 0 + || (char_class= cl->char_classes [ch]) < 0 + || char_class > cl->max_classes + ) + return -1; + + if ((st= thread->current_state) == (struct RDTP_STATE *) 0) + { /* current state is undefined; perform self correction, if possible */ + rc= -1; + + st= cl->state_for_undefined_state; + method= cl->method_for_undefined_state; + } + + if (st != (struct RDTP_STATE *) 0) + { + rc= 0; + + new_state= st->new_states [char_class]; + +#ifdef RDTP_DEBUG + printf ("0x%02X %c %4d %-10s -> %-10s %s\n", + ch, + (ch > 0x20 && ch < 0x7F) ? ch : '.', + char_class, + st->state_name, + (new_state == (struct RDTP_STATE *) 0) + ? "(undef)" + : XSTR (new_state->state_name), + XSTR (st->transition_info [char_class])); +#endif /* RDTP_DEBUG */ + + if (new_state == (struct RDTP_STATE *) 0) + { /* undefined input arrived */ + method= cl->method_for_undefined_input; + + if (cl->state_for_undefined_input != (struct RDTP_STATE *) 0) + { /* next state is defined; use that */ + new_state= cl->state_for_undefined_input; + } + else + { /* no method to deal with stuff */ +#ifdef RDTP_DEBUG + char *nm1; + + nm1= st->state_name; + printf ( + "rdtp0001: state=%s char=0x%02X -> undef state; ignoring input\n", + nm1, ch); +#endif /* RDTP_DEBUG */ + + } + } + else + { + method= st->transitions [char_class]; + } + + if (method != (RDTP_state_transition *) 0) + rc= (*method) ((void *) thread, ch); + thread->current_state= new_state; + } + + return rc; +} diff --git a/lib/ds/rdtp/rdtp0001.o b/lib/ds/rdtp/rdtp0001.o new file mode 100644 index 0000000000000000000000000000000000000000..09a6a495cde7b26b71856d4e0977119c15ab85a2 Binary files /dev/null and b/lib/ds/rdtp/rdtp0001.o differ diff --git a/lib/ds/rdtp/rdtp0002.c b/lib/ds/rdtp/rdtp0002.c new file mode 100644 index 0000000000000000000000000000000000000000..3c98de6a26292042f20c111270d95d80bc1ec929 --- /dev/null +++ b/lib/ds/rdtp/rdtp0002.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/rdtp/rdtp0002.c + * + * restructured dynamic text parser + * + * written: 1996-04-02 + * latest update: 1996-04-02 15:07:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/rdtp.h> + +/* ------------------------------------------------------------------------ */ +struct RDTP_THREAD *rdtp_new_thread (struct RDTP_CLASS *cl) +{ + struct RDTP_THREAD *thr= (struct RDTP_THREAD *) 0; + + if (cl != (struct RDTP_CLASS *) 0 + && (thr= (struct RDTP_THREAD *) + calloc (sizeof (struct RDTP_THREAD), 1)) + != (struct RDTP_THREAD *) 0 + ) + { + thr->class= cl; + thr->current_state= cl->start_state; + } + + return thr; +} diff --git a/lib/ds/rdtp/rdtp0002.o b/lib/ds/rdtp/rdtp0002.o new file mode 100644 index 0000000000000000000000000000000000000000..6cd6ccb7d69c3d2dc01f70e418e8cb421198a05a Binary files /dev/null and b/lib/ds/rdtp/rdtp0002.o differ diff --git a/lib/ds/rdtp/rdtp0003.c b/lib/ds/rdtp/rdtp0003.c new file mode 100644 index 0000000000000000000000000000000000000000..6228a0236832f4ad48286273a97035abe6cc77ed --- /dev/null +++ b/lib/ds/rdtp/rdtp0003.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/rdtp/rdtp0003.c + * + * restructured dynamic text parser + * + * written: 1996-04-02 + * latest update: 1996-04-02 15:26:58 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> + +/* ------------------------------------------------------------------------ */ +long rdtp_parse_file ( +struct RDTP_THREAD *thread, +char *fnm, +long beg, +long size) +{ + FILE *fi; + long rc; + + if ((fi= fopen (fnm, "rb")) == (FILE *) 0) return -1L; + + fseek (fi, beg, 0L); + rc= rdtp_parse_stream (thread, fi, size); + fclose (fi); + + return rc; +} diff --git a/lib/ds/rdtp/rdtp0003.o b/lib/ds/rdtp/rdtp0003.o new file mode 100644 index 0000000000000000000000000000000000000000..756d59204e135aefcfc552c47162cd213b4a4625 Binary files /dev/null and b/lib/ds/rdtp/rdtp0003.o differ diff --git a/lib/ds/rdtp/rdtp0004.c b/lib/ds/rdtp/rdtp0004.c new file mode 100644 index 0000000000000000000000000000000000000000..cf7f47d4a958fdb10778d7c3999996f9481644cc --- /dev/null +++ b/lib/ds/rdtp/rdtp0004.c @@ -0,0 +1,56 @@ +/* + * FILE %ds/rdtp/rdtp0004.c + * + * restructured dynamic text parser + * + * written: 1996-04-02 + * latest update: 1996-04-02 21:18:10 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> + +/* ------------------------------------------------------------------------ */ +long rdtp_parse_stream ( +struct RDTP_THREAD *thread, +FILE *fi, +long size) +{ + int ch; + int rc; + long cnt= 0L; +#ifdef RDTP_DEBUG + long line_cnt= 1L; +#endif /* RDTP_DEBUG */ + + if (thread == (struct RDTP_THREAD *) 0) return -1L; + +#ifdef RDTP_DEBUG + printf ("char ch cl state -> state act\n"); +#endif /* RDTP_DEBUG */ + + while (size-- > 0L) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + +#ifdef RDTP_DEBUG + if (ch == 0x0A) + { + line_cnt++; + } + printf ("0x%08lX %5ld: ", cnt, line_cnt++); +#endif /* RDTP_DEBUG */ + + rc= rdtp_parse_char (thread, ch); + if (rc != 0) break; + cnt++; + } + + return cnt; +} diff --git a/lib/ds/rdtp/rdtp0004.o b/lib/ds/rdtp/rdtp0004.o new file mode 100644 index 0000000000000000000000000000000000000000..cd4e1a24b27ce2a89e15e8617044f6be64c551cd Binary files /dev/null and b/lib/ds/rdtp/rdtp0004.o differ diff --git a/lib/ds/rdtp/rdtp0005.c b/lib/ds/rdtp/rdtp0005.c new file mode 100644 index 0000000000000000000000000000000000000000..28ba14c0476e000ce987476bfb8360fd616a5e94 --- /dev/null +++ b/lib/ds/rdtp/rdtp0005.c @@ -0,0 +1,23 @@ +/* + * FILE %ds/rdtp/rdtp0005.c + * + * restructured dynamic text parser + * + * written: 1996-09-15 + * latest update: 1996-09-15 9:54:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> + +/* ------------------------------------------------------------------------ */ +void rdtp_bad_thread (char *id) +{ + fputs (id, stderr); + fputs (": bad thread\n", stderr); +} diff --git a/lib/ds/rdtp/rdtp0005.o b/lib/ds/rdtp/rdtp0005.o new file mode 100644 index 0000000000000000000000000000000000000000..cc67d828cc0d58e2dbd9c688705f06c7d0b360ff Binary files /dev/null and b/lib/ds/rdtp/rdtp0005.o differ diff --git a/lib/ds/rdtp/rdtp0101.c b/lib/ds/rdtp/rdtp0101.c new file mode 100644 index 0000000000000000000000000000000000000000..e1652fa37624f9492929ea4facee2ce2146fa370 --- /dev/null +++ b/lib/ds/rdtp/rdtp0101.c @@ -0,0 +1,54 @@ +/* + * FILE %ds/rdtp/rdtp0101.c + * + * restructured dynamic text parser + * + * written: 1996-04-01 + * latest update: 1996-04-02 10:37:13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_define_transition ( +struct RDTP_GENERATOR *gen, +char *from, +char *to, +long begin, +long end, +RDTP_state_transition *method, +char *method_info) +{ + struct RDTP_STATE_DEFINITION *std; + struct RDTP_STATE_TRANSITION *trans; + + if (gen == (struct RDTP_GENERATOR *) 0 + || from == (char *) 0 + || to == (char *) 0 + || (std= rdtp_find_state_definition (gen, from)) + == (struct RDTP_STATE_DEFINITION *) 0 + || (trans= (struct RDTP_STATE_TRANSITION *) + calloc (sizeof (struct RDTP_STATE_TRANSITION), 1)) + == (struct RDTP_STATE_TRANSITION *) 0 + ) + return -1; + + trans->state_to= strdup (to); + if (method_info != (char *) 0) trans->method_info= strdup (method_info); + trans->range_begin= begin; + trans->range_end= end; + trans->method= method; + + trans->next= std->trans; + std->trans= trans; + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0101.o b/lib/ds/rdtp/rdtp0101.o new file mode 100644 index 0000000000000000000000000000000000000000..90c8dac820594ae150b215cf26632751f08c494c Binary files /dev/null and b/lib/ds/rdtp/rdtp0101.o differ diff --git a/lib/ds/rdtp/rdtp0102.c b/lib/ds/rdtp/rdtp0102.c new file mode 100644 index 0000000000000000000000000000000000000000..c857c4c9be40c1bc4bfb3bf55d99bb2a9b2ca6e3 --- /dev/null +++ b/lib/ds/rdtp/rdtp0102.c @@ -0,0 +1,42 @@ +/* + * FILE %ds/rdtp/rdtp0102.c + * + * restructured dynamic text parser + * + * written: 1996-04-01 + * latest update: 1996-05-07 13:34:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_load_static_table ( +struct RDTP_GENERATOR *gen, +struct RDTP_STATIC_STATE_TABLE state_table []) +{ + struct RDTP_STATIC_STATE_TABLE *entry; + + if (gen == (struct RDTP_GENERATOR *) 0 + || state_table == (struct RDTP_STATIC_STATE_TABLE *) 0 + ) + return -1; + + for (entry= &state_table [0]; + entry->state_from != (char *) 0; + entry++) + { + rdtp_define_transition (gen, + entry->state_from, entry->state_to, + entry->range_begin, entry->range_end, + entry->method, + entry->method_info); + } + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0102.o b/lib/ds/rdtp/rdtp0102.o new file mode 100644 index 0000000000000000000000000000000000000000..8c4fac931af25b6b7d97c56dc498de4abc4f8471 Binary files /dev/null and b/lib/ds/rdtp/rdtp0102.o differ diff --git a/lib/ds/rdtp/rdtp0103.c b/lib/ds/rdtp/rdtp0103.c new file mode 100644 index 0000000000000000000000000000000000000000..213011e2f837e2d70fdc7f11362e383d8653f506 --- /dev/null +++ b/lib/ds/rdtp/rdtp0103.c @@ -0,0 +1,51 @@ +/* + * FILE %ds/rdtp/rdtp0103.c + * + * restructured dynamic text parser + * + * written: 1996-04-01 + * latest update: 1997-01-15 10:46:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +struct RDTP_STATE_DEFINITION *rdtp_find_state_definition ( +struct RDTP_GENERATOR *gen, +char *state_name) +{ + struct RDTP_STATE_DEFINITION *def= (struct RDTP_STATE_DEFINITION *) 0; + struct YTREE *yt; + + if (gen != (struct RDTP_GENERATOR *) 0 + && (yt= ytree_insert_word (&gen->state_names, + (unsigned char *) state_name)) + != (struct YTREE *) 0 + ) + { + if (yt->YT_flags & YTflag_EOW) + { /* state was already defined */ + def= (struct RDTP_STATE_DEFINITION *) yt->YT_info; + } + else + { + if ((def= calloc (sizeof (struct RDTP_STATE_DEFINITION), 1)) + != (struct RDTP_STATE_DEFINITION *) 0) + { + yt->YT_info= (long) def; + yt->YT_flags |= YTflag_EOW; + def->state_name= strdup (state_name); + } + } + } + + return def; +} diff --git a/lib/ds/rdtp/rdtp0103.o b/lib/ds/rdtp/rdtp0103.o new file mode 100644 index 0000000000000000000000000000000000000000..b5c7528426ca5f15328edb0dc77ee5c96ef78902 Binary files /dev/null and b/lib/ds/rdtp/rdtp0103.o differ diff --git a/lib/ds/rdtp/rdtp0104.c b/lib/ds/rdtp/rdtp0104.c new file mode 100644 index 0000000000000000000000000000000000000000..66af3e6684d71951050c7a0e1cbc6eb28bc3bbcb --- /dev/null +++ b/lib/ds/rdtp/rdtp0104.c @@ -0,0 +1,28 @@ +/* + * FILE %ds/rdtp/rdtp0104.c + * + * restructured dynamic text parser + * + * written: 1996-04-01 + * latest update: 1996-04-02 9:26:16 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_print_generator ( +struct RDTP_GENERATOR *gen, +FILE *fo) +{ + fprintf (fo, "name: %s\n", gen->generator_name); + ytree_process (gen->state_names, rdtp_print_states, (void *) fo); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0104.o b/lib/ds/rdtp/rdtp0104.o new file mode 100644 index 0000000000000000000000000000000000000000..9e2e9a049d5e528c7a945351dac13c9df609c4a7 Binary files /dev/null and b/lib/ds/rdtp/rdtp0104.o differ diff --git a/lib/ds/rdtp/rdtp0105.c b/lib/ds/rdtp/rdtp0105.c new file mode 100644 index 0000000000000000000000000000000000000000..e705775a2425791af7a83540a710a9f31f40d6b9 --- /dev/null +++ b/lib/ds/rdtp/rdtp0105.c @@ -0,0 +1,40 @@ +/* + * FILE %ds/rdtp/rdtp0105.c + * + * restructured dynamic text parser + * + * written: 1996-04-02 + * latest update: 1996-04-02 18:50:27 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_print_states (struct YTREE *yt, void *cd) +{ + FILE *fo; + struct RDTP_STATE_DEFINITION *st; + struct RDTP_STATE_TRANSITION *tr; + + if (yt == (struct YTREE *) 0 + || !(yt->YT_flags & YTflag_EOW) + || (st= (struct RDTP_STATE_DEFINITION *) yt->YT_info) + == (struct RDTP_STATE_DEFINITION *) 0 + ) + return 0; + + fo= (FILE *) cd; + fprintf (fo, "state: %s\n", st->state_name); + + for (tr= st->trans; tr != (struct RDTP_STATE_TRANSITION *) 0; tr= tr->next) + rdtp_print_state_entry (fo, tr, " "); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0105.o b/lib/ds/rdtp/rdtp0105.o new file mode 100644 index 0000000000000000000000000000000000000000..8101b1bed6f8bb86da5870f722cf014c77b5120c Binary files /dev/null and b/lib/ds/rdtp/rdtp0105.o differ diff --git a/lib/ds/rdtp/rdtp0106.c b/lib/ds/rdtp/rdtp0106.c new file mode 100644 index 0000000000000000000000000000000000000000..be78d75d400a85b648e1e5c5720ec32937850077 --- /dev/null +++ b/lib/ds/rdtp/rdtp0106.c @@ -0,0 +1,92 @@ +/* + * FILE %ds/rdtp/rdtp0106.c + * + * restructured dynamic text parser + * + * written: 1996-04-02 + * latest update: 1996-06-22 12:37:14 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* #define DEBUG */ + +/* ------------------------------------------------------------------------ */ +int rdtp_generate_transition_table (struct RDTP_GENERATOR *gen) +{ + int i; + int g; + int rc; + struct RDTP_CLASS *class; + struct RDTP_STATE_DEFINITION *st_def; + + printf (">> GEN name: %s (reset)\n", gen->generator_name); + + if ((class= gen->class) == (struct RDTP_CLASS *) 0) + { + if ((class= gen->class= (struct RDTP_CLASS *) + calloc (sizeof (struct RDTP_CLASS), 1)) + == (struct RDTP_CLASS *) 0) return -1; + } + + ytree_process (gen->state_names, rdtp_unmark_states, (void *) gen); + + printf (">> GEN name: %s (init)\n", gen->generator_name); + gen->generator_ok= 0; + gen->defined_classes= 1; /* in the beginning everything is in class 0 */ + for (i= 0; i < RDTP_MAX_CLASSES; i++) + gen->class_table [i]= 0; + + printf (">> GEN name: %s (pass 1)\n", gen->generator_name); + rc= rdtp_mark_states (gen, gen->start_state, 1); + gen->generator_ok= rc; + + printf ("defined_classes: %d\n", gen->defined_classes); + class->max_classes= gen->defined_classes; + for (i= 0; i < 256; i++) + { + g= gen->class_table [i]; + class->char_classes [i]= g; +#ifdef DEBUG + printf ("0x%02X: %c %4d\n", i, (i > 0x20 && i < 0x7f) ? i : '.', g); +#endif /* DEBUG */ + } + + if (rc != 1) + { + printf ("rdtp0106: WARNING, generator not ok, trying to proceed!\n"); + } + + printf (">> GEN name: %s (pass 2)\n", gen->generator_name); + ytree_process (gen->state_names, rdtp_pass2_transformation, (void *) gen); + + printf (">> GEN name: %s (pass 3)\n", gen->generator_name); + ytree_process (gen->state_names, rdtp_pass3_transformation, (void *) gen); + + /* brushing up the parser class record */ + if ((st_def= (struct RDTP_STATE_DEFINITION *) + ytree_get_value (gen->state_names, + (unsigned char *) gen->start_state)) + != (struct RDTP_STATE_DEFINITION *) 0 + ) + { + printf ("rdtp0106: start_state: %s\n", st_def->state_name); + + class->start_state= st_def->state; + + class->method_for_undefined_state= gen->method_for_undefined_state; + class-> state_for_undefined_state= gen-> state_for_undefined_state; + class->method_for_undefined_input= gen->method_for_undefined_input; + class-> state_for_undefined_input= gen-> state_for_undefined_input; + } + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0106.o b/lib/ds/rdtp/rdtp0106.o new file mode 100644 index 0000000000000000000000000000000000000000..375c21832ee359fd6245a564e77a0b2175f1f4c3 Binary files /dev/null and b/lib/ds/rdtp/rdtp0106.o differ diff --git a/lib/ds/rdtp/rdtp0107.c b/lib/ds/rdtp/rdtp0107.c new file mode 100644 index 0000000000000000000000000000000000000000..eb1fdeeeba518541ff380f96011bfab7ade2e371 --- /dev/null +++ b/lib/ds/rdtp/rdtp0107.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/rdtp/rdtp0107.c + * + * *** NOT USED, OBSOLTE *** + * + * restructured dynamic text parser + * + * written: 1996-04-02 + * latest update: 1996-09-14 22:47:29 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_drop_tables (struct YTREE *yt, void *cd) +{ + if (yt == (struct YTREE *) 0 || !(yt->YT_flags & YTflag_EOW)) return 0; + + return rdtp_drop_state_table ( + (struct RDTP_GENERATOR *) cd, + (struct RDTP_STATE_DEFINITION *) yt->YT_info); +} diff --git a/lib/ds/rdtp/rdtp0107.o b/lib/ds/rdtp/rdtp0107.o new file mode 100644 index 0000000000000000000000000000000000000000..5240d5f0f627214e574b3e903c53fdf24d1026de Binary files /dev/null and b/lib/ds/rdtp/rdtp0107.o differ diff --git a/lib/ds/rdtp/rdtp0108.c b/lib/ds/rdtp/rdtp0108.c new file mode 100644 index 0000000000000000000000000000000000000000..93aa64388040c5bb21e0e41582eb4ef0ec5b449c --- /dev/null +++ b/lib/ds/rdtp/rdtp0108.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/rdtp/rdtp0108.c + * + * mark all state tables as unusued + * + * written: 1996-04-02 + * latest update: 1996-06-22 12:47:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_unmark_states (struct YTREE *yt, void *cd) +{ + struct RDTP_STATE_DEFINITION *st; + +#ifdef MSDOS + cd; +#endif + + if (yt == (struct YTREE *) 0 + || !(yt->YT_flags & YTflag_EOW) + || (st= (struct RDTP_STATE_DEFINITION *) yt->YT_info) + == (struct RDTP_STATE_DEFINITION *) 0 + ) + return 0; + +#ifdef DEBUG + printf ("mark state: %s unused\n", st->state_name); +#endif /* DEBUG */ + + st->state_used= 0; + rdtp_drop_state_table ((struct RDTP_GENERATOR *) cd, st); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0108.o b/lib/ds/rdtp/rdtp0108.o new file mode 100644 index 0000000000000000000000000000000000000000..e3c2cb970ec8b0e38d3bca709798a37ea81722c6 Binary files /dev/null and b/lib/ds/rdtp/rdtp0108.o differ diff --git a/lib/ds/rdtp/rdtp0109.c b/lib/ds/rdtp/rdtp0109.c new file mode 100644 index 0000000000000000000000000000000000000000..b19cf971a3e0683847db922273f475d2b8656156 --- /dev/null +++ b/lib/ds/rdtp/rdtp0109.c @@ -0,0 +1,69 @@ +/* + * FILE %ds/rdtp/rdtp0109.c + * + * locate all used states and mark them accordingly + * + * written: 1996-04-02 + * latest update: 1997-01-15 10:47:02 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_mark_states ( +struct RDTP_GENERATOR *gen, +char *start, +int verbosity) +/* return codes: */ +/* 0 .. invalid or incomplete information */ +/* 1 .. everything's ok */ +{ + struct RDTP_STATE_DEFINITION *st; + struct RDTP_STATE_TRANSITION *tr; + struct YTREE *names; + int rv= 1; /* assume thing's are ok */ + int rc; + + if (gen == (struct RDTP_GENERATOR *) 0 + || (names= gen->state_names) == (struct YTREE *) 0 + || start == (char *) 0 + ) + { + printf ("rdtp0109: invalid state data!\n"); + return 0; + } + + if ((st= (struct RDTP_STATE_DEFINITION *) + ytree_get_value (names, (unsigned char *) start)) + == (struct RDTP_STATE_DEFINITION *) 0 + ) + { + printf ("rdtp0109: state '%s' undefined!\n", start); + return 0; + } + + if (st->state_used) return 1; /* we have been here before */ + +#ifdef DEBUG + printf ("\n-----------------------------------\n"); + printf (">> mark '%s' as used\n", start); +#endif /* DEBUG */ + + st->state_used= 1; /* this has been visited */ + rdtp_process1_state_table (gen, st); + + for (tr= st->trans; tr != (struct RDTP_STATE_TRANSITION *) 0; tr= tr->next) + { + rc= rdtp_mark_states (gen, tr->state_to, verbosity); + if (rc != 1) rv= 0; /* propagate an error back up */ + } + + return rv; +} diff --git a/lib/ds/rdtp/rdtp0109.o b/lib/ds/rdtp/rdtp0109.o new file mode 100644 index 0000000000000000000000000000000000000000..fa30be8d9416cbad31a0a5894d996aedcb6ec0a1 Binary files /dev/null and b/lib/ds/rdtp/rdtp0109.o differ diff --git a/lib/ds/rdtp/rdtp0110.c b/lib/ds/rdtp/rdtp0110.c new file mode 100644 index 0000000000000000000000000000000000000000..fddb1cae8e52a0fb0967c495fc0ec581ad61f7ac --- /dev/null +++ b/lib/ds/rdtp/rdtp0110.c @@ -0,0 +1,183 @@ +/* + * FILE %ds/rdtp/rdtp0110.c + * + * restructured dynamic text parser + * analyze state table to create a global character class mapping table + * + * written: 1996-04-02 + * latest update: 1997-01-15 10:47:27 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/**** #define DEBUG ****/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_process1_state_table ( +struct RDTP_GENERATOR *gen, +struct RDTP_STATE_DEFINITION *st) +{ + struct RDTP_STATE_TRANSITION *t1, *t2; + int defined_classes= 1; + int found_class; + int *local_class_table; + int i; + int g, g2, l; + int class_count= 0; /* new number of global classes */ + struct YTREE *yt_map= (struct YTREE *) 0; + struct YTREE *yt; + char pair [20]; + + if (gen == (struct RDTP_GENERATOR *) 0 + || st == (struct RDTP_STATE_DEFINITION *) 0 + || !(st->state_used) /* otherwise dont care */ + ) + return 0; + +#ifdef DEBUG + printf (">> GEN state: %s (pass 1)\n", st->state_name); +#endif /* DEBUG */ + + /* step 1: identify different classes in this state */ + for (t1= st->trans; + t1 != (struct RDTP_STATE_TRANSITION *) 0; + t1= t1->next) + { +#ifdef DEBUG + rdtp_print_state_entry (stdout, t1, "P1: "); +#endif /* DEBUG */ + + /* search for the identical combination of (method,state_to,info) */ + found_class= -1; + for (t2= st->trans; + t2 != t1 && t2 != (struct RDTP_STATE_TRANSITION *) 0; + t2= t2->next) + { +#ifdef DEBUG + rdtp_print_state_entry (stdout, t2, " compare: "); +#endif /* DEBUG */ + + if (t1->method == t2->method + && strcmp (t1->state_to, t2->state_to) == 0 + && strcmp (t1->method_info, t2->method_info) == 0 /* TEST */ + ) + { + found_class= t2->class_code; + break; + } + } + + if (found_class == -1) + { /* a new class */ +#ifdef DEBUG + printf (" >> new class %d\n", defined_classes); +#endif /* DEBUG */ + + t1->class_code= defined_classes++; + } + else + { /* the same as something before */ +#ifdef DEBUG + printf (" >> old class %d\n", found_class); +#endif /* DEBUG */ + + t1->class_code= found_class; + } + } + +#ifdef DEBUG + printf (">> GEN %d classes in total\n", defined_classes); +#endif /* DEBUG */ + if ((local_class_table= calloc (sizeof (int), 256)) == (int *) 0) + { + printf (">> GEN can't create temp mapping tables (1)\n"); + return -1; + } + + /* step 2: colorize full character table */ + for (t1= st->trans; + t1 != (struct RDTP_STATE_TRANSITION *) 0; + t1= t1->next) + { +#ifdef DEBUG + rdtp_print_state_entry (stdout, t1, "P2: "); + printf (" >>> class_code=%d\n", t1->class_code); +#endif /* DEBUG */ + + for (i= (int) t1->range_begin; i <= (int) t1->range_end; i++) + { /* table is arranged from more specific to less specific, */ + /* if ranges are ambigious */ + if (local_class_table [i] == 0) local_class_table [i]= t1->class_code; + } + } + + /* step 3: map local classes onto global class table */ +#ifdef DEBUG + printf ("defined_classes= %d\n", gen->defined_classes); + printf ("index: . GLOB LOC\n"); +#endif /* DEBUG */ + + class_count= 0; + for (i= 0; i < 256; i++) + { + g= gen->class_table [i]; + l= local_class_table [i]; + sprintf (pair, "%02X:%02X", g, l); + +#ifdef DEBUG + printf (" 0x%02X: %c %4d %4d '%s'", + i, + (i > 0x20 && i < 0x7f) ? i : '.', + g, l, pair); +#endif /* DEBUG */ + + if ((yt= ytree_insert_word (&yt_map, (unsigned char *) pair)) + == (struct YTREE *) 0) + { + printf (">> GEN can't create temp hash table\n"); + ytree_free (yt_map); + free (local_class_table); + return -1; + } + + if (yt->YT_flags & YTflag_EOW) + { +#ifdef DEBUG + printf (" ** known combination"); +#endif /* DEBUG */ + g2= (int) yt->YT_info; + gen->class_table [i]= g2; + } + else + { /* new entry */ + g= class_count++; + gen->class_table [i]= g; + + yt->YT_info= (long) g; + yt->YT_flags |= YTflag_EOW; + +#ifdef DEBUG + printf (" ** new combination g=%d", g); +#endif /* DEBUG */ + } + +#ifdef DEBUG + printf (" -> g=%d\n", gen->class_table [i]); +#endif /* DEBUG */ + } + + gen->defined_classes= class_count; + ytree_free (yt_map); + free (local_class_table); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0110.o b/lib/ds/rdtp/rdtp0110.o new file mode 100644 index 0000000000000000000000000000000000000000..0a9513a5d1f181e5421528b6c0d825e505460498 Binary files /dev/null and b/lib/ds/rdtp/rdtp0110.o differ diff --git a/lib/ds/rdtp/rdtp0111.c b/lib/ds/rdtp/rdtp0111.c new file mode 100644 index 0000000000000000000000000000000000000000..e109d443498f7d3d675a1b3fb8393c0aaa359c2a --- /dev/null +++ b/lib/ds/rdtp/rdtp0111.c @@ -0,0 +1,56 @@ +/* + * FILE %ds/rdtp/rdtp0111.c + * + * restructured dynamic text parser + * allocate memory for the runtime state transition tables + * + * written: 1996-04-02 + * latest update: 1996-04-02 21:43:28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_process2_state_table ( +struct RDTP_GENERATOR *gen, +struct RDTP_STATE_DEFINITION *st) +{ + struct RDTP_STATE *stt; /* runtime form of the state table */ + int defined_classes; + + if (gen == (struct RDTP_GENERATOR *) 0 + || st == (struct RDTP_STATE_DEFINITION *) 0 + || !(st->state_used) /* otherwise dont care */ + || (st->state= stt= (struct RDTP_STATE *) + calloc (sizeof (struct RDTP_STATE), 1)) + == (struct RDTP_STATE *) 0 + || (defined_classes= gen->defined_classes) <= 0 + || (stt->new_states= (struct RDTP_STATE **) + calloc (sizeof (struct RDTP_STATE *), defined_classes)) + == (struct RDTP_STATE **) 0 + || (stt->transitions= (RDTP_state_transition **) + calloc (sizeof (RDTP_state_transition *), defined_classes)) + == (RDTP_state_transition **) 0 +#ifdef RDTP_DEBUG + || (stt->transition_info= (char **) + calloc (sizeof (char *), defined_classes)) + == (char **) 0 +#endif /* RDTP_DEBUG */ + ) + return 0; + +#ifdef RDTP_DEBUG + printf (">> GEN state: %s (pass 2)\n", st->state_name); +#endif /* RDTP_DEBUG */ + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0111.o b/lib/ds/rdtp/rdtp0111.o new file mode 100644 index 0000000000000000000000000000000000000000..eaa3aa348c05a4cec21ca220b775435c1d0b77e2 Binary files /dev/null and b/lib/ds/rdtp/rdtp0111.o differ diff --git a/lib/ds/rdtp/rdtp0112.c b/lib/ds/rdtp/rdtp0112.c new file mode 100644 index 0000000000000000000000000000000000000000..6a6f02f2f7c5a63295f68f8ff8d7a15acea52bf0 --- /dev/null +++ b/lib/ds/rdtp/rdtp0112.c @@ -0,0 +1,88 @@ +/* + * FILE %ds/rdtp/rdtp0112.c + * + * restructured dynamic text parser + * assign values to the runtime state transition tables + * + * written: 1996-04-02 + * latest update: 1997-01-15 10:48:04 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_process3_state_table ( +struct RDTP_GENERATOR *gen, +struct RDTP_STATE_DEFINITION *st) +{ + struct RDTP_STATE_TRANSITION *t1; /* setup form of a state transition */ + struct RDTP_STATE_DEFINITION *st2; + struct RDTP_STATE *stt; /* runtime form of the state table */ + + struct RDTP_STATE **new_states; + RDTP_state_transition **transitions; +#ifdef RDTP_DEBUG + char **transition_info; +#endif /* RDTP_DEBUG */ + + int class; + int ch; + + if (gen == (struct RDTP_GENERATOR *) 0 + || st == (struct RDTP_STATE_DEFINITION *) 0 + || !(st->state_used) /* otherwise dont care */ + || (stt= st->state) == (struct RDTP_STATE *) 0 + || (new_states= stt->new_states) == (struct RDTP_STATE **) 0 + || (transitions= stt->transitions) == (RDTP_state_transition **) 0 +#ifdef RDTP_DEBUG + || (transition_info= stt->transition_info) == (char **) 0 +#endif /* RDTP_DEBUG */ + ) + return 0; + +#ifdef RDTP_DEBUG + printf (">> GEN state: %s (pass 3)\n", st->state_name); + stt->state_name= st->state_name; +#endif /* RDTP_DEBUG */ + + /* step 1: identify different classes in this state */ + for (t1= st->trans; + t1 != (struct RDTP_STATE_TRANSITION *) 0; + t1= t1->next) + { + for (ch= (int) t1->range_begin; ch <= (int) t1->range_end; ch++) + { + class= gen->class_table [ch]; + + /* define values if not already defined */ + if (new_states [class] == (struct RDTP_STATE *) 0 + && transitions [class] == (RDTP_state_transition *) 0 + ) + { + if ((st2= (struct RDTP_STATE_DEFINITION *) + ytree_get_value (gen->state_names, + (unsigned char *) t1->state_to)) + != (struct RDTP_STATE_DEFINITION *) 0 + ) + new_states [class]= st2->state; + + transitions [class]= t1->method; + +#ifdef RDTP_DEBUG + transition_info [class]= t1->method_info; +#endif /* RDTP_DEBUG */ + } + } + } + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0112.o b/lib/ds/rdtp/rdtp0112.o new file mode 100644 index 0000000000000000000000000000000000000000..f10a3cf621bd409a096a595cb93dc6d7a4058518 Binary files /dev/null and b/lib/ds/rdtp/rdtp0112.o differ diff --git a/lib/ds/rdtp/rdtp0113.c b/lib/ds/rdtp/rdtp0113.c new file mode 100644 index 0000000000000000000000000000000000000000..73cfa03e583ea220aec5cf007eb1334e55f9189c --- /dev/null +++ b/lib/ds/rdtp/rdtp0113.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/rdtp/rdtp0113.c + * + * restructured dynamic text parser + * + * written: 1996-04-02 + * latest update: 1996-04-02 21:43:35 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_pass2_transformation (struct YTREE *yt, void *cd) +{ + if (yt == (struct YTREE *) 0 || !(yt->YT_flags & YTflag_EOW)) return 0; + + return rdtp_process2_state_table ( + (struct RDTP_GENERATOR *) cd, + (struct RDTP_STATE_DEFINITION *) yt->YT_info); +} diff --git a/lib/ds/rdtp/rdtp0113.o b/lib/ds/rdtp/rdtp0113.o new file mode 100644 index 0000000000000000000000000000000000000000..51bc7d619403926561cb7414c7a1da8b90c03b75 Binary files /dev/null and b/lib/ds/rdtp/rdtp0113.o differ diff --git a/lib/ds/rdtp/rdtp0114.c b/lib/ds/rdtp/rdtp0114.c new file mode 100644 index 0000000000000000000000000000000000000000..fd694c797a4ff49ec984f950c05117755289516e --- /dev/null +++ b/lib/ds/rdtp/rdtp0114.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/rdtp/rdtp0114.c + * + * restructured dynamic text parser + * + * written: 1996-04-02 + * latest update: 1996-04-02 14:08:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_pass3_transformation (struct YTREE *yt, void *cd) +{ + if (yt == (struct YTREE *) 0 || !(yt->YT_flags & YTflag_EOW)) return 0; + + return rdtp_process3_state_table ( + (struct RDTP_GENERATOR *) cd, + (struct RDTP_STATE_DEFINITION *) yt->YT_info); +} diff --git a/lib/ds/rdtp/rdtp0114.o b/lib/ds/rdtp/rdtp0114.o new file mode 100644 index 0000000000000000000000000000000000000000..1394b8d5f8f5ca721e9864b5ec9ee537a1d2f797 Binary files /dev/null and b/lib/ds/rdtp/rdtp0114.o differ diff --git a/lib/ds/rdtp/rdtp0115.c b/lib/ds/rdtp/rdtp0115.c new file mode 100644 index 0000000000000000000000000000000000000000..fbcf838b6120055292ec3d5a3f56dc954ec21003 --- /dev/null +++ b/lib/ds/rdtp/rdtp0115.c @@ -0,0 +1,70 @@ +/* + * FILE %ds/rdtp/rdtp0115.c + * + * restructured dynamic text parser + * drop any old state table + * + * written: 1996-04-02 + * latest update: 1996-06-22 12:50:54 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_drop_state_table ( +struct RDTP_GENERATOR *gen, +struct RDTP_STATE_DEFINITION *st) +{ + struct RDTP_STATE *stt; /* runtime form of the state table */ +#ifdef NOT_USED + struct RDTP_STATE **new_states; + RDTP_state_transition **transitions; +#ifdef RDTP_DEBUG + char **transition_info; +#endif /* RDTP_DEBUG */ +#endif /* NOT_USED */ + + if (gen == (struct RDTP_GENERATOR *) 0 + || st == (struct RDTP_STATE_DEFINITION *) 0 + || (stt= st->state) == (struct RDTP_STATE *) 0 + ) + return 0; + + /* NOTE: ignores st->state_used and drops even those tables */ + + printf (">> GEN state: %s (drop tables)\n", st->state_name); + +#ifdef NOT_USED + if ((new_states= stt->new_states) != (struct RDTP_STATE **) 0) + free (new_states); + + if ((transitions= stt->transitions) != (RDTP_state_transition **) 0) + free (transitions); + +#ifdef RDTP_DEBUG + if ((transition_info= stt->transition_info) != (char **) 0) + free (transition_info); +#endif /* RDTP_DEBUG */ +#endif /* NOT_USED */ + + free_or_what ((void *) stt->new_states); + free_or_what ((void *) stt->transitions); +#ifdef RDTP_DEBUG + free_or_what ((void *) stt->transition_info); +#endif /* RDTP_DEBUG */ + + free (stt); + st->state= (struct RDTP_STATE *) 0; + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0115.o b/lib/ds/rdtp/rdtp0115.o new file mode 100644 index 0000000000000000000000000000000000000000..1e22f201654ea3678910ec6ddb1c0996224b9efc Binary files /dev/null and b/lib/ds/rdtp/rdtp0115.o differ diff --git a/lib/ds/rdtp/rdtp0116.c b/lib/ds/rdtp/rdtp0116.c new file mode 100644 index 0000000000000000000000000000000000000000..a93ff3467cb7d855da50262caeb0868ad0a8f0dc --- /dev/null +++ b/lib/ds/rdtp/rdtp0116.c @@ -0,0 +1,50 @@ +/* + * FILE %ds/rdtp/rdtp0116.c + * + * restructured dynamic text parser + * + * written: 1996-04-02 + * latest update: 1996-04-02 18:48:38 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +/* ------------------------------------------------------------------------ */ +int rdtp_print_state_entry ( +FILE *fo, +struct RDTP_STATE_TRANSITION *tr, +char *pfx) +{ + long beg; + long end; + + beg= tr->range_begin; + end= tr->range_end; + + fputs (pfx, fo); + if (beg > 0x20 && beg < 0x7F && end > 0x20 && end < 0x7F) + { + if (beg == end) + fprintf (fo, "[%c]", (int) beg); + else + fprintf (fo, "[%c..%c]", (int) beg, (int) end); + } + else + { + fprintf (fo, "[0x%02lX..0x%02lX]", beg, end); + } + + fprintf (fo, " -> %s", tr->state_to); + if (tr->method_info != (char *) 0) + fprintf (fo, " (%s)", tr->method_info); + fputc ('\n', fo); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0116.o b/lib/ds/rdtp/rdtp0116.o new file mode 100644 index 0000000000000000000000000000000000000000..283e0ad0aea2cb6b539d5c3acfe6c995d337a865 Binary files /dev/null and b/lib/ds/rdtp/rdtp0116.o differ diff --git a/lib/ds/rdtp/rdtp0201.c b/lib/ds/rdtp/rdtp0201.c new file mode 100644 index 0000000000000000000000000000000000000000..15b145c6e1093bd0f2d1336f3e99d7ec14a25390 --- /dev/null +++ b/lib/ds/rdtp/rdtp0201.c @@ -0,0 +1,114 @@ +/* + * FILE %ds/rdtp/rdtp0201.c + * + * restructured dynamic text parser: RTF processor + * + * written: 1996-04-01 + * latest update: 1997-01-15 10:52:37 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp02.h> + +/* ------------------------------------------------------------------------ */ +static char + _[]= "?", + collect[]= "collect", + ignore[]= "ignore", /* uninterpreted chars */ + literal[]= "literal", + new_group[]= "new_group", + new_control[]= "new_control", + close_group[]= "close_group", + cmd_name[]= "cmd_name", + hex[]= "hex", + par_end[]= "par_end"; + +/* ------------------------------------------------------------------------ */ +static struct RDTP_STATIC_STATE_TABLE rtf_states [] = +{ +/*. . . . . . */ +{ "START", "START", 0x20, 0xFF, collect, rtf_nop }, +{ "START", "START", 0x09, 0x09, collect, rtf_nop }, +{ "START", "START", 0x0A, 0x0A, ignore, rtf_nop }, +{ "START", "START", 0x0C, 0x0C, ignore, rtf_nop }, +{ "START", "START", 0x0D, 0x0D, ignore, rtf_nop }, +{ "START", "START", '{', '{', new_group, rtf_nop }, +{ "START", "START", '}', '}', close_group, rtf_nop }, +{ "START", "Ctrl", '\\', '\\', new_control, rtf_nop }, + +{ "Ctrl", "START", '\\', '\\', literal, rtf_nop }, +{ "Ctrl", "START", '{', '{', literal, rtf_nop }, +{ "Ctrl", "START", '}', '}', literal, rtf_nop }, +{ "Ctrl", "START", '*', '*', "comment", rtf_nop }, +{ "Ctrl", "START", ':', ':', "index item?", rtf_nop }, +{ "Ctrl", "START", '~', '~', "fixed space", rtf_nop }, +{ "Ctrl", "START", '-', '-', "nonrquired hyphen", rtf_nop }, +{ "Ctrl", "START", '_', '_', "nobreaking hyphen", rtf_nop }, +{ "Ctrl", "START", '|', '|', "formula begin", rtf_nop }, +{ "Ctrl", "HEX1", '\'', '\'', hex, rtf_nop }, +{ "Ctrl", "Cmd", 'A', 'Z', cmd_name, rtf_cmd_name_begin }, +{ "Ctrl", "Cmd", 'a', 'z', cmd_name, rtf_cmd_name_begin }, + +{ "Cmd", "Cmd", 'A', 'Z', cmd_name, rtf_cmd_name }, +{ "Cmd", "Cmd", 'a', 'z', cmd_name, rtf_cmd_name }, +{ "Cmd", "Par", '0', '9', _, rtf_cmd_name_end }, +{ "Cmd", "Par", '-', '-', _, rtf_cmd_name_end }, +{ "Cmd", "Ctrl", '\\', '\\', new_control, rtf_cmd_name_end }, +{ "Cmd", "START", '}', '}', close_group, rtf_cmd_name_end }, +{ "Cmd", "START", '{', '{', new_group, rtf_cmd_name_end }, +{ "Cmd", "START", '$', '$', _, rtf_cmd_name_end }, +{ "Cmd", "START", ' ', ' ', _, rtf_cmd_name_end }, +{ "Cmd", "START", '\t', '\t', _, rtf_cmd_name_end }, +{ "Cmd", "START", 0x0A, 0x0A, _, rtf_cmd_name_end }, +{ "Cmd", "START", 0x0D, 0x0D, _, rtf_cmd_name_end }, +{ "Cmd", "START", ';', ';', _, rtf_cmd_name_end }, + +{ "Par", "START", 0x20, 0x7F, collect, rtf_nop }, +{ "Par", "Par", '0', '9', _, rtf_nop }, +{ "Par", "Ctrl", '\\', '\\', new_control, rtf_nop }, +{ "Par", "START", '}', '}', close_group, rtf_nop }, +{ "Par", "START", '{', '{', new_group, rtf_nop }, +{ "Par", "START", ' ', ' ', par_end, rtf_nop }, +{ "Par", "START", '\t', '\t', par_end, rtf_nop }, +{ "Par", "START", 0x0A, 0x0A, par_end, rtf_nop }, +{ "Par", "START", 0x0D, 0x0D, par_end, rtf_nop }, +{ "Par", "START", ';', ';', par_end, rtf_nop }, + +{ "HEX1", "HEX2", '0', '9', _, rtf_nop }, +{ "HEX1", "HEX2", 'a', 'f', _, rtf_nop }, +{ "HEX1", "HEX2", 'A', 'F', _, rtf_nop }, + +{ "HEX2", "START", '0', '9', _, rtf_nop }, +{ "HEX2", "START", 'a', 'f', _, rtf_nop }, +{ "HEX2", "START", 'A', 'F', _, rtf_nop }, + +{ (char *) 0, (char *) 0, 0, 0, (char *) 0, (RDTP_state_transition *) 0 } +} ; + +/* ------------------------------------------------------------------------ */ +struct RDTP_GENERATOR *rtf_setup_parser (char *name) +{ + struct RDTP_GENERATOR *gen= (struct RDTP_GENERATOR *) 0; + + if ((gen= calloc (sizeof (struct RDTP_GENERATOR), 1)) + != (struct RDTP_GENERATOR *) 0 + ) + { + rdtp_load_static_table (gen, rtf_states); + gen->generator_name= strdup (name); + gen->start_state= strdup ("START"); + + gen->method_for_undefined_state= rtf_error; + gen->method_for_undefined_input= rtf_error; + } + + return gen; +} diff --git a/lib/ds/rdtp/rdtp0201.o b/lib/ds/rdtp/rdtp0201.o new file mode 100644 index 0000000000000000000000000000000000000000..1835e87af04a7515b1162da7e9cf315c40cdee36 Binary files /dev/null and b/lib/ds/rdtp/rdtp0201.o differ diff --git a/lib/ds/rdtp/rdtp0202.c b/lib/ds/rdtp/rdtp0202.c new file mode 100644 index 0000000000000000000000000000000000000000..42afbfcae31e4d55541b72d6d713be09e92177c9 --- /dev/null +++ b/lib/ds/rdtp/rdtp0202.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/rdtp/rdtp0202.c + * + * restructured dynamic text parser + * + * written: 1996-04-02 + * latest update: 1997-01-15 10:48:51 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp02.h> + +/* ------------------------------------------------------------------------ */ +int rtf_nop (void *thrp, int ch) +{ +#ifdef MSDOS + thrp; + ch; +#endif + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0202.o b/lib/ds/rdtp/rdtp0202.o new file mode 100644 index 0000000000000000000000000000000000000000..b7ec959a66ae465f3042a87abe578f3ac0493cb4 Binary files /dev/null and b/lib/ds/rdtp/rdtp0202.o differ diff --git a/lib/ds/rdtp/rdtp0203.c b/lib/ds/rdtp/rdtp0203.c new file mode 100644 index 0000000000000000000000000000000000000000..451cde6b75f319fccc2e9409d2221dc6ce66acbe --- /dev/null +++ b/lib/ds/rdtp/rdtp0203.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/rdtp/rdtp0203.c + * + * restructured dynamic text parser + * + * written: 1996-04-02 + * latest update: 1997-06-17 14:01:50 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp02.h> + +/* ------------------------------------------------------------------------ */ +int rtf_error (void *thrp, int ch) +{ + struct RDTP_THREAD *thr; + + if ((thr= (struct RDTP_THREAD *) thrp) == (struct RDTP_THREAD *) 0) + return -1; + + printf ( + "rtf_error: undefined state (processing 0x%02x), resetting to start!\n", + ch); + + thr->current_state= thr->class->start_state; + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0203.o b/lib/ds/rdtp/rdtp0203.o new file mode 100644 index 0000000000000000000000000000000000000000..0eefda20d9ba3d1154a64472b2ae96acba9994bc Binary files /dev/null and b/lib/ds/rdtp/rdtp0203.o differ diff --git a/lib/ds/rdtp/rdtp0204.c b/lib/ds/rdtp/rdtp0204.c new file mode 100644 index 0000000000000000000000000000000000000000..59140fad22b7c5f6a9bf56ea391b04cedaafdc49 --- /dev/null +++ b/lib/ds/rdtp/rdtp0204.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/rdtp/rdtp0204.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1997-01-15 10:49:52 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp02.h> + +/* ------------------------------------------------------------------------ */ +int rtf_cmd_name_begin (void *thrp, int ch) +{ + struct RTF_BUILDUP *rtf; + struct RDTP_THREAD *thr; + + if ((thr= (struct RDTP_THREAD *) thrp) == (struct RDTP_THREAD *) 0 + || (rtf= thr->payload) == (struct RTF_BUILDUP *) 0 + ) + { + fprintf (stderr, "rdtp0204: bad thread\n"); + return -1; + } + + rtf->bl1 [0]= (char) ch; + rtf->bl1_cnt= 1; + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0204.o b/lib/ds/rdtp/rdtp0204.o new file mode 100644 index 0000000000000000000000000000000000000000..e3338dd4682bb98d2cb79f35b713b0c2042f413d Binary files /dev/null and b/lib/ds/rdtp/rdtp0204.o differ diff --git a/lib/ds/rdtp/rdtp0205.c b/lib/ds/rdtp/rdtp0205.c new file mode 100644 index 0000000000000000000000000000000000000000..606355ffa9b166a378c101c776298e983710e6f3 --- /dev/null +++ b/lib/ds/rdtp/rdtp0205.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/rdtp/rdtp0205.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1997-01-15 10:51:00 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp02.h> + +/* ------------------------------------------------------------------------ */ +int rtf_cmd_name (void *thrp, int ch) +{ + struct RTF_BUILDUP *rtf; + struct RDTP_THREAD *thr; + + if ((thr= (struct RDTP_THREAD *) thrp) == (struct RDTP_THREAD *) 0 + || (rtf= thr->payload) == (struct RTF_BUILDUP *) 0 + ) + { + fprintf (stderr, "rdtp0204: bad thread\n"); + return -1; + } + + if (rtf->bl1_cnt < TMP_BL_SIZE -1) + rtf->bl1 [rtf->bl1_cnt++]= (char) ch; + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0205.o b/lib/ds/rdtp/rdtp0205.o new file mode 100644 index 0000000000000000000000000000000000000000..5b6157500c5396e16cd723c1d00cdebac49622eb Binary files /dev/null and b/lib/ds/rdtp/rdtp0205.o differ diff --git a/lib/ds/rdtp/rdtp0206.c b/lib/ds/rdtp/rdtp0206.c new file mode 100644 index 0000000000000000000000000000000000000000..5cc22557d9756687465dc279e7333a2941ba5b0b --- /dev/null +++ b/lib/ds/rdtp/rdtp0206.c @@ -0,0 +1,66 @@ +/* + * FILE %ds/rdtp/rdtp0206.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1997-01-15 10:52:13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp02.h> + +/* ------------------------------------------------------------------------ */ +int rtf_cmd_name_end (void *thrp, int ch) +{ + struct RTF_BUILDUP *rtf; + struct YTREE *yt; + struct RTF_COMMAND_NAME *cmd; + struct RDTP_THREAD *thr; + + if ((thr= (struct RDTP_THREAD *) thrp) == (struct RDTP_THREAD *) 0 + || (rtf= thr->payload) == (struct RTF_BUILDUP *) 0 + ) + { + fprintf (stderr, "rdtp0204: bad thread\n"); + return -1; + } + +#ifdef MSDOS + ch; +#endif /* MSDOS */ + + rtf->bl1 [rtf->bl1_cnt]= 0; + /* printf ("rtf: name='%s'\n", rtf->bl1); */ + + if ((yt= ytree_insert_word (&rtf->names, (unsigned char *) rtf->bl1)) + == (struct YTREE *) 0) return -1; + + /* create a new command statistics control structure */ + if (!(yt->YT_flags & YTflag_EOW) + || (cmd= (struct RTF_COMMAND_NAME *) yt->YT_info) + == (struct RTF_COMMAND_NAME *) 0 + ) + { + if ((cmd= (struct RTF_COMMAND_NAME *) + calloc (sizeof (struct RTF_COMMAND_NAME), 1)) + == (struct RTF_COMMAND_NAME *) 0) return -1; + + yt->YT_flags |= YTflag_EOW; + yt->YT_info= (long) cmd; + cmd->cmd_name= strdup (rtf->bl1); + } + + cmd->counter++; + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0206.o b/lib/ds/rdtp/rdtp0206.o new file mode 100644 index 0000000000000000000000000000000000000000..d1ab91795e7fedfc6ae86aa1fb802bccc39a3b20 Binary files /dev/null and b/lib/ds/rdtp/rdtp0206.o differ diff --git a/lib/ds/rdtp/rdtp0207.c b/lib/ds/rdtp/rdtp0207.c new file mode 100644 index 0000000000000000000000000000000000000000..a4345c8c13b311951dcb5ef4fdb4de176f7faa83 --- /dev/null +++ b/lib/ds/rdtp/rdtp0207.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/rdtp/rdtp0207.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1997-06-17 14:14:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp02.h> + +/* ------------------------------------------------------------------------ */ +int rtf_print_statistics (struct RDTP_THREAD *thr) +{ + struct RTF_BUILDUP *rtf; + + if (thr == (struct RDTP_THREAD *) 0 + || (rtf= (struct RTF_BUILDUP *) thr->payload) + == (struct RTF_BUILDUP *) 0 + ) + { + fprintf (stderr, "rdtp0205: bad thread!\n"); + return -1; + } + + ytree_process_info (rtf->names, rtf_print_name_statistics, (void *) 0); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0207.o b/lib/ds/rdtp/rdtp0207.o new file mode 100644 index 0000000000000000000000000000000000000000..3c842c532214547317fdb287fc34469031520c8d Binary files /dev/null and b/lib/ds/rdtp/rdtp0207.o differ diff --git a/lib/ds/rdtp/rdtp0208.c b/lib/ds/rdtp/rdtp0208.c new file mode 100644 index 0000000000000000000000000000000000000000..4f9bda1e4755a77b8908fffac34c61184532f337 --- /dev/null +++ b/lib/ds/rdtp/rdtp0208.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/rdtp/rdtp0208.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1996-06-22 10:11:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp02.h> + +/* ------------------------------------------------------------------------ */ +int rtf_print_name_statistics (long cmd_info, void *thr_info) +{ + struct RTF_COMMAND_NAME *cmd; + + if ((cmd= (struct RTF_COMMAND_NAME *) cmd_info) + == (struct RTF_COMMAND_NAME *) 0) + { + fprintf (stderr, "rdtp0208: bad command record!\n"); + return -1; + } + +#ifdef MSDOS + thr_info; +#endif /* MSDOS */ + + printf ("command: %5ld '%s'\n", cmd->counter, cmd->cmd_name); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0208.o b/lib/ds/rdtp/rdtp0208.o new file mode 100644 index 0000000000000000000000000000000000000000..4a0993d604282c1a56b20a796e8b456fa880ac8c Binary files /dev/null and b/lib/ds/rdtp/rdtp0208.o differ diff --git a/lib/ds/rdtp/rdtp0300.c b/lib/ds/rdtp/rdtp0300.c new file mode 100644 index 0000000000000000000000000000000000000000..179923f26b88115a3e05dfa9e913c38be0942523 --- /dev/null +++ b/lib/ds/rdtp/rdtp0300.c @@ -0,0 +1,22 @@ +/* + * FILE %ds/rdtp/rdtp0300.c + * + * restructured dynamic text parser: SGML + * + * written: 1996-06-23 + * latest update: 1996-06-23 10:25:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ + +{ +} diff --git a/lib/ds/rdtp/rdtp0301.c b/lib/ds/rdtp/rdtp0301.c new file mode 100644 index 0000000000000000000000000000000000000000..d1acb8ab96dcfd58ea790a7f3fec26a97d22c3ea --- /dev/null +++ b/lib/ds/rdtp/rdtp0301.c @@ -0,0 +1,243 @@ +/* + * FILE %ds/rdtp/rdtp0301.c + * + * restructured dynamic text parser + * SGML concrete syntax + * + * written: 1996-04-02 + * latest update: 1997-01-15 10:55:48 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +static char + _[]= "?", + collect[]= "collect", + tagging[]= "tagging", + entity[]= "entity", + test_nonsense[]= "nonsense"; + +/* ------------------------------------------------------------------------ */ +static struct RDTP_STATIC_STATE_TABLE sgml_states [] = +{ +/*. . . . . . */ +{ "START", "START", 0x20, 0x7F, collect, sgml_collect }, +{ "START", "START", 0x09, 0x0D, collect, sgml_collect }, +{ "START", "TAGGING", '<', '<', tagging, sgml_new_element }, +{ "START", "ENTITYBEG", '&', '&', entity, sgml_new_element }, + +{ "TAGGING", "START", 0x20, 0x20, collect, sgml_collect2 }, /* barely legal SGML */ +{ "TAGGING", "START", 0x09, 0x0D, collect, sgml_collect2 }, /* barely legal SGML */ +{ "TAGGING", "DEF", '!', '!', _, sgml_nop }, +{ "TAGGING", "PI", '?', '?', _, sgml_nop }, +{ "TAGGING", "TAG", /*HYX*/ ':', ';', collect, sgml_name_begin }, +{ "TAGGING", "TAG", 'A', 'Z', collect, sgml_name_begin }, +{ "TAGGING", "TAG", 'a', 'z', collect, sgml_name_begin }, +{ "TAGGING", "TAGEND", '/', '/', collect, sgml_name_begin }, + +{ "TAG", "TAG", 'A', 'Z', collect, sgml_collect }, +{ "TAG", "TAG", 'a', 'z', collect, sgml_collect }, +{ "TAG", "TAG", '0', '9', collect, sgml_collect }, +{ "TAG", "TAG", '-', '-', collect, sgml_collect }, +{ "TAG", "TAG", '.', '.', collect, sgml_collect }, +{ "TAG", "START", '>', '>', collect, sgml_element_name_end }, +{ "TAG", "TAG-PAR", ' ', ' ', collect, sgml_element_name_end }, +{ "TAG", "TAG-PAR", 0x09, 0x0D, collect, sgml_element_name_end }, +{ "TAG", "minimized", '/', '/', collect, sgml_element_name_end }, +{ "TAG", "TAGGING", '<', '<', collect, sgml_element_name_end }, + +{ "TAG-PAR", "TAG-PAR", 0x09, 0x0D, collect, sgml_collect }, +{ "TAG-PAR", "TAG-PAR", 0x20, 0x7F, collect, sgml_collect }, +{ "TAG-PAR", "minimized", '/', '/', collect, sgml_nop }, +{ "TAG-PAR", "START", '>', '>', collect, sgml_nop }, + +{ "PI", "PI", 0x20, 0x7F, collect, sgml_collect }, +{ "PI", "START", '>', '>', collect, sgml_nop }, + +{ "TAGEND", "TAGEND", 0x20, 0x7F, collect, sgml_collect }, +{ "TAGEND", "START", '>', '>', collect, sgml_nop }, + +{ "minimized", "minimized", 0x00, 0x7F, collect, sgml_collect }, +{ "minimized", "START", '/', '/', collect, sgml_nop }, + +{ "DEF", "DEF2", 0x09, 0x0D, _, sgml_nop }, +{ "DEF", "DEF2", 0x20, 0x20, _, sgml_nop }, +{ "DEF", "DEF-Br1", '[', '[', _, sgml_nop }, +{ "DEF", "DEF3", 'A', 'Z', collect, sgml_name_begin }, +{ "DEF", "DEF3", 'a', 'z', collect, sgml_name_begin }, +{ "DEF", "START", '>', '>', _, sgml_nop }, +{ "DEF", "COM1a", '-', '-', _, sgml_nop }, + +{ "DEF2", "DEF2", 0x00, 0x7F, collect, sgml_collect }, +{ "DEF2", "COM1a", '-', '-', _, sgml_nop }, +{ "DEF2", "START", '>', '>', _, sgml_nop }, + +/* comment in declaration part */ +{ "COM1a", "DEF2", 0x00, 0x7F, _, sgml_nop }, + /* NOTE: just a single - doesn't mean anything, ERROR! */ +{ "COM1a", "COM1b", '-', '-', _, sgml_nop }, +{ "COM1b", "COM1b", 0x00, 0x7F, collect, sgml_collect }, +{ "COM1b", "COM1c", '-', '-', _, sgml_nop }, +{ "COM1c", "COM1b", 0x00, 0x7F, collect, sgml_collect }, +{ "COM1c", "DEF2", '-', '-', _, sgml_nop }, + +/* definition name */ +/* e.g SGML, DOCTYPE, ELEMENT, ATTLIST, ENTITY, SHORTREF, USEMAP, */ +/* NOTATION, LINKTYPE, LINK, USELINK, IDLINK */ +{ "DEF3", "DEF3", 'A', 'Z', collect, sgml_collect }, +{ "DEF3", "DEF3", 'a', 'z', collect, sgml_collect }, +{ "DEF3", "DECL", ' ', ' ', collect, sgml_declaration }, + /* end of the declaration name */ + +/* the body of any declaration part */ +{ "DECL", "DECL", 0x09, 0x0D, _, sgml_nop }, +{ "DECL", "DECL", ' ', ' ', _, sgml_nop }, +{ "DECL", "START", '[', '[', _, sgml_declaration_done }, + /* NOTE: PUSH META STATE */ +{ "DECL", "DECL-TOK", 'A', 'Z', _, sgml_decl_literal_beg }, +{ "DECL", "DECL-TOK", 'a', 'z', _, sgml_decl_literal_beg }, +{ "DECL", "DECL-TOK", '#', '#', _, sgml_decl_literal_beg }, + /* NOTE: this may be wrong */ +{ "DECL", "DECL-NUM", '0', '9', _, sgml_decl_num_beg }, +{ "DECL", "DECL-SQS", '\'', '\'', _, sgml_decl_sqs_beg }, +{ "DECL", "DECL-DQS", '\"', '\"', _, sgml_decl_dqs_beg }, +{ "DECL", "DECL", '?', '?', _, sgml_decl_symbol }, +{ "DECL", "DECL", '|', '|', _, sgml_decl_symbol }, +{ "DECL", "DECL", '(', ',', _, sgml_decl_symbol }, + /* NOTE: this is: ()*+, */ +{ "DECL", "DECL-DASH", '-', '-', _, sgml_nop }, +{ "DECL", "DECL-PCT", '%', '%', _, sgml_nop }, +{ "DECL", "START", '>', '>', _, sgml_declaration_done }, + +/* token in a definition */ +{ "DECL-TOK", "DECL-TOK", 'A', 'Z', collect, sgml_collect }, +{ "DECL-TOK", "DECL-TOK", 'a', 'z', collect, sgml_collect }, +{ "DECL-TOK", "DECL-TOK", '0', '9', collect, sgml_collect }, +{ "DECL-TOK", "DECL-TOK", '-', '-', collect, sgml_collect }, + /* NOTE: this may be wrong! */ +{ "DECL-TOK", "DECL-TOK", '_', '_', collect, sgml_collect }, +{ "DECL-TOK", "DECL-TOK", '.', '.', collect, sgml_collect }, +{ "DECL-TOK", "DECL", ' ', ' ', _, sgml_decl_token_end }, +{ "DECL-TOK", "DECL", 0x09, 0x0D, _, sgml_decl_token_end }, +{ "DECL-TOK", "DECL", '?', '?', _, sgml_decl_token_end }, +{ "DECL-TOK", "DECL", '|', '|', _, sgml_decl_token_end }, +{ "DECL-TOK", "DECL", '(', ',', _, sgml_decl_token_end }, + /* NOTE: this is: ()*+, */ +{ "DECL-TOK", "START", '>', '>', _, sgml_declaration_done2 }, + +/* a regular decimal number; used for ranks (?!?) */ +{ "DECL-NUM", "DECL-NUM", '0', '9', collect, sgml_collect }, +{ "DECL-NUM", "DECL", ' ', ' ', _, sgml_decl_token_end }, +{ "DECL-NUM", "DECL", 0x09, 0x0D, _, sgml_decl_token_end }, +{ "DECL-NUM", "DECL", '?', '?', _, sgml_decl_token_end }, +{ "DECL-NUM", "DECL", '|', '|', _, sgml_decl_token_end }, +{ "DECL-NUM", "DECL", '(', ',', _, sgml_decl_token_end }, + /* NOTE: this is: ()*+, */ +{ "DECL-NUM", "START", '>', '>', _, sgml_declaration_done2 }, + +/* single quoted string inside a declaration */ +{ "DECL-SQS", "DECL-SQS", 0x00, 0xFF, _, sgml_collect }, +{ "DECL-SQS", "DECL", '\'', '\'', _, sgml_decl_col_token_end }, + +/* double quoted string inside a declaration */ +{ "DECL-DQS", "DECL-DQS", 0x00, 0xFF, _, sgml_collect }, +{ "DECL-DQS", "DECL", '\"', '\"', _, sgml_decl_col_token_end }, +{ "DECL-DQS", "DECL-DQSBS", '\\', '\\', _, sgml_collect }, + +/* backslash within double quoted string */ +{ "DECL-DQSBS", "DECL-DQS", 0x00, 0xFF, _, sgml_collect }, + +/* comment in declaration part */ +{ "DECL-DASH", "DECL", 0x09, 0x0D, _, sgml_single_dash }, +{ "DECL-DASH", "DECL", ' ', ' ', _, sgml_single_dash }, +{ "DECL-DASH", "DECL", '(', '(', _, sgml_single_dash_gbeg }, +{ "DECL-DASH", "COM2b", '-', '-', _, sgml_nop }, +{ "COM2b", "COM2b", 0x00, 0x7F, _, sgml_nop }, +{ "COM2b", "COM2c", '-', '-', _, sgml_nop }, +{ "COM2c", "COM2b", 0x00, 0x7F, _, sgml_nop }, +{ "COM2c", "DECL", '-', '-', _, sgml_nop }, + +/* a percent sign may be the beginning of a declaration entity */ +/* or the definition of such a beast */ +{ "DECL-PCT", "DECL-ENT", 'A', 'Z', collect, sgml_par_ent_beg }, +{ "DECL-PCT", "DECL-ENT", 'a', 'z', collect, sgml_par_ent_beg }, +{ "DECL-PCT", "DECL", 0x09, 0x0D, _, sgml_single_pct }, +{ "DECL-PCT", "DECL", ' ', ' ', _, sgml_single_pct }, + +/* declaration entity */ +{ "DECL-ENT", "DECL-ENT", 'A', 'Z', collect, sgml_collect }, +{ "DECL-ENT", "DECL-ENT", 'a', 'z', collect, sgml_collect }, +{ "DECL-ENT", "DECL-ENT", '0', '9', collect, sgml_collect }, +{ "DECL-ENT", "DECL-ENT", '-', '-', collect, sgml_collect }, +{ "DECL-ENT", "DECL-ENT", '.', '.', collect, sgml_collect }, +{ "DECL-ENT", "DECL", ';', ';', collect, sgml_par_ent_end }, + +/* bracketed definitions */ +{ "DEF-Br1", "DEF-Br1", 0x09, 0x0D, _, sgml_nop }, +{ "DEF-Br1", "DEF-Br1", ' ', ' ', _, sgml_nop }, +{ "DEF-Br1", "DEF-Br2", 'a', 'z', _, sgml_name_begin }, +{ "DEF-Br1", "DEF-Br2", 'A', 'Z', _, sgml_name_begin }, +{ "DEF-Br2", "DEF-Br2", 'a', 'z', _, sgml_collect }, +{ "DEF-Br2", "DEF-Br2", 'A', 'Z', _, sgml_collect }, +{ "DEF-Br2", "DEF-Br2b", 0x09, 0x0D, _, sgml_element_name_end }, + /* NOTE: not a tag name! */ +{ "DEF-Br2", "DEF-Br2b", ' ', ' ', _, sgml_element_name_end }, +{ "DEF-Br2", "DEF-Brack", '[', '[', _, sgml_element_name_end }, +{ "DEF-Br2b", "DEF-Brack", '[', '[', _, sgml_nop }, +{ "DEF-Brack", "DEF-Brack", 0x00, 0xFF, _, sgml_collect }, +{ "DEF-Brack", "DEF-Br3", ']', ']', _, sgml_nop }, +{ "DEF-Br3", "DEF-Brack", 0x00, 0xFF, _, sgml_collect3 }, +{ "DEF-Br3", "DEFEND", ']', ']', _, sgml_nop }, +{ "DEFEND", "DEF-Brack", 0x00, 0xFF, _, sgml_collect3b }, +{ "DEFEND", "START", '>', '>', _, sgml_new_element }, + +{ "ENTITYBEG", "START", 0x00, 0xFF, _, sgml_new_element }, +{ "ENTITYBEG", "CHARREF", '#', '#', _, sgml_nop }, +{ "ENTITYBEG", "ENTITY", 'A', 'Z', _, sgml_name_begin }, +{ "ENTITYBEG", "ENTITY", 'a', 'z', _, sgml_name_begin }, + +{ "ENTITY", "START", 0x00, 0xFF, _, sgml_new_element }, +{ "ENTITY", "ENTITY", 'A', 'Z', _, sgml_collect }, +{ "ENTITY", "ENTITY", 'a', 'z', _, sgml_collect }, +{ "ENTITY", "ENTITY", '0', '9', _, sgml_collect }, +{ "ENTITY", "ENTITY", '.', '.', _, sgml_collect }, +{ "ENTITY", "ENTITY", '-', '-', _, sgml_collect }, +{ "ENTITY", "START", ';', ';', _, sgml_entity_name_end }, + +{ "CHARREF", "CHARREF2", '0', '9', _, sgml_collect }, +{ "CHARREF", "TAGGING", '<', '<', _, sgml_collect4 }, +{ "CHARREF2", "CHARREF2", '0', '9', _, sgml_collect }, +{ "CHARREF2", "START", ';', ';', _, sgml_nop }, + +{ (char *) 0, (char *) 0, 0, 0, (char *) 0, (RDTP_state_transition *) 0 } +} ; + +/* ------------------------------------------------------------------------ */ +struct RDTP_GENERATOR *sgml_setup_parser (char *name) +{ + struct RDTP_GENERATOR *gen= (struct RDTP_GENERATOR *) 0; + + if ((gen= calloc (sizeof (struct RDTP_GENERATOR), 1)) + != (struct RDTP_GENERATOR *) 0 + ) + { + rdtp_load_static_table (gen, sgml_states); + gen->generator_name= strdup (name); + gen->start_state= strdup ("START"); + + gen->method_for_undefined_state= sgml_error; + gen->method_for_undefined_input= sgml_error; + } + + return gen; +} diff --git a/lib/ds/rdtp/rdtp0301.o b/lib/ds/rdtp/rdtp0301.o new file mode 100644 index 0000000000000000000000000000000000000000..9102d10b0c94c50b3ed088eb2dc9f0c66d2961b1 Binary files /dev/null and b/lib/ds/rdtp/rdtp0301.o differ diff --git a/lib/ds/rdtp/rdtp0302.c b/lib/ds/rdtp/rdtp0302.c new file mode 100644 index 0000000000000000000000000000000000000000..8b378d858d2e95902cca0a16f5d3d76d7f33af5f --- /dev/null +++ b/lib/ds/rdtp/rdtp0302.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/rdtp/rdtp0302.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1996-09-14 22:21:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_nop (struct RDTP_THREAD *thr, int ch) +{ +#ifdef MSDOS + thr; + ch; +#endif + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0302.o b/lib/ds/rdtp/rdtp0302.o new file mode 100644 index 0000000000000000000000000000000000000000..88fd7a4d9fec567f0a0f13dd8aa9e687e3e47bf0 Binary files /dev/null and b/lib/ds/rdtp/rdtp0302.o differ diff --git a/lib/ds/rdtp/rdtp0303.c b/lib/ds/rdtp/rdtp0303.c new file mode 100644 index 0000000000000000000000000000000000000000..3b0cb1ac8b051c97c3e33d337e55e49dadd39b69 --- /dev/null +++ b/lib/ds/rdtp/rdtp0303.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/rdtp/rdtp0303.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1997-06-17 14:07:50 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_error (void *thrp, int ch) +{ + struct RDTP_THREAD *thr; + + if ((thr= (struct RDTP_THREAD *) thrp) == (struct RDTP_THREAD *) 0) + return -1; + + printf ( + "sgml_error: undefined state (processing 0x%02x), resetting to start!\n", + ch); + + thr->current_state= thr->class->start_state; + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0303.o b/lib/ds/rdtp/rdtp0303.o new file mode 100644 index 0000000000000000000000000000000000000000..7555f414cad76b68824b85f108cfc7f64c8e78d1 Binary files /dev/null and b/lib/ds/rdtp/rdtp0303.o differ diff --git a/lib/ds/rdtp/rdtp0304.c b/lib/ds/rdtp/rdtp0304.c new file mode 100644 index 0000000000000000000000000000000000000000..2a672e9fd243fa061a4ebf51460d02f9d5e23179 --- /dev/null +++ b/lib/ds/rdtp/rdtp0304.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/rdtp/rdtp0304.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1997-01-15 11:19:13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_name_begin (void *thrp, int ch) +{ + struct SGML_BUILDUP *sb; + struct RDTP_THREAD *thr; + + if ((thr= (struct RDTP_THREAD *) thrp) == (struct RDTP_THREAD *) 0 + || (sb= (struct SGML_BUILDUP *) thr->payload) + == (struct SGML_BUILDUP *) 0 + ) + { + fprintf (stderr, "rdtp0304: bad thread\n"); + return -1; + } + + sb->bl1 [0]= (char) ch; + sb->bl1_cnt= 1; + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0304.o b/lib/ds/rdtp/rdtp0304.o new file mode 100644 index 0000000000000000000000000000000000000000..d30b8e930b4f5f515690c2a32da40063be4cbabb Binary files /dev/null and b/lib/ds/rdtp/rdtp0304.o differ diff --git a/lib/ds/rdtp/rdtp0305.c b/lib/ds/rdtp/rdtp0305.c new file mode 100644 index 0000000000000000000000000000000000000000..04ec82862ba2649fdb7b53b5fc9010547ef180de --- /dev/null +++ b/lib/ds/rdtp/rdtp0305.c @@ -0,0 +1,77 @@ +/* + * FILE %ds/rdtp/rdtp0305.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1997-01-15 10:56:28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_collect (void *thrp, int ch) +{ + struct SGML_BUILDUP *sb; + struct RDTP_THREAD *thr; + + if ((thr= (struct RDTP_THREAD *) thrp) == (struct RDTP_THREAD *) 0 + || (sb= (struct SGML_BUILDUP *) thr->payload) + == (struct SGML_BUILDUP *) 0 + ) + { + fprintf (stderr, "rdtp0305: bad thread\n"); + return -1; + } + + if (sb->bl1_cnt >= TMP_BL_SIZE -1) sgml_flush_buffer (sb); + + sb->bl1 [sb->bl1_cnt++]= (char) ch; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int sgml_collect2 (struct RDTP_THREAD *thr, int ch) +{ + sgml_collect (thr, '<'); + return sgml_collect (thr, ch); +} + +/* ------------------------------------------------------------------------ */ +int sgml_collect3 (struct RDTP_THREAD *thr, int ch) +{ + sgml_collect (thr, ']'); + return sgml_collect (thr, ch); +} + +/* ------------------------------------------------------------------------ */ +int sgml_collect3b (struct RDTP_THREAD *thr, int ch) +{ + sgml_collect (thr, ']'); + sgml_collect (thr, ']'); + return sgml_collect (thr, ch); +} + +/* ------------------------------------------------------------------------ */ +int sgml_collect4 (struct RDTP_THREAD *thr, int ch) +{ + sgml_collect (thr, '&'); + sgml_collect (thr, '#'); + return sgml_new_element (thr, ch); +} + +/* ------------------------------------------------------------------------ */ +int sgml_collect5 (struct RDTP_THREAD *thr, int ch) +{ + sgml_collect (thr, '-'); + return sgml_collect (thr, ch); +} diff --git a/lib/ds/rdtp/rdtp0305.o b/lib/ds/rdtp/rdtp0305.o new file mode 100644 index 0000000000000000000000000000000000000000..d0182b00822bad9b46b6c3bde376502a1b612a53 Binary files /dev/null and b/lib/ds/rdtp/rdtp0305.o differ diff --git a/lib/ds/rdtp/rdtp0306.c b/lib/ds/rdtp/rdtp0306.c new file mode 100644 index 0000000000000000000000000000000000000000..8f6d83738241846cf20df3e7c4d0708ae74d0b58 --- /dev/null +++ b/lib/ds/rdtp/rdtp0306.c @@ -0,0 +1,73 @@ +/* + * FILE %ds/rdtp/rdtp0306.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1996-09-15 10:19:58 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_name_end ( +struct SGML_BUILDUP *sgml_structure, +int ch, +struct YTREE **name_table) +{ +#ifdef _JUNK_ + struct SGML_TAG_NAME *cmd; + struct YTREE *yt; + + if (sgml_structure == (struct SGML_BUILDUP *) 0 + || name_table == (struct YTREE **) 0 + ) + { + fprintf (stderr, "rdtp0204: bad thread\n"); + return -1; + } + +#ifdef MSDOS + ch; +#endif /* MSDOS */ + + sgml_structure->bl1 [sgml_structure->bl1_cnt]= 0; + printf ("sgml: name='%s'\n", sgml_structure->bl1); + + if ((yt= ytree_insert_word (name_table, (unsigned char *) sgml_structure->bl1)) + == (struct YTREE *) 0) return -1; + + /* create a new command statistics control structure */ + if (!(yt->YT_flags & YTflag_EOW) + || (cmd= (struct SGML_COMMAND_NAME *) yt->YT_info) + == (struct SGML_COMMAND_NAME *) 0 + ) + { + if ((cmd= (struct SGML_COMMAND_NAME *) + calloc (sizeof (struct SGML_COMMAND_NAME), 1)) + == (struct SGML_COMMAND_NAME *) 0) return -1; + + yt->YT_flags |= YTflag_EOW; + yt->YT_info= (long) cmd; + cmd->cmd_name= strdup (sgml_structure->bl1); + } + + cmd->counter++; + +#else +#ifdef MSDOS + sgml_structure; ch; name_table; +#endif /* MSDOS */ +#endif /* !_JUNK_ */ + return 0; +} diff --git a/lib/ds/rdtp/rdtp0306.o b/lib/ds/rdtp/rdtp0306.o new file mode 100644 index 0000000000000000000000000000000000000000..1982066c079fe8e673effb2cebf95002c0d08bb6 Binary files /dev/null and b/lib/ds/rdtp/rdtp0306.o differ diff --git a/lib/ds/rdtp/rdtp0307.c b/lib/ds/rdtp/rdtp0307.c new file mode 100644 index 0000000000000000000000000000000000000000..9419dea57fb5d83b260428770eb6a2487f3891ec --- /dev/null +++ b/lib/ds/rdtp/rdtp0307.c @@ -0,0 +1,41 @@ +/* + * FILE %ds/rdtp/rdtp0307.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1996-09-15 13:51:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_print_statistics (struct RDTP_THREAD *thr) +{ + struct SGML_BUILDUP *sb; + + if (thr == (struct RDTP_THREAD *) 0 + || (sb= (struct SGML_BUILDUP *) thr->payload) + == (struct SGML_BUILDUP *) 0 + ) + { + rdtp_bad_thread ("rdtp0307"); + return -1; + } + + printf ("tag names\n"); + ytree_process_info (sb->element_names, sgml_print_name_statistics, (void *) 0); + + printf ("entity names\n"); + ytree_process_info (sb->entity_names, sgml_print_name_statistics, (void *) 0); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0307.o b/lib/ds/rdtp/rdtp0307.o new file mode 100644 index 0000000000000000000000000000000000000000..f233381b62b3978c625bc308e674cae2bc1e9e25 Binary files /dev/null and b/lib/ds/rdtp/rdtp0307.o differ diff --git a/lib/ds/rdtp/rdtp0308.c b/lib/ds/rdtp/rdtp0308.c new file mode 100644 index 0000000000000000000000000000000000000000..edac68d47b97ac79d58f5ffa8e1c38f0af8def06 --- /dev/null +++ b/lib/ds/rdtp/rdtp0308.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/rdtp/rdtp0308.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1996-10-13 20:57:29 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_print_name_statistics (long cmd_info, void *thr_info) +{ + struct SGML_TAG_NAME *cmd; + + if ((cmd= (struct SGML_TAG_NAME *) cmd_info) + == (struct SGML_TAG_NAME *) 0) + { + fprintf (stderr, "rdtp0308: bad tag record!\n"); + return -1; + } + +#ifdef MSDOS + thr_info; +#endif /* MSDOS */ + + printf ("%5ld %5s '%s'\n", + cmd->ref_counter, + (cmd->tag_def == (struct SGML_ELEMENT_DECLARATION *) 0) + ? "UNDEF" : "DEF", + cmd->tag_name); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0308.o b/lib/ds/rdtp/rdtp0308.o new file mode 100644 index 0000000000000000000000000000000000000000..c6a80dcc049473b1421b175acb5ae7207487ec23 Binary files /dev/null and b/lib/ds/rdtp/rdtp0308.o differ diff --git a/lib/ds/rdtp/rdtp0309.c b/lib/ds/rdtp/rdtp0309.c new file mode 100644 index 0000000000000000000000000000000000000000..2557ec173980764d589fdf796e268fb6eb985f91 --- /dev/null +++ b/lib/ds/rdtp/rdtp0309.c @@ -0,0 +1,48 @@ +/* + * FILE %ds/rdtp/rdtp0309.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1997-06-16 13:57:09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_element_name_end (void *thrp, int ch) +{ + struct RDTP_THREAD *thr; + struct SGML_BUILDUP *sb; + char *element; + + if ((thr= (struct RDTP_THREAD *) thrp) == (struct RDTP_THREAD *) 0 + || (sb= (struct SGML_BUILDUP *) thr->payload) + == (struct SGML_BUILDUP *) 0 + ) + { + rdtp_bad_thread ("rdtp0309"); + return -1; + } + +#ifdef MSDOS + ch; +#endif + + sb->bl1 [sb->bl1_cnt]= 0; + sb->bl1_cnt= 0; + element= sb->bl1; + + return (sgml_add_element (sb, element) == (struct SGML_TAG_NAME *) 0) + ? -1 : 0; +} diff --git a/lib/ds/rdtp/rdtp0309.o b/lib/ds/rdtp/rdtp0309.o new file mode 100644 index 0000000000000000000000000000000000000000..e219971bc6ffc83a23b7cfe995198755c7826f03 Binary files /dev/null and b/lib/ds/rdtp/rdtp0309.o differ diff --git a/lib/ds/rdtp/rdtp0310.c b/lib/ds/rdtp/rdtp0310.c new file mode 100644 index 0000000000000000000000000000000000000000..417f7fddad4d1bfcb143700c101336700073bb32 --- /dev/null +++ b/lib/ds/rdtp/rdtp0310.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/rdtp/rdtp0310.c + * + * restructured dynamic text parser + * + * written: 1996-06-22 + * latest update: 1996-09-14 22:30:50 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_entity_name_end (struct RDTP_THREAD *thr, int ch) +{ + struct SGML_BUILDUP *rtf; + + if (thr == (struct RDTP_THREAD *) 0 + || (rtf= (struct SGML_BUILDUP *) thr->payload) + == (struct SGML_BUILDUP *) 0 + ) + { + fprintf (stderr, "rdtp0204: bad thread\n"); + return -1; + } + + return sgml_name_end (rtf, ch, &rtf->entity_names); +} diff --git a/lib/ds/rdtp/rdtp0310.o b/lib/ds/rdtp/rdtp0310.o new file mode 100644 index 0000000000000000000000000000000000000000..26c49af126a664412e148ac19c2216b5b7684d8b Binary files /dev/null and b/lib/ds/rdtp/rdtp0310.o differ diff --git a/lib/ds/rdtp/rdtp0311.c b/lib/ds/rdtp/rdtp0311.c new file mode 100644 index 0000000000000000000000000000000000000000..99f7c6a7215a09468ef693aeb2319877ac35f98d --- /dev/null +++ b/lib/ds/rdtp/rdtp0311.c @@ -0,0 +1,32 @@ +/* + * FILE %ds/rdtp/rdtp0311.c + * + * restructured dynamic text parser + * + * written: 1996-06-23 + * latest update: 1996-09-14 22:31:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +struct SGML_BUILDUP *sgml_initialize_buildup () +{ + struct SGML_BUILDUP *sgml_build= (struct SGML_BUILDUP *) 0; + + if ((sgml_build= (struct SGML_BUILDUP *) + calloc (sizeof (struct SGML_BUILDUP), 1)) + != (struct SGML_BUILDUP *) 0) + { + sgml_build->append= &sgml_build->document; + } + + return sgml_build; +} diff --git a/lib/ds/rdtp/rdtp0311.o b/lib/ds/rdtp/rdtp0311.o new file mode 100644 index 0000000000000000000000000000000000000000..4fae730507fb5be6559db7b86cc0d065c26a4162 Binary files /dev/null and b/lib/ds/rdtp/rdtp0311.o differ diff --git a/lib/ds/rdtp/rdtp0312.c b/lib/ds/rdtp/rdtp0312.c new file mode 100644 index 0000000000000000000000000000000000000000..8cc84e306a459e00b1c92b88b0218067c94f9dd0 --- /dev/null +++ b/lib/ds/rdtp/rdtp0312.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/rdtp/rdtp0312.c + * + * restructured dynamic text parser + * + * written: 1996-06-23 + * latest update: 1996-06-23 10:25:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_flush_buffer (struct SGML_BUILDUP *rtf) +{ + rtf->bl1 [rtf->bl1_cnt++]= 0; + + printf ("T2D flushing buffer: '%s'\n", rtf->bl1); + rtf->bl1_cnt= 0; + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0312.o b/lib/ds/rdtp/rdtp0312.o new file mode 100644 index 0000000000000000000000000000000000000000..9a8d34618c7b2bc5376a6333201bb64c7aadf13f Binary files /dev/null and b/lib/ds/rdtp/rdtp0312.o differ diff --git a/lib/ds/rdtp/rdtp0313.c b/lib/ds/rdtp/rdtp0313.c new file mode 100644 index 0000000000000000000000000000000000000000..50e1354d11ff4dc1eacc93960f328bd13c197b7d --- /dev/null +++ b/lib/ds/rdtp/rdtp0313.c @@ -0,0 +1,45 @@ +/* + * FILE %ds/rdtp/rdtp0313.c + * + * restructured dynamic text parser: SGML + * + * written: 1996-06-23 + * latest update: 1997-06-16 20:01:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +struct SGML_TAG_NAME *sgml_new_element_name ( +struct SGML_BUILDUP *ctx, +char *name) +{ + struct SGML_TAG_NAME *element= (struct SGML_TAG_NAME *) 0; + struct YTREE *yt; + + /***** printf ("new element name: '%s'\n", name); ******/ + + if ((element= calloc (sizeof (struct SGML_TAG_NAME), 1)) + != (struct SGML_TAG_NAME *) 0 + && (element->tag_name= strdup (name)) != (char *) 0 + ) + { + if ((yt= ytree_lookup_word (ctx->defined_element_names, name)) + != (struct YTREE *) 0 + && (yt->YT_flags & YTflag_EOW) + ) + element->tag_def= (struct SGML_ELEMENT_DECLARATION *) yt->YT_info; + } + + return element; +} diff --git a/lib/ds/rdtp/rdtp0313.o b/lib/ds/rdtp/rdtp0313.o new file mode 100644 index 0000000000000000000000000000000000000000..465b3895257c36a5b4eb087c5eaa7be2e4b92ff1 Binary files /dev/null and b/lib/ds/rdtp/rdtp0313.o differ diff --git a/lib/ds/rdtp/rdtp0314.c b/lib/ds/rdtp/rdtp0314.c new file mode 100644 index 0000000000000000000000000000000000000000..3ec3d25c26dde332fe289ac62d83542afbb088c7 --- /dev/null +++ b/lib/ds/rdtp/rdtp0314.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/rdtp/rdtp0314.c + * + * restructured dynamic text parser + * + * written: 1996-06-23 + * latest update: 1996-09-15 10:20:39 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_new_element (struct RDTP_THREAD *thr, int ch) +{ + struct SGML_BUILDUP *rtf; + +#ifdef MSDOS + ch; +#endif + + if (thr == (struct RDTP_THREAD *) 0 + || (rtf= (struct SGML_BUILDUP *) thr->payload) + == (struct SGML_BUILDUP *) 0 + ) + { + fprintf (stderr, "rdtp0305: bad thread\n"); + return -1; + } + + sgml_flush_buffer (rtf); + + /* T2D */ + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0314.o b/lib/ds/rdtp/rdtp0314.o new file mode 100644 index 0000000000000000000000000000000000000000..924c886177a50512f8be197e70d56fe0127d63e4 Binary files /dev/null and b/lib/ds/rdtp/rdtp0314.o differ diff --git a/lib/ds/rdtp/rdtp0315.c b/lib/ds/rdtp/rdtp0315.c new file mode 100644 index 0000000000000000000000000000000000000000..26e690079b490642d56d7f4cfd1248a92a8e24c0 --- /dev/null +++ b/lib/ds/rdtp/rdtp0315.c @@ -0,0 +1,50 @@ +/* + * FILE %ds/rdtp/rdtp0315.c + * + * restructured dynamic text parser + * + * written: 1996-09-15 + * latest update: 1996-09-15 12:40:33 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_declaration (struct RDTP_THREAD *thr, int ch) +{ + struct SGML_BUILDUP *sb; + char *decl; + +#ifdef MSDOS + ch; +#endif + + if (thr == (struct RDTP_THREAD *) 0 + || (sb= (struct SGML_BUILDUP *) thr->payload) + == (struct SGML_BUILDUP *) 0 + ) + { + rdtp_bad_thread ("rdtp0315"); + return -1; + } + + sb->bl1 [sb->bl1_cnt]= 0; + sb->bl1_cnt= 0; + decl= sb->bl1; + + /***** printf ("declaration: '%s'\n", decl); ******/ + sb->tokens= array_new (); + array_push (sb->tokens, (void *) sgml_tokenizer (decl, SGML_tokt_literal)); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0315.o b/lib/ds/rdtp/rdtp0315.o new file mode 100644 index 0000000000000000000000000000000000000000..6056b1805e23341b5754682fe42a583fd601b3c3 Binary files /dev/null and b/lib/ds/rdtp/rdtp0315.o differ diff --git a/lib/ds/rdtp/rdtp0316.c b/lib/ds/rdtp/rdtp0316.c new file mode 100644 index 0000000000000000000000000000000000000000..4715906cf91eed496e6630a1c743d97fd91dbd17 --- /dev/null +++ b/lib/ds/rdtp/rdtp0316.c @@ -0,0 +1,67 @@ +/* + * FILE %ds/rdtp/rdtp0315.c + * + * restructured dynamic text parser + * start of a token of a certain type + * + * written: 1996-09-15 + * latest update: 1996-09-15 18:46:52 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_decl_token_beg (struct RDTP_THREAD *thr, int ch, int token_type) +{ + struct SGML_BUILDUP *sb; + +#ifdef MSDOS + ch; +#endif + + if (thr == (struct RDTP_THREAD *) 0 + || (sb= (struct SGML_BUILDUP *) thr->payload) + == (struct SGML_BUILDUP *) 0 + ) + { + rdtp_bad_thread ("rdtp0316"); + return -1; + } + + sb->bl1 [0]= (char) ch; + sb->bl1_cnt= 1; + sb->token_type= token_type; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int sgml_decl_literal_beg (struct RDTP_THREAD *thr, int ch) +{ + return sgml_decl_token_beg (thr, ch, SGML_tokt_literal); +} + +/* ------------------------------------------------------------------------ */ +int sgml_decl_sqs_beg (struct RDTP_THREAD *thr, int ch) +{ + return sgml_decl_token_beg (thr, ch, SGML_tokt_sqs); +} + +/* ------------------------------------------------------------------------ */ +int sgml_decl_dqs_beg (struct RDTP_THREAD *thr, int ch) +{ + return sgml_decl_token_beg (thr, ch, SGML_tokt_dqs); +} + +/* ------------------------------------------------------------------------ */ +int sgml_decl_num_beg (struct RDTP_THREAD *thr, int ch) +{ + return sgml_decl_token_beg (thr, ch, SGML_tokt_number); +} diff --git a/lib/ds/rdtp/rdtp0316.o b/lib/ds/rdtp/rdtp0316.o new file mode 100644 index 0000000000000000000000000000000000000000..2d3aa83ca4fcd95ea1bb2e120c58d7296e2f8472 Binary files /dev/null and b/lib/ds/rdtp/rdtp0316.o differ diff --git a/lib/ds/rdtp/rdtp0317.c b/lib/ds/rdtp/rdtp0317.c new file mode 100644 index 0000000000000000000000000000000000000000..6dd16a965966d6b5a1b7fd108a6698d2bb695499 --- /dev/null +++ b/lib/ds/rdtp/rdtp0317.c @@ -0,0 +1,57 @@ +/* + * FILE %ds/rdtp/rdtp0317.c + * + * restructured dynamic text parser + * + * written: 1996-09-15 + * latest update: 1996-09-15 10:10:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_decl_token_end (struct RDTP_THREAD *thr, int ch) +{ + struct SGML_BUILDUP *sb; + char *decl; + + if (thr == (struct RDTP_THREAD *) 0 + || (sb= (struct SGML_BUILDUP *) thr->payload) + == (struct SGML_BUILDUP *) 0 + ) + { + rdtp_bad_thread ("rdtp0317"); + return -1; + } + + sb->bl1 [sb->bl1_cnt]= 0; + sb->bl1_cnt= 0; + decl= sb->bl1; + + array_push (sb->tokens, (void *) sgml_tokenizer (decl, sb->token_type)); + + /* if the token was delimited by some valid declaration symbol, */ + /* parse the symbol too! */ + if (ch != ' ' + && !(ch >= 0x09 && ch <= 0x0D) + && ch != '>' && ch != ']' + && ch != (char) 0 + ) + sgml_decl_symbol (thr, ch); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int sgml_decl_col_token_end (struct RDTP_THREAD *thr, int ch) +{ + sgml_collect (thr, ch); + return sgml_decl_token_end (thr, (char) 0); +} diff --git a/lib/ds/rdtp/rdtp0317.o b/lib/ds/rdtp/rdtp0317.o new file mode 100644 index 0000000000000000000000000000000000000000..598fdf2ec7500e5f3a1891f6a67b85e041c8903e Binary files /dev/null and b/lib/ds/rdtp/rdtp0317.o differ diff --git a/lib/ds/rdtp/rdtp0318.c b/lib/ds/rdtp/rdtp0318.c new file mode 100644 index 0000000000000000000000000000000000000000..149c037457a73e98297bd3e39bc2fc7b5c1a721b --- /dev/null +++ b/lib/ds/rdtp/rdtp0318.c @@ -0,0 +1,66 @@ +/* + * FILE %ds/rdtp/rdtp0318.c + * + * restructured dynamic text parser + * + * written: 1996-09-15 + * latest update: 1999-04-25 16:57:59 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +struct SGML_TOKEN *sgml_tokenizer (char *str, int type) +{ + struct SGML_TOKEN *token; + + if ((token= (struct SGML_TOKEN *) calloc (sizeof (struct SGML_TOKEN), 1)) + != (struct SGML_TOKEN *) 0 + ) + { + /****** printf ("tokenize: '%s' ty=%d\n", str, type); *****/ + token->contents= strdup (str); + token->type= type; + } + + return token; +} + +/* ------------------------------------------------------------------------ */ +void sgml_destroy_token (void *pl) +{ + struct SGML_TOKEN *token; + char *str; + + if ((token= (struct SGML_TOKEN *) pl) != (struct SGML_TOKEN *) 0) + { + if ((str= token->contents) != (char *) 0) + { + printf ("destroy token: %2d '%s'\n", token->type, str); + free (str); + } + free (token); + } +} + +/* ------------------------------------------------------------------------ */ +void sgml_free_token (struct SGML_TOKEN *token) +{ + char *str; + + if (token != (struct SGML_TOKEN *) 0) + { + if ((str= token->contents) != (char *) 0) free (str); + free (token); + } +} diff --git a/lib/ds/rdtp/rdtp0318.o b/lib/ds/rdtp/rdtp0318.o new file mode 100644 index 0000000000000000000000000000000000000000..a38da734bef33cd1d8f438b459eef5bf4baaabdf Binary files /dev/null and b/lib/ds/rdtp/rdtp0318.o differ diff --git a/lib/ds/rdtp/rdtp0319.c b/lib/ds/rdtp/rdtp0319.c new file mode 100644 index 0000000000000000000000000000000000000000..88fc8ea708b895c9276badeb12d0dc4f04fe91eb --- /dev/null +++ b/lib/ds/rdtp/rdtp0319.c @@ -0,0 +1,118 @@ +/* + * FILE %ds/rdtp/rdtp0319.c + * + * restructured dynamic text parser + * + * written: 1996-09-15 + * latest update: 1996-09-15 10:10:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_tokenize_symbol (struct RDTP_THREAD *thr, int ch, int token_type) +{ + struct SGML_BUILDUP *sb; + char str [4]; + + str [0]= (char) ch; + str [1]= 0; + + if (thr == (struct RDTP_THREAD *) 0 + || (sb= (struct SGML_BUILDUP *) thr->payload) + == (struct SGML_BUILDUP *) 0 + ) + { + rdtp_bad_thread ("rdtp0319"); + return -1; + } + + array_push (sb->tokens, (void *) sgml_tokenizer (str, token_type)); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int sgml_decl_symbol (struct RDTP_THREAD *thr, int ch) +{ + int token_type; + + switch (ch) + { + case '(': + token_type= SGML_tokt_begin_group; + break; + + case ')': + token_type= SGML_tokt_end_group; + break; + + case '*': + token_type= SGML_tokt_asterisk; + break; + + case '+': + token_type= SGML_tokt_plus; + break; + + case ',': + token_type= SGML_tokt_comma; + break; + + case '-': + token_type= SGML_tokt_dash; + break; + + case '?': + token_type= SGML_tokt_qm; + break; + + case '%': + token_type= SGML_tokt_pct; + break; + + case '|': + token_type= SGML_tokt_or; + break; + + default: + printf ("bad declaration symbol: 0x%02X\n", ch); + return -1; + } + + return sgml_tokenize_symbol (thr, ch, token_type); +} + +/* ------------------------------------------------------------------------ */ +int sgml_single_dash (struct RDTP_THREAD *thr, int ch) +{ +#ifdef MSDOS + ch; +#endif + + return sgml_decl_symbol (thr, '-'); +} + +/* ------------------------------------------------------------------------ */ +int sgml_single_dash_gbeg (struct RDTP_THREAD *thr, int ch) +{ + sgml_decl_symbol (thr, '-'); + return sgml_decl_symbol (thr, ch); +} + +/* ------------------------------------------------------------------------ */ +int sgml_single_pct (struct RDTP_THREAD *thr, int ch) +{ +#ifdef MSDOS + ch; +#endif + + return sgml_decl_symbol (thr, '%'); +} diff --git a/lib/ds/rdtp/rdtp0319.o b/lib/ds/rdtp/rdtp0319.o new file mode 100644 index 0000000000000000000000000000000000000000..bb55007cc7b1b4752b7e9546e4517e44fbdacc59 Binary files /dev/null and b/lib/ds/rdtp/rdtp0319.o differ diff --git a/lib/ds/rdtp/rdtp0320.c b/lib/ds/rdtp/rdtp0320.c new file mode 100644 index 0000000000000000000000000000000000000000..a1eee0048dac89beb247bea5c36dae5574febde0 --- /dev/null +++ b/lib/ds/rdtp/rdtp0320.c @@ -0,0 +1,36 @@ +/* + * FILE %ds/rdtp/rdtp0320.c + * + * restructured dynamic text parser + * SGML declaration entities + * + * written: 1996-09-15 + * latest update: 1996-09-15 11:23:18 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_par_ent_beg (struct RDTP_THREAD *thr, int ch) +{ + return sgml_decl_token_beg (thr, ch, SGML_tokt_par_ent); +} + +/* ------------------------------------------------------------------------ */ +int sgml_par_ent_end (struct RDTP_THREAD *thr, int ch) +{ +#ifdef MSDOS + ch; +#endif + + return sgml_decl_token_end (thr, (char) 0); +} + diff --git a/lib/ds/rdtp/rdtp0320.o b/lib/ds/rdtp/rdtp0320.o new file mode 100644 index 0000000000000000000000000000000000000000..9e465ba953929baa4bdf940fdc8f7e68c5e71291 Binary files /dev/null and b/lib/ds/rdtp/rdtp0320.o differ diff --git a/lib/ds/rdtp/rdtp0321.c b/lib/ds/rdtp/rdtp0321.c new file mode 100644 index 0000000000000000000000000000000000000000..9cd99d9022a41c3f66b67f80726e0e05c00df459 --- /dev/null +++ b/lib/ds/rdtp/rdtp0321.c @@ -0,0 +1,106 @@ +/* + * FILE %ds/rdtp/rdtp0321.c + * + * restructured dynamic text parser + * process a declaration + * + * written: 1996-09-15 + * latest update: 1996-09-15 21:26:33 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_declaration_done (struct RDTP_THREAD *thr, int ch) +{ + struct SGML_BUILDUP *sb; + struct SGML_TOKEN *token; + struct ARRAY_CONTROL *token_list; + char *declaration_type; + +#ifdef MSDOS + ch; +#endif + + if (thr == (struct RDTP_THREAD *) 0 + || (sb= (struct SGML_BUILDUP *) thr->payload) + == (struct SGML_BUILDUP *) 0 + ) + { + rdtp_bad_thread ("rdtp0321"); + return -1; + } + + if ((token_list= sb->tokens) == (struct ARRAY_CONTROL *) 0) + { + printf ("Warning: empty token list!\n"); + return 0; + } + + token= (struct SGML_TOKEN *) array_shift (token_list); + if (token->type != SGML_tokt_literal + || (declaration_type= token->contents) == (char *) 0 + ) + { + printf ("warning: unknown declaration format!\n"); + goto DONE; + } + + to_lower (declaration_type); + printf ("declaration type: '%s'\n", declaration_type); + + if (strcmp (declaration_type, "element") == 0) + { + sgml_element_declaration (sb, token_list, 0); + /* NOTE: token_list is currently reused */ + goto COMPLETELY_DONE; + } + else + if (strcmp (declaration_type, "attlist") == 0) + { + struct SGML_TOKEN *tok2; + + if ((tok2= (struct SGML_TOKEN *) array_shift (token_list)) + == (struct SGML_TOKEN *) 0) + return -1; + + if (tok2->type == SGML_tokt_literal + && strcmp_c (tok2->contents, "#notation") == 0 + ) + { /* Notation attribute */ + /* T2D */ + } + else + { + array_unshift (token_list, tok2); + sgml_element_declaration (sb, token_list, 1); + } + } + +DONE: + token_list->element_destructor= sgml_destroy_token; + array_dispose (token_list); + +COMPLETELY_DONE: + sb->tokens= (struct ARRAY_CONTROL *) 0; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int sgml_declaration_done2 (struct RDTP_THREAD *thr, int ch) +{ + sgml_decl_token_end (thr, ch); + return sgml_declaration_done (thr, ch); +} diff --git a/lib/ds/rdtp/rdtp0321.o b/lib/ds/rdtp/rdtp0321.o new file mode 100644 index 0000000000000000000000000000000000000000..a06b9823fa2baf0cd62598e82fcbf627a603cca8 Binary files /dev/null and b/lib/ds/rdtp/rdtp0321.o differ diff --git a/lib/ds/rdtp/rdtp0322.c b/lib/ds/rdtp/rdtp0322.c new file mode 100644 index 0000000000000000000000000000000000000000..5888bfe4faffb4bd14b60087899598733e740fe7 --- /dev/null +++ b/lib/ds/rdtp/rdtp0322.c @@ -0,0 +1,56 @@ +/* + * FILE %ds/rdtp/rdtp0322.c + * + * restructured dynamic text parser + * add a tag name to a document instance + * + * written: 1997-06-16 + * latest update: 1997-06-16 13:57:09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +struct SGML_TAG_NAME *sgml_add_element ( +struct SGML_BUILDUP *sb, +char *element) +{ + struct SGML_TAG_NAME *element_name; + struct YTREE *yt; + + if ((yt= ytree_insert_word (&sb->element_names, (unsigned char *) element)) + == (struct YTREE *) 0) + { +IE: + fprintf (stderr, "rdtp0309: internal error\n"); + return (struct SGML_TAG_NAME *) 0; + } + + if (!(yt->YT_flags & YTflag_EOW)) + { + element_name= sgml_new_element_name (sb, element); + + yt->YT_flags |= YTflag_EOW; + yt->YT_info= (long) element_name; + } + else + { + element_name= (struct SGML_TAG_NAME *) yt->YT_info; + } + + if (element_name == (struct SGML_TAG_NAME *) 0) goto IE; + + element_name->ref_counter++; + + return element_name; +} diff --git a/lib/ds/rdtp/rdtp0322.o b/lib/ds/rdtp/rdtp0322.o new file mode 100644 index 0000000000000000000000000000000000000000..4fc1309698e650e4a09853b744a75b94e26c958b Binary files /dev/null and b/lib/ds/rdtp/rdtp0322.o differ diff --git a/lib/ds/rdtp/rdtp0341.c b/lib/ds/rdtp/rdtp0341.c new file mode 100644 index 0000000000000000000000000000000000000000..b2c7531ea52a1552f7e01d0bdaa55d70b60d9a34 --- /dev/null +++ b/lib/ds/rdtp/rdtp0341.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/rdtp/rdtp0341.c + * + * restructured dynamic text parser + * create a new opening tag structure + * + * written: 1997-06-16 + * latest update: 1997-06-16 17:23:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +struct SGML_OPENING_TAG *sgml_new_opening_tag ( +struct SGML_BUILDUP *ctx, +char *name) +{ + struct SGML_OPENING_TAG *ot; + struct SGML_TAG_NAME *element_name; + + if (ctx == (struct SGML_BUILDUP *) 0 + || (element_name= sgml_add_element (ctx, name)) + == (struct SGML_TAG_NAME *) 0 + || (ot= (struct SGML_OPENING_TAG *) + calloc (sizeof (struct SGML_OPENING_TAG), 1)) + == (struct SGML_OPENING_TAG *) 0 + ) return (struct SGML_OPENING_TAG *) 0; + + ot->tag_name= element_name; + ot->attr_append= &ot->attributes; + + return ot; +} diff --git a/lib/ds/rdtp/rdtp0341.o b/lib/ds/rdtp/rdtp0341.o new file mode 100644 index 0000000000000000000000000000000000000000..4bbdad9635443188035323886ccda28e72ed324e Binary files /dev/null and b/lib/ds/rdtp/rdtp0341.o differ diff --git a/lib/ds/rdtp/rdtp0342.c b/lib/ds/rdtp/rdtp0342.c new file mode 100644 index 0000000000000000000000000000000000000000..6f2b96895666e63634ccca726ccc2afe61a6a5b6 --- /dev/null +++ b/lib/ds/rdtp/rdtp0342.c @@ -0,0 +1,70 @@ +/* + * $Id: rdtp0342.c,v 1.4 2000/06/05 17:05:13 gonter Exp $ + * FILE %ds/rdtp/rdtp0342.c + * + * restructured dynamic text parser + * add a attribute name/value pair to a tag's structure + * + * written: 1997-06-16 + * latest update: 2000-06-05 18:27:21 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +struct SGML_ATTRIBUTE_LIST *sgml_add_attribute ( +struct SGML_OPENING_TAG *ot, +char *name, +char *value) +{ + struct SGML_ATTRIBUTE_LIST *av; + char *cp; + int ch; + int flg= 0x00; + + if (ot == (struct SGML_OPENING_TAG *) 0 + || (av= (struct SGML_ATTRIBUTE_LIST *) + calloc (sizeof (struct SGML_ATTRIBUTE_LIST), 1)) + == (struct SGML_ATTRIBUTE_LIST *) 0 + ) return (struct SGML_ATTRIBUTE_LIST *) 0; + + /*** printf ("sgml_add_attribute.c av=0x%08lX name='%s'\n", av, name); ***/ + if (name != (char *) 0 && *name) + { + av->attribute_name= strdup (name); + } + + /* T2D: analyze attribute value for SGML specific */ + /* chars and if quoting is necessary */ + av->attribute_value= cp= strdup (value); + while (ch= *cp++ & 0x00FF) + { + if (ch == '\'') flg |= SAf_value_dquoted; + else if (ch == '\"') flg |= SAf_value_squoted; + else if (ch == '\\') flg |= SAf_value_escaped; + else if (!( (ch >= 'A' && ch <= 'Z') + || (ch >= 'a' && ch <= 'z') + || ch == '_' || ch == '-' + || (ch >= '0' && ch <= '9')) + ) flg |= SAf_value_dquoted; + } + + if (flg == 0x00) flg |= SAf_value_noquote; /* no quote necessary */ + + av->flags= SAf_name_malloced | SAf_value_malloced | flg; + + *ot->attr_append= av; + ot->attr_append= &av->next; + + return av; +} diff --git a/lib/ds/rdtp/rdtp0342.o b/lib/ds/rdtp/rdtp0342.o new file mode 100644 index 0000000000000000000000000000000000000000..586a3aadc195f979eeba2846cafcbbae1cc1e932 Binary files /dev/null and b/lib/ds/rdtp/rdtp0342.o differ diff --git a/lib/ds/rdtp/rdtp0343.c b/lib/ds/rdtp/rdtp0343.c new file mode 100644 index 0000000000000000000000000000000000000000..beb3cd319291ebbb427e0f11a5ec2cdabeda7d1a --- /dev/null +++ b/lib/ds/rdtp/rdtp0343.c @@ -0,0 +1,62 @@ +/* + * FILE %ds/rdtp/rdtp0343.c + * + * restructured dynamic text parser + * print tag complete with attributes + * + * written: 1997-06-16 + * latest update: 1997-06-16 17:23:33 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_diag_tag ( +FILE *fo, +struct SGML_OPENING_TAG *ot) +{ + struct SGML_ATTRIBUTE_LIST *av; + struct SGML_TAG_NAME *tn; + char *name; + char *cp; + + fputs ("tag: ", fo); + if (ot == (struct SGML_OPENING_TAG *) 0 + || (tn= ot->tag_name) == (struct SGML_TAG_NAME *) 0 + || (name= tn->tag_name) == (char *) 0 + ) + { + fputs ("<NULL>\n", fo); + return 0; + } + + fputs (name, fo); + fputc ('\n', fo); + + for (av= ot->attributes; + av != (struct SGML_ATTRIBUTE_LIST *) 0; + av= av->next + ) + { + if ((cp= av->attribute_name) != (char *) 0) + fprintf (fo, " %s=\"", cp); + if ((cp= av->attribute_value) != (char *) 0) + { + fputs (cp, fo); + fputc ('\"', fo); + } + fputc ('\n', fo); + } + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0343.o b/lib/ds/rdtp/rdtp0343.o new file mode 100644 index 0000000000000000000000000000000000000000..7d98da6f4bb845c817fc37c75e7bb1b445fb324d Binary files /dev/null and b/lib/ds/rdtp/rdtp0343.o differ diff --git a/lib/ds/rdtp/rdtp0344.c b/lib/ds/rdtp/rdtp0344.c new file mode 100644 index 0000000000000000000000000000000000000000..14535e43e65e81e7996866fc9210ce066f7fbe0e --- /dev/null +++ b/lib/ds/rdtp/rdtp0344.c @@ -0,0 +1,44 @@ +/* + * $Id: rdtp0344.c,v 1.3 2000/06/05 17:05:13 gonter Exp $ + * FILE %ds/rdtp/rdtp0344.c + * + * restructured dynamic text parser + * destroy an attribute + * + * T2D: new parametrs: + * 1. flag: release list + * 2. free attribute value function + * + * written: 1997-06-16 + * latest update: 2000-06-05 18:05:18 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/dyb.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_destroy_attribute (struct SGML_ATTRIBUTE_LIST *av) +{ + if (av == (struct SGML_ATTRIBUTE_LIST *) 0) return -1; + + if (av->flags & SAf_name_malloced) free_or_what (av->attribute_name); + if (av->flags & SAf_value_malloced) free_or_what (av->attribute_value); + +#ifdef __T2D__ /* 1997-06-16 18:35:39 */ + if (av->flags & SAf_value_dyb) dyb_destroy_block (av->attribute_value); +#endif /* __T2D__ 1997-06-16 18:35:39 */ + + free (av); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0344.o b/lib/ds/rdtp/rdtp0344.o new file mode 100644 index 0000000000000000000000000000000000000000..c07d11885ffffc89691327fb56a6d3fd617b724a Binary files /dev/null and b/lib/ds/rdtp/rdtp0344.o differ diff --git a/lib/ds/rdtp/rdtp0345.c b/lib/ds/rdtp/rdtp0345.c new file mode 100644 index 0000000000000000000000000000000000000000..d0dffc23eb85075a9c26acd9bd7ed9f445926c69 --- /dev/null +++ b/lib/ds/rdtp/rdtp0345.c @@ -0,0 +1,43 @@ +/* + * $Id: rdtp0345.c,v 1.3 2000/06/05 17:04:56 gonter Exp $ + * FILE %ds/rdtp/rdtp0345.c + * + * restructured dynamic text parser + * destroy a complete tag structure + * + * written: 1997-06-16 + * latest update: 2000-06-05 18:43:13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_destroy_tag (struct SGML_OPENING_TAG *ot) +{ + struct SGML_ATTRIBUTE_LIST *av, *av_next; + + if (ot == (struct SGML_OPENING_TAG *) 0) return -1; + + for (av= ot->attributes; + av != (struct SGML_ATTRIBUTE_LIST *) 0; + ) + { + av_next= av->next; + sgml_destroy_attribute (av); + av= av_next; + } + + free (ot); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0345.o b/lib/ds/rdtp/rdtp0345.o new file mode 100644 index 0000000000000000000000000000000000000000..b6f32655209ec4fe60c4337f54f6cc232144825f Binary files /dev/null and b/lib/ds/rdtp/rdtp0345.o differ diff --git a/lib/ds/rdtp/rdtp0346.c b/lib/ds/rdtp/rdtp0346.c new file mode 100644 index 0000000000000000000000000000000000000000..d34b94b7ccd651867fee932847365f874ff461f2 --- /dev/null +++ b/lib/ds/rdtp/rdtp0346.c @@ -0,0 +1,107 @@ +/* + * FILE %ds/rdtp/rdtp0346.c + * + * restructured dynamic text parser + * transform a tag structure to a string + * + * written: 1997-06-16 + * latest update: 1997-11-26 12:52:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +char *sgml_tag_to_string ( +struct SGML_OPENING_TAG *ot, +char *buffer, +int max_size, +int extra) +{ + struct SGML_ATTRIBUTE_LIST *av; + struct SGML_TAG_NAME *tn; + char *name; + char *dest; + char *cp; + int quote= 0; /* 0 or quote character to be used */ + int size= 0; + + if (ot == (struct SGML_OPENING_TAG *) 0 + || (tn= ot->tag_name) == (struct SGML_TAG_NAME *) 0 + || (name= tn->tag_name) == (char *) 0 + ) + { + return (char *) 0; + } + + if (buffer == (char *) 0) + { + if ((size= sgml_space_required (ot)) > 0 + && (max_size= size+5+extra) > 0 + && (buffer= malloc (max_size)) == (char *) 0 + ) return (char *) 0; + + max_size--; + } + + dest= buffer; + *dest++= '<'; + max_size -= 2; /* reserve space for '>' */ + size= strcpy2_max (dest, name, max_size); + max_size -= size; + dest += size; + + for (av= ot->attributes; + av != (struct SGML_ATTRIBUTE_LIST *) 0; + av= av->next + ) + { + if (max_size < 2) break; + + *dest++= ' '; + max_size--; + quote= (av->attribute_type == SAt_NED) + ? 0 : '\"'; + + if (quote) + switch (av->flags & SAf_value_quote_mask) + { + case SAf_value_noquote: quote= 0; break; + case SAf_value_squoted: quote= '\''; break; + default: quote= '\"'; break; + } + + if ((cp= av->attribute_name) != (char *) 0) + { + size= strcpy2_max (dest, cp, max_size); + dest += size; + *dest++= '='; + max_size -= size+1; + } + + if (max_size < 3) break; + if ((cp= av->attribute_value) != (char *) 0) + { + if (quote) *dest++= (char) quote; + max_size -= 2; + size= strcpy2_max (dest, cp, max_size); + dest += size; + max_size -= size; + if (quote) *dest++= (char) quote; + } + } + + *dest++= '>'; + *dest= 0; + + return buffer; +} diff --git a/lib/ds/rdtp/rdtp0346.o b/lib/ds/rdtp/rdtp0346.o new file mode 100644 index 0000000000000000000000000000000000000000..4b53cf4a913373705c1221b54a17cd039ec40f67 Binary files /dev/null and b/lib/ds/rdtp/rdtp0346.o differ diff --git a/lib/ds/rdtp/rdtp0347.c b/lib/ds/rdtp/rdtp0347.c new file mode 100644 index 0000000000000000000000000000000000000000..54c647bd8a21ab04e1d4ed0b199634ba27f13816 --- /dev/null +++ b/lib/ds/rdtp/rdtp0347.c @@ -0,0 +1,61 @@ +/* + * FILE %ds/rdtp/rdtp0347.c + * + * restructured dynamic text parser + * transform a tag structure to a string + * + * written: 1997-06-16 + * latest update: 1997-06-16 19:06:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_space_required (struct SGML_OPENING_TAG *ot) +{ + struct SGML_ATTRIBUTE_LIST *av; + struct SGML_TAG_NAME *tn; + char *name; + char *cp; + int size= 0; + + if (ot == (struct SGML_OPENING_TAG *) 0 + || (tn= ot->tag_name) == (struct SGML_TAG_NAME *) 0 + || (name= tn->tag_name) == (char *) 0 + ) + { + return -1; + } + + size= 2+strlen (name); + + for (av= ot->attributes; + av != (struct SGML_ATTRIBUTE_LIST *) 0; + av= av->next + ) + { + size++; /* space between two attribute pairs */ + + if ((cp= av->attribute_name) != (char *) 0) + { + size += 1 + strlen (cp); /* = char */ + } + + if ((cp= av->attribute_value) != (char *) 0) + { + size += 2 + strlen (cp); /* 2x quote */ + } + } + + return size; +} diff --git a/lib/ds/rdtp/rdtp0347.o b/lib/ds/rdtp/rdtp0347.o new file mode 100644 index 0000000000000000000000000000000000000000..5a73edf0d7490326a323df20b4713580f6a6218b Binary files /dev/null and b/lib/ds/rdtp/rdtp0347.o differ diff --git a/lib/ds/rdtp/rdtp0348.c b/lib/ds/rdtp/rdtp0348.c new file mode 100644 index 0000000000000000000000000000000000000000..4042caf761131214ed8deb5ec1ab3be87bca300d --- /dev/null +++ b/lib/ds/rdtp/rdtp0348.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/rdtp/rdtp0348.c + * + * restructured dynamic text parser + * add a attribute name/long-value pair to a tag's structure + * + * written: 1997-07-14 + * latest update: 1997-07-27 10:42:30 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +struct SGML_ATTRIBUTE_LIST *sgml_add_long_attribute ( +struct SGML_OPENING_TAG *ot, +char *name, +long value) +{ + char value_str [24]; + + sprintf (value_str, "%ld", value); + return sgml_add_attribute (ot, name, value_str); +} diff --git a/lib/ds/rdtp/rdtp0348.o b/lib/ds/rdtp/rdtp0348.o new file mode 100644 index 0000000000000000000000000000000000000000..9d1b7366e734ddb8bd25c727059f8e6df36b3d72 Binary files /dev/null and b/lib/ds/rdtp/rdtp0348.o differ diff --git a/lib/ds/rdtp/rdtp0403.c b/lib/ds/rdtp/rdtp0403.c new file mode 100644 index 0000000000000000000000000000000000000000..5b4abd3b528b6c31377838181cae9fe10a20f844 --- /dev/null +++ b/lib/ds/rdtp/rdtp0403.c @@ -0,0 +1,177 @@ +/* + * FILE %ds/rdtp/rdtp0403.c + * + * restructured dynamic text parser + * process a element or attlist declaration + * + * written: 1996-09-15 + * latest update: 1996-09-22 13:00:12 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/dpp.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_can_be_minimized (char *str) +{ + if (str == (char *) 0) return -1; + if (strcmp (str, "O") == 0) return 1; + if (strcmp (str, "-") == 0) return 0; + return -1; +} + +/* ------------------------------------------------------------------------ */ +int sgml_can_be_minimized_tok (struct SGML_TOKEN *tok) +{ + if (tok == (struct SGML_TOKEN *) 0 + || (tok->type != SGML_tokt_literal + && tok->type != SGML_tokt_dash + ) + ) + return -1; + + return sgml_can_be_minimized (tok->contents); +} + +/* ------------------------------------------------------------------------ */ +int sgml_element_declaration ( +struct SGML_BUILDUP *sb, +struct ARRAY_CONTROL *token_list, +int what) /* 0 -> element declaration */ + /* 1 -> attlist declaration */ +{ + struct SGML_TOKEN *tok; + char *element_name; + int minim_beg; + int minim_end; + long rank= 0L; + int repeater; + struct YTREE *yt; + struct SGML_ELEMENT_DECLARATION *ed; + struct SGML_ATTLIST_DECL *attlist; + struct SGML_CONTENT_MODEL *cont_mod; + struct ARRAY_CONTROL *element_names; + + /* {GF [117] 406:1} */ + if ((element_names= sgml_get_name_or_group (token_list, 0)) + == (struct ARRAY_CONTROL *) 0) + { + printf ("error: invalid element name (or list)\n"); + return -1; + } + + if (what == 0) + { /* element declaration */ + + /* look at the next token for a rank or minimization */ + for (repeater= 2; repeater > 0; repeater--) + { + if ((tok= (struct SGML_TOKEN *) array_shift (token_list)) + == (struct SGML_TOKEN *) 0) + { + printf ("error: invalid element declaration\n"); + return -1; + } + + if (repeater == 1) break; /* only one rank code! */ + if (tok->type == SGML_tokt_number) + { /* there's a rank code, whatever that is! */ + printf ("note: there's a ranking code!\n"); + rank= get_parameter_value (tok->contents); + } + else break; + } + + /* check for minimization options */ + if ((minim_beg= sgml_can_be_minimized_tok (tok)) == -1) + { + minim_beg= minim_end= 0; + array_unshift (token_list, tok); + } + else + { /* token was a minimization token, there must be another one */ + sgml_free_token (tok); + + tok= (struct SGML_TOKEN *) array_shift (token_list); + minim_end= sgml_can_be_minimized_tok (tok); + sgml_free_token (tok); + } + + /* T2D: process content model and produce a in-memory version */ + cont_mod= sgml_get_content_model (token_list); + } + + if (what == 1 || what == 2) + { /* attlist declaration */ + + /* T2D: process attribute definition list */ + attlist= sgml_get_attlist (token_list); + } + + /* register minimization options and content model for all element names */ + while ((element_name= (char *) array_shift (element_names))!= (char *) 0) + { + if ((yt= ytree_insert_word (&sb->defined_element_names, element_name)) + == (struct YTREE *) 0) + { +OOM: + printf ("error: (rdtp0403) out of memory!!\n"); + return -1; + } + + if (yt->YT_flags & YTflag_EOW) + { + printf ("warning: (rdtp0403) redeclaration of element '%s'\n"); + ed= (struct SGML_ELEMENT_DECLARATION *) yt->YT_info; + free (element_name); + } + else + { + yt->YT_flags |= YTflag_EOW; + ed= sgml_new_element_declaration (); + yt->YT_info= (long) ed; + ed->name= element_name; + } + + if (ed == (struct SGML_ELEMENT_DECLARATION *) 0) goto OOM; + + /* T2D: If there are other element names left, copy in-memory version */ + /* of the content model and use that here, otherwise use the */ + /* the processed model directly. */ + /* Alternatively, link to the content model and increment */ + /* a reference counter. */ + + if (what == 0) + { + ed->minim_start= minim_beg; + ed->minim_end= minim_end; + ed->rank= rank; + + ed->cont_mod= cont_mod; + cont_mod->ref_count++; + } + + if (what == 1) + { + ed->attlist= attlist; + attlist->ref_count++; + } + + sgml_print_element_declaration (stdout, ed); + } + + array_dispose (element_names); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0403.o b/lib/ds/rdtp/rdtp0403.o new file mode 100644 index 0000000000000000000000000000000000000000..386c74debbaf7538fb77e609eafe72c3f3e17c15 Binary files /dev/null and b/lib/ds/rdtp/rdtp0403.o differ diff --git a/lib/ds/rdtp/rdtp0413.c b/lib/ds/rdtp/rdtp0413.c new file mode 100644 index 0000000000000000000000000000000000000000..336a6eb298006f5a673ad9615d7687212ef5f6ef --- /dev/null +++ b/lib/ds/rdtp/rdtp0413.c @@ -0,0 +1,67 @@ +/* + * FILE %ds/rdtp/rdtp0413.c + * + * restructured dynamic text parser + * process a declaration + * + * written: 1996-09-15 + * latest update: 1996-09-22 14:43:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +int sgml_print_element_declaration ( +FILE *fo, +struct SGML_ELEMENT_DECLARATION *ed) +{ + fprintf (fo, "element: '%s'\n", ed->name); + fprintf (fo, " minimization: start=%c end=%c\n", + (ed->minim_start) ? 'O' : '-', + (ed->minim_end) ? 'O' : '-'); + + sgml_print_attlist_declaration (fo, ed->attlist); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int sgml_print_attlist_declaration ( +FILE *fo, +struct SGML_ATTLIST_DECL *attl) +{ + struct SGML_ATTRIBUTE_DECLARATION *attdecl; + + if (attl == (struct SGML_ATTLIST_DECL *) 0) return 0; + + fprintf (fo, " attributes:\n"); + fprintf (fo, " references: %d\n", attl->ref_count); + + for (attdecl= attl->attributes; + attdecl != (struct SGML_ATTRIBUTE_DECLARATION *) 0; + attdecl= attdecl->next) + sgml_print_attribute_declaration (fo, attdecl); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int sgml_print_attribute_declaration ( +FILE *fo, +struct SGML_ATTRIBUTE_DECLARATION *attdecl) +{ + fprintf (fo, " attribute: name='%s' decval=%d defval=%d\n", + attdecl->name, attdecl->declared_value, attdecl->default_value); + + return 0; +} diff --git a/lib/ds/rdtp/rdtp0413.o b/lib/ds/rdtp/rdtp0413.o new file mode 100644 index 0000000000000000000000000000000000000000..8373c2089c9071a1ee68e0ee9d6211451c615898 Binary files /dev/null and b/lib/ds/rdtp/rdtp0413.o differ diff --git a/lib/ds/rdtp/rdtp0421.c b/lib/ds/rdtp/rdtp0421.c new file mode 100644 index 0000000000000000000000000000000000000000..84d89d64246e909bdec69ff27e338c6efd600812 --- /dev/null +++ b/lib/ds/rdtp/rdtp0421.c @@ -0,0 +1,113 @@ +/* + * FILE %ds/rdtp/rdtp0421.c + * + * restructured dynamic text parser + * return an array representing a name group or a single name + * + * see {GF [69] 374:11} for details + * + * Options: group required indicates that a single name is invalid + * + * written: 1996-09-15 + * latest update: 1999-04-25 16:58:05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +struct ARRAY_CONTROL *sgml_get_name_or_group ( +struct ARRAY_CONTROL *token_list, +int group_required) /* 1 -> (name) required */ +{ + struct ARRAY_CONTROL *element_names= (struct ARRAY_CONTROL *) 0; + struct SGML_TOKEN *tok; + char *str_element_name; + int tokt; + char *reason; + + element_names= array_new (); + /* get list of enlement names */ + if ((tok= (struct SGML_TOKEN *) array_shift (token_list)) + == (struct SGML_TOKEN *) 0 + ) + { + reason= "no tokens"; + +INVALID: + printf ("error: (rdtp0403) invalid name group: '%s'\n", reason); + + element_names->element_destructor= free; + array_dispose (element_names); + return (struct ARRAY_CONTROL *) 0; + } + + if (tok->type == SGML_tokt_begin_group) + { + sgml_free_token (tok); + + for (;;) + { + if ((tok= (struct SGML_TOKEN *) array_shift (token_list)) + == (struct SGML_TOKEN *) 0 + || tok->type != SGML_tokt_literal + ) + { + reason= "no gr literal"; + goto INVALID; + } + + str_element_name= tok->contents; + to_lower (str_element_name); + array_push (element_names, (void *) str_element_name); + free (tok); + + if ((tok= (struct SGML_TOKEN *) array_shift (token_list)) + == (struct SGML_TOKEN *) 0) + { + reason= "no gr follower"; + goto INVALID; + } + + tokt= tok->type; + sgml_free_token (tok); + + if (tokt == SGML_tokt_end_group) break; + + if (tokt != SGML_tokt_comma + && tokt != SGML_tokt_or + && tokt != SGML_tokt_and + ) + { + reason= "no gr connector"; + goto INVALID; + } + } + } + else + if (tok->type == SGML_tokt_literal && !group_required) + { + str_element_name= tok->contents; + to_lower (str_element_name); + array_push (element_names, (void *) str_element_name); + free (tok); + } + else + { + reason= "inv. token"; + sgml_free_token (tok); + goto INVALID; + } + + return element_names; +} diff --git a/lib/ds/rdtp/rdtp0421.o b/lib/ds/rdtp/rdtp0421.o new file mode 100644 index 0000000000000000000000000000000000000000..3d08ef7394c920c5911392e81c6558dc904f6d15 Binary files /dev/null and b/lib/ds/rdtp/rdtp0421.o differ diff --git a/lib/ds/rdtp/rdtp0422.c b/lib/ds/rdtp/rdtp0422.c new file mode 100644 index 0000000000000000000000000000000000000000..7af4b632b32264d0254db3c199bf7d648d593ae9 --- /dev/null +++ b/lib/ds/rdtp/rdtp0422.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/rdtp/rdtp0422.c + * + * restructured dynamic text parser + * process a declaration + * + * written: 1996-09-15 + * latest update: 1999-04-25 16:58:09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +struct SGML_CONTENT_MODEL *sgml_get_content_model ( +struct ARRAY_CONTROL *token_list) +{ + struct SGML_CONTENT_MODEL *cm; + + if ((cm= sgml_new_content_model ()) != (struct SGML_CONTENT_MODEL *) 0) + { + /* T2D: a lot is here to do !!! */ + cm->tmp= token_list; + } + + return cm; +} diff --git a/lib/ds/rdtp/rdtp0422.o b/lib/ds/rdtp/rdtp0422.o new file mode 100644 index 0000000000000000000000000000000000000000..b24660a0bc7cd6d0c1865ee4136af65677a74dd5 Binary files /dev/null and b/lib/ds/rdtp/rdtp0422.o differ diff --git a/lib/ds/rdtp/rdtp0423.c b/lib/ds/rdtp/rdtp0423.c new file mode 100644 index 0000000000000000000000000000000000000000..b854c07fa617bdac25eb7911bf7bf5ec36628a2f --- /dev/null +++ b/lib/ds/rdtp/rdtp0423.c @@ -0,0 +1,148 @@ +/* + * FILE %ds/rdtp/rdtp0423.c + * + * restructured dynamic text parser + * process an attlist declaration + * + * written: 1996-09-15 + * latest update: 1999-04-25 16:58:13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +#define NUM_DECL_VALUES 16 +static char *DECLARED_VALUES [NUM_DECL_VALUES] = +{ + (char *) 0, + "CDATA", + "ENTITY", + "ENTITIES", + "ID", + + "IDREF", + "IDREFS", + "NAME", + "NAMES", + "NMTOKEN", + + "NMTOKENS", + "NUMBER", + "NUMBERS", + "NUTOKEN", + "NUTOKENS", + + "NOTATION" +} ; + +/* ------------------------------------------------------------------------ */ +int sgml_get_declared_value_code (char *str) +{ + int rc; + + to_upper (str); /* T2D: this is only allowed if generic identifiers */ + /* can be uppercased, that is, if the SGML */ + /* declaration states GENARAL NO in the NAME group! */ + + rc= find_command (str, DECLARED_VALUES, 1, NUM_DECL_VALUES-1); + if (rc < 0) rc= 0; + return rc; +} + +/* ------------------------------------------------------------------------ */ +struct SGML_ATTLIST_DECL *sgml_get_attlist ( +struct ARRAY_CONTROL *token_list) +{ + struct SGML_ATTLIST_DECL *attl; + struct SGML_ATTRIBUTE_DECLARATION *attdecl, **attdecl_next; + struct SGML_TOKEN *att_name, *att_defval; + struct ARRAY_CONTROL *declared_value_list; + char *declared_value; + int declared_value_code; + char *s1; + + if ((attl= sgml_new_attlist_decl ()) == (struct SGML_ATTLIST_DECL *) 0) + { +NO_MEM: + printf ("error: (rdtp0423) out of memory\n"); + } + else + { + attdecl_next= &attl->attributes; + + for (;;) + { + /* {GF [141] 420:16} */ + /* attribute definition */ + /* = (<attribute name> <declared value> <default value>)+) */ + + /* {GF [144] 421:14} */ + if ((att_name= (struct SGML_TOKEN *) array_shift (token_list)) + == (struct SGML_TOKEN *) 0) + { /* NOTE, T2D: this implementation allows empty attribute */ + /* declaration lists, this is not really correct! */ + break; + } + + if ((attdecl= sgml_new_attdecl ()) + == (struct SGML_ATTRIBUTE_DECLARATION *) 0 + ) + goto NO_MEM; + + if (att_name->type != SGML_tokt_literal + || (s1= att_name->contents) == (char *) 0 + ) + { +ERROR: + printf ("error: (rdtp0423) bad attribute list\n"); + break; + } + + /* {GF [145] 422:6} */ + /* NOTE, T2D: notation attributes are not handleded! {GF [145] 423:11}*/ + if ((declared_value_list= sgml_get_name_or_group (token_list, 0)) + == (struct ARRAY_CONTROL *) 0) goto ERROR; + + attdecl->name= att_name->contents; + free (att_name); + + if (array_elements (declared_value_list) == 1) + { + declared_value= (char *) array_shift (declared_value_list); + declared_value_code= sgml_get_declared_value_code (declared_value); +printf (">> decval= '%s' = %d\n", declared_value, declared_value_code); + + array_dispose (declared_value_list); + free (declared_value); + /* NOTE, T2D: if this is a NOTATION, get another name or group */ + } + else + { + declared_value_code= SGML_DECLVAL_name_tokg; + attdecl->declared_value_ptr= declared_value_list; + } + attdecl->declared_value= declared_value_code; + + /* {GF [147] 425:1} */ + /* WORK: this is incomplete!!! */ + att_defval= (struct SGML_TOKEN *) array_shift (token_list); + attdecl->default_value_ptr= att_defval->contents; + + *attdecl_next= attdecl; + attdecl_next= &attdecl->next; + } + } + + return attl; +} diff --git a/lib/ds/rdtp/rdtp0423.o b/lib/ds/rdtp/rdtp0423.o new file mode 100644 index 0000000000000000000000000000000000000000..4ac8399d1b4584e0325aa5fe377bb3311d534841 Binary files /dev/null and b/lib/ds/rdtp/rdtp0423.o differ diff --git a/lib/ds/rdtp/rt1.c b/lib/ds/rdtp/rt1.c new file mode 100644 index 0000000000000000000000000000000000000000..701029eec618fc6422d25ef2cbedc5e3e49e0d62 --- /dev/null +++ b/lib/ds/rdtp/rt1.c @@ -0,0 +1,93 @@ +/* + * FILE %ds/rdtp/rt1.c + * + * written: 1996-04-01 + * latest update: 1996-06-22 9:25:52 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/rdtp.h> +#include <gg/rdtp01.h> + +#ifdef RTF +#include <gg/rdtp02.h> +#endif /* RTF */ + +#ifdef SGML +#include <gg/rdtp03.h> +#endif /* SGML */ + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + struct RDTP_GENERATOR *gen= (struct RDTP_GENERATOR *) 0; + struct RDTP_THREAD *thread; +#ifdef RTF + struct RTF_BUILDUP *rtf_build; +#endif /* RTF */ +#ifdef SGML + struct SGML_BUILDUP *sgml_build; +#endif /* SGML */ + int i; + long rc; + char *arg; +#ifdef DEBUG + int g; +#endif /* DEBUG */ + +#ifdef RTF + gen= rtf_setup_parser ("RTF"); +#endif /* RTF */ + +#ifdef SGML + gen= sgml_setup_parser ("SGML"); +#endif /* SGML */ + + rdtp_print_generator (gen, stdout); + rdtp_generate_transition_table (gen); + +#ifdef DEBUG + for (i= 0; i < 256; i++) + { + g= gen->class_table [i]; + printf ("0x%02X: %c %4d\n", i, (i > 0x20 && i < 0x7f) ? i : '.', g); + } +#endif /* DEBUG */ + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + + printf ("**********************************************\n"); + printf ("generating thread for file %s\n", arg); + + thread= rdtp_new_thread (gen->class); + +#ifdef RTF + rtf_build= (struct RTF_BUILDUP *) calloc (sizeof (struct RTF_BUILDUP), 1); + thread->payload= (void *) rtf_build; +#endif /* RTF */ + +#ifdef SGML + sgml_build= sgml_initialize_buildup (); + thread->payload= (void *) sgml_build; +#endif /* SGML */ + + rc= rdtp_parse_file (thread, arg, 0L, 0x7FFFFFFFL); + printf ("file '%s': %ld (0x%04lX) bytes processed\n", arg, rc, rc); + +#ifdef RTF + rtf_print_statistics (thread); +#endif /* RTF */ +#ifdef SGML + sgml_print_statistics (thread); +#endif /* SGML */ + } + + return 0; +} diff --git a/lib/ds/rdtp/rt2.c b/lib/ds/rdtp/rt2.c new file mode 100644 index 0000000000000000000000000000000000000000..75a973a861b9ea2b7c825ae9d8179030193e2383 --- /dev/null +++ b/lib/ds/rdtp/rt2.c @@ -0,0 +1,62 @@ +/* + * FILE %ds/rdtp/rt2.c + * + * written: 1997-06-16 + * latest update: 1997-06-16 14:52:06 + * + */ + +#include <stdio.h> +#include <gg/rdtp.h> +#include <gg/rdtp03.h> + +/* ------------------------------------------------------------------------ */ +#define MAX_BUFFER 256 +static char b_n [MAX_BUFFER]; +static char b_v [MAX_BUFFER]; + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + struct SGML_BUILDUP *sgml_build; + struct SGML_OPENING_TAG *ot; + struct SGML_ATTRIBUTE_LIST *attr; + int i; + char *cp; + + if ((sgml_build= sgml_initialize_buildup ()) + == (struct SGML_BUILDUP *) 0 + || (ot= sgml_new_opening_tag (sgml_build, "hyx.l")) + == (struct SGML_OPENING_TAG *) 0 + ) + { + fprintf (stderr, "new ot failed\n"); + return 0; + } + + for (i= 0; i < 10; i++) + { + sprintf (b_n, "a%03d", i); + sprintf (b_v, "value %3d", i); + if ((attr= sgml_add_attribute (ot, b_n, b_v)) + == (struct SGML_ATTRIBUTE_LIST *) 0) + { + fprintf (stderr, "new attribute failed\n"); + return 0; + } + } + + sgml_diag_tag (stdout, ot); + if ((cp= sgml_tag_to_string (ot, (char *) 0, 0, 0)) == (char *) 0) + { + fprintf (stderr, "tag_to_string failed!\n"); + return 0; + } + + printf ("[%s]\n", cp); + + return 0; +} diff --git a/lib/ds/rtf/(dirinf).fm b/lib/ds/rtf/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..2610b41023cdbada7eb993b94dc3f40ee91603a1 --- /dev/null +++ b/lib/ds/rtf/(dirinf).fm @@ -0,0 +1,13 @@ +# +# FILE %ds/(dirinf).fm +# +. | rich text format +# +# written: 1995-11-11 +# latest update: 1995-12-29 +# +# ---------------------------------------------------------------------------- + +(dirinf).fm Contents +makefile DOS version of Makefile +make-ux Unix version of Makefile diff --git a/lib/ds/rtf/Makefile b/lib/ds/rtf/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..ede17d732d3e566fcd7d9854dbd9d86d121bdbfc --- /dev/null +++ b/lib/ds/rtf/Makefile @@ -0,0 +1,33 @@ +# +# FILE %ds/viesos/make-ux +# +# written: 1995-03-19 +# latest update: 1999-05-08 9:51:35 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow + +# ---------------------------------------------------------------------------- +LIB=../../libgg.a + +all: + echo rtf is not ready yet +all.2: lib + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + tclhyx01.o tclhyx02.o tclhyx03.o tclhyx04.o tclhyx05.o tclhyx06.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $(LIBOBJS0) + touch lib + +.c.o: + $(CC) $(OPTS) -c $*.c diff --git a/lib/ds/rtf/contrib b/lib/ds/rtf/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/rtf/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/rtf/gg b/lib/ds/rtf/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/rtf/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/rtf/libgg.a b/lib/ds/rtf/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/rtf/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/rtf/make-dos b/lib/ds/rtf/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..3d172bf3557a48e5f2854bcee5b5c1cf38fea075 --- /dev/null +++ b/lib/ds/rtf/make-dos @@ -0,0 +1,22 @@ +# +# FILE %ds/rtf/makefile +# +# lexicon services +# +# written: 1984-03-28 +# latest update: 1995-12-20 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : rtf01.obj + +# rtf02.obj rtf03.obj rtf04.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/rtf/rtf00.c b/lib/ds/rtf/rtf00.c new file mode 100644 index 0000000000000000000000000000000000000000..119e9d85d9e0185c8c68053c99c7cb1688038e4d --- /dev/null +++ b/lib/ds/rtf/rtf00.c @@ -0,0 +1,11 @@ +/* + * File ~/usr/ds/rtf/rtf01.c + * + * written: 1994-03-28 + * latest update: 1994-03-28 + * + */ + +#include <gg/rtf.h> + +/* ------------------------------------------------------------------------ */ diff --git a/lib/ds/rtf/rtf01.c b/lib/ds/rtf/rtf01.c new file mode 100644 index 0000000000000000000000000000000000000000..df4eee46979ce0030f5d65165959efcf51d41013 --- /dev/null +++ b/lib/ds/rtf/rtf01.c @@ -0,0 +1,22 @@ +/* + * File ~/usr/ds/rtf/rtf01.c + * + * written: 1993-10-27 + * latest update: 1994-03-28 + * + */ + +#include <stdio.h> +#include <gg/rtf.h> + +/* ------------------------------------------------------------------------ */ +int rtf_blk2sgml (FILE *fi, FILE *fo, long count) +{ + long open_structures= 0L; + + for (; count > 0L; count++) + { + } + + return 0; +} diff --git a/lib/ds/streams/(dirinf).fm b/lib/ds/streams/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..1d0e1383318d4e29f2a34588243ab7d8e092e32a --- /dev/null +++ b/lib/ds/streams/(dirinf).fm @@ -0,0 +1,18 @@ +# +# FILE %ds/url/(dirinf).fm +# +# written: 1996-11-04 +# latest update: 1996-11-04 0:00:10 +# + +# see also: <gg/streams.h> + +(dirinf).fm Contents +Makefile current version of Makefile +make-dos DOS version of Makefile +make-ux Unix version of Makefile + +strm_f01.c struct STREAM_OBJECT *new_stream_file_object (FILE *fi) +strm_f02.c int stream_file_next_char (void *cd) +strm_f03.c int stream_file_eof (void *cd) + diff --git a/lib/ds/streams/Makefile b/lib/ds/streams/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..975f535f46c12e37e0bdcb90fd6c9d754c14850a --- /dev/null +++ b/lib/ds/streams/Makefile @@ -0,0 +1,29 @@ +# +# FILE %ds/streams/make-ux +# +# written: 1996-11-04 +# latest update: 1999-05-08 9:51:50 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + strm_f01.o strm_f02.o strm_f03.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib diff --git a/lib/ds/streams/contrib b/lib/ds/streams/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/streams/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/streams/gg b/lib/ds/streams/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/streams/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/streams/lib b/lib/ds/streams/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/streams/libgg.a b/lib/ds/streams/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/streams/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/streams/make-dos b/lib/ds/streams/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..bf232196aa0127bb4b2142fd48e6f52f83c64c78 --- /dev/null +++ b/lib/ds/streams/make-dos @@ -0,0 +1,21 @@ +# +# FILE %ds/streams/make-dos +# +# manipulation of stream objects +# +# written: 1996-11-04 +# latest update: 1996-11-04 0:19:51 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : ! + strm_f01.obj strm_f02.obj strm_f03.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/streams/strm_f01.c b/lib/ds/streams/strm_f01.c new file mode 100644 index 0000000000000000000000000000000000000000..70bd843c17792ed7fb4b04c2fe63e0951cd7dcf8 --- /dev/null +++ b/lib/ds/streams/strm_f01.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/streams/stre_f01.c + * + * file stream operations + * + * written: 1996-11-04 + * latest update: 1996-11-04 0:10:00 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#define STREAM_FILE +#include <gg/streams.h> + +/* ------------------------------------------------------------------------ */ +struct STREAM_OBJECT *new_stream_file_object (FILE *fi) +{ + struct STREAM_OBJECT *so= (struct STREAM_OBJECT *) 0; + + if (fi != (FILE *) 0 + && (so= new_stream_object ()) != (struct STREAM_OBJECT *) 0 + ) + { + so->next_char= stream_file_next_char; + so->is_end= stream_file_eof; + so->stream_cd= (void *) fi; + } + + return so; +} diff --git a/lib/ds/streams/strm_f01.o b/lib/ds/streams/strm_f01.o new file mode 100644 index 0000000000000000000000000000000000000000..2c7230ba3868a77e15f517f0358f6dc69ab16538 Binary files /dev/null and b/lib/ds/streams/strm_f01.o differ diff --git a/lib/ds/streams/strm_f02.c b/lib/ds/streams/strm_f02.c new file mode 100644 index 0000000000000000000000000000000000000000..0581dff6db6d8bb774d86b39d953771d29f41388 --- /dev/null +++ b/lib/ds/streams/strm_f02.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/streams/stre_f02.c + * + * file stream operations + * + * written: 1996-11-04 + * latest update: 1997-01-15 10:32:19 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#define STREAM_FILE +#include <gg/streams.h> + +/* ------------------------------------------------------------------------ */ +int stream_file_next_char (void *sop) +{ + FILE *fi; + struct STREAM_OBJECT *so; + + if ((so= (struct STREAM_OBJECT *) sop) == (struct STREAM_OBJECT *) 0 + || (fi= (FILE *) so->stream_cd) == (FILE *) 0 + ) return -1; + + so->position++; + return fgetc (fi) & 0x00FF; +} diff --git a/lib/ds/streams/strm_f02.o b/lib/ds/streams/strm_f02.o new file mode 100644 index 0000000000000000000000000000000000000000..248631dd840ab4fecf1bebe0327d13952fb35c4d Binary files /dev/null and b/lib/ds/streams/strm_f02.o differ diff --git a/lib/ds/streams/strm_f03.c b/lib/ds/streams/strm_f03.c new file mode 100644 index 0000000000000000000000000000000000000000..a163599f8571d15997a50d4b08ed080fe88d9f9a --- /dev/null +++ b/lib/ds/streams/strm_f03.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/streams/stre_f03.c + * + * file stream operations + * + * written: 1996-11-04 + * latest update: 1997-01-15 10:34:29 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#define STREAM_FILE +#include <gg/streams.h> + +/* ------------------------------------------------------------------------ */ +int stream_file_eof (void *sop) +{ + FILE *fi; + struct STREAM_OBJECT *so; + + return ((so= (struct STREAM_OBJECT *) sop) == (struct STREAM_OBJECT *) 0 + || (fi= (FILE *) so->stream_cd) == (FILE *) 0 + || feof (fi) + ) ? 1 : 0; +} diff --git a/lib/ds/streams/strm_f03.o b/lib/ds/streams/strm_f03.o new file mode 100644 index 0000000000000000000000000000000000000000..5c4e9e4333264359d82d0a499644863af421bdb6 Binary files /dev/null and b/lib/ds/streams/strm_f03.o differ diff --git a/lib/ds/strings/(dirinf).fm b/lib/ds/strings/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..fde65b7f5a18c87c0c0ce3c5879194fde35c149a --- /dev/null +++ b/lib/ds/strings/(dirinf).fm @@ -0,0 +1,95 @@ +# +# FILE %ds/strings/(dirinf).fm +# +# C-libraries for string manipulation +# +#include <gg/strings.h> +# +# written: 1988 09 03 +# latest update: 2000-08-28 12:23:26 +# $Id: (dirinf).fm,v 1.4 2000/08/28 19:27:01 gonter Exp $ +# +# ---------------------------------------------------------------------------- +# +large | Objektfiles LARGE Model +small | Objektfiles SMALL Model +Makefile | active Makefile +make-ux | Makefile (Unix) +make-dos | Makefile (MSDOS) +# +# ============================================================================ +strings.zip | | String Operationen +str_0001.c | int strnscpy (char *d, char *s, int cnt) +str_0002.c | int strcmp_c (char *s1, char *s2); +str_0003.c | int strcmp_ebcdic (char *s1, char *s2); +str_0004.c | char *to_lower (char *n); +str_0005.c | char *to_upper (char *n); +str_0006.c | int match (pattern, string) +str_0007.c | int string_hash (str, lng, hash, hash_lng) +str_0008.c | int match_lng (char *s1, char *s2, int cnt); +str_0009.c | int strcmp_us (char *s1, char *s2); +str_0010.c | int strcmp_weighted (char *s1, char *s2); +str_0011.c | int strcmp_cweighted (char *s1, char *s2); +str_0012.c | int lower_case (int n); +str_0013.c | int upper_case (int n); +str_0014.c | int strcmp_cre (char *s1, char *s2); +str_0015.c | int skip_re (char *str); +str_0016.c | int find_command (...); +str_0017.c | char *str_assign (char **d, char *s); +str_0018.c | char *rotate13 (char *s); +str_0019.c | char *strridx (char *s, int ch); +str_0020.c | int split_string (...); +str_0021.c | int match_array (...); +str_0022.c | int isolate_words (...); +str_0023.c | int str2fld (...}; +str_0024.c | int isolate_tokens (...); +str_0025.c | int strdiff (...); +str_0026.c | int isolate2words (...) +str_0027.c | int put_chartable (...) +str_0028.c | char *locate_word (char *s, int num) +str_0029.c | long count_char (int code, char *s, long size) +str_0030.c | int mk_passwd (char *s, int pass_lng) +str_0031.c | int enter_value (char *s, int pos, int val) +str_0032.c | void blanks (FILE *fo, int cnt) +str_0033.c | int chr_index (char *chars, int value) +str_0034.c | int xchange (char *s, int f, int t) +str_0035.c | int gopher_url2components (char *url, char **host,...) +str_0036.c | int str_prompt (char *txt, char *dest, ...) +str_0037.c | int remove_apostrophe (char *s); +str_0038.c | char *str_or_undef (char *s); +str_0039.c | int mk_PassWord (char *s, int pass_lng) +str_0040.c | get_operation () +str_0041.c | int get_cat_code (int ch) +str_0041.tbl | IBM PC category codes +str_0042.c | int get_weight_code (int ch) +str_0042.tbl | IBM PC weight codes +str_0043.c | int mk_pin_code (char *s, int pass_lng) +str_0044.c | int free_or_what (void *s); +str_0045.c | char *strdup_extra (char *str, int extra) +str_0046.c | int sgml_encode (char *str, char *tmp, int str_size) +str_0047.c | char *read_string (FILE *fi, int string_length) +str_0048.c | char *XSTR (char *str) +str_0049.c | strcpy_max (char *d, char *s, int size); +str_0050.c | strcmp_nn (char *s1, char *s2); +str_0051.c | char *strdup_or_what (char *s) +str_0052.c | strcpy2_max (char *d, char *s, int size); +str_0053.c | char *get_password_verified (char *p1, char *p2); +# +str_0107.c | strnins (str, lng, pos, cnt) +str_0108.c | strndel (str, lng, pos, cnt) +str_0109.c | delstr (s, p) /* L�sche ein Zeichen */ +# +str_0201.c | int abbrev (char *unabbr, char *abbr, int lng) +str_0202.c | char *translate (...) +str_0203.c | int verify (char *string, char *reference) +str_0204.c | int strip (char *string, char *where) +# +str_0301.c | char *strdup (char *str); +str_0301.c |__CMS__ | fuer CMS +str_0302.c | char *strndup (char *str, int size); +str_0303.c | char *strrev (char *str) +str_0304.c | char *strdup_max (char *str, int max_size); +# +# +strings.c | Test Modul f�r String Operationen +* | diff --git a/lib/ds/strings/.cvsignore b/lib/ds/strings/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..50c53328f85db3abc4661fd3cadbc0d7658aa2a3 --- /dev/null +++ b/lib/ds/strings/.cvsignore @@ -0,0 +1 @@ +strndup-test-ok diff --git a/lib/ds/strings/Makefile b/lib/ds/strings/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..eb0accd2bd9f6448fb91904533eb037865326985 --- /dev/null +++ b/lib/ds/strings/Makefile @@ -0,0 +1,59 @@ +# +# FILE %ds/strings/make-ux +# +# string processing library +# +# written: 1995-12-12 +# latest update: 1999-05-08 9:51:58 +# +# ---------------------------------------------------------------------------- +CC=cc +# CF=-pedantic -Wall -Wuninitialized -Wunused -Wshadow +OPTS=-g -I. -I/usr/local/include $(cf) +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + str_0001.o str_0002.o str_0003.o str_0004.o str_0005.o str_0006.o \ + str_0007.o str_0008.o str_0009.o str_0010.o str_0011.o str_0012.o \ + str_0013.o str_0014.o str_0015.o str_0016.o str_0017.o str_0018.o \ + str_0019.o str_0020.o str_0021.o str_0022.o str_0023.o str_0024.o \ + str_0025.o str_0026.o str_0027.o str_0028.o str_0029.o str_0030.o \ + str_0031.o str_0032.o str_0033.o str_0034.o str_0035.o str_0036.o \ + str_0037.o str_0037.o str_0039.o str_0040.o str_0041.o str_0042.o \ + str_0043.o str_0044.o str_0045.o str_0046.o str_0047.o str_0048.o \ + str_0049.o str_0050.o str_0051.o str_0052.o str_0053.o + +LIBOBJS1= \ + str_0107.o str_0108.o str_0109.o \ + str_0201.o str_0202.o str_0203.o str_0204.o \ + str_0302.o str_0303.o str_0304.o + +# only needed on certain systems... +LIBOBJS99= str_0301.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) $(LIBOBJS1) $(LIBOBJS2) + ar ru $(LIB) $(LIBOBJS0) + ar ru $(LIB) $(LIBOBJS1) + touch lib + +.c.o: + $(CC) $(OPTS) -c $? + +# ---------------------------------------------------------------------------- +TEST_OK= strndup-test-ok +TEST_FAIL= strndup-test-fail +clean: + rm -f *.o lib + +test-ok: $(TEST_OK) +test-fail: $(TEST_FAIL) + +strndup-test-fail : strndup-test.c + $(CC) $(OPTS) -o $@ $? + +strndup-test-ok : strndup-test.c str_0302.o + $(CC) $(OPTS) -o $@ -DTEST_OK strndup-test.c str_0302.o diff --git a/lib/ds/strings/contrib b/lib/ds/strings/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/strings/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/strings/gg b/lib/ds/strings/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/strings/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/strings/lib b/lib/ds/strings/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/strings/libgg.a b/lib/ds/strings/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/strings/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/strings/make-dos b/lib/ds/strings/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..2cf8e3989bbac8b07c0e169cfab4c4bfbde0bf9d --- /dev/null +++ b/lib/ds/strings/make-dos @@ -0,0 +1,404 @@ +# +# FILE %ds/strings/makefile +# +# string processing library +# +# written: 198?-??-?? +# latest update: 1997-10-05 12:23:39 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$*.obj /c +cms=cl -AS /W3 /Fo$*.obj /c +ccl=cl -AL +ccs=cl -AS +obj=objdec -w -d -m0 +objs=objdec -w -d -m0 -sl 2 STRINGS_TEXT +incl=c:\c5\include\gg\ +bin=c:\bin\ + +all : lib.lsbr all.exe +all.exe : $(bin)fnmdef.exe +test.exe : strings.exe t.exe tt.exe zs.exe dt011t.exe str_0043.exe + +# LARGE Library -------------------------------------------------------------- +lib.lsbr : string1.lgrp string2.lgrp string3.lgrp + +string1.lgrp : ! + large\str_0001.obj large\str_0002.obj large\str_0003.obj large\str_0004.obj ! + large\str_0005.obj large\str_0006.obj large\str_0007.obj large\str_0008.obj ! + large\str_0009.obj large\str_0010.obj large\str_0011.obj large\str_0012.obj ! + large\str_0013.obj large\str_0014.obj large\str_0015.obj large\str_0016.obj ! + large\str_0017.obj large\str_0018.obj large\str_0019.obj large\str_0020.obj ! + large\str_0021.obj large\str_0022.obj large\str_0023.obj large\str_0024.obj ! + large\str_0025.obj large\str_0026.obj large\str_0027.obj large\str_0028.obj + +string2.lgrp : ! + large\str_0029.obj large\str_0030.obj large\str_0031.obj large\str_0032.obj ! + large\str_0033.obj large\str_0034.obj large\str_0035.obj large\str_0036.obj ! + large\str_0037.obj large\str_0038.obj large\str_0039.obj large\str_0040.obj ! + large\str_0041.obj large\str_0042.obj large\str_0043.obj large\str_0044.obj ! + large\str_0045.obj large\str_0046.obj large\str_0047.obj large\str_0048.obj ! + large\str_0049.obj large\str_0050.obj large\str_0051.obj large\str_0052.obj ! + large\str_0053.obj + +string3.lgrp : ! + large\str_0107.obj large\str_0108.obj large\str_0109.obj ! + large\str_0201.obj large\str_0202.obj large\str_0203.obj large\str_0204.obj ! + large\str_0301.obj large\str_0302.obj large\str_0303.obj large\str_0304.obj + +# SMALL Library -------------------------------------------------------------- +lib.ssbr : part.s1 part.s2 part.s3 ssbr.lib + +part.s2 : ! + small\str_s001.obj small\str_s002.obj small\str_s003.obj small\str_s004.obj ! + small\str_s005.obj small\str_s006.obj small\str_s007.obj small\str_s008.obj ! + small\str_s009.obj small\str_s107.obj small\str_s108.obj small\str_s109.obj + +# ---------------------------------------------------------------------------- +# generate include tables for category and weight codes + +str_0041.tbl : \etc\codes\table + codeconv -spc437 -spc -sascii -dcatc -wcstr_0041.tbl + +str_0042.tbl : \etc\codes\table + codeconv -spc437 -spc -sascii -dwgtc -wcstr_0042.tbl + +# +# =========================== +# Stringmanipulationen (Test) ------------------------------------------------ +strings.exe : strings.obj + link strings,,,c:\usr\sbr\lsbr; + +strings.obj : strings.c + $(cml) strings.c + $(obj) strings.obj + +stt.exe : stt.obj + link stt str_0015.obj,,\dev\nul,c:\usr\sbr\lsbr/NOE; + +stt.obj : stt.c + $(cml) stt.c + +str_0043.exe : str_0043.obj + link str_0043,,,c:\usr\sbr\lsbr; + +str_0043.obj : str_0043.c + $(cml) -DTEST str_0043.c + +large\stt_0020.obj : stt_0020.c + $(cml) stt_0020.c + +stt_0020.exe : large\stt_0020.obj large\str_0020.obj + link large\stt_0020 large\str_0020; + +stt_0035.obj : str_0035.c + $(cml) -DDEBUG str_0035.c + +stt_0035.exe : stt_0035.obj + link stt_0035,,\dev\nul,c:\usr\sbr\lsbr/NOE; + +# ============= +# LARGE LIBRARY +# ------------- + +large\str_0001.obj : str_0001.c + $(cml) str_0001.c + $(objs) $@ + +large\str_0002.obj : str_0002.c + $(cml) str_0002.c + $(objs) $@ + +large\str_0003.obj : str_0003.c + $(cml) str_0003.c + $(objs) $@ + +large\str_0004.obj : str_0004.c + $(cml) str_0004.c + $(objs) $@ + +large\str_0005.obj : str_0005.c + $(cml) str_0005.c + $(objs) $@ + +large\str_0006.obj : str_0006.c + $(cml) str_0006.c + $(objs) $@ + +large\str_0007.obj : str_0007.c + $(cml) str_0007.c + $(objs) $@ + +large\str_0008.obj : str_0008.c + $(cml) str_0008.c + $(objs) $@ + +large\str_0009.obj : str_0009.c + $(cml) str_0009.c + $(objs) $@ + +large\str_0010.obj : str_0010.c + $(cml) str_0010.c + $(objs) $@ + +large\str_0011.obj : str_0011.c + $(cml) str_0011.c + $(objs) $@ + +large\str_0012.obj : str_0012.c + $(cml) str_0012.c + $(objs) $@ + +large\str_0013.obj : str_0013.c + $(cml) str_0013.c + $(objs) $@ + +large\str_0014.obj : str_0014.c + $(cml) str_0014.c + $(objs) $@ + +large\str_0015.obj : str_0015.c + $(cml) str_0015.c + $(objs) $@ + +large\str_0016.obj : str_0016.c + $(cml) str_0016.c + $(objs) $@ + +large\str_0017.obj : str_0017.c + $(cml) str_0017.c + $(objs) $@ + +large\str_0018.obj : str_0018.c + $(cml) str_0018.c + $(objs) $@ + +large\str_0019.obj : str_0019.c + $(cml) str_0019.c + $(objs) $@ + +large\str_0020.obj : str_0020.c + $(cml) str_0020.c + $(objs) $@ + +large\str_0021.obj : str_0021.c + $(cml) str_0021.c + $(objs) $@ + +large\str_0022.obj : str_0022.c + $(cml) str_0022.c + $(objs) $@ + +large\str_0023.obj : str_0023.c + $(cml) str_0023.c + $(objs) $@ + +large\str_0024.obj : str_0024.c + $(cml) str_0024.c + $(objs) $@ + +large\str_0025.obj : str_0025.c + $(cml) str_0025.c + $(objs) $@ + +large\str_0026.obj : str_0026.c + $(cml) str_0026.c + $(objs) $@ + +large\str_0027.obj : str_0027.c + $(cml) str_0027.c + $(objs) $@ + +large\str_0028.obj : str_0028.c + $(cml) str_0028.c + $(objs) $@ + +large\str_0029.obj : str_0029.c + $(cml) str_0029.c + $(objs) $@ + +large\str_0030.obj : str_0030.c + $(cml) str_0030.c + $(objs) $@ + +large\str_0031.obj : str_0031.c + $(cml) str_0031.c + $(objs) $@ + +large\str_0032.obj : str_0032.c + $(cml) str_0032.c + $(objs) $@ + +large\str_0033.obj : str_0033.c + $(cml) str_0033.c + $(objs) $@ + +large\str_0034.obj : str_0034.c + $(cml) str_0034.c + $(objs) $@ + +large\str_0035.obj : str_0035.c + $(cml) str_0035.c + $(objs) $@ + +large\str_0036.obj : str_0036.c + $(cml) str_0036.c + $(objs) $@ + +large\str_0037.obj : str_0037.c + $(cml) str_0037.c + $(objs) $@ + +large\str_0038.obj : str_0038.c + $(cml) str_0038.c + $(objs) $@ + +large\str_0039.obj : str_0039.c + $(cml) str_0039.c + $(objs) $@ + +large\str_0043.obj : str_0043.c + $(cml) str_0043.c + $(objs) $@ + +large\str_0040.obj : str_0040.c + $(cml) $? + $(objs) $@ + +large\str_0041.obj : str_0041.c str_0041.tbl + $(cml) str_0041.c + $(objs) $@ + +large\str_0042.obj : str_0042.c str_0042.tbl + $(cml) str_0042.c + $(objs) $@ + +large\str_0043.obj : str_0043.c + $(cml) $? + $(objs) $@ + +large\str_0044.obj : str_0044.c + $(cml) $? + $(objs) $@ + +large\str_0045.obj : str_0045.c + $(cml) $? + $(objs) $@ + +large\str_0046.obj : str_0046.c + $(cml) $? + $(objs) $@ + +large\str_0047.obj : str_0047.c + $(cml) $? + $(objs) $@ + +large\str_0048.obj : str_0048.c + $(cml) $? + $(objs) $@ + +large\str_0049.obj : str_0049.c + $(cml) $? + $(objs) $@ + +large\str_0050.obj : str_0050.c + $(cml) $? + $(objs) $@ + +large\str_0051.obj : str_0051.c + $(cml) $? + $(objs) $@ + +large\str_0052.obj : str_0052.c + $(cml) $? + $(objs) $@ + +large\str_0053.obj : str_0053.c + $(cml) $? + $(objs) $@ + +# +large\str_0107.obj : str_0107.c + $(cml) str_0107.c + $(objs) $@ + +large\str_0108.obj : str_0108.c + $(cml) str_0108.c + $(objs) $@ + +large\str_0109.obj : str_0109.c + $(cml) str_0109.c + $(objs) $@ + +large\str_0201.obj : str_0201.c + $(cml) str_0201.c + $(objs) $@ + +large\str_0202.obj : str_0202.c + $(cml) str_0202.c + $(objs) $@ + +large\str_0203.obj : str_0203.c + $(cml) str_0203.c + $(objs) $@ + +large\str_0204.obj : str_0204.c + $(cml) str_0204.c + $(objs) $@ + +large\str_0301.obj : str_0301.c + $(cml) str_0301.c + $(objs) $@ + +large\str_0302.obj : str_0302.c + $(cml) str_0302.c + $(objs) $@ + +large\str_0303.obj : str_0303.c + $(cml) str_0303.c + $(objs) $@ + +large\str_0304.obj : str_0304.c + $(cml) str_0304.c + $(objs) $@ + +# ---------------------------------------------------------------------------- +# ============= +# SMALL LIBRARY +# ------------- + +small\str_s001.obj : str_0001.c + $(cms) str_0001.c + +small\str_s002.obj : str_0002.c + $(cms) str_0002.c + +small\str_s003.obj : str_0003.c + $(cms) str_0003.c + +small\str_s004.obj : str_0004.c + $(cms) str_0004.c + +small\str_s005.obj : str_0005.c + $(cms) str_0005.c + +small\str_s006.obj : str_0006.c + $(cms) str_0006.c + +small\str_s007.obj : str_0007.c + $(cms) str_0007.c + +small\str_s008.obj : str_0008.c + $(cms) str_0008.c + +small\str_s009.obj : str_0009.c + $(cms) str_0009.c + +small\str_s107.obj : str_0107.c + $(cms) str_0107.c + +small\str_s108.obj : str_0108.c + $(cms) str_0108.c + +small\str_s109.obj : str_0109.c + $(cms) str_0109.c diff --git a/lib/ds/strings/str_0001.c b/lib/ds/strings/str_0001.c new file mode 100644 index 0000000000000000000000000000000000000000..ef3fb58a7404d2e77a10d48c478914c0089540bb --- /dev/null +++ b/lib/ds/strings/str_0001.c @@ -0,0 +1,57 @@ +/* + * FILE %ds/strings/str_0001.c + * + * copy string and strip blanks and tabs + * + * written: 1989 10 14: (aus STRINGS.SAR) + * 1992 09 13: revision + * latest update: 1996-09-28 18:05:24 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +void strnscpy ( /* String Copy; Strip Blanks & TABS; */ +char *d, /* destination */ +char *s, /* source */ +int cnt) /* maximal cnt Zeichen in Dest; d [cnt]=0; */ +{ + int blank= 0; + int anything= 0; + + for (;;) + switch (*s) + { + case 0x00: *d= 0; return; + case 0x09: + + case 0x20: + if (anything) blank= 1; + s++; + break; + + default: + if (cnt - blank - 1 < 0) + { + *d= 0; + return; + } + + if (blank) + { + *d++= 0x20; + cnt--; + blank=0; + } + + *d++= *s++; + cnt--; + anything= 1; + break; + } +} diff --git a/lib/ds/strings/str_0001.o b/lib/ds/strings/str_0001.o new file mode 100644 index 0000000000000000000000000000000000000000..6863142a3f89e64781aa25f1eef566e11f658fe1 Binary files /dev/null and b/lib/ds/strings/str_0001.o differ diff --git a/lib/ds/strings/str_0002.c b/lib/ds/strings/str_0002.c new file mode 100644 index 0000000000000000000000000000000000000000..84165f6cd750a37c83f33c9c3f78f1d896784fbb --- /dev/null +++ b/lib/ds/strings/str_0002.c @@ -0,0 +1,70 @@ +/* + * FILE %ds/strings/str_0002.c + * + * written: 1989 10 14: (aus STRINGS.SAR) + * 1990 11 23: alle uebersetzbaren Zeichen werden behandelt + * 1992 09 13: revision + * latest update: 1996-01-30 11:08:12 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int strcmp_c (char *s1, char *s2) +{ + int i, c1, c2; + + if (s1 == (char *) 0 || s2 == (char *) 0) + { + if (s1 != (char *) 0) return -1; + if (s2 != (char *) 0) return 1; + return 0; + } + + for (i= 0; (c1= s1 [i] & 0x00FF) + &&(c2= s2 [i] & 0x00FF); i++) + { + switch (c1) + { +#ifdef MSDOS + case 0x0080: c1 = 0x0087; break; /* � -> � */ + case 0x008E: c1 = 0x0084; break; /* � -> � */ + case 0x008F: c1 = 0x0086; break; /* � -> � */ + case 0x0090: c1 = 0x0082; break; /* � -> � */ + case 0x0092: c1 = 0x0091; break; /* � -> � */ + case 0x0099: c1 = 0x0094; break; /* � -> � */ + case 0x009A: c1 = 0x0081; break; /* � -> � */ + case 0x00A5: c1 = 0x00A4; break; /* � -> � */ +#endif /* MSDOS */ + default : if (c1 >= 'A' && c1 <= 'Z') + c1 = c1 - 'A' + 'a'; + break; + } + + switch (c2) + { +#ifdef MSDOS + case 0x0080: c2 = 0x0087; break; /* � -> � */ + case 0x008E: c2 = 0x0084; break; /* � -> � */ + case 0x008F: c2 = 0x0086; break; /* � -> � */ + case 0x0090: c2 = 0x0082; break; /* � -> � */ + case 0x0092: c2 = 0x0091; break; /* � -> � */ + case 0x0099: c2 = 0x0094; break; /* � -> � */ + case 0x009A: c2 = 0x0081; break; /* � -> � */ + case 0x00A5: c2 = 0x00A4; break; /* � -> � */ +#endif /* MSDOS */ + default : if (c2 >= 'A' && c2 <= 'Z') + c2 = c2 - 'A' + 'a'; + break; + } + if (c1 != c2) + return (c1 - c2 < 0) ? -1 : 1; + } + + return (s1 [i] - s2 [i] < 0) ? -1 : 0; +} diff --git a/lib/ds/strings/str_0002.o b/lib/ds/strings/str_0002.o new file mode 100644 index 0000000000000000000000000000000000000000..1e9beeb0afb7b2211113b8849948aa691e9ae5e4 Binary files /dev/null and b/lib/ds/strings/str_0002.o differ diff --git a/lib/ds/strings/str_0003.c b/lib/ds/strings/str_0003.c new file mode 100644 index 0000000000000000000000000000000000000000..297c32efb3cc0e563e503d9c238a4705b1486435 --- /dev/null +++ b/lib/ds/strings/str_0003.c @@ -0,0 +1,31 @@ +/* + * FILE /usr/sbr/str_0003.c + * + * 1989 10 14: (aus STRINGS.SAR) + * 1992 09 13: revision + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/asc2ebc.inc> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int strcmp_ebcdic (char *s1, char *s2) /* z.Z. unvollstaendig */ +{ + int c1, c2; + + while (*s1 == *s2 && *s1) + { + s1++; + s2++; + } + + if ((c1= *s1 & 0x00FF) == (c2= *s2 & 0x00FF)) return 0; + + return ((CODE_ASCII_to_EBCDIC [c1] & 0x00FF) - + (CODE_ASCII_to_EBCDIC [c2] & 0x00FF) < 0) ? -1 : 1; +} diff --git a/lib/ds/strings/str_0003.o b/lib/ds/strings/str_0003.o new file mode 100644 index 0000000000000000000000000000000000000000..a0e22025a4e900b5225b6b4162e06a1589f9f0ce Binary files /dev/null and b/lib/ds/strings/str_0003.o differ diff --git a/lib/ds/strings/str_0004.c b/lib/ds/strings/str_0004.c new file mode 100644 index 0000000000000000000000000000000000000000..4a6e90d4ea6e831d990e0cad1e48f220976a7a66 --- /dev/null +++ b/lib/ds/strings/str_0004.c @@ -0,0 +1,53 @@ +/* + * FILE %ds/strings/str_0004.c + * + * written: 1989 10 14: (aus STRINGS.SAR) + * 1990 11 23: Revision, all translatable characters + * are converted + * 1992 09 13: revision + * 1993-03-03: CMS adaption + * latest update: 1995-11-26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *to_lower (char *n) +{ + int i, c; + + if (n == (char *) 0) return (char *) 0; + +#ifndef __CMS__ + for (i = 0; (c= n [i] & 0x00FF) != 0; i++) + if (c >= 'A' && c <= 'Z') + n [i]= (char) (c - 'A' + 'a'); +#ifdef MSDOS + else + switch (c) + { /* This applies only to the PC (MSDOS)! */ + case 0x0080: n [i] = (char) 0x0087; break; /* � -> � */ + case 0x008E: n [i] = (char) 0x0084; break; /* � -> � */ + case 0x008F: n [i] = (char) 0x0086; break; /* � -> � */ + case 0x0090: n [i] = (char) 0x0082; break; /* � -> � */ + case 0x0092: n [i] = (char) 0x0091; break; /* � -> � */ + case 0x0099: n [i] = (char) 0x0094; break; /* � -> � */ + case 0x009A: n [i] = (char) 0x0081; break; /* � -> � */ + case 0x00A5: n [i] = (char) 0x00A4; break; /* � -> � */ + } +#endif /* MSDOS */ +#else + for (i = 0; c = n [i] & 0x00FF; i++) + if ((c >= 'A' && c <= 'I') + ||(c >= 'J' && c <= 'R') + ||(c >= 'S' && c <= 'Z')) + n [i]= (char) (c - 'A' + 'a'); +#endif + + return n; +} diff --git a/lib/ds/strings/str_0004.o b/lib/ds/strings/str_0004.o new file mode 100644 index 0000000000000000000000000000000000000000..bacf2ccb8a13dbcfd135415e25e283505fd01919 Binary files /dev/null and b/lib/ds/strings/str_0004.o differ diff --git a/lib/ds/strings/str_0005.c b/lib/ds/strings/str_0005.c new file mode 100644 index 0000000000000000000000000000000000000000..b05102d1e1323199d3dfb607d2af5868b5779c31 --- /dev/null +++ b/lib/ds/strings/str_0005.c @@ -0,0 +1,52 @@ +/* + * FILE ~/usr/sbr/str_0005.c + * + * written: 1989 10 14: (aus STRINGS.SAR) + * 1990 11 23: alle uebersetzbaren Zeichen werden behandelt + * 1992 09 13: revision + * 1993-03-03: CMS adaption + * latest update: 1995-03-18 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *to_upper (char *n) +{ + int i, c; + + if (n == (char *) 0) return (char *) 0; + +#ifndef __CMS__ + for (i= 0; (c= (n [i] & 0x00FF)) != 0; i++) + if (c >= 'a' && c <= 'z') + n [i] = (char) (c - 'a' + 'A'); +#ifdef MSDOS + else + switch (c) + { /* this applies only to the PC (MSDOS)! */ + case 0x0087: n [i] = (char) 0x0080; break; /* � <- � */ + case 0x0084: n [i] = (char) 0x008E; break; /* � <- � */ + case 0x0086: n [i] = (char) 0x008F; break; /* � <- � */ + case 0x0080: n [i] = (char) 0x0090; break; /* � <- � */ + case 0x0091: n [i] = (char) 0x0092; break; /* � <- � */ + case 0x0094: n [i] = (char) 0x0099; break; /* � <- � */ + case 0x0081: n [i] = (char) 0x009A; break; /* � <- � */ + case 0x00A4: n [i] = (char) 0x00A5; break; /* � <- � */ + } +#endif /* MSDOS */ +#else + for (i= 0; c= n [i] & 0x00FF; i++) + if ((c >= 'a' && c <= 'i') + ||(c >= 'j' && c <= 'r') + ||(c >= 's' && c <= 'z')) + n [i] = (char) (c - 'a' + 'A'); +#endif + + return n; +} diff --git a/lib/ds/strings/str_0005.o b/lib/ds/strings/str_0005.o new file mode 100644 index 0000000000000000000000000000000000000000..2fca62ab253ca36f9309374e46c370cceafbb420 Binary files /dev/null and b/lib/ds/strings/str_0005.o differ diff --git a/lib/ds/strings/str_0006.c b/lib/ds/strings/str_0006.c new file mode 100644 index 0000000000000000000000000000000000000000..470c8cd95fbe86fddf94a7a88447e5aef4223727 --- /dev/null +++ b/lib/ds/strings/str_0006.c @@ -0,0 +1,94 @@ +/* + * FILE %ds/strings/str_0006.c + * + * written: 1989 10 14: (from STRINGS.SAR) + * 1992 09 13: revision + * 1992 09 13: revision + * latest update: 1997-08-28 13:27:41 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int match ( /* match strings (e.g: filenames) */ +char *pattern, /* matching pattern */ +char *string) /* string to match */ +/* RETURN: 0 .. no match */ +/* 1 .. match without wildcard */ +/* 2 .. match with wildcard */ +{ +#define STAT_start 0 +#define STAT_wild_string 1 +#define STAT_wild_char 3 + int stat= STAT_start; /* state of the automato */ + int wild= MATCH_no_wildcard; /* ... used as return value */ + int ch_p= 0; /* letztes Zeichen von pattern */ + int p_ch_p= 0; /* Pattern Backtracking Char */ + char *p_pattern= (char *) 0; /* Pattern Backtracking Puffer */ + char *p_string= (char *) 0; /* String . . */ + + for (;;) + { + switch (stat) + { + case STAT_start: + switch (ch_p= *pattern++) + { + case 0: stat= 4; break; + case '?': stat= STAT_wild_char; wild= MATCH_wildcard; break; + case '*': stat= STAT_wild_string; wild= MATCH_wildcard; break; + default : stat= 5; break; + } + break; + + case STAT_wild_string: + switch (ch_p= *pattern++) + { + case 0: return wild; /* * at end of string, match all */ + case '*': /* skip over all other wild chars */ + case '?': break; /* including single char matches */ + default : stat = 2; break; + } + break; + + case 2: + if (!*string) /* Sonderfall: *.(te) soll auch gematcht werden */ + return MATCH_no; + if (*string++ == (char) ch_p) + { + p_string= string; + p_pattern= pattern; + p_ch_p= ch_p; + stat= STAT_start; + } + break; + + case STAT_wild_char: + stat= (!*string++) ? 6 : STAT_start; + break; + + case 4: + if (*string) stat= 6; + else return wild; + /* *NO* break here! */ + + case 5: + stat= (*string++ != (char) ch_p) ? stat= 6 : STAT_start; + break; + + case 6: /* Kein Match; Backtracking versuchen */ + if (p_pattern == (char *) 0 + ||p_string == (char *) 0) return MATCH_no; + string= p_string; + pattern= p_pattern; + ch_p= p_ch_p; + stat= 2; /* Zurueck zur Wildcard */ + break; + } + } +} diff --git a/lib/ds/strings/str_0006.o b/lib/ds/strings/str_0006.o new file mode 100644 index 0000000000000000000000000000000000000000..2a9be9edb070a96ab5cfef2e7f23ec7f911a777b Binary files /dev/null and b/lib/ds/strings/str_0006.o differ diff --git a/lib/ds/strings/str_0007.c b/lib/ds/strings/str_0007.c new file mode 100644 index 0000000000000000000000000000000000000000..0641f9a18a3792287caf6b3b8b3467369deb9878 --- /dev/null +++ b/lib/ds/strings/str_0007.c @@ -0,0 +1,30 @@ +/* + * FILE ~/usr/sbr/str_0007.c + * + * generate checkstrings over strings. + * + * written: 1989 10 14: (from STRINGS.SAR) + * latest update: 1995-05-13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int string_hash ( +char *str, /* string to check */ +int lng, /* length of the string to check */ +char *hash, /* hash string generated */ +int hlng) /* length of wanted hash-strings */ +{ + int i; + + for (i=0; i<hlng; i++) hash [i ] = 0; + for (i=0; i< lng; i++) hash [i % hlng] += str [i]; + + return 0; +} diff --git a/lib/ds/strings/str_0007.o b/lib/ds/strings/str_0007.o new file mode 100644 index 0000000000000000000000000000000000000000..961d0a70c50695a82aa2d8213e01ca468c6ade8a Binary files /dev/null and b/lib/ds/strings/str_0007.o differ diff --git a/lib/ds/strings/str_0008.c b/lib/ds/strings/str_0008.c new file mode 100644 index 0000000000000000000000000000000000000000..94bb00cbb18f6067ed3f395b9ecaa88ed26a31f7 --- /dev/null +++ b/lib/ds/strings/str_0008.c @@ -0,0 +1,69 @@ +/* + * FILE %ds/strings/str_0008.c + * + * Anzahl der uebereinstimmenden Zeichen bestimmen + * + * written: 1989 10 14: (aus STRINGS.SAR) + * 1992 09 13: revision + * latest update: 1996-11-03 9:15:19 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* Anzahl der uebereinstimmenden Zeichen: --------------------------------- */ +int match_lng ( +char *s1, +char *s2, +int cnt) +{ + int c; + int c1; + int c2; + + if (s1 == (char *) 0 || s2 == (char *) 0 || s1 == s2) return 0; + + for (c= 0; ; c++) + if (c == cnt || !(c1= *s1++) || !(c2= *s2++) || c1 != c2) return c; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef _DEBUG_MODULE_ +struct TEST +{ + char *s1, *s2; + int lng; +} ; + +# define TEST_CNT 7 +struct TEST test [TEST_CNT] = +{ + "abcd", "abab", 4, + "Gerhard", "Gonter", 99, + "Gerhard", "Gerald", 99, + + "just the same", "just the same", 99, + "this one", "this one is longer", 99, + "this one is longer", "this one", 99, + "this one is longer", "this one", 3 +} ; + +main () +{ + int i, rc; + + for (i= 0; i < TEST_CNT; i++) + { + rc= match_lng (test[i].s1, test[i].s2, test[i].lng); + printf ("s1='%s' s2='%s' lng=%d -> rc=%d\n", + test[i].s1, test[i].s2, test[i].lng, rc); + } +} + +#endif /* _DEBUG_MODULE */ diff --git a/lib/ds/strings/str_0008.o b/lib/ds/strings/str_0008.o new file mode 100644 index 0000000000000000000000000000000000000000..14c55272e8c1c81e2c3bae61ca04f916da37aed6 Binary files /dev/null and b/lib/ds/strings/str_0008.o differ diff --git a/lib/ds/strings/str_0009.c b/lib/ds/strings/str_0009.c new file mode 100644 index 0000000000000000000000000000000000000000..4a82fb01ca06b0346bdd970d1c4c19a4f4e22095 --- /dev/null +++ b/lib/ds/strings/str_0009.c @@ -0,0 +1,40 @@ +/* + * FILE ~/usr/sbr/str_0009.c + * + * String Compare, unsigned Characters + * + * written: 1990 07 14: aus c:/usr/utl/merge.c + * 1992 09 13: revision + * latest update: 1995-02-12 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int strcmp_us (char *s1, char *s2) +{ + if (s1 == (char *) 0 || s2 == (char *) 0) + { + if (s1 != (char *) 0) return -1; + if (s2 != (char *) 0) return 1; + + return 0; + } + + while (*s1 == *s2 && *s1) + { + s1++; + s2++; + } + + if (*s1 == *s2) return 0; + if (*s1 == 0) return -1; + if (*s2 == 0) return 1; + + return (((*s1 & 0x00FF) - (*s2 & 0x00FF)) < 0) ? -1 : 1; +} diff --git a/lib/ds/strings/str_0009.o b/lib/ds/strings/str_0009.o new file mode 100644 index 0000000000000000000000000000000000000000..65e10de505b54e577fffdac5bc19ba55fe68b865 Binary files /dev/null and b/lib/ds/strings/str_0009.o differ diff --git a/lib/ds/strings/str_0010.c b/lib/ds/strings/str_0010.c new file mode 100644 index 0000000000000000000000000000000000000000..6630fb60dd877846086afd56c78b41ac278ba5f8 --- /dev/null +++ b/lib/ds/strings/str_0010.c @@ -0,0 +1,47 @@ +/* + * FILE ~/usr/sbr/str_0010.c + * + * String Compare, weighted Characters + * + * written: 1990 11 23 + * 1992 09 13: revision + * latest update: 1995-05-13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifndef MSDOS +#ifndef cdecl +#define cdecl +#endif + +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int strcmp_weighted (char *s1, char *s2) +{ + if (s1 == (char *) 0 || s2 == (char *) 0) + { + if (s1 != (char *) 0) return -1; + if (s2 != (char *) 0) return 1; + return 0; + } + + while (*s1 == *s2 && *s1) + { + s1++; + s2++; + } + + if (*s1 == *s2) return 0; + if (*s1 == 0) return -1; + if (*s2 == 0) return 1; + + return ((get_weight_code (*s1 & 0x00FF) + - get_weight_code (*s2 & 0x00FF)) < 0) ? -1 : 1; +} diff --git a/lib/ds/strings/str_0010.o b/lib/ds/strings/str_0010.o new file mode 100644 index 0000000000000000000000000000000000000000..246ef4bd426664ef868e13690355a919def4565b Binary files /dev/null and b/lib/ds/strings/str_0010.o differ diff --git a/lib/ds/strings/str_0011.c b/lib/ds/strings/str_0011.c new file mode 100644 index 0000000000000000000000000000000000000000..34ff568ca4cc7f5173072f51869d1ec862e89fbd --- /dev/null +++ b/lib/ds/strings/str_0011.c @@ -0,0 +1,78 @@ +/* + * FILE /usr/sbr/str_0011.c + * + * String Compare, weighted Characters, without case + * + * 1990 11 23 + * 1992 09 13: revision + * + */ + +# ifdef MSDOS +# pragma check_stack(off) +# endif +# ifndef MSDOS +# ifndef cdecl +# define cdecl +# endif +# endif + +#include <gg/strings.h> + +int cdecl get_weight_code (int code); + +/* ------------------------------------------------------------------------ */ +int strcmp_cweighted (char *s1, char *s2) +{ + int i, c1, c2; + + if (s1 == (char *) 0 || s2 == (char *) 0) + { + if (s1 != (char *) 0) return -1; + if (s2 != (char *) 0) return 1; + return 0; + } + + for (i = 0; (c1 = s1 [i] & 0x00FF) && + (c2 = s2 [i] & 0x00FF); i++) + { + switch (c1) + { + case 0x0080: c1 = 0x0087; break; /* � -> � */ + case 0x008E: c1 = 0x0084; break; /* � -> � */ + case 0x008F: c1 = 0x0086; break; /* � -> � */ + case 0x0090: c1 = 0x0082; break; /* � -> � */ + case 0x0092: c1 = 0x0091; break; /* � -> � */ + case 0x0099: c1 = 0x0094; break; /* � -> � */ + case 0x009A: c1 = 0x0081; break; /* � -> � */ + case 0x00A5: c1 = 0x00A4; break; /* � -> � */ + default : if (c1 >= 'A' && c1 <= 'Z') + c1 = c1 - 'A' + 'a'; + break; + } + + switch (c2) + { + case 0x0080: c2 = 0x0087; break; /* � -> � */ + case 0x008E: c2 = 0x0084; break; /* � -> � */ + case 0x008F: c2 = 0x0086; break; /* � -> � */ + case 0x0090: c2 = 0x0082; break; /* � -> � */ + case 0x0092: c2 = 0x0091; break; /* � -> � */ + case 0x0099: c2 = 0x0094; break; /* � -> � */ + case 0x009A: c2 = 0x0081; break; /* � -> � */ + case 0x00A5: c2 = 0x00A4; break; /* � -> � */ + default : if (c2 >= 'A' && c2 <= 'Z') + c2 = c2 - 'A' + 'a'; + break; + } + + c1 = get_weight_code (c1); + c2 = get_weight_code (c2); + + if (c1 != c2) + return (c1 - c2 < 0) ? -1 : 1; + } + + return (get_weight_code (s1 [i] & 0x00FF) + - get_weight_code (s2 [i] & 0x00FF) < 0) ? -1 : 0; +} diff --git a/lib/ds/strings/str_0011.o b/lib/ds/strings/str_0011.o new file mode 100644 index 0000000000000000000000000000000000000000..ac18e338699d344161ec92b3bd13695247c72b18 Binary files /dev/null and b/lib/ds/strings/str_0011.o differ diff --git a/lib/ds/strings/str_0012.c b/lib/ds/strings/str_0012.c new file mode 100644 index 0000000000000000000000000000000000000000..1fd9f6d7b88fe3a234b3053d2713369a5016d743 --- /dev/null +++ b/lib/ds/strings/str_0012.c @@ -0,0 +1,37 @@ +/* + * FILE ~/usr/sbr/str_0012.c + * + * written: 1990 11 26 + * 1992 09 13: revision + * latest update: 1995-07-16 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int lower_case (int n) +{ + switch (n) + { +#ifdef MSDOS + case 0x0080: n = 0x0087; break; /* � -> � */ + case 0x008E: n = 0x0084; break; /* � -> � */ + case 0x008F: n = 0x0086; break; /* � -> � */ + case 0x0090: n = 0x0082; break; /* � -> � */ + case 0x0092: n = 0x0091; break; /* � -> � */ + case 0x0099: n = 0x0094; break; /* � -> � */ + case 0x009A: n = 0x0081; break; /* � -> � */ + case 0x00A5: n = 0x00A4; break; /* � -> � */ +#endif /* MSDOS */ + default: + if (n >= 'A' && n <= 'Z') n = (n - 'A' + 'a'); + break; + } + + return n; +} diff --git a/lib/ds/strings/str_0012.o b/lib/ds/strings/str_0012.o new file mode 100644 index 0000000000000000000000000000000000000000..b75b8821bd2aef2fb4a5a9384d497088bde2b44a Binary files /dev/null and b/lib/ds/strings/str_0012.o differ diff --git a/lib/ds/strings/str_0013.c b/lib/ds/strings/str_0013.c new file mode 100644 index 0000000000000000000000000000000000000000..19639f3d84abed857a572003e2f347c9e3593a07 --- /dev/null +++ b/lib/ds/strings/str_0013.c @@ -0,0 +1,37 @@ +/* + * FILE ~/usr/sbr/str_0013.c + * + * written: 1990 11 26 + * 1992 09 13: revision + * latest update: 1994-12-31 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int upper_case (int n) +{ + switch (n) + { +#ifdef MSDOS + case 0x0087: n = 0x0080; break; /* � <- � */ + case 0x0084: n = 0x008E; break; /* � <- � */ + case 0x0086: n = 0x008F; break; /* � <- � */ + case 0x0080: n = 0x0090; break; /* � <- � */ + case 0x0091: n = 0x0092; break; /* � <- � */ + case 0x0094: n = 0x0099; break; /* � <- � */ + case 0x0081: n = 0x009A; break; /* � <- � */ + case 0x00A4: n = 0x00A5; break; /* � <- � */ +#endif + default: + if (n >= 'a' && n <= 'z') n = (n - 'a' + 'A'); + break; + } + + return n; +} diff --git a/lib/ds/strings/str_0013.o b/lib/ds/strings/str_0013.o new file mode 100644 index 0000000000000000000000000000000000000000..c28cc624b2a30a1bd95f4083aec9562f6d6d5739 Binary files /dev/null and b/lib/ds/strings/str_0013.o differ diff --git a/lib/ds/strings/str_0014.c b/lib/ds/strings/str_0014.c new file mode 100644 index 0000000000000000000000000000000000000000..dd26b94ef31f508cd02f6aa580112d0b8361bde3 --- /dev/null +++ b/lib/ds/strings/str_0014.c @@ -0,0 +1,88 @@ +/* + * FILE ~/usr/sbr/str_0014.c + * + * written: 1991 01 27: aus str_0002.c abgeleitet + * 1992 09 13: revision + * latest update: 1994-11-23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int strcmp_cre (char *s1, char *s2) +{ + int idx1, idx2; + int c1, c2; + int skip; + + if (s1 == (char *) 0 || s2 == (char *) 0) + { + if (s1 != (char *) 0) return -1; + if (s2 != (char *) 0) return 1; + return 0; + } + + idx1= idx2= 0; + while ((c1= s1 [idx1] & 0x00FF) && + (c2= s2 [idx2] & 0x00FF)) + { + switch (c1) + { +#ifdef MSDOS + case 0x0080: c1 = 0x0087; break; /* � -> � */ + case 0x008E: c1 = 0x0084; break; /* � -> � */ + case 0x008F: c1 = 0x0086; break; /* � -> � */ + case 0x0090: c1 = 0x0082; break; /* � -> � */ + case 0x0092: c1 = 0x0091; break; /* � -> � */ + case 0x0099: c1 = 0x0094; break; /* � -> � */ + case 0x009A: c1 = 0x0081; break; /* � -> � */ + case 0x00A5: c1 = 0x00A4; break; /* � -> � */ +#endif /* MSDOS */ + case 'R': case 'r': + if ((skip= skip_re (&s1 [idx1])) > 0) + { + idx1 += skip; + continue; + } + default: + if (c1 >= 'A' && c1 <= 'Z') c1 = c1 - 'A' + 'a'; + break; + } + + switch (c2) + { +#ifdef MSDOS + case 0x0080: c2 = 0x0087; break; /* � -> � */ + case 0x008E: c2 = 0x0084; break; /* � -> � */ + case 0x008F: c2 = 0x0086; break; /* � -> � */ + case 0x0090: c2 = 0x0082; break; /* � -> � */ + case 0x0092: c2 = 0x0091; break; /* � -> � */ + case 0x0099: c2 = 0x0094; break; /* � -> � */ + case 0x009A: c2 = 0x0081; break; /* � -> � */ + case 0x00A5: c2 = 0x00A4; break; /* � -> � */ +#endif /* MSDOS */ + case 'R': case 'r': + skip = skip_re (&s2 [idx2]); + if (skip > 0) + { + idx2 += skip; + continue; + } + default: + if (c2 >= 'A' && c2 <= 'Z') c2 = c2 - 'A' + 'a'; + break; + } + + if (c1 != c2) return (c1 - c2 < 0) ? -1 : 1; + + idx1++; + idx2++; + } + + return (s1 [idx1] - s2 [idx2] < 0) ? -1 : 0; +} diff --git a/lib/ds/strings/str_0014.o b/lib/ds/strings/str_0014.o new file mode 100644 index 0000000000000000000000000000000000000000..f31b018157d1c6eaf3c9c7a9fcc9bfbc9f2d47f9 Binary files /dev/null and b/lib/ds/strings/str_0014.o differ diff --git a/lib/ds/strings/str_0015.c b/lib/ds/strings/str_0015.c new file mode 100644 index 0000000000000000000000000000000000000000..d1a0d520cfa43864f35c9fef47dda87bf0ffd902 --- /dev/null +++ b/lib/ds/strings/str_0015.c @@ -0,0 +1,30 @@ +/* + * FILE ~/usr/sbr/str_0015.c + * + * written: 1991 01 27 + * 1992 09 13: revision + * latest update: 1994-11-23 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int skip_re (char *str) +{ + if ((str [0] == 'R' || str [0] == 'r') && + (str [1] == 'E' || str [1] == 'e') && + str [2] == ':') + { + int idx= 3; + + while (str [idx] == ' ' || str [idx] == '\t') idx++; + return idx; + } + + return 0; +} diff --git a/lib/ds/strings/str_0015.o b/lib/ds/strings/str_0015.o new file mode 100644 index 0000000000000000000000000000000000000000..0d2432b98e688103c64b2b3a0283f3f440114846 Binary files /dev/null and b/lib/ds/strings/str_0015.o differ diff --git a/lib/ds/strings/str_0016.c b/lib/ds/strings/str_0016.c new file mode 100644 index 0000000000000000000000000000000000000000..4c801383c8705aedc5a180a0b7f36210248493a2 --- /dev/null +++ b/lib/ds/strings/str_0016.c @@ -0,0 +1,42 @@ +/* + * FILE %ds/strings/str_0016.c + * + * identify a command in a line of text. + * + * written: 1992-12-08 + * latest update: 1996-09-22 13:47:19 + * $Id: str_0016.c,v 1.2 2004/05/25 22:07:18 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int find_command (char *s, char *cmds[], int first, int last) +{ + int i; + int cl; + char *c; + int ch; + + if (s == (char *) 0) return -1; + + for (; (ch= *s) && (ch == ' ' || ch == '\t'); s++); + if (*s == 0) return -1; + + for (i= first; i <= last; i++) + { + if ((c= cmds[i]) == (char *) 0) continue; + + cl= strlen (c); + if (strncmp (s, c, cl) == 0 + && (s [cl] == 0 || s [cl] == ' ' || s [cl] == '\t')) return i; + } + + return -1; +} diff --git a/lib/ds/strings/str_0016.o b/lib/ds/strings/str_0016.o new file mode 100644 index 0000000000000000000000000000000000000000..5267ef8270e9095279f5e778e5b6f0d0092f8826 Binary files /dev/null and b/lib/ds/strings/str_0016.o differ diff --git a/lib/ds/strings/str_0017.c b/lib/ds/strings/str_0017.c new file mode 100644 index 0000000000000000000000000000000000000000..945f09df7b3ca2fc3bc71cd8c0e0ccf2899ce12e --- /dev/null +++ b/lib/ds/strings/str_0017.c @@ -0,0 +1,23 @@ +/* + * FILE %ds/strings/str_0017.c + * + * written: 1992 12 08 + * latest update: 1996-01-29 8:43:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *str_assign (char **d, char *s) +{ + free_or_what (*d); + *d= (s == (char *) 0) ? (char *) 0 : strdup (s); + + return *d; +} diff --git a/lib/ds/strings/str_0017.o b/lib/ds/strings/str_0017.o new file mode 100644 index 0000000000000000000000000000000000000000..9912174cfd3652ddadbde93ca62cae2d2393fa94 Binary files /dev/null and b/lib/ds/strings/str_0017.o differ diff --git a/lib/ds/strings/str_0018.c b/lib/ds/strings/str_0018.c new file mode 100644 index 0000000000000000000000000000000000000000..0f0b318d8bf33155817a7eaa92bf86f32cce5e07 --- /dev/null +++ b/lib/ds/strings/str_0018.c @@ -0,0 +1,33 @@ +/* + * FILE %ds/strings/str_0018.c + * + * written: 1992 12 08 + * latest update: 1996-05-06 10:36:43 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *rotate13 (char *s) +{ + int ch; + char *x; + + if (s == (char *) 0) return (char *) 0; + + for (x= s; ch= (*x) & 0x00FF; x++) + { + if (ch >= 'a' && ch <= 'm') ch= ch+13; else + if (ch >= 'n' && ch <= 'z') ch= ch-13; else + if (ch >= 'A' && ch <= 'M') ch= ch+13; else + if (ch >= 'N' && ch <= 'Z') ch= ch-13; + *x = (char) ch; + } + + return s; +} diff --git a/lib/ds/strings/str_0018.o b/lib/ds/strings/str_0018.o new file mode 100644 index 0000000000000000000000000000000000000000..51ed802be82b62484c0b3c320bdeef8b734ed48f Binary files /dev/null and b/lib/ds/strings/str_0018.o differ diff --git a/lib/ds/strings/str_0019.c b/lib/ds/strings/str_0019.c new file mode 100644 index 0000000000000000000000000000000000000000..09b05ade03b4302391fd7d82e77b5ea592a74aa7 --- /dev/null +++ b/lib/ds/strings/str_0019.c @@ -0,0 +1,29 @@ +/* + * FILE ~/usr/sbr/str_0019.c + * + * find last occurance of char in string + * + * written: 1993-01-15 + * latest update: 1994-08-13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *strridx (char *s, int ch) +{ + int i; + + if (s == (char *) 0) return (char *) 0; + + for (i= strlen(s)-1; i>=0; i--) + if (((int) (s[i] & 0x00FF)) == ch) return &s[i]; + + return (char *) 0; +} diff --git a/lib/ds/strings/str_0019.o b/lib/ds/strings/str_0019.o new file mode 100644 index 0000000000000000000000000000000000000000..a66419edf8b6c5341c5c32356d80237f3b0df041 Binary files /dev/null and b/lib/ds/strings/str_0019.o differ diff --git a/lib/ds/strings/str_0020.c b/lib/ds/strings/str_0020.c new file mode 100644 index 0000000000000000000000000000000000000000..07bcb40a448bc877bf2c120648eae04cea44de2c --- /dev/null +++ b/lib/ds/strings/str_0020.c @@ -0,0 +1,54 @@ +/* + * FILE %ds/strings/str_0020.c + * + * split a string into fields + * + * written: 1993-04-23 + * latest update: 1996-02-25 0:29:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int split_string (char *src, int spl, char *flds[], int n_flds) +{ + int cnt= 0; /* number of fields identified */ + int flg= 0; /* 0 -> new field begins */ + /* 1 -> within a field */ + + if (src == (char *) 0 || *src == 0) return 0; + + for (; *src; src++) + { + if (flg == 0) + { + if (n_flds > 0) + { + flds [cnt]= src; + n_flds--; + } + cnt++; + flg= 1; + } + + if (((int) (*src & 0x00FF)) == spl) + { + flg= 0; + if (n_flds > 0) *src= 0; + } + } + + if (flg == 0) + { + if (n_flds > 0) flds [cnt]= src; + cnt++; + } + + return cnt; +} diff --git a/lib/ds/strings/str_0020.o b/lib/ds/strings/str_0020.o new file mode 100644 index 0000000000000000000000000000000000000000..7df2e0745619493f810d8ce4c1da9bf26af2177b Binary files /dev/null and b/lib/ds/strings/str_0020.o differ diff --git a/lib/ds/strings/str_0021.c b/lib/ds/strings/str_0021.c new file mode 100644 index 0000000000000000000000000000000000000000..baf3d31caf41eb80c1110f4230ea5d2701434912 --- /dev/null +++ b/lib/ds/strings/str_0021.c @@ -0,0 +1,27 @@ +/* + * FILE ~/usr/sbr/str_0021.c + * + * written: 1993-04-24 + * latest update: 1994-10-02 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int match_array ( /* match a list of strings */ +char *patterns [], /* possible patterns */ +int pattern_count, /* number of patterns in array */ +char *string) /* string to find in patterns */ +{ + int i; + + for (i= 0; i < pattern_count; i++) + if (match (patterns[i], string) > 0) return i; + + return -1; +} diff --git a/lib/ds/strings/str_0021.o b/lib/ds/strings/str_0021.o new file mode 100644 index 0000000000000000000000000000000000000000..bf301ae99f80c09efded4e34309f6975ae06a1d8 Binary files /dev/null and b/lib/ds/strings/str_0021.o differ diff --git a/lib/ds/strings/str_0022.c b/lib/ds/strings/str_0022.c new file mode 100644 index 0000000000000000000000000000000000000000..221f99fa16f8ef2beeaba6c436b365f9a2f94585 --- /dev/null +++ b/lib/ds/strings/str_0022.c @@ -0,0 +1,58 @@ +/* + * FILE ~/usr/sbr/str_0022.c + * + * isolate words out of a string. + * + * written: 1993-04-23 + * latest update: 1998-02-18 17:03:41 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <ctype.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int isolate_words (char *src, char *flds[], int n_flds) +{ + int ch; /* character unter observation */ + int cnt= 0; /* number of words isolated */ +#define STA_noword 0 /* no word has been identified */ +#define STA_word 1 /* word has been identified */ + int sta= STA_noword; /* status of the isolator automaton */ + + if (src == (char *) 0) return 0; + + for (; (ch= *src & 0x00FF) != 0; src++) + { + switch (sta) + { + case STA_noword: + if (isalpha(ch) || isdigit(ch) || ch=='_' || ch=='*' || ch=='$') + { + if (n_flds>0) + { + flds[cnt]= src; + n_flds--; + } + cnt++; + sta= STA_word; + } + break; + + case STA_word: + if (!(isalpha(ch) || isdigit(ch) || ch=='_' || ch=='*' || ch=='$')) + { + if (n_flds>0) *src= 0; + sta= STA_noword; + } + break; + } + } + + return cnt; +} diff --git a/lib/ds/strings/str_0022.o b/lib/ds/strings/str_0022.o new file mode 100644 index 0000000000000000000000000000000000000000..c3e4ad19f0a07dbcd80bcb9d5a17e49c70eb49e4 Binary files /dev/null and b/lib/ds/strings/str_0022.o differ diff --git a/lib/ds/strings/str_0023.c b/lib/ds/strings/str_0023.c new file mode 100644 index 0000000000000000000000000000000000000000..70c2ba124c0b0a47295b7639cfae0f337d4a006b --- /dev/null +++ b/lib/ds/strings/str_0023.c @@ -0,0 +1,90 @@ +/* + * FILE %ds/strings/str_0023.c + * + * split a string into fields. + * the string has the form: <field1>,<field2>,...,<fieldn> + * where fields are: "text" | text + * if flg_esc is true, fields may contain escapes of the form: \" + * + * written: 1993-09-03 + * latest update: 1995-12-03 + * $Id: str_0023.c,v 1.2 2001/09/10 06:58:44 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int str2fld ( +char *src, /* original string to be splitted */ +char *flds [], /* pointers to individual fields */ +int n_flds, /* number of fields possible */ +int delimiter, /* delimiter between fields */ +int open_quote, /* opening quoting character */ +int close_quote, /* closing quote character */ +int escape_char) /* escape character */ +{ + int cnt= 0; /* number of fields identified */ + int flg= 0; /* 1 .. searching for new field begin */ + int ch; /* currently processed character */ + +#define STAT_text 0 /* normal text without quotes */ +#define STAT_qtext 1 /* text is quoted */ +#define STAT_qescape 2 /* next character is escaped in quote */ +#define STAT_tescape 3 /* next character is escaped in text */ + int stat= STAT_text; /* parser automaton status */ + + if (src == (char *) 0) return 0; + + for (; (ch= *src) != 0; src++) + { + if (flg == 0) + { + if (!(delimiter == -1 && (ch == ' ' || ch == '\t'))) + { + if (n_flds > 0) + { + flds [cnt]= src; + n_flds--; + } + cnt++; + flg= 1; + } + } + + switch (stat) + { + case STAT_text: + if (ch == delimiter + || (delimiter == -1 && (ch == ' ' || ch == '\t')) + ) + { + *src= 0; + flg= 0; + } + if (ch == open_quote) stat= STAT_qtext; + if (ch == escape_char) stat= STAT_tescape; + break; + + case STAT_qtext: + if (ch == close_quote) stat= STAT_text; + if (ch == escape_char) stat= STAT_qescape; + break; + + case STAT_qescape: + stat= STAT_qtext; + break; + + case STAT_tescape: + stat= STAT_text; + break; + } + } + + return cnt; +} diff --git a/lib/ds/strings/str_0023.o b/lib/ds/strings/str_0023.o new file mode 100644 index 0000000000000000000000000000000000000000..5b0feb2ed7c0e0fc9cf3ab56d0a5a689d6660951 Binary files /dev/null and b/lib/ds/strings/str_0023.o differ diff --git a/lib/ds/strings/str_0024.c b/lib/ds/strings/str_0024.c new file mode 100644 index 0000000000000000000000000000000000000000..5f179f98dffadeec900bd936d4786b584790fdf8 --- /dev/null +++ b/lib/ds/strings/str_0024.c @@ -0,0 +1,58 @@ +/* + * FILE %ds/strings/str_0024.c + * + * isolate words out of a string + * + * written: 1993-10-27 + * latest update: 1995-12-03 + * $Id: str_0024.c,v 1.2 2006/04/09 08:05:35 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <sys/types.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int isolate_tokens (char *src, char *flds[], int n_flds) +{ + int ch; /* character under observation */ + int cnt= 0; /* number of words isolated */ +#define STA_noword 0 /* no word has been identified */ +#define STA_word 1 /* word has been identified */ + int sta= STA_noword; /* status of the isolator automaton */ + + if (src == (char *) 0) return -1; + + for (; (ch= *src) != 0; src++) + { + switch (sta) + { + case STA_noword: + if (!(ch == ' ' || ch == '\t')) + { + if (n_flds > 0) + { + flds [cnt]= src; + n_flds--; + } + cnt++; + sta= STA_word; + } + break; + + case STA_word: + if (ch == ' ' || ch == '\t') + { + if (n_flds > 0) *src= 0; + sta= STA_noword; + } + break; + } + } + + return cnt; +} diff --git a/lib/ds/strings/str_0024.o b/lib/ds/strings/str_0024.o new file mode 100644 index 0000000000000000000000000000000000000000..1c8668adefaf320bc50dae35ea5862cd6cdb5dd9 Binary files /dev/null and b/lib/ds/strings/str_0024.o differ diff --git a/lib/ds/strings/str_0025.c b/lib/ds/strings/str_0025.c new file mode 100644 index 0000000000000000000000000000000000000000..12ca4b60fe7bdc7ac51a132731796fe85971f98c --- /dev/null +++ b/lib/ds/strings/str_0025.c @@ -0,0 +1,37 @@ +/* + * FILE ~/usr/sbr/str_0025.c + * + * written: 1993-12-05 + * latest update: 1993-12-05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int strdiff (char *diff, char *s1, char *s2, +int eq_char, int diff_char, int eos_char) +{ + int cnt= 0; + + while (*s1 && *s2) + { + *diff= (char) ((*s1 == *s2) ? eq_char : diff_char); + + cnt++; + diff++; + s1++; + s2++; + } + + if (*s1 == 0 && *s2 == 0) goto DONE; + + *diff++= (char) eos_char; +DONE: + *diff= 0; + return cnt; +} diff --git a/lib/ds/strings/str_0025.o b/lib/ds/strings/str_0025.o new file mode 100644 index 0000000000000000000000000000000000000000..60a5bf2103759aed65cab16b9d94ce1b0550d69e Binary files /dev/null and b/lib/ds/strings/str_0025.o differ diff --git a/lib/ds/strings/str_0026.c b/lib/ds/strings/str_0026.c new file mode 100644 index 0000000000000000000000000000000000000000..00f642c688f040727106377627fece4ffdeadf26 --- /dev/null +++ b/lib/ds/strings/str_0026.c @@ -0,0 +1,59 @@ +/* + * FILE %ds/strings/str_0026.c + * + * isolate words out of a string. + * + * written: 1993-12-10 copied from str_0022.c + * latest update: 1995-12-05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <ctype.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int isolate2words (char *src, char *flds[], int n_flds, int *table) +{ + int ch; /* character unter observation */ + int cnt= 0; /* number of words isolated */ +#define STA_noword 0 /* no word has been identified */ +#define STA_word 1 /* word has been identified */ + int sta= STA_noword; /* status of the isolator automaton */ + + if (table == (int *) 0) return -1; + if (src == (char *) 0) return 0; + + for (; (ch= *src & 0x00FF) != 0; src++) + { + switch (sta) + { + case STA_noword: + if (table [ch]) + { + if (n_flds > 0) + { + flds [cnt]= src; + n_flds--; + } + cnt++; + sta= STA_word; + } + break; + + case STA_word: + if (!table [ch]) + { + if (n_flds > 0) *src= 0; + sta= STA_noword; + } + break; + } + } + + return cnt; +} diff --git a/lib/ds/strings/str_0026.o b/lib/ds/strings/str_0026.o new file mode 100644 index 0000000000000000000000000000000000000000..72d2a4e97f05242f48f5c5e725185d38d4741456 Binary files /dev/null and b/lib/ds/strings/str_0026.o differ diff --git a/lib/ds/strings/str_0027.c b/lib/ds/strings/str_0027.c new file mode 100644 index 0000000000000000000000000000000000000000..4ed99cda96239b62ac477d24d9bdd3739bdf6946 --- /dev/null +++ b/lib/ds/strings/str_0027.c @@ -0,0 +1,75 @@ +/* + * FILE %ds/strings/str_0027.c + * + * set values into a character table + * + * written: 1993-12-10 + * latest update: 1995-12-05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int put_chartable (int *table, char *chars, int value) +{ + int cnt= 0; + int stat= 0; + int xval= 0; + int ch; + + if (chars == (char *) 0) return 0; + + while ((ch= (int) *chars++ & 0x00FF) != 0) + { + switch (stat) + { + case 0: + if (ch == '\\') + { + stat= 1; + } + else + { + table [ch] = value; + cnt++; + } + break; + + case 1: + switch (ch) + { + case 'x': + case 'X': + stat= 2; + xval= 0; + break; + + case '\\': + table ['\\']= value; + cnt++; + break; + } + break; + + case 2: + case 3: + stat++; + if (ch >= '0' || ch <= '9') ch= xval*16 + ch - '0'; + if (ch >= 'a' || ch <= 'f') ch= xval*16 + ch - 'a' + 10; + if (ch >= 'A' || ch <= 'F') ch= xval*16 + ch - 'A' + 10; + if (stat == 4) + { + table [xval]= value; + cnt++; + } + break; + } + } + + return cnt; +} diff --git a/lib/ds/strings/str_0027.o b/lib/ds/strings/str_0027.o new file mode 100644 index 0000000000000000000000000000000000000000..96326c936e9bebc9011bb69e88275d34ad9ce30a Binary files /dev/null and b/lib/ds/strings/str_0027.o differ diff --git a/lib/ds/strings/str_0028.c b/lib/ds/strings/str_0028.c new file mode 100644 index 0000000000000000000000000000000000000000..56bb5bbbd961b98f18ccf994793277f23c1cd822 --- /dev/null +++ b/lib/ds/strings/str_0028.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/strings/str_0028.c + * + * locate n-th word in a string + * + * written: 1994-02-04 + * latest update: 1997-11-09 11:14:00 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *locate_word (char *s, int num) +{ + int ch; + + if (s != (char *) 0) + for (; *s && num >= 0; num--) + { + for (; (ch= *s) && (ch == ' ' || ch == '\t'); s++); + if (num == 0) return s; + for (; (ch= *s) && ch != ' ' && ch != '\t'; s++); + } + + return (char *) 0; +} diff --git a/lib/ds/strings/str_0028.o b/lib/ds/strings/str_0028.o new file mode 100644 index 0000000000000000000000000000000000000000..6fa9653f2f10062179ec8c7447df08b6927886ec Binary files /dev/null and b/lib/ds/strings/str_0028.o differ diff --git a/lib/ds/strings/str_0029.c b/lib/ds/strings/str_0029.c new file mode 100644 index 0000000000000000000000000000000000000000..92e1d3680dd5b44761a0229bbe2c68aec2295df7 --- /dev/null +++ b/lib/ds/strings/str_0029.c @@ -0,0 +1,23 @@ +/* + * FILE ~/usr/sbr/str_0029.c + * + * written: 1994-03-24 + * latest update: 1994-12-22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +long count_char (int code, char *s, long size) +{ + long count= 0L; + + while (size-- > 0L) if (((int) (*s++ & 0x00FF)) == code) count++; + + return count; +} diff --git a/lib/ds/strings/str_0029.o b/lib/ds/strings/str_0029.o new file mode 100644 index 0000000000000000000000000000000000000000..db022c51086a2e116f46df48bb7c870bc4740b6c Binary files /dev/null and b/lib/ds/strings/str_0029.o differ diff --git a/lib/ds/strings/str_0030.c b/lib/ds/strings/str_0030.c new file mode 100644 index 0000000000000000000000000000000000000000..f29cef91d840007fb1fda3cea6e0380bb471f939 --- /dev/null +++ b/lib/ds/strings/str_0030.c @@ -0,0 +1,54 @@ +/* + * FILE %ds/strings/str_0030.c + * + * generate a random password with a given length + * see also mk_PassWord () + * + * written: 1994-04-23 (extracted from ~/usr/admux/powernet/mkstud.c) + * latest update: 2000-08-21 0:37:59 + * $Id: str_0030.c,v 1.3 2000/08/28 19:27:02 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <time.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/dpp.h> + +#ifndef MSDOS +#include <sys/types.h> +#include <unistd.h> +#endif + +/* ------------------------------------------------------------------------ */ +static char *PASS_CHARS= "abcdefghijkmnpqrstuvwx23456789101112"; +#define PASSWORD_ALPHABETH_SIZE 30 + +static int initialized= 0; + +/* ------------------------------------------------------------------------ */ +int mk_passwd (char *s, int pass_lng) +{ + long r; + int i; + + if (!initialized) + { + alt_seed (); + initialized= 1; + } + + for (i= 0; i < pass_lng; i++) + { + r= rand () % PASSWORD_ALPHABETH_SIZE; + s [i]= PASS_CHARS [r]; + } + + s [i]= 0; + + return 0; +} diff --git a/lib/ds/strings/str_0030.o b/lib/ds/strings/str_0030.o new file mode 100644 index 0000000000000000000000000000000000000000..bd3acf0ecc4460733335567c1b57e6a5d98fcf6d Binary files /dev/null and b/lib/ds/strings/str_0030.o differ diff --git a/lib/ds/strings/str_0031.c b/lib/ds/strings/str_0031.c new file mode 100644 index 0000000000000000000000000000000000000000..a051e4076b1607badd390887e54c6ef897f59d9d --- /dev/null +++ b/lib/ds/strings/str_0031.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/strings/str_0031.c + * + * written: 1994-05-20 (extracted from ~/usr/mail/distmail.c) + * latest update: 1999-09-10 3:37:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int enter_value (char *s, int pos, int val, int digits) +{ + int xpos; + int v; + + if (val == -1) + { + for (; digits > 0; digits--) s [pos++]= 'X'; + return 0; + } + + for (xpos= pos+digits-1; digits > 0; digits--) + { + v= val%10; + val= val/10; + s [xpos--]= (char) (v+'0'); + } + + return 1; +} diff --git a/lib/ds/strings/str_0031.o b/lib/ds/strings/str_0031.o new file mode 100644 index 0000000000000000000000000000000000000000..ab72b4dfa401dcffd0cd65551c77b9570b57dc5d Binary files /dev/null and b/lib/ds/strings/str_0031.o differ diff --git a/lib/ds/strings/str_0032.c b/lib/ds/strings/str_0032.c new file mode 100644 index 0000000000000000000000000000000000000000..029070f682708bfc93e9ba107bb42e041763c22c --- /dev/null +++ b/lib/ds/strings/str_0032.c @@ -0,0 +1,20 @@ +/* + * FILE %ds/strings/str_0032.c + * + * written: 1994-05-27 (extracted from ~/usr/obj/crf.c) + * latest update: 1996-04-14 12:58:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +void blanks (FILE *fo, int cnt) +{ + while (cnt-- > 0) fputc (' ', fo); +} diff --git a/lib/ds/strings/str_0032.o b/lib/ds/strings/str_0032.o new file mode 100644 index 0000000000000000000000000000000000000000..2f2366ff6de577257a2852ef07daa375ef2d1ee1 Binary files /dev/null and b/lib/ds/strings/str_0032.o differ diff --git a/lib/ds/strings/str_0033.c b/lib/ds/strings/str_0033.c new file mode 100644 index 0000000000000000000000000000000000000000..ded0ef060bc5156881cc17e6592b8df370f701a9 --- /dev/null +++ b/lib/ds/strings/str_0033.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/strings/str_0033.c + * + * set values into a character table + * + * written: 1994-08-06 + * latest update: 1996-09-03 13:17:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int chr_index (char *chars, int value) +{ + int i; + int ch; + + if (chars == (char *) 0) return -1; + + for (i= 0; (ch= (*chars++) & 0x00FF) != 0; i++) + if (value == ch) return i; + + return -1; +} diff --git a/lib/ds/strings/str_0033.o b/lib/ds/strings/str_0033.o new file mode 100644 index 0000000000000000000000000000000000000000..38aa2a55f669b97540cddcdcb9645119b69dd63a Binary files /dev/null and b/lib/ds/strings/str_0033.o differ diff --git a/lib/ds/strings/str_0034.c b/lib/ds/strings/str_0034.c new file mode 100644 index 0000000000000000000000000000000000000000..18c00f928950a3734ccdf6f059e3535ef0c0be44 --- /dev/null +++ b/lib/ds/strings/str_0034.c @@ -0,0 +1,25 @@ +/* + * FILE %ds/strings/str_0034.c + * + * change a character to another in a string + * + * written: 1994-08-12 + * latest update: 1996-08-11 14:34:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int xchange (char *str, int from, int to) +{ + int ch; + + for (; (ch= (*str & 0x00FF)) != 0; str++) if (ch == from) *str= (char) to; + + return 0; +} diff --git a/lib/ds/strings/str_0034.o b/lib/ds/strings/str_0034.o new file mode 100644 index 0000000000000000000000000000000000000000..256b05dcffbb4fb0aa631d05e467d8623ad57080 Binary files /dev/null and b/lib/ds/strings/str_0034.o differ diff --git a/lib/ds/strings/str_0035.c b/lib/ds/strings/str_0035.c new file mode 100644 index 0000000000000000000000000000000000000000..4a535298deae92e9a048271f092c6c7ec80a4af6 --- /dev/null +++ b/lib/ds/strings/str_0035.c @@ -0,0 +1,143 @@ +/* + * FILE %ds/strings/str_0035.c + * + * decompose a gopher URL into its components + * + * written: 1994-09-08 + * latest update: 1996-10-29 16:10:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int gopher_url2components ( +char *url, +char **host, +long *port, +int *type, +char **path, +int *tabs) +{ + char *cp; + char *xport; + int ch; + long port_number; + int tab_count; + + if (strncmp (url, "gopher://", 9) != 0) return -1; + + /* scanning over host name */ + *host= url+9; + for (cp= *host; ch= *cp; cp++) + { + if (ch == 0) goto DONE; + if (ch == ':') + { + *cp++= 0; + xport= cp; + break; + } + if (ch == '/') + { + *cp++= 0; + goto GET_PATH; + } + } + + /* reading port number */ + port_number= 0L; + for (; ch= *cp; cp++) + { + if (ch == 0) + { + *cp= 0; + goto DONE; + } + if (ch == '/') + { + *cp++= 0; + break; + } + + if (ch >= '0' && ch <= '9') + port_number= 10L*port_number + ((long) (ch - '0')); + else + { +ERROR_PORT: + return -1; + } + } + if (port_number <= 0L || port_number >= 0x00010000L) goto ERROR_PORT; + *port= port_number; + +GET_PATH: + ch= *cp++; + if (ch != 0) + { + *type= ch; + ch= *cp; + if (ch != 0) *path= cp; + } + + /* cp now points to the first byte of the path string */ + + /* analyze the request string only if we're doing cache stuff... */ + tab_count= 0; + for (; ch= *cp; cp++) + { + if (ch == 0) break; /* just a plain gopher request */ + if (ch == '\t') tab_count++; /* oh, oh... gopher plus? */ + } + *tabs= tab_count; + +DONE: + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef DEBUG +#include <stdio.h> +#define LINE_SIZE 1024 +static char url [LINE_SIZE]; + +int main (void); + +int main () +{ + int rc; + char *host; + long port; + int gtype; + char *path; + int tabs; + + for (;;) + { + printf ("url: "); + scanf ("%s", url); + + host= "host.do.main"; + port= 70; + gtype= '1'; + path= ""; + tabs= 0; + + rc= gopher_url2components (url, &host, &port, >ype, &path, &tabs); + + printf ("rc=%d\n", rc); + printf ("host=%s\n", host); + printf ("port=%ld\n", port); + printf ("type=%c\n", gtype); + printf ("path=%s\n", path); + printf ("tabs=%d\n", tabs); + } + + return 0; +} +#endif /* DEBUG */ diff --git a/lib/ds/strings/str_0035.o b/lib/ds/strings/str_0035.o new file mode 100644 index 0000000000000000000000000000000000000000..ae250f362b02c5491fe2898d23aad02c0ff01378 Binary files /dev/null and b/lib/ds/strings/str_0035.o differ diff --git a/lib/ds/strings/str_0036.c b/lib/ds/strings/str_0036.c new file mode 100644 index 0000000000000000000000000000000000000000..c186b883c7e1fdadd751b5965815f3e05734ca2f --- /dev/null +++ b/lib/ds/strings/str_0036.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/strings/str_0036.c + * + * set values into a character table + * + * written: 1994-09-17 + * latest update: 1995-12-08 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int str_prompt (char *txt, char *dest, int lng, char *tmp, char *preset) +{ + if (preset != (char *) 0) strncpy (dest, preset, lng); + + printf ("%s [%s]: ", txt, dest); + + if (fread_line (stdin, tmp, lng) > 0) + strncpy (dest, tmp, lng); + + return 0; +} diff --git a/lib/ds/strings/str_0036.o b/lib/ds/strings/str_0036.o new file mode 100644 index 0000000000000000000000000000000000000000..d91c2c4777ca3ffe9d98c909b3d5af6aebc05f7d Binary files /dev/null and b/lib/ds/strings/str_0036.o differ diff --git a/lib/ds/strings/str_0037.c b/lib/ds/strings/str_0037.c new file mode 100644 index 0000000000000000000000000000000000000000..02249847506d1502fa28b8d3c5fef16a70229ebb --- /dev/null +++ b/lib/ds/strings/str_0037.c @@ -0,0 +1,25 @@ +/* + * FILE %ds/strings/str_0037.c + * + * remove apostrophes from a character strings + * + * written: 1994-12-31 + * latest update: 1996-10-29 16:08:48 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int remove_apostrophe (char *s) +{ + char *d= s; + + while (*s) if (*s == '\'' || *s == '\"') s++; else *d++= *s++; + + return 0; +} diff --git a/lib/ds/strings/str_0037.o b/lib/ds/strings/str_0037.o new file mode 100644 index 0000000000000000000000000000000000000000..9a1285f9fd565ef34a0aa7cfb25668f65b05cba6 Binary files /dev/null and b/lib/ds/strings/str_0037.o differ diff --git a/lib/ds/strings/str_0038.c b/lib/ds/strings/str_0038.c new file mode 100644 index 0000000000000000000000000000000000000000..880617cabb1226b11c07037da5ca3816cc132c84 --- /dev/null +++ b/lib/ds/strings/str_0038.c @@ -0,0 +1,21 @@ +/* + * FILE %ds/strings/str_0038.c + * + * return actual string or undef-string + * + * written: 1995-01-29 + * latest update: 1995-11-05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *str_or_undef (char *s) +{ + return (s == (char *) 0 || *s == 0) ? "???" : s; +} diff --git a/lib/ds/strings/str_0039.c b/lib/ds/strings/str_0039.c new file mode 100644 index 0000000000000000000000000000000000000000..84cc520cc6db3b0736530f5b3cd0c004d72b3241 --- /dev/null +++ b/lib/ds/strings/str_0039.c @@ -0,0 +1,56 @@ +/* + * FILE %ds/strings/str_0039.c + * + * generate a random password with a given length + * based on mk_passwd () + * + * written: 1995-05-12 + * latest update: 2000-08-21 0:53:19 + * $Id: str_0039.c,v 1.3 2000/08/28 19:27:02 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <time.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/dpp.h> + +#ifndef MSDOS +#include <sys/types.h> +#include <unistd.h> +#endif + +/* ------------------------------------------------------------------------ */ +static char *PASS_CHARS= + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + +#define PASSWORD_ALPHABETH_SIZE 62 + +static int initialized= 0; + +/* ------------------------------------------------------------------------ */ +int mk_PassWord (char *s, int pass_lng) +{ + long r; + int i; + + if (!initialized) + { + alt_seed (); + initialized= 1; + } + + for (i= 0; i < pass_lng; i++) + { + r= rand () % PASSWORD_ALPHABETH_SIZE; + s [i]= PASS_CHARS [r]; + } + + s [i]= 0; + + return 0; +} diff --git a/lib/ds/strings/str_0039.o b/lib/ds/strings/str_0039.o new file mode 100644 index 0000000000000000000000000000000000000000..6d22f4edb50164d44031d3643df06e569e92cb9e Binary files /dev/null and b/lib/ds/strings/str_0039.o differ diff --git a/lib/ds/strings/str_0040.c b/lib/ds/strings/str_0040.c new file mode 100644 index 0000000000000000000000000000000000000000..2d03e32f4eb3b889f572adb9b51d1d4f45aba2db --- /dev/null +++ b/lib/ds/strings/str_0040.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/strings/str_0040.c + * + * written: 1993-02-07 + * latest update: 1997-11-09 11:12:53 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +struct OPERATION *get_operation ( +struct OPERATION ops [], +int n_ops, +char *str) +{ + int i; + + for (i= 0; i<n_ops; i++) + if (abbrev (ops[i].OP_name, str, ops[i].OP_minimal_length)) + return &ops[i]; + + return (struct OPERATION *) 0; +} diff --git a/lib/ds/strings/str_0040.o b/lib/ds/strings/str_0040.o new file mode 100644 index 0000000000000000000000000000000000000000..f3dd67c701b22c223f31882522b80126b446bbe1 Binary files /dev/null and b/lib/ds/strings/str_0040.o differ diff --git a/lib/ds/strings/str_0041.c b/lib/ds/strings/str_0041.c new file mode 100644 index 0000000000000000000000000000000000000000..5b9b7bbbdefbed441666ea8ecdf5d8e5b1e349d9 --- /dev/null +++ b/lib/ds/strings/str_0041.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/strings/str_0041.c + * + * Character Code Categories f�r den IBM PC (MSDOS) + * + * written: 1990 11 10 + * 1993-01-02: include table + * latest update: 1995-12-25 + * + */ + +#include <gg/strings.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +static unsigned char IBMPC_CATEGORY_CODES [256] = +{ +#include "str_0041.tbl" +} ; + +/* ------------------------------------------------------------------------ */ +int get_cat_code (int ch) +{ + return IBMPC_CATEGORY_CODES [ch & 0x00FF]; +} + +/* ------------------------------------------------------------------------ */ +void set_cat_code (int ch, int code) +{ + IBMPC_CATEGORY_CODES [ch & 0x00FF] = (unsigned char) code; +} diff --git a/lib/ds/strings/str_0041.o b/lib/ds/strings/str_0041.o new file mode 100644 index 0000000000000000000000000000000000000000..e7450b01fe7914dae233c9fdbeee73846d848c4d Binary files /dev/null and b/lib/ds/strings/str_0041.o differ diff --git a/lib/ds/strings/str_0041.tbl b/lib/ds/strings/str_0041.tbl new file mode 100644 index 0000000000000000000000000000000000000000..74fb7faf5b779d88a688767ea6a85361e9cbdac0 --- /dev/null +++ b/lib/ds/strings/str_0041.tbl @@ -0,0 +1,71 @@ +/* + * conversion table + * from: pc437, pc, ascii + * to: catc + * as generated on 1997-02-23/18:04:24 + * + */ +/*0x00*/ 0x00000002,/*0x01*/ 0x00000002,/*0x02*/ 0x00000002,/*0x03*/ 0x0000000A, +/*0x04*/ 0x0000000A,/*0x05*/ 0x0000000A,/*0x06*/ 0x0000000A,/*0x07*/ 0x00000002, +/*0x08*/ 0x00000002,/*0x09*/ 0x00000015,/*0x0A*/ 0x00000016,/*0x0B*/ 0x00000017, +/*0x0C*/ 0x00000017,/*0x0D*/ 0x00000016,/*0x0E*/ 0x00000002,/*0x0F*/ 0x00000002, +/*0x10*/ 0x00000002,/*0x11*/ 0x00000002,/*0x12*/ 0x00000002,/*0x13*/ 0x00000002, +/*0x14*/ 0x00000002,/*0x15*/ 0x0000000D,/*0x16*/ 0x00000002,/*0x17*/ 0x00000002, +/*0x18*/ 0x00000002,/*0x19*/ 0x00000002,/*0x1A*/ 0x00000001,/*0x1B*/ 0x00000001, +/*0x1C*/ 0x00000002,/*0x1D*/ 0x00000002,/*0x1E*/ 0x00000002,/*0x1F*/ 0x00000002, +/*0x20*/ 0x00000015,/*0x21*/ 0x00000011,/*0x22*/ 0x00000012,/*0x23*/ 0x0000000E, +/*0x24*/ 0x00000008,/*0x25*/ 0x0000000D,/*0x26*/ 0x0000000D,/*0x27*/ 0x00000012, +/*0x28*/ 0x00000014,/*0x29*/ 0x00000014,/*0x2A*/ 0x0000000B,/*0x2B*/ 0x0000000B, +/*0x2C*/ 0x00000011,/*0x2D*/ 0x00000013,/*0x2E*/ 0x00000011,/*0x2F*/ 0x0000000B, +/*0x30*/ 0x00000005,/*0x31*/ 0x00000005,/*0x32*/ 0x00000005,/*0x33*/ 0x00000005, +/*0x34*/ 0x00000005,/*0x35*/ 0x00000005,/*0x36*/ 0x00000005,/*0x37*/ 0x00000005, +/*0x38*/ 0x00000005,/*0x39*/ 0x00000005,/*0x3A*/ 0x00000011,/*0x3B*/ 0x00000011, +/*0x3C*/ 0x0000000B,/*0x3D*/ 0x0000000B,/*0x3E*/ 0x0000000B,/*0x3F*/ 0x00000011, +/*0x40*/ 0x0000000E,/*0x41*/ 0x00000004,/*0x42*/ 0x00000004,/*0x43*/ 0x00000004, +/*0x44*/ 0x00000004,/*0x45*/ 0x00000004,/*0x46*/ 0x00000004,/*0x47*/ 0x00000004, +/*0x48*/ 0x00000004,/*0x49*/ 0x00000004,/*0x4A*/ 0x00000004,/*0x4B*/ 0x00000004, +/*0x4C*/ 0x00000004,/*0x4D*/ 0x00000004,/*0x4E*/ 0x00000004,/*0x4F*/ 0x00000004, +/*0x50*/ 0x00000004,/*0x51*/ 0x00000004,/*0x52*/ 0x00000004,/*0x53*/ 0x00000004, +/*0x54*/ 0x00000004,/*0x55*/ 0x00000004,/*0x56*/ 0x00000004,/*0x57*/ 0x00000004, +/*0x58*/ 0x00000004,/*0x59*/ 0x00000004,/*0x5A*/ 0x00000004,/*0x5B*/ 0x0000000F, +/*0x5C*/ 0x0000000F,/*0x5D*/ 0x0000000F,/*0x5E*/ 0x0000000E,/*0x5F*/ 0x0000000E, +/*0x60*/ 0x00000011,/*0x61*/ 0x00000003,/*0x62*/ 0x00000003,/*0x63*/ 0x00000003, +/*0x64*/ 0x00000003,/*0x65*/ 0x00000003,/*0x66*/ 0x00000003,/*0x67*/ 0x00000003, +/*0x68*/ 0x00000003,/*0x69*/ 0x00000003,/*0x6A*/ 0x00000003,/*0x6B*/ 0x00000003, +/*0x6C*/ 0x00000003,/*0x6D*/ 0x00000003,/*0x6E*/ 0x00000003,/*0x6F*/ 0x00000003, +/*0x70*/ 0x00000003,/*0x71*/ 0x00000003,/*0x72*/ 0x00000003,/*0x73*/ 0x00000003, +/*0x74*/ 0x00000003,/*0x75*/ 0x00000003,/*0x76*/ 0x00000003,/*0x77*/ 0x00000003, +/*0x78*/ 0x00000003,/*0x79*/ 0x00000003,/*0x7A*/ 0x00000003,/*0x7B*/ 0x0000000F, +/*0x7C*/ 0x0000000F,/*0x7D*/ 0x0000000F,/*0x7E*/ 0x0000000E,/*0x7F*/ 0x00000002, +/*0x80*/ 0x00000007,/*0x81*/ 0x00000006,/*0x82*/ 0x00000006,/*0x83*/ 0x00000006, +/*0x84*/ 0x00000006,/*0x85*/ 0x00000006,/*0x86*/ 0x00000006,/*0x87*/ 0x00000006, +/*0x88*/ 0x00000006,/*0x89*/ 0x00000006,/*0x8A*/ 0x00000006,/*0x8B*/ 0x00000006, +/*0x8C*/ 0x00000006,/*0x8D*/ 0x00000006,/*0x8E*/ 0x00000007,/*0x8F*/ 0x00000007, +/*0x90*/ 0x00000007,/*0x91*/ 0x00000018,/*0x92*/ 0x00000018,/*0x93*/ 0x00000006, +/*0x94*/ 0x00000006,/*0x95*/ 0x00000006,/*0x96*/ 0x00000006,/*0x97*/ 0x00000006, +/*0x98*/ 0x00000006,/*0x99*/ 0x00000006,/*0x9A*/ 0x00000007,/*0x9B*/ 0x00000008, +/*0x9C*/ 0x00000008,/*0x9D*/ 0x00000008,/*0x9E*/ 0x00000008,/*0x9F*/ 0x00000008, +/*0xA0*/ 0x00000006,/*0xA1*/ 0x00000006,/*0xA2*/ 0x00000006,/*0xA3*/ 0x00000006, +/*0xA4*/ 0x00000006,/*0xA5*/ 0x00000006,/*0xA6*/ 0x00000006,/*0xA7*/ 0x00000006, +/*0xA8*/ 0x00000010,/*0xA9*/ 0x0000000C,/*0xAA*/ 0x0000000C,/*0xAB*/ 0x0000000C, +/*0xAC*/ 0x0000000C,/*0xAD*/ 0x00000010,/*0xAE*/ 0x00000010,/*0xAF*/ 0x00000010, +/*0xB0*/ 0x0000000A,/*0xB1*/ 0x0000000A,/*0xB2*/ 0x0000000A,/*0xB3*/ 0x0000000A, +/*0xB4*/ 0x0000000A,/*0xB5*/ 0x0000000A,/*0xB6*/ 0x0000000A,/*0xB7*/ 0x0000000A, +/*0xB8*/ 0x0000000A,/*0xB9*/ 0x0000000A,/*0xBA*/ 0x0000000A,/*0xBB*/ 0x0000000A, +/*0xBC*/ 0x0000000A,/*0xBD*/ 0x0000000A,/*0xBE*/ 0x0000000A,/*0xBF*/ 0x0000000A, +/*0xC0*/ 0x0000000A,/*0xC1*/ 0x0000000A,/*0xC2*/ 0x0000000A,/*0xC3*/ 0x0000000A, +/*0xC4*/ 0x0000000A,/*0xC5*/ 0x0000000A,/*0xC6*/ 0x0000000A,/*0xC7*/ 0x0000000A, +/*0xC8*/ 0x0000000A,/*0xC9*/ 0x0000000A,/*0xCA*/ 0x0000000A,/*0xCB*/ 0x0000000A, +/*0xCC*/ 0x0000000A,/*0xCD*/ 0x0000000A,/*0xCE*/ 0x0000000A,/*0xCF*/ 0x0000000A, +/*0xD0*/ 0x0000000A,/*0xD1*/ 0x0000000A,/*0xD2*/ 0x0000000A,/*0xD3*/ 0x0000000A, +/*0xD4*/ 0x0000000A,/*0xD5*/ 0x0000000A,/*0xD6*/ 0x0000000A,/*0xD7*/ 0x0000000A, +/*0xD8*/ 0x0000000A,/*0xD9*/ 0x0000000A,/*0xDA*/ 0x0000000A,/*0xDB*/ 0x0000000A, +/*0xDC*/ 0x0000000A,/*0xDD*/ 0x0000000A,/*0xDE*/ 0x0000000A,/*0xDF*/ 0x0000000A, +/*0xE0*/ 0x00000009,/*0xE1*/ 0x00000006,/*0xE2*/ 0x00000009,/*0xE3*/ 0x00000009, +/*0xE4*/ 0x00000009,/*0xE5*/ 0x00000009,/*0xE6*/ 0x00000009,/*0xE7*/ 0x00000009, +/*0xE8*/ 0x00000009,/*0xE9*/ 0x00000009,/*0xEA*/ 0x00000009,/*0xEB*/ 0x00000009, +/*0xEC*/ 0x0000000C,/*0xED*/ 0x0000000C,/*0xEE*/ 0x0000000C,/*0xEF*/ 0x0000000C, +/*0xF0*/ 0x0000000C,/*0xF1*/ 0x0000000C,/*0xF2*/ 0x0000000C,/*0xF3*/ 0x0000000C, +/*0xF4*/ 0x0000000C,/*0xF5*/ 0x0000000C,/*0xF6*/ 0x0000000C,/*0xF7*/ 0x0000000C, +/*0xF8*/ 0x0000000C,/*0xF9*/ 0x0000000C,/*0xFA*/ 0x0000000C,/*0xFB*/ 0x0000000C, +/*0xFC*/ 0x0000000C,/*0xFD*/ 0x0000000C,/*0xFE*/ 0x0000000A,/*0xFF*/ 0x00000002 diff --git a/lib/ds/strings/str_0042.c b/lib/ds/strings/str_0042.c new file mode 100644 index 0000000000000000000000000000000000000000..9ce95b82f33d7d8af4e6f829ee7ff8c07c1f3591 --- /dev/null +++ b/lib/ds/strings/str_0042.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/strings/str_0042.c + * + * Wichtungscodes fuer den IBM PC (MSDOS) + * + * written: 1990 11 23 + * 1993-01-02: include table + * latest update: 1995-12-25 + * + */ + +#include <gg/strings.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +static int IBMPC_WEIGHT_CODES [256] = +{ +#include "str_0042.tbl" +} ; + +/* ------------------------------------------------------------------------ */ +int get_weight_code (int ch) +{ + return IBMPC_WEIGHT_CODES [ch & 0x00FF]; +} + +/* ------------------------------------------------------------------------ */ +void set_weight_code (int ch, int code) +{ + IBMPC_WEIGHT_CODES [ch & 0x00FF] = code; +} diff --git a/lib/ds/strings/str_0042.o b/lib/ds/strings/str_0042.o new file mode 100644 index 0000000000000000000000000000000000000000..cecc55eba2a58d4f3c616a8fab9c19f09ea2ceaf Binary files /dev/null and b/lib/ds/strings/str_0042.o differ diff --git a/lib/ds/strings/str_0042.tbl b/lib/ds/strings/str_0042.tbl new file mode 100644 index 0000000000000000000000000000000000000000..866f537b9b3efe3a66701025c3d617657af8f464 --- /dev/null +++ b/lib/ds/strings/str_0042.tbl @@ -0,0 +1,71 @@ +/* + * conversion table + * from: pc437, pc, ascii + * to: wgtc + * as generated on 1997-02-23/18:04:27 + * + */ +/*0x00*/ 0x00007000,/*0x01*/ 0x00007010,/*0x02*/ 0x00007020,/*0x03*/ 0x00007030, +/*0x04*/ 0x00007040,/*0x05*/ 0x00007050,/*0x06*/ 0x00007060,/*0x07*/ 0x00007070, +/*0x08*/ 0x00007080,/*0x09*/ 0x00000210,/*0x0A*/ 0x00000220,/*0x0B*/ 0x000070B0, +/*0x0C*/ 0x000070C0,/*0x0D*/ 0x00000230,/*0x0E*/ 0x000070E0,/*0x0F*/ 0x000070F0, +/*0x10*/ 0x00007100,/*0x11*/ 0x00007110,/*0x12*/ 0x00007120,/*0x13*/ 0x00007130, +/*0x14*/ 0x00007140,/*0x15*/ 0x00007150,/*0x16*/ 0x00007160,/*0x17*/ 0x00007170, +/*0x18*/ 0x00007180,/*0x19*/ 0x00007190,/*0x1A*/ 0x000071A0,/*0x1B*/ 0x000071B0, +/*0x1C*/ 0x000071C0,/*0x1D*/ 0x000071D0,/*0x1E*/ 0x000071E0,/*0x1F*/ 0x000071F0, +/*0x20*/ 0x00000200,/*0x21*/ 0x00006210,/*0x22*/ 0x00006220,/*0x23*/ 0x00006230, +/*0x24*/ 0x00006240,/*0x25*/ 0x00006250,/*0x26*/ 0x00006260,/*0x27*/ 0x00006270, +/*0x28*/ 0x00006280,/*0x29*/ 0x00006290,/*0x2A*/ 0x000062A0,/*0x2B*/ 0x000062B0, +/*0x2C*/ 0x000062C0,/*0x2D*/ 0x000062D0,/*0x2E*/ 0x000062E0,/*0x2F*/ 0x000062F0, +/*0x30*/ 0x00001300,/*0x31*/ 0x00001310,/*0x32*/ 0x00001320,/*0x33*/ 0x00001330, +/*0x34*/ 0x00001340,/*0x35*/ 0x00001350,/*0x36*/ 0x00001360,/*0x37*/ 0x00001370, +/*0x38*/ 0x00001380,/*0x39*/ 0x00001390,/*0x3A*/ 0x000063A0,/*0x3B*/ 0x000063B0, +/*0x3C*/ 0x000063C0,/*0x3D*/ 0x000063D0,/*0x3E*/ 0x000063E0,/*0x3F*/ 0x000063F0, +/*0x40*/ 0x00006400,/*0x41*/ 0x00002618,/*0x42*/ 0x00002628,/*0x43*/ 0x00002638, +/*0x44*/ 0x00002648,/*0x45*/ 0x00002658,/*0x46*/ 0x00002668,/*0x47*/ 0x00002678, +/*0x48*/ 0x00002688,/*0x49*/ 0x00002698,/*0x4A*/ 0x000026A8,/*0x4B*/ 0x000026B8, +/*0x4C*/ 0x000026C8,/*0x4D*/ 0x000026D8,/*0x4E*/ 0x000026E8,/*0x4F*/ 0x000026F8, +/*0x50*/ 0x00002708,/*0x51*/ 0x00002718,/*0x52*/ 0x00002728,/*0x53*/ 0x00002738, +/*0x54*/ 0x00002748,/*0x55*/ 0x00002758,/*0x56*/ 0x00002768,/*0x57*/ 0x00002778, +/*0x58*/ 0x00002788,/*0x59*/ 0x00002798,/*0x5A*/ 0x000027A8,/*0x5B*/ 0x000065B0, +/*0x5C*/ 0x000065C0,/*0x5D*/ 0x000065D0,/*0x5E*/ 0x000065E0,/*0x5F*/ 0x000065F0, +/*0x60*/ 0x00006600,/*0x61*/ 0x00002610,/*0x62*/ 0x00002620,/*0x63*/ 0x00002630, +/*0x64*/ 0x00002640,/*0x65*/ 0x00002650,/*0x66*/ 0x00002660,/*0x67*/ 0x00002670, +/*0x68*/ 0x00002680,/*0x69*/ 0x00002690,/*0x6A*/ 0x000026A0,/*0x6B*/ 0x000026B0, +/*0x6C*/ 0x000026C0,/*0x6D*/ 0x000026D0,/*0x6E*/ 0x000026E0,/*0x6F*/ 0x000026F0, +/*0x70*/ 0x00002700,/*0x71*/ 0x00002710,/*0x72*/ 0x00002720,/*0x73*/ 0x00002730, +/*0x74*/ 0x00002740,/*0x75*/ 0x00002750,/*0x76*/ 0x00002760,/*0x77*/ 0x00002770, +/*0x78*/ 0x00002780,/*0x79*/ 0x00002790,/*0x7A*/ 0x000027A0,/*0x7B*/ 0x000067B0, +/*0x7C*/ 0x000067C0,/*0x7D*/ 0x000067D0,/*0x7E*/ 0x000067E0,/*0x7F*/ 0x000067F0, +/*0x80*/ 0x0000263F,/*0x81*/ 0x00002751,/*0x82*/ 0x00002652,/*0x83*/ 0x00002614, +/*0x84*/ 0x00002611,/*0x85*/ 0x00002613,/*0x86*/ 0x00002616,/*0x87*/ 0x00002637, +/*0x88*/ 0x00002654,/*0x89*/ 0x00002651,/*0x8A*/ 0x00002653,/*0x8B*/ 0x00002691, +/*0x8C*/ 0x00002694,/*0x8D*/ 0x00002693,/*0x8E*/ 0x00002619,/*0x8F*/ 0x0000261E, +/*0x90*/ 0x0000265A,/*0x91*/ 0x00002910,/*0x92*/ 0x00002920,/*0x93*/ 0x000026F4, +/*0x94*/ 0x000026F1,/*0x95*/ 0x000026F3,/*0x96*/ 0x00002754,/*0x97*/ 0x00002753, +/*0x98*/ 0x00002791,/*0x99*/ 0x000026F9,/*0x9A*/ 0x00002759,/*0x9B*/ 0x000029B0, +/*0x9C*/ 0x000029C0,/*0x9D*/ 0x000029D0,/*0x9E*/ 0x000029E0,/*0x9F*/ 0x000029F0, +/*0xA0*/ 0x00002612,/*0xA1*/ 0x00002692,/*0xA2*/ 0x000026F2,/*0xA3*/ 0x00002752, +/*0xA4*/ 0x000026E7,/*0xA5*/ 0x000026EF,/*0xA6*/ 0x00002617,/*0xA7*/ 0x000026F7, +/*0xA8*/ 0x00007A80,/*0xA9*/ 0x00007A90,/*0xAA*/ 0x00007AA0,/*0xAB*/ 0x00007AB0, +/*0xAC*/ 0x00007AC0,/*0xAD*/ 0x00007AD0,/*0xAE*/ 0x00007AE0,/*0xAF*/ 0x00007AF0, +/*0xB0*/ 0x00005B00,/*0xB1*/ 0x00005B10,/*0xB2*/ 0x00005B20,/*0xB3*/ 0x00005B30, +/*0xB4*/ 0x00005B40,/*0xB5*/ 0x00005B50,/*0xB6*/ 0x00005B60,/*0xB7*/ 0x00005B70, +/*0xB8*/ 0x00005B80,/*0xB9*/ 0x00005B90,/*0xBA*/ 0x00005BA0,/*0xBB*/ 0x00005BB0, +/*0xBC*/ 0x00005BC0,/*0xBD*/ 0x00005BD0,/*0xBE*/ 0x00005BE0,/*0xBF*/ 0x00005BF0, +/*0xC0*/ 0x00005C00,/*0xC1*/ 0x00005C10,/*0xC2*/ 0x00005C20,/*0xC3*/ 0x00005C30, +/*0xC4*/ 0x00005C40,/*0xC5*/ 0x00005C50,/*0xC6*/ 0x00005C60,/*0xC7*/ 0x00005C70, +/*0xC8*/ 0x00005C80,/*0xC9*/ 0x00005C90,/*0xCA*/ 0x00005CA0,/*0xCB*/ 0x00005CB0, +/*0xCC*/ 0x00005CC0,/*0xCD*/ 0x00005CD0,/*0xCE*/ 0x00005CE0,/*0xCF*/ 0x00005CF0, +/*0xD0*/ 0x00005D00,/*0xD1*/ 0x00005D10,/*0xD2*/ 0x00005D20,/*0xD3*/ 0x00005D30, +/*0xD4*/ 0x00005D40,/*0xD5*/ 0x00005D50,/*0xD6*/ 0x00005D60,/*0xD7*/ 0x00005D70, +/*0xD8*/ 0x00005D80,/*0xD9*/ 0x00005D90,/*0xDA*/ 0x00005DA0,/*0xDB*/ 0x00005DB0, +/*0xDC*/ 0x00005DC0,/*0xDD*/ 0x00005DD0,/*0xDE*/ 0x00005DE0,/*0xDF*/ 0x00005DF0, +/*0xE0*/ 0x00003E00,/*0xE1*/ 0x00002737,/*0xE2*/ 0x00003E20,/*0xE3*/ 0x00003E30, +/*0xE4*/ 0x00003E40,/*0xE5*/ 0x00003E50,/*0xE6*/ 0x00003E60,/*0xE7*/ 0x00003E70, +/*0xE8*/ 0x00003E80,/*0xE9*/ 0x00003E90,/*0xEA*/ 0x00003EA0,/*0xEB*/ 0x00003EB0, +/*0xEC*/ 0x00004EC0,/*0xED*/ 0x00004ED0,/*0xEE*/ 0x00004EE0,/*0xEF*/ 0x00004EF0, +/*0xF0*/ 0x00004F00,/*0xF1*/ 0x00004F10,/*0xF2*/ 0x00004F20,/*0xF3*/ 0x00004F30, +/*0xF4*/ 0x00004F40,/*0xF5*/ 0x00004F50,/*0xF6*/ 0x00004F60,/*0xF7*/ 0x00004F70, +/*0xF8*/ 0x00004F80,/*0xF9*/ 0x00004F90,/*0xFA*/ 0x00004FA0,/*0xFB*/ 0x00004FB0, +/*0xFC*/ 0x00004FC0,/*0xFD*/ 0x00004FD0,/*0xFE*/ 0x00007FE0,/*0xFF*/ 0x00007FF0 diff --git a/lib/ds/strings/str_0043.c b/lib/ds/strings/str_0043.c new file mode 100644 index 0000000000000000000000000000000000000000..0122cda1af455bfee095629dcfcee5c65198884e --- /dev/null +++ b/lib/ds/strings/str_0043.c @@ -0,0 +1,64 @@ +/* + * FILE %ds/strings/str_0043.c + * + * generate a random password with a given length + * based on mk_passwd () + * + * written: 1995-10-04 + * latest update: 1995-11-05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <time.h> +#include <stdlib.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +static char *PASS_CHARS= + "0123456789"; + +#define PASSWORD_ALPHABETH_SIZE 10 + +static int initialized= 0; + +/* ------------------------------------------------------------------------ */ +int mk_pin_code (char *s, int pass_lng) +{ + long r; + int i; + + if (!initialized) + { + srand ((unsigned int) time ((time_t *) 0)); + initialized= 1; + } + + for (i= 0; i < pass_lng; i++) + { + r= rand () % PASSWORD_ALPHABETH_SIZE; + s [i]= PASS_CHARS [r]; + } + + s [i]= 0; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef TEST +int main (int argc, char *argv []) +{ + int i; + char pin [10]; + for (i= 0; i<300; i++) + { + mk_pin_code (pin, 4); + printf ("%s\n", pin); + } + return 0; +} +#endif diff --git a/lib/ds/strings/str_0043.o b/lib/ds/strings/str_0043.o new file mode 100644 index 0000000000000000000000000000000000000000..04ff7fad1bcb96bd765e6b1e60f421fadb89c15e Binary files /dev/null and b/lib/ds/strings/str_0043.o differ diff --git a/lib/ds/strings/str_0044.c b/lib/ds/strings/str_0044.c new file mode 100644 index 0000000000000000000000000000000000000000..f4b81bfd82585a92c137652ff3f787c937d4f6c0 --- /dev/null +++ b/lib/ds/strings/str_0044.c @@ -0,0 +1,24 @@ +/* + * FILE %ds/strings/str_0044.c + * + * free a string if not a null pointer + * + * written: 1995-11-05 + * latest update: 1995-11-05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int free_or_what (void *s) +{ + if (s != (void *) 0) free (s); + + return 0; +} diff --git a/lib/ds/strings/str_0044.o b/lib/ds/strings/str_0044.o new file mode 100644 index 0000000000000000000000000000000000000000..4d7b628adf35dfe5e462c92a2297f7333e3637bc Binary files /dev/null and b/lib/ds/strings/str_0044.o differ diff --git a/lib/ds/strings/str_0045.c b/lib/ds/strings/str_0045.c new file mode 100644 index 0000000000000000000000000000000000000000..fbc5aeb0fb502a40368641fd0ccb9f851241ee06 --- /dev/null +++ b/lib/ds/strings/str_0045.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/strings/str_0045.c + * + * written: 1995-11-11 + * latest update: 1995-11-11 + * $Id: str_0045.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *strdup_extra (const char *str, int extra) +{ + char *cp; + + if (str == (char *) 0) return (char *) 0; + + if ((cp= malloc (strlen (str) + 1 + extra)) != (char *) 0) + strcpy (cp, str); + + return cp; +} diff --git a/lib/ds/strings/str_0045.o b/lib/ds/strings/str_0045.o new file mode 100644 index 0000000000000000000000000000000000000000..2475ce33578dcb35f62d5215bf508c4d044ece2b Binary files /dev/null and b/lib/ds/strings/str_0045.o differ diff --git a/lib/ds/strings/str_0046.c b/lib/ds/strings/str_0046.c new file mode 100644 index 0000000000000000000000000000000000000000..6d07badcaa172972f8f0788ea5b0a0e325a81c6f --- /dev/null +++ b/lib/ds/strings/str_0046.c @@ -0,0 +1,67 @@ +/* + * FILE %ds/strings/str_0046.c + * + * written: 1995-12-08 + * latest update: 1995-12-08 + * $Id: str_0046.c,v 1.3 2005/02/19 03:37:02 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int sgml_encode (char *str, char *tmp, int str_size) +{ + int ch; + char *dst; + char *src; + int rv= 0; + + if (str == (char *) 0 || tmp == (char *) 0 || str_size < 0) return -1; + + dst= tmp; + src= str; + + while (str_size > 0) + { + switch (ch= (*src++ & 0x00FF)) + { + case '&': + if (str_size <= 5) goto TOO_SHORT; + strcpy (dst, "&"); + dst += 5; + str_size -= 5; + break; + + case '<': + case '>': + if (str_size <= 4) + { +TOO_SHORT: + ch= 0; + rv= 1; + break; + } + strcpy (dst, (ch == '<') ? "<" : ">"); + dst += 4; + str_size -= 4; + break; + + default: + *dst++= (char) ch; + str_size--; + break; + } + if (ch == 0) break; + } + + strcpy (str, tmp); + + return rv; +} diff --git a/lib/ds/strings/str_0046.o b/lib/ds/strings/str_0046.o new file mode 100644 index 0000000000000000000000000000000000000000..47ff660ebdffe3be80412bd554fbcebe3866d2ad Binary files /dev/null and b/lib/ds/strings/str_0046.o differ diff --git a/lib/ds/strings/str_0047.c b/lib/ds/strings/str_0047.c new file mode 100644 index 0000000000000000000000000000000000000000..4abe0f7824f3a88a03969b7cc2b087f832a85700 --- /dev/null +++ b/lib/ds/strings/str_0047.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/strings/str_0047.c + * + * read string from file + * + * written: 1990 07 29 + * latest update: 1995-12-25 + * $Id: str_0047.c,v 1.3 2009/10/13 13:00:07 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/strings.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +char *read_string (FILE *fi, int string_length) +{ + char *str= (char *) 0; + + if (string_length > 0 + && (str= malloc (string_length+1)) != (char *) 0 + ) + { + fread (str, string_length, 1, fi); + str [string_length]= 0; + } + + return str; +} diff --git a/lib/ds/strings/str_0047.o b/lib/ds/strings/str_0047.o new file mode 100644 index 0000000000000000000000000000000000000000..e3362ea98c37e357a6a894d050418693e92c7abd Binary files /dev/null and b/lib/ds/strings/str_0047.o differ diff --git a/lib/ds/strings/str_0048.c b/lib/ds/strings/str_0048.c new file mode 100644 index 0000000000000000000000000000000000000000..1f4cd286efab537a12006790fd235d3586d3daee --- /dev/null +++ b/lib/ds/strings/str_0048.c @@ -0,0 +1,21 @@ +/* + * FILE %ds/strings/str_0048.c + * + * return string for debugging + * + * written: 1996-03-17 + * latest update: 1996-03-17 16:28:02 + * + */ + +#include <gg/strings.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +char *XSTR (char *str) +{ + return (str == (char *) 0) ? "(null)" : str; +} diff --git a/lib/ds/strings/str_0048.o b/lib/ds/strings/str_0048.o new file mode 100644 index 0000000000000000000000000000000000000000..871c4ec02eaf22cc55625c2574c92eb0c0667cc9 Binary files /dev/null and b/lib/ds/strings/str_0048.o differ diff --git a/lib/ds/strings/str_0049.c b/lib/ds/strings/str_0049.c new file mode 100644 index 0000000000000000000000000000000000000000..1183d5791e3516763c26b05f8ce773cf0d418f2d --- /dev/null +++ b/lib/ds/strings/str_0049.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/strings/str_0049.c + * + * copy string with a given maximum length + * similar to strncpy, except that the buffer is not cleared out + * and that a 0 character is always put at the end of the string + * + * written: 1996-09-28 + * latest update: 1997-06-16 19:50:39 + * $Id: str_0049.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *strcpy_max ( /* string copy with maximum length */ +char *d, /* destination */ +const char *s, /* source */ +int size) /* maximal cnt Zeichen in Dest; d [cnt]=0; */ +{ + char *rv; + + if ((rv= d) == (char *) 0 + || s == (char *) 0 + || size <= 0 + ) return (char *) 0; + + while (--size > 0) if ((*d++= *s++) == 0) return rv; + *d= (char) 0; + + return rv; +} diff --git a/lib/ds/strings/str_0049.o b/lib/ds/strings/str_0049.o new file mode 100644 index 0000000000000000000000000000000000000000..c282e0e1dbb058b8a5156be41f0983351d4a1baf Binary files /dev/null and b/lib/ds/strings/str_0049.o differ diff --git a/lib/ds/strings/str_0050.c b/lib/ds/strings/str_0050.c new file mode 100644 index 0000000000000000000000000000000000000000..24b90a98684e9b8c57024b4c94ff6797802c42fb --- /dev/null +++ b/lib/ds/strings/str_0050.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/strings/str_0050.c + * + * written: 1997-06-11 + * latest update: 1997-06-11 11:08:12 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> + +static char *ES= ""; + +/* ------------------------------------------------------------------------ */ +int strcmp_nn (char *s1, char *s2) +{ +#ifdef __V1__ + if (s1 == (char *) 0 && s2 == (char *) 0) return 0; + if (s1 == (char *) 0) return -1; + if (s2 == (char *) 0) return 1; +#endif /* __V1__ */ + + if (s1 == (char *) 0) s1= ES; + if (s2 == (char *) 0) s2= ES; + + return strcmp (s1, s2); +} diff --git a/lib/ds/strings/str_0050.o b/lib/ds/strings/str_0050.o new file mode 100644 index 0000000000000000000000000000000000000000..d8aa2db556dc8b4674ab6d9541ace6c2d5344080 Binary files /dev/null and b/lib/ds/strings/str_0050.o differ diff --git a/lib/ds/strings/str_0051.c b/lib/ds/strings/str_0051.c new file mode 100644 index 0000000000000000000000000000000000000000..84b9d469b0530e7b3d30512d8f055db21523ed8b --- /dev/null +++ b/lib/ds/strings/str_0051.c @@ -0,0 +1,24 @@ +/* + * FILE %ds/strings/str_0051.c + * + * duplicate a string if not a null pointer + * + * written: 1997-06-13 + * latest update: 1997-06-13 14:04:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *strdup_or_what (char *s) +{ + if (s == (char *) 0) return (char *) 0; + return strdup (s); +} diff --git a/lib/ds/strings/str_0051.o b/lib/ds/strings/str_0051.o new file mode 100644 index 0000000000000000000000000000000000000000..46444cdce2817c7ccc356515afc61e8e09220608 Binary files /dev/null and b/lib/ds/strings/str_0051.o differ diff --git a/lib/ds/strings/str_0052.c b/lib/ds/strings/str_0052.c new file mode 100644 index 0000000000000000000000000000000000000000..5fa0d2d1d98db5b98b2e5c54b923d38fd38eed0f --- /dev/null +++ b/lib/ds/strings/str_0052.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/strings/str_0052.c + * + * copy string with a given maximum length + * + * similar to strncpy, except that the buffer is not cleared out + * and that a 0 character is always put at the end of the string + * furthermore: the number of chars copied is returned + * + * written: 1997-06-16 + * latest update: 1997-06-16 18:54:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int strcpy2_max ( /* string copy with maximum length */ +char *d, /* destination */ +char *s, /* source */ +int size) /* maximal cnt Zeichen in Dest; d [cnt]=0; */ +{ + int rv= 0; + + if (d == (char *) 0 + || s == (char *) 0 + || size <= 0 + ) return 0; + + while (--size > 0) { if ((*d++= *s++) == 0) return rv; rv++; } + *d= (char) 0; + + return rv; +} diff --git a/lib/ds/strings/str_0052.o b/lib/ds/strings/str_0052.o new file mode 100644 index 0000000000000000000000000000000000000000..c6e3faffb137ccd695ad23491dc3b16150a5e2a9 Binary files /dev/null and b/lib/ds/strings/str_0052.o differ diff --git a/lib/ds/strings/str_0053.c b/lib/ds/strings/str_0053.c new file mode 100644 index 0000000000000000000000000000000000000000..ee98edf4f09fb3a053f9ad56528c2aad75a65977 --- /dev/null +++ b/lib/ds/strings/str_0053.c @@ -0,0 +1,42 @@ +/* + * FILE %ds/strings/str_0053.c + * + * prompt for a password and verify in a cycle + * + * written: 1997-10-05 + * latest update: 1999-11-28 12:26:17 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *get_password_verified (char *p1, char *p2) +{ + char *ver1; + char *ver2; + + for (;;) + { + ver1= strdup_or_what (getpass (p1)); + ver2= strdup_or_what (getpass (p2)); + if (ver1 == (char *) 0 || ver2 == (char *) 0) return (char *) 0; + + if (strcmp (ver1, ver2) == 0) break; + + fprintf (stderr, "passwords don't match, try again!\n"); + free_or_what (ver1); + free_or_what (ver2); + } + free_or_what (ver2); + + return ver1; +} diff --git a/lib/ds/strings/str_0053.o b/lib/ds/strings/str_0053.o new file mode 100644 index 0000000000000000000000000000000000000000..9e9f385375659a9c84211f5b671c8668679ff545 Binary files /dev/null and b/lib/ds/strings/str_0053.o differ diff --git a/lib/ds/strings/str_0107.c b/lib/ds/strings/str_0107.c new file mode 100644 index 0000000000000000000000000000000000000000..fabc0d0667a0a099cbb092c7bfbff5b3b5d9cc20 --- /dev/null +++ b/lib/ds/strings/str_0107.c @@ -0,0 +1,24 @@ +/* + * FILE %ds/strings/str_0107.c + * + * written: 1989 10 14: (aus STRINGS.SAR) + * 1992 09 13: revision + * latest update: 1995-12-03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +void strnins (char *str, int lng, int pos, int cnt) +{ + int i; + + for (i= lng-1; i >= pos; i--) str [i+cnt]= str [i]; + + str [lng+cnt]= 0; +} diff --git a/lib/ds/strings/str_0107.o b/lib/ds/strings/str_0107.o new file mode 100644 index 0000000000000000000000000000000000000000..4ab76a61c5a9c1df007e85bf4a21b0802904fe4d Binary files /dev/null and b/lib/ds/strings/str_0107.o differ diff --git a/lib/ds/strings/str_0108.c b/lib/ds/strings/str_0108.c new file mode 100644 index 0000000000000000000000000000000000000000..a9adc4c23f4558500d5f63ad1cc2acae307a9eaf --- /dev/null +++ b/lib/ds/strings/str_0108.c @@ -0,0 +1,22 @@ +/* + * FILE /usr/sbr/str_0108.c + * + * 1989 10 14: (aus STRINGS.SAR) + * 1992 09 13: revision + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +void strndel (char *str, int lng, int pos, int cnt) +{ + int i; + + for (i = pos + cnt; i < lng; i++) + str [i-cnt] = str [i]; +} diff --git a/lib/ds/strings/str_0108.o b/lib/ds/strings/str_0108.o new file mode 100644 index 0000000000000000000000000000000000000000..298e8a22a09b8be23e73289e3f99337cc1d12e2a Binary files /dev/null and b/lib/ds/strings/str_0108.o differ diff --git a/lib/ds/strings/str_0109.c b/lib/ds/strings/str_0109.c new file mode 100644 index 0000000000000000000000000000000000000000..756e61dd9bdfb7b27191cba5129ab54f487f5ed0 --- /dev/null +++ b/lib/ds/strings/str_0109.c @@ -0,0 +1,24 @@ +/* + * FILE ~/usr/sbr/str_0109.c + * + * written: 1989 10 14: (aus STRINGS.SAR) + * 1992 03 13: revision + * latest update: 1994-08-01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +void delstr ( /* Loesche ein Zeichen */ +char *s, /* aus diesem String */ +int p) /* ab dieser Position */ + /* und verschiebe den Rest */ +{ + for (; s [p]; p++) + s [p]= s [p+1]; +} diff --git a/lib/ds/strings/str_0109.o b/lib/ds/strings/str_0109.o new file mode 100644 index 0000000000000000000000000000000000000000..1bb2fbd4d9315fe0c9409648f0f45ed30f013cf3 Binary files /dev/null and b/lib/ds/strings/str_0109.o differ diff --git a/lib/ds/strings/str_0201.c b/lib/ds/strings/str_0201.c new file mode 100644 index 0000000000000000000000000000000000000000..76a0e8cd72981f93b3f7679d267eb271f1b59630 --- /dev/null +++ b/lib/ds/strings/str_0201.c @@ -0,0 +1,56 @@ +/* + * FILE %ds/strings/str_0201.c + * + * return 1 if one string is the abbreviation of the other one + * return 0 if it's not a abbreviation + * return -1 in case of an error + * + * written: 1992 03 13 + * latest update: 1995-12-13 + * $Id: str_0201.c,v 1.2 2005/09/04 20:27:37 gonter Exp $ + * + */ + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int abbrev (const char *unabbr, const char *abbr, int lng) +{ + int i; + int c; + +/* printf ("unabbr=%s, abbr=%s, i=%d\n", unabbr, abbr, i); */ + if (unabbr == (char *) 0 || abbr == (char *) 0) return -1; /* or 0 ? */ + + for (i= 0; ((int) *abbr) == (c= ((int) *unabbr)) && c; i++) + { + abbr++; + unabbr++; + } + +/* printf ("unabbr=%s, abbr=%s, i=%d\n", unabbr, abbr, i); */ + + if (*abbr == 0 && i >= lng) return 1; + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef _DEBUG_MODULE_ +t_abbrev (char *s1, char *s2, int l) +{ + printf ("abbrev(\"%s\",\"%s\",%d) -> %d\n", + s1, s2, l, + abbrev (s1, s2, l)); +} + +main () +{ + t_abbrev ("Gerhard", "Ger", 0); + t_abbrev ("Gerhard", "Ger", 2); + t_abbrev ("Gerhard", "Ger", 3); + t_abbrev ("Gerhard", "Ger", 4); + t_abbrev ("Gerhard", "ger", 0); + t_abbrev ("Gerhard", "Gerald", 3); + t_abbrev ("Gerhard", "Gerhard", 3); +} +#endif diff --git a/lib/ds/strings/str_0201.o b/lib/ds/strings/str_0201.o new file mode 100644 index 0000000000000000000000000000000000000000..c29d2c05d59dbf11166aa3937d620472a02a2b50 Binary files /dev/null and b/lib/ds/strings/str_0201.o differ diff --git a/lib/ds/strings/str_0202.c b/lib/ds/strings/str_0202.c new file mode 100644 index 0000000000000000000000000000000000000000..3233f9dfef10533efade7c2d1a10bd7193bc6791 --- /dev/null +++ b/lib/ds/strings/str_0202.c @@ -0,0 +1,37 @@ +/* + * FILE ~/usr/sbr/str_0202.c + * + * translate (see REXX) + * + * written: 1993-01-15 + * latest update: 1994-08-13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *translate (char *s, char *tbl_in, char *tbl_out) +{ + int j; + int l_s; + int l_in; + int l_out; + + if (s == (char *) 0) return (char *) 0; + if (tbl_in == (char *) 0 || tbl_out == (char *) 0) return s; + + l_s= strlen(s); + l_in= strlen (tbl_in); + l_out= strlen (tbl_out); + if (l_in > l_out) l_in= l_out; + + for (j= 0; j<l_in; j++) xchange (s, tbl_in [j], tbl_out [j]); + + return s; +} diff --git a/lib/ds/strings/str_0202.o b/lib/ds/strings/str_0202.o new file mode 100644 index 0000000000000000000000000000000000000000..720c487dc367f18a62adf0c2fce9ed5d3c1f7661 Binary files /dev/null and b/lib/ds/strings/str_0202.o differ diff --git a/lib/ds/strings/str_0203.c b/lib/ds/strings/str_0203.c new file mode 100644 index 0000000000000000000000000000000000000000..8d0a5f3c0f7f2f7e1ce113f4c65ed2821c8cd1cc --- /dev/null +++ b/lib/ds/strings/str_0203.c @@ -0,0 +1,49 @@ +/* + * FILE %ds/strings/str_0203.c + * + * Verify if a string only contains characters from a reference set. + * (see REXX) + * + * Returns position of first character that is *NOT* contained + * in the reference set. A return value of 0 indicates that + * all characters are contained in the reference set. + * The position is given (as in REXX) in the interval 1..N, + * where N is the length of the string. + * + * written: 1993-01-20 + * latest update: 1995-05-29 + * $Id: str_0203.c,v 1.2 2004/05/25 22:07:18 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int verify (char *string, char *reference) +{ + int j; + int i= 0; /* index of examined character */ + int ch; /* examined character */ + int rch; /* reference character */ + int found; + + while ((ch= *string++) != 0) + { + i++; + found= 0; + for (j= 0; (rch= reference [j]) != 0; j++) + if (ch == rch) + { + found= 1; + break; + } + if (!found) return i; + } + + return 0; +} diff --git a/lib/ds/strings/str_0203.o b/lib/ds/strings/str_0203.o new file mode 100644 index 0000000000000000000000000000000000000000..539a13e9d7e82ae33b279acf2384b93f8207be9a Binary files /dev/null and b/lib/ds/strings/str_0203.o differ diff --git a/lib/ds/strings/str_0204.c b/lib/ds/strings/str_0204.c new file mode 100644 index 0000000000000000000000000000000000000000..a01e49dd74e80f04ae784fa84b227b8b43f87d56 --- /dev/null +++ b/lib/ds/strings/str_0204.c @@ -0,0 +1,107 @@ +/* + * FILE ~/usr/sbr/str_0204.c + * + * strip a string (see REXX) + * + * written: 1993-04-23 + * latest update: 1993-09-27 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int strip (char *string, char *where) +{ + int ch; + int str_lead= 0; + int str_trail= 0; + int str_inter= 0; + char *dest; +#define STAT_top 0 +#define STAT_char 1 +#define STAT_blank 2 + int stat=STAT_top; + int blank_count; + + if (string == (char *) 0) return -1; + + if (where != (char *) 0 && *where != 0) + { + for (; ch= *where; where++) + switch (ch) + { + case 'l': case 'L': + str_lead= 1; + break; + case 'b': case 'B': + str_lead= 1; + case 't': case 'T': + str_trail= 1; + break; + case 'i': case 'I': + str_inter= 1; + break; + } + } + else + str_lead= str_trail= 1; + + dest= string; + while (ch= (int) *string++) + { + switch (stat) + { + case STAT_top: + if (ch == ' ' || ch == '\t') + { + if (!str_lead) *dest++= (char) ch; + } + else + { + stat= STAT_char; + *dest++= (char) ch; + } + break; + case STAT_char: + if (ch == ' ' || ch == '\t') + { + stat= STAT_blank; + blank_count= 1; + } + else + *dest++= (char) ch; + break; + case STAT_blank: + if (ch == ' ' || ch == '\t') + blank_count++; + else + { + stat= STAT_char; + + if (!str_inter) + while (blank_count-- > 0) + *dest++= ' '; + else *dest++= ' '; /* just once if stripping is on */ + + *dest++= (char) ch; + } + break; + default: + return -1; + } + } + + if (!str_trail) + while (blank_count-- > 0) + *dest++= ' '; + + *dest= 0; + + return 0; +} diff --git a/lib/ds/strings/str_0204.o b/lib/ds/strings/str_0204.o new file mode 100644 index 0000000000000000000000000000000000000000..2ee46a565394c1594c6bdfc00e81750122d62d16 Binary files /dev/null and b/lib/ds/strings/str_0204.o differ diff --git a/lib/ds/strings/str_0301.c b/lib/ds/strings/str_0301.c new file mode 100644 index 0000000000000000000000000000000000000000..5e2993e15c65795bcbaca719320c4b18eb00f882 --- /dev/null +++ b/lib/ds/strings/str_0301.c @@ -0,0 +1,41 @@ +/* + * FILE %ds/strings/str_0301.c + * + * written: 1991 01 27 + * 1992 09 13: revision + * latest update: 1999-04-25 16:58:51 + * $Id: str_0301.c,v 1.3 2002/02/04 08:13:10 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifdef __HPUX__ +#define _XOPEN_SOURCE +#endif + +#include <stdlib.h> + +#ifdef MSDOS +int strlen (char *); +char *strcpy (char *, char *); +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *strdup (const char *str) +{ + char *cp; + + if (str == (char *) 0) return (char *) 0; + + if ((cp= malloc (strlen (str) + 1)) != (char *) 0) + { + strcpy (cp, str); + } + + return cp; +} diff --git a/lib/ds/strings/str_0302.c b/lib/ds/strings/str_0302.c new file mode 100644 index 0000000000000000000000000000000000000000..48fe5b18bdad05c0a4bd443775768537d9e6367f --- /dev/null +++ b/lib/ds/strings/str_0302.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/strings/str_0302.c + * + * written: 1992 12 14 + * latest update: 1999-04-25 16:58:42 + * $Id: str_0302.c,v 1.4 2005/09/04 09:24:40 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifdef __HPUX__ +#define _XOPEN_SOURCE +#endif + +#include <stdlib.h> + +#include <memory.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *strndup (const char *str, size_t size) +{ + char *cp; + + if (str == (char *) 0 || size < 0) return (char *) 0; + + if ((cp= malloc (size + 1)) != (char *) 0) + { + memcpy (cp, str, size); + cp [size]= 0; + } + + return cp; +} diff --git a/lib/ds/strings/str_0302.o b/lib/ds/strings/str_0302.o new file mode 100644 index 0000000000000000000000000000000000000000..c0724eb942309ec11a2b3552f90795c8ad06c55e Binary files /dev/null and b/lib/ds/strings/str_0302.o differ diff --git a/lib/ds/strings/str_0303.c b/lib/ds/strings/str_0303.c new file mode 100644 index 0000000000000000000000000000000000000000..0353c12ad84e63f5f8ed3ad46d4a34f79400a06f --- /dev/null +++ b/lib/ds/strings/str_0303.c @@ -0,0 +1,45 @@ +/* + * FILE ~/usr/sbr/str_0303.c + * + * written: 1994-04-02 + * latest update: 1999-04-25 16:59:00 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifdef __HPUX__ +#define _XOPEN_SOURCE +#endif + +#include <string.h> +#include <stdlib.h> + +#ifdef MSDOS +int strlen(char *); +#endif + +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *strrev (char *str) +{ + char *cp1; + char *cp2; + char ch; + + if (str == (char *) 0) return (char *) 0; + + cp1= str; + cp2= str+strlen (str)-1; + for (; cp1 < cp2; cp1++, cp2--) + { + ch= *cp1; + *cp1= *cp2; + *cp2= ch; + } + + return str; +} diff --git a/lib/ds/strings/str_0303.o b/lib/ds/strings/str_0303.o new file mode 100644 index 0000000000000000000000000000000000000000..cf3b5ba4498198f8f5b34ef780e6dee96de31d98 Binary files /dev/null and b/lib/ds/strings/str_0303.o differ diff --git a/lib/ds/strings/str_0304.c b/lib/ds/strings/str_0304.c new file mode 100644 index 0000000000000000000000000000000000000000..60f2971e2720bc8716eaf900d80ec637a9a2dcd1 --- /dev/null +++ b/lib/ds/strings/str_0304.c @@ -0,0 +1,40 @@ +/* + * FILE 1996-11-26 19:26:14 + * + * written: 1996-11-26 + * latest update: 1999-04-25 16:59:09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifdef __HPUX__ +#define _XOPEN_SOURCE +#endif + +#include <stdlib.h> +#include <memory.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +char *strdup_max (char *str, int max_size) +{ + char *cp; + int size; + + if (str == (char *) 0 || max_size < 0) return (char *) 0; + + cp= str; + for (size= 0; size < max_size; size++) + if (*cp++ == 0) break; + + if ((cp= malloc (size + 1)) != (char *) 0) + { + memcpy (cp, str, size); + cp [size]= 0; + } + + return cp; +} diff --git a/lib/ds/strings/str_0304.o b/lib/ds/strings/str_0304.o new file mode 100644 index 0000000000000000000000000000000000000000..d4e1d3614e6d2dcc4d5a03f8eaf13d96f3f1d569 Binary files /dev/null and b/lib/ds/strings/str_0304.o differ diff --git a/lib/ds/strings/strings.c b/lib/ds/strings/strings.c new file mode 100644 index 0000000000000000000000000000000000000000..d3dfec4731820ef691c64d4fb16cc5d5654a1da4 --- /dev/null +++ b/lib/ds/strings/strings.c @@ -0,0 +1,231 @@ +/* + * FILE C:\usr\sbr\strings.c + * + * Testmodule fuer String-Operationen + * + * 1989 05 21 + * + */ + +# include <stdio.h> + +# define STDHLP stderr +# define ARG_C_max 24 +static char *arg_v [ARG_C_max]; +static int arg_c = 0; + +static char filenm [64]; + +# ifdef NIL +# undef NIL +# endif +# define NIL (char *) 0 + +# define MAX_LINE 256 +static char + line0 [MAX_LINE], + line1 [MAX_LINE], + line2 [MAX_LINE], + line3 [MAX_LINE]; + +static char + *linep0, + *linep1, + *linep2, + *linep3; + +static int int1, int2, int3, int4; + +/* ------------------------------------------------------------------------ */ +extern long + strcmp (), + strncmp (), + strcmp_c (), + strcmp_ebcdic (), + strcpy (), + strnscpy (), + match_lng (); + +/* ------------------------------------------------------------------------ */ +struct TEST_ARRAY +{ + char *name; + long (*funct) (); + int inp_str; + int inp_int; + int out_str; + int out_int; + int rval; /* 0 -> void; 1 -> int; 2 -> char * */ +} ; + +struct TEST_ARRAY test_array [] = +{ + { "strcmp", strcmp, 0x0003, 0x0000, 0x0000, 0x0000, 1 }, + { "strncmp", strncmp, 0x0003, 0x0004, 0x0000, 0x0000, 1 }, + { "strcpy", strcpy, 0x0002, 0x0000, 0x0001, 0x0000, 2 }, + { "strnscpy", strnscpy, 0x0002, 0x0004, 0x0001, 0x0000, 0 }, + { "strcmp_c", strcmp_c, 0x0003, 0x0000, 0x0000, 0x0000, 1 } , + { "strcmp_ebcdic", strcmp_ebcdic, 0x0003, 0x0000, 0x0000, 0x0000, 1 }, + { "match_lng", match_lng, 0x0003, 0x0004, 0x0000, 0x0000, 1 } +} ; + +static int array_size; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ "USAGE: strings [options] {file name}\n", + "OPTIONS: -f<filename> ... List of Files\n", + "EXAMPLES: \n", + "\n", + "(@)Astrings.c 0.0 #D$1989-02-14 15:45:00\n", + "\n", +# include "c:\usr\inc\public.inc" +} ; + +/* ------------------------------------------------------------------------ */ +main (argc, argv) +int argc; +char *argv []; +{ FILE *fi2; + int i, j; + + array_size = sizeof (test_array) / sizeof (struct TEST_ARRAY); + + for (i = 1; i < argc; i++) + if (argv [i][0] == '-' || argv [i][0] == '/') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + + case 'a': case 'A': +HLP: +# include "c:\usr\inc\help.inc" + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + if (arg_c) + for (i = 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if (access (& arg_v [i][2], 0) != 0) + { fprintf (stderr, "File %s not found!\n", + &arg_v [i][2]); + break; + } + fi2 = fopen (& arg_v [i][2], "rt"); + for (;;) + { + fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; + strings (filenm); + } + fclose (fi2); + } + else strings (arg_v [i]); + else strings_prompt (); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +strings (fn) +char *fn; +{ FILE *fi; + int ch; + + if (access (fn, 0) != 0) + { fprintf (stderr, "File %s not found!\n", fn); + return -1; + } + fi = fopen (fn, "rt"); + for (;;) + { + ch = fgetc (fi); + if (feof (fi)) break; + fputc (ch, stdout); + } + fclose (fi); +} + +/* ------------------------------------------------------------------------ */ +strings_prompt () +{ + int i, found; + long rc; + + for (;;) + { + printf ("Command: "); scanf ("%[^\n]", line0); fgetc (stdin); + if ((int) strcmp_c (line0, "exit") == 0) break; + found = -1; + for (i=0; i < array_size && found < 0; i++) + if ((int) strcmp (line0, test_array [i].name) == 0) + found=0; + if (found==-1) + { + printf ("Function %s not known!\n", line0); + continue; + } + if (test_array [found].inp_str & 0x0001) + { + printf ("Parameter 1 (String): "); + scanf ("%[^\n]", line1); fgetc (stdin); + linep1 = ((int) strcmp (line1, "NIL") == 0) ? NIL : line1; + } + if (test_array [found].inp_str & 0x0002) + { + printf ("Parameter 2 (String): "); + scanf ("%[^\n]", line2); fgetc (stdin); + linep2 = ((int) strcmp (line2, "NIL") == 0) ? NIL : line2; + } + if (test_array [found].inp_int & 0x0004) + { + printf ("Parameter 3 (Integer): "); + scanf ("%d", &int3); + } + switch (test_array [found].inp_str | + test_array [found].out_str) + { + case 0x0001: + switch (test_array [found].inp_int) + { + case 0x0002: + rc = (test_array [found].funct) (linep1, int2); + break; + } + break; + case 0x0003: + switch (test_array [found].inp_int) + { + case 0x0000: + rc = (test_array [found].funct) (linep1, linep2); + printf ("%s (%s, %s) -: %d\n", line0, linep1, linep2, rc); + break; + case 0x0004: + rc = (test_array [found].funct) (linep1, linep2, int3); + break; + } + break; + } + if (test_array [found].out_str & 0x0001) + { + printf ("Return Parameter 1 (String): %s\n", line1); + } + if (test_array [found].out_int & 0x0004) + { + printf ("Return Parameter 3 (Integer): %d\n", int3); + } + switch (test_array [found].rval) + { + case 0: printf ("Return Value is void.\n"); break; + case 1: printf ("Return Value is int %d\n", (int) rc); break; + case 2: printf ("Return Value is string %s\n", (char *) rc); break; + } + } +} + diff --git a/lib/ds/strings/strndup-test.c b/lib/ds/strings/strndup-test.c new file mode 100644 index 0000000000000000000000000000000000000000..9f62085b13a53a8eaa6d5ff552a7784ec03a6625 --- /dev/null +++ b/lib/ds/strings/strndup-test.c @@ -0,0 +1,21 @@ +/* + * FILE %ds/strings/strndup-test.c + * Test module for strndup + * apparently, not all operating systems define strndup () + * written: 2001-08-22 + * $Id: strndup-test.c,v 1.1 2001/08/22 09:03:25 gonter Exp $ + */ + +#include <string.h> +#ifdef TEST_OK +#include <gg/strings.h> +#endif + +int main (int argc, char *argv []) +{ + char *c; + c= strndup ("urxn", 10); + exit (0); +} + + diff --git a/lib/ds/strings/stt.c b/lib/ds/strings/stt.c new file mode 100644 index 0000000000000000000000000000000000000000..1ed9d058a7cbc39b3decebbfbba86af9dde88b00 --- /dev/null +++ b/lib/ds/strings/stt.c @@ -0,0 +1,106 @@ +/* + * FILE C:\usr\sbr\strings.arc [stt_0008.c] + * + * 1990 06 02 + * + */ + +# include "strings.h" + +struct TEST +{ + char *s1, *s2; + int lng; +} ; + +/* ------------------------------------------------------------------------ */ +# define TEST1_CNT 7 +struct TEST test1 [TEST1_CNT] = +{ + "abcd", "abab", 4, + "Gerhard", "Gonter", 99, + "Gerhard", "Gerald", 99, + + "just the same", "just the same", 99, + "this one", "this one is longer", 99, + "this one is longer", "this one", 99, + "this one is longer", "this one", 3 +} ; + +xxtest1 () +{ + int i, rc; + + for (i=0; i<TEST1_CNT; i++) + { + rc = match_lng (test1[i].s1, test1[i].s2, test1[i].lng); + printf ("s1='%s' s2='%s' lng=%d -> rc=%d\n", + test1[i].s1, test1[i].s2, test1[i].lng, rc); + } +} + +/* ------------------------------------------------------------------------ */ +# define TEST2a_CNT 6 +char *test2a [TEST2a_CNT] = +{ + "Re:xx", "Re: xx", "re: XX", "RE: ", + "xx yz", "abc Re: aa" +}; + +# define TEST2b_CNT 3 +struct TEST test2b [TEST2b_CNT] = +{ + "Subject: Designing online documents", + "Subject: re: Designing online documents", + 0, + "Subject: Designing online documents", + "Subject: re: Designing documents", + 0, + "Subject: Designing online documents", + "Subject: Designing online documents", + 0 +} ; + +xxtest2 () +{ + int i, rc; + + printf ("\nTEST2a: rc=skip_re (s)\n"); + for (i=0; i<TEST2a_CNT; i++) + { + rc = skip_re (test2a[i]); + printf ("s='%s' -> rc=%d\n", test2a[i], rc); + } + + printf ("\nTEST2b: rc=strcmp_cre (s1, s2)\n"); + for (i=0; i<TEST2b_CNT; i++) + { + rc = strcmp_cre (test2b[i].s1, test2b[i].s2); + printf ("s1='%s' s2='%s' -> rc=%d\n", + test2b[i].s1, test2b[i].s2, rc); + } +} + +/* ------------------------------------------------------------------------ */ +# define TEST3_CNT 4 +struct TEST test3 [TEST3_CNT] = +{ + "xyz", "abc", 0, + "*", "xyz", 0, + "*abcd*", "xyabxy", 0, + "*abcd*", "xxababcdyy", 0 +} ; + +main () +{ + int i, rc; + + printf ("\nTEST3: rc=match (pat, cmp)\n"); + for (i=0; i<TEST3_CNT; i++) + { + rc = match (test3[i].s1, test3[i].s2); + printf ("pat='%s' cmp='%s' rc=%d\n", + test3[i].s1, test3[i].s2, rc); + } +} + diff --git a/lib/ds/strings/stt_0020.c b/lib/ds/strings/stt_0020.c new file mode 100644 index 0000000000000000000000000000000000000000..4f3e136902858cc30705c17a5f326e73e29a7c37 --- /dev/null +++ b/lib/ds/strings/stt_0020.c @@ -0,0 +1,81 @@ +/* + * FILE %ds/strings/stt_0020.c + * + * test split_string module + * + * written: 1993-08-15 + * latest update: 1996-02-25 0:25:06 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +static char *TESTS1 [] = +{ + "a:b:c", + ":b:c", + "a:b:", + "a::c", + "", + ":::::", + ":xx:", + "xx", + "abc::de:f:g::x", + (char *) 0 +} ; + +/* ------------------------------------------------------------------------ */ +static char *TESTS2 [] = +{ + " ", + " xx ", + "xx", + "abc de f g x", + (char *) 0 +} ; + +/* ------------------------------------------------------------------------ */ +#define N_SPLIT 40 +static char *SPLIT [N_SPLIT]; + +static char tmp [1024]; + +/* ------------------------------------------------------------------------ */ +int stt_0020 (char *str, int spl) +{ + int sc; + int i; + int n; + + strcpy (tmp, str); + printf ("tmp=\"%s\"\n", tmp); + printf ("spl='%c'\n", spl); + + sc= split_string (tmp, spl, SPLIT, N_SPLIT); + n= (sc > N_SPLIT) ? N_SPLIT : sc; + printf ("sc=%d n=%d\n", sc, n); + + for (i= 0; i<n; i++) + printf ("[%2d] %s\n", i, SPLIT[i]); + + printf ("--------------------------\n"); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + int i; + char *s; + + argc; argv; + + for (i= 0; (s= TESTS1[i]) != (char *) 0; i++) stt_0020 (s, ':'); + for (i= 0; (s= TESTS2[i]) != (char *) 0; i++) stt_0020 (s, ' '); + + return 0; +} diff --git a/lib/ds/tcl/(dirinf).fm b/lib/ds/tcl/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..060685a0234720512b210c45c69ef2adc90b934a --- /dev/null +++ b/lib/ds/tcl/(dirinf).fm @@ -0,0 +1,34 @@ +# +# FILE %ds/tcl/(dirinf).fm +# +# written: 1996-03-17 +# latest update: 1996-09-28 11:35:07 +# + +# see also: <gg/ggtcl.h> and tcl +(dirinf).fm Contents +make-dos DOS version of Makefile +make-ux Unix version of Makefile + +# TCL registration procedures +tclreg00.c int ggtcl_reg_services (Tcl_interp *interp, service_table) +tclreg01.c int ggtcl_reg_filename_services (Tcl_Interp *interp) +tclreg02.c int ggtcl_reg_hyx_services (Tcl_Interp *interp) + +# TCL command procedures: filename services +tcl_0000.c TEMPLATE +tcl_0001.c int ggtcl_translate_virtual_name (...) +tcl_0002.c int ggtcl_read_virtual_path_table (...) +tcl_0003.c int ggtcl_define_virtual_path (...) +tcl_0004.c int ggtcl_virtual_filename (...) +tcl_0005.c int ggtcl_real_filename (...) +tcl_0006.c int ggtcl_filename_definition (...) +tcl_0007.c int ggtcl_find_virtual_file (...) +tcl_0008.c int ggtcl_set_dirinf (...) +tcl_0009.c int ggtcl_register_dirinf_generator ( +tcl_0010.c int ggtcl_register_url_handler (...) + +# TCL command procedures: hyx services +tcl_0101.c int ggtcl_hyx_set_color_code (...) + + diff --git a/lib/ds/tcl/Makefile b/lib/ds/tcl/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..7b1579bc834c7799e248d4ee5bb8a9cf234e5888 --- /dev/null +++ b/lib/ds/tcl/Makefile @@ -0,0 +1,38 @@ +# +# FILE %ds/tcl/make-ux +# +# written: 1996-03-17 +# latest update: 1999-05-08 9:52:08 +# +# ---------------------------------------------------------------------------- +CC=cc +# OPTS=-I. -I/usr/local/include/tcl8.0 +# OPTS=-I. -I/usr/local/include/tcl8.3 +OPTS=-I. -I/usr/include/tcl8.4 +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + tclreg00.o tclreg01.o tclreg02.o + +LIBOBJS1= \ + tcl_0000.o tcl_0001.o tcl_0002.o tcl_0003.o tcl_0004.o tcl_0005.o \ + tcl_0006.o tcl_0007.o tcl_0008.o tcl_0009.o tcl_0010.o + +LIBOBJS2= \ + tcl_0101.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) $(LIBOBJS1) $(LIBOBJS2) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib diff --git a/lib/ds/tcl/contrib b/lib/ds/tcl/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/tcl/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/tcl/gg b/lib/ds/tcl/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/tcl/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/tcl/lib b/lib/ds/tcl/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/tcl/libgg.a b/lib/ds/tcl/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/tcl/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/tcl/make-dos b/lib/ds/tcl/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..735e4322589e09394fc1679ca4ee308b2de50bf2 --- /dev/null +++ b/lib/ds/tcl/make-dos @@ -0,0 +1,31 @@ +# +# FILE %ds/tcl/makefile +# +# TCL command library +# +# written: 1996-03-17 +# latest update: 1996-09-28 11:28:17 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all : all.1 all.2 all.3 + +all.1 : ! + tclreg00.obj tclreg01.obj tclreg02.obj + +all.2 : ! + tcl_0000.obj tcl_0001.obj tcl_0002.obj tcl_0003.obj tcl_0004.obj ! + tcl_0005.obj tcl_0006.obj tcl_0007.obj tcl_0008.obj tcl_0009.obj ! + tcl_0010.obj + +all.3 : ! + tcl_0101.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/tcl/tcl_0000.c b/lib/ds/tcl/tcl_0000.c new file mode 100644 index 0000000000000000000000000000000000000000..3a8be7183326268de60c40b6a960b08ffdec21d4 --- /dev/null +++ b/lib/ds/tcl/tcl_0000.c @@ -0,0 +1,41 @@ +/* + * FILE %ds/tcl/tcl_0000.c + * + * TCL subroutine library + * + * written: 1996-03-17 + * latest update: 1996-03-17 20:22:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <tcl.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +int ggtcl_template ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + int i; + int rc= TCL_OK; + char *arg; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + } + + return rc; +} diff --git a/lib/ds/tcl/tcl_0000.o b/lib/ds/tcl/tcl_0000.o new file mode 100644 index 0000000000000000000000000000000000000000..48cf4ac2c2df37f02ccb68a33cf8e8895f255387 Binary files /dev/null and b/lib/ds/tcl/tcl_0000.o differ diff --git a/lib/ds/tcl/tcl_0001.c b/lib/ds/tcl/tcl_0001.c new file mode 100644 index 0000000000000000000000000000000000000000..e56f6c27caf746953d31a42591b54293f74dae79 --- /dev/null +++ b/lib/ds/tcl/tcl_0001.c @@ -0,0 +1,49 @@ +/* + * FILE %ds/tcl/tcl_0001.c + * + * TCL subroutine library + * + * written: 1996-03-17 + * latest update: 1996-03-17 20:22:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <tcl.h> +#include <gg/filename.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +int ggtcl_translate_virtual_name ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + char *fnm= (char *) 0; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc != 2) + { + interp->result= "wrong number of args"; + return TCL_ERROR; + } + + if ((fnm= translate_logic_filename (argv [1])) == (char *) 0) + { + interp->result= "invalid argument"; + return TCL_ERROR; + } + + Tcl_SetResult (interp, fnm, TCL_DYNAMIC); + + return TCL_OK; +} diff --git a/lib/ds/tcl/tcl_0001.o b/lib/ds/tcl/tcl_0001.o new file mode 100644 index 0000000000000000000000000000000000000000..594d269ea8421266f90f35284a794b0f2a689c1b Binary files /dev/null and b/lib/ds/tcl/tcl_0001.o differ diff --git a/lib/ds/tcl/tcl_0002.c b/lib/ds/tcl/tcl_0002.c new file mode 100644 index 0000000000000000000000000000000000000000..1b1147526dd01fdc6c7a237f23c36d18282e581a --- /dev/null +++ b/lib/ds/tcl/tcl_0002.c @@ -0,0 +1,48 @@ +/* + * FILE %ds/tcl/tcl_0002.c + * + * TCL subroutine library + * + * written: 1996-03-17 + * latest update: 1996-03-17 20:22:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <tcl.h> +#include <gg/filename.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +int ggtcl_read_virtual_path_table ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + struct VIRTUAL_FILENAME *a; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc != 2) + { + interp->result= "wrong number of args"; + return TCL_ERROR; + } + + if ((a= _read_logic_filename_table (argv [1], (char *) 0, 1)) + == (struct VIRTUAL_FILENAME *) 0) + { + interp->result= "invalid argument"; + return TCL_ERROR; + } + + return TCL_OK; +} diff --git a/lib/ds/tcl/tcl_0002.o b/lib/ds/tcl/tcl_0002.o new file mode 100644 index 0000000000000000000000000000000000000000..6997d7bf57bb41f8c7a45e21e00f7320c7d648d0 Binary files /dev/null and b/lib/ds/tcl/tcl_0002.o differ diff --git a/lib/ds/tcl/tcl_0003.c b/lib/ds/tcl/tcl_0003.c new file mode 100644 index 0000000000000000000000000000000000000000..c37e44e81e6e6622f64364f2a1054b33a30a708a --- /dev/null +++ b/lib/ds/tcl/tcl_0003.c @@ -0,0 +1,48 @@ +/* + * FILE %ds/tcl/tcl_0003.c + * + * TCL subroutine library + * + * written: 1996-03-17 + * latest update: 1996-03-17 20:59:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <tcl.h> +#include <gg/filename.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +int ggtcl_define_virtual_path ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + struct VIRTUAL_FILENAME *a; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc != 3) + { + interp->result= "wrong number of args"; + return TCL_ERROR; + } + + if ((a= _define_logic_filename (argv [1], argv [2])) + == (struct VIRTUAL_FILENAME *) 0) + { + interp->result= "invalid argument"; + return TCL_ERROR; + } + + return TCL_OK; +} diff --git a/lib/ds/tcl/tcl_0003.o b/lib/ds/tcl/tcl_0003.o new file mode 100644 index 0000000000000000000000000000000000000000..374fa8834f85cf77bbbebaffb43a2b8455381bf5 Binary files /dev/null and b/lib/ds/tcl/tcl_0003.o differ diff --git a/lib/ds/tcl/tcl_0004.c b/lib/ds/tcl/tcl_0004.c new file mode 100644 index 0000000000000000000000000000000000000000..d248a5038c415b8a80ac3bbd0d6d219e39650267 --- /dev/null +++ b/lib/ds/tcl/tcl_0004.c @@ -0,0 +1,46 @@ +/* + * FILE %ds/tcl/tcl_0004.c + * + * TCL subroutine library + * + * written: 1996-03-17 + * latest update: 1996-03-17 21:04:59 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <tcl.h> +#include <gg/filename.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +int ggtcl_virtual_filename ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +char *argv []) +{ +#define VP_SIZE 1024 + char vp [VP_SIZE]; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc != 2) + { + interp->result= "wrong number of args"; + return TCL_ERROR; + } + + if (find_logic_filename (argv [1], vp, VP_SIZE) != 1) + interp->result= (char *) 0; /* TEST: does that work?? */ + else Tcl_SetResult (interp, vp, TCL_VOLATILE); + + return TCL_OK; +} diff --git a/lib/ds/tcl/tcl_0004.o b/lib/ds/tcl/tcl_0004.o new file mode 100644 index 0000000000000000000000000000000000000000..f9269ff294e3776302eb494fa12c6179173b22a7 Binary files /dev/null and b/lib/ds/tcl/tcl_0004.o differ diff --git a/lib/ds/tcl/tcl_0005.c b/lib/ds/tcl/tcl_0005.c new file mode 100644 index 0000000000000000000000000000000000000000..fd1f2e6b0871970b7f6eb1e98dacae45e3f6eb54 --- /dev/null +++ b/lib/ds/tcl/tcl_0005.c @@ -0,0 +1,50 @@ +/* + * FILE %ds/tcl/tcl_0005.c + * + * TCL subroutine library + * + * written: 1996-03-17 + * latest update: 1996-03-17 21:17:05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <tcl.h> +#include <gg/filename.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +int ggtcl_real_filename ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + char *r_fnm; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc != 2 && argc != 3) + { + interp->result= "wrong number of args"; + return TCL_ERROR; + } + + if ((r_fnm= real_filename (argv [1], (argc == 3) ? argv [2] : (char *) 0)) + == (char *) 0) + { + interp->result= "invalid argument"; + return TCL_ERROR; + } + + Tcl_SetResult (interp, r_fnm, TCL_DYNAMIC); + + return TCL_OK; +} diff --git a/lib/ds/tcl/tcl_0005.o b/lib/ds/tcl/tcl_0005.o new file mode 100644 index 0000000000000000000000000000000000000000..f899004f1dff558b305c482c7a5e7bfe3a7159ee Binary files /dev/null and b/lib/ds/tcl/tcl_0005.o differ diff --git a/lib/ds/tcl/tcl_0006.c b/lib/ds/tcl/tcl_0006.c new file mode 100644 index 0000000000000000000000000000000000000000..98355358922f454cfc38d9d8c92fcb8c1ccd163a --- /dev/null +++ b/lib/ds/tcl/tcl_0006.c @@ -0,0 +1,55 @@ +/* + * FILE %ds/tcl/tcl_0006.c + * + * Tcl subroutine library + * + * written: 1996-03-17 + * latest update: 1996-03-18 13:58:05 + * $Id: tcl_0006.c,v 1.3 2012/08/10 14:44:09 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <tcl.h> +#include <gg/filename.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +int ggtcl_filename_definition ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + char *fnm_elements [2]; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc != 2 && argc != 3) + { + interp->result= "wrong number of args"; + return TCL_ERROR; + } + + if (filename_definition (argv [1], + &fnm_elements [0], + &fnm_elements [1], + (argc == 3) ? argv [2] : (char *) 0) + != 0) + { + interp->result= "invalid argument"; + return TCL_ERROR; + } + + Tcl_SetResult (interp, Tcl_Merge (2, fnm_elements), TCL_DYNAMIC); + + return TCL_OK; +} diff --git a/lib/ds/tcl/tcl_0006.o b/lib/ds/tcl/tcl_0006.o new file mode 100644 index 0000000000000000000000000000000000000000..6d7cccf0476da8f039600fde52ce476d56e7e28f Binary files /dev/null and b/lib/ds/tcl/tcl_0006.o differ diff --git a/lib/ds/tcl/tcl_0007.c b/lib/ds/tcl/tcl_0007.c new file mode 100644 index 0000000000000000000000000000000000000000..d3186062e9749f5493abb116d2557c3bc87d2776 --- /dev/null +++ b/lib/ds/tcl/tcl_0007.c @@ -0,0 +1,54 @@ +/* + * FILE %ds/tcl/tcl_0007.c + * + * TCL subroutine library + * + * written: 1996-03-17 + * latest update: 1996-03-18 13:59:35 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <tcl.h> +#include <gg/filename.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +int ggtcl_find_virtual_file ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + char *fnm_elements [2]; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc != 2 && argc != 3) + { + interp->result= "wrong number of args"; + return TCL_ERROR; + } + + if (find_virtual_file (argv [1], + (argc == 3) ? argv [2] : (char *) 0, + &fnm_elements [0], + &fnm_elements [1]) + != 0) + { + interp->result= "invalid argument"; + return TCL_ERROR; + } + + Tcl_SetResult (interp, Tcl_Merge (2, fnm_elements), TCL_DYNAMIC); + + return TCL_OK; +} diff --git a/lib/ds/tcl/tcl_0007.o b/lib/ds/tcl/tcl_0007.o new file mode 100644 index 0000000000000000000000000000000000000000..27035aea2a6e5c163784541f4f755deec6d4f0c9 Binary files /dev/null and b/lib/ds/tcl/tcl_0007.o differ diff --git a/lib/ds/tcl/tcl_0008.c b/lib/ds/tcl/tcl_0008.c new file mode 100644 index 0000000000000000000000000000000000000000..c95d69ea7675c6c9fde91ea5b699716b0cbabde6 --- /dev/null +++ b/lib/ds/tcl/tcl_0008.c @@ -0,0 +1,46 @@ +/* + * FILE %ds/tcl/tcl_0008.c + * + * TCL subroutine library + * + * written: 1996-03-18 + * latest update: 1996-03-18 8:07:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <tcl.h> +#include <gg/filename.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +int ggtcl_set_dirinf ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +char *argv []) +{ +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc != 2) + { + interp->result= "wrong number of args"; + return TCL_ERROR; + } + + if (fvf_set_dirinf (argv [1]) != 0) + { + interp->result= "invalid argument"; + return TCL_ERROR; + } + + return TCL_OK; +} diff --git a/lib/ds/tcl/tcl_0008.o b/lib/ds/tcl/tcl_0008.o new file mode 100644 index 0000000000000000000000000000000000000000..c5c31c00f901cff763478d5ce770d0297e63109f Binary files /dev/null and b/lib/ds/tcl/tcl_0008.o differ diff --git a/lib/ds/tcl/tcl_0009.c b/lib/ds/tcl/tcl_0009.c new file mode 100644 index 0000000000000000000000000000000000000000..0f1624db1df195202a891b2f728ce53f2ee32540 --- /dev/null +++ b/lib/ds/tcl/tcl_0009.c @@ -0,0 +1,72 @@ +/* + * FILE %ds/tcl/tcl_0009.c + * + * TCL subroutine library + * + * written: 1996-03-18 + * latest update: 1996-03-18 8:07:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <tcl.h> +#include <gg/filename.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +struct XYZ +{ + Tcl_Interp *interp; + char *cmd; +} ; + +/* ------------------------------------------------------------------------ */ +char *ggtcl_dirinf_generator ( +char *dir_path, +void *client_data) +{ + struct XYZ *xyz; + Tcl_Interp *interp; + + if ((xyz= (struct XYZ *) client_data) == (struct XYZ *) 0 + || (interp= xyz->interp) == (Tcl_Interp *) 0 + || xyz->cmd == (char *) 0 + || Tcl_VarEval (interp, xyz->cmd, " ", dir_path, (char *) 0) != TCL_OK + ) return (char *) 0; + + return strdup (interp->result); +} + +/* ------------------------------------------------------------------------ */ +int ggtcl_register_dirinf_generator ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + struct XYZ *xyz; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0 + || argc != 2 + || (xyz= (struct XYZ *) calloc (sizeof (struct XYZ), 1)) + == (struct XYZ *) 0 + ) + return TCL_ERROR; + + xyz->interp= interp; + xyz->cmd= strdup (argv [1]); + + if (fvf_set_dirinf_callback (ggtcl_dirinf_generator, (void *) xyz) != 0) + return TCL_ERROR; + + return TCL_OK; +} diff --git a/lib/ds/tcl/tcl_0009.o b/lib/ds/tcl/tcl_0009.o new file mode 100644 index 0000000000000000000000000000000000000000..62fc8ad15b1ed4a1f8e242b716458f1406a394e3 Binary files /dev/null and b/lib/ds/tcl/tcl_0009.o differ diff --git a/lib/ds/tcl/tcl_0010.c b/lib/ds/tcl/tcl_0010.c new file mode 100644 index 0000000000000000000000000000000000000000..2172977912b31b3ddf8c5f1603deed5f84f4a102 --- /dev/null +++ b/lib/ds/tcl/tcl_0010.c @@ -0,0 +1,107 @@ +/* + * FILE %ds/tcl/tcl_0010.c + * + * TCL subroutine library + * url_register_handler schema procedure + * + * written: 1996-03-18 + * latest update: 1996-03-18 21:51:44 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/dpp.h> +#include <tcl.h> +#include <gg/filename.h> +#include <gg/url.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +struct XYZ +{ + Tcl_Interp *interp; + char *cmd; +} ; + +/* ------------------------------------------------------------------------ */ +char *ggtcl_url_fetcher ( +char *url, +void *client_data) +{ + struct XYZ *xyz; + Tcl_Interp *interp; + + if ((xyz= (struct XYZ *) client_data) == (struct XYZ *) 0 + || (interp= xyz->interp) == (Tcl_Interp *) 0 + || xyz->cmd == (char *) 0 + || Tcl_VarEval (interp, xyz->cmd, " ", url, (char *) 0) != TCL_OK + ) return (char *) 0; + + return strdup (interp->result); +} + +/* ------------------------------------------------------------------------ */ +int ggtcl_register_url_handler ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + struct XYZ *xyz; + int args_cnt= 0; +#define NEEDED_ARGS 2 + char *args [NEEDED_ARGS]; + char *arg; + int do_strip= 1; + int type= URL_TYPE_something; + int i; + +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0 + || (xyz= (struct XYZ *) calloc (sizeof (struct XYZ), 1)) + == (struct XYZ *) 0 + ) + return TCL_ERROR; + + for (i= 1; i < argc; i++) + { + arg= argv [i]; + if (arg [0] == '-') + { + if (strcmp ("-nostrip", arg) == 0) do_strip= 0; + if (strncmp ("-t", arg, 2) == 0) + type= (int) get_parameter_value (arg+2); + } + else + { + if (args_cnt < NEEDED_ARGS) + { + args [args_cnt++]= arg; + } + } + } + + if (args_cnt < NEEDED_ARGS) + { + Tcl_SetResult (interp, "invalid args", TCL_STATIC); + return TCL_ERROR; + } + + xyz->interp= interp; + xyz->cmd= strdup (args [1]); + + if (url_register_handler (args [0], type, do_strip, + ggtcl_url_fetcher, (void *) xyz) + == (struct URL_HANDLER *) 0) + return TCL_ERROR; + + return TCL_OK; +} diff --git a/lib/ds/tcl/tcl_0010.o b/lib/ds/tcl/tcl_0010.o new file mode 100644 index 0000000000000000000000000000000000000000..41ad9b29894c9d795577fcd853c88a253ff88085 Binary files /dev/null and b/lib/ds/tcl/tcl_0010.o differ diff --git a/lib/ds/tcl/tcl_0101.c b/lib/ds/tcl/tcl_0101.c new file mode 100644 index 0000000000000000000000000000000000000000..44792629f6c071f3606908f9029e062241c03ccd --- /dev/null +++ b/lib/ds/tcl/tcl_0101.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/tcl/tcl_0101.c + * + * TCL subroutine library + * + * written: 1996-09-28 + * latest update: 1996-11-10 17:17:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <tcl.h> +#include <gg/hyx.h> +#include <gg/dpp.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +int ggtcl_hyx_set_color_code ( +ClientData client_data, +Tcl_Interp *interp, +int argc, +char *argv []) +{ +#ifdef MSDOS + client_data; +#endif /* MSDOS */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if (argc != 3) + { + interp->result= "wrong number of args"; + return TCL_ERROR; + } + + hyx_set_color_code (argv [1], get_parameter_value (argv [2])); + + return TCL_OK; +} diff --git a/lib/ds/tcl/tcl_0101.o b/lib/ds/tcl/tcl_0101.o new file mode 100644 index 0000000000000000000000000000000000000000..5a5d8e36b1a825be12af83962b09e30e7f2d9689 Binary files /dev/null and b/lib/ds/tcl/tcl_0101.o differ diff --git a/lib/ds/tcl/tclreg00.c b/lib/ds/tcl/tclreg00.c new file mode 100644 index 0000000000000000000000000000000000000000..5f859376423672208e04d61222f1018434b0abdc --- /dev/null +++ b/lib/ds/tcl/tclreg00.c @@ -0,0 +1,33 @@ +/* + * FILE %ds/tcl/tclreg00.c + * + * TCL subroutine library + * + * written: 1996-09-28 + * latest update: 1996-09-28 11:30:06 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <tcl.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +int ggtcl_reg_services (Tcl_Interp *interp, struct N2P *service_table) +{ + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + for (;; service_table++) + { + if (service_table->cmd == (char *) 0) break; + + Tcl_CreateCommand (interp, service_table->cmd, service_table->prc, + (ClientData) 0, + (Tcl_CmdDeleteProc *) 0); + } + + return TCL_OK; +} diff --git a/lib/ds/tcl/tclreg00.o b/lib/ds/tcl/tclreg00.o new file mode 100644 index 0000000000000000000000000000000000000000..97f2ebb32a25a3ede490f02c9cbf7c350e4da482 Binary files /dev/null and b/lib/ds/tcl/tclreg00.o differ diff --git a/lib/ds/tcl/tclreg01.c b/lib/ds/tcl/tclreg01.c new file mode 100644 index 0000000000000000000000000000000000000000..e50ea9cde469cb2621d2a12de51ff76e1b68dc53 --- /dev/null +++ b/lib/ds/tcl/tclreg01.c @@ -0,0 +1,40 @@ +/* + * FILE %ds/tcl/tclreg01.c + * + * Tcl subroutine library + * + * written: 1996-03-17 + * latest update: 1996-09-28 11:30:06 + * $Id: tclreg01.c,v 1.2 2012/08/10 14:44:09 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <tcl.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +static N2P_t N2P_list [] = +{ + { "define_virtual_path", (Tcl_CmdProc *) ggtcl_define_virtual_path } , + { "read_virtual_path_table", (Tcl_CmdProc *) ggtcl_read_virtual_path_table } , + { "translate_virtual_name", (Tcl_CmdProc *) ggtcl_translate_virtual_name } , + { "virtual_filename", (Tcl_CmdProc *) ggtcl_virtual_filename } , + { "real_filename", (Tcl_CmdProc *) ggtcl_real_filename } , + { "filename_definition", (Tcl_CmdProc *) ggtcl_filename_definition } , + { "find_virtual_file", (Tcl_CmdProc *) ggtcl_find_virtual_file } , + { "set_dirinf", (Tcl_CmdProc *) ggtcl_set_dirinf } , + { "register_dirinf_generator", (Tcl_CmdProc *) ggtcl_register_dirinf_generator } , + { "register_url_handler", (Tcl_CmdProc *) ggtcl_register_url_handler } , + + { (char *) 0, (Tcl_CmdProc *) 0 } +} ; + +/* ------------------------------------------------------------------------ */ +int ggtcl_reg_filename_services (Tcl_Interp *interp) +{ + return ggtcl_reg_services (interp, N2P_list); +} diff --git a/lib/ds/tcl/tclreg01.o b/lib/ds/tcl/tclreg01.o new file mode 100644 index 0000000000000000000000000000000000000000..a09d3e8c4846313caf28706f18fb383398a78f6a Binary files /dev/null and b/lib/ds/tcl/tclreg01.o differ diff --git a/lib/ds/tcl/tclreg02.c b/lib/ds/tcl/tclreg02.c new file mode 100644 index 0000000000000000000000000000000000000000..24c60b450226c124a93551e23e670717e827fd1c --- /dev/null +++ b/lib/ds/tcl/tclreg02.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/tcl/tclreg02.c + * + * TCL subroutine library + * + * written: 1996-09-28 + * latest update: 1997-12-04 22:16:50 + * $Id: tclreg02.c,v 1.2 2012/08/10 14:44:09 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <tcl.h> +#include <gg/ggtcl.h> + +/* ------------------------------------------------------------------------ */ +static struct N2P N2P_list [] = +{ + { "hyx_set_color_code", (Tcl_CmdProc *) ggtcl_hyx_set_color_code } , + + { (char *) 0, (Tcl_CmdProc *) 0 } +} ; + +/* ------------------------------------------------------------------------ */ +int ggtcl_reg_hyx_services (Tcl_Interp *interp) +{ + return ggtcl_reg_services (interp, N2P_list); +} diff --git a/lib/ds/tcl/tclreg02.o b/lib/ds/tcl/tclreg02.o new file mode 100644 index 0000000000000000000000000000000000000000..3bac49f982c71674df8fa55d02de61632a26a0fd Binary files /dev/null and b/lib/ds/tcl/tclreg02.o differ diff --git a/lib/ds/tfb/(dirinf).fm b/lib/ds/tfb/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..a131b22d6395fa8325b862143f6f15c537c3aab8 --- /dev/null +++ b/lib/ds/tfb/(dirinf).fm @@ -0,0 +1,34 @@ +# +# FILE %ds/tfb/(dirinf).fm +# +# written: 1995-11-11 +# latest update: 1995-12-29 +# $Id: (dirinf).fm,v 1.3 2001/12/19 08:07:43 gonter Exp $ +# +# ---------------------------------------------------------------------------- + +# see also: <gg/tfb.h> and tfb +(dirinf).fm Contents +Makefile current Makefile version +makefile DOS version of Makefile +make-ux Unix version of Makefile + +# library functions +tfblut01.c | create a LUT index for a TFB file; worker routine +tfb01.c | int tfb_get_entry (char *keyword, char *file_tfb, ...) +tfb02.c | int tfb_get_2entry (char *keyword, char *file_tfb, ...) +tfb03.c | struct TFB_HANDLE *tfb_create_handle (char *tfb_file, ...) +tfb04.c | int tfb_transfer_entry (...) +tfb05.c | int tfb_close_handle (struct TFB_HANDLE *h) +tfb06.c | int tfb_get_tag_entry (...) +tfb07.c | int tfb_fetch_entry (...) +tfb08.c | int tfb_fetch_entry2 (...) + +# main programs +tfblut.c | create a LUT index for a TFB file; main module +tfbget.c | get an entry from a TFB file by looking up the LUT file + +# special applications +plz2tfb.c | deutsche Postleitzahlen in TFB Format konvertieren +dbf2tfb.c | DBF (??) File in TFB konvertieren +d3164.c | repack a DBF 3164 File (whatever that is) diff --git a/lib/ds/tfb/.cvsignore b/lib/ds/tfb/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..4499d4ea08c96b67a29367494e2633bc50e01cc4 --- /dev/null +++ b/lib/ds/tfb/.cvsignore @@ -0,0 +1,2 @@ +tfbget +tfblut diff --git a/lib/ds/tfb/Makefile b/lib/ds/tfb/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..067bf32358c096d3d018af6410621152f519b904 --- /dev/null +++ b/lib/ds/tfb/Makefile @@ -0,0 +1,35 @@ +# +# FILE %ds/tfb/make-ux +# +# written: 1995-03-19 +# latest update: 1999-05-08 9:52:23 +# $Id: Makefile,v 1.5 2005/09/04 09:24:40 gonter Exp $ +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I../../include -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow + +# ---------------------------------------------------------------------------- +LIB=../../libgg.a +BINS= +all: lib +all.bin: $(BINS) + echo "no binaries here" + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o $(BINS) + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + tfb01.o tfb02.o tfb03.o tfb04.o tfb05.o tfb06.o tfb07.o tfb08.o \ + tfblut01.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $(LIBOBJS0) + touch lib + +.c.o: + $(CC) $(OPTS) -c $? diff --git a/lib/ds/tfb/contrib b/lib/ds/tfb/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/tfb/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/tfb/d3164.c b/lib/ds/tfb/d3164.c new file mode 100644 index 0000000000000000000000000000000000000000..4e09e6b7ededff3ddc7e1dbf1ee7ee187457093b --- /dev/null +++ b/lib/ds/tfb/d3164.c @@ -0,0 +1,60 @@ +/* + * FILE %ds/tfb/d3164.c + * + * written: 1994-08-20 + * latest update: 1995-11-11 + * + */ + +#include <stdio.h> + +#pragma pack(1) + +/* ------------------------------------------------------------------------ */ +#define FLD1_MAX 29 +#define FLD2_MAX 30 +struct DBF_D3164 +{ + char rec_num; + char nul1; + char fld1_size; + char fld1 [FLD1_MAX]; + char nul2; + char fld2_size; + char fld2 [FLD2_MAX]; +} ; + +/* ------------------------------------------------------------------------ */ +int xout (FILE *fo, char *b, int siz) +{ + while (siz-- > 0) fputc (*b++, fo); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int convert_d3164 (FILE *fi, FILE *fo, int fld_sep, char *fn) +{ + struct DBF_D3164 dbf; + int rc; + + for (;;) + { + rc= fread ((char *) &dbf, sizeof (struct DBF_D3164), 1, fi); + /* printf ("rc=%d %d\n", rc, dbf.rec_num); */ + if (rc < 1) break; + fprintf (fo, "%s%c%d%c", + fn, + fld_sep, + dbf.rec_num, + fld_sep); + + xout (fo, dbf.fld1, dbf.fld1_size); + fputc (fld_sep, fo); + + xout (fo, dbf.fld2, dbf.fld2_size); + fputc ('\n', fo); + } + return 0; +} + + diff --git a/lib/ds/tfb/dbf2tfb.c b/lib/ds/tfb/dbf2tfb.c new file mode 100644 index 0000000000000000000000000000000000000000..c13d03d3edff16e823aea961e788900ac11ac292 --- /dev/null +++ b/lib/ds/tfb/dbf2tfb.c @@ -0,0 +1,173 @@ +/* + * FILE ~/usr/inc/XXXX.c + * + * template, standard command interpreter style + * + * written: 1992 02 19 + * latest update: 1994-08-13 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/filename.h> + +#define STDHLP stderr +#ifdef MSDOS +#define ARG_C_max 24 +#else +#define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c= 0; + +/* Quick Hack: ------------------------------------------------------------ */ +#ifdef MSDOS +#define SUBDIRS /* Rekursive Suche durch das */ + /* Filesystem moeglich */ +#define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ +#else +#define wcrd_wildcards main_fnc +#endif + +/* ------------------------------------------------------------------------ */ +static char filenm [66]; +static int verbose_mode= 0; + +/* ------------------------------------------------------------------------ */ +#define GPL +static char *HELP []= +{ + "USAGE: XXXX [options] {file name}\n", + "OPTIONS:\n", + " -f<fnm> ... list of files\n", +#ifdef SUBDIRS + " -s -r ... subdirs\n", +#endif + " -v ... verbose mode\n", + "EXAMPLES: \n", + "\n", + "(@)AXXXX.c 0.01 #D$1994-06-04 16:10:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= argv [i]; + break; + +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': +#endif + case 'v': case 'V': + for (j= 1; argv [i][j]; j++) + switch (argv [i][j]) + { +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': + wcrd_set_subdirs (1); + break; +#endif + case 'v': case 'V': + verbose_mode++; + break; + default: + fprintf (stderr, "unknown option %c\n", argv[i][j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= argv [i]; + + if (arg_c) + { + for (i= 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if ((fi2= fopen (& arg_v [i][2], "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", &arg_v [i][2]); + break; + } + for (;;) + { + fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (filenm) == -1) + { + fclose (fi2); + goto STOP; + } +#else + wcrd_wildcards (filenm); +#endif + } + fclose (fi2); + } + else + { +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (arg_v [i]) == -1) goto STOP; +#else + wcrd_wildcards (arg_v [i]); +#endif + } + } + else + { +#ifdef SUBDIRS + wcrd_wildcards_or_rec ("*.*"); +#else + main_fnc ("Default.fil"); +#endif + } + +STOP: + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn) +{ + FILE *fi; + int ch; + + if ((fi= fopen (fn, "rb")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", fn); + return -2; + } + + to_lower (fn); + convert_d3164 (fi, stdout, ':', fn); + fclose (fi); + + return 0; +} diff --git a/lib/ds/tfb/gg b/lib/ds/tfb/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/tfb/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/tfb/lib b/lib/ds/tfb/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/tfb/libgg.a b/lib/ds/tfb/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/tfb/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/tfb/make-dos b/lib/ds/tfb/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..83fc4143433056389abbe8eff88798066ac5cd00 --- /dev/null +++ b/lib/ds/tfb/make-dos @@ -0,0 +1,46 @@ +# +# FILE %ds/tfb/makefile +# +# written: 1993-10-19 +# latest update: 1996-05-24 16:34:28 +# +# ============================================================================ +cml=cl -AL /W3 /c +cms=cl -AS /W3 /c +ccl=cl -AL /W3 +ccs=cl -AS /W3 +obj=objdec -w -d -m0 +bin=c:\bin\ +lib=c:\usr\sbr\lsbr +nomap=\dev\nul + +# ---------------------------------------------------------------------------- +all.exe : all.lib $(bin)tfblut.exe $(bin)tfbget.exe +all2.exe : plz2tfb.exe dbf2tfb.exe + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $*.c + $(obj) $*.obj + +# ---------------------------------------------------------------------------- +all.lib : ! + tfblut01.obj ! + tfb01.obj tfb02.obj tfb03.obj tfb04.obj tfb05.obj tfb06.obj ! + d3164.obj + +# ---------------------------------------------------------------------------- +$(bin)tfblut.exe : tfblut.obj tfblut01.obj + link tfblut tfblut01,$@,$(nomap),$(lib); + +# ---------------------------------------------------------------------------- +$(bin)tfbget.exe : tfbget.obj + link tfbget,$@,$(nomap),$(lib); + +# ---------------------------------------------------------------------------- +plz2tfb.exe : plz2tfb.obj + link plz2tfb,$@,$(nomap),$(lib); + +# ---------------------------------------------------------------------------- +dbf2tfb.exe : dbf2tfb.obj d3164.obj + link dbf2tfb d3164,$@,$(nomap),$(lib); diff --git a/lib/ds/tfb/plz2tfb.c b/lib/ds/tfb/plz2tfb.c new file mode 100644 index 0000000000000000000000000000000000000000..e2dabc547fc4af278f775380c7b5fb661c486109 --- /dev/null +++ b/lib/ds/tfb/plz2tfb.c @@ -0,0 +1,90 @@ +/* + * FILE ~/usr/ds/tfb/plz2tfb.c + * + * written: 1993-11-20 + * latest update: 1993-11-20 + * + */ + +#include <stdio.h> + +#ifndef MSDOS +#ifndef cdecl +#define cdecl +#endif +#endif + +/* ------------------------------------------------------------------------ */ +#define HEADER_OFFSET 0x00C2 +#define RECORD_SIZE 53 +static char RECORD [1024]; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv[]); +int cdecl plz2tfb (char *fni, FILE *fo); +int cdecl xtrans (FILE *fo, char *ch, int siz); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + int i; + + for (i= 1; i<argc; i++) plz2tfb (argv[i], stdout); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int plz2tfb (char *fni, FILE *fo) +{ + FILE *fi; + int rc; + + if ((fi= fopen (fni, "rb")) == (FILE *) 0) + { + fprintf (stderr, "plz2tfb: can't open file %s\n", fni); + return -1; + } + + rc= fseek (fi, (long) HEADER_OFFSET, 0); + for (;;) + { + fread (RECORD, RECORD_SIZE, 1, fi); + if (feof (fi) && rc <= 0) break; + xtrans (fo, RECORD+30, 4); + fputc (':', fo); + xtrans (fo, RECORD+34, 5); + fputc (':', fo); + xtrans (fo, RECORD+39, 5); + fputc (':', fo); + xtrans (fo, RECORD+43, 8); + fputc (':', fo); + xtrans (fo, RECORD, 30); + fputc ('\n', fo); + } + fclose (fi); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int xtrans (FILE *fo, char *str, int siz) +{ + int blanks= 0; + int ch; + + while (siz-- > 0) + { + ch= (int) *str++; + if (ch == ' ') + { + blanks++; + } + else + { + for (; blanks>0; blanks--) fputc (' ', fo); + fputc (ch, fo); + } + } + return 0; +} diff --git a/lib/ds/tfb/tfb01.c b/lib/ds/tfb/tfb01.c new file mode 100644 index 0000000000000000000000000000000000000000..3e8ddbbc91f6689f41e10cd365b1149c85a2eafc --- /dev/null +++ b/lib/ds/tfb/tfb01.c @@ -0,0 +1,55 @@ +/* + * FILE %ds/tfb/tfb01.c + * + * written: 1994-04-10 + * latest update: 2001-12-08 21:51:42 + * $Id: tfb01.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/sbr.h> +#include <gg/tfb.h> +#include <gg/diagnose.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int tfb_get_entry ( +const char *keyword, +const char *file_tfb, +const char *file_lut, +char *line_buffer, +int MAX_LINE_BUFFER) +{ + FILE *fi; + long pos; + int rc; + int lng; + + if ((fi= fopen (file_lut, "rb")) == (FILE *) 0) + { + gg_diagnose= TFB_ge_no_lut; + return -1; + } + + rc= lookup_file (fi, keyword, &pos, &lng); + fclose (fi); + if (!(rc & LOOKUP_found)) return 0; + + if ((fi= fopen (file_tfb, "rb")) == (FILE *) 0) + { + gg_diagnose= TFB_ge_no_tfb; + return -1; + } + + fseek (fi, pos-1L, 0); + rc= fread_line (fi, line_buffer, MAX_LINE_BUFFER); + fclose (fi); + if (rc <= 0) + { + gg_diagnose= TFB_ge_tfb_bad; + return -1; + } + + return 1; +} diff --git a/lib/ds/tfb/tfb01.o b/lib/ds/tfb/tfb01.o new file mode 100644 index 0000000000000000000000000000000000000000..9115b28be5ff3d79ce427c67ad11712e94bf54fe Binary files /dev/null and b/lib/ds/tfb/tfb01.o differ diff --git a/lib/ds/tfb/tfb02.c b/lib/ds/tfb/tfb02.c new file mode 100644 index 0000000000000000000000000000000000000000..b716141756b1fd62d12102a00befe26007844885 --- /dev/null +++ b/lib/ds/tfb/tfb02.c @@ -0,0 +1,55 @@ +/* + * FILE %ds/tfb/tfb02.c + * + * written: 1994-05-10 + * latest update: 1995-11-11 + * $Id: tfb02.c,v 1.2 2001/12/19 08:07:45 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/sbr.h> +#include <gg/tfb.h> +#include <gg/diagnose.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int tfb_get_2entry ( +char *keyword, +char *file_tfb, +char *lut_buffer, +char *line_buffer, +int MAX_LINE_BUFFER) +{ + FILE *fi; + long pos; + int rc; + int lng; + + if (lut_buffer == (char *) 0) + { + gg_diagnose= TFB_ge_no_lut; + return -1; + } + + rc= lookup_char (lut_buffer, keyword, &pos, &lng); + fclose (fi); + if (!(rc & LOOKUP_found)) return 0; + + if ((fi= fopen (file_tfb, "rb")) == (FILE *) 0) + { + gg_diagnose= TFB_ge_no_tfb; + return -1; + } + + fseek (fi, pos-1L, 0); + rc= fread_line (fi, line_buffer, MAX_LINE_BUFFER); + fclose (fi); + if (rc <= 0) + { + gg_diagnose= TFB_ge_tfb_bad; + return -1; + } + + return 1; +} diff --git a/lib/ds/tfb/tfb02.o b/lib/ds/tfb/tfb02.o new file mode 100644 index 0000000000000000000000000000000000000000..3b081ebf7d1ac410f03c7c5e37877f97efeacee8 Binary files /dev/null and b/lib/ds/tfb/tfb02.o differ diff --git a/lib/ds/tfb/tfb03.c b/lib/ds/tfb/tfb03.c new file mode 100644 index 0000000000000000000000000000000000000000..d66525e7e94e08b058c85caef1b1772b958c292f --- /dev/null +++ b/lib/ds/tfb/tfb03.c @@ -0,0 +1,40 @@ +/* + * FILE %ds/tfb/tfb03.c + * + * written: 1996-03-20 + * latest update: 1996-05-24 16:33:54 + * $Id: tfb03.c,v 1.3 2001/12/19 08:07:45 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/filename.h> +#include <gg/tfb.h> + +/* ------------------------------------------------------------------------ */ +struct TFB_HANDLE *tfb_create_handle (char *fn_tfb, char *fn_lut) +{ + struct TFB_HANDLE *h; + + if (fn_tfb == (char *) 0 + || *fn_tfb == 0 + || (h= (struct TFB_HANDLE *) calloc (sizeof (struct TFB_HANDLE), 1)) + == (struct TFB_HANDLE *) 0 + ) + return (struct TFB_HANDLE *) 0; + + h->TFBH_tfb_name= strdup (fn_tfb); + h->TFBH_lut_name= (fn_lut == (char *) 0 || *fn_lut == 0) + ? fnmcpy2 (fn_tfb, ".lut") + : strdup (fn_lut); + + return h; +} + +/* ------------------------------------------------------------------------ */ +TFB_HANDLE *new_TFB_HANDLE (char *fn_tfb, char *fn_lut) +{ + return tfb_create_handle (fn_tfb, fn_lut); +} diff --git a/lib/ds/tfb/tfb03.o b/lib/ds/tfb/tfb03.o new file mode 100644 index 0000000000000000000000000000000000000000..be0d5a155f7a9263fdf5da2bdb1a8968597d2a1f Binary files /dev/null and b/lib/ds/tfb/tfb03.o differ diff --git a/lib/ds/tfb/tfb04.c b/lib/ds/tfb/tfb04.c new file mode 100644 index 0000000000000000000000000000000000000000..c1b9de1158a04c3b511e66e483ff0e4b7c11e326 --- /dev/null +++ b/lib/ds/tfb/tfb04.c @@ -0,0 +1,56 @@ +/* + * FILE %ds/tfb/tfb04.c + * + * written: 1996-03-20 + * latest update: 1996-05-24 16:33:21 + * $Id: tfb04.c,v 1.4 2005/03/11 22:25:08 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/lookup.h> +#include <gg/filename.h> +#include <gg/sbr.h> +#include <gg/tfb.h> + +/* ------------------------------------------------------------------------ */ +int tfb_transfer_entry ( +FILE *fo, +struct TFB_HANDLE *handle, +char *key) +{ + FILE *lut; + FILE *tfb; + long w_info; + int lng; + int rc; + + if ((lut= handle->TFBH_lut) == (FILE *) 0) + lut= handle->TFBH_lut= fopen (handle->TFBH_lut_name, "rb"); + if (lut == (FILE *) 0) return -1; + + if (key[0] == 0) goto NO_MATCH; + + fseek (lut, (long) 0, 0); + + rc= lookup_file (lut, key, &w_info, &lng); + + if (rc & LOOKUP_found) + { /* matching entry was found */ + if ((tfb= handle->TFBH_tfb) == (FILE *) 0) + tfb= handle->TFBH_tfb= fopen (handle->TFBH_tfb_name, "rb"); + if (tfb == (FILE *) 0) return -1; + + fseek (tfb, (long) w_info-1, 0); + ftransfer_line (tfb, fo, 100000L); + } + else + { /* no matching entry was found: print an empty line */ +NO_MATCH: + fputc ('\n', fo); + } + + return 0; +} diff --git a/lib/ds/tfb/tfb04.o b/lib/ds/tfb/tfb04.o new file mode 100644 index 0000000000000000000000000000000000000000..7bfab3630211e5ba84e65ff83c0be3822d319270 Binary files /dev/null and b/lib/ds/tfb/tfb04.o differ diff --git a/lib/ds/tfb/tfb05.c b/lib/ds/tfb/tfb05.c new file mode 100644 index 0000000000000000000000000000000000000000..ddd62095fa6dd194d6e661f9f7ba73246e9287ed --- /dev/null +++ b/lib/ds/tfb/tfb05.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/tfb/tfb05.c + * + * written: 1996-03-20 + * latest update: 1996-05-24 16:33:37 + * $Id: tfb05.c,v 1.3 2001/12/19 08:07:45 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <gg/strings.h> +#include <gg/fileio.h> +#include <gg/tfb.h> + +/* ------------------------------------------------------------------------ */ +int tfb_close_handle (struct TFB_HANDLE *h) +{ + if (h == (struct TFB_HANDLE *) 0) return -1; + + fclose_or_what (h->TFBH_tfb); + fclose_or_what (h->TFBH_lut); + free_or_what (h->TFBH_tfb_name); + free_or_what (h->TFBH_lut_name); + free_or_what (h->TFBH_buffer); + free (h); + + return 0; +} diff --git a/lib/ds/tfb/tfb05.o b/lib/ds/tfb/tfb05.o new file mode 100644 index 0000000000000000000000000000000000000000..13ff14aec427e87759be46a77585c4d54bea1929 Binary files /dev/null and b/lib/ds/tfb/tfb05.o differ diff --git a/lib/ds/tfb/tfb06.c b/lib/ds/tfb/tfb06.c new file mode 100644 index 0000000000000000000000000000000000000000..1b7918434a9b08268fa946e2bb5c9c15a902b05a --- /dev/null +++ b/lib/ds/tfb/tfb06.c @@ -0,0 +1,101 @@ +/* + * FILE %ds/tfb/tfb06.c + * + * written: 1996-05-24 + * latest update: 1997-08-28 13:29:11 + * $Id: tfb06.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/strings.h> +#include <gg/sbr.h> +#include <gg/tfb.h> +#include <gg/diagnose.h> +#include <gg/lookup.h> + +/* ------------------------------------------------------------------------ */ +int tfb_get_tag_entry ( +const char *keyword, +const char *file_tfb, +const char *file_lut, +char *line_buffer, +char **field_fnm, +char **field_location, +int MAX_LINE_BUFFER, +int kw_lng) /* significant length of keyword */ +{ + FILE *fi; + long pos= -1; + int rc; + int sc; + int lng; + struct stat st_tfb; + struct stat st_lut; + char *fields [3]; + + if (stat (file_tfb, &st_tfb) != 0 + || field_fnm == (char **) 0 + || field_location == (char **) 0 + ) return -1; + + if (stat (file_lut, &st_lut) == 0 + && st_lut.st_mtime >= st_tfb.st_mtime + && (fi= fopen (file_lut, "rb")) != (FILE *) 0 + ) + { + rc= lookup_file (fi, keyword, &pos, &lng); + fclose (fi); + if (!(rc & LOOKUP_found)) pos= -1; + } + + if ((fi= fopen (file_tfb, "rb")) == (FILE *) 0) + { + gg_diagnose= TFB_ge_no_tfb; + return -1; + } + + if (pos > 0L) fseek (fi, pos-1L, 0); + for (;;) + { + rc= fread_line (fi, line_buffer, MAX_LINE_BUFFER); + if (rc <= 0 && feof (fi)) + { + rc= -1; + break; + } + + if (line_buffer [0] == '#') continue; + sc= split_string (line_buffer, '\t', fields, 3); + if (sc >= 3 + && ((kw_lng == 0 && strcmp (fields [0], keyword) == 0) + || (kw_lng > 0 && strncmp (fields [0], keyword, kw_lng) == 0) + ) + ) + { + *field_fnm= fields [1]; + *field_location= fields [2]; + rc= 1; + break; + } + + if (pos > 0L) + { + rc= -1; + break; + } + } + + fclose (fi); + + if (rc <= 0) + { + gg_diagnose= TFB_ge_tfb_bad; + return -1; + } + + return 1; +} diff --git a/lib/ds/tfb/tfb06.o b/lib/ds/tfb/tfb06.o new file mode 100644 index 0000000000000000000000000000000000000000..5c341aebc8dc77f15c81296cafdb2a56e6a69897 Binary files /dev/null and b/lib/ds/tfb/tfb06.o differ diff --git a/lib/ds/tfb/tfb07.c b/lib/ds/tfb/tfb07.c new file mode 100644 index 0000000000000000000000000000000000000000..fc5b2831362f7bef4c2e01b852a3f361a380aa69 --- /dev/null +++ b/lib/ds/tfb/tfb07.c @@ -0,0 +1,52 @@ +/* + * FILE %ds/tfb/tfb07.c + * + * written: 2001-12-08 + * latest update: 2001-12-08 21:12:51 + * $Id: tfb07.c,v 1.1 2001/12/31 06:29:30 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/lookup.h> +#include <gg/filename.h> +#include <gg/sbr.h> +#include <gg/tfb.h> + +/* ------------------------------------------------------------------------ */ +int tfb_fetch_entry ( +struct TFB_HANDLE *handle, +char *key, +char *buffer, +int buffer_size) +{ + FILE *lut; + FILE *tfb; + long w_info; + int lng; + int rc; + + if (buffer == (char *) 0) return -1; + if ((lut= handle->TFBH_lut) == (FILE *) 0) + lut= handle->TFBH_lut= fopen (handle->TFBH_lut_name, "rb"); + if (lut == (FILE *) 0) return -1; + + fseek (lut, (long) 0, 0); + + rc= lookup_file (lut, key, &w_info, &lng); + + if (rc & LOOKUP_found) + { /* matching entry was found */ + if ((tfb= handle->TFBH_tfb) == (FILE *) 0) + tfb= handle->TFBH_tfb= fopen (handle->TFBH_tfb_name, "rb"); + if (tfb == (FILE *) 0) return -1; + + fseek (tfb, (long) w_info-1, 0); + rc= fread_line (tfb, buffer, buffer_size); + return rc; + } + + return -1; +} diff --git a/lib/ds/tfb/tfb07.o b/lib/ds/tfb/tfb07.o new file mode 100644 index 0000000000000000000000000000000000000000..dbbb182bf22d324157a9b5098792de6ad890c1ab Binary files /dev/null and b/lib/ds/tfb/tfb07.o differ diff --git a/lib/ds/tfb/tfb08.c b/lib/ds/tfb/tfb08.c new file mode 100644 index 0000000000000000000000000000000000000000..233a26d3c0f6a7b8d0f4d50ec9a7270017c7f6f8 --- /dev/null +++ b/lib/ds/tfb/tfb08.c @@ -0,0 +1,40 @@ +/* + * FILE %ds/tfb/tfb08.c + * + * written: 2001-12-08 + * latest update: 2001-12-08 21:12:51 + * $Id: tfb08.c,v 1.1 2001/12/31 06:29:30 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/lookup.h> +#include <gg/filename.h> +#include <gg/sbr.h> +#include <gg/tfb.h> + +/* ------------------------------------------------------------------------ */ +char *tfb_fetch_entry2 ( +TFB_HANDLE *handle, +char *key) +{ + char *buffer; + int rv; + + if (handle == (TFB_HANDLE *) 0) return (char *) 0; + + if ((buffer= handle->TFBH_buffer) == (char *) 0) + { + if ((buffer= malloc (TFB_default_buffer_size)) == (char *) 0) + return (char *) 0; + + handle->TFBH_buffer= buffer; + handle->TFBH_buffer_size= TFB_default_buffer_size; + } + + rv= tfb_fetch_entry (handle, key, buffer, handle->TFBH_buffer_size); + if (rv > 0) return strdup (buffer); + return (char *) 0; +} diff --git a/lib/ds/tfb/tfb08.o b/lib/ds/tfb/tfb08.o new file mode 100644 index 0000000000000000000000000000000000000000..28b4050b352f34dca55da71b46cc9d818e52e565 Binary files /dev/null and b/lib/ds/tfb/tfb08.o differ diff --git a/lib/ds/tfb/tfblut01.c b/lib/ds/tfb/tfblut01.c new file mode 100644 index 0000000000000000000000000000000000000000..331c8bc685bc879a27726f2c0fe71ee731e09912 --- /dev/null +++ b/lib/ds/tfb/tfblut01.c @@ -0,0 +1,233 @@ +/* + * FILE %ds/tfb/tfblut01.c + * + * generate lut_file for a tfb file + * + * written: 1993-10-19 + * latest update: 1997-10-06 13:23:03 + * $Id: tfblut01.c,v 1.3 2002/07/17 07:04:35 gonter Exp $ + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/tfb.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +#define MAX_LINE 4096 +#define MAX_FIELDS 1024 + +static char line [MAX_LINE]; +static char *fields [MAX_FIELDS]; + +static struct YTREE *ytree= (struct YTREE *) 0; +extern long YTREE_ALLOCATED; +extern long YTREE_ALLOC_SIZE; +extern long YTREE_truncated; + +/* ------------------------------------------------------------------------ */ +int tfb_make_lut_file ( +char *tfb_file, +char *lut_file, +int field_number, +int field_delimiter, +int open_quote, +int close_quote, +int escape_char, +int ambigous_key, +int modification, +int truncation, +int verbosity, +int use_pos) /* field number to be used instead of pos */ +{ + FILE *fi; + int rc; + int fc; + long line_number= 0; + long cnt_used= 0L; + long cnt_unique; + long cnt_bytes; + struct YTREE *yt; + char *indexed_field= (char *) 0; +#define MAX_REC_ID 24 + char REC_ID [MAX_REC_ID]; + long pos; + long rec_id_code; + int rec_id_fmt; + char *rec_id_fmt_str; + int i; + int j; + + if ((fi= fopen (tfb_file, "rb")) == (FILE *) 0) + { + fprintf (stderr, "tfb_make_lut_file: couldn't open %s\n", tfb_file); + return -1; + } + + fseek (fi, 0L, 0); + for (;;) + { + pos= ftell (fi); + rc= fread_line (fi, line, MAX_LINE); + if (rc <= 0 && feof (fi)) break; + line_number++; + if (line [0] == '#') continue; + + if (field_number < 0) + { + switch (field_number) + { + default: + rec_id_code= line_number; + rec_id_fmt= 0; + break; + + case -2: + rec_id_code= line_number; + rec_id_fmt= 1; + break; + + case -3: + rec_id_code= line_number; + rec_id_fmt= 3; + break; + + case -4: + rec_id_code= line_number; + rec_id_fmt= 4; + break; + + case -5: + rec_id_code= pos; + rec_id_fmt= 0; + break; + + case -6: + rec_id_code= pos; + rec_id_fmt= 1; + break; + + case -7: + rec_id_code= pos; + rec_id_fmt= 3; + break; + + case -8: + rec_id_code= pos; + rec_id_fmt= 4; + break; + + } + + switch (rec_id_fmt) + { + default: rec_id_fmt_str= "%ld"; break; + case 1: rec_id_fmt_str= "%08ld"; break; + case 2: rec_id_fmt_str= "%lX"; break; + case 3: rec_id_fmt_str= "%08lX"; break; + } + sprintf (REC_ID, rec_id_fmt_str, rec_id_code); + goto INSERT; + } + + fc= str2fld (line, fields, MAX_FIELDS, + field_delimiter, open_quote, close_quote, escape_char); + + switch (verbosity) + { + case 2: + printf ("%d fields identified:\n", fc); + if ((j= fc) > MAX_FIELDS) j= MAX_FIELDS; + for (i= 0; i < j; i++) printf ("[%d] '%s'\n", i, fields [i]); + break; + } + + if (use_pos >= 0 + && use_pos < fc + && (indexed_field= fields [use_pos]) != (char *) 0 + && *indexed_field != 0 + ) + { + pos= get_parameter_value (indexed_field); +/**** printf ("modified pos=%ld\n", pos); ****/ + } + else { pos++; } + + if (field_number >= 0 + && field_number < fc + && (indexed_field= fields [field_number]) != (char *) 0 + && *indexed_field != 0 + ) + { + switch (modification) + { + case MK_tolower: to_lower (indexed_field); break; + case MK_toupper: to_upper (indexed_field); break; + } + + if (truncation > 0 && strlen (indexed_field) > truncation) + indexed_field [truncation]= 0; + +INSERT: + /* printf ("indexed_field= %s\n", indexed_field); */ + if ((yt= ytree_insert_word (&ytree, + (unsigned char *) indexed_field)) + == (struct YTREE *) 0) + { + fprintf (stderr, + "tfb_make_lut_file: %s(%ld) can't insert '%s'\n", + tfb_file, line_number, indexed_field); + fprintf (stderr, + "%ld ytree nodes; %ld bytes total size; %ld wasted\n", + YTREE_ALLOCATED, YTREE_ALLOC_SIZE, YTREE_truncated); + + goto DONE; + } + else + { + if (yt->YT_flags & YTflag_EOW) + { + if (verbosity == 2) printf ("already present\n"); + if (ambigous_key & AK_complain) + printf ("tfb_make_lut_file: %s(%ld) duplicate key '%s'\n", + tfb_file, line_number, indexed_field); + + if (ambigous_key & AK_last) + goto USE; + } + else + { + if (verbosity == 2) printf ("new\n"); + cnt_used++; +USE: + yt->YT_flags |= YTflag_EOW; + yt->YT_info= pos; + } + } + } + } + +DONE: + fclose (fi); + + if ((fi= fopen (lut_file, "wb")) == (FILE *) 0) + { + fprintf (stderr, "tfb_make_lut_file: couldn't open %s\n", lut_file); + return -1; + } + + cnt_bytes= ytree_size (ytree); + cnt_unique= ytree_dump (fi, ytree); + fclose (fi); + + printf ("tfb_make_lut_file: fnm=%s lines=%ld used=%ld unique=%ld\n", + tfb_file, line_number, cnt_used, cnt_unique); + printf ("tfb_make_lut_file: lut=%s bytes=%ld\n", + lut_file, cnt_bytes); + + return 0; +} diff --git a/lib/ds/tfb/tfblut01.o b/lib/ds/tfb/tfblut01.o new file mode 100644 index 0000000000000000000000000000000000000000..b54a24b1bef7378475636195106844bd7e2811e3 Binary files /dev/null and b/lib/ds/tfb/tfblut01.o differ diff --git a/lib/ds/url/(dirinf).fm b/lib/ds/url/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..2ace130f1950fac8102576707647db269148f365 --- /dev/null +++ b/lib/ds/url/(dirinf).fm @@ -0,0 +1,26 @@ +# +# FILE %ds/url/(dirinf).fm +# +# written: 1995-12-12 +# latest update: 1996-11-04 0:00:10 +# + +# see also: <gg/url.h> and url +(dirinf).fm Contents +Makefile current version of Makefile +make-dos DOS version of Makefile +make-ux Unix version of Makefile + +url_0000.c TEMPLATE +url_0001.c url handler stuff... +url_0002.c char *url_fetch (char *url); +url_0003.c write url interface +url_0004.c read url interface +url_0005.c char *url_isolate_schema (char *url, char *schema) +url_0006.c int url_identify_type (char *url) +url_0007.c char *url_fetch_file (char *url, void *cd) +url_0008.c char *url_fetch_mailto (char *url, void *cd) + +url_0009.c ... trash ... + + diff --git a/lib/ds/url/Makefile b/lib/ds/url/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..5460bc3349fc4d57d897c01a5293231f665145be --- /dev/null +++ b/lib/ds/url/Makefile @@ -0,0 +1,30 @@ +# +# FILE %ds/url/make-ux +# +# written: 1995-12-20 +# latest update: 1999-05-08 9:52:49 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + url_0001.o url_0002.o url_0003.o url_0004.o url_0005.o url_0006.o \ + url_0007.o url_0008.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o lib diff --git a/lib/ds/url/contrib b/lib/ds/url/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/url/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/url/gg b/lib/ds/url/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/url/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/url/lib b/lib/ds/url/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/url/libgg.a b/lib/ds/url/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/url/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/url/make-dos b/lib/ds/url/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..ce344e13eb4ffbdad0b0faaae44f32d254b52631 --- /dev/null +++ b/lib/ds/url/make-dos @@ -0,0 +1,22 @@ +# +# FILE %ds/url/make-dos +# +# manipulation of URLs +# +# written: 1995-11-26 +# latest update: 1996-11-04 0:19:51 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : ! + url_0001.obj url_0002.obj url_0003.obj url_0004.obj url_0005.obj ! + url_0006.obj url_0007.obj url_0008.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/url/url_0000.c b/lib/ds/url/url_0000.c new file mode 100644 index 0000000000000000000000000000000000000000..3bff5b92fbd408cd9d92d76ab879071119b15751 --- /dev/null +++ b/lib/ds/url/url_0000.c @@ -0,0 +1,19 @@ +/* + * FILE %ds/url/url_0000.c + * + * variable space management + * + * written: 1995-11-26 + * latest update: 1995-11-26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/url.h> + +/* ------------------------------------------------------------------------ */ + + diff --git a/lib/ds/url/url_0001.c b/lib/ds/url/url_0001.c new file mode 100644 index 0000000000000000000000000000000000000000..7fb2b04199ff87d5f7467d84f85c6cd83158abdd --- /dev/null +++ b/lib/ds/url/url_0001.c @@ -0,0 +1,112 @@ +/* + * FILE %ds/url/url_0001.c + * + * URL handling + * + * written: 1995-11-26 + * latest update: 1996-08-08 17:09:18 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/url.h> + +/* ------------------------------------------------------------------------ */ +static struct URL_HANDLER *url_handlers= (struct URL_HANDLER *) 0; +static struct URL_HANDLER **url_next_handler= &url_handlers; +static struct YTREE *url_schemes= (struct YTREE *) 0; +static int initialized= 0; + +/* ------------------------------------------------------------------------ */ +struct URL_HANDLER *url_get_handler (char *url) +{ + struct URL_HANDLER *rc= (struct URL_HANDLER *) 0; + struct YTREE *yt; + char *schema; + + if (!initialized) url_initialize (); + + if ((schema= url_isolate_schema (url)) != (char *) 0 + && (yt= ytree_lookup_word (url_schemes, (unsigned char *) schema)) + != (struct YTREE *) 0 + && (yt->YT_flags & YTflag_EOW) + ) + rc= (struct URL_HANDLER *) yt->YT_info; + + free_or_what (schema); + + return rc; +} + +/* ------------------------------------------------------------------------ */ +struct URL_HANDLER *url_register_handler ( +char *schema, +int type, +int drop_schema, +URL_Processor *fetcher, +void *cd) +{ + struct URL_HANDLER *url_handler; + struct YTREE *yt; + + if (!initialized) url_initialize (); + + if (schema == (char *) 0 + || *schema == 0 + || (yt= ytree_insert_word (&url_schemes, (unsigned char *) schema)) + == (struct YTREE *) 0 + ) return (struct URL_HANDLER *) 0; + + if (yt->YT_flags & YTflag_EOW) + { /* url handler was already registerd; overwrite ... */ + url_handler= (struct URL_HANDLER *) yt->YT_info; + } + else + { /* url handler is new, create control structure; */ + if ((url_handler= (struct URL_HANDLER *) + calloc (sizeof (struct URL_HANDLER), 1)) + == (struct URL_HANDLER *) 0 + ) return (struct URL_HANDLER *) 0; + + yt->YT_flags |= YTflag_EOW; + yt->YT_info= (long) url_handler; + + url_handler->URL_schema= strdup (schema); + url_handler->URL_schema_length= strlen (schema); + + *url_next_handler= url_handler; + url_next_handler= &url_handler->URL_next; + } + + url_handler->URL_type= type; + url_handler->URL_drop_schema= drop_schema; + url_handler->URL_fetcher= fetcher; + url_handler->URL_client_data= cd; + + return url_handler; +} + +/* ------------------------------------------------------------------------ */ +int url_initialize () +{ + initialized= 1; + + url_register_handler ("file", URL_TYPE_file, 1, + url_fetch_file, (void *) 0); + +#ifdef MSDOS + url_register_handler ("mailto", URL_TYPE_mailto, 1, + url_fetch_mailto, (void *) URL_TYPE_mailto); + url_register_handler ("reply", URL_TYPE_reply, 1, + url_fetch_mailto, (void *) URL_TYPE_reply); +#endif /* MSDOS */ + + return 0; +} diff --git a/lib/ds/url/url_0001.o b/lib/ds/url/url_0001.o new file mode 100644 index 0000000000000000000000000000000000000000..7ad94428909d63bbcf1a5fbc3dbe59c6b4f43c6f Binary files /dev/null and b/lib/ds/url/url_0001.o differ diff --git a/lib/ds/url/url_0002.c b/lib/ds/url/url_0002.c new file mode 100644 index 0000000000000000000000000000000000000000..f96759afc08388510cc182c1c2d6e21efae3c882 --- /dev/null +++ b/lib/ds/url/url_0002.c @@ -0,0 +1,37 @@ +/* + * FILE %ds/url/url_0002.c + * + * URL handling + * + * written: 1995-11-26 + * latest update: 1999-04-25 16:59:21 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/filename.h> +#include <gg/strings.h> +#include <gg/url.h> + +/* ------------------------------------------------------------------------ */ +char *url_fetch (char *url) +{ + struct URL_HANDLER *uh; + URL_Processor *fetch; + + if (url == (char *) 0 + || *url == 0 + || (uh= url_get_handler (url)) == (struct URL_HANDLER *) 0 + || (fetch= uh->URL_fetcher) == (URL_Processor *) 0 + ) return (char *) 0; + + if (uh->URL_drop_schema) url += uh->URL_schema_length + 1; + + return (*fetch) (url, uh->URL_client_data); +} diff --git a/lib/ds/url/url_0002.o b/lib/ds/url/url_0002.o new file mode 100644 index 0000000000000000000000000000000000000000..ea1c125f8f3d204d0c99885a1e3f98ba5601b1ab Binary files /dev/null and b/lib/ds/url/url_0002.o differ diff --git a/lib/ds/url/url_0003.c b/lib/ds/url/url_0003.c new file mode 100644 index 0000000000000000000000000000000000000000..b7244b9115309723f9c90b2707ef66f3fd398487 --- /dev/null +++ b/lib/ds/url/url_0003.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/url/url_0005.c + * + * URL handling + * + * written: 1995-12-25 + * latest update: 1996-03-18 8:05:29 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/url.h> + +/* ------------------------------------------------------------------------ */ +int url_write_object_name (char *url_interface, char *outfile) +{ + FILE *fo; + + if (url_interface == (char *) 0 || *url_interface == 0) return 0; + + if (outfile == (char *) 0 + || *outfile == 0 + || (fo= fopen (url_interface, "w")) == (FILE *) 0 + ) return -1; + + fprintf (fo, "object %s\n", outfile); + fclose (fo); + + return 0; +} diff --git a/lib/ds/url/url_0003.o b/lib/ds/url/url_0003.o new file mode 100644 index 0000000000000000000000000000000000000000..3f70ff1ddf63afcefa1a40eb6e13094ddc88314d Binary files /dev/null and b/lib/ds/url/url_0003.o differ diff --git a/lib/ds/url/url_0004.c b/lib/ds/url/url_0004.c new file mode 100644 index 0000000000000000000000000000000000000000..e1bc96737ae3f38a7b2bae6f93005151e763d276 --- /dev/null +++ b/lib/ds/url/url_0004.c @@ -0,0 +1,68 @@ +/* + * FILE %ds/url/url_0004.c + * + * URL handling + * + * written: 1995-12-25 + * latest update: 1996-03-18 8:05:42 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/sbr.h> +#include <gg/url.h> + +#define TMP_SIZE 1024 +#define MAX_TOKENS 10 + +/* ------------------------------------------------------------------------ */ +char *url_read_object_name ( +char *url_interface, +char *tmp_space, +int tmp_size) +{ + FILE *fi; + int tmp_allocated= 0; + int rc; + int num_tokens; + char *tokens [MAX_TOKENS]; + char *url_file= (char *) 0; + + if ((fi= fopen (url_interface, "r")) == (FILE *) 0) return (char *) 0; + + if (tmp_space == (char *) 0 || tmp_size <= 0) + { + if ((tmp_space= malloc (TMP_SIZE)) == (char *) 0) return (char *) 0; + tmp_size= TMP_SIZE; + tmp_allocated= 1; + } + + for (;;) + { + rc= fread_line (fi, tmp_space, tmp_size); + if (rc <= 0 && feof (fi)) break; + + num_tokens= isolate_tokens (tmp_space, tokens, MAX_TOKENS); + if (num_tokens > MAX_TOKENS) num_tokens= MAX_TOKENS; + + if (num_tokens == 2) + { + if (strcmp ("object", tokens [0]) == 0) + { + url_file= strdup (tokens [1]); + break; + } + } + } + + if (tmp_allocated == -1) free (tmp_space); + + return url_file; +} diff --git a/lib/ds/url/url_0004.o b/lib/ds/url/url_0004.o new file mode 100644 index 0000000000000000000000000000000000000000..f46fb3d4f2c17dd3e6b179b129105ab8e8aa7ad8 Binary files /dev/null and b/lib/ds/url/url_0004.o differ diff --git a/lib/ds/url/url_0005.c b/lib/ds/url/url_0005.c new file mode 100644 index 0000000000000000000000000000000000000000..787c38058a9dedec431955c66773f7c151c25203 --- /dev/null +++ b/lib/ds/url/url_0005.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/url/url_0005.c + * + * isolate url schema + * + * written: 1996-03-17 + * latest update: 1996-04-05 15:02:59 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/url.h> + +/* ------------------------------------------------------------------------ */ +char *url_isolate_schema (char *url) +{ + int i; + int ch; + char *schema; + + if (url == (char *) 0 || *url == 0) return (char *) 0; + + for (i= 0;; i++) + { + if ((ch= url [i] & 0x00FF) == 0) return (char *) 0; + if (ch == ':') break; + } + + if ((schema= malloc (i+1)) == (char *) 0) return (char *) 0; + strncpy (schema, url, i); + schema [i]= 0; + + return schema; +} diff --git a/lib/ds/url/url_0005.o b/lib/ds/url/url_0005.o new file mode 100644 index 0000000000000000000000000000000000000000..e16f8ef28902cef6a9041b5468f49d4eacf766fd Binary files /dev/null and b/lib/ds/url/url_0005.o differ diff --git a/lib/ds/url/url_0006.c b/lib/ds/url/url_0006.c new file mode 100644 index 0000000000000000000000000000000000000000..60b081f8ba1087cb15bce3586f4bf8237f1a3c1e --- /dev/null +++ b/lib/ds/url/url_0006.c @@ -0,0 +1,26 @@ +/* + * FILE %ds/url/url_0006.c + * + * URL handling + * + * written: 1995-11-26 + * latest update: 1996-03-17 23:37:44 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/url.h> + +/* ------------------------------------------------------------------------ */ +int url_identify_type (char *url) +{ + struct URL_HANDLER *url_handler; + + if ((url_handler= url_get_handler (url)) != (struct URL_HANDLER *) 0) + return url_handler->URL_type; + + return URL_TYPE_none; +} diff --git a/lib/ds/url/url_0006.o b/lib/ds/url/url_0006.o new file mode 100644 index 0000000000000000000000000000000000000000..813c5d14e24d550a10a1159112ef55cda17b6f5b Binary files /dev/null and b/lib/ds/url/url_0006.o differ diff --git a/lib/ds/url/url_0007.c b/lib/ds/url/url_0007.c new file mode 100644 index 0000000000000000000000000000000000000000..3b822e6930d3fde8c228cde782ecb202c74feddb --- /dev/null +++ b/lib/ds/url/url_0007.c @@ -0,0 +1,42 @@ +/* + * FILE %ds/url/url_0007.c + * + * URL handling + * + * written: 1995-11-26 + * latest update: 1996-03-18 21:41:42 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/url.h> + +/* ------------------------------------------------------------------------ */ +char *url_fetch_file (char *url, void *cd) +{ + char *dst= (char *) 0; + +#ifdef MSDOS + cd; +#endif /* MSDOS */ + + if (url == (char *) 0) return (char *) 0; + + if (strncmp ("//", url, 2) == 0) + { /* host is contained */ + url += 2; + if (strncmp ("localhost/", url, 10) == 0) + dst= strdup (url+9); /* check for the slash but also return it */ + } + else + { + if (*url == '/') dst= strdup (url); + } + + return dst; +} diff --git a/lib/ds/url/url_0007.o b/lib/ds/url/url_0007.o new file mode 100644 index 0000000000000000000000000000000000000000..8190796427000b4ca9db14f6a15645e434e9cb39 Binary files /dev/null and b/lib/ds/url/url_0007.o differ diff --git a/lib/ds/url/url_0008.c b/lib/ds/url/url_0008.c new file mode 100644 index 0000000000000000000000000000000000000000..e8ca9cc972160c35a8d5f3a963aef0c5fd1ab8cd --- /dev/null +++ b/lib/ds/url/url_0008.c @@ -0,0 +1,54 @@ +/* + * FILE %ds/url/url_0008.c + * + * URL handling + * + * written: 1995-11-26 + * latest update: 1999-04-25 16:59:36 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/url.h> + +static char *URL_INTERFACE= "@@urlint.@@@"; + +#define TMP_SIZE 1024 + +/* ------------------------------------------------------------------------ */ +char *url_fetch_mailto (char *url, void *cd) +{ + char *dst= (char *) 0; + char *tmp; + char *url_interface; + int method; + + if ((tmp= malloc (TMP_SIZE)) == (char *) 0 + || (url_interface= set_tmp_filename ((char *) 0, URL_INTERFACE)) + == (char *) 0 + ) + return (char *) 0; + + method= (int) cd; + + sprintf (tmp, "gmail -z -u%s %s%s", + url_interface, + (method == URL_TYPE_reply) ? "-r" : "", + url); + + system (tmp); + dst= url_read_object_name (url_interface, (char *) 0, -1); + + free_or_what (tmp); + free_or_what (url_interface); + + return dst; +} diff --git a/lib/ds/url/url_0008.o b/lib/ds/url/url_0008.o new file mode 100644 index 0000000000000000000000000000000000000000..a9617867a082afdf827a8a0c7e0f01c612c9d6f9 Binary files /dev/null and b/lib/ds/url/url_0008.o differ diff --git a/lib/ds/url/url_0009.c b/lib/ds/url/url_0009.c new file mode 100644 index 0000000000000000000000000000000000000000..870014f6b23b44c9663ddd256bf0b01f85bd5e42 --- /dev/null +++ b/lib/ds/url/url_0009.c @@ -0,0 +1,55 @@ +/* + * FILE %ds/url/url_0009.c + * + * ... trash... + * URL handling + * + * written: 1996-03-23 + * latest update: 1999-04-25 16:59:44 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/url.h> + +static char *URL_INTERFACE= "@@urlint.@@@"; + +#define TMP_SIZE 1024 + +/* ------------------------------------------------------------------------ */ +char *url_fetch_mailto (char *url, void *cd) +{ + char *dst= (char *) 0; + char *tmp; + char *url_interface; + int method; + + if ((tmp= malloc (TMP_SIZE)) == (char *) 0 + || (url_interface= set_tmp_filename ((char *) 0, URL_INTERFACE)) + == (char *) 0 + ) + return (char *) 0; + + method= (int) cd; + + sprintf (tmp, "gmail -z -u%s %s%s", + url_interface, + (method == URL_TYPE_reply) ? "-r" : "", + url); + + system (tmp); + dst= url_read_object_name (url_interface, (char *) 0, -1); + + free_or_what (tmp); + free_or_what (url_interface); + + return dst; +} diff --git a/lib/ds/varspace/(dirinf).fm b/lib/ds/varspace/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..37c0dec746c3397d0773b32fb1e89e6780082e97 --- /dev/null +++ b/lib/ds/varspace/(dirinf).fm @@ -0,0 +1,25 @@ +# +# FILE %ds/varspace/(dirinf).fm +# +# written: 1994-12-11 +# latest update: 1995-12-29 +# +# ---------------------------------------------------------------------------- + +# see also: <gg/varspace.h> +(dirinf).fm Contents +makefile DOS version of Makefile +make-ux Unix version of Makefile + +varsp001.c struct VAR_SPACE *vs_get_record (...) +varsp002.c struct VAR_SPACE *vs_get (...) +varsp003.c struct VAR_SPACE *vs_set (...) +varsp004.c struct VAR_SPACE *vs_set_array (...) +varsp005.c int vs_assign (struct YTREE **yt_root, char *var_name, ...) +varsp006.c long vs_increment (struct YTREE **yt_root, char *var_name, ...) +varsp007.c int vs_operations (struct YTREE **ytpp, ...) +varsp008.c struct VAR_SPACE *vs_query (struct YTREE *yt_root, ...) + +fehlt: +varsp009.c destroy ytree structure + diff --git a/lib/ds/varspace/Makefile b/lib/ds/varspace/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..9c27154c47c9e18b2ce11de6a25f74d5e436c087 --- /dev/null +++ b/lib/ds/varspace/Makefile @@ -0,0 +1,33 @@ +# +# FILE %ds/varspace/make-ux +# +# written: 1995-03-19 +# latest update: 1999-05-08 9:53:06 +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow + +# ---------------------------------------------------------------------------- +LIB=../../libgg.a + +all: lib + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + varsp001.o varsp002.o varsp003.o varsp004.o varsp005.o varsp006.o \ + varsp007.o varsp008.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $(LIBOBJS0) + touch lib + +.c.o: + $(CC) $(OPTS) -c $? + diff --git a/lib/ds/varspace/contrib b/lib/ds/varspace/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/varspace/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/varspace/gg b/lib/ds/varspace/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/varspace/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/varspace/lib b/lib/ds/varspace/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/varspace/libgg.a b/lib/ds/varspace/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/varspace/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/varspace/make-dos b/lib/ds/varspace/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..076308c2b1f09c499045ba7269af6e8ae0eec874 --- /dev/null +++ b/lib/ds/varspace/make-dos @@ -0,0 +1,27 @@ +# +# FILE %ds/varspace/makefile +# +# manipulation of attribute lists +# +# written: 1994-12-11 +# latest update: 1996-01-01 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all.2 : ! + varsp001.obj varsp002.obj varsp003.obj varsp004.obj ! + varsp005.obj varsp006.obj varsp007.obj varsp008.obj + +# ---------------------------------------------------------------------------- +VS=varsp001.obj varsp005.obj varsp006.obj! + varsp007.obj varsp008.obj +vspt.exe : vspt.obj $(VS) + link vspt $(VS),,,$(lib)/NOE; + +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/varspace/varsp000.c b/lib/ds/varspace/varsp000.c new file mode 100644 index 0000000000000000000000000000000000000000..c24b95b902a55cebeba06a0921e4a4d231d6a5bc --- /dev/null +++ b/lib/ds/varspace/varsp000.c @@ -0,0 +1,20 @@ +/* + * FILE %ds/varspace/varsp000.c + * + * variable space management + * + * written: 1994-12-19 + * latest update: 1995-08-20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/varspace.h> +/* #include <gg/ytree.h> ... included by <gg/varspace.h> */ + +/* ------------------------------------------------------------------------ */ + + diff --git a/lib/ds/varspace/varsp001.c b/lib/ds/varspace/varsp001.c new file mode 100644 index 0000000000000000000000000000000000000000..a876e9c918524837b94f3ea00c16ed979831a07e --- /dev/null +++ b/lib/ds/varspace/varsp001.c @@ -0,0 +1,52 @@ +/* + * FILE %ds/varspace/varsp001.c + * + * variable space management + * + * written: 1994-12-11 + * latest update: 1996-08-08 17:08:28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <gg/varspace.h> + +/* ------------------------------------------------------------------------ */ +struct VAR_SPACE *vs_get_record ( +struct YTREE **yt_root, +char *vsp_name [], +int vsp_cnt) +{ + struct VAR_SPACE *vs= (struct VAR_SPACE *) 0; + struct YTREE *yt; + int vsp_num; + + for (vsp_num= 0; vsp_num < vsp_cnt; vsp_num++) + { + if ((yt= ytree_insert_word (yt_root, (unsigned char *) vsp_name[vsp_num])) + == (struct YTREE *) 0) return (struct VAR_SPACE *) 0; + + if (yt->YT_flags & YTflag_EOW) + { + vs= (struct VAR_SPACE *) yt->YT_info; + } + else + { /* this variable doesn't exist sofar */ + if ((vs= (struct VAR_SPACE *) calloc (sizeof (struct VAR_SPACE), 1)) + == (struct VAR_SPACE *) 0) goto STOP; + + vs->VS_signature= SIG_VS_NODE; + yt->YT_flags |= YTflag_EOW; + yt->YT_info= (long) vs; + } + + yt_root= &(vs->VS_array); + } + +STOP: + return vs; +} diff --git a/lib/ds/varspace/varsp001.o b/lib/ds/varspace/varsp001.o new file mode 100644 index 0000000000000000000000000000000000000000..2c2ef0c7818383e268cef207239798199c19a20f Binary files /dev/null and b/lib/ds/varspace/varsp001.o differ diff --git a/lib/ds/varspace/varsp002.c b/lib/ds/varspace/varsp002.c new file mode 100644 index 0000000000000000000000000000000000000000..d17c15e88b4064b73e4c035193fe38460db05deb --- /dev/null +++ b/lib/ds/varspace/varsp002.c @@ -0,0 +1,40 @@ +/* + * FILE %ds/varspace/varsp002.c + * + * variable space management + * + * written: 1994-12-11 + * latest update: 1996-08-08 17:08:16 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/varspace.h> + +/* ------------------------------------------------------------------------ */ +struct VAR_SPACE *vs_get ( +struct YTREE *yt_root, +char *vsp_name [], +int vsp_cnt) +{ + struct VAR_SPACE *vs= (struct VAR_SPACE *) 0; + struct YTREE *yt; + int vsp_num; + + for (vsp_num= 0; vsp_num < vsp_cnt; vsp_num++) + { + if ((yt= ytree_lookup_word (yt_root, (unsigned char *) vsp_name[vsp_num])) + == (struct YTREE *) 0 + || !(yt->YT_flags & YTflag_EOW) + ) + return (struct VAR_SPACE *) 0; + + vs= (struct VAR_SPACE *) yt->YT_info; + yt_root= vs->VS_array; + } + + return vs; +} diff --git a/lib/ds/varspace/varsp002.o b/lib/ds/varspace/varsp002.o new file mode 100644 index 0000000000000000000000000000000000000000..f8e0aa26e4383373d2f833154f3e8b8907030dda Binary files /dev/null and b/lib/ds/varspace/varsp002.o differ diff --git a/lib/ds/varspace/varsp003.c b/lib/ds/varspace/varsp003.c new file mode 100644 index 0000000000000000000000000000000000000000..d8ffb54b590cb8c73de866cdba0f58241597ff92 --- /dev/null +++ b/lib/ds/varspace/varsp003.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/varspace/varsp003.c + * + * variable space management + * + * written: 1994-12-11 + * latest update: 1996-08-08 17:06:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/varspace.h> + +/* ------------------------------------------------------------------------ */ +struct VAR_SPACE *vs_set ( +struct YTREE **yt_root, +char *vsp_name [], +int vsp_cnt, +long vsp_type, +long vsp_value) +{ + struct VAR_SPACE *vs; + + if ((vs= vs_get_record (yt_root, vsp_name, vsp_cnt)) + != (struct VAR_SPACE *) 0) + { + vs->VS_type= vsp_type; + vs->VS_value= (void *) vsp_value; + } + + return vs; +} diff --git a/lib/ds/varspace/varsp003.o b/lib/ds/varspace/varsp003.o new file mode 100644 index 0000000000000000000000000000000000000000..9afa361232370eb95554bb2654a39834c61271d9 Binary files /dev/null and b/lib/ds/varspace/varsp003.o differ diff --git a/lib/ds/varspace/varsp004.c b/lib/ds/varspace/varsp004.c new file mode 100644 index 0000000000000000000000000000000000000000..ffadd97cc29a57ea48e6a73750e32500141b1de5 --- /dev/null +++ b/lib/ds/varspace/varsp004.c @@ -0,0 +1,33 @@ +/* + * FILE %ds/varspace/varsp004.c + * + * variable space management + * + * written: 1994-12-11 + * latest update: 1996-01-21 23:41:15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/varspace.h> + +/* ------------------------------------------------------------------------ */ +struct VAR_SPACE *vs_set_array ( +struct YTREE **yt_root, +char *vsp_name [], +int vsp_cnt, +struct YTREE *vsp_array) +{ + struct VAR_SPACE *vs; + + if ((vs= vs_get_record (yt_root, vsp_name, vsp_cnt)) + != (struct VAR_SPACE *) 0) + { + vs->VS_array= vsp_array; + } + + return vs; +} diff --git a/lib/ds/varspace/varsp004.o b/lib/ds/varspace/varsp004.o new file mode 100644 index 0000000000000000000000000000000000000000..e4d45a968a9e7e1838455b92f863ea6eee94811e Binary files /dev/null and b/lib/ds/varspace/varsp004.o differ diff --git a/lib/ds/varspace/varsp005.c b/lib/ds/varspace/varsp005.c new file mode 100644 index 0000000000000000000000000000000000000000..eb02750152900b529e024483410bb37707551855 --- /dev/null +++ b/lib/ds/varspace/varsp005.c @@ -0,0 +1,42 @@ +/* + * FILE %ds/varspace/varsp005.c + * + * variable space management + * + * written: 1994-12-19 + * latest update: 1997-11-02 13:03:26 + * $Id: varsp005.c,v 1.2 2005/09/04 09:24:40 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <sys/types.h> +#include <gg/strings.h> +#include <gg/varspace.h> +/** #include <gg/attlist.h> **/ +/* #include <gg/ytree.h> ... included by <gg/varspace.h> */ + +/* ------------------------------------------------------------------------ */ +int vs_assign ( +struct YTREE **yt_root, +char *var_name, +long value, +long var_type, +int split_char) +{ + int nf; + char *fields [MAX_VAR_SPACE_LEVELS]; + + if ((nf= split_string (var_name, split_char, fields, MAX_VAR_SPACE_LEVELS)) + > 0) + { + if (nf > MAX_VAR_SPACE_LEVELS) nf= MAX_VAR_SPACE_LEVELS; + if (vs_set (yt_root, fields, nf, var_type, value) + == (struct VAR_SPACE *) 0) return -1; + } + + return 0; +} diff --git a/lib/ds/varspace/varsp005.o b/lib/ds/varspace/varsp005.o new file mode 100644 index 0000000000000000000000000000000000000000..11aa7e2457ab5763d12c74b670b856f7a819d179 Binary files /dev/null and b/lib/ds/varspace/varsp005.o differ diff --git a/lib/ds/varspace/varsp006.c b/lib/ds/varspace/varsp006.c new file mode 100644 index 0000000000000000000000000000000000000000..b552c989045f43b8bfae8ff2a5ba92c385eebd4f --- /dev/null +++ b/lib/ds/varspace/varsp006.c @@ -0,0 +1,50 @@ +/* + * FILE %ds/varspace/varsp006.c + * + * variable space management + * + * written: 1994-12-19 + * latest update: 1996-01-21 23:39:56 + * $Id: varsp006.c,v 1.2 2005/09/04 09:24:40 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <sys/types.h> +#include <gg/strings.h> +#include <gg/varspace.h> +#include <gg/attlist.h> +/* #include <gg/ytree.h> ... included by <gg/varspace.h> */ + +/* ------------------------------------------------------------------------ */ +long vs_increment ( +struct YTREE **yt_root, +char *var_name, /* variable name */ +long value, /* increment value */ +int pre_post, /* 1 -> return value before incrementing */ +int split_char) +{ + int nf; + char *fields [MAX_VAR_SPACE_LEVELS]; + long rv= -1L; + struct VAR_SPACE *vsp; + + if ((nf= split_string (var_name, split_char, fields, MAX_VAR_SPACE_LEVELS)) + > 0) + { + if (nf > MAX_VAR_SPACE_LEVELS) nf= MAX_VAR_SPACE_LEVELS; + if ((vsp= vs_get_record (yt_root, fields, nf)) + == (struct VAR_SPACE *) 0) return -1L; + + rv= (long) vsp->VS_value; + vsp->VS_type= ALty_long; + value += rv; + vsp->VS_value= (void *) value; + if (pre_post == 0) rv= value; + } + + return rv; +} diff --git a/lib/ds/varspace/varsp006.o b/lib/ds/varspace/varsp006.o new file mode 100644 index 0000000000000000000000000000000000000000..b42f2b40a0ac64c03d668cd55804ccc48d9a8362 Binary files /dev/null and b/lib/ds/varspace/varsp006.o differ diff --git a/lib/ds/varspace/varsp007.c b/lib/ds/varspace/varsp007.c new file mode 100644 index 0000000000000000000000000000000000000000..819c26fbfcc3a3577e7ed80daf6f9e9bcde0c1eb --- /dev/null +++ b/lib/ds/varspace/varsp007.c @@ -0,0 +1,125 @@ +/* + * FILE %ds/varspace/varsp007.c + * + * written: 1994-12-26 + * latest update: 1996-01-21 23:39:10 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/dpp.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/varspace.h> +#include <gg/attlist.h> + +#define LINE_SIZE 128 +static char line [LINE_SIZE]; + +#define N_FIELDS 10 +static char *fields [N_FIELDS]; + +/* ------------------------------------------------------------------------ */ +int vs_operations ( +struct YTREE **ytpp, +FILE *fi, +FILE *fo) +{ + struct VAR_SPACE *vsp; + char *var_name; + int cnt_fields; + int rc; + long xval; + + for (;;) + { + fputs ("% ", fo); + fread_line (fi, line, LINE_SIZE); + if (line [0] == '#') continue; + cnt_fields= isolate_tokens (line, fields, N_FIELDS); + + if (cnt_fields < 1) continue; + if (strcmp (fields [0], "quit") == 0 + || strcmp (fields [0], "0x04") == 0 + || strcmp (fields [0], "exit") == 0 + ) break; + + if (strcmp (fields [0], "set") == 0 && cnt_fields == 3) + { + rc= vs_assign (ytpp, fields [1], (long) strdup (fields [2]), + (long) ALty_string_dup, '.'); + if (rc == -1) + { + fprintf (fo, "error: rc == -1\n"); + break; + } + continue; + } + + if (strcmp (fields [0], "inc") == 0 && cnt_fields == 3) + { + xval= vs_increment (ytpp, fields [1], + get_parameter_value (fields [2]), 1, '.'); + fprintf (fo, "xval=%ld\n", xval); + continue; + } + + if (strcmp (fields [0], "pinc") == 0 && cnt_fields == 3) + { + xval= vs_increment (ytpp, fields [1], + get_parameter_value (fields [2]), 0, '.'); + fprintf (fo, "xval=%ld\n", xval); + continue; + } + + if (strcmp (fields [0], "query") == 0 && cnt_fields == 2) + { + var_name= fields [1]; + vsp= vs_query (*ytpp, var_name, '.'); + if (vsp == (struct VAR_SPACE *) 0) + { + fprintf (fo, "%s is undefined!\n", var_name); + } + else + { + switch ((int) vsp->VS_type) + { + case ALty_string: + case ALty_string_dup: + fprintf (fo, "string, value= '%s'\n", vsp->VS_value); + break; + case ALty_long: + fprintf (fo, "long, value= 0x%08lX\n", vsp->VS_value); + break; + default: + fprintf (fo, "unknown type %ld, value= 0x%08lX\n", + vsp->VS_type, vsp->VS_value); + break; + } + } + continue; + } + +#ifndef JUNK + if (strcmp (fields [0], "delete") == 0 && cnt_fields == 2) + { + var_name= fields [1]; + rc= ytree_delete_word (ytpp, var_name); + fprintf (fo, "rc= %d\n", rc); + continue; + } +#endif + + if (strcmp (fields [0], "print") == 0 && cnt_fields == 1) + { + ytree_print (fo, *ytpp, 2); + continue; + } + + fprintf (fo, "invalid command or syntax\n"); + } + return 0; +} diff --git a/lib/ds/varspace/varsp007.o b/lib/ds/varspace/varsp007.o new file mode 100644 index 0000000000000000000000000000000000000000..853bbe4006ce04c4837584de41262715865d75cd Binary files /dev/null and b/lib/ds/varspace/varsp007.o differ diff --git a/lib/ds/varspace/varsp008.c b/lib/ds/varspace/varsp008.c new file mode 100644 index 0000000000000000000000000000000000000000..9c003939d1a6f180090cf7694454cd941ef5c3b2 --- /dev/null +++ b/lib/ds/varspace/varsp008.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/varspace/varsp008.c + * + * variable space management + * + * written: 1994-12-26 + * latest update: 1996-01-21 23:42:36 + * $Id: varsp008.c,v 1.2 2005/09/04 09:24:40 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <sys/types.h> +#include <gg/strings.h> +#include <gg/varspace.h> +#include <gg/attlist.h> +/* #include <gg/ytree.h> ... included by <gg/varspace.h> */ + +/* ------------------------------------------------------------------------ */ +struct VAR_SPACE *vs_query ( +struct YTREE *yt_root, +char *var_name, +int split_char) +{ + int nf; + char *fields [MAX_VAR_SPACE_LEVELS]; + + if ((nf= split_string (var_name, split_char, fields, MAX_VAR_SPACE_LEVELS)) + > 0) + { + if (nf > MAX_VAR_SPACE_LEVELS) nf= MAX_VAR_SPACE_LEVELS; + return vs_get (yt_root, fields, nf); + } + + return (struct VAR_SPACE *) 0; +} diff --git a/lib/ds/varspace/varsp008.o b/lib/ds/varspace/varsp008.o new file mode 100644 index 0000000000000000000000000000000000000000..f35a384201560f775f50b37fff0fbdf3e85905e0 Binary files /dev/null and b/lib/ds/varspace/varsp008.o differ diff --git a/lib/ds/varspace/vspt.c b/lib/ds/varspace/vspt.c new file mode 100644 index 0000000000000000000000000000000000000000..00087d129632fd468306cdb0fff5cf2dab952023 --- /dev/null +++ b/lib/ds/varspace/vspt.c @@ -0,0 +1,24 @@ +/* + * FILE %ds/varspace/vspt.c + * + * written: 1994-12-26 + * latest update: 1997-11-02 13:05:57 + * + */ + +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/varspace.h> + +/* ------------------------------------------------------------------------ */ +static struct YTREE *yt= (struct YTREE *) 0; + +/* ------------------------------------------------------------------------ */ +int cdecl main (void); + +int main () +{ + vs_operations (&yt, stdin, stdout); + + return 0; +} diff --git a/lib/ds/vieos/(dirinf).fm b/lib/ds/vieos/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..ed4c3b5615c318140ba9f966362d7721da98136c --- /dev/null +++ b/lib/ds/vieos/(dirinf).fm @@ -0,0 +1,49 @@ +# +# FILE %ds/vieos/(dirinf).fm +# +. Vienna objective SGML TCL Library +# +# written: 1995-03-19 +.. latest update: 1997-01-15 11:31:20 +# +# --------------------------------------------------------------------------- + +# see also: <gg/vieos.h>, $vieos +# administrative files +(dirinf).fm Contents +make-dos DOS version of Makefile +make-ux Unix version of Makefile + +vieos.c vieos interpreter + +# modules +vieos001.c struct VIEOS_CONTEXT *vieos_create_context (Tcl_Interp *interp) +vieos002.c int vieos_context_object (...) +vieos003.c int vieos_destroy_context (...) +vieos004.c + +vieos101.c struct VIEOS_MARKUP *vieos_create_markup (...) +vieos102.c int vieos_markup_object (...) +vieos103.c int vieos_destroy_markup (struct VIEOS_MARKUP *vm) +vieos1*.c markup objects + +vieos201.c struct VIEOS_INDEX *vieos_create_index (...) +vieos202.c int vieos_index_object (...) +vieos203.c int vieos_destroy_index (struct VIEOS_INDEX *vm) +vieos2*.c index objects + +vieos301.c struct VIEOS_BLOCK *vieos_create_block (...) +vieos302.c int vieos_block_object (...) +vieos303.c int vieos_destroy_block (struct VIEOS_BLOCK *vm) +vieos3*.c dynamic block objects <gg/dyb.h> + +vieos401.c struct VIEOS_CLUSTER *vieos_create_cluster (...) +vieos402.c int vieos_cluster_object (...) +vieos403.c int vieos_destroy_cluster (struct VIEOS_CLUSTER *vcl) + +# generic modules, used as a template for new classes +vieosg01.c struct VIEOS_GENERIC *vieos_create_generic (...) +vieosg02.c int vieos_generic_object (...) +vieosg03.c int vieos_destroy_generic (struct VIEOS_GENERIC *vg) +vieosg04.c int vieos_destructor_generic (struct YTREE *yt, void *cd) + diff --git a/lib/ds/vieos/Makefile b/lib/ds/vieos/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..69603fb7bdb9edb4776be5aa869ea15c3ef17fbc --- /dev/null +++ b/lib/ds/vieos/Makefile @@ -0,0 +1,54 @@ +# +# FILE %ds/vieos/make-ux +# +# written: 1995-03-19 +# latest update: 1999-05-08 9:53:18 +# +# ---------------------------------------------------------------------------- +CC=cc +# OPTS=-I. -I/usr/local/include/tcl8.0 +# OPTS=-I. -I/usr/local/include/tcl8.3 +OPTS=-I. -I/usr/include/tcl8.4 +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a +lib_path=-L/usr/local/lib/tcl8.0 +tcllibs=-ltcl -lm +tklibs=-ltk -lX11 + +BINS= vieos +all: lib +all.bin: $(BINS) + +vieos : $(LIB) vieos.o + cc -o vieos vieos.o $(lib_path) $(LIB) $(tcllibs) + +# ---------------------------------------------------------------------------- +vieos_0= \ + vieos001.o vieos002.o vieos003.o + +vieos_1= \ + vieos101.o vieos102.o vieos103.o + +vieos_2= \ + vieos201.o vieos202.o vieos203.o + +vieos_3= \ + vieos301.o vieos302.o vieos303.o + +vieos_4= \ + vieos401.o vieos402.o vieos403.o + +vieos_g= \ + vieosg01.o vieosg02.o vieosg03.o + +# ---------------------------------------------------------------------------- +lib: $(vieos_0) $(vieos_1) $(vieos_2) $(vieos_3) $(vieos_4) $(vieos_g) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $*.c + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o $(BINS) diff --git a/lib/ds/vieos/contrib b/lib/ds/vieos/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/vieos/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/vieos/gg b/lib/ds/vieos/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/vieos/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/vieos/lib b/lib/ds/vieos/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/vieos/libgg.a b/lib/ds/vieos/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/vieos/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/vieos/make-dos b/lib/ds/vieos/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..f03a1045f00e6fcf393986d2a09bd70252773b93 --- /dev/null +++ b/lib/ds/vieos/make-dos @@ -0,0 +1,26 @@ +# +# FILE %ds/vieos/makefile +# +# written: 1995-03-19 +# latest update: 1997-01-15 11:31:40 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all : all.2 + +all.2 : ! + vieos001.obj vieos002.obj vieos003.obj ! + vieos101.obj vieos102.obj vieos103.obj ! + vieos201.obj vieos202.obj vieos203.obj ! + vieos301.obj vieos302.obj vieos303.obj ! + vieos401.obj vieos402.obj vieos403.obj ! + vieosg01.obj vieosg02.obj vieosg03.obj vieosg04.obj + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/vieos/vieos.c b/lib/ds/vieos/vieos.c new file mode 100644 index 0000000000000000000000000000000000000000..966b31ea63c5b6e0ef143a1e2bf6b4479145c1f0 --- /dev/null +++ b/lib/ds/vieos/vieos.c @@ -0,0 +1,64 @@ +/* + * FILE %ds/vieos/vieos.c + * + * written: 1995-12-14 + * latest update: 1996-03-19 9:19:13 + * + */ + +#include <tcl.h> +#include <gg/vieos.h> + +/* + * The following variable is a special hack that is needed in order for + * Sun shared libraries to be used for Tcl. + */ + +extern int matherr (); +int *tclDummyMathPtr= (int *) matherr; + +int main (int argc, char *argv []) +{ + Tcl_Main (argc, argv, Tcl_AppInit); + return 0; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppInit -- + * + * This procedure performs application-specific initialization. + * Most applications, especially those that incorporate additional + * packages, will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error + * message in interp->result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int Tcl_AppInit (Tcl_Interp *interp) /* Interpreter for application. */ +{ + if (Tcl_Init(interp) == TCL_ERROR + || vieos_create_context (interp, (void *) 0, "vieos") + == (struct VIEOS_CONTEXT *) 0 + || ggtcl_reg_filename_services (interp) != TCL_OK + ) + return TCL_ERROR; + + /* + * Specify a user-specific startup file to invoke if the application + * is run interactively. Typically the startup file is "~/.apprc" + * where "app" is the name of the application. If this line is deleted + * then no user-specific startup file will be run under any conditions. + */ + + tcl_RcFileName = "~/.vieosrc"; + return TCL_OK; +} + diff --git a/lib/ds/vieos/vieos001.c b/lib/ds/vieos/vieos001.c new file mode 100644 index 0000000000000000000000000000000000000000..e1c9e0bb27d193efa6646f4d5e833160952b8397 --- /dev/null +++ b/lib/ds/vieos/vieos001.c @@ -0,0 +1,44 @@ +/* + * FILE %ds/vieos/vieos001.c + * + * create a new vieos context + * + * written: 1995-03-19 + * latest update: 1997-01-15 11:26:00 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <tcl.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +struct VIEOS_CONTEXT *vieos_create_context ( +Tcl_Interp *interp, +struct VIEOS_CONTEXT *vc_creator, +char *nm) +{ + struct VIEOS_CONTEXT *vc; + + if ((vc= (struct VIEOS_CONTEXT *) + calloc (sizeof (struct VIEOS_CONTEXT), 1)) + != (struct VIEOS_CONTEXT *) 0) + { + vc->VC_name= strdup (nm); + vc->VC_signature= SIG_VIEOS_CONTEXT; + vc->VC_interp= interp; + vc->VC_context= vc_creator; + + Tcl_CreateCommand (interp, nm, + vieos_context_object, + (ClientData) vc, + vieos_destroy_context); + + if (vc_creator != (struct VIEOS_CONTEXT *) 0) + ytree_set_value (&vc_creator->VC_SUB_CONTEXT, (unsigned char *) nm, + (long) vc); + } + + return vc; +} diff --git a/lib/ds/vieos/vieos001.o b/lib/ds/vieos/vieos001.o new file mode 100644 index 0000000000000000000000000000000000000000..ca1c51dc3fc883d5615328be1dce4000f090ca05 Binary files /dev/null and b/lib/ds/vieos/vieos001.o differ diff --git a/lib/ds/vieos/vieos002.c b/lib/ds/vieos/vieos002.c new file mode 100644 index 0000000000000000000000000000000000000000..1b138879bbc6ec3eeda8bf37ad8297a646c5b7af --- /dev/null +++ b/lib/ds/vieos/vieos002.c @@ -0,0 +1,198 @@ +/* + * FILE %ds/vieos/vieos002.c + * + * create a new context object + * + * written: 1995-03-19 + * latest update: 1996-03-18 14:02:32 + * + */ + +#include <string.h> +#include <tcl.h> +#include <gg/strings.h> +#include <gg/vieos.h> + +char VIEOS_VERSION []= "vieos 1.01.03 $#D1996-03-17 19:37:06"; + +/* ------------------------------------------------------------------------ */ +int vieos_context_object ( +ClientData clientData, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + char *method; + char *object_name; + struct VIEOS_CONTEXT *vc; /* this universe */ + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if ((vc= (struct VIEOS_CONTEXT *) clientData) == (struct VIEOS_CONTEXT *) 0 + || vc->VC_signature != SIG_VIEOS_CONTEXT + ) + { + Tcl_SetResult (interp, "unknown vieos context", TCL_STATIC); + return TCL_ERROR; + } + + if (argc < 1 + || (method= argv [1]) == (char *) 0 + || *method == 0 + ) + goto ERROR; + + if (abbrev ("version", method, 3)) + { + Tcl_SetResult (interp, VIEOS_VERSION, TCL_STATIC); + return TCL_OK; + } + + /* BEGIN standard methods - - - - - - - - - - - - - - - */ + if (abbrev ("creator", method, 4)) + { + struct VIEOS_CONTEXT *vc_up; /* the creator of this context */ + + interp->result= ((vc_up= (struct VIEOS_CONTEXT *) vc->VC_context) + == (struct VIEOS_CONTEXT *) 0) + ? "" /* the absolute creator */ + : vc_up->VC_name; + + return TCL_OK; + } + + if (abbrev ("class", method, 3)) + { + Tcl_SetResult (interp, "context", TCL_STATIC); + return TCL_OK; + } + + if (abbrev ("name", method, 3)) + { + interp->result= vc->VC_name; + return TCL_OK; + } + + if (strcmp ("destroy", method) == 0) + { + Tcl_DeleteCommand (interp, vc->VC_name); + vieos_destroy_context (vc); + + Tcl_SetResult (interp, "context destroyed", TCL_STATIC); + return TCL_OK; + } + /* END standard methods - - - - - - - - - - - - - - - */ + + if (argc >= 3) + { + object_name= argv [2]; + + /* vieos00?.c */ + if (abbrev ("context", method, 6)) + { + struct VIEOS_CONTEXT *vc_sub; + + if ((vc_sub= vieos_create_context (interp, vc, object_name)) + == (struct VIEOS_CONTEXT *) 0) + { + Tcl_SetResult (interp, + "can't create context object", TCL_STATIC); + return TCL_ERROR; + } + + interp->result= vc_sub->VC_name; + return TCL_OK; + } + + /* vieos10?.c */ + if (abbrev ("markup", method, 3)) + { + struct VIEOS_MARKUP *hto; + + if ((hto= vieos_create_markup (interp, vc, object_name)) + == (struct VIEOS_MARKUP *) 0) + { + Tcl_SetResult (interp, + "can't create markup object", TCL_STATIC); + return TCL_ERROR; + } + + interp->result= hto->VIEM_name; + return TCL_OK; + } + + /* vieos20?.c */ + if (abbrev ("indexer", method, 3) + || strcmp ("lmd", method) == 0 + ) + { + struct VIEOS_INDEX *lmd; + + if ((lmd= vieos_create_index (interp, vc, object_name)) + == (struct VIEOS_INDEX *) 0) + { + Tcl_SetResult (interp, + "can't create index object", TCL_STATIC); + return TCL_ERROR; + } + + interp->result= lmd->VIEI_name; + return TCL_OK; + } + + /* vieos30?.c */ + if (abbrev ("block", method, 5)) + { + struct VIEOS_BLOCK *vb; + + if ((vb= vieos_create_block (interp, vc, object_name)) + == (struct VIEOS_BLOCK *) 0) + { + Tcl_SetResult (interp, + "can't create block object", TCL_STATIC); + return TCL_ERROR; + } + + interp->result= vb->VIEB_name; + return TCL_OK; + } + + /* vieos40?.c */ + if (abbrev ("cluster", method, 5)) + { + struct VIEOS_CLUSTER *vcl; + + if ((vcl= vieos_create_cluster (interp, vc, object_name)) + == (struct VIEOS_CLUSTER *) 0) + { + Tcl_SetResult (interp, + "can't create generic object", TCL_STATIC); + return TCL_ERROR; + } + + interp->result= vcl->VCL_name; + return TCL_OK; + } + + /* vieosg0?.c */ + if (abbrev ("generic", method, 5)) + { + struct VIEOS_GENERIC *vg; + + if ((vg= vieos_create_generic (interp, vc, object_name)) + == (struct VIEOS_GENERIC *) 0) + { + Tcl_SetResult (interp, + "can't create generic object", TCL_STATIC); + return TCL_ERROR; + } + + interp->result= vg->VIEG_name; + return TCL_OK; + } + } + +ERROR: + Tcl_SetResult (interp, "unknown vieos command", TCL_STATIC); + return TCL_ERROR; +} diff --git a/lib/ds/vieos/vieos002.o b/lib/ds/vieos/vieos002.o new file mode 100644 index 0000000000000000000000000000000000000000..330f9adc47ee7fb2fc15011c9844c1aac8c007d2 Binary files /dev/null and b/lib/ds/vieos/vieos002.o differ diff --git a/lib/ds/vieos/vieos003.c b/lib/ds/vieos/vieos003.c new file mode 100644 index 0000000000000000000000000000000000000000..613ad82e362f71e46321d05f67e9d196adc54419 --- /dev/null +++ b/lib/ds/vieos/vieos003.c @@ -0,0 +1,56 @@ +/* + * FILE %ds/vieos/vieos003.c + * + * destroy a complete context and all it's associated memory + * + * written: 1995-12-16 + * latest update: 1997-01-15 11:25:05 + * + */ + +#include <stdlib.h> +#include <tcl.h> +#include <gg/strings.h> +#include <gg/parse.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +void vieos_destroy_context (ClientData clientData) +{ + struct VIEOS_CONTEXT *vc; + + if ((vc= (struct VIEOS_CONTEXT *) clientData) != (struct VIEOS_CONTEXT *) 0 + && vc->VC_signature == (long) SIG_VIEOS_CONTEXT + ) + { + free_or_what (vc->VC_name); + + /* T2D: remove subordinate objects and everything ... */ + ytree_process (vc->VC_SUB_CONTEXT, + vieos_destructor_generic, + (void *) vieos_destroy_context); + + ytree_process (vc->VC_INDEX, + vieos_destructor_generic, + (void *) vieos_destroy_index); + + ytree_process (vc->VC_MARKUP, + vieos_destructor_generic, + (void *) vieos_destroy_markup); + + ytree_process (vc->VC_BLOCK, + vieos_destructor_generic, + (void *) vieos_destroy_block); + +#ifdef __NOT_YET__ /* 1996-03-19 10:57:17 */ + ytree_process (vc->VC_CLUSTER, + vieos_destructor_generic, + (void *) vieos_destroy_cluster); +#endif /* __NOT_YET__ 1996-03-19 10:57:17 */ + + ytree_process (vc->VC_GENERIC, + vieos_destructor_generic, + (void *) vieos_destroy_generic); + free (vc); + } +} diff --git a/lib/ds/vieos/vieos003.o b/lib/ds/vieos/vieos003.o new file mode 100644 index 0000000000000000000000000000000000000000..94ef7f4e5e9257bee0a4c84e716a3a532854d738 Binary files /dev/null and b/lib/ds/vieos/vieos003.o differ diff --git a/lib/ds/vieos/vieos101.c b/lib/ds/vieos/vieos101.c new file mode 100644 index 0000000000000000000000000000000000000000..79ac4545d8c142973c543074b09d158ca385d4ae --- /dev/null +++ b/lib/ds/vieos/vieos101.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/vieos/vieos101.c + * + * call evaluation of a TCL script + * + * written: 1995-03-19 + * latest update: 1997-01-15 11:27:56 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <tcl.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +struct VIEOS_MARKUP *vieos_create_markup ( +Tcl_Interp *interp, +struct VIEOS_CONTEXT *vc, +char *nm) +{ + struct VIEOS_MARKUP *vm; + + if ((vm= (struct VIEOS_MARKUP *) + calloc (sizeof (struct VIEOS_MARKUP), 1)) + != (struct VIEOS_MARKUP *) 0) + { + vm->VIEM_name= strdup (nm); + vm->VIEM_signature= SIG_VIEOS_MARKUP; + vm->VIEM_interp= interp; + vm->VIEM_context= vc; + + Tcl_CreateCommand (interp, nm, + vieos_markup_object, + (ClientData) vm, + vieos_destroy_markup); + + if (vc != (struct VIEOS_CONTEXT *) 0) + ytree_set_value (&vc->VC_MARKUP, (unsigned char *) nm, (long) vm); + } + + return vm; +} diff --git a/lib/ds/vieos/vieos101.o b/lib/ds/vieos/vieos101.o new file mode 100644 index 0000000000000000000000000000000000000000..9223d46ae8637e8e65e5e04c8d8a220264570731 Binary files /dev/null and b/lib/ds/vieos/vieos101.o differ diff --git a/lib/ds/vieos/vieos102.c b/lib/ds/vieos/vieos102.c new file mode 100644 index 0000000000000000000000000000000000000000..a244a6f7c8a59327f41a96052f0689401a76d977 --- /dev/null +++ b/lib/ds/vieos/vieos102.c @@ -0,0 +1,84 @@ +/* + * FILE %ds/vieos/vieos102.c + * + * execute markup object methods + * + * written: 1995-03-19 + * latest update: 1996-03-17 23:04:22 + * + */ + +#include <string.h> +#include <tcl.h> +#include <gg/strings.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +int vieos_markup_object ( +ClientData clientData, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + struct VIEOS_MARKUP *vm; + char *method; + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if ((vm= (struct VIEOS_MARKUP *) clientData) == (struct VIEOS_MARKUP *) 0 + || vm->VIEM_signature != SIG_VIEOS_MARKUP + ) + { + Tcl_SetResult (interp, "unknown object", TCL_STATIC); + return TCL_ERROR; + } + + if (argc == 2) + { + method= argv [1]; + + /* BEGIN standard methods - - - - - - - - - - - - - - - */ + if (abbrev ("creator", method, 4)) + { + struct VIEOS_CONTEXT *vc_up; /* the creator of this object */ + + interp->result= ((vc_up= (struct VIEOS_CONTEXT *) vm->VIEM_context) + == (struct VIEOS_CONTEXT *) 0) + ? "" /* the absolute creator */ + : vc_up->VC_name; + + return TCL_OK; + } + + if (abbrev ("class", method, 3)) + { + Tcl_SetResult (interp, "markup", TCL_STATIC); + return TCL_OK; + } + + if (abbrev ("name", method, 3)) + { + interp->result= vm->VIEM_name; + return TCL_OK; + } + + if (strcmp ("destroy", method) == 0) + { + Tcl_DeleteCommand (interp, vm->VIEM_name); + vieos_destroy_markup (vm); + + Tcl_SetResult (interp, "markup destroyed", TCL_STATIC); + return TCL_OK; + } + /* END standard methods - - - - - - - - - - - - - - - */ + + if (strcmp ("dump", method) == 0) + { + return TCL_OK; + } + + } + + Tcl_SetResult (interp, "unknown method", TCL_STATIC); + return TCL_ERROR; +} diff --git a/lib/ds/vieos/vieos102.o b/lib/ds/vieos/vieos102.o new file mode 100644 index 0000000000000000000000000000000000000000..fdf16aedec292c8868af00a5dbc5a6662cbf9030 Binary files /dev/null and b/lib/ds/vieos/vieos102.o differ diff --git a/lib/ds/vieos/vieos103.c b/lib/ds/vieos/vieos103.c new file mode 100644 index 0000000000000000000000000000000000000000..a02d79f3db6e6229245b652d68b764df89327fd6 --- /dev/null +++ b/lib/ds/vieos/vieos103.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/vieos/vieos103.c + * + * destroy a markup object and all it's associated memory + * + * written: 1995-03-19 + * latest update: 1997-01-15 11:27:36 + * + */ + +#include <stdlib.h> +#include <tcl.h> +#include <gg/strings.h> +#include <gg/parse.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +void vieos_destroy_markup (ClientData clientData) +{ + struct VIEOS_MARKUP *vm; + + if ((vm= (struct VIEOS_MARKUP *) clientData) != (struct VIEOS_MARKUP *) 0 + && vm->VIEM_signature == SIG_VIEOS_MARKUP + ) + { + hyx_frtx_elem_list (vm->VIEM_te); + free_or_what (vm->VIEM_name); + free (vm); + } +} diff --git a/lib/ds/vieos/vieos103.o b/lib/ds/vieos/vieos103.o new file mode 100644 index 0000000000000000000000000000000000000000..112b3b21630fe51a88b3c0c4cdd179324dc19153 Binary files /dev/null and b/lib/ds/vieos/vieos103.o differ diff --git a/lib/ds/vieos/vieos201.c b/lib/ds/vieos/vieos201.c new file mode 100644 index 0000000000000000000000000000000000000000..aa8afa82619fa88dc23aad94e20d897d4ef6c527 --- /dev/null +++ b/lib/ds/vieos/vieos201.c @@ -0,0 +1,48 @@ +/* + * FILE %ds/vieos/vieos201.c + * + * call evaluation of a TCL script + * + * written: 1995-12-14 + * latest update: 1996-03-17 19:32:27 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <tcl.h> +#include <gg/lookup.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +struct VIEOS_INDEX *vieos_create_index ( +Tcl_Interp *interp, +struct VIEOS_CONTEXT *vc, +char *nm) +{ + struct VIEOS_INDEX *idx; + struct LMDC_CONTROL *lmdc; + + if ((idx= (struct VIEOS_INDEX *) + calloc (sizeof (struct VIEOS_INDEX), 1)) + != (struct VIEOS_INDEX *) 0 + && (lmdc= lmd_create_control ()) != (struct LMDC_CONTROL *) 0 + ) + { + idx->VIEI_name= strdup (nm); + idx->VIEI_signature= SIG_VIEOS_INDEX; + idx->VIEI_interp= interp; + idx->VIEI_lmdc= lmdc; + idx->VIEI_context= vc; + + Tcl_CreateCommand (interp, nm, + vieos_index_object, + (ClientData) idx, + vieos_destroy_index); + + if (vc != (struct VIEOS_CONTEXT *) 0) + ytree_set_value (&vc->VC_INDEX, (unsigned char *) nm, (long) idx); + } + + return idx; +} diff --git a/lib/ds/vieos/vieos201.o b/lib/ds/vieos/vieos201.o new file mode 100644 index 0000000000000000000000000000000000000000..d760f2355dffa6a1b1c0c593312a62e0e6adcfab Binary files /dev/null and b/lib/ds/vieos/vieos201.o differ diff --git a/lib/ds/vieos/vieos202.c b/lib/ds/vieos/vieos202.c new file mode 100644 index 0000000000000000000000000000000000000000..0ef7779cac5320f841a11f55350ed79d6baca045 --- /dev/null +++ b/lib/ds/vieos/vieos202.c @@ -0,0 +1,152 @@ +/* + * FILE %ds/vieos/vieos202.c + * + * execute vieos index object methods + * + * written: 1995-12-14 + * latest update: 1996-12-22 12:39:04 + * + */ + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <tcl.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/dpp.h> +#include <gg/lookup.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +int vieos_index_object ( +ClientData clientData, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + struct VIEOS_INDEX *idx; + char *method; + struct LMDC_CONTROL *lmdc; + int i; + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if ((idx= (struct VIEOS_INDEX *) clientData) == (struct VIEOS_INDEX *) 0 + || idx->VIEI_signature != SIG_VIEOS_INDEX + || (lmdc= idx->VIEI_lmdc) == (struct LMDC_CONTROL *) 0 + ) + { + Tcl_SetResult (interp, "unknown object", TCL_STATIC); + return TCL_ERROR; + } + + if (argc >= 2) + { + method= argv [1]; + + /* BEGIN standard methods - - - - - - - - - - - - - - - */ + if (abbrev ("creator", method, 4)) + { + struct VIEOS_CONTEXT *vc_up; /* the creator of this object */ + + interp->result= ((vc_up= (struct VIEOS_CONTEXT *) idx->VIEI_context) + == (struct VIEOS_CONTEXT *) 0) + ? "" /* the absolute creator */ + : vc_up->VC_name; + + return TCL_OK; + } + + if (abbrev ("class", method, 3)) + { + Tcl_SetResult (interp, "index", TCL_STATIC); + return TCL_OK; + } + + if (abbrev ("name", method, 3)) + { + interp->result= idx->VIEI_name; + return TCL_OK; + } + + if (strcmp ("destroy", method) == 0) + { + Tcl_DeleteCommand (interp, idx->VIEI_name); + /* T2D: get rid of the control structure properly ... */ + vieos_destroy_index (idx); + + Tcl_SetResult (interp, "index destroyed", TCL_STATIC); + return TCL_OK; + } + /* END standard methods - - - - - - - - - - - - - - - */ + + if (abbrev ("stream", method, 3)) + { + for (i= 2; i < argc; i++) + if (lmd_read_stream (lmdc, argv [i]) < 0L) return TCL_ERROR; + + return TCL_OK; + } + + if (strcmp ("add", method) == 0) + { + if (argc > 3) + { + long docid; + char *docid_str; + + docid= get_parameter_value (docid_str= argv [2]); + + for (i= 3; i < argc; i++) + if (lmd_idx (lmdc, argv [i], docid, 0L, docid_str, 0, 0, 0L) != 0) + return TCL_ERROR; + } + + return TCL_OK; + } + + if (strcmp ("write", method) == 0 + || strcmp ("read", method) == 0 + ) + { + long word_cnt_unique; + char *lut_file= (char *) 0; + char *wr_file= (char *) 0; + char *di_file= (char *) 0; + + if (argc > 2) lut_file= argv [2]; + if (argc > 3) wr_file= strdup (argv [3]); + if (argc > 4) di_file= strdup (argv [4]); + + if (lut_file == (char *) 0) lut_file= "xxx.lt"; + if (wr_file == (char *) 0) wr_file= fnmcpy2 (lut_file, ".wr"); + if (di_file == (char *) 0) di_file= fnmcpy2 (lut_file, ".di"); + + if (strcmp ("write", method) == 0) + { + lmd_write_tables (lmdc, wr_file, di_file, LMDD_mode_full); + word_cnt_unique= lmd_PL (lmdc->LMDC_ytree, lut_file, (char *) 0); + } + else + { + lmd_RL4 (lmdc, lut_file); + word_cnt_unique= lmd_read_tables (lmdc, wr_file, di_file); + } + + sprintf (interp->result, "%ld", word_cnt_unique); + free (wr_file); + free (di_file); + + return TCL_OK; + } + + if (strcmp ("dump", method) == 0) + { + return TCL_OK; + } + } + + Tcl_SetResult (interp, "unknown method", TCL_STATIC); + return TCL_ERROR; +} diff --git a/lib/ds/vieos/vieos202.o b/lib/ds/vieos/vieos202.o new file mode 100644 index 0000000000000000000000000000000000000000..2b743d19b05b8e0cc4134c35093d5f981e67005f Binary files /dev/null and b/lib/ds/vieos/vieos202.o differ diff --git a/lib/ds/vieos/vieos203.c b/lib/ds/vieos/vieos203.c new file mode 100644 index 0000000000000000000000000000000000000000..ac1be6a9b0ce7b66008fda6570b2e66293d89549 --- /dev/null +++ b/lib/ds/vieos/vieos203.c @@ -0,0 +1,29 @@ +/* + * FILE %ds/vieos/vieos203.c + * + * destroy a index object and all it's associated memory + * + * written: 1995-12-14 + * latest update: 1997-01-15 11:29:01 + * + */ + +#include <stdlib.h> +#include <tcl.h> +#include <gg/strings.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +void vieos_destroy_index (ClientData clientData) +{ + struct VIEOS_INDEX *idx; + + if ((idx= (struct VIEOS_INDEX *) clientData) != (struct VIEOS_INDEX *) 0 + && idx->VIEI_signature == SIG_VIEOS_INDEX + ) + { + free_or_what (idx->VIEI_name); + free (idx); + } +} + diff --git a/lib/ds/vieos/vieos203.o b/lib/ds/vieos/vieos203.o new file mode 100644 index 0000000000000000000000000000000000000000..45d7d7ba260a9aeccb82b9d6b72bef562424f040 Binary files /dev/null and b/lib/ds/vieos/vieos203.o differ diff --git a/lib/ds/vieos/vieos301.c b/lib/ds/vieos/vieos301.c new file mode 100644 index 0000000000000000000000000000000000000000..11e65e54091c085f14373f4a9c97c98b049330dc --- /dev/null +++ b/lib/ds/vieos/vieos301.c @@ -0,0 +1,46 @@ +/* + * FILE %ds/vieos/vieos301.c + * + * create a new vieos block object + * + * written: 1995-12-16 + * latest update: 1996-03-17 19:57:12 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <tcl.h> +#include <gg/dyb.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +struct VIEOS_BLOCK *vieos_create_block ( +Tcl_Interp *interp, +struct VIEOS_CONTEXT *vc, +char *nm) +{ + struct VIEOS_BLOCK *vb; + + if ((vb= (struct VIEOS_BLOCK *) + calloc (sizeof (struct VIEOS_BLOCK), 1)) + != (struct VIEOS_BLOCK *) 0) + { + vb->VIEB_name= strdup (nm); + vb->VIEB_signature= SIG_VIEOS_BLOCK; + vb->VIEB_interp= interp; + vb->VIEB_context= vc; + + vb->VIEB_dyb= dyb_new_block (256); + + Tcl_CreateCommand (interp, nm, + vieos_block_object, + (ClientData) vb, + vieos_destroy_block); + + if (vc != (struct VIEOS_CONTEXT *) 0) + ytree_set_value (&vc->VC_BLOCK, (unsigned char *) nm, (long) vb); + } + + return vb; +} diff --git a/lib/ds/vieos/vieos301.o b/lib/ds/vieos/vieos301.o new file mode 100644 index 0000000000000000000000000000000000000000..1cc50d3a8a42c942be07489779f0fcef06aed329 Binary files /dev/null and b/lib/ds/vieos/vieos301.o differ diff --git a/lib/ds/vieos/vieos302.c b/lib/ds/vieos/vieos302.c new file mode 100644 index 0000000000000000000000000000000000000000..121dd8a70c67a5aa6f18b07c702b76483e62849d --- /dev/null +++ b/lib/ds/vieos/vieos302.c @@ -0,0 +1,79 @@ +/* + * FILE %ds/vieos/vieos302.c + * + * execute block object methods + * + * written: 1995-03-19 + * latest update: 1996-03-17 19:56:55 + * + */ + +#include <string.h> +#include <tcl.h> +#include <gg/strings.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +int vieos_block_object ( +ClientData clientData, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + struct VIEOS_BLOCK *vb; + char *method; + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if ((vb= (struct VIEOS_BLOCK *) clientData) == (struct VIEOS_BLOCK *) 0 + || vb->VIEB_signature != SIG_VIEOS_BLOCK + ) + { + Tcl_SetResult (interp, "unknown object", TCL_STATIC); + return TCL_ERROR; + } + + if (argc == 2) + { + if ((method= argv [1]) == (char *) 0 || *method == 0) goto ERROR; + + /* BEGIN standard methods - - - - - - - - - - - - - - - */ + if (abbrev ("creator", method, 4)) + { + struct VIEOS_CONTEXT *vc_up; /* the creator of this object */ + + interp->result= ((vc_up= (struct VIEOS_CONTEXT *) vb->VIEB_context) + == (struct VIEOS_CONTEXT *) 0) + ? "" /* the absolute creator */ + : vc_up->VC_name; + + return TCL_OK; + } + + if (abbrev ("class", method, 3)) + { + Tcl_SetResult (interp, "block", TCL_STATIC); + return TCL_OK; + } + + if (abbrev ("name", method, 3)) + { + interp->result= vb->VIEB_name; + return TCL_OK; + } + + if (strcmp ("destroy", method) == 0) + { + Tcl_DeleteCommand (interp, vb->VIEB_name); + vieos_destroy_block (vb); + + Tcl_SetResult (interp, "block destroyed", TCL_STATIC); + return TCL_OK; + } + /* END standard methods - - - - - - - - - - - - - - - */ + } + +ERROR: + Tcl_SetResult (interp, "unknown method", TCL_STATIC); + return TCL_ERROR; +} diff --git a/lib/ds/vieos/vieos302.o b/lib/ds/vieos/vieos302.o new file mode 100644 index 0000000000000000000000000000000000000000..08c40bfb7e2c6381402d7ff1055f44964a739e69 Binary files /dev/null and b/lib/ds/vieos/vieos302.o differ diff --git a/lib/ds/vieos/vieos303.c b/lib/ds/vieos/vieos303.c new file mode 100644 index 0000000000000000000000000000000000000000..7c526f21fe3ea965daf46d5bfbebccdc48f00c20 --- /dev/null +++ b/lib/ds/vieos/vieos303.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/vieos/vieos303.c + * + * destroy a block object and all it's associated memory + * + * written: 1995-12-16 + * latest update: 1997-01-15 11:29:26 + * + */ + +#include <stdlib.h> +#include <tcl.h> +#include <gg/strings.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +void vieos_destroy_block (ClientData clientData) +{ + struct VIEOS_BLOCK *vb; + + if ((vb= (struct VIEOS_BLOCK *) clientData) != (struct VIEOS_BLOCK *) 0 + && vb->VIEB_signature == SIG_VIEOS_BLOCK + ) + { + vb->VIEB_signature= 0L; /* create an invalid signature */ + /* in case someone comes across */ + /* a dangling pointer... */ + free_or_what (vb->VIEB_name); + free (vb); + } +} diff --git a/lib/ds/vieos/vieos303.o b/lib/ds/vieos/vieos303.o new file mode 100644 index 0000000000000000000000000000000000000000..09fd99c9a3a5a68498feee028bd6acfb379fc558 Binary files /dev/null and b/lib/ds/vieos/vieos303.o differ diff --git a/lib/ds/vieos/vieos401.c b/lib/ds/vieos/vieos401.c new file mode 100644 index 0000000000000000000000000000000000000000..9763dc82b0fc4e39aca412ce851d2e1470059ff5 --- /dev/null +++ b/lib/ds/vieos/vieos401.c @@ -0,0 +1,49 @@ +/* + * FILE %ds/vieos/vieos401.c + * + * create a vieos cluster object + * + * written: 1995-12-16 + * latest update: 1997-01-15 11:29:44 + * $Id: vieos401.c,v 1.3 2002/01/27 23:01:46 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <tcl.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +struct VIEOS_CLUSTER *vieos_create_cluster ( +Tcl_Interp *interp, +struct VIEOS_CONTEXT *vc, +char *nm) +{ + struct VIEOS_CLUSTER *vcl; + struct HYX_CLUSTER_CONTROL *hcc; + + if ((vcl= (struct VIEOS_CLUSTER *) + calloc (sizeof (struct VIEOS_CLUSTER), 1)) + != (struct VIEOS_CLUSTER *) 0) + { + vcl->VCL_name= strdup (nm); + vcl->VCL_signature= SIG_VIEOS_CLUSTER; + vcl->VCL_interp= interp; + vcl->VCL_context= vc; + + vcl->VCL_hcc= hcc= hyx_new_cluster_control (); + hcc_set_cluster_name (hcc, nm); + + Tcl_CreateCommand (interp, nm, + vieos_cluster_object, + (ClientData) vcl, + vieos_destroy_cluster); + + if (vc != (struct VIEOS_CONTEXT *) 0) + ytree_set_value (&vc->VC_GENERIC, (unsigned char *) nm, (long) vcl); + } + + return vcl; +} diff --git a/lib/ds/vieos/vieos401.o b/lib/ds/vieos/vieos401.o new file mode 100644 index 0000000000000000000000000000000000000000..95ca97d8c8bd3d53ce457d1c8a5e91db5130b5e9 Binary files /dev/null and b/lib/ds/vieos/vieos401.o differ diff --git a/lib/ds/vieos/vieos402.c b/lib/ds/vieos/vieos402.c new file mode 100644 index 0000000000000000000000000000000000000000..f0825ad00588a4af70c06a25f504832ce3a8d1ca --- /dev/null +++ b/lib/ds/vieos/vieos402.c @@ -0,0 +1,91 @@ +/* + * FILE %ds/vieos/vieos402.c + * + * execute cluster object methods + * + * written: 1995-12-16 + * latest update: 1997-01-15 11:34:56 + * + */ + +#include <tcl.h> +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +int vieos_cluster_object ( +ClientData clientData, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + struct VIEOS_CLUSTER *vcl; + char *method; + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if ((vcl= (struct VIEOS_CLUSTER *) clientData) == (struct VIEOS_CLUSTER *) 0 + || vcl->VCL_signature != SIG_VIEOS_CLUSTER + ) + { + Tcl_SetResult (interp, "unknown object", TCL_STATIC); + return TCL_ERROR; + } + + if (argc == 2) + { + if ((method= argv [1]) == (char *) 0 || *method == 0) goto ERROR; + + /* BEGIN standard methods - - - - - - - - - - - - - - - */ + if (abbrev ("creator", method, 4)) + { + struct VIEOS_CONTEXT *vc_up; /* the creator of this object */ + + interp->result= ((vc_up= (struct VIEOS_CONTEXT *) vcl->VCL_context) + == (struct VIEOS_CONTEXT *) 0) + ? "" /* the absolute creator */ + : vc_up->VC_name; + + return TCL_OK; + } + + if (abbrev ("class", method, 3)) + { + Tcl_SetResult (interp, "cluster", TCL_STATIC); + return TCL_OK; + } + + if (abbrev ("name", method, 3)) + { + interp->result= vcl->VCL_name; + return TCL_OK; + } + + if (strcmp ("destroy", method) == 0) + { + Tcl_DeleteCommand (interp, vcl->VCL_name); + vieos_destroy_cluster (vcl); + + Tcl_SetResult (interp, "cluster destroyed", TCL_STATIC); + return TCL_OK; + } + /* END standard methods - - - - - - - - - - - - - - - */ + } + + if (argc >= 3) + { +#ifdef __T2D__ /* 1997-01-15 11:36:45 */ + char *fnm_hyx; + char *fnm_idx; + char *fnm_lut; + char *fnm_xfn; + fnm_hyx= (char *) 0; /* T2D */ +#endif /* __T2D__ 1997-01-15 11:36:45 */ + } + +ERROR: + Tcl_SetResult (interp, "unknown method", TCL_STATIC); + return TCL_ERROR; +} diff --git a/lib/ds/vieos/vieos402.o b/lib/ds/vieos/vieos402.o new file mode 100644 index 0000000000000000000000000000000000000000..9cc3dfb8e4b2f77e7296ee77f60f635361b8fc9d Binary files /dev/null and b/lib/ds/vieos/vieos402.o differ diff --git a/lib/ds/vieos/vieos403.c b/lib/ds/vieos/vieos403.c new file mode 100644 index 0000000000000000000000000000000000000000..7400ff30477c5c3d53bb983c1cd65125ff3d9199 --- /dev/null +++ b/lib/ds/vieos/vieos403.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/vieos/vieos403.c + * + * destroy a cluster object and all it's associated memory + * + * written: 1995-12-16 + * latest update: 1997-01-15 11:30:13 + * + */ + +#include <tcl.h> +#include <stdio.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +void vieos_destroy_cluster (ClientData clientData) +{ + struct VIEOS_CLUSTER *vcl; + + if ((vcl= (struct VIEOS_CLUSTER *) clientData) != (struct VIEOS_CLUSTER *) 0 + && vcl->VCL_signature == SIG_VIEOS_CLUSTER + ) + { + vcl->VCL_signature= 0L; /* create an invalid signature */ + /* in case someone comes across */ + /* a dangling pointer... */ + free_or_what (vcl->VCL_name); + hcc_destroy (vcl->VCL_hcc); + + free (vcl); + } +} diff --git a/lib/ds/vieos/vieos403.o b/lib/ds/vieos/vieos403.o new file mode 100644 index 0000000000000000000000000000000000000000..52a3842e43fdccdab9fda15b5eededa229e12022 Binary files /dev/null and b/lib/ds/vieos/vieos403.o differ diff --git a/lib/ds/vieos/vieosg01.c b/lib/ds/vieos/vieosg01.c new file mode 100644 index 0000000000000000000000000000000000000000..2db81a11734d37cff9598ebc19bb40bcfabb6490 --- /dev/null +++ b/lib/ds/vieos/vieosg01.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/vieos/vieosg01.c + * + * create a vieos generic object + * + * written: 1995-12-16 + * latest update: 1996-03-17 19:33:45 + * + */ + +#include <stdlib.h> +#include <string.h> +#include <tcl.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +struct VIEOS_GENERIC *vieos_create_generic ( +Tcl_Interp *interp, +struct VIEOS_CONTEXT *vc, +char *nm) +{ + struct VIEOS_GENERIC *vg; + + if ((vg= (struct VIEOS_GENERIC *) + calloc (sizeof (struct VIEOS_GENERIC), 1)) + != (struct VIEOS_GENERIC *) 0) + { + vg->VIEG_name= strdup (nm); + vg->VIEG_signature= SIG_VIEOS_GENERIC; + vg->VIEG_interp= interp; + vg->VIEG_context= vc; + + Tcl_CreateCommand (interp, nm, + vieos_generic_object, + (ClientData) vg, + vieos_destroy_generic); + + if (vc != (struct VIEOS_CONTEXT *) 0) + ytree_set_value (&vc->VC_GENERIC, nm, (long) vg); + } + + return vg; +} diff --git a/lib/ds/vieos/vieosg01.o b/lib/ds/vieos/vieosg01.o new file mode 100644 index 0000000000000000000000000000000000000000..192dd4868f3475cb642660bc9a56e13cc67deadf Binary files /dev/null and b/lib/ds/vieos/vieosg01.o differ diff --git a/lib/ds/vieos/vieosg02.c b/lib/ds/vieos/vieosg02.c new file mode 100644 index 0000000000000000000000000000000000000000..482d72c60571a92078b7619df8ba27b7b83890e4 --- /dev/null +++ b/lib/ds/vieos/vieosg02.c @@ -0,0 +1,79 @@ +/* + * FILE %ds/vieos/vieosg02.c + * + * execute generic object methods + * + * written: 1995-12-16 + * latest update: 1996-03-17 19:34:38 + * + */ + +#include <string.h> +#include <tcl.h> +#include <gg/strings.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +int vieos_generic_object ( +ClientData clientData, +Tcl_Interp *interp, +int argc, +char *argv []) +{ + struct VIEOS_GENERIC *vg; + char *method; + + if (interp == (Tcl_Interp *) 0) return TCL_ERROR; + + if ((vg= (struct VIEOS_GENERIC *) clientData) == (struct VIEOS_GENERIC *) 0 + || vg->VIEG_signature != SIG_VIEOS_GENERIC + ) + { + Tcl_SetResult (interp, "unknown object", TCL_STATIC); + return TCL_ERROR; + } + + if (argc == 2) + { + if ((method= argv [1]) == (char *) 0 || *method == 0) goto ERROR; + + /* BEGIN standard methods - - - - - - - - - - - - - - - */ + if (abbrev ("creator", method, 4)) + { + struct VIEOS_CONTEXT *vc_up; /* the creator of this object */ + + interp->result= ((vc_up= (struct VIEOS_CONTEXT *) vg->VIEG_context) + == (struct VIEOS_CONTEXT *) 0) + ? "" /* the absolute creator */ + : vc_up->VC_name; + + return TCL_OK; + } + + if (abbrev ("class", method, 3)) + { + Tcl_SetResult (interp, "generic", TCL_STATIC); + return TCL_OK; + } + + if (abbrev ("name", method, 3)) + { + interp->result= vg->VIEG_name; + return TCL_OK; + } + + if (strcmp ("destroy", method) == 0) + { + Tcl_DeleteCommand (interp, vg->VIEG_name); + vieos_destroy_generic (vg); + + Tcl_SetResult (interp, "generic destroyed", TCL_STATIC); + return TCL_OK; + } + /* END standard methods - - - - - - - - - - - - - - - */ + } + +ERROR: + Tcl_SetResult (interp, "unknown method", TCL_STATIC); + return TCL_ERROR; +} diff --git a/lib/ds/vieos/vieosg02.o b/lib/ds/vieos/vieosg02.o new file mode 100644 index 0000000000000000000000000000000000000000..d81baa5570ccfab0b271e1a558fd840212e2bfc4 Binary files /dev/null and b/lib/ds/vieos/vieosg02.o differ diff --git a/lib/ds/vieos/vieosg03.c b/lib/ds/vieos/vieosg03.c new file mode 100644 index 0000000000000000000000000000000000000000..1ece759a575bc8257ffb6e9b43b43ab16d2de1a2 --- /dev/null +++ b/lib/ds/vieos/vieosg03.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/vieos/vieosg03.c + * + * destroy a generic object and all it's associated memory + * + * written: 1995-12-16 + * latest update: 1997-01-15 11:36:12 + * + */ + +#include <stdlib.h> +#include <tcl.h> +#include <gg/strings.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +void vieos_destroy_generic (ClientData clientData) +{ + struct VIEOS_GENERIC *vg; + + if ((vg= (struct VIEOS_GENERIC *) clientData) != (struct VIEOS_GENERIC *) 0 + && vg->VIEG_signature == SIG_VIEOS_GENERIC + ) + { + vg->VIEG_signature= 0L; /* create an invalid signature */ + /* in case someone comes across */ + /* a dangling pointer... */ + free_or_what (vg->VIEG_name); + free (vg); + } +} diff --git a/lib/ds/vieos/vieosg03.o b/lib/ds/vieos/vieosg03.o new file mode 100644 index 0000000000000000000000000000000000000000..3f52f89878db7d5127de4131e5d70407a76eb8ae Binary files /dev/null and b/lib/ds/vieos/vieosg03.o differ diff --git a/lib/ds/vieos/vieosg04.c b/lib/ds/vieos/vieosg04.c new file mode 100644 index 0000000000000000000000000000000000000000..14f813eeeb5eca5414b677feb34d4eb3fbf7a363 --- /dev/null +++ b/lib/ds/vieos/vieosg04.c @@ -0,0 +1,28 @@ +/* + * FILE %ds/vieos/vieosg04.c + * + * destroy a generic object in a hash tree + * + * written: 1996-03-19 + * latest update: 1996-03-19 9:32:00 + * + */ + +#include <tcl.h> +#include <gg/strings.h> +#include <gg/vieos.h> + +/* ------------------------------------------------------------------------ */ +int vieos_destructor_generic (struct YTREE *yt, void *cd) +{ + VIEOS_DESTRUCTOR *destructor; + + if (yt == (struct YTREE *) 0 + || !(yt->YT_flags & YTflag_EOW) + || (destructor= (VIEOS_DESTRUCTOR *) cd) == (VIEOS_DESTRUCTOR *) 0 + ) return 0; + + (*destructor) ((ClientData) yt->YT_info); + + return 0; +} diff --git a/lib/ds/ytree/(dirinf).fm b/lib/ds/ytree/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..0c8150c09f7e6a666041d68ed1cc6a7e82a45aa7 --- /dev/null +++ b/lib/ds/ytree/(dirinf).fm @@ -0,0 +1,43 @@ +# +# FILE %ds/ytree/(dirinf).fm +# +# include <gg/ytree.h> +# +# written: 1990-01-01 +# latest update: 1996-12-11 12:52:39 +# +# ---------------------------------------------------------------------------- +(dirinf).fm Library Funktionen: YTREE +Makefile active Makefile (DOS or Unix) +make-ux Makefile (Unix) +make-dos Makefile (MSDOS) + +# index tree handling +yt_00001.c ytree_alloc () neuen YTREE Knoten anlegen +yt_00002.c int ytree_free (struct YTREE *yt); +yt_00003.c ytree_insert_word () YTREE Struktur aufbauen +yt_00004.c ytree_lookup_word () Wort in YTREE Struktur suchen +yt_00005.c ytree_delete_word () Wort aus YTREE entfernen +yt_00006.c ytree_size () Groesse einer YTREE-(Sub)-Struktur berechnen +yt_00007.c ytree_print +yt_00008.c ytree_print_node +yt_00009.c ytree_dump () ytree im LUT-Format ausgeben +yt_00010.c int ytree_scan (lut, ytp); +yt_00011.c int ytree_full_scan (FILE *lut, struct YTREE **ytp, ...kill...); +yt_00012.c int ytree_process (struct YTREE *yt, YTREE_PROCESSOR *pr, void *cd) +yt_00013.c int ytree_operations (struct YTREE **ytp, ...) +yt_00014.c int ytree_debug (struct YTREE *yt) +yt_00015.c int ytree_dump_to_lut_file (char *name_lut, struct YTREE *yt) +yt_00016.c long ytree_set_value (struct YTREE **yt, unsigned char *w, long v) +yt_00017.c int ytree_increment_value (struct YTREE **ytp, ...) +yt_00018.c long ytree_get_value (struct YTREE *ytp, ...) +yt_00019.c struct YTREE *ytree_duplicate (struct YTREE *yt) +yt_00020.c int ytree_repack (struct YTREE **ytp) +yt_00021.c int ytree_track (struct YTREE *yt, YTREE_TRACKER *pr, void *cd) +yt_00022.c int ytree_process_info (struct YTREE *yt, YTREE_PROCESSOR *pr, void *cd) +yt_00023.c int ytree_track_info (struct YTREE *yt, YTREE_INFO_TRACKER *pr, void *cd) + +yt_00101.c struct YTREE_CONTROL *ytree_new_control (char *name); +yt_00102.c int ytree_free_control (struct YTREE_CONTROL *yc); + +ytt \ No newline at end of file diff --git a/lib/ds/ytree/.cvsignore b/lib/ds/ytree/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..7aba1542f0843aaf63591fb036c45b83409fe059 --- /dev/null +++ b/lib/ds/ytree/.cvsignore @@ -0,0 +1,3 @@ +ytt +ytt2 +@* diff --git a/lib/ds/ytree/Makefile b/lib/ds/ytree/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..2d4cf8cc1daf36eceda0a64723f23300c52b761c --- /dev/null +++ b/lib/ds/ytree/Makefile @@ -0,0 +1,46 @@ +# +# FILE %ds/ytree/make-ux +# +# written: 1995-12-12 +# latest update: 1999-05-08 9:53:56 +# $Id: Makefile,v 1.5 2003/06/25 15:02:49 gonter Exp $ +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-g -I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow + +# ---------------------------------------------------------------------------- +LIB=../../libgg.a + +all: lib + +bin : ytt ytt2 + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + yt_00001.o yt_00002.o yt_00003.o yt_00004.o yt_00005.o yt_00006.o \ + yt_00007.o yt_00008.o yt_00009.o yt_00010.o yt_00011.o yt_00012.o \ + yt_00013.o yt_00014.o yt_00015.o yt_00016.o yt_00017.o yt_00018.o \ + yt_00019.o yt_00020.o yt_00021.o yt_00022.o yt_00023.o + +LIBOBJS1= \ + yt_00101.o yt_00102.o + +# ---------------------------------------------------------------------------- +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $? + +ytt : ytt.o lib + cc -o ytt ytt.o $(LIB) + +ytt2 : ytt2.o lib + cc -o ytt2 ytt2.o $(LIB) diff --git a/lib/ds/ytree/contrib b/lib/ds/ytree/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/ytree/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/ytree/gg b/lib/ds/ytree/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/ytree/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/ytree/lib b/lib/ds/ytree/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/ytree/libgg.a b/lib/ds/ytree/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/ytree/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/ytree/make-dos b/lib/ds/ytree/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..2edb50a26030be5eaad62665db2e36f1ba5bb764 --- /dev/null +++ b/lib/ds/ytree/make-dos @@ -0,0 +1,31 @@ +# +# FILE %ds/ytree/makefile +# +# written: 1989 03 29 +# latest update: 1996-12-11 13:04:06 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all : all.2 all.3 + +all.2 : yt_00001.obj yt_00002.obj yt_00003.obj yt_00004.obj yt_00005.obj ! + yt_00006.obj yt_00007.obj yt_00008.obj yt_00009.obj yt_00010.obj ! + yt_00011.obj yt_00012.obj yt_00013.obj yt_00014.obj yt_00015.obj ! + yt_00016.obj yt_00017.obj yt_00018.obj yt_00019.obj yt_00020.obj ! + yt_00021.obj yt_00022.obj yt_00023.obj + +all.3 : yt_00101.obj yt_00102.obj + +# llink -n0 -l$(lib).lib -dyt_lib.mod + +ytt.exe : ytt.obj yt_00013.obj yt_d0005.obj + link ytt yt_00013.obj yt_d0005.obj,,,$(lib); + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/ytree/yt_00001.c b/lib/ds/ytree/yt_00001.c new file mode 100644 index 0000000000000000000000000000000000000000..06147267ceb4837ae8cc8fe58d72f48425ccd388 --- /dev/null +++ b/lib/ds/ytree/yt_00001.c @@ -0,0 +1,80 @@ +/* + * FILE %ds/ytree/yt_00001.c + * + * ytree_alloc: create a new YTREE node + * + * written: 1990 06 02 + * 1991 03 16: Revision; AIX + * latest update: 1995-12-05 + * $Id: yt_00001.c,v 1.3 2001/11/20 19:32:44 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/ytree.h> + +long YTREE_ALLOCATED= 0L; +long YTREE_ALLOC_SIZE= 0L; + +/* ------------------------------------------------------------------------ */ +struct YTREE *ytree_alloc ( +unsigned char *s, /* String, fuer den der Knoten angelegt wird */ +int lng_str) /* Laenge des Strings; <0 -> strlen () */ +{ + struct YTREE *p; + int lng_allocated; + + if (lng_str < 0) lng_str= strlen ((char *) s); + + lng_allocated= sizeof (struct YTREE) - 2 + lng_str; + + if ((p= (struct YTREE *) malloc (lng_allocated)) != (struct YTREE *) 0) + { + YTREE_ALLOCATED++; + YTREE_ALLOC_SIZE += (long) lng_allocated; + + p->YT_next= + p->YT_down= (struct YTREE *) 0; + p->YT_info= 0L; + p->YT_lng_str= lng_str; +#ifdef YTlng_all + p->YT_lng_allocated= lng_allocated; +#endif + p->YT_flags= 0x0000; + p->YT_size= 0L; + memcpy (p->YT_str, s, lng_str); + } + + return p; +} + +/* ------------------------------------------------------------------------ */ +int ytree_free_node (struct YTREE *yt) +{ + int lng_allocated; + + lng_allocated= sizeof (struct YTREE) - 1 + yt->YT_lng_str; + YTREE_ALLOC_SIZE -= (long) lng_allocated; + YTREE_ALLOCATED--; + + free (yt); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +/* Anmerkung: */ +/* 1. YT_lng_str kann gegenueber dem Zeitpunkt des allocierens */ +/* herabgesetzt werden, etwa in ytree_insert_word, wenn ein */ +/* Knoten geteilt wird, und der Eintrag im urspruenglichen */ +/* Knoten einfach nur in der Laenge angepasst wird. */ +/* 2. Diese Laengeunterschiede sind abhaengig von der Reihenfolge, in der */ +/* die Worte eingelesen werden. */ +/* Dadurch kann ein Unterschied im Platzbedarf von erstmals gelesenen */ +/* Worten und von einer LUT gescannten Worten erklaert werden. */ diff --git a/lib/ds/ytree/yt_00001.o b/lib/ds/ytree/yt_00001.o new file mode 100644 index 0000000000000000000000000000000000000000..6f509a67273295efe87686f374db25614fc902a6 Binary files /dev/null and b/lib/ds/ytree/yt_00001.o differ diff --git a/lib/ds/ytree/yt_00002.c b/lib/ds/ytree/yt_00002.c new file mode 100644 index 0000000000000000000000000000000000000000..971884eade69969603a87c46c46b8a7fa9772d0b --- /dev/null +++ b/lib/ds/ytree/yt_00002.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/ytree/yt_00002.c + * + * free a complete ytree structure + * + * written: 1990 11 12 + * 1991 03 16: Revision; AIX + * latest update: 1995-08-20 + * $Id: yt_00002.c,v 1.2 2001/11/20 19:32:44 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +int ytree_free (struct YTREE *yt) +{ + struct YTREE *y; + + while (yt != (struct YTREE *) 0) + { + ytree_free (yt->YT_down); + y= yt; + yt= yt->YT_next; + ytree_free_node (y); + } + + return 0; +} diff --git a/lib/ds/ytree/yt_00002.o b/lib/ds/ytree/yt_00002.o new file mode 100644 index 0000000000000000000000000000000000000000..f978a09cf83ddd67b08084a494f3849119731fea Binary files /dev/null and b/lib/ds/ytree/yt_00002.o differ diff --git a/lib/ds/ytree/yt_00003.c b/lib/ds/ytree/yt_00003.c new file mode 100644 index 0000000000000000000000000000000000000000..f49b9fc72189f60541c72da04447f3e9c937aa04 --- /dev/null +++ b/lib/ds/ytree/yt_00003.c @@ -0,0 +1,197 @@ +/* + * FILE %ds/ytree/yt_00003.c + * + * ytree_insert_word: YTREE Struktur aufbauen + * + * written: 1990 06 02 + * 1991 03 16: Revision; AIX + * latest update: 1995-12-30 + * $Id: yt_00003.c,v 1.3 2002/10/16 04:44:51 gonter Exp $ + * + */ + +/* #define DEBUG_001 */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/ytree.h> +#include <gg/strings.h> + +long YTREE_truncated= 0L; /* number of bytes used up by node splits */ + +#ifdef DEBUG_001 +static char *PI (struct YTREE *s); +#endif + +/* ------------------------------------------------------------------------ */ +struct YTREE *ytree_insert_word ( +struct YTREE **ypp, /* Wurzel des erzeugten YTREEs */ +unsigned char *key) /* einzusortierendes Wort */ +/* Return: Knoten, der die Info-Komponente des Worts enthaelt */ +{ + struct YTREE *new_node; /* neu angelegter Knoten */ + struct YTREE *next_node; /* neu angelegter nachfolgender Knoten */ + struct YTREE *yp; /* yp= *ypp */ + int ml; /* match length */ + int lng_str; /* length of string segment in current node */ + +#ifdef DEBUG_001 + printf ("@61 YT_score_word *ypp=%08lX key='%s'\n", *ypp, key); +#endif + + if (ypp == (struct YTREE **) 0 + || key == (unsigned char *) 0 + ) + return (struct YTREE *) 0; /* ERROR */ + +CHECK: + if (*ypp == (struct YTREE *) 0 + || (*ypp)->YT_str[0] > *key /* lexicographische Sortierung */ + ) + { /* key als neuen Knoten anlegen */ +#ifdef DEBUG_001 + printf ("@62 Wort '%s' als neuen Knoten anlegen\n", key); +#endif + + if ((new_node= ytree_alloc (key, -1)) == (struct YTREE *) 0) + return (struct YTREE *) 0; + + new_node->YT_next= *ypp; + *ypp= new_node; + + return new_node; + } + + yp= *ypp; + lng_str= yp->YT_lng_str; + +#ifdef DEBUG_001 + printf ("@62a Compare: '%s' '%s' -> ml=%d\n", PI(yp), key, + match_lng (yp->YT_str, key, lng_str)); +#endif + + if ((ml= match_lng ((char *) yp->YT_str, (char *) key, lng_str)) > 0) + { + if (ml == strlen ((char *) key) && ml == lng_str) + { /* exakter Match */ +#ifdef DEBUG_001 + printf ("@63 Exakter Match: '%s'\n", key); +#endif + return yp; + } + + if (ml == lng_str) + { /* Textsegment kommt auch in str vor und Wort ist laenger als */ + /* das betrachtete Textsegment => Baum weiter absteigen */ + /* z.B. yp->YT_str = 'AB' */ + /* key = 'ABCD' */ + /* -> ml = 2 */ +#ifdef DEBUG_001 + printf ("@64 Textsegment '%s' auch in '%s'\n", PI(yp), key); +#endif + + key= &key [ml]; + ypp= &yp->YT_down; + + goto CHECK; + } + + /* sonst split nach match_lng: ---------------------------- */ + /* Hier koennen bei gegebener ml folgende Faelle auftreten: */ + /* 1. yp->YT_str = 'ABDC' | */ + /* key = 'ABCD' | */ + /* -> ml = 2 | --> Split 1 */ + /* 2. yp->YT_str = 'ABCD' | */ + /* key = 'ABDC' | */ + /* -> ml = 2 | --> Split 2 */ + /* 3. yp->YT_str = 'ABCD' | */ + /* key = 'AB' | */ + /* -> ml = 2 | --> Split 2 verkuerzt */ + if (strlen ((char *) key) > ml && yp->YT_str [ml] > key [ml]) + { +#ifdef DEBUG_001 + printf ("@65 Split1: '%s' key='%s' nach %d\n", + PI(yp), key, ml); +#endif + + if ((new_node= ytree_alloc (&key [ml], -1)) == (struct YTREE *) 0 + || (new_node->YT_next= next_node= + ytree_alloc (&yp->YT_str [ml], lng_str-ml)) + == (struct YTREE *) 0 + ) + return (struct YTREE *) 0; + + next_node->YT_down= yp->YT_down; + yp->YT_down= new_node; + YTREE_truncated += lng_str - ml; + yp->YT_lng_str= ml; + next_node->YT_info= yp->YT_info; + next_node->YT_flags= yp->YT_flags; + yp->YT_info= 0L; + yp->YT_flags= 0; + + ytree_repack (ypp); + /* yp is now invalid!! */ + + return new_node; + } + else + { +#ifdef DEBUG_001 + printf ("@66 Split2: '%s' key='%s' nach\n", + PI(yp), key, ml); +#endif + + if ((new_node= ytree_alloc (&yp->YT_str [ml], lng_str-ml)) + == (struct YTREE *) 0) return (struct YTREE *) 0; + + new_node->YT_down= yp->YT_down; + yp->YT_down= new_node; + YTREE_truncated += lng_str - ml; + yp->YT_lng_str= ml; + new_node->YT_info= yp->YT_info; + new_node->YT_flags= yp->YT_flags; + yp->YT_info= 0L; + yp->YT_flags= 0; + + ytree_repack (ypp); + /* yp is now invalid!! */ + + if (ml == strlen ((char *) key)) + { /* Neues Wort hat gleiche Laenge wie das bisherige Textsegment */ + return *ypp; /* node was repacked!!! */ + } + + return new_node->YT_next= ytree_alloc (&key [ml], -1); + } + } + else + { /* kein Match */ +#ifdef DEBUG_001 + printf ("@67 Kein Match: '%s' key='%s'\n", PI(yp), key); +#endif + ypp= &yp->YT_next; + + goto CHECK; + } +} + +/* ------------------------------------------------------------------------ */ +#ifdef DEBUG_001 +static V [10][64]; +static int idx= 0; +static char *PI (struct YTREE *s) +{ + int i; + + i= idx++; + if (idx >= 10) idx=0; + strncpy ((char *) V [i], s->YT_str, s->YT_lng_str); + ((char *)V[i])[s->YT_lng_str] = 0; + return (char *) V[i]; +} +#endif diff --git a/lib/ds/ytree/yt_00003.o b/lib/ds/ytree/yt_00003.o new file mode 100644 index 0000000000000000000000000000000000000000..b8eb2356a64f5f800aba8ac4312fbcb5cd114772 Binary files /dev/null and b/lib/ds/ytree/yt_00003.o differ diff --git a/lib/ds/ytree/yt_00004.c b/lib/ds/ytree/yt_00004.c new file mode 100644 index 0000000000000000000000000000000000000000..ce7d17fb4b91706b167ba5e2c42dcc89bbe6e2b2 --- /dev/null +++ b/lib/ds/ytree/yt_00004.c @@ -0,0 +1,77 @@ +/* + * FILE %ds/ytree/yt_00004.c + * + * ytree_lookup_word: Wort in YTREE Struktur suchen + * + * written: 1991 04 14: aus nl_00006.c abgeleitet + * latest update: 1998-08-07 14:17:34 + * + */ + +/* # define DEBUG_001 */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/ytree.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +static struct YTREE *last_yt= (struct YTREE *) 0; +static int total_match_lng= 0; + +/* ------------------------------------------------------------------------ */ +struct YTREE *ytree_lookup_word ( +struct YTREE *yp, /* Wurzel des YTREEs */ +unsigned char *wort) /* zu suchendes Wort */ +/* Return: Knoten, der die Info-Komponente des Worts enthaelt */ +/* (struct YTREE *) 0 ... nicht gefunden */ +{ + int ml; /* match length */ + + total_match_lng= 0; + last_yt= (struct YTREE *) 0; + + if (wort == (unsigned char *) 0) return (struct YTREE *) 0; + + while (yp != (struct YTREE *) 0 + && yp->YT_str[0] <= *wort) /* lexicographische Sortierung */ + { + if ((ml= match_lng ((char *) yp->YT_str, + (char *) wort, yp->YT_lng_str)) > 0) + { + if (ml == strlen ((char *) wort) && ml == yp->YT_lng_str) return yp; + + if (ml == yp->YT_lng_str) + { /* Textsegment kommt auch in str vor und */ + /* Wort ist laenger als das Textsegment */ + /* z.B. yp->YTstr = 'AB' */ + /* wort = 'ABCD' */ + /* -> ml = 2 */ + total_match_lng += ml; + last_yt= yp; + wort= &wort [ml]; + yp= yp->YT_down; + } + else return (struct YTREE *) 0; + } + else yp= yp->YT_next; + } + + return (struct YTREE *) 0; +} + +/* ------------------------------------------------------------------------ */ +struct YTREE *ytree_lookup_word_get_last () +{ + return last_yt; +} + +/* ------------------------------------------------------------------------ */ +int ytree_lookup_word_get_lng () +{ + return total_match_lng; +} diff --git a/lib/ds/ytree/yt_00004.o b/lib/ds/ytree/yt_00004.o new file mode 100644 index 0000000000000000000000000000000000000000..9aab132602e03d2411d581086955afaf2fa05987 Binary files /dev/null and b/lib/ds/ytree/yt_00004.o differ diff --git a/lib/ds/ytree/yt_00005.c b/lib/ds/ytree/yt_00005.c new file mode 100644 index 0000000000000000000000000000000000000000..095b5cb8d36080293d559ebe112219572faa300f --- /dev/null +++ b/lib/ds/ytree/yt_00005.c @@ -0,0 +1,150 @@ +/* + * FILE %ds/ytree/yt_00005.c + * + * ytree_delete_word: Wort-Eintrag aus YTREE entfernen + * + * written: 1990 06 08 + * latest update: 1996-01-21 23:34:00 + * + */ + +/* #define DEBUG_001 */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +#ifdef DEBUG_001 +static V [10][64]; +static int idx= 0; +static char *PI (struct YTREE *s) +{ + int i; + + i= idx++; + if (idx >= 10) idx=0; + strncpy ((char *) V [i], s->YT_str, s->YT_lng_str); + ((char *)V[i])[s->YT_lng_str] = 0; + return (char *) V[i]; +} +#endif + +/* ------------------------------------------------------------------------ */ +int ytree_delete_word ( +struct YTREE **ypp, /* Wurzel des bearbeiteten YTREEs */ +unsigned char *wort) /* zu loeschendes Wort */ +/* Return: <0 .. Error */ +{ + struct YTREE *tmp; + struct YTREE *yp; /* yp= *ypp */ + int ml; + +#ifdef DEBUG_001 + char *PI(); + printf ("@61 YT_score_word *ypp=%08lX wort='%s'\n", *ypp, wort); +#endif + + if (ypp == (void *) 0) return -1; /* ERROR: YTREE empty */ + +CHECK: + if (*ypp == (struct YTREE *) 0 + || (*ypp)->YT_str [0] > *wort) /* lexicographische sortierung */ + { /* wort existiert nicht im YTREE, falls dieser richtig */ + /* sortiert war; --> also ist alles bestens :-) */ +#ifdef DEBUG_001 + printf ("@62 Wort '%s' nicht im YTREE vorhanden\n", wort); +#endif + return 0; + } + + yp= *ypp; +#ifdef DEBUG_001 + printf ("@62a Compare: '%s' '%s' -> ml=%d\n", PI(yp), wort, + match_lng (yp->YT_str, wort, yp->YT_lng_str)); +#endif + + if ((ml= match_lng ((char *) yp->YT_str, (char *) wort, yp->YT_lng_str)) > 0) + { + if (ml == strlen ((char *) wort) && ml == yp->YT_lng_str) + { /* exakter Match */ +#ifdef DEBUG_001 + printf ("@63 Exakter Match: '%s'\n", wort); +#endif + /* ypp zeigt auf den Pointer, der die Adresse des Knoten enthaelt, */ + /* der das Wort-Ende des gesuchten Wortes darstellt. */ + /* Wenn dort das EOW-Flag nicht gesetzt ist, dann ist das Wort */ + /* eigentlich gar nicht gespeichert. (Dieser Fall muss nicht extra */ + /* behandelt werden, da er bei den anderen Faellen abgedeckt wird. */ + /* if (yp->YT_flags & YFflag_EOW) return 0; */ + /* Sonst kann man 3 Faelle unterscheiden: */ + /* Fall A: es gibt KEINE Worte, die noch weitergehen. */ + /* Fall B: es gibt EIN Wort, das noch weitergeht. */ + /* Fall C: es gibt MEHRERE Worte, die noch weitergehen. */ + if (yp->YT_down == (struct YTREE *) 0) + { /* *** FALL A *** */ + *ypp= yp->YT_next; + free (yp); + return 0; + } + else + { + if (yp->YT_down->YT_next == (struct YTREE *) 0) + { /* *** FALL B *** zwei Knoten joinen */ + tmp= ytree_alloc (yp->YT_str, + yp->YT_lng_str + yp->YT_down->YT_lng_str); + memcpy ((&tmp->YT_str [yp->YT_lng_str]), + yp->YT_down->YT_str, + yp->YT_down->YT_lng_str); + tmp->YT_down= yp->YT_down->YT_down; + tmp->YT_flags= yp->YT_down->YT_flags; + tmp->YT_info= yp->YT_down->YT_info; + tmp->YT_next= yp->YT_next; + *ypp= tmp; + free (yp->YT_down); + free (yp); + return 0; + } + else + { /* *** FALL C *** */ + yp->YT_flags= 0; /* ###################### */ + yp->YT_info= 0L; + } + } + + } + + if (ml == yp->YT_lng_str) + { /* Textsegment kommt auch in str vor und */ + /* Wort ist laenger als das Textsegment */ + /* z.B. yp->YTstr = 'AB' */ + /* wort = 'ABCD' */ + /* -> ml = 2 */ +#ifdef DEBUG_001 + printf ("@64 Textsegment '%s' auch in '%s'\n", PI(yp), wort); +#endif + wort= &wort [ml]; + ypp= &yp->YT_down; + goto CHECK; + } + fprintf (stderr, "yt_00005.c(136) internal error!\n"); + return -1; + } + else + { /* kein Match */ +#ifdef DEBUG_001 + printf ("@67 Kein Match: '%s' wort='%s'\n", PI(yp), wort); +#endif + ypp= &yp->YT_next; + goto CHECK; + } + + fprintf (stderr, "yt_00005.c(148) internal error!\n"); + return -1; +} diff --git a/lib/ds/ytree/yt_00005.o b/lib/ds/ytree/yt_00005.o new file mode 100644 index 0000000000000000000000000000000000000000..8131663f67856801e45cd2a6d91ed65f1136758e Binary files /dev/null and b/lib/ds/ytree/yt_00005.o differ diff --git a/lib/ds/ytree/yt_00006.c b/lib/ds/ytree/yt_00006.c new file mode 100644 index 0000000000000000000000000000000000000000..6f7730fe8652195b6894012e8753c00bbc82539c --- /dev/null +++ b/lib/ds/ytree/yt_00006.c @@ -0,0 +1,84 @@ +/* + * FILE %ds/ytree/yt_00006.c + * + * Berechnung des Platzbedarfs eines YTREE-(Sub)-Trees + * + * written: 1990 06 04 + * 1991 03 16: Revision; AIX + * latest update: 1996-01-21 23:27:45 + * + */ + +/* #define DEBUG_001 */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +long ytree_size (struct YTREE *yt) +{ + long siz= 0; /* Platzbedarf der Struktur */ + long siz1; /* Platzbedarf einer Sub-Struktur */ + + /******************************************************** + Entscheiden, ob eine Table erzeugt werden soll oder nicht + ********************************************************/ + + for (; + yt != (struct YTREE *) 0; + yt= yt->YT_next) + { +#ifdef DEBUG_001 + printf ("-------- ytree_size \n"); + ytree_print_node (stdout, yt, 0); +#endif + + /* Platzbedarf fuer den Text-Teil und Info Komponente */ + siz1= ytree_size (yt->YT_down); + + siz1 += (long) yt->YT_lng_str; + if (yt->YT_flags & YTflag_EOW) + { + if (yt->YT_down != (struct YTREE *) 0) + siz1 += 2; /* Wort Info muss uebersprungen werden koennen */ + + siz1 += 5L; /* 0-Code am Ende des Strings */ + } + + if (yt->YT_next != (struct YTREE *) 0) + { + /* ANM: am Ende der Liste darf kein Offset Code gespeichert werden */ + + /* Platzbedarf fuer Offset Codes berechnen */ + if (siz1 < 0x100L) + { + siz1 += 2L; + yt->YT_flags= (yt->YT_flags & YTflag_OFFx) | YTflag_OFF1; + } else if (siz1 < 0x10000L) + { + siz1 += 3L; + yt->YT_flags= (yt->YT_flags & YTflag_OFFx) | YTflag_OFF2; + } else if (siz1 < 0x1000000L) + { + siz1 += 4L; + yt->YT_flags= (yt->YT_flags & YTflag_OFFx) | YTflag_OFF3; + } else + { + siz1 += 5L; + yt->YT_flags= (yt->YT_flags & YTflag_OFFx) | YTflag_OFF4; + } + } + + yt->YT_size= siz1; +#ifdef DEBUG_001 + ytree_print_node (stdout, yt, 0); +#endif + siz += siz1; + } + + return siz; +} diff --git a/lib/ds/ytree/yt_00006.o b/lib/ds/ytree/yt_00006.o new file mode 100644 index 0000000000000000000000000000000000000000..2b6c65c13190386d9df8d66737aeebf73bac2688 Binary files /dev/null and b/lib/ds/ytree/yt_00006.o differ diff --git a/lib/ds/ytree/yt_00007.c b/lib/ds/ytree/yt_00007.c new file mode 100644 index 0000000000000000000000000000000000000000..22f1444f53915e47aea5e6262a6d8fa619397184 --- /dev/null +++ b/lib/ds/ytree/yt_00007.c @@ -0,0 +1,29 @@ +/* + * FILE 1996-01-21 23:32:03 + * + * print a YTREE node + * + * written: 1990 06 02 + * latest update: 1996-01-21 23:32:06 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +int ytree_print (FILE *fo, struct YTREE *yt, int indent) +{ + for (; yt != (struct YTREE *) 0; yt= yt->YT_next) + { + ytree_print_node (fo, yt, indent); + if (yt->YT_down != (struct YTREE *) 0) + ytree_print (fo, yt->YT_down, indent+yt->YT_lng_str); + } + + return 0; +} diff --git a/lib/ds/ytree/yt_00007.o b/lib/ds/ytree/yt_00007.o new file mode 100644 index 0000000000000000000000000000000000000000..0f21afb1134361fb20c2ea0786848648ce5911ee Binary files /dev/null and b/lib/ds/ytree/yt_00007.o differ diff --git a/lib/ds/ytree/yt_00008.c b/lib/ds/ytree/yt_00008.c new file mode 100644 index 0000000000000000000000000000000000000000..b804cfe0c6ba33a7d209aa7b4bf6a4a624e53631 --- /dev/null +++ b/lib/ds/ytree/yt_00008.c @@ -0,0 +1,40 @@ +/* + * FILE %ds/ytree/yt_00008.c + * + * print a YTREE node + * + * written: 1990 06 02 + * 1991 03 16: Revision; AIX + * latest update: 1996-01-21 23:32:26 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +int ytree_print_node ( +FILE *fo, +struct YTREE *yt, +int indent) +{ + int i; + char *cp; + + fprintf (fo, "%08lX (%4d) ", (long) yt, yt->YT_lng_str); + + fprintf (fo, "%4ld ", yt->YT_size); + + fprintf (fo, "0x%04X ", yt->YT_flags); + for (i= 0; i < indent; i++) fputc (' ', fo); + + cp= (char *) yt->YT_str; + for (i= yt->YT_lng_str; i > 0; i--) fputc (*cp++, fo); + fputc ('\n', fo); + + return 0; +} diff --git a/lib/ds/ytree/yt_00008.o b/lib/ds/ytree/yt_00008.o new file mode 100644 index 0000000000000000000000000000000000000000..89392320642617a9ccc78f4ab080baebfbe13044 Binary files /dev/null and b/lib/ds/ytree/yt_00008.o differ diff --git a/lib/ds/ytree/yt_00009.c b/lib/ds/ytree/yt_00009.c new file mode 100644 index 0000000000000000000000000000000000000000..3b5549623cc9f7c1ee51c6a7686b3c775186e132 --- /dev/null +++ b/lib/ds/ytree/yt_00009.c @@ -0,0 +1,64 @@ +/* + * FILE %ds/ytree/yt_00009.c + * + * Ausgeben des YTREEs im LUT-Format + * + * written: 1990 06 04 + * 1991 03 15: Revision; AIX + * latest update: 1996-01-21 23:26:41 + * + */ + +/* #define DEBUG_001 */ +/* #define DEBUG_002 */ /* Vergleich mit dem ZTREE Verfahren */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dpp.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +long ytree_dump (FILE *fo, struct YTREE *yt) +{ + long unique= 0; /* Zahl der verschiedenen Eintraege */ + int i; + char *cp; + + for (; + yt != (struct YTREE *) 0; + yt= yt->YT_next) + { + /* Offset Code ausgeben */ + if ((i= yt->YT_flags & YTflag_OFF) != 0) + { + i= i >> 4; + fputc (i, fo); + dpp_fwrite_long (fo, yt->YT_size-i-1, i); + } + + cp= (char *) yt->YT_str; + for (i= yt->YT_lng_str; i > 0; i--) fputc (*cp++, fo); + + if (yt->YT_flags & YTflag_EOW) /* Ende eines Wortes */ + { + if (yt->YT_down != (struct YTREE *) 0) + { /* Sonderfall: bisheriger String ist einerseits selbst eine Wort */ + /* als auch Prefix eines anderen Wortes! */ + /* Bsp: abc ... Wort; abcdef ... Wort */ + /* daher: Wort Info muss uebersprungen werden koennen */ + fputc (0x01, fo); /* sonst: 0x01 0x05 */ + fputc (0x05, fo); + } + + unique++; + fputc (0, fo); /* End-of-Word Code */ + dpp_fwrite_long (fo, yt->YT_info, 4); + } + unique += ytree_dump (fo, yt->YT_down); + } + + return unique; +} diff --git a/lib/ds/ytree/yt_00009.o b/lib/ds/ytree/yt_00009.o new file mode 100644 index 0000000000000000000000000000000000000000..9fc62a5e3255c12b79c8eea7f1f7435b7b782f47 Binary files /dev/null and b/lib/ds/ytree/yt_00009.o differ diff --git a/lib/ds/ytree/yt_00010.c b/lib/ds/ytree/yt_00010.c new file mode 100644 index 0000000000000000000000000000000000000000..7729151c4d9a98c5011d1e6f85fa9c42f3949465 --- /dev/null +++ b/lib/ds/ytree/yt_00010.c @@ -0,0 +1,170 @@ +/* + * FILE %ds/ytree/yt_00010.c + * + * LUT in YTREE einscannen; + * YTREE wird knotenweise aus der LUT aufgebaut. + * + * Damned, damned, damned .... da ist ein Hund drinn!!!!!! + * + * written: 1990 11 11: in Anlehnung an lut_dump in LUT_0004.C + * 1991 03 16: Revision; AIX + * latest update: 1993-07-24 + * $Id: yt_00010.c,v 1.3 2003/06/25 14:38:29 gonter Exp $ + * + */ + +/** #define DEBUG_003 **/ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <gg/ytree.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +static unsigned char lut_word_buffer [4096]; + +#ifdef DEBUG_003 +#define xxxerr stdout +static void cdecl dump_stack (int tos); +static void cdecl printf_wrd (int idx); +#else +#define xxxerr stderr +#endif + +/* ------------------------------------------------------------------------ */ +struct YT_STACK +{ + long offs; + struct YTREE **yta; +} ; + +# define YT_STACK_SIZE 48 +struct YT_STACK yt_stack [YT_STACK_SIZE]; + +/* ------------------------------------------------------------------------ */ +int ytree_scan ( +FILE *lut, /* Look Up Table; binaer eroeffnet */ +struct YTREE **ytp) /* erzeugter YTREE */ +{ + int idx= 0; /* untersuchte Stelle im Key (Suchwort) */ + struct YTREE *y; + int tos= 0; + int cp; + long cp2, v; + +#ifdef DEBUG_003 +printf ("\n"); +#endif + for (;;) + { + cp=fgetc (lut) & 0x00FF; + if (feof (lut)) break; +#ifdef DEBUG_003 + printf ("cp=0x%02X tos=%d ytp=%08lX *ytp=%08lX [tos]=%08lX idx=%d w=", + cp, tos, (long) ytp, (long) *ytp, + (long) ((tos) ? yt_stack[tos-1].yta : 0), + idx); + printf_wrd (idx); + dump_stack (tos); +#endif + + switch (cp) + { + case 0: /* Wortende gefunden */ + if (idx == 0) + { + /* ERROR !!!!!, oder so... ???? */ + fprintf (xxxerr, "ytree_scan: %d empty node to create!!!\n", __LINE__); + if (tos == 0) goto OVER; /* Ende des Scan Bereichs */ + y= *(yt_stack [tos-1].yta); + } + else *ytp= y= ytree_alloc (lut_word_buffer, idx); + +#ifdef DEBUG_003 + printf ("Alloc1: %08lX %d ", (long) y, idx); + printf_wrd(idx); +#endif + if (y == (void *) 0) + { + fprintf (xxxerr, "ytree_scan: out of memory!\n"); + goto OVER; + } + y->YT_info= dpp_fread_long (lut, 4); + y->YT_flags |= YTflag_EOW; + idx=0; + + if (tos==0) goto OVER; /* Ende des Scan Bereichs */ + tos--; + fseek (lut, yt_stack [tos].offs, 0); + ytp= yt_stack [tos].yta; + ytp= &(*ytp)->YT_next; + break; + + default: + lut_word_buffer [idx++] = (char) cp; + break; + + /* Offset Codes */ + case 1: + case 2: + case 3: + case 4: + v= dpp_fread_long (lut, cp); + cp2= ftell (lut) + v; + if (tos >= YT_STACK_SIZE) + { + fprintf (xxxerr, "ytree_scan: internal stack overflow!\n"); + goto OVER; + } + yt_stack [tos].yta= ytp; + yt_stack [tos].offs= cp2; + tos++; + if (idx) + { + *ytp= y= ytree_alloc (lut_word_buffer, idx); +#ifdef DEBUG_003 + printf ("Alloc2: %08lX %d ", (long) y, idx); + printf_wrd(idx); +#endif + if (y == (void *) 0) + { + fprintf (xxxerr, "ytree_scan: out of memory!\n"); + goto OVER; + } + ytp= &y->YT_down; + idx= 0; + } + break; + } + } + +OVER: + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef DEBUG_003 +static void printf_wrd (int idx) +{ + int i; + + for (i=0;i<idx;i++) fputc (lut_word_buffer [i], stdout); + fputc ('\n', stdout); +} + +static void dump_stack (int tos) +{ + for (tos--; tos >= 0; tos--) + { + printf ("[%2d] offs=%lX yta=%lX *yta=%lX\n", + tos, + yt_stack[tos].offs, + (long) yt_stack[tos].yta, + (long) *(yt_stack[tos].yta)); + } +} +#endif diff --git a/lib/ds/ytree/yt_00010.o b/lib/ds/ytree/yt_00010.o new file mode 100644 index 0000000000000000000000000000000000000000..71ddd0c5c9ffa15ab20b3ece475af3dc551ad6ec Binary files /dev/null and b/lib/ds/ytree/yt_00010.o differ diff --git a/lib/ds/ytree/yt_00011.c b/lib/ds/ytree/yt_00011.c new file mode 100644 index 0000000000000000000000000000000000000000..802b01c7c76cf0a60934c9f553f402873ec83988 --- /dev/null +++ b/lib/ds/ytree/yt_00011.c @@ -0,0 +1,176 @@ +/* + * FILE %ds/ytree/yt_00011.c + * + * LUT in YTREE einscannen; + * YTREE wird durch Einfuegen von vollstaendigen Worten aufgebaut. + * + * written: 1989 06 11: aus WORDCR01.C isolierte Funktionen: + * check_word -> lookup_char + * check_word_file -> lookup_file + * 1990 01 20: zerlegt in Library-Module + * 1991 03 16: Revision; AIX + * 1991 04 26: Erweiterung durch kill-lists + * Umbennennung von ytree_2scan in + * ytree_full_scan, da diese Funktion jetzt + * gegenueber ytree_scan eine echte + * Daseinsberechtigung, ueber die Tatsache + * hinausgehend, dass ytree_scan nicht immer + * funktionierte, hat. + * 2003-06-25 vgl. lut_process_block () + * latest update: 1996-08-08 16:33:29 + * $Id: yt_00011.c,v 1.5 2003/06/25 14:38:29 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +#define BUFFER_SIZE 4096 + +/* ------------------------------------------------------------------------ */ +int ytree_full_scan ( +FILE *lut, /* Look Up Table */ +struct YTREE **ytp, +long kill_by_info [], /* entries not to be included by info value */ +int kill_by_info_cnt, /* number of ^^^^ */ +char *kill_by_str [], /* entries not to be included by string */ +int kill_by_str_cnt) /* number of ^^^^ */ +{ + int idx= 0; /* untersuchte Stelle im Key (Suchwort) */ + int rc= -1; /* return code of this function */ + int cp; + int i; /* loop index */ + long retry_position; /* restart position */ + long skip; /* skip (offset) code */ + long info; /* info contents of node */ + struct YTREE *y; + struct LUT_STACK *lut_stack= (struct LUT_STACK *) 0; /* Suchpfad */ + unsigned char lut_word_buffer [ZTREE_DEPTH_MAX]; + long cnt= 0L; + +printf ("yt_00011: %d\n", __LINE__); + + if ((lut_stack= malloc (sizeof (struct LUT_STACK)*ZTREE_DEPTH_MAX)) + == (struct LUT_STACK *) 0 + ) return -1; + +printf ("yt_00011: %d\n", __LINE__); + + lut_stack [0].offset= ftell (lut); + +#ifdef DIAGNOSTIC +/*** BEGIN DIAGNOSTIC OUTPUT ************************************************/ +printf ("kill_by_info_cnt=%d kill_by_str_cnt=%d\n", + kill_by_info_cnt, kill_by_str_cnt); +for (i= 0; i < kill_by_info_cnt; i++) + printf ("kill_by_info [%d]= 0x%lX\n", i, kill_by_info [i]); +for (i= 0; i < kill_by_str_cnt; i++) + printf ("kill_by_str [%d]= '%s'\n", i, kill_by_str [i]); +/*** END DIAGNOSTIC OUTPUT **************************************************/ +#endif /* DIAGNOSTIC */ + + retry_position= -1L; + for (;;) + { + cp= fgetc (lut) & 0x00FF; + if (feof (lut)) + { + long pos; + pos= ftell (lut); + printf ("yt_00011: %d pos=%ld\n", __LINE__, pos); + break; + } + cnt++; + + switch (cp) + { + case 0: /* Wortende gefunden */ + info= dpp_fread_long (lut, 4); + + lut_word_buffer[idx]= 0; + for (i= 0; i < kill_by_info_cnt; i++) + if (info == kill_by_info [i]) goto BREAK; + for (i= 0; i < kill_by_str_cnt; i++) + if (strcmp ((char *) lut_word_buffer, kill_by_str [i]) == 0) + goto BREAK; + +/*** +if (lut_word_buffer[0] == 'z') +printf ("idx=%d lut_word_buffer='%s'\n", idx, lut_word_buffer); +***/ + + if ((y= ytree_insert_word (ytp, lut_word_buffer)) + == (struct YTREE *) 0) + { + fprintf (stderr, "ytree_scan: new word not in tree (memory?)\n"); + goto ERROR; + } + y->YT_flags |= YTflag_EOW; + y->YT_info= info; + +BREAK: + while (lut_stack [idx].offset == 0L) + { + idx--; + if (idx < 0) + { + printf ("idx=%d, OVER\n", idx); + goto OVER; + } + } + fseek (lut, lut_stack [idx].offset, 0); + lut_stack [idx].offset= 0L; + break; + + default: + if (idx >= ZTREE_DEPTH_MAX) + { + fprintf (stderr, "LUT key length exceed; stopping %d\n", __LINE__); + goto OVER; + } + + lut_stack [idx].key= cp; + lut_word_buffer [idx]= (unsigned char) cp; + idx++; + if (idx >= ZTREE_DEPTH_MAX) + { + fprintf (stderr, "LUT key length exceed; stopping %d\n", __LINE__); + goto OVER; + } + lut_word_buffer [idx]= 0; + lut_stack [idx].offset= 0L; + break; + + /* Offset Codes */ + case 1: + case 2: + case 3: + case 4: + skip= dpp_fread_long (lut, cp); + retry_position= ftell (lut) + skip; + lut_stack [idx].offset= retry_position; + break; + } + } + +printf ("yt_00011: %d\n", __LINE__); + +OVER: + rc= 0; +printf ("yt_00011: %d cnt=%ld\n", __LINE__, cnt); + +ERROR: +printf ("yt_00011: %d\n", __LINE__); + free_or_what (lut_stack); + + return rc; +} diff --git a/lib/ds/ytree/yt_00011.o b/lib/ds/ytree/yt_00011.o new file mode 100644 index 0000000000000000000000000000000000000000..becbf0b05962a93a843f760faa0db57fc3659832 Binary files /dev/null and b/lib/ds/ytree/yt_00011.o differ diff --git a/lib/ds/ytree/yt_00012.c b/lib/ds/ytree/yt_00012.c new file mode 100644 index 0000000000000000000000000000000000000000..101776d5e358e3a6aeb53f8789a824a308b51835 --- /dev/null +++ b/lib/ds/ytree/yt_00012.c @@ -0,0 +1,34 @@ +/* + * FILE %ds/ytree/yt_00012.c + * + * process a YTREE structure + * + * see also: ytree_process_info () + * + * written: 1994-08-04 + * latest update: 1996-06-22 10:02:40 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +int ytree_process ( +struct YTREE *yt, +YTREE_PROCESSOR *processor, +void *client_data) +{ + for (; yt != (struct YTREE *) 0; yt= yt->YT_next) + { + (*processor) (yt, client_data); + + if (yt->YT_down != (struct YTREE *) 0) + ytree_process (yt->YT_down, processor, client_data); + } + + return 0; +} diff --git a/lib/ds/ytree/yt_00012.o b/lib/ds/ytree/yt_00012.o new file mode 100644 index 0000000000000000000000000000000000000000..66d8bb368ea6308ddb96adc6b92eeab0d2ee0dc9 Binary files /dev/null and b/lib/ds/ytree/yt_00012.o differ diff --git a/lib/ds/ytree/yt_00013.c b/lib/ds/ytree/yt_00013.c new file mode 100644 index 0000000000000000000000000000000000000000..3955b781a65e249b2f7852efc69740c67c6b129b --- /dev/null +++ b/lib/ds/ytree/yt_00013.c @@ -0,0 +1,127 @@ +/* + * FILE %ds/ytree/yt_00013.c + * + * written: 1994-12-08 + * latest update: 1996-08-08 16:34:33 + * $Id: yt_00013.c,v 1.3 2003/06/25 14:38:29 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/lookup.h> + +#define LINE_SIZE 128 +static char line [LINE_SIZE]; + +#define N_FIELDS 10 +static char *fields [N_FIELDS]; + +/* ------------------------------------------------------------------------ */ +int ytree_operations ( +struct YTREE **ytpp, +FILE *fi, +FILE *fo) +{ + struct YTREE *yt; + char *var_name; + int cnt_fields; + int rc; + char *op; + + for (;;) + { + fputs ("% ", fo); + fread_line (fi, line, LINE_SIZE); + if (line [0] == '#') continue; + if (feof (fi)) break; + + cnt_fields= isolate_tokens (line, (char **) fields, N_FIELDS); + + if (cnt_fields < 1) continue; + op= fields [0]; + if (strcmp (op, "quit") == 0 + || strcmp (op, "\004") == 0 + || strcmp (op, "exit") == 0 + ) break; + + if (strcmp (op, "set") == 0 && cnt_fields == 3) + { + if ((yt= ytree_insert_word (ytpp, (unsigned char *) fields [1])) + == (struct YTREE *) 0) + { + fprintf (fo, "error: yt == NIL\n"); + break; + } + if (yt->YT_flags & YTflag_EOW) + { + char *cp; + cp= (char *) yt->YT_info; + fprintf (fo, "previous value was %s\n", + (cp == (char *) 0) ? "NIL" : cp); + if (cp != (char *) 0) free (cp); + } + yt->YT_info= (long) strdup (fields [2]); + yt->YT_flags |= YTflag_EOW; + continue; + } + + if (strcmp (op, "query") == 0 && cnt_fields == 2) + { + var_name= fields [1]; + yt= ytree_lookup_word (*ytpp, (unsigned char *) var_name); + if (yt == (struct YTREE *) 0) + { + fprintf (fo, "%s is undefined!\n", var_name); + } + else + { + if (yt->YT_flags & YTflag_EOW) + { + fprintf (fo, "%s's value is \"%s\"\n", var_name, yt->YT_info); + } + else + { + fprintf (fo, "%s is an intermediate node!\n", var_name); + } + } + continue; + } + + if (strcmp (op, "delete") == 0 && cnt_fields == 2) + { + var_name= fields [1]; + rc= ytree_delete_word (ytpp, (unsigned char *) var_name); + fprintf (fo, "rc= %d\n", rc); + continue; + } + + if (strcmp (op, "print") == 0 && cnt_fields == 1) + { + ytree_size (*ytpp); + ytree_print (fo, *ytpp, 2); + continue; + } + + if (strcmp (op, "lut") == 0 && cnt_fields == 2) + { + int rc; + rc= lut_process (fields [1], lut_ytree_entry, (void *) ytpp, 0L); + printf ("rc=%d\n", rc); + continue; + } + + if (strcmp (op, "size") == 0 && cnt_fields == 1) + { + long s; + s= ytree_size (*ytpp); + printf ("size=%ld\n", s); + } + + fprintf (fo, "invalid command or syntax\n"); + } + return 0; +} diff --git a/lib/ds/ytree/yt_00013.o b/lib/ds/ytree/yt_00013.o new file mode 100644 index 0000000000000000000000000000000000000000..b331693d336c53c6a2aa6513c17079da93ec46d5 Binary files /dev/null and b/lib/ds/ytree/yt_00013.o differ diff --git a/lib/ds/ytree/yt_00014.c b/lib/ds/ytree/yt_00014.c new file mode 100644 index 0000000000000000000000000000000000000000..436ce290775dbd8452f081827e230165a4faf1e0 --- /dev/null +++ b/lib/ds/ytree/yt_00014.c @@ -0,0 +1,22 @@ +/* + * FILE %ds/ytree/yt_00014.c + * + * print a YTREE node for debugging reasons + * + * written: 1994-12-11 + * latest update: 1996-01-21 23:37:11 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +int ytree_debug (struct YTREE *yt) +{ + return ytree_print (stdout, yt, 2); +} diff --git a/lib/ds/ytree/yt_00014.o b/lib/ds/ytree/yt_00014.o new file mode 100644 index 0000000000000000000000000000000000000000..fd8d2c458080c48e7eb83cd0b834508f608b98d4 Binary files /dev/null and b/lib/ds/ytree/yt_00014.o differ diff --git a/lib/ds/ytree/yt_00015.c b/lib/ds/ytree/yt_00015.c new file mode 100644 index 0000000000000000000000000000000000000000..3f63c5ded3d86e12fcba601fffbf586c6bcb5d87 --- /dev/null +++ b/lib/ds/ytree/yt_00015.c @@ -0,0 +1,30 @@ +/* + * FILE %ds/ytree/yt_00015.c + * + * write out lut file + * + * written: 1995-01-07 + * latest update: 1996-01-21 23:37:30 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +int ytree_dump_to_lut_file (char *name_lut, struct YTREE *yt) +{ + FILE *lut; + + /* write lut file back */ + if ((lut= fopen (name_lut, "wb")) == (FILE *) 0) return -1; + ytree_size (yt); + ytree_dump (lut, yt); + fclose (lut); + + return 0; +} diff --git a/lib/ds/ytree/yt_00015.o b/lib/ds/ytree/yt_00015.o new file mode 100644 index 0000000000000000000000000000000000000000..52e2ca0c60a5f06695757015072d303b2d05af9e Binary files /dev/null and b/lib/ds/ytree/yt_00015.o differ diff --git a/lib/ds/ytree/yt_00016.c b/lib/ds/ytree/yt_00016.c new file mode 100644 index 0000000000000000000000000000000000000000..138563b2165dbba70b8d87e9fa7678a01ad9196a --- /dev/null +++ b/lib/ds/ytree/yt_00016.c @@ -0,0 +1,32 @@ +/* + * FILE %ds/ytree/yt_00016.c + * + * ytree_set_value: set info pointer to a particular value + * + * written: 1995-08-30 + * latest update: 1996-01-07 23:59:20 + * $Id: yt_00016.c,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +long ytree_set_value (struct YTREE **ytp, const unsigned char *w, long v) +{ + struct YTREE *yt; + long v2= 0L; + + if ((yt= ytree_insert_word (ytp, (unsigned char *) w)) != (struct YTREE *) 0) + { + v2= yt->YT_info; + yt->YT_info= v; + yt->YT_flags |= YTflag_EOW; + } + + return v2; +} diff --git a/lib/ds/ytree/yt_00016.o b/lib/ds/ytree/yt_00016.o new file mode 100644 index 0000000000000000000000000000000000000000..31c30977947cefc1afc941022da0a1ec4faa9a9c Binary files /dev/null and b/lib/ds/ytree/yt_00016.o differ diff --git a/lib/ds/ytree/yt_00017.c b/lib/ds/ytree/yt_00017.c new file mode 100644 index 0000000000000000000000000000000000000000..07116b3a8bd28bde9409e1aed867e4bbbec92196 --- /dev/null +++ b/lib/ds/ytree/yt_00017.c @@ -0,0 +1,38 @@ +/* + * FILE %ds/ytree/yt_00017.c + * + * ytree_set_value: set info pointer to a particular value + * + * written: 1995-11-08 + * latest update: 1997-08-03 20:45:56 + * $Id: yt_00017.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +long ytree_increment_value (struct YTREE **ytp, const unsigned char *w, long v) +{ + struct YTREE *yt; + long v2= 0L; + + if ((yt= ytree_insert_word (ytp, (unsigned char *) w)) == (struct YTREE *) 0) return 0L; + + if (yt->YT_flags & YTflag_EOW) + { + v2= yt->YT_info; + yt->YT_info += v; + } + else + { + yt->YT_info= v; + yt->YT_flags |= YTflag_EOW; + } + + return v2; +} diff --git a/lib/ds/ytree/yt_00017.o b/lib/ds/ytree/yt_00017.o new file mode 100644 index 0000000000000000000000000000000000000000..a8063d651c41d529543034e9a16881b71b9cac0b Binary files /dev/null and b/lib/ds/ytree/yt_00017.o differ diff --git a/lib/ds/ytree/yt_00018.c b/lib/ds/ytree/yt_00018.c new file mode 100644 index 0000000000000000000000000000000000000000..1051adf17b94ce397f99a5b843d81051f1f7081b --- /dev/null +++ b/lib/ds/ytree/yt_00018.c @@ -0,0 +1,28 @@ +/* + * FILE %ds/ytree/yt_00018.c + * + * ytree_set_value: set info pointer to a particular value + * + * written: 1995-11-08 + * latest update: 1995-11-08 + * $Id: yt_00018.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +long ytree_get_value (struct YTREE *ytp, const unsigned char *w) +{ + struct YTREE *yt; + + if ((yt= ytree_lookup_word (ytp, (unsigned char *) w)) == (struct YTREE *) 0 + || !(yt->YT_flags & YTflag_EOW) + ) return 0L; + + return yt->YT_info; +} diff --git a/lib/ds/ytree/yt_00018.o b/lib/ds/ytree/yt_00018.o new file mode 100644 index 0000000000000000000000000000000000000000..f95c17d3c6dda7026531032fc8081487a51dcdb3 Binary files /dev/null and b/lib/ds/ytree/yt_00018.o differ diff --git a/lib/ds/ytree/yt_00019.c b/lib/ds/ytree/yt_00019.c new file mode 100644 index 0000000000000000000000000000000000000000..908f467c2d887b5adeb021680c1b1f819f9e85f5 --- /dev/null +++ b/lib/ds/ytree/yt_00019.c @@ -0,0 +1,36 @@ +/* + * FILE %ds/ytree/yt_00019.c + * + * ytree_alloc: create a new YTREE node + * + * written: 1995-12-03 + * latest update: 1995-12-03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +struct YTREE *ytree_duplicate ( +struct YTREE *yt) +{ + struct YTREE *yt_new; + + if (yt == (struct YTREE *) 0 + || (yt_new= ytree_alloc (yt->YT_str, yt->YT_lng_str)) + == (struct YTREE *) 0 + ) + return (struct YTREE *) 0; + + yt_new->YT_next= yt->YT_next; + yt_new->YT_down= yt->YT_down; + yt_new->YT_size= yt->YT_size; + yt_new->YT_info= yt->YT_info; + yt_new->YT_flags= yt->YT_flags; + + return yt_new; +} diff --git a/lib/ds/ytree/yt_00019.o b/lib/ds/ytree/yt_00019.o new file mode 100644 index 0000000000000000000000000000000000000000..ebee6bc2047cc4b38cfb56bf9ee357606598d8c4 Binary files /dev/null and b/lib/ds/ytree/yt_00019.o differ diff --git a/lib/ds/ytree/yt_00020.c b/lib/ds/ytree/yt_00020.c new file mode 100644 index 0000000000000000000000000000000000000000..252513aac26ce54c052d19785a13ffe360ae3614 --- /dev/null +++ b/lib/ds/ytree/yt_00020.c @@ -0,0 +1,33 @@ +/* + * FILE %ds/ytree/yt_00020.c + * + * ytree_alloc: create a new YTREE node + * + * written: 1995-12-03 + * latest update: 1995-12-03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +int ytree_repack (struct YTREE **ytp) +{ + struct YTREE *yt_new; + struct YTREE *yt_old; + + if (ytp == (struct YTREE **) 0 + || (yt_old= *ytp) == (struct YTREE *) 0 + || (yt_new= ytree_duplicate (yt_old)) == (struct YTREE *) 0 + ) + return -1; + + *ytp= yt_new; + ytree_free_node (yt_old); + + return 0; +} diff --git a/lib/ds/ytree/yt_00020.o b/lib/ds/ytree/yt_00020.o new file mode 100644 index 0000000000000000000000000000000000000000..902a2701abcc3691dee30e24118d3e1f2d030f31 Binary files /dev/null and b/lib/ds/ytree/yt_00020.o differ diff --git a/lib/ds/ytree/yt_00021.c b/lib/ds/ytree/yt_00021.c new file mode 100644 index 0000000000000000000000000000000000000000..4316ede0ebac26e2863d95ecb40168ce9f4c1d99 --- /dev/null +++ b/lib/ds/ytree/yt_00021.c @@ -0,0 +1,52 @@ +/* + * FILE %ds/ytree/yt_00021.c + * + * track a YTREE structure + * sse also: ytree_process + * + * written: 1996-04-06 + * latest update: 1996-08-08 16:35:41 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +int ytree_track ( +struct YTREE *yt, +char *buffer, +int buffer_size, +int buffer_pos, +YTREE_TRACKER *tracker, +void *client_data) +{ + int pfx_lng; /* length of current ytree prefix */ + int str_lng; /* length of constructed string sofar */ + + for (; yt != (struct YTREE *) 0; yt= yt->YT_next) + { + pfx_lng= yt->YT_lng_str; + if (buffer_pos+pfx_lng > buffer_size) + { /* oh, oh! */ + pfx_lng= buffer_size-buffer_pos-1; + } + + str_lng= buffer_pos + pfx_lng; + strncpy (buffer+buffer_pos, (char *) yt->YT_str, pfx_lng); + buffer [str_lng]= 0; + + (*tracker) (yt, buffer, client_data); + + if (yt->YT_down != (struct YTREE *) 0) + ytree_track (yt->YT_down, + buffer, buffer_size, str_lng, + tracker, client_data); + } + + return 0; +} diff --git a/lib/ds/ytree/yt_00021.o b/lib/ds/ytree/yt_00021.o new file mode 100644 index 0000000000000000000000000000000000000000..2c6d3e5d439af4d10d0ad47e87658eeb88612539 Binary files /dev/null and b/lib/ds/ytree/yt_00021.o differ diff --git a/lib/ds/ytree/yt_00022.c b/lib/ds/ytree/yt_00022.c new file mode 100644 index 0000000000000000000000000000000000000000..cfd03f289b9a9aa17a0c999980f3c786b3cbf13d --- /dev/null +++ b/lib/ds/ytree/yt_00022.c @@ -0,0 +1,39 @@ +/* + * FILE %ds/ytree/yt_00022.c + * + * process a YTREE structure + * + * see also: ytree_process () + * + * written: 1996-06-22 + * latest update: 1996-06-22 9:59:49 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +int ytree_process_info ( +struct YTREE *yt, +YTREE_INFO_PROCESSOR *processor, +void *client_data) +{ + long info; + + for (; yt != (struct YTREE *) 0; yt= yt->YT_next) + { + if ((yt->YT_flags & YTflag_EOW) + && (info= yt->YT_info) != (long) 0 + ) + (*processor) (info, client_data); + + if (yt->YT_down != (struct YTREE *) 0) + ytree_process_info (yt->YT_down, processor, client_data); + } + + return 0; +} diff --git a/lib/ds/ytree/yt_00022.o b/lib/ds/ytree/yt_00022.o new file mode 100644 index 0000000000000000000000000000000000000000..6ef09ec58a7863e02372cc47e7d88b5e274359aa Binary files /dev/null and b/lib/ds/ytree/yt_00022.o differ diff --git a/lib/ds/ytree/yt_00023.c b/lib/ds/ytree/yt_00023.c new file mode 100644 index 0000000000000000000000000000000000000000..7dfebf037e08e50bf2945debca89cb642f61b4e9 --- /dev/null +++ b/lib/ds/ytree/yt_00023.c @@ -0,0 +1,56 @@ +/* + * FILE %ds/ytree/yt_00023.c + * + * track a YTREE structure + * sse also: ytree_process + * + * written: 1996-06-23 + * latest update: 1996-12-01 22:06:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +int ytree_track_info ( +struct YTREE *yt, +char *buffer, +int buffer_size, +int buffer_pos, +YTREE_INFO_TRACKER *tracker, +void *client_data) +{ + int pfx_lng; /* length of current ytree prefix */ + int str_lng; /* length of constructed string sofar */ + long info; + + for (; yt != (struct YTREE *) 0; yt= yt->YT_next) + { + pfx_lng= yt->YT_lng_str; + if (buffer_pos+pfx_lng > buffer_size) + { /* oh, oh! */ + pfx_lng= buffer_size - buffer_pos-1; + } + + str_lng= buffer_pos + pfx_lng; + strncpy (buffer+buffer_pos, (char *) yt->YT_str, pfx_lng); + buffer [str_lng]= 0; + + if ((yt->YT_flags & YTflag_EOW) + && (info= yt->YT_info) != (long) 0 + ) + (*tracker) (info, buffer, client_data); + + if (yt->YT_down != (struct YTREE *) 0) + ytree_track_info (yt->YT_down, + buffer, buffer_size, str_lng, + tracker, client_data); + } + + return 0; +} diff --git a/lib/ds/ytree/yt_00023.o b/lib/ds/ytree/yt_00023.o new file mode 100644 index 0000000000000000000000000000000000000000..a7d92ec37ad98b56f272167f70768eaa721f9232 Binary files /dev/null and b/lib/ds/ytree/yt_00023.o differ diff --git a/lib/ds/ytree/yt_00101.c b/lib/ds/ytree/yt_00101.c new file mode 100644 index 0000000000000000000000000000000000000000..37d1b53fd0dade924f3c5260e6442b565586c48e --- /dev/null +++ b/lib/ds/ytree/yt_00101.c @@ -0,0 +1,35 @@ +/* + * FILE %ds/ytree/yt_00101.c + * + * ytree_alloc: create a new YTREE node + * + * written: 1996-12-11 + * latest update: 1996-12-11 12:47:48 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/signatur.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +struct YTREE_CONTROL *ytree_new_control (char *name) +{ + struct YTREE_CONTROL *nc; + + if ((nc= (struct YTREE_CONTROL *) + calloc (sizeof (struct YTREE_CONTROL), 1)) + != (struct YTREE_CONTROL *) 0 + ) + { + nc->signature= SIG_YTREE_CONTROL; + if (name != (char *) 0) nc->name= strdup (name); + } + + return nc; +} diff --git a/lib/ds/ytree/yt_00102.c b/lib/ds/ytree/yt_00102.c new file mode 100644 index 0000000000000000000000000000000000000000..c778c38c9ca46dc607c72dd5f5a5822834980390 --- /dev/null +++ b/lib/ds/ytree/yt_00102.c @@ -0,0 +1,41 @@ +/* + * FILE %ds/ytree/yt_00102.c + * + * ytree_free_control: + * destroy a complete ytree control structure + * together with the represented ytree + * + * written: 1996-12-11 + * latest update: 1996-12-11 12:47:48 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +int ytree_free_control (struct YTREE_CONTROL *yc) +{ + YTREE_INFO_PROCESSOR *yt_dt; + void *yt_dt_cd; + + if (yc == (struct YTREE_CONTROL *) 0) return 0; + + if ((yt_dt= yc->destructor) != (YTREE_INFO_PROCESSOR *) 0) + { + yt_dt_cd= yc->destructor_cd; + ytree_process_info (yc->yt, yt_dt, yt_dt_cd); + } + + ytree_free (yc->yt); + free_or_what (yc->name); + free (yc); + + return 0; +} diff --git a/lib/ds/ytree/ytt.c b/lib/ds/ytree/ytt.c new file mode 100644 index 0000000000000000000000000000000000000000..0f27b93bff210d5bf62900cd6c1fa7d10a9488fd --- /dev/null +++ b/lib/ds/ytree/ytt.c @@ -0,0 +1,25 @@ +/* + * FILE %ds/ytree/ytt.c + * + * written: 1994-12-08 + * latest update: 1994-12-08 + * $Id: ytt.c,v 1.2 2003/06/25 14:38:29 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/ytree.h> + + +/* ------------------------------------------------------------------------ */ +static struct YTREE *yt= (struct YTREE *) 0; + +/* ------------------------------------------------------------------------ */ +int cdecl main (void); + +int main () +{ + ytree_operations (&yt, stdin, stdout); + + return 0; +} diff --git a/lib/ds/ytree/ytt2.c b/lib/ds/ytree/ytt2.c new file mode 100644 index 0000000000000000000000000000000000000000..b66f0590d312bf24a65d0b99ead98adae04cc69a --- /dev/null +++ b/lib/ds/ytree/ytt2.c @@ -0,0 +1,77 @@ +/* + * FILE %ds/ytree/ytt.c + * + * written: 2003-06-25 + * latest update: 2003-06-25 + * $Id: ytt2.c,v 1.1 2003/06/25 14:38:29 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/lookup.h> + +/*** #define TEST1 TOO BROKEN ***/ +#define TEST2 /* broken! */ +#define TEST3 +/* ------------------------------------------------------------------------ */ +static struct YTREE *yt1= (struct YTREE *) 0; +static struct YTREE *yt2= (struct YTREE *) 0; +static struct YTREE *yt3= (struct YTREE *) 0; + +/* ------------------------------------------------------------------------ */ +static int ytree_dump_file (struct YTREE *yt, char *fnm) +{ + FILE *FO; + FO= fopen (fnm, "wb"); + if (FO == (FILE *) 0) + { + printf ("cant write to %s\n", fnm); + return -1; + } + ytree_size (yt); + ytree_dump (FO, yt); + fclose (FO); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + char *fnm; + FILE *FI; + int rc1, rc2, rc3; + + if (argc <= 1) + { + printf ("not enough parameters\n"); + return 0; + } + + fnm= argv[1]; + FI= fopen (fnm, "rb"); + if (FI == (FILE *) 0) + { + printf ("cant read %s\n", fnm); + return 0; + } + +#ifdef TEST1 + fseek (FI, 0L, 0); + rc1= ytree_scan (FI, &yt1); + ytree_dump_file (yt1, "@yt1.lut"); +#endif + +#ifdef TEST2 + fseek (FI, 0L, 0); + rc2= ytree_full_scan (FI, &yt2, (long *) 0, 0, (char **) 0, 0); + ytree_dump_file (yt2, "@yt2.lut"); + close (FI); +#endif + +#ifdef TEST3 + yt3= lut_scan_ytree (fnm, 0L); + ytree_dump_file (yt3, "@yt3.lut"); +#endif + + return 0; +} diff --git a/lib/ds/zip/(dirinf).fm b/lib/ds/zip/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..011ea6d24649f62385a7893d1269045c5ce41d4f --- /dev/null +++ b/lib/ds/zip/(dirinf).fm @@ -0,0 +1,24 @@ +# +# FILE %ds/zip/(dirinf).fm +# +# written: 1995-12-25 +# latest update: 1995-12-28 +# + +(dirinf).fm Contents +makefile DOS version of Makefile +make-ux Unix version of Makefile + +# see also: <gg/zip.h> +zs.c ZIP Scanner +zip_0001.c int zip_quick_scan (char *fnm); +zip_0002.c long zip_find_cde_start (FILE *fi, long max_search); +zip_0003.c struct ZIP_CONTROL *zip_init_control (char *fnm); +zip_0004.c int zip_init_LFH (struct ZIP_LOCAL_FILE_HEADER *lfh); +zip_0005.c int zip_init_CFH (struct ZIP_CENTRAL_FILE_HEADER *cfh); +zip_0006.c int zip_init_CDE (struct ZIP_CENTRAL_DIR_END *cde); +zip_0007.c int zip_scan (struct ZIP_CONTROL *zc); +zip_0008.c int zip_delete_control (struct ZIP_CONTROL *zc); + + + diff --git a/lib/ds/zip/.cvsignore b/lib/ds/zip/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..470733c168855617532de5f6ca5b1b0b3dfce42b --- /dev/null +++ b/lib/ds/zip/.cvsignore @@ -0,0 +1 @@ +zs diff --git a/lib/ds/zip/Makefile b/lib/ds/zip/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..8d36d7929e4cc98dc6a264117cc61d907701b222 --- /dev/null +++ b/lib/ds/zip/Makefile @@ -0,0 +1,35 @@ +# +# FILE %ds/zip/make-ux +# +# written: 1995-12-26 +# latest update: 1999-05-08 9:54:06 +# $Id: Makefile,v 1.3 2009/10/13 12:59:25 gonter Exp $ +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include -g +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +# ---------------------------------------------------------------------------- +LIBOBJS0= \ + zip_0001.o zip_0002.o zip_0003.o zip_0004.o zip_0005.o zip_0006.o \ + zip_0007.o zip_0008.o + +all: lib zs +lib: $(LIBOBJS0) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $? + +zs.o : zs.c zip_0007.o + $(CC) $(OPTS) -c zs.c + +zs: zs.o $(LIB) + $(CC) -o zs zs.o $(LIB) + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib diff --git a/lib/ds/zip/contrib b/lib/ds/zip/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/ds/zip/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/ds/zip/gg b/lib/ds/zip/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/ds/zip/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/ds/zip/lib b/lib/ds/zip/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/ds/zip/libgg.a b/lib/ds/zip/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/ds/zip/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/ds/zip/make-dos b/lib/ds/zip/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..e3b5574668882a7a954759639971c51ac1323086 --- /dev/null +++ b/lib/ds/zip/make-dos @@ -0,0 +1,27 @@ +# +# FILE %ds/zip/makefile +# +# manipulation of zip files +# +# written: 1995-12-25 +# latest update: 1995-12-26 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +ccl=cl -AL +obj=objdec -w -d -m0 -sl 2 DS_TEXT +lib=c:\usr\sbr\lsbr + +all : all.2 zs.exe + +all.2 : ! + zip_0001.obj zip_0002.obj zip_0003.obj zip_0004.obj zip_0005.obj ! + zip_0006.obj zip_0007.obj zip_0008.obj + +zs.exe : zs.obj + link zs.obj,$@,\dev\nul,$(lib); + +# ---------------------------------------------------------------------------- +.c.obj : + $(cml) $? + $(obj) $@ diff --git a/lib/ds/zip/zip_0001.c b/lib/ds/zip/zip_0001.c new file mode 100644 index 0000000000000000000000000000000000000000..061b35b8c6622f5b80f75952a8782cf7900344c9 --- /dev/null +++ b/lib/ds/zip/zip_0001.c @@ -0,0 +1,27 @@ +/* + * FILE %ds/zip/zip_0001.c + * + * ZIP Scanner; + * + * written: 1990 05 12 + * latest update: 1995-12-26 + * $Id: zip_0001.c,v 1.3 2009/10/13 12:59:25 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/zip.h> + +/* ------------------------------------------------------------------------ */ +int zip_quick_scan (char *fnm) +{ + FILE *fi; + long cde_pos; + + if ((fi= fopen (fnm, "rb")) == (FILE *) 0) return -1; + cde_pos= zip_find_cde_start (fi, 0x1000L); + printf ("CDE @0x%08lX\n", cde_pos); +} diff --git a/lib/ds/zip/zip_0001.o b/lib/ds/zip/zip_0001.o new file mode 100644 index 0000000000000000000000000000000000000000..92c29c6e23635d4192d1335e289d4d02e45cdf8e Binary files /dev/null and b/lib/ds/zip/zip_0001.o differ diff --git a/lib/ds/zip/zip_0002.c b/lib/ds/zip/zip_0002.c new file mode 100644 index 0000000000000000000000000000000000000000..9f82469194d9ad2547e6b256884ca8e4e812092e --- /dev/null +++ b/lib/ds/zip/zip_0002.c @@ -0,0 +1,66 @@ +/* + * FILE %sbr/zip_0002.c + * + * ZIP Quick Scanner: Beginn des CDE suchen + * + * written: 1990 05 12 + * latest update: 1995-12-25 + * $Id: zip_0002.c,v 1.2 2009/10/13 12:59:25 gonter Exp $ + * + */ + +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/zip.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long zip_find_cde_start (FILE *fi, long max_search) +{ + struct stat stb; + int rc, ch, st; + long search_pos; + long chrs= 0L; + + rc= fstat (fileno (fi), &stb); + if (rc != 0) return -1L; + + st= 0; + for (search_pos = stb.st_size-1L; + search_pos >= 0L && max_search-- > 0L; + search_pos --) + { + fseek (fi, search_pos, 0); + ch= fgetc (fi) & 0x00FF; + chrs++; + switch (st) + { + case 0: + if (ch == 0x06) st++; + break; + case 1: + if (ch == 0x05) st++; + else st= 0; + break; + case 2: + if (ch == 'K') st++; + else st= 0; + break; + case 3: + if (ch == 'P') + { + /* Position sollte genauer untersucht werden ! */ + if (chrs >= 22L) return search_pos; + } + st= 0; + break; + } + } + + return -1L; +} + diff --git a/lib/ds/zip/zip_0002.o b/lib/ds/zip/zip_0002.o new file mode 100644 index 0000000000000000000000000000000000000000..e610b9f7d7b63dd9e71690857242679f7c15cad3 Binary files /dev/null and b/lib/ds/zip/zip_0002.o differ diff --git a/lib/ds/zip/zip_0003.c b/lib/ds/zip/zip_0003.c new file mode 100644 index 0000000000000000000000000000000000000000..8d8c48715d8e9be6c2c3debfaa90f56d5e3bf1ea --- /dev/null +++ b/lib/ds/zip/zip_0003.c @@ -0,0 +1,43 @@ +/* + * FILE %ds/zip/zip_0003.c + * + * ZIP Scanner; + * + * written: 1990 05 12 + * latest update: 1995-12-25 + * $Id: zip_0003.c,v 1.3 2009/10/13 12:59:25 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/zip.h> + +/* initialze ZIP control structure ---------------------------------------- */ +struct ZIP_CONTROL *zip_init_control (char *fnm) +{ + struct ZIP_CONTROL *zc= (struct ZIP_CONTROL *) 0; + char *cp; + + if (fnm != (char *) 0 + && *fnm != 0 + && (zc= calloc (sizeof (struct ZIP_CONTROL), 1)) + != (struct ZIP_CONTROL *) 0 + && (cp= strdup (fnm)) != (char *) 0 + ) + { + /* information about the ZIP file */ + zc->ZIPC_filename = cp; + zc->ZIPC_status = 0; + + /* information from the ZIP file */ + zc->ZIPC_LFH = (struct ZIP_LOCAL_FILE_HEADER *) 0; + zc->ZIPC_LFH_app = &zc->ZIPC_LFH; + zc->ZIPC_CFH = (struct ZIP_CENTRAL_FILE_HEADER *) 0; + zc->ZIPC_CFH_app = &zc->ZIPC_CFH; + zc->ZIPC_CDE = (struct ZIP_CENTRAL_DIR_END *) 0; + } + + return zc; +} diff --git a/lib/ds/zip/zip_0003.o b/lib/ds/zip/zip_0003.o new file mode 100644 index 0000000000000000000000000000000000000000..b92c90705751cdf9caceb77ca9c075fc4fb376c7 Binary files /dev/null and b/lib/ds/zip/zip_0003.o differ diff --git a/lib/ds/zip/zip_0004.c b/lib/ds/zip/zip_0004.c new file mode 100644 index 0000000000000000000000000000000000000000..c5acc470328b674a250ae111ead2d35cc8f85a79 --- /dev/null +++ b/lib/ds/zip/zip_0004.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/zip/zip_0004.c + * + * ZIP Scanner; + * + * written: 1990 05 12 + * latest update: 1995-12-25 + * $Id: zip_0004.c,v 1.3 2009/10/13 12:59:25 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/zip.h> + +/* ------------------------------------------------------------------------ */ +int zip_init_LFH (struct ZIP_LOCAL_FILE_HEADER *lfh) +{ + lfh->ZIP_LFH_filename = (char *) 0; + lfh->ZIP_LFH_extra_field = (char *) 0; + + lfh->ZIP_LFH_sig_PK = ZIP_sig_PK; + lfh->ZIP_LFH_sig_lfh = ZIP_sig_lfh; + + lfh->ZIP_LFH_next = + lfh->ZIP_LFH_prev = (struct ZIP_LOCAL_FILE_HEADER *) 0; + + return 0; +} diff --git a/lib/ds/zip/zip_0004.o b/lib/ds/zip/zip_0004.o new file mode 100644 index 0000000000000000000000000000000000000000..06d453cd75637be765134f18a6a9b784e746f05c Binary files /dev/null and b/lib/ds/zip/zip_0004.o differ diff --git a/lib/ds/zip/zip_0005.c b/lib/ds/zip/zip_0005.c new file mode 100644 index 0000000000000000000000000000000000000000..1ef0e771419f3c983ea596b9a138a534ec6b2418 --- /dev/null +++ b/lib/ds/zip/zip_0005.c @@ -0,0 +1,31 @@ +/* + * FILE %ds/zip/zs.c + * + * ZIP Scanner; + * + * written: 1990 05 12 + * latest update: 1995-12-25 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/zip.h> + +/* ------------------------------------------------------------------------ */ +int zip_init_CFH (struct ZIP_CENTRAL_FILE_HEADER *cfh) +{ + cfh->ZIP_CFH_filename = (char *) 0; + cfh->ZIP_CFH_extra_field = (char *) 0; + cfh->ZIP_CFH_file_comment = (char *) 0; + + cfh->ZIP_CFH_sig_PK = ZIP_sig_PK; + cfh->ZIP_CFH_sig_cfh = ZIP_sig_cfh; + + cfh->ZIP_CFH_next = + cfh->ZIP_CFH_prev = (struct ZIP_CENTRAL_FILE_HEADER *) 0; + + return 0; +} diff --git a/lib/ds/zip/zip_0005.o b/lib/ds/zip/zip_0005.o new file mode 100644 index 0000000000000000000000000000000000000000..cda138983dfaddb961973235cc330cea39a22816 Binary files /dev/null and b/lib/ds/zip/zip_0005.o differ diff --git a/lib/ds/zip/zip_0006.c b/lib/ds/zip/zip_0006.c new file mode 100644 index 0000000000000000000000000000000000000000..fafc44c536c2f4144844ea31515dc4a7a77027b1 --- /dev/null +++ b/lib/ds/zip/zip_0006.c @@ -0,0 +1,27 @@ +/* + * FILE %ds/zip/zs.c + * + * ZIP Scanner; + * + * written: 1990 05 12 + * latest update: 1995-12-25 + * $Id: zip_0006.c,v 1.3 2009/10/13 12:59:25 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/zip.h> + +/* ------------------------------------------------------------------------ */ +int zip_init_CDE (struct ZIP_CENTRAL_DIR_END *cde) +{ + cde->ZIP_CDE_zipfile_comment = (char *) 0; + + cde->ZIP_CDE_sig_PK = ZIP_sig_PK; + cde->ZIP_CDE_sig_cde = ZIP_sig_cde; + + return 0; +} diff --git a/lib/ds/zip/zip_0006.o b/lib/ds/zip/zip_0006.o new file mode 100644 index 0000000000000000000000000000000000000000..31e37f85e633158561c697bdd7ba1670acbd49f7 Binary files /dev/null and b/lib/ds/zip/zip_0006.o differ diff --git a/lib/ds/zip/zip_0007.c b/lib/ds/zip/zip_0007.c new file mode 100644 index 0000000000000000000000000000000000000000..7f6113072bc34d56ec751d8ff1472d78164c585f --- /dev/null +++ b/lib/ds/zip/zip_0007.c @@ -0,0 +1,170 @@ +/* + * FILE %ds/zip/zip_0007.c + * + * ZIP Scanner; + * + * written: 1990 05 12 + * latest update: 1995-12-25 + * $Id: zip_0007.c,v 1.3 2009/10/13 12:59:25 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/strings.h> +#include <gg/dpp.h> +#include <gg/zip.h> + +/* ------------------------------------------------------------------------ */ +int zip_scan (struct ZIP_CONTROL *zc) +/* RETURN: 0 ... OK */ +/* -1 ... unexpected EOF */ +/* -2 ... unknonw ZIP-Substructure */ +/* -3 ... this is not a ZIP-File */ +/* -10 ... no more memory */ +/* -100 ... ZIP control invalid */ +/* -101 ... ZIP filename invalid */ +/* -102 ... ZIP file could not be opened */ +{ + FILE *fi; + int return_value= 0; + unsigned char sig_1, sig_2, sig_3, sig_4; + struct ZIP_LOCAL_FILE_HEADER *lfh; + struct ZIP_CENTRAL_FILE_HEADER *cfh; + struct ZIP_CENTRAL_DIR_END *cde; +#ifdef MAIN + long pos; +#endif + + if (zc == (struct ZIP_CONTROL *) 0) return -100; + if (zc->ZIPC_filename == (char *) 0) + { + return_value = -101; + goto OVER; + } + + fi= fopen (zc->ZIPC_filename, "rb"); + if (fi == (FILE *) 0) + { +#ifdef MAIN + printf ("zip file %s NOT opened\n", zc->ZIPC_filename); +#endif + return_value = -102; + goto OVER; + } +#ifdef MAIN + printf ("zip file %s opened\n", zc->ZIPC_filename); +#endif + + for (;;) + { +#ifdef MAIN + pos= ftell (fi); +#endif + sig_1= fgetc (fi) & 0x00FF; + sig_2= fgetc (fi) & 0x00FF; + sig_3= fgetc (fi) & 0x00FF; + sig_4= fgetc (fi) & 0x00FF; +#ifdef MAIN +printf ("pos=%ld sig=[%02X %02X %02X %02X]\n", pos, sig_1, sig_2, sig_3, sig_4); +#endif + if (feof (fi)) + { +#ifdef MAIN + printf ("EOF at 0x%08lX\n", pos); +#endif + return_value = -1; + break; + } + + if (sig_1 == 'P' && sig_2 == 'K') + { + if (sig_3 == ZIP_sig_lfh1 && sig_4 == ZIP_sig_lfh2) + { + *(zc->ZIPC_LFH_app)= lfh= malloc (sizeof (struct ZIP_LOCAL_FILE_HEADER)); + if (lfh == (struct ZIP_LOCAL_FILE_HEADER *) 0) + { + return_value = -10; + goto OVER1; + } + + zip_init_LFH (lfh); + fread (&lfh->ZIP_LFH, 1, sizeof (struct ZIP_local_file_header), fi); + lfh->ZIP_LFH_filename= read_string (fi, lfh->ZIP_LFH.ZIP_LFH_filename_length); + lfh->ZIP_LFH_extra_field= read_string (fi, lfh->ZIP_LFH.ZIP_LFH_extra_field_length); + fseek (fi, lfh->ZIP_LFH.ZIP_LFH_compressed_size, 1); +#ifdef MAIN + printf ("LFH at 0x%08lX: %s %s (fnm_lng=0x%08lX)\n", pos, + lfh->ZIP_LFH_filename, lfh->ZIP_LFH_extra_field, + lfh->ZIP_LFH.ZIP_LFH_filename_length); +#endif + } + else if (sig_3 == ZIP_sig_cfh1 && sig_4 == ZIP_sig_cfh2) + { + *(zc->ZIPC_CFH_app)= cfh= malloc (sizeof (struct ZIP_CENTRAL_FILE_HEADER)); + if (cfh == (struct ZIP_CENTRAL_FILE_HEADER *) 0) + { + return_value = -10; + goto OVER1; + } + + zip_init_CFH (cfh); + fread (&cfh->ZIP_CFH, 1, sizeof (struct ZIP_central_file_header), fi); + cfh->ZIP_CFH_filename= read_string (fi, cfh->ZIP_CFH.ZIP_CFH_filename_length); + cfh->ZIP_CFH_extra_field= read_string (fi, cfh->ZIP_CFH.ZIP_CFH_extra_field_length); + cfh->ZIP_CFH_file_comment= read_string (fi, cfh->ZIP_CFH.ZIP_CFH_file_comment_length); +#ifdef MAIN + printf ("CFH at 0x%08lX: %s %s %s\n", pos, + cfh->ZIP_CFH_filename, cfh->ZIP_CFH_extra_field, + cfh->ZIP_CFH_file_comment); +#endif + } + else if (sig_3 == ZIP_sig_cde1 && sig_4 == ZIP_sig_cde2) + { + zc->ZIPC_CDE= cde= malloc (sizeof (struct ZIP_CENTRAL_DIR_END)); + if (cde == (struct ZIP_CENTRAL_DIR_END *) 0) + { + return_value= -10; + goto OVER1; + } + + zip_init_CDE (cde); + fread (&cde->ZIP_CDE, 1, sizeof (struct ZIP_central_dir_end), fi); + cde->ZIP_CDE_zipfile_comment= read_string (fi, cde->ZIP_CDE.ZIP_CDE_zipfile_comment_length); +#ifdef MAIN + printf ("CDE at 0x%08lX: %s\n", pos, cde->ZIP_CDE_zipfile_comment); + printf (" CFH-Start 0x%08lX with %d entries %ld bytes\n", + cde->ZIP_CDE.ZIP_CDE_cfh_start_offset, + cde->ZIP_CDE.ZIP_CDE_cfh_count, + cde->ZIP_CDE.ZIP_CDE_cfh_size); +#endif + } + else + { +#ifdef MAIN + printf ("Unknown ZIP sub structure 0x%02X 0x%02X at offset 0x%08lX\n", + sig_3, sig_4, pos); +#endif + return_value = -2; + goto OVER1; + } + } + else + { + return_value = -3; + goto OVER1; + } + } + +OVER1: + fclose (fi); +OVER: + zc->ZIPC_status= return_value; + +#ifdef MAIN + printf ("zip file %s closed; return_value=%d\n", zc->ZIPC_filename, return_value); +#endif + return return_value; +} diff --git a/lib/ds/zip/zip_0007.o b/lib/ds/zip/zip_0007.o new file mode 100644 index 0000000000000000000000000000000000000000..e0dfc85aa4460b6516606ed8514cdfa531696c94 Binary files /dev/null and b/lib/ds/zip/zip_0007.o differ diff --git a/lib/ds/zip/zip_0008.c b/lib/ds/zip/zip_0008.c new file mode 100644 index 0000000000000000000000000000000000000000..4bc1b48cf53482e6a4aeaa26f8f39bc35079c22f --- /dev/null +++ b/lib/ds/zip/zip_0008.c @@ -0,0 +1,56 @@ +/* + * FILE %ds/zip/zip_0008.c + * + * ZIP Scanner; + * + * written: 1995-12-26 + * latest update: 1995-12-26 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/zip.h> + +/* ------------------------------------------------------------------------ */ +int zip_delete_control (struct ZIP_CONTROL *zc) +{ + struct ZIP_LOCAL_FILE_HEADER *lfh1, *lfh2; + struct ZIP_CENTRAL_FILE_HEADER *cfh1, *cfh2; + + if (zc == (struct ZIP_CONTROL *) 0) return -1; + + free_or_what (zc->ZIPC_filename); + + for (lfh1= zc->ZIPC_LFH; + lfh1 != (struct ZIP_LOCAL_FILE_HEADER *) 0; + lfh2= lfh1) + { + lfh2= lfh1->ZIP_LFH_next; + free_or_what (lfh1->ZIP_LFH_filename); + free_or_what (lfh1->ZIP_LFH_extra_field); + free (lfh1); + } + + for (cfh1= zc->ZIPC_CFH; + cfh1 != (struct ZIP_CENTRAL_FILE_HEADER *) 0; + cfh2= cfh1) + { + cfh2= cfh1->ZIP_CFH_next; + free_or_what (cfh1->ZIP_CFH_filename); + free_or_what (cfh1->ZIP_CFH_extra_field); + free_or_what (cfh1->ZIP_CFH_file_comment); + free (cfh1); + } + + if (zc->ZIPC_CDE != (struct ZIP_CENTRAL_DIR_END *) 0) + { + free_or_what (zc->ZIPC_CDE->ZIP_CDE_zipfile_comment); + free (zc->ZIPC_CDE); + } + + free (zc); + + return 0; +} diff --git a/lib/ds/zip/zip_0008.o b/lib/ds/zip/zip_0008.o new file mode 100644 index 0000000000000000000000000000000000000000..346cb1b9ec96c3523bcc660da250b8b0a05ae8c6 Binary files /dev/null and b/lib/ds/zip/zip_0008.o differ diff --git a/lib/ds/zip/zs b/lib/ds/zip/zs new file mode 100755 index 0000000000000000000000000000000000000000..8c51ce8dac18cb4ed325238cfbbb44f2304c3cf9 Binary files /dev/null and b/lib/ds/zip/zs differ diff --git a/lib/ds/zip/zs.c b/lib/ds/zip/zs.c new file mode 100644 index 0000000000000000000000000000000000000000..c657e4378bec561208d46a64618ed1cfb6abf5d7 --- /dev/null +++ b/lib/ds/zip/zs.c @@ -0,0 +1,179 @@ +/* + * FILE %ds/zip/zs.c + * + * template, standard command interpreter style + * + * written: 1992 02 19 + * latest update: 1995-12-25 + * $Id: zs.c,v 1.2 2009/10/13 12:59:25 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <stdio.h> +#ifdef MSDOS +#include <conio.h> +#endif +#include <gg/filename.h> +#include <gg/zip.h> + +#define STDHLP stderr +#ifdef MSDOS +#define ARG_C_max 24 +#else +#define ARG_C_max 240 +#endif +static char *arg_v [ARG_C_max]; +static int arg_c= 0; + +/* Quick Hack: ------------------------------------------------------------ */ +#ifdef MSDOS +#define SUBDIRS /* Rekursive Suche durch das */ + /* Filesystem moeglich */ +#define BETTER_FILENAME_MATCH /* eigene Match Funktion */ + /* sonst DOS Match Funktion */ +#else +#define wcrd_wildcards main_fnc +#endif + +/* ------------------------------------------------------------------------ */ +static char filenm [66]; +static int verbose_mode= 0; + +/* ------------------------------------------------------------------------ */ +#define GPL +static char *HELP []= +{ + "USAGE: zs [options] {file name}\n", + "OPTIONS:\n", + " -f<fnm> ... list of files\n", +#ifdef SUBDIRS + " -s -r ... subdirs\n", +#endif + " -v ... verbose mode\n", + "\n", + "(@)Azs.c 0.01 #D$1995-12-26 2:07:52\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv []); +int cdecl main_fnc (char *fn); + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + FILE *fi2; + int i, j; + + if (argc <= 1) goto HLP; + + for (i= 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= argv [i]; + break; + +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': +#endif + case 'v': case 'V': + for (j= 1; argv [i][j]; j++) + switch (argv [i][j]) + { +#ifdef SUBDIRS + case 'r': case 'R': + case 's': case 'S': + wcrd_set_subdirs (1); + break; +#endif + case 'v': case 'V': + verbose_mode++; + break; + default: + fprintf (stderr, "unknown option %c\n", argv[i][j]); + goto HLP; + } + break; + +HLP: +#include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) arg_v [arg_c++]= argv [i]; + + if (arg_c) + { + for (i= 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if ((fi2= fopen (& arg_v [i][2], "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s not opened!\n", &arg_v [i][2]); + break; + } + for (;;) + { + fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (filenm) == -1) + { + fclose (fi2); + goto STOP; + } +#else + wcrd_wildcards (filenm); +#endif + } + fclose (fi2); + } + else + { +#ifdef SUBDIRS + if (wcrd_wildcards_or_rec (arg_v [i]) == -1) goto STOP; +#else + wcrd_wildcards (arg_v [i]); +#endif + } + } + else + { +#ifdef SUBDIRS + wcrd_wildcards_or_rec ("*.*"); +#else + main_fnc ("Default.fil"); +#endif + } + +STOP: + return 0; +} + + +/* ------------------------------------------------------------------------ */ +int main_fnc (char *fn) +{ + struct ZIP_CONTROL *zip_control; + + if ((zip_control= zip_init_control (fn)) != (struct ZIP_CONTROL *) 0) + { + zip_scan (zip_control); + zip_quick_scan (fn); + /** zip_delete_control (zip_control); **/ + } + else + { + printf ("cant create zip_control for %s\n", fn); + } + + return 0; +} + +#define MAIN +#include "zip_0007.c" + diff --git a/lib/ds/zip/zs.o b/lib/ds/zip/zs.o new file mode 100644 index 0000000000000000000000000000000000000000..44d0481f13595a0438cd03d676b1fb034fffbf4f Binary files /dev/null and b/lib/ds/zip/zs.o differ diff --git a/lib/include/(dirinf).fm b/lib/include/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..f81ad4b3483c80d6f27f78ca0b46923d51da6575 --- /dev/null +++ b/lib/include/(dirinf).fm @@ -0,0 +1,9 @@ +#!/usr/local/bin/perl +# FILE %gg/usr/work/fbsd/gg/lib/include/(dirinf).fm +# +# written: 1999-12-19 +# latest update: 1999-12-19 18:47:42 +# + +contrib headers for contributed files +gg headers for gg's files diff --git a/lib/include/contrib/(dirinf).fm b/lib/include/contrib/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..8b11d66819b1a8a1555dfd6c7fcab9fd259439fb --- /dev/null +++ b/lib/include/contrib/(dirinf).fm @@ -0,0 +1,13 @@ +# +# Modules derived from other sources +# +# $Id: (dirinf).fm,v 1.1 2000/09/03 19:00:11 gonter Exp $ + +# MD5 +md5gg.h GG's wrapper functions +global.h original MD5 header +md5.h original MD5 header + +# ---- +pcmcia.h 7588 f 100644 3222 3000 + diff --git a/lib/include/contrib/global.h b/lib/include/contrib/global.h new file mode 100644 index 0000000000000000000000000000000000000000..5e5f5028828fb5b9dc827b9d6ceacf821aa66872 --- /dev/null +++ b/lib/include/contrib/global.h @@ -0,0 +1,32 @@ +/* GLOBAL.H - RSAREF types and constants + * This file was extracted from rfc1321.txt + */ + +/* PROTOTYPES should be set to one if and only if the compiler supports + function argument prototyping. + The following makes PROTOTYPES default to 0 if it has not already + been defined with C compiler flags. + */ +#define PROTOTYPES 1 +#ifndef PROTOTYPES +#define PROTOTYPES 0 +#endif + +/* POINTER defines a generic pointer type */ +typedef unsigned char *POINTER; + +/* UINT2 defines a two byte word */ +typedef unsigned short int UINT2; + +/* UINT4 defines a four byte word */ +typedef unsigned long int UINT4; + +/* PROTO_LIST is defined depending on how PROTOTYPES is defined above. +If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it + returns an empty list. + */ +#if PROTOTYPES +#define PROTO_LIST(list) list +#else +#define PROTO_LIST(list) () +#endif diff --git a/lib/include/contrib/md5.h b/lib/include/contrib/md5.h new file mode 100644 index 0000000000000000000000000000000000000000..ff3e9fafb3022c9d437b84c88dc104a448c24e53 --- /dev/null +++ b/lib/include/contrib/md5.h @@ -0,0 +1,36 @@ +/* MD5.H - header file for MD5C.C + * This file was extracted from rfc1321.txt + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All +rights reserved. + +License to copy and use this software is granted provided that it +is identified as the "RSA Data Security, Inc. MD5 Message-Digest +Algorithm" in all material mentioning or referencing this software +or this function. + +License is also granted to make and use derivative works provided +that such works are identified as "derived from the RSA Data +Security, Inc. MD5 Message-Digest Algorithm" in all material +mentioning or referencing the derived work. + +RSA Data Security, Inc. makes no representations concerning either +the merchantability of this software or the suitability of this +software for any particular purpose. It is provided "as is" +without express or implied warranty of any kind. + +These notices must be retained in any copies of any part of this +documentation and/or software. + */ + +/* MD5 context. */ +typedef struct { + UINT4 state[4]; /* state (ABCD) */ + UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} MD5_CTX; + +void MD5Init PROTO_LIST ((MD5_CTX *)); +void MD5Update PROTO_LIST ((MD5_CTX *, unsigned char *, unsigned int)); +void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); diff --git a/lib/include/contrib/md5gg.h b/lib/include/contrib/md5gg.h new file mode 100644 index 0000000000000000000000000000000000000000..83155529c1d8b2a7a2e6c568e052db1b5f91223d --- /dev/null +++ b/lib/include/contrib/md5gg.h @@ -0,0 +1,38 @@ +/* + * include File <contrib/md5gg.h> + * + * GG's utility functions for MD5 manipulation + * + * written: 1993-01-05: <Gerhard.Gonter@wu-wien.ac.at> + * latest update: 1995-09-01 + * + */ + +#ifndef __contrib_md5gg__ +#define __contrib_md5gg__ + +#include <gg/floskel.h> + +#ifdef __GG_dpp__ +/* if <gg/dpp.h> is included, there are also these routines: */ +# define MD5Digest2String(digest,string) bin_to_hex((digest),(string),16) +# define MD5String2Digest(digest,string) hex_to_bin((string),(digest),16) +#else +int cdecl MD5Digest2String (char *digest, char *string); +int cdecl MD5String2Digest (char *digest, char *string); +#endif + +char *cdecl MD5check_string (unsigned char *str); +char *cdecl MD5check_block (unsigned char *str, int lng); +unsigned char *cdecl MD5chk2_block (unsigned char *str, int lng); +unsigned char *cdecl MD5chk2_string (unsigned char *str); +unsigned char *cdecl MD5chk2_block_array (unsigned char *str [], + int lng [], int cnt); + +#ifdef _FILE_DEFINED +unsigned char *cdecl MD5chk_stream (FILE *fi, long size); +#endif /* _FILE_DEFINED */ +unsigned char *MD5chk_file_block (char *fnm, long beg, long size); +#define MD5chk_file(fnm) MD5chk_file_block((fnm), 0L, 0x7FFFFFFFL); + +#endif /* __contrib_md5gg__ */ diff --git a/lib/include/contrib/pcmcia.h b/lib/include/contrib/pcmcia.h new file mode 100644 index 0000000000000000000000000000000000000000..5acf5ccb27e08c437cb329079fb02e07415a3877 --- /dev/null +++ b/lib/include/contrib/pcmcia.h @@ -0,0 +1,264 @@ +/* + * include FILE <contrib/pcmcia.h> + * + * from Dr. Dobb's Journal 94/06 + * + * 1994-09-01 + * latest update: 1994-09-01 + * + */ + +/****************************************************************************/ +/** CARDINFO.H -- by Troy-Anthony Miles */ +/** */ +/****************************************************************************/ + +/** GENERAL DEFINITIONS*/ + +typedef unsigned char BYTE; +typedef unsigned short int WORD; +typedef unsigned long DWORD; + +#define LOBYTE(w) ((BYTE)(w)) +#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) +#define LOWORD(l) ((WORD)(DWORD)(l)) +#define HIWORD(l) ((WORD)((((DWORD)(l)) >> 16) & 0xFFFF)) + +#define FALSE 0 +#define TRUE 1 + +#define CARD_INTERRUPT 0x1A +#define CARD_SUBFUNCTION 0xAF +#define SIGNATURE 'SC' + +/** POSITIONS*/ + +#define D_LINES 7 +#define D_Y 6 +#define D_Y2 (D_Y + 4) +#define D_X 0 + +/** FUNCTION CODES*/ + +#define GET_CARDSERVICES_INFO 0x0B +#define REGISTER_CLIENT 0x10 +#define DEREGISTER_CLIENT 0x02 +#define GET_STATUS 0x0C +#define RESET_CARD 0x11 +#define SET_EVENT_MASK 0x31 +#define GET_EVENT_MASK 0x2E + +#define REQUEST_IO 0x1F +#define RELEASE_IO 0x1B +#define REQUEST_IRQ 0x20 +#define RELEASE_IRQ 0x1C +#define REQUEST_WINDOW 0x21 +#define RELEASE_WINDOW 0x1D +#define MODIFY_WINDOW 0x17 +#define MAP_MEM_PAGE 0x14 +#define REQUEST_SOCKET_MASK 0x22 +#define RELEASE_SOCKET_MASK 0x2F +#define REQUEST_CONFIGURATION 0x30 +#define GET_CONFIGURATION_INFO 0x04 +#define MODIFY_CONFIGURATION 0x27 +#define RELEASE_CONFIGURATION 0x1E + +#define OPEN_MEMORY 0x18 +#define READ_MEMORY 0x19 +#define WRITE_MEMORY 0x24 +#define COPY_MEMORY 0x01 +#define REGISTER_ERASE_QUEUE 0x0F +#define CHECK_ERASE_QUEUE 0x26 +#define DEREGISTER_ERASE_QUEUE 0x25 +#define CLOSE_MEMORY 0x00 + +#define GET_FIRST_TUPLE 0x07 +#define GET_NEXT_TUPLE 0x0A +#define GET_TUPLE_DATA 0x0D +#define GET_FIRST_REGION 0x06 +#define GET_NEXT_REGION 0x09 +#define GET_FIRST_PARTITION 0x05 +#define GET_NEXT_PARTITION 0x08 + +#define RETURN_SS_ENTRY 0x23 +#define MAP_LOG_SOCKET 0x12 +#define MAP_PHY_SOCKET 0x15 +#define MAP_LOG_WINDOW 0x13 +#define MAP_PHY_WINDOW 0x16 +#define REGISTER_MTD 0x1A +#define REGISTER_TIMER 0x28 +#define SET_REGION 0x29 +#define VALIDATE_CIS 0x2B +#define REQUEST_EXCLUSIVE 0x2C +#define RELEASE_EXCLUSIVE 0x2D +#define GET_FIRST_CLIENT 0x0E +#define GET_NEXT_CLIENT 0x2A +#define GET_CLIENT_INFO 0x03 +#define ADD_SOCKET_SERVICES 0x32 +#define REPLACE_SOCKET_SERVICES 0x33 +#define VENDOR_SPECIFIC 0x34 +#define ADJUST_RESOURCE_INFO 0x35 + +/** FLAGS*/ + +#define WRITE_PROTECT 0x01 +#define BATTERY_DEAD_FLAG 0x10 +#define BATTERY_LOW_FLAG 0x20 +#define CARD_DETECT_FLAG 0x80 + +/** RETURN CODES*/ + +#define SUCCESS 0x00 +#define BAD_ADAPTER 0x01 +#define BAD_ATTRIBUTE 0x02 +#define BAD_BASE 0x03 +#define BAD_EDC 0x04 + +#define BAD_IRQ 0x06 +#define BAD_OFFSET 0x07 +#define BAD_PAGE 0x08 +#define READ_FAILURE 0x09 +#define BAD_SIZE 0x0A +#define BAD_SOCKET 0x0B + +#define BAD_TYPE 0x0D +#define BAD_VCC 0x0E +#define BAD_VPP 0x0F + +#define BAD_WINDOW 0x11 +#define WRITE_FAILURE 0x12 + +#define NO_CARD 0x14 +#define UNSUPPORTED_FUNCTION 0x15 +#define UNSUPPORTED_MODE 0x16 +#define BAD_SPEED 0x17 +#define BUSY 0x18 +#define GENERAL_FAILURE 0x19 +#define WRITE_PROTECTED 0x1A +#define BAD_ARGS_LENGTH 0x1B +#define BAD_ARGS 0x1C +#define CONFIGURATION_LOCKED 0x1D +#define IN_USE 0x1E +#define NO_MORE_ITEMS 0x1F +#define OUT_OF_RESOURCE 0x20 +#define BAD_HANDLE 0x21 + +/** TUPLES*/ + +#define CISTPL_NULL 0x00 +#define CISTPL_DEVICE 0x01 +#define CISTPL_CHECKSUM 0x10 +#define CISTPL_LONGLINK_A 0x11 +#define CISTPL_LONGLINK_C 0x12 +#define CISTPL_LINKTARGET 0x13 +#define CISTPL_NO_LINK 0x14 +#define CISTPL_VERS_1 0x15 +#define CISTPL_ALTSTR 0x16 +#define CISTPL_DEVICE_A 0x17 +#define CISTPL_JEDEC_C 0x18 +#define CISTPL_JEDEC_A 0x19 +#define CISTPL_CONFIG 0x1A +#define CISTPL_CFTABLE_ENTRY 0x1B +#define CISTPL_DEVICE_OC 0x1C +#define CISTPL_DEVICE_OA 0x1D +#define CISTPL_VERS_2 0x40 +#define CISTPL_FORMAT 0x41 +#define CISTPL_GEOMETRY 0x42 +#define CISTPL_BYTEORDER 0x43 +#define CISTPL_DATE 0x44 +#define CISTPL_BATTERY 0x45 +#define CISTPL_ORG 0x46 +#define CISTPL_END 0xFF + +/** DEVICE TYPES*/ + +#define DTYPE_NULL 0x0 +#define DTYPE_ROM 0x1 +#define DTYPE_OTPROM 0x2 +#define DTYPE_EPROM 0x3 +#define DTYPE_EEPROM 0x4 +#define DTYPE_FLASH 0x5 +#define DTYPE_SRAM 0x6 +#define DTYPE_DRAM 0x7 +#define DTYPE_FUNCSPEC 0xD +#define DTYPE_EXTEND 0xE + +/** EVENTS*/ + +#define PM_RESUME 0x0B +#define PM_SUSPEND 0x0C +#define BATTERY_DEAD 0x01 +#define BATTERY_LOW 0x02 +#define CARD_INSERTION 0x40 +#define CARD_LOCK 0x03 +#define CARD_READY 0x04 +#define CARD_REMOVAL 0x05 +#define CARD_RESET 0x11 +#define CARD_UNLOCK 0x06 +#define EJECTION_COMPLETE 0x07 +#define EJECTION_REQUEST 0x08 +#define ERASE_COMPLETE 0x81 +#define EXCLUSIVE_COMPLETE 0x0D +#define EXCLUSIVE_REQUEST 0x0E +#define INSERTION_COMPLETE 0x09 +#define INSERTION_REQUEST 0x0A +#define REGISTRATION_COMPLETE 0x82 +#define RESET_COMPLETE 0x80 +#define RESET_PHYSICAL 0x0F +#define RESET_REQUEST 0x10 +#define MTD_REQUEST 0x12 +#define CLIENT_INFO 0x14 +#define TIMER_EXPIRED 0x15 +#define SS_UPDATED 0x16 + +/** STRUCTURES*/ + +typedef struct { + WORD InfoLen; + WORD Signature; + WORD Count; + WORD Revision; + WORD CSLevel; + WORD VStrOff; + WORD VStrLen; + BYTE VendorString[80]; +}CS_INFO; + +typedef struct{ + WORD Socket; + WORD CardState; + WORD SocketState; +}STATUS_INFO; + +typedef struct { + WORD Socket; + WORD Attributes; + BYTE DesiredTuple; + BYTE Reserved; + WORD Flags; + DWORD LinkOffset; + DWORD CISOffset; + BYTE TupleCode; + BYTE TupleLink; +}TUPLE_INFO; + +typedef struct { + WORD Socket; + WORD Attributes; + BYTE DesiredTuple; + BYTE TupleOffset; + WORD Flags; + DWORD LinkOffset; + DWORD CISOffset; + WORD TupleDataMax; + WORD TupleDataLen; + BYTE TupleData[20]; /* GG JUNK!!!! */ +}TUPLE_DATA_INFO; + +typedef struct { + WORD Attributes; + WORD EventMask; + BYTE ClientData[8]; + WORD Version; +}REGISTER_CLIENT_INFO; + diff --git a/lib/include/gg/(dirinf).fm b/lib/include/gg/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..dc5c9c2e9764e805a36629a4c7b95ea2c9d13cd9 --- /dev/null +++ b/lib/include/gg/(dirinf).fm @@ -0,0 +1,55 @@ +# +# FILE %inc/gg/(dirinf).fm +# +# written: 1994-10-17 +# latest update: 1999-11-28 12:15:15 +# $Id: (dirinf).fm,v 1.3 2007/12/02 11:58:13 gonter Exp $ +# + +array.h array processing +attlist.h attribute list processing + +dates.h Calendar and Date functions +dbx.h database +dpp.h data portability package + +hytxt.h Hypertext Engine + +lxs.h Lexicon Services (unused) +lxs2.h Lexicon Services, Version 2 +lexicon.h Lexicon: data structures +parse.h Lexicon: parser datastructures + +strings.h various string processing functions + +keys.h names and codes for MSDOS function keys + +rdtp.h Restructured Dynamic Text Parser +rdtp01.h Restructured Dynamic Text Parser; table generator +rdtp02.h Restructured Dynamic Text Parser; RTF concrete syntax +rdtp03.h Restructured Dynamic Text Parser; SGML concrete syntax + +irdb.h irrelational database + +lmd5.h LMD Version 5 + +lookup.h LMD Version 1-4 +ytree.h YTREE processing + +filename.h processing of filenames +wildcard.h redesigned wildcard system + +streams.h stream processing framework +ta.h textual analysis +ggcrypt.h simple file manipulations + +window.h CGA Window package + +xref.h Cross Reference Tool (OO) + +mscdex.h MS CD-Rom Extensions +mscdex01.h GG CD-Rom Extensions + + + + diff --git a/lib/include/gg/8859_ebc.ci b/lib/include/gg/8859_ebc.ci new file mode 100644 index 0000000000000000000000000000000000000000..9fe1508627d0ac2b626a62ad8472d1ef4448cba4 --- /dev/null +++ b/lib/include/gg/8859_ebc.ci @@ -0,0 +1,71 @@ +/* + * conversion table + * from: iso8859_1, ascii + * to: ebcdic + * as generated on 1997-02-08/21:44:27 + * + */ +/*0x00*/ 0x00000000,/*0x01*/ 0x00000001,/*0x02*/ 0x00000002,/*0x03*/ 0x00000003, +/*0x04*/ 0x00000037,/*0x05*/ 0x0000002D,/*0x06*/ 0x0000002E,/*0x07*/ 0x0000002F, +/*0x08*/ 0x00000016,/*0x09*/ 0x00000005,/*0x0A*/ 0x00000025,/*0x0B*/ 0x0000000B, +/*0x0C*/ 0x0000000C,/*0x0D*/ 0x0000000D,/*0x0E*/ 0x0000000E,/*0x0F*/ 0x0000009F, +/*0x10*/ 0x00000010,/*0x11*/ 0x00000011,/*0x12*/ 0x00000012,/*0x13*/ 0x00000013, +/*0x14*/ 0x000000B6,/*0x15*/ 0x0000007C,/*0x16*/ 0x00000032,/*0x17*/ 0x00000026, +/*0x18*/ 0x00000018,/*0x19*/ 0x00000019,/*0x1A*/ 0x0000003F,/*0x1B*/ 0x00000027, +/*0x1C*/ 0x0000001C,/*0x1D*/ 0x0000001D,/*0x1E*/ 0x0000001E,/*0x1F*/ 0x0000001F, +/*0x20*/ 0x00000040,/*0x21*/ 0x0000004F,/*0x22*/ 0x0000007F,/*0x23*/ 0x0000007B, +/*0x24*/ 0x0000005B,/*0x25*/ 0x0000006C,/*0x26*/ 0x00000050,/*0x27*/ 0x0000007D, +/*0x28*/ 0x0000004D,/*0x29*/ 0x0000005D,/*0x2A*/ 0x0000005C,/*0x2B*/ 0x0000004E, +/*0x2C*/ 0x0000006B,/*0x2D*/ 0x00000060,/*0x2E*/ 0x0000004B,/*0x2F*/ 0x00000061, +/*0x30*/ 0x000000F0,/*0x31*/ 0x000000F1,/*0x32*/ 0x000000F2,/*0x33*/ 0x000000F3, +/*0x34*/ 0x000000F4,/*0x35*/ 0x000000F5,/*0x36*/ 0x000000F6,/*0x37*/ 0x000000F7, +/*0x38*/ 0x000000F8,/*0x39*/ 0x000000F9,/*0x3A*/ 0x0000007A,/*0x3B*/ 0x0000005E, +/*0x3C*/ 0x0000004C,/*0x3D*/ 0x0000007E,/*0x3E*/ 0x0000006E,/*0x3F*/ 0x0000006F, +/*0x40*/ 0x000000B5,/*0x41*/ 0x000000C1,/*0x42*/ 0x000000C2,/*0x43*/ 0x000000C3, +/*0x44*/ 0x000000C4,/*0x45*/ 0x000000C5,/*0x46*/ 0x000000C6,/*0x47*/ 0x000000C7, +/*0x48*/ 0x000000C8,/*0x49*/ 0x000000C9,/*0x4A*/ 0x000000D1,/*0x4B*/ 0x000000D2, +/*0x4C*/ 0x000000D3,/*0x4D*/ 0x000000D4,/*0x4E*/ 0x000000D5,/*0x4F*/ 0x000000D6, +/*0x50*/ 0x000000D7,/*0x51*/ 0x000000D8,/*0x52*/ 0x000000D9,/*0x53*/ 0x000000E2, +/*0x54*/ 0x000000E3,/*0x55*/ 0x000000E4,/*0x56*/ 0x000000E5,/*0x57*/ 0x000000E6, +/*0x58*/ 0x000000E7,/*0x59*/ 0x000000E8,/*0x5A*/ 0x000000E9,/*0x5B*/ 0x00000063, +/*0x5C*/ 0x000000EC,/*0x5D*/ 0x000000FC,/*0x5E*/ 0x0000005F,/*0x5F*/ 0x0000006D, +/*0x60*/ 0x00000079,/*0x61*/ 0x00000081,/*0x62*/ 0x00000082,/*0x63*/ 0x00000083, +/*0x64*/ 0x00000084,/*0x65*/ 0x00000085,/*0x66*/ 0x00000086,/*0x67*/ 0x00000087, +/*0x68*/ 0x00000088,/*0x69*/ 0x00000089,/*0x6A*/ 0x00000091,/*0x6B*/ 0x00000092, +/*0x6C*/ 0x00000093,/*0x6D*/ 0x00000094,/*0x6E*/ 0x00000095,/*0x6F*/ 0x00000096, +/*0x70*/ 0x00000097,/*0x71*/ 0x00000098,/*0x72*/ 0x00000099,/*0x73*/ 0x000000A2, +/*0x74*/ 0x000000A3,/*0x75*/ 0x000000A4,/*0x76*/ 0x000000A5,/*0x77*/ 0x000000A6, +/*0x78*/ 0x000000A7,/*0x79*/ 0x000000A8,/*0x7A*/ 0x000000A9,/*0x7B*/ 0x00000043, +/*0x7C*/ 0x000000CC,/*0x7D*/ 0x000000DC,/*0x7E*/ 0x00000059,/*0x7F*/ 0x00000007, +/*0x80*/ 0x00000000,/*0x81*/ 0x00000000,/*0x82*/ 0x00000000,/*0x83*/ 0x00000000, +/*0x84*/ 0x00000000,/*0x85*/ 0x00000000,/*0x86*/ 0x00000000,/*0x87*/ 0x00000000, +/*0x88*/ 0x00000000,/*0x89*/ 0x00000000,/*0x8A*/ 0x00000000,/*0x8B*/ 0x00000000, +/*0x8C*/ 0x00000000,/*0x8D*/ 0x00000000,/*0x8E*/ 0x00000000,/*0x8F*/ 0x00000000, +/*0x90*/ 0x00000000,/*0x91*/ 0x00000000,/*0x92*/ 0x00000000,/*0x93*/ 0x00000000, +/*0x94*/ 0x00000000,/*0x95*/ 0x00000000,/*0x96*/ 0x00000000,/*0x97*/ 0x00000000, +/*0x98*/ 0x00000000,/*0x99*/ 0x00000000,/*0x9A*/ 0x00000000,/*0x9B*/ 0x00000000, +/*0x9C*/ 0x00000000,/*0x9D*/ 0x00000000,/*0x9E*/ 0x00000000,/*0x9F*/ 0x00000000, +/*0xA0*/ 0x000000FF,/*0xA1*/ 0x000000AA,/*0xA2*/ 0x000000B0,/*0xA3*/ 0x000000B1, +/*0xA4*/ 0x00000000,/*0xA5*/ 0x000000B2,/*0xA6*/ 0x00000000,/*0xA7*/ 0x00000000, +/*0xA8*/ 0x00000000,/*0xA9*/ 0x00000000,/*0xAA*/ 0x0000009A,/*0xAB*/ 0x0000008A, +/*0xAC*/ 0x000000BA,/*0xAD*/ 0x00000000,/*0xAE*/ 0x00000000,/*0xAF*/ 0x00000000, +/*0xB0*/ 0x00000000,/*0xB1*/ 0x0000008F,/*0xB2*/ 0x000000EA,/*0xB3*/ 0x00000000, +/*0xB4*/ 0x00000000,/*0xB5*/ 0x00000000,/*0xB6*/ 0x00000000,/*0xB7*/ 0x000000B3, +/*0xB8*/ 0x00000000,/*0xB9*/ 0x00000000,/*0xBA*/ 0x0000009B,/*0xBB*/ 0x0000008B, +/*0xBC*/ 0x000000B7,/*0xBD*/ 0x000000B8,/*0xBE*/ 0x00000000,/*0xBF*/ 0x000000AB, +/*0xC0*/ 0x00000000,/*0xC1*/ 0x00000000,/*0xC2*/ 0x00000000,/*0xC3*/ 0x00000000, +/*0xC4*/ 0x0000004A,/*0xC5*/ 0x00000067,/*0xC6*/ 0x0000009E,/*0xC7*/ 0x00000068, +/*0xC8*/ 0x00000000,/*0xC9*/ 0x00000071,/*0xCA*/ 0x00000000,/*0xCB*/ 0x00000000, +/*0xCC*/ 0x00000000,/*0xCD*/ 0x00000000,/*0xCE*/ 0x00000000,/*0xCF*/ 0x00000000, +/*0xD0*/ 0x00000000,/*0xD1*/ 0x00000069,/*0xD2*/ 0x00000000,/*0xD3*/ 0x00000000, +/*0xD4*/ 0x00000000,/*0xD5*/ 0x00000000,/*0xD6*/ 0x000000DA,/*0xD7*/ 0x00000000, +/*0xD8*/ 0x00000000,/*0xD9*/ 0x00000000,/*0xDA*/ 0x00000000,/*0xDB*/ 0x00000000, +/*0xDC*/ 0x0000005A,/*0xDD*/ 0x00000000,/*0xDE*/ 0x00000000,/*0xDF*/ 0x000000A1, +/*0xE0*/ 0x00000044,/*0xE1*/ 0x00000045,/*0xE2*/ 0x00000042,/*0xE3*/ 0x00000000, +/*0xE4*/ 0x000000C0,/*0xE5*/ 0x00000047,/*0xE6*/ 0x0000009C,/*0xE7*/ 0x00000048, +/*0xE8*/ 0x00000054,/*0xE9*/ 0x00000051,/*0xEA*/ 0x00000052,/*0xEB*/ 0x00000053, +/*0xEC*/ 0x00000058,/*0xED*/ 0x00000055,/*0xEE*/ 0x00000056,/*0xEF*/ 0x00000057, +/*0xF0*/ 0x00000000,/*0xF1*/ 0x00000049,/*0xF2*/ 0x000000CD,/*0xF3*/ 0x000000CE, +/*0xF4*/ 0x000000CB,/*0xF5*/ 0x00000000,/*0xF6*/ 0x0000006A,/*0xF7*/ 0x000000EE, +/*0xF8*/ 0x00000000,/*0xF9*/ 0x000000DD,/*0xFA*/ 0x000000DE,/*0xFB*/ 0x000000DB, +/*0xFC*/ 0x000000D0,/*0xFD*/ 0x00000000,/*0xFE*/ 0x00000000,/*0xFF*/ 0x000000DF diff --git a/lib/include/gg/8859_pc.ci b/lib/include/gg/8859_pc.ci new file mode 100644 index 0000000000000000000000000000000000000000..43657d3224c41db1beb541a57a1dfc9d481ac4d9 --- /dev/null +++ b/lib/include/gg/8859_pc.ci @@ -0,0 +1,71 @@ +/* + * conversion table + * from: iso8859_1, ascii + * to: pc437, ascii + * as generated on 1997-02-08/21:44:30 + * + */ +/*0x00*/ 0x00000000,/*0x01*/ 0x00000001,/*0x02*/ 0x00000002,/*0x03*/ 0x00000003, +/*0x04*/ 0x00000004,/*0x05*/ 0x00000005,/*0x06*/ 0x00000006,/*0x07*/ 0x00000007, +/*0x08*/ 0x00000008,/*0x09*/ 0x00000009,/*0x0A*/ 0x0000000A,/*0x0B*/ 0x0000000B, +/*0x0C*/ 0x0000000C,/*0x0D*/ 0x0000000D,/*0x0E*/ 0x0000000E,/*0x0F*/ 0x0000000F, +/*0x10*/ 0x00000010,/*0x11*/ 0x00000011,/*0x12*/ 0x00000012,/*0x13*/ 0x00000013, +/*0x14*/ 0x00000014,/*0x15*/ 0x00000015,/*0x16*/ 0x00000016,/*0x17*/ 0x00000017, +/*0x18*/ 0x00000018,/*0x19*/ 0x00000019,/*0x1A*/ 0x0000001A,/*0x1B*/ 0x0000001B, +/*0x1C*/ 0x0000001C,/*0x1D*/ 0x0000001D,/*0x1E*/ 0x0000001E,/*0x1F*/ 0x0000001F, +/*0x20*/ 0x00000020,/*0x21*/ 0x00000021,/*0x22*/ 0x00000022,/*0x23*/ 0x00000023, +/*0x24*/ 0x00000024,/*0x25*/ 0x00000025,/*0x26*/ 0x00000026,/*0x27*/ 0x00000027, +/*0x28*/ 0x00000028,/*0x29*/ 0x00000029,/*0x2A*/ 0x0000002A,/*0x2B*/ 0x0000002B, +/*0x2C*/ 0x0000002C,/*0x2D*/ 0x0000002D,/*0x2E*/ 0x0000002E,/*0x2F*/ 0x0000002F, +/*0x30*/ 0x00000030,/*0x31*/ 0x00000031,/*0x32*/ 0x00000032,/*0x33*/ 0x00000033, +/*0x34*/ 0x00000034,/*0x35*/ 0x00000035,/*0x36*/ 0x00000036,/*0x37*/ 0x00000037, +/*0x38*/ 0x00000038,/*0x39*/ 0x00000039,/*0x3A*/ 0x0000003A,/*0x3B*/ 0x0000003B, +/*0x3C*/ 0x0000003C,/*0x3D*/ 0x0000003D,/*0x3E*/ 0x0000003E,/*0x3F*/ 0x0000003F, +/*0x40*/ 0x00000040,/*0x41*/ 0x00000041,/*0x42*/ 0x00000042,/*0x43*/ 0x00000043, +/*0x44*/ 0x00000044,/*0x45*/ 0x00000045,/*0x46*/ 0x00000046,/*0x47*/ 0x00000047, +/*0x48*/ 0x00000048,/*0x49*/ 0x00000049,/*0x4A*/ 0x0000004A,/*0x4B*/ 0x0000004B, +/*0x4C*/ 0x0000004C,/*0x4D*/ 0x0000004D,/*0x4E*/ 0x0000004E,/*0x4F*/ 0x0000004F, +/*0x50*/ 0x00000050,/*0x51*/ 0x00000051,/*0x52*/ 0x00000052,/*0x53*/ 0x00000053, +/*0x54*/ 0x00000054,/*0x55*/ 0x00000055,/*0x56*/ 0x00000056,/*0x57*/ 0x00000057, +/*0x58*/ 0x00000058,/*0x59*/ 0x00000059,/*0x5A*/ 0x0000005A,/*0x5B*/ 0x0000005B, +/*0x5C*/ 0x0000005C,/*0x5D*/ 0x0000005D,/*0x5E*/ 0x0000005E,/*0x5F*/ 0x0000005F, +/*0x60*/ 0x00000060,/*0x61*/ 0x00000061,/*0x62*/ 0x00000062,/*0x63*/ 0x00000063, +/*0x64*/ 0x00000064,/*0x65*/ 0x00000065,/*0x66*/ 0x00000066,/*0x67*/ 0x00000067, +/*0x68*/ 0x00000068,/*0x69*/ 0x00000069,/*0x6A*/ 0x0000006A,/*0x6B*/ 0x0000006B, +/*0x6C*/ 0x0000006C,/*0x6D*/ 0x0000006D,/*0x6E*/ 0x0000006E,/*0x6F*/ 0x0000006F, +/*0x70*/ 0x00000070,/*0x71*/ 0x00000071,/*0x72*/ 0x00000072,/*0x73*/ 0x00000073, +/*0x74*/ 0x00000074,/*0x75*/ 0x00000075,/*0x76*/ 0x00000076,/*0x77*/ 0x00000077, +/*0x78*/ 0x00000078,/*0x79*/ 0x00000079,/*0x7A*/ 0x0000007A,/*0x7B*/ 0x0000007B, +/*0x7C*/ 0x0000007C,/*0x7D*/ 0x0000007D,/*0x7E*/ 0x0000007E,/*0x7F*/ 0x0000007F, +/*0x80*/ 0x00000080,/*0x81*/ 0x00000081,/*0x82*/ 0x00000082,/*0x83*/ 0x00000083, +/*0x84*/ 0x00000084,/*0x85*/ 0x00000085,/*0x86*/ 0x00000086,/*0x87*/ 0x00000087, +/*0x88*/ 0x00000088,/*0x89*/ 0x00000089,/*0x8A*/ 0x0000008A,/*0x8B*/ 0x0000008B, +/*0x8C*/ 0x0000008C,/*0x8D*/ 0x0000008D,/*0x8E*/ 0x0000008E,/*0x8F*/ 0x0000008F, +/*0x90*/ 0x00000090,/*0x91*/ 0x00000091,/*0x92*/ 0x00000092,/*0x93*/ 0x00000093, +/*0x94*/ 0x00000094,/*0x95*/ 0x00000095,/*0x96*/ 0x00000096,/*0x97*/ 0x00000097, +/*0x98*/ 0x00000098,/*0x99*/ 0x00000099,/*0x9A*/ 0x0000009A,/*0x9B*/ 0x0000009B, +/*0x9C*/ 0x0000009C,/*0x9D*/ 0x0000009D,/*0x9E*/ 0x0000009E,/*0x9F*/ 0x0000009F, +/*0xA0*/ 0x000000A0,/*0xA1*/ 0x000000A1,/*0xA2*/ 0x000000A2,/*0xA3*/ 0x000000A3, +/*0xA4*/ 0x000000A4,/*0xA5*/ 0x000000A5,/*0xA6*/ 0x000000A6,/*0xA7*/ 0x000000A7, +/*0xA8*/ 0x000000A8,/*0xA9*/ 0x000000A9,/*0xAA*/ 0x000000AA,/*0xAB*/ 0x000000AB, +/*0xAC*/ 0x000000AC,/*0xAD*/ 0x000000AD,/*0xAE*/ 0x000000AE,/*0xAF*/ 0x000000AF, +/*0xB0*/ 0x000000B0,/*0xB1*/ 0x000000B1,/*0xB2*/ 0x000000B2,/*0xB3*/ 0x000000B3, +/*0xB4*/ 0x000000B4,/*0xB5*/ 0x000000B5,/*0xB6*/ 0x000000B6,/*0xB7*/ 0x000000B7, +/*0xB8*/ 0x000000B8,/*0xB9*/ 0x000000B9,/*0xBA*/ 0x000000BA,/*0xBB*/ 0x000000BB, +/*0xBC*/ 0x000000BC,/*0xBD*/ 0x000000BD,/*0xBE*/ 0x000000BE,/*0xBF*/ 0x000000BF, +/*0xC0*/ 0x000000C0,/*0xC1*/ 0x000000C1,/*0xC2*/ 0x000000C2,/*0xC3*/ 0x000000C3, +/*0xC4*/ 0x000000C4,/*0xC5*/ 0x000000C5,/*0xC6*/ 0x000000C6,/*0xC7*/ 0x000000C7, +/*0xC8*/ 0x000000C8,/*0xC9*/ 0x000000C9,/*0xCA*/ 0x000000CA,/*0xCB*/ 0x000000CB, +/*0xCC*/ 0x000000CC,/*0xCD*/ 0x000000CD,/*0xCE*/ 0x000000CE,/*0xCF*/ 0x000000CF, +/*0xD0*/ 0x000000D0,/*0xD1*/ 0x000000D1,/*0xD2*/ 0x000000D2,/*0xD3*/ 0x000000D3, +/*0xD4*/ 0x000000D4,/*0xD5*/ 0x000000D5,/*0xD6*/ 0x000000D6,/*0xD7*/ 0x000000D7, +/*0xD8*/ 0x000000D8,/*0xD9*/ 0x000000D9,/*0xDA*/ 0x000000DA,/*0xDB*/ 0x000000DB, +/*0xDC*/ 0x000000DC,/*0xDD*/ 0x000000DD,/*0xDE*/ 0x000000DE,/*0xDF*/ 0x000000DF, +/*0xE0*/ 0x000000E0,/*0xE1*/ 0x000000E1,/*0xE2*/ 0x000000E2,/*0xE3*/ 0x000000E3, +/*0xE4*/ 0x000000E4,/*0xE5*/ 0x000000E5,/*0xE6*/ 0x000000E6,/*0xE7*/ 0x000000E7, +/*0xE8*/ 0x000000E8,/*0xE9*/ 0x000000E9,/*0xEA*/ 0x000000EA,/*0xEB*/ 0x000000EB, +/*0xEC*/ 0x000000EC,/*0xED*/ 0x000000ED,/*0xEE*/ 0x000000EE,/*0xEF*/ 0x000000EF, +/*0xF0*/ 0x000000F0,/*0xF1*/ 0x000000F1,/*0xF2*/ 0x000000F2,/*0xF3*/ 0x000000F3, +/*0xF4*/ 0x000000F4,/*0xF5*/ 0x000000F5,/*0xF6*/ 0x000000F6,/*0xF7*/ 0x000000F7, +/*0xF8*/ 0x000000F8,/*0xF9*/ 0x000000F9,/*0xFA*/ 0x000000FA,/*0xFB*/ 0x000000FB, +/*0xFC*/ 0x000000FC,/*0xFD*/ 0x000000FD,/*0xFE*/ 0x000000FE,/*0xFF*/ 0x000000FF diff --git a/lib/include/gg/@ b/lib/include/gg/@ new file mode 100644 index 0000000000000000000000000000000000000000..127003172a50bc8fc0b70ce3c0c8c486151108d8 --- /dev/null +++ b/lib/include/gg/@ @@ -0,0 +1,334 @@ +Index: strings.h +=================================================================== +RCS file: /cvsroot/hyx-tools/lib/include/gg/strings.h,v +retrieving revision 1.6 +diff -r1.6 strings.h +1,162c1,165 +< /* +< * include FILE <gg/strings.h> +< * +< * see also: %ds/strings +< * - constants +< * - prototypes +< * +< * written: 1990 06 24 +< * latest update: 1997-10-05 12:19:12 +< * $Id: strings.h,v 1.6 2005/09/04 20:27:37 gonter Exp $ +< * +< */ +< +< #ifndef __GG_strings__ +< #define __GG_strings__ +< +< #include <gg/floskel.h> +< +< /* ------------------------------------------------------------------------ */ +< struct STRLIST +< { +< struct STRLIST *strl_next; +< char *strl_string; +< }; +< +< /* ------------------------------------------------------------------------ */ +< struct OPERATION +< { +< char *OP_name; /* name to be matched with */ +< int OP_minimal_length; /* minimal match length for the string */ +< long OP_info; /* information to be associated, its only */ +< /* of interest for the calling function. */ +< } ; +< +< /* constants: ------------------------------------------------------------- */ +< #define MATCH_error -1 /* something is wrong */ +< #define MATCH_no 0 /* no match possible */ +< #define MATCH_no_wildcard 1 /* matched without wildcard */ +< #define MATCH_wildcard 2 /* matched with wildcard */ +< +< #define STR_DIGITS "0123456789" +< #define STR_HEX_DIGITS "0123456789ABCDEF" +< #define STR_hex_DIGITS "0123456789abcdef" +< #define STR_Hex_DIGITS "0123456789abcdefABCDEF" +< +< /* ------------------------------------------------------------------------ */ +< #define strlist_new() ((struct STRLIST *) calloc (sizeof (struct STRLIST), 1)) +< +< /* prototypes of library functions: --------------------------------------- */ +< /* 0001 */ void cdecl strnscpy (char *d, char *s, int cnt); +< /* 0002 */ int cdecl strcmp_c (char *s1, char *s2); +< /* 0003 */ int cdecl strcmp_ebcdic (char *s1, char *s2); +< /* 0004 */ char *cdecl to_lower (char *n); +< /* 0005 */ char *cdecl to_upper (char *n); +< /* 0006 */ int cdecl match (char *pattern, char *str); +< /* 0007 */ int cdecl string_hash (char *str, int lng, char *hash, int hlng); +< /* 0008 */ int cdecl match_lng (char *s1, char *s2, int cnt); +< /* 0009 */ int cdecl strcmp_us (char *s1, char *s2); +< /* 0010 */ int cdecl strcmp_weighted (char *s1, char *s2); +< /* 0011 */ int cdecl strcmp_cweighted (char *s1, char *s2); +< /* 0012 */ int cdecl lower_case (int n); +< /* 0013 */ int cdecl upper_case (int n); +< /* 0014 */ int cdecl strcmp_cre (char *s1, char *s2); +< /* 0015 */ int cdecl skip_re (char *str); +< /* 0016 */ int cdecl find_command (char *s, char *cmds[], int first, +< int last); +< /* 0017 */ char *cdecl str_assign (char **d, char *s); +< /* 0018 */ char *cdecl rotate13 (char *s); +< /* 0019 */ char *cdecl strridx (char *s, int ch); +< /* 0020 */ int cdecl split_string (char *src, int spl, char *flds[], +< int n_flds); +< /* 0021 */ int cdecl match_array (char *patterns[], int pattern_count, +< char *string); +< /* 0022 */ int cdecl isolate_words (char *src, char *flds[], int n_flds); +< /* 0023 */ int cdecl str2fld (char *src, char *flds[], int n_flds, +< int delimiter, int open_quote, int close_quote, +< int escape_char); +< /* 0024 */ int cdecl isolate_tokens (char *src, char *flds[], int n_flds); +< /* 0025 */ int cdecl strdiff (char *diff, char *s1, char *s2, +< int eq_char, int diff_char, int eos_char); +< /* 0026 */ int cdecl isolate2words (char *src, char *flds[], int n_flds, +< int *table); +< /* 0027 */ int cdecl put_chartable (int *table, char *chars, int value); +< /* 0028 */ char *cdecl locate_word (char *s, int num); +< /* 0029 */ long cdecl count_char (int code, char *s, long size); +< /* 0030 */ int cdecl mk_passwd (char *s, int pass_lng); +< /* 0031 */ int cdecl enter_value (char *s, int pos, int val, int digits); +< #ifdef _FILE_DEFINED +< /* 0032 */ void cdecl blanks (FILE *fo, int cnt); +< #endif +< /* 0033 */ int cdecl chr_index (char *chars, int value); +< /* 0034 */ int cdecl xchange (char *s, int f, int t); +< /* 0035 */ int cdecl gopher_url2components (char *url, char **host, +< long *port, int *type, char **path, int *tabs); +< /* 0036 */ int cdecl str_prompt (char *txt, char *dest, int lng, +< char *tmp, char *preset); +< /* 0037 */ int cdecl remove_apostrophe (char *s); +< /* 0038 */ char *cdecl str_or_undef (char *s); +< /* 0039 */ int cdecl mk_PassWord (char *s, int pass_lng); +< /* 0040 */ struct OPERATION *cdecl get_operation (struct OPERATION ops [], +< int n_ops, char *str); +< /* 0041 */ int cdecl get_cat_code (int ch); +< void cdecl set_cat_code (int ch, int code); +< /* 0042 */ int cdecl get_weight_code (int ch); +< void cdecl set_weight_code (int ch, int code); +< /* 0043 */ int cdecl mk_pin_code (char *s, int pass_lng); +< /* 0044 */ int cdecl free_or_what (void *s); +< /* 0045 */ char *cdecl strdup_extra (char *str, int extra); +< /* 0046 */ int cdecl sgml_encode (char *title, char *tmp, int str_size); +< #ifdef _FILE_DEFINED +< /* 0047 */ char *cdecl read_string (FILE *fi, int string_length); +< #endif /* _FILE_DEFINED */ +< /* 0048 */ char *cdecl XSTR (char *str); +< /* 0049 */ char *cdecl strcpy_max (char *d, char *s, int size); +< /* 0050 */ int cdecl strcmp_nn (char *s1, char *s2); +< /* 0051 */ char *cdecl strdup_or_what (char *s); +< /* 0052 */ int cdecl strcpy2_max (char *d, char *s, int size); +< /* 0053 */ char *cdecl get_password_verified (char *p1, char *p2); +< +< /* remains of the famous MAGIS -------------------------------------------- */ +< /* 0107 */ void cdecl strnins (char *str, int lng, int pos, int cnt); +< /* 0108 */ void cdecl strndel (char *str, int lng, int pos, int cnt); +< /* 0109 */ void cdecl delstr (char *s, int p); +< +< /* REXX like things ------------------------------------------------------- */ +< /* 0201 */ int cdecl abbrev (const char *unabbr, const char *abbr, int lng); +< /* 0202 */ char *cdecl translate (char *s, char *tbl_in, char *tbl_out); +< /* 0203 */ int cdecl verify (char *string, char *reference); +< /* 0204 */ int cdecl strip (char *string, char *where); +< +< /* OS/environment specific functions -------------------------------------- */ +< #ifdef __CMS__ +< #define __strdup_undefined__ +< #endif +< #ifdef __hpux_older_version +< #define __strdup_undefined__ +< #endif +< #ifdef __ultrix +< #define __strdup_undefined__ +< #endif +< #ifdef __AIX43__ +< #define __strndup_defined__ +< #endif +< +< #ifdef __strdup_undefined__ +< /* 0301 */ char *cdecl strdup (const char *str); +< #endif +< +< #ifndef __strdnup_defined__ +< #ifndef size_t +< #include <sys/types.h> +< #endif +< /* 0302 */ char *cdecl strndup (const char *str, size_t size); +< #endif +< +< #ifdef __strrev_undefined__ +< /* 0303 */ char *cdecl strrev (char *str); +< #endif +< +< /* 0304 */ char *cdecl strdup_max (char *str, int max_size); +< +< #endif /* __GG_strings__ */ +--- +> /* +> * include FILE <gg/strings.h> +> * +> * see also: %ds/strings +> * - constants +> * - prototypes +> * +> * written: 1990 06 24 +> * latest update: 1997-10-05 12:19:12 +> * $Id: strings.h,v 1.6 2005/09/04 20:27:37 gonter Exp $ +> * +> */ +> +> #ifndef __GG_strings__ +> #define __GG_strings__ +> +> #include <gg/floskel.h> +> +> /* ------------------------------------------------------------------------ */ +> struct STRLIST +> { +> struct STRLIST *strl_next; +> char *strl_string; +> }; +> +> /* ------------------------------------------------------------------------ */ +> struct OPERATION +> { +> char *OP_name; /* name to be matched with */ +> int OP_minimal_length; /* minimal match length for the string */ +> long OP_info; /* information to be associated, its only */ +> /* of interest for the calling function. */ +> } ; +> +> +> typedef int (*mk_pass_func) (char *s, int pass_lng); +> +> /* constants: ------------------------------------------------------------- */ +> #define MATCH_error -1 /* something is wrong */ +> #define MATCH_no 0 /* no match possible */ +> #define MATCH_no_wildcard 1 /* matched without wildcard */ +> #define MATCH_wildcard 2 /* matched with wildcard */ +> +> #define STR_DIGITS "0123456789" +> #define STR_HEX_DIGITS "0123456789ABCDEF" +> #define STR_hex_DIGITS "0123456789abcdef" +> #define STR_Hex_DIGITS "0123456789abcdefABCDEF" +> +> /* ------------------------------------------------------------------------ */ +> #define strlist_new() ((struct STRLIST *) calloc (sizeof (struct STRLIST), 1)) +> +> /* prototypes of library functions: --------------------------------------- */ +> /* 0001 */ void cdecl strnscpy (char *d, char *s, int cnt); +> /* 0002 */ int cdecl strcmp_c (char *s1, char *s2); +> /* 0003 */ int cdecl strcmp_ebcdic (char *s1, char *s2); +> /* 0004 */ char *cdecl to_lower (char *n); +> /* 0005 */ char *cdecl to_upper (char *n); +> /* 0006 */ int cdecl match (char *pattern, char *str); +> /* 0007 */ int cdecl string_hash (char *str, int lng, char *hash, int hlng); +> /* 0008 */ int cdecl match_lng (char *s1, char *s2, int cnt); +> /* 0009 */ int cdecl strcmp_us (char *s1, char *s2); +> /* 0010 */ int cdecl strcmp_weighted (char *s1, char *s2); +> /* 0011 */ int cdecl strcmp_cweighted (char *s1, char *s2); +> /* 0012 */ int cdecl lower_case (int n); +> /* 0013 */ int cdecl upper_case (int n); +> /* 0014 */ int cdecl strcmp_cre (char *s1, char *s2); +> /* 0015 */ int cdecl skip_re (char *str); +> /* 0016 */ int cdecl find_command (char *s, char *cmds[], int first, +> int last); +> /* 0017 */ char *cdecl str_assign (char **d, char *s); +> /* 0018 */ char *cdecl rotate13 (char *s); +> /* 0019 */ char *cdecl strridx (char *s, int ch); +> /* 0020 */ int cdecl split_string (char *src, int spl, char *flds[], +> int n_flds); +> /* 0021 */ int cdecl match_array (char *patterns[], int pattern_count, +> char *string); +> /* 0022 */ int cdecl isolate_words (char *src, char *flds[], int n_flds); +> /* 0023 */ int cdecl str2fld (char *src, char *flds[], int n_flds, +> int delimiter, int open_quote, int close_quote, +> int escape_char); +> /* 0024 */ int cdecl isolate_tokens (char *src, char *flds[], int n_flds); +> /* 0025 */ int cdecl strdiff (char *diff, char *s1, char *s2, +> int eq_char, int diff_char, int eos_char); +> /* 0026 */ int cdecl isolate2words (char *src, char *flds[], int n_flds, +> int *table); +> /* 0027 */ int cdecl put_chartable (int *table, char *chars, int value); +> /* 0028 */ char *cdecl locate_word (char *s, int num); +> /* 0029 */ long cdecl count_char (int code, char *s, long size); +> /* 0030 */ int cdecl mk_passwd (char *s, int pass_lng); +> /* 0031 */ int cdecl enter_value (char *s, int pos, int val, int digits); +> #ifdef _FILE_DEFINED +> /* 0032 */ void cdecl blanks (FILE *fo, int cnt); +> #endif +> /* 0033 */ int cdecl chr_index (char *chars, int value); +> /* 0034 */ int cdecl xchange (char *s, int f, int t); +> /* 0035 */ int cdecl gopher_url2components (char *url, char **host, +> long *port, int *type, char **path, int *tabs); +> /* 0036 */ int cdecl str_prompt (char *txt, char *dest, int lng, +> char *tmp, char *preset); +> /* 0037 */ int cdecl remove_apostrophe (char *s); +> /* 0038 */ char *cdecl str_or_undef (char *s); +> /* 0039 */ int cdecl mk_PassWord (char *s, int pass_lng); +> /* 0040 */ struct OPERATION *cdecl get_operation (struct OPERATION ops [], +> int n_ops, char *str); +> /* 0041 */ int cdecl get_cat_code (int ch); +> void cdecl set_cat_code (int ch, int code); +> /* 0042 */ int cdecl get_weight_code (int ch); +> void cdecl set_weight_code (int ch, int code); +> /* 0043 */ int cdecl mk_pin_code (char *s, int pass_lng); +> /* 0044 */ int cdecl free_or_what (void *s); +> /* 0045 */ char *cdecl strdup_extra (char *str, int extra); +> /* 0046 */ int cdecl sgml_encode (char *title, char *tmp, int str_size); +> #ifdef _FILE_DEFINED +> /* 0047 */ char *cdecl read_string (FILE *fi, int string_length); +> #endif /* _FILE_DEFINED */ +> /* 0048 */ char *cdecl XSTR (char *str); +> /* 0049 */ char *cdecl strcpy_max (char *d, char *s, int size); +> /* 0050 */ int cdecl strcmp_nn (char *s1, char *s2); +> /* 0051 */ char *cdecl strdup_or_what (char *s); +> /* 0052 */ int cdecl strcpy2_max (char *d, char *s, int size); +> /* 0053 */ char *cdecl get_password_verified (char *p1, char *p2); +> +> /* remains of the famous MAGIS -------------------------------------------- */ +> /* 0107 */ void cdecl strnins (char *str, int lng, int pos, int cnt); +> /* 0108 */ void cdecl strndel (char *str, int lng, int pos, int cnt); +> /* 0109 */ void cdecl delstr (char *s, int p); +> +> /* REXX like things ------------------------------------------------------- */ +> /* 0201 */ int cdecl abbrev (const char *unabbr, const char *abbr, int lng); +> /* 0202 */ char *cdecl translate (char *s, char *tbl_in, char *tbl_out); +> /* 0203 */ int cdecl verify (char *string, char *reference); +> /* 0204 */ int cdecl strip (char *string, char *where); +> +> /* OS/environment specific functions -------------------------------------- */ +> #ifdef __CMS__ +> #define __strdup_undefined__ +> #endif +> #ifdef __hpux_older_version +> #define __strdup_undefined__ +> #endif +> #ifdef __ultrix +> #define __strdup_undefined__ +> #endif +> #ifdef __AIX43__ +> #define __strndup_defined__ +> #endif +> +> #ifdef __strdup_undefined__ +> /* 0301 */ char *cdecl strdup (const char *str); +> #endif +> +> #ifndef __strdnup_defined__ +> #ifndef size_t +> #include <sys/types.h> +> #endif +> /* 0302 */ char *cdecl strndup (const char *str, size_t size); +> #endif +> +> #ifdef __strrev_undefined__ +> /* 0303 */ char *cdecl strrev (char *str); +> #endif +> +> /* 0304 */ char *cdecl strdup_max (char *str, int max_size); +> +> #endif /* __GG_strings__ */ diff --git a/lib/include/gg/@file.lst b/lib/include/gg/@file.lst new file mode 100644 index 0000000000000000000000000000000000000000..48776d13c95e59badeca0ada25c0ebdff37551a7 --- /dev/null +++ b/lib/include/gg/@file.lst @@ -0,0 +1,86 @@ +ARCHEAD.H +ATTLIST.H +CKSLIB.H +CODES.H +CONVENT.H +DATES.H +RFC822.H +DIAGNOSE.H +DIRTY.H +DPP.H +EBCASC.H +ENTITY.H +EVENT.H +FIELDS.H +FILEIO.H +FILENAME.H +FNAMES.H +GGCMS.H +GIF.H +HYTXT.H +HYX.H +HYXD.H +WINDOW.H +KEYS.H +LEXICON.H +LOOKUP.H +LZHHEAD.H +MACBINAR.H +MASKED_1.H +MAUS.H +LXS.H +RTF.H +PARSE.H +PCTCPSBR.H +PCX.H +SBR.H +SGML.H +SIXEL.H +STRINGS.H +TA.H +TFB.H +TIF.H +VIDEODAT.H +VLIB.H +GGCRYPT.H +YTREE.H +ZIP.H +ZTREE.H +OBJUTILS.H +HYXDB.H +LEXUTIL.H +UNIFY.H +(DIRINF).FM +WORDCREA.H +IOA.H +SIGNATUR.H +FLOSKEL.H +VARSPACE.H +SYNCFSH.H +MSCDEX.H +OBJDEC.H +BBCH.H +DYB.H +CCTABLE.H +CCPP.H +CCSCAN.H +CCSCANR.H +TAGLST.H +CSED.H +URL.H +VIEOS.H +MAIL.H +GGTCL.H +RDTP.H +RDTP01.H +RDTP02.H +RDTP03.H +IRDB.H +LMD5.H +WILDCARD.H +ARRAY.H +STREAMS.H +DBX.H +LXS2.H +XREF.H +MSCDEX01.H diff --git a/lib/include/gg/@fnd.sgm b/lib/include/gg/@fnd.sgm new file mode 100644 index 0000000000000000000000000000000000000000..f92e06538b24d6055c8ccaf06ee4b3257b791bde --- /dev/null +++ b/lib/include/gg/@fnd.sgm @@ -0,0 +1,2 @@ +searching [ /bin/possig.pl ] +hytxt.h 125: struct YTREE *<hyx.l file="hytxt.h" ln=125 cn=16 tdc=79 tdp=10>read_cache; diff --git a/lib/include/gg/archead.h b/lib/include/gg/archead.h new file mode 100644 index 0000000000000000000000000000000000000000..f599e0cd7d0a03d9426c17b8e3e124036dc0d73d --- /dev/null +++ b/lib/include/gg/archead.h @@ -0,0 +1,48 @@ +/* + * include FILE <gg/archead.h> + * + * Verarbeiten von Archiv Files (.ARC, .PAK) + * + * written: 1989 01 20 + * 1989 07 02: aus ARCFILES.C extrahiert + * 1990 02 03: Revision + * 1991 01 28: Revision + * latest update: 1994-11-11 + * + */ + +#ifndef __GG_archead__ +#define __GG_archead__ + +#pragma pack(1) + +/* PKARC, PKPACK, ARC ----------------------------------------------------- */ +struct heads +{ /* archive entry header format */ + char name[13]; /* file name */ + long size; /* size of file, in bytes IM ARCHIV !!!! */ + unsigned int date; /* creation date */ + unsigned int time; /* creation time */ + int crc; /* cyclic redundancy check */ + long length; /* true file length DECOMPRIMIERT !!!! */ +} ; + +/* Compression Methods: Wird im Archiv VOR dem Header gespeichert --------- */ +#define ARC_END 0 /* -> Ende des ARC-Files */ +#define ARC_store_1 1 /* -> unkomprimiert */ +#define ARC_store_2 2 +#define ARC_pack 3 +#define ARC_squeeze 4 +#define ARC_crunch_1 5 +#define ARC_crunch_2 6 +#define ARC_crunch_3 7 +#define ARC_crunch_4 8 +#define ARC_squash 9 + +/* Modul ARCHEAD.C -------------------------------------------------------- */ +int cdecl get_arc_head (FILE *fi, struct heads *head); + +/* Modul ARCFILES.C ------------------------------------------------------- */ +int cdecl get_arc_file (FILE *fi, struct dta_buff *p); + +#endif diff --git a/lib/include/gg/array.h b/lib/include/gg/array.h new file mode 100644 index 0000000000000000000000000000000000000000..f2f1d7ca8392ce2b465256f40a02b0b85484f253 --- /dev/null +++ b/lib/include/gg/array.h @@ -0,0 +1,91 @@ +/* + * include FILE <gg/array.h> + * + * written: 1996-08-11 + * latest update: 1997-03-30 10:05:53 + * + */ + +#ifndef __GG_array__ +#define __GG_array__ + +/* arbitrary limits: ------------------------------------------------------ */ +#define MAX_ARRAY_SPLIT 50 /* max. number of elements to split array */ + +/* ------------------------------------------------------------------------ */ +typedef void array_element_destructor (void *payload); + +/* ------------------------------------------------------------------------ */ +struct ARRAY_ELEMENT +{ + struct ARRAY_ELEMENT *next; + struct ARRAY_ELEMENT *prev; + void *payload; +} ; + +/* ------------------------------------------------------------------------ */ +struct ARRAY_CONTROL +{ + struct ARRAY_ELEMENT *top; + struct ARRAY_ELEMENT *last; + + long elements; + array_element_destructor *element_destructor; +} ; + +/* ------------------------------------------------------------------------ */ +#define array_elements(x) (x->elements) +#define array_last_index(x) (x->elements-1) + +#define array_new() \ + ((struct ARRAY_CONTROL *) calloc (sizeof (struct ARRAY_CONTROL), 1)) +#define array_new_element() \ + ((struct ARRAY_ELEMENT *) calloc (sizeof (struct ARRAY_ELEMENT), 1)) + +#define array_top(x) \ + ((x == (struct ARRAY_CONTROL *) 0) ? (struct ARRAY_ELEMENT *) 0 : x->top) +#define array_last(x) \ + ((x == (struct ARRAY_CONTROL *) 0) ? (struct ARRAY_ELEMENT *) 0 : x->last) + +#define array_next(x) \ + ((x == (struct ARRAY_ELEMENT *) 0) ? (struct ARRAY_ELEMENT *) 0 : x->next) +#define array_prev(x) \ + ((x == (struct ARRAY_ELEMENT *) 0) ? (struct ARRAY_ELEMENT *) 0 : x->prev) + +/* ------------------------------------------------------------------------ */ +int array_dispose (struct ARRAY_CONTROL *ac); + +long array_push (struct ARRAY_CONTROL *ac, void *pl); +long array_unshift (struct ARRAY_CONTROL *ac, void *pl); +void *array_pop (struct ARRAY_CONTROL *ac); +void *array_shift (struct ARRAY_CONTROL *ac); + +long array_push2 (struct ARRAY_CONTROL **ac, void *pl); +long array_unshift2 (struct ARRAY_CONTROL **ac, void *pl); +long array_push2_dup (struct ARRAY_CONTROL **ac, char *pl); +int array_dispose2 (struct ARRAY_CONTROL *ac, array_element_destructor *ad); +int array_dispose_string (struct ARRAY_CONTROL *ac); + +int string_push (char *fn); +int string_unshift (char *fn); +char *string_pop (void); +char *string_shift (void); +void string_reset (void); + +struct ARRAY_CONTROL *array_append_split_destructive ( + struct ARRAY_CONTROL *ac, char *str, int split_char, int max_fields); + +char *array_join (struct ARRAY_CONTROL *ac, char *out_str, int out_size, + char *conc_str); + +struct ARRAY_CONTROL *array_dup_tmp (struct ARRAY_CONTROL *ac); + +#ifdef __T2D__ /* 1997-01-15 17:44:46 */ +struct ARRAY_CONTROL *array_split (string, split_char); +struct ARRAY_CONTROL *array_isolate_tokens (string); +array_reverse +... udgl ... + +#endif /* __T2D__ 1997-01-15 17:44:46 */ + +#endif /* __GG_array__ */ diff --git a/lib/include/gg/asc2ebc.inc b/lib/include/gg/asc2ebc.inc new file mode 100644 index 0000000000000000000000000000000000000000..c8abfe4e33bd38c3a5523b7f7e24134093c9bae2 --- /dev/null +++ b/lib/include/gg/asc2ebc.inc @@ -0,0 +1,50 @@ +/* + * include FILE <gg/asc2ebc.inc> + * + * Codierungstablle fuer ASCII -> EBCDIC Umwandlung + * + * written: 1989 08 04 + * latest update: 1994-03-30 + * + */ + +#ifndef __GG_asc2ebc__ +#define __GG_asc2ebc__ + +int CODE_ASCII_to_EBCDIC [256] = +{ +/* 0x00 */ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, +/* 0x08 */ 0x16, 0x05, 0x25, 0x0B, 0x0C, 0x0D, 0x0E, 0x9F, +/* 0x10 */ 0x10, 0x11, 0x12, 0x13, 0xB6, 0x7C, 0x32, 0x26, +/* 0x18 */ 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, +/* 0x20 */ 0x40, 0x4F, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, +/* 0x28 */ 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, +/* 0x30 */ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, +/* 0x38 */ 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F, +/* 0x40 */ 0xB5, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, +/* 0x48 */ 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, +/* 0x50 */ 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, +/* 0x58 */ 0xE7, 0xE8, 0xE9, 0x63, 0xEC, 0xFC, 0x5F, 0x6D, +/* 0x60 */ 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, +/* 0x68 */ 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, +/* 0x70 */ 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, +/* 0x78 */ 0xA7, 0xA8, 0xA9, 0x43, 0xCC, 0xDC, 0x59, 0x07, +/* 0x80 */ 0x68, 0xD0, 0x51, 0x42, 0xC0, 0x44, 0x47, 0x48, +/* 0x88 */ 0x52, 0x53, 0x54, 0x57, 0x56, 0x58, 0x4A, 0x67, +/* 0x90 */ 0x71, 0x9C, 0x9E, 0xCB, 0x6A, 0xCD, 0xDB, 0xDD, +/* 0x98 */ 0xDF, 0xDA, 0x5A, 0xB0, 0xB1, 0xB2, 0x3E, 0xB4, +/* 0xA0 */ 0x45, 0x55, 0xCE, 0xDE, 0x49, 0x69, 0x9A, 0x9B, +/* 0xA8 */ 0xAB, 0x0F, 0xBA, 0xB8, 0xB7, 0xAA, 0x8A, 0x8B, +/* 0xB0 */ 0x3C, 0x3D, 0x62, 0xBB, 0x64, 0x65, 0x66, 0x20, +/* 0xB8 */ 0x21, 0x22, 0x70, 0x23, 0x72, 0x73, 0x74, 0xBE, +/* 0xC0 */ 0x76, 0x77, 0x78, 0x80, 0x24, 0x15, 0x8C, 0x8D, +/* 0xC8 */ 0x8E, 0x41, 0x06, 0x17, 0x28, 0x29, 0x9D, 0x2A, +/* 0xD0 */ 0x2B, 0x2C, 0x09, 0x0A, 0xAC, 0xAD, 0xAE, 0xAF, +/* 0xD8 */ 0x1B, 0x30, 0x31, 0xFA, 0x1A, 0x33, 0x34, 0x35, +/* 0xE0 */ 0x36, 0xA1, 0x08, 0x38, 0xBC, 0x39, 0xA0, 0xBF, +/* 0xE8 */ 0xCA, 0x3A, 0xFE, 0x3B, 0x04, 0xCF, 0xE0, 0x14, +/* 0xF0 */ 0xE1, 0x8F, 0x46, 0x75, 0xFD, 0xEB, 0xEE, 0xED, +/* 0xF8 */ 0x90, 0xEF, 0xB3, 0xFB, 0xB9, 0xEA, 0xBD, 0xFF +} ; + +#endif /* __GG_asc2ebc__ */ diff --git a/lib/include/gg/attlist.h b/lib/include/gg/attlist.h new file mode 100644 index 0000000000000000000000000000000000000000..faf90c5ea4c6c7b9f0d734dce0cf6523ead9f346 --- /dev/null +++ b/lib/include/gg/attlist.h @@ -0,0 +1,62 @@ +/* + * include FILE <gg/attlist.h> + * + * attribute list management + * + * written: 1994-03-26 + * latest update: 1997-11-09 10:59:53 + * $Id: attlist.h,v 1.2 2002/05/02 06:48:29 gonter Exp $ + * + */ + +#ifndef __GG_attlist__ +#define __GG_attlist__ + +#include <gg/floskel.h> + +/* ------------------------------------------------------------------------ */ +struct ATTRIBUTE_LIST +{ + struct ATTRIBUTE_LIST *AL_next; + char *AL_name; /* attribute name */ + char *AL_attl; /* attribute list for an attribute */ + long AL_type; /* ... maybe this should be a pointer too */ + void *AL_value; /* attribute value */ +} ; + +#define ALty_void 0 /* no AL_value */ +#define ALty_attlist 1 /* AL_value points again to an ATTLIST */ +#define ALty_string 2 /* AL_value points to a string */ +#define ALty_string_dup 3 /* strdup'ed string */ +#define ALty_opaque 4 /* points to any other value */ +#define ALty_long 5 /* numeric long value */ + +/* ------------------------------------------------------------------------ */ +struct _ATTL_CTL +{ + struct ATTRIBUTE_LIST *AL_start; + struct ATTRIBUTE_LIST **AL_append; +}; + +typedef struct _ATTL_CTL ATTLIST; + +/* prototypes: ------------------------------------------------------------ */ +/* attl0001.c */ struct ATTRIBUTE_LIST *cdecl al_create_attribute ( + char *name, char *attl, long type, void *value); +/* attl0002.c */ struct ATTRIBUTE_LIST **cdecl al_getp_attribute ( + struct ATTRIBUTE_LIST **alp, char *name); +/* attl0003.c */ struct ATTRIBUTE_LIST *cdecl al_set_attribute ( + struct ATTRIBUTE_LIST **alp, + char *name, char *attl, long type, void *value); +/* attl0004.c */ struct ATTRIBUTE_LIST *cdecl al_find_attribute ( + struct ATTRIBUTE_LIST *al, char *name); +/* attl0005.c */ int cdecl al_find_name (char *name_file, char *first_name, + char *nick, struct ATTRIBUTE_LIST *ntl); +/* attl0006.c */ void *cdecl al_find_attribute_value ( + struct ATTRIBUTE_LIST *al, char *name); + +/* attl0008.c */ int al_add_attribute (ATTLIST *al, char *name, + char *attl, long type, void *value); +/* attl0009.c */ ATTLIST *new_ATTLIST (void); + +#endif /* __GG_attlist__ */ diff --git a/lib/include/gg/bbch.h b/lib/include/gg/bbch.h new file mode 100644 index 0000000000000000000000000000000000000000..c085d2951918c0ae87e9d4b132901191e20a482b --- /dev/null +++ b/lib/include/gg/bbch.h @@ -0,0 +1,164 @@ +/* + * include FILE <gg/bbch.h> + * + * Black Board Controller + * + * for information see %lexicon/bbcd.doc + * + * - constants + * - methods: typedef's for function prototyes + * - structures + * - macros + * - prototypes + * + * written: 1995-08-03 + * latest update: 1999-05-09 18:08:11 + * $Id: bbch.h,v 1.4 2003/10/01 21:52:01 gonter Exp $ + * + */ + +#ifndef __GG_bbch__ +#define __GG_bbch__ + +#include <gg/parse.h> /* @@@ import hyx_output_processor */ +#include <gg/ggcrypt.h> +#include <gg/signatur.h> +#include <gg/floskel.h> + +/* constants: ------------------------------------------------------------- */ +#define MAX_HN_LNG 256 +#define RANDOM_SIZE 23 + +/* methods: --------------------------------------------------------------- */ +typedef int BBC_accept (void *client_data); +typedef int BBC_input (void *bbcc, char *block, int size); + +/* structures: ------------------------------------------------------------ */ +struct BBC_CONNECTION +{ + long sig; /* SIG_BBC_CONNECTION */ + struct BBC_CONNECTION *BBCC_next; + void *BBCC_bbcs; /* parrent session */ + + int BBCC_status; +#define BBCCst_target 0 /* target side, waitinf for REQUEST message */ +#define BBCCst_target2 1 /* target side, waiting for CONNECT message */ +#define BBCCst_initiator 2 /* initiator side, waiting for ACCEPT msg. */ +#define BBCCst_wait 3 /* initiator waiting for BBC:OK: */ +#define BBCCst_ok 4 /* connection came up correctly identified */ +#define BBCCst_failed 5 /* other side could not be authenticated */ +#define BBCCst_initiator_wait_random 6 +#define BBCCst_target_wait_random 7 + + int BBCC_t2d; /* flag to indicate a special operation */ +#define BBCCt2d_nothing 0 /* ... everything's ok */ +#define BBCCt2d_shutdown 1 /* ... this connection needs to be closed */ +#define BBCCt2d_pushup 2 /* authentication completed successfully */ + + /* peer entity information -- supplied by the peer */ + char *BBCC_from; /* peer objects entity name */ + char *BBCC_to; /* objects own entity name */ + char *BBCC_resource; /* name of resource for this authentication */ + char *BBCC_opening_challenge; /* sent to initiator */ + char *BBCC_chex_string; /* chex string returned by initiator */ + + struct GG_CRYPT /* session streams encryption */ + BBCC_s_o2p, /* encryption session to peer side */ + BBCC_s_p2o; /* encryption session from peer side */ + + /* description of the peer connection */ + int BBCC_connection_mode; /* this structure is the same for initiator */ + /* and called entity of a connection. */ +#define BBCCcm_undefined 0 /* initialized structure, no info yet */ +#define BBCCcm_called 1 /* this entity is called by the peer */ +#define BBCCcm_initiator 2 /* this entity is calling the peer */ + char *BBCC_peer_host; /* name of the peer's host, if known */ + char *BBCC_peer_ipnum; /* ip address of the peer's host */ + long BBCC_peer_port; /* port number of the peer, if known */ + + int BBCC_socket; /* socket number */ + + /* inherited data from session controller */ + BBC_accept *BBCC_accept; + + BBC_input *BBCC_input1; /* security layer input handler */ + BBC_input *BBCC_input2; /* processing layer input handler */ + void *BBCC_client_data1; + + hyx_output_processor *BBCC_op;/* lexicon output processor */ +} ; + +/* ------------------------------------------------------------------------ */ +struct BBC_LISTEN +{ + long sig; /* SIG_BBC_LISTEN */ + struct BBC_LISTEN *BBCL_next; + void *BBCL_bbcs; /* parrent session */ + + int BBCL_socket; +} ; + +/* ------------------------------------------------------------------------ */ +struct BBC_SESSION +{ + long sig; /* SIG_BBC_SESSION */ + + struct BBC_CONNECTION + *BBCS_connections; /* list of currently active connections */ + int BBCS_count; /* number of active connections */ + + int BBCS_is_public; /* 1 -> this is a public resource */ + char *BBCS_key_file; /* file with chex keys */ + char *BBCS_my_name; /* object name of this object */ + char *BBCS_my_resource; /* my object resource name (NOT USED???) */ + char *BBCS_public_resource; /* name of any public resource */ + + BBC_accept *BBCS_accept; + + /* connection information passed to established connections. */ + BBC_input *BBCS_input1; /* security layer input handler */ + BBC_input *BBCS_input2; /* processing layer input handler */ + + void *BBCS_client_data1; + hyx_output_processor *BBCS_op;/* lexicon output processor */ + +#define BBCS_BUFFER_SIZE 8192 + char BBCS_buffer [BBCS_BUFFER_SIZE+2]; +} ; + +/* macros: ---------------------------------------------------------------- */ +#define bbc_new_connection() \ + ((struct BBC_CONNECTION *) calloc (sizeof (struct BBC_CONNECTION), 1)) + +/* prototypes: ------------------------------------------------------------ */ +/* bbc01.c */ void bbc_sig_term (int sig); + int bbc_main (struct BBC_SESSION *bbcs, char *server, int port, + int proc_stdin, char *target_name, char *target_resource); +/* bbc02.c */ void inet_netnames (int sockfd, char *host_name, char *ipnum); +/* bbc03.c */ struct BBC_CONNECTION *bbc_init_connection ( + struct BBC_SESSION *bbcs, int sock); +/* bbc04.c */ int bbc_authentication_protocol (void *client_data, + char *buffer, int buffer_size); +/* bbc05.c */ int bbc_chex (struct BBC_SESSION *bbcs, + struct BBC_CONNECTION *bbcc, char *buffer); + +#ifdef _FILE_DEFINED +/* bbc06.c */ int bbc_diag_conn (FILE *fo, struct BBC_CONNECTION *bbcc); +#endif /* _FILE_DEFINED */ + +/* bbc07.c */ int bbc_lexicon_processor (void *client_data, + char *buffer, int buffer_size); +/* bbc08.c */ int bbc_get_request (struct BBC_CONNECTION *bbcc, char *buffer); +/* bbc09.c */ struct BBC_LISTEN *bbc_server (int port); +/* bbc10.c */ struct BBC_CONNECTION *bbc_connect ( + struct BBC_SESSION *bbcs, char *server, int port, + char *target_name, char *target_resource); +/* bbc11.c */ int bbc_challenge (struct BBC_SESSION *bbcs, + struct BBC_CONNECTION *bbcc, char *buffer); +/* bbc12.c */ int bbc_to_stdout (void *client_data, + char *buffer, int buffer_size); +/* bbc13.c */ int bbc_transmit_text (void *cd, struct TEXT_ELEMENT *te); +/* bbc14.c */ struct BBC_SESSION *bbc_new_session (void); +/* bbc15.c */ int bbc_acceptor (void *client_data); + +#endif /* __GG_bbch__ */ diff --git a/lib/include/gg/ccpp.h b/lib/include/gg/ccpp.h new file mode 100644 index 0000000000000000000000000000000000000000..c2b1243fcb6bef53ca69e0ca0c975eac6766b686 --- /dev/null +++ b/lib/include/gg/ccpp.h @@ -0,0 +1,82 @@ +/* + * include FILE <gg/ccpp.h> + * + * C Preprocessor Definitions + * + * !!!!!! <gg/scanr.h> muss vorher includiert werden !!!!!1 + * + * written: 1988 02 14 + * 1990 07 21: Revision + * latest update: 1995-08-30 + * + */ + +#ifndef __GG_ccpp__ +#define __GG_ccpp__ + +#include <gg/floskel.h> + +typedef int CPP_OUTPUT (int tv, long val); + +/* ------------------------------------------------------------------------ */ +struct FILESTACK /* Verschachtelte INCLUDEs */ +{ + long position; + int znr; + char fname [32]; + struct FILESTACK *fs_nxt; +} ; + +/* ------------------------------------------------------------------------ */ +struct SKIPSTACK /* Verschachtelte IFDEFs usw. */ +{ + struct SKIPSTACK *sk_nxt; + int sk_mode; /* SKM_xxxx */ +} ; + +/* ------------------------------------------------------------------------ */ +struct T_NODE /* Liste von Tokens + Tokenvalues */ +{ + int TN_tok; + long TN_val; + struct T_NODE *TN_nxt; +} ; + +/* ------------------------------------------------------------------------ */ +struct DEFINELIST +{ + int pars; /* # der Parameter: -1 ohne Parameter */ + struct DEFINELIST *dl_nxt; /* Verkettung */ + struct IDENT *id; /* Name fuer Ersetzung */ + struct T_NODE *parlist; /* formale Parameterliste */ + struct T_NODE *replace; /* Ersetzungstext */ +} ; + +/* ------------------------------------------------------------------------ */ +#define SKM_r 1 /* alles lesen */ +#define SKM_rif 2 /* IF Zweig lesen */ +#define SKM_selse 3 /* ELSE Zweig skippen */ +#define SKM_sif 4 /* IF Zweig skippen */ +#define SKM_relse 5 /* ELSE Zweig lesen */ +#define SKM_s 6 /* alles skippen */ + +/* ------------------------------------------------------------------------ */ +/* Uebergaenge: */ +/* #ifXdef: PUSH; bei Skipxx in Skip gehen */ +/* sonst entscheiden und in readif oder skipif gehen */ +/* #else: readif -> skipelse; skipif -> readelse; skip -> skip */ +/* #endif: POP; */ + +/* ------------------------------------------------------------------------ */ +int cpp_define_output (CPP_OUTPUT *op, struct CC_C_SCANNER *xx, + struct CC_SCANNER *cc, struct CC_SCANNER *cpp); +int cpp_init (void); +struct DEFINELIST *cpp_find_define (struct IDENT *ip); +int cpp_define (struct IDENT *ip); +int cpp_undefine (struct IDENT *ip); +int cpp_input (int tv, long val); +int cpp_process2 (int tv, long val); +int cpp_print_defines (void); +int cpp_set_znr (int z, char *f, int flg); + +#endif /* __GG_ccpp__ */ diff --git a/lib/include/gg/ccscan.h b/lib/include/gg/ccscan.h new file mode 100644 index 0000000000000000000000000000000000000000..23bd77ca74628d51aac6fd6f38af1fb874560352 --- /dev/null +++ b/lib/include/gg/ccscan.h @@ -0,0 +1,318 @@ +/* + * include FILE <gg/ccscan.h> + * + * Spezielle Defintionen fuer den C-Compiler - Scanner + * + * written: 1987 11 14 + * 1990 07 10: Revision + * latest update: 1997-08-15 19:29:36 + * + */ + +#ifndef __GG_ccscan__ +#define __GG_ccscan__ + +#include <gg/floskel.h> + +/* ------------------------------------------------------------------------ */ +typedef void CC_SCAN_OUTPUT (int tv, long val); + +/* ------------------------------------------------------------------------ */ +struct CC_C_SCANNER +{ + struct CC_SCANNER *CC_sc_cc; + struct CC_SCANNER *CC_sc_cpp; + + CC_SCAN_OUTPUT *CC_sc_cc_output; + CC_SCAN_OUTPUT *CC_sc_cpp_output; + + /* Zustandsparameter des Scanners */ + int CC_fl_val2; /* akt. Float-Nachkomma-Wert */ + int CC_fl_val3; /* akt. Float-Exponent-Wert */ + int CC_fl_evz; /* akt. Float-Exponent-Vorzeichen */ + int CC_chv; /* akt. Character-Wert */ + int CC_idx; /* Index des Names bzw. Strings */ + long CC_value; /* akt. Integer-Wert */ + char CC_id [500]; /* Identifier und String Puffer */ + char CC_int_token; /* Unterscheidung: DEZ - HEX - OKT */ +} ; + +/* Lexikalische Tokens: --------------------------------------------------- */ +#define TOK_DEZ 1 +#define TOK_FLOAT 2 +#define TOK_CHAR 3 +#define TOK_STR 4 +#define TOK_ID 5 +#define TOK_HEX 6 +#define TOK_OKT 7 + +#define TOK_DELI 10 /* CR, BLANK, TAB ... */ +#define TOK_COMMENT 11 /* Kommentare f. Beautifier */ + +#define TOK_SEL 14 +#define TOK_DEREFF 15 +#define TOK_Lor 16 +#define TOK_Land 17 +#define TOK_DEC 18 +#define TOK_INC 19 + +#define TOK_Band 20 +#define TOK_aBand 21 +#define TOK_Bor 22 +#define TOK_aBor 23 +#define TOK_MOD 24 +#define TOK_aMOD 25 +#define TOK_DIV 26 +#define TOK_aDIV 27 +#define TOK_MUL 28 +#define TOK_aMUL 29 +#define TOK_ADD 30 +#define TOK_aADD 31 +#define TOK_SUB 32 +#define TOK_aSUB 33 +#define TOK_XOR 34 +#define TOK_aXOR 35 +#define TOK_COMPL 36 +#define TOK_aCOMPL 37 +#define TOK_assign 38 + +#define TOK_EQ 39 +#define TOK_LT 40 +#define TOK_LE 41 +#define TOK_GT 42 +#define TOK_GE 43 +#define TOK_not 44 +#define TOK_NE 45 + +#define TOK_Lshift 46 +#define TOK_aLshift 47 +#define TOK_Rshift 48 +#define TOK_aRshift 49 + +#define TOK_BACK 50 +#define TOK_ASK 51 +#define TOK_COL 52 +#define TOK_HASH 53 +#define TOK_KOMMA 54 +#define TOK_SEMICOL 55 +#define TOK_56 56 +#define TOK_57 57 +#define TOK_58 58 +#define TOK_59 59 +#define TOK_60 60 +#define TOK_61 61 + +#define TOK_FNM1 62 /* Include File Name mit Anfuehrungsz. */ +#define TOK_FNM2 63 /* . . . . <..> */ + +/* Reservierte Identifier: ------------------------------------------------ */ +#define ID_asm 1 +#define ID_auto 2 +#define ID_break 3 +#define ID_case 4 +#define ID_char 5 +#define ID_const 6 +#define ID_continue 7 +#define ID_default 8 +#define ID_do 9 +#define ID_double 10 +#define ID_else 11 +#define ID_entry 12 +#define ID_enum 13 +#define ID_extern 14 +#define ID_float 15 +#define ID_for 16 +#define ID_fortran 17 +#define ID_goto 18 +#define ID_if 19 +#define ID_int 20 +#define ID_long 21 +#define ID_pascal 22 +#define ID_register 23 +#define ID_return 24 +#define ID_short 25 +#define ID_sizeof 26 +#define ID_static 27 +#define ID_struct 28 +#define ID_switch 29 +#define ID_typedef 30 +#define ID_union 31 +#define ID_unsigned 32 +#define ID_void 33 +#define ID_while 34 + +/* CPP - Identifier duerfen auch als normale Identifier */ +/* verwendet werden !! */ +#define ID_define 35 +#define ID_undef 36 +#define ID_include 37 +#define ID_ifdef 38 /* if ... auch normales C !! */ +#define ID_ifndef 39 +/* #define ID_else 40 .... ^^^^^ */ +#define ID_endif 41 +#define ID_line 42 +#define ID_file 43 + +/* Erweiterungen: (ZORLAND) ----------------------------------------------- */ +#define ID_volatile 44 +#define ID_message 45 + +/* IDENTIFIER FLAGS: ------------------------------------------------------ */ +#define ID_SYN 0x8000 /* ID == Syntaktisches Symbol */ +#define ID_CPP 0x4000 /* ID == Symbol fuer CPP */ +#define ID_RSV 0xC000 /* ID == Syntakt. | CPP oder beides */ +#define ID_nFL 0x3FFF /* Flags ausmaskieren */ + +/* Debugging: ------------------------------------------------------------- */ +#ifdef QQ_scann +static char *qq_token [] = +{ + "undef00", "TOK_DEZ", "TOK_FLOAT", "TOK_CHAR", "TOK_STR", + "TOK_ID", "TOK_HEX", "TOK_OKT", "undef08", "undef09", + "TOK_DELI", "TOK_COMMENT","undef12", "undef13", "TOK_SEL", + "TOK_DEREFF", "TOK_Lor", "TOK_Land", "TOK_DEC", "TOK_INC", + "TOK_Band", "TOK_aBand", "TOK_Bor", "TOK_aBor", "TOK_MOD", + "TOK_aMOD", "TOK_DIV", "TOK_aDIV", "TOK_MUL", "TOK_aMUL", + "TOK_ADD", "TOK_aADD", "TOK_SUB", "TOK_aSUB", "TOK_XOR", + "TOK_aXOR", "TOK_COMPL", "TOK_aCOMPL", "TOK_assign", "TOK_EQ", + "TOK_LT", "TOK_LE", "TOK_GT", "TOK_GE", "TOK_not", + "TOK_NE", "TOK_Lshift", "TOK_aLshift","TOK_Rshift", "TOK_aRshift", + "TOK_BACK", "TOK_ASK", "TOK_COL", "TOK_HASH", "TOK_KOMMA", + "TOK_SEMICOL","TOK_56", "TOK_57", "TOK_58", "TOK_59", + "TOK_60", "TOK_61", "TOK_FNM1", "TOK_FNM2" +} ; + +static char *qq2_token [] = +{ + "<undef00>", "<DEZ>", "<FLOAT>", "<CHAR>", "<STR>", "<ID>", + "<HEX>", "<OKT>", "<undef08>", "<undef09>", "\n", + "/**/", "<undef12>", "<undef13>", ".", "->", "||", "&&", + "--", "++", "&", "&=", "|", "|=", "%", "%=", "/", "/=", "*", + "*=", "+", "+=", "-", "-=", "^", "^=", "~", "~=", "=", "==", + "<", "<=", ">", ">=", "!", "!=", "<<", "<<=", ">>", ">>=", + "\\", "?", ":", "#", ",", ";", "(", ")", "[", "]", "{", "}", + "<FNM1>", "<FNM2>" +} ; +#endif /* QQ_scann */ + +/* Prototypes: ------------------------------------------------------------ */ +int cc_define_output (CC_SCAN_OUTPUT *op); +struct CC_SCANNER *cc_c_init (void); + +int cc_cppb_define_output (CC_SCAN_OUTPUT *op); +int cc_cpp_define_output (CC_SCAN_OUTPUT *op); +struct CC_SCANNER *cc_cpp_init (void); + +int cc_cpp_Bdefine_output (CC_SCAN_OUTPUT *op); +void cc_cpp_Bscanner (int xch); +void cc_cpp_Binit (void); + +/* cc_sc10.c */ struct CC_C_SCANNER *cc_init_c_parser (void); + +/* cc.c */ +int cc_process (struct CC_C_SCANNER *sc_xx, char *infile, int mode, int aznr); +void cc_set_scan (int i); +long cc_r_pos (void); + +/* lex.c */ +int get_action_code (struct IDENT *id); +int find_pair (int idx, int c_idx, int t_idx); +void lex_input (int tv, long val); +void cc_proc_tell (char *fmt, char *str, int z); + +/* cppscan.c (redefinitions!) */ +int cpAsi (int st); +int cpAsc (int xch); +void cpBsi (void); +void cpBsc (int xch); + +/* scanner.c (functions redefined!!) */ +int SC_init (int st); +int SC_scanner (int xch); + +int digit (int chr); +int back_check (int chr); +#define ldigit(x) ((long) digit(x)) + +#define __CC_SCAN_ACTION__ void *_sc, int SC_ch, void *client_data + +/* CPP-SCANNER-ACTIONS prototypes: ---------------------------------------- */ +void cpp00 (__CC_SCAN_ACTION__); +void cpp01 (__CC_SCAN_ACTION__); +void cpp02 (__CC_SCAN_ACTION__); +void cpp03 (__CC_SCAN_ACTION__); +void cpp04 (__CC_SCAN_ACTION__); +void cpp05 (__CC_SCAN_ACTION__); +void cpp06 (__CC_SCAN_ACTION__); + +/* C-SCANNER-ACTIONS prototypes: ------------------------------------------ */ +void s_00 (__CC_SCAN_ACTION__); +void s_01 (__CC_SCAN_ACTION__); +void s_02 (__CC_SCAN_ACTION__); +void s_03 (__CC_SCAN_ACTION__); +void s_04 (__CC_SCAN_ACTION__); +void s_05 (__CC_SCAN_ACTION__); +void s_06 (__CC_SCAN_ACTION__); +void s_07 (__CC_SCAN_ACTION__); +void s_08 (__CC_SCAN_ACTION__); +void s_09 (__CC_SCAN_ACTION__); +void s_10 (__CC_SCAN_ACTION__); +void s_11 (__CC_SCAN_ACTION__); +void s_12 (__CC_SCAN_ACTION__); +void s_13 (__CC_SCAN_ACTION__); +void s_14 (__CC_SCAN_ACTION__); +void s_15 (__CC_SCAN_ACTION__); +void s_16 (__CC_SCAN_ACTION__); +void s_17 (__CC_SCAN_ACTION__); +void s_18 (__CC_SCAN_ACTION__); +void s_19 (__CC_SCAN_ACTION__); +void s_20 (__CC_SCAN_ACTION__); +void s_21 (__CC_SCAN_ACTION__); +void s_22 (__CC_SCAN_ACTION__); +void s_23 (__CC_SCAN_ACTION__); +void s_24 (__CC_SCAN_ACTION__); +void s_25 (__CC_SCAN_ACTION__); +void s_26 (__CC_SCAN_ACTION__); +void s_27 (__CC_SCAN_ACTION__); +void s_28 (__CC_SCAN_ACTION__); +void s_29 (__CC_SCAN_ACTION__); +void s_30 (__CC_SCAN_ACTION__); +void s_31 (__CC_SCAN_ACTION__); +void s_32 (__CC_SCAN_ACTION__); +void s_33 (__CC_SCAN_ACTION__); +void s_34 (__CC_SCAN_ACTION__); +void s_35 (__CC_SCAN_ACTION__); +void s_36 (__CC_SCAN_ACTION__); +void s_37 (__CC_SCAN_ACTION__); +void s_38 (__CC_SCAN_ACTION__); +void s_39 (__CC_SCAN_ACTION__); +void s_40 (__CC_SCAN_ACTION__); +void s_41 (__CC_SCAN_ACTION__); +void s_42 (__CC_SCAN_ACTION__); +void s_43 (__CC_SCAN_ACTION__); +void s_44 (__CC_SCAN_ACTION__); +void s_45 (__CC_SCAN_ACTION__); +void s_46 (__CC_SCAN_ACTION__); +void s_47 (__CC_SCAN_ACTION__); +void s_48 (__CC_SCAN_ACTION__); +void s_49 (__CC_SCAN_ACTION__); +void s_50 (__CC_SCAN_ACTION__); +void s_51 (__CC_SCAN_ACTION__); +void s_52 (__CC_SCAN_ACTION__); +void s_53 (__CC_SCAN_ACTION__); +void s_54 (__CC_SCAN_ACTION__); +void s_55 (__CC_SCAN_ACTION__); +void s_56 (__CC_SCAN_ACTION__); +void s_57 (__CC_SCAN_ACTION__); +void s_58 (__CC_SCAN_ACTION__); +void s_59 (__CC_SCAN_ACTION__); +void s_60 (__CC_SCAN_ACTION__); +void s_61 (__CC_SCAN_ACTION__); +void s_62 (__CC_SCAN_ACTION__); +void s_63 (__CC_SCAN_ACTION__); +void s_64 (__CC_SCAN_ACTION__); +void s_65 (__CC_SCAN_ACTION__); +void s_66 (__CC_SCAN_ACTION__); +void s_67 (__CC_SCAN_ACTION__); + +#endif /* __GG_ccscan__ */ diff --git a/lib/include/gg/ccscanr.h b/lib/include/gg/ccscanr.h new file mode 100644 index 0000000000000000000000000000000000000000..866af850ac274cd122aed6326e106fd8d53dd732 --- /dev/null +++ b/lib/include/gg/ccscanr.h @@ -0,0 +1,46 @@ +/* + * include FILE <gg/ccscanr.h> + * + * Allgemeine Defintionen fuer den Scanner + * see: cc and scanner module + * + * written: 1987 11 14 + * latest update: 1995-09-01 + * + */ + +#ifndef __GG_ccscanr__ +#define __GG_ccscanr__ + +/* ------------------------------------------------------------------------ */ +typedef void CC_SCAN_ACTION (void *_sc, int ch, void *client_data); +typedef long CC_SCANNER_POSITION (void *_sc); + +/* ------------------------------------------------------------------------ */ +struct CC_SCANNER +{ + int CCSC_PS_S; + int CCSC_status; /* Zustand des Scanners: */ + /* gueltig *bei* Ausfuehrung der */ + /* Scanner-Action */ + int CCSC_new_status; /* neuer Zustand *nach* Zustandsuebergang: */ + /* gueltig *nach* Ausfuehrung der */ + /* Scanner-Action */ + int CCSC_ch; /* gelesener Character */ + int CCSC_ch_group; /* Character Group des gelesenen Characters */ + int CCSC_nCLASS; + + int *CCSC_class_table; + int *CCSC_mx_status; + int *CCSC_mx_action; + CC_SCAN_ACTION **CCSC_action; + + CC_SCANNER_POSITION *CCSC_get_position; +} ; + +/* ------------------------------------------------------------------------ */ +int cc_classify (int class_table [], int chr); +int cc_scanner_init (struct CC_SCANNER *sc, int st); +int cc_scanner (struct CC_SCANNER *sc, int xch, void *client_data); + +#endif /* __GG_ccscanr__ */ diff --git a/lib/include/gg/cctable.h b/lib/include/gg/cctable.h new file mode 100644 index 0000000000000000000000000000000000000000..ae4d1fb954ee37dd35b0965208f8f9a73b4141c4 --- /dev/null +++ b/lib/include/gg/cctable.h @@ -0,0 +1,62 @@ +/* + * include FILE <gg/cctable.h> + * + * written: 1987 11 15 + * 1990 07 22: Revision + * latest update: 1995-08-30 + * + */ + +#ifndef __GG_cctable__ +#define __GG_cctable__ + +/* ------------------------------------------------------------------------ */ +#define ID_LNG 24 /* signif. Laenge eines Identifiers */ +#define ID_Tsize 100 /* Groesse der Symbol-Tabelle */ +#define FL_Tsize 40 /* . . Float-Konst-Tabelle */ +#define ST_Tsize 50 /* . . String-Konst-Tabelle */ +#define ST_Psize 400 /* . des String Puffers */ + +/* ------------------------------------------------------------------------ */ +struct IDENT +{ + int atyp; + char *name; +} ; + + +/* ------------------------------------------------------------------------ */ +struct FLOAT_CONST +{ + long fv1; + int fv2, fv3, evz, mvz; +} ; + +/* ------------------------------------------------------------------------ */ +struct ppFLOAT_CONST +{ + struct ppFLOAT_CONST *fl_nxt; + struct FLOAT_CONST fl_flt; +} ; + +/* ------------------------------------------------------------------------ */ +struct ppSTRING +{ + struct ppSTRING *st_nxt; + char strv [4]; +} ; + +/* ------------------------------------------------------------------------ */ +#ifndef NIL +#define NIL (char *) 0 +#endif + +/* ------------------------------------------------------------------------ */ +void cc_table_init (void); +struct IDENT *cc_inst_id (char *s); +char *cc_str_const (char *s); +struct FLOAT_CONST *cc_fl_const (long v1, int v2, int v3, int vz); +struct IDENT *cc_rsvd_id (char *s, unsigned int num); +void cc_in_rsvd (void); + +#endif /* __GG_cctable__ */ diff --git a/lib/include/gg/ckslib.h b/lib/include/gg/ckslib.h new file mode 100644 index 0000000000000000000000000000000000000000..de06a1391196611e952cfffce04eec5bc26582be --- /dev/null +++ b/lib/include/gg/ckslib.h @@ -0,0 +1,141 @@ +/* + * include FILE <gg/ckslib.h> + * + * Datenstrukturern fuer Pruefsummen Generator und Pruefer + * + * written: 1989 12 26 + * latest update: 1999-04-25 11:04:54 + * + */ + +#ifndef __GG_ckslib__ +#define __GG_ckslib__ + +#include <gg/floskel.h> +#pragma pack(1) + +#define ALLOW_MD5 + +/* ------------------------------------------------------------------------ */ +#define CKS_VERSION 0x0000 +#define FNLEN 66 +#define COMMENT_LENGTH 50 +#define MD5_DIGEST_LENGTH 16 +/* Note: COMMENT_LENGTH+MD5_DIGEST_LENGTH == 66 */ + +#define OPERATION_MODES 0x0003 +#define OPERATION_CHECK_ENTRY 0x0000 +#define OPERATION_NEW_ENTRY 0x0001 +#define OPERATION_DISPLAY_ENTRY 0x0002 +#define OPERATION_DONT_EDIT 0x0010 + +/* ------------------------------------------------------------------------ */ +struct CKSLIB_HEADER /* Beginn eines Library Files */ +{ /* wird z.Z. nicht geprueft !!!!!!! */ + char ckslib_v1 [4]; /* CKS-Signature */ + int ckslib_version; /* CKS-Version Nummer */ + char ckslib_dummy [10]; /* reserved */ +} ; + +/* ------------------------------------------------------------------------ */ +struct CKSLIB /* Eintrag fuer ein geprueftes File */ +{ /* in der Checksum-Library */ + char ckslib_path [FNLEN]; /* Pfad des geprueften Files */ + /* Das *sollte* der *vollstaendige* */ + /* Pfad inklusive Laufwerks- */ + /* bezeichnung sein! */ + char ckslib_comment [COMMENT_LENGTH]; /* Freier Kommentar String */ + char ckslib_md5 [MD5_DIGEST_LENGTH]; /* MD5 message digest block */ + + long ckslib_c0; /* CKS: Anfang des Files (4 Bytes) */ + long ckslib_c1; /* CKS: Laenge des Files */ + long ckslib_c2; /* CKS: */ + long ckslib_c3; /* CKS: */ + int ckslib_c4; /* CKS: */ + + int ckslib_flags; +#define CKSLF_update 0x01 /* bit 0: update */ +#define CKSLF_multi 0x02 /* bit 1: multiple entry */ +#define CKSLF_md5 0x04 /* bit 2: md5 string present */ + + int ckslib_class; /* 0: normal */ + /* 1: Text (Bsp. Config.SYS */ + /* 2: Autopatch (Laenge gleich) */ + /* 3: WATCH OUT */ +} ; + +/* ------------------------------------------------------------------------ */ +struct VIRUS_TYPES +{ + struct VIRUS_TYPES *next; /* Listenverkettung */ + int vir_match; /* Bei Uebereinstimmung gesetzt wenn ... */ + /* Bit 0: Laenge exakt */ + /* Bit 1: Laenge im gueltigen Bereich */ + /* Bit 2: Filename matcht Typ */ + /* Bit 3: (reserved) */ + /* Bit 4: Sequenz matcht */ + int vir_seq_match_count; /* Zaehler fuer die Anzahl der SEQ-Matches */ + char *vir_name; /* Bezeichnung des Virus */ + char *vir_type; /* Befallene Files: *.COM, *.EXE, .. */ + /* Virus-Laenge: Zahl der Bytes, um die ein */ + /* durch den Virus befallenes */ + /* File verlaengert wird. */ + long vir_length1, /* V-Laenge: exakt oder minimal */ + vir_length2; /* 0 oder maximal */ + char *vir_action [6]; /* Actions to perform on (infected) file */ +} ; + +/* ------------------------------------------------------------------------ */ +struct CKS_SEQUENCE +{ + int seq_code; /* Virus Code: -1 -> undefiniert */ + struct CKS_SEQUENCE *seq_next; /* anderer Code in gleicher Ebene */ + struct CKS_SEQUENCE *seq_follow; /* folgender Code der Sequenz */ + struct VIRUS_TYPES *seq_virus; /* betroffener Virus */ + int seq_virus_number; /* Nummer der matchend Sequenz */ +} ; + +/* prototypes cks.c ------------------------------------------------------- */ +void cdecl reset_verbose_mode (void); + +/* prototypes ckscomm.c --------------------------------------------------- */ +void cdecl comment_reset (void); +void cdecl comment_generate (char *fn, int mode, struct CKSLIB *entry, + long check_0, long check_1, long check_2, + long check_3, int check_4, + unsigned char *md5_digest, + char *entry_comment []); +char *cdecl prepare_command_line (int nr, char *action, char *fn); +void cdecl comment_virus_report (FILE *fp, char *fn); +void cdecl comment_init (char *fn); + +/* prototypes cksdiag.c --------------------------------------------------- */ +int cdecl cks_check_file (char *fnm, char *c0, long *c1, long *c2, long *c3, + int *c4, unsigned char *md5_digest); +void cdecl cks_seq_start (void); +void cdecl cks_seq_append_code (int code); +void cdecl cks_seq_last_code (struct VIRUS_TYPES *vt, int seq_cnt); +void cdecl cks_set_rotor_call (long rc, void (*fun)(long)); + +/* prototypes cksi01.c ---------------------------------------------------- */ +void cdecl cks_screen_init (void); +int cdecl edit_entry (int mode, struct CKSLIB *ckslib, long check_0, + long check_1, long check_2, long check_3, int check_4, + unsigned char *md5_digest, + char *comment []); +void cdecl install_menues (void); +void cdecl interactive_wait (long total_size); +void cdecl interactive_rotor (long act_size); +void cdecl interactive_text (char *txt); +void cdecl print_long (int p, int x, int y, int c, char *fmt, long val); + +/* prototypes ckslib.c ---------------------------------------------------- */ +void cdecl ckslib_reset (void); +int cdecl ckslib_finis (void); +int cdecl ckslib_newlib (char *libname); +int cdecl cks_lookup (char *fn, struct CKSLIB *ckslib); +int cdecl cks_new (struct CKSLIB *ckslib); +int cdecl cks_update (struct CKSLIB *ckslib); +int cdecl open_library (void); + +#endif /* __GG_ckslib__ */ diff --git a/lib/include/gg/codes.h b/lib/include/gg/codes.h new file mode 100644 index 0000000000000000000000000000000000000000..07007a5f3561337b9dfcd55a765e03fe5974839d --- /dev/null +++ b/lib/include/gg/codes.h @@ -0,0 +1,198 @@ +/* + * include FILE <gg/codes.h> + * + * data structures and functions to manipulate code sets + * - prototypes + * + * written: 1992-12-25: <Gerhard.Gonter@wu-wien.ac.at> + * latest update: 1995-12-10 + * + */ + +#ifndef __GG_codes__ +#define __GG_codes__ + +#include <gg/floskel.h> + +/* ------------------------------------------------------------------------ */ +struct CS_field +{ + struct CS_field *CSf_next; /* next field in the list */ + char *CSf_name; /* name of the attribute */ + void *CSf_info; /* hook for additional information */ + long CSf_type; /* type of the attribute value */ +#define CSft_undefined 0 /* no value defined */ +#define CSft_number 1 /* integer number */ +#define CSft_string 2 /* double quoted string */ +#define CSft_identifier 3 /* identifier string */ +#define CSft_count 4 /* number of different types */ + char *CSf_string; /* string value attribute */ + long CSf_number; /* integer value of attribute */ +} ; + +/* ------------------------------------------------------------------------ */ +struct CS_record +{ + struct CS_record *CSr_next; /* next record in the list */ + struct CS_field *CSr_fields; /* list of fields in that record */ + void *CSr_info; /* hook for additional information */ + long CSr_count; /* number of fields in record */ + long CSr_offset_dat; /* offset in data file */ + long CSr_offset_str; /* offset in string file */ +} ; + +/* ------------------------------------------------------------------------ */ +struct CS_attribute_statistics +{ + struct CS_attribute_statistics *CSa_next; + char *CSa_name; /* name of the attribute */ + long CSa_tcnt [CSft_count]; /* total number of given type */ + long CSa_ucnt [CSft_count]; /* number of used given type */ +} ; + +/* ------------------------------------------------------------------------ */ +struct CS_tlate_table /* string translation table */ +{ + char *CStt_table_name; /* informal name of the table */ + char *CStt_file_name; /* name of the file that holds data */ + char *CStt_table [256]; /* translation table */ +} ; + +/* ------------------------------------------------------------------------ */ +/* entity translation structure for translation of 8-bit coding blocks */ +struct CS_ET8 +{ + long CS_et8_table_id; /* numerical id of a given translation tbl */ + int CS_et8_error_flag; /* != 0 -> something terrible has happened */ + + char *CS_et8_lut_fnm; /* name of file containing entity->code tbl */ + char *CS_et8_lut; /* entity to code table */ + long CS_et8_lut_size; /* size of the table */ + + char *CS_et8_index_fnm; /* name of the file containing offset tbl */ + long *CS_et8_index; /* offset into string buffer for given code */ + /* this table has always 256 entries */ + + char *CS_et8_string_fnm; /* name of the file containing strings */ + char *CS_et8_string_buffer; /* string buffer for the needed entities */ + long CS_et8_string_size; /* size of the buffer */ +} ; + +#ifdef MSDOS +#define MAX_CS_ET8_SIZE 0x00007FF0L +#else +#define MAX_CS_ET8_SIZE 0x10000000L +#endif + +/* Code Set Field IDs: ---------------------------------------------------- */ +#define CSfid_ascii 0x61736369L /* ASCII code */ +#define CSfid_pc 0x70630000L /* standard pc code (--> 437) */ +#define CSfid_pc437 0x70630437L /* standard code page */ +#define CSfid_pc850 0x70630850L /* multilingual code page */ +#define CSfid_mac 0x6D163000L /* macintosh codes */ +#define CSfid_ebcdic 0xEBCD1C00L /* standard ebcdic */ +#define CSfid_ebcdic_gr 0xEBCD1C67L /* german ebcdic */ +#define CSfid_ebcdic_en 0xEBCD1C65L /* english ebcdic */ +#define CSfid_iso8859 0x00885900L +#define CSfid_iso8859_1 0x00885901L +#define CSfid_iso8859_2 0x00885902L +#define CSfid_iso10646 0x01064600L +#define CSfid_tex 0x74657800L /* tex ... plain TeX */ +#define CSfid_latex 0x7465786CL /* texl ... LaTeX */ +#define CSfid_amstex 0x74657861L /* texa ... AMS-TeX */ +#define CSfid_latex_gr 0x74657847L /* texG ... german documentstyle */ +#define CSfid_tex_f 0x74657866L /* texf ... TeX fonts */ + +#define CSfid_entity 0x00887965L +#define CSfid_entityset 0x00887973L + +#define CSfid_catn 0x6361746EL /* catn ... category names */ +#define CSfid_catc 0x63617463L /* catc ... category codes */ +#define CSfid_catf1 0x63617431L /* cat1 ... category flags 1 */ +#define CSfid_catf2 0x63617432L /* cat2 ... category flags 2 */ + +/* filenames: ------------------------------------------------------------- */ +#define CSF_TABLE "codes/table" +#define CSF_PC_INDEX "codes/entpc437.idx" +#define CSF_PC_STRINGS "codes/entpc437.str" +#define CSF_PC_COMPACT_LUT "codes/entpc437.lut" +#define CSF_8859_1_INDEX "codes/ent88591.idx" +#define CSF_8859_1_STRINGS "codes/ent88591.str" + +/* prototypes: ------------------------------------------------------------ */ +/* cs001 */ struct CS_record *cdecl cs_parse_code_table (char *fn, + char *matching_field [], int field_cnt, int filter, + int max_warnings); +/* cs001 */ long cdecl cs_tnum_records (void); +/* cs001 */ long cdecl cs_unum_records (void); +#ifdef _FILE_DEFINED +/* cs002 */ long cdecl cs_print_records (FILE *fo, struct CS_record *recs); +/* cs003 */ long cdecl cs_print_fields (FILE *fo, struct CS_field *fields); +#endif +/* cs004 */ int cdecl cs_records2ytree (struct CS_record *recs, char *field[], + long tags[], int fields, char *lut_file, char *data_file, + int verbose, int compact, int all); +/* cs005 */ int cdecl cs_records2index (struct CS_record *recs, char *field[], + int fields, char *index_file, char *data_file, int verbose); +/* cs006 */ int cdecl cs_records2table (struct CS_record *recs, + char *src_attr[], int src_attr_cnt, char *dst_attr[], + int dst_attr_cnt, int table_type, long *table); +/* cs006 */ int cdecl set_common_base (int flag); +/* cs007 */ struct CS_field *cdecl cs_find_field (struct CS_record *first, + char *f1_name, int f1_type, char *f1_string, long f1_number, + char *f2_name); +/* cs008 */ int cdecl cs_free_fields (struct CS_field *csf, + /* void (*free_info) (void *), */ + int free_names, int free_values); +/* cs009 */ int cdecl cs_count_attribute (char *attribute, int atype, + int used); +/* cs009 */ struct CS_attribute_statistics + *cdecl cs_get_attribute_statistics (void); +/* cs009 */ void cdecl cs_reset_attribute_statistics (void); +#ifdef _FILE_DEFINED +/* cs010 */ int cdecl cs_print_statistics (FILE *fo); +/* cs011 */ long cdecl cs_print_frames (FILE *fo, struct CS_record *recs); +/* cs012 */ long cdecl cs_print_frame (FILE *fo, struct CS_field *fields); +#endif + +/* cs101 */ int cdecl INIT_get_sgml_entity (char *fnm_idx, char *fnm_str); +/* cs101 */ int cdecl KILL_get_sgml_entity (void); +/* cs101 */ char *cdecl get_sgml_entity (int ch); + +/* cs102 */ int cdecl INIT_find_sgml_entity (char *fnm_lut); +/* cs102 */ int cdecl KILL_find_sgml_entity (void); +/* cs102 */ int cdecl find_sgml_entity (char *entity); + +/* cs103 */ struct CS_ET8 *cdecl cs_et8_create_table (long table_id, + char *fnm_dat, char *fnm_idx, char *fnm_lut); +/* cs104 */ int cdecl cs_et8_destroy_table (struct CS_ET8 *et8); +/* cs105 */ char *cs_et8_code2entity (struct CS_ET8 *et8, int ch); +/* cs106 */ int cdecl cs_et8_entity2code (struct CS_ET8 *et8, char *entity); +#ifdef _FILE_DEFINED +/* cs107 */ long cdecl cs_et8_fputc (struct CS_ET8 *et8, int ch, FILE *fo); +/* cs108 */ long cdecl cs_et8_fputs (struct CS_ET8 *et8, char *str, FILE *fo); +/* cs109 */ long cdecl cs_et8_ftransfer (struct CS_ET8 *et8, + FILE *fi, FILE *fo, long cpy_size); +#endif /* _FILE_DEFINED */ +/* cs110 */ long cdecl cs_et8_encode (struct CS_ET8 *et8, + char *fni, char *fno, long cpy_size); + +#ifdef _FILE_DEFINED +/* cs201 */ long cdecl cs_convert_stream (FILE *fi, FILE *fo, + long *table, long limit); +#endif +/* cs202 */ int cdecl cs_convert_file (char *fni, char *fno, long *table); +/* cs203 */ long cdecl cs_convert_string (char *str, long *table); + +/* cs204 */ int cs_string_tlate (char *dst, char *src, int dst_size, + struct CS_tlate_table *tt); +/* cs205 */ struct CS_tlate_table *cs_load_tlate_table ( + char *file_name, char *table_name); +#ifdef _FILE_DEFINED +/* cs206 */ int cdecl cs_print_tlate_table (FILE *fo, char *file_name, + char *table_name); +#endif + +/* cs207 */ long cdecl cs_convert_block (char *str, long size, long *table); + +#endif /* __GG_codes__ */ diff --git a/lib/include/gg/convent.h b/lib/include/gg/convent.h new file mode 100644 index 0000000000000000000000000000000000000000..3eff001c06604912176e5c190fdef96f289a942f --- /dev/null +++ b/lib/include/gg/convent.h @@ -0,0 +1,38 @@ +/* + * include FILE <gg/convent.h> + * + * Convert Characters to Entities + * + * written: 1991 07 03 + * latest update: 1995-12-10 + * $Id: convent.h,v 1.2 2005/09/04 20:27:37 gonter Exp $ + * + */ + +#ifndef __GG_convent__ +#define __GG_convent__ + +#include <gg/floskel.h> + +/* conversion flags ------------------------------------------------------- */ +#define CONVENT_amp 0x0001 +#define CONVENT_lt_gt 0x0002 +#define CONVENT_8bit 0x0004 +#define CONVENT_pc_8bit 0x0004 +#define CONVENT_mac_8bit 0x0008 +#define CONVENT_pc_text 0x0007 + +/* prototypes ------------------------------------------------------------- */ +/* convent1.c */ int cdecl sgml_entity_conversion (char *fni, char *fno, + int level); +/* convent2.c */ char *cdecl get_pc_sgml_entity (int ch); + int cdecl find_pc_sgml_entity (const char *s); +/* convent4.c */ char *cdecl get_typographic_sgml_entity (int ch); + int cdecl find_typographic_sgml_entity (char *s); + +#ifdef _FILE_DEFINED +/* convent5.c */ int cdecl fputc_entity (int ch, FILE *fo, int level); +/* convent6.c */ int cdecl fputs_entity (char *s, FILE *fo, int level); +#endif /* _FILE_DEFINED */ + +#endif /* __GG_convent__ */ diff --git a/lib/include/gg/csed.h b/lib/include/gg/csed.h new file mode 100644 index 0000000000000000000000000000000000000000..3a98d93fa40a999209769104b4c54df05a39770a --- /dev/null +++ b/lib/include/gg/csed.h @@ -0,0 +1,115 @@ +/* + * include FILE <gg/csed.h> + * + * Defintionen fuer DED 80/40-Zeichen Bildschirmeditor + * - prototypes + * + * written: 1989 07 22 + * latest update: 1995-10-26 + * + */ + +#ifndef __GG_csed__ +#define __GG_csed__ + +#define DED_EXIT 0x0801 +#define DED_CUP 0x0802 +#define DED_CDOWN 0x0803 +#define DED_CLEFT 0x0804 +#define DED_CRIGHT 0x0805 +#define DED_HOME 0x0806 +#define DED_END 0x0807 +#define DED_FIELD_CREATE 0x0810 +#define DED_FIELD_TOGGLE 0x0811 +#define DED_FIELD_DELETE 0x0812 +#define DED_FIELD_SHORT 0x0813 +#define DED_FIELD_ATTRIBUTE 0x0814 +#define DED_FIELD_DEFAULT_1 0x0815 +#define DED_FIELD_DEFAULT_2 0x0816 +#define DED_FIELD_REPEAT 0x0817 +#define DED_FIELD_TYPE 0x0818 +#define DED_FIELD_OFFSET 0x0819 +#define DED_FIELD_FWD 0x0880 +#define DED_FIELD_BWD 0x0881 +#define DED_FIELD_TYPEAHEAD 0x0882 +#define DED_FIELD_REEDIT 0x0883 +#define DED_FIELD_CLR 0x0884 +#define DED_FIELD_LENGTH 0x0885 +#define DED_FIELD_SINGLE 0x0886 +#define DED_FIELD_ATTR2 0x0887 +#define DED_FIELD_FORMAT 0x0888 +#define DED_FIELD_HELP 0x0889 +#define DED_COLOR_FOREGROUND 0x0820 +#define DED_COLOR_BACKGROUND 0x0821 +#define DED_COLOR_BLINK_HELL 0x0822 +#define DED_COLOR_SCREEN 0x0823 +#define DED_COLOR_BORDER 0x0824 +#define DED_COLOR_DEL_BORDER 0x0825 +#define DED_REFRESH 0x0830 +#define DED_STATUS_TOGGLE 0x0831 +#define DED_BLOCK_BEGIN 0x0840 +#define DED_BLOCK_END 0x0841 +#define DED_BLOCK_DO 0x0842 +#define DED_DBOX_R 0x0843 +#define DED_DBOX_D 0x0844 +#define DED_DBOX_L 0x0845 +#define DED_DBOX_U 0x0846 +#define DED_SBOX_R 0x0847 +#define DED_SBOX_D 0x0848 +#define DED_SBOX_L 0x0849 +#define DED_SBOX_U 0x0850 +#define DED_CBOX_R 0x0851 +#define DED_CBOX_D 0x0852 +#define DED_CBOX_L 0x0853 +#define DED_CBOX_U 0x0854 +#define DED_INS_TOGGLE 0x0860 +#define DED_DEL_LEFT 0x0861 +#define DED_DEL_RIGHT 0x0862 +#define DED_DEL_OBJECT 0x0863 +#define DED_MOVE_OBJECT 0x0864 +#define DED_MARK 0x0865 +#define DED_RETURN 0x0866 +#define DED_CUT 0x0867 +#define DED_PASTE 0x0868 +#define DED_COMPILE 0x0869 + +/* Beschraenkungen: ------------------------------------------------------- */ +#define M_FLDB 1700 /* . . . Field . */ +#define M_SO 200 /* max. Anz der Screen Objekte */ +#define M_FO M_FLDB/FLD_size /* . . . Fields */ +#define M_FLD 30 /* . . . Menue/FR- Selections */ + +/* KEYS: Names Values Alias */ +#define K_EXIT 0x0141 +#define K_CUT 0x012E +#define K_PASTE 0x0119 +#define K_INDEX 0x0117 +#define K_DOC 0x0120 +#define K_HARD 0x0007 /* Hardcopy */ + +#define SIG(x) (x) +#define POS(x) ((x)&0x00FF) + +/* prototypes: ------------------------------------------------------------ */ +void cdecl alt_field (char *f, int cx, int cy); +void cdecl w_print_int (int p, int x, int y, int attr, char *fmt, int val); + +int cdecl col_8040_ed (char *fr_name, char s [], char f [], int flag); +void cdecl display_f (char *s); +void cdecl DED_rst (void); + +int cdecl synt_sync (FILE *fi, char *struct_name, char *fr_name); +int cdecl synt_data (FILE *fi, char data [], int flg); + +void cdecl set_comp_option (int opt); +int cdecl open_comp_file (char *name, char *mode, int flg); +void cdecl close_comp_file (void); +int cdecl comp_screen (char *fr_name, char *data); +int cdecl comp_fields (char *fr_name, char *data); +int cdecl comp_fk (char *fr_name, char *data); +void cdecl comp_comment (char *fr_name); + +int cdecl comp_data (FILE *comp_file, char *data, char *pfx, + char *fr_name, int hex, int neun_neun_neun); + +#endif /* __GG_csed__ */ diff --git a/lib/include/gg/dates.h b/lib/include/gg/dates.h new file mode 100644 index 0000000000000000000000000000000000000000..abe67b771dab10ee4b8c1ec39e23ef22b6fdc37e --- /dev/null +++ b/lib/include/gg/dates.h @@ -0,0 +1,228 @@ +/* + * include FILE <gg/dates.h> + * + * operation with dates, days, months and years + * + * written: 1992 08 30 + * latest update: 1998-08-04 12:30:15 + * $Id: dates.h,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifndef __GG_dates__ +#define __GG_dates__ + +#include <time.h> +#include <gg/floskel.h> + +/* ------------------------------------------------------------------------ */ +#define DT_int 1 +#define DT_str_mon 2 +#define DT_str_tz 41 +#define DT_int_tz 41 +#define DT_str_tzm 42 +#define DT_int_tzm 42 +#define DT_str_junk 99 +#define DT_int_day 201 +#define DT_int_year 202 +#define DT_int_hour 301 +#define DT_int_min 302 +#define DT_int_sec 303 + +/* date and time formats: ------------------------------------------------- */ +#define DATIMfmt_none 0 /* nothing at all... */ +#define DATIMfmt_date_time 1 /* YYYY-MM-DD hh:mm:ss */ +#define DATIMfmt_date 2 /* YYYY-MM-DD */ +#define DATIMfmt_time 3 /* hh:mm:ss (hh: 0..23) */ +#define DATIMfmt_touch 4 /* MMDDhhmmYY */ +#define DATIMfmt_touch_gnu 5 /* MMDDhhmmCCYY.ss */ +#define DATIMfmt_touch_linux 5 +#define DATIMfmt_touch_aix 6 /* CCYYMMDDhhmm.ss */ +#define DATIMfmt_dos_date 7 /* MM-DD-YYYY */ +#define DATIMfmt_this_month 8 /* YYYY-MM */ +#define DATIMfmt_month 8 /* YYYY-MM */ +#define DATIMfmt_elm_mbox 9 /* ddd mmm dd hh:mm:ss YYYY */ +#define DATIMfmt_time2 10 /* hh:mm:ss (hh: 00..23) */ +#define DATIMfmt_next_month 11 /* YYYY-MM */ +#define DATIMfmt_last_month 12 /* YYYY-MM */ +#define DATIMfmt_seconds 13 +#define DATIMfmt_GMT 0x1000 /* to be used in a bit combination */ + +/* CC ... century (19..20?) */ +/* YY ... year (00..99) */ +/* YYYY ... year (0..9999) */ +/* MM ... month (01..12) */ +/* DD ... day */ +/* hh ... hour (00..23) */ +/* mm ... minute (00..59) */ +/* ss ... second (00..59) */ +/* ddd ... day as a string */ +/* mdd ... month as a string */ + +/* ------------------------------------------------------------------------ */ +struct DATE_str +{ + int DStr_type; /* DT_xxxx */ + int DStr_value; + int DStr_min_str; + char *DStr_str; +} ; + +/* ------------------------------------------------------------------------ */ +struct DAY_INFO_EXTRA +{ + struct DAY_INFO_EXTRA *DAYIE_next; + char *DAYIE_country; + char *DAYIE_description; + + int DAYIE_type; +#define DAYIET_undef 0 +#define DAYIET_fixed 1 /* fixed month/day */ + /* statically allocated */ +#define DAYIET_variable 2 /* variable month/day, */ + /* dynamically allocated */ + + int DAYIE_class; +#define DAYIEC_standard 0 +#define DAYIEC_note 1 /* not a bank holiday or such */ +#define DAYIEC_holiday 2 +#define DAYIEC_bank 3 + + int DAYIE_month; + int DAYIE_day; + int DAYIE_year_first; + int DAYIE_year_last; +} ; + +/* ------------------------------------------------------------------------ */ +struct DAY_INFO +{ + int DAYI_year; + int DAYI_month; + int DAYI_day; + int DAYI_wday; /* day of the week: 0..SUN, 6..SAT */ + struct DAY_INFO_EXTRA *DAYI_extra; +} ; + +#define DAYI_sunday 0 +#define DAYI_monday 1 +#define DAYI_tuesday 2 +#define DAYI_wednesday 3 +#define DAYI_thursday 4 +#define DAYI_friday 5 +#define DAYI_saturday 6 + +/* ------------------------------------------------------------------------ */ +struct YEAR_INFO +{ + int YI_year; + int YI_is_leap_year; + int YI_days_of_month [12]; + int YI_month_beg [12]; +#define YI_DI_cnt 366 + struct DAY_INFO YI_day_info [YI_DI_cnt]; +#define YI_AV_COLUMNS 21 /* 3 monnths with 7 days per line */ +#define YI_AV_LINES 24 /* 4 such blocks spanning up to 6 weeks */ + struct DAY_INFO *YI_av [YI_AV_LINES][YI_AV_COLUMNS]; /* alternative view */ + + struct DAY_INFO *YI_easter; +} ; + +/* ------------------------------------------------------------------------ */ +/* dt001 */ int cdecl actual_datim (char *datum, int format); +/* dt001b */ int cdecl _actual_datim (char *datum, int format, time_t tt); +/* dt002 */ int cdecl actual_datim_int (int *jahr, int *monat, int *tag, + int *stunde, int *minute, int *sekunde); +/* dt002b */ int cdecl get_current_year (void); +#ifdef _FILE_DEFINED +/* dt003 */ int cdecl print_date_time (FILE *fo); +#endif +/* dt004 */ void cdecl prepare_date (char *datum, char *tz, int max_lng); + +/* dt006 */ int cdecl days_of_month (int year, int month); +/* dt007 */ int cdecl is_leap_year (int year); +#ifdef _TM_DEFINED +/* dt008 */ int cdecl modify_date (struct tm *d, int delta); +#endif + +/* dt010 */ long cdecl day_number (int jahr, int mon, int tag); +/* dt011 */ int cdecl weekday (int jahr, int mon, int tag); +/* dt014a */ extern char *DAY_OF_WEEK3 []; +/* dt014b */ extern char *DAY_OF_WEEK2 []; +/* dt015a */ extern char *MONTH_NAME []; + +/* dt021 */ int cdecl chk_datum (char *sb, char *se, int sl, int *d, + int *e, int *beg_jahr); +/* dt022 */ int cdecl get_datum (char *s, int zone_begin, int zone_end, + int *jahr, int *mon, int *tag); +/* dt023 */ int cdecl get_jahr_mon_tag (char *s, int *ii, int *vv, + char *m, int ms, int *msr); +/* dt024 */ int cdecl delta_datum (int bjahr, int bmon, int btag, long *v1, + int *t1, int ejahr, int emon, int etag, long *v2, int *t2, + int *d, int *e); +/* dt025 */ int cdecl valid_datum (int jahr, int mon, int tag, long *v, + int *t, int *xsj, int *xt); + +/* dt031 */ int cdecl analyze_date (const char *s, int *jahr, int *mon, int *tag, + int *std, int *minutes, int *sek, int *x_timezone); +/* dt032 */ int cdecl analyze_dat_str (char *name, int dat_val [], + int dat_typ [], int *dat_stack, int STACK_SIZE); +/* dt033 */ int cdecl check_for_timezone (int *v, int *s, char *str); +/* dt034 */ int cdecl get_easter (int year, int *month, int *day); +/* dt035 */ int cdecl get_day_index (struct YEAR_INFO *yi, int mon, int day); +/* dt036 */ struct DAY_INFO_EXTRA *cdecl create_day_info_extra ( + char *country, int d_class, char *description); +/* dt037 */ struct DAY_INFO *cdecl fixup_day (struct YEAR_INFO *yi, + int idx, struct DAY_INFO_EXTRA *dep); +/* dt038 */ int get_wday_index (struct YEAR_INFO *yi, int mon, int wday, + int num); + +/* dt041 */ int cdecl setup_year_info (struct YEAR_INFO *yi, int year); +/* dt042 */ int cdecl cal_reset_year_info (struct YEAR_INFO *yi); + +#ifdef _FILE_DEFINED +/* cal01 */ int print_yi_year (FILE *fo, struct YEAR_INFO *yi, int year, + char *frame_name, int year_prev, int year_next, char *pfx); +/* cal02 */ int print_yi_months (FILE *fo, struct YEAR_INFO *yi, + int year_prev, int year_next, char *pfx); +/* cal03 */ int print_yi_days (FILE *fo, struct YEAR_INFO *yi, char *pfx); +#endif /* _FILE_DEFINED */ + +/* cal04 */ extern struct DAY_INFO_EXTRA AT_holiday []; +/* cal05 */ int cdecl fixup_extra_information (struct YEAR_INFO *yi, + struct DAY_INFO_EXTRA de []); +/* cal06 */ int cdecl get_day_string (char *day_frame, struct DAY_INFO *di); + +#ifdef _FILE_DEFINED +/* cal07 */ int cdecl print_calendar (FILE *fo, int year_from, + int year_to, int print_what, char *pfx); +#endif /* _FILE_DEFINED */ +#define CAL_PRINT_root_frame 0x0001 +#define CAL_PRINT_year 0x0002 +#define CAL_PRINT_months 0x0004 +#define CAL_PRINT_days 0x0008 +#define CAL_PRINT_alternative_view 0x0010 + +/* cal08 */ int cdecl cal_reset_alternative_view (struct YEAR_INFO *yi); +/* cal09 */ int cdecl cal_setup_alternative_view (struct YEAR_INFO *yi); +#ifdef _FILE_DEFINED +/* cal10 */ int cdecl cal_print_alternative_view (FILE *fo, + struct YEAR_INFO *yi, char *pfx); +#endif /* _FILE_DEFINED */ + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +/* planner0.c */ int cdecl generate_week (FILE *fo, int week_from, + int week_to); +#ifdef _TM_DEFINED + int cdecl setup_week (struct tm *day [], int days, int wko); + +/* planner1.c */ int cdecl print_week (FILE *fo, struct tm *day[], int days, + char *period, int language); +#endif /* _TM_DEFINED */ + +/* plannerl.c */ int cdecl latex_header (FILE *fo); + int cdecl latex_trailer (FILE *fo); +#endif /* _FILE_DEFINED */ + +#endif /* __GG_dates__ */ diff --git a/lib/include/gg/dbx.h b/lib/include/gg/dbx.h new file mode 100644 index 0000000000000000000000000000000000000000..93fdee1686a2235e0a89d759e47665f9208d6134 --- /dev/null +++ b/lib/include/gg/dbx.h @@ -0,0 +1,111 @@ +/* + * include FILE <gg/dbx.h> + * + * methods + * data structures + * constants + * prototypes + * + * written: 1996-11-26 + * latest udpate: 1996-11-26 17:42:13 + * + */ + +#ifndef __GG_dbx__ +#define __GG_dbx__ + +#include <gg/array.h> +#include <gg/floskel.h> + +/* methods: --------------------------------------------------------------- */ + +/* ------------------------------------------------------------------------ */ +struct DBX_FIELD_DESCRIPTOR +{ + int type; + char *name; + int size; +} ; + +#define DBX_Fty_undef 0 +#define DBX_Fty_string 1 +#define DBX_Fty_long 2 + +/* data structures: ------------------------------------------------------- */ +struct DBX_SCHEMA +{ + char *name; + int n_fields; + struct DBX_FIELD_DESCRIPTOR *fields [2]; /* n_fields fields !!! */ +} ; + +/* ------------------------------------------------------------------------ */ +struct DBX_RECORD +{ + struct DBX_SCHEMA *schema; + int n_fields; + void *fields [2]; /* n_fields fields !!! */ +} ; + +/* ------------------------------------------------------------------------ */ +struct DBX_FILE_DESCRIPTOR +{ + int type; + char *fnm; + + void *fi1; /* stream descriptor 1 */ + + struct DBX_SCHEMA *schema; + + int is_fixed_record_size; + long record_size; + long header_size; +} ; + +/* ------------------------------------------------------------------------ */ +/* specific for DBF Files: */ +#define DBX_DBF_PFX_SIZE 32 +#define DBX_DBF_FDESC_SIZE 32 +#define DBX_DBF_NAME_SIZE 11 +#define DBX_DBF_off_hdr_size 0x08 +#define DBX_DBF_off_rec_size 0x0A + +#define DBX_DBF_off_name 0x00 +#define DBX_DBF_off_fld_type 0x0B +#define DBX_DBF_off_fld_size 0x10 + +#ifdef __COMMENT__ +The DBF header consists of a 32 byte prefix followed by a series of +field descriptors. + +The prefix contains at offset: + +DBX_DBF_off_hdr_size 0x08 .. 0x09 header_size +DBX_DBF_off_rec_size 0x0A .. 0x0B record_size + +Each field descriptor is 32 byte long and contains at offset: + +DBX_DBF_off_name 0x00 .. 0x0A name +DBX_DBF_off_fld_type 0x0B field_type_code +DBX_DBF_off_fld_size 0x10 .. 0x11 field_size + +The number of fields is header_size/32 -1 +Known field type codes are: C..character, N..numeric +The first data record starts at (header_size+1) + +#endif /* __COMMENT__ */ + +/* ------------------------------------------------------------------------ */ +#define dbx_new_field_descriptor() \ + ((struct DBX_FIELD_DESCRIPTOR *) \ + calloc (sizeof (struct DBX_FIELD_DESCRIPTOR), 1)) + +#define dbx_new_file_descriptor() \ + ((struct DBX_FILE_DESCRIPTOR *) \ + calloc (sizeof (struct DBX_FILE_DESCRIPTOR), 1)) + +/* prototypes: ------------------------------------------------------------ */ +struct DBX_SCHEMA *dbx_new_schema (int n_fields, char *name); +struct DBX_FILE_DESCRIPTOR *dbx_open_dbf (char *fnm, char *name); + +#endif /* __GG_dbx__ */ diff --git a/lib/include/gg/diagnose.h b/lib/include/gg/diagnose.h new file mode 100644 index 0000000000000000000000000000000000000000..d6355ceb9574925ee05c3c907de96b31d64a2849 --- /dev/null +++ b/lib/include/gg/diagnose.h @@ -0,0 +1,40 @@ +/* + * include File <gg/diagnose.h> + * + * This file contains definitions for diagnostic codes used in + * GG's library functions. + * + * written: 1992-12-27: <Gerhard.Gonter@wu-wien.ac.at> + * latest update: 1995-12-14 + * + */ + +#ifndef __GG_diagnose__ +#define __GG_diagnose__ + +/* ------------------------------------------------------------------------ */ +extern long gg_diagnose; /* variable to hold diagnose codes */ + +/* file names and general file handling: ---------------------------------- */ +#define EF_not_found 0x00000101L +#define EF_couldnt_stat 0x00000102L /* stat() returned an error */ + +/* management of buffers: ------------------------------------------------- */ +#define EB_size_exceeded 0x00000201L + +/* memory management: (client) -------------------------------------------- */ +#define EM_no_memory 0x00000301L + +/* tfb file processing: --------------------------------------------------- */ +#define TFB_ge_no_lut 0x00000401L +#define TFB_ge_no_tfb 0x00000402L +#define TFB_ge_tfb_bad 0x00000403L + +/* lexicon processing: ---------------------------------------------------- */ +#define LEX_RT_init_error 0x00000501L /* initialization of */ + /* read_lexicon_text */ + /* failed */ +#define LEX_RT_no_frame_close 0x00000502L /* no frame close found */ + + +#endif /* __GG_diagnose__ */ diff --git a/lib/include/gg/dirty.h b/lib/include/gg/dirty.h new file mode 100644 index 0000000000000000000000000000000000000000..05492c504db1ebbd82cd62ef0f16a32c6ee99bba --- /dev/null +++ b/lib/include/gg/dirty.h @@ -0,0 +1,63 @@ +/* + * include FILE <gg/dirty.h> + * + * written: 1991 10 03 + * latest update: 1997-08-15 21:34:41 + * + */ + +#ifndef __GG_dirty__ +#define __GG_dirty__ + +#include <gg/floskel.h> + +#define char_or_dot(x) (((x) >= 0x20 && (x) <= 0x7e) ? (x) : '.') + + +/* ------------------------------------------------------------------------ */ +#ifdef MSDOS +/* dirt_001.c */ void cdecl patch (void (*fp)(), void (*fx)()); +/* dirt_002.c */ void cdecl patch_str (void (*p)(), char *s); +/* dirt_003.c */ void cdecl get_patch (void (*p)(), char *s); +/* dirt_004.c */ int cdecl peekb (char far *p); +/* dirt_005.c */ void cdecl pokeb (char far *p, char b); +#endif +#ifdef _FILE_DEFINED +/* dirt_006.c */ void cdecl dump (FILE *fo, char *cp, int cnt); +#endif +/* dirt_007.c */ void set_cp (char **c1, unsigned int c2, unsigned int c3); +#ifdef MSDOS +/* dirt_008.c */ void cdecl flip_int (int *iv); +/* dirt_009.c */ void cdecl flip_long (long *lv); +/* dirt_010.c */ void cdecl flip_long_2 (long *lv); +#endif +/* dirt_011.c */ int cdecl VAL (char *f, int s); +#ifdef _FILE_DEFINED +/* dirt_012.c */ void cdecl dump_file (FILE *fo, FILE *fi, long cnt, + int do_flush); + void cdecl dump_file_tlti (FILE *fo, FILE *fi, long cnt, + int do_flush, int *tbl); + void cdecl dump_file_tltl (FILE *fo, FILE *fi, long cnt, + int do_flush, long *tbl); +/* dirt_013.c */ void cdecl dump_str (FILE *fo, char *x, int cnt); + void cdecl dump_str_tlti (FILE *fo, char *x, int cnt, int *tbl); + void cdecl dump_str_tltl (FILE *fo, char *x, int cnt, long *tbl); +/* dirt_014.c */ int cdecl print_int_table (FILE *fo, int *cpi, int num); +/* dirt_014.c */ int cdecl print_long_table (FILE *fo, long *cpi, int num); +/* dirt_016.c */ int cdecl print_int_table2 (FILE *fo, int write_mode, int *converter_table, int num); +/* dirt_016.c */ int cdecl print_long_table2 (FILE *fo, int write_mode, long *converter_table, int num); +#define WRITE_MODE_undef 0 +#define WRITE_MODE_C 1 +#define WRITE_MODE_binary 2 +#define WRITE_MODE_rexx 4 +#define WRITE_MODE_REXX 5 +#define WRITE_MODE_ASSEMBLE 6 +#define WRITE_MODE_C_ARRAY 7 +#define WRITE_MODE_PERL 8 +#endif /* _FILE_DEFINED */ + +#ifdef MSDOS +/* int24.asm */ void cdecl int24ign_install (void); +#endif /* MSDOS */ + +#endif /* __GG_dirty__ */ diff --git a/lib/include/gg/dpp.h b/lib/include/gg/dpp.h new file mode 100644 index 0000000000000000000000000000000000000000..5ff755eca56feeed65d83bb3a36aa5cce3d26146 --- /dev/null +++ b/lib/include/gg/dpp.h @@ -0,0 +1,80 @@ +/* + * include FILE <gg/dpp.h> + * + * Data Portability Package + * + * written: 1992-00-00 + * latest update: 1999-11-28 12:13:14 + * $Id: dpp.h,v 1.10 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifndef __GG_dpp__ +#define __GG_dpp__ + +#include <gg/floskel.h> + +#ifdef MSDOS +#define __IS_BIG_ENDIAN__ +#endif + +#ifdef i386 +#define __IS_BIG_ENDIAN__ +#endif + +#ifdef __linux +#ifndef __IS_BIG_ENDIAN__ +#define __IS_BIG_ENDIAN__ +#endif +#endif + +#ifdef __FreeBSD__ +#ifndef __IS_BIG_ENDIAN__ +#define __IS_BIG_ENDIAN__ +#endif +#endif + +#ifdef __OpenBSD__ +#ifndef __IS_BIG_ENDIAN__ +#define __IS_BIG_ENDIAN__ +#endif +#endif + +#ifdef _AIX +#define __IS_LITTLE_ENDIAN__ +#endif +#ifdef __hpux +#define __IS_LITTLE_ENDIAN__ +#endif + +/* portable encoding of integer values up to 4 bytes: --------------------- */ +#ifdef _FILE_DEFINED +/* dpp_0001.c */ long cdecl dpp_fread_long (FILE *fi, int bytes); +/* dpp_0002.c */ int cdecl dpp_fwrite_long (FILE *fo, long val, int bytes); +#endif + +/* dpp_0003.c */ long cdecl dpp_get_long (const char *buf, int bytes); +/*** long cdecl dpp_put_long (char *buf, long val, int bytes); ***/ +/* dpp_0004.c */ int cdecl ARGDeval (const char *s, int o, int c, int b, int d); +/* dpp_0005.c */ int cdecl ARGeval (const char *s, int o, int c, int b); +/* dpp_0006.c */ int cdecl ARG_long_eval (const char *s, int o, int c, int b, + long *val); +/* dpp_0007.c */ int cdecl msdos_get_int (char *s); +/* dpp_0008.c */ long cdecl msdos_get_long (char *s); + +/* param001.c */ long cdecl _get_parameter_value (const char *s, int cnt); +#ifdef NO_MACRO +/* param002.c */ long cdecl get_parameter_value (const char *s); +#else +#define get_parameter_value(s) _get_parameter_value((s),1024) +#endif + +/* rndlong */ long cdecl random_long (void); +/* bin2hex */ int cdecl bin_to_hex (char *bin, char *hex, int lng); +/* bin2hexr */ int cdecl bin_to_hex_rev (char *bin, char *hex, int lng); +/* hex2bin */ int cdecl hex_to_bin (char *hex, char *bin, int lng); +/* lng2hex */ int cdecl long_to_hex (long bin, char *hex); +/* lng2nstr */ int cdecl long_to_num_string (long bin, char *hex); +/* alt_seed */ void cdecl alt_seed (void); + +#endif /* __GG_dpp__ */ diff --git a/lib/include/gg/dyb.h b/lib/include/gg/dyb.h new file mode 100644 index 0000000000000000000000000000000000000000..7dae0a2598071683a4b3b4dca5a8f775e8f7e3ba --- /dev/null +++ b/lib/include/gg/dyb.h @@ -0,0 +1,83 @@ +/* + * include FILE <gg/dyb.h> + * + * dynamic block management + * - constants + * - structures: + * DYB_SEGMENT, DYNAMIC_BLOCK + * - prototypes + * + * written: 1995-08-19 + * latest update: 1996-06-22 9:20:43 + * + */ + +#ifndef __GG_dyb__ +#define __GG_dyb__ + +#include <gg/floskel.h> + +/* constants: ------------------------------------------------------------- */ +#ifdef MSDOS +#define DYB_SEGMENT_SIZE 256 +#else +#define DYB_SEGMENT_SIZE 1024 +#endif + +/* ------------------------------------------------------------------------ */ +struct DYB_SEGMENT +{ + struct DYB_SEGMENT *DYBS_next; /* the next element of a block */ + long DYBS_size; /* number of bytes allocated */ + long DYBS_free; /* number of bytes still free */ + char *DYBS_append; /* next position to insert chars */ + char DYBS_block [2]; /* dynamically allocated block */ +} ; + +/* ------------------------------------------------------------------------ */ +#define _DYNAMIC_BLOCK_DEFINED +struct DYNAMIC_BLOCK +{ + long DYB_reference_counter; + long DYB_total_size; + int DYB_segment_size; + + struct DYB_SEGMENT + *DYB_begin, + *DYB_last, + **DYB_append; +} ; + +/* prototypes: ------------------------------------------------------------ */ +/* dyb_0001.c */ struct DYB_SEGMENT *cdecl dyb_new_segment (int segment_size); +/* dyb_0002.c */ struct DYNAMIC_BLOCK *cdecl dyb_new_block (int segment_size); +/* dyb_0003.c */ int cdecl dyb_append_block (struct DYNAMIC_BLOCK *dyb, + char *block, long block_size); +/* dyb_0004.c */ int cdecl dyb_append_string (struct DYNAMIC_BLOCK *dyb, + char *string); +/* dyb_0005.c */ int cdecl dyb_destroy_block (struct DYNAMIC_BLOCK *dyb); +/* dyb_0006.c */ int cdecl dyb_reference (struct DYNAMIC_BLOCK *dyb); +/* dyb_0007.c */ long cdecl dyb_truncate (struct DYNAMIC_BLOCK *dyb, + long size); + +#ifdef _GG_CRYPT_defined +/* dyb_0008.c */ int cdecl dyb_encrypt_ecb (struct GG_CRYPT *ggc, + struct DYNAMIC_BLOCK *dyb); +/* dyb_0008.c */ int cdecl dyb_encrypt_cfb (struct GG_CRYPT *ggc, + struct DYNAMIC_BLOCK *dyb); +#endif /* _GG_CRYPT_defined */ + +/* dyb_0010.c */ int cdecl dyb_write (int fd, struct DYNAMIC_BLOCK *dyb); +/* dyb_0011.c */ int cdecl dyb_append_blanks (struct DYNAMIC_BLOCK *dyb, + long num_blanks); + +#ifdef __COMMENT__ +additional functions: +struct DYNAMIC_BLOCK *dyb_copy (struct DYNAMIC_BLOCK *src); +int dyb_concat (struct DYNAMIC_BLOCK *dst, struct DYNAMIC_BLOCK *b2) +/* append b2 at the end of dst, destroying b2 */ +int dyb_concat_copy (struct DYNAMIC_BLOCK *dst, struct DYNAMIC_BLOCK *b2) +/* append b2 at the end of dst, NOT destroying b2 */ +#endif /* __COMMENT__ */ + +#endif /* __GG_dyb__ */ diff --git a/lib/include/gg/ebc2asc.inc b/lib/include/gg/ebc2asc.inc new file mode 100644 index 0000000000000000000000000000000000000000..35bb6b45aeb89694a90dd5e97b9cec8b4effd02b --- /dev/null +++ b/lib/include/gg/ebc2asc.inc @@ -0,0 +1,50 @@ +/* + * include FILE <gg/ebc2asc.inc> + * + * Codierungstabelle fuer EBCDIC -> ASCII Umwandlung + * + * written: 1989 08 04 + * latest update: 1994-03-30 + * + */ + +#ifndef __GG_ebc2asc__ +#define __GG_ebc2asc__ + +int CODE_EBCDIC_to_ASCII [256] = +{ +/* 0x00 */ 0x00, 0x01, 0x02, 0x03, 0xEC, 0x09, 0xCA, 0x7F, +/* 0x08 */ 0xE2, 0xD2, 0xD3, 0x0B, 0x0C, 0x0D, 0x0E, 0xA9, +/* 0x10 */ 0x10, 0x11, 0x12, 0x13, 0xEF, 0xC5, 0x08, 0xCB, +/* 0x18 */ 0x18, 0x19, 0xDC, 0xD8, 0x1C, 0x1D, 0x1E, 0x1F, +/* 0x20 */ 0xB7, 0xB8, 0xB9, 0xBB, 0xC4, 0x0A, 0x17, 0x1B, +/* 0x28 */ 0xCC, 0xCD, 0xCF, 0xD0, 0xD1, 0x05, 0x06, 0x07, +/* 0x30 */ 0xD9, 0xDA, 0x16, 0xDD, 0xDE, 0xDF, 0xE0, 0x04, +/* 0x38 */ 0xE3, 0xE5, 0xE9, 0xEB, 0xB0, 0xB1, 0x9E, 0x1A, +/* 0x40 */ 0x20, 0xC9, 0x83, 0x7B, 0x85, 0xA0, 0xF2, 0x86, +/* 0x48 */ 0x87, 0xA4, 0x8E, 0x2E, 0x3C, 0x28, 0x2B, 0x21, +/* 0x50 */ 0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x8B, +/* 0x58 */ 0x8D, 0x7E, 0x9A, 0x24, 0x2A, 0x29, 0x3B, 0x5E, +/* 0x60 */ 0x2D, 0x2F, 0xB2, 0x5B, 0xB4, 0xB5, 0xB6, 0x8F, +/* 0x68 */ 0x80, 0xA5, 0x94, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, +/* 0x70 */ 0xBA, 0x90, 0xBC, 0xBD, 0xBE, 0xF3, 0xC0, 0xC1, +/* 0x78 */ 0xC2, 0x60, 0x3A, 0x23, 0x15, 0x27, 0x3D, 0x22, +/* 0x80 */ 0xC3, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, +/* 0x88 */ 0x68, 0x69, 0xAE, 0xAF, 0xC6, 0xC7, 0xC8, 0xF1, +/* 0x90 */ 0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, +/* 0x98 */ 0x71, 0x72, 0xA6, 0xA7, 0x91, 0xCE, 0x92, 0x0F, +/* 0xA0 */ 0xE6, 0xE1, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, +/* 0xA8 */ 0x79, 0x7A, 0xAD, 0xA8, 0xD4, 0xD5, 0xD6, 0xD7, +/* 0xB0 */ 0x9B, 0x9C, 0x9D, 0xFA, 0x9F, 0x40, 0x14, 0xAC, +/* 0xB8 */ 0xAB, 0xFC, 0xAA, 0xB3, 0xE4, 0xFE, 0xBF, 0xE7, +/* 0xC0 */ 0x84, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, +/* 0xC8 */ 0x48, 0x49, 0x8E, 0x93, 0x7C, 0x95, 0xA2, 0xED, +/* 0xD0 */ 0x81, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, +/* 0xD8 */ 0x51, 0x52, 0x99, 0x96, 0x7D, 0x97, 0xA3, 0x98, +/* 0xE0 */ 0x99, 0xF0, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, +/* 0xE8 */ 0x59, 0x5A, 0x9A, 0xF5, 0x5C, 0xF7, 0xF6, 0xF9, +/* 0xF0 */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, +/* 0xF8 */ 0x38, 0x39, 0xDB, 0xFB, 0x5D, 0xF4, 0xEA, 0xFF +} ; + +#endif /* __GG_ebc2asc__ */ diff --git a/lib/include/gg/ebc_8859.ci b/lib/include/gg/ebc_8859.ci new file mode 100644 index 0000000000000000000000000000000000000000..82cea9f3731a233355cdb14a52750848e8d6522e --- /dev/null +++ b/lib/include/gg/ebc_8859.ci @@ -0,0 +1,71 @@ +/* + * conversion table + * from: ebcdic + * to: iso8859_1, ascii + * as generated on 1997-02-08/21:44:26 + * + */ +/*0x00*/ 0x00000000,/*0x01*/ 0x00000001,/*0x02*/ 0x00000002,/*0x03*/ 0x00000003, +/*0x04*/ 0x00000000,/*0x05*/ 0x00000009,/*0x06*/ 0x00000000,/*0x07*/ 0x0000007F, +/*0x08*/ 0x00000000,/*0x09*/ 0x00000000,/*0x0A*/ 0x00000000,/*0x0B*/ 0x0000000B, +/*0x0C*/ 0x0000000C,/*0x0D*/ 0x0000000D,/*0x0E*/ 0x0000000E,/*0x0F*/ 0x00000000, +/*0x10*/ 0x00000010,/*0x11*/ 0x00000011,/*0x12*/ 0x00000012,/*0x13*/ 0x00000013, +/*0x14*/ 0x00000000,/*0x15*/ 0x00000000,/*0x16*/ 0x00000008,/*0x17*/ 0x00000000, +/*0x18*/ 0x00000018,/*0x19*/ 0x00000019,/*0x1A*/ 0x00000000,/*0x1B*/ 0x00000000, +/*0x1C*/ 0x0000001C,/*0x1D*/ 0x0000001D,/*0x1E*/ 0x0000001E,/*0x1F*/ 0x0000001F, +/*0x20*/ 0x00000000,/*0x21*/ 0x00000000,/*0x22*/ 0x00000000,/*0x23*/ 0x00000000, +/*0x24*/ 0x00000000,/*0x25*/ 0x0000000A,/*0x26*/ 0x00000017,/*0x27*/ 0x0000001B, +/*0x28*/ 0x00000000,/*0x29*/ 0x00000000,/*0x2A*/ 0x00000000,/*0x2B*/ 0x00000000, +/*0x2C*/ 0x00000000,/*0x2D*/ 0x00000005,/*0x2E*/ 0x00000006,/*0x2F*/ 0x00000007, +/*0x30*/ 0x00000000,/*0x31*/ 0x00000000,/*0x32*/ 0x00000016,/*0x33*/ 0x00000000, +/*0x34*/ 0x00000000,/*0x35*/ 0x00000000,/*0x36*/ 0x00000000,/*0x37*/ 0x00000004, +/*0x38*/ 0x00000000,/*0x39*/ 0x00000000,/*0x3A*/ 0x00000000,/*0x3B*/ 0x00000000, +/*0x3C*/ 0x00000000,/*0x3D*/ 0x00000000,/*0x3E*/ 0x00000000,/*0x3F*/ 0x0000001A, +/*0x40*/ 0x00000020,/*0x41*/ 0x00000000,/*0x42*/ 0x000000E2,/*0x43*/ 0x0000007B, +/*0x44*/ 0x000000E0,/*0x45*/ 0x000000E1,/*0x46*/ 0x00000000,/*0x47*/ 0x000000E5, +/*0x48*/ 0x000000E7,/*0x49*/ 0x000000F1,/*0x4A*/ 0x000000C4,/*0x4B*/ 0x0000002E, +/*0x4C*/ 0x0000003C,/*0x4D*/ 0x00000028,/*0x4E*/ 0x0000002B,/*0x4F*/ 0x00000021, +/*0x50*/ 0x00000026,/*0x51*/ 0x000000E9,/*0x52*/ 0x000000EA,/*0x53*/ 0x000000EB, +/*0x54*/ 0x000000E8,/*0x55*/ 0x000000ED,/*0x56*/ 0x000000EE,/*0x57*/ 0x000000EF, +/*0x58*/ 0x000000EC,/*0x59*/ 0x0000007E,/*0x5A*/ 0x000000DC,/*0x5B*/ 0x00000024, +/*0x5C*/ 0x0000002A,/*0x5D*/ 0x00000029,/*0x5E*/ 0x0000003B,/*0x5F*/ 0x0000005E, +/*0x60*/ 0x0000002D,/*0x61*/ 0x0000002F,/*0x62*/ 0x00000000,/*0x63*/ 0x0000005B, +/*0x64*/ 0x00000000,/*0x65*/ 0x00000000,/*0x66*/ 0x00000000,/*0x67*/ 0x000000C5, +/*0x68*/ 0x000000C7,/*0x69*/ 0x000000D1,/*0x6A*/ 0x000000F6,/*0x6B*/ 0x0000002C, +/*0x6C*/ 0x00000025,/*0x6D*/ 0x0000005F,/*0x6E*/ 0x0000003E,/*0x6F*/ 0x0000003F, +/*0x70*/ 0x00000000,/*0x71*/ 0x000000C9,/*0x72*/ 0x00000000,/*0x73*/ 0x00000000, +/*0x74*/ 0x00000000,/*0x75*/ 0x00000000,/*0x76*/ 0x00000000,/*0x77*/ 0x00000000, +/*0x78*/ 0x00000000,/*0x79*/ 0x00000060,/*0x7A*/ 0x0000003A,/*0x7B*/ 0x00000023, +/*0x7C*/ 0x00000015,/*0x7D*/ 0x00000027,/*0x7E*/ 0x0000003D,/*0x7F*/ 0x00000022, +/*0x80*/ 0x00000000,/*0x81*/ 0x00000061,/*0x82*/ 0x00000062,/*0x83*/ 0x00000063, +/*0x84*/ 0x00000064,/*0x85*/ 0x00000065,/*0x86*/ 0x00000066,/*0x87*/ 0x00000067, +/*0x88*/ 0x00000068,/*0x89*/ 0x00000069,/*0x8A*/ 0x000000AB,/*0x8B*/ 0x000000BB, +/*0x8C*/ 0x00000000,/*0x8D*/ 0x00000000,/*0x8E*/ 0x00000000,/*0x8F*/ 0x000000B1, +/*0x90*/ 0x00000000,/*0x91*/ 0x0000006A,/*0x92*/ 0x0000006B,/*0x93*/ 0x0000006C, +/*0x94*/ 0x0000006D,/*0x95*/ 0x0000006E,/*0x96*/ 0x0000006F,/*0x97*/ 0x00000070, +/*0x98*/ 0x00000071,/*0x99*/ 0x00000072,/*0x9A*/ 0x000000AA,/*0x9B*/ 0x000000BA, +/*0x9C*/ 0x000000E6,/*0x9D*/ 0x00000000,/*0x9E*/ 0x000000C6,/*0x9F*/ 0x0000000F, +/*0xA0*/ 0x00000000,/*0xA1*/ 0x000000DF,/*0xA2*/ 0x00000073,/*0xA3*/ 0x00000074, +/*0xA4*/ 0x00000075,/*0xA5*/ 0x00000076,/*0xA6*/ 0x00000077,/*0xA7*/ 0x00000078, +/*0xA8*/ 0x00000079,/*0xA9*/ 0x0000007A,/*0xAA*/ 0x000000A1,/*0xAB*/ 0x000000BF, +/*0xAC*/ 0x00000000,/*0xAD*/ 0x00000000,/*0xAE*/ 0x00000000,/*0xAF*/ 0x00000000, +/*0xB0*/ 0x000000A2,/*0xB1*/ 0x000000A3,/*0xB2*/ 0x000000A5,/*0xB3*/ 0x000000B7, +/*0xB4*/ 0x00000000,/*0xB5*/ 0x00000040,/*0xB6*/ 0x00000014,/*0xB7*/ 0x000000BC, +/*0xB8*/ 0x000000BD,/*0xB9*/ 0x00000000,/*0xBA*/ 0x000000AC,/*0xBB*/ 0x00000000, +/*0xBC*/ 0x00000000,/*0xBD*/ 0x00000000,/*0xBE*/ 0x00000000,/*0xBF*/ 0x00000000, +/*0xC0*/ 0x000000E4,/*0xC1*/ 0x00000041,/*0xC2*/ 0x00000042,/*0xC3*/ 0x00000043, +/*0xC4*/ 0x00000044,/*0xC5*/ 0x00000045,/*0xC6*/ 0x00000046,/*0xC7*/ 0x00000047, +/*0xC8*/ 0x00000048,/*0xC9*/ 0x00000049,/*0xCA*/ 0x00000000,/*0xCB*/ 0x000000F4, +/*0xCC*/ 0x0000007C,/*0xCD*/ 0x000000F2,/*0xCE*/ 0x000000F3,/*0xCF*/ 0x00000000, +/*0xD0*/ 0x000000FC,/*0xD1*/ 0x0000004A,/*0xD2*/ 0x0000004B,/*0xD3*/ 0x0000004C, +/*0xD4*/ 0x0000004D,/*0xD5*/ 0x0000004E,/*0xD6*/ 0x0000004F,/*0xD7*/ 0x00000050, +/*0xD8*/ 0x00000051,/*0xD9*/ 0x00000052,/*0xDA*/ 0x000000D6,/*0xDB*/ 0x000000FB, +/*0xDC*/ 0x0000007D,/*0xDD*/ 0x000000F9,/*0xDE*/ 0x000000FA,/*0xDF*/ 0x000000FF, +/*0xE0*/ 0x00000000,/*0xE1*/ 0x00000000,/*0xE2*/ 0x00000053,/*0xE3*/ 0x00000054, +/*0xE4*/ 0x00000055,/*0xE5*/ 0x00000056,/*0xE6*/ 0x00000057,/*0xE7*/ 0x00000058, +/*0xE8*/ 0x00000059,/*0xE9*/ 0x0000005A,/*0xEA*/ 0x000000B2,/*0xEB*/ 0x00000000, +/*0xEC*/ 0x0000005C,/*0xED*/ 0x00000000,/*0xEE*/ 0x000000F7,/*0xEF*/ 0x00000000, +/*0xF0*/ 0x00000030,/*0xF1*/ 0x00000031,/*0xF2*/ 0x00000032,/*0xF3*/ 0x00000033, +/*0xF4*/ 0x00000034,/*0xF5*/ 0x00000035,/*0xF6*/ 0x00000036,/*0xF7*/ 0x00000037, +/*0xF8*/ 0x00000038,/*0xF9*/ 0x00000039,/*0xFA*/ 0x00000000,/*0xFB*/ 0x00000000, +/*0xFC*/ 0x0000005D,/*0xFD*/ 0x00000000,/*0xFE*/ 0x00000000,/*0xFF*/ 0x000000A0 diff --git a/lib/include/gg/ebc_pc.ci b/lib/include/gg/ebc_pc.ci new file mode 100644 index 0000000000000000000000000000000000000000..b423c4b001e6e5c70b824a24f6a2fa6803c6ac44 --- /dev/null +++ b/lib/include/gg/ebc_pc.ci @@ -0,0 +1,71 @@ +/* + * conversion table + * from: ebcdic + * to: pc437, ascii + * as generated on 1997-02-08/21:44:34 + * + */ +/*0x00*/ 0x00000000,/*0x01*/ 0x00000001,/*0x02*/ 0x00000002,/*0x03*/ 0x00000003, +/*0x04*/ 0x00000000,/*0x05*/ 0x00000009,/*0x06*/ 0x00000000,/*0x07*/ 0x0000007F, +/*0x08*/ 0x00000000,/*0x09*/ 0x00000000,/*0x0A*/ 0x00000000,/*0x0B*/ 0x0000000B, +/*0x0C*/ 0x0000000C,/*0x0D*/ 0x0000000D,/*0x0E*/ 0x0000000E,/*0x0F*/ 0x00000000, +/*0x10*/ 0x00000010,/*0x11*/ 0x00000011,/*0x12*/ 0x00000012,/*0x13*/ 0x00000013, +/*0x14*/ 0x00000000,/*0x15*/ 0x00000000,/*0x16*/ 0x00000008,/*0x17*/ 0x00000000, +/*0x18*/ 0x00000018,/*0x19*/ 0x00000019,/*0x1A*/ 0x00000000,/*0x1B*/ 0x00000000, +/*0x1C*/ 0x0000001C,/*0x1D*/ 0x0000001D,/*0x1E*/ 0x0000001E,/*0x1F*/ 0x0000001F, +/*0x20*/ 0x00000000,/*0x21*/ 0x00000000,/*0x22*/ 0x00000000,/*0x23*/ 0x00000000, +/*0x24*/ 0x00000000,/*0x25*/ 0x0000000A,/*0x26*/ 0x00000017,/*0x27*/ 0x0000001B, +/*0x28*/ 0x00000000,/*0x29*/ 0x00000000,/*0x2A*/ 0x00000000,/*0x2B*/ 0x00000000, +/*0x2C*/ 0x00000000,/*0x2D*/ 0x00000005,/*0x2E*/ 0x00000006,/*0x2F*/ 0x00000007, +/*0x30*/ 0x00000000,/*0x31*/ 0x00000000,/*0x32*/ 0x00000016,/*0x33*/ 0x00000000, +/*0x34*/ 0x00000000,/*0x35*/ 0x00000000,/*0x36*/ 0x00000000,/*0x37*/ 0x00000004, +/*0x38*/ 0x00000000,/*0x39*/ 0x00000000,/*0x3A*/ 0x00000000,/*0x3B*/ 0x00000000, +/*0x3C*/ 0x00000000,/*0x3D*/ 0x00000000,/*0x3E*/ 0x00000000,/*0x3F*/ 0x0000001A, +/*0x40*/ 0x00000020,/*0x41*/ 0x00000000,/*0x42*/ 0x00000000,/*0x43*/ 0x0000007B, +/*0x44*/ 0x00000000,/*0x45*/ 0x00000000,/*0x46*/ 0x00000000,/*0x47*/ 0x00000000, +/*0x48*/ 0x00000000,/*0x49*/ 0x00000000,/*0x4A*/ 0x00000000,/*0x4B*/ 0x0000002E, +/*0x4C*/ 0x0000003C,/*0x4D*/ 0x00000028,/*0x4E*/ 0x0000002B,/*0x4F*/ 0x00000021, +/*0x50*/ 0x00000026,/*0x51*/ 0x00000000,/*0x52*/ 0x00000000,/*0x53*/ 0x00000000, +/*0x54*/ 0x00000000,/*0x55*/ 0x00000000,/*0x56*/ 0x00000000,/*0x57*/ 0x00000000, +/*0x58*/ 0x00000000,/*0x59*/ 0x0000007E,/*0x5A*/ 0x00000000,/*0x5B*/ 0x00000024, +/*0x5C*/ 0x0000002A,/*0x5D*/ 0x00000029,/*0x5E*/ 0x0000003B,/*0x5F*/ 0x0000005E, +/*0x60*/ 0x0000002D,/*0x61*/ 0x0000002F,/*0x62*/ 0x00000000,/*0x63*/ 0x0000005B, +/*0x64*/ 0x00000000,/*0x65*/ 0x00000000,/*0x66*/ 0x00000000,/*0x67*/ 0x00000000, +/*0x68*/ 0x00000000,/*0x69*/ 0x00000000,/*0x6A*/ 0x00000000,/*0x6B*/ 0x0000002C, +/*0x6C*/ 0x00000025,/*0x6D*/ 0x0000005F,/*0x6E*/ 0x0000003E,/*0x6F*/ 0x0000003F, +/*0x70*/ 0x00000000,/*0x71*/ 0x00000000,/*0x72*/ 0x00000000,/*0x73*/ 0x00000000, +/*0x74*/ 0x00000000,/*0x75*/ 0x00000000,/*0x76*/ 0x00000000,/*0x77*/ 0x00000000, +/*0x78*/ 0x00000000,/*0x79*/ 0x00000060,/*0x7A*/ 0x0000003A,/*0x7B*/ 0x00000023, +/*0x7C*/ 0x00000015,/*0x7D*/ 0x00000027,/*0x7E*/ 0x0000003D,/*0x7F*/ 0x00000022, +/*0x80*/ 0x00000000,/*0x81*/ 0x00000061,/*0x82*/ 0x00000062,/*0x83*/ 0x00000063, +/*0x84*/ 0x00000064,/*0x85*/ 0x00000065,/*0x86*/ 0x00000066,/*0x87*/ 0x00000067, +/*0x88*/ 0x00000068,/*0x89*/ 0x00000069,/*0x8A*/ 0x00000000,/*0x8B*/ 0x00000000, +/*0x8C*/ 0x00000000,/*0x8D*/ 0x00000000,/*0x8E*/ 0x00000000,/*0x8F*/ 0x00000000, +/*0x90*/ 0x00000000,/*0x91*/ 0x0000006A,/*0x92*/ 0x0000006B,/*0x93*/ 0x0000006C, +/*0x94*/ 0x0000006D,/*0x95*/ 0x0000006E,/*0x96*/ 0x0000006F,/*0x97*/ 0x00000070, +/*0x98*/ 0x00000071,/*0x99*/ 0x00000072,/*0x9A*/ 0x00000000,/*0x9B*/ 0x00000000, +/*0x9C*/ 0x00000000,/*0x9D*/ 0x00000000,/*0x9E*/ 0x00000000,/*0x9F*/ 0x0000000F, +/*0xA0*/ 0x00000000,/*0xA1*/ 0x00000000,/*0xA2*/ 0x00000073,/*0xA3*/ 0x00000074, +/*0xA4*/ 0x00000075,/*0xA5*/ 0x00000076,/*0xA6*/ 0x00000077,/*0xA7*/ 0x00000078, +/*0xA8*/ 0x00000079,/*0xA9*/ 0x0000007A,/*0xAA*/ 0x00000000,/*0xAB*/ 0x00000000, +/*0xAC*/ 0x00000000,/*0xAD*/ 0x00000000,/*0xAE*/ 0x00000000,/*0xAF*/ 0x00000000, +/*0xB0*/ 0x00000000,/*0xB1*/ 0x00000000,/*0xB2*/ 0x00000000,/*0xB3*/ 0x00000000, +/*0xB4*/ 0x00000000,/*0xB5*/ 0x00000040,/*0xB6*/ 0x00000014,/*0xB7*/ 0x00000000, +/*0xB8*/ 0x00000000,/*0xB9*/ 0x00000000,/*0xBA*/ 0x00000000,/*0xBB*/ 0x00000000, +/*0xBC*/ 0x00000000,/*0xBD*/ 0x00000000,/*0xBE*/ 0x00000000,/*0xBF*/ 0x00000000, +/*0xC0*/ 0x00000000,/*0xC1*/ 0x00000041,/*0xC2*/ 0x00000042,/*0xC3*/ 0x00000043, +/*0xC4*/ 0x00000044,/*0xC5*/ 0x00000045,/*0xC6*/ 0x00000046,/*0xC7*/ 0x00000047, +/*0xC8*/ 0x00000048,/*0xC9*/ 0x00000049,/*0xCA*/ 0x00000000,/*0xCB*/ 0x00000000, +/*0xCC*/ 0x0000007C,/*0xCD*/ 0x00000000,/*0xCE*/ 0x00000000,/*0xCF*/ 0x00000000, +/*0xD0*/ 0x00000000,/*0xD1*/ 0x0000004A,/*0xD2*/ 0x0000004B,/*0xD3*/ 0x0000004C, +/*0xD4*/ 0x0000004D,/*0xD5*/ 0x0000004E,/*0xD6*/ 0x0000004F,/*0xD7*/ 0x00000050, +/*0xD8*/ 0x00000051,/*0xD9*/ 0x00000052,/*0xDA*/ 0x00000000,/*0xDB*/ 0x00000000, +/*0xDC*/ 0x0000007D,/*0xDD*/ 0x00000000,/*0xDE*/ 0x00000000,/*0xDF*/ 0x00000000, +/*0xE0*/ 0x00000000,/*0xE1*/ 0x00000000,/*0xE2*/ 0x00000053,/*0xE3*/ 0x00000054, +/*0xE4*/ 0x00000055,/*0xE5*/ 0x00000056,/*0xE6*/ 0x00000057,/*0xE7*/ 0x00000058, +/*0xE8*/ 0x00000059,/*0xE9*/ 0x0000005A,/*0xEA*/ 0x00000000,/*0xEB*/ 0x00000000, +/*0xEC*/ 0x0000005C,/*0xED*/ 0x00000000,/*0xEE*/ 0x00000000,/*0xEF*/ 0x00000000, +/*0xF0*/ 0x00000030,/*0xF1*/ 0x00000031,/*0xF2*/ 0x00000032,/*0xF3*/ 0x00000033, +/*0xF4*/ 0x00000034,/*0xF5*/ 0x00000035,/*0xF6*/ 0x00000036,/*0xF7*/ 0x00000037, +/*0xF8*/ 0x00000038,/*0xF9*/ 0x00000039,/*0xFA*/ 0x00000000,/*0xFB*/ 0x00000000, +/*0xFC*/ 0x0000005D,/*0xFD*/ 0x00000000,/*0xFE*/ 0x00000000,/*0xFF*/ 0x00000000 diff --git a/lib/include/gg/ebcasc.h b/lib/include/gg/ebcasc.h new file mode 100644 index 0000000000000000000000000000000000000000..cd9ebe6f2e5339611bf3b2ae28ceb885b9ef556c --- /dev/null +++ b/lib/include/gg/ebcasc.h @@ -0,0 +1,17 @@ +/* + * include FILE <gg/ebcasc.h> + * + * written: 1992 08 30 + * latest update: 1994-11-11 + * + */ + +#ifndef __GG_ebcasc__ +#define __GG_ebcasc__ + +#define TABLE_NAME "ebc--asc.cod" + +int cdecl EBCDIC_ASCII_INIT (void); +int cdecl EBCDIC_ASCII_convert (char p[], int start, int lng); +int cdecl EBCDIC_ASCII_char_convert (int ch); +#endif /* __GG_ebcasc__ */ diff --git a/lib/include/gg/entity.h b/lib/include/gg/entity.h new file mode 100644 index 0000000000000000000000000000000000000000..db7cacd18508ef58271ac00ab702a10a5af8b3d1 --- /dev/null +++ b/lib/include/gg/entity.h @@ -0,0 +1,148 @@ +/* + * include FILE <gg/entity.h> + * + * entity definitions + * + * written: 1991 06 21 + * 1993-01-01: revision + * latest update: 1996-06-09 11:26:21 + * + */ + +#ifndef __GG_entity__ +#define __GG_entity__ + +#include <gg/ytree.h> +#include <gg/floskel.h> + +/* structures: ------------------------------------------------------------ */ +struct ENTITY_DESCRIPTOR +{ + int type; /* ED_TYPE_* */ + long code; /* character code, if defined */ + char *name; /* Entity Name */ + char *string; /* Entity Declaration accoring to type */ + + void *system_data; + void *application_data; +} ; + +#define ED_TYPE_string 1 /* simple replacement string (PCDATA??) */ +#define ED_TYPE_CDATA 2 /* character data */ +#define ED_TYPE_SDATA 3 /* specific data */ +#define ED_TYPE_PI 4 /* processing instruction */ +#define ED_TYPE_SYSTEM 5 /* system entity identifier */ +#define ED_TYPE_PUBLIC 6 /* public entity identifier */ +#define ED_TYPE_PARAM 7 /* parameter entity */ +#define ED_TYPE_STARTTAG 8 /* */ +#define ED_TYPE_ENDTAG 9 /* */ +#define ED_TYPE_MS 10 /* */ +#define ED_TYPE_MD 11 /* */ + +/* References: */ +/* [2] The SGML Implementation Guide; p. 250 ff */ + +/* ------------------------------------------------------------------------ */ +struct ENTITY_DESCRIPTOR_LIST +{ + struct ENTITY_DESCRIPTOR_LIST *next; + struct ENTITY_DESCRIPTOR *ed; +} ; + +/* ------------------------------------------------------------------------ */ +struct ENTITY_CONTEXT +{ + char *ec_name; + + struct ENTITY_DESCRIPTOR_LIST *edl; + struct ENTITY_DESCRIPTOR_LIST **edl_append; + + struct ENTITY_DESCRIPTOR *ec_tbl [256]; + struct YTREE *ec_names; + struct YTREE *ec_codes; +} ; + +/* prototypes: ------------------------------------------------------------ */ +struct ENTITY_CONTEXT *cdecl entity_create_context (char *name); +int cdecl cdecl entity_destroy_context (struct ENTITY_CONTEXT *ec); +struct ENTITY_DESCRIPTOR *cdecl entity_find_by_name ( + struct ENTITY_CONTEXT *ctx, char *name); +struct ENTITY_DESCRIPTOR *cdecl entity_find_by_code ( + struct ENTITY_CONTEXT *ctx, long code); + +/* ***** REVISION NEEDED BELOW THIS LINE (1996-06-09 11:22:47) ************ */ +/* prototypes ------------------------------------------------------------- */ +#define SE_N_char 8 /* number of def'ed character code families */ + +/* prototypes ------------------------------------------------------------- */ +struct SGML_ENTITY +{ + int SE_group; /* Entity Group */ + char *SE_entity_name; /* character string of entity */ + long SE_char [SE_N_char]; /* character code in family */ +} ; + +/* prototypes ------------------------------------------------------------- */ +#define SEG_undef 0 /* undefine entity group */ +#define SEG_ISOlat1 1 /* entities for latin alphabetic characters */ + /* used in western european languages */ +#define SEG_ISOlat2 2 /* aditional entities for latin alphabetic */ + /* characters */ +#define SEG_ISOgrk1 3 +#define SEG_ISOgrk2 4 +#define SEG_ISOcyr1 5 +#define SEG_ISOcyr2 6 +#define SEG_ISOnum 7 /* numerical and special characters */ +#define SEG_ISOdia 8 +#define SEG_ISOpub 9 +#define SEG_ISObox 10 +#define SEG_ISOtech 11 +#define SEG_ISOgrk3 12 +#define SEG_ISOgrk4 13 +#define SEG_ISOamso 14 +#define SEG_ISOamsb 15 +#define SEG_ISOamsr 16 +#define SEG_ISOamsn 17 +#define SEG_ISOamsa 18 +#define SEG_ISOamsc 19 + +/* IBM-PC character codes - - - - - - - - - - - - - - - - - - - - - - - - - */ +#define SE_char_pc SE_char[0] +#define SE_fam_pc 0 + +/* Apple Macintosh character codes - - - - - - - - - - - - - - - - - - - - */ +#define SE_char_mac SE_char[1] +#define SE_fam_mac 1 + +/* character codes as defined with Donald Knuth's TeX - - - - - - - - - - - */ +#define SE_char_tex SE_char[2] +#define SE_fam_tex 2 + +/* character codes as defined with GG's fontdir system - - - - - - - - - - */ +#define SE_char_fontdir SE_char[3] +#define SE_fam_fontdir 3 + +/* character codes in German EBCDIC - - - - - - - - - - - - - - - - - - - - */ +#define SE_char_ebcdic_german SE_char[4] +#define SE_fam_ebcdic_german 4 + +/* character codes in US EBCDIC - - - - - - - - - - - - - - - - - - - - - - */ +#define SE_char_ebcdic_us SE_char[5] +#define SE_fam_ebcdic_us 5 + +/* character codes in German EBCDIC (translated) - - - - - - - - - - - - - */ +#define SE_char_ebcdic_tgerman SE_char[6] +#define SE_fam_ebcdic_tgerman 6 + +/* character codes in US EBCDIC (translated) - - - - - - - - - - - - - - - */ +#define SE_char_ebcdic_tus SE_char[7] +#define SE_fam_ebcdic_tus 7 + +/* prototypes ------------------------------------------------------------- */ +char *cdecl sgml_char_to_entity (long tchar, int tfam); +long cdecl sgml_entity_to_char (char *entity, int tfam); +int cdecl sgml_char_to_entity_group (long tchar, int tfam); +int cdecl sgml_entity_to_entity_group (char *entity); +long cdecl sgml_translit (long tchar_from, int tfam_from, int tfam_to); + +#endif /* __GG_entity__ */ diff --git a/lib/include/gg/event.h b/lib/include/gg/event.h new file mode 100644 index 0000000000000000000000000000000000000000..3278046aaeddfd79912edf73c2107b3c8b3dda6b --- /dev/null +++ b/lib/include/gg/event.h @@ -0,0 +1,106 @@ +/* + * include FILE <gg/event.h> + * + * Definitionen f�r Event-Handler + * + * written: 1989 07 11 + * latest update: 1995-10-26 + * + */ + +#ifndef __GG_event__ +#define __GG_event__ + +/* Return Values: EVENT_xxxx ---------------------------------------------- */ +#define EVENT_key 0x0001 +#define EVENT_timeout 0x0002 +#define EVENT_mouse 0x0003 +#define EVENT_button 0x0004 +#define EVENT_field 0x1001 +#define EVENT_mmenu 0x1002 + +/* Mask Values: ----------------------------------------------------------- */ +#define EVENT_MASK_key 0x0001 +#define EVENT_MASK_timeout 0x0002 +#define EVENT_MASK_mouse 0x0004 +#define EVENT_MASK_button 0x0008 + +/* Modul %jeannie/event.c ------------------------------------------------- */ +void cdecl INIT_event (void); +int get_event (int *key, int *x, int *y, int *timeout, int mask, int flg); +void cdecl wait_maus (void); + +/* Modul %jeannie/ik3a.c -------------------------------------------------- */ +unsigned int cdecl keymap_analyse ( +int key, /* zu untersuchende Taste */ +char fkt1 [], /* globale und ... */ +char fkt2 []); /* ... lokale Funktion Key Tabelle */ + /* fkt2 wird mit h�herer Priorit�t behandelt */ +/* RETURN: FR_UNDEF ... Zuordnung nicht gefunden */ +/* sonst ... gefunden Zuordnung */ + +/* Modul %jeannie/ik3b.c -------------------------------------------------- */ +unsigned int cdecl get_entry (char *fkt, int akt); + +/* Modul %jeannie/ik3c.c -------------------------------------------------- */ +unsigned int cdecl get_2_entry (int fkt [], int akt); + +/* Modul %jeannie/ik4.c --------------------------------------------------- */ +int cdecl E_field_edit (char field [], + char desc [], + int mode, + int akt_page, + int event_mask, + int *key, + int *timeout, + int *x, + int *y, + int *update); + +void cdecl E_show_field (char field [], + char desc [], + int mode, + int akt_page, + int flag); + +int cdecl E_scan_str ( int p, + int x, + int y, + int l, + int attr, + int event_mask, + char *pu, + int *key, + int *timeout, + int flg); + +int cdecl E_scan_int ( int p, + int x, + int y, + int l, + int attr, + int event_mask, + int *val, + int *key, + int *timeout, + int flg); + +void cdecl E_set_cursor_offset (int cursor_off); +int cdecl E_get_cursor_offset (void); + +/* Modul %jeannie/maskedit.c ---------------------------------------------- */ +int cdecl msk_edit (char ff [], char *dss [], int dmode, int *kv, + int *timeout, int *x, int *y, int mask, int *update, int flgs); + +void cdecl msk_set_fld (int fld); +int cdecl msk_get_flg (void); + +/* Modul %jeannie/complex.c ----------------------------------------------- */ +int cdecl complex_screen (int *key, int *x, int *y, int *timeout, + long *value, int mask, char *screen, char *fields, + char *data [], char *buttons, struct MMctrl *mmctrl, + long aktivate, int aktivate_key); + +int cdecl complex_update (void); + +#endif /* __GG_event__ */ diff --git a/lib/include/gg/fields.h b/lib/include/gg/fields.h new file mode 100644 index 0000000000000000000000000000000000000000..d9b59d6d01fe39d19ef76ac2d765f0e6af626866 --- /dev/null +++ b/lib/include/gg/fields.h @@ -0,0 +1,116 @@ +/* + * include File <gg/fields.h> + * + * Datenstrukturen + * + * written: 1989 09 23 + * latest update: 1995-02-19 + * + */ + +#ifndef __GG_fields__ +#define __GG_fields__ + +#pragma pack(1) + +/* Definition f. Fielddescriptor ------------------------------------------ */ +#define FLD_size 14 /* Laenge eines Field Desc. Records */ +#define FDo_x 0 /* 1. Variante: Offset in String */ +#define FDo_y 1 /* Koordinaten am Text Screen */ +#define FDo_l 2 /* L�nge des Feldes */ +#define FDo_attr1 3 /* Farb Attribut 1: ohne Edit */ +#define FDo_attr2 4 /* Farb Attribut 2: bei Edit (siehe unten) */ +#define FDo_rpt 5 /* Repeat Counter: 1..255; 0 -> ERROR N/A */ +#define FDo_fmt 6 /* Format Code: #des Input Format Pgms N/A */ +#define FDo_help_num 7 /* Help Code ######N/A */ +#define FDo_off1 8 /* � Offset der Daten des Feldes in FORM- */ +#define FDo_off2 9 /* � Datenstruktur; (im VAL-Format) */ + /* Offset muss extra errechnet werden */ +#define FDo_flg1 10 /* Flags #1; siehe unten */ +#define FDo_typ 11 /* Typ des Datenfeldes (Flags #2) N/A */ +#define FDo_flg3 12 /* Flags #3; N/A */ +#define FDo_flg4 13 /* Flags #4; N/A */ + +struct FIELD_DESC /* 2. Variante: Struktur */ +{ + unsigned char + FLD_x, + FLD_y, + FLD_l, + FLD_attr1, + FLD_attr2, + FLD_rpt, + FLD_fmt, + FLD_help_num, + FLD_off1, /* Offset im VAL-Format */ + FLD_off2, + FLD_flg1, + FLD_typ, /* == flg2 */ + FLD_flg3, + FLD_flg4; +}; + +/***************************************************************************** +ANM: Bei Aktivierung eines Feldes wird der Attribut Code 1 invertiert + verwendet. Falls das Bit 7 in flg1 (flg | 0x80) gesetzt ist, wird + der Attribut Code 2 (nicht invertiert) verwendet. + +������������������������������������������������������������������������������ +flg1: (altes F1) +������������������������������������������������������������������������������ + Bit 0 � 0x01 � Forward Link (N/A) + 1 � 0x02 � Backward Link (N/A) + 2 � 0x04 � (reserved) + 3 � 0x08 � Return after 1 Character Input + 4 � 0x10 � Type Ahead: 1 -> Autoenter wenn Feld voll ist + 5 � 0x20 � No Reedit: 1 -> Field nur 1 x editieren + 6 � 0x40 � CLEAR: 1 -> Feld l�schen vor Edit + 7 � 0x80 � ATTR2: 1 -> bei Attr2 statt inversertierung von Attr1 +������������������������������������������������������������������������������ +*****************************************************************************/ + +/* Definition f. Button Descriptor ---------------------------------------- */ +#define BUT_size 16 +#define BUTo_ax 0 +#define BUTo_ay 2 +#define BUTo_bx 4 +#define BUTo_by 6 +#define BUTo_key 8 +#define BUTo_color1 10 +#define BUTo_value 12 + +struct BUTTON_DESC +{ + int BUT_ax, BUT_ay; /* Button Koordinaten */ + int BUT_bx, BUT_by; + int BUT_key; /* �quivalenter Key */ + int BUT_color1; /* Farbe bei Anzeige */ + /* Button-Anzeige */ + long BUT_value; +} ; + +/* Field Funktionen: ------------------------------------------------------ */ +int cdecl mm_field_locate (char field_descriptors [], + int field_count, + int x, + int y, + int *field_number); + +int cdecl mm_field_allocate (char field_descriptors [], + int field_count, + char *data []); + +void cdecl mm_field_jump (char field_descriptor [], + int field_count, + int t, + int *f, + int *new_off); + +/* Button Funktionen: ----------------------------------------------------- */ +int cdecl mm_button_locate (char button_descriptor [], + int button_count, + int x, + int y, + int *button_number); + +#endif /* __GG_fields__ */ diff --git a/lib/include/gg/fileio.h b/lib/include/gg/fileio.h new file mode 100644 index 0000000000000000000000000000000000000000..868dcab690c0191b67d4dd7bc8ad57b2f110487d --- /dev/null +++ b/lib/include/gg/fileio.h @@ -0,0 +1,67 @@ +/* + * include FILE <gg/fileio.h> + * + * written: 1988 03 19 + * 1991 01 28: revision + * latest update: 1997-10-24 12:04:02 + * + */ + +#ifndef __GG_fileio__ +#define __GG_fileio__ + +#include <gg/floskel.h> + +/* diagnostic values: (*OLD*) --------------------------------------------- */ +#define ERR_file_not_found 17 /* f4read */ +#define ERR_name_not_found 18 /* . */ +#define ERR_version_not_found 19 /* . */ +#define ERR_eof 20 /* . */ + +#define TEMPFILE "tmptmp.tmp" + +#define FXOPEN(fn,fh,dfh,m,f) \ + {if ((fn) == (char *) 0 || *fn == 0 || (fn[0] == '-' && fn[1] == 0)) \ + { fh= dfh; f= 0;} else { fh= fopen (fn, m); f= 1; }} + +#define FXCLOSE(fh,f) {if (f && fh != (FILE *) 0) fclose (fh);} + +/* %sbr/fileio.c: --------------------------------------------------------- */ +void cdecl set_filemode (int num, int nid, char *ident [], int slng); +int cdecl get_identifier (char *n); +int cdecl get_Sid (void); + +#ifdef _FILE_DEFINED +int cdecl f4fscan (FILE *fi, FILE *fo, int *objekttyp, char *objekt, + int flags); +#endif /* _FILE_DEFINED */ + +int cdecl f4f_read (char *filename, char *k_name, int *k_version, int flags, + char *daten1 [], int daten1_zahl, + char *daten2 [], int daten2_zahl, + char *daten3 [], int daten3_zahl, + char *daten4 [], int daten4_zahl); +int cdecl f4f_write (char *filename, char *k_name, int *k_version, int flags, + char *daten1 [], int daten1_zahl, + char *daten2 [], int daten2_zahl, + char *daten3 [], int daten3_zahl, + char *daten4 [], int daten4_zahl); + +#ifdef _FILE_DEFINED +void cdecl f4f_wds (FILE *fo, + char *daten1 [], int daten1_zahl, + char *daten2 [], int daten2_zahl, + char *daten3 [], int daten3_zahl, + char *daten4 [], int daten4_zahl); +#endif /* _FILE_DEFINED */ + +/* %sbr/file2buf.c: ------------------------------------------------------- */ +long cdecl read_file2buffer (char **buffer, char *fnm, long limit); + +#ifdef _FILE_DEFINED +/* file2low.c */ int cdecl file_to_lower (char *fn, FILE *fo); +/* file2low.c */ int cdecl file_to_upper (char *fn, FILE *fo); +/* fclosec.c */ int cdecl fclose_or_what (FILE *f); +#endif /* _FILE_DEFINED */ + +#endif diff --git a/lib/include/gg/filename.h b/lib/include/gg/filename.h new file mode 100644 index 0000000000000000000000000000000000000000..1472f9e626a7d50ed53e848c38c22de3f24042a2 --- /dev/null +++ b/lib/include/gg/filename.h @@ -0,0 +1,143 @@ +/* + * include FILE <gg/filename.h> + * + * filename operations + * + * written: 1991 11 02 + * latest update: 2000-12-09 16:16:23 + * $Id: filename.h,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifndef __GG_filename__ +#define __GG_filename__ + +#include <gg/floskel.h> + +#ifdef MSDOS +#define DEF_FNM_LENGTH 258 +#else +#define DEF_FNM_LENGTH 1026 +#endif +#define DEF_FNM_EXTRA 24 + +#ifndef MAX_FNM_LENGTH +#ifdef MSDOS +#define MAX_FNM_LENGTH 258 +#else +#define MAX_FNM_LENGTH 1026 +#endif +#endif + +#define DEFAULT_MODULE_TABLE "module.tfb" +#define DEFAULT_MODULE_DIR "%sbr" + +/* ------------------------------------------------------------------------ */ +typedef char *FVF_get_directory_listing (char *path, void *cd); + +/* ------------------------------------------------------------------------ */ +struct VIRTUAL_FILENAME +{ + struct VIRTUAL_FILENAME *VFN_next; + char *VFN_virtual; + char *VFN_real; +} ; + +/* prototypes ------------------------------------------------------------- */ +/* handling of logic, real and virtual paths */ +/* logicfnm.c */ char *cdecl translate_logic_filename (const char *fnm); + char *cdecl _translate_logic_filename (const char *fnm, + char **vfnv); + struct VIRTUAL_FILENAME *cdecl read_logic_filename_table ( + char *l1, int read_all); + struct VIRTUAL_FILENAME *cdecl _read_logic_filename_table ( + char *lp_file, char *l1, int read_all); + struct VIRTUAL_FILENAME *cdecl _define_logic_filename ( + char *fn_virtual, char *fn_real); + int cdecl find_logic_filename (char *p, char *vp_buffer, + int vp_lng); + int flush_virtual_filename_table (void); + int vfn_set_read_flag (int val); + struct VIRTUAL_FILENAME *get_virtual_filename_table (void); +#ifdef _FILE_DEFINED +/* logicfpt.c */ int print_virtual_filename_table (FILE *fo); +#endif +/* fnmdef.c */ int cdecl filename_definition (const char *spec, + char **real, char **virtual_fnm, char *assumed_path); +/* fnmreal.c */ char *cdecl real_filename (const char *spec, char *assumed_path); +/* fnmrenm.c */ int cdecl filename_rename (char *from, char *to, int mode); +/* fnmdpath.c */ char *cdecl duplicate_assumed_path (char *assumed_path); + int _duplicate_assumed_path_alloc_size (void); +/* getcdir0.c */ char *cdecl _get_current_directory (char *buffer); +/* getcdir1.c */ char *cdecl get_current_directory (char *buffer); +/* curdisk.c */ int get_current_disk (void); + int select_disk (int disk_number); +/* dcd01.c */ int cdecl dcd (char *dir_specified); + +/* fnmdestn.c */ char *cdecl get_destination_name (char *dest_dir, + char *from, char *result, int mk_path, int rotfnm); +/* makepath.c */ int cdecl make_path (char *path, int flags); +/* fmtdta01.c */ int cdecl fmt_dta_date (char *puffer, int fn_date); +/* fmtdta02.c */ int cdecl fmt_dta_time (char *puffer, int fn_time); +/* fnmcpy.c */ int cdecl fnmcpy (char *dst, char *src, char *ext); +/* fnmcpy2.c */ char *fnmcpy2 (char *fnm_old, char *ext); +/* fnmcpy3.c */ char *fnmcpy3 (char **dst, char *fnm_old, char *ext); +/* fnmcpy4.c */ char *fnmcpy4 (char *fnm1, char *fnm2, char *ext); +/* fnmsep1.c */ int cdecl isolate_path (char *s); +/* fnmsep2.c */ char *cdecl remove_extension (char *s); +/* fnmsep3.c */ char *cdecl get_filename_from_path (char *s); +/* fnmsep4.c */ char *cdecl get_relative_path (char *p1, char *p2); +/* fndvfile.c */ int find_virtual_file (char *fnm, char *current_path, + char **real_fnm, char **virtual_fnm); + int fvf_set_dirinf (char *s); + int fvf_set_dirinf_callback ( + FVF_get_directory_listing *proc, void *client_data); +/* gennednm.c */ char *cdecl generate_ned_name (char *fnm, char *ext, + int check_subdir); +/* getpwd_l.s */ void cdecl getpwd (char *buffer, int drive); +/* extcmp.c */ int cdecl extcmp (char *s1, char *s2); +/* setetcfn.c */ char *cdecl set_etc_filename (char *dst, char *fnm); +/* settmpfn.c */ char *cdecl set_tmp_filename (char *dst, char *fnm); +/* envfilsr.c */ char *cdecl env_file_search (char *fn, char *env); +/* envbinsr.c */ char *cdecl env_bin_search (char *fn, char *env, + char *ext [], int n_ext); +/* shift01.c */ int cdecl vshift (char *fnm, long version, char *fmt, + int doit, int verbose); +/* tellext.c */ char *cdecl tell_extension (char *s); +/* fnm_d2u.c */ int cdecl filename_dos2unix (char *d, char *s); +/* wildcrd2.c */ int cdecl wcrd_wild_check (char *nm); +/* modtbl.c */ int cdecl read_module_table (char *fnm); + char *cdecl get_module_directory (char *fnm); +/* cdromfnm.c */ int cdecl cdrom_file_name (char *fnm); +/* fnmovwr.c */ char *alternative_filename (char *fnm, int extra); + +/* module rotfile.c ------------------------------------------------------- */ +#ifdef _FILE_DEFINED +int cdecl rotate_file (char *fn, FILE *fo, int verbose_mode, int decode_it, + int rotate_names); +#endif + +/* module wildcard.c ------------------------------------------------------ */ +#ifndef __CMS__ /* what other operating system would care for this? */ +int cdecl wcrd_get_date (void); +int cdecl wcrd_get_time (void); +long cdecl wcrd_get_size (void); +int cdecl wcrd_wildcards_or_rec (char *fn); +int cdecl wcrd_wildcards (char *fn); +int cdecl wcrd_set_match_mode (int mode); +int cdecl wcrd_get_match_mode (void); +int cdecl wcrd_set_subdirs (int mode); +#define wcrd_set_recursive wcrd_set_subdirs +int cdecl wcrd_get_subdirs (void); +int cdecl wcrd_get_current_level (void); +int cdecl wcrd_leave (int levels); + +#ifdef __COMMENT__ +int cdecl main_fnc (char *fn); /* this function will be called from the */ + /* the wildcard functions and performs the */ + /* actual processing task with the file */ +#endif /* __COMMENT__ */ +#endif /* !__CMS__ */ + + +#endif /* __GG_filename__ */ diff --git a/lib/include/gg/floskel.h b/lib/include/gg/floskel.h new file mode 100644 index 0000000000000000000000000000000000000000..68db5cd7f2523ab8f0450c0b52df8a852c8082e8 --- /dev/null +++ b/lib/include/gg/floskel.h @@ -0,0 +1,42 @@ +/* + * include FILE <gg/floskel.h> + * + * general clauses for header files + * + * written: 1994-12-03 + * latest update: 2001-02-11 16:43:26 + * $Id: floskel.h,v 1.3 2005/03/11 23:42:45 gonter Exp $ + * + */ + +#ifndef __GG_floskel__ +#define __GG_floskel__ + +#ifndef MSDOS +#ifndef cdecl +#define cdecl +#endif +#endif + +#if defined (_STDIO_H) || defined (_STDIO_H_) || defined (_H_STDIO) +#ifndef _FILE_DEFINED +#define _FILE_DEFINED +#endif +#endif + +#ifdef stdout +#ifndef _FILE_DEFINED +#define _FILE_DEFINED +#endif +#endif + +#ifdef _TIME_H_ +#ifndef _TM_DEFINED +#define _TM_DEFINED +#endif +#endif + +/* used for checking the correct assignment of function parameters */ +#define PAR(name,value) (value) + +#endif /* __GG_floskel__ */ diff --git a/lib/include/gg/fnames.h b/lib/include/gg/fnames.h new file mode 100644 index 0000000000000000000000000000000000000000..172a5169109b13ea6d65fa3d52b0ffd5a66b9453 --- /dev/null +++ b/lib/include/gg/fnames.h @@ -0,0 +1,71 @@ +/* + * include FILE <gg/fnames.h> + * + * Files suchen �ber DOS + * + * written: 1987 10 21 + * 1990 02 03: Revision + * 1991 01 28: Revision + * latest update: 1996-08-11 10:10:11 + * + */ + +#ifndef __GG_fnames__ +#define __GG_fnames__ + +/* DOS Function Calls - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#define Setdta 0x1A +#define First 0x4E +#define Next 0x4F + +/* File Attribute - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +#define FA_READONLY 0x01 +#define FA_HIDDEN 0x02 +#define FA_SYSTEM 0x04 +#define FA_VOLUME 0x08 +#define FA_DIRECTORY 0x10 /* just directories */ +#define FA_ARCHIVE 0x20 +#define FA_FILE 0x27 /* alle Files */ +#define FA_ALL 0x37 /* auch Directories */ + +/* Kontroll-Struktur f�r Directory Entry - - - - - - - - - - - - - - - - - */ +#pragma pack(1) + +struct dta_buff /* Standard DTA-Struktur lt. MSDOS */ +{ + char res [21]; /* (laut MicroSoft reserved) */ + char att; /* File Attribute: FA_xxxx */ + int time, date; /* Date/Time der letzten �nderung */ + long size; /* File Size in Bytes */ + char name [14]; /* File Name */ +} ; + +/* erweiterte Kontroll-Struktur f�r Directory Entry - - - - - - - - - - - - */ +struct dta2_buff /* Listen + Info */ +{ + char att; /* File Attribute: FA_xxxx */ + int time, date; /* Date/Time der letzten �nderung */ + long size; /* File Size in Bytes */ + char name [14]; /* File Name */ + struct dta2_buff *prev, *next; /* Listenverkettung */ + int info_allocated; /* FM: 1 -> Info-Eintr�ge g�ltig */ + int info_cnt; /* FM: Zahl der infos [] */ + int select_code; /* FM: Function-Key f�r DIESES File */ + int mark_left; /* FM: Markierungsattribut */ + char *infos [2]; /* FM: Info Eintr�ge */ +} ; + +#pragma pack() + +/* Modul FNAMES.C --------------------------------------------------------- */ +void cdecl Fsetdta (struct dta_buff *dta); +int cdecl Fsfirst (char *name, int att); +int cdecl Fsnext (void); + +/* Modul FNAMES2.C -------------------------------------------------------- */ +struct dta_buff *cdecl Fdta_find (char *path, int attr); +char *cdecl Fname_find (char *path, int attr); +void cdecl Freset_find (void); +struct dta_buff *cdecl Fget_dta (void); + +#endif /* __GG_fnames__ */ diff --git a/lib/include/gg/ggcms.h b/lib/include/gg/ggcms.h new file mode 100644 index 0000000000000000000000000000000000000000..1d9e02e53dd4d513160fecb48dec10695d915213 --- /dev/null +++ b/lib/include/gg/ggcms.h @@ -0,0 +1,140 @@ +/* + * include FILE <gg/ggcms.h> + * + * redefine some things for use with CMS in order to avoid + * those nasty name conflicts + * HYX: no_links + * + * written: 1992 02 06 + * latest update: 1995-08-11 + * + */ + + +#ifndef __GG_CMS__ +#define __GG_CMS__ +#define __CMS__ + +/* renamed library functions: --------------------------------------------- */ +#define unlink remove + +/* renamed functions: ----------------------------------------------------- */ +#define sixel_encode se_01_sd +#define sixel_encode_setup se_02_sd +#define sixel_encode_bits se_03_sd +#define sixel_decode se_04_sd +#define sixel_decode_setup se_05_sd +#define sixel_decode_bits se_06_sd +#define sixel_segment_decode se_07_sd +#define sixel_segment_processor se_08_sd +#define sixel_analyze_segment se_09_sd +#define sixel_analyze_bin_tags se_10_sd +#define sixel_segment_sort se_11_sd +#define sixel_segment_list se_12_sd +#define sixel_segment_completeness se_13_sd +#define sixel_segment_pass2 se_14_sd +#define sixel_identify_tag se_15_sd +#define sixel_identify_attribute se_16_sd +#define print_bin_f se_17_sd +#define print_bin_d se_18_sd + +/* from <gg/strings.h> */ +#define strcmp_c st_01cms +#define strcmp_ebcdic st_02cms +#define strcmp_us st_03cms +#define strcmp_weighted st_04cms +#define strcmp_cweighted st_05cms +#define strcmp_cre st_06cms +#define translate st202cms +#define isolate_words isowrds +#define isolate_tokens isotoks +#define isolate2words iso2wrds + +/* from <gg/sbr.h> */ +#define string_pull strpl +#define string_push strps +#define actual_datim actd +#define actual_datim_int actdi +#define ftransfer sbr01 +#define f2transfer sbr02 +#define f3transfer sbr03 +#define ftransfer_to_shar sbr04 +#define f5transfer_to_shar sbr05 +#define ftransfer_line sbr06 + +/* from <gg/hyx.h> */ +#define get_attr_value getav +#define find_attr_name fndan +#define find_attr_value fndav + +/* from <gg/dpp.h> */ +#define _get_parameter_value gpmv0001 + +#define bitmask_32bit bm32bit +#define put_chartable pcht + +/* from <gg/filename.h> */ +#define fmt_dta_date fmtdta1 +#define fmt_dta_time fmtdta2 + +/* nl_kr package: --------------------------------------------------------- */ +#define discard_document_info dsdif +#define discard_document_id dsdid + +#define lookup_file lut01 +#define lookup_file_xfn lut02 +#define lut_char_get_word_buffer lut03 +#define lut_char_get_dump_beg lut04 +#define lut_char_get_dump_end lut05 +#define lut_file_get_word_buffer lut06 +#define lut_file_get_dump_beg lut07 +#define lut_file_get_dump_end lut08 +#define lut_print lut09 +#define lut_print_block lut10 +#define lut_process lut11 +#define lut_process_block lut12 +#define deref_word lut13 +#define deref_word_ref lut14 +#define read_word_ref_list lut15 +#define read_word_ref lut16 +#define discard_doc_info lut17 +#define discard_doc_id lut18 +#define print_veronica_hit_list lut19 +#define print_veronica_docinfo_list lut20 +#define print_gopher_hit_list lut22a +#define print_doc_hit_list lut22b +#define print_document_info_list lut22c +#define print_docdir_hyx lut22d +#define print_docdir_gopher lut22e +#define read_document_info_list lut23 +#define read_docdir_info lut24 +#define luttest lut25a +#define luttest_manual lut25m +#define deref_set_match_pattern sxmp + +#define YTREE_ALLOC_SIZE ytals +#define YTREE_ALLOCATED ytalc +#define read_words rw007 +#define ytree_free ytfr +#define ytree_print_node ytpn +#define ytree_process ytpr +#define get_word_ref_list wrx1a +#define get_word_ref wrx1b + +#define ytree_wr_ptr2idx ytwp2i +#define ytree_wr_idx2ptr ytwi2p + +/* reprogrammed functions: ------------------------------------------------ */ +char *strdup (char *str); + +/* simulated stat() ------------------------------------------------------- */ +struct stat +{ + long st_size; + int mode; +} ; + +int stat (char *fn, struct stat *st); +int access (char *fn, int mode); + +#endif /* __GG_CMS__ */ diff --git a/lib/include/gg/ggcrypt.h b/lib/include/gg/ggcrypt.h new file mode 100644 index 0000000000000000000000000000000000000000..debbadb1da691aa9d0175146c6fb0684689a9fdb --- /dev/null +++ b/lib/include/gg/ggcrypt.h @@ -0,0 +1,161 @@ +/* + * include FILE <gg/ggcrypt.h> + * + * simple encryption routines + * + * written: 1994-09-18 + * latest update: 1997-10-05 9:41:24 + * $Id: ggcrypt.h,v 1.4 2009/09/24 12:21:08 gonter Exp $ + * + */ + +#ifndef __GG_ggcrypt__ +#define __GG_ggcrypt__ + +#include <gg/floskel.h> + +/* ------------------------------------------------------------------------ */ +#define _GG_CRYPT_defined +struct GG_CRYPT +{ + char *GGC_challenge; + char *GGC_key; + char *GGC_key_str; + int GGC_index; +} ; + +#define KEYED_MD5_SIZE 20 + +/* ------------------------------------------------------------------------ */ +#ifdef MODE_CFB +/* cipher feedback mode */ +#define ggc_file_encrypt ggc_file_cfb +#define ggc_stream_encrypt ggc_stream_cfb +#define ggc_block_encrypt ggc_block_cfb +#define ggc_pad ggc_pad_cfb +#define ggc_pad_md5 ggc_pad_md5_cfb +#endif + +#ifdef MODE_ECB +/* electronic coodebook mode */ +#define ggc_file_encrypt ggc_file_ecb +#define ggc_stream_encrypt ggc_stream_ecb +#define ggc_block_encrypt ggc_block_ecb +#define ggc_pad ggc_pad_ecb +#define ggc_pad_md5 ggc_pad_md5_ecb +#endif +/** #define GGC_BUFFER_SIZE 8192 **/ +#define GGC_BUFFER_SIZE 524288 + +/* ------------------------------------------------------------------------ */ +#define ggcrypt_new() \ + ((struct GG_CRYPT *) calloc (sizeof (struct GG_CRYPT), 1)) + +#define ggcrypt_free(x) free (x) + +/* ------------------------------------------------------------------------ */ +/* ggcryp01.c */ int cdecl ggcrypt_very_simple (char *fn, + char *crypt_code, int crypt_length, char *crypt_tmp, + char *buffer1, char *buffer2, int BUFFER_SIZE); +/* ggcryp02.c */ int cdecl gg_encrypt (char *fn, + int crypt_length, char *crypt_tmp, + char *buffer1, char *buffer2, int BUFFER_SIZE); + +/* ggcryp03.c */ int cdecl gg_decrypt (char *fn, + int crypt_length, char *crypt_tmp, + char *buffer1, char *buffer2, int BUFFER_SIZE); + +/* /ggcryp04.c */ int cdecl ggcrypt_set_code (char *cp); +#ifdef _FILE_DEFINED + int cdecl ggcrypt_fputc_code (int c, FILE *f); + int cdecl ggcrypt_fgetc_code (FILE *f); + int cdecl ggcrypt_flush_last (FILE *f); +#endif /* _FILE_DEFINED */ + int cdecl ggcrypt_encode (int c); + +/* ggcryp05.c */ int cdecl ggcrypt_block (unsigned char *block, int block_lng, + unsigned char *key, int key_lng); + +/* ggcryp06.c */ int cdecl ggcrypt_string (unsigned char *string, + unsigned char *key, int key_lng); + +/* ggcryp07.c */ char *cdecl sec_generate_key (char *principal, + char *resource, char *identifier, char *secret); + +/* ggcryp08.c */ int cdecl agettok_get_hash_key (char *user_from, + char *user_to, char *resourc_name, char *hash, char *key, + int hash_size); + char *cdecl agettok_get_resource_password (char *file_name, + char *user_from, char *user_to, char *resourc_name, + int get_flags); + char *cdecl agettok_get_resource_entry (char *file_name, + char *user_from, char *user_to, char *resource_name); + int cdecl agettok_set_resource_password (char *file_name, + char *user_from, char *user_to, char *resourc_name, + char *resource_password, int set_flags); +#define AGETTOK_clear_password 0x0001 +#define AGETTOK_write_entry 0x0002 + +/* ggcryp09.c */ char *cdecl agettok_get_challenge (char *password_file, + char *user_from, char *user_to, char *resource_name, + char *challenge); +/* ggcryp10.c */ char *cdecl sca_get_sigfile (char *username); +/* ggcryp11.c */ char *cdecl sca_get_signature (char *username, + char *password); +/* ggcryp12.c */ int cdecl sca_check_signature (char *sca_sig_file, + char *sca_signature); +/* ggcryp13.c -- ggc_block_encrypt () */ + int cdecl ggc_block_ecb (struct GG_CRYPT *ggc, + char *buffer, int size); + int cdecl ggc_block_cfb (struct GG_CRYPT *ggc, + char *buffer, int size); +/* ggcryp14.c */ int cdecl ggc_set_session_key (struct GG_CRYPT *ggc, + char *key_file, char *from, char *to, char *resource); +/* ggcryp15.c -- ggc_file_encrypt () */ + int ggc_file_ecb (struct GG_CRYPT *ggc, char *fn, + char *crypt_tmp, long padding); + int ggc_file_cfb (struct GG_CRYPT *ggc, char *fn, + char *crypt_tmp, long padding); +/* ggcryp16.c */ struct GG_CRYPT *ggc_set_key (struct GG_CRYPT *ggc, + char *key); +/* ggcryp17.c */ int ggc_dispose_key (struct GG_CRYPT *ggc); +/* ggcryp18.c */ int ggc_dispose_block (char **cpp, int lng); +/* ggcryp19.c */ int ggc_dispose (struct GG_CRYPT *ggc); +#ifdef _FILE_DEFINED +/* ggcryp20.c -- ggc_stream_encrypt () */ + int ggc_stream_ecb (struct GG_CRYPT *ggc, + FILE *fi, FILE *fo, long padding); + int ggc_stream_cfb (struct GG_CRYPT *ggc, + FILE *fi, FILE *fo, long padding); +/* ggcryp23.c */ +void ggc_pad (struct GG_CRYPT *ggc, FILE *fo, char *buffer, + long padding, long BS); +#endif /* _FILE_DEFINED */ +/* ggcryp24.c */ int ggc_file_2enc (struct GG_CRYPT *ggc, char *fn, + char *crypt_tmp, long padding1, long padding2); +/* ggcryp25.c */ int ggc_file_2dec (struct GG_CRYPT *ggc, char *fn, + char *crypt_tmp); + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +#ifdef __GG_attlist__ +/* ggcryp21.c */ +int ggc_stream_2encrypt (struct GG_CRYPT *ggc, FILE *fi, FILE *fo, + ATTLIST *al_pre, ATTLIST *al_post, long padding1, long padding2); +/* ggcryp22.c */ +int ggc_stream_2decrypt (struct GG_CRYPT *ggc, FILE *fi, FILE *fo); + +/* ggcryp26.c */ +int ggc_wr_tag_block (struct GG_CRYPT *ggc, FILE *fo, char *tag_name, + ATTLIST *al, char *buffer); +#endif /* __GG_attlist__ */ + +#ifdef __contrib_md5gg__ +/* ggcryp27.c */ +long ggc_pad_md5 (struct GG_CRYPT *ggc, MD5_CTX *md5, + FILE *fo, char *buffer, long padding, long BS); +#endif /* __contrib_md5gg__ */ + +#endif /* _FILE_DEFINED */ + +#endif /* __GG_ggcrypt__ */ diff --git a/lib/include/gg/ggtcl.h b/lib/include/gg/ggtcl.h new file mode 100644 index 0000000000000000000000000000000000000000..d0cba242be313aecdc751d9b5f7fcbc6d0a8cfe0 --- /dev/null +++ b/lib/include/gg/ggtcl.h @@ -0,0 +1,57 @@ +/* + * include FILE <gg/ggtcl.h> + * + * GG's Tcl libarary + * - registration procedures + * - command procedures + * + * written: 1996-03-17 + * latest update: 1996-09-28 11:35:38 + * $Id: ggtcl.h,v 1.2 2012/08/10 14:44:09 gonter Exp $ + * + */ + +#ifndef __GG_ggtcl__ +#define __GG_ggtcl__ + +#include <gg/floskel.h> + +/* ------------------------------------------------------------------------ */ +struct N2P +{ + char *cmd; + Tcl_CmdProc *prc; +} ; + +typedef struct N2P N2P_t; + +#define __TCL_CMDPROC__ ClientData client_data, Tcl_Interp *interp, \ + int argc, char *argv [] +/* registration procedures: ----------------------------------------------- */ +int ggtcl_reg_services (Tcl_Interp *interp, struct N2P *service_table); +int ggtcl_reg_filename_services (Tcl_Interp *interp); +int ggtcl_reg_hyx_services (Tcl_Interp *interp); + +/* command procedures: ---------------------------------------------------- */ + +/* filename services */ +int ggtcl_template (__TCL_CMDPROC__); +int ggtcl_translate_virtual_name (__TCL_CMDPROC__); +int ggtcl_read_virtual_path_table (__TCL_CMDPROC__); +int ggtcl_define_virtual_path (__TCL_CMDPROC__); +int ggtcl_virtual_filename (__TCL_CMDPROC__); +int ggtcl_real_filename (__TCL_CMDPROC__); +int ggtcl_filename_definition (__TCL_CMDPROC__); +int ggtcl_find_virtual_file (__TCL_CMDPROC__); +int ggtcl_set_dirinf (__TCL_CMDPROC__); +int ggtcl_register_dirinf_generator (__TCL_CMDPROC__); +int ggtcl_register_url_handler (__TCL_CMDPROC__); + +/* helpers */ +char *ggtcl_dirinf_generator (char *dir_path, void *client_data); +char *ggtcl_url_fetcher (char *url, void *client_data); + +/* hyx services */ +int ggtcl_hyx_set_color_code (__TCL_CMDPROC__); + +#endif /* __GG_ggtcl__ */ diff --git a/lib/include/gg/gif.h b/lib/include/gg/gif.h new file mode 100644 index 0000000000000000000000000000000000000000..11fbb435cd51b2299200ebc4426301d9e77a0488 --- /dev/null +++ b/lib/include/gg/gif.h @@ -0,0 +1,89 @@ +/* + * include FILE <gg/gif.h> + * + * datastructures for GIF-files etc. + * + * written: 1989 08 29 + * 1991 10 03: Revision + * latest update: 1994-09-04 + * + */ + + +#ifndef __GG_gif__ +#define __GG_gif__ + +#define GIF_signature "GIF87a" +#define GIF_image_signature ',' +#define GIF_terminator ';' +#define GIF_extension_signature '!' + +#pragma pack(1) + +/* ------------------------------------------------------------------------ */ +struct GIF_screen_descriptor +{ + int gif_screen_width; + int gif_screen_height; + char gif_pixels_; + char gif_background; + char gif_dummy_1; +} ; + +/* ------------------------------------------------------------------------ */ +struct GIF_color_map +{ + char gif_intensity_red; + char gif_intensity_green; + char gif_intensity_blue; +} ; + +/* ------------------------------------------------------------------------ */ +struct GIF_image_descriptor +{ + int gif_image_left; + int gif_image_top; + int gif_image_width; + int gif_image_height; + char gif_image_flags; +} ; + +/* ------------------------------------------------------------------------ */ +struct GIFLZW_DATA /* status variables from module GIFLZWDC.C */ +{ /* >>>>>> se also GIFLZWDC.C <<<<<<<<<<<<<< */ + int GLD_block_counter; /* position in decode-block */ + int GLD_stat; /* state of the LZW-deocoder */ + int GLD_mem_available; /* 1 -> memory for tables is available */ + /* ---------------------------------------- */ + int GLD_pixies; /* Bits/Pixel; initial code size */ + int GLD_code_size; /* actual code size: pixies+1 .. 12 */ + int GLD_bits; /* compose decoding code */ + int GLD_bit_num; /* number of bits in bits [] */ + int GLD_min_code; /* first available LZW-code */ + int GLD_max_code; /* first LZW-code with code_size+1 bits */ + int GLD_clear; /* CLEAR-Code (== min_code - 2) */ + int GLD_end; /* END-Code (== min_code - 1) */ + int GLD_nvc; /* Next Valid Code (LZW-code to come) */ + int GLD_code; /* LZW-code just processed */ + int GLD_new_code; /* LZW-code just processed */ + int GLD_old_code; /* LZW-code previously processed */ + int GLD_color; /* color derived from LZW-code */ + /* ---------------------------------------- */ + int GLD_sp; /* stack pointer for output stack */ + int *GLD_stack; /* output stack */ + int *GLD_shade; /* color code of the LZW-codes */ + int *GLD_child; /* following LZW-code of the LZW-codes */ + /* child [i] = j; j < i; */ + /* in all cases ? */ + /* i < min_code undefined; i is a color */ +} ; + +/* ------------------------------------------------------------------------ */ +#define GIF_ERROR_invalid_LZW_code 1 + +/* ------------------------------------------------------------------------ */ +struct GIFLZW_DATA *cdecl get_giflzw_data(); + +#pragma pack() + +#endif /* __GG_gif__ */ diff --git a/lib/include/gg/help.inc b/lib/include/gg/help.inc new file mode 100644 index 0000000000000000000000000000000000000000..ac28269e84593cbfb9a18dfd09c1b9d7c9e8aebe --- /dev/null +++ b/lib/include/gg/help.inc @@ -0,0 +1,42 @@ +/* + * include FILE <gg/help.inc> + * + * Ausgabe von HELP-Klauseln + * + * Voraussetzung: static char *HELP [] + * int j; + * STDHLP + * + * written: 1988 02 25 + * 1992 02 12: CMS + * latest update: 1995-08-21 + * $Id: help.inc,v 1.2 2011/05/31 15:51:09 gonter Exp $ + * + */ + +#ifndef STDHLP +#define STDHLP stdout +#endif + +default : + +#ifdef W_MODEL_CURSES + endwin(); +#endif + + for (j = 0; j < (sizeof (HELP) / sizeof (char *)); j++) + { + fputs (HELP [j], STDHLP); +#ifdef MSDOS + if ((j % 23) == 22 + || (j+1 >= (sizeof (HELP) / sizeof (char *)) )) + switch (getch ()) + { + case 0: getch (); break; + case 'b': case 'B': j = -1; break; + case 0x1b: exit (0); + } +#endif + if (j+1 >= (sizeof (HELP) / sizeof (char *))) break; + } + exit (0); diff --git a/lib/include/gg/help2.inc b/lib/include/gg/help2.inc new file mode 100644 index 0000000000000000000000000000000000000000..220913818473c1c71b9daed86bcc06f2d1b3dac2 --- /dev/null +++ b/lib/include/gg/help2.inc @@ -0,0 +1,36 @@ +/* + * include FILE <gg/help2.inc> + * + * Ausgabe von HELP-Klauseln /// Variante 2 + * + * Voraussetzung: static char *HELP [] + * STDHLP + * + * written: 1989 04 12 + * latest update: 1995-02-19 + * + */ + +#ifndef STDHLP +#define STDHLP stdout +#endif + +HELP_function () +{ + int j; + + for (j= 0; j < (sizeof (HELP) / sizeof (char *)); j++) + { + fprintf (STDHLP, HELP [j]); + if ((j % 23) == 22 || (j+1 >= (sizeof (HELP) / sizeof (char *)) )) + switch (getch ()) + { + case 0: getch (); break; + case 'b': case 'B': j = -1; break; + case 0x1b: exit (0); + } + if (j+1 >= (sizeof (HELP) / sizeof (char *))) break; + } + + exit (0); +} diff --git a/lib/include/gg/hytxt.h b/lib/include/gg/hytxt.h new file mode 100644 index 0000000000000000000000000000000000000000..06171603d2cae109ef5a3fa3ac650751a0d9b580 --- /dev/null +++ b/lib/include/gg/hytxt.h @@ -0,0 +1,388 @@ +/* + * include FILE <gg/hytxt.h> + * + * declaration of HYX hypertext structures + * + * written: 1990 02 14 + * latest update: 1997-11-09 12:47:53 + * $Id: hytxt.h,v 1.4 2005/09/04 20:27:37 gonter Exp $ + * + */ + +#ifndef __GG_hytxt__ +#define __GG_hytxt__ + +#include <gg/floskel.h> +#include <gg/ytree.h> + +/* limits: ---------------------------------------------------------------- */ +#define FRAME_NAME_LNG 1024 /* maximum length of a frame name */ + +/* ------------------------------------------------------------------------ */ +struct HYTXT_ATTR /* Hypertext Frame Attribut Liste */ +{ + struct HYTXT_ATTR + *hytxt_attr_next; + char *hytxt_attr_id; /* Frame Attribut Name */ + char *hytxt_attr_pars; /* Frame Attribut Parameter */ +} ; + +/* ------------------------------------------------------------------------ */ +struct HYTXT_FRAME /* Hypertext Frame Descriptor */ +{ /* not much used anymore ... */ + struct HYTXT_FRAME + *hytxt_frame_next, /* Naechster Frame; bezogen auf Fileposition*/ + *hytxt_frame_prev, /* Vorheriger Frame; bezogen auf File-Pos */ + *hytxt_frame_earlier, /* Aeltere Version des *selben* Frames */ + *hytxt_frame_newer; /* Neuere Version des *selben* Frames */ + + struct HYTXT_ATTR + *hytxt_attr, /* Frame Attribut Liste */ + **hytxt_attr_append; /* Pointer zum Anhaengen des */ + /* naechsten Attributs */ + + long hytxt_frame_pos_beg; /* Anfang des Frames im File */ + long hytxt_frame_pos_end; /* Ende des Frames im File */ + char *hytxt_frame_name; /* Name des Frames (gestrippt) */ + + int hytxt_frame_flags; /* Flags fuer interne Verwendung */ +#define HYTXT_FRFLAG_Deleted 0x01 /* Frame was deleted */ +#define HYTXT_FRFLAG_Rename 0x02 /* Frame was renamed */ +#define HYTXT_FRFLAG_Move 0x04 /* Frame was moved */ +#define HYTXT_FRFLAG_TOPURGE 0x07 /* Frame should be purged next time */ + + char *hytxt_frame_buffer; /* space to store frame data */ + int hytxt_frame_bsize; /* size of frame buffer */ +} ; + +/* ------------------------------------------------------------------------ */ +struct FILE_SEGMENT +{ + struct FILE_SEGMENT *FS_next; /* ... next one please! */ + + char *FS_frame_name; /* frame name involved */ + long FS_index; /* frame's index number */ + long FS_begin; /* frame's coordinates in the cluster */ + long FS_end; /* */ + long FS_cluster; /* cluster number (dummy value!) */ + + char *FS_file_name; /* file to transfer to or from */ + long FS_from; /* part of file to start transfering */ + long FS_size; /* size of file segment transfer */ + + int FS_operation; /* what to do with the frame */ +#define FSop_frame 'f' +#define FSop_list 'l' +#define FSop_number 'n' +#define FSop_update 'u' +#define FSop_extract 'x' +#define FSop_delete 'd' + + int FS_update_state; /* when adding a frame, conflict resolution */ +#define FSupd_added 'a' /* new frame added, no conflict */ +#define FSupd_replaced 'r' /* update: replaced old frame */ +#define FSupd_renamed 'n' /* update: renamed new frame automatically */ +#define FSupd_prompted 'p' /* update: prompted new frame's name */ +#define FSupd_ignored 'i' /* update: ignored new frame */ +/* The same flags in uppercase indicate that the update was performed */ +/* after prompting the user. */ +} ; + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +#define _HYX_CLUSTER_CONTROL_DEFINED +struct HYX_CLUSTER_CONTROL +{ + char *HCC_fnm_hyx; + char *HCC_fnm_idx; + char *HCC_fnm_lut; + char *HCC_fnm_xfn; + char *HCC_fnm_kill_by_id; + char *HCC_fnm_kill_by_lx; + + struct YTREE *HCC_ytree; + long HCC_next_index; + int HCC_dictadd1_inited; + int HCC_dict_mode; + int HCC_mode_frame_name; + int HCC_lut_mode; +#define HCC_lm_full_write 0 /* write complete LUT file */ +#define HCC_lm_incremental 1 /* only add new frames to XFN file */ + + int HCC_open_mode; +#define HCC_om_error -1 /* cluster is not usable! */ +#define HCC_om_closed 0 /* cluster was not opened sofar */ +#define HCC_om_read 1 /* cluster was opened for reading only */ +#define HCC_om_update 2 /* cluster was opened to perform updates */ + + FILE *HCC_f_hyx; /* opened hyx file */ + FILE *HCC_f_idx; /* opened idx file */ + FILE *HCC_f_lut; /* opened lut file */ + FILE *HCC_f_xfn; /* opened xfn file */ + + /* read cache */ + int read_wall; /* max. number of elements to be cached */ + int read_cnt; /* number of elements cached */ + struct YTREE *read_cache; + + /* write cache */ + int write_wall; /* max. number of elements to be cached */ + int write_cnt; /* number of elements cached */ + struct YTREE *write_cache; +} ; +typedef struct HYX_CLUSTER_CONTROL HYX_CLUSTER_CONTROL; +#endif /* _FILE_DEFINED */ + +/* ------------------------------------------------------------------------ */ +struct HYX_OBJECT_COUNTER /* tag or entity counter */ +{ + struct HYX_OBJECT_COUNTER *HOC_next; + long HOC_cnt1; /* subtotal counter */ + long HOC_cnt1b; /* . of entities within a tag */ + long HOC_cnt2; /* overall total counter */ + long HOC_cnt2b; /* . of entities within a tag */ + char *HOC_str; /* tag or entity name */ +} ; + +/* ------------------------------------------------------------------------ */ +/* scan modes: */ +#define HYXSM_hide_earlier 0x0001 +#define HYXSM_hide_purged 0x0002 +#define HYXSM_no_attributes 0x0010 +#define HYXSM_no_allocation 0x0100 + +/* extract flags: */ +#define HYXEF_write_frame_number 0x0001 +#define HYXEF_append_eoln 0x0002 +#define HYXEF_write_frame_name 0x0004 +#define HYXEF_add_dot 0x0008 + +/* macros: ---------------------------------------------------------------- */ +#define hyx_new_cluster_control() \ + ((struct HYX_CLUSTER_CONTROL *) \ + calloc (sizeof (struct HYX_CLUSTER_CONTROL), 1)) + +#define hyx_new_file_segment() \ + ((struct FILE_SEGMENT *) calloc (sizeof (struct FILE_SEGMENT), 1)) + +/* prototypes for hytxt modules: ------------------------------------------ */ +/* hytxt001.c */ int cdecl hytxt_scan (char *fname, struct HYTXT_FRAME **fl, + int scan_mode); +#ifdef _FILE_DEFINED +/* hytxt002.c */ int cdecl hytxt_scan_entry (FILE *fi, long *fi_pos, + struct HYTXT_FRAME *fd, int scan_mode, char *md5_cks); +#endif /* _FILE_DEFINED */ + +/* hytxt003.c */ int cdecl hytxt_purge (char *hypertext_file, + char *purge_file,char *temp_file); +/* hytxt003.c */ int cdecl hytxt_purge_seperator (char *seperator, + int seperator_size); +/* hytxt004.c */ int cdecl hytxt_sort (struct HYTXT_FRAME **liste, + int sort_mode); +/* hytxt005.c */ void cdecl free_HYTXT_FRAME (struct HYTXT_FRAME *fd); +/* hytxt006.c */ void cdecl hytxt_hide_earlier (struct HYTXT_FRAME **fl); +#ifdef __GG_fnames__ +/* hytxt007.c */ int cdecl hytxt_frame2dta2 (struct HYTXT_FRAME *fr, + struct dta2_buff **d2); +#endif +#ifdef _FILE_DEFINED +/* hytxt008.c */ int cdecl hytxt_report_frame (FILE *fo, char *txt, + struct HYTXT_FRAME *fd, int ret_val); +#endif /* _FILE_DEFINED */ + +/* prototypes for *NEW* hytxt modules: ------------------------------------ */ +/* hytxt009.c */ int cdecl hyx_purge2 (char *fni, char *fni_tmp, + char *fnh, char *fnh_tmp, int verbose_level); +#ifdef _FILE_DEFINED +/* hytxt010.c */ int cdecl hyx_sequencer (FILE *fo, char *fnm_hyx, + char *fnm_idx, char *fnm_lut, char *fnm_xfn, + struct FILE_SEGMENT *fseg, int verbose_mode, + int extract_flags); +/* hytxt011.c */ long cdecl find_frame_lut (FILE *lut, char *fr_name); +/* hytxt012.c */ long cdecl find_frame_xfn (FILE *lut, char *fr_name); +/* hytxt013.c */ int cdecl deref_index (FILE *fidx, long idx, long *p1, + long *p2, long *p3); +/* hytxt014.c */ long cdecl hyx_write_stamp (FILE *fo, char *sig); +/* hytxt015.c */ int cdecl sgml_write_data (FILE *fo, char *open_tag, + char *close_tag, char *buffer, int buffer_size); +/* hytxt016.c */ int cdecl hyx_extract (FILE *fo, FILE *fi_hyx, FILE *fi_idx, + FILE *fi_lut, FILE *fi_xfn, char *frame_name, + int verbose_mode, int extract_flags); +#endif /* _FILE_DEFINED */ +/* hytxt017.c */ long cdecl hyx_get_last_index (char *fnm); +#ifdef _FILE_DEFINED +/* hytxt018.c */ long cdecl hyx_get_random_index (FILE *fi_idx); +#endif /* _FILE_DEFINED */ +/* hytxt019.c */ int cdecl hyx_update (char *fn_hyx, char *fn_idx, + char *fn_lut, char *fn_xfn, + struct FILE_SEGMENT *segment, int verbose_mode); +/* hytxt020.c */ struct FILE_SEGMENT *hyx_make_segment ( + struct FILE_SEGMENT **fs_app, char *fn, char *frame_name, + long *index_number, int operation, + long fs_from, long fs_size); +/* hytxt021.c */ int cdecl hyx_destroy_segments (struct FILE_SEGMENT *fs); +#ifdef _FILE_DEFINED +/* hytxt022.c */ long cdecl hyx_get_index (FILE *fi_idx, FILE *fi_lut, + FILE *fi_xfn, char *frame_name); +/* hytxt023.c */ int cdecl hytxt_scan_file (FILE *fo, char *fn); +/* hytxt024.c */ int cdecl hyx_seq (FILE *fo, char *fnm_hyx, + struct FILE_SEGMENT *fs_list, int verbose_level, + int extract_flags); +#endif /* _FILE_DEFINED */ +/* hytxt025.c */ int cdecl hyx_purge (char *hyx_in, int verbose_level); +#ifdef _FILE_DEFINED +/* hytxt026.c */ long cdecl hyx_seek_by_name (FILE *fi_hyx, FILE *fi_idx, + FILE *fi_lut, FILE *fi_xfn, char *frame_name); +/* hytxt027.c */ int cdecl hyx_print_segment (FILE *fo, + struct FILE_SEGMENT *fseg); +/* hytxt028.c */ int cdecl hyx_setup_segment ( + struct FILE_SEGMENT **app_segments, + struct FILE_SEGMENT **fs_new, + char *x_line, long *index_number); + +/* hytxt029.c */ int cdecl hyx_thr ( + FILE *fo, char *fnm_hyx, + struct FILE_SEGMENT *fs_list, int verbose_level, + int extract_flags, char *wanted_thread); +/* hytxt030.c */ int cdecl hyx_threader ( + FILE *fo, char *fnm_hyx, + char *fnm_idx, char *fnm_lut, char *fnm_xfn, + struct FILE_SEGMENT *fseg, int verbose_mode, + int extract_flags, char *wanted_thread); +/* hytxt031.c */ int cdecl hyx_thr_extract ( + FILE *fo, FILE *fi_hyx, + FILE *fi_idx, FILE *fi_lut, FILE *fi_xfn, + char *frame_name, int verbose_mode, int extract_flags, + char *wanted_thread); +#ifdef __GG_parse__ +/* hytxt032.c */ void cdecl hyx_thr_process ( + FILE *fo, FILE *fi_hyx, + FILE *fi_idx, FILE *fi_lut, FILE *fi_xfn, + int verbose_mode, int extract_flags, + char *wanted_thread, + struct TEXT_ELEMENT *t, int verbosity, + int append_eoln); +#endif /* __GG_parse__ */ +#endif /* _FILE_DEFINED */ + +/* hytxt033.c */ int cdecl hyx_update_index (char *index_file, + long li_begin, long li_end, long li_cluster_number, + long *frame_index, long *next_index); + +#ifdef _FILE_DEFINED +/* hytxt034.c */ int cdecl hyx_setup_delete_segment ( + struct FILE_SEGMENT **app_segments, + struct FILE_SEGMENT **fs_new, + char *frame_name, long *index_number); +/* hytxt035.c */ long hyx_seek_by_index (FILE *fi_hyx, FILE *fi_idx,long idx); +#endif /* _FILE_DEFINED */ +/* hytxt036.c */ int hyx_setup_stdin_segment ( + struct FILE_SEGMENT **app_segments, + struct FILE_SEGMENT **fs_new, + char *frame_name, long *index_number); + +#ifdef _FILE_DEFINED +/* hytxt037.c */ int hyx_dump_frame_list (FILE *fi_lut, FILE *fi_xfn); +/* hytxt038.c */ /** DONT USE **/ + long find_frame_lut_or_xfn (FILE *lut, FILE *xfn, + char *fr_name); +#endif /* _FILE_DEFINED */ + +/* prototypes for application modules: hyxidx01.c ------------------------- */ +int cdecl hyx_index (char *fn, char *idx_frame, char *md5_frame, + int idx_format, int flags, int verbose_mode); +int cdecl hyx_index_insert (char *frame_name, long idx, void *client_data); +int cdecl sort_frame (char *fn, long idx, long siz, char *md5); +#ifdef _FILE_DEFINED +int cdecl hyx_index_dump_frame (FILE *fo, char *idx_frame, int idx_format); +#endif /* _FILE_DEFINED */ +int cdecl hyx_index_full_scan (int verbose_mode); +int cdecl hyx_index_rescan (void); + +#define HYXIDX_FMT_NORMAL 0 +#define HYXIDX_FMT_LINK 1 +#define HYXIDX_FMT_DOCDIR 2 +#define HYXIDX_FMT_MD5 3 + +#define HYXIDX_REC_SIZE 12 + +#define HYXIDX_FLAG_default 0x0000 +#define HYXIDX_FLAG_full_scan 0x0001 + +/* ------------------------------------------------------------------------ */ +/* hyxadd01.c */ int cdecl hyx_add (char *fn_hyx, + struct FILE_SEGMENT *segments, int verbose_mode); + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +/* sf01.c */ int cdecl hytxt_filter (FILE *fi, FILE *fo, + long transfer_length, + int translit_entities); +/* sf02.c */ long cdecl hytxt_hyx2html (FILE *fo, char *bu); + int cdecl hyx_print_relational_links (FILE *fo); +#endif /* _FILE_DEFINED */ + +/* sf03.c */ int cdecl frame_name2url (char *frame, char *url, int max_url); +/* sf04.c */ int cdecl url2frame_name (char *url, char *frame, int max_frame); + +/* ------------------------------------------------------------------------ */ +#define TAGo_Frame 101 +#define TAGc_Frame 102 +#define TAGso_Frame 103 +#define TAGsc_Frame 104 + +/* chksgml ---------------------------------------------------------------- */ +#define CHKSGML_Fign_case 0x0001 + +#ifdef _FILE_DEFINED +/* chksgml1.c */ int cdecl hoc_print_counter (FILE *fo, + struct HYX_OBJECT_COUNTER *x,int what); +/* chksgml2.c */ int cdecl chksgml_file (FILE *fo, FILE *fo_report, char *fn, + int verbose_level, long byte_offset, long byte_count, + int flags); + +/* chksgml3.c */ int chksgml_stream (FILE *fo, FILE *fo_report, FILE *fi, + char *fn, + int verbose_level, long byte_offset, long byte_count, + int flags); + int cdecl chksgml_print_total_counter (FILE *fo); +#endif /* _FILE_DEFINED */ + +/* chksgml4.c */ int cdecl analyze_tag (char *tag, int *tag_code, + struct HYX_OBJECT_COUNTER **x_app, int *frame_state); +/* chksgml5.c */ int cdecl analyze_entity (char *entity, int what, + struct HYX_OBJECT_COUNTER **x_app); +/* chksgml6.c */ int cdecl hoc_reset_counter ( + struct HYX_OBJECT_COUNTER *x_app); + +#ifdef _HYX_CLUSTER_CONTROL_DEFINED +/* hyxl0005.c */ int cdecl hcc_set_cluster_name ( + struct HYX_CLUSTER_CONTROL *hcc, char *fnm_hyx); +#endif /* _HYX_CLUSTER_CONTROL_DEFINED */ + +#ifdef _FILE_DEFINED +/* hyxl0006.c */ int cdecl print_hyx_link (FILE *fo, char *destination_frame, + char *destination_cluster, char *destination_file, + char *color, char *text); +#endif /* _FILE_DEFINED */ + +#ifdef _HYX_CLUSTER_CONTROL_DEFINED +/* hyxl0007.c */ int cdecl hcc_destroy (struct HYX_CLUSTER_CONTROL *hcc); +#endif /* _HYX_CLUSTER_CONTROL_DEFINED */ +/* hyxl0008.c */ char *cdecl hyx_make_stop_tag (const char *s); +/* hyxl0009.c */ char *cdecl hyx_translate_special_frame (const char *s); + +#ifdef _HYX_CLUSTER_CONTROL_DEFINED +/* hyxl0010.c */ int cdecl hcc_open (struct HYX_CLUSTER_CONTROL *hcc, + int mode); +/* hyxl0011.c */ long hcc_update_index (struct HYX_CLUSTER_CONTROL *hcc, + YTREE_PROCESSOR *lut_processor, + YTREE_PROCESSOR *xfn_processor); +/* hyxl0012.c */ long hcc_seek_by_name (struct HYX_CLUSTER_CONTROL *hcc, + char *frame_name); +/* hyxl0013.c */ HYX_CLUSTER_CONTROL *new_HYX_CLUSTER_CONTROL (char *fnm_hyx); +#endif /* _HYX_CLUSTER_CONTROL_DEFINED */ + +#define hcc_close(x) hcc_open((x), HCC_om_closed); + +#endif /* __GG_hytxt__ */ diff --git a/lib/include/gg/hyx.h b/lib/include/gg/hyx.h new file mode 100644 index 0000000000000000000000000000000000000000..0b64095a27c088bdffc70aa597f579fb48766484 --- /dev/null +++ b/lib/include/gg/hyx.h @@ -0,0 +1,61 @@ +/* + * include FILE <gg/hyx.h> + * + * HYX structure manipulation + * + * written: 1993-03-07 + * latest update: 1997-06-16 11:00:53 + * $Id: hyx.h,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifndef __GG_hyx__ +#define __GG_hyx__ + +#include <gg/floskel.h> + +/* ------------------------------------------------------------------------ */ +struct SGML_ATTRIBUTE +{ + struct SGML_ATTRIBUTE *next; + int type; /* see note: SAt_* */ +#define SAt_undef 0 +#define SAt_NED 1 /* like Frame names */ +#define SAt_normal 2 +/* Note: more types as specified in the SGML ref */ + int flags; /* bitfield: SAf_* */ +#define SAf_name_malloced 0x01 +#define SAf_value_malloced 0x02 +#define SAf_value_squoted 0x10 +#define SAf_value_dquoted 0x20 +#define SAf_value_escaped 0x40 + char *name; + char *value; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_TAG2 +{ + int type; /* STt_* */ + char *tag_name; + void *tag_def; + struct TAG_ATTRIUBTE *list; + struct TAG_ATTRIUBTE **app; +} ; + +/* prototypes for library functions of %usr/ds/hyx: ----------------------- */ +/* 0001 */ char *cdecl find_attr_name (char *str, char *name); +/* 0002 */ int cdecl get_attr_value (char *src, char *dst, int dst_lng, + int flags); +/* 0003 */ int cdecl find_attr_value (char *src, char *dst, int dst_size, + char *name); + +/* 0004 */ long hyx_identify_color_code (unsigned char *s); + long hyx_set_color_code (unsigned char *name, long value); +#define identify_colour_code(colour_value) \ + ((int) hyx_identify_color_code((unsigned char *) colour_value)) + +/* 0101 */ int cdecl hyx_rule_calendar (const char *token, + char **res_string, char **res_type, void *client_data); + +#endif /* __GG_hyx__ */ diff --git a/lib/include/gg/hyxd.h b/lib/include/gg/hyxd.h new file mode 100644 index 0000000000000000000000000000000000000000..5b10ce777d35517e758750299e9c6625539af4ce --- /dev/null +++ b/lib/include/gg/hyxd.h @@ -0,0 +1,51 @@ +/* + * include FILE <gg/hyxd.h> + * + * Hypertext daemon + * + * written: 1992 12 08 + * latest update: 1997-09-14 19:13:49 + * + */ + +#ifndef __GG_hyxd__ +#define __GG_hyxd__ + +#include <gg/hytxt.h> +#include <gg/floskel.h> + +#define HYXD_single_transaction 0x01 +#define HYXD_md5_transformation 0x02 +#define HYXD_ticket_required 0x04 +#define HYXD_lexicon_server 0x08 +#define HYXD_verbose 0x10 +#define HYXD_preformatted 0x20 + +#define HYXD_LINE_SIZE 1024 +/* structures: ------------------------------------------------------------ */ +struct HYXD_THREAD +{ + FILE *fi; /* input file stream */ + FILE *fo; /* output file stream */ + char line [HYXD_LINE_SIZE]; /* line buffer */ + char line2 [HYXD_LINE_SIZE]; /* line buffer */ + struct HYX_CLUSTER_CONTROL *hcc; + int hcc_defined; +} ; + +/* macros: ---------------------------------------------------------------- */ +#define hyx_d_new_thread() \ + ((struct HYXD_THREAD *) calloc (sizeof (struct HYXD_THREAD), 1)) + +/* prototypes: ------------------------------------------------------------ */ +/* hyxd01.c */ int cdecl hyx_d_daemon (FILE *fi, FILE *fo, + char *cluster, char *credential_file); +/* hyxd02.c */ int cdecl hyx_d_extract (FILE *fo, char *cluster, char *frame, + char *default_path, int mode); +/* hyxd03.c */ int cdecl hyx_d_command (struct HYXD_THREAD *thr, char *line); +/* hyxd03.c */ int cdecl hyx_d_set_cluster (char *cl); +/* hyxd04.c */ int cdecl http4hyx_command (FILE *fo, char *line, int mode); +/* hyxd04.c */ int cdecl http4hyx_set_path (char *pfx); +/* hyxd05.c */ int cdecl http4hyx_daemon (FILE *fi, FILE *fo, int mode); + +#endif /* __GG_hyxd__ */ diff --git a/lib/include/gg/hyxdb.h b/lib/include/gg/hyxdb.h new file mode 100644 index 0000000000000000000000000000000000000000..fdf15fea7fa49d79a0900f1f339e136781a777d3 --- /dev/null +++ b/lib/include/gg/hyxdb.h @@ -0,0 +1,79 @@ +/* + * include FILE <gg/hyxdb.h> + * + * declaration of HYX database structures + * + * written: 1996-01-23 + * latest update: 1997-11-09 11:21:55 + * + */ + +#ifndef __GG_hyxdb__ +#define __GG_hyxdb__ + +#include <gg/floskel.h> +#include <gg/array.h> +#include <gg/ytree.h> +#include <gg/hytxt.h> +#include <gg/dyb.h> + +/* limits: ---------------------------------------------------------------- */ +#define FRAME_NAME_LNG 1024 /* maximum length of a frame name */ +#define HYXDB_BUFFER_SIZE 2048 /* typical size of a HYXDB buffer */ + +/* ------------------------------------------------------------------------ */ +struct HYXDB_CONTROL +{ + struct HYX_CLUSTER_CONTROL *HYXDB_clc; + char *HYXDB_database_control; + long HYXDB_highest_oid; + + struct YTREE *write_cache; + struct YTREE *read_cache; + array_element_destructor *element_destructor; + + int buffer_size; + char *buffer; +} ; + +/* ------------------------------------------------------------------------ */ +struct HYXDB_OBJECT +{ + char *frame_name; + long OID; + + struct YTREE *attr; + array_element_destructor *element_destructor; +} ; + +/* ------------------------------------------------------------------------ */ +struct HYXDB_VALUE +{ + int format; +#define HYXDB_undef 0 +#define HYXDB_string 1 +#define HYXDB_binary 2 +#define HYXDB_dyb 3 + long size; + void *value; +} ; + +/* prototypes: ------------------------------------------------------------ */ +struct HYXDB_CONTROL *hyxdb_new_handle (char *cluster_name, int open_mode); +struct HYXDB_OBJECT *hyxdb_new_object (struct HYXDB_CONTROL *ctrl, + char *frame_name, long id); +long hyxdb_insert_attribute (struct HYXDB_OBJECT *obj, char *attr_name, + void *attr_value, int insert_mode); +#define HYXDB_insert 0 +#define HYXDB_update 1 +#define HYXDB_replace 2 + +struct ARRAY_CONTROL *hyxdb_get_attribute_values (struct HYXDB_OBJECT *obj, + char *attr_name); +struct HYXDB_OBJECT *hyxdb_load_object_frame (struct HYXDB_CONTROL *ctrl, + char *frame_name); +struct HYXDB_OBJECT *hyxdb_parse_stream (struct HYXDB_CONTROL *ctrl, + FILE *fi, long size, char *frame_name); +struct HYXDB_VALUE *hyxdb_new_value (int format, void *value, long size); + +#endif /* __GG_hyxdb__ */ diff --git a/lib/include/gg/ioa.h b/lib/include/gg/ioa.h new file mode 100644 index 0000000000000000000000000000000000000000..11d260c67e034272eae672663cbff921dd4fbf78 --- /dev/null +++ b/lib/include/gg/ioa.h @@ -0,0 +1,20 @@ +/* + * include FILE <gg/ioa.h> + * + * IOA: + * + * written: 1993-02-10 + * latest update: 1994-11-05 + * + */ + +#ifndef __GG_ioa__ +#define __GG_ioa__ + +/* ------------------------------------------------------------------------ */ +/* ioa001.c */ int find_info (char *buffer, char *attr_n[], char *attr_v[], + int n_attr); +/* ioa002.c */ int analyze_fields (char *line, int delimiter, char *items[], + int max_items); + +#endif /* __GG_ioa__ */ diff --git a/lib/include/gg/irdb.h b/lib/include/gg/irdb.h new file mode 100644 index 0000000000000000000000000000000000000000..9b603fc43bd58cba75a0f0e53e7226effaaedca0 --- /dev/null +++ b/lib/include/gg/irdb.h @@ -0,0 +1,167 @@ +/* + * include FILE <gg/irdb.h> + * + * irrelational database + * - prototypes + * + * written: 1996-04-05 + * latest update: 1996-11-26 17:46:46 + * + */ + +#ifndef __GG_irdb__ +#define __GG_irdb__ + +/* ------------------------------------------------------------------------ */ +#include <stdio.h> +#include <gg/ytree.h> +#include <gg/floskel.h> + +#define DEBUG0 +/* #define IRDB_USE_CLASS_NAME ... used for what ??? */ + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +struct IRDB_DUMP +{ + long type; + FILE *fo; + int indent; +} ; +#endif /* _FILE_DEFINED */ + +/* ------------------------------------------------------------------------ */ +struct IRDB_HANDLE +{ + long IRDB_type; /* IRDBty_* */ + + long IRDB_payload_size; /* in bytes */ + long IRDB_payload; /* pointer or offset in bytes */ + long IRDB_payload_type; /* for array and struct IRDBty_* */ + +#ifdef IRDB_USE_CLASS_NAME + char *IRDB_class_name; +#endif /* IRDB_USE_CLASS_NAME */ +} ; + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +struct IRDB_POS /* Persistant Objest Store */ +{ + struct IRDB_HANDLE *IRDB_handle; + char *IRDB_file_name; + FILE *IRDB_file; + int IRDB_open_mode; /* see IRDBom_* */ + int IRDB_is_new; +} ; +#endif /* _FILE_DEFINED */ + +/* IRDBty_*: -------------------------------------------------------------- */ +#define IRDBty_int 1 +#define IRDBty_float 2 +#define IRDBty_string 3 +#define IRDBty_string_dumped 4 /* string dumped to file */ +#define IRDBty_struct 5 +#define IRDBty_struct_dumped 6 /* structure dumped to file */ +#define IRDBty_array 7 +#define IRDBty_array_dumped 8 /* array dumped to file */ +#define IRDBty_block 9 +#define IRDBty_block_dumped 10 + +/* IRDBom_*: -------------------------------------------------------------- */ +#define IRDBom_closed 1 +#define IRDBom_read 2 +#define IRDBom_write 3 +#define IRDBom_overwrite 4 + +/* prototypes: ------------------------------------------------------------ */ +/* 0001 */ long irdb_dump_to_file (char *filename, + struct IRDB_HANDLE *handle); + +#ifdef _FILE_DEFINED +/* 0002 */ long irdb_dump_to_stream (FILE *fo, struct IRDB_HANDLE *handle); +/* 0003 */ long irdb_dump_payload (FILE *fo, struct IRDB_HANDLE *handle); +/* 0004 */ long irdb_dump_string (FILE *fo, char *s); +#endif /* _FILE_DEFINED */ + +#ifdef _YTREE_DEFINED +/* 0005 */ int irdb_dump_struct (struct YTREE *yt, char *str, void *cd); +#endif /* _YTREE_DEFINED */ + +#ifdef _FILE_DEFINED +/* 0006 */ long irdb_commit (struct IRDB_POS *pos); +#endif /* _FILE_DEFINED */ + +/* 0007 */ long irdb_dumped_form (long type); +/* 0008 */ long irdb_core_form (long type); +/* 0009 */ struct IRDB_POS *irdb_new_pos (char *fnm, char *cln, int is_new); +/* 0010 */ struct IRDB_HANDLE *irdb_new_handle (long ty, char *cln); +/* 0011 */ struct IRDB_HANDLE *irdb_new_struct_handle (char *cln, + long payload_type); +/* 0012 */ int irdb_store_to_struct (struct IRDB_HANDLE *hnd, + char *slot, long value); +/* 0013 */ int irdb_strdup_to_struct (struct IRDB_HANDLE *hnd, + char *slot, char *value); + +#ifdef _FILE_DEFINED +/* 0014 */ long *irdb_locate_info (struct IRDB_POS *pos, + char *slots[], int slot_cnt, int create, long ty); +/* 0015 */ int irdb_exists (struct IRDB_POS *pos, + char *slots[], int slot_cnt); +/* 0016 */ int irdb_replace_string (struct IRDB_POS *pos, + char *slots[], int slot_cnt, char *value); +/* 0017 */ struct IRDB_HANDLE *irdb_locate_handle (struct IRDB_POS *pos, + char *slots[], int slot_cnt, int create, long ty); +/* 0018 */ long irdb_set_long (struct IRDB_POS *pos, + char *slots[], int slot_cnt, long value); +/* 0019 */ long irdb_post_increment_long (struct IRDB_POS *pos, + char *slots[], int slot_cnt, long value); +/* 0020 */ long irdb_pre_increment_long (struct IRDB_POS *pos, + char *slots[], int slot_cnt, long value); +#endif /* _FILE_DEFINED */ + +/* 0021 */ long irdb_fixup_pos_header (char *filename, + struct IRDB_HANDLE *handle); +/* 0022 */ struct IRDB_HANDLE *irdb_load_handle (FILE *fi); +/* 0023 */ char *irdb_load_string (FILE *fi, char *buffer, int bsize); + +#ifdef _FILE_DEFINED +/* 0024 */ FILE *irdb_get_pos_file_pointer (struct IRDB_POS *pos, + int open_mode); +/* 0025 */ int irdb_restore (struct IRDB_POS *pos, struct IRDB_HANDLE *hnd); +#endif /* _FILE_DEFINED */ + +/* 0026 */ int irdb_restore_handle (struct YTREE *yt_node, void *client_data); +/* 0027 */ int irdb_restore_strings (struct YTREE *yt_node, + void *client_data); + +#ifdef _FILE_DEFINED +/* 0028 */ long irdb_get_increment_long (struct IRDB_POS *pos, + char *slots[], int slot_cnt); +/* 0101 */ long irdb_diag (FILE *fo, struct IRDB_HANDLE *handle); +/* 0102 */ long irdb_diag_to_stream (FILE *fo, struct IRDB_HANDLE *handle, + int indent); +/* 0103 */ long irdb_diag_payload (FILE *fo, struct IRDB_HANDLE *handle, + int indent); +/* 0104 */ long irdb_diag_string (FILE *fo, char *s); +/* 0105 */ int irdb_diag_struct (struct YTREE *yt, char *str, void *cd); +/* 0107 */ long irdb_dbg_show_slot_names (FILE *fo, char *slots[], + int slot_cnt); +#endif /* _FILE_DEFINED */ +/* 0106 */ char *irdb_type (long type); + +/* 0112 */ int irdb_dbg_store_to_struct (struct IRDB_HANDLE *hnd, + char *slot, long value); + +#ifdef _FILE_DEFINED +/* 0116 */ int irdb_dbg_replace_string (struct IRDB_POS *pos, + char *slots[], int slot_cnt, char *value); +/* 0118 */ long irdb_dbg_set_long (struct IRDB_POS *pos, + char *slots[], int slot_cnt, long value); +/* 0119 */ long irdb_dbg_post_increment_long (struct IRDB_POS *pos, + char *slots[], int slot_cnt, long value); +/* 0120 */ long irdb_dbg_pre_increment_long (struct IRDB_POS *pos, + char *slots[], int slot_cnt, long value); +#endif /* _FILE_DEFINED */ + +#endif /* __GG_irdb__ */ diff --git a/lib/include/gg/keys.h b/lib/include/gg/keys.h new file mode 100644 index 0000000000000000000000000000000000000000..885989e6dffb4b468c6c2f30f6c8d30b1a5ee1e1 --- /dev/null +++ b/lib/include/gg/keys.h @@ -0,0 +1,172 @@ +/* + * include FILE <gg/keys.h> + * + * Tastencodes (lt. kbin) fuer PC-Funktionstasten + * + * written: 1986-07-20 + * latest update: 1995-12-16 + * + */ + +#ifndef __GG_keys__ +#define __GG_keys__ + +#include <gg/floskel.h> + +#define K_CUP 0x0148 /* Cursorblock */ +#define K_CDOWN 0x0150 +#define K_CLEFT 0x014B +#define K_CRIGHT 0x014D +#define K_DEL 0x0153 +#define K_INS 0x0152 +#define K_END 0x014F +#define K_HOME 0x0147 +#define K_PGUP 0x0149 +#define K_PGDN 0x0151 + +#define K_CTRLPRTSCR 0x0172 +#define K_CTRLLEFT 0x0173 +#define K_CTRLRIGHT 0x0174 +#define K_CTRLEND 0x0175 +#define K_CTRLHOME 0x0177 +#define K_CPGDN 0x0176 /* Ctrl-PGDN */ +#define K_CTRLPGDN 0x0176 +#define K_CPGUP 0x0184 /* Ctrl-PGUP */ +#define K_CTRLPGUP 0x0184 + +#define K_PF1 0x013B /* Funktions Tasten */ +#define K_PF2 0x013C +#define K_PF3 0x013D +#define K_PF4 0x013E +#define K_PF5 0x013F +#define K_PF6 0x0140 +#define K_PF7 0x0141 +#define K_PF8 0x0142 +#define K_PF9 0x0143 +#define K_PF10 0x0144 +#define K_SPF1 0x0154 /* Shift-PF1 */ +#define K_SPF2 0x0155 +#define K_SPF3 0x0156 +#define K_SPF4 0x0157 +#define K_SPF5 0x0158 +#define K_SPF6 0x0159 +#define K_SPF7 0x015A +#define K_SPF8 0x015B +#define K_SPF9 0x015C +#define K_SPF10 0x015D +#define K_CPF1 0x015E /* Ctrl-PF1 */ +#define K_CPF2 0x015F +#define K_CPF3 0x0160 +#define K_CPF4 0x0161 +#define K_CPF5 0x0162 +#define K_CPF6 0x0163 +#define K_CPF7 0x0164 +#define K_CPF8 0x0165 +#define K_CPF9 0x0166 +#define K_CPF10 0x0167 +#define K_APF1 0x0168 /* Alt-PF1 */ +#define K_APF2 0x0169 +#define K_APF3 0x016A +#define K_APF4 0x016B +#define K_APF5 0x016C +#define K_APF6 0x016D +#define K_APF7 0x016E +#define K_APF8 0x016F +#define K_APF9 0x0170 +#define K_APF10 0x0171 + +#define K_PF11 0x0185 /* Extended Funktion Keys */ +#define K_PF12 0x0186 +#define K_SPF11 0x0187 +#define K_SPF12 0x0188 +#define K_CPF11 0x0189 +#define K_CPF12 0x018A +#define K_APF11 0x018B +#define K_APF12 0x018C + +#define K_ALT_A 0x011E +#define K_ALT_B 0x0130 +#define K_ALT_C 0x012E +#define K_ALT_D 0x0120 +#define K_ALT_E 0x0112 +#define K_ALT_F 0x0121 +#define K_ALT_G 0x0122 +#define K_ALT_H 0x0123 +#define K_ALT_I 0x0117 +#define K_ALT_J 0x0124 +#define K_ALT_K 0x0125 +#define K_ALT_L 0x0126 +#define K_ALT_M 0x0132 +#define K_ALT_N 0x0131 +#define K_ALT_O 0x0118 +#define K_ALT_P 0x0119 +#define K_ALT_Q 0x0110 +#define K_ALT_R 0x0113 +#define K_ALT_S 0x011F +#define K_ALT_T 0x0114 +#define K_ALT_U 0x0116 +#define K_ALT_V 0x012F +#define K_ALT_W 0x0111 +#define K_ALT_X 0x012D +#define K_ALT_Y 0x0115 +#define K_ALT_Z 0x012C +#define K_ALT_1 0x0178 +#define K_ALT_2 0x0179 +#define K_ALT_3 0x017A +#define K_ALT_4 0x017B +#define K_ALT_5 0x017C +#define K_ALT_6 0x017D +#define K_ALT_7 0x017E +#define K_ALT_8 0x017F +#define K_ALT_9 0x0180 +#define K_ALT_0 0x0181 +#define K_ALT_MINUS 0x0182 +#define K_ALT_GLEICH 0x0183 + +#define K_ALT_CDOWN 0x01A0 /* ALT + Cursor Down */ +#define K_ALT_CUP 0x0198 +#define K_ALT_CLEFT 0x019B +#define K_ALT_CRIGHT 0x019D + +#define K_CTRL_CUP 0x018D /* Ctrl + Cursor Down */ +#define K_CTRL_CDOWN 0x0191 +#define K_CTRL_CLEFT 0x0173 +#define K_CTRL_CRIGHT 0x0174 + +/* Tastencodes fuer Shift Keys (Funktion kbshift) ------------------------- */ +#define K_SHIFT_LEFT 0x0001 +#define K_SHIFT_RIGHT 0x0002 +#define K_SHIFT 0x0003 +#define K_CTRL 0x0004 +#define K_ALT 0x0008 +#define K_SCROLL_LOCK 0x0010 /* Scroll Lock aktiviert */ +#define K_NUM_LOCK 0x0020 /* Num Lock aktiviert */ +#define K_CAPS_LOCK 0x0040 /* Caps Lock aktiviert */ +#define K_CTRL_LEFT 0x0100 +#define K_ALT_LEFT 0x0200 +#define K_CTRL_RIGHT 0x0400 +#define K_ALT_RIGHT 0x0800 +#define K_H_SCROLL_LOCK 0x1000 /* Scroll Lock Key gerade gedrueckt */ +#define K_H_NUM_LOCK 0x2000 /* Num Lock Key gerade gedrueckt */ +#define K_H_CAPS_LOCK 0x4000 /* Caps Lock Key gerade gedrueckt */ + +/* Function Prototypes KEYBOARD.ARC --------------------------------------- */ +int cdecl kbin (void); +void cdecl kbin_set_AT (void); +int cdecl kbhit (void); +void cdecl kbhit_set_AT (void); +int cdecl kbshift (void); +void cdecl kbclick (int); +int cdecl kbqueue (int key); +int cdecl kbtype (void); +void cdecl kbnumoff (void); +void cdecl kbnumon (void); +void cdecl kbmfon (void); + +/* Modul c:/usr/sbr/identkey.c -------------------------------------------- */ +unsigned int cdecl identify_key (char *key_name); + +/* Modul c:/usr/sbr/keynames.c -------------------------------------------- */ +char *cdecl key_name (unsigned int kc); /* Key Code */ + +#endif /* __GG_keys__ */ diff --git a/lib/include/gg/lexicon.h b/lib/include/gg/lexicon.h new file mode 100644 index 0000000000000000000000000000000000000000..397c2790e8b98019b4852f8bece464b886a12dbd --- /dev/null +++ b/lib/include/gg/lexicon.h @@ -0,0 +1,110 @@ +/* + * include FILE <gg/lexicon.h> + * + * + * written: 1990 11 13 + * 1991 01 09: Revision + * 1991 03 16: Revision; AIX + * latest update: 1995-06-25 + * + */ + +#ifndef __GG_lexicon__ +#define __GG_lexicon__ + +#include <gg/floskel.h> + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +struct LEXICON_FILE +{ + struct LEXICON_FILE *LEXF_next; + char *LEXF_fnm; /* real filename */ + FILE *LEXF_fp; /* 'cached' file pointer */ + char LEXF_open_mode [6]; /* open mode string */ + long LEXF_p1; /* parameters: used differently */ + long LEXF_p2; + long LEXF_p3; +} ; +#endif /* _FILE_DEFINED */ + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* usage of parameters: */ +/* LUT: */ +/* p1 ... LUT number */ +/* p2 ... size of LUT in byte */ +/* p3 ... 1 -> LUT can still be expanded */ + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +struct LEXICON_DESCRIPTION /* description of files etc. for *one* */ +{ /* lexicon file system */ + char LEX_path [66]; + int LEX_used; /* 1 -> entry used */ + struct LEXICON_FILE *LEX_main_luts; /* lists of the different */ + struct LEXICON_FILE *LEX_clusters; /* files, used for the */ + struct LEXICON_FILE *LEX_index_tables; /* lexicon file system */ +} ; +#endif /* _FILE_DEFINED */ + +/* ------------------------------------------------------------------------ */ +#define LEXICON_INDEX_SIZE 0x00010000L /* indizes per IDX-file */ +#define LEXICON_LUT_SIZE 50000L /* byte per LUT-file */ +#define LEXICON_CLUSTER_SIZE 700000L /* byte per HYX-file */ +/* ... these values are completely arbitrary */ + +/* ------------------------------------------------------------------------ */ +#ifdef MSDOS +#define fopen_APPEND "ab" +#define fopen_READ "rb" +#define fopen_READ_WRITE "a+b" +#define fopen_WRITE "wb" +#else +#define fopen_APPEND "a" +#define fopen_READ "r" +#define fopen_READ_WRITE "a+" +#define fopen_WRITE "w" +#endif + +/* Notes: ----------------------------------------------------------------- */ +/* a) each LEXICON system must reside in it's own directory. */ +/* b) all files in that directory are considered to belong to the */ +/* particular LEXICON system. */ +/* c) the LEXICON system can manipulate all files that belong to it */ +/* in every way, whatever the system decides. */ + +/* DICTADD Setup flags: --------------------------------------------------- */ +#define DASTP_SET_LEXICON_FILE 0x0001 +#define DASTP_GET_LEXICON_FILE 0x1001 +#define DASTP_SET_INDEX_FILE 0x0002 +#define DASTP_GET_INDEX_FILE 0x1002 +#define DASTP_SET_MAIN_LUT_FILE 0x0003 +#define DASTP_GET_MAIN_LUT_FILE 0x1003 +#define DASTP_SET_CLUSTER_NAME 0x0004 + +/* lex00001.c --- *** not used! *** --------------------------------------- */ +struct LEXICON_DESCRIPTION *cdecl LEXICON_get_description (int lexicon_handle); +int cdecl LEXICON_init (int lexicon_handle, char *lexicon_path); +int cdecl LEXICON_get_entry (int lexicon_handle, long frame_index, + char *puffer, long puffer_size); +#ifdef _FILE_DEFINED +int cdecl _LEXICON_get_entry (struct LEXICON_DESCRIPTION *ld, + long frame_index, + char *puffer, long puffer_size, + FILE *fo, int out_mode); +#endif /* _FILE_DEFINED */ +long cdecl get_usable_cluster (struct LEXICON_DESCRIPTION *ld); +int cdecl LEXICON_add_entry (int lexicon_handle, long frame_index, + char *puffer, long siz); +int cdecl _LEXICON_add_entry (struct LEXICON_DESCRIPTION *ld, + long frame_index, char *puffer, long siz); +long cdecl LEXICON_new_entry (int lexicon_handle); +#ifdef _FILE_DEFINED +int cdecl LEXICON_print (FILE *fo); +int cdecl LEXICON_print_entry (FILE *fo, int nr); +#endif /* _FILE_DEFINED */ +int cdecl LEXICON_flush (void); + +/* dict0003.c .. dict0006.c see <gg/parse.h> ------------------------------ */ + +#endif /* __GG_lexicon__ */ diff --git a/lib/include/gg/lexutil.h b/lib/include/gg/lexutil.h new file mode 100644 index 0000000000000000000000000000000000000000..fd80a539a31d38da0c8a84b043be7a6594aae6f4 --- /dev/null +++ b/lib/include/gg/lexutil.h @@ -0,0 +1,22 @@ +/* + * include FILE <gg/lexutil.h> + * + * lexicon utilities + * + * written: 1991 04 27 + * latest update: 1994-07-17 + * + */ + +#ifndef __GG_lexutil__ +#define __GG_lexutil__ + +#ifndef MSDOS +#ifndef cdecl +#define cdecl +#endif +#endif + +int cdecl ISPELL_derive (char *orig, int flag, char *deriv); + +#endif /* __GG_lexutil__ */ diff --git a/lib/include/gg/lmd5.h b/lib/include/gg/lmd5.h new file mode 100644 index 0000000000000000000000000000000000000000..70e98d0200742300c2c62fdc91f7784906da47a8 --- /dev/null +++ b/lib/include/gg/lmd5.h @@ -0,0 +1,43 @@ +/* + * include FILE <gg/lmd5.h> + * + * Contents: + * - structures: LMD5_CONTROL + * - prototypes: + * + * written: 1996-04-14 + * latest update: 1996-04-27 9:06:23 + * + */ + +#ifndef __GG_lmd5__ +#define __GG_lmd5__ + +#include <gg/floskel.h> +#include <gg/irdb.h> + +/* ------------------------------------------------------------------------ */ +struct LMD5_CONTROL +{ + struct IRDB_HANDLE *LMD5_db; + struct IRDB_HANDLE *LMD5_words; + struct IRDB_POS *LMD5_pos; + char *LMD5_word_table [4]; + char *LMD5_docs_table [4]; + char *LMD5_info_table [4]; +} ; + +/* prototypes: ------------------------------------------------------------ */ +/* 0001 */ struct LMD5_CONTROL *lmd5_create_control (char *fnm, int is_new); +/* 0002 */ long lmd5_increment_word_count (struct LMD5_CONTROL *l5, + char *word, char *docid, long cnt); +#ifdef _FILE_DEFINED +/* 0003 */ int lmd5_process_stream (struct LMD5_CONTROL *l5, FILE *fi); +#endif /* _FILE_DEFINED */ +/* 0004 */ long lmd5_increment_document_count (struct LMD5_CONTROL *l5, + char *docid, char *fref_name, long fref_begin, long fref_end, + char *date_string); +/* 0005 */ int lmd5_set_info_attribute_value (struct LMD5_CONTROL *l5, + char *attribute_name, char *attribute_value); + +#endif /* __GG_lmd5__ */ diff --git a/lib/include/gg/lookup.h b/lib/include/gg/lookup.h new file mode 100644 index 0000000000000000000000000000000000000000..c25e5e4917d56d423c87e64e5addaf1d2d81deef --- /dev/null +++ b/lib/include/gg/lookup.h @@ -0,0 +1,603 @@ +/* + * include FILE <gg/lookup.h> + * + * using the Look Up Table (LUT) + * * macro functions + * * prototypes + * + * related information: + * * <gg/ytree.h> + * * <gg/ztree.h> + * * LMD-Engine + * + * written: 1989-05-01 + * 1989 06 11: replaced previous file + * 1991 03 15: revision; AIX + * 1993-02-28: word info and doc info data structures + * latest update: 2000-09-01 12:10:56 + * $Id: lookup.h,v 1.11 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifndef __GG_lookup__ +#define __GG_lookup__ + +#include <gg/floskel.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +#define MAX_LUT_KEY_LENGTH 1024 /* maximum size of LUT entry allowed */ +#define STOP_WORD_LIMIT 1000 /* The first 1000 words are considered */ + /* stop words. */ +#define MAX_WORD_COUNT 1000 /* Number of hits for a word to be */ + /* dropped from document list. */ +#define MIN_WORDLENGTH 3 /* word must be at least (or at most) this */ +#define MAX_WORDLENGTH 24 /* long to be indexed. */ +#define LMD_BUFFER_SIZE 2048 /* various character buffers */ + +/* data structure design features ----------------------------------------- */ +#define MAX_DI_POS 2 +#define LMD_EXTENDED_MODEL + +/* LUT Index Reference ---------------------------------------------------- */ +struct LUT_REFERENCE /*** this data structure is more or less obsolete ***/ +{ + long LR_off_next; /* Offset des naechsten Records zu selben Key */ + long LR_off_prev; /* Offset des vorherigen Records zu selben Key */ + short LR_file_id; /* File ID Schluessel (z.B. als Index in Tabelle) */ + short LR_cnt; /* Zahl der Offset Eintraege in der Offset Tabelle */ + long LR_offset [1]; /* Offset Tabelle; selber Key und selbe File ID */ +} ; + +/* document information --------------------------------------------------- */ +struct DOCUMENT_INFO +{ + long DI_document_id; /* reference code of document */ + long DI_hit_count; /* number of hits of word in that document */ + +#ifdef LMD_EXTENDED_MODEL + long DI_document_ptr; /* pointer into document info table or so */ + long DI_pos [MAX_DI_POS]; /* position(s) of word within document */ +#endif /* LMD_EXTENDED_MODEL */ +} ; + +#define DOCUMENT_INFO_SIZE (sizeof (struct DOCUMENT_INFO)) + +/* NOTE: DI_document_ptr and DI_pos are not really used by the NL_KR */ +/* library. These parameters are simply stored and passed along */ +/* and could be used by an embedding application. */ + +/* document information --------------------------------------------------- */ +struct DOCUMENT_INFO_LIST +{ + struct DOCUMENT_INFO_LIST *DIL_next; + struct DOCUMENT_INFO *DIL; +} ; +typedef struct DOCUMENT_INFO_LIST DIL; + +/* document directory ----------------------------------------------------- */ +struct DOCDIR_LIST +{ + struct DOCDIR_LIST *DL_next; + struct DOCUMENT_INFO *DL_di; + char *DL_name; + char *DL_path; + char *DL_file; + long DL_from; + long DL_to; + long DL_size; + long DL_lfrom; + long DL_lto; + long DL_lines; +} ; + +/* word information ------------------------------------------------------- */ +struct WORD_REF +{ + long WR_count; /* number of references to that entry */ + /* more or less the real word count! */ + + /* only temporarily used during reading and writing !! */ + long WR_docinfo_offset; /* begin of document info block */ + long WR_docinfo_count; /* number of entries in doc info block */ + /* number of documents associated with that */ + /* word; 0 implies almost certainly a */ + /* stop word! */ + + /* pointers to the document descriptor */ + struct YTREE *WR_ytree; /* hash table for doc ids */ + + void *WR_extra; /* additional payload for special apps. */ +} ; + +/* number of bytes actually written to the file for a WORD_REF record */ +#define WORD_REF_SIZE (3*sizeof (long)) + +#define WRlang_english 1 +#define WRlang_german 2 + +#define WRint_null 0x00000000 +#define WRint_evaled 0x00000001 +#define WRint_atomic 0x00000002 +#define WRint_ignore 0x00001000 +#define WRint_logic_and 0x00001001 +#define WRint_logic_or 0x00001002 +#define WRint_logic_not 0x00001003 +#define WRint_logic_but 0x00001004 +#define WRint_ling_and 0x00001101 +#define WRint_ling_or 0x00001102 +#define WRint_ling_not 0x00001103 +#define WRint_ling_but 0x00001104 + +/* word information list -------------------------------------------------- */ +struct WORD_REF_LIST /* datastructure describing any */ +{ /* hit word */ + struct WORD_REF_LIST *WRL_next; /* following word */ + struct WORD_REF WRL; /* description of word */ + char *WRL_string; /* associated string for word ref */ + long WRL_index; /* word index of that word */ + struct DOCUMENT_INFO_LIST *WRL_dil; /* document list for that word */ +} ; +typedef struct WORD_REF_LIST WRL; + +/* NOTE: this structure is only used during a search and not for index */ +/* generation any longer. */ + +/* term evaluation list --------------------------------------------------- */ +struct TERM_EVAL /* evaluation of boolean or */ +{ /* linguistic expressions */ + struct TERM_EVAL *TE_left; /* next term or right hand ... */ + struct TERM_EVAL *TE_right; /* left hand operand */ + long TE_operator; /* WRint_xxx */ + char *TE_string; /* string representation of */ + /* evaluated term */ + struct WORD_REF_LIST *TE_wrl; /* words used in evaluation */ + struct DOCUMENT_INFO_LIST *TE_dil; /* resulting document list */ +} ; + +/* lutmake/deref creation control: ---------------------------------------- */ +struct LMDC_CONTROL +{ + struct YTREE *LMDC_ytree; + + /* information about the latest added item */ + struct WORD_REF *LMDC_act_word_ref; /* word reference structure */ + long LMDC_word_index; /* word reference index (ytree key) */ + + long LMDC_cnt_sw_idx; /* total number of words processed */ + /* in all documents during one run */ + + /* limiting the number of items */ + long LMDC_max_word_count; + long LMDC_stop_word_limit; + long LMDC_max_doc_count; /* max number of documents for word */ + + /* "quality" of each added word */ + int LMDC_min_wordlength; + int LMDC_max_wordlength; + + /* temporary storage and run-time options */ + char *LMDC_buffer1; + char *LMDC_buffer2; + int LMDC_buffer_size; + + int LMDC_verbosity; +} ; + +/* lutmake dump control: -------------------------------------------------- */ +/* NOTE: this structure is used while simultanously dumping the word */ +/* reference and document info structures to seperates files */ + +#ifdef _FILE_DEFINED +#define _LMDD_CONTROL_DEFINED +struct LMDD_CONTROL /* lutmake dump control */ +{ + struct LMDC_CONTROL *LMDD_lmdc; + FILE *LMDD_fo_wr; /* word ref file currently being written */ + FILE *LMDD_fo_di; /* document info file currently written */ + long LMDD_doc_items_offset; /* 0th entry dummy!! */ + long LMDD_doc_items_written; /* number of document entries in word ref */ + /* block written to DI file. */ + long LMDD_items_written; /* CLEANUP: not necessary!!??!! */ + long LMDD_word_index; /* number of item in the WR file */ + + int LMDD_mode; +#define LMDD_mode_full 0 /* dump the complete wr and di structures */ +#define LMDD_mode_partial 1 /* only dump partial di structures */ +} ; +#endif /* _FILE_DEFINED */ + +/* lutmake/deref test control: -------------------------------------------- */ +#ifdef _FILE_DEFINED +#define _LMDT_CONTROL_DEFINED +struct LMDT_CONTROL +{ + char *LMDT_LUT; + FILE *LMDT_LUT_FILE; + FILE *LMDT_TFB_FILE; + + char *LMDT_pfx; + int LMDT_rep2_cnt; + + char LMDT_ext_pattern [MAX_LUT_KEY_LENGTH]; + char LMDT_complete_key [MAX_LUT_KEY_LENGTH]; +} ; +#endif /* _FILE_DEFINED */ + +/* ------------------------------------------------------------------------ */ +struct DEREF_CONTROL +{ + struct DOCUMENT_INFO_LIST *DC_dil; + struct DOCUMENT_INFO_LIST **DC_dil_app; +} ; + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +#define _LMD_QUERY_SET_defined +struct LMD_QUERY_SET +{ + struct LMD_QUERY_SET *LMDQS_next; + struct LMD_QUERY_SET *LMDQS_sub; + + char *LMDQS_fn_lut; + char *LMDQS_fn_wr; + char *LMDQS_fn_di; + + FILE *LMDQS_F_lt; + FILE *LMDQS_F_wr; + FILE *LMDQS_F_di; + + int LMDQS_initialized; + + /* temporary data used during lookup and reference */ + char LMDQS_ext_pattern [MAX_LUT_KEY_LENGTH]; + char LMDQS_found_string [MAX_LUT_KEY_LENGTH]; + struct WORD_REF_LIST **LMDQS__wrl; + int LMDQS__error_flag; + char *LMDQS_pfx; /* prefix of all found words */ + int LMDQS_pfx_lng; +} ; +typedef struct LMD_QUERY_SET LMDQS; +#endif /* _FILE_DEFINED */ + +/* ------------------------------------------------------------------------ */ +#define RM_words 0 +#define RM_fcy 1 +#define RM_tokens 2 +#define RM_veronica 3 +#define RM_stream 4 +#define RM_lfcy 5 +#define RM_tfb 6 +#define RM_hyx_cluster 7 + +/* ------------------------------------------------------------------------ */ +#define lmdt_control_new() \ + ((struct LMDT_CONTROL *) calloc (sizeof (struct LMDT_CONTROL), 1)) + +/* LOOKUP functions ------------------------------------------------------- */ +int cdecl lookup_char (char *lut, const char *w, long *w_info, int *lng); +char *cdecl lut_char_get_word_buffer (void); +char *cdecl lut_char_get_dump_beg (void); +char *cdecl lut_char_get_dump_end (void); + +#ifdef _FILE_DEFINED +int cdecl lookup_file (FILE *lut, const char *w, long *w_info, int *lng); +#endif /* _FILE_DEFINED */ +char *cdecl lut_file_get_word_buffer (void); +long cdecl lut_file_get_dump_beg (void); +long cdecl lut_file_get_dump_end (void); + +#ifdef _FILE_DEFINED +int cdecl lookup_file_xfn (FILE *xfn, const char *w, long *w_info); +#endif /* _FILE_DEFINED */ + +/* int lookup_XXXX (lut, w, w_info, lng) */ +/* XXXX *lut; Look Up Table (File bzw. Array of char) */ +/* char *w; Word */ +/* long *w_info; -> Informationen ueber Word */ +/* int *lng; -> Laenge des gematchten Wortes */ +/* Wichtig bei LOOKUP_prefix */ +/* RETURN: */ + +/* LUT_RETURN_CODES: */ +#define LOOKUP_empty -4 /* ERR: LUT is still empty */ +#define LOOKUP_invalid -3 /* ERR: structure of LUT is unknown */ +#define LOOKUP_error_size -2 /* ERR: LUT is too large */ +#define LOOKUP_error -1 /* ERR: string is invalid, can't be located */ +#define LOOKUP_not_found 0 /* string could not be found */ +#define LOOKUP_found 0x0001 /* w in LUT */ +#define LOOKUP_prefix 0x0002 /* w=uv, u in LUT, w not in LUT */ + /* Der Anfang von w (= die ersten lng Bytes)*/ + /* kann in der LUT gefunden werden. */ +#define LOOKUP_prefix_3 0x0004 /* w not in LUT, u=wv in LUT */ + /* w ist der Anfang EINES Wortes in der LUT */ +#define LOOKUP_prefix_4 0x0008 /* w not in LUT, u=wv in LUT, x=wy in LUT */ + /* w ist der Anfang von ZWEI ODER MEHR */ + /* Worten in der LUT */ + +/* macro functions: ------------------------------------------------------- */ +#define lmd_new_word_ref_list() \ + ((struct WORD_REF_LIST *) calloc (sizeof (struct WORD_REF_LIST), 1)) + +#define lmd_new_word_ref() \ + ((struct WORD_REF *) calloc (sizeof (struct WORD_REF), 1)) + +#define lmd_new_document_info_list() \ + ((struct DOCUMENT_INFO_LIST *) calloc (sizeof (struct DOCUMENT_INFO_LIST),1)) + +#define lmd_new_document_info() \ + ((struct DOCUMENT_INFO *) calloc (sizeof (struct DOCUMENT_INFO),1)) + +#define lmd_new_term_eval() \ + ((struct TERM_EVAL *) calloc (sizeof (struct TERM_EVAL),1)) + +#define lmd_new_query_set() \ + ((struct LMD_QUERY_SET *) calloc (sizeof (struct LMD_QUERY_SET), 1)) + +#define lmd_SW(lmdc,s) lmd_score((lmdc), (s), 1L, 0x0003) +#define lmd_SWT(lmdc,s,add) lmd_score((lmdc), (s), (add), 0x0003) +#define lmd_SWX(lmdc,s,cnt) lmd_score((lmdc), (s), (cnt), 0x0002) + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +/* nl_00001.c */ int cdecl nl_get_str (FILE *fi, char *s); +#endif + +/* nl_00002.c */ int cdecl nl_key_valid (const char *w); + +/* Ausgabe einer LUT in Klarschrift --------------------------------------- */ +#ifdef _FILE_DEFINED +int cdecl lut_print (FILE *fo, char *lut_name, char *fmp, long start); +int cdecl lut_print_block (FILE *fo, FILE *lut, char *format); +#endif /* _FILE_DEFINED */ + +/* NL_00004.C: Ein Token einlesen: ---------------------------------------- */ +#ifdef _FILE_DEFINED +int cdecl nl_get_token ( +FILE *fi, /* Input File */ +char *s, /* gelesenes Token */ +int mode, /* Controlvektor */ +int *push_back, /* zuletzt gelesenes Zeichen */ +long *filepos_beg); /* Beginn des Wortes im File */ +/* Return: Controlvektor ... Das Bit gibt an warum abgebrochen wurde; */ +/* 0 -> EOF */ +#endif /* _FILE_DEFINED */ + +int cdecl lut_process (char *lut_name, + int (*processor) (char *w, long i, void *client_data), + void *client_data, long start); +#ifdef _FILE_DEFINED +int cdecl lut_process_block (FILE *lut, + int (*processor) (char *w, long i, void *client_data), + void *client_data); +#endif /* _FILE_DEFINED */ + +/* lut_0010.c */ int cdecl xfn_process (char *xfn_name, + int (*processor) (char *w, long i, void *client_data), + void *client_data, long start); +#ifdef _FILE_DEFINED +/* lut_0011.c */ int cdecl xfn_process_block (FILE *xfn, + int (*processor) (char *w, long i, void *client_data), + void *client_data); +#endif /* _FILE_DEFINED */ +/* lut_0012.c */ int lut_dump_file (char *fn, int out_mode, long dump_start); +/* lut_0013.c */ int lut_dump_entry (char *wrd, long info, void *client_data); +/* lut_0015.c */ struct YTREE *lut_scan_ytree (char *fn, long start); + int lut_ytree_entry (char *wrd, long info, void *client_data); +#ifdef _FILE_DEFINED + struct YTREE *lut_scan_ytree_file (FILE *lut, long start); +#endif /* _FILE_DEFINED */ +/* prototypes: ------------------------------------------------------------ */ +/* nl_00101.c */ struct DOCUMENT_INFO_LIST *cdecl + lmd_find_document_info_list ( + struct DOCUMENT_INFO_LIST *start, long doc_id); +#ifdef _FILE_DEFINED +/* nl_00102.c */ int cdecl lmd_dump_document_info_list (struct YTREE *yt, + void *client_data); + +/* nl_00104.c */ struct WORD_REF_LIST *cdecl lmd_deref_word ( + struct LMD_QUERY_SET *lmdqs, char *w, int exact); +/* nl_00105.c */ struct WORD_REF_LIST *cdecl lmd_deref1 ( + struct LMD_QUERY_SET *lmdqs, + char *str, int min_wordlength, int max_wordlength); + +/* nl_00106.c */ int cdecl lmd_deref_word_ref ( + struct LMD_QUERY_SET *lmdqs, + char *w, int exact, struct WORD_REF_LIST **wrl); +/* nl_00107.c */ int lmd_read_word_ref_list (struct YTREE *yt, + void *client_data); +/* nl_00108.c */ int cdecl lmd_read_word_ref (FILE *fi_word_ref, + struct WORD_REF *wr); +/* nl_00109.c */ long cdecl lmd_read_document_info_list (FILE *fi, + struct YTREE **wrl_ytree, long offset, long cnt); +#endif /* _FILE_DEFINED */ + +/* nl_00111.c */ int cdecl lmd_discard_doc_id (struct YTREE *yt, + void *client_data); + +/* nl_00112.c */ int cdecl lmd_free_docdir_list (struct DOCDIR_LIST *dl1); +/* nl_00113.c */ struct DOCDIR_LIST *cdecl lmd_read_docdir_info ( + char *document_dir, struct WORD_REF_LIST *wrl); +/* nl_00114.c */ struct DOCDIR_LIST *cdecl lmd_get_docdir_info (char *line1, + char *line2, int MAX_LINE, long docid, + struct WORD_REF_LIST *wrl); + +#ifdef _FILE_DEFINED +/* nl_00115.c */ int lmd_find_word_ref (FILE *f_wr, long w_info, + struct WORD_REF *wr); +/* nl_00116.c */ int cdecl lmd_print_word_ref_info (FILE *fo, + struct WORD_REF *wr); +/* nl_00117.c */ int cdecl lmd_print_doc_hit_list (FILE *fo, + struct WORD_REF_LIST *wrl, int print_dil); +/* nl_00118.c */ int cdecl lmd_print_document_info_list (FILE *fo, + struct DOCUMENT_INFO_LIST *start); +/* nl_00119.c */ int cdecl lmd_print_veronica_hit_list (FILE *fo, + char *veronica_file, struct WORD_REF_LIST *wrl); +/* nl_00120.c */ int cdecl lmd_print_veronica_docinfo_list (FILE *fo, + FILE *vf, struct DOCUMENT_INFO_LIST *start); +/* nl_00121.c */ int cdecl lmd_print_hyx_hit_list (FILE *fo, + char *document_dir, struct WORD_REF_LIST *wrl); +/* nl_00122.c */ int cdecl lmd_print_docdir_hyx (FILE *fo, + struct DOCDIR_LIST *docdir); +/* nl_00123.c */ int cdecl lmd_print_gopher_hit_list (FILE *fo, + char *document_dir, struct WORD_REF_LIST *wrl, + char *path_prefix, char *item_type, char *host_name, + long port_number); +/* nl_00124.c */ int cdecl lmd_print_docdir_gopher (FILE *fo, + struct DOCDIR_LIST *dl2, char *path_prefix, + char *item_type, char *host_name, long port_number); +/* nl_00125.c */ long cdecl lmd_write_word_ref (FILE *fo_word_ref, + struct WORD_REF *wr, long doc_items_offset, + long doc_items_written); +#endif /* _FILE_DEFINED */ + +/* nl_00126.c */ int cdecl lmd_docid_list_insert ( + struct DOCUMENT_INFO *element, + struct YTREE **wrl_ytree, char *docid_str); +/* nl_00127.c */ struct TERM_EVAL *cdecl lmd_build_term_eval (char *str, + struct WORD_REF_LIST *wrl); +/* nl_00128.c */ struct TERM_EVAL *lmd_evaluate_terms ( + struct TERM_EVAL *te_list, long opcode); +/* nl_00129.c */ struct DOCUMENT_INFO_LIST *cdecl lmd_dil_accumulate ( + struct WORD_REF_LIST *wrl); +/* nl_00130.c */ struct DOCUMENT_INFO_LIST *cdecl lmd_dil_dup ( + struct DOCUMENT_INFO_LIST *org); + struct DOCUMENT_INFO *lmd_di_dup (struct DOCUMENT_INFO *org); +/* nl_00131.c */ struct DOCUMENT_INFO_LIST *cdecl lmd_dil_operator ( + struct DOCUMENT_INFO_LIST *dil_op1, + struct DOCUMENT_INFO_LIST *dil_op2, + long operation); +/* nl_00132.c */ struct DOCUMENT_INFO *cdecl lmd_find_document_info ( + struct WORD_REF *wr, char *doc_id_str); +/* nl_00133.c */ struct DOCUMENT_INFO *cdecl lmd_insert_document_info ( + struct WORD_REF *wr, long doc_id, char *doc_id_str); +/* nl_00134.c */ int cdecl lmd_create_dil (struct YTREE *yt, + void *client_data); + +#ifdef _LMD_QUERY_SET_defined +/* nl_00135.c */ int cdecl lmd_qs_setup_table_names ( + struct LMD_QUERY_SET *lmdq, char *s); +/* nl_00136.c */ int cdecl lmd_deref_init (struct LMD_QUERY_SET *lmdqs); +/* nl_00137.c */ int cdecl lmd_deref_finish (struct LMD_QUERY_SET *lmdqs); +#endif /* _LMD_QUERY_SET_defined */ + +/* nl_00138.c */ int cdecl lmd_store_word_ref (char *str, long info, + void *client_data); + +#ifdef _FILE_DEFINED +/* nl_00139.c */ int cdecl lmd_print_hyx_cluster_hit_list (FILE *fo, + struct WORD_REF_LIST *wrl, char *cluster_name); +#endif /* _FILE_DEFINED */ + +/* ------------------------------------------------------------------------ */ +/* nl_00201.c */ int cdecl lmd_set_location_code (struct DOCUMENT_INFO *di, + int loc_operator, int loc_number, long loc_code); +/* loc_operator */ +#define LOC_CODE_NOP 0 +#define LOC_CODE_SET 1 +#define LOC_CODE_ADD 2 +#define LOC_CODE_OR 3 + +/* ------------------------------------------------------------------------ */ +#ifdef _LMDT_CONTROL_DEFINED +/* nl_00301.c */ int cdecl lmd_TWF (struct LMDT_CONTROL *lmdt, char *w); +/* nl_00302.c */ int cdecl lmd_report_tfb (struct LMDT_CONTROL *lmdt, + long inf); +/* nl_00303.c */ int cdecl lmd_report2 (char *str, long inf, + void *client_data); +/* nl_00304.c */ int cdecl lmd_report (struct LMDT_CONTROL *lmdt, char *w, + int rv, int lng, long wi); +/* nl_00305.c */ int cdecl lmd_RL3 (struct LMDT_CONTROL *lmdt, char *fn, + int mode); +/* nl_00306.c */ int cdecl lmd_RL3_set_tfb_file (struct LMDT_CONTROL *lmdt, + char *fn); +#endif /* _LMDT_CONTROL_DEFINED */ + +/* ------------------------------------------------------------------------ */ +/* nl_00401.c */ int cdecl lmd_score (struct LMDC_CONTROL *lmdc, char *s, + long cnt, int mode); +/* nl_00402.c */ int cdecl lmd_idx (struct LMDC_CONTROL *lmdc, char *s, + long document_id, long document_ptr, char *document_id_str, + int loc_operator, int loc_number, long loc_code); +/* nl_00403.c */ struct WORD_REF *cdecl lmd_lookup_entry ( + struct LMDC_CONTROL *lmdc, char *string); + +#ifdef __GG_ytree__ +/* nl_00404.c */ long cdecl lmd_PL (struct YTREE *yt, char *LUT_out, + char *TABLE_out); +#endif /* __GG_ytree__ */ + +/* nl_00405.c */ int cdecl lmd_RL4 (struct LMDC_CONTROL *lmdc, char *LUT_in); +/* nl_00407.c */ void cdecl lmd_initialize_control(struct LMDC_CONTROL *lmdc); +/* nl_00408.c */ void cdecl lmd_error04 (char *msg); +#ifdef _FILE_DEFINED +/* nl_00409.c */ void cdecl lmd_print_04statistics ( + struct LMDC_CONTROL *lmdc, FILE *fo); +#endif + +#ifdef __GG_ytree__ +/* nl_00410.c */ int cdecl ytree_wr_ptr2idx (struct YTREE *yt, void *lmdc); +/* nl_00411.c */ int cdecl ytree_wr_idx2ptr (struct YTREE *yt, void *lmdc); +#endif /* __GG_ytree__ */ + +/* ------------------------------------------------------------------------ */ +/* nl_00500.c */ struct LMDC_CONTROL *cdecl lmd_create_control (void); + +/* nl_00501.c */ int cdecl lmd_word_statistics (struct LMDC_CONTROL *lmdc, + struct WORD_REF *wi, char *string, long document_id, + long document_ptr, char *document_id_str, int operation, + int loc_operator, int loc_number, long loc_code); + +/* operation: */ +#define ADD_WORD_REF 1 +#define DEL_WORD_REF 0 + +/* nl_00502.c */ int cdecl lmd_write_tables (struct LMDC_CONTROL *lmdc, + char *fn_wr, char *fn_di, int mode); +/* nl_00503.c */ long cdecl lmd_read_tables (struct LMDC_CONTROL *lmdc, + char *fn_wr, char *fn_di); +/* nl_00504.c */ int cdecl lmd_discard_document_id (struct LMDC_CONTROL *lmdc, + long doc_id); +#ifdef _FILE_DEFINED +/* nl_00510.c */ int cdecl lmd_dump_word_entry (struct YTREE *yt, + void *client_data); +/* nl_00511.c */ int cdecl lmd_print_lmdd (FILE *fo, + struct LMDD_CONTROL *lmdd); +#endif /* _FILE_DEFINED */ +/* nl_00512.c */ long cdecl lmd_get_interpretation (char *s); +/* nl_00514.c */ int cdecl lmd_discard_document_node (struct YTREE *yt, + void *cd); + +/* ------------------------------------------------------------------------ */ +/* nl_00601.c */ long cdecl lmd_read_stream ( + struct LMDC_CONTROL *lmdc, char *fn); +/* nl_00602.c */ long cdecl lmd_read_tokens ( + struct LMDC_CONTROL *lmdc, char *fn, long docid, + char *docid_str, + long f_from, long f_size, long f_end, int verbosity); +/* nl_00603.c */ long cdecl lmd_batch_process ( + struct LMDC_CONTROL *lmdc, char *fn, int verbosity); +/* nl_00604.c */ long cdecl lmd_docdir_process ( + struct LMDC_CONTROL *lmdc, char *fn, + int match_c, char *match_v [], int verbosity); +/* nl_00605.c */ long cdecl lmd_veronica_process ( + struct LMDC_CONTROL *lmdc, char *fn, int *alphabet); +/* nl_00606.c */ long cdecl lmd_read_tfb ( + struct LMDC_CONTROL *lmdc, char *fn, + int position, int TFB_delimiter, int *alphabet); +/* nl_00607.c */ long cdecl lmd_read_words ( + struct LMDC_CONTROL *lmdc, char *fn); +/* nl_00608.c */ long cdecl lmd_read_fcy ( + struct LMDC_CONTROL *lmdc, char *fn); +/* nl_00609.c */ long cdecl lmd_read_long_fcy ( + struct LMDC_CONTROL *lmdc, char *fn); +/* nl_00610.c */ long lmd_read_hyx_cluster (struct LMDC_CONTROL *lmdc, + char *fnm_hyx, char *fnm_idx, int *alphabet); + +/* ------------------------------------------------------------------------ */ +/* util_001.c */ int cdecl sort_by_frequency (char *wort, long frequency); +#ifdef _FILE_DEFINED + int cdecl print_sorted (FILE *fo); +#endif /* _FILE_DEFINED */ + +#endif /* __GG_lookup__ */ diff --git a/lib/include/gg/lutctl.h b/lib/include/gg/lutctl.h new file mode 100644 index 0000000000000000000000000000000000000000..409dd4e998035083cfdd9da2805e64714bb1cab7 --- /dev/null +++ b/lib/include/gg/lutctl.h @@ -0,0 +1,54 @@ +/* + * FILE %inc/gg/lutctl.h + * + * written: 2001-11-20 + * latest update: 2001-11-20 19:09:54 + * $Id: lutctl.h,v 1.1 2001/11/20 19:32:45 gonter Exp $ + * + */ + +#ifndef __GG_lutctl__ +#define __GG_lutctl__ + +#include <stdio.h> +#include <gg/lookup.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +struct LUTCTL +{ + int state; /* indicates where the lookup table is stored */ +#define LUTCTL_state_undef 0 /* not yet defined */ +#define LUTCTL_state_file 1 /* LUT structure in opened file */ +#define LUTCTL_state_mem 2 /* LUT structure in memory */ +#define LUTCTL_state_ytree 3 /* YTREE in memory */ + + int updated; + + /* file based lookup table */ + char *filename; + FILE *fp; + + /* memory cached lookup table */ + char *mem; + long size; + long limit; + + /* structured as YTREE */ + struct YTREE *yt; +}; +typedef struct LUTCTL LUTCTL; + +/* methods: --------------------------------------------------------------- */ +LUTCTL *lutctl_alloc (); +int lutctl_free (LUTCTL *lutct); + +int lutctl_set_filename (LUTCTL *lutct, char *fnm); +int lutctl_open (LUTCTL *lutctl); +int lutctl_close (LUTCTL *lutctl); + +int lutctl_load (LUTCTL *lutctl, long limit); + + +#endif /* __GG_lutctl__ */ + diff --git a/lib/include/gg/lxs.h b/lib/include/gg/lxs.h new file mode 100644 index 0000000000000000000000000000000000000000..ba8bb15091cace2a2d4afc52cd5a699947b7f522 --- /dev/null +++ b/lib/include/gg/lxs.h @@ -0,0 +1,87 @@ +/* + * include FILE <gg/lxs.h> + * + * lexicon services + * + * written: 1994-03-27 + * latest update: 1995-07-18 + * + */ + +#ifndef __GG_lxs__ +#define __GG_lxs__ + +#include <gg/floskel.h> +#include <gg/lookup.h> +#include <gg/attlist.h> + +/* ------------------------------------------------------------------------ */ +struct LXS_OLD_ENTRY +{ +#ifdef JUNK + struct WORD_REF *lxs_word_ref; + struct ATTRIBUTE_LIST *lxs_attribute_list; +#endif + struct LXS_OLD_ENTRY *lxs_next; + long lxs_entry_type; +#define LXS_ty_undef 0 +#define LXS_ty_word_ref 1 +#define LXS_ty_attlist 2 +#define LXS_ty_raw 3 + long lxs_entry_size; /* length of entry memory block */ + void *lxs_entry; +} ; + +#ifdef __COMMENT__ +The client for the Lexicon Services can specify which kind of information +is wanted, e.g. +1. if the word_ref information should be returned, +2. if the attribute list should be filled with (selected) attributes +3. if the full lexicon entry should be placed in the lxs_entry buffer. + +Also, the origin of the data may also be configured, e.g. ++ from a word_ref table ++ from a lexicon file ++ from a lexicon server (TBS) + +#endif /* __COMMENT__ */ + +/* ------------------------------------------------------------------------ */ +struct LXS_ENTRY +{ /* derived from struct WORD_REF */ + + /* quick'n'dirty mini lexicon for special processing actions */ + long LXSE_language; /* one language of that word */ + long LXSE_fq_rank; /* frequency ranking (for stop word thsld) */ + long LXSE_word_type; /* bit field for word types */ + long LXSE_interpretation; /* interpretation code within programs */ + long LXSE_bin_lex_offset; /* offset in binary lexicon */ +} ; + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +#define _LXS_CONTROL_DEFINED +struct LXS_CONTROL +{ + int LXSC_type; + + /* cluster file */ + FILE *LXSC_hyx; + FILE *LXSC_idx; + FILE *LXSC_lut; + FILE *LXSC_xfn; +} ; +#endif /* _FILE_DEFINED */ + +#define LXSC_TYPE_undefined 0 +#define LXSC_TYPE_cluster 1 + +/* lxs_0001.c ------------------------------------------------------------- */ +struct LXS_OLD_ENTRY *cdecl lxs_get_word (int lexicon_number, + unsigned char *wrd, int cr_flag); +int cdecl lxs_set_word_ref (int lexicon_number, char *fnm_lut, char *fnm_wr); +int cdecl lxs_shutdown_word_ref (int lexicon_number); +int cdecl lxs_intialize (int num); + + +#endif /* __GG_lxs__ */ diff --git a/lib/include/gg/lxs2.h b/lib/include/gg/lxs2.h new file mode 100644 index 0000000000000000000000000000000000000000..468901364641fb83c72b4e8c128fdd47794c8361 --- /dev/null +++ b/lib/include/gg/lxs2.h @@ -0,0 +1,61 @@ +/* + * include FILE <gg/lxs2.h> + * + * lexicon services + * + * written: 1996-12-20 + * latest update: 1996-12-20 0:24:10 + * + */ + +#ifndef __GG_lxs2__ +#define __GG_lxs2__ + +#include <gg/floskel.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +struct LEXICON_ENTRY +{ + char *entry; + int is_lower; /* 1: record is for lower case version */ + + struct LEXICON_ENTRY *lower_case; /* same entry in lower case */ + struct LEXICON_ENTRY *alt; /* alternative mixed case version */ + + long ref_count; +} ; + +/* ------------------------------------------------------------------------ */ +struct LEXICON_CONTEXT +{ + char *name; + + struct YTREE *lower_case; + struct YTREE *mixed_case; + + int to_lower; /* 1: record only lower case version */ + + long num_entries_lower; + long num_entries_mixed; +} ; + +/* ------------------------------------------------------------------------ */ + +/* buildup */ +struct LEXICON_CONTEXT *lxs_new_context (char *name); + +struct LEXICON_ENTRY *lxs_record (struct LEXICON_CONTEXT *lxc, char *word, + int is_mixed); + + +/* diagnostics */ + +#ifdef _FILE_DEFINED +int lxs_dump_context (struct LEXICON_CONTEXT *lxc, FILE *fo); +int lxs_dump_entry (struct LEXICON_ENTRY *lxe, FILE *fo); +#endif /* _FILE_DEFINED */ + +int lxs_dump_entry2 (long entry_ref, void *cd); + +#endif /* __GG_lxs2__ */ diff --git a/lib/include/gg/lzhhead.h b/lib/include/gg/lzhhead.h new file mode 100644 index 0000000000000000000000000000000000000000..d817476263c6e5ddb413e5ef524bca8d21f209c2 --- /dev/null +++ b/lib/include/gg/lzhhead.h @@ -0,0 +1,48 @@ +/* + * include FILE <gg/lzhhead.h> + * + * structure and constants of LH-ARC files (extension LZH) + * + * written: 1990 05 26 + * 1991 01 28: Revision + * latest update: 1994-11-12 + * + */ + +#ifndef __GG_lzhhead__ +#define __GG_lzhhead__ + +#pragma pack(1) + +/* structure: ------------------------------------------------------------- */ +struct LZH_HEAD +{ + /* fix part: 22 bytes */ + unsigned char LZH_header_size; + unsigned char LZH_header_cks; /* calculation not known ########## */ + char LZH_header_sign [5]; /* */ + long LZH_size_compressed; /* */ + long LZH_size_decompressed; /* */ + long LZH_timestamp; /* ###### */ + int LZH_attributes; /* ###### */ + unsigned char LZH_name_length; /* 1 if name has one char */ + + /* variable part */ + char LZH_name [64]; /* maximum name length in DOS */ +} ; + +/* constants: ------------------------------------------------------------- */ +#define LZH_FIX_HEAD_SIZE 23 /* includes name length, */ + /* but not the name */ +#define LZH_SIGN_1 "-lh1-" /* only known signature so far */ + +/* prototypes: ------------------------------------------------------------ */ +int cdecl get_lzh_head ( +FILE *fi, /* archive file, binary opened */ +struct LZH_HEAD *head); /* LZH-Header */ +/* RETURN: */ +/* -1 error or no archive */ +/* 0 EOF: no more files in archive */ +/* >0 archived file found; head is valid */ + +#endif diff --git a/lib/include/gg/macbinar.h b/lib/include/gg/macbinar.h new file mode 100644 index 0000000000000000000000000000000000000000..2e4cf0861a858b18472b9c9849c7727dcca9ec01 --- /dev/null +++ b/lib/include/gg/macbinar.h @@ -0,0 +1,41 @@ +/* + * include FILE <gg/macbinar.h> + * + * written: 1990 05 15 + * 1991 06 24: Revision + * latest update: 1995-02-12 + * + */ + +#ifndef __GG_macbinary__ +#define __GG_macbinary__ + +#pragma pack(1) + +#define MB_READ 0 +#define MB_WRITE 1 +#define MB_DISABLE 0x80 + +/* ------------------------------------------------------------------------ */ +struct MBHead /* MacBinary header */ +{ + char zero1; /* reserved; should be zero */ + char nlen; /* length of name string */ + char name [63]; /* name string */ + char type [4]; /* Type ID */ + char creator [4]; /* Creator ID */ + char flags; + char zero2; /* reserved; should be zero */ + char location [6]; + char protected; + char zero3; /* reserverd; should be zero */ + long dflen; /* data fork length */ + long rflen; /* resource fork lenth */ + char cdate [4]; /* creation date */ + char mdate [4]; /* modification date */ + char res [29]; /* reserved */ +} ; + +#pragma pack() + +#endif /* __GG_macbinary__ */ diff --git a/lib/include/gg/mail.h b/lib/include/gg/mail.h new file mode 100644 index 0000000000000000000000000000000000000000..0488d1f803531fbcaeac91b9433153e3bba0d2bc --- /dev/null +++ b/lib/include/gg/mail.h @@ -0,0 +1,26 @@ +/* + * include FILE <gg/mail.h> + * + * see also: %ds/mime + * + * written: 1996-02-23 + * latest update: 1997-01-25 19:18:23 + * $Id: mail.h,v 1.3 2002/01/29 19:21:10 gonter Exp $ + * + */ + +#ifndef __GG_mail__ +#define __GG_mail__ + +/* ------------------------------------------------------------------------ */ +#define MIME_none 0 +#define MIME_quoted_printable 1 +#define MIME_base64 2 +#define MIME_url_encoded 3 + +/* prototypes: ------------------------------------------------------------ */ +int mime_convert_line (char *line, char *line2, int MAX_LINE, int mime_mode); +int mime_convert_url (char *line, char *line2, int MAX_LINE); +int mime_convert_xurl (char *line, char *line2, int MAX_LINE, int escape); + +#endif /* __GG_mail__ */ diff --git a/lib/include/gg/masked_1.h b/lib/include/gg/masked_1.h new file mode 100644 index 0000000000000000000000000000000000000000..5be5d20015fdf3be6536500f1e43b22b4e41a731 --- /dev/null +++ b/lib/include/gg/masked_1.h @@ -0,0 +1,36 @@ +/* + * include FILE <gg/masked_1.h> + * + * written: 1988 03 28 + * 1991 01 28: Revision + * latest update: 1994-11-11 + * + */ + +#ifndef __GG_masked_1__ +#define __GG_masked_1__ + +struct MSK_FIELD /* Feldbeschreibung fuer Masken Editor */ +{ + int cx, cy, + lng, + attr1, attr2; +} ; + +/* ------------------------------------------------------------------------ */ +int cdecl msk_edit (int men, struct MSK_FIELD ff [], char *dss[], + int sc, int *update); + +/* int msk_edit (men, ff, dss, sc, update) */ +/* int men; gewaehlte Menue Seite */ +/* struct MSK_FIELD ff []; Feldbeschreibungsstrukturen */ +/* char *dss []; Datenfelder */ +/* int sc, Anzahl der Felder */ +/* *update; 1 -> Daten veraendert */ +/* RETURN: letzte nicht interpretierte Taste */ + +void cdecl msk_set_fld (int); +int cdecl msk_get_fld (); +void cdecl msk_set_err (char *, int, int); + +#endif diff --git a/lib/include/gg/maus.h b/lib/include/gg/maus.h new file mode 100644 index 0000000000000000000000000000000000000000..7c9cc48a2d98b2e0805624a8847d0112f601e850 --- /dev/null +++ b/lib/include/gg/maus.h @@ -0,0 +1,130 @@ +/* + * include FILE <gg/maus.h> + * + * written: 1988 09 04 + * latest update: 1995-04-29 + * + */ + +#ifndef __GG_maus__ +#define __GG_maus__ + +#ifndef MSDOS +#ifndef cdecl +#define cdecl +#endif +#endif + +#define MAUS_key_left 0x01 +#define MAUS_key_right 0x02 +#define MAUS_key_middle 0x04 + +/* Pop Up Menue ----------------------------------------------------------- */ +struct MMen +{ + int mm_sub_sp; + int mm_sub_z; + char *mm_name; + long mm_function; + int mm_key; /* Tastencode */ + int mm_type; /* 0 -> leer */ + /* 1 -> vordefiniert */ + /* 2 -> Setup (dynamisch allociert) */ + struct MMen *mm_next; + struct MMen *mm_sub; +} ; + +/* Pop Up Menue ----------------------------------------------------------- */ +struct MMen_short +{ + int mm_sub_sp; + int mm_sub_z; + char *mm_name; + long mm_function; + int mm_key; /* Tastencode */ + int mm_type; /* 0 -> leer */ + /* 1 -> vordefiniert */ + /* 2 -> Setup (dynamisch allociert) */ +} ; + +/* Pop Up Menue Steuerung ------------------------------------------------- */ +struct MMctrl +{ + struct MMen *mm_men; + int mm_akt_page; + int mm_menu_line; + int mm_color_1; + int mm_color_2; + int mm_color_3; + int mm_color_4; + int mm_smen; + int mm_sel; +} ; + +/* ANM: Die Struktur MMctrl beschreibt das Menue-System vollst�ndig. */ +/* Mit mm_save und und mm_load k�nnen unterschiedliche Menue-System */ +/* umgeschaltet werden !!! */ + +/* Maus Library ----------------------------------------------------------- */ +struct SELBOX_LIST +{ + struct SELBOX_LIST *sbl_next; + struct SELBOX_LIST *sbl_prev; + char *sbl_display; + long sbl_cookie; +} ; + +/* Maus Library ----------------------------------------------------------- */ +int cdecl maus_reset (void); +void cdecl maus_enable (void); +void cdecl maus_disable (void); +void cdecl maus_position (int *, int *, int *); +void cdecl maus_setposition (int, int); +void cdecl maus_set_x_margins (int min_x, int max_x); +void cdecl maus_set_y_margins (int min_y, int max_y); +void cdecl maus_set_cursor_type (int type, int p1, int p2); + +/* Pop Up Menue ----------------------------------------------------------- */ +#ifdef W_MODEL_CGA +#define mm_maus_menu mmcga_maus_menu +#define mm_install_function mmcga_install_function +#define mm_setup mmcga_setup +#define mm_clear_menu mmcga_clear_menu +#define mm_save mmcga_save +#define mm_load mmcga_load +#define mm_set_home mmcga_set_home + +#define mm_short_install_function mmcga_short_install_function +#endif + +#ifdef W_MODEL_BIOS +#define mm_maus_menu mmbios_maus_menu +#define mm_install_function mmbios_install_function +#define mm_setup mmbios_setup +#define mm_clear_menu mmbios_clear_menu +#define mm_save mmbios_save +#define mm_load mmbios_load +#define mm_set_home mmbios_set_home + +#define mm_short_install_function mmbios_short_install_function +#endif + +/* ------------------------------------------------------------------------ */ +long cdecl mm_maus_menu (int mode, int use_maus, int use_key); +int cdecl mm_install_function (int spalte, int zeile, char *name, + long value, int m_key, int modus); +void cdecl mm_setup (int, int, int, int, int, int); +void cdecl mm_clear_menu (void); +void cdecl mm_save (struct MMctrl *); +void cdecl mm_load (struct MMctrl *); +void cdecl mm_set_home (void); + +int cdecl mm_short_install_function (struct MMen_short *mm); + +/* selbox01: -------------------------------------------------------------- */ +int cdecl selbox_select (int mode, int act_page, int ax, int ay, + int bx, int by, int cy, int box_type, int box_colour, + int text_colour, int sel_colour, struct SELBOX_LIST *sbl, + long *cookie); + +#endif /* __GG_maus__ */ diff --git a/lib/include/gg/mscdex.h b/lib/include/gg/mscdex.h new file mode 100644 index 0000000000000000000000000000000000000000..e6f15d9ed55bdcd070ecb95afcddf47e369fbc42 --- /dev/null +++ b/lib/include/gg/mscdex.h @@ -0,0 +1,145 @@ +/* + * include FILE <gg/mscdex.h> + * + * - prototypes + * - see also: cdcmd.c + * + * written: 1995-06-04 + * latest update: 1997-08-24 9:32:12 + * + */ + +#ifndef __GG_mscdex__ +#define __GG_mscdex__ + +#include <gg/floskel.h> + +#pragma pack(1) +#define _80MINUTES_ 360000L /* 80*60*75 */ + +/* ------------------------------------------------------------------------ */ +struct DDRV_REQ_HDR +{ + char DRH_length; + char DRH_subunit_code; + unsigned char DRH_command_code; + int DRH_status; + char DRH_reserved [8]; +} ; + +/* ------------------------------------------------------------------------ */ +struct DDRV_REQ_HDR_IOCTL +{ + struct DDRV_REQ_HDR DRH_DDRV; + char DRH_mdb; /* 0 */ + char *DRH_ta; + int DRH_size; + int DRH_start; + char *DRH_ptr; +} ; + +/* ------------------------------------------------------------------------ */ +struct DDRV_REQ_HDR_PLAYREQ +{ + struct DDRV_REQ_HDR DRH_DDRV; + char DRH_addr_mode; + long DRH_start; + long DRH_number; +} ; + +/* ------------------------------------------------------------------------ */ +struct DDRV_AUDIO_DISK_INFO +{ + char DADI_code; + char DADI_lowest_track; + char DADI_highest_track; + long DADI_lead_out; +} ; + +/* ------------------------------------------------------------------------ */ +struct DDRV_AUDIO_TRACK_INFO +{ + char DATI_code; + char DATI_track; + long DATI_start; + char DATI_tci; /* Track Control Information */ + /* ... interpreted according to the */ + /* Philips/Sony Red Book standard. */ +} ; + +/* ------------------------------------------------------------------------ */ +struct DDRV_AUDIO_Q_CHANNEL_INFO +{ + char DAQI_code; + char DAQI_tci; + char DAQI_track; + char DAQI_index; + char DAQI_track_min; /* running time within track */ + char DAQI_track_sec; + char DAQI_track_frame; + char DAQI_track_zero; + char DAQI_disk_min; /* running time within disk */ + char DAQI_disk_sec; + char DAQI_disk_frame; +} ; + +/* ------------------------------------------------------------------------ */ +struct DDRV_UPC /* universal product code */ +{ + char DUPC_code; + char DUPC_control; + char DUPC_num [7]; + char DUPC_zero; + char DUPC_aframe; +} ; + +#pragma pack() +/* ------------------------------------------------------------------------ */ +struct CD_TRACK_INFO +{ + int CDTI_tci; + long CDTI_track_offset; +} ; + +/* ------------------------------------------------------------------------ */ +struct CD_DISK_INFO +{ + int CDDI_first_track; + int CDDI_last_track; + int CDDI_track_count; + long CDDI_end_address; + char *CDDI_id_code; /* MD5 code */ + int CDDI_ti_size; + struct CD_TRACK_INFO *CDDI_ti; +} ; + +/* ------------------------------------------------------------------------ */ +#define MSCDEX_ERROR 0x8000 +#define MSCDEX_BUSY 0x0200 +#define MSCDEX_DONE 0x0100 + +/* prototypes: ------------------------------------------------------------ */ +int cdecl mscdex_get_drives (void); +int cdecl mscdex_get_first_drive (void); +int cdecl mscdex_send_device_request (int drive, char *request_header); + +char *cdecl cd_addr_to_time (long addr, int fmt); +char *cdecl cd_binary_to_time (long frames); +long cdecl cd_addr_to_binary (long addr); +struct CD_DISK_INFO *cd_read_track_info (int drive_num); + +int cdecl cd_eject_close (int drive, int eject_close); +int cdecl cd_play (int drive, long first, long number); +int cdecl cd_stop_resume (int drive, int mode); +int cdecl cd_info (int drive, int *first_track, int *last_track, + long *address); +int cdecl cd_track_info (int drive, int track_number, long *start, int *tci); +int cdecl cd_upc (int drive, struct DDRV_UPC *req, int ctrl); +int cdecl cd_query (int drive, int *tci, int *track, int *index, + int *track_min, int *track_sec, int *track_fr, + int *disk_min, int *disk_sec, int *disk_fr); + +int cdecl cd_is_playing (int drive_num); +int cdecl cd_play_track (int drive, char *s); + +#endif /* __GG_mscdex__ */ diff --git a/lib/include/gg/mscdex01.h b/lib/include/gg/mscdex01.h new file mode 100644 index 0000000000000000000000000000000000000000..e8e30f85ecafdf622c3d8e860f72ec3625938bd7 --- /dev/null +++ b/lib/include/gg/mscdex01.h @@ -0,0 +1,59 @@ +/* + * include FILE <gg/mscdex01.h> + * + * - prototypes + * - see also: cdcmd.c, <gg/mscdex.h> + * + * written: 1997-08-24 + * latest update: 1997-08-24 9:24:49 + * + */ + +#ifndef __GG_mscdex01__ +#define __GG_mscdex01__ + +#include <gg/floskel.h> + +#define DEFAULT_PROMPT_BUFFER_SIZE 128 + +/* ------------------------------------------------------------------------ */ +struct CD_CATALOG +{ + int format; +#define CD_FMT_HYX 0x0001 /* produce HYX frames */ +#define CD_FMT_VERBOSE 0x0002 /* verbose information */ + + int ask_mode; +#define CD_ask_dont 0 /* don't ask */ +#define CD_ask_toc 1 /* prompt for contents information */ +#define CD_ask_hyx 2 /* like CD_ask_toc but use info to update * + /* cluster */ + + char *cluster_name; +} ; + +/* ------------------------------------------------------------------------ */ +struct CD_TOC_PROMPT +{ + char *CDTP_bu1; + char *CDTP_title; + char *CDTP_sng; + char *CDTP_grp; + char *CDTP_class; + int CDTP_buffer_size; +} ; + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +int cdecl cd_print_play_info (FILE *fo, int drive_num, int show); +int cdecl cd_print_upc_info (FILE *fo, int drive_num); +char *cdecl cd_get_upc (int drive); +int cdecl cd_print_track_info (FILE *fo, int drive_num, + struct CD_CATALOG *cat, struct CD_TOC_PROMPT *cdtp); +#endif /* _FILE_DEFINED */ + +/* ------------------------------------------------------------------------ */ +struct CD_TOC_PROMPT *cdecl cd_new_prompt_structure (int buffer_size); +struct CD_CATALOG *cdecl cd_new_catalog (void); + +#endif /* __GG_mscdex01__ */ diff --git a/lib/include/gg/ned.stp b/lib/include/gg/ned.stp new file mode 100644 index 0000000000000000000000000000000000000000..7dfeba06cf5d666bf6ab8799f0806601c715ee90 --- /dev/null +++ b/lib/include/gg/ned.stp @@ -0,0 +1,5 @@ +@macro +1 ^n^y^qs\#define +2 ^qy^isbr0 +4 ^kr$$^m +@end diff --git a/lib/include/gg/objdec.h b/lib/include/gg/objdec.h new file mode 100644 index 0000000000000000000000000000000000000000..7e9d5458276b16033ae1b940d2d2611b2e6f6197 --- /dev/null +++ b/lib/include/gg/objdec.h @@ -0,0 +1,310 @@ +/* + * include FILE <gg/objdec.h> + * + * Decoder fuer Files im INTEL RELOCATIBLE OBJECT FORMAT + * in der MICROSOFT Variante + * + * written: 1988 01 12 + * 1990 04 26: Revision + * latest update: 1997-08-16 9:47:22 + * + */ + +#ifndef __GG_objdec__ +#define __GG_objdec__ + +#include <gg/floskel.h> + +#ifdef NIL +#undef NIL +#endif +#define NIL (void *) 0 + +#define CROSS_REFERENCE /* Diese Variante von OBJDEC kann */ + /* auch Cross References erzeugen */ + +#pragma pack(1) + +/* ------------------------------------------------------------------------ */ +struct OBJ_RECORD /* Beginn eines Object Records */ +{ /* ... es werden 3 Byte des Records gelesen */ + char rec_typ; /* Record Type Code */ + char rec_lng [2]; /* Laenge des Records: wie's im File steht */ + int Irec_lng; /* Laenge des Records: ausgerechnet */ +} ; + +/* ------------------------------------------------------------------------ */ +struct DEF_NAME /* Segment- und Group Names udgl. */ +{ + struct DEF_NAME *next; + int nsize; + char nm [2]; +} ; + +/* ------------------------------------------------------------------------ */ +struct DEF_SEG /* Segment Definition */ +{ + struct DEF_SEG *next; + int a, c, b, p; + int seg_lng, + frnum, + offs; + int Xname_seg, /* Index fuer Segment Namen */ + Xname_class, /* . . Class . */ + Xname_overlay; +} ; + +/* ------------------------------------------------------------------------ */ +struct DEF_GROUP_COMPONENT /* Segmentliste fuer Group Definition */ +{ + struct DEF_GROUP_COMPONENT *next; + int si, + Xseg; +} ; + +/* ------------------------------------------------------------------------ */ +struct DEF_GRP /* Group Definition */ +{ + struct DEF_GRP *next; + int Xname_grp; /* Index fuer Group Namen */ + int cnt_seg; /* Anzahl der Segmente in der Group */ + struct DEF_GROUP_COMPONENT *seg_list; +} ; + +/* ------------------------------------------------------------------------ */ +struct DEF_EXT +{ + struct DEF_EXT *next; + int Xtype, /* Type Index */ + nsize; /* Laenge des Namens */ + char nm [2]; +} ; + +/* ------------------------------------------------------------------------ */ +struct DEF_PUB +{ + struct DEF_PUB *next; + int Xgrp; /* Index fuer Group Namen */ + int Xseg; /* . . Segment . */ + int frnum; /* Frame Number; gueltig wenn */ + /* Xseg= Xgrp= 0 */ + int Xtype; + int offs; + int nsize; + char nm [2]; +} ; + +/* ------------------------------------------------------------------------ */ +struct LST_STR /* String Listen */ +{ + struct LST_STR *next; + char *str1, + *str2; +} ; + +/* Cross Reference -------------------------------------------------------- */ +struct CRF_TITLE /* Liste der untersuchten Module */ +{ + struct CRF_TITLE + *crf_title_nxt; + char nm [2]; /* Name des Moduls */ +} ; + +/* ------------------------------------------------------------------------ */ +struct CRF_SEGMENT +{ + struct CRF_SEGMENT + *crf_segment_nxt; + char nm [2]; /* Name des Segments */ +} ; + +/* ------------------------------------------------------------------------ */ +struct CRF_EXTERNAL /* Verwendung eines Symbols */ +{ + struct CRF_EXTERNAL + *ref_ext_title; /* Modulname der Verwendung */ + struct CRF_TITLE + *title; +} ; + +/* ------------------------------------------------------------------------ */ +struct CRF_PUBLIC /* Definition eines Symbols */ +{ + struct CRF_PUBLIC /* Sortiert nach ... */ + *nxt_occ, /* ... 1. Verwendung */ + *nxt_name, /* ... Name des Public Symbols */ + *nxt_title, /* ... Name des Moduls (title) */ + *nxt_segment; /* ... Segment */ + + struct CRF_EXTERNAL + *ref_ext_title; /* Modulname der Verwendung */ + struct CRF_TITLE + *title; + struct CRF_SEGMENT + *segment; + char nm [2]; /* Name des Symbols */ +} ; + +/* ------------------------------------------------------------------------ */ +struct RECORD_BUFFER +{ + struct RECORD_BUFFER /* double linked list, if necessary */ + *RB_next, + *RB_prev; + + int RB_record_type; /* type of the buffered record */ + int RB_record_length; /* length of the buffered record */ + int RB_buffer_size; /* size of the allocated buffer */ + long RB_position_source; /* position of record in the source file */ + char *RB_buffer; /* buffered OBJ-record, comlete with */ + /* fields for record type, record length */ + /* and calculated checksum */ +} ; + +#pragma pack() + +/* Output Modi: ----------------------------------------------------------- */ +#define OM_DIAGNOSTIC 0x01 /* Record Struktur anzeigen */ +#define OM_DIA_2 0x02 /* Struktur 'etwas' interpretieren */ +#define OM_ASM 0x04 /* MASM-Header erzeugen */ +#define OM_LEX 0x08 /* LEX records erzeugen */ +#define OM_FEATURE 0x10 /* feature records erzeugen */ + +/* Record Types: ---------------------------------------------------------- */ +#define RT__fill_ 0x00 /* Filler: ?? undokumentiert */ + /* scheinbar wirden diese das in */ + /* Libraries zwischen 2 Module gesetzt, */ + /* sodass jedes Modul an einer */ + /* 16-Byte-Grenze beginnt. */ +#define RT_0x01__ 0x01 /* Filler: ?? undokumentiert */ +#define RT_RHEADR 0x6E +#define RT_REGINT 0x70 +#define RT_REDATA 0x72 +#define RT_RIDATA 0x74 +#define RT_OBLDEF 0x76 +#define RT_ENDREC 0x78 +#define RT_BLKDEF 0x7A +#define RT_BLKEND 0x7C +#define RT_DEBSYM 0x7E +#define RT_THEADR 0x80 +#define RT_LHEADR 0x82 +#define RT_PEDATA 0x84 +#define RT_PIDATA 0x86 +#define RT_COMENT 0x88 +#define RT_MODEND 0x8A +#define RT_EXTDEF 0x8C +#define RT_TYPDEF 0x8E +#define RT_PUBDEF 0x90 +#define RT_LOCSYM 0x92 +#define RT_LINNUM 0x94 +#define RT_LNAMES 0x96 +#define RT_SEGDEF 0x98 +#define RT_GRPDEF 0x9A +#define RT_FIXUPP 0x9C +#define RT__none_ 0x9E /* Undokumentiert, keine Funktion ??? */ +#define RT_LEDATA 0xA0 +#define RT_LIDATA 0xA2 +#define RT_LIBHED 0xA4 +#define RT_LIBNAM 0xA6 +#define RT_LIBLOC 0xA8 +#define RT_LIBDIC 0xAA +#define RT_BSSDEF 0xB0 /* ?? Globale BSS Variable ???? */ +#define RT__libH_ 0xF0 /* library header */ +#define RT__libX_ 0xF1 /* library index at the end of a library */ +#define RT__libD_ 0xF2 /* library extended dictionary */ + +#define COMENT_TRANSLATOR 0x00 +#define COMENT_LIBRARY1 0x81 +#define COMENT_MEM_MODEL 0x9D /* e.g: 0s, 0l, ... */ +#define COMENT_0x9E 0x9E /* ??? */ +#define COMENT_LIBRARY2 0x9F +#define COMENT_0xA0 0xA0 /* e.g. CV */ +#define COMENT_0xA1 0xA1 /* e.g. CV */ +#define COMENT_0xA2 0xA2 /* e.g. CV */ +#define COMENT_OBJECT 0xA3 + +#ifndef NO_PROTOTYPING +/* objproc.c: ------------------------------------------------------------- */ +struct DEF_NAME *cdecl get_find_name (char *name, int code); + +/* objdec01.c: */ char *cdecl get_record_type (int record_type); +/* objdec02.c: */ char *cdecl get_alignment (int number); +/* objdec03.c: */ char *cdecl get_combination (int number); + +/* objdec04.c: ------------------------------------------------------------ */ +void cdecl crf_option (char *option_string); +struct CRF_PUBLIC *cdecl get_crf_public (char *n); +struct CRF_PUBLIC *cdecl set_crf_public (char *n); +struct CRF_TITLE *cdecl get_crf_title (char *n, int flg); +struct CRF_SEGMENT *cdecl get_crf_segment (char *n, int flg); +void cdecl sort_crf_external (struct CRF_PUBLIC *cpp, + struct CRF_EXTERNAL *cee); +void cdecl sort_crf_pub_name (void); +void cdecl sort_crf_pub_title (void); +void cdecl sort_crf_pub_seg (void); +void cdecl print_CRF (int argc, char *argv[], char *date_and_time); + +/* objdec05.c ------------------------------------------------------------- */ +void init_lists (void); +struct DEF_NAME *cdecl get_names (void); +struct DEF_NAME *cdecl get_name (int idx); +void cdecl show_names (FILE *fo); +struct DEF_SEG *cdecl get_segment (int idx); +struct DEF_NAME *cdecl new_name (int slng, char *name); +struct DEF_PUB *cdecl new_public (int slng, char *name, int offs, int xtype, + int idx_grp, int idx_seg, int frnum); +struct DEF_PUB *cdecl get_publics (void); +struct DEF_EXT *cdecl new_extern (int slng, char *name, int idx); +struct DEF_EXT *cdecl get_externs (void); +struct DEF_SEG *cdecl new_segment (void); +struct DEF_SEG *cdecl get_segments (void); +struct DEF_GRP *cdecl new_group (int idx); +struct DEF_GRP *cdecl get_groups (void); +void cdecl free_all (void); + +/* objdec06.c ------------------------------------------------------------- */ +struct RECORD_BUFFER *cdecl obj_get_record_buffer (int type, int lng); +void cdecl obj_free_record_buffer (struct RECORD_BUFFER *rec); +void cdecl obj_release_buffers (void); + +/* objdec07.c */ void cdecl scan_THEADR (struct RECORD_BUFFER *rec, + char *tit, int OM); +/* objdec08.c */ int cdecl obj_rd_name (char *source, char *dest); +/* objdec09.c */ int cdecl obj_rd2_name (char *source, char *dest, int cnt); +/* objdec10.c */ int cdecl rd_index (char *s, int *v); +/* objdec11.c */ int cdecl rd_number (char *v1, int *v2); +/* objdec12.c */ int cdecl rd_leaf_descriptor (char *s, long *v); +/* objdec13.c */ int cdecl calc_date_time (char *datim); +/* objdec14.c */ int cdecl create_objproc_version (struct RECORD_BUFFER *rec, + char *datim); +/* objdec15.c */ int cdecl calculate_checksum (char *s, int lng); +/* objdec16.c */ void cdecl print_ASM (char *title, struct DEF_NAME *np1, + struct DEF_SEG *sp, struct DEF_GRP *gp, + struct DEF_EXT *ep, struct DEF_PUB *pp); +/* objdec17.c */ int cdecl scan_LNAMES (struct RECORD_BUFFER *rec, + char *name, char *tit, char *fnm, int lnm_cnt, int OM); +/* objdec18.c */ void cdecl scan_COMENT (struct RECORD_BUFFER *rec, + char *name, int OM); +/* objdec19.c */ void cdecl scan_MODEND (struct RECORD_BUFFER *rec, int OM); +/* objdec20.c */ void cdecl scan_PUBDEF (struct RECORD_BUFFER *rec, + char *name, char *title, char *fnm, int en_crf, int OM); +/* objdec21.c */ void cdecl scan_EXTDEF (struct RECORD_BUFFER *rec, + char *name, char *title, char *fnm, int en_crf, int OM); +/* objdec22.c */ void cdecl scan_BSSNAM (struct RECORD_BUFFER *rec, + char *name, char *title, char *fnm, int en_crf, int OM); +/* objdec23.c */ int cdecl scan_SEGDEF (struct RECORD_BUFFER *rec, + int seg_cnt, int OM); +/* objdec24.c */ int cdecl scan_GRPDEF (struct RECORD_BUFFER *rec, + int grp_cnt, int OM); +/* objdec25.c */ int cdecl scan_TYPDEF (struct RECORD_BUFFER *rec, + int type_cnt, int OM); +/* objdec26.c */ void cdecl scan_LINNUM (struct RECORD_BUFFER *rec, int OM); +/* objdec27.c */ int cdecl print_LEX (FILE *fo, char *title, + struct DEF_EXT *ep, struct DEF_PUB *pp); +/* objdec28.c */ int cdecl print_feature_table (FILE *fo, char *title, + struct DEF_PUB *pp); +/* objdec29.c */ struct RECORD_BUFFER *cdecl obj_read_record (FILE *fi, + int akt_record_type, long pos); +#endif + +#endif /* __GG_objdec__ */ diff --git a/lib/include/gg/objutils.h b/lib/include/gg/objutils.h new file mode 100644 index 0000000000000000000000000000000000000000..e6149adffe54004fa80eda42191ba2b865a593d7 --- /dev/null +++ b/lib/include/gg/objutils.h @@ -0,0 +1,83 @@ +/* + * include FILE <gg/objutils.h> + * + * written: 1994-05-28 + * latest update: 1994-12-08 + * + */ + + +#ifndef __GG_objutils__ +#define __GG_objutils__ + +#include <gg/floskel.h> + +#ifdef NIL +#undef NIL +#endif +#define NIL ((void *) 0) + +/* ------------------------------------------------------------------------ */ +struct MODULE +{ + struct MODULE *next; + void *sym_list, **next_sym; + void *ext_list, **next_ext; + char *title; + char *file_name; + char *translator; + char *library; +} ; + +/* ------------------------------------------------------------------------ */ +struct SYMBOL +{ + struct SYMBOL *next; + struct SYMBOL *next_sym; + struct MODULE *mod; + void *ext_list; /* Liste der externen Module, die dieses */ + /* Symbol verwenden */ + char *sym_name; + int typ; +} ; + +/* ------------------------------------------------------------------------ */ +struct EXTERN +{ + struct EXTERN *next; + struct EXTERN *next_ext; + struct EXTERN *next_ext2; /* nach Modul-Titel verkettet */ + struct MODULE *mod; + struct SYMBOL *sym; + int local; +} ; + +/* ------------------------------------------------------------------------ */ +struct ARIADNE +{ + struct ARIADNE *ar_up; + struct EXTERN *ar_ex; + struct SYMBOL *ar_sy; +} ; + +/* Prototypes: ------------------------------------------------------------ */ +/* crf01.c */ struct MODULE *cdecl find_module (char *s, struct MODULE **pp); +/* crf02.c */ struct SYMBOL *cdecl find_symbol (char *s, int mode, + struct SYMBOL **pp, struct MODULE *akt_symbol); +/* crf03.c */ struct SYMBOL *cdecl find_local_symbol (struct SYMBOL *p, + char *s); +/* crf04.c */ void cdecl sort_extern (struct EXTERN **pep, struct EXTERN *ep, int mode); +/* crf05.c */ struct MODULE *cdecl get_module (void); +/* crf05.c */ struct SYMBOL *cdecl get_symbol (void); +/* crf05.c */ int cdecl crf (char *fn, int read_object, char *tmp_file); +#ifdef _FILE_DEFINED +/* crf06.c */ void cdecl print_modules (FILE *fo, struct MODULE *module); +/* crf07.c */ void cdecl print_symbols (FILE *fo, struct SYMBOL *symbol, + int MAX_LINE); +/* crf08.c */ int cdecl print_crf_tree (FILE *fo, char *symb, + struct SYMBOL *symbol); +/* crf09.c */ int cdecl print_crf_symbol (FILE *fo, int indent, + struct SYMBOL *sp, struct ARIADNE *arp); +#endif + +#endif /* __GG_objutils__ */ diff --git a/lib/include/gg/parse.h b/lib/include/gg/parse.h new file mode 100644 index 0000000000000000000000000000000000000000..da2d8c76751ba2bafb8cba770b53764e10efccdb --- /dev/null +++ b/lib/include/gg/parse.h @@ -0,0 +1,662 @@ +/* + * include FILE <gg/parse.h> + * + * HYX SGML Parser System + * + * - notes: about a restructuration + * - methods + * - structures: + * TAG_DEFINITION, TEXT_SEGMENT, TEXT_ELEMENT, + * MARKUP, HYX_PARSER_STATUS, ENTRY_DESCRIPTOR, ENTRY_QUEUE, + * LEXICON_GLOBAL_CONTROL, LEXICON_CONTROL, LEXICON_INDEX, + * LEX_SESSION, HYX_OUTPUT_DESCRIPTOR + * - macros + * - prototypes + * + * written: 1991 03 11 + * latest update: 1997-11-02 23:29:38 + * $Id: parse.h,v 1.6 2004/05/08 15:45:04 gonter Exp $ + * + */ + +#ifndef __GG_parse__ +#define __GG_parse__ + +#include <gg/attlist.h> /* attribute lists must be defined! */ +#include <gg/signatur.h> /* signatures must be defined! */ +#include <gg/floskel.h> + +/* #define PARSER_DEBUG 1 */ /* debugging level */ +/* #define PARSER_DEBUG_B 1 */ + +/* limits: ---------------------------------------------------------------- */ +#ifdef MSDOS +#define ENTRY_KEY_SIZE 128 +#define QUEUE_SIZE 128 +#else +#define ENTRY_KEY_SIZE 512 +#define QUEUE_SIZE 4096 +#endif + +/* ------------------------------------------------------------------------ */ +struct TAG_DEFINITION /* Beschreibung eines Tags */ +{ + long sig; /* Signatur: SIG_TAG_DEFINITION */ + struct TAG_DEFINITION + *TAG_DEF_next; /* Verkettung (ungluecklicher Umstaende...) */ + char *tag_name; /* Name des Tags */ + long tag_id; /* ID Code des Tags; siehe <gg/sgml.h> */ + int match_mode; /* Art des Tag Name Vergleichs */ + int tag_type; /* Art des Tags */ + long tag_weight; /* Wichtung des Tags */ + char *tag_comment; /* comment about that tag, if present */ +} ; + +#define TAG_TYPE_recursive 1 +#define TAG_TYPE_nonrecursive 2 +#define TAG_TYPE_endtag 3 +#define TAG_TYPE_autonomous 4 +#define TAG_TYPE_HTML 5 + +/* ------------------------------------------------------------------------ */ +struct TEXT_SEGMENT /* logisch zusammenhaengender Textabschnitt */ +{ /* ... fragmentiert in einzelne Segmente */ + long sig; /* Signatur: SIG_TEXT_SEGMENT */ + struct TEXT_SEGMENT *TSEG_next; + long TSEG_text_lng; /* Laenge des verwendeten Textes */ + char TSEG_text_array [2]; /* abgespeicherter Text */ +} ; + +/* ------------------------------------------------------------------------ */ +struct TEXT_ELEMENT /* textliches Element: entweder getaggter */ +{ /* Text oder Tag-Text */ + long sig; /* Signatur: SIG_TEXT_ELEMENT */ + struct TEXT_ELEMENT *TE_next; + + int TE_type; /* what kind of element there is */ +#define TEt_text 0 /* element is a piece of normal text */ +#define TEt_tag 1 /* element is a tag */ +#define TEt_declaration 2 /* element contains a declaration */ +#define TEt_processing 3 /* element contains processing instructions */ + + char *TE_tag_name; /* Tag Name */ + struct ATTRIBUTE_LIST + *TE_attributes; + struct TEXT_SEGMENT /* Folge von logischen zusammenhaengenden */ + *TE_text_segment; /* Text Segmenten */ + struct TAG_DEFINITION /* Tag Definition, sobald diese bekannt ist */ + *TE_tag_definition; + + long TE_level; /* level==0: (getaggter) Text */ + /* level==1: Text innerhalb von <..> */ + /* sonst: z.Z. nicht vorgesehen!!! */ + long TE_link_count; /* number of references to this element */ + long TE_cat_flags; + long TE_text_lng; /* Laenge aller Textsegmente */ + +} ; + +/* BEGIN 1995-12-21 10:52:19 ---------------------------------------------- */ +struct ATTRIBUTE_DECLARATION_LIST +{ + struct ATTRIBUTE_DECLARATION_LIST *ADL_next; + + char *ADL_name; + struct TEXT_ELEMENT *ADL_te; +} ; + +/* ------------------------------------------------------------------------ */ +struct ELEMENT_DECLARATION +{ + char *ED_name; + int ED_omit_start_tag; /* 1 -> start tag is omissible */ + int ED_omit_end_tag; /* 1 -> end tag is omissible */ + + struct ATTRIBUTE_DECLARATION_LIST *ED_adl; + struct TEXT_ELEMENT *ED_te; +} ; + +/* ------------------------------------------------------------------------ */ +struct ELEMENT_DECLARATION_LIST +{ + struct ELEMENT_DECLARATION_LIST *EDL_next; + struct ELEMENT_DECLARATION *EDL; +} ; +/* END 1995-12-21 10:52:19 ------------------------------------------------ */ + +/* ------------------------------------------------------------------------ */ +struct MARKUP /* logisch zusammengehoeriger Abschnitt */ +{ /* Textes; mit Start Tag und End Tag */ + long sig; /* Markus Signatur: SIG_MARKUP */ + struct MARKUP *M_next; /* guess what? */ + struct TAG_DEFINITION *tag_definition; /* TAG des Start Tags */ + struct TEXT_ELEMENT *tag_open; /* Start Tag mit allem drum und dran */ + struct TEXT_ELEMENT *tagged_text; /* in der Liste des getaggten Text */ + /* koennen auch wieder Markups sein */ + struct TEXT_ELEMENT *tag_close; /* End Tag */ +} ; +/* Anmerkung: Start Tag und End Tag koennen unter Umstaenden ausgelassen */ +/* werden. Die Art des Markups wird in von irgendeiner Prozessorstufe */ +/* in struct TAG_DEFINITION *tag_definition eingetragen, sodass die Art */ +/* des Markups ersichtlich ist. */ + +/* ------------------------------------------------------------------------ */ +struct HYX_PARSER_CONTEXT /* pushed parser status */ +{ /* this is a stack!!! */ + /* used for recursive SGML structs */ + struct HYX_PARSER_CONTEXT *HPC_next; /* next context frame in stack */ + + int HPC_state; +} ; + +/* ------------------------------------------------------------------------ */ +struct HYX_PARSER_CLASS /* definitions about the parser in */ +{ /* a meta level */ + /* content model and tag definitions */ + struct TAG_DEFINITION *HPC_tag_list; + struct TAG_DEFINITION **HPC_tag_append; + + struct YTREE *HPC_tags; + /* note: the hash list for tag names can be used if exact tag names are */ + /* searched */ + + + /* DTD Class Options */ + int HPC_tag_open; /* tag open character */ + int HPC_tag_close; /* tag close character */ + int HPC_entity_open; /* enitity open character */ + int HPC_entity_close; /* enitity close character */ + int HPC_declaration_start; /* mdo char */ + int HPC_processing_start; /* processing instr. start */ + int HPC_minimization_char; /* character used for minimization */ + + char *HPC_entity_tag_open; /* string to use as tag open entity */ + char *HPC_entity_tag_close; + char *HPC_entity_entity_open; + + /* processing options */ + int HPC_po_strip; /* strip text segments */ + int HPC_po_id_tag; /* identify tag */ + + /* runtime characteristics */ + long HPC_next_tag_id; + + /* statistics */ + long HPC_TAG_DEFINITION_allocated; + int HPC_debug_flags; + int HPC_meta_flags; +#define HPC_META_HTML 0x0001 +#define HPC_META_show_new_tags 0x0002 +} ; + +/* ------------------------------------------------------------------------ */ +struct HYX_PARSER_STATUS +{ + struct HYX_PARSER_CLASS *HPS_hpc; /* DTD class options */ + + long HPS_segment_length; /* number of bytes in segment sofar */ + long HPS_parser_level; /* 0: currently processing text */ + /* 1: currently processing tag */ + + int HPS_level_changed; /* switch from tag to text or back */ + + +#define MAX_SEGMENT_LENGTH 2048 + char HPS_segment [MAX_SEGMENT_LENGTH];/* buffer for new text segment */ + + struct TEXT_ELEMENT *HPS_tx_last; /* last created text element list */ + struct TEXT_ELEMENT *HPS_tx_list; /* newly created text element list */ + struct TEXT_ELEMENT **HPS_ptx; /* append possition to list */ + struct TEXT_SEGMENT **HPS_ptxs; /* append possition for *segments* */ + int HPS_text_alloc_flag; /* text element already allocated */ + + int HPS_minimization_seen; /* text is within minimization */ + int HPS_white_spaces; /* number of white spaces seen */ + + /* items from <gg/ta.h> */ + int HPS_last_cat_code; /* last text category code */ + long HPS_cat_flags; /* text category flags */ + long HPS_tx_cnt; /* number of elements in tx_list */ + + int HPS_element_type; /* type of TEXT_ELEMENT */ + + /* operation state for recursive SGML strutures */ + int HPS_state; /* opaque state identifier */ + struct HYX_PARSER_CONTEXT *HPS_ctx; /* context frame pointer */ + int HPS_cnt; /* context frame counter */ + + int HPS_other_quote; +} ; + +/* ------------------------------------------------------------------------ */ +struct ENTRY_DESCRIPTOR /* information about an lexicon entry */ +{ /* while processed in memory */ + struct TEXT_ELEMENT *ED_te; /* data of lexicon entry */ + long ED_index; /* index of lexicon entry */ + char *ED_frame_name; /* strdup'ed name of the frame */ + int ED_status; +#define ED_stat_is_new 0 +#define ED_stat_from_LUT 1 /* Entry was generated while processing */ + /* a YTREE node, it was read from a LUT */ + /* or XFN file. */ +} ; + +/* ------------------------------------------------------------------------ */ +struct ENTRY_QUEUE +{ + struct ENTRY_QUEUE *EQ_next; /* list to form the queue */ + struct ENTRY_DESCRIPTOR *EQ_ed; + int EQ_is_dirty; +} ; + +/* ------------------------------------------------------------------------ */ +struct LEXICON_GLOBAL_CONTROL /* see also HYX_CLUSTER_CONTROL */ +{ + /* entry queue: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + int LGC_queue_size; /* max number of elements allowed */ + /* in queue, flush if more in q. */ + int LGC_EQ_count; /* number of elements already in q. */ + struct ENTRY_QUEUE *LGC_EQ_first; /* begin of the queue */ + struct ENTRY_QUEUE **LGC_EQ_append; /* position to append to queue */ +} ; + +/* ------------------------------------------------------------------------ */ +struct LEXICON_CONTROL /* see also HYX_CLUSTER_CONTROL */ +{ + struct LEXICON_GLOBAL_CONTROL *LC_lgc; + + /* processing options: - - - - - - - - - - - - - - - - - - - - - - - - - */ + int LC_do_strip; /* strip white space in text */ + /* NOTE: in tags, always strip */ + int LC_write_nl; /* write LF after text */ + + int LC_end_tag_count; +#define MAX_LC_END_TAGS 8 + long LC_end_tags [MAX_LC_END_TAGS]; + + char *LC_head_tag_str; /* tag to be added to entry */ + char *LC_tail_tag_str; /* tag to be appended to entry */ +} ; + +/* ------------------------------------------------------------------------ */ +struct LEXICON_INDEX +{ + long LEXI_begin; /* begin offset of entry in the cluster */ + long LEXI_end; /* end offset */ + long LEXI_cluster_number; /* number of the cluster */ +} ; + +/* ------------------------------------------------------------------------ */ +#ifdef _HYX_CLUSTER_CONTROL_DEFINED +struct LEX_SESSION +{ + struct HYX_CLUSTER_CONTROL *LEXS_hcc; + struct LEXICON_CONTROL *LEXS_lcc; + struct HYX_PARSER_CLASS *LEXS_hpc; + struct HYX_PARSER_STATUS *LEXS_hps; + long LEXS_record_counter; + struct TEXT_ELEMENT *LEXS_tx_new_entry; +} ; +#endif /* _HYX_CLUSTER_CONTROL_DEFINED */ + +/* methods: --------------------------------------------------------------- */ +typedef int hyx_output_processor (void *cd, struct TEXT_ELEMENT *te); + +/* ------------------------------------------------------------------------ */ +struct HYX_OUTPUT_DESCRIPTOR +{ + long HOD_signature; /* SIG_OUTPUT_DESCRIPTOR */ + + char *HOD_buffer; + int HOD_buffer_size; + int HOD_buffer_index; + + void *HOD_client_data; + hyx_output_processor *HOD_output_processor; + /* HOD_output_processor's argument is a HYX_OUTPUT_DESCRIPTOR structure! */ +} ; + +/* Lexicon Tag IDs: ------------------------------------------------------- */ +#define LEX_sTAG_LE 0x0201 +#define LEX_eTAG_LE 0x0202 +#define LEX_sTAG_LM 0x0203 +#define LEX_eTAG_LM 0x0204 +#define LEX_sTAG_LX 0x0205 +#define LEX_eTAG_LX 0x0206 + +/* DICTADD operation modes: ----------------------------------------------- */ +#define DAMODE_MERGE 0 /* merge entry with new one */ +#define DAMODE_REPLACE 1 /* replace entry by new one */ +#define DAMODE_DIVIDE1 2 /* divide according to one key char */ +#define DAMODE_DIVIDE2 3 /* divide according to two key chars */ +#define DAMODE_DIVIDE3 4 /* divide according to three key chars */ +#define DAMODE_LOOKUP 5 /* just get the entry from the lexicon */ +#define DAMODE_CHECK 9 /* check: test new entries */ + +/* DICTADD frame name modes: ---------------------------------------------- */ +#define DAFNM_md5 0 /* generate MD5 string for frame name */ +#define DAFNM_entry_key 1 /* use entry key as frame name */ +#define DAFNM_index 2 /* use index as frame name */ + +/* macros: ---------------------------------------------------------------- */ +#define hyx_new_lexicon_control() \ + ((struct LEXICON_CONTROL *) calloc (sizeof (struct LEXICON_CONTROL), 1)) + +#define hyx_new_lexicon_global_control() \ + ((struct LEXICON_GLOBAL_CONTROL *) \ + calloc (sizeof (struct LEXICON_GLOBAL_CONTROL), 1)) + +#define hyx_new_entry_queue() \ + ((struct ENTRY_QUEUE *) calloc (sizeof (struct ENTRY_QUEUE), 1)) + +#define hyx_new_markup() \ + ((struct MARKUP *) calloc (sizeof (struct MARKUP), 1)) + +#define hyx_new_tag_definition() \ + ((struct TAG_DEFINITION *) calloc (sizeof (struct TAG_DEFINITION), 1)) + +#define hyx_new_parser_class() \ + ((struct HYX_PARSER_CLASS *) calloc (sizeof (struct HYX_PARSER_CLASS), 1)) + +#define hyx_new_parser_status() \ + ((struct HYX_PARSER_STATUS *) calloc (sizeof (struct HYX_PARSER_STATUS), 1)) + +/* prototypes: ------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +/* parse007.c */ void cdecl print_text_element_list (FILE *fo, + struct TEXT_ELEMENT *t); +/* parse008.c */ int cdecl print_text_segment_list (FILE *fo, + struct TEXT_SEGMENT *ts); +/* parsd008.c */ int cdecl diag_print_text_segment_list (FILE *fo, + struct TEXT_SEGMENT *ts); +#endif /* _FILE_DEFINED */ +/* parse014.c */ int cdecl key_string_transform (char *s, int lng); +#ifdef _FILE_DEFINED +/* parse016.c */ void display_text_element (FILE *fo, + struct TEXT_ELEMENT *t, char *txt, int strip); +/* parsd016.c */ void cdecl display_markup (FILE *fo, + struct HYX_PARSER_CLASS *hpc, + struct TEXT_ELEMENT *t, int indent, int verbosity, + int append_eoln, int strip); +/* parsd016.c */ void diag_display_text_element (FILE *fo, + struct TEXT_ELEMENT *t, char *txt, int strip); +/* parsd016.c */ void cdecl diag_display_markup (FILE *fo, + struct HYX_PARSER_CLASS *hpc, + struct TEXT_ELEMENT *t, int indent, int verbosity, + int append_eoln, int strip); +/* parse017.c */ void cdecl display_tag_definition (FILE *fo, + struct TAG_DEFINITION *td); +#endif /* _FILE_DEFINED */ +/* parse019.c */ int cdecl parse_tag_sequence (char *tag_str, + char *parse_string_array, char *pt_array [], + int pt_type [], int pt_max); +#define TAG_ITEM_TAG 1 +#define TAG_ITEM_PARAMETER 2 +#define TAG_ITEM_ATTR_NAME 3 +#define TAG_ITEM_ATTR_VALUE 4 + +#ifdef _FILE_DEFINED +/* parse021.c */ void cdecl dump_text_element_list (FILE *fo, + struct TEXT_ELEMENT *t); +/* parse022.c */ int dump_text_segment_list (FILE *fo, + struct TEXT_SEGMENT *ts); +#endif /* _FILE_DEFINED */ + +/* ------------------------------------------------------------------------ */ +#ifdef _HYX_CLUSTER_CONTROL_DEFINED +/* dictadd1.c */ int cdecl dict_add_file ( + struct HYX_PARSER_CLASS *hpc, + struct HYX_CLUSTER_CONTROL *hcc, + struct LEXICON_CONTROL *lcc, char *fn, int verbose_level); +#endif /* _HYX_CLUSTER_CONTROL_DEFINED */ + +/* dictadd2.c */ long cdecl dict_restructure_new_entry ( + struct HYX_PARSER_CLASS *hpc, + struct TEXT_ELEMENT **tx_list, char *key_string, + int key_string_length, int do_strip, + struct TEXT_ELEMENT *insert_head, + struct TEXT_ELEMENT *insert_tail); + +#ifdef _HYX_CLUSTER_CONTROL_DEFINED +/* dictadd3.c */ int cdecl dict_update_entry ( + struct HYX_PARSER_CLASS *hpc, + struct HYX_CLUSTER_CONTROL *hcc, + struct LEXICON_CONTROL *lcc, char *frame_name, + struct TEXT_ELEMENT *tx_new_entry, + hyx_output_processor *op, void *op_client_data, + int verbose_level); +#endif /* _HYX_CLUSTER_CONTROL_DEFINED */ + +/* dictadd4.c */ int cdecl write_lexicon_entry (char *lexicon_file, + char *index_file, long *framme_index, char *entry_key, + struct TEXT_ELEMENT *lexicon_entry, + long *next_index, int write_nl); +#ifdef _FILE_DEFINED +/* dictadd6.c */ int cdecl write_lexicon_text (FILE *fhyx, + struct TEXT_ELEMENT *le, int write_nl); +#endif /* _FILE_DEFINED */ +/* dictadd8.c */ int cdecl dict_purge_entry (struct TEXT_ELEMENT **tx_list, + long purge_tags [], int purge_tags_flags [], + int purge_tags_cnt); +/* dictadd9.c */ int cdecl dict_combine_entries (struct TEXT_ELEMENT **tx_old, + struct TEXT_ELEMENT **tx_new); + +/* ------------------------------------------------------------------------ */ +/* dict0001.c */ char *cdecl get_divided_lexicon (char *base_name, + int divide_mode, char *entry_key); + +/* dict0002.c */ int cdecl dict_check_integrity ( + struct HYX_PARSER_CLASS *hpc); + +#ifdef _FILE_DEFINED +/* dict0003.c */ int cdecl write_lexicon_frame (FILE *fhyx, char *frame_name, + struct TEXT_ELEMENT *lexicon_entry, int write_nl); +#endif /* _FILE_DEFINED */ + +#ifdef _HYX_CLUSTER_CONTROL_DEFINED +/* dict0004.c */ int cdecl dict_add_init (struct HYX_CLUSTER_CONTROL *hcc); +/* dict0005.c */ int cdecl dict_add_finish (struct HYX_CLUSTER_CONTROL *hcc, + struct LEXICON_CONTROL *lcc); +#endif /* _HYX_CLUSTER_CONTROL_DEFINED */ + +#ifdef _FILE_DEFINED +/* dict0006.c */ void cdecl memory_statistics (FILE *fo, long record_counter); +#endif /* _FILE_DEFINED */ + +#ifdef _YTREE_DEFINED +/* dict0007.c */ int cdecl ytree_index_to_entry_descriptor ( + struct YTREE *yt_node, void *client_data); +/* dict0008.c */ int cdecl ytree_entry_descriptor_to_index ( + struct YTREE *yt_node, void *client_data); +#endif /* _YTREE_DEFINED */ + +/* dict0009.c */ int cdecl dict_queue (struct LEXICON_CONTROL *lcc, + struct ENTRY_DESCRIPTOR *ed, int mark_dirty); +#ifdef _HYX_CLUSTER_CONTROL_DEFINED +/* dict0010.c */ int cdecl dict_flush_queue (struct HYX_CLUSTER_CONTROL *hcc, + struct LEXICON_CONTROL *lcc); +#endif /* _HYX_CLUSTER_CONTROL_DEFINED */ + +#ifdef _YTREE_DEFINED +/* dict0011.c */ int cdecl dict_write_xfn_entry (struct YTREE *yt_node, + void *client_data); +#endif /* _YTREE_DEFINED */ + +#ifdef _HYX_CLUSTER_CONTROL_DEFINED +/* dict0012.c */ int cdecl dict_read_setup_file ( + struct HYX_CLUSTER_CONTROL *hcc, char *fn, + char *line, int MAX_LINE, char **tag_definition); +/* dict0013.c */ char *cdecl dict_get_frame_name ( + struct HYX_CLUSTER_CONTROL *hcc, + char *entry_key, char *index_str); +#endif /* _HYX_CLUSTER_CONTROL_DEFINED */ + +/* dict0014.c */ long cdecl dict_restructure2_entry ( + struct HYX_PARSER_CLASS *hpc, + struct LEXICON_CONTROL *lcc, + struct TEXT_ELEMENT **tx_new_entry, + char *entry_key, int entry_key_size); + +#ifdef _HYX_CLUSTER_CONTROL_DEFINED +/* dict0015.c */ int cdecl dict_process_entry ( + struct HYX_PARSER_CLASS *hpc, + struct HYX_CLUSTER_CONTROL *hcc, + struct LEXICON_CONTROL *lcc, + struct TEXT_ELEMENT *tx_new_entry, + hyx_output_processor *op, void *op_client_data, + int verbose_level); +#endif /* _HYX_CLUSTER_CONTROL_DEFINED */ + +#ifdef _DYNAMIC_BLOCK_DEFINED +/* dict0016.c */ int cdecl hyx_unroll_text (struct DYNAMIC_BLOCK *dyb, + struct TEXT_ELEMENT *t, int indent, int verbosity, + int append_eoln); +/* dict0017.c */ /* unroll tag defintion */ +/* dict0018.c */ int cdecl hyx_unroll_text_segment_list ( + struct DYNAMIC_BLOCK *dyb, struct TEXT_SEGMENT *ts); +#endif /* _DYNAMIC_BLOCK_DEFINED */ + +/* %ds/hyxp/ hyx parser package: ------------------------------------------ */ +/* hyxp0001.c */ struct HYX_PARSER_STATUS *cdecl hyx_parser_reset ( + struct HYX_PARSER_CLASS *hpc); +/* hyxp0002.c */ struct TEXT_ELEMENT *cdecl hyx_parse_char ( + struct HYX_PARSER_STATUS *lps, int ch); +#define hyx_parser_get_text_list(lps) ((lps)->HPS_tx_list) + +/* hyxp0003.c */ int cdecl hyx_parse2_char (struct HYX_PARSER_STATUS *hps, + struct TEXT_ELEMENT **le, int ch, long end_tags [], + int end_tag_count); + +#ifdef _FILE_DEFINED +/* hyxp0004.c */ int cdecl hyx_parse1_file (struct HYX_PARSER_CLASS *hpc, + FILE *fhyx, struct TEXT_ELEMENT **le, long end_tags[], + int end_tag_count, long max_to_read, long *bytes_read); +/* hyxp0005.c */ int cdecl hyx_parse2_file ( + struct HYX_PARSER_STATUS *hps, + FILE *fhyx, struct TEXT_ELEMENT **le, long end_tags[], + int end_tag_count, long max_to_read, long *bytes_read); +#endif /* _FILE_DEFINED */ + +/* hyxp0006.c */ int cdecl hyx_parse1_string ( struct HYX_PARSER_CLASS *hpc, + char *str, struct TEXT_ELEMENT **le, long end_tags [], + int end_tag_count, long max_to_read, long *bytes_read); + +/* hyxp0007.c */ int cdecl hyx_parse2_string ( + struct HYX_PARSER_STATUS *hps, + char *str, struct TEXT_ELEMENT **le, long end_tags [], + int end_tag_count, long max_to_read, long *bytes_read); +/* hyxp0008.c */ int cdecl hyx_parse2_block (struct HYX_PARSER_STATUS *hps, + char *str, struct TEXT_ELEMENT **le, long end_tags [], + int end_tag_count, long max_to_read, long *bytes_read); +/* hyxp0009.c */ struct TEXT_SEGMENT *cdecl hyx_mktx_segm (char *s, + long lng); +/* hyxp0010.c */ struct TEXT_ELEMENT *cdecl hyx_mktx_elem (long lev, int typ); +/* hyxp0011.c */ struct TEXT_ELEMENT *cdecl hyx_mktx_elem_and_segm ( + struct HYX_PARSER_CLASS *hpc, char *str, long lng, + long level, int typ, int get_tag_def, int append); +/* hyxp0012.c */ int cdecl hyx_frtx_elem_list ( + struct TEXT_ELEMENT *t1); +/* hyxp0013.c */ int cdecl hyx_frtx_segm_list ( + struct TEXT_SEGMENT *ts1); +/* hyxp0014.c */ int cdecl hyx_strip_text_elem (struct TEXT_ELEMENT *t); +/* hyxp0015.c */ struct MARKUP *cdecl hyx_make_markup ( + struct HYX_PARSER_CLASS *hpc, void *start_tag, + void *marked_text, void *stop_tag, + struct TAG_DEFINITION *tag_def, int flags); +/* hyxp0016.c */ int cdecl hyx_text_to_markup ( + struct HYX_PARSER_CLASS *hpc, + struct TEXT_ELEMENT *tx_list, struct MARKUP **pmarkup); + +/* hyxp0017.c */ int cdecl hyx_copy_tx_segm_list (char *dest, int size, + struct TEXT_SEGMENT *ts); +/* hyxp0018.c */ struct TEXT_ELEMENT *cdecl hyx_append_tx_elem_list ( + struct TEXT_ELEMENT **d, struct TEXT_ELEMENT *s); +/* hyxp0019.c */ struct TEXT_ELEMENT **cdecl hyx_find_last_tx_elem_ptr ( + struct TEXT_ELEMENT **d); +/* hyxp0020.c */ long cdecl hyx_tx_segm_count_char ( + struct TEXT_SEGMENT *ts, int code); +/* hyxp0021.c */ struct TEXT_ELEMENT *cdecl hyx_parse_block ( + struct HYX_PARSER_STATUS *lps, + char *block, long size); +/* hyxp0022.c */ struct TEXT_ELEMENT *cdecl hyx_parse_string ( + struct HYX_PARSER_STATUS *lps, char *string); + +/* hyxp0023.c */ int cdecl hyx_parse_hyx_frame ( + struct HYX_PARSER_CLASS *hpc, + char *lexicon_file, + char *index_file, long frame_index, + struct TEXT_ELEMENT **lexicon_entry, + long end_tags [], int num_end_tags); + +#ifdef _FILE_DEFINED +/* hyxp0024.c */ int cdecl hyx_parse_hyx_frame_file ( + struct HYX_PARSER_CLASS *hpc, + FILE *fhyx, FILE *fidx, + long frame_index, struct TEXT_ELEMENT **lexicon_entry, + long end_tags [], int num_end_tags); +#endif /* _FILE_DEFINED */ + +/* hyxp0025.c */ int cdecl hyx_transfer_details ( + struct HYX_PARSER_STATUS *hps, struct TEXT_ELEMENT *tt); +/* hyxp0026.c */ int cdecl hyx_parser_add_char ( + struct HYX_PARSER_STATUS *lps, int ch); +/* hyxp0027.c */ struct TEXT_ELEMENT *cdecl hyx_parser_finish ( + struct HYX_PARSER_STATUS *hps); +/* hyxp0028.c */ struct TEXT_SEGMENT *cdecl hyx_parser_finish_segment ( + struct HYX_PARSER_STATUS *lps); +/* hyxp0029.c */ struct HYX_PARSER_CLASS *cdecl hyx_init_parser_class (void); + +/* hyxp0030.c */ int cdecl hyx_read_tag_definition ( + struct HYX_PARSER_CLASS *hpc, char *fn); +/* hyxp0031.c */ int cdecl hyx_process_tag_definition ( + struct HYX_PARSER_CLASS *hpc, char *line); +/* hyxp0032.c */ struct TAG_DEFINITION *cdecl hyx_identify_tag ( + struct HYX_PARSER_CLASS *hpc, char *str, int append); + int hyx_copy_tag (char *src, char *dst, int size, int lower); +/* hyxp0033.c */ struct TAG_DEFINITION *cdecl hyx_make_tag_definition ( + struct HYX_PARSER_CLASS *hpc, char *str, long id, + int mm, long weight, int ty, char *comment); +/* hyxp0034.c */ struct TAG_DEFINITION *cdecl hyx_find_tag_definition ( + struct HYX_PARSER_CLASS *hpc, char *str); +/* hyxp0035.c */ long cdecl hyx_get_tag_definition ( + struct HYX_PARSER_CLASS *hpc, struct TEXT_ELEMENT *tx, + int append); + +/* hyx ta parser package: ------------------------------------------------- */ +/* hyxta001.c */ int cdecl hyx_ta_parse_char (struct HYX_PARSER_STATUS *hps, + int ch, struct TEXT_ELEMENT **generated_node); +/* hyxta002.c */ int cdecl hyx_ta_parse_flush ( + struct HYX_PARSER_CLASS *hpc, + struct HYX_PARSER_STATUS *hps, + struct TEXT_ELEMENT **generated_node); + +/* hyxta003.c */ int cdecl hyx_ta_get_break_code (int last_cat_code, + int act_cat_code); + int cdecl hyx_ta_break_table_init (int mode); + void cdecl hyx_ta_break_table_dump (char *s); + void cdecl hyx_ta_break_table_overlay (int pairs [], + int cnt, int code); + int cdecl hyx_ta_set_break_code (int last_cat_code, + int act_cat_code, int code); + +/* hyxta004.c */ long cdecl hyx_ta_get_cat_flags (int cat); + int cdecl hyx_ta_set_cat_flags (int cat, long catf); +/* hyxta005.c */ long cdecl hyx_ta_parse_file (struct HYX_PARSER_STATUS *hps, + char *fn, long pos_offset, long max_to_read); + +#ifdef _FILE_DEFINED +/* hyxta006.c */ long cdecl hyx_ta_parse_stream ( + struct HYX_PARSER_CLASS *hpc, + struct HYX_PARSER_STATUS *hps, + FILE *fi, long max_to_read); +#endif /* _FILE_DEFINED */ + +/* hyxta007.c */ int cdecl hyx_ta_store_node ( + struct HYX_PARSER_CLASS *hpc, + struct HYX_PARSER_STATUS *hps, + struct TEXT_ELEMENT *node); +/* hyxta008.c */ struct TAG_DEFINITION *cdecl hyx_ta_find_tag_definition ( + struct HYX_PARSER_CLASS *hpc, + long cat_flags); + +#endif /* __GG_parse__ */ diff --git a/lib/include/gg/pc_8859.ci b/lib/include/gg/pc_8859.ci new file mode 100644 index 0000000000000000000000000000000000000000..e577e321214a8fd407be63fdefdc84f2f9c3997b --- /dev/null +++ b/lib/include/gg/pc_8859.ci @@ -0,0 +1,71 @@ +/* + * conversion table + * from: pc437, ascii + * to: iso8859_1, ascii + * as generated on 1997-02-08/21:44:29 + * + */ +/*0x00*/ 0x00000000,/*0x01*/ 0x00000001,/*0x02*/ 0x00000002,/*0x03*/ 0x00000003, +/*0x04*/ 0x00000004,/*0x05*/ 0x00000005,/*0x06*/ 0x00000006,/*0x07*/ 0x00000007, +/*0x08*/ 0x00000008,/*0x09*/ 0x00000009,/*0x0A*/ 0x0000000A,/*0x0B*/ 0x0000000B, +/*0x0C*/ 0x0000000C,/*0x0D*/ 0x0000000D,/*0x0E*/ 0x0000000E,/*0x0F*/ 0x0000000F, +/*0x10*/ 0x00000010,/*0x11*/ 0x00000011,/*0x12*/ 0x00000012,/*0x13*/ 0x00000013, +/*0x14*/ 0x00000014,/*0x15*/ 0x00000015,/*0x16*/ 0x00000016,/*0x17*/ 0x00000017, +/*0x18*/ 0x00000018,/*0x19*/ 0x00000019,/*0x1A*/ 0x0000001A,/*0x1B*/ 0x0000001B, +/*0x1C*/ 0x0000001C,/*0x1D*/ 0x0000001D,/*0x1E*/ 0x0000001E,/*0x1F*/ 0x0000001F, +/*0x20*/ 0x00000020,/*0x21*/ 0x00000021,/*0x22*/ 0x00000022,/*0x23*/ 0x00000023, +/*0x24*/ 0x00000024,/*0x25*/ 0x00000025,/*0x26*/ 0x00000026,/*0x27*/ 0x00000027, +/*0x28*/ 0x00000028,/*0x29*/ 0x00000029,/*0x2A*/ 0x0000002A,/*0x2B*/ 0x0000002B, +/*0x2C*/ 0x0000002C,/*0x2D*/ 0x0000002D,/*0x2E*/ 0x0000002E,/*0x2F*/ 0x0000002F, +/*0x30*/ 0x00000030,/*0x31*/ 0x00000031,/*0x32*/ 0x00000032,/*0x33*/ 0x00000033, +/*0x34*/ 0x00000034,/*0x35*/ 0x00000035,/*0x36*/ 0x00000036,/*0x37*/ 0x00000037, +/*0x38*/ 0x00000038,/*0x39*/ 0x00000039,/*0x3A*/ 0x0000003A,/*0x3B*/ 0x0000003B, +/*0x3C*/ 0x0000003C,/*0x3D*/ 0x0000003D,/*0x3E*/ 0x0000003E,/*0x3F*/ 0x0000003F, +/*0x40*/ 0x00000040,/*0x41*/ 0x00000041,/*0x42*/ 0x00000042,/*0x43*/ 0x00000043, +/*0x44*/ 0x00000044,/*0x45*/ 0x00000045,/*0x46*/ 0x00000046,/*0x47*/ 0x00000047, +/*0x48*/ 0x00000048,/*0x49*/ 0x00000049,/*0x4A*/ 0x0000004A,/*0x4B*/ 0x0000004B, +/*0x4C*/ 0x0000004C,/*0x4D*/ 0x0000004D,/*0x4E*/ 0x0000004E,/*0x4F*/ 0x0000004F, +/*0x50*/ 0x00000050,/*0x51*/ 0x00000051,/*0x52*/ 0x00000052,/*0x53*/ 0x00000053, +/*0x54*/ 0x00000054,/*0x55*/ 0x00000055,/*0x56*/ 0x00000056,/*0x57*/ 0x00000057, +/*0x58*/ 0x00000058,/*0x59*/ 0x00000059,/*0x5A*/ 0x0000005A,/*0x5B*/ 0x0000005B, +/*0x5C*/ 0x0000005C,/*0x5D*/ 0x0000005D,/*0x5E*/ 0x0000005E,/*0x5F*/ 0x0000005F, +/*0x60*/ 0x00000060,/*0x61*/ 0x00000061,/*0x62*/ 0x00000062,/*0x63*/ 0x00000063, +/*0x64*/ 0x00000064,/*0x65*/ 0x00000065,/*0x66*/ 0x00000066,/*0x67*/ 0x00000067, +/*0x68*/ 0x00000068,/*0x69*/ 0x00000069,/*0x6A*/ 0x0000006A,/*0x6B*/ 0x0000006B, +/*0x6C*/ 0x0000006C,/*0x6D*/ 0x0000006D,/*0x6E*/ 0x0000006E,/*0x6F*/ 0x0000006F, +/*0x70*/ 0x00000070,/*0x71*/ 0x00000071,/*0x72*/ 0x00000072,/*0x73*/ 0x00000073, +/*0x74*/ 0x00000074,/*0x75*/ 0x00000075,/*0x76*/ 0x00000076,/*0x77*/ 0x00000077, +/*0x78*/ 0x00000078,/*0x79*/ 0x00000079,/*0x7A*/ 0x0000007A,/*0x7B*/ 0x0000007B, +/*0x7C*/ 0x0000007C,/*0x7D*/ 0x0000007D,/*0x7E*/ 0x0000007E,/*0x7F*/ 0x0000007F, +/*0x80*/ 0x00000080,/*0x81*/ 0x00000081,/*0x82*/ 0x00000082,/*0x83*/ 0x00000083, +/*0x84*/ 0x00000084,/*0x85*/ 0x00000085,/*0x86*/ 0x00000086,/*0x87*/ 0x00000087, +/*0x88*/ 0x00000088,/*0x89*/ 0x00000089,/*0x8A*/ 0x0000008A,/*0x8B*/ 0x0000008B, +/*0x8C*/ 0x0000008C,/*0x8D*/ 0x0000008D,/*0x8E*/ 0x0000008E,/*0x8F*/ 0x0000008F, +/*0x90*/ 0x00000090,/*0x91*/ 0x00000091,/*0x92*/ 0x00000092,/*0x93*/ 0x00000093, +/*0x94*/ 0x00000094,/*0x95*/ 0x00000095,/*0x96*/ 0x00000096,/*0x97*/ 0x00000097, +/*0x98*/ 0x00000098,/*0x99*/ 0x00000099,/*0x9A*/ 0x0000009A,/*0x9B*/ 0x0000009B, +/*0x9C*/ 0x0000009C,/*0x9D*/ 0x0000009D,/*0x9E*/ 0x0000009E,/*0x9F*/ 0x0000009F, +/*0xA0*/ 0x000000A0,/*0xA1*/ 0x000000A1,/*0xA2*/ 0x000000A2,/*0xA3*/ 0x000000A3, +/*0xA4*/ 0x000000A4,/*0xA5*/ 0x000000A5,/*0xA6*/ 0x000000A6,/*0xA7*/ 0x000000A7, +/*0xA8*/ 0x000000A8,/*0xA9*/ 0x000000A9,/*0xAA*/ 0x000000AA,/*0xAB*/ 0x000000AB, +/*0xAC*/ 0x000000AC,/*0xAD*/ 0x000000AD,/*0xAE*/ 0x000000AE,/*0xAF*/ 0x000000AF, +/*0xB0*/ 0x000000B0,/*0xB1*/ 0x000000B1,/*0xB2*/ 0x000000B2,/*0xB3*/ 0x000000B3, +/*0xB4*/ 0x000000B4,/*0xB5*/ 0x000000B5,/*0xB6*/ 0x000000B6,/*0xB7*/ 0x000000B7, +/*0xB8*/ 0x000000B8,/*0xB9*/ 0x000000B9,/*0xBA*/ 0x000000BA,/*0xBB*/ 0x000000BB, +/*0xBC*/ 0x000000BC,/*0xBD*/ 0x000000BD,/*0xBE*/ 0x000000BE,/*0xBF*/ 0x000000BF, +/*0xC0*/ 0x000000C0,/*0xC1*/ 0x000000C1,/*0xC2*/ 0x000000C2,/*0xC3*/ 0x000000C3, +/*0xC4*/ 0x000000C4,/*0xC5*/ 0x000000C5,/*0xC6*/ 0x000000C6,/*0xC7*/ 0x000000C7, +/*0xC8*/ 0x000000C8,/*0xC9*/ 0x000000C9,/*0xCA*/ 0x000000CA,/*0xCB*/ 0x000000CB, +/*0xCC*/ 0x000000CC,/*0xCD*/ 0x000000CD,/*0xCE*/ 0x000000CE,/*0xCF*/ 0x000000CF, +/*0xD0*/ 0x000000D0,/*0xD1*/ 0x000000D1,/*0xD2*/ 0x000000D2,/*0xD3*/ 0x000000D3, +/*0xD4*/ 0x000000D4,/*0xD5*/ 0x000000D5,/*0xD6*/ 0x000000D6,/*0xD7*/ 0x000000D7, +/*0xD8*/ 0x000000D8,/*0xD9*/ 0x000000D9,/*0xDA*/ 0x000000DA,/*0xDB*/ 0x000000DB, +/*0xDC*/ 0x000000DC,/*0xDD*/ 0x000000DD,/*0xDE*/ 0x000000DE,/*0xDF*/ 0x000000DF, +/*0xE0*/ 0x000000E0,/*0xE1*/ 0x000000E1,/*0xE2*/ 0x000000E2,/*0xE3*/ 0x000000E3, +/*0xE4*/ 0x000000E4,/*0xE5*/ 0x000000E5,/*0xE6*/ 0x000000E6,/*0xE7*/ 0x000000E7, +/*0xE8*/ 0x000000E8,/*0xE9*/ 0x000000E9,/*0xEA*/ 0x000000EA,/*0xEB*/ 0x000000EB, +/*0xEC*/ 0x000000EC,/*0xED*/ 0x000000ED,/*0xEE*/ 0x000000EE,/*0xEF*/ 0x000000EF, +/*0xF0*/ 0x000000F0,/*0xF1*/ 0x000000F1,/*0xF2*/ 0x000000F2,/*0xF3*/ 0x000000F3, +/*0xF4*/ 0x000000F4,/*0xF5*/ 0x000000F5,/*0xF6*/ 0x000000F6,/*0xF7*/ 0x000000F7, +/*0xF8*/ 0x000000F8,/*0xF9*/ 0x000000F9,/*0xFA*/ 0x000000FA,/*0xFB*/ 0x000000FB, +/*0xFC*/ 0x000000FC,/*0xFD*/ 0x000000FD,/*0xFE*/ 0x000000FE,/*0xFF*/ 0x000000FF diff --git a/lib/include/gg/pc_ebc.ci b/lib/include/gg/pc_ebc.ci new file mode 100644 index 0000000000000000000000000000000000000000..bd044645bae1afee81a176d10d809d948758de97 --- /dev/null +++ b/lib/include/gg/pc_ebc.ci @@ -0,0 +1,71 @@ +/* + * conversion table + * from: pc437, ascii + * to: ebcdic + * as generated on 1997-02-08/21:44:32 + * + */ +/*0x00*/ 0x00000000,/*0x01*/ 0x00000001,/*0x02*/ 0x00000002,/*0x03*/ 0x00000003, +/*0x04*/ 0x00000037,/*0x05*/ 0x0000002D,/*0x06*/ 0x0000002E,/*0x07*/ 0x0000002F, +/*0x08*/ 0x00000016,/*0x09*/ 0x00000005,/*0x0A*/ 0x00000025,/*0x0B*/ 0x0000000B, +/*0x0C*/ 0x0000000C,/*0x0D*/ 0x0000000D,/*0x0E*/ 0x0000000E,/*0x0F*/ 0x0000009F, +/*0x10*/ 0x00000010,/*0x11*/ 0x00000011,/*0x12*/ 0x00000012,/*0x13*/ 0x00000013, +/*0x14*/ 0x000000B6,/*0x15*/ 0x0000007C,/*0x16*/ 0x00000032,/*0x17*/ 0x00000026, +/*0x18*/ 0x00000018,/*0x19*/ 0x00000019,/*0x1A*/ 0x0000003F,/*0x1B*/ 0x00000027, +/*0x1C*/ 0x0000001C,/*0x1D*/ 0x0000001D,/*0x1E*/ 0x0000001E,/*0x1F*/ 0x0000001F, +/*0x20*/ 0x00000040,/*0x21*/ 0x0000004F,/*0x22*/ 0x0000007F,/*0x23*/ 0x0000007B, +/*0x24*/ 0x0000005B,/*0x25*/ 0x0000006C,/*0x26*/ 0x00000050,/*0x27*/ 0x0000007D, +/*0x28*/ 0x0000004D,/*0x29*/ 0x0000005D,/*0x2A*/ 0x0000005C,/*0x2B*/ 0x0000004E, +/*0x2C*/ 0x0000006B,/*0x2D*/ 0x00000060,/*0x2E*/ 0x0000004B,/*0x2F*/ 0x00000061, +/*0x30*/ 0x000000F0,/*0x31*/ 0x000000F1,/*0x32*/ 0x000000F2,/*0x33*/ 0x000000F3, +/*0x34*/ 0x000000F4,/*0x35*/ 0x000000F5,/*0x36*/ 0x000000F6,/*0x37*/ 0x000000F7, +/*0x38*/ 0x000000F8,/*0x39*/ 0x000000F9,/*0x3A*/ 0x0000007A,/*0x3B*/ 0x0000005E, +/*0x3C*/ 0x0000004C,/*0x3D*/ 0x0000007E,/*0x3E*/ 0x0000006E,/*0x3F*/ 0x0000006F, +/*0x40*/ 0x000000B5,/*0x41*/ 0x000000C1,/*0x42*/ 0x000000C2,/*0x43*/ 0x000000C3, +/*0x44*/ 0x000000C4,/*0x45*/ 0x000000C5,/*0x46*/ 0x000000C6,/*0x47*/ 0x000000C7, +/*0x48*/ 0x000000C8,/*0x49*/ 0x000000C9,/*0x4A*/ 0x000000D1,/*0x4B*/ 0x000000D2, +/*0x4C*/ 0x000000D3,/*0x4D*/ 0x000000D4,/*0x4E*/ 0x000000D5,/*0x4F*/ 0x000000D6, +/*0x50*/ 0x000000D7,/*0x51*/ 0x000000D8,/*0x52*/ 0x000000D9,/*0x53*/ 0x000000E2, +/*0x54*/ 0x000000E3,/*0x55*/ 0x000000E4,/*0x56*/ 0x000000E5,/*0x57*/ 0x000000E6, +/*0x58*/ 0x000000E7,/*0x59*/ 0x000000E8,/*0x5A*/ 0x000000E9,/*0x5B*/ 0x00000063, +/*0x5C*/ 0x000000EC,/*0x5D*/ 0x000000FC,/*0x5E*/ 0x0000005F,/*0x5F*/ 0x0000006D, +/*0x60*/ 0x00000079,/*0x61*/ 0x00000081,/*0x62*/ 0x00000082,/*0x63*/ 0x00000083, +/*0x64*/ 0x00000084,/*0x65*/ 0x00000085,/*0x66*/ 0x00000086,/*0x67*/ 0x00000087, +/*0x68*/ 0x00000088,/*0x69*/ 0x00000089,/*0x6A*/ 0x00000091,/*0x6B*/ 0x00000092, +/*0x6C*/ 0x00000093,/*0x6D*/ 0x00000094,/*0x6E*/ 0x00000095,/*0x6F*/ 0x00000096, +/*0x70*/ 0x00000097,/*0x71*/ 0x00000098,/*0x72*/ 0x00000099,/*0x73*/ 0x000000A2, +/*0x74*/ 0x000000A3,/*0x75*/ 0x000000A4,/*0x76*/ 0x000000A5,/*0x77*/ 0x000000A6, +/*0x78*/ 0x000000A7,/*0x79*/ 0x000000A8,/*0x7A*/ 0x000000A9,/*0x7B*/ 0x00000043, +/*0x7C*/ 0x000000CC,/*0x7D*/ 0x000000DC,/*0x7E*/ 0x00000059,/*0x7F*/ 0x00000007, +/*0x80*/ 0x00000000,/*0x81*/ 0x00000000,/*0x82*/ 0x00000000,/*0x83*/ 0x00000000, +/*0x84*/ 0x00000000,/*0x85*/ 0x00000000,/*0x86*/ 0x00000000,/*0x87*/ 0x00000000, +/*0x88*/ 0x00000000,/*0x89*/ 0x00000000,/*0x8A*/ 0x00000000,/*0x8B*/ 0x00000000, +/*0x8C*/ 0x00000000,/*0x8D*/ 0x00000000,/*0x8E*/ 0x00000000,/*0x8F*/ 0x00000000, +/*0x90*/ 0x00000000,/*0x91*/ 0x00000000,/*0x92*/ 0x00000000,/*0x93*/ 0x00000000, +/*0x94*/ 0x00000000,/*0x95*/ 0x00000000,/*0x96*/ 0x00000000,/*0x97*/ 0x00000000, +/*0x98*/ 0x00000000,/*0x99*/ 0x00000000,/*0x9A*/ 0x00000000,/*0x9B*/ 0x00000000, +/*0x9C*/ 0x00000000,/*0x9D*/ 0x00000000,/*0x9E*/ 0x00000000,/*0x9F*/ 0x00000000, +/*0xA0*/ 0x00000000,/*0xA1*/ 0x00000000,/*0xA2*/ 0x00000000,/*0xA3*/ 0x00000000, +/*0xA4*/ 0x00000000,/*0xA5*/ 0x00000000,/*0xA6*/ 0x00000000,/*0xA7*/ 0x00000000, +/*0xA8*/ 0x00000000,/*0xA9*/ 0x00000000,/*0xAA*/ 0x00000000,/*0xAB*/ 0x00000000, +/*0xAC*/ 0x00000000,/*0xAD*/ 0x00000000,/*0xAE*/ 0x00000000,/*0xAF*/ 0x00000000, +/*0xB0*/ 0x00000000,/*0xB1*/ 0x00000000,/*0xB2*/ 0x00000000,/*0xB3*/ 0x00000000, +/*0xB4*/ 0x00000000,/*0xB5*/ 0x00000000,/*0xB6*/ 0x00000000,/*0xB7*/ 0x00000000, +/*0xB8*/ 0x00000000,/*0xB9*/ 0x00000000,/*0xBA*/ 0x00000000,/*0xBB*/ 0x00000000, +/*0xBC*/ 0x00000000,/*0xBD*/ 0x00000000,/*0xBE*/ 0x00000000,/*0xBF*/ 0x00000000, +/*0xC0*/ 0x00000000,/*0xC1*/ 0x00000000,/*0xC2*/ 0x00000000,/*0xC3*/ 0x00000000, +/*0xC4*/ 0x00000000,/*0xC5*/ 0x00000000,/*0xC6*/ 0x00000000,/*0xC7*/ 0x00000000, +/*0xC8*/ 0x00000000,/*0xC9*/ 0x00000000,/*0xCA*/ 0x00000000,/*0xCB*/ 0x00000000, +/*0xCC*/ 0x00000000,/*0xCD*/ 0x00000000,/*0xCE*/ 0x00000000,/*0xCF*/ 0x00000000, +/*0xD0*/ 0x00000000,/*0xD1*/ 0x00000000,/*0xD2*/ 0x00000000,/*0xD3*/ 0x00000000, +/*0xD4*/ 0x00000000,/*0xD5*/ 0x00000000,/*0xD6*/ 0x00000000,/*0xD7*/ 0x00000000, +/*0xD8*/ 0x00000000,/*0xD9*/ 0x00000000,/*0xDA*/ 0x00000000,/*0xDB*/ 0x00000000, +/*0xDC*/ 0x00000000,/*0xDD*/ 0x00000000,/*0xDE*/ 0x00000000,/*0xDF*/ 0x00000000, +/*0xE0*/ 0x00000000,/*0xE1*/ 0x00000000,/*0xE2*/ 0x00000000,/*0xE3*/ 0x00000000, +/*0xE4*/ 0x00000000,/*0xE5*/ 0x00000000,/*0xE6*/ 0x00000000,/*0xE7*/ 0x00000000, +/*0xE8*/ 0x00000000,/*0xE9*/ 0x00000000,/*0xEA*/ 0x00000000,/*0xEB*/ 0x00000000, +/*0xEC*/ 0x00000000,/*0xED*/ 0x00000000,/*0xEE*/ 0x00000000,/*0xEF*/ 0x00000000, +/*0xF0*/ 0x00000000,/*0xF1*/ 0x00000000,/*0xF2*/ 0x00000000,/*0xF3*/ 0x00000000, +/*0xF4*/ 0x00000000,/*0xF5*/ 0x00000000,/*0xF6*/ 0x00000000,/*0xF7*/ 0x00000000, +/*0xF8*/ 0x00000000,/*0xF9*/ 0x00000000,/*0xFA*/ 0x00000000,/*0xFB*/ 0x00000000, +/*0xFC*/ 0x00000000,/*0xFD*/ 0x00000000,/*0xFE*/ 0x00000000,/*0xFF*/ 0x00000000 diff --git a/lib/include/gg/pctcpsbr.h b/lib/include/gg/pctcpsbr.h new file mode 100644 index 0000000000000000000000000000000000000000..e4d01b67181111916f76a98c7fa12260ff85fe2c --- /dev/null +++ b/lib/include/gg/pctcpsbr.h @@ -0,0 +1,12 @@ +/* + * include FILE <gg/pctcpsbr.h> + * + * written: 1992 09 15 + * latest update: 1994-11-11 + * + */ + +#ifndef __GG_pctcpsbr__ +#define __GG_pctcpsbr__ + +#endif /* __GG_pctcpsbr__ */ diff --git a/lib/include/gg/pcx.h b/lib/include/gg/pcx.h new file mode 100644 index 0000000000000000000000000000000000000000..57f82aa9169b3ec2612c87d619ea25bc619a8ca7 --- /dev/null +++ b/lib/include/gg/pcx.h @@ -0,0 +1,54 @@ +/* + * include FILE <gg/pcx.h> + * + * header for PCX files format + * + * written: 1989 08 09 + * 1991 10 03: Revision + * latest update: 1994-11-11 + * + */ + +#ifndef __GG_pcx__ +#define __GG_pcx__ + +#pragma pack(1) + +/* ------------------------------------------------------------------------ */ +struct PCX_TRIPLET +{ + char pcx_red; + char pcx_green; + char pcx_blue; +} ; + +/* ------------------------------------------------------------------------ */ +struct PCX_HEADER +{ + char pcx_maker; + char pcx_version; + char pcx_encoding; + char pcx_bpp; + int pcx_ax; + int pcx_ay; + int pcx_bx; + int pcx_by; + int pcx_xres; + int pcx_yres; + struct PCX_TRIPLET pcx_triple[16]; /* palette */ + char pcx_vmode; + char pcx_nplanes; + int pcx_bpl; /* Byte Per Line */ + char _pcx_unused[128-68]; /* or 256 color RGB map ?? */ +} ; + +/* ------------------------------------------------------------------------ */ +struct PCX_PICTURE +{ + struct PCX_HEADER pcx_hdr; + unsigned char **pcx_rows[4]; +} ; + +#pragma pack() + +#endif /* __GG_pcx__ */ diff --git a/lib/include/gg/public.inc b/lib/include/gg/public.inc new file mode 100644 index 0000000000000000000000000000000000000000..6c0255e300c97352a877eb1aac6b9f5e20b78cde --- /dev/null +++ b/lib/include/gg/public.inc @@ -0,0 +1,47 @@ +/* + * include FILE <gg/public.inc> + * + * Free Software Klausel fuer Utilities + * + * written: 1986-01-01 + * latest update: 2001-08-25 19:02:42 + * $Id: public.inc,v 1.10 2011/05/31 15:51:23 gonter Exp $ + * + */ + +"(c) 1986..2011 Gerhard Gonter; comments to <g.gonter@ieee.org>\n", +"This is free software, you may distribute this program and/or the source\n", +"freely under the terms of the FreeBSD license.\n", +"See http://www.freebsd.org/copyright/freebsd-license.html\n" + +/* + * Copyright (c) 2002 Gerhard Gonter <g.gonter@ieee.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#ifdef MSDOS +, +"(RETURN)\n" +#endif diff --git a/lib/include/gg/rdtp.h b/lib/include/gg/rdtp.h new file mode 100644 index 0000000000000000000000000000000000000000..3a5145fe06b039f0d5d2a1c6d8e77c9e90f39412 --- /dev/null +++ b/lib/include/gg/rdtp.h @@ -0,0 +1,70 @@ +/* + * include FILE <gg/rdtp.h> + * + * restructured dynamic text parser: runtime engine + * - methods + * - structures + * - prototypes + * + * written: 1996-04-01 + * latest update: 1997-01-15 10:43:01 + * + */ + +#ifndef __GG_rdtp__ +#define __GG_rdtp__ + +/** #define RDTP_DEBUG **/ +#define TMP_BL_SIZE 256 /* size of temporary blocks */ + +/* methods: --------------------------------------------------------------- */ +typedef int RDTP_state_transition (void *thrp, int ch); +/* there should be some kind of forward declaration somewhere around here. */ + +/* structures: ------------------------------------------------------------ */ +struct RDTP_STATE +{ + struct RDTP_STATE **new_states; + RDTP_state_transition **transitions; + +#ifdef RDTP_DEBUG + char *state_name; + char **transition_info; +#endif /* RDTP_DEBUG */ +} ; + +/* ------------------------------------------------------------------------ */ +struct RDTP_CLASS +{ + int char_classes [256]; + int max_classes; + struct RDTP_STATE *start_state; + + RDTP_state_transition *method_for_undefined_state; + struct RDTP_STATE *state_for_undefined_state; + + RDTP_state_transition *method_for_undefined_input; + struct RDTP_STATE *state_for_undefined_input; +} ; + +/* ------------------------------------------------------------------------ */ +struct RDTP_THREAD +{ + struct RDTP_CLASS *class; + struct RDTP_STATE *current_state; + + void *payload; +} ; + +/* prototypes: ------------------------------------------------------------ */ +/* 0001 */ int rdtp_parse_char (struct RDTP_THREAD *thread, int ch); +/* 0002 */ struct RDTP_THREAD *rdtp_new_thread (struct RDTP_CLASS *cl); +/* 0003 */ long rdtp_parse_file (struct RDTP_THREAD *thread, + char *fnm, long beg, long size); +#ifdef _FILE_DEFINED +/* 0004 */ long rdtp_parse_stream (struct RDTP_THREAD *thread, + FILE *fi, long size); +#endif /* _FILE_DEFINED */ +/* 0005 */ void rdtp_bad_thread (char *id); + +#endif /* __GG_rdtp__ */ diff --git a/lib/include/gg/rdtp01.h b/lib/include/gg/rdtp01.h new file mode 100644 index 0000000000000000000000000000000000000000..a81857aec4d421251392d8cc4f85f30b53e4fb80 --- /dev/null +++ b/lib/include/gg/rdtp01.h @@ -0,0 +1,123 @@ +/* + * include FILE <gg/rdtp01.h> + * + * restructured dynamic text parser: state table generator + * - methods + * - structures + * - prototypes + * + * written: 1996-04-01 + * latest update: 1996-08-08 17:15:59 + * + */ + +#ifndef __GG_rdtp01__ +#define __GG_rdtp01__ + +#include <gg/ytree.h> + +#define MAX_STATE_CLASSES 256 +#define RDTP_MAX_CLASSES 256 + +/* ------------------------------------------------------------------------ */ +struct RDTP_STATE_TRANSITION +{ + struct RDTP_STATE_TRANSITION *next; + + /* definition */ + char *state_to; /* next state name */ + RDTP_state_transition *method; /* action to be performed */ + char *method_info; /* description about action */ + + long range_begin; /* character ranges; ISO 10646 */ + long range_end; + + /* derivations */ + int class_code; +} ; + +/* ------------------------------------------------------------------------ */ +struct RDTP_STATE_DEFINITION +{ + char *state_name; + struct RDTP_STATE_TRANSITION *trans; + struct RDTP_STATE *state; /* runtime table for the definiton */ + + int state_used; /* 0 .. ignore */ + /* 1 .. dzt. in Verwendung */ +} ; + +/* ------------------------------------------------------------------------ */ +struct RDTP_GENERATOR +{ + char *generator_name; + char *start_state; + struct RDTP_CLASS *class; /* parser class definition */ + + struct YTREE *state_names; +/******* int used; *******/ + + int generator_ok; + + int defined_classes; + int class_table [RDTP_MAX_CLASSES]; + + RDTP_state_transition *method_for_undefined_state; + struct RDTP_STATE * state_for_undefined_state; + + RDTP_state_transition *method_for_undefined_input; + struct RDTP_STATE * state_for_undefined_input; +} ; + +/* ------------------------------------------------------------------------ */ +struct RDTP_STATIC_STATE_TABLE /* static description of states */ +{ /* and transitions */ + char *state_from; + char *state_to; + + long range_begin; /* character ranges; ISO 10646 */ + long range_end; + + char *method_info; /* description about action */ + RDTP_state_transition *method; /* action to be performed */ +} ; + +/* prototypes: ------------------------------------------------------------ */ +/* 0101 */ int rdtp_define_transition (struct RDTP_GENERATOR *gen, + char *from, char *to, long begin, long end, + RDTP_state_transition *method, char *info); +/* 0102 */ int rdtp_load_static_table (struct RDTP_GENERATOR *gen, + struct RDTP_STATIC_STATE_TABLE state_table []); +/* 0103 */ struct RDTP_STATE_DEFINITION *rdtp_find_state_definition ( + struct RDTP_GENERATOR *gen, char *state_name); +#ifdef _FILE_DEFINED +/* 0104 */ int rdtp_print_generator (struct RDTP_GENERATOR *gen, FILE *fo); +#endif /* _FILE_DEFINED */ + +/* 0105 */ int rdtp_print_states (struct YTREE *yt, void *cd); +/* 0104 */ int rdtp_generate_transition_table (struct RDTP_GENERATOR *gen); +/* 0107 */ int rdtp_drop_tables (struct YTREE *yt, void *cd); +/* 0108 */ int rdtp_unmark_states (struct YTREE *yt, void *cd); +/* 0109 */ int rdtp_mark_states ( + struct RDTP_GENERATOR *gen, + char *start, int verbosity); +/* 0110 */ int rdtp_process1_state_table ( + struct RDTP_GENERATOR *gen, + struct RDTP_STATE_DEFINITION *st); +/* 0111 */ int rdtp_process2_state_table ( + struct RDTP_GENERATOR *gen, + struct RDTP_STATE_DEFINITION *st); +/* 0112 */ int rdtp_process3_state_table ( + struct RDTP_GENERATOR *gen, + struct RDTP_STATE_DEFINITION *st); +/* 0113 */ int rdtp_pass2_transformation (struct YTREE *yt, void *cd); +/* 0114 */ int rdtp_pass3_transformation (struct YTREE *yt, void *cd); +/* 0115 */ int rdtp_drop_state_table ( + struct RDTP_GENERATOR *gen, + struct RDTP_STATE_DEFINITION *st); +#ifdef _FILE_DEFINED +/* 0116 */ int rdtp_print_state_entry (FILE *fo, + struct RDTP_STATE_TRANSITION *tr, char *pfx); +#endif /* _FILE_DEFINED */ + +#endif /* __GG_rdtp01__ */ diff --git a/lib/include/gg/rdtp02.h b/lib/include/gg/rdtp02.h new file mode 100644 index 0000000000000000000000000000000000000000..3057640df5bf0ff0dd86a5d726942b774ca8a2ed --- /dev/null +++ b/lib/include/gg/rdtp02.h @@ -0,0 +1,99 @@ +/* + * include FILE <gg/rdtp02.h> + * + * restructured dynamic text parser: RTF runtime + * - methods + * - structures + * - prototypes + * + * written: 1996-04-01 + * latest update: 1997-06-17 14:14:14 + * + */ + +#ifndef __GG_rdtp02__ +#define __GG_rdtp02__ + +#include <gg/dyb.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +struct RTF_NODE +{ + struct RTF_NODE *next; + int node_type; +} ; + +/* ------------------------------------------------------------------------ */ +struct RTF_GROUP +{ + struct RTF_NODE *next; + int node_type; + + struct RTF_NODE *down; /* element held by stack element */ +} ; + +/* ------------------------------------------------------------------------ */ +struct RTF_COMMAND +{ + struct RTF_NODE *next; + int node_type; + + char *command; + char *parameter; +} ; + +/* ------------------------------------------------------------------------ */ +struct RTF_TEXT +{ + struct RTF_NODE *next; + int node_type; + + int size; + int flags; + char *block; +} ; + +/* ------------------------------------------------------------------------ */ +struct RTF_STACK +{ + struct RTF_NODE *prev; + int node_type; + + struct RTF_NODE **hold; /* element held by stack element */ +} ; + +/* ------------------------------------------------------------------------ */ +struct RTF_COMMAND_NAME +{ + char *cmd_name; + long counter; +} ; + +/* ------------------------------------------------------------------------ */ +struct RTF_BUILDUP +{ + struct RTF_NODE *next; + int node_type; + + struct RTF_STACK *stack; + struct RTF_NODE *top; + struct RTF_NODE **append; + + char bl1 [TMP_BL_SIZE]; /* temporary block */ + int bl1_cnt; + + struct YTREE *names; +} ; + +/* prototypes: ------------------------------------------------------------ */ +/* 0201 */ struct RDTP_GENERATOR *rtf_setup_parser (char *name); +/* 0202 */ int rtf_nop (void *thrp, int ch); +/* 0203 */ int rtf_error (void *thrp, int ch); +/* 0204 */ int rtf_cmd_name_begin (void *thrp, int ch); +/* 0205 */ int rtf_cmd_name (void *thrp, int ch); +/* 0206 */ int rtf_cmd_name_end (void *thrp, int ch); +/* 0207 */ int rtf_print_statistics (struct RDTP_THREAD *thr); +/* 0208 */ int rtf_print_name_statistics (long cmd_info, void *thr_info); + +#endif /* __GG_rdtp02__ */ diff --git a/lib/include/gg/rdtp03.h b/lib/include/gg/rdtp03.h new file mode 100644 index 0000000000000000000000000000000000000000..52af52f808c096e5b71b1731a218c9be2df747c6 --- /dev/null +++ b/lib/include/gg/rdtp03.h @@ -0,0 +1,393 @@ +/* + * include FILE <gg/rdtp03.h> + * + * restructured dynamic text parser: SGML runtime + * - methods + * - structures + * - prototypes + * see also: <gg/hyx.h> + * + * written: 1996-04-02 + * latest update: 1997-11-26 12:42:06 + * + */ + +#ifndef __GG_rdtp03__ +#define __GG_rdtp03__ + +#include <gg/ytree.h> +#include <gg/array.h> + +#define SGML_DIAG + +/* ------------------------------------------------------------------------ */ +/* SGML_tokt_* SGML token types */ +#define SGML_tokt_undef 0 +#define SGML_tokt_literal 1 /* literal token */ +#define SGML_tokt_sqs 2 /* single quoted string */ +#define SGML_tokt_dqs 3 /* double quoted string */ +#define SGML_tokt_begin_group 4 /* ( */ +#define SGML_tokt_end_group 5 /* ) */ +#define SGML_tokt_asterisk 6 /* * */ +#define SGML_tokt_plus 7 /* + */ +#define SGML_tokt_comma 8 /* , seq connector */ +#define SGML_tokt_dash 9 /* - */ +#define SGML_tokt_qm 10 /* ? (question mark) optional par. */ +#define SGML_tokt_pct 11 /* % */ +#define SGML_tokt_par_ent 12 /* parameter entity: %name; */ +#define SGML_tokt_or 13 /* | or connector */ +#define SGML_tokt_and 14 /* & and connector */ +#define SGML_tokt_number 15 /* decimal number */ + +/* SGML_DECLVAL_* declared value type codes; see The SGML Handbook p. 422 */ +#define SGML_DECLVAL_undef 0 +#define SGML_DECLVAL_CDATA 1 +#define SGML_DECLVAL_ENTITY 2 +#define SGML_DECLVAL_ENTITIES 3 +#define SGML_DECLVAL_ID 4 +#define SGML_DECLVAL_IDREF 5 +#define SGML_DECLVAL_IDREFS 6 +#define SGML_DECLVAL_NAME 7 +#define SGML_DECLVAL_NAMES 8 +#define SGML_DECLVAL_NMTOKEN 9 +#define SGML_DECLVAL_NMTOKENS 10 +#define SGML_DECLVAL_NUMBER 11 +#define SGML_DECLVAL_NUMBERS 12 +#define SGML_DECLVAL_NUTOKEN 13 +#define SGML_DECLVAL_NUTOKENS 14 +#define SGML_DECLVAL_notation 15 +#define SGML_DECLVAL_name_tokg 16 + +/* SGML_DEFVAL_* default value type codes; see The SGML Handbook p. 425 */ +#define SGML_DEFVAL_undef 0 +#define SGML_DEFVAL_FIXED 1 +#define SGML_DEFVAL_REQUIRED 2 +#define SGML_DEFVAL_CURRENT 3 +#define SGML_DEFVAL_CONREF 4 +#define SGML_DEFVAL_IMPLIED 5 + +/* ------------------------------------------------------------------------ */ +/* SGML_ENTITY_* entity class or type definitions */ +#define SGML_ENTITY_undef 0 + /* parameter literals */ +#define SGML_ENTITY_litstring 1 /* single quoted literal string */ +#define SGML_ENTITY_litstring2 2 /* single quoted literal string */ + + /* data text */ +#define SGML_ENTITY_CDATA 3 /* character data */ +#define SGML_ENTITY_SDATA 4 /* specific character data */ +#define SGML_ENTITY_PI 5 /* processing instruction */ + + /* bracketed text */ +#define SGML_ENTITY_STARTTAG 6 +#define SGML_ENTITY_ENDTAG 7 +#define SGML_ENTITY_MS 8 +#define SGML_ENTITY_MD 9 + + /* public and system identifier */ +#define SGML_ENTITY_SYSTEM 10 +#define SGML_ENTITY_PUBLIC 11 + + /* system; sub type */ +#define SGML_ENTITY_SUBDOC 12 +#define SGML_ENTITY_NDATA 13 + +/* ------------------------------------------------------------------------ */ +struct SGML_TOKEN +{ + int type; /* see SGML_tokt_* */ + char *contents; /* contents of the token */ +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_ATTRIBUTE_SPEC_LIST /* system or public notation */ +{ /* attribute specification list */ + struct SGML_ATTRIBUTE_SPEC_LIST *next; + char *name; /* name may be empty!!! */ + char *value; /* attribute value */ +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_ENTITY_SYSTEM_DECL /* more definition data for */ +{ /* SYSTEM and PUBLIC entities */ + int entity_class; /* same as in ENTITY_DECLARATION */ + /* either SYSTEM or PUBLIC */ + int entity_type; /* NONE, SUBDOC, (C|S|N)DATA */ + + char *public_id; + char *system_id; + char *notation_name; + struct SGML_ATTRIBUTE_SPEC_LIST *att_specs; /* 0 or more attr. specs. */ +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_ENTITY_DECLARATION /* DTD: entity definition */ +{ /* the same structure is used for */ + /* normal and parameter entities, */ + /* however, they are listed in */ + /* separately from the DTD-struct. */ + + char *name; /* entity name */ + int entity_class; /* see SGML_ENTITY_* */ + char *text; /* replacement text */ + /* not used for SYSTEM and PUBLIC */ + + struct SGML_ENTITY_SYSTEM_DECL *system_decl; /* more details for */ + /* SYSTEM and PUBLIC ent. */ +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_ATTRIBUTE_DECLARATION /* DTD */ +{ + struct SGML_ATTRIBUTE_DECLARATION *next; + char *name; + + int declared_value; /* see SGML_DECLVAL_* */ + void *declared_value_ptr; + + int default_value; /* see SGML_DEFVAL_* */ + void *default_value_ptr; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_ATTLIST_DECL /* DTD */ +{ /* can be referenced by several */ + /* element declarations */ + int ref_count; /* number of elements referencing */ + /* to this attribute list decl. */ + struct YTREE *attribute_declaration; + struct SGML_ATTRIBUTE_DECLARATION *attributes; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_CONTENT_MODEL /* DTD */ +{ /* element declarations */ + int ref_count; /* number of elements referencing */ + /* to this content model */ + void *content; + void *exclusions; + void *inclusions; + + struct ARRAY_CONTROL *tmp; /* temporary hack */ +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_ELEMENT_DECLARATION /* DTD */ +{ + char *name; + + int minim_start; /* start tag minimization */ + int minim_end; /* end tag minimization */ + long rank; /* rank code, whatever that is */ + + struct SGML_CONTENT_MODEL *cont_mod; + struct SGML_ATTLIST_DECL *attlist; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_TAG_NAME /* document instance statistics */ +{ + struct SGML_ELEMENT_DECLARATION *tag_def; + char *tag_name; + long ref_counter; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_ATTRIBUTE_LIST +{ + struct SGML_ATTRIBUTE_LIST *next; + + int attribute_type; /* see note: SAt_* */ +#define SAt_undef 0 +#define SAt_NED 1 /* like Frame names */ +#define SAt_normal 2 +/* Note: more types as specified in the SGML ref */ + + int flags; /* bitfield: SAf_* */ +#define SAf_name_malloced 0x01 +#define SAf_value_malloced 0x02 +#define SAf_value_dyb 0x04 /* value is a DYNAMIC_BLOCK */ + +#define SAf_value_squoted 0x10 /* single quote necessary */ +#define SAf_value_dquoted 0x20 /* double quote necessary */ +#define SAf_value_escaped 0x40 /* escape chars necessary */ +#define SAf_value_noquote 0x80 /* no quoting necessary */ +#define SAf_value_quote_mask 0xF0 + + char *attribute_name; + void *attribute_value; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_OPENING_TAG /* document instance */ +{ + struct SGML_TAG_NAME *tag_name; + struct SGML_ATTRIBUTE_LIST *attributes; + struct SGML_ATTRIBUTE_LIST **attr_append; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_CLOSING_TAG /* document instance */ +{ + struct SGML_TAG_NAME *tag_name; + struct SGML_OPENING_TAG *open_tag; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_NODE /* document instance: element */ +{ + int node_type; + int status; + int minimiziation; + + struct SGML_OPENING_TAG *opening_tag; + void *content; + struct SGML_CLOSING_TAG *closing_tag; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_STACK +{ + struct SGML_STACK *prev; + struct SGML_NODE **ptr; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_BUILDUP +{ + /* temporary storage areas */ + char bl1 [TMP_BL_SIZE]; /* tmp block */ + int bl1_cnt; + + struct ARRAY_CONTROL *tokens; /* tmp tokens */ + int token_type; /* seek SGML_tokt_* */ + + struct SGML_NODE *document; /* begin of the currently */ + /* parsed instance */ + + /* parser meta status */ + struct SGML_NODE **append; + struct SGML_STACK *stack; + int stack_size; + + /* document type definition */ + struct YTREE *defined_element_names; /* declared elements */ + struct YTREE *defined_entity_names; /* declared entities */ + struct YTREE *defined_par_entity_names;/*declared parameter entities */ + struct YTREE *defined_notation_names; /* declared notation names */ + + /* statistics */ + struct YTREE *element_names; + struct YTREE *entity_names; + struct YTREE *par_entity_names; +} ; + +/* macros: ---------------------------------------------------------------- */ +#define sgml_new_element_declaration() \ + ((struct SGML_ELEMENT_DECLARATION *) \ + calloc (sizeof (struct SGML_ELEMENT_DECLARATION), 1)) + +#define sgml_new_content_model() \ + ((struct SGML_CONTENT_MODEL *) \ + calloc (sizeof (struct SGML_CONTENT_MODEL), 1)) + +#define sgml_new_attlist_decl() \ + ((struct SGML_ATTLIST_DECL *) \ + calloc (sizeof (struct SGML_ATTLIST_DECL), 1)) + +#define sgml_new_attdecl() \ + ((struct SGML_ATTRIBUTE_DECLARATION *) \ + calloc (sizeof (struct SGML_ATTRIBUTE_DECLARATION), 1)) + +#define sgml_new_entity_declaration() \ + ((struct SGML_ENTITY_DECLARATION *) \ + calloc (sizeof (struct SGML_ENTITY_DECLARATION), 1)) + +#define sgml_new_attribute() \ + ((struct SGML_ATTRIBUTE_LIST *) \ + calloc (sizeof (struct SGML_ATTRIBUTE_LIST), 1)) + +/* prototypes: ------------------------------------------------------------ */ +/* 0301 */ struct RDTP_GENERATOR *sgml_setup_parser (char *name); +/* 0302 */ int sgml_nop (struct RDTP_THREAD *thr, int ch); +/* 0303 */ int sgml_error (void *thrp, int ch); +/* 0304 */ int sgml_name_begin (void *thrp, int ch); +/* 0305 */ int sgml_collect (void *thrp, int ch); + int sgml_collect2 (struct RDTP_THREAD *thr, int ch); + int sgml_collect3 (struct RDTP_THREAD *thr, int ch); + int sgml_collect3b (struct RDTP_THREAD *thr, int ch); + int sgml_collect4 (struct RDTP_THREAD *thr, int ch); + int sgml_collect5 (struct RDTP_THREAD *thr, int ch); +/* 0306 */ int sgml_name_end (struct SGML_BUILDUP *sgml_structure, + int ch, struct YTREE **name_table); +/* 0307 */ int sgml_print_statistics (struct RDTP_THREAD *thr); +/* 0308 */ int sgml_print_name_statistics (long cmd_info, void *thr_info); +/* 0309 */ int sgml_element_name_end (void *thrp, int ch); +/* 0310 */ int sgml_entity_name_end (struct RDTP_THREAD *thr, int ch); +/* 0311 */ struct SGML_BUILDUP *sgml_initialize_buildup (void); +/* 0312 */ int sgml_flush_buffer (struct SGML_BUILDUP *rtf); +/* 0313 */ struct SGML_TAG_NAME *sgml_new_element_name ( + struct SGML_BUILDUP *ctx, char *name); +/* 0314 */ int sgml_new_element (struct RDTP_THREAD *thr, int ch); +/* 0315 */ int sgml_declaration (struct RDTP_THREAD *thr, int ch); +/* 0316 */ int sgml_decl_token_beg (struct RDTP_THREAD *thr, int ch, + int token_type); + int sgml_decl_literal_beg (struct RDTP_THREAD *thr, int ch); + int sgml_decl_sqs_beg (struct RDTP_THREAD *thr, int ch); + int sgml_decl_dqs_beg (struct RDTP_THREAD *thr, int ch); + int sgml_decl_num_beg (struct RDTP_THREAD *thr, int ch); +/* 0317 */ int sgml_decl_token_end (struct RDTP_THREAD *thr, int ch); + int sgml_decl_col_token_end (struct RDTP_THREAD *thr, int ch); +/* 0318 */ struct SGML_TOKEN *sgml_tokenizer (char *str, int type); + void sgml_destroy_token (void *pl); + void sgml_free_token (struct SGML_TOKEN *token); +/* 0319 */ int sgml_tokenize_symbol (struct RDTP_THREAD *thr, int ch, + int token_type); + int sgml_decl_symbol (struct RDTP_THREAD *thr, int ch); + int sgml_single_dash (struct RDTP_THREAD *thr, int ch); + int sgml_single_dash_gbeg (struct RDTP_THREAD *thr, int ch); + int sgml_single_pct (struct RDTP_THREAD *thr, int ch); +/* 0320 */ int sgml_par_ent_beg (struct RDTP_THREAD *thr, int ch); + int sgml_par_ent_end (struct RDTP_THREAD *thr, int ch); +/* 0321 */ int sgml_declaration_done (struct RDTP_THREAD *thr, int ch); + int sgml_declaration_done2 (struct RDTP_THREAD *thr, int ch); +/* 0322 */ struct SGML_TAG_NAME *sgml_add_element (struct SGML_BUILDUP *sb, + char *element); + +/* 0341 */ struct SGML_OPENING_TAG *sgml_new_opening_tag ( + struct SGML_BUILDUP *sb, char *name); +/* 0342 */ struct SGML_ATTRIBUTE_LIST *sgml_add_attribute ( + struct SGML_OPENING_TAG *ot, char *name, char *value); +#ifdef _FILE_DEFINED +/* 0343 */ int sgml_diag_tag (FILE *fo, struct SGML_OPENING_TAG *ot); +#endif /* _FILE_DEFINED */ +/* 0344 */ int sgml_destroy_attribute (struct SGML_ATTRIBUTE_LIST *av); +/* 0345 */ int sgml_destroy_tag (struct SGML_OPENING_TAG *ot); +/* 0346 */ char *sgml_tag_to_string (struct SGML_OPENING_TAG *ot, + char *buffer, int max_size, int extra); +/* 0347 */ int sgml_space_required (struct SGML_OPENING_TAG *ot); +/* 0348 */ struct SGML_ATTRIBUTE_LIST *sgml_add_long_attribute ( + struct SGML_OPENING_TAG *ot, char *name, long value); + +/* 0403 */ int sgml_can_be_minimized (char *str); + int sgml_can_be_minimized_tok (struct SGML_TOKEN *tok); + int sgml_element_declaration (struct SGML_BUILDUP *sb, + struct ARRAY_CONTROL *token_list, int what); +#ifdef _FILE_DEFINED +/* 0413 */ int sgml_print_element_declaration (FILE *fo, + struct SGML_ELEMENT_DECLARATION *ed); + int sgml_print_attlist_declaration (FILE *fo, + struct SGML_ATTLIST_DECL *attl); + int sgml_print_attribute_declaration (FILE *fo, + struct SGML_ATTRIBUTE_DECLARATION *attdecl); +#endif /* _FILE_DEFINED */ + +/* 0421 */ struct ARRAY_CONTROL *sgml_get_name_or_group ( + struct ARRAY_CONTROL *token_list, int group_required); +/* 0422 */ struct SGML_CONTENT_MODEL *sgml_get_content_model ( + struct ARRAY_CONTROL *token_list); +/* 0423 */ int sgml_get_declared_value_code (char *str); + struct SGML_ATTLIST_DECL *sgml_get_attlist ( + struct ARRAY_CONTROL *token_list); + +#endif /* __GG_rdtp03__ */ diff --git a/lib/include/gg/rfc822.h b/lib/include/gg/rfc822.h new file mode 100644 index 0000000000000000000000000000000000000000..4cbb9b080e23be9a5d3b58086c83f2b421262805 --- /dev/null +++ b/lib/include/gg/rfc822.h @@ -0,0 +1,169 @@ +/* + * include FILE <gg/rfc822.h> + * + * constants, etc., for RFC822 mail processing + * + * written: 1990 12 01 + * 1991 09 16: revision + * latest update: 1997-11-27 19:57:38 + * + */ + +#ifndef __GG_rfc822__ +#define __GG_rfc822__ + +/* ------------------------------------------------------------------------ */ +#define RFC822_unknown 0 +#define RFC822_From 1 +#define RFC822_To 2 +#define RFC822_Date 3 +#define RFC822_Subject 4 +#define RFC822_Received 5 +#define RFC822_Via 6 +#define RFC822_Keywords 7 +#define RFC822_Summary 8 +#define RFC822_Path 9 +#define RFC822_Approved 10 +#define RFC822_Approved_By 11 +#define RFC822_Newsgroups 12 +#define RFC822_Control 13 + +#define RFC822_continue 101 +#define RFC822_blank 102 +#define RFC822_sep1 103 +#define RFC822_sep2 104 +#define RFC822_sep_elm 105 + +/* delimiter string between messages -------------------------------------- */ +#define DELIMIT_NOTEBOOK 0 +#define DELIMIT_OCCAM_archive 1 +#define DELIMIT_LISTSERV_DB 2 +#define DELIMIT_3 3 +#define DELIMIT_Love_Hounds 4 +#define DELIMIT_card_oldmail 5 +#define DELIMIT_Unix 6 + +/* ------------------------------------------------------------------------ */ +struct MAIL_DESCRIPTION +{ + struct MAIL_DESCRIPTION *MD_next; + + struct MAIL_DESCRIPTION *MD_by_addr; + struct MAIL_DESCRIPTION *MD_by_date; + struct MAIL_DESCRIPTION *MD_by_subj; + + char *MD_frame; + char *MD_addr; + char *MD_date; + char *MD_subj; + int MD_cnt; +} ; + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +typedef int BC_REPORT_MAIL (struct BREAKUP_CONTROL *bc, char *fnm, char *s1, + char *s2, char *s3, int cnt); + +#define _BREAKUP_CONTROL_DEFINED +struct BREAKUP_CONTROL +{ + FILE *BC_log; + FILE *BC_hyx; + + int BC_is_hyx; + + char *BC_fo_name; + char *BC_new_name; + char *BC_f_name; + char *BC_f_type; + + int BC_f_rename_file; + int BC_delimiter_mode; + int BC_counter; + int BC_dummy_lines; + int BC_remove_lines; + + int BC_use_addr; + BC_REPORT_MAIL *BC_report_mail; + + struct MAIL_DESCRIPTION *BC_MD_list; + struct MAIL_DESCRIPTION **BC_MD_append; + + struct YTREE *BC_yt_addr; + struct YTREE *BC_yt_date; + struct YTREE *BC_yt_subj; + char *BC_format; +} ; +#endif + +/* ------------------------------------------------------------------------ */ +struct RFC822_KEYWORD +{ + unsigned char *kw; + long code; +} ; + +/* ------------------------------------------------------------------------ */ +typedef int DB_lookup (char *s, void *cd); + +/* ------------------------------------------------------------------------ */ +struct MAIL_VERIFY_DB +{ + DB_lookup *spamsites, *spammers, *goodaddr; + void *cd_spamsites, *cd_spammers, *cd_goodaddr; +} ; + +/* prototypes: ------------------------------------------------------------ */ +/* mail0001.c */ long RFC822_chk_keyword (char *s, int lng); + int RFC822_reg_keyword_table (struct RFC822_KEYWORD *tbl); + int RFC822_reg_keyword (unsigned char *kw, long code); +/* mail0002.c */ int cdecl mk_fnm_from_date (char *fnm_string, + char *date_string, int normalize); +/* mail0003.c */ int cdecl message_delimiter (char *p, int delim_mode); + +#ifdef _FILE_DEFINED +/* mail0004.c */ int cdecl breakup (char *fn, struct BREAKUP_CONTROL *bc); + int cdecl close_current_file (struct BREAKUP_CONTROL *bc); + int cdecl new_file (struct BREAKUP_CONTROL *bc); +#endif /* _FILE_DEFINED */ + +/* mail0005.c */ int cdecl record_mails (struct BREAKUP_CONTROL *bc, + char *frame, char *addr, char *date, char *subj, int cnt); + +#ifdef _YTREE_DEFINED +/* mail0006.c */ int cdecl sort_mail (struct YTREE **ytr, + struct MAIL_DESCRIPTION *md, + struct MAIL_DESCRIPTION **md_app, char *str); +#endif /* _YTREE_DEFINED */ + +#ifdef _BREAKUP_CONTROL_DEFINED +/* mail0007.c */ struct BREAKUP_CONTROL *cdecl create_breakup_control (void); +#endif /* _BREAKUP_CONTROL_DEFINED */ + +#ifdef _FILE_DEFINED +/* mail0008.c */ int cdecl print_mail_description_link (FILE *fo, + struct MAIL_DESCRIPTION *md); +/* mail0009.c */ int cdecl print_mail_description_list (FILE *fo, + struct MAIL_DESCRIPTION *md, int sort_mode); +#endif /* _FILE_DEFINED */ + +/* mail0010.c */ int cdecl normalize_date (char *fnm_string, + char *date_string, int normalize); + +/* spam fight package ----------------------------------------------------- */ +/* mail0011.c */ int mail_verify_address (char *addr, int dup, + struct MAIL_VERIFY_DB *db); +#define ADDR_ERROR -1 +#define ADDR_OK 0 +#define ADDR_SYNTAX 1 +#define ADDR_SPAMMER 2 +#define ADDR_SPAMSITE 3 +#define ADDR_INVALID 4 + +/* mail0012.c */ int mail_verify_domain_name (char *addr, int dup, + struct MAIL_VERIFY_DB *db); +/* mail0013.c */ int mail_valid_tld (char *tld); +/* mail0014.c */ int mail_verify_message_id (char *msgid, int dup, + int defocus, struct MAIL_VERIFY_DB *db); + +#endif /* __GG_rfc822__ */ diff --git a/lib/include/gg/rtf.h b/lib/include/gg/rtf.h new file mode 100644 index 0000000000000000000000000000000000000000..2437a623e1c6b4614c556385ace35d05ca7fd501 --- /dev/null +++ b/lib/include/gg/rtf.h @@ -0,0 +1,35 @@ +/* + * include FILE <gg/rtf.h> + * + * attribute list management + * + * written: 1994-03-28 + * latest update: 1994-03-28 + * + */ + +#ifndef __GG_rtf__ +#define __GG_rtf__ + +#ifndef MSDOS +#ifndef cdecl +#define cdecl +#endif /* cdecl */ +#endif /* MSDOS */ + +#ifdef _STDIO_H +#ifndef _FILE_DEFINED +#define _FILE_DEFINED +#endif +#endif + +#ifndef __GG_lookup__ +#include <gg/lookup.h> +#endif +#ifndef __GG_attlist__ +#include <gg/attlist.h> +#endif + +/* ------------------------------------------------------------------------ */ + +#endif /* __GG_rtf__ */ diff --git a/lib/include/gg/sbr.h b/lib/include/gg/sbr.h new file mode 100644 index 0000000000000000000000000000000000000000..e5a38d519cead77e2b79cec5d902a1cf802d952d --- /dev/null +++ b/lib/include/gg/sbr.h @@ -0,0 +1,256 @@ +/* + * include FILE <gg/sbr.h> + * + * Deklarationen fuer Funktionen aus LSBR.LIB bzw. SSBR.LIB + * + * Module + * freadlin.c + * fscanlin.c + * fsopen.c + * ftopen.c + * topen.c + * ftransfer.c + * + * written: 1989 05 02 + * latest update: 1997-11-02 14:05:21 + * + */ + +#ifndef __GG_sbr__ +#define __GG_sbr__ + +#include <gg/floskel.h> + +/* Modul FREADLIN.C ------------------------------------------------------- */ +#ifdef _FILE_DEFINED +int cdecl fread_line (FILE *fi, char *p, int c); +int cdecl fread_mac_line (FILE *fi, char *p, int c); +/* include <STDIO.H> */ +/* int fread_line (fi, p, c) */ +/* FILE *fi; file to read from */ +/* char *p; line buffer */ +/* int c; size of line buffer */ +/* RETURNS: <0 ... error or END-OF-FILE */ +/* 0 ... empty line */ +/* >0 ... number of characters read into line buffer */ +/* REMARKS: if c is smaller than the length of line, then the */ +/* remaining characters are read away. */ + +/* Modul FSCANLIN.C ------------------------------------------------------- */ +int cdecl fscan_line ( +FILE *fi, /* gelesenes File */ +char *line, /* Pufferbereich fuer Zeile */ +int max_line, /* Groesse von line */ +int max_par, /* maximale Zahl der geparsten Zeichen */ + /* <<<< nicht verwendet !!! */ +int comment, /* Kommentarzeichen (z.b. '#') */ +int in_flags, /* Input Flags: siehe FCLI_xxxxx */ + /* <<<< nicht verwendet !!! */ +char *parse_line [], /* Zeiger auf geparste Zeilenelemente */ +int parse_pos [], /* Position der geparsten Zeilenelemente */ +int *parse_cnt, /* tatsaechlich gelesene Zeilenelemente */ +int *out_flags); /* Output Flags: siehe FCLO_xxxx */ +/* RETURN: EOF wenn fgetc EOF liefert */ +/* EOF wenn keine Zeile mehr geparst werden kann */ +/* 0 alles ok */ + +/* Modul FSCANLIN.C ------------------------------------------------------- */ +int cdecl fpars_line ( +char *line, /* Pufferbereich fuer Zeile */ +int comment, /* Kommentarzeichen (z.b. '#') */ +int in_flags, /* Input Flags: siehe FCLI_xxxxx */ +char *parse_line [], /* Zeiger auf geparste Zeilenelemente */ +int parse_pos [], /* Position der geparsten Zeilenelemente */ +int *parse_cnt, /* tatsaechlich gelesene Zeilenelemente */ +int *out_flags); /* Output Flags: siehe FCLO_xxxx */ +/* RETURN: EOF wenn fgetc EOF liefert */ +/* EOF wenn keine Zeile mehr geparst werden kann */ +/* 0 alles ok */ + +/* Modul FSOPEN.C --------------------------------------------------------- */ +FILE *cdecl fsopen (char *, char *, + unsigned int, int, int, int *); +/* INCLUDE: <stdio.h> <share.h> <fcntl.h> */ +/* FILE *fsopen (file_name, file_mode, */ +/* open_mode, share_mode, retry, err) */ +/* char *file_name, Filename des zu oeffnenden Files */ +/* *file_mode; fopen (file_name, file_mode); */ +/* int open_mode, open (file_name, open_mode); */ +/* share_mode, Share Codes */ +/* retry, Zahl der Versuche */ +/* *err; DOS Error Code; Fehlercode */ +/* RETURN: file_pointer (Stream); err := 0 */ +/* (FILE *) 0 --> File not opened; err := Fehlercode */ + +/* Modul FTOPEN.C --------------------------------------------------------- */ +FILE *cdecl ftopen (char *, char *, + int, int, int *); +/* INCLUDE: <stdio.h> */ +/* FILE *ftopen (path_name, file_mode, */ +/* open_mode, share_mode, err) */ +/* char *path_name, Pathname des zu oeffnenden Files (siehe unten) */ +/* *file_mode; fopen (file_name, file_mode); */ +/* int open_mode, open (file_name, open_mode); */ +/* share_mode, Share Codes */ +/* *err; DOS Error Code; Fehlercode */ +/* RETURN: file_pointer (Stream); err := 0 */ +/* (FILE *) 0 --> File not opened; err := Fehlercode */ + +/* module %sbr/flopen.c --------------------------------------------------- */ +#ifdef _FILE_DEFINED +FILE *cdecl flopen (char *file_name, char *open_mode); +#endif /* _FILE_DEFINED */ +int cdecl flclose (char *file_name); +int cdecl flclose_all (void); +int cdecl flprint_table (FILE *fo); + +#ifdef _FILE_DEFINED +/* fopenwng.c */ FILE *cdecl fopen_wng (char *fnm, char *mode); +#endif /* _FILE_DEFINED */ + +/* ftrans01.c */ long cdecl ftransfer (FILE *fi, FILE *fo, long cpy_size); +/* ftrans02.c */ long cdecl f2transfer (char *fi_nm, FILE *fo, + long cpy_start, long cpy_size); +/* ftrans03.c */ long cdecl f3transfer (char *fi_nm, char *fo_nm, + long cpy_start,long cpy_size); +/* ftrans04.c */ long cdecl ftransfer_to_shar (FILE *fi, FILE *SHAR, + char *fnm, long cpy_size, char *st_dat_buffer); +/* ftrans05.c */ long cdecl f5transfer_to_shar (char *fi_nm, FILE *SHAR, + char *fnm, long cpy_start, long cpy_size, char *fi_buf, + int shar_bufsiz, char *st_dat_buffer); +/* ftrans06.c */ long cdecl ftransfer_line (FILE *fi, FILE *fo, + long cpy_size); +/* ftrans07.c */ long cdecl ftransfer_crlf (FILE *fi, FILE *fo, + long cpy_size); +/* ftrans08.c */ long cdecl f2transfer_crlf (char *fi_nm, FILE *fo, + long cpy_start, long cpy_size); +/* ftrans09.c */ long cdecl ftransfer_add_dot (FILE *fi, FILE *fo, + long cpy_size); +/* ftrans10.c */ long cdecl ftransfer_del_dot (FILE *fi, FILE *fo, + long cpy_size); + +/* trasheol.c */ long cdecl trash_until_eol (FILE *fi); +/* freadit.c */ int cdecl fread_integer_table (FILE *f, + long int_table [], int table_size, char *buffer, + int buffer_size); +/* freaditf.c */ int cdecl fread_integer_table_file (char *fnm, + long int_table [], int table_size, char *buffer, + int buffer_size); +/* freadst.c */ int cdecl fread_string_table (FILE *f, + char *string_table [], int table_size, char *buffer, + int buffer_size); +/* freadstf.c */ int cdecl fread_string_table_file (char *fnm, + char *string_table [], int table_size, char *buffer, + int buffer_size); +#endif + +long cdecl copy_file (char *src, char *dst, int flags); +/* Return: -1L ... error; >= 0L number of bytes copied */ +#define COPY_FILE_verify 0x0001 +#define COPY_FILE_append 0x0002 +#define COPY_FILE_old_date 0x0004 /* not implemented */ +#define COPY_FILE_dont_overwrite 0x0008 +#define COPY_FILE_in_text 0x0010 +#define COPY_FILE_out_text 0x0020 + +int cdecl copyfile (char *src, char *dst); + +/* Modul TOPEN.C ---------------------------------------------------------- */ +long cdecl topen (char *path_name, int msdos_file_attribute); +/* ANMERKUNG: */ +/* path_name: String des gueltigen Pfades, nach dem 0-Character muss laut */ +/* MSDOS Programmierhandbuch noch fuer 13 Byte Platz sein. */ + +/* Modul FNMQUEUE.C ------------------------------------------------------- */ +int cdecl string_queue (char *fn); +int cdecl string_push (char *fn); +char *cdecl string_pull (void); +void cdecl string_reset (void); + +/* module fmt.c ----------------------------------------------------------- */ +void cdecl dc_reset (void); +void cdecl dc_modus (int d); +void cdecl dc_cal (double v); +char *cdecl dc_chk (int st, int sig, int nk, int faktor_st, double *faktor, + char **cp2, int komma, int punkt); +char *cdecl dc_fmt (double v); + +/* module scan.c ---------------------------------------------------------- */ +/* Einlesen eines Strings via field_edit */ +int cdecl scan_str ( +char field [], /* editiertes Feld */ +int helpnum, /* 1. Help Seite */ +int flag, /* Bit 0: --> Field loeschen vor Edit */ + /* 1: --> Field terminieren nach Blank udgl. */ + /* 2: --> Default-Descriptor verwenden */ + /* 3: --> Editierung Ende nach 1 Input Char */ + /* == Single Character Mode */ + /* Bit 4: --> Feld nur anzeigen */ +int timeout1, +int x, +int y, +int l, +int attr, /* Koordinaten, Laenge und Attribut */ +int *oflg); /* Bit 0: field veraendert */ + +/* module scan.c ---------------------------------------------------------- */ +/* Ein Feld im Textmodus (40|80 Zeichen) editieren */ +int cdecl field_edit ( +char field [], /* Editiertes Feld (intern immer String) */ +int mode, /* 1 -> 80 Zeichen Mode */ +char desc [], /* Field-Descriptor-Record */ +unsigned int *key, /* letzte uninterpretierte Taste */ +unsigned int *timeout, /* (IN/OUT) Zeit Limit fuer Edit: */ + /* kann fuer ein ganzes Feld oder auch nur */ + /* fuer ein Zeichen verstanden werden */ +unsigned int *oflg); /* Bit 0: field veraender */ +/* RETURN: 0 -> keine Funktionstastenzuordnung */ +/* -> *key == uninterpretierter Tastenwert (mapped) */ +/* 1 -> Funktionstastenzuordnung gefunden */ +/* -> *key == Destination Frame Nummer (Bit 15 == 0) */ +/* 2 -> Timeout abgelaufen; *key ist undefiniert */ + +/* module scan.c ---------------------------------------------------------- */ +void cdecl show_field ( +char field [], /* Feldinhalt */ +int mode, /* 1 -> 80 Zeichen */ +char desc [], /* Beschreibung des Feldes */ +int flag); /* 1 -> inverse Darstellung */ + +/* module scan.c ---------------------------------------------------------- */ +int cdecl getkey (unsigned int *akt, unsigned int *timeout); + +/* module scan.c ---------------------------------------------------------- */ +/* Einlesen eines Integers via field_edit */ +void cdecl scan_int ( +int *field, /* editiertes Feld */ +int helpnum, /* 1. Help Seite */ +int flag, /* Bit 0: --> Field loeschen vor Edit */ + /* 1: --> Field terminieren nach Blank udgl. */ + /* 2: --> Default-Descriptor verwenden */ +int timeout1, +int x, +int y, +int l, +int attr, /* Koordinaten, Laenge und Attribut */ +int *oflg); /* Bit 0: field veraendert */ + +/* module scan.c ---------------------------------------------------------- */ +/* Einlesen eines HEX-Integers via field_edit */ +void cdecl scan_hex ( +int *field, /* editiertes Feld */ +int helpnum, /* 1. Help Seite */ +int flag, /* Bit 0: --> Field loeschen vor Edit */ + /* 1: --> Field terminieren nach Blank udgl. */ + /* 2: --> Default-Descriptor verwenden */ +int timeout1, +int x, +int y, +int l, +int attr, /* Koordinaten, Laenge und Attribut */ +int *oflg); /* Bit 0: field veraendert */ + +/* module scan.c ---------------------------------------------------------- */ +void cdecl set_coff (int x); + +#endif /* __GG_sbr__ */ diff --git a/lib/include/gg/sgml.h b/lib/include/gg/sgml.h new file mode 100644 index 0000000000000000000000000000000000000000..2de30bb4b3103a173adcde060c8fce9e95bf3188 --- /dev/null +++ b/lib/include/gg/sgml.h @@ -0,0 +1,142 @@ +/* + * include FILE <gg/sgml.h> + * + * declaration of datastructures for SGML tagged text + * + * written: 1990 09 27 + * 1991 02 03: Revision + * latest update: 1994-12-12 + * + */ + +#ifndef __GG_sgml__ +#define __GG_sgml__ + +#include <gg/floskel.h> +#include <gg/signatur.h> /* signatures must be defined! */ + +#define TeX_VERSION /* #################### */ + +/* ------------------------------------------------------------------------ */ +struct SGML_LIST +{ + int sig; + void *car; + struct SGML_LIST *cdr; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_INFO_BYTE +{ + int sig; + int size; + char info [2]; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_INFO_LONG +{ + int sig; + int size; + long info [2]; +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_TAG +{ + int sig; + int sgml_tag_id; + char *sgml_tag_name; +#ifdef JUNK + int sgml_tag_flags; /* Bit 1: can be purged */ + /* TAG braucht nicht mehr aufgel�st */ + /* zu werden, bzw. Protokollierung */ + /* ist nicht mehr notwendig */ +#endif + /* usw. usw. usw. */ +} ; + +/* ------------------------------------------------------------------------ */ +struct SGML_VARIABLE +{ + int sig; + void *sgml_variable_name; + void *sgml_variable_value; + struct SGML_VARIABLE *sgml_variable_next; +} ; + +/* SGML TAG Codes: -------------------------------------------------------- */ +#define SGML_TAG_undefined 0x0000 +#define SGML_TAG_frame 0x0001 +#define SGML_TAG_endframe 0x0002 +#define SGML_TAG_Sframe 0x0003 +#define SGML_TAG_Sendframe 0x0004 +#define SGML_TAG_if 0x0005 +#define SGML_TAG_else 0x0006 +#define SGML_TAG_endif 0x0007 +#define SGML_TAG_switch 0x0008 +#define SGML_TAG_case 0x0009 +#define SGML_TAG_default 0x000A +#define SGML_TAG_break 0x000B +#define SGML_TAG_endswitch 0x000C +#define SGML_TAG_set 0x000D +#define SGML_TAG_paragraph 0x000E +#define SGML_TAG_endparagraph 0x000F +#define SGML_TAG_Link 0x0010 +#define SGML_TAG_endLink 0x0011 +#define SGML_TAG_Ref 0x0012 +#define SGML_TAG_endRef 0x0013 +#define SGML_TAG_verbatim 0x0014 +#define SGML_TAG_endverbatim 0x0015 +#define SGML_TAG_FrAttr 0x0016 +#define SGML_TAG_SIG1 0x0017 +#define SGML_TAG_SIG2 0x0018 +#define SGML_TAG_typographic 0x0019 +#define SGML_TAG_link 0x001A +#define SGML_TAG_endlink 0x001B +#define SGML_TAG_name 0x001C +#define SGML_TAG_endname 0x001D +#define SGML_TAG_reference 0x001E +#define SGML_TAG_endreference 0x001F + +#define SGML_TAG_ned_sgml 0x0020 +#define SGML_TAG_hyx_stamp 0x0021 + +#ifdef TeX_VERSION +#define SGML_TAG_Titel 0x0101 +#define SGML_TAG_endTitel 0x0102 +#define SGML_TAG_Hervorhebung 0x0103 +#define SGML_TAG_endHervorhebung 0x0104 +#define SGML_TAG_OverheadText 0x0105 +#define SGML_TAG_endOverheadText 0x0106 +#define SGML_TAG_Definition 0x0107 +#define SGML_TAG_endDefinition 0x0108 +#define SGML_TAG_Formel 0x0109 +#define SGML_TAG_endFormel 0x010A +#define SGML_TAG_Gleichung 0x010B +#define SGML_TAG_endGleichung 0x010C +#define SGML_TAG_Tabelle 0x010D +#define SGML_TAG_endTabelle 0x010E +#define SGML_TAG_BodyText 0x010F +#define SGML_TAG_endBodyText 0x0110 +#define SGML_TAG_Tex 0x0111 +#define SGML_TAG_slant 0x0114 +#define SGML_TAG_endslant 0x0115 +#define SGML_TAG_quote 0x0116 +#define SGML_TAG_endquote 0x0117 +#define SGML_TAG_note 0x0118 +#define SGML_TAG_endnote 0x0119 +#endif + +/* SGML Prozessor Codes: -------------------------------------------------- */ +#define SGML_PROC_verbatim 0 +#define SGML_PROC_text 1 +#define SGML_PROC_title_1 2 +#define SGML_PROC_title_2 3 + +/* prototypes: ------------------------------------------------------------ */ + +/* sgml0008.c */ void sgml_transmit_2segment (void *segment); +/* sgml0008.c */ void flush_segments (void); + +#endif /* __GG_sgml__ */ diff --git a/lib/include/gg/signatur.h b/lib/include/gg/signatur.h new file mode 100644 index 0000000000000000000000000000000000000000..306591c6d75095031e0b7326b48b7c70ab73002d --- /dev/null +++ b/lib/include/gg/signatur.h @@ -0,0 +1,54 @@ +/* + * include FILE <gg/signatur.h> + * + * signatures of various data structures + * + * written: 1994-11-12 + * latest update: 1996-12-11 12:51:39 + * + */ + +#ifndef __GG_signature__ +#define __GG_signature__ + +/* <gg/sgml.h> SGML_signatures -- (int) ----------------------------------- */ +#define SIG_LIST 0x0101 +#define SIG_INFO_BYTE 0x0111 +#define SIG_INFO_LONG 0x0112 +#define SIG_TAG 0x0121 +#define SIG_PARAMETER 0x0122 + +/* <gg/parse.h> -- (long) ------------------------------------------------- */ +#define SIG_epsilon 0x0200 +#define SIG_TEXT_SEGMENT 0x0201 +#define SIG_TEXT_ELEMENT 0x0202 /* formerly: SIG_TEXT */ +#define SIG_TAG_DEFINITION 0x0203 +#define SIG_MARKUP 0x0204 +#define SIG_ENTRY 0x0205 +#define SIG_OUTPUT_DESCRIPTOR 0x0206 + +/* <gg/ta.h> -- (ilong) --------------------------------------------------- */ +#define SIG_TA_TAG 0x0301 +#define SIG_TA_TEXT 0x0302 +#define SIG_TA_OBJECT 0x0303 + +/* <gg/varspace.h> -- (long) ---------------------------------------------- */ +#define SIG_VS_NODE 0x0401 + +/* <gg/vieos.h> -- (long) ------------------------------------------------- */ +#define SIG_VIEOS_CONTEXT 0x0500 +#define SIG_VIEOS_MARKUP 0x0501 +#define SIG_VIEOS_INDEX 0x0502 +#define SIG_VIEOS_BLOCK 0x0503 +#define SIG_VIEOS_CLUSTER 0x0504 +#define SIG_VIEOS_GENERIC 0x05FF + +/* <gg/hyxtcl.h> -- (long) ------------------------------------------------ */ +#define SIG_BBC_SESSION 0x0601 +#define SIG_BBC_LISTEN 0x0602 +#define SIG_BBC_CONNECTION 0x0603 + +/* <gg/ytree.h> -- (long) ------------------------------------------------- */ +#define SIG_YTREE_CONTROL 0x0701 + +#endif /* __GG_signature__ */ diff --git a/lib/include/gg/sixel.h b/lib/include/gg/sixel.h new file mode 100644 index 0000000000000000000000000000000000000000..37632f6e815677311824e198588b789306f627b9 --- /dev/null +++ b/lib/include/gg/sixel.h @@ -0,0 +1,230 @@ +/* + * include FILE <gg/sixel.h> + * + * written: 1992 02 01 + * latest update: 1995-03-11 + * + */ + +#ifndef __GG_sixel__ +#define __GG_sixel__ + +#include <gg/floskel.h> + +#define BASE64_ENCODING + +/* ------------------------------------------------------------------------ */ +struct SIXEL_TAG_bin_f +{ + int STbf_initialized; /* 1 -> filled in */ + char *STbf_fn; + char *STbf_url; + char *STbf_doi; + long STbf_size; + long STbf_parts; +} ; + +/* ------------------------------------------------------------------------ */ +struct SIXEL_TAG_bin_d +{ + int STbd_initialized; /* 1 -> filled in */ + char *STbd_doi; + long STbd_beg; + long STbd_lng; + long STbd_part; + int STbd_ws; + int STbd_cont; +} ; + +/* ------------------------------------------------------------------------ */ +struct SIXEL_SEGMENT_desc +{ + char *SSd_filename; + long SSd_beg; + int SSd_ok; /* 1 -> segment is part of the full list */ + + struct SIXEL_SEGMENT_desc *SSd_next; + struct SIXEL_TAG_bin_f *SSd_bin_f; + struct SIXEL_TAG_bin_d *SSd_bin_d; +} ; + +/* sixel encoder split modes ---------------------------------------------- */ +#define SIXEL_OM_stream 0 /* output to a (FILE *) */ +#define SIXEL_OM_1afile 1 /* file name for output is given (append) */ +#define SIXEL_OM_1ofile 2 /* file name for output is given (overwrite)*/ +#define SIXEL_OM_files 3 /* pattern for file name is given: */ + /* example: "sp%06lX.spl" or "xyz.%03lX" */ + /* out_count must be set!!!! */ +#define SIXEL_OM_system 4 /* call program for processing of file */ + +/* sixel encoder split modes ---------------------------------------------- */ +#define SIXEL_SM_none 0 /* no splitting */ +#define SIXEL_SM_parts 1 /* number of parts specified */ +#define SIXEL_SM_words 2 /* number of source words per segment */ +#define SIXEL_SM_lines 3 /* number of encoded lines per segment */ + +/* bitmsk32.c ------------------------------------------------------------- */ +extern unsigned long bitmask_32bit [33]; + +/* sixeltab.c ------------------------------------------------------------- */ +extern unsigned char *sixel_table; +extern unsigned char *sixel_table_name; + +/* sixelenc.c ------------------------------------------------------------- */ +int cdecl sixel_encode (long wrd, char *sixel_buffer); +int cdecl sixel_encode_setup (int wordsize); +int cdecl sixel_encode_bits (void); + +/* sixeldec.c ------------------------------------------------------------- */ +int cdecl sixel_decode (int ch, long *word_buffer); +int cdecl sixel_decode_setup (int wordsize); +int cdecl sixel_decode_bits (void); + +/* sixelval.c ------------------------------------------------------------- */ +int cdecl sixel_value (int ch); + +/* sfileenc.c ------------------------------------------------------------- */ +int cdecl sixel_file_encode (char *fn, int word_size, + char *enc_fn, char *enc_url, char *enc_doi, char *enc_ty, + int out_mode, void *out_pointer, + long *out_count, int split_mode, long split_value, + int line_length); + +/* ssegmdec.c ------------------------------------------------------------- */ +#ifdef _FILE_DEFINED +int cdecl sixel_segment_decode (FILE *fi, FILE *fo, + long word_count, int first_char); +/* return values: 0x00 .. 0xFF = last character read and not processed */ +/* negative values: */ +#endif +#define SIXEL_SD_error -1 /* can't read or write stream */ +#define SIXEL_SD_eof -2 /* input stream's EOF reached */ +#define SIXEL_SD_counted_down -3 /* word_count is down to 0 */ + +/* ssegmana.c ------------------------------------------------------------- */ +#ifdef _FILE_DEFINED +int cdecl sixel_analyze_segment (FILE *fi, + FILE *((*fo_proc) (struct SIXEL_TAG_bin_f *stbf, + struct SIXEL_TAG_bin_d *stbd)), + struct SIXEL_SEGMENT_desc **ssd, + struct SIXEL_TAG_bin_f *stbf_preset, + int word_size, int pass); + +int cdecl sixel_analyze_bin_tags (FILE *fi, int write_data, + struct SIXEL_TAG_bin_f *stbf, struct SIXEL_TAG_bin_d *stbd); +/* return values: SIXEL_AT_xxxx */ +#endif + +/* stagiden.c ------------------------------------------------------------- */ +int cdecl sixel_identify_tag (char *buffer); + +#define SIXEL_AT_error -1 +#define SIXEL_AT_junk 0 +#define SIXEL_AT_bin_f 1 +#define SIXEL_AT__bin_f 2 +#define SIXEL_AT_bin_d 3 +#define SIXEL_AT__bin_d 4 +#define SIXEL_AT_bin 5 +#define SIXEL_AT__bin 6 +#define SIXEL_AT_tag 7 +#define SIXEL_AT__tag 8 + +/* sattiden.c ------------------------------------------------------------- */ +int cdecl sixel_identify_attribute (char *buffer); + +#define SIXEL_AA_error -1 +#define SIXEL_AA_junk 0 +#define SIXEL_AA_doi 1 +#define SIXEL_AA_fn 2 +#define SIXEL_AA_size 3 +#define SIXEL_AA_lng 4 +#define SIXEL_AA_beg 5 +#define SIXEL_AA_part 6 +#define SIXEL_AA_parts 7 +#define SIXEL_AA_cont 8 +#define SIXEL_AA_ws 9 + +/* sixdeb01.c ------------------------------------------------------------- */ +#ifdef _FILE_DEFINED +void cdecl print_bin_f (FILE *fo, struct SIXEL_TAG_bin_f *stbf); +#endif + +/* sixdeb02.c ------------------------------------------------------------- */ +#ifdef _FILE_DEFINED +void cdecl print_bin_d (FILE *fo, struct SIXEL_TAG_bin_d *stbd); +#endif + +/* sdec.c ----------------------------------------------------------------- */ +int cdecl sixel_segment_processor (char *fn, long begin_offset, + int word_size, int processing_mode, int options); + +#define SIXEL_PRC_linear 0 +#define SIXEL_PRC_pass1 1 /* pass 1: scan for segments */ +#define SIXEL_PRC_pass2 2 /* pass 2: decode the segments */ +#define SIXEL_PRC_segmlib 3 /* manage a segment library */ + +#define SIXEL_OPT_none 0x0000 /* no options (bit field) */ +#define SIXEL_OPT_ack_name 0x0001 /* acknowledge a files name */ + +/* ssegmsrt.c ------------------------------------------------------------- */ +int cdecl sixel_segment_sort (struct SIXEL_SEGMENT_desc *ssd); +#ifdef _FILE_DEFINED +int cdecl sixel_segment_list (FILE *fo); +#endif +int cdecl sixel_segment_pass2 (int word_size, int opts); +int cdecl sixel_segment_completeness (void); + +/* encoding scheme -------------------------------------------------------- */ +#ifdef __COMMENT__ +Sixel encoding repacks 6 bits of information in a source data stream +into 64 ASCII characters in the sixel encoded data stream: + +base64 encoding: +characters 'A'..'Z' = values 0..25 +characters 'a'..'z' = values 26..51 +characters '0'..'9' = values 52..61 +character '+' = value 62 +character '/' = value 63 + +old encoding scheme (base64 encoding): +characters 'a'..'z' = values 9..25 +characters 'A'..'Z' = values 26..51 +characters '0'..'9' = values 52..61 +character '+' = value 62 +character '-' = value 63 + +new encoding scheme: +character '+' = value 0 +character '-' = value 1 +characters '0'..'9' = values 2..11 +characters 'A'..'Z' = values 12..37 +characters 'a'..'z' = values 38..63 + +The bits are numbered from word #0, bit #0 to bit #(word_size-1) and +mapped into sixel values in the same order. The ordering of the bits +is fully preserved. +(Bit[i] in the source data stream is also bit[i] in the sixel data stream.) +#endif /* __COMMENT__ */ + +/* usage notes ------------------------------------------------------------ */ +#ifdef __COMMENT__ +sixel_encode_bits and sixel_decode_bits return the number of valid bits +still contained in the buffers of the respective modules. To avoid data +loss it is necessary to 'flush' out any valid data bits from the encoder. + +This means, after the encoder has processed all words from the source +data stream, the function sixel_encode_bits must be called to obtain the +number of bits still contained in the encoders buffer. Call the function +sixel_encode ((long) 0, buffer) until it returns a value > 0 and +then write only the character in buffer [0] to the sixel data stream. + +Remaining bits in the decoders buffer are meaningless and can be ignored. + +If the word size is smaller that 6, the encoder might deliver more +words from the sixel data stream than there were in the beginning. +Example: word size is 5 bits, 5 words to encode, makes 25 bits. + 25 bits need 5 sixels, but 5 sixels can hold 30 bits which + is also enough for 6 words. +#endif /* __COMMENT__ */ + +#endif /* __GG_sixel__ */ diff --git a/lib/include/gg/streams.h b/lib/include/gg/streams.h new file mode 100644 index 0000000000000000000000000000000000000000..666afd6aaec953f56915f85923edbb0ec3262266 --- /dev/null +++ b/lib/include/gg/streams.h @@ -0,0 +1,47 @@ +/* + * include FILE <gg/streams.h> + * + * methods + * data structures + * constants + * prototypes + * sub types: STREAM_FILE + * + * written: 1996-11-04 + * latest udpate: 1997-01-15 10:29:24 + * + */ + +#ifndef __GG_streams__ +#define __GG_streams__ + +#include <gg/floskel.h> + +/* methods: --------------------------------------------------------------- */ +typedef int STREAM_next_char (void *sop); +typedef int STREAM_end (void *sop); + +/* data structures: ------------------------------------------------------- */ +struct STREAM_OBJECT +{ + STREAM_next_char *next_char; + STREAM_end *is_end; + + long position; + void *stream_cd; +} ; + +/* prototypes: ------------------------------------------------------------ */ +#define new_stream_object() \ + ((struct STREAM_OBJECT *) calloc (sizeof (struct STREAM_OBJECT), 1)) + +#define stream_position(stream) (stream->position) + +/* STREAM_FILE: ----------------------------------------------------------- */ +#ifdef STREAM_FILE +struct STREAM_OBJECT *new_stream_file_object (FILE *fi); +int stream_file_next_char (void *sop); +int stream_file_eof (void *sop); +#endif /* STREAM_FILE */ + +#endif /* __GG_streams__ */ diff --git a/lib/include/gg/strings.h b/lib/include/gg/strings.h new file mode 100644 index 0000000000000000000000000000000000000000..2124e4917ff0669d0bb82f536c0ba91224a8914f --- /dev/null +++ b/lib/include/gg/strings.h @@ -0,0 +1,165 @@ +/* + * include FILE <gg/strings.h> + * + * see also: %ds/strings + * - constants + * - prototypes + * + * written: 1990 06 24 + * latest update: 1997-10-05 12:19:12 + * $Id: strings.h,v 1.8 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifndef __GG_strings__ +#define __GG_strings__ + +#include <gg/floskel.h> + +/* ------------------------------------------------------------------------ */ +struct STRLIST +{ + struct STRLIST *strl_next; + char *strl_string; +}; + +/* ------------------------------------------------------------------------ */ +struct OPERATION +{ + char *OP_name; /* name to be matched with */ + int OP_minimal_length; /* minimal match length for the string */ + long OP_info; /* information to be associated, its only */ + /* of interest for the calling function. */ +} ; + + +typedef int (*mk_pass_func) (char *s, int pass_lng); + +/* constants: ------------------------------------------------------------- */ +#define MATCH_error -1 /* something is wrong */ +#define MATCH_no 0 /* no match possible */ +#define MATCH_no_wildcard 1 /* matched without wildcard */ +#define MATCH_wildcard 2 /* matched with wildcard */ + +#define STR_DIGITS "0123456789" +#define STR_HEX_DIGITS "0123456789ABCDEF" +#define STR_hex_DIGITS "0123456789abcdef" +#define STR_Hex_DIGITS "0123456789abcdefABCDEF" + +/* ------------------------------------------------------------------------ */ +#define strlist_new() ((struct STRLIST *) calloc (sizeof (struct STRLIST), 1)) + +/* prototypes of library functions: --------------------------------------- */ +/* 0001 */ void cdecl strnscpy (char *d, char *s, int cnt); +/* 0002 */ int cdecl strcmp_c (char *s1, char *s2); +/* 0003 */ int cdecl strcmp_ebcdic (char *s1, char *s2); +/* 0004 */ char *cdecl to_lower (char *n); +/* 0005 */ char *cdecl to_upper (char *n); +/* 0006 */ int cdecl match (char *pattern, char *str); +/* 0007 */ int cdecl string_hash (char *str, int lng, char *hash, int hlng); +/* 0008 */ int cdecl match_lng (char *s1, char *s2, int cnt); +/* 0009 */ int cdecl strcmp_us (char *s1, char *s2); +/* 0010 */ int cdecl strcmp_weighted (char *s1, char *s2); +/* 0011 */ int cdecl strcmp_cweighted (char *s1, char *s2); +/* 0012 */ int cdecl lower_case (int n); +/* 0013 */ int cdecl upper_case (int n); +/* 0014 */ int cdecl strcmp_cre (char *s1, char *s2); +/* 0015 */ int cdecl skip_re (char *str); +/* 0016 */ int cdecl find_command (char *s, char *cmds[], int first, + int last); +/* 0017 */ char *cdecl str_assign (char **d, char *s); +/* 0018 */ char *cdecl rotate13 (char *s); +/* 0019 */ char *cdecl strridx (char *s, int ch); +/* 0020 */ int cdecl split_string (char *src, int spl, char *flds[], + int n_flds); +/* 0021 */ int cdecl match_array (char *patterns[], int pattern_count, + char *string); +/* 0022 */ int cdecl isolate_words (char *src, char *flds[], int n_flds); +/* 0023 */ int cdecl str2fld (char *src, char *flds[], int n_flds, + int delimiter, int open_quote, int close_quote, + int escape_char); +/* 0024 */ int cdecl isolate_tokens (char *src, char *flds[], int n_flds); +/* 0025 */ int cdecl strdiff (char *diff, char *s1, char *s2, + int eq_char, int diff_char, int eos_char); +/* 0026 */ int cdecl isolate2words (char *src, char *flds[], int n_flds, + int *table); +/* 0027 */ int cdecl put_chartable (int *table, char *chars, int value); +/* 0028 */ char *cdecl locate_word (char *s, int num); +/* 0029 */ long cdecl count_char (int code, char *s, long size); +/* 0030 */ int cdecl mk_passwd (char *s, int pass_lng); +/* 0031 */ int cdecl enter_value (char *s, int pos, int val, int digits); +#ifdef _FILE_DEFINED +/* 0032 */ void cdecl blanks (FILE *fo, int cnt); +#endif +/* 0033 */ int cdecl chr_index (char *chars, int value); +/* 0034 */ int cdecl xchange (char *s, int f, int t); +/* 0035 */ int cdecl gopher_url2components (char *url, char **host, + long *port, int *type, char **path, int *tabs); +/* 0036 */ int cdecl str_prompt (char *txt, char *dest, int lng, + char *tmp, char *preset); +/* 0037 */ int cdecl remove_apostrophe (char *s); +/* 0038 */ char *cdecl str_or_undef (char *s); +/* 0039 */ int cdecl mk_PassWord (char *s, int pass_lng); +/* 0040 */ struct OPERATION *cdecl get_operation (struct OPERATION ops [], + int n_ops, char *str); +/* 0041 */ int cdecl get_cat_code (int ch); + void cdecl set_cat_code (int ch, int code); +/* 0042 */ int cdecl get_weight_code (int ch); + void cdecl set_weight_code (int ch, int code); +/* 0043 */ int cdecl mk_pin_code (char *s, int pass_lng); +/* 0044 */ int cdecl free_or_what (void *s); +/* 0045 */ char *cdecl strdup_extra (const char *str, int extra); +/* 0046 */ int cdecl sgml_encode (char *title, char *tmp, int str_size); +#ifdef _FILE_DEFINED +/* 0047 */ char *cdecl read_string (FILE *fi, int string_length); +#endif /* _FILE_DEFINED */ +/* 0048 */ char *cdecl XSTR (char *str); +/* 0049 */ char *cdecl strcpy_max (char *d, const char *s, int size); +/* 0050 */ int cdecl strcmp_nn (char *s1, char *s2); +/* 0051 */ char *cdecl strdup_or_what (char *s); +/* 0052 */ int cdecl strcpy2_max (char *d, char *s, int size); +/* 0053 */ char *cdecl get_password_verified (char *p1, char *p2); + +/* remains of the famous MAGIS -------------------------------------------- */ +/* 0107 */ void cdecl strnins (char *str, int lng, int pos, int cnt); +/* 0108 */ void cdecl strndel (char *str, int lng, int pos, int cnt); +/* 0109 */ void cdecl delstr (char *s, int p); + +/* REXX like things ------------------------------------------------------- */ +/* 0201 */ int cdecl abbrev (const char *unabbr, const char *abbr, int lng); +/* 0202 */ char *cdecl translate (char *s, char *tbl_in, char *tbl_out); +/* 0203 */ int cdecl verify (char *string, char *reference); +/* 0204 */ int cdecl strip (char *string, char *where); + +/* OS/environment specific functions -------------------------------------- */ +#ifdef __CMS__ +#define __strdup_undefined__ +#endif +#ifdef __hpux_older_version +#define __strdup_undefined__ +#endif +#ifdef __ultrix +#define __strdup_undefined__ +#endif +#ifdef __AIX43__ +#define __strndup_defined__ +#endif + +#ifdef __strdup_undefined__ +/* 0301 */ char *cdecl strdup (const char *str); +#endif + +#ifndef __strdnup_defined__ +#ifndef size_t +#include <sys/types.h> +#endif +/* 0302 */ char *cdecl strndup (const char *str, size_t size); +#endif + +#ifdef __strrev_undefined__ +/* 0303 */ char *cdecl strrev (char *str); +#endif + +/* 0304 */ char *cdecl strdup_max (char *str, int max_size); + +#endif /* __GG_strings__ */ diff --git a/lib/include/gg/syncfsh.h b/lib/include/gg/syncfsh.h new file mode 100644 index 0000000000000000000000000000000000000000..5cdde62a541cbeefc48a85a5b4f361d820ffd76a --- /dev/null +++ b/lib/include/gg/syncfsh.h @@ -0,0 +1,176 @@ +/* + * include FILE <gg/syncfsh.h> + * + * - constants: design, other + * - structures: SFS_RECORD, SFS_FILESYSTEM, SFS_GLOBAL + * - prototypes + * + * written: 1994-02-12 + * latest update: 1998-07-19 10:43:10 + * $Id: syncfsh.h,v 1.2 2002/01/22 03:09:53 gonter Exp $ + * + */ + +#ifndef __GG_syncfs__ +#define __GG_syncfs__ + +#include <gg/floskel.h> +#include <gg/ytree.h> + +/* design constants: ------------------------------------------------------ */ +#define N_COMPDIRS 10 /* max number of HOST systems to compare */ +#define N_MATCH_TABLE 64 /* The maximum number of different match */ + /* patterns or regular expressions to test */ + /* filename against in order to find out if */ + /* the file should actually be examined. */ +#define MAX_NUM_FS 128 /* number of different filesystems to be */ + /* specified for checking explicitly. */ + +#define LINE_SIZE 1024 +#ifdef MSDOS +#define FNM_SIZE 256 +#else +#define FNM_SIZE 1024 +#endif /* !MSDOS */ + +/* other constants: ------------------------------------------------------ */ +#define SFS_TEST 1 /* just check files through */ +#define SFS_COMPARE 2 /* also compare with other system */ + +/* ------------------------------------------------------------------------ */ +struct SFS_RECORD /* description of a single file */ +{ /* as currently found in the file system */ + char *SFSR_name; /* name of the file */ + char *SFSR_md5; /* MD5 checksum, if known */ + char *SFSR_date; /* last modification date */ + char *SFSR_time; /* last modification time */ + long SFSR_size; /* actual size of the file */ + +#define SFSF_undef 0x0000 +#define SFSF_missing 0x0001 +#define SFSF_md5_equal 0x0002 +#define SFSF_size_larger 0x0010 +#define SFSF_size_smaller 0x0020 +#define SFSF_date_newer 0x0100 +#define SFSF_date_older 0x0200 +#define SFSF_checked 0x4000 + int SFSR_flags [N_COMPDIRS]; + + char *SFSR_owner_name; + char *SFSR_group_name; + char *SFSR_permissions; +} ; + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +#define _SFS_GLOBAL_DEFINED +struct SFS_GLOBAL +{ + char *SFSG_masterdir; /* directory where everything happens */ + char *SFSG_fnm_table; /* name of sync filesystem table */ + char *SFSG_environment_id; /* userid for whom this is happening */ + char *SFSG_fs [MAX_NUM_FS]; /* name of file system to check */ + int SFSG_fs_cnt; /* number of file systems to check (0==all) */ + + char *SFSG_compdirs [N_COMPDIRS]; + char *SFSG_systems [N_COMPDIRS]; + int SFSG_compdir_cnt; + + char *SFSG_offer_batch_name; + char *SFSG_order_batch_name; + FILE *SFSG_offer_batch_file; + FILE *SFSG_order_batch_file; + + /* various flags: */ + int SFSG_do_md5; /* also take MD5 finger prints [DEF: OFF] */ + int SFSG_recursive; /* also scan subdirectories [DEF: ON] */ + int SFSG_verbose_level; /* to chat or not to chat [DEF: 0] */ + int SFSG_diagnose_level; /* [DEF: 0] */ + int SFSG_run_mode; /* SFS_TEST | SFS_COMPARE */ + int SFSG_compact; /* 1 -> compact table format */ + + /* counter'n'stuff */ + int SFSG_num_ordered; + int SFSG_num_offered; +} ; + +/* ------------------------------------------------------------------------ */ +#define _SFS_FILESYSTEM_DEFINED +struct SFS_FILESYSTEM +{ + struct SFS_GLOBAL *SFSF_global; + + char *SFSF_file_system; + char *SFSF_working_dir; + int SFSF_path_length; + + char *SFSF_patterns [N_MATCH_TABLE]; + int SFSF_num_patterns; + int SFSF_match_counter [N_MATCH_TABLE]; /* statistics ... */ + + /* various flags: inherited from SFS_GLOBAL and subsequently adapted */ + int SFSF_do_md5; /* also take MD5 finger prints [DEF: OFF] */ + int SFSF_recursive; /* also scan subdirectories [DEF: ON] */ + int SFSF_verbose_level; /* to chat or not to chat [DEF: 0] */ + int SFSF_diagnose_level; /* [DEF: 0] */ + int SFSF_run_mode; /* SFS_TEST | SFS_COMPARE */ + + char *SFSF_cks2; + FILE *SFSF_Fcks2; + + /* counter'n'stuff */ + int SFSF_num_ordered; /* number of files ordered in this fs */ + int SFSF_num_offered; /* number of files offered from this fs */ + int SFSF_num; /* currently checked filesystem number */ + char *SFSF_sysname; /* not malloc'ed !!! */ + + struct YTREE *SFSF_recs; +} ; +#endif /* _FILE_DEFINED */ + +/* prototypes ------------------------------------------------------------- */ +#ifdef _SFS_GLOBAL_DEFINED +/* syncfsb.c */ int cdecl syncfs_file_handler (char *fn, void *cd); + int cdecl syncfs_dir_enter (char *fn, void *cd); + int cdecl syncfs_dir_leave (char *fn, void *cd); +/* syncfs01.c */ int cdecl syncfs_table (struct SFS_GLOBAL *sfsg); +/* syncfs02.c */ int cdecl syncfs_check (struct SFS_FILESYSTEM *f, char *fn, + char *date_str, char *time_str, long file_size); +/* syncfs03.c */ int cdecl syncfs_record (struct SFS_FILESYSTEM *sfsf, + char *fn, long size, + char *f_date, char *f_time, char *md5_string); +/* syncfs04.c */ struct SFS_GLOBAL *cdecl sfs_new_global_descriptor (void); +/* syncfs05.c */ struct SFS_FILESYSTEM *cdecl sfs_new_filesystem_descriptor ( + struct SFS_GLOBAL *gd); +/* syncfs06.c */ int cdecl sfs_free_filesystem_descriptor ( + struct SFS_FILESYSTEM *fs); +/* syncfs07.c */ int cdecl syncfs_set_pattern ( + struct SFS_FILESYSTEM *sfsf, char *p); +/* syncfs08.c */ int cdecl syncfs_offer_batch ( + struct SFS_FILESYSTEM *sfsf, char *fn); +/* syncfs09.c */ int cdecl syncfs_order_batch ( + struct SFS_FILESYSTEM *sfsf, char *fn); +/* syncfs10.c */ int cdecl syncfs_set_workdir (struct SFS_FILESYSTEM *sfsf, + char *wd, char *fsnm); +/* syncfs11.c */ int cdecl syncfs_close_workdir (struct SFS_FILESYSTEM *sfsf); +/* syncfs12.c */ int syncfs_set_system (struct SFS_GLOBAL *sfsg, + char *sys, char *compdir); +/* syncfs13.c */ int cdecl syncfs_free_all_records ( + struct SFS_FILESYSTEM *sfsf); +/* syncfs14.c */ struct SFS_RECORD *cdecl syncfs_find_record ( + struct SFS_FILESYSTEM *sfsf, char *fn); +/* syncfs15.c */ int cdecl syncfs_compare_records ( + struct SFS_FILESYSTEM *sfsf); +/* syncfs16.c */ int cdecl syncfs_compare (struct SFS_FILESYSTEM *sfsf, + char *fsnm, int num); +/* syncfs17.c */ int cdecl syncfs_free_one_record (struct YTREE *yt, + void *client_data); +/* syncfs18.c */ int cdecl syncfs_offer_remaining_files (struct YTREE *yt, + void *ct); + +/* DEBUGGING: ------------------------------------------------------------- */ +#define DEB_FREE() /* { fprintf (stderr, "%s %d\n", __FILE__, __LINE__); } */ + +#endif /* _SFS_GLOBAL_DEFINED */ + +#endif /* __GG_syncfs__ */ diff --git a/lib/include/gg/ta.h b/lib/include/gg/ta.h new file mode 100644 index 0000000000000000000000000000000000000000..d30937c81fe975f72a9700b1652ce1559c3a1fef --- /dev/null +++ b/lib/include/gg/ta.h @@ -0,0 +1,232 @@ +/* + * include FILE <gg/ta.h> + * + * general textual analysis + * . see also: <gg/parse.h> + * + * written: 1990-11-10 + * latest update: 1996-12-22 20:47:43 + * + */ + +#ifndef __GG_ta__ +#define __GG_ta__ + +#define DEBTA_100 + +#include <gg/attlist.h> /* attribute lists must be defined! */ +#include <gg/signatur.h> /* signatures must be defined! */ +#include <gg/floskel.h> + +#ifndef int32 +#define int32 long +#endif /* int32 */ + +/* ------------------------------------------------------------------------ */ +struct TA_TAG +{ + long sig; + struct TA_TAG *TAtag_next; + + long TAtag_type; +#define TAtag_8BIT 1 /* node contains a character string */ +#define TAtag_16BIT 2 /* node contains a 16-bit character string */ +#define TAtag_32BIT 3 /* node contains a 32-bit character string */ + + struct TA_TAG *TAtag_related; /* this tag is related to other tag */ + char *TAtag_relation; /* relationship of these tags */ + + struct ATTRIBUTE_LIST *TAtag_attributes; +} ; + +/* *** OBSOLETE *** ------------------------------------------------------- */ +struct TA_TEXT +{ + int sig; + struct TA_TEXT *ta_next; + + struct TA_TAG *ta_tag; /* type of the node: */ + long ta_cat_flags; /* flags for category codes (TA_CATF_xxx) */ + long ta_data_lng; /* used space */ + long ta_data_size; /* reserved space */ + + char ta_data [2]; /* text segment */ +} ; + +/* constraints: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* ta_data_lng < ta_data_size */ +/* ta_data [ta_data_lng] = 0; */ + +/* ------------------------------------------------------------------------ */ +struct TA_OBJECT /* describes a very general data object */ +{ /* very similar to a markup structure */ + int sig; + struct TA_OBJECT *TAO_next; + long TAO_type; /* defines the type of this object node */ +#define TAOT_object 0 /* TAO_body is another TA_OBJECT */ +#define TAOT_string 1 /* TAO_body is a string block */ +#define TAOT_tag 2 /* TAO_body is a TA_TAG structure */ +#define TAOT_text 3 /* TAO_body is a TA_TEXT structure */ +#define TAOT_other 4 /* any other contents type */ + struct TA_TAG *TAO_tag; + long TAO_size; /* size of the text block or other struct */ + + void *TAO_head; + void *TAO_body; + void *TAO_tail; +} ; + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +#define _TA_SOURCE_DEFINED +struct TA_SOURCE /* describes a source object */ +{ + FILE *TAS_file; + char *TAS_filename; + long TAS_line_number; + int TAS_is_eof; /* EOF has been detected */ +} ; +#endif + +/* *** OBSOLETE *** ------------------------------------------------------- */ +#ifdef JUNK +#define MAX_SEGMENT_BUFFER 1024 +struct TA_SEGMENT_STATUS +{ + int TSS_last_cat_code; /* undefined category code so far */ + int TSS_buffer_size; /* number of chars in buffer */ + long TSS_cat_flags; /* category flags of buffer */ + + char TSS_buffer [MAX_SEGMENT_BUFFER]; /* temporary data storage */ +} ; + +/* ------------------------------------------------------------------------ */ +struct TA_NODE_LIST_STATUS +{ + struct TEXT_ELEMENT *TNLS_nlist; + struct TEXT_ELEMENT **TNLS_napp; + long TNLS_ncnt; +} ; +#endif /* JUNK */ + +#define MAX_BUFFERED_NODES 4096 + +/* ------------------------------------------------------------------------ */ +#define TA_CAT_CODES 25 +#define TA_CAT_control1 1 +#define TA_CAT_control2 2 +#define TA_CAT_small 3 +#define TA_CAT_capital 4 +#define TA_CAT_digit 5 +#define TA_CAT_nat_small 6 +#define TA_CAT_nat_capital 7 +#define TA_CAT_nat_currency 8 +#define TA_CAT_greek 9 +#define TA_CAT_graphic 10 +#define TA_CAT_math1 11 +#define TA_CAT_math2 12 +#define TA_CAT_sond1 13 +#define TA_CAT_sond2 14 +#define TA_CAT_sond3 15 +#define TA_CAT_nat_satz 16 +#define TA_CAT_satz1 17 +#define TA_CAT_satz2 18 +#define TA_CAT_satz3 19 +#define TA_CAT_satz4 20 +#define TA_CAT_space1 21 +#define TA_CAT_space2 22 +#define TA_CAT_space3 23 +#define TA_CAT_ligature 24 + +#define TA_CATF_none 0x00000000L +#define TA_CATF_control1 0x00000001L +#define TA_CATF_control2 0x00000002L +#define TA_CATF_control 0x00000003L +#define TA_CATF_small 0x00000004L +#define TA_CATF_capital 0x00000008L +#define TA_CATF_letter 0x0000000CL /* small | capital */ +#define TA_CATF_digit 0x00000010L +#define TA_CATF_nat_small 0x00000020L +#define TA_CATF_nat_capital 0x00000040L +#define TA_CATF_nat_letter 0x00000060L /* nat small | capital */ +#define TA_CATF_nat_currency 0x00000080L +#define TA_CATF_greek 0x00000100L +#define TA_CATF_graphic 0x00000200L +#define TA_CATF_math1 0x00000400L +#define TA_CATF_math2 0x00000800L +#define TA_CATF_sond1 0x00001000L +#define TA_CATF_sond2 0x00002000L +#define TA_CATF_sond3 0x00004000L +#define TA_CATF_nat_satz 0x00008000L +#define TA_CATF_satz1 0x00010000L +#define TA_CATF_satz2 0x00020000L +#define TA_CATF_satz3 0x00040000L +#define TA_CATF_satz4 0x00080000L +#define TA_CATF_satz 0x000F8000L /* satz 1|2|3|4|nat */ +#define TA_CATF_space1 0x00100000L +#define TA_CATF_space2 0x00200000L +#define TA_CATF_space3 0x00400000L +#define TA_CATF_space 0x00700000L /* space 1 | 2 | 3 */ +#define TA_CATF_ligature 0x00800000L +#define TA_CATF_other 0x80000000L + +#define BREAK_DEFAULT_init 0x06 + +#define N_PAR_TYPE 5 +#define PAR_TYPE_text 0 +#define PAR_TYPE_section_head 1 +#define PAR_TYPE_table_head 2 +#define PAR_TYPE_figure_head 3 +#define PAR_TYPE_chapter 4 + +/* prototypes: ------------------------------------------------------------ */ +/* ta001.c */ extern struct TA_TAG TA_TAG_8BIT; + extern struct TA_TAG TA_TAG_16BIT; + extern struct TA_TAG TA_TAG_32BIT; + extern struct TA_TAG *TA_TAG_LIST; + extern struct TA_TAG **TA_TAG_APPEND; + +/* ta005.c */ struct TA_TEXT *cdecl ta_get_new_node ( + struct TA_TAG *tag_code, long data_size); + int cdecl ta_free_node (struct TA_TEXT *node); + +/* ta006.c */ long cdecl ta_get_new_id_code (void); +/* ta007.c */ int cdecl ta_read_setup (char *fn); +/* ta008.c */ void cdecl ta_reset_cat_names (void); + int cdecl ta_get_cat_name (char *s, int mode); + +/* ta010.c */ int cdecl ta_free_node_list (struct TA_TEXT *nlist); +/* ta012.c */ int cdecl ta_identify_par_type (struct TEXT_ELEMENT *li); + +#ifdef _FILE_DEFINED + int cdecl ta_print_paragraph (FILE *fo, + struct TEXT_ELEMENT *li, long ncnt); + int cdecl ta_print_nodelist (FILE *fo, + struct TEXT_ELEMENT *li, long ncnt, int par_type); + int cdecl ta012_finish (FILE *fo); + int cdecl ta_print_toc (FILE *fo, char *frame_name); + +/* ta015.c */ int cdecl hyx_ta_print_text_segments (FILE *fo, + struct TEXT_SEGMENT *ts); +#endif /* _FILE_DEFINED */ + +/* ta016.c */ struct HYX_PARSER_STATUS *cdecl ta_collect_init (void); + +/* ta019.c */ struct HYX_PARSER_STATUS *ta_create_node_list (void); +/* ta020.c */ int cdecl hyx_ta_flush_node_list ( + struct HYX_PARSER_STATUS *hps); +/* ta021.c */ int cdecl ta_collect_node (struct HYX_PARSER_STATUS *hps, + struct TEXT_ELEMENT *node); + +#ifdef _TA_SOURCE_DEFINED +/* ta101.c */ struct TA_OBJECT *cdecl tao_rd_sgml_body ( + struct TA_SOURCE *source); +#endif /* _TA_SOURCE_DEFINED */ + +/* ta102.c */ struct TA_OBJECT *cdecl tao_mk_string (char *str, int size); +/* tax01.c */ void cdecl ta_transmit_mode (int mode); + int cdecl ta_transmit_node ( + struct HYX_PARSER_STATUS *hps, + struct TEXT_ELEMENT *node); + +#endif /* __GG_ta__ */ diff --git a/lib/include/gg/taglst.h b/lib/include/gg/taglst.h new file mode 100644 index 0000000000000000000000000000000000000000..5230f62411d764c1a3d86b5d9de96621a7dd5842 --- /dev/null +++ b/lib/include/gg/taglst.h @@ -0,0 +1,33 @@ +/* + * include FILE <gg/taglst.h> + * + * written: 1990 06 10 + * latest update: 1995-10-26 + * + */ + +#ifndef __GG_taglst__ +#define __GG_taglst__ + +/* ------------------------------------------------------------------------ */ +struct TAGGED_LIST +{ + struct TAGGED_LIST *TL_next; + struct TAGGED_LIST *TL_prev; + int TL_lng; + int TL_tag; + char TL[2]; +} ; + +#define TAG_SCREEN 1 +#define TAG_FIELD 2 + +/* ------------------------------------------------------------------------ */ +struct TAGGED_LIST *tl_generate_tagged_list (struct TAGGED_LIST *tl, + char *array, int array_size, int tag, int typ); +struct TAGGED_LIST *tl_allocate (int data_size); +void tl_rueckverkettung (struct TAGGED_LIST *tl); +void tl_dump (FILE *fo, struct TAGGED_LIST *tl); +void tl_dump_list (FILE *fo, struct TAGGED_LIST *tl); + +#endif /* __GG_taglst__ */ diff --git a/lib/include/gg/tfb.h b/lib/include/gg/tfb.h new file mode 100644 index 0000000000000000000000000000000000000000..bdcdfcccfd0ffef306c2f17aead71fcbaf6e0a58 --- /dev/null +++ b/lib/include/gg/tfb.h @@ -0,0 +1,71 @@ +/* + * include FILE <gg/tfb.h> + * + * written: 1993-10-19 + * latest update: 1997-08-28 18:40:22 + * $Id: tfb.h,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifndef __GG_tfb__ +#define __GG_tfb__ + +#include <gg/floskel.h> + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +struct TFB_HANDLE +{ + char *TFBH_tfb_name; + char *TFBH_lut_name; + FILE *TFBH_tfb; + FILE *TFBH_lut; + char *TFBH_buffer; + int TFBH_buffer_size; +} ; +typedef struct TFB_HANDLE TFB_HANDLE; +#define TFB_default_buffer_size 4096 +#endif /* _FILE_DEFINED */ + +/* ------------------------------------------------------------------------ */ +#define AK_complain 0x01 +#define AK_last 0x02 + +#define MK_none 0 +#define MK_toupper 1 +#define MK_tolower 2 + +/* tfb01.c ---------------------------------------------------------------- */ +int cdecl tfb_get_entry (const char *keyword, + const char *file_tfb, const char *file_lut, + char *line_buffer, int MAX_LINE_BUFFER); + +/* tfb02.c ---------------------------------------------------------------- */ +int cdecl tfb_get_2entry (char *keyword, char *file_tfb, char *lut_buffer, + char *line_buffer, int MAX_LINE_BUFFER); +#ifdef _FILE_DEFINED +struct TFB_HANDLE *cdecl tfb_create_handle (char *fn_tfb, char *fn_lut); +int cdecl tfb_transfer_entry (FILE *fo, struct TFB_HANDLE *handle, + char *key); +int tfb_close_handle (struct TFB_HANDLE *h); +int tfb_fetch_entry (struct TFB_HANDLE *handle, char *key, + char *buffer, int buffer_size); +char *tfb_fetch_entry2 (TFB_HANDLE *handle, char *key); +#endif /* _FILE_DEFINED */ + +/* tfb06.c ---------------------------------------------------------------- */ +int cdecl tfb_get_tag_entry (const char *keyword, + const char *file_tfb, const char *file_lut, + char *line_buffer, char **field_fnm, + char **field_location, int MAX_LINE_BUFFER, + int kw_lng); + +/* tfblut01.c ------------------------------------------------------------- */ +int cdecl tfb_make_lut_file (char *tfb_file, char *lut_file, + int field_number, int field_delimiter, + int open_quote, int close_quote, + int escape_char, int ambigious_key, + int modification, int truncation, + int verbosity, int use_pos); + +#endif /* __GG_tfb__ */ diff --git a/lib/include/gg/tif.h b/lib/include/gg/tif.h new file mode 100644 index 0000000000000000000000000000000000000000..53c6eb6440673b9df3de0c566e94cfd0a7a6d21a --- /dev/null +++ b/lib/include/gg/tif.h @@ -0,0 +1,117 @@ +/* + * include FILE <gg/tif.h> + * + * definitions for images in TIF-format + * (Tagged Image File Format) + * + * written: 1989 10 16 + * 1991 10 03: Revision + * latest update: 1994-11-11 + * + */ + +#ifndef __GG_tif__ +#define __GG_tif__ + +#ifndef MSDOS +#define cdecl +#endif + +#define TIF_ORDER_INTEL 0x4949 /* II */ +#define TIF_ORDER_MOTOROLA 0x4D4D /* MM */ + +/* ------------------------------------------------------------------------ */ +struct TIF_HEADER +{ + int tif_order; + int tif_version; + long tif_directory_offset; +} ; + +/* ------------------------------------------------------------------------ */ +struct TIF_DIRECTORY +{ + int tif_dir_count; + long tif_next_directory; + int tif_dir_size; /* doesnt come from the file!! */ + /* size of puffer */ + struct TIF_DIR_ENTRY *tif_entry; +} ; + +/* ------------------------------------------------------------------------ */ +struct TIF_DIR_ENTRY +{ + int tif_dir_tag; + int tif_dir_type; + long tif_dir_length; + long tif_dir_offset; +} ; + +/* Tags -- Name ---------------------- Code ------------------------------- */ +#define TT_NewSubfileType 254 +#define TT_SubfileType 255 +#define TT_ImageWidth 256 +#define TT_ImageLength 257 +#define TT_BitsPerSample 258 +#define TT_Compression 259 + +#define TT_PhotometricInterpretation 262 +#define TT_Threshholding 263 +#define TT_CellWidth 264 +#define TT_CellLength 265 +#define TT_FillOrder 266 + +#define TT_DocumentName 269 +#define TT_ImageDescription 270 +#define TT_Make 271 +#define TT_Model 272 +#define TT_StripOffsets 273 +#define TT_Orientation 274 + +#define TT_SamplesPerPixel 277 +#define TT_RowsPerStrip 278 +#define TT_StripByteCounts 279 +#define TT_MinSampleValue 280 +#define TT_MaxSampleValue 281 +#define TT_XResolution 282 +#define TT_YResolution 283 +#define TT_PlanarConfiguration 284 +#define TT_PageName 285 +#define TT_XPosition 286 +#define TT_YPosition 287 +#define TT_FreeOffsets 288 +#define TT_FreeByteCounts 289 +#define TT_GrayResponseUnit 290 +#define TT_GrayResponseCurve 291 +#define TT_Group3Options 292 +#define TT_Group4Options 293 + +#define TT_ResolutionUnit 296 +#define TT_PageNumber 297 + +#define TT_ColorResponseCurves 301 + +#define TT_Software 305 +#define TT_DateTime 306 + +#define TT_Artist 315 +#define TT_HostComputer 316 +#define TT_Predictor 317 +#define TT_WhitePoint 318 +#define TT_PrimaryChromaticities 319 +#define TT_ColorMap 320 + +/* ------------------------------------------------------------------------ */ +#ifdef _FILE_DEFINED +/* tif00001.c */ int cdecl tif_read_directory (FILE *fi, + struct TIF_DIRECTORY *dir, int order); +#endif +/* tif00002.c */ char *cdecl tif_type (int type_code); +#ifdef _FILE_DEFINED +/* tif00003.c */ int cdecl tif_report_dir (FILE *fi, FILE *fo, + long relative_offset, struct TIF_DIRECTORY *tif_dir); +/* tif00004.c */ int cdecl tif_report_dir_entry (FILE *fi, FILE *fo, + long relative_offset, int nr, struct TIF_DIR_ENTRY *tp); +#endif + +#endif /* __GG_tif__ */ diff --git a/lib/include/gg/unify.h b/lib/include/gg/unify.h new file mode 100644 index 0000000000000000000000000000000000000000..140772b6018ebe156596def13b7f6bd01b2a9cd9 --- /dev/null +++ b/lib/include/gg/unify.h @@ -0,0 +1,100 @@ +/* + * include FILE <gg/unify.h> + * + * written: 1991 05 01 + * latest update: 1994-12-12 + * + */ + +#ifndef __GG_unify__ +#define __GG_unify__ + +#include <gg/floskel.h> + +/****************************************************************************/ +/** **/ +/** datastructures and constants **/ +/** **/ +/****************************************************************************/ + +/* ------------------------------------------------------------------------ */ +struct FEATURE_STRUCTURE +{ + struct FEATURE_STRUCTURE *fs_next; + short fs_sub1; /* subsumption flag */ + + struct FEATURE_STRUCTURE *fs_head; /* == feature name */ + short fs_head_type; /* type code for head structure */ + long fs_head_prop; + long fs_head_weight; + + struct FEATURE_STRUCTURE *fs_tail; /* == feature value */ + short fs_tail_type; /* type code for tail structure */ + long fs_tail_prop; + long fs_tail_weight; +} ; + +/* subsumption flags ------------------------------------------------------ */ +#define FS_sub_holds 0 /* subsumption relation holds */ +#define FS_sub_feature 1 /* feature not in both structures */ +#define FS_sub_value 2 /* conflicting value */ +#define FS_sub_type 4 /* unimplented or invalid type */ + +/* type codes ------------------------------------------------------------- */ +#define FS_type_unknown 0 /* unbound variable */ +#define FS_type_atomic 1 /* (not used) */ +#define FS_type_string 2 /* == atomic */ +#define FS_type_feature 3 /* feature structure */ +#define FS_type_set 4 /* conjunctive feature structure (set) */ +#define FS_type_pointer 5 /* path in form @name(*) */ +#define FS_type_number 6 /* additive long integer */ + + +/****************************************************************************/ +/** **/ +/** prototypes for library functions **/ +/** **/ +/****************************************************************************/ + +/* unify001.c ------------------------------------------------------------- */ +struct FEATURE_STRUCTURE *cdecl fs_unify (struct FEATURE_STRUCTURE *fs1, + struct FEATURE_STRUCTURE *fs2); + +/* unify002.c ------------------------------------------------------------- */ +int cdecl fs_subsumption (struct FEATURE_STRUCTURE *fs1, + struct FEATURE_STRUCTURE *fs2); + +/* unify003.c ------------------------------------------------------------- */ +#ifdef _FILE_DEFINED +int cdecl fs_print_feature_structure (FILE *fo, struct FEATURE_STRUCTURE *fs, + struct FEATURE_STRUCTURE *root, + int indent, int flags, int list); +int cdecl fs_print_feature_element (FILE *fo, int fe_type, + struct FEATURE_STRUCTURE *fe, struct FEATURE_STRUCTURE *root, + int indent, int flags); +#endif + +/* unify004.c ------------------------------------------------------------- */ +#ifdef _FILE_DEFINED +int cdecl fs_scan (FILE *fi, FILE *err, struct FEATURE_STRUCTURE **act, + int act_mode, int list_mode); +#define SCAN_error -1 +#define SCAN_EOS 0 /* End-of-Structure */ +#define SCAN_EOF 1 +#endif + +/* unify005.c ------------------------------------------------------------- */ +struct FEATURE_STRUCTURE *cdecl fs_allocate_FEATURE_STRUCTURE (void); + +/* unify006.c ------------------------------------------------------------- */ +struct FEATURE_STRUCTURE *cdecl fs_trace_path (struct FEATURE_STRUCTURE *fs, + char *path); + +/* unify007.c ------------------------------------------------------------- */ +int cdecl fs_mbq (char *s); + +/* unify008.c ------------------------------------------------------------- */ +struct FEATURE_STRUCTURE *cdecl fs_merge (struct FEATURE_STRUCTURE *fs1, + struct FEATURE_STRUCTURE *fs2); + +#endif /* __GG_unify__ */ diff --git a/lib/include/gg/url.h b/lib/include/gg/url.h new file mode 100644 index 0000000000000000000000000000000000000000..5f2732998437441fdd220812eae555e9795b64f2 --- /dev/null +++ b/lib/include/gg/url.h @@ -0,0 +1,64 @@ +/* + * include FILE <gg/url.h> + * + * methods + * data structures + * constants + * prototypes + * + * written: 1995-11-26 + * latest udpate: 1996-03-18 8:00:56 + * + */ + +#ifndef __GG_url__ +#define __GG_url__ + +#include <gg/floskel.h> + +/* methods: --------------------------------------------------------------- */ +typedef char *URL_Processor (char *url, void *cd); + +/* data structures: ------------------------------------------------------- */ +struct URL_HANDLER +{ + struct URL_HANDLER *URL_next; + + char *URL_schema; + int URL_schema_length; + int URL_type; + int URL_drop_schema; /* 1 -> remove schema for process. */ + URL_Processor *URL_fetcher; + void *URL_client_data; +} ; + +/* constants: ------------------------------------------------------------- */ +#define URL_TYPE_error -1 +#define URL_TYPE_none 0 +#define URL_TYPE_ftp 1 +#define URL_TYPE_file 2 +#define URL_TYPE_http 3 +#define URL_TYPE_wais 4 +#define URL_TYPE_news 5 +#define URL_TYPE_newsrc 6 +#define URL_TYPE_gopher 7 +#define URL_TYPE_mailto 8 +#define URL_TYPE_reply 9 +#define URL_TYPE_something 99 + +/* prototypes: ------------------------------------------------------------ */ +struct URL_HANDLER *cdecl url_get_handler (char *url); +struct URL_HANDLER *cdecl url_register_handler (char *schema, int type, + int drop_schema, URL_Processor *fetcher, void *cd); +int cdecl url_initialize (void); + +char *cdecl url_fetch (char *url); +int cdecl url_write_object_name (char *url_interface, char *url_file); +char *cdecl url_read_object_name (char *url_interface, + char *tmp_space, int tmp_size); +char *cdecl url_isolate_schema (char *url); +int cdecl url_identify_type (char *url); +char *cdecl url_fetch_file (char *url, void *cd); +char *cdecl url_fetch_mailto (char *url, void *cd); + +#endif /* __GG_url__ */ diff --git a/lib/include/gg/varspace.h b/lib/include/gg/varspace.h new file mode 100644 index 0000000000000000000000000000000000000000..ca8641f793b1f709d2840e767b8dcd6de002e769 --- /dev/null +++ b/lib/include/gg/varspace.h @@ -0,0 +1,54 @@ +/* + * include FILE <gg/varspace.h> + * + * variable space management + * - prototypes + * - VAR_SPACE + * + * written: 1994-12-11 + * latest update: 1995-11-25 + * + */ + +#ifndef __GG_varspace__ +#define __GG_varspace__ + +#include <gg/floskel.h> +#include <gg/signatur.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +#define MAX_VAR_SPACE_LEVELS 100 /* only where splitting is done */ + +/* ------------------------------------------------------------------------ */ +struct VAR_SPACE +{ + long VS_signature; /* SIG_VS_NODE */ + long VS_type; + void *VS_value; + struct YTREE *VS_array; +} ; + +/* prototypes: ------------------------------------------------------------ */ +/* varsp001.c */ struct VAR_SPACE *cdecl vs_get_record ( + struct YTREE **yt_root, char *vsp_name [], int vsp_cnt); +/* varsp002.c */ struct VAR_SPACE *cdecl vs_get ( + struct YTREE *yt_root, char *vsp_name [], int vsp_cnt); +/* varsp003.c */ struct VAR_SPACE *cdecl vs_set ( + struct YTREE **yt_root, char *vsp_name [], int vsp_cnt, + long vsp_type, long vsp_value); +/* varsp004.c */ struct VAR_SPACE *cdecl vs_set_array ( + struct YTREE **yt_root, char *vsp_name [], int vsp_cnt, + struct YTREE *vsp_array); +/* varsp005.c */ int cdecl vs_assign (struct YTREE **yt_root, char *var_name, + long value, long var_type, int split_char); +/* varsp006.c */ long cdecl vs_increment (struct YTREE **yt_root, + char *var_name, long value, int pre_post, int split_char); +#ifdef _FILE_DEFINED +/* varsp007.c */ int cdecl vs_operations (struct YTREE **ytpp, + FILE *fi, FILE *fo); +#endif /* _FILE_DEFINED */ +/* varsp008.c */ struct VAR_SPACE *cdecl vs_query (struct YTREE *yt_root, + char *var_name, int split_char); + +#endif /* __GG_varspace__ */ diff --git a/lib/include/gg/videodat.h b/lib/include/gg/videodat.h new file mode 100644 index 0000000000000000000000000000000000000000..9ad0c812ce3d10e8ebf69d17cd47bcfbfee3a3e1 --- /dev/null +++ b/lib/include/gg/videodat.h @@ -0,0 +1,23 @@ +/* + * include FILE <gg/videodat.h> + * + * written: 1993-09-25 + * latest update: 1993-09-25 + * + */ + +#ifndef __GG_videodat__ +#define __GG_videodat__ + +/* ------------------------------------------------------------------------ */ +struct VD_TTL_block +{ + char *vd_ttl_fname; /* filename */ + char *vd_ttl_buffer; /* unidentified contents */ + char *vd_ttl_descr; /* description */ +} ; + +/* ------------------------------------------------------------------------ */ +struct VD_TTL_block *cdecl read_vd_ttl_block (FILE *fi); + +#endif /* __GG_videodat__ */ diff --git a/lib/include/gg/vieos.h b/lib/include/gg/vieos.h new file mode 100644 index 0000000000000000000000000000000000000000..eaaab943da25d0a32d73101f2244606d9a2ae5fd --- /dev/null +++ b/lib/include/gg/vieos.h @@ -0,0 +1,139 @@ +/* + * include FILE <gg/vieos.h> + * + * Vienna Objective SGML + * see also: VIEOS, TCL HYX SGML objects + * + * written: 1995-12-14 + * latest update: 1997-01-15 11:27:03 + * + */ + +#ifndef __GG_hyxtcl__ +#define __GG_hyxtcl__ + +/* #include <tcl.h> */ +#include <gg/floskel.h> +#include <gg/signatur.h> +#include <gg/dyb.h> +#include <gg/hytxt.h> +#include <gg/ytree.h> + +/* ------------------------------------------------------------------------ */ +typedef int VIEOS_DESTRUCTOR (ClientData object); + +/* ------------------------------------------------------------------------ */ +struct VIEOS_GENERIC /* common structural elements */ +{ /* for all objects */ + long VIEG_signature; /* any signature of SIG_VIEOS_* */ + char *VIEG_name; /* the name of the object */ + Tcl_Interp *VIEG_interp; + void *VIEG_context; /* pointer back to the creating */ + /* context */ +} ; + +/* ------------------------------------------------------------------------ */ +struct VIEOS_MARKUP +{ + long VIEM_signature; /* SIG_VIEOS_MARKUP */ + char *VIEM_name; + Tcl_Interp *VIEM_interp; + void *VIEM_context; /* pointer back to the creating */ + /* context */ + + struct TEXT_ELEMENT *VIEM_te; +} ; + +/* ------------------------------------------------------------------------ */ +struct VIEOS_INDEX +{ + long VIEI_signature; /* SIG_VIEOS_INDEX */ + char *VIEI_name; + Tcl_Interp *VIEI_interp; + void *VIEI_context; /* pointer back to the creating */ + /* context */ + + struct LMDC_CONTROL *VIEI_lmdc; +} ; + +/* ------------------------------------------------------------------------ */ +struct VIEOS_BLOCK /* common structural elements */ +{ /* for all objects */ + long VIEB_signature; /* SIG_VIEOS_BLOCK */ + char *VIEB_name; /* the name of the object */ + Tcl_Interp *VIEB_interp; + void *VIEB_context; /* pointer back to the creating */ + /* context */ + + struct DYNAMIC_BLOCK *VIEB_dyb; +} ; + +/* ------------------------------------------------------------------------ */ +struct VIEOS_CLUSTER /* common structural elements */ +{ /* for all objects */ + long VCL_signature; /* SIG_VIEOS_CLUSTER */ + char *VCL_name; /* the name of the object */ + Tcl_Interp *VCL_interp; + void *VCL_context; /* pointer back to the creating */ + /* context */ + + struct HYX_CLUSTER_CONTROL *VCL_hcc; +} ; + +/* ------------------------------------------------------------------------ */ +struct VIEOS_CONTEXT +{ + long VC_signature; /* SIG_VIEOS_CONTEXT */ + char *VC_name; + Tcl_Interp *VC_interp; + void *VC_context; /* pointer back to the creating */ + /* context */ + + /* list of ... objects */ + struct YTREE *VC_SUB_CONTEXT; /* ... subordinate context */ + struct YTREE *VC_INDEX; /* ... index */ + struct YTREE *VC_MARKUP; /* ... markup */ + struct YTREE *VC_BLOCK; /* ... named block */ + struct YTREE *VC_CLUSTER; /* ... cluster */ + struct YTREE *VC_GENERIC; /* ... generic (template) */ +} ; + +/* prototypes: ------------------------------------------------------------ */ +/* vieos001.c */ struct VIEOS_CONTEXT *vieos_create_context ( + Tcl_Interp *interp, struct VIEOS_CONTEXT *vc, char *nm); +/* vieos002.c */ int vieos_context_object (ClientData clientData, + Tcl_Interp *interp, int argc, char *argv []); +/* vieos003.c */ void vieos_destroy_context (ClientData clientData); + +/* vieos101.c */ struct VIEOS_MARKUP *vieos_create_markup ( + Tcl_Interp *interp, struct VIEOS_CONTEXT *vc, char *nm); +/* vieos102.c */ int vieos_markup_object (ClientData clientData, + Tcl_Interp *interp, int argc, char *argv []); +/* vieos103.c */ void vieos_destroy_markup (ClientData clientData); + +/* vieos201.c */ struct VIEOS_INDEX *vieos_create_index ( + Tcl_Interp *interp, struct VIEOS_CONTEXT *vc, char *nm); +/* vieos202.c */ int vieos_index_object (ClientData clientData, + Tcl_Interp *interp, int argc, char *argv []); +/* vieos203.c */ void vieos_destroy_index (ClientData clientData); + +/* vieos301.c */ struct VIEOS_BLOCK *vieos_create_block ( + Tcl_Interp *interp, struct VIEOS_CONTEXT *vc, char *nm); +/* vieos302.c */ int vieos_block_object (ClientData clientData, + Tcl_Interp *interp, int argc, char *argv []); +/* vieos303.c */ void vieos_destroy_block (ClientData clientData); + +/* vieos401.c */ struct VIEOS_CLUSTER *vieos_create_cluster ( + Tcl_Interp *interp, struct VIEOS_CONTEXT *vc, char *nm); +/* vieos402.c */ int vieos_cluster_object (ClientData clientData, + Tcl_Interp *interp, int argc, char *argv []); +/* vieos403.c */ void vieos_destroy_cluster (ClientData clientData); + +/* vieosg01.c */ struct VIEOS_GENERIC *vieos_create_generic ( + Tcl_Interp *interp, struct VIEOS_CONTEXT *vc, char *nm); +/* vieosg02.c */ int vieos_generic_object (ClientData clientData, + Tcl_Interp *interp, int argc, char *argv []); +/* vieosg03.c */ void vieos_destroy_generic (ClientData clientData); +/* vieosg04.c */ int vieos_destructor_generic (struct YTREE *yt, void *cd); + +#endif /* __GG_hyxtcl__ */ diff --git a/lib/include/gg/vlib.h b/lib/include/gg/vlib.h new file mode 100644 index 0000000000000000000000000000000000000000..7e3d1aa393154add4b5a1784e819497f52c445ed --- /dev/null +++ b/lib/include/gg/vlib.h @@ -0,0 +1,25 @@ +/* + * include FILE <gg/vlib.h> + * + * functions etc for VLIB operations + * + * written: 1993-02-07 + * latest update: 1995-01-29 + * + */ + +#ifndef __GG_vlib__ +#define __GG_vlib__ + +#include <gg/floskel.h> + +/* ------------------------------------------------------------------------ */ +#define VLIBOP_GEN 1 /* generate */ + +/* ------------------------------------------------------------------------ */ +/* vlibgen.c */ int cdecl vlib_generate (char *fn, char *file_mode, + char *gen_uid, + char *gen_date, char *gen_time, + int overwrite, int verbose); + +#endif /* __GG_vlib__ */ diff --git a/lib/include/gg/wildcard.h b/lib/include/gg/wildcard.h new file mode 100644 index 0000000000000000000000000000000000000000..2cf960858a82d40e8041814e56b084aee3274f4d --- /dev/null +++ b/lib/include/gg/wildcard.h @@ -0,0 +1,118 @@ +/* + * include FILE <gg/wildcard.h> + * + * wildcard processing + * - constants + * - methods + * - structures + * - macros + * - generic and system specific prototypes + * + * written: 1996-08-10 + * latest update: 1999-05-08 9:29:21 + * + */ + +#ifndef __GG_wildcard__ +#define __GG_wildcard__ + +#include <gg/floskel.h> + +#ifndef __GG_filename__ +#include <gg/filename.h> +#endif /* __GG_filename__ */ + +/* #define __wcrd_debug__ */ + +/* constants: ------------------------------------------------------------- */ +#ifdef __OLD__ /* 1998-07-19 11:13:36 */ +#define WCRD_buffer_size 128 +#else +#define WCRD_buffer_size 4096 +#endif + +#define WCRD_drive_buffer 2 +#define WCRD_pattern_size 30 + +#ifndef DEF_FNM_LENGTH +#ifdef MSDOS +#define DEF_FNM_LENGTH 66 +#else +#define DEF_FNM_LENGTH 1026 +#endif +#define DEF_FNM_EXTRA 24 + +#ifndef MAX_FNM_LENGTH +#ifdef MSDOS +#define MAX_FNM_LENGTH 66 +#else +#define MAX_FNM_LENGTH 1026 +#endif +#endif + +#endif /* !DEF_FNM_LENGTH */ + +/* methods: --------------------------------------------------------------- */ +typedef int WCRD_processor (char *fnm, void *client_data); + +/* structures: ------------------------------------------------------------ */ +struct WCRD +{ + /* setup */ + int subdirs; /* 1 -> follow subdirectories */ + int match_mode; /* 0 -> use MSDOS's matching mode */ + /* 1 -> use or own matchin mode */ + + /* processors */ + WCRD_processor *dir_pre_processor; /* called when entering a directory */ + void *dir_pre_client_data; + + WCRD_processor *file_processor; /* foreach file in a directory */ + void *file_client_data; + + WCRD_processor *dir_post_processor; /* called when leaving a directory */ + void *dir_post_client_data; + + /* runtime data */ + char actual_filenm [WCRD_buffer_size]; + char actual_path [WCRD_buffer_size]; + char actual_drive [WCRD_drive_buffer]; + char actual_pattern [WCRD_pattern_size]; + int actual_index; + + int leave; /* number of recursions to leave */ + int current_level; + +} ; + +/* macros: ---------------------------------------------------------------- */ +#define wcrd2_get_match_mode(wcrd) (wcrd->match_mode) +#define wcrd2_get_subdirs(wcrd) (wcrd->subdirs) +#define wcrd2_get_current_level(wcrd) (wcrd->current_level) +#define wcrd2_new() \ + ((struct WCRD *) calloc (sizeof (struct WCRD), 1)) + +/* generic prototypes: ---------------------------------------------------- */ +int wcrd2_set_match_mode (struct WCRD *wcrd, int mode); +int wcrd2_set_subdirs (struct WCRD *wcrd, int mode); +int wcrd2_leave (struct WCRD *wcrd, int levels); +struct WCRD *wcrd2_initialize (void); +int wcrd2_dispose (struct WCRD *wcrd); +int wcrd2_set_processor (struct WCRD *wcrd, int what, + WCRD_processor *prc, void *client_data); + +#define WCRD_set_file_processor 1 +#define WCRD_set_dir_pre_processor 2 +#define WCRD_set_dir_post_processor 3 + +#ifdef __GG_array__ +int wcrd2_arguments (struct WCRD *wcrd, struct ARRAY_CONTROL *arguments); +#endif + +/* system specific prototypes: (MSDOS and UNIX) --------------------------- */ +int wcrd2_rec_wildcards (struct WCRD *wcrd, int lev); +int wcrd2_wildcards_or_rec (struct WCRD *wcrd, char *fn); +int wcrd2_wildcards (struct WCRD *wcrd, char *fn); +int wcrd2_wildcards_search (struct WCRD *wcrd); + +#endif /* __GG_wildcard__ */ diff --git a/lib/include/gg/window.h b/lib/include/gg/window.h new file mode 100644 index 0000000000000000000000000000000000000000..d5c270f402cd34459f9949492a481cd55f7fc4b7 --- /dev/null +++ b/lib/include/gg/window.h @@ -0,0 +1,476 @@ +/* + * include FILE <gg/window.h> + * + * Strukturdefinitionen fuer Bildschirmverwaltung + * + * function redefinitions depending on windowing model + * - BIOS W_MODEL_BIOS (PCs using the BIOS alone) + * - CGA W_MODEL_CGA (PCs taking advantage of CGA programming) + * - CURSES W_MODEL_CURSES (for Unix ASCII terminals) + * - NCURSES W_MODEL_NCURSES (e.g for Linux, mostly like W_MODE_CURSES) + * - X and TK W_MODEL_TK (X windows using the TK toolkit) + * + * - prototypes + * + * W_MODEL_MSDOS is defined if W_MODEL_BIOS or W_MODEL_CGA are defined + * + * written: 1989 07 xx - 1989 09 xx: Revision + * 1991 01 29: Revision + * latest update: 1997-05-30 18:01:47 + * $Id: window.h,v 1.4 2005/09/04 20:27:37 gonter Exp $ + * + */ + +#ifndef __GG_window__ +#define __GG_window__ + +#ifndef MSDOS +#ifndef cdecl +#define cdecl +#endif +#endif + +#ifdef W_MODEL_BIOS +#ifndef W_MODEL_MSDOS +#define W_MODEL_MSDOS +#endif +#endif + +#ifdef W_MODEL_CGA +#ifndef W_MODEL_MSDOS +#define W_MODEL_MSDOS +#endif +#endif + +/* Modus Definition Record: ----------------------------------------------- */ +struct MODEDEF /* aus MAGIS; wird nicht mehr verwendet */ +{ + unsigned int + spalten, + zeilen, + seiten, + farben, + hgfarben, + modecode, /* Wird an BIOS geschickt */ + scx, /* X-Scalierung: MSB:Up | LSD:Down */ + scy, /* Y-. : . :. | . :. */ + flags; /* Bit 0: Dieser Modus kann nicht */ + /* mit anderen gemischt werden */ + /* 1: Grapischer Modus */ + /* 2: Text Modus */ +} ; + +/* ------------------------------------------------------------------------ */ +struct WINDEF /* Parameter fuer verwendete IO */ +{ /* aus MAGIS; wird nicht mehr verwendet */ + int drivercode; /* 1 -> CGA, EGA und Mono Treiber */ + int modecnt; + struct MODEDEF modedef [10]; +} ; + +/* Definition eines Windows: ---------------------------------------------- */ +struct WINDOW +{ + int page; + int ax, ay; + int bx, by; + int cx, cy; + int attr; +} ; + +/* Definition der Editor-Einstellung fuer WEDIT: --------------------------- */ +struct EDITOR +{ + int anzeige; /* 1. angezeigte Zeile */ + int scrupd; /* 1 -> Screen Update noetig */ + int f_ins; /* 1 -> Insert Mode */ + int lines; /* aktuelle Zahl der Zeilen */ + int maxlines; /* maximale . . . */ + int lastkey; /* letzte nicht interpretierte Taste */ +} ; + +/* Modus Definition (neue Version): --------------------------------------- */ +struct W_MODE_CAPABILITIES +{ + /* allgemgeines */ + /* char *w_mode_name; */ /* Bezeichnung des Modes */ + int w_mode_code; /* BIOS-Code fuer Modus */ + /* -1 -> nicht ueber BIOS aufrufbar */ + + /* Text Characteristiken */ + int w_text_max_x; /* -1 -> Text nicht verfuegbar */ + int w_text_max_y; + int w_text_colors; + int w_text_cell_x; /* Zahl der X Pixels fuer ein Zeichen */ + int w_text_cell_y; /* Zahl der Y Pixels fuer ein Zeichen */ + /* ANM: auch wenn Grafik eigentlich */ + /* nicht moeglich ist. Wird fuer */ + /* die Maus benoetigt */ + int w_text_pages; + + /* Grafik Characteristiken */ + int w_graph_max_x; /* -1 -> Grafik nicht verfuegbar */ + int w_graph_max_y; + int w_graph_colors; + int w_graph_pages; + +} ; + +/* Definition der Moeglichkeiten des Adapters: ---------------------------- */ +struct W_SCREEN_CAPABILITIES +{ + char *w_model_name; + int w_model_code; + int w_mode_count; + int w_mode_default; +} ; + +/* ------------------------------------------------------------------------ */ +struct W_SCREEN_AND_MODES +{ + struct W_SCREEN_CAPABILITIES *w_screen_capabilities; + struct W_MODE_CAPABILITIES *w_mode_capabilities; +} ; + +/* ------------------------------------------------------------------------ */ +#define W_MODEL_CODE_BIOS 0x1010 +#define W_MODEL_CODE_CGA 0x1011 + +#define W_CURSOR_LOWER 0x06 +#define W_CURSOR_UPPER 0x07 + +/* ------------------------------------------------------------------------ */ +#define W_BLINK 0x80 +#define W_HELL 0x08 + +#define WH_SCHWARZ 0x00 +#define WH_BLAU 0x10 +#define WH_GRUEN 0x20 +#define WH_KOBALT 0x30 +#define WH_ROT 0x40 +#define WH_VIOLETT 0x50 +#define WH_BRAUN 0x60 +#define WH_WEISS 0x70 + +#define WV_SCHWARZ 0x00 +#define WV_BLAU 0x01 +#define WV_GRUEN 0x02 +#define WV_KOBALT 0x03 +#define WV_ROT 0x04 +#define WV_VIOLETT 0x05 +#define WV_BRAUN 0x06 +#define WV_WEISS 0x07 + +#define WV_HSCHWARZ 0x08 +#define WV_HBLAU 0x09 +#define WV_HGRUEN 0x0A +#define WV_HKOBALT 0x0B +#define WV_HROT 0x0C +#define WV_HVIOLETT 0x0D +#define WV_HBRAUN 0x0E +#define WV_HWEISS 0x0F + +#define WV_GELB WV_BRAUN | W_HELL +#define WV_ERROR WV_ROT | W_HELL | W_BLINK + +/* BIOS: ------------------------------------------------------------------ */ +/* HYX: no_links */ +#ifdef W_MODEL_BIOS +/* %win/0/(dirinf).fm */ +#define w_init bios_init +#define w_init_mode bios_init_mode +#define w_get_mode bios_get_mode +#define w_reset bios_reset +#define w_col80mode() bios_init_mode(0x03,0x0001) +#define w_col40mode() bios_init_mode(0x01,0x0001) +#define w_graphmode() bios_init_mode(0x05,0x0001) +#define w_selpage bios_selpage +#define w_cursoroff bios_cursoroff +#define w_cursoron bios_cursoron +#define w_cursorsize bios_cursorsize +#define w_border bios_border +#define w_setchar bios_setchar +#define w_setnchar bios_setnchar +#define w_getchar bios_getchar +#define w_setscreen bios_setscreen +#define w_cls bios_cls +#define w_cls80 bios_cls +#define w_cls40 bios_cls +#define w_setarea bios_setarea +#define w_scrollup bios_scrollup +#define w_scrolldown bios_scrolldown +#define w_scrblk_up bios_scrblk_up +#define w_scrblk_down bios_scrblk_down +#define w_setcup bios_setcup +#define wg_wr_dot bios_wr_dot +#define wg_rd_dot bios_rd_dot +#define w_clear(w) bios_scrollup((w),0); +#define w_set_mode bios_set_mode +#define w_set_col bios_set_col +#define w_blit_save bios_blit_save +#define w_blit_load bios_blit_load +#define w_get_cols cga_get_cols +#define w_getpage cga_getpage +#define w_scrblk_left cga_scrblk_left +#define w_scrblk_right cga_scrblk_right +#define w_setpalette vga_setpalette +#define w_setpalette_block vga_setpalette_block +#define w_getpalette vga_getpalette +#define w_getpalette_block vga_getpalette_block +#define w_palette_block_grey vga_palette_block_grey +#define w_cls_col bios_cls +#define w_getcup bios_getcup +#define w_get_screen_max cga_get_screen_max +#define w_blit_line cga_blit_line +#define w_set_screen_mode vga_set_screen_mode + +/* %win/1/(dirinf).fm */ +#define w_prntcol bios_prntcol +#define w_setstring bios_setstring +#define w_create bios_create +#define w_namecreat bios_namecreat +#define gr_create bios_gr_create +#define w_put1ln bios_put1ln +#define w_putln bios_putln +#define w_putstr bios_putstr +#define w_readstr bios_readstr +#define w_readln bios_readln +#define w_disp_bbox bios_disp_bbox +#define w_disp_box bios_disp_box +#define w_printf bios_printf +#define w_more bios_more +#define w_puts bios_puts +#define w_display bios_display +#define w_display_scr bios_display_scr +#define w_prtstr bios_prtstr +#define w_print_long bios_print_long +#define w_bell bios_bell + +/* %win/2/(dirinf).fm */ +#define wg_box bios_box +#define wg_fbox bios_fbos +#define wg_circle bios_circle +#define wg_fcircle bios_fcircle +#define _wg_x_line _bios_x_line +#define _wg_y_line _bios_y_line +#endif /* W_MODEL_BIOS */ + +/* CGA: ------------------------------------------------------------------- */ +#ifdef W_MODEL_CGA +/* %win/0/(dirinf).fm */ +#define w_init cga_init +#define w_init_mode cga_init_mode +#define w_get_mode cga_get_mode +#define w_reset cga_reset +#define w_col80mode() cga_init_mode(0x03,0x0001) +#define w_col40mode() cga_init_mode(0x01,0x0001) +#define w_graphmode() cga_init_mode(0x05,0x0001) +#define w_selpage cga_selpage +#define w_cursoroff bios_cursoroff +#define w_cursoron bios_cursoron +#define w_cursorsize bios_cursorsize +#define w_border bios_border +#define w_setchar cga_setchar +#define w_setnchar cga_setnchar +#define w_getchar cga_getchar +#define w_setscreen bios_setscreen +#define w_cls() cga_cls_col(WV_GELB) +#define w_cls80() cga_cls_col(WV_GELB) +#define w_cls40() cga_cls_col(WV_GELB) +#define w_setarea bios_setarea +#define w_scrollup bios_scrollup +#define w_scrolldown bios_scrolldown +#define w_scrblk_up bios_scrblk_up +#define w_scrblk_down bios_scrblk_down +#define w_setcup bios_setcup +#define wg_wr_dot bios_wr_dot +#define wg_rd_dot bios_rd_dot +#define w_clear(w) bios_scrollup((w),0) +#define w_set_mode bios_set_mode +#define w_set_col bios_set_col +#define w_blit_save cga_blit_save +#define w_blit_load cga_blit_load +#define w_get_cols cga_get_cols +#define w_getpage cga_getpage +#define w_scrblk_left cga_scrblk_left +#define w_scrblk_right cga_scrblk_right +#define w_setpalette vga_setpalette +#define w_setpalette_block vga_setpalette_block +#define w_getpalette vga_getpalette +#define w_getpalette_block vga_getpalette_block +#define w_palette_block_grey vga_palette_block_grey +#define w_cls_col cga_cls_col +#define w_getcup bios_getcup +#define w_get_screen_max cga_get_screen_max +#define w_blit_line cga_blit_line +#define w_set_screen_mode vga_set_screen_mode + +/* %win/1/(dirinf).fm */ +#define w_prntcol cga_prntcol +#define w_setstring cga_setstring +#define w_create bios_create +#define w_namecreat cga_namecreat +#define gr_create bios_gr_create +#define w_put1ln cga_put1ln +#define w_putln bios_putln +#define w_putstr bios_putstr +#define w_readstr bios_readstr +#define w_readln bios_readln +#define w_disp_bbox cga_disp_bbox +#define w_disp_box cga_disp_box +#define w_printf cga_printf +#define w_more cga_more +#define w_puts cga_puts +#define w_display cga_display +#define w_display_scr cga_display_scr +#define w_prtstr cga_prtstr +#define w_print_long cga_print_long +#define w_bell bios_bell + +/* %win/2/(dirinf).fm */ +#define wg_box bios_box +#define wg_fbox bios_fbos +#define wg_circle bios_circle +#define wg_fcircle bios_fcircle +#define _wg_x_line _bios_x_line +#define _wg_y_line _bios_y_line +#endif /* W_MODEL_CGA */ + +/* CURSES ----------------------------------------------------------------- */ +#ifdef W_MODEL_CURSES +#define w_init curses_init +#define w_cls curses_cls_col +#define w_disp_bbox curses_disp_bbox +#define w_disp_box curses_disp_box +#define w_setstring curses_setstring +#define w_setchar curses_setchar +#define w_setnchar curses_setnchar +#define w_prntcol curses_prntcol +#define w_setcup curses_setcup +#define w_scrblk_up curses_scrblk_up +#define w_scrblk_down curses_scrblk_down +#define w_scrblk_left curses_scrblk_left +#define w_scrblk_right curses_scrblk_right +#define w_blit_line curses_blit_line +#define w_sig_winch curses_sig_winch +#ifndef W_MODEL_NCURSES +#define w_bell bios_bell +#endif /* W_MODEL_NCURSES */ +#endif + +/* NCURSES ---------------------------------------------------------------- */ +#ifdef W_MODEL_NCURSES +#define w_init curses_init +#define w_cls curses_cls_col +#define w_disp_bbox curses_disp_bbox +#define w_disp_box curses_disp_box +#define w_setstring curses_setstring +#define w_setchar curses_setchar +#define w_setnchar curses_setnchar +#define w_prntcol curses_prntcol +#define w_setcup curses_setcup +#define w_blit_line curses_blit_line +#define w_bell ncurses_bell +#define w_sig_winch curses_sig_winch +#endif + +/* X and TK --------------------------------------------------------------- */ +#ifdef W_MODEL_TK +#define w_setstring tk_setstring +#define w_setchar tk_setchar +#define w_setnchar tk_setnchar +#define w_prntcol tk_prntcol +#define w_init tk_init +#define w_setcup tk_setcup +#define w_cls tk_cls +#define w_bell tk_bell +#define w_scrblk_up tk_scrblk_up +#define w_scrblk_down tk_scrblk_down +#define w_scrblk_left tk_scrblk_left +#define w_scrblk_right tk_scrblk_right +#define w_sig_winch tk_sig_winch +#endif + +/* prototypes: %win/x/(dirinf).fm ----------------------------------------- */ +void cdecl w_init (int flags); +int cdecl w_init_mode (int, int); +int cdecl w_get_mode (void); +void cdecl w_reset (void); +void cdecl w_selpage (int); +void cdecl w_cursoroff (void); +void cdecl w_cursoron (void); +void cdecl w_cursorsize (int lower, int upper); +void cdecl w_border (int); +void cdecl w_setcup (int, int, int); +void cdecl w_setchar (int, int, int, int, int); +void cdecl w_setnchar (int, int, int, int, int, int); +int cdecl w_getchar (int, int, int); +void cdecl w_setarea (int, int, int, int, int, int); +int cdecl w_scrollup (struct WINDOW *, int); +int cdecl w_scrolldown (struct WINDOW *, int); +int cdecl w_scrblk_up (int ax, int ay, int bx, int by, int attr, int cnt); +int cdecl w_scrblk_down (int ax, int ay, int bx, int by, int attr, int cnt); +int cdecl w_scrblk_left (int page, int ax, int ay, int bx, int by, + int attr, int cnt); +int cdecl w_scrblk_right (int page, int ax, int ay, int bx, int by, + int attr, int cnt); +int cdecl wg_wr_dot (int, int, int); +int cdecl wg_rd_dot (int, int); +int cdecl w_set_mode (int); +void cdecl w_set_col (int, int); +int cdecl w_blit_save (void *puffer, int page, int ax, int ay, int bx,int by); +int cdecl w_blit_load (void *puffer, int page, int ax, int ay, int bx,int by); +int cdecl w_get_cols (void); +int cdecl w_getpage (void); +int cdecl w_setpalette (int nr, int red, int green, int blue); +int cdecl w_setpalette_block (int start, int count, void *table); +int cdecl w_getpalette (int nr, int *red, int *green, int *blue); +int cdecl w_getpalette_block (int start, int count, void *table); +int cdecl w_palette_block_grey (int start, int count); +void cdecl cga_cls_col (int color); +void cdecl cursor_cls_col (int color); +void cdecl tk_cls (void); +void cdecl bios_cls (void); +void cdecl w_getcup (int p, int *x, int *y); +void cdecl w_get_screen_max (void); +void cdecl w_blit_line (int page, int ax, int ay, int cnt, char *line); +int cdecl vga_set_screen_mode (int mode); + +/* %win/1/(dirinf).fm ----------------------------------------------------- */ +void cdecl w_prntcol (int, int, int, int, char *); +void cdecl w_create (struct WINDOW *); +void cdecl w_namecreat (struct WINDOW *, char *); +void cdecl gr_create (struct WINDOW *); +void cdecl w_disp_bbox (int page, int ax, int ay, int bx, int by, + int attr, int box_typ); +void cdecl w_disp_box (int page, int ax, int ay, int bx, int by, + int attr, int box_typ, int box_edges); +void cdecl gr_setcup (int, int); +void cdecl cga_setcup (int, int, int); +void cdecl ega_setcup (int, int, int); +void cdecl w_setstring (int, int, int, int, int, int, const char *, int); +void cdecl w_putstr (struct WINDOW *, char *); +void cdecl w_setscreen (int attr);/*Page und SP nicht benoetigt*/ +int cdecl w_readstr (struct WINDOW *, char *); +int cdecl w_readln (struct WINDOW *, char *); +int cdecl mapkey (void); +void cdecl w_put1ln (struct WINDOW *, char *); +void cdecl w_putln (struct WINDOW *, char *); +void cdecl w_display (int page, char *scr); +void cdecl w_display_scr (int page, char *s); +void cdecl w_prtstr (int p, int x, int y, int attr, char *nm, int l); +void cdecl w_print_long (int p, int x, int y, int c, char *fmt, long val); +void cdecl w_set_332_palette (void); + +/* %win/2/(dirinf).fm ----------------------------------------------------- */ +void cdecl wg_box (int, int, int, int, int); +void cdecl wg_fbox (int, int, int, int, int); +void cdecl wg_circle (int, int, int, int); +void cdecl wg_fcircle (int, int, int, int); +void cdecl _wg_x_line (int, int, int, int); +void cdecl _wg_y_line (int, int, int, int); + +void cdecl report_attribute_value (int attr, char *s); +void cdecl w_bell (void); +void cdecl w_sig_winch (void); +#endif diff --git a/lib/include/gg/wordcrea.h b/lib/include/gg/wordcrea.h new file mode 100644 index 0000000000000000000000000000000000000000..2b49efdd7514c8f831cd6f3eeff61e0ff6f89285 --- /dev/null +++ b/lib/include/gg/wordcrea.h @@ -0,0 +1,16 @@ +/* + * include FILE <gg/wordcrea.h> + * + * Anlegen des LUT-Woerterbuches + * + * written: 1989-03-29 + * 1990-11-11: zerlegt in YTREE.H und ZTREE.H + * 1994-10-23: moved to %inc/gg + * latest update: 1994-12-19 + * + */ + +#ifndef __GG_wordcrea__ +#define __GG_wordcrea__ + +#endif /* __GG_wordcrea__ */ diff --git a/lib/include/gg/xref.h b/lib/include/gg/xref.h new file mode 100644 index 0000000000000000000000000000000000000000..480c6486ebfbf4949cee5c7f8d79808a48019a89 --- /dev/null +++ b/lib/include/gg/xref.h @@ -0,0 +1,96 @@ +/* + * include FILE <gg/xref.h> + * + * Cross Reference Generator + * + * written: 1997-08-03 + * latest update: 1997-08-15 23:00:39 + * + */ + +#ifndef __GG_xref__ +#define __GG_xref__ + +#include <gg/ytree.h> +#include <gg/array.h> +#include <gg/floskel.h> + +#ifndef UCHAR +#define UCHAR unsigned char +#endif + +/* ------------------------------------------------------------------------ */ +struct XREF_CONTEXT /* definition section */ +{ + struct YTREE + *modules, /* dict of defined modules */ + *publics, /* dict of defined public symbols */ + *bss; /* dict of defined BSS areas */ +} ; + +/* ------------------------------------------------------------------------ */ +struct XREF_RESOLVE /* runtime section */ +{ + struct XREF_CONTEXT *ctx; + + struct ARRAY_CONTROL + *unresolved; /* list of unresolved symbols */ + + struct YTREE + *imported, /* dict of imported modules */ + *resolved, /* dict of resolved symbols */ + *not_found, /* dict of items that were not found */ + *ignore; /* dict of ignored symbols */ +} ; + +/* ------------------------------------------------------------------------ */ +struct XREF_MODULE +{ + char *name; + char *object_name; + struct XREF_CONTEXT *ctx; + + struct XREF_MODULE *shadows; /* this module replaces or shadows another */ + struct YTREE + *externals, + *publics, + *bss; +} ; + +/* ------------------------------------------------------------------------ */ +struct XREF_PUBLIC +{ + char *name; + struct XREF_MODULE *module; /* module where symbol is defined */ + +#ifdef NOT_USED + struct YTREE *imported; /* names of modules importing this symbol */ +#endif +} ; + +/* ------------------------------------------------------------------------ */ +#define xref_new_context() \ + ((struct XREF_CONTEXT *) calloc (sizeof (struct XREF_CONTEXT), 1)) + +/* ------------------------------------------------------------------------ */ +/* %sbr/xref01.c */ +struct XREF_MODULE *xref_module (struct XREF_CONTEXT *ctx, char *name, + int replace); + +int xref_set_object (struct XREF_MODULE *mod, char *name); +struct XREF_PUBLIC *xref_public (struct XREF_MODULE *mod, char *name); +int xref_external (struct XREF_MODULE *mod, char *name); + +/* %sbr/xref02.c */ +struct XREF_RESOLVE *xref_new_resolve (struct XREF_CONTEXT *ctx); +long xref_resolve (struct XREF_RESOLVE *res, char *name); +int xref_ignore (struct XREF_RESOLVE *res, char *name, void *cd); +/* internal functions, no need to call them directly */ +int xref_print_ref_list (long info, char *str, void *cd); +int xref_resolve_symbols (struct YTREE *yt, char *str, void *cd); + +/* %sbr/xref03.c */ +int xref_do_resolve (struct XREF_RESOLVE *res, int show_resolved, + int show_unresolved); + +#endif /* __GG_xref__ */ diff --git a/lib/include/gg/ytree.h b/lib/include/gg/ytree.h new file mode 100644 index 0000000000000000000000000000000000000000..6a6390a2b43fff7ea8efe8f3de689b83bf297e7e --- /dev/null +++ b/lib/include/gg/ytree.h @@ -0,0 +1,154 @@ +/* + * include FILE <gg/ytree.h> + * + * managing of ytree data structures + * see also: %ds/ytree/ + * - prototypes + * + * written: 1989 03 29 + * 1990 11 11: isolated from WORDCREA.H + * 1991-12-10: isolation as a library package + * latest update: 1998-08-07 14:16:48 + * $Id: ytree.h,v 1.4 2005/09/04 20:27:37 gonter Exp $ + * + */ + +#ifndef __GG_ytree__ +#define __GG_ytree__ + +#include <gg/floskel.h> + +#ifndef ZTREE_DEPTH_MAX /* from <gg/ztree.h> */ +#define ZTREE_DEPTH_MAX 1024 /* max. Laenge eines Wortes, */ + /* -> max. Tiefe des Woerterbuches */ +#endif /* !ZTREE_DEPTH_MAX */ + +/* ------------------------------------------------------------------------ */ +#define _YTREE_DEFINED +struct YTREE +{ + struct YTREE *YT_next; /* anderes Zeichen */ + struct YTREE *YT_down; /* dieses Zeichen; naechste Stelle */ + long YT_size; /* fuer die ganze Substruktur benoetigter */ + /* Platz im Binaerfile in Bytes */ + /* (Einschliesslich des Vater-Knotens?) */ + long YT_info; /* Informationsteil */ + unsigned int YT_lng_str; /* Laenge der Zeichenkette */ + unsigned int YT_flags; /* siehe unten */ + unsigned char YT_str[2]; /* Zeichenstring fuer den Schluessel */ + /* veraenderlich !!!!! */ +} ; + +/* ------------------------------------------------------------------------ */ +#define YTflag_EOW 0x01 /* End of Word */ +#define YTflag_TABbeg 0x02 /* Table Begin */ +#define YTflag_TABend 0x04 /* Table End */ +#define YTflag_OFF 0x70 /* Offset Groesse */ +#define YTflag_OFFx 0x8F /* Offset Groesse (invertiert) */ +#define YTflag_OFF0 0x00 /* Keine Offset noetig; Ende der Liste */ +#define YTflag_OFF1 0x10 +#define YTflag_OFF2 0x20 +#define YTflag_OFF3 0x30 +#define YTflag_OFF4 0x40 + +/* methods: --------------------------------------------------------------- */ +typedef int YTREE_PROCESSOR (struct YTREE *yt_node, void *client_data); +typedef int YTREE_TRACKER (struct YTREE *yt_node, char *str, void *client_data); +typedef int YTREE_INFO_PROCESSOR (long info, void *client_data); +typedef int YTREE_INFO_TRACKER (long info, char *str, void *client_data); + +/* ------------------------------------------------------------------------ */ +struct YTREE_CONTROL +{ + long signature; + char *name; + + struct YTREE *yt; + long size; + long element_count; + + YTREE_INFO_PROCESSOR *destructor; + void *destructor_cd; +} ; + +/* Ausgabe Funktionen (Klarschrift) --------------------------------------- */ +struct LUT_STACK +{ + long offset; /* next alternative */ + int key; /* part of the key */ +} ; + +/* ------------------------------------------------------------------------ */ +#define ytree_get_tree(x) (((x)==(struct YTREE_CONTROL *) 0)\ + ? (struct YTREE *) 0 : (x)->yt) + +/* prototypes: ------------------------------------------------------------ */ +/* yt_00001.c */ struct YTREE *cdecl ytree_alloc (unsigned char *s, + int lng_str); + int cdecl ytree_free_node (struct YTREE *yt); + +/* yt_00002.c */ int cdecl ytree_free (struct YTREE *yt); + +/* yt_00003.c */ struct YTREE *cdecl ytree_insert_word (struct YTREE **ypp, + unsigned char *wort); + struct YTREE *cdecl ytree_lookup_word_get_last (void); + int cdecl ytree_lookup_word_get_lng (void); + +/* yt_00004.c */ struct YTREE *cdecl ytree_lookup_word (struct YTREE *yp, + unsigned char *wort); + +/* yt_00005.c */ int cdecl ytree_delete_word (struct YTREE **ypp, + unsigned char *wort); + +/* yt_00006.c */ long cdecl ytree_size (struct YTREE *yt); + +#ifdef _FILE_DEFINED +/* yt_00007.c */ int cdecl ytree_print (FILE *fo, struct YTREE *yt, + int indent); + +/* yt_00008.c */ int cdecl ytree_print_node (FILE *fo, struct YTREE *yt, + int indent); + +/* yt_00009.c */ long cdecl ytree_dump (FILE *fo, struct YTREE *yt); + +/* yt_00010.c */ int cdecl ytree_scan (FILE *lut, struct YTREE **ytp); + +/* yt_00011.c */ int cdecl ytree_full_scan (FILE *lut, struct YTREE **ytp, + long kill_by_info[], int kill_by_info_cnt, + char *kill_by_str [], int kill_by_str_cnt); +#endif + +/* yt_00012.c */ int cdecl ytree_process (struct YTREE *yt, + /***** int (*processor) (struct YTREE *yt_node, void *client_data), ****/ + YTREE_PROCESSOR *processor, + void *client_data); + +#ifdef _FILE_DEFINED +/* yt_00013.c */ int cdecl ytree_operations (struct YTREE **ytpp, + FILE *fi, FILE *fo); +#endif +/* yt_00014.c */ int cdecl ytree_debug (struct YTREE *yt); +/* yt_00015.c */ int cdecl ytree_dump_to_lut_file (char *name_lut, + struct YTREE *yt); + +/* yt_00016.c */ long cdecl ytree_set_value (struct YTREE **yt, + const unsigned char *w, long v); +/* yt_00017.c */ long cdecl ytree_increment_value (struct YTREE **ytp, + const unsigned char *w, long v); +/* yt_00018.c */ long cdecl ytree_get_value (struct YTREE *ytp, + const unsigned char *w); +/* yt_00019.c */ struct YTREE *cdecl ytree_duplicate (struct YTREE *yt); +/* yt_00020.c */ int cdecl ytree_repack (struct YTREE **ytp); +/* yt_00021.c */ int cdecl ytree_track (struct YTREE *yt, + char *buffer, int buffer_size, int buffer_pos, + YTREE_TRACKER *tracker, void *client_data); +/* yt_00022.c */ int ytree_process_info (struct YTREE *yt, + YTREE_INFO_PROCESSOR *processor, void *client_data); +/* yt_00023.c */ int ytree_track_info (struct YTREE *yt, + char *buffer, int buffer_size, int buffer_pos, + YTREE_INFO_TRACKER *tracker, void *client_data); + +/* yt_00101.c */ struct YTREE_CONTROL *ytree_new_control (char *name); +/* yt_00102.c */ int ytree_free_control (struct YTREE_CONTROL *yc); + +#endif /* !__GG_ytree__ */ diff --git a/lib/include/gg/zip.h b/lib/include/gg/zip.h new file mode 100644 index 0000000000000000000000000000000000000000..12b2526841c577204e6d4e041b55acaeb8cfe4f0 --- /dev/null +++ b/lib/include/gg/zip.h @@ -0,0 +1,148 @@ +/* + * include FILE <gg/zip.h> + * + * Structures and Constants for PKZIP + * Version 1.01 + * + * written: 1990 02 04 + * 1991 01 28: Revision + * latest update: 1994-07-28 + * + */ + +#ifndef __GG_zip__ +#define __GG_zip__ + +#include <gg/floskel.h> +#ifdef MSDOS +#pragma pack(1) +#endif + +/* ------------------------------------------------------------------------ */ +struct ZIP_local_file_header +{ + int ZIP_LFH_vers_to_extract; + int ZIP_LFH_general_purpose_bit_flag; + int ZIP_LFH_compression_method; + int ZIP_LFH_last_mod_file_time; + int ZIP_LFH_last_mod_file_date; + long ZIP_LFH_crc32; + long ZIP_LFH_compressed_size; + long ZIP_LFH_uncompressed_size; + int ZIP_LFH_filename_length; + int ZIP_LFH_extra_field_length; +} ; + +/* ------------------------------------------------------------------------ */ +struct ZIP_LOCAL_FILE_HEADER +{ + struct ZIP_LOCAL_FILE_HEADER + *ZIP_LFH_next, + *ZIP_LFH_prev; + int ZIP_LFH_sig_PK; + int ZIP_LFH_sig_lfh; + struct ZIP_local_file_header ZIP_LFH; + char *ZIP_LFH_filename; + char *ZIP_LFH_extra_field; +} ; + +/* ------------------------------------------------------------------------ */ +struct ZIP_central_file_header +{ + int ZIP_CFH_version_made_by; + int ZIP_CFH_vers_to_extract; + int ZIP_CFH_general_purpose_bit_flag; + int ZIP_CFH_compression_method; + int ZIP_CFH_last_mod_file_time; + int ZIP_CFH_last_mod_file_date; + long ZIP_CFH_crc32; + long ZIP_CFH_compressed_size; + long ZIP_CFH_uncompressed_size; + int ZIP_CFH_filename_length; + int ZIP_CFH_extra_field_length; + int ZIP_CFH_file_comment_length; + int ZIP_CFH_disk_number_start; + int ZIP_CFH_internal_file_attributes; + long ZIP_CFH_external_file_attributes; + long ZIP_CFH_rel_off_local_header; +} ; + +/* ------------------------------------------------------------------------ */ +struct ZIP_CENTRAL_FILE_HEADER +{ + struct ZIP_CENTRAL_FILE_HEADER + *ZIP_CFH_next, + *ZIP_CFH_prev; + int ZIP_CFH_sig_PK; + int ZIP_CFH_sig_cfh; + struct ZIP_central_file_header ZIP_CFH; + char *ZIP_CFH_filename; + char *ZIP_CFH_extra_field; + char *ZIP_CFH_file_comment; +} ; + +/* ------------------------------------------------------------------------ */ +struct ZIP_central_dir_end +{ + int ZIP_CDE_disk_number; /* Number of this disk */ + int ZIP_CDE_cfh_start_disk; /* Number of disk with beginning */ + /* of the Central File Directory */ + int ZIP_CDE_cfh_count_on_this_disk; /* Number of entries in the */ + /* Central File Directory */ + /* on this disk */ + int ZIP_CDE_cfh_count; /* Number of entries in the */ + /* Central File Directory at all */ + long ZIP_CDE_cfh_size; /* Size of Central File Directory */ + long ZIP_CDE_cfh_start_offset; + int ZIP_CDE_zipfile_comment_length; +} ; + +/* ------------------------------------------------------------------------ */ +struct ZIP_CENTRAL_DIR_END +{ + int ZIP_CDE_sig_PK; + int ZIP_CDE_sig_cde; + struct ZIP_central_dir_end ZIP_CDE; + char *ZIP_CDE_zipfile_comment; +} ; + +/* structure to contral a ZIP-file ---------------------------------------- */ +struct ZIP_CONTROL +{ + /* information about the ZIP file */ + char *ZIPC_filename; /* name of the ZIP-file */ + int ZIPC_status; /* return value from ZIP scanner */ + + /* information from the ZIP file */ + struct ZIP_LOCAL_FILE_HEADER + *ZIPC_LFH, /* list of local file headers */ + **ZIPC_LFH_app; /* append next file header */ + struct ZIP_CENTRAL_FILE_HEADER + *ZIPC_CFH, /* list of central file headers */ + **ZIPC_CFH_app; /* append next central file header */ + struct ZIP_CENTRAL_DIR_END + *ZIPC_CDE; /* central directory end */ +} ; + +/* signatures: ------------------------------------------------------------ */ +#define ZIP_sig_PK 0x504B /* == 'PK' -> this is a ZIP */ +#define ZIP_sig_lfh 0x0304 /* signature of local file header */ +#define ZIP_sig_lfh1 0x03 +#define ZIP_sig_lfh2 0x04 +#define ZIP_sig_cfh 0x0102 /* signature of central file header */ +#define ZIP_sig_cfh1 0x01 +#define ZIP_sig_cfh2 0x02 +#define ZIP_sig_cde 0x0506 /* signature of central dir. end */ +#define ZIP_sig_cde1 0x05 +#define ZIP_sig_cde2 0x06 + +/* prototypes: ------------------------------------------------------------ */ +/* zip_0001.c */ int cdecl zip_quick_scan (char *fnm); +/* zip_0002.c */ long cdecl zip_find_cde_start (FILE *fi, long max_search); +/* zip_0003.c */ struct ZIP_CONTROL *cdecl zip_init_control (char *fnm); +/* zip_0004.c */ int cdecl zip_init_LFH (struct ZIP_LOCAL_FILE_HEADER *lfh); +/* zip_0005.c */ int cdecl zip_init_CFH (struct ZIP_CENTRAL_FILE_HEADER *cfh); +/* zip_0006.c */ int cdecl zip_init_CDE (struct ZIP_CENTRAL_DIR_END *cde); +/* zip_0007.c */ int cdecl zip_scan (struct ZIP_CONTROL *zc); + +#endif diff --git a/lib/include/gg/ztree.h b/lib/include/gg/ztree.h new file mode 100644 index 0000000000000000000000000000000000000000..0ade9357a06965887dc9560f48638ebdc6e8385c --- /dev/null +++ b/lib/include/gg/ztree.h @@ -0,0 +1,58 @@ +/* + * include FILE <gg/ztree.h> + * + * Anlegen des LUT-Woerterbuches mittels ZTREE Datenstruktur + * + * written: 1989 03 29 + * 1990 11 11: aus WORDCREA.H isoliert + * latest update: 1995-10-24 + * + */ + +#ifndef __GG_ztree__ +#define __GG_ztree__ + +#include <gg/floskel.h> + +#ifndef ZTREE_DEPTH_MAX +#define ZTREE_DEPTH_MAX 100 /* max. Laenge eines Wortes, */ + /* -> max. Tiefe des Woerterbuches */ +#endif + +/* moegliche Informationen �ber ein Wort ----------------------------------- */ +struct WORD_INFO +{ + int word_number; /* Nummer des Wortes */ + int word_frequency; /* Haeufigkeit */ +} ; + +/* ------------------------------------------------------------------------ */ +struct ZTREE +{ + struct WORD_INFO wi; /* moegliche Informationen zu einem Wort */ + + int next_char; + int sub_cnt; /* f�r die ganze Substruktur benoetigter */ + /* Platz im Binaerfile in Bytes */ + /* (Einschliesslich des Vater-Knotens?) */ + struct ZTREE *next; /* anderes Zeichen */ + struct ZTREE *sub; /* dieses Zeichen; naechste Stelle */ +} ; + +/* NL_00003.C ------------------------------------------------------------- */ +int cdecl set_word_info (int code); + +int cdecl score_word ( +struct ZTREE **pp1, /* LEX-Baum */ +char *w, /* gesuchtes Wort */ +int mode, /* Bit 0 .. Zaehler auf diesen Wert setzen */ + /* Bit 1 .. Code in Word Number eintragen */ +int cnt, /* Zaehler um diesen Wert erhoehen */ +int code) ; /* Word Number auf diesen Wert setzen */ +/* RETURN: 0 OK */ +/* -1 Wort nicht ok */ +/* -2 Out of Memory */ + +int cdecl dump_lut (struct ZTREE *p1, FILE *fo); + +#endif /* __GG_ztree__ */ diff --git a/lib/libgg.a b/lib/libgg.a new file mode 100644 index 0000000000000000000000000000000000000000..cd8c66f69972fa276dccd3d9ee60c79322422856 Binary files /dev/null and b/lib/libgg.a differ diff --git a/lib/sbr/(dirinf).fm b/lib/sbr/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..3e57ee0cacc94c1dd165548885bfb03798cfa20e --- /dev/null +++ b/lib/sbr/(dirinf).fm @@ -0,0 +1,8 @@ +#!/usr/local/bin/perl +# FILE .../lib/sbr/(dirinf).fm +# +# written: 1999-04-17 +# latest update: 1999-04-17 11:55:03 +# $Id: (dirinf).fm,v 1.2 2002/05/02 06:48:29 gonter Exp $ +# +misc miscellaneous functions diff --git a/lib/sbr/misc/$$$llink.upd b/lib/sbr/misc/$$$llink.upd new file mode 100644 index 0000000000000000000000000000000000000000..36a2d102401b8c140bad3e2fee3fbfa4324a9a4e --- /dev/null +++ b/lib/sbr/misc/$$$llink.upd @@ -0,0 +1 @@ +-+large\wcrd_008; diff --git a/lib/sbr/misc/(dirinf).fm b/lib/sbr/misc/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..50450de8633a9d14173fc50957140ffdd0b84d3c --- /dev/null +++ b/lib/sbr/misc/(dirinf).fm @@ -0,0 +1,209 @@ +# +# FILE .../lib/sbr/misc/(dirinf).fm +# +# C-Libraries, see also %ds and .. +# +# written: 1988 09 03 +# latest update: 2000-08-28 12:26:17 +# $Id: (dirinf).fm,v 1.5 2002/05/02 06:48:29 gonter Exp $ +# +# jump: tools +# +# ---------------------------------------------------------------------------- +# +large | | Objektfiles LARGE Model +small | | Objektfiles SMALL Model +make-dos | | <<<< DOS Makefile +Makefile | | <<<< Unix Makefile +make-sbr.lst | | <<<< create Unix shar distribution package +make-hdr.lst | | <<<< create distrib package for header files +library.hyx | | Beschreibung der Funktionen aus der Library +# +ssbr.bak | | ================================== +ssbr.lib | | SMALL Model Library +ssbr.mod | | SMALL Model Steuerung +ssbr.lst | | SMALL Model Cross Reference +# +lsbr.bak | | ================================== +lsbr.lib | | LARGE Model Library +lsbr.mod | | LARGE Model Steuerung +lsbr.lst | | LARGE Model Cross Reference +liblst.awk | | Angabe von Modulen in Libraries +# +ai.bak | | ================================== +ai.lib | | LARGE Model: Advanced Information Library +ai.lst | | LARGE Model: Advanced Information Library +ai.crf | | LARGE Model: Advanced Information Library - Cross Reference +# +param001.c |dpp | String -> Long; OCT/DEC/HEX etc... +param002.c |dpp | String -> Long; OCT/DEC/HEX etc... +rndlong.c |dpp | long random_long () +alt_seed.c |dpp | void alt_seed (); +convent1.c | | Convert Entities: convert a file in different modes +convent2.c | | Convert Entities: convert PC chars and entities +# convent3.c | | Convert Entities: convert MAC chars and entities +convent4.c | | Convert Entities: convert typographic chars and entities +convent5.c | | int cdecl fputc_entity (int ch, FILE *fo, int level); +convent6.c | | int cdecl fputs_entity (char *s, FILE *fo, int level); +# +diagnose.c | | global variables for diagnose codes +file2buf.c |fileio | read a file to a buffer +file2low.c |fileio | int file_to_lower (char *fn, FILE *fo); +file2low.c |fileio | int file_to_upper (char *fn, FILE *fo); +fclosec.c |fileio | int fclose_or_what (FILE *f) +fclosec.c |fileio | close a file if it was open +fopenwng.c |sbr | FILE *fopen_wng (char *fnm, char *mode) +flopen.c |sbr | lazy file open routines +fparslin.c |sbr | Zeile parsen +freadit.c |sbr | read a integer table +freaditf.c |sbr | read a integer table from file stream +freadlin.c |sbr | genau eine Zeile einlesen +freadst.c |sbr | read a string table +freadstf.c |sbr | read a string table from file stream +fscanlin.c |sbr | Scannen von Zeilen mit Kommentar-Entfernung +# +ftrans01.c |fileio | Daten von einem File in ein anderes transferieren +ftrans01.c |fileio | int ftransfer (FILE *fi, FILE *fo, long cpy_size) +ftrans02.c |fileio | Daten von einem File in ein anderes transferieren +ftrans02.c |fileio | long f2transfer (..) +ftrans03.c |fileio | long f3transfer (...); +ftrans04.c |fileio | long ftransfer_to_shar (FILE *fi, ...); +ftrans05.c |fileio | long f5transfer_to_shar (FILE *fi, ...); +ftrans06.c |fileio | long ftransfer_line (FILE *fi, ...); +ftrans07.c |fileio | long cdecl ftransfer_crlf (FILE *fi, ...); +ftrans08.c |fileio | long cdecl f2transfer_crlf (char *fi_nm, ...); +ftrans09.c |fileio | long ftransfer_add_dot (FILE *fi, ...) +ftrans10.c |fileio | long ftransfer_del_dot (FILE *fi, ...) +# +copyfil0.c |fileio | int copyfile (char *src, char *dst) +copyfile.c |fileio | copy files (with options) +trasheol.c |fileio | long trash_until_eol (FILE *fi) +dsklscrd.asm | | disc sector read (large model) +fnmqueue.c | | queue file names (or strings) + | | *** OBSOLETE *** +fmt.c | | Formatieren von Zahlen fuer Ausgabe +fileio.c |fileio | Verarbeitung von Full-Text Daten Files +masked_1.c | | Masken Editor / Version 1 +masked_t.c | | Masken Editor / Testmodul f�r Version 1 +s2can.c | | Zeileneditor / vgl. \usr\g\ik*.c +fsopen.c | | Netzwerk: File Shared Open +ftopen.c | | file temporary open: create unique filename (stream) +topen_l.asm | | file temporary open: create unique filename (low level) +topen_l.asm | | Large Model +topen_s.asm | | file temporary open: create unique filename (low level) +topen_s.asm | | Samll Model +identkey.c | | Key-Code aus der Bezeichnung des Keys ermitteln +keynames.c | | Key Names aus dem Key Code ermitteln +ebcasc.c | | Convert EBCDIC -> ASCII +scan.c | | Einlesen eines Strings via field_edit +# Test Module +t.c | | Test Modul +TT.C | | Test Modul +t2dummy.c | | unix dummy functions +# +# Operationen mit Filenamen, Archiven und Directories ------------------------ +fnames.c | | DOS Function Call 4B ... +fnames2.c | | File Find ueber FNAMES.C +cdromfnm.c |filename| int cdrom_file_name (char *fnm) +curdisk.c |filename| get or select the current dirve (MSDOS) +dcd01.c |filename| int dcd (char *dir_specified) +envfilsr.c |filename| search for file in path specified by environment +envbinsr.c |filename| char *env_bin_search (char *fn, char *env, ...); +extcmp.c |filename| int extcmp (char *s1, char *s2) +extcmp.c |filename| Zwei Files nach Extensions vergleichen +fmtdta01.c |filename| int fmt_dta_date (char *puffer, int fn_date) +fmtdta02.c |filename| int fmt_dta_time (char *puffer, int fn_time) +fndvfile.c |filename| int find_virtual_file (char *fnm, ...) +fnmcpy.c |filename| copy file name and set extension +fnmcpy2.c |filename| char *fnmcpy2 (char *fnm_old, char *ext) +fnmcpy3.c |filename| char *fnmcpy3 (char **dst, char *fnm_old, char *ext) +fnmcpy4.c |filename| char *fnmcpy4 (char *nm1, char *nm2, char *ext) +fnmdef.c |filename| int filename_definition (char *spec, ...) +fnmdestn.c |filename| char *get_destination_name (...) +fnmdpath.c |filename| char *duplicate_assumed_path (char *assumed_path); +fnmreal.c |filename| char *real_filename (char *spec) +fnmrenm.c |filename| char *filename_rename (from, to, mode) +fnmsep1.c |filename| isolate_path () +fnmsep2.c |filename| char *remove_extension (char *s) +fnmsep3.c |filename| char *get_filename_from_path (char *s) +fnmsep4.c |filename| char *get_relative_path (char *p1, char *p2) +fnmovwr.c |filename| int dont_overwrite_file (char *s, int max); +fnm_d2u.c |filename| int cdecl filename_dos2unix (char *d, char *s); +gennednm.c |filename| generate ned names +getcdir0.c |filename| char *_get_current_directory (char *buffer) +getcdir1.c |filename| char *get_current_directory (char *buffer) +getpwd_l.asm |filename| Get Current Working Directory (Change Directory) +getpwd_l.asm |filename| Large Model +getpwd_s.asm |filename| Get Current Working Directory (Change Directory) +getpwd_s.asm |filename| Small Model +logicfnm.c |filename| translate logic filenames +logicfpt.c |filename| print logic filename translation table +makepath.c |filename| int make_path (char *path, int flags) +modtbl.c |filename| return module information +rotfile.c |filename| rotate a file +setetcfn.c |filename| set file name using environment variable ETC +settmpfn.c |filename| char *set_tmp_filename (char *dst, char *fnm); +tellext.c |filename| char *tell_extension (char *s) +vshift01.c |filename| vshift (char *fnm, long version, ...) +wildcard.c |filename| wildcard matching and recursive subdirs +wildcrd2.c |filename| int wcrd_wild_check (char *nm) +wcrd_001.c |filename| redesigned wildcard subsystem +wcrd_002.c |filename| redesigned wildcard subsystem +wcrd_003.c |filename| redesigned wildcard subsystem +wcrd_004.c |filename| redesigned wildcard subsystem +wcrd_005.c |filename| redesigned wildcard subsystem +wcrd_006.c |filename| redesigned wildcard subsystem +wcrd_007.c |filename| redesigned wildcard subsystem +wcrd_008.c |filename| redesigned wildcard subsystem +wcrd_009.c |filename| redesigned wildcard subsystem +wcrd_d01.c |filename| (DOS) redesigned wildcard subsytem +wcrd_d02.c |filename| (DOS) redesigned wildcard subsytem +# +archead.c |archives| Einscannen von Fileheadern in ARC-Files +arcfiles.c |archives| Verarbeiten von ARC-Files (PKARC, ARC) +zip_0001.c |archives| Strings aus ZIP Files lesen +zip_0001.c |archives| int zip_read_string (FILE *fi, int string_length, char **string_ptr) +zip_0002.c |archives| Beginn des Central Directory End Blocks in ZIP Files aufsuchen +zip_0002.c |archives| long zip_find_cde_start (FILE *fi, long max_search) +zs.c | | ZIP Scanner, experimentell +lzhhead.c |archives| LZH-Archive: Scannen eines Eintrags +dpp_0001.c |dpp | long dpp_fread_long (FILE *fi, int bytes) +dpp_0002.c |dpp | int dpp_fwrite_long (FILE *fo, long val, int bytes) +dpp_0003.c |dpp | long dpp_get_long (char *buf, int bytes) +dpp_0004.c |dpp | int ARGDeval (char *s, int o, int c, int b, int d); +dpp_0005.c |dpp | int ARGeval (char *s, int o, int c, int b); +dpp_0006.c |dpp | int ARG_long_eval (char *s, int o, int c, ...); +dpp_0007.c |dpp | int msdos_get_int (char *s); +dpp_0008.c |dpp | long msdos_get_long (char *s); +lng2hex.c |dpp | int long_to_hex (long bin, char *hex) +lng2nstr.c |dpp | int long_to_num_string (long bin, char *hex) +bin2hex.c |dpp | int bin_to_hex (char *bin, char *hex, int lng) +bin2hex.c |dpp | convert a binary data block into a printable hex string +bin2hexr.c |dpp | int bin_to_hex_rev (char *bin, char *hex, int lng); +hex2bin.c |dpp | int cdecl hex_to_bin (char *hex, char *bin, int lng); +hex2bin.c |dpp | convert a printable hex string into a binary data block +cms_stat.c |__CMS__ | int stat (char *fn, struct stat *st); +cms_acce.c |__CMS__ | int access (char *fn, int mode); +# +# tools ====================================================================== +xref01.c |tools | general XREF package +xref02.c |tools | XREF package: resolver helpers +xref03.c |tools | XREF package: resolver +# +# 'Schmutzige' Tricks ======================================================== +dirt_001.c |dirty | patch (...) +dirt_002.c |dirty | patch_str () +dirt_003.c |dirty | get_patch (...) +dirt_004.c |dirty | peekb (...) +dirt_005.c |dirty | pokeb (...) +dirt_006.c |dirty | dump (FILE *fo, char *cp, int cnt); +dirt_007.c |dirty | set_cp (char **c1, char *c2); +dirt_008.c |dirty | flip_int (int *); +dirt_009.c |dirty | flip_long (long *); +dirt_010.c |dirty | flip_long_2 (long *); +dirt_011.c |dirty | VAL (char *s, int idx); +dirt_012.c |dirty | void dump_file* (FILE *fo, FILE *fi, long cnt) +dirt_013.c |dirty | void dump_str* (FILE *fo, char *x, int cnt, long *tbl) +dirt_014.c |dirty | int print_int_table (FILE *fo, int *cpi, int num); +dirt_016.c |dirty | int print_int_table2 (...) +* | | diff --git a/lib/sbr/misc/.cvsignore b/lib/sbr/misc/.cvsignore new file mode 100644 index 0000000000000000000000000000000000000000..40bf8265cd4a04e9622d612bd754b8a05b51044a --- /dev/null +++ b/lib/sbr/misc/.cvsignore @@ -0,0 +1,4 @@ +fnmdef +fndvfile +t_getcwd +@* diff --git a/lib/sbr/misc/Makefile b/lib/sbr/misc/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..a03ee3484d65a8581970cae871f6b069405299a1 --- /dev/null +++ b/lib/sbr/misc/Makefile @@ -0,0 +1,133 @@ +# +# FILE %sbr/make-ux +# +# written: 1995-12-28 +# latest update: 2000-08-28 12:27:57 +# $Id: Makefile,v 1.12 2009/01/13 16:46:11 gonter Exp $ +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-g -I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a +ccc=$(CC) $(OPTS) -c + +BINS= fnmdef fndvfile + +all: lib +all.bin: $(BINS) +test: t_getcwd + +# ---------------------------------------------------------------------------- +sbr_0= \ + bin2hex.o bin2hexr.o cdromfnm.o \ + convent1.o convent2.o convent4.o convent5.o convent6.o \ + copyfil0.o dcd01.o diagnose.o dirt_006.o \ + dirt_012.o dirt_i12.o dirt_l12.o \ + dirt_013.o dirt_i13.o dirt_l13.o \ + dirt_i14.o dirt_l14.o\ + dirt_i16.o dirt_l16.o\ + dpp_0001.o dpp_0002.o dpp_0003.o dpp_0005.o dpp_0006.o \ + dpp_0007.o dpp_0008.o \ + alt_seed.o \ + envfilsr.o fclosec.o file2low.o file2upp.o \ + file2buf.o flopen.o fndvfile.o fnmcpy.o fnmcpy2.o \ + fnmcpy3.o fnmcpy4.o fnmdef.o fnmdestn.o fnmovwr.o \ + fnmreal.o fnmrenm.o fnmsep1.o fnmsep2.o fnmsep3.o fnmsep4.o \ + fnmdpath.o freadit.o freaditf.o freadlin.o frmaclin.o \ + freadst.o freadstf.o \ + ftrans01.o ftrans02.o ftrans03.o ftrans04.o ftrans05.o ftrans06.o \ + ftrans07.o ftrans08.o ftrans09.o ftrans10.o \ + getcdir0.o getcdir1.o gennednm.o lng2hex.o lng2nstr.o \ + makepath.o param001.o param002.o rndlong.o rotfile.o \ + setetcfn.o settmpfn.o tellext.o \ + trasheol.o hex2bin.o logicfnm.o logicfpt.o vshift01.o \ + wcrd_001.o wcrd_002.o wcrd_003.o wcrd_004.o wcrd_005.o \ + wcrd_006.o wcrd_007.o wcrd_008.o wcrd_009.o wildcrd2.o \ + xref01.o xref02.o xref03.o + +sbr_2= sixelval.o +sbr_1= md5c.o md5d2s.o md5s2d.o md5chkb.o md5chks.o \ + md5chk2a.o md5chk2b.o + +# ---------------------------------------------------------------------------- +clean: + rm -f *.o lib $(BINS) + +# ---------------------------------------------------------------------------- +lib: $(sbr_0) # $(sbr_1) $(sbr_2) + ar ru $(LIB) $? + touch lib + +.c.o: + $(CC) $(OPTS) -c $? + +# ---------------------------------------------------------------------------- +dirt_012.o: dirt_012.c + $(CC) $(OPTS) -o $@ -c dirt_012.c + +dirt_i12.o: dirt_012.c + $(CC) $(OPTS) -o $@ -c -DTLT_INT $? + +dirt_l12.o: dirt_012.c + $(CC) $(OPTS) -o $@ -c -DTLT_LONG $? + +dirt_013.o: dirt_013.c + $(CC) $(OPTS) -o $@ -c dirt_013.c + +dirt_i13.o: dirt_013.c + $(CC) $(OPTS) -o $@ -c -DTLT_INT $? + +dirt_l13.o: dirt_013.c + $(CC) $(OPTS) -o $@ -c -DTLT_LONG $? + +dirt_i14.o: dirt_014.c + $(CC) $(OPTS) -o $@ -c -DDTYPE_int $? + +dirt_l14.o: dirt_014.c + $(CC) $(OPTS) -o $@ -c -DDTYPE_long $? + +dirt_i16.o: dirt_016.c + $(CC) $(OPTS) -o $@ -c -DDTYPE_int $? + +dirt_l16.o: dirt_016.c + $(CC) $(OPTS) -o $@ -c -DDTYPE_long $? + +file2low.o: file2low.c + $(CC) $(OPTS) -o $@ -DTO_LOWER -c file2low.c + +file2upp.o: file2low.c + $(CC) $(OPTS) -o $@ -DTO_UPPER -c file2low.c + +frmaclin.o: freadlin.c + $(CC) $(OPTS) -o $@ -c -DMAC_MODE $? + +# ---------------------------------------------------------------------------- +FNMDEF_DEBUG= #-DEBUG +FNMDEF= _fnmdef.o _fnmreal.o _logicfnm.o +fnmdef : $(FNMDEF) + cc -o fnmdef $(FNMDEF) $(LIB) + +_fnmdef.o : fnmdef.c + $(ccc) -o $@ $(FNMDEF_DEBUG) -DDEBUG_main fnmdef.c + +_fnmreal.o : fnmreal.c + $(ccc) -o $@ $(FNMDEF_DEBUG) fnmreal.c + +_logicfnm.o : logicfnm.c + $(ccc) -o $@ $(FNMDEF_DEBUG) logicfnm.c + +logicfnm.o : logicfnm.c + $(ccc) -o $@ $(FNMDEF_DEBUG) logicfnm.c + +# ---------------------------------------------------------------------------- +FNDVFILE= _fndvfile.o +fndvfile : $(FNDVFILE) + cc -o fndvfile $(FNDVFILE) $(LIB) + +_fndvfile.o : fndvfile.c + $(ccc) -o $@ $(FNMDEF_DEBUG) -DDEBUG_main fndvfile.c + +# ---------------------------------------------------------------------------- +t_getcwd : t_getcwd.c + $(CC) $(OPTS) -o $@ $? diff --git a/lib/sbr/misc/alt_seed.c b/lib/sbr/misc/alt_seed.c new file mode 100644 index 0000000000000000000000000000000000000000..74bc030d3298cbc83c0514c6908664b2bcdc35ea --- /dev/null +++ b/lib/sbr/misc/alt_seed.c @@ -0,0 +1,22 @@ +/* + * FILE %sbr/alt_seed.c + * + * written: 2000-08-28 + * latest update: 2000-08-28 12:25:52 + * $Id: alt_seed.c,v 1.3 2012/11/22 16:16:26 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +void alt_seed (void) +{ + long seed= (unsigned int) time ((long *) 0); +#ifndef MSDOS + seed ^= getpid (); +#endif + seed ^= (int) rand (); + srand (seed); +} diff --git a/lib/sbr/misc/alt_seed.o b/lib/sbr/misc/alt_seed.o new file mode 100644 index 0000000000000000000000000000000000000000..e71c86debe7199ce99297f277d3628957db51795 Binary files /dev/null and b/lib/sbr/misc/alt_seed.o differ diff --git a/lib/sbr/misc/arcfiles.c b/lib/sbr/misc/arcfiles.c new file mode 100644 index 0000000000000000000000000000000000000000..41dfb0b5b4f24f02cb7fe0396697ee901ed1ad5c --- /dev/null +++ b/lib/sbr/misc/arcfiles.c @@ -0,0 +1,46 @@ +/* + * FILE /usr/sbr/arcfiles.c + * + * Verarbeiten von Archiv Files f�r FM File Manager + * + * 1989 01 20 + * 1989 07 02: File ARCHEAD.H extrahiert + * 1990 02 03: Revision + * + */ + +# include <stdio.h> +# include <dos.h> +# include <direct.h> +# include <ctype.h> +# include <string.h> +# include <gg/fnames.h> +# include <gg/archead.h> + +static struct heads pu; + +# pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +int get_arc_file ( +FILE *fi, /* Archiv File, bin�r er�ffnet */ +struct dta_buff *p) /* DOS DTA-Puffer */ +/* RETURN: -1 Error or no Archive */ +/* 0 EOF: no more files in archive */ +/* 1 Archiv File gefunden; DTA g�ltig */ +{ int ch; + + if (feof (fi)) return -1; /* EOF ??? kommt ueberraschend */ + ch =fgetc (fi); + if (ch != 0x01A) return -1; /* no Archive */ + ch =fgetc (fi); + if (ch == 0x00) return 0; /* EOF */ + fread ((char *) &pu, 27, 1, fi); + strncpy (p->name, pu.name,13); + p->time = pu.time; + p->date = pu.date; + p->size = pu.length; + p->att = (char) ch; /* Compressing Mode */ + fseek (fi, pu.size, 1); + return 1; +} diff --git a/lib/sbr/misc/archead.c b/lib/sbr/misc/archead.c new file mode 100644 index 0000000000000000000000000000000000000000..cfcd5b4e4c804c18e4b274ab4ad48c846fcd0c4f --- /dev/null +++ b/lib/sbr/misc/archead.c @@ -0,0 +1,36 @@ +/* + * FILE c:/usr/sbr/archead.c + * + * Verarbeiten von Archiv Files + * + * 1989 01 20 + * 1989 07 02: aus ARCFILES.C abgewandelt + * 1990 02 03: Revision + * + */ + +# include <stdio.h> +# include <gg/archead.h> + +# pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +int get_arc_head ( +FILE *fi, /* Archiv File, bin�r er�ffnet */ +struct heads *head) /* ARC-Header */ +/* RETURN: Compression Method: */ +/* -1 Error or no Archive */ +/* 0 EOF: no more files in archive */ +/* >0 Archiv File gefunden; head g�ltig */ +{ int ch; + + if (head == (struct heads *) 0) return -1; + if (feof (fi)) return -1; /* EOF ??? kommt �berraschend */ + ch =fgetc (fi); + if (ch != 0x01A) return -1; /* no Archive */ + ch =fgetc (fi); + if (ch == 0x00) return 0; /* EOF */ + fread ((char *) head, 27, 1, fi); + fseek (fi, head->size, 1); + return ch; +} diff --git a/lib/sbr/misc/bin2hex.c b/lib/sbr/misc/bin2hex.c new file mode 100644 index 0000000000000000000000000000000000000000..f35d87f974c6a6bb7b80641ef363f1b35630d5a5 --- /dev/null +++ b/lib/sbr/misc/bin2hex.c @@ -0,0 +1,39 @@ +/* + * FILE %sbr/bin2hex.c + * + * convert an binary data block into a printable string + * see also: + * - hex2bin.c int cdecl hex_to_bin (char *hex, char *bin, int lng); + * convert a printable hex string into a binary data block + * + * written: 1993-01-06: <Gerhard.Gonter@wu-wien.ac.at> + * 1995-02-20: renamed from md5d2s.c to bin2hex.c + * latest update: 1996-07-21 15:37:07 + * + */ + +#include <gg/dpp.h> + +static char hex_table [16]= "0123456789abcdef"; + +/* ------------------------------------------------------------------------ */ +int bin_to_hex (char *bin, char *hex, int lng) +{ + int ch; + int ch2; + + if (lng <= 0) return -1; + + while (lng-- > 0) + { + ch= *bin++ & 0x00FF; + ch2= (ch >> 4) & 0x000F; + ch &= 0x000F; + + *hex++= hex_table [ch2]; + *hex++= hex_table [ch]; + } + *hex= 0; + + return 0; +} diff --git a/lib/sbr/misc/bin2hex.o b/lib/sbr/misc/bin2hex.o new file mode 100644 index 0000000000000000000000000000000000000000..1bbceaff98f28906e1b23d13200928fc126862f6 Binary files /dev/null and b/lib/sbr/misc/bin2hex.o differ diff --git a/lib/sbr/misc/bin2hexr.c b/lib/sbr/misc/bin2hexr.c new file mode 100644 index 0000000000000000000000000000000000000000..3806efb2ad06de78a0ccd3a2fc45a4313f9bf01a --- /dev/null +++ b/lib/sbr/misc/bin2hexr.c @@ -0,0 +1,39 @@ +/* + * FILE %sbr/bin2hexr.c + * + * convert an binary data block into a printable string + * see also: + * - hex2bin.c int cdecl hex_to_bin (char *hex, char *bin, int lng); + * convert a printable hex string into a binary data block + * + * written: 1993-01-06: <Gerhard.Gonter@wu-wien.ac.at> + * 1995-02-20: renamed from md5d2s.c to bin2hex.c + * latest update: 1996-07-21 15:33:02 + * + */ + +#include <gg/dpp.h> + +static char hex_table [16]= "0123456789abcdef"; + +/* ------------------------------------------------------------------------ */ +int bin_to_hex_rev (char *bin, char *hex, int lng) +{ + int ch; + int ch2; + + if (lng <= 0) return -1; + + while (--lng >= 0) + { + ch= bin [lng] & 0x00FF; + ch2= (ch >> 4) & 0x000F; + ch &= 0x000F; + + *hex++= hex_table [ch2]; + *hex++= hex_table [ch]; + } + *hex= 0; + + return 0; +} diff --git a/lib/sbr/misc/bin2hexr.o b/lib/sbr/misc/bin2hexr.o new file mode 100644 index 0000000000000000000000000000000000000000..2c3fc73ab560a6501c1f818313de69f5b7c1056d Binary files /dev/null and b/lib/sbr/misc/bin2hexr.o differ diff --git a/lib/sbr/misc/cdromfnm.c b/lib/sbr/misc/cdromfnm.c new file mode 100644 index 0000000000000000000000000000000000000000..b6e66f64a98d1b63b48c96cb6eed476ac61ecc80 --- /dev/null +++ b/lib/sbr/misc/cdromfnm.c @@ -0,0 +1,38 @@ +/* + * FILE %sbr/cdromfnm.c + * + * change a filename into a format that is also good for CD Roms + * + * written: 1996-08-11 + * latest update: 1996-08-11 17:23:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +int cdrom_file_name (char *fnm) +{ + int ch; + + if (fnm == (char *) 0) return -1; + + while ((ch= *fnm & 0x0FF) != 0) + { + if (ch >= 'A' && ch <= 'Z') ch= ch - 'A' + 'a'; else + if (!((ch >= '0' && ch <= '9') + || (ch >= 'a' && ch <= 'z') + || ch == '@' || ch == '-' || ch == '.' + ) + ) + ch= '_'; + + *fnm++= (char) ch; + } + + return 0; +} diff --git a/lib/sbr/misc/cdromfnm.o b/lib/sbr/misc/cdromfnm.o new file mode 100644 index 0000000000000000000000000000000000000000..bdf4d5bcd70b381e09f55733987e7d8949001ef9 Binary files /dev/null and b/lib/sbr/misc/cdromfnm.o differ diff --git a/lib/sbr/misc/cms_acce.c b/lib/sbr/misc/cms_acce.c new file mode 100644 index 0000000000000000000000000000000000000000..d0698e224c11af12618c6addd7803cc2a5085513 --- /dev/null +++ b/lib/sbr/misc/cms_acce.c @@ -0,0 +1,25 @@ +/* + * FILE /usr/sbr/cms_acce.c + * + * simulate access() for CMS + * >> Don't use it on a MSDOS or Unix machine << + * >> this function is simply pervert... << + * + * 1992 02 12 + * + */ + +#include <stdio.h> +#include "ggcms.h" + +/* ------------------------------------------------------------------------ */ +int access (char *fn, int mode) +{ + FILE *f; + + f=fopen (fn, "rb"); + if (f == (FILE *) 0) return -1; + fclose (f); + + return 0; +} diff --git a/lib/sbr/misc/cms_stat.c b/lib/sbr/misc/cms_stat.c new file mode 100644 index 0000000000000000000000000000000000000000..6de1da27910763310625c73e35f11d1370be02d3 --- /dev/null +++ b/lib/sbr/misc/cms_stat.c @@ -0,0 +1,27 @@ +/* + * FILE /usr/sbr/cms_stat.c + * + * simulate stat() for CMS + * >> Don't use it on a MSDOS or Unix machine << + * >> this function is simply pervert... << + * + * 1992 02 11 + * + */ + +#include <stdio.h> +#include "ggcms.h" + +/* ------------------------------------------------------------------------ */ +int stat (char *fn, struct stat *st) +{ + FILE *f; + + f=fopen (fn, "rb"); + if (f == (FILE *) 0) return -1; + fseek (f, 0L, 2); + st->st_size = ftell (f); + fclose (f); + + return 0; +} diff --git a/lib/sbr/misc/contrib b/lib/sbr/misc/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/sbr/misc/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/sbr/misc/convent1.c b/lib/sbr/misc/convent1.c new file mode 100644 index 0000000000000000000000000000000000000000..662051e9e30b8c26e8bc6149f817ca76283f72c1 --- /dev/null +++ b/lib/sbr/misc/convent1.c @@ -0,0 +1,54 @@ +/* + * FILE %sbr/convent1.c + * + * Convert Characters to SGML Entities + * + * written: 1991-07-03: <Gerhard.Gonter@wu-wien.ac.at> + * latest update: 1997-10-24 11:46:52 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/fileio.h> +#include <gg/convent.h> + +/* ------------------------------------------------------------------------ */ +int sgml_entity_conversion ( +char *fni, /* input file name */ +char *fno, /* output file name */ +int level) /* bit 0: convert & */ + /* bit 1: convert <> */ + /* bit 2: convert 0x80..0xFF (PC) */ + /* bit 3: convert 0x80..0xFF (Mac) */ +{ + FILE *fi; + FILE *fo; + int ch; + int fi_open= 0; + int fo_open= 0; + int rc= 0; + + FXOPEN (fni, fi, stdin, "rb", fi_open); + FXOPEN (fno, fo, stdout, "wb", fo_open); + + if (fi != (FILE *) 0 && fo != (FILE *) 0) + { + rc= 0; + + for (;;) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + fputc_entity (ch, fo, level); + } + } + + FXCLOSE (fi, fi_open); + FXCLOSE (fo, fo_open); + + return rc; +} diff --git a/lib/sbr/misc/convent1.o b/lib/sbr/misc/convent1.o new file mode 100644 index 0000000000000000000000000000000000000000..730f70789c00dd4b42a4c524317413f54f9118fe Binary files /dev/null and b/lib/sbr/misc/convent1.o differ diff --git a/lib/sbr/misc/convent2.c b/lib/sbr/misc/convent2.c new file mode 100644 index 0000000000000000000000000000000000000000..8fae12d374d9f7b0c3f07008b80b86bb0711afa0 --- /dev/null +++ b/lib/sbr/misc/convent2.c @@ -0,0 +1,185 @@ +/* + * FILE %sbr/convent2.c + * + * Convert PC characters to SGML entities + * + * written: 1991 07 03 + * latest update: 1997-03-31 10:55:27 + * $Id: convent2.c,v 1.2 2005/09/04 20:27:37 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/dpp.h> +#include <gg/convent.h> + +/* ------------------------------------------------------------------------ */ +struct XX +{ + int v; + char *nm; +} ; + +/* ------------------------------------------------------------------------ */ +#define xx_siz 4 +static struct XX PC_ENTITY_xx [xx_siz] = +{ + /* SGML meta characters */ + { 0x26, "amp" } , + { 0x3C, "lt" } , + { 0x3E, "gt" } , + + { 0x15, "sect" } +}; + +/* ------------------------------------------------------------------------ */ +static char *PC_ENTITY_a [] = +{ +/* 0x80 */ "Ccedil", +/* 0x81 */ "uuml", +/* 0x82 */ "eacute", +/* 0x83 */ "acirc", +/* 0x84 */ "auml", +/* 0x85 */ "agrave", +/* 0x86 */ "adot", +/* 0x87 */ "ccedil", +/* 0x88 */ "ecirc", +/* 0x89 */ "euml", +/* 0x8A */ "egrave", +/* 0x8B */ "iuml", +/* 0x8C */ "icirc", +/* 0x8D */ "igrave", +/* 0x8E */ "Auml", +/* 0x8F */ "Acirc", + +/* 0x90 */ "Eacute", +/* 0x91 */ "aelig", +/* 0x92 */ "AElig", +/* 0x93 */ "ocirc", +/* 0x94 */ "ouml", +/* 0x95 */ "ograve", +/* 0x96 */ "ucirc", +/* 0x97 */ "ugrave", +/* 0x98 */ "yuml", +/* 0x99 */ "Ouml", +/* 0x9A */ "Uuml", +/* 0x9B */ "cent", +/* 0x9C */ "pound", +/* 0x9D */ "yen", +/* 0x9E */ "Ptlig", /* P und t zusammengezogen */ +/* 0x9F */ "funnyf", /* �hnlich wie ein kleines f */ + +/* 0xA0 */ "aacute", +/* 0xA1 */ "iacute", +/* 0xA2 */ "oacute", +/* 0xA3 */ "uacute", +/* 0xA4 */ "ntilde", +/* 0xA5 */ "Ntilde", +/* 0xA6 */ "aunderl", +/* 0xA7 */ "ounderl", +/* 0xA8 */ "iquest", +/* 0xA9 */ "inot", /* inverses NOT ?? */ +/* 0xAA */ "not", +/* 0xAB */ "frac12", +/* 0xAC */ "frac14", +/* 0xAD */ "iexcl", +/* 0xAE */ "laquo", +/* 0xAF */ "raquo" +} ; + +/* ------------------------------------------------------------------------ */ +static char *PC_ENTITY_b [] = +{ +/* 0xE0 */ "agr", +/* 0xE1 */ "szlig", +/* 0xE2 */ "Ggr", +/* 0xE3 */ "pgr", +/* 0xE4 */ "Sgr", +/* 0xE5 */ "sgr", +/* 0xE6 */ "mgr", +/* 0xE7 */ "tgr", +/* 0xE8 */ "PHgr", +/* 0xE9 */ "THgr", +/* 0xEA */ "OHgr", +/* 0xEB */ "dgr", +/* 0xEC */ "infin", +/* 0xED */ "Oslash", /* Durchschnitt ??? */ +/* 0xEE */ "isin", +/* 0xEF */ "cap", + +/* 0xF0 */ "equiv", +/* 0xF1 */ "plusmn", +/* 0xF2 */ "ge", +/* 0xF3 */ "le", +/* 0xF4 */ "intu", /* obere H�lfte des Integralzeichens!! */ +/* 0xF5 */ "intl", /* untere H�lfte des Integralzeichens !! */ +/* 0xF6 */ "divide", +/* 0xF7 */ "sim", +/* 0xF8 */ "deg", +/* 0xF9 */ "bmiddot", +/* 0xFA */ "middot", +/* 0xFB */ "radic", +/* 0xFC */ "supn", +/* 0xFD */ "sup2" +} ; + +/* ------------------------------------------------------------------------ */ +char *get_pc_sgml_entity (int ch) +{ + int i; + + for (i= 0; i<xx_siz; i++) + if (PC_ENTITY_xx[i].v == ch) + return PC_ENTITY_xx[i].nm; + + if (ch >= 0x80 && ch <= 0xAF) + { + return PC_ENTITY_a [ch-0x80]; + } + + if (ch >= 0xE0 && ch <= 0xFD) + { + return PC_ENTITY_b [ch-0xE0]; + } + return (char *) 0; +} + +/* ------------------------------------------------------------------------ */ +int find_pc_sgml_entity (const char *s) +{ + int i; + + if (s == (char *) 0 || *s == 0) return -1; + + if (*s == '#') + { + long v; + + s++; + if (*s == 0) return -1; + v= get_parameter_value (s); + return (v < 0 || v > 255) ? -1 : (int) v; + } + + for (i= 0; i < xx_siz; i++) + if (strcmp (PC_ENTITY_xx[i].nm, s) == 0) + return PC_ENTITY_xx[i].v; + + for (i= 0x00; i <= 0x2F; i++) + { + if (PC_ENTITY_a [i] != (char *) 0 + && strcmp (PC_ENTITY_a [i], s) == 0) return i + 0x80; + } + + for (i= 0x00; i <= 0x1D; i++) + { + if (PC_ENTITY_b [i] != (char *) 0 + && strcmp (PC_ENTITY_b [i], s) == 0) return i + 0xE0; + } + + return -1; +} diff --git a/lib/sbr/misc/convent2.o b/lib/sbr/misc/convent2.o new file mode 100644 index 0000000000000000000000000000000000000000..f40f3c5fa17332d174d24dbd0f0743844bc232f8 Binary files /dev/null and b/lib/sbr/misc/convent2.o differ diff --git a/lib/sbr/misc/convent4.c b/lib/sbr/misc/convent4.c new file mode 100644 index 0000000000000000000000000000000000000000..50d3d6aefd9ac4414d28f3161d4de177ac652a03 --- /dev/null +++ b/lib/sbr/misc/convent4.c @@ -0,0 +1,59 @@ +/* + * FILE /usr/sbr/convent4.c + * + * convert typographic characters to SGML entities + * + * 1991 11 13 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/convent.h> + +/* ------------------------------------------------------------------------ */ +struct XX +{ + int v; + char *nm; +} ; + +/* ------------------------------------------------------------------------ */ +#define xx_siz 5 +static struct XX TY_ENTITY_xx [xx_siz] = +{ + { 0x00101, "TYcont" } , + { 0x00102, "TYdash" } , + { 0x00103, "TYhyph" } , + { 0x00104, "TYminus" } , + { 0x00105, "TYsp1" } +}; + +/* ------------------------------------------------------------------------ */ +char *get_typographic_sgml_entity (int ch) +{ + int i; + + for (i=0; i<xx_siz; i++) + if (TY_ENTITY_xx[i].v == ch) + return TY_ENTITY_xx[i].nm; + + return (char *) 0; +} + +/* ------------------------------------------------------------------------ */ +int find_typographic_sgml_entity (char *s) +{ + int i; + + if (s == (char *) 0 || *s == 0) return -1; + + for (i=0; i<xx_siz; i++) + if (strcmp (TY_ENTITY_xx[i].nm, s) == 0) + return TY_ENTITY_xx[i].v; + + return -1; +} diff --git a/lib/sbr/misc/convent4.o b/lib/sbr/misc/convent4.o new file mode 100644 index 0000000000000000000000000000000000000000..ad0c98ce916c483b72aecc41210da6b2cceba9ff Binary files /dev/null and b/lib/sbr/misc/convent4.o differ diff --git a/lib/sbr/misc/convent5.c b/lib/sbr/misc/convent5.c new file mode 100644 index 0000000000000000000000000000000000000000..086380bbc62c12759ff5c64b57707d68a59c1082 --- /dev/null +++ b/lib/sbr/misc/convent5.c @@ -0,0 +1,88 @@ +/* + * FILE %sbr/convent5.c + * + * Convert Characters to SGML Entities + * + * written: 1991-07-03: <Gerhard.Gonter@wu-wien.ac.at> + * 1995-01-29: extracted from convent1.c + * latest update: 1996-06-09 11:14:18 + * + */ + +#include <stdio.h> + +#define USE_CODE_TABLE +#ifdef USE_CODE_TABLE +#include <gg/codes.h> +#endif + +#include <gg/convent.h> + +/* ------------------------------------------------------------------------ */ +int fputc_entity (int ch, FILE *fo, int level) +{ + char *entity_name; + + switch (ch) + { + case '&': + if (level & CONVENT_amp) fputs ("&", fo); + else fputc ('&', fo); + break; + + case '<': + if (level & CONVENT_lt_gt) fputs ("<", fo); + else fputc ('<', fo); + break; + + case '>': + if (level & CONVENT_lt_gt) fputs (">", fo); + else fputc ('>', fo); + break; + + case 0x0A: + case 0x0D: + goto NORMAL; + + default: + if ((ch >= 0x80 && ch <= 0xFF) + ||(ch >= 0x00 && ch <= 0x1F)) + { +#ifdef USE_CODE_TABLE +/* fprintf (stderr, "convert 0x%02X %c\n", ch, ch); **********/ + if (level & CONVENT_pc_8bit) + { +/* fprintf (stderr, "convert 0x%02X %c (2)\n", ch, ch); */ + entity_name= get_sgml_entity (ch); + if (entity_name == (char *) 0) goto NORMAL; + fprintf (fo, "&%s;", entity_name); + } +#else + if (level & CONVENT_pc_8bit) + { + entity_name= get_pc_sgml_entity (ch); + if (entity_name == (char *) 0) goto NORMAL; + fprintf (fo, "&%s;", entity_name); + } +#ifdef NOT_YET + else + if (level & CONVENT_mac_8bit) + { + entity_name= get_mac_sgml_entity (ch); + if (entity_name == (char *) 0) goto NORMAL; + fprintf (fo, "&%s;", entity_name); + } +#endif +#endif + else goto NORMAL; + } + else + { +NORMAL: + fputc (ch, fo); + } + break; + } + + return 0; +} diff --git a/lib/sbr/misc/convent5.o b/lib/sbr/misc/convent5.o new file mode 100644 index 0000000000000000000000000000000000000000..073c1f10ccf12ca50994a2bd5dfc09de6f9e6165 Binary files /dev/null and b/lib/sbr/misc/convent5.o differ diff --git a/lib/sbr/misc/convent6.c b/lib/sbr/misc/convent6.c new file mode 100644 index 0000000000000000000000000000000000000000..eb06e1948627274d1468de70533bcca82c78192d --- /dev/null +++ b/lib/sbr/misc/convent6.c @@ -0,0 +1,23 @@ +/* + * FILE %sbr/convent6.c + * + * Convert Characters to SGML Entities + * + * written: 1995-01-29 + * latest update: 1996-06-09 11:14:06 + * + */ + +#include <stdio.h> +#include <gg/convent.h> + +/* ------------------------------------------------------------------------ */ +int fputs_entity (char *s, FILE *fo, int level) +{ + int ch; + + for (; ((ch= *s) & 0x00FF) != 0; s++) + fputc_entity (ch, fo, level); + + return 0; +} diff --git a/lib/sbr/misc/convent6.o b/lib/sbr/misc/convent6.o new file mode 100644 index 0000000000000000000000000000000000000000..613450da47fc45d424a82dd6b6415b6c66be9cb0 Binary files /dev/null and b/lib/sbr/misc/convent6.o differ diff --git a/lib/sbr/misc/copyfil0.c b/lib/sbr/misc/copyfil0.c new file mode 100644 index 0000000000000000000000000000000000000000..2ede53a3d47ee371318f788aeb1e3e842de7d6bc --- /dev/null +++ b/lib/sbr/misc/copyfil0.c @@ -0,0 +1,44 @@ +/* + * FILE ~/usr/sbr/copyfil0.c + * + * File Copy + * - see also: copyfile.c + * + * written: 1994-07-17 (extracted from .. + * latest update: 1994-12-09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +int copyfile (char *src, char *dst) +{ + FILE *fi; + FILE *fo; + int ch; + + if ((fi= fopen (src, "rb")) == (FILE *) 0) return -1; + if ((fo= fopen (dst, "wb")) == (FILE *) 0) + { + fclose (fi); + return -1; + } + + for (;;) + { + ch= fgetc (fi); + if (feof (fi)) break; + fputc (ch, fo); + } + + fclose (fi); + fclose (fo); + + return 0; +} diff --git a/lib/sbr/misc/copyfil0.o b/lib/sbr/misc/copyfil0.o new file mode 100644 index 0000000000000000000000000000000000000000..e7b5f893dbb9b5c8cf81d243e1eb802577f5b544 Binary files /dev/null and b/lib/sbr/misc/copyfil0.o differ diff --git a/lib/sbr/misc/copyfile.c b/lib/sbr/misc/copyfile.c new file mode 100644 index 0000000000000000000000000000000000000000..d68a824f893465bce95921059718a01ebab5e28b --- /dev/null +++ b/lib/sbr/misc/copyfile.c @@ -0,0 +1,85 @@ +/* + * FILE ~/usr/sbr/copyfile.c + * + * File Copy + * - see also: copyfil0.c + * + * written: 1991 06 23 + * latest update: 1994-07-17 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#include <io.h> +#endif + +#include <stdio.h> +#include <gg/sbr.h> + +static char *outmodes; + +/* ------------------------------------------------------------------------ */ +long copy_file (char *src, char *dst, int flags) +{ + FILE *fi; + FILE *fo; + int ch, ch2; + long cnt= 0L; + long write_pos; + + fi= fopen (src, (flags & COPY_FILE_in_text) ? "rt" : "rb"); + if (fi == (FILE *) 0) return -1L; + + if ((flags & COPY_FILE_dont_overwrite) + && access (dst, 0) == 0) return -1L; + + fo= fopen (dst, + (flags & COPY_FILE_append) + ? ((flags & COPY_FILE_out_text) ? "at" : "ab") + : ((flags & COPY_FILE_out_text) ? "wt" : "wb")); + + if (fo == (FILE *) 0) + { +ERR1: + fclose (fi); + return -1L; + } + + fseek (fo, (long) 0, 2); + write_pos= ftell (fo); + + for (;;) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + fputc (ch, fo); + cnt++; + } + + fclose (fo); + + if (flags & COPY_FILE_verify) + { + fo= fopen (dst, (flags & COPY_FILE_out_text) ? "rt" : "rb"); + if (fo == (FILE *) 0) goto ERR1; + fseek (fi, 0L, 0); + fseek (fo, write_pos, 0); + for (;;) + { + ch= fgetc (fi) & 0x00FF; + ch2= fgetc (fi) & 0x00FF; + if (feof (fi) && feof (fo)) break; + if (feof (fi) || feof (fo) || ch != ch2) + { + fclose (fo); + goto ERR1; + } + } + fclose (fo); + } + + fclose (fi); + + return cnt; +} diff --git a/lib/sbr/misc/curdisk.c b/lib/sbr/misc/curdisk.c new file mode 100644 index 0000000000000000000000000000000000000000..bfc5044aabf993d2f380ddd2a2c73136c97f7118 --- /dev/null +++ b/lib/sbr/misc/curdisk.c @@ -0,0 +1,23 @@ +/* + * FILE %sbr/curdisk.c + * + * written: 1995-12-03 + * latest update: 1995-12-03 + * + */ + +#include <dos.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +int get_current_disk () +{ + return bdos (0x19, 0x00, 0x00); +} + +/* ------------------------------------------------------------------------ */ +int select_disk (int disk_number) +{ + return bdos (0x0E, disk_number, 0x00) & 0x00FF; +} + diff --git a/lib/sbr/misc/dcd01.c b/lib/sbr/misc/dcd01.c new file mode 100644 index 0000000000000000000000000000000000000000..eb12a7162fdc0247039fa46b7eb4da91d3006ce4 --- /dev/null +++ b/lib/sbr/misc/dcd01.c @@ -0,0 +1,86 @@ +/* + * FILE %sbr/dcd01.c + * + * change the current working directory + * - process virtual paths and drive letters + * + * TEST: This function may possibly not work under UNIX + * + * written: 1995-12-03 + * latest update: 1999-05-01 20:25:56 + * + */ + +#include <string.h> +#include <stdlib.h> +#ifdef MSDOS +#include <direct.h> +#else +#include <stdio.h> +#endif /* MSDOS */ +#include <gg/strings.h> +#include <gg/filename.h> + +#ifdef MSDOS +#define DRIVE_OFFSET 2 +#else +#define DRIVE_OFFSET 0 +#endif /* !MSDOS */ + +/* #define DEBUG */ + +/* ------------------------------------------------------------------------ */ +int dcd (char *dir_specified) +{ + char *dir_real; + char *dir_virtual; + int idx; + + if (dir_specified == (char *) 0 || *dir_specified == 0) + dir_specified= getenv ("HOME"); + + if (dir_specified == (char *) 0 || *dir_specified == 0 + || filename_definition (dir_specified, &dir_real, &dir_virtual, + (char *) 0) == -1 + ) + return -1; + +#ifdef DEBUG + printf ("dir_specified: '%s'\n", dir_specified); + printf ("dir_real: '%s'\n", dir_real); + printf ("dir_virtual: '%s'\n", dir_virtual); +#endif /* DEBUG */ + + if (dir_real == (char *) 0 || *dir_real == 0) return -1; + + idx= strlen (dir_real)-1; + if (idx > DRIVE_OFFSET && dir_real [idx] == '/') dir_real [idx]= 0; + +#ifdef MSDOS + { + int current_drive; + int wanted_drive; + + current_drive= get_current_disk (); /* 0 .. A and so on */ + wanted_drive= dir_real [0]; + if (wanted_drive >= 'a' && wanted_drive <= 'z') + wanted_drive= wanted_drive - 'a'; + else + if (wanted_drive >= 'A' && wanted_drive <= 'Z') + wanted_drive= wanted_drive - 'A'; + else return -1; + + if (wanted_drive != current_drive) select_disk (wanted_drive); + + xchange (dir_real, '/', '\\'); + } +#endif /* MSDOS */ + +#ifdef MSDOS + chdir (dir_real + DRIVE_OFFSET); +#else + printf ("%s\n", dir_real + DRIVE_OFFSET); +#endif + + return 0; +} diff --git a/lib/sbr/misc/dcd01.o b/lib/sbr/misc/dcd01.o new file mode 100644 index 0000000000000000000000000000000000000000..622712baa8b999fac1d78ef13a8ac10b4c1740dc Binary files /dev/null and b/lib/sbr/misc/dcd01.o differ diff --git a/lib/sbr/misc/diagnose.c b/lib/sbr/misc/diagnose.c new file mode 100644 index 0000000000000000000000000000000000000000..239d79c05d1c59ba53b2511d2a44588fef2694a4 --- /dev/null +++ b/lib/sbr/misc/diagnose.c @@ -0,0 +1,12 @@ +/* + * FILE ~/usr/sbr/diagnose.c + * + * global memory for diagnose codes + * + * written: 1992-12-27: <Gerhard.Gonter@wu-wien.ac.at> + * latest update: 1995-02-25 + * + */ + +/* ------------------------------------------------------------------------ */ +long gg_diagnose= 0L; diff --git a/lib/sbr/misc/diagnose.o b/lib/sbr/misc/diagnose.o new file mode 100644 index 0000000000000000000000000000000000000000..9a35945e1f077ccd60dcf6d7159aff490a9a9e3d Binary files /dev/null and b/lib/sbr/misc/diagnose.o differ diff --git a/lib/sbr/misc/dirt_001.c b/lib/sbr/misc/dirt_001.c new file mode 100644 index 0000000000000000000000000000000000000000..c191d6434c6d1b7cdb913af0e1570022e2fc793f --- /dev/null +++ b/lib/sbr/misc/dirt_001.c @@ -0,0 +1,44 @@ +/* + * FILE /usr/sbr/dirt_001.c + * + * 1989 11 04 + * + */ + +#pragma check_stack(off) +#pragma pack(1) + +# define NEW_WAY + +/* ------------------------------------------------------------------------ */ +# ifdef OLD_WAY +struct PATCH +{ + int qjump; + int (*qadresse) (); +} ; + +void patch (struct PATCH *a1, int (*a2) ()) +{ + a1->qjump = 0xEA90; /* 90=NOP, EA=JUMP far */ + a1->qadresse = a2; +} +# endif + +/* ------------------------------------------------------------------------ */ +# ifdef NEW_WAY +struct PATCH +{ + char qjump; + char qa1, qa2, qa3, qa4; +} ; + +void patch (register struct PATCH *p, int a1, int a2) +{ + p->qjump = 0xEA; /* 90=NOP, EA=JUMP far */ + p->qa1 = a1 & 0xFF; + p->qa2 = (a1 >> 8) & 0xFF; + p->qa3 = a2 & 0xFF; + p->qa4 = (a2 >> 8) & 0xFF; +} +#endif diff --git a/lib/sbr/misc/dirt_002.c b/lib/sbr/misc/dirt_002.c new file mode 100644 index 0000000000000000000000000000000000000000..4d802241b2d3f76082906a4c0d8660e1d4611cc0 --- /dev/null +++ b/lib/sbr/misc/dirt_002.c @@ -0,0 +1,16 @@ +/* + * FILE /usr/sbr/dirt_002.c + * + * 1989 11 04 + * + */ + +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void patch_str (char *p, char *s) +{ + int i; + for (i = 0; i < 5; i++) *p++ = *s++; +} + diff --git a/lib/sbr/misc/dirt_003.c b/lib/sbr/misc/dirt_003.c new file mode 100644 index 0000000000000000000000000000000000000000..4409373ff9a1c732b1fc42fccdf5a57a4c392791 --- /dev/null +++ b/lib/sbr/misc/dirt_003.c @@ -0,0 +1,17 @@ +/* + * FILE /usr/sbr/dirt_003.c + * + * 1989 11 04 + * + */ + +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +get_patch (char *p, char *s) +{ + int i; + + for (i = 0; i < 5; i++) *s++ = *p++; +} + diff --git a/lib/sbr/misc/dirt_004.c b/lib/sbr/misc/dirt_004.c new file mode 100644 index 0000000000000000000000000000000000000000..886df26623517ccec31299f36c573b02121c943e --- /dev/null +++ b/lib/sbr/misc/dirt_004.c @@ -0,0 +1,14 @@ +/* + * FILE /usr/sbr/dirt_004.c + * + * 1989 11 04 + * + */ + +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +int peekb (char far *p) +{ + return *p & 0x00FF; +} diff --git a/lib/sbr/misc/dirt_005.c b/lib/sbr/misc/dirt_005.c new file mode 100644 index 0000000000000000000000000000000000000000..b8a22735bf296fa21676032a78dfbac46b2bfc52 --- /dev/null +++ b/lib/sbr/misc/dirt_005.c @@ -0,0 +1,15 @@ +/* + * FILE /usr/sbr/dirt_005.c + * + * 1989 11 04 + * + */ + +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void pokeb (char far *p, char b) +{ + *p = b; +} + diff --git a/lib/sbr/misc/dirt_006.c b/lib/sbr/misc/dirt_006.c new file mode 100644 index 0000000000000000000000000000000000000000..4bde58dcd8c59684e76cc09efaf571db8dd5f80f --- /dev/null +++ b/lib/sbr/misc/dirt_006.c @@ -0,0 +1,36 @@ +/* + * FILE ~/usr/sbr/dirt_006.c + * + * written: 1989 11 04 + * latest update: 1994-06-01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dirty.h> + +#define char_or_dot(x) (((x) >= 0x20 && (x) <= 0x7e) ? (x) : '.') + +/* ------------------------------------------------------------------------ */ +void dump (FILE *fo, char *x, int cnt) +{ + int i; + int b; + int off= 0; + + for (; cnt > 0; cnt -= 16) + { + b= (cnt > 16) ? 16 : cnt; + fprintf (fo, "%04X: ", off); + for (i=0; i< b; i++) fprintf (fo, "%02X ", x[i] & 0x00FF); + for ( ; i< 16; i++) fprintf (fo, " "); + for (i=0; i< b; i++) fprintf (fo, "%c", char_or_dot (x[i])); + fprintf (fo, "\n"); + x= &x[16]; + off += 16; + } +} diff --git a/lib/sbr/misc/dirt_006.o b/lib/sbr/misc/dirt_006.o new file mode 100644 index 0000000000000000000000000000000000000000..846a51f38e568c6d6487db607cee068f760f7f9e Binary files /dev/null and b/lib/sbr/misc/dirt_006.o differ diff --git a/lib/sbr/misc/dirt_007.c b/lib/sbr/misc/dirt_007.c new file mode 100644 index 0000000000000000000000000000000000000000..4a5941ee2e7ed6201fc0ca15e42e35072e9b4d32 --- /dev/null +++ b/lib/sbr/misc/dirt_007.c @@ -0,0 +1,14 @@ +/* + * FILE /usr/sbr/dirt_007.c + * + * 1990 01 02 + * + */ + +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void set_cp (char **c1, char *c2) +{ + *c1=c2; +} diff --git a/lib/sbr/misc/dirt_008.c b/lib/sbr/misc/dirt_008.c new file mode 100644 index 0000000000000000000000000000000000000000..9736739518ff9680e4db05cd0d106c9be4dc14c6 --- /dev/null +++ b/lib/sbr/misc/dirt_008.c @@ -0,0 +1,19 @@ +/* + * FILE ~/usr/sbr/dirt_008.c + * + * written: 1990 04 13 + * latest update: 1994-12-11 + * + */ + +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void flip_int (char *v) +{ + int x; + + x= v[0]; + v[0]= v[1]; + v[1]= x; +} diff --git a/lib/sbr/misc/dirt_009.c b/lib/sbr/misc/dirt_009.c new file mode 100644 index 0000000000000000000000000000000000000000..3d9a657d332d77ae70fc4bcc002b1f0b4b42726f --- /dev/null +++ b/lib/sbr/misc/dirt_009.c @@ -0,0 +1,23 @@ +/* + * FILE ~/usr/sbr/dirt_009.c + * + * written: 1990 04 13 + * latest update: 1995-02-12 + * + */ + +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void flip_long (char *v) +{ + int x; + + x = v[0]; + v[0] = v[3]; + v[3] = x; + + x = v[1]; + v[1] = v[2]; + v[2] = x; +} diff --git a/lib/sbr/misc/dirt_010.c b/lib/sbr/misc/dirt_010.c new file mode 100644 index 0000000000000000000000000000000000000000..1f57df006b7dd66b211dedb0e24684031c9f65d2 --- /dev/null +++ b/lib/sbr/misc/dirt_010.c @@ -0,0 +1,21 @@ +/* + * FILE /usr/sbr/dirt_010.c + * + * 1990 04 13 + */ + +# pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void flip_long_2 (char *v) +{ + int x; + + x = v[0]; + v[0] = v[2]; + v[2] = x; + + x = v[1]; + v[1] = v[3]; + v[3] = x; +} diff --git a/lib/sbr/misc/dirt_011.c b/lib/sbr/misc/dirt_011.c new file mode 100644 index 0000000000000000000000000000000000000000..aed59904335b20a1e07e7070ebc5a3feb19167eb --- /dev/null +++ b/lib/sbr/misc/dirt_011.c @@ -0,0 +1,17 @@ +/* + * FILE %sbr/dirt_011.c + * + * written: 1990 04 12 + * latest update: 1995-10-26 + * + */ + +#pragma check_stack(off) + +#include <gg/dirty.h> + +/* ------------------------------------------------------------------------ */ +int VAL (char *f, int s) +{ + return (f [s] & 0x00FF)* 256 + (f [s+1] & 0x00FF); +} diff --git a/lib/sbr/misc/dirt_012.c b/lib/sbr/misc/dirt_012.c new file mode 100644 index 0000000000000000000000000000000000000000..066ec4354e29b4c326f63649ed795a39503148ed --- /dev/null +++ b/lib/sbr/misc/dirt_012.c @@ -0,0 +1,97 @@ +/* + * FILE %sbr/dirt_012.c + * + * written: 1994-03-12 + * latest update: 1997-04-05 18:46:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dirty.h> + +#define TLT_NONE + +#ifdef TLT_INT +#define dump_fnc dump_file_tlti +#define ttype int +#define MASK 0x00FF +#undef TLT_NONE +#endif + +#ifdef TLT_LONG +#define dump_fnc dump_file_tltl +#define ttype long +#define MASK 0x00FFL +#undef TLT_NONE +#endif + +#ifdef TLT_NONE +#define dump_fnc dump_file +#endif + +/* ------------------------------------------------------------------------ */ +void dump_fnc ( +FILE *fo, +FILE *fi, +long cnt, +int do_flush +#ifndef TLT_NONE +, ttype *tbl +#endif /* TLT_NONE */ +) +{ + int i; + int b; + int x[16]; + long off= 0; +#ifndef TLT_NONE + int ch; +#endif /* TLT_NONE */ + + for (; cnt > 0L; cnt -= 16L) + { + b= (cnt > 16L) ? 16 : ((int) cnt); + + fprintf (fo, "%08lX: ", off); + for (i= 0; i< b; i++) + { + x[i]= fgetc (fi) & 0x00FF; + if (feof (fi)) + { + b= i; + break; + } + fprintf (fo, "%02X ", x[i] & 0x00FF); + } + + for ( ; i < 16; i++) fputs (" ", fo); + for (i= 0; i < b; i++) fprintf (fo, "%c", char_or_dot (x[i])); + +#ifndef TLT_NONE + if (tbl != (ttype *) 0) + { + fputc ('|', fo); + for (i= 0; i < b; i++) + { + ch= x[i] & 0x00FF; + ch= (int) (tbl[ch] & MASK); + fprintf (fo, "%c", char_or_dot (ch)); + } + } +#endif /* !TLT_NONE */ + + fputc ('\n', fo); + if (do_flush) fflush (fo); + off += 16L; + + if (feof (fi)) + { + fflush (fo); + break; + } + } +} diff --git a/lib/sbr/misc/dirt_012.o b/lib/sbr/misc/dirt_012.o new file mode 100644 index 0000000000000000000000000000000000000000..89806b563d6c587a51f2ba62fb0a8a71b3d01624 Binary files /dev/null and b/lib/sbr/misc/dirt_012.o differ diff --git a/lib/sbr/misc/dirt_013.c b/lib/sbr/misc/dirt_013.c new file mode 100644 index 0000000000000000000000000000000000000000..740f8788fe81dc649c92f62179a5ac8804d41ce8 --- /dev/null +++ b/lib/sbr/misc/dirt_013.c @@ -0,0 +1,79 @@ +/* + * FILE %sbr/dirt_013.c + * + * written: 1984-05-11 + * latest update: 1997-04-05 18:07:46 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dirty.h> + +#define TLT_NONE + +#ifdef TLT_INT +#define dump_fnc dump_str_tlti +#define ttype int +#define MASK 0x00FF +#undef TLT_NONE +#endif + +#ifdef TLT_LONG +#define dump_fnc dump_str_tltl +#define ttype long +#define MASK 0x00FFL +#undef TLT_NONE +#endif + +#ifdef TLT_NONE +#define dump_fnc dump_str +#endif /* !TLT_NONE */ + +/* ------------------------------------------------------------------------ */ +void dump_fnc ( +FILE *fo, +char *x, +int cnt +#ifndef TLT_NONE +, ttype *tbl +#endif /* TLT_NONE */ +) +{ + int off= 0; + int i; + int b; +#ifndef TLT_NONE + int ch; +#endif /* TLT_NONE */ + + for (; cnt > 0; cnt -= 16) + { + b= (cnt > 16) ? 16 : cnt; + fprintf (fo, "%04X: ", off); + for (i=0; i< b; i++) fprintf (fo, "%02X ", x[i] & 0x00FF); + for ( ; i< 16; i++) fputs (" ", fo); + for (i=0; i< b; i++) fprintf (fo, "%c", char_or_dot (x[i])); + for ( ; i< 16; i++) fputc (' ', fo); + +#ifndef TLT_NONE + if (tbl != (ttype *) 0) + { + fputc ('|', fo); + for (i= 0; i < b; i++) + { + ch= x[i] & 0x00FF; + ch= (int) (tbl[ch] & MASK); + fprintf (fo, "%c", char_or_dot (ch)); + } + } +#endif /* !TLT_NONE */ + + fputc ('\n', fo); + x += 16; + off += 16; + } +} diff --git a/lib/sbr/misc/dirt_013.o b/lib/sbr/misc/dirt_013.o new file mode 100644 index 0000000000000000000000000000000000000000..ae2b418884faa51dc709bb6796d668febce903f9 Binary files /dev/null and b/lib/sbr/misc/dirt_013.o differ diff --git a/lib/sbr/misc/dirt_014.c b/lib/sbr/misc/dirt_014.c new file mode 100644 index 0000000000000000000000000000000000000000..44d1f3bc8ea4311bff401c80b9de94e5f5a0a2f1 --- /dev/null +++ b/lib/sbr/misc/dirt_014.c @@ -0,0 +1,51 @@ +/* + * FILE %sbr/dirt_014.c + * + * print an array of integers in C format + * + * written: 1995-08-30 + * latest update: 1997-08-15 21:27:59 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dirty.h> + +#define NUM_ENTRIES 16 + +#ifdef DTYPE_int +#define DTYPE int +#define FMT1 "%3d," +#define FMT2 "%3d" +#define fnc print_int_table +#endif + +#ifdef DTYPE_long +#define DTYPE long +#define FMT1 "%3ld," +#define FMT2 "%3ld" +#define fnc print_long_table +#endif + +/* ------------------------------------------------------------------------ */ +int fnc (FILE *fo, DTYPE *cpi, int num) +{ + int i; + + num--; + fputs ("{\n ", fo); + for (i= 0; i < num; i++) + { + fprintf (fo, FMT1, *cpi++); + if ((i % NUM_ENTRIES) == NUM_ENTRIES-1) fputs ("\n ", fo); + } + + fprintf (fo, FMT2, *cpi); + fputs ("\n} ;\n\n", fo); + + return 0; +} diff --git a/lib/sbr/misc/dirt_016.c b/lib/sbr/misc/dirt_016.c new file mode 100644 index 0000000000000000000000000000000000000000..8cde5b7af2165980634120be89538067102f3748 --- /dev/null +++ b/lib/sbr/misc/dirt_016.c @@ -0,0 +1,117 @@ +/* + * FILE %sbr/dirt_016.c + * + * print an array of integers in various formats + * + * BUG: some sections always print 256 byte tables! + * + * written: 1997-08-15 + * latest update: 1997-08-15 22:23:22 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <gg/dirty.h> + +#define NUM_ENTRIES 16 + +#ifdef DTYPE_int +#define DTYPE int +#define FMT1 "/*0x%02X*/ 0x%08X%s" +#define fnc print_int_table2 +#endif + +#ifdef DTYPE_long +#define DTYPE long +#define FMT1 "/*0x%02X*/ 0x%08lX%s" +#define fnc print_long_table2 +#endif + +/* ------------------------------------------------------------------------ */ +int fnc (FILE *ft, int write_mode, DTYPE *converter_table, int num) +{ + int i, j, code; + + if (ft == (FILE *) 0) return -1; + + switch (write_mode) + { + case WRITE_MODE_C: + fprintf (ft, "{ \n"); + for (i= 0; i < num; i++) + { + fprintf (ft, FMT1, + i, + converter_table [i], + ((code == num) ? "" : ",")); + if ((i % 4) == 3) fputs ("\n ", ft); + } + fputs ("}\n", ft); + break; + + case WRITE_MODE_rexx: + for (i= 0; i < 16; i++) + { + fprintf (ft, " \'"); + for (j= 0; j < 16; j++) + { + code= i*16+j; + fprintf (ft, "%02X", ((int) converter_table[code]) & 0x00FF); + } + if (i == 15) + fprintf (ft, "\'x"); + else fprintf (ft, "\'x||,\n"); + } + if (write_mode == WRITE_MODE_REXX) fprintf (ft, ")"); + fprintf (ft, ";\n"); + break; + + case WRITE_MODE_PERL: + { + int last_code= -1; + int current_code; + int range= 0; + + fprintf (ft, "tr(\\x00-\\xff)\n(\n"); + for (i= 0; i < 16; i++) + { + fprintf (ft, " "); + for (j= 0; j < 16; j++) + { + code= i*16+j; + current_code= ((int) converter_table[code]) & 0x00FF; + fprintf (ft, "\\x%02X", current_code); + } + fprintf (ft, "\n"); + } + fprintf (ft, ");"); + } + break; + + case WRITE_MODE_ASSEMBLE: + for (i= 0; i < 16; i++) + { + fprintf (ft, " DC X\'"); + for (j= 0; j < 16; j++) + { + code= i*16+j; + fprintf (ft, "%02X", ((int) converter_table[code]) & 0x00FF); + } + fprintf (ft, "\'\n"); + } + break; + + case WRITE_MODE_binary: + /* not implemented yet!!! ####*/ + break; + + default: + return -1; + } + + return 0; +} diff --git a/lib/sbr/misc/dirt_i12.o b/lib/sbr/misc/dirt_i12.o new file mode 100644 index 0000000000000000000000000000000000000000..ba96681c1f415be05b831e49e88c83be66d9cd41 Binary files /dev/null and b/lib/sbr/misc/dirt_i12.o differ diff --git a/lib/sbr/misc/dirt_i13.o b/lib/sbr/misc/dirt_i13.o new file mode 100644 index 0000000000000000000000000000000000000000..bc3a0bafcbfbc50478a87990f107909da87db8b9 Binary files /dev/null and b/lib/sbr/misc/dirt_i13.o differ diff --git a/lib/sbr/misc/dirt_i14.o b/lib/sbr/misc/dirt_i14.o new file mode 100644 index 0000000000000000000000000000000000000000..41083d6bb176ab1766ba9ab2712d5351758c1bf7 Binary files /dev/null and b/lib/sbr/misc/dirt_i14.o differ diff --git a/lib/sbr/misc/dirt_i16.o b/lib/sbr/misc/dirt_i16.o new file mode 100644 index 0000000000000000000000000000000000000000..d8dbbae6ab87216df75333766bed3b4153bf446a Binary files /dev/null and b/lib/sbr/misc/dirt_i16.o differ diff --git a/lib/sbr/misc/dirt_l12.o b/lib/sbr/misc/dirt_l12.o new file mode 100644 index 0000000000000000000000000000000000000000..b66a39010190f152558ef20764cf2087ca985676 Binary files /dev/null and b/lib/sbr/misc/dirt_l12.o differ diff --git a/lib/sbr/misc/dirt_l13.o b/lib/sbr/misc/dirt_l13.o new file mode 100644 index 0000000000000000000000000000000000000000..ee6239bda66937b41ee8b77a151d6fbd395956ae Binary files /dev/null and b/lib/sbr/misc/dirt_l13.o differ diff --git a/lib/sbr/misc/dirt_l14.o b/lib/sbr/misc/dirt_l14.o new file mode 100644 index 0000000000000000000000000000000000000000..a1ad96918ec33d41f6d93677b2e0c5a87e0673a5 Binary files /dev/null and b/lib/sbr/misc/dirt_l14.o differ diff --git a/lib/sbr/misc/dirt_l16.o b/lib/sbr/misc/dirt_l16.o new file mode 100644 index 0000000000000000000000000000000000000000..8aa6224c5270f8cfc53a70594b08654c1b03ccab Binary files /dev/null and b/lib/sbr/misc/dirt_l16.o differ diff --git a/lib/sbr/misc/dpp_0001.c b/lib/sbr/misc/dpp_0001.c new file mode 100644 index 0000000000000000000000000000000000000000..f4f07832b001bd370f5604d35db69f6ed6340f89 --- /dev/null +++ b/lib/sbr/misc/dpp_0001.c @@ -0,0 +1,39 @@ +/* + * FILE %sbr/dpp_0001.c + * + * Funktionen zum Durchsuchen von LUT-Woerterb�chern + * + * written: 1989 06 11: aus WORDCR01.C isolierte Funktionen: + * check_word -> lookup_char + * check_word_file -> lookup_file + * 1990 01 20: zerlegt in Library-Module + * 1991 03 15: Revision; AIX + * 1991 12 11: mv %nl_kr/lib/lut_0005.c -> %sbr/dpp_0001.c + * latest update: 1995-07-02 + * $Id: dpp_0001.c,v 1.2 2003/06/25 14:38:29 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/dpp.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long dpp_fread_long (FILE *fi, int bytes) +{ + long v; + int i; + + v= 0L; + + for (i= 0; i < bytes; i++) + { + v= v*256L + ((long) (fgetc (fi) & 0x00FF)); + if (feof (fi)) return 0L; + } + + return v; +} diff --git a/lib/sbr/misc/dpp_0001.o b/lib/sbr/misc/dpp_0001.o new file mode 100644 index 0000000000000000000000000000000000000000..82b764a9a6e6874c19322c0878a4fb799246d18b Binary files /dev/null and b/lib/sbr/misc/dpp_0001.o differ diff --git a/lib/sbr/misc/dpp_0002.c b/lib/sbr/misc/dpp_0002.c new file mode 100644 index 0000000000000000000000000000000000000000..1f11cab7da6eb886b224bf3ec34eb7c5e711d03d --- /dev/null +++ b/lib/sbr/misc/dpp_0002.c @@ -0,0 +1,38 @@ +/* + * FILE %sbr/dpp_0002.c + * + * Funktionen zum Durchsuchen von LUT-Woerterb�chern + * + * written: 1989 06 11: aus WORDCR01.C isolierte Funktionen: + * check_word -> lookup_char + * check_word_file -> lookup_file + * 1990 01 20: zerlegt in Library-Module + * 1991 03 15: Revision; AIX + * 1991 12 11: rename /usr/nl_kr/lib/lut_0006.c + * to /usr/sbr/dpp_0002.c + * latest update: 1996-04-27 12:32:05 + * $Id: dpp_0002.c,v 1.2 2005/09/04 20:27:37 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/dpp.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int dpp_fwrite_long (FILE *fo, long val, int bytes) +{ + int i; + unsigned char b[4]; + + for (i= 3; i>=0; i--) + { + b[i]= (char) (val & 0x000000FFL); + val= val >> 8; + } + + return fwrite (&b[4-bytes], bytes, 1, fo); +} diff --git a/lib/sbr/misc/dpp_0002.o b/lib/sbr/misc/dpp_0002.o new file mode 100644 index 0000000000000000000000000000000000000000..fb17673847a0cbe2e0511d03e1a53e41d0b9bd50 Binary files /dev/null and b/lib/sbr/misc/dpp_0002.o differ diff --git a/lib/sbr/misc/dpp_0003.c b/lib/sbr/misc/dpp_0003.c new file mode 100644 index 0000000000000000000000000000000000000000..98f9ab4c0d8b7772c78971b16bbcdc5d75133736 --- /dev/null +++ b/lib/sbr/misc/dpp_0003.c @@ -0,0 +1,37 @@ +/* + * FILE /usr/dpp/dpp_0003.c + * + * Funktionen zum Durchsuchen von LUT-Woerterb�chern + * + * 1989 06 11: aus WORDCR01.C isolierte Funktionen: + * check_word -> lookup_char + * check_word_file -> lookup_file + * 1990 01 20: zerlegt in Library-Module + * 1991 03 15: Revision; AIX + * 1991 12 11: rename /usr/nl_kr/lib/lut_0003.c -> /usr/sbr/dpp_0003.c + * $Id: dpp_0003.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#include <gg/dpp.h> + +#ifdef MSDOS +# pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long dpp_get_long (const char *buf, int bytes) +{ + long v; + int i; + + v=0L; + + for (i=0;i<bytes;i++) + { + v = v*256L + ((long) (buf [i] & 0x00FF)); + } + + return v; +} + diff --git a/lib/sbr/misc/dpp_0003.o b/lib/sbr/misc/dpp_0003.o new file mode 100644 index 0000000000000000000000000000000000000000..724d84a07d6c87cdc9146b950964bbdc0771d370 Binary files /dev/null and b/lib/sbr/misc/dpp_0003.o differ diff --git a/lib/sbr/misc/dpp_0004.c b/lib/sbr/misc/dpp_0004.c new file mode 100644 index 0000000000000000000000000000000000000000..c5588823535c7a339d4607b7ef3b94914ed27825 --- /dev/null +++ b/lib/sbr/misc/dpp_0004.c @@ -0,0 +1,31 @@ +/* + * FILE ~/usr/sbr/dpp_0004.c + * + * written: 1990 01 20: aus NED00.C ausgelagert + * 1991 01 29: Revision + * 1994-05-27: was: ned0317.c + * latest update: 1994-11-13 + * $Id: dpp_0004.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int ARGDeval ( +const char *s, /* Evaluierungsstring */ +int o, /* Offset */ +int c, /* Stellenzahl */ +int b, /* Basis */ +int d) /* Defaultwert <<<<<< */ +{ + int i; + + for (i= 0; i <= o; i++) if (!s [i]) return d; + + return ARGeval (s, o, c, b); +} diff --git a/lib/sbr/misc/dpp_0005.c b/lib/sbr/misc/dpp_0005.c new file mode 100644 index 0000000000000000000000000000000000000000..c57f396944564228c8fac33f13d0933066153e23 --- /dev/null +++ b/lib/sbr/misc/dpp_0005.c @@ -0,0 +1,43 @@ +/* + * FILE %sbr/dpp_0005.c + * + * written: 1990 01 20: aus NED00.C ausgelagert + * 1991 01 29: Revision + * latest update: 1996-01-31 22:11:11 + * $Id: dpp_0005.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int ARGeval ( +const char *s, /* Evaluierungsstring */ +int o, /* Offset */ +int c, /* Stellenzahl */ +int b) /* Basis */ +{ + int v = 0, i, ch; + + for (i = 0; i < c; i++) + { + if (!(ch = s [i+o])) break; + if (ch >= '0' && ch <= '9') + v= b*v + ch - '0'; + else + if (b > 10) + { + if (ch >= 'a' && ch <= 'z') /* !!!!!! */ + v = b*v + ch - 'a' + 10; + else + if (ch >= 'A' && ch <= 'Z') + v = b*v + ch - 'A' + 10; + } + } + + return v; +} diff --git a/lib/sbr/misc/dpp_0005.o b/lib/sbr/misc/dpp_0005.o new file mode 100644 index 0000000000000000000000000000000000000000..50ed287907618fe088f0e60fcef0562f7cf6b4d1 Binary files /dev/null and b/lib/sbr/misc/dpp_0005.o differ diff --git a/lib/sbr/misc/dpp_0006.c b/lib/sbr/misc/dpp_0006.c new file mode 100644 index 0000000000000000000000000000000000000000..665f83468e1930fae75da06f7d8db85a90dab1dd --- /dev/null +++ b/lib/sbr/misc/dpp_0006.c @@ -0,0 +1,47 @@ +/* + * FILE %sbr/dpp_0006.c + * + * written: 1994-05-27 + * latest update: 1996-11-26 20:58:01 + * $Id: dpp_0006.c,v 1.2 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int ARG_long_eval ( +const char *s, /* Evaluierungsstring */ +int o, /* Offset */ +int c, /* Stellenzahl */ +int b, /* Basis */ +long *val) /* Ergebnis in LONG */ +/* RETURN: 0 -> Fehler */ +/* 1 -> OK */ +{ + long v= 0; + int i; + int ch; + + for (i= 0; i <= o; i++) if (!s [i]) return 0; + + for (i = 0; i < c; i++) + { + if (!(ch= s [i+o])) break; + if (ch >= '0' && ch <= '9') + v= ((long) b)*v + ((long) (ch - '0')); else + if (b > 10) + if (ch >= 'a' && ch <= 'z') /* !!!!!! */ + v= ((long) b)*v + ((long) (ch - 'a' + 10)); else + if (ch >= 'A' && ch <= 'Z') + v= ((long) b)*v + ((long) (ch - 'A' + 10)); + } + + *val= v; + + return 1; +} diff --git a/lib/sbr/misc/dpp_0006.o b/lib/sbr/misc/dpp_0006.o new file mode 100644 index 0000000000000000000000000000000000000000..501751264cb2bc1527b0b48e16e4580eddd40437 Binary files /dev/null and b/lib/sbr/misc/dpp_0006.o differ diff --git a/lib/sbr/misc/dpp_0007.c b/lib/sbr/misc/dpp_0007.c new file mode 100644 index 0000000000000000000000000000000000000000..03549baf3603e090969c4e84ea922b005361ac4f --- /dev/null +++ b/lib/sbr/misc/dpp_0007.c @@ -0,0 +1,24 @@ +/* + * FILE %sbr/dpp_0007.c + * + * written: 1996-11-26 + * latest update: 1996-11-26 20:58:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int msdos_get_int (char *s) +{ + int v1, v2; + + v1= *s++ & 0x00FF; + v2= *s & 0x00FF; + + return v2*256 + v1; +} diff --git a/lib/sbr/misc/dpp_0007.o b/lib/sbr/misc/dpp_0007.o new file mode 100644 index 0000000000000000000000000000000000000000..285d2316d5dcbb72394561e914f76b3b70e12113 Binary files /dev/null and b/lib/sbr/misc/dpp_0007.o differ diff --git a/lib/sbr/misc/dpp_0008.c b/lib/sbr/misc/dpp_0008.c new file mode 100644 index 0000000000000000000000000000000000000000..0747a62f265a179f7c96ba573f883ef63b5184f0 --- /dev/null +++ b/lib/sbr/misc/dpp_0008.c @@ -0,0 +1,26 @@ +/* + * FILE %sbr/dpp_0008.c + * + * written: 1996-11-26 + * latest update: 1996-11-26 20:58:01 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +long msdos_get_long (char *s) +{ + int v1, v2, v3, v4; + + v1= *s++ & 0x00FF; + v2= *s++ & 0x00FF; + v3= *s++ & 0x00FF; + v4= *s & 0x00FF; + + return ((v4*256 + v3)*256 + v2)*256 + v1; +} diff --git a/lib/sbr/misc/dpp_0008.o b/lib/sbr/misc/dpp_0008.o new file mode 100644 index 0000000000000000000000000000000000000000..ca1ce752d329a72a20fd3f9d32c9278c0d3c3e3a Binary files /dev/null and b/lib/sbr/misc/dpp_0008.o differ diff --git a/lib/sbr/misc/dsklscrd.asm b/lib/sbr/misc/dsklscrd.asm new file mode 100644 index 0000000000000000000000000000000000000000..54fdf1123c4d27adb6e33aca4a39d18b6c2292e3 --- /dev/null +++ b/lib/sbr/misc/dsklscrd.asm @@ -0,0 +1,73 @@ +; +; FILE ~/usr/sbr/sectrd_l.asm +; +; *********** +; LARGE MODEL +; *********** +; +; Lesen eines Sectors +; +; written: 1991 06 22 +; latest update: 1994-10-02 +; + + TITLE sector_read + + +DISK_TEXT SEGMENT BYTE PUBLIC 'CODE' +DISK_TEXT ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: DISK_TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP +PUBLIC _sector_read + +DISK_TEXT SEGMENT +; LARGE MODEL: +; 6 ... Offset Puffer +; 8 ... Segment Puffer +; 10 ... Drive Number +; 12 ... Head Number +; 14 ... Track Number +; 16 ... Sector Number + PUBLIC _sector_read +_sector_read PROC far + push bp + mov bp,sp + push es + push cx + push bx + push dx + + mov bx, [bp+6] ; data buffer + mov es, [bp+8] + mov ax, [bp+10] ; drive number + mov dl, al + mov ax, [bp+12] ; head number + mov dh, al + mov ax, [bp+16] ; sector number + mov cl, al + mov ax, [bp+14] ; track number + mov ch, al + shr ax, 1 + shr ax, 1 + and al, 0C0h + or cl, al ; upper 2 bits of track number + mov ax, 0201h ; command: read one sector + int 013h + + pop dx + pop bx + pop cx + pop es + mov sp,bp + pop bp + ret +_sector_read ENDP + +DISK_TEXT ENDS +END diff --git a/lib/sbr/misc/ebcasc.c b/lib/sbr/misc/ebcasc.c new file mode 100644 index 0000000000000000000000000000000000000000..6b8047c98fab114714f93e46d29d4e6bccae1438 --- /dev/null +++ b/lib/sbr/misc/ebcasc.c @@ -0,0 +1,70 @@ +/* + * FILE /usr/sbr/ebcasc.c + * + * Umwandlung von EBCDIC nach ASCII + * + * 1988 12 13 + * 1990 06 02: Revision + * + */ + +#include <stdio.h> +#include <io.h> +#include <gg/ebcasc.h> +#include <gg/filename.h> + +#pragma check_stack(off) + +static char table_name [66]; +static char EBCDIC_ASCII_Table [256]; + +static int module_initialized=0; + +/* initialize the module: ------------------------------------------------- */ +int EBCDIC_ASCII_INIT () +{ + FILE *fi; + + if (access (table_name, 0) != 0) return -1; + + module_initialized=1; + set_etc_filename (table_name, TABLE_NAME); + fi = fopen (table_name, "rb"); + fread (EBCDIC_ASCII_Table, 1, 256, fi); + fclose (fi); + + return 0; +} + +/* convert a block of characters: ----------------------------------------- */ +int EBCDIC_ASCII_convert (char p[], int start, int lng) +{ + int i,j; + + if (! module_initialized) + { + if (EBCDIC_ASCII_INIT () < 0) return -1; + } + + for (i=start; lng > 0; lng--) + { + p [i] = (EBCDIC_ASCII_Table [j = (p[i] & 0x00FF)]) & 0x00FF; +/************ + printf ("Convert %3d: %02X -> %02X\n", i, j, p[i]); +************/ + i++; + } + + return 0; +} + +/* convert one character: ------------------------------------------------- */ +int EBCDIC_ASCII_char_convert (int ch) +{ + if (! module_initialized) + { + if (EBCDIC_ASCII_INIT () < 0) return -1; + } + + return (EBCDIC_ASCII_Table [ch & 0x00FF]) & 0x00FF; +} diff --git a/lib/sbr/misc/envbinsr.c b/lib/sbr/misc/envbinsr.c new file mode 100644 index 0000000000000000000000000000000000000000..a9678dfa34860e428fcaf5c6eafd6f05d217e0e3 --- /dev/null +++ b/lib/sbr/misc/envbinsr.c @@ -0,0 +1,68 @@ +/* + * FILE ~/usr/sbr/envbinsr.c + * + * env_bin_search: find a file following an environment variable + * + * written: 1994-08-13: variation of env_file_search (envfilsr.c) + * latest update: 1999-04-25 17:00:01 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/filename.h> +#include <gg/strings.h> + +#ifdef MSDOS +#pragma check_stack(off) +#include <io.h> +#else +#include <unistd.h> +#endif + +#ifndef NIL +#define NIL (void *) 0 +#endif + +/* ------------------------------------------------------------------------ */ +char *env_bin_search (char *fn, char *env, char *ext [], int n_ext) +{ + char tmp [66]; + char *envv; + int i; + int j; + int l; + + if (fn == (char *) 0 + || *fn == 0 + || env == (char *) 0 + || *env == 0 + || (envv= getenv (env)) == (char *) 0) + return (char *) 0; + + while (*envv) + { + for (i= 0; envv[i]; i++) + if (envv [i] == ';') break; + + if (i+strlen(fn)+1 < 66) + { + strncpy (tmp, envv, i); + tmp [i]= '\\'; + strcpy (&tmp [i + ((tmp [i-1] == '\\' || tmp [i-1] == '/') + ? 0 : 1)], fn); + l= strlen (tmp); + for (j= 0; j<n_ext; j++) + { + strcpy (tmp+l, ext [j]); + if (access (tmp, 0) == 0) return strdup (tmp); + } + } + envv= &envv[i]; + if (*envv == 0) break; + envv++; + } + + return (char *) 0; +} diff --git a/lib/sbr/misc/envfilsr.c b/lib/sbr/misc/envfilsr.c new file mode 100644 index 0000000000000000000000000000000000000000..c2c3ed881810abb98d5647b12670a97a0693ea9e --- /dev/null +++ b/lib/sbr/misc/envfilsr.c @@ -0,0 +1,69 @@ +/* + * FILE ~/usr/sbr/envfilsr.c + * + * env_file_search: find a file following an environment variable + * + * written: 1992 02 08 + * latest update: 1999-04-25 17:00:11 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/filename.h> +#include <gg/strings.h> + +#ifdef MSDOS +#pragma check_stack(off) +#include <io.h> +#define PATH_SEP '\\' +#define PATH_ENV_SEP ';' +#else +#include <unistd.h> +#define PATH_SEP '/' +#define PATH_ENV_SEP ':' +#endif + +#ifndef NIL +#define NIL (void *) 0 +#endif + +/* ------------------------------------------------------------------------ */ +char *env_file_search (char *fn, char *env) +{ + char tmp [66]; + char *envv; + int i; + + if (fn == (char *) 0 + || *fn == 0 + || env == (char *) 0 + || *env == 0 + || (envv= getenv (env)) == (char *) 0) + return (char *) 0; + + while (*envv) + { + for (i= 0; envv[i]; i++) + if (envv [i] == PATH_ENV_SEP) break; + + if (i+strlen (fn)+1 < 66) + { + strncpy (tmp, envv, i); + tmp [i]= PATH_SEP; +#ifdef MSDOS + strcpy (&tmp[i + ((tmp [i-1] == '/' || tmp [i-1] == '\\') ? 0 :1)], fn); +#else + strcpy (&tmp[i + ((tmp [i-1] == '/') ? 0 : 1)], fn); +#endif + if (access (tmp, 0) == 0) return strdup (tmp); + } + + envv= &envv [i]; + if (*envv == 0) break; + envv++; + } + + return (char *) 0; +} diff --git a/lib/sbr/misc/envfilsr.o b/lib/sbr/misc/envfilsr.o new file mode 100644 index 0000000000000000000000000000000000000000..afce692c0b19f4f828b78c8575254bd9fbcd2a1f Binary files /dev/null and b/lib/sbr/misc/envfilsr.o differ diff --git a/lib/sbr/misc/extcmp.c b/lib/sbr/misc/extcmp.c new file mode 100644 index 0000000000000000000000000000000000000000..185b19f8ce115360aae24ed0541334dc78d00e94 --- /dev/null +++ b/lib/sbr/misc/extcmp.c @@ -0,0 +1,56 @@ +/* + * FILE ~/usr/sbr/extcmp.c + * + * compare two filenames by their extensions + * Zwei Files nach Extensions vergleichen + * + * written: 1991 12 07: aus fmw.c isoliert + * latest update: 1994-08-13 + * + */ + +#include <string.h> +#include <gg/filename.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int extcmp (char *s1, char *s2) +{ + int i1, i2; + int p= 0; /* flags: bit 0: s1 has an extension */ + /* bit 1: s2 has an extension */ + + for (i1= 0; s1 [i1]; i1++) + if (s1 [i1] == '.') + { + p |= 0x01; + break; + } + + for (i2= 0; s2 [i2]; i2++) + if (s2 [i2] == '.') + { + p |= 0x02; + break; + } + + /* Moeglichkeiten: - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + /* 0: beide Filenamen ohne Extension: dann nach Filenamen */ + /* 1, 2: Ein Filename von Ohne Extension: dann gelte */ + /* (Filename OHNE Extension) > (Filename MIT Extension) */ + /* 3: beide Filenamen mit Extenstion */ + /* Falls Extenstions geleich, dann nach Filenamen */ + switch (p) + { + case 1: return 1; + case 2: return -1; + case 3: + if ((p= strcmp (&s1 [i1], &s2 [i2])) != 0) return p; + } + + /* case 0: */ + return strcmp (s1, s2); +} diff --git a/lib/sbr/misc/fclosec.c b/lib/sbr/misc/fclosec.c new file mode 100644 index 0000000000000000000000000000000000000000..13a088b399e43f0eee91b8456fa5e0c3c267c9c4 --- /dev/null +++ b/lib/sbr/misc/fclosec.c @@ -0,0 +1,17 @@ +/* + * FILE %sbr/fclosec.c + * + * written: 1995-11-05 + * latest update: 1995-11-05 + * + */ + +#include <stdio.h> +#include <gg/fileio.h> + +/* ------------------------------------------------------------------------ */ +int fclose_or_what (FILE *f) +{ + if (f != (FILE *) 0) fclose (f); + return 0; +} diff --git a/lib/sbr/misc/fclosec.o b/lib/sbr/misc/fclosec.o new file mode 100644 index 0000000000000000000000000000000000000000..7afc586acfa7af68d132067cd944f28a8ab7aa2e Binary files /dev/null and b/lib/sbr/misc/fclosec.o differ diff --git a/lib/sbr/misc/file2buf.c b/lib/sbr/misc/file2buf.c new file mode 100644 index 0000000000000000000000000000000000000000..c6a2a83677b3eab9f592d289570af30f3d797a2a --- /dev/null +++ b/lib/sbr/misc/file2buf.c @@ -0,0 +1,71 @@ +/* + * FILE %sbr/file2buf.c + * + * read a file to buffer + * + * written: 1992-12-27: <Gerhard.Gonter@wu-wien.ac.at> + * latest update: 1995-12-10 + * $Id: file2buf.c,v 1.3 2001/11/20 19:32:46 gonter Exp $ + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/diagnose.h> +#include <gg/fileio.h> + +/* ------------------------------------------------------------------------ */ +long read_file2buffer (char **buffer, char *fnm, long limit) +{ + FILE *fi; + struct stat stat_buf; + char *b; /* handle for *buffer */ + int rc; + long bytes_read; + + if (fnm == (char *) 0 || *fnm == 0) + { + gg_diagnose= EF_not_found; + return -1L; + } + + if ((rc= stat (fnm, &stat_buf)) == -1) + { + gg_diagnose= EF_couldnt_stat; + return -1L; + } + + if (limit <= 0 || stat_buf.st_size > limit) + { + gg_diagnose= EB_size_exceeded; + return -1L; + } + + /* first: see if file can really be read, then allocate the buffer */ + if ((fi= fopen (fnm, "rb")) == (FILE *) 0) + { + gg_diagnose= EF_not_found; + return -1L; + } + + if ((b= *buffer) == (char *) 0) + { + limit= stat_buf.st_size+1; + if ((b= malloc ((int) limit)) == (char *) 0) + { + gg_diagnose= EM_no_memory; + fclose (fi); + return -1L; + } + *buffer= b; + } + + bytes_read= fread (b, 1, (int) stat_buf.st_size, fi); + fclose (fi); + + if (bytes_read < limit) b [limit]= 0; + + return bytes_read; +} diff --git a/lib/sbr/misc/file2buf.o b/lib/sbr/misc/file2buf.o new file mode 100644 index 0000000000000000000000000000000000000000..416a7eb857692d883e1ed4f5be96ac90d324775a Binary files /dev/null and b/lib/sbr/misc/file2buf.o differ diff --git a/lib/sbr/misc/file2low.c b/lib/sbr/misc/file2low.c new file mode 100644 index 0000000000000000000000000000000000000000..c95f62ee55b8c0433b90153ef0b3264d2d20fda5 --- /dev/null +++ b/lib/sbr/misc/file2low.c @@ -0,0 +1,48 @@ +/* + * FILE ~/usr/sbr/file2low.c + * + * written: 1994-12-31: extracted from %usr/utl/tolower.c + * latest update: 1995-08-15 + * + */ + +#include <stdio.h> +#include <gg/strings.h> +#include <gg/fileio.h> + +/* ------------------------------------------------------------------------ */ +#ifdef TO_UPPER +#define FILE_TO_WHATEVER file_to_upper +#define WHATEVER_CASE upper_case +#endif /* TO_UPPER */ + +#ifdef TO_LOWER +#define FILE_TO_WHATEVER file_to_lower +#define WHATEVER_CASE lower_case +#endif /* TO_LOWER */ + +/* ------------------------------------------------------------------------ */ +int FILE_TO_WHATEVER (char *fn, FILE *fo) +{ + FILE *fi; + int ch; + + if ((fi= fopen (fn, "rb")) == (FILE *) 0) + { + fprintf (stderr, "can't open File %s!\n", fn); + return -1; + } + + for (;;) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + if (ch == 0x0D) continue; + ch= WHATEVER_CASE (ch); + fputc (ch, fo); + } + + fclose (fi); + + return 0; +} diff --git a/lib/sbr/misc/file2low.o b/lib/sbr/misc/file2low.o new file mode 100644 index 0000000000000000000000000000000000000000..2ccbba7818835c486a3e9bcf0e97a48cc8ecf53f Binary files /dev/null and b/lib/sbr/misc/file2low.o differ diff --git a/lib/sbr/misc/file2upp.o b/lib/sbr/misc/file2upp.o new file mode 100644 index 0000000000000000000000000000000000000000..24c234dd0c837486c9985814b3927148994e844a Binary files /dev/null and b/lib/sbr/misc/file2upp.o differ diff --git a/lib/sbr/misc/fileio.c b/lib/sbr/misc/fileio.c new file mode 100644 index 0000000000000000000000000000000000000000..c93c99b9481d029e65cd6f86124cfa14aa4219ff --- /dev/null +++ b/lib/sbr/misc/fileio.c @@ -0,0 +1,466 @@ +/* + * FILE ~/usr/sbr/fileio.c + * + * written: 1987 12 15 + * latest update: 1994-08-01 + * + */ + +#include <stdio.h> +#include <string.h> +#include <io.h> +#include <gg/fileio.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +#define NSid 2 + +static char *Sid [NSid] = +{ + "write-empty", + "no-write-empty" +} ; + +/* ------------------------------------------------------------------------ */ +static char **identifier; +static int Nid; +static int flg_write_empty= 0; /* 1 -> leere Daten schreiben */ +static int Slng= 0; /* Laenge der Bearbeiteten Strings */ + +#define N_So 32 +static FILE *ffi, *ffo; +static int last_type; +static char obj [100]; +static char So [N_So]; + +/* ------------------------------------------------------------------------ */ +void set_filemode ( +int num, +int nid, +char *ident [], +int slng) +{ +#ifdef DEBUGx + int i; + + printf ("\n\n&ident=%lx ident=%lx *ident=%lx\n", + &ident, ident, *ident); + + for (i = 0; i < nid; i++) + printf ("Identifier%d [%3d] = %s\n", num, i, ident [i]); +#else +#ifdef MSDOS + num; +#endif +#endif + + Nid = nid; + identifier = ident; + Slng = slng; +} + +/* ------------------------------------------------------------------------ */ +int get_identifier (char *n) +{ + int i; + to_lower (n); + for (i = 0; i < Nid; i++) +#ifdef DEBUG + if (strcmp (identifier [i], n) == 0) + { printf ("Identifier %20s -> %3d\n", + identifier [i], i); + return i; + } +#else + if (strcmp (identifier [i], n) == 0) return i; +#endif + + return -1; +} + +/* ------------------------------------------------------------------------ */ +int get_Sid () +{ + int i; + + to_lower (So); + for (i = 0; i < NSid; i++) + if (strcmp (Sid [i], So) == 0) return i; + return -1; +} + +/* ------------------------------------------------------------------------ */ +int f4fscan ( +FILE *fi, +FILE *fo, +int *objekttyp, /* 0 -> undef; 1 -> Identifier; 2 -> Daten */ +char *objekt, +int flags) /* Bit 0 -> Copy fi -> fo */ + /* 1 -> Copy fi -> fo bis EOF ohne Analyse */ + /* 2 -> Copy fi -> fo Comment */ +/* RETURN: 0 .. OK, -1 .. EOF erreicht */ +{ + int ch, off, state, Soff; + + if (last_type < 0) return -1; + switch (last_type) + { case 1: state = 3; + break; + case 3: state = 4; + break; + default: state = 0; + break; + } + for (off = 0;;) + { ch = fgetc (fi); + if (((flags & 0x03) || + ((flags & 0x04) && state == 1)) && ch != -1) + fputc (ch, fo); +#ifdef DEBUG2 + printf ("SCAN: last_type=%d state=%d off=%3d ch=%02x\n", + last_type, state, off, ch); +#endif +#ifdef DEBUG2 + putchar (ch); +#endif + if (flags & 0x02) + { if (ch == -1) + { last_type = -1; + return -1; + } + } + else + switch (state) + { case 0: /* noch nichts brauchbares vorgekommen */ + if (ch == -1) + { *objekttyp = 0; + last_type = -1; + return -1; + } + if (ch == '#') + { state = 1; + if (flags & 0x04) + fputc ('#', fo); + break; + } + if (ch == '@') + { + state = 5; + So [0] = 0; + Soff = 0; + if (flags & 0x04) + fputc ('@', fo); + break; + } + if ((ch >= 'a' && ch <= 'z') || (ch == '_') || + (ch >= 'A' && ch <= 'Z') || (ch == '-') || + (ch >= '0' && ch <= '9')) + { objekt [off++] = (char) ch; + state = 2; + } + break; + case 1: /* Kommentare ausfiltern */ + if (ch == 0x0D || ch == 0x0A) + state = (last_type == 1) ? 3 : 0; + break; + case 2: /* Identifier lesen */ + if ((ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') || (ch == '-') || + (ch >= '0' && ch <= '9')) + { if (off+1 < Slng) + objekt [off++] = (char) ch; + } + else if (ch == -1) + { *objekttyp = 1; last_type = -1; + objekt [off] = 0; + return 0; + } + else { *objekttyp = last_type = 1; + objekt [off] = 0; + if (ch == '=') last_type = 3; + else if (ch == 0x0A || ch == 0x0D) + last_type = 0; + return 0; + } + break; + case 3: /* Datentrennzeichen erwarten */ + if (ch == '=') state = 4; + else if (ch == 0x0A || ch == 0x0D) state = 0; + break; + case 4: /* Datum lesen */ + if (ch == 0x0A || ch == 0x0D) + { *objekttyp = last_type = 2; + objekt [off] = 0; + return 0; + } else + if (ch == -1) + { *objekttyp = 2; last_type = -1; + objekt [off] = 0; + return 0; + } else + if (off+1 < Slng) + objekt [off++] = (char) ch; + break; + case 5: /* Modulsteuerung */ + if (ch == 0x0D || ch == 0x0A) + { state = (last_type == 1) ? 3 : 0; + Soff = get_Sid (); + switch (Soff) + { case 0: flg_write_empty = 1; break; + case 1: flg_write_empty = 0; break; + } + } + else if (Soff+2 < N_So) + { So [Soff++] = (char) ch; + So [Soff ] = 0; + } + break; + } + } +} + +/* ------------------------------------------------------------------------ */ +int f4f_read ( +char *filename, +char *k_name, +int *k_version, +int flags, /* Bit 0: first static open */ + /* 1: sequential read */ +char *daten1 [], +int daten1_zahl, +char *daten2 [], +int daten2_zahl, +char *daten3 [], +int daten3_zahl, +char *daten4 [], +int daten4_zahl) +/* RETURN: ERR_file_not_found */ +/* ERR_name_not_found */ +/* ERR_version_not_found */ +/* ERR_eof ... bei sequentiellem lesen */ +{ int obj_typ, + sel_field, + ret_val = ERR_name_not_found, + vers = -1, + state = 0; + int g1, g2, g3, g4; + + if (filename [0] == 0) return ERR_file_not_found; + if (!(flags & 0x03)) + if (k_name [0] == 0) return ERR_name_not_found; + g1 = daten1_zahl; + g2 = g1 + daten2_zahl; + g3 = g2 + daten3_zahl; + g4 = g3 + daten4_zahl; + + if (access (filename, 0) != 0) return ERR_file_not_found; + if ((flags & 0x03) == 0x01 || + (flags & 0x03) == 0x00) + { ffi = fopen (filename, "rt"); + last_type = 0; + } + + /* printf ("Filename=%s k_name=%s k_version=%d\n", */ + /* filename, k_name, *k_version); getch (); */ + for (;;) + { if (f4fscan (ffi, ffo, &obj_typ, obj, 0) == -1) + { if (flags & 0x03) ret_val = ERR_eof; + break; + } + to_lower (obj); +#ifdef DEBUG + printf ("READ: state=%2d obj_typ=%3d obj=%s\n", + state, obj_typ, obj); +#endif + switch (state) + { case 0: if (obj_typ == 1 && strcmp (obj, "kid") == 0) + state = 3; + break; + case 1: if (obj_typ != 2) break; + state = 2; + if (sel_field < 0) break; + if (sel_field < g1) + strcpy (daten1 [sel_field], obj); else + if (sel_field < g2) + strcpy (daten2 [sel_field-g1], obj); else + if (sel_field < g3) + strcpy (daten3 [sel_field-g2], obj); else + if (sel_field < g4) + strcpy (daten4 [sel_field-g3], obj); + break; + case 2: /* naechsten Identifier erwarten */ + if (obj_typ != 1) break; + if (strcmp (obj, "kid") == 0) + if (vers >= *k_version || + (flags & 0x03)) goto READ_ENDE; + else state = 0; + else { sel_field = get_identifier (obj); + state = 1; + } + break; + case 3: /* k_name erwarten */ + if (obj_typ == 2) + if (strcmp (obj, k_name) == 0) + { vers++; + state = 2; + ret_val = ERR_version_not_found; + } else + if (flags & 0x03) + { state = 2; + ret_val = 0; + strcpy (k_name, obj); + } + else state = 0; + else state = 0; + break; + } + } +READ_ENDE: + *k_version = vers; + if (!(flags & 0x03) || ret_val == ERR_eof) + fclose (ffi); + return ret_val; +} + +/* ------------------------------------------------------------------------ */ +int f4f_write ( +char *filename, +char *k_name, +int *k_version, +int flags, +char *daten1 [], +int daten1_zahl, +char *daten2 [], +int daten2_zahl, +char *daten3 [], +int daten3_zahl, +char *daten4 [], +int daten4_zahl) +{ + int obj_typ; + int copyflgs; + int f_create= 0; /* 1 -> File erst erzeugt */ + int written= 0; /* 1 -> Daten gesichert */ + int ret_val= ERR_name_not_found; + int vers= -1; + int state= 0; + +#ifdef MSDOS + flags; +#endif + + if (filename [0] == 0) return ERR_file_not_found; + if (k_name [0] == 0) return ERR_name_not_found; + if (access (filename, 0) != 0) + { ffo = fopen (filename, "wt"); + fprintf (ffo, "#\n# File %s\n#\nkid =%s\n", filename, k_name); + f4f_wds (ffo, daten1, daten1_zahl, + daten2, daten2_zahl, + daten3, daten3_zahl, + daten4, daten4_zahl); + fclose (ffo); + return ERR_file_not_found; + } + ffo = fopen (TEMPFILE, "wt"); + ffi = fopen (filename, "rt"); + last_type = 0; copyflgs = 0x01; +#ifdef DEBUG + w_col80mode (); + menue (0); +#endif + for (; state >= 0;) + { if (f4fscan (ffi, ffo, &obj_typ, obj, copyflgs) == -1) break; +#ifdef DEBUG + printf ("WRITE: %3d %s \n", obj_typ, obj); +#endif + switch (state) + { case 0: if (obj_typ == 1 && strcmp (to_lower (obj), "kid") == 0) + state = 3; + break; + case 1: /* Daten ueberlesen */ + state = 2; + break; + case 2: /* naechsten Identifier erwarten */ + if (obj_typ == 1) + if (strcmp (to_lower (obj), "kid") == 0) + { /* Rest uebertragen */ +#ifdef DEBUG + printf ("Skipping Record Obj=%s\n", obj); +#endif + fprintf (ffo, (last_type == 3) ? "kid=" : "kid"); + f4fscan (ffi, ffo, &obj_typ, obj, 3); /* copy -> EOF */ + state = -1; /* -> Ende */ + } + else state = 1; + break; + case 3: /* k_name erwarten */ + if (obj_typ == 2 && + strcmp (obj, k_name) == 0) + { vers++; + ret_val = ERR_version_not_found; + if (vers >= *k_version) + { /* aktuelle Daten schreiben */ +#ifdef DEBUG + printf ("Writing Record Kid=%s Vers=%d\n", k_name, vers); +#endif + f4f_wds (ffo, daten1, daten1_zahl, + daten2, daten2_zahl, + daten3, daten3_zahl, + daten4, daten4_zahl); + state = 2; /* folgenden (alten) DS ueberlesen */ + copyflgs = 4; /* nur Kommentare kopieren */ + written = 1; + ret_val = 0; + } + else state = 0; + } + else state = 0; + break; + } } + *k_version = vers; + if (!written) + { fprintf (ffo, "# ------\nkid =%s\n", k_name); + f4f_wds (ffo, daten1, daten1_zahl, + daten2, daten2_zahl, + daten3, daten3_zahl, + daten4, daten4_zahl); + } + fclose (ffi); fclose (ffo); + unlink (filename); + rename (TEMPFILE, filename); +#ifdef DEBUG + printf ("Write Over: vers=%d ret_val=%d\n", vers, ret_val); + getch (); + menue (0); +#endif + return ret_val; +} + +/* ------------------------------------------------------------------------ */ +void f4f_wds ( +FILE *fo, +char *daten1 [], +int daten1_zahl, +char *daten2 [], +int daten2_zahl, +char *daten3 [], +int daten3_zahl, +char *daten4 [], +int daten4_zahl) +{ + int i; + int j= 0; + + for (i = 0; i < daten1_zahl; i++,j++) + if (daten1 [i][0] || flg_write_empty) + fprintf (fo, "%s =%s\n", identifier [j], daten1 [i]); + for (i = 0; i < daten2_zahl; i++,j++) + if (daten2 [i][0] || flg_write_empty) + fprintf (fo, "%s =%s\n", identifier [j], daten2 [i]); + for (i = 0; i < daten3_zahl; i++,j++) + if (daten3 [i][0] || flg_write_empty) + fprintf (fo, "%s =%s\n", identifier [j], daten3 [i]); + for (i = 0; i < daten4_zahl; i++,j++) + if (daten4 [i][0] || flg_write_empty) + fprintf (fo, "%s =%s\n", identifier [j], daten4 [i]); +} diff --git a/lib/sbr/misc/flopen.c b/lib/sbr/misc/flopen.c new file mode 100644 index 0000000000000000000000000000000000000000..03c95ab8e3e3a1a4d155d039c17c882541746b49 --- /dev/null +++ b/lib/sbr/misc/flopen.c @@ -0,0 +1,122 @@ +/* + * FILE %sbr/flopen.c + * + * lazy file open + * + * written: 1991 03 25 + * 1994-10-10 was ~/usr/lexicon/dictadd5.c + * Filecache System fuer Lexicon-Operationen + * latest update: 1996-10-10 0:38:07 + * + */ + + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +struct FILECACHE +{ + struct FILECACHE *next; + FILE *fp; + char mode [8]; + char name [4]; +} ; + +static struct FILECACHE *filecache= (struct FILECACHE *) 0; + +/* ------------------------------------------------------------------------ */ +FILE *flopen (char *file_name, char *open_mode) +{ + FILE *f; + struct FILECACHE *fc, **fcp; + +/************* +printf (">> flopen: (%s, %s)\n", file_name, open_mode); +fflush (stdout); +*************/ + + for (fcp= &filecache; + (fc= *fcp) != (struct FILECACHE *) 0; + fcp= &(*fcp)->next) + { + if (strcmp (fc->name, file_name) == 0) + { + if (strcmp (fc->mode, open_mode) == 0) return (fc->fp); + +/********* +printf (">>> fclose: (%s), was %s\n", file_name, fc->mode); +********/ + fclose (fc->fp); + *fcp= fc->next; + free (fc); + break; + } + } + + if (strcmp (open_mode, "close") == 0) return (FILE *) 0; + +/********** +printf (">>> fopen: (%s, %s)\n", file_name, open_mode); +********/ + if ((f= fopen (file_name, open_mode)) == (FILE *) 0) + { + /*********** + fprintf (stderr, "flopen (%s, %s) failed!\n", file_name, open_mode); + ***********/ + return (FILE *) 0; + } + + if ((fc= (struct FILECACHE *) + calloc (sizeof (struct FILECACHE) + strlen (file_name), 1)) + == (struct FILECACHE *) 0) return f; + + fc->fp= f; + strcpy (fc->mode, open_mode); + strcpy (fc->name, file_name); + fc->next= filecache; + filecache= fc; + + return f; +} + +/* ------------------------------------------------------------------------ */ +int flclose (char *file_name) +{ + flopen (file_name, "close"); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int flclose_all () +{ + struct FILECACHE *fc; + +/************** +printf (">> flclose_all: ()\n"); +************/ + while (filecache != (struct FILECACHE *) 0) + { + fc= filecache; + filecache= filecache->next; + fclose (fc->fp); + free (fc); + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +int flprint_table (FILE *fo) +{ + struct FILECACHE *fc; + + fprintf (fo, "lazy file table (BEGIN)\n"); + for (fc= filecache; fc != (struct FILECACHE *) 0; fc= fc->next) + fprintf (fo, "0x%08lX %3s %s\n", (long) fc->fp, fc->mode, fc->name); + + fprintf (fo, "lazy file table (END)\n"); + + return 0; +} diff --git a/lib/sbr/misc/flopen.o b/lib/sbr/misc/flopen.o new file mode 100644 index 0000000000000000000000000000000000000000..3d4b2aafe9685a4083cf7b68444834262b5929bf Binary files /dev/null and b/lib/sbr/misc/flopen.o differ diff --git a/lib/sbr/misc/fmt.c b/lib/sbr/misc/fmt.c new file mode 100644 index 0000000000000000000000000000000000000000..b41f7c3ef64e999a12c344fe78457b447522d677 --- /dev/null +++ b/lib/sbr/misc/fmt.c @@ -0,0 +1,297 @@ +/* + * FILE ~/usr/sbr/fmt.c + * + * Formatierung von Zahlen usw. + * + * written: 1988 04 09 + * latest update: 1994-08-13 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +#ifndef NIL +#define NIL (char *) 0 +#endif + +/* ------------------------------------------------------------------------ */ +static double dc_max; /* Maximum der |betrachteten Zahlen| */ + +static int dc_cnt= 0; /* Zahl der betrachteten Zahlen */ +static int dc_chkflg= 0; /* 1 -> Format schon erstellt */ +static int dc_doit= 1; /* 1 -> wirklich formatieren */ +static int dc_komma; /* Zeichen fuer Komma */ +static int dc_punkt; /* . . Punkt */ + +static int dc_rnd; /* Schutzstelle fuer Rundung */ +static int dc_oo; /* Pos. fuer 1. kopierte Ziffer */ +static int dc_pp; /* . des zu setzenden Punktes */ +static int dc_cp; /* . . . . Kommas */ +static int dc_cs; /* . . . Skippenden Kommas */ +static int dc_st; /* Laenge des formatierten Str. */ + +/* ------------------------------------------------------------------------ */ +static char *dc_faktor_string; +static char dc_xxxx [40]; +static char *dc_value_string; +static char dc_value_string1 [40]; +static char dc_value_string2 [40]; +static char dc_value_string3 [40]; +static int dc_v_c= 1; + +/* ------------------------------------------------------------------------ */ +void dc_reset () +{ + dc_max= 0.0; + dc_chkflg= dc_cnt= 0; +} + +/* ------------------------------------------------------------------------ */ +void dc_modus (int d) +{ + dc_doit= d; +} + +/* ------------------------------------------------------------------------ */ +void dc_cal (double v) +{ + if (v < 0.0) v= -v; + if (v > dc_max) dc_max= v; + dc_cnt++; +} + +/* ------------------------------------------------------------------------ */ +char *dc_chk ( +int st, /* Gesamtstellenzahl mit VZ, Punkt, Komma */ +int sig, /* Signifikante Ziffern */ +int nk, /* max. erlaubte Nachkommastellen */ +int faktor_st, /* Anzahl der Stellen des Faktors */ + /* z.B: 3 -> 1.000 | 1.000.000 | 1.000.000.000 */ + /* 1 -> 1 | 10 | 100 | 1000 | 10000 .... */ +double *faktor, /* Verwendeter Faktor */ +char **cp2, /* Faktor in Worten */ +int komma, /* Zeichen fuer Komma */ +int punkt) /* . . Punkt */ +/* RETURN: Faktor in Stringdarstellung (linksbuendig!!) */ +{ + int i; + int variante; + + if (faktor_st <= 0 || + st <= 0 || + sig > st || + nk < 0 || + sig <= nk) return NIL; + + st= 8; + sig= 5; + nk= 2; + faktor_st= 3; /* ############## <<<<<<< */ + + dc_st = st; + dc_komma = komma; dc_punkt = punkt; + sprintf (dc_xxxx, "%15.3f", dc_max); + + for (i = 0; dc_xxxx [i]; i++) + { if (dc_xxxx [i] >= '0' && + dc_xxxx [i] <= '9') break; + if (dc_xxxx [i] == '.') break; + } + dc_rnd = 0; dc_cs = 11; /* Komma Position == 11 */ + switch (dc_xxxx [i]) + { case 0: + case '.': return NIL; + default : + if ((dc_rnd = i+sig) >= dc_cs) dc_rnd++; + dc_oo = i-1; if (i > 8) dc_oo = 7; + + switch (i) + { case 10: + case 9: + case 8: variante = 1; + dc_faktor_string = "1.0"; + *faktor = 1.0 ; + *cp2 = ""; + break; + case 7: variante = 2; + dc_faktor_string = "1.0"; + *faktor = 1.0 ; + *cp2 = ""; + break; + case 6: variante = 3; + dc_faktor_string = "1.0"; + *faktor = 1.0 ; + *cp2 = ""; + break; + case 5: variante = 1; + dc_faktor_string = "1000"; + *faktor = 1000.0 ; + *cp2 = "1000 "; + break; + case 4: variante = 2; + dc_faktor_string = "1000"; + *faktor = 1000.0 ; + *cp2 = "1000 "; + break; + case 3: variante = 3; + dc_faktor_string = "1000"; + *faktor = 1000.0 ; + *cp2 = "1000 "; + break; + case 2: variante = 1; + dc_faktor_string = "1000000"; + *faktor = 1000000.0 ; + *cp2 = "Mio "; + break; + case 1: variante = 2; + dc_faktor_string = "1000000"; + *faktor = 1000000.0 ; + *cp2 = "Mio "; + break; + default: return NIL; + } break; + } + + switch (variante) + { default: + case 1: + dc_pp = -1; + dc_cp = 5; + break; + case 2: + dc_pp = 2; + dc_cp = 6; + break; + case 3: + dc_pp = 4; + dc_cp = -1; + break; + } + if (dc_pp == -1 || dc_cp == -1) dc_oo--; + + dc_chkflg= 1; + return dc_faktor_string; +} + +/* ------------------------------------------------------------------------ */ +char *dc_fmt (double v) +{ + double f; + int i, j, c; + int carry; + char *cp; + + if (!dc_chkflg) dc_chk (8, 5, 2, 3, &f, &cp, ',', '.'); + sprintf (dc_xxxx, "%15.3f", v); + /* printf ("CPY: %15.3f -> %s\n", v, dc_xxxx); */ + if (!dc_doit) return dc_xxxx; + + switch (dc_v_c) /* Speicherflaeche festlegen ---------------- */ + { + case 1: dc_value_string = &dc_value_string1 [0]; dc_v_c = 2; break; + case 2: dc_value_string = &dc_value_string2 [0]; dc_v_c = 3; break; + case 3: dc_value_string = &dc_value_string3 [0]; dc_v_c = 1; break; + } + + /* Zahlen setzen und runden */ + carry= (dc_xxxx [dc_rnd] >= '5' && dc_rnd) ? 1 : 0; + + for (i = dc_rnd-1, j = dc_st-1; i >= dc_oo; i--,j--) + { + if (j == dc_pp || j == dc_cp) j--; + if (i >= dc_cs) + if (i > dc_cs) + c = dc_xxxx [i+1]; + else c = dc_xxxx [--i]; + else c = dc_xxxx [i ]; + + if (carry) + switch (c) + { + case '9': + dc_value_string [j]= '0'; + break; + case ' ': + dc_value_string [j]= '1'; + carry= 0; + break; + default : + dc_value_string [j]= (char) c+1; + carry= 0; + break; + } + else dc_value_string [j]= (char) c; + /* printf ("CPY: %3d (%3d) %c -> %c\n", */ + /* i, j, dc_xxxx [i], dc_value_string [j]); */ + } + + /* Kommas und Punkte setzen */ + if (dc_pp >= 0) + dc_value_string [dc_pp] = + (dc_value_string [dc_pp-1] != ' ' && + dc_value_string [dc_pp-1] != '-' ) + ? (char) dc_punkt : ' '; + + if (dc_cp >= 0) + { + dc_value_string [dc_cp]= (char) dc_komma; + switch (dc_value_string [dc_cp-1]) + { + case ' ': dc_value_string [dc_cp-1] = '0'; break; + case '-': dc_value_string [dc_cp-1] = '0'; + dc_value_string [dc_cp-2] = '-'; break; + } + for (i= dc_cp+1; i < dc_st; i++) + if (dc_value_string [i] == ' ') + dc_value_string [i]= '0'; + } + + dc_value_string [dc_st]= 0; + return dc_value_string; +} + +/* ------------------------------------------------------------------------ */ +#ifdef DEBUG + +static double DD [] = +{ + 123600.0, + 262900.0, + 1286460.0, + 1880380.0, + 7450.0 +}; + +int cdecl main (void); + +/* ------------------------------------------------------------------------ */ +int main () +{ + int i, j, k; + double f; + char *cp1, *cp2; + + sprintf (dc_xxxx, "%15.3f", 123456789.9876); + printf ("Fakt_str= :%s: len=%d\n", dc_xxxx, strlen (dc_xxxx)); + sprintf (dc_xxxx, "%15.3f", -123456789.9876); + printf ("Fakt_str= :%s: len=%d\n", dc_xxxx, strlen (dc_xxxx)); + + k= sizeof (DD) / sizeof (double); + dc_reset (); + for (i = 0; i < k; i++) dc_cal (DD [i]); + cp1= dc_chk (8, 5, 2, 3, &f, &cp2, ',', '.'); + + printf ("dc_rnd=%d dc_oo=%d dc_pp=%d dc_cp=%d dc_cs=%d dc_st=%d\n", + dc_rnd, dc_oo, dc_pp, dc_cp, dc_cs, dc_st); + + printf ("Max = %15.2f In %s (%15.2f) Einheiten; %s\n", + dc_max, cp1, f, cp2); + + for (i = 0; i < k; i++) + printf ("Wert [%2d] = %15.3f :%s:\n", i, DD [i], dc_fmt (DD [i])); + + return 0; +} + +#endif diff --git a/lib/sbr/misc/fmtdta01.c b/lib/sbr/misc/fmtdta01.c new file mode 100644 index 0000000000000000000000000000000000000000..31e013be95419824a3d09860c5c8175366722756 --- /dev/null +++ b/lib/sbr/misc/fmtdta01.c @@ -0,0 +1,26 @@ +/* + * FILE %sbr/fmtdta01.c + * + * written: 1994-02-12 + * latest update: 1996-07-19 18:46:00 + * + */ + +#include <stdio.h> +#include <gg/filename.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif /* MSDOS */ + +/* ------------------------------------------------------------------------ */ +int fmt_dta_date (char *puffer, int fn_date) +{ + sprintf (puffer, + "%04d-%02d-%02d", + ((fn_date >> 9) & 0x7F) + 1980, + (fn_date >> 5) & 0x0F, + fn_date & 0x1F); + + return 0; +} diff --git a/lib/sbr/misc/fmtdta02.c b/lib/sbr/misc/fmtdta02.c new file mode 100644 index 0000000000000000000000000000000000000000..5c750ab9ed271d26fb444a22c2286784121f4fb6 --- /dev/null +++ b/lib/sbr/misc/fmtdta02.c @@ -0,0 +1,26 @@ +/* + * FILE %sbr/fmtdta02.c + * + * written: 1994-02-12 + * latest update: 1996-07-19 18:46:46 + * + */ + +#include <stdio.h> +#include <gg/filename.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif /* MSDOS */ + +/* ------------------------------------------------------------------------ */ +int fmt_dta_time (char *puffer, int fn_time) +{ + sprintf (puffer, + "%02d:%02d:%02d", + (fn_time >> 11) & 0x1F, + (fn_time >> 5) & 0x3F, + (fn_time & 0x1F) << 1); + + return 0; +} diff --git a/lib/sbr/misc/fnames.c b/lib/sbr/misc/fnames.c new file mode 100644 index 0000000000000000000000000000000000000000..892966d1c385f0e626804b0a2d893fb27c8d87c2 --- /dev/null +++ b/lib/sbr/misc/fnames.c @@ -0,0 +1,48 @@ +/* + * FILE %sbr/fnames.c + * + * Suchen von Files ueber DOS + * + * written: 1987 10 21 + * 1990 02 03: Revision + * latest update: 1996-08-11 10:24:38 + * + */ + +#include <dos.h> +#include <gg/fnames.h> + +/* DTA - Operationen ------------------------------------------------------ */ +void Fsetdta (struct dta_buff *dta) +{ +#ifdef LARGE_MODEL + bdos (Setdta, FP_OFF (dta), FP_SEG (dta)); +#else + bdos (Setdta, FP_OFF (dta), 0); +#endif +} + +/* DTA - Operationen ------------------------------------------------------ */ +int Fsfirst (char *name, int att) +{ + union REGS inregs, outregs; + struct SREGS sregs; + + inregs.h.ah= First; + sregs.ds= FP_SEG (name); + inregs.x.dx= FP_OFF (name); + inregs.x.cx= att; + + intdosx (&inregs, &outregs, &sregs); + return ((outregs.x.cflag) ? outregs.x.ax : 0); +} + +/* DTA - Operationen ------------------------------------------------------ */ +int Fsnext (void) +{ + union REGS inregs, outregs; + inregs.h.ah= Next; + + intdos (&inregs, &outregs); + return ((outregs.x.cflag) ? outregs.x.ax : 0); +} diff --git a/lib/sbr/misc/fnames2.c b/lib/sbr/misc/fnames2.c new file mode 100644 index 0000000000000000000000000000000000000000..cae0101258ed6be29f8be8282fff9e8bea2fb8ad --- /dev/null +++ b/lib/sbr/misc/fnames2.c @@ -0,0 +1,96 @@ +/* + * FILE %sbr/fnames2.c + * + * Suchen von Files ueber DOS + * Etwas hoehere Funktionen + * + * written: 1989 04 12 + * 1989 12 24: Fname_find () liefert ganzen Path des + * gefundenen Files + * 1990 02 03: Revision + * latest update: 1996-08-11 10:42:29 + * + */ + +#include <stdio.h> + +#include <dos.h> +#include <string.h> +#include <gg/fnames.h> +#include <gg/filename.h> + +static struct dta_buff dta; +static char last_path [66]; +static char found_file [66]; +static char *found_file_ptr; +static int last_attr= -1; +static int init= -1; + +/* ------------------------------------------------------------------------ */ +struct dta_buff *Fdta_find (char *path, int attr) +{ + int notfound; + int i; + + Fsetdta (&dta); + if (init == -1) + { + init= 0; + goto FIRST; + } + + if (strcmp (last_path, path) == 0 && last_attr == attr) + { /* schon einmal nach diesem Muster gesucht */ + notfound= Fsnext (); + } + else + { /* zum erstenmal nach diesem Muster UND Attribut gesucht */ +FIRST: + last_attr= attr; + strcpy (last_path, path); + strcpy (found_file, path); + notfound= Fsfirst (path, attr); + + for (i= strlen (path)-1; i >= 0; i--) + if (path [i] == '\\' || path [i] == ':') break; + + found_file_ptr= (i >= 0) ? &found_file [i+1] : found_file; + } + + if (notfound) + { + return (struct dta_buff *) 0; + } + else + { + if (dta.att & FA_DIRECTORY) dta.size= 0L; + return &dta; + } +} + +/* ------------------------------------------------------------------------ */ +char *Fname_find (char *path, int attr) +{ + if (Fdta_find (path, attr) == (struct dta_buff *) 0) + return (char *) 0; + + strcpy (found_file_ptr, dta.name); + return found_file; +} + +/* ------------------------------------------------------------------------ */ +struct dta_buff *Fget_dta (void) +{ + return &dta; +} + +/* ------------------------------------------------------------------------ */ +void Freset_find (void) +{ + init= -1; +} + +/* ------------------------------------------------------------------------ */ +int wcrd_get_date () { return dta.date; } +int wcrd_get_time () { return dta.time; } +long wcrd_get_size () { return dta.size; } diff --git a/lib/sbr/misc/fndvfile.c b/lib/sbr/misc/fndvfile.c new file mode 100644 index 0000000000000000000000000000000000000000..e2e6c96ae50db7bea7d10879600540554072e59c --- /dev/null +++ b/lib/sbr/misc/fndvfile.c @@ -0,0 +1,208 @@ +/* + * FILE %sbr/fndvfile.c + * + * written: 1996-03-17: extracted from %ned/04/ned0425.c + * latest update: 1997-06-11 14:40:56 + * + */ + +#ifdef DEBUG +#define DFILE stdout +#include <stdio.h> +int main (int argc, char *argv []); +int print_virtual_file (FILE *fo, char *str); +#endif + +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/url.h> +#include <gg/strings.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +static char *dirinf= "(dirinf).fm"; +static int dirinf_allocated= 0; +static FVF_get_directory_listing *fvf_get_dirinf= + (FVF_get_directory_listing *) 0; +static void *fvf_get_dirinf_cd= (void *) 0; + +/* ------------------------------------------------------------------------ */ +int find_virtual_file ( +char *fnm, +char *current_path, +char **real_fnm, +char **virtual_fnm) +{ + char *r_fnm; + char *v_fnm; + int lrf; + struct stat st; + + /* T2D: current_path could be an URL itself !!! */ + if (url_identify_type (fnm) >= URL_TYPE_file) + { + if ((r_fnm= url_fetch (fnm)) == (char *) 0) return -1; + v_fnm= strdup (fnm); + + *virtual_fnm= v_fnm; + *real_fnm= r_fnm; + } + else + { + if (filename_definition (fnm, real_fnm, virtual_fnm, current_path) != 0) + { + *real_fnm= strdup (fnm); + *virtual_fnm= strdup (fnm); + } + + /* NOTE: 1997-06-11 14:40:28 */ + /* optionally strdup (fnm) if real_fnm or virtual_fnm are NULL ! */ + + r_fnm= *real_fnm; + v_fnm= *virtual_fnm; + } + + if ((lrf= strlen (r_fnm) - 1) <= 0) return -1; + + if (r_fnm [lrf] == '/' +#ifdef MSDOS + || r_fnm [lrf] == '\\' +#endif /* MSDOS */ + ) r_fnm [lrf--]= 0; /* skip that / from dirinf */ + + if (stat (r_fnm, &st) == 0 && (st.st_mode & S_IFDIR)) + { + FVF_get_directory_listing *proc; + char *res; + +#ifdef DEBUG + printf ("is_dir: '%s'\n", r_fnm); +#endif /* DEBUG */ + + if ((proc= fvf_get_dirinf) != (FVF_get_directory_listing *) 0 +#ifdef DEBUG + && printf (" -> calling dirinf generator\n") +#endif /* DEBUG */ + && (res= (*fvf_get_dirinf) (r_fnm, fvf_get_dirinf_cd)) != (char *) 0 + ) + { + free (r_fnm); /* not used anymore */ + *real_fnm= res; + return 0; + } + + if (dirinf == (char *) 0 + || lrf <= 0 + || lrf + 14 >= MAX_FNM_LENGTH + ) return -1; + + /* NOTE: both r_fnm and v_fnm are set up larger than needed */ + /* to be able to add a filename to a directory name! */ + +#ifdef DEBUG + printf (" -> appending '/%s'\n", dirinf); +#endif /* DEBUG */ + strcat (r_fnm, "/"); + strcat (r_fnm, dirinf); + /* strcat (v_fnm, dirinf); */ + } + /* END library function isolation (1996-03-17 12:39:48) ***************** */ + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int fvf_set_dirinf (char *s) +{ + if (dirinf_allocated) + { + free_or_what (dirinf); + dirinf= (char *) 0; + } + + if (s != (char *) 0 && *s != 0) + { + if (strlen (s)-4 >= DEF_FNM_EXTRA) return -1; /* T2D: that's ugly! */ + + dirinf= strdup (s); + dirinf_allocated= 1; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int fvf_set_dirinf_callback ( +FVF_get_directory_listing *proc, +void *client_data) +{ + fvf_get_dirinf= proc; + fvf_get_dirinf_cd= client_data; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef DEBUG +static char line [256]; + +char *XSTR (char *str) +{ + return (str == (char *) 0) ? "(null)" : str; +} +#endif /* DEBUG */ + +#ifdef DEBUG_main +static char *assumed_path= (char *) 0; + +int main (int argc, char *argv []) +{ + int i; + int done= 0; + + for (i= 1; i < argc; i++) + { + if (strncmp (argv [i], "-p", 2) == 0) + { + assumed_path= argv [i]+2; + continue; + } + + /* assumed_path= argv [i]; *****/ + print_virtual_file (DFILE, argv [i]); + done++; + } + + while (done == 0) + { + fprintf (DFILE, "filename: "); + scanf ("%s", line); + if (line [0] == '#') line [0]= 0; + + print_virtual_file (DFILE, line); + } + + return 0; +} + +int print_virtual_file (FILE *fo, char *str) +{ + char *vir, *rea; + char *reverse_lookup; + int rc; + + rea= vir= reverse_lookup= (char *) 0; + rc= find_virtual_file (str, assumed_path, &rea, &vir); + + fprintf (fo, "filename= '%s'\n", XSTR (str)); + fprintf (fo, "path = '%s'\n", XSTR (assumed_path)); + fprintf (fo, "real = '%s'\n", XSTR (rea)); + fprintf (fo, "virtual = '%s'\n", XSTR (vir)); + fprintf (fo, "--------------\n"); + + return 0; +} + +#endif /* DEBUG_main */ diff --git a/lib/sbr/misc/fndvfile.o b/lib/sbr/misc/fndvfile.o new file mode 100644 index 0000000000000000000000000000000000000000..737ce3317f4202d3643d8f7349582d9b3695e8d8 Binary files /dev/null and b/lib/sbr/misc/fndvfile.o differ diff --git a/lib/sbr/misc/fnm_d2u.c b/lib/sbr/misc/fnm_d2u.c new file mode 100644 index 0000000000000000000000000000000000000000..30835d3f917938da67a79a1d727613b7e15e38b3 --- /dev/null +++ b/lib/sbr/misc/fnm_d2u.c @@ -0,0 +1,49 @@ +/* + * FILE ~/usr/sbr/fnm_d2u.c + * + * translate a filename from dos to unix + * + * written: 1994-12-31 + * latest update: 1995-06-11 + * + */ + +#include <gg/strings.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +int filename_dos2unix (char *d, char *s) +{ + int ch; + + for (;; s++) + { + switch (ch= (*s & 0x00FF)) + { + case '(': /* quote offending characters */ + case ')': + *d++ = '\''; + *d++ = (char) ch;; + *d++ = '\''; + break; + case '\\': + *d++ = '/'; + break; + case ':': + *d++ = '.'; + *d++ = 'd'; + *d++ = 'r'; + *d++ = 'i'; + *d++ = 'v'; + *d++ = 'e'; + *d++ = '/'; + break; + default: + *d++= (char) lower_case (ch); + break; + } + if (*s == 0) break; + } + + return 0; +} diff --git a/lib/sbr/misc/fnmcpy.c b/lib/sbr/misc/fnmcpy.c new file mode 100644 index 0000000000000000000000000000000000000000..07cd4572d317819b73698019ae1880fcb8bd7f0b --- /dev/null +++ b/lib/sbr/misc/fnmcpy.c @@ -0,0 +1,113 @@ +/* + * FILE %sbr/fnmcpy.c + * + * copy filename and replace its extension or filetype (under CMS) + * + * written: 1987 04 08 + * 1991 02 09: revision + * 1991 05 17: rename c:/usr/ned/04/ned0407.c + * to c:/usr/sbr/fnmcpy.c + * gen_extension() -> fnmcpy() + * latest update: 1995-12-05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +#ifndef __CMS__ +int fnmcpy (char *fnm_new, char *fnm_old, char *extension) +{ + int i, j; + + if (fnm_new == (char *) 0) return -1; + strcpy (fnm_new, fnm_old); + i= strlen (fnm_new); + + for (j= i-1; j >= 0; j--) + { + if (fnm_new [j] == '.') + { + strcpy (&fnm_new [j], extension); + return 0; + } + if (fnm_new [j] == '\\' + || fnm_new [j] == '/' + || fnm_new [j] == ':') break; + } + + if (extension == (char *) 0 || extension [0] == 0) + { + fnm_new [i] = 0; + return 0; + } + + strcpy (&fnm_new [i], extension); + return 0; +} +#endif + +/* ------------------------------------------------------------------------ */ +#ifdef __CMS__ +int fnmcpy (char *fnm_new, char *fnm_old, char *extension) +{ + int ch; + int dots= 0; + + if (fnm_new == (char *) 0) return -1; + + for (; ch= *fnm_old;) + { + *fnm_new= (char) ch; + if (ch == '.') break; + fnm_new++; + fnm_old++; + } + + for (fnm_old++; ch= *fnm_old;) + { + if (ch == '.') break; + fnm_old++; + } + + if (*extension != '.') + { + *fnm_new++ = '.'; + dots++; + } + + for (; ch= *extension;) + { + *fnm_new= (char) ch; + if (ch == '.') + { + if (dots == 2) break; + dots++; + } + fnm_new++; + extension++; + } + + if (dots == 1) + for (; ch= *fnm_old;) + { + *fnm_new= (char) ch; + if (ch == '.') + { + if (dots == 2) break; + dots++; + } + fnm_new++; + fnm_old++; + } + + *fnm_new= 0; + + return 0; +} +#endif diff --git a/lib/sbr/misc/fnmcpy.o b/lib/sbr/misc/fnmcpy.o new file mode 100644 index 0000000000000000000000000000000000000000..dadc81b19cf320ca4119a8114953eb1aa1feeee1 Binary files /dev/null and b/lib/sbr/misc/fnmcpy.o differ diff --git a/lib/sbr/misc/fnmcpy2.c b/lib/sbr/misc/fnmcpy2.c new file mode 100644 index 0000000000000000000000000000000000000000..deac396ab7b03c5b50e383de0c9d2444120f0a66 --- /dev/null +++ b/lib/sbr/misc/fnmcpy2.c @@ -0,0 +1,29 @@ +/* + * FILE %sbr/fnmcpy2.c + * + * copy filename and replace its extension or filetype (under CMS) + * - result is malloced + * + * written: 1994-12-09 + * latest update: 1996-09-29 9:00:00 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +char *fnmcpy2 (char *fnm_old, char *ext) +{ + char *fnm_new= (char *) 0; + + if ((fnm_new= malloc (strlen (fnm_old) + strlen (ext) + 2)) != (char *) 0) + fnmcpy (fnm_new, fnm_old, ext); + + return fnm_new; +} diff --git a/lib/sbr/misc/fnmcpy2.o b/lib/sbr/misc/fnmcpy2.o new file mode 100644 index 0000000000000000000000000000000000000000..dc4ffb9f1d5ae160a474a9911de1f8e68541b3a0 Binary files /dev/null and b/lib/sbr/misc/fnmcpy2.o differ diff --git a/lib/sbr/misc/fnmcpy3.c b/lib/sbr/misc/fnmcpy3.c new file mode 100644 index 0000000000000000000000000000000000000000..37ca22d8bc687e566152ea0d33d410ff52865a9f --- /dev/null +++ b/lib/sbr/misc/fnmcpy3.c @@ -0,0 +1,26 @@ +/* + * FILE %sbr/fnmcpy3.c + * + * copy filename and replace its extension or filetype (under CMS) + * + * written: 1995-07-30 + * latest update: 1995-12-16 + * $Id: fnmcpy3.c,v 1.2 2005/09/04 09:24:40 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <sys/types.h> +#include <gg/strings.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +char *fnmcpy3 (char **dst, char *fnm_old, char *ext) +{ + free_or_what (*dst); + *dst= fnmcpy2 (fnm_old, ext); + return *dst; +} diff --git a/lib/sbr/misc/fnmcpy3.o b/lib/sbr/misc/fnmcpy3.o new file mode 100644 index 0000000000000000000000000000000000000000..ab6e4a57d73b235badaecc48cf825bb3bd876d95 Binary files /dev/null and b/lib/sbr/misc/fnmcpy3.o differ diff --git a/lib/sbr/misc/fnmcpy4.c b/lib/sbr/misc/fnmcpy4.c new file mode 100644 index 0000000000000000000000000000000000000000..f5fc38893ea36bb43b20135c26f1672b6a3b3bf8 --- /dev/null +++ b/lib/sbr/misc/fnmcpy4.c @@ -0,0 +1,26 @@ +/* + * FILE %sbr/fnmcpy4.c + * + * copy filename if given or create a new one by combining + * a given other file name and an extension + * + * written: 1995-12-10 + * latest update: 1995-12-10 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +char *fnmcpy4 (char *fnm1, char *fnm2, char *ext) +{ + return (fnm1 == (char *) 0 || *fnm1 == 0) + ? fnmcpy2 (fnm2, ext) + : strdup (fnm1); +} diff --git a/lib/sbr/misc/fnmcpy4.o b/lib/sbr/misc/fnmcpy4.o new file mode 100644 index 0000000000000000000000000000000000000000..cd6f2ffe25b57b6171a046e2ebf5c70b9cb101b0 Binary files /dev/null and b/lib/sbr/misc/fnmcpy4.o differ diff --git a/lib/sbr/misc/fnmcpyt.c b/lib/sbr/misc/fnmcpyt.c new file mode 100644 index 0000000000000000000000000000000000000000..62f3419e0d9b36f2fda0772f01e7194b6debe1f1 --- /dev/null +++ b/lib/sbr/misc/fnmcpyt.c @@ -0,0 +1,31 @@ +/* + * FILE usr/sbr/fnmcpyt.c + * + * test: + * copy filename and replace its extension or filetype (under CMS) + * + * latest update: 1993-04-25 + * + */ + +#undef MSDOS +#define __CMS__ +#include "fnmcpy.c" + +static char dest[1024]; + +testit (char *t, char *e) +{ + fnmcpy (dest, t, e); + printf ("t=%s e=%s d=%s\n", t, e, dest); + +} + +main () +{ + testit ("abc.def.a", ".bg"); + testit ("xyz..", ".e7"); + testit ("blabla", ".dra"); + testit ("blabla.x.y.z", ".qua.adaf"); + testit ("blabla.x.y.z", ".qua"); +} diff --git a/lib/sbr/misc/fnmdef.c b/lib/sbr/misc/fnmdef.c new file mode 100644 index 0000000000000000000000000000000000000000..09a9d20425b7aa82b4c35a570d8dea8102efcc4f --- /dev/null +++ b/lib/sbr/misc/fnmdef.c @@ -0,0 +1,172 @@ +/* + * FILE %sbr/fnmdef.c + * + * written: 1994-08-12 + * latest update: 1996-03-17 21:07:52 + * $Id: fnmdef.c,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef DEBUG +#define DFILE stdout +#include <stdio.h> +int main (int argc, char *argv []); +int print_fnmdef (FILE *fo, char *str); +#endif + +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/filename.h> + +#define MAX_RECURSION 25 /* that should be enough, I guess */ +#define VP_BUFFER_SIZE 1024 +static char vp_buffer [VP_BUFFER_SIZE]; + +/* ------------------------------------------------------------------------ */ +int filename_definition ( +const char *spec, /* given filename */ +char **real_fnm, /* real absolute filename */ +char **virtual_fnm, /* translation for a logic path, or NULL */ +char *assumed_path) /* assumed working directory or NULL */ +{ + int ch; + char *tfn; + char *cpath; + int recursion; /* recursively resolve virtual paths */ + char *searched; + + if (spec == (char *) 0 + || real_fnm == (char **) 0 + || virtual_fnm == (char **) 0 + /**** || (ch= *spec) == 0 *****/ + ) return -1; + + read_logic_filename_table ((char *) 0, 1); + + *real_fnm= *virtual_fnm= (char *) 0; + + switch (ch) + { + case '%': + case '~': + case '$': + default: /* TEST1: it needs to be decided if this wide */ + /* translation mechanism is really wanted... */ + + searched= (char *) spec; /* not a (const char *) anymore ... */ + for (recursion= 0;; recursion++) + { + if (recursion >= MAX_RECURSION) return -1; +#ifdef MSDOS + to_lower (spec); + xchange (spec, '\\', '/'); +#endif /* MSDOS */ + + if ((tfn= translate_logic_filename (searched)) == (char *) 0) + return -1; + + if (tfn == (char *) 0 + || (ch= *tfn) == 0 + || strcmp (searched, tfn) == 0 + ) + { +#ifdef DEBUG + fprintf (DFILE, + ">> fnmdef: spec and tfn are identical, discard and getpath\n"); +#endif /* DEBUG */ + free (tfn); + goto RELATIVE; + } + + *real_fnm= tfn; + if (*virtual_fnm == (char *) 0) + *virtual_fnm= strdup_extra (searched, DEF_FNM_EXTRA); + if (recursion > 0) free (searched); /* malloc'ed in previous round */ + if (ch != '%' && ch != '~' && ch != '$') return 0; + searched= tfn; /* start another round of translations */ + } + } + +RELATIVE: + /* no virtual path found, try to resolve filename relativeley */ + + if ((cpath= real_filename (spec, assumed_path)) == (char *) 0) return -1; +#ifdef MSDOS + to_lower (cpath); + xchange (cpath, '\\', '/'); +#endif /* MSDOS */ + + ch= find_logic_filename (*real_fnm= cpath, vp_buffer, VP_BUFFER_SIZE); + +#ifdef DEBUG + fprintf (DFILE, "find_logic_filename (%s)\n", XSTR (*real_fnm)); + fprintf (DFILE, "rv=%d\n", ch); +#endif /* DEBUG */ + + if (ch == 1 /* a translation for a logic path exists */ + && (cpath= strdup_extra (vp_buffer, DEF_FNM_EXTRA)) != (char *) 0 + ) + { +#ifdef MSDOS + to_lower (cpath); + xchange (cpath, '\\', '/'); +#endif /* MSDOS */ + *virtual_fnm= cpath; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +#ifdef DEBUG_main +static char line [256]; +static char *assumed_path= (char *) 0; + +int main (int argc, char *argv []) +{ + int i; + int done= 0; + + for (i= 1; i < argc; i++) + { + /* assumed_path= argv [i]; *****/ + print_fnmdef (DFILE, argv [i]); + done++; + } + + while (done == 0) + { + fprintf (DFILE, "filename: "); + scanf ("%s", line); + if (line [0] == '#') line [0]= 0; + + print_fnmdef (DFILE, line); + } + + return 0; +} + +int print_fnmdef (FILE *fo, char *str) +{ + char *vir, *rea; + char *reverse_lookup; + int rc; + + rea= vir= reverse_lookup= (char *) 0; + vp_buffer [0]= 0; + rc= filename_definition (str, &rea, &vir, assumed_path); + + if (rea != (char *) 0) + find_logic_filename (rea, vp_buffer, VP_BUFFER_SIZE); + + fprintf (fo, "filename= '%s'\n", XSTR (str)); + fprintf (fo, "real = '%s'\n", XSTR (rea)); + fprintf (fo, "virtual = '%s'\n", XSTR (vir)); + fprintf (fo, "reverse = '%s'\n", XSTR (vp_buffer)); + fprintf (fo, "--------------\n"); + + return 0; +} + +#endif /* DEBUG_main */ diff --git a/lib/sbr/misc/fnmdef.map b/lib/sbr/misc/fnmdef.map new file mode 100644 index 0000000000000000000000000000000000000000..b7f8a0b4e31b02a86db70eda13e8cdb9e8a7f4c3 --- /dev/null +++ b/lib/sbr/misc/fnmdef.map @@ -0,0 +1,41 @@ + + Start Stop Length Name Class + 00000H 00BCBH 00BCCH FILES_TEXT CODE + 00BCCH 00BE4H 00019H GETPWD_TEXT CODE + 00BE6H 00EE3H 002FEH STRINGS_TEXT CODE + 00EE4H 00F6FH 0008CH FILEIO_TEXT CODE + 00F70H 03E62H 02EF3H _TEXT CODE + 03E64H 03E64H 00000H C_ETEXT ENDCODE + 03E70H 03EB1H 00042H NULL BEGDATA + 03EB2H 04645H 00794H _DATA DATA + 04646H 04653H 0000EH CDATA DATA + 04654H 04654H 00000H XIFB DATA + 04654H 04654H 00000H XIF DATA + 04654H 04654H 00000H XIFE DATA + 04654H 04654H 00000H XIB DATA + 04654H 04654H 00000H XI DATA + 04654H 04654H 00000H XIE DATA + 04654H 04654H 00000H XPB DATA + 04654H 04657H 00004H XP DATA + 04658H 04658H 00000H XPE DATA + 04658H 04658H 00000H XCB DATA + 04658H 04658H 00000H XC DATA + 04658H 04658H 00000H XCE DATA + 04658H 04658H 00000H XCFB DATA + 04658H 04658H 00000H XCF DATA + 04658H 04658H 00000H XCFE DATA + 04658H 0488BH 00234H CONST CONST + 0488CH 04893H 00008H HDR MSG + 04894H 04961H 000CEH MSG MSG + 04962H 04963H 00002H PAD MSG + 04964H 04964H 00001H EPAD MSG + 04966H 04E63H 004FEH _BSS BSS + 04E64H 04E64H 00000H XOB BSS + 04E64H 04E64H 00000H XO BSS + 04E64H 04E64H 00000H XOE BSS + 04E70H 0566FH 00800H STACK STACK + + Origin Group + 03E7:0 DGROUP + +Program entry point at 00F7:0010 diff --git a/lib/sbr/misc/fnmdef.o b/lib/sbr/misc/fnmdef.o new file mode 100644 index 0000000000000000000000000000000000000000..84889907134a31c6393faf2e1246c6a6d7af3e29 Binary files /dev/null and b/lib/sbr/misc/fnmdef.o differ diff --git a/lib/sbr/misc/fnmdestn.c b/lib/sbr/misc/fnmdestn.c new file mode 100644 index 0000000000000000000000000000000000000000..015115c632ea1339a21aa02038d45f0c772d3dbf --- /dev/null +++ b/lib/sbr/misc/fnmdestn.c @@ -0,0 +1,72 @@ +/* + * FILE %sbr/fnmdestn.c + * + * return the name of a transfer filename + * + * written: 1996-07-14 + * latest update: 1999-04-25 17:00:21 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +char *get_destination_name ( +char *dest_dir, /* destination directory */ +char *from, /* old filename */ +char *result, /* result buffer; malloced if NULL */ +int mk_path, /* 1 ... verify existence of path */ +int rotfnm) /* 1 ... rotate file name */ +{ + char *malloced= (char *) 0; + char *fnm; + int dest_size; + int ch; + + if (dest_dir == (char *) 0 + || from == (char *) 0 + || (dest_size= strlen (dest_dir)) == 0 + ) + return (char *) 0; + + /* prepare result; alloc buffer if not already passed as argument */ + if (result == (char *) 0 + && (result= malloced= malloc (dest_size +strlen (from)+2)) == (char *) 0 + ) + return (char *) 0; + + /* append dest_dir, a slash and the given filename */ + strcpy (result, dest_dir); + dest_size--; + + if ((ch= result [dest_size]) != '/' +#ifdef MSDOS + && ch != '\\' +#endif /* MSDOS */ + ) + { /* dest_dir does not end with a slash */ + dest_size++; + result [dest_size++]= '/'; + } + + strcpy (result+dest_size, from); + + if (rotfnm) + { + if ((fnm= get_filename_from_path (result)) == (char *) 0) + { +ERROR: + free_or_what (malloced); + return (char *) 0; + } + rotate13 (fnm); + } + + if (mk_path && make_path (result, 0x0001) != 0) goto ERROR; + + return result; +} diff --git a/lib/sbr/misc/fnmdestn.o b/lib/sbr/misc/fnmdestn.o new file mode 100644 index 0000000000000000000000000000000000000000..f6f09d853a02078e01d1af8a4a045e35a3d5c64a Binary files /dev/null and b/lib/sbr/misc/fnmdestn.o differ diff --git a/lib/sbr/misc/fnmdpath.c b/lib/sbr/misc/fnmdpath.c new file mode 100644 index 0000000000000000000000000000000000000000..bc5a0a867b697ad79f8a4dd0d4d67a5cc28c35eb --- /dev/null +++ b/lib/sbr/misc/fnmdpath.c @@ -0,0 +1,60 @@ +/* + * FILE %sbr/fnmdpath.c + * + * duplicate assumed path or get current path and place that + * stuff in a "suitably" large buffer + * T2D: REDISIGN! This could be abused with a buffer overflow if + * the calling method doesn't check! + * + * written: 1996-03-17 + * latest update: 2000-12-09 16:13:48 + * $Id: fnmdpath.c,v 1.5 2004/05/08 15:43:20 gonter Exp $ + * + */ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#ifndef MSDOS +#include <unistd.h> +#include <sys/param.h> +#endif + +#include <gg/filename.h> + +static int alloc_size; + +/* ------------------------------------------------------------------------ */ +char *duplicate_assumed_path (char *assumed_path) +{ + char *buffer; + int ap_size; + + alloc_size= MAX_FNM_LENGTH + DEF_FNM_EXTRA; + if (assumed_path != (char *) 0) + { + ap_size= strlen (assumed_path); + if (ap_size+100 > alloc_size) alloc_size= ap_size+alloc_size; + } + + if ((buffer= malloc (alloc_size)) != (char *) 0) + { + if (assumed_path == (char *) 0) + +#ifdef MSDOS + _get_current_directory (buffer); +#else + /* see t_getcwd.c for additional information about getcwd () */ + buffer= getcwd (NULL, MAXPATHLEN); +#endif + else strcpy (buffer, assumed_path); + } + + return buffer; +} + +/* ------------------------------------------------------------------------ */ +int _duplicate_assumed_path_alloc_size (void) +{ + return alloc_size; +} diff --git a/lib/sbr/misc/fnmdpath.o b/lib/sbr/misc/fnmdpath.o new file mode 100644 index 0000000000000000000000000000000000000000..234232ead7d4c9c5db7d86cb4c6c36ae383bab82 Binary files /dev/null and b/lib/sbr/misc/fnmdpath.o differ diff --git a/lib/sbr/misc/fnmovwr.c b/lib/sbr/misc/fnmovwr.c new file mode 100644 index 0000000000000000000000000000000000000000..12b6a7450b5da8b50491a2801a6e920d85c87799 --- /dev/null +++ b/lib/sbr/misc/fnmovwr.c @@ -0,0 +1,62 @@ +/* + * FILE %sbr/fnmovwr.c + * + * do not overwerite files + * + * written: 1997-09-14 + * latest update: 1997-09-14 16:15:20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <time.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/filename.h> + +static int initialized= 0; + +/* ------------------------------------------------------------------------ */ +char *alternative_filename (char *fnm, int extra) +{ + struct stat st; + char *new_name; /* newly generated filename */ + char *file_part; /* filename part of a full path */ + char *extension_part; /* extension part of original filename */ + char *new_pattern; /* format for new filename */ + int tries; + int num; + + if (fnm == (char *) 0 || *fnm == 0 + || stat (fnm, &st) != 0 + ) return (char *) 0; + + /* file already exists; find a new name */ + new_name= strdup_extra (fnm, extra+9); + file_part= get_filename_from_path (new_name); + extension_part= tell_extension (fnm); + + new_pattern= (*extension_part == 0) ? "qq%06d" : "qq%06d.%s"; + + if (!initialized) + { + srand ((int) time ((time_t *) 0)); + initialized= 1; + } + + for (tries= 10000; tries-- > 0;) + { + num= rand (); + sprintf (file_part, new_pattern, num, extension_part); + if (stat (new_name, &st) != 0) break; + } + + return new_name; +} diff --git a/lib/sbr/misc/fnmovwr.o b/lib/sbr/misc/fnmovwr.o new file mode 100644 index 0000000000000000000000000000000000000000..9c46f9383c1a186618df647057ccf97ea422ea94 Binary files /dev/null and b/lib/sbr/misc/fnmovwr.o differ diff --git a/lib/sbr/misc/fnmqueue.c b/lib/sbr/misc/fnmqueue.c new file mode 100644 index 0000000000000000000000000000000000000000..233286d00eed7930b2814ddb695d1a1a156afc52 --- /dev/null +++ b/lib/sbr/misc/fnmqueue.c @@ -0,0 +1,110 @@ +/* + * FILE %sbr/fnmqueue.c + * + * *** OBSOLETE *** + * + * Verwaltung einer Liste von Strings mit den Operationen + * o queue ... einf�gen hinten + * o push ... einf�gen vorne + * o pull ... entnehmen vorne + * + * written: 1991-03-15 + * latest update: 1996-05-06 10:43:17 + * + */ + +*** OBSOLETE *** + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdlib.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +struct FILENAMES +{ + struct FILENAMES *next; + char *fnm; +} ; + +/* ------------------------------------------------------------------------ */ +static struct FILENAMES *filenames= (struct FILENAMES *) 0; +static struct FILENAMES **fnmapp= &filenames; + +/* ------------------------------------------------------------------------ */ +int string_queue (char *fn) +{ + struct FILENAMES *f; + + f= (struct FILENAMES *) malloc (sizeof (struct FILENAMES)); + if (f == (struct FILENAMES *) 0) return -1; + + f->fnm= strdup (fn); + f->next= (struct FILENAMES *) 0; + *fnmapp= f; + fnmapp= &f->next; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int string_push (char *fn) +{ + struct FILENAMES *f; + + f= (struct FILENAMES *)malloc (sizeof (struct FILENAMES)); + if (f == (struct FILENAMES *) 0) return -1; + + f->fnm= strdup (fn); + f->next= filenames; + if (fnmapp == &filenames) /* Liste war bisher leer */ + { + fnmapp= &f->next; + } + filenames= f; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +char *string_pull () +{ + struct FILENAMES *f; + char *cp; + + if (filenames == (struct FILENAMES *) 0) return (char *) 0; + cp= filenames->fnm; + + if (&filenames->next == fnmapp) + { + free (filenames); + fnmapp= &filenames; + filenames= (struct FILENAMES *) 0; + } + else + { + f= filenames; + filenames= filenames->next; + free (f); + } + + return cp; +} + +/* ------------------------------------------------------------------------ */ +void string_reset () +{ + struct FILENAMES *f; + + while ((f= filenames) != (struct FILENAMES *) 0) + { + f=f->next; + free (filenames->fnm); + free (filenames); + filenames= f; + } +} diff --git a/lib/sbr/misc/fnmreal.c b/lib/sbr/misc/fnmreal.c new file mode 100644 index 0000000000000000000000000000000000000000..ba6859e808613ce03c7891183ca0336f201fb782 --- /dev/null +++ b/lib/sbr/misc/fnmreal.c @@ -0,0 +1,184 @@ +/* + * FILE %sbr/fnmreal.c + * + * Find absolute filename of a specified file file relative + * to a specified assumed path or the current working directory. + * + * Resolves references to the current (./) and the parrent (../) + * working directory. + * + * written: 1994-08-12 + * latest update: 1996-03-17 16:17:27 + * $Id: fnmreal.c,v 1.4 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#include <string.h> +#include <stdlib.h> +#include <gg/strings.h> +#include <gg/filename.h> + +#ifdef DEBUG +#include <stdio.h> +#define DFILE stdout +#endif + +/* ------------------------------------------------------------------------ */ +char *real_filename (const char *spec, char *assumed_path) +{ + int ch; /* examined character in specified path */ + int ch2; /* next character ... */ + char *cpath; /* buffer for correct path, large enough.. */ + char *cp; /* pointer into current path */ + int cpath_offset= 0; /* index into corrected path */ + int spec_offset= 0; /* index into examined specified path */ + int cycle= 0; + + if (spec == (char *) 0 + || (cpath= duplicate_assumed_path (assumed_path)) == (char *) 0 + ) return (char *) 0; + + /* NOTE: *spec == 0 is allowed as a refrence to the current directory. */ + /* NOTE: cpath is allocated suitably large to hold a valid filename. */ + + cpath_offset= strlen (cpath); +#ifdef DEBUG + fprintf (DFILE, "cpath='%s' cpath_offset=%d\n", cpath, cpath_offset); +#endif /* DEBUG */ + +DOITAGAIN: + cycle++; + ch= spec [spec_offset]; + ch2= spec [spec_offset+1]; +#ifdef DEBUG3 + fprintf (DFILE, "cycle=%d spec_offset=%d ch=%c ch2=%c\n", + cycle, spec_offset, ch, ch2); +#endif /* DEBUG */ + + switch (ch) + { + case 0: +#ifdef DEBUG4 + fprintf (DFILE, "ch==0: cpath_offset=%d spec_offset=%d\n", + cpath_offset, spec_offset); +#endif /* DEBUG */ + break; + + case '/': +#ifdef MSDOS + case '\\': + if (cycle == 1) + { + cpath_offset= 2; /* in DOS there's also a drive letter */ + cpath [cpath_offset]= 0; + } +#else + if (cycle == 1) + { + cpath_offset= 0; + cpath [cpath_offset]= 0; + } +#endif /* !MSDOS */ + break; + + case '.': + if (ch2 == 0) + { + spec_offset++; + break; + } + + if (ch2 == '.') + { + if ((cp= strridx (cpath, '/')) != (char *) 0 +#ifdef MSDOS + || (cp= strridx (cpath, '\\')) != (char *) 0 +#endif /* MSDOS */ + ) *cp= 0; + + spec_offset += 2; + if (spec [spec_offset] != 0) spec_offset++; + goto DOITAGAIN; + } + + if (ch2 == '/' +#ifdef MSDOS + || ch2 == '\\' +#endif /* MSDOS */ + ) + { + spec_offset += 2; + goto DOITAGAIN; + } + + /* otherwise it must be a filename (not in DOS, however) */ + + default: +#ifdef MSDOS + /* path name contains drive letter?? */ + if (cycle == 1 && ch != 0 && ch2 == ':') + { +#ifdef DEBUG + fprintf (DFILE, "drive letter: '%c%c'\n", ch, ch2); +#endif /* DEBUG */ + if (ch >= 'A' && ch <= 'Z') ch= ch - 'A' + 'a'; + cpath [0]= (char) ch; + cpath [1]= ':'; + spec_offset += 2; + ch2= spec [spec_offset]; + if (ch2 == '/' || ch2 == '\\') + { + cpath_offset= 3; + spec_offset++; + cpath [cpath_offset]= 0; +#ifdef DEBUG + fprintf (DFILE, "cpath= '%s'\n", cpath); +#endif /* DEBUG */ + goto DOITAGAIN; + } + + cpath [2]= '\\'; + getpwd (cpath+3, ch-'a'+1); +#ifdef DEBUG + fprintf (DFILE, "cpath= '%s'\n", cpath); +#endif /* DEBUG */ + goto DOITAGAIN; + } +#endif /* MSDOS */ + + cpath_offset= strlen (cpath); +#ifdef DEBUG5 + fprintf (DFILE, "[fnmreal] fixing: cpath='%s' cpath_offset=%d\n", + cpath, cpath_offset); +#endif /* DEBUG */ + +#ifdef MSDOS + if ((ch= cpath [cpath_offset-1]) != '/' && ch != '\\') + cpath [cpath_offset++]= '\\'; +#else /* MSDOS */ + if (cpath [cpath_offset-1] != '/') + cpath [cpath_offset++]= '/'; +#endif /* !MSDOS */ + cpath [cpath_offset]= 0; + + break; + } + + cpath_offset= strlen (cpath); + /* must be done, otherwise ned crashes under MSDOS... why on earth??? */ + strcpy (cpath+cpath_offset, spec+spec_offset); + +#ifdef MSDOS + if ((cpath_offset= strlen (cpath)) == 2) + { + cpath [2]= '\\'; + cpath [3]= 0; + } +#endif /* MSDOS */ + +#ifdef DEBUG + fprintf (DFILE, "[fnmreal] END: cpath='%s'\n", cpath); +#endif /* DEBUG */ + + return cpath; +} diff --git a/lib/sbr/misc/fnmreal.o b/lib/sbr/misc/fnmreal.o new file mode 100644 index 0000000000000000000000000000000000000000..ff43baf6d8dfcc2b8b7fac9b488a06581df91049 Binary files /dev/null and b/lib/sbr/misc/fnmreal.o differ diff --git a/lib/sbr/misc/fnmrenm.c b/lib/sbr/misc/fnmrenm.c new file mode 100644 index 0000000000000000000000000000000000000000..1084b187b1341de28e5d1c983d9e60f95f17995e --- /dev/null +++ b/lib/sbr/misc/fnmrenm.c @@ -0,0 +1,60 @@ +/* + * FILE %sbr/fnmrenm.c + * + * rename a file + * + * T2D: add code to overwrite the original file too + * + * written: 1996-07-14 + * latest update: 1997-05-30 12:58:14 + * + */ + +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +int filename_rename ( +char *from, /* old filename */ +char *to, /* new filename */ +int mode) /* rename mode: */ + /* 0 ... don't rename (silly) */ + /* 1 ... just rename the file */ + /* 2 ... rename the file to a rot13 version */ + /* 3 ... like 2 but don't delete dest. filename */ +{ + char *rotnm; + char *fnm; + + switch (mode) + { + default: + break; + + case 1: +NOROT: + unlink (to); + rename (from, to); + break; + + case 2: + case 3: + if ((rotnm= strdup_extra (to, 2)) == (char *) 0 + || (fnm= get_filename_from_path (rotnm)) == (char *) 0 + ) goto NOROT; + + rotate13 (fnm); + /** printf (">> rename '%s' to '%s'; fnm='%s'\n", from, rotnm, fnm); **/ + + if (mode == 2) unlink (to); + rename (from, rotnm); + free (rotnm); + break; + } + + return 0; +} diff --git a/lib/sbr/misc/fnmrenm.o b/lib/sbr/misc/fnmrenm.o new file mode 100644 index 0000000000000000000000000000000000000000..3a61872054d39715c8174aa1c6c972c387d3e79c Binary files /dev/null and b/lib/sbr/misc/fnmrenm.o differ diff --git a/lib/sbr/misc/fnmsep1.c b/lib/sbr/misc/fnmsep1.c new file mode 100644 index 0000000000000000000000000000000000000000..4a3503f99193c9bd851868e9f80e0c591f637607 --- /dev/null +++ b/lib/sbr/misc/fnmsep1.c @@ -0,0 +1,38 @@ +/* + * FILE %sbr/fnmsep1.c + * + * index of last character of path name; + * i+1 == first char of filename + * + * written: 1987 04 08 + * 1991 02 03: Revision + * 1992 02 07: FILE %ned/04/ned0419.c copied ... + * latest update: 1995-11-05 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifndef __GG_CMS__ +#include <gg/filename.h> +#endif + +/* ------------------------------------------------------------------------ */ +int isolate_path (char *s) +{ + int i= -1; + int j; + int ch; + + for (j= 0; (ch= s [j] & 0x00FF) != 0; j++) + if (ch == '/' +#ifdef MSDOS + || ch == '\\' + || ch == ':' +#endif /* MSDOS */ + ) i= j; + + return i; +} diff --git a/lib/sbr/misc/fnmsep1.o b/lib/sbr/misc/fnmsep1.o new file mode 100644 index 0000000000000000000000000000000000000000..447723b7b351bf14ba6586a9c7d1c60b70edebed Binary files /dev/null and b/lib/sbr/misc/fnmsep1.o differ diff --git a/lib/sbr/misc/fnmsep2.c b/lib/sbr/misc/fnmsep2.c new file mode 100644 index 0000000000000000000000000000000000000000..e9f094df6a74a35d95cb987d78f4478f19130cac --- /dev/null +++ b/lib/sbr/misc/fnmsep2.c @@ -0,0 +1,39 @@ +/* + * FILE %sbr/fnmsep2.c + * + * remove extension from a file name + * + * written: 1994-12-28 + * latest update: 1995-12-03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +char *remove_extension (char *s) +{ + int i; + + for (i= strlen (s)-1; i >= 0; i--) + switch (s [i] ) + { + case '.': + s [i]= 0; + +#ifdef MSDOS + case '\\': +#endif + case '/': + i= 0; + break; + } + + return s; +} + diff --git a/lib/sbr/misc/fnmsep2.o b/lib/sbr/misc/fnmsep2.o new file mode 100644 index 0000000000000000000000000000000000000000..cd8caf96c3a57ee2772dcb32b4b537a2b7fa12e1 Binary files /dev/null and b/lib/sbr/misc/fnmsep2.o differ diff --git a/lib/sbr/misc/fnmsep3.c b/lib/sbr/misc/fnmsep3.c new file mode 100644 index 0000000000000000000000000000000000000000..ceacd4b0e43152350ad77cfa8e06274c3163366e --- /dev/null +++ b/lib/sbr/misc/fnmsep3.c @@ -0,0 +1,35 @@ +/* + * FILE %sbr/fnmsep3.c + * + * return pointer to filename only from a full path + * + * written: 1995-11-05 + * latest update: 1997-09-14 16:43:56 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#ifndef __GG_CMS__ +#include <gg/filename.h> +#endif + +/* ------------------------------------------------------------------------ */ +char *get_filename_from_path (char *s) /* s.a: isolate_path */ +{ + int i; + + if (s == (char *) 0) return (char *) 0; + + for (i= strlen (s)-1; i >= 0; i--) + if (s [i] == '/' +#ifdef MSDOS + || s [i] == '\\' +#endif + ) return &s [i+1]; + + return s; +} diff --git a/lib/sbr/misc/fnmsep3.o b/lib/sbr/misc/fnmsep3.o new file mode 100644 index 0000000000000000000000000000000000000000..de70e4a4f78c5d1555aa53a59f0299774d1bf471 Binary files /dev/null and b/lib/sbr/misc/fnmsep3.o differ diff --git a/lib/sbr/misc/fnmsep4.c b/lib/sbr/misc/fnmsep4.c new file mode 100644 index 0000000000000000000000000000000000000000..506cc986ce46b29cd3560dea2c50c668668f9799 --- /dev/null +++ b/lib/sbr/misc/fnmsep4.c @@ -0,0 +1,113 @@ +/* + * FILE %sbr/fnmsep4.c + * + * return the part of p2 that is relative to p1 if p2 is a file + * in or subdirectory or the same directory as p1, otherwise p2 + * is returned. + * + * Examples: + * p1 p2 result + * "/usr/tmp/x1.c" "/usr/tmp/x2.c") "x2.c" + * + * written: 1996-11-03 + * latest update: 1996-12-29 17:10:11 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/strings.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +char *get_relative_path (char *p1, char *p2) +{ + int ml; + + for (ml= match_lng (p1, p2, 9999)-1; ml >= 0; ml--) + { + if (p1 [ml] == '/') break; + } + + if ( +#ifdef MSDOS + ml <= 3 +#else + ml <= 1 +#endif /* !MSDOS */ + || p1 [ml] != '/' + ) + return p2; + + ml++; + if (strchr (p1 + ml, '/') == (char *) 0) + { + return p2+ml; + } + + return p2; +} + +/* ------------------------------------------------------------------------ */ +#ifdef DEBUG +#include <stdio.h> +#include <stdio.h> + +struct EXAMPLE +{ + char *e_p1; + char *e_p2; + char *e_result; +} ; + +struct EXAMPLE Examples [] = +{ +/* p1 p2 result */ + { "/usr/tmp/x1.c", "/usr/tmp/x2.c", "x2.c" }, + { "/usr/tmp/x1.c", "/usr/x2.c", "/usr/x2.c" }, + { "/usr/x1.c", "/usr/tmp/x2.c", "tmp/x2.c" }, + + { (char *) 0, (char *) 0, (char *) 0 } +} ; + +int main (int argc, char *argv []); +int main (int argc, char *argv []) +{ + char *res; + int i; + int ok; + int ERRORS= 0; + struct EXAMPLE *example; + +#ifdef MSDOS + argc; argv; +#endif + + for (i= 0;; i++) + { + example= &Examples[i]; + if (example->e_p1 == (char *) 0) break; + res= get_relative_path (example->e_p1, example->e_p2); + ok= (strcmp (example->e_result, res) == 0); + + fputc ('\n', stdout); + fputs ((ok) ? "-- OK -------------------" : "** ERROR ****************", + stdout); + fputc ('\n', stdout); + + printf ("p1: '%s'\n", example->e_p1); + printf ("p2: '%s'\n", example->e_p2); + printf ("expected: '%s'\n", example->e_result); + printf ("returned: '%s'\n", res); + + fputs ("-------------------------\n\n", stdout); + + if (!ok) ERRORS++; + } + + return ERRORS; +} +#endif /* DEBUG */ diff --git a/lib/sbr/misc/fnmsep4.o b/lib/sbr/misc/fnmsep4.o new file mode 100644 index 0000000000000000000000000000000000000000..0d9473c8aa71444e1dbe2dab0fdcd8064a23b234 Binary files /dev/null and b/lib/sbr/misc/fnmsep4.o differ diff --git a/lib/sbr/misc/fopenwng.c b/lib/sbr/misc/fopenwng.c new file mode 100644 index 0000000000000000000000000000000000000000..b06815c149bf6a10e351e6a4be544197ecc04f4a --- /dev/null +++ b/lib/sbr/misc/fopenwng.c @@ -0,0 +1,39 @@ +/* + * FILE ~/usr/sbr/fopenwng.c + * + * open file and print warning, if that failed + * + * written: 1995-04-26 + * latest update: 1995-05-12 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +FILE *fopen_wng (char *fnm, char *mode) +{ + FILE *f; + + if (fnm == (char *) 0 || *fnm == 0) + { + fprintf (stderr, "wng: can't open unnamed file\n"); + return (FILE *) 0; + } + + if (mode == (char *) 0 || *mode == 0) + { + fprintf (stderr, "wng: can't open file %s without mode!\n"); + return (FILE *) 0; + } + + if ((f= fopen (fnm, mode)) == (FILE *) 0) + { + fprintf (stderr, "wng: can't open file \"%s\" in mode \"%s\"\n", + fnm, mode); + return (FILE *) 0; + } + + return f; +} diff --git a/lib/sbr/misc/fparslin.c b/lib/sbr/misc/fparslin.c new file mode 100644 index 0000000000000000000000000000000000000000..606d61eb7d8c835dd9cbac043d7247825ebcf16a --- /dev/null +++ b/lib/sbr/misc/fparslin.c @@ -0,0 +1,61 @@ +/* + * FILE c:/usr/sbr/fparslin.c + * + * Parsen von Zeilen + * + * written: 1989 03 18: extrahiert aus fscanlin.c + * latest update: 1994-12-13 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +int fpars_line ( +char *line, /* Pufferbereich fuer Zeile */ +int comment, /* Kommentarzeichen (z.b. '#') */ +int in_flags, /* Input Flags: siehe FCLI_xxxxx */ +char *parse_line [], /* Zeiger auf geparste Zeilenelemente */ +int parse_pos [], /* Position der geparsten Zeilenelemente */ +int *parse_cnt, /* tatsaechlich gelesene Zeilenelemente */ +int *out_flags) /* Output Flags: siehe FCLO_xxxx */ +/* RETURN: EOF wenn fgetc EOF liefert */ +/* EOF wenn keine Zeile mehr geparst werden kann */ +/* 0 alles ok */ +{ + int i, ch, st, ls; + register char *cp; + +#ifdef MSDOS + in_flags; +#endif + + *parse_cnt= *out_flags = 0; + + if ((ls = strlen (line)) == 0) return 0; + + /* Zeile Parsen */ + cp = line; st = 0; + for (i = 0; i < ls; i++) + { if ((ch = *cp) == comment) break; + switch (ch) + { case 0x20: case 0x09: /* Blanks und Tabs */ + if (st == 1) + { *cp = 0; st = 0; + } + break; + default : /* irgendein Zeichen */ + if (st == 0) + { parse_line [*parse_cnt] = cp; + parse_pos [*parse_cnt] = i; + (*parse_cnt)++; + st = 1; + } + break; + } + cp++; + } + return 0; +} diff --git a/lib/sbr/misc/freadit.c b/lib/sbr/misc/freadit.c new file mode 100644 index 0000000000000000000000000000000000000000..bbf5d4569196f72e6b9c6a0cca23ce1da73b8f0f --- /dev/null +++ b/lib/sbr/misc/freadit.c @@ -0,0 +1,36 @@ +/* + * FILE %sbr/freadit.c + * + * read integer table + * + * written: 1994-10-08 + * latest update: 1994-10-08 + * $Id: freadit.c,v 1.2 2003/06/25 14:38:29 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/sbr.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int fread_integer_table ( +FILE *f, +long int_table [], +int table_size, +char *buffer, +int buffer_size) +{ + int table_cnt= 0; + int rc; + + for (;;) + { + if (table_cnt >= table_size) break; + rc= fread_line (f, buffer, buffer_size); + if (rc <= 0 && feof (f)) break; + int_table [table_cnt++]= get_parameter_value (buffer); + } + + return table_cnt; +} diff --git a/lib/sbr/misc/freadit.o b/lib/sbr/misc/freadit.o new file mode 100644 index 0000000000000000000000000000000000000000..4b55366e2ae3506dea72cf9682bc5361fdc72131 Binary files /dev/null and b/lib/sbr/misc/freadit.o differ diff --git a/lib/sbr/misc/freaditf.c b/lib/sbr/misc/freaditf.c new file mode 100644 index 0000000000000000000000000000000000000000..5eba348e8f67be2681c69eee569b802c06d2ddec --- /dev/null +++ b/lib/sbr/misc/freaditf.c @@ -0,0 +1,34 @@ +/* + * FILE %sbr/freaditf.c + * + * read integer table + * + * written: 1994-10-08 + * latest update: 1994-10-08 + * $Id: freaditf.c,v 1.2 2003/06/25 14:38:29 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +int fread_integer_table_file ( +char *fnm, +long int_table [], +int table_size, +char *buffer, +int buffer_size) +{ + FILE *f; + int table_cnt= 0; + + if ((f= fopen (fnm, "rb")) != (FILE *) 0) + { + table_cnt= fread_integer_table (f, int_table, table_size, + buffer, buffer_size); + fclose (f); + } + + return table_cnt; +} diff --git a/lib/sbr/misc/freaditf.o b/lib/sbr/misc/freaditf.o new file mode 100644 index 0000000000000000000000000000000000000000..2aefe5a3f79f06400a56bdb5534ef56f180ceb0b Binary files /dev/null and b/lib/sbr/misc/freaditf.o differ diff --git a/lib/sbr/misc/freadlin.c b/lib/sbr/misc/freadlin.c new file mode 100644 index 0000000000000000000000000000000000000000..04987615b0394ceeaa5109e08b94337a531a3072 --- /dev/null +++ b/lib/sbr/misc/freadlin.c @@ -0,0 +1,81 @@ +/* + * FILE %sbr/freadlin.c + * + * read exactly one line, nothing more, nothing less. + * take care of the buffer and discard additional characters + * and carriage returns and line feeds + * + * written: 1989 03 18: extracted from /usr/ned/testprnt.c + * 1990 10 13: revision + * 1993-02-02: small revision + * latest update: 1997-11-02 17:42:19 + * $Id: freadlin.c,v 1.2 2001/12/19 08:07:49 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#define EOLN 0x000A +#define IGNORE_CR + +#ifdef MAC_MODE +#define fread_line fread_mac_line +#undef EOLN +#define EOLN 0x000D +#undef IGNORE_CR +#endif + +#ifdef __CMS__ +#undef EOLN +#define EOLN '\n' +#undef IGNORE_CR +#endif + +/* ------------------------------------------------------------------------ */ +int fread_line ( +FILE *fi, /* file to read from */ +char *p, /* line buffer */ +int c) /* size of line buffer */ +/* RETURNS: < 0 ... error or END-OF-FILE */ +/* = 0 ... empty line */ +/* > 0 ... number of characters read into line buffer */ +/* REMARKS: if c is smaller than the length of line, then the */ +/* remaining characters in the line are read away. */ +/* RETURN-characters (0x0D) are ignored */ +{ + int k; /* character read from the input file */ + int r= 0; /* number of the character in the buffer */ + + if (p == (char *) 0) c= 0; /* no buffer, just read over line! */ + else p[0]= 0; /* clear the buffer, for if it's EOF */ + if (feof (fi)) return -1; /* file at EOF; report this ... */ + + c--; /* the last character will be 0x00 */ + + for (;;) + { + k= fgetc (fi) & 0x00FF; /* we treat the character as unsigned ... */ + /* ... as it should be! */ + if (feof (fi)) break; /* nothing more to read, this is *no* error */ + +#ifdef IGNORE_CR + if (k == 0x000D) continue; /* Carriage Return is ignored */ +#endif /* IGNORE_CR */ + + if (k == EOLN) break; /* Line Feed is *our* end-of-line */ + + if (c <= 0) continue; /* read away characters past the buffer */ + *p++ = (char) k; + c--; + r++; + } + + if (r >= 0) *p= 0x00; /* terminate the buffer ... */ + return r; /* ... and report, how many characters */ + /* are in the buffer */ +} diff --git a/lib/sbr/misc/freadlin.o b/lib/sbr/misc/freadlin.o new file mode 100644 index 0000000000000000000000000000000000000000..baf386dfa77b87def71eadba334c8c44d4c18dea Binary files /dev/null and b/lib/sbr/misc/freadlin.o differ diff --git a/lib/sbr/misc/freadst.c b/lib/sbr/misc/freadst.c new file mode 100644 index 0000000000000000000000000000000000000000..e455db699c5b620b0c1b2f1e0ea4ba815feae131 --- /dev/null +++ b/lib/sbr/misc/freadst.c @@ -0,0 +1,36 @@ +/* + * FILE ~/usr/sbr/freadst.c + * + * read string table + * + * written: 1994-10-08 + * latest update: 1994-11-06 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +int fread_string_table ( +FILE *f, +char *string_table [], +int table_size, +char *buffer, +int buffer_size) +{ + int table_cnt= 0; + int rc; + + for (;;) + { + if (table_cnt >= table_size) break; + rc= fread_line (f, buffer, buffer_size); + if (rc <= 0 && feof (f)) break; + string_table [table_cnt++]= strdup (buffer); + } + + return table_cnt; +} diff --git a/lib/sbr/misc/freadst.o b/lib/sbr/misc/freadst.o new file mode 100644 index 0000000000000000000000000000000000000000..3678e9cf5466b728b7e16ff1a288f416fbe993ef Binary files /dev/null and b/lib/sbr/misc/freadst.o differ diff --git a/lib/sbr/misc/freadstf.c b/lib/sbr/misc/freadstf.c new file mode 100644 index 0000000000000000000000000000000000000000..b920d8948e7cb044029347bd27dede90ecc67c63 --- /dev/null +++ b/lib/sbr/misc/freadstf.c @@ -0,0 +1,33 @@ +/* + * FILE ~/usr/sbr/freadstf.c + * + * read string table + * + * written: 1994-10-08 + * latest update: 1994-10-08 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +int fread_string_table_file ( +char *fnm, +char *string_table [], +int table_size, +char *buffer, +int buffer_size) +{ + FILE *f; + int table_cnt= 0; + + if ((f= fopen (fnm, "rb")) != (FILE *) 0) + { + table_cnt= fread_string_table (f, string_table, table_size, + buffer, buffer_size); + fclose (f); + } + + return table_cnt; +} diff --git a/lib/sbr/misc/freadstf.o b/lib/sbr/misc/freadstf.o new file mode 100644 index 0000000000000000000000000000000000000000..0b1676a9092b622ddbca4dc046b07fcdf2ca933d Binary files /dev/null and b/lib/sbr/misc/freadstf.o differ diff --git a/lib/sbr/misc/frmaclin.o b/lib/sbr/misc/frmaclin.o new file mode 100644 index 0000000000000000000000000000000000000000..57ed57216287cdfc5079276a45e3d46ffc5ce074 Binary files /dev/null and b/lib/sbr/misc/frmaclin.o differ diff --git a/lib/sbr/misc/fscanlin.c b/lib/sbr/misc/fscanlin.c new file mode 100644 index 0000000000000000000000000000000000000000..44ca3d952bdc1339a934c0e7a10fddf16b45ef8b --- /dev/null +++ b/lib/sbr/misc/fscanlin.c @@ -0,0 +1,90 @@ +/* + * FILE ~/usr/sbr/fscanlin.c + * + * Lesen und Parsen von Zeilen aus einem File + * + * written: 1988 09 03 + * latest update: 1994-12-13 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +int fscan_line ( +FILE *fi, /* gelesenes File */ +char *line, /* Pufferbereich fuer Zeile */ +int max_line, /* Groesse von line */ +int max_par, /* maximale Zahl der geparsten Zeichen */ + /* <<<< nicht verwendet !!! */ +int comment, /* Kommentarzeichen (z.b. '#') */ +int in_flags, /* Input Flags: siehe FCLI_xxxxx */ + /* <<<< nicht verwendet !!! */ +char *parse_line [], /* Zeiger auf geparste Zeilenelemente */ +int parse_pos [], /* Position der geparsten Zeilenelemente */ +int *parse_cnt, /* tatsaechlich gelesene Zeilenelemente */ +int *out_flags) /* Output Flags: siehe FCLO_xxxx */ +/* RETURN: EOF wenn fgetc EOF liefert */ +/* EOF wenn keine Zeile mehr geparst werden kann */ +/* 0 alles ok */ +{ + int i, ch, st; + int ls; /* Line Size */ + register char *cp; + +#ifdef MSDOS + max_par; + in_flags; +#endif + + max_line--; + cp= line; + *parse_cnt= *out_flags = 0; + + for (;;) + { /* Zeile einlesen */ + for (ls= 0; ls < max_line; ls++) + { + ch= fgetc (fi) & 0x00FF; + if (ch == -1 || ch == 0x0D || ch == 0x0A) break; + *cp++= (char) ch; + } + + *cp = 0; + if (ch == -1 && ls == 0) return -1; /* nothing else could be read */ + if (ls == 0) continue; /* bei Leerzeile weiterlesen */ + + /* Zeile Parsen */ + cp= line; + st= 0; + for (i= 0; i < ls; i++) + { + if ((ch= *cp) == comment) break; + switch (ch) + { + case 0x20: case 0x09: /* Blanks und Tabs */ + if (st == 1) + { + *cp = 0; st = 0; + } + break; + default: /* irgendein Zeichen */ + if (st == 0) + { + parse_line [*parse_cnt] = cp; + parse_pos [*parse_cnt] = i; + (*parse_cnt)++; + st= 1; + } + break; + } + cp++; + } + + if (*parse_cnt) + { /* es wurde etwas ge'parse't */ + return 0; + } + } +} diff --git a/lib/sbr/misc/fsopen.c b/lib/sbr/misc/fsopen.c new file mode 100644 index 0000000000000000000000000000000000000000..820cb5d62042b7c59361e607b8a0f5114b66cd0e --- /dev/null +++ b/lib/sbr/misc/fsopen.c @@ -0,0 +1,73 @@ +/* + * FILE /usr/sbr/fsopen.c + * + * File Open in Shared Mode + * + * 1988 03 07 + * + * Include Files: <stdio.h> + * <share.h> + * <fcntl.h> + * + */ + +#include <stdio.h> +#include <fcntl.h> +#include <io.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/sbr.h> + +# pragma check_stack(off) + +# define PMODE S_IREAD | S_IWRITE /* Archive File */ + +extern int _doserrno; + +/* ------------------------------------------------------------------------ */ +FILE *fsopen ( +char *file_name, /* Filename des zu �ffnenden Files */ +char *file_mode, /* fopen (file_name, file_mode); */ +unsigned int open_mode, /* open (file_name, open_mode); */ +int share_mode, /* Share Codes */ +int retry, /* Zahl der Versuche */ +int *err) /* DOS Error Code; Fehlercode */ +/* RETURN: file_pointer (Stream); err := 0 */ +/* (FILE *) 0 --> File not opened; err := Fehlercode */ +{ + int fp; + + for (;;) + { +RETRY: + fp = sopen (file_name, open_mode, share_mode); + if (fp >= 0) break; + +/************************ +printf ("sopen: _doserrno = %04x %3d\n", _doserrno, _doserrno); +getch (); +************************/ + + if (_doserrno == 2) /* File not found: */ + if ((open_mode & 0x000F) == O_RDONLY) + { + return (FILE *) 0; + *err = _doserrno; + } + else + { + fp = creat (file_name, PMODE); + close (fp); + goto RETRY; + } + + if (--retry <= 0) + { + return (FILE *) 0; + *err = _doserrno; + } + } + *err = 0; + + return fdopen (fp, file_mode); +} diff --git a/lib/sbr/misc/ftopen.c b/lib/sbr/misc/ftopen.c new file mode 100644 index 0000000000000000000000000000000000000000..3b158cdf5856facefa0f02e19ab27321e52f9d7b --- /dev/null +++ b/lib/sbr/misc/ftopen.c @@ -0,0 +1,56 @@ +/* + * FILE ~/usr/sbr/ftopen.c + * + * file open in shared mode + * + * include files: <stdio.h> + * <share.h> + * <fcntl.h> + * + * written: 1988 03 07 + * latest update: 1994-07-31 + * + */ + +#include <stdio.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#define PMODE S_IREAD | S_IWRITE /* Archive File */ + +extern int _doserrno; + +/* ------------------------------------------------------------------------ */ +FILE *ftopen ( +char *file_name, /* Filename des zu oeffnenden Files */ +char *file_mode, /* fopen (file_name, file_mode); */ +int open_mode, /* open (file_name, open_mode); */ +int share_mode, /* Share Codes */ +int *err) /* DOS Error Code; Fehlercode */ +/* RETURN: file_pointer (Stream); err := 0 */ +/* (FILE *) 0 --> File not opened; err := Fehlercode */ +{ + long rv; + + open_mode; + share_mode; + + rv= topen (file_name, 0x20); /* ###################### */ + /* open_mode umsetzen !!! */ + /* ###################### */ + if (rv & 0xFFFF0000L) + { + *err= (int) rv; + return (FILE *) 0; + } + + *err= 0; + + return fdopen ((int) (rv & 0x0000FFFFL), file_mode); +} diff --git a/lib/sbr/misc/ftrans01.c b/lib/sbr/misc/ftrans01.c new file mode 100644 index 0000000000000000000000000000000000000000..3cb2f27d3c7e59e92fada395d88731b7bfdf97df --- /dev/null +++ b/lib/sbr/misc/ftrans01.c @@ -0,0 +1,36 @@ +/* + * FILE %sbr/ftrans01.c + * + * Transfer some range of a file to another one. + * + * see also: ftrans09.c : ftransfer_add_dot (...) + * + * written: 1990-09-20 + * latest update: 1995-12-10 + * $Id: ftrans01.c,v 1.2 2002/01/27 23:01:48 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long ftransfer (FILE *fi, FILE *fo, long cpy_size) +{ + int ch; + long fsiz= 0L; + + for (; cpy_size > 0L; cpy_size--) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + fputc (ch, fo); + fsiz++; + } + + return fsiz; +} diff --git a/lib/sbr/misc/ftrans01.o b/lib/sbr/misc/ftrans01.o new file mode 100644 index 0000000000000000000000000000000000000000..b9c6628dfa98d9b29f06325433d3e7a19701f888 Binary files /dev/null and b/lib/sbr/misc/ftrans01.o differ diff --git a/lib/sbr/misc/ftrans02.c b/lib/sbr/misc/ftrans02.c new file mode 100644 index 0000000000000000000000000000000000000000..eba1cf1b7bba2c358c26b90ba33918f224756e46 --- /dev/null +++ b/lib/sbr/misc/ftrans02.c @@ -0,0 +1,39 @@ +/* + * FILE %sbr/ftrans02.c + * + * Transfer some range of a disk file to another. + * The file is opened, the transfer initiated and then closed again. + * + * written: 1993-09-28 + * latest update: 1996-12-03 22:27:22 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long f2transfer (char *fi_nm, FILE *fo, long cpy_start, long cpy_size) +{ + long rc; + FILE *fi; + + if (strcmp ("-", fi_nm) == 0) + { + rc= ftransfer_del_dot (stdin, fo, cpy_size); + } + else + { + if ((fi= fopen (fi_nm, "rb")) == (FILE *) 0) return -1L; + if (cpy_start > 0L) fseek (fi, cpy_start, 0); + rc= ftransfer (fi, fo, cpy_size); + fclose (fi); + } + + return rc; +} diff --git a/lib/sbr/misc/ftrans02.o b/lib/sbr/misc/ftrans02.o new file mode 100644 index 0000000000000000000000000000000000000000..caea95d10f83ea2bebb7cd625d54b5fcffa6e01a Binary files /dev/null and b/lib/sbr/misc/ftrans02.o differ diff --git a/lib/sbr/misc/ftrans03.c b/lib/sbr/misc/ftrans03.c new file mode 100644 index 0000000000000000000000000000000000000000..31770a6b7bb4a6132d0df0b79755d8b72f50f828 --- /dev/null +++ b/lib/sbr/misc/ftrans03.c @@ -0,0 +1,39 @@ +/* + * FILE %sbr/ftrans03.c + * + * Transfer some range of a disk file to another. + * The file is opened, the transfer initiated and then closed again. + * + * written: 1994-05-29 + * latest update: 1996-10-12 12:07:59 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long f3transfer (char *fi_nm, char *fo_nm, long cpy_start, long cpy_size) +{ + long rc; + FILE *fi; + FILE *fo; + + if ((fi= fopen (fi_nm, "rb")) == (FILE *) 0) return -1L; + if ((fo= fopen (fo_nm, "wb")) == (FILE *) 0) + { + fclose (fi); + return -1L; + } + + if (cpy_start > 0L) fseek (fi, cpy_start, 0); + rc= ftransfer (fi, fo, cpy_size); + fclose (fi); + fclose (fo); + + return rc; +} diff --git a/lib/sbr/misc/ftrans03.o b/lib/sbr/misc/ftrans03.o new file mode 100644 index 0000000000000000000000000000000000000000..525030f7db4b0d376d436296050c36b79b93be23 Binary files /dev/null and b/lib/sbr/misc/ftrans03.o differ diff --git a/lib/sbr/misc/ftrans04.c b/lib/sbr/misc/ftrans04.c new file mode 100644 index 0000000000000000000000000000000000000000..c9c19988627c68d0c38d9c282c128826e34f8810 --- /dev/null +++ b/lib/sbr/misc/ftrans04.c @@ -0,0 +1,64 @@ +/* + * FILE %sbr/ftrans04.c + * + * Transfer some range of a file to another one as a SHAR file block + * see also %sbr/ftrans.c + * + * written: 1994-07-23: extracted from %usr/utl/shar.c + * latest update: 1996-10-13 20:38:34 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long ftransfer_to_shar ( +FILE *fi, +FILE *SHAR, +char *fnm, +long cpy_size, +char *st_dat_buffer) +{ + int ch; + long fsiz= 0L; + int status= 0; + + fprintf (SHAR, "echo shar: extracting %s\n", fnm); + fprintf (SHAR, "sed 's/^X//' << \\SHAR_EOF > %s\n", fnm); + + for (; cpy_size > 0L; cpy_size--) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + if (status == 0) fputc ('X', SHAR); + status= 1; + fputc (ch, SHAR); + fsiz++; + if (ch == 0x0A) status= 0; + } + + if (status != 0) fputc (0x0A, SHAR); + + fprintf (SHAR, "SHAR_EOF\n"); + +/*fprintf (SHAR, "echo shar: file %s expected size %ld byte\n", fnm, fsiz);*/ +/*fprintf (SHAR, "if test %ld -ne \"\`wc -c %s\`\"\n", fsiz, fnm);*/ + + if (st_dat_buffer != (char *) 0 && *st_dat_buffer) + { + fprintf (stderr, "[%s] ", st_dat_buffer); + fprintf (SHAR, "touch -t%s %s\n", st_dat_buffer, fnm); + } + fprintf (SHAR, "if test %ld -ne \"`cat %s | wc -c`\"\n", fsiz, fnm); + fprintf (SHAR, "then\n"); + fprintf (SHAR, "echo shar: error transmitting %s: %ld byte expected!\n", + fnm, fsiz); + fprintf (SHAR, "fi\n"); + + return fsiz; +} diff --git a/lib/sbr/misc/ftrans04.o b/lib/sbr/misc/ftrans04.o new file mode 100644 index 0000000000000000000000000000000000000000..6e35d4497b03fa9554bb3906dfa5cac063024256 Binary files /dev/null and b/lib/sbr/misc/ftrans04.o differ diff --git a/lib/sbr/misc/ftrans05.c b/lib/sbr/misc/ftrans05.c new file mode 100644 index 0000000000000000000000000000000000000000..8d24eaf1d72c7d56541146ffbacb5fbf8382b110 --- /dev/null +++ b/lib/sbr/misc/ftrans05.c @@ -0,0 +1,41 @@ +/* + * FILE %sbr/ftrans05.c + * + * Transfer some range of a disk file to another. + * The file is opened, the transfer initiated and then closed again. + * + * written: 1994-07-23: extracted from %usr/utl/shar.c + * latest update: 1995-09-10 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long f5transfer_to_shar ( +char *fi_nm, +FILE *SHAR, +char *fnm, +long cpy_start, +long cpy_size, +char *fi_buf, +int shar_bufsiz, +char *st_dat_buffer) +{ + long rc; + FILE *fi; + + if ((fi= fopen (fi_nm, "rb")) == (FILE *) 0) return -1L; + setvbuf (fi, fi_buf, _IOFBF, shar_bufsiz); + + if (cpy_start > 0L) fseek (fi, cpy_start, 0); + rc= ftransfer_to_shar (fi, SHAR, fnm, cpy_size, st_dat_buffer); + fclose (fi); + + return rc; +} diff --git a/lib/sbr/misc/ftrans05.o b/lib/sbr/misc/ftrans05.o new file mode 100644 index 0000000000000000000000000000000000000000..9eda3b4eb02a2feb1b0eca71e1e05fa8d84823c8 Binary files /dev/null and b/lib/sbr/misc/ftrans05.o differ diff --git a/lib/sbr/misc/ftrans06.c b/lib/sbr/misc/ftrans06.c new file mode 100644 index 0000000000000000000000000000000000000000..aa83ce270cd4fc8d4244a94c1670e1078fde4c3c --- /dev/null +++ b/lib/sbr/misc/ftrans06.c @@ -0,0 +1,36 @@ +/* + * FILE %sbr/ftrans06.c + * + * Transfer some range of a file to another one but only + * up to a line feed. + * + * written: 1994-07-31 + * latest update: 1995-10-20 + * $Id: ftrans06.c,v 1.2 2001/12/19 08:07:49 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long ftransfer_line (FILE *fi, FILE *fo, long cpy_size) +{ + int ch; + long fsiz= 0L; + + for (; cpy_size > 0L; cpy_size--) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + fputc (ch, fo); + fsiz++; + if (ch == '\n') break; + } + + return fsiz; +} diff --git a/lib/sbr/misc/ftrans06.o b/lib/sbr/misc/ftrans06.o new file mode 100644 index 0000000000000000000000000000000000000000..af4e012fc4e90d2398bd47827c6561aef3f3c12e Binary files /dev/null and b/lib/sbr/misc/ftrans06.o differ diff --git a/lib/sbr/misc/ftrans07.c b/lib/sbr/misc/ftrans07.c new file mode 100644 index 0000000000000000000000000000000000000000..ac556de44c6e92e4778031365c1fc4aa817ee7c4 --- /dev/null +++ b/lib/sbr/misc/ftrans07.c @@ -0,0 +1,34 @@ +/* + * FILE %sbr/ftrans07.c + * + * Transfer some range of a file to another one. + * + * written: 1994-10-31: cloned from ftransfer() + * latest update: 1996-10-12 12:09:33 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long ftransfer_crlf (FILE *fi, FILE *fo, long cpy_size) +{ + int ch; + long fsiz= 0L; + + for (; cpy_size > 0L; cpy_size--) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + if (ch == '\n') fputc ('\r', fo); + fputc (ch, fo); + fsiz++; + } + + return fsiz; +} diff --git a/lib/sbr/misc/ftrans07.o b/lib/sbr/misc/ftrans07.o new file mode 100644 index 0000000000000000000000000000000000000000..1dee51d4aa91c24b649d4eba4d2a6e46801d8afd Binary files /dev/null and b/lib/sbr/misc/ftrans07.o differ diff --git a/lib/sbr/misc/ftrans08.c b/lib/sbr/misc/ftrans08.c new file mode 100644 index 0000000000000000000000000000000000000000..4ae5f8cfd863296656b63f2755a08bf02b3de4c6 --- /dev/null +++ b/lib/sbr/misc/ftrans08.c @@ -0,0 +1,32 @@ +/* + * FILE %sbr/ftrans08.c + * + * Transfer some range of a disk file to another. + * The file is opened, the transfer initiated and then closed again. + * + * written: 1994-10-31: cloned from f2transfer + * latest update: 1996-10-12 12:10:12 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long f2transfer_crlf (char *fi_nm, FILE *fo, long cpy_start, long cpy_size) +{ + long rc; + FILE *fi; + + if ((fi= fopen (fi_nm, "rb")) == (FILE *) 0) return -1L; + + if (cpy_start > 0L) fseek (fi, cpy_start, 0); + rc= ftransfer_crlf (fi, fo, cpy_size); + fclose (fi); + + return rc; +} diff --git a/lib/sbr/misc/ftrans08.o b/lib/sbr/misc/ftrans08.o new file mode 100644 index 0000000000000000000000000000000000000000..c00fc084f0c553691791174a042bb31272c6c4ff Binary files /dev/null and b/lib/sbr/misc/ftrans08.o differ diff --git a/lib/sbr/misc/ftrans09.c b/lib/sbr/misc/ftrans09.c new file mode 100644 index 0000000000000000000000000000000000000000..53c7c10bbda87fd4db2c47e784c359a1cf025901 --- /dev/null +++ b/lib/sbr/misc/ftrans09.c @@ -0,0 +1,84 @@ +/* + * FILE %sbr/ftrans09.c + * + * Transfer some range of a file to another one. + * add a line with a single dot at the end of the file + * + * see also: ftrans01.c : ftransfer (...) + * + * written: 1996-10-10 + * latest update: 1996-12-03 22:19:06 + * $Id: ftrans09.c,v 1.2 2002/01/27 23:01:48 gonter Exp $ + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long ftransfer_add_dot (FILE *fi, FILE *fo, long cpy_size) +{ + int ch= 0; /* character read from file */ + long fsiz= 0L; /* bytes (without padded dots) transfered */ + int status= 0; + + for (; cpy_size > 0L; cpy_size--) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + + switch (status) + { + case 0: /* begin of the line */ + if (ch == '.') status= 1; + else if (ch != '\n') status= 2; + break; + + case 1: /* dots at the begin of the line */ + if (ch == '\r') + { + status= 3; + continue; /* wait and see if there is a LF coming */ + } + else if (ch == '\n') + { + fputc ('.', fo); + status= 0; + } + else if (ch != '.') status= 2; + break; + + case 2: /* any character */ + if (ch == '\n') status= 0; + break; + + case 3: /* CR after lines with dots only */ + if (ch == '\n') /* CF LF on a line with dots only */ + { + fputc ('.', fo); + fputc ('\r', fo); + fsiz++; + status= 0; + } + else /* something else, CR is spurious */ + { + fputc ('\r', fo); + status= 2; + } + break; + } + + fputc (ch, fo); + fsiz++; + } + + if (ch != '\n') /* the ending dot must be on a line of its */ + fputc ('\n', fo); /* own, otherwise it would not be */ + fputs (".\n", fo); /* recognized as the end of the stream! */ + + return fsiz; +} diff --git a/lib/sbr/misc/ftrans09.o b/lib/sbr/misc/ftrans09.o new file mode 100644 index 0000000000000000000000000000000000000000..d03b715efef2659eb477012fea8025eb765bf184 Binary files /dev/null and b/lib/sbr/misc/ftrans09.o differ diff --git a/lib/sbr/misc/ftrans10.c b/lib/sbr/misc/ftrans10.c new file mode 100644 index 0000000000000000000000000000000000000000..939e678a9061bd798e01790d7ab7fdd8ae1b3e21 --- /dev/null +++ b/lib/sbr/misc/ftrans10.c @@ -0,0 +1,109 @@ +/* + * FILE %sbr/ftrans10.c + * + * Transfer some range of a file to another one. + * + * written: 1996-10-12 + * latest update: 1996-12-03 22:26:48 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long ftransfer_del_dot (FILE *fi, FILE *fo, long cpy_size) +{ + int ch; + long fsiz= 0L; + int status= 0; + int dots= 0; + + for (; cpy_size > 0L; cpy_size--) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + + switch (status) + { + case 0: /* begin of the line */ + if (ch == '.') + { + status= 1; + dots= 1; + continue; /* don't issue that character */ + } + else if (ch != '\n') status= 2; + break; + + case 1: /* dots at the begin of the line */ + if (ch == '\r') + { + status= 3; + continue; /* wait and see if there is a LF coming */ + } + else if (ch == '\n') + { + if (dots == 1) + { +#ifdef TEST_NOT_NOW +1996-12-03 22:22:30 NOTE, Test +The complete line is the End-Of-Stream symbol. + fputc ('\n', fo); + fsiz++; +#endif /* TEST_NOT_NOW */ + goto DONE; + } + status= 0; + } + else if (ch == '.') dots++; + else + { + fputc ('.', fo); + fsiz++; + status= 2; + } + break; + + case 2: /* any character */ + if (ch == '\n') status= 0; + break; + + case 3: /* CR after lines with dots only */ + if (ch == '\n') /* CF LF on a line with dots only */ + { + if (dots == 1) + { +#ifdef TEST_NOT_NOW +1996-12-03 22:26:05 see above... + fputc ('\r', fo); + fputc ('\n', fo); + fsiz += 2; +#endif /* TEST_NOT_NOW */ + goto DONE; + } + fsiz++; + fputc ('\r', fo); + status= 0; + } + else /* something else, CR is spurious */ + { + fputc ('.', fo); + fputc ('\r', fo); + fsiz += 2; + status= 2; + } + break; + } + + fputc (ch, fo); + fsiz++; + } + +DONE: + return fsiz; +} diff --git a/lib/sbr/misc/ftrans10.o b/lib/sbr/misc/ftrans10.o new file mode 100644 index 0000000000000000000000000000000000000000..6af35dd0a0ee10bf3c9cac5395959becddaeff52 Binary files /dev/null and b/lib/sbr/misc/ftrans10.o differ diff --git a/lib/sbr/misc/gennednm.c b/lib/sbr/misc/gennednm.c new file mode 100644 index 0000000000000000000000000000000000000000..89ed4811c566cfe5a586251b655f6d12287f5222 --- /dev/null +++ b/lib/sbr/misc/gennednm.c @@ -0,0 +1,131 @@ +/* + * FILE %sbr/genbaknm.c + * + * File I/O: Backup File Name erzeugen + * + * written: 1990 05 20 + * 1991 02 03: Revision + * latest update: 1996-03-18 12:02:07 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/filename.h> + +#ifdef __HPUX__ +@@@ +#define S_IFDIR _S_IFDIR +#endif + +static char *NED_DIR= "_bak_ftr.ned"; + +/* ------------------------------------------------------------------------ */ +char *generate_ned_name (char *fnm, char *ext, int check_subdir) +{ + int ii, jj; + int idx; + int ch; + struct stat st; + char *used_ned_name; + + if (fnm == (char *) 0 || *fnm == 0) return (char *) 0; + +#ifdef DEBUG + printf ("generate_ned_name (fnm='%s', ext='%s')\n", fnm, ext); +#endif /* DEBUG */ + + ii= isolate_path (fnm); + + used_ned_name= malloc (strlen (fnm) + strlen (NED_DIR) + strlen (ext) + 5); + + strncpy (used_ned_name, fnm, ii+1); + strcpy (used_ned_name +ii+1, NED_DIR); + +#ifdef DEBUG + printf ("ned_dir='%s'\n", used_ned_name); +#endif /* DEBUG */ + + if ((stat (used_ned_name, &st) == 0 && (st.st_mode & S_IFDIR)) + || !check_subdir + ) + { +#ifdef DEBUG + printf ("ned_dir exists\n"); +#endif /* DEBUG */ + idx= strlen (used_ned_name); + used_ned_name [idx++]= '/'; + strcpy (used_ned_name + idx, fnm +ii+1); + } + else + { +#ifdef DEBUG + printf ("ned_dir does not exist\n"); +#endif /* DEBUG */ + strcpy (used_ned_name, fnm); + } + +#ifdef DEBUG + printf ("used_ned_name='%s'\n", used_ned_name); +#endif /* DEBUG */ + + for (ii= (jj= strlen (used_ned_name))-1; ii >= 0; ii--) + switch (used_ned_name [ii]) + { + case '.': + /* check if filename has the form .cshrc or so */ + if (ii > 0 + && ((ch= used_ned_name [ii-1] & 0x00FF) == '/' +#ifdef MSDOS + || ch == '\\' + || ch == ':' +#endif /* MSDOS */ + ) + ) goto BREAK; + + jj= ii; + break; + case '/': +#ifdef MSDOS + case ':': + case '\\': +#endif /* MSDOS */ + goto BREAK; + } + +BREAK: + strcpy (used_ned_name + jj, ext); + + return used_ned_name; +} + +#ifdef DEBUG +static char line [100]; + +int main (void); +int main () +{ + char *ftr_name, *bak_name; + + for (;;) + { + printf ("Filename: "); + scanf ("%s", line); + ftr_name= generate_ned_name (line, ".ftr", 1); + bak_name= generate_ned_name (line, ".bak", 1); + printf ("ftr: %s\n", ftr_name); + printf ("bak: %s\n", bak_name); + printf ("-----------------------\n"); + } + + return 0; +} + +#endif /* DEBUG */ diff --git a/lib/sbr/misc/gennednm.o b/lib/sbr/misc/gennednm.o new file mode 100644 index 0000000000000000000000000000000000000000..59a053eb0de25c664964fd48dc71379929659e54 Binary files /dev/null and b/lib/sbr/misc/gennednm.o differ diff --git a/lib/sbr/misc/getcdir0.c b/lib/sbr/misc/getcdir0.c new file mode 100644 index 0000000000000000000000000000000000000000..2c32d6ada667a2d9913a7d86e3cc5ec2a5d1b216 --- /dev/null +++ b/lib/sbr/misc/getcdir0.c @@ -0,0 +1,42 @@ +/* + * FILE %sbr/getcdir0.c + * + * written: 1994-08-12 + * latest update: 1999-04-25 17:00:40 + * $Id: getcdir0.c,v 1.3 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif /* !MSDOS */ + +#include <string.h> +#include <stdlib.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +char *_get_current_directory (char *buffer) +{ +#ifndef MSDOS + char *pwd; +#endif /* !MSDOS */ + + if (buffer == (char *) 0 + && (buffer= malloc (MAX_FNM_LENGTH + DEF_FNM_EXTRA)) == (char *) 0 + ) return (char *) 0; + +#ifdef MSDOS + /* 2. Path ermittlen */ + buffer [0]= (char) get_current_disk () + 'A'; + buffer [1]= ':'; + buffer [2]= '\\'; + getpwd (buffer+3, 0); +#else + pwd= getenv ("PWD"); + + strcpy (buffer, (pwd == (char *) 0) ? "." : pwd); +#endif + + return buffer; +} diff --git a/lib/sbr/misc/getcdir0.o b/lib/sbr/misc/getcdir0.o new file mode 100644 index 0000000000000000000000000000000000000000..19cd74808b3f9d21fc13b9456750d936f6e856b4 Binary files /dev/null and b/lib/sbr/misc/getcdir0.o differ diff --git a/lib/sbr/misc/getcdir1.c b/lib/sbr/misc/getcdir1.c new file mode 100644 index 0000000000000000000000000000000000000000..efb79da5342262df55ed0446135074cbbf321488 --- /dev/null +++ b/lib/sbr/misc/getcdir1.c @@ -0,0 +1,29 @@ +/* + * FILE %sbr/getcdir1.c + * + * written: 1994-08-12 + * latest update: 1995-12-30 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#include <gg/strings.h> +#endif +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +char *get_current_directory (char *buffer) +{ +#ifdef MSDOS + if ((buffer= _get_current_directory (buffer)) == (char *) 0) + return (char *) 0; + + xchange (buffer, '\\', '/'); + to_lower (buffer); + + return buffer; +#else + return _get_current_directory (buffer); +#endif /* !MSDOS */ +} diff --git a/lib/sbr/misc/getcdir1.o b/lib/sbr/misc/getcdir1.o new file mode 100644 index 0000000000000000000000000000000000000000..454008e8fabbc95d9205db6caf47fe879f463865 Binary files /dev/null and b/lib/sbr/misc/getcdir1.o differ diff --git a/lib/sbr/misc/getpwd_l.asm b/lib/sbr/misc/getpwd_l.asm new file mode 100644 index 0000000000000000000000000000000000000000..911b126df367542aa210684b8ff15268ad785c0b --- /dev/null +++ b/lib/sbr/misc/getpwd_l.asm @@ -0,0 +1,83 @@ +; +; FILE %sbr/getpwd_l.asm +; +; *********** +; LARGE MODEL +; *********** +; +; Ermittlung des Current Work Directories +; Wechseln des Current Work Directories +; +; written: 1987 11 25 +; 1989 07 10: Revision +; latest update: 1996-03-17 16:08:23 +; + + TITLE getpwd + + +GETPWD_TEXT SEGMENT BYTE PUBLIC 'CODE' +GETPWD_TEXT ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: GETPWD_TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP +PUBLIC _getpwd +; PUBLIC _CDIR + +GETPWD_TEXT SEGMENT +; LARGE MODEL: +; a=6 Offset Puffer +; b=8 Segment Puffer +; c=10 Drive Number + PUBLIC _getpwd +_getpwd PROC far + push bp + mov bp,sp + push si + push ds + + mov si, [bp+6] ; Data Buffer + mov ds, [bp+8] + mov dx, [bp+10] ; drive number: 0..default + mov ax, 04700h ; getpwd + int 021h + + pop ds + pop si + mov sp,bp + pop bp + ret +_getpwd ENDP + +; a=4 +; PUBLIC _CDIR +; _CDIR PROC far +; push bp +; mov bp,sp +; push di +; push si +; +; mov DX, [bp+4] ; Pointer to Pathname +; mov ah, 03Bh ; CDIR +; mov al, 000h +; int 021h +; jc cdir_error +; mov ax, 0 +; jmp cdir_ende +; cdir_error: mov ax, -1 +; +; cdir_ende: +; pop si +; pop di +; mov sp,bp +; pop bp +; ret +; _CDIR ENDP + +GETPWD_TEXT ENDS +END diff --git a/lib/sbr/misc/getpwd_s.asm b/lib/sbr/misc/getpwd_s.asm new file mode 100644 index 0000000000000000000000000000000000000000..c60417568e2d74565011281176ee052408fdd435 --- /dev/null +++ b/lib/sbr/misc/getpwd_s.asm @@ -0,0 +1,81 @@ +; +; FILE %sbr/getpwd_s.asm +; +; *********** +; SMALL MODEL +; *********** +; +; Ermittlung des Current Work Directories +; Wechseln des Current Work Directories +; +; written: 1987 11 25 +; 1989 07 10: Anpassung fuer SMALL Modell +; latest update: 1995-09-10 +; + + TITLE getpwd + + +_TEXT SEGMENT BYTE PUBLIC 'CODE' +_TEXT ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: _TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP + +_TEXT SEGMENT +; SMALL MODEL: +; a=4 Offset Puffer +; c=6 Drive Number + + PUBLIC _getpwd +_getpwd PROC near + push bp + mov bp,sp + push si + push ds + + mov si, [bp+4] ; Data Buffer + ; DS vom rufenden Process + mov dx, [bp+6] + mov ax, 04700h ; getpwd + int 021h + + pop ds + pop si + mov sp,bp + pop bp + ret +_getpwd ENDP + +; a=4 +; PUBLIC _CDIR +; _CDIR PROC near +; push bp +; mov bp,sp +; push di +; push si +; +; mov DX, [bp+4] ; Pointer to Pathname +; mov ah, 03Bh ; CDIR +; mov al, 000h +; int 021h +; jc cdir_error +; mov ax, 0 +; jmp cdir_ende +; cdir_error: mov ax, -1 +; +; cdir_ende: +; pop si +; pop di +; mov sp,bp +; pop bp +; ret +; _CDIR ENDP + +_TEXT ENDS +END diff --git a/lib/sbr/misc/gg b/lib/sbr/misc/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/sbr/misc/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/sbr/misc/hex2bin.c b/lib/sbr/misc/hex2bin.c new file mode 100644 index 0000000000000000000000000000000000000000..820f66b784920e3470f128a1532b017c61bf8410 --- /dev/null +++ b/lib/sbr/misc/hex2bin.c @@ -0,0 +1,41 @@ +/* + * FILE ~/usr/sbr/hex2bin.c + * + * convert a printable hex string into a binary data block + * see also: + * - bin2hex.c int bin_to_hex (char *bin, char *hex, int lng) + * convert a binary data block into a printable hex string + * + * written: 1993-12-05: <Gerhard.Gonter@wu-wien.ac.at> + * 1995-02-20: renamed from md5s2b.c to hex2bin.c + * latest update: 1995-08-04 + * + */ + +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int hex_to_bin (char *hex, char *bin, int lng) +{ + int i= 0; + int ch; + int v= 0; + + if (lng <= 0) return -1; + + while (lng-- > 0) + { + ch= *hex++ & 0x00FF; + if (ch >= '0' && ch <= '9') ch= ch - '0'; else + if (ch >= 'a' && ch <= 'f') ch= ch - 'a' + 10; else + if (ch >= 'A' && ch <= 'F') ch= ch - 'A' + 10; else + return -1; + + if (i%2) + *bin++ = (char) (v+ch); + else v= 16*ch; + i++; + } + + return 0; +} diff --git a/lib/sbr/misc/hex2bin.o b/lib/sbr/misc/hex2bin.o new file mode 100644 index 0000000000000000000000000000000000000000..eb162947d056f8bf5800c9a5b909a0d0892871f3 Binary files /dev/null and b/lib/sbr/misc/hex2bin.o differ diff --git a/lib/sbr/misc/identkey.c b/lib/sbr/misc/identkey.c new file mode 100644 index 0000000000000000000000000000000000000000..558e422887532f2c37c2bfd460016a7a28258053 --- /dev/null +++ b/lib/sbr/misc/identkey.c @@ -0,0 +1,196 @@ +/* + * FILE ~/usr/sbr/identkey.c + * + * Ermitteln des Key Codes aus einer KEY-Bezeichnung + * + * written: 1989 07 09: aus Filemanager (Modul FM2.C) ausgekoppelt + * latest update: 1995-06-15 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/keys.h> + +static int cdecl getnum (char *s, int i); + +/* Code Table fuer ALT-Codes: --------------------------------------------- */ +static unsigned int CODE_TABLE [] = +{ + 0x0181, 0x0178, 0x0179, 0x017A, 0x017B, 0x017C, 0x017D, 0x017E, + 0x017F, 0x0180, 0x0000, 0x0000, 0x0000, 0x0183, 0x0000, 0x0000, + 0x0000, 0x011E, 0x0130, 0x012E, 0x0120, 0x0112, 0x0121, 0x0122, + 0x0123, 0x0117, 0x0124, 0x0125, 0x0126, 0x0132, 0x0131, 0x0118, + 0x0119, 0x0110, 0x0113, 0x011F, 0x0114, 0x0116, 0x012F, 0x0111, + 0x012D, 0x0115, 0x012C +} ; + +/* ------------------------------------------------------------------------ */ +unsigned int identify_key (char *key_name) /* Bezeichnung des Keys */ +/* RETURN: key_code laut ~/usr/g/keys.h */ +/* 0 ... Key nicht identifiziert */ +{ + register int k; + register unsigned int knum=0; + + /*************************/ + /* 0x#### Hex Key Code */ + /*************************/ + if (key_name [0] == '0' && + (key_name [1] == 'x' || key_name [1] == 'X')) + { + knum= 0; + for (key_name += 2; k= *key_name++; ) + if (k >= '0' && k <= '9') knum = knum*16 + k - '0'; + else if (k >= 'a' && k <= 'f') knum = knum*16 + k - 'a' + 10; + else if (k >= 'A' && k <= 'F') knum = knum*16 + k - 'A' + 10; + else break; + return knum; + } + + /***********************/ + /* F1 .. F10 F11 F12 */ + /***********************/ + if ((key_name [0] == 'f' || key_name [0] == 'F') && key_name [1]) + { + switch (knum= getnum (key_name, 1)) + { + case 0: return 0; + case 11: case 12: return 0x0185 + knum -11; + default: if (knum>12) return 0; + return 0x013A + knum; + } + } + + /***************************/ + /* SF1 .. SF10 SF11 SF12 */ + /* CF1 .. CF10 CF11 CF12 */ + /* AF1 .. AF10 AF11 AF12 */ + /***************************/ + if (key_name [1] == 'f' || key_name [1] == 'F') + { + k= 0; + switch (key_name [0]) + { + case 'a': case 'A': k += 10; + case 'c': case 'C': k += 10; + case 's': case 'S': + switch (knum= getnum (key_name, 2)) + { + case 0: + return 0; + case 11: + case 12: + switch (k) + { + case 0: k = 2; break; + case 10: k = 4; break; + case 20: k = 6; break; + } + return 0x0185+k + knum-11; + default: + if (knum > 12) return 0; + return knum + k + 0x0153; + } + break; + } + } + + /***********/ + /* ALT-? */ + /***********/ + if ((key_name [0] == 'a' || key_name [0] == 'A') && + (key_name [1] == 'l' || key_name [1] == 'L') && + (key_name [2] == 't' || key_name [2] == 'T') && + (key_name [3] == '-')) + { + if ((k= key_name [4] & 0x00FF) >= 'a' && k <= 'z') + return CODE_TABLE [k-'a'+17]; + if (k >= '0' && k <= 'Z') return CODE_TABLE [k-'0']; + if (k == '-') return 0x0182; + return 0; + } + + /***************************/ + /* Control CURSOR Tasten */ + /***************************/ + if ((key_name [0] == 'c' || key_name [0] == 'C') && key_name [1]) + { + switch (key_name [1]) + { /************/ + case 'u': case 'U': return K_CUP; /* CUp */ + case 'd': case 'D': return K_CDOWN; /* CDown */ + case 'l': case 'L': return K_CLEFT; /* CLeft */ + case 'r': case 'R': return K_CRIGHT; /* CRight */ + case 'h': case 'H': return K_CTRLHOME; /* CHome */ + case 'e': case 'E': return K_CTRLEND; /* CEnd */ + /************/ + case 'c': case 'C': + switch (key_name [2]) + { /************/ + case 'l': case 'L': return K_CTRLLEFT; /* CCLeft */ + case 'r': case 'R': return K_CTRLRIGHT; /* CCRight */ + } /************/ + break; + + case 'p': case 'P': + if (key_name [2] != 'G' && key_name [2] != 'g') break; + switch (key_name [3]) + { /************/ + case 'u': case 'U': return K_CTRLPGUP; /* CPGUp */ + case 'd': case 'D': return K_CTRLPGDN; /* CPGDn */ + } /************/ + break; + } + return 0; + } + + if ((key_name [0] == 'p' || key_name [0] == 'P') && + (key_name [1] == 'g' || key_name [1] == 'G')) + switch (key_name [2]) + { /************/ + case 'u': case 'U': return K_PGUP; /* PGUp */ + case 'd': case 'D': return K_PGDN; /* PGDn */ + } /************/ + + if (key_name [1] != 0) + switch (key_name [0]) + { /************/ + case 'd': case 'D': return K_DEL; /* Delete */ + case 'e': case 'E': return K_END; /* End */ + case 'h': case 'H': return K_HOME; /* Home */ + case 'i': case 'I': return K_INS; /* Insert */ + } /************/ + + /********************/ + /* Control Tasten */ + /********************/ + if (key_name [0] == '^') + { + k= key_name [1]; /************/ + if (k >= 'a' && k <= 'z') return k - 'a' + 1; /* ^a .. ^z */ + if (k >= 'A' && k <= 'Z') return k - 'A' + 1; /* ^A .. ^Z */ + } /************/ + + /* Normale Tasten */ + if (key_name [1] == 0) + return key_name [0]; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +static int getnum (char *s, int i) +{ + int rv= 0; + int ss; + + for (; ss= s [i] & 0x00FF; i++) + if (ss >= '0' && ss <= '9') + rv = 10*rv + ss - '0'; + else break; + + return rv; +} diff --git a/lib/sbr/misc/int14l.asm b/lib/sbr/misc/int14l.asm new file mode 100644 index 0000000000000000000000000000000000000000..32ff4a3fe37f8523bcc2811886c0ecfa956585e5 --- /dev/null +++ b/lib/sbr/misc/int14l.asm @@ -0,0 +1,300 @@ +; +; FILE %sbr/int14l.asm +; +; RS 232 Puffer fuer die Verwendung unter C +; +; ---------------------------------------------------------------------------- +; angepasst fuer das MEDIUM und LARGE Modell: +; alle RETs wurden als FAR RET - Konstanten eingesetzt +; ---------------------------------------------------------------------------- +; +; written: 1985 08 01 +; 1989 10 29: Revision +; latest update: 1995-09-10 +; + + NAME int14 + +public _INIT ; Initialisierung der ganzen Aenderung +public _STOP ; Pufferung wieder ausklinken + +public _RS_GETCH ; lesen aus dem Puffer +public _RS_PUTCH ; Ausgabe eines Zeichens auf der Schnittstelle + +puffsize equ 2000 ; Groesse des Ringpuffers + ; Bei Bedarf anpassen !!! + +; ---------------------------------------------------------------------------- +; ANM: 1. Dieses Modul wird zum Programmsystem dazugelinkt +; 2. Vor der Verwendung der Schnittstelle muss unbedingt +; _INIT aufgerufen werden! +; 3. Vor verlassen des Programms muss unbeding +; _STOP aufgerufen werden! +; Andernfalls wuerden die Interrupt Vektoren nicht +; wieder hergestellt werden !!!!!!!!!!!! +; (-> Systemabsturz zu spaeteren Zeitpunkt) +; +; +; ---------------------------------------------------------------------------- +_DATA segment word public 'DATA' +_DATA ends +DGROUP group _DATA + +_TEXT segment byte public 'CODE' + assume cs:_TEXT, ds:DGROUP + + +dssave dw 0 +nxtrd dw 0 +nxtwr dw 0 +rdcnt dw 0 +wrcnt dw 0 +temp dw 0 +p_end dw 0 + +s_hw1 dw 0 +s_hw2 dw 0 +s_sw1 dw 0 +s_sw2 dw 0 + +; ---------------------------------------------------------------------------- +; Input: -- +; Output: Return (AX): Groesse des Puffers +; +_INIT proc far + push es + push ax + push dx + push bp + + ; Pointer und Zaehler initialisieren + mov [dssave], cs ; Segment des Puffers + mov ax, offset p_base + mov [nxtrd], ax + mov [nxtwr], ax + add ax, puffsize + mov [p_end], ax + mov [rdcnt], 0 ; noch nichts vom Puffer gelesen + mov [wrcnt], 0 ; . . in den Puffer geschrieben + + ; Interrupt Vektoren scharfmachen + push ds + mov ax, 0 + mov ds, ax + mov es, ax + mov bp, ax + mov ax, es: [bp+30h] ; HW int Vektor retten, Offset + mov [s_hw1], ax ; HW int Vektor retten, Offset + mov ax, es: [bp+32h] ; . . . . , Segment + mov [s_hw2], ax ; . . . . , Segment + mov ax, es: [bp+50h] ; INT 14 . . , Offset + mov [s_sw1], ax ; INT 14 . . , Offset + mov ax, es: [bp+52h] ; . . . . , Segment + mov [s_sw2], ax ; . . . . , Segment + mov ax, offset int_server + mov es: [bp+30h], ax + mov es: [bp+32h], cs + mov ax, offset int_14 + mov es: [bp+50h], ax + mov es: [bp+52h], cs + pop ds + + ; Interrupt Controller und Masken klarmachen + mov dx, 03f9H ; IER + mov al, 01H ; Interrupt nur bei Data Available + out dx, al + + mov dx, 03fch ; MCR + in al, dx + or al, 008H ; out 2 == 0 -> Interrupt enabled + out dx, al + + mov dx, 021H ; 8259: Masken Register + in al, dx + and al, 0EFH ; bit 4 == 0 -> Interrupt enabled + out dx, al + + mov ax, puffsize + pop bp + pop dx + pop ax + pop es + ret +_INIT endp + +; ---------------------------------------------------------------------------- +_RS_GETCH proc far + ; Return: ax > 255 -> buffer underflow + ; sonst: al == gelesenes Zeichen + push bx + push dx + push ds + + mov ds, word ptr cs: [dssave] + + mov dx, [rdcnt] + mov bx, [nxtrd] ; if ((nxtrd == + cmp bx, [nxtwr] ; nxtwr) + jne r_doit + cmp dx, [wrcnt] ; && (rdcnt == wrcnt)) + jne r_doit + ; buffer underflow + mov ax, 0100H + jmp r_ready ; return (256); -> buffer empty + +r_doit: mov al, [bx] + mov ah, 0 + cmp bx, [p_end] ; if (nxtrd == buffer_end) + jne rbxin + mov bx, offset p_base ; wieder an den anfang des puffers + jmp r_doit2 +rbxin: inc bx ; else nxtrd++; +r_doit2: + mov [nxtrd], bx + inc dx ; rdcnt++; + mov [rdcnt], dx +r_ready: + pop ds + pop dx + pop bx + ret +_RS_GETCH endp + +; ============================================================================ +; Interruptbedienung + +; 1. Behandlung des Software Interrupt 0x14 +; maskierung fuer die rs232 bios routine +int_14 proc far + sti + cmp ah, 2 ; read from COM-line + je read + mov [temp], dx + mov dx, [s_sw2] + push dx + mov dx, [s_sw1] ; eventuell zuerst Segment!!! + push dx + mov dx, [temp] + ret ; immer Wert fuer RET FAR !! + +read: ; Ausfuehren des Befehls # 2 + call _RS_GETCH + iret +int_14 endp + +; ---------------------------------------------------------------------------- +; 2. Behandlung des von der RS232-Hardware ausgeloesten Interrupts +int_server: ; von der Hardware ausgeloeste Routine + ; zum Einlesen in den Puffer + sti + push ax + push bx + push dx + push ds + + mov ds, word ptr cs: [dssave] + + mov dx, 03f8h ; Empfangs-Register des 8250 Chip + in al, dx ; lesen auf alle Faelle + mov bx, [nxtwr] + cmp bx, [nxtrd] ; if ((nxtwr == nxtrd) + jne w_doit + mov dx, [wrcnt] + cmp dx, [rdcnt] ; && (rdcnt != wrcnt)) /* vgl. oben!! */ + je w_doit ; bei read genau das Gegenteil!! + jmp w_ready + +w_doit: mov [bx], al ; nur speichern wenn Platz da ist! + mov dx, [wrcnt] + cmp bx, [p_end] ; if (nxtwr == puffer end) + jne w_inc_bx + mov bx, offset p_base ; wieder an den Anfang + jmp w_doit2 +w_inc_bx: inc bx +w_doit2: + mov [nxtwr], bx + inc dx + mov [wrcnt], dx + +w_ready: + mov dx, 0020H + mov al, 020h + out dx, al ; Interrupt CRRL zuruecksetzen + + pop ds + pop dx + pop bx + pop ax + iret + +; ============================================================================ +_STOP proc far + push es + push ax + push dx + push bp + + ; Interrupt Vektoren von vorher + push ds + mov ax, 0 + mov ds, ax + mov es, ax + mov bp, ax + mov ax, [s_hw1] ; HW int Vektor retten, Offset + mov es: [bp+30h], ax ; HW int Vektor retten, Offset + mov ax, [s_hw2] ; . . . . , Segment + mov es: [bp+32h], ax ; . . . . , Segment + mov ax, [s_sw1] ; INT 14 . . , Offset + mov es: [bp+50h], ax ; INT 14 . . , Offset + mov ax, [s_sw2] ; . . . . , Segment + mov es: [bp+52h], ax ; . . . . , Segment + pop ds + + ; Interrupt Controller und Masken / sperren + mov dx, 03f9H ; IER + mov al, 00H ; keine Interrupts + out dx, al + + mov dx, 03fch ; MCR + in al, dx + and al, 0F7H ; out 2 == 0 -> Interrupt disabled + out dx, al + + mov dx, 021H ; 8259: Masken Register + in al, dx + or al, 010H ; bit 4 == 0 -> Interrupt enabled + out dx, al + + pop bp + pop dx + pop ax + pop es + ret +_STOP endp + +; Ausgabe: ------------------------------------------------------------------- +_RS_PUTCH proc far ; ohne leitungsbedienung!!! + push bp + mov bp,sp + push ax + push dx + mov dx, 03fdH +loo: in al, dx + and al, 020h ; Sende Halte Register leer? + jz loo + mov dx, 03f8H + mov ax, [bp+6] ; MEDIUM: 6; SMALL: 4 + out dx, al + pop dx + pop ax + pop bp + ret +_RS_PUTCH endp + +; Ringpuffer: ---------------------------------------------------------------- +p_base DB puffsize Dup (?) ; Puffer Speicher + DB 2 Dup (?) + +_TEXT ends + end + diff --git a/lib/sbr/misc/int24.asm b/lib/sbr/misc/int24.asm new file mode 100644 index 0000000000000000000000000000000000000000..3b70ae9946ba50de10a09ff518d2afe59b924538 --- /dev/null +++ b/lib/sbr/misc/int24.asm @@ -0,0 +1,53 @@ +; +; FILE ~/usr/sbr/int24.asm +; +; Ignore Interrupt 0x24 (critical error) +; +; written: 1991 02 17 +; latest update: 1994-10-02 +; +; --------------------------------------------------------------------------- +; + TITLE int24.asm + NAME int24 + .MODEL Large + +DIRTY_TEXT SEGMENT WORD PUBLIC 'CODE' +DIRTY_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: DIRTY_TEXT, DS: DGROUP, SS: DGROUP + +DIRTY_TEXT SEGMENT + ASSUME CS: DIRTY_TEXT + + PUBLIC _int24ign_install + +_int24ign_install proc far + push ds + push dx + push cs + pop ds + call next +next: pop dx + add dx,12 + mov ax,2524h + int 021h + pop dx + pop ds + ret + +int24ign: + mov al,0 + iret + +_int24ign_install endp + +DIRTY_TEXT ENDS +END diff --git a/lib/sbr/misc/keynames.c b/lib/sbr/misc/keynames.c new file mode 100644 index 0000000000000000000000000000000000000000..aaa84a88aa86214c431d2066870e05dad1b1f95d --- /dev/null +++ b/lib/sbr/misc/keynames.c @@ -0,0 +1,64 @@ +/* + * File c:/usr/sbr/keynames.c + * + * 1991 09 30 + * + */ + +#include <stdio.h> +#include <gg/keys.h> + +static char TMP[10]; + +/* ------------------------------------------------------------------------ */ +char *key_name (unsigned int kc) /* Key Code */ +{ + if (kc >= K_PF1 && kc <= K_PF10) + sprintf (TMP, "F%d", (kc-K_PF1 + 1)); + else if (kc >= K_SPF1 && kc <= K_SPF10) + sprintf (TMP, "SF%d", (kc-K_SPF1 + 1)); + else if (kc >= K_APF1 && kc <= K_APF10) + sprintf (TMP, "AF%d", (kc-K_APF1 + 1)); + else if (kc >= K_CPF1 && kc <= K_CPF10) + sprintf (TMP, "CF%d", (kc-K_CPF1 + 1)); + else if (kc >= 0x21 && kc <= 0x7E) + sprintf (TMP, "%c", kc); + else if (kc >= 0x01 && kc <= 0x1A) + sprintf (TMP, "^%c", kc+'A'-1); + else { + switch (kc) + { + case K_CUP: return "CUP"; + case K_CDOWN: return "CDN"; + case K_CLEFT: return "CLT"; + case K_CRIGHT: return "CRT"; + case K_DEL: return "DEL"; + case K_INS: return "INS"; + case K_END: return "END"; + case K_HOME: return "HOME"; + case K_PGUP: return "PGUP"; + case K_PGDN: return "PGDN"; + case 0x1B: return "ESC"; + case 0x20: return "BLNK"; + case 0x0D: return "CR"; + case K_CTRLLEFT: return "^CLT"; + case K_CTRLRIGHT: return "^CRT"; + case K_CTRLEND: return "^END"; + case K_CTRLHOME: return "^HOM"; + case K_CTRLPGUP: return "^PUP"; + case K_CTRLPGDN: return "^PDN"; + case K_CTRLPRTSCR: return "^PSC"; + case K_PF11: return "F11"; + case K_PF12: return "F12"; + case K_SPF11: return "SF11"; + case K_SPF12: return "SF12"; + case K_CPF11: return "CF11"; + case K_CPF12: return "CF12"; + case K_APF11: return "AF11"; + case K_APF12: return "AF12"; + default: sprintf (TMP, "0x%04X", kc); + } + } + + return TMP; +} diff --git a/lib/sbr/misc/lib b/lib/sbr/misc/lib new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/sbr/misc/libgg.a b/lib/sbr/misc/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/sbr/misc/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/sbr/misc/liblst.awk b/lib/sbr/misc/liblst.awk new file mode 100644 index 0000000000000000000000000000000000000000..d7424d40328cfd8ae3a7fce78db9b1273225f43c --- /dev/null +++ b/lib/sbr/misc/liblst.awk @@ -0,0 +1,6 @@ +# Print List of Modules from LIB-Cross Reference List +# Tylman Susato 1989 09 17 +$2=="Offset:" { MN[$1]=1; } +END { i=1; + for (x in MN) printf ("%3d: %s\n", i++, x); + } diff --git a/lib/sbr/misc/lng2hex.c b/lib/sbr/misc/lng2hex.c new file mode 100644 index 0000000000000000000000000000000000000000..f1468135defdc972a1fe1ba60926ae8078d56355 --- /dev/null +++ b/lib/sbr/misc/lng2hex.c @@ -0,0 +1,47 @@ +/* + * FILE %sbr/lng2hex.c + * + * convert a long (32bit) integer into a printable string + * see also: + * - hex2bin.c int cdecl hex_to_bin (char *hex, char *bin, int lng); + * convert a printable hex string into a binary data block + * + * written: 1995-07-31 + * latest update: 1999-11-28 12:17:57 + * + */ + +#include <gg/dpp.h> + +#define UNKNOWN_MODEL + +/* ------------------------------------------------------------------------ */ +int long_to_hex (long bin, char *hex) +{ +#ifdef __IS_BIG_ENDIAN__ +#undef UNKNOWN_MODEL +#ifdef __OLD__ /* 1996-07-21 15:41:06 */ + char *p; + char bin_buffer [4]; + + p= (char *) &bin; + bin_buffer [0]= p [3]; + bin_buffer [1]= p [2]; + bin_buffer [2]= p [1]; + bin_buffer [3]= p [0]; +#endif /* __OLD__ 1996-07-21 15:41:06 */ + return bin_to_hex_rev ((char *) &bin, hex, 4); +#endif + +#ifdef __IS_LITTLE_ENDIAN__ +#undef UNKNOWN_MODEL + return bin_to_hex ((char *) &bin, hex, 4); +#endif + +#ifdef UNKNOWN_MODEL + NOTE: if you have a compilation error at this point, find out which + hardware architecture you have and which preprocessor symbols your + compiler defines by default, then create a #ifdef construct similar + to the one for AIX and let me know. (g.gonter@ieee.org) +#endif /* UNKNOWN_MODEL */ +} diff --git a/lib/sbr/misc/lng2hex.o b/lib/sbr/misc/lng2hex.o new file mode 100644 index 0000000000000000000000000000000000000000..97a63b80036670e3bfcda1e1f9d5700f2f40d12d Binary files /dev/null and b/lib/sbr/misc/lng2hex.o differ diff --git a/lib/sbr/misc/lng2nstr.c b/lib/sbr/misc/lng2nstr.c new file mode 100644 index 0000000000000000000000000000000000000000..14363f7ad0b78e26635c2b302bab9265cd02eaf7 --- /dev/null +++ b/lib/sbr/misc/lng2nstr.c @@ -0,0 +1,30 @@ +/* + * FILE %sbr/lng2nstr.c + * + * convert a long (32bit) integer into a printable string in sortable + * notation + * see also: lng2hex.c + * + * written: 1995-12-28 + * latest update: 1995-12-28 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/dpp.h> + +/* ------------------------------------------------------------------------ */ +int long_to_num_string (long bin, char *hex) +{ + int lng; + + sprintf (hex+2, "%d", (int) bin); + + lng= strlen (hex+2); + if (lng >= 0 && lng <= 9) *hex= (char) lng + '0'; else + if (lng >= 10 && lng <= 36) *hex= (char) lng + 'A' - 10; else + hex [1]= ':'; + + return 0; +} diff --git a/lib/sbr/misc/lng2nstr.o b/lib/sbr/misc/lng2nstr.o new file mode 100644 index 0000000000000000000000000000000000000000..fb4fc7b1d86511a4246c729be25eb98423093902 Binary files /dev/null and b/lib/sbr/misc/lng2nstr.o differ diff --git a/lib/sbr/misc/logicfnm.c b/lib/sbr/misc/logicfnm.c new file mode 100644 index 0000000000000000000000000000000000000000..26167439253b579dd06f30fcbca266370a425b85 --- /dev/null +++ b/lib/sbr/misc/logicfnm.c @@ -0,0 +1,457 @@ +/* + * FILE %sbr/logicfnm.c + * + * map a logic filename to a physical filename + * + * written: 1991 09 18: as: %ned/12/ned1202.c) + * 1991 12 12: moved to %sbr as locicfnm.c + * latest update: 2001-02-11 10:05:55 + * $Id: logicfnm.c,v 1.6 2010/05/04 02:47:07 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifdef DEBUG +#define DFILE stdout +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifndef MSDOS +#include <pwd.h> +#endif /* !MSDOS */ + +#include <gg/ytree.h> +#include <gg/filename.h> +#include <gg/strings.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +static struct VIRTUAL_FILENAME *vfn= (struct VIRTUAL_FILENAME *) 0; +static struct VIRTUAL_FILENAME **vfnp= &vfn; + +#ifdef MSDOS +#define L_LNG 66 +#define T_LNG 160 +#define NED_LP_LNG 256 +#else +#define L_LNG 1024 +#define T_LNG 1024 +#define NED_LP_LNG 1024 +#endif + +static char ned_lp [NED_LP_LNG]; +static int all_has_been_read= 0; + +static struct YTREE *yt_real_to_virtual= (struct YTREE *) 0; +static struct YTREE *yt_virtual_to_real= (struct YTREE *) 0; + +/* ------------------------------------------------------------------------ */ +char *translate_logic_filename (const char *fnm) +{ + char *vfnv; + + return _translate_logic_filename (fnm, &vfnv); +} + +/* ------------------------------------------------------------------------ */ +char *_translate_logic_filename (const char *fnm, char **vfnv) +{ + char l1 [L_LNG]; + char *rv; + char *env; + int ch; + int i; + int env_l; + struct VIRTUAL_FILENAME *a; + int contains_logic_path= 0; + int contains_drive_name= 0; + const char *full_fnm; + struct YTREE *yt; +#ifndef MSDOS + struct passwd *pwd; +#endif /* !MSDOS */ + + if ((full_fnm= fnm) == (char *) 0) return (char *) 0; + + switch (*fnm) + { + case '~': /* user or old way to describe a logic path */ + if (fnm [1] == '/' /* ~/something */ + || fnm [1] == 0) /* simply ~ to indicate the home directory */ + { +#ifdef DEBUG + fprintf (DFILE, ">> searching environment 'HOME'\n", l1+1); +#endif /* DEBUG */ + if ((env= getenv ("HOME")) == (char *) 0) goto NEXT1; + fnm++; + goto IS_HOME; + } + break; + + case '%': /* new way to describe a logic path */ + break; + + case '$': /* environment variable */ + if (fnm [1] == '$') + { + fnm++; /* $$ means file begins with 1 $ */ + goto XNIL; + } + break; + +/********* + default: + goto XNIL; +*********/ + } + +NEXT1: + /* copy the beginning of the filename string into l1 which then contains */ + /* something like: */ + /* %virtual_path */ + /* $environment */ + /* ~user */ + /* drive: */ + for (i= 0; (ch= *fnm & 0x00FF) != 0; i++, fnm++) + { + if (ch == '/' +#ifdef MSDOS + || ch == '\\' +#endif + ) break; + + if (i+1 >= L_LNG) goto XNIL; + l1 [i]= (char) ch; + + if (ch == ':') + { + i++; + fnm++; + contains_drive_name= 1; + break; + } + } + l1 [i]= 0; + /* NOTE: *fnm can be empty now!!! (--> logic filename) */ + /* usually it points now to the rest of the path beginning */ + /* after the SLASH or BACKSLASH. */ + +#ifdef DEBUG + fprintf (DFILE, ">> l1='%s'\n", l1); +#endif /* DEBUG */ + + switch (l1 [0]) + { + case '$': + contains_logic_path= 1; +#ifdef MSDOS + to_upper (l1); +#endif +#ifdef DEBUG + fprintf (DFILE, ">> searching environment '%s'\n", l1+1); +#endif /* DEBUG */ + if ((env= getenv (l1+1)) == (char *) 0) goto XNIL; + +IS_HOME: + /* reserve enough space to combine the expanded environment and the */ + /* filename and return the combination. */ + env_l= strlen (env); + + if ((rv= strdup_extra (env, DEF_FNM_EXTRA + strlen (fnm))) + == (char *) 0) goto XNIL; + + if (env_l > 0 + && (env [env_l-1] == '/' +#ifdef MSDOS + || env [env_l-1] == '\\' +#endif + ) + ) env_l--; + + strcpy (&rv [env_l], fnm); + goto END; + + case '~': + contains_logic_path= 1; +#ifdef DEBUG + fprintf (DFILE, ">> searching user '%s'\n", l1+1); +#endif /* DEBUG */ +#ifndef MSDOS + if ((pwd= getpwnam (l1+1)) != (struct passwd *) 0) + { +#ifdef DEBUG + fprintf (DFILE, ">> home is '%s'\n", pwd->pw_dir); +#endif /* DEBUG */ + if ((env= pwd->pw_dir) != (char *) 0) goto IS_HOME; + } + goto XNIL; +#else /* !MSDOS */ + break; /* in dos this will be translated ! */ +#endif /* MSDOS */ + + case '%': + contains_logic_path= 1; + break; + } + + if ((yt= ytree_lookup_word (yt_virtual_to_real, (unsigned char *) l1)) + != (struct YTREE *) 0 + && (yt->YT_flags & YTflag_EOW) + && (a= (struct VIRTUAL_FILENAME *) yt->YT_info) + != (struct VIRTUAL_FILENAME *) 0 + ) + { +FOUND: + /* reserve enough space to combine the expanded virtual path and the */ + /* filename and return the combination. */ + if (vfnv != (char **) 0) *vfnv= a->VFN_virtual; + env_l= strlen (a->VFN_real); + + if ((rv= strdup_extra (a->VFN_real, DEF_FNM_EXTRA + strlen (fnm))) + == (char *) 0) goto XNIL; + + if (contains_drive_name == 1 + && *fnm != '/' +#ifdef MSDOS + && *fnm != '\\' +#endif + && *fnm + ) + { + rv [env_l++]= '/'; + rv [env_l]= 0; + } + + strcpy (&rv [env_l], fnm); + goto END; + } + + if (!all_has_been_read + && (a= read_logic_filename_table (l1, 0)) + != (struct VIRTUAL_FILENAME *) 0) + goto FOUND; + + if (!contains_logic_path) fnm= full_fnm; + +XNIL: + rv= strdup_extra (fnm, DEF_FNM_EXTRA); + +END: +#ifdef MSDOS + xchange (rv, '\\', '/'); + to_lower (rv); +#endif + + return rv; +} + +/* ------------------------------------------------------------------------ */ +struct VIRTUAL_FILENAME *read_logic_filename_table ( +char *path_entry, +int read_all) +{ + struct VIRTUAL_FILENAME *a; + +#ifdef DEBUG + fprintf (DFILE, ">> read_logic_filename_table: path_entry=%s read_all=%d all_has_been_read=%d\n", + path_entry, read_all, all_has_been_read); +#endif /* DEBUG */ + + if (all_has_been_read) return (struct VIRTUAL_FILENAME *) 0; + + set_etc_filename (ned_lp, "ned.lp"); + +#ifdef DEBUG + fprintf (DFILE, ">> read_logic_filename_table: ned_lp=%s\n", ned_lp); +#endif /* DEBUG */ + + a= _read_logic_filename_table (ned_lp, path_entry, read_all); + if (read_all) all_has_been_read= 1; + + return a; +} + +/* ------------------------------------------------------------------------ */ +struct VIRTUAL_FILENAME *_read_logic_filename_table ( +char *lp_file, +char *path_entry, +int read_all) +{ + struct VIRTUAL_FILENAME *a; + struct VIRTUAL_FILENAME *b= (struct VIRTUAL_FILENAME *) 0; + FILE *fi; + char tmp [T_LNG]; + char *fields [2]; + int rc; + int they_match= 0; + +#ifdef DEBUG + fprintf (DFILE, + ">> _read_logic_filename_table: lp_file=%s path_entry=%s read_all=%d\n", + lp_file, path_entry, read_all); +#endif /* DEBUG */ + + if ((fi= fopen (lp_file, "rt")) == (FILE *) 0) + return (struct VIRTUAL_FILENAME *) 0; + + for (;;) + { + rc= fread_line (fi, tmp, T_LNG); + if (rc <= 0 && feof (fi)) break; + if (tmp [0] == '#') + { /* comment of course... */ + continue; + } + + rc= isolate_tokens (tmp, fields, 2); + if (rc > 2) rc= 2; + if (rc < 2) continue; + + if (read_all + || (they_match= (path_entry != (char *) 0 + && strcmp (fields [0], path_entry) == 0 + ) + ) + ) + { + if ((a= _define_logic_filename (fields [0], fields [1])) + == (struct VIRTUAL_FILENAME *) 0) + return (struct VIRTUAL_FILENAME *) 0; + + if (they_match) b= a; + if (!read_all) break; + } + } + fclose (fi); + + return b; +} + +/* ------------------------------------------------------------------------ */ +struct VIRTUAL_FILENAME *_define_logic_filename ( +char *fn_virtual, +char *fn_real) +{ + struct VIRTUAL_FILENAME *a; + + if ((a= (struct VIRTUAL_FILENAME *) + calloc (sizeof (struct VIRTUAL_FILENAME), 1)) + == (struct VIRTUAL_FILENAME *) 0) + return (struct VIRTUAL_FILENAME *) 0; + + *vfnp= a; + vfnp= &a->VFN_next; + + a->VFN_virtual= strdup (fn_virtual); + a->VFN_real= strdup (fn_real); + + ytree_set_value (&yt_virtual_to_real, (unsigned char *) fn_virtual, (long) a); + ytree_set_value (&yt_real_to_virtual, (unsigned char *) fn_real, (long) a); + + return a; +} + +/* ------------------------------------------------------------------------ */ +int find_logic_filename ( +char *actual_path, +char *vp_buffer, +int vp_lng) +{ + struct VIRTUAL_FILENAME *a; + char *x; + char *examined_path; + char *next_examined_path; + int l_v; /* length of virtual path component */ + int l_r; /* length of real path component */ + int l_r_prev; /* ... previously found */ + int rc= 0; + +#ifdef DEBUG + fprintf (DFILE, ">> find_logic_filename: ap=%s\n", actual_path); +#endif /* DEBUG */ + + for (examined_path= actual_path; + examined_path != (char *) 0; + examined_path= next_examined_path) + { + next_examined_path= (char *) 0; + l_r_prev= 0; + +#ifdef DEBUG + fprintf (DFILE, ">> find_logic_filename: examined=%s\n", examined_path); +#endif /* DEBUG */ + + for (a= vfn; a != (struct VIRTUAL_FILENAME *) 0; a= a->VFN_next) + { + x= a->VFN_real; + l_r= strlen (x); + + if (strncmp (x, examined_path, l_r) == 0 && l_r > l_r_prev) + { + rc= 1; + l_r_prev= l_r; + l_v= strlen (a->VFN_virtual); + + if (vp_buffer != (char *) 0 + && vp_lng > l_v + strlen (examined_path) - l_r + 2 + ) + { + strcpy (vp_buffer, a->VFN_virtual); + strcpy (vp_buffer + l_v, examined_path + l_r); + next_examined_path= vp_buffer; + } + } + } + } + + return rc; +} + +/* ------------------------------------------------------------------------ */ +int flush_virtual_filename_table (void) +{ + struct VIRTUAL_FILENAME *p1, *p2; + +#ifdef DEBUG + fprintf (DFILE, ">> flush_virtual_filename_table\n"); +#endif /* DEBUG */ + + ytree_free (yt_virtual_to_real); + ytree_free (yt_real_to_virtual); + + yt_virtual_to_real= yt_real_to_virtual= (struct YTREE *) 0; + + for (p1= vfn; p1 != (struct VIRTUAL_FILENAME *) 0; p1= p2) + { + p2= p1->VFN_next; + free (p1->VFN_virtual); + free (p1->VFN_real); + free (p1); + } + + vfn= (struct VIRTUAL_FILENAME *) 0; + vfnp= &vfn; + all_has_been_read= 0; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int vfn_set_read_flag (int val) +{ + int rc= all_has_been_read; + all_has_been_read= val; + return rc; +} + +/* ------------------------------------------------------------------------ */ +struct VIRTUAL_FILENAME *get_virtual_filename_table () +{ + return vfn; +} diff --git a/lib/sbr/misc/logicfnm.o b/lib/sbr/misc/logicfnm.o new file mode 100644 index 0000000000000000000000000000000000000000..aca5795aa2abb8873de435a9fa941915f37600f7 Binary files /dev/null and b/lib/sbr/misc/logicfnm.o differ diff --git a/lib/sbr/misc/logicfpt.c b/lib/sbr/misc/logicfpt.c new file mode 100644 index 0000000000000000000000000000000000000000..e5dcc896b040d36bc1455c0377c1f13bbd87503a --- /dev/null +++ b/lib/sbr/misc/logicfpt.c @@ -0,0 +1,49 @@ +/* + * FILE %sbr/logicfpt.c + * + * print contents of the virtual file translation table + * + * written: 2000-12-09 + * latest update: 2000-12-09 16:32:51 + * $Id: logicfpt.c,v 1.1 2000/12/09 17:35:39 gonter Exp $ + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#ifdef DEBUG +#define DFILE stdout +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifndef MSDOS +#include <pwd.h> +#endif /* !MSDOS */ + +#include <gg/ytree.h> +#include <gg/filename.h> +#include <gg/strings.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +int print_virtual_filename_table (FILE *fo) +{ + struct VIRTUAL_FILENAME *p1; + int count= 0; + + fprintf (fo, "virtual filename table:\n"); + for (p1= get_virtual_filename_table (); + p1 != (struct VIRTUAL_FILENAME *) 0; + p1= p1->VFN_next) + { + fprintf (fo, "%3d: %s -> %s\n", count, p1->VFN_virtual, p1->VFN_real); + count++; + } + + return count; +} diff --git a/lib/sbr/misc/logicfpt.o b/lib/sbr/misc/logicfpt.o new file mode 100644 index 0000000000000000000000000000000000000000..1a6cd37bf320f61571275ef3b1efae4b279e88c3 Binary files /dev/null and b/lib/sbr/misc/logicfpt.o differ diff --git a/lib/sbr/misc/lzhhead.c b/lib/sbr/misc/lzhhead.c new file mode 100644 index 0000000000000000000000000000000000000000..b9c42d2140ae77bdb7614f9a414280eba156c2ad --- /dev/null +++ b/lib/sbr/misc/lzhhead.c @@ -0,0 +1,58 @@ +/* + * FILE ~/usr/sbr/lzhhead.c + * + * processing of LZH-archives + * + * written: 1990 05 26 + * latest update: 1994-11-12 + * + */ + +#include <stdio.h> +#include <string.h> +#include <gg/lzhhead.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +int get_lzh_head ( +FILE *fi, /* archive file, binary opened */ +struct LZH_HEAD *head) /* LZH-Header */ +/* RETURN: */ +/* -1 error or no archive */ +/* 0 EOF: no more files in archive */ +/* >0 archived file found; head is valid */ +{ + int size; + long skip; + + if (head == (struct LZH_HEAD *) 0) return -1; + + if (feof (fi)) return -1; /* EOF ??? this is unexpected !! */ + + fread ((char *) head, 1, LZH_FIX_HEAD_SIZE, fi); + if (head->LZH_header_size == 0) + return 0; /* EOA: End-Of-Archive */ + + if (strncmp (head->LZH_header_sign, LZH_SIGN_1, 5) != 0) + return -1; + + size = head->LZH_name_length; + skip = head->LZH_size_compressed+2L; /* looks like a 16 bit checksum */ + /* we don't check this */ + + if (size > 64) + { + skip += (long) size-64; + size = 64; /* truncate file name, */ + /* this is very dangerous */ + } + + if (feof (fi)) return -1; /* EOF ??? this is unexpected !! */ + fread (head->LZH_name, 1, size, fi); + fseek (fi, skip, 1); /* jump to next file header */ + + return 1; +} diff --git a/lib/sbr/misc/make-dos b/lib/sbr/misc/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..e6894ee55ad43a6b7a9d3f5aa9c623436c70cecc --- /dev/null +++ b/lib/sbr/misc/make-dos @@ -0,0 +1,906 @@ +# +# FILE %sbr/makefile +# +# Diverse Unterprogramme und Libraries +# +# written: 198?-??-?? +# latest update: 1997-08-15 21:42:26 +# +# ============================================================================ +cml=cl -AL /W3 /Fo$@ /c +cms=cl -AS /W3 /Fo$*.obj /c +ccl=cl -AL +ccs=cl -AS +obj=objdec -w -d -m0 +incl=c:\c5\include\gg\ +bin=c:\bin\ + +all : lib.lsbr all.exe +all.exe : $(bin)fnmdef.exe $(bin)gennednm.exe $(bin)fndvfile.exe +test.exe : fnmsep4.exe strings.exe t.exe tt.exe zs.exe + +# LARGE Library -------------------------------------------------------------- +lib.lsbr : part.l1 part.l3 dirt.lgrp ! + filename.lgrp wildcard.lgrp fileio.lgrp unix.lgrp ! + lsbr.lib + +lsbr.lib : + llink -v -llsbr.lib -dlsbr.mod -n0 + +# ---------------------------------------------------------------------------- +sbr.sh : + shar -c -t sbr.sh -fmake-sbr.lst + +# ---------------------------------------------------------------------------- +part.l1 : large\fopenwng.obj large\flopen.obj ! + large\fmt.obj large\fsopen.obj large\topen.obj large\ftopen.obj ! + large\ftrans01.obj large\ftrans02.obj large\ftrans03.obj large\ftrans04.obj ! + large\ftrans05.obj large\ftrans06.obj large\ftrans07.obj large\ftrans08.obj ! + large\ftrans09.obj large\ftrans10.obj ! + large\fscanlin.obj large\freadlin.obj large\frmaclin.obj large\trasheol.obj ! + large\freadit.obj large\freaditf.obj large\freadst.obj large\freadstf.obj ! + large\fparslin.obj large\scan.obj large\identkey.obj large\keynames.obj ! + large\fnames.obj large\fnames2.obj large\fnmovwr.obj large\getpwd.obj ! + large\xref01.obj large\xref02.obj large\xref03.obj + +part.l3 : ! + large\arcfiles.obj large\archead.obj large\lzhhead.obj ! + large\ebcasc.obj large\param001.obj large\param002.obj ! + large\dsklscrd.obj large\copyfile.obj large\copyfil0.obj ! + large\convent1.obj large\convent2.obj large\convent4.obj large\convent5.obj ! + large\convent6.obj ! + large\dpp_0001.obj large\dpp_0002.obj large\dpp_0003.obj large\dpp_0004.obj ! + large\dpp_0005.obj large\dpp_0006.obj large\dpp_0007.obj large\dpp_0008.obj ! + large\rndlong.obj ! + large\lng2hex.obj large\lng2nstr.obj large\hex2bin.obj ! + large\bin2hex.obj large\bin2hexr.obj large\diagnose.obj + +fileio.lgrp: ! + large\file2buf.obj large\file2low.obj large\file2upp.obj large\fileio.obj ! + large\fclosec.obj + +dirt.lgrp : large\dirt_001.obj large\dirt_002.obj large\dirt_003.obj ! + large\dirt_004.obj large\dirt_005.obj large\dirt_006.obj large\dirt_007.obj ! + large\dirt_008.obj large\dirt_009.obj large\dirt_010.obj large\dirt_011.obj ! + large\dirt_012.obj large\dirt_i12.obj large\dirt_l12.obj ! + large\dirt_013.obj large\dirt_i13.obj large\dirt_l13.obj ! + large\dirt_i14.obj large\dirt_l14.obj ! + large\dirt_i16.obj large\dirt_l16.obj ! + large\int24.obj large\int14l.obj + +filename.lgrp : ! + large\cdromfnm.obj large\curdisk.obj large\dcd01.obj ! + large\envbinsr.obj large\envfilsr.obj large\extcmp.obj ! + large\fnmcpy.obj large\fnmcpy2.obj large\fnmcpy3.obj large\fnmcpy4.obj ! + large\fnmdef.obj large\fnmdestn.obj large\fmtdta01.obj large\fmtdta02.obj ! + large\fnmreal.obj large\fnmrenm.obj large\fnmsep1.obj ! + large\fnmsep2.obj large\fnmsep3.obj large\fnmsep4.obj large\fnmdpath.obj ! + large\fnm_d2u.obj large\fndvfile.obj large\getcdir0.obj large\getcdir1.obj ! + large\gennednm.obj large\logicfnm.obj large\makepath.obj large\modtbl.obj ! + large\rotfile.obj large\setetcfn.obj large\settmpfn.obj large\tellext.obj ! + large\vshift01.obj large\wildcard.obj large\wildcrd2.obj + +wildcard.lgrp : ! + large\wcrd_001.obj large\wcrd_002.obj large\wcrd_003.obj ! + large\wcrd_004.obj large\wcrd_005.obj large\wcrd_006.obj ! + large\wcrd_007.obj large\wcrd_008.obj large\wcrd_009.obj ! + large\wcrd_d01.obj large\wcrd_d02.obj + +unix.lgrp : ! + large\unix0001.obj large\unix0002.obj large\unix0003.obj + +# SMALL Library -------------------------------------------------------------- +lib.ssbr : part.s1 part.s2 part.s3 ssbr.lib + +ssbr.lib : + llink -v -lssbr.lib -dssbr.mod -n0 + del ssbr.bak + +part.s1 : ! + small\fileio.obj small\fmt.obj small\fsopen.obj ! + small\topen.obj small\ftopen.obj ! + small\ftrans01.obj small\ftrans02.obj small\ftrans03.obj ! + small\fscanlin.obj small\freadlin.obj small\fparslin.obj ! + small\identkey.obj small\scan.obj ! + small\fnames.obj small\fnames2.obj small\getpwd.obj ! + small\arcfiles.obj small\archead.obj small\lzhhead.obj ! + small\ebcasc.obj small\copyfile.obj + +part.s3 : ! + small\dirt_s01.obj small\dirt_s02.obj small\dirt_s03.obj small\dirt_s04.obj ! + small\dirt_s05.obj small\dirt_s06.obj small\dirt_s08.obj small\dirt_s09.obj ! + small\dirt_s10.obj small\dirt_s11.obj + +# File Input/Output ---------------------------------------------------------- +large\file2buf.obj : file2buf.c + $(cml) $? + $(obj) -sl 2 FILEIO_TEXT $@ + +large\fclosec.obj : fclosec.c + $(cml) $? + $(obj) -sl 2 FILEIO_TEXT $@ + +large\file2low.obj : file2low.c + $(cml) -DTO_LOWER file2low.c + $(obj) -sl 2 FILEIO_TEXT large\file2low.obj + +large\file2upp.obj : file2low.c + $(cml) -DTO_UPPER file2low.c + $(obj) -sl 2 FILEIO_TEXT large\file2upp.obj + +small\fileio.obj : fileio.c + $(cms) fileio.c + +large\fileio.obj : fileio.c + $(cml) fileio.c + $(obj) -sl 2 FILEIO_TEXT large\fileio.obj + +# Zeilen von Files lesen und parsen ------------------------------------------ +small\fscanlin.obj : fscanlin.c + $(cms) fscanlin.c + +large\fscanlin.obj : fscanlin.c + $(cml) fscanlin.c + $(obj) -sl 2 FILEIO_TEXT large\fscanlin.obj + +small\freadlin.obj : freadlin.c + $(cms) freadlin.c + +large\freadlin.obj : freadlin.c + $(cml) freadlin.c + $(obj) -sl 2 FILEIO_TEXT large\freadlin.obj + +large\frmaclin.obj : freadlin.c + $(cml) -DMAC_MODE freadlin.c + $(obj) -sl 2 FILEIO_TEXT large\frmaclin.obj + +large\freadit.obj : freadit.c + $(cml) freadit.c + $(obj) -sl 2 FILEIO_TEXT large\freadit.obj + +large\freadst.obj : freadst.c + $(cml) freadst.c + $(obj) -sl 2 FILEIO_TEXT large\freadst.obj + +large\freaditf.obj : freaditf.c + $(cml) freaditf.c + $(obj) -sl 2 FILEIO_TEXT large\freaditf.obj + +large\freadstf.obj : freadstf.c + $(cml) freadstf.c + $(obj) -sl 2 FILEIO_TEXT large\freadstf.obj + +large\trasheol.obj : trasheol.c + $(cml) trasheol.c + $(obj) -sl 2 FILEIO_TEXT large\trasheol.obj + +small\fparslin.obj : fparslin.c + $(cms) fparslin.c + +large\fparslin.obj : fparslin.c + $(cml) fparslin.c + $(obj) -sl 2 FILEIO_TEXT large\fparslin.obj + +# Masken Editor -------------------------------------------------------------- +small\masked_1.obj : masked_1.c $(incl)masked_1.h + $(cms) masked_1.c + +large\masked_1.obj : masked_1.c $(incl)masked_1.h + $(cml) masked_1.c + +large\masked_t.obj : masked_t.c $(incl)masked_1.h + $(cml) masked_t.c + +masked_t.exe : large\masked_t.obj large\masked_1.obj + link large\masked_t large\masked_1,,\dev\nul,\usr\sbr\lsbr; + +# Zahlenformatierung --------------------------------------------------------- +small\fmt.obj : fmt.c + $(cms) fmt.c + +large\fmt.obj : fmt.c + $(cml) fmt.c + +fmt.exe : large\fmt.obj + LINK large\fmt.obj; + fmt + +# Zeichenconvertierung: EBCDIC -> ASCII -------------------------------------- +small\ebcasc.obj : ebcasc.c + $(cms) ebcasc.c + +large\ebcasc.obj : ebcasc.c + $(cml) ebcasc.c + +# Eingaben von der Tastatur; (Varianten von \usr\g\ik*.c) -------------------- +small\scan.obj : scan.c + $(cms) scan.c + +large\scan.obj : scan.c + $(cml) scan.c + + +# Identifizieren von Tastebezeichnungen -------------------------------------- +small\identkey.obj : identkey.c + $(cms) /Os identkey.c + +large\identkey.obj : identkey.c + $(cml) identkey.c + +large\keynames.obj : keynames.c + $(cml) keynames.c + +small\t.obj : t.c + $(cms) t.c + +t.exe : small\t.obj + link small\t,,,ssbr; + +# Test fuer String-Pruefsummen ----------------------------------------------- +small\tt.obj : tt.c + $(cms) tt.c + +tt.exe : small\tt.obj + link small\tt,,,ssbr; + +# File Open fuer Netzwerk (SHARE) -------------------------------------------- +large\fsopen.obj : fsopen.c + $(cml) fsopen.c + $(obj) -sl 2 FILEIO_TEXT large\fsopen.obj + +small\fsopen.obj : fsopen.c + $(cms) fsopen.c + +# lazy file open ------------------------------------------------------------- +large\flopen.obj : flopen.c + $(cml) flopen.c + $(obj) -sl 2 FILEIO_TEXT large\flopen.obj + +# file open with warning ----------------------------------------------------- +large\fopenwng.obj : fopenwng.c + $(cml) fopenwng.c + $(obj) -sl 2 FILEIO_TEXT large\fopenwng.obj + +# file temporary open -------------------------------------------------------- +large\ftopen.obj : ftopen.c + $(cml) ftopen.c + $(obj) -sl 2 FILEIO_TEXT large\ftopen.obj + +small\ftopen.obj : ftopen.c + $(cms) ftopen.c + +# transfer data from file to file -------------------------------------------- +large\ftrans01.obj : ftrans01.c + $(cml) ftrans01.c + $(obj) -sl 2 FILEIO_TEXT large\ftrans01.obj + +large\ftrans02.obj : ftrans02.c + $(cml) ftrans02.c + $(obj) -sl 2 FILEIO_TEXT large\ftrans02.obj + +large\ftrans03.obj : ftrans03.c + $(cml) ftrans03.c + $(obj) -sl 2 FILEIO_TEXT large\ftrans03.obj + +large\ftrans04.obj : ftrans04.c + $(cml) ftrans04.c + $(obj) -sl 2 FILEIO_TEXT large\ftrans04.obj + +large\ftrans05.obj : ftrans05.c + $(cml) ftrans05.c + $(obj) -sl 2 FILEIO_TEXT large\ftrans05.obj + +large\ftrans06.obj : ftrans06.c + $(cml) ftrans06.c + $(obj) -sl 2 FILEIO_TEXT large\ftrans06.obj + +large\ftrans07.obj : ftrans07.c + $(cml) ftrans07.c + $(obj) -sl 2 FILEIO_TEXT large\ftrans07.obj + +large\ftrans08.obj : ftrans08.c + $(cml) ftrans08.c + $(obj) -sl 2 FILEIO_TEXT large\ftrans08.obj + +large\ftrans09.obj : ftrans09.c + $(cml) ftrans09.c + $(obj) -sl 2 FILEIO_TEXT large\ftrans09.obj + +large\ftrans10.obj : ftrans10.c + $(cml) ftrans10.c + $(obj) -sl 2 FILEIO_TEXT large\ftrans10.obj + +small\ftrans01.obj : ftrans01.c + $(cms) ftrans01.c + +small\ftrans02.obj : ftrans02.c + $(cms) ftrans02.c + +small\ftrans03.obj : ftrans03.c + $(cms) ftrans03.c + +# copy files ----------------------------------------------------------------- +large\copyfile.obj : copyfile.c + $(cml) copyfile.c + $(obj) -sl 2 FILES_TEXT large\copyfile.obj + +small\copyfile.obj : copyfile.c + $(cms) copyfile.c + +# copy files ----------------------------------------------------------------- +large\copyfil0.obj : copyfil0.c + $(cml) copyfil0.c + $(obj) -sl 2 FILES_TEXT large\copyfil0.obj + +small\copyfil0.obj : copyfil0.c + $(cms) copyfil0.c + +# Filematching (Aufrufe fuer DOS-Funktionen) --------------------------------- +small\fnames.obj : fnames.c $(incl)fnames.h + $(cms) -DSMALL_MODEL fnames.c + +large\fnames.obj : fnames.c $(incl)fnames.h + $(cml) -DLARGE_MODEL fnames.c + $(obj) -sl 2 FILES_TEXT large\fnames.obj + +# Filematching (Aufrufe ueber FNAMES) ---------------------------------------- +small\fnames2.obj : fnames2.c $(incl)fnames.h + $(cms) fnames2.c + +large\fnames2.obj : fnames2.c $(incl)fnames.h + $(cml) fnames2.c + $(obj) -sl 2 FILES_TEXT large\fnames2.obj + +# Filematching --------------------------------------------------------------- +large\wildcard.obj : wildcard.c $(incl)filename.h + $(cml) wildcard.c + $(obj) -sl 2 FILES_TEXT large\wildcard.obj + +large\wildcrd2.obj : wildcrd2.c $(incl)filename.h + $(cml) wildcrd2.c + $(obj) -sl 2 FILES_TEXT large\wildcrd2.obj + +# redesigned wildcard processing --------------------------------------------- +large\wcrd_001.obj : wcrd_001.c $(incl)wildcard.h + $(cml) wcrd_001.c + $(obj) -sl 2 FILES_TEXT $@ + +large\wcrd_002.obj : wcrd_002.c $(incl)wildcard.h + $(cml) wcrd_002.c + $(obj) -sl 2 FILES_TEXT $@ + +large\wcrd_003.obj : wcrd_003.c $(incl)wildcard.h + $(cml) wcrd_003.c + $(obj) -sl 2 FILES_TEXT $@ + +large\wcrd_004.obj : wcrd_004.c $(incl)wildcard.h + $(cml) wcrd_004.c + $(obj) -sl 2 FILES_TEXT $@ + +large\wcrd_005.obj : wcrd_005.c $(incl)wildcard.h + $(cml) wcrd_005.c + $(obj) -sl 2 FILES_TEXT $@ + +large\wcrd_006.obj : wcrd_006.c $(incl)wildcard.h + $(cml) wcrd_006.c + $(obj) -sl 2 FILES_TEXT $@ + +large\wcrd_007.obj : wcrd_007.c $(incl)wildcard.h + $(cml) wcrd_007.c + $(obj) -sl 2 FILES_TEXT $@ + +large\wcrd_008.obj : wcrd_008.c $(incl)wildcard.h + $(cml) wcrd_008.c + $(obj) -sl 2 FILES_TEXT $@ + +large\wcrd_009.obj : wcrd_009.c $(incl)wildcard.h + $(cml) wcrd_009.c + $(obj) -sl 2 FILES_TEXT $@ + +large\wcrd_d01.obj : wcrd_d01.c $(incl)wildcard.h + $(cml) wcrd_d01.c + $(obj) -sl 2 FILES_TEXT $@ + +large\wcrd_d02.obj : wcrd_d02.c $(incl)wildcard.h + $(cml) wcrd_d02.c + $(obj) -sl 2 FILES_TEXT $@ + +large\wcrd_d03.obj : wcrd_d03.c $(incl)wildcard.h + $(cml) wcrd_d03.c + $(obj) -sl 2 FILES_TEXT $@ + +large\wcrd_d04.obj : wcrd_d04.c $(incl)wildcard.h + $(cml) wcrd_d04.c + $(obj) -sl 2 FILES_TEXT $@ + +# make full path ------------------------------------------------------------- +large\makepath.obj : makepath.c + $(cml) makepath.c + $(obj) -sl 2 FILES_TEXT large\makepath.obj + +# format date from dta ------------------------------------------------------- +large\fmtdta01.obj : fmtdta01.c + $(cml) fmtdta01.c + $(obj) -sl 2 FILES_TEXT large\fmtdta01.obj + +# format time from dta ------------------------------------------------------- +large\fmtdta02.obj : fmtdta02.c + $(cml) fmtdta02.c + $(obj) -sl 2 FILES_TEXT large\fmtdta02.obj + +# set filename with ETC environment ------------------------------------------ +large\setetcfn.obj : setetcfn.c + $(cml) setetcfn.c + $(obj) -sl 2 FILES_TEXT large\setetcfn.obj + +large\settmpfn.obj : settmpfn.c + $(cml) settmpfn.c + $(obj) -sl 2 FILES_TEXT large\settmpfn.obj + +# change filename extension -------------------------------------------------- +large\fnmcpy.obj : fnmcpy.c + $(cml) fnmcpy.c + $(obj) -sl 2 FILES_TEXT large\fnmcpy.obj + +large\fnmcpy2.obj : fnmcpy2.c + $(cml) fnmcpy2.c + $(obj) -sl 2 FILES_TEXT large\fnmcpy2.obj + +large\fnmcpy3.obj : fnmcpy3.c + $(cml) $? + $(obj) -sl 2 FILES_TEXT $@ + +large\fnmcpy4.obj : fnmcpy4.c + $(cml) $? + $(obj) -sl 2 FILES_TEXT $@ + +large\fnmdpath.obj : fnmdpath.c + $(cml) $? + $(obj) -sl 2 FILES_TEXT $@ + +fnmcpyt.exe : fnmcpyt.c fnmcpy.c + cl -AL /W3 fnmcpyt.c + +# translate logic filenames -------------------------------------------------- +large\logicfnm.obj : logicfnm.c + $(cml) logicfnm.c + $(obj) -sl 2 FILES_TEXT large\logicfnm.obj + +test\logicfnm.obj : logicfnm.c + $(cml) -DDEBUG logicfnm.c + $(obj) -sl 2 FILES_TEXT test\logicfnm.obj + +# ---------------------------------------------------------------------------- +large\fnmdef.obj : fnmdef.c + $(cml) fnmdef.c + $(obj) -sl 2 FILES_TEXT $@ + +test\fnmdef.obj : fnmdef.c + $(cml) -DDEBUG -DDEBUG_main fnmdef.c + $(obj) -sl 2 FILES_TEXT $@ + +large\fnmreal.obj : fnmreal.c + $(cml) fnmreal.c + $(obj) -sl 2 FILES_TEXT $@ + +test\fnmreal.obj : fnmreal.c + $(cml) -DDEBUG fnmreal.c + $(obj) -sl 2 FILES_TEXT $@ + +$(bin)fnmdef.exe : test\fnmdef.obj test\fnmreal.obj test\logicfnm.obj + link test\fnmdef test\fnmreal test\logicfnm,$@,\dev\nul,lsbr/NOE/NOI; + +# ---------------------------------------------------------------------------- +large\fnmrenm.obj : fnmrenm.c + $(cml) fnmrenm.c + $(obj) -sl 2 FILES_TEXT $@ + +large\fnmdestn.obj : fnmdestn.c + $(cml) fnmdestn.c + $(obj) -sl 2 FILES_TEXT $@ + +# ---------------------------------------------------------------------------- +large\gennednm.obj : gennednm.c + $(cml) gennednm.c + $(obj) -sl 2 FILES_TEXT $@ + +test\gennednm.obj : gennednm.c + $(cml) -DDEBUG gennednm.c + $(obj) -sl 2 FILES_TEXT $@ + +$(bin)gennednm.exe : test\gennednm.obj + link test\gennednm,$@,\dev\nul,lsbr/NOE/NOI; + +# ---------------------------------------------------------------------------- +large\fndvfile.obj : fndvfile.c + $(cml) fndvfile.c + $(obj) -sl 2 FILES_TEXT $@ + +test\fndvfile.obj : fndvfile.c + $(cml) -DDEBUG -DDEBUG_main fndvfile.c + $(obj) -sl 2 FILES_TEXT $@ + +$(bin)fndvfile.exe : test\fndvfile.obj + link test\fndvfile,$@,\dev\nul,lsbr/NOE/NOI; + +# seperate path from filename ------------------------------------------------ +large\fnmsep1.obj : fnmsep1.c + $(cml) fnmsep1.c + $(obj) -sl 2 FILES_TEXT $@ + +# remove filename extension -------------------------------------------------- +large\fnmsep2.obj : fnmsep2.c + $(cml) fnmsep2.c + $(obj) -sl 2 FILES_TEXT $@ + +large\fnmsep3.obj : fnmsep3.c + $(cml) fnmsep3.c + $(obj) -sl 2 FILES_TEXT $@ + +large\fnmsep4.obj : fnmsep4.c + $(cml) fnmsep4.c + $(obj) -sl 2 FILES_TEXT $@ + +test\fnmsep4.obj : fnmsep4.c + $(cml) -DDEBUG fnmsep4.c + $(obj) -sl 2 FILES_TEXT large\fnmsep4.obj + +fnmsep4.exe : test\fnmsep4.obj + link test\fnmsep4,$@,\dev\nul,lsbr/NOE/NOI; + +# copy filenames from dos to unix style -------------------------------------- +large\fnm_d2u.obj : fnm_d2u.c + $(cml) fnm_d2u.c + $(obj) -sl 2 FILES_TEXT large\fnm_d2u.obj + +# find the current working directory ----------------------------------------- +large\getcdir0.obj : getcdir0.c + $(cml) getcdir0.c + $(obj) -sl 2 FILES_TEXT large\getcdir0.obj + +large\getcdir1.obj : getcdir1.c + $(cml) getcdir1.c + $(obj) -sl 2 FILES_TEXT large\getcdir1.obj + +# Ermittlung des Current Work Directories ------------------------------------ +small\getpwd.obj : getpwd_s.asm + masm /Ml getpwd_s,small\getpwd.obj; + +large\getpwd.obj : getpwd_l.asm + masm /Ml getpwd_l,large\getpwd.obj; + +# change working directory --------------------------------------------------- +large\dcd01.obj : dcd01.c + $(cml) $? + $(obj) -sl 2 FILES_TEXT $@ + +# ---------------------------------------------------------------------------- +large\cdromfnm.obj : cdromfnm.c + $(cml) $? + $(obj) -sl 2 FILES_TEXT $@ + +# get and set current disk --------------------------------------------------- +large\curdisk.obj : curdisk.c + $(cml) $? + $(obj) -sl 2 FILES_TEXT $@ + +# find file in path specified by environment --------------------------------- +large\envfilsr.obj : envfilsr.c + $(cml) envfilsr.c + $(obj) -sl 2 FILES_TEXT large\envfilsr.obj + +# find binary file in path specified by environment -------------------------- +large\envbinsr.obj : envbinsr.c + $(cml) envbinsr.c + $(obj) -sl 2 FILES_TEXT large\envbinsr.obj + +# compare two files by their extensions -------------------------------------- +large\extcmp.obj : extcmp.c + $(cml) extcmp.c + $(obj) -sl 2 FILES_TEXT large\extcmp.obj + +# open temporary file -------------------------------------------------------- +small\topen.obj : topen_s.asm + masm /Ml topen_s,small\topen.obj; + +large\topen.obj : topen_l.asm + masm /Ml topen_l,large\topen.obj; + +# rotate a file -------------------------------------------------------------- +large\rotfile.obj : rotfile.c + $(cml) rotfile.c + $(obj) -sl 2 FILES_TEXT large\rotfile.obj + +# process module table ------------------------------------------------------- +large\modtbl.obj : modtbl.c + $(cml) modtbl.c + $(obj) -sl 2 FILES_TEXT large\modtbl.obj + +# return filename extension -------------------------------------------------- +large\tellext.obj : tellext.c + $(cml) tellext.c + $(obj) -sl 2 FILES_TEXT large\tellext.obj + +# Verarbeiten von ARC-Files -------------------------------------------------- +small\arcfiles.obj : arcfiles.c $(incl)fnames.h $(incl)archead.h + $(cms) arcfiles.c + +large\arcfiles.obj : arcfiles.c $(incl)fnames.h $(incl)archead.h + $(cml) arcfiles.c + $(obj) -sl 2 FILES_TEXT large\arcfiles.obj + +small\archead.obj : archead.c $(incl)archead.h + $(cms) archead.c + +large\archead.obj : archead.c $(incl)archead.h + $(cml) archead.c + $(obj) -sl 2 FILES_TEXT large\archead.obj + +# Verarbeiten von LZH-Files -------------------------------------------------- +small\lzhhead.obj : lzhhead.c $(incl)lzhhead.h + $(cms) lzhhead.c + +large\lzhhead.obj : lzhhead.c $(incl)lzhhead.h + $(cml) lzhhead.c + $(obj) -sl 2 FILES_TEXT large\lzhhead.obj + +# Parameter Verarbeitung ----------------------------------------------------- +large\param001.obj : param001.c + $(cml) param001.c + $(obj) -sl 2 PARAM_TEXT large\param001.obj + +param001.exe : param001.c + $(ccl) /DTEST param001.c + del param001.obj + +large\param002.obj : param002.c + $(cml) param002.c + $(obj) -sl 2 PARAM_TEXT large\param002.obj + +large\fnmqueue.obj : fnmqueue.c + $(cml) fnmqueue.c + $(obj) -sl 2 STRINGS_TEXT large\fnmqueue.obj + +# Direktes Lesen/Schreiben von Disks ----------------------------------------- +large\dsklscrd.obj : dsklscrd.asm + masm /Ml dsklscrd,large\dsklscrd.obj; + +# Entity Processing ---------------------------------------------------------- +large\convent1.obj : convent1.c + $(cml) convent1.c + $(obj) -sl 2 STRINGS_TEXT large\convent1.obj + +large\convent2.obj : convent2.c + $(cml) convent2.c + $(obj) -sl 2 STRINGS_TEXT large\convent2.obj + +large\convent4.obj : convent4.c + $(cml) convent4.c + $(obj) -sl 2 STRINGS_TEXT large\convent4.obj + +large\convent5.obj : convent5.c + $(cml) convent5.c + $(obj) -sl 2 STRINGS_TEXT large\convent5.obj + +large\convent6.obj : convent6.c + $(cml) convent6.c + $(obj) -sl 2 STRINGS_TEXT large\convent6.obj + +# Data Portability Package --------------------------------------------------- +large\dpp_0001.obj : dpp_0001.c + $(cml) dpp_0001.c + $(obj) -sl 2 DPP_TEXT large\dpp_0001.obj + +large\dpp_0002.obj : dpp_0002.c + $(cml) dpp_0002.c + $(obj) -sl 2 DPP_TEXT large\dpp_0002.obj + +large\dpp_0003.obj : dpp_0003.c + $(cml) dpp_0003.c + $(obj) -sl 2 DPP_TEXT large\dpp_0003.obj + +large\dpp_0004.obj : dpp_0004.c + $(cml) dpp_0004.c + $(obj) -sl 2 DPP_TEXT large\dpp_0004.obj + +large\dpp_0005.obj : dpp_0005.c + $(cml) dpp_0005.c + $(obj) -sl 2 DPP_TEXT large\dpp_0005.obj + +large\dpp_0006.obj : dpp_0006.c + $(cml) dpp_0006.c + $(obj) -sl 2 DPP_TEXT $@ + +large\dpp_0007.obj : dpp_0007.c + $(cml) dpp_0007.c + $(obj) -sl 2 DPP_TEXT $@ + +large\dpp_0008.obj : dpp_0008.c + $(cml) dpp_0008.c + $(obj) -sl 2 DPP_TEXT $@ + +large\rndlong.obj : rndlong.c + $(cml) rndlong.c + $(obj) -sl 2 DPP_TEXT large\rndlong.obj + +large\lng2hex.obj : lng2hex.c + $(cml) lng2hex.c + $(obj) -sl 2 DPP_TEXT large\lng2hex.obj + +large\lng2nstr.obj : lng2nstr.c + $(cml) $? + $(obj) -sl 2 DPP_TEXT $@ + +large\bin2hex.obj : bin2hex.c + $(cml) bin2hex.c + $(obj) -sl 2 DPP_TEXT large\bin2hex.obj + +large\bin2hexr.obj : bin2hexr.c + $(cml) bin2hexr.c + $(obj) -sl 2 DPP_TEXT large\bin2hexr.obj + +large\hex2bin.obj : hex2bin.c + $(cml) hex2bin.c + $(obj) -sl 2 DPP_TEXT $@ + +large\fnmovwr.obj : fnmovwr.c + $(cml) fnmovwr.c + $(obj) -sl 2 FILE_TEXT $@ + +# ---------------------------------------------------------------------------- +large\vshift01.obj : vshift01.c + $(cml) vshift01.c + $(obj) -sl 2 FILES_TEXT large\vshift01.obj + +# diagnose: ------------------------------------------------------------------ +large\diagnose.obj : diagnose.c + $(cml) diagnose.c + $(obj) -sl 2 DPP_TEXT large\diagnose.obj + +# ============================================================================ +large\dirt_001.obj : dirt_001.c + $(cml) /W0 dirt_001.c + $(obj) -sl 2 DIRTY_TEXT large\dirt_001.obj + +large\dirt_002.obj : dirt_002.c + $(cml) /W0 dirt_002.c + $(obj) -sl 2 DIRTY_TEXT large\dirt_002.obj + +large\dirt_003.obj : dirt_003.c + $(cml) /W0 dirt_003.c + $(obj) -sl 2 DIRTY_TEXT large\dirt_003.obj + +large\dirt_004.obj : dirt_004.c + $(cml) /W0 dirt_004.c + $(obj) -sl 2 DIRTY_TEXT large\dirt_004.obj + +large\dirt_005.obj : dirt_005.c + $(cml) /W0 dirt_005.c + $(obj) -sl 2 DIRTY_TEXT large\dirt_005.obj + +large\dirt_006.obj : dirt_006.c + $(cml) /W0 dirt_006.c + $(obj) -sl 2 DIRTY_TEXT large\dirt_006.obj + +large\dirt_007.obj : dirt_007.c + $(cml) /W0 dirt_007.c + $(obj) -sl 2 DIRTY_TEXT large\dirt_007.obj + +large\dirt_008.obj : dirt_008.c + $(cml) /W0 dirt_008.c + $(obj) -sl 2 DIRTY_TEXT large\dirt_008.obj + +large\dirt_009.obj : dirt_009.c + $(cml) /W0 dirt_009.c + $(obj) -sl 2 DIRTY_TEXT large\dirt_009.obj + +large\dirt_010.obj : dirt_010.c + $(cml) /W0 dirt_010.c + $(obj) -sl 2 DIRTY_TEXT large\dirt_010.obj + +large\dirt_011.obj : dirt_011.c + $(cml) /W0 dirt_011.c + $(obj) -sl 2 DIRTY_TEXT large\dirt_011.obj + +large\dirt_012.obj : dirt_012.c + $(cml) $? + $(obj) -sl 2 DIRTY_TEXT $@ + +large\dirt_i12.obj : dirt_012.c + $(cml) -DTLT_INT $? + $(obj) -sl 2 DIRTY_TEXT $@ + +large\dirt_l12.obj : dirt_012.c + $(cml) -DTLT_LONG $? + $(obj) -sl 2 DIRTY_TEXT $@ + +large\dirt_013.obj : dirt_013.c + $(cml) $? + $(obj) -sl 2 DIRTY_TEXT $@ + +large\dirt_i13.obj : dirt_013.c + $(cml) -DTLT_INT $? + $(obj) -sl 2 DIRTY_TEXT $@ + +large\dirt_l13.obj : dirt_013.c + $(cml) -DTLT_LONG $? + $(obj) -sl 2 DIRTY_TEXT $@ + +large\dirt_i14.obj : dirt_014.c + $(cml) -DDTYPE_int $? + $(obj) -sl 2 DIRTY_TEXT $@ + +large\dirt_l14.obj : dirt_014.c + $(cml) -DDTYPE_long $? + $(obj) -sl 2 DIRTY_TEXT $@ + +large\dirt_i16.obj : dirt_016.c + $(cml) -DDTYPE_int $? + $(obj) -sl 2 DIRTY_TEXT $@ + +large\dirt_l16.obj : dirt_016.c + $(cml) -DDTYPE_long $? + $(obj) -sl 2 DIRTY_TEXT $@ + +large\int24.obj : int24.asm + masm /Ml int24.asm,$@; + +large\int14l.obj : int14l.asm + masm /Ml int14l.asm,$@; + +# ---------------------------------------------------------------------------- +small\dirt_s01.obj : dirt_001.c + $(cms) dirt_001.c + +small\dirt_s02.obj : dirt_002.c + $(cms) dirt_002.c + +small\dirt_s03.obj : dirt_003.c + $(cms) dirt_003.c + +small\dirt_s04.obj : dirt_004.c + $(cms) dirt_004.c + +small\dirt_s05.obj : dirt_005.c + $(cms) dirt_005.c + +small\dirt_s06.obj : dirt_006.c + $(cms) dirt_006.c + +small\dirt_s08.obj : dirt_008.c + $(cms) dirt_008.c + +small\dirt_s09.obj : dirt_009.c + $(cms) dirt_009.c + +small\dirt_s10.obj : dirt_010.c + $(cms) dirt_010.c + +small\dirt_s11.obj : dirt_011.c + $(cms) dirt_011.c + +# ---------------------------------------------------------------------------- +large\unix0001.obj : unix0001.c + $(cml) unix0001.c + $(obj) -sl 2 FILES_TEXT large\unix0001.obj + +large\unix0002.obj : unix0002.c + $(cml) unix0002.c + $(obj) -sl 2 FILES_TEXT large\unix0002.obj + +large\unix0003.obj : unix0003.c + $(cml) /W0 unix0003.c + $(obj) -sl 2 FILES_TEXT large\unix0003.obj + +# tools ---------------------------------------------------------------------- +large\xref01.obj : xref01.c $(incl)xref.h + $(cml) xref01.c + $(obj) -sl 2 FILES_TEXT $@ + +large\xref02.obj : xref02.c $(incl)xref.h + $(cml) xref02.c + $(obj) -sl 2 FILES_TEXT $@ + +large\xref03.obj : xref03.c $(incl)xref.h + $(cml) xref03.c + $(obj) -sl 2 FILES_TEXT $@ diff --git a/lib/sbr/misc/make-sbr.lst b/lib/sbr/misc/make-sbr.lst new file mode 100644 index 0000000000000000000000000000000000000000..b2e4007cd908e4f6816c5c8295b2193109c7e998 --- /dev/null +++ b/lib/sbr/misc/make-sbr.lst @@ -0,0 +1,124 @@ +# +# File %sbr/make-sbr.lst (Contents) +# +# contents for shar file of the %sbr package +# +# written: 1995-12-28 +# latest update: 1997-11-27 16:04:13 +# +# ---------------------------------------------------------------------------- +# +>mkdir _bak_ftr.ned +a make-ux make-ux +a make-dos make-dos +>ln -s make-ux Makefile +a (dirinf).fm '(dirinf)'.fm +a make-sbr.lst make-sbr.lst +# +>echo 'symlink pointing to the directory with the headers' +>ln -fs ../gg gg +>ln -fs ../contrib contrib +# +# general library modules - - - - - - - - - +a bin2hex.c bin2hex.c +a bin2hexr.c bin2hexr.c +a cdromfnm.c cdromfnm.c +a convent1.c convent1.c +a convent2.c convent2.c +a convent4.c convent4.c +a convent5.c convent5.c +a convent6.c convent6.c +a copyfil0.c copyfil0.c +a diagnose.c diagnose.c +a dirt_006.c dirt_006.c +a dirt_012.c dirt_012.c +a dirt_013.c dirt_013.c +a dirt_014.c dirt_014.c +a dirt_016.c dirt_016.c +a dpp_0001.c dpp_0001.c +a dpp_0002.c dpp_0002.c +a dpp_0003.c dpp_0003.c +a dpp_0005.c dpp_0005.c +a dpp_0006.c dpp_0006.c +a dpp_0007.c dpp_0007.c +a dpp_0008.c dpp_0008.c +a envfilsr.c envfilsr.c +a fclosec.c fclosec.c +a file2buf.c file2buf.c +a flopen.c flopen.c +a fndvfile.c fndvfile.c +a fnmcpy.c fnmcpy.c +a fnmcpy2.c fnmcpy2.c +a fnmcpy3.c fnmcpy3.c +a fnmcpy4.c fnmcpy4.c +a fnmdef.c fnmdef.c +a fnmdestn.c fnmdestn.c +a fnmdpath.c fnmdpath.c +a fnmovwr.c fnmovwr.c +a fnmreal.c fnmreal.c +a fnmrenm.c fnmrenm.c +a fnmsep1.c fnmsep1.c +a fnmsep2.c fnmsep2.c +a fnmsep3.c fnmsep3.c +a fnmsep4.c fnmsep4.c +a freadlin.c freadlin.c +a freadit.c freadit.c +a freaditf.c freaditf.c +a freadst.c freadst.c +a freadstf.c freadstf.c +a ftrans01.c ftrans01.c +a ftrans02.c ftrans02.c +a ftrans03.c ftrans03.c +a ftrans04.c ftrans04.c +a ftrans05.c ftrans05.c +a ftrans06.c ftrans06.c +a ftrans07.c ftrans07.c +a ftrans08.c ftrans08.c +a ftrans09.c ftrans09.c +a ftrans10.c ftrans10.c +a gennednm.c gennednm.c +a getcdir0.c getcdir0.c +a getcdir1.c getcdir1.c +a hex2bin.c hex2bin.c +a logicfnm.c logicfnm.c +a lng2hex.c lng2hex.c +a lng2nstr.c lng2nstr.c +a makepath.c makepath.c +a param001.c param001.c +a param002.c param002.c +a rndlong.c rndlong.c +a rotfile.c rotfile.c +a setetcfn.c setetcfn.c +a settmpfn.c settmpfn.c +a tellext.c tellext.c +a trasheol.c trasheol.c +a vshift01.c vshift01.c +a wcrd_001.c wcrd_001.c +a wcrd_002.c wcrd_002.c +a wcrd_003.c wcrd_003.c +a wcrd_004.c wcrd_004.c +a wcrd_005.c wcrd_005.c +a wcrd_006.c wcrd_006.c +a wcrd_007.c wcrd_007.c +a wcrd_008.c wcrd_008.c +a wcrd_009.c wcrd_009.c +a wildcrd2.c wildcrd2.c +a xref01.c xref01.c +a xref02.c xref02.c +a xref03.c xref03.c +# +a /usr/bss/sixelval.c sixelval.c +# +# MD5 processing +a /usr/contrib/md5/md5c.c md5c.c +a /usr/contrib/md5/md5d2s.c md5d2s.c +a /usr/contrib/md5/md5s2d.c md5s2d.c +a /usr/contrib/md5/md5chkb.c md5chkb.c +a /usr/contrib/md5/md5chks.c md5chks.c +a /usr/contrib/md5/md5chk2a.c md5chk2a.c +a /usr/contrib/md5/md5chk2b.c md5chk2b.c +a /usr/contrib/md5/mddriver.c mddriver.c +# /usr/contrib/md5/md5.h md5.h +# /usr/contrib/md5/md5gg.h md5gg.h +# /usr/contrib/md5/global.h global.h +a /usr/contrib/md5/rfc1321.txt rfc1321.txt diff --git a/lib/sbr/misc/makepath.c b/lib/sbr/misc/makepath.c new file mode 100644 index 0000000000000000000000000000000000000000..b3659c039783dc963409db9d9bcda648a3608d4b --- /dev/null +++ b/lib/sbr/misc/makepath.c @@ -0,0 +1,75 @@ +/* + * File %sbr/makepath.c + * + * verify that the given directory path exists and create + * missing directories + * + * written: 1991 11 08 + * latest update: 1997-03-23 14:57:51 + * + */ + +#ifdef DEBUG +#include <stdio.h> +#endif /* DEBUG */ + +#ifdef MSDOS +#include <direct.h> +/* AIX has the mkdir() prototype in sys/stat.h */ +#endif + +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#include <gg/filename.h> + +extern int errno; + +/* ------------------------------------------------------------------------ */ +int make_path ( +char *path, /* complete path to generate */ +int flags) /* bit 0: last part is a file name */ +{ + struct stat st; + int i, c; + int rc; + +#ifdef DEBUG + printf (">> make_path (%s)\n", %s); +#endif /* DEBUG */ + + for (i= 0;; i++) + { + c= path[i]; + if (c == 0 && (flags & 0x0001)) break; + if (c == '/' || c == '\\' || c == 0) + { + path[i]= 0; + rc= stat (path, &st); + +#ifdef DEBUG +printf (">> stat (%s) -> rc=%d errno=%d\n", path, rc, errno); +#endif /* DEBUG */ + + if (rc == 0) + { + path[i]= (char) c; + if (!(st.st_mode & S_IFDIR)) return -1; + } + else + { + if (errno == ENOENT) +#ifdef MSDOS + mkdir (path); +#else + mkdir (path, 0755); /* T2D: umask or something? */ +#endif + + path[i]= (char) c; + } + } + if (c == 0) break; + } + + return 0; +} diff --git a/lib/sbr/misc/makepath.o b/lib/sbr/misc/makepath.o new file mode 100644 index 0000000000000000000000000000000000000000..9d30afed441b7af306d09b53d15108aea267d230 Binary files /dev/null and b/lib/sbr/misc/makepath.o differ diff --git a/lib/sbr/misc/masked_1.c b/lib/sbr/misc/masked_1.c new file mode 100644 index 0000000000000000000000000000000000000000..3112285037922aff763c8b9f93dca5e24837ff3a --- /dev/null +++ b/lib/sbr/misc/masked_1.c @@ -0,0 +1,192 @@ +/* + * FILE c:/usr/sbr/masked_1.c + * + * Nicht Magisfaehig !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * + * 1988 03 28 + * + */ + +# include "masked_1.h" +# define W_MODEL_CGA +# include <gg/window.h> +# include <gg/keys.h> + +/* Daten fuer den Maskeneditor: ------------------------------------ */ +static int afld, /* aktuelles Feld in der Maske */ + err = 0, /* 1 -> Fehlermeldung ausgeben */ + err_line; + +static char *err_msg; /* Fehlermeldung */ + +/* ======================================================================== */ +int msk_edit (men, ff, dss, sc, update) +int men; /* gewaehlte Menue Seite */ +struct MSK_FIELD ff []; /* Feldbeschreibungsstrukturen */ +char *dss []; /* Datenfelder */ +int sc, /* Anzahl der Felder */ + *update; /* 1 -> Daten veraendert */ +/* RETURN: letzte nicht interpretierte Taste */ +{ int akt, i, oflg; + +# ifdef JUNK + menue (men); setcolon (ff, sc); + if (err) + { w_prntcol (0, 1, err_line, WV_ROT | W_BLINK, + err_msg); + if (err == 1) w_setnchar (0, 1, err_line, WV_GRUEN, '�', 78); + err--; + } +# endif + + for (i = 0; i < sc; i++) + scan_str (dss [i], 0, 0x10, 0, + ff [i].cx, ff [i].cy, + ff [i].lng, ff [i].attr2, &oflg); + for (;;) + { akt = scan_str (dss [afld], 0, 0, 0, + ff [afld].cx, ff [afld].cy, + ff [afld].lng, ff [afld].attr1, &oflg); + *update = (oflg & 0x01); + scan_str (dss [afld], 0, 0x10, 0, + ff [afld].cx, ff [afld].cy, + ff [afld].lng, ff [afld].attr2, &oflg); + switch (akt) + { case K_CUP : + case K_CDOWN : + case K_CLEFT : + case K_CRIGHT : + case K_CTRLLEFT : + case K_CTRLRIGHT: + case 0x09: + case 0x0D: + case 0x0A: jump (ff, sc, akt, &afld); + break; + default: return akt; + } + } +} + +/* ----------------------------------------------------------------- */ +static jump (ff, sc, t, f) +struct MSK_FIELD ff []; +int sc, + t, + *f; +{ int i, j, k, l; + int axx, bxx, ayy, byy, fnum; + bxx = ff [*f].cx; byy = ff [*f].cy; + switch (t) + { case 0x09: /* Tabulator */ + if ((*f) + 1 < sc) (*f)++; + else (*f) = 0; + break; + case K_CUP: axx = -1; ayy = -1; + for (i = 0; i < sc; i++) + if ((k = ff [i].cy) < byy && k > ayy) + ayy = k; + if (ayy < 0) break; + for (i = 0; i < sc; i++) + if (ff [i].cy == ayy && + (k = ff [i].cx) <= bxx && k > axx) + { axx = k; fnum = i; } + if (axx < 0) + { axx = 9999; + for (i = 0; i < sc; i++) + if (ff [i].cy == ayy && + (k = ff [i].cx) > bxx && k < axx) + { axx = k; fnum = i; } + } + if (axx > 9000) break; + *f = fnum; + break; + case 0x0D: case 0x0A: + case K_CDOWN: axx = -1; ayy = 9999; + for (i = 0; i < sc; i++) + if ((k = ff [i].cy) > byy && k < ayy) + ayy = k; + if (ayy > 9000) break; + for (i = 0; i < sc; i++) + if (ff [i].cy == ayy && + (k = ff [i].cx) <= bxx && k > axx) + { axx = k; fnum = i; } + if (axx < 0) + { axx = 9999; + for (i = 0; i < sc; i++) + if (ff [i].cy == ayy && + (k = ff [i].cx) > bxx && k < axx) + { axx = k; fnum = i; } + } + if (axx > 9000) break; + *f = fnum; + break; + case K_CTRLRIGHT: + case K_CRIGHT: axx = 9999; + for (i = 0; i < sc; i++) + if (ff [i].cy == byy && i != *f && + (k=ff [i].cx) > bxx && k < axx) + { axx = k; fnum = i; } + if (axx < 9999) + { *f = fnum; + break; + } + for (i = 0; i < sc; i++) + if ((k = ff [i].cx) > bxx && k < axx) + { axx = k; fnum = i; } + else if (k > bxx && k == axx && + delta (*f, fnum) > delta (*f, i)) + fnum = i; + if (axx > 9000) break; + *f = fnum; + break; + case K_CTRLLEFT: + case K_CLEFT: axx = -1; + for (i = 0; i < sc; i++) + if (ff [i].cy == byy && i != *f && + (k=ff [i].cx) < bxx && k > axx) + { axx = k; fnum = i; } + if (axx >= 0) + { *f = fnum; + break; + } + for (i = 0; i < sc; i++) + if ((k = ff [i].cx) < bxx && k > axx) + { axx = k; fnum = i; } + else if (k < bxx && k == axx && + delta (*f, fnum) > delta (*f, i)) + fnum = i; + if (axx < 0) break; + *f = fnum; + break; + } +} + +/* ----------------------------------------------------------------- */ +static setcolon (ff, sc) +struct MSK_FIELD ff []; +int sc; +{ int i; + for (i = 0; i < sc; i++) + { w_setchar (0, ff [i].cx - 1, ff [i].cy, WV_GELB, ':'); + w_setchar (0, ff [i].cx + ff [i].lng, ff [i].cy, WV_GELB, ':'); + } +} + +/* ----------------------------------------------------------------- */ +static int delta (a, b) +int a, b; +{ if (a - b < 0) return b - a; + else return a - b; +} + +/* ----------------------------------------------------------------- */ +void msk_set_fld (num) int num; { afld = num; } +int msk_get_fld ( ) { return afld; } + +void msk_set_err (ptr, el, en) +char *ptr; +int el, en; +{ err_msg = ptr; + err = en; + err_line = el; +} diff --git a/lib/sbr/misc/masked_t.c b/lib/sbr/misc/masked_t.c new file mode 100644 index 0000000000000000000000000000000000000000..ebe9be2ae3ad8a287d82993a9881883eaa5c8bd7 --- /dev/null +++ b/lib/sbr/misc/masked_t.c @@ -0,0 +1,42 @@ +/* + * FILE c:/usr/sbr/masked_t.c + * + * Test Modul f�r MASKED_1.C - Masken Editor + * + * 1989 09 22 + * + */ + +# include <stdlib.h> +# define W_MODEL_CGA +# include <gg/window.h> +# include <gg/keys.h> +# include <gg/masked_1.h> + +/* ------------------------------------------------------------------------ */ +# define FIELDS_1 3 +struct MSK_FIELD fields_1 [FIELDS_1] = +{ + { 1, 2, 10, WV_BLAU, WV_GELB }, + { 1, 4, 10, WV_BLAU, WV_GELB }, + { 60, 2, 10, WV_BLAU, WV_GELB } +} ; + +static char *data_1 [FIELDS_1]; + +/* ------------------------------------------------------------------------ */ +main () +{ + int rv, i, upd; + + w_init (0x0001); + for (i=0; i< FIELDS_1; i++) data_1 [i] = calloc (11, 1); + + for (;;) + { + rv = msk_edit (0, fields_1, data_1, FIELDS_1, &upd); + if (rv == K_PF7) break; + sprintf (data_1 [2], "rv=0x%04X", rv); + } + printf ("over\n"); +} diff --git a/lib/sbr/misc/modtbl.c b/lib/sbr/misc/modtbl.c new file mode 100644 index 0000000000000000000000000000000000000000..750cb09c46b240d6265d818e1d7697c689368463 --- /dev/null +++ b/lib/sbr/misc/modtbl.c @@ -0,0 +1,79 @@ +/* + * FILE %sbr/modtbl.c + * + * derive module references + * + * written: 1995-06-15 + * latest update: 1997-08-15 14:09:28 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/ytree.h> +#include <gg/filename.h> + +static struct YTREE *modules= (struct YTREE *) 0; +static int initialized= 0; + +/* ------------------------------------------------------------------------ */ +int read_module_table (char *fnm) +{ + FILE *fi; + struct YTREE *yt; +#define BUFFER_SIZE 256 +#define N_FIELDS 2 + char buffer [BUFFER_SIZE]; + char *fields [N_FIELDS]; + int field_cnt; + int rc; + + if (fnm == (char *) 0) + fnm= set_etc_filename ((char *) 0, DEFAULT_MODULE_TABLE); + + initialized= 1; + if ((fi= fopen (fnm, "r")) == (FILE *) 0) return -1; + + for (;;) + { + rc= fread_line (fi, buffer, BUFFER_SIZE); + if (rc <= 0 && feof (fi)) break; + if (buffer [0] == '#') continue; + + field_cnt= split_string (buffer, ':', fields, N_FIELDS); + if (field_cnt != 2) continue; + + if ((yt= ytree_insert_word (&modules, fields [0])) != (struct YTREE *) 0) + { + yt->YT_flags= YTflag_EOW; + yt->YT_info= (long) strdup (fields [1]); + } + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +char *get_module_directory (char *fnm) +{ + struct YTREE *yt; + + if (!initialized) read_module_table ((char *) 0); + + if ((yt= ytree_lookup_word (modules, fnm)) != (struct YTREE *) 0 + || (ytree_lookup_word_get_lng () > 0 + && (yt= ytree_lookup_word_get_last ()) + ) + ) + { + if (yt->YT_flags & YTflag_EOW) return (char *) yt->YT_info; + } + + return DEFAULT_MODULE_DIR; +} diff --git a/lib/sbr/misc/ned_dir.c b/lib/sbr/misc/ned_dir.c new file mode 100644 index 0000000000000000000000000000000000000000..7474314338feb99de452d9303408d6cd22beeaab --- /dev/null +++ b/lib/sbr/misc/ned_dir.c @@ -0,0 +1,20 @@ +/* + * FILE %sbr/ned_dir.c + * + * written: 1996-03-16 + * latest update: 1996-03-16 18:15:31 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +char *NED_DIR= "_bak_ftr.ned"; diff --git a/lib/sbr/misc/param001.c b/lib/sbr/misc/param001.c new file mode 100644 index 0000000000000000000000000000000000000000..cb325111b5a14b35f4601e91b3fafc979a5d90ae --- /dev/null +++ b/lib/sbr/misc/param001.c @@ -0,0 +1,146 @@ +/* + * FILE %sbr/param001.c + * + * written: 1990 11 09 + * 1993-04-06: cnt, renamed + * latest update: 1995-08-21 + * $Id: param001.c,v 1.2 2005/09/04 20:27:37 gonter Exp $ + * + */ + +#include <gg/dpp.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#define VARIANTE2 + +/* ------------------------------------------------------------------------ */ +long _get_parameter_value (const char *s, int cnt) +{ + long val = 0L; + long base = 16L; + int lastchar = 6; + int signum = 0; + int ch; + +#define STAT_start 0 /* in the beginning ... */ +#define STAT_oct_hex 1 /* decide between octal and hex */ +#define STAT_oct 2 /* octal number 0[0-7] */ +#define STAT_hex 3 /* hexadecimal number 0[xX][0-9a-zA-Z] */ + /* or a number with any base: */ + /* [1-9][0-9]#[0-9a-zA-Z] */ +#define STAT_dec 4 /* decimal number [1-9][0-9] */ + int stat= STAT_start; + + if (s == (char *) 0) return 0L; + + while ((ch= (int) (*s++ & 0x00FF)) != 0 && cnt-- > 0) + { + switch (stat) + { + case STAT_start: + switch (ch) + { + case '0': + stat= STAT_oct_hex; + break; +#ifdef VARIANTE1 + case '+': + signum= 0; + break; + case '-': + signum= 1; + break; +#endif +#ifdef VARIANTE2 + case '+': + break; + case '-': + signum= (signum) ? 0 : 1; + break; +#endif + case ' ': + break; + default: + if (ch < '1' || ch > '9') goto OVER; + stat= STAT_dec; + val= (long) (ch - '0'); + break; + } + break; + + case STAT_oct_hex: + if (ch == '_') break; + if (ch == 'x' || ch == 'X') stat= STAT_hex; else + if (ch >= '0' && ch <= '7') + { + stat= STAT_oct; + val= (long) (ch - '0'); + } + else goto OVER; + break; + + case STAT_oct: + if (ch == '_') break; + if (ch < '0' || ch > '7') goto OVER; + val= val*8L + ((long) (ch - '0')); + break; + + case STAT_hex: + if (ch == '_') break; + if (ch >= '0' && ch <= '9') + { + val= val*base + ((long) (ch - '0')); + } else + if (ch >= 'A' && ch < ('A' + lastchar)) + { + val= val*base + ((long) (ch - 'A' + 10)); + } else + if (ch >= 'a' && ch < ('a' + lastchar)) + { + val= val*base + ((long) (ch - 'a' + 10)); + } else goto OVER; + break; + + case STAT_dec: + if (ch == '_') break; + if (ch < '0' || ch > '9') + { + if (ch != '#') goto OVER; + { + stat= STAT_hex; + base= val; + val= 0L; + if (base > 36L) goto OVER; + lastchar= ((int) base) - 10; + } + } else val= val*10L + ((long) (ch - '0')); + break; + + default: goto OVER; + } + } + +OVER: + return (signum) ? -val : val; +} + +/* ------------------------------------------------------------------------ */ +#ifdef TEST +static char line [1024]; + +main () +{ + long rv; + + for (;;) + { + printf ("parameter: "); + scanf ("%s", line); + rv= _get_parameter_value (line, 1024); + printf ("value : %ld\n", rv); + } +} +#endif diff --git a/lib/sbr/misc/param001.o b/lib/sbr/misc/param001.o new file mode 100644 index 0000000000000000000000000000000000000000..e286b397766a22f5afaee045231f099f5f7c68b1 Binary files /dev/null and b/lib/sbr/misc/param001.o differ diff --git a/lib/sbr/misc/param002.c b/lib/sbr/misc/param002.c new file mode 100644 index 0000000000000000000000000000000000000000..50cf3758f01cb039139e72a953a1e6116fbac4a7 --- /dev/null +++ b/lib/sbr/misc/param002.c @@ -0,0 +1,23 @@ +/* + * FILE %sbr/param002.c + * + * this function is also defined as macro in <gg/dpp.h> + * + * written: 1993-04-06: cnt, renamed + * latest update: 1995-11-02 + * $Id: param002.c,v 1.3 2005/09/04 20:27:37 gonter Exp $ + * + */ + +#define NO_MACRO +#include <gg/dpp.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +long get_parameter_value (const char *s) +{ + return _get_parameter_value (s, 1024); +} diff --git a/lib/sbr/misc/param002.o b/lib/sbr/misc/param002.o new file mode 100644 index 0000000000000000000000000000000000000000..1ae3364f42cef7daadc592b17dbc411e732cac00 Binary files /dev/null and b/lib/sbr/misc/param002.o differ diff --git a/lib/sbr/misc/rndlong.c b/lib/sbr/misc/rndlong.c new file mode 100644 index 0000000000000000000000000000000000000000..cd9bd080160fcea30f5d0dfa77cf2016aa14da01 --- /dev/null +++ b/lib/sbr/misc/rndlong.c @@ -0,0 +1,35 @@ +/* + * FILE %sbr/rndlong.c + * + * written: 1994-02-04 + * latest update: 2000-08-28 12:25:49 + * $Id: rndlong.c,v 1.3 2000/08/28 19:28:06 gonter Exp $ + * + */ + +#include <stdlib.h> +#include <gg/dpp.h> + +static int seed_done= 0; + +/* ------------------------------------------------------------------------ */ +long random_long () +{ + long x; + int rv; + + if (!seed_done) + { + seed_done= 1; + alt_seed (); + rv= rand () % 16; + while (rv-- > 0) (void) rand (); + } + + rv= rand () & 0x7FFF; + x= ((long) rv) << 7; + rv= rand () & 0x7FFF; + x |= (long) rv; + + return x; +} diff --git a/lib/sbr/misc/rndlong.o b/lib/sbr/misc/rndlong.o new file mode 100644 index 0000000000000000000000000000000000000000..2654f2a628a28ecbcb42802697f92f88593dcb24 Binary files /dev/null and b/lib/sbr/misc/rndlong.o differ diff --git a/lib/sbr/misc/rotfile.c b/lib/sbr/misc/rotfile.c new file mode 100644 index 0000000000000000000000000000000000000000..4195a5d8e23437f9f536b15cd12d8cc53518cb06 --- /dev/null +++ b/lib/sbr/misc/rotfile.c @@ -0,0 +1,99 @@ +/* + * FILE %sbr/rotfile.c + * + * rotate a file + * - used in: %usr/utl/rotate.c + * + * written: 1992-02-19 + * latest update: 1997-05-30 13:03:05 + * + */ + +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <gg/filename.h> +#include <gg/strings.h> + +#define EXTRA_BUFFERS +#ifdef EXTRA_BUFFERS +#include <stdlib.h> +static char *buf1, *buf2; +#define BUFFER_SIZE 40960 +#endif + +static char tmpnm[300]; +static char rotnm[300]; + +/* ------------------------------------------------------------------------ */ +int rotate_file ( +char *fn, +FILE *fo, +int verbose_mode, +int decode_it, +int rotate_names) +{ + FILE *fi; + FILE *xfo; + int ch; + int ch2; + + xfo= fo; + + if ((fi= fopen (fn, "rb")) == (FILE *) 0) + { + fprintf (stderr, "File %s not found!\n", fn); + return -1; + } + +#ifdef EXTRA_BUFFERS + setvbuf (fi, buf1, _IOFBF, BUFFER_SIZE); +#endif + if (decode_it) + { + fnmcpy (tmpnm, fn, "$pv"); + xfo= fopen (tmpnm, "wb"); + if (xfo == (FILE *) 0) return -1; +#ifdef EXTRA_BUFFERS + setvbuf (xfo, buf2, _IOFBF, BUFFER_SIZE); +#endif + } + + if (xfo != (FILE *) 0) + { + for (;;) + { + ch= fgetc (fi) & 0x00FF; + if (feof (fi)) break; + ch2= ((ch & 0x000F) << 4) | ((ch & 0x00F0) >> 4); + fputc (ch2, xfo); + } + fclose (fi); + } + + if (decode_it) + { + if (xfo != (FILE *) 0) fclose (xfo); + unlink (fn); + if (rotate_names) + { + strcpy (rotnm, fn); + rotate13 (rotnm); + if (verbose_mode > 0) printf ("%s renamed to %s\n", fn, rotnm); + rename (tmpnm, rotnm); + } + else rename (tmpnm, fn); + } + else + { + if (rotate_names) + { + strcpy (rotnm, fn); + rotate13 (rotnm); + if (verbose_mode > 0) printf ("%s renamed to %s\n", fn, rotnm); + rename (fn, rotnm); + } + } + + return 0; +} diff --git a/lib/sbr/misc/rotfile.o b/lib/sbr/misc/rotfile.o new file mode 100644 index 0000000000000000000000000000000000000000..e3c408610dd6a11332ee1d30f820699c3c6e02e0 Binary files /dev/null and b/lib/sbr/misc/rotfile.o differ diff --git a/lib/sbr/misc/scan.c b/lib/sbr/misc/scan.c new file mode 100644 index 0000000000000000000000000000000000000000..1435b0ce04d1fe9372529de8316ce29df468a1c6 --- /dev/null +++ b/lib/sbr/misc/scan.c @@ -0,0 +1,340 @@ +/* + * FILE ~/usr/sbr/scan.c + * + * written: 1987 12 13 + * latest update: 1994-08-01 + * + */ + +#include <string.h> +#include <stdio.h> +#include <conio.h> +#define W_MODEL_CGA +#include <gg/window.h> +#include <gg/keys.h> +#include <gg/dpp.h> +#include <gg/strings.h> +#include <gg/sbr.h> + +#define T_CONST 200 + +#define POS(x) ((x)&0x00FF) + +static int coff; /* Cursor Offset im Feld */ +static int insf= 1; /* Insert Flag: 1 -> Insert Modus */ + +/* ------------------------------------------------------------------------ */ +/* Einlesen eines Strings via field_edit */ +int scan_str ( +char field [], /* editiertes Feld */ +int helpnum, /* 1. Help Seite */ +int flag, /* Bit 0: --> Field loeschen vor Edit */ + /* 1: --> Field terminieren nach Blank udgl. */ + /* 2: --> Default-Descriptor verwenden */ + /* 3: --> Editierung Ende nach 1 Input Char */ + /* == Single Character Mode */ + /* Bit 4: --> Feld nur anzeigen */ +int timeout1, +int x, +int y, +int l, +int attr, /* Koordinaten, Laenge und Attribut */ +int *oflg) /* Bit 0: field veraendert */ +/* RETURN: letzte nicht interpretierte Taste oder NULL */ +{ + char Descriptor [14]; + int ret; + int timeout; + int loop; + int i; + int key; + + helpnum; + + for (i = 4; i < 14; i++) Descriptor [i] = 0; + + if (flag & 0x01) field [0] = 0; + if (flag & 0x04) + { + Descriptor [0] = 1; + Descriptor [1] = 22; + Descriptor [2] = 78; + Descriptor [3] = WV_BLAU | W_HELL; + } + else + { + Descriptor [0] = (char) x; + Descriptor [1] = (char) y; + Descriptor [2] = (char) l; + Descriptor [3] = (char) attr; + } + + Descriptor [10] |= flag; /* Single Char Mode stellen */ + + if (flag & 0x0010) + { show_field (field, 1, Descriptor, 0); + return 0; + } + for (loop = 0; loop == 0; ) + { timeout = timeout1; + ret = field_edit (field, 1, Descriptor, &key, &timeout, oflg); + switch (ret) + { case 0: loop = 3; + break; + case 2: loop = 1; + break; + } + } + + if (flag & 0x02) + for (i = 0;;i++) + { if (field [i] <= 0x20 || field [i] >= 0x7f || + field [i] == ',' || field [i] == ';') + field [i] = 0; + if (! field [i]) break; + } + + if (loop == 3) return key; else return 0; +} + +/* ------------------------------------------------------------------------ */ +/* Ein Feld im Textmodus (40|80 Zeichen) editieren */ +int field_edit ( +char field [], /* Editiertes Feld (intern immer String) */ +int mode, /* 1 -> 80 Zeichen Mode */ +char desc [], /* Field-Descriptor-Record */ +unsigned int *key, /* letzte uninterpretierte Taste */ +unsigned int *timeout, /* (IN/OUT) Zeit Limit fuer Edit: */ + /* kann fuer ein ganzes Feld oder auch nur */ + /* fuer ein Zeichen verstanden werden */ +unsigned int *oflg) /* Bit 0: field veraender */ +/* RETURN: 0 -> keine Funktionstastenzuordnung */ +/* -> *key == uninterpretierter Tastenwert (mapped) */ +/* 1 -> Funktionstastenzuordnung gefunden */ +/* -> *key == Destination Frame Nummer (Bit 15 == 0) */ +/* 2 -> Timeout abgelaufen; *key ist undefiniert */ +{ + int strl, /* Laenge des Editierten Strings */ + disp = 1, /* 1 -> Feld muss angezeigt werden */ + retype = 0, /* 1 -> Feld muss 2. asgegeben werden (XOR) */ + retinc = 0, /* */ + bx_flg = 0, /* 1 -> Grafischer Modus */ + stop, i; + char field_save [100]; /* gesicherter Feldinhalt */ + + if (desc [10] & 0x40) field [0] = 0; + strl = strlen (field); + strcpy (field_save, field); + if (coff > strl) coff = strl; + + w_cursoron (); + + /* Editorschleife */ + for (stop = 3; stop == 3;) + { /* Cursor richtig positionieren */ + if (disp) + show_field (field, mode, desc, 1 /* -> invers */); + disp = 0; retype += retinc; + w_setcup (0, POS (desc [0]) + coff, POS (desc [1])); + switch (getkey (key, timeout)) + /* timeout fuer jeden Aufruf neu initialsieren oder nicht? */ + { case 0: /* Normale Taste eingegben; */ + /* wird lokal weiterverarbeitet */ + switch (*key) + { case K_CLEFT: if (coff) coff--; + break; + case K_CRIGHT: if (coff < POS (desc [2])-1 && coff < strl) + coff++; + break; + case K_HOME: + case 0x01: coff = 0; break; + case K_END: + case 0x07: coff = strl; + if (coff >= POS (desc [2])) + coff = POS (desc [2]) - 1; + break; + case 0x04: field [coff] = 0; + strl = strlen (field); + disp = 1; + break; + case 0x08: /* <- Taste; nach links loeschen */ + if (coff) { delstr (field, --coff); + strl--; disp = 1; + } + break; + case K_DEL: /* Nach rechts loeschen */ + delstr (field, coff); + strl = strlen (field); + disp = 1; + break; + case K_INS: /* Toggle Insert Modus */ + insf = (insf) ? 0: 1; + break; + case 0x19: + case 0x15: /* CTRL-U ==> Feld loeschen */ + strl = coff = 0; + field [0] = 0; + disp = 1; + break; + case 0x12: + case 0x1B: /* ESC-Taste ==> Restore alten Feldinhalt */ + strcpy (field, field_save); + strl = strlen (field); + if (coff > strl) coff = strl; + disp = 1; + break; + default: /* keine lokale Sonderfunktion */ + if (0x20 <= *key && *key <= 255 && *key != 127) + { /* darstellbare Zeichen werden im Feld eingebaut */ + if ((insf || strl <= coff) && (strl+1) < POS (desc [2])) + { for (i = strl; i > coff; i--) + field [i] = field [i-1]; + strl++; + } + disp = 1; + field [coff] = (char) *key; + field [strl] = 0; + if (coff+1 < POS (desc [2])) + /* Feldende noch nicht erreicht */ + coff++; + else + /* Feldende erreicht */ + if (desc [10] & 0x10) + { /* und Autoenter (Type Ahead enabled) */ + stop = 0; /* -> Funktionstaste vortaeuschen */ + } /* sonst keine Aktion */ + if (desc [10] & 0x08) + { /* Single Char Mode */ + stop = 0; + *key = 0x0100; /* Pseudo Funktion Key */ + field [coff] = 0; + } + } + else stop = 0; /* sonstige CTRL- und Funktions-Tasten */ + } + break; + case 1: /* Funktions Taste */ + stop = 0; break; + case 2: /* Time Out bei Zeichen */ + stop = 2; break; + } } + + w_cursoroff (); + show_field (field, mode, desc, 0 /* -> normal */); + *oflg = (strcmp (field_save, field) == 0) ? 0 : 1; + return stop; +} + +/* ------------------------------------------------------------------------ */ +void show_field ( +char field [], /* Feldinhalt */ +int mode, /* 1 -> 80 Zeichen */ +char desc [], /* Beschreibung des Feldes */ +int flag) /* 1 -> inverse Darstellung */ +{ + int attr; /* ausgegebenes Attribut */ + int i; + int strend= 0; /* StringEnde Flag */ + + mode; + + if (flag) + attr = (desc [3] & 0x88) /* Hell u. Blink bleibt */ + | ((desc [3] & 0x07) << 4) /* Vordegrund --> Hinterg. */ + | ((desc [3] & 0x70) >> 4); /* Hintergrund --> Voderg. */ + else attr = desc [3]; + + for (i = 0; i < POS (desc [2]); i++) + { if (!field [i]) + { w_setnchar (0, POS (desc [0]) + i, /* Blank Field */ + POS (desc [1]), attr, ' ', + POS (desc [2]) - i); + break; + } + w_setchar (0, POS (desc [0]) + i, + POS (desc [1]), attr, field [i]); + } +} + +/* ------------------------------------------------------------------------ */ +/* Einlesen von genau einer Taste OHNE Ausgabe am Schirm */ +int getkey ( +unsigned int *akt, +unsigned int *timeout) +/* RETURN: 0 -> keine Funktionstastenzuordnung */ +/* -> *akt == Tastenwert gemaess Mapkey */ +/* 1 -> Funktionstastenzuordnung gefunden */ +/* -> *akt == Destination Frame Nummer (Bit 15 = 0) */ +/* ANM: bei Special Frames werden diverse Aktionen */ +/* auf dem Stack vorbereitet !!!! */ +/* 2 -> Timeout abgelaufen; *akt ist undefiniert */ +{ int time; + + for (time = T_CONST;;) + { if (kbhit ()) + { if (!(*akt = getch ())) *akt = getch () + 0x0100; + return 0; + } + if (*timeout) + { if (*timeout == 1) return 2; + if (time) time--; + else { time = T_CONST; + (*timeout)--; + } + } + /* war *timeout beim Funktionsaufruf == 0, */ + /* dann wird notfalls ewig gewartet */ + } +} + +/* ------------------------------------------------------------------------ */ +/* Einlesen eines Integers via field_edit */ +void scan_int ( +int *field, /* editiertes Feld */ +int helpnum, /* 1. Help Seite */ +int flag, /* Bit 0: --> Field loeschen vor Edit */ + /* 1: --> Field terminieren nach Blank udgl. */ + /* 2: --> Default-Descriptor verwenden */ +int timeout1, +int x, +int y, +int l, +int attr, /* Koordinaten, Laenge und Attribut */ +int *oflg) /* Bit 0: field veraendert */ +{ + char str [80], *strp; + + sprintf (str, "%d", *field); + scan_str (str, helpnum, flag, timeout1, x, y, l, attr, oflg); + strp = str; + *field= (int) get_parameter_value (str); +} + +/* ------------------------------------------------------------------------ */ +/* Einlesen eines HEX-Integers via field_edit */ +void scan_hex ( +int *field, /* editiertes Feld */ +int helpnum, /* 1. Help Seite */ +int flag, /* Bit 0: --> Field loeschen vor Edit */ + /* 1: --> Field terminieren nach Blank udgl. */ + /* 2: --> Default-Descriptor verwenden */ +int timeout1, +int x, +int y, +int l, +int attr, /* Koordinaten, Laenge und Attribut */ +int *oflg) /* Bit 0: field veraendert */ +{ + char str [80], *strp; + + sprintf (str, "0x%04x", *field); + scan_str (str, helpnum, flag, timeout1, x, y, l, attr, oflg); + strp= str; + *field= (int) get_parameter_value (str); +} + +/* ------------------------------------------------------------------------ */ +void set_coff (int x) +{ + coff= x; +} diff --git a/lib/sbr/misc/setetcfn.c b/lib/sbr/misc/setetcfn.c new file mode 100644 index 0000000000000000000000000000000000000000..b3e1c0bd1340b69f744fe4edb9a63bf4954ff5fc --- /dev/null +++ b/lib/sbr/misc/setetcfn.c @@ -0,0 +1,52 @@ +/* + * FILE %sbr/setetcfn.c + * + * set a filename pointing into the /etc directory + * + * written: 1991 09 18 + * 1991 12 13: moved to /usr/sbr + * (before: /usr/ned/12/ned1202.c) + * latest update: 1999-04-25 17:00:50 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/filename.h> + +#ifdef MSDOS +#define DEFAULT_ETC "c:/etc" +#else +#ifdef __CMS__ +#define DEFAULT_ETC "" +#else +#endif +#define DEFAULT_ETC "/usr/local/etc" +#endif + +/* ------------------------------------------------------------------------ */ +char *set_etc_filename (char *dst, char *fnm) +{ + char *etc; + int l1; + + etc= getenv ("ETC"); + if (etc == (char *) 0) etc= DEFAULT_ETC; + l1= strlen (etc); + if (dst == (char *) 0) dst= malloc (l1 + strlen (fnm) + 2); + strcpy (dst, etc); + if (l1 > 0 +#ifdef MSDOS + && dst [l1-1] != '\\' +#endif + && dst [l1-1] != '/') + { + dst [l1++]= '/'; + dst [l1]= 0; + } + + strcpy (dst+l1, fnm); + + return dst; +} diff --git a/lib/sbr/misc/setetcfn.o b/lib/sbr/misc/setetcfn.o new file mode 100644 index 0000000000000000000000000000000000000000..4441fa085484253862eadd5531639340a52aacb8 Binary files /dev/null and b/lib/sbr/misc/setetcfn.o differ diff --git a/lib/sbr/misc/settmpfn.c b/lib/sbr/misc/settmpfn.c new file mode 100644 index 0000000000000000000000000000000000000000..eec86b8e8b4affaf745d80c46442cd660532f699 --- /dev/null +++ b/lib/sbr/misc/settmpfn.c @@ -0,0 +1,48 @@ +/* + * FILE %sbr/settmpfn.c + * + * set a filename pointing into the /tmp directory + * + * written: 1991 09 18 + * 1991 12 13: moved to /usr/sbr + * (before: /usr/ned/12/ned1202.c) + * latest update: 1999-04-25 17:00:55 + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/filename.h> + +static int temp_counter= 1; + +/* ------------------------------------------------------------------------ */ +char *set_tmp_filename (char *dst, char *fnm) +{ + char *tmp; + int fnm_allocated= 0; + int tmp_lng; + + temp_counter++; + tmp= getenv ("TMP"); + if (tmp == (char *) 0) tmp= ""; + if (fnm == (char *) 0) + { + fnm= malloc (16); + sprintf (fnm, "@@@%05d.tmp", temp_counter); + fnm_allocated= 1; + } + + tmp_lng= strlen (tmp); + if (dst == (char *) 0) dst= malloc (tmp_lng + strlen (fnm) + 2); + if (dst == (char *) 0) return (char *) 0; + strcpy (dst, tmp); + if (tmp_lng > 0 && dst [tmp_lng-1] != '\\' && dst [tmp_lng-1] != '/') + strcat (dst, "\\"); + strcat (dst, fnm); + + if (fnm_allocated) free (fnm); + + return dst; +} diff --git a/lib/sbr/misc/settmpfn.o b/lib/sbr/misc/settmpfn.o new file mode 100644 index 0000000000000000000000000000000000000000..db451efab531bf3400dfbc1c36b57c58ef06e674 Binary files /dev/null and b/lib/sbr/misc/settmpfn.o differ diff --git a/lib/sbr/misc/ssbr.crf b/lib/sbr/misc/ssbr.crf new file mode 100644 index 0000000000000000000000000000000000000000..420cdf1145e764bbbaa6f16b03ce7144c56153d9 --- /dev/null +++ b/lib/sbr/misc/ssbr.crf @@ -0,0 +1,518 @@ +_bios_blit_load...bioss030 _bios_blit_save...bioss029 +_bios_border......bioss011 _bios_box.........bioss201 +_bios_circle......bioss203 _bios_cls.........bioss016 +_bios_create......bioss103 _bios_cursoroff...bioss009 +_bios_cursoron....bioss010 _bios_cursorsize..bioss050 +_bios_display.....bioss120 _bios_display_scr..bioss121 +_bios_disp_bbox...bioss111 _bios_disp_box....bioss112 +_bios_fbos........bioss202 _bios_fcircle.....bioss204 +_bios_getchar.....bioss014 _bios_getcup......bioss042 +_bios_gr_create...bioss105 _bios_init........bioss001 +_bios_init_mode...bioss001 _bios_more........bioss118 +_bios_namecreat...bioss104 _bios_printf......bioss117 +_bios_prntcol.....bioss101 _bios_put1ln......bioss106 +_bios_putln.......bioss107 _bios_puts........bioss119 +_bios_putstr......bioss108 _bios_rd_dot......bioss025 +_bios_readln......bioss110 _bios_readstr.....bioss109 +_bios_reset.......bioss004 _bios_scrblk_down..bioss022 +_bios_scrblk_up...bioss021 _bios_scrolldown..bioss020 +_bios_scrollup....bioss019 _bios_selpage.....bioss008 +_bios_setarea.....bioss018 _bios_setchar.....bioss012 +_bios_setcup......bioss023 _bios_setnchar....bioss013 +_bios_setscreen...bioss015 _bios_setstring...bioss102 +_bios_set_col.....bioss028 _bios_set_mode....bioss027 +_bios_wr_dot......bioss024 _cga_blit_load....cga_s030 +_cga_blit_save....cga_s029 _cga_cls_col......cga_s041 +_cga_display......cga_s120 _cga_display_scr..cga_s121 +_cga_disp_bbox....cga_s111 _cga_disp_box.....cga_s112 +_cga_getchar......cga_s014 _cga_getpage......cga_s033 +_cga_get_cols.....cga_s032 _cga_get_mode.....cga_s001 +_cga_get_screen_max..cga_s043 _cga_init.........cga_s001 +_cga_init_mode....cga_s001 _cga_more.........cga_s118 +_cga_namecreat....cga_s104 _cga_printf.......cga_s117 +_cga_prntcol......cga_s101 _cga_put1ln.......cga_s106 +_cga_puts.........cga_s119 _cga_reset........cga_s004 +_cga_scrblk_left..cga_s034 _cga_scrblk_right..cga_s035 +_cga_selpage......cga_s008 _cga_setchar......cga_s012 +_cga_setcup.......bioss114 _cga_setnchar.....cga_s013 +_cga_setstring....cga_s102 _CODE_ASCII_to_EBCDIC..str_s003 +_copy_file........copyfile _dc_cal...........fmt +_dc_chk...........fmt _dc_fmt...........fmt +_dc_modus.........fmt _dc_reset.........fmt +_delstr...........str_s109 _dump.............dirt_s06 +_EBCDIC_ASCII_char_convert..ebcasc _EBCDIC_ASCII_convert..ebcasc +_EBCDIC_ASCII_INIT..ebcasc _ega_setcup.......bioss115 +_f2transfer.......ftrans02 _f3transfer.......ftrans03 +_f4fscan..........fileio _f4f_read.........fileio +_f4f_wds..........fileio _f4f_write........fileio +_Fdta_find........fnames2 _Fget_dta.........fnames2 +_field_edit.......scan _flip_int.........dirt_s08 +_flip_long........dirt_s09 _flip_long_2......dirt_s10 +_Fname_find.......fnames2 _fpars_line.......fparslin +_fread_line.......freadlin _Freset_find......fnames2 +_fscan_line.......fscanlin _Fsetdta..........fnames +_Fsfirst..........fnames _Fsnext...........fnames +_fsopen...........fsopen _ftopen...........ftopen +_ftransfer........ftrans01 _getkey...........scan +_getpwd...........getpwd _get_arc_file.....arcfiles +_get_arc_head.....archead _get_identifier...fileio +_get_lzh_head.....lzhhead _get_patch........dirt_s03 +_get_Sid..........fileio _gr_setcup........bioss113 +_identify_key.....identkey _kbclick..........key_s004 +_kbhit............key_s002 _kbhit_set_AT.....key_s002 +_kbin.............key_s001 _kbin_set_AT......key_s001 +_kbnumoff.........key_s007 _kbnumon..........key_s008 +_kbqueue..........key_s005 _kbshift..........key_s003 +_kbshift_set_AT...key_s003 _kbtype...........key_s006 +_mapkey...........bioss116 _match............str_s006 +_match_lng........str_s008 _maus_disable.....maus_s03 +_maus_enable......maus_s02 _maus_position....maus_s04 +_maus_reset.......maus_s01 _maus_setposition..maus_s05 +_maus_set_cursor_type..maus_s08 _maus_set_x_margins..maus_s06 +_maus_set_y_margins..maus_s07 _msk_edit.........masked_1 +_msk_get_fld......masked_1 _msk_set_err......masked_1 +_msk_set_fld......masked_1 _patch............dirt_s01 +_patch_str........dirt_s02 _peekb............dirt_s04 +_pokeb............dirt_s05 _scan_hex.........scan +_scan_int.........scan _scan_str.........scan +_set_coff.........scan _set_filemode.....fileio +_show_field.......scan _strcmp_c.........str_s002 +_strcmp_ebcdic....str_s003 _strcmp_us........str_s009 +_string_hash......str_s007 _strndel..........str_s108 +_strnins..........str_s107 _strnscpy.........str_s001 +_topen............topen _to_lower.........str_s004 +_to_upper.........str_s005 _VAL..............dirt_s11 +_wcrd_get_date....fnames2 _wcrd_get_size....fnames2 +_wcrd_get_time....fnames2 _W_AKT_MODE.......win_sdat +_W_DATA_initialized..win_sdat _W_GRAPH_MAX_X....win_sdat +_W_GRAPH_MAX_Y....win_sdat _w_screen_and_modes..win_sdat +_W_TEXT_AKT_MEM...cga_s001 _W_TEXT_AKT_MULT..cga_s001 +_W_TEXT_CELL_X....win_sdat _W_TEXT_CELL_Y....win_sdat +_W_TEXT_MAX_X.....win_sdat _W_TEXT_MAX_Y.....win_sdat +__bios_x_line.....bioss205 __bios_y_line.....bioss206 +__cga_get_mode....cga_s031 + +maus_s01 Offset: 00000010H Code and data size: 1aH + _maus_reset + +maus_s02 Offset: 000000e0H Code and data size: cH + _maus_enable + +maus_s03 Offset: 000001a0H Code and data size: cH + _maus_disable + +maus_s05 Offset: 00000260H Code and data size: 12H + _maus_setposition + +maus_s06 Offset: 00000330H Code and data size: 12H + _maus_set_x_margins + +maus_s07 Offset: 00000400H Code and data size: 12H + _maus_set_y_margins + +maus_s08 Offset: 000004d0H Code and data size: 15H + _maus_set_cursor_type + +masked_1 Offset: 000005a0H Code and data size: 912H + _msk_edit _msk_get_fld _msk_set_err _msk_set_fld + +maus_s04 Offset: 00001100H Code and data size: 20H + _maus_position + +dirt_s01 Offset: 000011d0H Code and data size: 26H + _patch + +dirt_s02 Offset: 000012f0H Code and data size: 2aH + _patch_str + +dirt_s03 Offset: 00001420H Code and data size: 2aH + _get_patch + +dirt_s04 Offset: 00001550H Code and data size: cH + _peekb + +dirt_s05 Offset: 00001660H Code and data size: eH + _pokeb + +dirt_s06 Offset: 00001770H Code and data size: eaH + _dump + +dirt_s08 Offset: 00001990H Code and data size: 26H + _flip_int + +dirt_s09 Offset: 00001ac0H Code and data size: 40H + _flip_long + +dirt_s10 Offset: 00001c00H Code and data size: 40H + _flip_long_2 + +dirt_s11 Offset: 00001d50H Code and data size: 24H + _VAL + +key_s001 Offset: 00001e80H Code and data size: 2bH + _kbin _kbin_set_AT + +key_s002 Offset: 00001f70H Code and data size: 21H + _kbhit _kbhit_set_AT + +key_s003 Offset: 00002060H Code and data size: 18H + _kbshift _kbshift_set_AT + +key_s004 Offset: 00002140H Code and data size: 8H + _kbclick + +key_s005 Offset: 00002200H Code and data size: 4aH + _kbqueue + +key_s006 Offset: 00002360H Code and data size: 1aH + _kbtype + +key_s007 Offset: 00002430H Code and data size: 10H + _kbnumoff + +key_s008 Offset: 000024f0H Code and data size: 10H + _kbnumon + +bioss001 Offset: 000025b0H Code and data size: 5adH + _bios_init _bios_init_mode + +freadlin Offset: 00002e30H Code and data size: 82H + _fread_line + +fsopen Offset: 00002fd0H Code and data size: 6eH + _fsopen + +archead Offset: 00003180H Code and data size: 74H + _get_arc_head + +lzhhead Offset: 00003330H Code and data size: d0H + _get_lzh_head + +identkey Offset: 00003540H Code and data size: 446H + _identify_key + +ebcasc Offset: 00003b40H Code and data size: 22bH + _EBCDIC_ASCII_char_convert _EBCDIC_ASCII_convert + _EBCDIC_ASCII_INIT + +str_s002 Offset: 00003e20H Code and data size: 1b2H + _strcmp_c + +str_s003 Offset: 000040d0H Code and data size: 26cH + _CODE_ASCII_to_EBCDIC _strcmp_ebcdic + +str_s005 Offset: 00004480H Code and data size: e6H + _to_upper + +str_s007 Offset: 00004670H Code and data size: 56H + _string_hash + +str_s009 Offset: 000047d0H Code and data size: 7aH + _strcmp_us + +str_s107 Offset: 00004950H Code and data size: 2eH + _strnins + +str_s108 Offset: 00004a80H Code and data size: 30H + _strndel + +ftrans02 Offset: 00004bb0H Code and data size: 71H + _f2transfer + +fileio Offset: 00004d70H Code and data size: ae4H + _f4fscan _f4f_read _f4f_wds _f4f_write + _get_identifier _get_Sid _set_filemode + +scan Offset: 00005c00H Code and data size: 63fH + _field_edit _getkey _scan_hex _scan_int + _scan_str _set_coff _show_field + +fmt Offset: 00006580H Code and data size: 653H + _dc_cal _dc_chk _dc_fmt _dc_modus + _dc_reset + +fparslin Offset: 00006f70H Code and data size: 9cH + _fpars_line + +fscanlin Offset: 00007130H Code and data size: f2H + _fscan_line + +ftopen Offset: 00007340H Code and data size: 44H + _ftopen + +ftrans01 Offset: 000074a0H Code and data size: 5cH + _ftransfer + +ftrans03 Offset: 00007620H Code and data size: 9dH + _f3transfer + +copyfile Offset: 00007820H Code and data size: 1c1H + _copy_file + +fnames2 Offset: 00007bb0H Code and data size: 1f6H + _Fdta_find _Fget_dta _Fname_find _Freset_find + _wcrd_get_date _wcrd_get_size _wcrd_get_time + +arcfiles Offset: 00007f80H Code and data size: cbH + _get_arc_file + +str_s001 Offset: 00008190H Code and data size: 7eH + _strnscpy + +str_s004 Offset: 00008310H Code and data size: e2H + _to_lower + +str_s006 Offset: 000084f0H Code and data size: 142H + _match + +str_s008 Offset: 00008750H Code and data size: 62H + _match_lng + +str_s109 Offset: 000088b0H Code and data size: 1cH + _delstr + +topen Offset: 000089d0H Code and data size: 1bH + _topen + +getpwd Offset: 00008a90H Code and data size: 16H + _getpwd + +fnames Offset: 00008b50H Code and data size: 66H + _Fsetdta _Fsfirst _Fsnext + +cga_s001 Offset: 00008d10H Code and data size: 2b6H + _cga_get_mode _cga_init _cga_init_mode _W_TEXT_AKT_MEM + _W_TEXT_AKT_MULT + +cga_s004 Offset: 000092b0H Code and data size: 21H + _cga_reset + +cga_s008 Offset: 00009410H Code and data size: 74H + _cga_selpage + +cga_s012 Offset: 000095e0H Code and data size: 7cH + _cga_setchar + +cga_s013 Offset: 000097a0H Code and data size: 9aH + _cga_setnchar + +cga_s014 Offset: 00009980H Code and data size: 4eH + _cga_getchar + +cga_s029 Offset: 00009af0H Code and data size: 3aH + _cga_blit_save + +cga_s030 Offset: 00009c50H Code and data size: 46H + _cga_blit_load + +cga_s031 Offset: 00009dc0H Code and data size: 13H + __cga_get_mode + +cga_s032 Offset: 00009e90H Code and data size: 11H + _cga_get_cols + +cga_s033 Offset: 00009f50H Code and data size: 13H + _cga_getpage + +cga_s034 Offset: 0000a010H Code and data size: 86H + _cga_scrblk_left + +cga_s035 Offset: 0000a1d0H Code and data size: 86H + _cga_scrblk_right + +cga_s041 Offset: 0000a390H Code and data size: 46H + _cga_cls_col + +cga_s043 Offset: 0000a530H Code and data size: 1eH + _cga_get_screen_max + +bioss004 Offset: 0000a640H Code and data size: 21H + _bios_reset + +bioss008 Offset: 0000a7a0H Code and data size: 44H + _bios_selpage + +bioss009 Offset: 0000a930H Code and data size: 26H + _bios_cursoroff + +bioss010 Offset: 0000aa70H Code and data size: 26H + _bios_cursoron + +bioss011 Offset: 0000abb0H Code and data size: 28H + _bios_border + +bioss012 Offset: 0000acf0H Code and data size: 7cH + _bios_setchar + +bioss013 Offset: 0000aeb0H Code and data size: 9aH + _bios_setnchar + +bioss014 Offset: 0000b0a0H Code and data size: 4eH + _bios_getchar + +bioss015 Offset: 0000b210H Code and data size: 40H + _bios_setscreen + +bioss016 Offset: 0000b390H Code and data size: 3eH + _bios_cls + +bioss018 Offset: 0000b500H Code and data size: 8cH + _bios_setarea + +bioss019 Offset: 0000b6d0H Code and data size: 5aH + _bios_scrollup + +bioss020 Offset: 0000b840H Code and data size: 54H + _bios_scrolldown + +bioss021 Offset: 0000b9b0H Code and data size: 94H + _bios_scrblk_up + +bioss022 Offset: 0000bb90H Code and data size: 94H + _bios_scrblk_down + +bioss023 Offset: 0000bd70H Code and data size: 30H + _bios_setcup + +bioss024 Offset: 0000bec0H Code and data size: 52H + _bios_wr_dot + +bioss025 Offset: 0000c050H Code and data size: 52H + _bios_rd_dot + +bioss027 Offset: 0000c1e0H Code and data size: 34H + _bios_set_mode + +bioss028 Offset: 0000c330H Code and data size: 2aH + _bios_set_col + +bioss029 Offset: 0000c470H Code and data size: 7cH + _bios_blit_save + +bioss030 Offset: 0000c610H Code and data size: 7eH + _bios_blit_load + +bioss042 Offset: 0000c7b0H Code and data size: 36H + _bios_getcup + +bioss050 Offset: 0000c900H Code and data size: 2aH + _bios_cursorsize + +win_sdat Offset: 0000ca50H Code and data size: 14H + _W_AKT_MODE _W_DATA_initialized _W_GRAPH_MAX_X + _W_GRAPH_MAX_Y _w_screen_and_modes _W_TEXT_CELL_X + _W_TEXT_CELL_Y _W_TEXT_MAX_X _W_TEXT_MAX_Y + +bioss101 Offset: 0000cbf0H Code and data size: 36H + _bios_prntcol + +bioss103 Offset: 0000cd60H Code and data size: 60H + _bios_create + +bioss104 Offset: 0000cf00H Code and data size: 6aH + _bios_namecreat + +bioss105 Offset: 0000d0b0H Code and data size: 6aH + _bios_gr_create + +bioss106 Offset: 0000d250H Code and data size: a8H + _bios_put1ln + +bioss107 Offset: 0000d440H Code and data size: 42H + _bios_putln + +bioss108 Offset: 0000d5d0H Code and data size: c8H + _bios_putstr + +bioss109 Offset: 0000d7f0H Code and data size: 116H + _bios_readstr + +bioss110 Offset: 0000da70H Code and data size: 138H + _bios_readln + +bioss111 Offset: 0000dd10H Code and data size: 24H + _bios_disp_bbox + +bioss112 Offset: 0000de60H Code and data size: 1fcH + _bios_disp_box + +bioss115 Offset: 0000e1b0H Code and data size: 52H + _ega_setcup + +bioss117 Offset: 0000e330H Code and data size: 1eaH + _bios_printf + +bioss118 Offset: 0000e4d0H Code and data size: 107H + _bios_more + +bioss119 Offset: 0000e760H Code and data size: d2H + _bios_puts + +bioss120 Offset: 0000e960H Code and data size: fcH + _bios_display + +bioss121 Offset: 0000ebd0H Code and data size: 48H + _bios_display_scr + +cga_s101 Offset: 0000ed50H Code and data size: 36H + _cga_prntcol + +cga_s104 Offset: 0000eeb0H Code and data size: 6aH + _cga_namecreat + +cga_s106 Offset: 0000f060H Code and data size: a8H + _cga_put1ln + +cga_s111 Offset: 0000f250H Code and data size: 24H + _cga_disp_bbox + +cga_s112 Offset: 0000f390H Code and data size: 1fcH + _cga_disp_box + +cga_s117 Offset: 0000f6e0H Code and data size: 1eaH + _cga_printf + +cga_s118 Offset: 0000f870H Code and data size: 107H + _cga_more + +cga_s119 Offset: 0000fb00H Code and data size: d2H + _cga_puts + +cga_s120 Offset: 0000fd00H Code and data size: fcH + _cga_display + +cga_s121 Offset: 0000ff70H Code and data size: 48H + _cga_display_scr + +bioss201 Offset: 000100f0H Code and data size: 78H + _bios_box + +bioss202 Offset: 000102a0H Code and data size: 4cH + _bios_fbos + +bioss203 Offset: 00010400H Code and data size: 10aH + _bios_circle + +bioss204 Offset: 00010640H Code and data size: faH + _bios_fcircle + +bioss205 Offset: 00010860H Code and data size: 2cH + __bios_x_line + +bioss206 Offset: 000109b0H Code and data size: 2cH + __bios_y_line + +bioss113 Offset: 00010b00H Code and data size: 50H + _gr_setcup + +bioss114 Offset: 00010c80H Code and data size: 16H + _cga_setcup + +bioss116 Offset: 00010dc0H Code and data size: 36H + _mapkey + +bioss102 Offset: 00010f10H Code and data size: 84H + _bios_setstring + +cga_s102 Offset: 000110d0H Code and data size: 84H + _cga_setstring diff --git a/lib/sbr/misc/ssbr.lst b/lib/sbr/misc/ssbr.lst new file mode 100644 index 0000000000000000000000000000000000000000..950f1278e04650989f312795ec077d2a96ec9877 --- /dev/null +++ b/lib/sbr/misc/ssbr.lst @@ -0,0 +1,4179 @@ + + + + + TITLE maus_s01.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _maus_reset ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + + + + + + TITLE maus_s02.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _maus_enable ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + + + + + + TITLE maus_s03.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _maus_disable ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + + + + + + TITLE maus_s05.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _maus_setposition ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + + + + + + TITLE maus_s06.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _maus_set_x_margins ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + + + + + + TITLE maus_s07.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _maus_set_y_margins ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + + + + + + TITLE maus_s08.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _maus_set_cursor_type ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE masked_1.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _msk_edit ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +PUBLIC _msk_set_fld ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=2232 +PUBLIC _msk_get_fld ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=2255 +PUBLIC _msk_set_err ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=2278 +; 4 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN __chkstk ; TYPE=0 +EXTRN _cga_setchar ; TYPE=0 +EXTRN _msk_edit ; TYPE=0 +EXTRN _msk_set_fld ; TYPE=0 +EXTRN _msk_get_fld ; TYPE=0 +EXTRN _msk_set_err ; TYPE=0 +EXTRN _scan_str ; TYPE=0 +; 8 Externals + + + + + + TITLE maus_s04.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _maus_position ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE dirt_001.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _patch ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _patch ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE dirt_002.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _patch_str ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _patch_str ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE dirt_003.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _get_patch ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _get_patch ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE dirt_004.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _peekb ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _peekb ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE dirt_005.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _pokeb ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _pokeb ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE dirt_006.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _dump ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _dump ; TYPE=0 +EXTRN _fprintf ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE dirt_008.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _flip_int ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _flip_int ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE dirt_009.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _flip_long ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _flip_long ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE dirt_010.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _flip_long_2 ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _flip_long_2 ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE dirt_011.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _VAL ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN __chkstk ; TYPE=0 +EXTRN _VAL ; TYPE=0 +; 3 Externals + + + + + + TITLE key_s001.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP _DATA, CONST, _BSS +; 1 Groups + +PUBLIC _kbin ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +PUBLIC _kbin_set_AT ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=25 +; 2 Publics + +; 0 Externals + + + + + + TITLE key_s002.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP _DATA, CONST, _BSS +; 1 Groups + +PUBLIC _kbhit ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +PUBLIC _kbhit_set_AT ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=15 +; 2 Publics + +; 0 Externals + + + + + + TITLE key_s003.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP _DATA, CONST, _BSS +; 1 Groups + +PUBLIC _kbshift_set_AT ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=6 +PUBLIC _kbshift ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 2 Publics + +; 0 Externals + + + + + + TITLE key_s004.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP _DATA, CONST, _BSS +; 1 Groups + +PUBLIC _kbclick ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE key_0005.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _kbqueue ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _int86 ; TYPE=0 +EXTRN _kbqueue ; TYPE=0 +; 3 Externals + + + + + + TITLE key_s006.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP _DATA, CONST, _BSS +; 1 Groups + +PUBLIC _kbtype ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + + + + + + TITLE key_s007.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP _DATA, CONST, _BSS +; 1 Groups + +PUBLIC _kbnumoff ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + + + + + + TITLE key_s008.asm + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP _DATA, CONST, _BSS +; 1 Groups + +PUBLIC _kbnumon ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0001.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_init ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +PUBLIC _bios_init_mode ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=65 +; 2 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_init ; TYPE=0 +EXTRN _cga_get_mode ; TYPE=0 +EXTRN _bios_init_mode ; TYPE=0 +EXTRN _int86 ; TYPE=0 +EXTRN _strcmp ; TYPE=0 +EXTRN _w_screen_and_modes ; TYPE=0 +EXTRN _W_DATA_initialized ; TYPE=0 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +EXTRN _W_TEXT_CELL_X ; TYPE=0 +EXTRN _cga_get_screen_max ; TYPE=0 +EXTRN _W_TEXT_CELL_Y ; TYPE=0 +EXTRN _W_GRAPH_MAX_X ; TYPE=0 +EXTRN _W_GRAPH_MAX_Y ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _W_AKT_MODE ; TYPE=0 +; 17 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE freadlin.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _fread_line ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _fread_line ; TYPE=0 +EXTRN _fgetc ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE fsopen.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _fsopen ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _fsopen ; TYPE=0 +EXTRN __doserrno ; TYPE=0 +EXTRN _close ; TYPE=0 +EXTRN _creat ; TYPE=0 +EXTRN _sopen ; TYPE=0 +EXTRN _fdopen ; TYPE=0 +; 7 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE archead.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _get_arc_head ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _fseek ; TYPE=0 +EXTRN _get_arc_head ; TYPE=0 +EXTRN _fgetc ; TYPE=0 +EXTRN _fread ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE lzhhead.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _get_lzh_head ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _fseek ; TYPE=0 +EXTRN _get_lzh_head ; TYPE=0 +EXTRN _strncmp ; TYPE=0 +EXTRN _fread ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE identkey.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _identify_key ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _identify_key ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE ebcasc.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _EBCDIC_ASCII_INIT ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +PUBLIC _EBCDIC_ASCII_convert ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=102 +PUBLIC _EBCDIC_ASCII_char_convert ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=178 +; 3 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _set_etc_filename ; TYPE=0 +EXTRN _access ; TYPE=0 +EXTRN _fclose ; TYPE=0 +EXTRN _EBCDIC_ASCII_INIT ; TYPE=0 +EXTRN _EBCDIC_ASCII_convert ; TYPE=0 +EXTRN _EBCDIC_ASCII_char_convert ; TYPE=0 +EXTRN _fopen ; TYPE=0 +EXTRN _fread ; TYPE=0 +; 9 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE str_0002.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _strcmp_c ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _strcmp_c ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE str_0003.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _CODE_ASCII_to_EBCDIC ; GRP=1 SEG=2 FRAME=0 TYPE=0 OFFS=0 +PUBLIC _strcmp_ebcdic ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 2 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _strcmp_ebcdic ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE str_0005.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _to_upper ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _to_upper ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE str_0007.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _string_hash ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _string_hash ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE str_0009.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _strcmp_us ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _strcmp_us ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE str_0107.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _strnins ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _strnins ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE str_0108.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _strndel ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _strndel ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE ftrans02.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _f2transfer ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _fseek ; TYPE=0 +EXTRN _ftransfer ; TYPE=0 +EXTRN _f2transfer ; TYPE=0 +EXTRN _fclose ; TYPE=0 +EXTRN _fopen ; TYPE=0 +; 6 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE fileio.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _f4f_wds ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=2138 +PUBLIC _set_filemode ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +PUBLIC _get_identifier ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=28 +PUBLIC _get_Sid ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=106 +PUBLIC _f4fscan ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=180 +PUBLIC _f4f_read ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=912 +PUBLIC _f4f_write ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=1492 +; 7 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _f4f_wds ; TYPE=0 +EXTRN _rename ; TYPE=0 +EXTRN _to_lower ; TYPE=0 +EXTRN _set_filemode ; TYPE=0 +EXTRN _get_identifier ; TYPE=0 +EXTRN _unlink ; TYPE=0 +EXTRN _get_Sid ; TYPE=0 +EXTRN _f4fscan ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _strcmp ; TYPE=0 +EXTRN _strcpy ; TYPE=0 +EXTRN _f4f_read ; TYPE=0 +EXTRN _fclose ; TYPE=0 +EXTRN _fgetc ; TYPE=0 +EXTRN _f4f_write ; TYPE=0 +EXTRN _fopen ; TYPE=0 +EXTRN _fprintf ; TYPE=0 +EXTRN _fputc ; TYPE=0 +EXTRN _access ; TYPE=0 +; 20 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE scan.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _scan_int ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=1392 +PUBLIC _scan_hex ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=1480 +PUBLIC _set_coff ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=1568 +PUBLIC _scan_str ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +PUBLIC _field_edit ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=282 +PUBLIC _show_field ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=1110 +PUBLIC _getkey ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=1294 +; 7 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _getch ; TYPE=0 +EXTRN _delstr ; TYPE=0 +EXTRN _bios_cursoroff ; TYPE=0 +EXTRN _bios_cursoron ; TYPE=0 +EXTRN _kbhit ; TYPE=0 +EXTRN _bios_setcup ; TYPE=0 +EXTRN _scan_int ; TYPE=0 +EXTRN _cga_setchar ; TYPE=0 +EXTRN _cga_setnchar ; TYPE=0 +EXTRN _scan_hex ; TYPE=0 +EXTRN _set_coff ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN __get_parameter_value ; TYPE=0 +EXTRN _strcmp ; TYPE=0 +EXTRN _scan_str ; TYPE=0 +EXTRN _strcpy ; TYPE=0 +EXTRN _sprintf ; TYPE=0 +EXTRN _strlen ; TYPE=0 +EXTRN _field_edit ; TYPE=0 +EXTRN _show_field ; TYPE=0 +EXTRN _getkey ; TYPE=0 +; 22 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE fmt.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _dc_reset ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +PUBLIC _dc_modus ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=24 +PUBLIC _dc_cal ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=40 +PUBLIC _dc_chk ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=132 +PUBLIC _dc_fmt ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=768 +; 5 Publics + +EXTRN __fltused ; TYPE=0 +EXTRN FJSRQQ ; TYPE=1 +EXTRN FISRQQ ; TYPE=1 +EXTRN FIERQQ ; TYPE=1 +EXTRN FIDRQQ ; TYPE=1 +EXTRN FIWRQQ ; TYPE=1 +EXTRN __acrtused ; TYPE=1 +EXTRN _sprintf ; TYPE=0 +EXTRN _dc_reset ; TYPE=0 +EXTRN _dc_modus ; TYPE=0 +EXTRN _dc_cal ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _dc_chk ; TYPE=0 +EXTRN _dc_fmt ; TYPE=0 +; 14 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE fparslin.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _fpars_line ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _fpars_line ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _strlen ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE fscanlin.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _fscan_line ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN __chkstk ; TYPE=0 +EXTRN _fscan_line ; TYPE=0 +EXTRN _fgetc ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE ftopen.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _ftopen ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _topen ; TYPE=0 +EXTRN _fdopen ; TYPE=0 +EXTRN _ftopen ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE ftrans01.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _ftransfer ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _ftransfer ; TYPE=0 +EXTRN _fgetc ; TYPE=0 +EXTRN _fputc ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE ftrans03.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _f3transfer ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _fseek ; TYPE=0 +EXTRN _ftransfer ; TYPE=0 +EXTRN _fclose ; TYPE=0 +EXTRN _f3transfer ; TYPE=0 +EXTRN _fopen ; TYPE=0 +; 6 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE copyfile.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _copy_file ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _fclose ; TYPE=0 +EXTRN _fgetc ; TYPE=0 +EXTRN _fopen ; TYPE=0 +EXTRN _fputc ; TYPE=0 +EXTRN _fseek ; TYPE=0 +EXTRN _ftell ; TYPE=0 +EXTRN _copy_file ; TYPE=0 +EXTRN _access ; TYPE=0 +; 9 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE fnames2.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _Fname_find ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=216 +PUBLIC _Freset_find ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=274 +PUBLIC _Fget_dta ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=264 +PUBLIC _wcrd_get_date ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=286 +PUBLIC _wcrd_get_time ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=296 +PUBLIC _wcrd_get_size ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=306 +PUBLIC _Fdta_find ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 7 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _Fname_find ; TYPE=0 +EXTRN _Freset_find ; TYPE=0 +EXTRN _Fget_dta ; TYPE=0 +EXTRN _wcrd_get_date ; TYPE=0 +EXTRN _wcrd_get_time ; TYPE=0 +EXTRN _wcrd_get_size ; TYPE=0 +EXTRN _strcmp ; TYPE=0 +EXTRN _strcpy ; TYPE=0 +EXTRN _strlen ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _Fsetdta ; TYPE=0 +EXTRN _Fsfirst ; TYPE=0 +EXTRN _Fsnext ; TYPE=0 +EXTRN _Fdta_find ; TYPE=0 +; 15 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE arcfiles.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _get_arc_file ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _fseek ; TYPE=0 +EXTRN _get_arc_file ; TYPE=0 +EXTRN _strncpy ; TYPE=0 +EXTRN _fgetc ; TYPE=0 +EXTRN _fread ; TYPE=0 +; 6 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE str_0001.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _strnscpy ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _strnscpy ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE str_0004.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _to_lower ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _to_lower ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE str_0006.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _match ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _match ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE str_0008.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _match_lng ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _match_lng ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE str_0109.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _delstr ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _delstr ; TYPE=0 +; 2 Externals + + + + + + TITLE topen_s.ASM + +_TEXT SEGMENT Byte Public CODE ; +_TEXT ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _topen ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + + + + + + TITLE getpwd_s.ASM + +_TEXT SEGMENT Byte Public CODE ; +_TEXT ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _getpwd ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE fnames.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _Fsetdta ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +PUBLIC _Fsfirst ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=26 +PUBLIC _Fsnext ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=70 +; 3 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _Fsetdta ; TYPE=0 +EXTRN _Fsfirst ; TYPE=0 +EXTRN _Fsnext ; TYPE=0 +EXTRN _bdos ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _intdos ; TYPE=0 +; 7 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0001.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _W_TEXT_AKT_MEM ; GRP=1 SEG=2 FRAME=0 TYPE=0 OFFS=354 +PUBLIC _W_TEXT_AKT_MULT ; GRP=1 SEG=2 FRAME=0 TYPE=0 OFFS=356 +PUBLIC _cga_init ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=19 +PUBLIC _cga_init_mode ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=58 +PUBLIC _cga_get_mode ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=282 +; 5 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _cga_init ; TYPE=0 +EXTRN _cga_init_mode ; TYPE=0 +EXTRN _cga_get_mode ; TYPE=0 +EXTRN _cga_get_screen_max ; TYPE=0 +EXTRN __cga_get_mode ; TYPE=0 +EXTRN _bios_set_mode ; TYPE=0 +EXTRN _w_screen_and_modes ; TYPE=0 +EXTRN _W_DATA_initialized ; TYPE=0 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +EXTRN _W_TEXT_CELL_X ; TYPE=0 +EXTRN _W_TEXT_CELL_Y ; TYPE=0 +EXTRN _W_GRAPH_MAX_X ; TYPE=0 +EXTRN _W_GRAPH_MAX_Y ; TYPE=0 +EXTRN _W_AKT_MODE ; TYPE=0 +; 16 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0004.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_reset ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _cga_reset ; TYPE=0 +EXTRN _bios_init_mode ; TYPE=0 +EXTRN _bios_cursoron ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0008.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_selpage ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_TEXT_AKT_MEM ; TYPE=0 +EXTRN _W_AKT_MODE ; TYPE=0 +EXTRN _w_screen_and_modes ; TYPE=0 +EXTRN _cga_selpage ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 6 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0012.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_setchar ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +EXTRN _cga_setchar ; TYPE=0 +EXTRN _int86 ; TYPE=0 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0013.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_setnchar ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +EXTRN _cga_setnchar ; TYPE=0 +EXTRN _int86 ; TYPE=0 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0014.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_getchar ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _cga_getchar ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0029.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_blit_save ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _cga_blit_save ; TYPE=0 +EXTRN _cga_getchar ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0030.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_blit_load ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _cga_blit_load ; TYPE=0 +EXTRN _cga_setchar ; TYPE=0 +; 3 Externals + + + + + + TITLE WIN_S031.ASM + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP _DATA, CONST, _BSS +; 1 Groups + +PUBLIC __cga_get_mode ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + + + + + + TITLE WIN_S032.ASM + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP _DATA, CONST, _BSS +; 1 Groups + +PUBLIC _cga_get_cols ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + + + + + + TITLE WIN_S033.ASM + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_getpage ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +; 0 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0034.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_scrblk_left ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _cga_scrblk_left ; TYPE=0 +EXTRN _cga_getchar ; TYPE=0 +EXTRN _cga_setchar ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0035.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_scrblk_right ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _cga_scrblk_right ; TYPE=0 +EXTRN _cga_getchar ; TYPE=0 +EXTRN _cga_setchar ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0041.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_cls_col ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +EXTRN _W_TEXT_AKT_MEM ; TYPE=0 +EXTRN _cga_cls_col ; TYPE=0 +EXTRN _set_cp ; TYPE=0 +; 6 Externals + + + + + + TITLE WIN_S043.ASM + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_get_screen_max ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN _W_TEXT_MAX_X ; TYPE=0 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +; 2 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0004.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_reset ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_reset ; TYPE=0 +EXTRN _bios_init_mode ; TYPE=0 +EXTRN _bios_cursoron ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0008.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_selpage ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _w_screen_and_modes ; TYPE=0 +EXTRN _W_AKT_MODE ; TYPE=0 +EXTRN _bios_selpage ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0009.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_cursoroff ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _int86 ; TYPE=0 +EXTRN _bios_cursoroff ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0010.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_cursoron ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _int86 ; TYPE=0 +EXTRN _bios_cursoron ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0011.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_border ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_border ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0012.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_setchar ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +EXTRN _bios_setchar ; TYPE=0 +EXTRN _int86 ; TYPE=0 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0013.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_setnchar ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +EXTRN _bios_setnchar ; TYPE=0 +EXTRN _int86 ; TYPE=0 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0014.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_getchar ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_getchar ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0015.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_setscreen ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +EXTRN _bios_setscreen ; TYPE=0 +EXTRN _int86 ; TYPE=0 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0016.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_cls ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _int86 ; TYPE=0 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +EXTRN _bios_cls ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0018.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_setarea ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +EXTRN _bios_setarea ; TYPE=0 +EXTRN _int86 ; TYPE=0 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0019.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_scrollup ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_scrollup ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0020.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_scrolldown ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_scrolldown ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0021.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_scrblk_up ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +EXTRN _bios_scrblk_up ; TYPE=0 +EXTRN _int86 ; TYPE=0 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0022.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_scrblk_down ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_TEXT_MAX_Y ; TYPE=0 +EXTRN _bios_scrblk_down ; TYPE=0 +EXTRN _int86 ; TYPE=0 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0023.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_setcup ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_setcup ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0024.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_wr_dot ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_GRAPH_MAX_Y ; TYPE=0 +EXTRN _bios_wr_dot ; TYPE=0 +EXTRN _int86 ; TYPE=0 +EXTRN _W_GRAPH_MAX_X ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0025.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_rd_dot ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_GRAPH_MAX_Y ; TYPE=0 +EXTRN _bios_rd_dot ; TYPE=0 +EXTRN _int86 ; TYPE=0 +EXTRN _W_GRAPH_MAX_X ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0027.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_set_mode ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_set_mode ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0028.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_set_col ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_set_col ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0029.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_blit_save ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_blit_save ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0030.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_blit_load ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_blit_load ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0042.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_getcup ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_getcup ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0050.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_cursorsize ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_cursorsize ; TYPE=0 +EXTRN _int86 ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_data.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _w_screen_and_modes ; GRP=1 SEG=2 FRAME=0 TYPE=0 OFFS=0 +PUBLIC _W_DATA_initialized ; GRP=1 SEG=2 FRAME=0 TYPE=0 OFFS=4 +PUBLIC _W_TEXT_MAX_X ; GRP=1 SEG=2 FRAME=0 TYPE=0 OFFS=6 +PUBLIC _W_TEXT_MAX_Y ; GRP=1 SEG=2 FRAME=0 TYPE=0 OFFS=8 +PUBLIC _W_TEXT_CELL_X ; GRP=1 SEG=2 FRAME=0 TYPE=0 OFFS=10 +PUBLIC _W_TEXT_CELL_Y ; GRP=1 SEG=2 FRAME=0 TYPE=0 OFFS=12 +PUBLIC _W_GRAPH_MAX_X ; GRP=1 SEG=2 FRAME=0 TYPE=0 OFFS=14 +PUBLIC _W_GRAPH_MAX_Y ; GRP=1 SEG=2 FRAME=0 TYPE=0 OFFS=16 +PUBLIC _W_AKT_MODE ; GRP=1 SEG=2 FRAME=0 TYPE=0 OFFS=18 +; 9 Publics + +EXTRN __acrtused ; TYPE=1 +; 1 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0101.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_prntcol ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +EXTRN _bios_setchar ; TYPE=0 +EXTRN _bios_prntcol ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0103.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_create ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_setcup ; TYPE=0 +EXTRN _bios_scrollup ; TYPE=0 +EXTRN _bios_create ; TYPE=0 +EXTRN _bios_disp_bbox ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0104.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_namecreat ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_setcup ; TYPE=0 +EXTRN _bios_setchar ; TYPE=0 +EXTRN _bios_create ; TYPE=0 +EXTRN _bios_namecreat ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0105.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_gr_create ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_box ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _bios_gr_create ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0106.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_put1ln ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_setchar ; TYPE=0 +EXTRN _bios_setnchar ; TYPE=0 +EXTRN _bios_scrollup ; TYPE=0 +EXTRN _bios_put1ln ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0107.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_putln ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_setcup ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _bios_scrollup ; TYPE=0 +EXTRN _bios_put1ln ; TYPE=0 +EXTRN _bios_putln ; TYPE=0 +; 6 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0108.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_putstr ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_setcup ; TYPE=0 +EXTRN _bios_setchar ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _bios_scrollup ; TYPE=0 +EXTRN _bios_putstr ; TYPE=0 +; 6 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0109.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_readstr ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_setcup ; TYPE=0 +EXTRN _bios_setchar ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _bios_scrollup ; TYPE=0 +EXTRN _bios_readstr ; TYPE=0 +EXTRN _mapkey ; TYPE=0 +; 7 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0110.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_readln ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_setcup ; TYPE=0 +EXTRN _bios_setchar ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _bios_scrollup ; TYPE=0 +EXTRN _bios_readln ; TYPE=0 +EXTRN _mapkey ; TYPE=0 +; 7 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0111.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_disp_bbox ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_disp_box ; TYPE=0 +EXTRN _bios_disp_bbox ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0112.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_disp_box ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_disp_box ; TYPE=0 +EXTRN _bios_setchar ; TYPE=0 +EXTRN _bios_setnchar ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0115.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _ega_setcup ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN __chkstk ; TYPE=0 +EXTRN _ega_setcup ; TYPE=0 +EXTRN _bios_wr_dot ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0117.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_printf ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN __chkstk ; TYPE=0 +EXTRN _bios_printf ; TYPE=0 +EXTRN _sprintf ; TYPE=0 +EXTRN _bios_puts ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0118.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_more ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _fscanf ; TYPE=0 +EXTRN _fsopen ; TYPE=0 +EXTRN _bios_more ; TYPE=0 +EXTRN _access ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _mapkey ; TYPE=0 +EXTRN _bios_put1ln ; TYPE=0 +EXTRN _fclose ; TYPE=0 +EXTRN _fgetc ; TYPE=0 +; 10 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0119.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_puts ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_puts ; TYPE=0 +EXTRN _bios_setchar ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0120.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_display ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_border ; TYPE=0 +EXTRN _bios_setchar ; TYPE=0 +EXTRN _bios_scrblk_up ; TYPE=0 +EXTRN _bios_disp_bbox ; TYPE=0 +EXTRN _bios_setscreen ; TYPE=0 +EXTRN _bios_display ; TYPE=0 +; 7 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0121.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_display_scr ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _VAL ; TYPE=0 +EXTRN _bios_display ; TYPE=0 +EXTRN _bios_display_scr ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0101.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_prntcol ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _W_TEXT_MAX_X ; TYPE=0 +EXTRN _cga_setchar ; TYPE=0 +EXTRN _cga_prntcol ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0104.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_namecreat ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_setcup ; TYPE=0 +EXTRN _cga_setchar ; TYPE=0 +EXTRN _bios_create ; TYPE=0 +EXTRN _cga_namecreat ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0106.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_put1ln ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _cga_setchar ; TYPE=0 +EXTRN _cga_setnchar ; TYPE=0 +EXTRN _bios_scrollup ; TYPE=0 +EXTRN _cga_put1ln ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0111.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_disp_bbox ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _cga_disp_box ; TYPE=0 +EXTRN _cga_disp_bbox ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0112.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_disp_box ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _cga_disp_box ; TYPE=0 +EXTRN _cga_setchar ; TYPE=0 +EXTRN _cga_setnchar ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0117.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_printf ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN __chkstk ; TYPE=0 +EXTRN _cga_printf ; TYPE=0 +EXTRN _sprintf ; TYPE=0 +EXTRN _cga_puts ; TYPE=0 +; 5 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0118.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_more ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _fscanf ; TYPE=0 +EXTRN _fsopen ; TYPE=0 +EXTRN _cga_more ; TYPE=0 +EXTRN _access ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _mapkey ; TYPE=0 +EXTRN _fclose ; TYPE=0 +EXTRN _cga_put1ln ; TYPE=0 +EXTRN _fgetc ; TYPE=0 +; 10 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0119.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_puts ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _cga_puts ; TYPE=0 +EXTRN _cga_setchar ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0120.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_display ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_border ; TYPE=0 +EXTRN _cga_setchar ; TYPE=0 +EXTRN _bios_scrblk_up ; TYPE=0 +EXTRN _cga_disp_bbox ; TYPE=0 +EXTRN _bios_setscreen ; TYPE=0 +EXTRN _cga_display ; TYPE=0 +; 7 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0121.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_display_scr ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _VAL ; TYPE=0 +EXTRN _cga_display ; TYPE=0 +EXTRN _cga_display_scr ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0201.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_box ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_box ; TYPE=0 +EXTRN __bios_x_line ; TYPE=0 +EXTRN __bios_y_line ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0202.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_fbos ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_fbos ; TYPE=0 +EXTRN __bios_x_line ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0203.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_circle ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_circle ; TYPE=0 +EXTRN _bios_wr_dot ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0204.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_fcircle ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_fcircle ; TYPE=0 +EXTRN __bios_x_line ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0205.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC __bios_x_line ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN __bios_x_line ; TYPE=0 +EXTRN _bios_wr_dot ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0206.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC __bios_y_line ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN __bios_y_line ; TYPE=0 +EXTRN _bios_wr_dot ; TYPE=0 +; 3 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0113.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _gr_setcup ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _gr_setcup ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +EXTRN _bios_wr_dot ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0114.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_setcup ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _gr_setcup ; TYPE=0 +EXTRN _cga_setcup ; TYPE=0 +EXTRN __chkstk ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0116.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _mapkey ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN __chkstk ; TYPE=0 +EXTRN _int86 ; TYPE=0 +EXTRN _mapkey ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0102.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _bios_setstring ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _bios_setstring ; TYPE=0 +EXTRN _bios_setchar ; TYPE=0 +EXTRN _bios_setnchar ; TYPE=0 +; 4 Externals + +; Translator : MS C +; use Library: SLIBCE + + + + + TITLE win_0102.c + +_TEXT SEGMENT Word Public CODE ; +_TEXT ENDS +_DATA SEGMENT Word Public DATA ; +_DATA ENDS +CONST SEGMENT Word Public CONST ; +CONST ENDS +_BSS SEGMENT Word Public BSS ; +_BSS ENDS +; 4 Segmente + +DGROUP GROUP CONST, _BSS, _DATA +; 1 Groups + +PUBLIC _cga_setstring ; GRP=0 SEG=1 FRAME=0 TYPE=0 OFFS=0 +; 1 Publics + +EXTRN __acrtused ; TYPE=1 +EXTRN _cga_setstring ; TYPE=0 +EXTRN _cga_setchar ; TYPE=0 +EXTRN _cga_setnchar ; TYPE=0 +; 4 Externals + diff --git a/lib/sbr/misc/ssbr.mod b/lib/sbr/misc/ssbr.mod new file mode 100644 index 0000000000000000000000000000000000000000..1c6b6bfc1671341351ab108cfc4fe890bdcf2af1 --- /dev/null +++ b/lib/sbr/misc/ssbr.mod @@ -0,0 +1,51 @@ +# +# FILE ~sbr/ssbr.mod +# +# Linker / Library Steuerfile fuer SBR-Library +# +# ============ +# Small Modell +# ============ +# +# TAG-Field: Bit 0 ... Library +# +# written: 1988 03 29 +# latest update: 1994-10-02 +# +1 small\datum.obj 0 +1 small\getdatim.obj 0 +1 small\fileio.obj 2e8eae66 +1 small\masked_1.obj 0 +1 small\scan.obj 2e8eae8a +1 small\fmt.obj 2e8eae76 +1 small\fparslin.obj 2e8eae84 +1 small\freadlin.obj 2dca5cac +1 small\fscanlin.obj 2e8eae80 +1 small\fsopen.obj 2dca5c9a +1 small\ftopen.obj 2e8eae78 +1 small\ftrans01.obj 2e8eae7a +1 small\ftrans02.obj 2e8eae30 +1 small\ftrans03.obj 2e8eae7e +1 small\copyfile.obj 2e8eae96 +1 small\topen.obj 2e8eb106 +1 small\fnames.obj 2e8eb384 +1 small\fnames2.obj 2e8eae90 +1 small\arcfiles.obj 2e8eae94 +1 small\archead.obj 2dca5cce +1 small\lzhhead.obj 2dca5cd2 +1 small\getpwd.obj 2e8eb10a +1 small\identkey.obj 2dca5cb6 +1 small\ebcasc.obj 2dca5cd6 +# String Manipulation Modules +1 small\str_s001.obj 2e8eae9a +1 small\str_s002.obj 2dca5ce2 +1 small\str_s003.obj 2dca5ce6 +1 small\str_s004.obj 2e8eae9c +1 small\str_s005.obj 2dca5cee +1 small\str_s006.obj 2e8eaea0 +1 small\str_s007.obj 2dca5cf6 +1 small\str_s008.obj 2e8eaea2 +1 small\str_s009.obj 2dca5cfc +1 small\str_s107.obj 2dca5d00 +1 small\str_s108.obj 2dca5d04 +1 small\str_s109.obj 2e8eaea4 diff --git a/lib/sbr/misc/ssbr.t b/lib/sbr/misc/ssbr.t new file mode 100644 index 0000000000000000000000000000000000000000..807dd0947823667cf1f8cea1ae6bf137bbf01520 --- /dev/null +++ b/lib/sbr/misc/ssbr.t @@ -0,0 +1,139 @@ + TITLE maus_s01.asm + TITLE maus_s02.asm + TITLE maus_s03.asm + TITLE maus_s05.asm + TITLE maus_s06.asm + TITLE maus_s07.asm + TITLE maus_s08.asm + TITLE masked_1.c + TITLE maus_s04.asm + TITLE dirt_001.c + TITLE dirt_002.c + TITLE dirt_003.c + TITLE dirt_004.c + TITLE dirt_005.c + TITLE dirt_006.c + TITLE dirt_008.c + TITLE dirt_009.c + TITLE dirt_010.c + TITLE dirt_011.c + TITLE key_s001.asm + TITLE key_s002.asm + TITLE key_s003.asm + TITLE key_s004.asm + TITLE key_0005.c + TITLE key_s006.asm + TITLE key_s007.asm + TITLE key_s008.asm + TITLE win_0001.c + TITLE freadlin.c + TITLE fsopen.c + TITLE archead.c + TITLE lzhhead.c + TITLE identkey.c + TITLE ebcasc.c + TITLE str_0002.c + TITLE str_0003.c + TITLE str_0005.c + TITLE str_0007.c + TITLE str_0009.c + TITLE str_0107.c + TITLE str_0108.c + TITLE ftrans02.c + TITLE fileio.c + TITLE scan.c + TITLE fmt.c + TITLE fparslin.c + TITLE fscanlin.c + TITLE ftopen.c + TITLE ftrans01.c + TITLE ftrans03.c + TITLE copyfile.c + TITLE fnames2.c + TITLE arcfiles.c + TITLE str_0001.c + TITLE str_0004.c + TITLE str_0006.c + TITLE str_0008.c + TITLE str_0109.c + TITLE topen_s.ASM + TITLE getpwd_s.ASM + TITLE fnames.c + TITLE win_0001.c + TITLE win_0004.c + TITLE win_0008.c + TITLE win_0012.c + TITLE win_0013.c + TITLE win_0014.c + TITLE win_0029.c + TITLE win_0030.c + TITLE WIN_S031.ASM + TITLE WIN_S032.ASM + TITLE WIN_S033.ASM + TITLE win_0034.c + TITLE win_0035.c + TITLE win_0041.c + TITLE WIN_S043.ASM + TITLE win_0004.c + TITLE win_0008.c + TITLE win_0009.c + TITLE win_0010.c + TITLE win_0011.c + TITLE win_0012.c + TITLE win_0013.c + TITLE win_0014.c + TITLE win_0015.c + TITLE win_0016.c + TITLE win_0018.c + TITLE win_0019.c + TITLE win_0020.c + TITLE win_0021.c + TITLE win_0022.c + TITLE win_0023.c + TITLE win_0024.c + TITLE win_0025.c + TITLE win_0027.c + TITLE win_0028.c + TITLE win_0029.c + TITLE win_0030.c + TITLE win_0042.c + TITLE win_0050.c + TITLE win_data.c + TITLE win_0101.c + TITLE win_0103.c + TITLE win_0104.c + TITLE win_0105.c + TITLE win_0106.c + TITLE win_0107.c + TITLE win_0108.c + TITLE win_0109.c + TITLE win_0110.c + TITLE win_0111.c + TITLE win_0112.c + TITLE win_0115.c + TITLE win_0117.c + TITLE win_0118.c + TITLE win_0119.c + TITLE win_0120.c + TITLE win_0121.c + TITLE win_0101.c + TITLE win_0104.c + TITLE win_0106.c + TITLE win_0111.c + TITLE win_0112.c + TITLE win_0117.c + TITLE win_0118.c + TITLE win_0119.c + TITLE win_0120.c + TITLE win_0121.c + TITLE win_0201.c + TITLE win_0202.c + TITLE win_0203.c + TITLE win_0204.c + TITLE win_0205.c + TITLE win_0206.c + TITLE win_0113.c + TITLE win_0114.c + TITLE win_0116.c + TITLE win_0102.c + TITLE win_0102.c diff --git a/lib/sbr/misc/ssbr.ts b/lib/sbr/misc/ssbr.ts new file mode 100644 index 0000000000000000000000000000000000000000..b34e52ee7b470f77290703a56a98d592f38113a9 --- /dev/null +++ b/lib/sbr/misc/ssbr.ts @@ -0,0 +1,139 @@ + TITLE arcfiles.c + TITLE archead.c + TITLE copyfile.c + TITLE dirt_001.c + TITLE dirt_002.c + TITLE dirt_003.c + TITLE dirt_004.c + TITLE dirt_005.c + TITLE dirt_006.c + TITLE dirt_008.c + TITLE dirt_009.c + TITLE dirt_010.c + TITLE dirt_011.c + TITLE ebcasc.c + TITLE fileio.c + TITLE fmt.c + TITLE fnames.c + TITLE fnames2.c + TITLE fparslin.c + TITLE freadlin.c + TITLE fscanlin.c + TITLE fsopen.c + TITLE ftopen.c + TITLE ftrans01.c + TITLE ftrans02.c + TITLE ftrans03.c + TITLE getpwd_s.ASM + TITLE identkey.c + TITLE key_0005.c + TITLE key_s001.asm + TITLE key_s002.asm + TITLE key_s003.asm + TITLE key_s004.asm + TITLE key_s006.asm + TITLE key_s007.asm + TITLE key_s008.asm + TITLE lzhhead.c + TITLE masked_1.c + TITLE maus_s01.asm + TITLE maus_s02.asm + TITLE maus_s03.asm + TITLE maus_s04.asm + TITLE maus_s05.asm + TITLE maus_s06.asm + TITLE maus_s07.asm + TITLE maus_s08.asm + TITLE scan.c + TITLE str_0001.c + TITLE str_0002.c + TITLE str_0003.c + TITLE str_0004.c + TITLE str_0005.c + TITLE str_0006.c + TITLE str_0007.c + TITLE str_0008.c + TITLE str_0009.c + TITLE str_0107.c + TITLE str_0108.c + TITLE str_0109.c + TITLE topen_s.ASM + TITLE win_0001.c + TITLE win_0001.c + TITLE win_0004.c + TITLE win_0004.c + TITLE win_0008.c + TITLE win_0008.c + TITLE win_0009.c + TITLE win_0010.c + TITLE win_0011.c + TITLE win_0012.c + TITLE win_0012.c + TITLE win_0013.c + TITLE win_0013.c + TITLE win_0014.c + TITLE win_0014.c + TITLE win_0015.c + TITLE win_0016.c + TITLE win_0018.c + TITLE win_0019.c + TITLE win_0020.c + TITLE win_0021.c + TITLE win_0022.c + TITLE win_0023.c + TITLE win_0024.c + TITLE win_0025.c + TITLE win_0027.c + TITLE win_0028.c + TITLE win_0029.c + TITLE win_0029.c + TITLE win_0030.c + TITLE win_0030.c + TITLE win_0034.c + TITLE win_0035.c + TITLE win_0041.c + TITLE win_0042.c + TITLE win_0050.c + TITLE win_0101.c + TITLE win_0101.c + TITLE win_0102.c + TITLE win_0102.c + TITLE win_0103.c + TITLE win_0104.c + TITLE win_0104.c + TITLE win_0105.c + TITLE win_0106.c + TITLE win_0106.c + TITLE win_0107.c + TITLE win_0108.c + TITLE win_0109.c + TITLE win_0110.c + TITLE win_0111.c + TITLE win_0111.c + TITLE win_0112.c + TITLE win_0112.c + TITLE win_0113.c + TITLE win_0114.c + TITLE win_0115.c + TITLE win_0116.c + TITLE win_0117.c + TITLE win_0117.c + TITLE win_0118.c + TITLE win_0118.c + TITLE win_0119.c + TITLE win_0119.c + TITLE win_0120.c + TITLE win_0120.c + TITLE win_0121.c + TITLE win_0121.c + TITLE win_0201.c + TITLE win_0202.c + TITLE win_0203.c + TITLE win_0204.c + TITLE win_0205.c + TITLE win_0206.c + TITLE win_data.c + TITLE WIN_S031.ASM + TITLE WIN_S032.ASM + TITLE WIN_S033.ASM + TITLE WIN_S043.ASM diff --git a/lib/sbr/misc/t.c b/lib/sbr/misc/t.c new file mode 100644 index 0000000000000000000000000000000000000000..0429be1c2d0b6c54f00d5f06cb9f18df738b466b --- /dev/null +++ b/lib/sbr/misc/t.c @@ -0,0 +1,25 @@ +/* + * FILE c:/usr/sbr/t.c + * + * 1991 06 24 + * + */ + +# include <stdio.h> + +static char line1 [100], line2 [100]; + +main () +{ + int v1, v2, v3; + + for (;;) + { + printf ("1: "); scanf ("%[^\n]", line1); getchar (); + printf ("2: "); scanf ("%[^\n]", line2); getchar (); + v1 = strcmp (line1, line2); + v2 = strcmp_ebcdic (line1, line2); + v3 = strcmp_c (line1, line2); + printf ("%d %d (ebcdic) %d (case)\n", v1, v2, v3); + } +} diff --git a/lib/sbr/misc/t2dummy.c b/lib/sbr/misc/t2dummy.c new file mode 100644 index 0000000000000000000000000000000000000000..7ef24b358f43af373979e5e88dc7dee2d2c5ca48 --- /dev/null +++ b/lib/sbr/misc/t2dummy.c @@ -0,0 +1,11 @@ +/* + * FILE c:/usr/sbr/t2dummy.c + * + * Dummy Funktionen f�r T2 unter AIX + * + * 1991 03 18 + * + */ + + +getch () {} diff --git a/lib/sbr/misc/t_getcwd.c b/lib/sbr/misc/t_getcwd.c new file mode 100644 index 0000000000000000000000000000000000000000..615f5f774911d6492ae3007e1bfcc010add01962 --- /dev/null +++ b/lib/sbr/misc/t_getcwd.c @@ -0,0 +1,30 @@ +/* + * This module is intended to test how getcwd behaves on + * differen operating systems. + * + * The synopsis for this function is: + * char *getcwd (char *buffer, size_t size); + * + * AIX allowd buffer to be NULL, however size must be specified + * FreeBSD allows buffer= NULL and size= 0 + * + * $Id: t_getcwd.c,v 1.3 2004/05/08 15:43:20 gonter Exp $ + * + */ + +#include <stdio.h> +#include <unistd.h> +#include <errno.h> +#include <sys/param.h> + +int main (int argc, char *argv []) +{ + char *buffer= (char *) 0; + + buffer= getcwd (NULL, 0); + fprintf (stderr, "size=0 :: buffer=%08lX '%s' errno=%d\n", buffer, buffer, errno); + buffer= getcwd (NULL, MAXPATHLEN); + fprintf (stderr, "size=MAXPATHLEN :: buffer=%08lX '%s' errno=%d\n", buffer, buffer, errno); + + return 0; +} diff --git a/lib/sbr/misc/tellext.c b/lib/sbr/misc/tellext.c new file mode 100644 index 0000000000000000000000000000000000000000..2b88e5e995154aa012579e944e8503162d98ecf1 --- /dev/null +++ b/lib/sbr/misc/tellext.c @@ -0,0 +1,38 @@ +/* + * FILE %sbr/tellext.c + * + * return extension of a file name + * + * written: 1994-12-28 + * latest update: 1997-09-14 16:19:52 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <string.h> +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +char *tell_extension (char *s) +{ + int i; + + for (i= strlen (s)-1; i >= 0; i--) + switch (s [i] ) + { + case '.': + return &s [i+1]; + +#ifdef MSDOS + case '\\': +#endif + case '/': + i= 0; + break; + } + + return &s [strlen (s)]; /* Filename ohne Extension */ +} diff --git a/lib/sbr/misc/tellext.o b/lib/sbr/misc/tellext.o new file mode 100644 index 0000000000000000000000000000000000000000..a0607b550baafc752862af678aa258d44f5d99f1 Binary files /dev/null and b/lib/sbr/misc/tellext.o differ diff --git a/lib/sbr/misc/topen_l.asm b/lib/sbr/misc/topen_l.asm new file mode 100644 index 0000000000000000000000000000000000000000..a5d4c8e02337b70a399cee4ae4379cab9e62d9d6 --- /dev/null +++ b/lib/sbr/misc/topen_l.asm @@ -0,0 +1,59 @@ +; +; FILE ~/usr/sbr/topen_l.asm +; +; *********** +; LARGE MODEL +; *********** +; +; Eroeffnen eines temporaeren Files (unique filename) +; +; written: 1990 06 02 +; latest update: 1994-10-02 +; + + TITLE topen + + +TOPEN_TEXT SEGMENT BYTE PUBLIC 'CODE' +TOPEN_TEXT ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: TOPEN_TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP + +TOPEN_TEXT SEGMENT ; --------------------------------------------------- +; LARGE MODEL: +; a=6 Offset Path Name +; b=8 Segment Path Name +; c=10 Attributes + + PUBLIC _topen +_topen PROC far + push bp + mov bp,sp + push ds + + mov dx, [bp+6] ; Path Name + mov ds, [bp+8] + mov cx, [bp+10] ; Attributes + mov ax, 05A00h ; topen + int 021h + + jnc all_ok + mov dx, 0FFFFh + +all_ok: + sub dx,dx +over: + pop ds + mov sp,bp + pop bp + ret +_topen ENDP + +TOPEN_TEXT ENDS +END diff --git a/lib/sbr/misc/topen_s.asm b/lib/sbr/misc/topen_s.asm new file mode 100644 index 0000000000000000000000000000000000000000..1f0f59f6f910dc10285f1ff410bb1b63ecfcae31 --- /dev/null +++ b/lib/sbr/misc/topen_s.asm @@ -0,0 +1,58 @@ +; +; FILE ~/usr/sbr/topen_s.asm +; +; *********** +; SMALL MODEL +; *********** +; +; Eroeffnen eines temporaeren Files (unique filename) +; +; written: 1990 06 02 +; latest update: 1994-10-02 +; + + TITLE topen + + +_TEXT SEGMENT BYTE PUBLIC 'CODE' +_TEXT ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: _TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP + +_TEXT SEGMENT ; -------------------------------------------------------- +; LARGE MODEL: +; a=4 Offset Path Name +; c=6 Attributes + + PUBLIC _topen +_topen PROC near + push bp + mov bp,sp + push ds + + mov dx, [bp+4] ; Path Name + ; DS vom rufenden Process + mov cx, [bp+6] ; Attributes + mov ax, 05A00h ; topen + int 021h + + jnc all_ok + mov dx, 0FFFFh + +all_ok: + sub dx,dx +over: + pop ds + mov sp,bp + pop bp + ret +_topen ENDP + +_TEXT ENDS +END diff --git a/lib/sbr/misc/trasheol.c b/lib/sbr/misc/trasheol.c new file mode 100644 index 0000000000000000000000000000000000000000..7d86a051f5809c7d9ea3194e4843dcaf0d59072a --- /dev/null +++ b/lib/sbr/misc/trasheol.c @@ -0,0 +1,22 @@ +/* + * FILE ~/usr/sbr/trasheol.c + * + * overread until end of line + * + * written: 1992 07 20 + * latest update: 1994-08-14 + * + */ + +#include <stdio.h> +#include <gg/sbr.h> + +/* ------------------------------------------------------------------------ */ +long trash_until_eol (FILE *fi) +{ + long ctr= 0L; + + while (!feof (fi) && (fgetc (fi) & 0x00FF) != 0x0A) ctr++; + + return ctr; +} diff --git a/lib/sbr/misc/trasheol.o b/lib/sbr/misc/trasheol.o new file mode 100644 index 0000000000000000000000000000000000000000..cb3e7e0a1d0a5cf6a44a94d6d2eb6bf7a846c61f Binary files /dev/null and b/lib/sbr/misc/trasheol.o differ diff --git a/lib/sbr/misc/tt.c b/lib/sbr/misc/tt.c new file mode 100644 index 0000000000000000000000000000000000000000..19cee9a0c2a4c4e9f499a274ef8770398f205b01 --- /dev/null +++ b/lib/sbr/misc/tt.c @@ -0,0 +1,217 @@ +/* + * FILE c:/usr/sbr/tt.c + * + * + * 1988 11 17 + * + */ + +# include <stdio.h> +# include <gg/fnames.h> + + +# define STDHLP stderr +# define ARG_C_max 24 +static char *arg_v [ARG_C_max]; +static int arg_c = 0; + +# define XXXX xxxx /* Name der Programmfunktion */ + +static char filenm [64]; +static char line [400]; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ "USAGE: XXXX [options] {file name}\n", + "OPTIONS: -f<filename> ... List of Files\n", + "EXAMPLES: \n", + "\n", + "(@)AXXXX.c 0.0 #D$1989-02-14 15:45:00\n", + "\n", +# include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +main (argc, argv) +int argc; +char *argv []; +{ FILE *fi2; + int i, j; + + if (argc <= 1) goto HLP; + for (i = 1; i < argc; i++) + if (argv [i][0] == '-' || argv [i][0] == '/') + switch (argv [i][1]) + { case 'f': case 'F': + if (argv [i][2] == 0) break; + if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + break; + + case 'a': case 'A': +HLP: +# include <gg/help.inc> + } + else if (arg_c+1 < ARG_C_max) + arg_v [arg_c++] = argv [i]; + + if (arg_c) + for (i = 0; i < arg_c; i++) + if (arg_v [i][0] == '-') + { + if (access (& arg_v [i][2], 0) != 0) + { fprintf (stderr, "File %s not found!\n", + &arg_v [i][2]); + break; + } + fi2 = fopen (& arg_v [i][2], "rt"); + for (;;) + { fscanf (fi2, "%s", filenm); + if (feof (fi2)) break; + wildcards (filenm); + } + fclose (fi2); + } + else wildcards (arg_v [i]); + else XXXX ("Default.fil"); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +wildcards (fn) +char *fn; +{ char *nm; int wild=0; + for (nm=fn; *nm && !wild; nm++) + if (*nm == '*' || *nm == '?') wild=1; + if (wild) + while ((nm=Fname_find (fn, FA_FILE)) != (char *) 0) + XXXX (nm); + else XXXX (fn); +} + +/* ------------------------------------------------------------------------ */ +XXXX (fn) +char *fn; +{ FILE *fi; + int lng; + long hash; + + if (access (fn, 0) != 0) + { fprintf (stderr, "File %s not found!\n", fn); + return -1; + } + fi = fopen (fn, "rt"); + for (;;) + { + fscanf (fi, "%[^\n]", line); + if (feof (fi)) break; fgetc (fi); + lng = strlen (line); +#define X2 +#ifdef X1 + printf ("\n-------------------\n%s\n", line); + string_hash_1 (line, lng, &hash); + printf ("Var 1: %3d %8lX\n", lng, hash); + string_hash_2 (line, lng, &hash); + printf ("Var 2: %8lX %4.4s\n", hash, hash); + string_hash_3 (line, lng, &hash); + printf ("Var 3: %8lX\n", hash); + string_hash_4 (line, lng, &hash); + printf ("Var 4: %8lX\n", hash); + string_hash_5 (line, lng, &hash); + printf ("Var 5: %8lX\n", hash); + string_hash_6 (line, lng, &hash); + printf ("Var 6: %8lX\n", hash); +#endif +#ifdef X2 + string_hash_1 (line, lng, &hash); + printf ("%3d %8lX ", lng, hash); + string_hash_2 (line, lng, &hash); + printf ("%08lX ", hash, hash); + string_hash_3 (line, lng, &hash); + printf ("%8lX ", hash); + string_hash_4 (line, lng, &hash); + printf ("%8lX ", hash); + string_hash_5 (line, lng, &hash); + printf ("%8lX ", hash); + string_hash_6 (line, lng, &hash); + printf ("%8lX %s\n", hash, line); +#endif + } + fclose (fi); +} + +/* ------------------------------------------------------------------------ */ +int string_hash_1 (str, lng, hash) +char *str; +int lng; +long *hash; +{ int i; + long h=0L; + for (i=0; i<lng; i++) + h += (long) str [i]; + *hash=h; +} + +/* ------------------------------------------------------------------------ */ +int string_hash_2 (str, lng, hash) +char *str; +int lng; +char *hash; +{ int i; + for (i=0;i<4;i++) hash [i]=0; + for (i=0; i<lng; i++) + hash [i%4] += str [i]; +} + +/* ------------------------------------------------------------------------ */ +int string_hash_3 (str, lng, hash) +char *str; +int lng; +long *hash; +{ int i; + long h=0L; + for (i=0; i<lng; i++) + h += ((long) str [i]) * ((long) i+1); + *hash=h; +} + +/* ------------------------------------------------------------------------ */ +int string_hash_4 (str, lng, hash) +char *str; +int lng; +long *hash; +{ int i; + long h=0L, l=1L; + for (i=0; i<lng; i++) + h += l * (l= (long) str [i]); + *hash=h; +} + +/* ------------------------------------------------------------------------ */ +int string_hash_5 (str, lng, hash) +char *str; +int lng; +long *hash; +{ int i; + long h=0L, l=1L; + for (i=0; i<lng; i++) + h += l * (l= (long) str [i]) * ((long) i+1); + *hash=h; +} + +/* ------------------------------------------------------------------------ */ +int string_hash_6 (str, lng, hash) +char *str; +int lng; +long *hash; +{ int i; + long h=1L; + for (i=0; i<lng; i++) + h *= (long) str [i]; + *hash=h; +} + + + + diff --git a/lib/sbr/misc/unix0001.c b/lib/sbr/misc/unix0001.c new file mode 100644 index 0000000000000000000000000000000000000000..72859fe8a0e5ceb8a65cf2c1cda761cdfab92387 --- /dev/null +++ b/lib/sbr/misc/unix0001.c @@ -0,0 +1,15 @@ +/* + * FILE %sbr/unix0001.c + * + * written: 1995-08-20 + * latest update: 1995-08-20 + * + */ + +#include <unistd.h> + +/* ------------------------------------------------------------------------ */ +pid_t getpid () +{ + return 4711; +} diff --git a/lib/sbr/misc/unix0002.c b/lib/sbr/misc/unix0002.c new file mode 100644 index 0000000000000000000000000000000000000000..9bd696f8d85922366ca015e6894b283bd1537a58 --- /dev/null +++ b/lib/sbr/misc/unix0002.c @@ -0,0 +1,15 @@ +/* + * FILE %sbr/unix0002.c + * + * written: 1995-08-20 + * latest update: 1995-08-20 + * + */ + +#include <unistd.h> + +/* ------------------------------------------------------------------------ */ +pid_t getppid () +{ + return 4710; +} diff --git a/lib/sbr/misc/unix0003.c b/lib/sbr/misc/unix0003.c new file mode 100644 index 0000000000000000000000000000000000000000..f2d66489c6d707e69b04f88c2c84944c7702630f --- /dev/null +++ b/lib/sbr/misc/unix0003.c @@ -0,0 +1,27 @@ +/* + * FILE %sbr/unix0003.c + * + * written: 1995-08-20 + * latest update: 1995-08-20 + * + */ + +#include <stdio.h> +#include <syslog.h> + +/* ------------------------------------------------------------------------ */ +int syslog ( +int log_level, +char *s, +long p1, +long p2, +long p3, +long p4, +long p5, +long p6, +long p7, +long p8, +long p9) +{ + return fprintf (stderr, s, p1, p2, p3, p4, p5, p6, p7, p8, p9); +} diff --git a/lib/sbr/misc/vm.tmp b/lib/sbr/misc/vm.tmp new file mode 100644 index 0000000000000000000000000000000000000000..9c88f9a275b3a0654b1c3bc9a8006159a0e45735 Binary files /dev/null and b/lib/sbr/misc/vm.tmp differ diff --git a/lib/sbr/misc/vshift01.c b/lib/sbr/misc/vshift01.c new file mode 100644 index 0000000000000000000000000000000000000000..232f6f73f1fd469648e4cc3a3b80776542024907 --- /dev/null +++ b/lib/sbr/misc/vshift01.c @@ -0,0 +1,102 @@ +/* + * FILE %sbr/vshift01.c + * + * written: 1994-03-06 + * latest update: 1997-05-30 13:05:23 + * + */ + +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <gg/filename.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +#define FNM_SIZE 256 +static char fnm_old [FNM_SIZE]; +static char fnm_new [FNM_SIZE]; + +/* ------------------------------------------------------------------------ */ +#define TBL_SIZE 32 +static long shift_tbl [TBL_SIZE] = +{ + 0x00000001, + 0x00000002, + 0x00000004, + 0x00000008, + + 0x00000010, + 0x00000020, + 0x00000040, + 0x00000080, + + 0x00000100, + 0x00000200, + 0x00000400, + 0x00000800, + + 0x00001000, + 0x00002000, + 0x00004000, + 0x00008000, + + 0x00010000, + 0x00020000, + 0x00040000, + 0x00080000, + + 0x00100000, + 0x00200000, + 0x00400000, + 0x00800000, + + 0x01000000, + 0x02000000, + 0x04000000, + 0x08000000, + + 0x10000000, + 0x20000000, + 0x40000000, + 0x80000000 +} ; + +/* ------------------------------------------------------------------------ */ +int vshift (char *fnm, long version, char *fmt, int doit, int verbose) +{ + int i; + int ops= 0; + + if (verbose) + printf ("vshift: %s version=%ld\n", fnm, version); + + for (i= 0; i < TBL_SIZE; i++) + { + if (version & shift_tbl [i]) + { + for (; i>= 0; i--) + { + if (i == 0) + strcpy (fnm_old, fnm); + else sprintf (fnm_old, fmt, fnm, shift_tbl [i-1]); + sprintf (fnm_new, fmt, fnm, shift_tbl [i]); + + if (verbose) printf ("unlinking %s\n", fnm_new); + if (doit) unlink (fnm_new); + + if (verbose) printf ("renaming %s to %s\n", fnm_old, fnm_new); + if (doit) rename (fnm_old, fnm_new); + + ops++; + } + + return ops; + } + } + + return ops; +} diff --git a/lib/sbr/misc/vshift01.o b/lib/sbr/misc/vshift01.o new file mode 100644 index 0000000000000000000000000000000000000000..7003cd322f1c6fbfd6c2f4c8b74fc7fcf5e8efd6 Binary files /dev/null and b/lib/sbr/misc/vshift01.o differ diff --git a/lib/sbr/misc/wcrd_001.c b/lib/sbr/misc/wcrd_001.c new file mode 100644 index 0000000000000000000000000000000000000000..568feaf2791076051173a3752d2b5ab301d3e37d --- /dev/null +++ b/lib/sbr/misc/wcrd_001.c @@ -0,0 +1,19 @@ +/* + * FILE %sbr/wcrd_001.c + * + * redesigned wildcard matching + * + * written: 1996-08-10 redesigned wildcard.c + * latest update: 1996-08-10 12:43:48 + * + */ + +#include <gg/wildcard.h> + +/* ------------------------------------------------------------------------ */ +int wcrd2_set_match_mode (struct WCRD *wcrd, int mode) +{ + wcrd->match_mode= mode; + + return 0; +} diff --git a/lib/sbr/misc/wcrd_001.o b/lib/sbr/misc/wcrd_001.o new file mode 100644 index 0000000000000000000000000000000000000000..a0fa01fca4df47f0b5cc0cde4f6e0e60ae41403f Binary files /dev/null and b/lib/sbr/misc/wcrd_001.o differ diff --git a/lib/sbr/misc/wcrd_002.c b/lib/sbr/misc/wcrd_002.c new file mode 100644 index 0000000000000000000000000000000000000000..890698304c67b7f5f51851287577e85db4ae135e --- /dev/null +++ b/lib/sbr/misc/wcrd_002.c @@ -0,0 +1,19 @@ +/* + * FILE %sbr/wcrd_002.c + * + * redesigned wildcard matching + * + * written: 1996-08-10 redesigned wildcard.c + * latest update: 1998-02-21 9:07:23 + * + */ + +#include <gg/wildcard.h> + +/* ------------------------------------------------------------------------ */ +int wcrd2_set_subdirs (struct WCRD *wcrd, int mode) +{ + wcrd->subdirs= mode; + + return 0; +} diff --git a/lib/sbr/misc/wcrd_002.o b/lib/sbr/misc/wcrd_002.o new file mode 100644 index 0000000000000000000000000000000000000000..22babc9bd0518f7f06855384c15592737fc6e86a Binary files /dev/null and b/lib/sbr/misc/wcrd_002.o differ diff --git a/lib/sbr/misc/wcrd_003.c b/lib/sbr/misc/wcrd_003.c new file mode 100644 index 0000000000000000000000000000000000000000..cf8db1bce101093ae87489731fd6d78eb086870c --- /dev/null +++ b/lib/sbr/misc/wcrd_003.c @@ -0,0 +1,21 @@ +/* + * FILE %sbr/wcrd_003.c + * + * redesigned wildcard matching + * + * written: 1996-08-10 redesigned wildcard.c + * latest update: 1996-09-22 23:48:43 + * + */ + +#include <gg/wildcard.h> + +/* ------------------------------------------------------------------------ */ +int wcrd2_leave (struct WCRD *wcrd, int levels) +{ + if (wcrd == (struct WCRD *) 0) return -1; + + wcrd->leave= (levels < 0) ? 999 : levels; + + return levels; +} diff --git a/lib/sbr/misc/wcrd_003.o b/lib/sbr/misc/wcrd_003.o new file mode 100644 index 0000000000000000000000000000000000000000..e6705fa6b71d8ede053a22c923a12de6fc3b6208 Binary files /dev/null and b/lib/sbr/misc/wcrd_003.o differ diff --git a/lib/sbr/misc/wcrd_004.c b/lib/sbr/misc/wcrd_004.c new file mode 100644 index 0000000000000000000000000000000000000000..66adffc1270649d1b14f7f47275f777b5c767fe3 --- /dev/null +++ b/lib/sbr/misc/wcrd_004.c @@ -0,0 +1,22 @@ +/* + * FILE %sbr/wcrd_004.c + * + * redesigned wildcard matching + * + * written: 1996-08-10 redesigned wildcard.c + * latest update: 1996-08-10 12:43:48 + * + */ + +#include <stdlib.h> +#include <gg/wildcard.h> + +/* ------------------------------------------------------------------------ */ +struct WCRD *wcrd2_initialize () +{ + struct WCRD *wcrd; + + wcrd= (struct WCRD *) calloc (sizeof (struct WCRD), 1); + + return wcrd; +} diff --git a/lib/sbr/misc/wcrd_004.o b/lib/sbr/misc/wcrd_004.o new file mode 100644 index 0000000000000000000000000000000000000000..422eae1d0b4bea14a8138f807595406074c2f56d Binary files /dev/null and b/lib/sbr/misc/wcrd_004.o differ diff --git a/lib/sbr/misc/wcrd_005.c b/lib/sbr/misc/wcrd_005.c new file mode 100644 index 0000000000000000000000000000000000000000..ffbd7477b5e64de792817ed89e17d776ab9bbb15 --- /dev/null +++ b/lib/sbr/misc/wcrd_005.c @@ -0,0 +1,22 @@ +/* + * FILE %sbr/wcrd_005.c + * + * redesigned wildcard matching + * + * written: 1996-08-10 redesigned wildcard.c + * latest update: 1996-08-10 12:43:48 + * + */ + +#include <stdlib.h> +#include <gg/wildcard.h> + +/* ------------------------------------------------------------------------ */ +int wcrd2_dispose (struct WCRD *wcrd) +{ + if (wcrd == (struct WCRD *) 0) return -1; + + free (wcrd); + + return 0; +} diff --git a/lib/sbr/misc/wcrd_005.o b/lib/sbr/misc/wcrd_005.o new file mode 100644 index 0000000000000000000000000000000000000000..4172b515be6ee4d6f2abf6bc3985ba7fd3a00d65 Binary files /dev/null and b/lib/sbr/misc/wcrd_005.o differ diff --git a/lib/sbr/misc/wcrd_006.c b/lib/sbr/misc/wcrd_006.c new file mode 100644 index 0000000000000000000000000000000000000000..ecfeacab0c97a6e9ef8f07d5b348a684ad6132a9 --- /dev/null +++ b/lib/sbr/misc/wcrd_006.c @@ -0,0 +1,44 @@ +/* + * FILE %sbr/wcrd_006.c + * + * redesigned wildcard matching + * + * written: 1996-08-10 redesigned wildcard.c + * latest update: 1997-08-04 12:40:10 + * + */ + +#include <stdlib.h> +#include <gg/wildcard.h> + +/* ------------------------------------------------------------------------ */ +int wcrd2_set_processor ( +struct WCRD *wcrd, +int what, +WCRD_processor *prc, +void *client_data) +{ + if (wcrd == (struct WCRD *) 0) return -1; + + switch (what) + { + case WCRD_set_file_processor: + wcrd->file_processor= prc; + wcrd->file_client_data= client_data; + break; + + case WCRD_set_dir_pre_processor: + wcrd->dir_pre_processor= prc; + wcrd->dir_pre_client_data= client_data; + break; + + case WCRD_set_dir_post_processor: + wcrd->dir_post_processor= prc; + wcrd->dir_post_client_data= client_data; + break; + + return -1; + } + + return 0; +} diff --git a/lib/sbr/misc/wcrd_006.o b/lib/sbr/misc/wcrd_006.o new file mode 100644 index 0000000000000000000000000000000000000000..13374be854608d1f35de13ce10dcc11a60acb65b Binary files /dev/null and b/lib/sbr/misc/wcrd_006.o differ diff --git a/lib/sbr/misc/wcrd_007.c b/lib/sbr/misc/wcrd_007.c new file mode 100644 index 0000000000000000000000000000000000000000..b616d72016f74abd39559d4e1824636a4527d082 --- /dev/null +++ b/lib/sbr/misc/wcrd_007.c @@ -0,0 +1,68 @@ +/* + * FILE %sbr/wcrd_007.c + * + * redesigned wildcard matching + * + * written: 1996-08-10 redesigned wildcard.c + * latest update: 1998-02-21 9:01:53 + * + */ + +#ifdef __wcrd_debug__ +#include <stdio.h> +#endif +#include <string.h> +#include <gg/strings.h> +#include <gg/filename.h> +#include <gg/wildcard.h> + +/* ------------------------------------------------------------------------ */ +int wcrd2_wildcards (struct WCRD *wcrd, char *fn) +{ + int wild= 0; + int rc= 0; + + wild= wcrd_wild_check (fn); + +#ifdef __wcrd_debug__ + printf ("wildcards: fn='%s' wild=%d\n", fn, wild); +#endif + + if (wild) + { + int separator; + +#ifdef MSDOS + to_upper (fn); +#endif /* MSDOS */ + + separator= isolate_path (fn); +#ifdef __wcrd_debug__ + printf (" separator=%d pattern='%s'\n", separator, fn+separator+1); +#endif + + if (separator > 0) + { + strncpy (wcrd->actual_path, fn, separator); + wcrd->actual_path [separator]= 0; + } + else + { + wcrd->actual_path [0]= 0; + } + + strcpy (wcrd->actual_pattern, fn+separator+1); + wcrd->actual_index= separator; + + wcrd2_wildcards_search (wcrd); + } + else + { + WCRD_processor *prc; + + if ((prc= wcrd->file_processor) != (WCRD_processor *) 0) + rc= (*prc) (fn, wcrd->file_client_data); + } + + return rc; +} diff --git a/lib/sbr/misc/wcrd_007.o b/lib/sbr/misc/wcrd_007.o new file mode 100644 index 0000000000000000000000000000000000000000..f79a772f9fb5dc0b6bee05413333a1d9d65e2db6 Binary files /dev/null and b/lib/sbr/misc/wcrd_007.o differ diff --git a/lib/sbr/misc/wcrd_008.c b/lib/sbr/misc/wcrd_008.c new file mode 100644 index 0000000000000000000000000000000000000000..ba721334c06bc11f40dde88cea8ad7bb7ba4168e --- /dev/null +++ b/lib/sbr/misc/wcrd_008.c @@ -0,0 +1,234 @@ +/* + * FILE %sbr/wcrd_008.c + * + * redesigned wildcard matching + * + * written: 1996-08-10 redesigned wildcard.c + * latest update: 1998-07-19 11:25:09 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> + +#ifdef MSDOS +#include <gg/fnames.h> +#else +#include <sys/types.h> +#include <sys/stat.h> +#include <dirent.h> +#endif /* !MSDOS */ + +#include <gg/array.h> +#include <gg/filename.h> +#include <gg/wildcard.h> + +/* ------------------------------------------------------------------------ */ +int wcrd2_wildcards_search (struct WCRD *wcrd) +{ + char *nm; /* filename currently processed */ + int matches; /* 1 -> file matches with pattern */ + int subdirs; /* 1 -> process subdirectories */ + int files= 0; /* 1 -> process files */ + char *fnm; + char *path; /* currently used path */ + char *pattern; /* currently used filename pattern */ + int actual_index; /* positition where filenames are appended */ + struct ARRAY_CONTROL *ac_files; + struct ARRAY_CONTROL *ac_dirs; + WCRD_processor *prc_file; + void *cd_file= (void *) 0; + int rc= 0; + int is_dir; /* 1 -> entry refers to directory */ +#ifdef MSDOS + struct dta_buff l_dta; /* result of directory lookup */ + int look; /* success indicator for directory lookup */ +#else + DIR *dh; + struct dirent *de; + struct stat st; +#endif /* !MSDOS */ + + path= wcrd->actual_path; /* Fixed buffer: WCRD_buffer_size */ + fnm= wcrd->actual_filenm; + pattern= wcrd->actual_pattern; + actual_index= wcrd->actual_index; + subdirs= wcrd->subdirs; + strcpy (fnm, path); + + if (actual_index > 0) + { +#ifdef MSDOS + fnm [actual_index]= '\\'; +#else + fnm [actual_index]= '/'; +#endif /* !MSDOS */ + fnm [actual_index+1]= 0; + } + + if ((prc_file= wcrd->file_processor) != (WCRD_processor *) 0) + { + files= 1; + cd_file= wcrd->file_client_data; + } + + ac_files= array_new (); + ac_dirs= array_new (); + +#ifdef MSDOS + if (actual_index > 0) + strcpy (path + actual_index, "\\*.*"); + else strcpy (path, "*.*"); +#endif /* MSDOS */ + +#ifdef __wcrd_debug__ + printf ("search: actual_index=%d path='%s'\n", actual_index, path); +#endif + +#ifdef MSDOS + Fsetdta (&l_dta); + for (look= Fsfirst (path, FA_ALL); + !look; + look= Fsnext ()) +#else + for (dh= opendir ((*path == 0) ? "." : path); + dh != (DIR *) 0 && (de= readdir (dh)) != (struct dirent *) 0; + ) +#endif /* !MSDOS */ + { +#ifdef MSDOS + nm= l_dta.name; + is_dir= (l_dta.att & FA_DIRECTORY); +#else + nm= de->d_name; + + /* T2D: check for buffer overflow */ + strcpy (fnm + ((actual_index > 0) ? actual_index+1 : 0), nm); + + rc= lstat (fnm, &st); /* check for symlinks too */ + if (rc != 0) continue; /* something fishy about that ... */ + if (!(is_dir= S_ISDIR (st.st_mode))) + if (!S_ISREG (st.st_mode)) continue; +#endif /* !MSDOS */ + + if (is_dir) + { + if (subdirs + && strcmp (nm, ".") != 0 + && strcmp (nm, "..") != 0 + ) array_push (ac_dirs, (void *) strdup (nm)); + } + else + { + if (files) + { + matches= match (pattern, nm); + + if (matches) array_push (ac_files, (void *) strdup (nm)); + } + } + } + +#ifdef MSDOS + /* printf ("look=%d\n", look); */ +#else + if (dh != (DIR *) 0) closedir (dh); +#endif /* !MSDOS */ + + while ((nm= (char *) array_shift (ac_files)) != (char *) 0) + { + /* T2D: check for buffer overflow */ + strcpy (fnm + ((actual_index > 0) ? actual_index+1 : 0), nm); + free (nm); + +#ifdef MSDOS + xchange (fnm, '\\', '/'); + to_lower (fnm); +#endif /* MSDOS */ + + rc= (*prc_file) (fnm, cd_file); + if (wcrd->leave > 0) goto LEAVE; + } + +#ifdef __wcrd_debug__ +printf (" processing %ld dirs\n", array_elements (ac_dirs)); +#endif + + if (subdirs) + { + WCRD_processor *prc_pre; + void *cd_pre= (void *) 0; + WCRD_processor *prc_post; + void *cd_post= (void *) 0; + + if ((prc_pre= wcrd->dir_pre_processor) != (WCRD_processor *) 0) + cd_pre= wcrd->dir_pre_client_data; + if ((prc_post= wcrd->dir_post_processor) != (WCRD_processor *) 0) + cd_post= wcrd->dir_post_client_data; + + while ((nm= (char *) array_shift (ac_dirs)) != (char *) 0) + { +#ifdef __wcrd_debug__ + printf (" process dir '%s'\n", nm); +#endif + + if (actual_index > 0) + { +#ifdef MSDOS + path [actual_index]= '\\'; +#else + path [actual_index]= '/'; +#endif /* !MSDOS */ + strcpy (path + actual_index+1, nm); + wcrd->actual_index= actual_index + strlen (nm) + 1; + } + else + { + strcpy (path, nm); + wcrd->actual_index= strlen (nm); + } + free (nm); + + if (prc_pre != (WCRD_processor *) 0) + { + strcpy (fnm, path); +#ifdef MSDOS + /* under MSDOS we see the pattern as part of the path!!! */ + /* strip that off now, we are not interested in that here! */ + if (actual_index > 0) fnm [actual_index]= 0; + xchange (fnm, '\\', '/'); + to_lower (fnm); +#endif /* MSDOS */ + (*prc_pre) (fnm, cd_pre); + } + + wcrd2_wildcards_search (wcrd); + + if (wcrd->leave > 0) goto LEAVE; + + if (prc_post != (WCRD_processor *) 0) + { + strcpy (fnm, path); +#ifdef MSDOS + /* under MSDOS we see the pattern as part of the path!!! */ + /* strip that off now, we are not interested in that here! */ + if (actual_index > 0) fnm [actual_index]= 0; + xchange (fnm, '\\', '/'); + to_lower (fnm); +#endif /* MSDOS */ + (*prc_post) (fnm, cd_post); + } + } + } + +LEAVE: + ac_files->element_destructor= + ac_dirs->element_destructor= free; + + array_dispose (ac_files); + array_dispose (ac_dirs); + + return rc; +} diff --git a/lib/sbr/misc/wcrd_008.o b/lib/sbr/misc/wcrd_008.o new file mode 100644 index 0000000000000000000000000000000000000000..89ce9b5b0adede284970dd0d9640d72f371db04f Binary files /dev/null and b/lib/sbr/misc/wcrd_008.o differ diff --git a/lib/sbr/misc/wcrd_009.c b/lib/sbr/misc/wcrd_009.c new file mode 100644 index 0000000000000000000000000000000000000000..f209bdf825cc4cb94f4f0ababccbb7458bdd8c99 --- /dev/null +++ b/lib/sbr/misc/wcrd_009.c @@ -0,0 +1,81 @@ +/* + * FILE %sbr/wcrd_009.c + * + * redesigned wildcard matching + * + * written: 1997-03-23 + * latest update: 1998-02-28 9:33:41 + * + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <gg/sbr.h> +#include <gg/strings.h> +#include <gg/array.h> +#include <gg/filename.h> +#include <gg/wildcard.h> + +/* ------------------------------------------------------------------------ */ +int wcrd2_arguments (struct WCRD *wcrd, struct ARRAY_CONTROL *arguments) +{ + char *filenm= (char *) 0; + int rc= 0; + char *arg; + FILE *fi2; + + if (wcrd == (struct WCRD *) 0 + || arguments == (struct ARRAY_CONTROL *) 0 + ) + return -1; + + if (array_elements (arguments) == 0) return 0; + + while ((arg= (char *) array_shift (arguments)) != (char *) 0) + { + if (arg [0] == '-') + { + if ((fi2= fopen (arg+2, "rt")) == (FILE *) 0) + { + fprintf (stderr, "File %s could not be read!\n", arg+2); + rc= -1; + break; + } + + if (filenm == (char *) 0 + && (filenm= malloc (MAX_FNM_LENGTH)) == (char *) 0 + ) + { + rc= -1; + break; + } + + for (;;) + { + rc= fread_line (fi2, filenm, MAX_FNM_LENGTH); + if (rc <= 0 && feof (fi2)) break; + if (wcrd2_wildcards (wcrd, filenm) == -1) + { + fclose (fi2); + rc= -1; + goto STOP; + } + } + fclose (fi2); + } + else + { + if (wcrd2_wildcards (wcrd, arg) == -1) + { + rc= -1; + goto STOP; + } + } + } + +STOP: + free_or_what (filenm); + + return rc; +} diff --git a/lib/sbr/misc/wcrd_009.o b/lib/sbr/misc/wcrd_009.o new file mode 100644 index 0000000000000000000000000000000000000000..5120ace3c5193143742980c41f98fbb541383b7d Binary files /dev/null and b/lib/sbr/misc/wcrd_009.o differ diff --git a/lib/sbr/misc/wcrd_d01.c b/lib/sbr/misc/wcrd_d01.c new file mode 100644 index 0000000000000000000000000000000000000000..b6f943cc3593b464638bf0210215e2b171847701 --- /dev/null +++ b/lib/sbr/misc/wcrd_d01.c @@ -0,0 +1,95 @@ +/* + * FILE %sbr/wcrd_d01.c + * + * redesigned wildcard matching + * MSDOS version + * + * written: 1996-08-10 redesigned wildcard.c + * latest update: 1996-08-11 10:43:26 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/fnames.h> +#include <gg/wildcard.h> + +/* ------------------------------------------------------------------------ */ +int wcrd2_rec_wildcards (struct WCRD *wcrd, int lev) +{ + struct dta_buff l_dta; + int actual_path_length; + int look; + int rc= 0; + char *actual_filenm; + char *actual_path; + char *actual_pattern; + + actual_filenm= wcrd->actual_filenm; + actual_path= wcrd->actual_path; + actual_pattern= wcrd->actual_pattern; + + wcrd->current_level= lev; + /* Fsetdta (&l_dta); */ + +#ifdef __wcrd_debug__ +printf ("rec_wildcard: lev=%D actual_path=%s\n", lev, actual_path); +#endif + + actual_path_length= strlen (actual_path); + if (actual_path_length) + sprintf (actual_filenm, "%s\\%s", actual_path, actual_pattern); + else sprintf (actual_filenm, "%s", actual_pattern); + +#ifdef __wcrd_debug__ +printf (" actual_filenm=%s\n", actual_filenm); +#endif + + rc= wcrd2_wildcards (wcrd, actual_filenm); + if (wcrd->leave > 0) + { + wcrd->leave--; + return rc; + } + + if (actual_path_length) + sprintf (actual_filenm, "%s\\*.*", actual_path); + else strcpy (actual_filenm, "*.*"); + + Fsetdta (&l_dta); + for (look= Fsfirst (actual_filenm, FA_DIRECTORY); /* search DIRS */ + !look; + look= Fsnext ()) + { + if ((l_dta.att & 0x10) == 0 || + strcmp (l_dta.name, ".") == 0 || + strcmp (l_dta.name, "..") == 0) + continue; + + if (actual_path_length) + sprintf (actual_path + actual_path_length, "\\%s", l_dta.name); + else sprintf (actual_path + actual_path_length, "%s", l_dta.name); + +#ifdef __wcrd_debug__ + printf ("rec_wildcards: pre actual_path='%s'\n", actual_path); +#endif + + rc= wcrd2_rec_wildcards (wcrd, lev+1); + +#ifdef __wcrd_debug__ + printf ("rec_wildcards: post actual_path='%s'\n", actual_path); +#endif + + if (wcrd->leave > 0) + { + wcrd->leave--; + return rc; + } + + Fsetdta (&l_dta); + } + + return rc; +} diff --git a/lib/sbr/misc/wcrd_d02.c b/lib/sbr/misc/wcrd_d02.c new file mode 100644 index 0000000000000000000000000000000000000000..ef43d603662f9b86eabc27cf63510714f594e438 --- /dev/null +++ b/lib/sbr/misc/wcrd_d02.c @@ -0,0 +1,138 @@ +/* + * FILE %sbr/wcrd_d02.c + * + * redesigned wildcard matching + * MSDOS version + * + * written: 1996-08-10 redesigned wildcard.c + * latest update: 1996-08-11 10:43:53 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/fnames.h> +#include <gg/filename.h> +#include <gg/wildcard.h> + +/* ------------------------------------------------------------------------ */ +int wcrd2_wildcards_or_rec (struct WCRD *wcrd, char *fn) +{ + int i; + int drive_letter; + int path_length; + int rc= 0; + char *actual_path; + char *actual_pattern; + + actual_path= wcrd->actual_path; + actual_pattern= wcrd->actual_pattern; + + wcrd->leave= 0; + +#ifdef __wcrd_debug__ + printf ("wildcards_or_rec: fn='%s'\n", fn); +#endif + + if (wcrd->subdirs) + { + for (i= strlen (fn) -1; i >= 0; i--) + if (fn [i] == '\\' || fn [i] == ':') break; + strcpy (wcrd->actual_path, fn); +#ifdef __wcrd_debug__ + printf (" actual_path= '%s'\n", actual_path); +#endif + + if (i >= 0) + if (actual_path [i] == ':') + actual_path [i+1]= 0; + else actual_path [i ]= 0; + else actual_path [ 0]= 0; + +#ifdef __wcrd_debug__ + printf (" actual_path= '%s'\n", actual_path); +#endif + + strcpy (actual_pattern, &fn [i+1]); + if (actual_pattern [0] == 0) + strcpy (actual_pattern, "*.*"); + path_length= strlen (actual_path); + +#ifdef __wcrd_debug__ + printf (" actual_path= '%s'\n", actual_path); +#endif + + if (actual_path [1] == ':' && actual_path [0] == '*') + { + i= get_current_disk (); /* aktuelles Drive ermitteln */ + drive_letter= select_disk (i); + drive_letter += 'A'; + i &= 0x00FF; + + for (i= (i >= 2) ? 'C' : i+'A' ; + i < drive_letter; + i++) + { + actual_path [0]= (char) i; + rc= wcrd2_rec_wildcards (wcrd, 1); + if (wcrd->leave > 0) + { + wcrd->leave--; + return rc; + } + actual_path [path_length]= 0; + } + } + else + { +#ifdef __wcrd_debug__ + printf (" rec; actual_path= '%s'\n", actual_path); +#endif + + rc= wcrd2_rec_wildcards (wcrd, 1); + if (wcrd->leave > 0) + { + wcrd->leave--; + return rc; + } + } + } + else + { + path_length= strlen (fn); + if (fn [1] == ':' && fn [0] == '*') + { + i= get_current_disk (); /* aktuelles Drive ermitteln */ + drive_letter= select_disk (i); + drive_letter += 'A'; + i &= 0x00FF; + + for (i= (i >= 2) ? 'C' : i+'A' ; + i < drive_letter; + i++) + { + fn [0]= (char) i; + rc= wcrd2_wildcards (wcrd, fn); + if (wcrd->leave > 0) + { + wcrd->leave--; + return rc; + } + fn [path_length]= 0; + } + } + else + { + rc= wcrd2_wildcards (wcrd, fn); + if (wcrd->leave > 0) + { + wcrd->leave--; + return rc; + } + } + } + + return rc; +} diff --git a/lib/sbr/misc/wildcard.c b/lib/sbr/misc/wildcard.c new file mode 100644 index 0000000000000000000000000000000000000000..0f3048b5dd48240418b33fe01b0455ac5a478f5f --- /dev/null +++ b/lib/sbr/misc/wildcard.c @@ -0,0 +1,253 @@ +/* + * FILE %sbr/wildcard.c + * + * MSDOS: wildcard matching ev. with recursion through subdirs + * + * 1992 02 21: extracted from /usr/inc/temp.c + * latest update: 1998-07-19 11:17:17 + * + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <gg/strings.h> +#include <gg/fnames.h> +#include <gg/filename.h> + +/* Where to search: recursion through directory tree: --------------------- */ +static char actual_filenm [128]; /* T2D: UNIX -> BUFFER OVERFLOW */ +static char actual_drive [ 2]; +static char actual_path [128]; +static char actual_pattern [ 30]; + +static int leave= 0; /* number of recursion levels */ + /* to leave */ +static int subdirs= 0; /* 1 -> follow subdirectories */ +static int match_mode= 0; /* 0 -> use MSDOS's matching mode */ + /* 1 -> use or own matchin mode */ +static int current_level; + +/* ------------------------------------------------------------------------ */ +static int cdecl rec_wildcards (int lev); + +/* ------------------------------------------------------------------------ */ +static int rec_wildcards (int lev) +{ + struct dta_buff l_dta; + int actual_path_length; + int look; + int rc= 0; + + current_level= lev; + Fsetdta (&l_dta); + +/* fprintf (stderr, "%2d RC1: actual_path=%s\n", lev, actual_path); */ + actual_path_length = strlen (actual_path); + if (actual_path_length) + sprintf (actual_filenm, "%s\\%s", actual_path, actual_pattern); + else sprintf (actual_filenm, "%s", actual_pattern); + + rc= wcrd_wildcards (actual_filenm); + if (leave > 0) + { + leave--; + return rc; + } + + if (actual_path_length) + sprintf (actual_filenm, "%s\\*.*", actual_path); + else strcpy (actual_filenm, "*.*"); + + Fsetdta (&l_dta); + for (look= Fsfirst (actual_filenm, 0x10); + !look; + look= Fsnext ()) + { + if ((l_dta.att & 0x10) == 0 || + strcmp (l_dta.name, ".") == 0 || + strcmp (l_dta.name, "..") == 0) + continue; + if (actual_path_length) + sprintf (& actual_path [actual_path_length], "\\%s", l_dta.name); + else sprintf (& actual_path [actual_path_length], "%s", l_dta.name); + rc= rec_wildcards (lev+1); + if (leave > 0) + { + leave--; + return rc; + } + Fsetdta (&l_dta); + } + + return rc; +} + +/* ------------------------------------------------------------------------ */ +int wcrd_wildcards_or_rec (char *fn) +{ + int i; + int drive_letter; + int path_length; + int rc= 0; + + leave= 0; + + if (subdirs) + { + for (i= strlen (fn) -1; i >= 0; i--) + if (fn [i] == '\\' || fn [i] == ':') break; + strcpy (actual_path, fn); + + if (i>=0) + if (actual_path [i] == ':') + actual_path [i+1]= 0; + else actual_path [i ]= 0; + else actual_path [ 0]= 0; + + strcpy (actual_pattern, &fn [i+1]); + if (actual_pattern [0] == 0) + strcpy (actual_pattern, "*.*"); + path_length= strlen (actual_path); + + if (actual_path [1] == ':' && actual_path [0] == '*') + { + i= get_current_disk (); /* aktuelles Drive ermitteln */ + drive_letter= select_disk (i); + drive_letter += 'A'; + i &= 0x00FF; + + for (i= (i >= 2) ? 'C' : i+'A' ; + i < drive_letter; + i++) + { + actual_path [0]= (char) i; + rc= rec_wildcards (1); + if (leave > 0) + { + leave--; + return rc; + } + actual_path [path_length]= 0; + } + } + else + { + rc= rec_wildcards (1); + if (leave > 0) + { + leave--; + return rc; + } + } + } + else + { + path_length= strlen (fn); + if (fn [1] == ':' && fn [0] == '*') + { + i= get_current_disk (); /* aktuelles Drive ermitteln */ + drive_letter= select_disk (i); + drive_letter += 'A'; + i &= 0x00FF; + + for (i= (i >= 2) ? 'C' : i+'A' ; + i < drive_letter; + i++) + { + fn [0]= (char) i; + rc= wcrd_wildcards (fn); + if (leave > 0) + { + leave--; + return rc; + } + fn [path_length]= 0; + } + } + else + { + rc= wcrd_wildcards (fn); + if (leave > 0) + { + leave--; + return rc; + } + } + } + + return rc; +} + +/* ------------------------------------------------------------------------ */ +int wcrd_wildcards (char *fn) +{ + char *nm; + int wild= 0; + int rc= 0; + + wild= wcrd_wild_check (fn); + + if (wild) + { + if (match_mode) + { + to_upper (fn); + while ((nm= Fname_find ("*.*", FA_FILE)) != (char *) 0) + if (match (fn, nm) > 0) + { + if ((rc= main_fnc (nm)) < 0 || leave > 0) break; + } + } + else + { + while ((nm= Fname_find (fn, FA_FILE)) != (char *) 0) + if ((rc= main_fnc (nm)) < 0 || leave > 0) break; + } + } + else rc= main_fnc (fn); + + return rc; +} + +/* ------------------------------------------------------------------------ */ +int wcrd_set_match_mode (int mode) +{ + match_mode= mode; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int wcrd_get_match_mode () +{ + return match_mode; +} + +/* ------------------------------------------------------------------------ */ +int wcrd_set_subdirs (int mode) +{ + subdirs= mode; + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int wcrd_get_subdirs () +{ + return subdirs; +} + +/* ------------------------------------------------------------------------ */ +int wcrd_get_current_level () +{ + return current_level; +} + +/* ------------------------------------------------------------------------ */ +int wcrd_leave (int levels) +{ + leave= (levels < 0) ? 999 : levels; + + return levels; +} diff --git a/lib/sbr/misc/wildcrd2.c b/lib/sbr/misc/wildcrd2.c new file mode 100644 index 0000000000000000000000000000000000000000..7613545aa8a69a8f97036f666d5b076fc6b3cb9f --- /dev/null +++ b/lib/sbr/misc/wildcrd2.c @@ -0,0 +1,18 @@ +/* + * FILE %sbr/wildcrd2.c + * + * written: 1995-02-12: extracted from /usr/utl/mv2.c + * latest update: 1996-08-10 13:02:29 + * + */ + +#include <gg/filename.h> + +/* ------------------------------------------------------------------------ */ +int wcrd_wild_check (char *nm) +{ + for (; *nm; nm++) + if (*nm == '*' || *nm == '?') return 1; + + return 0; +} diff --git a/lib/sbr/misc/wildcrd2.o b/lib/sbr/misc/wildcrd2.o new file mode 100644 index 0000000000000000000000000000000000000000..e922b0bae07a93412861965604055fc287957e48 Binary files /dev/null and b/lib/sbr/misc/wildcrd2.o differ diff --git a/lib/sbr/misc/xref01.c b/lib/sbr/misc/xref01.c new file mode 100644 index 0000000000000000000000000000000000000000..b05f0287000a3b77b4add6ef0041bf938fb25eb7 --- /dev/null +++ b/lib/sbr/misc/xref01.c @@ -0,0 +1,141 @@ +/* + * FILE %sbr/xref01.c + * + * Cross Reference Generator + * - collect definitions + * + * written: 1997-08-03 + * latest update: 1997-09-14 17:15:09 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/xref.h> + +/* ------------------------------------------------------------------------ */ +struct XREF_MODULE *xref_module ( +struct XREF_CONTEXT *ctx, +char *name, +int replace) +{ + struct XREF_MODULE *mod; + struct XREF_MODULE *mod2= (struct XREF_MODULE *) 0; + + if (ctx == (struct XREF_CONTEXT *) 0 + || (mod= (struct XREF_MODULE *) calloc (sizeof (struct XREF_MODULE), 1)) + == (struct XREF_MODULE *) 0 + ) return (struct XREF_MODULE *) 0; + + /* populate module declaration with data */ + mod->name= strdup (name); + mod->ctx= ctx; + + if ((mod2= (struct XREF_MODULE *) + ytree_get_value (ctx->modules, (unsigned char *) name)) + != (struct XREF_MODULE *) 0 + ) + { + if (replace) + { + mod->shadows= mod2; + printf ("module %s replaces another instance\n", name); + } + else + { + struct XREF_MODULE **mp; + int cnt= 2; + + /* find end of list of shadowed modules */ + for (mp= &mod2->shadows; + *mp != (struct XREF_MODULE *) 0; + mp= &(*mp)->shadows) cnt++; + + *mp= mod; + + printf ("module %s shadowed as instance %d\n", name, cnt); + return mod; + } + } + + ytree_set_value (&ctx->modules, (UCHAR *) name, (long) mod); + + return mod; +} + +/* ------------------------------------------------------------------------ */ +int xref_set_object ( +struct XREF_MODULE *mod, +char *name) +{ + if (mod == (struct XREF_MODULE *) 0 + || name == (char *) 0 + ) return -1; + + mod->object_name= strdup (name); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +struct XREF_PUBLIC *xref_public ( +struct XREF_MODULE *mod, +char *name) +{ + struct XREF_PUBLIC *pub; + struct XREF_PUBLIC *pub2; + struct XREF_CONTEXT *ctx; + + if (mod == (struct XREF_MODULE *) 0 + || (ctx= mod->ctx) == (struct XREF_CONTEXT *) 0 + || (pub= (struct XREF_PUBLIC *) calloc (sizeof (struct XREF_PUBLIC), 1)) + == (struct XREF_PUBLIC *) 0 + ) return (struct XREF_PUBLIC *) 0; + + if ((pub2= (struct XREF_PUBLIC *) + ytree_get_value (ctx->publics, (UCHAR *) name)) + != (struct XREF_PUBLIC *) 0 + ) + { /* T2D: implement pub2 shadowing pub or vica versa */ + struct XREF_MODULE *mod2; + + mod2= pub2->module; + + printf ("%s already defined in %s (now in %s)\n", + name, mod2->name, mod->name); + } + else + ytree_set_value (&ctx->publics, (UCHAR *) name, (long) pub); + + ytree_set_value (&mod->publics, (UCHAR *) name, (long) pub); + +#ifdef XREF_DEBUG1 + printf ("registering PUBLIC '%s' in '%s'\n", name, mod->name); +#endif /* XREF_DEBUG */ + + pub->module= mod; + pub->name= strdup (name); + + return pub; +} + +/* ------------------------------------------------------------------------ */ +int xref_external ( +struct XREF_MODULE *mod, +char *name) +{ + if (mod == (struct XREF_MODULE *) 0) return -1; + + ytree_set_value (&mod->externals, (UCHAR *) name, (long) 0); + +#ifdef XREF_DEBUG1 + printf ("registering EXTERNAL '%s' in '%s'\n", name, mod->name); +#endif /* XREF_DEBUG */ + + return 0; +} diff --git a/lib/sbr/misc/xref01.o b/lib/sbr/misc/xref01.o new file mode 100644 index 0000000000000000000000000000000000000000..a6bc952fbd5a5515f0a29cfe2a1b1862d2774e21 Binary files /dev/null and b/lib/sbr/misc/xref01.o differ diff --git a/lib/sbr/misc/xref02.c b/lib/sbr/misc/xref02.c new file mode 100644 index 0000000000000000000000000000000000000000..31989c6af52492e61f997239169ba0eb54c1173a --- /dev/null +++ b/lib/sbr/misc/xref02.c @@ -0,0 +1,93 @@ +/* + * FILE %sbr/xref02.c + * + * Cross Reference Generator + * - resolver + * + * written: 1997-08-03 + * latest update: 1997-08-15 21:38:03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/xref.h> + +/* ------------------------------------------------------------------------ */ +struct XREF_RESOLVE *xref_new_resolve (struct XREF_CONTEXT *ctx) +{ + struct XREF_RESOLVE *res; + struct ARRAY_CONTROL *ac; + + if (ctx == (struct XREF_CONTEXT *) 0 + || (res= (struct XREF_RESOLVE *) + calloc (sizeof (struct XREF_RESOLVE), 1)) + == (struct XREF_RESOLVE *) 0 + || (ac= array_new ()) == (struct ARRAY_CONTROL *) 0 + ) + return (struct XREF_RESOLVE *) 0; + + res->ctx= ctx; + res->unresolved= ac; + + return res; +} + +/* ------------------------------------------------------------------------ */ +long xref_resolve ( +struct XREF_RESOLVE *res, +char *name) /* add item to the resolver list */ +/* return: -1 .. error; 0 .. already resolved; > 0 number in resolve queue */ +{ + struct ARRAY_CONTROL *ac; + + if (res == (struct XREF_RESOLVE *) 0 + || (ac= res->unresolved) == (struct ARRAY_CONTROL *) 0 + ) return (long) -1; + + if (ytree_get_value (res->resolved, (UCHAR *) name) != 0 + || ytree_get_value (res->ignore, (UCHAR *) name) != 0 + ) + return (long) 0; + + array_push (ac, (void *) strdup (name)); + + printf (" resolve %s\n", name); + + return array_elements (ac); +} + +/* ------------------------------------------------------------------------ */ +/* YTREE_TRACKER: add externals to resolve list */ +int xref_resolve_symbols (struct YTREE *yt, char *str, void *cd) +{ + if (yt->YT_flags & YTflag_EOW) + xref_resolve ((struct XREF_RESOLVE *) cd, str); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int xref_ignore (struct XREF_RESOLVE *res, char *name, void *cd) +{ + if (res == (struct XREF_RESOLVE *) 0) return -1; + + ytree_set_value (&res->ignore, (UCHAR *) name, (long) cd); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int xref_print_ref_list (long info, char *str, void *cd) +{ + char *msg; + + if ((msg= (char *) cd) == (char *) 0) msg= ""; + + printf ("%s %8ld %s\n", msg, info, str); + return 0; +} diff --git a/lib/sbr/misc/xref02.o b/lib/sbr/misc/xref02.o new file mode 100644 index 0000000000000000000000000000000000000000..2745b2db31cebba77942d9659ec289ec1de82d95 Binary files /dev/null and b/lib/sbr/misc/xref02.o differ diff --git a/lib/sbr/misc/xref03.c b/lib/sbr/misc/xref03.c new file mode 100644 index 0000000000000000000000000000000000000000..d3b25100073e68b2dd5fe9f7f72eaf107b26981a --- /dev/null +++ b/lib/sbr/misc/xref03.c @@ -0,0 +1,130 @@ +/* + * FILE %sbr/xref02.c + * + * Cross Reference Generator + * - resolver + * + * written: 1997-08-03 + * latest update: 1997-08-15 21:38:03 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <gg/filename.h> +#include <gg/xref.h> + +/* ------------------------------------------------------------------------ */ +int xref_do_resolve ( +struct XREF_RESOLVE *res, +int show_resolved, +int show_unresolved) +{ + struct ARRAY_CONTROL *ac; + struct XREF_PUBLIC *pub; + struct XREF_MODULE *mod; /* currently processed module */ + struct XREF_MODULE *modi; /* imported module */ + struct XREF_CONTEXT *ctx; +#define MAX_BUFFER 120 + char buffer [MAX_BUFFER]; + char *name; + + char *mod_name; /* name of module as recorded in obj file */ + char *obj_name; /* name of object file as recorded in lib */ + char *dir_name; /* name of directory for source file */ + + if (res == (struct XREF_RESOLVE *) 0 + || (ctx= res->ctx) == (struct XREF_CONTEXT *) 0 + ) + { + printf ("NULL resolver, nothing to do!\n"); + return -1; + } + + if ((ac= res->unresolved) == (struct ARRAY_CONTROL *) 0) + { + printf ("nothing to resolve!\n"); + return 0; + } + + while ((name= (char *) array_shift (ac)) != (char *) 0) + { + if (ytree_get_value (res->ignore, (UCHAR *) name) != 0L) + { + goto NEXT; /* resolver should ignore this item */ + } + + if (ytree_get_value (res->resolved, (UCHAR *) name) > 0L) + { + ytree_increment_value (&res->resolved, (UCHAR *) name, 1L); + goto NEXT; /* already resolved */ + } + + if ((pub= (struct XREF_PUBLIC *) + ytree_get_value (ctx->publics, (UCHAR *) name)) + == (struct XREF_PUBLIC *) 0 + || (mod= pub->module) == (struct XREF_MODULE *) 0 + ) + { /* symbol could not be found anywhere */ + ytree_increment_value (&res->not_found, (UCHAR *) name, 1L); + goto NEXT; + } + + mod_name= mod->name; + ytree_increment_value (&res->resolved, (UCHAR *) name, 1L); + + if ((modi= (struct XREF_MODULE *) + ytree_get_value (res->imported, (UCHAR *) mod_name)) + != (struct XREF_MODULE *) 0 + ) + { + printf ("%s imported with %s\n", name, mod_name); + goto NEXT; + } + + /* print require statement */ + printf ("%s requires %s\n", name, mod_name); + if ((obj_name= mod->object_name) != (char *) 0) + printf ("object: %s.obj\n", obj_name); + if ((dir_name= get_module_directory (mod_name)) != (char *) 0) + printf ("source: %s/%s\n", dir_name, mod_name); + + ytree_set_value (&res->imported, (UCHAR *) mod_name, (long) mod); + + if (mod->externals != (struct YTREE *) 0) + { + printf ("BEGIN import list for %s\n", mod_name); + + ytree_track (mod->externals, buffer, MAX_BUFFER, 0, + xref_resolve_symbols, (void *) res); + + printf ("END of import list for %s\n", mod_name); + } + +NEXT: + free (name); + } + + if (show_unresolved && res->not_found != (struct YTREE *) 0) + { + printf ("BEGIN list of unresolved symbols (number of refs, name)\n"); + ytree_track_info (res->not_found, buffer, MAX_BUFFER, 0, + xref_print_ref_list, (void *) " "); + printf ("END list of unresolved symbols\n"); + } + + if (show_resolved && res->resolved != (struct YTREE *) 0) + { + printf ("BEGIN list of resolved symbols (number of refs, name)\n"); + ytree_track_info (res->resolved, buffer, MAX_BUFFER, 0, + xref_print_ref_list, (void *) " "); + printf ("END list of resolved symbols\n"); + } + + return 0; +} diff --git a/lib/sbr/misc/xref03.o b/lib/sbr/misc/xref03.o new file mode 100644 index 0000000000000000000000000000000000000000..847d333a4e8c2ec86886de92216e7371233ad564 Binary files /dev/null and b/lib/sbr/misc/xref03.o differ diff --git a/lib/window/(dirinf).fm b/lib/window/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..6066ca80c6bf39ebad0c97a1657434f2aa3decbc --- /dev/null +++ b/lib/window/(dirinf).fm @@ -0,0 +1,25 @@ +# +# FILE .../lib/window/(dirinf).fm +# +# written: 1989 04 06 +# latest update: 1999-04-17 11:54:50 +# $Id: (dirinf).fm,v 1.4 2006/04/09 08:05:37 gonter Exp $ +# +. WINDOW-System Library Funktionen +makefile makefile +makeall.bat <<< execute make in all subdirectories +window_l.mod llink control file for the large model +window_s.mod llink control file for the small model +bios Modell BIOS +cga Modell CGA +test test modules +utl utility programs +0 global data files +1 allgemeines Modell +2 allgemeines Modell; Graphic +3 newer functions + +# +_relics_.zip Alte Module und Backups +win0hers.asm Window-System; Hercules Basis Modul +*.sar prehistoric modules diff --git a/lib/window/0/(dirinf).fm b/lib/window/0/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..f2692e00ca947ec3d9f60fe24ddd59f2e50a711b --- /dev/null +++ b/lib/window/0/(dirinf).fm @@ -0,0 +1,8 @@ +# +# FILE ~/usr/window/0/(dirinf).fm +# +# written: 1994-08-20 +# latest update: 1994-08-20 +# +# ---------------------------------------------------------------------------- +win_data.c define global data elements for window the system diff --git a/lib/window/0/make-dos b/lib/window/0/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..8fd5a19d68e0159f905b416ea36d1593f45ded36 --- /dev/null +++ b/lib/window/0/make-dos @@ -0,0 +1,21 @@ +# +# FILE /usr/window/0/makefile +# +# Window Programme (f�r MAGIS) +# +# +# ===================================================================== +cml=cl -Os -AL /c +cms=cl -Os -AS /c +ccl=cl -Os -AL +ccs=cl -Os -AS +llib=c:\usr\sbr\lsbr + +win_data : win_ldat.obj + +win_sdat.obj : win_data.c + $(cms) /Fo$* win_data.c + +win_ldat.obj : win_data.c + $(cml) /Fo$* win_data.c + objdec -m0 -w -sl 2 WINDOW_TEXT win_ldat.obj diff --git a/lib/window/0/win_data.c b/lib/window/0/win_data.c new file mode 100644 index 0000000000000000000000000000000000000000..8e75932a7b9651b56172e22a6979890b2b113cea --- /dev/null +++ b/lib/window/0/win_data.c @@ -0,0 +1,30 @@ +/* + * FILE %win/0/win_data.c + * + * globale Daten fuer das Window System + * + * written: 1989 08 17 + * latest update: 1996-05-27 8:55:20 + * + */ + +#include <dos.h> +#include <gg/window.h> + +/* ------------------------------------------------------------------------ */ +extern struct W_SCREEN_AND_MODES w_screen_and_modes = +{ + (void *) 0, + (void *) 0 +} ; + +/* ------------------------------------------------------------------------ */ +#define extern +extern int W_DATA_initialized = 0; +extern int W_TEXT_MAX_X = -1; +extern int W_TEXT_MAX_Y = -1; +extern int W_TEXT_CELL_X = -1; +extern int W_TEXT_CELL_Y = -1; +extern int W_GRAPH_MAX_X = -1; +extern int W_GRAPH_MAX_Y = -1; +extern int W_AKT_MODE = -1; diff --git a/lib/window/1/(dirinf).fm b/lib/window/1/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..83e44a56ede3055777ab1f9090ceca87365a3914 --- /dev/null +++ b/lib/window/1/(dirinf).fm @@ -0,0 +1,33 @@ +# +# FILE %win/1/(dirinf).fm +# +# Window System; Modell-Unabhaengige Routinen +# +# written: 1989 08 16 +# latest update: 1995-10-01 +# +win_0101.c void w_prntcol (p, x, y, a, s) +win_0102.c void w_setstring (p, ax, ay, bx, by, a, s, f) +win_0103.c void w_create (w) +win_0104.c void w_namecreat (w, n) +win_0105.c void gr_create (w) +win_0106.c void w_put1ln (w, l) +win_0107.c void w_putln (w, l) +win_0108.c void w_putstr (w, s) +win_0109.c int w_readstr (w, s) +win_0110.c int w_readln (w, s) /* bis end of line zeichen oder wendiger */ +win_0111.c void w_disp_bbox (page, ax, ay, bx, by, attr, box_typ) +win_0112.c void w_disp_box (int page, int ax, ...) +win_0113.c void gr_setcup (cx, cy) /* 40-Zeichen-Cursor im Graphic Mode */ +win_0114.c void cga_setcup (pag, cx, cy) /* 40-Zeichen-Cursor im Graphic Mode */ +win_0115.c void ega_setcup (pag, cx, cy) /* 80-Zeichen-Cursor im EGA Mode */ +win_0116.c int mapkey () /* nicht nur fuer windows!!, daher kein w_ */ +win_0117.c w_printf (a01, a02, a03, a04, a05, a06, a07, a08, a09, a10, ... +win_0118.c int w_more (w, fnm) +win_0119.c w_puts (str) +win_0120.c int w_display (int page, char *s); +win_0121.c int w_display_scr (int page, char *scr); +win_0122.c void w_prtstr (p, x, y, attr, nm, l) +win_0123.c void w_print_long (int p, int x, int y, int c, ...) +win_0124.c void w_set_332_palette () +win_0125.c void w_bell () diff --git a/lib/window/1/Makefile b/lib/window/1/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..c45f3fc1973fea5139b15d8371462d92cbfca755 --- /dev/null +++ b/lib/window/1/Makefile @@ -0,0 +1,55 @@ +# +# FILE %ds/window/1/make-ux +# +# written: 1999-04-10 +# latest update: 2000-08-24 12:59:55 +# $Id: Makefile,v 1.4 2000/08/24 16:26:44 gonter Exp $ +# +# ---------------------------------------------------------------------------- +CC=cc +OPTS=-I. -I/usr/local/include +# OPTS=-I. -O -pedantic -Wall -Wuninitialized -Wunused -Wshadow +LIB=../../libgg.a + +all: $(LIB) + +# ---------------------------------------------------------------------------- +LIBOBJS_tk= win_0102tk.o win_0111tk.o win_0112tk.o win_0125tk.o +LIBOBJS_cur= win_0102cur.o win_0111cur.o win_0112cur.o win_0125cur.o + +# ---------------------------------------------------------------------------- +$(LIB): $(LIBOBJS_tk) $(LIBOBJS_cur) + ar ru $(LIB) $? + +# --- Tk Version ------------------------------------------------------------- +win_0102tk.o : win_0102.c + $(CC) $(OPTS) -DW_MODEL_TK -o win_0102tk.o -c win_0102.c + +win_0111tk.o : win_0111.c + $(CC) $(OPTS) -DW_MODEL_TK -o win_0111tk.o -c win_0111.c + +win_0112tk.o : win_0112.c + $(CC) $(OPTS) -DW_MODEL_TK -o win_0112tk.o -c win_0112.c + +win_0125tk.o : win_0125.c + $(CC) $(OPTS) -DW_MODEL_TK -o win_0125tk.o -c win_0125.c + +# --- Curses Version --------------------------------------------------------- +win_0102cur.o : win_0102.c + $(CC) $(OPTS) -DW_MODEL_CURSES -o win_0102cur.o -c win_0102.c + +win_0111cur.o : win_0111.c + $(CC) $(OPTS) -DW_MODEL_CURSES -o win_0111cur.o -c win_0111.c + +win_0112cur.o : win_0112.c + $(CC) $(OPTS) -DW_MODEL_CURSES -o win_0112cur.o -c win_0112.c + +win_0125cur.o : win_0125.c + $(CC) $(OPTS) -DW_MODEL_CURSES -o win_0125cur.o -c win_0125.c + +# ---------------------------------------------------------------------------- +.c.o: + $(CC) $(OPTS) -c $? + +clean: + rm -f *.o diff --git a/lib/window/1/contrib b/lib/window/1/contrib new file mode 120000 index 0000000000000000000000000000000000000000..7e981abe2509272887707d1ab4b8a5879628d275 --- /dev/null +++ b/lib/window/1/contrib @@ -0,0 +1 @@ +../../include/contrib \ No newline at end of file diff --git a/lib/window/1/gg b/lib/window/1/gg new file mode 120000 index 0000000000000000000000000000000000000000..3d245525b3fca7af17fed3fe295b13dad86fec3d --- /dev/null +++ b/lib/window/1/gg @@ -0,0 +1 @@ +../../include/gg \ No newline at end of file diff --git a/lib/window/1/libgg.a b/lib/window/1/libgg.a new file mode 120000 index 0000000000000000000000000000000000000000..ce2ff5013bebcaeec255c1a7f28afc3b3b5122aa --- /dev/null +++ b/lib/window/1/libgg.a @@ -0,0 +1 @@ +../../libgg.a \ No newline at end of file diff --git a/lib/window/1/make-dos b/lib/window/1/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..3e0ca7f912fcf1c99be0a3e0f8ee3ed941c352bd --- /dev/null +++ b/lib/window/1/make-dos @@ -0,0 +1,301 @@ +# +# FILE %win/1/makefile +# +# written: 1989 08 16 +# 1991 02 04: Revision +# latest update: 1995-10-01 +# + +cml=cl -Os -AL /Fo$* /c +cms=cl -Os -AS /Fo$* /c +obl=objdec -w -d -m0 -sl 2 WINDOW_TEXT +obs=objdec -w -d -m0 + +window : large.bios large.cga small.bios small.cga + +large.bios : obj\biosl101.obj obj\biosl102.obj obj\biosl103.obj ! + obj\biosl104.obj obj\biosl105.obj obj\biosl106.obj obj\biosl107.obj ! + obj\biosl108.obj obj\biosl109.obj obj\biosl110.obj obj\biosl111.obj ! + obj\biosl112.obj obj\biosl113.obj obj\biosl114.obj obj\biosl115.obj ! + obj\biosl116.obj obj\biosl117.obj obj\biosl118.obj obj\biosl119.obj ! + obj\biosl120.obj obj\biosl121.obj obj\biosl122.obj obj\biosl123.obj ! + obj\biosl124.obj obj\biosl125.obj + +large.cga : obj\cga_l101.obj obj\cga_l102.obj ! + obj\cga_l104.obj obj\cga_l106.obj obj\cga_l111.obj ! + obj\cga_l112.obj obj\cga_l117.obj obj\cga_l118.obj obj\cga_l119.obj ! + obj\cga_l120.obj obj\cga_l121.obj obj\cga_l122.obj obj\cga_l123.obj + +small.bios : obj\bioss101.obj obj\bioss102.obj obj\bioss103.obj ! + obj\bioss104.obj obj\bioss105.obj obj\bioss106.obj obj\bioss107.obj ! + obj\bioss108.obj obj\bioss109.obj obj\bioss110.obj obj\bioss111.obj ! + obj\bioss112.obj obj\bioss113.obj obj\bioss114.obj obj\bioss115.obj ! + obj\bioss116.obj obj\bioss117.obj obj\bioss118.obj obj\bioss119.obj ! + obj\bioss120.obj obj\bioss121.obj + +small.cga : obj\cga_s101.obj obj\cga_s102.obj ! + obj\cga_s104.obj obj\cga_s106.obj obj\cga_s111.obj obj\cga_s112.obj ! + obj\cga_s117.obj obj\cga_s118.obj obj\cga_s119.obj obj\cga_s120.obj ! + obj\cga_s121.obj + +# LARGE Modell --------------------------------------------------------------- +obj\biosl101.obj : win_0101.c + $(cml) /DW_MODEL_BIOS win_0101.c + $(obl) obj\biosl101.obj + +obj\cga_l101.obj : win_0101.c + $(cml) /DW_MODEL_CGA win_0101.c + $(obl) obj\cga_l101.obj + +obj\biosl102.obj : win_0102.c + $(cml) /DW_MODEL_BIOS win_0102.c + $(obl) obj\biosl102.obj + +obj\cga_l102.obj : win_0102.c + $(cml) /DW_MODEL_CGA win_0102.c + $(obl) obj\cga_l102.obj + +obj\biosl103.obj : win_0103.c + $(cml) /DW_MODEL_BIOS win_0103.c + $(obl) obj\biosl103.obj + +obj\biosl104.obj : win_0104.c + $(cml) /DW_MODEL_BIOS win_0104.c + $(obl) obj\biosl104.obj + +obj\cga_l104.obj : win_0104.c + $(cml) /DW_MODEL_CGA win_0104.c + $(obl) obj\cga_l104.obj + +obj\biosl105.obj : win_0105.c + $(cml) /DW_MODEL_BIOS win_0105.c + $(obl) obj\biosl105.obj + +obj\biosl106.obj : win_0106.c + $(cml) /DW_MODEL_BIOS win_0106.c + $(obl) obj\biosl106.obj + +obj\cga_l106.obj : win_0106.c + $(cml) /DW_MODEL_CGA win_0106.c + $(obl) obj\cga_l106.obj + +obj\biosl107.obj : win_0107.c + $(cml) /DW_MODEL_BIOS win_0107.c + $(obl) obj\biosl107.obj + +obj\biosl108.obj : win_0108.c + $(cml) /DW_MODEL_BIOS win_0108.c + $(obl) obj\biosl108.obj + +obj\biosl109.obj : win_0109.c + $(cml) /DW_MODEL_BIOS win_0109.c + $(obl) obj\biosl109.obj + +obj\biosl110.obj : win_0110.c + $(cml) /DW_MODEL_BIOS win_0110.c + $(obl) obj\biosl110.obj + +obj\biosl111.obj : win_0111.c + $(cml) /DW_MODEL_BIOS win_0111.c + $(obl) obj\biosl111.obj + +obj\cga_l111.obj : win_0111.c + $(cml) /DW_MODEL_CGA win_0111.c + $(obl) obj\cga_l111.obj + +obj\biosl112.obj : win_0112.c + $(cml) /DW_MODEL_BIOS win_0112.c + $(obl) obj\biosl112.obj + +obj\cga_l112.obj : win_0112.c + $(cml) /DW_MODEL_CGA win_0112.c + $(obl) obj\cga_l112.obj + +obj\biosl113.obj : win_0113.c + $(cml) /DW_MODEL_BIOS win_0113.c + $(obl) obj\biosl113.obj + +obj\biosl114.obj : win_0114.c + $(cml) /DW_MODEL_BIOS win_0114.c + $(obl) obj\biosl114.obj + +obj\biosl115.obj : win_0115.c + $(cml) /DW_MODEL_BIOS win_0115.c + $(obl) obj\biosl115.obj + +obj\biosl116.obj : win_0116.c + $(cml) /DW_MODEL_BIOS win_0116.c + $(obl) obj\biosl116.obj + +obj\biosl117.obj : win_0117.c + $(cml) /DW_MODEL_BIOS win_0117.c + $(obl) obj\biosl117.obj + +obj\cga_l117.obj : win_0117.c + $(cml) /DW_MODEL_CGA win_0117.c + $(obl) obj\cga_l117.obj + +obj\biosl118.obj : win_0118.c + $(cml) /DW_MODEL_BIOS win_0118.c + $(obl) obj\biosl118.obj + +obj\cga_l118.obj : win_0118.c + $(cml) /DW_MODEL_CGA win_0118.c + $(obl) obj\cga_l118.obj + +obj\biosl119.obj : win_0119.c + $(cml) /DW_MODEL_BIOS win_0119.c + $(obl) obj\biosl119.obj + +obj\cga_l119.obj : win_0119.c + $(cml) /DW_MODEL_CGA win_0119.c + $(obl) obj\cga_l119.obj + +obj\biosl120.obj : win_0120.c + $(cml) /DW_MODEL_BIOS win_0120.c + $(obl) obj\biosl120.obj + +obj\cga_l120.obj : win_0120.c + $(cml) /DW_MODEL_CGA win_0120.c + $(obl) obj\cga_l120.obj + +obj\biosl121.obj : win_0121.c + $(cml) /DW_MODEL_BIOS win_0121.c + $(obl) obj\biosl121.obj + +obj\cga_l121.obj : win_0121.c + $(cml) /DW_MODEL_CGA win_0121.c + $(obl) obj\cga_l121.obj + +obj\biosl122.obj : win_0122.c + $(cml) /DW_MODEL_BIOS win_0122.c + $(obl) obj\biosl122.obj + +obj\cga_l122.obj : win_0122.c + $(cml) /DW_MODEL_CGA win_0122.c + $(obl) obj\cga_l122.obj + +obj\biosl123.obj : win_0123.c + $(cml) /DW_MODEL_BIOS win_0123.c + $(obl) obj\biosl123.obj + +obj\cga_l123.obj : win_0123.c + $(cml) /DW_MODEL_CGA win_0123.c + $(obl) obj\cga_l123.obj + +obj\biosl124.obj : win_0124.c + $(cml) /DW_MODEL_BIOS win_0124.c + $(obl) obj\biosl124.obj + +obj\cga_l124.obj : win_0124.c + $(cml) /DW_MODEL_CGA win_0124.c + $(obl) obj\cga_l124.obj + +obj\biosl125.obj : win_0125.c + $(cml) /DW_MODEL_BIOS win_0125.c + $(obl) obj\biosl125.obj + + +# SMALL Modell --------------------------------------------------------------- +obj\bioss101.obj : win_0101.c + $(cms) /DW_MODEL_BIOS win_0101.c + +obj\cga_s101.obj : win_0101.c + $(cms) /DW_MODEL_CGA win_0101.c + +obj\bioss102.obj : win_0102.c + $(cms) /DW_MODEL_BIOS win_0102.c + +obj\cga_s102.obj : win_0102.c + $(cms) /DW_MODEL_CGA win_0102.c + +obj\bioss103.obj : win_0103.c + $(cms) /DW_MODEL_BIOS win_0103.c + +obj\bioss104.obj : win_0104.c + $(cms) /DW_MODEL_BIOS win_0104.c + +obj\cga_s104.obj : win_0104.c + $(cms) /DW_MODEL_CGA win_0104.c + +obj\bioss105.obj : win_0105.c + $(cms) /DW_MODEL_BIOS win_0105.c + +obj\bioss106.obj : win_0106.c + $(cms) /DW_MODEL_BIOS win_0106.c + +obj\cga_s106.obj : win_0106.c + $(cms) /DW_MODEL_CGA win_0106.c + +obj\bioss107.obj : win_0107.c + $(cms) /DW_MODEL_BIOS win_0107.c + +obj\bioss108.obj : win_0108.c + $(cms) /DW_MODEL_BIOS win_0108.c + +obj\bioss109.obj : win_0109.c + $(cms) /DW_MODEL_BIOS win_0109.c + +obj\bioss110.obj : win_0110.c + $(cms) /DW_MODEL_BIOS win_0110.c + +obj\bioss111.obj : win_0111.c + $(cms) /DW_MODEL_BIOS win_0111.c + +obj\cga_s111.obj : win_0111.c + $(cms) /DW_MODEL_CGA win_0111.c + +obj\bioss112.obj : win_0112.c + $(cms) /DW_MODEL_BIOS win_0112.c + +obj\cga_s112.obj : win_0112.c + $(cms) /DW_MODEL_CGA win_0112.c + +obj\bioss113.obj : win_0113.c + $(cms) /DW_MODEL_BIOS win_0113.c + +obj\bioss114.obj : win_0114.c + $(cms) /DW_MODEL_BIOS win_0114.c + +obj\bioss115.obj : win_0115.c + $(cms) /DW_MODEL_BIOS win_0115.c + +obj\bioss116.obj : win_0116.c + $(cms) /DW_MODEL_BIOS win_0116.c + +obj\bioss117.obj : win_0117.c + $(cms) /DW_MODEL_BIOS win_0117.c + +obj\cga_s117.obj : win_0117.c + $(cms) /DW_MODEL_CGA win_0117.c + +obj\bioss118.obj : win_0118.c + $(cms) /DW_MODEL_BIOS win_0118.c + +obj\cga_s118.obj : win_0118.c + $(cms) /DW_MODEL_CGA win_0118.c + +obj\bioss119.obj : win_0119.c + $(cms) /DW_MODEL_BIOS win_0119.c + +obj\cga_s119.obj : win_0119.c + $(cms) /DW_MODEL_CGA win_0119.c + +obj\bioss120.obj : win_0120.c + $(cms) /DW_MODEL_BIOS win_0120.c + +obj\cga_s120.obj : win_0120.c + $(cms) /DW_MODEL_CGA win_0120.c + +obj\bioss121.obj : win_0121.c + $(cms) /DW_MODEL_BIOS win_0121.c + +obj\cga_s121.obj : win_0121.c + $(cms) /DW_MODEL_CGA win_0121.c + +obj\bioss122.obj : win_0122.c + $(cms) /DW_MODEL_BIOS win_0122.c + +obj\cga_s122.obj : win_0122.c + $(cms) /DW_MODEL_CGA win_0122.c + diff --git a/lib/window/1/win_0101.c b/lib/window/1/win_0101.c new file mode 100644 index 0000000000000000000000000000000000000000..749181bbbfa5664a89ca64b66fa8af13ba527ac3 --- /dev/null +++ b/lib/window/1/win_0101.c @@ -0,0 +1,25 @@ +/* + * FILE ~/usr/window/1/win_0101.c + * + * written: 1989 08 16: aus WIN1.SAR uebernommen + * Revision + * latest update: 1994-12-25 + * + */ + +#include <gg/window.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +extern int W_TEXT_MAX_X; + +void w_prntcol (int p, int x, int y, int a, char *s) +{ + while (*s) + { + if (x >= W_TEXT_MAX_X) break; + w_setchar (p, x++, y, a, *s++); + } +} diff --git a/lib/window/1/win_0102.c b/lib/window/1/win_0102.c new file mode 100644 index 0000000000000000000000000000000000000000..d7717571dce02ea12a4a6d284ee7a83f25e4509b --- /dev/null +++ b/lib/window/1/win_0102.c @@ -0,0 +1,41 @@ +/* + * FILE %win/1/win_0102.c + * + * written: 1989 08 16: extracted from WIN1.SAR; revision + * latest update: 1995-09-30 + * $Id: win_0102.c,v 1.2 2005/09/04 20:27:37 gonter Exp $ + * + */ + +#include <gg/window.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +void w_setstring ( +int p, /* Bildschirmseite */ +int ax, /* ) Stringausgabewindow */ +int ay, +int bx, /* ) (inklusiv) */ +int by, +int a, /* Attribut aller Chars */ +const char *s, /* What's to print on screen */ +int f) /* Bit 0: -> angefangene Zeile loeschen */ + /* 1: -> restliches Window loeschen */ +{ + int cx, cy; + + for (cy= ay; cy <= by; cy++) + for (cx= ax; cx <= bx; cx++) + if (*s) + w_setchar (p, cx, cy, a, *s++); + else + { + if ((f & 0x01) || (f & 0x02)) + w_setnchar (p, cx, cy, a, ' ', bx - cx + 1); + if (f & 0x02) break; /* in die Zeilenschleife */ + else return; + } +} diff --git a/lib/window/1/win_0102cur.o b/lib/window/1/win_0102cur.o new file mode 100644 index 0000000000000000000000000000000000000000..31f4f8b2cbb5e4053a4ab17b83c0c3471e8729de Binary files /dev/null and b/lib/window/1/win_0102cur.o differ diff --git a/lib/window/1/win_0102tk.o b/lib/window/1/win_0102tk.o new file mode 100644 index 0000000000000000000000000000000000000000..02f59ae5fa2de75ce3b1690c02ae4f49b08b2bd4 Binary files /dev/null and b/lib/window/1/win_0102tk.o differ diff --git a/lib/window/1/win_0103.c b/lib/window/1/win_0103.c new file mode 100644 index 0000000000000000000000000000000000000000..937c58561d0e3e41127fd055956cf37fc6c1d1df --- /dev/null +++ b/lib/window/1/win_0103.c @@ -0,0 +1,23 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0103.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void w_create (struct WINDOW *w) +{ + int i; + + w_clear (w); + w_disp_bbox (w->page, w->ax, w->ay, w->bx, w->by, w->attr, 2); + + w->cx = w->ax+1; w->cy = w->ay+1; + w_setcup (w->page, w->cx, w->cy); +} + diff --git a/lib/window/1/win_0104.c b/lib/window/1/win_0104.c new file mode 100644 index 0000000000000000000000000000000000000000..a1220baf01db13e6e302d00a2542230465865faf --- /dev/null +++ b/lib/window/1/win_0104.c @@ -0,0 +1,23 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0104.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> +#pragma check_stack(off) + +void w_namecreat (w, n) +struct WINDOW *w; +char *n; +{ int i; + + w_create (w); + + for (i = w->ax + 1; i < w->bx && n [i - w->ax-1]; i++) + w_setchar (w->page, i, w->ay, w->attr, n [i - w->ax-1]); + w_setcup (w->page, w->cx, w->cy); +} + diff --git a/lib/window/1/win_0105.c b/lib/window/1/win_0105.c new file mode 100644 index 0000000000000000000000000000000000000000..c52fc1881bff0a57679639f3a8656c3ff37213f3 --- /dev/null +++ b/lib/window/1/win_0105.c @@ -0,0 +1,22 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0105.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> + +void gr_create (w) +struct WINDOW *w; +{ int i; + + wg_box (w->ax*8+6, w->ay*8+6, + w->bx*8+1, w->by*8+1, + w->attr); + wg_box (w->ax*8+4, w->ay*8+4, + w->bx*8+3, w->by*8+3, + w->attr); +} + diff --git a/lib/window/1/win_0106.c b/lib/window/1/win_0106.c new file mode 100644 index 0000000000000000000000000000000000000000..0e08bced5568963500215541553b7cb0407bd741 --- /dev/null +++ b/lib/window/1/win_0106.c @@ -0,0 +1,39 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0106.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> +#pragma check_stack(off) + +void w_put1ln (w, l) +struct WINDOW *w; +char *l; +/* String l in einer Zeile ausgeben bis + * a) Window Zeile aus + * b) Zeile im String aus + * c) String aus + */ +{ + if (w->cy >= w->by) + { + w_scrollup (w, w->cy - w->by + 1); + } + + for (;;) + { + if (w->cx >= w->bx) break; /* fall a) */ + if ((*l == 0x00) || (*l == 0x0D) || (*l == 0x0A)) + break; /* fall b) und c) */ + w_setchar (w->page, (w->cx)++, w->cy, w->attr, *l++); + } + + if (w->cx < w->bx) + w_setnchar (w->page, w->cx, w->cy, w->attr, ' ', w->bx - w->cx); + (w->cy)++; w->cx = w->ax + 1; + +} + diff --git a/lib/window/1/win_0107.c b/lib/window/1/win_0107.c new file mode 100644 index 0000000000000000000000000000000000000000..1d081b02ca53bb260249051952cb1adb344a3fe3 --- /dev/null +++ b/lib/window/1/win_0107.c @@ -0,0 +1,26 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0107.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> + +void w_putln (w, l) +struct WINDOW *w; +char *l; +/* String l in einer Zeile ausgeben bis + * a) Window Zeile aus + * b) Zeile im String aus + * c) String aus + * und einen Zeilenevorschub durchfuehren (ggf. scrollen) + */ +{ + w_put1ln (w, l); + if (w->cy >= w->by) + w_scrollup (w, 1); + w_setcup (w->page, w->cx, w->cy); +} + diff --git a/lib/window/1/win_0108.c b/lib/window/1/win_0108.c new file mode 100644 index 0000000000000000000000000000000000000000..f892ccd094d31ba5f97632d03604b218ab300c90 --- /dev/null +++ b/lib/window/1/win_0108.c @@ -0,0 +1,32 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0108.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> + +void w_putstr (w, s) +struct WINDOW *w; +char *s; +{ + while (*s) + { if (w->cy == w->by) w_scrollup (w, 1); + if (w->cx == w->bx) + { (w->cy)++; w->cx = w->ax + 1; + continue; + } + if ((*s == 0x0D) || (*s == 0x0A)) + { (w->cy)++; w->cx = w->ax +1; s++; + continue; + } + w_setchar (w->page, (w->cx)++, w->cy, w->attr, *s++); + } + if (w->cy >= w->by) + { w_scrollup (w, 1); + } + w_setcup (w->page, w->cx, w->cy); +} + diff --git a/lib/window/1/win_0109.c b/lib/window/1/win_0109.c new file mode 100644 index 0000000000000000000000000000000000000000..7b537a2666ed8b5a260fab6ea09495621ef9a2c7 --- /dev/null +++ b/lib/window/1/win_0109.c @@ -0,0 +1,62 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0109.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> + +int w_readstr (w, s) +struct WINDOW *w; +char *s; +/* RETURN: last uninterpreted key */ +{ int si = 0, ch; +/* printf ("READ: cx %d cy %d ax %d ay %d bx %d by %d\n", + * w->cx, w->cy, w->ax, w->ay, w->bx, w->by); + */ + + for (;;) + { if (w->cx <= w->ax) w->cx = w->ax + 1; + if (w->cx >= w->bx) + { w->cx = w->ax + 1; + w->cy++; + continue; + } + if (w->cy <= w->ay) w->cy = w->ay + 1; + if (w->cy >= w->by) + { w_scrollup (w, w->cy - w->by + 1); + continue; + } + /* eventuell cursor setzen */ + w_setcup (w->page, w->cx, w->cy); + ch = mapkey (); + if ((ch >= 0x0020) && (ch <= 0x00FF)) + { w_setchar (w->page, w->cx++, w->cy, w->attr, ch); + s [si++] = ch; + } + else + switch (ch) + { case 0x000D: + case 0x000A: w->cy++; + w->cx = w->ax + 1; + s [si++] = '\n'; + break; + case 0x0008: /* backtab */ + if (w->cx <= w->ax + 1) break; + w->cx--; si--; + break; +#ifdef JUNK + case 0x0141: + case 0x0143: /* F7 u. F9 */ + s [si] = 0; + return 0; +#endif + /* andere interpretationen usw */ + default: s [si] = 0; + return ch; + } + } +} + diff --git a/lib/window/1/win_0110.c b/lib/window/1/win_0110.c new file mode 100644 index 0000000000000000000000000000000000000000..da741af4bd8a9b3c146bb7701c0162444f51e18f --- /dev/null +++ b/lib/window/1/win_0110.c @@ -0,0 +1,61 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0110.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> + +int w_readln (w, s) /* bis end of line zeichen oder wendiger */ +struct WINDOW *w; +char *s; +/* return: last uninterpreted key */ +{ int si = 0, ch; +/* printf ("READ: cx %d cy %d ax %d ay %d bx %d by %d\n", + * w->cx, w->cy, w->ax, w->ay, w->bx, w->by); + */ + + for (;;) + { if (w->cx <= w->ax) w->cx = w->ax + 1; + if (w->cx >= w->bx) return 0; + if (w->cy <= w->ay) w->cy = w->ay + 1; + if (w->cy >= w->by) + { w_scrollup (w, w->cy - w->by + 1); + continue; + } + /* eventuell cursor setzen */ + w_setchar (w->page, w->cx, w->cy, w->attr, ' '); + ch = mapkey (); + if ((ch >= 0x0020) && (ch <= 0x00FF)) + { w_setchar (w->page, w->cx++, w->cy, w->attr, ch); + s [si++] = ch; + } + else + switch (ch) + { case 0x000D: + case 0x000A: w->cy++; + w->cx = w->ax + 1; + s [si] = 0; + if (w->cy >= w->by) + w_scrollup (w, 1); + w_setcup (w->page, w->cx, w->cy); + return 0x0A; + case 0x0008: /* backtab */ + if (w->cx <= w->ax + 1) break; + w->cx--; si--; + break; +#ifdef JUNK + case 0x0141: + case 0x0143: /* F7 u. F9 */ + s [si] = 0; + return 0; +#endif + /* andere interpretationen usw */ + default: s [si] = 0; + return ch; + } + } +} + diff --git a/lib/window/1/win_0111.c b/lib/window/1/win_0111.c new file mode 100644 index 0000000000000000000000000000000000000000..23c8fe7bdc0090be94292dfd6958a15bef526e4e --- /dev/null +++ b/lib/window/1/win_0111.c @@ -0,0 +1,128 @@ +/* + * FILE ~/usr/window/1/win_0111.c + * + * written: 1989 08 16: aus WIN1.SAR uebernommen + * Revision + * latest update: 1995-03-05 + * + */ + +#include <gg/window.h> + +#ifdef MSDOS +#pragma check_stack(off) +#define RU_OK +#endif + +#ifdef W_MODEL_NCURSES +#define RU_OK +#endif + +/* Display Box in Blockmode ----------------------------------------------- */ +void w_disp_bbox ( +int page, +int ax, +int ay, +int bx, +int by, +int attr, +int box_typ) /* 1 -> einfach; sonst: doppelt */ +{ +#ifdef JUNKIE + register int i; + int linie_waagrecht; + int linie_senkrecht; + int ecke_links_oben; + int ecke_rechts_oben; + int ecke_rechts_unten; + int ecke_links_unten; + + /* Koordinaten verdreht: keine Box */ + if (ax > bx || ay > by) return; + +#ifdef MSDOS + /* Box ist nur ein Zeichen gross */ + if (ax == bx && ay == by) + { + if (box_typ) + w_setchar (page, ax, ay, attr, 0x07); + else w_setchar (page, ax, ay, attr, 0x09); + return; + } + + switch (box_typ) + { + case 1: + linie_waagrecht = 0xC4; + linie_senkrecht = 0xB3; + ecke_links_oben = 0xDA; + ecke_rechts_oben = 0xBF; + ecke_rechts_unten = 0xD9; + ecke_links_unten = 0xC0; + break; + case 2: linie_waagrecht = 0xCD; + linie_senkrecht = 0xBA; + ecke_links_oben = 0xC9; + ecke_rechts_oben = 0xBB; + ecke_rechts_unten = 0xBC; + ecke_links_unten = 0xC8; + break; + default: return; + } +#else + /* Box ist nur ein Zeichen gross */ + if (ax == bx && ay == by) + { + w_setchar (page, ax, ay, attr, '*'); + return; + } + + linie_waagrecht = '-'; + linie_senkrecht = '|'; + ecke_links_oben = + ecke_rechts_oben = + ecke_rechts_unten = + ecke_links_unten = '+'; +#endif + + /* Box besteht nur aus der senkrechten Linie */ + if (ax == bx) + { + for (i = ay; i <= by; i++) + w_setchar (page, ax, i, attr, linie_senkrecht); + return; + } + + /* Box besteht nur aus der waagrechten Linie */ + if (ay == by) + { + w_setnchar (page, ax, ay, attr, linie_waagrecht, bx-ax+1); + return; + } + + /* Richtige Box */ + w_setchar (page, ax, ay, attr, ecke_links_oben); + + if (ax+1 < bx) + w_setnchar (page, ax+1, ay, attr, linie_waagrecht, bx-ax-1); + + w_setchar (page, bx, ay, attr, ecke_rechts_oben); + + for (i= ay + 1; i < by; i++) + { + w_setchar (page, bx, i, attr, linie_senkrecht); + w_setchar (page, ax, i, attr, linie_senkrecht); + } + + w_setchar (page, ax, by, attr, ecke_links_unten); + +#ifdef RU_OK + w_setchar (page, bx, by, attr, ecke_rechts_unten); +#endif + + if (ax+1 < bx) + w_setnchar (page, ax+1, by, attr, linie_waagrecht, bx-ax-1); +#else + w_disp_box (page, ax, ay, bx, by, attr, box_typ, 0x00FF); +#endif /* !JUNKIE */ +} diff --git a/lib/window/1/win_0111cur.o b/lib/window/1/win_0111cur.o new file mode 100644 index 0000000000000000000000000000000000000000..6ff188b82071a3eb52cffcf284d7160c7a5b42bf Binary files /dev/null and b/lib/window/1/win_0111cur.o differ diff --git a/lib/window/1/win_0111tk.o b/lib/window/1/win_0111tk.o new file mode 100644 index 0000000000000000000000000000000000000000..47d802c5d97d5ab7ca14de3426bd337404deab49 Binary files /dev/null and b/lib/window/1/win_0111tk.o differ diff --git a/lib/window/1/win_0112.c b/lib/window/1/win_0112.c new file mode 100644 index 0000000000000000000000000000000000000000..fe60bbfb6a31b337918ef193129891e6e4d19548 --- /dev/null +++ b/lib/window/1/win_0112.c @@ -0,0 +1,139 @@ +/* + * FILE ~/usr/window/1/win_0112.c + * + * written: 1989 08 16: aus WIN1.SAR uebernommen + * Revision + * latest update: 1995-03-05: extracted from win_0111.c + * + */ + +#include <gg/window.h> + +#ifdef MSDOS +#pragma check_stack(off) +#define RU_OK +#endif + +#ifdef W_MODEL_NCURSES +#define RU_OK +#endif + +/* Display Box in Blockmode ----------------------------------------------- */ +void w_disp_box ( +int page, +int ax, +int ay, +int bx, +int by, +int attr, +int box_typ, /* 1 -> einfach; sonst: doppelt */ +int box_edges) /* bit 0: upper edge */ + /* bit 1: upper right corner */ + /* bit 2: right edge */ + /* bit 3: lower right corner */ + /* bit 4: lower edge */ + /* bit 5: lower left corner */ + /* bit 6: left edge */ + /* bit 7: upper left corner */ +{ + register int i; + int linie_waagrecht; + int linie_senkrecht; + int ecke_links_oben; + int ecke_rechts_oben; + int ecke_rechts_unten; + int ecke_links_unten; + + /* Koordinaten verdreht: keine Box */ + if (ax > bx || ay > by) return; + +#ifdef MSDOS + /* Box ist nur ein Zeichen gross */ + if (ax == bx && ay == by) + { + if (box_typ) + w_setchar (page, ax, ay, attr, 0x07); + else w_setchar (page, ax, ay, attr, 0x09); + return; + } + + switch (box_typ) + { + case 1: + linie_waagrecht = 0xC4; + linie_senkrecht = 0xB3; + ecke_links_oben = 0xDA; + ecke_rechts_oben = 0xBF; + ecke_rechts_unten = 0xD9; + ecke_links_unten = 0xC0; + break; + case 2: linie_waagrecht = 0xCD; + linie_senkrecht = 0xBA; + ecke_links_oben = 0xC9; + ecke_rechts_oben = 0xBB; + ecke_rechts_unten = 0xBC; + ecke_links_unten = 0xC8; + break; + default: return; + } +#else + /* Box ist nur ein Zeichen gross */ + if (ax == bx && ay == by) + { + w_setchar (page, ax, ay, attr, '*'); + return; + } + + linie_waagrecht = '-'; + linie_senkrecht = '|'; + ecke_links_oben = + ecke_rechts_oben = + ecke_rechts_unten = + ecke_links_unten = '+'; +#endif + + /* Box besteht nur aus der senkrechten Linie */ + if (ax == bx && (box_edges & 0x0044)) + { + for (i= ay; i <= by; i++) + w_setchar (page, ax, i, attr, linie_senkrecht); + return; + } + + /* Box besteht nur aus der waagrechten Linie */ + if (ay == by && (box_edges & 0x0011)) + { + w_setnchar (page, ax, ay, attr, linie_waagrecht, bx-ax+1); + return; + } + + /* Richtige Box */ + if (ax+1 < bx && (box_edges & 0x0001)) + w_setnchar (page, ax+1, ay, attr, linie_waagrecht, bx-ax-1); + + if (box_edges & 0x0002) + w_setchar (page, bx, ay, attr, ecke_rechts_oben); + + if (box_edges & 0x0004) + for (i= ay + 1; i < by; i++) + w_setchar (page, bx, i, attr, linie_senkrecht); + +#ifdef RU_OK + if (box_edges & 0x0008) + w_setchar (page, bx, by, attr, ecke_rechts_unten); +#endif + + if (ax+1 < bx && (box_edges & 0x0010)) + w_setnchar (page, ax+1, by, attr, linie_waagrecht, bx-ax-1); + + if (box_edges & 0x0020) + w_setchar (page, ax, by, attr, ecke_links_unten); + + if (box_edges & 0x0040) + for (i= ay + 1; i < by; i++) + w_setchar (page, ax, i, attr, linie_senkrecht); + + if (box_edges & 0x0080) + w_setchar (page, ax, ay, attr, ecke_links_oben); + +} diff --git a/lib/window/1/win_0112cur.o b/lib/window/1/win_0112cur.o new file mode 100644 index 0000000000000000000000000000000000000000..fb6e5480e867e6f0d421ad5942bb8ebebee47580 Binary files /dev/null and b/lib/window/1/win_0112cur.o differ diff --git a/lib/window/1/win_0112tk.o b/lib/window/1/win_0112tk.o new file mode 100644 index 0000000000000000000000000000000000000000..bc29d14c7f6bbc8b2175b098b5123ea41573dc47 Binary files /dev/null and b/lib/window/1/win_0112tk.o differ diff --git a/lib/window/1/win_0113.c b/lib/window/1/win_0113.c new file mode 100644 index 0000000000000000000000000000000000000000..7292815f8d6e8021e85397f24e1e375844f62e3f --- /dev/null +++ b/lib/window/1/win_0113.c @@ -0,0 +1,20 @@ +/* + * FILE ~/usr/window/1/win_0113.c + * + * written: 1989 08 16: aus WIN1.SAR �bernommen; Revision + * latest update: 1995-03-05 + * + */ + +#include <gg/window.h> + +void gr_setcup ( /* 40-Zeichen-Cursor im Graphic Mode */ +int cx, int cy) +{ + int i, j; + + for (i= 0; i < 2; i++) + for (j= 0; j < 8; j++) + wg_wr_dot (cx*8+j, cy*8+6+i, 0x81); +} + diff --git a/lib/window/1/win_0114.c b/lib/window/1/win_0114.c new file mode 100644 index 0000000000000000000000000000000000000000..a7d14242bcd2c66487660f7071da5db66f36d5bf --- /dev/null +++ b/lib/window/1/win_0114.c @@ -0,0 +1,18 @@ +/* + * FILE ~/usr/window/1/win_0114.c + * + * written: 1989 08 16: aus WIN1.SAR uebernommen; Revision + * latest update: 1995-03-05 + * + */ + +#include <gg/window.h> + +void cga_setcup ( /* 40-Zeichen-Cursor im Graphic Mode */ +int pag, +int cx, +int cy) +{ + gr_setcup (cx, cy); +} + diff --git a/lib/window/1/win_0115.c b/lib/window/1/win_0115.c new file mode 100644 index 0000000000000000000000000000000000000000..713b494a9eb8f529cb472c147de7e0d455acf977 --- /dev/null +++ b/lib/window/1/win_0115.c @@ -0,0 +1,18 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0115.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> + +void ega_setcup (pag, cx, cy) /* 80-Zeichen-Cursor im EGA Mode */ +int pag, cx, cy; +{ int i, j; + for (i = 0; i < 2; i++) + for (j = 0; j < 8; j++) + wg_wr_dot (cx*8+j, cy*14+12+i, 0x81); +} + diff --git a/lib/window/1/win_0116.c b/lib/window/1/win_0116.c new file mode 100644 index 0000000000000000000000000000000000000000..861cc342c024ffd204c4a13e78ce2e2c391ca6af --- /dev/null +++ b/lib/window/1/win_0116.c @@ -0,0 +1,31 @@ +/* + * FILE ~/usr/window/1/win_0116.c + * + * written: 1989 08 16: aus WIN1.SAR uebernommen; Revision + * latest update: 1995-03-05 + * + */ + + +#include <dos.h> + +int mapkey () /* nicht nur fuer windows!!, daher kein w_ */ +/* tastatur einlesen, + * sondercodes auf EIN integer abbilden + * usw... + */ +{ + int ch; + union REGS ra, rb; + + ra.h.ah = 0x0000; /* Fuer AT's: 0x0010 */ + int86 (0x0016, &ra, &rb); + + switch (rb.h.al) + { + case 0x00E0: + case 0x0000: return (rb.h.ah & 0x00FF) | 0x0100; + default : return rb.h.al & 0x00FF; + } +} + diff --git a/lib/window/1/win_0117.c b/lib/window/1/win_0117.c new file mode 100644 index 0000000000000000000000000000000000000000..876aee738f26c9bc3d635300b5eb0f631f437dc3 --- /dev/null +++ b/lib/window/1/win_0117.c @@ -0,0 +1,23 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0117.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> + +typedef char *strng; +static char p [400]; + +w_printf (a01, a02, a03, a04, a05, a06, a07, a08, a09, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) +strng a01, a02, a03, a04, a05, a06, a07, a08, a09, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; +{ sprintf (p, + a01, a02, a03, a04, a05, a06, a07, a08, a09, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + w_puts (p); +} + diff --git a/lib/window/1/win_0118.c b/lib/window/1/win_0118.c new file mode 100644 index 0000000000000000000000000000000000000000..1f2bc89d1cdd2efaaa421e66d7e6581c5cae5640 --- /dev/null +++ b/lib/window/1/win_0118.c @@ -0,0 +1,51 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0118.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <stdio.h> +#include <fcntl.h> +#include <share.h> +#include <gg/window.h> + +extern FILE *fsopen (); + +static char VVV [] = "(@)Bwedit.c #D$1988-03-23 17:00:00"; + +/* ----------------------------------------------------------------- */ +int w_more (w, fnm) +struct WINDOW *w; /* Window, wo ... */ +char fnm []; /* ... File angezeigt wird */ +/* RETURN: 0 -> File vollstaendig auf 1 Seite angezeigt */ +/* > 1 -> File benoetigt mehr als 1 Seite am Schirm !! */ +{ FILE *disp; + char line [100]; + int frei, ch, fullpage = 0; + + if (access (fnm, 0) != 0) return 1; + frei = w->by - w->ay - 1; + disp = fsopen (fnm, "rt", O_RDONLY, SH_DENYNO, 16, &ch); + if (disp == (FILE *) 0) return 1; + for (;;) + { fscanf (disp, "%[^\n]s", line); fgetc (disp); + if (feof (disp)) break; + if (!frei) + { ch = mapkey (); + fullpage = 1; + if (ch == 0x0d) frei = 1; + if (ch == 0x20) frei = w->by - w->ay; + if (ch == 0x1b) + { fclose (disp); + return 1; + } + } + w_put1ln (w, line); + frei--; + } + fclose (disp); + return fullpage; +} + diff --git a/lib/window/1/win_0119.c b/lib/window/1/win_0119.c new file mode 100644 index 0000000000000000000000000000000000000000..38e4cfdfaf8cabf47860e3303652c54d2f08eb80 --- /dev/null +++ b/lib/window/1/win_0119.c @@ -0,0 +1,43 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0119.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> + +w_puts (str) +char *str; +{ int i = 0; + int Cx=0, Cy=0, Cm=0; /* ####aktuelle Cursor Position ####*/ + + for (i = 0; str [i]; i++) + switch (str [i]) + { case 0x07: break; + case 0x08: if (Cx) Cx--; + else if (Cy) + { Cx = (Cm) ? 39 : 79; + Cy--; + } + break; + case 0x0C: Cx = Cy = 0; break; + case 0x0D: case 0x0A: + Cx = 0; + if (++Cy >= 25) + Cy = 0; + break; + default: w_setchar (0, Cx, Cy, WV_GRUEN, str [i]); + if (++Cx >= ((Cm) ? 40 : 80)) + { Cx = 0; + if (++Cy >= 25) + Cy = 0; + } + break; + } +} + + + + diff --git a/lib/window/1/win_0120.c b/lib/window/1/win_0120.c new file mode 100644 index 0000000000000000000000000000000000000000..d8d28d2fc502b1cfa1baa8f300c0a461eb01e5b1 --- /dev/null +++ b/lib/window/1/win_0120.c @@ -0,0 +1,54 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0120.C] + * + * 1989 08 16: aus WIN1.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +/* Anzeigen von Screen Records im Text Modus */ +void w_display (page, s) +int page; /* verwendete Bildschirmseite */ +char *s; /* Screen Record */ +{ int i, l, cx, cy, attr; + + l = s [0] & 0x00FF; + cx = s [1] & 0x00FF; + cy = s [2] & 0x00FF; + attr = s [3] & 0x00FF; +#ifdef DEBUG + printf ("\ncx=%d, cy=%d, laenge=%d, attr=0x%02x", + cx, cy, l, attr); +#endif + + if (cx == 255) + { switch (cy) + { case 0x01: /* set background colour */ + w_setscreen (attr); + if (l > 4) w_border (s [4]); + break; + case 0x02: /* Area */ + w_scrblk_up (s [4] & 0x00FF, + s [5] & 0x00FF, + s [6] & 0x00FF, + s [7] & 0x00FF, + attr, 0); + break; + case 0x03: /* Doppelte Box */ + case 0x04: /* Einfache Box */ + w_disp_bbox (page, s [4] & 0x00FF, s [5] & 0x00FF, + s [6] & 0x00FF, s [7] & 0x00FF, attr, + (cy==3) ? 2 : 1); + break; + case 0xFF: /* defined as the empty screen object */ + break; + } + } + else + for (i = 4; i < l; i++) + w_setchar (page, cx++, cy, attr, s [i]); +} diff --git a/lib/window/1/win_0121.c b/lib/window/1/win_0121.c new file mode 100644 index 0000000000000000000000000000000000000000..a576efdc6c9f3dd8f920f93c8e4e220b0eea6f57 --- /dev/null +++ b/lib/window/1/win_0121.c @@ -0,0 +1,23 @@ +/* + * FILE C:\usr\window\win1.arc [WIN_0121.C] + * + * 1989 08 19: aus COMMON.SAR �bernommen + * Revision + * + */ + +#include <gg/window.h> +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void w_display_scr (page, scr) +int page; +char *scr; +{ + int i, j; + + j = VAL (scr,0); + + for (i = 2; i < j; i += scr [i] & 0x00FF) + w_display (page, &scr [i]); +} diff --git a/lib/window/1/win_0122.c b/lib/window/1/win_0122.c new file mode 100644 index 0000000000000000000000000000000000000000..37e25f5f04f7d26f42478b4f27978692a6087866 --- /dev/null +++ b/lib/window/1/win_0122.c @@ -0,0 +1,42 @@ +/* + * FILE ~/usr/window/1/win_0122.c + * + * written: 1990 04 21: aus /usr/fm/files.c uebernommen + * latest update: 1994-08-20 + * + */ + +#include <gg/window.h> +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void w_prtstr ( +int p, +int x, +int y, +int attr, +char *nm, +int l) /* Laenge des zu beschreibenden Feldes */ + /* l < 0 -> Rechtsbuendig */ +{ + int i, j= 0; + + if (nm == (char *) 0) + { + w_setnchar (p, x, y, attr, ' ', l); + return; + } + + if (l < 0) + { + j= strlen (nm); + for (i= 0; i > l; i--) + w_setchar (p, x+i, y, attr, (j > 0) ? nm [--j] : ' '); + } + else + { + for (i= 0; nm [i] && i < l; i++) + w_setchar (p, x+i, y, attr, nm [i]); + if (i < l) w_setnchar (p, x+i, y, attr, ' ', l-i); + } +} diff --git a/lib/window/1/win_0123.c b/lib/window/1/win_0123.c new file mode 100644 index 0000000000000000000000000000000000000000..3e92af6da9fc8b211029e271169fe5b448ffdf79 --- /dev/null +++ b/lib/window/1/win_0123.c @@ -0,0 +1,22 @@ +/* + * FILE ~/usr/win/1/win_0123.c + * + * written: 1994-08-20 + * latest update: 1994-08-20 + * + */ + +#include <stdio.h> +#include <gg/window.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +void w_print_long (int p, int x, int y, int c, char *fmt, long val) +{ + char vals [48]; + sprintf (vals, fmt, val); + w_prntcol (p, x, y, c, vals); +} diff --git a/lib/window/1/win_0124.c b/lib/window/1/win_0124.c new file mode 100644 index 0000000000000000000000000000000000000000..f2c50dc18573cd4ece138ddd50d3dc4d8ae48b68 --- /dev/null +++ b/lib/window/1/win_0124.c @@ -0,0 +1,38 @@ +/* + * FILE %win/1/win_0124.c + * + * written: 1994-09-04 + * latest update: 1995-10-01 + * + */ + +#include <stdio.h> +#include <gg/window.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +static char block [256*3]; + +/* ------------------------------------------------------------------------ */ +void w_set_332_palette () +{ + int num= 0; + int red; + int green; + int blue; + int idx= 0; + + for (red= 0; red < 0x0040; red += 0x0008) + for (green= 0; green < 0x0040; green += 0x0008) + for (blue= 0; blue < 0x0040; blue += 0x0010) + { + block [idx++] = (char) red; + block [idx++] = (char) green; + block [idx++] = (char) blue; + num++; + } + + w_setpalette_block (0, 256, block); +} diff --git a/lib/window/1/win_0125.c b/lib/window/1/win_0125.c new file mode 100644 index 0000000000000000000000000000000000000000..01954f4f1fade6b8e437c518eecb57aeb5792184 --- /dev/null +++ b/lib/window/1/win_0125.c @@ -0,0 +1,27 @@ +/* + * FILE %win/1/win_0125.c + * + * written: 1995-10-01 + * latest update: 1995-10-20 + * + */ + +#include <stdio.h> +#include <gg/window.h> + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#define SIMPLE_BELL +#ifdef W_MODEL_TK +#undef SIMPLE_BELL +#endif + +/* ------------------------------------------------------------------------ */ +#ifdef SIMPLE_BELL +void w_bell () +{ + putchar (0x07); +} +#endif diff --git a/lib/window/1/win_0125cur.o b/lib/window/1/win_0125cur.o new file mode 100644 index 0000000000000000000000000000000000000000..7b69cc4e0e7d8f85cd17f8410b8c371fa9350f01 Binary files /dev/null and b/lib/window/1/win_0125cur.o differ diff --git a/lib/window/1/win_0125tk.o b/lib/window/1/win_0125tk.o new file mode 100644 index 0000000000000000000000000000000000000000..6f3edd6ff6c59bdd4d5864eae2307d80f23dac87 Binary files /dev/null and b/lib/window/1/win_0125tk.o differ diff --git a/lib/window/2/(dirinf).fm b/lib/window/2/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..68df6b2119de94283c7587f8836d27d556eb688d --- /dev/null +++ b/lib/window/2/(dirinf).fm @@ -0,0 +1,13 @@ +# +# FILE ~/usr/window/w/(dirinf).fm +# +# written: 1994-08-20 +# latest update: 1994-08-20 +# +# ---------------------------------------------------------------------------- +win_0201.c void wg_box (...) /* Rechteck */ +win_0202.c void wg_fbox (...) /* gefuelltes Rechteck */ +win_0203.c void wg_circle (...) /* zeichnet Kreis mit Mittelpunkt */ +win_0204.c void wg_fcircle (...) /* zeichnet Kreis mit Mittelpunkt */ +win_0205.c void _wg_x_line (...) +win_0206.c void _wg_y_line (...) diff --git a/lib/window/2/make-dos b/lib/window/2/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..2e52152094fb6fcc4c9a0929459ba50885d18e26 --- /dev/null +++ b/lib/window/2/make-dos @@ -0,0 +1,105 @@ +# +# FILE /usr/window/2/makefile +# +# 1989 08 16: aus WIN0.SAR �bernommen +# Revision +# + +asm=masm /Ml +cml=cl -Os -AL /Fo$* /c +cms=cl -Os -AS /Fo$* /c +obl=objdec -w -d -m0 -sl 2 WINDOW_TEXT +cga=/DW_MODEL_CGA +bios=/DW_MODEL_BIOS + +# ---------------------------------------------------------------------------- +all : large small + +large : biosl201.obj biosl202.obj biosl203.obj biosl204.obj biosl205.obj ! + biosl206.obj + +# copy c:\usr\sbr\lsbr.lib x.lib +# lib x.lib-+biosl201-+biosl202-+biosl203-+biosl204-+biosl205-+biosl206; +# copy x.lib c:\usr\sbr\lsbr.lib +# copy cr.lst c:\usr\sbr\lsbr.lst +# del x.lib +# del cr.lst +# del *.obj +# del *.bak + +small : bioss201.obj bioss202.obj bioss203.obj bioss204.obj bioss205.obj ! + bioss206.obj + +# copy c:\usr\sbr\ssbr.lib x.lib +# lib x.lib-+bioss201-+bioss202-+bioss203-+bioss204-+bioss205-+bioss206; +# copy x.lib c:\usr\sbr\ssbr.lib +# copy cr.lst c:\usr\sbr\ssbr.lst +# del x.lib +# del cr.lst +# del *.obj +# del *.bak + +# ---------------------------------------------------------------------------- +t1.obj : t1.c + $(cml) t1.c + +t1.exe : t1.obj biosl201.obj biosl205.obj biosl206.obj + link t1 biosl201 biosl205 biosl206,,/map,c:\usr\sbr\lsbr; + +t2.obj : t2.c + $(cml) t2.c + +t2.exe : t2.obj biosl201.obj biosl202.obj biosl203.obj biosl204.obj ! + biosl205.obj biosl206.obj + link t2 biosl201 biosl202 biosl203 biosl204 biosl205 biosl206,,/map,c:\usr\sbr\lsbr; + + +# Large Modules: ------------------------------------------------------------- +biosl201.obj : win_0201.c + $(cml) $(bios) win_0201.c + $(obl) biosl201.obj + +biosl202.obj : win_0202.c + $(cml) $(bios) win_0202.c + $(obl) biosl202.obj + +biosl203.obj : win_0203.c + $(cml) $(bios) win_0203.c + $(obl) biosl203.obj + +biosl204.obj : win_0204.c + $(cml) $(bios) win_0204.c + $(obl) biosl204.obj + +biosl205.obj : win_0205.c + $(cml) $(bios) win_0205.c + $(obl) biosl205.obj + +biosl206.obj : win_0206.c + $(cml) $(bios) win_0206.c + $(obl) biosl206.obj + + + +# Small Modules: ------------------------------------------------------------- +bioss201.obj : win_0201.c + $(cms) $(bios) win_0201.c + +bioss202.obj : win_0202.c + $(cms) $(bios) win_0202.c + +bioss203.obj : win_0203.c + $(cms) $(bios) win_0203.c + +bioss204.obj : win_0204.c + $(cms) $(bios) win_0204.c + +bioss205.obj : win_0205.c + $(cms) $(bios) win_0205.c + +bioss206.obj : win_0206.c + $(cms) $(bios) win_0206.c + + + + diff --git a/lib/window/2/ned.stp b/lib/window/2/ned.stp new file mode 100644 index 0000000000000000000000000000000000000000..3853eab9f47fde1d89c60d0e9c48c90b4c365a6d --- /dev/null +++ b/lib/window/2/ned.stp @@ -0,0 +1,3 @@ +@macro +1 ^kb^kk^ka(dirinf).fm^m +@end diff --git a/lib/window/2/t2.c b/lib/window/2/t2.c new file mode 100644 index 0000000000000000000000000000000000000000..d6484284d14fa51a54c0a0088eb6db79372a4425 --- /dev/null +++ b/lib/window/2/t2.c @@ -0,0 +1,14 @@ + +#define W_MODEL_CGA +#include <gg/window.h> + +main () +{ + w_init_mode ((char *) 0, 5, 0x0001); + wg_box (20, 20, 30, 30, 1); + wg_fbox (40, 40, 50, 50, 2); + wg_circle (100, 100, 40, 0x82); + wg_fcircle (200, 100, 40, 0x83); + wg_fcircle (10, 10, 0, 1); + wg_fbox (0, 0, 319, 199, 0x81); +} diff --git a/lib/window/2/win_0201.c b/lib/window/2/win_0201.c new file mode 100644 index 0000000000000000000000000000000000000000..156d026cf39de96d9fed1211b22f0be7ea06560e --- /dev/null +++ b/lib/window/2/win_0201.c @@ -0,0 +1,31 @@ +/* + * FILE /usr/window/2/win_0201.c + * + * written: 1989 08 16: aus WIN1.SAR uebernommen; Revision + * latest update: 1994-08-20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/window.h> + +/* ------------------------------------------------------------------------ */ +void wg_box ( /* Rechteck */ +int x1, +int y1, +int x2, +int y2, +int col) +{ + register int x,y; + + if (x1 > x2) { x = x1; x1 = x2; x2 = x; } + if (y1 > y2) { y = y1; y1 = y2; y2 = y; } + _wg_x_line (x1, x2, y1, col); + _wg_x_line (x1, x2, y2, col); + _wg_y_line (x1, y1, y2, col); + _wg_y_line (x2, y1, y2, col); +} diff --git a/lib/window/2/win_0202.c b/lib/window/2/win_0202.c new file mode 100644 index 0000000000000000000000000000000000000000..c83ff645dac4fe4dea4adf9ab5e355b52cc108d6 --- /dev/null +++ b/lib/window/2/win_0202.c @@ -0,0 +1,30 @@ +/* + * FILE ~/usr/window/2/win_0202.c + * + * written: 1989 09 09 + * latest update: 1994-08-20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/window.h> + +/* ------------------------------------------------------------------------ */ +void wg_fbox ( /* gefuelltes Rechteck */ +int x1, +int y1, +int x2, +int y2, +int col) +{ + register int x,y; + + if (x1 > x2) { x= x1; x1= x2; x2= x; } + if (y1 > y2) { y= y1; y1= y2; y2= y; } + + for (y = y1; y <= y2; y++) + _wg_x_line (x1, x2, y, col); +} diff --git a/lib/window/2/win_0203.c b/lib/window/2/win_0203.c new file mode 100644 index 0000000000000000000000000000000000000000..946e1ec69977e41e2a012547245b61cfd8e630cb --- /dev/null +++ b/lib/window/2/win_0203.c @@ -0,0 +1,52 @@ +/* + * FILE ~/usr/window/2/win_0203.c + * + * written: 1989 09 09 + * latest update: 1994-08-20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/window.h> + +/* ------------------------------------------------------------------------ */ +void wg_circle ( /* zeichnet Kreis mit Mittelpunkt */ +int xm, /* definiert durch (xm, ym) */ +int ym, +int r, /* und Radius r */ +int col) /* .. in der Farbe r */ +{ /* Alg: Bresenham modifiziert auf Kreisbahn */ + int x, y, dx, dy, e; + + x= 0; + y= r; + dy= x; + dx= y; + e= dx/2; + + do + { + wg_wr_dot (xm+x,ym+y,col); + wg_wr_dot (xm+y,ym+x,col); + wg_wr_dot (xm-x,ym+y,col); + wg_wr_dot (xm+y,ym-x,col); + wg_wr_dot (xm+x,ym-y,col); + wg_wr_dot (xm-y,ym+x,col); + wg_wr_dot (xm-x,ym-y,col); + wg_wr_dot (xm-y,ym-x,col); + + if (e < 0) + { + y--; + e+= dx; + dx= y; + } + + dy= x++; + e-= dy; + } + while (dy <= dx); +} diff --git a/lib/window/2/win_0204.c b/lib/window/2/win_0204.c new file mode 100644 index 0000000000000000000000000000000000000000..9b870b19f43b58e4481b9c124e603f26db25a082 --- /dev/null +++ b/lib/window/2/win_0204.c @@ -0,0 +1,46 @@ +/* + * FILE ~/usr/window/2/win_0204.c + * + * written: 1989 09 09 + * latest update: 1994-08-20 + * + */ + +#include <gg/window.h> +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void wg_fcircle ( /* zeichnet Kreis mit Mittelpunkt */ +int xm, /* definiert durch (xm, ym) */ +int ym, +int r, /* und Radius r */ +int col) /* .. in der Farbe r */ +{ /* Alg: Bresenham modifiziert auf Kreisbahn */ + int x, y, dx, dy, e; + int crit_y; /* critical lines */ + + if (xm < 0 || ym < 0 || r < 0) return; + + x= 0; + y= r; + dy= x; + dx= y; + e= dx/2; + + do + { + _wg_x_line (xm-y, xm+y, ym-x, col); + if (x) _wg_x_line (xm-y, xm+y, ym+x, col); + if (ym-y != crit_y) + { + _wg_x_line (xm-x, xm+x, crit_y=ym-y, col); + if (y) _wg_x_line (xm-x, xm+x, ym+y, col); + } + + x++; + if (e < 0) { y--; e+= dx; dx= y; } + dy= x; + e-= dy; + } + while (dy <= dx); +} diff --git a/lib/window/2/win_0205.c b/lib/window/2/win_0205.c new file mode 100644 index 0000000000000000000000000000000000000000..289c94c74bad387e8535986256c39097428bab94 --- /dev/null +++ b/lib/window/2/win_0205.c @@ -0,0 +1,26 @@ +/* + * FILE ~/usr/window/2/win_0205.c + * + * written: 1989 09 09 + * latest update: 1994-08-20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/window.h> + +/* ------------------------------------------------------------------------ */ +void _wg_x_line ( +int ax, +int bx, +int y, +int col) +{ + int x; + + for (x= ax; x <= bx; x++) + wg_wr_dot (x, y, col); +} diff --git a/lib/window/2/win_0206.c b/lib/window/2/win_0206.c new file mode 100644 index 0000000000000000000000000000000000000000..e9159189c7f1b1663474c81c74a02af89b0ddf7d --- /dev/null +++ b/lib/window/2/win_0206.c @@ -0,0 +1,26 @@ +/* + * FILE ~/usr/window/2/win_0206.c + * + * written: 1989 09 09 + * latest update: 1994-08-20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +#include <gg/window.h> + +/* ------------------------------------------------------------------------ */ +void _wg_y_line ( +int x, +int ay, +int by, +int col) +{ + int y; + + for (y= ay; y <= by; y++) + wg_wr_dot (x, y, col); +} diff --git a/lib/window/3/(dirinf).fm b/lib/window/3/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..1880973024e6218d1578d5da5df2294d18f00a11 --- /dev/null +++ b/lib/window/3/(dirinf).fm @@ -0,0 +1,8 @@ +# +# FILE ~/usr/window/3/(dirinf).fm +# +# written: 1994-08-20 +# latest update: 1994-08-20 +# +# ---------------------------------------------------------------------------- +win_0303.c void report_attribute_value (int attr, char *s) diff --git a/lib/window/3/make-dos b/lib/window/3/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..55b9f7c33648b09de6912177b5c2a44f2b323228 --- /dev/null +++ b/lib/window/3/make-dos @@ -0,0 +1,26 @@ +# +# FILE /usr/window/3/makefile +# +# 1989 08 16: aus WIN0.SAR �bernommen +# Revision +# + +asm=masm /Ml +cml=cl -Os -AL /Fo$* /c +cms=cl -Os -AS /Fo$* /c +obl=objdec -w -d -m0 -sl 2 WINDOW_TEXT $* + +xx : large.library + +large.library : obj\win_l301.obj obj\win_l302.obj obj\win_l303.obj + +obj\win_l301.obj : win_l301.asm + masm /Ml WIN_L301.ASM,obj\win_l301; + +obj\win_l302.obj : win_l302.asm + masm /Ml WIN_L302.ASM,obj\win_l302; + +obj\win_l303.obj : win_0303.c + $(cml) win_0303.c + $(obj) + diff --git a/lib/window/3/win_0303.c b/lib/window/3/win_0303.c new file mode 100644 index 0000000000000000000000000000000000000000..a0d4156dba1172b292368399154b6d3ff0bb6b2c --- /dev/null +++ b/lib/window/3/win_0303.c @@ -0,0 +1,48 @@ +/* + * FILE ~/usr/window/3/win_0303.c + * + * written: 1991 02 17 + * latest update: 1994-08-20 + * + */ + +#ifdef MSDOS +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +static char *W_COLOR_NAMES [8] = +{ + "bla", "blu", "gre", "cob", + "red", "man", "bro", "whi" +} ; + +/* ------------------------------------------------------------------------ */ +void report_attribute_value (int attr, char *s) +{ + char *cp; + + s [0] = 'F'; + s [1] = ':'; + s [2] = (attr & 0x08) ? 'H' : 'L'; + cp = W_COLOR_NAMES [attr & 0x07]; + s [3] = *cp++; + s [4] = *cp++; + s [5] = *cp; + s [6] = '/'; + s [7] = 'B'; + s [8] = ':'; + s [9] = 'L'; + cp = W_COLOR_NAMES [(attr>>4) & 0x07]; + s [10] = *cp++; + s [11] = *cp++; + s [12] = *cp; + s [13] = 0; + if (attr & 0x0080) + { + s [14] = '/'; + s [15] = 'B'; + s [16] = 'L'; + s [17] = 0; + } +} diff --git a/lib/window/3/win_l301.asm b/lib/window/3/win_l301.asm new file mode 100644 index 0000000000000000000000000000000000000000..3492c760f564e2ed07ac02d793268f2714a090ea --- /dev/null +++ b/lib/window/3/win_l301.asm @@ -0,0 +1,67 @@ +; +; FILE /usr/window/3/win_l301.asm +; +; 1989 08 16: aus WIN0.SAR �bernommen +; Revision +; +; +; Static Name Aliases +; + TITLE WIN_L301.ASM + NAME win_0301 + +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _mirror_byte + +_mirror_byte PROC FAR + push bp + mov bp,sp + +; p = 6 + + mov bx, word ptr [bp+6] + ror bl, 1 + rcl al, 1 + ror bl, 1 + rcl al, 1 + + ror bl, 1 + rcl al, 1 + ror bl, 1 + rcl al, 1 + + ror bl, 1 + rcl al, 1 + ror bl, 1 + rcl al, 1 + + ror bl, 1 + rcl al, 1 + ror bl, 1 + rcl al, 1 + mov ah, 0 + +$EX199: + mov sp,bp + pop bp + ret + +_mirror_byte ENDP +WINDOW_TEXT ENDS +END + +; ---------------------------------------------------------------------------- diff --git a/lib/window/3/win_l302.asm b/lib/window/3/win_l302.asm new file mode 100644 index 0000000000000000000000000000000000000000..f10d8b5621d7d8d72ca686c060d3ca34b66d1abe --- /dev/null +++ b/lib/window/3/win_l302.asm @@ -0,0 +1,86 @@ +; +; FILE /usr/window/3/win_l302.asm +; +; 1989 08 16: aus WIN0.SAR �bernommen +; Revision +; +; +; Static Name Aliases +; + TITLE WIN_L301.ASM + NAME win_0301 + +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _mirror_word + +_mirror_word PROC FAR + push bp + mov bp,sp + +; p = 6 + + mov bx, word ptr [bp+6] + ror bx, 1 + rcl ax, 1 + ror bx, 1 + rcl ax, 1 + + ror bx, 1 + rcl ax, 1 + ror bx, 1 + rcl ax, 1 + + ror bx, 1 + rcl ax, 1 + ror bx, 1 + rcl ax, 1 + + ror bx, 1 + rcl ax, 1 + ror bx, 1 + rcl ax, 1 + + ror bx, 1 + rcl ax, 1 + ror bx, 1 + rcl ax, 1 + + ror bx, 1 + rcl ax, 1 + ror bx, 1 + rcl ax, 1 + + ror bx, 1 + rcl ax, 1 + ror bx, 1 + rcl ax, 1 + + ror bx, 1 + rcl ax, 1 + ror bx, 1 + rcl ax, 1 + +$EX199: + mov sp,bp + pop bp + ret + +_mirror_word ENDP +WINDOW_TEXT ENDS +END + +; ---------------------------------------------------------------------------- diff --git a/lib/window/Makefile b/lib/window/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..296df6cd2900f6c7b9fab3d77176781c273411d6 --- /dev/null +++ b/lib/window/Makefile @@ -0,0 +1,9 @@ +# +# $Id: Makefile,v 1.3 2006/11/08 07:49:38 gonter Exp $ +# + +all: + (cd 1 && make) + +clean: + (cd 1 && make clean) diff --git a/lib/window/_relics_.zip b/lib/window/_relics_.zip new file mode 100644 index 0000000000000000000000000000000000000000..bba7b6f75d6ee86f9fae1e9be4c0227b077cf614 Binary files /dev/null and b/lib/window/_relics_.zip differ diff --git a/lib/window/bios/(dirinf).fm b/lib/window/bios/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..18c0c9748c5aa308d21373df0da34a655f2d5eba --- /dev/null +++ b/lib/window/bios/(dirinf).fm @@ -0,0 +1,38 @@ +# +# FILE ~/usr/window/bios/(dirinf).fm +# +# latest update: 1994-08-20 +# +(DIRINF).FM WINDOW System Library Funktionen; Model BIOS +Makefile <<< +win_0001.c void bios_init () +win_0004.c void bios_reset () +win_0008.c void bios_selpage (p) +win_0009.c void bios_cursoroff () +win_0010.c void bios_cursoron () +win_0011.c void bios_border (col) +win_0012.c void bios_setchar (p, x, y, a, c) +win_0013.c void bios_setnchar (p, x, y, a, c, n) +win_0014.c int bios_getchar (p, x, y) +win_0015.c void bios_setscreen (att) +win_0016.c void bios_cls () +win_0018.c void bios_setarea (p, ax, ay, bx, by, att) +win_0019.c bios_scrollup (w, cnt) +win_0020.c bios_scrolldown (w, cnt) +win_0021.c bios_scrblk_up (ax, ay, bx, by, attr, cnt) +win_0022.c bios_scrblk_down (ax, ay, bx, by, attr, cnt) +win_0023.c void bios_setcup (p, x, y) +win_0024.c int bios_wr_dot (x, y, col) +win_0025.c int bios_rd_dot(x,y) /* liest Punkt auf (x,y) mit Farbe col */ +win_0027.c int bios_set_mode (mode) /* setzt Bildschirm Mode auf mode */ +win_0028.c void bios_set_col (what, col) /* setzt Hintergrundfarbe resp. */ +win_0029.c int bios_blit_save (puffer, page, ax, ay, bx, by) +win_0030.c int bios_blit_load (puffer, page, ax, ay, bx, by) +win_0042.c bios_getcup (int p, int *x, int *y); +win_0050.c void bios_cursorsize (int lower, int upper) +win_L012.asm PUBLIC _bios_setchar +win_L013.asm PUBLIC _bios_setnchar +win_L014.asm PUBLIC _bios_getchar +win_L024.asm PUBLIC _bios_wr_dot +win_L025.asm PUBLIC _bios_rd_dot +win_l042.asm PUBLIC _bios_get_cup diff --git a/lib/window/bios/make-dos b/lib/window/bios/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..b9d824c105a332b20dce1aaf0063cb3b245ea384 --- /dev/null +++ b/lib/window/bios/make-dos @@ -0,0 +1,199 @@ +# +# FILE /usr/window/bios/MAKEFILE +# +# 1989 08 16: aus WIN0.SAR �bernommen +# Revision +# + +asm=masm /Ml +cml=cl -Os -AL /Fo$* /c +cms=cl -Os -AS /Fo$* /c +obl=objdec -w -d -m0 -sl 2 WINDOW_TEXT + +window : large.window small.window + +large.window : obj\biosl004.obj obj\biosl008.obj ! + obj\biosl009.obj obj\biosl010.obj obj\biosl011.obj obj\biosl012.obj ! + obj\biosl013.obj obj\biosl014.obj obj\biosl015.obj obj\biosl016.obj ! + obj\biosl018.obj obj\biosl019.obj obj\biosl020.obj ! + obj\biosl021.obj obj\biosl022.obj obj\biosl023.obj obj\biosl024.obj ! + obj\biosl025.obj obj\biosl027.obj obj\biosl028.obj ! + obj\biosl029.obj obj\biosl030.obj obj\biosl042.obj ! + obj\biosl050.obj +# llink -n0 -v -lC:\usr\sbr\lsbr.lib -dbiosl.mod + +small.window : obj\bioss004.obj obj\bioss008.obj ! + obj\bioss009.obj obj\bioss010.obj obj\bioss011.obj obj\bioss012.obj ! + obj\bioss013.obj obj\bioss014.obj obj\bioss015.obj obj\bioss016.obj ! + obj\bioss018.obj obj\bioss019.obj obj\bioss020.obj ! + obj\bioss021.obj obj\bioss022.obj obj\bioss023.obj obj\bioss024.obj ! + obj\bioss025.obj obj\bioss027.obj obj\bioss028.obj ! + obj\bioss029.obj obj\bioss030.obj obj\bioss042.obj ! + obj\bioss050.obj +# llink -n0 -v -lC:\usr\sbr\ssbr.lib -dbioss.mod + + +# LARGE Modell --------------------------------------------------------------- +obj\biosl004.obj : win_0004.c + $(cml) win_0004.c + $(obl) obj\biosl004.obj + +obj\biosl008.obj : win_0008.c + $(cml) win_0008.c + $(obl) obj\biosl008.obj + +obj\biosl009.obj : win_0009.c + $(cml) win_0009.c + $(obl) obj\biosl009.obj + +obj\biosl010.obj : win_0010.c + $(cml) win_0010.c + $(obl) obj\biosl010.obj + +obj\biosl011.obj : win_0011.c + $(cml) win_0011.c + $(obl) obj\biosl011.obj + +obj\biosl012.obj : win_l012.asm + $(asm) WIN_L012.ASM,obj\biosl012.obj; + +obj\biosl013.obj : win_l013.asm + $(asm) WIN_L013.ASM,obj\biosl013.obj; + +obj\biosl014.obj : win_l014.asm + $(asm) WIN_L014.ASM,obj\biosl014.obj; + +obj\biosl015.obj : win_0015.c + $(cml) win_0015.c + $(obl) obj\biosl015.obj + +obj\biosl016.obj : win_0016.c + $(cml) win_0016.c + $(obl) obj\biosl016.obj + +obj\biosl018.obj : win_0018.c + $(cml) win_0018.c + $(obl) obj\biosl018.obj + +obj\biosl019.obj : win_0019.c + $(cml) win_0019.c + $(obl) obj\biosl019.obj + +obj\biosl020.obj : win_0020.c + $(cml) win_0020.c + $(obl) obj\biosl020.obj + +obj\biosl021.obj : win_l021.asm + $(asm) WIN_L021.ASM,obj\biosl021.obj; + +obj\biosl022.obj : win_l022.asm + $(asm) WIN_L022.ASM,obj\biosl022.obj; + +obj\biosl023.obj : win_0023.c + $(cml) win_0023.c + $(obl) obj\biosl023.obj + +obj\biosl024.obj : win_l024.asm + $(asm) WIN_L024.ASM,obj\biosl024.obj; + +obj\biosl025.obj : win_l025.asm + $(asm) WIN_L025.ASM,obj\biosl025.obj; + +# obj\biosl027.obj : win_0027.c +# $(cml) win_0027.c +# $(obl) obj\biosl027.obj + +obj\biosl027.obj : win_l027.asm + $(asm) WIN_L027.ASM,obj\biosl027.obj; + +obj\biosl028.obj : win_0028.c + $(cml) win_0028.c + $(obl) obj\biosl028.obj + +obj\biosl029.obj : win_0029.c + $(cml) win_0029.c + $(obl) obj\biosl029.obj + +obj\biosl030.obj : win_0030.c + $(cml) win_0030.c + $(obl) obj\biosl030.obj + +obj\biosl042.obj : win_l042.asm + $(asm) WIN_L042.ASM,obj\biosl042.obj; + +obj\biosl050.obj : win_0050.c + $(cml) win_0050.c + $(obl) obj\biosl050.obj + +# SMALL Modell --------------------------------------------------------------- +obj\bioss004.obj : win_0004.c + $(cms) win_0004.c + +obj\bioss008.obj : win_0008.c + $(cms) win_0008.c + +obj\bioss009.obj : win_0009.c + $(cms) win_0009.c + +obj\bioss010.obj : win_0010.c + $(cms) win_0010.c + +obj\bioss011.obj : win_0011.c + $(cms) win_0011.c + +obj\bioss012.obj : win_0012.c + $(cms) win_0012.c + +obj\bioss013.obj : win_0013.c + $(cms) win_0013.c + +obj\bioss014.obj : win_0014.c + $(cms) win_0014.c + +obj\bioss015.obj : win_0015.c + $(cms) win_0015.c + +obj\bioss016.obj : win_0016.c + $(cms) win_0016.c + +obj\bioss018.obj : win_0018.c + $(cms) win_0018.c + +obj\bioss019.obj : win_0019.c + $(cms) win_0019.c + +obj\bioss020.obj : win_0020.c + $(cms) win_0020.c + +obj\bioss021.obj : win_0021.c + $(cms) win_0021.c + +obj\bioss022.obj : win_0022.c + $(cms) win_0022.c + +obj\bioss023.obj : win_0023.c + $(cms) win_0023.c + +obj\bioss024.obj : win_0024.c + $(cms) win_0024.c + +obj\bioss025.obj : win_0025.c + $(cms) win_0025.c + +obj\bioss027.obj : win_0027.c + $(cms) win_0027.c + +obj\bioss028.obj : win_0028.c + $(cms) win_0028.c + +obj\bioss029.obj : win_0029.c + $(cms) win_0029.c + +obj\bioss030.obj : win_0030.c + $(cms) win_0030.c + +obj\bioss042.obj : win_0042.c + $(cms) win_0042.c + +obj\bioss050.obj : win_0050.c + $(cms) win_0050.c diff --git a/lib/window/bios/ned.stp b/lib/window/bios/ned.stp new file mode 100644 index 0000000000000000000000000000000000000000..d73f6640c0a9ed6149126d1d6879ab42254d213e --- /dev/null +++ b/lib/window/bios/ned.stp @@ -0,0 +1,3 @@ +@macro +1 ^qd^qa# ^m#^mgn^m^qd^qa"dos.h"^m<dos.h>^mgn^m +@end diff --git a/lib/window/bios/win_0004.c b/lib/window/bios/win_0004.c new file mode 100644 index 0000000000000000000000000000000000000000..cad03ed5b4d13dda13fc29492d55ccd9fa9d25b3 --- /dev/null +++ b/lib/window/bios/win_0004.c @@ -0,0 +1,17 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0004.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +# pragma check_stack(off) + +void bios_reset () +{ + bios_init_mode ("80x25 COL Text", -1); + bios_cursoron (); +} + +/* ------------------------------------------------------------------------ */ diff --git a/lib/window/bios/win_0008.c b/lib/window/bios/win_0008.c new file mode 100644 index 0000000000000000000000000000000000000000..d4315bd40131e22c4eeb2e12bd8faa534e3c5f55 --- /dev/null +++ b/lib/window/bios/win_0008.c @@ -0,0 +1,31 @@ +/* + * FILE /usr/window/bios/win_0008.c + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#include <gg/window.h> +#pragma check_stack(off) + +extern struct W_SCREEN_AND_MODES w_screen_and_modes; + +extern int W_AKT_MODE; + +/* ------------------------------------------------------------------------ */ +void bios_selpage (p) +int p; +{ union REGS rega; + union REGS regb; + + if (p < 0 || + p >= w_screen_and_modes.w_mode_capabilities [W_AKT_MODE].w_text_pages) + return; + + rega.h.ah = 5; + rega.h.al = p; + int86 (0x10, ®a, ®b); +} + diff --git a/lib/window/bios/win_0009.c b/lib/window/bios/win_0009.c new file mode 100644 index 0000000000000000000000000000000000000000..aa40b0292bf84047c2de74de66a874aa387ac38a --- /dev/null +++ b/lib/window/bios/win_0009.c @@ -0,0 +1,22 @@ +/* + * FILE ~/usr/window/bios/win_0009.c + * + * written: 1989 08 16: aus WIN0.SAR �bernommen + * latest update: 1994-05-09 + * + */ + +#include <dos.h> +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void bios_cursoroff () +{ + union REGS rega; + union REGS regb; + + rega.h.ah = 1; + rega.h.ch = 0x38; + rega.h.cl = 0x08; + int86 (0x10, ®a, ®b); +} diff --git a/lib/window/bios/win_0010.c b/lib/window/bios/win_0010.c new file mode 100644 index 0000000000000000000000000000000000000000..1d1a515188e9efa28ad77d8812eeb2641b46a251 --- /dev/null +++ b/lib/window/bios/win_0010.c @@ -0,0 +1,22 @@ +/* + * FILE ~/usr/window/bios/win_0010.c + * + * written: 1989 08 16: aus WIN0.SAR �bernommen; Revision + * latest update: 1994-05-10 + * + */ + +#include <dos.h> +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void bios_cursoron () +{ + union REGS rega; + union REGS regb; + + rega.h.ah = 1; + rega.h.ch = 0x06; + rega.h.cl = 0x07; + int86 (0x10, ®a, ®b); +} diff --git a/lib/window/bios/win_0011.c b/lib/window/bios/win_0011.c new file mode 100644 index 0000000000000000000000000000000000000000..8a4edf87f17845f422a55d8108c91e6352bb7637 --- /dev/null +++ b/lib/window/bios/win_0011.c @@ -0,0 +1,24 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0011.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +void bios_border (col) +int col; +{ + union REGS rega; + union REGS regb; + + rega.h.ah = 11; + rega.h.bh = 0; /* Colour Palette 0 */ + rega.h.bl = col; + int86 (0x10, ®a, ®b); +} + +/* ------------------------------------------------------------------------ */ diff --git a/lib/window/bios/win_0012.c b/lib/window/bios/win_0012.c new file mode 100644 index 0000000000000000000000000000000000000000..04748dcaeeeeccfe77e1e00fc43ef54ff62d36ea --- /dev/null +++ b/lib/window/bios/win_0012.c @@ -0,0 +1,37 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0012.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +extern int W_TEXT_MAX_X, + W_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +void bios_setchar (p, x, y, a, c) +int p, x, y, a, c; +{ + union REGS rega; + union REGS regb; + + if (x < 0 || x >= W_TEXT_MAX_X || + y < 0 || y >= W_TEXT_MAX_Y) return; + + rega.h.ah = 2; + rega.h.bh = p; + rega.h.dl = x; + rega.h.dh = y; + int86 (0x10, ®a, ®b); + + rega.h.ah = 9; + rega.h.bh = p; + rega.x.cx = 1; + rega.h.al = c; + rega.h.bl = a; + int86 (0x10, ®a, ®b); +} diff --git a/lib/window/bios/win_0013.c b/lib/window/bios/win_0013.c new file mode 100644 index 0000000000000000000000000000000000000000..b90900a82a38f0123c3ae90262635df2c5f391ef --- /dev/null +++ b/lib/window/bios/win_0013.c @@ -0,0 +1,39 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0013.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +extern int W_TEXT_MAX_X, + W_TEXT_MAX_Y; + +void bios_setnchar (p, x, y, a, c, n) +int p, x, y, a, c, n; +{ + union REGS rega; + union REGS regb; + + if (x < 0 || x >= W_TEXT_MAX_X || + y < 0 || y >= W_TEXT_MAX_Y || n <= 0) return; + if ((x+n) > W_TEXT_MAX_X) n = W_TEXT_MAX_X-x; + + rega.h.ah = 2; + rega.h.bh = p; + rega.h.dl = x; + rega.h.dh = y; + int86 (0x10, ®a, ®b); + + rega.h.ah = 9; + rega.h.bh = p; + rega.x.cx = n; /* Wiederholfaktor */ + rega.h.al = c; + rega.h.bl = a; + int86 (0x10, ®a, ®b); +} + +/* ------------------------------------------------------------------------ */ diff --git a/lib/window/bios/win_0014.c b/lib/window/bios/win_0014.c new file mode 100644 index 0000000000000000000000000000000000000000..49c7e1f40b15f836377f2924b79bdf36b93ba8a7 --- /dev/null +++ b/lib/window/bios/win_0014.c @@ -0,0 +1,30 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0014.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +int bios_getchar (p, x, y) +int p, x, y; +{ + union REGS rega; + union REGS regb; + + rega.h.ah = 2; + rega.h.bh = p; + rega.h.dl = x; + rega.h.dh = y; + int86 (0x10, ®a, ®b); + + rega.h.ah = 8; + rega.h.bh = p; + int86 (0x10, ®a, ®b); + return regb.x.ax; +} + +/* ------------------------------------------------------------------------ */ diff --git a/lib/window/bios/win_0015.c b/lib/window/bios/win_0015.c new file mode 100644 index 0000000000000000000000000000000000000000..52df6c8cef32e5b14d929924ed1038779d15bd38 --- /dev/null +++ b/lib/window/bios/win_0015.c @@ -0,0 +1,29 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0015.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +extern int W_TEXT_MAX_X, + W_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +void bios_setscreen (att) +int att; +{ + union REGS rega; + union REGS regb; + + rega.h.ah = 6; + rega.h.al = 0; + rega.h.ch = rega.h.cl = 0; + rega.h.dh = W_TEXT_MAX_Y-1; + rega.h.dl = W_TEXT_MAX_X-1; + rega.h.bh = att; + int86 (0x10, ®a, ®b); +} diff --git a/lib/window/bios/win_0016.c b/lib/window/bios/win_0016.c new file mode 100644 index 0000000000000000000000000000000000000000..fbf1941887d49f0ecdb199fd14609da79c81184d --- /dev/null +++ b/lib/window/bios/win_0016.c @@ -0,0 +1,30 @@ +/* + * FILE %win/bios/win_0016.c + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * latest update: 1997-05-30 17:58:13 + * + */ + +#include <gg/window.h> +#include <dos.h> +#pragma check_stack(off) + +extern int W_TEXT_MAX_X, + W_TEXT_MAX_Y; + +void bios_cls () +/* screen attribute auf att setzen */ +{ + union REGS rega; + union REGS regb; + + rega.h.ah = 6; + rega.h.al = 0; + rega.h.ch = rega.h.cl = 0; + rega.h.dh = W_TEXT_MAX_Y-1; + rega.h.dl = W_TEXT_MAX_X-1; + rega.h.bh = WV_BRAUN | WH_SCHWARZ | W_HELL; + int86 (0x10, ®a, ®b); +} diff --git a/lib/window/bios/win_0018.c b/lib/window/bios/win_0018.c new file mode 100644 index 0000000000000000000000000000000000000000..a957933774d46dfa3cbb65c408a6ac830f654b87 --- /dev/null +++ b/lib/window/bios/win_0018.c @@ -0,0 +1,39 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0018.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +extern int W_TEXT_MAX_X, + W_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +void bios_setarea (p, ax, ay, bx, by, att) +int p, ax, ay, bx, by, att; +/* screen attribute auf page p im Bereich von [ax/ay, bx/by] */ +/* auf att setzen */ +{ + union REGS rega; + union REGS regb; + + if (bx < 0 || ax >= W_TEXT_MAX_X || + by < 0 || ay >= W_TEXT_MAX_Y) return; + + if (ax < 0) ax= 0; + if (ay < 0) ay= 0; + if (bx >= W_TEXT_MAX_X) bx=W_TEXT_MAX_X-1; + if (by >= W_TEXT_MAX_Y) by=W_TEXT_MAX_Y-1; + + rega.h.ah = 6; + rega.h.al = 0; + rega.h.ch = ay; rega.h.cl = ax; + rega.h.dh = by; + rega.h.dl = bx; + rega.h.bh = att; + int86 (0x10, ®a, ®b); +} diff --git a/lib/window/bios/win_0019.c b/lib/window/bios/win_0019.c new file mode 100644 index 0000000000000000000000000000000000000000..da8b9fd63ce590ad3a84dacc3268fcf53d0d8875 --- /dev/null +++ b/lib/window/bios/win_0019.c @@ -0,0 +1,35 @@ +/* + * FILE /usr/window/bios/win_0019.c + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#include <gg/window.h> +#pragma check_stack(off) + +extern int W_TEXT_MAX_X, + W_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +bios_scrollup (w, cnt) +register struct WINDOW *w; +int cnt; +{ + union REGS rega; + union REGS regb; + + rega.h.ah = 6; + rega.h.al = cnt; /* clear window */ + rega.h.ch = w->ay+1; + rega.h.cl = w->ax+1; + rega.h.dh = w->by-1; + rega.h.dl = w->bx-1; + rega.h.bh = w->attr; + int86 (0x10, ®a, ®b); + (w->cy) -= cnt; /* passt cy an */ + return 0; +} + diff --git a/lib/window/bios/win_0020.c b/lib/window/bios/win_0020.c new file mode 100644 index 0000000000000000000000000000000000000000..3ec3b35766c89d881540e7c3a1ea91300644b76e --- /dev/null +++ b/lib/window/bios/win_0020.c @@ -0,0 +1,34 @@ +/* + * FILE /usr/window/bios/win_0020.c + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#include <gg/window.h> +#pragma check_stack(off) + +extern int W_TEXT_MAX_X, + W_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +bios_scrolldown (w, cnt) +register struct WINDOW *w; +int cnt; +{ + union REGS rega; + union REGS regb; + + rega.h.ah = 7; + rega.h.al = cnt; /* clear window */ + rega.h.ch = w->ay+1; + rega.h.cl = w->ax+1; + rega.h.dh = w->by-1; + rega.h.dl = w->bx-1; + rega.h.bh = w->attr; + int86 (0x10, ®a, ®b); + /* passt cy NICHT an !! */ + return 0; +} diff --git a/lib/window/bios/win_0021.c b/lib/window/bios/win_0021.c new file mode 100644 index 0000000000000000000000000000000000000000..e32df1993ee5902bd3d2433b5cf48c047b044577 --- /dev/null +++ b/lib/window/bios/win_0021.c @@ -0,0 +1,38 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0021.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +extern int W_TEXT_MAX_X, + W_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +bios_scrblk_up (ax, ay, bx, by, attr, cnt) +int ax, ay, bx, by, attr, cnt; +{ union REGS rega; + union REGS regb; + + if (bx < 0 || ax >= W_TEXT_MAX_X || + by < 0 || ay >= W_TEXT_MAX_Y) return; + + if (ax < 0) ax= 0; + if (ay < 0) ay= 0; + if (bx >= W_TEXT_MAX_X) bx=W_TEXT_MAX_X-1; + if (by >= W_TEXT_MAX_Y) by=W_TEXT_MAX_Y-1; + + rega.h.ah = 6; + rega.h.al = cnt; /* clear window */ + rega.h.ch = ay; + rega.h.cl = ax; + rega.h.dh = by; + rega.h.dl = bx; + rega.h.bh = attr; + int86 (0x10, ®a, ®b); + return 0; +} diff --git a/lib/window/bios/win_0022.c b/lib/window/bios/win_0022.c new file mode 100644 index 0000000000000000000000000000000000000000..2b48f938a5d88775df6242a9f4313a9eeee92fc6 --- /dev/null +++ b/lib/window/bios/win_0022.c @@ -0,0 +1,39 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0022.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +extern int W_TEXT_MAX_X, + W_TEXT_MAX_Y; + +/* ------------------------------------------------------------------------ */ +bios_scrblk_down (ax, ay, bx, by, attr, cnt) +int ax, ay, bx, by, attr, cnt; +{ + union REGS rega; + union REGS regb; + + if (bx < 0 || ax >= W_TEXT_MAX_X || + by < 0 || ay >= W_TEXT_MAX_Y) return; + + if (ax < 0) ax= 0; + if (ay < 0) ay= 0; + if (bx >= W_TEXT_MAX_X) bx=W_TEXT_MAX_X-1; + if (by >= W_TEXT_MAX_Y) by=W_TEXT_MAX_Y-1; + + rega.h.ah = 7; + rega.h.al = cnt; /* clear window */ + rega.h.ch = ay; + rega.h.cl = ax; + rega.h.dh = by; + rega.h.dl = bx; + rega.h.bh = attr; + int86 (0x10, ®a, ®b); + return 0; +} diff --git a/lib/window/bios/win_0023.c b/lib/window/bios/win_0023.c new file mode 100644 index 0000000000000000000000000000000000000000..d88d186ce4f50b04aee201599c2ad4449be201b0 --- /dev/null +++ b/lib/window/bios/win_0023.c @@ -0,0 +1,25 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0023.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +void bios_setcup (p, x, y) +int p, x, y; +{ + union REGS rega; + union REGS regb; + + rega.h.ah = 2; + rega.h.bh = p; + rega.h.dl = x; + rega.h.dh = y; + int86 (0x10, ®a, ®b); +} + +/* ------------------------------------------------------------------------ */ diff --git a/lib/window/bios/win_0024.c b/lib/window/bios/win_0024.c new file mode 100644 index 0000000000000000000000000000000000000000..ac2ad3ae9b6faf92b571541668cbaeed8dae836d --- /dev/null +++ b/lib/window/bios/win_0024.c @@ -0,0 +1,32 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0024.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +extern int W_GRAPH_MAX_X, + W_GRAPH_MAX_Y; + +int bios_wr_dot (x, y, col) +int x, y, col; +{ + union REGS rega; + union REGS regb; + + if (x < 0 || x >= W_GRAPH_MAX_X || + y < 0 || y >= W_GRAPH_MAX_Y) return; + + rega.h.ah= 12; + rega.x.dx= y; + rega.x.cx= x; + rega.h.bh= 0; + rega.h.al= col; + int86 (0x10, ®a, ®b); +} + +/* ------------------------------------------------------------------------ */ diff --git a/lib/window/bios/win_0025.c b/lib/window/bios/win_0025.c new file mode 100644 index 0000000000000000000000000000000000000000..59dbdbf775044cf096aa7b9ff273a7323190bf04 --- /dev/null +++ b/lib/window/bios/win_0025.c @@ -0,0 +1,32 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0025.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +extern int W_GRAPH_MAX_X, + W_GRAPH_MAX_Y; + +int bios_rd_dot(x,y) /* liest Punkt auf (x,y) mit Farbe col */ +int x, y; +{ + union REGS rega; + union REGS regb; + + if (x < 0 || x >= W_GRAPH_MAX_X || + y < 0 || y >= W_GRAPH_MAX_Y) return; + + rega.h.ah= 13; + rega.x.dx= y; + rega.x.cx= x; + rega.h.bh= 0; + int86 (0x10, ®a, ®b); + return regb.h.al; +} + +/* ------------------------------------------------------------------------ */ diff --git a/lib/window/bios/win_0027.c b/lib/window/bios/win_0027.c new file mode 100644 index 0000000000000000000000000000000000000000..55d923d733f61b2a82c5b33dc1841ae68a10f5d6 --- /dev/null +++ b/lib/window/bios/win_0027.c @@ -0,0 +1,25 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0027.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#pragma check_stack(off) +#include <dos.h> + +/* ------------------------------------------------------------------------ */ +int bios_set_mode (int mode) /* setzt Bildschirm Mode auf mode */ +/* RETIRN: 0 -> Modus gesetzt; -1 -> Modus nicht gesetzt */ +{ + union REGS rega; + union REGS regb; + + if (mode < 0) return -1; + rega.h.ah = 0; + rega.h.al = mode; + int86 (0x10, ®a, ®b); + return 0; +} + diff --git a/lib/window/bios/win_0028.c b/lib/window/bios/win_0028.c new file mode 100644 index 0000000000000000000000000000000000000000..0397c23c9dcddf33747100bb319d98848da29574 --- /dev/null +++ b/lib/window/bios/win_0028.c @@ -0,0 +1,24 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0028.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +void bios_set_col (what, col) /* setzt Hintergrundfarbe resp. */ +int what, col; /* Farbpalette */ +{ + union REGS rega; + union REGS regb; + + rega.h.ah = 11; + rega.h.bh = what; + rega.h.bl = col; + int86 (0x10, ®a, ®b); +} + +/* ------------------------------------------------------------------------ */ diff --git a/lib/window/bios/win_0029.c b/lib/window/bios/win_0029.c new file mode 100644 index 0000000000000000000000000000000000000000..e80365a91cbe13238d59a9da36043060639032d3 --- /dev/null +++ b/lib/window/bios/win_0029.c @@ -0,0 +1,35 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0029.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +int bios_blit_save (puffer, page, ax, ay, bx, by) +register char *puffer; +int page, ax, ay, bx, by; +{ + union REGS rega1; + union REGS rega2, regb; + + rega1.h.ah = 2; + rega1.h.bh = page; + rega2.h.ah = 8; + rega2.h.bh = page; + + for (rega1.h.dl = ax; rega1.h.dl <= bx; rega1.h.dl++) + for (rega1.h.dh = ay; rega1.h.dh <= by; rega1.h.dh++) + { + int86 (0x10, ®a1, ®b); + int86 (0x10, ®a2, ®b); + *puffer++ = (regb.h.al) & 0x00FF; /* Character */ + *puffer++ = (regb.h.ah) & 0x00FF; /* Attribut */ + } + +} + +/* ------------------------------------------------------------------------ */ diff --git a/lib/window/bios/win_0030.c b/lib/window/bios/win_0030.c new file mode 100644 index 0000000000000000000000000000000000000000..3c45677df65073b799a3299b11885e4405668bff --- /dev/null +++ b/lib/window/bios/win_0030.c @@ -0,0 +1,34 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0030.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +int bios_blit_load (puffer, page, ax, ay, bx, by) +register char *puffer; +int page, ax, ay, bx, by; +{ + union REGS rega1; + union REGS rega2, regb; + + rega1.h.ah = 2; + rega1.h.bh = page; + rega2.h.ah = 9; + rega2.h.bh = page; + rega2.x.cx = 1; + + for (rega1.h.dl = ax; rega1.h.dl <= bx; rega1.h.dl++) + for (rega1.h.dh = ay; rega1.h.dh <= by; rega1.h.dh++) + { + rega2.h.al = *puffer++; /* Character */ + rega2.h.bl = *puffer++; /* Attribut */ + int86 (0x10, ®a1, ®b); + int86 (0x10, ®a2, ®b); + } + +} diff --git a/lib/window/bios/win_0042.c b/lib/window/bios/win_0042.c new file mode 100644 index 0000000000000000000000000000000000000000..f9e15e579000bbaa47943a98134c248127190710 --- /dev/null +++ b/lib/window/bios/win_0042.c @@ -0,0 +1,22 @@ +/* + * FILE C:\usr\window\win0bios.arc [WIN_0042.C] + * + * 1990 05 16 + * + */ + +#include <dos.h> +#pragma check_stack(off) + +void bios_getcup (int p, int *x, int *y) +{ + union REGS rega; + union REGS regb; + + rega.h.ah = 3; + rega.h.bh = p; + int86 (0x10, ®a, ®b); + *x = regb.h.dl; + *y = regb.h.dh; +} + diff --git a/lib/window/bios/win_0050.c b/lib/window/bios/win_0050.c new file mode 100644 index 0000000000000000000000000000000000000000..1b1fbcbd9dad18e6bd2cbe8a7a0a93620e6f2bdb --- /dev/null +++ b/lib/window/bios/win_0050.c @@ -0,0 +1,25 @@ +/* + * FILE ~/usr/window/bios/win_0050.c + * + * written: 1994-04-08: copied from win_0010.c + * latest update: 1994-05-09 + * + */ + +#include <dos.h> + +#ifdef MSDOS /* well... what else? */ +#pragma check_stack(off) +#endif + +/* ------------------------------------------------------------------------ */ +void bios_cursorsize (int lower, int upper) +{ + union REGS rega; + union REGS regb; + + rega.h.ah= 1; + rega.h.ch= lower; + rega.h.cl= upper; + int86 (0x10, ®a, ®b); +} diff --git a/lib/window/bios/win_l012.asm b/lib/window/bios/win_l012.asm new file mode 100644 index 0000000000000000000000000000000000000000..4fa8774a08e6deba50d6229cc1fb8202d7e3fe21 --- /dev/null +++ b/lib/window/bios/win_l012.asm @@ -0,0 +1,83 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L012.ASM] +; +; 1989 08 16: aus WIN0.SAR �bernommen +; Revision +; + +; Static Name Aliases +; + TITLE WIN_L012.ASM + NAME win_0012 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_TEXT_MAX_Y:WORD +EXTRN _W_TEXT_MAX_X:WORD + +CONST SEGMENT +$T20000 DW SEG _W_TEXT_MAX_X + ORG $+2 +$T20001 DW SEG _W_TEXT_MAX_Y +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _bios_setchar + +_bios_setchar PROC FAR + push bp + mov bp,sp + +; p = 6 +; x = 8 +; y = 10 +; a = 12 +; c = 14 + + cmp WORD PTR [bp+8],0 ;x + jl $EX199 + mov es,$T20000 + mov ax,WORD PTR [bp+8] ;x + cmp es:_W_TEXT_MAX_X,ax + jle $EX199 + cmp WORD PTR [bp+10],0 ;y + jl $EX199 + mov es,$T20001 + mov ax,WORD PTR [bp+10] ;y + cmp es:_W_TEXT_MAX_Y,ax + jle $EX199 + + mov ah, 2 + mov bh, BYTE PTR [bp+6] ;p + mov dl, BYTE PTR [bp+8] ;x + mov dh, BYTE PTR [bp+10] ;y + int 010h + + mov ah, 9 + mov al, BYTE PTR [bp+14] ;c + mov bh, BYTE PTR [bp+6] ;p + mov bl, BYTE PTR [bp+12] ;a + mov cx, 1 + int 010h + +$EX199: + mov sp,bp + pop bp + ret + +_bios_setchar ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/bios/win_l013.asm b/lib/window/bios/win_l013.asm new file mode 100644 index 0000000000000000000000000000000000000000..e36d1bc599422c4a4348c0da15afd4e4500152ad --- /dev/null +++ b/lib/window/bios/win_l013.asm @@ -0,0 +1,92 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L013.ASM] +; +; 1989 08 16: aus WIN0.SAR �bernommen +; Revision +; + +; Static Name Aliases +; + TITLE WIN_L013.c + NAME win_0012 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_TEXT_MAX_Y:WORD +EXTRN _W_TEXT_MAX_X:WORD + +CONST SEGMENT +$T20000 DW SEG _W_TEXT_MAX_X + ORG $+2 +$T20001 DW SEG _W_TEXT_MAX_Y +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _bios_setnchar + +_bios_setnchar PROC FAR + push bp + mov bp,sp + +; p = 6 +; x = 8 +; y = 10 +; a = 12 +; c = 14 +; n = 16 + + cmp WORD PTR [bp+16],0 ;n + jle $EX199 + cmp WORD PTR [bp+10],0 ;y + jl $EX199 + mov es,$T20001 + mov ax,WORD PTR [bp+10] ;y + cmp es:_W_TEXT_MAX_Y,ax + jle $EX199 + cmp WORD PTR [bp+8],0 ;x + jl $EX199 + mov es,$T20000 + mov ax,WORD PTR [bp+8] ;x + mov bx, es:_W_TEXT_MAX_X + cmp bx, ax + jle $EX199 + add ax,WORD PTR [bp+16] ;n; ax=x+n + cmp bx, ax + jge X1 + sub bx,WORD PTR [bp+8] ;x + mov WORD PTR [bp+16],bx ;n + +X1: mov ah, 2 + mov bh, BYTE PTR [bp+6] ;p + mov dl, BYTE PTR [bp+8] ;x + mov dh, BYTE PTR [bp+10] ;y + int 010h + + mov ah, 9 + mov al, BYTE PTR [bp+14] ;c + mov bh, BYTE PTR [bp+6] ;p + mov bl, BYTE PTR [bp+12] ;a + mov cx, WORD PTR [bp+16] ;n + int 010h + +$EX199: + mov sp,bp + pop bp + ret + +_bios_setnchar ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/bios/win_l014.asm b/lib/window/bios/win_l014.asm new file mode 100644 index 0000000000000000000000000000000000000000..66ba26924ea5a5823e94156ea578336730f28315 --- /dev/null +++ b/lib/window/bios/win_l014.asm @@ -0,0 +1,81 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L014.ASM] +; +; 1989 08 16: aus WIN0.SAR �bernommen +; Revision +; + + +; Static Name Aliases +; + TITLE WIN_L014.asm + NAME win_0014 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_TEXT_MAX_Y:WORD +EXTRN _W_TEXT_MAX_X:WORD + +CONST SEGMENT +$T20000 DW SEG _W_TEXT_MAX_X + ORG $+2 +$T20001 DW SEG _W_TEXT_MAX_Y +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _bios_getchar + +_bios_getchar PROC FAR + push bp + mov bp,sp + +; p = 6 +; x = 8 +; y = 10 +; a = 12 +; c = 14 + + cmp WORD PTR [bp+8],0 ;x + jl $EX199 + mov es,$T20000 + mov ax,WORD PTR [bp+8] ;x + cmp es:_W_TEXT_MAX_X,ax + jle $EX199 + cmp WORD PTR [bp+10],0 ;y + jl $EX199 + mov es,$T20001 + mov ax,WORD PTR [bp+10] ;y + cmp es:_W_TEXT_MAX_Y,ax + jle $EX199 + + mov ah, 2 + mov bh, BYTE PTR [bp+6] ;p + mov dl, BYTE PTR [bp+8] ;x + mov dh, BYTE PTR [bp+10] ;y + int 010h + + mov ah, 8 + mov bh, BYTE PTR [bp+6] ;p + int 010h + +$EX199: + mov sp,bp + pop bp + ret + +_bios_getchar ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/bios/win_l021.asm b/lib/window/bios/win_l021.asm new file mode 100644 index 0000000000000000000000000000000000000000..ed6ad8fb969269841133985e8a4ea59f39365b5a --- /dev/null +++ b/lib/window/bios/win_l021.asm @@ -0,0 +1,100 @@ +; Static Name Aliases +; + TITLE win_0021.c + NAME win_0021 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_TEXT_MAX_Y:WORD +EXTRN _W_TEXT_MAX_X:WORD + +CONST SEGMENT +$T20000 DW SEG _W_TEXT_MAX_X + ORG $+2 +$T20001 DW SEG _W_TEXT_MAX_Y +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _bios_scrblk_up +_bios_scrblk_up PROC FAR + push bp + mov bp,sp + +; ax = 6 +; ay = 8 +; bx = 10 +; by = 12 +; attr = 14 +; cnt = 16 + + cmp WORD PTR [bp+10],0 ;bx + jl $EX200 + mov es,$T20000 + mov ax,WORD PTR [bp+6] ;ax + cmp es:_W_TEXT_MAX_X,ax + jle $EX200 + cmp WORD PTR [bp+12],0 ;by + jl $EX200 + mov es,$T20001 + mov ax,WORD PTR [bp+8] ;ay + cmp es:_W_TEXT_MAX_Y,ax + jl $EX200 + + cmp WORD PTR [bp+6],0 ;ax + jge $I205 + mov WORD PTR [bp+6],0 ;ax + +$I205: + cmp WORD PTR [bp+8],0 ;ay + jge $I206 + mov WORD PTR [bp+8],0 ;ay + +$I206: + mov es,$T20000 + mov ax,WORD PTR [bp+10] ;bx + cmp es:_W_TEXT_MAX_X,ax + jg $I207 + mov ax,es:_W_TEXT_MAX_X + dec ax + mov WORD PTR [bp+10],ax ;bx + +$I207: + mov es,$T20001 + mov ax,WORD PTR [bp+12] ;by + cmp es:_W_TEXT_MAX_Y,ax + jg $I208 + mov ax,es:_W_TEXT_MAX_Y + dec ax + mov WORD PTR [bp+12],ax ;by + +$I208: + mov ah,6 + mov al,BYTE PTR [bp+16] ;cnt + mov ch,BYTE PTR [bp+8] ;ay + mov cl,BYTE PTR [bp+6] ;ax + mov dh,BYTE PTR [bp+12] ;by + mov dl,BYTE PTR [bp+10] ;bx + mov bh,BYTE PTR [bp+14] ;attr + + int 10h + +$EX200: + mov sp,bp + pop bp + ret + +_bios_scrblk_up ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/bios/win_l022.asm b/lib/window/bios/win_l022.asm new file mode 100644 index 0000000000000000000000000000000000000000..cbc1b6e836a9c1cc8510de15f2643127da2e58e4 --- /dev/null +++ b/lib/window/bios/win_l022.asm @@ -0,0 +1,100 @@ +; Static Name Aliases +; + TITLE win_0022.c + NAME win_0022 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_TEXT_MAX_Y:WORD +EXTRN _W_TEXT_MAX_X:WORD + +CONST SEGMENT +$T20000 DW SEG _W_TEXT_MAX_X + ORG $+2 +$T20001 DW SEG _W_TEXT_MAX_Y +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _bios_scrblk_down +_bios_scrblk_down PROC FAR + push bp + mov bp,sp + +; ax = 6 +; ay = 8 +; bx = 10 +; by = 12 +; attr = 14 +; cnt = 16 + + cmp WORD PTR [bp+10],0 ;bx + jl $EX200 + mov es,$T20000 + mov ax,WORD PTR [bp+6] ;ax + cmp es:_W_TEXT_MAX_X,ax + jle $EX200 + cmp WORD PTR [bp+12],0 ;by + jl $EX200 + mov es,$T20001 + mov ax,WORD PTR [bp+8] ;ay + cmp es:_W_TEXT_MAX_Y,ax + jl $EX200 + + cmp WORD PTR [bp+6],0 ;ax + jge $I205 + mov WORD PTR [bp+6],0 ;ax + +$I205: + cmp WORD PTR [bp+8],0 ;ay + jge $I206 + mov WORD PTR [bp+8],0 ;ay + +$I206: + mov es,$T20000 + mov ax,WORD PTR [bp+10] ;bx + cmp es:_W_TEXT_MAX_X,ax + jg $I207 + mov ax,es:_W_TEXT_MAX_X + dec ax + mov WORD PTR [bp+10],ax ;bx + +$I207: + mov es,$T20001 + mov ax,WORD PTR [bp+12] ;by + cmp es:_W_TEXT_MAX_Y,ax + jg $I208 + mov ax,es:_W_TEXT_MAX_Y + dec ax + mov WORD PTR [bp+12],ax ;by + +$I208: + mov ah,7 + mov al,BYTE PTR [bp+16] ;cnt + mov ch,BYTE PTR [bp+8] ;ay + mov cl,BYTE PTR [bp+6] ;ax + mov dh,BYTE PTR [bp+12] ;by + mov dl,BYTE PTR [bp+10] ;bx + mov bh,BYTE PTR [bp+14] ;attr + + int 10h + +$EX200: + mov sp,bp + pop bp + ret + +_bios_scrblk_down ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/bios/win_l024.asm b/lib/window/bios/win_l024.asm new file mode 100644 index 0000000000000000000000000000000000000000..a5e11397f32da2a2cbcc9e91db29bd8f95667fbd --- /dev/null +++ b/lib/window/bios/win_l024.asm @@ -0,0 +1,76 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L024.ASM] +; +; 1989 08 16: aus WIN0.SAR �bernommen +; Revision +; + +; Static Name Aliases +; + TITLE WIN_L024.c + NAME win_0024 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_GRAPH_MAX_Y:WORD +EXTRN _W_GRAPH_MAX_X:WORD + +CONST SEGMENT +$T20000 DW SEG _W_GRAPH_MAX_X + ORG $+2 +$T20001 DW SEG _W_GRAPH_MAX_Y +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _bios_wr_dot + +_bios_wr_dot PROC FAR + push bp + mov bp,sp + +; x = 6 +; y = 8 +; col = 10 + + cmp WORD PTR [bp+6],0 ;x + jl $EX199 + mov es,$T20000 + mov ax,WORD PTR [bp+6] ;x + cmp es:_W_GRAPH_MAX_X,ax + jle $EX199 + cmp WORD PTR [bp+8],0 ;y + jl $EX199 + mov es,$T20001 + mov ax,WORD PTR [bp+8] ;y + cmp es:_W_GRAPH_MAX_Y,ax + jle $EX199 + + mov ah, 12 + mov al, BYTE PTR [bp+10] ;col + mov bx, 0 + mov cx, WORD PTR [bp+6] ;x + mov dx, WORD PTR [bp+8] ;y + int 010h + +$EX199: + mov sp,bp + pop bp + ret + nop + +_bios_wr_dot ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/bios/win_l025.asm b/lib/window/bios/win_l025.asm new file mode 100644 index 0000000000000000000000000000000000000000..4a0aa128c1de9b1ed875dcd13d4a58f086502892 --- /dev/null +++ b/lib/window/bios/win_l025.asm @@ -0,0 +1,76 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L025.ASM] +; +; 1989 08 16: aus WIN0.SAR �bernommen +; Revision +; +; + +; Static Name Aliases +; + TITLE WIN_L025.c + NAME win_0025 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_GRAPH_MAX_Y:WORD +EXTRN _W_GRAPH_MAX_X:WORD + +CONST SEGMENT +$T20000 DW SEG _W_GRAPH_MAX_X + ORG $+2 +$T20001 DW SEG _W_GRAPH_MAX_Y +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _bios_rd_dot + +_bios_rd_dot PROC FAR + push bp + mov bp,sp + +; x = 6 +; y = 8 + + cmp WORD PTR [bp+6],0 ;x + jl $EX199 + mov es,$T20000 + mov ax,WORD PTR [bp+6] ;x + cmp es:_W_GRAPH_MAX_X,ax + jle $EX199 + cmp WORD PTR [bp+8],0 ;y + jl $EX199 + mov es,$T20001 + mov ax,WORD PTR [bp+8] ;y + cmp es:_W_GRAPH_MAX_Y,ax + jle $EX199 + + mov ah, 13 + mov bx, 0 + mov cx, WORD PTR [bp+6] ;x + mov dx, WORD PTR [bp+8] ;y + int 010h + mov ah, 0 + +$EX199: + mov sp,bp + pop bp + ret + nop + +_bios_rd_dot ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/bios/win_l027.asm b/lib/window/bios/win_l027.asm new file mode 100644 index 0000000000000000000000000000000000000000..52acae3cd8ccffa430a20653b56cb9eb1cc3b0df --- /dev/null +++ b/lib/window/bios/win_l027.asm @@ -0,0 +1,45 @@ +; +; FILE C:/usr/window/bios/win_l027.asm +; +; void bios_set_mode (int mode) +; RETURN: Zahl der Spalten am Bildschirm +; +; 1989 08 20 +; + TITLE WIN_L027.asm + NAME win_l027 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _bios_set_mode + +_bios_set_mode proc far + push bp + mov bp, sp + + mov ax, word ptr [bp+6] + mov ah, 0 + int 10h + + mov sp, bp + pop bp + ret + +_bios_set_mode endp + +WINDOW_TEXT ENDS +END diff --git a/lib/window/bios/win_l042.asm b/lib/window/bios/win_l042.asm new file mode 100644 index 0000000000000000000000000000000000000000..495ac9217ed6d67ae8c2356d5d581c83430454e5 --- /dev/null +++ b/lib/window/bios/win_l042.asm @@ -0,0 +1,51 @@ +; Static Name Aliases +; + TITLE win_l042.asm + NAME win_0042 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _bios_getcup +_bios_getcup PROC FAR + push bp + mov bp,sp + +; x = 8 +; y = 12 +; p = 6 + + mov BYTE PTR [bp-27],3 + mov bh,BYTE PTR [bp+6] ;p + mov ah,3 + int 010h + + les bx,DWORD PTR [bp+8] ;x + mov al, dl + sub ah, ah + mov WORD PTR es:[bx],ax + les bx,DWORD PTR [bp+12] ;y + mov al, dh + mov WORD PTR es:[bx],ax + + mov sp,bp + pop bp + ret + nop + +_bios_getcup ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/cga/(dirinf).fm b/lib/window/cga/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..233d7b33012b3bcbd4fcec9890d716cebe804a19 --- /dev/null +++ b/lib/window/cga/(dirinf).fm @@ -0,0 +1,38 @@ +# +# FILE ~/usr/window/cga/(dirinf).fm +# +# latest update: 1994-08-20 +# +(DIRINF).FM WINDOW System Library Funktionen; Model CGA (direkt) +Makefile <<< +# ---------------------------------------------------------------------------- +WIN_0001.C void cga_init () +WIN_0004.C void cga_reset () +WIN_0008.C void cga_selpage (p) +WIN_0012.C void cga_setchar (p, x, y, a, c) +WIN_L012.ASM void cga_setchar (int page, int x, int y, int attr, int ch); +WIN_0013.C void cga_setnchar (p, x, y, a, c, n) +WIN_L013.ASM void cga_setnchar (int page, int x, int y, int attr, ch, count); +WIN_0014.C int cga_getchar (p, x, y) +WIN_L014.ASM int cga_getchar (int page, int x, int y); +WIN_0029.C int cga_blit_save (puffer, page, ax, ay, bx, by) +WIN_0030.C int cga_blit_load (puffer, page, ax, ay, bx, by) +WIN_L031.ASM int _cga_get_mode (void); +WIN_S031.ASM int _cga_get_mode (void); +WIN_L032.ASM int cga_get_cols (void); +WIN_S032.ASM int cga_get_cols (void); +WIN_L033.ASM int cga_getpage (void); +WIN_S033.ASM int cga_getpage (void); +WIN_0034.C int cga_scrblk_left (page, ax, ay, bx, by, attr, cnt); +WIN_L034.ASM int cga_scrblk_left (page, ax, ay, bx, by, attr, cnt); +WIN_0035.C int cga_scrblk_right (page, ax, ay, bx, by, attr, cnt); +WIN_L035.ASM int cga_scrblk_right (page, ax, ay, bx, by, attr, cnt); +WIN_L036.asm int vga_setpalette (palette, red, green, blue); +win_l037.asm int vga_setpalette_block (start, count, block); +WIN_L038.asm int vga_getpalette (int palette, int *red, int *green, int *blue); +win_l039.asm int vga_getpalette_block (start, count, block); +win_l040.asm int vga_palette_block_grey (start, count); +win_0041.c void cga_cls_col (int col); +win_?043.asm void cga_get_screen_max (void); +win_0044.c void cga_blit_line (int page, int ax, int ay, int cnt, char *line) +win_0045.c void vga_set_screen_mode (int mode) diff --git a/lib/window/cga/make-dos b/lib/window/cga/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..1b8cfd2c9a32ffe6c53cb31a2bca62e6adeeff69 --- /dev/null +++ b/lib/window/cga/make-dos @@ -0,0 +1,282 @@ +# +# FILE ~/usr/window/cga/MAKEFILE +# +# written: 1989 08 16: aus WIN0.SAR �bernommen; Revisison +# latest update: 1994-09-01 +# + +asm=masm /Ml +cml=cl -Os -AL /Fo$* /c +cms=cl -Os -AS /Fo$* /c +obl=objdec -w -d -m0 -sl 2 WINDOW_TEXT + +all : large.window small.window + +large.window : obj\cga_l001.obj obj\biosl001.obj ! + obj\cga_l004.obj obj\cga_l008.obj ! + obj\cga_l012.obj obj\cga_l013.obj obj\cga_l014.obj ! + obj\cga_l029.obj obj\cga_l030.obj obj\cga_l031.obj ! + obj\cga_l032.obj obj\cga_l033.obj obj\cga_l034.obj ! + obj\cga_l035.obj obj\cga_l036.obj obj\cga_l037.obj ! + obj\cga_l038.obj obj\cga_l039.obj obj\cga_l040.obj ! + obj\cga_l041.obj obj\cga_l043.obj obj\cga_l044.obj obj\cga_l045.obj +# llink -n0 -v -lc:\usr\sbr\lsbr.lib -dcga_l.mod + +small.window : obj\cga_s001.obj obj\bioss001.obj ! + obj\cga_s004.obj obj\cga_s008.obj ! + obj\cga_s012.obj obj\cga_s013.obj obj\cga_s014.obj ! + obj\cga_s029.obj obj\cga_s030.obj obj\cga_s031.obj ! + obj\cga_s032.obj obj\cga_s033.obj obj\cga_s034.obj ! + obj\cga_s035.obj obj\cga_s041.obj obj\cga_s043.obj +# llink -n0 -v -lc:\usr\sbr\ssbr.lib -dcga_s.mod + +clear : + del *.bak + del *.ftr + del window.asm + +t1.obj : C:\usr\window\t1.c + $(cml) C:\usr\window\t1.c + +t1.exe : t1.obj obj\cga_l001.obj obj\cga_l012.obj obj\cga_l013.obj + link t1 obj\cga_l001 obj\cga_l012 obj\cga_l013,/map,/NOE,c:\usr\sbr\lsbr; + +# LARGE Modell --------------------------------------------------------------- +obj\cga_l001.obj : win_0001.c + $(cml) -DW_MODEL_CGA win_0001.c + $(obl) obj\cga_l001.obj + +obj\biosl001.obj : win_0001.c + $(cml) -DW_MODEL_BIOS win_0001.c + $(obl) obj\biosl001.obj + +obj\cga_l004.obj : win_0004.c + $(cml) win_0004.c + $(obl) obj\cga_l004.obj + +obj\cga_l008.obj : win_0008.c + $(cml) win_0008.c + $(obl) obj\cga_l008.obj + +obj\cga_l009.obj : win_0009.c + $(cml) win_0009.c + $(obl) obj\cga_l009.obj + +obj\cga_l010.obj : win_0010.c + $(cml) win_0010.c + $(obl) obj\cga_l010.obj + +obj\cga_l011.obj : win_0011.c + $(cml) win_0011.c + $(obl) obj\cga_l011.obj + +obj\cga_l012.obj : win_l012.asm + $(asm) WIN_L012.ASM,obj\cga_l012.obj; + +obj\cga_l013.obj : win_l013.asm + $(asm) WIN_L013.ASM,obj\cga_l013.obj; + +obj\cga_l014.obj : win_l014.asm + $(asm) WIN_L014.ASM,obj\cga_l014.obj; + +obj\cga_l015.obj : win_0015.c + $(cml) win_0015.c + $(obl) obj\cga_l015.obj + +obj\cga_l016.obj : win_0016.c + $(cml) win_0016.c + $(obl) obj\cga_l016.obj + +obj\cga_l018.obj : win_0018.c + $(cml) win_0018.c + $(obl) obj\cga_l018.obj + +obj\cga_l019.obj : win_0019.c + $(cml) win_0019.c + $(obl) obj\cga_l019.obj + +obj\cga_l020.obj : win_0020.c + $(cml) win_0020.c + $(obl) obj\cga_l020.obj + +obj\cga_l021.obj : win_0021.c + $(cml) win_0021.c + $(obl) obj\cga_l021.obj + +obj\cga_l022.obj : win_0022.c + $(cml) win_0022.c + $(obl) obj\cga_l022.obj + +obj\cga_l023.obj : win_0023.c + $(cml) win_0023.c + $(obl) obj\cga_l023.obj + +obj\cga_l024.obj : win_l024.asm + $(asm) WIN_L024.ASM,obj\cga_l024.obj; + +obj\cga_l025.obj : win_l025.asm + $(asm) WIN_L025.ASM,obj\cga_l025.obj; + +obj\cga_l026.obj : win_0026.c + $(cml) win_0026.c + +obj\cga_l027.obj : win_0027.c + $(cml) win_0027.c + $(obl) obj\cga_l027.obj + +obj\cga_l028.obj : win_0028.c + $(cml) win_0028.c + $(obl) obj\cga_l028.obj + +obj\cga_l029.obj : win_0029.c + $(cml) win_0029.c + $(obl) obj\cga_l029.obj + +obj\cga_l030.obj : win_0030.c + $(cml) win_0030.c + $(obl) obj\cga_l030.obj + +obj\cga_l031.obj : win_l031.asm + $(asm) WIN_L031.ASM,obj\cga_l031; + +obj\cga_l032.obj : win_l032.asm + $(asm) WIN_L032.ASM,obj\cga_l032; + +obj\cga_l033.obj : win_l033.asm + $(asm) WIN_L033.ASM,obj\cga_l033; + +obj\cga_l034.obj : win_L034.asm + $(asm) WIN_L034.ASM,obj\cga_l034; + +obj\cga_l035.obj : win_l035.asm + $(asm) WIN_L035.ASM,obj\cga_l035; + +obj\cga_l036.obj : win_l036.asm + $(asm) WIN_L036.ASM,obj\cga_l036; + +obj\cga_l037.obj : win_l037.asm + $(asm) WIN_L037.ASM,obj\cga_l037; + +obj\cga_l038.obj : win_l038.asm + $(asm) WIN_L038.ASM,obj\cga_l038; + +obj\cga_l039.obj : win_l039.asm + $(asm) WIN_L039.ASM,obj\cga_l039; + +obj\cga_l040.obj : win_l040.asm + $(asm) WIN_L040.ASM,obj\cga_l040; + +obj\cga_l041.obj : win_0041.c + $(cml) win_0041.c + $(obl) obj\cga_l041.obj + +obj\cga_l043.obj : win_l043.asm + $(asm) WIN_L043.ASM,obj\cga_l043; + +obj\cga_l044.obj : win_0044.c + $(cml) win_0044.c + $(obl) obj\cga_l044.obj + +obj\cga_l045.obj : win_0045.c + $(cml) /DW_MODEL_CGA win_0045.c + $(obl) obj\cga_l045.obj + + +# SMALL Modell --------------------------------------------------------------- +obj\cga_s001.obj : win_0001.c + $(cms) -DW_MODEL_CGA win_0001.c + objdec -w -d -m0 obj\cga_s001.obj + +obj\bioss001.obj : win_0001.c + $(cms) -DW_MODEL_BIOS win_0001.c + objdec -w -d -m0 obj\bioss001.obj + +obj\cga_s004.obj : win_0004.c + $(cms) win_0004.c + +obj\cga_s008.obj : win_0008.c + $(cms) win_0008.c + +obj\cga_s009.obj : win_0009.c + $(cms) win_0009.c + +obj\cga_s010.obj : win_0010.c + $(cms) win_0010.c + +obj\cga_s011.obj : win_0011.c + $(cms) win_0011.c + +obj\cga_s012.obj : win_0012.c + $(cms) win_0012.c + +obj\cga_s013.obj : win_0013.c + $(cms) win_0013.c + +obj\cga_s014.obj : win_0014.c + $(cms) win_0014.c + +obj\cga_s015.obj : win_0015.c + $(cms) win_0015.c + +obj\cga_s016.obj : win_0016.c + $(cms) win_0016.c + +obj\cga_s018.obj : win_0018.c + $(cms) win_0018.c + +obj\cga_s019.obj : win_0019.c + $(cms) win_0019.c + +obj\cga_s020.obj : win_0020.c + $(cms) win_0020.c + +obj\cga_s021.obj : win_0021.c + $(cms) win_0021.c + +obj\cga_s022.obj : win_0022.c + $(cms) win_0022.c + +obj\cga_s023.obj : win_0023.c + $(cms) win_0023.c + +obj\cga_s024.obj : win_0024.c + $(cms) win_0024.c + +obj\cga_s025.obj : win_0025.c + $(cms) win_0025.c + +obj\cga_s026.obj : win_0026.c + $(cms) win_0026.c + +obj\cga_s027.obj : win_0027.c + $(cms) win_0027.c + +obj\cga_s028.obj : win_0028.c + $(cms) win_0028.c + +obj\cga_s029.obj : win_0029.c + $(cms) win_0029.c + +obj\cga_s030.obj : win_0030.c + $(cms) win_0030.c + +obj\cga_s031.obj : win_s031.asm + $(asm) WIN_S031.ASM,obj\cga_s031.obj; + +obj\cga_s032.obj : win_s032.asm + $(asm) WIN_S032.ASM,obj\cga_s032.obj; + +obj\cga_s033.obj : win_s033.asm + $(asm) WIN_S033.ASM,obj\cga_s033.obj; + +obj\cga_s034.obj : win_0034.c + $(cms) win_0034.c + +obj\cga_s035.obj : win_0035.c + $(cms) win_0035.c + +obj\cga_s041.obj : win_0041.c + $(cms) win_0041.c + +obj\cga_s043.obj : win_s043.asm + $(asm) WIN_S043.ASM,obj\cga_s043.obj; diff --git a/lib/window/cga/win_0001.c b/lib/window/cga/win_0001.c new file mode 100644 index 0000000000000000000000000000000000000000..400910031fded9d06a405ccde5019ba217c28b5a --- /dev/null +++ b/lib/window/cga/win_0001.c @@ -0,0 +1,206 @@ +/* + * FILE ~/usr/window/cga/win_0001.c + * + * written: 1989 08 17: aus WIN0BIOS.ARC �bernommen + * latest update: 1994-08-20 + * + */ + +#pragma check_stack(off) + +/* #define ET4000 */ +/* #define T8900 */ + +#include <gg/window.h> +#include <dos.h> + +#ifdef W_MODEL_CGA +/* 14 standard video modes */ +#ifdef T8900 +#define KNOWN_MODES 29 +#endif +#ifdef ET4000 +#define KNOWN_MODES 17 +#endif +#ifndef KNOWN_MODES +#define KNOWN_MODES 14 +#endif +static char VVVxxx [] = "(@)BWindow CGA #D$1991-05-13 01:15:00"; +#endif + +#ifdef W_MODEL_BIOS +#ifdef T8900 +# define KNOWN_MODES 28 +#endif +#ifdef ET4000 +# define KNOWN_MODES 16 +#endif +#ifndef KNOWN_MODES +#define KNOWN_MODES 13 +#endif +static char VVVxxx [] = "(@)BWindow BIOS #D$1991-05-13 01:15:00"; +#endif + +extern struct W_SCREEN_AND_MODES w_screen_and_modes; + +extern int W_DATA_initialized, + W_TEXT_MAX_X, + W_TEXT_MAX_Y, + W_TEXT_CELL_X, + W_TEXT_CELL_Y, + W_GRAPH_MAX_X, + W_GRAPH_MAX_Y; + +extern int W_AKT_MODE; + +/* ------------------------------------------------------------------------ */ +static struct W_SCREEN_CAPABILITIES w_screen_capabilities = +{ + "CGA", W_MODEL_CODE_CGA, KNOWN_MODES, 3 +} ; + +static struct W_MODE_CAPABILITIES w_mode_capabilities [KNOWN_MODES] = +{ +/* standard modes: --- */ +{ /* 40x25 B/W Text */ 0x00, 40, 25, 2, 16, 8, 8, -1, -1, -1, -1 }, +{ /* 40x25 COL Text */ 0x01, 40, 25, 256, 16, 8, 8, -1, -1, -1, -1 }, +{ /* 80x25 B/W Text */ 0x02, 80, 25, 2, 8, 8, 4, -1, -1, -1, -1 }, +{ /* 80x25 COL Text */ 0x03, 80, 25, 256, 8, 8, 4, -1, -1, -1, -1 }, +{ /* 320x200x2 Graph */ 0x04, 40, 25, 2, 8, 8, 1, 320, 200, 2, 1 }, +{ /* 320x200x4 Graph */ 0x05, 40, 25, 4, 8, 8, 1, 320, 200, 4, 1 }, +{ /* 640x200x2 Graph */ 0x06, 80, 25, 2, 8, 8, 1, 640, 200, 2, 1 }, +{ /* 80x25 B/W Alpha */ 0x07, 80, 25, 2, 8, 8, 1, -1, -1, -1, -1 }, +{ /* 320x200x16 Graph */ 0x0D, 80, 25, 16, 8, 8, 1, 320, 200, 16, 1 }, +{ /* 640x200x16 Graph */ 0x0E, 80, 25, 16, 8, 8, 1, 640, 200, 16, 1 }, +{ /* 640x350x16 Graph */ 0x10, 80, 25, 16, 8, 14, 1, 640, 350, 16, 1 }, +#ifdef W_MODEL_CGA +{ /* 640x480x2 Graph */ 0x11, 80, 25, 2, 8, 16, 1, 640, 480, 2, 1 }, +#endif +{ /* 640x480x16 Graph */ 0x12, 80, 25, 16, 8, 16, 1, 640, 480, 16, 1 }, +{ /* 320x200x256 Graph */ 0x13, 40, 25, 256, 8, 8, 1, 320, 200, 256, 1 } + +#ifdef T8900 +/* extended modes: for Trident 8900 --- */ +, +{ /* 80x30 COL Text */ 0x50, 80, 30, 256, 8, 8, 1, -1, -1, -1, -1 }, +{ /* 80x43 COL Text */ 0x51, 80, 43, 256, 8, 8, 1, -1, -1, -1, -1 }, +{ /* 80x60 COL Text */ 0x52, 80, 60, 256, 8, 8, 1, -1, -1, -1, -1 }, +{ /* 132x25 COL Text */ 0x53, 132, 25, 256, 8, 8, 1, -1, -1, -1, -1 }, +{ /* 132x30 COL Text */ 0x54, 132, 30, 256, 8, 8, 1, -1, -1, -1, -1 }, +{ /* 132x43 COL Text */ 0x55, 132, 43, 256, 8, 8, 1, -1, -1, -1, -1 }, +{ /* 132x60 COL Text */ 0x56, 132, 60, 256, 8, 8, 1, -1, -1, -1, -1 }, +{ /* 132x25b COL Text */ 0x57, 132, 25, 256, 8, 8, 1, -1, -1, -1, -1 }, +{ /* 132x30b COL Text */ 0x58, 132, 30, 256, 8, 8, 1, -1, -1, -1, -1 }, +{ /* 132x43b COL Text */ 0x59, 132, 43, 256, 8, 8, 1, -1, -1, -1, -1 }, +{ /* 132x60b COL Text */ 0x5A, 132, 60, 256, 8, 8, 1, -1, -1, -1, -1 }, +{ /* 800x600x16 Graph */ 0x5B, 100, 75, 256, 8, 8, 1, 800, 600, 16, 1 }, +{ /* 640x400x256 Graph */ 0x5C, 80, 25, 256, 8, 8, 1, 640, 400, 256, 1 }, +{ /* 640x480x256 Graph */ 0x5D, 80, 30, 256, 8, 8, 1, 640, 480, 256, 1 }, +{ /* 1024x768x16 Graph */ 0x5F, 128, 48, 256, 8, 8, 1,1024, 768, 16, 1 } +#endif + +#ifdef ET4000 +/* extended modes: for ET 4000 --- */ +, +{ /* 640x400x256 Graph */ 0x2F, 80, 25, 256, 8, 8, 1, 640, 400, 256, 1 }, +{ /* 640x480x256 Graph */ 0x2E, 80, 30, 256, 8, 8, 1, 640, 480, 256, 1 }, +{ /* 1024x768x16 Graph */ 0x38, 128, 48, 256, 8, 8, 1,1024, 768, 16, 1 } +#endif +} ; + +/* Model abh�ngige Daten: ------------------------------------------------- */ +#ifdef W_MODEL_CGA +int W_TEXT_AKT_MEM = 0xB800; /* aktuelle Position der Textseite */ + /* im Bilsspeicher */ +int W_TEXT_AKT_MULT = 160; /* Zahl der Byte je Bildschirmzeile */ +#endif + +/* ------------------------------------------------------------------------ */ +static void cdecl _init_data (void); + +static void _init_data () +{ + w_screen_and_modes.w_screen_capabilities = &w_screen_capabilities; + w_screen_and_modes.w_mode_capabilities = w_mode_capabilities; + W_DATA_initialized = 1; +} + +/* ------------------------------------------------------------------------ */ +void w_init (int flags) /* Bit 0: Mode Initialisieren lassen */ + /* Bit 1: Zeilen/Spalten *NICHT* ermitteln */ +{ + _init_data (); + + if (flags & 0x0001) + w_init_mode (w_screen_capabilities.w_mode_default, flags); + else w_init_mode (W_AKT_MODE=w_get_mode(), flags); +} + +/* ------------------------------------------------------------------------ */ +int w_init_mode (int num, int flags) +/* flags: bit 0: initialize the controller (by calling bios) */ +/* bit 1: don't get maximum screen coordinates */ +/* bit 3: mode num is a bios mode number */ +{ + union REGS rega, regb; + register struct W_MODE_CAPABILITIES *wmc; + + if (! W_DATA_initialized) _init_data (); + + if (flags & 0x0004) + { + int i; + for (i=0; i < w_screen_capabilities.w_mode_count; i++) + if (w_mode_capabilities [i].w_mode_code == num) break; + num=i; + } + if (num < 0 || num >= w_screen_capabilities.w_mode_count) return -1; + + wmc = &w_mode_capabilities [num]; + +#ifdef NOT_IMPLEMENTED + if (wmc->w_mode_code == -1) + { + /* Sonder Modus: z.Z. nicht handhabbar #### */ + return -1; + } +#endif + + W_AKT_MODE=num; +/****************************************** + if (num >= 0x50) W_TEXT_AKT_MEM = 0xA000; +******************************************/ + + W_GRAPH_MAX_Y = wmc->w_graph_max_y; + W_GRAPH_MAX_X = wmc->w_graph_max_x; + W_TEXT_CELL_X = wmc->w_text_cell_x; + W_TEXT_CELL_Y = wmc->w_text_cell_y; + W_TEXT_MAX_Y = wmc->w_text_max_y; + W_TEXT_MAX_X = wmc->w_text_max_x; + +#ifdef W_MODEL_CGA + switch (wmc->w_text_max_x) + { + case 40: W_TEXT_AKT_MULT = 80; W_TEXT_AKT_MEM = 0xB800; break; + case 80: W_TEXT_AKT_MULT = 160; W_TEXT_AKT_MEM = 0xB800; break; + case 132: W_TEXT_AKT_MULT = 264; W_TEXT_AKT_MEM = 0xBC00; break; + } +#endif + + if (flags & 0x0001) w_set_mode (wmc->w_mode_code); + if (!(flags & 0x0002)) w_get_screen_max(); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int w_get_mode () +{ + register int am,i; + + am= _cga_get_mode (); + for (i= 0; i<KNOWN_MODES; i++) + if (am == w_mode_capabilities [i].w_mode_code) return i; + + return -1; +} diff --git a/lib/window/cga/win_0004.c b/lib/window/cga/win_0004.c new file mode 100644 index 0000000000000000000000000000000000000000..954d82a3da95de72aee82ed0f441a12240eb751f --- /dev/null +++ b/lib/window/cga/win_0004.c @@ -0,0 +1,17 @@ +/* + * FILE ~/usr/window/cga/win_0004.c + * + * written: 1989 08 16: aus WIN0.SAR �bernommen + * latest update: 1994-08-20 + * + */ + +#pragma check_stack(off) + +/* ------------------------------------------------------------------------ */ +void cga_reset () +{ + bios_init_mode ("80x25 COL Text", -1); + bios_cursoron (); +} + diff --git a/lib/window/cga/win_0008.c b/lib/window/cga/win_0008.c new file mode 100644 index 0000000000000000000000000000000000000000..29bafd0ae69b87f046a912d583a185d8ed769843 --- /dev/null +++ b/lib/window/cga/win_0008.c @@ -0,0 +1,40 @@ +/* + * FILE /usr/window/cga/win_0008.c + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#include <gg/window.h> +#pragma check_stack(off) + +extern int W_TEXT_AKT_MEM, + W_AKT_MODE; + +extern struct W_SCREEN_AND_MODES w_screen_and_modes; + +/* ------------------------------------------------------------------------ */ +void cga_selpage (p) +int p; +{ union REGS rega; + union REGS regb; + int mx; + + if (p < 0 || + p >= w_screen_and_modes.w_mode_capabilities [W_AKT_MODE].w_text_pages) + return; + + switch (w_screen_and_modes.w_mode_capabilities [W_AKT_MODE].w_text_max_x) + { + case 40: mx = 0x0080; break; + case 80: mx = 0x0100; break; + } + + W_TEXT_AKT_MEM = 0xB800 + mx*p; + + rega.h.ah = 5; + rega.h.al = p; + int86 (0x10, ®a, ®b); +} diff --git a/lib/window/cga/win_0012.c b/lib/window/cga/win_0012.c new file mode 100644 index 0000000000000000000000000000000000000000..26cc13fc485f4333aaedf9573789f6342d51d10d --- /dev/null +++ b/lib/window/cga/win_0012.c @@ -0,0 +1,39 @@ +/* + * FILE /usr/window/cga/win_0012.c + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +extern int W_TEXT_MAX_X, + W_TEXT_MAX_Y; + +void cga_setchar (p, x, y, a, c) +int p, x, y, a, c; +{ + union REGS rega; + union REGS regb; + + if (x < 0 || x >= W_TEXT_MAX_X || + y < 0 || y >= W_TEXT_MAX_Y) return; + + rega.h.ah = 2; + rega.h.bh = p; + rega.h.dl = x; + rega.h.dh = y; + int86 (0x10, ®a, ®b); + + rega.h.ah = 9; + rega.h.bh = p; + rega.x.cx = 1; + rega.h.al = c; + rega.h.bl = a; + int86 (0x10, ®a, ®b); +} + + +/* ------------------------------------------------------------------------ */ diff --git a/lib/window/cga/win_0013.c b/lib/window/cga/win_0013.c new file mode 100644 index 0000000000000000000000000000000000000000..414bff575a31dcbb7d86a25bcd16d14c2a7a16da --- /dev/null +++ b/lib/window/cga/win_0013.c @@ -0,0 +1,39 @@ +/* + * FILE /usr/window/cga/win_0013.c + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +extern int W_TEXT_MAX_X, + W_TEXT_MAX_Y; + +void cga_setnchar (p, x, y, a, c, n) +int p, x, y, a, c, n; +{ + union REGS rega; + union REGS regb; + + if (x < 0 || x >= W_TEXT_MAX_X || + y < 0 || y >= W_TEXT_MAX_Y || n <= 0) return; + if ((x+n) > W_TEXT_MAX_X) n = W_TEXT_MAX_X-x; + + rega.h.ah = 2; + rega.h.bh = p; + rega.h.dl = x; + rega.h.dh = y; + int86 (0x10, ®a, ®b); + + rega.h.ah = 9; + rega.h.bh = p; + rega.x.cx = n; /* Wiederholfaktor */ + rega.h.al = c; + rega.h.bl = a; + int86 (0x10, ®a, ®b); +} + +/* ------------------------------------------------------------------------ */ diff --git a/lib/window/cga/win_0014.c b/lib/window/cga/win_0014.c new file mode 100644 index 0000000000000000000000000000000000000000..1e9a1200221cfeda4fc073ffbce663a2afbe15d2 --- /dev/null +++ b/lib/window/cga/win_0014.c @@ -0,0 +1,30 @@ +/* + * FILE /usr/window/cga/win_0014.c + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +#include <dos.h> +#pragma check_stack(off) + +int cga_getchar (p, x, y) +int p, x, y; +{ + union REGS rega; + union REGS regb; + + rega.h.ah = 2; + rega.h.bh = p; + rega.h.dl = x; + rega.h.dh = y; + int86 (0x10, ®a, ®b); + + rega.h.ah = 8; + rega.h.bh = p; + int86 (0x10, ®a, ®b); + return regb.x.ax; +} + +/* ------------------------------------------------------------------------ */ diff --git a/lib/window/cga/win_0029.c b/lib/window/cga/win_0029.c new file mode 100644 index 0000000000000000000000000000000000000000..60c13b038d87389dee70874dbb4f2531e7012f6a --- /dev/null +++ b/lib/window/cga/win_0029.c @@ -0,0 +1,24 @@ +/* + * FILE C:\usr\window\win0cga.arc [WIN_0029.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +# pragma check_stack(off) + +int cga_blit_save (puffer, page, ax, ay, bx, by) +int *puffer; +int page, ax, ay, bx, by; +{ + register int x, y; + + for (x = ax; x <= bx; x++) + for (y = ay; y <= by; y++) + { + *puffer++ = cga_getchar (page, x, y); + /* cga_getchar liefert (character, attribut) als Integer wobei */ + /* character das LSB ist und als erstes in den Puffer wandert. */ + } +} diff --git a/lib/window/cga/win_0030.c b/lib/window/cga/win_0030.c new file mode 100644 index 0000000000000000000000000000000000000000..6d8ba7312e9b66dae54c854f2c6a857702dd95e2 --- /dev/null +++ b/lib/window/cga/win_0030.c @@ -0,0 +1,30 @@ +/* + * FILE C:\usr\window\win0cga.arc [WIN_0030.C] + * + * 1989 08 16: aus WIN0.SAR �bernommen + * Revision + * + */ + +# pragma check_stack(off) + +int cga_blit_load (puffer, page, ax, ay, bx, by) +char *puffer; +int page, ax, ay, bx, by; +{ + register int x, y; + + for (x = ax; x <= bx; x++) + for (y = ay; y <= by; y++) + { + cga_setchar (page, x, y, *puffer++, *puffer++); + /* attribut character */ + /* ANM: blit_save legt (character, attribut) als integer in den */ + /* als INT-Array betrachteten puffer ab, wobei character im */ + /* Intel-Format als LSB als ersetes abgelegt wird. */ + /* blit_load betrachtet puffer als CHAR-Array. */ + /* Da zuerst das rechte *puffer++ evaluiert wird, kommt */ + /* zuerst der character und dann das attribut aus dem */ + /* Puffer heraus. (daher alles ok) */ + } +} diff --git a/lib/window/cga/win_0034.c b/lib/window/cga/win_0034.c new file mode 100644 index 0000000000000000000000000000000000000000..1428b5923b39b6f9ff2c6d24803bf6d9064d23d3 --- /dev/null +++ b/lib/window/cga/win_0034.c @@ -0,0 +1,30 @@ +/* + * FILE C:\usr\window\win0cga.arc [WIN_0034.C] + * + * 1989 09 17 + * + */ + +# pragma check_stack(off) +# pragma pack(1) + +int cga_scrblk_left (page, ax, ay, bx, by, attr, cnt) +int page, ax, ay, bx, by, attr, cnt; +{ + register int x, y; + union { int ch_i; + char ch_c [2]; + } ch; + + if (cnt <= 0 || cnt > bx - ax) return -1; + for (x = ax+cnt; x <= bx; x++) + for (y = ay; y <= by; y++) + { + ch.ch_i = cga_getchar (page, x, y); + cga_setchar (page, x-cnt, y, ch.ch_c[1], ch.ch_c[0]); + /* cga_getchar liefert (character, attribut) als Integer wobei */ + /* character das LSB ist und als erstes in den Puffer wandert. */ + } + for (y = ay; y <= by; y++) + cga_setchar (page, bx, y, attr, ' '); +} diff --git a/lib/window/cga/win_0035.c b/lib/window/cga/win_0035.c new file mode 100644 index 0000000000000000000000000000000000000000..527ea9a1db93251c1011cc36861bf6c50e1e3575 --- /dev/null +++ b/lib/window/cga/win_0035.c @@ -0,0 +1,30 @@ +/* + * FILE C:\usr\window\win0cga.arc [WIN_0034.C] + * + * 1989 09 17 + * + */ + +# pragma check_stack(off) +# pragma pack(1) + +int cga_scrblk_right (page, ax, ay, bx, by, attr, cnt) +int page, ax, ay, bx, by, attr, cnt; +{ + register int x, y; + union { int ch_i; + char ch_c [2]; + } ch; + + if (cnt <= 0 || cnt > bx - ax) return -1; + for (x = bx-cnt; x >= ax; x--) + for (y = ay; y <= by; y++) + { + ch.ch_i = cga_getchar (page, x, y); + cga_setchar (page, x+cnt, y, ch.ch_c[1], ch.ch_c[0]); + /* cga_getchar liefert (character, attribut) als Integer wobei */ + /* character das LSB ist und als erstes in den Puffer wandert. */ + } + for (y = ay; y <= by; y++) + cga_setchar (page, ax, y, attr, ' '); +} diff --git a/lib/window/cga/win_0041.c b/lib/window/cga/win_0041.c new file mode 100644 index 0000000000000000000000000000000000000000..7905a281794a9b5a3adcbee967e5910ea5f7c2ca --- /dev/null +++ b/lib/window/cga/win_0041.c @@ -0,0 +1,26 @@ +/* + * FILE ~/usr/window/cga/win_0041.c + * + * written: 1990 04 01 + * latest update: 1994-12-24 + * + */ + +#pragma check_stack(off) + +extern int + W_TEXT_MAX_X, + W_TEXT_MAX_Y, + W_TEXT_AKT_MEM; + +void cga_cls_col (int col) +{ + int cnt; + int *cp; + + cnt = W_TEXT_MAX_X * W_TEXT_MAX_Y; + col = (col << 8) & 0xFF00; /* Color Attribut + NULL-Blank */ + + set_cp (&cp, 0x0000, W_TEXT_AKT_MEM); + while (cnt-- > 0) *cp++ = col; +} diff --git a/lib/window/cga/win_0044.c b/lib/window/cga/win_0044.c new file mode 100644 index 0000000000000000000000000000000000000000..7acb8d6f2f3598813fe6d327ba24beace422aa27 --- /dev/null +++ b/lib/window/cga/win_0044.c @@ -0,0 +1,23 @@ +/* + * FILE /usr/window/cga/win_0044.C + * + * 1991 07 05 + * + */ + +#pragma check_stack(off) + +extern int W_TEXT_AKT_MEM; +extern int W_TEXT_MAX_X; + +/* ------------------------------------------------------------------------ */ +void cga_blit_line (int page, int ax, int ay, int cnt, char *line) +{ + int off; + char *cp; + + off = (ay*W_TEXT_MAX_X+ax)*2; + + set_cp (&cp, off, W_TEXT_AKT_MEM); + memcpy (cp, line, cnt*2); +} diff --git a/lib/window/cga/win_0045.c b/lib/window/cga/win_0045.c new file mode 100644 index 0000000000000000000000000000000000000000..f119d9cc3203bb0d34b2270c17bc1c52a622c62a --- /dev/null +++ b/lib/window/cga/win_0045.c @@ -0,0 +1,56 @@ +/* + * FILE /usr/window/cga/win_0045.C + * + * 1991 12 07 + * + */ + +#pragma check_stack(off) + +#include <dos.h> + +extern int W_TEXT_MAX_Y; +extern int W_TEXT_CELL_Y; + +/* ------------------------------------------------------------------------ */ +int vga_set_screen_mode (int mode) +{ + union REGS ra, rb; + int max_y=24; + +#ifdef W_MODEL_CGA + char *cp; + + /* �nderung der Zeilenzahl erm�glichen */ + ra.h.ah=0x11; + ra.h.bl=0; + switch (mode) + { + case 1: ra.h.al=0x14; break; + case 2: ra.h.al=0x11; break; + case 3: ra.h.al=0x15; break; + case 4: ra.h.al=0x12; break; + case 5: ra.h.al=0x13; break; + case 6: ra.h.al=0x16; break; + case 7: ra.h.al=0x17; break; + case 8: ra.h.al=0x18; break; + case 9: ra.h.al=0x19; break; + default: return; + } + int86 (0x10, &ra, &rb); + + set_cp (&cp, 0, 0x0040); + max_y = cp [0x84] & 0x00FF; + if (max_y<19 || max_y >60) max_y=24; +#endif + +/* set_line_mode (max_y); ... ehedem */ + W_TEXT_MAX_Y = max_y + 1; + + ra.x.ax=8; /* Maus auf neuen Textbereich einstellen */ + ra.x.cx=0; + ra.x.dx=max_y*W_TEXT_CELL_Y; + int86 (0x33, &ra, &rb); + + return max_y; +} diff --git a/lib/window/cga/win_l012.asm b/lib/window/cga/win_l012.asm new file mode 100644 index 0000000000000000000000000000000000000000..c9fe7e67f7d4cebf62414fb283c6d5afcd8b1718 --- /dev/null +++ b/lib/window/cga/win_l012.asm @@ -0,0 +1,102 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L012.ASM] +; +; 1989 08 16: aus WIN0.SAR �bernommen +; Revision +; +; +; Static Name Aliases +; + TITLE WIN_L012.ASM + NAME win_0012 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_TEXT_MAX_Y:WORD +EXTRN _W_TEXT_MAX_X:WORD +EXTRN _W_TEXT_AKT_MEM:WORD +EXTRN _W_TEXT_AKT_MULT:WORD + +CONST SEGMENT +$T20000 DW SEG _W_TEXT_MAX_X + ORG $+2 +$T20001 DW SEG _W_TEXT_MAX_Y + ORG $+2 +$T20002 DW SEG _W_TEXT_AKT_MEM + ORG $+2 +$T20003 DW SEG _W_TEXT_AKT_MULT +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _cga_setchar + +_cga_setchar PROC FAR + push bp + mov bp,sp + +; p = 6 +; x = 8 +; y = 10 +; a = 12 +; c = 14 + + cmp WORD PTR [bp+8],0 ;x + jl $EX199 + mov es,$T20000 + mov ax,WORD PTR [bp+8] ;x + cmp es:_W_TEXT_MAX_X,ax + jle $EX199 + cmp WORD PTR [bp+10],0 ;y + jl $EX199 + mov es,$T20001 + mov ax,WORD PTR [bp+10] ;y + cmp es:_W_TEXT_MAX_Y,ax + jle $EX199 + + mov es,$T20003 + mov ax, es:_W_TEXT_AKT_MULT ; Zeilenmultiplikator + mov dx, ax + mov al, BYTE PTR [bp+10] ;y + mul dx ; ax = y * Zeilenmultiplikator + mov bl, BYTE PTR [bp+8] ;x + mov bh, 0 + add bx, bx ; bx = x * 2 + add bx, ax + + mov es,$T20002 + mov ax, es:_W_TEXT_AKT_MEM ; Adresse der Bildschirmseite + mov es, ax + mov cl, BYTE PTR [bp+14] ;c + mov ch, BYTE PTR [bp+12] ;a + + mov dx, 03dah +y1: in al, dx + test al, 1 + jnz y1 +y2: in al, dx + test al, 1 + jz y2 + + mov es:word ptr [bx], cx + +$EX199: + mov sp,bp + pop bp + ret + +_cga_setchar ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/cga/win_l013.asm b/lib/window/cga/win_l013.asm new file mode 100644 index 0000000000000000000000000000000000000000..dd851f6a9e98cfaa2a0e8b3771fc080da9f435ed --- /dev/null +++ b/lib/window/cga/win_l013.asm @@ -0,0 +1,119 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L013.ASM] +; +; 1989 08 16: aus WIN0.SAR �bernommen +; Revision +; + +; Static Name Aliases +; + TITLE WIN_L013.c + NAME win_0013 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_TEXT_MAX_Y:WORD +EXTRN _W_TEXT_MAX_X:WORD +EXTRN _W_TEXT_AKT_MEM:WORD +EXTRN _W_TEXT_AKT_MULT:WORD + +CONST SEGMENT +$T20000 DW SEG _W_TEXT_MAX_X + ORG $+2 +$T20001 DW SEG _W_TEXT_MAX_Y + ORG $+2 +$T20002 DW SEG _W_TEXT_AKT_MEM + ORG $+2 +$T20003 DW SEG _W_TEXT_AKT_MULT +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _cga_setnchar + +_cga_setnchar PROC FAR + push bp + mov bp,sp + push di + +; p = 6 +; x = 8 +; y = 10 +; a = 12 +; c = 14 +; n = 16 + + mov di, WORD PTR [bp+16] ;n + cmp di, 0 + jle $EX199 + cmp WORD PTR [bp+10],0 ;y + jl $EX199 + mov es,$T20001 + mov ax,WORD PTR [bp+10] ;y + cmp es:_W_TEXT_MAX_Y,ax + jle $EX199 + cmp WORD PTR [bp+8],0 ;x + jl $EX199 + mov es,$T20000 + mov ax,WORD PTR [bp+8] ;x + mov bx, es:_W_TEXT_MAX_X + cmp bx, ax + jle $EX199 + add ax, di ;n; ax=x+n + cmp bx, ax + jge X1 + sub bx,WORD PTR [bp+8] ;x + mov di,bx ;n + +X1: mov es,$T20003 + mov ax, es:_W_TEXT_AKT_MULT ; Zeilenmultiplikator + mov dx, ax + mov al, BYTE PTR [bp+10] ;y + mul dx ; ax = y * Zeilenmultiplikator + mov bl, BYTE PTR [bp+8] ;x + mov bh, 0 + add bx, bx ; bx = x * 2 + add bx, ax + + mov es,$T20002 + mov ax, es:_W_TEXT_AKT_MEM ; Adresse der Bildschirmseite + mov es, ax + mov cl, BYTE PTR [bp+14] ;c + mov ch, BYTE PTR [bp+12] ;a + + mov dx, 03dah +y1: in al, dx + test al, 1 + jnz y1 +y2: in al, dx + test al, 1 + jz y2 + + mov es:word ptr [bx], cx + inc bx + inc bx + dec di + cmp di, 0 + jg y1 + +$EX199: + pop di + mov sp,bp + pop bp + ret + +_cga_setnchar ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/cga/win_l014.asm b/lib/window/cga/win_l014.asm new file mode 100644 index 0000000000000000000000000000000000000000..72527f366959127f2a4d254f36bfe298abf99df6 --- /dev/null +++ b/lib/window/cga/win_l014.asm @@ -0,0 +1,104 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L014.ASM] +; +; 1989 08 16: aus WIN0.SAR �bernommen +; Revision +; + + +; Static Name Aliases +; + TITLE WIN_L014.asm + NAME win_0014 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_TEXT_MAX_Y:WORD +EXTRN _W_TEXT_MAX_X:WORD +EXTRN _W_TEXT_AKT_MEM:WORD +EXTRN _W_TEXT_AKT_MULT:WORD + +CONST SEGMENT +$T20000 DW SEG _W_TEXT_MAX_X + ORG $+2 +$T20001 DW SEG _W_TEXT_MAX_Y + ORG $+2 +$T20002 DW SEG _W_TEXT_AKT_MEM + ORG $+2 +$T20003 DW SEG _W_TEXT_AKT_MULT + +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _cga_getchar + +_cga_getchar PROC FAR + push bp + mov bp,sp + +; p = 6 +; x = 8 +; y = 10 +; a = 12 +; c = 14 + + cmp WORD PTR [bp+8],0 ;x + jl $EX199 + mov es,$T20000 + mov ax,WORD PTR [bp+8] ;x + cmp es:_W_TEXT_MAX_X,ax + jle $EX199 + cmp WORD PTR [bp+10],0 ;y + jl $EX199 + mov es,$T20001 + mov ax,WORD PTR [bp+10] ;y + cmp es:_W_TEXT_MAX_Y,ax + jle $EX199 + + mov es,$T20003 + mov ax, es:_W_TEXT_AKT_MULT ; Zeilenmultiplikator + mov dx, ax + mov al, BYTE PTR [bp+10] ;y + mul dx ; ax = y * Zeilenmultiplikator + mov bl, BYTE PTR [bp+8] ;x + mov bh, 0 + add bx, bx ; bx = x * 2 + add bx, ax + + mov es,$T20002 + mov ax, es:_W_TEXT_AKT_MEM ; Adresse der Bildschirmseite + mov es, ax + mov cl, BYTE PTR [bp+14] ;c + mov ch, BYTE PTR [bp+12] ;a + + mov dx, 03dah +y1: in al, dx + test al, 1 + jnz y1 +y2: in al, dx + test al, 1 + jz y2 + + mov ax, es:word ptr [bx] + +$EX199: + mov sp,bp + pop bp + ret + +_cga_getchar ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/cga/win_l031.asm b/lib/window/cga/win_l031.asm new file mode 100644 index 0000000000000000000000000000000000000000..534e54891ce8cd8635d7e836eb08eb2de44acd97 --- /dev/null +++ b/lib/window/cga/win_l031.asm @@ -0,0 +1,48 @@ +; +; FILE C:\usr\window\cga\win0cga.arc [win_l031.asm] +; +; int cga_get_mode (void) +; RETURN: aktuelle Bildschirm Modus +; +; 1989 08 20 +; + TITLE WIN_L031.asm + NAME win_l031 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC __cga_get_mode + +__cga_get_mode proc far + push bp + mov bp, sp + push ds + + mov ax, 040h + mov ds, ax + mov al, byte ptr ds:[049h] + mov ah, 0 + + pop ds + mov sp, bp + pop bp + ret + +__cga_get_mode endp + +WINDOW_TEXT ENDS +END diff --git a/lib/window/cga/win_l032.asm b/lib/window/cga/win_l032.asm new file mode 100644 index 0000000000000000000000000000000000000000..0c06b49fd2bc4abb681123ae9726b03f9ddbfd0e --- /dev/null +++ b/lib/window/cga/win_l032.asm @@ -0,0 +1,47 @@ +; +; FILE C:\usr\window\cga\win0cga.arc [win_l032.asm] +; +; int cga_get_cols (void) +; RETURN: Zahl der Spalten am Bildschirm +; +; 1989 08 20 +; + TITLE WIN_L032.asm + NAME win_l031 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _cga_get_cols + +_cga_get_cols proc far + push bp + mov bp, sp + push ds + + mov ax, 040h + mov ds, ax + mov ax, word ptr ds:[04Ah] + + pop ds + mov sp, bp + pop bp + ret + +_cga_get_cols endp + +WINDOW_TEXT ENDS +END diff --git a/lib/window/cga/win_l033.asm b/lib/window/cga/win_l033.asm new file mode 100644 index 0000000000000000000000000000000000000000..1cd62bff6993b1dbcf35604df12e03578e5df66e --- /dev/null +++ b/lib/window/cga/win_l033.asm @@ -0,0 +1,48 @@ +; +; FILE C:\usr\window\cga\win0cga.arc [WIN_L033.asm] +; +; int cga_getpage (void) +; RETURN: aktuelle Bildschirm Seite +; +; 1989 08 20 +; + TITLE WIN_L033.asm + NAME WIN_L033 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _cga_getpage + +_cga_getpage proc far + push bp + mov bp, sp + push ds + + mov ax, 040h + mov ds, ax + mov al, byte ptr ds:[062h] + mov ah, 0 + + pop ds + mov sp, bp + pop bp + ret + +_cga_getpage endp + +WINDOW_TEXT ENDS +END diff --git a/lib/window/cga/win_l034.asm b/lib/window/cga/win_l034.asm new file mode 100644 index 0000000000000000000000000000000000000000..995b8eeeb4a7be258d15fe38e3f8c81deab904cc --- /dev/null +++ b/lib/window/cga/win_l034.asm @@ -0,0 +1,172 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L012.ASM] +; +; 1989 09 17: aus WIN0.SAR �bernommen +; Revision +; +; +; Static Name Aliases +; + TITLE win_0034.c + NAME win_0034 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_TEXT_MAX_Y:WORD +EXTRN _W_TEXT_MAX_X:WORD +EXTRN _W_TEXT_AKT_MEM:WORD +EXTRN _W_TEXT_AKT_MULT:WORD + +CONST SEGMENT +$T20000 DW SEG _W_TEXT_MAX_X + ORG $+2 +$T20001 DW SEG _W_TEXT_MAX_Y + ORG $+2 +$T20002 DW SEG _W_TEXT_AKT_MEM + ORG $+2 +$T20003 DW SEG _W_TEXT_AKT_MULT +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT +; Line 12 + PUBLIC _cga_scrblk_left +_cga_scrblk_left PROC FAR + push bp + mov bp,sp + sub sp,10 + push di + push si +; Line 13 +; page = 6 +; ax = 8 +; ay = 10 +; bx = 12 +; by = 14 +; attr = 16 +; cnt = 18 +; register si = x +; register di = y +; ch = -6 +; zm = -8 +; lines = -10 +; Line 19 + cmp WORD PTR [bp+18],0 ;cnt + jle $ERR + mov ax,WORD PTR [bp+12] ;bx + sub ax,WORD PTR [bp+8] ;ax + cmp ax,WORD PTR [bp+18] ;cnt + jge $I115 +$ERR: + mov ax,-1 + pop si + pop di + mov sp,bp + pop bp + ret +$I115: +; +; cmp WORD PTR [bp+12],0 ;bx +; jl $ERR +; mov es,$T20000 +; mov ax,WORD PTR [bp+8] ;ax +; cmp es:_W_TEXT_MAX_X,ax +; jle $ERR +; cmp WORD PTR [bp+14],0 ;by +; jl $ERR +; mov es,$T20001 +; mov ax,WORD PTR [bp+10] ;ay +; cmp es:_W_TEXT_MAX_Y,ax +; jle $ERR +; +; cmp WORD PTR [bp+8],0 ;ax +; jge c1 +; mov WORD PTR [bp+8],0 +; c1: mov es,$T20000 +; mov ax,WORD PTR [bp+12] ;bx +; cmp es:_W_TEXT_MAX_X,ax +; jg c2 +; mov ax,es:_W_TEXT_MAX_X +; mov WORD_PTR [bp+12],ax +; c2: cmp WORD PTR [bp+10],0 ;ay +; jge c3 +; mov WORD PTR [bp+10],0 +; c3: mov es,$T20001 +; mov ax,WORD PTR [bp+14] ;by +; cmp es:_W_TEXT_MAX_Y,ax +; jg c4 +; mov ax,es:_W_TEXT_MAX_X +; mov WORD_PTR [bp+14],ax +; c4: +; +; Kontroll Variablen einrichten + mov es,$T20003 + mov ax, es:_W_TEXT_AKT_MULT ; Zeilenmultiplikator + mov WORD PTR [bp-8], ax ; zm + mov dx, ax + mov al, BYTE PTR [bp+10] ; ay + mul dx ; ax = y * Zeilenmultiplikator + mov bx, ax + + mov es,$T20002 + mov ax, es:_W_TEXT_AKT_MEM ; Adresse der Bildschirmseite + mov es, ax + mov ax, WORD PTR [bp+8] ; ax *= 2 + add ax, ax + mov WORD PTR [bp+8], ax + mov ax, WORD PTR [bp+12] ; bx *= 2 + add ax, ax + mov WORD PTR [bp+12], ax + mov ax, WORD PTR [bp+18] ; cnt *= 2 + add ax, ax + mov WORD PTR [bp+18], ax + + mov ax,WORD PTR [bp+14] ; by + sub ax,WORD PTR [bp+10] ; ay + inc ax + mov WORD PTR [bp-10], ax ; lines = by - ay +Loop1: ; Zeilen + cmp ax, 0 + jle Over1 + mov di,WORD PTR [bp+8] ; ax + mov si,di + add si,WORD PTR [bp+18] ; cnt + +Loop2: cmp WORD PTR [bp+12], si ;bx + jl Over2 + mov ax, es:[bx+si] + mov es:[bx+di], ax + inc si + inc si + inc di + inc di + jmp Loop2 +Over2: + mov ax, WORD PTR [bp-8] ; zm + add bx, ax + mov ax, WORD PTR [bp-10] ; lines + dec ax + mov WORD PTR [bp-10], ax ; lines + jmp Loop1 + +Over1: + pop si + pop di + mov sp,bp + pop bp + ret + +_cga_scrblk_left ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/cga/win_l035.asm b/lib/window/cga/win_l035.asm new file mode 100644 index 0000000000000000000000000000000000000000..3431d351912d01b3ee49afe206f7c266661ca0ef --- /dev/null +++ b/lib/window/cga/win_l035.asm @@ -0,0 +1,170 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L035.ASM] +; +; 1989 09 17 +; +; Static Name Aliases +; + TITLE win_0034.c + NAME win_0034 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_TEXT_MAX_Y:WORD +EXTRN _W_TEXT_MAX_X:WORD +EXTRN _W_TEXT_AKT_MEM:WORD +EXTRN _W_TEXT_AKT_MULT:WORD + +CONST SEGMENT +$T20000 DW SEG _W_TEXT_MAX_X + ORG $+2 +$T20001 DW SEG _W_TEXT_MAX_Y + ORG $+2 +$T20002 DW SEG _W_TEXT_AKT_MEM + ORG $+2 +$T20003 DW SEG _W_TEXT_AKT_MULT +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _cga_scrblk_right +_cga_scrblk_right PROC FAR + push bp + mov bp,sp + sub sp,10 + push di + push si +; Line 13 +; page = 6 +; ax = 8 +; ay = 10 +; bx = 12 +; by = 14 +; attr = 16 +; cnt = 18 +; register si = x +; register di = y +; ch = -6 +; zm = -8 +; lines = -10 +; Line 19 + cmp WORD PTR [bp+18],0 ;cnt + jle $ERR + mov ax,WORD PTR [bp+12] ;bx + sub ax,WORD PTR [bp+8] ;ax + cmp ax,WORD PTR [bp+18] ;cnt + jge $I115 +$ERR: + mov ax,-1 + pop si + pop di + mov sp,bp + pop bp + ret +$I115: +; +; cmp WORD PTR [bp+12],0 ;bx +; jl $ERR +; mov es,$T20000 +; mov ax,WORD PTR [bp+8] ;ax +; cmp es:_W_TEXT_MAX_X,ax +; jle $ERR +; cmp WORD PTR [bp+14],0 ;by +; jl $ERR +; mov es,$T20001 +; mov ax,WORD PTR [bp+10] ;ay +; cmp es:_W_TEXT_MAX_Y,ax +; jle $ERR +; +; cmp WORD PTR [bp+8],0 ;ax +; jge c1 +; mov WORD PTR [bp+8],0 +; c1: mov es,$T20000 +; mov ax,WORD PTR [bp+12] ;bx +; cmp es:_W_TEXT_MAX_X,ax +; jg c2 +; mov ax,es:_W_TEXT_MAX_X +; mov WORD_PTR [bp+12],ax +; c2: cmp WORD PTR [bp+10],0 ;ay +; jge c3 +; mov WORD PTR [bp+10],0 +; c3: mov es,$T20001 +; mov ax,WORD PTR [bp+14] ;by +; cmp es:_W_TEXT_MAX_Y,ax +; jg c4 +; mov ax,es:_W_TEXT_MAX_X +; mov WORD_PTR [bp+14],ax +; c4: +; +; Kontroll Variablen einrichten + mov es,$T20003 + mov ax, es:_W_TEXT_AKT_MULT ; Zeilenmultiplikator + mov WORD PTR [bp-8], ax ; zm + mov dx, ax + mov al, BYTE PTR [bp+10] ; ay + mul dx ; ax = y * Zeilenmultiplikator + mov bx, ax + + mov es,$T20002 + mov ax, es:_W_TEXT_AKT_MEM ; Adresse der Bildschirmseite + mov es, ax + mov ax, WORD PTR [bp+8] ; ax *= 2 + add ax, ax + mov WORD PTR [bp+8], ax + mov ax, WORD PTR [bp+12] ; bx *= 2 + add ax, ax + mov WORD PTR [bp+12], ax + mov ax, WORD PTR [bp+18] ; cnt *= 2 + add ax, ax + mov WORD PTR [bp+18], ax + + mov ax,WORD PTR [bp+14] ; by + sub ax,WORD PTR [bp+10] ; ay + inc ax + mov WORD PTR [bp-10], ax ; lines = by - ay +Loop1: ; Zeilen + cmp ax, 0 + jle Over1 + mov di,WORD PTR [bp+12] ; bx + mov si,di + sub si,WORD PTR [bp+18] ; cnt + +Loop2: cmp WORD PTR [bp+8], si ; ax + jg Over2 + mov ax, es:[bx+si] + mov es:[bx+di], ax + dec si + dec si + dec di + dec di + jmp Loop2 +Over2: + mov ax, WORD PTR [bp-8] ; zm + add bx, ax + mov ax, WORD PTR [bp-10] ; lines + dec ax + mov WORD PTR [bp-10], ax ; lines + jmp Loop1 + +Over1: + pop si + pop di + mov sp,bp + pop bp + ret + +_cga_scrblk_right ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/cga/win_l036.asm b/lib/window/cga/win_l036.asm new file mode 100644 index 0000000000000000000000000000000000000000..4808d20c60df794defd182c4e060e9ee1ab8508d --- /dev/null +++ b/lib/window/cga/win_l036.asm @@ -0,0 +1,59 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L036.ASM] +; +; VGA Palette setzen +; +; 1989 11 21 +; +; +; Static Name Aliases +; + TITLE WIN_L036.ASM + NAME win_0036 + +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _vga_setpalette + +_vga_setpalette PROC FAR + push bp + mov bp,sp + +; palette color nr = 6 +; palette color red = 8 +; palette color green = 10 +; palette color blue = 12 + + mov bx, word ptr [bp+6] ; nr + mov ax, word ptr [bp+8] ; red + mov dh, al + mov ax, word ptr [bp+10] ; green + mov ch, al + mov ax, word ptr [bp+12] ; blue + mov cl, al + mov ax, 1010h + int 10h + +$EX199: + mov sp,bp + pop bp + ret + +_vga_setpalette ENDP +WINDOW_TEXT ENDS +END + +; ---------------------------------------------------------------------------- diff --git a/lib/window/cga/win_l037.asm b/lib/window/cga/win_l037.asm new file mode 100644 index 0000000000000000000000000000000000000000..55c5fb67d53d11265c7b865a2a6fa2f4a3cc80da --- /dev/null +++ b/lib/window/cga/win_l037.asm @@ -0,0 +1,57 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L037.ASM] +; +; VGA Palette Block setzen +; +; 1990 03 04 +; +; +; Static Name Aliases +; + TITLE WIN_L037.ASM + NAME win_0037 + +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _vga_setpalette_block + +_vga_setpalette_block PROC FAR + push bp + mov bp,sp + +; palette color nr start = 6 +; palette color count = 8 +; palette color table offset = 10 +; palette color table segment = 12 + + mov bx, word ptr [bp+6] ; nr start + mov cx, word ptr [bp+8] ; color count (table size) + mov dx, word ptr [bp+10] ; table offset + mov ax, word ptr [bp+12] ; table segment + mov es, ax + mov ax, 1012h + int 10h + +$EX199: + mov sp,bp + pop bp + ret + +_vga_setpalette_block ENDP +WINDOW_TEXT ENDS +END + +; ---------------------------------------------------------------------------- diff --git a/lib/window/cga/win_l038.asm b/lib/window/cga/win_l038.asm new file mode 100644 index 0000000000000000000000000000000000000000..a815bdff1ea8fdd8cae1d2cc883c615419caa44c --- /dev/null +++ b/lib/window/cga/win_l038.asm @@ -0,0 +1,67 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L038.ASM] +; +; VGA Palette setzen +; +; 1989 11 21 +; +; +; Static Name Aliases +; + TITLE WIN_L038.ASM + NAME win_0038 + +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _vga_getpalette + +_vga_getpalette PROC FAR + push bp + mov bp,sp + +; palette color nr = 6 +; palette color *red = 8 +; palette color *green = 12 +; palette color *blue = 16 + + mov bx, word ptr [bp+6] ; nr + mov ax, 1015h + int 10h + + xor ah, ah + mov al, dh + les bx,DWORD PTR [bp+8] ; *red + mov WORD PTR es:[bx],ax + + mov al, ch + les bx,DWORD PTR [bp+12] ; *green + mov WORD PTR es:[bx],ax + + mov al, cl + les bx,DWORD PTR [bp+16] ; *blue + mov WORD PTR es:[bx],ax + + +$EX199: + mov sp,bp + pop bp + ret + +_vga_getpalette ENDP +WINDOW_TEXT ENDS +END + +; ---------------------------------------------------------------------------- diff --git a/lib/window/cga/win_l039.asm b/lib/window/cga/win_l039.asm new file mode 100644 index 0000000000000000000000000000000000000000..34f21a0f0a0857c995568d1b8ed36073f3775ff7 --- /dev/null +++ b/lib/window/cga/win_l039.asm @@ -0,0 +1,57 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L039.ASM] +; +; VGA Palette Block lesen +; +; 1990 03 04 +; +; +; Static Name Aliases +; + TITLE WIN_L039.ASM + NAME win_0039 + +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _vga_getpalette_block + +_vga_getpalette_block PROC FAR + push bp + mov bp,sp + +; palette color nr start = 6 +; palette color count = 8 +; palette color table offset = 10 +; palette color table segment = 12 + + mov bx, word ptr [bp+6] ; nr start + mov cx, word ptr [bp+8] ; color count (table size) + mov dx, word ptr [bp+10] ; table offset + mov ax, word ptr [bp+12] ; table segment + mov es, ax + mov ax, 1017h + int 10h + +$EX199: + mov sp,bp + pop bp + ret + +_vga_getpalette_block ENDP +WINDOW_TEXT ENDS +END + +; ---------------------------------------------------------------------------- diff --git a/lib/window/cga/win_l040.asm b/lib/window/cga/win_l040.asm new file mode 100644 index 0000000000000000000000000000000000000000..81a96af8d1f7b32c96fbf40cdab2ae6c98488f10 --- /dev/null +++ b/lib/window/cga/win_l040.asm @@ -0,0 +1,53 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L040.ASM] +; +; VGA Palette Block lesen +; +; 1990 03 04 +; +; +; Static Name Aliases +; + TITLE WIN_L040.ASM + NAME win_0040 + +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _vga_palette_block_grey + +_vga_palette_block_grey PROC FAR + push bp + mov bp,sp + +; palette color nr start = 6 +; palette color count = 8 + + mov bx, word ptr [bp+6] ; nr start + mov cx, word ptr [bp+8] ; color count (table size) + mov es, ax + mov ax, 101Bh + int 10h + +$EX199: + mov sp,bp + pop bp + ret + +_vga_palette_block_grey ENDP +WINDOW_TEXT ENDS +END + +; ---------------------------------------------------------------------------- diff --git a/lib/window/cga/win_l043.asm b/lib/window/cga/win_l043.asm new file mode 100644 index 0000000000000000000000000000000000000000..6f13bb0950b8046f7b44691bba7b2a2019393beb --- /dev/null +++ b/lib/window/cga/win_l043.asm @@ -0,0 +1,60 @@ +; Static Name Aliases +; + TITLE win_l043.asm + NAME win_l043 + + .8087 +WINDOW_TEXT SEGMENT WORD PUBLIC 'CODE' +WINDOW_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WINDOW_TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_TEXT_MAX_X:WORD +EXTRN _W_TEXT_MAX_Y:WORD + +CONST SEGMENT +$T20001 DW SEG _W_TEXT_MAX_Y + ORG $+2 +$T20002 DW SEG _W_TEXT_MAX_X +CONST ENDS + +WINDOW_TEXT SEGMENT + ASSUME CS: WINDOW_TEXT + + PUBLIC _cga_get_screen_max +_cga_get_screen_max PROC FAR + + push ds + mov ax, 040h + mov ds, ax + mov al, ds:[084h] + mov ah,0 + cmp ax, 15 + jge Y_OK + mov ax, 24 +Y_OK: + inc ax + pop ds + mov es,$T20001 + mov WORD PTR es:_W_TEXT_MAX_Y, ax + + push ds + mov ax, 040h + mov ds, ax + mov ax, ds:[04Ah] + pop ds + mov es,$T20002 + mov WORD PTR es:_W_TEXT_MAX_X, ax + + ret + +_cga_get_screen_max ENDP +WINDOW_TEXT ENDS +END diff --git a/lib/window/cga/win_s031.asm b/lib/window/cga/win_s031.asm new file mode 100644 index 0000000000000000000000000000000000000000..ba965eee7f3297a99a11fa12149bf3da21b30b45 --- /dev/null +++ b/lib/window/cga/win_s031.asm @@ -0,0 +1,47 @@ +; +; FILE C:\usr\window\cga\win0cga.arc [win_l031.asm] +; +; int cga_get_mode (void) +; RETURN: aktuelle Bildschirm Modus +; +; 1989 08 20 +; + TITLE WIN_S031.asm + NAME win_s031 + .MODEL Small + + .8087 +_TEXT SEGMENT WORD PUBLIC 'CODE' +_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: _TEXT, DS: DGROUP, SS: DGROUP +_TEXT SEGMENT + ASSUME CS: _TEXT +; Line 4 + PUBLIC __cga_get_mode + +__cga_get_mode proc near + push bp + mov bp, sp + push ds + + mov ax, 040h + mov ds, ax + mov al, byte ptr ds:[049h] + mov ah, 0 + + pop ds + mov sp, bp + pop bp + ret + +__cga_get_mode endp + +_TEXT ENDS +END diff --git a/lib/window/cga/win_s032.asm b/lib/window/cga/win_s032.asm new file mode 100644 index 0000000000000000000000000000000000000000..0e384fc54d0489e0bdef3ce979ffa8269c6767b1 --- /dev/null +++ b/lib/window/cga/win_s032.asm @@ -0,0 +1,46 @@ +; +; FILE C:\usr\window\cga\win0cga.arc [win_l032.asm] +; +; int cga_get_cols (void) +; RETURN: Zahl der Spalten am Bildschirm +; +; 1989 08 20 +; + TITLE WIN_S032.asm + NAME win_s031 + .MODEL Small + + .8087 +_TEXT SEGMENT WORD PUBLIC 'CODE' +_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: _TEXT, DS: DGROUP, SS: DGROUP +_TEXT SEGMENT + ASSUME CS: _TEXT +; Line 4 + PUBLIC _cga_get_cols + +_cga_get_cols proc near + push bp + mov bp, sp + push ds + + mov ax, 040h + mov ds, ax + mov ax, word ptr ds:[04Ah] + + pop ds + mov sp, bp + pop bp + ret + +_cga_get_cols endp + +_TEXT ENDS +END diff --git a/lib/window/cga/win_s033.asm b/lib/window/cga/win_s033.asm new file mode 100644 index 0000000000000000000000000000000000000000..51a3e7e65cf2789b4d9916af0578614306180c5a --- /dev/null +++ b/lib/window/cga/win_s033.asm @@ -0,0 +1,46 @@ +; +; FILE C:\usr\window\cga\win0cga.arc [WIN_L033.asm] +; +; int cga_getpage (void) +; RETURN: aktuelle Bildschirm Seite +; +; 1989 08 20 +; + TITLE WIN_S033.asm + NAME WIN_S033 + + .8087 +_TEXT SEGMENT WORD PUBLIC 'CODE' +_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: _TEXT, DS: DGROUP, SS: DGROUP +_TEXT SEGMENT + ASSUME CS: _TEXT + + PUBLIC _cga_getpage + +_cga_getpage proc near + push bp + mov bp, sp + push ds + + mov ax, 040h + mov ds, ax + mov al, byte ptr ds:[062h] + mov ah, 0 + + pop ds + mov sp, bp + pop bp + ret + +_cga_getpage endp + +_TEXT ENDS +END diff --git a/lib/window/cga/win_s043.asm b/lib/window/cga/win_s043.asm new file mode 100644 index 0000000000000000000000000000000000000000..45b4e07d1efaf377df0031c4810986e42f8743d6 --- /dev/null +++ b/lib/window/cga/win_s043.asm @@ -0,0 +1,47 @@ +; Static Name Aliases +; + TITLE win_s043.asm + NAME win_s043 + + .8087 +_TEXT SEGMENT WORD PUBLIC 'CODE' +_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: _TEXT, DS: DGROUP, SS: DGROUP + +EXTRN _W_TEXT_MAX_X:WORD +EXTRN _W_TEXT_MAX_Y:WORD + +_TEXT SEGMENT + ASSUME CS: _TEXT + + PUBLIC _cga_get_screen_max +_cga_get_screen_max PROC NEAR + + push ds + mov ax, 040h + mov ds, ax + mov al, ds:[084h] + mov ah, 0 + inc ax + pop ds + mov WORD PTR _W_TEXT_MAX_Y, ax + + push ds + mov ax, 040h + mov ds, ax + mov ax, ds:[04Ah] + pop ds + mov WORD PTR _W_TEXT_MAX_X, ax + + ret + +_cga_get_screen_max ENDP +_TEXT ENDS +END diff --git a/lib/window/make-dos b/lib/window/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..32ac0c75aeee1a0b211c8df5424d979afef451b9 --- /dev/null +++ b/lib/window/make-dos @@ -0,0 +1,14 @@ +# +# FILE ~/usr/window/makefile +# +# latest update: 1994-09-01 +# +all : large small + +large : + llink -n0 -v -l\usr\sbr\lsbr.lib -dwindow_l.mod + del \usr\sbr\lsbr.bak + +small : + llink -n0 -v -l\usr\sbr\ssbr.lib -dwindow_s.mod + del \usr\sbr\ssbr.bak diff --git a/lib/window/makeall.bat b/lib/window/makeall.bat new file mode 100644 index 0000000000000000000000000000000000000000..2b9742703c8faea51917afb034c455a85c55e752 --- /dev/null +++ b/lib/window/makeall.bat @@ -0,0 +1,16 @@ +cd \usr\window\CGA +make -i >\usr\window\$CGA.mk +cd \usr\window\BIOS +make -i >\usr\window\$BIOS.mk +cd \usr\window\0 +make -i >\usr\window\$0.mk +cd \usr\window\1 +make -i >\usr\window\$1.mk +cd \usr\window\2 +make -i >\usr\window\$2.mk +cd \usr\window\3 +make -i >\usr\window\$3.mk +cd \usr\window\UTL +make -i >\usr\window\$UTL.mk +cd \usr\window +make >$window.mk diff --git a/lib/window/test/(dirinf).fm b/lib/window/test/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..870742a418167ce3f7c7d7339eb7803cf00098b6 --- /dev/null +++ b/lib/window/test/(dirinf).fm @@ -0,0 +1,8 @@ +# +# FILE ~/usr/window/test/(dirinf).fm +# +# written: 1994-08-20 +# latest update: 1994-08-20 +# +# ---------------------------------------------------------------------------- +palette.c check VGA palette entries diff --git a/lib/window/test/make-dos b/lib/window/test/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..1ab4ece3a5794e16d5cd023dab3dede489b73d91 --- /dev/null +++ b/lib/window/test/make-dos @@ -0,0 +1,111 @@ +# +# FILE ~/usr/window/makefile +# +# Window Programme (fuer MAGIS) +# +# +# written: 1989 08 16 +# latest update: 1994-08-24 +# +# ===================================================================== +cml=cl -Os -AL -H24 -Ic:\c5\include /c +cms=cl -Os -AS -H24 -Ic:\c5\include /c +ccl=cl -Os -AL -H24 -Ic:\c5\include +ccs=cl -Os -AS -H24 -Ic:\c5\include + +all : t1.obj palette.exe t2.exe + +t1.obj : t1.c + $(cml) t1.c + +t2.obj : t2.c + $(cml) t2.c + +t2b.obj : t2b.asm + masm /Ml t2b.asm; + +t2.exe : t2.obj t2b.obj + link t2 t2b; + +palette.exe : palette.c + $(cml) palette.c + link palette,,,c:\usr\sbr\lsbr; + +# JUNK +# Bildschirmsteuerungen =============================================== +# +# . . . . +windows.obj : win0vir2.obj win0cga.obj win0her.obj win0hers.obj ! + win1.obj win2.obj win3.obj win4.obj ! + win5.obj window.obj wmore.obj wedit.obj + objdec -m0 -owindows.obj win1.obj + +\usr\g\d.lib : windows.obj + lib \usr\g\d-+win0cga-+win1-+win2-+win3-+win4-+win5-+wmore-+wedit,\usr\g\cr.lst; + \nor\beep + +# Kernmodul : Virtuelle Versionen +# Includiert und steuert win0cga.c und win0her.c +win0vir2.obj : win0vir2.c window.h + cl -Os -AL -H24 -Ic:\c5\include /c win0vir2.c + objdec -m0 -w -d -sl 2 WINDOW_TEXT win0vir2.obj + +win0vir1.obj : win0vir1.c window.h + cl -Os -AL -H24 -Ic:\c5\include /c win0vir1.c + objdec -m0 -w -d -sl 2 WINDOW_TEXT win0vir1.obj + +# Kernmodul : CGA-Version; (urspruengliche Version) +win0cga.obj : win0cga.c window.h + cl -Os -AL -H24 -Ic:\c5\include /c win0cga.c + objdec -m0 -w -d -sl 2 WINDOW_TEXT win0cga.obj + +# Kernmodul : HERCULES-Version: Schnittstelle zu den Anwendungen +win0her.obj : win0her.c window.h + cl -Os -AL -H24 -Ic:\c5\include /c win0her.c + objdec -m0 -w -d -sl 2 WINDOW_TEXT win0her.obj + +# Kernmodul : HERCULES-Versionen: Schnittstelle zur Maschine +win0hers.obj : win0hers.asm + \asm\masm win0hers.asm; + objdec -m0 -w -d win0hers.obj + +# Zusatzmodul : +win1.obj : win1.c window.h + cl -Os -AL -H24 -Ic:\c5\include /c win1.c + objdec -m0 -w -d -sl 2 WINDOW_TEXT win1.obj + +# Zusatzmodul : +win2.obj : win2.c window.h + cl -Os -AL -H24 -Ic:\c5\include /c win2.c + objdec -m0 -w -d -sl 2 WINDOW_TEXT win2.obj + +# Zusatzmodul : +win3.obj : win3.c window.h + cl -Os -AL -H24 -Ic:\c5\include /c win3.c + objdec -m0 -w -d -sl 2 WINDOW_TEXT win3.obj + +# Zusatzmodul : +win4.obj : win4.c window.h + cl -Os -AL -H24 -Ic:\c5\include /c win4.c + objdec -m0 -w -d -sl 2 WINDOW_TEXT win4.obj + +# Zusatzmodul : +win5.obj : win5.c window.h + cl -Os -AL -H24 -Ic:\c5\include /c win5.c + objdec -m0 -w -d -sl 2 WINDOW_TEXT win5.obj + +# +wmore.obj : wmore.c + cl -Ot -AL -H24 -Ic:\c5\include /c wmore.c + objdec -m0 -w -d -sl 2 WINDOW_TEXT wmore.obj + +wedit.obj : wedit.c + cl -Ot -AL -H24 -Ic:\c5\include /c wedit.c + objdec -m0 -w -d -sl 2 WINDOW_TEXT wedit.obj + +# : alte Bildschirmsteuerung; +# : wird noch von anderen Programmen verwendet +window.obj : window.c window.h + cl -Os -AL -H24 -Ic:\c5\include /c window.c + objdec -m0 -w -d window.obj + diff --git a/lib/window/test/palette.c b/lib/window/test/palette.c new file mode 100644 index 0000000000000000000000000000000000000000..19dc9542938c9213ddb52fb8fd2a58c02533b106 --- /dev/null +++ b/lib/window/test/palette.c @@ -0,0 +1,39 @@ +/* + * FILE ~/usr/window/palette.c + * + * written: 1990 01 20 + * latest update: 1994-08-20 + * + */ + +#define W_MODEL_BIOS +#include <gg/window.h> + +/* ------------------------------------------------------------------------ */ +int main () +{ + int R= 20, G= 20, B= 20; + int k; + + w_init (0x0000); + for (;;) + { + w_setpalette (61, R, G, B); + w_prntcol (0,0,3, 13, "���������"); + w_setcup (0,0,4); + printf ("R: %3d G: %3d B: %3d\n", R, G, B); + printf ("R: %02X G: %02X B: %02X\n", R, G, B); + printf ("X: Exit\n"); + k= kbin (); + if (k == 'x') break; + switch (k) + { + case 'r': R--; if (R < 0) R= 0; break; + case 'R': R++; if (R > 63) R=63; break; + case 'g': G--; if (G < 0) G= 0; break; + case 'G': G++; if (G > 63) G=63; break; + case 'b': B--; if (B < 0) B= 0; break; + case 'B': B++; if (B > 63) B=63; break; + } + } +} diff --git a/lib/window/test/palette.map b/lib/window/test/palette.map new file mode 100644 index 0000000000000000000000000000000000000000..1b61c18637e4b3ded0d68892524ea3022bc75915 --- /dev/null +++ b/lib/window/test/palette.map @@ -0,0 +1,40 @@ + + Start Stop Length Name Class + 00000H 00121H 00122H PALETTE_TEXT CODE + 00122H 003CDH 002ACH WINDOW_TEXT CODE + 003CEH 003F8H 0002BH KEYBOARD_TEXT CODE + 003FAH 01F06H 01B0DH _TEXT CODE + 01F08H 01F08H 00000H C_ETEXT ENDCODE + 01F10H 01F51H 00042H NULL BEGDATA + 01F52H 028B3H 00962H _DATA DATA + 028B4H 028C1H 0000EH CDATA DATA + 028C2H 028C2H 00000H XIFB DATA + 028C2H 028C2H 00000H XIF DATA + 028C2H 028C2H 00000H XIFE DATA + 028C2H 028C2H 00000H XIB DATA + 028C2H 028C2H 00000H XI DATA + 028C2H 028C2H 00000H XIE DATA + 028C2H 028C2H 00000H XPB DATA + 028C2H 028C5H 00004H XP DATA + 028C6H 028C6H 00000H XPE DATA + 028C6H 028C6H 00000H XCB DATA + 028C6H 028C6H 00000H XC DATA + 028C6H 028C6H 00000H XCE DATA + 028C6H 028C6H 00000H XCFB DATA + 028C6H 028C6H 00000H XCF DATA + 028C6H 028C6H 00000H XCFE DATA + 028C6H 02933H 0006EH CONST CONST + 02934H 0293BH 00008H HDR MSG + 0293CH 02A09H 000CEH MSG MSG + 02A0AH 02A0BH 00002H PAD MSG + 02A0CH 02A0CH 00001H EPAD MSG + 02A0EH 02BA3H 00196H _BSS BSS + 02BA4H 02BA4H 00000H XOB BSS + 02BA4H 02BA4H 00000H XO BSS + 02BA4H 02BA4H 00000H XOE BSS + 02BB0H 033AFH 00800H STACK STACK + + Origin Group + 01F1:0 DGROUP + +Program entry point at 003F:001A diff --git a/lib/window/test/t1.c b/lib/window/test/t1.c new file mode 100644 index 0000000000000000000000000000000000000000..16de35a7157ebf7e7cc33e995e6e24052f32df7f --- /dev/null +++ b/lib/window/test/t1.c @@ -0,0 +1,296 @@ +/* + * FILE ~/usr/window/t1.c + * + * Generelle Test Routine fuer das WINDOW-System + * + * written: 1989 08 16 + * latest updte: 1994-08-20 + * + */ + +#define W_MODEL_CGA +#include <gg/window.h> + +/* ------------------------------------------------------------------------ */ +extern struct W_SCREEN_AND_MODES w_screen_and_modes; + +extern int W_TEXT_MAX_X, + W_TEXT_MAX_Y, + W_GRAPH_MAX_X, + W_GRAPH_MAX_Y; + +static char blit_puffer [200]; + +static int akt_mode = -1, + color = WV_GRUEN, + known_modes; + +/* ------------------------------------------------------------------------ */ +struct M +{ + int M_v; + char *M_n; +} ; + +static struct M Mm [] = +{ + { 0, "Exit", }, + { 9, "Menu" }, + { 1, "Select Mode" }, + { 2, "Text Test 1" }, + { 5, "Text Test 2" }, + { 3, "80 Z nchar" }, + { 4, "BLIT" }, + { 10, "wint" }, + { 11, "wint2" }, + { 12, "Check Mode" }, + { 13, "Show modes" }, + { 14, "Boxes" }, +} ; + +/* ------------------------------------------------------------------------ */ +int main () +{ + int i, test, test_cnt; + + w_init (0x0001); + known_modes = w_screen_and_modes.w_screen_capabilities->w_mode_count; + +MENU: + test_cnt = sizeof (Mm) / sizeof (struct M); + for (i =0; i < test_cnt; i++) + printf ("%3d: %s\n", i, Mm[i].M_n); + + for (;;) + { + w_setcup (0, 0, 0); + printf (" "); + w_setcup (0, 0, 0); + printf ("Test #: "); scanf ("%d", &test); + if (test < 0 || test >= test_cnt) continue; + test = Mm[test].M_v; + if (test == 0) break; + +TEST: + switch (test) + { case 1: test_mode (); break; + case 2: test_text_1 (); break; + case 3: test_n80 (); break; + case 4: test_blit (); break; + case 5: test_text_2 (); break; + case 9: goto MENU; + case 10: wint (); break; + case 11: wint2 (); break; + case 12: check_mode (); break; + case 13: show_modes (); break; + case 14: boxes (); break; + } + switch (getch ()) + { + case 0x0D: case 0x20: goto TEST; + } + printf ("\n"); + } + + w_init_mode (-1, 0x0001); + return 0; +} + +/* ------------------------------------------------------------------------ */ +test_mode () +{ + int i, j; + do { + show_modes (); + printf ("Select Mode: "); scanf ("%d", &j); + } while (j < -1 || j >= known_modes); + if (j == -1) return; + + w_init_mode (j, 0x0001); +} + +/* ------------------------------------------------------------------------ */ +test_n80 () +{ + int i, j; + + if (akt_mode != 80) + { + w_init_mode (-1, 0x0001); + akt_mode= 80; + } + + for (j= 24; j >= 0; j--) + for (i= 7; i >= 0; i--) + cga_setnchar (0, i*10, j, color, ((j*80+i) % 63) + 0x41, 12); + + color++; + if (color > 15) color= 1; +} + +/* ------------------------------------------------------------------------ */ +test_text_1 () +{ + int i, j; + + for (j=0; j<W_TEXT_MAX_Y; j++) + for (i=0; i<W_TEXT_MAX_X; i++) + w_setchar (0, i, j, color, ((j*40+i) % 63) + 0x41); + color++; if (color > 15) color=1; +} + +/* ------------------------------------------------------------------------ */ +test_text_2 () +{ + int i, j, v; + + for (i=2; i<W_TEXT_MAX_X; i++) w_setchar (0, i, 0, color, '0'+i/100); + for (i=2; i<W_TEXT_MAX_X; i++) w_setchar (0, i, 1, color, '0'+(i%100)/10); + for (i=2; i<W_TEXT_MAX_X; i++) w_setchar (0, i, 2, color, '0'+(i%10)); + + for (i=2; i<W_TEXT_MAX_Y; i++) w_setchar (0, 0, i, color, '0'+i/100); + for (i=2; i<W_TEXT_MAX_Y; i++) w_setchar (0, 1, i, color, '0'+(i%100)/10); + for (i=2; i<W_TEXT_MAX_Y; i++) w_setchar (0, 2, i, color, '0'+(i%10)); + + color++; if (color > 15) color=1; +} + +/* ------------------------------------------------------------------------ */ +show_modes () +{ + int i; + struct W_MODE_CAPABILITIES *wmc; + + for (i= 0; i < known_modes; i++) + { + wmc= &w_screen_and_modes.w_mode_capabilities [i]; + printf ("%s %2d %-24s %3d %3d %3d %3d %3d\n", + (w_screen_and_modes.w_screen_capabilities->w_mode_default == i) + ? "->" : " ", i, + /* wmc->w_mode_name */ "unknown", + wmc->w_text_max_x, wmc->w_text_max_y, + wmc->w_graph_max_x, wmc->w_graph_max_y, + wmc->w_graph_colors); + } +} + +/* ------------------------------------------------------------------------ */ +check_mode () +{ int m1, m2; + m1 = w_get_mode (); + m2 = _cga_get_mode (); + printf ("WINDOW-Modus: %d Bios-Modus: %d\n", m1, m2); +} + +/* ------------------------------------------------------------------------ */ +test_blit () +{ + w_init_mode (-1, 0x0001); akt_mode=80; + system ("DIR"); + + w_blit_save (blit_puffer, 0, 2, 2, 10, 10); + w_blit_load (blit_puffer, 0, 52, 2, 60, 10); +} + +/* ------------------------------------------------------------------------ */ +boxes () +{ + int yy, cc= 1; + + if (W_GRAPH_MAX_X <= 0) return; + + for (yy=0; yy<100; yy++) + wg_box (yy, yy, 319-yy, 199-yy, cc++); + for (yy=0; yy<100; yy++) + wg_box (yy, yy, 319-yy, 199-yy, cc++); + for (yy=0; yy<100; yy++) + wg_box (yy, yy, 319-yy, 199-yy, cc++); +} + +/***************************************************************************** + * + * Funktion wint + * Testprogramm fuer Herculeskarten Primitives + * 1987 10 08 + * + */ + + +wint () +{ + int x, y, v, i, mode; + + for (v = 0;; v %= 256) + { w_graphmode (); + for (x = 50; x < 200; x++) + for (y = 50; y < 200; y++) + wg_wr_dot (x, y, 0x81); + for (x = 50; x < 200; x++) + for (y = 50; y < 200; y++) + wg_wr_dot (x, y, 0x81); + + if (getch () == 0x1b) break; + } + w_reset (); +} + +/***************************************************************************** + * + * FILE wint.c + * Testprogramm fuer Herculeskarten Primitives + * 1987 10 08 + * + */ + + +wint2 () +{ + int x, y, v, i, mode; + + for (v = 0;; v %= 256) + { w_col80mode (); + for (y = 0; y < 28; y++) + { for (x = 0; x < 90; x++) + w_setnchar (0,x,y,1,v++ %256,3); + if (getch () == 0x1b) goto L1; + w_setcup (0, 0, 24); +/* w_printf ("Zeile %02x %3d ", y, y); ######### */ + } +L1: + if (getch () == 0x1b) break; + w_col40mode (); + for (y = 0; y < 28; y++) + { for (x = 0; x < 45; x++) + w_setnchar (0, x,y,1,v++ %256,3); + if (getch () == 0x1b) goto L2; + w_setcup (0, 0, 24); +/* w_printf ("Zeile %02x %3d ", y, y); ######### */ + } +L2: + if (getch () == 0x1b) break; +/* w_graphmode (); */ + for (x = 0; x < 720; x += 10) + if (kbhit ()) { if (getch () == 0x1b) goto L3; } + else for (y = 0; y < 348; y += 20) + for (i = 0; i < 12; i++) + wg_wr_dot (x, y+i, 0x81); +L3: + if (getch () == 0x1b) break; +/* w_graphmode (); */ + for (x = 0; x < 720; x++) + if (kbhit ()) { if (getch () == 0x1b) goto L4; } + else for (y = 0; y < 348; y++) + wg_wr_dot (x, y, 0x81); +L4: + if (getch () == 0x1b) break; + for (x = 0; x < 720; x++) + if (kbhit ()) { if (getch () == 0x1b) goto L5; } + else for (y = 0; y < 348; y++) + wg_wr_dot (x, y, 0x00); +L5: + if (getch () == 0x1b) break; + } + w_reset (); +} + + diff --git a/lib/window/test/t2.c b/lib/window/test/t2.c new file mode 100644 index 0000000000000000000000000000000000000000..e6a3a61d520935aad2c12cdee56d63690f4ff220 --- /dev/null +++ b/lib/window/test/t2.c @@ -0,0 +1,28 @@ +/* + * FILE ~/usr/window/t2.c + * + * written: 1990 03 03 + * latest update: 1994-08-20 + * + */ + +#include <bios.h> + +main () +{ + union REGS ra, rb; + struct SREGS sr; + int i; + long get_info(); + + ra.h.ah=0x12; + ra.h.bl=0x10; + int86x(0x10, &ra, &rb, &sr); + printf ("bh=%02X bl=%02X ch=%02X cl=%02X\n", + rb.h.bh, rb.h.bl, rb.h.ch, rb.h.cl); + for (i=0; i < 20; i++) + { + printf ("cx=%04X dx=%04X %04X:%04X\n", + get_info (i, 1), get_info (i, 0)); + } +} diff --git a/lib/window/test/t2b.asm b/lib/window/test/t2b.asm new file mode 100644 index 0000000000000000000000000000000000000000..98d083bd7849e8348bbea2f581e380f04c55b093 --- /dev/null +++ b/lib/window/test/t2b.asm @@ -0,0 +1,64 @@ +; +; FILE C:\usr\window\win0bios.arc [WIN_L014.ASM] +; +; 1989 08 16: aus WIN0.SAR �bernommen +; Revision +; + + +; Static Name Aliases +; + TITLE WIN_L014.asm + NAME win_0014 + + .8087 +WIN_L014_TEXT SEGMENT WORD PUBLIC 'CODE' +WIN_L014_TEXT ENDS +_DATA SEGMENT WORD PUBLIC 'DATA' +_DATA ENDS +CONST SEGMENT WORD PUBLIC 'CONST' +CONST ENDS +_BSS SEGMENT WORD PUBLIC 'BSS' +_BSS ENDS + +DGROUP GROUP CONST, _BSS, _DATA + ASSUME CS: WIN_L014_TEXT, DS: DGROUP, SS: DGROUP + +WIN_L014_TEXT SEGMENT + ASSUME CS: WIN_L014_TEXT + + PUBLIC _get_info + +_get_info PROC FAR + push bp + mov bp,sp + +; info_num = 6 +; info_mode = 8 + + mov cs:merke, sp + mov ax, 01130h + mov bh, BYTE PTR [bp+6] ;info_num + cmp byte PTR [bp+8], 1 + je hopp + int 010h + mov ax, bp + mov dx, es + jmp tropp + +hopp: + int 010h + mov ax,cx + +tropp: + mov sp,cs:merke + pop bp + ret + +merke dw 0 + +_get_info ENDP +WIN_L014_TEXT ENDS +END + +; ---------------------------------------------------------------------------- diff --git a/lib/window/utl/(dirinf).fm b/lib/window/utl/(dirinf).fm new file mode 100644 index 0000000000000000000000000000000000000000..8be5cbfec8a7a82e0116433d4ccc7c04abd3dae9 --- /dev/null +++ b/lib/window/utl/(dirinf).fm @@ -0,0 +1,9 @@ +# +# FILE ~/usr/window/utl/(dirinf).fm +# +# written: 1994-08-20 +# latest update: 1994-08-20 +# +# ---------------------------------------------------------------------------- +setpal.c setup VGA color palette +video.c check color codes diff --git a/lib/window/utl/make-dos b/lib/window/utl/make-dos new file mode 100644 index 0000000000000000000000000000000000000000..5404d42f98f1107d5f4f7dfaf936c53985f2ef49 --- /dev/null +++ b/lib/window/utl/make-dos @@ -0,0 +1,29 @@ +# +# FILE /usr/window/utl/makefile +# +# Diverese Utilities IBM-PC Bildschirmunterst�tzung +# +# ---------------------------------------------------------------------------- +obj=objdec -m0 -w -d +cml=cl -Ot -AL /c +incl=c:\c5\include\gg\ +inst=command /c inst-exe +bin=c:\bin\ +llib=c:\usr\sbr\lsbr + +all.exe : $(bin)video.exe $(bin)setpal.exe + +# +# Bildschirmmode Utility ===================================================== +# +$(bin)video.exe : video.c + $(cml) video.c + $(obj) video.obj + link video,$(bin)video.exe,\dev\nul,$(llib); + del video.obj + +$(bin)setpal.exe : setpal.c + $(cml) setpal.c + $(obj) setpal.obj + link setpal,$(bin)setpal.exe,\dev\nul,$(llib); + del setpal.obj diff --git a/lib/window/utl/setpal.c b/lib/window/utl/setpal.c new file mode 100644 index 0000000000000000000000000000000000000000..293f61d378e8762589af70fd7fa72cd534f5f330 --- /dev/null +++ b/lib/window/utl/setpal.c @@ -0,0 +1,410 @@ +/* + * FILE ~/usr/window/utl/setpal.c + * + * written: 1991 07 23 + * latest udpate: 1994-08-20 + * + */ + + +#include <stdio.h> +#include <bios.h> +#define W_MODEL_CGA +#include <gg/window.h> +#include <gg/keys.h> +#include <gg/filename.h> + +#define CURSOR_COL 10 +#define NAME_SIZE 16 + +static char xxlin []= +"��������������������������������������������������������������������������������"; + +static char d_fnm [66]; +static char d_tmp [66]; +static char d_bak [66]; + +/* ------------------------------------------------------------------------ */ +int cdecl main (int argc, char *argv[]); +int cdecl setpal (void); +long cdecl get_parameter_value (char *s); + +struct COLOR_PALETTE +{ + int cp_num; + int cp_r, cp_g, cp_b; + int flags; +} ; + +static struct COLOR_PALETTE color_palette [16]; + +static char VALUES [66] = "c:/etc/setpal.v"; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: setpal [options]\n", + "OPTIONS:\n", + " -f<fnm> ... settings file [DEF: c:/etc/setpal.v]\n", + " -l<set> ... load setting\n", + "EXAMPLES:\n", + "\n", + "(@)Asetpal.c 1.01 #D$1994-08-20 19:00:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv[]) +{ + int i, j; + char *setting= (char *) 0; + int setting_num; + + for (i = 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { + case 'f': case 'F': + strcpy (VALUES, &argv[i][2]); + break; + case 'l': case 'L': + setting= &argv[i][2]; + break; + +HLP: +#include <gg/help.inc> + } + + w_init (0x0000); + if (setting != (char *) 0) + { + if (*setting >= '0' && *setting <= '9') + { + setting_num= (int) get_parameter_value (setting); + } + else + { + /* ... unfinished ... */ + } + return; + } + + setpal (); + return 0; +} + +/* ------------------------------------------------------------------------ */ +int setpal () +{ + int i; + int er, r,g,b; + int key; + int col=0; + int dc=1; + int dp=1; + union REGS ra, rb; + char palette_name [40]; + int palette_number=-1; + char tmp [40]; + + palette_name[0]=0; + w_prntcol (0,0,1, WV_WEISS|W_HELL, xxlin); + w_prntcol (0,0,2, WV_WEISS|W_HELL, +"Color [Nr] ER R G B R G B"); + w_prntcol (0,0,3, WV_WEISS|W_HELL, xxlin); + for (i=0;i<16;i++) + { + ra.x.ax= 0x1007; + ra.h.bl= i; + int86 (0x10, &ra, &rb); + color_palette[i].cp_num = er = rb.h.bh; + + vga_getpalette (er, &r, &g, &b); + show_values (i, er, r, g, b); + color_palette[i].cp_r = r; + color_palette[i].cp_g = g; + color_palette[i].cp_b = b; + } + w_prntcol (0,0,20, WV_WEISS|W_HELL, xxlin); + w_prntcol (0,0,24, WV_WEISS|W_HELL, xxlin); + w_prntcol (0,44,17, WV_WEISS|W_HELL, "ESC to exit"); + w_prntcol (0,44,18, WV_WEISS|W_HELL, + "F10: dump values to c:/etc/fm.stp"); + w_prntcol (0,44,4, WV_WEISS|W_HELL, "F1: name:"); + w_prntcol (0,54,4, WV_WEISS|W_HELL, palette_name); + sprintf (tmp, "%4d", palette_number); + w_prntcol (0,44,5, WV_WEISS|W_HELL, " num:"); + w_prntcol (0,54,5, WV_WEISS|W_HELL, tmp); + + for (;;) + { + if (dp) + { + vga_setpalette ( + color_palette[col].cp_num, + color_palette[col].cp_r, + color_palette[col].cp_g, + color_palette[col].cp_b); + show_values ( + col, + color_palette[col].cp_num, + color_palette[col].cp_r, + color_palette[col].cp_g, + color_palette[col].cp_b); + show_palette ("red ", 21, color_palette[col].cp_r); + show_palette ("green", 22, color_palette[col].cp_g); + show_palette ("blue ", 23, color_palette[col].cp_b); + dp=0; + } + + if (dc=1) + { + w_setchar (0,CURSOR_COL,col+4,WV_WEISS|W_HELL,0x11); + w_setchar (0,CURSOR_COL+1,col+4,WV_WEISS|W_HELL,0x10); + dc=0; + } + + switch (key=kbin()) + { + case K_CDOWN: + if (col>=15) break; + w_setchar (0,CURSOR_COL,col+4,WV_WEISS|W_HELL,0x20); + w_setchar (0,CURSOR_COL+1,col+4,WV_WEISS|W_HELL,0x20); + col++; + dc=1; + dp=1; + break; + case K_CUP: + if (col<=0) break; + w_setchar (0,CURSOR_COL,col+4,WV_WEISS|W_HELL,0x20); + w_setchar (0,CURSOR_COL+1,col+4,WV_WEISS|W_HELL,0x20); + col--; + dc=1; + dp=1; + break; + + case 'R': + color_palette [col].cp_r++; + if (color_palette [col].cp_r >= 64) + color_palette [col].cp_r = 0; + dp=1; + break; + case 'G': + color_palette [col].cp_g++; + if (color_palette [col].cp_g >= 64) + color_palette [col].cp_g = 0; + dp=1; + break; + case 'B': + color_palette [col].cp_b++; + if (color_palette [col].cp_b >= 64) + color_palette [col].cp_b = 0; + dp=1; + break; + + case 'r': + color_palette [col].cp_r--; + if (color_palette [col].cp_r < 0) + color_palette [col].cp_r = 63; + dp=1; + break; + case 'g': + color_palette [col].cp_g--; + if (color_palette [col].cp_g < 0) + color_palette [col].cp_g = 63; + dp=1; + break; + case 'b': + color_palette [col].cp_b--; + if (color_palette [col].cp_b < 0) + color_palette [col].cp_b = 63; + dp=1; + break; + + case 'E': + if (color_palette [col].cp_num >= 63) break; + color_palette [col].cp_num++; + goto SET_EGA_POINTER; + case 'e': + if (color_palette [col].cp_num <= 0) break; + color_palette [col].cp_num--; +SET_EGA_POINTER: + ra.x.ax= 0x1000; + ra.h.bl= col; + ra.h.bh= er= color_palette [col].cp_num; + int86 (0x10, &ra, &rb); + vga_getpalette (er, &r, &g, &b); + show_values (col, er, r, g, b); + color_palette[col].cp_r = r; + color_palette[col].cp_g = g; + color_palette[col].cp_b = b; + dp=1; + break; + + case K_PF1: + w_setcup (0, 54, 4); + scanf ("%s", palette_name); + break; + + case K_PF10: + set_etc_filename (d_fnm, "fm.stp"); + set_etc_filename (d_tmp, "fm.$"); + set_etc_filename (d_bak, "fm.bak"); + if (dump_values (d_fnm, d_tmp, d_bak, color_palette) == -1) + { + w_prntcol (0,44,19, WV_WEISS|W_HELL, "error writing file"); + } + else + { + w_prntcol (0,44,19, WV_WEISS|W_HELL, "file written ok :)"); + } + break; + } + if (key==0x1B || key == K_PF7) break; + } + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int show_palette (char *s, int lin, int val) +{ + if (val > 63 || val < 0) return -1; + + w_prntcol (0, 0, lin, WV_WEISS|W_HELL,s); + w_setchar (0, 6, lin, WV_WEISS|W_HELL, ':'); + w_setnchar (0, 7, lin, WV_WEISS|W_HELL, 0x08, val); + w_setnchar (0, 7+val, lin, WV_SCHWARZ, 0x08, 63-val); + w_setchar (0, 70, lin, WV_WEISS|W_HELL, ':'); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int show_values (int col, int er, int r, int g, int b) +{ + char lin [100]; + + sprintf (lin, + " [%2d] %2d %2d %2d %2d #%02X%02X%02X", + col, er, r, g, b, r<<2, g<<2, b<<2); + w_prntcol (0, 10, col+4, WV_WEISS|W_HELL, lin); + w_setnchar (0, 0, col+4, col, 0x08, 9); + + return 0; +} + +/* ------------------------------------------------------------------------ */ +int dump_values ( +char *fnm, +char *tmp, +char *bak, +struct COLOR_PALETTE cp[16]) +{ + FILE *fi; + FILE *fo; + int i; + int num; + int ch; + int stat= 0; + char lin [100]; + int in_default= 0; + int written= 0; + + for (i= 0; i < 16; i++) cp[i].flags= 0; + + if ((fo= fopen (tmp, "wb")) == (FILE *) 0) return -1; + if ((fi= fopen (fnm, "rb")) == (FILE *) 0) + { + fclose (fo); + return -1; + } + + for (;;) + { + ch = fgetc (fi) & 0x00FF; + if (feof (fi)) goto STOP; + switch (stat) + { + case 0: + switch (ch) + { + case '@': + in_default=0; + stat=99; + fscanf (fi, "%s", lin); + if (strcmp (lin, "default") == 0) in_default=1; + if (strcmp (lin, "default-end") == 0) + { + for (i=0;i<16;i++) + { + if (cp[i].flags==0) + { + fprintf (fo, "palette %2d %2d %2d %2d\n", + cp[i].cp_num, cp[i].cp_r, cp[i].cp_g, cp[i].cp_b); + written=1; + } + } + fprintf (fo, "@%s", lin); + ftransfer (fi, fo, 0x7FFFFFFF); + goto STOP; + } + fprintf (fo, "@%s", lin); + break; + case 'p': + if (in_default) + { + fscanf (fi, "%s", lin); + if (strcmp (lin, "alette") == 0) + { + fscanf (fi, "%d", &num); + for (i=0;i<16;i++) + if (cp[i].cp_num==num) break; + if (i<16 && cp[i].cp_num==num) + { + fprintf (fo, "palette %2d %2d %2d %2d\n", + cp[i].cp_num, cp[i].cp_r, cp[i].cp_g, cp[i].cp_b); + cp[i].flags=1; + written=1; + stat=98; + } + else + { + fprintf (fo, "palette %d", num); + stat=99; + } + } + else + { + fprintf (fo, "%c%s", ch, lin); + stat=99; + } + break; + } + default: + stat=99; + case 0x0A: + fputc (ch, fo); + break; + } + break; + default: + fputc (ch, fo); + case 98: + if (ch == 0x0A) stat=0; + break; + } + } + +STOP: + fclose (fi); + fclose (fo); + if (written) + { + unlink (bak); + rename (fnm, bak); + rename (tmp, fnm); + } + return 0; +} diff --git a/lib/window/utl/video.c b/lib/window/utl/video.c new file mode 100644 index 0000000000000000000000000000000000000000..5a9a07762ad2a67f5554a337a1f6559d2ab120b2 --- /dev/null +++ b/lib/window/utl/video.c @@ -0,0 +1,288 @@ +/* + * FILE ~/usr/window/utl/video.c + * + * Einstellen der Hintergrund/Vordergrund/Border-Farben + * + * written: 1988 02 05 + * latest update: 1994-08-20 + * + */ + +#include <string.h> +#include <stdio.h> +#include <dos.h> +/******* +#define W_MODEL_CGA +#include <gg/window.h> +*******/ +#include <gg/strings.h> + +/* ------------------------------------------------------------------------ */ +#define TBL_size 19 + +#define DEF_V 0x0E +#define DEF_H 0x01 +#define DEF_B 0x04 +#define DEF_P 0x00 + +/* ------------------------------------------------------------------------ */ +static struct + { char *nm; + int value; + } definitions [TBL_size] = +{ { "BLINK", 0x08 }, { "HELL", 0x08 }, + + { "SCHWARZ", 0x00 }, { "BLAU", 0x01 }, + { "GRUEN", 0x02 }, { "KOBALT", 0x03 }, + { "ROT", 0x04 }, { "VIOLETT", 0x05 }, + { "BRAUN", 0x06 }, { "WEISS", 0x07 }, + + { "HSCHWARZ", 0x08 }, { "HBLAU", 0x09 }, + { "HGRUEN", 0x0A }, { "HKOBALT", 0x0B }, + { "HROT", 0x0C }, { "HVIOLETT", 0x0D }, + { "HBRAUN", 0x0E }, { "HWEISS", 0x0F }, + + { "GELB", 0x0E } +} ; + +/* ------------------------------------------------------------------------ */ +static int CLS = 0; + +/* ------------------------------------------------------------------------ */ +static char *HELP [] = +{ + "USAGE: video ([-Opt] (Farbe)* )*\n", + " Veraendern der Bildschirmattribute\n", + "Options: -v ... Vordergrundfarbe\n", + " -h ... Hintergrundfarbe\n", + " -b ... Umrandungsfarbe\n", + " -p <n> ... Umschalten auf Page <n>\n", + " -c ... Clear Screen\n", + " -d ... Default Farben\n", + " -m <n> ... Screen Mode\n", + " -f[m] ... Farbpalette; x -> Hex d -> Dez; Def: Name\n", + "\n", + "(@)Avideo.c 1.2 #D$1992-01-15 10:30:00\n", + "\n", +#include <gg/public.inc> +} ; + +/* ------------------------------------------------------------------------ */ +int main (int argc, char *argv []) +{ + union REGS ra, rb; + int i, j, basis = 10, mode = 0, + c_v = 0, c_h = 0, c_b = 0, page = 0; + int fp = 0, fc = 0, fb = 0, fm=0, modus; + + for (i = 1; i < argc; i++) + if (argv [i][0] == '-') + switch (argv [i][1]) + { case 'v': case 'V': mode = 1; break; + case 'h': case 'H': mode = 2; break; + case 'b': case 'B': mode = 3; break; + case 'p': case 'P': mode = 4; break; + case 'm': case 'M': mode = 5; break; + case 'd': case 'D': c_v = DEF_V; + c_h = DEF_H; + c_b = DEF_B; + page = DEF_P; + fb = fp = fc = 1; + break; + case 'c': case 'C': CLS = 1; break; + case 'f': case 'F': help (page, argv [i][2]); + return; +#include <gg/help.inc> + } + else switch (mode) + { case 1: c_v |= indent (argv [i]); fc = 1; break; + case 2: c_h |= indent (argv [i]); fc = 1; break; + case 3: c_b |= indent (argv [i]); fb = 1; break; + case 4: sscanf (argv [i], "%d", &page); fp = 1; break; + case 5: sscanf (argv [i], "%d", &modus);fm = 1; break; + } + + if (fm) xx_w_mode (modus); + if ((fc && (c_v != 0 || c_h != 0)) || CLS) + if (CLS) xx_w_cls80xx (page, c_v | (c_h << 4)); + else xx_w_cls80 (page, c_v | (c_h << 4)); + if (fp) w_selpage (page); + if (fb && c_b != 0) w_border (c_b); +} + +/* ------------------------------------------------------------------------ */ +help (page, x_mode) +int page, + x_mode; /* 1 -> Hexwerte ausgeben */ +{ + int v, h, a = 0; + char puf [14]; + + xx_w_cls80xx (page, 0x1E); + xx_w_prnt2col (page, 0, 1, 0x43, 25, "Zeilen: Vordergrund"); + xx_w_prnt2col (page, 0, 2, 0x43, 25, "Spalten: Hintergrund"); + for (h = 0; h < 8; h++) + xx_w_prnt2col (page, h*10, 4, (h) ? h : 1, 8, + definitions [h+2].nm); + switch (x_mode) + { default : + case 'n': case 'N': + for (v = 0; v < 16; v++) + for (h = 0; h < 8; h++) + xx_w_prnt2col (page, h*10, v+5, v | (h << 4), 8, + definitions [v+2].nm); + break; + case 'x': case 'X': + for (v = 0; v < 16; v++) + for (h = 0; h < 16; h++) + { + sprintf (puf, "0x%02X", h*16+v); + xx_w_prnt2col (page, h*5, v+5, + v | (h << 4), 4, puf); + } + break; + case 'd': case 'D': + for (v = 0; v < 16; v++) + for (h = 0; h < 16; h++) + { + sprintf (puf, "%3d", h*16+v); + xx_w_prnt2col (page, h*5+1, v+5, + v | (h << 4), 4, puf); + } + break; + } + xx_w_prnt2col (page, 0, 23, DEF_V | (DEF_H << 4), 25, + "Default: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); +} + +/* ------------------------------------------------------------------------ */ +indent (char *s) +{ + int i; + + for (i = 0; i < TBL_size; i++) + if (strcmp (definitions [i].nm, to_upper (s)) == 0) + return definitions [i].value; + return 0; +} + + +/* ------------------------------------------------------------------------ */ +xx_w_mode (m) +int m; +{ union REGS rega, regb; + rega.h.ah = 0; + rega.h.al = m; + int86 (0x10, ®a, ®b); +} + +/* ------------------------------------------------------------------------ */ +xx_w_cls80 (page, col) +int page, col; +{ union REGS rega, regb; + int x, y, sxy; + rega.h.ah = 3; + rega.h.bh = page; + int86 (0x10, ®a, ®b); + sxy = regb.x.dx; + for (x = 0; x < 80; x++) + for (y = 0; y < 25; y++) + { rega.h.ah = 2; + rega.h.bh = page; + rega.h.dl = x; + rega.h.dh = y; + int86 (0x10, ®a, ®b); + + rega.h.ah = 8; + rega.h.bh = page; + int86 (0x10, ®a, ®b); + + rega.h.ah = 9; + rega.h.bh = page; + rega.x.cx = 1; + rega.h.al = regb.h.al; + rega.h.bl = col; + int86 (0x10, ®a, ®b); + } + rega.h.ah = 2; + rega.h.bh = page; + rega.x.dx = sxy; + int86 (0x10, ®a, ®b); +} + +/* ------------------------------------------------------------------------ */ +xx_w_cls80xx (page, col) +int page, col; +{ + union REGS rega, regb; + rega.h.ah = 6; + rega.h.al = 0; + rega.h.ch = rega.h.cl = 0; + rega.h.dh = 24; + rega.h.dl = 79; + rega.h.bh = col; + int86 (0x10, ®a, ®b); + rega.h.ah = 2; + rega.h.bh = page; + rega.x.dx = 0; + int86 (0x10, ®a, ®b); +} + +/* ------------------------------------------------------------------------ */ +xx_w_prnt2col (p, x, y, a, m, s) +int p, x, y, a, m; +char *s; +{ + while (*s) + { + if (x > 79) break; + w_setchar (p, x++, y, a, *s++); m--; + } + while (m) + { + if (x > 79) break; + w_setchar (p, x++, y, a, ' '); m--; + } +} + +/* ------------------------------------------------------------------------ */ +#define JUNK +#ifdef JUNK +w_selpage (p) +int p; +{ union REGS rega, regb; + rega.h.ah = 5; + rega.h.al = p; + int86 (0x10, ®a, ®b); +} + +/* ------------------------------------------------------------------------ */ +w_border (col) +int col; +{ union REGS rega, regb; + rega.h.ah = 11; + rega.h.bh = 0; /* Colour Palette 0 */ + rega.h.bl = col; + int86 (0x10, ®a, ®b); +} + +/* ------------------------------------------------------------------------ */ +w_setchar (p, x, y, a, c) +int p, x, y, a, c; +{ union REGS rega, regb; + if (x < 0 || x > 79 || y < 0 || y > 24) return; + rega.h.ah = 2; + rega.h.bh = p; + rega.h.dl = x; + rega.h.dh = y; + int86 (0x10, ®a, ®b); + + rega.h.ah = 9; + rega.h.bh = p; + rega.x.cx = 1; + rega.h.al = c; + rega.h.bl = a; + int86 (0x10, ®a, ®b); +} + +#endif diff --git a/lib/window/window_l.mod b/lib/window/window_l.mod new file mode 100644 index 0000000000000000000000000000000000000000..530477e1f4794805f7980ade27a81a05eee07063 --- /dev/null +++ b/lib/window/window_l.mod @@ -0,0 +1,106 @@ +# +# FILE ~/usr/window/window_l.mod +# +# window modules for the large memory model +# +# latest update: 1995-03-05 +# +# ---------------------------------------------------------------------------- +1 cga\obj\cga_l001.obj 2e565d24 +1 cga\obj\cga_l004.obj 2e565d2a +1 cga\obj\cga_l008.obj 2b54d586 +1 cga\obj\cga_l012.obj 282d4dbe +1 cga\obj\cga_l013.obj 282d4dc0 +1 cga\obj\cga_l014.obj 282de194 +1 cga\obj\cga_l029.obj 282d4dca +1 cga\obj\cga_l030.obj 282d4dd2 +1 cga\obj\cga_l031.obj 282dec7a +1 cga\obj\cga_l032.obj 282dec7c +1 cga\obj\cga_l033.obj 282dec7e +1 cga\obj\cga_l034.obj 282d4ddc +1 cga\obj\cga_l035.obj 282d4dde +1 cga\obj\cga_l036.obj 282d4de0 +1 cga\obj\cga_l037.obj 282d4de2 +1 cga\obj\cga_l038.obj 282d4de4 +1 cga\obj\cga_l039.obj 282d4de6 +1 cga\obj\cga_l040.obj 282ded82 +1 cga\obj\cga_l041.obj 2f0025e2 +1 cga\obj\cga_l043.obj 28693b82 +1 cga\obj\cga_l044.obj 2e65a01c +1 cga\obj\cga_l045.obj 2b54d588 +1 bios\obj\biosl004.obj 26723bf6 +1 bios\obj\biosl008.obj 2b54ced4 +1 bios\obj\biosl009.obj 2dcf3a2c +1 bios\obj\biosl010.obj 2dcf3a2e +1 bios\obj\biosl011.obj 2b54d994 +1 bios\obj\biosl012.obj 26723c16 +1 bios\obj\biosl013.obj 26723c18 +1 bios\obj\biosl014.obj 282de0ec +1 bios\obj\biosl015.obj 2b54d996 +1 bios\obj\biosl016.obj 2b54ced6 +1 bios\obj\biosl018.obj 2b54d998 +1 bios\obj\biosl019.obj 2b54ced8 +1 bios\obj\biosl020.obj 2b54cedc +1 bios\obj\biosl021.obj 283f3e62 +1 bios\obj\biosl022.obj 283f498e +1 bios\obj\biosl023.obj 2b54d99c +1 bios\obj\biosl024.obj 26723c5c +1 bios\obj\biosl025.obj 26723c5e +1 bios\obj\biosl027.obj 282de590 +1 bios\obj\biosl028.obj 2b54d99e +1 bios\obj\biosl029.obj 2b54d9a0 +1 bios\obj\biosl030.obj 2b54d9a2 +1 bios\obj\biosl042.obj 26723c7e +1 bios\obj\biosl050.obj 2dcf3a32 +1 0\win_ldat.obj 31a97290 +# +1 1\obj\biosl101.obj 2efcd8f4 +1 1\obj\biosl102.obj 306ddac8 +1 1\obj\biosl103.obj 2b54dba0 +1 1\obj\biosl104.obj 2b54dba4 +1 1\obj\biosl105.obj 2b54dba6 +1 1\obj\biosl106.obj 2b54dbc8 +1 1\obj\biosl107.obj 2b54dbca +1 1\obj\biosl108.obj 2b54dbce +1 1\obj\biosl109.obj 2b54dbd0 +1 1\obj\biosl110.obj 2b54dbd4 +1 1\obj\biosl111.obj 2f59d7d4 +1 1\obj\biosl112.obj 2f59d7d8 +1 1\obj\biosl113.obj 2f59dd62 +1 1\obj\biosl114.obj 2f59dd66 +1 1\obj\biosl115.obj 2b54dbde +1 1\obj\biosl116.obj 2f59dd68 +1 1\obj\biosl117.obj 2b54dbe2 +1 1\obj\biosl118.obj 2b54dbe6 +1 1\obj\biosl119.obj 2b54dbe8 +1 1\obj\biosl120.obj 2b54dbea +1 1\obj\biosl121.obj 2b54dbee +1 1\obj\biosl122.obj 2e5659ac +1 1\obj\biosl123.obj 2e568794 +1 1\obj\biosl124.obj 306e83d4 +1 1\obj\biosl125.obj 3087683e +# +1 1\obj\cga_l101.obj 2efcd900 +1 1\obj\cga_l102.obj 306ddaca +1 1\obj\cga_l104.obj 2b54dbf8 +1 1\obj\cga_l106.obj 2b54dbfa +1 1\obj\cga_l111.obj 2f59d7dc +1 1\obj\cga_l112.obj 2f59d7e0 +1 1\obj\cga_l117.obj 2b54dc00 +1 1\obj\cga_l118.obj 2b54dc02 +1 1\obj\cga_l119.obj 2b54dc06 +1 1\obj\cga_l120.obj 2b54dc08 +1 1\obj\cga_l121.obj 2b54dc0a +1 1\obj\cga_l122.obj 2e5659b4 +1 1\obj\cga_l123.obj 2e568796 +# +1 2\biosl201.obj 2e5684b6 +1 2\biosl202.obj 2e5684b8 +1 2\biosl203.obj 2e5684bc +1 2\biosl204.obj 2e5684c0 +1 2\biosl205.obj 2e5684c4 +1 2\biosl206.obj 2e5684c8 +1 3\obj\win_l301.obj 2b55fdc0 +1 3\obj\win_l302.obj 2b55fdc2 +1 3\obj\win_l303.obj 2e568560 +# diff --git a/lib/window/window_s.mod b/lib/window/window_s.mod new file mode 100644 index 0000000000000000000000000000000000000000..9c98d1ce426f1da5573c0d9374b0498958cb9ab2 --- /dev/null +++ b/lib/window/window_s.mod @@ -0,0 +1,84 @@ +# +# FILE %win/window_s.mod +# +# latest update: 1995-03-05 +# +1 cga\obj\cga_s001.obj 2e565d2e +1 cga\obj\cga_s004.obj 2e565d36 +1 cga\obj\cga_s008.obj 2b54d592 +1 cga\obj\cga_s012.obj 2b54d594 +1 cga\obj\cga_s013.obj 2b54d596 +1 cga\obj\cga_s014.obj 2b54d598 +1 cga\obj\cga_s029.obj 267233a0 +1 cga\obj\cga_s030.obj 267233a6 +1 cga\obj\cga_s031.obj 25efe4b8 +1 cga\obj\cga_s032.obj 267233a8 +1 cga\obj\cga_s033.obj 282ded06 +1 cga\obj\cga_s034.obj 267233b0 +1 cga\obj\cga_s035.obj 267233b6 +1 cga\obj\cga_s041.obj 2f0025e4 +1 cga\obj\cga_s043.obj 282d4e42 +1 bios\obj\bioss004.obj 26723c90 +1 bios\obj\bioss008.obj 2b54cf08 +1 bios\obj\bioss009.obj 2dcf3a34 +1 bios\obj\bioss010.obj 2dcf3a36 +1 bios\obj\bioss011.obj 2b54d9a8 +1 bios\obj\bioss012.obj 2b54d9aa +1 bios\obj\bioss013.obj 2b54d9ac +1 bios\obj\bioss014.obj 2b54d9ae +1 bios\obj\bioss015.obj 2b54d9b0 +1 bios\obj\bioss016.obj 2b54cf0a +1 bios\obj\bioss018.obj 2b54d9b2 +1 bios\obj\bioss019.obj 2b54cf0c +1 bios\obj\bioss020.obj 2b54cf0e +1 bios\obj\bioss021.obj 2b54d9b4 +1 bios\obj\bioss022.obj 2b54d9b6 +1 bios\obj\bioss023.obj 2b54d9b6 +1 bios\obj\bioss024.obj 2b54d9b8 +1 bios\obj\bioss025.obj 2b54d9ba +1 bios\obj\bioss027.obj 2b54d9bc +1 bios\obj\bioss028.obj 2b54d9be +1 bios\obj\bioss029.obj 2b54d9c0 +1 bios\obj\bioss030.obj 2b54d9c2 +1 bios\obj\bioss042.obj 2b54d9c4 +1 bios\obj\bioss050.obj 2dcf3a38 +1 0\win_sdat.obj 24eec1c8 +1 1\obj\bioss101.obj 2efcd90a +1 1\obj\bioss102.obj 306ddace +1 1\obj\bioss103.obj 2b54dc14 +1 1\obj\bioss104.obj 2b54dc16 +1 1\obj\bioss105.obj 2b54dc18 +1 1\obj\bioss106.obj 2b54dc1a +1 1\obj\bioss107.obj 2b54dc1a +1 1\obj\bioss108.obj 2b54dc1c +1 1\obj\bioss109.obj 2b54dc20 +1 1\obj\bioss110.obj 2b54dc22 +1 1\obj\bioss111.obj 2f59d7e2 +1 1\obj\bioss112.obj 2f59d7e4 +1 1\obj\bioss113.obj 2f59dd6a +1 1\obj\bioss114.obj 2f59dd6c +1 1\obj\bioss115.obj 2b54dc2a +1 1\obj\bioss116.obj 2f59dd6e +1 1\obj\bioss117.obj 2b54dc2e +1 1\obj\bioss118.obj 2b54dc30 +1 1\obj\bioss119.obj 2b54dc32 +1 1\obj\bioss120.obj 2b54dc34 +1 1\obj\bioss121.obj 2b54dc36 +1 1\obj\cga_s101.obj 2efcd912 +1 1\obj\cga_s102.obj 306ddad0 +1 1\obj\cga_s104.obj 2b54dc3c +1 1\obj\cga_s106.obj 2b54dc3e +1 1\obj\cga_s111.obj 2f59d7e6 +1 1\obj\cga_s112.obj 2f59d7ea +1 1\obj\cga_s117.obj 2b54dc42 +1 1\obj\cga_s118.obj 2b54dc44 +1 1\obj\cga_s119.obj 2b54dc46 +1 1\obj\cga_s120.obj 2b54dc48 +1 1\obj\cga_s121.obj 2b54dc4a +1 2\bioss201.obj 2e5684ca +1 2\bioss202.obj 2e5684cc +1 2\bioss203.obj 2e5684d0 +1 2\bioss204.obj 2e5684d2 +1 2\bioss205.obj 2e5684d6 +1 2\bioss206.obj 2e5684d8 +# diff --git a/lib/window/xf.awk b/lib/window/xf.awk new file mode 100644 index 0000000000000000000000000000000000000000..fa82e893499b4efd6e4a8f6b298c5cd3e74b5e42 --- /dev/null +++ b/lib/window/xf.awk @@ -0,0 +1,28 @@ +# +# <gg/window.h> +BEGIN { + CLASS= ""; + con= "\\dev\\con"; +} + +$1=="#ifdef" { + CLASS= $2; + print "CLASS "CLASS >>con; + next; +} + +$1=="#endif" { + CLASS= ""; + # print "CLASS "CLASS >>con; + next; +} + +CLASS=="" { next; } + +$1=="#define" { + SYMBOL[$2":"CLASS]= $3; +} + +END { + for (s in SYMBOL) printf ("%-32s -> %s\n", s, SYMBOL[s]); +} diff --git a/misc/Mailman/README_foreign.py b/misc/Mailman/README_foreign.py new file mode 100644 index 0000000000000000000000000000000000000000..d9d795de4d6e6525fcb307caa37abb08a982b6df --- /dev/null +++ b/misc/Mailman/README_foreign.py @@ -0,0 +1,33 @@ +$Id: README_foreign.py,v 1.1 2017/09/11 12:11:49 gonter Exp $ + +==foreign.py== + +The module foreign.py can be used in a Mailman installation in the +Cgi directory to allow other (foreign) applications to authenticate +address/password pairs against a certain mailman list. This may +be useful if a website needs to restrict access based on the memberhip +of a certain mailman list. + + +===installation=== +* put foreign.py into ~mailman/Mailman/Cgi +* add a configuration clause to mm_cfg.py +* install a wrapper in cgi-bin, e.g. by patching an appropriate wrapper; +<pre> +cp private foreign +perl -pi.bak -e 's/private/foreign/g;' foreign +</pre> + + +===configuration=== +In mm_cfg.py +# Foreign Authentication Applications +FAA = { + 'x1': { 'list': 'test', 'code': 'testsecretcode', 'dt': 3600, 'rf': 'php/1' }, +} + +===TODO=== +* add code to build the wrapper script +* provide more information... + + diff --git a/misc/Mailman/changehost.py b/misc/Mailman/changehost.py new file mode 100644 index 0000000000000000000000000000000000000000..0c9aee895540ae5b2424986b1df4c8b9488bdebf --- /dev/null +++ b/misc/Mailman/changehost.py @@ -0,0 +1,20 @@ +# Usage: +# +# bin/withlist -l -r changehost test-list list.example.org https://lists.example.org/mailman/ +# + +def changehost(mlist, hn, wpu): + try: + print 'changing host names' + print 'old:' + print mlist.host_name + print mlist.web_page_url + mlist.host_name= hn + mlist.web_page_url= wpu + print 'new:' + print mlist.host_name + print mlist.web_page_url + mlist.Save() + except NotAMemberError: + print 'No address matched:', addr + diff --git a/misc/Mailman/foreign.py b/misc/Mailman/foreign.py new file mode 100644 index 0000000000000000000000000000000000000000..c1e147066d111033581778633c7cab6efe9e3dd6 --- /dev/null +++ b/misc/Mailman/foreign.py @@ -0,0 +1,164 @@ +# Copyright (C) 1998-2006 by the Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. +# +# $Id: foreign.py,v 1.1 2006/12/15 11:42:53 gonter Exp $ + +"""Provide a password-interface wrapper around private archives.""" + +import os +import sys +import cgi +import mimetypes +import md5 +import time + +from Mailman import mm_cfg +from Mailman import Utils +from Mailman import MailList +from Mailman import Errors +from Mailman import i18n +from Mailman.htmlformat import * +from Mailman.Logging.Syslog import syslog + +# Set up i18n. Until we know which list is being requested, we use the +# server's default. +_ = i18n._ +i18n.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE) + +SLASH = '/' + + + +def true_path(path): + "Ensure that the path is safe by removing .." + # Workaround for path traverse vulnerability. Unsuccessful attempts will + # be logged in logs/error. + parts = [x for x in path.split(SLASH) if x not in ('.', '..')] + return SLASH.join(parts)[1:] + + + +def guess_type(url, strict): + if hasattr(mimetypes, 'common_types'): + return mimetypes.guess_type(url, strict) + return mimetypes.guess_type(url) + + + +def main(): + # print 'Content-type: text/plain\n\n' + print 'Content-type: text/plain; charset=us-ascii\n' + + doc = Document() + doc.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE) + + parts = Utils.GetPathPieces() + if not parts: + doc.SetTitle(_("Private Archive Error")) + doc.AddItem(Header(3, _("You must specify a list."))) + print doc.Format() + return + + path = os.environ.get('PATH_INFO') + tpath = true_path(path) + if tpath <> path[1:]: + msg = _('Private archive - "./" and "../" not allowed in URL.') + doc.SetTitle(msg) + doc.AddItem(Header(2, msg)) + print doc.Format() + syslog('mischief', 'Private archive hostile path: %s', path) + return + # BAW: This needs to be converted to the Site module abstraction + true_filename = os.path.join( + mm_cfg.PRIVATE_ARCHIVE_FILE_DIR, tpath) + + listname = parts[0].lower() + + try: + mlist = MailList.MailList(listname, lock=0) + except Errors.MMListError, e: + # Avoid cross-site scripting attacks + safelistname = Utils.websafe(listname) + msg = _('No such list <em>%(safelistname)s</em>') + doc.SetTitle(_("Private Archive Error - %(msg)s")) + doc.AddItem(Header(2, msg)) + print doc.Format() + syslog('error', 'No such list "%s": %s\n', listname, e) + return + + i18n.set_language(mlist.preferred_language) + doc.set_language(mlist.preferred_language) + + cgidata = cgi.FieldStorage() + ai = cgidata.getvalue('ai', '') + ad = cgidata.getvalue('ad', '') + ts = cgidata.getvalue('ts', '') + hc = cgidata.getvalue('hc', '') + dx = cgidata.getvalue('dx', '') + + if ai=='' or ad=='' or ts=='' or hc=='': + return + + try: + papp= mm_cfg.FAA[ai] + except: + return + + now= time.time() + dt= abs(now-int(ts)) + + if dx == 'true': + print 'listname=%s' % listname + print 'ad=%s' % ad + print 'ai=%s' % ai + print ' ts=%s' % ts + print 'now=%s' % now + print ' dt=%s' % dt + print papp + print mlist + + if dt > papp['dt']: + return + + if papp['list'] != listname: + # list names not matching + return + + try: + password= mlist.getMemberPassword(ad) + except: + return + + code= papp['code'] + + ## print 'password=%s' % password + hs= SLASH.join ((ad, ts, password, code)) + md5s= md5.new(hs).hexdigest() + + if dx == 'true': + print 'code=%s' % code + print 'hs=%s' % hs + print 'md5s=%s' % md5s + + if md5s != hc: + return + + if papp['rf'] == 'php/1': + print '<?php\n$MM_AUTH=true;\n?>' + else: + print 'passt so...' + diff --git a/misc/puzzles/eurochk.pl b/misc/puzzles/eurochk.pl new file mode 100755 index 0000000000000000000000000000000000000000..98d494de35b672c538da608a0bda667552476196 --- /dev/null +++ b/misc/puzzles/eurochk.pl @@ -0,0 +1,189 @@ +#!/usr/bin/perl +# see http://www.wyae.de/docs/euroschein/ + +=head1 USAGE + +test one serial number: + + ./eurochk.pl 'X30198131849' + +test a pattern and find a valid serial number: + + ./eurochk.pl 'X30198?31849' + ./eurochk.pl '?12345678901' + +=cut + +use strict; + +use Data::Dumper; +$Data::Dumper::Indent= 1; + +my $chatty= 1; + +my %CC_Codes= +( + 'G' => 1, 'P' => 1, 'Y' => 1, + 'F' => 2, 'X' => 2, + 'E' => 3, 'N' => 3, 'W' => 3, + 'M' => 4, 'V' => 4, + 'L' => 5, 'U' => 5, + 'K' => 6, 'T' => 6, + 'J' => 7, 'S' => 7, + 'R' => 8, + 'H' => 9, 'Z' => 9, +); +my @CC_Codes= sort keys %CC_Codes; + +unless (@ARGV) +{ + system ("perldoc $0"); + exit; +} + +while (my $arg= shift (@ARGV)) +{ + if ($arg =~ m#^[A-Z]\d{11}$#) + { + euro::checksum1 ($arg); + } + elsif ($arg =~ m#^[A-Z\?][\?\d]{11}$#) + { + $chatty= 0; + euro::checksum_x (split ('|', $arg)); + } + elsif ($arg eq 'valid:') {} # nop for feeding serial numbers back into script + else + { + print "kein gueltiges Pattern [$arg]\n"; + } +} + +sub test +{ + euro::checksum1 ('x30198131849'); +} + +package euro; + +sub checksum_x +{ + my @num= @_; + + unless ($num[0] eq '?' || exists ($CC_Codes{$num[0]})) + { + print "invalid country code; allowd=", join (' ', @CC_Codes), "\n"; + return undef; + } + + my @wildcards; + my $num_wildcards= 0; + + for (my $i= 0; $i <= 11; $i++) + { + if ($num[$i] eq '?') + { + push (@wildcards, $i); + $num_wildcards++; + } + } + + my $wc1= shift (@wildcards); + + if ($wc1 eq 0) + { + foreach my $j (@CC_Codes) + { + $num[$wc1]= $j; + + if (@wildcards) + { + checksum_x (@num); + } + else + { + my ($n, $v1, $v2)= checksum2 (@num); + + if ($v1 eq 'valid' && $v2 eq 'valid') + { + print "valid: $n\n"; + } + } + } + } + else + { + for (my $j= 0; $j <= 9; $j++) + { + $num[$wc1]= $j; + if (@wildcards) + { + checksum_x (@num); + } + else + { + my ($n, $v1, $v2)= checksum2 (@num); + + if ($v1 eq 'valid' && $v2 eq 'valid') + { + print "valid: $n\n"; + } + } + } + } +} + +sub checksum1 +{ + my $num= shift; + + my @num= split ('|', $num); + $num[0]= chr(ord($num[0])-ord('a')+ord('A')) if ($num[0] gt 'a' && $num[0] <= 'z'); + + unless (exists ($CC_Codes{$num[0]})) + { + print "invalid country code; allowd=", join (' ', @CC_Codes), "\n"; + return undef; + } + + &checksum2 (@num); +} + +sub checksum2 +{ + my @num= @_; + + # print "num: ", join (' ', @num), "\n"; + my $num= join ('', @num); + my ($xsum, $sum)= zsum (@num); + my $sum_valid= ($sum == 8) ? 'valid' : 'invalid'; + print "num: ", join ('', @num, '=', $xsum, '=', $sum, '/', $sum_valid), "\n" if ($chatty); + + my $cc= shift (@num); + my ($xsum, $sum)= zsum (@num); + my $cc_valid= ($CC_Codes{$cc} == $sum) ? 'valid' : 'invalid'; + print "num: ", join ('', ' ', @num, '=', $xsum, '=', $sum, '/', $cc, '/', $cc_valid), "\n\n" if ($chatty); + + ($num, $sum_valid, $cc_valid); +} + +sub zsum +{ + my @num= @_; + + my $sum= 0; + for (my $i= 0; $i <= $#num; $i++) + { + my $n= $num[$i]; + if ($n ge 'A' && $n le 'Z') { $num[$i]= $n= ord ($n) - ord('A') + 1; } + $sum += $n; + } + my $xsum= $sum; + while ($sum >= 10) + { + $sum= ($sum%10) + int ($sum/10); + } + + ($xsum, $sum); +} +