home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.x
- From: philb@cats.ucsc.edu (Philip Brown)
- Subject: v21i003: kdrill - A program to quiz folks on kanji, Part02/02
- Message-ID: <1993Oct7.165600.27954@sparky.sterling.com>
- X-Md4-Signature: cfd9cd84c538992439b480c454dbdd81
- Sender: chris@sparky.sterling.com (Chris Olson)
- Organization: Sterling Software
- Date: Thu, 7 Oct 1993 16:56:00 GMT
- Approved: chris@sterling.com
-
- Submitted-by: philb@cats.ucsc.edu (Philip Brown)
- Posting-number: Volume 21, Issue 3
- Archive-name: kdrill/part02
- Environment: X11R5
- Supersedes: kdrill: Volume 20, Issue 134-135
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: INSTALL Imakefile KDrill PATCHLIST attributes.c externs.h
- # icon.xbm kdrill.man patchlevel.h usefile
- # Wrapped by chris@sparky on Thu Oct 7 11:48:57 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 2 (of 2)."'
- if test -f 'INSTALL' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'INSTALL'\"
- else
- echo shar: Extracting \"'INSTALL'\" \(969 characters\)
- sed "s/^X//" >'INSTALL' <<'END_OF_FILE'
- Xkdrill v2.1
- X
- XYou should really check out Imakefile to see if things are okay for your
- Xsystem. Specifically, if you do not have your X11 headers in
- X/usr/include/X11, you will have to change the INCLUDES line. There may be
- Xother stuff you wish to fiddle with.
- X
- XRead README about getting "kanjidic", if you do not have it yet. It is
- Xrequired for this program.
- X
- XYou technically do not need an ANSI compiler for this program, although
- X SUN's cc whines about "No Aggregate initialization", in "main.c"
- XIf you're determined, you can fix that.
- X
- XAlso: This is techinically for X11R5. I do not think it will work on R4.
- XApart from changing #include files, and fonts, I think that the R4 Xaw
- Xsupport for 16-bit fonts is broken. If you manage to cobble something
- Xtogether on your R4 system, I will be happy to incorporate your source
- Xinto the "official" version of kdrill, but I will not go outof my to
- Xsupport R4.
- X
- X Philip Brown
- X 1993 -- July 25th, 6am
- X (almost time for bed!)
- END_OF_FILE
- if test 969 -ne `wc -c <'INSTALL'`; then
- echo shar: \"'INSTALL'\" unpacked with wrong size!
- fi
- # end of 'INSTALL'
- fi
- if test -f 'Imakefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Imakefile'\"
- else
- echo shar: Extracting \"'Imakefile'\" \(881 characters\)
- sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
- XDEPLIBS = $(DEPXLIB)
- X/* Sun compilations require having the XMU lib here...
- X * I don't know about "normal" systems
- X */
- XLOCAL_LIBRARIES = $(XLIB) $(XTOOLLIB) $(XAWLIB) $(XMULIB)
- X
- X
- X/*
- X *R4 NOTE!!!
- X * I am told you can change fonts to
- X * "jeuc.16x32". [in "init.c", or with the -smallkanji/-kanjifont flags]
- X * or whatever 16-bit kanji font your system happens to have.
- X * That was for kdrill v1.
- X * However, Since I rely on Xaw's 16-bit handling in V2 of kdrill,
- X * I am no longer sure this will work.
- X */
- X
- X/* DEFINES = -DDEBUG*/
- X
- X/*
- X * I don't like putting <X11/...> for everything, so..
- X */
- XINCLUDES = -I/usr/include/X11
- X
- X/*
- X * If you want to force things...
- X * CDEBUGFLAGS = -g
- X * BINDIR = /usr/local/bin/X11
- X */
- X
- XSRCS = main.c readfile.c game.c init.c widgets.c attributes.c
- XOBJS = main.o readfile.o game.o init.o widgets.o attributes.o
- X
- XComplexProgramTarget(kdrill)
- X
- END_OF_FILE
- if test 881 -ne `wc -c <'Imakefile'`; then
- echo shar: \"'Imakefile'\" unpacked with wrong size!
- fi
- # end of 'Imakefile'
- fi
- if test -f 'KDrill' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'KDrill'\"
- else
- echo shar: Extracting \"'KDrill'\" \(445 characters\)
- sed "s/^X//" >'KDrill' <<'END_OF_FILE'
- X! usefile for "kdrill"
- X! if this usefile is installed,
- X! ALL ENTRIES MUST BE USED!!!
- X! otherwise, the program most likely will crash
- X
- XKDrill.usefile: usefile
- XKDrill.dictfile: kanjidic
- XKDrill.kanjifont: kanji24
- XKDrill.smallkanji: kanji16
- XKDrill.font: fixed
- XKDrill.gradelevel: 0
- X! the following are boolean values
- X
- XKDrill.showkana: true
- XKDrill.guessmeaning: false
- XKDrill.noBell: false
- X
- END_OF_FILE
- if test 445 -ne `wc -c <'KDrill'`; then
- echo shar: \"'KDrill'\" unpacked with wrong size!
- fi
- # end of 'KDrill'
- fi
- if test -f 'PATCHLIST' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'PATCHLIST'\"
- else
- echo shar: Extracting \"'PATCHLIST'\" \(679 characters\)
- sed "s/^X//" >'PATCHLIST' <<'END_OF_FILE'
- Xkdrill v1.1:
- X - Patched so initstuff gets passed argc and argv!!
- X - Now actually checks for depth of window. QUITE important, when
- X creating a pixmap, eh?! (hardcoding, bad. Bad!)
- X - fiddled with man page
- X
- Xv1.3:
- X - added resource use, for usefile, and dictfile
- X
- X
- X * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- X
- Xv2.0: MASSIVE re-writing to rely on 16-bit-font support in Xaw!!
- X (glarg)
- X
- X Improved random kanji picking immesureably.
- X Theoretically added kana display
- X Allowed changing of fonts
- X
- Xv2.1:
- X Fixed most of the features that didn't work in v2.0:
- X -noBell, -gradelevel, -showkana
- X Added icon!
- X Man page cleaned up even more.
- X
- X
- END_OF_FILE
- if test 679 -ne `wc -c <'PATCHLIST'`; then
- echo shar: \"'PATCHLIST'\" unpacked with wrong size!
- fi
- # end of 'PATCHLIST'
- fi
- if test -f 'attributes.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'attributes.c'\"
- else
- echo shar: Extracting \"'attributes.c'\" \(602 characters\)
- sed "s/^X//" >'attributes.c' <<'END_OF_FILE'
- X/* atributes.c
- X * This file currently exists SOLELY to contain a quickly
- X * portable routine to turn on backing store.
- X * We would NEVER want to turn OFF backing store :-)
- X */
- X#include <stdio.h>
- X#include <X11/Xos.h>
- X#include <X11/Xlib.h>
- Xstatic XSetWindowAttributes attribs;
- X
- Xint SetBackingStore(display,screen,win)
- XDisplay *display;
- XScreen *screen;
- XWindow win;
- X{
- X if(!DoesBackingStore(screen)){
- X fprintf(stderr,"This aplication expects to have backing store available\n");
- X return 0;
- X }
- X attribs.backing_store = Always;
- X XChangeWindowAttributes(display,win,CWBackingStore,&attribs);
- X return 1;
- X}
- END_OF_FILE
- if test 602 -ne `wc -c <'attributes.c'`; then
- echo shar: \"'attributes.c'\" unpacked with wrong size!
- fi
- # end of 'attributes.c'
- fi
- if test -f 'externs.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'externs.h'\"
- else
- echo shar: Extracting \"'externs.h'\" \(1048 characters\)
- sed "s/^X//" >'externs.h' <<'END_OF_FILE'
- Xextern struct translationstruct *translations[0x8000];
- Xextern int lowest,highest,numberofkanji; /* keep track of how many we have */
- Xextern char *dictname,*usefile,kanjifontname[];
- X
- Xextern void GetXtString();
- Xextern int GetXtNumber();
- Xextern Boolean GetXtBoolean();
- X
- Xextern int xtoi(),getline();
- Xvoid readstructs(),readstructs(),kprint(),eprint();
- Xextern void englishcallback();
- Xextern void kanjicallback();
- Xextern void CountKanji();
- Xextern void ChangeMode();
- Xextern void DescribeCurrent();
- X
- Xextern XFontStruct *largekfont;
- Xextern XFontStruct *smallkfont;
- Xextern XFontStruct *fixedfont;
- X
- Xextern void quit();
- Xextern XtAppContext Context;
- X
- Xextern unsigned long black,white;
- Xextern Display *display;
- Xextern Window mainwindow,rootwindow;
- Xextern GC gc,cleargc;
- X
- Xextern Widget toplevel,form,quitbutton,statusline;
- Xextern Widget gradedisplay;
- Xextern Widget kanjimode,englishmode,togglekana;
- Xextern Widget englishWidget[4],kanjiWidget[4];
- X
- X/* misc resource-level stuffs... */
- Xextern int doBell;
- Xextern int gradelevel;
- Xextern int Kanji2English,showEnglish;
- END_OF_FILE
- if test 1048 -ne `wc -c <'externs.h'`; then
- echo shar: \"'externs.h'\" unpacked with wrong size!
- fi
- # end of 'externs.h'
- fi
- if test -f 'icon.xbm' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'icon.xbm'\"
- else
- echo shar: Extracting \"'icon.xbm'\" \(824 characters\)
- sed "s/^X//" >'icon.xbm' <<'END_OF_FILE'
- X#define icon_width 25
- X#define icon_height 30
- Xstatic char icon_bits[] = {
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x18, 0x0c, 0x00,
- X 0x80, 0x30, 0x0c, 0x00, 0x00, 0x33, 0x06, 0x00, 0x20, 0x00, 0x01, 0x00,
- X 0xf0, 0xff, 0x3f, 0x00, 0x30, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00,
- X 0xc8, 0xff, 0x07, 0x00, 0x40, 0x00, 0x04, 0x00, 0x40, 0x00, 0x04, 0x00,
- X 0xc0, 0xff, 0x07, 0x00, 0x40, 0x00, 0x04, 0x00, 0x40, 0x00, 0x04, 0x00,
- X 0xc0, 0xff, 0x07, 0x00, 0x40, 0x00, 0x04, 0x00, 0x40, 0x00, 0x04, 0x00,
- X 0xc0, 0xff, 0x07, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00,
- X 0x00, 0x26, 0x00, 0x00, 0x00, 0x22, 0x20, 0x00, 0x80, 0x21, 0x20, 0x00,
- X 0x78, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- END_OF_FILE
- if test 824 -ne `wc -c <'icon.xbm'`; then
- echo shar: \"'icon.xbm'\" unpacked with wrong size!
- fi
- # end of 'icon.xbm'
- fi
- if test -f 'kdrill.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'kdrill.man'\"
- else
- echo shar: Extracting \"'kdrill.man'\" \(4955 characters\)
- sed "s/^X//" >'kdrill.man' <<'END_OF_FILE'
- X.\" kdrill.1 93/07/22
- X.TH KDRILL 1 "22nd July 1993" "Phil\'s Software"
- X.SH NAME
- Xkdrill v2.1 \- drill program for kanji chars under Xwindows
- X.SH OPTIONS
- X
- X.TP
- X.B \-usefile \fINewUsefileName\fR
- XChange usefile.
- X.TP
- X.B \-dictfile \fIOtherKanjidicFile\fR
- XChange dictionary file name
- X.TP
- X.B \-font \fIFontName\fR
- XChange main english font.
- X.TP
- X.B \-kanjifont \fIKanjiFontName\fR
- XChange large kanji font.
- X.TP
- X.B \-smallkanji \fIKanjiFontName\fR
- XChange small kanji/kana font.
- X.TP
- X.B \-noBell
- Xturns off beep on wrong answer.
- X.TP
- X.B \-guessmeaning
- Xstart with four kanji, and one meaning to guess.
- X.TP
- X.B \-gradelevel \fIlevel#\fR
- Xstart at a different grade level limit.
- X.TP
- X.B \-showkana
- Xstart with kana meanings instead of english.
- X
- X.SH RESOURCES
- XAll the above options can be set in a resource file, with the same names
- Xas values. See the sample "KDrill" file for more detail, which is
- Xnormally installed in /usr/lib/X11/app-defaults.
- X
- X.SH DESCRIPTION
- X
- X.B kdrill
- Xis a program to drill users on meanings of kanji characters. Various
- Xformats of drills are available:
- X
- X.RS 5
- Xkanji to english
- X
- Xkanji to kana
- X
- Xenglish to kanji
- X
- Xkana to kanji
- X.RE
- X
- XThe user can restrict the range of kanji to drill on in different, yet
- Xcompatible, ways. The first way is to make a "usefile" (described below),
- Xwith a an explicit list of desired kanji.
- XA second way to limit the range of the drill is to change the gradelevel.
- XThis can be done by clicking the Grade: button, using the -gradelevel
- Xflag, or setting the gradelevel resource.
- X
- X
- Xkdrill will use the "kanjidic" file to interpret many of the various
- X16-bit kanji chars in the
- X.I kanji24
- Xfont supplied with the X11R5 distribution. It checks for a file by the name of
- X.B "usefile"
- Xin the current directory, although this name can be changed either with
- Xthe '-usefile' option, or in a resource file.
- X
- X
- X.I kanjidic
- Xsubdivides its entries into grade levels, and frequency ratings. Grade
- Xlevels are similar to school grade levels, but more compressed. For
- Xkdrill's purposes, grade levels start at 1, and increase to 6. There are
- Xmany kanji that do not have a grade level, due to their infrequency of
- Xuse. You may specify that you only with to see kanji of a certain grade
- Xlevel or lower. To use ALL kanji, you may specify gradelevel as 0. Grade
- Xlevel 0 is the default, unless a resource file for kanjidrill has been
- Xinstalled to override this.
- X
- X.I kanjidic
- Xalso has a frequency rating for the top 2000 or so kanji. Kdrill will
- Xdisplay this for your information, but the program does not attach any
- Xsignificance to the number at present.
- X
- XAny grade level or frequency rating the current kanji has, will be
- Xdisplayed in the top right hand side of the window, next to the "G:" and
- X"F:" letters. The kanji number will be displayed \fIin
- Xhexadecimal\fR(base 16) after the "#:" sign. It is displayed in
- Xhexadecimal because that is what kanjidic, xfd, and the usefile display.
- X
- X.SH USEFILES
- X
- XA usefile consists of a list of hex numbers; one per line, no
- Xinitial spaces allowed. A usefile makes the program only use particular
- Xkanji, instead of the thousands possible in the dictionary. It is
- Xpossible to add comment lines by having the very first character of a
- Xline be "#". It is also possible to add english reminders after the number
- Xon each line, so you remember what each number is.
- XHex numbers can be checked or found by using the "xfd" util on the
- X"kanji24" font.
- X
- XGrade restrictions will apply to ALL kanji selected, even if you have a
- Xusefile. Thus, if all your usefile-defined kanji are of grade 4 or
- Xhigher, and you have selected grade 3 as a cut-off point, kdrill will
- Xcomplain that there are not enough kanji available, and attempt to
- Xincrease the grade level.
- X
- XIf you have a usefile, and wish the program to ignore it, you can run
- X"kdrill -usefile none", and it will ignore it. "none" is NOT a keyword.
- XIf you actually have a file in your directory named "none", use a
- Xdifferent word.
- X
- X.SH KANJIDIC
- XThe dictionary, kanjidic, is currently available where it originated, via
- Xftp from
- X.I monu6.cc.monash.edu.au,
- Xor from a mirror in the U.S. at ftp.uwtc.washington.edu
- X
- XAt the monu6 site, both the dictionary and this program can currently be
- Xfound in
- X.I /pub/nihongo
- X
- X.SH BUGS
- X"kanjidic" isn't perfect. There are "incomplete" entries, missing either
- Xenglish or kana translations. There are also entries consisting of
- X"See Nxxxx" which isn't really an improvement.
- X
- X.SH AUTHOR
- XPhilip P Brown
- X
- X(Who does not speak Japanese or Chinese, but hopes to one day)
- X
- X.SH COPYRIGHT
- XPhilip Brown is currently a student of the University of California.
- XHowever, this program was developed entirely by Philip Brown, on his own
- Xcomputer, not related to any classwork. Philip Brown retains sole right
- Xto this program.
- X
- XPhilip Brown hereby gives permission to use, and/or modify this code, so
- Xlong as it it not sold for profit, and the author's name appears
- Xsomewhere in the code. Seperate derivative works are not covered by this
- Xrestriction.
- X
- END_OF_FILE
- if test 4955 -ne `wc -c <'kdrill.man'`; then
- echo shar: \"'kdrill.man'\" unpacked with wrong size!
- fi
- # end of 'kdrill.man'
- fi
- if test -f 'patchlevel.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patchlevel.h'\"
- else
- echo shar: Extracting \"'patchlevel.h'\" \(76 characters\)
- sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
- X#ifndef _PATCHLEVEL_H
- X#define _PATCHLEVEL_H
- X
- X#define VERSION "v2.1"
- X
- X#endif
- END_OF_FILE
- if test 76 -ne `wc -c <'patchlevel.h'`; then
- echo shar: \"'patchlevel.h'\" unpacked with wrong size!
- fi
- # end of 'patchlevel.h'
- fi
- if test -f 'usefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'usefile'\"
- else
- echo shar: Extracting \"'usefile'\" \(1379 characters\)
- sed "s/^X//" >'usefile' <<'END_OF_FILE'
- X# This is the "kdrill" 'usefile'
- X# it is used to abridge the "kanjidic" dictionary
- X#
- X# lines can be commented by the VERY FIRST CHARACTER being a '#'
- X# Try not to leave blank lines
- X# Only the initial hex number is important..
- X# You can add whatever english you like afterwards,so that you remember
- X# what the numbers mean.
- X3030 rising sun
- X303f someone?
- X306c "one"
- X312b rain
- X312c east
- X315f yen, round
- X323c below ,low
- X3433 dry
- X3250 fire
- X3456 interval (of time), a room
- X355d bow
- X3662 gold
- X3665 nine
- X376e Moon
- X384a self
- X385e five
- X3971 country
- X3b30 three
- X3b33 mountain
- X3b4d four
- X3b4e samurai,gentleman
- X3b5s child
- X3b54 city
- X3b7b temple(buddhist)
- X3b7e time, or hour
- X3c37 seven
- X3d3a utensil?ten??
- X3d3d ten
- X3d50 exit (verb)
- X3d77 woman
- X3e2e small
- X3e65 above
- X3f4d person
- X3f65 water
- X4038 life
- X403e west
- X405a cut, cut off
- X4069 thousand
- X406e river
- X4134 all
- X422b sheaf
- X4267 large
- X4331 one
- X4366 middle/center
- X4544 rice paddy
- X455a earth
- X4561 knife , sword
- X466e south
- X4673 two
- X467c sun
- X467e enter
- X482a cultivated field, really.
- X482b farm?
- X482c eight
- X4934 hundred
- X4977 wind, style
- X4a2c minute, portion
- X4a60 garden
- X4b2e country
- X4b4c north
- X4b5c book, origin
- X4b7c ten thousand, many, etc
- X4c40 bright, clear
- X4c5a tree
- X4c5c ordinal for numbers
- X4c67 gates
- X4d4b day of week
- X4d5b sunshine
- X4f3b six
- X5042 thousand (sort of)
- X5051 hundred (sort of)
- X5345 one?
- X5744 three (fur/hair radical)
- X666d new moon
- X
- END_OF_FILE
- if test 1379 -ne `wc -c <'usefile'`; then
- echo shar: \"'usefile'\" unpacked with wrong size!
- fi
- # end of 'usefile'
- fi
- echo shar: End of archive 2 \(of 2\).
- cp /dev/null ark2isdone
- MISSING=""
- for I in 1 2 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked both archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
- --
- // chris@Sterling.COM | Send comp.sources.x submissions to:
- \X/ Amiga - The only way to fly! | sources-x@sterling.com
- "It's intuitively obvious to the |
- most casual observer..." | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
-