Path: sokai!inet-gw!cae-gw!ntt-twins!nttlab!tutgw!hamamatsu-pc.ac.jp!dclsic!wnoc-tyo-news!astemgw!icspub!taeko!ouskn1!nishioka From: nishioka@sanken.osaka-u.ac.jp (Shingo NISHIOKA) Newsgroups: fj.sources Subject: dserver/Electronic Book Dictionary server & clients (2/2) Message-ID: Date: 3 Sep 91 10:15:36 GMT Sender: news@ouskn1.sanken.osaka-u.ac.jp Distribution: fj Organization: The Institute of Scientific and Industrial Research, Osaka University. Lines: 1868 #!/bin/sh # This is part 02 of a multipart archive # ============= dict/INSTALL ============== if test ! -d 'dict'; then echo 'x - creating directory dict' mkdir 'dict' fi if test -f 'dict/INSTALL' -a X"$1" != X"-c"; then echo 'x - skipping dict/INSTALL (File already exists)' else echo 'x - extracting dict/INSTALL (Text)' sed 's/^X//' << 'SHAR_EOF' > 'dict/INSTALL' && Xインストール X @@@ 0 X Discman用の, 「広辞苑」(7725円), 「研究社 新英和・和英中辞典」(6200円) Xを買ってきます. X Xインストールには, cdromドライブが必要です. X X @@@ 1 X X広辞苑を /usr/local/dict/k に, X英和,和英を /usr/local/dict/e にマウントします. X Xこんな感じになります. ===***===***===***===***===***===***===***===***===***===***===***=== e/ k/ X e: catalog. eiwa/ vtoc. waei/ X e/eiwa: start. X e/waei: start. X k: catalog kojien/ vtoc X k/kojien: start ===***===***===***===***===***===***===***===***===***===***===***=== X Xそれ以外の場所に辞書を置く場合には, 必ず eiwa/eiwa.c, waei/waei.c, kojien/kojien.c にある X #define DICT "..." X Xの行をそれぞれ変更して下さい. X X @@@ 2 X server/Makefile の先頭の方にある X CFLAGS=-Dsparc -g -DLOGGING #CFLAGS=-Dsparc -g X Xのいずれかを選択して下さい. -DLOGGING がついていると, syslog を使って X辞書の使用頻度などの記録が残ります. X X @@@ 3 X Xこのファイルがあるディレクトリで, X make X Xとします. X X @@@ 4 X server/dserver を /usr/local/dict などにコピーします. client/diclookup.el を emacs-lisp のライブラリがあるところにコピーします. Xそののち, M-x byte-compile-file でコンパイルしておきます. X X @@@ 5 X /etc/services に ndtp 2010/tcp # Network Dictionary Transfer Protocol Xという行を加えます. (2010 のところには好きな数字を書いて下さい.) X X @@@ 6 X /etc/rc.local に X if [ -f /usr/local/dict/dserver ]; then X (echo '/usr/local/dict/dserver &' | su ndtp) > /dev/console X (echo 'dserver.') > /dev/console fi X Xという行を加えます. X (私のところでは, ndtp というユーザを作り, オーナを ndtp にして動かしています.) SHAR_EOF chmod 0644 dict/INSTALL || echo 'restore of dict/INSTALL failed' Wc_c="`wc -c < 'dict/INSTALL'`" test 1806 -eq "$Wc_c" || echo 'dict/INSTALL: original size 1806, current size' "$Wc_c" fi # ============= dict/Makefile ============== if test -f 'dict/Makefile' -a X"$1" != X"-c"; then echo 'x - skipping dict/Makefile (File already exists)' else echo 'x - extracting dict/Makefile (Text)' sed 's/^X//' << 'SHAR_EOF' > 'dict/Makefile' && all: X cd server; make all clean: X cd server; make clean SHAR_EOF chmod 0644 dict/Makefile || echo 'restore of dict/Makefile failed' Wc_c="`wc -c < 'dict/Makefile'`" test 56 -eq "$Wc_c" || echo 'dict/Makefile: original size 56, current size' "$Wc_c" fi # ============= dict/kojien/Makefile ============== if test ! -d 'dict/kojien'; then echo 'x - creating directory dict/kojien' mkdir 'dict/kojien' fi if test -f 'dict/kojien/Makefile' -a X"$1" != X"-c"; then echo 'x - skipping dict/kojien/Makefile (File already exists)' else echo 'x - extracting dict/kojien/Makefile (Text)' sed 's/^X//' << 'SHAR_EOF' > 'dict/kojien/Makefile' && CFLAGS=-g all: kojien.o kojien.o: clean: X rm -f debug *.o *‾ debug: kojien.c ../server/util.c X cc -o debug -DDEBUG -DALONE kojien.c ../server/util.c convtest: convtest.c ../server/util.c X cc -o convtest -DDEBUG -DALONE convtest.c ../server/util.c SHAR_EOF chmod 0644 dict/kojien/Makefile || echo 'restore of dict/kojien/Makefile failed' Wc_c="`wc -c < 'dict/kojien/Makefile'`" test 247 -eq "$Wc_c" || echo 'dict/kojien/Makefile: original size 247, current size' "$Wc_c" fi # ============= dict/kojien/kojien.c ============== if test -f 'dict/kojien/kojien.c' -a X"$1" != X"-c"; then echo 'x - skipping dict/kojien/kojien.c (File already exists)' else echo 'x - extracting dict/kojien/kojien.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'dict/kojien/kojien.c' && /* X * Copyright (C) Shingo NISHIOKA, 1991 X * nishioka@sanken.osaka-u.ac.jp X */ X #include #include "../server/cdrom.h" X #define IOBUFSZ 128 X #define TRUE 1 #define FALSE 0 X #ifdef DEBUG extern int debug; #endif X /* the follwings are application specific constants */ X #define DICT "/usr/local/dict/k/kojien/start" X #define STARTFRAME 0x42c5 X /* end */ X static int current_stream; static FILE *dic; X kojien_init() { X X if(!(dic=fopen(DICT,"r"))) { X fprintf(stderr,"Cannot open file %s¥n",DICT); X exit(1); X } } X #ifdef ALONE main(argc,argv) int argc; char *argv[]; { #ifdef DEBUG X if(debug>=2) { X if(argc==3 && !strcmp(argv[1],"-x")) { X sscanf(argv[2],"%d",&debug); X } X } #endif X kojien_init(); X kojien_set_currout(0); X for(;;) { X char *p; X char buf[IOBUFSZ]; X printf("key="); X fgets(buf,IOBUFSZ,stdin); X if(buf[0]=='¥n') { X break; X } X else { X for(p=buf; *p&&*p!='¥n'; p++) ; X *p = '¥0'; X kojien_process_entry(buf); X } X } X printf("bye.¥n"); } #endif X kojien_process_entry(k) char *k; { X char buf[IOBUFSZ]; X char key[IOBUFSZ*2]; X char realkey[IOBUFSZ*2]; X int len; X X strncpy(buf,k,IOBUFSZ-1); X buf[IOBUFSZ-1]='¥0'; X neuc2jis(buf); X X strcpy(key,buf); X strcpy(realkey,buf); X X len = strlen(key); X key[len]='¥0'; X key[len+1]='¥0'; X realkey[len]='¥0'; X realkey[len+1]='¥0'; X X njisnormalize(key); X #ifdef DEBUG X if(debug>=2) { X printf("given key=¥033$@%s*¥033(J¥n",realkey); X printf("converted key=¥033$@%s¥033(J*¥n",key); X } #endif X if(masterindex(dic,key,realkey)) { X write(current_stream,"$!¥n",3); X } X else { X write(current_stream,"$$¥n",3); X } } X kojien_set_currout(out) int out; { X current_stream=out; } X typedef int fourbytes; typedef short int twobytes; X static masterindex(dic,key,realkey) FILE *dic; char *key,*realkey; { X struct _master_key { X char key[30]; X fourbytes ptr; X }; X struct _master_key master_key; X twobytes pad,count; X int i; X X seekframe(dic,STARTFRAME); X fread(&pad,sizeof(twobytes),1,dic); X fread(&count,sizeof(twobytes),1,dic); /* count--;*/ /* the master_index's bug? */ X for(i=0; i=2) { X for(j=0; j<48; j+=2) { X puteuc(master_key.key[j],master_key.key[j+1]); X } X printf("* %08x¥n",master_key.ptr); X } #endif X X if(jisstrsub(key,master_key.key)<=0) break; X } X if(i=2) { X printf("Next Frame = %08x¥n",master_key.ptr); X } #endif X return secondaryindex(dic,key,realkey,master_key.ptr); X } X else { X return -1; X } } X static secondaryindex(dic,key,realkey,frame) FILE *dic; char *key,*realkey; int frame; { X struct _second_key { X char key[30]; X fourbytes ptr; X }; X struct _second_key second_key; X twobytes pad,count; X int i; X X seekframe(dic,frame); X fread(&pad,sizeof(twobytes),1,dic); X fread(&count,sizeof(twobytes),1,dic); X for(i=0; i=2) { X for(j=0; j<48; j+=2) { X puteuc(second_key.key[j],second_key.key[j+1]); X } X printf("%08x¥n",second_key.ptr); X } #endif X if(jisstrsub(key,second_key.key)<=0) break; X } X if(i=2) { X printf("Next Frame = %08x¥n",second_key.ptr); X } #endif X return thirdindex(dic,key,realkey,second_key.ptr); X } X else { X return -1; X } } X struct _third_key { X char key1[128]; X char key2[128]; X fourbytes desc_ptr; X twobytes desc_offs; X fourbytes spell_ptr; X twobytes spell_offs; }; X static thirdindex(dic,key,realkey,frame) FILE *dic; char *key,*realkey; int frame; { X struct _third_key third_key; X twobytes count; X twobytes pad2; X unsigned char pad1; X int i; X unsigned char leng; X int status; X int curr_frame_type; X X status = -1; X seekframe(dic,frame); X fread(&pad1,sizeof(char),1,dic); X curr_frame_type = pad1; X fread(&pad1,sizeof(char),1,dic); X fread(&count,sizeof(twobytes),1,dic); #ifdef DEBUG X if(debug>=2) { X printf("Count=%d¥n",count); X } #endif X for(i=0; i=2) { X printf("*"); X for(j=0; ; j+=2) { X if(key[j]==0 && key[j+1]==0) break; X puteuc(key[j]&0x7f,key[j+1]&0x7f); X } X printf("*"); X for(j=0; j=2) { X printf("Spell:%08x,%04x¥n",key->spell_ptr,key->spell_offs); X printf("Descr:%08x,%04x¥n",key->desc_ptr,key->desc_offs); X } #endif X write(current_stream,"$0",2); X seekframe(dic,key->spell_ptr); X fseek(dic,key->spell_offs,1); X do { X hi = getc(dic); X lo = getc(dic); X } while(hi==0x1f); X do { X if(hi!=0x1f) { X puteucz2h(current_stream,hi,lo); X } X hi = getc(dic); X lo = getc(dic); X } while(!(hi==0x1f && lo==0x0a)); X write(current_stream,"¥n",1); X X write(current_stream,"$1",2); X seekframe(dic,key->desc_ptr); X fseek(dic,key->desc_offs,1); X X do { X if(hi!=0x1f) { X puteucz2h(current_stream,hi,lo); X } X hi = getc(dic); X lo = getc(dic); X } while(!(hi==0x00 && lo==0x01) && !(hi==0x00 && lo==0x00)); X X write(current_stream,"¥n",1); } SHAR_EOF chmod 0644 dict/kojien/kojien.c || echo 'restore of dict/kojien/kojien.c failed' Wc_c="`wc -c < 'dict/kojien/kojien.c'`" test 7173 -eq "$Wc_c" || echo 'dict/kojien/kojien.c: original size 7173, current size' "$Wc_c" fi # ============= dict/kojien/convtest.c ============== if test -f 'dict/kojien/convtest.c' -a X"$1" != X"-c"; then echo 'x - skipping dict/kojien/convtest.c (File already exists)' else echo 'x - extracting dict/kojien/convtest.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'dict/kojien/convtest.c' && /* X * Copyright (C) Shingo NISHIOKA, 1991 X * nishioka@sanken.osaka-u.ac.jp X */ X #include #include "../server/cdrom.h" X #define IOBUFSZ 128 X #define TRUE 1 #define FALSE 0 X static int current_stream; static FILE *dic; X main(argc,argv) int argc; char *argv[]; { X for(;;) { X char *p; X char buf[IOBUFSZ]; X printf("key="); X fgets(buf,IOBUFSZ,stdin); X if(buf[0]=='¥n') { X break; X } X else { X for(p=buf; *p&&*p!='¥n'; p++) ; X *p = '¥0'; X kojien_process_entry(buf); X } X } X printf("bye.¥n"); } X kojien_process_entry(k) char *k; { X char buf[IOBUFSZ]; X char key[IOBUFSZ*2]; X char realkey[IOBUFSZ*2]; X int len; X int i; X X strncpy(buf,k,IOBUFSZ-1); X buf[IOBUFSZ-1]='¥0'; X neuc2jis(buf); X X strcpy(key,buf); X strcpy(realkey,buf); X X len = strlen(key); X key[len]='¥0'; X key[len+1]='¥0'; X realkey[len]='¥0'; X realkey[len+1]='¥0'; X X njisnormalize(key); X X for(i=0; key[i]; i++) { X key[i]|=0x80; X } X for(i=0; realkey[i]; i++) { X realkey[i]|=0x80; X } X X printf("given key=%s*¥n",realkey); X printf("converted key=%s*¥n",key); } SHAR_EOF chmod 0644 dict/kojien/convtest.c || echo 'restore of dict/kojien/convtest.c failed' Wc_c="`wc -c < 'dict/kojien/convtest.c'`" test 1071 -eq "$Wc_c" || echo 'dict/kojien/convtest.c: original size 1071, current size' "$Wc_c" fi # ============= dict/DIST ============== if test -f 'dict/DIST' -a X"$1" != X"-c"; then echo 'x - skipping dict/DIST (File already exists)' else echo 'x - extracting dict/DIST (Text)' sed 's/^X//' << 'SHAR_EOF' > 'dict/DIST' && ./DIST このファイル ./INSTALL インストールの手順が書いてあります ./Makefile ./README ./client クライアントプログラム集 ./client/Makefile ./client/README ./client/client.c サンプルのクライアントで, dserverと直接通信します ./client/diclookup.el emacsからdserverを使うためのプログラムです ./client/dsstat.c dserverの使用状況を表示します ./doc ./doc/protocol dserverのプロトコルの表 ./eiwa 英和辞典ドライバ ./eiwa/Makefile ./eiwa/eiwa.c ./eiwa/eiwa.c.nowild ワイルドカードが使えないバージョン(未使用) ./kojien 広辞苑ドライバ ./kojien/Makefile ./kojien/convtest.c デバッグ用プログラム ./kojien/kojien.c ./server dserver ./server/Makefile ./server/README ./server/cdrom.h ./server/daemon.c ./server/main.c ./server/ndtp.h ./server/util.c ./waei 和英辞典ドライバ ./waei/Makefile ./waei/waei.c SHAR_EOF chmod 0644 dict/DIST || echo 'restore of dict/DIST failed' Wc_c="`wc -c < 'dict/DIST'`" test 887 -eq "$Wc_c" || echo 'dict/DIST: original size 887, current size' "$Wc_c" fi # ============= dict/README ============== if test -f 'dict/README' -a X"$1" != X"-c"; then echo 'x - skipping dict/README (File already exists)' else echo 'x - extracting dict/README (Text)' sed 's/^X//' << 'SHAR_EOF' > 'dict/README' && Xこのディレクトリはオンライン辞書のサーバ/クライアントの全てのソースを X含みます. X Xインストールの仕方は, INSTALL を見て下さい. X Xクライアントプログラムで唯一使い物になるのが diclookup.el です. Xインストールと使い方は INSTALL, client/README を見て下さい. X client にサンプルとして, client.c が入っています. このプログラムは dserver と通信するだけです. doc/protocol のコマンドが全て使えます. SHAR_EOF chmod 0644 dict/README || echo 'restore of dict/README failed' Wc_c="`wc -c < 'dict/README'`" test 469 -eq "$Wc_c" || echo 'dict/README: original size 469, current size' "$Wc_c" fi # ============= dict/client/client.c ============== if test ! -d 'dict/client'; then echo 'x - creating directory dict/client' mkdir 'dict/client' fi if test -f 'dict/client/client.c' -a X"$1" != X"-c"; then echo 'x - skipping dict/client/client.c (File already exists)' else echo 'x - extracting dict/client/client.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'dict/client/client.c' && /* X * Copyright (C) Shingo NISHIOKA, 1991 X * nishioka@sanken.osaka-u.ac.jp X * Everyone is permitted to do anything on this program X * including copying, transplanting, debugging, and modifying. X */ X #include #include #include #include #include X #include "ndtp.h" X #define BUFSIZE 4096 X main(argc,argv) char *argv[]; { X int width; X fd_set readfds, writefds, exceptfds; X X char buf[BUFSIZE]; X int s; X width = getdtablesize(); X X if(argc!=2) { X fprintf(stderr,"usage %s host¥n",argv[0]); X exit(1); X } X s = iclient_init(argv[1]); X for(;;) { X int l; X X FD_ZERO(&readfds); X FD_ZERO(&writefds); X FD_ZERO(&exceptfds); X FD_SET(0,&readfds); X FD_SET(s,&readfds); X select(width,&readfds,&writefds,&exceptfds,NULL); X if(FD_ISSET(s,&readfds)) { X l = read(s,buf,BUFSIZE); X buf[l] = '¥0'; X if(l==0) break; X printf("%s",buf); X } X /* NEVER remove 'else' from next line. */ X else if(FD_ISSET(0,&readfds)) { X fgets(buf,BUFSIZE,stdin); X write(s,buf,strlen(buf)); X } X } X printf("Connection closed¥n"); X close(s); } X iclient_init(remote) char *remote; { X int s; X struct sockaddr_in peeraddr_in; X struct hostent *hp; X struct servent *sp; X X bzero( (char *)&peeraddr_in, sizeof(struct sockaddr_in) ) ; X X peeraddr_in.sin_family = AF_INET ; X hp = gethostbyname( remote ) ; X if( hp == NULL ) { X perror( "iclient_init: " ); X fprintf( stderr, "%s is not found in /etc/hosts¥n", remote ); X exit(1) ; X } X peeraddr_in.sin_addr.s_addr=((struct in_addr *)(hp->h_addr))->s_addr ; X X sp = getservbyname( SERVICE, "tcp" ) ; X if( sp == NULL ) { X perror( "in iclient_init" ); X fprintf( stderr, "%s is not found in /etc/services¥n", SERVICE ); X exit(1) ; X } X peeraddr_in.sin_port = sp->s_port ; X X s = socket( AF_INET, SOCK_STREAM, 0 ) ; X if( s == -1 ) { X perror( "Unable to create a socket /iclient_init¥n" ) ; X exit(1) ; X } X X if( connect( s,&peeraddr_in, sizeof(struct sockaddr_in) )==-1 ) { X perror( "Unable to connect /iclient_init¥n" ) ; X exit(1) ; X } X return s; } SHAR_EOF chmod 0644 dict/client/client.c || echo 'restore of dict/client/client.c failed' Wc_c="`wc -c < 'dict/client/client.c'`" test 2089 -eq "$Wc_c" || echo 'dict/client/client.c: original size 2089, current size' "$Wc_c" fi # ============= dict/client/Makefile ============== if test -f 'dict/client/Makefile' -a X"$1" != X"-c"; then echo 'x - skipping dict/client/Makefile (File already exists)' else echo 'x - extracting dict/client/Makefile (Text)' sed 's/^X//' << 'SHAR_EOF' > 'dict/client/Makefile' && #CFLAGS=-g -DDEBUG -I../server CFLAGS=-g -I../server SRC=client.c OBJ=client.o all: client client: $(OBJ) X cc $(CFLAGS) -o client $(OBJ) $(OBJ): clean: X rm -f client core $(OBJ) *‾ SHAR_EOF chmod 0644 dict/client/Makefile || echo 'restore of dict/client/Makefile failed' Wc_c="`wc -c < 'dict/client/Makefile'`" test 181 -eq "$Wc_c" || echo 'dict/client/Makefile: original size 181, current size' "$Wc_c" fi # ============= dict/client/diclookup.el ============== if test -f 'dict/client/diclookup.el' -a X"$1" != X"-c"; then echo 'x - skipping dict/client/diclookup.el (File already exists)' else echo 'x - extracting dict/client/diclookup.el (Text)' sed 's/^X//' << 'SHAR_EOF' > 'dict/client/diclookup.el' && ;;; ;;; Copyright (C) Shingo NISHIOKA, 1991 ;;; nishioka@sanken.osaka-u.ac.jp ;;; X (defvar dserver-host-name) (defvar od:*window-config*) (defvar od:*body-fillcolumn* nil) (defvar od:*select-unique-entry-immediately* t) (defvar od:*scroll-step* 'full) (defvar od:*eiwa-summary-mode* nil) (defvar od:*default-jisyo* nil) X (defvar dserv-protocol "ndtp") X ;;; Caution: No variables allowed to be buffer-local (defvar od:*previous-config* nil) (defvar od:*dict* nil) (defvar od:*headers*) X (defvar od:*current-entry* -1) X (defvar od:*input-by-kanji* nil) (defvar od:*current-jisyo*) (defvar od:*current-jisyo-pretty-name* "") (defvar od:*current-entry-string* "") (defconst od:*jisyo* '(("eiwa" "eiwa") ("waei" "waei") ("kojien" "kojien"))) (defconst od:*dict-name* X '(("eiwa" . "新英和中辞典") X ("waei" . "新和英中辞典") X ("kojien" . "広辞苑"))) (defconst od:*is-use-kanji* '(("eiwa" . nil) ("waei" . t) ("kojien" . t))) X X ;;; dict filter X (defvar od:*current-dict-filter-func* nil) X (defconst od:*dict-filter-func* X '(("eiwa" . (eiwa-reformatter od:filter-buffer eiwa-make-summary)) X ("waei" . (od:filter-buffer)) X ("kojien" . (od:filter-buffer)))) X ;; eiwa ;; ;; ". [1|2|3|4|5|6|7|8|9] " ;; "¥(.¥) ¥([1-9]a? ¥)" -> "¥1¥n¥n¥2" ;; 全角ピリオド, 半角スペース, 半角数字, 半角スペースのシー ;; ケンスがあったら数字の前で改行2個. ;; 数字の後に"a"が入ることがある. ;; ;; ". [b|c|d|e|f|...] " ;; "¥(.¥) ¥([b-z] ¥)" -> "¥1¥n¥2" ;; 全角ピリオド, 半角スペース, a以外の若い半角英字, 半角 ;; スペースのシーケンスがあったら半角英字の前で改行1個. X ;; " − " -> "¥n − " X (defvar od:*dict-filter* X '(("eiwa" . (("¥¥(.¥¥) ¥¥([1-9][0-9]?[a(]? ¥¥)" . "¥¥1¥n¥n ¥¥2") X ("¥¥(.¥¥) ¥¥([bcdefg] ¥¥)" . "¥¥1¥n ¥¥2") X ("¥015¥005" . "¥n ") X (" ¥¥(−[¥¥[ ]¥¥)" . "¥n¥n¥n ¥¥1"))) X ("waei" . (("¥015¥005" . "¥n¥n ") X ("/ " . "¥n / ") X ("./" . ".¥n /"))) X ("kojien" . (("¥015¥005" . "¥n¥n ") X ("¥¥(([1-9][0-9]*)¥¥)" . "¥n ¥¥1"))))) X (defvar od:*current-dict-filter* nil) X (defun od:filter-buffer () X (let ((tmp od:*current-dict-filter*)) X (while tmp X (goto-char 1) X (while (re-search-forward (car (car tmp)) nil t nil) X (replace-match (cdr (car tmp)) t nil)) X (setq tmp (cdr tmp))))) X (defun eiwa-reformatter () X (goto-char 1) X (if (re-search-forward "¥¥[[^]]*¥¥]" nil t nil) X (insert "¥n¥n"))) X (defun eiwa-make-summary () X (goto-char 1) X (if od:*eiwa-summary-mode* X (while (re-search-forward ":" nil t nil) X (backward-char 1) X (kill-line)))) X X X (defvar odic-mode-syntax-table nil X "Syntax table used while in odic mode.") X (defvar odic-mode-abbrev-table nil X "Abbrev table used while in odic mode.") (define-abbrev-table 'odic-mode-abbrev-table ()) X (if odic-mode-syntax-table X () X (setq odic-mode-syntax-table (make-syntax-table))) X (defvar odic-mode-map nil "") (if odic-mode-map X () X (setq odic-mode-map (make-sparse-keymap)) X (define-key odic-mode-map "f" 'od:lookup-pattern) X (define-key odic-mode-map "¥C-s" 'od:lookup-pattern) X (define-key odic-mode-map "i" 'od:lookup-pattern-with-ispell) X (define-key odic-mode-map "." 'od:current-entry) X (define-key odic-mode-map " " 'od:scroll-entry-up) X (define-key odic-mode-map "" 'od:scroll-entry-down) X (define-key odic-mode-map "¥C-d" 'od:scroll-entry-up-half) X (define-key odic-mode-map "¥C-u" 'od:scroll-entry-down-half) X (define-key odic-mode-map "h" 'od:show-headers) X (define-key odic-mode-map "p" 'od:previous-entry) X (define-key odic-mode-map "n" 'od:next-entry) X (define-key odic-mode-map "?" 'od:help) X (define-key odic-mode-map "q" 'od:quit) X (define-key odic-mode-map "Q" 'od:really-quit) X (define-key odic-mode-map "s" 'od:select-entry) X (define-key odic-mode-map "C" 'od:change-dictionary) X (define-key odic-mode-map "E" 'od:toggle-eiwa-summary-mode) X (define-key odic-mode-map "1" 'od:direct-select-entry) X (define-key odic-mode-map "2" 'od:direct-select-entry) X (define-key odic-mode-map "3" 'od:direct-select-entry) X (define-key odic-mode-map "4" 'od:direct-select-entry) X (define-key odic-mode-map "5" 'od:direct-select-entry) X (define-key odic-mode-map "6" 'od:direct-select-entry) X (define-key odic-mode-map "7" 'od:direct-select-entry) X (define-key odic-mode-map "8" 'od:direct-select-entry) X (define-key odic-mode-map "9" 'od:direct-select-entry)) X (defun odic-mode () X "Major mode for editing odic intended for humans to read. Special commands:¥¥{odic-mode-map} Turning on odic-mode calls the value of the variable odic-mode-hook, if that value is non-nil." X (interactive) X (kill-all-local-variables) X (use-local-map odic-mode-map) X (setq mode-name "Dict") X (setq major-mode 'odic-mode) X (setq local-abbrev-table odic-mode-abbrev-table) X (set-syntax-table odic-mode-syntax-table) X (setq buffer-read-only t) X (make-variable-buffer-local 'goal-column) X (setq goal-column 3) X (make-variable-buffer-local 'mode-line-format) X (setq mode-line-format X '((kanji-flag X ((minibuffer-window-selected X (display-minibuffer-mode "m" " ") X " ") X "[" X (minibuffer-window-selected X (display-minibuffer-mode X mode-line-egg-mode-in-minibuffer mode-line-egg-mode) X mode-line-egg-mode) X "]")) X "" X mode-line-modified X mode-line-nemacs-header X " " X od:*current-jisyo-pretty-name* X " " X global-mode-string X " %[(" X (kanji-flag ("%c" ":")) X mode-name X minor-mode-alist X "%n" X mode-line-process X ")%]--" X (-3 . "%p") X "-%-")) X (run-hooks 'odic-mode-hook)) X (defvar odic-body-mode-syntax-table nil X "Syntax table used while in odic body mode.") X (defvar odic-body-mode-abbrev-table nil X "Abbrev table used while in odic body mode.") (define-abbrev-table 'odic-body-mode-abbrev-table ()) X (if odic-body-mode-syntax-table X () X (setq odic-body-mode-syntax-table (make-syntax-table))) X (defvar odic-body-mode-map nil "") (if odic-body-mode-map X () X (setq odic-body-mode-map (make-sparse-keymap)) X (define-key odic-body-mode-map "9" 'od:direct-select-entry)) X (defun odic-body-mode () X "Major mode for editing odic intended for humans to read. Special commands:¥¥{odic-body-mode-map} Turning on odic-body-mode calls the value of the variable odic-body-mode-hook, if that value is non-nil." X (interactive) X (kill-all-local-variables) X (use-local-map odic-body-mode-map) X (setq mode-name "DictBody") X (setq major-mode 'odic-body-mode) X (setq local-abbrev-table odic-body-mode-abbrev-table) X (set-syntax-table odic-body-mode-syntax-table) X (setq buffer-read-only t) X (make-variable-buffer-local 'fill-column) X (setq fill-column (or od:*body-fillcolumn* X (let ((fillcol (- (window-width) 10))) X (if (< 0 fillcol) X fillcol)) X fill-column)) X (make-variable-buffer-local 'mode-line-format) X (setq mode-line-format X '((kanji-flag X ((minibuffer-window-selected X (display-minibuffer-mode "m" " ") X " ") X "[" X (minibuffer-window-selected X (display-minibuffer-mode X mode-line-egg-mode-in-minibuffer mode-line-egg-mode) X mode-line-egg-mode) X "]")) X "" X mode-line-modified X mode-line-nemacs-header X " " X od:*current-entry-string* X " " X od:*eiwa-current-display-mode* X global-mode-string X " %[(" X (kanji-flag ("%c" ":")) X mode-name X minor-mode-alist X "%n" X mode-line-process X ")%]--" X (-3 . "%p") X "-%-")) X (run-hooks 'odic-body-mode-hook)) X X X (defun od:open-dictionary () X (if od:*dict* X () X (setq od:*dict* (open-network-stream "*ndtp*" " *ndtp*" X dserver-host-name X dserv-protocol)) X (set-process-kanji-code od:*dict* 3) X (set-process-sentinel od:*dict* 'od:watchdog) X (set-buffer " *ndtp*") X (erase-buffer) X (process-send-string od:*dict* X (format "A%s@%s¥n" (getenv "USER") (od:hostname))) X (let ((ans (od:wait-until '("$A¥n" "$!¥n" "$?¥n" "$N¥n") od:*dict*))) X (if (not (string= "$A¥n" ans)) X (error "Cannot connect to jisyo server"))) X (erase-buffer))) X (defun od:wait-until (list proc) X (catch 'od:wait-until X (while t X (let* ((str (buffer-string)) X (len (length str)) X (tmp list)) X (while tmp X (let* ((item (car tmp)) X (ilen (length item))) X (cond ((< len ilen) nil) X ((string= item (substring str (- len ilen))) X (throw 'od:wait-until item)))) X (setq tmp (cdr tmp))) X (accept-process-output proc))))) X (defun od:setup-windows () X (delete-other-windows) X (switch-to-buffer "*Dict-Header*") X (switch-to-buffer "*Dict-Body*") X (split-window (selected-window) od:*window-config*) X (switch-to-buffer "*Dict-Header*")) X (defun od:kill-active-buffers () X (kill-buffer "*Dict-Header*") X (kill-buffer "*Dict-Body*")) X (defun od:set-header () X (od:setup-windows) X (set-buffer "*Dict-Header*")) X (defun od:set-body () X (od:setup-windows) X (set-buffer "*Dict-Body*")) X (defun od:switch-to-header () X (od:setup-windows) X (switch-to-buffer "*Dict-Header*")) X (defun od:switch-to-body () X (od:setup-windows) X (switch-to-buffer "*Dict-Body*")) X (defun od:watchdog (process event) X (if (string= "finished¥n" event) X (setq od:*dict* nil))) X X X (defun online-dictionary () X (interactive) X (let ((is-first (not od:*dict*))) X (setq od:*eiwa-current-display-mode* X (if od:*eiwa-summary-mode* "[Summary]" X "")) X (setq od:*previous-config* (current-window-configuration)) X (get-buffer-create " *ndtp*") X (get-buffer-create " *od:hostname*") X (get-buffer-create " *od:temp*") X (get-buffer-create "*Dict-Header*") X (get-buffer-create "*Dict-Body*") X (od:set-header) X (odic-mode) X (od:set-body) X (odic-body-mode) X (od:set-header) X (delete-other-windows) X (let ((buffer-read-only nil)) X (erase-buffer) X (od:show-title)) X (od:open-dictionary) X (if is-first X (if od:*default-jisyo* X (od:really-change-dictionary od:*default-jisyo*) X (od:change-dictionary))) X (od:help))) X (defun od:help () X (interactive) X (with-output-to-temp-buffer " *od:Help*" X (princ " X オンライン辞書コマンドリファレンス X Xキー 動作 X f,C-s 検索を行ないます. X 入力したパターンに完全に一致する候補が表示されます. X パターンは半角アルファベット(英和), X 平仮名, 片仮名(和英, 広辞苑) で入力します. X なお, 辞書が和英, 広辞苑にセットされている時には, 自動的に X egg-mode になります. i ispellを用いてあやふやな綴から入力パターンを選びます. (英和辞書の時便利) X . 現在の候補の説明文を表示します. p 直前の候補の説明文を表示します. n 直後の候補の説明文を表示します. s 候補を番号で選び, その説明文を表示します. 1-9 1-9番の候補を直接選び, その説明文を表示します. X 10番以降は ¥"s¥" または ¥"n¥" コマンドを使って下さい. X SPC 説明文を od:*scroll-step* で示された値だけ上にスクロールします. DEL 説明文を od:*scroll-step* で示された値だけ下にスクロールします. C-d 説明文を od:*scroll-step* で示された値の半分だけ上にスクロールします. C-u 説明文を od:*scroll-step* で示された値の半分だけ下にスクロールします. X これらのコマンドは説明文が表示されていなければ ¥".¥" と同じ動作をします. X od:*scroll-step* には, 整数, half, full のいずれかが指定できます. X デフォルトは full です. X h ヘッダに戻ります. q オンライン辞書起動前のウインドウコンフィグレーションに戻ります. Q オンライン辞書の持つバッファを全て削除し, X オンライン辞書起動前のウインドウコンフィグレーションに戻ります. X C 辞書を切替えます. X 現在 eiwa(英和辞典), waei(和英辞典), kojien(広辞苑) が使えます. X コンプリーション入力が可能です. E 英和辞典での例文の表示の ON/OFF を切替えます. ? このメッセージを表示します. "))) X (defun od:show-title () X (insert " X X X X X 電子ブック版辞書検索システム X X X 岩波書店 広辞苑(第三版) X 研究社 新英和中辞典(第5版)・新和英中辞典(第3版) X X Copyright (C) Shingo NISHIOKA, 1991 X nishioka@sanken.osaka-u.ac.jp X X X * 「広辞苑」は株式会社岩波書店の登録商標です. ") X (goto-char 1)) X (defun od:change-dictionary () X (interactive) X (let ((new-dic (completing-read "Select jisyo: " od:*jisyo*))) X (od:really-change-dictionary new-dic))) X (defun od:really-change-dictionary (new-dic) X (od:open-dictionary) X (set-buffer " *ndtp*") X (erase-buffer) X (process-send-string od:*dict* (format "L%s¥n" new-dic)) X (let ((ans (od:wait-until '("$A¥n" "$N¥n" "$?¥n" "$*¥n" "$&¥n") od:*dict*))) X (if (not (string= ans "$*¥n")) X (error "Jisyo set failed") X (setq od:*current-jisyo* new-dic) X (setq od:*current-jisyo-pretty-name* X (cdr (assoc new-dic od:*dict-name*))) X (setq od:*current-dict-filter* X (cdr (assoc new-dic od:*dict-filter*))) X (setq od:*current-dict-filter-func* X (cdr (assoc new-dic od:*dict-filter-func*))) X (setq od:*input-by-kanji* (cdr (assoc new-dic od:*is-use-kanji*))) X (message "辞書が「%s」にセットされました." X od:*current-jisyo-pretty-name*)))) X (defun od:lookup-pattern () X (interactive) X (let ((pat (if od:*input-by-kanji* X (od:read-string-with-egg "Pattern(in kana): ") X (read-string "Pattern: ")))) X (od:really-lookup-pattern pat))) X (defun od:really-lookup-pattern (pat) X (od:open-dictionary) X (set-buffer " *ndtp*") X (erase-buffer) X (process-send-string od:*dict* (format "p%s¥n" pat)) X (let ((ans (od:wait-until '("$$¥n" "$!¥n" "$?¥n" "$N¥n" "$A¥n") od:*dict*))) X (cond ((string= "$$¥n" ans) X (od:find-entries (buffer-string)) X (setq continue-loop nil)) X ((or (string= "$!¥n" ans) X (string= "$?¥n" ans) X (string= "$N¥n" ans) X (string= "$A¥n" ans)) X (od:no-entries-found pat))))) X (defun od:find-entries (str) X (set-buffer " *od:temp*") X (erase-buffer) X (insert str) X (setq od:*headers* nil) X (setq od:*current-entry* -1) X (goto-char 1) X (while (looking-at "$.") X (if (looking-at "$0") ;this is $0 line X (let (entry title body) X (forward-char 2) ;just after $0 X (let ((begin (point))) X (end-of-line) X (let ((end (point))) X (setq entry (buffer-substring begin end)))) X (next-line 1) ;$1 line X (beginning-of-line) X (forward-char 2) ;just after $1 X (setq title "") X (let ((begin (point))) X (end-of-line) X (let ((end (point))) X (setq body (buffer-substring begin end)))) X (if (not (od:findp-equal (cons entry body) od:*headers*)) X (setq od:*headers* X (cons (cons entry body) X od:*headers*))))) X (next-line 1) X (beginning-of-line)) X (setq od:*headers* (reverse od:*headers*)) X (od:show-headers) X (delete-other-windows) X (if (and od:*select-unique-entry-immediately* X (= 1 (length od:*headers*))) X (od:select-entry 1))) X (defun od:show-headers () X (interactive) X (od:set-header) X (let ((buffer-read-only nil)) X (erase-buffer) X (insert (format "%d entries.¥n" X (length od:*headers*))) X (let ((tmp od:*headers*) X (i 1)) X (while tmp X (let ((ent (car tmp))) X (insert (format "%2d: %s¥n" i (car ent)))) X (setq i (1+ i)) X (setq tmp (cdr tmp))))) X (goto-line 2) X (forward-char 3)) X (defun od:select-entry (n) X (interactive "nNumber:") X (let ((len (length od:*headers*))) X (if (and (<= 1 n) (<= n len)) X (progn X (setq od:*current-entry* n) X (od:show-entry (nth (1- n) od:*headers*)) X (goto-line (1+ n)) X (forward-char 3)) X (message (format "%d out of range" n))))) X (defun od:direct-select-entry () X (interactive) X (let ((n (string-to-int (char-to-string last-command-char)))) X (od:select-entry n))) X (defun od:current-header-line () X (save-excursion X (od:set-header) X (1- (count-lines 1 (1+ (point)))))) X (defun od:previous-entry () X (interactive) X (let ((curr (od:current-header-line))) X (if (< 1 curr) X (od:select-entry (1- curr)) X (message "No previous entry")))) X (defun od:current-entry () X (interactive) X (let ((curr (od:current-header-line))) X (od:select-entry curr))) X (defun od:next-entry () X (interactive) X (let ((curr (od:current-header-line))) X (if (< curr (length od:*headers*)) X (od:select-entry (1+ curr)) X (message "No following entry")))) X (defun od:scroll-step () X (cond ((integerp od:*scroll-step*) X od:*scroll-step*) X ((eql od:*scroll-step* 'full) X (- (window-height (next-window (selected-window))) 2)) X ((eql od:*scroll-step* 'half) X (- (/ (window-height (next-window (selected-window))) 2) 1)))) X (defun od:scroll-entry-up () X (interactive) X (let ((curr (od:current-header-line))) X (if (/= od:*current-entry* curr) X (od:select-entry curr) X (scroll-other-window (od:scroll-step))))) X (defun od:scroll-entry-down () X (interactive) X (let ((curr (od:current-header-line))) X (if (/= od:*current-entry* curr) X (od:select-entry curr) X (scroll-other-window (- (od:scroll-step)))))) X (defun od:scroll-entry-up-half () X (interactive) X (let ((curr (od:current-header-line))) X (if (/= od:*current-entry* curr) X (od:select-entry curr) X (scroll-other-window (/ (od:scroll-step) 2))))) X (defun od:scroll-entry-down-half () X (interactive) X (let ((curr (od:current-header-line))) X (if (/= od:*current-entry* curr) X (od:select-entry curr) X (scroll-other-window (- (/ (od:scroll-step) 2)))))) X (defun od:show-entry (entry) X (save-excursion X (od:set-body) X (let ((buffer-read-only nil)) X (erase-buffer) X (setq od:*current-entry-string* (car entry)) X (insert (cdr entry)) X (let ((tmp od:*current-dict-filter-func*)) X (while tmp X (goto-char 1) X (funcall (car tmp)) X (setq tmp (cdr tmp)))) X (fill-region 1 (point-max)) X (hang-indent-buffer)) X (goto-char 1))) X (defun od:no-entries-found (pat) X (od:set-body) X (let ((buffer-read-only nil)) X (erase-buffer) X (insert (format "¥"%s¥" Not found¥n" pat))) X (od:set-header)) X X X (defun od:toggle-eiwa-summary-mode () X (interactive) X (setq od:*eiwa-summary-mode* (not od:*eiwa-summary-mode*)) X (if od:*eiwa-summary-mode* X (setq od:*eiwa-current-display-mode* "[Summary]") X (setq od:*eiwa-current-display-mode* "")) X (od:current-entry)) X X X (defun od:quit () X (interactive) X (if od:*previous-config* X (set-window-configuration od:*previous-config*)) X (setq od:*previous-config* nil)) X (defun od:really-quit () X (interactive) X (od:kill-active-buffers) X (if od:*previous-config* X (set-window-configuration od:*previous-config*)) X (setq od:*previous-config* nil)) X X X (defun od:hostname () X (save-excursion X (set-buffer " *od:hostname*") X (erase-buffer) X (call-process "/bin/hostname" nil " *od:hostname*") X (let ((str (buffer-string))) X (let ((i 0) X (len (length str))) X (while (and (< i len) X (/= (aref str i) ?¥n)) X (setq i (1+ i))) X (substring str 0 i))))) X X (defvar od:ispell-program-name "ispell" X "Program invoked by ispell-word and ispell-region commands.") X (defconst od:ispell-out-name " *ispell*" X "Name of the buffer that is associated with the 'ispell' process") X (defvar od:ispell-process nil X "Holds the process object for 'ispell'") X (defun od:ispell-init-process () X (if (and od:ispell-process X (eq (process-status od:ispell-process) 'run)) X (save-excursion X (set-buffer od:ispell-out-name) X (erase-buffer)) X (message "Starting new ispell process...") X (and (get-buffer od:ispell-out-name) (kill-buffer od:ispell-out-name)) X (setq od:ispell-process (apply 'start-process "ispell" X od:ispell-out-name od:ispell-program-name X (list "-A"))) X (process-kill-without-query od:ispell-process) X (sleep-for 3))) X (defun od:lookup-pattern-with-ispell () X (interactive) X (let ((orig-pat (read-string "Pattern: "))) X (od:ispell-init-process) X (send-string od:ispell-process orig-pat) X (send-string od:ispell-process "¥n") X (sleep-for 3) X (set-buffer od:ispell-out-name) X (goto-char 1) X (cond ((looking-at "¥¥*") X ;; correct! X (od:really-lookup-pattern orig-pat)) X ((looking-at "+") X ;; a word follows X (od:really-lookup-pattern (od:select-candidate))) X ((looking-at "&") X ;; some words follows X (od:really-lookup-pattern (od:select-candidate))) X ((looking-at "#") X ;; cannot find any candidates X (message "No candidate."))))) X (defun od:select-candidate () X (goto-char 1) X (forward-char 2) X (let ((list nil)) X (while (looking-at "[^ ]") X (let ((begin (point))) X (forward-word 1) X (setq list (cons (buffer-substring begin (point)) list))) X (while (looking-at "[ ¥t¥n]") (forward-char 1))) X (with-output-to-temp-buffer " *od:Selection*" X (let ((i 1) X (col 0) X (l list)) X (while l X (let ((str (format "(%d) %s " i (car l)))) X (let ((len (length str))) X (if (< (- (screen-width) 2) (+ col len)) X (progn X (princ "¥n") X (setq col 0))) X (setq col (+ col len)) X (princ str))) X (setq l (cdr l)) X (setq i (1+ i))))) X (let ((sel (od:read-integer))) X (while (or (< sel 1) (< (length list) sel)) X (setq sel (od:read-integer))) X (nth (1- sel) list)))) X (defun od:read-integer () X (let ((n (string-to-int (read-from-minibuffer "Choose:")))) X (while (not (integerp n)) X (setq n (string-to-int (read-from-minibuffer "Choose:")))) X n)) X (defun od:read-string-with-egg (prompt) X (set-buffer (format " *Minibuf-%d*" (minibuffer-depth))) X (toggle-egg-mode) X (read-string prompt)) X (defun od:findp-equal (item sequence) X (let ((is-true nil)) X (while (and sequence X (not is-true)) X (if (equal item (car sequence)) X (setq is-true t) X (setq sequence (cdr sequence)))) X is-true)) X (defun hang-indent-buffer () X (goto-char 1) X (beginning-of-line) X (while (< (point) (point-max)) X (cond ((looking-at "[ ¥t]") X (while (looking-at "[ ¥t]") X (delete-char 1))) X ((looking-at "¥n") X ;; do nothing X ) X (t X (insert " "))) X (next-line 1) X (beginning-of-line))) SHAR_EOF chmod 0644 dict/client/diclookup.el || echo 'restore of dict/client/diclookup.el failed' Wc_c="`wc -c < 'dict/client/diclookup.el'`" test 22396 -eq "$Wc_c" || echo 'dict/client/diclookup.el: original size 22396, current size' "$Wc_c" fi # ============= dict/client/README ============== if test -f 'dict/client/README' -a X"$1" != X"-c"; then echo 'x - skipping dict/client/README (File already exists)' else echo 'x - extracting dict/client/README (Text)' sed 's/^X//' << 'SHAR_EOF' > 'dict/client/README' && * オンライン辞書のセットアップ X .emacs に 次の5行を加えます. X (defvar dserver-host-name "host") ; dserver が動いているホスト (defvar od:*window-config* 6) ; 候補を表示するウインドウの行数+1 (defvar od:*body-fillcolumn* nil) ; 説明を表示する時の最大幅 通常はnilでよい (defvar od:*select-unique-entry-immediately* t) X ; この変数がtのとき, 候補が1つならいきなり表示する (defvar od:*scroll-step* 'half) ; 説明文をスクロールする時のステップ (load "diclookup") ; /usr/local/lisp/diclookup.el X X X * オンライン辞書の起動 X M-x online-dictionary RET で起動します. X Xはじめて起動した時には辞書を尋ねてくるので, eiwa, waei, kojien のいずれかを答えます. (使用中に C コマンドを使えば辞書の切替えも可能) X X変数 od:*default-jisyo* が nil でなかった場合, その辞書が自動で開かれます. X X X * オンライン辞書の終了 X emacs を終了すると自動的にサーバとのコネクションを閉じます. X "q" とすると, オンライン辞書を起動した時のウインドウの状態に戻ります. X "Q" とすると, オンライン辞書のバッファを全て削除し, そののちオンライン X辞書を起動した時のウインドウの状態に戻ります. X Xオンライン辞書のバッファを削除してしまった場合, M-x online-dictionary RET Xでバッファを作り直してくれます. X X X * ヘルプ機能 X "?" とすると, ヘルプが表示されます. X X X * 辞書を引く X Xオンライン辞書のバッファで, f または ¥C-s とすると, ミニバッファに Pattern:と表示され, 広辞苑, 和英辞典の場合にはさらに自動的にeggモード Xになります. (¥C-g を2回押さないと脱出できないので注意!) X X平仮名, 片仮名(広辞苑,和英), 半角アルファベット(英和)のみからなるパター Xンを入力したのち RET を押すと検索が開始され, パターンに完全にマッチし Xたエントリが全て表示されます. パターンにマッチするいかなるエントリを Xも発見できなければ, Not found と表示されます. X (コマンドのエラー, 権限の与えられていないセッションでも同様の表示にな Xります. どうしてもおかしいと思ったら相談に来て下さい.) X X好みの候補まで ¥C-n, ¥C-p で移動し, SPC を押すとその説明が表示されます. Xさらに SPC を押すと表示がスクロールします. また, DELで逆方向にスクロー Xルします. X X説明を見たい候補が 1-9 の場合, 1-9 までのキーで直接選択できます. また, s コマンドで候補の番号を選択することもできます. X n で直後の候補, p で直前の候補を表示します. X X X * ispell(スペルチェッカ) を使う X i とすると, パターンを尋ねてきます. ここで半角英字のみの綴りを入れると, Xその綴りに似た綴りの単語全てを表示し, 選択モードに入ります. 綴りをはっ Xきり思い出せない時など便利な機能です. X X X * 辞書を切替える X C と押すと切替える辞書を尋ねてきます. eiwa, waei, kojien のいずれかを X指定します. X X X * 非印字文字の表示 X X辞書サーバは解釈不能(*)な非印字文字を発見した場合, #x?? の形式で印字し Xます. ここに, ? には 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f のいずれかの文字 Xが入ります. また, 表示不可能な2バイト文字は'■'と表示されます. また, '#' が単独で現れる場合は必ず全角文字で現れます. X (*) 実際には何か意味があるはずなのですが, サーバがその文字に関して知識 Xを持っていない場合に相当します. 意味が分かった人は, nishioka@ei.sanken.osaka-u.ac.jp までメールで知らせて下さい. X X X * 発音記号の読み方 X X発音記号は端末では表示できないので, 複数の文字を使って表します. 半角の '#' が現れた場合, 直後の文字が '/' ならば次の '/' まで, そうでなければ '#' と直後の1文字で意味を持ちます. 以下に全ての場合を示します. スペー Xス以降の単語はその発音を持つ単語です. X #e ability X ^ #o cotton X ^ #/er/ art X ^ #a alms X ^ #/ae(:)/ ask X ^ #/ae/ hat X ^ #s ship X ^^ #v up X ^ #g maesure X ^ #/ng/ ink X ^ #t think X ^^ #d this X ^^ #' 直後の音に第一アクセントがあることを示します. #` 直後の音に第二アクセントがあることを示します. X Xまた, judge, chair の音はそれぞれ d#g, t#s と表示されます. X ^ ^^ X本文中では, #/ng/ は, `=>' の代わりに使われています. X X X * ワイルドカードサーチ X * : 0文字以上の任意の文字にマッチ(語の末尾でのみ使うことができます.) ? : ちょうど一文字にマッチ X X使用例: X quick* : 'quick'で始まる単語全てを検索 (quickという語も含む) X quick?? : 'quick'で始まり, 全部で7文字になる単語を全て検索 X an??i* : 始め2文字が'an'で, 3,4文字めが任意の文字, 5文字めが'i'で, X しかも全部で5文字以上になる単語を全て検索 X (anemia, anguishedなど) X Xこのワイルドカードサーチは hangman などで絶大な威力を発揮します. SHAR_EOF chmod 0644 dict/client/README || echo 'restore of dict/client/README failed' Wc_c="`wc -c < 'dict/client/README'`" test 5068 -eq "$Wc_c" || echo 'dict/client/README: original size 5068, current size' "$Wc_c" fi # ============= dict/client/dsstat.c ============== if test -f 'dict/client/dsstat.c' -a X"$1" != X"-c"; then echo 'x - skipping dict/client/dsstat.c (File already exists)' else echo 'x - extracting dict/client/dsstat.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'dict/client/dsstat.c' && /* X * Copyright (C) Shingo NISHIOKA, 1991 X * nishioka@sanken.osaka-u.ac.jp X * Everyone is permitted to do anything on this program X * including copying, transplanting, debugging, and modifying. X */ X #include #include #include #include #include X #include "ndtp.h" X #define BUFSIZE 4096 X main(argc,argv) char *argv[]; { X char buf[BUFSIZE]; X int s; X int l; X X if(argc!=2) { X char *p; X p=argv[0]+strlen(argv[0]); X for(; argv[0]

h_addr))->s_addr ; X X sp = getservbyname( SERVICE, "tcp" ) ; X if( sp == NULL ) { X perror( "in iclient_init" ); X fprintf( stderr, "%s is not found in /etc/services¥n", SERVICE ); X exit(1) ; X } X peeraddr_in.sin_port = sp->s_port ; X X s = socket( AF_INET, SOCK_STREAM, 0 ) ; X if( s == -1 ) { X perror( "Unable to create a socket /iclient_init¥n" ) ; X exit(1) ; X } X X if( connect( s,&peeraddr_in, sizeof(struct sockaddr_in) )==-1 ) { X perror( "Unable to connect /iclient_init¥n" ) ; X exit(1) ; X } X return s; } SHAR_EOF chmod 0644 dict/client/dsstat.c || echo 'restore of dict/client/dsstat.c failed' Wc_c="`wc -c < 'dict/client/dsstat.c'`" test 1772 -eq "$Wc_c" || echo 'dict/client/dsstat.c: original size 1772, current size' "$Wc_c" fi exit 0 -- 西岡@産研.大阪大学 nishioka@ei.sanken.osaka-u.ac.jp