Skip to content

Commit 6401ac5

Browse files
committed
CWB restored
1 parent a4b540c commit 6401ac5

88 files changed

Lines changed: 2344 additions & 13971 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/cwb/CQi/auth.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include <stdlib.h>
2424
#include <assert.h>
2525

26-
void Rprintf(const char *, ...);
27-
2826
#include "auth.h"
2927
#include "../cl/cl.h"
3028

@@ -90,7 +88,7 @@ add_user_to_list(char *user, char *passwd)
9088
UserEntry *new_user;
9189

9290
if (find_user(user))
93-
Rprintf("WARNING: user '%s' already in list (ignored)\n", user);
91+
fprintf(stderr, "WARNING: user '%s' already in list (ignored)\n", user);
9492
else {
9593
new_user = (UserEntry *)cl_malloc(sizeof(UserEntry));
9694
new_user->name = cl_strdup(user);
@@ -128,7 +126,7 @@ add_host_to_list(char *ipaddr)
128126
}
129127

130128
if (host->address.s_addr == -1) {
131-
Rprintf("WARNING: '%s' isn't a valid IP address (ignored)\n", ipaddr);
129+
fprintf(stderr, "WARNING: '%s' isn't a valid IP address (ignored)\n", ipaddr);
132130
cl_free(host);
133131
}
134132
else {
@@ -197,13 +195,13 @@ show_grants(void)
197195
Grant *grant;
198196

199197
for (host = authorized_hosts; host; host = host->next)
200-
Rprintf("HOST: %s\n", inet_ntoa(host->address));
198+
printf("HOST: %s\n", inet_ntoa(host->address));
201199

202200
for (user = authorized_users; user; user = user->next) {
203-
Rprintf("USER: %s, pass='%s' (", user->name, user->passwd);
201+
printf("USER: %s, pass='%s' (", user->name, user->passwd);
204202
for (grant = user->grants; grant; grant = grant->next)
205-
Rprintf("%s ", grant->corpus);
206-
Rprintf(")\n");
203+
printf("%s ", grant->corpus);
204+
printf(")\n");
207205
}
208206
}
209207

src/cwb/CQi/cqpserver.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "../cqp/options.h"
3232
#include "../cqp/corpmanag.h"
3333
#include "../cqp/groups.h"
34-
void Rprintf(const char *, ...);
3534

3635

3736
/** String containing the username sent by the currently-connect CQi client */

src/cwb/CQi/log.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
void
4545
cqiserver_welcome(void)
4646
{
47-
Rprintf("** WELCOME TO CQPserver v" CWB_VERSION "\n");
48-
Rprintf(" implementing version %d.%d of the CQi\n", CQI_MAJOR_VERSION, CQI_MINOR_VERSION);
49-
Rprintf(" for copyright and other info, see `cqp -v`%s", server_log ? "\n" : "\n\n"); /* if writing to log, skip decorative newline */
47+
printf("** WELCOME TO CQPserver v" CWB_VERSION "\n");
48+
printf(" implementing version %d.%d of the CQi\n", CQI_MAJOR_VERSION, CQI_MINOR_VERSION);
49+
printf(" for copyright and other info, see `cqp -v`%s", server_log ? "\n" : "\n\n"); /* if writing to log, skip decorative newline */
5050
}
5151

5252
/**
@@ -67,18 +67,18 @@ cqiserver_log(MessageType msg_type, const char *msg, ...)
6767
/* if logging is on, print to stdout, which is the logging dest */
6868
if (server_log || Error == msg_type) {
6969
va_start(vector, msg);
70-
Rprintf("CQPserver: ");
70+
printf("CQPserver: ");
7171
vprintf(msg, vector);
72-
Rprintf("\n");
72+
printf("\n");
7373
va_end(vector);
7474
}
7575

7676
/* if it's an error or if debug is on, print to stderr, which is where all debug messages go */
7777
if (Error == msg_type || server_debug) {
7878
va_start(vector, msg);
79-
Rprintf("CQPserver: ");
80-
Rprintf(msg, vector);
81-
Rprintf("\n");
79+
fprintf(stderr, "CQPserver: ");
80+
vfprintf(stderr, msg, vector);
81+
fprintf(stderr, "\n");
8282
va_end(vector);
8383
return Error == msg_type;
8484
}
@@ -107,9 +107,9 @@ cqiserver_snoop(const char *format, ...)
107107
if (snoop) {
108108
va_list vector;
109109
va_start(vector, format);
110-
Rprintf("CQi ");
111-
Rprintf(format, vector);
112-
Rprintf("\n");
110+
fprintf(stderr, "CQi ");
111+
vfprintf(stderr, format, vector);
112+
fprintf(stderr, "\n");
113113
va_end(vector);
114114
}
115115
}
@@ -146,7 +146,7 @@ cqiserver_debug_arglist(const char *arg_list, int n_args, int int_args)
146146
sprintf(mark += strlen(mark), "%d ", (int)arg_list[i]);
147147
else
148148
/* super creaky typecasting needed to get the compiler to not complain here */
149-
sprintf(mark += strlen(mark), "'%s' ", arg_list);
149+
sprintf(mark += strlen(mark), "'%s' ", (char *)((long)arg_list[i]));
150150
}
151151
return buf;
152152
}
@@ -165,9 +165,9 @@ cqiserver_debug_msg(const char *format, ...)
165165
if (server_debug) {
166166
va_list vector;
167167
va_start(vector, format);
168-
Rprintf("CQi: ");
169-
Rprintf(format, vector);
170-
Rprintf("\n");
168+
fprintf(stderr, "CQi: ");
169+
vfprintf(stderr, format, vector);
170+
fprintf(stderr, "\n");
171171
va_end(vector);
172172
}
173173
}

src/cwb/CQi/server.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
* Public License for more details (in the file "COPYING", or available via
1515
* WWW at http://www.gnu.org/copyleft/gpl.html).
1616
*/
17-
#ifdef __MINGW__
18-
#include <winsock2.h>
19-
#define socklen_t int
20-
#endif
2117
#include <signal.h>
2218
#include <string.h>
2319
#include <unistd.h>
@@ -32,6 +28,9 @@
3228
#include <netinet/in.h>
3329
#include <arpa/inet.h>
3430
#include <netdb.h>
31+
#else
32+
#include <winsock2.h>
33+
#define socklen_t int
3534
#endif
3635

3736

@@ -49,8 +48,6 @@
4948
/** the att hash is initially sized to 2 to the power of 14 */
5049
#define ATTHASHSIZE 16384
5150

52-
void Rprintf(const char *, ...);
53-
5451
/** Error strings are limited to this many bytes. @see cqi_error_string */
5552
#define GENERAL_ERROR_SIZE 1024
5653

@@ -403,8 +400,8 @@ int
403400
cqi_send_byte(int n, int nosnoop)
404401
{
405402
#ifdef __MINGW__
406-
const char prep = (const char) 0xff & n;
407-
/* prep = (unsigned char) 0xff & n; */
403+
unsigned char prep;
404+
prep = (unsigned char) 0xff & n;
408405
#endif
409406

410407
if (!nosnoop)

src/cwb/CQi/server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "../cl/cl.h"
2222
#include "../cqp/corpmanag.h" /* for CorpusList */
2323

24-
typedef char cqi_byte;
24+
typedef unsigned char cqi_byte;
2525

2626
/* global errno variable; the error code is a CQi error message */
2727
/* utility functions such as cqi_lookup_attribute() set cqi_errno, so

src/cwb/Makefile

Lines changed: 148 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,47 +44,180 @@
4444
# doxygen to update the HTML code documentation (requires doxygen to be installed)
4545
#
4646

47-
TOP = $(R_PACKAGE_SOURCE)
47+
TOP = $(shell pwd)
4848
include $(TOP)/config.mk
4949

5050
# targets for external libraries; currently not used (Glib and PCRE assumed to be on the system already)
51-
SUBDIRS = cl cqp # subdirectories that have their own makefiles
51+
ifdef __MINGW__
52+
#EXTERNALS =
53+
else
54+
EXTERNALS =
55+
endif
56+
SUBDIRS = cl cqp utils man instutils # subdirectories that have their own makefiles
5257
SRCDIRS = cl cqp utils CQi # subdirectories containing C source code
5358

5459

5560
.PHONY: clean realclean depend all test install uninstall release mingw-libgnurx-2.5.1 cl cqp utils man instutils tags size
5661

62+
default:
63+
@$(ECHO) "Please type one of the following:"
64+
@$(ECHO) ""
65+
@$(ECHO) " make clean remove binaries and temporary files"
66+
@$(ECHO) " make realclean deletes all automatically generated files"
67+
@$(ECHO) " make depend updated dependencies"
68+
@$(ECHO) " make all build CWB libaries, programs and man pages"
69+
@$(ECHO) " make install install CWB into chosen location"
70+
@$(ECHO) " make release create binary release in build/ directory"
71+
@$(ECHO) " make tarball create source code release in build/ directory"
72+
@$(ECHO) ""
73+
@$(ECHO) " make cl build low-level corpus library (CL)"
74+
@$(ECHO) " make cqp build CQP query processor"
75+
@$(ECHO) " make utils build command-line utilities"
76+
@$(ECHO) " make man update manpages from POD sources"
77+
@$(ECHO) " make doxygen update HTML code documentation"
78+
@$(ECHO) " make docset create MacOS docset (see README)"
79+
@$(ECHO) " make instutils configure installation scripts"
80+
@$(ECHO) " make tags generate symbol index for GNU Emacs"
81+
@$(ECHO) " make size check total size of CWB source code"
82+
83+
all: $(EXTERNALS)
84+
@$(ECHO) "--------------------------------- BUILDING CORPUS LIBRARY (CL)"
85+
$(MAKE) -C cl
86+
@$(ECHO) "--------------------------------- BUILDING CQP"
87+
$(MAKE) -C cqp
88+
@$(ECHO) "--------------------------------- BUILDING COMMAND-LINE UTILITIES"
89+
$(MAKE) -C utils
90+
@$(ECHO) "--------------------------------- BUILDING MANPAGES"
91+
$(MAKE) -C man
5792

5893
cl:
5994
@$(ECHO) "--------------------------------- BUILDING CORPUS LIBRARY (CL)"
60-
cd cl; $(MAKE)
95+
$(MAKE) -C cl
6196

6297
cqp:
6398
@$(ECHO) "--------------------------------- BUILDING CQP"
64-
cd cqp; $(MAKE)
99+
$(MAKE) -C cqp
65100

66101
utils:
67-
@$(ECHO) "--------------------------------- BUILDING UTILITIES"
68-
cd utils; $(MAKE)
102+
@$(ECHO) "--------------------------------- BUILDING COMMAND-LINE UTILITIES"
103+
$(MAKE) -C utils
69104

70105
man:
71106
@$(ECHO) "--------------------------------- BUILDING MANPAGES"
72-
cd man; $(MAKE)
73-
107+
$(MAKE) -C man
108+
109+
doxygen:
110+
@$(ECHO) "--------------------------------- BUILDING CODE DOCUMENTATION"
111+
-$(RM) -rf doc/html
112+
doxygen doc/doxygen-config
113+
(cd doc && perl textile2html.perl)
114+
115+
docset:
116+
@$(ECHO) "--------------------------------- BUILDING CODE DOCSET (MacOS)"
117+
-$(RM) -rf doc/docset_html build/net.sourceforge.cwb.CWB3-Code.docset
118+
doxygen doc/doxygen-config-docset && \
119+
perl -i -lpe '$$_="DESTDIR=../../build" if /^DESTDIR=/; $$_="" if /^XCODE_INSTALL/; s{^(\s+).*/(docsetutil index)}{$$1$$2};' doc/docset_html/Makefile && \
120+
(cd doc/docset_html && make install) && \
121+
perl -i -lpe '$$_ .= "\n\t<key>dashIndexFilePath</key>\n\t<string>index.html</string>" if /^\s*<dict>/; s{(<string>)doxygen(</string>)}{$$1cwb$$2}' build/net.sourceforge.cwb.CWB3-Code.docset/Contents/Info.plist && \
122+
$(RM) -rf doc/docset_html && \
123+
$(ECHO) "Created MacOS docset in build/net.sourceforge.cwb.CWB3-Code.docset/"
124+
125+
instutils:
126+
@$(ECHO) "--------------------------------- CONFIGURING INSTUTILS"
127+
$(MAKE) -C instutils
128+
129+
test:
130+
@$(ECHO) "ERROR: no self tests available at the moment."
131+
# $(MAKE) -C test
74132

75133
size:
134+
@$(ECHO) "--------------------------------- MEASURING EXTENT OF THE CWB CODE"
76135
for i in $(SUBDIRS) ;\
77136
do \
78-
$(ECHO) "--------------------------------- $$i"; \
79-
cd $$i; \
80-
$(MAKE) size; \
137+
@$(ECHO) "--------------------------------- $$i"; \
138+
$(MAKE) -C $$i size; \
81139
done;
82140

83141
depend:
84-
for i in $(SUBDIRS) ; do cd $$i; $(MAKE) depend.mk; cd ..; done;
142+
@$(ECHO) "--------------------------------- UPDATING ALL DEPENDENCIES"
143+
for i in $(SUBDIRS) ;\
144+
do \
145+
$(MAKE) -C $$i depend; \
146+
done;
85147

86148
clean:
87-
for i in $(SUBDIRS); do if [ -f "$$i/Makefile" ]; then cd $$i; $(MAKE) clean; cd ..; fi; done;
149+
@$(ECHO) "--------------------------------- PERFORMING TYPICAL CLEANUP"
150+
for i in $(SUBDIRS) $(EXTERNALS); do if [ -f "$$i/Makefile" ]; then $(MAKE) -C $$i clean; fi; done;
88151
-$(RM) *~ config/*/*~ CQi/*~ CQi/*.o technical/*~ TAGS
89-
-$(RM) -rf build
90-
152+
-$(RM) -rf build/* doc/docset_html
153+
154+
realclean: clean
155+
@$(ECHO) "--------------------------------- PERFORMING EXTRA CLEANUP"
156+
for i in $(SUBDIRS) ; do $(MAKE) -C $$i realclean; done;
157+
ifdef __MINGW__
158+
-$(RM) -rf mingw-libgnurx-2.5.1/config.log mingw-libgnurx-2.5.1/config.status mingw-libgnurx-2.5.1/Makefile
159+
endif
160+
161+
install:
162+
ifdef __MINGW__
163+
@$(ECHO) "ERROR: install operation is not supported for Windows binaries!"
164+
else
165+
@$(ECHO) "--------------------------------- INSTALLING CORPUS WORKBENCH"
166+
$(MAKE) -C cl install # not in for loop to make sure we abort on error
167+
$(MAKE) -C cqp install
168+
$(MAKE) -C utils install
169+
$(MAKE) -C man install
170+
$(MAKE) -C instutils all
171+
$(MAKE) -C instutils install
172+
endif
173+
174+
release:
175+
@$(ECHO) "--------------------------------- BUILDING RELEASE BUNDLE"
176+
if [ -d "$(RELEASE_DIR)" ]; then $(RM) -rf "$(RELEASE_DIR)"; fi
177+
$(INSTALL) $(INST_FLAGS_DIR) "$(RELEASE_DIR)"
178+
$(MAKE) -C cl release
179+
$(MAKE) -C cqp release
180+
$(MAKE) -C utils release
181+
$(MAKE) -C man release
182+
$(MAKE) -C instutils all
183+
$(MAKE) -C instutils release
184+
# in case we need extra static libraries
185+
for i in $(RELEASE_EXTRA_LIBS); do $(INSTALL) $(INST_FLAGS_DATA) "$$i" "$(RELEASE_DIR)/lib"; done
186+
ifdef __MINGW__
187+
# for windwos, we need DLL file(s) in the bin/ directory
188+
for i in $(DLLS_TO_INSTALL); do $(INSTALL) $(INST_FLAGS_DATA) $$i "$(RELEASE_DIR)/bin"; done
189+
endif
190+
if [ -f "$(RELEASE_COMPRESSED_FILENAME)" ]; then $(RM) "$(RELEASE_COMPRESSED_FILENAME)"; fi
191+
(cd build/ && $(COMPRESS_COMMAND) "$(RELEASE_COMPRESSED_FILENAME)" "$(RELEASE_NAME)")
192+
@$(ECHO) "==> CREATED BINARY RELEASE build/$(RELEASE_COMPRESSED_FILENAME)"
193+
194+
tarball: realclean
195+
@$(ECHO) "--------------------------------- BUILDING SOURCE RELEASE"
196+
$(MAKE) depend
197+
$(MAKE) man
198+
$(MAKE) clean
199+
if [ -d "$(TARBALL_DIR)" ]; then $(RM) -rf "$(TARBALL_DIR)"; fi
200+
$(INSTALL) $(INST_FLAGS_DIR) "$(TARBALL_DIR)"
201+
$(CP) -p AUTHORS CHANGES COPYING INSTALL INSTALL-MACOS INSTALL-WIN README "$(TARBALL_DIR)"
202+
$(CP) -p config.mk definitions.mk Makefile rpm-linux.spec "$(TARBALL_DIR)"
203+
$(CP) -pR CQi cl config cqp doc editline install-scripts instutils man utils "$(TARBALL_DIR)"
204+
$(INSTALL) $(INST_FLAGS_DIR) "$(TARBALL_DIR)/build"
205+
if [ -f "$(TARBALL_COMPRESSED_FILENAME)" ]; then $(RM) "$(TARBALL_COMPRESSED_FILENAME)"; fi
206+
(cd build/ && $(COMPRESS_COMMAND) "$(TARBALL_COMPRESSED_FILENAME)" "$(TARBALL_NAME)")
207+
@$(ECHO) "==> CREATED SOURCE RELEASE build/$(TARBALL_COMPRESSED_FILENAME)"
208+
209+
uninstall:
210+
@$(ECHO) "ERROR: uninstall operation is currently not supported!"
211+
# for i in $(SUBDIRS) ;\
212+
# do \
213+
# $(MAKE) -C $$i uninstall; \
214+
# done;
215+
216+
tags:
217+
@$(ECHO) "--------------------------------- GENERATING 'TAGS' FILES"
218+
rm -f TAGS
219+
for i in $(SRCDIRS) ;\
220+
do \
221+
$(ETAGS) -a -o TAGS $$i/*.[chly]; \
222+
done
223+
# NB "-a" option is required because we build the TAGS file incrementally

0 commit comments

Comments
 (0)