a99  V32.6
allegro Windows Hauptprogramm
 Alle Klassen Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Makrodefinitionen
extern.cpp
gehe zur Dokumentation dieser Datei
1 // extern.cpp : Leerfunktionen !
2 // 1995
3 // Copyright 2011 Universitätsbibliothek Braunschweig, more see bottom
4 // Bei Bedarf zu fuellen; an einigen Stellen, wo man evtl. erweitern will,
5 // wird hierher gesprungen und zurueck
6 // Dieses Konzept stammt eigentlich noch aus den DOS-Programmen,
7 // z.B. f. aLF genutzt, um gewisse Erweiterungen an PRESTO in externe Dateien zu verlagern
8 
9 #ifdef WIN32
10 #include <process.h>
11 #include <io.h>
12 #include <afx.h>
13 #endif
14 #include "allegro.hpp"
15 
16 
17 #define READ_HANDLE 0
18 #define WRITE_HANDLE 1
19 
20 // Aufruf kommt aus KONFIG.CPP
21 int s_cfg(char *cfgline) // check a .CFG line (cfgline points to it)
22 // set *cfgline to 0 if invalid
23 // the programmer can create his own
24 // CFG commands and evaluate them here
25 {
26  return 1 ; // 0: cfgline line invalid
27 }
28 
29 // aus KONFIG.CPP
30 int s_check(int f, char *adr) // user programmable check
31 // f=interne Feldnummer, adr=Feldtext
32 // return -1 if FLD unacceptable, 0 for warning
33 {
34  return 1;
35 }
36 
37 // aus EXET.CPP
38 int s_preex()
39 {
40  return 1; // BEFORE export
41 }
42 
43 int s_postex()
44 {
45  return 1; // AFTER export
46 }
47 
48 // aus EXET2.CPP
49 int s_param(char *)
50 {
51  return 1; // param line ok?
52 }
53 
54 // aus ABASE.CPP
55 int s_fctn()
56 {
57  return 1; // after opening a database
58 }
59 
60 // aus ABASEW.CPP
61 // before deleting a record
62 // return 0 if Rec not to be deleted
63 int s_del(RECNR recn, int md)
64 {
65  return 1;
66 }
67 /* md nur 1 und 3 hier evtl. relevant:
68  = 2 : nur Loeschkontrolle (#-- in .API)
69  3 : Kontrolle + Loeschung
70  1 : Loeschung ohne Kontrolle
71 */
72 // ENDE ENDE ENDE ********************************************* ENDE
73 
74 
75 /* // Das hier war nur mal ein Versuch f. pipe-Ausgabe
76 char szBuffer[512];
77 int expipe(char *extprog)
78 {
79  int nExitCode = STILL_ACTIVE;
80  HANDLE hProcess;
81  int hStdOut; // handle for stdout
82  int hStdOutPipe[2]; // read + write handles of pipe
83 
84 *Aerror=0;
85  // Create the pipe
86  if(_pipe(hStdOutPipe, 512, O_BINARY | O_NOINHERIT) == -1)
87  return 1;
88 
89  // Duplicate stdout handle (next line will close original)
90  hStdOut = _dup(_fileno(stdout));
91 
92  // Duplicate write end of pipe to stdout handle
93  if(_dup2(hStdOutPipe[WRITE_HANDLE], _fileno(stdout)) != 0)
94  { sprintf(Aerror,"errno=%d",errno); return 2; }
95  // errno = EBADF=6, EMFILE=4
96 
97  // Close original write end of pipe
98  close(hStdOutPipe[WRITE_HANDLE]);
99 
100  // Spawn process : start the external program
101  hProcess = (HANDLE)spawnvp(P_NOWAIT, extprog,
102  (const char* const*)&extprog);
103 
104  // Duplicate copy of original stdout back into stdout
105  if(_dup2(hStdOut, _fileno(stdout)) != 0)
106  return 3;
107 
108  // Close duplicate copy of original stdout
109  close(hStdOut);
110 
111 // create CFile from handle
112 CFile *sto;
113 sto=new CFile(hStdOutPipe[READ_HANDLE]);
114 
115  if(hProcess) // see what the ext prog says
116  {
117  int nOutRead;
118  while (nExitCode == STILL_ACTIVE)
119  {
120  nOutRead = read(hStdOutPipe[READ_HANDLE],
121  szBuffer, 512); // read 256 bytes from pipe
122  if(nOutRead)
123  {
124  // filter the received stuff
125 // nOutRead = Filter(szBuffer, nOutRead, BEEP_CHAR);
126  // then do what needs doing ...
127  // z.B. fwrite(szBuffer, 1, nOutRead, stdout);
128 strcat(Aerror,szBuffer);
129  }
130 
131  if(!GetExitCodeProcess(hProcess,(unsigned long*)&nExitCode))
132  return 4;
133  }
134  }
135 
136 
137  printf("\nPress \'ENTER\' key to continue... ");
138  getchar();
139  return nExitCode;
140 }
141 */
142 
143 /*
144  Copyright 2011 Universitätsbibliothek Braunschweig
145 
146  Licensed under the Apache License, Version 2.0 (the "License");
147  you may not use this file except in compliance with the License.
148  You may obtain a copy of the License at
149 
150  http://www.apache.org/licenses/LICENSE-2.0
151 
152  Unless required by applicable law or agreed to in writing, software
153  distributed under the License is distributed on an "AS IS" BASIS,
154  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
155  See the License for the specific language governing permissions and
156  limitations under the License.
157 */
158