1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709
|
#!/bin/sh
# Installation Script Copyright (C) 1992 Bob Kerns <rwk@crl.dec.com>
echo <<GNUHEADER
Installation script for edict.el, an gnu emacs interface to EDICTJ
Public Domain japanese/english dictionary.
Contents Copyright (c) 1991, 1992 by Per Hammarlund <perham@nada.kth.se>
and Copyright (c) 1992 Bob Kerns <rwk@crl.dec.com>
edict.el written by Per Hammarlund <perham@nada.kth.se>
Morphology and private dictionary handling/editing by Bob Kerns <rwk@crl.dec.com>
International installation script by Bob Kerns <rwk@crl.dec.com>
Helpful remarks from Ken-Ichi Handa <handa@etl.go.jp>.
The EDICTJ PD dictionary is maintained by Jim Breen <jwb@monu6.cc.monash.edu.au>
Your credits here if you contribute!
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
GNUHEADER
export EPATH
EPATH="/tmp/edict.$$"
export PATH
PATH=$EPATH:/bin:/usr/bin:$PATH
export PWD
PWD=`pwd`
export DATE
DATE=`date`
# Script for installing the edict nemacs library.
if [ -d $EPATH ] || [ -f $EPATH ]; then
rm -rf $EPATH
fi
trap "rm -rf $EPATH" 0
mkdir $EPATH
if [ -f $EPATH/failure ]; then
rm -f $EPATH/failure
fi
cat <<'ENDMSG' >$EPATH/msg
#!/bin/sh
X=$LN
if [ ! X = 'EN' ]; then
if egrep "^$X[ ]?$1[ ]?" $EPATH/text >/dev/null; then
: ;
else
X='EN'
fi
fi
egrep "^$X[ ]?$1[ ]?" $EPATH/text >/dev/null ||
{
echo "Could not find $X message $1"
exit 1
}
# Do this to get variable substitution in messages.
# Some /bin/sh's aren't 8-bit clean, and all of them will screw up
# due to the the '$' chars in the JIS KI/KO sequences.
# So we have to do things the hard way. Instead of allowing arbitrary
# variable substitutions, we substitute for a fixed set of vars.
# If you add a variable to this list, be sure it's exported!
sed -e "s!@PWD!$PWD!;
s!@DISTDIR!$DISTDIR!;
s!@EMACSDIR!$EMACSDIR!;
s!@HOME!$HOME!;
s!@DATE!$DATE!;
s!@LN!$LN!;
s!@INSTDIR!$INSTDIR!" $EPATH/text |
sed -n -e "s/^$X[ ][ ]*$1[ ][ ]*//p"
ENDMSG
chmod a+x $EPATH/msg
cat <<'ENDLOG' >$EPATH/log
#!/bin/sh
export LN
# Log the user's responses & the program's actions & discoveries.
msg $1 >>/tmp/edict.log.$LN
# For the sake of bug reports, log it in english as well.
case "$LN" in
EN) ;;
*) LN='EN'
msg $1 >>/tmp/edict.log.$LN
;;
esac
ENDLOG
chmod a+x $EPATH/log
cat <<'ENDLOGAPPEND' >$EPATH/logappend
#!/bin/sh
# Append a file to the log file(s)
cat $1 >>/tmp/edict.log.EN
case "$LN" in
EN) ;;
*) cat $1 >>/tmp/edict.log.$LN
;;
esac
rm $1
ENDLOGAPPEND
chmod a+x $EPATH/logappend
cat <<'ENDCOPY' >$EPATH/copy
#!/bin/sh
# Copy a file, logging and echoing that fact.
touch $EPATH/mv.out
echo "mv $2 $2.orig"
if [ -f $2 ]; then
echo "mv $2 $2.orig"
mv $2 $2.orig >>$EPATH/mv.out 2>&1 ||
{
cat $EPATH/mv.out
touch $EPATH/failure
}
fi
echo "mv $2 $2.orig" >>$EPATH/copy.out
cat $EPATH/mv.out >>$EPATH/copy.out
rm $EPATH/mv.out
touch $EPATH/cp.out
echo "cp -p $1 $2"
cp -p $1 $2 >>$EPATH/cp.out 2>&1 ||
{
cat $EPATH/cp.out
touch $EPATH/failure
}
echo "cp -p $1 $2" >>$EPATH/copy.out
cat $EPATH/cp.out >>$EPATH/copy.out
rm $EPATH/cp.out
touch $EPATH/chmod.out
echo "chmod 0644 $2"
chmod 0644 $2 >>$EPATH/chmod.out 2>&1 ||
{
cat $EPATH/chmod.out
touch $EPATH/failure
}
echo "chmod 0644 $2" >>$EPATH/copy.out
cat $EPATH/chmod.out >>$EPATH/copy.out
rm $EPATH/chmod.out
logappend $EPATH/copy.out
ENDCOPY
chmod a+x $EPATH/copy
# Build our database of textual messages
# First item is the two-character language code.
# Second item is the message name. A multiline message is
# formed by having multiple lines with that name.
# The remainder of the line is the text which should be printed.
cat <<'END' >$EPATH/text
# It is OK to have comments in here.
# If a translation for a messsage does not exist, the english version will be used.
EN LANGUAGE Using english messages.
JA LANGUAGE ܸȤäƤޤ
SW LANGUAGE Anv{nder svenska meddelanden.
EN DISTDIR What directory has the edict files? [@PWD]
JA DISTDIR edictΥեϿϤɤǤ [@PWD]
SW DISTDIR Var finns edictprogrammets filer? [@PWD]
EN XDISTDIR The edict files are in @DISTDIR
JA XDISTDIR edict ΥեϿ @DISTDIR ˤޤ
SW XDISTDIR Edictprogrammets filer finns i @DISTDIR.
EN EDICTJDIR What directory has the edictj dictionary? [@DISTDIR]
JA EDICTJDIR edictj ȤŻҼŵϤɤǤ [@DISTDIR]
SW EDICTJDIR Var finns lexikonet EDICTJ? [@DISTDIR]
EN XEDICTJDIR The edictj dictionary is in @DISTDIR.
JA XEDICTJDIR edictj@DISTDIRˤޤ
SW XEDICTJDIR Lexikonet EDICTJ finns i @DISTDIR.
EN INSTDIR Normally, this software should be placed in the directory
EN INSTDIR which holds your site's emacs libraries. However, you do
EN INSTDIR not have write access to that directory, so you will need to
EN INSTDIR place them somewhere else.
EN INSTDIR
EN INSTDIR In what directory should I put the edict files? [leave in @DISTDIR]
JA INSTDIR ΥեȥϥȤnemacsΥ饤֥Ͽ
JA INSTDIR ǼΤǤǤ⡢ʤϤϿޤ줫顢
JA INSTDIR եȥ;˳Ǽޤ礦
JA INSTDIR
JA INSTDIR edict ϡɤϿ˳ǼƤޤ礦 [@DISTDIR]
SW INSTDIR Egentligen skall edictprogrammets filer placeras i katalogen
SW INSTDIR som har emacs |vriga filer; emacs "bibliotek". Men iom att
SW INSTDIR du inte har skrivr{ttigheter d{r, s} m}ste du l{gga dem
SW INSTDIR n}gon annanstans.
SW INSTDIR
SW INSTDIR I vilken katalog ska jag placera edictprogrammets filer? [@DISTDIR]
EN XINSTDIR The installation will be in @INSTDIR
JA XINSTDIR եȥ@INSTDIR˳Ǽޤ
SW XINSTDIR Edictprogrammet kommer att installeras i @INSTDIR.
EN BYTECOMP Emacs byte-compiling @DISTDIR/edict.el and
EN BYTECOMP @DISTDIR/edict-test.el.
SW BYTECOMP Emacs byte-compiling @DISTDIR/edict.el och
SW BYTECOMP @DISTDIR/edict-test.el. (Detta ger dig
SW BYTECOMP en "snabbare", kompilerad, version av programmen.)
JA BYTECOMP emacs @DISTDIR/edict.el
JA BYTECOMP @DISTDIR/edict-test.el byte-compile Ƥޤ
EN DEFAULTS In the following questions, if a default value may appear between
EN DEFAULTS square brackets. [] If you type Return, I will use that value.
SW DEFAULTS I de f|ljande fr}gorna s} kan det finnas ett standardsvar, givet mellan
SW DEFAULTS hakparenteser ([]), om du bara trycker RETURN kommer detta standardsvar att
SW DEFAULTS anv{ndas.
EN DOTEMACSQ Should I add the default key bindings and setup to your .emacs file?
EN DOTEMACSQ You may type SHOW to see what will be inserted.
EN DOTEMACSQ Please type yes, no, or show.
SW DOTEMACSQ Ska jag l{gga till n|dv{ndig initieringskod till din .emacs-fil?
SW DOTEMACSQ Om du skriver VISA visar jag vad som kommer att l{ggas till.
SW DOTEMACSQ Svara JA, NEJ, eller VISA.
EN DOTEMACSADD @HOME/.emacs updated.
SW DOTEMACSADD @HOME/.emacs uppdaterad.
EN YESORNO Please answer yes, no, or show.
JA YESORNO ֤Ϥפ֤פּơפƲʤɤǤ
JA YESORNO Ѹ⤤Ǥ
SW YESORNO Svara JA, NEJ eller VISA.
EN YESNOCONV cat
JA YESNOCONV sed 's/HAI/YES/; s/IIE/NO/; s/SHIME.*/SHOW/;\
JA YESNOCONV s/Ϥ/YES/; s//NO/; s/.*/SHOW/; s/.*/SHOW/'
SW YESNOCONV sed 's/JA/YES/; s/NEJ/NO/; s/VISA/SHOW/'
EN LOGHEADER ----------------------------------------------------------------
EN LOGHEADER Installation at @DATE.
SW LOGHEADER ----------------------------------------------------------------
SW LOGHEADER Installering gjord @DATE.
EN LOGBEGIN2 A log file is being kept in english in /tmp/edict.log.EN
SW LOGBEGIN2 En logfil med engelsk inneh}ll kommer att skapas och underh}llas.
SW LOGBEGIN2 Filen heter /tmp/edict.log.EN.
EN LOGBEGIN A log file is being kept in /tmp/edict.log.@LN.
SW LOGBEGIN En logfil som visar vad jag g|r finns. Den heter /tmp/edict.log.@LN.
EN SUCCESS Installation successfully completed.
SW SUCCESS Installationen gick bra.
EN FAILURE Installation encountered errors.
SW FAILURE Installationen gick inte bra, n}got fel intr{ffade.
EN NOCPYEDIR The emacs libraries are already in the right locations.
SW NOCPYEDIR Emacsbiblioteken finns redan p} r{tt plats.
EN NOCPYEJDIR The edictj dictionary file is already in the right location.
SW NOCPYEJDIR Lexikonet EDICTJ finns redan p} r{tt st{lle.
EN EJUSEDEMO Using the demo version of the EDICTJ file.
EN EJUSEDEMO Please place the real one in @INSTDIR/edictj
JA EJUSEDEMO ޡǥedictȤäƤޤ. edictjȥ벼
SW EJUSEDEMO Jag kommer att anv{nde en demoversion av lexikonet
SW EJUSEDEMO EDICTJ. Installera det riktiga lexikonet som
SW EJUSEDEMO @INSTDIR/edictj
EN .EMACSCOMNT ;;; This sets up the standard key bindings for edict commands to
EN .EMACSCOMNT ;;; autoload from @INSTDIR.
EN .EMACSCOMNT ;;;
EN .EMACSCOMNT ;;; Place this in your $HOME/.emacs file.
EN .EMACSCOMNT ;;; Edit the global-set-key forms if you wish to change the key assignments.
EN .EMACSCOMNT ;;; The default key assignments are as follows (m- is the same as ESC-)
EN .EMACSCOMNT ;;; m-* edict-search-english Search for an english word.
EN .EMACSCOMNT ;;; m-& edict-search-kanji Search for a Japanese word.
EN .EMACSCOMNT ;;; m-+ edict-insert Insert the last match.
JA .EMACSCOMNT ;;; ϡedict ɸΥХǥΩƤޤ
JA .EMACSCOMNT ;;; εǽ @INSTDIR autoload ưɤΤΩƤޤ
JA .EMACSCOMNT ;;;
JA .EMACSCOMNT ;;; Υɤ $HOME/.emacs ֤Ʋ
JA .EMACSCOMNT ;;; Хǥѹȡglobal-set-key ηԽƲ
JA .EMACSCOMNT ;;; ʲǥեȥХǥޤ
JA .EMACSCOMNT ;;; (m-פ ESC-פƱǤ)
JA .EMACSCOMNT ;;; m-* edict-search-english Ѹθդõ
JA .EMACSCOMNT ;;; m-& edict-search-kanji ܸθդõ
JA .EMACSCOMNT ;;; m-+ edict-insert פ
SW .EMACSCOMNT ;;; F|ljande kod ser till att edictprogrammet laddas automatiskt
SW .EMACSCOMNT ;;; fr}n @INSTDIR.
SW .EMACSCOMNT ;;;
SW .EMACSCOMNT ;;; Skriv in detta i din $HOME/.emacs fil.
SW .EMACSCOMNT ;;; [ndra global-set-key anropen om du vill att kommandona
SW .EMACSCOMNT ;;; skall anropas fr}n andra tangenter.
SW .EMACSCOMNT ;;; Detta {r standardtangentmappningarna (m- {r samma som ESC-)
SW .EMACSCOMNT ;;; m-* edict-search-english S|k med ett engelskt ord.
SW .EMACSCOMNT ;;; m-& edict-search-kanji S|k med ett japanskt ord.
SW .EMACSCOMNT ;;; m-+ edict-insert Skriv in senaste hittade ord.
END
# deduce which tr we have: v6 or v7
case "`echo B | tr A-Z a-z `" in
b) trversion=v7 ;;
B) trversion=v6 ;; # or System V
esac
export trversion
# Some systems use LANG, not LANGUAGE (i.e. ultrix)
export LN
LN=$LANGUAGE
[ $LN ] || LN=$LANG
LN=`echo $LN | sed -n -e 's/^\(..\).*/\1/p'`
LN=`echo $LN | case "$trversion" in
v6) tr [a-z] [A-Z] ;;
v7) tr a-z A-Z ;;
esac`
case "$LN" in
JP) : ;;
JP|EN|JA) : ;;
SW) : ;;
*)
echo 'What language should I use?'
echo '(EN = English, JA = Japanese, SW = Swedish) [EN]'
read LN
;;
esac
LN=`echo $LN | case "$trversion" in
v6) tr [a-z] [A-Z] ;;
v7) tr a-z A-Z ;;
esac`
# Handle any common aliases for the language identifiers, such as the native terms
# or country names.
case "$LN" in
'') LN='EN' ;;
EN|ENGLISH|BRITISH|BRITAIN|ENGLAND|US|AMERICAN) LN='EN' ;;
JA|''|'ܸ'|JAPANESE|NIHONGO|JP|NIHON|JAPAN) LN='JA' ;;
SW|SWEDISH|SWEDEN|SWE|SE|SVENSKA|SVERIGE) LN='SW' ;;
*) echo "I don't understand the language $LN."
LN='EN'
;;
esac
log LOGHEADER
case "$LN" in
EN) log LOGBEGIN2
msg LOGBEGIN2
;;
*) log LOGBEGIN
msg LOGBEGIN
log LOGBEGIN2
msg LOGBEGIN2
;;
esac
msg LANGUAGE
log LANGUAGE
echo
msg DEFAULTS
echo
export DISTDIR
msg DISTDIR
read DISTDIR
[ $DISTDIR ] || DISTDIR=`pwd`
export EDICTJDIR
msg EDICTJDIR
read EDICTJDIR
[ $EDICTJDIR ] || EDICTJDIR=$DISTDIR
log XEDICTJDIR
echo "# Values extracted from nemacs." >$EPATH/emacs.vars
cat <<END >$EPATH/emacs.info
(setq epath (reverse load-path))
(setq edir (expand-file-name (car epath)))
(if (string-match "/$" edir)
(setq edir (substring edir 0 (- (length edir) 1))))
(princ (format "export EMACSDIR\nEMACSDIR=%s\n" edir))
(princ (format "export EMACSPATH\nEMACSPATH=%s" (car epath)))
(let ((path (cdr epath)))
(while path
(princ (format ":%s" (car path)))
(setq path (cdr path))))
(princ "\n")
END
nemacs -batch -load $EPATH/emacs.info >>$EPATH/emacs.vars
. $EPATH/emacs.vars
echo "# End of values extracted from nemacs." >>$EPATH/emacs.vars
logappend $EPATH/emacs.vars
# OK, let's see if we can install it into the normal location.
if [ -w $EMACSDIR ]; then
# Yes!
export INSTDIR
INSTDIR=$EMACSDIR
else
# No, gotta ask.
export INSTDIR
msg INSTDIR
read INSTDIR
[ $INSTDIR ] || INSTDIR=$DISTDIR
fi
msg XINSTDIR
log XINSTDIR
# Byte compile the program.
log BYTECOMP
msg BYTECOMP
cat <<END >$EPATH/emacs.comp
(load-library "bytecomp")
;;; Fix emacs byte compiler bug...
;;; This used to blow out if given anything with a non-symbol
;;; in the CAR. Emacs 18.57 has a different form of the bug,
;;; where &optional or &rest in the argument list of a lambda
;;; combination silently mis-compiles. --RWK
(defun byte-compile-form (form)
(setq form (macroexpand form byte-compile-macro-environment))
(cond ((eq form 'nil)
(byte-compile-constant form))
((eq form 't)
(byte-compile-constant form))
((symbolp form)
(byte-compile-variable-ref 'byte-varref form))
((not (consp form))
(byte-compile-constant form))
((symbolp (car form))
(let ((handler (get (car form) 'byte-compile)))
(if handler
(funcall handler form)
(byte-compile-normal-call form))))
((and (consp (car form))
(eq (car (car form)) 'lambda))
;; It's a lambda combination. Turn it into a LET.
(let* ((lambda-expr (car form))
(arglist (nth 1 lambda-expr))
(body (nthcdr 2 lambda-expr))
(params (cdr form))
(original-arglist arglist) ; For error reporting
(original-params params) ; For error reporting
(state nil) ;Last &-keyword seen.
(binding-list nil) ;LET's binding list.
(arg nil))
;; Parse the argument list, and build the binding list.
;; Check for invalid arglist syntax as we go.
(while arglist
(setq arg (car arglist)
arglist (cdr arglist))
(cond
((eq arg '&optional )
(when state
(error "Illegal argument list syntax: &optional after %s."
state))
(setq state arg))
((eq arg '&rest )
(cond
((or (eq state nil)
(eq state '&optional)))
(t (error "Illegal argument list syntax: &rest after %s."
state)))
(setq arg (car arglist)
arglist (cdr arglist))
(setq binding-list
(cons (list arg (list* 'list params))
binding-list)
params nil
state arg))
(t (cond ((eq state '&rest)
(error "Extra junk after &rest parameter: %s."
(cons arg arglist))))
(unless (eq state '&optional)
(unless params
(error "Insufficient arguments. Arglist=%s\nParameters=%s"
original-arglist original-params)))
(setq binding-list
(cons (list arg (car params))
binding-list)
params (cdr params)))))
(when params
(error "Too many arguments. Arglist=%s\nParameters=%s"
original-arglist original-params))
(setq binding-list (nreverse binding-list))
(byte-compile-form
(list* 'let binding-list body))))
;; Things like autoload, macro, mock-lisp.
((consp (car form)) (byte-compile-normal-call form))
(t (error "Illegal form: %s" form)))
(setq byte-compile-maxdepth
(max byte-compile-maxdepth
(setq byte-compile-depth (1+ byte-compile-depth)))))
;;; Now here's another compiler fix: Add eval-when !!
(defmacro eval-when (when &rest forms)
(and (or (member 'eval when)
(member ':execute when))
(mapcar (function eval) forms))
(and (or (member 'load when)
(member ':load-toplevel when))
(cons 'progn forms)))
(defun macro-function (name)
(and (fboundp name)
(let ((fun (symbol-function name)))
(and (not (atom fun))
(eq (car fun) 'macro)
(cdr fun)))))
(defun macroexpand-1 (form)
(if (atom form) form
(if (listp (car form)) form
(let ((expander (macro-function (car form))))
(apply expander (cdr form))))))
(defun byte-compile-file-form (form)
(let ((expander nil))
(cond ((not (listp form))
form)
((memq (car form) '(defun defmacro))
(let* ((name (car (cdr form)))
(tem (assq name byte-compile-macro-environment)))
(if (eq (car form) 'defun)
(progn
(message "Compiling %s (%s)..." filename (nth 1 form))
(cond (tem (setcdr tem nil))
((and (fboundp name)
(eq (car-safe (symbol-function name)) 'macro))
;; shadow existing macro definition
(setq byte-compile-macro-environment
(cons (cons name nil)
byte-compile-macro-environment))))
(prog1 (cons 'defun (byte-compile-lambda (cdr form)))
(if (not noninteractive)
(message "Compiling %s..." filename))))
;; defmacro
(if tem
(setcdr tem (cons 'lambda (cdr (cdr form))))
(setq byte-compile-macro-environment
(cons (cons name (cons 'lambda (cdr (cdr form))))
byte-compile-macro-environment)))
(cons 'defmacro (byte-compile-lambda (cdr form))))))
((eq (car form) 'progn)
(cons 'progn
(mapcar (function byte-compile-file-form) (cdr form))))
((listp (car form)) form)
((setq expander (macro-function (car form)))
(byte-compile-file-form (macroexpand-1 form)))
((setq expander (get (car form) 'byte-compile-top-level-handler))
(byte-compile-file-form (funcall expander form)))
((eq (car form) 'require)
(eval form)
form)
(t form))))
(put 'eval-when 'eval-when-top-level-handler 'byte-compile-top-level-handler)
(defun eval-when-top-level-handler (form)
(let ((when (nth 1 form))
(body (nthcdr 2 form)))
(princ (format "Eval-when %s...\n" when))
(and (or (member 'compile when)
(member ':compile-toplevel when))
(mapcar (function print) body)
(mapcar (function eval) body))
(and (or (member 'load when)
(member ':load-toplevel when))
(cons 'progn body))))
;;; Now compile our two files.
(byte-compile-file "$DISTDIR/edict.el")
(byte-compile-file "$DISTDIR/edict-test.el")
END
nemacs -batch -load $EPATH/emacs.comp | tee $EPATH/emacs.comp.out
logappend $EPATH/emacs.comp
logappend $EPATH/emacs.comp.out
# Now copy, if they're not already there.
if [ $DISTDIR = $INSTDIR ]; then
msg NOCPYEDIR
log NOCPYEDIR
else
copy $DISTDIR/edict.ChangeLog $INSTDIR/edict.ChangeLog
copy $DISTDIR/edict.el $INSTDIR/edict.el
copy $DISTDIR/edict.elc $INSTDIR/edict.elc
copy $DISTDIR/edict-test.el $INSTDIR/edict-test.el
copy $DISTDIR/edict-test.elc $INSTDIR/edict-test.elc
copy $DISTDIR/edict.texinfo $INSTDIR/edict.texinfo
fi
if [ $EDICTJDIR = $INSTDIR ]; then
if [ -f $INSTDIR/edictj ]; then
msg NOCPYEJDIR
log NOCPYEJDIR
else
msg EJUSEDEMO
log EJUSEDEMO
copy $DISTDIR/edictj.demo $INSTDIR/edictj
fi
else
if [ -r $EDICTJDIR/edictj ]; then
copy $EDICTJDIR/edictj $INSTDIR/edictj
elif [ -f $INSTDIR/edictj ]; then
: ;
else
copy $DISTDIR/edictj.demo $INSTDIR/edictj
fi
fi
if [ "$INSTDIR" = "$EMACSDIR" ]; then
LOADFILE=edict
else
LOADFILE=$INSTDIR/edict
fi
# Build a file of suggested .emacs setup.
echo >$INSTDIR/edict.emacs
# Start it off with a language-specific explanatory comment.
msg .EMACSCOMNT >>$INSTDIR/edict.emacs
sed -e "s!@LOADFILE!$LOADFILE!; s!@INSTDIR!$INSTDIR!" <<'EMACSEND' >>$INSTDIR/edict.emacs
(cond ((fboundp 'convert-region-kanji-code)
(autoload 'edict-search-english "@LOADFILE"
"Search for a translation of an English word")
(global-set-key "\e*" 'edict-search-english)
(autoload 'edict-search-kanji "@LOADFILE"
"Search for a translation of a Kanji sequence")
(global-set-key "\e&" 'edict-search-kanji)
(autoload 'edict-add-english "@LOADFILE"
"Add a translation of an English word")
(autoload 'edict-add-kanji "@LOADFILE"
"Add a translation of a Kanji sequence")
(autoload 'edict-insert "@LOADFILE"
"Insert the last item looked up in edict.")
(global-set-key "\e+" 'edict-insert)
(autoload 'edict-insert-english "@LOADFILE"
"Insert the last item looked up in edict.")
(autoload 'edict-insert-ܸ "@LOADFILE"
"Insert the last item looked up in edict.")
(setq *edict-files* '("@INSTDIR/edictj"))))
EMACSEND
# Extract the script for canonicalizing yes or no from whatever natural language.
msg YESNOCONV >$EPATH/yesnoconv
while [ "ALWAYS" ]; do
msg DOTEMACSQ
read DOTEMACSQ
DOTEMACSQ=`echo $DOTEMACSQ | case "$trversion" in
v6) tr [a-z] [A-Z] ;;
v7) tr a-z A-Z ;;
esac`
DOTEMACSQ=`echo $DOTEMACSQ | (. $EPATH/yesnoconv)`
case $DOTEMACSQ in
Y|YES)
sed -e '/;;; Start of EDICT/,/;;; End of EDICT/ D' $HOME/.emacs >$EPATH/.emacs.out
echo ";;; Start of EDICT's automatically-added stuff." >>$EPATH/.emacs.out
cat $INSTDIR/edict.emacs >>$EPATH/.emacs.out
echo ";;; End of EDICT's automatically-added stuff." >>$EPATH/.emacs.out
[ -f $HOME/.emacs ] && mv $HOME/.emacs $HOME/.emacs.orig
mv $EPATH/.emacs.out $HOME/.emacs
msg DOTEMACSADD
log DOTEMACSADD
break
;;
N|NO)
break
;;
SHOW)
echo more $INSTDIR/edict.emacs
more $INSTDIR/edict.emacs
;;
*) msg YESORNO
;;
esac
done
if [ -f $EPATH/failure ]; then
log FAILURE
msg FAILURE
else
log SUCCESS
msg SUCCESS
fi
|