a99  V32.6
allegro Windows Hauptprogramm
 Alle Klassen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
allegro.hpp
gehe zur Dokumentation dieser Datei
1 // allegro.hpp : allgemeine Definitionen und globale Variablen
2 // 1995 / 2010
3 // Copyright 2011 Universitätsbibliothek Braunschweig, more see bottom
4 
5 // Header file for allegro class library and applications
6 
7 // Allgemeines File fuer die gemeinsamen Zwecke
8 // Die einzelnen Klassen haben eigene Header files: record.hpp etc.
9 // Diese binden dann allegro.hpp ein, falls noch nicht vorhanden
10 
11 #include "platform.h" // z.B. Wert ALCA oder A99, LINUX
12 #include "ai-const.h" // Indexfunktionen
13 
14 #ifndef __cplusplus
15 #define __cplusplus
16 #endif
17 
18 #include <stdio.h>
19 
20 #ifdef UNIX
21 #define min(x,y) ((x) < (y) ? (x) : (y))
22 #define max(x,y) ((x) > (y) ? (x) : (y))
23 #endif
24 
25 // *************** 1. Durchlauf ***************************
26 
27 // Initialisierungen, wenn die Variablen noch nicht definiert sind
28 // dann ist __ALLEGRO noch nicht gesetzt
29 
30 #ifndef __ALLEGRO
31 
32 #define __ALLEGRO
33 // sonst der Abschnitt "2. Durchlauf" weiter unten!
34 
35 // includes:
36 
37 #include <stdio.h>
38 #include <fcntl.h>
39 #include <stdlib.h>
40 #include <string.h>
41 #include <malloc.h>
42 #include <ctype.h>
43 #include <time.h>
44 #ifdef UNIX
45 #include <sys/stat.h>
46 #include <unistd.h>
47 #else
48 #include <sys\stat.h>
49 #include <io.h>
50 #include <conio.h>
51 #endif
52 
53 #ifdef LINUX
54 #include <iostream>
55 #endif
56 
57 // global defines:
58 
59 #ifdef UNIX
60 #define CHAR unsigned char
61 #define FLD unsigned char
62 #define stricmp(a,b) strcasecmp(a,b)
63 #define strnicmp(a,b,c) strncasecmp(a,b,c)
64 
65 #elif defined WIN32
66 #define CHAR unsigned char
67 #define FLD unsigned char
68 
69 #endif
70 
71 // Diese Funktionsprototypen sind sonst nur fuer 'char' definiert
72 // sie sollen aber auch fuer CHAR klappen (unsigned char)
73 #define strcpy(a,b) strcpy((char*)a,(char*)b)
74 #define strncpy(a,b,c) strncpy((char*)a,(char*)b,c)
75 #define strlen(a) strlen((char*)a)
76 #define strchr(a,b) strchr((char*)a,b)
77 #define strcat(a,b) strcat((char*)a,(char*)b)
78 #define strncmp(a,b,c) strncmp((char*)a,(char*)b,c)
79 #define strcmp(a,b) strcmp((char*)a,(char*)b)
80 #define atoi(a) atoi((char*)a)
81 #define strstr(a,b) strstr((char*)a,(char*)b)
82 
83 #define UIFMAX 500 // max number of UIF lines, initialized in system.cpp
84 
85 // CFG-Konstanten
86 #define ML 130 // max lines: size of export space: 128x150
87 #define MC 152 // max columns per line
88 #define FS '\0' // field separator
89 #define RS '\35' // rec separator, asci=29
90 #define CR '\15' // carriage return = 13
91 #define EOD '\32' // end-of-data = 26 (kommt ans Ende des Arb.Sp.)
92 #define ESC '\33' // Esc = 27
93 #define TAB '\11' // Tab = 9
94 #define NL '\0' // char ASCII zero
95 #define BK 'x' // break code
96 #define QT '"' // Quote = 34
97 #define FF 255 // delimiter for some purposes
98 
99 #define PATH_SIZE 256 // Size of path+filename
100 
101 #endif // #ifndef __ALLEGRO
102 
103 // *************** Ende 1. Durchlauf ***************************
104 
105 // *** Abschnitt fuer 2. Durchlauf und weitere: Deklarationen ********
106 
107 #ifndef __UTIL
108 #include "utility.hpp" // allegro utility function prototypes
109 #endif
110 
111 // Function Prototypes ( in system.cpp )
112 
113 int Amain(char*); // main program file (nicht immer vorh.)
114 
115 int SyInit(); // einige Initialisierungen
116 
117 // Datei oeffnen, in vorgeschriebener Reihenfolge suchen
118 FILE *SyOpen(char *, char *,char *dbDir=".\\"); // open file on dbDir, pgDir, ./
119 
120 void SyDat(CHAR*); // write dates to a, German way SYSTEM.CPP
121 void SyTime(CHAR*); // write exact date and time to a, sortable, YYYYMMDD/HH:MM:SS
122 
123 char *SyGetArg(CHAR,int); // get a start option variable
124 
125 void SyPause(int); // n sekunden pause
126 
127 
128 // einige externe Sonder-Routinen ( in extern.cpp, progr.interface )
129 // (sind standardmaessig alle leer und geben 1 zurueck)
130 
131 // Aufruf aus konfig.cpp
132 int s_cfg(char *); // externe CFG-Zeilen-Behandlung
133 int s_check(int,char *); // external check (field validation, konfig.cpp)
134 // ... exet2.cpp
135 int s_param(char *); // external eval of export param line
136 // ... exet.cpp
137 int s_preex(); // external routine BEFORE export
138 int s_postex(); // external routine AFTER export
139 // ... abase.cpp
140 int s_fctn(); // external routine after opening a database
141 // ... abasew.cpp
142 int s_del(RECNR , int); // before deleting a record
143 
144 // *****************************
145 // GLOBAL Variables: die meisten Namen fangen mit A an!
146 
147 // Achtung:
148 // Im main() Modul setzt man #define __GLOBALS vor #include "allegro.hpp"
149 // dann wird dieser Abschnitt uebergangen und der zweite ausgefuehrt
150 // In anderen Modulen einfach nur #include "allegro.hpp"
151 
152 #ifndef __GLOBALS
153 
154 extern int ARGC; // cmd line arguments
155 extern char **ARGV;
156 
157 extern char Aerror[]; // Fehlermeldung; contains most recent error message
158 
159 extern int Active[]; // flags of active databases 0..4
160 
161 extern void *Abase[]; // pointers to database objects
162 
163 extern int Pctive[]; // flags of active parameter sets 0..9
164 
165 extern int aiFlag; // aindex flag: 0:not yet initialized (ai-Modul)
166 
167 extern CHAR *Aspace; // general auxiliary space
168 
169 extern CHAR Awx[]; // global auxiliary string
170 
171 extern CHAR Aextra[]; // Unicode UTF-8 quadruples (u-Befehle in .APT)
172 
173 extern int Aflag; // 0: Aspace free, 1:Aspace in use
174 
175 extern char pgDir[]; // program directory; dbDir in exet.hpp
176 
177 extern char Optor[]; // Operator code or name, option -Oname
178 
179 extern CHAR *svTable; // sort values of index, for command i x y in .API
180 
181 extern char Alanguage[]; // language code
182 
183 extern char Aprinter[]; // name of printer
184 
185 extern char *uif[]; // user interface texts
186 extern char *uift; // pointer into uif
187 
188 extern int Apgnb; // prog number, default '1' [obsolete? frueher 1=PRESTO]
189 
190 extern char nil[]; // zero string
191 extern CHAR fsep[]; // file name path separator: \ or /
192 
193 // Folgende Sachen sind in utility.cpp
194 
195 extern int fspace; // background space size (-> KONFIG mB)
196 extern CHAR *fr, *fend; // background space: 1st pos / last+1
197 extern CHAR **fa; // address array for backgr fields
198 extern int *fi; // internal field numbers of backgr fields
199 extern int fri; // current number of background fields, mb in CFG
200 extern int f_dim; // max number, default 500,
201 
202 extern int pspace; // phrase space size (-> KONFIG mP)
203 extern CHAR *phr, *pend; // phrase space: 1st pos / last+1
204 extern CHAR *pa[]; // address array for phrases, max 1200
205 extern int pi[]; // internal numbers of phrases
206 extern int phi; // current number of phrases
207 
208 
209 // ***** ENDE #ifndef __ALLEGRO ***************************************
210 
211 #else // im main() Modul stehen die echten
212  // Definitionen globaler Variablen:
213 
214 #undef GLOBALS
215 
216 int ARGC; // for cmd line arguments
217 char **ARGV;
218 
219 char Aerror[256]; // most recent error message
220 
221 int Active[5]= {-1,-1,-1,-1,-1};// access flags (accf) of databases in use
222 
223 void *Abase[5] ; // pointers to active database objects
224 
225 // jede geladene Parameterdatei erhaelt eine interne Nummer, 0...9
226 int Pctive[10]={0,0,0,0,0,0,0,0,0,0};// flags for loaded param sets
227 
228 int aiFlag=0; // aindex flag: 0=inactive, 1=initialized
229 
230 // XXX Achtung: Werte evtl. vergroessern:
231 CHAR *Aspace; // general auxiliary space
232 CHAR Awx[256000]; // Auxiliary workstring (export param, mostly exet.cpp)
233 
234 CHAR Aextra[8512]; // Unicode UTF-8 quadruples (u-Befehle in .APT)
235 
236 int Aflag=0; // 0: Aspace free, 1: in use
237 
238 #ifdef UNIX
239 char pgDir[PATH_SIZE]="/usr/allegro/";
240 CHAR fsep[2]="/"; // filename separator character UNIX
241 #define FSEP 47
242 #else
243 char pgDir[PATH_SIZE]="C:\\ALLEGRO\\"; // program directory
244 CHAR fsep[2]="\\"; // Win
245 #define FSEP 92
246 #endif
247 
248 char Alanguage[8]="ger"; // interface language
249 char Aprinter[PATH_SIZE]="PRN"; // printer name
250 char *uif[UIFMAX]; // addresses of uif texts
251 char *uift;
252 
253 // int Ndb=0; // number of databases open UUU
254 
255 int Apgnb='1'; // program number ('1'=PRESTO ...) $$951217
256 
257 char nil[2]="\0"; // just to have an empty string
258 
259 char Optor[32]; // Operator code or name (DOS: -o ...)
260 
261 CHAR *svTable; // Index-Sortierwerte i-Befehle (sort values of index)
262 
263 
264 // Folgende Sachen sind in utility.cpp verwendet
265 
266 // Hintergrundspeicher
267 int fspace=12000; // size of background space
268 int f_dim=500; // number of backgr fields
269 CHAR *fr=(CHAR*)NULL; // background space: 1st pos / last+1
270 CHAR *fend=(CHAR*)NULL;// current end position
271 CHAR **fa; // address array for background fields
272 int *fi; // internal field numbers (as determined by KONFIG)
273 int fri; // current number of fields in background
274 
275 // Phrasenspeicher
276 int pspace=10000; // size of phrase space
277 CHAR *phr=(CHAR*)NULL; // phrase base
278 CHAR *pend=(CHAR*)NULL;// phase space: 1st pos / last+1
279 
280 // 1200 Phrasen: (frueher 800)
281 CHAR *pa[1200]; // address array for phrases
282 int pi[1200]; // internal numbers of phrases
283 int phi; // current number of phrases
284 
285 
286 #define __GLOBALS
287 
288 #endif // ifndef __GLOBALS
289 
290 // ***** ENDE #else von #ifndef __ALLEGRO *********
291 
292 /*
293  Copyright 2011 Universitätsbibliothek Braunschweig
294 
295  Licensed under the Apache License, Version 2.0 (the "License");
296  you may not use this file except in compliance with the License.
297  You may obtain a copy of the License at
298 
299  http://www.apache.org/licenses/LICENSE-2.0
300 
301  Unless required by applicable law or agreed to in writing, software
302  distributed under the License is distributed on an "AS IS" BASIS,
303  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
304  See the License for the specific language governing permissions and
305  limitations under the License.
306 */
307