[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff-commit] groff/contrib/chem ChangeLog README.txt chem.ma...
From: |
Bernd Warken |
Subject: |
[Groff-commit] groff/contrib/chem ChangeLog README.txt chem.ma... |
Date: |
Mon, 06 Nov 2006 23:17:25 +0000 |
CVSROOT: /cvsroot/groff
Module name: groff
Changes by: Bernd Warken <bwarken> 06/11/06 23:17:25
Modified files:
contrib/chem : ChangeLog README.txt chem.man chem.pl
contrib/chem/examples: README.txt reserpine.chem
contrib/chem/examples/122: README ch6a_pic.chem ch6b_dna.chem
chAg_circle.chem
chAi_poly_vinyl_chloride.chem
Log message:
Update chem-0.1.2
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/chem/ChangeLog?cvsroot=groff&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/chem/README.txt?cvsroot=groff&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/chem/chem.man?cvsroot=groff&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/chem/chem.pl?cvsroot=groff&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/chem/examples/README.txt?cvsroot=groff&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/chem/examples/reserpine.chem?cvsroot=groff&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/chem/examples/122/README?cvsroot=groff&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/chem/examples/122/ch6a_pic.chem?cvsroot=groff&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/chem/examples/122/ch6b_dna.chem?cvsroot=groff&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/chem/examples/122/chAg_circle.chem?cvsroot=groff&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/groff/contrib/chem/examples/122/chAi_poly_vinyl_chloride.chem?cvsroot=groff&r1=1.2&r2=1.3
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/groff/groff/contrib/chem/ChangeLog,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- ChangeLog 27 Oct 2006 07:32:50 -0000 1.2
+++ ChangeLog 6 Nov 2006 23:17:25 -0000 1.3
@@ -1,3 +1,55 @@
+2006-11-07 Bernd Warken
+ ________________________________________________________________
+ * release of chem 0.1.2
+
+ ### `chem' works now with all example files (examples/*.chem and
+ examples/122/*.chem).
+
+ * examples/122/README: Add some information on the example files.
+
+ * examples/122/chAi_poly_vinyl_chloride.chem: Use .ps with
+ argument `-2' and recall `.ps +2' at the end of the file. This
+ stops the size shift in the following files.
+
+ * examples/122/ch6b_dna.chem: Make the file runnable, it works
+ now.
+
+ * examples/reserpine.chem: Change access to `begin chem'.
+
+ * chem.man:
+ - Fix the BUGS section.
+ - Correct the name of the macro file to `macros.pic'.
+ - Extent section DESCRIPTION and LANGUAGE.
+ - Moieties and Strings: Rewritten section about moieties and
+ double quoted strings.
+
+ * chem.pl:
+ - parameter check: Add filespecs only when non-empty file.
+ - Set $Last_Type to $OTHER for the `pic' command.
+ - joinring(), label(), labsave(), reduce(): Remove these functions.
+ - `[', `]', `{', `}', `define': Make these and the defined
+ functions commands for `chem' without using the `pic' word.
+ - @Words: Fix it such that all double quoted strings are
+ completely in an element.
+ - `Last: ': Remove this prefix from all commands that are related
+ to `pic'.
+
+ ### global variables
+
+ * chem.pl:
+ - $Line: Add this variable to store the unchanged input line.
+ - %Params: Add the variables from setparams() to this hash.
+ - %Types: Add BOND, MOL, RING, OTHER from init() to this hash.
+ - %Put: Move %put to this.
+ - %Dbl: Move %dbl to this.
+ - %Labtype: Move %labtype to this.
+ - %Aromatic: Move $aromatic to this.
+ - %Dc: Move %dc to this.
+ - %Nput: Move $nput to this.
+ - %Define: New hash for storing the names of the `define'
+ constructs during `chem'. Use the elements in `%Define' as `chem'
+ commands.
+
2006-10-27 Bernd Warken
________________________________________________________________
* release of chem 0.1.1
Index: README.txt
===================================================================
RCS file: /cvsroot/groff/groff/contrib/chem/README.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- README.txt 26 Oct 2006 22:13:49 -0000 1.1
+++ README.txt 6 Nov 2006 23:17:25 -0000 1.2
@@ -15,17 +15,16 @@
version does the following changements:
- the options -h, --help, -v, --version to output usage and version
information are added.
-- remove the functions `inline', `shiftfields', and `set'.
-- remove some variables that are used only once.
+- remove some functions `inline', `shiftfields', and `set' and some
+variables that are used only once.
The subdirectory `examples/' contains example files for chem. They
-are written in the `chem' language. The file names end with .p
-because `pic' code is created by chem.
+are written in the `chem' language. The file names end with .chem.
####### License
-Last update: 19 Oct 2006
+Last update: 6 Nov 2006
Copyright (C) 2006 Free Software Foundation, Inc.
Written by Bernd Warken.
Index: chem.man
===================================================================
RCS file: /cvsroot/groff/groff/contrib/chem/chem.man,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- chem.man 26 Oct 2006 22:13:49 -0000 1.1
+++ chem.man 6 Nov 2006 23:17:25 -0000 1.2
@@ -17,7 +17,7 @@
Source file position: <groff_source_top>/contrib/chem/chem.man
Installed position: $prefix/share/man/man1/@address@hidden
-Last update: 23 Oct 2006
+Last update: 2 Nov 2006
..
.de author
This file was written by
@@ -243,6 +243,11 @@
.SH DESCRIPTION
.\" --------------------------------------------------------------------
.
+.I chem
+produces chemical structure diagrams.
+.
+Today's version is best suited for organic chemistry (bonds, rings).
+.
The
.B @address@hidden
program is a
@@ -253,9 +258,13 @@
.BR @address@hidden ,
etc.
.
-It produces chemical structure diagrams.
-.
-Today's version is best suited for organic chemistry (bonds, rings).
+It generates
+.I pic
+output such that all
+.I chem
+parts are translated into diagrams of the
+.I pic
+language.
.
.
.P
@@ -266,11 +275,31 @@
It tells
.B @address@hidden
to include a copy of
-.File_name chem.macros
+.File_name macros.pic
that is installed in the
-.B groff
+.I groff
lib directory
-.BR @libdir@/groff/chem .
+.File_name @libdir@/groff/chem .
+.
+This file contains macros written in the
+.I pic
+language.
+.
+Moreover the
+.I groff
+source file
+.File_name pic.tmac
+is loaded.
+.
+This redefines the
+.I pic
+initialization requests
+.B .PS
+and
+.B .PE
+such that all
+.I pic
+diagrams are centered in the display.
.
.
.P
@@ -278,22 +307,35 @@
.I eqn
and
.IR pic ,
+the
+.I chem
diagrams are written in a special language.
.
+.
+.P
A set of
.I chem
-lines must be written between the lines
+lines must be written between the initialization lines
.B .cstart
before and
.B .cend
after.
.
-Anything outside
-these is copied through intact; whatever is between
-.B .cstart
-and
-.B .cend
-is converted into
+In
+.I pic
+context, i.e. after the call of
+.BR .PS ,
+.I chem
+input can optionally be started by the line
+.B \%begin\~chem
+and ended by the line with the single word
+.B end
+instead.
+.
+.
+.P
+Anything outside these initialization lines is copied through intact;
+whatever is between the initialization lines is converted into
.I pic
commands to draw the diagram.
.
@@ -348,23 +390,68 @@
.
The
.I chem
-input language is rather small. It provides bonds of several styles,
+input language is rather small. It provides rings of several styles
+and a way to glue them together as desired, bonds of several styles,
moieties (e.g.,
.BR C ,
.BR NH3 ,
-\*[Ellipsis]), rings of several styles, and a way to glue them together
-as desired.
+\*[Ellipsis]) and strings.
.
-In addition, since
-.B @address@hidden
-is a
-.B @address@hidden
-preprocessor, it's possible to include
-.I pic
-statements in the middle of a diagram to draw things not provided for
-by
-.I chem
-itself.
+.
+.\" --------------------------------------------------------------------
+.SS Setting Variables:
+.\" --------------------------------------------------------------------
+.
+There are some variables that can be set by commands.
+.
+Such commands have 2 possible forms, either
+.br
+.RS
+.I "variable value"
+.RE
+.br
+or
+.br
+.RS
+.IB "variable " = " value"
+.RE
+.
+.
+.P
+This sets the given
+.I variable
+to the argument
+.IR value .
+If more arguments are given only the last argument is taken, all other
+arguments are ignored.
+.
+.
+.P
+There are only a few variables to be set by these commands:
+.
+.TP
+.BI textht " arg"
+this sets the height of the text to
+.IR arg ;
+default is 0.16.
+.
+.TP
+.BI cwid " arg"
+this sets the character widht to
+.IR arg ;
+default is 0.12.
+.
+.TP
+.BI db " arg"
+this sets the bond length to
+.IR arg ;
+default is 0.2.
+.
+.TP
+.BI size " arg"
+scales the diagram so it looks plausible at point size
+.IR arg ;
+default is 10 point.
.
.
.\" --------------------------------------------------------------------
@@ -447,75 +534,6 @@
.
.
.\" --------------------------------------------------------------------
-.SS Names:
-.\" --------------------------------------------------------------------
-.
-In the alkyl chain above, notice that the carbon atom
-.B C
-was used both to draw something and as the name for a place.
-.
-A moiety always defines a name for a place; you can use
-your own names for places instead, and indeed, for rings
-you will have to.
-.
-A name is just
-.
-.IP
-.IB Name :
-\*[Ellipsis]
-.
-.
-.P
-.I Name
-is often the name of a moiety like
-.BR CH3 ,
-but it needn't be.
-.
-Any name that begins with a capital letter and contains only letters
-and numbers is ok:
-.
-.RS
-.TP
-.B First:
-.B bond
-.TP+
-\&
-.B bond 30 from First
-.RE
-.
-.
-.\" --------------------------------------------------------------------
-.SS Moieties:
-.\" --------------------------------------------------------------------
-.
-A moiety is a string of characters beginning with a capital letter,
-such as N(C2H5)2.
-.
-Numbers are converted to subscripts (unless they appear to be
-fractional values, as in N2.5H). The moiety names itself after
-special characters have been stripped out: N(C2H5)2) has the name
-NC2H52.
-
-.B BP
-is a special
-.I branch point
-(i.e., line crossing) that doesn't print.
-.
-Normally a moiety is placed right after the last thing mentioned, but
-it may be positioned by
-.IR pic -like
-commands, e.g.,
-.
-.IP
-.B CH3 at C + (0.5,0.5)
-.
-.
-.P
-Text within quotes "\*[Ellipsis]" is treated more or less like a
-moiety except that no changes are made to the quoted part.
-.
-.
-.\" --------------------------------------------------------------------
.SS Rings:
.\" --------------------------------------------------------------------
.
@@ -649,6 +667,139 @@
.
.
.\" --------------------------------------------------------------------
+.SS Moieties and Strings:
+.\" --------------------------------------------------------------------
+.
+A moiety is a string of characters beginning with a capital letter,
+such as N(C2H5)2.
+.
+Numbers are converted to subscripts (unless they appear to be
+fractional values, as in N2.5H).
+.
+The name of a moiety is determined from the moiety after special
+characters have been stripped out: e.g., N(C2H5)2) has the name NC2H52.
+.
+.
+.P
+Moieties can be specified in 2 kinds.
+.
+Normally a moiety is placed right after the last thing mentioned,
+separated by a semicolon surrounded by spaces, e.g.,
+.
+.IP
+.B B1: bond ; OH
+.
+.P
+Here the moiety is
+.BR OH ;
+it is set after a bond.
+.
+.
+.P
+As the second kind a moiety can be positioned as the first word in a
+.IR pic -like
+command, e.g.,
+.
+.IP
+.B CH3 at C + (0.5,0.5)
+.
+.P
+Here the moiety is
+.BR CH3 .
+It is placed at a position relative to
+.BR C ,
+a former used moiety.
+.
+.
+.P
+So moiety names can be specified as
+.I chem
+positions everywhere in the
+.I chem
+code.
+.
+Beneath their printing moieties are names for places.
+.
+.
+.P
+The moiety
+.P
+.B BP
+is special.
+.
+It is not printed, but just serves as a mark to be referred to in later
+.I chem
+commands.
+.
+For example,
+.
+.IP
+.B bond ; BP
+.
+.P
+sets a mark at the end of the bond.
+.
+This can be used later on for specifying a place.
+.
+The name
+.BP BP
+is derived from
+.I branch point
+(i.e., line crossing).
+.
+.
+.P
+A string within double quotes
+.B \[dq]
+is interpreted as a part of a
+.I chem
+command.
+.
+It is a string that should be printed (without the quotes).
+.
+Text within quotes "\*[Ellipsis]" is treated more or less like a
+moiety except that no changes are made to the quoted part.
+.
+.
+.\" --------------------------------------------------------------------
+.SS Names:
+.\" --------------------------------------------------------------------
+.
+In the alkyl chain above, notice that the carbon atom
+.B C
+was used both to draw something and as the name for a place.
+.
+A moiety always defines a name for a place; you can use
+your own names for places instead, and indeed, for rings
+you will have to.
+.
+A name is just
+.
+.IP
+.IB Name :
+\*[Ellipsis]
+.
+.
+.P
+.I Name
+is often the name of a moiety like
+.BR CH3 ,
+but it needn't be.
+.
+Any name that begins with a capital letter and contains only letters
+and numbers is ok:
+.
+.RS
+.TP
+.B First:
+.B bond
+.TP+
+\&
+.B bond 30 from First
+.RE
+.
+.
+.\" --------------------------------------------------------------------
.SS Miscellaneous:
.\" --------------------------------------------------------------------
.
@@ -711,6 +862,103 @@
.
.
.\" --------------------------------------------------------------------
+.SS Non-chem Commands:
+.\" --------------------------------------------------------------------
+.
+All
+.I roff
+requests are passed through witout change.
+.
+These are lines starting with a dot
+.B .
+or a single quote
+.BR ' .
+.
+.
+.P
+All lines starting with
+.B #
+as first non-space character are interpreted as comments and are
+ignored just like in
+.IR pic .
+When a word in a line starts with
+.B #
+it is regarded as the beginning of a comment.
+.
+So this part is ignored in the line.
+.
+But
+.B #
+characters within words are kept.
+.
+.
+.P
+Since
+.B @address@hidden
+is a
+.B @address@hidden
+preprocessor, it's possible to include
+.I pic
+statements in the middle of a diagram to draw things not provided for
+by
+.I chem
+itself.
+.
+Such
+.I pic
+statements should be included in
+.I chem
+code by adding
+.B pic
+as the first word of this line.
+.
+But nevertheless, all lines that are not handled by
+.I chem
+are transferred to
+.IR pic .
+.
+.
+.P
+The following
+.I pic
+commands are accepted as
+.I chem
+commands, so no
+.B pic
+command word is needed:
+.
+.TP
+.B define
+the definition of
+.I pic
+macros within
+.IR chem .
+.
+.TP
+.B [
+the beginning of a block composite.
+.
+.TP
+.B ]
+the end of a block composite.
+.
+.TP
+.B {
+the beginning of a macro definition.
+.
+.TP
+.B }
+the end of a macro definition.
+.
+.P
+The macro names from
+,B define
+statements are stored and their call is accepted as
+.I chem
+command as well.
+.
+.
+.\" --------------------------------------------------------------------
.SS WISH LIST
.\" --------------------------------------------------------------------
.
@@ -765,9 +1013,14 @@
.
Include a complete, self-contained example that will allow the bug to
be reproduced, and say which version of
-.B @address@hidden
+.I groff
+and
+.I chem
you are using.
.
+You can get both version numbers by calling
+.BR "@address@hidden --version" .
+.
.
.P
You can also use the
Index: chem.pl
===================================================================
RCS file: /cvsroot/groff/groff/contrib/chem/chem.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- chem.pl 27 Oct 2006 07:32:50 -0000 1.2
+++ chem.pl 6 Nov 2006 23:17:25 -0000 1.3
@@ -30,8 +30,8 @@
# settings
########################################################################
-my $Program_Version = '0.1.1';
-my $Last_Update = '27 Oct 2006';
+my $Program_Version = '0.1.2';
+my $Last_Update = '7 Nov 2006';
# this setting of the groff version is only used before make is run,
# otherwise @VERSION@ will set it.
@@ -115,7 +115,7 @@
}
if ($dbl_minus) {
if (-f $_) {
- push @filespec, $_;
+ push @filespec, $_ if -s $_;
} else {
warn "chem: argument $_ is not an existing file.\n";
$wrong = 1;
@@ -139,7 +139,7 @@
exit 0;
}
if (-f $_) {
- push @filespec, $_;
+ push @filespec, $_ if -s $_;
} else {
$wrong = 1;
if (/^-/) {
@@ -164,7 +164,7 @@
# main process
########################################################################
-my %dc = ( 'up' => 0, 'right' => 90, 'down' => 180, 'left' => 270,
+my %Dc = ( 'up' => 0, 'right' => 90, 'down' => 180, 'left' => 270,
'ne' => 45, 'se' => 135, 'sw' => 225, 'nw' => 315,
0 => 'n', 90 => 'e', 180 => 's', 270 => 'w',
30 => 'ne', 45 => 'ne', 60 => 'ne',
@@ -172,7 +172,6 @@
210 => 'sw', 225 => 'sw', 240 => 'sw',
300 => 'nw', 315 => 'nw', 330 => 'nw',
);
-my $RSTART;
my $Word_Count;
my @Words;
@@ -182,36 +181,29 @@
# from init()
my $First_Time = 1;
-my $RING;
-my $MOL;
-my $BOND;
-my $OTHER;
-my $Last;
+my $Last_Type;
my $Dir; # direction
+my %Types = (
+ 'RING' => 'R',
+ 'MOL' => 'M',
+ 'BOND' => 'B',
+ 'OTHER' => 'O' # manifests
+ );
# from setparams()
-my $lineht;
-my $linewid;
-my $textht;
-my $db;
-my $cwid;
-my $cr;
-my $crh;
-my $crw;
-my $dav;
-my $dew;
-my $ringside;
-my $dbrack;
+my %Params;
# from ring()
-my $nput;
-my $aromatic;
-my %put;
-my %dbl;
+my $Nput;
+my $Aromatic;
+my %Put;
+my %Dbl;
-my %labtype;
+my %Labtype;
+my %Define = ();
my $File_Name = '';
+my $Line = '';
&main();
@@ -227,19 +219,22 @@
my $count_minus = 0;
my @stdin = ();
my $stdin = 0;
+
+ # for centralizing the pic code
+ open TMAC, "<$File_pic_tmac";
+ print <TMAC>;
+ close TMAC;
+
foreach (@ARGV) {
$count_minus++ if /^-$/;
}
+
foreach my $arg (@ARGV) {
&setparams(1.0);
next unless $arg;
$Line_No = 0;
$is_pic = '';
$is_chem = '';
- # for centralizing the pic code
- open TMAC, "<$File_pic_tmac";
- print <TMAC>;
- close TMAC;
if ($arg eq '-') {
$File_Name = 'standard input';
if ($stdin) {
@@ -277,6 +272,8 @@
#
sub main_line {
my $line = $_[0];
+# $Last_Type = $Types{'OTHER'};
+# $Last_Type = '';
my $stack;
$Line_No++;
chomp $line;
@@ -288,21 +285,46 @@
} else {
$former_line = '';
}
+ $Line = $line;
{
+ @Words = ();
my $s = $line;
- $s =~ s/^\s+//;
+ $s =~ s/^\s*//;
$s =~ s/\s+$//;
return 1 unless $s;
- @Words = split(/\s+/, $s);
- return 1 unless @Words;
- foreach my $i (0..$#Words) {
- if ($Words[$i] =~ /^\s*#/) {
- $#Words = $i - 1;
- last;
+ $s = " $s";
+ $s =~ s/\s+#.*$// if $is_pic;
+ return 1 unless $s;
+ $line = $s;
+ $line =~ s/^\s*|\s*$//g;
+ my $bool = 1;
+ while ($bool) {
+ $s =~ /^([^"]*)\s("[^"]*"?\S*)(.*)$/;
+ if (defined $1) {
+ my $s1 = $1;
+ my $s2 = $2;
+ $s = $3;
+ $s1 =~ s/^\s*|\s*$//g;
+ push @Words, split(/\s+/, $s1) if $s1;
+ push @Words, $s2;
+ }
+ if ($s !~ /\s"/) {
+ $s =~ s/^\s*|\s*$//g;
+ push @Words, split(/\s+/, $s) if $s;
+ $bool = 0;
}
}
+
+# @Words = split(/\s+/, $s);
return 1 unless @Words;
+# foreach my $i (0..$#Words) {
+# if ($Words[$i] =~ /^\s*#/) {
+# $#Words = $i - 1;
+# last;
+# }
+# }
+# return 1 unless @Words;
}
if ($line =~ /^([\.']\s*PS\s*)|([\.']\s*PS\s.+)$/) {
@@ -393,6 +415,7 @@
print "$line\n";
return 1;
}
+
if ($Words[0] eq 'pic') {
# pic pass-thru
return 1 if $#Words == 0;
@@ -400,8 +423,11 @@
$s =~ /^\s*pic\s*(.*)$/;
$s = $1;
print "$s\n" if $s;
+ $Last_Type = $Types{'OTHER'};
+ $Define{ $Words[2] } = 1 if $#Words >= 2 && $Words[1] eq 'define';
return 1;
}
+
if ($Words[0] eq 'textht') {
if ($#Words == 0) {
&error("`textht' needs a single argument.");
@@ -410,11 +436,11 @@
&error("only the last argument is taken for `textht', " .
"all others are ignored.")
unless $#Words <= 1 or ($#Words == 2 && $Words[1] =~ /^=/);
- $textht = $Words[$#Words];
+ $Params{'textht'} = $Words[$#Words];
return 1;
}
### main_line()
- if ($Words[0] eq 'cwid') {
+ if ($Words[0] eq 'cwid') { # character width
if ($#Words == 0) {
&error("`cwid' needs a single argument.");
return 0;
@@ -422,10 +448,10 @@
&error("only the last argument is taken for `cwid', " .
"all others are ignored.")
unless $#Words <= 1 or ($#Words == 2 && $Words[1] =~ /^=/);
- $cwid = $Words[$#Words];
+ $Params{'cwid'} = $Words[$#Words];
return 1;
}
- if ($Words[0] eq 'db') {
+ if ($Words[0] eq 'db') { # bond length
if ($#Words == 0) {
&error("`db' needs a single argument.");
return 0;
@@ -433,10 +459,10 @@
&error("only the last argument is taken for `db', " .
"all others are ignored.")
unless $#Words <= 1 or ($#Words == 2 && $Words[1] =~ /^=/);
- $db = $Words[$#Words];
+ $Params{'db'} = $Words[$#Words];
return 1;
}
- if ($Words[0] eq 'size') {
+ if ($Words[0] eq 'size') { # size for all parts of the whole diagram
my $size;
if ($#Words == 0) {
&error("`size' needs a single argument.");
@@ -455,28 +481,42 @@
}
### main_line()
- print "\n#", $line, "\n"; # debugging, etc.
+ print "\n#", $Line, "\n"; # debugging, etc.
$Last_Name = '';
+# $Last_Type = $Types{'OTHER'};
+# $Last_Type = '';
if ($Words[0] =~ /^[A-Z].*:$/) {
# label; falls thru after shifting left
- my $w0 = $Words[0];
- $Last_Name = $w0;
+ my $w = $Words[0];
+ $Last_Name = $w;
$Last_Name =~ s/:$//;
- print "$w0";
+ print "$w";
shift @Words;
if (@Words) {
print " ";
- $line =~ s/^\s*$w0\s*//;
+ $line =~ s/^\s*$w\s*//;
} else {
print "\n";
return 1;
}
}
+ if ($Words[0] eq 'define') {
+ print "$line\n";
+ $Define{ $Words[1] } = 1 if $#Words >= 1;
+ $Last_Type = $Types{'OTHER'};
+ return 1;
+ }
+ if ($Words[0] =~ /^[\[\]{}]/) {
+ print "$line\n";
+ $Last_Type = $Types{'OTHER'};
+ return 1;
+ }
+
if ($Words[0] =~ /^"/) {
print 'Last: ', $line, "\n";
- $Last = $OTHER;
+ $Last_Type = $Types{'OTHER'};
return 1;
}
@@ -493,7 +533,6 @@
&bond($Words[0]);
return 1;
}
-
if ($Words[0] eq 'aromatic') {
my $temp = $Words[0];
$Words[0] = $Words[1] ? $Words[1] : '';
@@ -525,18 +564,32 @@
$stack--;
return 1;
}
- if ($Words[0] eq 'label') {
- &label();
+ if ($Words[0] eq 'label') { # prints the vertex numbers in a ring
+ if ( exists $Labtype{$Words[1]} and
+ $Labtype{$Words[1]} =~ /^$Types{'RING'}/ ) {
+ my $v = substr($Labtype{$Words[1]}, 1, 1);
+ $Words[1] = '' unless $Words[1];
+ foreach my $i ( 1..$v ) {
+ printf "\"\\s-3%d\\s0\" at 0.%d<%s.C,%s.V%d>\n", $i, $v + 2,
+ $Words[1], $Words[1], $i;
+ }
+ } else {
+ &error("$Words[1] is not a ring.");
+ }
return 1;
}
- if ($Words[0] =~ '[\[\]]') {
+
+ if ( exists $Define{ $Words[0] } ) {
print $line, "\n";
+ $Last_Type = $Types{'OTHER'};
return 1;
}
- if ($line) {
- print 'Last: ', $line, "\n";
- $Last = $OTHER;
- }
+ return 1 unless $line;
+# print STDERR "# $Line\n";
+# &error('This is not a chem command. To include a command for pic, ' .
+# "add `pic' as the first word to the command.");
+ print $line, "\n";
+ $Last_Type = $Types{'OTHER'};
1;
} # main_line()
@@ -576,8 +629,9 @@
$s =~ s/\./\\v#-.3m#.\\v#.3m#/g;
}
sprintf( "atom(\"%s\", %g, %g, %g, %g, %g, %g)",
- $s, ($n - $nsub / 2) * $cwid, $textht,
- ($cloc - $nsubc / 2 + 0.5) * $cwid, $crh, $crw, $dav
+ $s, ($n - $nsub / 2) * $Params{'cwid'}, $Params{'textht'},
+ ($cloc - $nsubc / 2 + 0.5) * $Params{'cwid'}, $Params{'crh'},
+ $Params{'crw'}, $Params{'dav'}
);
} # atom()
@@ -587,22 +641,22 @@
#
sub bond {
my ($type) = @_;
- my ($i, $goes, $from, $leng);
- $goes = '';
+ my ($i, $moiety, $from, $leng);
+ $moiety = '';
for ($i = 1; $i <= $#Words; $i++) {
if ($Words[$i] eq ';') {
&error("a colon `;' must be followed by a space and a single word.")
if $i != $#Words - 1;
- $goes = $Words[$i + 1] if $#Words > $i;
+ $moiety = $Words[$i + 1] if $#Words > $i;
$#Words = $i - 1;
last;
}
}
- $leng = $db;
+ $leng = $Params{'db'}; # bond length
$from = '';
for ($Word_Count = 1; $Word_Count <= $#Words; ) {
if ($Words[$Word_Count] =~
- /(\+|-)?[0-9]+|up|down|right|left|ne|se|nw|sw/) {
+ /(\+|-)?\d+|up|down|right|left|ne|se|nw|sw/) {
$Dir = &cvtdir($Dir);
} elsif ($Words[$Word_Count] =~ /^leng/) {
$leng = $Words[$Word_Count + 1] if $#Words > $Word_Count;
@@ -626,16 +680,14 @@
if ($from =~ /( to )|^to/) { # said "from ... to ...", so zap length
$leng = 0;
} elsif (! $from) { # no from given at all
- $from = 'from Last.' . &leave($Last, $Dir) . ' ' .
+ $from = 'from Last.' . &leave($Last_Type, $Dir) . ' ' .
&fields($Word_Count, $#Words);
}
printf "Last: %s(%g, %g, %s)\n", $type, $leng, $Dir, $from;
- $Last = $BOND;
- if ($Last_Name) {
- &labsave($Last_Name, $Last, $Dir);
- }
- if ($goes) {
- @Words = ($goes);
+ $Last_Type = $Types{'BOND'};
+ $Labtype{$Last_Name} = $Last_Type if $Last_Name;
+ if ($moiety) {
+ @Words = ($moiety);
&molecule();
}
} # bond()
@@ -653,9 +705,9 @@
$t = 'line';
}
printf "%s from last [].sw+(%g,0) to last [].sw to last [].nw to last " .
- "[].nw+(%g,0)\n", $t, $dbrack, $dbrack;
+ "[].nw+(%g,0)\n", $t, $Params{'dbrack'}, $Params{'dbrack'};
printf "%s from last [].se-(%g,0) to last [].se to last [].ne to last " .
- "[].ne-(%g,0)\n", $t, $dbrack, $dbrack;
+ "[].ne-(%g,0)\n", $t, $Params{'dbrack'}, $Params{'dbrack'};
if ($Words[2] && $Words[2] eq 'sub') {
printf "\" %s\" ljust at last [].se\n", &fields(3, $#Words);
}
@@ -665,25 +717,28 @@
##########
# corner(<dir>)
#
+# Return the corner name next to the given angle.
+#
sub corner {
my ($d) = @_;
- $dc{&reduce(45 * int(($d + 22.5) / 45))};
+ $Dc{ (45 * int(($d + 22.5) / 45)) % 360 };
} # corner()
##########
# cvtdir(<dir>)
#
+# Maps "[pointing] somewhere" to degrees.
+#
sub cvtdir {
my ($d) = @_;
- # maps "[pointing] somewhere" to degrees
if ($Words[$Word_Count] eq 'pointing') {
$Word_Count++;
}
- if ($Words[$Word_Count] =~ /^[+\\-]?[0-9]+/) {
- return &reduce($Words[$Word_Count++]);
+ if ($Words[$Word_Count] =~ /^[+\\-]?\d+/) {
+ return ( $Words[$Word_Count++] % 360 );
} elsif ($Words[$Word_Count] =~ /left|right|up|down|ne|nw|se|sw/) {
- return &reduce($dc{$Words[$Word_Count++]});
+ return ( $Dc{$Words[$Word_Count++]} % 360 );
} else {
$Word_Count++;
return $d;
@@ -704,9 +759,9 @@
$v1 = substr($Words[$Word_Count], 0, 1);
$v2 = substr($Words[$Word_Count], 2, 1);
if ($v2 == $v1 + 1 || $v1 == $v && $v2 == 1) { # e.g., 2,3 or 5,1
- $dbl{$v1} = $d;
+ $Dbl{$v1} = $d;
} elsif ($v1 == $v2 + 1 || $v2 == $v && $v1 == 1) { # e.g., 3,2 or
1,5
- $dbl{$v2} = $d;
+ $Dbl{$v2} = $d;
} else {
&error(sprintf("weird %s bond in\n\t%s", $d, $_));
}
@@ -721,8 +776,8 @@
my $n;
$Word_Count++; # skip "from"
$n = $Words[$Word_Count];
- if (defined $labtype{$n}) { # "from Thing" => "from Thing.V.s"
- return 'from ' . $n . '.' . &leave($labtype{$n}, $Dir);
+ if (defined $Labtype{$n}) { # "from Thing" => "from Thing.V.s"
+ return 'from ' . $n . '.' . &leave($Labtype{$n}, $Dir);
}
if ($n =~ /^\.[A-Z]/) { # "from .V" => "from Last.V.s"
return 'from Last' . $n . '.' . &corner($Dir);
@@ -749,12 +804,11 @@
#
sub fields {
my ($n1, $n2) = @_;
- my ($i, $s);
if ($n1 > $n2) {
return '';
}
- $s = '';
- for ($i = $n1; $i <= $n2; $i++) {
+ my $s = '';
+ foreach my $i ($n1..$n2) {
if ($Words[$i] =~ /^#/) {
last;
}
@@ -770,82 +824,33 @@
sub init {
if ($First_Time) {
printf "copy \"%s\"\n", $File_macros_pic;
- printf "\ttextht = %g; textwid = .1; cwid = %g\n", $textht, $cwid;
- printf "\tlineht = %g; linewid = %g\n", $lineht, $linewid;
+ printf "\ttextht = %g; textwid = .1; cwid = %g\n",
+ $Params{'textht'}, $Params{'cwid'};
+ printf "\tlineht = %g; linewid = %g\n",
+ $Params{'lineht'}, $Params{'linewid'};
$First_Time = 0;
}
printf "Last: 0,0\n";
- $RING = 'R';
- $MOL = 'M';
- $BOND = 'B';
- $OTHER = 'O'; # manifests
- $Last = $OTHER;
+ $Last_Type = $Types{'OTHER'};
$Dir = 90;
} # init()
##########
-# joinring(<type>, <dir>, <last>)
-#
-sub joinring {
- my ($type, $d, $last) = @_;
- # join a ring to something
- if (substr($last, 0, 1) eq $RING) {
- # ring to ring
- if (substr($type, 2) eq substr($last, 2)) { # fails if not 6-sided
- return 'with .V6 at Last.V2';
- }
- }
- # if all else fails
- sprintf('with .%s at Last.%s',
- &leave($type, $d + 180), &leave($last, $d));
-} # joinring()
-
-
-##########
-# label()
-#
-sub label {
- my ($i, $v);
- if (! exists $labtype{$Words[1]} or ! $RING or
- substr($labtype{$Words[1]}, 0, 1) ne $RING) {
- &error(sprintf('%s is not a ring', $Words[1]));
- } else {
- $v = substr($labtype{$Words[1]}, 1, 1);
- $Words[1] = '' unless $Words[1];
- for ($i = 1; $i <= $v; $i++) {
- printf "\"\\s-3%d\\s0\" at 0.%d<%s.C,%s.V%d>\n", $i, $v + 2,
- $Words[1], $Words[1], $i;
- }
- }
-} # label()
-
-
-##########
-# labsave(<name>, <type>, <dir>)
-#
-sub labsave {
- my ($name, $type, $d) = @_;
- $labtype{$name} = $type;
-# $labdir{$name} = $d;
-} # labsave()
-
-
-##########
# leave(<last>, <d>)
#
sub leave {
my ($last, $d) = @_;
my ($c, $c1);
- # return vertex of last in dir d
- if ($last eq $BOND) {
+ # return vertex of $last in direction $d
+ if ( $last eq $Types{'BOND'} ) {
return 'end';
}
- $d = &reduce($d);
- if (substr($last, 0, 1) eq $RING) {
+ $d %= 360;
+ if ( $last =~ /^$Types{'RING'}/ ) {
return &ringleave($last, $d);
}
- if ($last eq $MOL) {
+ if ( $last eq $Types{'MOL'} ) {
if ($d == 0 || $d == 180) {
$c = 'C';
} elsif ($d > 0 && $d < 180) {
@@ -853,14 +858,14 @@
} else {
$c = 'L';
}
- if (defined $dc{$d}) {
- $c1 = $dc{$d};
+ if (defined $Dc{$d}) {
+ $c1 = $Dc{$d};
} else {
$c1 = &corner($d);
}
return sprintf('%s.%s', $c, $c1);
}
- if ($last eq $OTHER) {
+ if ( $last eq $Types{'OTHER'} ) {
return &corner($d);
}
'c';
@@ -878,7 +883,7 @@
# vertices
;
}
- $r = $ringside / (2 * sin(pi / $v));
+ $r = $Params{'ringside'} / (2 * sin(pi / $v));
printf "\tC: 0,0\n";
for ($i = 0; $i <= $v + 1; $i++) {
$a = (($i - 1) / $v * 360 + $pt) / 57.29578; # 57. is $deg
@@ -889,26 +894,26 @@
$v = 5;
}
# sides
- if ($nput > 0) {
+ if ($Nput > 0) {
# hetero ...
for ($i = 1; $i <= $v; $i++) {
$c1 = $c2 = 0;
- if ($put{$i} ne '') {
+ if ($Put{$i} ne '') {
printf "\tV%d: ellipse invis ht %g wid %g at V%d\n",
- $i, $crh, $crw, $i;
- printf "\t%s at V%d\n", $put{$i}, $i;
- $c1 = $cr;
+ $i, $Params{'crh'}, $Params{'crw'}, $i;
+ printf "\t%s at V%d\n", $Put{$i}, $i;
+ $c1 = $Params{'cr'};
}
$j = $i + 1;
if ($j > $v) {
$j = 1;
}
### makering()
- if ($put{$j} ne '') {
- $c2 = $cr;
+ if ($Put{$j} ne '') {
+ $c2 = $Params{'cr'};
}
printf "\tline from V%d to V%d chop %g chop %g\n", $i, $j, $c1, $c2;
- if ($dbl{$i} ne '') {
+ if ($Dbl{$i} ne '') {
# should check i<j
if ($type =~ /flat/ && $i == 3) {
$rat = 0.75;
@@ -917,19 +922,19 @@
$rat = 0.85;
$fix = 1.5;
}
- if ($put{$i} eq '') {
+ if ($Put{$i} eq '') {
$c1 = 0;
} else {
- $c1 = $cr / $fix;
+ $c1 = $Params{'cr'} / $fix;
}
- if ($put{$j} eq '') {
+ if ($Put{$j} eq '') {
$c2 = 0;
} else {
- $c2 = $cr / $fix;
+ $c2 = $Params{'cr'} / $fix;
}
printf "\tline from %g<C,V%d> to %g<C,V%d> chop %g chop %g\n",
$rat, $i, $rat, $j, $c1, $c2;
- if ($dbl{$i} eq 'triple') {
+ if ($Dbl{$i} eq 'triple') {
printf "\tline from %g<C,V%d> to %g<C,V%d> chop %g chop %g\n",
2 - $rat, $i, 2 - $rat, $j, $c1, $c2;
}
@@ -944,7 +949,7 @@
$j = 1;
}
printf "\tline from V%d to V%d\n", $i, $j;
- if ($dbl{$i} ne '') {
+ if ($Dbl{$i} ne '') {
# should check i<j
if ($type =~ /flat/ && $i == 3) {
$rat = 0.75;
@@ -953,7 +958,7 @@
}
printf "\tline from %g<C,V%d> to %g<C,V%d>\n",
$rat, $i, $rat, $j;
- if ($dbl{$i} eq 'triple') {
+ if ($Dbl{$i} eq 'triple') {
printf "\tline from %g<C,V%d> to %g<C,V%d>\n",
2 - $rat, $i, 2 - $rat, $j;
}
@@ -963,7 +968,7 @@
### makering()
# punt on triple temporarily
# circle
- if ($type =~ /benz/ || $aromatic > 0) {
+ if ($type =~ /benz/ || $Aromatic > 0) {
if ($type =~ /flat/) {
$r *= .4;
} else {
@@ -983,21 +988,23 @@
$n = $Words[0];
if ($n eq 'BP') {
$Words[0] = "\"\" ht 0 wid 0";
- $type = $OTHER;
+ $type = $Types{'OTHER'};
} else {
$Words[0] = &atom($n);
- $type = $MOL;
+ $type = $Types{'MOL'};
}
}
$n =~ s/[^A-Za-z0-9]//g; # for stuff like C(OH3): zap non-alnum
if ($#Words < 1) {
printf "Last: %s: %s with .%s at Last.%s\n",
- $n, join(' ', @Words), &leave($type, $Dir + 180), &leave($Last, $Dir);
+ $n, join(' ', @Words), &leave($type, $Dir + 180),
+ &leave($Last_Type, $Dir);
### molecule()
} else {
if (! $Words[1]) {
printf "Last: %s: %s with .%s at Last.%s\n",
- $n, join(' ', @Words), &leave($type, $Dir + 180), &leave($Last, $Dir);
+ $n, join(' ', @Words), &leave($type, $Dir + 180),
+ &leave($Last_Type, $Dir);
} elsif ($#Words >= 1 and $Words[1] eq 'below') {
$Words[2] = '' if ! $Words[2];
printf "Last: %s: %s with .n at %s.s\n", $n, $Words[0], $Words[2];
@@ -1007,21 +1014,22 @@
} elsif ($#Words >= 2 and $Words[1] eq 'left' && $Words[2] eq 'of') {
$Words[3] = '' if ! $Words[3];
printf "Last: %s: %s with .e at %s.w+(%g,0)\n",
- $n, $Words[0], $Words[3], $dew;
+ $n, $Words[0], $Words[3], $Params{'dew'};
} elsif ($#Words >= 2 and $Words[1] eq 'right' && $Words[2] eq 'of') {
$Words[3] = '' if ! $Words[3];
printf "Last: %s: %s with .w at %s.e-(%g,0)\n",
- $n, $Words[0], $Words[3], $dew;
+ $n, $Words[0], $Words[3], $Params{'dew'};
} else {
printf "Last: %s: %s\n", $n, join(' ', @Words);
}
}
- $Last = $type;
+ $Last_Type = $type;
if ($Last_Name) {
- &labsave($Last_Name, $Last, $Dir);
+ # $Last_Type = '';
+ $Labtype{$Last_Name} = $Last_Type;
}
- &labsave($n, $Last, $Dir);
+ $Labtype{$n} = $Last_Type;
} # molecule()
@@ -1110,7 +1118,7 @@
if ($n >= 1 && $n <= $v) {
$m = $mol;
$m =~ s/[^A-Za-z0-9]//g;
- $put{$n} = $m . ':' . &atom($mol);
+ $Put{$n} = $m . ':' . &atom($mol);
} elsif ($n == 0) {
error('argument of "put at" must be a single digit');
} else {
@@ -1121,22 +1129,6 @@
##########
-# reduce(<d>)
-#
-sub reduce {
- my ($d) = @_;
- # reduces d to 0 <= d < 360
- while ($d >= 360) {
- $d -= 360;
- }
- while ($d < 0) {
- $d += 360;
- }
- $d;
-} # reduce()
-
-
-##########
# ring(<type>)
#
sub ring {
@@ -1152,9 +1144,9 @@
}
$fused = $other = '';
for ($i = 1; $i <= $verts; $i++) {
- $put{$i} = $dbl{$i} = '';
+ $Put{$i} = $Dbl{$i} = '';
}
- $nput = $aromatic = $withat = 0;
+ $Nput = $Aromatic = $withat = 0;
for ($Word_Count = 1; $Word_Count <= $#Words; ) {
if ($Words[$Word_Count] eq 'pointing') {
$pt = &cvtdir(0);
@@ -1162,12 +1154,12 @@
$Words[$Word_Count] eq 'triple') {
&dblring($verts);
} elsif ($Words[$Word_Count] =~ /arom/) {
- $aromatic++;
+ $Aromatic++;
$Word_Count++; # handled later
### ring()
} elsif ($Words[$Word_Count] eq 'put') {
&putring($verts);
- $nput++;
+ $Nput++;
} elsif ($Words[$Word_Count] =~ /^#/) {
$Word_Count = $#Words + 1;
last;
@@ -1179,17 +1171,25 @@
$Word_Count++;
}
}
- $typeint = $RING . $verts . $pt; # RING | verts | dir
+ $typeint = $Types{'RING'} . $verts . $pt; # RING | verts | dir
if ($withat == 0) {
- $fused = &joinring($typeint, $Dir, $Last);
+ # join a ring to something
+ if ( $Last_Type =~ /^$Types{'RING'}/ ) {
+ # ring to ring
+ if (substr($typeint, 2) eq substr($Last_Type, 2)) {
+ # fails if not 6-sided
+ $fused = 'with .V6 at Last.V2';
+ }
+ }
+ # if all else fails
+ $fused = sprintf('with .%s at Last.%s',
+ &leave($typeint, $Dir + 180), &leave($Last_Type, $Dir));
}
printf "Last: [\n";
&makering($type, $pt, $verts);
printf "] %s %s\n", $fused, $other;
- $Last = $typeint;
- if ($Last_Name) {
- &labsave($Last_Name, $Last, $Dir);
- }
+ $Last_Type = $typeint;
+ $Labtype{$Last_Name} = $Last_Type if $Last_Name;
} # ring()
@@ -1199,10 +1199,11 @@
sub ringleave {
my ($last, $d) = @_;
my ($rd, $verts);
- # return vertex of ring in dir d
+ # return vertex of ring in direction d
$verts = substr($last, 1, 1);
$rd = substr($last, 2);
- sprintf('V%d.%s', int(&reduce($d - $rd) / (360 / $verts)) + 1, &corner($d));
+ sprintf('V%d.%s', int( (($d - $rd) % 360) / (360 / $verts)) + 1,
+ &corner($d));
} # ringleave()
@@ -1211,18 +1212,18 @@
#
sub setparams {
my ($scale) = @_;
- $lineht = $scale * 0.2;
- $linewid = $scale * 0.2;
- $textht = $scale * 0.16;
- $db = $scale * 0.2; # bond length
- $cwid = $scale * 0.12; # character width
- $cr = $scale * 0.08; # rad of invis circles at ring vertices
- $crh = $scale * 0.16; # ht of invis ellipse at ring vertices
- $crw = $scale * 0.12; # wid
- $dav = $scale * 0.015; # vertical shift up for atoms in atom macro
- $dew = $scale * 0.02; # east-west shift for left of/right of
- $ringside = $scale * 0.3; # side of all rings
- $dbrack = $scale * 0.1; # length of bottom of bracket
+ $Params{'lineht'} = $scale * 0.2;
+ $Params{'linewid'} = $scale * 0.2;
+ $Params{'textht'} = $scale * 0.16;
+ $Params{'db'} = $scale * 0.2; # bond length
+ $Params{'cwid'} = $scale * 0.12; # character width
+ $Params{'cr'} = $scale * 0.08; # rad of invis circles at ring vertices
+ $Params{'crh'} = $scale * 0.16; # ht of invis ellipse at ring vertices
+ $Params{'crw'} = $scale * 0.12; # wid
+ $Params{'dav'} = $scale * 0.015; # vertical shift up for atoms in atom macro
+ $Params{'dew'} = $scale * 0.02; # east-west shift for left of/right of
+ $Params{'ringside'} = $scale * 0.3; # side of all rings
+ $Params{'dbrack'} = $scale * 0.1; # length of bottom of bracket
} # setparams()
@@ -1273,7 +1274,7 @@
EOF
} # version()
-
+1;
### Emacs settings
# Local Variables:
# mode: CPerl
Index: examples/README.txt
===================================================================
RCS file: /cvsroot/groff/groff/contrib/chem/examples/README.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- examples/README.txt 26 Oct 2006 22:13:49 -0000 1.1
+++ examples/README.txt 6 Nov 2006 23:17:25 -0000 1.2
@@ -2,9 +2,10 @@
You can view the graphical display of the examples by calling
- @address@hidden <file> | groffer
+ groffer <file>
-or get a suitable `groff' output by running
+`groffer' calls `chem' automatically. Or get a suitable `groff'
+output by running
@address@hidden <file> | groff -p ...
@@ -24,7 +25,7 @@
####### License
-Last update: 25 Oct 2006
+Last update: 6 Nov 2006
Copyright (C) 2006 Free Software Foundation, Inc.
Written by Bernd Warken.
Index: examples/reserpine.chem
===================================================================
RCS file: /cvsroot/groff/groff/contrib/chem/examples/reserpine.chem,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- examples/reserpine.chem 26 Oct 2006 22:13:49 -0000 1.1
+++ examples/reserpine.chem 6 Nov 2006 23:17:25 -0000 1.2
@@ -1,5 +1,6 @@
reserpine.chem:
-.cstart
+.PS
+begin chem
# Example file for `chem':
# Reserpine or C33H40N2O9
@@ -10,7 +11,7 @@
# Copyright (C) 2006 Free Software Foundation, Inc.
# Written by Bernd Warken.
-# Last update: 26 Oct 2006
+# Last update: 6 Nov 2006
# This file is part of `chem', which is part of `groff'.
@@ -63,4 +64,5 @@
# Local Variables:
# mode: Nroff
# End:
-.cend
+end
+.PE
Index: examples/122/README
===================================================================
RCS file: /cvsroot/groff/groff/contrib/chem/examples/122/README,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- examples/122/README 26 Oct 2006 22:13:49 -0000 1.1
+++ examples/122/README 6 Nov 2006 23:17:25 -0000 1.2
@@ -8,23 +8,33 @@
The book is available in the internet at
<http://cm.bell-labs.com/cm/cs/cstr/122.ps.gz>.
-The examples are sorted by the chapter in the book. For example, the
-file `ch4c_colon.chem' means a chem example in chapter 4; according to
-`c', it is the third example in this chapter; the name `colon' is used
-to describe the context of the example.
+Many of the examples had to be fixed. Unfortunately, the `chem' akw
+version does not run on many of these programs. But the Perl version
+of `chem' works on all examples.
+
+Most examples do not use the modern chemical display. They have C
+atoms added, whereas the modern method omits all C atoms and their
+directly appended H atoms.
+
+The examples are named and sorted by the chapter where they are found
+in the book. For example, the file `ch4c_colon.chem' means a `chem'
+example in chapter 4; according to `c', it is the third example in
+this chapter; the name `colon' is used to describe the context of the
+example.
You can view the graphical display of the examples by calling
- @address@hidden <file> | groffer
+ groffer <file>
-or get a suitable `groff' output by running
+`groffer' calls `chem' automatically. Or get a suitable `groff'
+output by running
@address@hidden <file> | groff -p ...
####### License
-Last update: 26 Oct 2006
+Last update: 6 Nov 2006
Copyright (C) 2006 Free Software Foundation, Inc.
Written by Bernd Warken.
Index: examples/122/ch6a_pic.chem
===================================================================
RCS file: /cvsroot/groff/groff/contrib/chem/examples/122/ch6a_pic.chem,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- examples/122/ch6a_pic.chem 27 Oct 2006 07:32:50 -0000 1.2
+++ examples/122/ch6a_pic.chem 6 Nov 2006 23:17:25 -0000 1.3
@@ -11,7 +11,7 @@
# Copyright (C) 2006 Free Software Foundation, Inc.
-# Last update: 26 Oct 2006
+# Last update: 2 Nov 2006
# This file is part of `chem', which is part of `groff'.
@@ -36,8 +36,8 @@
R: ring double 2,3
line from R.V6 to R.C
line from R.C to R.V4
-X1: 1/2 <R.V5,R.C>
-X2: 1/2 <R.C,R.V2>
+ X1: 1/2 <R.V5,R.C>
+ X2: 1/2 <R.C,R.V2>
bond from X1 to X2
########################################################################
Index: examples/122/ch6b_dna.chem
===================================================================
RCS file: /cvsroot/groff/groff/contrib/chem/examples/122/ch6b_dna.chem,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- examples/122/ch6b_dna.chem 27 Oct 2006 07:32:50 -0000 1.2
+++ examples/122/ch6b_dna.chem 6 Nov 2006 23:17:25 -0000 1.3
@@ -1,12 +1,6 @@
ch6b_dna.chem:
-this does not work for any chem.
.br
-.ig
-# To work with this file remove the `.ig' line above, uncomment the
-# following `.cstart' command, and remove the line `..' at the end of
-# this file.
-
-#.cstart
+.cstart
# Example file for `chem':
@@ -17,7 +11,7 @@
# Copyright (C) 2006 Free Software Foundation, Inc.
-# Last update: 26 Oct 2006
+# Last update: 29 Oct 2006
# This file is part of `chem', which is part of `groff'.
@@ -68,4 +62,3 @@
# mode: Nroff
# End:
.cend
-..
Index: examples/122/chAg_circle.chem
===================================================================
RCS file: /cvsroot/groff/groff/contrib/chem/examples/122/chAg_circle.chem,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- examples/122/chAg_circle.chem 27 Oct 2006 07:32:50 -0000 1.2
+++ examples/122/chAg_circle.chem 6 Nov 2006 23:17:25 -0000 1.3
@@ -11,7 +11,7 @@
# Copyright (C) 2006 Free Software Foundation, Inc.
-# Last update: 26 Oct 2006
+# Last update: 2 Nov 2006
# This file is part of `chem', which is part of `groff'.
@@ -35,19 +35,19 @@
bond 120 ; C
bond 60 ; C
- bond up ; Cl
+bond up ; Cl
double bond 120 from C ; C
bond 60 ; C
bond 120 ; C
bond 60 ; C
- bond up ; Cl
+bond up ; Cl
double bond 120 from C ; C
- circle at C rad .08
+circle at C rad .08
bond 60 from C ; C
bond 120 ; C
bond 60 ; C
double bond 120 ; C
- bond down ; Cl
+bond down ; Cl
bond 60 from C ; C
bond 120
Index: examples/122/chAi_poly_vinyl_chloride.chem
===================================================================
RCS file:
/cvsroot/groff/groff/contrib/chem/examples/122/chAi_poly_vinyl_chloride.chem,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- examples/122/chAi_poly_vinyl_chloride.chem 27 Oct 2006 07:32:50 -0000
1.2
+++ examples/122/chAi_poly_vinyl_chloride.chem 6 Nov 2006 23:17:25 -0000
1.3
@@ -1,6 +1,6 @@
chAi_poly_vinyl_chloride.chem:
.br
-.ps 8
+.ps -2
.cstart
# Example file for `chem':
@@ -12,7 +12,7 @@
# Copyright (C) 2006 Free Software Foundation, Inc.
-# Last update: 26 Oct 2006
+# Last update: 29 Oct 2006
# This file is part of `chem', which is part of `groff'.
@@ -143,3 +143,4 @@
# mode: Nroff
# End:
.cend
+.ps +2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Groff-commit] groff/contrib/chem ChangeLog README.txt chem.ma...,
Bernd Warken <=