File: makehelp.l

package info (click to toggle)
euslisp 9.31%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 55,448 kB
  • sloc: ansic: 41,610; lisp: 3,339; makefile: 286; sh: 238; asm: 138; python: 53
file content (142 lines) | stat: -rw-r--r-- 4,925 bytes parent folder | download | duplicates (3)
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
;
;   make helpfile for eushelp.l
;
;   02-Oct-1994   Programmed by H.Nakagaki
;   May-1995	for Solaris

(defconstant *type-CLASS*  0)
(defconstant *type-METHOD* 1)
(defconstant *type-FUNC*   2)
(defconstant *type-MACRO*  3)
(defconstant *type-CONST*  4)
(defconstant *type-VAR*    5)
(defconstant *type-SPEC*   6)

(defparameter *help-file* "euslisp.hlp")
(defparameter *eus-tex-dir*  (format nil "~adoc/latex/" *eusdir*))
(defparameter *eus-jtex-dir* (format nil "~adoc/jlatex/" *eusdir*))

(defvar *eus-tex-list* (list "intro"
			      "generals"
			      "controls"
			      "objects"
			      "arith"
			      "symbols" 
			      "sequences"
			      "io"
			      "evaluation"
			      "sysfunc"
			      "mthread"
			      "matrix"
			      "geometry"
			      "contact"
			      "voronoi"
			      "graphics"
			      "xwindow"
			      "xtoolkit"
			      "image"
			      "manipulator"
			      "mars-pre"))
(defvar *eus-jtex-list* (list "jintro"
			      "jgenerals"
			      "jcontrols"
			      "jobjects"
			      "jarith"
			      "jsymbols"
			      "jsequences"
			      "jio" 
			      "jevaluation"
			      "jsysfunc"
			      "jmthread"
			      "jvxw"
			      "jmatrix"
			      "jgeometry"
			      "jcontact"
			      "jvoronoi"
			      "jgraphics"
			      "jxwindow"
			      "jxtoolkit"
			      "jimage"
			      "jmanipulator"
			      "jmars-pre"))

(defun addition-to-help(fp2 tex-dir fname)
  (let ((fp (open (make-pathname
			:directory (pathname-directory (pathname tex-dir))
                        :name fname :type "tex") :direction :input))
	buf c name class seek type args)
    (format t "~s file is included in help-file.~%" fname)
    (loop (setf c (peek-char fp nil))
	  (if (eq c nil) (return))
	  (setf seek (+ (- (unix:lseek fp 0 1) (file-stream-tail fp)) (file-stream-count fp)))
	  (setf buf (read-line fp))
	  (setf type -1)
	  (if (eq c #\\)
	      (progn (cond ((string= buf "\\funcdesc" :end1 9)
	                    (setq type *type-FUNC* args 3))
			   ((string= buf "\\fundesc" :end1 8)
			    (setq type *type-FUNC* args 2))
			   ((string= buf "\\macrodesc" :end1 10)
	                    (setq type *type-MACRO* args 3))
			   ((string= buf "\\macdesc" :end1 8)
	                    (setq type *type-MACRO* args 2))
			   ((string= buf "\\specialdesc" :end1 12)
	                    (setq type *type-SPEC* args 3))
			   ((string= buf "\\spedesc" :end1 8)
	                    (setq type *type-SPEC* args 2))
			   ((string= buf "\\methoddesc" :end1 11)
	                    (setq type *type-METHOD* args 3))
			   ((string= buf "\\metdesc" :end1 8)
	                    (setq type *type-METHOD* args 2))
			   ((string= buf "\\vardesc" :end1 8)
	                    (setq type *type-VAR* args 2))
			   ((string= buf "\\constdesc" :end1 10)
	                    (setq type *type-CONST* args 2))
			   ((string= buf "\\longdescription" :end1 16)
			    (if (eq (elt buf (1+ (position #\{ buf))) #\:)
			    	(setq type *type-METHOD*)
			        (setq type *type-FUNC*))
			    (setq args 3))
			   ((string= buf "\\classdesc" :end1 10)
	                    (setq type *type-CLASS* args 4))
			   )
		     (if (not (eq type -1))
			 (progn (setf seek (+ seek (position #\} buf) 1))
				(setf name (subseq buf (1+ (position #\{ buf)) (position #\} buf)))
				(if (eq type *type-CLASS*)
				    (setf class name))
				(format fp2 "~s ~d ~s ~d ~d ~%" name type fname seek args)))
		     )
	    ))
    (close fp)
    ))

(defun make-help-sub(tex-list &optional (helpfile *help-file*)
					(tex-dir *eus-tex-dir*))
  (let* ((file (make-pathname 
			:directory (pathname-directory (pathname tex-dir))
			:name helpfile)))
    (format t "help directory is being written to ~a~%" file)
    (with-open-file (fp file :direction :output)
	(format fp "; This file is help command list for euslisp~%")
	(format fp "~s ; Directory of TeX manual~%;~%" tex-dir )
	(dotimes(i (length tex-list))
	(addition-to-help fp tex-dir (nth i tex-list))))) )

(defun make-help(&optional (helpfile *help-file*))
  (make-help-sub *eus-tex-list* helpfile *eus-tex-dir*))

(defun make-jhelp(&optional (helpfile *help-file*))
  (make-help-sub *eus-jtex-list* helpfile *eus-jtex-dir*))

(format t "This program makes help file for eushelp.~%" )
(format t "That help-file's default name is ~s.~%" *help-file*)
(format t "So, if you run '(make-help)', you get help-file.~%" )
(format t "But, if you want to help-file that has your own name,~%" )
(format t "you must run '(make-help new-file-name).~%") 
(format t "This program assume that euslisp's document locate at ~%" )
(format t "'/usr/local/eus/doc/latex/'.~%")
(format t "Therefore, if your euslisp's document locate different ~%")
(format t "directiory, you set variable *eus-tex-dir* to your euslisp's~%")
(format t "document directory before you run '(make-help)'.~%~%")
(format t "Japanese help file is made by running '(make-jhelp)'.~%~%")