1 /*
2   This is main.c
3 
4   Coxeter version 3.0 Copyright (c) 2002 Fokko du Cloux
5 
6   This program is made available under the terms stated in the Gnu
7   General Public License below. Enquiries about the General Public License
8   and the Gnu project may be adressed to :
9 
10       Free Software Foundation
11       675 Mass. Ave., Cambridge, MA 02139, USA
12 
13   		    GNU GENERAL PUBLIC LICENSE
14      TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
15 
16     0. This License Agreement applies to any program or other work which
17   contains a notice placed by the copyright holder saying it may be
18   distributed under the terms of this General Public License.  The
19   "Program", below, refers to any such program or work, and a "work based
20   on the Program" means either the Program or any work containing the
21   Program or a portion of it, either verbatim or with modifications.  Each
22   licensee is addressed as "you".
23 
24     1. You may copy and distribute verbatim copies of the Program's source
25   code as you receive it, in any medium, provided that you conspicuously and
26   appropriately publish on each copy an appropriate copyright notice and
27   disclaimer of warranty; keep intact all the notices that refer to this
28   General Public License and to the absence of any warranty; and give any
29   other recipients of the Program a copy of this General Public License
30   along with the Program.  You may charge a fee for the physical act of
31   transferring a copy.
32 
33     2. You may modify your copy or copies of the Program or any portion of
34   it, and copy and distribute such modifications under the terms of Paragraph
35   1 above, provided that you also do the following:
36 
37       a) cause the modified files to carry prominent notices stating that
38       you changed the files and the date of any change; and
39 
40       b) cause the whole of any work that you distribute or publish, that
41       in whole or in part contains the Program or any part thereof, either
42       with or without modifications, to be licensed at no charge to all
43       third parties under the terms of this General Public License (except
44       that you may choose to grant warranty protection to some or all
45       third parties, at your option).
46 
47       c) If the modified program normally reads commands interactively when
48       run, you must cause it, when started running for such interactive use
49       in the simplest and most usual way, to print or display an
50       announcement including an appropriate copyright notice and a notice
51       that there is no warranty (or else, saying that you provide a
52       warranty) and that users may redistribute the program under these
53       conditions, and telling the user how to view a copy of this General
54       Public License.
55 
56       d) You may charge a fee for the physical act of transferring a
57       copy, and you may at your option offer warranty protection in
58       exchange for a fee.
59 
60   Mere aggregation of another independent work with the Program (or its
61   derivative) on a volume of a storage or distribution medium does not bring
62   the other work under the scope of these terms.
63 
64     3. You may copy and distribute the Program (or a portion or derivative of
65   it, under Paragraph 2) in object code or executable form under the terms of
66   Paragraphs 1 and 2 above provided that you also do one of the following:
67 
68       a) accompany it with the complete corresponding machine-readable
69       source code, which must be distributed under the terms of
70       Paragraphs 1 and 2 above; or,
71 
72       b) accompany it with a written offer, valid for at least three
73       years, to give any third party free (except for a nominal charge
74       for the cost of distribution) a complete machine-readable copy of the
75       corresponding source code, to be distributed under the terms of
76       Paragraphs 1 and 2 above; or,
77 
78       c) accompany it with the information you received as to where the
79       corresponding source code may be obtained.  (This alternative is
80       allowed only for noncommercial distribution and only if you
81       received the program in object code or executable form alone.)
82 
83   Source code for a work means the preferred form of the work for making
84   modifications to it.  For an executable file, complete source code means
85   all the source code for all modules it contains; but, as a special
86   exception, it need not include source code for modules which are standard
87   libraries that accompany the operating system on which the executable
88   file runs, or for standard header files or definitions files that
89   accompany that operating system.
90 
91     4. You may not copy, modify, sublicense, distribute or transfer the
92   Program except as expressly provided under this General Public License.
93   Any attempt otherwise to copy, modify, sublicense, distribute or transfer
94   the Program is void, and will automatically terminate your rights to use
95   the Program under this License.  However, parties who have received
96   copies, or rights to use copies, from you under this General Public
97   License will not have their licenses terminated so long as such parties
98   remain in full compliance.
99 
100     5. By copying, distributing or modifying the Program (or any work based
101   on the Program) you indicate your acceptance of this license to do so,
102   and all its terms and conditions.
103 
104     6. Each time you redistribute the Program (or any work based on the
105   Program), the recipient automatically receives a license from the original
106   licensor to copy, distribute or modify the Program subject to these
107   terms and conditions.  You may not impose any further restrictions on the
108   recipients' exercise of the rights granted herein.
109 
110     7. The Free Software Foundation may publish revised and/or new versions
111   of the General Public License from time to time.  Such new versions will
112   be similar in spirit to the present version, but may differ in detail to
113   address new problems or concerns.
114 
115   Each version is given a distinguishing version number.  If the Program
116   specifies a version number of the license which applies to it and "any
117   later version", you have the option of following the terms and conditions
118   either of that version or of any later version published by the Free
119   Software Foundation.  If the Program does not specify a version number of
120   the license, you may choose any version ever published by the Free Software
121   Foundation.
122 
123     8. If you wish to incorporate parts of the Program into other free
124   programs whose distribution conditions are different, write to the author
125   to ask for permission.  For software which is copyrighted by the Free
126   Software Foundation, write to the Free Software Foundation; we sometimes
127   make exceptions for this.  Our decision will be guided by the two goals
128   of preserving the free status of all derivatives of our free software and
129   of promoting the sharing and reuse of software generally.
130 
131   			    NO WARRANTY
132 
133     9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
134   FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
135   OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
136   PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
137   OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
138   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
139   TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
140   PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
141   REPAIR OR CORRECTION.
142 
143     10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
144   WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
145   REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
146   INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
147   OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
148   TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
149   YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
150   PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
151   POSSIBILITY OF SUCH DAMAGES.
152 
153   		     END OF TERMS AND CONDITIONS
154 */
155 
156 #include "constants.h"
157 #include "commands.h"
158 #include "version.h"
159 
160 namespace {
161   using namespace version;
162   void printVersion();
163 };
164 
main()165 int main()
166 
167 /*
168   In this version, the program can only run in interactive mode, and
169   does not take any arguments.
170 */
171 
172 {
173   constants::initConstants();
174   printVersion();
175   commands::run();
176 
177   exit(0);
178 }
179 
180 
181 namespace {
182 
printVersion()183 void printVersion()
184 
185 /*
186   Prints an opening message and the version number.
187 */
188 
189 {
190 
191   printf("This is %s version %s.\nEnter help if you need assistance,\
192  carriage return to start the program.\n\n",NAME,VERSION);
193 
194   return;
195 }
196 
197 };
198