Debian Codegraph @

src/autoloads.scm

raw
1 ;;;
2 ;;; Generates default autoloads
3 ;;;
4
5 (use util.match)
6 (use gauche.cgen)
7
8 (define *autoloads* '())
9
10
11 (cgen-current-unit
12 (make <cgen-unit>
13 :name "autoloads"
14 :preamble "/* Generated from autoloads.scm. DO NOT EDIT */"
15 :init-prologue "void Scm__InitAutoloads(void)\n{"
16 ))
17
18 (define (register-autoload target path entries)
19 (push! *autoloads*
20 (list target path
21 (fold (^[entry r]
22 (match entry
23 [(':macro . syms) (fold (cut acons <> #t <>) r syms)]
24 [sym (acons sym #f r)]))
25 '() entries))))
26
27 ;; Emit code
28 (define (main args)
29 (cgen-decl "#define LIBGAUCHE_BODY"
30 "#include <gauche.h>"
31 "#include <gauche/priv/configP.h>")
32 ;; init
33 (cgen-init " ScmModule *gauche = Scm_GaucheModule();"
34 " ScmSymbol *sym, *import_from;"
35 " ScmObj al, path;")
36
37 ;; loop
38 (dolist (al (reverse *autoloads*))
39 (let* ([where (car al)]
40 [path&from (if (string? (cadr al))
41 (let1 str (cgen-literal (cadr al))
42 (cons (cgen-cexpr str) "NULL"))
43 (let1 sym (cgen-literal (cadr al))
44 (cons (format "Scm_ModuleNameToPath(SCM_SYMBOL(~a))"
45 (cgen-cexpr sym))
46 (format "SCM_SYMBOL(~a)" (cgen-cexpr sym)))))])
47 (cgen-init #" path = ~(car path&from);"
48 #" import_from = ~(cdr path&from);")
49 (dolist [ent (caddr al)]
50 (let1 str (cgen-literal (symbol->string (car ent)))
51 (cgen-init
52 #" sym = SCM_SYMBOL(Scm_Intern(SCM_STRING(~(cgen-cexpr str)))); /* ~(cgen-safe-comment (car ent)) */"
53 #" al = Scm_MakeAutoload(SCM_CURRENT_MODULE(), sym, SCM_STRING(path), import_from);")
54 (if (cdr ent) ;; macro?
55 (cgen-init
56 #" Scm_Define(~|where|, sym, Scm_MakeMacroAutoload(sym, SCM_AUTOLOAD(al)));")
57 (cgen-init
58 #" Scm_Define(~|where|, sym, al);"))))
59 ))
60 ;; emit
61 (cgen-emit-c (cgen-current-unit))
62 0)
63
64 ;; Override autoload macro
65 (define-macro (autoload file . vars)
66 `(register-autoload 'gauche ',file ',vars))
67
68 (define-macro (autoload-scheme file . vars)
69 `(register-autoload 'scheme ',file ',vars))
70
71 ;;==========================================================
72 (autoload "gauche/numutil"
73 exact-integer-sqrt
74 continued-fraction real->rational
75 print-exact-decimal-point-number
76 expt-mod gamma lgamma
77 real-valued? rational-valued? integer-valued?
78 div-and-mod div mod div0-and-mod0 div0 mod0
79 floor/ floor-quotient floor-remainder
80 truncate/ truncate-quotient truncate-remainder
81 square encode-float
82 approx=? nearly=?)
83
84 (autoload "gauche/redefutil"
85 redefine-class! class-redefinition
86 update-direct-subclass! change-object-class)
87
88 (autoload gauche.charconv %open-input-file/conv %open-output-file/conv)
89
90 (autoload "gauche/sigutil" (:macro with-signal-handlers))
91
92 (autoload gauche.modutil (:macro export-if-defined use-version))
93
94 (autoload gauche.portutil copy-port)
95
96 (autoload "gauche/logutil"
97 logtest logbit? copy-bit bit-field copy-bit-field)
98
99 (autoload gauche.common-macros
100 (:macro get-optional get-keyword* fluid-let while until))
101
102 (autoload gauche.regexp
103 regexp-unparse rxmatch-substrings rxmatch-positions
104 <regexp-invalid-ast>)
105
106 (autoload gauche.regexp.sre
107 regexp-parse-sre sre->regexp regexp->sre)
108
109 (autoload gauche.procutil
110 compose .$ complement flip swap pa$ map$ for-each$ apply$
111 count$ fold$ fold-right$ reduce$ reduce-right$
112 filter$ partition$ remove$ find$ find-tail$
113 any$ every$ delete$ member$ assoc$
114 any-pred every-pred
115 ;;(:macro curry-lambda) (:macro define-curry)
116 arity procedure-arity-includes?
117 <arity-at-least> arity-at-least? arity-at-least-value
118 source-code source-location disasm
119 ;; for the backward compatibility
120 port-fold port-fold-right port-for-each port-map)
121
122 (autoload gauche.time (:macro time))
123
124 (autoload gauche.vm.debugger
125 (:macro debug-print debug-print-conditionally
126 debug-funcall debug-funcall-conditionally
127 debug-thread-log)
128 debug-print-width debug-print-pre debug-print-post debug-funcall-pre
129 debug-thread-pre debug-thread-post)
130
131 (autoload gauche.vm.profiler
132 profiler-show profiler-show-load-stats with-profiler)
133
134 (autoload gauche.vm.debug-info decode-debug-info)
135
136 (autoload srfi.7 (:macro program))
137 (autoload srfi.55 (:macro require-extension))
138
139 (autoload gauche.interpolate string-interpolate
140 (:macro string-interpolate*))
141
142 (autoload "gauche/sysutil"
143 sys-realpath sys-fdset list->sys-fdset sys-fdset->list
144 sys-find-file)
145
146 (autoload gauche.vecutil
147 vector-tabulate vector-map vector-map! vector-for-each
148 vector-map-with-index vector-map-with-index!
149 vector-for-each-with-index reverse-list->vector)
150
151 (autoload gauche.computil
152 boolean-comparator char-comparator char-ci-comparator
153 string-ci-comparator symbol-comparator
154 exact-integer-comparator integer-comparator rational-comparator
155 real-comparator complex-comparator number-comparator
156 pair-comparator list-comparator vector-comparator
157 bytevector-comparator uvector-comparator
158 make-eq-comparator make-eqv-comparator
159 make-reverse-comparator make-key-comparator make-tuple-comparator
160 make-pair-comparator
161 make-list-comparator make-vector-comparator
162 (:macro comparator-if<=>))
163
164 (autoload gauche.fileutil
165 sys-stat->file-type sys-stat->mode sys-stat->ino
166 sys-stat->dev sys-stat->rdev sys-stat->nlink
167 sys-stat->size sys-stat->uid sys-stat->gid
168 sys-stat->atime sys-stat->mtime sys-stat->ctime
169 sys-stat->type sys-tm->alist)
170
171 (autoload gauche.fmtutil format-numeral-R)
172
173 (autoload gauche.hashutil string-ci-hash)
174
175 (autoload gauche.treeutil make-tree-map tree-map-empty?
176 tree-map-min tree-map-max
177 tree-map-pop-min! tree-map-pop-max!
178 tree-map-seek tree-map-fold tree-map-fold-right
179 tree-map-map tree-map-for-each
180 tree-map-keys tree-map-values
181 tree-map->alist alist->tree-map
182 tree-map->generator/key-range
183 tree-map-compare-as-sets
184 tree-map-compare-as-sequences)
185
186 (autoload gauche.libutil library-fold library-map library-for-each
187 library-exists? library-has-module?
188 library-name->module-name)
189
190 (autoload gauche.generic-sortutil %generic-sorted?
191 %generic-sort
192 %generic-sort!)
193
194 (autoload gauche.pputil %pretty-print pprint)
195
196 (autoload gauche.version-alist version-alist)
197
198 ;; Autoloading r7rs-setup allows Gauche-native programs to load R7RS library
199 ;; seamlessly.
200 (autoload r7rs-setup (:macro define-library))