id
int64
0
45.1k
file_name
stringlengths
4
68
file_path
stringlengths
14
193
content
stringlengths
32
9.62M
size
int64
32
9.62M
language
stringclasses
1 value
extension
stringclasses
6 values
total_lines
int64
1
136k
avg_line_length
float64
3
903k
max_line_length
int64
3
4.51M
alphanum_fraction
float64
0
1
repo_name
stringclasses
779 values
repo_stars
int64
0
882
repo_forks
int64
0
108
repo_open_issues
int64
0
90
repo_license
stringclasses
8 values
repo_extraction_date
stringclasses
146 values
sha
stringlengths
64
64
__index_level_0__
int64
0
45.1k
exdup_ids_cmlisp_stkv2
sequencelengths
1
47
11,406
win32.lisp
ufasoft_lisp/src/lisp/code/win32.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# ;(defun-ff 'MessageBox '("USER32.DLL" "MessageBoxA") '(int string string int))
1,529
Common Lisp
.lisp
7
216.857143
240
0.40948
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
0041fbf7c3c09108bf650b989781e7a627211c5f5228226d7030cbaae48b6faf
11,406
[ -1 ]
11,407
break.lisp
ufasoft_lisp/src/lisp/code/break.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "SYS") (defvar *debug-frame* nil) (defvar - nil) (defvar + nil) (defvar ++ nil) (defvar +++ nil) (defvar * nil) (defvar ** nil) (defvar *** nil) (defvar / nil) (defvar // nil) (defvar /// nil) (defun _print-in-loop (vals) (prin1 (car vals)) (when (cdr vals) (princ " ;") (terpri) (_print-in-loop (cdr vals)))) (defun _read-eval-print-loop (istm ostm &optional (promt "") filter) (forever (catch 'repl (if (read-eval-print istm ostm promt filter) (return-from _read-eval-print-loop t))))) (defun _read-loop () (forever (catch 'top-level-catcher (if (_read-eval-print-loop *standard-input* *standard-output*) (return-from _read-loop))))) (defun _help () (print ":? Help :bt Backtrace :uw Unwind break " )) (defun _backtrace () (do ((frame (_frame-up nil) (_frame-up frame))) ((null frame)) (describe-frame *debug-io* frame))) (defun _backtrace0 () (do ((frame (_frame-up nil) (_frame-up frame))) ((null frame)) (_describe-frame0 *debug-io* frame))) (defun _break-filter (form) (case form (:? (_help)) (:F (print (_frame-info))) (:bt (_backtrace)) (:bt0 (_backtrace0)) (:uw (throw 'unwind nil))))
2,750
Common Lisp
.lisp
55
45.8
240
0.477545
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
3615af47c0b9940a74cf0c84cc6718b38240f67f9b4a02dc964b91c79046be1a
11,407
[ -1 ]
11,408
byte.lisp
ufasoft_lisp/src/lisp/code/byte.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "SYS") (defun byte (size position) (cons size position)) (defun byte-size (b) (car b)) (defun byte-position (b) (cdr b)) (defun dpb (n b i) (deposit-field (ash n (byte-position b)) b i)) (define-setf-expander LDB (bytespec integer) ;!!! &environment env (multiple-value-bind (SM1 SM2 SM3 SM4 SM5) (get-setf-method integer) ;!!! env (let* ((bytespecvar (gensym)) (storevar (gensym))) (values (cons bytespecvar SM1) (cons bytespec SM2) `(,storevar) `(LET ((,(first SM3) (DPB ,storevar ,bytespecvar ,SM5))) ,SM4 ,storevar ) `(LDB ,bytespecvar ,SM5) ) ) ) ) (define-setf-expander MASK-FIELD (bytespec integer) ;!!! &environment env (multiple-value-bind (SM1 SM2 SM3 SM4 SM5) (get-setf-method integer) ;!!! env (let* ((bytespecvar (gensym)) (storevar (gensym))) (values (cons bytespecvar SM1) (cons bytespec SM2) `(,storevar) `(LET ((,(first SM3) (DEPOSIT-FIELD ,storevar ,bytespecvar ,SM5))) ,SM4 ,storevar ) `(MASK-FIELD ,bytespecvar ,SM5) ) ) ) ) (defun ldb-test (bs n) (not (zerop (ldb bs n))))
2,801
Common Lisp
.lisp
43
56.069767
240
0.460007
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
8c4ccbbefa43022e679758b2498e362ec8e0e29305cf3a7b872adfcb24402f9c
11,408
[ -1 ]
11,409
cffi-sys.lisp
ufasoft_lisp/src/lisp/code/cffi-sys.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "CFFI-SYS") (export '(foreign-pointer pointerp make-pointer null-pointer null-pointer-p inc-pointer canonicalize-symbol-name-case %foreign-alloc foreign-free %foreign-type-size %foreign-type-alignment %mem-ref %mem-set %foreign-funcall %foreign-funcall-pointer %foreign-symbol-pointer %load-foreign-library %close-foreign-library foreign-library-handle get-foreign-library )) (defun pointer-eq (ptr1 ptr2) (eql ptr1 ptr2)) (defun pointerp (ptr) (eq (type-of ptr) 'foreign-pointer)) (defun null-pointer () (make-pointer 0)) (defun null-pointer-p (ptr) (zerop (pointer-address ptr))) (defun inc-pointer (ptr offset) (make-pointer (+ offset (pointer-address ptr)))) (defun canonicalize-symbol-name-case (name) (string-upcase name)) (defun native-namestring (pathname) (namestring pathname)) (defmacro %foreign-funcall-pointer (ptr args &key library calling-convention) `(_%foreign-funcall ,ptr nil ,calling-convention ,@args)) (defmacro %foreign-funcall (name args &key library calling-convention) `(_%foreign-funcall ,name (foreign-library-handle (get-foreign-library ',library)) ,calling-convention ,@args)) (defun register-callback (name function parsed-type) (setf (get name 'callback) (list function (%create-callback name parsed-type)))) (defun %callback (name) (let ((v (get name 'callback))) (if v (second v) (error "Undefined callback: ~S" name))))
2,987
Common Lisp
.lisp
39
71.128205
240
0.548919
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
f6704c337ac8ed0fbd299da55e1925054fc76243dfbc6cf6389ecc0bd36887ae
11,409
[ -1 ]
11,410
sort.lisp
ufasoft_lisp/src/lisp/code/sort.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "SYS") (defun _stable-sort (seq pk i s e) (if (< s e) (let ((x (elt seq i)) (y (elt seq s))) (if (funcall pk y x) (setf (elt seq i) y) (setf (elt seq s) x)) (_stable-sort seq pk i (1+ s) e)))) (defun stable-sort (seq p &key key) (let ((e (1- (length seq))) (pk (_pk p key))) (dotimes (i e seq) (_stable-sort seq pk i (1+ i) e)))) ;!!! optimize #| (defun _qsort (seq pk s e) (if (< s e) (do ((i (1- s)) (j (1+ e)) (x (elt seq s)) y z) (nil) (do () ((progn (setq z (elt seq (decf j))) (not (funcall pk x z))))) (do () ((progn (setq y (elt seq (incf i))) (not (funcall pk y x))))) (if (< i j) (progn (setf (elt seq i) z) (setf (elt seq j) y)) (return (progn (_qsort seq pk s j) (_qsort seq pk (1+ j) e))))))) |# #| buggy (defun _qsort (seq pk s e) (if (< s e) (do ((i s) (j (1+ e)) (x (elt seq s)) y z) (nil) (do () ((or (<= (decf j) i) (funcall pk (setq z (elt seq j)) x)))) (do () ((or (>= (incf i) j) (funcall pk x (setq y (elt seq i)))))) (if (< i j) (progn (setf (elt seq i) z) (setf (elt seq j) y)) (return (progn (setf (elt seq s) z) (setf (elt seq j) x) (_qsort seq pk s (1- j)) (_qsort seq pk (1+ j) e))))))) (defun sort (seq p &key key) (_qsort seq (_pk p key) 0 (1- (length seq))) seq) |# (defun sort (sequence predicate &key key) "Destructively sorts sequence. Predicate should returns non-Nil if Arg1 is to precede Arg2." (typecase sequence (simple-vector (if (> (the fixnum (length (the simple-vector sequence))) 0) (sort-simple-vector sequence predicate key) sequence)) (list (sort-list sequence predicate key)) (vector (if (> (the fixnum (length sequence)) 0) (sort-vector sequence predicate key) sequence)) (t (error "~S is not a sequence." sequence)))) ;;; Sorting Vectors ;;; Sorting is done with a heap sort. (eval-when (compile eval) ;;; HEAPIFY, assuming both sons of root are heaps, percolates the root element ;;; through the sons to form a heap at root. Root and max are zero based ;;; coordinates, but the heap algorithm only works on arrays indexed from 1 ;;; through N (not 0 through N-1); This is because a root at I has sons at 2*I ;;; and 2*I+1 which does not work for a root at 0. Because of this, boundaries, ;;; roots, and termination are computed using 1..N indexes. (defmacro heapify (seq vector-ref root max pred key) (let ((heap-root (gensym)) (heap-max (gensym)) (root-ele (gensym)) (root-key (gensym)) (heap-max/2 (gensym)) (heap-l-son (gensym)) (one-son (gensym)) (one-son-ele (gensym)) (one-son-key (gensym)) (r-son-ele (gensym)) (r-son-key (gensym)) (var-root (gensym))) `(let* ((,var-root ,root) ; necessary to not clobber calling root var. (,heap-root (1+ ,root)) (,heap-max (1+ ,max)) (,root-ele (,vector-ref ,seq ,root)) (,root-key (apply-key ,key ,root-ele)) (,heap-max/2 (ash ,heap-max -1))) ; (floor heap-max 2) (declare (fixnum ,var-root ,heap-root ,heap-max ,heap-max/2)) (loop (if (> ,heap-root ,heap-max/2) (return)) (let* ((,heap-l-son (ash ,heap-root 1)) ; (* 2 heap-root) ;; l-son index in seq (0..N-1) is one less than heap computation (,one-son (1- ,heap-l-son)) (,one-son-ele (,vector-ref ,seq ,one-son)) (,one-son-key (apply-key ,key ,one-son-ele))) (declare (fixnum ,heap-l-son ,one-son)) (if (< ,heap-l-son ,heap-max) ;; there is a right son. (let* ((,r-son-ele (,vector-ref ,seq ,heap-l-son)) (,r-son-key (apply-key ,key ,r-son-ele))) ;; choose the greater of the two sons. (when (funcall ,pred ,one-son-key ,r-son-key) (setf ,one-son ,heap-l-son) (setf ,one-son-ele ,r-son-ele) (setf ,one-son-key ,r-son-key)))) ;; if greater son is less than root, then we've formed a heap again. (if (funcall ,pred ,one-son-key ,root-key) (return)) ;; else put greater son at root and make greater son node be the root. (setf (,vector-ref ,seq ,var-root) ,one-son-ele) (setf ,heap-root (1+ ,one-son)) ; one plus to be in heap coordinates. (setf ,var-root ,one-son))) ; actual index into vector for root ele. ;; now really put percolated value into heap at the appropriate root node. (setf (,vector-ref ,seq ,var-root) ,root-ele)))) ;;; BUILD-HEAP rearranges seq elements into a heap to start heap sorting. (defmacro build-heap (seq type len-1 pred key) (let ((i (gensym))) `(do ((,i (floor ,len-1 2) (1- ,i))) ((minusp ,i) ,seq) (declare (fixnum ,i)) (heapify ,seq ,type ,i ,len-1 ,pred ,key)))) ) ; eval-when ;;; Make simple-vector and miscellaneous vector sorting functions. (macrolet ((frob-rob (fun-name vector-ref) `(defun ,fun-name (seq pred key) (let ((len-1 (1- (length (the vector seq))))) (declare (fixnum len-1)) (build-heap seq ,vector-ref len-1 pred key) (do* ((i len-1 i-1) (i-1 (1- i) (1- i-1))) ((zerop i) seq) (declare (fixnum i i-1)) (rotatef (,vector-ref seq 0) (,vector-ref seq i)) (heapify seq ,vector-ref 0 i-1 pred key)))))) (frob-rob sort-vector aref) (frob-rob sort-simple-vector svref)) ;;;; Stable Sorting (defun stable-sort (sequence predicate &key key) "Destructively sorts sequence. Predicate should returns non-Nil if Arg1 is to precede Arg2." (typecase sequence (simple-vector (stable-sort-simple-vector sequence predicate key)) (list (sort-list sequence predicate key)) (vector (stable-sort-vector sequence predicate key)) (t (error "~S is not a sequence." sequence)))) ;;; Stable Sorting Lists ;;; SORT-LIST uses a bottom up merge sort. First a pass is made over ;;; the list grabbing one element at a time and merging it with the next one ;;; form pairs of sorted elements. Then n is doubled, and elements are taken ;;; in runs of two, merging one run with the next to form quadruples of sorted ;;; elements. This continues until n is large enough that the inner loop only ;;; runs for one iteration; that is, there are only two runs that can be merged, ;;; the first run starting at the beginning of the list, and the second being ;;; the remaining elements. (defun sort-list (list pred key) (let ((head (cons :header list)) ; head holds on to everything (n 1) ; bottom-up size of lists to be merged unsorted ; unsorted is the remaining list to be ; broken into n size lists and merged list-1 ; list-1 is one length n list to be merged last) ; last points to the last visited cell (declare (fixnum n)) (loop ;; start collecting runs of n at the first element (setf unsorted (cdr head)) ;; tack on the first merge of two n-runs to the head holder (setf last head) (let ((n-1 (1- n))) (declare (fixnum n-1)) (loop (setf list-1 unsorted) (let ((temp (nthcdr n-1 list-1)) list-2) (cond (temp ;; there are enough elements for a second run (setf list-2 (cdr temp)) (setf (cdr temp) nil) (setf temp (nthcdr n-1 list-2)) (cond (temp (setf unsorted (cdr temp)) (setf (cdr temp) nil)) ;; the second run goes off the end of the list (t (setf unsorted nil))) (multiple-value-bind (merged-head merged-last) (merge-lists* list-1 list-2 pred key) (setf (cdr last) merged-head) (setf last merged-last)) (if (null unsorted) (return))) ;; if there is only one run, then tack it on to the end (t (setf (cdr last) list-1) (return))))) (setf n (ash n 1)) ; (+ n n) ;; If the inner loop only executed once, then there were only enough ;; elements for two runs given n, so all the elements have been merged ;; into one list. This may waste one outer iteration to realize. (if (eq list-1 (cdr head)) (return list-1)))))) ;;; APPLY-PRED saves us a function call sometimes. (eval-when (compile eval) (defmacro apply-pred (one two pred key) `(if ,key (funcall ,pred (funcall ,key ,one) (funcall ,key ,two)) (funcall ,pred ,one ,two))) ) ; eval-when (defvar *merge-lists-header* (list :header)) ;;; MERGE-LISTS* originally written by Jim Large. ;;; modified to return a pointer to the end of the result ;;; and to not cons header each time its called. ;;; It destructively merges list-1 with list-2. In the resulting ;;; list, elements of list-2 are guaranteed to come after equal elements ;;; of list-1. (defun merge-lists* (list-1 list-2 pred key) (do* ((result *merge-lists-header*) (P result)) ; P points to last cell of result ((or (null list-1) (null list-2)) ; done when either list used up (if (null list-1) ; in which case, append the (rplacd p list-2) ; other list (rplacd p list-1)) (do ((drag p lead) (lead (cdr p) (cdr lead))) ((null lead) (values (prog1 (cdr result) ; return the result sans header (rplacd result nil)) ; (free memory, be careful) drag)))) ; and return pointer to last element (cond ((apply-pred (car list-2) (car list-1) pred key) (rplacd p list-2) ; append the lesser list to last cell of (setq p (cdr p)) ; result. Note: test must bo done for (pop list-2)) ; list-2 < list-1 so merge will be (T (rplacd p list-1) ; stable for list-1 (setq p (cdr p)) (pop list-1))))) ;;; Stable Sort Vectors ;;; Stable sorting vectors is done with the same algorithm used for lists, ;;; using a temporary vector to merge back and forth between it and the ;;; given vector to sort. (eval-when (compile eval) ;;; STABLE-SORT-MERGE-VECTORS* takes a source vector with subsequences, ;;; start-1 (inclusive) ... end-1 (exclusive) and ;;; end-1 (inclusive) ... end-2 (exclusive), ;;; and merges them into a target vector starting at index start-1. (defmacro stable-sort-merge-vectors* (source target start-1 end-1 end-2 pred key source-ref target-ref) (let ((i (gensym)) (j (gensym)) (target-i (gensym))) `(let ((,i ,start-1) (,j ,end-1) ; start-2 (,target-i ,start-1)) (declare (fixnum ,i ,j ,target-i)) (loop (cond ((= ,i ,end-1) (loop (if (= ,j ,end-2) (return)) (setf (,target-ref ,target ,target-i) (,source-ref ,source ,j)) (incf ,target-i) (incf ,j)) (return)) ((= ,j ,end-2) (loop (if (= ,i ,end-1) (return)) (setf (,target-ref ,target ,target-i) (,source-ref ,source ,i)) (incf ,target-i) (incf ,i)) (return)) ((apply-pred (,source-ref ,source ,j) (,source-ref ,source ,i) ,pred ,key) (setf (,target-ref ,target ,target-i) (,source-ref ,source ,j)) (incf ,j)) (t (setf (,target-ref ,target ,target-i) (,source-ref ,source ,i)) (incf ,i))) (incf ,target-i))))) ;;; VECTOR-MERGE-SORT is the same algorithm used to stable sort lists, but ;;; it uses a temporary vector. Direction determines whether we are merging ;;; into the temporary (T) or back into the given vector (NIL). (defmacro vector-merge-sort (vector pred key vector-ref) (let ((vector-len (gensym)) (n (gensym)) (direction (gensym)) (unsorted (gensym)) (start-1 (gensym)) (end-1 (gensym)) (end-2 (gensym)) (temp-len (gensym)) (i (gensym))) `(let ((,vector-len (length (the vector ,vector))) (,n 1) ; bottom-up size of contiguous runs to be merged (,direction t) ; t vector --> temp nil temp --> vector (,temp-len (length (the simple-vector *merge-sort-temp-vector*))) (,unsorted 0) ; unsorted..vector-len are the elements that need ; to be merged for a given n (,start-1 0)) ; one n-len subsequence to be merged with the next (declare (fixnum ,vector-len ,n ,temp-len ,unsorted ,start-1)) (if (> ,vector-len ,temp-len) (setf *merge-sort-temp-vector* (make-array (max ,vector-len (+ ,temp-len ,temp-len))))) (loop ;; for each n, we start taking n-runs from the start of the vector (setf ,unsorted 0) (loop (setf ,start-1 ,unsorted) (let ((,end-1 (+ ,start-1 ,n))) (declare (fixnum ,end-1)) (cond ((< ,end-1 ,vector-len) ;; there are enough elements for a second run (let ((,end-2 (+ ,end-1 ,n))) (declare (fixnum ,end-2)) (if (> ,end-2 ,vector-len) (setf ,end-2 ,vector-len)) (setf ,unsorted ,end-2) (if ,direction (stable-sort-merge-vectors* ,vector *merge-sort-temp-vector* ,start-1 ,end-1 ,end-2 ,pred ,key ,vector-ref svref) (stable-sort-merge-vectors* *merge-sort-temp-vector* ,vector ,start-1 ,end-1 ,end-2 ,pred ,key svref ,vector-ref)) (if (= ,unsorted ,vector-len) (return)))) ;; if there is only one run, copy those elements to the end (t (if ,direction (do ((,i ,start-1 (1+ ,i))) ((= ,i ,vector-len)) (declare (fixnum ,i)) (setf (svref *merge-sort-temp-vector* ,i) (,vector-ref ,vector ,i))) (do ((,i ,start-1 (1+ ,i))) ((= ,i ,vector-len)) (declare (fixnum ,i)) (setf (,vector-ref ,vector ,i) (svref *merge-sort-temp-vector* ,i)))) (return))))) ;; If the inner loop only executed once, then there were only enough ;; elements for two subsequences given n, so all the elements have ;; been merged into one list. Start-1 will have remained 0 upon exit. (when (zerop ,start-1) (if ,direction ;; if we just merged into the temporary, copy it all back ;; to the given vector. (dotimes (,i ,vector-len) (setf (,vector-ref ,vector ,i) (svref *merge-sort-temp-vector* ,i)))) (return ,vector)) (setf ,n (ash ,n 1)) ; (* 2 n) (setf ,direction (not ,direction)))))) ) ; eval-when ;;; Temporary vector for stable sorting vectors. (defvar *merge-sort-temp-vector* (make-array 50)) (proclaim '(simple-vector *merge-sort-temp-vector*)) (defun stable-sort-simple-vector (vector pred key) (declare (simple-vector vector)) (vector-merge-sort vector pred key svref)) (defun stable-sort-vector (vector pred key) (vector-merge-sort vector pred key aref))
16,857
Common Lisp
.lisp
362
39.055249
240
0.558292
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
76cfadcc034645876dd1c0370043bcc5299771ba94127a5514d9491172c35802
11,410
[ -1 ]
11,411
debug.lisp
ufasoft_lisp/src/lisp/code/debug.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "SYSTEM") (defun frame-up (n sp mode) (do ((np (frame-up-1 sp mode))) ((or (eq np sp) (and (integerp n) (zerop n))) sp) (setq sp np) (if (integerp n) (setq n (1- n))))) (defun frame-down (n sp mode) (do ((np (frame-down-1 sp mode))) ((or (eq np sp) (and (integerp n) (zerop n))) sp) (setq sp np) (if (integerp n) (setq n (1- n))))) (defun _read-form-eof (istream) (clear-input istream) (values t t)) (defun read-form (prompt &optional command-list &aux (istream *standard-input*) (ostream *standard-output*) (interactive-p (interactive-stream-p istream))) (let () ;((raw (terminal-raw istream nil))) (when interactive-p (fresh-line ostream) (write-string prompt ostream) (force-output ostream)) (let* ((eof-value "EOF") (form (let ((*read-suppress* nil) (*key-bindings* (nreconc command-list *key-bindings*)) trs-bound old-trs) (prog2 (if (and interactive-p (not (boundp '*terminal-read-stream*))) (multiple-value-bind (line flag) (read-line istream nil) (when (null line) (return-from read-form (_read-form-eof istream))) (dolist (h *key-bindings*) (when (and (consp h) (string-equal (car h) (subseq line 0 (min (length (car h)) (length line) )))) (funcall (cdr h) (subseq line (length (car h)))) (return-from read-form (_read-form-eof istream)))) (setq istream (make-concatenated-stream (make-string-input-stream (if flag line (ext:string-concat line (string #\Newline)))) istream) trs-bound t)) (when (boundp '*terminal-read-stream*) (setq old-trs *terminal-read-stream*) (makunbound '*terminal-read-stream*) (setq istream old-trs trs-bound t))) (progv (if trs-bound '(*terminal-read-stream*)) (if trs-bound (list istream)) (prog1 (read istream nil eof-value nil) (setq old-trs (and trs-bound (boundp '*terminal-read-stream*) *terminal-read-stream*)))) (when old-trs (let ((concs (concatenated-stream-streams old-trs))) (when (and (cdr concs) (peek-char t (car concs) nil)) (setq *terminal-read-stream* old-trs)))))))) ; (terminal-raw istream raw) (if (eql form eof-value) (_read-form-eof istream) (progn ;(clear-input-upto-newline istream) (values form nil)))))) (defun read-eval-print (prompt &optional command-list) (multiple-value-bind (form flag) (read-form prompt command-list) (if flag form ; return T (progn (setq +++ ++ ++ + + form - form) (let ((vals (multiple-value-list (eval form)))) (setq /// // // / / vals *** ** ** * * (car vals)) (fresh-line) (when vals (do () ((null (progn (write (pop vals)) vals))) (write-string " ;") (terpri))))))))
5,165
Common Lisp
.lisp
90
42.622222
240
0.442571
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
014161ef5fb2fd32e4dad4221cd9c018657100f6d9a2a7ad9dc3cd168abf9d10
11,411
[ -1 ]
11,412
seq.lisp
ufasoft_lisp/src/lisp/code/seq.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "SYSTEM") (defvar *_seq-types* nil) (defun _seq-type (x) (svref x 0)) (defun _seq-init (x) (svref x 1)) (defun _seq-upd (x) (svref x 2)) (defun _seq-endtest (x) (svref x 3)) (defun _seq-fe_init (x) (svref x 4)) (defun _seq-fe_upd (x) (svref x 5)) (defun _seq-fe_endtest (x) (svref x 6)) (defun _seq-access (x) (svref x 7)) (defun _seq-access_set (x) (svref x 8)) (defun _seq-copy (x) (svref x 9)) (defun _seq-length (x) (svref x 10)) (defun _seq-make (x) (svref x 11)) (defun _seq-elt (x) (svref x 12)) (defun _seq-set_elt (x) (svref x 13)) (defun _seq-init_start (x) (svref x 14)) (defun _seq-fe_init_end (x) (svref x 15)) (defun %defseq (x) (push x *_seq-types*) (_seq-type x)) #| (defun _get-seq-type (seq) (_find-seq-type (cond ((listp seq) 'list) ((stringp seq) 'string) ((vectorp seq) 'vector)))) (defun _get-valid-seq-type (seq) (or (_get-seq-type seq) (err))) (defun _get-td-check-index (seq i) (prog1 (_get-valid-seq-type seq) (if (or (not (integerp i)) (minusp i)) (err)) (when (and (vectorp seq) (>= i (length seq))) (err)))) |# #|!!! (defun |(SETF ELT)| (n seq i) (funcall (_seq-set_elt (_get-td-check-index seq i)) seq i n) n) |# (defun (SETF ELT) (n seq i) ;!!! (|(SETF ELT)| n seq i)) (defun count-if (p seq &key from-end (start 0) end key) (let ((c 0)) (_seq-test #'(lambda (i) (declare (ignore i)) (incf c)) p seq from-end start end key) c)) (defun count-if-not (p seq &rest rest &key from-end (start 0) end key) (declare (ignore from-end start end key)) (apply #'count-if (complement p) seq rest)) (defun count (item seq &rest rest &key from-end (start 0) end key (test #'eql) test-not) (declare (ignore from-end start end key)) (apply #'count-if (_test item test test-not) seq :allow-other-keys t rest)) (defun find-if (p seq &key from-end (start 0) end key) (_seq-test #'(lambda (i) (return-from find-if (elt seq i))) p seq from-end start end key)) (defun find-if-not (p seq &rest rest &key from-end (start 0) end key) (declare (ignore from-end start end key)) (apply #'find-if (complement p) seq rest)) (defun find (item seq &rest rest &key from-end (test #'eql) test-not (start 0) end key) (declare (ignore from-end start end key)) (apply #'find-if (_test item test test-not) seq :allow-other-keys t rest)) (defun position-if (p seq &key from-end (start 0) end key) (_seq-test #'(lambda (i) (return-from position-if i)) p seq from-end start end key)) (defun position-if-not (p seq &rest rest &key from-end (start 0) end key) (declare (ignore from-end start end key)) (apply #'position-if (complement p) seq rest)) (defun fill (seq item &key (start 0) end) (_seq-iterate #'(lambda (x z i) (declare (ignore x z)) (setf (elt seq i) item)) seq nil start end nil)) (defun nsubstitute-if (new p seq &key from-end (start 0) end count key) (_seq-iterate #'(lambda (x z i) (declare (ignore x)) (when (and (or (null count) (plusp count)) (funcall p z)) (setf (elt seq i) new) (if count (decf count)))) seq from-end start end key)) (defun nsubstitute-if-not (new p seq &rest rest &key from-end (start 0) end count key) (declare (ignore from-end start end count key)) (apply #'nsubstitute-if new (complement p) seq rest)) (defun nsubstitute (new old seq &rest rest &key from-end (test #'eql) test-not (start 0) end count key) (declare (ignore from-end start end count key)) (apply #'nsubstitute-if new (_test old test test-not) seq :allow-other-keys t rest)) (defun substitute (new old seq &rest rest &key from-end (test #'eql) test-not (start 0) end count key) (declare (ignore from-end test test-not start end count key)) (apply #'nsubstitute new old (copy-seq seq) rest)) (defun substitute-if (new p seq &rest rest &key from-end (start 0) end count key) (declare (ignore from-end start end count key)) (apply #'nsubstitute-if new p (copy-seq seq) rest)) (defun substitute-if-not (new p seq &rest rest &key from-end (start 0) end count key) (declare (ignore from-end start end count key)) (apply #'nsubstitute-if-not new p (copy-seq seq) rest)) (defun remove-if-not (p seq &rest rest &key from-end (start 0) end count key) (declare (ignore from-end start end count key)) (apply #'remove-if (complement p) seq rest)) (defun remove (item seq &rest rest &key from-end (test #'eql) test-not (start 0) end count key) (declare (ignore from-end start end count key)) (apply #'remove-if (_test item test test-not) seq :allow-other-keys t rest)) ;!!! (defun delete-if (p seq &rest rest &key from-end (start 0) end count key) (declare (ignore from-end start end count key)) (apply #'remove-if p seq rest)) (defun delete-if-not (p seq &rest rest &key from-end (start 0) end count key) (declare (ignore from-end start end count key)) (apply #'delete-if (complement p) seq rest)) (defun delete (item seq &rest rest &key from-end (test #'eql) test-not (start 0) end count key) (declare (ignore from-end start end count key)) (apply #'delete-if (_test item test test-not) seq :allow-other-keys t rest)) #|!!! (defun _list-to-seq (seq list from-end) (do ((last (1- (length seq))) (n 0 (1+ n)) (x list (cdr x))) ((endp x) seq) (setf (elt seq (if from-end n (- last n))) (car x)))) |# (defun remove-duplicates (seq &key from-end (test #'eql) test-not (start 0) end key) (let (stack) (_seq-iterate #'(lambda (x z i) (declare (ignore i)) (if (not (find z stack :test test :test-not test-not :key key)) (push x stack))) seq (not from-end) start end key) (concatenate (type-of seq) (subseq seq 0 start) (if from-end (nreverse stack) stack) (subseq seq (_end end seq))))) (defun delete-duplicates (seq &rest rest &key from-end (test #'eql) test-not (start 0) end key) (declare (ignore from-end test test-not start end key)) (apply #'remove-duplicates seq rest)) (defun search (seq1 seq2 &rest rest &key from-end (test #'eql) test-not key (start1 0) (start2 0) end1 end2) (declare (ignore test test-not key)) (setq end2 (_end end2 seq2)) (do ((i (if from-end (1- end2) start2) (if from-end (1- i) (1+ i))) (len1 (- (_end end1 seq1) start1))) ((if from-end (< i start2) (>= i end2)) nil) (unless (apply #'mismatch seq1 seq2 :start2 i :end2 (min end2 (+ i len1)) rest) (return-from search i)))) (defun _copy-seqpart-into (seq1 td1 seq2 td2 count p1 p2) (let ((u1 (_seq-upd td1)) (u2 (_seq-upd td2)) (acc1 (_seq-access td1)) (accset2 (_seq-access_set td2))) (dotimes (i count seq2) (funcall accset2 seq2 p2 (funcall acc1 seq1 p1)) (setq p1 (funcall u1 seq1 p1)) (setq p2 (funcall u2 seq2 p2))))) (defun _copy-seqpart-onto (seq1 td1 seq2 td2 count p1) (_copy-seqpart-into seq1 td1 seq2 td2 count p1 (funcall (_seq-init td2) seq2))) (defun _merge (seq seq1 seq2 n1 n2 p k) (let* ((e1 (< n1 (length seq1))) (e2 (< n2 (length seq2))) s (x (if e1 (elt seq1 n1))) (y (if e2 (elt seq2 n2)))) (cond ((and (not e1) (not e2)) (return-from _merge)) ((not e1)) ((not e2) (setq s t)) ((let ((vx (funcall k x)) (vy (funcall k y))) (setq s (or (funcall p vx vy) (not (funcall p vy vx))))))) (setf (elt seq (+ n1 n2)) (if s x y)) (_merge seq seq1 seq2 (if s (1+ n1) n1) (if s n2 (1+ n2)) p k))) (defun merge (result-type seq1 seq2 p &key key) (let ((seq (make-sequence result-type (+ (length seq1) (length seq2))))) (_merge seq seq1 seq2 0 0 p (_key key)) seq)) (defun copy-seq (seq) (subseq seq 0)) (defun _coerce-seq (seq typ error-p) (multiple-value-bind (td2 len) (if error-p (_valid-type typ) (_valid-type1 typ)) (when td2 (let* ((td1 (_get-valid-seq-type seq)) (stl (funcall (_seq-length td1) seq))) (when (and len (if (eql len -1) (zerop stl) (not (eql len stl)))) (err)) (if (eq (_seq-type td1) (_seq-type td2)) seq (_copy-seqpart-onto seq td1 (funcall (_seq-make td2) stl) td2 stl (funcall (_seq-init td1) seq))))))) (%putd 'list-llength #'length) (%putd 'vector-length #'length) (defun list-upd (seq p) (declare (ignore seq)) (cdr p)) (defun list-endtest (seq p) (declare (ignore seq)) (endp p)) (defun list-fe-init (seq) (revappend seq nil)) (defun list-access (seq p) (declare (ignore seq)) (if (atom p) (err) (car p))) (defun list-access-set (seq p v) (declare (ignore seq)) (setf (car p) v)) (defun list-elt (seq i) (nth i seq)) (defun list-set-elt (seq i v) (setf (nth i seq) v)) (defun list-init-start (seq i) (nthcdr i seq)) (defun list-fe-init-end (seq index) (if (<= 0 index) (do* ((L1 nil (cons (car L2) L1)) (L2 seq (cdr L2)) (i index (1- i))) ((zerop i) L1) (if (atom L2) (err))) (err))) (defun vector-init (seq) (declare (ignore seq)) 0) (defun vector-upd (seq p) (declare (ignore seq)) (1+ p)) (defun vector-endtest (seq p) (= p (length seq))) (defun vector-fe-init (seq) (1- (length seq))) (defun vector-fe-upd (seq p) (declare (ignore seq)) (1- p)) (defun vector-fe-endtest (seq p) (declare (ignore seq)) (minusp p)) (defun vector-init-start (seq i) (if (<= 0 i (length seq)) i (err))) (defun vector-fe-init-end (seq i) (if (<= 0 i (length seq)) (1- i) (err))) (defun make-bit-vector (len) (make-array len :element-type 'bit)) (defun reduce (fun seq &key key from-end (start 0) end (initial-value nil init-suppl)) (setq key (_key key) end (_end end seq)) (if (= start end) (if init-suppl initial-value (funcall fun)) (do* ((i (if from-end (1- end) start) (if from-end (1- i) (1+ i))) (r (if init-suppl initial-value (prog1 (funcall key (elt seq i)) (if from-end (decf i) (incf i)))))) ((if from-end (< i start) (>= i end)) r) (setq r (let ((x (funcall key (elt seq i)))) (if from-end (funcall fun x r) (funcall fun r x)))))))
12,491
Common Lisp
.lisp
277
37.913357
240
0.558153
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
595c0b9f090b2df3a1440f27472404451e06d0b789934764a4bfd0fa05a50285
11,412
[ -1 ]
11,413
utils.lisp
ufasoft_lisp/src/lisp/code/utils.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# ;;; Collect-List-Expander -- Internal ;;; ;;; This function deals with the list collection case. N-Tail is the pointer ;;; to the current tail of the list, which is NIL if the list is empty. ;;; (defun collect-list-expander (n-value n-tail forms) (let ((n-res (gensym))) `(progn ,@(mapcar #'(lambda (form) `(let ((,n-res (cons ,form nil))) (cond (,n-tail (setf (cdr ,n-tail) ,n-res) (setq ,n-tail ,n-res)) (t (setq ,n-tail ,n-res ,n-value ,n-res))))) forms) ,n-value))) ;;; Collect -- Public ;;; ;;; The ultimate collection macro... ;;; (defmacro collect (collections &body body) "Collect ({(Name [Initial-Value] [Function])}*) {Form}* Collect some values somehow. Each of the collections specifies a bunch of things which collected during the evaluation of the body of the form. The name of the collection is used to define a local macro, a la MACROLET. Within the body, this macro will evaluate each of its arguments and collect the result, returning the current value after the collection is done. The body is evaluated as a PROGN; to get the final values when you are done, just call the collection macro with no arguments. Initial-Value is the value that the collection starts out with, which defaults to NIL. Function is the function which does the collection. It is a function which will accept two arguments: the value to be collected and the current collection. The result of the function is made the new value for the collection. As a totally magical special-case, the Function may be Collect, which tells us to build a list in forward order; this is the default. If an Initial-Value is supplied for Collect, the stuff will be rplacd'd onto the end. Note that Function may be anything that can appear in the functional position, including macros and lambdas." (let ((macros ()) (binds ())) (dolist (spec collections) (unless (<= 1 (length spec) 3) (error "Malformed collection specifier: ~S." spec)) (let ((n-value (gensym)) (name (first spec)) (default (second spec)) (kind (or (third spec) 'collect))) (push `(,n-value ,default) binds) (if (eq kind 'collect) (let ((n-tail (gensym))) (if default (push `(,n-tail (last ,n-value)) binds) (push n-tail binds)) (push `(,name (&rest args) (collect-list-expander ',n-value ',n-tail args)) macros)) (push `(,name (&rest args) (collect-normal-expander ',n-value ',kind args)) macros)))) `(macrolet ,macros (let* ,(nreverse binds) ,@body)))) (defun apropos-search (symbol string) (declare (simple-string string)) (do* ((index 0 (1+ index)) (name (symbol-name symbol)) (length (length string)) (terminus (- (length name) length))) ((> index terminus) nil) (declare (simple-string name) (type index index terminus length)) (if (do ((jndex 0 (1+ jndex)) (kndex index (1+ kndex))) ((= jndex length) t) (declare (fixnum jndex kndex)) (let ((char (schar name kndex))) (unless (char= (schar string jndex) (char-upcase char)) (return nil)))) (return t)))) ;;; MAP-APROPOS -- public (extension). ;;; (defun map-apropos (fun string &optional package external-only) "Call FUN with each symbol that contains STRING. If PACKAGE is supplied then only use symbols present in that package. If EXTERNAL-ONLY is true then only use symbols exported from the specified package." (let ((string (string-upcase string))) (declare (simple-string string)) (flet ((apropos-in-package (package) (if external-only (do-external-symbols (symbol package) (if (and (eq (symbol-package symbol) package) (apropos-search symbol string)) (funcall fun symbol))) (do-symbols (symbol package) (if (and (eq (symbol-package symbol) package) (apropos-search symbol string)) (funcall fun symbol)))))) (if (null package) (mapc #'apropos-in-package (list-all-packages)) (apropos-in-package (package-or-lose package)))) nil)) (defun briefly-describe-symbol (symbol) (fresh-line) (prin1 symbol) (when (boundp symbol) (write-string ", value: ") (prin1 (symbol-value symbol))) (if (fboundp symbol) (write-string " (defined)"))) ;;; APROPOS -- public. ;;; (defun apropos (string &optional package external-only) "Briefly describe all symbols which contain the specified String. If Package is supplied then only describe symbols present in that package. If External-Only is true then only describe external symbols in the specified package." (map-apropos #'briefly-describe-symbol string package external-only) (values)) ;;; APROPOS-LIST -- public. ;;; (defun apropos-list (string &optional package external-only) "Identical to Apropos, except that it returns a list of the symbols found instead of describing them." (collect ((result)) (map-apropos #'(lambda (symbol) (result symbol)) string package external-only) (result))) ;;;; WITH-PACKAGE-ITERATOR (defmacro with-package-iterator ((mname package-list &rest symbol-types) &body body) (let* ((packages (gensym)) (these-packages (gensym)) (ordered-types (let ((res nil)) (dolist (kind '(:inherited :external :internal) res) (when (member kind symbol-types) (push kind res))))) ; Order symbol-types. (counter (gensym)) (kind (gensym)) (hash-vector (gensym)) (vector (gensym)) (package-use-list (gensym)) (init-macro (gensym)) (end-test-macro (gensym)) (real-symbol-p (gensym)) (BLOCK (gensym))) `(let* ((,these-packages ,package-list) (,packages `,(mapcar #'(lambda (package) (if (packagep package) package (find-package package))) (if (consp ,these-packages) ,these-packages (list ,these-packages)))) (,counter nil) (,kind (car ,packages)) (,hash-vector nil) (,vector nil) (,package-use-list nil)) ,(if (member :inherited ordered-types) `(setf ,package-use-list (package-%use-list (car ,packages))) `(declare (ignore ,package-use-list))) (macrolet ((,init-macro (next-kind) (let ((symbols (gensym))) `(progn (setf ,',kind ,next-kind) (setf ,',counter nil) ,(case next-kind (:internal `(let ((,symbols (package-internal-symbols (car ,',packages)))) (setf ,',vector (package-hashtable-table ,symbols)) (setf ,',hash-vector (package-hashtable-hash ,symbols)))) (:external `(let ((,symbols (package-external-symbols (car ,',packages)))) (setf ,',vector (package-hashtable-table ,symbols)) (setf ,',hash-vector (package-hashtable-hash ,symbols)))) (:inherited `(let ((,symbols (package-external-symbols (car ,',package-use-list)))) (setf ,',vector (package-hashtable-table ,symbols)) (setf ,',hash-vector (package-hashtable-hash ,symbols)))))))) (,end-test-macro (this-kind) `,(let ((next-kind (cadr (member this-kind ',ordered-types)))) (if next-kind `(,',init-macro ,next-kind) `(if (endp (setf ,',packages (cdr ,',packages))) (return-from ,',BLOCK) (,',init-macro ,(car ',ordered-types))))))) (when ,packages ,(when (null symbol-types) (error "Must supply at least one of :internal, :external, or ~ :inherited.")) ,(dolist (symbol symbol-types) (unless (member symbol '(:internal :external :inherited)) (error "~S is not one of :internal, :external, or :inherited." symbol))) (,init-macro ,(car ordered-types)) (flet ((,real-symbol-p (number) (> number 1))) (macrolet ((,mname () `(block ,',BLOCK (loop (case ,',kind ,@(when (member :internal ',ordered-types) `((:internal (setf ,',counter (position-if #',',real-symbol-p ,',hash-vector :start (if ,',counter (1+ ,',counter) 0))) (if ,',counter (return-from ,',BLOCK (values t (svref ,',vector ,',counter) ,',kind (car ,',packages))) (,',end-test-macro :internal))))) ,@(when (member :external ',ordered-types) `((:external (setf ,',counter (position-if #',',real-symbol-p ,',hash-vector :start (if ,',counter (1+ ,',counter) 0))) (if ,',counter (return-from ,',BLOCK (values t (svref ,',vector ,',counter) ,',kind (car ,',packages))) (,',end-test-macro :external))))) ,@(when (member :inherited ',ordered-types) `((:inherited (setf ,',counter (position-if #',',real-symbol-p ,',hash-vector :start (if ,',counter (1+ ,',counter) 0))) (cond (,',counter (return-from ,',BLOCK (values t (svref ,',vector ,',counter) ,',kind (car ,',packages)))) (t (setf ,',package-use-list (cdr ,',package-use-list)) (cond ((endp ,',package-use-list) (setf ,',packages (cdr ,',packages)) (when (endp ,',packages) (return-from ,',BLOCK)) (setf ,',package-use-list (package-%use-list (car ,',packages))) (,',init-macro ,(car ',ordered-types))) (t (,',init-macro :inherited) (setf ,',counter nil))))))))))))) ,@body)))))))
11,293
Common Lisp
.lisp
265
35.50566
240
0.572521
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
f6655bc3ad6723474a29d69e037e4ed35aa5cd114f60a14ba4969600b91029c1
11,413
[ -1 ]
11,414
print.lisp
ufasoft_lisp/src/lisp/code/print.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "SYS") (setq *prin-traillength* 0) (setq *prin-level* 0) (defmethod print-object ((x integer) s) (_print-integer x s)) (defmethod print-object ((x method) s) (write-string "#<METHOD>" s) x) (with-output-to-string (stm) ;!!! to precompile print-object (print-object (find-class 'method) stm)) (setq sys::*_use-print-object* t) #|!!!R (defun write-unreadable (fun x stm &key type identity) (write-string "#<" stm) (when type (write (type-of x) :stream stm :readably nil) (if (or fun identity) (write-string " " stm))) (if fun (funcall fun)) (write-string ">" stm) nil) |# (defmacro print-unreadable-object ((&whole args object stream &key type identity) &body body) (declare (ignore object stream type identity)) `(SYSTEM::WRITE-UNREADABLE ,(if body `(FUNCTION (LAMBDA () ,@body)) 'NIL) ,@args )) (defmethod print-object ((x t) stm) (print-unreadable-object (x stm :type t :identity t) ) x) (defmethod print-object ((x package) s) (_print-package x s)) (defmethod print-object ((x character) s) (_print-character x s)) (defmethod print-object ((x float) stm) (_print-float x stm)) (defmethod print-object ((x symbol) stm) (_print-symbol x stm)) (defmethod print-object ((x stream) stm) (_print-stream x stm)) (defmethod print-object ((x list) s) (_print-list x s) x) (defmethod print-object ((x string) s) (_print-string x s)) (defmethod print-object ((x ratio) s) (_print-ratio x s)) (defmethod print-object ((x complex) s) (_print-complex x s)) (defmethod print-object ((x vector) s) (_print-vector x s)) (defmethod print-object ((x bit-vector) s) (_print-bit-vector x s)) (defmethod print-object ((x array) s) (_print-array x s)) (defmethod print-object ((x function) s) (_print-function x s)) (defmethod print-object ((x pathname) s) (cond (*print-readably* (_print-pathname x s)) (t (write-string "#P" s) (write (namestring x) :stream s))) x) (defmethod print-object ((x hash-table) s) (_print-hash-table x s) x) (defun print-structure (structure stream) (let* ((name (type-of structure)) (class (get name 'CLOS::CLOSCLASS))) (if class (let ((readable (clos::class-kconstructor class))) (write-string (if readable "#S(" "#<") stream) (prin1 name stream) (dolist (slot (clos:class-slots class)) (write-char #\space stream) (prin1 (intern (symbol-name (clos:slot-definition-name slot)) *KEYWORD-PACKAGE*) stream) (write-char #\space stream) (prin1 (%structure-ref name structure (clos:slot-definition-location slot)) stream)) (write-string (if readable ")" ">") stream)) (print-unreadable-object (structure stream :type t) (do ((l (%record-length structure)) (i 1 (1+ i))) ((>= i l)) (write-char #\space stream) (prin1 (%structure-ref name structure i) stream)))))) #|!!!R (defun print-structure (structure stream) (let* ((name (type-of structure)) (description (get name 'DEFSTRUCT-DESCRIPTION))) (if description (let ((readable (svref description 2))) (write-string (if readable "#S(" "#<") stream) (prin1 name stream) (dolist (slot (svref description 3)) (cond ((not (simple-vector-p slot)) (err)) ((svref slot 0) (let ((obj (svref slot 0))) (write-char #\space stream) (prin1 (intern (symbol-name obj) *KEYWORD-PACKAGE*) stream) (write-char #\space stream) (prin1 (%structure-ref name structure (svref slot 2)) stream))))) (write-string (if readable ")" ">") stream) ) (progn (write-string "#<" stream) (prin1 name stream) (do ((l (%record-length structure)) (i 1 (1+ i))) ((>= i l)) (write-char #\space stream) (prin1 (%structure-ref name structure i) stream) ) (write-string ">" stream))))) |#
5,619
Common Lisp
.lisp
122
39.655738
240
0.547685
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
449bd781b2ac7547bd3eb982dc2445f42da6ac70e905fd11f9c566fcbc236708
11,414
[ -1 ]
11,415
clisp.lisp
ufasoft_lisp/src/lisp/code/clisp.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "SYS") (setq *print-pretty-fill* nil) (defvar *internal-compiled-file-type* "fas") (defvar custom:*compiled-file-types* (list *internal-compiled-file-type*)) (defvar *endless-loop-code* #12Y(00 00 00 00 00 00 00 00 11 16 1B 7E)) (defvar *constant-initfunction-code* #13Y(00 00 00 00 00 00 00 00 00 01 C5 19 01)) (defun make-constant-initfunction (x) (%make-closure 'constant-initfunction *constant-initfunction-code* (list x) nil nil nil)) (defun constant-initfunction-p (x) (and (closurep x) (compiled-function-p x) (eq (closure-name x) 'constant-initfunction) (eq (closure-codevec x) *constant-initfunction-code*))) (defun %compiled-function-p (x) (or (compiled-function-p x) (clos::funcallable-instance-p x))) (defun make-closure (&key name code constants seclass lambda-list documentation jitc-p) (declare (ignore jitc-p)) (sys::%make-closure name (sys::make-code-vector code) constants seclass lambda-list documentation)) (%putd 'quit #'exit) (defun current-language () 'ENGLISH) (defun elastic-newline (&optional stm) (terpri stm)) ;!!!TODO (defun function-block-name (funname) (if (atom funname) funname (second funname))) (defun package-case-inverted-p (p) (declare (ignore p)) nil) (defun package-case-sensitive-p (p) (declare (ignore p)) nil) (defun lib-directory () (pathname ".\\")) (defun write-spaces (n &optional stm) (dotimes (i n nil) (princ #\Space stm))) (defun symbol-stream (sym &optional dir) (declare (ignore dir)) (symbol-value sym)) (defun function-lambda-expression (obj) (setq obj (coerce obj 'function)) (cond #+FFI ((eq (type-of obj) 'FFI::FOREIGN-FUNCTION) (values nil nil (sys::%record-ref obj 0))) ((sys::subr-info obj) (values nil nil (sys::subr-info obj))) ((compiled-function-p obj) ; compiled closure? (let* ((name (sys::%record-ref obj 0)) (def (get name 'sys::definition))) (values (when def (cons 'LAMBDA (cddar def))) t name))) ((sys::closurep obj) ; interpreted closure? (values (cons 'LAMBDA (sys::%record-ref obj 1)) ; lambda-expression without docstring (vector ; environment (sys::%record-ref obj 4) ; venv (sys::%record-ref obj 5) ; fenv (sys::%record-ref obj 6) ; benv (sys::%record-ref obj 7) ; genv (sys::%record-ref obj 8)); denv (sys::%record-ref obj 0))))) ; name (defun decimal-string (n) (write-to-string n :base 10 :radix nil)) (defvar *prin-indentation*) (defvar *prin-linelength* 79) (defun format-tab (stream colon-modifier atsign-modifier &optional colnum colinc) (setq colnum (or colnum 1)) (setq colinc (or colinc 1)) (let* ((new-colnum (+ (max colnum 0) (if (and colon-modifier (boundp '*prin-indentation*)) *prin-indentation* 0))) (new-colinc (max colinc 1)) ; >0 (pos (sys::line-position stream))) ; actual position, fixnum>=0 or NIL (if atsign-modifier (+ new-colnum (if pos (mod (- (+ pos new-colnum)) new-colinc) 0)) (if pos (if (< pos new-colnum) (- new-colnum pos) (+ colinc (mod (- new-colnum pos) (- new-colinc)))) 2)))) (defun string-both-trim (character-bag-left character-bag-right string invertp) (declare (ignore invertp)) (let ((l (length string))) (do ((i 0 (1+ i))) (nil) (when (or (= i l) (not (find (char string i) character-bag-left))) (do ((j l (1- j))) (nil) (when (or (= i j) (not (find (char string (1- j)) character-bag-right))) (return-from string-both-trim (_rev-list-to-string (let ((r)) (dotimes (k (- j i) r) (push (char string (+ i k)) r))))))))))) (defvar *current-source-file* nil) (defvar *toplevel-denv* nil) (defun function-side-effect (fun) (declare (ignore fun)) '(T T T)) ;;;!!! '(T . T)) (defun symbol-value-lock (s) (declare (ignore s)) nil) (defun string-width (s) (length s)) (defun maplap (fun &rest rest) (apply #'append (apply #'maplist fun rest))) (defun mapcap (fun &rest lists) (apply #'append (apply #'mapcar fun lists))) (defun concat-pnames (obj1 obj2) (let ((str (ext:string-concat (string obj1) (string obj2)))) (if (and (plusp (length str)) (eql (char str 0) #\:)) (intern (subseq str 1) *keyword-package*) (intern str)))) (defun check-function-name (funname caller) (do () ((function-name-p funname) funname) (setq funname (check-value nil (coerce-to-condition (TEXT "~s: ~s is not a function name") (list caller funname) 'check-function-name 'simple-source-program-error))))) (defun %defclcs (conds) (setq *_conds* conds)) (defun convert-simple-condition (c) (let ((e (find c *_conds* :test #'eq :key #'car))) (if e (cdr e) c))) (defun %defgray (v) (setq <fundamental-stream> (svref v 0) <fundamental-input-stream> (svref v 1) <fundamental-output-stream> (svref v 2))) (defvar *recursive-error-count* 0) (defun NOTE-NEW-STRUCTURE-CLASS () ) (defun NOTE-NEW-STANDARD-CLASS () ) (defun %copy-simple-vector (v) (copy-seq v)) (defun random-posfixnum () (random (1+ most-positive-fixnum))) (defvar *documentation* (make-hash-table :test 'eq :size 1000)) (defun argv () (concatenate 'vector *args*)) (defun encodingp (i) (declare (ignore i)) nil) (defun base-char-p (ch) (and (characterp ch) (< (char-code ch) 256))) (defun sys::double-float-p (x) (floatp x)) (defun sys::long-float-p (x) (floatp x)) (defun sys::short-float-p (x) (floatp x)) (defun sys::single-float-p (x) (floatp x)) (defun stream-element-type (s) (built-in-stream-element-type s)) (defun sequencep (x) (or (listp x) (vectorp x))) #|!!!R (defmacro do-external-symbols ((var &optional (pack '*package*) res) &body body) ; redefined in defs.lisp `(dolist (,var (_get-external-symbols (_get-package ,pack)) ,res) ,@body)) |# (defmacro do-external-symbols ((var &optional (pack '*package*) res) &body body) ; redefined in defs.lisp `(progn (map-external-symbols (lambda (,var) ,@body) ,pack) ,res)) (defun ext:re-export (from to) (do-external-symbols (sym from) (import sym to) (export sym to))) (defun package-shortest-name (p &aux (r (package-name p))) (dolist (n (package-nicknames p) r) (when (< (length n) (length r)) (setq r n)))) (defmacro destructuring-bind (&whole whole-form lambdalist form &body body) (multiple-value-bind (body-rest declarations) (system::parse-body body) (if declarations (setq declarations `((DECLARE ,@declarations)))) (let ((%whole-form whole-form) (%proper-list-p nil) (%arg-count 0) (%min-args 0) (%restp nil) (%let-list nil) (%keyword-tests nil) (%default-form nil)) (analyze1 lambdalist '<DESTRUCTURING-FORM> 'destructuring-bind '<DESTRUCTURING-FORM>) (let ((lengthtest (make-length-test '<DESTRUCTURING-FORM> 0)) (mainform `(LET* ,(nreverse %let-list) ,@declarations ,@(nreverse %keyword-tests) ,@body-rest )) ) (if lengthtest (setq mainform `(IF ,lengthtest (DESTRUCTURING-ERROR <DESTRUCTURING-FORM> '(,%min-args . ,(if %restp nil %arg-count)) ) ,mainform ) ) ) `(LET ((<DESTRUCTURING-FORM> ,form)) ,mainform) ) ) ) ) #| (defmacro destructuring-bind (lam exp &rest forms) `(let* ((_args ,exp) ,@(_macro-lam-list lam '_args)) ,@forms)) |# (defvar custom:*suppress-check-redefinition* t) (defun sys::preliminary-p (name) (and (consp name) (eq (car name) 'ext:preliminary))) (defun sys::fbound-string (sym) (cond ((special-operator-p sym) (TEXT "special operator")) ((macro-function sym) (if (not (and (sys::closurep (macro-function sym)) (sys::preliminary-p (sys::closure-name (macro-function sym))))) (TEXT "macro") nil)) ((fboundp sym) (if (not (and (sys::closurep (symbol-function sym)) (sys::preliminary-p (sys::closure-name (symbol-function sym))))) (TEXT "function") nil)))) (defun sys::check-redefinition (symbol caller what) (let ((cur-file *current-source-file*) ;; distinguish between undefined and defined at top-level (old-file (getf (gethash symbol *documentation*) 'sys::file))) (unless (or custom:*suppress-check-redefinition* (equalp old-file cur-file) (and (pathnamep old-file) (pathnamep cur-file) (equal (pathname-name old-file) (pathname-name cur-file)))) (sys::check-package-lock caller (cond ((atom symbol) (symbol-package symbol)) ((function-name-p symbol) (symbol-package (second symbol))) ((mapcar #'(lambda (obj) ; handle (setf NAME) and (eql NAME) (let ((oo (if (atom obj) obj (second obj)))) (when (symbolp oo) (symbol-package oo)))) symbol))) symbol) (when what ; when not yet defined, `what' is NIL (warn (TEXT "~a: redefining ~a ~s in ~a, was defined in ~a") caller what symbol (or cur-file "top-level") (or old-file "top-level"))) (system::%set-documentation symbol 'sys::file cur-file)))) (import 'mapcap 'ext) (export 'mapcap 'ext) (defun allow-read-eval (stm x) (declare (ignore stm x)) t) (defun report-one-new-value-string () (TEXT "You may input a new value for ~S.")) (defun report-no-new-value-string () (TEXT "Retry")) (defun report-new-values-string () (TEXT "You may input new values for ~S.")) (defun CLOSURE-SET-SECLASS (clos seclass) (declare (ignore clos)) seclass) (defun %find-package (name) (or (find-package name) (err))) (defun package-lock (&rest r) (declare (ignore r)) ) (defun |(SETF PACKAGE-LOCK)| (&rest r) (declare (ignore r)) ) (defun add-backquote (skel) (list 'BACKQUOTE skel)) (defun add-unquote (skel) (list 'UNQUOTE skel)) #|!!! (in-package "EXT") (export '(fcase)) (in-package "SYSTEM") (defmacro fcase (test keyform &body clauses) (case-expand 'fcase test keyform clauses)) |# (in-package "CLOS") (defun typep-class (x c) (subclassp (class-of x) c)) (let ((clos-extra '(generic-flet generic-labels no-primary-method class-prototype class-finalized-p finalize-inheritance))) ;; not in ANSI - export separately, after `re-export' above (export clos-extra "CLOS") ;; so that they are available in CL-USER even though it does not use CLOS (import clos-extra "EXT") (export clos-extra "EXT")) ;(load "defseq") (in-package "SYS") (PROGN (sys::%putd 'defmacro (sys::%putd 'sys::predefmacro ; predefmacro means "preliminary defmacro" (sys::make-macro (function defmacro (lambda (form env) (declare (ignore env)) (let ((preliminaryp (eq (car form) 'sys::predefmacro))) (multiple-value-bind (expansion expansion-lambdabody name lambdalist docstring) (sys::make-macro-expansion (cdr form) form) (declare (ignore expansion-lambdabody lambdalist)) `(LET () (EVAL-WHEN ,(if preliminaryp '(LOAD EVAL) '(COMPILE LOAD EVAL)) (SYSTEM::REMOVE-OLD-DEFINITIONS ',name ,@(if preliminaryp '('T))) ,@(if docstring `((SYSTEM::%SET-DOCUMENTATION ',name 'FUNCTION ',docstring)) '()) (SYSTEM::%PUTD ',name (SYSTEM::MAKE-MACRO ,(if preliminaryp `(SYSTEM::MAKE-PRELIMINARY ,expansion) expansion)))) (EVAL-WHEN (EVAL) (SYSTEM::%PUT ',name 'SYSTEM::DEFINITION (CONS ',form (THE-ENVIRONMENT)))) ',name)))))))) #-compiler (predefmacro COMPILER::EVAL-WHEN-COMPILE (&body body) ; preliminary `(eval-when (compile) ,@body)) ;; return 2 values: ordinary lambda list and reversed list of type declarations (sys::%putd 'sys::specialized-lambda-list-to-ordinary (function sys::specialized-lambda-list-to-ordinary (lambda (spelalist caller) (multiple-value-bind (lalist speclist) #+clos (clos::decompose-specialized-lambda-list spelalist (clos::program-error-reporter caller)) #-clos (copy-list spelalist) ; pacify "make check-recompile" (values lalist ; MAPCAN needs a LAMBDA which leads to infinite recursion (let ((decls '())) (block spelalist-to-ordinary (tagbody start (when (null lalist) (return-from spelalist-to-ordinary decls)) (when (null speclist) (return-from spelalist-to-ordinary decls)) (let ((arg (car lalist)) (spec (car speclist))) (if (not (eq spec 'T)) (setq decls (cons (list spec arg) decls)))) (setq lalist (cdr lalist) speclist (cdr speclist)) (go start))))))))) (sys::%putd 'defun (sys::%putd 'sys::predefun ; predefun means "preliminary defun" (sys::make-macro (function defun (lambda (form env) (if (atom (cdr form)) (error-of-type 'source-program-error :form form :detail (cdr form) (TEXT "~S: cannot define a function from that: ~S") (car form) (cdr form))) (unless (function-name-p (cadr form)) (error-of-type 'source-program-error :form form :detail (cadr form) (TEXT "~S: the name of a function must be a symbol, not ~S") (car form) (cadr form))) (if (atom (cddr form)) (error-of-type 'source-program-error :form form :detail (cddr form) (TEXT "~S: function ~S is missing a lambda list") (car form) (cadr form))) (let ((preliminaryp (eq (car form) 'sys::predefun)) (name (cadr form)) (lambdalist (caddr form)) (body (cdddr form))) (multiple-value-bind (body-rest declarations docstring) (sys::parse-body body t) (when *defun-accept-specialized-lambda-list* (multiple-value-bind (lalist decl-list) (sys::specialized-lambda-list-to-ordinary lambdalist (car form)) (setq lambdalist lalist declarations (nreconc decl-list declarations)))) (let ((symbolform (if (atom name) `',name `(LOAD-TIME-VALUE (GET-SETF-SYMBOL ',(second name))))) (lambdabody `(,lambdalist ,@(if docstring `(,docstring) '()) (DECLARE (SYS::IN-DEFUN ,name) ,@declarations) (BLOCK ,(function-block-name name) ,@body-rest)))) `(LET () (SYSTEM::REMOVE-OLD-DEFINITIONS ,symbolform ,@(if preliminaryp '('T))) ,@(if ; Is name declared inline? (if (and compiler::*compiling* compiler::*compiling-from-file*) (member name compiler::*inline-functions* :test #'equal) (eq (get (get-funname-symbol name) 'inlinable) 'inline)) ;; Is the lexical environment the top-level environment? ;; If yes, save the lambdabody for inline compilation. (if compiler::*compiling* (if (and (null compiler::*venv*) (null compiler::*fenv*) (null compiler::*benv*) (null compiler::*genv*) (eql compiler::*denv* *toplevel-denv*)) `((COMPILER::EVAL-WHEN-COMPILE (COMPILER::C-DEFUN ',name (lambda-list-to-signature ',lambdalist) ',lambdabody)) (EVAL-WHEN (LOAD) (SYSTEM::%PUT ,symbolform 'SYSTEM::INLINE-EXPANSION ',lambdabody))) `((COMPILER::EVAL-WHEN-COMPILE (COMPILER::C-DEFUN ',name (lambda-list-to-signature ',lambdalist))))) (if (and (null (svref env 0)) ; venv (null (svref env 1))) ; fenv `((EVAL-WHEN (EVAL) (LET ((%ENV (THE-ENVIRONMENT))) (IF (AND (NULL (SVREF %ENV 0)) ; venv (NULL (SVREF %ENV 1)) ; fenv (NULL (SVREF %ENV 2)) ; benv (NULL (SVREF %ENV 3)) ; genv (EQL (SVREF %ENV 4) *TOPLEVEL-DENV*)) ; denv (SYSTEM::%PUT ,symbolform 'SYSTEM::INLINE-EXPANSION ',lambdabody))))) '())) `((COMPILER::EVAL-WHEN-COMPILE (COMPILER::C-DEFUN ',name (lambda-list-to-signature ',lambdalist))))) ,@(if docstring `((SYSTEM::%SET-DOCUMENTATION ,symbolform 'FUNCTION ',docstring)) '()) (SYSTEM::%PUTD ,symbolform ,(if preliminaryp `(SYSTEM::MAKE-PRELIMINARY (FUNCTION ,name (LAMBDA ,@lambdabody))) `(FUNCTION ,name (LAMBDA ,@lambdabody)))) (EVAL-WHEN (EVAL) (SYSTEM::%PUT ,symbolform 'SYSTEM::DEFINITION (CONS ',form (THE-ENVIRONMENT)))) ',name))))))))) (VALUES) ) (defun make-logical-pathname (&rest r) (apply #'make-pathname :logical t r)) (load "macros1") (load "macros2") (load "defs1") (LOAD "lambdalist") ; parsing ordinary lambda lists (defun _to-keyword (s) (intern (symbol-name s) *keyword-package*)) (remove-old-definitions 'push) (remove-old-definitions 'incf) (remove-old-definitions 'setf) (LOAD "places") (defun vector-push (x v) (let ((fp (fill-pointer v))) (unless (eql fp (array-total-size v)) (setf (aref v fp) x) (setf (fill-pointer v) (1+ fp)) fp))) (defun vector-pop (v) (aref v (decf (fill-pointer v)))) #|!!!P (defun (setf get) (v s i) (setf (getf (symbol-plist s) i) v)) |# (defun %set-documentation (symbol doctype value) (if value (setf (getf (gethash symbol *documentation*) doctype) value) (multiple-value-bind (rec found-p) (gethash symbol *documentation*) (when (and found-p (remf rec doctype) (null rec)) (remhash symbol *documentation*))))) (LOAD "defpackage") (defun bytep (b) (listp b)) (defun random-state-p (x) ; redefined later in (defstruct random-state... (typep x 'random-state)) (load "type") ;(deftype simple-string (&optional size) ; `(simple-array string-char (,size))) (load "byte") ;(when (memq :NO-HUGE *features*) ; (pushnew :NO-CLOS *features*) ; (pushnew :NO-COMPILER *features*)) (defun _read-sequence (fun seq stm start end) (setq end (_end end seq)) (do* ((td (_get-valid-seq-type seq)) (aset (_seq-access_set td)) (u (_seq-upd td)) (p (funcall (_seq-init_start td) seq start) (funcall u seq p)) (i start (1+ i))) ((>= i end) i) (let ((a (funcall fun stm nil nil))) (if a (funcall aset seq p a) (return i))))) (defun read-char-sequence (seq stm &key (start 0) end) (funcall #'_read-sequence #'read-char seq stm start end)) (defun read-byte-sequence (seq stm &key (start 0) end) (funcall #'_read-sequence #'read-byte seq stm start end)) (defun write-char-sequence (seq stm &key (start 0) end) (write-string (coerce (subseq seq start end) 'string) stm) seq) (defun make-weak-list (x) (let ((wl (%make-structure '(weak-list) 2))) (%record-store wl 1 (mapcar #'make-weak-pointer x)) wl)) (defun weak-list-p (x) (%structure-type-p 'weak-list x)) (defun weak-list-list (wl) (unless (weak-list-p wl) (err)) (mapcan #'(lambda (x) (multiple-value-bind (v p) (weak-pointer-value x) (if p (list v)))) (%record-ref wl 1))) (defun (setf weak-list-list) (v wl) (unless (weak-list-p wl) (err)) (%record-store wl 1 (mapcar #'make-weak-pointer v)) v) ;---------------------------------- (unless (memq :NO-CLOS *features*) (load "uclos") (LOAD "clos-package") ; Early CLOS (LOAD "clos-macros") (LOAD "clos-class0") (LOAD "clos-metaobject1") (LOAD "clos-slotdef1") (LOAD "clos-stablehash1") (LOAD "clos-specializer1") (LOAD "clos-class1") (LOAD "clos-class2") (LOAD "clos-class3") ;!!! Patched (LOAD "defstruct") ; DEFSTRUCT-macro (LOAD "format") ; FORMAT (load "international") (LOAD "functions") ; function objects ; (LOAD "trace") ; TRACE (load "cmacros") #-LOAD_COMPILER_FAS (unless (memq :NO-COMPILER *features*) (load "compiler")) #+LOAD_COMPILER_FAS (progn (load (merge-pathnames "compiler.fas" (car *args*))) (setq *features* (remove :LOAD_COMPILER_FAS *features*)) ) (LOAD "defs2") ; CLtL2-definitions, optional ; (LOAD "loop") ; CLtL2/ANSI-CL-LOOP, optional (LOAD "clos") ; CLOS ) (load "backquote") ;!!! (defstruct (random-state (:constructor _make-random-state)) data) (when (memq :NO-HUGE *features*) (defun warn-of-type (type format-string &rest args) (declare (ignore format-string args)) (warn type))) (LOAD "loop") ; CLtL2/ANSI-CL-LOOP, optional (unless (memq :NO-HUGE *features*) (fmakunbound 'close) (fmakunbound 'stream-element-type) (LOAD "gray") ; STREAM-DEFINITION-BY-USER:GENERIC-FUNCTIONS ; FILL-OUTPUT-STREAM (for condition & describe) (LOAD "disassem")) ; Disassembler (LOAD "fill-out") ; required by "condition" (LOAD "condition") ; Conditions (define-condition stack-overflow-error (control-error) ()) (defvar *stack-overflow-instance* (make-condition 'ext::stack-overflow-error)) ; // to make nex create simpler (defun invoke-debugger (c) (if *debugger-hook* (let ((h *debugger-hook*) (*debugger-hook* nil)) (funcall h c h))) (funcall *break-driver* nil c t) (unwind-to-driver 1)) (unless (memq :NO-HUGE *features*) ; shoul be separate from previos (progn (load... to use right symbols (load "loadform")) ; `make-load-form' (defun delta4 (n1 n2 o1 o2 shift) (- (+ (ash n1 shift) n2) (+ (ash o1 shift) o2))) #|!!! implemented in CLISP (defmacro time (form) (let ((t-real (gensym)) (t-run (gensym)) (t-gccount (gensym))) `(let ((,t-real (get-internal-real-time)) (,t-run (get-internal-run-time)) (,t-gccount (_gc-count))) (unwind-protect ,form (let ((real (- (get-internal-real-time) ,t-real)) (run (- (get-internal-run-time) ,t-run)) (gccount (- (_gc-count) ,t-gccount))) (terpri *trace-output*) (write-string "Real time: " *trace-output*) (write (float (/ real internal-time-units-per-second)) :stream *trace-output*) (write-string " sec." *trace-output*) (terpri *trace-output*) (write-string "Run time: " *trace-output*) (write (float (/ run internal-time-units-per-second)) :stream *trace-output*) (write-string " sec." *trace-output*) (terpri *trace-output*) (when (plusp gccount) (terpri *trace-output*) (write-string "GC: " *trace-output*) (write gccount :stream *trace-output*) (terpri *trace-output*))))))) |# (define-condition simple-condition () (($format-control :initarg :format-control :initform nil :reader simple-condition-format-string ; for CLtL2 backward compatibility :reader simple-condition-format-control) ($format-arguments :initarg :format-arguments :initform nil :reader simple-condition-format-arguments) ($hresult :initarg :hresult :initform nil :reader simple-condition-hresult)) ) (clos:defmethod print-object :around ((condition simple-condition) stream) (if (or *print-escape* *print-readably*) (clos:call-next-method) (let ((fstring (simple-condition-format-control condition))) (if fstring (progn (let ((hr (sys::simple-condition-hresult condition))) (if hr (format stream " fatal error L~D: " (logand 65535 hr)))) (apply #'format stream fstring (simple-condition-format-arguments condition))) (clos:call-next-method)))) condition) (defmethod print-object ((c type-error) stm) (if (or *print-escape* *print-readably*) (clos:call-next-method) (format stm "~A is not a ~A" (type-error-datum c) (type-error-expected-type c))) c) (defmethod print-object ((c stream-error) stm) (if (or *print-escape* *print-readably*) (clos:call-next-method) (let* ((stm (stream-error-stream c)) (lpos (sys::line-position stm))) (format *error-output* "~A(~A~@[,~D~]): fatal error L~D: " (namestring stm) (sys::line-number stm) lpos (logand 65535 (simple-condition-hresult c)) ) (pretty-print-condition cnd *error-output*))) c) (defun report-error (condition) (when *report-error-print-backtrace* (print-backtrace :out *error-output*)) (fresh-line *error-output*) (write-string "*** - " *error-output*) (pretty-print-condition condition *error-output*) (elastic-newline *error-output*)) (defun exitunconditionally (condition) ; ABI (if (boundp 'compiler::*error-count*) (incf compiler::*error-count*)) (report-error condition) (exit (if (typep condition 'simple-condition) (or (simple-condition-hresult condition) t) t))) ; exit Lisp with error (defun coerce-to-condition-ex (type hresult datum arguments &rest more-initargs) (let ((cnd (handler-case (apply #'make-condition type :hresult hresult :format-control datum :format-arguments arguments more-initargs) (TYPE-ERROR (error) (error error)) (ERROR (error) ;; ANSI CL wants a type error here. (error-of-type 'type-error :datum (cons datum arguments) :expected-type '(satisfies valid-condition-designator-p) "~A" error))))) (let ((*print-escape* nil) ;!!!? (*print-readably* nil)) (signal cnd) (invoke-debugger cnd)))) (defun correctable-error-ex (options type hresult datum arguments &rest more-initargs) (let ((cnd (handler-case (apply #'make-condition type :hresult hresult :format-control datum :format-arguments arguments more-initargs) (TYPE-ERROR (error) (error error)) (ERROR (error) ;; ANSI CL wants a type error here. (error-of-type 'type-error :datum (cons datum arguments) :expected-type '(satisfies valid-condition-designator-p) "~A" error))))) (correctable-error cnd options))) (defun cerror-of-type (continue-format-string type &rest arguments) (let ((keyword-arguments '())) (loop (unless (and (consp arguments) (symbolp (car arguments))) (return)) (push (pop arguments) keyword-arguments) (push (pop arguments) keyword-arguments)) (setq keyword-arguments (nreverse keyword-arguments)) (let ((error-format-string (first arguments)) (args (rest arguments))) (apply #'cerror continue-format-string (if (or *error-handler* (not *use-clcs*)) error-format-string (apply #'coerce-to-condition error-format-string args 'cerror (convert-simple-condition type) keyword-arguments)) args)))) (load "print") #+CLISP-DEBUG (defun compiler::c-style-warn (&rest r) (princ "."));!!! ;;; redefine "defs1", remove #+CLISP (defun require (module-name &optional (pathname nil p-given)) (setq module-name (module-name module-name)) (unless (member module-name *modules* :test #'string=) (unless p-given (setq pathname (pathname module-name))) (let (#+CLISP (*load-paths* *load-paths*)) (pushnew (merge-pathnames "dynmod/" *lib-directory*) *load-paths* :test #'equal) (when *load-truename* (pushnew (make-pathname :name nil :type nil :defaults *load-truename*) *load-paths* :test #'equal)) (with-augmented-load-path () (mapcar #'load (listify pathname)))))) (unless (memq :NO-HUGE *features*) (defstruct (load-time (:print-function (lambda (x s k) (declare (ignore k)) (write-string "#." s) (write (load-time-obj x) :stream s)))) obj) #| (defun _print-load-time (x s) (write-string "#." s) (write (load-time-obj x) :stream s) x) (defmethod print-object ((x load-time) s) (_print-load-time x s)) |# (defun make-load-time-eval (x) (make-load-time :obj x)) (load "pprint") (defun pprint (x &optional stm) (write x :stream stm :escape t :pretty t)) (setq *print-pretty* t) (load "describe") ;!!! (load "inspect") (definternational date-format (t ENGLISH)) (deflocalized date-format ENGLISH (formatter "~1{~5@*~D-~4@*~2,'0D-~3@*~2,'0D ~2@*~2,'0D:~1@*~2,'0D:~0@*~2,'0D~:}")) (defun date-format () (localized 'date-format)) ;;; redefine "defs1" (defun encode-universal-time (second minute hour date month year &optional tz) (when (<= 0 year 99) (incf year (* 100 (ceiling (- (nth-value 5 (get-decoded-time)) year 50) 100)))) (_encode-universal-time second minute hour date month year tz)) (defun decode-universal-time (ut &optional tz) (_decode-universal-time ut tz)) (defun get-decoded-time () (decode-universal-time (get-universal-time))) ;(dolist (x '(expand-loop formatter-main-1 format-parse-cs)) ; (_compile x)) ;!!! (clos::u-def-unbound ;!!! (sys::%record-ref (clos::allocate-std-instance clos::<standard-object> 3) 2)) ;!!! (load "condition") ;(in-package "SYS") (load "reploop") (defun commands0 () ;; To override string with "CLISP" (list* (TEXT " Help (abbreviated :h) = this list Use the usual editing capabilities. \(quit) or (exit) leaves LISP.") (cons "Help" #'debug-help) (cons ":h" #'debug-help) (wrap-user-commands *user-commands*))) (load "runprog") ) ; :NO-HUGE (setq *use-clcs* t)
34,434
Common Lisp
.lisp
764
34.818063
240
0.558321
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
dca09b77279d2f021714d1f10bf2a801210586cdba5e05e4194320bddab5f337
11,415
[ -1 ]
11,416
reader.lisp
ufasoft_lisp/src/lisp/code/reader.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "SYS") (set-dispatch-macro-character #\# #\( #'(lambda (stm ch p) (declare (ignore ch)) (let* ((x (read-delimited-list #\) stm t)) (len (length x))) (when (not *read-suppress*) (if (and p (or (> len p) (and (zerop len) (plusp p)))) (error 'reader-error)) (fill (replace (make-array (or p len)) x) (car (last x)) :start len))))) (set-dispatch-macro-character #\# #\" #'(lambda (stm ch p) ;!!! #"" (declare (ignore p)) (unread-char ch stm) (read stm t nil t))) (defun _sharp-comment (stm ch p) (declare (ignore p)) (do ((c (read-char stm t nil t) (read-char stm t nil t))) ((and (eql c ch) (eql (peek-char nil stm) #\#)) (read-char stm) (values)) (when (and (eql c #\#) (eql (peek-char nil stm) ch)) (read-char stm) (_sharp-comment stm ch nil)))) ;(set-dispatch-macro-character #\# #\| #' _sharp-comment) (set-dispatch-macro-character #\# #\S #'(lambda (stm ch p) (declare (ignore ch)) (if p (err)) (cond (*read-suppress* (read stm t nil t) nil) (t (let ((r (let* ((*reading-struct* t)) (read stm t nil t)))) (if (atom r) (err) (let ((name (car r)) (d (cdr r))) (if (not (symbolp name)) (err) (case name (hash-table (if (atom d) (err) (make-hash-table :test (car d) :initial-contents (cdr d)))) (pathname (apply #'make-pathname d)) (byte (apply #'make-byte d)) (t (let ((desc (get name 'DEFSTRUCT-DESCRIPTION))) (if (and desc (vectorp desc)) (apply (svref desc 2) d) (err))))))))))))) (set-dispatch-macro-character #\# #\C #'(lambda (stream sub-char n) (declare (ignore sub-char)) (if *read-suppress* (progn (read stream t nil t) nil) (if n (error "~: Zwischen # und C ist keine Zahl erlaubt." 'read) (let ((h (read stream t nil t))) (if (and (consp h) (consp (cdr h)) (null (cddr h)) (numberp (first h)) (not (complexp (first h))) (numberp (second h)) (not (complexp (second h))) ) (apply #'complex h) (error "~: Wrong Syntax for complex Number: #C~" 'read h) ) ) ) ) ) ) (set-dispatch-macro-character #\# #\A #'(lambda (stream sub-char n) (declare (ignore sub-char)) (if *read-suppress* (progn (read stream t nil t) nil) (if (null n) (let ((h (read stream t nil t))) (if (and (consp h) (consp (cdr h)) (consp (cddr h)) (null (cdddr h))) (make-array (second h) :element-type (first h) :initial-contents (third h)) (error "~: Wrong Syntax for Array: #A~" 'read h) ) ) (let* ((rank n) (cont (read stream t nil t)) (dims '()) (eltype 't)) (when (plusp rank) (let ((subcont cont) (i 0)) (loop (let ((l (length subcont))) (push l dims) (incf i) (when (>= i rank) (return)) (when (plusp l) (setq subcont (elt subcont 0))) ) ) (cond ((stringp subcont) (setq eltype 'character)) ((bit-vector-p subcont) (setq eltype 'bit)) ) ) ) (make-array (nreverse dims) :element-type eltype :initial-contents cont) ) ) ) ) ) (set-dispatch-macro-character #\# #\P (lambda (stream sub-char n) (declare (ignore sub-char)) (if *read-suppress* (progn (read stream t nil t) nil) (if n (error "~ of ~: no infix for #P" (quote read) stream) (let ((obj (read stream t nil t))) (if (stringp obj) (values (parse-namestring obj)) (if (listp obj) (apply (function make-pathname) obj) (error "~ of ~: Wrong Syntax for Pathname: #P~" (quote read) stream obj)))))))) (defun read-from-string (string &optional (eof-error-p t) (eof-value nil) &key (start 0) (end nil) (preserve-whitespace nil) &aux index) (values (with-input-from-string (stream string :start start :end end :index index) (funcall (if preserve-whitespace #'read-preserving-whitespace #'read) stream eof-error-p eof-value nil ) ) index ) ) #| (defvar *read-reference-table* nil) (set-dispatch-macro-character #\# #\* #'(lambda (stream sub-char n) (declare (ignore sub-char)) (let* ((token (read-token stream))) (unless *read-suppress* (unless (or [Escape-Zeichen im Token verwendet] (every #'(lambda (ch) (member ch '(#\0 #\1))) token)) (error "~ von ~: Nach #* durfen nur Nullen und Einsen kommen." 'read stream)) (let ((l (length token))) (if n (cond ((< n l) (error "~ von ~: Bit-Vektor langer als angegebene Lange ~." 'read stream n)) ((and (plusp n) (zerop l)) (error "~ von ~: Element fur Bit-Vektor der Lange ~ muss spezifiziert werden." 'read stream n))) (setq n l)) (let ((bv (make-array n :element-type 'bit)) (i 0) b) (loop (when (= i n) (return)) (when (< i l) (setq b (case (char token i) (#\0 0) (#\1 1)))) (setf (sbit bv i) b) (incf i)) bv)))))) |# (defun _sharp-r (stm ch p) (cond (*read-suppress* (read stm t nil t) nil) ((not p) (err)) ((not (<= 2 p 36)) (err)) (t (let ((res (let ((*read-base* p)) (read stm t nil t)))) (unless (typep res 'rational) (error stm "#~A (base ~D) value is not a rational: ~S." ch p res)) res)))) (set-dispatch-macro-character #\# #\R #'_sharp-r) (set-dispatch-macro-character #\# #\B #'(lambda (stm ch p) (declare (ignore p)) (_sharp-r stm ch 2))) (set-dispatch-macro-character #\# #\O #'(lambda (stm ch p) (declare (ignore p)) (_sharp-r stm ch 8))) (set-dispatch-macro-character #\# #\X #'(lambda (stm ch p) (declare (ignore p)) (_sharp-r stm ch 16))) #| (set-dispatch-macro-character #\# #\Y #'(lambda (stm ch p) (if p (err)) (cond (*read-suppress* (read stm t nil t) nil) (t (let ((x (read stm t nil t))) (%make-closure (car x) (make-code-vector (cadr x)) (caddr x) nil)))))) |# (copy-readtable nil *_standard-readtable*)
8,807
Common Lisp
.lisp
176
36.846591
240
0.451132
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
3904996d708f76b80619f333029edb8adfcef534db2bdb19e8fda4e2a79992a9
11,416
[ -1 ]
11,417
pathname.lisp
ufasoft_lisp/src/lisp/code/pathname.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "SYS") (defun logical-pathname (x) (typecase x (logical-pathname x) (pathname (error 'type-error :datum x :expected-type '(or logical-pathname stream string))) (synonym-stream (logical-pathname (symbol-value (synonym-stream-symbol x)))) (stream (let ((pn (pathname x))) (unless (logical-pathname-p pn) (error 'type-error :datum x :expected-type '(or logical-pathname stream string))) pn)) (t #+COMPILER (handler-case (parse-namestring x nil _*empty-logical-pathname*) (parse-error (c) (error 'type-error :datum x))) #-COMPILER (parse-namestring x nil _*empty-logical-pathname*) ))) (defun _equal-pathchar (x y) (if (member :win32 *features*) (char-equal x y) (char= x y))) (defun _trivial-p (x) (or (null x) (stringp x))) (defun _simple-p (x) (or (null x) (stringp x) (eq x :wild))) (defun _host-match (p s) (or (null p) (equal p s))) (defun _host-diff (p s) (if p (list :host) (list s))) (defvar _*subst*) (defun _translate-host (p) (let ((a (car _*subst*))) (if (or (null p) (eq a :host)) (pop _*subst*)) (or p (and (_trivial-p a) a)))) (defun _device-match (p s) (cond ((or (null p) (eq p :wild)) t) ((eq s :wild) nil) (t (if (member :win32 *features*) (equalp p s) (equal p s))))) (defun _wild-to-string (x) (if (eq x :wild) "*" x)) (defun _device-diff (p s) (cond ((or (null p) (eq p :wild)) (list (_wild-to-string s))) (t (list :device)))) (defun _translate-device (p) (let ((a (car _*subst*))) (if (or (null p) (eq a :device)) (pop _*subst*)) (or p (and (_trivial-p a) a)))) (defun _wildcard-match-ab (m i b j) (let ((mc (length m)) (bc (length b)) c) (loop (if (eql i mc) (return-from _wildcard-match-ab (eql j bc))) (setq c (char m (prog1 i (incf i)))) (cond ((eql c #\?) (if (eql j bc) (return-from _wildcard-match-ab nil) (incf j))) ((eql c #\*) (return)) ((eql j bc) (return-from _wildcard-match-ab nil)) (t (unless (_equal-pathchar c (char b (prog1 j (incf j)))) (return-from _wildcard-match-ab nil))))) (loop (if (eql i mc) (return-from _wildcard-match-ab t)) (setq c (char m (prog1 i (incf i)))) (cond ((eql c #\?) (if (zerop bc) (return-from _wildcard-match-ab nil) (incf j))) ((not (eql c #\*)) (return)))) (loop (if (eql j bc) (return-from _wildcard-match-ab nil)) (and (_equal-pathchar c (char b (prog1 j (incf j)))) (_wildcard-match-ab m i b j) (return-from _wildcard-match-ab t))))) (defun _wildcard-match (p s) (case p ((:wild :wild-inferiors) t) ((:up :back) nil) (t (_wildcard-match-ab p 0 s 0)))) (defun _subdir-match (p s) (or (eq p s) (eq p :wild) (and (stringp p) (stringp s) (_wildcard-match p s)))) (defun _directory-match-ab (m b &aux item) (loop (if (atom m) (return-from _directory-match-ab (atom b))) (setq item (pop m)) (if (eq item :wild-inferiors) (return)) (if (or (atom b) (not (_subdir-match item (pop b)))) (return-from _directory-match-ab nil))) (loop (if (atom m) (return-from _directory-match-ab t)) (setq item (pop m)) (if (not (eq item :wild-inferiors)) (return))) (loop (if (atom b) (return-from _directory-match-ab nil)) (if (and (_subdir-match item (pop b)) (_directory-match-ab m b)) (return-from _directory-match-ab t)))) (defun _directory-match (p s) (cond ((or (null p) (null s) (eq s :unspecific)) t) ((not (eq (car p) (car s))) nil) (t (_directory-match-ab (cdr p) (cdr s))))) (defun _uni-diff (p s wild wild-inferiors sub-diff conv &optional r) (do* ((qi 0) (si 0) (plen (length p)) (slen (length s)) c) ((eql qi plen) (if (eql si slen) r (error "Sequences don't match"))) (setq c (elt p qi)) (incf qi) (cond ((eql c wild-inferiors) (if (> (- plen qi) (- slen si)) (error "Sequences don't match")) (push (subseq s si (setq si (- slen (- plen qi)))) r)) ((eql si slen) (error "Sequences don't match")) (t (let ((d (elt s si))) (incf si) (if (eql c wild) (push (conv d) r) (setq r (funcall sub-diff c d r)))))))) (defun _directory-diff-ab (p s) (let ((r (_uni-diff p s :wild :wild-inferiors #'_nametype-diff #'identity))) (mapcar (lambda (x) (if (consp x) (cons :directory x) x)) r))) (defun _directory-diff (p s) (cond ((null s) (list p)) ((or (null p) (equal p '(:relative))) (list s)) (t (_directory-diff-ab (cdr p) (cdr s))))) (defun _translate-nametype-aux (p) (cond ((and (eq p :wild) (consp _*subst*)) (let ((a (car _*subst*))) (if (or (null a) (stringp a)) (pop _*subst*)))) ((stringp p) (do* ((i 0 (1+ i)) (len (length p)) r) ((progn (push (subseq p i (setq i (or (position #\* p :start i) len))) r) (eql i len)) (apply #'ext:string-concat (reverse r))) (if (or (null (car _*subst*)) (stringp (null (car _*subst*)))) (push (pop _*subst*) r) (return-from _translate-nametype-aux nil)))) (t p))) (defun _translate-directory (p) (cond ((null p) (let ((a (pop _*subst*))) (if (listp a) (copy-list a)))) ((and (eq (car p) :absolute) (or (null (car _*subst*)) (equal (car _*subst*) '(:relative)))) (pop _*subst*) (copy-list p)) (t (let ((r (list (pop p)))) (dolist (x p (reverse r)) (if (eq x :wild-inferiors) (if (eq (caar _*subst*) :directory) (setq r (append (reverse (cdr (pop _*subst*))) r)) (return-from _translate-directory)) (let ((item (_translate-nametype-aux x))) (if item (push item r) (return-from _translate-directory))))))))) (defun _nametype-match (p s) (cond ((or (null p) (eq p :unspecific) (eq p :wild)) t) ((or (null s) (eq s :wild)) nil) (t (_wildcard-match p s)))) (defun _nametype-diff (p s &optional r) (if (or (null p) (eq p :wild)) (list s) (_uni-diff p s #\? #\* (lambda (a b r) (if (_equal-pathchar a b) r (error "Sequences don't match"))) #'string r))) (defun _translate-nametype (p) (if (and (null p) _*subst*) (and (_simple-p (car _*subst*)) (pop _*subst*)) (_translate-nametype-aux p))) (defun _version-match (p s) (cond ((or (eq s :unspecific) (null p) (eq p :wild)) t) ((eq s :wild) nil) (t (eql p s)))) (defun _version-diff (p s) (cond ((or (null p) (eq p :wild)) (list s)) (t (list :version)))) (defun _translate-version (p) (cond ((and _*subst* (or (null p) (eq p :wild))) (let ((a (pop _*subst*))) (if (or (null a) (integerp a) (eq a :wild) (eq a :newest) (eq a :unspecific)) a))) (t p))) (defun pathname-match-p (pathname wildcard) (setq pathname (pathname pathname) wildcard (pathname wildcard)) (and (_host-match (pathname-host wildcard) (pathname-host pathname)) (_device-match (pathname-device wildcard) (pathname-device pathname)) (_directory-match (pathname-directory wildcard) (pathname-directory pathname)) (_nametype-match (pathname-name wildcard) (pathname-name pathname)) (_nametype-match (pathname-type wildcard) (pathname-type pathname)) (_version-match (pathname-version wildcard) (pathname-version pathname)))) (defun _translate-component (fun keyword pattern) (let ((r (funcall fun pattern))) (cond (r (list keyword r)) ((eq keyword :host) nil) (t (error "Replacement pieces don't fit onto ~S" pattern))))) (defun translate-pathname (source from-wildcard to-wildcard &key) (setq source (pathname source) from-wildcard (pathname from-wildcard) to-wildcard (pathname to-wildcard)) (unless (pathname-match-p source from-wildcard) (error 'type-error :datum source)) (let* ((host (reverse (_host-diff (pathname-host from-wildcard) (pathname-host source) ))) (device (reverse (_device-diff (pathname-device from-wildcard) (pathname-device source) ))) (directory (reverse (_directory-diff (pathname-directory from-wildcard) (pathname-directory source) ))) (name (reverse (_nametype-diff (pathname-name from-wildcard) (pathname-name source) ))) (type (reverse (_nametype-diff (pathname-type from-wildcard) (pathname-type source) ))) (version (reverse (_version-diff (pathname-version from-wildcard) (pathname-version source) ))) (logical (logical-pathname-p to-wildcard)) (_*subst* (append host device directory name type version))) (apply #'make-pathname (append (list :logical logical) (_translate-component #'_translate-host :host (pathname-host to-wildcard)) (unless logical (_translate-component #'_translate-device :device (pathname-device to-wildcard))) (_translate-component #'_translate-directory :directory (pathname-directory to-wildcard)) (_translate-component #'_translate-nametype :name (pathname-name to-wildcard)) (_translate-component #'_translate-nametype :type (pathname-type to-wildcard)) (_translate-component #'_translate-version :version (pathname-version to-wildcard)))))) (defun translate-logical-pathname (pathname &key) (setq pathname (if (stringp pathname) (logical-pathname pathname) (pathname pathname))) (if (logical-pathname-p pathname) (let ((ht (make-hash-table :key-type 'logical-pathname :value-type '(eql t) :test #'equal))) (loop (when (gethash pathname ht) (error "Translation loop")) (setf (gethash pathname ht) t) (let ((host (or (pathname-host pathname) "SYS"))) (unless (logical-host-p host) (error "No translation for host")) (let* ((translations (gethash host sys::*logical-pathname-translations*)) (translation (assoc pathname translations :test #'pathname-match-p))) (unless (and translation (consp translation) (consp (cdr translation))) (error "No translation for pathname")) (setq pathname (translate-pathname pathname (first translation) (second translation))))) (unless (logical-pathname-p pathname) (return))))) pathname) (defun enough-namestring (pathname &optional (defaults *default-pathname-defaults*)) (setq pathname (pathname pathname)) (setq defaults (pathname defaults)) (namestring (multiple-value-call #'make-pathname (if (equal (pathname-device pathname) (pathname-device defaults)) (values :device nil :directory (let ((pathname-dir (pathname-directory pathname)) (defaults-dir (pathname-directory defaults))) (if (equal pathname-dir defaults-dir) (list ':RELATIVE) (if (and (not (eq (car pathname-dir) ':RELATIVE)) (not (eq (car defaults-dir) ':RELATIVE)) (equal (subseq pathname-dir 0 (min (length pathname-dir) (length defaults-dir))) defaults-dir ) ) (cons ':RELATIVE (nthcdr (length defaults-dir) pathname-dir)) pathname-dir ) ) ) ) (values :device (pathname-device pathname) :directory (pathname-directory pathname))) :name (if (equal (pathname-name pathname) (pathname-name defaults)) nil (pathname-name pathname)) :type (if (equal (pathname-type pathname) (pathname-type defaults)) nil (pathname-type pathname)))))
14,211
Common Lisp
.lisp
309
36.724919
240
0.530407
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
afde89b0946494554808747abe241354dcc1b3b2d351fc33896a3e52aa38b269
11,417
[ -1 ]
11,418
clos-class3.lisp
ufasoft_lisp/src/lisp/code/clos-class3.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# ;;;; Common Lisp Object System for CLISP ;;;; Class metaobjects ;;;; Part 3: Class definition and redefinition. ;;;; Bruno Haible 21.8.1993 - 2004 ;;;; Sam Steingold 1998 - 2008 ;;;; German comments translated into English: Stefan Kain 2002-04-08 (in-package "CLOS") ;; Wipe out all traces of an earlier loaded CLOS. (eval-when (load eval) (do-all-symbols (s) (remprop s 'CLOSCLASS))) ;; CLtL2 28.1.4., ANSI CL 4.3.7. Integrating Types and Classes (defun subclassp (class1 class2) (unless (>= (class-initialized class1) 4) (finalize-inheritance class1)) (values (gethash class2 (class-all-superclasses class1)))) ; T or (default) NIL ;; Continue bootstrapping. (%defclos ;; distinctive marks for CLASS-P *<standard-class>-class-version* *<structure-class>-class-version* *<built-in-class>-class-version* 'defined-class 'class ;; built-in-classes for CLASS-OF - order in sync with constobj.d (vector 'array 'bit-vector 'character 'complex 'cons 'float 'function 'hash-table 'integer 'list 'null 'package 'pathname #+LOGICAL-PATHNAMES 'logical-pathname ;!!!if UCFG_LISP_BUILTIN_RANDOM_STATE 'random-state 'ratio 'readtable 'stream 'file-stream 'synonym-stream 'broadcast-stream 'concatenated-stream 'two-way-stream 'echo-stream 'string-stream 'string 'symbol 't 'vector)) ;; Bootstrapping support. (defun replace-class-version (class class-version) (replace class-version (class-current-version class)) (setf (class-current-version class) class-version)) ;;; -------------------------------- DEFCLASS -------------------------------- (defmacro defclass (&whole whole-form name superclass-specs slot-specs &rest options) (setq name (sys::check-not-declaration name 'defclass)) (let* ((superclass-forms (progn (unless (listp superclass-specs) (error-of-type 'ext:source-program-error :form whole-form :detail superclass-specs (TEXT "~S ~S: expecting list of superclasses instead of ~S") 'defclass name superclass-specs)) (mapcar #'(lambda (superclass) (unless (symbolp superclass) (error-of-type 'ext:source-program-error :form whole-form :detail superclass (TEXT "~S ~S: superclass name ~S should be a symbol") 'defclass name superclass)) `',superclass) superclass-specs))) (accessor-method-decl-forms '()) (accessor-function-decl-forms '()) (generic-accessors nil) (generic-accessors-arg 'T) (slot-forms (let ((slot-names '())) (unless (listp slot-specs) (error-of-type 'ext:source-program-error :form whole-form :detail slot-specs (TEXT "~S ~S: expecting list of slot specifications instead of ~S") 'defclass name slot-specs)) (when (and (oddp (length slot-specs)) (cdr slot-specs) (do ((l (cdr slot-specs) (cddr l))) ((endp l) t) (unless (keywordp (car l)) (return nil)))) ;; Typical beginner error: Omission of the parentheses around the ;; slot-specs. Probably someone who knows DEFSTRUCT and uses ;; DEFCLASS for the first time. (clos-warning (TEXT "~S ~S: Every second slot name is a keyword, and these slots have no options. If you want to define a slot with options, you need to enclose all slot specifications in parentheses: ~S, not ~S.") 'defclass name (list slot-specs) slot-specs)) (mapcar #'(lambda (slot-spec) (let ((slot-name slot-spec) (slot-options '())) (when (consp slot-spec) (setq slot-name (car slot-spec) slot-options (cdr slot-spec))) (unless (symbolp slot-name) (error-of-type 'ext:source-program-error :form whole-form :detail slot-name (TEXT "~S ~S: slot name ~S should be a symbol") 'defclass name slot-name)) (if (memq slot-name slot-names) (error-of-type 'ext:source-program-error :form whole-form :detail slot-names (TEXT "~S ~S: There may be only one direct slot with the name ~S.") 'defclass name slot-name) (push slot-name slot-names)) (let ((readers '()) (writers '()) (allocations '()) (initargs '()) (initform nil) (initfunction nil) (types '()) (documentation nil) (user-defined-args nil)) (when (oddp (length slot-options)) (error-of-type 'ext:source-program-error :form whole-form :detail slot-options (TEXT "~S ~S: slot options for slot ~S must come in pairs") 'defclass name slot-name)) (do ((optionsr slot-options (cddr optionsr))) ((atom optionsr)) (let ((optionkey (first optionsr)) (argument (second optionsr))) (case optionkey (:READER (unless (and (symbolp argument) argument) (error-of-type 'ext:source-program-error :form whole-form :detail argument (TEXT "~S ~S, slot option for slot ~S: ~S is not a non-NIL symbol") 'defclass name slot-name argument)) (push argument readers)) (:WRITER (unless (function-name-p argument) (error-of-type 'ext:source-program-error :form whole-form :detail argument (TEXT "~S ~S, slot option for slot ~S: ~S is not a function name") 'defclass name slot-name argument)) (push argument writers)) (:ACCESSOR (unless (and (symbolp argument) argument) (error-of-type 'ext:source-program-error :form whole-form :detail argument (TEXT "~S ~S, slot option for slot ~S: ~S is not a non-NIL symbol") 'defclass name slot-name argument)) (push argument readers) (push `(SETF ,argument) writers)) (:ALLOCATION (unless (symbolp argument) (error-of-type 'ext:source-program-error :form whole-form :detail argument (TEXT "~S ~S, slot option ~S for slot ~S: ~S is not a symbol") 'defclass name ':allocation slot-name argument)) (when allocations (error-of-type 'ext:source-program-error :form whole-form :detail slot-options (TEXT "~S ~S, slot option ~S for slot ~S may only be given once") 'defclass name ':allocation slot-name)) (setq allocations (list argument))) (:INITARG (unless (symbolp argument) (error-of-type 'ext:source-program-error :form whole-form :detail argument (TEXT "~S ~S, slot option for slot ~S: ~S is not a symbol") 'defclass name slot-name argument)) (push argument initargs)) (:INITFORM (when initform (error-of-type 'ext:source-program-error :form whole-form :detail slot-options (TEXT "~S ~S, slot option ~S for slot ~S may only be given once") 'defclass name ':initform slot-name)) (setq initform `(QUOTE ,argument) initfunction (make-initfunction-form argument slot-name))) (:TYPE (when types (error-of-type 'ext:source-program-error :form whole-form :detail slot-options (TEXT "~S ~S, slot option ~S for slot ~S may only be given once") 'defclass name ':type slot-name)) (setq types (list argument))) (:DOCUMENTATION (when documentation (error-of-type 'ext:source-program-error :form whole-form :detail slot-options (TEXT "~S ~S, slot option ~S for slot ~S may only be given once") 'defclass name ':documentation slot-name)) (unless (stringp argument) (error-of-type 'ext:source-program-error :form whole-form :detail argument (TEXT "~S ~S, slot option for slot ~S: ~S is not a string") 'defclass name slot-name argument)) (setq documentation argument)) ((:NAME :READERS :WRITERS :INITARGS :INITFUNCTION) ;; These are valid initialization keywords for ;; <direct-slot-definition>, but nevertheless ;; not valid DEFCLASS slot options. (error-of-type 'ext:source-program-error :form whole-form :detail optionkey (TEXT "~S ~S, slot option for slot ~S: ~S is not a valid slot option") 'defclass name slot-name optionkey)) (t (if (symbolp optionkey) (let ((acons (assoc optionkey user-defined-args))) (if acons (push argument (cdr acons)) (push (list optionkey argument) user-defined-args))) (error-of-type 'ext:source-program-error :form whole-form :detail optionkey (TEXT "~S ~S, slot option for slot ~S: ~S is not a valid slot option") 'defclass name slot-name optionkey)))))) (setq readers (nreverse readers)) (setq writers (nreverse writers)) (setq user-defined-args (nreverse user-defined-args)) (let ((type (if types (first types) 'T))) (dolist (funname readers) (push `(DECLAIM-METHOD ,funname ((OBJECT ,name))) accessor-method-decl-forms) (push `(PROCLAIM '(FUNCTION ,funname (,name) ,type)) accessor-function-decl-forms) (push `(SYSTEM::EVAL-WHEN-COMPILE (SYSTEM::C-DEFUN ',funname (SYSTEM::LAMBDA-LIST-TO-SIGNATURE '(OBJECT)))) accessor-function-decl-forms)) (dolist (funname writers) (push `(DECLAIM-METHOD ,funname (NEW-VALUE (OBJECT ,name))) accessor-method-decl-forms) (push `(PROCLAIM '(FUNCTION ,funname (,type ,name) ,type)) accessor-function-decl-forms) (push `(SYSTEM::EVAL-WHEN-COMPILE (SYSTEM::C-DEFUN ',funname (SYSTEM::LAMBDA-LIST-TO-SIGNATURE '(NEW-VALUE OBJECT)))) accessor-function-decl-forms))) `(LIST :NAME ',slot-name ,@(when readers `(:READERS ',readers)) ,@(when writers `(:WRITERS ',writers)) ,@(when allocations `(:ALLOCATION ',(first allocations))) ,@(when initargs `(:INITARGS ',(nreverse initargs))) ,@(when initform `(:INITFORM ,initform :INITFUNCTION ,initfunction)) ,@(when types `(:TYPE ',(first types))) ,@(when documentation `(:DOCUMENTATION ',documentation)) ,@(when user-defined-args ;; For error-checking purposes: `('DEFCLASS-FORM ',whole-form)) ,@(mapcan #'(lambda (option) (list `',(car option) ;; If there are multiple occurrences ;; of the same option, the values are ;; passed as a list. Otherwise a single ;; value is passed (not a 1-element list)! `',(if (cddr option) (nreverse (cdr option)) (cadr option)))) user-defined-args))))) slot-specs))) (metaclass nil) (metaclass-arg nil) (direct-default-initargs nil) (documentation nil) (user-defined-args nil)) (dolist (option options) (block nil (when (listp option) (let ((optionkey (first option))) (when (case optionkey (:METACLASS metaclass) (:DEFAULT-INITARGS direct-default-initargs) (:DOCUMENTATION documentation)) (error-of-type 'ext:source-program-error :form whole-form :detail options (TEXT "~S ~S: option ~S may only be given once") 'defclass name optionkey)) (case optionkey (:METACLASS (when (eql (length option) 2) (let ((argument (second option))) (unless (symbolp argument) (error-of-type 'ext:source-program-error :form whole-form :detail argument (TEXT "~S ~S, option ~S: ~S is not a symbol") 'defclass name option argument)) (setq metaclass-arg argument) (setq metaclass `(FIND-CLASS ',argument))) (return))) (:DEFAULT-INITARGS (let ((list (rest option))) (when (and (consp list) (null (cdr list)) (listp (car list))) (setq list (car list)) (clos-warning (TEXT "~S ~S: option ~S should be written ~S") 'defclass name option (cons ':DEFAULT-INITARGS list))) (when (oddp (length list)) (error-of-type 'ext:source-program-error :form whole-form :detail list (TEXT "~S ~S, option ~S: arguments must come in pairs") 'defclass name option)) (setq direct-default-initargs `(:DIRECT-DEFAULT-INITARGS (LIST ,@(let ((arglist nil) (formlist nil)) (do ((listr list (cddr listr))) ((atom listr)) (unless (symbolp (first listr)) (error-of-type 'ext:source-program-error :form whole-form :detail (first listr) (TEXT "~S ~S, option ~S: ~S is not a symbol") 'defclass name option (first listr))) (when (member (first listr) arglist) (error-of-type 'ext:source-program-error :form whole-form :detail list (TEXT "~S ~S, option ~S: ~S may only be given once") 'defclass name option (first listr))) (push (first listr) arglist) (push (second listr) formlist)) (mapcan #'(lambda (arg form) `((LIST ',arg ',form ,(make-initfunction-form form arg)))) (nreverse arglist) (nreverse formlist))))))) (return)) (:DOCUMENTATION (when (eql (length option) 2) (let ((argument (second option))) (unless (stringp argument) (error-of-type 'ext:source-program-error :form whole-form :detail argument (TEXT "~S ~S, option ~S: ~S is not a string") 'defclass name option argument)) (setq documentation `(:DOCUMENTATION ',argument))) (return))) ((:NAME :DIRECT-SUPERCLASSES :DIRECT-SLOTS :DIRECT-DEFAULT-INITARGS) ;; These are valid initialization keywords for <defined-class>, ;; but nevertheless not valid DEFCLASS options. (error-of-type 'ext:source-program-error :form whole-form :detail option (TEXT "~S ~S: invalid option ~S") 'defclass name option)) (:GENERIC-ACCESSORS (when (eql (length option) 2) (let ((argument (second option))) (setq generic-accessors-arg argument) (setq generic-accessors `(:GENERIC-ACCESSORS ',argument)) (return)))) (T (when (symbolp optionkey) (when (assoc optionkey user-defined-args) (error-of-type 'ext:source-program-error :form whole-form :detail options (TEXT "~S ~S: option ~S may only be given once") 'defclass name optionkey)) (push option user-defined-args) (return)))))) (error-of-type 'ext:source-program-error :form whole-form :detail option (TEXT "~S ~S: invalid option ~S") 'defclass name option))) (setq user-defined-args (nreverse user-defined-args)) (let ((metaclass-var (gensym)) (metaclass-keywords-var (gensym))) `(LET () (EVAL-WHEN (COMPILE LOAD EVAL) (LET* ((,metaclass-var ,(or metaclass '<STANDARD-CLASS>)) ,@(if user-defined-args `((,metaclass-keywords-var ,(cond ((or (null metaclass) (eq metaclass-arg 'STANDARD-CLASS)) '*<STANDARD-CLASS>-VALID-INITIALIZATION-KEYWORDS*) ((eq metaclass-arg 'FUNCALLABLE-STANDARD-CLASS) '*<FUNCALLABLE-STANDARD-CLASS>-VALID-INITIALIZATION-KEYWORDS*) (t `(CLASS-VALID-INITIALIZATION-KEYWORDS ,metaclass-var))))))) ;; Provide good error messages. The error message from ;; ENSURE-CLASS (actually MAKE-INSTANCE) later is unintelligible. ,@(if user-defined-args `((UNLESS (EQ ,metaclass-keywords-var 'T) ,@(mapcar #'(lambda (option) `(UNLESS (MEMBER ',(first option) ,metaclass-keywords-var) (ERROR-OF-TYPE 'EXT:SOURCE-PROGRAM-ERROR :FORM ',whole-form :DETAIL ',option (TEXT "~S ~S: invalid option ~S") 'DEFCLASS ',name ',option))) user-defined-args)))) (APPLY #'ENSURE-CLASS ',name :DIRECT-SUPERCLASSES (LIST ,@superclass-forms) :DIRECT-SLOTS (LIST ,@slot-forms) :METACLASS ,metaclass-var ,@direct-default-initargs ,@documentation ,@generic-accessors ;; Pass user-defined initargs of the metaclass. ,@(mapcan #'(lambda (option) (list `',(first option) `',(rest option))) user-defined-args) (APPEND ;; Pass the default initargs of the metaclass, in ;; order to erase leftovers from the previous definition. ,(if metaclass `(MAPCAN #'(LAMBDA (X) (LIST (FIRST X) (FUNCALL (THIRD X)))) (CLASS-DEFAULT-INITARGS ,metaclass-var)) `',*<standard-class>-default-initargs*) (LIST ;; Here we use (unless ... '(... NIL)) because when a class ;; is being redefined, passing :DOCUMENTATION NIL to ;; ENSURE-CLASS means to erase the documentation string, ;; while nothing means to keep it! See MOP p. 57. ,@(unless direct-default-initargs '(:DIRECT-DEFAULT-INITARGS NIL)) ,@(unless documentation '(:DOCUMENTATION NIL)) ,@(unless generic-accessors '(:GENERIC-ACCESSORS 'T))))))) ,@(if generic-accessors-arg (nreverse accessor-method-decl-forms) ; the DECLAIM-METHODs (nreverse accessor-function-decl-forms)) ; the C-DEFUNs (FIND-CLASS ',name))))) ;; DEFCLASS execution: ;; The function responsible for a MAKE-INSTANCES-OBSOLETE call. (defvar *make-instances-obsolete-caller* 'make-instances-obsolete) (defun ensure-class-using-class-<t> (class name &rest all-keys &key (metaclass <standard-class>) (direct-superclasses '()) (direct-slots '()) (direct-default-initargs '()) (documentation nil) (fixed-slot-locations nil) &allow-other-keys) (declare (ignore direct-slots direct-default-initargs documentation fixed-slot-locations)) ;; Argument checks. (unless (symbolp name) (error (TEXT "~S: class name ~S should be a symbol") 'ensure-class-using-class name)) (unless (defined-class-p metaclass) (if (symbolp metaclass) (setq metaclass (cond ((eq metaclass 'standard-class) <standard-class>) ; for bootstrapping (t (find-class metaclass)))) (error (TEXT "~S for class ~S: metaclass ~S is neither a class or a symbol") 'ensure-class-using-class name metaclass))) (unless (or (eq metaclass <standard-class>) ; for bootstrapping (subclassp metaclass <defined-class>)) (error (TEXT "~S for class ~S: metaclass ~S is not a subclass of CLASS") 'ensure-class-using-class name metaclass)) (unless (proper-list-p direct-superclasses) (error (TEXT "~S for class ~S: The ~S argument should be a proper list, not ~S") 'ensure-class-using-class name ':direct-superclasses direct-superclasses)) (unless (every #'(lambda (x) (or (defined-class-p x) (forward-reference-to-class-p x) (symbolp x))) direct-superclasses) (error (TEXT "~S for class ~S: The direct-superclasses list should consist of classes and symbols, not ~S") 'ensure-class-using-class name direct-superclasses)) ;; Ignore the old class if the given name is not its "proper name". ;; (This is an ANSI CL requirement; it's not clear whether it belongs ;; here or in ENSURE-CLASS.) (when (and class (not (eq (class-name class) name))) (return-from ensure-class-using-class-<t> (apply #'ensure-class-using-class nil name all-keys))) ;; Decide whether to modify the given class or ignore it. (let ((a-semi-standard-class-p (or (eq metaclass <standard-class>) (subclassp metaclass <semi-standard-class>)))) (when class (cond ((not (eq metaclass (class-of class))) ;; This can occur when mixing DEFSTRUCT and DEFCLASS. ;; MOP p. 48 says "If the class of the class argument is not the ;; same as the class specified by the :metaclass argument, an ;; error is signalled." But we can do better: ignore the old ;; class, warn and proceed. The old instances will thus keep ;; pointing to the old class. (clos-warning (TEXT "Cannot redefine ~S with a different metaclass ~S") class metaclass) (setq class nil)) ((not a-semi-standard-class-p) ;; This can occur when redefining a class defined through ;; (DEFCLASS ... (:METACLASS STRUCTURE-CLASS)), which is ;; equivalent to re-executed DEFSTRUCT. ;; Only <semi-standard-class> subclasses support making instances ;; obsolete. Ignore the old class and proceed. The old instances ;; will thus keep pointing to the old class. (setq class nil))) (unless class (return-from ensure-class-using-class-<t> (apply #'ensure-class-using-class nil name all-keys)))) ;; Preparation of class initialization arguments. (setq all-keys (copy-list all-keys)) (remf all-keys ':metaclass) ;; See which direct superclasses are already defined. (setq direct-superclasses (mapcar #'(lambda (c) (if (defined-class-p c) c (let ((cn (if (forward-reference-to-class-p c) (class-name c) c))) (assert (symbolp cn)) (if a-semi-standard-class-p ;; Need a class. Allocate a forward-referenced-class ;; if none is yet allocated. (or (get cn 'CLOSCLASS) (setf (get cn 'CLOSCLASS) (make-instance 'forward-referenced-class :name cn))) ;; Need a defined-class. (find-class cn))))) direct-superclasses)) (if class ;; Modify the class and return the modified class. (apply #'reinitialize-instance ; => #'reinitialize-instance-<defined-class> class :direct-superclasses direct-superclasses all-keys) (setf (find-class name) (setq class (apply (cond ((eq metaclass <standard-class>) #'make-instance-<standard-class>) ((eq metaclass <funcallable-standard-class>) #'make-instance-<funcallable-standard-class>) ((eq metaclass <built-in-class>) #'make-instance-<built-in-class>) ((eq metaclass <structure-class>) #'make-instance-<structure-class>) (t #'make-instance)) metaclass :name name :direct-superclasses direct-superclasses all-keys)))) class)) ;; Preliminary. (predefun ensure-class-using-class (class name &rest args &key (metaclass <standard-class>) (direct-superclasses '()) (direct-slots '()) (direct-default-initargs '()) (documentation nil) (fixed-slot-locations nil) &allow-other-keys) (declare (ignore metaclass direct-superclasses direct-slots direct-default-initargs documentation fixed-slot-locations)) (apply #'ensure-class-using-class-<t> class name args)) ;; MOP p. 46 (defun ensure-class (name &rest args &key (metaclass <standard-class>) (direct-superclasses '()) (direct-slots '()) (direct-default-initargs '()) (documentation nil) (fixed-slot-locations nil) &allow-other-keys) (declare (ignore metaclass direct-superclasses direct-slots direct-default-initargs documentation fixed-slot-locations)) (unless (symbolp name) (error (TEXT "~S: class name ~S should be a symbol") 'ensure-class name)) (let ((result (apply #'ensure-class-using-class (find-class name nil) name args))) ; A check, to verify that user-defined methods on ensure-class-using-class ; work as they should. (unless (defined-class-p result) (error (TEXT "Wrong ~S result for ~S: not a class: ~S") 'ensure-class-using-class name result)) result)) ;; Preliminary. (predefun reader-method-class (class direct-slot &rest initargs) (declare (ignore class direct-slot initargs)) <standard-reader-method>) (predefun writer-method-class (class direct-slot &rest initargs) (declare (ignore class direct-slot initargs)) <standard-writer-method>) ;; ---------------------------- Class redefinition ---------------------------- ;; When this is true, all safety checks about the metaclasses ;; of superclasses are omitted. (defparameter *allow-mixing-metaclasses* nil) (defun reinitialize-instance-<defined-class> (class &rest all-keys &key (name nil name-p) (direct-superclasses '() direct-superclasses-p) (direct-slots '() direct-slots-p) (direct-default-initargs '() direct-default-initargs-p) (documentation nil documentation-p) (fixed-slot-locations nil fixed-slot-locations-p) &allow-other-keys &aux (metaclass (class-of class))) (if (and (>= (class-initialized class) 4) ; already finalized? (subclassp class <metaobject>)) ;; Things would go awry when we try to redefine <class> and similar. (clos-warning (TEXT "Redefining metaobject class ~S has no effect.") class) (progn (when direct-superclasses-p ;; Normalize the (class-direct-superclasses class) in the same way as ;; the direct-superclasses argument, so that we can compare the two ;; lists using EQUAL. (when (and (subclassp metaclass <standard-class>) (< (class-initialized class) 3)) (do ((l (class-direct-superclasses class) (cdr l))) ((atom l)) (let ((c (car l))) (unless (defined-class-p c) (let ((new-c (let ((cn (if (forward-reference-to-class-p c) (class-name c) c))) (assert (symbolp cn)) ;; Need a class. Allocate a forward-referenced-class ;; if none is yet allocated. (or (get cn 'CLOSCLASS) (setf (get cn 'CLOSCLASS) (make-instance 'forward-referenced-class :name cn)))))) (unless (eq new-c c) (when (defined-class-p new-c) ; changed from forward-referenced-class to defined-class (check-allowed-superclass class new-c)) (setf (car l) new-c) (when (or (defined-class-p c) (forward-reference-to-class-p c)) (remove-direct-subclass c class)) (add-direct-subclass new-c class)))))))) (when direct-slots-p ;; Convert the direct-slots to <direct-slot-definition> instances. (setq direct-slots (convert-direct-slots class direct-slots))) (when fixed-slot-locations-p ;; Convert from list to boolean. (when (consp fixed-slot-locations) (setq fixed-slot-locations (car fixed-slot-locations)))) ;; Trivial changes (that can occur when loading the same code twice) ;; do not require updating the instances: ;; changed slot-options :initform, :documentation, ;; changed class-options :name, :default-initargs, :documentation. (if (or (and direct-superclasses-p (not (equal (or direct-superclasses (default-direct-superclasses class)) (class-direct-superclasses class)))) (and direct-slots-p (not (equal-direct-slots direct-slots (class-direct-slots class)))) (and direct-default-initargs-p (not (equal-default-initargs direct-default-initargs (class-direct-default-initargs class)))) (and fixed-slot-locations-p (not (eq fixed-slot-locations (class-fixed-slot-locations class))))) ;; Instances have to be updated: (let* ((was-finalized (>= (class-initialized class) 6)) (must-be-finalized (and was-finalized (some #'class-instantiated (list-all-finalized-subclasses class)))) (old-direct-superclasses (class-direct-superclasses class)) (old-direct-accessors (class-direct-accessors class)) (old-class-precedence-list (and was-finalized (class-precedence-list class))) old-class) ;; ANSI CL 4.3.6. Remove accessor methods created by old DEFCLASS. (remove-accessor-methods old-direct-accessors) (setf (class-direct-accessors class) '()) ;; Clear the cached prototype. (setf (class-prototype class) nil) ;; Declare all instances as obsolete, and backup the class object. (let ((old-version (class-current-version class)) (*make-instances-obsolete-caller* 'defclass)) (make-instances-obsolete class) (setq old-class (cv-class old-version))) (locally (declare (compile)) (sys::%handler-bind #'(lambda () (apply #'shared-initialize ; => #'shared-initialize-<built-in-class> ; #'shared-initialize-<standard-class> ; #'shared-initialize-<structure-class> class nil `(,@(if direct-slots-p (list 'direct-slots direct-slots) '()) ,@all-keys)) ;; If the class could be finalized (although not a "must"), ;; keep it finalized and don't unfinalize it. (when (>= (class-initialized class) 6) (setq must-be-finalized t)) (update-subclasses-for-redefined-class class was-finalized must-be-finalized old-direct-superclasses)) ;; If an error occurs during the class redefinition, ;; switch back to the old definition, so that existing ;; instances can continue to be used. 'ERROR #'(lambda (condition) (declare (ignore condition)) (let ((tmp-direct-superclasses (class-direct-superclasses class))) ;; Restore the class using the backup copy. (let ((new-version (class-current-version class))) (dotimes (i (sys::%record-length class)) (setf (sys::%record-ref class i) (sys::%record-ref old-class i))) (setf (class-current-version class) new-version)) ;; Restore the direct-subclasses pointers. (dolist (super tmp-direct-superclasses) (remove-direct-subclass-internal super class)) (dolist (super old-direct-superclasses) (add-direct-subclass-internal super class)) ;; Restore the finalized-direct-subclasses pointers. (dolist (super tmp-direct-superclasses) (when (semi-standard-class-p super) (remove-finalized-direct-subclass super class))) (when (>= (class-initialized class) 6) (dolist (super old-direct-superclasses) (when (semi-standard-class-p super) (add-finalized-direct-subclass super class)))) ;; Restore the accessor methods. (add-accessor-methods old-direct-accessors) (setf (class-direct-accessors class) old-direct-accessors))))) (let ((new-class-precedence-list (and (>= (class-initialized class) 6) (class-precedence-list class)))) (unless (equal old-class-precedence-list new-class-precedence-list) (update-subclass-instance-specializer-generic-functions class) (update-subclass-cpl-specializer-generic-functions class old-class-precedence-list new-class-precedence-list))) (install-class-direct-accessors class)) ;; Instances don't need to be updated: (progn (when name-p ;; Store new name: (setf (class-classname class) name)) (when direct-slots-p ;; Store new slot-inits: (do ((l-old (class-direct-slots class) (cdr l-old)) (l-new direct-slots (cdr l-new))) ((null l-new)) (let ((old (car l-old)) (new (car l-new))) (setf (slot-definition-initform old) (slot-definition-initform new)) (setf (slot-definition-initfunction old) (slot-definition-initfunction new)) (setf (slot-definition-documentation old) (slot-definition-documentation new))))) (when direct-default-initargs-p ;; Store new default-initargs: (do ((l-old (class-direct-default-initargs class) (cdr l-old)) (l-new direct-default-initargs (cdr l-new))) ((null l-new)) (let ((old (cdar l-old)) (new (cdar l-new))) ;; Move initform and initfunction from new destructively into ;; the old one: (setf (car old) (car new)) (setf (cadr old) (cadr new))))) (when documentation-p ;; Store new documentation: (setf (class-documentation class) documentation)) ;; NB: These modifications are automatically inherited by the ;; subclasses of class! Due to <inheritable-slot-definition-initer> ;; and <inheritable-slot-definition-doc>. ;; No need to call (install-class-direct-accessors class) here. ) ) ;; Try to finalize it (mop-cl-reinit-mo, bug [ 1526448 ]) (unless *allow-mixing-metaclasses* ; for gray.lisp (when (finalizable-p class) (finalize-inheritance class))) ;; Notification of listeners: (map-dependents class #'(lambda (dependent) (apply #'update-dependent class dependent all-keys))) ) ) class) (defun equal-direct-slots (slots1 slots2) (or (and (null slots1) (null slots2)) (and (consp slots1) (consp slots2) (equal-direct-slot (first slots1) (first slots2)) (equal-direct-slots (rest slots1) (rest slots2))))) (defun equal-default-initargs (initargs1 initargs2) (or (and (null initargs1) (null initargs2)) (and (consp initargs1) (consp initargs2) (eq (car (first initargs1)) (car (first initargs2))) (equal-default-initargs (cdr initargs1) (cdr initargs2))))) (defun map-dependents-<defined-class> (class function) (dolist (dependent (class-listeners class)) (funcall function dependent))) ;; ------------------- General routines for <defined-class> ------------------- ;; Preliminary. (predefun class-name (class) (class-classname class)) ;; Returns the list of implicit direct superclasses when none was specified. (defun default-direct-superclasses (class) (cond ((typep class <standard-class>) (list <standard-object>)) ((typep class <funcallable-standard-class>) (list <funcallable-standard-object>)) ((typep class <structure-class>) (list <structure-object>)) (t '()))) (defun check-metaclass-mix (name direct-superclasses metaclass-test metaclass) (unless *allow-mixing-metaclasses* (unless (every metaclass-test direct-superclasses) (error-of-type 'error (TEXT "(~S ~S): superclass ~S should be of class ~S") 'DEFCLASS name (find-if-not metaclass-test direct-superclasses) metaclass)))) ;; Preliminary. (predefun validate-superclass (class superclass) (or ;; Green light if class and superclass belong to the same metaclass. (eq (sys::%record-ref class 0) (sys::%record-ref superclass 0)) ;; Green light also if class is a funcallable-standard-class and ;; superclass is a standard-class. (and (eq (sys::%record-ref class 0) *<funcallable-standard-class>-class-version*) (eq (sys::%record-ref superclass 0) *<standard-class>-class-version*)) ;; Other than that, only <standard-object> and <structure-object> can ;; inherit from <t> without belonging to the same metaclass. (and (eq superclass <t>) (memq (class-classname class) '(standard-object structure-object))) ;; And only <funcallable-standard-object> can inherit from <function> ;; without belonging to the same metaclass. (and (eq superclass <function>) (eq (class-classname class) 'funcallable-standard-object)))) (defun check-allowed-superclass (class superclass) (unless (validate-superclass class superclass) (error (TEXT "(~S ~S) for class ~S: ~S does not allow ~S to become a subclass of ~S. You may define a method on ~S to allow this.") 'initialize-instance 'class (class-classname class) 'validate-superclass class superclass 'validate-superclass))) ;;; The direct-subclasses slot can be either ;;; - NIL or a weak-list (for saving memory when there are few subclasses), or ;;; - a weak-hash-table (for speed when there are many subclasses). #| ;; Adds a class to the list of direct subclasses. (defun add-direct-subclass (class subclass) ...) ;; Removes a class from the list of direct subclasses. (defun remove-direct-subclass (class subclass) ...) ;; Returns the currently existing direct subclasses, as a freshly consed list. (defun list-direct-subclasses (class) ...) |# (def-weak-set-accessors class-direct-subclasses-table defined-class add-direct-subclass-internal remove-direct-subclass-internal list-direct-subclasses) ;; Preliminary. (predefun add-direct-subclass (class subclass) (add-direct-subclass-internal class subclass)) (predefun remove-direct-subclass (class subclass) (remove-direct-subclass-internal class subclass)) (predefun class-direct-subclasses (class) (list-direct-subclasses class)) (defun checked-class-direct-subclasses (class) (let ((result (class-direct-subclasses class))) ; Some checks, to guarantee that user-defined methods on ; class-direct-subclasses don't break our CLOS. (unless (proper-list-p result) (error (TEXT "Wrong ~S result for class ~S: not a proper list: ~S") 'class-direct-subclasses (class-name class) result)) (dolist (c result) (unless (defined-class-p c) (error (TEXT "Wrong ~S result for class ~S: list element is not a class: ~S") 'class-direct-subclasses (class-name class) c)) (unless (memq class (class-direct-superclasses c)) (error (TEXT "Wrong ~S result for class ~S: ~S is not a direct superclass of ~S") 'class-direct-subclasses (class-name class) class c))) result)) (defun update-subclasses-sets (class old-direct-superclasses new-direct-superclasses) (unless (equal old-direct-superclasses new-direct-superclasses) (let ((removed-direct-superclasses (set-difference old-direct-superclasses new-direct-superclasses)) (added-direct-superclasses (set-difference new-direct-superclasses old-direct-superclasses))) (dolist (super removed-direct-superclasses) (remove-direct-subclass super class)) (dolist (super added-direct-superclasses) (add-direct-subclass super class))))) ;; ---------------------------------------------------------------------------- ;; CLtL2 28.1.5., ANSI CL 4.3.5. Determining the Class Precedence List ;; The set of all classes forms a directed graph: Class C is located ;; below the direct superclasses of C. This graph is acyclic, because ;; at the moment of definition of the class C all direct superclasses must ;; already be present. ;; Hence, one can use Noether Induction (Induction from above to below in ;; the class graph) . ;; For a class C let DS(n) be the list of all direct superclasses of C. ;; The set of all superclasses (incl. C itself) is inductively defined as ;; S(C) := {C} union union_{D in DS(C)} S(D). ;; In other words: ;; S(C) = { C_n : C_n in DS(C_{n-1}), ..., C_1 in DS(C_0), C_0 = C } ;; Lemma 1: (a) C in S(C). ;; (b) DS(C) subset S(C). ;; (c) D in DS(C) ==> S(D) subset S(C). ;; (d) D in S(C) ==> S(D) subset S(C). ;; proof: (a) follows from the definition. ;; (b) from (a) and from the definition. ;; (c) from the definition. ;; (d) from (c) with fixed D via induction over C. ;; The CPL of a class C is one order of set S(C). ;; If CPL(C) = (... D1 ... D2 ...), one writes D1 < D2. ;; The relation introduced by this is a total order upon S(C). ;; The following set of restrictions has to be taken into account: ;; R(C) := union_{D in S(C)} DR(D) with ;; DR(C) := { C < C1, C1 < C2, ..., C{n-1} < C_n } if DS(C) = (C1, ..., Cn). ;; If R(C) contains a cycle, R(C) cannot be completed into a total order, ;; of course. Then, R(C) is called inconsistent. ;; CPL(C) is constructed as follows: ;; L := (), R := R(C). ;; L := (L | C), remove all (C < ..) from R. ;; while R /= {}, deal with the set M of all minimal elements of R ;; (those classes, that can be added to L without violating R(C) ). ;; If M is empty, then there is a cycle in R(C) and ;; the algorithm is finished. Else, choose that element among the ;; elements E of M, which has a D being rightmost in L with ;; E in DS(D) . ;; L := (L | E), remove all (E < ..) from R. ;; CPL(C) := L. ;; L is lengthened stepwise by one element, R is shortened stepwise, ;; and R always consists solely of relations between elements ;; of S(C)\L. ;; Lemma 2: (a) CPL(C) = (C ...). ;; (b) If DS(C) = (C1, ..., Cn), then ;; CPL(C) = (C ... C1 ... C2 ... ... Cn ...). ;; proof: (a) obvious by construction. ;; (b) If Ci is added to the CPL, then the restriction ;; C{i-1} < Ci can no longer be in R, so C{i-1} must already be ;; in the CPL. ;; The following statement is wrong: ;; (*) If D is in DS(C) and CPL(D) = (D1, ..., Dn), then ;; CPL(C) = (C ... D1 ... D2 ... ... Dn ...). ;; Example: ;; z ;; /|\ CPL(z) = (z) ;; / | \ CPL(x) = (x z) ;; x | x CPL(y) = (y z) ;; | | | CPL(d) = (d x z) ;; d y e CPL(e) = (e x z) ;; \/ \/ CPL(b) = (b d x y z) ;; b c CPL(c) = (c y e x z) ;; \ / CPL(a) = (a b d c y e x z) ;; a ;; CPL(a) does not contain CPL(b) ! #|| (defclass z () ()) (defclass x (z) ()) (defclass y (z) ()) (defclass d (x z) ()) (defclass e (x z) ()) (defclass b (d y) ()) (defclass c (y e) ()) (defclass a (b c) ()) (mapcar #'find-class '(z x y d e b c a)) ||# (defun std-compute-cpl (class direct-superclasses) (let* ((superclasses ; list of all superclasses in any order (remove-duplicates (mapcap #'class-precedence-list direct-superclasses))) (L '()) (R1 (list (cons class direct-superclasses))) (R2 (mapcar #'(lambda (D) (cons D (class-direct-superclasses D))) superclasses))) (loop ;; L is the reversed, so far constructed CPL. ;; R1 is the list of the so far relevant restrictions, in the form ;; R1 = (... (Dj ... Dn) ...) if from DR(D) = (D1 ... Dn) only ;; Dj,...,Dn is left over. The order in R1 corresponds to that in L. ;; R2 is the list of all so far irrelevant restrictions. (when (null R1) (return)) ; R1 = R2 = () -> finished (let ((M (remove-duplicates (mapcar #'first R1) :from-end t))) (setq M (remove-if #'(lambda (E) (or (dolist (r R1 nil) (when (member E (cdr r)) (return t))) (dolist (r R2 nil) (when (member E (cdr r)) (return t))))) (the list M))) (when (null M) (error-of-type 'error (TEXT "~S ~S: inconsistent precedence graph, cycle ~S") 'defclass (class-classname class) ;; find cycle: advance to ever smaller elements ;; with aid of the restrictions. (let* ((R0 (append R1 R2)) (cycle (list (car (first R0))))) (loop (let* ((last (car cycle)) (next (dolist (r R0 nil) (when (member last (cdr r)) (return (nth (position last (cdr r)) r)))))) (when (null next) ;; last is now apparently a minimal element, after all! (return '??)) (when (member next cycle) (setf (cdr (member next cycle)) nil) (return cycle)) (push next cycle)))))) (let ((E (first M))) (push E L) (push (assoc E R2) R1) (setq R2 (delete E R2 :key #'first)) (mapl #'(lambda (r) (when (eq (first (car r)) E) (pop (car r)))) R1) (setq R1 (delete-if #'null R1))))) (setq L (nreverse L)) ;; Test, if L is compatible with the CPL(D), D in direct-superclasses: (mapc #'(lambda (D) (unless ; Is (class-precedence-list D) sublist of L ? (do ((CL L) (DL (class-precedence-list D) (cdr DL))) ((null DL) t) (when (null (setq CL (member (car DL) CL))) (return nil))) (clos-warning (TEXT "(class-precedence-list ~S) and (class-precedence-list ~S) are inconsistent") class D))) direct-superclasses) L)) (defun compute-class-precedence-list-<defined-class> (class) (std-compute-cpl class (class-direct-superclasses class))) ;; Preliminary. (predefun compute-class-precedence-list (class) (compute-class-precedence-list-<defined-class> class)) (defun checked-compute-class-precedence-list (class) (let ((cpl (compute-class-precedence-list class)) (name (class-name class))) ; Some checks, to guarantee that user-defined methods on ; compute-class-precedence-list don't break our CLOS. (unless (proper-list-p cpl) (error (TEXT "Wrong ~S result for class ~S: not a proper list: ~S") 'compute-class-precedence-list name cpl)) (dolist (c cpl) (unless (defined-class-p c) (error (TEXT "Wrong ~S result for class ~S: list element is not a class: ~S") 'compute-class-precedence-list name c))) (unless (eq (first cpl) class) (error (TEXT "Wrong ~S result for class ~S: list doesn't start with the class itself: ~S") 'compute-class-precedence-list name cpl)) (unless (or (eq name 't) ; for bootstrapping (eq (car (last cpl)) <t>)) (error (TEXT "Wrong ~S result for class ~S: list doesn't end with ~S: ~S") 'compute-class-precedence-list name <t> cpl)) (unless (= (length cpl) (length (remove-duplicates cpl :test #'eq))) (error (TEXT "Wrong ~S result for class ~S: list contains duplicates: ~S") 'compute-class-precedence-list name cpl)) (let ((superclasses (reduce #'union (mapcar #'class-precedence-list (class-direct-superclasses class)) :initial-value '()))) (let ((forgotten (set-difference superclasses cpl))) (when forgotten (error (TEXT "Wrong ~S result for class ~S: list doesn't contain the superclass~[~;~:;es~] ~{~S~^, ~}.") 'compute-class-precedence-list name (length forgotten) forgotten))) (let ((extraneous (set-difference (rest cpl) superclasses))) (when extraneous (error (TEXT "Wrong ~S result for class ~S: list contains elements that are not superclasses: ~{~S~^, ~}") 'compute-class-precedence-list name extraneous)))) ; Now we've checked the CPL is OK. cpl)) ;; Stuff all superclasses (from the precedence-list) into a hash-table. (defun std-compute-superclasses (precedence-list) (let ((ht (make-hash-table :key-type 'defined-class :value-type '(eql t) :test 'ext:stablehash-eq :warn-if-needs-rehash-after-gc t))) (mapc #'(lambda (superclass) (setf (gethash superclass ht) t)) precedence-list) ht)) ;; Determine whether a class inherits from <standard-stablehash> or ;; <structure-stablehash>. (defun std-compute-subclass-of-stablehash-p (class) (dolist (superclass (class-precedence-list class) nil) (let ((superclassname (class-classname superclass))) (when (or (eq superclassname 'standard-stablehash) (eq superclassname 'structure-stablehash)) (return t))))) ;; ---------------------------------------------------------------------------- ;; CLtL2 28.1.3.2., ANSI CL 7.5.3. Inheritance of Slots and Slot Options (defun compute-effective-slot-definition-initargs-<defined-class> (class directslotdefs) (declare (ignore class)) (unless (and (proper-list-p directslotdefs) (consp directslotdefs)) (error (TEXT "~S: argument should be a non-empty proper list, not ~S") 'compute-effective-slot-definition-initargs directslotdefs)) (dolist (slot directslotdefs) (unless (direct-slot-definition-p slot) (error (TEXT "~S: argument list element is not a ~S: ~S") 'compute-effective-slot-definition-initargs 'direct-slot-definition slot))) (let ((name (slot-definition-name (first directslotdefs)))) (dolist (slot (rest directslotdefs)) (unless (eql name (slot-definition-name slot)) (error (TEXT "~S: argument list elements should all have the same name, not ~S and ~S") 'compute-effective-slot-definition-initargs name (slot-definition-name slot)))) `(:name ,name ; "The allocation of a slot is controlled by the most ; specific slot specifier." :allocation ,(slot-definition-allocation (first directslotdefs)) ; "The set of initialization arguments that initialize a ; given slot is the union of the initialization arguments ; declared in the :initarg slot options in all the slot ; specifiers. ,@(let ((initargs (remove-duplicates (mapcap #'slot-definition-initargs directslotdefs) :from-end t))) (if initargs `(:initargs ,initargs))) ; "The default initial value form for a slot is the value ; of the :initform slot option in the most specific slot ; specifier that contains one." ,@(dolist (slot directslotdefs '()) (when (slot-definition-initfunction slot) (return `(:initform ,(slot-definition-initform slot) :initfunction ,(slot-definition-initfunction slot) inheritable-initer ,(slot-definition-inheritable-initer slot))))) ; "The contents of a slot will always be of type ; (and T1 ... Tn) where T1 ...Tn are the values of the ; :type slot options contained in all of the slot specifiers." ,@(let ((types '())) (dolist (slot directslotdefs) (push (slot-definition-type slot) types)) `(:type ,(if types `(AND ,@(nreverse types)) 'T))) ; "The documentation string for a slot is the value of the ; :documentation slot option in the most specific slot ; specifier that contains one." ,@(dolist (slot directslotdefs '()) (when (slot-definition-documentation slot) (return `(:documentation ,(slot-definition-documentation slot) inheritable-doc ,(slot-definition-inheritable-doc slot))))) #|| ; Commented out because <effective-slot-definition> ; doesn't have readers and writers. ,@(let ((readers (mapcap #'slot-definition-readers directslotdefs))) (if readers `(:readers ,readers))) ,@(let ((writers (mapcap #'slot-definition-writers directslotdefs))) (if writers `(:writers ,writers))) ||# ))) ;; Preliminary. (predefun compute-effective-slot-definition-initargs (class direct-slot-definitions) (compute-effective-slot-definition-initargs-<defined-class> class direct-slot-definitions)) (defun compute-effective-slot-definition-<defined-class> (class name directslotdefs) (let ((args (compute-effective-slot-definition-initargs class directslotdefs))) ; Some checks, to guarantee that user-defined primary methods on ; compute-effective-slot-definition-initargs don't break our CLOS. (unless (and (proper-list-p args) (evenp (length args))) (error (TEXT "Wrong ~S result for ~S: not a list of keyword/value pairs: ~S") 'compute-effective-slot-definition-initargs class args)) (let* ((default '#:default) (returned-name (getf args ':name '#:default))) (unless (eql returned-name name) (if (eq returned-name default) (error (TEXT "Wrong ~S result for ~S: missing ~S") 'compute-effective-slot-definition-initargs class ':name) (error (TEXT "Wrong ~S result for ~S: invalid ~S value") 'compute-effective-slot-definition-initargs class ':name)))) (let ((slot-definition-class (apply #'effective-slot-definition-class class args))) (cond ((semi-standard-class-p class) (unless (or ; for bootstrapping (eq slot-definition-class 'standard-effective-slot-definition) (and (defined-class-p slot-definition-class) (subclassp slot-definition-class <standard-effective-slot-definition>))) (error (TEXT "Wrong ~S result for class ~S: not a subclass of ~S: ~S") 'effective-slot-definition-class (class-name class) 'standard-effective-slot-definition slot-definition-class))) ((structure-class-p class) (unless (and (defined-class-p slot-definition-class) (subclassp slot-definition-class <structure-effective-slot-definition>)) (error (TEXT "Wrong ~S result for class ~S: not a subclass of ~S: ~S") 'effective-slot-definition-class (class-name class) 'structure-effective-slot-definition slot-definition-class)))) (apply (cond ((eq slot-definition-class 'standard-effective-slot-definition) #'make-instance-<standard-effective-slot-definition>) (t #'make-instance)) slot-definition-class args)))) ;; Preliminary. (predefun compute-effective-slot-definition (class slotname direct-slot-definitions) (compute-effective-slot-definition-<defined-class> class slotname direct-slot-definitions)) (defun compute-slots-<defined-class>-primary (class) ;; Gather all slot-specifiers, ordered by precedence: (let ((all-slots (mapcan #'(lambda (c) (nreverse (copy-list (class-direct-slots c)))) (class-precedence-list class)))) ;!!! PATCH because our MAPHASH don't order elements (let ((z nil)) (dolist (slot all-slots) (let* ((slot-name (slot-definition-name slot)) (el (assoc slot-name z))) (if el (push slot (cdr el)) (setq z (acons slot-name (list slot) z))))) (setq all-slots (dolist (el z z) (setf (cdr el) (nreverse (cdr el)))))) #| ;; Partition by slot-names: (setq all-slots (let ((ht (make-hash-table :key-type 'symbol :value-type 't :test 'ext:stablehash-eql :warn-if-needs-rehash-after-gc t))) (dolist (slot all-slots) (let ((slot-name (slot-definition-name slot))) (push slot (gethash slot-name ht nil)))) (let ((L nil)) (maphash #'(lambda (name slot-list) (push (cons name (nreverse slot-list)) L)) ht) L))) ; not (nreverse L), because maphash reverses the order ;; Bring the slots into final order: Superclass before subclass, and ;; inside each class, keeping the same order as in the direct-slots. (setq all-slots (nreverse all-slots)) |# ;; all-slots is now a list of lists of the form ;; (name most-specific-slot ... least-specific-slot). (mapcar #'(lambda (slotbag) (let ((name (car slotbag)) (directslotdefs (cdr slotbag))) ;; Create the effective slot definition in a way that depends ;; only on the class, name, and direct-slot-definitions. (let ((eff-slot (compute-effective-slot-definition class name directslotdefs))) ; Some checks, to guarantee that user-defined methods on ; compute-effective-slot-definition don't break our CLOS. (unless (effective-slot-definition-p eff-slot) (error (TEXT "Wrong ~S result for class ~S, slot ~S: not an ~S instance: ~S") 'compute-effective-slot-definition class name 'effective-slot-definition eff-slot)) eff-slot))) all-slots))) ;; Allocation of local and shared slots. ;; Side effects done by this function: The slot-definition-location of the ;; slots is determined. (defun compute-slots-<slotted-class>-around (class next-method) (let ((cpl (class-precedence-list class)) (slots (funcall next-method class))) ; Some checks, to guarantee that user-defined primary methods on ; compute-slots don't break our CLOS. (unless (proper-list-p slots) (error (TEXT "Wrong ~S result for class ~S: not a proper list: ~S") 'compute-slots (class-name class) slots)) (cond ((semi-standard-class-p class) (dolist (slot slots) (unless (standard-effective-slot-definition-p slot) (error (TEXT "Wrong ~S result for class ~S: list element is not a ~S: ~S") 'compute-slots (class-name class) 'standard-effective-slot-definition slot)))) ((structure-class-p class) (dolist (slot slots) (unless (typep-class slot <structure-effective-slot-definition>) (error (TEXT "Wrong ~S result for class ~S: list element is not a ~S: ~S") 'compute-slots (class-name class) 'structure-effective-slot-definition slot))))) (unless (= (length slots) (length (delete-duplicates (mapcar #'slot-definition-name slots)))) (error (TEXT "Wrong ~S result for class ~S: list contains duplicate slot names: ~S") 'compute-slots (class-name class) slots)) ;; Implementation of fixed-slot-locations policy. (let ((superclasses-with-fixed-slot-locations (remove-if-not #'(lambda (c) (and (semi-standard-class-p c) (class-fixed-slot-locations c))) (cdr (class-precedence-list class))))) (when superclasses-with-fixed-slot-locations (dolist (slot slots) (let ((name (slot-definition-name slot)) (location nil)) (dolist (superclass superclasses-with-fixed-slot-locations) (let ((slot-in-superclass (find name (class-slots superclass) :key #'slot-definition-name))) (when slot-in-superclass (when (eq (slot-definition-allocation slot-in-superclass) ':instance) (let ((guaranteed-location (slot-definition-location slot-in-superclass))) (assert (integerp guaranteed-location)) (if location (unless (equal location guaranteed-location) (error (TEXT "In class ~S, the slot ~S is constrained by incompatible constraints inherited from the superclasses.") (class-name class) name)) (setq location guaranteed-location))))))) (when location (unless (eq (slot-definition-allocation slot) ':instance) (error (TEXT "In class ~S, non-local slot ~S is constrained to be a local slot at offset ~S.") (class-name class) name location)) (setf (slot-definition-location slot) location)))))) (let ((constrained-indices (let ((constrained-slots (remove-if-not #'slot-definition-location slots))) (setq constrained-slots (copy-list constrained-slots)) (setq constrained-slots (sort constrained-slots #'< :key #'slot-definition-location)) (do ((l constrained-slots (cdr l))) ((null (cdr l))) (when (= (slot-definition-location (car l)) (slot-definition-location (cadr l))) (error (TEXT "In class ~S, the slots ~S and ~S are constrained from the superclasses to both be located at offset ~S.") (class-name class) (slot-definition-name (car l)) (slot-definition-name (cadr l)) (slot-definition-location (car l))))) (mapcar #'slot-definition-location constrained-slots))) (local-index (class-instance-size class)) (shared-index 0)) ;; Actually the constrained-indices must form a list of consecutive indices ;; (1 2 ... n), but we don't need to make use of this. ;; Now determine the location of each slot. (when (and constrained-indices (< (first constrained-indices) local-index)) (error (TEXT "In class ~S, a slot constrained from a superclass wants to be located at offset ~S, which is impossible.") (class-name class) (first constrained-indices))) (flet ((skip-constrained-indices () (loop (if (and constrained-indices (= (first constrained-indices) local-index)) (progn (incf local-index) (pop constrained-indices)) (return))))) (skip-constrained-indices) (dolist (slot slots) (let ((name (slot-definition-name slot)) (allocation (slot-definition-allocation slot))) (setf (slot-definition-location slot) (cond ((eq allocation ':instance) ;; Local slot. (or (slot-definition-location slot) (prog1 local-index (incf local-index) (skip-constrained-indices)))) ((eq allocation ':class) ;; Shared slot. ;; This is a flaw in the compute-slots protocol: the ;; primary compute-slots method returns a list of slots, ;; without information about the class where the slot ;; comes from. So we have to re-scan the direct slots ;; lists. (let ((origin (dolist (superclass cpl class) (when (find name (class-direct-slots superclass) :key #'slot-definition-name) (return superclass))))) (if (eq origin class) ;; New shared slot. (prog1 (cons (class-current-version class) shared-index) (incf shared-index)) ;; Inherited shared slot. (let ((inh-descriptor (gethash name (class-slot-location-table origin)))) (if (effective-slot-definition-p inh-descriptor) (slot-definition-location inh-descriptor) inh-descriptor))))) (t ;; Don't signal an error for user-defined allocation ;; types. They can be handled by user-defined around ;; methods. nil)))))) ;; Actually the constrained-indices must already have been emptied by ;; the first (skip-constrained-indices) call, but we don't need to make ;; use of this. Warn if :fixed-slot-locations would cause a waste of ;; space. (when constrained-indices (setq local-index (1+ (car (last constrained-indices)))) (clos-warning (TEXT "In class ~S, constrained slot locations cause holes to appear.") (class-name class))) slots))) ;; Preliminary. (predefun compute-slots (class) (compute-slots-<slotted-class>-around class #'compute-slots-<defined-class>-primary)) (defun checked-compute-slots (class) (let ((slots (compute-slots class))) ; Some checks, to guarantee that user-defined around methods on ; compute-slots don't break our CLOS. (unless (proper-list-p slots) (error (TEXT "Wrong ~S result for class ~S: not a proper list: ~S") 'compute-slots (class-name class) slots)) (dolist (slot slots) (unless (standard-effective-slot-definition-p slot) (error (TEXT "Wrong ~S result for class ~S: list element is not a ~S: ~S") 'compute-slots (class-name class) 'standard-effective-slot-definition slot))) (unless (= (length slots) (length (delete-duplicates (mapcar #'slot-definition-name slots)))) (error (TEXT "Wrong ~S result for class ~S: list contains duplicate slot names: ~S") 'compute-slots (class-name class) slots)) (dolist (slot slots) (case (slot-definition-allocation slot) ((:INSTANCE :CLASS) (unless (slot-definition-location slot) (error (TEXT "Wrong ~S result for class ~S: no slot location has been assigned to ~S") 'compute-slots (class-name class) slot))))) slots)) ;; The MOP lacks a way to customize the instance size as a function of the ;; slots. This becomes an issue when you have slots which occupy more than one ;; word, and such a slot is the last local slot. (defun compute-instance-size (class) (let ((size (class-instance-size class))) ; initial size depends on the metaclass (dolist (slot (class-slots class)) (when (eq (slot-definition-allocation slot) ':instance) (let ((location (slot-definition-location slot))) (assert (integerp location)) (setq size (max size (+ location 1)))))) size)) ;; Similarly, the MOP lacks a way to customize the shared slot values vector's ;; size as a function of the slots. (defun compute-shared-size (class) (let ((shared-size 0)) (dolist (slot (class-slots class)) (let ((location (slot-definition-location slot))) (when (and (consp location) (eq (cv-newest-class (car location)) class)) (let ((shared-index (cdr location))) (setq shared-size (max shared-size (+ shared-index 1))))))) shared-size)) ;; Creates the shared slot values vector for a class. (defun create-shared-slots-vector (class shared-size old-slot-location-table) (let ((v (make-array shared-size :initial-element 'DEADBEEF))) (dolist (slot (class-slots class)) (let ((location (slot-definition-location slot))) (when (and (consp location) (eq (cv-newest-class (car location)) class)) (let ((shared-index (cdr location))) (setf (svref v shared-index) (let* ((old-slot-descriptor (gethash (slot-definition-name slot) old-slot-location-table)) (old-slot-location (if (effective-slot-definition-p old-slot-descriptor) (slot-definition-location old-slot-descriptor) old-slot-descriptor))) (if (and (consp old-slot-location) (eq (cv-newest-class (car old-slot-location)) class)) ;; The slot was already shared. Retain its value. (svref (cv-shared-slots (car old-slot-location)) (cdr old-slot-location)) ;; A new shared slot. (let ((initfunction (slot-definition-initfunction slot))) (if initfunction (funcall initfunction) (sys::%unbound)))))))))) v)) (defun compute-slot-location-table (class) (let ((slots (class-slots class))) (if slots (make-hash-table :key-type 'symbol :value-type 't :test 'ext:stablehash-eq :warn-if-needs-rehash-after-gc t :initial-contents (mapcar #'(lambda (slot) (cons (slot-definition-name slot) (compute-slot-location-table-entry class slot))) slots)) empty-ht))) (defun compute-slot-location-table-entry (class slot) (let ((location (slot-definition-location slot)) ;; Compute the effective methods of SLOT-VALUE-USING-CLASS etc. ;; Note that we cannot use (class-prototype class) yet. ;; Also, SLOT-VALUE-USING-CLASS etc. are not defined on STRUCTURE-CLASS. (efm-svuc (if (and (semi-standard-class-p class) *classes-finished*) (compute-applicable-methods-effective-method-for-set |#'slot-value-using-class| (list `(EQL ,class) `(INSTANCE-OF-P ,class) `(EQL ,slot)) (list class '`(CLASS-PROTOTYPE ,class) slot)) #'%slot-value-using-class)) (efm-ssvuc (if (and (semi-standard-class-p class) *classes-finished*) (compute-applicable-methods-effective-method-for-set |#'(setf slot-value-using-class)| (list `(TYPEP ,<t>) `(EQL ,class) `(INSTANCE-OF-P ,class) `(EQL ,slot)) (list 'ANY-VALUE class '`(CLASS-PROTOTYPE ,class) slot)) #'%set-slot-value-using-class)) (efm-sbuc (if (and (semi-standard-class-p class) *classes-finished*) (compute-applicable-methods-effective-method-for-set |#'slot-boundp-using-class| (list `(EQL ,class) `(INSTANCE-OF-P ,class) `(EQL ,slot)) (list class '`(CLASS-PROTOTYPE ,class) slot)) #'%slot-boundp-using-class)) (efm-smuc (if (and (semi-standard-class-p class) *classes-finished*) (compute-applicable-methods-effective-method-for-set |#'slot-makunbound-using-class| (list `(EQL ,class) `(INSTANCE-OF-P ,class) `(EQL ,slot)) (list class '`(CLASS-PROTOTYPE ,class) slot)) #'%slot-makunbound-using-class))) (setf (slot-definition-efm-svuc slot) efm-svuc) (setf (slot-definition-efm-ssvuc slot) efm-ssvuc) (setf (slot-definition-efm-sbuc slot) efm-sbuc) (setf (slot-definition-efm-smuc slot) efm-smuc) (if (and (eq efm-svuc #'%slot-value-using-class) (eq efm-ssvuc #'%set-slot-value-using-class) (eq efm-sbuc #'%slot-boundp-using-class) (eq efm-smuc #'%slot-makunbound-using-class)) location slot))) ;; ---------------------------------------------------------------------------- ;; CLtL2 28.1.3.3., ANSI CL 4.3.4.2. Inheritance of Default-Initargs (defun compute-default-initargs-<defined-class> (class) (remove-duplicates (mapcap #'class-direct-default-initargs (class-precedence-list class)) :key #'car :from-end t)) ;; Preliminary. (predefun compute-default-initargs (class) (compute-default-initargs-<defined-class> class)) (defun checked-compute-default-initargs (class) (let ((default-initargs (compute-default-initargs class))) ; Some checks, to guarantee that user-defined methods on ; compute-default-initargs don't break our CLOS. (unless (proper-list-p default-initargs) (error (TEXT "Wrong ~S result for class ~S: not a proper list: ~S") 'compute-default-initargs (class-name class) default-initargs)) (dolist (di default-initargs) (unless (canonicalized-default-initarg-p di) (error (TEXT "Wrong ~S result for class ~S: list element is not a canonicalized default initarg: ~S") 'compute-default-initargs (class-name class) di))) (unless (= (length default-initargs) (length (delete-duplicates (mapcar #'first default-initargs)))) (error (TEXT "Wrong ~S result for class ~S: list contains duplicate initarg names: ~S") 'compute-default-initargs (class-name class) default-initargs)) default-initargs)) ;; ----------------------------- Accessor Methods ----------------------------- ;; Flag to avoid bootstrapping issues with the compiler. (defvar *compile-accessor-functions* nil) (defun check-method-redefinition (funname qualifiers spec-list caller) (sys::check-redefinition (list* funname qualifiers spec-list) caller ;; do not warn about redefinition when no method was defined (and (fboundp 'find-method) (fboundp funname) (typep-class (fdefinition funname) <generic-function>) (not (safe-gf-undeterminedp (fdefinition funname))) (eql (sig-req-num (safe-gf-signature (fdefinition funname))) (length spec-list)) (find-method (fdefinition funname) qualifiers spec-list nil) (TEXT "method")))) ;; Install the accessor methods corresponding to the direct slots of a class. (defun install-class-direct-accessors (class) (dolist (slot (class-direct-slots class)) (let ((slot-name (slot-definition-name slot)) (readers (slot-definition-readers slot)) (writers (slot-definition-writers slot))) (when (or readers writers) (let ((generic-p (class-generic-accessors class)) (access-place (let (effective-slot) (if (and (semi-standard-class-p class) (class-fixed-slot-locations class) (setq effective-slot (find slot-name (class-slots class) :key #'slot-definition-name)) (eq (slot-definition-allocation effective-slot) ':instance)) (progn (assert (typep (slot-definition-location effective-slot) 'integer)) `(STANDARD-INSTANCE-ACCESS OBJECT ,(slot-definition-location effective-slot))) (if (and (structure-class-p class) (setq effective-slot (find slot-name (class-slots class) :key #'slot-definition-name)) (eq (slot-definition-allocation effective-slot) ':instance)) (progn (assert (typep (slot-definition-location effective-slot) 'integer)) `(SYSTEM::%STRUCTURE-REF ',(class-name class) OBJECT ,(slot-definition-location effective-slot))) `(SLOT-VALUE OBJECT ',slot-name)))))) ;; Generic accessors are defined as methods and listed in the ;; direct-accessors list, so they can be removed upon class redefinition. ;; Non-generic accessors are defined as plain functions. ;; Call CHECK-REDEFINITION appropriately. (dolist (funname readers) (if generic-p (progn (check-method-redefinition funname nil (list class) 'defclass) (setf (class-direct-accessors class) (list* funname (do-defmethod funname (let* ((args (list :specializers (list class) :qualifiers nil :lambda-list '(OBJECT) 'signature (sys::memoized (make-signature :req-num 1)) :slot-definition slot)) (method-class (apply #'reader-method-class class slot args))) (unless (and (defined-class-p method-class) (subclassp method-class <standard-reader-method>)) (error (TEXT "Wrong ~S result for class ~S: not a subclass of ~S: ~S") 'reader-method-class (class-name class) 'standard-reader-method method-class)) (apply #'make-instance method-class (nconc (method-function-initargs method-class (eval `(LOCALLY (DECLARE (COMPILE ,funname)) (%OPTIMIZE-FUNCTION-LAMBDA (T) (#:CONTINUATION OBJECT) (DECLARE (COMPILE)) ,access-place)))) args)))) (class-direct-accessors class)))) (progn (sys::check-redefinition funname 'defclass (sys::fbound-string funname)) (setf (fdefinition funname) (eval `(FUNCTION ,funname (LAMBDA (OBJECT) ,@(if *compile-accessor-functions* `((DECLARE (COMPILE ,funname)))) (UNLESS (TYPEP OBJECT ',class) (ERROR-ACCESSOR-TYPECHECK ',funname OBJECT ',class)) ,access-place))))))) (dolist (funname writers) (if generic-p (progn (check-method-redefinition funname nil (list class) 'defclass) (setf (class-direct-accessors class) (list* funname (do-defmethod funname (let* ((args (list :specializers (list <t> class) :qualifiers nil :lambda-list '(NEW-VALUE OBJECT) 'signature (sys::memoized (make-signature :req-num 2)) :slot-definition slot)) (method-class (apply #'writer-method-class class slot args))) (unless (and (defined-class-p method-class) (subclassp method-class <standard-writer-method>)) (error (TEXT "Wrong ~S result for class ~S: not a subclass of ~S: ~S") 'writer-method-class (class-name class) 'standard-writer-method method-class)) (apply #'make-instance method-class (nconc (method-function-initargs method-class (eval `(LOCALLY (DECLARE (COMPILE ,funname)) (%OPTIMIZE-FUNCTION-LAMBDA (T) (#:CONTINUATION NEW-VALUE OBJECT) (DECLARE (COMPILE)) (SETF ,access-place NEW-VALUE))))) args)))) (class-direct-accessors class)))) (progn (sys::check-redefinition funname 'defclass (sys::fbound-string (sys::get-funname-symbol funname))) (setf (fdefinition funname) (eval `(FUNCTION ,funname (LAMBDA (NEW-VALUE OBJECT) ,@(if *compile-accessor-functions* `((DECLARE (COMPILE ,funname)))) (UNLESS (TYPEP OBJECT ',class) (ERROR-ACCESSOR-TYPECHECK ',funname OBJECT ',class)) (SETF ,access-place NEW-VALUE))))))))))))) ;; Remove a set of accessor methods given as a plist. (defun remove-accessor-methods (plist) (do ((l plist (cddr l))) ((endp l)) (let ((funname (car l)) (method (cadr l))) (remove-method (fdefinition funname) method)))) ;; Add a set of accessor methods given as a plist. (defun add-accessor-methods (plist) (do ((l plist (cddr l))) ((endp l)) (let ((funname (car l)) (method (cadr l))) (add-method (fdefinition funname) method)))) ;; --------------- Creation of an instance of <built-in-class> --------------- (defun make-instance-<built-in-class> (metaclass &rest args &key name (direct-superclasses '()) &allow-other-keys) ;; metaclass = <built-in-class> ;; Don't add functionality here! This is a preliminary definition that is ;; replaced with #'make-instance later. (declare (ignore metaclass name direct-superclasses)) (let ((class (allocate-metaobject-instance *<built-in-class>-class-version* *<built-in-class>-instance-size*))) (apply #'initialize-instance-<built-in-class> class args))) (defun initialize-instance-<built-in-class> (class &rest args &key &allow-other-keys) ;; Don't add functionality here! This is a preliminary definition that is ;; replaced with #'initialize-instance later. (apply #'shared-initialize-<built-in-class> class 't args) (install-class-direct-accessors class) class) (defun shared-initialize-<built-in-class> (class situation &rest args &key (name nil name-p) (direct-superclasses '() direct-superclasses-p) ((prototype prototype) nil prototype-p) &allow-other-keys) (when (or (eq situation 't) direct-superclasses-p) (check-metaclass-mix (if name-p name (class-classname class)) direct-superclasses #'built-in-class-p 'built-in-class)) (apply #'shared-initialize-<defined-class> class situation args) ; Initialize the remaining <defined-class> slots: (when (or (eq situation 't) direct-superclasses-p) (setf (class-precedence-list class) (checked-compute-class-precedence-list class)) (when (eq situation 't) (setf (class-initialized class) 3)) (setf (class-all-superclasses class) (std-compute-superclasses (class-precedence-list class))) (when (eq situation 't) (setf (class-initialized class) 4))) (when (eq situation 't) (setf (class-slots class) '()) (setf (class-initialized class) 5) (setf (class-default-initargs class) '()) (setf (class-initialized class) 6)) (when (or (eq situation 't) prototype-p) (setf (sys::%record-ref class *<built-in-class>-prototype-location*) prototype)) ; Done. class) ;; --------------- Creation of an instance of <structure-class> --------------- (defun make-instance-<structure-class> (metaclass &rest args &key name (direct-superclasses '()) ;; The following keys come from ENSURE-CLASS. ((:direct-slots direct-slots-as-lists) '()) (direct-default-initargs '()) (documentation nil) ;; The following keys come from DEFINE-STRUCTURE-CLASS. ((names names) nil) ((kconstructor kconstructor) nil) ((boa-constructors boa-constructors) '()) ((copier copier) nil) ((predicate predicate) nil) ((direct-slots direct-slots-as-metaobjects) '()) ((slots slots) '()) ((size size) 1) &allow-other-keys) ;; metaclass = <structure-class> ;; Don't add functionality here! This is a preliminary definition that is ;; replaced with #'make-instance later. (declare (ignore metaclass name direct-superclasses direct-slots-as-lists direct-default-initargs documentation names kconstructor boa-constructors copier predicate direct-slots-as-metaobjects slots size)) (let ((class (allocate-metaobject-instance *<structure-class>-class-version* *<structure-class>-instance-size*))) (apply #'initialize-instance-<structure-class> class args))) (defun initialize-instance-<structure-class> (class &rest args &key &allow-other-keys) ;; Don't add functionality here! This is a preliminary definition that is ;; replaced with #'initialize-instance later. (apply #'shared-initialize-<structure-class> class 't args) ;; avoid slot accessor redefinition warning ;; (install-class-direct-accessors class) class) (defun shared-initialize-<structure-class> (class situation &rest args &key (name nil name-p) (direct-superclasses '() direct-superclasses-p) (generic-accessors t generic-accessors-p) ;; The following keys come from ENSURE-CLASS. ((:direct-slots direct-slots-as-lists) '() direct-slots-as-lists-p) (direct-default-initargs '() direct-default-initargs-p) (documentation nil documentation-p) ;; The following keys come from DEFINE-STRUCTURE-CLASS. ((names names) nil names-p) ((kconstructor kconstructor) nil kconstructor-p) ((boa-constructors boa-constructors) '() boa-constructors-p) ((copier copier) nil copier-p) ((predicate predicate) nil predicate-p) ((direct-slots direct-slots-as-metaobjects) '() direct-slots-as-metaobjects-p) ((slots slots) '()) ((size size) 1) &allow-other-keys) ;; metaclass ⊆ <structure-class> (declare (ignore generic-accessors generic-accessors-p direct-slots-as-lists direct-slots-as-metaobjects direct-default-initargs documentation documentation-p)) (when (or (eq situation 't) direct-superclasses-p) (check-metaclass-mix (if name-p name (class-classname class)) direct-superclasses #'structure-class-p 'STRUCTURE-CLASS)) (apply #'shared-initialize-<slotted-class> class situation args) (setq direct-superclasses (class-direct-superclasses class)) ; augmented ; Initialize the remaining <defined-class> slots: (when (or (eq situation 't) direct-superclasses-p) (setf (class-precedence-list class) (checked-compute-class-precedence-list class)) (when (eq situation 't) (setf (class-initialized class) 3)) (setf (class-all-superclasses class) (std-compute-superclasses (class-precedence-list class))) (when (eq situation 't) (setf (class-initialized class) 4))) (when (or (eq situation 't) direct-superclasses-p direct-slots-as-lists-p direct-slots-as-metaobjects-p) (setf (class-slots class) slots) (when (eq situation 't) (setf (class-initialized class) 5)) (setf (class-slot-location-table class) (compute-slot-location-table class)) (setf (class-instance-size class) size) (unless names (setf (class-instance-size class) 1) (setf (class-slots class) (compute-slots-<slotted-class>-around class #'compute-slots-<defined-class>-primary)) (setf (class-instance-size class) (max size (compute-instance-size class))) (when (class-slots class) (let ((ht (class-slot-location-table class))) (when (eq ht empty-ht) ; avoid clobbering empty-ht! (setq ht (setf (class-slot-location-table class) (make-hash-table :key-type 'symbol :value-type 't :test 'ext:stablehash-eq :warn-if-needs-rehash-after-gc t)))) (dolist (slot (class-slots class)) (setf (gethash (slot-definition-name slot) ht) (slot-definition-location slot))))) (when (plusp (compute-shared-size class)) (error-of-type 'error (TEXT "(~S ~S): metaclass ~S does not support shared slots") 'DEFCLASS name 'STRUCTURE-CLASS)))) (when (or (eq situation 't) direct-superclasses-p direct-default-initargs-p) (setf (class-default-initargs class) (checked-compute-default-initargs class))) (when (eq situation 't) (setf (class-initialized class) 6)) ; Initialize the remaining <slotted-class> slots: (when (or (eq situation 't) direct-superclasses-p) (setf (class-subclass-of-stablehash-p class) (std-compute-subclass-of-stablehash-p class))) (when (or (eq situation 't) direct-superclasses-p direct-slots-as-lists-p direct-slots-as-metaobjects-p) (setf (class-valid-initargs-from-slots class) (remove-duplicates (mapcap #'slot-definition-initargs (class-slots class))))) ; Initialize the remaining <structure-class> slots: (when (or (eq situation 't) direct-superclasses-p names-p) (unless names (setq names (cons name (if direct-superclasses (class-names (first direct-superclasses)) '())))) (setf (class-names class) names)) (when (or (eq situation 't) kconstructor-p) (setf (class-kconstructor class) kconstructor)) (when (or (eq situation 't) boa-constructors-p) (setf (class-boa-constructors class) boa-constructors)) (when (or (eq situation 't) copier-p) (setf (class-copier class) copier)) (when (or (eq situation 't) predicate-p) (setf (class-predicate class) predicate)) (when (eq situation 't) (setf (sys::%record-ref class *<structure-class>-prototype-location*) nil)) ; Done. (when (eq situation 't) (system::note-new-structure-class)) class) ;; DEFSTRUCT-Hook (defun define-structure-class (name names keyword-constructor boa-constructors copier predicate all-slots direct-slots) ; ABI (setf (find-class name) (make-instance-<structure-class> <structure-class> :name name :direct-superclasses (if (cdr names) (list (find-class (second names))) '()) 'names names 'kconstructor keyword-constructor 'boa-constructors boa-constructors 'copier copier 'predicate predicate 'direct-slots direct-slots 'slots all-slots 'size (if all-slots (1+ (slot-definition-location (car (last all-slots)))) 1) :generic-accessors nil 'clos::defclass-form 'defstruct))) (defun undefine-structure-class (name) ; ABI (setf (find-class name) nil)) ;; ------------- Creation of an instance of <semi-standard-class> ------------- (defun shared-initialize-<semi-standard-class> (class situation &rest args &key (direct-superclasses '() direct-superclasses-p) ((:direct-slots direct-slots-as-lists) '() direct-slots-as-lists-p) ((direct-slots direct-slots-as-metaobjects) '() direct-slots-as-metaobjects-p) (direct-default-initargs '() direct-default-initargs-p) (documentation nil documentation-p) (generic-accessors t generic-accessors-p) (fixed-slot-locations nil fixed-slot-locations-p) &allow-other-keys) (declare (ignore direct-superclasses direct-superclasses-p direct-slots-as-lists direct-slots-as-lists-p direct-slots-as-metaobjects direct-slots-as-metaobjects-p direct-default-initargs direct-default-initargs-p documentation documentation-p generic-accessors generic-accessors-p)) (apply #'shared-initialize-<slotted-class> class situation args) (when (eq situation 't) (setf (class-current-version class) (make-class-version :newest-class class :class class :serial 0)) (unless *classes-finished* ; Bootstrapping: Simulate the effect of #'%shared-initialize. (setf (class-instantiated class) nil) (setf (class-direct-instance-specializers-table class) '()) (setf (class-finalized-direct-subclasses-table class) '()))) ; Initialize the remaining <defined-class> slots: (setf (class-initialized class) 2) ; mark as not yet finalized (setf (class-precedence-list class) nil) ; mark as not yet finalized (setf (class-all-superclasses class) nil) ; mark as not yet finalized ; Initialize the remaining <slotted-class> slots: ; Initialize the remaining <semi-standard-class> slots: (when (or (eq situation 't) fixed-slot-locations-p) ;; Convert from list to boolean. (when (consp fixed-slot-locations) (setq fixed-slot-locations (car fixed-slot-locations))) (setf (class-fixed-slot-locations class) fixed-slot-locations)) (setf (class-prototype class) nil) ; Try to finalize it. (when (finalizable-p class) (finalize-inheritance class)) ; Done. class) ;; ------------- Finalizing an instance of <semi-standard-class> ------------- ;; Tests whether a class can be finalized, by recursing on the ;; direct-superclasses list. May call finalize-inheritance on some of the ;; superclasses. ;; Returns T if all the direct-superclasses could be finalized. ;; Returns NIL if this is not possible, and as second value a list from the ;; direct-superclass that couldn't be finalized up to the forward-reference ;; that is not yet defined. (defun finalizable-p (class &optional (stack nil)) (assert (defined-class-p class)) (when (memq class stack) (error-of-type 'program-error (TEXT "~S: class definition circularity: ~S depends on itself") 'defclass class)) (let ((stack (cons class stack))) (do ((superclassesr (class-direct-superclasses class) (cdr superclassesr))) ((endp superclassesr)) (let ((superclass (car superclassesr))) (unless (defined-class-p superclass) (unless (forward-reference-to-class-p superclass) (error (TEXT "~S has a direct-superclasses element ~S, which is invalid.") class superclass)) (let ((real-superclass (or (find-class (class-name superclass) nil) (return-from finalizable-p (values nil (list superclass)))))) ;; Changed from forward-reference-to-class to defined-class. (check-allowed-superclass class real-superclass) (setf (car superclassesr) real-superclass) (remove-direct-subclass superclass class) (add-direct-subclass real-superclass class) (setq superclass real-superclass))) (assert (defined-class-p superclass)) (unless (>= (class-initialized superclass) 6) ; not already finalized? ;; Here we get only for instances of STANDARD-CLASS, since instances ;; of BUILT-IN-CLASS and STRUCTURE-CLASS are already finalized when ;; they are constructed. (multiple-value-bind (done failure-cause) (finalizable-p superclass stack) (unless done ;; Finalization of a superclass was impossible. (return-from finalizable-p (values nil (cons superclass failure-cause))))) ;; Now finalize the superclass. (We could also do this later, from ;; inside finalize-inheritance, but then we would need some extra ;; bookkeeping to ensure that the running time for a class hierarchy ;; like this ;; A1 ;; / \ ;; B1 C1 ;; \ / ;; A2 ;; / \ ;; B2 C2 ;; \ / ;; A3 ;; .... ;; A(n-1) ;; / \ ;; B(n-1) C(n-1) ;; \ / ;; An ;; is linear, not exponential, in the number of classes.) (finalize-inheritance superclass))))) t) ;; Preliminary. (predefun finalize-inheritance (class) (finalize-inheritance-<semi-standard-class> class)) (defun finalize-inheritance-<semi-standard-class> (class) (multiple-value-bind (done failure-cause) (finalizable-p class) (unless done (let ((pretty-cause (mapcar #'class-pretty (cons class failure-cause)))) (error (TEXT "~S: Cannot finalize class ~S. ~:{Class ~S inherits from class ~S. ~}Class ~S is not yet defined.") 'finalize-inheritance (first pretty-cause) (mapcar #'list pretty-cause (rest pretty-cause)) (car (last pretty-cause)))))) ;; Now we know that all direct superclasses are finalized. (when (boundp 'class-finalized-p) (assert (every #'class-finalized-p (class-direct-superclasses class)))) ;; Now compute the class-precedence-list. (finalize-instance-semi-standard-class class) class) (defun finalize-instance-semi-standard-class (class &aux (direct-superclasses (class-direct-superclasses class)) (name (class-name class)) (old-slot-location-table (class-slot-location-table class))) ;; metaclass ⊆ <semi-standard-class> (if (standard-class-p class) (check-metaclass-mix name direct-superclasses #'standard-class-p 'STANDARD-CLASS) (check-metaclass-mix name direct-superclasses #'semi-standard-class-p 'SEMI-STANDARD-CLASS)) (setf (class-precedence-list class) (checked-compute-class-precedence-list class)) (when (< (class-initialized class) 3) (setf (class-initialized class) 3)) (setf (class-all-superclasses class) (std-compute-superclasses (class-precedence-list class))) (when (< (class-initialized class) 4) (setf (class-initialized class) 4)) (dolist (super direct-superclasses) (when (semi-standard-class-p super) (add-finalized-direct-subclass super class))) (setf (class-subclass-of-stablehash-p class) (std-compute-subclass-of-stablehash-p class)) (setf (class-funcallablep class) ; <funcallable-standard-object> or a subclass of it? (if (gethash <function> (class-all-superclasses class)) t nil)) (setf (class-instance-size class) (if (class-funcallablep class) 3 ; see comments in clos-genfun1.lisp 1)) ; slot 0 is the class_version pointer (setf (class-slots class) (checked-compute-slots class)) (when (< (class-initialized class) 5) (setf (class-initialized class) 5)) (setf (class-instance-size class) (compute-instance-size class)) (setf (class-slot-location-table class) (compute-slot-location-table class)) (let ((shared-size (compute-shared-size class))) (when (plusp shared-size) (setf (cv-shared-slots (class-current-version class)) (create-shared-slots-vector class shared-size old-slot-location-table)))) ;; CLtL2 28.1.3.3., ANSI CL 4.3.4.2. Inheritance of Class Options (setf (class-default-initargs class) (checked-compute-default-initargs class)) (setf (class-valid-initargs-from-slots class) (remove-duplicates (mapcap #'slot-definition-initargs (class-slots class)))) (when (< (class-initialized class) 6) (setf (class-initialized class) 6)) (system::note-new-standard-class)) ;; ------------- Redefining an instance of <semi-standard-class> ------------- ;; Preliminary definition. (predefun make-instances-obsolete (class) (make-instances-obsolete-<semi-standard-class> class)) (defun make-instances-obsolete-<semi-standard-class> (class) (when (>= (class-initialized class) 6) ; nothing to do if not yet finalized ;; Recurse to the subclasses. (Even if there are no direct instances of ;; this class: the subclasses may have instances.) (mapc #'make-instances-obsolete-<semi-standard-class>-nonrecursive (list-all-finalized-subclasses class)))) (defun make-instances-obsolete-<semi-standard-class>-nonrecursive (class) (if (and (>= (class-initialized class) 4) ; already finalized? (subclassp class <metaobject>)) ; Don't obsolete metaobject instances. (let ((name (class-name class)) (caller *make-instances-obsolete-caller*) ;; Rebind *make-instances-obsolete-caller* because WARN may enter a ;; nested REP-loop. (*make-instances-obsolete-caller* 'make-instances-obsolete)) (clos-warning (TEXT "~S: Class ~S (or one of its ancestors) is being redefined, but its instances cannot be made obsolete") caller name)) (progn (when (class-instantiated class) ; don't warn if there are no instances (let ((name (class-name class)) (caller *make-instances-obsolete-caller*) ;; Rebind *make-instances-obsolete-caller* because WARN may enter a ;; nested REP-loop. (*make-instances-obsolete-caller* 'make-instances-obsolete)) (if (eq caller 'defclass) (clos-warning (TEXT "~S: Class ~S (or one of its ancestors) is being redefined, instances are obsolete") caller name) (clos-warning (TEXT "~S: instances of class ~S are made obsolete") caller name)))) ;; Create a new class-version. (Even if there are no instances: the ;; shared-slots may need change.) (let* ((copy (copy-standard-class class)) (old-version (class-current-version copy)) (new-version (make-class-version :newest-class class :class class :serial (1+ (cv-serial old-version))))) (setf (cv-class old-version) copy) (setf (cv-next old-version) new-version) (setf (class-current-version class) new-version))))) ;; After a class redefinition, finalize the subclasses so that the instances ;; can be updated. (defun update-subclasses-for-redefined-class (class was-finalized must-be-finalized old-direct-superclasses) (when was-finalized ; nothing to do if not finalized before the redefinition ;; Handle the class itself specially, because its superclasses list now is ;; not the same as before. (setf (class-initialized class) 2) ; mark as not yet finalized (setf (class-precedence-list class) nil) ; mark as not yet finalized (setf (class-all-superclasses class) nil) ; mark as not yet finalized (if must-be-finalized ;; The class remains finalized. (progn (finalize-inheritance class) (let ((new-direct-superclasses (class-direct-superclasses class))) (unless (equal old-direct-superclasses new-direct-superclasses) (let ((removed-direct-superclasses (set-difference old-direct-superclasses new-direct-superclasses)) (added-direct-superclasses (set-difference new-direct-superclasses old-direct-superclasses))) (dolist (super removed-direct-superclasses) (when (semi-standard-class-p super) (remove-finalized-direct-subclass super class))) (dolist (super added-direct-superclasses) (when (semi-standard-class-p super) (add-finalized-direct-subclass super class))))))) ;; The class becomes unfinalized. (dolist (super old-direct-superclasses) (when (semi-standard-class-p super) (remove-finalized-direct-subclass super class)))) ;; Now handle the true subclasses. (mapc #'update-subclasses-for-redefined-class-nonrecursive (rest (list-all-finalized-subclasses class))))) (defun update-subclasses-for-redefined-class-nonrecursive (class) (when (>= (class-initialized class) 6) ; nothing to do if not yet finalized (setf (class-initialized class) 2) ; mark as not yet finalized (setf (class-precedence-list class) nil) ; mark as not yet finalized (setf (class-all-superclasses class) nil) ; mark as not yet finalized (if (class-instantiated class) ;; The class remains finalized. (finalize-inheritance class) ;; The class becomes unfinalized. If it has an instantiated subclass, the ;; subclass' finalize-inheritance invocation will re-finalize this one. (dolist (super (class-direct-superclasses class)) (when (semi-standard-class-p super) (remove-finalized-direct-subclass super class)))))) ;; After a class redefinition that changed the class-precedence-list, ;; update the generic functions that use specializers whose object is a ;; direct instance of this class or of a subclass. (defun update-subclass-instance-specializer-generic-functions (class) (dolist (subclass (list-all-finalized-subclasses class)) ;; Since the CPL of the class has changed, the CPL of the subclass has ;; most likely changed as well. It is not worth testing whether it has ;; really changed. (dolist (specializer (list-direct-instance-specializers subclass)) ;; specializer's location in the type hierarchy has now changed. (dolist (gf (specializer-direct-generic-functions specializer)) (when (typep-class gf <standard-generic-function>) ;; Clear the discriminating function. ;; The effective method cache does not need to be invalidated. #|(setf (std-gf-effective-method-cache gf) '())|# (finalize-fast-gf gf)))))) ;; After a class redefinition that changed the class-precedence-list, ;; update the generic functions that could be affected. (defun update-subclass-cpl-specializer-generic-functions (class old-cpl new-cpl) ;; Class definitions change the type hierarchy, therefore the discriminating ;; function of some generic functions has to be invalidated and recomputed ;; later. ;; The effective method cache does not need to be invalidated, since it takes ;; a sorted method list as input and compute-effective-method-as-function ;; doesn't do computations in the type hierarchy. ;; ;; Now, which generic functions are affected? The discriminating function of ;; a generic depends on the following. (x denotes an object occurring as ;; argument, and x-class means (class-of x).) ;; 1. The computation of the applicable method list for given arguments x ;; depends on ;; (subclassp x-class specializer) ;; for all specializers occurring in methods of the GF. ;; 2. The discriminating function is also free to exploit the result of ;; (subclassp specializer1 specializer2) ;; for any two specializer1, specializer2 occurring in methods of the GF. ;; 3. The sorting of the applicable method list for given arguments x ;; depends on the relative order of specializer1 and specializer2 in ;; (cpl x-class), for any two specializer1, specializer2 occurring in ;; methods of the GF. ;; ;; What effects can a change of (cpl class) = old-cpl -> new-cpl have? ;; Assume that some classes S+ are added, some classes S- are removed from ;; the CPL, and some classes S* are reordered in the CPL. What effects does ;; this have on (cpl o-class), where o-class is any other class? ;; - If o-class is not a subclass of class, (cpl o-class) doesn't change. ;; - If o-class if subclass of class, ;; the elements of S+ are added or, if already present, possibly ;; reordered, ;; the elements of S- are possibly removed or reordered, ;; the elements of S* are possibly reordered. ;; ("Possibly" because o-class can also inherit from other classes that ;; are not under the given class but under elements of S+, S-, S*.) ;; ;; Now back to the problem of finding the affected generic functions. ;; 1. (subclassp x-class specializer) == (member specializer (cpl x-class)) ;; - doesn't change if x-class is not a subclass of class, ;; - doesn't change if specializer is not an element of S+ or S-. ;; Because of the implicit "for all x", we cannot exploit the first ;; statement. But the second statement tells us that we have to go ;; from the elements of S+ and S- to the methods and generic functions ;; using these classes as specializers. ;; 2. (subclassp specializer1 specializer2) ;; == (member specializer2 (cpl specializer1)) ;; - doesn't change if specializer1 is not a subclass of class, ;; - doesn't change if specializer2 is not an element of S+ or S-. ;; So we have to intersect ;; - the set of GFs using a subclass of class as specializer, ;; - the set of GFs using an element of S+ or S- as specializer. ;; This is a subset of the one we got in point 1. It is redundant. ;; 3. We know that if ;; old (cpl x-class) = (... specializer1 ... specializer2 ...) ;; and new (cpl x-class) = (... specializer2 ... specializer1 ...) ;; then x-class is a subclass of the given class, and one of ;; specializer1, specializer2 (at least) is a member of S+, S- or S*. ;; Because of the implicit "for all x", the first condition is hard to ;; exploit: we need to recurse through all x-class that are subclasses ;; the given class. It is easier to exploit the second condition: ;; Go from the elements of S+, S-, S* to the methods and generic functions ;; using these classes as specializers. ;; ;; Cf. MOP p. 41 compute-discriminating-function item (iv). This says that ;; all generic functions which use a specializer whose class precedence list ;; has changed (i.e. essentially a specializer which is a subclass of the ;; given class) should invalidate their discriminating function. This is not ;; needed! ;; ;; Cf. MOP p. 41 compute-discriminating-function item (v). This says that ;; all generic functions which have a cache entry containing a class whose ;; class precedence list has changed (i.e. essentially a subclass of the ;; given class) should invalidate their discriminating function. This is ;; also far more than is needed; all that's needed is 1. and 3. ;; (declare (ignore class)) (let* ((added-superclasses (set-difference new-cpl old-cpl)) (removed-superclasses (set-difference old-cpl new-cpl)) (permuted-superclasses (let ((common-superclasses-in-old-order (remove-if #'(lambda (x) (memq x removed-superclasses)) (the list old-cpl))) (common-superclasses-in-new-order (remove-if #'(lambda (x) (memq x added-superclasses)) (the list new-cpl)))) (assert (= (length common-superclasses-in-old-order) (length common-superclasses-in-new-order))) (subseq common-superclasses-in-old-order 0 (or (mismatch common-superclasses-in-old-order common-superclasses-in-new-order :test #'eq :from-end t) 0))))) ;; Build the set of affected generic functions. (let ((gf-set (make-hash-table :key-type 'generic-function :value-type '(eql t) :test 'ext:fasthash-eq))) (dolist (specializer (append added-superclasses removed-superclasses permuted-superclasses)) (dolist (gf (specializer-direct-generic-functions specializer)) (setf (gethash gf gf-set) t))) #| (format *debug-io* "~&added = ~:S, removed = ~:S, permuted = ~:S, affected = ~:S~%" added-superclasses removed-superclasses permuted-superclasses (let ((l '())) (maphash #'(lambda (gf ignored) (declare (ignore ignored)) (push gf l)) gf-set) l)) |# ;; Clear their discriminating function. (maphash #'(lambda (gf ignored) (declare (ignore ignored)) (when (typep-class gf <standard-generic-function>) (finalize-fast-gf gf))) gf-set)))) ;; Store the information needed by the update of obsolete instances in a ;; class-version object. Invoked when an instance needs to be updated. (defun class-version-compute-slotlists (old-version) (let ((old-class (cv-class old-version)) (new-class (cv-class (cv-next old-version))) ; old-class is already finalized - otherwise no instance could exist. ; new-class is already finalized, because ensure-class guarantees it. (kept2 '()) (added '()) (discarded '()) (discarded2 '())) (dolist (old-slot (class-slots old-class)) (let* ((name (slot-definition-name old-slot)) (new-slot (find name (class-slots new-class) :test #'eq :key #'slot-definition-name))) (if (and new-slot (atom (slot-definition-location new-slot))) ;; Local slot remains local, or shared slot becomes local. (setq kept2 (list* (slot-definition-location old-slot) (slot-definition-location new-slot) kept2)) (if (atom (slot-definition-location old-slot)) ;; Local slot is discarded or becomes shared. (setq discarded (cons name discarded) discarded2 (list* name (slot-definition-location old-slot) discarded2)))))) (dolist (new-slot (class-slots new-class)) (let* ((name (slot-definition-name new-slot)) (old-slot (find name (class-slots old-class) :test #'eq :key #'slot-definition-name))) (unless old-slot ;; Newly added local slot. (setq added (cons name added))))) (setf (cv-kept-slot-locations old-version) kept2) (setf (cv-added-slots old-version) added) (setf (cv-discarded-slots old-version) discarded) (setf (cv-discarded-slot-locations old-version) discarded2) (setf (cv-slotlists-valid-p old-version) t))) ;; -------------- Auxiliary functions for <semi-standard-class> -------------- ;;; Maintaining the list of eql-specializers of direct instances that are or ;;; were used in a method. (We need this for notifying the generic functions ;;; to which these methods belong, when the class or a superclass of it is ;;; redefined in a way that changes the class-precedence-list.) #| ;; Adds a class to the list of direct instance specializers. (defun add-direct-instance-specializer (class eql-specializer) ...) ;; Removes a class from the list of direct instance specializers. (defun remove-direct-instance-specializer (class eql-specializer) ...) ;; Returns the currently existing direct instance specializers, as a freshly ;; consed list. (defun list-direct-instance-specializers (class) ...) |# (def-weak-set-accessors class-direct-instance-specializers-table eql-specializer add-direct-instance-specializer remove-direct-instance-specializer list-direct-instance-specializers) ;;; Maintaining the weak references to the finalized direct subclasses. ;;; (We need only the finalized subclasses, because: ;;; - The only use of these references is for make-instances-obsolete and for ;;; update-subclasses-for-redefined-class. ;;; - A non-finalized class cannot have instances. ;;; - Without an instance one cannot even access the shared slots.) ;;; The finalized-direct-subclasses slot can be either ;;; - NIL or a weak-list (for saving memory when there are few subclasses), or ;;; - a weak-hash-table (for speed when there are many subclasses). #| ;; Adds a class to the list of direct subclasses. (defun add-finalized-direct-subclass (class subclass) ...) ;; Removes a class from the list of direct subclasses. (defun remove-finalized-direct-subclass (class subclass) ...) ;; Returns the currently existing direct subclasses, as a freshly consed list. (defun list-finalized-direct-subclasses (class) ...) |# (def-weak-set-accessors class-finalized-direct-subclasses-table class add-finalized-direct-subclass remove-finalized-direct-subclass list-finalized-direct-subclasses) ;; Returns the currently existing finalized subclasses, in top-down order, ;; including the class itself as first element. (defun list-all-finalized-subclasses (class) ; Use a breadth-first search which removes duplicates. (let ((as-list '()) (as-set (make-hash-table :key-type 'defined-class :value-type '(eql t) :test 'ext:stablehash-eq :warn-if-needs-rehash-after-gc t :rehash-size 2s0)) (pending (list class))) (loop (unless pending (return)) (let ((new-pending '())) (dolist (class pending) (unless (gethash class as-set) (push class as-list) (setf (gethash class as-set) t) (setq new-pending (nreconc (if (semi-standard-class-p class) ; <semi-standard-class> stores the finalized direct-subclasses. (list-finalized-direct-subclasses class) ; <defined-class> stores only the complete direct-subclasses list. (remove-if-not #'(lambda (c) (= (class-initialized c) 6)) (checked-class-direct-subclasses class))) new-pending)))) (setq pending (nreverse new-pending)))) ;; Now reorder the list so that superclasses come before, not after, a ;; class. This is needed by update-subclasses-for-redefined-class. (It's ;; a "topological sorting" algorithm w.r.t. to the superclass relation.) (let ((tsorted-list '())) (labels ((add-with-superclasses-first (cls) (when (gethash cls as-set) (remhash cls as-set) (dolist (supercls (class-direct-superclasses cls)) (add-with-superclasses-first supercls)) (push cls tsorted-list)))) (mapc #'add-with-superclasses-first as-list)) (setq tsorted-list (nreverse tsorted-list)) (assert (eq (first tsorted-list) class)) tsorted-list))) ;; --------------- Creation of an instance of <standard-class> --------------- (defun make-instance-<standard-class> (metaclass &rest args &key name (direct-superclasses '()) (direct-slots '()) (direct-default-initargs '()) &allow-other-keys) ;; metaclass = <standard-class> ;; Don't add functionality here! This is a preliminary definition that is ;; replaced with #'make-instance later. (declare (ignore metaclass name direct-superclasses direct-slots direct-default-initargs)) (let ((class (allocate-metaobject-instance *<standard-class>-class-version* *<standard-class>-instance-size*))) (apply #'initialize-instance-<standard-class> class args))) (defun initialize-instance-<standard-class> (class &rest args &key &allow-other-keys) ;; Don't add functionality here! This is a preliminary definition that is ;; replaced with #'initialize-instance later. (apply #'shared-initialize-<standard-class> class 't args) (install-class-direct-accessors class) class) (defun shared-initialize-<standard-class> (class situation &rest args &key (direct-superclasses '() direct-superclasses-p) ((:direct-slots direct-slots-as-lists) '() direct-slots-as-lists-p) ((direct-slots direct-slots-as-metaobjects) '() direct-slots-as-metaobjects-p) (direct-default-initargs '() direct-default-initargs-p) (documentation nil documentation-p) (generic-accessors t generic-accessors-p) (fixed-slot-locations nil fixed-slot-locations-p) &allow-other-keys) (declare (ignore direct-superclasses direct-superclasses-p direct-slots-as-lists direct-slots-as-lists-p direct-slots-as-metaobjects direct-slots-as-metaobjects-p direct-default-initargs direct-default-initargs-p documentation documentation-p generic-accessors generic-accessors-p fixed-slot-locations fixed-slot-locations-p)) (apply #'shared-initialize-<semi-standard-class> class situation args) class) ;; --------------------------------------------------------------------------- ;; Bootstrapping (progn (setq <function> nil) ;; 1. Define the class <t>. (setq <t> (make-instance-<built-in-class> nil :name 't :direct-superclasses '() 'prototype (byte 1 0))) (setf (find-class 't) <t>) ;; 2. Define the class <standard-object>. (setq <standard-object> (let ((*allow-mixing-metaclasses* t)) (make-instance-<standard-class> nil :name 'standard-object :direct-superclasses `(,<t>) :direct-slots '() :slots '() :slot-location-table empty-ht :instance-size 1 :direct-default-initargs '() :default-initargs '()))) (setf (find-class 'standard-object) <standard-object>) ;; 3. Define the class <metaobject>. (setq <metaobject> (macrolet ((form () *<metaobject>-defclass*)) (form))) ;; 4. Define the class <standard-stablehash>. (macrolet ((form () *<standard-stablehash>-defclass*)) (form)) ;; 5. Define the class <specializer>. (macrolet ((form () *<specializer>-defclass*)) (form)) ;; 6. Define the classes <super-class>, <potential-class>. (macrolet ((form () *<super-class>-defclass*)) (form)) (setq <potential-class> (macrolet ((form () *<potential-class>-defclass*)) (form))) ;; 7. Define the class <defined-class>. (setq <defined-class> (macrolet ((form () *<defined-class>-defclass*)) (form))) ;; 8. Define the class <built-in-class>. (setq <built-in-class> (macrolet ((form () *<built-in-class>-defclass*)) (form))) (replace-class-version <built-in-class> *<built-in-class>-class-version*) ;; 9. Define the classes <slotted-class>, <semi-standard-class>, ;; <standard-class>, <structure-class>. (macrolet ((form () *<slotted-class>-defclass*)) (form)) (setq <semi-standard-class> (macrolet ((form () *<semi-standard-class>-defclass*)) (form))) (setq <standard-class> (macrolet ((form () *<standard-class>-defclass*)) (form))) (replace-class-version <standard-class> *<standard-class>-class-version*) (setq <structure-class> (macrolet ((form () *<structure-class>-defclass*)) (form))) (replace-class-version <structure-class> *<structure-class>-class-version*) ;; 10. Define the class <structure-object>. (setq <structure-object> (let ((*allow-mixing-metaclasses* t)) (make-instance-<structure-class> <structure-class> :name 'structure-object :direct-superclasses `(,<t>) :direct-slots '() :direct-default-initargs '() 'names (list 'structure-object)))) (setf (find-class 'structure-object) <structure-object>) ;; 11. Define other classes whose definition was delayed. ;; Define the class <slot-definition>. (macrolet ((form () *<slot-definition>-defclass*)) (form)) ;; Define the class <direct-slot-definition>. (setq <direct-slot-definition> (macrolet ((form () *<direct-slot-definition>-defclass*)) (form))) ;; Define the class <effective-slot-definition>. (setq <effective-slot-definition> (macrolet ((form () *<effective-slot-definition>-defclass*)) (form))) ;; Define the class <standard-slot-definition>. (macrolet ((form () *<standard-slot-definition>-defclass*)) (form)) ;; Define the class <standard-direct-slot-definition>. (setq <standard-direct-slot-definition> (macrolet ((form () *<standard-direct-slot-definition>-defclass*)) (form))) (replace-class-version (find-class 'standard-direct-slot-definition) *<standard-direct-slot-definition>-class-version*) ;; Define the class <standard-effective-slot-definition>. (setq <standard-effective-slot-definition> (macrolet ((form () *<standard-effective-slot-definition>-defclass*)) (form))) (replace-class-version (find-class 'standard-effective-slot-definition) *<standard-effective-slot-definition>-class-version*) ;; Define the class <structure-direct-slot-definition>. (setq <structure-direct-slot-definition> (macrolet ((form () *<structure-direct-slot-definition>-defclass*)) (form))) (replace-class-version (find-class 'structure-direct-slot-definition) *<structure-direct-slot-definition>-class-version*) ;; Define the class <structure-effective-slot-definition>. (setq <structure-effective-slot-definition> (macrolet ((form () *<structure-effective-slot-definition>-defclass*)) (form))) (replace-class-version (find-class 'structure-effective-slot-definition) *<structure-effective-slot-definition>-class-version*) ;; Define the class <eql-specializer>. (setq <eql-specializer> (macrolet ((form () *<eql-specializer>-defclass*)) (form))) (replace-class-version (find-class 'eql-specializer) *<eql-specializer>-class-version*) ;; Define the classes <forward-reference-to-class>, ;; <misdesigned-forward-referenced-class>. (setq <forward-reference-to-class> (macrolet ((form () *<forward-reference-to-class>-defclass*)) (form))) (setq <misdesigned-forward-referenced-class> (macrolet ((form () *<misdesigned-forward-referenced-class>-defclass*)) (form))) );progn ;;; Install built-in classes: ;; See CLtL2 p. 783 table 28-1, ANSI CL 4.3.7. (macrolet ((def (&rest classes) (setq classes (reverse classes)) (let* ((prototype-form (pop classes)) (new (pop classes)) (name (intern (string-trim "<>" (symbol-name new))))) `(setf (find-class ',name) (setq ,new (make-instance-<built-in-class> <built-in-class> :name ',name :direct-superclasses (list ,@classes) ,@(unless (eq prototype-form '-+-ABSTRACT-+-) `('prototype ,prototype-form)))))))) ;(def <t> (byte 1 0)) (def <t> <character> #\Space) (def <t> <function> #'cons) (def <t> <hash-table> empty-ht) (def <t> <package> (find-package "KEYWORD")) (def <t> <pathname> (make-pathname)) #+LOGICAL-PATHNAMES (def <pathname> <logical-pathname> (logical-pathname ":")) ;!!!if UCFG_LISP_BUILTIN_RANDOM_STATE (def <t> <random-state> *random-state*) (def <t> <readtable> *readtable*) (def <t> <stream> -+-ABSTRACT-+-) (def <stream> <file-stream> (open *load-pathname* :direction :probe)) (def <stream> <synonym-stream> (make-synonym-stream '*terminal-io*)) (def <stream> <broadcast-stream> (make-broadcast-stream)) (def <stream> <concatenated-stream> (make-concatenated-stream)) (def <stream> <two-way-stream> (make-two-way-stream (make-concatenated-stream) (make-broadcast-stream))) (def <stream> <echo-stream> (make-echo-stream (make-concatenated-stream) (make-broadcast-stream))) (def <stream> <string-stream> (make-string-output-stream)) (def <t> <symbol> 't) (def <t> <sequence> -+-ABSTRACT-+-) (def <sequence> <list> -+-ABSTRACT-+-) (def <list> <cons> '(t)) (def <list> <symbol> <null> 'nil) (def <t> <array> '#2A()) (def <sequence> <array> <vector> '#()) (def <vector> <bit-vector> '#*) (def <vector> <string> "") (def <t> <number> -+-ABSTRACT-+-) (def <number> <complex> #c(3 4)) (def <number> <real> -+-ABSTRACT-+-) (def <real> <float> 1.0s0) (def <real> <rational> -+-ABSTRACT-+-) (def <rational> <ratio> 1/2) (def <rational> <integer> 0) ) ;; Continue bootstrapping. (%defclos ;; distinctive marks for CLASS-P *<standard-class>-class-version* *<structure-class>-class-version* *<built-in-class>-class-version* <defined-class> <potential-class> ;; built-in-classes for CLASS-OF - order in sync with constobj.d (vector <array> <bit-vector> <character> <complex> <cons> <float> <function> <hash-table> <integer> <list> <null> <package> <pathname> #+LOGICAL-PATHNAMES <logical-pathname> ;!!!if UCFG_LISP_BUILTIN_RANDOM_STATE <random-state> <ratio> <readtable> <stream> <file-stream> <synonym-stream> <broadcast-stream> <concatenated-stream> <two-way-stream> <echo-stream> <string-stream> <string> <symbol> <t> <vector>)) ;;; Intersection of two built-in-classes: ;; Deviations from the single-inheritance are only ;; (AND <sequence> <array>) = <vector> and (AND <list> <symbol>) = <null>. (defun bc-p (class) (or (built-in-class-p class) (eq class <standard-object>) (eq class <structure-object>))) (defun bc-and (class1 class2) ; returns (AND class1 class2) (cond ((subclassp class1 class2) class1) ((subclassp class2 class1) class2) ((or (and (subclassp <sequence> class1) (subclassp <array> class2)) (and (subclassp <sequence> class2) (subclassp <array> class1))) <vector>) ((or (and (subclassp <list> class1) (subclassp <symbol> class2)) (and (subclassp <list> class2) (subclassp <symbol> class1))) <null>) (t nil))) (defun bc-and-not (class1 class2) ; returns a class c with ; (AND class1 (NOT class2)) <= c <= class1 (cond ((subclassp class1 class2) nil) ((and (eq class1 <sequence>) (subclassp <vector> class2)) <list>) ((and (eq class1 <sequence>) (subclassp <list> class2)) <vector>) ((and (eq class1 <list>) (subclassp <null> class2)) <cons>) (t class1)))
145,804
Common Lisp
.lisp
2,601
41.249904
240
0.547996
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
2da03ff8fddc27c6ede06d7d99bf64f1329f03c1dcba7ab6584d8292d6bdebee
11,418
[ -1 ]
11,419
errorcodes.lisp
ufasoft_lisp/src/lisp/code/errorcodes.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (defmacro _error_code (code val) `(defconstant ,code ,val)) ;!!! `(defconstant ,code ,(+ #x8004B3B0 val))) (defmacro _define-error-codes (&body codes) (let ((n 0)) (labels ((_defconsts (r) (if r (cons (list 'defconstant (car r) (incf n)) (_defconsts (cdr r)))))) `(progn ,@(_defconsts codes))))) (_define-error-codes E_LISP_InvalidSyntax E_LISP_RParExpected E_LISP_TooFewArgs E_LISP_Exit E_LISP_SymbolExpected E_LISP_SymbolNotDeclared E_LISP_LabelNotFound E_LISP_BadFunction E_LISP_BadArgumentType E_LISP_MisplacedCloseParen E_LISP_InvalidDottedPair E_LISP_IllegalSetfPlace E_LISP_IllegalTypeSpecifier E_LISP_CERROR E_LISP_MaxLenOfToken E_LISP_UnexpectedEOF E_LISP_VariableUnbound E_LISP_Return E_LISP_Stop E_LISP_Run E_LISP_CallDoesNotMatch E_LISP_AbsentCloseParen E_LISP_MustBeSValue E_LISP_InvalidLambdaList E_LISP_UnboundSlot E_LISP_Unwind E_LISP_NoValue E_LISP_NoFillPointer E_LISP_IsNotVector E_LISP_IsNotArray E_LISP_IsNotStream E_LISP_IsNegative E_LISP_IsNotReadTable E_LISP_IsNotHashTable E_LISP_UnknownError E_LISP_IsNotRandomState E_LISP_NoPackageWithName E_LISP_DisabledReadEval E_LISP_IsNotRational E_LISP_InvalidSeqType E_LISP_IllegalTestArgument E_LISP_NotCoercedToChar E_LISP_UnrecognizedCharName E_LISP_StackOverflow E_LISP_DivisionByZero )
3,218
Common Lisp
.lisp
62
42.629032
240
0.499207
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
c6af4294fdad880d7dadcd5d560873a051d088b8664793016f153bea94cd8149
11,419
[ -1 ]
11,420
macro.lisp
ufasoft_lisp/src/lisp/code/macro.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# ;;; Important macros, loaded 2 times (before & after of expander) (eval-when (compile load eval) (setq *package* (find-package "SYS"))) (%putd 'when (make-macro (function when (lambda (form env) (declare (ignore env)) (let ((c (cadr form)) (r (cddr form))) `(if ,c (progn ,@r))))))) (%putd 'unless (make-macro (function unless (lambda (form env) (declare (ignore env)) (let ((c (cadr form)) (r (cddr form))) `(if ,c nil (progn ,@r))))))) (%putd 'defconstant (make-macro (function defconstant (lambda (form env) (declare (ignore env)) (let ((n (cadr form)) (v (caddr form)) (d (cadddr form)) (d-p (cdddr form))) `(progn (%proclaim-constant ',n ,v) ,(if d-p `(setf (documentation ',n 'variable) ',d)) ',n)))))) (defun complement (func) #'(lambda (&rest r) (not (apply func r)))) (defun constantly (val) #'(lambda (&rest r) (declare (ignore r)) val)) (defun _key (key) (or key #'identity)) (defun _end (end seq) (or end (length seq))) (defun _setf-name-p (n) (and (consp n) (eq (car n) 'setf))) (defun _test (item test test-not) (if test-not #'(lambda (z) (not (funcall test-not item z))) #'(lambda (z) (funcall (or test #'eql) item z)))) #| (defun _test-if (p) #'(lambda (z) (funcall p z))) (defun _test-if-not (p) #'(lambda (z) (not (funcall p z)))) |# (defun _list-test (mc g list key) (if list (if (funcall g (funcall key (funcall mc (car list)))) list (_list-test mc g (cdr list) key)))) (defun member-if (p list &key key) (_list-test #'identity p list (_key key))) (defun member-if-not (p list &key key) (member-if (complement p) list :key key)) (%putd 'lambda (make-macro (function lambda (lambda (form env) (declare (ignore env)) (let ((bvl-decls-and-body (cdr form))) (declare (ignore bvl-decls-and-body)) (list 'function form)))))) (defun _get-package (name) (let ((p (find-package name))) (if p p (error 'package-error :package (string name))))) (defun setf-symbol (symbol) (make-symbol (ext:string-concat "(SETF " (let ((pack (symbol-package symbol))) (if pack (package-name pack) "#")) ":" (symbol-name symbol) ")"))) (defun _subforms (x) (if x (cons (gensym) (_subforms (cdr x))))) (defun _gensyms (n) (if (zerop n) nil (cons (gensym) (_gensyms (1- n))))) (defun _concs (&rest r) (intern (apply #'ext:string-concat r))) (defconstant t 't) (defconstant *keyword-package* (find-package 'keyword)) (defun _lambda-list-keyword-p (x) (memq x lambda-list-keywords)) ;!!! (defconstant %class-structure-types '(class structure-object)) (defun _try-aux (a r) (cond ((and (null r) (null a)) nil) ((eq a '&aux) r) ((err)))) (defun _find-key (k args &optional def) (let* ((d '(:absent)) (v (getf args k d))) (if (eq v d) def v))) (defun _bind-key (lam args) (if lam (let ((a (car lam)) (r (cdr lam))) (cond ((_lambda-list-keyword-p a) (if (eq a '&allow-other-keys) (_try-aux (car r) (cdr r)) (_try-aux a r))) ((consp a) (let ((k (intern (symbol-name (car a)) *keyword-package*))) (cons (list (car a) `(_find-key ,k ,args ,(cadr a))) (_bind-key r args)))) (t (let ((k (intern (symbol-name a) *keyword-package*))) (cons (list a `(_find-key ,k ,args)) (_bind-key r args)))))))) (defun _try-key (a r args) (if (eq a '&environment) (cons (list (car r) '_e) (_try-key (cadr r) (cddr r) args)) (if (eq a '&key) (_bind-key r args) (_try-aux a r)))) (defun _bind-rest (lam args) (cons (list (car lam) args) (_try-key (cadr lam) (cddr lam) args))) (defun _try-rest (a r args) (if (memq a '(&rest &body)) (_bind-rest r args) (_try-key a r args))) (defun _bind-optional (lam args) (if lam (let ((a (car lam)) (r (cdr lam))) (cond ((consp a) (let ((n (car a)) (d (cadr a)) (p (cddr a))) (if p (list* (list n `(if ,args (car ,args) ,d)) (list (car p) args) (_bind-optional r `(cdr ,args))) (cons (list n `(if ,args (car ,args) ,d)) (_bind-optional r `(cdr ,args)))))) ((_lambda-list-keyword-p a) (_try-rest a r args)) (t (cons (list a `(car ,args)) (_bind-optional r `(cdr ,args)))))))) (defun _try-optional (a r args) (if (eq a '&optional) (_bind-optional r args) (_try-rest a r args))) (defun _macro-lam-list (lam whole &optional (args '_args)) (if lam (let ((a (car lam)) (r (cdr lam))) (cond ((consp a) (append (_macro-lam-list a a `(car ,args)) (_macro-lam-list r whole `(cdr ,args)))) ((_lambda-list-keyword-p a) (cond ((eq a '&whole) (cons (list (car r) whole) (_macro-lam-list (cdr r) whole))) ((eq a '&environment) (cons (list (car r) '_e) (_macro-lam-list (cdr r) whole))) ((_try-optional a r args)))) (t (cons (list a `(car ,args)) (if (listp r) (_macro-lam-list r whole `(cdr ,args)) (cons (list r `(cdr ,args)) nil)))))))) (defun _make-macro-expansion (macrodef) (let ((name (car macrodef)) (lam (cadr macrodef)) (forms (cddr macrodef))) `(lambda (_f _e &aux (_whole _f) (_args (cdr _f)) ,@(_macro-lam-list lam '_f)) (block ,name ,@forms)))) (%putd 'defmacro (make-macro (function defmacro (lambda (form env) (declare (ignore env)) (let* ((macrodef (cdr form)) (name (car macrodef))) (if (symbolp name) `(progn (%putd ',name (make-macro ,(_make-macro-expansion macrodef))) ',name) (error "Invalid defmacro"))))))) (defmacro loop (&body body) (let ((tag (gensym))) `(BLOCK NIL (TAGBODY ,tag ,@body (GO ,tag))))) (defun _prog (a body op env) (declare (ignore env)) (multiple-value-bind (forms decls) (parse-body body) (list 'block nil (list op a (cons 'declare decls) (cons 'tagbody forms))))) #|!!! (defun _prog (a r op) `(block nil (,op ,a ,@(_decls r) (tagbody ,@(_body r))))) |# (defmacro prog (a &body body &environment env) (_prog a body 'let env)) (defmacro prog* (a &rest body &environment env) (_prog a body 'let* env)) (defun _dodecls (a) (if a (cons (let ((d (car a))) (if (atom d) d (list (car d) (cadr d)))) (_dodecls (cdr a))))) (defun _dosteps (a) (if a (let ((r (_dosteps (cdr a))) (d (car a))) (if (and (consp d) (cddr d)) (list* (car d) (caddr d) r) r)))) (defun _do (vars test r body op setop env) (declare (ignore env)) (let ((_lab (gensym))) (multiple-value-bind (forms decls) (parse-body body) (list 'block nil (list op (_dodecls vars) (cons 'declare decls) (list 'tagbody _lab (list 'if test (list 'return (cons 'progn r))) (cons 'tagbody forms) (cons setop (_dosteps vars)) (list 'go _lab))))))) (defmacro do (vars (test &rest r) &body body &environment env) (_do vars test r body 'let 'psetq env)) (defmacro do* (vars (test &rest r) &body body &environment env) (_do vars test r body 'let* 'setq env)) (defmacro ecase (expr &body clauses) (list* 'case expr (append clauses '((ecase-error-flag))))) #| (_putd-macro 'ecase (function ecase (lambda (form env) (let ((expr (cadr form)) (clauses (cddr form))) (list* 'case expr (append clauses '((ecase-error-flag)))))))) |# (defmacro prog1 (x &rest r) `(values (multiple-value-prog1 ,@(cons x r)))) (defmacro prog2 (x y &rest r) `(progn ,x (prog1 ,@(cons y r)))) ;; returns the name of the implicit block for a function-name (defun function-block-name (funname) (if (atom funname) funname (second funname))) ;; inserts an implicit BLOCK in the BODY. ;; uses *VENV* and *FENV*. (defun add-implicit-block (name lb) ; (_pr "----------------add-implicit-block-------------") ; (_pr name lb) (cons (car lb) (multiple-value-bind (body-rest declarations docstring) (sys::parse-body (cdr lb) t) (append (if declarations (list (cons 'DECLARE declarations))) (if docstring (list docstring)) (list (list* 'BLOCK (function-block-name name) body-rest))))))
11,429
Common Lisp
.lisp
231
37.008658
240
0.474207
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
cbe8ef67f308285b69c393681b3aa771c9ff922417a5253cb847b876af5836b4
11,420
[ -1 ]
11,421
print-builtin.lisp
ufasoft_lisp/src/lisp/code/print-builtin.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "SYS") (defun _print-character (c s) (if (or *print-readably* *print-escape*) (let ((r (char-name c))) (write-string "#\\" s) (if r (write-string r s) (write-char c s))) (write-char c s)) c) (defun _print-obj (x stm &rest params) (format stm "#<~A " (type-of x)) (dolist (a params) (princ a stm) (write-char #\Space stm)) (format stm "~8,'0X>" (_obj-ptr x)) x) (defun _print-stream (x stm) (_print-obj x stm)) (defun _print-pathname (x s) (write-string "#S" s) (write (append (list 'PATHNAME :host (pathname-host x)) (if (logical-pathname-p x) (list :logical t) (list :device (pathname-device x))) (list :directory (pathname-directory x) :name (pathname-name x) :type (pathname-type x) :version (pathname-version x))) :stream s)) (defun _print-hash-table (x s) (write-string "#S(HASH-TABLE " s) (write (hash-table-test x) :stream s) (maphash #'(lambda (k v) (write-string " (" s) (write k :stream s) (write-string " . " s) (write v :stream s) (write-char #\) s)) x) (write-char #\) s) x) (defun _print-package (x s &aux (n (package-name x))) (cond (*print-readably* (write-string "#." s) (write (list 'find-package n) :stream s)) (t (print-unreadable-object (x s :type t) (write n :stream s :escape nil)))) x) (defvar *_use-print-object* nil)
3,142
Common Lisp
.lisp
54
49.240741
240
0.448873
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
bc30864a9be5b9564ee953230037fae222e37682b46b98277c072e0a5ac06c5a
11,421
[ -1 ]
11,422
pass_tests.lisp
ufasoft_lisp/src/lisp/code/pass_tests.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (_pr "---------Pass Test--------") (in-package "SYSTEM") (load "byte") ;(_pr (multiple-value-list (get-setf-method 'q))) ;(_pr (macroexpand '(setf (ldb (byte 1 i) q) 1))) (setq q 0) (setf (ldb (byte 1 5) q) 1) (_pr "------------------") (_pr q) ;(load "clisp/compiler" :print t) ;(compile-file "clisp/compiler" :verbose t :print t :listing t) ;(compile-file "clisp/format" :verbose t :print t :listing t) ;(compile-file "foo" :verbose t :print t :listing t) (exit) (defmethod clos::print-condition ((c type-error) stm) (format stm "~S is not a ~S" (type-error-datum c) (type-error-expected-type c))) (defmethod clos::print-condition ((c cell-error) stm) (format stm "~S has not dynamic value" (cell-error-name c))) (exit) #| (let ((*default-pathname-defaults* (pathname "S:/SRC/LISP/CODE/TESTS/"))) (load "tests") (run-test "loop") ;(run-all-tests) ) |#
2,398
Common Lisp
.lisp
32
70.875
240
0.476026
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
da3405fbd0ad67a6c80e57c1282f6de365ae2b06ed45d07ca5087855be0cec3f
11,422
[ -1 ]
11,423
explambda.lisp
ufasoft_lisp/src/lisp/code/explambda.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (eval-when (compile load eval) (setq *package* (sys::_get-package "SYSTEM"))) (PROGN (proclaim '(special *keyword-package*)) (setq *keyword-package* (find-package "KEYWORD")) (defun symbol-to-keyword (s) (intern (symbol-name s) *keyword-package*)) (proclaim '(special *fenv*)) ;; *FENV* = the current function environment during expansion of a form. ;; structure: NIL or a 2n+1-element vector ;; (n1 f1 ... nn fn next), ;; where the ni are function-names, ;; the fi are their functional meanings ;; (closure or macro or function-macro or still NIL) ;; continued similarly at 'next'. ;; (fenv-assoc s fenv) searches symbol S in function-environment FENV. ;; the search routine uses EQUAL (defun fenv-assoc (s fenv &optional (from-inside-macrolet nil)) (if fenv (if (simple-vector-p fenv) #+COMPILER (do ((l (1- (length fenv))) (i 0 (+ i 2))) ((= i l) (fenv-assoc s (svref fenv i) from-inside-macrolet)) (if (equal s (svref fenv i)) (if (and from-inside-macrolet (not (macrop (svref fenv (1+ i))))) (error-of-type 'source-program-error :form (list 'FUNCTION s) :detail s (TEXT "Invalid access to the local function definition of ~S from within a ~S definition") s 'macrolet) (return (svref fenv (1+ i)))))) #-COMPILER (let ((l (1- (length fenv))) (i 0)) (block nil (tagbody 1 (if (= i l) (return-from nil (fenv-assoc s (svref fenv i) from-inside-macrolet))) (if (equal s (svref fenv i)) (if (and from-inside-macrolet (not (macrop (svref fenv (1+ i))))) (error-of-type 'source-program-error :form (list 'FUNCTION s) :detail s (TEXT "Invalid access to the local function definition of ~S from within a ~S definition") s 'macrolet) (return-from nil (svref fenv (1+ i))))) (setq i (+ i 2)) (go 1)))) (if (and (consp fenv) (eq (car fenv) 'MACROLET)) (fenv-assoc s (cdr fenv) t) (error-of-type 'type-error :datum fenv :expected-type '(or null simple-vector (cons (eql macrolet) t)) (TEXT "~S is an invalid function environment") fenv))) 'T)) ; not found ;; Determines, if a function-name S in function-environment FENV is not ;; defined and thus refers to the global function. (sys::%putd 'global-in-fenv-p (sys::make-preliminary (function global-in-fenv-p (lambda (s fenv) ; preliminary (eq (fenv-assoc s fenv) 'T))))) (proclaim '(special *venv*)) ;; *VENV* = the current variable-environment during the expansion of a form. ;; Structure: NIL or a 2n+1-element Vector ;; (n1 v1 ... nn vn next), ;; where the ni are Symbols, ;; the vi are their syntactic meanings (symbol-macro-object or sth. else) ;; continued similarly at 'next'. ;; (venv-assoc s venv) searches symbol S in variable-environment VENV. ;; Returns the value (or NIL if there's no value). ;; Caution: The value can be #<SPECDECL> or #<SYMBOL-MACRO ...> , thus ;; may not be temporarily saved in a variable in interpreted Code. ;; the search routine uses EQ (defun venv-assoc (s venv &optional (from-inside-macrolet nil)) (if venv (if (simple-vector-p venv) #+COMPILER (do ((l (1- (length venv))) (i 0 (+ i 2))) ((= i l) (venv-assoc s (svref venv i) from-inside-macrolet)) (if (eq s (svref venv i)) (if (and from-inside-macrolet (not (eq (svref venv (1+ i)) compiler::specdecl)) (not (symbol-macro-p (svref venv (1+ i))))) (error-of-type 'source-program-error :form s :detail s (TEXT "Invalid access to the value of the lexical variable ~S from within a ~S definition") s 'macrolet) (return (svref venv (1+ i)))))) #-COMPILER (let ((l (1- (length venv))) (i 0)) (block nil (tagbody 1 (if (= i l) (return-from nil (venv-assoc s (svref venv i) from-inside-macrolet))) (if (eq s (svref venv i)) (if (and from-inside-macrolet (not (symbol-macro-p (svref venv (1+ i))))) (error-of-type 'source-program-error :form s :detail s (TEXT "Invalid access to the value of the lexical variable ~S from within a ~S definition") s 'macrolet) (return-from nil (svref venv (1+ i))))) (setq i (+ i 2)) (go 1)))) (if (and (consp venv) (eq (car venv) 'MACROLET)) (venv-assoc s (cdr venv) t) (error-of-type 'type-error :datum venv :expected-type '(or null simple-vector) (TEXT "~S is an invalid variable environment") venv))) ; not found (if (symbol-macro-expand s) (global-symbol-macro-definition (get s 'SYMBOLMACRO)) (and (boundp s) (symbol-value s))))) ;; Most of the Expansion-functions return two values: ;; (1) the expansion result, ;; (2) (NIL or T) indicates, if something was changed within it. (proclaim '(special %whole-form)) ; the whole form being expanded ;; (%expand-cons ...) composes a cons. returns 2 values. ;; form=old Form, ;; expf,flagf = expansion of the first-part, ;; expr,flagr = expansion of the rest-part. (defun %expand-cons (form expf flagf expr flagr) (if (or flagf flagr) (values (cons expf expr) t) (values form nil))) ;; cons specs on top of *fenv* (defun cons-*fenv* (specs) (apply #'vector (nreverse (cons *fenv* specs)))) (setq sys::*pr* nil) ;; (%expand-form form) expands a whole Form. returns 2 values. (defun %expand-form (form &aux (%whole-form form)) (if (atom form) #+COMPILER (let (h) (if (and (symbolp form) (symbol-macro-p (setq h (venv-assoc form *venv*)))) (values (%expand-form (sys::%record-ref h 0)) t) (values form nil))) #-COMPILER (if (and (symbolp form) (symbol-macro-p (venv-assoc form *venv*))) (values (%expand-form (sys::%record-ref (venv-assoc form *venv*) 0)) t) (values form nil)) ;; form is a CONS (let ((f (first form))) (if (function-name-p f) (let ((h (fenv-assoc f *fenv*))) ;; f is in *fenv* associated to h (if (eq h 'T) ;; f has no local definition ;; Now the separate expanders for the special-forms: (case f ((RETURN-FROM THE) ; skip the 1st argument, expand the rest (multiple-value-call #'%expand-cons form (first form) nil (multiple-value-call #'%expand-cons (rest form) (second form) nil (%expand-list (cddr form))))) ((QUOTE GO DECLARE LOAD-TIME-VALUE) ; expand nothing (values form nil)) ((FUNCTION) ;; if 1st or 2nd argument is a list, ;; expand as lambda expression. (multiple-value-call #'%expand-cons form 'FUNCTION nil (if (atom (cddr form)) (if (function-name-p (second form)) (let ((h (fenv-assoc (second form) *fenv*))) (cond ((or (eq h 'T) (closurep h) (function-macro-p h) (null h)) (values (rest form) nil)) ((macrop h) (error-of-type 'source-program-error :form form :detail (second form) (TEXT "~S: ~S is illegal since ~S is a local macro") '%expand form (second form))) (t (error-of-type 'error (TEXT "~S: invalid function environment ~S") '%expand *fenv*)))) (if (atom (second form)) (error-of-type 'source-program-error :form form :detail (second form) (TEXT "~S: ~S is invalid since ~S is not a symbol") '%expand form (second form)) (multiple-value-call #'%expand-cons (rest form) (%expand-lambda (second form)) (cddr form) nil))) (multiple-value-call #'%expand-cons (rest form) (second form) nil (multiple-value-call #'%expand-cons (cddr form) (%expand-lambda (third form)) (cdddr form) nil))))) ((EVAL-WHEN) (let ((situations (second form))) (if (or (member 'EVAL situations) (member ':EXECUTE situations)) (multiple-value-call #'%expand-cons form (first form) nil (multiple-value-call #'%expand-cons (rest form) (second form) nil (%expand-list (cddr form)))) (values 'NIL t)))) ((LET) ; expand variable-list and body (let ((*venv* *venv*)) (%expand-special-declarations (cddr form)) (multiple-value-call #'%expand-cons form (first form) nil (multiple-value-call #'%expand-cons (rest form) (%expand-varspez (second form)) (%expand-list (cddr form)))))) ((LET*) ; expand variable-list and body (let ((*venv* *venv*)) (%expand-special-declarations (cddr form)) (multiple-value-call #'%expand-cons form (first form) nil (multiple-value-call #'%expand-cons (rest form) (%expand-varspez* (second form)) (%expand-list (cddr form)))))) ((LOCALLY) ; expand body (let ((*venv* *venv*)) (%expand-special-declarations (cdr form)) (multiple-value-call #'%expand-cons form (first form) nil (%expand-list (cdr form))))) ((MULTIPLE-VALUE-BIND) ; expand form and body, separately (let ((*venv* *venv*)) (%expand-special-declarations (cdddr form)) (multiple-value-call #'%expand-cons form 'MULTIPLE-VALUE-BIND nil (multiple-value-call #'%expand-cons (rest form) (second form) nil (multiple-value-call #'%expand-cons (cddr form) (%expand-form (third form)) (progn (%expand-lexical-variables (second form)) (%expand-list (cdddr form)))))))) ((COMPILER-LET) ; expand var-list in empty environment and body (progv (mapcar #'%expand-varspec-var (second form)) (mapcar #'%expand-varspec-val (second form)) (values (%expand-form (cons 'PROGN (cddr form))) t))) ((COND) ; expand all Sub-Forms of the clauses: (multiple-value-call #'%expand-cons form (first form) nil (%expand-cond (rest form)))) ((CASE) ; expand 1st argument and all sub-forms of the clauses (multiple-value-call #'%expand-cons form (first form) nil (multiple-value-call #'%expand-cons (rest form) (%expand-form (second form)) (%expand-case (cddr form))))) ((BLOCK) ;; expand body. If there is a RETURN-FROM in this ;; block, keep BLOCK, else turn it into a PROGN. (multiple-value-bind (body flagb) (%expand-list (cddr form)) (if (%return-p (second form) body) (multiple-value-call #'%expand-cons form (first form) nil (multiple-value-call #'%expand-cons (rest form) (second form) nil body flagb)) (values (cond ((atom body) body) ((null (cdr body)) (car body)) (t (cons 'progn body))) t)))) ((SETQ PSETQ) ; expand each second Argument (if (%expand-setqlist-macrop (rest form)) (let ((new (if (eq (first form) 'SETQ) 'SETF 'PSETF))) (values (%expand-form (funcall (macro-function new) (cons new (rest form)) (vector *venv* *fenv*))) t)) (multiple-value-call #'%expand-cons form (first form) nil (%expand-setqlist (rest form))))) ((MULTIPLE-VALUE-SETQ) ; skip 1st argument, expand the rest (if (%expand-varlist-macrop (second form)) (values (%expand-form (cons 'MULTIPLE-VALUE-SETF (rest form))) t) (multiple-value-call #'%expand-cons form 'MULTIPLE-VALUE-SETQ nil (multiple-value-call #'%expand-cons (rest form) (second form) nil (%expand-list (cddr form)))))) ((TAGBODY) ;; expand all arguments, ;; skip atoms that are created during expansion (multiple-value-call #'%expand-cons form (first form) nil (%expand-tagbody (rest form)))) ((PROGN) ; expand all arguments, possibly simplify them. (if (null (rest form)) (values nil t) (if (null (cddr form)) (values (%expand-form (second form)) t) (multiple-value-call #'%expand-cons form (first form) nil (%expand-list (rest form)))))) ((FLET) ; expand function definitions (if (null (second form)) (values (%expand-form (cons 'PROGN (cddr form))) t) (let ((newfenv (%expand-fundefs-1 (second form)))) (multiple-value-call #'%expand-cons form (first form) nil (multiple-value-call #'%expand-cons (rest form) (%expand-fundefs-2 (second form)) (let ((*fenv* (apply #'vector newfenv))) (%expand-list (cddr form)))))))) ((LABELS) ;; expand function definitions and body ;; in the extended environment (if (null (second form)) (values (%expand-form (cons 'PROGN (cddr form))) t) (let ((newfenv (%expand-fundefs-1 (second form)))) (let ((*fenv* (apply #'vector newfenv))) (multiple-value-call #'%expand-cons form (first form) nil (multiple-value-call #'%expand-cons (rest form) (%expand-fundefs-2 (second form)) (%expand-list (cddr form)))))))) ((MACROLET) ; expand the body in the extended environment (do ((L1 (second form) (cdr L1)) (L2 nil)) ((atom L1) (if L1 (error-of-type 'source-program-error :form form :detail L1 (TEXT "code after MACROLET contains a dotted list, ending with ~S") L1) (let ((*fenv* (apply #'vector (nreverse (cons *fenv* L2))))) (values (%expand-form (cons 'PROGN (cddr form))) t)))) (let ((macrodef (car L1))) (if (and (consp macrodef) (symbolp (car macrodef)) (consp (cdr macrodef))) (setq L2 (list* (make-macro-expander macrodef form) (car macrodef) L2)) (error-of-type 'source-program-error :form form :detail macrodef (TEXT "illegal syntax in MACROLET: ~S") macrodef))))) ((FUNCTION-MACRO-LET) ;; expand function-definitions, ;; expand body in extended environment (if (null (second form)) (values (%expand-form (cons 'PROGN (cddr form))) t) (let ((newfenv (%expand-funmacdefs-1 (second form)))) (multiple-value-call #'%expand-cons form (first form) nil (multiple-value-call #'%expand-cons (rest form) (%expand-funmacdefs-2 (second form)) (let ((*fenv* (apply #'vector newfenv))) (%expand-list (cddr form)))))))) ((SYMBOL-MACROLET) ; expand body in extended environment (do ((L1 (second form) (cdr L1)) (L2 nil)) ((atom L1) (if L1 (error-of-type 'source-program-error :form form :detail L1 (TEXT "code after SYMBOL-MACROLET contains a dotted list, ending with ~S") L1) (let ((*venv* (apply #'vector (nreverse (cons *venv* L2))))) (let ((specials (%expand-special-declarations (cddr form)))) (do ((L3 (second form) (cdr L3))) ((atom L3)) (if (memq (caar L3) specials) (error-of-type 'source-program-error :form form :detail (caar L3) (TEXT "~S: symbol ~S must not be declared SPECIAL and a macro at the same time") 'symbol-macrolet (caar L3))))) (values (%expand-form (cons 'LOCALLY (cddr form))) t)))) (let ((symdef (car L1))) (if (and (consp symdef) (symbolp (car symdef)) (consp (cdr symdef)) (null (cddr symdef))) (let ((symbol (car symdef)) (expansion (cadr symdef))) (if (special-variable-p symbol) (error-of-type 'program-error (TEXT "~S: symbol ~S is declared special and must not be declared a macro") 'symbol-macrolet symbol) (setq L2 (list* (make-symbol-macro expansion) symbol L2)))) (error-of-type 'source-program-error :form form :detail symdef (TEXT "illegal syntax in SYMBOL-MACROLET: ~S") symdef))))) (t (cond ((and (symbolp f) (special-operator-p f)) ;; other Special-forms, ;; e.g. IF, CATCH, THROW, PROGV, UNWIND-PROTECT, PROGN, ;; PROG1, PROG2, WHEN, UNLESS, MULTIPLE-VALUE-LIST, ;; MULTIPLE-VALUE-CALL, MULTIPLE-VALUE-PROG1, AND, OR: (multiple-value-call #'%expand-cons form f nil (%expand-list (rest form)))) ((and (symbolp f) (setq h (macro-function f))) ;; global Macro-Definition (%expand-macro h form)) (t ; normal function-call (multiple-value-call #'%expand-cons form f nil (%expand-list (rest form))))))) ;; f has a local definition (cond ((or (closurep h) (function-macro-p h) (null h)) ;; function to be called (multiple-value-call #'%expand-cons form f nil (%expand-list (rest form)))) ((macrop h) ; macro to be expanded (%expand-macro (macro-expander h) form)) ; call expander (t (error-of-type 'error (TEXT "bad function environment occurred in ~S: ~S") '%expand-form *fenv*))))) (if (consp f) (multiple-value-call #'%expand-cons form (%expand-lambda f) (%expand-list (rest form))) (error-of-type 'source-program-error :form form :detail form (TEXT "~S: invalid form ~S") '%expand-form form)))))) ;; Auxiliary functions for the the expansion: ;; call the macro-expander on the form (expanding after) (defun %expand-macro (macro-expander form) ; (_pr "-----%expand-macro-----------") ; (_pr (sys::%record-ref macro-expander 1)) (values (%expand-form (funcall macro-expander form (vector *venv* *fenv*))) t)) ;; expands a list of forms. returns 2 values. (defun %expand-list (l) (if (atom l) (if l (error-of-type 'source-program-error :form %whole-form :detail l (TEXT "code contains a dotted list, ending with ~S") l) (values nil nil)) (multiple-value-call #'%expand-cons l (%expand-form (first l)) (%expand-list (rest l))))) ;; Adds lexical variables to *venv* . ;; (only used for shadowing symbol-macros.) (defun %expand-lexical-variables (vars) (if vars (setq *venv* (apply #'vector (nconc (mapcan #'(lambda (v) (declare (source nil)) (list v nil)) vars) (list *venv*)))))) ;; Adds SPECIAL-Declarations at the beginning of a Body to *venv* . (defun %expand-special-declarations (body) (multiple-value-bind (body-rest declarations) (sys::parse-body body) (declare (ignore body-rest)) ; do not throw away declarations! (let ((specials nil)) (mapc #'(lambda (declspec) (declare (source nil)) (if (and (consp declspec) (null (cdr (last declspec)))) (if (eq (car declspec) 'SPECIAL) (mapc #'(lambda (x) (declare (source nil)) (if (symbolp x) (setq specials (cons x specials)))) (cdr declspec))))) (nreverse declarations)) (setq specials (nreverse specials)) (%expand-lexical-variables specials) ; specdecl doesn't matter here specials))) ;; expands a function-name, that is a Cons (that must be a ;; Lambda-Expression). returns 2 values. (defun %expand-lambda (l) (unless (eq (first l) 'lambda) (error-of-type 'source-program-error :form %whole-form :detail l (TEXT "~S: ~S should be a lambda expression") '%expand-form l)) (multiple-value-call #'%expand-cons l 'lambda nil ; LAMBDA (%expand-lambdabody (rest l)))) ;; expands the CDR of a Lambda-Expression, a (lambdalist . body). ;; returns 2 values. (defun %expand-lambdabody (lambdabody &optional name blockp) (let ((body (rest lambdabody))) (if (and (consp body) (let ((form (car body))) (and (consp form) (eq (car form) 'DECLARE) (let ((declspecs (cdr form))) (and (consp declspecs) (let ((declspec (car declspecs))) (and (consp declspec) (eq (car declspec) 'SOURCE)))))))) (values lambdabody nil) ; already expanded -> leave untouched (let ((*venv* *venv*)) (if blockp (setq lambdabody (add-implicit-block name lambdabody))) (values (list* (%expand-lambdalist (first lambdabody)) (list 'DECLARE (list 'SOURCE lambdabody)) (%expand-list (rest lambdabody))) t))))) ;; expands a Lambda-list. returns 2 values. (defun %expand-lambdalist (ll) (if (atom ll) (if ll (error-of-type 'source-program-error :form %whole-form :detail ll (TEXT "lambda list must not end with the atom ~S") ll) (values nil nil)) (multiple-value-call #'%expand-cons ll (%expand-parspez (first ll)) (progn (let ((v (first ll))) (if (not (memq v lambda-list-keywords)) (setq *venv* (vector (%expand-varspec-var v) nil *venv*)))) (%expand-lambdalist (rest ll)))))) ;; expands an element of a lambda-list. returns 2 values. ;; (expands only on lists, and then only the second element.) (defun %expand-parspez (ps) (if (or (atom ps) (atom (rest ps))) (values ps nil) (multiple-value-call #'%expand-cons ps (first ps) nil (multiple-value-call #'%expand-cons (rest ps) (%expand-form (second ps)) (cddr ps) nil)))) ;; expand a Variable-list for LET. returns 2 values. (defun %expand-varspez (vs &optional (nvenv nil)) (if (atom vs) (if vs (error-of-type 'source-program-error :form %whole-form :detail vs (TEXT "~S: variable list ends with the atom ~S") 'let vs) (progn (setq *venv* (apply #'vector (nreverse (cons *venv* nvenv)))) (values nil nil))) (multiple-value-call #'%expand-cons vs (%expand-parspez (first vs)) ; For List: Expand 2nd Element (%expand-varspez (rest vs) (list* nil (%expand-varspec-var (first vs)) nvenv))))) ;; expands a Variable-list for LET*. returns 2 values. (defun %expand-varspez* (vs) (if (atom vs) (if vs (error-of-type 'source-program-error :form %whole-form :detail vs (TEXT "~S: variable list ends with the atom ~S") 'let* vs) (values nil nil)) (multiple-value-call #'%expand-cons vs (%expand-parspez (first vs)) ; for list: expand 2nd Element (progn (setq *venv* (vector (%expand-varspec-var (first vs)) nil *venv*)) (%expand-varspez* (rest vs)))))) (defun %expand-varspec-var (varspec) (if (atom varspec) varspec (first varspec))) (defun %expand-varspec-val (varspec) (if (atom varspec) nil (eval (second varspec)))) ;; expands a cond-clause-list. returns 2 values. (defun %expand-cond (clauses) (if (atom clauses) (values clauses nil) (multiple-value-call #'%expand-cons clauses (%expand-list (first clauses)) (%expand-cond (rest clauses))))) ;; expands a case-clause-list. returns 2 values. (defun %expand-case (clauses) (if (atom clauses) (values clauses nil) (multiple-value-call #'%expand-cons clauses (multiple-value-call #'%expand-cons (first clauses) (caar clauses) nil (%expand-list (cdar clauses))) (%expand-case (rest clauses))))) ;; Apply the following to the already expanded body: ;; (%return-p name list) determines, if the form-list list contains ;; a (RETURN-FROM name ...) somewhere. (defun %return-p (name body) (block return-p (tagbody 1 (if (atom body) (return-from return-p nil)) (let ((form (car body))) (if ; determine, if form contains a (RETURN-FROM name ...) : (and (consp form) (not (eq (first form) 'quote)) (or (and (eq (first form) 'return-from) ; (RETURN-FROM name ...) (eq (second form) name)) (and (consp (first form)) ; lambda-list (%return-p name (first form))) (and (not ; no new definition of the same block ? (and (eq (first form) 'block) (eq (second form) name))) (%return-p name (rest form))))) ; function call (return-from return-p t))) (setq body (cdr body)) (go 1)))) (defun %expand-varlist-macrop (l) (and (consp l) (or (and (symbolp (car l)) (symbol-macro-p (venv-assoc (car l) *venv*))) (%expand-varlist-macrop (cdr l))))) (defun %expand-setqlist-macrop (l) (and (consp l) (consp (cdr l)) (or (and (symbolp (car l)) (symbol-macro-p (venv-assoc (car l) *venv*))) (%expand-setqlist-macrop (cddr l))))) (defun %expand-setqlist (l) (if (or (atom l) (atom (cdr l))) (values l nil) (multiple-value-call #'%expand-cons l (first l) nil (multiple-value-call #'%expand-cons (rest l) (%expand-form (second l)) (%expand-setqlist (cddr l)))))) ;; (%expand-tagbody list) expands the elements of a list ;; and leaves atoms, that are created meanwhile, untouched. ;; (thus no new tags are created that could hide other tags). ;; returns 2 values. (defun %expand-tagbody (body) (cond ((atom body) (values body nil)) ((atom (first body)) (multiple-value-call #'%expand-cons body (first body) nil (%expand-tagbody (rest body)))) (t (multiple-value-bind (exp flag) (%expand-form (first body)) (if (atom exp) (values (%expand-tagbody (rest body)) t) ; omit (multiple-value-call #'%expand-cons body exp flag (%expand-tagbody (rest body)))))))) ;; returns a list (name1 nil ... namek nil *fenv*) (defun %expand-fundefs-1 (fundefs) (if (atom fundefs) (if fundefs (error-of-type 'source-program-error :form %whole-form :detail fundefs (TEXT "FLET/LABELS: code contains a dotted list, ending with ~S") fundefs) (list *fenv*)) (let ((fundef (car fundefs))) (if (and (consp fundef) (function-name-p (car fundef)) (consp (cdr fundef))) (list* (car fundef) nil (%expand-fundefs-1 (cdr fundefs))) (error-of-type 'source-program-error :form %whole-form :detail fundef (TEXT "illegal syntax in FLET/LABELS: ~S") fundef))))) ;; (%expand-fundefs-2 fundefs) expands a function-definition-list, ;; like in FLET, LABELS. returns 2 values. (defun %expand-fundefs-2 (fundefs) (if (atom fundefs) (values fundefs nil) (let ((fundef (car fundefs))) (multiple-value-call #'%expand-cons fundefs (multiple-value-call #'%expand-cons fundef (car fundef) nil (%expand-lambdabody (cdr fundef) (car fundef) t)) (%expand-fundefs-2 (rest fundefs)))))) ;; returns a list (name1 nil ... namek nil *fenv*) (defun %expand-funmacdefs-1 (funmacdefs) (if (atom funmacdefs) (if funmacdefs (error-of-type 'source-program-error :form %whole-form :detail funmacdefs (TEXT "FUNCTION-MACRO-LET: code contains a dotted list, ending with ~S") funmacdefs) (list *fenv*)) (let ((funmacdef (car funmacdefs))) (if (and (consp funmacdef) (symbolp (car funmacdef)) (consp (cdr funmacdef)) (consp (second funmacdef)) (consp (cddr funmacdef)) (consp (third funmacdef)) (null (cdddr funmacdef))) (list* (car funmacdef) nil (%expand-funmacdefs-1 (cdr funmacdefs))) (error-of-type 'source-program-error :form %whole-form :detail funmacdef (TEXT "illegal syntax in FUNCTION-MACRO-LET: ~S") funmacdef))))) ;; (%expand-funmacdefs-2 funmacdefs) expands a function-macro- ;; definition-list, like in FUNCTION-MACRO-LET. returns 2 values. (defun %expand-funmacdefs-2 (funmacdefs) (if (atom funmacdefs) (values funmacdefs nil) (let ((funmacdef (car funmacdefs))) (multiple-value-call #'%expand-cons funmacdefs (multiple-value-call #'%expand-cons funmacdef (car funmacdef) nil (multiple-value-call #'%expand-cons (cdr funmacdef) (%expand-lambdabody (cadr funmacdef)) (multiple-value-call #'%expand-cons (cddr funmacdef) (let ((*venv* nil) (*fenv* nil)) (%expand-lambdabody (caddr funmacdef))) (cdddr funmacdef) nil))) (%expand-funmacdefs-2 (rest funmacdefs)))))) ;; (%expand-handlers handlers) expands a Typ/Handler-List ;; like in %HANDLER-BIND. returns 2 values. (defun %expand-handlers (handlers) (if (atom handlers) (values handlers nil) (let ((handler (car handlers))) (multiple-value-call #'%expand-cons handlers (multiple-value-call #'%expand-cons handler (car handler) nil (%expand-list (cdr handler))) (%expand-handlers (cdr handlers)))))) ;; expands (lambdalist . body) in a given function-environment. ;; Is called by GET_CLOSURE. (defun %expand-lambdabody-main (lambdabody *venv* *fenv*) (%expand-lambdabody lambdabody)) (defun expand-form (form &aux *fenv* *venv*) (%expand-form form)) (VALUES) )
36,094
Common Lisp
.lisp
739
34.338295
240
0.500085
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
04926013e0d0abe3757b155b52cc90f9976e7c7bdf3df470ef3046fb5ac61c51
11,423
[ -1 ]
11,424
opt.lisp
ufasoft_lisp/src/lisp/code/opt.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (defpackage "ANSI-LOOP") (load 'loop) (in-package sys) (load 'format) (setq *_opt-loaded* t) (in-package cl-user)
1,577
Common Lisp
.lisp
12
129
240
0.414414
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
3100988132b9ee2b4ef939fa6597f6ac0165061520b2b0612f9a22cbddbe4d2f
11,424
[ -1 ]
11,425
export.lisp
ufasoft_lisp/src/lisp/code/export.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (CL::setq CL::*package* (CL::find-package "SYS")) (CL::export '(*big-endian* concat-pnames)) (CL::setq CL::*package* (CL::find-package "CL")) (CL::export '( &allow-other-keys &aux &body &environment &key &optional &rest &whole * ** *** + ++ +++ - / // /// /= 1+ 1- < <= = > >= *break-on-signals* *compile-file-pathname* *compile-file-truename* *compile-print* *compile-verbose* *debug-io* *debugger-hook* *default-pathname-defaults* *error-output* *features* *gensym-counter* *load-pathname* *load-print* *load-truename* *load-verbose* *macroexpand-hook* *modules* *package* *print-array* *print-base* *print-case* *print-circle* *print-escape* *print-gensym* *print-length* *print-level* *print-lines* *print-miser-width* *print-pprint-dispatch* *print-pretty* *print-radix* *print-readably* *print-right-margin* *query-io* *random-state* *read-base* *read-default-float-format* *read-eval* *read-suppress* *readtable* *standard-input* *standard-output* *terminal-io* *trace-output* abort abs acons acos acosh add-method adjoin adjust-array adjustable-array-p allocate-instance alpha-char-p alphanumericp and append apply apropos apropos-list aref arithmetic-error arithmetic-error-operands arithmetic-error-operation array array-dimension array-dimension-limit array-dimensions array-displacement array-element-type array-has-fill-pointer-p array-in-bounds-p array-rank array-rank-limit array-row-major-index array-total-size array-total-size-limit arrayp ash asin asinh assert assoc assoc-if assoc-if-not atan atanh atom base-char base-string bignum bit bit-and bit-andc1 bit-andc2 bit-eqv bit-ior bit-nand bit-nor bit-not bit-orc1 bit-orc2 bit-vector bit-vector-p bit-xor block boole boole-1 boole-2 boole-and boole-andc1 boole-andc2 boole-c1 boole-c2 boole-clr boole-eqv boole-ior boole-nand boole-nor boole-orc1 boole-orc2 boole-set boole-xor boolean both-case-p boundp break broadcast-stream broadcast-stream-streams built-in-class butlast byte byte-position byte-size caaaar caaadr caaar caadar caaddr caadr caar cadaar cadadr cadar caddar cadddr caddr cadr call-arguments-limit call-method call-next-method car case catch ccase cdaaar cdaadr cdaar cdadar cdaddr cdadr cdar cddaar cddadr cddar cdddar cddddr cdddr cddr cdr ceiling cell-error cell-error-name cerror change-class char char-code char-code-limit char-downcase char-equal char-greaterp char-int char-lessp char-name char-not-equal char-not-greaterp char-not-lessp char-upcase char/= char< char<= char= char> char>= character characterp check-type cis class class-name class-of clear-input clear-output close clrhash code-char coerce compilation-speed compile compile-file compile-file-pathname compiled-function compiled-function-p compiler-macro compiler-macro-function complement complex complexp compute-applicable-methods compute-restarts concatenate concatenated-stream concatenated-stream-streams cond condition conjugate cons consp constantly constantp continue control-error copy-alist copy-list copy-pprint-dispatch copy-readtable copy-seq copy-structure copy-symbol copy-tree cos cosh count count-if count-if-not ctypecase debug decf declaim declaration declare decode-float decode-universal-time defclass defconstant defgeneric define-compiler-macro define-condition define-method-combination define-modify-macro define-setf-expander define-symbol-macro defmacro defmethod defpackage defparameter defsetf defstruct deftype defun defvar delete delete-duplicates delete-file delete-if delete-if-not delete-package denominator deposit-field describe describe-object destructuring-bind digit-char digit-char-p directory directory-namestring disassemble division-by-zero do do* do-all-symbols do-external-symbols do-symbols documentation dolist dotimes double-float double-float-epsilon double-float-negative-epsilon dpb dribble dynamic-extent ecase echo-stream echo-stream-input-stream echo-stream-output-stream ed eighth elt encode-universal-time end-of-file endp enough-namestring ensure-directories-exist ensure-generic-function eq eql equal equalp error etypecase eval eval-when evenp every exp export expt extended-char fboundp fceiling fdefinition ffloor fifth file-author file-error file-error-pathname file-length file-namestring file-position file-stream file-string-length file-write-date fill fill-pointer find find-all-symbols find-class find-if find-if-not find-method find-package find-restart find-symbol finish-output first fixnum flet float float-digits float-precision float-radix float-sign floating-point-inexact floating-point-invalid-operation floating-point-overflow floating-point-underflow floatp floor fmakunbound force-output format formatter fourth fresh-line fround ftruncate ftype funcall function function-keywords function-lambda-expression functionp gcd generic-function gensym gentemp get get-decoded-time get-dispatch-macro-character get-internal-real-time get-internal-run-time get-macro-character get-output-stream-string get-properties get-setf-expansion get-universal-time getf gethash go graphic-char-p handler-bind handler-case hash-table hash-table-count hash-table-p hash-table-rehash-size hash-table-rehash-threshold hash-table-size hash-table-test host-namestring identity if ignorable ignore ignore-errors imagpart import in-package incf initialize-instance inline input-stream-p inspect integer integer-decode-float integer-length integerp interactive-stream-p intern internal-time-units-per-second intersection invalid-method-error invoke-debugger invoke-restart invoke-restart-interactively isqrt keyword keywordp labels lambda lambda-list-keywords lambda-parameters-limit last lcm ldb ldb-test ldiff least-negative-double-float least-negative-long-float least-negative-normalized-double-float least-negative-normalized-long-float least-negative-normalized-short-float least-negative-normalized-single-float least-negative-short-float least-negative-single-float least-positive-double-float least-positive-long-float least-positive-normalized-double-float least-positive-normalized-long-float least-positive-normalized-short-float least-positive-normalized-single-float least-positive-short-float least-positive-single-float length let let* lisp-implementation-type lisp-implementation-version list list* list-all-packages list-length listen listp load load-logical-pathname-translations load-time-value locally log logand logandc1 logandc2 logbitp logcount logeqv logical-pathname logical-pathname-translations logior lognand lognor lognot logorc1 logorc2 logtest logxor long-float long-float-epsilon long-float-negative-epsilon long-site-name loop loop-finish lower-case-p machine-instance machine-type machine-version macro-function macroexpand macroexpand-1 macrolet make-array make-broadcast-stream make-concatenated-stream make-condition make-dispatch-macro-character make-echo-stream make-hash-table make-instance make-instances-obsolete make-list make-load-form make-load-form-saving-slots make-method make-package make-pathname make-random-state make-sequence make-string make-string-input-stream make-string-output-stream make-symbol make-synonym-stream make-two-way-stream makunbound map map-into mapc mapcan mapcar mapcon maphash mapl maplist mask-field max member member-if member-if-not merge merge-pathnames method method-combination method-combination-error method-qualifiers min minusp mismatch mod most-negative-double-float most-negative-fixnum most-negative-long-float most-negative-short-float most-negative-single-float most-positive-double-float most-positive-fixnum most-positive-long-float most-positive-short-float most-positive-single-float muffle-warning multiple-value-bind multiple-value-call multiple-value-list multiple-value-prog1 multiple-value-setq multiple-values-limit name-char namestring nbutlast nconc next-method-p nil nintersection ninth no-applicable-method no-next-method not notany notevery notinline nreconc nreverse nset-difference nset-exclusive-or nstring-capitalize nstring-downcase nstring-upcase nsublis nsubst nsubst-if nsubst-if-not nsubstitute nsubstitute-if nsubstitute-if-not nth nth-value nthcdr null number numberp numerator nunion oddp open open-stream-p optimize or otherwise output-stream-p package package-error package-error-package package-name package-nicknames package-shadowing-symbols package-use-list package-used-by-list packagep pairlis parse-error parse-integer parse-namestring pathname pathname-device pathname-directory pathname-host pathname-match-p pathname-name pathname-type pathname-version pathnamep peek-char phase pi plusp pop position position-if position-if-not pprint pprint-dispatch pprint-exit-if-list-exhausted pprint-fill pprint-indent pprint-linear pprint-logical-block pprint-newline pprint-pop pprint-tab pprint-tabular prin1 prin1-to-string princ princ-to-string print print-not-readable print-not-readable-object print-object print-unreadable-object probe-file proclaim prog prog* prog1 prog2 progn program-error progv provide psetf psetq push pushnew quote random random-state random-state-p rassoc rassoc-if rassoc-if-not ratio rational rationalize rationalp read read-byte read-char read-char-no-hang read-delimited-list read-from-string read-line read-preserving-whitespace read-sequence reader-error readtable readtable-case readtablep real realp realpart reduce reinitialize-instance rem remf remhash remove remove-duplicates remove-if remove-if-not remove-method remprop rename-file rename-package replace require rest restart restart-bind restart-case restart-name return return-from revappend reverse room rotatef round row-major-aref rplaca rplacd safety satisfies sbit scale-float schar search second sequence serious-condition set set-difference set-dispatch-macro-character set-exclusive-or set-macro-character set-pprint-dispatch set-syntax-from-char setf setq seventh shadow shadowing-import shared-initialize shiftf short-float short-float-epsilon short-float-negative-epsilon short-site-name signal signed-byte signum simple-array simple-base-string simple-bit-vector simple-bit-vector-p simple-condition simple-condition-format-arguments simple-condition-format-control simple-error simple-string simple-string-p simple-type-error simple-vector simple-vector-p simple-warning sin single-float single-float-epsilon single-float-negative-epsilon sinh sixth sleep slot-boundp slot-exists-p slot-makunbound slot-missing slot-unbound slot-value software-type software-version some sort space special special-operator-p speed sqrt stable-sort standard standard-char standard-char-p standard-class standard-generic-function standard-method standard-object step storage-condition store-value stream stream-element-type stream-error stream-error-stream stream-external-format streamp string string-capitalize string-downcase string-equal string-greaterp string-left-trim string-lessp string-not-equal string-not-greaterp string-not-lessp string-right-trim string-stream string-trim string-upcase string/= string< string<= string= string> string>= stringp structure structure-class structure-object style-warning sublis subseq subsetp subst subst-if subst-if-not substitute substitute-if substitute-if-not subtypep svref sxhash symbol symbol-function symbol-macrolet symbol-name symbol-package symbol-plist symbol-value symbolp synonym-stream synonym-stream-symbol t tagbody tailp tan tanh tenth terpri the third throw time trace translate-logical-pathname translate-pathname tree-equal truename truncate two-way-stream two-way-stream-input-stream two-way-stream-output-stream type type-error type-error-datum type-error-expected-type type-of typecase typep unbound-slot unbound-slot-instance unbound-variable undefined-function unexport unintern union unless unread-char unsigned-byte untrace unuse-package unwind-protect update-instance-for-different-class update-instance-for-redefined-class upgraded-array-element-type upgraded-complex-part-type upper-case-p use-package use-value user-homedir-pathname values values-list variable vector vector-pop vector-push vector-push-extend vectorp warn warning when wild-pathname-p with-accessors with-compilation-unit with-condition-restarts with-hash-table-iterator with-input-from-string with-open-file with-open-stream with-output-to-string with-package-iterator with-simple-restart with-slots with-standard-io-syntax write write-byte write-char write-line write-sequence write-string write-to-string y-or-n-p yes-or-no-p zerop )) (setq *package* (find-package "EXT")) (CL::export '(*applyhook* *args* argv *evalhook* evalhook applyhook re-export special-variable-p exit quit english simple-condition-format-string *load-compiling* notspecial probe-pathname mapcap maplap *ERROR-HANDLER* *driver* *break-driver* show-stack special-operator load-time-eval symbol-macro function-macro encoding gc finalize string-concat preliminary stack-overflow-error weak-pointer make-weak-pointer weak-pointer-p weak-pointer-value weak-list make-weak-list weak-list-p weak-list-list weak-and-relation make-weak-and-relation weak-and-relation-p weak-and-relation-list weak-or-relation make-weak-or-relation weak-or-relation-p weak-or-relation-list weak-mapping make-weak-mapping weak-mapping-p weak-mapping-pair weak-mapping-value weak-and-mapping make-weak-and-mapping weak-and-mapping-p weak-and-mapping-pair weak-and-mapping-value weak-or-mapping make-weak-or-mapping weak-or-mapping-p weak-or-mapping-pair weak-or-mapping-value weak-alist make-weak-alist weak-alist-p weak-alist-type weak-alist-contents weak-alist-assoc weak-alist-rassoc weak-alist-value expand-form symbol-macro-expand global-symbol-macro package-shortest-name package-case-inverted-p package-case-sensitive-p read-char-sequence write-char-sequence read-byte-sequence write-byte-sequence source-program-error source-program-error-form source-program-error-detail package-lock fasthash-eq stablehash-eq fasthash-eql stablehash-eql fasthash-equal stablehash-equal getenv shell dir delete-directory list-length-dotted list-length-proper proper-list-p elastic-newline base-char-code-limit defun-ff compiler-let )) (setq *package* (find-package "CLOS")) ;;; Exports: (CL::export '(;; names of functions and macros: metaobject ;; MOP for dependents add-dependent remove-dependent map-dependents update-dependent ;; MOP for slot definitions slot-definition standard-slot-definition direct-slot-definition standard-direct-slot-definition effective-slot-definition standard-effective-slot-definition slot-definition-name slot-definition-initform slot-definition-initfunction slot-definition-type slot-definition-allocation slot-definition-initargs slot-definition-readers slot-definition-writers slot-definition-location ;; MOP for slot access slot-value-using-class slot-boundp-using-class slot-makunbound-using-class standard-instance-access funcallable-standard-instance-access ;; MOP for classes class forward-referenced-class built-in-class structure-class standard-class class-name class-direct-superclasses class-precedence-list class-direct-subclasses class-direct-slots class-slots class-direct-default-initargs class-default-initargs class-prototype class-finalized-p finalize-inheritance compute-direct-slot-definition-initargs direct-slot-definition-class compute-class-precedence-list compute-slots compute-effective-slot-definition compute-effective-slot-definition-initargs effective-slot-definition-class compute-default-initargs validate-superclass add-direct-subclass remove-direct-subclass standard-accessor-method standard-reader-method standard-writer-method reader-method-class writer-method-class ensure-class ensure-class-using-class ;; MOP for specializers specializer eql-specializer specializer-direct-generic-functions specializer-direct-methods add-direct-method remove-direct-method eql-specializer-object intern-eql-specializer ;; MOP for methods method standard-method method-function method-generic-function method-lambda-list method-specializers method-qualifiers accessor-method-slot-definition extract-lambda-list extract-specializer-names ;; MOP for method combinations find-method-combination compute-effective-method ;; MOP for generic functions funcallable-standard-class funcallable-standard-object set-funcallable-instance-function generic-function-name generic-function-methods generic-function-method-class generic-function-lambda-list generic-function-method-combination generic-function-argument-precedence-order generic-function-declarations compute-discriminating-function compute-applicable-methods compute-applicable-methods-using-classes compute-effective-method-as-function ensure-generic-function ensure-generic-function-using-class ;; CLISP specific symbols generic-flet generic-labels no-primary-method method-call-error method-call-type-error method-call-error-generic-function method-call-error-method method-call-error-argument-list standard-stablehash structure-stablehash clos-warning gf-already-called-warning gf-replacing-method-warning slot-value slot-boundp slot-makunbound slot-exists-p with-slots with-accessors documentation find-class class-of defclass defmethod call-next-method next-method-p defgeneric generic-function no-applicable-method no-next-method find-method add-method remove-method compute-applicable-methods method-qualifiers function-keywords slot-missing slot-unbound print-object describe-object make-instance allocate-instance initialize-instance reinitialize-instance shared-initialize ensure-generic-function make-load-form make-load-form-saving-slots change-class update-instance-for-different-class update-instance-for-redefined-class make-instances-obsolete ;; names of classes: class standard-class structure-class built-in-class standard-object structure-object generic-function standard-generic-function method standard-method ;; other symbols: standard )) ; method combination (setq *package* (find-package "CUSTOM")) (CL::export '(*suppress-check-redefinition* *load-paths* *report-error-print-backtrace* *user-commands* *compiled-file-types*)) (CL::setq CL::*package* (CL::find-package "CHARSET")) (CL::export '(utf-8)) (CL::setq CL::*package* (CL::find-package "CL"))
21,501
Common Lisp
.lisp
247
78.105263
240
0.739061
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
335985acbd2b22f3565d921e1b7f6f548f7fc4ca5a4f9d2a2466ca2adb2385a2
11,425
[ -1 ]
11,426
restart.lisp
ufasoft_lisp/src/lisp/code/restart.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# ;; The list of active restarts. (defvar *active-restarts* nil) ;; A list of pairs of conditions and restarts associated with them. We have to ;; keep the associations separate because there can be a many-to-many mapping ;; between restarts and conditions, and this mapping has dynamic extent. (defvar *condition-restarts* nil) (defun default-restart-test (condition) t) (defstruct restart name (test #'default-restart-test)) (defmacro restart-case (rf &rest clauses) (err)) (defmacro with-simple-restart ((restart-name format-control &rest format-arguments) &body forms) `(restart-case (progn ,@forms) (,restart-name () :report (lambda (stream) (format stream ,format-control ,@format-arguments)) (values nil t)))) (defun compute-restarts (&optional condition) (if condition ; return only restarts that are applicable to that condition (remove-if-not #'(lambda (restart) (applicable-restart-p restart condition)) *active-restarts* ) ; return all restarts *active-restarts* ) ) ;;; 29.4.7. Establishing Restarts ;; This conses out the wazoo, but there seems to be no good way around it short ;; of special casing things a zillion ways. The main problem is that someone ;; could write: ;; ;; (restart-bind ((nil *fun-1* ;; :interactive-function *fun-2* ;; :report-function *fun-3* ;; :test-function *fun-4* ;; )) ...) ;; ;; and it is supposed to work. ;; RESTART-BIND, CLtL2 p. 909 (defmacro restart-bind (restart-specs &body body) (setq body `(PROGN ,@body)) (unless (listp restart-specs) (error-of-type 'source-program-error (ENGLISH "~S: not a list: ~S") 'restart-bind restart-specs ) ) (if restart-specs `(LET ((*ACTIVE-RESTARTS* (LIST* ,@(mapcar #'(lambda (spec) (unless (and (listp spec) (consp (cdr spec)) (symbolp (first spec))) (error-of-type 'source-program-error (ENGLISH "~S: invalid restart specification ~S") 'restart-bind spec ) ) (apply #'(lambda (name function &key (test-function '(FUNCTION DEFAULT-RESTART-TEST)) (interactive-function '(FUNCTION DEFAULT-RESTART-INTERACTIVE)) (report-function 'NIL)) (when (and (null name) (eq report-function 'NIL)) ; CLtL2 p. 906: "It is an error if an unnamed restart is used ; and no report information is provided." (error-of-type 'source-program-error (ENGLISH "~S: unnamed restarts require ~S to be specified: ~S") 'restart-bind ':REPORT-FUNCTION spec ) ) (make-restart-form `',name test-function 'NIL function report-function interactive-function ) ) spec ) ) restart-specs ) *ACTIVE-RESTARTS* )) ) ,body ) body ) ) ; Tests whether a given restart is applicable to a given condition (defun applicable-restart-p (restart condition) (and (or (null condition) ;; A restart is applicable if it is associated to that condition ;; or if it is not associated to any condition. (let ((not-at-all t)) (dolist (asso *condition-restarts* not-at-all) (when (eq (cdr asso) restart) (if (eq (car asso) condition) (return t) (setq not-at-all nil)))))) ;; Call the restart's test function: (funcall (restart-test restart) condition))) (defun find-restart (ri &optional c) (let ((f (etypecase ri (null (%error)) (symbol #'restart-name) (restart #'identity)))) (dolist (r *active-restarts*) (when (and (eq (funcall f r) ri) (or (null c) (applicable-restart-p r c))) (return restart)))))
6,355
Common Lisp
.lisp
115
40.304348
240
0.466087
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
7320df92bfed4141de44298b59deffb4aa06f74033b9ca98dc23c1ec6d433280
11,426
[ -1 ]
11,427
macros.lisp
ufasoft_lisp/src/lisp/code/macros.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "SYS") ;;; CASE-BODY returns code for all the standard "case" macros. Name is the ;;; macro name, and keyform is the thing to case on. Multi-p indicates whether ;;; a branch may fire off a list of keys; otherwise, a key that is a list is ;;; interpreted in some way as a single key. When multi-p, test is applied to ;;; the value of keyform and each key for a given branch; otherwise, test is ;;; applied to the value of keyform and the entire first element, instead of ;;; each part, of the case branch. When errorp, no t or otherwise branch is ;;; permitted, and an ERROR form is generated. When proceedp, it is an error ;;; to omit errorp, and the ERROR form generated is executed within a ;;; RESTART-CASE allowing keyform to be set and retested. ;;; (defun case-body (name keyform cases multi-p test errorp proceedp) (let ((keyform-value (gensym)) (clauses ()) (keys ())) (dolist (case cases) (cond ((atom case) (error "~S -- Bad clause in ~S." case name)) ((memq (car case) '(t otherwise)) (if errorp (error "No default clause allowed in ~S: ~S" name case) (push `(t nil ,@(rest case)) clauses))) ((and multi-p (listp (first case))) (setf keys (append (first case) keys)) (push `((or ,@(mapcar #'(lambda (key) `(,test ,keyform-value ',key)) (first case))) nil ,@(rest case)) clauses)) (t (push (first case) keys) (push `((,test ,keyform-value ',(first case)) nil ,@(rest case)) clauses)))) (case-body-aux name keyform keyform-value clauses keys errorp proceedp `(,(if multi-p 'member 'or) ,@keys)))) ;;; CASE-BODY-AUX provides the expansion once CASE-BODY has groveled all the ;;; cases. Note: it is not necessary that the resulting code signal ;;; case-failure conditions, but that's what KMP's prototype code did. We call ;;; CASE-BODY-ERROR, because of how closures are compiled. RESTART-CASE has ;;; forms with closures that the compiler causes to be generated at the top of ;;; any function using the case macros, regardless of whether they are needed. ;;; (defun case-body-aux (name keyform keyform-value clauses keys errorp proceedp expected-type) (if proceedp (let ((block (gensym)) (again (gensym))) `(let ((,keyform-value ,keyform)) (block ,block (tagbody ,again (return-from ,block (cond ,@(nreverse clauses) (t (setf ,keyform-value (setf ,keyform (case-body-error ',name ',keyform ,keyform-value ',expected-type ',keys))) (go ,again)))))))) `(let ((,keyform-value ,keyform)) ,keyform-value ; prevent warnings when key not used eg (case key (t)) (cond ,@(nreverse clauses) ,@(if errorp `((t (error 'case-failure :name ',name :datum ,keyform-value :expected-type ',expected-type :possibilities ',keys)))))))) (defun case-body-error (name keyform keyform-value expected-type keys) (restart-case (error 'case-failure :name name :datum keyform-value :expected-type expected-type :possibilities keys) (store-value (value) :report (lambda (stream) (format stream "Supply a new value for ~S." keyform)) :interactive read-evaluated-form value))) #|!!! (defmacro case (keyform &body cases) "CASE Keyform {({(Key*) | Key} Form*)}* Evaluates the Forms in the first clause with a Key EQL to the value of Keyform. If a singleton key is T then the clause is a default clause." (case-body 'case keyform cases t 'eql nil nil)) |# (defmacro ccase (keyform &body cases) "CCASE Keyform {({(Key*) | Key} Form*)}* Evaluates the Forms in the first clause with a Key EQL to the value of Keyform. If none of the keys matches then a correctable error is signalled." (case-body 'ccase keyform cases t 'eql t t)) (defmacro ecase (keyform &body cases) "ECASE Keyform {({(Key*) | Key} Form*)}* Evaluates the Forms in the first clause with a Key EQL to the value of Keyform. If none of the keys matches then an error is signalled." (case-body 'ecase keyform cases t 'eql t nil)) (defmacro typecase (keyform &body cases) "TYPECASE Keyform {(Type Form*)}* Evaluates the Forms in the first clause for which TYPEP of Keyform and Type is true." (case-body 'typecase keyform cases nil 'typep nil nil)) (defmacro ctypecase (keyform &body cases) "CTYPECASE Keyform {(Type Form*)}* Evaluates the Forms in the first clause for which TYPEP of Keyform and Type is true. If no form is satisfied then a correctable error is signalled." (case-body 'ctypecase keyform cases nil 'typep t t)) (defmacro etypecase (keyform &body cases) "ETYPECASE Keyform {(Type Form*)}* Evaluates the Forms in the first clause for which TYPEP of Keyform and Type is true. If no form is satisfied then an error is signalled." (case-body 'etypecase keyform cases nil 'typep t nil))
6,526
Common Lisp
.lisp
123
47.804878
240
0.603762
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
2252d7e180adbafd60fa6ce001d55931b4b0af83f0cbca15754ffd827600568e
11,427
[ -1 ]
11,428
empty.lisp
ufasoft_lisp/src/lisp/code/empty.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (print "Empty complete")
1,473
Common Lisp
.lisp
7
209.142857
240
0.399317
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
f64f6cea2c4c9639e043fb920abd1e7ce242aa2ed384c370611292d754404a5c
11,428
[ -1 ]
11,429
ext.lisp
ufasoft_lisp/src/lisp/code/ext.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|#
1,449
Common Lisp
.lisp
6
240
240
0.39375
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
0e8487fd2ffa01b4b6666a616d18eb0817a6c2c2bb5ade7cba33be0e4bea8197
11,429
[ -1 ]
11,430
string.lisp
ufasoft_lisp/src/lisp/code/string.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (in-package "SYS") (defun string-left-trim (cb s) (do ((i 0 (1+ i))) ((or (>= i (length s)) (not (find (char s i) cb))) (subseq s i)))) (defun string-right-trim (cb s) (do ((i (1- (length s)) (1- i))) ((or (minusp i) (not (find (char s i) cb))) (subseq s 0 (1+ i))))) (defun string-trim (cb s) (string-left-trim cb (string-right-trim cb s))) (defun string/= (x y &rest rest &key (start1 0) end1 (start2 0) end2) (declare (ignore start1 end1 start2 end2)) (apply #'mismatch (string x) (string y) :test #'char= rest)) (defun _string-compare< (c= c< x y &rest rest &key (start1 0) end1 (start2 0) end2) (setq x (string x) y (string y)) (let ((m (apply #'mismatch x y :test c= rest))) (when m (let ((off (- m start1))) (cond ((>= off (- (_end end2 y) start2)) nil) ((>= m (_end end1 x)) m) ((funcall c< (char x m) (char y (+ start2 off))) m)))))) #| (defun _string-compare> (c= c> x y &rest rest &key (start1 0) end1 (start2 0) end2) (let ((m (apply #'mismatch x y :test c= rest))) (cond ((or (null m) (>= m (_end end1 x))) nil) ((>= m (_end end2 y)) m) ((funcall c> (char x m) (char y m)) m)))) |# (defun string< (x y &rest rest &key (start1 0) end1 (start2 0) end2) (declare (ignore start1 end1 start2 end2)) (apply #'_string-compare< #'char= #'char< x y rest)) (defun string> (x y &rest rest &key (start1 0) end1 (start2 0) end2) (declare (ignore rest)) (let ((m (string< y x :start1 start2 :end1 end2 :start2 start1 :end2 end1))) (if m (+ (- m start2) start1)))) ; (apply #'_string-compare> #'char= #'char> x y rest)) (defun string<= (x y &rest rest &key (start1 0) end1 (start2 0) end2) (declare (ignore start1 start2 end2)) (if (apply #'string= x y rest) (_end end1 x) (apply #'string< x y rest))) (defun string>= (x y &rest rest &key (start1 0) end1 (start2 0) end2) (declare (ignore start1 start2 end2)) (if (apply #'string= x y rest) (_end end1 x) (apply #'string> x y rest))) (defun string-not-equal (x y &rest rest &key (start1 0) end1 (start2 0) end2) (declare (ignore start1 end1 start2 end2)) (apply #'mismatch (string x) (string y) :test #'char-equal rest)) (defun string-lessp (x y &rest rest &key (start1 0) end1 (start2 0) end2) (declare (ignore start1 end1 start2 end2)) (apply #'_string-compare< #'char-equal #'char-lessp x y rest)) (defun string-greaterp (x y &rest rest &key (start1 0) end1 (start2 0) end2) (declare (ignore rest)) (let ((m (string-lessp y x :start1 start2 :end1 end2 :start2 start1 :end2 end1))) (if m (+ (- m start2) start1)))) ; (apply #'_string-compare> #'char-equal #'char-greaterp x y rest)) (defun string-not-lessp (x y &rest rest &key (start1 0) end1 (start2 0) end2) (declare (ignore start1 start2 end2)) (if (apply #'string-equal x y rest) (_end end1 x) (apply #'string-greaterp x y rest))) (defun string-not-greaterp (x y &rest rest &key (start1 0) end1 (start2 0) end2) (declare (ignore start1 start2 end2)) (if (apply #'string-equal x y rest) (if end1 end1 (length x)) (apply #'string-lessp x y rest))) (defmacro with-one-string (string start end cum-offset &rest forms) `(let ((,string (if (stringp ,string) ,string (string ,string)))) (with-array-data ((,string ,string :offset-var ,cum-offset) (,start ,start) (,end (or ,end (length (the vector ,string))))) ,@forms))) #|!!!R (defun string-upcase (string &key (start 0) end) "Given a string, returns a new string that is a copy of it with all lower case alphabetic characters converted to uppercase." (declare (fixnum start)) (let* ((string (if (stringp string) string (string string))) (slen (length string))) (declare (fixnum slen)) (with-one-string string start end offset (let ((offset-slen (+ slen offset)) (newstring (make-string slen))) (declare (fixnum offset-slen)) (do ((index offset (1+ index)) (new-index 0 (1+ new-index))) ((= index start)) (declare (fixnum index new-index)) (setf (schar newstring new-index) (schar string index))) (do ((index start (1+ index)) (new-index (- start offset) (1+ new-index))) ((= index (the fixnum end))) (declare (fixnum index new-index)) (setf (schar newstring new-index) (char-upcase (schar string index)))) (do ((index end (1+ index)) (new-index (- (the fixnum end) offset) (1+ new-index))) ((= index offset-slen)) (declare (fixnum index new-index)) (setf (schar newstring new-index) (schar string index))) newstring)))) (defun string-downcase (string &key (start 0) end) "Given a string, returns a new string that is a copy of it with all upper case alphabetic characters converted to lowercase." (declare (fixnum start)) (let* ((string (if (stringp string) string (string string))) (slen (length string))) (declare (fixnum slen)) (with-one-string string start end offset (let ((offset-slen (+ slen offset)) (newstring (make-string slen))) (declare (fixnum offset-slen)) (do ((index offset (1+ index)) (new-index 0 (1+ new-index))) ((= index start)) (declare (fixnum index new-index)) (setf (schar newstring new-index) (schar string index))) (do ((index start (1+ index)) (new-index (- start offset) (1+ new-index))) ((= index (the fixnum end))) (declare (fixnum index new-index)) (setf (schar newstring new-index) (char-downcase (schar string index)))) (do ((index end (1+ index)) (new-index (- (the fixnum end) offset) (1+ new-index))) ((= index offset-slen)) (declare (fixnum index new-index)) (setf (schar newstring new-index) (schar string index))) newstring)))) |# (defun string-capitalize (string &key (start 0) end) "Given a string, returns a copy of the string with the first character of each ``word'' converted to upper-case, and remaining chars in the word converted to lower case. A ``word'' is defined to be a string of case-modifiable characters delimited by non-case-modifiable chars." (declare (fixnum start)) (let* ((string (if (stringp string) string (string string))) (slen (length string))) (declare (fixnum slen)) (with-one-string string start end offset (let ((offset-slen (+ slen offset)) (newstring (make-string slen))) (declare (fixnum offset-slen)) (do ((index offset (1+ index)) (new-index 0 (1+ new-index))) ((= index start)) (declare (fixnum index new-index)) (setf (schar newstring new-index) (schar string index))) (do ((index start (1+ index)) (new-index (- start offset) (1+ new-index)) (newword t) (char ())) ((= index (the fixnum end))) (declare (fixnum index new-index)) (setq char (schar string index)) (cond ((not (alphanumericp char)) (setq newword t)) (newword ;;char is first case-modifiable after non-case-modifiable (setq char (char-upcase char)) (setq newword ())) ;;char is case-modifiable, but not first (t (setq char (char-downcase char)))) (setf (schar newstring new-index) char)) (do ((index end (1+ index)) (new-index (- (the fixnum end) offset) (1+ new-index))) ((= index offset-slen)) (declare (fixnum index new-index)) (setf (schar newstring new-index) (schar string index))) newstring)))) (defun nstring-upcase (string &key (start 0) end) "Given a string, returns that string with all lower case alphabetic characters converted to uppercase." (declare (fixnum start)) (let ((save-header string)) (with-one-string string start end offset (do ((index start (1+ index))) ((= index (the fixnum end))) (declare (fixnum index)) (setf (schar string index) (char-upcase (schar string index))))) save-header)) (defun nstring-downcase (string &key (start 0) end) "Given a string, returns that string with all upper case alphabetic characters converted to lowercase." (declare (fixnum start)) (let ((save-header string)) (with-one-string string start end offset (do ((index start (1+ index))) ((= index (the fixnum end))) (declare (fixnum index)) (setf (schar string index) (char-downcase (schar string index))))) save-header)) (defun nstring-capitalize (string &key (start 0) end) "Given a string, returns that string with the first character of each ``word'' converted to upper-case, and remaining chars in the word converted to lower case. A ``word'' is defined to be a string of case-modifiable characters delimited by non-case-modifiable chars." (declare (fixnum start)) (let ((save-header string)) (with-one-string string start end offset (do ((index start (1+ index)) (newword t) (char ())) ((= index (the fixnum end))) (declare (fixnum index)) (setq char (schar string index)) (cond ((not (alphanumericp char)) (setq newword t)) (newword ;;char is first case-modifiable after non-case-modifiable (setf (schar string index) (char-upcase char)) (setq newword ())) (t (setf (schar string index) (char-downcase char)))))) save-header))
10,917
Common Lisp
.lisp
228
42.346491
240
0.596495
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
94999403e76cc085542a77fe5fa5016fdbb9b10618d3599ef1a280caffbc892b
11,430
[ -1 ]
11,431
init.lisp
ufasoft_lisp/src/lisp/code/init.lisp
#|######### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] ################################################################################################# # # # 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 3, 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, see <http://www.gnu.org/licenses/> # #############################################################################################################################################################################################################################################=|# (SYS::_load "export") (eval-when (compile load eval) (setq *package* (find-package "SYS"))) (%putd 'caar (%make-closure 'caar #15Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5B 19 02) nil nil)) (%putd 'cadr (%make-closure 'cadr #15Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5B 19 02) nil nil)) (%putd 'cdar (%make-closure 'cdar #15Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5C 19 02) nil nil)) (%putd 'cddr (%make-closure 'cddr #15Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5C 19 02) nil nil)) (%putd 'caaar (%make-closure 'caaar #16Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5B 5B 19 02) nil nil)) (%putd 'caadr (%make-closure 'caadr #16Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5B 5B 19 02) nil nil)) (%putd 'cadar (%make-closure 'cadar #16Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5C 5B 19 02) nil nil)) (%putd 'caddr (%make-closure 'caddr #16Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5C 5B 19 02) nil nil)) (%putd 'cdaar (%make-closure 'cdaar #16Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5B 5C 19 02) nil nil)) (%putd 'cdadr (%make-closure 'cdadr #16Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5B 5C 19 02) nil nil)) (%putd 'cddar (%make-closure 'cddar #16Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5C 5C 19 02) nil nil)) (%putd 'cdddr (%make-closure 'cdddr #16Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5C 5C 19 02) nil nil)) (%putd 'caaaar (%make-closure 'caaaar #17Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5B 5B 5B 19 02) nil nil)) (%putd 'caaadr (%make-closure 'caaadr #17Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5B 5B 5B 19 02) nil nil)) (%putd 'caadar (%make-closure 'caadar #17Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5C 5B 5B 19 02) nil nil)) (%putd 'caaddr (%make-closure 'caaddr #17Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5C 5B 5B 19 02) nil nil)) (%putd 'cadaar (%make-closure 'cadaar #17Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5B 5C 5B 19 02) nil nil)) (%putd 'cadadr (%make-closure 'cadadr #17Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5B 5C 5B 19 02) nil nil)) (%putd 'caddar (%make-closure 'caddar #17Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5C 5C 5B 19 02) nil nil)) (%putd 'cadddr (%make-closure 'cadddr #17Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5C 5C 5B 19 02) nil nil)) (%putd 'cdaaar (%make-closure 'cdaaar #17Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5B 5B 5C 19 02) nil nil)) (%putd 'cdaadr (%make-closure 'cdaadr #17Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5B 5B 5C 19 02) nil nil)) (%putd 'cdadar (%make-closure 'cdadar #17Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5C 5B 5C 19 02) nil nil)) (%putd 'cdaddr (%make-closure 'cdaddr #17Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5C 5B 5C 19 02) nil nil)) (%putd 'cddaar (%make-closure 'cddaar #17Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5B 5C 5C 19 02) nil nil)) (%putd 'cddadr (%make-closure 'cddadr #17Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5B 5C 5C 19 02) nil nil)) (%putd 'cdddar (%make-closure 'cdddar #17Y(00 00 00 00 01 00 00 00 00 00 9E 5B 5C 5C 5C 19 02) nil nil)) (%putd 'cddddr (%make-closure 'cddddr #17Y(00 00 00 00 01 00 00 00 00 00 9E 5C 5C 5C 5C 19 02) nil nil)) (proclaim '(special *macroexpand-hook*)) (setq *macroexpand-hook* #'funcall) (proclaim '(special compiler::*compiling* compiler::*compiling-from-file* compiler::*c-error-output*)) ; for load/compiling (setq compiler::*compiling* nil) #-COMPILER ; only for bootstrapping (progn ;; preliminary, no expansion at GET_CLOSURE: (sys::%putd '%expand-lambdabody-main (function %expand-lambdabody-main (lambda (lambdabody venv fenv) (declare (source nil) (ignore venv fenv)) lambdabody))) ;; preliminary, defun is to be expanded trivially: (sys::%putd 'defun (sys::make-macro (function defun (lambda (form env) (declare (ignore env)) #| (let ((name (cadr form)) (lambdalist (caddr form)) (body (cdddr form))) `(SYS::%PUTD ',name (FUNCTION ,name (LAMBDA ,lambdalist ,@body)))) |# (let ((name (cadr form))) (list 'sys::%putd (list 'quote name) (list 'function name (cons 'lambda (cddr form))))))))) ) #-ULISP-BACKQUOTE-AS-SPECIAL-OPERATOR (progn (%putd 'backquote (make-macro (function backquote (lambda (form env) (declare (ignore env)) (bq-expand (cadr form)))))) ;; The BQ-NCONC form is a marker used in the backquote-generated code. ;; It tells the optimizer that the enclosed forms may be combined with ;; NCONC. By defining BQ-NCONC as a macro, we take care of any `surviving' ;; occurences that are not removed and processed by the optimizer. (sys::%putd 'sys::bq-nconc (sys::make-macro (function sys::bq-nconc (lambda (form env) (declare (ignore env)) (if (cddr form) `(nconc ,@(cdr form)) (cadr form)))))) ) #|!!!hardwired (%putd 'proclaim (function proclaim (lambda (spec) (declare (source nil)) (if (eq (car spec) 'special) (_proclaim-special (cdr spec)))))) |# (%putd 'not (symbol-function 'null)) (%putd 'char-int (symbol-function 'char-code)) (%putd 'first (symbol-function 'car)) (%putd 'second (symbol-function 'cadr)) (%putd 'third (symbol-function 'caddr)) (%putd 'fourth (symbol-function 'cadddr)) (%putd 'rest (symbol-function 'cdr)) #-COMPILER (sys::%putd 'sys::predefun (%putd 'defun (make-macro (function defun (lambda (form env) (let ((name (cadr form))) `(%putd ',name (function ,name ,(cons 'lambda (cddr form)))))))))) #-COMPILER (sys::%putd 'sys::predefun (%putd 'defun (make-macro (function defun (lambda (form env) (let* ((name (cadr form)) (bname (cond ((symbolp name) name) ((_setf-name-p name) (cadr name)) (t (err)))) (fsym (if (symbolp name) name (get-setf-symbol bname)))) `(PROGN (%PUTD ',fsym (_GET-CLOSURE ',(cddr form) ',name t)) ;!!! maybe need env too? ',name))))))) #| (%putd 'defun (make-macro (function defun (lambda (form env) (let* ((name (cadr form)) (bname (cond ((symbolp name) name) ((_setf-name-p name) (cadr name)) (t (err)))) (fsym (if (symbolp name) name (get-setf-symbol bname)))) (multiple-value-bind (body decls docs) (parse-body (cdddr form) t) `(PROGN (when _pp (_pr "-------------------------") (_pr '(LAMBDA ,(caddr form) ,(cons 'DECLARE decls) ,docs (BLOCK ,bname ,@body)))) (%PUTD ',fsym (FUNCTION ,name (LAMBDA ,(caddr form) ,(cons 'DECLARE decls) ,docs (BLOCK ,bname ,@body)))) ',name))))))) |# (sys::%putd 'sys::remove-old-definitions (function sys::remove-old-definitions (lambda (symbol &optional (preliminary nil)) ; ABI ;; removes the old function-definitions of a symbol (declare (ignore preliminary)) (when (special-operator-p symbol) (error-of-type 'error (TEXT "~S is a special operator and may not be redefined.") symbol)) #| (unless preliminary (sys::check-redefinition symbol "DEFUN/DEFMACRO" (sys::fbound-string symbol))) |# (fmakunbound symbol) ; discard function & macro definition ;; Property sys::definition is not discarded, because it is ;; soon reset, anyway. ;!!! (remprop symbol 'sys::macro) ; discard macro definition ;!!! (remprop symbol 'sys::defstruct-reader) ; discard DEFSTRUCT information ;!!! (sys::%set-documentation symbol 'FUNCTION nil) (when (get symbol 'sys::inline-expansion) (sys::%put symbol 'sys::inline-expansion t)) (when (get symbol 'sys::traced-definition) ; discard Trace (warn (TEXT "DEFUN/DEFMACRO: redefining ~S; it was traced!") symbol) (untrace2 symbol))))) (%proclaim-constant 'lambda-list-keywords '(&optional &rest &key &allow-other-keys &aux &body &whole &environment)) (defun symbol-to-keyword (s) (intern (symbol-name s) *keyword-package*)) (defun ext:string-concat (&rest seqs) (apply #'concatenate 'string seqs)) (_load "macro") (defmacro return (&optional v) (list 'return-from nil v)) (defun _func-of (fn) (symbol-function (if (_setf-name-p fn) (get-setf-symbol (cadr fn)) fn))) #|!!! (defun _make-macro-expander (macrodef) (make-macro (eval (_make-macro-expansion macrodef)))) |# #|!!! (defun _last2 (p q) (if (atom p) q (_last2 (cdr p) (cdr q)))) (defun _last (n p q) (if (atom p) q (if (plusp n) (_last (1- n) (cdr p) q) (_last2 (cdr p) (cdr q))))) |# (defun nth (n a) (car (nthcdr n a))) (defun fifth (a) (car (cddddr a))) (defun sixth (a) (car (cdr (cddddr a)))) (defun seventh (a) (car (cddr (cddddr a)))) (defun eighth (a) (car (cdddr (cddddr a)))) (defun ninth (a) (car (cddddr (cddddr a)))) (defun tenth (a) (car (cdr (cddddr (cddddr a))))) (defun function-macro-p (x) (eq (type-of x) 'function-macro)) (defun _check-numbers (r) (if r (if (numberp (car r)) (_check-numbers (cdr r)) (error 'type-error)))) #|!!!R (defun _reduce-list (f r init) (if r (_seq-infix f (car r) (cdr r)) init)) (defun _seq-infix (f a r) (if r (_seq-infix f (apply f (multiple-value-list (_norm-pair a (car r)))) (cdr r)) a)) (defun _reduce-list-ex (f a r init) (if r (_seq-infix f a r) (apply f (multiple-value-list (_norm-pair init a))))) |# (defun _to-boolean (x) (if x t)) (defun make-preliminary (closure) ; ABI (sys::\(setf\ closure-name\) (list 'ext::preliminary (sys::closure-name closure)) closure) closure) (%putd 'fasthash-eq #'eq) (%putd 'stablehash-eq #'eq) (%putd 'fasthash-eql #'eql) (%putd 'stablehash-eql #'eql) (%putd 'fasthash-equal #'equal) (%putd 'stablehash-equal #'equal) (_load "explambda") ;;; Here we have Expander and may reload already loaded code, expanding it for speed (_load "macro") (_load "explambda") (defmacro in-package (name) `(eval-when (compile load eval) (setq *package* (sys::_get-package ',name)))) (in-package "SYSTEM") (defun fixnump (x) (_to-boolean (memq (type-of x) '(bit fixnum)))) (defun weak-pointer-p (x) (eq (type-of x) 'weak-pointer)) #|!!!R hardwired because can be called from GF dispatch (defun stringp (x) (let ((a (type-of x))) (and (consp a) (_to-boolean (memq (car a) '(string base-string simple-string simple-base-string)))))) (defun pathnamep (x) (eq (type-of x) 'pathname)) |# (defun simple-string-p (x) (let ((a (type-of x))) (and (consp a) (_to-boolean (memq (car a) '(simple-string simple-base-string)))))) (defun bit-vector-p (x) (let ((a (type-of x))) (and (consp a) (_to-boolean (memq (car a) '(bit-vector simple-bit-vector)))))) (defun packagep (x) (eq (type-of x) 'package)) (defun readtablep (x) (eq (type-of x) 'readtable)) (defun hash-table-p (x) (eq (type-of x) 'hash-table)) (defmacro declaim (&body r) (if r `(progn (proclaim ',(car r)) (declaim ,@(cdr r))))) (defmacro dolist ((p x &optional r) &body body) (let ((n (gensym))) `(do* ((,n ,x (cdr ,n)) (,p (car ,n) (car ,n))) ((null ,n) ,r) ,@body))) (defmacro dotimes ((p x &optional r) &body body) (let ((n (gensym))) `(do ((,p 0 (1+ ,p)) (,n ,x)) ((>= ,p ,n) ,r) ,@body))) (defun simple-bit-vector-p (x) (values (subtypep (type-of x) 'simple-bit-vector))) (defun typep (x t1 &optional e) (declare (ignore e)) (let ((tt (type-of t1))) (cond ((eq tt 'symbol) (if (eq t1 'atom) (atom x) (subtypep (type-of x) t1))) ((eq tt 'cons) (let ((c (car t1))) (cond ((eq c 'or) (member-if (lambda (y) (typep x y)) (cdr t1))) ((eq c 'and) (not (member-if-not (lambda (y) (typep x y)) (cdr t1)))) ((eq c 'not) (not (typep x (cadr t1)))) ((eq c 'member) (member-if (lambda (y) (eql x y)) (cdr t1))) ((err)))))))) (defun get-setf-expansion (p &optional env) (block nil (tagbody lab (if (consp p) (let ((f (get (car p) 'SETF-EXPANDER))) (if f (return-from get-setf-expansion (if (symbolp f) (do* ((storevar (gensym)) (tempvars nil (cons (gensym) tempvars)) (tempforms nil (cons (car formr) tempforms)) (formr (cdr p) (cdr formr))) ((atom formr) (setq tempforms (nreverse tempforms)) (values tempvars tempforms `(,storevar) `(,f ,@tempvars ,storevar) `(,(car p) ,@tempvars))) (when (eq f 'set-slot-value) ;!!! (_pr "---------------") ) ) (apply f (cdr p))))))) (if (eq p (setq p (macroexpand-1 p env))) (return)) (go lab))) (cond ((symbolp p) (let ((ta (gensym))) (values nil nil (list ta) (list 'setq p ta) p))) ((and (consp p) (symbolp (car p))) (let* ((a (car p)) (d (cdr p)) (f (get a 'SETF-EXPANDER))) (if f (apply f d) (let ((sf (_subforms d)) (ta (gensym))) (values sf d (list ta) (list* (list 'setf a) ta sf) (cons a sf)))))) (t (error-of-type 'source-program-error (TEXT "~S: Argument ~S is not a SETF place.") 'get-setf-expansion p)))) (defun get-setf-method (form &optional (env (vector nil nil))) (multiple-value-bind (vars vals stores store-form access-form) (get-setf-expansion form env) (unless (and (consp stores) (null (cdr stores))) (error-of-type 'source-program-error (TEXT "SETF place ~S produces more than one store variable.") form ) ) (values vars vals stores store-form access-form) ) ) (defmacro pop (p) (multiple-value-bind (x v s w a) (get-setf-expansion p) (let ((n (car s))) `(let* ,(mapcar #'list (append x s) (append v (list a))) (prog1 (car ,n) (setq ,n (cdr ,n)) ,w))))) (defun err () (error "Unspecified error")) #|!!!Hardcoded, should generate type-error in not proper=list (defun values-list (r) (apply #'values r)) |# (defun macroexpand (f &optional env) (multiple-value-bind (r p) (macroexpand-1 f env) (if p (values (macroexpand r env) t) (values f nil)))) (defun _callf2 (func n place args) (let ((z (gensym))) (multiple-value-bind (x v s w a) (get-setf-expansion place) (list 'let* (mapcar #'list (cons z (append x s)) (cons n (append v (list (list* func z a args))))) w)))) (defmacro pushnew (x p &rest rest &key key test test-not) (declare (ignore key test test-not)) (_callf2 'adjoin x p rest)) (defun _argnames (lam) (if lam (let ((a (car lam)) (d (_argnames (cdr lam)))) (cond ((_lambda-list-keyword-p a) d) ((symbolp a) (cons a d)) ((consp a) (cons (car a) d)) ((err)))))) ;!!! need process &key &aux (defun _callf (func place &rest args) (multiple-value-bind (x v s w a) (get-setf-expansion place) `(let* ,(mapcar #'list (append x s) (append v (list `(,func ,a ,@args)))) ,w))) (defmacro define-modify-macro (name lam fun &optional doc) (let ((p (gensym))) `(DEFMACRO ,name (,p ,@lam) ,doc (_callf ',fun ,p ,@(_argnames lam))))) (define-modify-macro incf (&optional (delta 1)) +) (define-modify-macro decf (&optional (delta 1)) -) #| (defmacro incf (p &optional (delta 1)) (_callf #'+ p (list delta))) (defmacro decf (p &optional (delta 1)) (_callf #'- p (list delta))) |# (defun _setf-expansions (p) (if p (multiple-value-bind (x v s w a) (get-setf-expansion (car p)) (cons (list x v s w a) (_setf-expansions (cdr p)))))) (defmacro push (item place) (_callf2 'cons item place nil)) (defun _psetf (r forms env) (if r (multiple-value-bind (x v s w a) (get-setf-expansion (car r) env) (declare (ignore a)) (let ((sf (_psetf (cddr r) (append forms (list w)) env))) `(let* ,(mapcar #'list x v) ,(if (> (length s) 1) (list 'multiple-value-bind s (cadr r) sf) (list 'let (list (list (car s) (cadr r))) sf ))))) `(progn ,@forms nil))) (defmacro psetf (&body r &environment env) (_psetf r nil env)) (defun get-setf-symbol (symbol &optional env) (declare (ignore env)) (or (get symbol 'SETF-FUNCTION) (progn (when (get symbol 'SETF-EXPANDER) (warn (ENGLISH "The function (~S ~S) is hidden by a SETF expander.") 'setf symbol )) (%put symbol 'SETF-FUNCTION (setf-symbol symbol))))) (defun (setf nth) (v n a) (setf (car (nthcdr n a)) v)) (defun (setf first) (n a) (setf (car a) n)) (defun (setf second) (n a) (setf (car (cdr a)) n)) (defun (setf third) (n a) (setf (car (cddr a)) n)) (defun (setf fourth) (n a) (setf (car (cdddr a)) n)) (defun (setf fifth) (n a) (setf (car (cddddr a)) n)) (defun (setf sixth) (n a) (setf (car (cdr (cddddr a))) n)) (defun (setf seventh) (n a) (setf (car (cddr (cddddr a))) n)) (defun (setf eighth) (n a) (setf (car (cdddr (cddddr a))) n)) (defun (setf ninth) (n a) (setf (car (cddddr (cddddr a))) n)) (defun (setf tenth) (n a) (setf (car (cdr (cddddr (cddddr a)))) n)) (defun (setf rest) (n a) (setf (cdr a) n)) (defun _supertypes (x) (cons x (cond ((memq x '(symbol sequence character stream function array readtable package pathname hash-table number)) '(t)) ((eq x t) nil) ((eq x 'keyword) '(symbol t)) ((eq x 'boolean) '(symbol t)) ((memq x '(fixnum bignum)) (_supertypes 'integer)) ((memq x '(compiled-function function)) '(function t)) ((memq x '(standard-char base-char extended-char)) '(character t)) ((eq x 'integer) '(rational real number t)) ((eq x 'signed-byte) (_supertypes 'integer)) ((eq x 'unsigned-byte) (_supertypes 'signed-byte)) ((eq x 'bit) (cons 'fixnum (_supertypes 'unsigned-byte))) ((eq x 'ratio) '(rational real number t)) ((eq x 'list) '(sequence t)) ((eq x 'float) '(real number t)) ((memq x '(short-float single-float double-float long-float)) (_supertypes 'float)) ((eq x 'complex) '(number t)) ((eq x 'cons) (_supertypes 'list)) ((eq x 'null) '(symbol list sequence t)) ((eq x 'vector) '(array sequence t)) ((eq x 'simple-array) '(array t)) ((eq x 'simple-vector) `(simple-array ,@(_supertypes 'vector))) ((eq x 'string) (_supertypes 'vector)) ((eq x 'base-string) (_supertypes 'string)) ((eq x 'simple-string) '(string vector simple-array array sequence t)) ((eq x 'simple-base-string) `(base-string ,@(_supertypes 'simple-string))) ((eq x 'bit-vector) '(_supertypes 'vector)) ((eq x 'simple-bit-vector) '(bit-vector vector simple-array array sequence t)) ((eq x 'logical-pathname) '(pathname)) (t (mapcar #'class-name (class-precedence-list (find-class x))))))) (defun subtypep (t1 t2 &optional e) (declare (ignore e)) (if (eq (type-of t2) 'cons) (values t t) (if t1 (values (memq t2 (_supertypes t1)) t) (values t t)))) (defun %set-documentation (symbol doctype value) ; !!! dummy (declare (ignore symbol doctype value)) ) #|!!!P (defmacro define-setf-expander (af lam &body body &environment env) (multiple-value-bind (forms decls doc) (parse-body body t) `(PROGN (%PUT ',af 'SETF-EXPANDER #'(lambda ,lam ,@forms)) (%SET-DOCUMENTATION ',af 'SETF ,doc) ',af))) (define-setf-expander values (&rest p) (let ((r (_setf-expansions p))) (values (apply #'append (mapcar #'first r)) (apply #'append (mapcar #'second r)) (apply #'append (mapcar #'third r)) `(values ,@(mapcar #'fourth r)) `(values ,@(mapcar #'fifth r))))) |# (defun _get-defsetf-store (xs vars forms) `(LET ,(mapcar #'(lambda (x y) (list x (list 'quote y))) vars xs) ,@forms)) ;!!! (defmacro defsetf (af uf &body body) (if (listp uf) (let* ((lam uf) (ss (car body)) (forms (cdr body)) (n (length lam)) (args (_gensyms n))) `(EVAL-WHEN (LOAD COMPILE EVAL) (DEFINE-SETF-EXPANDER ,af ,args (LET ((x (_gensyms ,n)) (s (_gensyms ,(length ss)))) (VALUES x (LIST ,@args) s (eval (_get-defsetf-store (append x s) ',(append lam ss) ',forms)) (cons ',af x)))) ',af)) `(EVAL-WHEN (LOAD COMPILE EVAL) (%PUT ',af 'SETF-EXPANDER ',uf) ;!!! need also doc ',af))) #| (let ((store (car body)) (forms (cdr body))) `(DEFINE-SETF-EXPANDER ,af (&rest r) (let ((x (_subforms r)) (s (gensym))) (values x r (list s) (cons ',uf (append x (list s))) (cons ',af x))))))) |# (defsetf symbol-function %putd) (defmacro _def_c_r (n f r) `(defun (setf ,n) (x p) (setf (,f (,r p)) x))) (_def_c_r caar car car) (_def_c_r cadr car cdr) (_def_c_r cdar cdr car) (_def_c_r cddr cdr cdr) (_def_c_r caaar car caar) (_def_c_r caadr car cadr) (_def_c_r cadar car cdar) (_def_c_r caddr car cddr) (_def_c_r cdaar cdr caar) (_def_c_r cdadr cdr cadr) (_def_c_r cddar cdr cdar) (_def_c_r cdddr cdr cddr) (_def_c_r caaaar car caaar) (_def_c_r caaadr car caadr) (_def_c_r caadar car cadar) (_def_c_r caaddr car caddr) (_def_c_r cadaar car cdaar) (_def_c_r cadadr car cdadr) (_def_c_r caddar car cddar) (_def_c_r cadddr car cdddr) (_def_c_r cdaaar cdr caaar) (_def_c_r cdaadr cdr caadr) (_def_c_r cdadar cdr cadar) (_def_c_r cdaddr cdr caddr) (_def_c_r cddaar cdr cdaar) (_def_c_r cddadr cdr cdadr) (_def_c_r cdddar cdr cddar) (_def_c_r cddddr cdr cdddr) (defsetf car %rplaca) (defsetf cdr %rplacd) (defsetf symbol-value set) (defsetf macro-function _setf_macro-function) (defsetf weak-pointer-value _setf_weak-pointer-value) (defun _setf (r env) (if r (cons (multiple-value-bind (x v s w a) (get-setf-expansion (car r) env) (declare (ignore a)) `(let* ,(mapcar #'list x v) ,(if (cdr s) (list 'multiple-value-bind s (cadr r) w) (list 'let (list (list (car s) (cadr r))) w)))) (_setf (cddr r) env)))) (defmacro setf (&body r &environment env) (let ((z (_setf r env))) (if (cdr z) (cons 'progn z) (car z)))) #|P (define-setf-expander getf (place indicator &optional default &environment env) (multiple-value-bind (temps subforms stores setterform getterform) (get-setf-method place env) (let* ((storevar (gensym)) (indicatorvar (gensym)) (defaultvar-list (if default (list (gensym)) `())) ) (values `(,@temps ,indicatorvar ,@defaultvar-list) `(,@subforms ,indicator ,@(if default `(,default) `())) `(,storevar) `(LET ((,(first stores) (SYS::%PUTF ,getterform ,indicatorvar ,storevar))) ,@defaultvar-list ; defaultvar zum Schein auswerten (WHEN ,(first stores) ,setterform) ,storevar ) `(GETF ,getterform ,indicatorvar ,@defaultvar-list) ) ) ) ) |# #|!!! (defun _setf_getf1 (p i) (if p (if (eq i (car p)) (cdr p) (_setf_getf1 (cddr p) i)))) (defun _setf_getf (p i v) (let ((x (_setf_getf1 p i))) (if x (progn (rplaca x v) p) (list* i v p)))) (define-setf-expander getf (p i &optional d) (multiple-value-bind (temps vals stores store-form access-form) (get-setf-expansion p) (let ((btemp (gensym)) ;Temp var for byte specifier. (store (gensym)) ;Temp var for byte to store. (stemp (car stores))) ;Temp var for int to store. (if (cdr stores) (error "Can't expand this.")) (values (append temps (list btemp)) ;Temporary variables. (append vals (list i)) ;Value forms. (list store) ;Store variables. `(let ((,stemp (_setf_getf ,access-form ,btemp ,store ))) ,store-form ,store) ;Storing form. `(getf ,access-form ,btemp) ;Accessing form. )))) |# (defmacro defvar (n &optional (i nil i-p) (d nil d-p)) `(progn (declaim (special ,n)) ,(if i-p `(unless (boundp ',n) (set ',n ,i))) ,(if d-p `(%SET-DOCUMENTATION ',n 'variable ',d)) ',n)) (defmacro defparameter (n i &optional (d nil d-p)) `(progn (declaim (special ,n)) (set ',n ,i) ,(if d-p `(%SET-DOCUMENTATION ',n 'variable ',d)) ',n)) (defun list-length-proper (x) (multiple-value-bind (len end) (%proper-list x) (if (or end (null len)) (err)) len)) (defun proper-list-p (x) (multiple-value-bind (len end) (%proper-list x) (and len (null end)))) (defun proper-list-length-in-bounds-p (x n &optional m) (multiple-value-bind (len end) (%proper-list x) (and len (null end) (>= len n) (or (null m) (>= m len))))) (defun list-length-in-bounds-p (x n m restp) (dotimes (i n) (if (atom x) (return-from list-length-in-bounds-p nil)) (setq x (cdr x))) (if (< m n) (return-from list-length-in-bounds-p nil)) (dotimes (i (- m n)) (cond ((null x) (return-from list-length-in-bounds-p t)) ((atom x) (return-from list-length-in-bounds-p nil))) (setq x (cdr x))) (or restp (null x))) (defvar *DEFUN-ACCEPT-SPECIALIZED-LAMBDA-LIST* nil) #| (defun string (s) (cond ((stringp s) s) ((symbolp s) (symbol-name s)) ((characterp s) (make-string 1 :initial-element s)) ((error 'type-error)))) |# (defun _check-contents (dims seq) (if dims (let ((n (car dims)) (r (cdr dims))) (if (/= n (length seq)) (error t) (do ((i 0 (1+ i))) ((= i n)) (_check-contents r (elt seq i))))))) (defun _check-non-negative (x) (unless (and (integerp x) (not (minusp x))) (error 'type-error :datum x :expected-type '(integer 0))) x) (defsetf row-major-aref _setf_row-major-aref) #| ;!!! (_pr "----------row-major-aref---------------") (multiple-value-bind (a b c d e) (get-setf-expansion '(row-major-aref a i)) (_pr a) (_pr b) (_pr c) (_pr d) (_pr e)) |# (defun _set-array-element (a j dims seq) (if dims (let ((n (car dims)) (r (cdr dims))) (do ((i 0 (1+ i))) ((= i n) j) (setq j (_set-array-element a j r (elt seq i))))) (progn (setf (row-major-aref a j) seq) (1+ j)))) (defun _fill-array-contents (a seq) (_check-contents (array-dimensions a) seq) (_set-array-element a 0 (array-dimensions a) seq)) (defun upgraded-array-element-type (x &optional env) (declare (ignore env)) (case x (bit 'bit) ((standard-char base-char) 'base-char) ((extended-char character) 'character) (t t))) #|!!!R (defun make-array (dims &key (element-type t) initial-element (initial-contents nil cont-suppl) adjustable fill-pointer displaced-to (displaced-index-offset 0)) (let ((a (_make-array dims (upgraded-array-element-type element-type) initial-element adjustable fill-pointer displaced-to displaced-index-offset))) (if cont-suppl (_fill-array-contents a initial-contents)) a)) |# (defsetf aref store) #|!!! as SUBR (defun svref (v i) (if (simple-vector-p v) (aref v i) (error 'type-error))) |# (defun (setf svref) (n v i) (if (simple-vector-p v) (setf (aref v i) n) (error 'type-error))) (defun complexp (x) (eq (type-of x) 'complex)) (defun _check-chars (r) (if r (if (characterp (car r)) (_check-chars (cdr r)) (error 'type-error)))) (defun _char-compare-1 (f g a r) (if r (let ((b (car r))) (and (funcall f (funcall g a) (funcall g b)) (_char-compare-1 f g b (cdr r)))) t)) (defun _char-compare (f a r) (_check-chars (cons a r)) (_char-compare-1 f #'char-code a r)) (defun _char-compare-ex (f a r) (_check-chars (cons a r)) (_char-compare-1 f #'(lambda (ch) (char-code (char-upcase ch))) a r)) (defun char= (a &rest r) (_char-compare #'= a r)) (defun char/= (a &rest r) (_check-chars (cons a r)) (apply #'_/= #'char= a r)) (defun char< (a &rest r) (_char-compare #'< a r)) (defun char> (a &rest r) (_char-compare #'> a r)) (defun char<= (a &rest r) (_char-compare #'<= a r)) (defun char>= (a &rest r) (_char-compare #'>= a r)) (defun char-equal (a &rest r) (_char-compare-ex #'= a r)) (defun char-not-equal (a &rest r) (_check-chars (cons a r)) (apply #'_/= #'char-equal a r)) (defun char-lessp (a &rest r) (_char-compare-ex #'< a r)) (defun char-greaterp (a &rest r) (_char-compare-ex #'> a r)) (defun char-not-lessp (a &rest r) (_char-compare-ex #'>= a r)) (defun char-not-greaterp (a &rest r) (_char-compare-ex #'<= a r)) (defun _minmax (f a r) (if r (_minmax f (if (funcall f a (car r)) a (car r)) (cdr r)) a)) (defun max (a &rest r) (if (fboundp 'EXT::type-expand) ;!!! dont work befor "type.lisp" loaded (check-type a real)) (_minmax '> a r)) (defun min (a &rest r) (if (fboundp 'EXT::type-expand) (check-type a real)) (_minmax '< a r)) #|!!!R hardwired (defun _mul2 (x y) (cond ((and (integerp x) (integerp y)) (_mul x y)) ((floatp x) (_mul x y)) ((rationalp x) (/ (* (numerator x) (numerator y)) (* (denominator x) (denominator y)))) ((complexp x) (let ((a (realpart x)) (b (imagpart x)) (c (realpart y)) (d (imagpart y))) (complex (- (* a c) (* b d)) (+ (* c b) (* a d))))))) (defun abs (z) (typecase z (complex (let ((x (realpart z)) (y (imagpart z))) (sqrt (+ (* x x) (* y y))))) (real (if (minusp z) (- z) z)) (t (error 'type-error :datum z :expected-type 'number)))) (defun _euclid (f x y) (multiple-value-bind (n a) (funcall f x y) (declare (ignore n)) (if (zerop a) y (_euclid f y a)))) (defun gcd (&rest r) (if r (let ((a (abs (car r))) (d (cdr r))) (if d (apply #'gcd (_euclid #'floor a (abs (car d))) (cdr d)) a)) 0)) |# #|!!! (defun _div-int (x y) (when (minusp y) (setq y (- y)) (setq x (- x))) (let ((g (gcd x y))) (when (/= g 1) (setq x (floor x g)) (setq y (floor y g))) (if (= y 1) x (_make-ratio x y)))) |# #|Hardcoded as _make-ratio (defun _div-int (x y) (when (minusp y) (setq y (- y)) (setq x (- x))) (let ((g (gcd x y))) (_make-ratio (truncate x g) (truncate y g)))) |# #|!!! hardwired (defun _div2 (x y) (if (zerop y) (error 'division-by-zero)) (cond ((integerp x) (_make-ratio x y)) ((floatp x) (_div x y)) ((rationalp x) (/ (* (numerator x) (denominator y)) (* (numerator y) (denominator x)))) ((complexp x) (let* ((a (realpart x)) (b (imagpart x)) (c (realpart y)) (d (imagpart y)) (m (+ (* c c) (* d d)))) (complex (/ (+ (* a c) (* b d)) m) (/ (- (* c b) (* a d)) m)))))) (defun * (&rest r) (_check-numbers r) (_reduce-list #'_mul2 r 1)) (defun / (a &rest r) (_check-numbers (cons a r)) (_reduce-list-ex #'_div2 a r 1)) |# (defun assoc-if (p list &key key) (car (_list-test #'car p list (_key key)))) (defun assoc-if-not (p list &key key) (assoc-if (complement p) list :key key)) (defun rassoc-if (p list &key key) (car (_list-test #'cdr p list (_key key)))) (defun rassoc-if-not (p list &key key) (rassoc-if (complement p) list :key key)) (defun rassoc (item list &key key (test #'eql) test-not) (rassoc-if (_test item test test-not) list :key key)) (defun set-difference (list-1 list-2 &rest rest &key key (test #'eql) test-not) (declare (ignore test test-not)) (if list-1 (let ((r (apply #'set-difference (cdr list-1) list-2 rest)) (item (car list-1))) (if (apply #'member (funcall (_key key) item) list-2 rest) (cons item r) r)))) (defun nset-difference (list-1 list-2 &rest rest &key key (test #'eql) test-not) (declare (ignore key test test-not)) (apply #'set-difference list-1 list-2 rest)) (defun adjoin (item list &rest rest &key key (test #'eql) test-not) (declare (ignore test test-not)) (if (apply #'member (funcall (_key key) item) list rest) list (cons item list))) (defun reverse (seq) (nreverse (copy-seq seq))) #|!!!D (do ((nseq (copy-seq seq)) (i 0 (1+ i)) (n (length seq))) ((= i n) nseq) (setf (elt nseq i) (elt seq (- n i 1))))) |# (defun _sharp-quote (stm ch p) (declare (ignore ch)) (list 'function (read stm t nil t))) (defun _rev-list-to-string (list) (concatenate 'string (nreverse list))) (defun _sharp-backslash (stm ch p) (declare (ignore ch p)) (let ((a (read-char stm))) (if (eq (_char-type (peek-char nil stm)) :constituent) (let ((r (name-char (_rev-list-to-string (do ((p (list a)) (ch (peek-char nil stm) (peek-char nil stm))) ((not (and ch (eq (_char-type ch) :constituent))) p) (push ch p) (read-char stm)))))) (if r r (error 'reader-error))) a))) (defun _sharp-colon (stm ch p) (declare (ignore ch p)) (_read-uninterned stm)) (defun _sharp-comma (stm ch p) (declare (ignore ch p)) (let ((x (read stm t nil t))) (unless *read-suppress* (eval x)))) #|!!!C (defun _sharp-dot (stm ch p) (let ((token (read stm t nil t))) (unless *read-suppress* (unless *read-eval* (error 'reader-error)) (eval token)))) |# #| (defun _sharp-cond (stm f) (if (funcall f (let ((*package* (find-package 'keyword))) (read stm t nil t)) *features*) (read stm t nil t) (let ((*read-suppress* t)) (read stm) (values)))) (defun _sharp-plus (stm ch p) (_sharp-cond stm #'member)) (defun _sharp-minus (stm ch p) (_sharp-cond stm (complement #'member))) |# (defun _sharp-equal (stream ch n) (declare (ignore ch)) (if *read-suppress* (values) (if n (let ((h (assoc n *read-reference-table*))) (if (consp h) (error "~ of ~: Label #~= must not be defined twice." 'read stream n) (let ((label (make-read-label n))) (push (setq h (cons n label)) *read-reference-table*) (let ((obj (read stream t nil t))) (if (eq obj label) (error "~ of ~: #~= #~# is not allowed." 'read stream n n) (setf (cdr h) obj)))))) (error "~ of ~: Between # ecified." 'read stream)))) (defun _sharp-sharp (stream ch n) (declare (ignore ch)) (unless *read-suppress* (if n (let ((h (assoc n *read-reference-table*))) (if (consp h) (cdr h) ; will be disentangled later you could also return (cdr h) (error "~ of ~: Label #~= is not defined." 'read stream n))) (error "~ of ~: Between # and #ied." 'read stream)))) (let ((nrt *_standard-readtable*)) ; (set-macro-character #\) #'_rpar-reader nil nrt) ; (set-macro-character #\' #'_quote-reader nil nrt) ; (set-macro-character #\; #'_semicolon-reader nil nrt) ; (set-macro-character #\" #'_dquote-reader nil nrt) ; (make-dispatch-macro-character #\# nil nrt) ; (set-dispatch-macro-character #\# #\' #'_sharp-quote nrt) ; (set-dispatch-macro-character #\# #\\ #'_sharp-backslash nrt) ; (set-dispatch-macro-character #\# #\: #'_sharp-colon nrt) ;!!!C (set-dispatch-macro-character #\# #\. #'_sharp-dot nrt) ; (set-dispatch-macro-character #\# #\S #'_sharp-s nrt) ; (set-dispatch-macro-character #\# #\+ #'_sharp-plus nrt) ; (set-dispatch-macro-character #\# #\- #'_sharp-minus nrt) (set-dispatch-macro-character #\# #\, #'_sharp-comma nrt) (set-dispatch-macro-character #\# #\, #'_sharp-comma *readtable*) (set-dispatch-macro-character #\# #\= #'_sharp-equal nrt) (set-dispatch-macro-character #\# #\= #'_sharp-equal *readtable*) (set-dispatch-macro-character #\# #\# #'_sharp-sharp nrt) (set-dispatch-macro-character #\# #\# #'_sharp-sharp *readtable*) ) (defconstant LAMBDA-PARAMETERS-LIMIT #+CLISP 4096 #-CLISP 8192) (defconstant CALL-ARGUMENTS-LIMIT LAMBDA-PARAMETERS-LIMIT) (defconstant %TYPE-INPUT-STREAM '(SATISFIES INPUT-STREAM-P)) (defconstant %TYPE-OUTPUT-STREAM '(SATISFIES OUTPUT-STREAM-P)) (defun TEXT (s) s) (defun char (v i) (if (stringp v) (aref v i) (error 'type-error :datum v :expected-type 'string))) (defun (setf char) (n v i) (if (stringp v) (setf (aref v i) n) (error 'type-error :datum v :expected-type 'string))) #|!!! (setq *error-handler* #'(lambda (&rest r) (let ((*error-handler* nil)) (_pr "###################### ERROR #####################") (dolist (x r) (_pr x)) (err)))) |# (defun warn (&rest r) (_pr ".............WARN..............") (dolist (x r) (_pr x)) nil) (defun _err (cnd code &rest args) ; (apply #'format nil (_get-err-message code) args) (error cnd (apply #'format nil (_get-err-message code) args))) (defun error (errorstring &rest args) ;; (_pr "----error----") ;; (_pr errorstring) ; (_pr args) (if (or *error-handler* (not *use-clcs*)) (progn (if *error-handler* (apply *error-handler* nil errorstring args) (progn (terpri *error-output*) (write-string "*** - " *error-output*) (apply #'format *error-output* errorstring args))) (funcall *break-driver* nil)) (let ((condition (coerce-to-condition errorstring args 'error 'simple-error))) (signal condition) (invoke-debugger condition)))) (defun error-of-type (type &rest arguments) ;; split off keyword arguments from the &rest arguments: (let ((keyword-arguments '())) (loop (unless (and (consp arguments) (symbolp (car arguments))) (return)) (push (pop arguments) keyword-arguments) (push (pop arguments) keyword-arguments)) (setq keyword-arguments (nreverse keyword-arguments)) (let ((errorstring (first arguments)) (args (rest arguments))) (if (or *error-handler* (not *use-clcs*)) (progn (if *error-handler* (apply *error-handler* nil errorstring args) (progn (terpri *error-output*) (write-string "*** - " *error-output*) (apply #'format *error-output* errorstring args))) (funcall *break-driver* nil)) (let ((condition (apply #'coerce-to-condition errorstring args 'error (convert-simple-condition type) keyword-arguments))) (signal condition) (invoke-debugger condition)))))) (defun acons (x y a) (cons (cons x y) a)) (defun _check-bi (seq start end) (unless (and (integerp start) (integerp end) (<= 0 start end (length seq))) (err))) (defun mismatch (seq1 seq2 &key from-end (test #'eql) test-not key (start1 0) (start2 0) end1 end2) (setq key (_key key) end1 (_end end1 seq1) end2 (_end end2 seq2)) (_check-bi seq1 start1 end1) (_check-bi seq2 start2 end2) (do ((i (if from-end (1- end1) start1) (if from-end (1- i) (1+ i))) (j (if from-end (1- end2) start2) (if from-end (1- j) (1+ j))) (pred (if test-not (complement test-not) test))) (nil) (let ((ppi (if from-end (< i start1) (>= i end1))) (pj (if from-end (< j start2) (>= j end2)))) (cond ((and ppi pj) (return-from mismatch nil)) ((or ppi pj) (return-from mismatch i)))) (let ((a (funcall key (elt seq1 i))) (b (funcall key (elt seq2 j)))) (unless (funcall pred a b) (return-from mismatch (if from-end (1+ i) i)))))) (defun string= (x y &rest rest &key (start1 0) end1 (start2 0) end2) (declare (ignore start1 end1 start2 end2)) (not (apply #'mismatch (string x) (string y) :test #'char= rest))) (defun string-equal (x y &rest rest &key (start1 0) end1 (start2 0) end2) (declare (ignore start1 end1 start2 end2)) (not (apply #'mismatch (string x) (string y) :test #'char-equal rest))) (defparameter *_char-name-alist* (labels ((_make-names (r) (if r (acons (car r) (code-char (cadr r)) (_make-names (cddr r)))))) (_make-names '("NULL" 0 "BELL" 7 "BACKSPACE" 8 "BS" 8 "TAB" 9 "NEWLINE" 10 "NL" 10 "LINEFEED" 10 "LF" 10 "VT" 11 "PAGE" 12 "FORM" 12 "FORMFEED" 12 "FF" 12 "RETURN" 13 "CR" 13 "ESCAPE" 27 "ESC" 27 "ALTMODE" 27 "ALT" 27 "SPACE" 32 "SP" 32 "DELETE" 127 "RUBOUT" 127)))) (defun name-char (name) (cdr (assoc (string name) *_char-name-alist* :test #'string-equal))) (defun make-string (size &key (initial-element (code-char 32)) (element-type 'character)) (if (or (eq element-type 'character) (subtypep element-type 'character)) ;!!! subtype don't work during boot (make-array size :initial-element initial-element :element-type element-type :adjustable t :fill-pointer t) (err))) (defun bit (a &rest r) (apply #'aref a r)) (defun sbit (a &rest r) (apply #'aref a r)) (defsetf bit store) (defsetf sbit store) (defvar *_trace* nil) (defun _trace (list) (if list (dolist (x list (_update-trace)) (if (and (fboundp x) (functionp (fdefinition x))) (setq *_trace* (adjoin x *_trace* :test #'equal)) (error 'simple-error "Function ~s not defined" x))) *_trace*)) (defmacro trace (&rest x) `(_trace ',x)) (defun _untrace (list) (setq *_trace* (if list (set-difference *_trace* list) nil)) (_update-trace)) (defmacro untrace (&rest x) `(_untrace ',x)) (defun _trace-enter (name level args) (format *trace-output* "Trace:~A ~A ~S~%" (make-string level :initial-element #\Space) name args)) (defun _trace-exit (name level vals) (format *trace-output* "Trace:~A ~A returns" (make-string level :initial-element #\Space) name) (dolist (x vals) (format *trace-output* " ~S" x)) (fresh-line *trace-output*)) (%putd 'set-symbol-value (symbol-function 'set)) (sys::%putd 'check-symbol (function check-symbol (lambda (object caller) (unless (symbolp object) (error-of-type 'source-program-error (TEXT "~S: ~S is not a symbol.") caller object)) object))) (sys::%putd '%the-environment (function %the-environment (lambda (form env) (declare (ignore form)) (sys::svstore env 0 (svref (svref env 0) 2)) ; nuke *evalhook* binding env))) (sys::%putd '%uncompilable (function %uncompilable (lambda (form) (error-of-type 'source-program-error (TEXT "~S is impossible in compiled code") form)))) (sys::%putd 'the-environment (sys::make-macro (function the-environment (lambda (form env) (declare (ignore form env)) '(progn (eval-when ((not eval)) (%uncompilable 'the-environment)) (let ((*evalhook* #'%the-environment)) 0)))))) (defun svstore (a i x) ;!!! (setf (svref a i) x)) (defun %svstore (x a i) ;!!! (setf (svref a i) x)) (defun get-funname-symbol (funname) (if (atom funname) funname (get-setf-symbol (second funname)))) #-compiler (defmacro COMPILER::EVAL-WHEN-COMPILE (&body body) ; preliminary `(eval-when (compile) ,@body)) (PROGN ;; return 2 values: ordinary lambda list and reversed list of type declarations (sys::%putd 'sys::specialized-lambda-list-to-ordinary (function sys::specialized-lambda-list-to-ordinary (lambda (spelalist caller) (multiple-value-bind (lalist speclist) #+clos (clos::decompose-specialized-lambda-list spelalist (clos::program-error-reporter caller)) #-clos (copy-list spelalist) ; pacify "make check-recompile" (values lalist ; MAPCAN needs a LAMBDA which leads to infinite recursion (let ((decls '())) (block spelalist-to-ordinary (tagbody start (when (null lalist) (return-from spelalist-to-ordinary decls)) (when (null speclist) (return-from spelalist-to-ordinary decls)) (let ((arg (car lalist)) (spec (car speclist))) (if (not (eq spec 'T)) (setq decls (cons (list spec arg) decls)))) (setq lalist (cdr lalist) speclist (cdr speclist)) (go start))))))))) (sys::%putd 'defun (sys::%putd 'sys::predefun ; predefun means "preliminary defun" (sys::make-macro (function defun (lambda (form env) (if (atom (cdr form)) (error-of-type 'source-program-error :form form :detail (cdr form) (TEXT "~S: cannot define a function from that: ~S") (car form) (cdr form))) (unless (function-name-p (cadr form)) (error-of-type 'source-program-error :form form :detail (cadr form) (TEXT "~S: the name of a function must be a symbol, not ~S") (car form) (cadr form))) (if (atom (cddr form)) (error-of-type 'source-program-error :form form :detail (cddr form) (TEXT "~S: function ~S is missing a lambda list") (car form) (cadr form))) (let ((preliminaryp (eq (car form) 'sys::predefun)) (name (cadr form)) (lambdalist (caddr form)) (body (cdddr form))) (multiple-value-bind (body-rest declarations docstring) (sys::parse-body body t) (when *defun-accept-specialized-lambda-list* (multiple-value-bind (lalist decl-list) (sys::specialized-lambda-list-to-ordinary lambdalist (car form)) (setq lambdalist lalist declarations (nreconc decl-list declarations)))) (let ((symbolform (if (atom name) `',name `(LOAD-TIME-VALUE (GET-SETF-SYMBOL ',(second name))))) (lambdabody `(,lambdalist ,@(if docstring `(,docstring) '()) (DECLARE (SYS::IN-DEFUN ,name) ,@declarations) (BLOCK ,(function-block-name name) ,@body-rest)))) `(LET () (SYSTEM::REMOVE-OLD-DEFINITIONS ,symbolform ,@(if preliminaryp '('T))) ,@(if ; Is name declared inline? (if (and compiler::*compiling* compiler::*compiling-from-file*) (member name compiler::*inline-functions* :test #'equal) (eq (get (get-funname-symbol name) 'inlinable) 'inline)) ;; Is the lexical environment the top-level environment? ;; If yes, save the lambdabody for inline compilation. (if compiler::*compiling* (if (and (null compiler::*venv*) (null compiler::*fenv*) (null compiler::*benv*) (null compiler::*genv*) (eql compiler::*denv* *toplevel-denv*)) `((COMPILER::EVAL-WHEN-COMPILE (COMPILER::C-DEFUN ',name (lambda-list-to-signature ',lambdalist) ',lambdabody)) (EVAL-WHEN (LOAD) (SYSTEM::%PUT ,symbolform 'SYSTEM::INLINE-EXPANSION ',lambdabody))) `((COMPILER::EVAL-WHEN-COMPILE (COMPILER::C-DEFUN ',name (lambda-list-to-signature ',lambdalist))))) (if (and (null (svref env 0)) ; venv (null (svref env 1))) ; fenv `((EVAL-WHEN (EVAL) (LET ((%ENV (THE-ENVIRONMENT))) (IF (AND (NULL (SVREF %ENV 0)) ; venv (NULL (SVREF %ENV 1)) ; fenv (NULL (SVREF %ENV 2)) ; benv (NULL (SVREF %ENV 3)) ; genv (EQL (SVREF %ENV 4) *TOPLEVEL-DENV*)) ; denv (SYSTEM::%PUT ,symbolform 'SYSTEM::INLINE-EXPANSION ',lambdabody))))) '())) `((COMPILER::EVAL-WHEN-COMPILE (COMPILER::C-DEFUN ',name (lambda-list-to-signature ',lambdalist))))) ,@(if docstring `((SYSTEM::%SET-DOCUMENTATION ,symbolform 'FUNCTION ',docstring)) '()) (SYSTEM::%PUTD ,symbolform ,(if preliminaryp `(SYSTEM::MAKE-PRELIMINARY (FUNCTION ,name (LAMBDA ,@lambdabody))) `(FUNCTION ,name (LAMBDA ,@lambdabody)))) (EVAL-WHEN (EVAL) (SYSTEM::%PUT ,symbolform 'SYSTEM::DEFINITION (CONS ',form (THE-ENVIRONMENT)))) ',name))))))))) (predefun check-not-declaration (symbol caller) (check-symbol symbol caller)) (VALUES) ) (_load "seq") (_load "defseq") (defconstant most-negative-fixnum (1- (- most-positive-fixnum))) (defconstant array-rank-limit most-positive-fixnum) (defconstant array-dimension-limit most-positive-fixnum) (defconstant array-total-size-limit most-positive-fixnum) (defun array-dimension (a n) (nth n (array-dimensions a))) (defun array-total-size (a) (apply #'* (array-dimensions a))) (defun array-in-bounds-p (a &rest r) (and (not (some #'minusp r)) (every #'< r (array-dimensions a)))) ;!!! (defsetf documentation %set-documentation) #|!!! (defun _copy-array (pa na y &optional x) (if y (dotimes (i (car y)) (_copy-array pa na (cdr y) (append x (list i)))) (setf (row-major-aref na (apply #'array-row-major-index na x)) (apply #'aref pa x)))) |# #| !!! (if y (do ((i (1- (car y)) (1- i))) ((minusp i)) (_copy-array pa na (append x (list i)) (cdr y))) (setf (aref na ,@x) (aref pa ,@x)))) |# #|!!!R (defun adjust-array (a dims &rest rest &key (element-type nil et-sp) initial-element (initial-contents nil cont-suppl) fill-pointer displaced-to (displaced-index-offset 0)) (setq element-type (if et-sp (upgraded-array-element-type element-type) (array-element-type a))) ;; all our arrays adjustable (_adjust-array a dims element-type initial-element fill-pointer displaced-to displaced-index-offset)) ;!!! (if cont-suppl (_fill-array-contents na initial-contents) ;!!! (_copy-array pa na (mapcar #'min (array-dimensions pa) (array-dimensions na)))) |# (defun char-name (ch) (car (rassoc ch *_char-name-alist*))) (defun replace (seq-1 seq-2 &key (start1 0) end1 (start2 0) end2) (setq end1 (_end end1 seq-1) end2 (_end end2 seq-2)) (let ((n (min (- end1 start1) (- end2 start2))) (seq (if (eq seq-1 seq-2) (copy-seq seq-2) seq-2))) (dotimes (i n seq-1) (setf (elt seq-1 (+ start1 i)) (elt seq (+ start2 i)))))) (defun (setf subseq) (new seq start &optional end) (replace seq new :start1 start :end1 end) new) (defun _pk (p key) (if key #'(lambda (a b) (funcall p (funcall key a) (funcall key b))) p)) (defun tailp (x y) (or (eql x y) (if (not (atom y)) (tailp x (cdr y))))) (defun ldiff (x y) (if (not (eql x y)) (if (atom x) x (cons (car x) (ldiff (cdr x) y))))) (defun butlast (a &optional (n 1)) ; (check-type n (integer 0)) (ldiff a (last a n))) (defun nbutlast (a &optional (n 1)) ; (check-type n (integer 0)) (when (> (length a) n) (rplacd (last a (1+ n)) nil) a)) (defun revappend (a b) (nconc (reverse a) b)) (defun copy-tree (a) (if (consp a) (cons (copy-tree (car a)) (copy-tree (cdr a))) a)) (defun subst-if (new p tree &key key) (cond ((funcall p (funcall (_key key) tree)) new) ((atom tree) tree) ((cons (subst-if new p (car tree) :key key) (subst-if new p (cdr tree) :key key))))) (defun subst-if-not (new p tree &key key) (subst-if new (complement p) tree :key key)) (defun subst (new old tree &key key test test-not) (subst-if new (_test old test test-not) tree :key key)) (defun nsubst-if (new p tree &key key) (cond ((funcall p (funcall (_key key) tree)) new) (t (when (consp tree) (rplaca tree (nsubst-if new p (car tree) :key key)) (rplacd tree (nsubst-if new p (cdr tree) :key key))) tree))) (defun nsubst-if-not (new p tree &key key) (nsubst-if new (complement p) tree :key key)) (defun nsubst (new old tree &key key test test-not) (nsubst-if new (_test old test test-not) tree :key key)) (defun sublis (alist tr &rest rest &key key (test #'eql) test-not) (let ((a (assoc (funcall (_key key) tr) alist :test test :test-not test-not))) (if a (cdr a) (if (atom tr) tr (cons (apply #'sublis alist (car tr) rest) (apply #'sublis alist (cdr tr) rest)))))) (defmacro typecase (expr &rest clauses) (let* ((temp (gensym)) (type-list nil) (body (cons 'cond (mapcar #'(lambda (c) (let ((a (car c))) (cons (cond ((eq a 'otherwise) t) ((eq a 'ecase-error-flag) `(error "etypecase failed: %s, %s" ,temp ',(reverse type-list))) (t (push a type-list) (list 'typep temp (if (and (listp a) (not (memq (car a) '(and not member)))) `',(cons 'or a) `',a)))) (or (cdr c) '(nil))))) clauses)))) `(let ((,temp ,expr)) ,body))) (defun pairlis (keys data &optional alist) (dolist (k keys) (if (atom data) (error 'type-error :datum data :expected-type 'cons)) (push (cons k (car data)) alist) (setq data (cdr data))) (if data (err)) alist) (defun copy-alist (alist) (mapcar #'(lambda (x) (if (consp x) (cons (car x) (cdr x)) x)) alist)) #|!!! (if alist (cons (if (atom (car alist)) (car alist) (cons (caar alist) (cdar alist))) (copy-alist (cdr alist))))) |# (defun tree-equal (x y &rest rest &key (test #'eql) test-not) (cond ((consp x) (and (consp y) (apply #'tree-equal (car x) (car y) rest) (apply #'tree-equal (cdr x) (cdr y) rest))) ((and (atom y) (funcall (_test x test test-not) y))))) (defmacro multiple-value-list (f) `(multiple-value-call #'list ,f)) (defmacro multiple-value-setq (varlist form) (let ((g (gensym)) (poplist nil)) (dolist (var varlist) (setq poplist (cons `(SETQ ,var (POP ,g)) poplist))) `(LET* ((,g (MULTIPLE-VALUE-LIST ,form))) ,(if poplist `(PROG1 ,@(nreverse poplist)) NIL)))) (defmacro nth-value (n form) `(nth ,n (multiple-value-list ,form))) (defmacro check-type (place typespec &optional (string nil) &environment env) (let ((tag1 (gensym "CHECK-TYPE-")) (tag2 (gensym "OK-")) (var (gensym))) `(TAGBODY ,tag1 (LET ((,var ,place)) (WHEN (TYPEP ,var ',typespec) (GO ,tag2)) (CHECK-TYPE-FAILED ',place ,var #'(LAMBDA (NEW-VALUE) (SETF ,place NEW-VALUE)) ,(length (nth-value 2 (get-setf-expansion place env))) ,string ',typespec)) (GO ,tag1) ,tag2))) #|!!!R (defmacro check-type (p ts &optional s) ; (declare (ignore p ts s)) ) |# #| (cond ((null vars) `(progn ,form nil)) ((null (cdr vars)) `(setq ,(car vars) (car ,form))) (t (let* ((temp (gensym)) (n 0)) (list 'let (list (list temp (list 'multiple-value-list form))) (list 'prog1 (list 'setq (pop vars) (list 'car temp)) (cons 'setq (apply 'nconc (mapcar (function (lambda (v) (list v (list 'nth (setq n (1+ n)) temp)))) vars))))))))) |# (defun copy-symbol (sym &optional copy-props) (let ((ns (make-symbol (symbol-name sym)))) (when copy-props (if (boundp sym) (setf (symbol-value ns) (symbol-value sym))) (if (fboundp sym) (setf (symbol-function ns) (symbol-function sym))) (setf (symbol-plist ns) (copy-list (symbol-plist sym)))) ns)) (defvar *load-pathname* nil) (defvar *load-truename* nil) (defparameter *load-print* nil) (defvar *load-verbose* nil) (defun (setf fdefinition) (f s) (setf (symbol-function (if (_setf-name-p s) (get-setf-symbol (cadr s)) s)) f)) (defun (setf char) (c s i) (setf (aref s i) c)) ;!!!D(defsetf slot-value _setf_slot-value) #|!!! (defun _tree-member (x a) (if a (or (member x (car a)) (_tree-member x (cdr a))))) |# (defun listify (r) (if (listp r) r (list r))) (defun _read_keys (a) (if a (list* (_to-keyword (car a)) (cadr a) (_read_keys (cddr a))))) (defvar *args* nil) (defvar *error-handler* nil) (defvar *use-clcs* nil) (defvar *break-driver* nil) (defvar *break-on-signals* nil) (defun coerce-to-condition (datum &rest rest) (declare (ignore rest)) datum) (defun signal (datum &rest args) (let ((cond (coerce-to-condition datum args 'signal 'simple-condition))) (if (and *break-on-signals* (safe-typep cond *break-on-signals*)) (funcall *break-driver* t cond t)) (_invoke-handlers cond) nil)) ;(defvar *features* '(:ufasoft-lisp :ansi-cl :clos :loop :common-lisp)) ;::UNICODE (defun close (stream &key abort) (built-in-stream-close stream :abort abort)) (defsetf readtable-case _setf_readtable-case) #|!!! (defun _get-input-stream (x) (cond ((streamp x) x) ((null x) *standard-input*) ((eq x t) *terminal-io*) ((error 'stream-error)))) (defun read-char (&optional stm (eof-error-p t) eof-value recursive-p) (or (_read-char (_get-input-stream stm)) (if eof-error-p (error 'end-of-file) eof-value))) (defun peek-char (&optional peek-type stm (eof-error-p t) eof-value recursive-p &aux ch) (do () (nil) (setq ch (read-char stm eof-error-p nil recursive-p)) (cond ((null ch) (if recursive-p (error 'end-of-file) (return-from peek-char eof-value))) ((null peek-type) (return)) ((eq peek-type t) (unless (eq (_char-type ch) :whitespace) (return))) ((char= ch peek-type) (return)))) (unread-char ch stm) ch) |# #| (defun get-macro-character (ch &optional (rt *readtable*)) (multiple-value-bind (a p) (_char-type ch) (if (functionp a) (values a (cdr p)) (values nil nil)))) (defun set-macro-character (ch f &optional ntp (rt *readtable*)) (_setf_char-type ch rt f nil) ;!!! need non-terminate attribute t) (defun get-dispatch-macro-character (disp-char sub-char &optional (rt *readtable*)) (setq sub-char (char-upcase sub-char)) (multiple-value-bind (a p) (_char-type disp-char rt) (if (functionp a) (cdr (assoc sub-char p)) (error 'reader-error)))) (defun set-dispatch-macro-character (disp-char sub-char f &optional (rt *readtable*)) (if (digit-char-p sub-char) (error 'reader-error)) (setq sub-char (char-upcase sub-char)) (multiple-value-bind (ct p) (_char-type disp-char rt) (if (eq ct (get-macro-character #\# nil)) (setf (getf p sub-char) f) (error 'reader-error)) t) (defun _macro-dispatcher (stm ch &aux p) (do ((p nil (if p (+ (* p 10) (digit-char-p c)) (digit-char-p c))) (c (read-char stm) (read-char stm))) ((not (digit-char-p c)) (let ((f (get-dispatch-macro-character ch c))) (if f (funcall f stm c p) (error 'reader-error)))))) |# (defun make-dispatch-macro-character (ch &optional ntp (rt *readtable*)) (set-macro-character ch (get-macro-character #\# nil) ntp rt)) (defun read-line (&optional stm (eof-error-p t) eof-value recursive-p) ;!!! (declare (ignore recursive-p)) (do ((p nil (cons ch p)) (ch (read-char stm nil) (read-char stm nil))) ((eql ch #\Newline) (values (ext:string-concat (nreverse p)) nil)) (unless ch (return (values (if p (ext:string-concat (nreverse p)) (if eof-error-p (err) eof-value)) t))))) #|!!! (defun read-delimited-list (char &optional stm recursive-p) (do (p q) (nil) (let ((ch (peek-char nil stm))) (cond ((null ch) (error 'stream-error)) ((eql ch char) (read-char stm) (return p)) ((eq (_char-type ch) :constituent) (let ((r (cons (read stm) nil))) (if q (rplacd q r) (setq p r)) (setq q r))) ((read-char stm)))))) |# (defun _read-mescape (stm) (let* ((ch (read-char stm)) (typ (if ch (_char-type ch) (error 'reader-error)))) (cond ((eq typ :mescape) nil) ((eq typ :sescape) (cons (read-char stm) (_read-mescape stm))) ((cons ch (_read-mescape stm)))))) #|!!!R (defun _as-integer (x &optional (radix 10) minus) (let ((c (car x)) (r (cdr x)) d) (cond ((eql c #\-) (_as-integer r radix t)) ((eql c #\+) (_as-integer r radix nil)) ((null x) 0) ((setq d (digit-char-p c)) (if r (+ (* d radix) (_as-integer r radix minus)) (if minus (- d) d)))))) (defun _decimal-integer (x) (if (digit-char-p (car x)) (let ((r (cdr x))) (if (and (_decimal-point (car r)) (null (cdr r))) t (_decimal-integer r))))) |# ;(defvar *read-suppress* nil) ;!!!C (defvar *read-eval* t) ;!!!(defvar *read-base* 10) (defvar *read-default-float-format* 'single-float) (defun _update-case (x c &aux p q) (dolist (a x p) (let ((r (cons (cond ((eq c :upcase) (char-upcase a)) ((eq c :downcase) (char-downcase a)) ((eq c :preserve) a) ((eq c :invert) (if (upper-case-p a) (char-downcase a) (char-upcase a))) ((error 'reader-error))) nil))) (if q (rplacd q r) (setq p r)) (setq q r)))) #| (:upcase #'char-upcase) (:downcase #'char-downcase) (:preserve #'identity) (:invert (lambda (a) (if (upper-case-p a) (char-downcase a) (char-upcase a)))) (t (error 'reader-error))))) |# #|!!! (let* ((f (case (readtable-case *readtable*) (:upcase #'char-upcase) (:downcase #'char-downcase) (:preserve #'identity) (:invert (lambda (a) (if (upper-case-p a) (char-downcase a) (char-upcase a)))) (t (error 'reader-error)))) (n (do ((y x (cdr y)) (i 0 (1+ i))) ((eq y end) i) )) (s (make-string n))) (dotimes (i n s) (setf (aref s i) (funcall f (caar x))) (setq x (cdr x))))) |# (defvar *_trace_* nil) ;!!! #|!!! (defun _read-token-list (stm &optional pres-white) (let ((ch (peek-char nil stm nil))) (if ch (let ((typ (_char-type ch))) (cond ((eq typ :constituent) (_read-simple-token stm pres-white)) ((eq typ :mescape) (read-char stm) (_read-mescape stm)) ((eq typ :sescape) (read-char stm) (cons (cons (read-char stm) _alphabetic) (_read-simple-token stm pres-white))) (nil)))))) (defun _chain-s (x &optional end) (_chain-s-ex x end (readtable-case *readtable*))) (defun _read-uninterned (stm) (make-symbol (_chain-s (_read-token-list stm)))) (defconstant _dot_ex '(dot)) (defconstant _rpar '(rpar)) (defun _dots (x) (if x (if (logtest _dot (cdar x)) (_dots (cdr x))) t)) (defun _integer-token-p (x &optional (radix *read-base*)) (let* ((s (cdar x)) (y (if (logtest _sign s) (cdr x) x)) (r 0)) (if (logtest _point (cdar (last y))) (dolist (el y) (let ((d (digit-char-p (car el)))) (if (logtest _point (cdar (last y))) (return)) (if (and d (logtest _alphadigit (cdr el))) (setq r (+ (* r 10) d)) (return-from _integer-token-p nil)))) (dolist (el y) (let ((d (digit-char-p (car el) radix))) (if (and d (logtest _alphadigit (cdr el))) (setq r (+ (* r radix) d)) (return-from _integer-token-p nil))))) (if (logtest _minus s) (- r) r))) (defun _ratio-token-p (x &optional (radix 10)) (let ((p (_member-trait _ratio x))) (if p (let ((n (ldiff x p)) (d (cdr p))) (/ (_integer-token-p n) (_integer-token-p d)))))) (defun _read (stm eof-error-p eof-value recursive-p pres-white &optional can-dot can-rpar) (do () (nil) (let ((ch (peek-char t stm nil))) (if ch (let ((typ (_char-type ch))) (cond ((memq typ '(:constituent :sescape :mescape)) (return (let ((x (_read-token-list stm pres-white))) (if (_dots x) (if (and can-dot (null (cdr x))) _dot_ex (error 'reader-error)) (if (null *read-suppress*) (if (_maybe-number x) (or (_integer-token-p x) (_ratio-token-p x) (_float-token-p x) (error x)) (let ((p (_member-trait _package x))) (if p (cond ((eq x p) (intern (_chain-s (cdr x)) *keyword-package*)) ((eq (cdr p) (_member-trait _package (cdr p))) (intern (_chain-s (cddr p)) (_get-package (_chain-s x p)))) ((multiple-value-bind (sym st) (find-symbol (_chain-s (cdr p)) (_get-package (_chain-s x p))) (if (eq st :external) sym (err))))) (intern (_chain-s x)))))))))) ((and (eq ch #\)) can-rpar) (read-char stm) (return _rpar)) ;!!! EQL must be for chars ((functionp typ) (let ((r (multiple-value-list (funcall typ stm (read-char stm))))) (if r (return (car r))))) ((error 'reader-error)))) (if (or eof-error-p recursive-p) (error 'end-of-file) (return eof-value)))))) (defun read (&optional stm (eof-error-p t) eof-value recursive-p) (_read stm eof-error-p eof-value recursive-p nil)) (defun read-preserving-whitespace (&optional stm (eof-error-p t) eof-value recursive-p) (_read stm eof-error-p eof-value recursive-p t)) |# (defun _rpar-reader (stm ch) (declare (ignore stm ch)) (error "an object cannot start with #\\)")) (defun _quote-reader (stm ch) (declare (ignore ch)) (list 'quote (read stm t nil t))) (defun _semicolon-reader (stm ch) (declare (ignore ch)) (do () ((eql (read-char stm nil #\Newline t) #\Newline))) (values)) (defun _dquote-reader (stm ch) (do (p (x (read-char stm) (read-char stm))) ((eql x ch) (_rev-list-to-string p)) (push (if (eq (_char-type x) :sescape) (read-char stm) x) p))) #| (defun _dquote-reader (stm ch) (do ((v (make-array 0 :element-type 'character :adjustable t :fill-pointer 0)) (x (read-char stm) (read-char stm))) ((eql x ch) v) (vector-push-extend (if (eq (_char-type x) :sescape) (read-char stm) x) v))) |# (setf (readtable-case *readtable*) :upcase) (defun _token-as-string (token) (ext:string-concat (mapcar #'car token))) #|!!! (defun _read-rational (stm radix &optional ch) (let* ((a (_read-simple-token stm t))) ;!!! (or (_integer-token-p a radix) (_ratio-token-p a radix) (if ch (_err 'reader-error E_LISP_IsNotRational (_token-as-string a) ch radix) (error 'reader-error))))) |# (setq *readtable* (copy-readtable nil)) (_load "defmacro") (defun terpri (&optional stm) (write-char #\Newline stm) nil) (defun fresh-line (&optional stm) (unless (eql (line-position stm) 0) (terpri stm) t)) (defmacro with-open-file ((stream &rest file-args) &rest body) `(let ((,stream (open ,@file-args))) (unwind-protect (progn ,@body) (close ,stream)))) (defun _cased-string (s case) (case case (:local s) (:common (cond ((every (lambda (ch) (or (upper-case-p ch) (not (both-case-p ch)))) s) (string-downcase s)) ((every (lambda (ch) (or (lower-case-p ch) (not (both-case-p ch)))) s) (string-upcase s)) (t s))) (t (error 'type-error :datum case :expected-type '(or (eql :local) (eql :common)))))) (defun _pathname-field (fn pn case) (let ((c (_pathname-field-ex fn (pathname pn)))) (cond ((stringp c) (_cased-string c case)) ((listp c) (mapcar (lambda (x) (if (stringp x) (_cased-string x case) x)) c)) (t c)))) (defun pathname-host (pn &key (case :local)) (_pathname-field 0 pn case)) (defun pathname-device (pn &key (case :local)) (_pathname-field 1 pn case)) (defun pathname-directory (pn &key (case :local)) (_pathname-field 2 pn case)) (defun pathname-name (pn &key (case :local)) (_pathname-field 3 pn case)) (defun pathname-type (pn &key (case :local)) (_pathname-field 4 pn case)) (defun pathname-version (pn) (_pathname-field-ex 5 (pathname pn))) #|!!!R (defun make-pathname (&key host device directory (name nil c-name) (type nil c-type) version (defaults *default-pathname-defaults*) case) (_make-path-name (or host (pathname-host defaults)) (or device (pathname-device defaults)) (if (and (listp directory) (eq (car directory) :relative) (consp (pathname-directory defaults))) (append (pathname-directory defaults) (cdr directory)) (or directory (pathname-directory defaults))) (if c-name name (pathname-name defaults)) (if c-type type (pathname-type defaults)) (or version (pathname-version defaults)))) |# (defun merge-pathnames (pathname &optional (defaults *default-pathname-defaults*) (def-ver :newest)) (setq pathname (pathname pathname) defaults (pathname defaults)) (let* ((host (pathname-host pathname)) (device (pathname-device pathname)) (directory (pathname-directory pathname)) (name (pathname-name pathname)) (type (pathname-type pathname)) (version (or (pathname-version pathname) def-ver))) (if (eq (car directory) :relative) (let ((def-dir (pathname-directory defaults))) (when (consp def-dir) (setq directory (append def-dir (cdr directory))) (do* ((p directory) (x (car p) (car p))) ((null p)) (setq p (if (and (or (stringp x) (eq x :wild)) (eq (cadr p) :back)) (setq directory (append (ldiff directory p) (cddr p))) (cdr p))))))) (apply #'make-pathname :defaults defaults (append (if host (list :host host)) (if device (list :device device)) (if directory (list :directory directory)) (if name (list :name name)) (if type (list :type type)) (if version (list :version version)))))) (defun host-namestring (pn) (let ((h (pathname-host pn))) (cond ((stringp h) h) ((consp h) (ext:string-concat (first h) "://" (second h))) (t "")))) (defun file-namestring (pn) (let ((s (pathname-name pn)) (ext (pathname-type pn))) (if ext (ext:string-concat s "." ext) s))) (defun directory-namestring (pn &aux r) (let* ((dev (pathname-device pn)) (dir (pathname-directory pn)) (lp (typep pn 'logical-pathname)) (sep (if lp ";" (if (and (member :WIN32 *features*) (not (consp (pathname-host pn)))) "\\" "/")))) (push (if (or (null dev) (eq dev :unspecific)) "" (ext:string-concat dev ":")) r) (when dir (if (and lp (eq (car dir) :relative)) (push ";" r)) (if (and (not lp) (eq (car dir) :absolute)) (push sep r)) (dolist (x (cdr dir)) (case x ((:up :back) (push ".." r)) (:wild (push "*" r)) (:wild-inferiors (push "**" r)) (t (push x r))) (push sep r)))) (apply #'ext:string-concat (nreverse r))) (defun namestring (pn) (let ((r "") (dev (pathname-device pn)) (h (host-namestring pn)) (hs (stringp (pathname-host pn)))) (if (or (null dev) (eq dev :unspecific)) (if (or (not hs) (equal h "")) (setq r h) (setq r (if (member :WIN32 *features*) (ext:string-concat "\\\\" h) (ext:string-concat h ":"))))) (ext:string-concat r (directory-namestring pn) (file-namestring pn)))) (defvar *logical-pathname-translations* (make-hash-table :test #'equalp)) (defconstant _eof '(eof)) (defvar *source-file-types* '("lisp")) (defvar *compiled-file-types* '("fas")) #|!!! (defun %put (s k v) (setf (get s k) v)) |# (defun remprop (s i) (multiple-value-bind (r removed-p) (%remf (symbol-plist s) i) (when (and removed-p (atom r)) (%putplist s r)) removed-p)) #|!!!hardwird (defun proclaim (spec) (case (car spec) (special (_proclaim-special (cdr spec))) ((inline notinline) (dolist (x (cdr spec)) (%put (get-funname-symbol x) 'inlinable (car spec)))))) |# ;!!! because bug in our defmacro, REPEAT (sys::%putd 'defmacro (sys::make-macro (function defmacro (lambda (form env) (declare (ignore env)) (multiple-value-bind (expansion expansion-lambdabody name lambdalist docstring) (sys::make-macro-expansion (cdr form) form) (declare (ignore expansion-lambdabody lambdalist)) `(LET () (EVAL-WHEN (COMPILE LOAD EVAL) (SYSTEM::REMOVE-OLD-DEFINITIONS ',name) ,@(if docstring `((SYSTEM::%SET-DOCUMENTATION ',name 'FUNCTION ',docstring)) '()) (SYSTEM::%PUTD ',name (SYSTEM::MAKE-MACRO ,expansion))) (EVAL-WHEN (EVAL) (SYSTEM::%PUT ',name 'SYSTEM::DEFINITION (CONS ',form (THE-ENVIRONMENT)))) ',name)))))) (defvar *toplevel-environment* (eval '(the-environment))) (defvar *toplevel-denv* (svref *toplevel-environment* 4)) ;(defvar *toplevel-denv* nil) (defmacro defun (&whole form name lambdalist &body body &environment env) (multiple-value-bind (body-rest declarations docstring) (parse-body body t) (let ((symbolform (if (atom name) `',name `(LOAD-TIME-VALUE (GET-SETF-SYMBOL ',(second name))))) (lambdabody `(,lambdalist (DECLARE (SYS::IN-DEFUN ,name) ,@declarations) (BLOCK ,(function-block-name name) ,@body-rest)))) `(LET () (SYSTEM::REMOVE-OLD-DEFINITIONS ,symbolform) ,@(if ; Is name declared inline? (if (and compiler::*compiling* compiler::*compiling-from-file*) (member name compiler::*inline-functions* :test #'equal) (eq (get (get-funname-symbol name) 'inlinable) 'inline)) ;; Is the lexical environment the top-level environment? ;; If yes, save the lambdabody for inline compilation. (if compiler::*compiling* (if (and (null compiler::*venv*) (null compiler::*fenv*) (null compiler::*benv*) (null compiler::*genv*) (eql compiler::*denv* *toplevel-denv*)) `((COMPILER::EVAL-WHEN-COMPILE (COMPILER::C-DEFUN ',name (lambda-list-to-signature ',lambdalist) ',lambdabody)) (EVAL-WHEN (LOAD) (SYSTEM::%PUT ,symbolform 'SYSTEM::INLINE-EXPANSION ',lambdabody))) `((COMPILER::EVAL-WHEN-COMPILE (COMPILER::C-DEFUN ',name (lambda-list-to-signature ',lambdalist))))) (if (and (null (svref env 0)) ; venv (null (svref env 1))) ; fenv `((EVAL-WHEN (EVAL) (LET ((%ENV (THE-ENVIRONMENT))) (IF (AND (NULL (SVREF %ENV 0)) ; venv (NULL (SVREF %ENV 1)) ; fenv (NULL (SVREF %ENV 2)) ; benv (NULL (SVREF %ENV 3)) ; genv (EQL (SVREF %ENV 4) *TOPLEVEL-DENV*)) ; denv (SYSTEM::%PUT ,symbolform 'SYSTEM::INLINE-EXPANSION ',lambdabody))))) '())) `((COMPILER::EVAL-WHEN-COMPILE (COMPILER::C-DEFUN ',name (lambda-list-to-signature ',lambdalist))))) ,@(if docstring `((SYSTEM::%SET-DOCUMENTATION ,symbolform 'FUNCTION ',docstring)) '()) (SYSTEM::%PUTD ,symbolform (FUNCTION ,name (LAMBDA ,@lambdabody))) (EVAL-WHEN (EVAL) (SYSTEM::%PUT ,symbolform 'SYSTEM::DEFINITION (CONS ',form (THE-ENVIRONMENT)))) ',name)))) (defun list-nreverse (x) (nreverse x)) (defun logical-pathname-p (pn) (eq (type-of pn) 'logical-pathname)) (_load "sort") (defun map (result-type function sequence &rest more-sequences) (setq more-sequences (cons sequence more-sequences)) (let ((l (apply #'min (mapcar #'length more-sequences)))) (if (null result-type) (do ((i 0 (1+ i)) (l l)) ((>= i l) nil) (declare (fixnum i l)) (apply function (mapcar #'(lambda (z) (elt z i)) more-sequences))) (let ((x (make-sequence result-type l))) (do ((i 0 (1+ i)) (l l)) ((>= i l) x) (declare (fixnum i l)) (setf (elt x i) (apply function (mapcar #'(lambda (z) (elt z i)) more-sequences)))))))) (defvar *print-array* t) (defvar *print-base* 10) (defvar *print-case* :upcase) (defvar *print-circle* nil) (defvar *print-escape* t) (defvar *print-gensym* t) (defvar *print-length* nil) (defvar *print-level* nil) (defvar *print-lines* nil) (defvar *print-miser-width* nil) (defvar *print-pprint-dispatch* nil) (defvar *print-pretty* nil) (defvar *print-radix* nil) (defvar *print-readably* nil) (defvar *print-right-margin* nil) (defvar *print-circle-table*) (defvar *prin-stream*) (defvar *prin-level*) (defvar *prin-bqlevel*) (_load "print-builtin") #| !!! (defun _get-integer (i radix &aux p) (do () (nil) (multiple-value-bind (q r) (truncate i radix) (push (digit-char r radix) p) (if (zerop q) (return p)) (setq i q)))) |# #|!!! (defun _char-name (ch) (with-output-to-string (stm) (princ (char-code ch) stm))) |# (defun princ (x &optional stm) (write x :stream stm :escape nil :readably nil)) (defun _wild-p (x &optional isdir) (if (consp x) (dolist (a x nil) (if (or (eq a :wild) (and isdir (eq a :wild-inferiors)) (and (stringp a) (or (find #\? a) (find #\* a)))) (return t))) (eq x :wild))) (defun wild-pathname-p (pn &optional fk) (ecase fk ((nil) (or (wild-pathname-p pn :host) (wild-pathname-p pn :device) (wild-pathname-p pn :directory) (wild-pathname-p pn :name) (wild-pathname-p pn :type) (wild-pathname-p pn :version))) (:host (_wild-p (pathname-host pn))) (:device (_wild-p (pathname-device pn))) (:directory (_wild-p (pathname-directory pn) t)) ;!!! check subdirs (:name (_wild-p (pathname-name pn))) (:type (_wild-p (pathname-type pn))) (:version (_wild-p (pathname-version pn))))) #| ;; for the time being the files don't have to be searched: (defun search-file (filename extensions) (mapcan #'(lambda (extension) (let ((filename (merge-pathnames filename (make-pathname :type extension)))) (if (probe-file filename) (list filename) '()))) extensions)) |# ;; A piece of "DO-WHAT-I-MEAN": ;; Searches for a program file. ;; We search in the current directory and then in the directories ;; listed in *load-paths*. ;; If an extension is specified in the filename, we search only for ;; files with this extension. If no extension is specified, we search ;; only for files with an extension from the given list. ;; The return value is a list of all matching files from the first directory ;; containing any matching file, sorted according to decreasing FILE-WRITE-DATE ;; (i.e. from new to old), or NIL if no matching file was found. (defun ppn-fwd (f keep-dirs) ; probe-pathname + file-write-date (multiple-value-bind (true-name phys-name fwd) (probe-pathname f) (when (and true-name (or keep-dirs (pathname-name true-name))) phys-name))) (defun search-file (filename &optional extensions (keep-dirs t)) ;; merge in the defaults: ;!!!R (setq filename (merge-pathnames filename "*.*")) ; (sys::_pr "--------------search-file-----" filename extensions) (let* ((already-searched nil) (path-nonW (pathname filename)) (path-wild (if (pathname-name path-nonW) (merge-pathnames path-nonW "*.*") ;; do not append *.* to directories path-nonW)) (use-extensions (null (pathname-type path-nonW)))) (dolist (dir (cons '"" ;; when filename has "..", ignore *load-paths* ;; (to avoid errors with "**/../foo"): (if (memq :up (pathname-directory path-nonW)) '() (mapcar #'pathname *load-paths*)))) (let* ((wild-p (wild-pathname-p dir)) (search-filename (merge-pathnames (if wild-p path-wild path-nonW) dir))) ; (_pr "---search-filename=" search-filename dir *load-paths*) (unless (member search-filename already-searched :test #'equal) (let ((xpathnames (if wild-p (nconc (directory search-filename :full t :circle t :if-does-not-exist :ignore) (directory (make-pathname :type nil :defaults search-filename))) (let ((f (ppn-fwd search-filename keep-dirs)) (e (and use-extensions extensions (mapcan #'(lambda (ext) (let ((f (ppn-fwd (make-pathname :type ext :defaults search-filename) keep-dirs))) (and f (list f)))) extensions)))) (if f (cons f e) e))))) (when wild-p (when (and use-extensions extensions) ; filter the extensions (setq xpathnames (delete-if-not #'(lambda (xpathname) (let ((ext (pathname-type xpathname))) (or (null ext) ; no extension - good! (member ext extensions :test #+WIN32 #'string-equal #-WIN32 #'string=)))) xpathnames)))) (when xpathnames ;; reverse sort by date: ; (_pr "-----before sort:" xpathnames) (return (sort xpathnames #'> :key #'file-write-date)))) (push search-filename already-searched)))))) ;; preliminary; needed here for open-for-load (defun warn (&rest args) (print (cons 'warn args)) nil) (defun open-for-load (filename extra-file-types external-format &aux stream (present-files t) obj path) (declare (ignore external-format)) (if (streamp filename) (values filename filename) (labels ((compiledp (name) (member (pathname-type name) *compiled-file-types* :test #'string=)) (my-open (name) ; (_pr "-----my-open---" name) (open name :direction :input-immutable :element-type 'character #+UNICODE :external-format #+UNICODE (if (compiledp name) charset:utf-8 external-format) :if-does-not-exist nil)) (bad (error-p stream message) (close stream) (when (eq *load-obsolete-action* :delete) (delete-file stream)) (if error-p (error-of-type 'file-error :pathname (pathname stream) message 'load (pathname stream)) (warn message 'load (pathname stream)))) (check-compiled-file (stream last-p obj) (and (or (and (consp obj) (eq (car obj) 'system::version)) (bad last-p stream (TEXT "~s: compiled file ~s lacks a version marker"))) (or (= 2 (length obj)) (bad last-p stream (TEXT "~s: compiled file ~s has a corrupt version marker ~s"))) (or (equal (system::version) (eval (second obj))) (bad last-p stream (TEXT "~s: compiled file ~s has an older version marker")))))) ; (_pr "=====filename as input to my-name=" filename) (setq filename (pathname filename) path filename stream (my-open path)) ; (_pr "============path=" path) (do () ((and stream (or (not (compiledp stream)) (check-compiled-file stream (or (eq *load-obsolete-action* :error) (eq present-files t) (cdr present-files)) (setq obj (read stream))))) (values stream path)) ; (_pr "----open-for-load-----" present-files) (when (eq present-files t) ;; File with precisely this name not present OR bad ;; Search among the files the most recent one ;; with the same name and the Extensions "LISP", "FAS": (setq present-files (search-file filename (append extra-file-types *compiled-file-types* *source-file-types*) nil))) (if present-files (progn (setq path (pop present-files) stream (my-open path))) (if stream ;; bad compiled STREAM, nowhere else to look ==> die (check-compiled-file stream t obj) ;; no file - return NIL (return-from open-for-load (values nil filename)))))))) (defvar *load-level* 0) (defvar *load-echo* nil) (defvar *load-compiling* nil) (defvar *load-obsolete-action* nil) (defun load (filespec &key ((:verbose *load-verbose*) *load-verbose*) ((:print *load-print*) *load-print*) ((:echo *load-echo*) *load-echo*) ((:compiling *load-compiling*) *load-compiling* c-top) (if-does-not-exist t) (external-format :default)) (declare (ignore c-top)) ;!!! (_pr "-----load----*load-paths*=" *load-paths*) ;!!!! (multiple-value-bind (stm filename) (open-for-load filespec nil external-format) ; (_pr "---after open-for-load---stream=" filename _stm) (unless stm (if if-does-not-exist (error-of-type 'file-error :pathname filename (TEXT "~S: A file with name ~A does not exist") 'load filename) (return-from load nil))) (let* ((*readtable* *readtable*) (*package* *package*) (*load-level* (1+ *load-level*)) (indent (if (null *load-verbose*) "" (make-string *load-level* :initial-element #\Space))) (*load-pathname* (if (pathnamep filename) (merge-pathnames filename) nil)) (*load-truename* (if (pathnamep filename) (truename filename) nil)) (*current-source-file* *load-truename*) (compiling (and *load-compiling* (memq :compiler *features*))) ; (*default-pathname-defaults* (make-pathname :host (pathname-host *load-pathname*) ; :device (pathname-device *load-pathname*) ; :directory (pathname-directory *load-pathname*))) ) (when *load-verbose* (fresh-line) (write-string ";;") (write-string indent) (write-string (TEXT "Loading file ")) (princ filespec) (write-string " ...") (fresh-line)) (if compiling (compiler::c-reset-globals)) (unwind-protect (do () (nil) (let ((e (read stm nil _eof))) (if (eq e _eof) (return)) (let ((v (multiple-value-list (cond ((compiled-function-p e) (funcall e)) (compiling (funcall (compile-form-in-toplevel-environment e))) (t (eval e)))))) (when *load-print* (when v (_pr (car v))))))) ;;!!! must be print (sys::built-in-stream-close stm) (if compiling (compiler::c-report-problems))) (when *load-verbose* (fresh-line) (write-string ";;") (write-string indent) (write-string "Loaded file ") (princ filespec) (fresh-line)))) t) (defun _eval-string (str) (ignore-errors (with-output-to-string (ostm) (with-input-from-string (istm str) (prin1 (eval (read istm)) ostm))))) (defun _clear-definitions () (do-all-symbols (sym) (remprop sym 'sys::definition) (when (and (fboundp 'clos::install-dispatch) (fboundp sym) (clos::generic-function-p (symbol-function sym))) (let ((gf (symbol-function sym))) (when (clos::gf-never-called-p gf) (clos::install-dispatch gf))))) (setq - nil + nil ++ nil +++ nil * nil ** nil *** nil / nil // nil /// nil) ) (defun keyword-test (arglist kwlist) ; (_pr "-------keyword-test-------" arglist kwlist) (unless (eq kwlist t) (let ((unallowed-arglistr nil) (allow-other-keys-flag nil)) (do ((arglistr arglist (cddr arglistr))) ((null arglistr)) (if (eq (first arglistr) ':ALLOW-OTHER-KEYS) (if (second arglistr) (setq allow-other-keys-flag t)) (do ((kw (first arglistr)) (kwlistr kwlist (cdr kwlistr))) ((or (null kwlistr) (eq kw (first kwlistr))) (if (and (null kwlistr) (null unallowed-arglistr)) (setq unallowed-arglistr arglistr)))))) (unless allow-other-keys-flag (if unallowed-arglistr (cerror (TEXT "Both will be ignored.") (TEXT "Invalid keyword-value-pair: ~S ~S") (first unallowed-arglistr) (second unallowed-arglistr))))))) #|!!! (defmacro with-input-from-string ((var string) &body body) `(LET ((,var (MAKE-STRING-INPUT-STREAM ,string))) (UNWIND-PROTECT (PROGN ,@body) (CLOSE ,var)))) |# (defmacro with-input-from-string ((var string &key (index nil sindex) (start '0 sstart) (end 'NIL send)) &body body &environment env) (declare (ignore env)) (multiple-value-bind (body-rest declarations) (SYSTEM::PARSE-BODY body) `(LET ((,var (MAKE-STRING-INPUT-STREAM ,string ,@(if (or sstart send) `(,start ,@(if send `(,end) '())) '())))) (DECLARE (READ-ONLY ,var) ,@declarations) (UNWIND-PROTECT (PROGN ,@body-rest) ,@(if sindex `((SETF ,index (SYSTEM::STRING-INPUT-STREAM-INDEX ,var))) '()) (CLOSE ,var))))) ;(load "seq") (load "cl") (load "pathname") ;(load 'ext) (load "errorcodes") (defconstant *common-lisp-user-package* (find-package "COMMON-LISP-USER")) ;(load "clos") ;(load "struct") ;(load "compiler") ;(load "cond") (load "macros") ;(load "debug") ;(load "env") (defun princ-to-string (x) (with-output-to-string (stm) (princ x stm))) (defun prin1-to-string (x) (with-output-to-string (stm) (prin1 x stm))) (defun write-to-string (x &rest rest) ;!!! &key array base case circle escape gensym length level lines miser-width pprint-dispatch pretty radix readably right-margin) ;; without macro with-output-to-string because #'close not defined (let ((stm (make-string-output-stream))) (apply #'write x :stream stm rest) (get-output-stream-string stm))) (load "break") (load "win32") (defvar *_opt-loaded* nil) ;(if (_full) (load "opt")) ;(unless sys::*_opt-loaded* (load 'opt)) (load "string") (load "reader") (load "math") (load "clisp") (unless (memq :NO-HUGE *features*) (load "debug")) ;!!!(_clear-definitions) (in-package "EXT") (defvar *for-execute* nil) (defun make-exe (filename stubpath destpath) (multiple-value-bind (fasfile warn-p fail-p) (compile-file filename) (declare (ignore warn-p)) (when fail-p (return-from make-exe nil)) (with-open-file (stm fasfile :direction :input) (do (r) (nil) (let ((f (read stm nil sys::_eof))) (if (eq f sys::_eof) (return (setq *for-execute* (nreverse r))) (push f r)))))) (with-open-file (dstm destpath :direction :output :element-type '(integer 0 255)) (with-open-file (stubstm stubpath :direction :input :element-type '(integer 0 255)) (let ((ar (make-sequence 'vector (file-length stubstm)))) (read-sequence ar stubstm) (write-sequence ar dstm))) (write-sequence (map 'vector #'char-code "$L$I$S$P") dstm) (sys::savemem dstm)) (format t "compiled to ~A" destpath) (setq *for-execute* nil) t) (defun run-for-execute () (do () ((null *for-execute*)) (let ((e (pop *for-execute*))) (cond ((compiled-function-p e) (funcall e)) (t (eval e)))))) #+CFFI-SYS (load "cffi-sys") (in-package "CL-USER") ;(compile '_integer-token-p)
103,809
Common Lisp
.lisp
2,397
32.788068
240
0.526371
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
fec14a1591288cbd48b1918134514b034dd1188bec6d7fcafd32fce71f1217d4
11,431
[ -1 ]
11,432
aclocal.m4
ufasoft_lisp/aclocal.m4
# generated automatically by aclocal 1.11.3 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, [m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar <conftest.tar]) grep GrepMe conftest.dir/file >/dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([acinclude.m4])
34,966
Common Lisp
.cl
873
37.546392
89
0.682326
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
ad0997176ecf6db4977195a5bc3a8d3206884475f651c8b0d4c4d1d035bb5e25
11,432
[ -1 ]
11,433
acinclude.m4
ufasoft_lisp/acinclude.m4
dnl Copyright © 2002 Dean Povey <[email protected]> dnl Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved AC_DEFUN([AC_PROG_PERL_VERSION],[dnl # Make sure we have perl if test -z "$PERL"; then AC_CHECK_PROG(PERL,perl,perl) fi # Check if version of Perl is sufficient ac_perl_version="$1" if test "x$PERL" != "x"; then AC_MSG_CHECKING(for perl version greater than or equal to $ac_perl_version) # NB: It would be nice to log the error if there is one, but we cannot rely # on autoconf internals $PERL -e "use $ac_perl_version;" > /dev/null 2>&1 if test $? -ne 0; then AC_MSG_RESULT(no); $3 else AC_MSG_RESULT(ok); $2 fi else AC_MSG_WARN(could not find perl) fi ])dnl
858
Common Lisp
.cl
25
30.64
177
0.707169
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
e734dc8a9c5c198558aa9e5012c88948056a207debdde7e40c5314f129b0fe02
11,433
[ -1 ]
11,443
mc2msg.pl
ufasoft_lisp/mc2msg.pl
#!/usr/bin/perl # .mc to .msg converter # .msg is input format for gencat(1) # (c) Ufasoft 2010 http://ufasoft.com mailto:[email protected] # Version 2010 # This software is Public Domain use warnings; use strict; use English; use File::Basename; use Getopt::Std; sub str2msgid { $_ = shift; return undef if !defined || $_ eq ""; return /^0/ ? oct : 0+$_; } sub readLine { $_ = <F>; return undef unless defined; s/\n|\r//g; /(^[^;]*)(;(.*))?$/; my ($cont, $comment) = ($1, $3); if ($cont =~ /^\s*$/) { print H "$comment\n" if $comment; } else { print H "// $_\n" if $_ ne "."; } return $cont; } sub processList { my ($fun, $line) = @_; while (1) { if ($line =~ /(\w+)\s*=\s*(\w+)\s*/) { $$fun->($1, $2); } last if $line =~ /\)/; $line = readLine; } } sub VERSION_MESSAGE { my $fh = shift; print $fh ".mc to .msg converter\n"; print $fh "(c) Ufasoft, 2010, http://ufasoft.com, mailto:support\@ufasoft.com, Public Domain\n"; } sub HELP_MESSAGE { my $fh = shift; print $fh " Usage: mc2msg.pl [-h dir] <file.mc>\n"; print $fh " -h dir: gives the dir, where to create .h and .msg, by default same as dir of file.mc\n"; print $fh " Outputs: file.msg file.h\n"; } $Getopt::Std::STANDARD_HELP_VERSION = 1; my %opts = (); exit 1 if !getopts("h:k:", \%opts); if (@ARGV < 1) { main::VERSION_MESSAGE STDERR; main::HELP_MESSAGE STDERR; exit 3; } my $mcfile = $ARGV[0]; sub main { open F, "< $mcfile" or die "Couldn't open `$mcfile': $!"; my (%name2fac, %name2sev); my $id = 0; my $prevfac = -1; my $fac = 0; my $sev = 0; my $typ = "int"; while (defined(my $line = readLine)) { next if $line =~ /^\s*$/; if ($line =~ /^\s*(\w+)\s*=\s*(.*)/) { my ($name, $val) = ($1, $2); if ($name eq "FacilityNames") { processList(\sub { my ($n, $v) = @_; $name2fac{$n} = str2msgid($v); }, $val); } elsif ($name eq "SeverityNames") { processList(\sub { my ($n, $v) = @_; $name2sev{$n} = str2msgid($v) }, $val); } elsif ($name eq "LanguageNames") { processList(\sub {}, $val); } elsif ($name eq "MessageIdTypedef") { $typ = $val; } else { my $msg = ""; my $bfields = 1; my $sym; MESSAGE: while (1) { if ($name eq "MessageId") { $_ = str2msgid($val); $id = $_ if defined; } elsif ($name eq "Facility") { $_ = $name2fac{$val}; $fac = $_ if defined; } elsif ($name eq "SymbolicName") { $sym = $val; } elsif ($name eq "Severity") { $_ = $name2sev{$val}; $sev = $_ if defined; } elsif ($name eq "Language") { } else { die "Unexpected format in the line $."; } $line = readLine; next if $line =~ /^\s*$/; if ($line =~ /^\s*(\w+)\s*=\s*(.*)/) { ($name, $val) = ($1, $2); } else { while (1) { $msg .= $line; $line = readLine; last MESSAGE if $line eq "."; } } } my $hr = ($sev << 30) | ($fac << 16) | $id; print H "#define $sym (($typ)0x" . sprintf("%08x", $hr) . ")\n" if $sym; if ($fac != $prevfac) { my $f = $fac & 255; # NL_SETMAX==255 in BSD print M "\$set $f\n"; $prevfac = $fac; } print M "$id $msg\n"; ++$id; } } else { die "Unexpected format in the line $."; } } } my ($file, $dir, $ext) = fileparse($mcfile, ".mc"); $dir = $opts{h} if defined $opts{h}; my ($hfn, $mfn) = ("$dir/$file.h", "$dir/$file.msg"); open H, "> $hfn" or die "Couldn't create `$hfn': $!"; open M, "> $mfn" or die "Couldn't create `$mfn': $!"; eval { main() }; if ($EVAL_ERROR) { close H; close M; unlink $hfn, $mfn; die $EVAL_ERROR; }
3,886
Common Lisp
.l
144
21.868056
105
0.496235
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
fd0aff68916c8947c400a74688084766abd2e981f9a3950139726d2226b063ed
11,443
[ -1 ]
11,446
Makefile.am
ufasoft_lisp/Makefile.am
build=@build@ AM_CPPFLAGS=-I src -pthread #AM_CXXFLAGS=-include src/el/ext.h include am.makeinc bin_PROGRAMS = lisp bindatadir = $(bindir) dist_lisp_SOURCES = ext_messages.h nodist_lisp_SOURCES = lispmsg.h lisp_DEPENDENCIES = lisp.cat bindata_DATA= lisp.cat init.bls if BUILD_LIBEXT lisp_SOURCES += $(libext_FILES) src/el/ext.h.gch: src/el/ext.h $(CXXCOMPILE) $(CXXFLAGS) -x c++-header $< ext_messages.msg h/ext_messages.h : src/el/libext/ext_messages.mc -mkdir h perl mc2msg.pl -h h $< cp h/ext_messages.msg . lispmsg.msg lispmsg.h : src/lisp/lispeng/lispmsg.mc perl mc2msg.pl -h . $< lisp.cat : ext_messages.msg lispmsg.msg gencat --new -o $@ $^ else lisp.cat : lispmsg.msg gencat --new -o $@ $^ lispmsg.msg lispmsg.h : src/lisp/lispeng/lispmsg.mc perl mc2msg.pl -h . $< endif BUILT_SOURCES =$(nodist_lisp_SOURCES) #src/el/ext.h.gch src/el/stl/codecvt : src/el/stl/codecvt echo src/el/stl/mutex : src/el/stl/mutex echo "---" src/el/stl/dynamic_bitset : src/el/stl/dynamic_bitset echo src/el/stl/regex : src/el/stl/regex echo "---" src/el/stl/thread : src/el/stl/thread echo "---" L = LISPINC=src/lisp/code/:clisp/ ./lisp --norc L0 = $(L) -M comp1.bls -c L2 = $(L) -M comp2.bls -c compiler.fas : clisp/compiler.lisp $(L) -b -c $< -o $@ comp1.bls : src/lisp/code/init.lisp compiler.fas $(L) -b --lp . -D LOAD_COMPILER_FAS -o $@ src/lisp/code/empty ./ init.bls : f1/ f2/ comp2.bls \ f2/backquote.fas f2/defs2.fas f2/loop.fas \ f2/clos.fas f2/clos-slots1.fas f2/clos-method1.fas f2/clos-methcomb1.fas \ f2/clos-genfun1.fas f2/clos-genfun2a.fas f2/clos-methcomb2.fas f2/clos-genfun2b.fas \ f2/clos-method2.fas f2/clos-genfun3.fas f2/clos-dependent.fas f2/clos-genfun4.fas \ f2/clos-method3.fas f2/clos-methcomb3.fas f2/clos-slots2.fas f2/clos-slotdef2.fas \ f2/clos-stablehash2.fas f2/clos-specializer2.fas f2/clos-class4.fas f2/clos-class5.fas \ f2/clos-slotdef3.fas f2/clos-specializer3.fas f2/clos-class6.fas f2/clos-method4.fas \ f2/clos-methcomb4.fas f2/clos-genfun5.fas f2/clos-print.fas f2/clos-custom.fas \ f2/documentation.fas f2/gray.fas f2/fill-out.fas f2/disassem.fas \ f2/condition.fas f2/loadform.fas f2/pprint.fas f2/runprog.fas \ f2/describe.fas f2/reploop.fas $(L) -b --lp . --lp f1/ --lp f2/ -i ./ src/lisp/code/empty comp2.bls : comp1.bls \ f1/macro.fas f1/explambda.fas f1/seq.fas f1/sort.fas f1/print-builtin.fas f1/init.fas \ f1/cl.fas f1/pathname.fas f1/macros.fas f1/break.fas f1/string.fas \ f1/reader.fas f1/math.fas f1/uclos.fas f1/print.fas \ f1/macros1.fas f1/macros2.fas f1/byte.fas f1/clisp.fas f1/clos-class3.fas \ f1/defmacro.fas f1/defs1.fas \ f1/lambdalist.fas f1/places.fas f1/defpackage.fas \ f1/type.fas f1/subtypep.fas \ f1/clos-package.fas f1/clos-macros.fas f1/clos-class0.fas f1/clos-metaobject1.fas \ f1/clos-slotdef1.fas f1/clos-stablehash1.fas f1/clos-specializer1.fas f1/clos-class1.fas \ f1/clos-class2.fas f1/defstruct.fas f1/format.fas f1/functions.fas \ f1/international.fas f1/cmacros.fas $(L) -b --lp . --lp f1/ -i ./ -o $@ src/lisp/code/empty f1/ f2/ : mkdir -p $@ f1/%.lib f1/%.fas : src/lisp/code/%.lisp $(L0) $< -o $@ f1/%.lib f1/%.fas : clisp/%.lisp $(L0) $< -o $@ f2/%.lib f2/%.fas : clisp/%.lisp $(L2) $< -o $@ CLEANFILES = src/el/ext.h.gch lisp.cat *.bls *.fas *.lib f1/*.fas f1/*.lib f2/*.fas f2/*.lib ext_messages.msg lispmsg.msg $(BUILT_SOURCES)
3,534
Common Lisp
.l
81
40.950617
138
0.689352
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
6b2d76d0ad560f2bca8c676fbd6fdf1e8b6bc508dd8adb70533236a5f7c389a1
11,446
[ -1 ]
11,447
Makefile.in
ufasoft_lisp/Makefile.in
# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @CLANG_TRUE@am__append_1 = -mno-sse @CLANG_FALSE@am__append_2 = -Wno-invalid-offsetof DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/am.makeinc \ $(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \ ChangeLog INSTALL NEWS config.guess config.sub depcomp \ install-sh missing bin_PROGRAMS = lisp$(EXEEXT) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindatadir)" PROGRAMS = $(bin_PROGRAMS) am__objects_1 = bignum.$(OBJEXT) ext-text.$(OBJEXT) \ ext-handlers.$(OBJEXT) ext-encoding.$(OBJEXT) \ threader.$(OBJEXT) ext-file.$(OBJEXT) ext-fw.$(OBJEXT) \ datetime.$(OBJEXT) ext-base.$(OBJEXT) ext-os.$(OBJEXT) \ ext-app.$(OBJEXT) ext-string.$(OBJEXT) ext-blob.$(OBJEXT) \ ext-stream.$(OBJEXT) ext-core.$(OBJEXT) \ ext-ip-address.$(OBJEXT) ext-net.$(OBJEXT) \ stack-trace.$(OBJEXT) binary-reader-writer.$(OBJEXT) \ regex.$(OBJEXT) thread.$(OBJEXT) am_lisp_OBJECTS = messages.$(OBJEXT) backquote.$(OBJEXT) \ clos.$(OBJEXT) data.$(OBJEXT) debug.$(OBJEXT) \ debugger.$(OBJEXT) eval.$(OBJEXT) garbagecoll.$(OBJEXT) \ f_array.$(OBJEXT) f_character.$(OBJEXT) \ f_environment.$(OBJEXT) f_file.$(OBJEXT) f_hashtable.$(OBJEXT) \ f_list.$(OBJEXT) f_number.$(OBJEXT) f_package.$(OBJEXT) \ f_pathname.$(OBJEXT) f_seq.$(OBJEXT) f_stream.$(OBJEXT) \ ffi.$(OBJEXT) functions.$(OBJEXT) lisp.$(OBJEXT) \ listutil.$(OBJEXT) macros.$(OBJEXT) memimage.$(OBJEXT) \ pretty-printer.$(OBJEXT) printer.$(OBJEXT) reader.$(OBJEXT) \ specialoperators.$(OBJEXT) svalue.$(OBJEXT) vm.$(OBJEXT) \ lisper.$(OBJEXT) $(am__objects_1) nodist_lisp_OBJECTS = lisp_OBJECTS = $(am_lisp_OBJECTS) $(nodist_lisp_OBJECTS) lisp_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(lisp_SOURCES) $(EXTRA_lisp_SOURCES) $(nodist_lisp_SOURCES) DIST_SOURCES = $(lisp_SOURCES) $(EXTRA_lisp_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } DATA = $(bindata_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COMPILER = @COMPILER@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EXEEXT = @EXEEXT@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -pthread -std=c++0x AM_CXXFLAGS = -include el/ext.h $(am__append_1) $(am__append_2) libext_FILES = \ el/ext.h \ el/extres.h \ el/libext.h \ el/bignum.h \ el/inc/default-defs.h \ el/inc/ext_config.h \ el/inc/extver.h \ el/inc/inc_configs.h \ manufacturer.h \ \ el/libext/bignum-x86x64.asm \ el/libext/afterstl.h \ el/libext/bignum.cpp \ el/libext/bignum386.h \ el/libext/c-old.h \ el/libext/cpp-old.h \ el/libext/datetime.h \ el/libext/ext-app.h \ el/libext/ext-base.h \ el/libext/ext-blob.h \ el/libext/ext-core.h \ el/libext/ext-safehandle.h \ el/libext/ext-sync.h \ el/libext/ext-cpp.h \ el/libext/ext-cpu.h \ el/libext/ext-fw.h \ el/libext/ext-posix.h \ el/libext/ext-regex.h \ el/libext/ext-hash.h \ el/libext/ext-lru.h \ el/libext/ext-macro.h \ el/libext/ext-meta.h \ el/libext/ext-net.h \ el/libext/ext-os.h \ el/libext/ext-protocols.h \ el/libext/ext-str.h \ el/libext/ext-stream.h \ el/libext/ext-string.h \ el/libext/ext-text.cpp \ el/libext/ext-thread.h \ el/libext/interlocked.h \ el/libext/exthelpers.h \ el/libext/facilities.h \ el/libext/gcc-intrinsic.h \ el/libext/ext-handlers.cpp \ el/libext/ext-encoding.cpp \ el/libext/threader.cpp \ el/libext/ext-file.cpp \ el/libext/ext-fw.cpp \ el/libext/datetime.cpp \ el/libext/ext-base.cpp \ el/libext/ext-os.cpp \ el/libext/ext-app.cpp \ el/libext/ext-string.cpp \ el/libext/ext-blob.cpp \ el/libext/ext-stream.cpp \ el/libext/ext-core.cpp \ el/libext/ext-ip-address.cpp \ el/libext/ext-net.cpp \ el/libext/stack-trace.cpp \ el/libext/binary-reader-writer.h \ el/libext/binary-reader-writer.cpp \ el/libext/ext-posix-win.h \ el/libext/vc-warnings.h \ el/libext/ext-http.h \ \ el/stl/regex.cpp \ el/stl/regex \ el/stl/mutex \ el/stl/thread.cpp \ el/stl/thread lisp_SOURCES = \ file_config.h \ prj_config.h \ \ src/lispeng/fundef.h \ src/lispeng/gc.h \ src/lispeng/lisp.h \ src/lispeng/lispeng.h \ src/lispeng/lisp_itf.h \ src/lispeng/params.h \ src/lispeng/symdef.h \ src/lispeng/typedef.h \ src/lispeng/messages.cpp \ src/lispeng/backquote.cpp \ src/lispeng/clos.cpp \ src/lispeng/data.cpp \ src/lispeng/debug.cpp \ src/lispeng/debugger.cpp \ src/lispeng/eval.cpp \ src/lispeng/garbagecoll.cpp \ src/lispeng/f_array.cpp \ src/lispeng/f_character.cpp \ src/lispeng/f_environment.cpp \ src/lispeng/f_file.cpp \ src/lispeng/f_hashtable.cpp \ src/lispeng/f_list.cpp \ src/lispeng/f_number.cpp \ src/lispeng/f_package.cpp \ src/lispeng/f_pathname.cpp \ src/lispeng/f_seq.cpp \ src/lispeng/f_stream.cpp \ src/lispeng/ffi.cpp \ src/lispeng/functions.cpp \ src/lispeng/lisp.cpp \ src/lispeng/listutil.cpp \ src/lispeng/macros.cpp \ src/lispeng/memimage.cpp \ src/lispeng/pretty-printer.cpp \ src/lispeng/printer.cpp \ src/lispeng/reader.cpp \ src/lispeng/specialoperators.cpp \ src/lispeng/svalue.cpp \ src/lispeng/vm.cpp \ src/lispeng/resource.h \ src/lispeng/lispmsg.mc \ src/console/lisper.cpp \ \ $(libext_FILES) EXTRA_lisp_SOURCES = \ am.makeinc \ u-config.h \ \ el/inc/ext.ver \ \ el/comp/x86x64.inc \ el/comp/stdafx.cpp \ el/comp/ia32-codegen.cpp \ el/comp/ia32-codegen.h \ \ el/elwin/static-main.cpp \ \ el/libext/ext_messages.mc \ src/code/break.lisp \ src/code/byte.lisp \ src/code/cffi-sys.lisp \ src/code/cl.lisp \ src/code/clisp.lisp \ src/code/clos-class3.lisp \ src/code/debug.lisp \ src/code/empty.lisp \ src/code/env.lisp \ src/code/errorcodes.lisp \ src/code/explambda.lisp \ src/code/export.lisp \ src/code/ext.lisp \ src/code/init.lisp \ src/code/macro.lisp \ src/code/macros.lisp \ src/code/math.lisp \ src/code/opt.lisp \ src/code/pass_tests.lisp \ src/code/pathname.lisp \ src/code/print-builtin.lisp \ src/code/print.lisp \ src/code/reader.lisp \ src/code/restart.lisp \ src/code/seq.lisp \ src/code/sort.lisp \ src/code/string.lisp \ src/code/uclos.lisp \ src/code/utils.lisp \ src/code/win32.lisp \ \ clisp/backquote.lisp \ clisp/case-sensitive.lisp \ clisp/clos-class0.lisp \ clisp/clos-class1.lisp \ clisp/clos-class2.lisp \ clisp/clos-class4.lisp \ clisp/clos-class5.lisp \ clisp/clos-class6.lisp \ clisp/clos-custom.lisp \ clisp/clos-dependent.lisp \ clisp/clos-genfun1.lisp \ clisp/clos-genfun2a.lisp \ clisp/clos-genfun2b.lisp \ clisp/clos-genfun3.lisp \ clisp/clos-genfun4.lisp \ clisp/clos-genfun5.lisp \ clisp/clos-macros.lisp \ clisp/clos-metaobject1.lisp \ clisp/clos-methcomb1.lisp \ clisp/clos-methcomb2.lisp \ clisp/clos-methcomb3.lisp \ clisp/clos-methcomb4.lisp \ clisp/clos-method1.lisp \ clisp/clos-method2.lisp \ clisp/clos-method3.lisp \ clisp/clos-method4.lisp \ clisp/clos-package.lisp \ clisp/clos-print.lisp \ clisp/clos-slotdef1.lisp \ clisp/clos-slotdef2.lisp \ clisp/clos-slotdef3.lisp \ clisp/clos-slots1.lisp \ clisp/clos-slots2.lisp \ clisp/clos-specializer1.lisp \ clisp/clos-specializer2.lisp \ clisp/clos-specializer3.lisp \ clisp/clos-stablehash1.lisp \ clisp/clos-stablehash2.lisp \ clisp/clos.lisp \ clisp/cmacros.lisp \ clisp/compiler.lisp \ clisp/complete.lisp \ clisp/condition.lisp \ clisp/defmacro.lisp \ clisp/defpackage.lisp \ clisp/defs1.lisp \ clisp/defs2.lisp \ clisp/defseq.lisp \ clisp/defstruct.lisp \ clisp/describe.lisp \ clisp/disassem.lisp \ clisp/documentation.lisp \ clisp/fill-out.lisp \ clisp/format.lisp \ clisp/functions.lisp \ clisp/gray.lisp \ clisp/inspect.lisp \ clisp/international.lisp \ clisp/lambdalist.lisp \ clisp/loadform.lisp \ clisp/loop.lisp \ clisp/macros1.lisp \ clisp/macros2.lisp \ clisp/macros3.lisp \ clisp/places.lisp \ clisp/pprint.lisp \ clisp/reploop.lisp \ clisp/runprog.lisp \ clisp/savemem.lisp \ clisp/subtypep.lisp \ clisp/trace.lisp \ clisp/type.lisp \ \ mc2msg.pl \ \ el/libext/murmurhashaligned2.cpp \ el/libext/bignum386.cpp \ el/libext/ext-os-api.cpp \ el/libext/ext-os-api.h \ el/libext/ext-posix.cpp \ \ el/libext/win32/com-module.cpp \ el/libext/win32/ext-cmd.h \ el/libext/win32/ext-com.cpp \ el/libext/win32/ext-com.h \ el/libext/win32/ext-full-win.h \ el/libext/win32/ext-registry.cpp \ el/libext/win32/ext-registry.h \ el/libext/win32/ext-win.cpp \ el/libext/win32/ext-win.h \ el/libext/win32/extwin32.h \ el/libext/win32/excom.cpp \ el/libext/win32/excom.h \ el/libext/win32/ext2.cpp \ el/libext/win32/getopt.cpp \ \ lisp-2012.sln \ src/lispeng/lisp.vcxproj \ src/lispeng/lisp.vcxproj.filters \ src/lispeng/lisp.vcproj \ src/lispeng/lisp386.cpp \ src/lispeng/lispeng.cpp \ src/lispeng/lispeng.idl \ src/lispeng/lispeng.def \ src/lispeng/lispeng.rc \ src/lispeng/ffi.h \ src/lispeng/messages.rc \ src/lispeng/tlb.rc \ \ src/lispdev/lispdev.vcxproj \ src/lispdev/lispdev.vcxproj.filters \ src/lispdev/lispdev.cpp \ src/lispdev/file_config.h \ src/lispdev/lispdev.exe.manifest \ src/lispdev/lispdev.rc \ src/lispdev/lispdev.pkgdef \ src/lispdev/lispdev.pkgundef \ \ src/lispideui/lispideui.vcxproj \ src/lispideui/lispideui.vcxproj.filters \ src/lispideui/vsct.buildrule \ src/lispideui/file_config.h \ src/lispideui/resource.h \ src/lispideui/lispideui.rc \ src/lispideui/lispideui.vsct \ \ src/targets/lisp.props \ src/targets/lisp.targets \ src/targets/lisp.xml \ src/targets/link-exe.lisp \ \ src/templates/lispproj/classlibrary.vstemplate \ src/templates/lispproj/classlibrary.lispproj \ src/templates/lispproj/class.lisp \ \ cfg/vs/mc.props \ cfg/vs/mc.targets \ cfg/vs/mc.xml \ cfg/vs/vsct.props \ cfg/vs/vsct.targets \ cfg/vs/vsct.xml lisp_DEPENDENCIES = lisp.cat bindata_DATA = lisp.cat init.bls bindatadir = $(bindir) nodist_lisp_SOURCES = ext_messages.h lispmsg.h BUILT_SOURCES = $(nodist_lisp_SOURCES) el/ext.h.gch L = LISPINC=src/code/:clisp/ ./lisp --norc L0 = $(L) -M comp1.bls -c L2 = $(L) -M comp2.bls -c CLEANFILES = el/ext.h.gch lisp.cat *.bls *.fas *.lib f1/*.fas f1/*.lib f2/*.fas f2/*.lib ext_messages.msg lispmsg.msg $(BUILT_SOURCES) all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .cpp .o .obj am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/am.makeinc $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(srcdir)/am.makeinc: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) lisp$(EXEEXT): $(lisp_OBJECTS) $(lisp_DEPENDENCIES) $(EXTRA_lisp_DEPENDENCIES) @rm -f lisp$(EXEEXT) $(CXXLINK) $(lisp_OBJECTS) $(lisp_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/backquote.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bignum.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bignum386.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/binary-reader-writer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clos.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/com-module.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datetime.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debugger.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eval.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/excom.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-app.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-base.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-blob.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-com.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-core.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-encoding.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-fw.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-handlers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-ip-address.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-net.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-os-api.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-os.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-posix.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-registry.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-stream.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-string.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-text.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext-win.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ext2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/f_array.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/f_character.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/f_environment.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/f_file.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/f_hashtable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/f_list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/f_number.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/f_package.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/f_pathname.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/f_seq.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/f_stream.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ffi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/functions.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/garbagecoll.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia32-codegen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lisp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lisp386.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lispdev.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lispeng.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lisper.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listutil.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/macros.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memimage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/messages.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/murmurhashaligned2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pretty-printer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/printer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/specialoperators.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stack-trace.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/static-main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdafx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/svalue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vm.Po@am__quote@ .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` messages.o: src/lispeng/messages.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT messages.o -MD -MP -MF $(DEPDIR)/messages.Tpo -c -o messages.o `test -f 'src/lispeng/messages.cpp' || echo '$(srcdir)/'`src/lispeng/messages.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/messages.Tpo $(DEPDIR)/messages.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/messages.cpp' object='messages.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o messages.o `test -f 'src/lispeng/messages.cpp' || echo '$(srcdir)/'`src/lispeng/messages.cpp messages.obj: src/lispeng/messages.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT messages.obj -MD -MP -MF $(DEPDIR)/messages.Tpo -c -o messages.obj `if test -f 'src/lispeng/messages.cpp'; then $(CYGPATH_W) 'src/lispeng/messages.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/messages.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/messages.Tpo $(DEPDIR)/messages.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/messages.cpp' object='messages.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o messages.obj `if test -f 'src/lispeng/messages.cpp'; then $(CYGPATH_W) 'src/lispeng/messages.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/messages.cpp'; fi` backquote.o: src/lispeng/backquote.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT backquote.o -MD -MP -MF $(DEPDIR)/backquote.Tpo -c -o backquote.o `test -f 'src/lispeng/backquote.cpp' || echo '$(srcdir)/'`src/lispeng/backquote.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/backquote.Tpo $(DEPDIR)/backquote.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/backquote.cpp' object='backquote.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o backquote.o `test -f 'src/lispeng/backquote.cpp' || echo '$(srcdir)/'`src/lispeng/backquote.cpp backquote.obj: src/lispeng/backquote.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT backquote.obj -MD -MP -MF $(DEPDIR)/backquote.Tpo -c -o backquote.obj `if test -f 'src/lispeng/backquote.cpp'; then $(CYGPATH_W) 'src/lispeng/backquote.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/backquote.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/backquote.Tpo $(DEPDIR)/backquote.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/backquote.cpp' object='backquote.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o backquote.obj `if test -f 'src/lispeng/backquote.cpp'; then $(CYGPATH_W) 'src/lispeng/backquote.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/backquote.cpp'; fi` clos.o: src/lispeng/clos.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT clos.o -MD -MP -MF $(DEPDIR)/clos.Tpo -c -o clos.o `test -f 'src/lispeng/clos.cpp' || echo '$(srcdir)/'`src/lispeng/clos.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/clos.Tpo $(DEPDIR)/clos.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/clos.cpp' object='clos.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o clos.o `test -f 'src/lispeng/clos.cpp' || echo '$(srcdir)/'`src/lispeng/clos.cpp clos.obj: src/lispeng/clos.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT clos.obj -MD -MP -MF $(DEPDIR)/clos.Tpo -c -o clos.obj `if test -f 'src/lispeng/clos.cpp'; then $(CYGPATH_W) 'src/lispeng/clos.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/clos.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/clos.Tpo $(DEPDIR)/clos.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/clos.cpp' object='clos.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o clos.obj `if test -f 'src/lispeng/clos.cpp'; then $(CYGPATH_W) 'src/lispeng/clos.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/clos.cpp'; fi` data.o: src/lispeng/data.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT data.o -MD -MP -MF $(DEPDIR)/data.Tpo -c -o data.o `test -f 'src/lispeng/data.cpp' || echo '$(srcdir)/'`src/lispeng/data.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/data.Tpo $(DEPDIR)/data.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/data.cpp' object='data.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o data.o `test -f 'src/lispeng/data.cpp' || echo '$(srcdir)/'`src/lispeng/data.cpp data.obj: src/lispeng/data.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT data.obj -MD -MP -MF $(DEPDIR)/data.Tpo -c -o data.obj `if test -f 'src/lispeng/data.cpp'; then $(CYGPATH_W) 'src/lispeng/data.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/data.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/data.Tpo $(DEPDIR)/data.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/data.cpp' object='data.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o data.obj `if test -f 'src/lispeng/data.cpp'; then $(CYGPATH_W) 'src/lispeng/data.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/data.cpp'; fi` debug.o: src/lispeng/debug.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT debug.o -MD -MP -MF $(DEPDIR)/debug.Tpo -c -o debug.o `test -f 'src/lispeng/debug.cpp' || echo '$(srcdir)/'`src/lispeng/debug.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/debug.Tpo $(DEPDIR)/debug.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/debug.cpp' object='debug.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o debug.o `test -f 'src/lispeng/debug.cpp' || echo '$(srcdir)/'`src/lispeng/debug.cpp debug.obj: src/lispeng/debug.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT debug.obj -MD -MP -MF $(DEPDIR)/debug.Tpo -c -o debug.obj `if test -f 'src/lispeng/debug.cpp'; then $(CYGPATH_W) 'src/lispeng/debug.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/debug.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/debug.Tpo $(DEPDIR)/debug.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/debug.cpp' object='debug.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o debug.obj `if test -f 'src/lispeng/debug.cpp'; then $(CYGPATH_W) 'src/lispeng/debug.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/debug.cpp'; fi` debugger.o: src/lispeng/debugger.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT debugger.o -MD -MP -MF $(DEPDIR)/debugger.Tpo -c -o debugger.o `test -f 'src/lispeng/debugger.cpp' || echo '$(srcdir)/'`src/lispeng/debugger.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/debugger.Tpo $(DEPDIR)/debugger.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/debugger.cpp' object='debugger.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o debugger.o `test -f 'src/lispeng/debugger.cpp' || echo '$(srcdir)/'`src/lispeng/debugger.cpp debugger.obj: src/lispeng/debugger.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT debugger.obj -MD -MP -MF $(DEPDIR)/debugger.Tpo -c -o debugger.obj `if test -f 'src/lispeng/debugger.cpp'; then $(CYGPATH_W) 'src/lispeng/debugger.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/debugger.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/debugger.Tpo $(DEPDIR)/debugger.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/debugger.cpp' object='debugger.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o debugger.obj `if test -f 'src/lispeng/debugger.cpp'; then $(CYGPATH_W) 'src/lispeng/debugger.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/debugger.cpp'; fi` eval.o: src/lispeng/eval.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT eval.o -MD -MP -MF $(DEPDIR)/eval.Tpo -c -o eval.o `test -f 'src/lispeng/eval.cpp' || echo '$(srcdir)/'`src/lispeng/eval.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/eval.Tpo $(DEPDIR)/eval.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/eval.cpp' object='eval.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o eval.o `test -f 'src/lispeng/eval.cpp' || echo '$(srcdir)/'`src/lispeng/eval.cpp eval.obj: src/lispeng/eval.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT eval.obj -MD -MP -MF $(DEPDIR)/eval.Tpo -c -o eval.obj `if test -f 'src/lispeng/eval.cpp'; then $(CYGPATH_W) 'src/lispeng/eval.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/eval.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/eval.Tpo $(DEPDIR)/eval.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/eval.cpp' object='eval.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o eval.obj `if test -f 'src/lispeng/eval.cpp'; then $(CYGPATH_W) 'src/lispeng/eval.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/eval.cpp'; fi` garbagecoll.o: src/lispeng/garbagecoll.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT garbagecoll.o -MD -MP -MF $(DEPDIR)/garbagecoll.Tpo -c -o garbagecoll.o `test -f 'src/lispeng/garbagecoll.cpp' || echo '$(srcdir)/'`src/lispeng/garbagecoll.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/garbagecoll.Tpo $(DEPDIR)/garbagecoll.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/garbagecoll.cpp' object='garbagecoll.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o garbagecoll.o `test -f 'src/lispeng/garbagecoll.cpp' || echo '$(srcdir)/'`src/lispeng/garbagecoll.cpp garbagecoll.obj: src/lispeng/garbagecoll.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT garbagecoll.obj -MD -MP -MF $(DEPDIR)/garbagecoll.Tpo -c -o garbagecoll.obj `if test -f 'src/lispeng/garbagecoll.cpp'; then $(CYGPATH_W) 'src/lispeng/garbagecoll.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/garbagecoll.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/garbagecoll.Tpo $(DEPDIR)/garbagecoll.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/garbagecoll.cpp' object='garbagecoll.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o garbagecoll.obj `if test -f 'src/lispeng/garbagecoll.cpp'; then $(CYGPATH_W) 'src/lispeng/garbagecoll.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/garbagecoll.cpp'; fi` f_array.o: src/lispeng/f_array.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_array.o -MD -MP -MF $(DEPDIR)/f_array.Tpo -c -o f_array.o `test -f 'src/lispeng/f_array.cpp' || echo '$(srcdir)/'`src/lispeng/f_array.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_array.Tpo $(DEPDIR)/f_array.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_array.cpp' object='f_array.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_array.o `test -f 'src/lispeng/f_array.cpp' || echo '$(srcdir)/'`src/lispeng/f_array.cpp f_array.obj: src/lispeng/f_array.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_array.obj -MD -MP -MF $(DEPDIR)/f_array.Tpo -c -o f_array.obj `if test -f 'src/lispeng/f_array.cpp'; then $(CYGPATH_W) 'src/lispeng/f_array.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_array.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_array.Tpo $(DEPDIR)/f_array.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_array.cpp' object='f_array.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_array.obj `if test -f 'src/lispeng/f_array.cpp'; then $(CYGPATH_W) 'src/lispeng/f_array.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_array.cpp'; fi` f_character.o: src/lispeng/f_character.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_character.o -MD -MP -MF $(DEPDIR)/f_character.Tpo -c -o f_character.o `test -f 'src/lispeng/f_character.cpp' || echo '$(srcdir)/'`src/lispeng/f_character.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_character.Tpo $(DEPDIR)/f_character.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_character.cpp' object='f_character.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_character.o `test -f 'src/lispeng/f_character.cpp' || echo '$(srcdir)/'`src/lispeng/f_character.cpp f_character.obj: src/lispeng/f_character.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_character.obj -MD -MP -MF $(DEPDIR)/f_character.Tpo -c -o f_character.obj `if test -f 'src/lispeng/f_character.cpp'; then $(CYGPATH_W) 'src/lispeng/f_character.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_character.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_character.Tpo $(DEPDIR)/f_character.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_character.cpp' object='f_character.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_character.obj `if test -f 'src/lispeng/f_character.cpp'; then $(CYGPATH_W) 'src/lispeng/f_character.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_character.cpp'; fi` f_environment.o: src/lispeng/f_environment.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_environment.o -MD -MP -MF $(DEPDIR)/f_environment.Tpo -c -o f_environment.o `test -f 'src/lispeng/f_environment.cpp' || echo '$(srcdir)/'`src/lispeng/f_environment.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_environment.Tpo $(DEPDIR)/f_environment.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_environment.cpp' object='f_environment.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_environment.o `test -f 'src/lispeng/f_environment.cpp' || echo '$(srcdir)/'`src/lispeng/f_environment.cpp f_environment.obj: src/lispeng/f_environment.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_environment.obj -MD -MP -MF $(DEPDIR)/f_environment.Tpo -c -o f_environment.obj `if test -f 'src/lispeng/f_environment.cpp'; then $(CYGPATH_W) 'src/lispeng/f_environment.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_environment.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_environment.Tpo $(DEPDIR)/f_environment.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_environment.cpp' object='f_environment.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_environment.obj `if test -f 'src/lispeng/f_environment.cpp'; then $(CYGPATH_W) 'src/lispeng/f_environment.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_environment.cpp'; fi` f_file.o: src/lispeng/f_file.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_file.o -MD -MP -MF $(DEPDIR)/f_file.Tpo -c -o f_file.o `test -f 'src/lispeng/f_file.cpp' || echo '$(srcdir)/'`src/lispeng/f_file.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_file.Tpo $(DEPDIR)/f_file.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_file.cpp' object='f_file.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_file.o `test -f 'src/lispeng/f_file.cpp' || echo '$(srcdir)/'`src/lispeng/f_file.cpp f_file.obj: src/lispeng/f_file.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_file.obj -MD -MP -MF $(DEPDIR)/f_file.Tpo -c -o f_file.obj `if test -f 'src/lispeng/f_file.cpp'; then $(CYGPATH_W) 'src/lispeng/f_file.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_file.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_file.Tpo $(DEPDIR)/f_file.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_file.cpp' object='f_file.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_file.obj `if test -f 'src/lispeng/f_file.cpp'; then $(CYGPATH_W) 'src/lispeng/f_file.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_file.cpp'; fi` f_hashtable.o: src/lispeng/f_hashtable.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_hashtable.o -MD -MP -MF $(DEPDIR)/f_hashtable.Tpo -c -o f_hashtable.o `test -f 'src/lispeng/f_hashtable.cpp' || echo '$(srcdir)/'`src/lispeng/f_hashtable.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_hashtable.Tpo $(DEPDIR)/f_hashtable.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_hashtable.cpp' object='f_hashtable.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_hashtable.o `test -f 'src/lispeng/f_hashtable.cpp' || echo '$(srcdir)/'`src/lispeng/f_hashtable.cpp f_hashtable.obj: src/lispeng/f_hashtable.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_hashtable.obj -MD -MP -MF $(DEPDIR)/f_hashtable.Tpo -c -o f_hashtable.obj `if test -f 'src/lispeng/f_hashtable.cpp'; then $(CYGPATH_W) 'src/lispeng/f_hashtable.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_hashtable.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_hashtable.Tpo $(DEPDIR)/f_hashtable.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_hashtable.cpp' object='f_hashtable.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_hashtable.obj `if test -f 'src/lispeng/f_hashtable.cpp'; then $(CYGPATH_W) 'src/lispeng/f_hashtable.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_hashtable.cpp'; fi` f_list.o: src/lispeng/f_list.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_list.o -MD -MP -MF $(DEPDIR)/f_list.Tpo -c -o f_list.o `test -f 'src/lispeng/f_list.cpp' || echo '$(srcdir)/'`src/lispeng/f_list.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_list.Tpo $(DEPDIR)/f_list.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_list.cpp' object='f_list.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_list.o `test -f 'src/lispeng/f_list.cpp' || echo '$(srcdir)/'`src/lispeng/f_list.cpp f_list.obj: src/lispeng/f_list.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_list.obj -MD -MP -MF $(DEPDIR)/f_list.Tpo -c -o f_list.obj `if test -f 'src/lispeng/f_list.cpp'; then $(CYGPATH_W) 'src/lispeng/f_list.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_list.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_list.Tpo $(DEPDIR)/f_list.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_list.cpp' object='f_list.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_list.obj `if test -f 'src/lispeng/f_list.cpp'; then $(CYGPATH_W) 'src/lispeng/f_list.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_list.cpp'; fi` f_number.o: src/lispeng/f_number.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_number.o -MD -MP -MF $(DEPDIR)/f_number.Tpo -c -o f_number.o `test -f 'src/lispeng/f_number.cpp' || echo '$(srcdir)/'`src/lispeng/f_number.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_number.Tpo $(DEPDIR)/f_number.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_number.cpp' object='f_number.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_number.o `test -f 'src/lispeng/f_number.cpp' || echo '$(srcdir)/'`src/lispeng/f_number.cpp f_number.obj: src/lispeng/f_number.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_number.obj -MD -MP -MF $(DEPDIR)/f_number.Tpo -c -o f_number.obj `if test -f 'src/lispeng/f_number.cpp'; then $(CYGPATH_W) 'src/lispeng/f_number.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_number.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_number.Tpo $(DEPDIR)/f_number.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_number.cpp' object='f_number.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_number.obj `if test -f 'src/lispeng/f_number.cpp'; then $(CYGPATH_W) 'src/lispeng/f_number.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_number.cpp'; fi` f_package.o: src/lispeng/f_package.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_package.o -MD -MP -MF $(DEPDIR)/f_package.Tpo -c -o f_package.o `test -f 'src/lispeng/f_package.cpp' || echo '$(srcdir)/'`src/lispeng/f_package.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_package.Tpo $(DEPDIR)/f_package.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_package.cpp' object='f_package.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_package.o `test -f 'src/lispeng/f_package.cpp' || echo '$(srcdir)/'`src/lispeng/f_package.cpp f_package.obj: src/lispeng/f_package.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_package.obj -MD -MP -MF $(DEPDIR)/f_package.Tpo -c -o f_package.obj `if test -f 'src/lispeng/f_package.cpp'; then $(CYGPATH_W) 'src/lispeng/f_package.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_package.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_package.Tpo $(DEPDIR)/f_package.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_package.cpp' object='f_package.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_package.obj `if test -f 'src/lispeng/f_package.cpp'; then $(CYGPATH_W) 'src/lispeng/f_package.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_package.cpp'; fi` f_pathname.o: src/lispeng/f_pathname.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_pathname.o -MD -MP -MF $(DEPDIR)/f_pathname.Tpo -c -o f_pathname.o `test -f 'src/lispeng/f_pathname.cpp' || echo '$(srcdir)/'`src/lispeng/f_pathname.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_pathname.Tpo $(DEPDIR)/f_pathname.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_pathname.cpp' object='f_pathname.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_pathname.o `test -f 'src/lispeng/f_pathname.cpp' || echo '$(srcdir)/'`src/lispeng/f_pathname.cpp f_pathname.obj: src/lispeng/f_pathname.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_pathname.obj -MD -MP -MF $(DEPDIR)/f_pathname.Tpo -c -o f_pathname.obj `if test -f 'src/lispeng/f_pathname.cpp'; then $(CYGPATH_W) 'src/lispeng/f_pathname.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_pathname.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_pathname.Tpo $(DEPDIR)/f_pathname.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_pathname.cpp' object='f_pathname.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_pathname.obj `if test -f 'src/lispeng/f_pathname.cpp'; then $(CYGPATH_W) 'src/lispeng/f_pathname.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_pathname.cpp'; fi` f_seq.o: src/lispeng/f_seq.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_seq.o -MD -MP -MF $(DEPDIR)/f_seq.Tpo -c -o f_seq.o `test -f 'src/lispeng/f_seq.cpp' || echo '$(srcdir)/'`src/lispeng/f_seq.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_seq.Tpo $(DEPDIR)/f_seq.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_seq.cpp' object='f_seq.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_seq.o `test -f 'src/lispeng/f_seq.cpp' || echo '$(srcdir)/'`src/lispeng/f_seq.cpp f_seq.obj: src/lispeng/f_seq.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_seq.obj -MD -MP -MF $(DEPDIR)/f_seq.Tpo -c -o f_seq.obj `if test -f 'src/lispeng/f_seq.cpp'; then $(CYGPATH_W) 'src/lispeng/f_seq.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_seq.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_seq.Tpo $(DEPDIR)/f_seq.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_seq.cpp' object='f_seq.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_seq.obj `if test -f 'src/lispeng/f_seq.cpp'; then $(CYGPATH_W) 'src/lispeng/f_seq.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_seq.cpp'; fi` f_stream.o: src/lispeng/f_stream.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_stream.o -MD -MP -MF $(DEPDIR)/f_stream.Tpo -c -o f_stream.o `test -f 'src/lispeng/f_stream.cpp' || echo '$(srcdir)/'`src/lispeng/f_stream.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_stream.Tpo $(DEPDIR)/f_stream.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_stream.cpp' object='f_stream.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_stream.o `test -f 'src/lispeng/f_stream.cpp' || echo '$(srcdir)/'`src/lispeng/f_stream.cpp f_stream.obj: src/lispeng/f_stream.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT f_stream.obj -MD -MP -MF $(DEPDIR)/f_stream.Tpo -c -o f_stream.obj `if test -f 'src/lispeng/f_stream.cpp'; then $(CYGPATH_W) 'src/lispeng/f_stream.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_stream.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/f_stream.Tpo $(DEPDIR)/f_stream.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/f_stream.cpp' object='f_stream.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o f_stream.obj `if test -f 'src/lispeng/f_stream.cpp'; then $(CYGPATH_W) 'src/lispeng/f_stream.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/f_stream.cpp'; fi` ffi.o: src/lispeng/ffi.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ffi.o -MD -MP -MF $(DEPDIR)/ffi.Tpo -c -o ffi.o `test -f 'src/lispeng/ffi.cpp' || echo '$(srcdir)/'`src/lispeng/ffi.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ffi.Tpo $(DEPDIR)/ffi.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/ffi.cpp' object='ffi.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ffi.o `test -f 'src/lispeng/ffi.cpp' || echo '$(srcdir)/'`src/lispeng/ffi.cpp ffi.obj: src/lispeng/ffi.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ffi.obj -MD -MP -MF $(DEPDIR)/ffi.Tpo -c -o ffi.obj `if test -f 'src/lispeng/ffi.cpp'; then $(CYGPATH_W) 'src/lispeng/ffi.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/ffi.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ffi.Tpo $(DEPDIR)/ffi.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/ffi.cpp' object='ffi.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ffi.obj `if test -f 'src/lispeng/ffi.cpp'; then $(CYGPATH_W) 'src/lispeng/ffi.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/ffi.cpp'; fi` functions.o: src/lispeng/functions.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT functions.o -MD -MP -MF $(DEPDIR)/functions.Tpo -c -o functions.o `test -f 'src/lispeng/functions.cpp' || echo '$(srcdir)/'`src/lispeng/functions.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/functions.Tpo $(DEPDIR)/functions.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/functions.cpp' object='functions.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o functions.o `test -f 'src/lispeng/functions.cpp' || echo '$(srcdir)/'`src/lispeng/functions.cpp functions.obj: src/lispeng/functions.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT functions.obj -MD -MP -MF $(DEPDIR)/functions.Tpo -c -o functions.obj `if test -f 'src/lispeng/functions.cpp'; then $(CYGPATH_W) 'src/lispeng/functions.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/functions.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/functions.Tpo $(DEPDIR)/functions.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/functions.cpp' object='functions.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o functions.obj `if test -f 'src/lispeng/functions.cpp'; then $(CYGPATH_W) 'src/lispeng/functions.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/functions.cpp'; fi` lisp.o: src/lispeng/lisp.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lisp.o -MD -MP -MF $(DEPDIR)/lisp.Tpo -c -o lisp.o `test -f 'src/lispeng/lisp.cpp' || echo '$(srcdir)/'`src/lispeng/lisp.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/lisp.Tpo $(DEPDIR)/lisp.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/lisp.cpp' object='lisp.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lisp.o `test -f 'src/lispeng/lisp.cpp' || echo '$(srcdir)/'`src/lispeng/lisp.cpp lisp.obj: src/lispeng/lisp.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lisp.obj -MD -MP -MF $(DEPDIR)/lisp.Tpo -c -o lisp.obj `if test -f 'src/lispeng/lisp.cpp'; then $(CYGPATH_W) 'src/lispeng/lisp.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/lisp.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/lisp.Tpo $(DEPDIR)/lisp.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/lisp.cpp' object='lisp.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lisp.obj `if test -f 'src/lispeng/lisp.cpp'; then $(CYGPATH_W) 'src/lispeng/lisp.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/lisp.cpp'; fi` listutil.o: src/lispeng/listutil.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT listutil.o -MD -MP -MF $(DEPDIR)/listutil.Tpo -c -o listutil.o `test -f 'src/lispeng/listutil.cpp' || echo '$(srcdir)/'`src/lispeng/listutil.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/listutil.Tpo $(DEPDIR)/listutil.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/listutil.cpp' object='listutil.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o listutil.o `test -f 'src/lispeng/listutil.cpp' || echo '$(srcdir)/'`src/lispeng/listutil.cpp listutil.obj: src/lispeng/listutil.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT listutil.obj -MD -MP -MF $(DEPDIR)/listutil.Tpo -c -o listutil.obj `if test -f 'src/lispeng/listutil.cpp'; then $(CYGPATH_W) 'src/lispeng/listutil.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/listutil.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/listutil.Tpo $(DEPDIR)/listutil.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/listutil.cpp' object='listutil.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o listutil.obj `if test -f 'src/lispeng/listutil.cpp'; then $(CYGPATH_W) 'src/lispeng/listutil.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/listutil.cpp'; fi` macros.o: src/lispeng/macros.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT macros.o -MD -MP -MF $(DEPDIR)/macros.Tpo -c -o macros.o `test -f 'src/lispeng/macros.cpp' || echo '$(srcdir)/'`src/lispeng/macros.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/macros.Tpo $(DEPDIR)/macros.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/macros.cpp' object='macros.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o macros.o `test -f 'src/lispeng/macros.cpp' || echo '$(srcdir)/'`src/lispeng/macros.cpp macros.obj: src/lispeng/macros.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT macros.obj -MD -MP -MF $(DEPDIR)/macros.Tpo -c -o macros.obj `if test -f 'src/lispeng/macros.cpp'; then $(CYGPATH_W) 'src/lispeng/macros.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/macros.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/macros.Tpo $(DEPDIR)/macros.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/macros.cpp' object='macros.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o macros.obj `if test -f 'src/lispeng/macros.cpp'; then $(CYGPATH_W) 'src/lispeng/macros.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/macros.cpp'; fi` memimage.o: src/lispeng/memimage.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT memimage.o -MD -MP -MF $(DEPDIR)/memimage.Tpo -c -o memimage.o `test -f 'src/lispeng/memimage.cpp' || echo '$(srcdir)/'`src/lispeng/memimage.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/memimage.Tpo $(DEPDIR)/memimage.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/memimage.cpp' object='memimage.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o memimage.o `test -f 'src/lispeng/memimage.cpp' || echo '$(srcdir)/'`src/lispeng/memimage.cpp memimage.obj: src/lispeng/memimage.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT memimage.obj -MD -MP -MF $(DEPDIR)/memimage.Tpo -c -o memimage.obj `if test -f 'src/lispeng/memimage.cpp'; then $(CYGPATH_W) 'src/lispeng/memimage.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/memimage.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/memimage.Tpo $(DEPDIR)/memimage.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/memimage.cpp' object='memimage.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o memimage.obj `if test -f 'src/lispeng/memimage.cpp'; then $(CYGPATH_W) 'src/lispeng/memimage.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/memimage.cpp'; fi` pretty-printer.o: src/lispeng/pretty-printer.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pretty-printer.o -MD -MP -MF $(DEPDIR)/pretty-printer.Tpo -c -o pretty-printer.o `test -f 'src/lispeng/pretty-printer.cpp' || echo '$(srcdir)/'`src/lispeng/pretty-printer.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/pretty-printer.Tpo $(DEPDIR)/pretty-printer.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/pretty-printer.cpp' object='pretty-printer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pretty-printer.o `test -f 'src/lispeng/pretty-printer.cpp' || echo '$(srcdir)/'`src/lispeng/pretty-printer.cpp pretty-printer.obj: src/lispeng/pretty-printer.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT pretty-printer.obj -MD -MP -MF $(DEPDIR)/pretty-printer.Tpo -c -o pretty-printer.obj `if test -f 'src/lispeng/pretty-printer.cpp'; then $(CYGPATH_W) 'src/lispeng/pretty-printer.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/pretty-printer.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/pretty-printer.Tpo $(DEPDIR)/pretty-printer.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/pretty-printer.cpp' object='pretty-printer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o pretty-printer.obj `if test -f 'src/lispeng/pretty-printer.cpp'; then $(CYGPATH_W) 'src/lispeng/pretty-printer.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/pretty-printer.cpp'; fi` printer.o: src/lispeng/printer.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT printer.o -MD -MP -MF $(DEPDIR)/printer.Tpo -c -o printer.o `test -f 'src/lispeng/printer.cpp' || echo '$(srcdir)/'`src/lispeng/printer.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/printer.Tpo $(DEPDIR)/printer.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/printer.cpp' object='printer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o printer.o `test -f 'src/lispeng/printer.cpp' || echo '$(srcdir)/'`src/lispeng/printer.cpp printer.obj: src/lispeng/printer.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT printer.obj -MD -MP -MF $(DEPDIR)/printer.Tpo -c -o printer.obj `if test -f 'src/lispeng/printer.cpp'; then $(CYGPATH_W) 'src/lispeng/printer.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/printer.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/printer.Tpo $(DEPDIR)/printer.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/printer.cpp' object='printer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o printer.obj `if test -f 'src/lispeng/printer.cpp'; then $(CYGPATH_W) 'src/lispeng/printer.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/printer.cpp'; fi` reader.o: src/lispeng/reader.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT reader.o -MD -MP -MF $(DEPDIR)/reader.Tpo -c -o reader.o `test -f 'src/lispeng/reader.cpp' || echo '$(srcdir)/'`src/lispeng/reader.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/reader.Tpo $(DEPDIR)/reader.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/reader.cpp' object='reader.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o reader.o `test -f 'src/lispeng/reader.cpp' || echo '$(srcdir)/'`src/lispeng/reader.cpp reader.obj: src/lispeng/reader.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT reader.obj -MD -MP -MF $(DEPDIR)/reader.Tpo -c -o reader.obj `if test -f 'src/lispeng/reader.cpp'; then $(CYGPATH_W) 'src/lispeng/reader.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/reader.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/reader.Tpo $(DEPDIR)/reader.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/reader.cpp' object='reader.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o reader.obj `if test -f 'src/lispeng/reader.cpp'; then $(CYGPATH_W) 'src/lispeng/reader.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/reader.cpp'; fi` specialoperators.o: src/lispeng/specialoperators.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT specialoperators.o -MD -MP -MF $(DEPDIR)/specialoperators.Tpo -c -o specialoperators.o `test -f 'src/lispeng/specialoperators.cpp' || echo '$(srcdir)/'`src/lispeng/specialoperators.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/specialoperators.Tpo $(DEPDIR)/specialoperators.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/specialoperators.cpp' object='specialoperators.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o specialoperators.o `test -f 'src/lispeng/specialoperators.cpp' || echo '$(srcdir)/'`src/lispeng/specialoperators.cpp specialoperators.obj: src/lispeng/specialoperators.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT specialoperators.obj -MD -MP -MF $(DEPDIR)/specialoperators.Tpo -c -o specialoperators.obj `if test -f 'src/lispeng/specialoperators.cpp'; then $(CYGPATH_W) 'src/lispeng/specialoperators.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/specialoperators.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/specialoperators.Tpo $(DEPDIR)/specialoperators.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/specialoperators.cpp' object='specialoperators.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o specialoperators.obj `if test -f 'src/lispeng/specialoperators.cpp'; then $(CYGPATH_W) 'src/lispeng/specialoperators.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/specialoperators.cpp'; fi` svalue.o: src/lispeng/svalue.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT svalue.o -MD -MP -MF $(DEPDIR)/svalue.Tpo -c -o svalue.o `test -f 'src/lispeng/svalue.cpp' || echo '$(srcdir)/'`src/lispeng/svalue.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/svalue.Tpo $(DEPDIR)/svalue.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/svalue.cpp' object='svalue.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o svalue.o `test -f 'src/lispeng/svalue.cpp' || echo '$(srcdir)/'`src/lispeng/svalue.cpp svalue.obj: src/lispeng/svalue.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT svalue.obj -MD -MP -MF $(DEPDIR)/svalue.Tpo -c -o svalue.obj `if test -f 'src/lispeng/svalue.cpp'; then $(CYGPATH_W) 'src/lispeng/svalue.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/svalue.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/svalue.Tpo $(DEPDIR)/svalue.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/svalue.cpp' object='svalue.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o svalue.obj `if test -f 'src/lispeng/svalue.cpp'; then $(CYGPATH_W) 'src/lispeng/svalue.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/svalue.cpp'; fi` vm.o: src/lispeng/vm.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vm.o -MD -MP -MF $(DEPDIR)/vm.Tpo -c -o vm.o `test -f 'src/lispeng/vm.cpp' || echo '$(srcdir)/'`src/lispeng/vm.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/vm.Tpo $(DEPDIR)/vm.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/vm.cpp' object='vm.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vm.o `test -f 'src/lispeng/vm.cpp' || echo '$(srcdir)/'`src/lispeng/vm.cpp vm.obj: src/lispeng/vm.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT vm.obj -MD -MP -MF $(DEPDIR)/vm.Tpo -c -o vm.obj `if test -f 'src/lispeng/vm.cpp'; then $(CYGPATH_W) 'src/lispeng/vm.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/vm.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/vm.Tpo $(DEPDIR)/vm.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/vm.cpp' object='vm.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o vm.obj `if test -f 'src/lispeng/vm.cpp'; then $(CYGPATH_W) 'src/lispeng/vm.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/vm.cpp'; fi` lisper.o: src/console/lisper.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lisper.o -MD -MP -MF $(DEPDIR)/lisper.Tpo -c -o lisper.o `test -f 'src/console/lisper.cpp' || echo '$(srcdir)/'`src/console/lisper.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/lisper.Tpo $(DEPDIR)/lisper.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/console/lisper.cpp' object='lisper.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lisper.o `test -f 'src/console/lisper.cpp' || echo '$(srcdir)/'`src/console/lisper.cpp lisper.obj: src/console/lisper.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lisper.obj -MD -MP -MF $(DEPDIR)/lisper.Tpo -c -o lisper.obj `if test -f 'src/console/lisper.cpp'; then $(CYGPATH_W) 'src/console/lisper.cpp'; else $(CYGPATH_W) '$(srcdir)/src/console/lisper.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/lisper.Tpo $(DEPDIR)/lisper.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/console/lisper.cpp' object='lisper.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lisper.obj `if test -f 'src/console/lisper.cpp'; then $(CYGPATH_W) 'src/console/lisper.cpp'; else $(CYGPATH_W) '$(srcdir)/src/console/lisper.cpp'; fi` bignum.o: el/libext/bignum.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bignum.o -MD -MP -MF $(DEPDIR)/bignum.Tpo -c -o bignum.o `test -f 'el/libext/bignum.cpp' || echo '$(srcdir)/'`el/libext/bignum.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/bignum.Tpo $(DEPDIR)/bignum.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/bignum.cpp' object='bignum.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bignum.o `test -f 'el/libext/bignum.cpp' || echo '$(srcdir)/'`el/libext/bignum.cpp bignum.obj: el/libext/bignum.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bignum.obj -MD -MP -MF $(DEPDIR)/bignum.Tpo -c -o bignum.obj `if test -f 'el/libext/bignum.cpp'; then $(CYGPATH_W) 'el/libext/bignum.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/bignum.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/bignum.Tpo $(DEPDIR)/bignum.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/bignum.cpp' object='bignum.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bignum.obj `if test -f 'el/libext/bignum.cpp'; then $(CYGPATH_W) 'el/libext/bignum.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/bignum.cpp'; fi` ext-text.o: el/libext/ext-text.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-text.o -MD -MP -MF $(DEPDIR)/ext-text.Tpo -c -o ext-text.o `test -f 'el/libext/ext-text.cpp' || echo '$(srcdir)/'`el/libext/ext-text.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-text.Tpo $(DEPDIR)/ext-text.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-text.cpp' object='ext-text.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-text.o `test -f 'el/libext/ext-text.cpp' || echo '$(srcdir)/'`el/libext/ext-text.cpp ext-text.obj: el/libext/ext-text.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-text.obj -MD -MP -MF $(DEPDIR)/ext-text.Tpo -c -o ext-text.obj `if test -f 'el/libext/ext-text.cpp'; then $(CYGPATH_W) 'el/libext/ext-text.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-text.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-text.Tpo $(DEPDIR)/ext-text.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-text.cpp' object='ext-text.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-text.obj `if test -f 'el/libext/ext-text.cpp'; then $(CYGPATH_W) 'el/libext/ext-text.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-text.cpp'; fi` ext-handlers.o: el/libext/ext-handlers.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-handlers.o -MD -MP -MF $(DEPDIR)/ext-handlers.Tpo -c -o ext-handlers.o `test -f 'el/libext/ext-handlers.cpp' || echo '$(srcdir)/'`el/libext/ext-handlers.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-handlers.Tpo $(DEPDIR)/ext-handlers.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-handlers.cpp' object='ext-handlers.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-handlers.o `test -f 'el/libext/ext-handlers.cpp' || echo '$(srcdir)/'`el/libext/ext-handlers.cpp ext-handlers.obj: el/libext/ext-handlers.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-handlers.obj -MD -MP -MF $(DEPDIR)/ext-handlers.Tpo -c -o ext-handlers.obj `if test -f 'el/libext/ext-handlers.cpp'; then $(CYGPATH_W) 'el/libext/ext-handlers.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-handlers.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-handlers.Tpo $(DEPDIR)/ext-handlers.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-handlers.cpp' object='ext-handlers.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-handlers.obj `if test -f 'el/libext/ext-handlers.cpp'; then $(CYGPATH_W) 'el/libext/ext-handlers.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-handlers.cpp'; fi` ext-encoding.o: el/libext/ext-encoding.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-encoding.o -MD -MP -MF $(DEPDIR)/ext-encoding.Tpo -c -o ext-encoding.o `test -f 'el/libext/ext-encoding.cpp' || echo '$(srcdir)/'`el/libext/ext-encoding.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-encoding.Tpo $(DEPDIR)/ext-encoding.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-encoding.cpp' object='ext-encoding.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-encoding.o `test -f 'el/libext/ext-encoding.cpp' || echo '$(srcdir)/'`el/libext/ext-encoding.cpp ext-encoding.obj: el/libext/ext-encoding.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-encoding.obj -MD -MP -MF $(DEPDIR)/ext-encoding.Tpo -c -o ext-encoding.obj `if test -f 'el/libext/ext-encoding.cpp'; then $(CYGPATH_W) 'el/libext/ext-encoding.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-encoding.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-encoding.Tpo $(DEPDIR)/ext-encoding.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-encoding.cpp' object='ext-encoding.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-encoding.obj `if test -f 'el/libext/ext-encoding.cpp'; then $(CYGPATH_W) 'el/libext/ext-encoding.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-encoding.cpp'; fi` threader.o: el/libext/threader.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT threader.o -MD -MP -MF $(DEPDIR)/threader.Tpo -c -o threader.o `test -f 'el/libext/threader.cpp' || echo '$(srcdir)/'`el/libext/threader.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/threader.Tpo $(DEPDIR)/threader.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/threader.cpp' object='threader.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o threader.o `test -f 'el/libext/threader.cpp' || echo '$(srcdir)/'`el/libext/threader.cpp threader.obj: el/libext/threader.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT threader.obj -MD -MP -MF $(DEPDIR)/threader.Tpo -c -o threader.obj `if test -f 'el/libext/threader.cpp'; then $(CYGPATH_W) 'el/libext/threader.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/threader.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/threader.Tpo $(DEPDIR)/threader.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/threader.cpp' object='threader.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o threader.obj `if test -f 'el/libext/threader.cpp'; then $(CYGPATH_W) 'el/libext/threader.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/threader.cpp'; fi` ext-file.o: el/libext/ext-file.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-file.o -MD -MP -MF $(DEPDIR)/ext-file.Tpo -c -o ext-file.o `test -f 'el/libext/ext-file.cpp' || echo '$(srcdir)/'`el/libext/ext-file.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-file.Tpo $(DEPDIR)/ext-file.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-file.cpp' object='ext-file.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-file.o `test -f 'el/libext/ext-file.cpp' || echo '$(srcdir)/'`el/libext/ext-file.cpp ext-file.obj: el/libext/ext-file.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-file.obj -MD -MP -MF $(DEPDIR)/ext-file.Tpo -c -o ext-file.obj `if test -f 'el/libext/ext-file.cpp'; then $(CYGPATH_W) 'el/libext/ext-file.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-file.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-file.Tpo $(DEPDIR)/ext-file.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-file.cpp' object='ext-file.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-file.obj `if test -f 'el/libext/ext-file.cpp'; then $(CYGPATH_W) 'el/libext/ext-file.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-file.cpp'; fi` ext-fw.o: el/libext/ext-fw.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-fw.o -MD -MP -MF $(DEPDIR)/ext-fw.Tpo -c -o ext-fw.o `test -f 'el/libext/ext-fw.cpp' || echo '$(srcdir)/'`el/libext/ext-fw.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-fw.Tpo $(DEPDIR)/ext-fw.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-fw.cpp' object='ext-fw.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-fw.o `test -f 'el/libext/ext-fw.cpp' || echo '$(srcdir)/'`el/libext/ext-fw.cpp ext-fw.obj: el/libext/ext-fw.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-fw.obj -MD -MP -MF $(DEPDIR)/ext-fw.Tpo -c -o ext-fw.obj `if test -f 'el/libext/ext-fw.cpp'; then $(CYGPATH_W) 'el/libext/ext-fw.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-fw.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-fw.Tpo $(DEPDIR)/ext-fw.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-fw.cpp' object='ext-fw.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-fw.obj `if test -f 'el/libext/ext-fw.cpp'; then $(CYGPATH_W) 'el/libext/ext-fw.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-fw.cpp'; fi` datetime.o: el/libext/datetime.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT datetime.o -MD -MP -MF $(DEPDIR)/datetime.Tpo -c -o datetime.o `test -f 'el/libext/datetime.cpp' || echo '$(srcdir)/'`el/libext/datetime.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/datetime.Tpo $(DEPDIR)/datetime.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/datetime.cpp' object='datetime.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o datetime.o `test -f 'el/libext/datetime.cpp' || echo '$(srcdir)/'`el/libext/datetime.cpp datetime.obj: el/libext/datetime.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT datetime.obj -MD -MP -MF $(DEPDIR)/datetime.Tpo -c -o datetime.obj `if test -f 'el/libext/datetime.cpp'; then $(CYGPATH_W) 'el/libext/datetime.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/datetime.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/datetime.Tpo $(DEPDIR)/datetime.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/datetime.cpp' object='datetime.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o datetime.obj `if test -f 'el/libext/datetime.cpp'; then $(CYGPATH_W) 'el/libext/datetime.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/datetime.cpp'; fi` ext-base.o: el/libext/ext-base.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-base.o -MD -MP -MF $(DEPDIR)/ext-base.Tpo -c -o ext-base.o `test -f 'el/libext/ext-base.cpp' || echo '$(srcdir)/'`el/libext/ext-base.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-base.Tpo $(DEPDIR)/ext-base.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-base.cpp' object='ext-base.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-base.o `test -f 'el/libext/ext-base.cpp' || echo '$(srcdir)/'`el/libext/ext-base.cpp ext-base.obj: el/libext/ext-base.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-base.obj -MD -MP -MF $(DEPDIR)/ext-base.Tpo -c -o ext-base.obj `if test -f 'el/libext/ext-base.cpp'; then $(CYGPATH_W) 'el/libext/ext-base.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-base.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-base.Tpo $(DEPDIR)/ext-base.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-base.cpp' object='ext-base.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-base.obj `if test -f 'el/libext/ext-base.cpp'; then $(CYGPATH_W) 'el/libext/ext-base.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-base.cpp'; fi` ext-os.o: el/libext/ext-os.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-os.o -MD -MP -MF $(DEPDIR)/ext-os.Tpo -c -o ext-os.o `test -f 'el/libext/ext-os.cpp' || echo '$(srcdir)/'`el/libext/ext-os.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-os.Tpo $(DEPDIR)/ext-os.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-os.cpp' object='ext-os.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-os.o `test -f 'el/libext/ext-os.cpp' || echo '$(srcdir)/'`el/libext/ext-os.cpp ext-os.obj: el/libext/ext-os.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-os.obj -MD -MP -MF $(DEPDIR)/ext-os.Tpo -c -o ext-os.obj `if test -f 'el/libext/ext-os.cpp'; then $(CYGPATH_W) 'el/libext/ext-os.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-os.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-os.Tpo $(DEPDIR)/ext-os.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-os.cpp' object='ext-os.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-os.obj `if test -f 'el/libext/ext-os.cpp'; then $(CYGPATH_W) 'el/libext/ext-os.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-os.cpp'; fi` ext-app.o: el/libext/ext-app.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-app.o -MD -MP -MF $(DEPDIR)/ext-app.Tpo -c -o ext-app.o `test -f 'el/libext/ext-app.cpp' || echo '$(srcdir)/'`el/libext/ext-app.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-app.Tpo $(DEPDIR)/ext-app.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-app.cpp' object='ext-app.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-app.o `test -f 'el/libext/ext-app.cpp' || echo '$(srcdir)/'`el/libext/ext-app.cpp ext-app.obj: el/libext/ext-app.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-app.obj -MD -MP -MF $(DEPDIR)/ext-app.Tpo -c -o ext-app.obj `if test -f 'el/libext/ext-app.cpp'; then $(CYGPATH_W) 'el/libext/ext-app.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-app.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-app.Tpo $(DEPDIR)/ext-app.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-app.cpp' object='ext-app.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-app.obj `if test -f 'el/libext/ext-app.cpp'; then $(CYGPATH_W) 'el/libext/ext-app.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-app.cpp'; fi` ext-string.o: el/libext/ext-string.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-string.o -MD -MP -MF $(DEPDIR)/ext-string.Tpo -c -o ext-string.o `test -f 'el/libext/ext-string.cpp' || echo '$(srcdir)/'`el/libext/ext-string.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-string.Tpo $(DEPDIR)/ext-string.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-string.cpp' object='ext-string.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-string.o `test -f 'el/libext/ext-string.cpp' || echo '$(srcdir)/'`el/libext/ext-string.cpp ext-string.obj: el/libext/ext-string.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-string.obj -MD -MP -MF $(DEPDIR)/ext-string.Tpo -c -o ext-string.obj `if test -f 'el/libext/ext-string.cpp'; then $(CYGPATH_W) 'el/libext/ext-string.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-string.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-string.Tpo $(DEPDIR)/ext-string.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-string.cpp' object='ext-string.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-string.obj `if test -f 'el/libext/ext-string.cpp'; then $(CYGPATH_W) 'el/libext/ext-string.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-string.cpp'; fi` ext-blob.o: el/libext/ext-blob.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-blob.o -MD -MP -MF $(DEPDIR)/ext-blob.Tpo -c -o ext-blob.o `test -f 'el/libext/ext-blob.cpp' || echo '$(srcdir)/'`el/libext/ext-blob.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-blob.Tpo $(DEPDIR)/ext-blob.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-blob.cpp' object='ext-blob.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-blob.o `test -f 'el/libext/ext-blob.cpp' || echo '$(srcdir)/'`el/libext/ext-blob.cpp ext-blob.obj: el/libext/ext-blob.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-blob.obj -MD -MP -MF $(DEPDIR)/ext-blob.Tpo -c -o ext-blob.obj `if test -f 'el/libext/ext-blob.cpp'; then $(CYGPATH_W) 'el/libext/ext-blob.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-blob.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-blob.Tpo $(DEPDIR)/ext-blob.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-blob.cpp' object='ext-blob.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-blob.obj `if test -f 'el/libext/ext-blob.cpp'; then $(CYGPATH_W) 'el/libext/ext-blob.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-blob.cpp'; fi` ext-stream.o: el/libext/ext-stream.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-stream.o -MD -MP -MF $(DEPDIR)/ext-stream.Tpo -c -o ext-stream.o `test -f 'el/libext/ext-stream.cpp' || echo '$(srcdir)/'`el/libext/ext-stream.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-stream.Tpo $(DEPDIR)/ext-stream.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-stream.cpp' object='ext-stream.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-stream.o `test -f 'el/libext/ext-stream.cpp' || echo '$(srcdir)/'`el/libext/ext-stream.cpp ext-stream.obj: el/libext/ext-stream.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-stream.obj -MD -MP -MF $(DEPDIR)/ext-stream.Tpo -c -o ext-stream.obj `if test -f 'el/libext/ext-stream.cpp'; then $(CYGPATH_W) 'el/libext/ext-stream.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-stream.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-stream.Tpo $(DEPDIR)/ext-stream.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-stream.cpp' object='ext-stream.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-stream.obj `if test -f 'el/libext/ext-stream.cpp'; then $(CYGPATH_W) 'el/libext/ext-stream.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-stream.cpp'; fi` ext-core.o: el/libext/ext-core.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-core.o -MD -MP -MF $(DEPDIR)/ext-core.Tpo -c -o ext-core.o `test -f 'el/libext/ext-core.cpp' || echo '$(srcdir)/'`el/libext/ext-core.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-core.Tpo $(DEPDIR)/ext-core.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-core.cpp' object='ext-core.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-core.o `test -f 'el/libext/ext-core.cpp' || echo '$(srcdir)/'`el/libext/ext-core.cpp ext-core.obj: el/libext/ext-core.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-core.obj -MD -MP -MF $(DEPDIR)/ext-core.Tpo -c -o ext-core.obj `if test -f 'el/libext/ext-core.cpp'; then $(CYGPATH_W) 'el/libext/ext-core.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-core.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-core.Tpo $(DEPDIR)/ext-core.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-core.cpp' object='ext-core.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-core.obj `if test -f 'el/libext/ext-core.cpp'; then $(CYGPATH_W) 'el/libext/ext-core.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-core.cpp'; fi` ext-ip-address.o: el/libext/ext-ip-address.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-ip-address.o -MD -MP -MF $(DEPDIR)/ext-ip-address.Tpo -c -o ext-ip-address.o `test -f 'el/libext/ext-ip-address.cpp' || echo '$(srcdir)/'`el/libext/ext-ip-address.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-ip-address.Tpo $(DEPDIR)/ext-ip-address.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-ip-address.cpp' object='ext-ip-address.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-ip-address.o `test -f 'el/libext/ext-ip-address.cpp' || echo '$(srcdir)/'`el/libext/ext-ip-address.cpp ext-ip-address.obj: el/libext/ext-ip-address.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-ip-address.obj -MD -MP -MF $(DEPDIR)/ext-ip-address.Tpo -c -o ext-ip-address.obj `if test -f 'el/libext/ext-ip-address.cpp'; then $(CYGPATH_W) 'el/libext/ext-ip-address.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-ip-address.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-ip-address.Tpo $(DEPDIR)/ext-ip-address.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-ip-address.cpp' object='ext-ip-address.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-ip-address.obj `if test -f 'el/libext/ext-ip-address.cpp'; then $(CYGPATH_W) 'el/libext/ext-ip-address.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-ip-address.cpp'; fi` ext-net.o: el/libext/ext-net.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-net.o -MD -MP -MF $(DEPDIR)/ext-net.Tpo -c -o ext-net.o `test -f 'el/libext/ext-net.cpp' || echo '$(srcdir)/'`el/libext/ext-net.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-net.Tpo $(DEPDIR)/ext-net.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-net.cpp' object='ext-net.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-net.o `test -f 'el/libext/ext-net.cpp' || echo '$(srcdir)/'`el/libext/ext-net.cpp ext-net.obj: el/libext/ext-net.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-net.obj -MD -MP -MF $(DEPDIR)/ext-net.Tpo -c -o ext-net.obj `if test -f 'el/libext/ext-net.cpp'; then $(CYGPATH_W) 'el/libext/ext-net.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-net.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-net.Tpo $(DEPDIR)/ext-net.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-net.cpp' object='ext-net.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-net.obj `if test -f 'el/libext/ext-net.cpp'; then $(CYGPATH_W) 'el/libext/ext-net.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-net.cpp'; fi` stack-trace.o: el/libext/stack-trace.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT stack-trace.o -MD -MP -MF $(DEPDIR)/stack-trace.Tpo -c -o stack-trace.o `test -f 'el/libext/stack-trace.cpp' || echo '$(srcdir)/'`el/libext/stack-trace.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stack-trace.Tpo $(DEPDIR)/stack-trace.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/stack-trace.cpp' object='stack-trace.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o stack-trace.o `test -f 'el/libext/stack-trace.cpp' || echo '$(srcdir)/'`el/libext/stack-trace.cpp stack-trace.obj: el/libext/stack-trace.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT stack-trace.obj -MD -MP -MF $(DEPDIR)/stack-trace.Tpo -c -o stack-trace.obj `if test -f 'el/libext/stack-trace.cpp'; then $(CYGPATH_W) 'el/libext/stack-trace.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/stack-trace.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stack-trace.Tpo $(DEPDIR)/stack-trace.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/stack-trace.cpp' object='stack-trace.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o stack-trace.obj `if test -f 'el/libext/stack-trace.cpp'; then $(CYGPATH_W) 'el/libext/stack-trace.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/stack-trace.cpp'; fi` binary-reader-writer.o: el/libext/binary-reader-writer.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT binary-reader-writer.o -MD -MP -MF $(DEPDIR)/binary-reader-writer.Tpo -c -o binary-reader-writer.o `test -f 'el/libext/binary-reader-writer.cpp' || echo '$(srcdir)/'`el/libext/binary-reader-writer.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/binary-reader-writer.Tpo $(DEPDIR)/binary-reader-writer.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/binary-reader-writer.cpp' object='binary-reader-writer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o binary-reader-writer.o `test -f 'el/libext/binary-reader-writer.cpp' || echo '$(srcdir)/'`el/libext/binary-reader-writer.cpp binary-reader-writer.obj: el/libext/binary-reader-writer.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT binary-reader-writer.obj -MD -MP -MF $(DEPDIR)/binary-reader-writer.Tpo -c -o binary-reader-writer.obj `if test -f 'el/libext/binary-reader-writer.cpp'; then $(CYGPATH_W) 'el/libext/binary-reader-writer.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/binary-reader-writer.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/binary-reader-writer.Tpo $(DEPDIR)/binary-reader-writer.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/binary-reader-writer.cpp' object='binary-reader-writer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o binary-reader-writer.obj `if test -f 'el/libext/binary-reader-writer.cpp'; then $(CYGPATH_W) 'el/libext/binary-reader-writer.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/binary-reader-writer.cpp'; fi` regex.o: el/stl/regex.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT regex.o -MD -MP -MF $(DEPDIR)/regex.Tpo -c -o regex.o `test -f 'el/stl/regex.cpp' || echo '$(srcdir)/'`el/stl/regex.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/regex.Tpo $(DEPDIR)/regex.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/stl/regex.cpp' object='regex.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o regex.o `test -f 'el/stl/regex.cpp' || echo '$(srcdir)/'`el/stl/regex.cpp regex.obj: el/stl/regex.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT regex.obj -MD -MP -MF $(DEPDIR)/regex.Tpo -c -o regex.obj `if test -f 'el/stl/regex.cpp'; then $(CYGPATH_W) 'el/stl/regex.cpp'; else $(CYGPATH_W) '$(srcdir)/el/stl/regex.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/regex.Tpo $(DEPDIR)/regex.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/stl/regex.cpp' object='regex.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o regex.obj `if test -f 'el/stl/regex.cpp'; then $(CYGPATH_W) 'el/stl/regex.cpp'; else $(CYGPATH_W) '$(srcdir)/el/stl/regex.cpp'; fi` thread.o: el/stl/thread.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT thread.o -MD -MP -MF $(DEPDIR)/thread.Tpo -c -o thread.o `test -f 'el/stl/thread.cpp' || echo '$(srcdir)/'`el/stl/thread.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/thread.Tpo $(DEPDIR)/thread.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/stl/thread.cpp' object='thread.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o thread.o `test -f 'el/stl/thread.cpp' || echo '$(srcdir)/'`el/stl/thread.cpp thread.obj: el/stl/thread.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT thread.obj -MD -MP -MF $(DEPDIR)/thread.Tpo -c -o thread.obj `if test -f 'el/stl/thread.cpp'; then $(CYGPATH_W) 'el/stl/thread.cpp'; else $(CYGPATH_W) '$(srcdir)/el/stl/thread.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/thread.Tpo $(DEPDIR)/thread.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/stl/thread.cpp' object='thread.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o thread.obj `if test -f 'el/stl/thread.cpp'; then $(CYGPATH_W) 'el/stl/thread.cpp'; else $(CYGPATH_W) '$(srcdir)/el/stl/thread.cpp'; fi` stdafx.o: el/comp/stdafx.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT stdafx.o -MD -MP -MF $(DEPDIR)/stdafx.Tpo -c -o stdafx.o `test -f 'el/comp/stdafx.cpp' || echo '$(srcdir)/'`el/comp/stdafx.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stdafx.Tpo $(DEPDIR)/stdafx.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/comp/stdafx.cpp' object='stdafx.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o stdafx.o `test -f 'el/comp/stdafx.cpp' || echo '$(srcdir)/'`el/comp/stdafx.cpp stdafx.obj: el/comp/stdafx.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT stdafx.obj -MD -MP -MF $(DEPDIR)/stdafx.Tpo -c -o stdafx.obj `if test -f 'el/comp/stdafx.cpp'; then $(CYGPATH_W) 'el/comp/stdafx.cpp'; else $(CYGPATH_W) '$(srcdir)/el/comp/stdafx.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stdafx.Tpo $(DEPDIR)/stdafx.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/comp/stdafx.cpp' object='stdafx.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o stdafx.obj `if test -f 'el/comp/stdafx.cpp'; then $(CYGPATH_W) 'el/comp/stdafx.cpp'; else $(CYGPATH_W) '$(srcdir)/el/comp/stdafx.cpp'; fi` ia32-codegen.o: el/comp/ia32-codegen.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ia32-codegen.o -MD -MP -MF $(DEPDIR)/ia32-codegen.Tpo -c -o ia32-codegen.o `test -f 'el/comp/ia32-codegen.cpp' || echo '$(srcdir)/'`el/comp/ia32-codegen.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ia32-codegen.Tpo $(DEPDIR)/ia32-codegen.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/comp/ia32-codegen.cpp' object='ia32-codegen.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ia32-codegen.o `test -f 'el/comp/ia32-codegen.cpp' || echo '$(srcdir)/'`el/comp/ia32-codegen.cpp ia32-codegen.obj: el/comp/ia32-codegen.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ia32-codegen.obj -MD -MP -MF $(DEPDIR)/ia32-codegen.Tpo -c -o ia32-codegen.obj `if test -f 'el/comp/ia32-codegen.cpp'; then $(CYGPATH_W) 'el/comp/ia32-codegen.cpp'; else $(CYGPATH_W) '$(srcdir)/el/comp/ia32-codegen.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ia32-codegen.Tpo $(DEPDIR)/ia32-codegen.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/comp/ia32-codegen.cpp' object='ia32-codegen.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ia32-codegen.obj `if test -f 'el/comp/ia32-codegen.cpp'; then $(CYGPATH_W) 'el/comp/ia32-codegen.cpp'; else $(CYGPATH_W) '$(srcdir)/el/comp/ia32-codegen.cpp'; fi` static-main.o: el/elwin/static-main.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT static-main.o -MD -MP -MF $(DEPDIR)/static-main.Tpo -c -o static-main.o `test -f 'el/elwin/static-main.cpp' || echo '$(srcdir)/'`el/elwin/static-main.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/static-main.Tpo $(DEPDIR)/static-main.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/elwin/static-main.cpp' object='static-main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o static-main.o `test -f 'el/elwin/static-main.cpp' || echo '$(srcdir)/'`el/elwin/static-main.cpp static-main.obj: el/elwin/static-main.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT static-main.obj -MD -MP -MF $(DEPDIR)/static-main.Tpo -c -o static-main.obj `if test -f 'el/elwin/static-main.cpp'; then $(CYGPATH_W) 'el/elwin/static-main.cpp'; else $(CYGPATH_W) '$(srcdir)/el/elwin/static-main.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/static-main.Tpo $(DEPDIR)/static-main.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/elwin/static-main.cpp' object='static-main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o static-main.obj `if test -f 'el/elwin/static-main.cpp'; then $(CYGPATH_W) 'el/elwin/static-main.cpp'; else $(CYGPATH_W) '$(srcdir)/el/elwin/static-main.cpp'; fi` murmurhashaligned2.o: el/libext/murmurhashaligned2.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT murmurhashaligned2.o -MD -MP -MF $(DEPDIR)/murmurhashaligned2.Tpo -c -o murmurhashaligned2.o `test -f 'el/libext/murmurhashaligned2.cpp' || echo '$(srcdir)/'`el/libext/murmurhashaligned2.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/murmurhashaligned2.Tpo $(DEPDIR)/murmurhashaligned2.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/murmurhashaligned2.cpp' object='murmurhashaligned2.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o murmurhashaligned2.o `test -f 'el/libext/murmurhashaligned2.cpp' || echo '$(srcdir)/'`el/libext/murmurhashaligned2.cpp murmurhashaligned2.obj: el/libext/murmurhashaligned2.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT murmurhashaligned2.obj -MD -MP -MF $(DEPDIR)/murmurhashaligned2.Tpo -c -o murmurhashaligned2.obj `if test -f 'el/libext/murmurhashaligned2.cpp'; then $(CYGPATH_W) 'el/libext/murmurhashaligned2.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/murmurhashaligned2.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/murmurhashaligned2.Tpo $(DEPDIR)/murmurhashaligned2.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/murmurhashaligned2.cpp' object='murmurhashaligned2.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o murmurhashaligned2.obj `if test -f 'el/libext/murmurhashaligned2.cpp'; then $(CYGPATH_W) 'el/libext/murmurhashaligned2.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/murmurhashaligned2.cpp'; fi` bignum386.o: el/libext/bignum386.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bignum386.o -MD -MP -MF $(DEPDIR)/bignum386.Tpo -c -o bignum386.o `test -f 'el/libext/bignum386.cpp' || echo '$(srcdir)/'`el/libext/bignum386.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/bignum386.Tpo $(DEPDIR)/bignum386.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/bignum386.cpp' object='bignum386.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bignum386.o `test -f 'el/libext/bignum386.cpp' || echo '$(srcdir)/'`el/libext/bignum386.cpp bignum386.obj: el/libext/bignum386.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT bignum386.obj -MD -MP -MF $(DEPDIR)/bignum386.Tpo -c -o bignum386.obj `if test -f 'el/libext/bignum386.cpp'; then $(CYGPATH_W) 'el/libext/bignum386.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/bignum386.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/bignum386.Tpo $(DEPDIR)/bignum386.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/bignum386.cpp' object='bignum386.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bignum386.obj `if test -f 'el/libext/bignum386.cpp'; then $(CYGPATH_W) 'el/libext/bignum386.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/bignum386.cpp'; fi` ext-os-api.o: el/libext/ext-os-api.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-os-api.o -MD -MP -MF $(DEPDIR)/ext-os-api.Tpo -c -o ext-os-api.o `test -f 'el/libext/ext-os-api.cpp' || echo '$(srcdir)/'`el/libext/ext-os-api.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-os-api.Tpo $(DEPDIR)/ext-os-api.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-os-api.cpp' object='ext-os-api.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-os-api.o `test -f 'el/libext/ext-os-api.cpp' || echo '$(srcdir)/'`el/libext/ext-os-api.cpp ext-os-api.obj: el/libext/ext-os-api.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-os-api.obj -MD -MP -MF $(DEPDIR)/ext-os-api.Tpo -c -o ext-os-api.obj `if test -f 'el/libext/ext-os-api.cpp'; then $(CYGPATH_W) 'el/libext/ext-os-api.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-os-api.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-os-api.Tpo $(DEPDIR)/ext-os-api.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-os-api.cpp' object='ext-os-api.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-os-api.obj `if test -f 'el/libext/ext-os-api.cpp'; then $(CYGPATH_W) 'el/libext/ext-os-api.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-os-api.cpp'; fi` ext-posix.o: el/libext/ext-posix.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-posix.o -MD -MP -MF $(DEPDIR)/ext-posix.Tpo -c -o ext-posix.o `test -f 'el/libext/ext-posix.cpp' || echo '$(srcdir)/'`el/libext/ext-posix.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-posix.Tpo $(DEPDIR)/ext-posix.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-posix.cpp' object='ext-posix.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-posix.o `test -f 'el/libext/ext-posix.cpp' || echo '$(srcdir)/'`el/libext/ext-posix.cpp ext-posix.obj: el/libext/ext-posix.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-posix.obj -MD -MP -MF $(DEPDIR)/ext-posix.Tpo -c -o ext-posix.obj `if test -f 'el/libext/ext-posix.cpp'; then $(CYGPATH_W) 'el/libext/ext-posix.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-posix.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-posix.Tpo $(DEPDIR)/ext-posix.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/ext-posix.cpp' object='ext-posix.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-posix.obj `if test -f 'el/libext/ext-posix.cpp'; then $(CYGPATH_W) 'el/libext/ext-posix.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/ext-posix.cpp'; fi` com-module.o: el/libext/win32/com-module.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT com-module.o -MD -MP -MF $(DEPDIR)/com-module.Tpo -c -o com-module.o `test -f 'el/libext/win32/com-module.cpp' || echo '$(srcdir)/'`el/libext/win32/com-module.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/com-module.Tpo $(DEPDIR)/com-module.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/com-module.cpp' object='com-module.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o com-module.o `test -f 'el/libext/win32/com-module.cpp' || echo '$(srcdir)/'`el/libext/win32/com-module.cpp com-module.obj: el/libext/win32/com-module.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT com-module.obj -MD -MP -MF $(DEPDIR)/com-module.Tpo -c -o com-module.obj `if test -f 'el/libext/win32/com-module.cpp'; then $(CYGPATH_W) 'el/libext/win32/com-module.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/com-module.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/com-module.Tpo $(DEPDIR)/com-module.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/com-module.cpp' object='com-module.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o com-module.obj `if test -f 'el/libext/win32/com-module.cpp'; then $(CYGPATH_W) 'el/libext/win32/com-module.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/com-module.cpp'; fi` ext-com.o: el/libext/win32/ext-com.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-com.o -MD -MP -MF $(DEPDIR)/ext-com.Tpo -c -o ext-com.o `test -f 'el/libext/win32/ext-com.cpp' || echo '$(srcdir)/'`el/libext/win32/ext-com.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-com.Tpo $(DEPDIR)/ext-com.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/ext-com.cpp' object='ext-com.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-com.o `test -f 'el/libext/win32/ext-com.cpp' || echo '$(srcdir)/'`el/libext/win32/ext-com.cpp ext-com.obj: el/libext/win32/ext-com.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-com.obj -MD -MP -MF $(DEPDIR)/ext-com.Tpo -c -o ext-com.obj `if test -f 'el/libext/win32/ext-com.cpp'; then $(CYGPATH_W) 'el/libext/win32/ext-com.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/ext-com.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-com.Tpo $(DEPDIR)/ext-com.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/ext-com.cpp' object='ext-com.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-com.obj `if test -f 'el/libext/win32/ext-com.cpp'; then $(CYGPATH_W) 'el/libext/win32/ext-com.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/ext-com.cpp'; fi` ext-registry.o: el/libext/win32/ext-registry.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-registry.o -MD -MP -MF $(DEPDIR)/ext-registry.Tpo -c -o ext-registry.o `test -f 'el/libext/win32/ext-registry.cpp' || echo '$(srcdir)/'`el/libext/win32/ext-registry.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-registry.Tpo $(DEPDIR)/ext-registry.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/ext-registry.cpp' object='ext-registry.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-registry.o `test -f 'el/libext/win32/ext-registry.cpp' || echo '$(srcdir)/'`el/libext/win32/ext-registry.cpp ext-registry.obj: el/libext/win32/ext-registry.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-registry.obj -MD -MP -MF $(DEPDIR)/ext-registry.Tpo -c -o ext-registry.obj `if test -f 'el/libext/win32/ext-registry.cpp'; then $(CYGPATH_W) 'el/libext/win32/ext-registry.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/ext-registry.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-registry.Tpo $(DEPDIR)/ext-registry.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/ext-registry.cpp' object='ext-registry.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-registry.obj `if test -f 'el/libext/win32/ext-registry.cpp'; then $(CYGPATH_W) 'el/libext/win32/ext-registry.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/ext-registry.cpp'; fi` ext-win.o: el/libext/win32/ext-win.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-win.o -MD -MP -MF $(DEPDIR)/ext-win.Tpo -c -o ext-win.o `test -f 'el/libext/win32/ext-win.cpp' || echo '$(srcdir)/'`el/libext/win32/ext-win.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-win.Tpo $(DEPDIR)/ext-win.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/ext-win.cpp' object='ext-win.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-win.o `test -f 'el/libext/win32/ext-win.cpp' || echo '$(srcdir)/'`el/libext/win32/ext-win.cpp ext-win.obj: el/libext/win32/ext-win.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext-win.obj -MD -MP -MF $(DEPDIR)/ext-win.Tpo -c -o ext-win.obj `if test -f 'el/libext/win32/ext-win.cpp'; then $(CYGPATH_W) 'el/libext/win32/ext-win.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/ext-win.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext-win.Tpo $(DEPDIR)/ext-win.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/ext-win.cpp' object='ext-win.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext-win.obj `if test -f 'el/libext/win32/ext-win.cpp'; then $(CYGPATH_W) 'el/libext/win32/ext-win.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/ext-win.cpp'; fi` excom.o: el/libext/win32/excom.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT excom.o -MD -MP -MF $(DEPDIR)/excom.Tpo -c -o excom.o `test -f 'el/libext/win32/excom.cpp' || echo '$(srcdir)/'`el/libext/win32/excom.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/excom.Tpo $(DEPDIR)/excom.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/excom.cpp' object='excom.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o excom.o `test -f 'el/libext/win32/excom.cpp' || echo '$(srcdir)/'`el/libext/win32/excom.cpp excom.obj: el/libext/win32/excom.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT excom.obj -MD -MP -MF $(DEPDIR)/excom.Tpo -c -o excom.obj `if test -f 'el/libext/win32/excom.cpp'; then $(CYGPATH_W) 'el/libext/win32/excom.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/excom.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/excom.Tpo $(DEPDIR)/excom.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/excom.cpp' object='excom.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o excom.obj `if test -f 'el/libext/win32/excom.cpp'; then $(CYGPATH_W) 'el/libext/win32/excom.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/excom.cpp'; fi` ext2.o: el/libext/win32/ext2.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext2.o -MD -MP -MF $(DEPDIR)/ext2.Tpo -c -o ext2.o `test -f 'el/libext/win32/ext2.cpp' || echo '$(srcdir)/'`el/libext/win32/ext2.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext2.Tpo $(DEPDIR)/ext2.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/ext2.cpp' object='ext2.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext2.o `test -f 'el/libext/win32/ext2.cpp' || echo '$(srcdir)/'`el/libext/win32/ext2.cpp ext2.obj: el/libext/win32/ext2.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ext2.obj -MD -MP -MF $(DEPDIR)/ext2.Tpo -c -o ext2.obj `if test -f 'el/libext/win32/ext2.cpp'; then $(CYGPATH_W) 'el/libext/win32/ext2.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/ext2.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ext2.Tpo $(DEPDIR)/ext2.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/ext2.cpp' object='ext2.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ext2.obj `if test -f 'el/libext/win32/ext2.cpp'; then $(CYGPATH_W) 'el/libext/win32/ext2.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/ext2.cpp'; fi` getopt.o: el/libext/win32/getopt.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT getopt.o -MD -MP -MF $(DEPDIR)/getopt.Tpo -c -o getopt.o `test -f 'el/libext/win32/getopt.cpp' || echo '$(srcdir)/'`el/libext/win32/getopt.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/getopt.Tpo $(DEPDIR)/getopt.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/getopt.cpp' object='getopt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o getopt.o `test -f 'el/libext/win32/getopt.cpp' || echo '$(srcdir)/'`el/libext/win32/getopt.cpp getopt.obj: el/libext/win32/getopt.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT getopt.obj -MD -MP -MF $(DEPDIR)/getopt.Tpo -c -o getopt.obj `if test -f 'el/libext/win32/getopt.cpp'; then $(CYGPATH_W) 'el/libext/win32/getopt.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/getopt.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/getopt.Tpo $(DEPDIR)/getopt.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='el/libext/win32/getopt.cpp' object='getopt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o getopt.obj `if test -f 'el/libext/win32/getopt.cpp'; then $(CYGPATH_W) 'el/libext/win32/getopt.cpp'; else $(CYGPATH_W) '$(srcdir)/el/libext/win32/getopt.cpp'; fi` lisp386.o: src/lispeng/lisp386.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lisp386.o -MD -MP -MF $(DEPDIR)/lisp386.Tpo -c -o lisp386.o `test -f 'src/lispeng/lisp386.cpp' || echo '$(srcdir)/'`src/lispeng/lisp386.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/lisp386.Tpo $(DEPDIR)/lisp386.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/lisp386.cpp' object='lisp386.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lisp386.o `test -f 'src/lispeng/lisp386.cpp' || echo '$(srcdir)/'`src/lispeng/lisp386.cpp lisp386.obj: src/lispeng/lisp386.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lisp386.obj -MD -MP -MF $(DEPDIR)/lisp386.Tpo -c -o lisp386.obj `if test -f 'src/lispeng/lisp386.cpp'; then $(CYGPATH_W) 'src/lispeng/lisp386.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/lisp386.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/lisp386.Tpo $(DEPDIR)/lisp386.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/lisp386.cpp' object='lisp386.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lisp386.obj `if test -f 'src/lispeng/lisp386.cpp'; then $(CYGPATH_W) 'src/lispeng/lisp386.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/lisp386.cpp'; fi` lispeng.o: src/lispeng/lispeng.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lispeng.o -MD -MP -MF $(DEPDIR)/lispeng.Tpo -c -o lispeng.o `test -f 'src/lispeng/lispeng.cpp' || echo '$(srcdir)/'`src/lispeng/lispeng.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/lispeng.Tpo $(DEPDIR)/lispeng.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/lispeng.cpp' object='lispeng.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lispeng.o `test -f 'src/lispeng/lispeng.cpp' || echo '$(srcdir)/'`src/lispeng/lispeng.cpp lispeng.obj: src/lispeng/lispeng.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lispeng.obj -MD -MP -MF $(DEPDIR)/lispeng.Tpo -c -o lispeng.obj `if test -f 'src/lispeng/lispeng.cpp'; then $(CYGPATH_W) 'src/lispeng/lispeng.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/lispeng.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/lispeng.Tpo $(DEPDIR)/lispeng.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispeng/lispeng.cpp' object='lispeng.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lispeng.obj `if test -f 'src/lispeng/lispeng.cpp'; then $(CYGPATH_W) 'src/lispeng/lispeng.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispeng/lispeng.cpp'; fi` lispdev.o: src/lispdev/lispdev.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lispdev.o -MD -MP -MF $(DEPDIR)/lispdev.Tpo -c -o lispdev.o `test -f 'src/lispdev/lispdev.cpp' || echo '$(srcdir)/'`src/lispdev/lispdev.cpp @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/lispdev.Tpo $(DEPDIR)/lispdev.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispdev/lispdev.cpp' object='lispdev.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lispdev.o `test -f 'src/lispdev/lispdev.cpp' || echo '$(srcdir)/'`src/lispdev/lispdev.cpp lispdev.obj: src/lispdev/lispdev.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lispdev.obj -MD -MP -MF $(DEPDIR)/lispdev.Tpo -c -o lispdev.obj `if test -f 'src/lispdev/lispdev.cpp'; then $(CYGPATH_W) 'src/lispdev/lispdev.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispdev/lispdev.cpp'; fi` @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/lispdev.Tpo $(DEPDIR)/lispdev.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/lispdev/lispdev.cpp' object='lispdev.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lispdev.obj `if test -f 'src/lispdev/lispdev.cpp'; then $(CYGPATH_W) 'src/lispdev/lispdev.cpp'; else $(CYGPATH_W) '$(srcdir)/src/lispdev/lispdev.cpp'; fi` install-bindataDATA: $(bindata_DATA) @$(NORMAL_INSTALL) test -z "$(bindatadir)" || $(MKDIR_P) "$(DESTDIR)$(bindatadir)" @list='$(bindata_DATA)'; test -n "$(bindatadir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(bindatadir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(bindatadir)" || exit $$?; \ done uninstall-bindataDATA: @$(NORMAL_UNINSTALL) @list='$(bindata_DATA)'; test -n "$(bindatadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(bindatadir)'; $(am__uninstall_files_from_dir) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(PROGRAMS) $(DATA) config.h installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindatadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-bindataDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-bindataDATA .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-compile \ distclean-generic distclean-hdr distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-binPROGRAMS \ install-bindataDATA install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-bindataDATA el/ext.h.gch: el/ext.h $(CXXCOMPILE) $(CXXFLAGS) -x c++-header $< ext_messages.msg ext_messages.h : el/libext/ext_messages.mc perl mc2msg.pl -h . $< lispmsg.msg lispmsg.h : lispeng/lispmsg.mc perl mc2msg.pl -h . $< lisp.cat : ext_messages.msg lispmsg.msg gencat --new -o $@ $^ el/stl/% : el/stl/% echo "---" compiler.fas : clisp/compiler.lisp $(L) -b -c $< -o $@ comp1.bls : src/code/init.lisp compiler.fas $(L) -b --lp . -D LOAD_COMPILER_FAS -o $@ src/code/empty ./ init.bls : f1/ f2/ comp2.bls \ f2/backquote.fas f2/defs2.fas f2/loop.fas \ f2/clos.fas f2/clos-slots1.fas f2/clos-method1.fas f2/clos-methcomb1.fas \ f2/clos-genfun1.fas f2/clos-genfun2a.fas f2/clos-methcomb2.fas f2/clos-genfun2b.fas \ f2/clos-method2.fas f2/clos-genfun3.fas f2/clos-dependent.fas f2/clos-genfun4.fas \ f2/clos-method3.fas f2/clos-methcomb3.fas f2/clos-slots2.fas f2/clos-slotdef2.fas \ f2/clos-stablehash2.fas f2/clos-specializer2.fas f2/clos-class4.fas f2/clos-class5.fas \ f2/clos-slotdef3.fas f2/clos-specializer3.fas f2/clos-class6.fas f2/clos-method4.fas \ f2/clos-methcomb4.fas f2/clos-genfun5.fas f2/clos-print.fas f2/clos-custom.fas \ f2/documentation.fas f2/gray.fas f2/fill-out.fas f2/disassem.fas \ f2/condition.fas f2/loadform.fas f2/pprint.fas f2/runprog.fas \ f2/describe.fas f2/reploop.fas $(L) -b --lp . --lp f1/ --lp f2/ -i ./ src/code/empty comp2.bls : comp1.bls \ f1/macro.fas f1/explambda.fas f1/seq.fas f1/sort.fas f1/print-builtin.fas f1/init.fas \ f1/cl.fas f1/pathname.fas f1/macros.fas f1/break.fas f1/string.fas \ f1/reader.fas f1/math.fas f1/uclos.fas f1/print.fas \ f1/macros1.fas f1/macros2.fas f1/byte.fas f1/clisp.fas f1/clos-class3.fas \ f1/defmacro.fas f1/defs1.fas \ f1/lambdalist.fas f1/places.fas f1/defpackage.fas \ f1/type.fas f1/subtypep.fas \ f1/clos-package.fas f1/clos-macros.fas f1/clos-class0.fas f1/clos-metaobject1.fas \ f1/clos-slotdef1.fas f1/clos-stablehash1.fas f1/clos-specializer1.fas f1/clos-class1.fas \ f1/clos-class2.fas f1/defstruct.fas f1/format.fas f1/functions.fas \ f1/international.fas f1/cmacros.fas $(L) -b --lp . --lp f1/ -i ./ -o $@ src/code/empty f1/ f2/ : mkdir -p $@ f1/%.lib f1/%.fas : src/code/%.lisp $(L0) $< -o $@ f1/%.lib f1/%.fas : clisp/%.lisp $(L0) $< -o $@ f2/%.lib f2/%.fas : clisp/%.lisp $(L2) $< -o $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT:
165,822
Common Lisp
.l
1,934
83.831954
405
0.686278
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
c556ae3238fd923e12f3e34c00a805dea0c58420a9a8b32102ac6d16368fca24
11,447
[ -1 ]
11,448
install-sh
ufasoft_lisp/install-sh
#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End:
13,663
Common Lisp
.l
449
26.314031
84
0.621395
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
50a26adf65838058cffd2bba7cc82a905cc356304a8a4df496b8569c5f3633a2
11,448
[ -1 ]
11,514
lisp.vcxproj.filters
ufasoft_lisp/src/lisp/lispeng/lisp.vcxproj.filters
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="Resource Files"> <UniqueIdentifier>{e003102c-8c9a-4b16-b57d-0f0988fec500}</UniqueIdentifier> <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions> </Filter> <Filter Include="Comp"> <UniqueIdentifier>{58d3fcd2-0fbf-4727-909d-a1144c90bbb1}</UniqueIdentifier> </Filter> <Filter Include="Comp\inc"> <UniqueIdentifier>{b5b416ef-3761-4623-a839-7655d2f3230d}</UniqueIdentifier> </Filter> <Filter Include="Header Files"> <UniqueIdentifier>{9c25bfdf-fd75-4161-aa0b-89233750b539}</UniqueIdentifier> <Extensions>h;hpp;hxx;hm;inl</Extensions> </Filter> <Filter Include="Source Files"> <UniqueIdentifier>{d6cdaa7a-c161-4158-af4e-311948242aa2}</UniqueIdentifier> <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> </Filter> <Filter Include="x86"> <UniqueIdentifier>{67863722-4e30-43b0-afec-c5ebb50897ac}</UniqueIdentifier> </Filter> <Filter Include="Console"> <UniqueIdentifier>{4c62a7c8-1c0d-4cdd-871a-7e6fa6682d98}</UniqueIdentifier> </Filter> <Filter Include="Source Files\libext"> <UniqueIdentifier>{7fb776cc-2c95-4cb0-b492-31a0bd11f3c0}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> <None Include="LispEng.def"> <Filter>Resource Files</Filter> </None> <None Include="..\..\el\comp\x86x64.inc"> <Filter>Comp\inc</Filter> </None> <None Include="LispEng.tlb" /> </ItemGroup> <ItemGroup> <Midl Include="LispEng.idl"> <Filter>Resource Files</Filter> </Midl> </ItemGroup> <ItemGroup> <ResourceCompile Include="lispeng.rc"> <Filter>Resource Files</Filter> </ResourceCompile> </ItemGroup> <ItemGroup> <Msg_Compiler Include="lispmsg.mc"> <Filter>Resource Files</Filter> </Msg_Compiler> <Msg_Compiler Include="..\..\el\libext\ext_messages.mc"> <Filter>Resource Files</Filter> </Msg_Compiler> </ItemGroup> <ItemGroup> <ClCompile Include="..\..\El\Comp\stdafx.cpp"> <Filter>Comp</Filter> </ClCompile> <ClCompile Include="..\..\el\comp\BigNum386.cpp"> <Filter>Comp\inc</Filter> </ClCompile> <ClCompile Include="backquote.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="clos.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="Data.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="debug.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="Debugger.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="Eval.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="f_array.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="F_Character.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="F_Environment.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="F_File.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="F_Hashtable.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="f_list.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="F_Number.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="F_Package.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="F_Pathname.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="F_Seq.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="F_Stream.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="ffi.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="Functions.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="Lisp.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="LispEng.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="ListUtil.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="macros.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="MemImage.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="pretty-printer.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="printer.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="reader.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="SpecialOperators.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="Svalue.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="Vm.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="lisp386.cpp"> <Filter>x86</Filter> </ClCompile> <ClCompile Include="..\console\lisper.cpp"> <Filter>Console</Filter> </ClCompile> <ClCompile Include="..\..\el\elwin\static-main.cpp"> <Filter>Console</Filter> </ClCompile> <ClCompile Include="..\..\el\comp\ia32-codegen.cpp"> <Filter>Comp</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\binary-reader-writer.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-ip-address.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\stack-trace.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\win32\com-module.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\win32\extole.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\win32\extwin32.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\EL\libext\bignum.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\datetime.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\win32\ExCom.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-app.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\EL\libext\ext-os-api.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-os.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\win32\ext-win.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\win32\ext2.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\win32\getopt.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\threader.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\EL\libext\bignum386.cpp"> <Filter>Source Files</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-base.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-blob.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\win32\ext-com.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-core.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-encoding.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-file.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-fw.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-err.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\dl.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-string.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-stream.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\win32\ext-registry.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-posix.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-net.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> <ClCompile Include="..\..\el\libext\ext-handlers.cpp"> <Filter>Source Files\libext</Filter> </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include=".\file_config.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="fundef.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="gc.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="Lisp.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="lisp_itf.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="LispEng.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="params.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="Resource.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="symdef.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="prj_config.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="typedef.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="..\..\el\libext\ext-thread.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="..\..\el\libext\vc-warnings.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="..\..\el\libext\ExCom.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="..\..\EL\libext\ext-cpp.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="..\..\el\libext\ext-hash.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="..\..\el\libext\extstl.h"> <Filter>Header Files</Filter> </ClInclude> </ItemGroup> <ItemGroup> <MASM Include="..\..\el\bignum\x86x64\bignum-x86x64.asm" /> </ItemGroup> </Project>
11,174
Common Lisp
.l
321
28.308411
89
0.635333
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
39ac837fc866e7f4c45c25ba7172e8b0ff399a8836f8c39271f2847209da5779
11,514
[ -1 ]
11,515
tlb.rc
ufasoft_lisp/src/lisp/lispeng/tlb.rc
#ifndef NO_TLB #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #pragma code_page(1251) ///////////////////////////////////////////////////////////////////////////// // // TYPELIB // 1 TYPELIB "inc/LispEng.tlb" #endif // Neutral resources #endif
348
Common Lisp
.l
11
29.272727
78
0.468468
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
84216a26af3b758fdd1e67ddec53405514409bfb9db5d91bbb8eb14125575710
11,515
[ -1 ]
11,516
clos.cpp
ufasoft_lisp/src/lisp/lispeng/clos.cpp
#include <el/ext.h> #include "lispeng.h" namespace Lisp { void CLispEng::F_FuncallableInstanceP() { m_r = FromBool(FuncallableInstanceP(Pop())); } bool CLispEng::InstanceP(CP p) { return Type(p)==TS_OBJECT || FuncallableInstanceP(p); } bool CLispEng::InstanceOf(CP p, CP c) { return InstanceP(p) && GetHash(c, TheClass(TheClassVersion(TheInstance(p).ClassVersion).NewestClass).AllSuperclasses); } void CLispEng::F_StdInstanceP() { m_r = FromBool(InstanceP(Pop())); } void CLispEng::F_FunctionP() { switch (Type(Pop())) { case TS_INTFUNC: case TS_CCLOSURE: case TS_SUBR: m_r = V_T; } } void CLispEng::F_CompiledFunctionP() { switch (Type(SV)) { case TS_CCLOSURE: if (FuncallableInstanceP(SV)) break; case TS_SUBR: m_r = V_T; } SkipStack(1); } bool CLispEng::SomeClassP(CP p, CLispSymbol ls) { if (!InstanceP(p)) return false; CP cv = TheInstance(p).ClassVersion; if (cv==Spec(L_S_CLASS_VERSION_STANDARD_CLASS) || cv==Spec(L_S_CLASS_VERSION_STRUCTURE_CLASS) || cv==Spec(L_S_CLASS_BUILT_IN_STANDARD_CLASS)) return true; CP cl = TheClassVersion(cv).NewestClass; CP r = GetHash(get_Special(ls), TheClass(cl).AllSuperclasses); m_r = 0; return r; } void CLispEng::F_PotentialClassP() { m_r = FromBool(SomeClassP(Pop(), ENUM_L_S_CLASS_POTENTIAL_CLASS)); } bool CLispEng::DefinedClassP(CP p) { return SomeClassP(p, ENUM_L_S_CLASS_DEFINED_CLASS); } void CLispEng::F_DefinedClassP() { m_r = FromBool(DefinedClassP(Pop())); } void CLispEng::F_StructureObjectP() { m_r = FromBool(Type(Pop()) == TS_STRUCT); } void CLispEng::F_StructureTypeP() { CP st = Pop(), typ = Pop(); if (Type(st) == TS_STRUCT) m_r = FromBool(Memq(typ, TheStruct(st).Types)); } void CLispEng::F_CopyStructure() { ToStruct(SV); size_t len = AsArray(SV)->DataLength; CArrayValue *av = CreateVector(len); memcpy(av->m_pData, AsArray(SV)->m_pData, len*sizeof(CP)); m_r = FromSValueT(av, TS_STRUCT); TheStruct(m_r).Types = TheStruct(SV).Types; SkipStack(1); } CP& CLispEng::GetStructRef() { size_t idx = AsPositive(Pop()); CStructInst *st = ToStruct(Pop()); if (!Memq(Pop(), st->Types)) E_Error(); CArrayValue *av = (CArrayValue*)st; if (!idx || idx-1>=av->DataLength) E_Error(); return av->m_pData[idx-1]; } void CLispEng::F_StructureRef() { m_r = GetStructRef(); } void CLispEng::F_StructureStore() { m_r = Pop(); GetStructRef() = m_r; } void CLispEng::F_ClosureP() { m_r = FromBool(ClosureP(Pop())); } pair<CP, CP> CLispEng::GetFunctionName(CP fun) { switch (Type(fun)) { case TS_INTFUNC: return pair<CP, CP>(CreateChar('C'), AsIntFunc(fun)->m_name); case TS_CCLOSURE: { CClosure& c = TheClosure(fun); return pair<CP, CP>(CreateChar('c'), AsArray(fun)->m_flags & FLAG_CLOSURE_INSTANCE ? c.Consts[1] : c.NameOrClassVersion); } case TS_SUBR: Push(CreateInteger(int(AsIndex(fun) & 0x1FF))); F_FunTabRef(); return pair<CP, CP>(CreateChar('S'), m_r); default: E_Error(); } } CP& CLispEng::ClosureName() { CP p = Pop(); switch (Type(p)) { case TS_INTFUNC: return AsIntFunc(p)->m_name; default: #ifdef _DEBUG//!!!D Disassemble(cerr, CurClosure); #endif E_Error(); case TS_CCLOSURE: CClosure& c = TheClosure(p); return AsArray(p)->m_flags & FLAG_CLOSURE_INSTANCE ? c.Consts[1] : c.NameOrClassVersion; } } void CLispEng::F_ClosureName() { m_r = ClosureName(); } void CLispEng::F_SetfClosureName() { CP& place = ClosureName(); m_r = place = Pop(); } void CLispEng::F_RecordRef() { size_t idx = AsPositive(Pop()); CP p = Pop(), *data; switch (Type(p)) { case TS_OBJECT: case TS_STRUCT: { if (!idx) { m_r = TheInstance(p).ClassVersion; return; } idx--; CArrayValue *av = AsArray(p); if (idx >= av->DataLength) E_Error(); data = av->m_pData; } break; //!!! case TS_MACRO: case TS_INTFUNC: m_r = AsIntFunc(p)->GetField(idx); return; case TS_SYMBOLMACRO: case TS_GLOBALSYMBOLMACRO: if (idx != 0) E_Error(); m_r = ToSymbolMacro(p)->m_macro; return; case TS_CCLOSURE: { CClosure& c = TheClosure(p); switch (idx) { case 0: m_r = c.NameOrClassVersion; return; case 1: m_r = c.CodeVec; return; } idx -= 2; CArrayValue *av = AsArray(p); if (idx >= av->DataLength) { #ifdef _DEBUG//!!!D idx = idx; #else E_Error(); #endif } data = av->m_pData; } break; default: E_Error(); } m_r = data[idx]; } /*!!! void CLispEng::SetCodevecFromList(CP closure, CP p) { Push(closure, p); CArrayValue *vec = CreateVector(Length(p)*8, ELTYPE_BIT); AsClosure(SV1)->m_codevec = FromSValue(vec); byte *pb = (byte*)vec->m_pData; for (CP q; SplitPair(p, q);) *pb++ = (byte)AsNumber(q); SkipStack(2); } */ void CLispEng::F_RecordStore() { CP val = Pop(); size_t idx = AsPositive(Pop()); //!!! if (idx > 19) //!!! E_Error(); //!!! CP p = Pop(), *data; switch (Type(p)) { case TS_STRUCT: case TS_OBJECT: if (!idx) data = &TheInstance(p).ClassVersion; else { idx--; CArrayValue *av = AsArray(p); if (idx >= av->DataLength) E_Error(); data = (CP*)av->m_pData; } break; case TS_INTFUNC: data = (CP*)ToIntFunc(p); break; case TS_CCLOSURE: { CClosure& c = TheClosure(p); switch (idx) { case 0: E_Error(); case 1: c.CodeVec = val; return; } data = ((CArrayValue*)&c)->m_pData; idx -= 2; } break; default: E_Error(); } data[idx] = val; } void CLispEng::F_RecordLength() { CP p = Pop(); size_t headerLen = 1; switch (Type(p)) { case TS_CCLOSURE: headerLen = 2; case TS_OBJECT: case TS_STRUCT: break; default: E_Error(); } m_r = CreateFixnum(headerLen+AsArray(p)->DataLength); } void CLispEng::F_ClosureConsts() { CArrayValue *vec = (CArrayValue*)ToCClosure(SV); size_t len = vec->DataLength; CP *data = vec->m_pData; { CListConstructor lc; for (size_t i=0; i<len; i++) lc.Add(data[i]); m_r = lc; } SkipStack(1); } void CLispEng::F_ClosureConst() { CArrayValue *vec = (CArrayValue*)ToCClosure(SV1); size_t idx = AsPositive(SV); if (idx >= vec->DataLength) E_Error(); m_r = vec->m_pData[idx]; SkipStack(2); } void CLispEng::F_SetClosureConst() { CArrayValue *vec = (CArrayValue*)ToCClosure(SV1); size_t idx = AsPositive(SV); if (idx >= vec->DataLength) E_Error(); m_r = vec->m_pData[idx] = SV2; SkipStack(3); } void CLispEng::F_ClosureCodevec() { m_r = ToCClosure(Pop())->CodeVec; } void CLispEng::F_ClosureSetDocumentation() { ToCClosure(SV1); //!!!TODO SkipStack(2); } void CLispEng::F_GenericFunctionP() { bool b = false; switch (Type(SV)) { case TS_INTFUNC: b = AsIntFunc(SV)->m_bGeneric; break; case TS_CCLOSURE: b = TheClosure(SV).IsGeneric; break; } m_r = FromBool(b); SkipStack(1); } void CLispEng::F_SetFuncallableInstanceFunction() { CP clos = SV1; if (!FuncallableInstanceP(clos)) E_Error(); CP codevec, venv; switch (Type(SV)) { case TS_CCLOSURE: if (AsArray(SV)->DataLength <= 1) { codevec = TheClosure(SV).CodeVec; venv = AsArray(SV)->DataLength==1 ? TheClosure(SV).VEnv : 0; break; } case TS_INTFUNC: case TS_SUBR: Call(S(L_MAKE_TRAMPOLINE), SV); codevec = m_r; venv = SV; break; default: E_Error(); } TheClosure(clos).CodeVec = codevec; TheClosure(m_r=clos).VEnv = venv; SkipStack(2); } void CLispEng::F_CopyGenericFunction() { Push(SV); F_GenericFunctionP(); if (!m_r) E_Error(); CP nvenv = CopyVector(ToCClosure(SV)->VEnv); AsArray(nvenv)->SetElement(0, SV1); SV1 = nvenv; CClosure *c = CopyClosure(Pop()); c->VEnv = Pop(); m_r = FromSValueT(c, TS_CCLOSURE); } void CLispEng::F_GenericFunctionEffectiveMethodFunction() { if (!ToCClosure(SV)->IsGeneric) E_Error(); m_r = FromSValueT(CopyClosure(SV), TS_CCLOSURE); CP vec = CopyVector(TheClosure(SV).CodeVec); TheClosure(m_r).CodeVec = vec; TheClosure(m_r).get_Header().m_flags |= 8; } void CLispEng::InitStdInstance(size_t len) { if (len < 1) E_Error(); CArrayValue *av = CreateVector(len-1); ((CInstance*)av)->ClassVersion = Pop(); FillMem(av->m_pData, len-1, V_U); m_r = FromSValueT(av, TS_OBJECT); } void CLispEng::F_AllocateStdInstance() { size_t len = AsPositive(Pop()); if (!DefinedClassP(SV)) E_Error(); CClass& cl = TheClass(SV); cl.Instantiated = V_T; SV = cl.CurrentVersion; InitStdInstance(len); } void CLispEng::F_AllocateMetaobjectInstance() { size_t len = AsPositive(Pop()); if (ToVector(SV)->GetVectorLength()*sizeof(CP) != sizeof(CClassVersion)) E_Error(); InitStdInstance(len); } void CLispEng::F_AllocateFuncallableInstance() { size_t len = AsPositive(Pop()); if (len < 4) E_Error(); if (!DefinedClassP(SV)) E_Error(); CClosure *c = CreateClosure(len-2); CClass& cl = TheClass(Pop()); cl.Instantiated = V_T; ((CArrayValue*)c)->m_flags |= FLAG_CLOSURE_INSTANCE; c->NameOrClassVersion = cl.CurrentVersion; c->CodeVec = Spec(L_S_ENDLESS_LOOP_CODE); c->VEnv = 0; FillMem(c->Consts+1, len-3, V_U); m_r = FromSValueT(c, TS_CCLOSURE); } void CLispEng::F_MakeStructure() { CArrayValue *av = CreateVector(AsNumber(Pop())-1); ((CStructInst*)av)->Types = Pop(); m_r = FromSValueT(av, TS_STRUCT); } void CLispEng::AllocateInstance(CP clas) { CClass& cl = TheClass(clas); if (!ConsP(cl.CurrentVersion)) { Push(clas); if (cl.Initialized != V_6) { Call(S(L_FINALIZE_INHERITANCE), clas); ASSERT(cl.Initialized == V_6); } Push(cl.InstanceSize); cl.FuncallableP ? F_AllocateFuncallableInstance() : F_AllocateStdInstance(); } else { Push(cl.CurrentVersion, cl.InstanceSize); F_MakeStructure(); FillMem(AsArray(m_r)->m_pData, AsArray(m_r)->DataLength, V_U); //!!! was V_US } } void CLispEng::CheckInitArgList(size_t nArgs) { if (nArgs & 1) E_Error(); while (nArgs) { nArgs -= 2; CP key = m_pStack[nArgs+1]; if (key && Type(key)!=TS_SYMBOL) E_ProgramErr(); } } void CLispEng::F_PAllocateInstance(size_t nArgs) { CheckInitArgList(nArgs); m_pStack += nArgs; AllocateInstance(Pop()); } void CLispEng::KeywordTest(CP *pStack, size_t nArgs, CP vk) { if (vk == V_T) return; for (int i=0; i<(int)nArgs; i+=2) if (pStack[-i-1] == S(L_K_ALLOW_OTHER_KEYS)) if (pStack[-i-2]) return; else break; for (int i=0; i<(int)nArgs; i+=2) { CP key = pStack[-i-1]; ToSymbol(key); if (key!=S(L_K_ALLOW_OTHER_KEYS) && !Memq(key, vk)) E_Error(); } } void CLispEng::F_PMakeInstance(size_t nArgs) { if (nArgs & 1) E_ProgramErr(IDS_E_KeywordArgsNoPairwise, Listof(nArgs)); CP *pStack = m_pStack+nArgs; CP clas = pStack[0]; if (Type(clas) != TS_OBJECT) E_TypeErr(clas, 0); //!!! if (TheClass(clas).Initialized != V_6) { Call(S(L_FINALIZE_INHERITANCE), clas); ASSERT(TheClass(clas).Initialized == V_6); } for (CP defIA=TheClass(clas).DefaultInitargs, car; SplitPair(defIA, car);) { CP key = Car(car); for (int i=0; i<(int)nArgs; i+=2) if (pStack[-i-1] == key) goto LAB_FOUND; Push(key); { CP init = Car(Cdr(Cdr(car))); if (ClosureP(init)) { CClosure& c = TheClosure(init); if (c.NameOrClassVersion==S(L_CONSTANT_INITFUNCTION) && c.CodeVec==Spec(L_S_CONSTANT_INITFUNCTION_CODE)) { Push(AsArray(init)->GetElement(0)); goto LAB_NEXT; } } Funcall(init, 0); } Push(m_r); LAB_NEXT: nArgs += 2; LAB_FOUND: ; } if (CP info = GetHash(clas, Spec(L_S_MAKE_INSTANCE_TABLE))) { KeywordTest(pStack, nArgs, ToVector(info)->GetElement(0)); Push(clas); for (int i=0; i<(int)nArgs; i++) Push(pStack[-1-i]); Funcall(ToVector(info)->GetElement(1), nArgs+1); if (ClassOf(m_r) != clas) E_Error(); pStack[0] = m_r; Push(m_r); memmove(m_pStack, m_pStack+1, nArgs*sizeof(CP)); pStack[-1] = m_r; Funcall(ToVector(info)->GetElement(2), 1+nArgs); m_r = Pop(); } else Funcall(S(L_INITIAL_MAKE_INSTANCE), 1+nArgs); } void CLispEng::UpdateInstance(CP p) { #ifdef _DEBUG//!!!D E_Error(); #endif CInstance& inst = TheInstance(p); class CUpdatedKeeper { CP m_p; public: CUpdatedKeeper(CP p) : m_p(p) { Lisp().AsArray(m_p)->m_flags |= FLAG_BeingUpdated; } ~CUpdatedKeeper() { Lisp().AsArray(m_p)->m_flags &= ~FLAG_BeingUpdated; } } updatedKeeper(p); do { Push(p); CClassVersion *cv = &TheClassVersion(inst.ClassVersion); if (TheClass(TheClassVersion(cv->Next).Class).Initialized != V_6) E_Error(); if (!cv->SlotListsValidP) { Call(S(L_CLASS_VERSION_COMPUTE_SLOTLISTS), inst.ClassVersion); cv = &TheClassVersion(inst.ClassVersion); ASSERT(cv->SlotListsValidP); } Push(cv->AddedSlots, cv->DiscardedSlots); // Fetch the values of the local slots that are discarded size_t count = 0; for (CP plist=cv->DiscardedSlotLocations; plist;) { CP slotName, slotInfo; SplitPair(plist, slotName); SplitPair(plist, slotInfo); CP val = ToArray(p)->m_pData[AsPositive(slotInfo)]; if (val != V_U) { Push(slotName, val); count += 2; } } Push(Listof(count)); // Fetch the values of the slots that remain local or were shared and become local. These values are retained CP oldClass = cv->Class, newClass = TheClassVersion(cv->Next).Class; size_t keptSlots = 0; for (CP plist=cv->KeptSlotLocations; plist;) { CP oldSlotInfo, newSlotInfo; SplitPair(plist, oldSlotInfo); SplitPair(plist, newSlotInfo); CP val = ConsP(oldSlotInfo) ? ToVector(TheClassVersion(Car(oldSlotInfo)).SharedSlots)->GetElement(AsPositive(Cdr(oldSlotInfo))) : ToVector(p)->GetElement(AsPositive(oldSlotInfo)); if (val != V_U) { Push(val, newSlotInfo); keptSlots ++; } } size_t len = AsPositive(TheClass(newClass).InstanceSize); CArrayValue *av; CClass& clNew = TheClass(newClass); size_t dataSize = clNew.FuncallableP ? clNew.InstanceSize-2 : clNew.InstanceSize-1; byte elType = clNew.FuncallableP ? ELTYPE_BYTE : ELTYPE_T; av = AsArray(p); delete[] exchange(av->m_pData, CArrayValue::CreateData(elType, av->m_dims=CreateFixnum(dataSize), V_U)); TheInstance(p).ClassVersion = newClass; if (clNew.FuncallableP) TheClosure(p).VEnv = 0; while (keptSlots--) { CP newSlotInfo = Pop(); av->SetElement(AsPositive(newSlotInfo), Pop()); } Funcall(S(L_UPDATE_INSTANCE_FOR_REDEFINED_CLASS), 4); } while (!InstanceValidP(p)); } static const CP g_arVecSimple[5] = {S(L_SIMPLE_VECTOR), S(L_SIMPLE_BIT_VECTOR), S(L_SIMPLE_STRING), S(L_SIMPLE_BASE_STRING), S(L_SIMPLE_VECTOR)}, g_arVec[5] = {S(L_VECTOR), S(L_BIT_VECTOR), S(L_STRING), S(L_BASE_STRING), S(L_VECTOR)}; void CLispEng::F_TypeOf() { CP i; CP p = Pop(); switch (Type(p)) { case TS_CHARACTER: { Push(p); F_StandardCharP(); i = m_r ? S(L_STANDARD_CHAR) : AsChar(p)<256 ? S(L_BASE_CHAR) : S(L_EXTENDED_CHAR); } break; case TS_FIXNUM: i = p==V_0 || p==V_1? S(L_BIT) : S(L_FIXNUM); break; case TS_BIGNUM: i = S(L_BIGNUM); break; case TS_FLONUM: i = S(L_SINGLE_FLOAT); break; case TS_RATIO: i = S(L_RATIO); break; case TS_COMPLEX: i = S(L_COMPLEX); break; #if UCFG_LISP_BUILTIN_RANDOM_STATE case TS_RANDOMSTATE:i = S(L_RANDOM_STATE); break; #endif case TS_CONS: i = p ? S(L_CONS) : S(L_NULL); break; case TS_SYMBOL: i = p==V_T ? S(L_BOOLEAN) : AsSymbol(p)->HomePackage==m_packKeyword ? S(L_KEYWORD) : S(L_SYMBOL); break; case TS_ARRAY: { CArrayValue *av = ToArray(p); if (VectorP(p)) m_r = List((av->SimpleP() ? g_arVecSimple : g_arVec)[av->m_elType], av->m_dims); else m_r = List(av->SimpleP() ? S(L_SIMPLE_ARRAY) : S(L_ARRAY), av->m_dims, V_T); //!!! must be type } return; case TS_SUBR: i = S(L_COMPILED_FUNCTION); break; case TS_INTFUNC: i = S(L_FUNCTION); break; case TS_PACKAGE: i = S(L_PACKAGE); break; case TS_READTABLE: i = S(L_READTABLE); break; case TS_HASHTABLE: i = S(L_HASH_TABLE); break; case TS_PATHNAME: i = AsPathname(p)->LogicalP ? S(L_LOGICAL_PATHNAME) : S(L_PATHNAME); break; case TS_WEAKPOINTER: i = S(L_WEAK_POINTER); break; case TS_STREAM: switch (AsStream(p)->m_subtype) { case STS_SYNONYM_STREAM: i = S(L_SYNONYM_STREAM); break; case STS_TWO_WAY_STREAM: i = S(L_TWO_WAY_STREAM); break; case STS_STRING_STREAM: i = S(L_STRING_STREAM); break; case STS_FILE_STREAM: i = S(L_FILE_STREAM); break; case STS_CONCATENATED_STREAM: i = S(L_CONCATENATED_STREAM); break; case STS_BROADCAST_STREAM: i = S(L_BROADCAST_STREAM); break; case STS_ECHO_STREAM: i = S(L_ECHO_STREAM); break; default: i = S(L_STREAM); } break; case TS_STRUCT: m_r = Car(TheStruct(p).Types); return; case TS_CCLOSURE: if (!ClosureInstanceP(p)) { i = S(L_COMPILED_FUNCTION); break; } case TS_OBJECT: { CP clas = TheClassVersion(TheInstance(p).ClassVersion).NewestClass, name = TheClass(clas).Classname; m_r = Get(name, S(L_CLOSCLASS))==clas ? name : clas; } return; case TS_SPECIALOPERATOR: i = S(L_SPECIAL_OPERATOR); break; case TS_SYMBOLMACRO: i = S(L_SYMBOL_MACRO); break; case TS_GLOBALSYMBOLMACRO: i = S(L_GLOBAL_SYMBOL_MACRO); break; case TS_MACRO: i = S(L_MACRO); break; case TS_FUNCTION_MACRO: i = S(L_FUNCTION_MACRO); break; #if UCFG_LISP_FFI case TS_FF_PTR: i = S(L_FOREIGN_POINTER); break; #endif default: E_ProgramErr(); } m_r = i; } void CLispEng::F_ClassOf() { CP i; CP p = Pop(); switch (Type(p)) { case TS_CHARACTER: i = S(L_CHARACTER); break; case TS_FIXNUM: case TS_BIGNUM: i = S(L_INTEGER); break; case TS_FLONUM: i = S(L_FLOAT); break; case TS_RATIO: i = S(L_RATIO); break; case TS_COMPLEX: i = S(L_COMPLEX); break; #if UCFG_LISP_BUILTIN_RANDOM_STATE case TS_RANDOMSTATE:i = S(L_RANDOM_STATE); break; #endif case TS_CONS: i = p ? S(L_CONS) : S(L_NULL); break; case TS_SYMBOL: i = S(L_SYMBOL); break; case TS_ARRAY: { CArrayValue *av = ToArray(p); if (Type(av->m_dims) == TS_FIXNUM) { CP ar[5] = {S(L_VECTOR), S(L_BIT_VECTOR), S(L_STRING), S(L_STRING), S(L_VECTOR)}; i = ar[av->m_elType]; } else i = S(L_ARRAY); } break; case TS_SUBR: case TS_INTFUNC: i = S(L_FUNCTION); break; case TS_STREAM: Push(p); F_TypeOf(); m_r = GetSymProp(m_r, S(L_CLOSCLASS)); return; case TS_PACKAGE: i = S(L_PACKAGE); break; case TS_READTABLE: i = S(L_READTABLE); break; case TS_HASHTABLE: i = S(L_HASH_TABLE); break; case TS_PATHNAME: i = AsPathname(p)->m_dev == V_U ? S(L_LOGICAL_PATHNAME) : S(L_PATHNAME); break; case TS_STRUCT: { CStructInst& str = TheStruct(p); for (CP types=str.Types, name; SplitPair(types, name);) if (DefinedClassP(m_r=GetSymProp(name, S(L_CLOSCLASS)))) return; } m_r = V_T; return; case TS_CCLOSURE: if (!ClosureInstanceP(p)) { i = S(L_FUNCTION); break; } case TS_OBJECT: m_r = TheClassVersion(TheInstance(p).ClassVersion).NewestClass; return; case TS_GLOBALSYMBOLMACRO: case TS_SPECIALOPERATOR: case TS_MACRO: case TS_SYMBOLMACRO: case TS_READLABEL: case TS_WEAKPOINTER: #if UCFG_LISP_FFI case TS_FF_PTR: #endif i = S(L_T); break; default: E_Error(); } m_r = GetSymProp(i, S(L_CLOSCLASS)); ASSERT(m_r); } CP CLispEng::ClassOf(CP p) { Push(p); if (InstanceP(p)) { CArrayValue *av = AsArray(Pop()); if (!(av->m_flags & FLAG_BeingUpdated)) { InstanceUpdate(p); return TheClassVersion(TheInstance(p).ClassVersion).NewestClass; } return TheClassVersion(TheInstance(p).ClassVersion).Class; } else F_ClassOf(); return m_r; } void CLispEng::F_PChangeClass() { AllocateInstance(SV); Push(m_r); CP oldClass = ClassOf(SV2); TheInstance(SV).ClassVersion = oldClass; CArrayValue *avCopy = AsArray(SV), *avOrig = AsArray(SV2); swap(avCopy->m_pData, avOrig->m_pData); swap(avCopy->m_dims, avOrig->m_dims); TheInstance(SV2).ClassVersion = SV1; m_r = Pop(); SkipStack(2); } CP& CLispEng::PtrToSlot(CP inst, CP slotInfo) { if (ConsP(slotInfo)) return ToArray(TheClassVersion(Car(slotInfo)).SharedSlots)->m_pData[AsPositive(Cdr(slotInfo))]; size_t idx = AsPositive(slotInfo); switch (Type(inst)) { case TS_OBJECT: case TS_STRUCT: return idx ? AsArray(inst)->m_pData[idx-1] : TheInstance(inst).ClassVersion; case TS_CCLOSURE: switch (idx) { case 0: return TheClosure(inst).NameOrClassVersion; case 1: return TheClosure(inst).CodeVec; default: return AsArray(inst)->m_pData[idx-2]; } default: E_Error(); //!!! NOTREACHED } } pair<CP, CP> CLispEng::GetSlotInfo(CP inst, CP slotname, CP fun, bool bArgInStack) { CP clas = ClassOf(inst); if (CP slotInfo = GetHash(slotname, TheClass(clas).SlotLocationTable)) return pair<CP, CP>(clas, slotInfo); Push(clas, inst, slotname, fun); if (bArgInStack) Push(SV4); Funcall(S(L_SLOT_MISSING), 4+bArgInStack); return pair<CP, CP>(clas, 0); } void CLispEng::F_SlotValue() { pair<CP, CP> pp = GetSlotInfo(SV1, SV, S(L_SLOT_VALUE), false); if (CP slotInfo = pp.second) { CP clas = pp.first; if (Type(slotInfo) == TS_OBJECT) Call(TheSlotDefinition(slotInfo).EfmSvuc, clas, SV1, slotInfo); else if ((m_r=PtrToSlot(SV1, slotInfo)) == V_U) Call(S(L_SLOT_UNBOUND), clas, SV1, SV); } SkipStack(2); m_cVal = 1; } void CLispEng::F_SetSlotValue() { pair<CP, CP> pp = GetSlotInfo(SV2, SV1, S(L_SETF), true); if (CP slotInfo = pp.second) { if (Type(slotInfo) == TS_OBJECT) Call(TheSlotDefinition(slotInfo).EfmSsvuc, SV, pp.first, SV2, slotInfo); else PtrToSlot(SV2, slotInfo) = SV; } m_r = SV; SkipStack(3); m_cVal = 1; } void CLispEng::F_SlotBoundP() { pair<CP, CP> pp = GetSlotInfo(SV1, SV, S(L_SLOT_BOUNDP), false); if (CP slotInfo = pp.second) { if (Type(slotInfo) == TS_OBJECT) Call(TheSlotDefinition(slotInfo).EfmSbuc, pp.first, SV1, slotInfo); else m_r = FromBool(PtrToSlot(SV1, slotInfo) != V_U); } else m_r = FromBool(m_r); SkipStack(2); m_cVal = 1; } void CLispEng::F_SlotMakUnbound() { pair<CP, CP> pp = GetSlotInfo(SV1, SV, S(L_SLOT_MAKUNBOUND), false); if (CP slotInfo = pp.second) { if (Type(slotInfo) == TS_OBJECT) Call(TheSlotDefinition(slotInfo).EfmSmuc, pp.first, SV1, slotInfo); else PtrToSlot(SV1, slotInfo) = V_U; } m_r = SV1; SkipStack(2); } void CLispEng::F_SlotExistsP() { m_r = FromBool(GetHash(SV, TheClass(ClassOf(SV1)).SlotLocationTable)); SkipStack(2); } CP& CLispEng::SlotAccess() { if (!InstanceP(SV1)) E_TypeErr(SV1, S(L_STANDARD_OBJECT)); CArrayValue *av = AsArray(SV1); if (!(av->m_flags & FLAG_BeingUpdated)) InstanceUpdate(SV1); CP slotInfo = Pop(); if (!slotInfo) E_Error(); return PtrToSlot(Pop(), slotInfo); } void CLispEng::F_StandardInstanceAccess() { m_r = SlotAccess(); } void CLispEng::F_SetfStandardInstanceAccess() { CP& place = SlotAccess(); place = m_r = Pop(); } void CLispEng::F_PUnbound() { m_r = V_U; } CP& CLispEng::SlotUsingClass() { CP clas = ClassOf(SV1); if (clas != SV2) E_Error(); m_cVal = 1; return PtrToSlot(SV1, TheSlotDefinition(SV).Location); } void CLispEng::F_PSlotValueUsingClass() { if ((m_r=SlotUsingClass()) != V_U) SkipStack(3); else { SV = TheSlotDefinition(SV).Name; Funcall(S(L_SLOT_UNBOUND), 3); } m_cVal = 1; } void CLispEng::F_PSetSlotValueUsingClass() { m_r = SlotUsingClass() = SV3; SkipStack(4); } void CLispEng::F_PSlotBoundpUsingClass() { m_r = FromBool(SlotUsingClass() != V_U); SkipStack(3); } void CLispEng::F_PSlotMakunboundUsingClass() { SlotUsingClass() = V_U; m_r = SV1; SkipStack(3); } void CLispEng::F_ClassGethash() { F_ClassOf(); CP ht = Pop(); Push(m_r, ht, 0); F_GetHash(); } } // Lisp::
23,390
Common Lisp
.l
880
24.057955
145
0.669059
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
3f65cded7cab79145f7e825a5645c144f53f3e21ec8d3b5e9ec87113250a46f1
11,516
[ -1 ]
11,517
eval.cpp
ufasoft_lisp/src/lisp/lispeng/eval.cpp
/*###### Copyright (c) 2002-2015 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] #### # # # See LICENSE for licensing information # #####################################################################################################################################*/ #include <el/ext.h> #include "lispeng.h" namespace Lisp { class CForEveryKeyword { protected: virtual void Start() =0; public: }; class CClosureForEveryKeyword : public CForEveryKeyword { protected: void Start(); public: CSPtr *m_pP; uint16_t m_nKey; CClosureForEveryKeyword(CSPtr *pP, uint16_t nKey) : m_pP(pP) , m_nKey(nKey) {} }; void CClosureForEveryKeyword::Start() { for (int i=0; i<m_nKey; i++) Lisp().Push(m_pP[i]); } CP CLispEng::ParseDD(CP body, bool bAllowDoc) { //!!! delete env! Push(body, 0, 0); CP compile = V_0; CP prev; for (CP form; prev=body, SplitPair(body, form);) if (Type(form) == TS_CONS && Car(form) == S(L_DECLARE)) for (CP decls=Cdr(form), declSpec; SplitPair(decls, declSpec);) { if (Type(declSpec) == TS_CONS && Car(declSpec) == S(L_COMPILE)) { CP specRest = declSpec, word; SplitPair(specRest, word); if (!specRest) compile = V_U; else if (!ConsP(specRest) || !SplitPair(specRest, compile) || !FunnameP(compile)) E_ProgramErr(); } SV = Cons(declSpec, SV); } else if (StringP(form) && body) { if (SV1) E_ProgramErr(); SV1 = form; } else { if (form != Car(prev)) //!!! prev = Cons(form, body); break; } m_r = prev; m_arVal[1] = NReverse(Pop()); m_arVal[2] = Pop(); SkipStack(1); if (!bAllowDoc && m_arVal[2]) E_ProgramErr(); m_cVal = 3; return compile; } void CLispEng::F_ParseBody() { bool bAllowDoc = ToOptionalNIL(Pop()); m_arVal[3] = ParseDD(Pop(), bAllowDoc); if (m_arVal[3] == V_U) m_arVal[3] = V_1; m_cVal = 4; } bool CLispEng::GetParamType(CP& p, CP& car, CParamType& pt) { pt = PT_NONE; if (!SplitPair(p, car)) pt = PT_END; else if (Type(car) != TS_SYMBOL) return false; else { switch (AsIndex(car)) { case ENUM_L_OPTIONAL: pt = PT_OPTIONAL; break; case ENUM_L_REST: pt = PT_REST; break; case ENUM_L_KEY: pt = PT_KEY; break; case ENUM_L_ALLOW_OTHER_KEYS: pt = PT_ALLOW_OTHER_KEYS; break; case ENUM_L_AUX: pt = PT_AUX; break; case ENUM_L_BODY: pt = PT_BODY; break; default: return false; } } return true; } CP CLispEng::LambdabodySource(CP lb) { CP body = Cdr(lb); if (!ConsP(body)) return V_U; CP form = Car(body); if (!ConsP(form) || Car(form)!=S(L_DECLARE)) return V_U; CP ds = Cdr(form); if (!ConsP(ds)) return V_U; CP d = Car(ds); if (!ConsP(d) || Car(d)!=S(L_SOURCE)) return V_U; CP r = Cdr(d); return ConsP(r) ? Car(r) : V_U; } CP CLispEng::FunnameBlockname(CP p) { return ConsP(p) ? Car(Cdr(p)) : p; } void CLispEng::AddImplicitBlock() { Push(m_arVal[1], m_arVal[2]); CP p = Cons(Cons(S(L_BLOCK), Cons(FunnameBlockname(SV3), m_r)), 0); if (CP doc = Pop()) p = Cons(doc, p); if (CP decls = Pop()) { Push(p); p = Cons(S(L_DECLARE), decls); p = Cons(p, Pop()); } SV = Cons(Car(SV), p); } CP CLispEng::GetClosure(CP lambdaBody, CP name, bool bBlock, CEnvironment& env) { if (!ConsP(lambdaBody)) E_ProgramErr(); Push(Car(lambdaBody)); CP& lambdaList = *m_pStack; Push(name, lambdaBody); CP compileName = ParseDD(Cdr(lambdaBody), true); if (compileName != V_0) { if (compileName!=V_U && SV1==S(L_K_LAMBDA)) SV1 = compileName; CP source = LambdabodySource(SV); // replace Lambdabody with its source (because some Macros can be compiled more efficiently than their Macro-Expansion) if (source != V_U) SV = source; else if (bBlock) AddImplicitBlock(); PushNestEnv(env); Push(V_T); Funcall(S(L_COMPILE_LAMBDA), 8); SkipStack(1); return m_r; } CP source = LambdabodySource(SV); #ifdef _DEBUG bool bPrintAfter = false; #endif if (source == V_U) { if (bBlock) AddImplicitBlock(); if (m_bExpandingLambda) lambdaBody = SV; else { #if UCFG_LISP_LAZY_EXPAND lambdaBody = SV; #else Push(SV, NestVar(m_env.m_varEnv)); Push(NestFun(m_env.m_funEnv)); CBoolKeeper keeper(m_bExpandingLambda, true); Funcall(S(L_EXPAND_LAMBDABODY_MAIN), 3); lambdaBody = m_r; #endif // UCFG_LISP_LAZY_EXPAND #ifdef _DEBUG if (bPrintAfter) { cerr << "\n-----------------L_EXPAND_LAMBDABODY_MAIN-------------------\n"; Print(name); cerr << "\n"; Print(m_r); } #endif } } else { lambdaBody = exchange(SV, source); } lambdaList = Car(lambdaBody); ParseDD(Cdr(lambdaBody), true); CEnvironment *stackEnv = NestEnv(env); CIntFuncValue *ifv = CreateIntFunc(); ifv->m_env = *stackEnv; SkipStack(5); ifv->m_docstring = m_arVal[2]; #ifdef _DEBUG //!!!D if (!m_r) { Print(SV); cerr << endl; } #endif ifv->m_body = m_r; ifv->m_form = Pop(); ifv->m_name = SV; CP clos = SV = FromSValue(ifv); int nSpec = 0, nReq = 0, nOpt = 0, nKey = 0, nAux = 0, nVar = 0; for (CP decl, car; SplitPair(m_arVal[1], decl);) { if (!SplitPair(decl, car)) E_ProgramErr(); if (car == S(L_SPECIAL)) while (SplitPair(decl, car)) if (Type(car) != TS_SYMBOL) E_ProgramErr(); else { Push(car); nSpec++; nVar++; } CP denv = AugmentDeclEnv(decl, AsIntFunc(clos)->m_env.m_declEnv); AsIntFunc(clos)->m_env.m_declEnv = denv; } CP item = 0, initForm = 0; CParamType pt; while (!GetParamType(lambdaList, item, pt)) { ToVariableSymbol(item); Push(item, V_0); nReq++; nVar++; } if (pt == PT_OPTIONAL) { while (!GetParamType(lambdaList, item, pt)) { nOpt++; nVar++; initForm = 0; if (Type(item) == TS_SYMBOL) { ToVariableSymbol(item); Push(item, V_0); } else { CP car = 0; SplitPair(item, car); ToVariableSymbol(car); Push(car, V_0); if (SplitPair(item, initForm) && Type(item) == TS_CONS && item) { //!!! if (Cdr(item)) E_ProgramErr(); item = Car(item); ToVariableSymbol(item); SV = CreateInteger(short(AsNumber(SV)|FLAG_SP)); Push(item, V_0); nVar++; } } CP cons = Cons(initForm, AsIntFunc(clos)->m_optInits); AsIntFunc(clos)->m_optInits = cons; } } if (pt == PT_REST) { if (GetParamType(lambdaList, item, pt)) E_ProgramErr(); ToVariableSymbol(item); Push(item, V_0); nVar++; AsIntFunc(clos)->m_bRestFlag = true; GetParamType(lambdaList, item, pt); } if (pt == PT_KEY) { while (!GetParamType(lambdaList, item, pt)) { nKey++; nVar++; initForm = 0; CSPtr keyword; if (Type(item) == TS_SYMBOL) { ToVariableSymbol(item); Push(item, V_0); keyword = GetSymbol(AsString(item), m_packKeyword); } else { CP car = 0; SplitPair(item, car); if (Type(car) == TS_SYMBOL) { ToVariableSymbol(car); Push(car, V_0, item); keyword = GetSymbol(AsString(car), m_packKeyword); item = Pop(); } else { keyword = Car(car); if (Type(keyword) != TS_SYMBOL) E_ProgramErr(); //!!! need additional check car = Car(Cdr(car)); ToVariableSymbol(car); Push(car, V_0); } if (SplitPair(item, initForm) && item) { SplitPair(item, car); if (item) E_ProgramErr(); ToVariableSymbol(car); SV = CreateInteger(short(AsNumber(SV)|FLAG_SP)); Push(car, V_0); nVar++; } } Push(initForm); CP cons = Cons(keyword, AsIntFunc(clos)->m_keywords); AsIntFunc(clos)->m_keywords = cons; cons = Cons(Pop(), AsIntFunc(clos)->m_keyInits); AsIntFunc(clos)->m_keyInits = cons; } } if (pt == PT_ALLOW_OTHER_KEYS) { AsIntFunc(clos)->m_bAllowFlag = true; GetParamType(lambdaList, item, pt); } if (pt == PT_AUX) { while (!GetParamType(lambdaList, item, pt)) { nAux++; nVar++; initForm = 0; if (Type(item) != TS_SYMBOL) { CP r = exchange(item, 0); if (SplitPair(r, item) && SplitPair(r, initForm) && r) E_ProgramErr(); } ToVariableSymbol(item); Push(item, V_0); CP cons = Cons(initForm, AsIntFunc(clos)->m_auxInits); AsIntFunc(clos)->m_auxInits = cons; } } if (pt != PT_END) E_ProgramErr(); CArrayValue *vv = CreateVector(nVar); ifv = AsIntFunc(clos); byte *q = 0; //!!! int k = 0; if (nSpec) goto foundFlag; for (; k<nVar-nSpec; k++) if (m_pStack[k*2] != V_0) { foundFlag: ifv->m_varFlags = new byte[nVar-nSpec]; q = ifv->m_varFlags+nVar-nSpec; for (int i=0; i<nVar-nSpec; i++) *--q = (byte)AsNumber(m_pStack[i*2]); } CP *p = vv->m_pData+nVar; int i; for (i=0; i<nVar-nSpec; i++) { SkipStack(1); *--p = Pop(); } for (i=0; i<nSpec; i++) *--p = Pop(); if (nSpec) { for (i=nSpec; i<nVar; i++) { for (int j=nSpec; j--;) { if (p[j] == p[i]) { q[i-nSpec] |= FLAG_DYNAMIC; break; } } } } ifv->m_vars = FromSValue(vv); ifv->m_nSpec = (byte)nSpec; ifv->m_nReq = (byte)nReq; ifv->m_nOpt = (uint16_t)nOpt; ifv->m_nKey = (byte)nKey; ifv->m_nAux = (byte)nAux; NReverse(ifv->m_optInits); NReverse(ifv->m_keywords); NReverse(ifv->m_keyInits); NReverse(ifv->m_auxInits); SkipStack(2); //!!! return clos; } CP CLispEng::NestFun(CP env) { int depth = 0; for (; Type(env)==TS_FRAME_PTR; depth++) { Push(env); env = AsFrame(env)[2]; } while (depth--) { CP *frame = AsFrame(Pop()); if (int count = AsNumber(frame[FRAME_COUNT])) { Push(env); CArrayValue *vv = CreateVector(count*2+1); for (int i=0; i<count; i++) { vv->m_pData[i*2] = frame[FRAME_BINDINGS+i*2]; vv->m_pData[i*2+1] = frame[FRAME_BINDINGS+1+i*2]; } vv->m_pData[count*2] = Pop(); env = FromSValue(vv); frame[FRAME_NEXT_ENV] = env; frame[FRAME_COUNT] = V_0; } } return env; } CP CLispEng::NestVar(CP env) { int depth = 0; for (; Type(env)==TS_FRAME_PTR; depth++) { Push(env); env = AsFrame(env)[FRAME_NEXT_ENV]; } while (depth--) { CP *frame = AsFrame(Pop()); int nBinds = AsNumber(frame[FRAME_COUNT]); int count = nBinds; CP *binds = frame+FRAME_BINDINGS; for (; count && !(binds[0] & FLAG_ACTIVE); count--) binds+=2; if (count) { nBinds -= count; Push(env); CArrayValue *vv = CreateVector(count*2+1); for (int i=0; i<count; i++, binds+=2) { if (binds[0] & FLAG_DYNAMIC) { vv->m_pData[i*2] = binds[0] & MASK_WITHOUT_FLAGS; vv->m_pData[i*2+1] = V_SPEC; } else { binds[0] = binds[0] & ~FLAG_ACTIVE; vv->m_pData[i*2] = binds[0]; vv->m_pData[i*2+1] = binds[1]; } } vv->m_pData[count*2] = Pop(); env = FromSValue(vv); frame[FRAME_NEXT_ENV] = env; frame[FRAME_COUNT] = CreateFixnum(nBinds); } } return env; } /*!!! bool CLispEng::IsMacro(CSymbolValue *sv) { return Type(GetSymRef(sv, m_env.m_varEnv)) == TS_SYMBOLMACRO; }*/ void CLispEng::F_MacroP() { m_r = FromBool(Type(Pop()) == TS_MACRO); } void CLispEng::F_SymbolMacroP() { m_r = FromBool(Type(Pop()) == TS_SYMBOLMACRO); } void CLispEng::F_MakeSymbolMacro() { m_r = FromSValueT(CreateSymbolMacro(Pop()), TS_SYMBOLMACRO); } void CLispEng::F_MakeGlobalSymbolMacro() { F_MakeSymbolMacro(); m_r = FromSValueT(CreateSymbolMacro(m_r), TS_GLOBALSYMBOLMACRO); } void CLispEng::F_SymbolMacroExpand() { CSymbolValue *sv = ToSymbol(SV); if (sv->SymMacroP) { CP q = Get(SV, S(L_SYMBOLMACRO)); if (m_r = FromBool(q!=V_U)) { m_arVal[1] = ToSymbolMacro(ToGlobalSymbolMacro(q)->m_macro)->m_macro; m_cVal = 2; } else sv->SymMacroP = false; } SkipStack(1); } void CLispEng::F_GlobalSymbolMacroDefinition() { m_r = ToGlobalSymbolMacro(Pop())->m_macro; } void CLispEng::F_FindSubr() { if ((m_r=Get(SV, S(L_TRACED_DEFINITION))) == V_U) AsSymbol(SV)->GetFun(); else if (Type(m_r) != TS_SUBR) E_SeriousCondition(); SkipStack(1); } CP *CLispEng::FindVarBind(CP sym, CP env) { bool bFromInsideMacrolet = false; while (true) { switch (Type(env)) { case TS_ARRAY: { CArrayValue *vv = AsArray(env); int count = AsFixnum(vv->m_dims)/2; CP *pData = vv->m_pData; int i=0; for (; i<count; i++) if (pData[i*2] == sym) { CP& q = pData[i*2+1]; if (bFromInsideMacrolet && q!=V_SPEC && Type(q)!=TS_SYMBOLMACRO) E_SeriousCondition(); return &q; } env = pData[i*2]; } break; case TS_CONS: if (env) { #ifdef X_DEBUG//!!!D cerr << "sym= "; Print(sym); cerr << "\nenv= "; Print(env); #endif ASSERT(Car(env)==S(L_MACROLET)); bFromInsideMacrolet = true; Inc(env); break; } default: return 0; } } } void CLispEng::F_SpecialVariableP() { CP env = ToOptionalNIL(Pop()); CP sym = Pop(); CSymbolValue *sv = ToSymbol(sym); if (sv->m_fun & SYMBOL_FLAG_SPECIAL) m_r = V_T; else if (env) { if (env == V_T) env = m_env.m_varEnv; else if (Type(env) == TS_ARRAY) { CArrayValue *av = ToVector(env); //!!! size_t len = av->DataLength; if (len==2 || len==5) env = av->m_pData[0]; } if (CP *pv = FindVarBind(sym, env)) m_r = FromBool(*pv==V_SPEC); } } void CLispEng::CheckAllowOtherKeys(CP *pBase, size_t nArg) { size_t j; for (j=nArg; j;) { if (pBase[(j-=2)+1] == S(L_K_ALLOW_OTHER_KEYS)) { pBase[j+1] = 0; if (pBase[j]) return; break; } } for (j=nArg; j;) if (pBase[(j-=2)+1]) E_ProgramErr(); } #if UCFG_LISP_TEST //!!! int g_maxDeep; #endif #if UCFG_LISP_TAIL_REC void CLispEng::TailRecApplyIntFunc(CP fun, ssize_t nArg) { for (CP *p=m_pStack; p!=m_pStackTop; ++p) { CP q = *p; if (Type(q) == TS_FRAMEINFO) { int idx = AsIndex(q); CFrameType ft = CFrameType(idx & FRAME_TYPE_MASK); switch (ft) { case FT_APPLY: m_tailedFun = fun; m_nTailArgs = nArg; m_pTailStack = m_pStack; return; case FT_VAR: { int nv = idx>>8; for (int i=1; i<nv; ++i) { CP sym = p[i]; if (sym & FLAG_DYNAMIC) goto LAB_OUT; } p += nv-1; } break; case FT_EVAL: case FT_ENV1V: case FT_ENV2VD: case FT_ENV5: case FT_ENV1B: case FT_ENV1F: case FT_ENV1G: case FT_ITAGBODY: case FT_IBLOCK: break; case FT_DYNBIND: case FT_FUN: case FT_UNWINDPROTECT: goto LAB_OUT; default: goto LAB_OUT; } } } LAB_OUT: //!!!BUG of VS2015. Stack is not unwinded LISP_TAIL_REC_ENABLED = false; } #endif // UCFG_LISP_TAIL_REC void CLispEng::ApplyIntFunc(CP fun, ssize_t nArg) { #if UCFG_LISP_TAIL_REC if (LISP_TAIL_REC_ENABLED) TailRecApplyIntFunc(fun, nArg); CP *pStack = m_pStack; LAB_TAIL_RET: // CStackKeeper stackKeeper(_self); if (m_tailedFun) { #ifdef X_DEBUG static ostream& s_fos = cerr; //("c:\\out\\debug\\lisp.log"); s_fos << "\ntail returning " << endl; Print(s_fos, fun); s_fos << " -> "; Print(s_fos, m_tailedFun); s_fos << "---" << endl; #endif fun = exchange(m_tailedFun, 0); m_pStack = pStack + nArg - m_nTailArgs; memmove(m_pStack, m_pTailStack, (nArg = m_nTailArgs)*sizeof(CP)); pStack = m_pStack; //!!! LISP_TAIL_REC_ENABLED = false; } #endif // UCFG_LISP_TAIL_REC #ifdef _X_TEST //!!! static int base = (int)&fun; g_maxDeep = _MAX(g_maxDeep, base-(int)&fun); #endif #if UCFG_LISP_LAZY_EXPAND if (!m_bExpandingLambda && !f.m_bExpanded && f.m_form) { AsIntFunc(fun)->m_bExpanded = true; Push(fun); //!!! Print(f.m_form); Push(f.m_form, f.m_env.m_varEnv, f.m_env.m_funEnv); CBoolKeeper keeper(m_bExpandingLambda, true); Funcall(S(L_EXPAND_LAMBDABODY_MAIN), 3); SkipStack(1); ParseDD(Cdr(m_r), true); //!!! Print(m_r); //!!! cerr << endl << endl; AsIntFunc(fun)->m_body = m_r; f = *AsIntFunc(fun); } #endif // UCFG_LISP_LAZY_EXPAND CP *pArgs = m_pStack+nArg; { CApplyFrame applyFrame(_self, pArgs, fun); if (m_bDebugFrames) { #if UCFG_LISP_SJLJ && LISP_ALLOCA_JMPBUF applyFrame.m_pJmpbuf = (jmp_buf*)alloca(sizeof(jmp_buf)); #endif LISP_TRY(applyFrame) { //!!!? } LISP_CATCH(applyFrame) { if (m_cVal) goto LAB_RET; else fun = m_pStack[1]; //!!! frame_closure } LISP_CATCH_END } CP *pTop = m_pStack; CIntFuncValue *fp = AsIntFunc(fun); #ifdef X_DEBUG//!!!D if (g_print) { Disassemble(cerr, CurClosure); Print(fp->m_name); cout << "\n"; } #endif PROF_POINT(fp->m_profInfo) CArrayValue *av = ToArray(fp->m_vars); CP *p = av->m_pData; int count = AsFixnum(av->m_dims); //!!!E TotalSize(); int nSpec = fp->m_nSpec; int i; for (i=0; i<nSpec; i++) Push(V_SPEC, *p++ | FLAG_ACTIVE); CVarFrame varFrame(m_pStack); byte *varFlags = fp->m_varFlags; for (i=0; i<count-nSpec; i++) { CP sym = *p++; if ((ToSymbol(sym)->m_fun & (SYMBOL_FLAG_SPECIAL|SYMBOL_FLAG_CONSTANT)) == SYMBOL_FLAG_SPECIAL) sym = sym | FLAG_DYNAMIC; if (varFlags) sym |= *varFlags++; Push(0, sym); } Push(fp->m_env.m_varEnv, CreateFixnum(count)); //!!! varFrame.Finish(_self, pTop); CP env = CreateFramePtr(m_pStack); CEnv5Frame env5Frame(_self); m_env.m_varEnv = env; m_env.m_funEnv = fp->m_env.m_funEnv; m_env.m_blockEnv = fp->m_env.m_blockEnv; m_env.m_goEnv = fp->m_env.m_goEnv; m_env.m_declEnv = fp->m_env.m_declEnv; int n = nArg; CP body = fp->m_body; { CIntFunc ff = *AsIntFunc(fun); CIntFunc *f = &ff; //!!! CIntFuncChain f(AsIntFunc(fun)); int nReq = f->m_nReq, nOpt = f->m_nOpt; if (n < nReq) E_ProgramErr(); n -= nReq; for (int i=0; i<nReq; i++) varFrame.Bind(*--pArgs); count = nOpt; CP inits = f->m_optInits; for (; count; count--, Inc(inits)) { if (!n) { Push(inits); while (count--) { CP car = 0; SplitPair(SV, car); if (varFrame.Bind(Eval(car))) varFrame.Bind(0); //!!! } if (f->m_bRestFlag) varFrame.Bind(0); SV = f->m_keyInits; for (count=f->m_nKey; count--; Inc(inits)) { CP car = 0; SplitPair(SV, car); if (varFrame.Bind(Eval(car))) varFrame.Bind(0); //!!! } SkipStack(1); goto LAB_AUX; } n--; if (varFrame.Bind(*--pArgs)) varFrame.Bind(V_T); //!!! } if (!f->m_keywords && !f->m_bAllowFlag && !f->m_bRestFlag) { if (n) E_ProgramErr(); } else { if (f->m_bRestFlag) { Push(0); for (int i=0; i<n; i++) SV = Cons(pArgs[i-n], SV); varFrame.Bind(Pop()); } if (f->m_keywords) { if (n & 1) E_ProgramErr(); n >>= 1; CP keywords = f->m_keywords, keyInits = f->m_keyInits; bool bAllow = f->m_bAllowFlag; for (int i=0; i<f->m_nKey; i++, Inc(keyInits)) { CP keyword = 0, val = 0, svar = 0; SplitPair(keywords, keyword); bool bAllowKey = false; for (ssize_t j=n-1; j>=0; j--) { if (pArgs[-j*2-1] == keyword) { svar = V_T; val = pArgs[-j*2-2]; if (keyword == S(L_K_ALLOW_OTHER_KEYS)) bAllowKey = val; //!!!Q may be must be T? pArgs[-j*2-1] = 0; } } if (!svar) val = Eval(Car(keyInits)); if (varFrame.Bind(val)) varFrame.Bind(svar); bAllow = bAllow || bAllowKey; } if (!bAllow) CheckAllowOtherKeys(pArgs-(n<<1), n<<1); } } LAB_AUX: Push(f->m_auxInits); for (int j=f->m_nAux; j--;) { CP car = 0; //!!! SplitPair(SV, car); varFrame.Bind(Eval(car)); } SkipStack(1); } LISP_TAIL_REC_KEEPER(true); #if UCFG_LISP_TAIL_REC == 2 CTailRecKeeper trKeeper2(_self, false); // for right work of Progn() #endif Progn(body); #if UCFG_LISP_TAIL_REC if (m_tailedFun) { goto LAB_TAIL_RET; } #endif return; } LAB_RET: m_cVal = 1; m_r = Eval(m_r); } class CLevelKeeper { int& m_level; public: int m_prev; CLevelKeeper(int& level) : m_level(level) , m_prev(m_level) { } ~CLevelKeeper() { m_level = m_prev; } }; class CTracer { LISP_LISPREF; CLevelKeeper m_levelKeeper; ptr<StandardStream> m_traceStream; ostream *m_os; CP m_fun; public: bool m_bNormalExit; CTracer(CLispEng& lisp, CP fun, int nArg) : LISP_SAVE_LISPREF(lisp) m_os(0) , m_levelKeeper(lisp.m_level) , m_bNormalExit(false) { if (!lisp.m_bTrace) return; lisp.m_level++; m_traceStream = lisp.m_streams[STM_TraceOutput]; m_os = m_traceStream->GetOstream(); //!!!? may be dybamic_cast int i; for (i=m_levelKeeper.m_prev; i--;) *m_os << " "; pair<CP, CP> pp = lisp.GetFunctionName(fun); m_fun = pp.second; lisp.Print(pp.first); *m_os << " "; lisp.Print(pp.second); *m_os << " > "; for (i=0; i<nArg; i++) { *m_os << ' '; lisp.Print(lisp.m_pStack[nArg-i-1]); } *m_os << '\n'; } ~CTracer() { if (!m_os || !m_bNormalExit) return; for (int i=m_levelKeeper.m_prev; i--;) *m_os << " "; CLispEng& lisp = LISP_GET_LISPREF; lisp.Print(m_fun); *m_os << " < "; lisp.PrintValues(*m_os); *m_os << '\n'; } }; #if UCFG_LISP_FAST_HOOKS void CLispEng::ApplyImp(CP fun, ssize_t nArg) { #else void CLispEng::Apply(CP fun, ssize_t nArg) { if (Signal) return ApplyHooked(fun, nArg); #endif #ifdef X_DEBUG//!!!D static int s_i; if (++s_i == 6660) {//6420) // In Interpreted 14500 StackOverflowAddress = (void*)1; E_Error(S(L_STACK_OVERFLOW_ERROR)); } if (s_i == 170000) { //PrintFrames(); } #endif LISP_TRACER; switch (Type(fun)) { case TS_CCLOSURE: ApplyClosure(fun, nArg); //!!!Q may be direct call to ApplyClosure(...rest)? break; case TS_SUBR: ApplySubr(fun, nArg); break; case TS_INTFUNC: ApplyIntFunc(fun, nArg); break; default: E_SeriousCondition(); } LISP_TRACER_NORMAL_EXIT; } void CLispEng::ApplyHooked(CP fun, ssize_t nArg) { while (Signal) { //!!! int sig = exchange(m_Signal, 0); switch (sig) { case SIGINT: E_Signal(S(L_INTERRUPT_CONDITION)); break; case int(HRESULT_OF_WIN32(ERROR_STACK_OVERFLOW)): #ifdef X_DEBUG//!!!D PrintFrames(); #endif Push(Spec(L_STACK_OVERFLOW_INSTANCE)); F_InvokeHandlers(); abort(); break; case SIGTERM: Throw(ExtErr::NormalExit); //!!! } Push(fun); //!!! Push(args); Call("BREAK", 0); //!!! args = Pop(); fun = Pop(); } #if UCFG_LISP_FAST_HOOKS if (CP hook = Spec(L_S_APPLYHOOK)) { Call(hook, Listof(nArg)); //!!! may optimize return; } m_mfnApply = &class_type::ApplyImp; #endif Apply(fun, nArg); } void CLispEng::Apply(CP form, ssize_t nArg, CP rest) { #ifdef _DEBUG { // Print(form); // Disassemble(cerr, *m_pClosure); } #endif for (CP car; SplitPair(rest, car); nArg++) Push(car); Funcall(form, nArg); } void CLispEng::Call(CP p, CP a) { Push(a); Funcall(p, 1); } void CLispEng::Call(CP p, CP a, CP b) { Push(a, b); Funcall(p, 2); } void CLispEng::Call(CP p, CP a, CP b, CP c) { Push(a, b, c); Funcall(p, 3); } void CLispEng::Call(CP p, CP a, CP b, CP c, CP d) { Push(a, b, c, d); Funcall(p, 4); } void CLispEng::Call(CP p, CP a, CP b, CP c, CP d, CP e) { Push(a, b, c, d, e); Funcall(p, 5); } CP * __fastcall CLispEng::SymValue(CSymbolValue *sym, CP env, CP *pSymMacro) { if (!(sym->m_fun & SYMBOL_FLAG_SPECIAL)) { CP symp = FromSValue(sym), sympA = symp | FLAG_ACTIVE; for (CP *frame; Type(env)==TS_FRAME_PTR; env=frame[FRAME_NEXT_ENV]) { CP *ptr = (frame=AsFrame(env))+FRAME_BINDINGS; for (int count=AsFixnum(frame[FRAME_COUNT]); count--; ptr+=2) //!!! without check for speed if (*ptr == sympA) { //!!! if ((*ptr & (MASK_WITHOUT_FLAGS|FLAG_ACTIVE)) == sympA) CP& v = ptr[1]; return v==V_SPEC ? &sym->m_dynValue : &v; } } if (CP *pv = FindVarBind(symp, env)) { if (*pv != V_SPEC) { if (Type(*pv) != TS_SYMBOLMACRO) return pv; *pSymMacro = *pv; return 0; } } else if (sym->SymMacroP) { CP sm = Get(symp, S(L_SYMBOLMACRO)); if (sm != V_U) *pSymMacro = ToGlobalSymbolMacro(sm)->m_macro; else sym->SymMacroP = false; } } return &sym->m_dynValue; } bool CLispEng::SymMacroP(CP p) { CP symMacro = 0; SymValue(ToSymbol(p), m_env.m_varEnv, &symMacro); return symMacro; } CP __fastcall CLispEng::GetSymFunction(CP sym, CP fenv) { CP val = 0; { for (CP *frame; Type(fenv)==TS_FRAME_PTR; fenv=frame[FRAME_NEXT_ENV]) { frame = AsFrame(fenv); CP *binds = frame+FRAME_BINDINGS; for (int count=AsNumber(frame[FRAME_COUNT]); count--; binds+=2) if (Equal(binds[0], sym)) { val = binds[1]; goto LAB_OUT; } } bool bFromInsideMacrolet = false; while (true) { switch (Type(fenv)) { case TS_ARRAY: { CArrayValue *vv = AsArray(fenv); CP *p = vv->m_pData; for (int count=AsFixnum(vv->m_dims)/2; count--; p+=2) { //!!!Evv->TotalSize()/2 if (Equal(p[0], sym)) { val = p[1]; if (bFromInsideMacrolet && Type(val)!=TS_MACRO) E_SeriousCondition(); goto LAB_OUT; } } fenv = *p; } break; case TS_CONS: if (fenv) { ASSERT(Car(fenv)==S(L_MACROLET)); bFromInsideMacrolet = true; Inc(fenv); break; } default: if (Type(sym) != TS_SYMBOL) { sym = GetSymProp(Car(Cdr(sym)), S(L_SETF_FUNCTION)); if (Type(sym) != TS_SYMBOL) return V_U; } return AsSymbol(sym)->GetFun(); } } } LAB_OUT: return val ? val : V_U; } void CLispEng::ApplySubr(CP fun, ssize_t nArg) { LISP_TAIL_REC_KEEPER(false); m_subrSelf = fun; CReqOptRest ror = AsReqOptRest(fun); if ((nArg-=ror.m_nReq) < 0) { CP name = GetSubrName(fun); Push(name); int n = nArg+ror.m_nReq; for (int i=0; i<n; ++i) Push(m_pStack[n]); E_ProgramErr(IDS_E_TooFewArguments, name, Listof(n+1)); } if ((nArg-=ror.m_nOpt) < 0) PushUnbounds(- exchange(nArg, 0)); size_t idx = AsIndex(fun) & 0x3FF; ClearResult(); if (!WithRestP(fun)) { if (WithKeywordsP(fun)) { if (nArg & 1) E_ProgramErr(); const byte *pk = s_stFuncInfo[idx].m_keywords; pair<size_t, bool> pp = KeywordsLen(pk); size_t nKey = pp.first; CP *vals = (CP*)alloca(nKey*sizeof(CP)); FillMem(vals, nKey, V_U); for (size_t i=0; i<nKey; ++i) { CP kw = get_Sym(CLispSymbol(pk[i])); for (int j=0; j<nArg; j+=2) if (m_pStack[j+1] == kw) { vals[nKey-i-1] = m_pStack[j]; m_pStack[j+1] = 0; } } if (!pp.second) CheckAllowOtherKeys(m_pStack, nArg); memcpy(m_pStack += nArg-nKey, vals, nKey*sizeof(CP)); // Replace nArg args with nKey vals in Stack } else if (nArg) E_ProgramErr(); PROF_POINT(m_arSubrProfile[idx]); (this->*s_stFuncAddrs[idx])(); } else { PROF_POINT(m_arSubrProfile[idx]); (this->*s_stFuncRAddrs[idx-SUBR_FUNCS])(nArg); } } //!!!D int g_nn; #if UCFG_LISP_FAST_HOOKS CP CLispEng::EvalImp(CP p) { #else CP CLispEng::EvalCall(CP p) { #endif #if UCFG_LISP_FAST_EVAL_ATOMS == 1 if (IsSelfEvaluated(p)) { m_cVal = 1; return m_r = p; } #endif #ifdef X_DEBUG//!!!D if (m_pStackTop-m_pStack > 80000) // if (p == 0xEEAF00) { E_Error(); // cerr << "\n-----------Eval----------------------" << '\n'; Print(p); cerr << "\n"; } #endif #if 0 struct CEvalFrameKeeper { CEvalFrame *m_p; CP *m_pStack; CEvalFrameKeeper(CP form) : m_p (0) { CLispEng& lisp = Lisp(); m_pStack = lisp.m_pStack; lisp.Push(form); } ~CEvalFrameKeeper() { /* if (Lisp().m_pStack != m_pStack) { Lisp().Print(m_form); cerr << hex << m_form; m_p = m_p; } */ if (m_p) m_p->~CEvalFrame(); Lisp().m_pStack = m_pStack; } } keepEval(p); // = { 0 }; #endif #if UCFG_LISP_DEBUG_FRAMES CEvalFrame evalFrame(_self, p); # if !UCFG_LISP_FAST_HOOKS if (m_bDebugFrames) { # if UCFG_LISP_SJLJ && LISP_ALLOCA_JMPBUF evalFrame.m_pJmpbuf = (jmp_buf*)alloca(sizeof(jmp_buf)); # endif // new(keepEval.m_p = (CEvalFrame*)alloca(sizeof CEvalFrame)) CEvalFrame(_self, p); //CEvalFrame frame(_self, p); LISP_TRY(evalFrame) { // m_bDebugFrames && //!!!? } LISP_CATCH(evalFrame) { if (m_cVal) m_pStack[FRAME_FORM] = m_r; p = m_pStack[FRAME_FORM]; if (IsSelfEvaluated(p)) { m_cVal = 1; return m_r = p; } ts = Type(p); # ifdef _DEBUG//!!!D E_Error(); # endif } LISP_CATCH_END } if (CP hook = Spec(L_S_EVALHOOK)) { CDynBindFrame bind; bind.Bind(_self, S(L_S_EVALHOOK), 0); bind.Bind(_self, S(L_S_APPLYHOOK), 0); bind.Finish(_self, 2); Push(p); PushNestEnvAsArray(m_env); Funcall(hook, 2); } else # endif // !UCFG_LISP_FAST_HOOKS #else CP *prevStackP = m_pStack; // faster without Frame Push(p, FromValue(FT_EVAL|(2<<8), TS_FRAMEINFO)); //!!!D CPseudoEvalFrame pseudoEvalFrame(_self, p); #endif //UCFG_LISP_DEBUG_FRAMES if (Type(p) == TS_CONS) { #if !UCFG_LISP_FAST_EVAL_ATOMS if (!p) { //!!! m_cVal = 1; m_r = 0; goto LAB_RET; } #endif CheckStack(); //!!! CConsValue *form = AsCons(p); CP sym = form->m_car; CSPtr fun; if (Type(sym)==TS_SYMBOL && Type(fun=GetSymFunction(sym, m_env.m_funEnv))==TS_MACRO) { LISP_TAIL_REC_KEEPER(false); #ifdef C_LISP_QUICK_MACRO Push(m_env.m_funEnv, m_env.m_varEnv); CP env = CreateFramePtr(m_pStack); Push(AsMacro(fun)->m_macro, p, env); #else Push(AsMacro(fun)->m_expander, p); Push(NestVar(m_env.m_varEnv)); Push(NestFun(m_env.m_funEnv)); CArrayValue *vec = CreateVector(2); vec->m_pData[1] = Pop(); vec->m_pData[0] = Pop(); Push(FromSValue(vec)); #endif Funcall(Spec(L_S_MACROEXPAND_HOOK), 3); m_cVal = 1; m_r = Eval(m_r); goto LAB_RET; } if (!fun) { if (!FunnameP(sym)) { CP q = sym, car; if (!SplitPair(q, car) || car!=S(L_LAMBDA)) E_ProgramErr(); fun = GetClosure(q, sym, false, m_env);//!!! } else fun = GetSymFunction(sym, m_env.m_funEnv); form = AsCons(p); } FUN_DISPATCH: switch (Type(fun)) { case TS_FUNCTION_MACRO: fun = ToFunctionMacro(fun)->m_function; //!!!O goto FUN_DISPATCH; case TS_SPECIALOPERATOR: { CP args = form->m_cdr; CReqOptRest ror = AsReqOptRest(fun); CP car; for (; ror.m_nReq--;) { if (!SplitPair(args, car)) E_ProgramErr(); else Push(car); } for (; ror.m_nOpt--;) { if (SplitPair(args, car)) Push(car); else Push(V_U); } if (WithRestP(fun)) Push(args); else if (args) { E_ProgramErr(); } ClearResult(); #if UCFG_LISP_TAIL_REC == 2 LISP_TAIL_REC_KEEPER(false); #endif (this->*AsSpecialOperator(fun))(); } break; case TS_CCLOSURE: case TS_INTFUNC: Push(fun); //!!! we need it save from GC case TS_SUBR: { int nArg = 0; { LISP_TAIL_REC_KEEPER(false); for (CP args=form->m_cdr, car; SplitPair(args, car); nArg++) Push(Eval(car)); } #if !UCFG_LISP_FAST_HOOKS if (CP hook = Spec(L_S_APPLYHOOK)) { Call(hook, Listof(nArg)); //!!! may optimize } else #endif Apply(fun, nArg); } break; default: #ifdef _DEBUG //!!!D Print(p); Print(sym); Print(AsSymbol(sym)->HomePackage); CSymbolValue *sv = AsSymbol(sym); #endif E_UndefinedFunction(sym); } } #if UCFG_LISP_FAST_EVAL_ATOMS else { #else else if (Type(p) == TS_SYMBOL) { #endif CP symMacro = 0; CP *pr = SymValue(AsSymbol(p), m_env.m_varEnv, &symMacro); if (symMacro) { m_cVal = 1; m_r = Eval(ToSymbolMacro(symMacro)->m_macro); } else if ((m_r=*pr) == V_U) CheckSymbolValue(p); else m_cVal = 1; } #if !UCFG_LISP_FAST_EVAL_ATOMS else { m_r = p; m_cVal = 1; } #endif LAB_RET: #if !UCFG_LISP_DEBUG_FRAMES m_pStack = prevStackP; #endif return m_r; } #if UCFG_LISP_FAST_HOOKS CP CLispEng::EvalHooked(CP p) { CEvalFrame evalFrame(_self, p); if (m_bDebugFrames) { #if UCFG_LISP_SJLJ && LISP_ALLOCA_JMPBUF evalFrame.m_pJmpbuf = (jmp_buf*)alloca(sizeof(jmp_buf)); #endif // new(keepEval.m_p = (CEvalFrame*)alloca(sizeof CEvalFrame)) CEvalFrame(_self, p); //CEvalFrame frame(_self, p); LISP_TRY(evalFrame) { // m_bDebugFrames && //!!!? } LISP_CATCH(evalFrame) { if (m_cVal) m_pStack[FRAME_FORM] = m_r; p = m_pStack[FRAME_FORM]; #ifdef X_DEBUG//!!!D E_Error(); #endif } LISP_CATCH_END } if (CP hook = Spec(L_S_EVALHOOK)) { CDynBindFrame bind; bind.Bind(_self, S(L_S_EVALHOOK), 0); bind.Bind(_self, S(L_S_APPLYHOOK), 0); bind.Finish(_self, 2); Push(p); PushNestEnvAsArray(m_env); Funcall(hook, 2); return m_r; } #if UCFG_LISP_FAST_EVAL_ATOMS == 2 if (IsSelfEvaluated(p)) { m_cVal = 1; return m_r = p; } #endif return EvalImp(p); } void CLispEng::CheckBeforeSetSymVal(CP sym, CP v) { switch (sym) { case S(L_S_EVALHOOK): m_mfnEval = v ? &class_type::EvalHooked : &class_type::EvalImp; #if UCFG_LISP_FAST_EVAL_ATOMS == 2 m_maskEvalHook = v ? ((CP)0)-1 : CP((CP(2)<<(sizeof(CP)*8-VALUE_SHIFT))-2); #endif break; case S(L_S_APPLYHOOK): m_mfnApply = v ? &class_type::ApplyHooked : &class_type::ApplyImp; if (Signal) // can be set asynchronously m_mfnApply = &class_type::ApplyHooked; break; } } #endif // UCFG_LISP_FAST_HOOKS CP CLispEng::SwapIfDynSymVal(CP symWithFlags, CP v) { if (symWithFlags & FLAG_DYNAMIC) { CP sym = symWithFlags & MASK_WITHOUT_FLAGS; #if UCFG_LISP_FAST_HOOKS CheckBeforeSetSymVal(sym, v); #endif return exchange(ToSymbol(sym)->m_dynValue, v); } else return v; } void CLispEng::F_MacroFunction() { CSPtr env = ToOptionalNIL(Pop()), sym = Pop(); ToSymbol(sym); CSPtr fenv; #ifdef C_LISP_QUICK_MACRO if (Type(env) == TS_FRAME_PTR) fenv = ToFrame(env)[1]; else #endif if (env) fenv = ToVector(env)->GetElement(1); CP fun = GetSymFunction(sym, fenv); switch (Type(fun)) { case TS_SPECIALOPERATOR: m_r = GetSymProp(sym, S(L_MACRO)); break; case TS_MACRO: m_r = AsMacro(fun)->m_expander; } } void CLispEng::F_Macroexpand1() { CSPtr env = ToOptionalNIL(Pop()), varEnv, funEnv, fun , car, val; if (env) { #ifdef C_LISP_QUICK_MACRO if (Type(env) == TS_FRAME_PTR) { CP *pEnvs = ToFrame(env); varEnv = pEnvs[0]; funEnv = pEnvs[1]; } else #endif { CArrayValue *vec = ToVector(env); varEnv = vec->GetElement(0); funEnv = vec->GetElement(1); } } m_arVal[1] = 0; CP r = Pop(); switch (Type(r)) { case TS_CONS: { if (Type(car=Car(r)) != TS_SYMBOL) break; CSPtr fenv; #ifdef C_LISP_QUICK_MACRO if (Type(env) == TS_FRAME_PTR) fenv = ToFrame(env)[1]; else #endif if (env) fenv = ToVector(env)->GetElement(1); CP fun = GetSymFunction(car, fenv); switch (Type(fun)) { case TS_SPECIALOPERATOR: if ((m_r=Get(car, S(L_MACRO))) == V_U) goto LAB_RET; break; case TS_MACRO: m_r = AsMacro(fun)->m_expander; break; case TS_SYMBOL: r = Cons(S(L_FUNCALL), Cons(fun, Cdr(r))); m_arVal[1] = V_T; default: goto LAB_RET; } Push(m_r, r, env); Funcall(Spec(L_S_MACROEXPAND_HOOK), 3); r = m_r; m_arVal[1] = V_T; } break; case TS_SYMBOL: CP symMacro = 0; SymValue(AsSymbol(r), varEnv, &symMacro); if (m_arVal[1] = FromBool(symMacro)) r = ToSymbolMacro(symMacro)->m_macro; } LAB_RET: m_r = r; m_cVal = 2; } void CLispEng::Eval5Env(CP form, const CEnvironment& env) { CEnv5Frame env5Frame(_self); m_env = env; m_cVal = 1; m_r = Eval(form); } void CLispEng::Setq(CP name, CP val) { CP symMacro = 0; SetSymValue(name, m_env.m_varEnv, &symMacro, val); if (symMacro) E_ProgramErr(); } CEnv1VFrame::CEnv1VFrame() { CLispEng& lisp = Lisp(); lisp.Push(lisp.m_env.m_varEnv); Finish(lisp, FT_ENV1V, lisp.m_pStack+1); } CEnv1VFrame::~CEnv1VFrame() { CLispEng& lisp = Lisp(); lisp.m_env.m_varEnv = GetStackP(lisp)[1]; base::ReleaseStack(lisp); } CEnv1FFrame::CEnv1FFrame() { CLispEng& lisp = Lisp(); lisp.Push(lisp.m_env.m_funEnv); Finish(lisp, FT_ENV1F, lisp.m_pStack+1); } CEnv1FFrame::~CEnv1FFrame() { CLispEng& lisp = Lisp(); lisp.m_env.m_funEnv = GetStackP(lisp)[1]; base::ReleaseStack(lisp); } CEnv1BFrame::~CEnv1BFrame() { CLispEng& lisp = Lisp(); lisp.m_env.m_blockEnv = GetStackP(lisp)[1]; base::ReleaseStack(lisp); } CEnv1GFrame::CEnv1GFrame() { CLispEng& lisp = Lisp(); lisp.Push(lisp.m_env.m_goEnv); Finish(lisp, FT_ENV1G, lisp.m_pStack+1); } CEnv1GFrame::~CEnv1GFrame() { CLispEng& lisp = Lisp(); lisp.m_env.m_goEnv = GetStackP(lisp)[1]; base::ReleaseStack(lisp); } CEnv1DFrame::CEnv1DFrame() { CLispEng& lisp = Lisp(); lisp.Push(lisp.m_env.m_declEnv); Finish(lisp, FT_ENV1D, lisp.m_pStack+1); } CEnv1DFrame::~CEnv1DFrame() { CLispEng& lisp = Lisp(); lisp.m_env.m_declEnv = GetStackP(lisp)[1]; base::ReleaseStack(lisp); } CEnv2VDFrame::CEnv2VDFrame() { CLispEng& lisp = Lisp(); lisp.Push(lisp.m_env.m_declEnv); lisp.Push(lisp.m_env.m_varEnv); Finish(lisp, FT_ENV2VD, lisp.m_pStack+2); } CEnv2VDFrame::~CEnv2VDFrame() { CLispEng& lisp = Lisp(); CP *p = GetStackP(lisp)+1; lisp.m_env.m_varEnv = *p++; lisp.m_env.m_declEnv = *p; base::ReleaseStack(lisp); } CDynBindFrame::CDynBindFrame(CP syms, CP vals) { CLispEng& lisp = Lisp(); int count = 0; for (CP sym; lisp.SplitPair(syms, sym); lisp.Inc(vals), count++) Bind(lisp, sym, vals ? Car(vals) : V_U); Finish(lisp, count); } CDynBindFrame::CDynBindFrame(CP sym, CP val, bool bBind) { CLispEng& lisp = Lisp(); if (bBind) Bind(lisp, sym, val); Finish(lisp, bBind); } CDynBindFrame::~CDynBindFrame() { CLispEng& lisp = Lisp(); CP *stackP = GetStackP(lisp); CP *top = AsFrameTop(stackP); for (CP *cur = stackP+1; cur!=top; cur+=2) lisp.SetSymVal(cur[0], cur[1]); base::ReleaseStack(lisp); } void CDynBindFrame::Bind(CLispEng& lisp, CP sym, CP val) { lisp.Push(lisp.ToVariableSymbol(sym)->m_dynValue, sym); lisp.SetSymVal(sym, val); //!!! check constant } void CDynBindFrame::Finish(CLispEng& lisp, size_t count) { base::Finish(lisp, FT_DYNBIND, lisp.m_pStack+count*2); } CVarFrame::~CVarFrame() { CLispEng& lisp = Lisp(); CP *top = AsFrameTop(GetStackP(lisp)); for (; m_pVars!=top; m_pVars+=2) { CP symFlags = *m_pVars; if ((symFlags & (FLAG_ACTIVE|FLAG_DYNAMIC)) == (FLAG_ACTIVE|FLAG_DYNAMIC)) lisp.SetSymVal(symFlags & MASK_WITHOUT_FLAGS, m_pVars[1]); // symFlags already checked to be TS_SYMBOL during Bind } base::ReleaseStack(lisp); } bool __fastcall CVarFrame::Bind(CP val) { m_pVars -= 2; CP& sym = m_pVars[0]; /*!!! if (Lisp().m_bTrace) //!!! { ostream os(new CTextStreambuf(Lisp().m_arStream[CLisp::STM_TraceOutput]));//!!! os << "VALUE of "; Lisp().PrintForm(os, sym & MASK_WITHOUT_FLAGS); os << " is "; Lisp().PrintForm(os, val); os << "\n\n"; }*/ bool r = sym & FLAG_SP; sym &= ~FLAG_SP; m_pVars[1] = CLispEng::StaticSwapIfDynSymVal(sym, val); sym |= FLAG_ACTIVE; return r; } CCatchFrame::CCatchFrame(CLispEng& lisp, CP tag) { lisp.Push(tag); lisp.Push(CreateFixnum(lisp.m_pSPTop-lisp.m_pSP)); Finish(lisp, FT_CATCH, lisp.m_pStack+2); } CFunFrame::CFunFrame(CP *pTop) { CLispEng& lisp = Lisp(); lisp.Push(lisp.m_env.m_funEnv); lisp.Push(CreateFixnum((pTop-lisp.m_pStack-1)/2)); Finish(lisp, FT_FUN, pTop); } } // Lisp::
38,964
Common Lisp
.l
1,581
21.386464
156
0.613187
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
361dbf65d6f2ce79fddb5de880de1ac746bc1275d6c936b3beb5b075cd2d17ca
11,517
[ -1 ]
11,518
specialoperators.cpp
ufasoft_lisp/src/lisp/lispeng/specialoperators.cpp
#include <el/ext.h> #include "lispeng.h" namespace Lisp { void CLispEng::F_If() { LISP_TAIL_REC_DISABLE_1; CP form = Eval(SV2) ? SV1 : SV; SkipStack(3); if (form == V_U) { m_r = 0; m_cVal = 1; //!!! ClearResult(); } else { LISP_TAIL_REC_RESTORE; m_cVal = 1; m_r = Eval(form); } } bool CLispEng::CheckSetqBody(CP p) { for (CP body=SV, n; SplitPair(body, n); Inc(body)) { if (SymMacroP(n)) { CP form = Cons(p, Pop()); m_cVal = 1; m_r = Eval(form); return true; } } return false; } void CLispEng::F_Setq() { LISP_TAIL_REC_DISABLE_1; if (CheckSetqBody(S(L_SETF))) return; for (CP p=SV, sym, form; SplitPair(p, sym);) if (SplitPair(p, form)) Setq(sym, m_r = Eval(form)); else E_ProgramErr(); SkipStack(1); m_cVal = 1; } void CLispEng::F_Quote() { m_r = Pop(); } void __fastcall CLispEng::Prog() { LISP_TAIL_REC_DISABLE_1; for (CP car; SplitPair(SV, car);) { #if UCFG_LISP_TAIL_REC if (!SV) { LISP_TAIL_REC_RESTORE; } #endif m_cVal = 1; m_r = Eval(car); } SkipStack(1); } void CLispEng::F_Progn() { Progn(Pop()); } void __fastcall CLispEng::PrognNoRec(CP p) { if (p) { Push(p); ProgNoRec(); } else ClearResult(); } void CLispEng::F_Block() { CP body = Pop(), name = Pop(); ToSymbol(name); #ifdef X_DEBUG//!!!D if (g_b) { cerr << "(BLOCK "; Print(name); cerr << " " << m_pSP << endl; } #endif CIBlockFrame blockFrame(_self, name); CEnv1BFrame b1Frame(_self); m_env.m_blockEnv = CreateFramePtr(blockFrame.GetStackP(_self)); LISP_TRY(blockFrame) { Progn(body); } LISP_CATCH(blockFrame) { m_pSP = m_pSPTop-blockFrame.m_spOff; } LISP_CATCH_END #ifdef X_DEBUG//!!!D if (g_b) { cerr << "(AFTER BLOCK "; Print(name); cerr << " " << m_pSP << endl; } #endif } void CLispEng::UnwindTo(CP *frame) { for (CJmpBufBase *p = m_pJmpBuf; p; p=p->m_pNext) { if (p->GetStackP(_self) == frame) { m_bUnwinding = true; LISP_THROW(p); } } E_Error(); //!!! throw HRESULT(HR_UNWIND | (m_pStackTop-frame)); } void CLispEng::F_ReturnFrom() { LISP_TAIL_REC_DISABLE_1; CP name = SV1, env = m_env.m_blockEnv; ToSymbol(name); CP *frame, car; #ifdef X_DEBUG//!!!D if (g_b) { cerr << "(Return-From "; Print(name); cerr << endl; } #endif while (Type(env) == TS_FRAME_PTR) { frame = AsFrame(env); env = frame[FRAME_NEXT_ENV]; if (IsFrameNested(frame[0])) break; if (frame[FRAME_NAME] == name) goto LAB_FOUND; } while (SplitPair(env, car)) { if (Car(car) == name) if ((env = Cdr(car)) == V_D) E_ControlErr(IDS_E_BlockHasLeft, name); else { frame = ToFrame(env); //!!! goto LAB_FOUND; } } E_ProgramErr(IDS_E_NoSuchBlock, name); LAB_FOUND: CP p = Pop(); SkipStack(1); if (p != V_U) { m_cVal = 1; m_r = Eval(p); } UnwindTo(frame); } void CLispEng::F_Function() { CP name = SV, funname = SV1; if (name != V_U) { name = SV1; if (!FunnameP(name)) E_Error(); funname = SV; } else { if (FunnameP(funname)) { m_r = GetSymFunction(funname, m_env.m_funEnv); switch (Type(m_r)) { case TS_FUNCTION_MACRO: m_r = ToFunctionMacro(m_r)->m_function; //!!!O case TS_SUBR: case TS_INTFUNC: case TS_CCLOSURE: break; default: Print(funname); E_Error(); } SkipStack(2); return; } else name = S(L_K_LAMBDA); } if (!(Type(funname) == TS_CONS && Car(funname) == S(L_LAMBDA))) E_Error(); #ifdef _DEBUG if (Cdr(funname) == 0x0036c700) Print(Cdr(funname)); #endif m_r = GetClosure(Cdr(funname), name, false, m_env);//!!! m_cVal = 1; SkipStack(2); } CP CLispEng::SkipDeclarations(CP body) { for (; Type(body)==TS_CONS && body; Inc(body)) { CP car = Car(body); if (Type(car) != TS_CONS || Car(car) != S(L_DECLARE)) break; } return body; } void CLispEng::FinishFLet(CP *pTop, CP body) { { CFunFrame funFrame(pTop); CEnv1FFrame f1Frame; m_env.m_funEnv = CreateFramePtr(funFrame.GetStackP(_self)); PrognNoRec(SkipDeclarations(body)); } SkipStack(2); } void CLispEng::F_Flet() { CP *pTop = m_pStack; for (CP car; SplitPair(pTop[1], car);) { ToCons(car); CP name = Car(car), lambdaBody = Cdr(car); if (!FunnameP(name)) E_Error(); ToCons(lambdaBody); Push(0, name); SV1 = GetClosure(lambdaBody, name, true, m_env); } FinishFLet(pTop, pTop[0]); } void CLispEng::F_FunctionMacroFunction() { m_r = ToFunctionMacro(Pop())->m_function; } void CLispEng::F_FunctionMacroExpander() { m_r = ToFunctionMacro(Pop())->m_expander; } void CLispEng::F_MacroExpander() { m_r = ToMacro(Pop())->m_expander; } void CLispEng::F_MacroLambdaList() { m_r = ToMacro(Pop())->m_lambdaList; } void CLispEng::F_MakeFunctionMacro() { m_r = FromSValueT(CreateFunctionMacro(SV1, SV), TS_FUNCTION_MACRO); SkipStack(2); } void CLispEng::F_FunctionMacroLet() { LISP_TAIL_REC_DISABLE_1; CP *pTop = m_pStack; for (CP p=SV1, car; SplitPair(p, car);) { CP name, fun, macro; if (!SplitPair(car, name) || !SplitPair(car, fun) || !SplitPair(car, macro)) E_Error(); ToSymbol(name); ToCons(fun); ToCons(macro); Push(GetClosure(fun, name, false, m_env)); Call(S(L_MAKE_FUNMACRO_EXPANDER), name, macro); Push(m_r); F_MacroExpander(); Push(m_r); F_MakeFunctionMacro(); Push(m_r, name); } FinishFLet(pTop, pTop[0]); } void CLispEng::CallBindedFormsEx(FPBindVar pfn, CP forms, CP *pBind, int nBinds) { LISP_TAIL_REC_DISABLE_1; Push(forms); int i; for (i=0; i<nBinds; i++) { CP *p = pBind-(1+i)*2; CP val = (this->*pfn)(i, p[0], p[1]); #ifdef X_DEBUG //!!!D if (val == V_U) val = val; #endif p[1] = SwapIfDynSymVal(p[0], val); } for (i=0; i<nBinds; i++) pBind[-(1+i)*2] |= FLAG_ACTIVE; #if UCFG_LISP_TAIL_REC == 1 LISP_TAIL_REC_RESTORE #endif Progn(Pop()); } CP CLispEng::AugmentDeclEnv(CP declSpec, CP env) { CP typ = Car(declSpec); if (Type(typ) == TS_SYMBOL) for (CP p=env, spec; SplitPair(p, spec);) if (Car(spec) == S(L_DECLARATION)) for (CP list=Cdr(spec), car; SplitPair(list, car);) if (car == typ) return Cons(declSpec, env); return env; } void CLispEng::CallBindedForms(FPBindVar pfn, CP caller, CP varSpecs, CP declars, CP forms) { CVarFrame varFrame(m_pStack); CP *pBind; int nBinds; CP *pSpec = m_pStack; int nSpec = 0, nVar = 0; CP spec; for (CP declSpecs=declars; SplitPair(declSpecs, spec);) { if (Type(spec) == TS_CONS && Car(spec) == S(L_SPECIAL)) { for (Inc(spec); spec; ++nSpec) { CP sym = 0; SplitPair(spec, sym); if (Type(sym) != TS_SYMBOL) E_Error(); Push(V_SPEC, sym | FLAG_ACTIVE); } } } pBind = m_pStack; for (; SplitPair(varSpecs, spec); nVar++) { CP sym = 0, init = 0; if (Type(spec) == TS_SYMBOL && caller != S(L_SYMBOL_MACROLET)) { sym = spec; init = V_U; } else if (ConsP(spec)) { //!!! SplitPair(spec, sym); if (Type(sym) == TS_SYMBOL) SplitPair(spec, init); //!!! Check more conditions else E_Error(); } else E_Error(); Push(init, sym); CP *p = pSpec; CP toCompare = sym | FLAG_ACTIVE; bool bSpecDecl = false; for (int i=0; i<nSpec; i++) { --p; if (*--p == toCompare) { bSpecDecl = true; break; } } if (caller == S(L_SYMBOL_MACROLET)) { if (bSpecDecl || (ToSymbol(sym)->m_fun & SYMBOL_FLAG_SPECIAL)) E_Error(); } else if ((ToVariableSymbol(sym)->m_fun & SYMBOL_FLAG_SPECIAL) || bSpecDecl) //!!!? FLAG_CONSTANT SV |= FLAG_DYNAMIC; } nBinds = nVar; nVar += nSpec; Push(m_env.m_varEnv, CreateFixnum(nVar)); varFrame.Finish(_self, pSpec); varFrame.m_pVars -= nBinds*2;//!!! CP pVarFrame = CreateFramePtr(m_pStack); Push(forms, declars); CP denv = m_env.m_declEnv; for (; SplitPair(SV, spec);) if (ConsP(spec) && Car(spec) != S(L_SPECIAL)) //!!! denv = AugmentDeclEnv(spec, denv); SkipStack(2); if (denv == m_env.m_declEnv) { CEnv1VFrame vFrame; m_env.m_varEnv = pVarFrame; CallBindedFormsEx(pfn, forms, pBind, nBinds); } else { CEnv2VDFrame vdFrame; m_env.m_declEnv = denv; m_env.m_varEnv = pVarFrame; CallBindedFormsEx(pfn, forms, pBind, nBinds); } } CP CLispEng::BindLet(size_t n, CP& sym, CP form) { return form==V_U ? 0 : Eval(form); } CP CLispEng::BindLetA(size_t n, CP& sym, CP form) { CP r = form==V_U ? 0 : Eval(form); sym |= FLAG_ACTIVE; return r; } CEnvironment *CLispEng::NestEnv(CEnvironment& penv) { CEnvironment *env5 = (CEnvironment*)(m_pStack -= 5); *env5 = penv; //!!! was m_env CP env = env5->m_goEnv; CP *fr; int depth = 0; while (Type(env) == TS_FRAME_PTR) { fr = AsFrame(env); if (!IsFrameNested(fr[0])) { Push(env); //!!!D env = fr[FRAME_TAG_NEXT_ENV]; depth++; } env = fr[FRAME_TAG_NEXT_ENV]; } while (depth--) { CP frame = SV; fr = AsFrame(frame); SV = env; CP *tags = fr+FRAME_TAG_BINDINGS, *top = AsFrameTop(fr); ssize_t count = (top-tags)/2; CArrayValue *vv = CreateVector(count); for (int i=0; i<count; i++) vv->m_pData[i] = tags[i*2]; fr[FRAME_TAG_NEXT_ENV] = env = Cons(Cons(FromSValue(vv), frame), SV); SkipStack(1); fr[0] = fr[0] | (FLAG_NESTED << VALUE_SHIFT); } env5->m_goEnv = env; env = env5->m_blockEnv; depth = 0; while (Type(env) == TS_FRAME_PTR) { fr = AsFrame(env); if (!IsFrameNested(fr[0])) { Push(env); //!!!D env = fr[FRAME_NEXT_ENV]; depth++; } env = fr[FRAME_NEXT_ENV]; } while (depth--) { CP frame = SV; fr = AsFrame(frame); fr[FRAME_NEXT_ENV] = env = Cons(Cons(fr[FRAME_NAME], frame), env); SkipStack(1); fr[0] = fr[0] | (FLAG_NESTED << VALUE_SHIFT); } env5->m_blockEnv = env; env5->m_funEnv = NestFun(env5->m_funEnv); env5->m_varEnv = NestVar(env5->m_varEnv); return env5; } void CLispEng::PushNestEnvAsArray(CEnvironment& env) { NestEnv(env); CArrayValue *av = CreateVector(5); memcpy(av->m_pData, m_pStack, 5*sizeof(CP)); SkipStack(5); Push(FromSValue(av)); } void CLispEng::PushNestEnv(CEnvironment& env) { CEnvironment *senv = NestEnv(env); swap(senv->m_declEnv, senv->m_varEnv); swap(senv->m_goEnv, senv->m_funEnv); } bool CLispEng::ParseCompileEvalForm(size_t skip) { CP compileName = ParseDD(SV, false); if (compileName == V_0) return false; SkipStack(skip); Push(SV1); //!!! (was SV1 - form in EVAL frame) PushNestEnv(m_env); int nArgs = 6; if (compileName != V_U) { Push(compileName); ++nArgs; } Apply(S(L_COMPILE_FORM), nArgs, 0); Call(m_r); return true; } void CLispEng::GeneralLet(FPBindVar pfn) { if (ParseCompileEvalForm(2)) return; SkipStack(1); CallBindedForms(pfn, S(L_LET), Pop(), m_arVal[1], m_r); } void CLispEng::F_Let() { GeneralLet(&CLispEng::BindLet); } void CLispEng::F_LetA() { GeneralLet(&CLispEng::BindLetA); } void CLispEng::F_CompilerLet() { CP *pStack = m_pStack; size_t count = 0; for (CP p=pStack[1], car; SplitPair(p, car); count++) { if (ConsP(car)) { CP v; SplitPair(car, v); ToVariableSymbol(v); if (!SplitPair(car, v)) v = 0; if (car) E_ProgramErr(); Push(Eval(v)); } else { ToVariableSymbol(car); Push(0); } } { CDynBindFrame dynBind; int i = 0; for (CP p=pStack[1], car; SplitPair(p, car); i++) dynBind.Bind(_self, ConsP(car) ? Car(car) : car, m_pStack[-i-1]); dynBind.Finish(_self, count); Progn(pStack[0]); } m_pStack = pStack+2; } void CLispEng::F_Catch() { SV1 = Eval(SV1); CP body = Pop(); CCatchFrame catchFrame(_self, Pop()); LISP_TRY(catchFrame) { Progn(body); } LISP_CATCH(catchFrame) { } LISP_CATCH_END; #if UCFG_WIN32 if (StackOverflowAddress) { DWORD old; Win32Check(::VirtualProtect(StackOverflowAddress, 1, PAGE_READWRITE|PAGE_GUARD, &old)); StackOverflowAddress = 0; } #endif } void CLispEng::ThrowTo(CP tag) { const DWORD testVal = (FT_CATCH<<TYPE_BITS)|TS_FRAMEINFO, mask = (FRAME_TYPE_MASK<<TYPE_BITS) | 0x1F; for (CP *p=m_pStack; p!=m_pStackTop; p++) if ((*p & mask)==testVal && p[FRAME_TAG]==tag) UnwindTo(p); E_ControlErr(IDS_E_NoSuchThrow, tag); } void CLispEng::F_EvalWhen() { for (CP p=SV1, sit; SplitPair(p, sit);) { if (sit==S(L_EVAL) || sit==S(L_K_EXECUTE)) goto found; if (Type(sit)==TS_CONS && Car(sit)==S(L_NOT)) { sit = Cdr(sit); if (sit==S(L_COMPILE) || sit==S(L_K_COMPILE_TOPLEVEL)) goto found; } } SkipStack(2); return; found: F_Progn(); //!!! SkipStack(1); } void CLispEng::F_Macrolet() { LISP_TAIL_REC_DISABLE_1; CP *pTop = m_pStack; for (CP p=pTop[1], car; SplitPair(p, car);) { CP name = Car(car); ToSymbol(name); ToCons(Cdr(car)); Push(car, 0); PushNestEnvAsArray(m_env); CEnvironment *penv = (CEnvironment*)AsArray(SV)->m_pData; penv->m_varEnv = Cons(S(L_MACROLET), penv->m_varEnv); penv->m_funEnv = Cons(S(L_MACROLET), penv->m_funEnv); Funcall(S(L_MAKE_MACRO_EXPANDER), 3); Push(m_r, name); } FinishFLet(pTop, pTop[0]); } void CLispEng::F_Labels() { LISP_TAIL_REC_DISABLE_1; Push(NestFun(m_env.m_funEnv)); int veclen = 1; CP funspecs = SV2, car = 0; for (; SplitPair(funspecs, car); veclen+=2) { CP name; if (!SplitPair(car, name) || !FunnameP(name) || (Type(car) != TS_CONS || !car)) //!!! E_Error(); } CArrayValue *vv = CreateVector(veclen); CP *p = vv->m_pData; funspecs = SV2; for (; SplitPair(funspecs, car); p+=2) *p = Car(car); *p = Pop(); CP body = Pop(); funspecs = Pop(); CEnv1FFrame f1Frame; m_env.m_funEnv = FromSValue(vv); Push(body, m_env.m_funEnv); int index = 1; for (; SplitPair(funspecs, car); index+=2) { Push(funspecs); CP fun = GetClosure(Cdr(car), Car(car), true, m_env); funspecs = Pop(); ToArray(SV)->m_pData[index] = fun; } SkipStack(1); Progn(SkipDeclarations(Pop())); } void CLispEng::F_LoadTimeValue() { Eval5Env(SV1, CEnvironment()); SkipStack(2); m_cVal = 1; } void CLispEng::F_Locally() { LISP_TAIL_REC_KEEPER(false); if (ParseCompileEvalForm(1)) return; CallBindedForms(0, 0, 0, m_arVal[1], m_r); //!!! Check SP } void CLispEng::F_MultipleValueCall() { LISP_TAIL_REC_DISABLE_1; CP fun = SV1 = Eval(SV1); size_t count = 0; for (CP forms=SV, car; SplitPair(forms, car);) { m_cVal = 1; m_r = Eval(car); count += m_cVal; MvToStack(); } Apply(fun, count, 0); SkipStack(2); } void CLispEng::F_MultipleValueProg1() { LISP_TAIL_REC_DISABLE_1; m_cVal = 1; m_r = Eval(SV1); CP body = Pop(); SkipStack(1); size_t cVal = m_cVal; MvToStack(); Push(body); ProgNoRec(); StackToMv(cVal); } void CLispEng::F_Progv() { LISP_TAIL_REC_DISABLE_1; SV2 = Eval(SV2); m_cVal = 1; m_r = Eval(SV1); CP body = Pop(); SkipStack(1);//!!! CDynBindFrame frame(Pop(), m_r); PrognNoRec(body); } CP CLispEng::BindSymbolMacrolet(size_t n, CP& sym, CP form) { return FromSValueT(CreateSymbolMacro(form), TS_SYMBOLMACRO); } void CLispEng::F_SymbolMacrolet() { LISP_TAIL_REC_DISABLE_1; if (ParseCompileEvalForm(2)) return; SkipStack(1); CallBindedForms(&CLispEng::BindSymbolMacrolet, S(L_SYMBOL_MACROLET), Pop(), m_arVal[1], m_r); } class CITagbodyFrame : public CJmpBuf { public: CITagbodyFrame(CP *pTop) { CLispEng& lisp = Lisp(); lisp.Push(lisp.m_env.m_goEnv); Finish(lisp, FT_ITAGBODY, pTop); } }; void CLispEng::F_Tagbody() { LISP_TAIL_REC_DISABLE_1; CP body = Pop(); CEnv1GFrame goFrame; int count = 0; for (CP bodyrest=body, car; SplitPair(bodyrest, car);) { switch (Type(car)) { case TS_SYMBOL: case TS_FIXNUM: Push(bodyrest, car); count++; case TS_CONS: if (!car) //!!! break; break; default: E_Error(); } } if (count) { CITagbodyFrame tagbodyFrame(goFrame.GetStackP(_self)); m_env.m_goEnv = CreateFramePtr(m_pStack); while (true) { LISP_TRY(tagbodyFrame) { Push(body); for (CP car; SplitPair(SV, car);) if (ConsP(car)) { m_cVal = 1; m_r = Eval(car); } SkipStack(1); break; } LISP_CATCH(tagbodyFrame) { m_pStack = tagbodyFrame.GetStackP(_self); body = m_r; } LISP_CATCH_END } } else { Push(body); //!!! possible to free ENV1G ProgNoRec(); } ClearResult(); } void CLispEng::F_Go() { CP *frame, tag = Pop(); switch (Type(tag)) { case TS_SYMBOL: case TS_FIXNUM: break; default: E_Error(); } CP env = m_env.m_goEnv, car = 0; while (Type(env) == TS_FRAME_PTR) { frame = AsFrame(env); env = frame[FRAME_TAG_NEXT_ENV]; if (IsFrameNested(frame[0])) break; CP *top = AsFrameTop(frame); for (CP *binds=frame+FRAME_TAG_BINDINGS; binds!=top; binds+=2) if (Eql(*binds, tag)) { m_r = binds[1]; goto LAB_FOUND; } } while (SplitPair(env, car)) { CArrayValue *av = ToArray(Car(car)); for (size_t i=0; i<av->TotalSize(); ++i) if (av->m_pData[i] == tag) { //!!! must be EQL env = Cdr(car); if (env == V_D) E_ProgramErr(); frame = ToFrame(env);//!!! m_r = frame[FRAME_TAG_BINDINGS+1+2*i]; goto LAB_FOUND; } } E_ProgramErr(); LAB_FOUND: UnwindTo(frame); } void CLispEng::F_The() { m_cVal = 1; m_r = Eval(Pop()); MvToList(); CP typ = SV; Push(m_r, m_r); Call(S(L_TYPE_FOR_DISCRIMINATION), typ); Push(m_r); Funcall(S(L_PTHE), 2); if (!m_r) E_TypeErr(SV, typ); ListToMv(Pop()); SkipStack(1); } void CLispEng::F_Throw() { LISP_TAIL_REC_DISABLE_1; SV1 = Eval(SV1); m_cVal = 1; m_r = Eval(Pop()); ThrowTo(Pop()); } class CUnwindProtectFrame : public CFrameBaseEx { typedef CFrameBaseEx base; public: CUnwindProtectFrame(CP *pTop) { Finish(Lisp(), FT_UNWINDPROTECT, pTop); } ~CUnwindProtectFrame() { CLispEng& lisp = Lisp(); lisp.m_pStack = GetStackP(lisp); CP cleanup = lisp.SV1; //!!! optimize Stack size_t cVal = lisp.m_cVal; lisp.MvToStack(); lisp.Push(cleanup); lisp.Prog(); lisp.StackToMv(cVal); base::ReleaseStack(lisp); } }; void CLispEng::F_UnwindProtect() { LISP_TAIL_REC_DISABLE_1; CP cleanup = Pop(), form = Pop(); Push(cleanup); CUnwindProtectFrame unwindProtectFrame(m_pStack+1); #ifdef _X_DEBUG //!!!D cerr << endl; Print(form); #endif m_cVal = 1; m_r = Eval(form); } void CLispEng::F_Declare() { SkipStack(1); //!!! } } // Lisp::
17,917
Common Lisp
.l
775
20.513548
98
0.640947
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
fa4f730c458b3f323d535a671954c35b926773f08e6c5195b90c6ede676eea0c
11,518
[ -1 ]
11,519
f_list.cpp
ufasoft_lisp/src/lisp/lispeng/f_list.cpp
#include <el/ext.h> #include "lispeng.h" namespace Lisp { void CLispEng::F_Cons() { m_r = Cons(SV1, SV); SkipStack(2); } void CLispEng::F_Car() { m_r = Car(Pop()); } void CLispEng::F_Cdr() { m_r = Cdr(Pop()); } void CLispEng::F_Null() { // NULL/NOT m_r = FromBool(!Pop()); } void CLispEng::F_Atom() { m_r = FromBool(!ConsP(Pop())); } CP CLispEng::GetSymProp(CP sym, CP name) { // returns NIL if not fount for (CP p=ToSymbol(sym)->GetPropList(), car; SplitPair(p, car); Inc(p)) if (car == name) return Car(p); return 0; } CP CLispEng::Get(CP sym, CP name) { // returns V_U if not fount for (CP p=ToSymbol(sym)->GetPropList(), car; SplitPair(p, car); Inc(p)) if (car == name) return Car(p); return V_U; } void CLispEng::F_Get() { if ((m_r=Get(SV2, SV1)) == V_U) m_r = ToOptionalNIL(SV); SkipStack(3); } /*!!!R void CLispEng::Putf(CSPtr& plist, CP p, CP v) { for (CP q=plist, car; SplitPair(q, car); Inc(q)) if (car == p) { AsCons(q)->m_car = v; return; } Push(p, v, plist); plist = ListofEx(3); } */ CP& CLispEng::PlistFind(CP& p, CP k) { CP *q = &p; for (; ConsP(*q) && Car(*q)!=k ; q=&AsCons(*q)->m_cdr) if (!ConsP(*(q=&AsCons(*q)->m_cdr))) E_Error(); return *q; } void CLispEng::F_Getf() { if (CP tail = PlistFind(SV2, SV1)) m_r = ToCons(Cdr(tail))->m_car; else m_r = ToOptionalNIL(SV); //!!!R m_r = Getf(SV2, SV1, SV==V_U ? 0 : SV); SkipStack(3); } void CLispEng::F_PRemf() { if (CP& tail = PlistFind(SV1, SV)) { CP p = Cdr(tail); if (!ConsP(p)) E_Error(); Inc(p); if (ConsP(p)) *AsCons(tail) = *AsCons(p); else tail = p; m_arVal[1] = V_T; } else m_arVal[1] = 0; m_r = SV1; m_cVal = 2; SkipStack(2); } void CLispEng::F_PPutf() { if (CP tail = PlistFind(SV2, SV1)) ToCons(Cdr(tail))->m_car = SV; else { CP cons1 = Cons(0, Cons(0, 0)); CConsValue *pcons2 = AsCons(Cdr(cons1)); if (ConsP(SV2)) { pcons2->m_car = Car(SV2); pcons2->m_cdr = Cdr(SV2); AsCons(SV2)->m_car = SV1; AsCons(SV2)->m_cdr = cons1; AsCons(cons1)->m_car = SV; } else { pcons2->m_car = SV; pcons2->m_cdr = SV2; AsCons(m_r=cons1)->m_car = SV1; } } SkipStack(3); } void CLispEng::F_PPut() { CP plist = ToSymbol(SV2)->GetPropList(); if (CP tail = PlistFind(plist, SV1)) ToCons(Cdr(tail))->m_car = SV; else AsSymbol(SV2)->SetPropList(Cons(SV1, Cons(SV, plist))); m_r = SV; SkipStack(3); } void CLispEng::F_Memq() { CP q = Pop(), p = Pop(), car = 0; do { m_r = q; } while (SplitPair(q, car) && car!=p); } void CLispEng::F_SymbolPList() { m_r = ToSymbol(Pop())->GetPropList(); } void CLispEng::F_PPutPlist() { m_r = Pop(); ToSymbol(Pop())->SetPropList(m_r); } void CLispEng::F_List(size_t nArgs) { m_r = Listof(nArgs); } void CLispEng::F_ListEx(size_t nArgs) { m_r = ListofEx(nArgs+1); } void CLispEng::F_NthCdr() { CP p = Pop(); for (size_t n=AsPositive(Pop()); n && p; n--) p = Cdr(p); m_r = p; } pair<CP, CP> CLispEng::ListLength(CP p) { int n = 0; for (CP slow=p; ConsP(p); p=Cdr(p), slow=Cdr(slow), n++) { p = Cdr(p); n++; if (!ConsP(p)) break; if (p == slow) return pair<CP, CP>(0, 0); } Push(p); CP len = CreateInteger(n); return pair<CP, CP>(len, Pop()); } void CLispEng::F_ListLength() { pair<CP, CP> pp = ListLength(Pop()); if (pp.second) E_Error(); m_r = pp.first; } void CLispEng::F_ListLengthDotted() { pair<CP, CP> pp = ListLength(Pop()); if (pp.first) { m_r = pp.first; m_arVal[1] = pp.second; m_cVal = 2; } } void CLispEng::F_CopyList() { m_r = CopyList(Pop()); } void CLispEng::F_PProperList() { pair<CP, CP> pp = ListLength(Pop()); m_r = pp.first; m_arVal[1] = pp.second; m_cVal = 2; } void CLispEng::F_Append(size_t nArgs) { if (!nArgs) return; int count = 0; CP *pStack = m_pStack; for (size_t i=nArgs-1; i>0; i--) for (CP p=pStack[i], car; SplitPair(p, car); count++) Push(car); Push(pStack[0]); m_r = ListofEx(count+1); SkipStack(nArgs); } void CLispEng::F_Nconc(size_t nArgs) { if (!nArgs) return; m_r = Pop(); while (--nArgs) { if (CP p = Pop()) { if (!ConsP(p)) E_TypeErr(p, S(L_LIST)); CP r = p; for (CP q; ConsP(q=Cdr(r));) r = q; AsCons(r)->m_cdr = exchange(m_r, p); } } } void CLispEng::F_NReconc() { m_r = Pop(); for (CP p=Pop(); p;) m_r = exchange(p, exchange(ToCons(p)->m_cdr, m_r)); } void CLispEng::Map(CMapCB& mapCB, CP *pStack, size_t nArgs, bool bCar) { CP fun = pStack[nArgs] = FromFunctionDesignator(pStack[nArgs]); while (true) { for (size_t i=nArgs; i--;) { if (CP p = pStack[i]) { if (bCar) Push(Car(p)); else Push(p); pStack[i] = Cdr(p); } else return; } Apply(fun, nArgs); mapCB.OnResult(m_r); } } class CMapCarCB : public CLispEng::CMapCB { public: CListConstructor m_lc; ~CMapCarCB() { Lisp().m_r = m_lc; } void OnResult(CP x) { m_lc.Add(x); } }; void CLispEng::F_MapCar(size_t nArgs) { CP *pStack = m_pStack; { CMapCarCB cb; Map(cb, pStack, nArgs+1, true); } SkipStack(nArgs+2); } void CLispEng::F_MapList(size_t nArgs) { CP *pStack = m_pStack; { CMapCarCB cb; Map(cb, pStack, nArgs+1, false); } SkipStack(nArgs+2); } void CLispEng::F_MapCan(size_t nArgs) { CP *pStack = m_pStack; { CMapCarCB cb; Map(cb, pStack, nArgs+1, true); } SkipStack(nArgs+2); size_t count = 0; for (CP car; SplitPair(m_r, car); count++) Push(car); ClearResult(); F_Nconc(count); } void CLispEng::F_MapCon(size_t nArgs) { CP *pStack = m_pStack; { CMapCarCB cb; Map(cb, pStack, nArgs+1, false); } SkipStack(nArgs+2); DWORD count = 0; for (CP car; SplitPair(m_r, car); count++) Push(car); ClearResult(); F_Nconc(count); } void CLispEng::F_MapC(size_t nArgs) { Push(m_pStack[nArgs]); CP *pStack = m_pStack; { CMapCB cb; Map(cb, m_pStack+1, nArgs+1, true); } m_pStack = pStack; //!!! m_r = Pop(); SkipStack(nArgs+2); } void CLispEng::F_MapL(size_t nArgs) { Push(m_pStack[nArgs]); CP *pStack = m_pStack; { CMapCB cb; Map(cb, m_pStack+1, nArgs+1, false); } m_pStack = pStack; //!!! m_r = Pop(); SkipStack(nArgs+2); } void CLispEng::F_MakeList() { CP el = ToOptionalNIL(SV); size_t len = AsPositive(SV1); m_r = 0; while (len--) m_r = Cons(el, m_r); SkipStack(2); } void CLispEng::MemberAssoc(bool bMember) { #ifdef _X_DEBUG//!!!D static int count = 0; if (!(++count % 100)) { cerr << "\n"; Print(SV3); cerr << "\n"; } #endif bool bTestNot; CP key = ToOptionalNIL(SV2), tf = FromFunctionDesignator((bTestNot = ToOptionalNIL(SV)) ? SV : ToOptional(SV1, g_fnEql)); if (key) key = FromFunctionDesignator(key); for (CP car, prev; SplitPair(prev=SV3, car); SV3=prev) { if (bMember) m_r = car; else if (!car) continue; else m_r = Car(car); if (key) { Push(m_r); Apply(key, 1); } bool b; if (tf == g_fnEql) b = Eql(SV4, m_r); else if (tf == g_fnEq) b = SV4==m_r; else if (tf == g_fnEqual) b = Equal(SV4, m_r); else { Push(SV4, m_r); Apply(tf, 2); b = m_r; } if (b ^= bTestNot) { if (!bMember) SV3 = car; // result break; } } m_r = SV3; m_cVal = 1; SkipStack(5); } // (MEMBER item list &key key test test-not) void CLispEng::F_Member() { MemberAssoc(true); } // (ASSOC item list &key key test test-not) void CLispEng::F_Assoc() { MemberAssoc(false); } void CLispEng::F_NSublis() { m_r = SV3; if (CP key = ToOptionalNIL(SV2)) Call(key, m_r); Push(m_r, SV4, V_U, SV1, SV); F_Assoc(); if (m_r) m_r = Cdr(m_r); else { if (ConsP(SV3)) { Push(SV4, Car(SV3), SV2, SV1, SV); F_NSublis(); AsCons(SV3)->m_car = m_r; Push(SV4, Cdr(SV3), SV2, SV1, SV); F_NSublis(); AsCons(SV3)->m_cdr = m_r; } m_r = SV3; } SkipStack(5); } } // Lisp::
7,715
Common Lisp
.l
382
17.819372
94
0.607305
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
5f8929627a7c38ed19e82fc5fb28875d179b92feb47ef3031141dcfc5bfde79e
11,519
[ -1 ]
11,520
f_hashtable.cpp
ufasoft_lisp/src/lisp/lispeng/f_hashtable.cpp
/*###### Copyright (c) 1997-2012 Ufasoft http://ufasoft.com mailto:[email protected] ########################################## # 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 3, 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, see <http://www.gnu.org/licenses/> # ########################################################################################################################################*/ #include <el/ext.h> #include "lispeng.h" namespace Lisp { /*!!!R size_t CLispEng::HashString(RCString s) { size_t sum = 0; for (int i=0; i<s.Length; i++) sum += s[i]; return sum; } */ CHashTable::CHashTable() : m_pMap(new CHashMap) { m_type = TS_HASHTABLE; } void CHashMap::SetTestFun(CP test) { CLispEng& lisp = Lisp(); if (test == g_fnEq) test = S(L_EQ); else if (test == g_fnEql) test = S(L_EQL); else if (test == g_fnEqual) test = S(L_EQUAL); else if (test == g_fnEqualP) test = S(L_EQUALP); m_func = test; } void CHashMap::Write(BlsWriter& wr) { (wr << m_func).WriteSize(size()); for (iterator i=begin(); i!=end(); ++i) wr << i->first << i->second; } void CHashMap::Read(const BlsReader& rd) { CSPtr test; rd >> test; SetTestFun(test); size_t size = rd.ReadSize(); while (size--) { CSPtr key, val; rd >> key >> val; insert(make_pair(key, val)); } } void CLispEng::F_GetHash() { CHashMap& m = *ToHashTable(SV1)->m_pMap; CHashMap::iterator i = m.find(SV2); m_r = (m_arVal[1]=FromBool(i!=m.end())) ? i->second : ToOptionalNIL(SV); SkipStack(3); m_cVal = 2; } CP CLispEng::GetHash(CP key, CP ht) { Push(key, ht, 0); F_GetHash(); m_cVal = 1; return m_r; } #ifdef _DEBUG//!!!D int g_count; #endif void CLispEng::F_PutHash() { #ifdef _X_DEBUG//!!!D if (Type(SV2)==TS_CONS && Type(Car(SV2))==TS_OBJECT && Type(Cdr(SV2))==TS_OBJECT) m_r = m_r; #endif CHashMap& m = *ToHashTable(SV1)->m_pMap; m[SV2] = SV; m_r = Pop(); SkipStack(2); #ifdef _DEBUG//!!!D g_count++; #endif } void CLispEng::F_RemHash() { ToHashTable(SV)->m_pMap->erase(SV1); SkipStack(2); ClearResult(); } /*!!! void CLispEng::F_MapHash() { CHashTable *ht = ToHashTable(GetStack(0)); Push(0); for (CHashTable::CHashMap::CIterator i(m_map); i; i++) SetStack(0, AppendEx(GetStack(0), i.Val)); for (CP car; SplitPair(m_pStack[0], car);) { Push(Car(car)); Push(Cdr(car)); Funcall(GetStack(4), 2); } SkipStack(3); ClearResult(); } */ void CLispEng::F_HashTableSize() { m_r = CreateInteger((int)ToHashTable(Pop())->m_pMap->size()); //!!! } void CLispEng::F_HashTableRehashSize() { m_r = ToHashTable(Pop())->m_rehashSize; } void CLispEng::F_HashTableRehashThreshold() { m_r = ToHashTable(Pop())->m_rehashThreshold; } void CLispEng::F_HashTableTest() { m_r = ToHashTable(Pop())->m_pMap->m_func; } void CLispEng::F_ClrHash() { ToHashTable(m_r = Pop())->m_pMap->clear(); } void CLispEng::F_HashTableCount() { m_r = CreateInteger((int)ToHashTable(Pop())->m_pMap->size()); } void CLispEng::F_HashTableIterator() { CHashMap& m = *ToHashTable(Pop())->m_pMap; CListConstructor lc; #ifdef X_DEBUG//!!!D set<CP> sorted; for (CHashMap::iterator i=m.begin(), e=m.end(); i!=e; ++i) sorted.insert(i->first); for (set<CP>::iterator i=sorted.begin(), e=sorted.end(); i!=e; ++i) lc.Add(Cons(*i, m[*i])); #else for (CHashMap::iterator i=m.begin(), e=m.end(); i!=e; ++i) lc.Add(Cons(i->first, i->second)); #endif m_r = Cons(0, lc); } void CLispEng::F_HashTableIterate() { CConsValue *cons = ToCons(Pop()); if (cons->m_cdr) { CP car; SplitPair(cons->m_cdr, car); m_r = V_T; m_arVal[1] = Car(car); m_arVal[2] = Cdr(car); m_cVal = 3; } } size_t CLispEng::HashEq(CP p) { #ifdef X_DEBUG//!!!D if (Type(p) == TS_OBJECT) p = p; #endif return AsIndex(p); } size_t CLispEng::HashEql(CP p) { switch (Type(p)) { case TS_RATIO: case TS_COMPLEX: { CConsValue *cons = AsCons(p); return HashEql(cons->m_car) ^ HashEql(cons->m_cdr); } case TS_BIGNUM: return hash<BigInteger>()(AsBignum(p)->m_int); case TS_FLONUM: return hash<double>()(AsFloat(p)->m_d); } return HashEq(p); } static const byte s_depth2rot[4] = { 16, 7, 5, 3 }; size_t CLispEng::HashcodeCons(CP p, int depth) { switch (Type(p)) { case TS_CONS: if (p) return depth==4 ? 1 : RotlSizeT(HashcodeCons(AsCons(p)->m_car, depth+1), s_depth2rot[depth]) ^ HashcodeCons(AsCons(p)->m_cdr, depth+1); default: return HashEql(p); } } size_t CLispEng::HashEqual(CP p) { // also for EQUALP switch (Type(p)) { case TS_ARRAY: { size_t hv = 0; CArrayValue *av = AsArray(p); for (size_t i=av->TotalSize(); i--;) hv += HashEql(av->GetElement(i)); return hv; } case TS_PATHNAME: { CPathname *pn = AsPathname(p); size_t hv = HashEqual(pn->m_host)+HashEqual(pn->m_dir)+HashEqual(pn->m_name)+HashEqual(pn->m_type)+HashEqual(pn->m_ver); if (!pn->LogicalP) hv += HashEqual(pn->m_dev); return hv; } default: return HashcodeCons(p); } } size_t CLispEng::SxHash(CP p) { return HashEqual(p); } void CLispEng::F_SxHash() { m_r = CreateFixnum(SxHash(Pop()) & (FIXNUM_LIMIT-1)); } void CLispEng::F_MakeHashTable() { SkipStack(4); CHashTable *ht = CreateHashTable(); ht->m_rehashThreshold = ToOptional(SV1, V_1); ht->m_rehashSize = ToOptional(SV2, V_1); CHashMap& hm = *ht->m_pMap; hm.SetTestFun(ToOptional(SV4, S(L_EQL))); for (CP inits=ToOptionalNIL(SV), c; SplitPair(inits, c);) { CConsValue *cons = AsCons(c); hm.insert(make_pair(cons->m_car, cons->m_cdr)); } m_r = FromSValue(ht); SkipStack(5); } // For 1 < n <= 16, // (hash-tuple-function n ...) = // (cons (hash-tuple-function n1 ...) (hash-tuple-function n2 ...)) */ static const byte s_tupleHalf1[17] = { 0, 0, 1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 4, 5, 6, 7, 8 }, s_tupleHalf2[17] = { 0, 0, 1, 2, 2, 3, 4, 4, 4, 5, 6, 7, 8, 8, 8, 8, 8 }; bool CLispEng::EqualTuple(CP p, size_t n, CP *pRest) { if (n == 1) return p == pRest[-1]; else if (!ConsP(p)) return false; else if (n <= 16) { size_t n1 = s_tupleHalf1[n]; return EqualTuple(Car(p), n1, pRest) && EqualTuple(Cdr(p), s_tupleHalf2[n], pRest-n1); } if (!EqualTuple(Car(p), 8, pRest)) return false; Inc(p); if (!ConsP(p) || !EqualTuple(Car(p), 4, pRest-8)) return false; Inc(p); if (!ConsP(p) || !EqualTuple(Car(p), 2, pRest-12)) return false; Inc(p); n -= 14; pRest -= 14; for (; n--; Inc(p), pRest--) if (!ConsP(p) || Car(p)!=pRest[-1]) return false; return !p; } bool CLispEng::EqualTuple(CP p, CP q) { if (Type(p) == TS_STACK_RANGE) swap(p, q); pair<int, int> pp = FromStackRange(q); return EqualTuple(p, pp.second, m_pStackBase+pp.first); } size_t CLispEng::HashcodeTuple(size_t n, CP *pRest, int depth) { if (n == 1) return HashEq(pRest[-1]); //!!! (size_t)AsFixnum( TheClass(pRest[-1]).Hashcode); else if (n <= 16) { size_t n1 = s_tupleHalf1[n]; return RotlSizeT(HashcodeTuple(n1, pRest, depth+1), s_depth2rot[depth]) ^ HashcodeTuple(s_tupleHalf2[n], pRest-n1, depth+1); } return RotlSizeT(HashcodeTuple(8, pRest, 1), 16) ^ RotlSizeT(HashcodeTuple(4, pRest-8, 2), 7) ^ RotlSizeT(HashcodeTuple(2, pRest-12, 3), 5) ^ RotlSizeT(HashcodeTuple(1, pRest-14, 4), 3) ^ 1; } void CLispEng::F_ClassTupleGethash(size_t nArgs) { CP *pRest = m_pStack + ++nArgs; for (int i=0; i<nArgs; i++) { Push(pRest[-1-i]); F_ClassOf(); pRest[-1-i] = m_r; } CHashMap& hm = *ToHashTable(pRest[0])->m_pMap; CHashMap::iterator i = hm.find(CreateStackRange(pRest-m_pStackBase, nArgs)); m_r = i != hm.end() ? i->second : 0; m_pStack = pRest+1; } } // Lisp::
8,072
Common Lisp
.l
282
26.539007
138
0.630323
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
a9767613fe1e5dff329c5471c329b1a30f41ca60e355de49bad607d2c20fac62
11,520
[ -1 ]
11,521
f_file.cpp
ufasoft_lisp/src/lisp/lispeng/f_file.cpp
/*###### Copyright (c) 1999-2015 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] #### # # # See LICENSE for licensing information # #####################################################################################################################################*/ #include <el/ext.h> #include "lispeng.h" namespace Lisp { void CLispEng::F_FileWriteDate() { path p = FromPathnameDesignator(SV); if (exists(p)) m_r = ToUniversalTime(last_write_time(p)); else E_FileErr(SV); SkipStack(1); } void CLispEng::F_Directory() { path filespec = FromPathnameDesignator(Pop()), dir = filespec.parent_path(); //!!!TODO process wildcards vector<path> files; error_code ec; for (directory_iterator it(dir, ec), e; it!=e; it.increment(ec)) files.push_back(it->path()); if (ec) return void(m_r = 0); for (size_t i=0; i<files.size(); ++i) Push(CreatePathname(files[i])); m_r = Listof(files.size()); } void CLispEng::F_ProbeFile() { path p = FromPathnameDesignator(Pop()); if (exists(p)) { Push(CreateString(p.native())); F_Pathname(); } } void CLispEng::F_FileAuthor() { path p = FromPathnameDesignator(SV); if (!exists(p)) E_FileErr(SV); SkipStack(1); } void CLispEng::F_DeleteFile() { error_code ec; sys::remove(FromPathnameDesignator(SV), ec); if (ec) E_FileErr(SV); m_r = V_T; SkipStack(1); } path CLispEng::GetDirectoryName(CP pathname) { Call(S(L_MERGE_PATHNAMES), pathname); CPathname *pn = ToPathname(m_r); pn->m_name = 0; pn->m_type = 0; pn->m_ver = 0; Call(S(L_NAMESTRING), m_r); return AsTrueString(m_r).ToOsString(); } void CLispEng::F_EnsureDirectoriesExist() { bool bVerbose = ToOptionalNIL(Pop()); path s = GetDirectoryName(SV); if (is_directory(s)) m_arVal[1] = 0; else { if (bVerbose) Call(S(L_FORMAT), V_T, CreateString("Creating directory: \n" + s.native())); error_code ec; create_directories(s, ec); if (ec) E_FileErr(SV); m_arVal[1] = V_T; } m_cVal = 2; m_r = Pop(); } void CLispEng::F_DeleteDirectory() { error_code ec; sys::remove(GetDirectoryName(SV), ec); if (ec) E_FileErr(SV); m_r = V_T; SkipStack(1); } } // Lisp::
2,404
Common Lisp
.l
84
26.452381
135
0.574468
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
e963dacaf90fb0835441f0e9494b8a971b6510b2dc9285fac1876088870d56d9
11,521
[ -1 ]
11,522
lispeng.idl
ufasoft_lisp/src/lisp/lispeng/lispeng.idl
import "oaidl.idl"; import "ocidl.idl"; [ uuid(00000055-0002-0003-0002-0044534F4654), version(2.0), helpstring("LispEng 2.0 Type Library") ] library LispEng { importlib("stdole32.tlb"); importlib("stdole2.tlb"); [ uuid(55534654-3F35-46d9-0001-54BAFC251101) ] interface IStandardStream : IUnknown { HRESULT get([out, retval] wchar_t *pch); HRESULT put(wchar_t ch); [propget] HRESULT IsInteractive([out, retval] bool *pb); [propget] HRESULT CanRead([out, retval] bool *pb); [propget] HRESULT CanWrite([out, retval] bool *pb); }; typedef enum { SIG_SIGTERM = 15 // compatibel with signal.h } EnumSignal; [ uuid(55534654-3F35-46d9-0001-54BAFC251102), dual, oleautomation ] interface ILisp : IDispatch { [id(1)] HRESULT Init(); [id(2)] HRESULT Loop(); [id(3)] HRESULT SetStandardStream(int idx, IStandardStream *stm); [id(4)] HRESULT GetSymbol(BSTR name, BSTR pack, [retval, out] void **sym); [id(5)] HRESULT Call(void *sym, [in] SAFEARRAY(VARIANT) psa, [retval, out] VARIANT *r); [id(6)] HRESULT Break(EnumSignal sig); [id(7)] HRESULT Eval(BSTR s, [retval, out] BSTR *r); }; [ uuid(55534654-3F35-46d9-0002-54BAFC251102)] coclass LispObj { [default] interface ILisp; }; };
1,220
Common Lisp
.l
36
31.444444
89
0.710884
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
426a7f29e517e9bb91ebd2b652c1f5d1b089f6349abb65bbbf3fe6308b6ef478
11,522
[ -1 ]
11,523
listutil.cpp
ufasoft_lisp/src/lisp/lispeng/listutil.cpp
#include <el/ext.h> #include "lispeng.h" namespace Lisp { int CLispEng::Length(CP p) { int r = 0; for (CP car; SplitPair(p, car);) r++; return r; } bool __fastcall CLispEng::Memq(CP x, CP list) { for (CP car; SplitPair(list, car);) if (x == car) return true; return false; } CP CLispEng::Adjoin(CP x, CP list) { return Memq(x, list) ? list : Cons(x, list); } CConsValue *CLispEng::Assoc(CP item, CP alist) { for (CP car; SplitPair(alist, car);) { CConsValue *cons = AsCons(car); if (cons->m_car == item) return cons; } return 0; } CP CLispEng::ListofEx(ssize_t n) { for (; n-- > 1; SkipStack(1)) SV1 = Cons(SV1, SV); return Pop(); } CP __fastcall CLispEng::Listof(ssize_t n) { Push(0); return ListofEx(n+1); } void CLispEng::Remf(CSPtr& plist, CP p) { for (CSPtr* q=&plist; *q; q=(CSPtr*)&ToCons(Cdr(*q))->m_cdr) if (Car(*q) == p) { *q = Cdr(Cdr(*q)); return; } } CP CLispEng::Remq(CP x, CP list) { int count = 0; for (CP p=list, car; SplitPair(p, car); ++count) { if (car == x) { Push(p); return ListofEx(count+1); } else Push(car); } SkipStack(count); return list; } void CLispEng::DeleteFromList(CP x, CSPtr& list) { for (CSPtr* q=&list; *q; q=(CSPtr*)&ToCons(*q)->m_cdr) if (Car(*q) == x) { *q = Cdr(*q); return; } } CP CLispEng::CopyList(CP p) { Push(p); CP r = 0; { if (Type(p) != TS_CONS) E_TypeErr(p, S(L_LIST)); { CListConstructor lc; for (CP car; SplitPair(p, car);) { lc.Add(car); if (!ConsP(p)) { lc.SetCdr(p); r = lc; break; } } } } SkipStack(1); return r; } CP __fastcall CLispEng::NReverse(CP p) { if (p) { CConsValue *consP = ToCons(p); if (CSPtr p3 = consP->m_cdr) { CConsValue *consP3 = ToCons(p3); if (consP3->m_cdr) { CSPtr p1 = p3, p2; do { consP3 = ToCons(p3 = exchange((CSPtr&)consP3->m_cdr, exchange(p2, p3))); } while (consP3->m_cdr); consP->m_cdr = p2; ToCons(p1)->m_cdr = p3; } consP->m_car = exchange(consP3->m_car, consP->m_car); } } return p; } CP CLispEng::AppendEx(CP p, CP q) { if (q) { int n = 0; for (CP car; SplitPair(p, car); n++) Push(car); Push(q); return ListofEx(n+1); } return p; } void CLispEng::MvToStack() { for (size_t i=0; i<m_cVal; ++i) Push(m_arVal[i]); } void CLispEng::StackToMv(size_t n) { if (n > size(m_arVal)) E_Err(IDS_E_TooManyValues, GetSubrName(m_subrSelf)); if (m_cVal = n) { do { m_arVal[n-1] = m_pStack[m_cVal-n]; } while (--n); SkipStack(m_cVal); } else m_r = 0; } void CLispEng::MvToList() { CSPtr p; for (size_t i=m_cVal; i--;) p = Cons(m_arVal[i], p); m_r = p; m_cVal = 1; } void CLispEng::ListToMv(CP p) { m_cVal = 0; for (CP car; SplitPair(p, car);) m_arVal[m_cVal++] = car; } CP CLispEng::List(CP a0) { Push(a0); return Listof(1); } CP CLispEng::List(CP a0, CP a1) { Push(a0, a1); return Listof(2); } CP CLispEng::List(CP a0, CP a1, CP a2) { Push(a0, a1, a2); return Listof(3); } CP CLispEng::List(CP a0, CP a1, CP a2, CP a3) { Push(a0, a1, a2, a3); return Listof(4); } CP CLispEng::List(CP a0, CP a1, CP a2, CP a3, CP a4) { Push(a0, a1, a2, a3); Push(a4); return Listof(5); } CP CLispEng::ListEx(CP a0, CP a1, CP a2) { Push(a0, a1, a2); return ListofEx(3); } } // Lisp::
3,294
Common Lisp
.l
164
17.542683
77
0.602771
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
a46abc2ac88fe714e2aab2fc2a8948369ccb3610bf4217da441ede61dfaa57bb
11,523
[ -1 ]
11,524
svalue.cpp
ufasoft_lisp/src/lisp/lispeng/svalue.cpp
/*###### Copyright (c) 2002-2015 Ufasoft http://ufasoft.com mailto:[email protected], Sergey Pavlov mailto:[email protected] #### # # # See LICENSE for licensing information # #####################################################################################################################################*/ #include <el/ext.h> #include "lispeng.h" namespace Lisp { const byte CLispEng::s_ts2numberP[32] = { # define LTYPE(ts, isnum, man) isnum, # define LMAN(typ, ts, man, init) # include "typedef.h" # undef LTYPE # undef LMAN }; CP __fastcall CLispEng::FromSValueT(CSValue *pv, CTypeSpec ts) { size_t idx; switch (ts) { case TS_CONS: case TS_RATIO: case TS_COMPLEX: #if UCFG_LISP_BUILTIN_RANDOM_STATE case TS_RANDOMSTATE: #endif case TS_MACRO: case TS_SYMBOLMACRO: case TS_GLOBALSYMBOLMACRO: case TS_FUNCTION_MACRO: case TS_READLABEL: idx = (CConsValue*)pv-m_consMan.Base; break; case TS_SYMBOL: idx = (CSymbolValue*)pv-m_symbolMan.Base; break; case TS_PACKAGE: idx = (CPackage*)pv-m_packageMan.Base; break; case TS_STREAM: idx = (CStreamValue*)pv-m_streamMan.Base; break; case TS_INTFUNC: idx = (CIntFuncValue*)pv-m_intFuncMan.Base; break; case TS_FLONUM: #if UCFG_LISP_GC_USE_ONLY_BITMAP idx = (CConsValue*)pv-m_consMan.Base; #else idx = (CFloat*)pv-m_floatMan.Base; #endif break; case TS_BIGNUM: idx = (CBignum*)pv-m_bignumMan.Base; break; case TS_ARRAY: case TS_STRUCT: case TS_OBJECT: case TS_CCLOSURE: idx = (CArrayValue*)pv-m_arrayMan.Base; break; /*!!!D idx = (CObjectValue*)pv-m_objectMan.Base; break;*/ case TS_HASHTABLE: idx = (CHashTable*)pv-m_hashTableMan.Base; break; case TS_READTABLE: idx = (CReadtable*)pv-m_readtableMan.Base; break; case TS_PATHNAME: idx = (CPathname*)pv-m_pathnameMan.Base; break; case TS_WEAKPOINTER: idx = (CWeakPointer*)pv-m_weakPointerMan.Base; break; #if UCFG_LISP_FFI case TS_FF_PTR: idx = (CConsValue*)pv-m_consMan.Base; break; #endif default: E_ProgramErr(); } return (CP(idx)<<8)|ts; } CP CLispEng::FromFunctionDesignator(CP p) { CSPtr q; switch (Type(p)) { case TS_INTFUNC: case TS_SUBR: case TS_CCLOSURE: return p; case TS_SYMBOL: q = ToSymbol(p)->GetFun(); break; case TS_CONS: if (FunnameP(p)) { q = ToSymbol(GetSymProp(Car(Cdr(p)), S(L_SETF_FUNCTION)))->GetFun(); break; } default: E_TypeErr(p, 0, IDS_E_IsNotAFunctionName, GetSubrName(m_subrSelf), p); } switch (Type(q)) { case TS_INTFUNC: case TS_SUBR: case TS_CCLOSURE: return q; default: #ifdef X_TEST //!!!D Print(p); Disassemble(cerr, CurClosure); #endif E_UndefinedFunction(p); } } /*!!! CP __fastcall CLispEng::FromSValue(CArrayValue *pv, CTypeSpec ts) { return FromValue(((CP*)pv-m_alloc.m_base), ts); }*/ CIntFuncValue *CLispEng::ToIntFunc(CP p) { if (Type(p) == TS_INTFUNC) return AsIntFunc(p); Error(LispErr::BadArgumentType, p); } CArrayValue* __fastcall CLispEng::ToArray(CP p) { if (Type(p) == TS_ARRAY) return AsArray(p); E_TypeErr(p, S(L_ARRAY)); //!!!D E_TypeError(E_LISP_IsNotArray, p); } CStructInst* __fastcall CLispEng::ToStruct(CP p) { if (Type(p) == TS_STRUCT) return (CStructInst*)AsArray(p); E_TypeErr(p, S(L_STRUCTURE_OBJECT)); } bool CLispEng::VectorP(CP p) { if (Type(p) != TS_ARRAY) return false; return Type(AsArray(p)->m_dims) == TS_FIXNUM; } bool CLispEng::StringP(CP p) { if (!VectorP(p)) return false; switch (AsArray(p)->GetElementType()) { case ELTYPE_CHARACTER: case ELTYPE_BASECHAR: return true; } return false; } CArrayValue *CLispEng::ToVector(CP p) { if (Type(p) == TS_ARRAY) { CArrayValue *av = AsArray(p); if (Type(av->m_dims) == TS_FIXNUM) return av; } E_TypeErr(p, S(L_VECTOR)); } CReadtable *CLispEng::ToReadtable(CP p) { if (Type(p) == TS_READTABLE) return AsReadtable(p); E_TypeErr(p, S(L_READTABLE)); } CHashTable *CLispEng::ToHashTable(CP p) { if (Type(p) == TS_HASHTABLE) return AsHashTable(p); E_TypeErr(p, S(L_HASH_TABLE)); } CStreamValue *CLispEng::ToStream(CP p) { if (Type(p) == TS_STREAM) return AsStream(p); E_TypeErr(p, S(L_STREAM)); } #if UCFG_LISP_BUILTIN_RANDOM_STATE CRandomState *CLispEng::ToRandomState(CP p) { if (Type(p) == TS_RANDOMSTATE) return AsRandomState(p); E_TypeErr(p, S(L_RANDOM_STATE)); } #endif CSymbolMacro *CLispEng::ToSymbolMacro(CP p) { if (Type(p) == TS_SYMBOLMACRO) return (CSymbolMacro*)AsCons(p); E_TypeErr(p, S(L_SYMBOL_MACRO)); } CSymbolMacro *CLispEng::ToGlobalSymbolMacro(CP p) { if (Type(p) == TS_GLOBALSYMBOLMACRO) return (CSymbolMacro*)AsCons(p); E_TypeErr(p, S(L_GLOBAL_SYMBOL_MACRO)); } CFunctionMacro *CLispEng::ToFunctionMacro(CP p) { if (Type(p) == TS_FUNCTION_MACRO) return (CFunctionMacro*)AsCons(p); E_TypeErr(p, S(L_FUNCTION_MACRO)); } /*!!!D CLispEng::CLispSubr* _fastcall CLispEng::ToSpecialOperator(CP p) { if (Type(p) == TS_SPECIALOPERATOR) return m_arSO+(AsIndex(p) & 0x3FF); Error(E_LISP_BadArgumentType, p); } */ CPackage *ToPackage(CP p) { if (Type(p) == TS_PACKAGE) return Lisp().AsPackage(p); Lisp().E_TypeErr(p, S(L_PACKAGE)); } CPathname * __stdcall ToPathname(CP p) { if (Type(p) == TS_PATHNAME) return Lisp().AsPathname(p); Lisp().E_TypeErr(p, S(L_PATHNAME)); } CWeakPointer *ToWeakPointer(CP p) { if (Type(p) == TS_WEAKPOINTER) return Lisp().AsWeakPointer(p); Lisp().E_TypeErr(p, S(L_WEAK_POINTER)); } CArrayValue *ToObject(CP p) { if (Type(p) == TS_OBJECT) return Lisp().AsArray(p); Lisp().E_TypeErr(p, S(L_STANDARD_OBJECT)); } CClosure *ToCClosure(CP p) { if (Type(p) == TS_CCLOSURE) return &Lisp().TheClosure(p); Lisp().Error(LispErr::BadArgumentType, p); } CMacro *ToMacro(CP p) { if (Type(p) == TS_MACRO) return Lisp().AsMacro(p); Lisp().Error(LispErr::BadArgumentType, p); } double AsFloatVal(CP p) { if (Type(p) == TS_FLONUM) return Lisp().AsFloat(p)->m_d; Lisp().E_TypeErr(p, S(L_FLOAT)); } CFrameType AsFrameType(CP p) { if (Type(p) == TS_FRAMEINFO) return CFrameType(AsIndex(p) & FRAME_TYPE_MASK); Lisp().Error(LispErr::BadArgumentType, p); } uintptr_t AsFrameTop(CP p) { if (Type(p) == TS_FRAMEINFO) return AsIndex(p) >> 8; Lisp().Error(LispErr::BadArgumentType, p); } CP CLispEng::Cons(CP a, CP b) { CConsValue *cons; if (m_consMan.m_pHeap) { cons = (CConsValue*)exchange(m_consMan.m_pHeap, (CConsValue*)((uintptr_t*)m_consMan.m_pHeap)[1]); cons->m_car = a; cons->m_cdr = b; } else { Push(a, b); cons = CreateCons(); cons->m_cdr = Pop(); cons->m_car = Pop(); } return FromSValue(cons); } CP CLispEng::CreateRatio(CP num, CP den) { Push(num, den); CRatio *pRatio = (CRatio*)m_consMan.CreateInstance(); pRatio->m_denominator = Pop(); pRatio->m_numerator = Pop(); return FromSValueT(pRatio, TS_RATIO); } #if UCFG_LISP_BUILTIN_RANDOM_STATE CRandomState *CLispEng::CreateRandomState(CP seed) { if (!seed) seed = CreateInteger(Ext::Random().m_seed); Push(seed); CRandomState *pRS = (CRandomState*)m_consMan.CreateInstance(); pRS->m_rnd = Pop(); pRS->m_stub = CSPtr(); return pRS; } #endif CP CLispEng::CreateMacro(CP expander, CP lambdaList) { Push(expander, lambdaList); CMacro *pSM = (CMacro*)m_consMan.CreateInstance(); pSM->m_lambdaList = Pop(); pSM->m_expander = Pop(); return FromSValueT(pSM, TS_MACRO); } CSymbolMacro *CLispEng::CreateSymbolMacro(CP p) { Push(p); CSymbolMacro *pSM = (CSymbolMacro*)m_consMan.CreateInstance(); pSM->m_macro = Pop(); pSM->m_stub = 0; return pSM; } CFunctionMacro *CLispEng::CreateFunctionMacro(CP f, CP e) { Push(f, e); CFunctionMacro *pFM = (CFunctionMacro*)m_consMan.CreateInstance(); pFM->m_expander = Pop(); pFM->m_function = Pop(); return pFM; } CP CLispEng::CreateReadLabel(CP lab) { Push(lab); CConsValue *cons = m_consMan.CreateInstance(); cons->m_car = Pop(); cons->m_cdr = 0; return FromSValueT(cons, TS_READLABEL); } CP CLispEng::CreateComplex(CP real, CP imag) { Push(real, imag); CComplex *pComplex = (CComplex*)m_consMan.CreateInstance(); pComplex->m_imag = Pop(); pComplex->m_real = Pop(); return FromSValueT(pComplex, TS_COMPLEX); } CFloat *CLispEng::CreateFloat(double d) { #if UCFG_LISP_GC_USE_ONLY_BITMAP CFloat *f = (CFloat*)m_consMan.CreateInstance(); #else CFloat *f = m_floatMan.CreateInstance(); #endif f->m_d = d; return f; } CBignum *CLispEng::CreateBignum(const BigInteger& i) { #ifdef _X_DEBUG //!!!D static int count = 0; if (++count==4) g_b = true; cout << i << endl; #endif return m_bignumMan.CreateInstance(i); } CP CLispEng::CreateKeyword() { CSymbolValue *sv = m_symbolMan.CreateInstance(); sv->m_fun |= SYMBOL_FLAG_CONSTANT|SYMBOL_FLAG_SPECIAL; return sv->m_dynValue = FromSValue(sv); } CClosure *CLispEng::CreateClosure(size_t len) { return (CClosure*)CreateVector(len); } CClosure *CLispEng::CopyClosure(CP oldClos) { CClosure *oc = ToCClosure(oldClos); size_t len = AsArray(oldClos)->DataLength; CClosure *nc = CreateClosure(len); nc->NameOrClassVersion = oc->NameOrClassVersion; nc->CodeVec = oc->CodeVec; memcpy(nc->Consts, oc->Consts, len*sizeof(CP)); return nc; } CStreamValue *CLispEng::CreateStream(int subtype, CP in, CP out, byte flags) { Push(in, out); CStreamValue *stm = m_streamMan.CreateInstance(); stm->m_elementType = S(L_CHARACTER); stm->m_subtype = (byte)subtype; stm->m_out = Pop(); stm->m_in = Pop(); stm->m_flags = flags; //!!! stm->m_pStm = pStm; //!!! stm->m_reader = AsSymbol(GetSymbol("%READ-CHAR", m_packSYS))->GetFun(); //!!! stm->m_writer = AsSymbol(GetSymbol("%WRITE-CHAR", m_packSYS))->GetFun(); return stm; } CP CLispEng::CreateSynonymStream(CP p) { return FromSValue(CreateStream(STS_SYNONYM_STREAM, p)); } CPackage *CLispEng::CreatePackage(RCString name, const vector<String>& nicks) { CPackage *pack = m_packageMan.CreateInstance(); pack->m_name = name; pack->m_arNick = nicks; pack->Connect(); return pack; } CWeakPointer *CLispEng::CreateWeakPointer(CP p) { Push(p); CWeakPointer *wp = m_weakPointerMan.CreateInstance(); wp->m_p = Pop(); return wp; } CArrayValue *CLispEng::CreateArray() { return m_arrayMan.CreateInstance(); } CArrayValue *CLispEng::CreateVector(size_t size, byte elType) { CArrayValue *av = CreateArray(); av->m_pData = av->CreateData(av->m_elType=elType, av->m_dims=CreateFixnum((INT_PTR)size), 0); return av; /*!!! Push(FromSValue(av)); av->m_pData = av->CreateData(ELTYPE_T, av->m_dims=FromSValue(Cons(CreateInteger(size), 0)), 0); SkipStack(1); return av;*/ } CP CLispEng::CopyVector(CP p) { Push(p); CArrayValue *oav = AsArray(p); size_t size = oav->DataLength; CArrayValue *av = CreateVector(size, oav->GetElementType()); oav = AsArray(Pop()); memcpy(av->m_pData, oav->m_pData, oav->GetByteLength()); return FromSValue(av); } CP CLispEng::CreateString(RCString s) { size_t size = s.length(); CArrayValue *av = CreateVector(size, ELTYPE_CHARACTER); memcpy(av->m_pData, (const String::value_type*)s, size*sizeof(String::value_type)); return FromSValue(av); } CReadtable *CLispEng::CreateReadtable() { return m_readtableMan.CreateInstance(); } CHashTable *CLispEng::CreateHashTable() { return m_hashTableMan.CreateInstance(); } void CLispEng::AdjustSymbols(ssize_t offset) { byte *p = (byte*)m_packageMan.m_pBase; #if UCFG_LISP_GC_USE_ONLY_BITMAP for (byte *pHeap=(byte*)m_packageMan.m_pHeap; ;) { byte *next = pHeap ? pHeap : (byte*)m_packageMan.m_pBase+m_packageMan.m_size*m_packageMan.m_sizeof; for (; p<next; p+=m_packageMan.m_sizeof) ((CPackage*)p)->AdjustSymbols(offset); p += m_packageMan.m_sizeof; if (!pHeap) break; pHeap = ((byte**)next)[1]; } #else for (int i=0; i<m_packageMan.m_size; i++, p+=m_packageMan.m_sizeof) if (*p!=0xFF) ((CPackage*)p)->AdjustSymbols(offset); #endif } CIntFuncValue::CIntFuncValue(const CIntFuncValue& ifv) { operator=((CIntFuncValue&)ifv); } CP CIntFuncValue::GetField(size_t idx) { //!!!CLISP switch (idx) { case 0: return m_name; case 1: return m_form; case 2: return m_docstring; case 3: return m_body; case 4: return m_env.m_varEnv; case 5: return m_env.m_funEnv; case 6: return m_env.m_blockEnv; case 7: return m_env.m_goEnv; case 8: return m_env.m_declEnv; case 9: return m_vars; case 10: return m_optInits; case 11: return m_keyInits; case 12: return CreateFixnum(m_nReq); case 13: return CreateFixnum(m_nOpt); case 14: return m_auxInits; case 16: return m_keywords; case 18: return FromBool(m_bAllowFlag); case 19: return FromBool(m_bRestFlag); default: if (idx < 12) return ((CP*)this)[idx]; else Lisp().E_ProgramErr(); } } void CIntFuncValue::Write(BlsWriter& wr) { wr << m_name << m_docstring << m_form << m_body << m_env.m_varEnv << m_env.m_funEnv << m_env.m_blockEnv << m_env.m_goEnv << m_env.m_declEnv << m_vars << m_optInits << m_keywords << m_keyInits << m_auxInits; (BinaryWriter&)wr << m_nReq << m_nOpt << m_nSpec << m_nKey << m_nAux << m_bAllowFlag << m_bRestFlag; if (m_varFlags) { uint16_t count = uint16_t(Lisp().ToArray(m_vars)->TotalSize()-m_nSpec); (BinaryWriter&)wr << count; for (int i=0; i<count; i++) (BinaryWriter&)wr << m_varFlags[i]; } else (BinaryWriter&)wr << uint16_t(0); } void CIntFuncValue::Read(const BlsReader& rd) { rd >> m_name >> m_docstring >> m_form >> m_body >> m_env.m_varEnv >> m_env.m_funEnv >> m_env.m_blockEnv >> m_env.m_goEnv >> m_env.m_declEnv >> m_vars >> m_optInits >> m_keywords >> m_keyInits >> m_auxInits; (BinaryReader&)rd >> m_nReq >> m_nOpt >> m_nSpec >> m_nKey >> m_nAux >> m_bAllowFlag >> m_bRestFlag; uint16_t count = rd.ReadUInt16(); if (count) { m_varFlags = new byte[count]; for (int i=0; i<count; i++) (BinaryReader&)rd >> m_varFlags[i]; } } CP CClosure::get_VEnv() { return Consts[0]; } void CClosure::put_VEnv(CP venv) { Consts[0] = venv; } /*!!! void CClosure::Read(CBlsStream& stm) { stm >> NameOrClassVersion >> CodeVec >> m_consts; } void CClosure::Write(CBlsStream& stm) { stm << NameOrClassVersion << CodeVec << m_consts; } */ CStreamValue::CStreamValue() : m_nStandard(-1) , m_nLine(1) , m_nPos(0) , m_bUnread(false) , m_bEchoed(false) , m_bMultiLine(false) , m_bClosed(false) , m_bSigned(false) , m_nCur(0) , m_nEnd(0) , m_elementBits(8) , m_curOctet(-1) , m_mode(FileMode::Open) { m_type = TS_STREAM; m_subtype = STS_STREAM; } void CStreamValue::Write(BlsWriter& wr) { CLispEng& lisp = Lisp(); (BinaryWriter&)wr << m_subtype << m_nStandard << m_nLine << m_nPos << m_nCur << m_nEnd << m_flags; wr << m_in << m_out << m_reader << m_writer << m_elementType << m_pathname; /*!!! byte i; for (i=0; i<lisp.m_arStream.size(); i++) if (lisp.m_arStream[i] == m_pStm) { (Stream&)stm << i; return; } E_Error();*/ } void CStreamValue::Read(const BlsReader& rd) { (BinaryReader&)rd >> m_subtype >> m_nStandard >> m_nLine >> m_nPos >> m_nCur >> m_nEnd >> m_flags; rd >> m_in >> m_out >> m_reader >> m_writer >> m_elementType >> m_pathname; /*!!! byte n; (Stream&)stm >> n; m_pStm = Lisp().m_arStream[n];*/ } int64_t& CStreamValue::LinePosRef() { if (m_stream) return m_stream->m_nPos; if (m_nStandard != -1) return Lisp().m_streams[m_nStandard]->m_nPos; return m_nPos; } void CHashTable::Write(BlsWriter& wr) { m_pMap->Write(wr << m_rehashSize << m_rehashThreshold); } void CHashTable::Read(const BlsReader& rd) { m_pMap->Read(rd >> m_rehashSize >> m_rehashThreshold); } void CSymbolValue::Write(BlsWriter& wr) { CLispEng& lisp = Lisp(); BinaryWriter& bwr = wr; #if UCFG_LISP_SPLIT_SYM String name = lisp.SymNameByIdx(this-lisp.m_symbolMan.Base); #else String name = m_s; #endif map<CP, String>::iterator i = lisp.m_mapObfuscated.find(lisp.FromSValue(this)); if (i != lisp.m_mapObfuscated.end()) name = i->second; byte flags = byte((m_fun & ~MASK_WITHOUT_FLAGS)|((m_fun>>30)&3)); if (name == lisp.GetStaticSymbolNamePack(this-lisp.m_symbolMan.Base).first) flags |= STREAM_FLAG_STANDARD_NAME; bwr << flags; if (!(flags & STREAM_FLAG_STANDARD_NAME)) wr << name; wr << GetFun() << m_dynValue << GetPropList(); } void CSymbolValue::Read(const BlsReader& rd) { CSPtr fun, propList; const BinaryReader& brd = rd; byte flags; brd >> flags; String name; if (flags & STREAM_FLAG_STANDARD_NAME) name = Lisp().GetStaticSymbolNamePack(this-Lisp().m_symbolMan.Base).first; else rd >> name; #if UCFG_LISP_SPLIT_SYM Lisp().SymNameByIdx(this-Lisp().m_symbolMan.Base) = name; #else m_s = name; #endif rd >> fun >> m_dynValue >> propList; m_fun = DWORD(flags & ~MASK_WITHOUT_FLAGS) | (DWORD(flags & 3)<<30); SetFun(fun); SetPropList(propList); } void CBignum::Read(const BlsReader& rd) { rd >> m_int; #ifdef _X_DEBUG //!!!D static int count; cout << ++count << endl; #endif } void CBignum::Write(BlsWriter& wr) { wr << m_int; } BlsWriter& operator<<(BlsWriter& wr, const CCharType& ct) { (BinaryWriter&)wr << (byte)ct.m_syntax << (uint16_t)ct.m_traits << (byte)ct.m_bTerminating; wr << ct.m_macro << ct.m_disp; return wr; } const BlsReader& operator>>(const BlsReader& rd, CCharType& ct) { byte syntax, bTerminating; uint16_t traits; rd >> syntax >> traits >> bTerminating; rd >> ct.m_macro >> ct.m_disp; ct.m_syntax = (CSyntaxType)syntax; ct.m_traits = traits; ct.m_bTerminating = bTerminating; return rd; } void CReadtable::Write(BlsWriter& wr) { wr << m_case; for (size_t i=0; i<size(m_ar); i++) wr << m_ar[i]; wr.WriteSize(m_map.size()); for (CCharMap::iterator it=m_map.begin(); it!=m_map.end(); ++it) { (BinaryWriter&)wr << it->first; wr << it->second; } } void CReadtable::Read(const BlsReader& rd) { rd >> m_case; for (size_t i=0; i<size(m_ar); i++) rd >> m_ar[i]; size_t num = rd.ReadSize(); while (num--) { Char16 ch = rd.ReadUInt16(); rd >> m_map[ch]; } } void CPathname::Write(BlsWriter& wr) { wr << m_host << m_dev << m_dir << m_name << m_type << m_ver; } void CPathname::Read(const BlsReader& rd) { rd >> m_host >> m_dev >> m_dir >> m_name >> m_type >> m_ver; } } // Lisp::
18,129
Common Lisp
.l
647
26.007728
135
0.676542
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
e92203ac9132cacfbb773737d62d6b2bba5a196e69a21c773bef236c04fd2306
11,524
[ -1 ]
11,555
ax_perl.m4
ufasoft_lisp/m4/ax_perl.m4
dnl Available from the GNU Autoconf Macro Archive at: dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_perl_version.html dnl AC_DEFUN([AC_PROG_PERL_VERSION],[dnl # Make sure we have perl if test -z "$PERL"; then AC_CHECK_PROG(PERL,perl,perl) fi # Check if version of Perl is sufficient ac_perl_version="$1" if test "x$PERL" != "x"; then AC_MSG_CHECKING(for perl version greater than or equal to $ac_perl_version) # NB: It would be nice to log the error if there is one, but we cannot rely # on autoconf internals $PERL -e "use $ac_perl_version;" > /dev/null 2>&1 if test $? -ne 0; then AC_MSG_RESULT(no); $3 else AC_MSG_RESULT(ok); $2 fi else AC_MSG_WARN(could not find perl) fi ])dnl # AC_PROG_PERL_VERSION
754
Common Lisp
.l
26
26.615385
77
0.714088
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
d15904134590641e40153fd94041b69aa6496cbb89b9f6c5eb663c7ef01bb8fc
11,555
[ -1 ]
11,556
ax_check_compile_flag.m4
ufasoft_lisp/m4/ax_check_compile_flag.m4
# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) # # DESCRIPTION # # Check whether the given FLAG works with the current language's compiler # or gives an error. (Warnings, however, are ignored) # # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on # success/failure. # # If EXTRA-FLAGS is defined, it is added to the current language's default # flags (e.g. CFLAGS) when the check is done. The check is thus made with # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to # force the compiler to issue an error when a bad flag is given. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim <[email protected]> # Copyright (c) 2011 Maarten Bosmans <[email protected]> # # 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 2 AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS
3,241
Common Lisp
.l
70
44.985714
82
0.704323
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
38fc71ffbb4ab4258c91b19220c46c4da56f48a74e2c2c6d720d216528f7639b
11,556
[ -1 ]
11,557
vsct.xml
ufasoft_lisp/cfg/vs/vsct.xml
<?xml version="1.0" encoding="utf-8"?> <ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback"> <Rule Name="BuildVSCT" PageTemplate="tool" DisplayName="Compile VSCT File" Order="200"> <Rule.DataSource> <DataSource Persistence="ProjectFile" ItemType="BuildVSCT" /> </Rule.DataSource> <Rule.Categories> <Category Name="General"> <Category.DisplayName> <sys:String>General</sys:String> </Category.DisplayName> </Category> <Category Name="Command Line" Subtype="CommandLine"> <Category.DisplayName> <sys:String>Command Line</sys:String> </Category.DisplayName> </Category> </Rule.Categories> <StringListProperty Name="Inputs" Category="Command Line" IsRequired="true" Switch=" "> <StringListProperty.DataSource> <DataSource Persistence="ProjectFile" ItemType="BuildVSCT" SourceType="Item" /> </StringListProperty.DataSource> </StringListProperty> <StringProperty Name="CommandLineTemplate" DisplayName="Command Line" Visible="False" IncludeInCommandLine="False" /> <DynamicEnumProperty Name="BuildVSCTBeforeTargets" Category="General" EnumProvider="Targets" IncludeInCommandLine="False"> <DynamicEnumProperty.DisplayName> <sys:String>Execute Before</sys:String> </DynamicEnumProperty.DisplayName> <DynamicEnumProperty.Description> <sys:String>Specifies the targets for the build customization to run before.</sys:String> </DynamicEnumProperty.Description> <DynamicEnumProperty.ProviderSettings> <NameValuePair Name="Exclude" Value="^BuildVSCTBeforeTargets|^Compute" /> </DynamicEnumProperty.ProviderSettings> <DynamicEnumProperty.DataSource> <DataSource Persistence="ProjectFile" HasConfigurationCondition="true" /> </DynamicEnumProperty.DataSource> </DynamicEnumProperty> <DynamicEnumProperty Name="BuildVSCTAfterTargets" Category="General" EnumProvider="Targets" IncludeInCommandLine="False"> <DynamicEnumProperty.DisplayName> <sys:String>Execute After</sys:String> </DynamicEnumProperty.DisplayName> <DynamicEnumProperty.Description> <sys:String>Specifies the targets for the build customization to run after.</sys:String> </DynamicEnumProperty.Description> <DynamicEnumProperty.ProviderSettings> <NameValuePair Name="Exclude" Value="^BuildVSCTAfterTargets|^Compute" /> </DynamicEnumProperty.ProviderSettings> <DynamicEnumProperty.DataSource> <DataSource Persistence="ProjectFile" ItemType="" HasConfigurationCondition="true" /> </DynamicEnumProperty.DataSource> </DynamicEnumProperty> <StringListProperty Name="Outputs" DisplayName="Outputs" Visible="False" IncludeInCommandLine="False" /> <StringProperty Name="ExecutionDescription" DisplayName="Execution Description" Visible="False" IncludeInCommandLine="False" /> <StringListProperty Name="AdditionalDependencies" DisplayName="Additional Dependencies" IncludeInCommandLine="False" Visible="false" /> <StringProperty Subtype="AdditionalOptions" Name="AdditionalOptions" Category="Command Line"> <StringProperty.DisplayName> <sys:String>Additional Options</sys:String> </StringProperty.DisplayName> <StringProperty.Description> <sys:String>Additional Options</sys:String> </StringProperty.Description> </StringProperty> </Rule> <ItemType Name="BuildVSCT" DisplayName="Compile VSCT File" /> <FileExtension Name="*.vsct" ContentType="BuildVSCT" /> <ContentType Name="BuildVSCT" DisplayName="Compile VSCT File" ItemType="BuildVSCT" /> </ProjectSchemaDefinitions>
4,445
Common Lisp
.l
127
26.96063
296
0.669833
ufasoft/lisp
9
4
1
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
5b32a40385bad0dcd1a9b97ddc560a0429c821f7361b5e703ede9b0bb6a5486b
11,557
[ -1 ]
11,572
package.lisp
JadedCtrl_cl-ipfs-api2/package.lisp
(defpackage :cl-ipfs-api2 (:use :cl :arnesi) (:nicknames :cl-ipfs :ipfs :cl-ipfs-api²) (:export *api-host* *api-root* *ipfs-root* ;; calls :dl :cat :add :dns :id :ls :resolve :shutdown ;; bitswap calls :bitswap-ledger :bitswap-reprovide :bitswap-stat :bitswap-wantlist ;; block calls :block-get :block-put :block-rm :block-stat ;; bootstrap calls :bootstrap :bootstrap-list :bootstrap-add :bootstrap-add-default :bootstrap-rm :bootstrap-rm-all ;; cid calls :cid-base32 :cid-bases ;; config calls :config :config-show ;; dag calls :dag-get :dag-put :dag-resolve ;; dht calls :dht-findpeer :dht-findprovs :dht-get :dht-provide :dht-put :dht-query ;; diag calls :diag-cmds :diag-cmds-clear :diag-cmds-set-time :diag-sys ;; file calls :file-ls ;; files calls :files-chcid :files-cp :files-flush :files-ls :files-mkdir :files-mv :files-read :files-rm :files-stat :files-write ;; filestore calls :filestore-dups :filestore-ls :filestore-verify ;; key calls :key-gen :key-list :key-rename :key-remove ;; log calls :log-level :log-ls :log-tail ;; name calls :name-publish :name-pubsub-cancel :name-pubsub-state :name-pubsub-subs :name-resolve ;; object calls :object-data :object-diff :object-get :object-links :object-new :object-patch-add-link :object-patch-rm-link :object-stat ;; absentees— :object-put, :object-set-data, :object-patch-append-data ;; p2p calls :p2p-close :p2p-listen :p2p-ls :p2p-stream-close :p2p-stream-ls ;; pin calls :pin-add :pin-ls :pin-rm :pin-update :pin-verify ;; pubsub calls :pubsub-sub :pubsub-sub-process :pubsub-sub-read-char :pubsub-sub-listen :pubsub-sub-close :pubsub-pub :pubsub-ls :pubsub-peers ;; refs calls :refs :refs-local ;; repo calls :repo-fsck :repo-gc :repo-stat :repo-verify :repo-version ;; stats calls :stats-bitswap :stats-bw :stats-repo ;; swarm calls :swarm-addrs :swarm-addrs-listen :swarm-addrs-local :swarm-connect :swarm-disconnect :swarm-filters :swarm-filters-add :swarm-filters-rm :swarm-peers ;; urlstore calls :urlstore-add ;; version calls :version :version-deps #:with-files-write))
2,649
Common Lisp
.lisp
147
12.884354
74
0.606883
JadedCtrl/cl-ipfs-api2
9
3
7
LGPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
aed31c416d8333d417692db7f8240a1819a6c6204548995c53c5e2adaea3050c
11,572
[ -1 ]
11,573
main.lisp
JadedCtrl_cl-ipfs-api2/main.lisp
;; This file is free software: you can redistribute it and/or modify ;; it under the terms of version 3 of the GNU General Public License ;; as published by the Free Software Foundation. ;; ;; 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. (in-package :cl-ipfs-api2) (defparameter *api-host* "http://127.0.0.1:5001") (defparameter *api-root* "/api/v0/") (defparameter *ipfs-root* nil) ;; correlates to the env variable $IPFS_PATH, ;; only necessary if yours deviates from the ;; default path. only used for #'pubsub-* ;; ————————————————————————————————————— ;; BASE ;; STRING LIST [:LIST :BOOLEAN :SYMBOL] → STRING | ALIST | (NIL STRING) (defun ipfs-call (call arguments &key (parameters nil) (want-stream nil) (method :POST)) "Make an IPFS HTTP API call. Quite commonly used. Some calls return strings/raw data, and others return JSON. When strings/arbitrary data are recieved, they're returned verbatim. But, when JSON is returned, it is parsed into a hashtable. If the JSON is 'error JSON', I.E., it signals that an error has been recieved, two values are returned: NIL and the string-error-message." (let ((result (multiple-value-list (drakma:http-request (make-call-url call arguments) :method method :url-encoder #'ipfs::url-encode :parameters parameters :want-stream want-stream)))) (if want-stream (car result) (apply #'process-result result)))) (defun process-result (body status-code headers uri http-stream must-close status-text) (declare (ignore uri http-stream must-close status-text)) (let* ((result (cond ((stringp body) body) ((vectorp body) (flexi-streams:octets-to-string body)))) (result (if (search "application/json" (cdr (assoc :content-type headers))) (unless (empty-string-p result) (simplify (yason:parse result :object-as :alist))) result))) (if (eql 200 status-code) result (values nil (if (stringp result) result (ignore-errors (cdr (s-assoc "Message" result)))))))) ;; STRING LIST &key STRING STRING → STRING (defun make-call-url (call arguments &key (host *api-host*) (root *api-root*)) "Create the URL of an API call, as per the given arguments. Symbols are assumed to be something like 'T (so boolean), nil likewise. Arguments should look like this: (('recursive' nil)('name' 'xabbu'))" (let ((call-url (string+ host root call)) (first-arg 'T)) (mapcar (lambda (arg-pair) (when arg-pair (setq call-url (string+ call-url (if first-arg "?" "&") (first arg-pair) "=" (cond ((not (second arg-pair)) "false") ((symbolp (second arg-pair)) "true") ('T (second arg-pair))))) (setq first-arg nil))) arguments) call-url)) ;; ————————————————————————————————————— ;; ROOT CALLS ;; PATHNAME → (HASH-STRING SIZE-NUMBER) || (NIL STRING) (defun add (pathname &key (pin 't) (only-hash nil) (cid-version 0)) "Add a file to IPFS, return it's hash. /ipns/docs.ipfs.io/reference/api/http/#api-v0-add" (ipfs-call "add" `(("pin" ,pin) ("only-hash" ,only-hash) ("cid-version" ,cid-version)) :parameters `(("file" . ,pathname)))) ;; STRING :NUMBER :NUMBER → STRING || (NIL STRING) (defun cat (ipfs-path &key (offset nil) (length nil)) "Return a string of the data at the given IPFS path. /ipns/docs.ipfs.io/reference/api/http/#api-v0-cat" (ipfs-call "cat" `(("arg" ,ipfs-path) ,(if offset `("offset" ,offset)) ,(if length `("length" ,length))))) ;; STRING [:BOOLEAN :BOOLEAN] → ALIST || (NIL STRING) (defun ls (ipfs-path &key (resolve-type 't) (size 't)) "Returns all sub-objects (IPFS hashes) under a given IPFS/IPNS directory path. Returns as an associative list. /ipns/docs.ipfs.io/reference/api/http/#api-v0-ls" (ipfs-call "ls" `(("arg" ,ipfs-path) ("resolve-type" ,resolve-type) ("size" ,size)))) ;; STRING PATHNAME → NIL (defun dl (ipfs-path out-file) "Write an IPFS file directly to a file on the local file-system. Non-recursive, in the case of directories… for now. (Thanks to this thread ♥: https://stackoverflow.com/a/12607423) Is a general replacement for the 'get' API call, but actually just uses the 'cat' call, due to some issues with using 'get'. Will not actually return NIL when an error is reached (like other functions) with an error-message, it'lll just write the error JSON to the file. Whoops." (with-open-file (out-stream out-file :direction :output :element-type '(unsigned-byte 8) :if-exists :overwrite :if-does-not-exist :create) (let ((in-stream (ipfs-call "cat" `(("arg" ,ipfs-path)) :want-stream 'T))) (awhile (read-byte in-stream nil nil) (write-byte it out-stream)) (close in-stream)))) ;; —————————————————— ;; [STRING] → ALIST (defun id (&optional peer-id) "Return info on a node by ID. Returns as an associative list, the public key, agent version, etc. If no node ID is specified, then your own is assumed. /ipns/docs.ipfs.io/reference/api/http/#api-v0-id" (ipfs-call "id" `(,(if peer-id (list "arg" peer-id))))) ;; —————————————————— ;; STRING → STRING || (NIL STRING (defun dns (domain &key (recursive 't)) "Resolve a domain into a path (usually /ipfs/). /ipns/docs.ipfs.io/reference/api/http/#api-v0-dns" (ipfs-call "dns" `(("arg" ,domain) ("recursive" ,recursive)))) ;; STRING [:BOOLEAN :NUMBER :NUMBER] → STRING || (NIL STRING) (defun resolve (ipfs-path &key (recursive 't) (dht-record-count nil) (dht-timeout 30)) "Resolve a given name to an IPFS path." (ipfs-call "resolve" `(("arg" ,ipfs-path) ("recursive" ,recursive) ,(if dht-record-count (list "dht-record-count" dht-record-count)) ("dht-timeout" ,(string+ dht-timeout "s"))))) ;; —————————————————— ;; NIL → NIL (defun shutdown () "Shut down the connected IPFS node. /ipns/docs.ipfs.io/reference/api/http/#api-v0-shutdown" (ipfs-call "shutdown" '())) ;; ————————————————————————————————————— ;; BITSWAP CALLS ;; STRING → ALIST || (NIL STRING) (defun bitswap-ledger (peer-id) "Show the current ledger for a peer. /ipns/docs.ipfs.io/reference/api/http/#api-v0-bitswap-ledger" (ipfs-call "bitswap/ledger" `(("arg" ,peer-id)))) ;; NIL → NIL (defun bitswap-reprovide () "Trigger the reprovider. /ipns/docs.ipfs.io/reference/api/http/#api-v0-bitswap-reprovide" (ipfs-call "bitswap/reprovide" '())) ;; NIL → ALIST || (NIL STRING) (defun bitswap-stat () "Show diagnostic info on the bitswap agent. /ipns/docs.ipfs.io/reference/api/http/#api-v0-bitswap-stat" (ipfs-call "bitswap/stat" '())) ;; STRING → ALIST || (NIL STRING) (defun bitswap-wantlist (&optional peer-id) "Show blocks currently on the wantlist. /ipns/docs.ipfs.io/reference/api/http/#api-v0-bitswap-wantlist" (ipfs-call "bitswap/wantlist" `(,(if peer-id (list "peer" peer-id))))) ;; ————————————————————————————————————— ;; BLOCK CALLS ;; STRING → STRING || (NIL STRING) (defun block-get (hash) "Get a raw IPFS block. /ipns/docs.ipfs.io/reference/api/http/#api-v0-block-get" (ipfs-call "block/get" `(("arg" ,hash)))) ;; PATHNAME [:STRING :STRING :NUMBER :BOOLEAN] → ALIST || (NIL STRING) (defun block-put (pathname &key (format nil) (mhtype "sha2-256") (mhlen -1) (pin nil)) "Store input as an IPFS block. /ipns/docs.ipfs.io/reference/api/http/#api-v0-block-put" (ipfs-call "block/put" `(,(if format (list "format" format)) ("mhtype" ,mhtype) ("mhlen" ,mhlen) ("pin" ,pin)) :parameters `(("data" . ,pathname)))) ;; STRING → NIL (defun block-rm (hash &key (force nil)) "Delete an IPFS block(s). /ipns/docs.ipfs.io/reference/api/http/#api-v0-block-rm" (ipfs-call "block/rm" `(("arg" ,hash) ,(if force (list "force" force)))) nil) ;; STRING → ALIST || (NIL STRING) (defun block-stat (hash) "Print info about a raw IPFS block /ipns/docs.ipfs.io/reference/api/http/#api-v0-block-stat" (ipfs-call "block/stat" `(("arg" ,hash)))) ;; ————————————————————————————————————— ;; BOOTSTRAP CALLS ;; NIL → LIST || (NIL STRING) (defun bootstrap () "Return a list of bootstrap peers /ipns/docs.ipfs.io/reference/api/http/#api-v0-bootstrap" (cdr (ipfs-call "bootstrap" '()))) ;; NIL → LIST || (NIL STRING) (defun bootstrap-list () "Return a list of bootstrap peers /ipns/docs.ipfs.io/reference/api/http/#api-v0-bootstrap-list" (bootstrap)) ;; STRING → LIST || (NIL STRING) (defun bootstrap-add (peer) "Add a peer to the bootstrap list /ipns/docs.ipfs.io/reference/api/http/#api-v0-bootstrap-add" (cdr (ipfs-call "bootstrap/add" `(("arg" ,peer))))) ;; NIL → LIST || (NIL STRING) (defun bootstrap-add-default () "Add default peers to the bootstrap list /ipns/docs.ipfs.io/reference/api/http/#api-v0-bootstrap-add-default" (cdr (ipfs-call "bootstrap/add/default" '()))) ;; STRING → LIST || (NIL STRING) (defun bootstrap-rm (peer) "Remove a peer from the bootstrap list /ipns/docs.ipfs.io/reference/api/http/#api-v0-bootstrap-rm" (cdr (ipfs-call "bootstrap/rm" `(("arg" ,peer))))) ;; NIL → LIST || (NIL STRING) (defun bootstrap-rm-all () "Remove a peer from the bootstrap list /ipns/docs.ipfs.io/reference/api/http/#api-v0-bootstrap-rm" (cdr (ipfs-call "bootstrap/rm/all" '()))) ;; ————————————————————————————————————— ;; CID CALLS ;; STRING → STRING || (NIL STRING) (defun cid-base32 (cid) "Convert a CID into Base32 CIDv1 /ipns/docs.ipfs.io/reference/api/http/#api-v0-cid-base32" (let ((result (ipfs-call "cid/base32" `(("arg" ,cid))))) (if (zerop (length (cdr (s-assoc "ErrorMsg" result)))) (cdr (s-assoc "Formatted" result)) (values nil (cdr (s-assoc "ErrorMsg" result)))))) ;; NIL → ALIST || (NIL STRING) (defun cid-bases () "Return a associative list of available bases in plist format; each base's name is a assigned a given code-number. ((CODE-A . NAME-A) (CODE-B . NAME-B) … (CODE-N . NAME-N)) /ipns/docs.ipfs.io/reference/api/http/#api-v0-cid-bases" (ipfs-call "cid/bases" '())) ;; ————————————————————————————————————— ;; CONFIG CALLS ;; STRING [:STRING :BOOLEAN :BOOLEAN] → STRING || (NIL STRING) (defun config (key &key (value nil) (bool nil) (json nil)) "Get/set a config key's value. /ipns/docs.ipfs.io/reference/api/http/#api-v0-config" (cdr (s-assoc "Value" (ipfs-call "config" `(("arg" ,key) ,(if value (list "value" value)) ("bool" ,bool) ("json" ,json)))))) ;; NIL → ALIST (defun config-show () "Return the config file's contents, in alist-format… y'know, with several sub-alists. Doesn't quite line up with #api-v0-config-show /ipns/docs.ipfs.io/reference/api/http/#api-v0-config-show" (ipfs-call "config/show" '())) ;; STRING → STRING || (NIL STRING) (defun config-get (key) "Get a config key's value. Doesn't map with any existant API call; it's just a convenience wrapper around #'config." (config key)) ;; STRING → STRING || (NIL STRING) (defun config-set (key value &key (bool nil) (json nil)) "Set a config key's value. Doesn't map with any existant API call; it's just a convenience wrapper around #'config." (config key :value value :bool bool :json json)) ;; ————————————————————————————————————— ;; DAG CALLS ;; STRING → STRING || (NIL STRING) (defun dag-get (dag-node) "Get a dag node from IPFS. /ipns/docs.ipfs.io/reference/api/http/#api-v0-dag-get" (ipfs-call "dag/get" `(("arg" ,dag-node)))) ;; STRING [:STRING :STRING :BOOLEAN] → STRING || (NIL STRING (defun dag-put (dag-node &key (format "cbor") (input-enc "json") (pin 'T)) "Add a dag node to IPFS. Returns CID string. /ipns/docs.ipfs.io/reference/api/http/#api-v0-dag-put" (ipfs-call "dag/put" `(("arg" ,dag-node) ("format" ,format) ("input-enc" ,input-enc) ("pin" ,pin)))) ;; (gethash "/" (gethash "Cid" result)))) ;; STRING → ALIST || (NIL STRING) (defun dag-resolve (path) "Resolve an IPLD block. /ipns/docs.ipfs.io/reference/api/http/#api-v0-dag-resolve" (ipfs-call "dag/resolve" `(("arg" ,path)))) ;; ————————————————————————————————————— ;; DHT CALLS ;; STRING → LIST || (NIL STRING) (defun dht-findpeer (peer-id) "Find the multiaddresses associated with a peer ID. /ipns/docs.ipfs.io/reference/api/http/#api-v0-dht-findpeer" (cdr (s-assoc "Addrs" (cadr (s-assoc "Responses" (ipfs-call "dht/findpeer" `(("arg" ,peer-id)))))))) ;; STRING [:NUMBER] → LIST || (NIL STRING) (defun dht-findprovs (key &key (provider-quantity 20)) "Find peers that can provide a specific value, given a key. /ipns/docs.ipfs.io/reference/api/http/#api-v0-dht-findprovs" (ipfs-call "dht/findprovs" `(("arg" ,key)("num-providers" ,provider-quantity)))) ;; STRING → LIST || (NIL STRING) (defun dht-get (key) "Query the routing system for a key's best value. /ipns/docs.ipfs.io/reference/api/http/#api-v0-dht-get" (cdr (s-assoc "Addrs" (cadr (s-assoc "Responses" (ipfs-call "dht/get" `(("arg" ,key)))))))) ;; STRING [:BOOLEAN] → NIL (defun dht-provide (key &key (recursive nil)) "Announce to the network that you're providing the given values. /ipns/docs.ipfs.io/reference/api/http/#api-v0-dht-provide" (ipfs-call "dht/provide" `(("arg" ,key)("recursive" ,recursive)))) ;; STRING STRING → NIL || (NIL STRING) (defun dht-put (key value) "Write a key-value pair to the routing system. /ipns/docs.ipfs.io/reference/api/http/#api-v0-dht-put" (ipfs-call "dht/put" `(("arg" ,key)("arg" ,value)))) ;; STRING → ALIST || (NIL STRING) (defun dht-query (peer-id) "Find the closest peer IDs to the given one by querying the DHT. /ipns/docs.ipfs.io/reference/api/http/#api-v0-dht-query" (cdr (s-assoc "Responses" (ipfs-call "dht/query" `(("arg" ,peer-id)))))) ;; ————————————————————————————————————— ;; DIAG CALLS ;; NIL → ALIST (defun diag-cmds () "List commands run on this IPFS node. /ipns/docs.ipfs.io/reference/api/http/#api-v0-diag-cmds" (ipfs-call "diag/cmds" NIL)) ;; NIL → NIL || (NIL STRING) (defun diag-cmds-clear () "Clear inactive requests from the log. /ipns/docs.ipfs.io/reference/api/http/#api-v0-diag-cmds-clear" (ipfs-call "diag/cmds/clear" NIL)) ;; NUMBER → NIL || (NIL STRING) (defun diag-cmds-set-time (time) "Set how long to keep inactive requests in the log. /ipns/docs.ipfs.io/reference/api/http/#api-v0-diag-cmds-set-time" (ipfs-call "diag/cmds/set-time" `(("arg" ,time)))) ;; NIL → STRING || (NIL STRING) (defun diag-sys () "Print system diagnostic info. /ipns/docs.ipfs.io/reference/api/http/#api-v0-diag-sys" (ipfs-call "diag/sys" NIL)) ;; ————————————————————————————————————— ;; FILE CALLS (defun file-ls (path) "List directory contents for UNIX filesystem objects. /ipns/docs.ipfs.io/reference/api/http/#api-v0-file-ls" (cdr (s-assoc "Objects" (ipfs-call "file/ls" `(("arg" ,path)))))) ;; ————————————————————————————————————— ;; FILES CALLS ;; STRING [:NUMBER :STRING] → NIL (defun files-chcid (path &key (cid-version nil) (hash nil)) "Change the cid version or hash function of the root node of a given path. /ipns/docs.ipfs.io/reference/api/http/#api-v0-files-chcid" (ipfs-call "files/chcid" `(("arg" ,path) ,(if cid-version `("cid-version" ,cid-version)) ,(if hash (list "hash" hash))))) ;; STRING STRING → NIL || (NIL STRING) (defun files-cp (source destination) "Copy files into mfs. /ipns/docs.ipfs.io/reference/api/http/#api-v0-files-cp" (ipfs-call "files/cp" `(("arg" ,source)("arg" ,destination)))) ;; STRING → STRING (defun files-flush (&optional (path "/")) "Flush a given path's data to disk. Returns CID. /ipns/docs.ipfs.io/reference/api/http/#api-v0-files-flush" (ipfs-call "files/flush" `(("arg" ,path)))) ;; [STRING] → ALIST || (NIL STRING) (defun files-ls (&optional (path "/")) "List directories in local mutable namespace. /ipns/docs.ipfs.io/reference/api/http/#api-v0-files-ls" (ipfs-call "files/ls" `(("arg" ,path)))) ;; STRING [:BOOLEAN :NUMBER :STRING] → NIL || (NIL STRING) (defun files-mkdir (path &key (parents nil) (cid-version nil) (hash nil)) "Make a directory. /ipns/docs.ipfs.io/reference/api/http/#api-v0-files-mkdir" (ipfs-call "files/mkdir" `(("arg" ,path) ,(if parents (list "parents" parents)) ,(if cid-version `("cid-version" ,cid-version)) ,(if hash (list "hash" hash))))) ;; STRING STRING → NIL || (NIL STRING) (defun files-mv (source destination) "Move a file. /ipns/docs.ipfs.io/reference/api/http/#api-v0-files-mv" (ipfs-call "files/mv" `(("arg" ,source)("arg" ,destination)))) ;; STRING [:NUMBER :NUMBER] → STRING || (NIL STRING) (defun files-read (path &key (offset nil) (max nil)) "Read a file in given mfs. /ipns/docs.ipfs.io/reference/api/http/#api-v0-files-read" (ipfs-call "files/read" `(("arg" ,path) ,(if offset (list "offset" offset)) ,(if max (list "max" max))))) ;; STRING [:BOOLEAN :BOOLEAN] → NIL || (NIL STRING) (defun files-rm (path &key (recursive nil) (force nil)) "Remove a given file. /ipns/docs.ipfs.io/reference/api/http/#api-v0-files-rm" (ipfs-call "files/rm" `(("arg" ,path) ("recursive" ,recursive) ("force" ,force)))) ;; STRING → ALIST || (NIL STRING) (defun files-stat (path) "Get file status. /ipns/docs.ipfs.io/reference/api/http/#api-v0-files-stat" (ipfs-call "files/stat" `(("arg" ,path)))) ;; PATHNAME STRING [:NUMBER :BOOLEAN :BOOLEAN :BOOLEAN :NUMBER :BOOLEAN ;; :NUMBER :STRING] ;; → NIL || (NIL STRING) (defun files-write (path-or-string dest-path &key (offset nil) (create nil) (parents nil) (truncate nil) (count nil) (raw-leaves nil) (cid-version nil) (hash nil)) "Write to a given file. First parameter can be a string or a path to a local file. /ipns/docs.ipfs.io/reference/api/http/#api-v0-files-rm" (let ((result (multiple-value-list (drakma:http-request (make-call-url "files/write" `(("arg" ,dest-path) ("create", create) ("parents" ,parents) ("truncate" ,truncate) ("raw-leaves" ,raw-leaves) ,@(when offset (list "offset" offset)) ,@(when count (list "count" count)) ,@(when cid-version `("cid-version" ,cid-version)) ,@(when hash (list "hash" hash)))) :method :post :parameters `(("data" . ,path-or-string)) :form-data t)))) (apply #'process-result result))) (defmacro with-files-write ((stream dest-path &rest params) &body body) "A convenience macro for files-write. In the body of the macro, any writes to the stream named by STREAM will be sent to the mfs file at DEST-PATH. PARAMS will be passed directly to the files-write function." (let ((fn (gensym "FN"))) ;;FIXME: Would be nice to write the stream directly to files-write. ;; This feels a little less efficient. `(uiop:with-temporary-file (:stream ,stream :pathname ,fn) ,@body :close-stream (files-write ,fn ,dest-path ,@params)))) ;; ————————————————————————————————————— ;; FILESTORE CALLS ;; NIL → ALIST || (NIL STRING) (defun filestore-dups () "List blocks that're both in the filestore and standard block storage. /ipns/docs.ipfs.io/reference/api/http/#api-v0-filestore-dups" (ipfs-call "filestore/dups" '())) ;; [STRING] → ALIST || (NIL STRING) (defun filestore-ls (&optional cid) "List objects in filestore. /ipns/docs.ipfs.io/reference/api/http/#api-v0-filestore-ls" (ipfs-call "filestore/ls" `(,(if cid (list "arg" cid))))) ;; [STRING] → ALIST || (NIL STRING) (defun filestore-verify (&optional cid) "Verify objects in filestore. /ipns/docs.ipfs.io/reference/api/http/#api-v0-filestore-verify" (ipfs-call "filestore/verify" `(,(if cid (list "arg" cid))))) ;; ————————————————————————————————————— ;; KEY CALLS ;; STRING [:STRING :NUMBER] → ALIST || (NIL STRING) (defun key-gen (name &key (type nil) (size nil)) "Create a new keypair. /ipns/docs.ipfs.io/reference/api/http/#api-v0-key-gen" (ipfs-call "key/gen" `(("name" ,name) ,(if type (list "type" type)) ,(if size (list "size" size))))) ;; NIL → ALIST || (NIL STRING) (defun key-list () "List all local keypairs. /ipns/docs.ipfs.io/reference/api/http/#api-v0-key-list" (ipfs-call "key/list" '())) ;; STRING STRING [:BOOLEAN] → ALIST || (NIL STRING) (defun key-rename (old-name new-name &key (force nil)) "Rename a local keypair. /ipns/docs.ipfs.io/reference/api/http/#api-v0-key-rename" (ipfs-call "key/rename" `(("arg" ,old-name) ("arg" ,new-name) ("force" ,force)))) ;; STRING → ALIST || (NIL STRING) (defun key-remove (name) "Remove a keypair, based on name. /ipns/docs.ipfs.io/reference/api/http/#api-v0-key-remove" (ipfs-call "key/remove" `(("arg" ,name)))) ;; ————————————————————————————————————— ;; LOG CALLS ;; STRING STRING → STRING || (NIL STRING) (defun log-level (subsystem level) "Change the logging level of a subsystem. /ipns/docs.ipfs.io/reference/api/http/#api-v0-log-level" (cdr (s-assoc "Message" (ipfs-call "log/level" `(("arg" ,subsystem)("arg" ,level)))))) ;; NIL → LIST || (NIL STRING) (defun log-ls () "List the logging subsystems. /ipns/docs.ipfs.io/reference/api/http/#api-v0-log-ls" (cdr (ipfs-call "log/ls" '()))) ;; NIL → STRING || (NIL STRING) (defun log-tail () "Read the event log. /ipns/docs.ipfs.io/reference/api/http/#api-v0-log-tail" (ipfs-call "log/tail" '()) result) ;; ————————————————————————————————————— ;; NAME CALLS ;; STRING [:BOOLEAN :STRING :BOOLEAN :STRING] → ALIST || (NIL STRING) (defun name-publish (ipfs-path &key (resolve 'T) (lifetime "24h") (allow-offline 'T) (ttl nil)) "Publish an IPNS name-- associate it with an IPFS path. /ipns/docs.ipfs.io/reference/api/http/#api-v0-name-publish" (ipfs-call "name/publish" `(("arg" ,ipfs-path)("resolve" ,resolve) ("lifetime" ,lifetime) ("allow-offline" ,allow-offline) ,(if ttl (list "ttl" ttl))))) ;; STRING → STRING || (NIL STRING) (defun name-pubsub-cancel (name) "Cancel subscription to a name. /ipns/docs.ipfs.io/reference/api/http/#api-v0-name-pubsub-cancel" (cdr (s-assoc "Cancelled" (ipfs-call "name/pubsub/cancel" `(("arg" ,name)))))) ;; NIL → STRING || (NIL STRING) (defun name-pubsub-state () "Query the state of IPNS pubsub. /ipns/docs.ipfs.io/reference/api/http/#api-v0-name-pubsub-state" (cdr (s-assoc "Enabled" (ipfs-call "name/pubsub/state" '())))) ;; NIL → STRING || (NIL STRING) (defun name-pubsub-subs () "Show current name subscriptions. /ipns/docs.ipfs.io/reference/api/http/#api-v0-name-pubsub-subs" (cdr (s-assoc "Strings" (ipfs-call "name/pubsub/subs" '())))) ;; STRING [:BOOLEAN :BOOLEAN :NUMBER :STRING] → STRING || (NIL STRING) (defun name-resolve (name &key (recursive 't) (nocache "") (dht-record-count nil) (dht-timeout nil)) "Resolve a given IPNS name. /ipns/docs.ipfs.io/reference/api/http/#api-v0-name-resolve" (ipfs-call "name/resolve" `(("arg" ,name)("recursive" ,recursive) ,(when (not (empty-string-p nocache)) (list "nocache" nocache)) ,(when dht-record-count (list "dht-record-count" dht-record-count)) ,(when dht-timeout (list "dht-timeout" dht-timeout))))) ;; ————————————————————————————————————— ;; OBJECT CALLS ;; STRING → STRING || (NIL STRING) (defun object-data (key) "Output the raw data of an IPFS object. /ipns/docs.ipfs.io/reference/api/http/#api-v0-object-data" (ipfs-call "object/data" `(("arg" ,key)))) ;; STRING STRING → ALIST || (NIL STRING) (defun object-diff (object-a object-b) "Display the differences between two IPFS objects. /ipns/docs.ipfs.io/reference/api/http/#api-v0-object-diff" (ipfs-call "object/diff" `(("arg" ,object-a)("arg" ,object-b)))) ;; STRING [:STRING] → STRING || (NIL STRING) (defun object-get (key &key (data-encoding "text")) "Get and serialize the named DAG node. /ipns/docs.ipfs.io/reference/api/http/#api-v0-object-get" (ipfs-call "object/get" `(("arg" ,key)("data-encoding" ,data-encoding)))) ;; STRING → ALIST || (NIL STRING) (defun object-links (key) "Output the links pointed to by the specified object. /ipns/docs.ipfs.io/reference/api/http/#api-v0-object-links" (ipfs-call "object/links" `(("arg" ,key)))) ;; [:STRING] → ALIST || (NIL STRING) (defun object-new (&key (template nil)) "Create a new object from an IPFS template. /ipns/docs.ipfs.io/reference/api/http/#api-v0-object-new" (ipfs-call "object/new"`(,(if template `("template" ,template))))) ;; STRING STRING STRING [:BOOLEAN] → ALIST || (NIL STRING) (defun object-patch-add-link (hash name object &key (create "")) "Add a link to a given object. /ipns/docs.ipfs.io/reference/api/http/#api-v0-object-patch-add-link" (ipfs-call "object/patch/add-link" `(("arg" ,hash)("arg" ,name)("arg" ,object) ,(when (not (empty-string-p create)) `("create" ,create))))) ;; STRING STRING → ALIST || (NIL STRING) (defun object-patch-rm-link (hash name) "Remove a link from a given object. /ipns/docs.ipfs.io/reference/api/http/#api-v0-object-patch-rm-link" (ipfs-call "object/patch/rm-link" `(("arg" ,hash)("arg" ,name)))) ;; STRING → ALIST || (NIL STRING) (defun object-stat (key) "Get stats for a DAG node. /ipns/docs.ipfs.io/reference/api/http/#api-v0-object-stat" (ipfs-call "object/stat" `(("arg" ,key)))) ;; ————————————————————————————————————— ;; P2P CALLS ;; [:BOOLEAN :STRING :STRING :STRING :STRING] → NUMBER || (NIL STRING) (defun p2p-close (&key (all "") (protocol nil) (listen-address nil) (target-address nil)) "Stop listening for new connections to forward. /ipns/docs.ipfs.io/reference/api/http/#api-v0-p2p-close" (ipfs-call "p2p/close" `(,(when (not (empty-string-p all)) `("all" ,all)) ,(when protocol `("protocol" ,protocol)) ,(when listen-address `("listen-address" ,listen-address)) ,(when target-address `("target-address" ,target-address))))) ;; STRING STRING STRING [:BOOLEAN] → STRING || (NIL STRING) (defun p2p-forward (protocol listening-endpoint target-endpoint &key (allow-custom-protocol "")) "Forward connections to libp2p service. /ipns/docs.ipfs.io/reference/api/http/#api-v0-p2p-forward" (ipfs-call "p2p/forward" `(("arg" ,protocol)("arg" ,listening-endpoint) ("arg" ,target-endpoint) ,(when (not (empty-string-p allow-custom-protocol)) `("allow-custom-protocol" ,allow-custom-protocol))))) ;; STRING STRING [:BOOLEAN :BOOLEAN] → STRING || (NIL STRING) (defun p2p-listen (protocol target-endpoint &key (allow-custom-protocol "") (report-peer-id "")) "Create libp2p service. /ipns/docs.ipfs.io/reference/api/http/#api-v0-p2p-listen" (ipfs-call "p2p/listen" `(("arg" ,protocol)("arg" ,target-endpoint) ,(when (not (empty-string-p allow-custom-protocol)) `("allow-custom-protocol" ,allow-custom-protocol)) ,(when (not (empty-string-p report-peer-id)) `("report-peer-id" ,report-peer-id))))) ;; NIL → ALIST || (NIL STRING) (defun p2p-ls () "List active p2p listeners. /ipns/docs.ipfs.io/reference/api/http/#api-v0-p2p-ls" (ipfs-call "p2p/ls" '())) ;; [:STRING :BOOLEAN] → STRING || (NIL STRING) (defun p2p-stream-close (&key (identifier nil) (all "")) "Close an active p2p stream. /ipns/docs.ipfs.io/reference/api/http/#api-v0-p2p-stream-close" (ipfs-call "p2p/stream/close" `(,(when identifier `("arg" ,identifier)) ,(when (not (empty-string-p all)) `("all" ,all))))) ;; NIL → ALIST || (NIL STRING) (defun p2p-stream-ls () "List active p2p streams. /ipns/docs.ipfs.io/reference/api/http/#api-v0-p2p-stream-ls" (ipfs-call "p2p/stream/ls" '())) ;; ————————————————————————————————————— ;; PIN CALLS ;; STRING [:BOOLEAN] → ALIST || (NIL STRING) (defun pin-add (path &key (recursive 'T)) "Pin an object to local storage. /ipns/docs.ipfs.io/reference/api/http/#api-v0-pin-add" (ipfs-call "pin/add" `(("arg" ,path)("recursive" ,recursive)))) ;; [:STRING :STRING] → ALIST || (NIL STRING) (defun pin-ls (&key (path nil) (type "all")) "List objects pinned to local storage. /ipns/docs.ipfs.io/reference/api/http/#api-v0-pin-ls" (let ((res (ipfs-call "pin/ls" `(,(when path `("arg" ,path)) ("type" ,type))))) (if (equal res '("Keys")) nil res))) ;; STRING [:BOOLEAN] → ALIAS || (NIL STRING) (defun pin-rm (path &key (recursive 'T)) "Remove pinned objects from local storage. /ipns/docs.ipfs.io/reference/api/http/#api-v0-pin-rm" (ipfs-call "pin/rm" `(("arg" ,path)("recursive" ,recursive)))) ;; STRING STRING [:BOOLEAN] → ALIST || (NIL STRING) (defun pin-update (old-path new-path &key (unpin 'T)) "Update a recursive pin. /ipns/docs.ipfs.io/reference/api/http/#api-v0-pin-update" (ipfs-call "pin/update" `(("arg" ,old-path)("arg" ,new-path)("unpin" ,unpin)))) ;; NIL → ALIST || (NIL STRING) (defun pin-verify () "Verify that recursive pins are complete. /ipns/docs.ipfs.io/reference/api/http/#api-v0-pin-verify" (ipfs-call "pin/verify" '())) ;; ————————————————————————————————————— ;; PUBSUB CALLS ;; STRING [:STRING] → PROCESS-INFO-STREAM (defun pubsub-sub (topic &key (env "")) "Subscribe to a given pubsub topic— this function requires go-ipfs to be installed on the current machine, and that `ipfs` is in the current $PATH. This probably will only work on *nix systems (sorry Windows nerds). Returns a uiop/launch-program::process-info socket-- can be used in conjunction with the #'pubsub-sub-* functions, or with :uiop/launch-program's functions. A system-dependent replacement for /ipns/docs.ipfs.io/reference/api/http/#api-v0-pubsub-sub" (when (and *ipfs-root* (empty-string-p env)) (setq env (string+ "env IPFS_PATH=" *ipfs-root* " > /dev/null;"))) (uiop:launch-program (string+ env "ipfs pubsub sub " topic) :output :stream)) ;; PROCESS-INFO-STREAM → FD-STREAM (defun pubsub-sub-process (pubsub-socket) "Turn a uiop process-info-stream ('pubsub stream') into a fd-stream that is #'read-char-able, etc." (uiop/launch-program:process-info-output pubsub-socket)) ;; PROCESS-INFO-STREAM → CHARACTER (defun pubsub-sub-read-char (pubsub-socket) "Process a 'pubsub stream' (process-info-stream) and #'readchar it." (read-char (pubsub-sub-process pubsub-socket))) ;; PROCESS-INFO-STREAM → BOOLEAN (defun pubsub-sub-listen (pubsub-socket) "Process a 'pubsub stream' (process-info-stream) and #'listen it." (listen (pubsub-sub-process pubsub-socket))) ;; PROCESS-INFO-STREAM → NIL (defun pubsub-sub-close (pubsub-socket) "Close a 'pubsub stream' (process-info-stream) and related processes." (and (uiop/launch-program:terminate-process pubsub-socket :urgent 't) (uiop/launch-program:close-streams pubsub-socket))) ;; ————————————————— ;; STRING STRING [:STRING] → NIL (defun pubsub-pub (topic string &key (env "")) "Publish a string to a given pubsub topic. /ipns/docs.ipfs.io/reference/api/http/#api-v0-pubsub-pub" (when (and *ipfs-root* (empty-string-p env)) (setq env (string+ "env IPFS_PATH=" *ipfs-root* " > /dev/null;"))) (uiop:run-program (string+ env "ipfs pubsub pub " topic " \"" string "\"")) nil) ;; ————————————————— ;; NIL → LIST || (NIL STRING) (defun pubsub-ls () "Return a list of subscribed topics. /ipns/docs.ipfs.io/reference/api/http/#api-v0-pubsub-ls" (s-assoc "Strings" (ipfs-call "pubsub/ls" '()))) ;; [STRING] → LIST || (NIL STRING) (defun pubsub-peers (&optional topic) "Return a list of peers with pubsub enabled. /ipns/docs.ipfs.io/reference/api/http/#api-v0-pubsub-peers" (s-assoc "Strings" (ipfs-call "pubsub/peers" `(,(if topic (list "arg" topic)))))) ;; ————————————————————————————————————— ;; REFS CALLS ;; STRING [:BOOLEAN :BOOLEAN :NUMBER] → ALIST || (NIL STRING) (defun refs (path &key (unique "") (recursive "") (max-depth -1)) "List links (references) from an object. /ipns/docs.ipfs.io/reference/api/http/#api-v0-refs" (ipfs-call "refs" `(("arg" ,path)("max-depth" ,max-depth) ,(if (not (empty-string-p recursive)) `("recursive" ,recursive)) ,(if (not (empty-string-p unique)) `("unique" ,unique))))) ;; NIL → ALIST || (NIL STRING) (defun refs-local () "List all local references. /ipns/docs.ipfs.io/reference/api/http/#api-v0-refs-local" (ipfs-call "refs/local" '())) ;; ————————————————————————————————————— ;; REPO CALLS ;; NIL → STRING || (NIL STRING) (defun repo-fsck () "Remove repo lock-files. /ipns/docs.ipfs.io/reference/api/http/#api-v0-repo-fsck" (cdr (s-assoc "Message" (ipfs-call "repo/fsck" '())))) ;; NIL → ALIST || (NIL STRING) (defun repo-gc () "Perform garbage collection on the repo. /ipns/docs.ipfs.io/reference/api/http/#api-v0-repo-gc" (ipfs-call "repo/gc" '())) ;; NIL → ALIST || (NIL STRING) (defun repo-stat () "Get stats for the current repo. /ipns/docs.ipfs.io/reference/api/http/#api-v0-repo-stat" (ipfs-call "repo/stat" '())) ;; NIL → ALIST || (NIL STRING) (defun repo-verify () "Verify that all repo blocks aren't corrupted. /ipns/docs.ipfs.io/reference/api/http/#api-v0-repo-verify" (ipfs-call "repo/verify" '())) ;; NIL → NUMBER || (NIL STRING) (defun repo-version () "Show the repo version. /ipns/docs.ipfs.io/reference/api/http/#api-v0-repo-version" (parse-integer (ipfs-call "repo/version" '()))) ;; ————————————————————————————————————— ;; STATS CALLS ;; NIL → ALIST || (NIL STRING) (defun stats-bitswap () "Show diagnostics on bitswap. /ipns/docs.ipfs.io/reference/api/http/#api-v0-stats-bitswap" (ipfs-call "stats/bitswap" '())) ;; [:STRING :STRING :STRING] → ALIST || (NIL STRING) (defun stats-bw (&key (peer nil) (proto nil) (interval nil)) "Return bandwidth information. /ipns/docs.ipfs.io/reference/api/http/#api-v0-stats-bw" (ipfs-call "stats/bitswap" `(,(when peer `("peer" ,peer)) ,(when proto `("proto" ,proto)) ,(when interval `("interval" ,interval)) ,(when interval `("poll" 'T))))) ;; NIL → ALIST || (NIL STRING) (defun stats-repo () "Show diagnostics on current repo. /ipns/docs.ipfs.io/reference/api/http/#api-v0-stats-repo" (ipfs-call "stats/repo" '())) ;; ————————————————————————————————————— ;; SWARM CALLS ;; NIL → ALIST || (NIL STRING) (defun swarm-addrs () "List known addresses. /ipns/docs.ipfs.io/reference/api/http/#api-v0-swarm-addrs" (ipfs-call "swarm/addrs" '())) ;; NIL → LIST || (NIL STRING) (defun swarm-addrs-listen () "List interface listening addresses. /ipns/docs.ipfs.io/reference/api/http/#api-v0-swarm-addrs-listen" (cdr (ipfs-call "swarm/addrs/listen" '()))) ;; NIL → LIST || (NIL STRING) (defun swarm-addrs-local () "List local addresses. /ipns/docs.ipfs.io/reference/api/http/#api-v0-swarm-addrs-local" (cdr (ipfs-call "swarm/addrs/local" '()))) ;; STRING → LIST || (NIL STRING) (defun swarm-connect (address) "Open connection to a given address. /ipns/docs.ipfs.io/reference/api/http/#api-v0-swarm-connect" (cdr (ipfs-call "swarm/connect" `(("arg" ,address))))) ;; STRING → LIST || (NIL STRING) (defun swarm-disconnect (address) "Close connection to a given address. /ipns/docs.ipfs.io/reference/api/http/#api-v0-swarm-disconnect" (cdr (ipfs-call "swarm/disconnect" `(("arg" ,address))))) ;; NIL → LIST || (NIL STRING) (defun swarm-filters () "List address filters. /ipns/docs.ipfs.io/reference/api/http/#api-v0-swarm-filters" (ipfs-call "swarm/filters" '())) ;; STRING → LIST || (NIL STRING) (defun swarm-filters-add (multiaddr) "Add an address filter. /ipns/docs.ipfs.io/reference/api/http/#api-v0-swarm-filters-add" (ipfs-call "swarm/filters/add" `(("arg" ,multiaddr)))) ;; STRING → LIST || (NIL STRING) (defun swarm-filters-rm (multiaddr) "Remove an address filter. /ipns/docs.ipfs.io/reference/api/http/#api-v0-swarm-filters-rm" (ipfs-call "swarm/filters/rm" `(("arg" ,multiaddr)))) ;; NIL → ALIST || (NIL STRING) (defun swarm-peers () "List peers with open connections. /ipns/docs.ipfs.io/reference/api/http/#api-v0-swarm-peers" (ipfs-call "swarm/peers" '())) ;; ————————————————————————————————————— ;; URLSTORE CALLS ;; STRING [:BOOLEAN :BOOLEAN] → ALIST || (NIL STRING) (defun urlstore-add (url &key (pin 'T) (trickle "")) "Add a URL via urlstore. /ipns/docs.ipfs.io/reference/api/http/#api-v0-urlstore-add" (ipfs-call "urlstore/add"`(("arg" ,url)("pin" ,pin) ,(when (not (empty-string-p trickle)) `("trickle" ,trickle))))) ;; ————————————————————————————————————— ;; VERSION CALLS ;; NIL → LIST || (NIL STRING) (defun version () "Return the current golang, system, repo, and IPFS versions. /ipns/docs.ipfs.io/reference/api/http/#api-v0-version" (ipfs-call "version" nil)) ;; NIL → ALIST (defun version-deps () "Return info about dependencies used for build; I.E., Go version, OS, etc. /ipns/docs.ipfs.io/reference/api/http/#api-v0-version" (ipfs-call "version/deps" '())) ;; ————————————————————————————————————— ;; UTIL ;; LIST -> LIST (defun simplify (list) "'Simplify' a list. Remove any extraneous sublisting [ ((2 3)) -> (2 3) ], and remove extraneous strings in otherwise pure alists, e.g. [ (``Apple'' (2 2) (3 3) (4 4)) -> ((2 2) (3 3) (4 4)) ]" (cond ((and (stringp (car list)) (stringp (cdr list))) (cdr list)) ((and (eq 1 (length list)) (consp (car list))) (simplify (car list))) ((and (consp list) (stringp (car list)) (consp (cadr list))) (simplify (cdr list))) ('T list))) ;; STRING LIST (defun s-assoc (key alist) "Get the value of an associative list using a string key." (assoc key alist :test #'string-equal)) ;; STRING-A STRING-B … STRING-N → STRING (defun string+ (&rest strings) "Combine an arbitrary amount of strings into a single string." (reduce (lambda (a b) (format nil "~A~A" a b)) strings)) ;; STRING → BOOLEAN (defun empty-string-p (string) "Return whether or not a given item is an empty string." (and (stringp string) (zerop (length string)))) ;; STRING → STRING (defun url-encode (string &rest ignored) "Wrap around drakma's url encoder, with a slight change-- instead of using plus-signs for spaces, we want to use %20." ignored (cl-ppcre:regex-replace-all "%2520" (drakma:url-encode (cl-ppcre:regex-replace-all " " string "%20") :utf-8) "%20"))
42,766
Common Lisp
.lisp
894
39.763982
88
0.619667
JadedCtrl/cl-ipfs-api2
9
3
7
LGPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
4fc6cd08a27b70e667ef25f026105de7a2461106c5618fbbd9dd3a67e7ec9ef3
11,573
[ -1 ]
11,574
cl-ipfs-api2.asd
JadedCtrl_cl-ipfs-api2/cl-ipfs-api2.asd
(defsystem "cl-ipfs-api2" :version "0.51" :license "LGPLv3" :author "Jaidyn Ann <[email protected]>" :description "Bindings for the IPFS HTTP API." :depends-on (:drakma :yason :arnesi :uiop) :components ((:file "package") (:file "main")))
290
Common Lisp
.asd
8
29.125
50
0.599291
JadedCtrl/cl-ipfs-api2
9
3
7
LGPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
c1b26d66f33c839f3468454c86cc4af492835b34b721e1fc026f02d22861da57
11,574
[ -1 ]
11,593
package.lisp
outergod_cl-m4/test/package.lisp
;;;; cl-m4 - package.lisp ;;;; Copyright (C) 2009, 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cl-m4-test-system) (defpackage :cl-m4-test (:use :cl :cffi-regex :hu.dwim.stefil) (:export :all) (:shadowing-import-from :cl-m4 m4-macro with-m4-lib *m4-lib* *m4-parse-row* *m4-parse-column* *m4-runtime-lib*)) (in-package :cl-m4-test) (in-suite root-suite) (defsuite all)
1,074
Common Lisp
.lisp
23
45.26087
114
0.715377
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
a2c5fb53de0e078a03dfdf4e41e04605eead399d9af4f10689890105c5b04815
11,593
[ -1 ]
11,594
m4-macros.lisp
outergod_cl-m4/test/m4-macros.lisp
;;;; cl-m4 - m4-macros.lisp ;;;; Copyright (C) 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cl-m4-test) (in-suite m4) ;;; 4 How to invoke macros ;; 4.4 On Quoting Arguments to macros ; "For example, if foo is a macro, ; foo(() (`(') `(') ; is a macro call, with one argument, whose value is ‘() (() (’" (deftest gnu-m4-4.4-1 () (m4-test #>m4> define(`foo', `[$1] [$2]') foo(() (`(') `(') foo(`() (() (') m4 #>m4> [() (() (] [] [() (() (] [] m4 :depends (list "define"))) (deftest gnu-m4-4.4-2 () (m4-test #>m4> define(`active', `ACT, IVE') define(`show', `$1 $1') show(active) show(`active') show(``active'') m4 #>m4> ACT ACT ACT, IVE ACT, IVE active active m4 :depends (list "define"))) ;;; 5 How to define new macros ;; 5.4 Deleting a macro ; "Undefining a macro inside that macro's expansion is safe; the macro still ; expands to the definition that was in effect at the ‘(’" (deftest gnu-m4-5.4 () (m4-test #>m4> define(`f', ``$0':$1') f(f(f(undefine(`f')`hello world'))) f(`bye')m4 #>m4> f:f:f:hello world f(bye)m4 :depends (list "define" "undefine"))) ;; 5.5 Renaming macros (deftest gnu-m4-5.5-1 () (m4-test #>m4> define(`zap', defn(`undefine')) zap(`undefine') undefine(`zap') m4 #>m4> undefine(zap) m4 :depends (list "define" "defn" "undefine"))) (deftest gnu-m4-5.5-2 () (m4-test #>m4> define(`foo', `This is `$0'') define(`bar', defn(`foo')) bar m4 #>m4> This is bar m4 :depends (list "define" "defn"))) (deftest gnu-m4-5.5-3 () (m4-test #>m4> define(`string', `The macro dnl is very useful ') string defn(`string') m4 #>m4> The macro The macro dnl is very useful m4 :depends (list "define" "defn"))) (deftest gnu-m4-5.5-4 () (m4-test #>m4> define(`foo', a'a) define(`a', `A') define(`echo', `$@') foo defn(`foo') echo(foo) m4 #>m4> A'A aA' AA' m4 :depends (list "define" "defn"))) (deftest gnu-m4-5.5-5 () (m4-test #>m4> define(`l', `<[>')define(`r', `<]>') changequote(`[', `]') defn([l])defn([r]) ]) defn([l], [r]) m4 #>m4> <[>]defn([r]) ) <[>][<]> m4 :depends (list "define" "changequote" "defn"))) (deftest gnu-m4-5.5-6 () (m4-test #>m4> defn(`defn') define(defn(`divnum'), `cannot redefine a builtin token') divnum len(defn(`divnum')) m4 #>m4> 0 0 m4 :error #>m4eof>cl-m4:3:57: define: invalid macro name ignored m4eof :depends (list "defn" "define" "divnum" "len"))) ; TODO traceon traceoff ;; (deftest gnu-m4-5.5-7 () ;; (m4-test ;; #>m4> ;; define(`a', `A')define(`AA', `b') ;; traceon(`defn', `define') ;; defn(`a', `divnum', `a') ;; define(`mydivnum', defn(`divnum', `divnum'))mydivnum ;; traceoff(`defn', `define') ;; m4 ;; #>m4> ;; AA ;; m4 ;; :error #>m4eof>cl-m4:stdin:3: cannot concatenate builtin `divnum' ;; cl-m4trace: -1- defn(`a', `divnum', `a') -> ``A'`A'' ;; cl-m4:stdin:4: cannot concatenate builtin `divnum' ;; cl-m4:stdin:4: cannot concatenate builtin `divnum' ;; cl-m4trace: -2- defn(`divnum', `divnum') ;; cl-m4trace: -1- define(`mydivnum', `') ;; m4eof ;; :depends (list "define" "traceon" "defn" "divnum" "traceoff"))) ;; 5.6 Temporarily redefining macros (deftest gnu-m4-5.6-1 () (m4-test #>m4> define(`foo', `Expansion one.') foo pushdef(`foo', `Expansion two.') foo pushdef(`foo', `Expansion three.') pushdef(`foo', `Expansion four.') popdef(`foo') foo popdef(`foo', `foo') foo popdef(`foo') foo m4 #>m4> Expansion one. Expansion two. Expansion three. Expansion one. foo m4 :depends (list "define" "pushdef" "popdef"))) (deftest gnu-m4-5.6-2 () (m4-test #>m4> define(`foo', `Expansion one.') foo pushdef(`foo', `Expansion two.') foo define(`foo', `Second expansion two.') foo undefine(`foo') foo m4 #>m4> Expansion one. Expansion two. Second expansion two. foo m4 :depends (list "define" "undefine" "pushdef"))) ;; 5.7 Indirect call of macros (deftest gnu-m4-5.7-1 () (m4-test #>m4> define(`$$internal$macro', `Internal macro (name `$0')') $$internal$macro indir(`$$internal$macro') m4 #>m4> $$internal$macro Internal macro (name $$internal$macro) m4 :depends (list "define" "indir"))) (deftest gnu-m4-5.7-2 () (m4-test #>m4> define(`f', `1') f(define(`f', `2')) indir(`f', define(`f', `3')) indir(`f', undefine(`f')) m4 #>m4> 1 3 m4 :error #>m4eof>cl-m4:5:25: undefined macro `f' m4eof :depends (list "define" "undefine" "indir"))) (deftest gnu-m4-5.7-3 () (m4-test #>m4> indir(defn(`defn'), `divnum') indir(`define', defn(`defn'), `divnum') indir(`define', `foo', defn(`divnum')) foo indir(`divert', defn(`foo')) m4 #>m4> 0 m4 :error #>m4eof>cl-m4:2:29: indir: invalid macro name ignored cl-m4:3:39: define: invalid macro name ignored cl-m4:6:28: empty string treated as 0 in builtin `divert' m4eof :depends (list "indir" "defn" "divnum" "define"))) ;; 5.8 Indirect call of builtins (deftest gnu-m4-5.8-1 () (m4-test #>m4> pushdef(`define', `hidden') undefine(`undefine') define(`foo', `bar') foo builtin(`define', `foo', defn(`divnum')) foo builtin(`define', `foo', `BAR') foo undefine(`foo') foo builtin(`undefine', `foo') foo m4 #>m4> hidden foo 0 BAR undefine(foo) BAR foo m4 :depends (list "pushdef" "define" "undefine" "builtin" "defn" "divnum"))) (deftest gnu-m4-5.8-3 () (m4-test #>m4> builtin builtin() builtin(`builtin') builtin(`builtin',) builtin(`builtin', ``' ') indir(`index') m4 #>m4> builtin m4 :error #>m4eof>cl-m4:3:9: undefined builtin `' cl-m4:4:18: too few arguments to builtin `builtin' cl-m4:5:19: undefined builtin `' cl-m4:7:15: undefined builtin ``' ' cl-m4:8:14: too few arguments to builtin `index' m4eof :depends (list "builtin" "indir" "index"))) ;;; 6 Conditionals, loops, and recursion ;; 6.1 Testing if a macro is defined (deftest gnu-m4-6.1 () (m4-test #>m4> ifdef(`foo', ``foo' is defined', ``foo' is not defined') define(`foo', `') ifdef(`foo', ``foo' is defined', ``foo' is not defined') ifdef(`no_such_macro', `yes', `no', `extra argument') m4 #>m4> foo is not defined foo is defined no m4 :error #>m4eof>cl-m4:5:53: excess arguments to builtin `ifdef' ignored m4eof :depends (list "ifdef" "define"))) ;; 6.2 If-else construct, or multibranch (deftest gnu-m4-6.2-1 () (m4-test #>m4> ifelse(`some comments') ifelse(`foo', `bar') m4 #>m4> m4 :error #>m4eof>cl-m4:3:20: too few arguments to builtin `ifelse' m4eof :depends (list "ifelse"))) (deftest gnu-m4-6.2-2 () (m4-test #>m4> ifelse(`foo', `bar', `true') ifelse(`foo', `foo', `true') define(`foo', `bar') ifelse(foo, `bar', `true', `false') ifelse(foo, `foo', `true', `false') m4 #>m4> true true false m4 :depends (list "ifelse" "define"))) (deftest gnu-m4-6.2-3 () (m4-test #>m4> define(`foo', `ifelse(`$#', `0', ``$0'', `arguments:$#')') foo foo() foo(`a', `b', `c') m4 #>m4> foo arguments:1 arguments:3 m4 :depends (list "ifelse" "define"))) (deftest gnu-m4-6.2-4 () (m4-test #>m4> ifelse(`foo', `bar', `third', `gnu', `gnats') ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth') ifelse(`foo', `bar', `third', `gnu', `gnats', `sixth', `seventh') ifelse(`foo', `bar', `3', `gnu', `gnats', `6', `7', `8') m4 #>m4> gnu seventh 7 m4 :error #>m4eof>cl-m4:2:45: excess arguments to builtin `ifelse' ignored cl-m4:5:56: excess arguments to builtin `ifelse' ignored m4eof :depends (list "ifelse" "define"))) ;; 6.3 Recursion in m4 (deftest gnu-m4-6.3-1 () (m4-test #>m4> shift shift(`bar') shift(`foo', `bar', `baz') m4 #>m4> shift bar,baz m4 :depends (list "shift"))) ;;; 7 How to debug macros and input ;; 7.1 Displaying macro definitions (deftest gnu-m4-7.1-1 () (m4-test #>m4> define(`foo', `Hello world.') dumpdef(`foo') dumpdef(`define') m4 #>m4> m4 :error #>m4>foo: Hello world. define: <define> m4 :depends (list "define" "dumpdef"))) (deftest gnu-m4-7.1-2 () (m4-test #>m4> pushdef(`f', ``$0'1')pushdef(`f', ``$0'2') f(popdef(`f')dumpdef(`f')) f(popdef(`f')dumpdef(`f')) m4 #>m4> f2 f1 m4 :error #>m4eof>f: `$0'1 cl-m4:4:25: undefined macro `f' m4eof :depends (list "pushdef" "popdef" "dumpdef"))) ;; TODO debugmode, debugfile ;; 7.2 Tracing macro calls (deftest gnu-m4-7.2-1 () (m4-test #>m4> define(`foo', `Hello World.') define(`echo', `$@') traceon(`foo', `echo') foo echo(`gnus', `and gnats') m4 #>m4> Hello World. gnus,and gnats m4 :error #>m4eof>cl-m4trace: -1- foo -> `Hello World.' cl-m4trace: -1- echo(`gnus', `and gnats') -> ``gnus',`and gnats'' m4eof :depends (list "define" "traceon"))) (deftest gnu-m4-7.2-2 () (m4-test #>m4> ifelse(`one level') ifelse(ifelse(ifelse(`three levels'))) ifelse(ifelse(ifelse(ifelse(`four levels')))) m4 #>m4> m4 :error #>m4eof>cl-m4trace: -1- ifelse cl-m4trace: -3- ifelse cl-m4trace: -2- ifelse cl-m4trace: -1- ifelse cl-m4:stdin:3: recursion limit of 3 exceeded, use -L<N> to change it m4eof :depends (list "define" "traceon"))) ;;; 8 Input control ;; 8.1 Deleting whitespace in input (deftest gnu-m4-8.1-1 () (m4-test #>m4> define(`foo', `Macro `foo'.')dnl A very simple macro, indeed. foo m4 #>m4> Macro foo. m4 :depends (list "define" "dnl"))) (deftest gnu-m4-8.1-2 () (m4-test #>m4> dnl(`args are ignored, but side effects occur', define(`foo', `like this')) while this text is ignored: undefine(`foo') See how `foo' was defined, foo? m4 #>m4> See how foo was defined, like this? m4 :error #>m4eof>cl-m4:3:27: excess arguments to builtin `dnl' ignored m4eof :depends (list "define" "dnl"))) (deftest gnu-m4-8.1-3 () (m4-test #>m4eof> m4wrap(`m4wrap(`2 hi ')0 hi dnl 1 hi') define(`hi', `HI') m4eof #>m4> 0 HI 2 HI m4 :error #>m4eof>cl-m4:5:0: end of file treated as newline m4eof :depends (list "m4wrap" "define" "dnl"))) ;; 8.2 Changing the quote characters (deftest gnu-m4-8.2-1 () (m4-test #>m4> changequote(`[', `]') define([foo], [Macro [foo].]) foo m4 #>m4> Macro foo. m4 :depends (list "define" "changequote"))) (deftest gnu-m4-8.2-2 () (m4-test #>m4> changequote(`[[[', `]]]') define([[[foo]]], [[[Macro [[[[[foo]]]]].]]]) foo m4 #>m4> Macro [[foo]]. m4 :depends (list "define" "changequote"))) (deftest gnu-m4-8.2-3 () (m4-test #>m4> define(`foo', `Macro `FOO'.') changequote(`', `') foo `foo' changequote(`,) foo m4 #>m4> Macro `FOO'. `Macro `FOO'.' Macro FOO. m4 :depends (list "define" "changequote"))) (deftest gnu-m4-8.2-4 () (m4-test #>m4> define(`echo', `$@') define(`hi', `HI') changequote(`q', `Q') q hi Q hi echo(hi) changequote changequote(`-', `EOF') - hi EOF hi changequote changequote(`1', `2') hi1hi2 hi 1hi2 m4 #>m4> q HI Q HI qHIQ hi HI hi1hi2 HI hi m4 :depends (list "define" "changequote"))) (deftest gnu-m4-8.2-5 () (m4-test #>m4> define(`echo', `$#:$@:') define(`hi', `HI') changequote(`(',`)') echo(hi) changequote changequote(`((', `))') echo(hi) echo((hi)) changequote changequote(`,', `)') echo(hi,hi)bye) m4 #>m4> 0::hi 1:HI: 0::hi 1:HIhibye: m4 :depends (list "define" "changequote"))) (deftest gnu-m4-8.2-6 () (m4-test #>m4> changequote(`[', `]')dnl define([a], [1, (b)])dnl define([b], [2])dnl define([quote], [[$*]])dnl define([expand], [_$0(($1))])dnl define([_expand], [changequote([(], [)])$1changequote`'changequote(`[', `]')])dnl expand([a, a, [a, a], [[a, a]]]) quote(a, a, [a, a], [[a, a]]) m4 #>m4> 1, (2), 1, (2), a, a, [a, a] 1,(2),1,(2),a, a,[a, a] m4 :depends (list "changequote" "dnl" "define"))) (deftest gnu-m4-8.2-7 () (m4-test #>m4> define(`hi', `HI') changequote(`""', `"') ""hi"""hi" ""hi" ""hi" ""hi"" "hi" changequote `hi`hi'hi' changequote(`"', `"') "hi"hi"hi" m4 #>m4> hihi hi hi hi" "HI" hi`hi'hi hiHIhi m4 :depends (list "define" "changequote"))) ;; 8.3 Changing the comment delimiters (deftest gnu-m4-8.3-1 () (m4-test #>m4> define(`comment', `COMMENT') # A normal comment changecom(`/*', `*/') # Not a comment anymore But: /* this is a comment now */ while this is not a comment m4 #>m4> # A normal comment # Not a COMMENT anymore But: /* this is a comment now */ while this is not a COMMENT m4 :depends (list "define" "changecom"))) (deftest gnu-m4-8.3-2 () (m4-test #>m4> define(`comment', `COMMENT') changecom # Not a comment anymore changecom(`#', `') # comment again m4 #>m4> # Not a COMMENT anymore # comment again m4 :depends (list "define" "changecom"))) (deftest gnu-m4-8.3-3 () (m4-test #>m4> define(`hi', `HI') define(`hi1hi2', `hello') changecom(`q', `Q') q hi Q hi changecom(`1', `2') hi1hi2 hi 1hi2 m4 #>m4> q hi Q HI hello HI 1hi2 m4 :depends (list "define" "changecom"))) (deftest gnu-m4-8.3-4 () (m4-test #>m4> define(`echo', `$#:$*:$@:') define(`hi', `HI') changecom(`(',`)') echo(hi) changecom changecom(`((', `))') echo(hi) echo((hi)) changecom(`,', `)') echo(hi,hi)bye) changecom echo(hi,`,`'hi',hi) echo(hi,`,`'hi',hi`'changecom(`,,', `hi')) m4 #>m4> 0:::(hi) 1:HI:HI: 0:::((hi)) 1:HI,hi)bye:HI,hi)bye: 3:HI,,HI,HI:HI,,`'hi,HI: 3:HI,,`'hi,HI:HI,,`'hi,HI: m4 :depends (list "define" "changecom"))) ;; Won't implement: changeword ;; 8.5 Saving text until end of input (deftest gnu-m4-8.5-1 () (m4-test #>m4eof> define(`cleanup', `This is the `cleanup' action. ') m4wrap(`cleanup') This is the first and last normal input line. m4eof #>m4> This is the first and last normal input line. This is the cleanup action. m4 :depends (list "define" "m4wrap"))) ;; ; TODO eval, decr ;; ; depends: define, ifelse, $\d, eval, m4wrap, decr ;; (deftest gnu-m4-8.5-2 () ;; (m4-test ;; #>m4eof> ;; define(`f', `ifelse(`$1', `0', `Answer: 0!=1 ;; ', eval(`$1>1'), `0', `Answer: $2$1=eval(`$2$1') ;; ', `m4wrap(`f(decr(`$1'), `$2$1*')')')') ;; f(`10') ;; m4eof ;; #>m4> ;; Answer: 10*9*8*7*6*5*4*3*2*1=3628800 ;; m4)) (deftest gnu-m4-8.5-3 () (m4-test #>m4eof> define(`aa', `AA ') m4wrap(`a')m4wrap(`a') m4eof #>m4> AA m4 :depends (list "define" "m4wrap"))) ;;; 9 File inclusion ;; 9.1 Including named files (deftest gnu-m4-9.1-1 () (m4-test #>m4> include(`none') include() sinclude(`none') sinclude() m4 #>m4> m4 :error #>m4eof>cl-m4:2:15: cannot open `none': No such file or directory cl-m4:3:9: cannot open `': No such file or directory m4eof :depends (list "include" "sinclude"))) (deftest gnu-m4-9.1-2 () (m4-test #>m4eof> define(`foo', `FOO') include(`incl.m4') m4eof #>m4> Include file start FOO Include file end m4 :include-path (list (relative-pathname "fixtures/")) :depends (list "define" "include"))) (deftest gnu-m4-9.1-3 () (m4-test #>m4eof> define(`bar', include(`incl.m4')) This is `bar': >>bar<< m4eof #>m4> This is bar: >>Include file start foo Include file end << m4 :include-path (list (relative-pathname "fixtures/")) :depends (list "define" "include"))) ;;; 10 Diverting and undiverting output ;; 10.1 Diverting output (deftest gnu-m4-10.1-1 () (m4-test #>m4> divert(`1') This text is diverted. divert This text is not diverted. m4 #>m4> This text is not diverted. This text is diverted. m4 :depends (list "divert"))) (deftest gnu-m4-10.1-2 () (m4-test #>m4eof> define(`text', `TEXT') divert(`1')`diverted text.' divert m4wrap(`Wrapped text precedes ') m4eof #>m4> Wrapped TEXT precedes diverted text. m4 :depends (list "define" "divert" "m4wrap"))) (deftest gnu-m4-10.1-3 () (m4-test #>m4> divert(`-1') define(`foo', `Macro `foo'.') define(`bar', `Macro `bar'.') divert m4 #>m4> m4 :depends (list "define" "divert"))) ;; ; TODO eval ;; ; depends: divert, eval ;; (deftest gnu-m4-10.1-4 () ;; (m4-test ;; #>m4> ;; divert(eval(`1<<28'))world ;; divert(`2')hello ;; m4 ;; #>m4> ;; hello ;; world ;; m4)) (deftest gnu-m4-10.1-5 () (m4-test #>m4> We decided to divert the stream for irrigation. define(`divert', `ifelse(`$#', `0', ``$0'', `builtin(`$0', $@)')') divert(`-1') Ignored text. divert(`0') We decided to divert the stream for irrigation. m4 #>m4> We decided to the stream for irrigation. We decided to divert the stream for irrigation. m4 :depends (list "define" "divert" "ifelse" "builtin"))) ;; 10.2 Undiverting output (deftest gnu-m4-10.2-1 () (m4-test #>m4> divert(`1') This text is diverted. divert This text is not diverted. undivert(`1') m4 #>m4> This text is not diverted. This text is diverted. m4 :depends (list "divert" "undivert"))) (deftest gnu-m4-10.2-2 () (m4-test #>m4> divert(`1')diverted text divert undivert() undivert(`0') undivert divert(`1')more divert(`2')undivert(`1')diverted text`'divert undivert(`1') undivert(`2') m4 #>m4> diverted text more diverted text m4 :depends (list "divert" "undivert"))) (deftest gnu-m4-10.2-3 () (m4-test #>m4> divert(`1') This text is diverted first. divert(`0')undivert(`1')dnl undivert(`1') divert(`1') This text is also diverted but not appended. divert(`0')undivert(`1')dnl m4 #>m4> This text is diverted first. This text is also diverted but not appended. m4 :depends (list "divert" "undivert"))) (deftest gnu-m4-10.2-4 () (m4-test #>m4> divert(`1')one divert(`2')two divert(`3')three divert(`2')undivert`'dnl divert`'undivert`'dnl m4 #>m4> two one three m4 :depends (list "divert" "undivert" "dnl"))) (deftest gnu-m4-10.2-5 () (m4-test #>m4> define(`bar', `BAR') undivert(`foo') include(`foo') m4 #>m4> bar BAR m4 :include-path (list (relative-pathname "fixtures/")) :depends (list "define" "undivert" "include"))) (deftest gnu-m4-10.2-6 () (m4-test #>m4> divert(`1')diversion one divert(`2')undivert(`foo')dnl divert(`3')diversion three divert`'dnl undivert(`1', `2', `foo', `3')dnl m4 #>m4> diversion one bar bar diversion three m4 :include-path (list (relative-pathname "fixtures/")) :depends (list "divert" "undivert" "dnl"))) ;; 10.3 Diversion numbers (deftest gnu-m4-10.3 () (m4-test #>m4> Initial divnum divert(`1') Diversion one: divnum divert(`2') Diversion two: divnum m4 #>m4> Initial 0 Diversion one: 1 Diversion two: 2 m4 :depends (list "divert" "divnum"))) ;; 10.4 Discarding diverted text (deftest gnu-m4-10.4 () (m4-test #>m4> divert(`1') Diversion one: divnum divert(`2') Diversion two: divnum divert(`-1') undivert m4 #>m4> m4 :depends (list "divert" "undivert"))) ;;; 11 Macros for text handling ;; 11.1 Calculating length of strings (deftest gnu-m4-11.1 () (m4-test #>m4> len() len(`abcdef') m4 #>m4> 0 6 m4 :depends (list "len"))) ;; 11.2 Searching for substrings (deftest gnu-m4-11.2-1 () (m4-test #>m4> index(`gnus, gnats, and armadillos', `nat') index(`gnus, gnats, and armadillos', `dag') m4 #>m4> 7 -1 m4 :depends (list "index"))) (deftest gnu-m4-11.2-2 () (m4-test #>m4> index(`abc') index(`abc', `') index(`abc', `b') m4 #>m4> 0 0 1 m4 :error #>m4eof>cl-m4:2:12: too few arguments to builtin `index' m4eof :depends (list "index"))) ;; 11.3 Searching for regular expressions (deftest gnu-m4-11.3-1 () (m4-test #>m4> regexp(`GNUs not Unix', `\<[a-z]\w+') regexp(`GNUs not Unix', `\<Q\w*') regexp(`GNUs not Unix', `\w\(\w+\)$', `*** \& *** \1 ***') regexp(`GNUs not Unix', `\<Q\w*', `*** \& *** \1 ***') m4 #>m4> 5 -1 *** Unix *** nix *** m4 :depends (list "regexp"))) (deftest gnu-m4-11.3-2 () (m4-test #>m4> regexp(`abc', `\(b\)', `\\\10\a') regexp(`abc', `b', `\1\') regexp(`abc', `\(\(d\)?\)\(c\)', `\1\2\3\4\5\6') m4 #>m4> \b0a c m4 :error #>m4eof>cl-m4:3:25: sub-expression 1 not present cl-m4:3:25: trailing \ ignored in replacement cl-m4:4:48: sub-expression 4 not present cl-m4:4:48: sub-expression 5 not present cl-m4:4:48: sub-expression 6 not present m4eof :depends (list "regexp"))) (deftest gnu-m4-11.3-3 () (m4-test #>m4> regexp(`abc') regexp(`abc', `') regexp(`abc', `', `\\def') m4 #>m4> 0 0 \def m4 :error #>m4eof>cl-m4:2:13: too few arguments to builtin `regexp' m4eof :depends (list "regexp"))) ;; 11.4 Extracting substrings (deftest gnu-m4-11.4-1 () (m4-test #>m4> substr(`gnus, gnats, and armadillos', `6') substr(`gnus, gnats, and armadillos', `6', `5') m4 #>m4> gnats, and armadillos gnats m4 :depends (list "substr"))) (deftest gnu-m4-11.4-2 () (m4-test #>m4> substr(`abc') substr(`abc',) m4 #>m4> abc abc m4 :error #>m4eof>cl-m4:2:13: too few arguments to builtin `substr' cl-m4:3:14: empty string treated as 0 in builtin `substr' m4eof :depends (list "substr"))) ;; 11.5 Translating characters (deftest gnu-m4-11.5-1 () (m4-test #>m4> translit(`GNUs not Unix', `A-Z') translit(`GNUs not Unix', `a-z', `A-Z') translit(`GNUs not Unix', `A-Z', `z-a') translit(`+,-12345', `+--1-5', `<;>a-c-a') translit(`abcdef', `aabdef', `bcged') m4 #>m4> s not nix GNUS NOT UNIX tmfs not fnix <;>abcba bgced m4 :depends (list "translit"))) (deftest gnu-m4-11.5-2 () (m4-test #>m4> translit(`abc') m4 #>m4> abc m4 :error #>m4eof>cl-m4:2:15: too few arguments to builtin `translit' m4eof :depends (list "translit"))) ;; 11.6 Substituting text by regular expression (deftest gnu-m4-11.6-1 () (m4-test #>m4> patsubst(`GNUs not Unix', `^', `OBS: ') patsubst(`GNUs not Unix', `\<', `OBS: ') patsubst(`GNUs not Unix', `\w*', `(\&)') patsubst(`GNUs not Unix', `\w+', `(\&)') patsubst(`GNUs not Unix', `[A-Z][a-z]+') patsubst(`GNUs not Unix', `not', `NOT\') m4 #>m4> OBS: GNUs not Unix OBS: GNUs OBS: not OBS: Unix (GNUs)() (not)() (Unix)() (GNUs) (not) (Unix) GN not GNUs NOT Unix m4 :error #>m4eof>cl-m4:7:40: trailing \ ignored in replacement m4eof :depends (list "patsubst"))) (deftest gnu-m4-11.6-2 () (m4-test #>m4> patsubst(`abc') patsubst(`abc', `') patsubst(`abc', `', `\\-') m4 #>m4> abc abc \-a\-b\-c\- m4 :error #>m4eof>cl-m4:2:15: too few arguments to builtin `patsubst' m4eof :depends (list "patsubst")))
22,143
Common Lisp
.lisp
1,145
17.785153
76
0.66342
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
0262db15c970ea9243c4481d82527b7026aa901ded9243466ed7263b942f9425
11,594
[ -1 ]
11,595
m4.lisp
outergod_cl-m4/test/m4.lisp
;;;; cl-m4 - m4.lisp ;;;; Copyright (C) 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cl-m4-test) (in-suite all) (defsuite m4) (in-suite m4) (set-dispatch-macro-character #\# #\> #'cl-heredoc:read-heredoc) (deftest test-m4-macro-exists (macro) (with-m4-lib (is (functionp (m4-macro macro))))) (defmacro with-m4-error (message &body body) (let ((error (gensym))) `(let ((,error (make-array 0 :element-type 'character :adjustable t :fill-pointer 0))) (progn (with-output-to-string (*error-output* ,error) ,@body) (is (equal ,message ,error)))))) (defmacro defm4test (name macro (&rest args) &key (result "") signal (error "")) `(deftest ,name () (test-m4-macro-exists ,macro) (with-m4-lib (with-m4-error ,error ,(if signal `(signals ,signal (funcall (m4-macro ,macro) ,macro t ,@args)) `(is (equal ,result (funcall (m4-macro ,macro) ,macro t ,@args)))))))) (deftest m4-test (m4 result &key (error "") include-path depends) (mapc #'test-m4-macro-exists depends) (let ((out (make-array 0 :element-type 'character :adjustable t :fill-pointer 0))) (with-input-from-string (input-stream m4) (with-output-to-string (output-stream out) (with-m4-error error (cl-m4:process-m4 input-stream output-stream :include-path include-path) (is (equal result out))))))) (defun relative-pathname (pathname) (merge-pathnames pathname (asdf:system-relative-pathname 'cl-m4 "test/")))
2,230
Common Lisp
.lisp
49
40.959184
90
0.66421
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
5df01fa75bddf8e200fd7cd7c179784d6065664023bbf48f4bf2d0f921d6039c
11,595
[ -1 ]
11,596
m4-composite.lisp
outergod_cl-m4/test/m4-composite.lisp
;;;; cl-m4 - m4-composite.lisp ;;;; Copyright (C) 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cl-m4-test) (in-suite m4) ;;; 5 How to define new macros ;; 5.1 Defining a macro ; TODO format ;; (deftest composite-array () ;; (m4-test ;; #>m4> ;; ;; m4 ;; ;; #>m4> ;; ;; m4 ;; ;;:depends (list "define" "defn" "format"))) ;; 5.2 Arguments to macros (deftest composite-exch () (m4-test #>m4> define(`exch', `$2, $1') exch(`arg1', `arg2') define(exch(``expansion text'', ``macro'')) macro m4 #>m4> arg2, arg1 expansion text m4 :depends (list "define"))) ;; 5.3 Special arguments to macros (deftest composite-nargs () (m4-test #>m4> define(`nargs', `$#') nargs nargs() nargs(`arg1', `arg2', `arg3') nargs(`commas can be quoted, like this') nargs(arg1#inside comments, commas do not separate arguments still arg1) nargs((unquoted parentheses, like this, group arguments)) nargs(`('quoted parentheses, like this, don't group arguments`)') m4 #>m4> 0 1 3 1 1 1 3 m4 :depends (list "define"))) (deftest composite-nargs-underquoted () (m4-test #>m4> define(underquoted, $#) oops) underquoted m4 #>m4> 0) oops m4 :depends (list "define"))) (deftest composite-echo () (m4-test #>m4> define(`echo', `$*') define(`arg1', `correct') echo(`arg1', arg2, arg3 , arg4) define(`echo', `$@') define(`arg1', `error') echo(`arg1', arg2, arg3 , arg4) m4 #>m4> correct,arg2,arg3 ,arg4 arg1,arg2,arg3 ,arg4 m4 :depends (list "define"))) ;; 6.3 Recursion in m4 (deftest composite-reverse () (m4-test #>m4> define(`reverse', `ifelse(`$#', `0', , `$#', `1', ``$1'', `reverse(shift($@)), `$1'')') reverse reverse(`foo') reverse(`foo', `bar', `gnats', `and gnus') m4 #>m4> foo and gnus, gnats, bar, foo m4 :depends (list "define" "ifelse" "shift"))) ; TODO incr ;; (deftest composite-cond () ;; (m4-test ;; #>m4> ;; define(`cond', ;; `ifelse(`$#', `1', `$1', ;; `ifelse($1, `$2', `$3', ;; `$0(shift(shift(shift($@))))')')')dnl ;; define(`side', `define(`counter', incr(counter))$1')dnl ;; define(`example1', ;; `define(`counter', `0')dnl ;; ifelse(side(`$1'), `yes', `one comparison: ', ;; side(`$1'), `no', `two comparisons: ', ;; side(`$1'), `maybe', `three comparisons: ', ;; `side(`default answer: ')')counter')dnl ;; define(`example2', ;; `define(`counter', `0')dnl ;; cond(`side(`$1')', `yes', `one comparison: ', ;; `side(`$1')', `no', `two comparisons: ', ;; `side(`$1')', `maybe', `three comparisons: ', ;; `side(`default answer: ')')counter')dnl ;; example1(`yes') ;; example1(`no') ;; example1(`maybe') ;; example1(`feeling rather indecisive today') ;; example2(`yes') ;; example2(`no') ;; example2(`maybe') ;; example2(`feeling rather indecisive today') ;; m4 ;; #>m4> ;; one comparison: 3 ;; two comparisons: 3 ;; three comparisons: 3 ;; default answer: 4 ;; one comparison: 1 ;; two comparisons: 2 ;; three comparisons: 3 ;; default answer: 4 ;; m4 ;; ;;:depends (list "define" "ifelse" "shift" "incr"))) (deftest composite-join () (m4-test #>m4eof> include(`join.m4') join,join(`-'),join(`-', `'),join(`-', `', `') joinall,joinall(`-'),joinall(`-', `'),joinall(`-', `', `') join(`-', `1') join(`-', `1', `2', `3') join(`', `1', `2', `3') join(`-', `', `1', `', `', `2', `') joinall(`-', `', `1', `', `', `2', `') join(`,', `1', `2', `3') define(`nargs', `$#')dnl nargs(join(`,', `1', `2', `3')) m4eof #>m4> ,,, ,,,- 1 1-2-3 123 1-2 -1---2- 1,2,3 1 m4 :include-path (list (relative-pathname "fixtures/gnu-m4-examples/")) :depends (list "include" "define" "dnl" "ifelse" "shift" "divert"))) (deftest composite-quote () (m4-test #>m4eof> include(`quote.m4') -quote-dquote-dquote_elt- -quote()-dquote()-dquote_elt()- -quote(`1')-dquote(`1')-dquote_elt(`1')- -quote(`1', `2')-dquote(`1', `2')-dquote_elt(`1', `2')- define(`n', `$#')dnl -n(quote(`1', `2'))-n(dquote(`1', `2'))-n(dquote_elt(`1', `2'))- dquote(dquote_elt(`1', `2')) dquote_elt(dquote(`1', `2')) m4eof #>m4> ---- --`'-`'- -1-`1'-`1'- -1,2-`1',`2'-`1',`2'- -1-1-2- ``1'',``2'' ``1',`2'' m4 :include-path (list (relative-pathname "fixtures/gnu-m4-examples/")) :depends (list "include" "dnl" "define" "divert" "ifelse" "shift"))) ;; TODO decr ;; (deftest composite-argn () ;; (m4-test ;; #>m4> ;; define(`argn', `ifelse(`$1', 1, ``$2'', ;; `argn(decr(`$1'), shift(shift($@)))')') ;; argn(`1', `a') ;; define(`foo', `argn(`11', $@)') ;; foo(`a', `b', `c', `d', `e', `f', `g', `h', `i', `j', `k', `l') ;; m4 ;; #>m4> ;; a ;; k ;; m4 ;; :depends (list "define" "ifelse" "decr" "shift"))) ;; TODO incr ;; — Composite: forloop (iterator, start, end, text) ;; — Composite: foreach (iterator, paren-list, text) ;; — Composite: foreachq (iterator, quote-list, text) (deftest composite-foreach-1 () (m4-test #>m4eof> include(`foreach.m4') foreach(`x', (foo, bar, foobar), `Word was: x ')dnl include(`foreachq.m4') foreachq(`x', `foo, bar, foobar', `Word was: x ')dnl m4eof #>m4> Word was: foo Word was: bar Word was: foobar Word was: foo Word was: bar Word was: foobar m4 :include-path (list (relative-pathname "fixtures/gnu-m4-examples/")) :depends (list "include" "divert" "define" "pushdef" "popdef" "ifelse" "shift" "dnl"))) (deftest composite-foreach-2 () (m4-test #>m4eof> include(`foreach.m4') define(`_case', ` $1) $2=" $1";; ')dnl define(`_cat', `$1$2')dnl case $`'1 in foreach(`x', `(`(`a', `vara')', `(`b', `varb')', `(`c', `varc')')', `_cat(`_case', x)')dnl esac m4eof #>m4> case $1 in a) vara=" a";; b) varb=" b";; c) varc=" c";; esac m4 :include-path (list (relative-pathname "fixtures/gnu-m4-examples/")) :depends (list "include" "divert" "define" "pushdef" "popdef" "ifelse" "shift" "dnl"))) ;; — Composite: stack_foreach (macro, action) ;; — Composite: stack_foreach_lifo (macro, action) ;; — Composite: define_blind (name, [value]) ;; — Composite: curry (macro, ...) ;; — Composite: copy (source, dest) ;; — Composite: rename (source, dest) (deftest composite-cleardivert () (m4-test #>m4> define(`cleardivert', `pushdef(`_n', divnum)divert(`-1')undivert($@)divert(_n)popdef(`_n')')dnl divert(`1') Diversion one: divnum divert(`2') Diversion two: divnum divert(`3')dnl Diversion three: divnum cleardivert(1,2)dnl m4 #>m4> Diversion three: 3 m4 :depends (list "define" "pushdef" "divnum" "divert" "undivert" "popdef"))) (deftest composite-cleardivert-fixed () (m4-test #>m4> define(`cleardivert', `pushdef(`_num', divnum)divert(`-1')ifelse(`$#', `0', `undivert`'', `undivert($@)')divert(_num)popdef(`_num')')dnl divert(`1') Diversion one: divnum divert(`2') Diversion two: divnum divert(`3') Diversion three: divnum cleardivert`'dnl m4 #>m4> m4 :depends (list "define" "pushdef" "divnum" "divert" "ifelse" "undivert" "popdef"))) ;; 11.6 Substituting text by regular expression (deftest composite-capitalize () (m4-test #>m4eof> include(`capitalize.m4') upcase(`GNUs not Unix') downcase(`GNUs not Unix') capitalize(`GNUs not Unix') m4eof #>m4> GNUS NOT UNIX gnus not unix Gnus Not Unix m4 :include-path (list (relative-pathname "fixtures/gnu-m4-examples/")) :depends (list "include" "divert" "define" "translit" "regexp" "patsubst" "dnl"))) (deftest composite-capitalize-broken () (m4-test #>m4eof> include(`capitalize.m4')dnl define(`active', `act1, ive')dnl define(`Active', `Act2, Ive')dnl define(`ACTIVE', `ACT3, IVE')dnl upcase(active) upcase(`active') upcase(``active'') downcase(ACTIVE) downcase(`ACTIVE') downcase(``ACTIVE'') capitalize(active) capitalize(`active') capitalize(``active'') define(`A', `OOPS') capitalize(active) capitalize(`active') m4eof #>m4> ACT1,IVE ACT3, IVE ACTIVE act3,ive act1, ive active Act1 Active _capitalize(`active') OOPSct1 OOPSctive m4 :include-path (list (relative-pathname "fixtures/gnu-m4-examples/")) :depends (list "include" "divert" "define" "translit" "regexp" "patsubst" "dnl"))) (deftest composite-capitalize-fixed () (m4-test #>m4eof> include(`capitalize2.m4')dnl define(`active', `act1, ive')dnl define(`Active', `Act2, Ive')dnl define(`ACTIVE', `ACT3, IVE')dnl define(`A', `OOPS')dnl capitalize(active; `active'; ``active''; ```actIVE''') m4eof #>m4> Act1,Ive; Act2, Ive; Active; `Active' m4 :include-path (list (relative-pathname "fixtures/gnu-m4-examples/")) :depends (list "include" "divert" "define" "translit" "changequote" "regexp" "patsubst" "dnl"))) (deftest composite-patreg () (m4-test #>m4> define(`patreg', `patsubst($@) regexp($@)')dnl patreg(`bar foo baz Foo', `foo\|Foo', `FOO') patreg(`aba abb 121', `\(.\)\(.\)\1', `\2\1\2') m4 #>m4> bar FOO baz FOO FOO bab abb 212 bab m4 :depends (list "define" "patsubst" "regexp" "dnl")))
9,440
Common Lisp
.lisp
391
22.560102
96
0.642905
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
caaef9cabef6e54fa331b11a2d3f73a40c403503eade2c2083482ca00a2d6781
11,596
[ -1 ]
11,597
m4-builtin.lisp
outergod_cl-m4/test/m4-builtin.lisp
;;;; cl-m4 - m4-builtin.lisp ;;;; Copyright (C) 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cl-m4) (shadowing-import '(macro-dnl-invocation-condition macro-defn-invocation-condition) (find-package :cl-m4-test)) (in-package :cl-m4-test) (in-suite m4) (defm4test macro-dnl-with-args "dnl" ("foo") :signal macro-dnl-invocation-condition :error (format nil "cl-m4:?:?: excess arguments to builtin `dnl' ignored~%")) (defm4test macro-dnl-with-empty-args "dnl" (nil) :signal macro-dnl-invocation-condition :error (format nil "cl-m4:?:?: excess arguments to builtin `dnl' ignored~%")) (defm4test macro-defn-no-args "defn" ()) (defm4test macro-defn-empty-args "defn" ("defn") :signal macro-defn-invocation-condition)
1,426
Common Lisp
.lisp
30
45.866667
79
0.727666
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
e2b6f73eee50380ab2efd4347f48b9fd3366e3afe7980a67595e57d0635d20d3
11,597
[ -1 ]
11,598
m4-parser.lisp
outergod_cl-m4/test/m4-parser.lisp
;;;; cl-m4 - m4-parser.lisp ;;;; Copyright (C) 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cl-m4-test) (in-suite m4) (deftest dnl-with-args () (m4-test #>m4> dnl(foo) <- token m4 #>m4> <- token m4 :error #>m4eof>cl-m4:2:8: excess arguments to builtin `dnl' ignored m4eof)) (deftest dnl-with-empty-args () (m4-test #>m4> dnl() <- token m4 #>m4> <- token m4 :error #>m4eof>cl-m4:2:5: excess arguments to builtin `dnl' ignored m4eof)) (deftest dnl-quote-start () (m4-test #>m4> dnl`0 <- token m4 #>m4> <- token m4)) (deftest dnl-underscore () (m4-test "dnl_foo token" "dnl_foo token")) (deftest dnl-number () (m4-test "dnl4 token" "dnl4 token")) (deftest dnl-quote-end () (m4-test #>m4> dnl'token token <- token m4 #>m4> <- token m4)) (deftest dnl-comment () (m4-test #>m4> dnl#token token <- token m4 #>m4> <- token m4)) (deftest dnl-quotes () (m4-test #>m4> dnl`token' token <- token m4 #>m4> <- token m4)) (deftest dnl-word () (m4-test #>m4> dnltoken token <- token m4 #>m4> dnltoken token <- token m4)) (deftest dnl-quoted-string-space () (m4-test #>m4> dnl `token' <- token m4 #>m4> <- token m4)) (deftest dnl-no-newline () (m4-test "dnl" "" :error #>m4eof>cl-m4:1:3: end of file treated as newline m4eof)) (deftest name-comment-space () (m4-test #>m4> token # token <- token m4 #>m4> token # token <- token m4)) (deftest name-dnl-space () (m4-test #>m4> token dnl token <- token m4 #>m4> token <- token m4)) (deftest name-comment-nospace () (m4-test #>m4> token#token <- token m4 #>m4> token#token <- token m4)) (deftest name-dnl-nospace () (m4-test "tokendnltoken" "tokendnltoken")) (deftest name-dnl-newline () (m4-test #>m4> tokendnl <- token m4 #>m4> tokendnl <- token m4)) (deftest quoted-string () (m4-test "`token'" "token")) (deftest comment-quoted-string () (m4-test #>m4> # `token' <- token m4 #>m4> # `token' <- token m4)) (deftest comment-name () (m4-test #>m4> #token <- token m4 #>m4> #token <- token m4)) (deftest comment-quoted-string-nospace () (m4-test #>m4> #`token' <- token m4 #>m4> #`token' <- token m4)) (deftest quoted-dnl () (m4-test "`dnl token'" "dnl token")) (deftest quoted-comment () (m4-test "`# token'" "# token")) (deftest double-quotes () (m4-test "``token''" "`token'")) (deftest triple-quotes () (m4-test "```token'''" "``token''")) (deftest quoted-newline () (m4-test #>m4> `foo bar' m4 #>m4> foo bar m4)) (deftest multi-quotes-newlines () (m4-test #>m4> ``token' token ``token''' m4 #>m4> `token' token ``token'' m4)) (deftest cascaded-quotes () (m4-test "``token1'token2`token3''" "`token1'token2`token3'")) (deftest arglist-munchy () (m4-test #>m4> define(`foo', ` hello?')dnl foo define(`bar',` '`hello2?')dnl bar define( `bop', ` '`hello3?')dnl bop m4 #>m4> hello? hello2? hello3? m4 :depends (list "define" "dnl")))
3,607
Common Lisp
.lisp
188
17.425532
76
0.675749
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
3d5a2462cd6bf6df094b9e58a22f8f228deae56507768194db22d198690b6f51
11,598
[ -1 ]
11,599
regex.lisp
outergod_cl-m4/test/cffi-regex/regex.lisp
;;;; cl-m4 - regex.lisp ;;;; Copyright (C) 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cl-m4-test) (in-suite root-suite) (defsuite cffi-regex) (in-suite cffi-regex) (defmacro with-regex-condition (startpos registers signal &body body) `(if signal (signals ,signal ,@body) (multiple-value-bind (startpos-result registers-result) ,@body (is (equal startpos-result ,startpos)) (is (equal (coerce registers-result 'list) ,registers))))) (deftest assert-regex-search (regex target-string &key (start 0) (end (length target-string)) (startpos start) registers signal) (with-regex-condition startpos registers signal (regex-search regex target-string :start start :end end))) (deftest regex-gnu-m4-11.3-1 () (assert-regex-search "\\<[a-z]\\w+" "GNUs not Unix" :startpos 5 :registers (list (list 5 8)))) (deftest regex-gnu-m4-11.3-2 () (assert-regex-search "\<Q\w*" "GNUs not Unix" :startpos nil)) (deftest regex-gnu-m4-11.3-3 () (assert-regex-search "\\(b\\)" "abc" :startpos 1 :registers (list (list 1 2) (list 1 2)))) (deftest regex-gnu-m4-11.3-4 () (assert-regex-search "b" "abc" :startpos 1 :registers (list (list 1 2)))) (deftest regex-gnu-m4-11.3-5 () (assert-regex-search "\\(\\(d\\)?\\)\\(c\\)" "abc" :startpos 2 :registers (list (list 2 3) (list 2 2) (list -1 -1) (list 2 3))))
2,167
Common Lisp
.lisp
40
48.425
108
0.648253
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
8791def1128bd60ab65a7a74a7d3832a4318af3f4f6525b813289b33199b5571
11,599
[ -1 ]
11,600
m4-lexer.lisp
outergod_cl-m4/src/m4-lexer.lisp
;;;; cl-m4 - m4-lexer.lisp ;;;; Copyright (C) 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cl-m4) (defclass m4-input-stream (lexer-input-stream) ((macro-stack :accessor m4-macro-stack :initform nil))) (defgeneric m4-push-macro (m4-input-stream macro) (:method ((stream m4-input-stream) macro) (push macro (m4-macro-stack stream)))) (defgeneric m4-pop-macro (m4-input-stream) (:method ((stream m4-input-stream)) (pop (m4-macro-stack stream)))) (defmethod stream-read-token :around ((stream m4-input-stream) &optional (peek nil)) (declare (ignore peek)) (if (m4-macro-stack stream) (values :macro-token (m4-pop-macro stream)) (call-next-method)))
1,390
Common Lisp
.lisp
30
43.7
84
0.707749
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
4d10166047ccd917f15582925414c454c1369117cc1acd3dc66ea826fb02c1fb
11,600
[ -1 ]
11,601
package.lisp
outergod_cl-m4/src/package.lisp
;;;; cl-m4 - package.lisp ;;;; Copyright (C) 2009, 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cl-m4-system) (defpackage :cffi-regex (:use :cl :cffi) (:export :regex-search :regex-search-all :regex-match :regex-compilation-failure :regex-internal-error)) (defpackage :cl-m4 (:use :cl :external-program :cffi-regex :graylex) (:shadow :copy-stream :copy-file) (:export :process-m4))
1,102
Common Lisp
.lisp
24
43.916667
74
0.714419
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
768abe25586525db342ba07ec55a47a62568a5988cb20a7099585b1ec4381ae6
11,601
[ -1 ]
11,602
m4-parser.lisp
outergod_cl-m4/src/m4-parser.lisp
;;;; cl-m4 - m4-parser.lisp ;;;; Copyright (C) 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cl-m4) ;;; Recurse descent M4 parser implemention ;; Helpers (defmacro with-tokens-active ((&rest tokens) &body body) `(let ,(mapcar #'(lambda (token) (list token "")) (set-difference '(*m4-quote-start* *m4-quote-end* *m4-comment-start* *m4-comment-end* *m4-macro-name*) tokens)) ,@body)) (define-condition m4-parse-error (error) ((message :initarg :message :reader m4-parse-error-message) (row :initarg :row :reader m4-parse-error-row) (column :initarg :column :reader m4-parse-error-column))) (defun split-merge (string-list split-token) (labels ((acc (rec string rest) (let ((token (car rest))) (cond ((null token) (nreverse (cons string rec))) ((equal split-token token) (acc (cons string rec) "" (cdr rest))) ((not (stringp token)) ; macro-token; a separator MUST follow (acc rec token (cdr rest))) (t (acc rec (concatenate 'string string token) (cdr rest))))))) (acc (list) "" string-list))) (defun call-m4-macro (macro macro-name args lexer) (let ((*m4-parse-row* (lexer-row lexer)) (*m4-parse-column* (lexer-column lexer)) (macro-args (and args (split-merge args :separator)))) (handler-case (apply macro macro-name nil macro-args) (macro-condition (condition) (mapc #'(lambda (hook) (funcall hook macro-name macro-args (when (eql (type-of condition) 'macro-invocation-condition) (macro-invocation-result condition)))) *m4-macro-hooks*) (signal condition))))) (defun m4-out (word) (with-m4-diversion-stream (out) (write-string word out))) ;; Recursive descent parser functions (defun parse-m4-comment (lexer image) (let ((row (lexer-row lexer)) (column (lexer-column lexer))) (labels ((m4-comment (rec) (multiple-value-bind (class image) (with-tokens-active (*m4-comment-end*) (stream-read-token lexer)) (cond ((null class) (error 'm4-parse-error :message "end of file in comment" :row row :column column)) ((equal :comment-end class) (apply #'concatenate 'string (nreverse (cons image rec)))) (t (m4-comment (cons image rec))))))) (m4-comment (list image))))) (defun parse-m4-quote (lexer) (let ((row (lexer-row lexer)) (column (lexer-column lexer))) (labels ((m4-quote (rec quoting-level) (multiple-value-bind (class image) (if (= 0 (or (search *m4-quote-end* *m4-quote-start*) -1)) ; "If end is a prefix of start, the ; end-quote will be recognized in preference to a ; nested begin-quote" (with-tokens-active (*m4-quote-end*) (stream-read-token lexer)) (with-tokens-active (*m4-quote-start* *m4-quote-end*) (stream-read-token lexer))) (cond ((null class) (error 'm4-parse-error :message "end of file in string" :row row :column column)) ((equal :quote-end class) (if (= 1 quoting-level) (apply #'concatenate 'string (nreverse rec)) (m4-quote (cons image rec) (1- quoting-level)))) ((equal :quote-start class) (m4-quote (cons image rec) (1+ quoting-level))) (t (m4-quote (cons image rec) quoting-level)))))) (m4-quote (list) 1)))) (defun parse-m4-munch-whitespace (lexer) (with-tokens-active () (do ((class (stream-read-token lexer t) (stream-read-token lexer t))) ((not (find class '(:space :newline)))) (stream-read-token lexer)))) (defun parse-m4-macro-arguments (lexer) (let ((row (lexer-row lexer)) (column (lexer-column lexer))) (labels ((m4-group-merge (string rec paren-level) (if (> paren-level 1) (cons (concatenate 'string (car rec) string) (cdr rec)) (cons string rec))) (m4-macro-arguments (rec paren-level &optional (new-argument nil)) (when new-argument (parse-m4-munch-whitespace lexer)) ; munch whitespace from beginning of argument (multiple-value-bind (class image) (with-tokens-active (*m4-quote-start* *m4-macro-name* *m4-comment-start*) (stream-read-token lexer)) (cond ((null class) (error 'm4-parse-error :message "EOF with unfinished argument list" :row row :column column)) ((equal :close-paren class) (if (= 1 paren-level) (nreverse rec) (m4-macro-arguments (m4-group-merge image rec paren-level) (1- paren-level)))) ((equal :open-paren class) (m4-macro-arguments (m4-group-merge image rec paren-level) (1+ paren-level))) ((equal :quote-start class) (m4-macro-arguments (m4-group-merge (parse-m4-quote lexer) rec paren-level) paren-level)) ((equal :comment-start class) (m4-macro-arguments (m4-group-merge (parse-m4-comment lexer image) rec paren-level) paren-level)) ((equal :macro-name class) (m4-macro-arguments (m4-group-merge (parse-m4-macro lexer image) rec paren-level) paren-level)) ((and (= 1 paren-level) (equal :comma class)) (parse-m4-munch-whitespace lexer) (m4-macro-arguments (cons :separator rec) paren-level t)) (t (m4-macro-arguments (m4-group-merge image rec paren-level) paren-level)))))) (m4-macro-arguments (list "") 1 t)))) (defun parse-m4-dnl (lexer) (with-tokens-active () (do ((class (stream-read-token lexer) (stream-read-token lexer))) ((or (equal :newline class) (null class)) (prog1 "" (when (null class) (let ((*m4-parse-row* (lexer-row lexer)) (*m4-parse-column* (lexer-column lexer))) (m4-warn "end of file treated as newline")))))))) (defun parse-m4-macro (lexer macro-name) (let ((macro (m4-macro macro-name)) (level *m4-nesting-level*) (*m4-nesting-level* (1+ *m4-nesting-level*))) (if (not macro) macro-name (if (and *m4-nesting-limit* (> *m4-nesting-level* *m4-nesting-limit*)) (progn (m4-warn (format nil "recursion limit of ~d exceeded, use -L<N> to change it" *m4-nesting-limit*)) (error 'macro-nesting-level-excession-condition :limit *m4-nesting-limit*)) (handler-case (multiple-value-bind (class image) (stream-read-token lexer t) (declare (ignore image)) (if (equal :open-paren class) (progn (stream-read-token lexer) ; consume token (call-m4-macro macro macro-name (parse-m4-macro-arguments lexer) lexer)) (call-m4-macro macro macro-name nil lexer))) (macro-dnl-invocation-condition () (parse-m4-dnl lexer)) (macro-defn-invocation-condition (condition) (prog1 "" (m4-push-macro lexer (macro-defn-invocation-result condition)))) (macro-invocation-condition (condition) (prog1 "" (lexer-unread-sequence lexer (macro-invocation-result condition))))))))) (defun parse-m4 (lexer) (do* ((token (multiple-value-list (stream-read-token lexer)) (multiple-value-list (stream-read-token lexer))) (class (car token) (car token)) (image (cadr token) (cadr token))) ((null class) (when *m4-wrap-stack* (lexer-unread-sequence lexer (apply #'concatenate 'string *m4-wrap-stack*)) (let ((*m4-wrap-stack* (list))) (parse-m4 lexer))) (let ((*m4-diversion* 0)) (mapcar #'m4-out (flush-m4-diversions)))) (m4-out (cond ((equal :quote-start class) (parse-m4-quote lexer)) ((equal :comment-start class) (parse-m4-comment lexer image)) ((equal :macro-name class) (parse-m4-macro lexer image)) ((equal :macro-token class) (prog1 "" (when (macro-token-p image) (lexer-unread-sequence lexer (expand-macro-token image))))) (t image))))) ;; Top-level M4 API (defun process-m4 (input-stream output-stream &key (include-path (list)) (prepend-include-path (list)) (trace-functions (list)) nesting-limit) (let* ((*m4-quote-start* "`") (*m4-quote-end* "'") (*m4-comment-start* "#") (*m4-comment-end* "\\n") (*m4-macro-name* "[_a-zA-Z]\\w*") (*m4-wrap-stack* (list)) (*m4-include-path* (append (reverse prepend-include-path) (list ".") include-path)) (*m4-diversion* 0) (*m4-diversion-table* (make-m4-diversion-table output-stream)) (*m4-nesting-level* 0) (*m4-nesting-limit* nesting-limit) (*m4-macro-hooks* (list #'m4-trace-out)) (*m4-traced-macros* trace-functions) (lexer (make-instance 'm4-input-stream :stream input-stream :rules '((*m4-comment-start* . :comment-start) (*m4-comment-end* . :comment-end) (*m4-macro-name* . :macro-name) (*m4-quote-start* . :quote-start) (*m4-quote-end* . :quote-end) ("," . :comma) ("\\n" . :newline) (" " . :space) ; only required for beginning of args ("\\(" . :open-paren) ("\\)" . :close-paren) ("." . :token))))) (with-m4-lib (parse-m4 lexer))))
11,643
Common Lisp
.lisp
226
36.743363
142
0.523989
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
c1430f52e64fa44c424a4a815815ab4bf8b46bdc349052640eb761427a2e7e09
11,602
[ -1 ]
11,603
regex.lisp
outergod_cl-m4/src/cffi-regex/regex.lisp
;;;; cl-m4 - regex.lisp ;;;; Copyright (C) 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cffi-regex) ;;; conditions (define-condition regex-compilation-failure (error) ((message :initarg :message :reader regex-compilation-failure-message))) (defmethod print-object ((condition regex-compilation-failure) stream) (format stream "libc regex compiliation failure: ~a~%" (regex-compilation-failure-message condition))) (define-condition regex-internal-error (error) ()) (defmacro with-pattern-buffer ((var pattern &optional (syntax (list +syntax-emacs+))) &body body) "with-pattern-buffer var pattern &optional (syntax (list +syntax-emacs+))) &body body => context Create lexical context binding VAR to a compiled libc regex PATTERN-BUFFER (re_pattern_buffer) with dynamic allocation and SYNTAX. In case of REGEX compilation failure a REGEX-COMPILATION-FAILURE condition containing the original error message is signaled." (let ((ret (gensym))) `(with-foreign-object (,var 'pattern-buffer) (setf (foreign-slot-value ,var 'pattern-buffer 'buffer) (make-pointer 0) (foreign-slot-value ,var 'pattern-buffer 'allocated) +regs-unallocated+ (foreign-slot-value ,var 'pattern-buffer 'fastmap) (make-pointer 0) (foreign-slot-value ,var 'pattern-buffer 'translate) (make-pointer 0) (foreign-slot-value ,var 'pattern-buffer 'syntax) (logior ,@syntax)) (let ((,ret (compile-pattern ,pattern (length ,pattern) ,var))) (if ,ret (error 'regex-compilation-failure :message ,ret) ,@body))))) (defun get-register (registers index) "get-register registers index => (start end) Return START and END of register match # INDEX in libc regex REGISTERS (re_registers)." (values (mem-aref (mem-aref (foreign-slot-pointer registers 'registers 'start) :pointer) 'regoff index) (mem-aref (mem-aref (foreign-slot-pointer registers 'registers 'end) :pointer) 'regoff index))) (flet ((%search (buffer registers target-string start end) (let ((startpos (%regex-search buffer target-string (length target-string) start end registers))) (cond ((= -2 startpos) (error 'regex-internal-error)) ((= -1 startpos) nil) (t (let* ((matches-count (1- (foreign-slot-value registers 'registers 'num-regs))) (matches (make-array matches-count :element-type 'integer :adjustable nil))) (dotimes (position matches-count) (setf (svref matches position) (multiple-value-list (get-register registers position)))) (values startpos matches))))))) (defun regex-search (regex target-string &key (start 0) (end (length target-string))) "regex-search regex target-string &key (start 0) (end (length target-string)) => (startpos registers) High-level interface to libc regex re_search. Match REGEX against region between START and END of TARGET-STRING returning STARTPOS of the first match and SIMPLE-VECTOR REGISTERS containing LISTs of register group STARTs and ENDs. The first register always contains the match of the whole REGEX. If no part of TARGET-STRING matches, nil is return. In case of a libc internal error signal a REGEX-INTERNAL-ERROR condition." (with-pattern-buffer (buffer regex) (with-foreign-object (registers 'registers) (%search buffer registers target-string start end)))) (defun regex-search-all (regex target-string &key (start 0) (end (length target-string))) "regex-search-all regex target-string &key (start 0) (end (length target-string)) => list Multi-version of REGEX-SEARCH that evaluates to a list of all (STARTPOS REGISTERS) matches of REGEX in TARGET-STRING." (with-pattern-buffer (buffer regex) (with-foreign-object (registers 'registers) (labels ((rec (position acc) (multiple-value-bind (startpos matches) (%search buffer registers target-string position end) (if startpos (let ((match-length (abs (apply #'- (svref matches 0))))) (rec (+ startpos (if (> match-length 0) match-length 1)) ; happens for ^, * and $ matches (cons (cons startpos matches) acc))) (nreverse acc))))) (rec start (list))))))) (defun regex-match (regex target-string &optional (start 0)) "regex-match regex target-string &optional (start 0) => incomplete" (with-pattern-buffer (buffer regex) (with-foreign-object (registers 'registers) (%regex-match buffer target-string (length target-string) start registers))))
5,594
Common Lisp
.lisp
97
49.113402
107
0.662409
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
c0558dc37588e45be2fa7382150be8bd8bfb4ecde198a3a852b25d6c11350494
11,603
[ -1 ]
11,604
cffi-regex-grovel.lisp
outergod_cl-m4/src/cffi-regex/cffi-regex-grovel.lisp
;;;; cl-m4 - cffi-regex-grovel.lisp ;;;; Copyright (C) 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cffi-regex) ;;; This is part of glibc regex.h expressed in cffi-grovel DSL and oughts to ;;; ensure portability between platforms (hopefully). ; regex.h requires __USE_GNU to be defined for the same feature set as GNU m4; ; on some platforms features.h gets sucked in early resulting in a reset of ; __USE_GNU to undef unless _GNU_SOURCE has been defined, hence features.h is ; explicitly included to ensure __USE_GNU being set during regex.h processing. (define "_GNU_SOURCE" 1) (include "features.h") (include "regex.h") (include "string.h") ;; c typdefs (ctype size-t "size_t") (ctype s-reg "s_reg_t") (ctype active-reg "active_reg_t") (ctype reg-syntax "reg_syntax_t") (ctype regoff "regoff_t") ;; option constants (constant (+backslash-escape-in-lists+ "RE_BACKSLASH_ESCAPE_IN_LISTS")) (constant (+bk-plus-qm+ "RE_BK_PLUS_QM")) (constant (+char-classes+ "RE_CHAR_CLASSES")) (constant (+context-indep-anchors+ "RE_CONTEXT_INDEP_ANCHORS")) (constant (+context-indep-ops+ "RE_CONTEXT_INDEP_OPS")) (constant (+context-invalid-ops+ "RE_CONTEXT_INVALID_OPS")) (constant (+dot-newline+ "RE_DOT_NEWLINE")) (constant (+dot-not-null+ "RE_DOT_NOT_NULL")) (constant (+hat-lists-not-newline+ "RE_HAT_LISTS_NOT_NEWLINE")) (constant (+intervals+ "RE_INTERVALS")) (constant (+limited-ops+ "RE_LIMITED_OPS")) (constant (+newline-alt+ "RE_NEWLINE_ALT")) (constant (+no-bk-braces+ "RE_NO_BK_BRACES")) (constant (+no-bk-parens+ "RE_NO_BK_PARENS")) (constant (+no-bk-refs+ "RE_NO_BK_REFS")) (constant (+no-bk-vbar+ "RE_NO_BK_VBAR")) (constant (+no-empty-ranges+ "RE_NO_EMPTY_RANGES")) (constant (+unmatched-right-paren-ord+ "RE_UNMATCHED_RIGHT_PAREN_ORD")) (constant (+no-posix-backtracking+ "RE_NO_POSIX_BACKTRACKING")) (constant (+no-gnu-ops+ "RE_NO_GNU_OPS")) (constant (+debug+ "RE_DEBUG")) (constant (+invalid-interval-ord+ "RE_INVALID_INTERVAL_ORD")) (constant (+re-icase+ "RE_ICASE")) (constant (+caret-anchors-here+ "RE_CARET_ANCHORS_HERE")) (constant (+context-invalid-dup+ "RE_CONTEXT_INVALID_DUP")) (constant (+no-sub+ "RE_NO_SUB")) ;; syntax constants (constant (+syntax-emacs+ "RE_SYNTAX_EMACS")) (constant (+syntax-awk+ "RE_SYNTAX_AWK")) (constant (+syntax-gnu-awk+ "RE_SYNTAX_GNU_AWK")) (constant (+syntax-posix-awk+ "RE_SYNTAX_POSIX_AWK")) (constant (+syntax-grep+ "RE_SYNTAX_GREP")) (constant (+syntax-egrep+ "RE_SYNTAX_EGREP")) (constant (+syntax-posix-egrep+ "RE_SYNTAX_POSIX_EGREP")) (constant (+syntax-ed+ "RE_SYNTAX_ED")) (constant (+syntax-sed+ "RE_SYNTAX_SED")) (constant (+syntax-posix-common+ "_RE_SYNTAX_POSIX_COMMON")) (constant (+syntax-posix-basic+ "RE_SYNTAX_POSIX_BASIC ")) (constant (+syntax-posix-minimal-basic+ "RE_SYNTAX_POSIX_MINIMAL_BASIC")) (constant (+syntax-posix-extended+ "RE_SYNTAX_POSIX_EXTENDED")) (constant (+syntax-posix-minimal-extended+ "RE_SYNTAX_POSIX_MINIMAL_EXTENDED")) ;; max number of duplicates constant (constant (+dup-max+ "RE_DUP_MAX")) ;; cflags constants (constant (+extended+ "REG_EXTENDED")) (constant (+reg-icase+ "REG_ICASE")) (constant (+newline+ "REG_NEWLINE")) (constant (+nosub+ "REG_NOSUB")) ;; eflags constants (constant (+notbol+ "REG_NOTBOL")) (constant (+noteol+ "REG_NOTEOL")) (constant (+startend+ "REG_STARTEND")) ;; enums (cenum errcode ((:noerror "REG_NOERROR")) ((:nomatch "REG_NOMATCH")) ((:badpat "REG_BADPAT")) ((:ecollate "REG_ECOLLATE")) ((:ectype "REG_ECTYPE")) ((:eescape "REG_EESCAPE")) ((:esubreg "REG_ESUBREG")) ((:ebrack "REG_EBRACK")) ((:eparen "REG_EPAREN")) ((:ebrace "REG_EBRACE")) ((:badbr "REG_BADBR")) ((:erange "REG_ERANGE")) ((:espace "REG_ESPACE")) ((:badrpt "REG_BADRPT")) ((:eend "REG_EEND")) ((:esize "REG_ESIZE")) ((:erparen "REG_ERPAREN"))) ;; pattern buffer (constant (+regs-unallocated+ "REGS_UNALLOCATED")) (constant (+regs-reallocate+ "REGS_REALLOCATE")) (constant (+regs-fixed+ "REGS_FIXED")) (cstruct pattern-buffer "regex_t" (buffer "buffer" :type :string) (allocated "allocated" :type :long) (used "used" :type :long) (syntax "syntax" :type reg-syntax) (fastmap "fastmap" :type :pointer) (translate "translate" :type :pointer) (nsub "re_nsub" :type size-t))
4,913
Common Lisp
.lisp
116
40.836207
79
0.706792
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
07bdaec28016b413ac27fd12b651601b9ef4191b62f3b5743c6bcc482dcf44b9
11,604
[ -1 ]
11,605
cffi-regex.lisp
outergod_cl-m4/src/cffi-regex/cffi-regex.lisp
;;;; cl-m4 - cffi-regex.lisp ;;;; Copyright (C) 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cffi-regex) ;;; What follows is the manual part of the CL -> libc regex interface. Please ;;; refer to the CFFI manual, glibc regex.h and the GNU regex info pages for an ;;; in-depth explanation. (define-foreign-library libc (:unix "libc.so.6")) (use-foreign-library libc) (defcstruct registers (num-regs :unsigned-int) (start :pointer) (end :pointer)) (defctype registers (:struct registers)) (defctype pattern-buffer (:struct pattern-buffer)) (defcfun ("re_set_syntax" set-syntax) reg-syntax (syntax reg-syntax)) (defcfun ("re_compile_pattern" compile-pattern) :string (pattern :string) (length size-t) (buffer (:pointer pattern-buffer))) (defcfun ("re_compile_fastmap" compile-fastmap) :int (buffer (:pointer pattern-buffer))) (defcfun ("re_search" %regex-search) :int (buffer (:pointer pattern-buffer)) (string :string) (length :int) (start :int) (range :int) (registers (:pointer registers))) (defcfun ("re_search_2" %regex-search-2) :int (buffer (:pointer pattern-buffer)) (string1 :string) (length1 :int) (string2 :string) (length2 :int) (start :int) (range :int) (registers (:pointer registers)) (stop :int)) (defcfun ("re_match" %regex-match) :int (buffer (:pointer pattern-buffer)) (string :string) (length :int) (start :int) (registers (:pointer registers))) (defcfun ("re_match_2" %regex-match-2) :int (buffer (:pointer pattern-buffer)) (string1 :string) (length1 :int) (string2 :string) (length2 :int) (start :int) (range :int) (registers (:pointer registers)) (stop :int)) (defcfun ("re_set_registers" %regex-set-registers) :void (buffer (:pointer pattern-buffer)) (registers (:pointer registers)) (num-regs :unsigned-int) (starts regoff) (ends regoff))
2,558
Common Lisp
.lisp
75
31.76
79
0.710697
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
ed2a558a41f491151593caff11430ef101cb235cee379706c1ee682e943132af
11,605
[ -1 ]
11,606
cl-m4-test.asd
outergod_cl-m4/cl-m4-test.asd
;;;; cl-m4 - cl-m4-test.asd ;;;; Copyright (C) 2009, 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cl-user) (defpackage :cl-m4-test-system (:use :cl :asdf)) (in-package :cl-m4-test-system) (asdf:defsystem :cl-m4-test :description "cl-m4 test package" :version "0.0.1" :author "Alexander Kahl <[email protected]>" :license "GPLv3+" :depends-on (:cl-m4 :hu.dwim.stefil :cl-heredoc) :components ((:module "test" :components ((:file "package") (:module "cffi-regex" :depends-on ("package") :components ((:file "regex"))) (:file "m4") (:file "m4-builtin" :depends-on ("package" "m4")) (:file "m4-parser" :depends-on ("package" "m4")) (:file "m4-macros" :depends-on ("package" "m4")) (:file "m4-composite" :depends-on ("package" "m4"))))))
1,846
Common Lisp
.asd
38
36.631579
83
0.54102
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
5ffbc19f5f99bcac69832ad1a6689717be7264a1e3b500611a93cab1bfcd0261
11,606
[ -1 ]
11,607
cl-m4.asd
outergod_cl-m4/cl-m4.asd
;;;; cl-m4 - cl-m4.asd ;;;; Copyright (C) 2009, 2010 Alexander Kahl <[email protected]> ;;;; This file is part of cl-m4. ;;;; cl-m4 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 3 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; cl-m4 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, see <http://www.gnu.org/licenses/>. (in-package :cl-user) (defpackage :cl-m4-system (:use :cl :asdf)) (in-package :cl-m4-system) ;;; CFFI-Grovel is needed for processing grovel-file components (cl:eval-when (:load-toplevel :execute) (asdf:operate 'asdf:load-op 'cffi-grovel)) (asdf:defsystem :cl-m4 :description "Common Lisp re-implementation of GNU M4" :version "0.0.1" :author "Alexander Kahl <[email protected]>" :license "GPLv3+" :depends-on (:external-program :cl-ppcre :alexandria :cl-fad :graylex :cffi) :components ((:module "src" :components ((:file "package") (:module "cffi-regex" :components ((cffi-grovel:grovel-file "cffi-regex-grovel") (:file "cffi-regex" :depends-on ("cffi-regex-grovel")) (:file "regex" :depends-on ("cffi-regex"))) :depends-on ("package")) (:file "m4-util" :depends-on ("package")) (:file "m4-lexer" :depends-on ("package")) (:file "m4-builtin" :depends-on ("package" "m4-util")) (:file "m4-parser" :depends-on ("package" "m4-util" "m4-lexer"))))))
2,208
Common Lisp
.asd
43
39.209302
95
0.555556
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
3dbf909dd28d7f4269be84aca7a1dbf3d05d667eab11430c64e86622b4e971aa
11,607
[ -1 ]
11,618
capitalize2.m4
outergod_cl-m4/test/fixtures/gnu-m4-examples/capitalize2.m4
divert(`-1') # upcase(text) # downcase(text) # capitalize(text) # change case of text, improved version define(`upcase', `translit(`$*', `a-z', `A-Z')') define(`downcase', `translit(`$*', `A-Z', `a-z')') define(`_arg1', `$1') define(`_to_alt', `changequote(`<<[', `]>>')') define(`_from_alt', `changequote(<<[`]>>, <<[']>>)') define(`_upcase_alt', `translit(<<[$*]>>, <<[a-z]>>, <<[A-Z]>>)') define(`_downcase_alt', `translit(<<[$*]>>, <<[A-Z]>>, <<[a-z]>>)') define(`_capitalize_alt', `regexp(<<[$1]>>, <<[^\(\w\)\(\w*\)]>>, <<[_upcase_alt(<<[<<[\1]>>]>>)_downcase_alt(<<[<<[\2]>>]>>)]>>)') define(`capitalize', `_arg1(_to_alt()patsubst(<<[<<[$*]>>]>>, <<[\w+]>>, _from_alt()`]>>_$0_alt(<<[\&]>>)<<['_to_alt())_from_alt())') divert`'dnl
752
Common Lisp
.l
19
37.947368
69
0.481583
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
1442b7a24aaf59397c375736052af682fdbd6bbd978e4d916a4f5d5f8746b54d
11,618
[ -1 ]
11,619
forloop3.m4
outergod_cl-m4/test/fixtures/gnu-m4-examples/forloop3.m4
divert(`-1') # forloop_arg(from, to, macro) - invoke MACRO(value) for # each value between FROM and TO, without define overhead define(`forloop_arg', `ifelse(eval(`($1) <= ($2)'), `1', `_forloop(`$1', eval(`$2'), `$3(', `)')')') # forloop(var, from, to, stmt) - refactored to share code define(`forloop', `ifelse(eval(`($2) <= ($3)'), `1', `pushdef(`$1')_forloop(eval(`$2'), eval(`$3'), `define(`$1',', `)$4')popdef(`$1')')') define(`_forloop', `$3`$1'$4`'ifelse(`$1', `$2', `', `$0(incr(`$1'), `$2', `$3', `$4')')') divert`'dnl
545
Common Lisp
.l
13
39.846154
59
0.535714
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
e46330ef5ece4668f39af648bcfd0c37e1abb571a912a7a9f44faff7fd191149
11,619
[ -1 ]
11,620
sync-lines.m4
outergod_cl-m4/test/fixtures/gnu-m4-examples/sync-lines.m4
# Several input lines, expanding to one define(`foo', ``foo' line one. `foo' line two. `foo' line three.') xyz foo # Several input lines, expanding to none define(`foo', ``foo' line one. `foo' line two. `foo' line three.')dnl # one input line, expanding to several output lines foo foo
286
Common Lisp
.l
11
25
51
0.730909
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
a29daa9d59da0d3be6e39ed33bf525d63e0ae217230a7096cd3932a315927782
11,620
[ -1 ]
11,621
file.m4
outergod_cl-m4/test/fixtures/gnu-m4-examples/file.m4
changequote([[,]])dnl define([[quoteall]], [[patsubst([[[[$*]]]], [[,[ ]+]], [[,]])]])dnl define([[group]], quoteall(include([[/etc/group]])))dnl dnl group()dnl
162
Common Lisp
.l
5
31.4
68
0.55414
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
0ff79ceee436d3956c0e9ef4346746d89af810cb3e18e388edd1e3fd97175e22
11,621
[ -1 ]
11,622
forloop2.m4
outergod_cl-m4/test/fixtures/gnu-m4-examples/forloop2.m4
divert(`-1') # forloop(var, from, to, stmt) - improved version: # works even if VAR is not a strict macro name # performs sanity check that FROM is larger than TO # allows complex numerical expressions in TO and FROM define(`forloop', `ifelse(eval(`($2) <= ($3)'), `1', `pushdef(`$1')_$0(`$1', eval(`$2'), eval(`$3'), `$4')popdef(`$1')')') define(`_forloop', `define(`$1', `$2')$4`'ifelse(`$2', `$3', `', `$0(`$1', incr(`$2'), `$3', `$4')')') divert`'dnl
473
Common Lisp
.l
12
37.416667
55
0.572668
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
faf7763d7e322f119b1d4bd7f685e83b2d15b9b1c5512fb1a7e706cdf0463fff
11,622
[ -1 ]
11,623
wraplifo.m4
outergod_cl-m4/test/fixtures/gnu-m4-examples/wraplifo.m4
dnl Redefine m4wrap to have LIFO semantics. define(`_m4wrap_level', `0')dnl define(`_m4wrap', defn(`m4wrap'))dnl define(`m4wrap', `ifdef(`m4wrap'_m4wrap_level, `define(`m4wrap'_m4wrap_level, `$1'defn(`m4wrap'_m4wrap_level))', `_m4wrap(`define(`_m4wrap_level', incr(_m4wrap_level))dnl m4wrap'_m4wrap_level)dnl define(`m4wrap'_m4wrap_level, `$1')')')dnl
381
Common Lisp
.l
10
34.2
64
0.671159
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
9c9d60844f781c66b7b17e49973f35d0d9cc0b3398d281a5fbb848cb9976e2c1
11,623
[ -1 ]
11,624
multiquotes.m4
outergod_cl-m4/test/fixtures/gnu-m4-examples/multiquotes.m4
traceon changequote([,])dnl changequote([``], [''])dnl ````traceon'''' define(``foo'', ````FOO'''')dnl dumpdef(``foo'')dnl changequote(``!'', ``!'')dnl !foo! foo dumpdef(!foo!)dnl define(!bar!, !BAR!) bar changequote(!>*>*>*>*>!, !<*<*<*<*<!)dnl five of each >*>*>*>*>foo bar<*<*<*<*< foo bar >*>*>*>*>*>*><*<*<*<*<*<*< dumpdef(>*>*>*>*>foo<*<*<*<*<, >*>*>*>*>bar<*<*<*<*<)dnl
377
Common Lisp
.l
17
21.176471
56
0.472222
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
d9d37155d4e7ecbc2a8a0170cea5c12b51b97e3feb9eef70acdfa1f93cd66713
11,624
[ -1 ]
11,625
capitalize.m4
outergod_cl-m4/test/fixtures/gnu-m4-examples/capitalize.m4
divert(`-1') # upcase(text) # downcase(text) # capitalize(text) # change case of text, simple version define(`upcase', `translit(`$*', `a-z', `A-Z')') define(`downcase', `translit(`$*', `A-Z', `a-z')') define(`_capitalize', `regexp(`$1', `^\(\w\)\(\w*\)', `upcase(`\1')`'downcase(`\2')')') define(`capitalize', `patsubst(`$1', `\w+', `_$0(`\&')')') divert`'dnl
385
Common Lisp
.l
12
29.25
58
0.533512
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
ede074838be0b5b131addefe7fcaac1f54db33a368f9820d8d3be5a698f372f1
11,625
[ -1 ]
11,626
wraplifo2.m4
outergod_cl-m4/test/fixtures/gnu-m4-examples/wraplifo2.m4
dnl Redefine m4wrap to have LIFO semantics, improved example. include(`join.m4')dnl define(`_m4wrap', defn(`m4wrap'))dnl define(`_arg1', `$1')dnl define(`m4wrap', `ifdef(`_$0_text', `define(`_$0_text', joinall(` ', $@)defn(`_$0_text'))', `_$0(`_arg1(defn(`_$0_text')undefine(`_$0_text'))')dnl define(`_$0_text', joinall(` ', $@))')')dnl
351
Common Lisp
.l
9
36.444444
62
0.602339
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
fe494883a24d8c95ee0a732495dc2eb5661c917fe451e6b64d9e5c8ef61041e7
11,626
[ -1 ]
11,627
forloop.m4
outergod_cl-m4/test/fixtures/gnu-m4-examples/forloop.m4
divert(`-1') # forloop(var, from, to, stmt) - simple version define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') define(`_forloop', `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') divert`'dnl
224
Common Lisp
.l
6
35.166667
66
0.550459
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
459b958d540064c8ce6dce3e38a5af230d9c73bca7686af30514cdadf32c8d87
11,627
[ -1 ]
11,628
translit.m4
outergod_cl-m4/test/fixtures/gnu-m4-examples/translit.m4
# traceon(`translit')dnl translit(`GNUs not Unix', `a-z') translit(`GNUs not Unix', `a-z', `A-Z') translit(`GNUs not Unix', `A-Z', `a-z') translit(`GNUs not Unix', `A-Z') translit(`a-z', `a-') translit(`A-Z', `A-Z-', `-A-Z') translit(`GNUs not Unix', `Z-A', `a-z')
265
Common Lisp
.l
8
32.125
39
0.599222
outergod/cl-m4
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
21354aff78613bfbe220cd5d5ce36b2cb27cfc3bbc32b941284659410222757a
11,628
[ -1 ]
11,649
petri4.lisp
lambdamikel_PetriNets-CLIM-Demo/src/petri4.lisp
;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: clim-user -*- ;;; ;;; Very simple petri net editor in Common LISP (CLIM/CLOS-Demo) ;;; Lets you create token nets and play with them ;;; Demonstrates some basic CLIM and CLOS programming techniques ;;; (C) 2003 by Michael Wessel ;;; (require "clim") (in-package clim-user) ;;; ;;; "Model" Classes ;;; (defclass petri-net () ((places :accessor places :initform nil) (transitions :accessor transitions :initform nil) (edges :accessor edges :initform nil))) (defclass token-net (petri-net) ()) ;;; ;;; ;;; (defclass petri-net-item () ((in-net :accessor in-net :initarg :in-net))) (defclass petri-net-item-with-capacity (petri-net-item) ((capacity :accessor capacity :initarg :capacity :initform 1))) (defclass place-or-transition (petri-net-item) ((outgoing-edges :accessor outgoing-edges :initform nil) (incoming-edges :accessor incoming-edges :initform nil))) ;;; ;;; ;;; (defclass transition (place-or-transition) ()) ;;; ;;; ;;; (defclass place (place-or-transition) ()) (defclass place-with-net-tokens (place) ((net-tokens :accessor net-tokens :initarg :net-tokens :initform 0))) (defclass place-with-capacity (place-with-net-tokens petri-net-item-with-capacity) ()) ;;; ;;; ;;; (defclass edge (petri-net-item) ((from :accessor from :initarg :from) (to :accessor to :initarg :to))) (defclass edge-with-capacity (edge petri-net-item-with-capacity) ()) ;;; ;;; ;;; (defun make-petri-net () (make-instance 'petri-net)) (defun make-token-net () (make-instance 'token-net)) ;;; ;;; ;;; (defmethod initialize-instance :after ((transition transition) &rest initargs) (push transition (transitions (in-net transition)))) (defmethod make-transition ((net petri-net) &key &allow-other-keys) (make-instance 'transition :in-net net)) ;;; ;;; ;;; (defmethod initialize-instance :after ((place place) &rest initargs) (push place (places (in-net place)))) (defmethod make-place ((net petri-net) &rest args) (make-instance 'place :in-net net)) (defmethod make-place ((net token-net) &key (net-tokens 0) capacity &allow-other-keys) (if capacity (make-instance 'place-with-capacity :net-tokens net-tokens :capacity capacity :in-net net) (make-instance 'place-with-net-tokens :net-tokens net-tokens :in-net net))) ;;; ;;; ;;; (defmethod initialize-instance :after ((edge edge) &rest initargs) (push edge (outgoing-edges (from edge))) (push edge (incoming-edges (to edge))) (push edge (edges (in-net edge)))) (defmethod link :before ((a place-or-transition) (b place-or-transition) &key &allow-other-keys) (unless (eq (in-net a) (in-net b)) (error "~A and ~A must be in same net!" a b)) (when (some #'(lambda (outgoing-edge) (eq (to outgoing-edge) b)) (outgoing-edges a)) (error "~A and ~A are already linked!" a b))) (defmethod link ((a place-or-transition) (b place-or-transition) &key &allow-other-keys) (error "Can only link places with transitions or transitions with places!")) (defmethod link ((transition transition) (place place) &key &allow-other-keys) (make-instance 'edge :in-net (in-net transition) :from transition :to place)) (defmethod link ((place place) (transition transition) &key &allow-other-keys) (make-instance 'edge :in-net (in-net transition) :from place :to transition)) (defmethod link ((place place-with-net-tokens) (transition transition) &key (capacity 1) &allow-other-keys) (make-instance 'edge-with-capacity :in-net (in-net transition) :from place :to transition :capacity capacity)) (defmethod link ((transition transition) (place place-with-net-tokens) &key (capacity 1) &allow-other-keys) (make-instance 'edge-with-capacity :in-net (in-net transition) :from transition :to place :capacity capacity)) ;;; ;;; ;;; (defmethod unlink ((a place-or-transition) (b place-or-transition)) (dolist (outgoing-edge (outgoing-edges a)) (when (eq (to outgoing-edge) b) (remove-from-net outgoing-edge)))) ;;; ;;; ;;; (defmethod remove-from-net ((edge edge)) (setf (outgoing-edges (from edge)) (delete edge (outgoing-edges (from edge)))) (setf (incoming-edges (to edge)) (delete edge (incoming-edges (to edge)))) (setf (edges (in-net edge)) (delete edge (edges (in-net edge)))) (in-net edge)) (defmethod remove-from-net ((place-or-transition place-or-transition)) (dolist (edge (append (outgoing-edges place-or-transition) (incoming-edges place-or-transition))) (remove-from-net edge)) (in-net place-or-transition)) (defmethod remove-from-net :after ((transition transition)) (setf (transitions (in-net transition)) (delete transition (transitions (in-net transition))))) (defmethod remove-from-net :after ((place place)) (setf (places (in-net place)) (delete place (places (in-net place))))) ;;; ;;; ;;; (defmethod may-have-more-net-tokens-p ((place place-with-net-tokens)) t) (defmethod may-have-more-net-tokens-p ((place place-with-capacity)) (< (net-tokens place) (capacity place))) ;;; ;;; ;;; (defmethod add-net-tokens ((place place-with-net-tokens) &optional (net-tokens 1)) (incf (net-tokens place) net-tokens)) (defmethod add-net-tokens :after ((place place-with-capacity) &optional args) (setf (net-tokens place) (min (net-tokens place) (capacity place)))) (defmethod remove-net-tokens ((place place-with-net-tokens) &optional (net-tokens 1)) (unless (zerop (net-tokens place)) (decf (net-tokens place) net-tokens))) ;;; ;;; ;;; (defmethod increase-capacity ((item petri-net-item-with-capacity) &optional (increment 1)) (incf (capacity item) increment)) (defmethod decrease-capacity ((item petri-net-item-with-capacity) &optional (increment 1)) (unless (zerop (1- (capacity item))) (decf (capacity item) increment))) ;;; ;;; ;;; (defmethod activated-p ((transition transition)) (active-p (in-net transition) transition)) (defmethod active-p ((net petri-net) (transition transition)) t) (defmethod active-p ((net token-net) (transition transition)) (and (incoming-edges transition) (every #'(lambda (incoming-edge) (>= (net-tokens (from incoming-edge)) (capacity incoming-edge))) (incoming-edges transition)) (outgoing-edges transition) (every #'(lambda (outgoing-edge) (or (not (typep (to outgoing-edge) 'place-with-capacity)) (<= (+ (net-tokens (to outgoing-edge)) (capacity outgoing-edge)) (capacity (to outgoing-edge))))) (outgoing-edges transition)))) ;;; ;;; ;;; (defmethod activate :before ((transition transition)) (unless (activated-p transition) (error "Transition ~A is not active!" transition))) (defmethod activate ((transition transition)) (make-step transition (in-net transition))) ;;; ;;; ;;; (defmethod make-step ((transition transition) (net petri-net)) net) (defmethod make-step ((transition transition) (net token-net)) (dolist (incoming-edge (incoming-edges transition)) (remove-net-tokens (from incoming-edge) (capacity incoming-edge))) (dolist (outgoing-edge (outgoing-edges transition)) (add-net-tokens (to outgoing-edge) (capacity outgoing-edge))) net) ;;; ;;; ;;; (defmethod step-net ((net petri-net)) t) (defmethod step-net ((net token-net)) (let ((active-transitions (remove-if-not #'activated-p (transitions net)))) (labels ((one-of (sequence) (elt sequence (random (length sequence))))) (when active-transitions (activate (one-of active-transitions)))))) ;;; ;;; "View" Classes ;;; (defconstant +font+ (make-text-style :sans-serif :bold :small)) (defclass display-object () ((object-color :accessor object-color :initform +black+))) (defclass positioned-display-object (display-object) ((x :accessor x :initarg :x) (y :accessor y :initarg :y))) (defclass transition-view (positioned-display-object transition) ((object-color :initform +red+))) (defclass place-view (positioned-display-object place) ((object-color :initform +blue+))) (defclass place-with-net-tokens-view (place-view place-with-net-tokens) ((object-color :initform +blue+))) (defclass place-with-capacity-view (place-with-net-tokens-view place-with-capacity) ()) (defclass edge-view (display-object edge) ()) (defclass edge-with-capacity-view (edge-view edge-with-capacity) ()) ;;; ;;; ;;; (defclass petri-net-view (petri-net standard-application-frame) ()) (defclass token-net-view (petri-net-view token-net) ()) ;;; ;;; Solve the "make isn't generic"-problem (kind of "Factory Pattern") ;;; (defmethod make-place ((net petri-net-view) &rest initargs) (apply #'change-class-of-instance (call-next-method) initargs)) (defmethod make-transition ((net petri-net-view) &rest initargs) (apply #'change-class-of-instance (call-next-method) initargs)) (defmethod link :around ((transition transition-view) (place place-view) &rest initargs) (apply #'change-class-of-instance (call-next-method) initargs)) (defmethod link :around ((place place-view) (transition transition-view) &rest initargs) (apply #'change-class-of-instance (call-next-method) initargs)) ;;; ;;; ;;; (defmethod change-class-of-instance ((transition transition) &rest initargs) (apply #'change-class transition 'transition-view initargs)) (defmethod change-class-of-instance ((place place) &rest initargs) (apply #'change-class place 'place-view initargs)) (defmethod change-class-of-instance ((place place-with-net-tokens) &rest initargs) (apply #'change-class place 'place-with-net-tokens-view initargs)) (defmethod change-class-of-instance ((place place-with-capacity) &rest initargs) (apply #'change-class place 'place-with-capacity-view initargs)) (defmethod change-class-of-instance ((edge edge) &rest initargs) (apply #'change-class edge 'edge-view initargs)) (defmethod change-class-of-instance ((edge edge-with-capacity) &rest initargs) (apply #'change-class edge 'edge-with-capacity-view initargs)) ;;; ;;; ;;; (defun get-random-net (n m p) (let ((net (make-petri-net))) (change-class net 'petri-net-view) (let ((places (loop as i from 1 to n collect (make-place net))) (transitions (loop as i from 1 to m collect (make-transition net)))) (loop as place in places do (loop as transition in transitions do (when (zerop (random p)) (link place transition))))) net)) ;;; ;;; Define the application frame ;;; Use inheritance to get a petri net editor ;;; (instead of, e.g., using association) ;;; (define-application-frame petri-net-editor (token-net-view) (; (net :accessor net :initform (get-random-net 10 10 3)) (scaling-factor :accessor scaling-factor :initform 1.0)) (:command-table (petri-net-editor :menu (("Commands" :menu command-table)))) (:panes (pointer-documentation-pane (make-clim-stream-pane :type 'pointer-documentation-pane :text-style +font+ :height '(1 :line) :min-height '(1 :line))) (command :interactor :text-style +font+) (display :application :display-function #'draw :incremental-redisplay t :redisplay-after-commands t) (scaling-factor :application :text-style +font+ :scroll-bars nil :incremental-redisplay t :display-function #'(lambda (frame stream) (updating-output (stream :unique-id 'scaling-factor :cache-value (scaling-factor frame) :cache-test #'=) (format stream "Current Scaling Factor: ~A" (scaling-factor frame))))) (slider (make-pane 'slider :text-style +font+ :scroll-bars nil :client 'slider :id 'slider :min-value 0.1 :max-value 10 :number-of-tick-marks 10 :value-changed-callback #'(lambda (slider val) (declare (ignore slider)) (with-application-frame (frame) (setf (scaling-factor frame) val) (redisplay-frame-panes frame))))) (quit-button (make-pane 'push-button :label "Quit!" :text-style +font+ :activate-callback #'(lambda (button) (declare (ignore button)) (with-application-frame (frame) (frame-exit frame))))) (refresh-button (make-pane 'push-button :label "Refresh!" :text-style +font+ :activate-callback #'(lambda (button) (declare (ignore button)) (with-application-frame (frame) (setf (scaling-factor frame) 1.0) (redisplay-frame-panes frame :force-p t))))) (step-button (make-pane 'push-button :label "Step!" :text-style +font+ :activate-callback #'(lambda (button) (declare (ignore button)) (with-application-frame (frame) (step-net frame) (redisplay-frame-panes frame)))))) (:layouts (:default #+:mswindows (vertically () (3/4 (vertically () (horizontally () (2/3 slider) (1/3 scaling-factor)) (horizontally () (1/3 quit-button) (1/3 refresh-button) (1/3 step-button)) display)) (1/4 command) pointer-documentation-pane) #-:mswindows (vertically () (3/4 (vertically () display (horizontally () (1/7 quit-button) (1/7 refresh-button) (1/7 step-button) (4/7 (vertically () (1/2 slider) (1/2 scaling-factor)))))) (1/4 command) pointer-documentation-pane)))) ;;; ;;; ;;; (defmethod get-pane-size ((stream stream)) (bounding-rectangle-size (bounding-rectangle (window-viewport stream)))) (defmethod get-relative-coordinates ((frame petri-net-editor) x y) (multiple-value-bind (width height) (get-pane-size (get-frame-pane frame 'display)) (values (/ (/ x width) (scaling-factor frame)) (/ (/ y height) (scaling-factor frame))))) (defmethod get-dimensions ((transition transition-view)) (with-application-frame (frame) (values (/ 0.05 (scaling-factor frame)) (/ 0.03 (scaling-factor frame))))) (defmethod get-dimensions ((place place-view)) (with-application-frame (frame) (values (/ 0.05 (scaling-factor frame))))) ;;; ;;; Draw the editor's content ;;; (defmethod draw ((frame petri-net-editor) stream) (multiple-value-bind (width height) (get-pane-size stream) (with-scaling (stream (scaling-factor frame) (scaling-factor frame) ) (with-scaling (stream width height) (dolist (object (append (places frame) (transitions frame))) (present object (type-of object) :stream stream :view +gadget-view+ :single-box t)) (dolist (edge (edges frame)) (present edge (type-of edge) :stream stream :view +gadget-view+)))))) ;;; ;;; Define the presentation methods ;;; (define-presentation-method present :around (object (type positioned-display-object) stream (view gadget-view) &key) (with-translation (stream (x object) (y object)) (call-next-method))) (define-presentation-method present :around (object (type display-object) stream (view gadget-view) &key) (with-drawing-options (stream :line-thickness 3 :ink (object-color object) :text-style +font+) (call-next-method))) (define-presentation-method present (place (type place-view) stream (view gadget-view) &key) (with-application-frame (frame) (multiple-value-bind (radius) (get-dimensions place) (updating-output (stream :unique-id place :cache-value (list (scaling-factor frame) (x place) (y place) (object-color place)) :cache-test #'equal) (draw-circle* stream 0 0 radius :filled nil))))) (define-presentation-method present (place (type place-with-net-tokens-view) stream (view gadget-view) &key) (with-application-frame (frame) (labels ((deg-to-rad (phi) (* pi (/ phi 180)))) (multiple-value-bind (radius) (get-dimensions place) (updating-output (stream :unique-id place :cache-value (list (scaling-factor frame) (x place) (y place) (object-color place) (net-tokens place)) :cache-test #'equal) (draw-circle* stream 0 0 radius :filled nil)) (unless (zerop (net-tokens place)) (let* ((n (net-tokens place)) (w (/ 360 n)) (r (* 2/3 radius)) (s (* 1/8 radius))) (loop as a from 1 to n do (draw-circle* stream (* r (sin (deg-to-rad (* a w)))) (* r (cos (deg-to-rad (* a w)))) s :ink +black+)))))))) (define-presentation-type capacity-label-view ()) (define-presentation-method presentation-typep (object (type capacity-label-view)) (typep object 'petri-net-item-with-capacity)) (define-presentation-method present :after (place (type place-with-capacity-view) stream (view gadget-view) &key) (with-application-frame (frame) (multiple-value-bind (radius) (get-dimensions place) (updating-output (stream :unique-id (list place (capacity place)) :id-test #'equal :cache-value (list (scaling-factor frame) (x place) (x place) (object-color place) (capacity place)) :cache-test #'equal) (with-output-as-presentation (stream place 'capacity-label-view) (draw-text* stream (format nil "~A" (capacity place)) radius radius)))))) (define-presentation-method present (transition (type transition-view) stream (view gadget-view) &key) (with-application-frame (frame) (multiple-value-bind (width height) (get-dimensions transition) (updating-output (stream :unique-id transition :cache-value (list (activated-p transition) (scaling-factor frame) (x transition) (x transition) (object-color transition)) :cache-test #'equal) (draw-rectangle* stream (- width) (- height) width height :filled (activated-p transition)))))) (define-presentation-method present (edge (type edge-view) stream (view gadget-view) &key) (with-application-frame (frame) (let ((from (from edge)) (to (to edge))) (updating-output (stream :unique-id edge :cache-value (list (scaling-factor frame) (x from) (x to) (y from) (y to) (object-color edge)) :cache-test #'equal) (draw-arrow* stream (x from) (y from) (x to) (y to) :line-thickness 2 :head-length (/ 0.03 (scaling-factor frame)) :head-width (/ 0.03 (scaling-factor frame))))))) (define-presentation-method present :after (edge (type edge-with-capacity-view) stream (view gadget-view) &key) (with-application-frame (frame) (let ((from (from edge)) (to (to edge))) (updating-output (stream :unique-id (list edge (capacity edge)) :id-test #'equal :cache-value (list (scaling-factor frame) (x from) (x to) (y from) (y to) (object-color edge) (capacity edge)) :cache-test #'equal) (with-output-as-presentation (stream edge 'capacity-label-view) (draw-text* stream (format nil "~A" (capacity edge)) (/ (+ (x from) (x to)) 2) (/ (+ (y from) (y to)) 2))))))) ;;; ;;; Define some gesture names ;;; (define-gesture-name :new-place :pointer-button :left) (define-gesture-name :new-transition :pointer-button (:left :shift)) (define-gesture-name :delete :pointer-button :left) (define-gesture-name :activate :pointer-button (:right :shift)) (define-gesture-name :move :pointer-button (:control :left)) (define-gesture-name :add-token :pointer-button :middle) (define-gesture-name :remove-token :pointer-button (:middle :shift)) (define-gesture-name :add-capacity-label :pointer-button (:middle :control)) ;;; ;;; Define some editor commands ;;; (define-petri-net-editor-command (com-new-transition :menu nil :name "New Transition") ((x 'integer) (y 'integer)) (with-application-frame (frame) (multiple-value-bind (x y) (get-relative-coordinates frame x y) (make-transition frame :x x :y y)))) (define-petri-net-editor-command (com-new-place :menu nil :name nil) ((x 'integer) (y 'integer)) (with-application-frame (frame) (multiple-value-bind (x y) (get-relative-coordinates frame x y) (make-place frame :x x :y y)))) ;;; ;;; (define-petri-net-editor-command (com-link-place-with-transition :menu nil :name "Link Place with Transition") ((place 'place-view) (transition 'transition-view)) (link place transition)) (define-petri-net-editor-command (com-link-transition-with-place :menu nil :name "Link Transition with Place") ((transition 'transition-view) (place 'place-view)) (link transition place)) ;;; ;;; ;;; (define-petri-net-editor-command (com-unlink-place-and-transition :menu nil :name "Unlink Place and Transition") ((place 'place-view) (transition 'transition-view)) (unlink place transition)) (define-petri-net-editor-command (com-unlink-transition-and-place :menu nil :name "Unlink Transition and Place") ((transition 'transition-view) (place 'place-view)) (unlink transition place)) ;;; ;;; ;;; (define-petri-net-editor-command (com-delete-object :menu nil :name "Delete Object") ((object 'display-object)) (remove-from-net object)) ;;; ;;; ;;; ;;; (define-petri-net-editor-command (com-add-token :menu nil :name "Add Token") ((place-with-net-tokens `(and place-with-net-tokens-view (satisfies may-have-more-net-tokens-p)))) (add-net-tokens place-with-net-tokens)) (define-petri-net-editor-command (com-remove-token :menu nil :name "Remove Token") ((place-with-net-tokens `(and place-with-net-tokens-view (satisfies ,#'(lambda (place) (not (zerop (net-tokens place)))))))) (remove-net-tokens place-with-net-tokens)) ;;; ;;; ;;; (define-petri-net-editor-command (com-add-capacity-label :menu nil :name "Add Capacity Label") ((place-with-net-tokens `(and place-with-net-tokens-view (satisfies ,#'(lambda (object) (not (typep object 'place-with-capacity-view)))))) (capacity 'integer)) (apply #'change-class place-with-net-tokens 'place-with-capacity-view :capacity capacity nil)) ;;; ;;; ;;; (define-petri-net-editor-command (com-increase-capacity :menu nil :name "Increase Capacity") ((capacity-label 'capacity-label-view)) (increase-capacity capacity-label 1)) (define-petri-net-editor-command (com-decrease-capacity :menu nil :name "Decrease Capacity") ((capacity-label `(and capacity-label-view (satisfies ,#'(lambda (object) (not (zerop (1- (capacity object))))))))) (decrease-capacity capacity-label 1)) ;;; ;;; ;;; (define-petri-net-editor-command (com-activate-transition :menu nil :name "Activate Transition") ((transition 'transition-view)) (activate transition)) ;;; ;;; ;;; (define-petri-net-editor-command (com-move-display-object :menu nil :name "Move Display Object") ((object 'positioned-display-object)) (with-application-frame (frame) (let ((ox (x object)) (oy (y object)) (stream (get-frame-pane frame 'display))) (tracking-pointer (stream) (:pointer-motion (x y) (multiple-value-bind (x y) (get-relative-coordinates frame x y) (setf (x object) x (y object) y) (redisplay-frame-pane frame stream))) (:pointer-button-press (event) (when (= (pointer-event-button event) +pointer-right-button+) (setf (x object) ox (y object) oy)) (return)))))) (define-petri-net-editor-command (com-new-transition-no-arguments :menu nil :name "New Transition") nil (with-application-frame (frame) (let ((stream (get-frame-pane frame 'display))) (multiple-value-bind (x y) (tracking-pointer (stream) (:pointer-button-press (x y event) (when (= (pointer-event-button event) +pointer-left-button+) (return (values x y))))) (com-new-transition x y))))) (define-petri-net-editor-command (com-new-place-no-arguments :menu nil :name "New Place") nil (with-application-frame (frame) (let ((stream (get-frame-pane frame 'display))) (multiple-value-bind (x y) (tracking-pointer (stream) (:pointer-button-press (x y event) (when (= (pointer-event-button event) +pointer-left-button+) (return (values x y))))) (com-new-place x y))))) ;;; ;;; Define some presentation translators ;;; (define-presentation-to-command-translator move-display-object (positioned-display-object com-move-display-object petri-net-editor :gesture :move :documentation ((stream) (format stream "Move This Object")) :echo t :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator delete-object (display-object com-delete-object petri-net-editor :gesture :delete :documentation ((stream) (format stream "Delete This Object")) :echo nil :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator new-transition (blank-area com-new-transition petri-net-editor :gesture :new-transition :documentation ((stream) (format stream "Create New Transition")) :echo nil :maintain-history nil) (x y) (list x y)) (define-presentation-to-command-translator new-place (blank-area com-new-place petri-net-editor :gesture :new-place :documentation ((stream) (format stream "Create New Place")) :echo nil :maintain-history nil) (x y) (list x y)) (define-presentation-to-command-translator add-token (place-with-net-tokens-view com-add-token petri-net-editor :gesture :add-token :tester ((object) (may-have-more-net-tokens-p object)) :documentation ((stream) (format stream "Add a Token")) :echo t :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator remove-token (place-with-net-tokens-view com-remove-token petri-net-editor :gesture :remove-token :tester ((object) (not (zerop (net-tokens object)))) :documentation ((stream) (format stream "Remove a Token")) :echo t :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator add-capacity-label (place-with-net-tokens-view com-add-capacity-label petri-net-editor :gesture :add-capacity-label :tester ((object) (not (typep object 'place-with-capacity-view))) :documentation ((stream) (format stream "Add a Capacity Label")) :echo t :maintain-history nil) (object) (list object 4)) (define-presentation-to-command-translator increase-capacity (capacity-label-view com-increase-capacity petri-net-editor :gesture :add-token :documentation ((stream) (format stream "Increase Capacity")) :echo t :maintain-history t) (object) (list object)) (define-presentation-to-command-translator decrease-capacity (capacity-label-view com-decrease-capacity petri-net-editor :gesture :remove-token :tester ((object) (not (zerop (1- (capacity object))))) :documentation ((stream) (format stream "Decrease Capacity")) :echo t :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator activate-transition (transition-view com-activate-transition petri-net-editor :gesture :activate :tester ((object) (activated-p object)) :documentation ((stream) (format stream "Activate Transition")) :echo t :maintain-history nil) (object) (list object)) ;;; ;;; Define the command table ;;; (define-command-table command-table :menu (("New Transition" :command (com-new-transition-no-arguments)) ("New Place" :command (com-new-place-no-arguments)) ("Link Place with Transtion" :command (com-link-place-with-transition)) ("Link Transtion with Place" :command (com-link-transition-with-place)) ("divide1" :divider nil) ("Delete Object" :command (com-delete-object)) ("divide2" :divider nil) ("Add Capacity Label" :command (com-add-capacity-label)) ("Increase Capacity" :command (com-increase-capacity)) ("Decrease Capacity" :command (com-decrease-capacity)) ("divide3" :divider nil) ("Add Token" :command (com-add-token)) ("Remove Toke" :command (com-remove-token)) ("divide4" :divider nil) ("Activate Transition" :command (com-activate-transition)))) ;;; ;;; Run the application ;;; (defun petri () (setf *application-frame* (make-application-frame 'petri-net-editor :width 700 :height 700)) (run-frame-top-level *application-frame*)) (petri)
34,800
Common Lisp
.lisp
825
30.415758
100
0.557158
lambdamikel/PetriNets-CLIM-Demo
9
1
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
3c0569290e5315b0d0dcd2927d736e717b3855bdeb0829e118e2b0ad72a719f5
11,649
[ -1 ]
11,650
petri2.lisp
lambdamikel_PetriNets-CLIM-Demo/src/old/petri2.lisp
;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: clim-user -*- ;;; ;;; Very simple petri net editor in Common LISP (CLIM/CLOS-Demo) ;;; Lets you create token nets and play with them ;;; Demonstrates some basic CLIM and CLOS programming techniques ;;; (C) 2003 by Michael Wessel ;;; #+(and allegro windows) (require :climnt) (in-package clim-user) ;;; ;;; "Model" Classes ;;; (defclass petri-net () ((places :accessor places :initform nil) (transitions :accessor transitions :initform nil) (edges :accessor edges :initform nil))) (defclass token-net (petri-net) ()) ;;; ;;; ;;; (defclass petri-net-item () ((in-net :accessor in-net :initarg :in-net))) (defclass petri-net-item-with-capacity (petri-net-item) ((capacity :accessor capacity :initarg :capacity :initform 1))) (defclass place-or-transition (petri-net-item) ((outgoing-edges :accessor outgoing-edges :initform nil) (incoming-edges :accessor incoming-edges :initform nil))) ;;; ;;; ;;; (defclass transition (place-or-transition) ()) ;;; ;;; ;;; (defclass place (place-or-transition) ()) (defclass place-with-tokens (place) ((tokens :accessor tokens :initarg :tokens :initform 0))) (defclass place-with-capacity (place-with-tokens petri-net-item-with-capacity) ()) ;;; ;;; ;;; (defclass edge (petri-net-item) ((from :accessor from :initarg :from) (to :accessor to :initarg :to))) (defclass edge-with-capacity (edge petri-net-item-with-capacity) ()) ;;; ;;; ;;; (defun make-petri-net () (make-instance 'petri-net)) (defun make-token-net () (make-instance 'token-net)) ;;; ;;; ;;; (defmethod initialize-instance :after ((transition transition) &rest initargs) (push transition (transitions (in-net transition)))) (defmethod make-transition ((net petri-net) &key &allow-other-keys) (make-instance 'transition :in-net net)) ;;; ;;; ;;; (defmethod initialize-instance :after ((place place) &rest initargs) (push place (places (in-net place)))) (defmethod make-place ((net petri-net) &rest args) (make-instance 'place :in-net net)) (defmethod make-place ((net token-net) &key (tokens 0) capacity &allow-other-keys) (if capacity (make-instance 'place-with-capacity :tokens tokens :capacity capacity :in-net net) (make-instance 'place-with-tokens :tokens tokens :in-net net))) ;;; ;;; ;;; (defmethod initialize-instance :after ((edge edge) &rest initargs) (push edge (outgoing-edges (from edge))) (push edge (incoming-edges (to edge))) (push edge (edges (in-net edge)))) (defmethod link :before ((a place-or-transition) (b place-or-transition) &key &allow-other-keys) (unless (eq (in-net a) (in-net b)) (error "~A and ~A must be in same net!" a b)) (when (some #'(lambda (outgoing-edge) (eq (to outgoing-edge) b)) (outgoing-edges a)) (error "~A and ~A are already linked!" a b))) (defmethod link ((a place-or-transition) (b place-or-transition) &key &allow-other-keys) (error "Can only link places with transitions or transitions with places!")) (defmethod link ((transition transition) (place place) &key &allow-other-keys) (make-instance 'edge :in-net (in-net transition) :from transition :to place)) (defmethod link ((place place) (transition transition) &key &allow-other-keys) (make-instance 'edge :in-net (in-net transition) :from place :to transition)) (defmethod link ((place place-with-tokens) (transition transition) &key (capacity 1) &allow-other-keys) (make-instance 'edge-with-capacity :in-net (in-net transition) :from place :to transition :capacity capacity)) (defmethod link ((transition transition) (place place-with-tokens) &key (capacity 1) &allow-other-keys) (make-instance 'edge-with-capacity :in-net (in-net transition) :from transition :to place :capacity capacity)) ;;; ;;; ;;; (defmethod unlink ((a place-or-transition) (b place-or-transition)) (dolist (outgoing-edge (outgoing-edges a)) (when (eq (to outgoing-edge) b) (remove-from-net outgoing-edge)))) ;;; ;;; ;;; (defmethod remove-from-net ((edge edge)) (setf (outgoing-edges (from edge)) (delete edge (outgoing-edges (from edge)))) (setf (incoming-edges (to edge)) (delete edge (incoming-edges (to edge)))) (setf (edges (in-net edge)) (delete edge (edges (in-net edge)))) (in-net edge)) (defmethod remove-from-net ((place-or-transition place-or-transition)) (dolist (edge (append (outgoing-edges place-or-transition) (incoming-edges place-or-transition))) (remove-from-net edge)) (in-net place-or-transition)) (defmethod remove-from-net :after ((transition transition)) (setf (transitions (in-net transition)) (delete transition (transitions (in-net transition))))) (defmethod remove-from-net :after ((place place)) (setf (places (in-net place)) (delete place (places (in-net place))))) ;;; ;;; ;;; (defmethod may-have-more-tokens-p ((place place-with-tokens)) t) (defmethod may-have-more-tokens-p ((place place-with-capacity)) (< (tokens place) (capacity place))) ;;; ;;; ;;; (defmethod add-tokens ((place place-with-tokens) &optional (tokens 1)) (incf (tokens place) tokens)) (defmethod add-tokens :after ((place place-with-capacity) &optional args) (setf (tokens place) (min (tokens place) (capacity place)))) (defmethod remove-tokens ((place place-with-tokens) &optional (tokens 1)) (unless (zerop (tokens place)) (decf (tokens place) tokens))) ;;; ;;; ;;; (defmethod increase-capacity ((item petri-net-item-with-capacity) &optional (increment 1)) (incf (capacity item) increment)) (defmethod decrease-capacity ((item petri-net-item-with-capacity) &optional (increment 1)) (unless (zerop (1- (capacity item))) (decf (capacity item) increment))) ;;; ;;; ;;; (defmethod activated-p ((transition transition)) (active-p (in-net transition) transition)) (defmethod active-p ((net petri-net) (transition transition)) t) (defmethod active-p ((net token-net) (transition transition)) (and (incoming-edges transition) (every #'(lambda (incoming-edge) (>= (tokens (from incoming-edge)) (capacity incoming-edge))) (incoming-edges transition)) (outgoing-edges transition) (every #'(lambda (outgoing-edge) (or (not (typep (to outgoing-edge) 'place-with-capacity)) (<= (+ (tokens (to outgoing-edge)) (capacity outgoing-edge)) (capacity (to outgoing-edge))))) (outgoing-edges transition)))) ;;; ;;; ;;; (defmethod activate :before ((transition transition)) (unless (activated-p transition) (error "Transition ~A is not active!" transition))) (defmethod activate ((transition transition)) (make-step transition (in-net transition))) ;;; ;;; ;;; (defmethod make-step ((transition transition) (net petri-net)) net) (defmethod make-step ((transition transition) (net token-net)) (dolist (incoming-edge (incoming-edges transition)) (remove-tokens (from incoming-edge) (capacity incoming-edge))) (dolist (outgoing-edge (outgoing-edges transition)) (add-tokens (to outgoing-edge) (capacity outgoing-edge))) net) ;;; ;;; ;;; (defmethod step-net ((net petri-net)) t) (defmethod step-net ((net token-net)) (let ((active-transitions (remove-if-not #'activated-p (transitions net)))) (labels ((one-of (sequence) (elt sequence (random (length sequence))))) (when active-transitions (activate (one-of active-transitions)))))) ;;; ;;; "View" Classes ;;; (defconstant +font+ (make-text-style :sans-serif :bold :very-large)) (defclass display-object () ((color :accessor color :initform +black+))) (defclass positioned-display-object (display-object) ((x :accessor x :initarg :x) (y :accessor y :initarg :y))) (defclass transition-view (positioned-display-object transition) ((color :initform +red+))) (defclass place-view (positioned-display-object place) ((color :initform +blue+))) (defclass place-with-tokens-view (place-view place-with-tokens) ((color :initform +blue+))) (defclass place-with-capacity-view (place-with-tokens-view place-with-capacity) ()) (defclass edge-view (display-object edge) ()) (defclass edge-with-capacity-view (edge-view edge-with-capacity) ()) ;;; ;;; ;;; (defclass petri-net-view (petri-net standard-application-frame) ()) (defclass token-net-view (petri-net-view token-net) ()) ;;; ;;; Solve the "make isn't generic"-problem (kind of "Factory Pattern") ;;; (defmethod make-place ((net petri-net-view) &rest initargs) (apply #'change-class-of-instance (call-next-method) initargs)) (defmethod make-transition ((net petri-net-view) &rest initargs) (apply #'change-class-of-instance (call-next-method) initargs)) (defmethod link :around ((transition transition-view) (place place-view) &rest initargs) (apply #'change-class-of-instance (call-next-method) initargs)) (defmethod link :around ((place place-view) (transition transition-view) &rest initargs) (apply #'change-class-of-instance (call-next-method) initargs)) ;;; ;;; ;;; (defmethod change-class-of-instance ((transition transition) &rest initargs) (apply #'change-class transition 'transition-view initargs)) (defmethod change-class-of-instance ((place place) &rest initargs) (apply #'change-class place 'place-view initargs)) (defmethod change-class-of-instance ((place place-with-tokens) &rest initargs) (apply #'change-class place 'place-with-tokens-view initargs)) (defmethod change-class-of-instance ((place place-with-capacity) &rest initargs) (apply #'change-class place 'place-with-capacity-view initargs)) (defmethod change-class-of-instance ((edge edge) &rest initargs) (apply #'change-class edge 'edge-view initargs)) (defmethod change-class-of-instance ((edge edge-with-capacity) &rest initargs) (apply #'change-class edge 'edge-with-capacity-view initargs)) ;;; ;;; ;;; (defun get-random-net (n m p) (let ((net (make-petri-net))) (change-class net 'petri-net-view) (let ((places (loop as i from 1 to n collect (make-place net))) (transitions (loop as i from 1 to m collect (make-transition net)))) (loop as place in places do (loop as transition in transitions do (when (zerop (random p)) (link place transition))))) net)) ;;; ;;; Define the application frame ;;; Use inheritance to get a petri net editor ;;; (instead of, e.g., using association) ;;; (define-application-frame petri-net-editor (token-net-view) (; (net :accessor net :initform (get-random-net 10 10 3)) (scaling-factor :accessor scaling-factor :initform 1.0)) (:command-table (petri-net-editor :menu (("Commands" :menu command-table)))) (:panes (pointer-documentation-pane (make-clim-stream-pane :type 'pointer-documentation-pane :text-style +font+ :height '(1 :line) :min-height '(1 :line) :max-height '(1 :line))) (command :interactor :text-style +font+) (display :application :height 400 :display-function #'draw :incremental-redisplay t :redisplay-after-commands t :scroll-bars :both) (scaling-factor :application :scroll-bars nil :height '(1 :line) :min-height '(1 :line) :max-height '(1 :line) :text-style +font+ :incremental-redisplay t :display-function #'(lambda (frame stream) (updating-output (stream :unique-id 'scaling-factor :cache-value (scaling-factor frame) :cache-test #'=) (format stream "Current Scaling Factor: ~A" (scaling-factor frame))))) (slider (make-pane 'slider :client 'slider :text-style +font+ :id 'slider :min-value 0.1 :max-value 10 :number-of-tick-marks 10 :value-changed-callback #'(lambda (slider val) (declare (ignore slider)) (with-application-frame (frame) (setf (scaling-factor frame) val) (redisplay-frame-panes frame))))) (quit-button (make-pane 'push-button :label "Quit!" :text-style +font+ :activate-callback #'(lambda (button) (declare (ignore button)) (with-application-frame (frame) (frame-exit frame))))) (refresh-button (make-pane 'push-button :label "Refresh!" :text-style +font+ :activate-callback #'(lambda (button) (declare (ignore button)) (with-application-frame (frame) (setf (scaling-factor frame) 1.0) (redisplay-frame-panes frame :force-p t))))) (step-button (make-pane 'push-button :label "Step!" :text-style +font+ :activate-callback #'(lambda (button) (declare (ignore button)) (with-application-frame (frame) (step-net frame) (redisplay-frame-panes frame)))))) (:layouts (:default (vertically () #+:lispworks display #+:lispworks (horizontally () (1/7 quit-button) (1/7 refresh-button) (1/7 step-button) (4/7 (vertically () (1/2 scaling-factor) (1/2 slider)))) #-:lispworks (500 display) #-:lispworks (90 (horizontally () (1/7 quit-button) (1/7 refresh-button) (1/7 step-button) (4/7 (vertically () (1/2 scaling-factor) (1/2 slider))))) command pointer-documentation-pane)))) ;;; ;;; ;;; (defmethod get-pane-size ((stream stream)) (bounding-rectangle-size (bounding-rectangle (window-viewport stream)))) (defmethod get-relative-coordinates ((frame petri-net-editor) x y) (multiple-value-bind (width height) (get-pane-size (get-frame-pane frame 'display)) (values (/ (/ x width) (scaling-factor frame)) (/ (/ y height) (scaling-factor frame))))) (defmethod get-dimensions ((transition transition-view)) (with-application-frame (frame) (values (/ 0.05 (scaling-factor frame)) (/ 0.03 (scaling-factor frame))))) (defmethod get-dimensions ((place place-view)) (with-application-frame (frame) (values (/ 0.05 (scaling-factor frame))))) ;;; ;;; Draw the editor's content ;;; (defmethod draw ((frame petri-net-editor) stream) (multiple-value-bind (width height) (get-pane-size stream) (with-scaling (stream (scaling-factor frame) (scaling-factor frame) ) (with-scaling (stream width height) (dolist (object (append (places frame) (transitions frame))) (present object (type-of object) :stream stream :view +gadget-view+ :single-box t)) (dolist (edge (edges frame)) (present edge (type-of edge) :stream stream :view +gadget-view+)))))) ;;; ;;; Define the presentation methods ;;; (define-presentation-method present :around (object (type positioned-display-object) stream (view gadget-view) &key) (with-translation (stream (x object) (y object)) (call-next-method))) (define-presentation-method present :around (object (type display-object) stream (view gadget-view) &key) (with-drawing-options (stream :line-thickness 3 :ink (color object) :text-style +font+) (call-next-method))) (define-presentation-method present (place (type place-view) stream (view gadget-view) &key) (with-application-frame (frame) (multiple-value-bind (radius) (get-dimensions place) (updating-output (stream :unique-id place :cache-value (list (scaling-factor frame) (x place) (y place) (color place)) :cache-test #'equal) (draw-circle* stream 0 0 radius :filled nil))))) (define-presentation-method present (place (type place-with-tokens-view) stream (view gadget-view) &key) (with-application-frame (frame) (labels ((deg-to-rad (phi) (* pi (/ phi 180)))) (multiple-value-bind (radius) (get-dimensions place) (updating-output (stream :unique-id place :cache-value (list (scaling-factor frame) (x place) (y place) (color place) (tokens place)) :cache-test #'equal) (draw-circle* stream 0 0 radius :filled nil)) (unless (zerop (tokens place)) (let* ((n (tokens place)) (w (/ 360 n)) (r (* 2/3 radius)) (s (* 1/8 radius))) (loop as a from 1 to n do (draw-circle* stream (* r (sin (deg-to-rad (* a w)))) (* r (cos (deg-to-rad (* a w)))) s :ink +black+)))))))) (define-presentation-type capacity-label-view ()) (define-presentation-method presentation-typep (object (type capacity-label-view)) (typep object 'petri-net-item-with-capacity)) (define-presentation-method present :after (place (type place-with-capacity-view) stream (view gadget-view) &key) (with-application-frame (frame) (multiple-value-bind (radius) (get-dimensions place) (updating-output (stream :unique-id (list place (capacity place)) :id-test #'equal :cache-value (list (scaling-factor frame) (x place) (x place) (color place) (capacity place)) :cache-test #'equal) (with-output-as-presentation (stream place 'capacity-label-view) (draw-text* stream (format nil "~A" (capacity place)) radius radius)))))) (define-presentation-method present (transition (type transition-view) stream (view gadget-view) &key) (with-application-frame (frame) (multiple-value-bind (width height) (get-dimensions transition) (updating-output (stream :unique-id transition :cache-value (list (activated-p transition) (scaling-factor frame) (x transition) (x transition) (color transition)) :cache-test #'equal) (draw-rectangle* stream (- width) (- height) width height :filled (activated-p transition)))))) (define-presentation-method present (edge (type edge-view) stream (view gadget-view) &key) (with-application-frame (frame) (let ((from (from edge)) (to (to edge))) (updating-output (stream :unique-id edge :cache-value (list (scaling-factor frame) (x from) (x to) (y from) (y to) (color edge)) :cache-test #'equal) (draw-arrow* stream (x from) (y from) (x to) (y to) :line-thickness 2 :head-length (/ 0.03 (scaling-factor frame)) :head-width (/ 0.03 (scaling-factor frame))))))) (define-presentation-method present :after (edge (type edge-with-capacity-view) stream (view gadget-view) &key) (with-application-frame (frame) (let ((from (from edge)) (to (to edge))) (updating-output (stream :unique-id (list edge (capacity edge)) :id-test #'equal :cache-value (list (scaling-factor frame) (x from) (x to) (y from) (y to) (color edge) (capacity edge)) :cache-test #'equal) (with-output-as-presentation (stream edge 'capacity-label-view) (draw-text* stream (format nil "~A" (capacity edge)) (/ (+ (x from) (x to)) 2) (/ (+ (y from) (y to)) 2))))))) ;;; ;;; Define some gesture names ;;; (define-gesture-name :new-place :pointer-button :left) (define-gesture-name :new-transition :pointer-button (:left :shift)) (define-gesture-name :delete :pointer-button :left) (define-gesture-name :activate :pointer-button (:right :shift)) (define-gesture-name :move :pointer-button (:control :left)) (define-gesture-name :add-token :pointer-button :middle) (define-gesture-name :remove-token :pointer-button (:middle :shift)) (define-gesture-name :add-capacity-label :pointer-button (:middle :control)) ;;; ;;; Define some editor commands ;;; (define-petri-net-editor-command (com-new-transition :menu nil :name "New Transition") ((x 'integer) (y 'integer)) (with-application-frame (frame) (multiple-value-bind (x y) (get-relative-coordinates frame x y) (make-transition frame :x x :y y)))) (define-petri-net-editor-command (com-new-place :menu nil :name nil) ((x 'integer) (y 'integer)) (with-application-frame (frame) (multiple-value-bind (x y) (get-relative-coordinates frame x y) (make-place frame :x x :y y)))) ;;; ;;; (define-petri-net-editor-command (com-link-place-with-transition :menu nil :name "Link Place with Transition") ((place 'place-view) (transition 'transition-view)) (link place transition)) (define-petri-net-editor-command (com-link-transition-with-place :menu nil :name "Link Transition with Place") ((transition 'transition-view) (place 'place-view)) (link transition place)) ;;; ;;; ;;; (define-petri-net-editor-command (com-unlink-place-and-transition :menu nil :name "Unlink Place and Transition") ((place 'place-view) (transition 'transition-view)) (unlink place transition)) (define-petri-net-editor-command (com-unlink-transition-and-place :menu nil :name "Unlink Transition and Place") ((transition 'transition-view) (place 'place-view)) (unlink transition place)) ;;; ;;; ;;; (define-petri-net-editor-command (com-delete-object :menu nil :name "Delete Object") ((object 'display-object)) (remove-from-net object)) ;;; ;;; ;;; ;;; (define-petri-net-editor-command (com-add-token :menu nil :name "Add Token") ((place-with-tokens `(and place-with-tokens-view (satisfies may-have-more-tokens-p)))) (add-tokens place-with-tokens)) (define-petri-net-editor-command (com-remove-token :menu nil :name "Remove Token") ((place-with-tokens `(and place-with-tokens-view (satisfies ,#'(lambda (place) (not (zerop (tokens place)))))))) (remove-tokens place-with-tokens)) ;;; ;;; ;;; (define-petri-net-editor-command (com-add-capacity-label :menu nil :name "Add Capacity Label") ((place-with-tokens `(and place-with-tokens-view (satisfies ,#'(lambda (object) (not (typep object 'place-with-capacity-view)))))) (capacity 'integer)) (apply #'change-class place-with-tokens 'place-with-capacity-view :capacity capacity nil)) ;;; ;;; ;;; (define-petri-net-editor-command (com-increase-capacity :menu nil :name "Increase Capacity") ((capacity-label 'capacity-label-view)) (increase-capacity capacity-label 1)) (define-petri-net-editor-command (com-decrease-capacity :menu nil :name "Decrease Capacity") ((capacity-label `(and capacity-label-view (satisfies ,#'(lambda (object) (not (zerop (1- (capacity object))))))))) (decrease-capacity capacity-label 1)) ;;; ;;; ;;; (define-petri-net-editor-command (com-activate-transition :menu nil :name "Activate Transition") ((transition 'transition-view)) (activate transition)) ;;; ;;; ;;; (define-petri-net-editor-command (com-move-display-object :menu nil :name "Move Display Object") ((object 'positioned-display-object)) (with-application-frame (frame) (let ((ox (x object)) (oy (y object)) (stream (get-frame-pane frame 'display))) (tracking-pointer (stream) (:pointer-motion (x y) (multiple-value-bind (x y) (get-relative-coordinates frame x y) (setf (x object) x (y object) y) (redisplay-frame-pane frame stream))) (:pointer-button-press (event) (when (= (pointer-event-button event) +pointer-right-button+) (setf (x object) ox (y object) oy)) (return)))))) (define-petri-net-editor-command (com-new-transition-no-arguments :menu nil :name "New Transition") nil (with-application-frame (frame) (let ((stream (get-frame-pane frame 'display))) (multiple-value-bind (x y) (tracking-pointer (stream) (:pointer-button-press (x y event) (when (= (pointer-event-button event) +pointer-left-button+) (return (values x y))))) (com-new-transition x y))))) (define-petri-net-editor-command (com-new-place-no-arguments :menu nil :name "New Place") nil (with-application-frame (frame) (let ((stream (get-frame-pane frame 'display))) (multiple-value-bind (x y) (tracking-pointer (stream) (:pointer-button-press (x y event) (when (= (pointer-event-button event) +pointer-left-button+) (return (values x y))))) (com-new-place x y))))) ;;; ;;; Define some presentation translators ;;; (define-presentation-to-command-translator move-display-object (positioned-display-object com-move-display-object petri-net-editor :gesture :move :documentation ((stream) (format stream "Move This Object")) :echo t :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator delete-object (display-object com-delete-object petri-net-editor :gesture :delete :documentation ((stream) (format stream "Delete This Object")) :echo nil :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator new-transition (blank-area com-new-transition petri-net-editor :gesture :new-transition :documentation ((stream) (format stream "Create New Transition")) :echo nil :maintain-history nil) (x y) (list x y)) (define-presentation-to-command-translator new-place (blank-area com-new-place petri-net-editor :gesture :new-place :documentation ((stream) (format stream "Create New Place")) :echo nil :maintain-history nil) (x y) (list x y)) (define-presentation-to-command-translator add-token (place-with-tokens-view com-add-token petri-net-editor :gesture :add-token :tester ((object) (may-have-more-tokens-p object)) :documentation ((stream) (format stream "Add a Token")) :echo t :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator remove-token (place-with-tokens-view com-remove-token petri-net-editor :gesture :remove-token :tester ((object) (not (zerop (tokens object)))) :documentation ((stream) (format stream "Remove a Token")) :echo t :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator add-capacity-label (place-with-tokens-view com-add-capacity-label petri-net-editor :gesture :add-capacity-label :tester ((object) (not (typep object 'place-with-capacity-view))) :documentation ((stream) (format stream "Add a Capacity Label")) :echo t :maintain-history nil) (object) (list object 4)) (define-presentation-to-command-translator increase-capacity (capacity-label-view com-increase-capacity petri-net-editor :gesture :add-token :documentation ((stream) (format stream "Increase Capacity")) :echo t :maintain-history t) (object) (list object)) (define-presentation-to-command-translator decrease-capacity (capacity-label-view com-decrease-capacity petri-net-editor :gesture :remove-token :tester ((object) (not (zerop (1- (capacity object))))) :documentation ((stream) (format stream "Decrease Capacity")) :echo t :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator activate-transition (transition-view com-activate-transition petri-net-editor :gesture :activate :tester ((object) (activated-p object)) :documentation ((stream) (format stream "Activate Transition")) :echo t :maintain-history nil) (object) (list object)) ;;; ;;; Define the command table ;;; (define-command-table command-table :menu (("New Transition" :command (com-new-transition-no-arguments)) ("New Place" :command (com-new-place-no-arguments)) ("Link Place with Transtion" :command (com-link-place-with-transition)) ("Link Transtion with Place" :command (com-link-transition-with-place)) ("divide1" :divider nil) ("Delete Object" :command (com-delete-object)) ("divide2" :divider nil) ("Add Capacity Label" :command (com-add-capacity-label)) ("Increase Capacity" :command (com-increase-capacity)) ("Decrease Capacity" :command (com-decrease-capacity)) ("divide3" :divider nil) ("Add Token" :command (com-add-token)) ("Remove Toke" :command (com-remove-token)) ("divide4" :divider nil) ("Activate Transition" :command (com-activate-transition)))) ;;; ;;; Run the application ;;; (defun petri () (setf *application-frame* (make-application-frame 'petri-net-editor :width 700 :height 800)) (run-frame-top-level *application-frame*)) (petri)
34,548
Common Lisp
.lisp
824
30.131068
100
0.554971
lambdamikel/PetriNets-CLIM-Demo
9
1
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
61110d093c1ec113ccecacb7229887a85809047b96e46b3d65c4ce5fa39d2aff
11,650
[ -1 ]
11,651
petri3.lisp
lambdamikel_PetriNets-CLIM-Demo/src/old/petri3.lisp
;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: clim-user -*- ;;; ;;; Very simple petri net editor in Common LISP (CLIM/CLOS-Demo) ;;; Lets you create token nets and play with them ;;; Demonstrates some basic CLIM and CLOS programming techniques ;;; (C) 2003 by Michael Wessel ;;; #-:mswindows (error "This version if for LispWorks CLIM Windows only!") #-:lispworks (error "This version if for LispWorks CLIM Windows only!") ;;; ;;; ;;; (require "clim") (in-package clim-user) ;;; ;;; "Model" Classes ;;; (defclass petri-net () ((places :accessor places :initform nil) (transitions :accessor transitions :initform nil) (edges :accessor edges :initform nil))) (defclass token-net (petri-net) ()) ;;; ;;; ;;; (defclass petri-net-item () ((in-net :accessor in-net :initarg :in-net))) (defclass petri-net-item-with-capacity (petri-net-item) ((capacity :accessor capacity :initarg :capacity :initform 1))) (defclass place-or-transition (petri-net-item) ((outgoing-edges :accessor outgoing-edges :initform nil) (incoming-edges :accessor incoming-edges :initform nil))) ;;; ;;; ;;; (defclass transition (place-or-transition) ()) ;;; ;;; ;;; (defclass place (place-or-transition) ()) (defclass place-with-net-tokens (place) ((net-tokens :accessor net-tokens :initarg :net-tokens :initform 0))) (defclass place-with-capacity (place-with-net-tokens petri-net-item-with-capacity) ()) ;;; ;;; ;;; (defclass edge (petri-net-item) ((from :accessor from :initarg :from) (to :accessor to :initarg :to))) (defclass edge-with-capacity (edge petri-net-item-with-capacity) ()) ;;; ;;; ;;; (defun make-petri-net () (make-instance 'petri-net)) (defun make-token-net () (make-instance 'token-net)) ;;; ;;; ;;; (defmethod initialize-instance :after ((transition transition) &rest initargs) (push transition (transitions (in-net transition)))) (defmethod make-transition ((net petri-net) &key &allow-other-keys) (make-instance 'transition :in-net net)) ;;; ;;; ;;; (defmethod initialize-instance :after ((place place) &rest initargs) (push place (places (in-net place)))) (defmethod make-place ((net petri-net) &rest args) (make-instance 'place :in-net net)) (defmethod make-place ((net token-net) &key (net-tokens 0) capacity &allow-other-keys) (if capacity (make-instance 'place-with-capacity :net-tokens net-tokens :capacity capacity :in-net net) (make-instance 'place-with-net-tokens :net-tokens net-tokens :in-net net))) ;;; ;;; ;;; (defmethod initialize-instance :after ((edge edge) &rest initargs) (push edge (outgoing-edges (from edge))) (push edge (incoming-edges (to edge))) (push edge (edges (in-net edge)))) (defmethod link :before ((a place-or-transition) (b place-or-transition) &key &allow-other-keys) (unless (eq (in-net a) (in-net b)) (error "~A and ~A must be in same net!" a b)) (when (some #'(lambda (outgoing-edge) (eq (to outgoing-edge) b)) (outgoing-edges a)) (error "~A and ~A are already linked!" a b))) (defmethod link ((a place-or-transition) (b place-or-transition) &key &allow-other-keys) (error "Can only link places with transitions or transitions with places!")) (defmethod link ((transition transition) (place place) &key &allow-other-keys) (make-instance 'edge :in-net (in-net transition) :from transition :to place)) (defmethod link ((place place) (transition transition) &key &allow-other-keys) (make-instance 'edge :in-net (in-net transition) :from place :to transition)) (defmethod link ((place place-with-net-tokens) (transition transition) &key (capacity 1) &allow-other-keys) (make-instance 'edge-with-capacity :in-net (in-net transition) :from place :to transition :capacity capacity)) (defmethod link ((transition transition) (place place-with-net-tokens) &key (capacity 1) &allow-other-keys) (make-instance 'edge-with-capacity :in-net (in-net transition) :from transition :to place :capacity capacity)) ;;; ;;; ;;; (defmethod unlink ((a place-or-transition) (b place-or-transition)) (dolist (outgoing-edge (outgoing-edges a)) (when (eq (to outgoing-edge) b) (remove-from-net outgoing-edge)))) ;;; ;;; ;;; (defmethod remove-from-net ((edge edge)) (setf (outgoing-edges (from edge)) (delete edge (outgoing-edges (from edge)))) (setf (incoming-edges (to edge)) (delete edge (incoming-edges (to edge)))) (setf (edges (in-net edge)) (delete edge (edges (in-net edge)))) (in-net edge)) (defmethod remove-from-net ((place-or-transition place-or-transition)) (dolist (edge (append (outgoing-edges place-or-transition) (incoming-edges place-or-transition))) (remove-from-net edge)) (in-net place-or-transition)) (defmethod remove-from-net :after ((transition transition)) (setf (transitions (in-net transition)) (delete transition (transitions (in-net transition))))) (defmethod remove-from-net :after ((place place)) (setf (places (in-net place)) (delete place (places (in-net place))))) ;;; ;;; ;;; (defmethod may-have-more-net-tokens-p ((place place-with-net-tokens)) t) (defmethod may-have-more-net-tokens-p ((place place-with-capacity)) (< (net-tokens place) (capacity place))) ;;; ;;; ;;; (defmethod add-net-tokens ((place place-with-net-tokens) &optional (net-tokens 1)) (incf (net-tokens place) net-tokens)) (defmethod add-net-tokens :after ((place place-with-capacity) &optional args) (setf (net-tokens place) (min (net-tokens place) (capacity place)))) (defmethod remove-net-tokens ((place place-with-net-tokens) &optional (net-tokens 1)) (unless (zerop (net-tokens place)) (decf (net-tokens place) net-tokens))) ;;; ;;; ;;; (defmethod increase-capacity ((item petri-net-item-with-capacity) &optional (increment 1)) (incf (capacity item) increment)) (defmethod decrease-capacity ((item petri-net-item-with-capacity) &optional (increment 1)) (unless (zerop (1- (capacity item))) (decf (capacity item) increment))) ;;; ;;; ;;; (defmethod activated-p ((transition transition)) (active-p (in-net transition) transition)) (defmethod active-p ((net petri-net) (transition transition)) t) (defmethod active-p ((net token-net) (transition transition)) (and (incoming-edges transition) (every #'(lambda (incoming-edge) (>= (net-tokens (from incoming-edge)) (capacity incoming-edge))) (incoming-edges transition)) (outgoing-edges transition) (every #'(lambda (outgoing-edge) (or (not (typep (to outgoing-edge) 'place-with-capacity)) (<= (+ (net-tokens (to outgoing-edge)) (capacity outgoing-edge)) (capacity (to outgoing-edge))))) (outgoing-edges transition)))) ;;; ;;; ;;; (defmethod activate :before ((transition transition)) (unless (activated-p transition) (error "Transition ~A is not active!" transition))) (defmethod activate ((transition transition)) (make-step transition (in-net transition))) ;;; ;;; ;;; (defmethod make-step ((transition transition) (net petri-net)) net) (defmethod make-step ((transition transition) (net token-net)) (dolist (incoming-edge (incoming-edges transition)) (remove-net-tokens (from incoming-edge) (capacity incoming-edge))) (dolist (outgoing-edge (outgoing-edges transition)) (add-net-tokens (to outgoing-edge) (capacity outgoing-edge))) net) ;;; ;;; ;;; (defmethod step-net ((net petri-net)) t) (defmethod step-net ((net token-net)) (let ((active-transitions (remove-if-not #'activated-p (transitions net)))) (labels ((one-of (sequence) (elt sequence (random (length sequence))))) (when active-transitions (activate (one-of active-transitions)))))) ;;; ;;; "View" Classes ;;; (defconstant +font+ (make-text-style :sans-serif :bold :small)) (defclass display-object () ((object-color :accessor object-color :initform +black+))) (defclass positioned-display-object (display-object) ((x :accessor x :initarg :x) (y :accessor y :initarg :y))) (defclass transition-view (positioned-display-object transition) ((object-color :initform +red+))) (defclass place-view (positioned-display-object place) ((object-color :initform +blue+))) (defclass place-with-net-tokens-view (place-view place-with-net-tokens) ((object-color :initform +blue+))) (defclass place-with-capacity-view (place-with-net-tokens-view place-with-capacity) ()) (defclass edge-view (display-object edge) ()) (defclass edge-with-capacity-view (edge-view edge-with-capacity) ()) ;;; ;;; ;;; (defclass petri-net-view (petri-net standard-application-frame) ()) (defclass token-net-view (petri-net-view token-net) ()) ;;; ;;; Solve the "make isn't generic"-problem (kind of "Factory Pattern") ;;; (defmethod make-place ((net petri-net-view) &rest initargs) (apply #'change-class-of-instance (call-next-method) initargs)) (defmethod make-transition ((net petri-net-view) &rest initargs) (apply #'change-class-of-instance (call-next-method) initargs)) (defmethod link :around ((transition transition-view) (place place-view) &rest initargs) (apply #'change-class-of-instance (call-next-method) initargs)) (defmethod link :around ((place place-view) (transition transition-view) &rest initargs) (apply #'change-class-of-instance (call-next-method) initargs)) ;;; ;;; ;;; (defmethod change-class-of-instance ((transition transition) &rest initargs) (apply #'change-class transition 'transition-view initargs)) (defmethod change-class-of-instance ((place place) &rest initargs) (apply #'change-class place 'place-view initargs)) (defmethod change-class-of-instance ((place place-with-net-tokens) &rest initargs) (apply #'change-class place 'place-with-net-tokens-view initargs)) (defmethod change-class-of-instance ((place place-with-capacity) &rest initargs) (apply #'change-class place 'place-with-capacity-view initargs)) (defmethod change-class-of-instance ((edge edge) &rest initargs) (apply #'change-class edge 'edge-view initargs)) (defmethod change-class-of-instance ((edge edge-with-capacity) &rest initargs) (apply #'change-class edge 'edge-with-capacity-view initargs)) ;;; ;;; ;;; (defun get-random-net (n m p) (let ((net (make-petri-net))) (change-class net 'petri-net-view) (let ((places (loop as i from 1 to n collect (make-place net))) (transitions (loop as i from 1 to m collect (make-transition net)))) (loop as place in places do (loop as transition in transitions do (when (zerop (random p)) (link place transition))))) net)) ;;; ;;; Define the application frame ;;; Use inheritance to get a petri net editor ;;; (instead of, e.g., using association) ;;; (define-application-frame petri-net-editor (token-net-view) (; (net :accessor net :initform (get-random-net 10 10 3)) (scaling-factor :accessor scaling-factor :initform 1.0)) (:command-table (petri-net-editor :menu (("Commands" :menu command-table)))) (:panes (pointer-documentation-pane (make-clim-stream-pane :type 'pointer-documentation-pane :text-style +font+ :height '(1 :line) :min-height '(1 :line))) (command :interactor :text-style +font+) (display :application :display-function #'draw :incremental-redisplay t :redisplay-after-commands t) (scaling-factor :application :text-style +font+ :scroll-bars nil :incremental-redisplay t :display-function #'(lambda (frame stream) (updating-output (stream :unique-id 'scaling-factor :cache-value (scaling-factor frame) :cache-test #'=) (format stream "Current Scaling Factor: ~A" (scaling-factor frame))))) (slider (make-pane 'slider :text-style +font+ :scroll-bars nil :client 'slider :id 'slider :min-value 0.1 :max-value 10 :number-of-tick-marks 10 :value-changed-callback #'(lambda (slider val) (declare (ignore slider)) (with-application-frame (frame) (setf (scaling-factor frame) val) (redisplay-frame-panes frame))))) (quit-button (make-pane 'push-button :label "Quit!" :text-style +font+ :activate-callback #'(lambda (button) (declare (ignore button)) (with-application-frame (frame) (frame-exit frame))))) (refresh-button (make-pane 'push-button :label "Refresh!" :label "Quit!" :activate-callback #'(lambda (button) (declare (ignore button)) (with-application-frame (frame) (setf (scaling-factor frame) 1.0) (redisplay-frame-panes frame :force-p t))))) (step-button (make-pane 'push-button :label "Step!" :label "Quit!" :activate-callback #'(lambda (button) (declare (ignore button)) (with-application-frame (frame) (step-net frame) (redisplay-frame-panes frame)))))) (:layouts (:default (vertically () (3/4 (vertically () (horizontally () (1/7 quit-button) (1/7 refresh-button) (1/7 step-button)) (horizontally () (1/2 slider) (1/2 scaling-factor)) display)) (1/4 command) pointer-documentation-pane)))) ;;; ;;; ;;; (defmethod get-pane-size ((stream stream)) (bounding-rectangle-size (bounding-rectangle (window-viewport stream)))) (defmethod get-relative-coordinates ((frame petri-net-editor) x y) (multiple-value-bind (width height) (get-pane-size (get-frame-pane frame 'display)) (values (/ (/ x width) (scaling-factor frame)) (/ (/ y height) (scaling-factor frame))))) (defmethod get-dimensions ((transition transition-view)) (with-application-frame (frame) (values (/ 0.05 (scaling-factor frame)) (/ 0.03 (scaling-factor frame))))) (defmethod get-dimensions ((place place-view)) (with-application-frame (frame) (values (/ 0.05 (scaling-factor frame))))) ;;; ;;; Draw the editor's content ;;; (defmethod draw ((frame petri-net-editor) stream) (multiple-value-bind (width height) (get-pane-size stream) (with-scaling (stream (scaling-factor frame) (scaling-factor frame) ) (with-scaling (stream width height) (dolist (object (append (places frame) (transitions frame))) (present object (type-of object) :stream stream :view +gadget-view+ :single-box t)) (dolist (edge (edges frame)) (present edge (type-of edge) :stream stream :view +gadget-view+)))))) ;;; ;;; Define the presentation methods ;;; (define-presentation-method present :around (object (type positioned-display-object) stream (view gadget-view) &key) (with-translation (stream (x object) (y object)) (call-next-method))) (define-presentation-method present :around (object (type display-object) stream (view gadget-view) &key) (with-drawing-options (stream :line-thickness 3 :ink (object-color object) :text-style +font+) (call-next-method))) (define-presentation-method present (place (type place-view) stream (view gadget-view) &key) (with-application-frame (frame) (multiple-value-bind (radius) (get-dimensions place) (updating-output (stream :unique-id place :cache-value (list (scaling-factor frame) (x place) (y place) (object-color place)) :cache-test #'equal) (draw-circle* stream 0 0 radius :filled nil))))) (define-presentation-method present (place (type place-with-net-tokens-view) stream (view gadget-view) &key) (with-application-frame (frame) (labels ((deg-to-rad (phi) (* pi (/ phi 180)))) (multiple-value-bind (radius) (get-dimensions place) (updating-output (stream :unique-id place :cache-value (list (scaling-factor frame) (x place) (y place) (object-color place) (net-tokens place)) :cache-test #'equal) (draw-circle* stream 0 0 radius :filled nil)) (unless (zerop (net-tokens place)) (let* ((n (net-tokens place)) (w (/ 360 n)) (r (* 2/3 radius)) (s (* 1/8 radius))) (loop as a from 1 to n do (draw-circle* stream (* r (sin (deg-to-rad (* a w)))) (* r (cos (deg-to-rad (* a w)))) s :ink +black+)))))))) (define-presentation-type capacity-label-view ()) (define-presentation-method presentation-typep (object (type capacity-label-view)) (typep object 'petri-net-item-with-capacity)) (define-presentation-method present :after (place (type place-with-capacity-view) stream (view gadget-view) &key) (with-application-frame (frame) (multiple-value-bind (radius) (get-dimensions place) (updating-output (stream :unique-id (list place (capacity place)) :id-test #'equal :cache-value (list (scaling-factor frame) (x place) (x place) (object-color place) (capacity place)) :cache-test #'equal) (with-output-as-presentation (stream place 'capacity-label-view) (draw-text* stream (format nil "~A" (capacity place)) radius radius)))))) (define-presentation-method present (transition (type transition-view) stream (view gadget-view) &key) (with-application-frame (frame) (multiple-value-bind (width height) (get-dimensions transition) (updating-output (stream :unique-id transition :cache-value (list (activated-p transition) (scaling-factor frame) (x transition) (x transition) (object-color transition)) :cache-test #'equal) (draw-rectangle* stream (- width) (- height) width height :filled (activated-p transition)))))) (define-presentation-method present (edge (type edge-view) stream (view gadget-view) &key) (with-application-frame (frame) (let ((from (from edge)) (to (to edge))) (updating-output (stream :unique-id edge :cache-value (list (scaling-factor frame) (x from) (x to) (y from) (y to) (object-color edge)) :cache-test #'equal) (draw-arrow* stream (x from) (y from) (x to) (y to) :line-thickness 2 :head-length (/ 0.03 (scaling-factor frame)) :head-width (/ 0.03 (scaling-factor frame))))))) (define-presentation-method present :after (edge (type edge-with-capacity-view) stream (view gadget-view) &key) (with-application-frame (frame) (let ((from (from edge)) (to (to edge))) (updating-output (stream :unique-id (list edge (capacity edge)) :id-test #'equal :cache-value (list (scaling-factor frame) (x from) (x to) (y from) (y to) (object-color edge) (capacity edge)) :cache-test #'equal) (with-output-as-presentation (stream edge 'capacity-label-view) (draw-text* stream (format nil "~A" (capacity edge)) (/ (+ (x from) (x to)) 2) (/ (+ (y from) (y to)) 2))))))) ;;; ;;; Define some gesture names ;;; (define-gesture-name :new-place :pointer-button :left) (define-gesture-name :new-transition :pointer-button (:left :shift)) (define-gesture-name :delete :pointer-button :left) (define-gesture-name :activate :pointer-button (:right :shift)) (define-gesture-name :move :pointer-button (:control :left)) (define-gesture-name :add-token :pointer-button :middle) (define-gesture-name :remove-token :pointer-button (:middle :shift)) (define-gesture-name :add-capacity-label :pointer-button (:middle :control)) ;;; ;;; Define some editor commands ;;; (define-petri-net-editor-command (com-new-transition :menu nil :name "New Transition") ((x 'integer) (y 'integer)) (with-application-frame (frame) (multiple-value-bind (x y) (get-relative-coordinates frame x y) (make-transition frame :x x :y y)))) (define-petri-net-editor-command (com-new-place :menu nil :name nil) ((x 'integer) (y 'integer)) (with-application-frame (frame) (multiple-value-bind (x y) (get-relative-coordinates frame x y) (make-place frame :x x :y y)))) ;;; ;;; (define-petri-net-editor-command (com-link-place-with-transition :menu nil :name "Link Place with Transition") ((place 'place-view) (transition 'transition-view)) (link place transition)) (define-petri-net-editor-command (com-link-transition-with-place :menu nil :name "Link Transition with Place") ((transition 'transition-view) (place 'place-view)) (link transition place)) ;;; ;;; ;;; (define-petri-net-editor-command (com-unlink-place-and-transition :menu nil :name "Unlink Place and Transition") ((place 'place-view) (transition 'transition-view)) (unlink place transition)) (define-petri-net-editor-command (com-unlink-transition-and-place :menu nil :name "Unlink Transition and Place") ((transition 'transition-view) (place 'place-view)) (unlink transition place)) ;;; ;;; ;;; (define-petri-net-editor-command (com-delete-object :menu nil :name "Delete Object") ((object 'display-object)) (remove-from-net object)) ;;; ;;; ;;; ;;; (define-petri-net-editor-command (com-add-token :menu nil :name "Add Token") ((place-with-net-tokens `(and place-with-net-tokens-view (satisfies may-have-more-net-tokens-p)))) (add-net-tokens place-with-net-tokens)) (define-petri-net-editor-command (com-remove-token :menu nil :name "Remove Token") ((place-with-net-tokens `(and place-with-net-tokens-view (satisfies ,#'(lambda (place) (not (zerop (net-tokens place)))))))) (remove-net-tokens place-with-net-tokens)) ;;; ;;; ;;; (define-petri-net-editor-command (com-add-capacity-label :menu nil :name "Add Capacity Label") ((place-with-net-tokens `(and place-with-net-tokens-view (satisfies ,#'(lambda (object) (not (typep object 'place-with-capacity-view)))))) (capacity 'integer)) (apply #'change-class place-with-net-tokens 'place-with-capacity-view :capacity capacity nil)) ;;; ;;; ;;; (define-petri-net-editor-command (com-increase-capacity :menu nil :name "Increase Capacity") ((capacity-label 'capacity-label-view)) (increase-capacity capacity-label 1)) (define-petri-net-editor-command (com-decrease-capacity :menu nil :name "Decrease Capacity") ((capacity-label `(and capacity-label-view (satisfies ,#'(lambda (object) (not (zerop (1- (capacity object))))))))) (decrease-capacity capacity-label 1)) ;;; ;;; ;;; (define-petri-net-editor-command (com-activate-transition :menu nil :name "Activate Transition") ((transition 'transition-view)) (activate transition)) ;;; ;;; ;;; (define-petri-net-editor-command (com-move-display-object :menu nil :name "Move Display Object") ((object 'positioned-display-object)) (with-application-frame (frame) (let ((ox (x object)) (oy (y object)) (stream (get-frame-pane frame 'display))) (tracking-pointer (stream) (:pointer-motion (x y) (multiple-value-bind (x y) (get-relative-coordinates frame x y) (setf (x object) x (y object) y) (redisplay-frame-pane frame stream))) (:pointer-button-press (event) (when (= (pointer-event-button event) +pointer-right-button+) (setf (x object) ox (y object) oy)) (return)))))) (define-petri-net-editor-command (com-new-transition-no-arguments :menu nil :name "New Transition") nil (with-application-frame (frame) (let ((stream (get-frame-pane frame 'display))) (multiple-value-bind (x y) (tracking-pointer (stream) (:pointer-button-press (x y event) (when (= (pointer-event-button event) +pointer-left-button+) (return (values x y))))) (com-new-transition x y))))) (define-petri-net-editor-command (com-new-place-no-arguments :menu nil :name "New Place") nil (with-application-frame (frame) (let ((stream (get-frame-pane frame 'display))) (multiple-value-bind (x y) (tracking-pointer (stream) (:pointer-button-press (x y event) (when (= (pointer-event-button event) +pointer-left-button+) (return (values x y))))) (com-new-place x y))))) ;;; ;;; Define some presentation translators ;;; (define-presentation-to-command-translator move-display-object (positioned-display-object com-move-display-object petri-net-editor :gesture :move :documentation ((stream) (format stream "Move This Object")) :echo t :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator delete-object (display-object com-delete-object petri-net-editor :gesture :delete :documentation ((stream) (format stream "Delete This Object")) :echo nil :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator new-transition (blank-area com-new-transition petri-net-editor :gesture :new-transition :documentation ((stream) (format stream "Create New Transition")) :echo nil :maintain-history nil) (x y) (list x y)) (define-presentation-to-command-translator new-place (blank-area com-new-place petri-net-editor :gesture :new-place :documentation ((stream) (format stream "Create New Place")) :echo nil :maintain-history nil) (x y) (list x y)) (define-presentation-to-command-translator add-token (place-with-net-tokens-view com-add-token petri-net-editor :gesture :add-token :tester ((object) (may-have-more-net-tokens-p object)) :documentation ((stream) (format stream "Add a Token")) :echo t :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator remove-token (place-with-net-tokens-view com-remove-token petri-net-editor :gesture :remove-token :tester ((object) (not (zerop (net-tokens object)))) :documentation ((stream) (format stream "Remove a Token")) :echo t :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator add-capacity-label (place-with-net-tokens-view com-add-capacity-label petri-net-editor :gesture :add-capacity-label :tester ((object) (not (typep object 'place-with-capacity-view))) :documentation ((stream) (format stream "Add a Capacity Label")) :echo t :maintain-history nil) (object) (list object 4)) (define-presentation-to-command-translator increase-capacity (capacity-label-view com-increase-capacity petri-net-editor :gesture :add-token :documentation ((stream) (format stream "Increase Capacity")) :echo t :maintain-history t) (object) (list object)) (define-presentation-to-command-translator decrease-capacity (capacity-label-view com-decrease-capacity petri-net-editor :gesture :remove-token :tester ((object) (not (zerop (1- (capacity object))))) :documentation ((stream) (format stream "Decrease Capacity")) :echo t :maintain-history nil) (object) (list object)) (define-presentation-to-command-translator activate-transition (transition-view com-activate-transition petri-net-editor :gesture :activate :tester ((object) (activated-p object)) :documentation ((stream) (format stream "Activate Transition")) :echo t :maintain-history nil) (object) (list object)) ;;; ;;; Define the command table ;;; (define-command-table command-table :menu (("New Transition" :command (com-new-transition-no-arguments)) ("New Place" :command (com-new-place-no-arguments)) ("Link Place with Transtion" :command (com-link-place-with-transition)) ("Link Transtion with Place" :command (com-link-transition-with-place)) ("divide1" :divider nil) ("Delete Object" :command (com-delete-object)) ("divide2" :divider nil) ("Add Capacity Label" :command (com-add-capacity-label)) ("Increase Capacity" :command (com-increase-capacity)) ("Decrease Capacity" :command (com-decrease-capacity)) ("divide3" :divider nil) ("Add Token" :command (com-add-token)) ("Remove Toke" :command (com-remove-token)) ("divide4" :divider nil) ("Activate Transition" :command (com-activate-transition)))) ;;; ;;; Run the application ;;; (defun petri () (setf *application-frame* (make-application-frame 'petri-net-editor :width 700 :height 700)) (run-frame-top-level *application-frame*)) (petri)
34,573
Common Lisp
.lisp
816
30.644608
100
0.558831
lambdamikel/PetriNets-CLIM-Demo
9
1
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
37e31f25aa9460f9f1503d01c2d3be09c0290f0d99593cb309165bb0ee699b94
11,651
[ -1 ]
11,670
visco-packages.lisp
lambdamikel_VISCO/src/visco-packages.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: CL-USER; Base: 10 -*- (in-package :CL-USER) ;;; ;;; Define Packages ;;; (export '(transform-xy-list tree-reverse tree-remove => <=> intervall-intersects-p circle-intervall-intersects-p lies-in-circle-intervall-p circle-intervall-length rad-to-deg deg-to-rad recode-german-characters zerop-eps =-eps <=-eps >=-eps yes no +2pi+ +pi/2+ defpersistentclass persistent-object load-persistent-object make-object-persistent initialize-loaded-persistent-object circle-subseq mynconc my-format pushend get-lambda-args set-equal set-disjoint)) (defpackage geometry (:use common-lisp-user common-lisp) (:export geom-error infinit polygon chain geom-thing geom-point geom-line geom-chain-or-polygon geom-chain geom-polygon geom-aggregate bounding-box bounding-box-mixin delete-object make-point p make-line l make-polygon poly make-chain chain make-aggregate agg make-bounding-box bb bounding-box-p bound-to id mark-value mark-object x y det det-0-vecs bb-width bb-height p1 p2 centroid p1-of p2-of centroid-of pcenter-of pmin ; BB pmax ; BB pcenter ; BB radius ; BB segments point-list has-parts ; nur fuer Aggregate ! part-of point-=-p point->=-p point-<=-p line-=-p joins-p parallel-p upright-p primary-p ; Primaerobjekt <=> keine Master component-p common-root-p get-all-masters ; fuer alle Objekte ! get-all-components get-direct-components ; fuer alle Objekte ! get-already-present-direct-master ; fuer alle Objekte ! get-topmost-master get-topmost-common-master get-direct-common-master get-direct-common-master-from-list for-each-master-holds-p for-each-component-holds-p for-some-master-holds-p for-some-component-holds-p calculate-bounding-box invalidate-bounding-box calculate-bounding-box-for-complex-object calculate-centroid calculate-intersection-point calculate-intersection-line angle-difference distance-between* distance-between-point-and-line distance-between distance-between-xy length-of-line point-truly-inside-box-p point-truly-inside-box-p* point-truly-outside-box-p point-truly-outside-box-p* box-overlaps-box-p box-overlaps-box-p* enlarged-box-overlaps-box-p box-truly-overlaps-box-p box-truly-overlaps-box-p* box-touches-box-p box-touches-box-p* box-inside-box-p box-inside-box-p* box-truly-inside-box-p box-truly-inside-box-p* line-intersects-box-border-p line-intersects-box-border-p* normalize angle-between angle-between* distance-and-orientation distance-and-orientation* global-orientation make-matrix reset translate scale rotate compose with-matrix with-translation with-scaling with-rotation with-no-matrix-at-all proportional-2-point fixed-sy-2-point lies-on-p lies-on-p* inside-p inside-p* outside-p outside-p* intersects-p crosses-p crosses-p* touches-p 0d-touches-p 1d-touches-p 1d-intersects-p equal-p inside-epsilon-p inside-epsilon-p* calculate-relation inverse get-epsilon-enclosure-relevant-points get-epsilon-enclosure-relevant-points* segment-list-ok-p ; Symbole (werden von calculate-relation geliefert) disjoint lies-on crosses touches 0d-intersects 1d-intersects intersects inside contains covers covered-by overlaps )) (defpackage sqd (:use common-lisp-user common-lisp) (:export read-sqd-file ; vom Client zu implementieren! set-client-bb recognized-os-p transform-sqd-pg transform-sqd-sy transform-sqd-tx transform-sqd-li transform-sqd-sn transform-sqd-bo transform-sqd-fl)) (defpackage objects-with-relations (:use common-lisp-user common-lisp geometry) (:export geom-thing-with-relations geom-point-with-relations geom-line-with-relations geom-chain-or-polygon-with-relations geom-chain-with-relations geom-polygon-with-relations inside intersects intersects-points intersects-lines intersects-chains intersects-polygons contains contains-points contains-lines contains-chains contains-polygons calculate-relations remove-all-relations store-intersection-between store-inside-between delete-intersection-between delete-inside-between)) (defpackage spatial-index (:use common-lisp-user common-lisp geometry) (:export spatial-index si-geom-thing si-geom-point si-geom-line si-geom-chain-or-polygon si-geom-chain si-geom-polygon install-as-current-index make-spatial-index init-spatial-index reset-spatial-index insert-into-spatial-index remove-from-spatial-index elements set-value-for get-value-for in-bucket with-new-level with-selected-buckets with-selected-objects bucket-selected-p candidate-selected-p get-point-from-spatial-index* xmin ymin xmax ymax)) (defpackage si-objects-with-relations (:use common-lisp-user common-lisp geometry objects-with-relations spatial-index) (:export si-geom-thing-with-relations si-geom-point-with-relations si-geom-line-with-relations si-geom-chain-with-relations si-geom-polygon-with-relations calculate-inside-relations)) (defpackage fonts (:use clim clim-lisp) (:export draw-vector-text)) (defpackage database (:use common-lisp-user common-lisp clim clim-lisp geometry spatial-index fonts objects-with-relations si-objects-with-relations sqd) (:shadowing-import-from geometry polygon chain make-point make-line make-polygon) (:shadowing-import-from clim with-translation with-rotation with-scaling interactive-stream-p pathname elements truename) (:shadowing-import-from clim-user write-string write-char write-byte with-open-stream unread-char terpri stream-element-type read-line read-char-no-hang read-char read-byte peek-char listen fresh-line format force-output finish-output close clear-output clear-input streamp output-stream-p open-stream-p input-stream-p) (:export db db-object db-point db-line db-chain db-polygon get-current-db install-as-current-db reset-db load-db store-db make-db-from-sqd-file objects all-os ready lookup-os *os* map-viewer set-current-map-position-and-radius draw-current-map-to-foreign-stream file-selector mcl-pane inverse-highlighter with-centering with-border draw-marker* get-size-of-graphic)) (defpackage query-compiler (:use common-lisp-user common-lisp spatial-index geometry database objects-with-relations) (:export *abort-search* show-search-progress get-expanded-polygon get-shrinked-polygon visco-object query-object-or-enclosure query transparency query-object at-least-1d-query-object point marble nail origin line rubberband atomic-rubberband atomic-<=-rubberband atomic->=-rubberband beam chain-or-polygon chain polygon enclosure derived-enclosure drawn-enclosure inner-enclosure outer-enclosure epsilon-enclosure epsilon-p-enclosure epsilon-m-enclosure disjoint inside contains outside excludes inside-epsilon epsilon-contains intersects angle-between get-next-name sx sy r sxmin symin sxmax symax width height sxsy-constraint sx-type sy-type rot-type asg-inside-p asg-outside-p asg-inside-p* asg-outside-p* 1d-intersects-other-lines-p ignore-disjoint-and-intersects-relations-p make-visco-query make-visco-transparency make-visco-marble make-visco-nail make-visco-origin make-visco-rubberband make-visco-atomic-rubberband make-visco-atomic-<=-rubberband make-visco-atomic->=-rubberband make-visco-beam make-visco-chain make-visco-polygon make-visco-drawn-enclosure make-visco-inner-enclosure make-visco-outer-enclosure make-visco-epsilon-enclosure make-visco-epsilon-p-enclosure make-visco-epsilon-m-enclosure orientation-constraint-mixin at-most-constraint-mixin find-constraint normalize-orientation-constraint orientation-constraint at-most-constraint on-transparency status status-of-line-object-ok-p status-of-point-object-ok-p status-of-chain-or-polygon-object-ok-p semantics constraints org-constraints inside-any-enclosure-p* fully-visible-p negated-p matches-with-database-object-p transparency-query-objects-and-enclosures args 1st-arg 2nd-arg db db-component universe change-status-applicable-p get-dependents possible-operator-result-mixin possible-operator-argument-mixin constraints-mixin arg-of-operators res-of-operators arg-object get-successors-of get-transparencies origin visco-objects opaque-p name get-all-query-objects-and-enclosures show-query-result get-query-semantics compile-query execute-query executable-p invalidate exec-fn ;;; ;;; ;;; not-applicable apply-create-transparency create-transparency-applicable-p apply-create-marble create-marble-applicable-p apply-create-nail create-nail-applicable-p apply-create-origin create-origin-applicable-p apply-create-rubberband create-rubberband-applicable-p apply-create-atomic-rubberband create-atomic-rubberband-applicable-p apply-create-atomic-<=-rubberband create-atomic-<=-rubberband-applicable-p apply-create-atomic->=-rubberband create-atomic->=-rubberband-applicable-p apply-create-beam create-beam-applicable-p apply-create-chain create-chain-applicable-p apply-create-polygon create-polygon-applicable-p apply-create-drawn-enclosure create-drawn-enclosure-applicable-p apply-create-negate-drawn-enclosure create-negate-drawn-enclosure-applicable-p apply-delete-object delete-object-applicable-p apply-create-inner-enclosure create-inner-enclosure-applicable-p apply-create-outer-enclosure create-outer-enclosure-applicable-p apply-create-epsilon-enclosure create-epsilon-enclosure-applicable-p apply-create-epsilon-p-enclosure create-epsilon-p-enclosure-applicable-p apply-create-epsilon-m-enclosure create-epsilon-m-enclosure-applicable-p apply-create-centroid create-centroid-applicable-p apply-create-intersection-point create-intersection-point-applicable-p #| apply-set-status set-status-applicable-p apply-declare-to-marble declare-to-marble-applicable-p apply-declare-to-nail declare-to-nail-applicable-p apply-declare-to-origin declare-to-origin-applicable-p apply-declare-to-rubberband declare-to-rubberband-applicable-p apply-declare-to-atomic-rubberband declare-to-atomic-rubberband-applicable-p apply-declare-to-atomic-<=-rubberband declare-to-atomic-<=-rubberband-applicable-p apply-declare-to-atomic->=-rubberband declare-to-atomic->=-rubberband-applicable-p apply-declare-to-beam declare-to-beam-applicable-p |# apply-set-semantics set-semantics-applicable-p apply-delete-semantics delete-semantics-applicable-p apply-set-at-most-constraint set-at-most-constraint-applicable-p apply-delete-at-most-constraint delete-at-most-constraint-applicable-p apply-set-orientation-constraint set-orientation-constraint-applicable-p apply-delete-orientation-constraint delete-orientation-constraint-applicable-p apply-set-relative-orientation-constraint set-relative-orientation-constraint-applicable-p apply-delete-relative-orientation-constraint delete-relative-orientation-constraint-applicable-p apply-set-transparency-properties set-transparency-properties-applicable-p)) (defpackage gui (:use common-lisp-user common-lisp clim-lisp clim geometry database query-compiler) (:export visco) (:shadowing-import-from query-compiler line point polygon enclosure) (:shadowing-import-from geometry make-point make-line make-polygon) (:shadowing-import-from clim with-translation with-rotation with-scaling interactive-stream-p pathname truename) (:shadowing-import-from clim-user write-string write-char write-byte with-open-stream unread-char terpri stream-element-type read-line read-char-no-hang read-char read-byte peek-char listen fresh-line format force-output finish-output close clear-output clear-input streamp output-stream-p open-stream-p input-stream-p)) (defpackage visco (:use common-lisp-user common-lisp gui database query-compiler))
15,455
Common Lisp
.lisp
632
16.947785
76
0.654944
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
5210cea27da51f7720a991309a3f9c37bfb8ff0eaaf88700c11994d012d79ab9
11,670
[ -1 ]
11,671
ansi-change-class-patch.lisp
lambdamikel_VISCO/src/ansi-change-class-patch.lisp
; -*- Mode: Lisp; Package: CCL; -*- ;; change class takes initargs per ANSI CL ;; this patch incorporates a previous change-class patch ;; 11/19/97 akh (in-package :ccl) (let ((*warn-if-redefine-kernel* nil) (*warn-if-redefine* nil) (*defmethod-congruency-override* t)) #+ppc-target (defun %change-class (object new-class initargs) ; The spec doesn't say whether to run update-instance-for-different-class ; if the class isn't really different. I choose not to. So there. - HMM (unless (and (eq (class-of object) new-class) (null initargs)) ; Try to prevent this from happenning inside of without-interrupts (maybe-update-obsolete-instance object) ; uncomment this as soon as it works. ;; should really check initargs before changing the class ;; update-instance-... will do this too (when initargs (check-initargs t new-class initargs t #'update-instance-for-different-class #'shared-initialize)) (with-managed-allocation (let (copy (instance (%maybe-gf-instance object))) (without-interrupts (maybe-update-obsolete-instance object) ; probably a nop, but you never know. (let* ((forwarded-instance instance) (new-wrapper (or (%class-own-wrapper new-class) (initialize-class-and-wrapper new-class))) (new-slots (%wrapper-instance-slots new-wrapper)) old-slots (old-size (%i- (uvsize instance) 2)) (new-size (uvsize new-slots)) (eql-methods (let ((eql-specializer (list 'eql object))) (declare (dynamic-extent eql-specializer)) (specializer-direct-methods eql-specializer)))) ; Remove any combined-methods for the old class (mapc #'remove-obsoleted-combined-methods eql-methods) ; If it wasn't forwarded, need to copy. This really should be stack-allocated. (when (eq instance (setq copy (%maybe-forwarded-instance instance))) (let ((size (%i+ old-size 2))) (setq copy (%make-temp-uvector size #-ppc-target $v_instance #+ppc-target ppc::subtag-instance)) (dotimes (i size) (declare (fixnum i)) (setf (%svref copy i) (%svref instance i))) (setf (%forwarded-instance copy) copy))) (setq old-slots (%wrapper-instance-slots (%instance-class-wrapper copy))) ; If the new class won't fit, need to forward instance. (if (%i> new-size old-size) (progn (when (typep object 'std-class) (error "Implementation restriction.~%Can't add slots to an instance of ~s" 'std-class)) (setq forwarded-instance (%allocate-instance new-class)) (%forward-instance instance forwarded-instance)) (progn (setf (%instance-class-wrapper instance) new-wrapper (%forwarded-instance instance) instance) ; Make all instance's slots unbound (let ((size (%i+ new-size 2))) (do ((i 2 (%i+ i 1))) ((%i>= i size)) (setf (%svref instance i) (%unbound-marker-8)))))) ; Copy the shared slots (dotimes (i new-size) (declare (fixnum i)) (let* ((slot-name (%svref new-slots i)) (old-index (position slot-name old-slots :test 'eq))) (when old-index (setf (%svref forwarded-instance (%i+ i 2)) (%svref copy (%i+ old-index 2)))))) ; Remove any combined-methods for the new class. (mapc #'remove-obsoleted-combined-methods eql-methods))) ; And let the user & shared-initialize do what they will (if (functionp object) ; was a generic-function (let ((temp-gf *temp-gf*)) (setq *temp-gf* nil) (unwind-protect (progn (let ((gf (or temp-gf (make-gf nil 0)))) (setf (%gf-instance gf) copy) (apply #'update-instance-for-different-class gf object initargs))) (if temp-gf (setq *temp-gf* temp-gf)))) (apply #'update-instance-for-different-class copy object initargs))))) object) #-ppc-target (defun %change-class (object new-class initargs) ; The spec doesn't say whether to run update-instance-for-different-class ; if the class isn't really different. I choose not to. So there. (unless (and (eq (class-of object) new-class) (null initargs)) ; Try to prevent this from happenning inside of without-interrupts (maybe-update-obsolete-instance object) (when initargs (check-initargs t new-class initargs t #'update-instance-for-different-class #'shared-initialize)) ; uncomment this as soon as it works. (with-managed-allocation (let (copy (instance (%maybe-gf-instance object))) (without-interrupts (maybe-update-obsolete-instance object) ; probably a nop, but you never know. (let* ((forwarded-instance instance) (new-wrapper (or (%class-own-wrapper new-class) (initialize-class-and-wrapper new-class))) (new-slots (%wrapper-instance-slots new-wrapper)) old-slots (old-size (%i- (uvsize instance) 1)) (new-size (uvsize new-slots)) (eql-methods (let ((eql-specializer (list 'eql object))) (declare (dynamic-extent eql-specializer)) (specializer-direct-methods eql-specializer)))) ; Remove any combined-methods for the old class (mapc #'remove-obsoleted-combined-methods eql-methods) ; If it wasn't forwarded, need to copy. This really should be stack-allocated. (when (eq instance (setq copy (%maybe-forwarded-instance instance))) (let ((size (%i+ old-size 1))) (setq copy (%make-temp-uvector size $v_instance)) (dotimes (i size) (declare (fixnum i)) (setf (%svref copy i) (%svref instance i))))) (setq old-slots (%wrapper-instance-slots (%instance-class-wrapper copy))) ; If the new class won't fit, need to forward instance. (if (%i> new-size old-size) (progn (when (typep object 'std-class) (error "Implementation restriction.~%Can't add slots to an instance of ~s" 'std-class)) (setq forwarded-instance (%allocate-instance new-class)) (%forward-instance instance forwarded-instance)) (progn (setf (%instance-class-wrapper instance) new-wrapper) ; Make all instance's slots unbound (do ((i 1 (%i+ i 1))) ((%i> i new-size)) (setf (%svref instance i) (%unbound-marker-8))))) ; Copy the shared slots (dotimes (i new-size) (declare (fixnum i)) (let* ((slot-name (%svref new-slots i)) (old-index (position slot-name old-slots :test 'eq))) (when old-index (setf (%svref forwarded-instance (%i+ i 1)) (%svref copy (%i+ old-index 1)))))) ; Remove any combined-methods for the new class. (mapc #'remove-obsoleted-combined-methods eql-methods))) ; And let the user & shared-initialize do what they will (if (functionp object) ; was a generic-function (let ((temp-gf *temp-gf*)) (setq *temp-gf* nil) (unwind-protect (progn (let ((gf (or temp-gf (make-gf nil 0)))) (setf (%gf-instance gf) copy) (apply #'update-instance-for-different-class gf object initargs))) (if temp-gf (setq *temp-gf* temp-gf)))) (apply #'update-instance-for-different-class copy object initargs))))) object) (defmethod change-class ((from structure-class) (to class) &rest initargs &key) (declare (dynamic-extent initargs)) (declare (ignore initargs)) (let ((class-name (class-name from))) (unless (eq from to) ; shouldn't be (remove-structure-defs class-name) (remhash class-name %defstructs%))) (call-next-method)) (defmethod change-class (instance (new-class symbol) &rest initargs &key) (declare (dynamic-extent initargs)) (apply #'change-class instance (find-class new-class) initargs)) (defmethod change-class ((instance standard-object) (new-class standard-class) &rest initargs &key) (declare (dynamic-extent initargs)) (%change-class instance new-class initargs)) (defmethod change-class ((instance standard-object) (new-class funcallable-standard-class) &rest initargs &key) (declare (dynamic-extent initargs)) (%change-class instance new-class initargs)) (defmethod change-class ((instance standard-generic-function) (new-class standard-class) &rest initargs &key) (declare (dynamic-extent initargs)) (unless (inherits-from-standard-generic-function-p new-class) (%badarg new-class 'standard-generic-function)) (unless (or (%gf-instance instance) (eq new-class *standard-generic-function-class*)) (let ((i (allocate-instance new-class))) (shared-initialize i t) (setf (%gf-instance instance) i))) (%change-class instance new-class initargs)) ) (setq *clos-initialization-functions* (append *clos-initialization-functions* (list #'change-class))) #| (defclass foo () ((a :initarg :a))) (defclass fie (foo)((b :initarg :b))) (setq f (make-instance 'foo)) (change-class f 'fie :b 4) |#
9,927
Common Lisp
.lisp
188
41.265957
117
0.593644
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
fe6634d9a820498ce5c7febcdfacd5d86c5599f1d77456ac165c04540b453758
11,671
[ -1 ]
11,672
visco-sysdcl.lisp
lambdamikel_VISCO/src/visco-sysdcl.lisp
(in-package CL-USER) (require "clim") (setf (logical-pathname-translations "visco") '(("spatial-index;*.*" "C:\\Users\\Michael\\Desktop\\Diplomarbeit\\Visco\\si-objects-with-relations\\*.*") ("fonts;*.*" "visco:db;*.*") ("aux;*.*" "visco:aux2;*.*") ("**;*.*" "C:\\Users\\Michael\\Desktop\\Diplomarbeit\\Visco\\**\\*.*"))) (load "visco:define-system.lisp") (push :visco-demo-mode *features*) ;;; (push :antiker-mac *features*) ;;; ;;; Systems ;;; (define-system aux (:default-pathname "visco:aux;") (:serial "aux6.lisp")) (define-system sqd (:default-pathname "visco:sqd;") (:serial "sqd-reader2.lisp" "hex.lisp" "def1.sqd" "def2.sqd" "sqd-transformer.lisp" )) (define-system geometry (:default-pathname "visco:geometry;") (:serial "relatio16.lisp" "tree-structure.lisp" "box-relations.lisp" "interse4.lisp" "inside3.lisp" "epsilon2.lisp" "equal.lisp" "reldef3.lisp")) (define-system objects-with-relations (:default-pathname "visco:objects-with-relations;") (:serial "obj-w-rel5.lisp")) (define-system spatial-index (:default-pathname "visco:spatial-index;") (:serial "spatial-index-macros5.lisp" "spatial-index9.lisp")) (define-system si-objects-with-relations (:default-pathname "visco:si-objects-with-relations;") (:serial "si-obj-w-rel3.lisp")) (define-system database (:default-pathname "visco:db;") (:serial "os2.lisp" "db8.lisp" "fonts.lisp" "gui-aux.lisp" "map-viewer3.lisp")) (define-system query-compiler (:default-pathname "visco:query-compiler;") (:serial "compiler-macros8.lisp" "query-compiler27.lisp" "db-knowledge2.lisp" "compiler-pieces17.lisp" "optimizer10.lisp")) (define-system asg ; "abstract syntax graph" (:default-pathname "visco:asg;") (:serial "constraints4.lisp" "asg17.lisp" "status2.lisp" "ops10.lisp")) (define-system gui (:default-pathname "visco:gui;") (:serial "macros.lisp" "specials.lisp" "classes10.lisp" "constructors5.lisp" "frame9.lisp" "query-result3.lisp" "other-commands2.lisp" "patterns4.lisp" "buttons.lisp" "option-buttons4.lisp" "object-buttons5.lisp" "operators9.lisp" "operator-buttons6.lisp" "status-buttons7.lisp" "control7.lisp" "creators7.lisp" "mover7.lisp" "draw15.lisp")) (define-system visco (:default-pathname "visco:") (:serial #+mcl "clim-mac-settings.lisp" #+mcl "ansi-change-class-patch.lisp" "visco-packages.lisp" aux sqd geometry objects-with-relations spatial-index si-objects-with-relations database asg query-compiler gui)) (compile-system 'visco) (load-system 'visco)
2,837
Common Lisp
.lisp
113
20.628319
89
0.650723
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
240f414c30e28b4e486c63d4b475b8925fad6295e16b22e07630bbe613d84834
11,672
[ -1 ]
11,674
LoadMe.lisp
lambdamikel_VISCO/src/LoadMe.lisp
;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: CL-USER -*- (in-package :cl-user) (let ((current-dir (directory-namestring (truename *loading-file-source-file*)))) (setf (logical-pathname-translations "defsystem") (list (list "**;*.*.*" (full-pathname (concatenate 'string current-dir "defsystem:**:*.*"))))) (compile-file "defsystem:Defsystem") (load "defsystem:Defsystem") (compile-file "defsystem:define-system") (load "defsystem:define-system") (setf (logical-pathname-translations "visco") (list (list "fonts;*.*" (full-pathname (concatenate 'string current-dir "db:*.*"))) (list "spatial-index;*.*" (full-pathname (concatenate 'string current-dir "si-objects-with-relations:*.*"))) (list "maps;*.*" (full-pathname (concatenate 'string current-dir "maps:*.*"))) (list "queries;*.*" (full-pathname (concatenate 'string current-dir "queries:*.*"))) (list "**;*.*" (full-pathname (concatenate 'string current-dir "**:*.*"))) (list "*.*" (full-pathname (concatenate 'string current-dir "*.*")))))) (load "visco:visco-sysdcl") (defsystem:compile-load-system 'visco)
1,958
Common Lisp
.lisp
47
21.723404
68
0.383281
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
2957eed3fbbf67b522ce25dc82bef156bd564ecb4318baf608840f0e3513b121
11,674
[ -1 ]
11,675
clim-mac-settings.lisp
lambdamikel_VISCO/src/clim-mac-settings.lisp
(cl:in-package :mcl-clim) #| (setf *generated-font-family-alist* '((:sans-serif "geneva") (:serif "new times" "york") (:mac-menu "chicago") (:fix "monaco"))) (setf *mac-font-size-alist* '((:tiny 6) (:very-small 7) (:small 8) (:normal 9) (:large 12) (:very-large 18) (:huge 24))) (define-gesture-name :describe :pointer-button (:left :super :meta)) (define-gesture-name :menu :pointer-button (:left :super)) |#
465
Common Lisp
.lisp
15
26.333333
68
0.598655
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
d2ffa1c099a45152e3ec0f7c87f71ced5f7bf5ffc2d024eefab28241564a0a2b
11,675
[ -1 ]
11,676
spatial-index-macros5.lisp
lambdamikel_VISCO/src/si-objects-with-relations/spatial-index-macros5.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: SPATIAL-INDEX; Base: 10 -*- (in-package spatial-index) (defconstant +no-of-levels+ 20) (defparameter *cur-level* -1) (defparameter *level-modes* (make-array +no-of-levels+ :initial-element nil)) (defparameter *level-objects* (make-array +no-of-levels+ :initial-element nil)) ;;; ;;; ;;; (defmacro with-new-level ((level) &body body) `(unwind-protect (progn (when (= *cur-level* (1- +no-of-levels+)) (error "No more levels!")) (incf *cur-level*) (prog1 (let ((,level *cur-level*)) (progn ,@body)))) (decf *cur-level*))) (defmacro with-selected-buckets ((bucket-bind-to obj mode &rest args) &body body) (let ((obj-var (gensym)) (mode-var (gensym)) (result-var (gensym))) `(let ((,obj-var ,obj) (,mode-var ,mode) (,result-var nil)) (multiple-value-bind (ixmin iymin ixmax iymax) (get-range-for-object ,obj-var ,mode-var ,@args) ,(let ((x-var (gensym)) (y-var (gensym))) `(loop for ,x-var from ixmin to ixmax do (loop for ,y-var from iymin to iymax do (let* ((,bucket-bind-to (get-current-bucket ,x-var ,y-var))) (when (bucket-selected-p ,obj-var ,bucket-bind-to ,mode-var ,@args) ; relevanter Bucket ? (setf ,result-var (progn ,@body)))) finally (return ,result-var)) finally (return ,result-var))))))) (defmacro with-selected-objects ((obj-bind-to obj add-test mode &rest args) &body body) (let ((obj-var (gensym)) (mode-var (gensym)) (result-var (gensym))) `(let ((,obj-var ,obj) (,mode-var ,mode) (,result-var nil)) (with-new-level (level) (unwind-protect (with-selected-buckets (cur-bucket ,obj-var ,mode-var ,@args) (dolist (,obj-bind-to (elements cur-bucket) ,result-var) (let ((tested? (get-value-for ,obj-bind-to level))) ; Yes, No, NIL (when (and (not tested?) ,add-test) (if (candidate-selected-p ,obj-var ,obj-bind-to ,mode-var ,@args) (setf ,result-var (progn (set-value-for ,obj-bind-to level 'yes) ,@body)) (set-value-for ,obj-bind-to level 'no)))))) (with-selected-buckets (cur-bucket ,obj-var ,mode-var ,@args) (dolist (element (elements cur-bucket)) (set-value-for element level nil))))))))
2,331
Common Lisp
.lisp
64
31.1875
82
0.618497
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
ceb93ed14e9b1ad048c355c5514e80d96f83c266ff18e235477d5f084c763bc6
11,676
[ -1 ]
11,677
spatial-index9.lisp
lambdamikel_VISCO/src/si-objects-with-relations/spatial-index9.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: SPATIAL-INDEX; Base: 10 -*- (in-package spatial-index) (defgeneric install-as-current-index (obj) (:documentation "Let the spatial index obj be the current index.")) (defgeneric reset-spatial-index (obj) (:documentation "Resets the spatial index obj.")) (defgeneric insert-into-spatial-index (obj) (:documentation "Insert obj into current spatial index.")) (defgeneric remove-from-spatial-index (obj) (:documentation "Remove obj from current spatial index.")) (defgeneric candidate-selected-p (reference-obj candidate mode &key &allow-other-keys) (:documentation "Determine whether a relation << candidate MODE reference-obj >> holds.")) (defgeneric bucket-selected-p (reference-obj bucket mode &key &allow-other-keys) (:documentation "Determine whether the objects of BUCKET are relevant candidates to check whether a << candidate MODE reference-obj >> relation holds.")) (defgeneric get-range-for-object (reference-obj mode &key &allow-other-keys) (:documentation "Returns range of relevant buckets.")) ;;; ;;; ;;; (defparameter *mark-counter* 0) (defparameter *cur-index* nil) (defun get-new-mark-value () (incf *mark-counter*)) ;;; ;;; ;;; (defpersistentclass spatial-index () ((grid :accessor grid :initform (make-array (list 20 20) :initial-element nil) :initarg :grid) (elements :accessor elements :initform nil) (xdiv :accessor xdiv :initarg :xdiv) (ydiv :accessor ydiv :initarg :ydiv) (xmin :accessor xmin :initarg :xmin) (ymin :accessor ymin :initarg :ymin) (xmax :accessor xmax :initarg :xmax) (ymax :accessor ymax :initarg :ymax) (xres :accessor xres :initarg :xres :initform 20) (yres :accessor yres :initarg :yres :initform 20))) ;;; ;;; ACHTUNG: alle si-Klassen sind abstrakt => keine Konstruktoren ;;; (defpersistentclass si-geom-thing (geom-thing) ((level-array :accessor level-array :initform (make-array +no-of-levels+ :initial-element nil) :not-persistent) (in-bucket :accessor in-bucket :initform nil))) (defmethod initialize-loaded-persistent-object ((obj si-geom-thing)) (setf (level-array obj) (make-array +no-of-levels+ :initial-element nil))) (defpersistentclass si-geom-point (si-geom-thing geom-point) ()) (defpersistentclass si-geom-line (si-geom-thing geom-line) ()) (defpersistentclass si-geom-chain-or-polygon (si-geom-thing geom-chain-or-polygon) ()) (defpersistentclass si-geom-polygon (si-geom-chain-or-polygon geom-polygon) ()) (defpersistentclass si-geom-chain (si-geom-chain-or-polygon geom-chain) ()) ;;; ;;; ;;; (defun set-value-for (obj level value) (setf (svref (level-array obj) level) value)) (defun get-value-for (obj level) (svref (level-array obj) level)) ;;; ;;; ;;; (defmethod initialize-instance :after ((obj si-geom-thing) &rest initargs) (declare (ignore initargs)) (insert-into-spatial-index obj)) (defmethod delete-object progn ((obj si-geom-thing) &key) (remove-from-spatial-index obj)) ;;; ;;; ;;; (defpersistentclass bucket () ((bbox :accessor bbox :initarg :bbox) (elements :accessor elements :initarg :elements :initform nil))) ;;; ;;; ;;; (defun make-spatial-index (xmin1 ymin1 xmax1 ymax1) (let ((index (make-instance 'spatial-index))) (with-slots (xdiv ydiv xmin ymin xmax ymax xres yres grid) index (setf xmin xmin1 ymin ymin1 xmax xmax1 ymax ymax1) (setf xdiv (/ (- (1+ xmax1) xmin1) xres) ydiv (/ (- (1+ ymax1) ymin1) yres)) (dotimes (x xres) (dotimes (y yres) (setf (aref grid x y) (make-instance 'bucket :bbox (make-bounding-box (+ xmin (* x xdiv)) (+ ymin (* y ydiv)) (+ xmin (* (1+ x) xdiv)) (+ ymin (* (1+ y) ydiv)))))))) index)) (defun init-spatial-index (xmin ymin xmax ymax) (install-as-current-index (make-spatial-index xmin ymin xmax ymax))) (defmethod install-as-current-index ((obj spatial-index)) (setf *cur-index* obj)) ;;; ;;; ;;; (defmethod reset-spatial-index ((obj spatial-index)) (with-slots (grid xres yres) obj (dotimes (x xres) (dotimes (y yres) (let ((bucket (aref grid x y))) (when bucket (setf (elements bucket) nil))))))) (defmethod get-indizes-for-point* ((obj spatial-index) x y) (with-slots (xmin ymin xdiv ydiv) obj (values (truncate (- x xmin) xdiv) (truncate (- y ymin) ydiv)))) (defmethod get-bucket-for-point* ((obj spatial-index) x y) (multiple-value-call #'(lambda (x y) (when (and (<= 0 x (1- (xres obj))) (<= 0 y (1- (yres obj)))) (aref (grid obj) x y))) (get-indizes-for-point* obj x y))) (defmethod get-elements-at* ((obj spatial-index) x y) (elements (get-bucket-for-point* obj x y))) (defun get-current-bucket (ix iy) (aref (grid *cur-index*) ix iy)) ;;; ;;; ;;; (defmethod insert-into-spatial-index ((obj si-geom-thing)) (push obj (elements *cur-index*)) (with-selected-buckets (cur-bucket obj :intersects) (push obj (elements cur-bucket)) (setf (in-bucket obj) cur-bucket)) (unless (in-bucket obj) (error "No bucket(s) for object ~A!" obj))) ;;; ;;; ;;; (defmethod remove-from-spatial-index ((obj si-geom-thing)) (with-selected-buckets (cur-bucket obj :intersects) (setf (elements cur-bucket) (delete obj (elements cur-bucket)))) (setf (elements *cur-index*) (delete obj (elements *cur-index*)))) ;;; ;;; ----------------------------- ;;; ;;; ;;; Grobeinstellung der zu untersuchenden Buckets: ;;; (defun get-range-for-bb-object (obj &optional (offset 0)) (if (bounding-box-p obj) (let* ((pmin (pmin obj)) (pmax (pmax obj)) (xmin (x pmin)) (ymin (y pmin)) (xmax (x pmax)) (ymax (y pmax))) (multiple-value-bind (ixmin iymin) (get-indizes-for-point* *cur-index* (- xmin offset) (- ymin offset)) (multiple-value-bind (ixmax iymax) (get-indizes-for-point* *cur-index* (+ xmax offset) (+ ymax offset)) (with-slots (xres yres) *cur-index* (values (max 0 ixmin) (max 0 iymin) (min ixmax (1- xres)) (min iymax (1- yres))))))) (error "No bounding box!"))) ;;; ;;; ;;; (defmethod get-range-for-object ((obj si-geom-point) (mode (eql :intersects)) &key) (multiple-value-bind (ix iy) (get-indizes-for-point* *cur-index* (x obj) (y obj)) (values ix iy ix iy))) (defmethod get-range-for-object ((obj si-geom-point) (mode (eql :epsilon)) &key epsilon-r (epsilon-a 1) (epsilon-b 1)) (with-slots (xres yres) *cur-index* (let ((epsilon-r (* epsilon-r (max epsilon-a epsilon-b)))) (multiple-value-bind (ixmin iymin) (get-indizes-for-point* *cur-index* (- (x obj) epsilon-r) (- (y obj) epsilon-r)) (multiple-value-bind (ixmax iymax) (get-indizes-for-point* *cur-index* (+ (x obj) epsilon-r) (+ (y obj) epsilon-r)) (values (max 0 ixmin) (max 0 iymin) (min ixmax (1- xres)) (min iymax (1- yres)))))))) ;;; ;;; ;;; (defmethod get-range-for-object ((obj bounding-box-mixin) (mode (eql :intersects)) &key) (get-range-for-bb-object obj)) (defmethod get-range-for-object ((obj bounding-box-mixin) (mode (eql :inside)) &key) (get-range-for-bb-object obj)) (defmethod get-range-for-object ((obj bounding-box-mixin) (mode (eql :outside)) &key) (with-slots (xres yres) *cur-index* (values 0 0 (1- xres) (1- yres)))) (defmethod get-range-for-object ((obj bounding-box-mixin) (mode (eql :epsilon)) &key epsilon-r (epsilon-a 1) (epsilon-b 1)) (let ((offset (* epsilon-r (max epsilon-a epsilon-b)))) (get-range-for-bb-object obj offset))) ;;; ;;; ----------------------------- ;;; ;;; ;;; Grobtest: Bucket untersuchen ? ;;; (defmethod bucket-selected-p ((obj bounding-box-mixin) (bucket bucket) (mode (eql :inside)) &key) (box-overlaps-box-p obj (bbox bucket))) ;;; ;;; PUNKTE ;;; (defmethod bucket-selected-p ((obj geom-point) (bucket bucket) (mode (eql :intersects)) &key) (eq (get-bucket-for-point* *cur-index* (x obj) (y obj)) bucket)) (defmethod bucket-selected-p ((obj geom-point) (bucket bucket) (mode (eql :epsilon)) &key epsilon-r (epsilon-a 1) (epsilon-b 1)) (or (bucket-selected-p obj bucket :intersects) (let ((radius (radius (bbox bucket))) (center (pcenter (bbox bucket))) (epsilon-r (* epsilon-r (max epsilon-a epsilon-b)))) (<= (distance-between obj center) (+ radius epsilon-r))))) ;;; ;;; LINIEN ;;; (defmethod bucket-selected-p ((obj geom-line) (bucket bucket) (mode (eql :intersects)) &key) (box-overlaps-box-p obj (bbox bucket))) (defmethod bucket-selected-p ((obj geom-line) (bucket bucket) (mode (eql :epsilon)) &key epsilon-r (epsilon-a 1) (epsilon-b 1)) (let ((epsilon-r (* epsilon-r (max epsilon-a epsilon-b)))) (enlarged-box-overlaps-box-p obj (bbox bucket) epsilon-r))) ;;; ;;; KETTEN und POLYGONE ;;; (defmethod bucket-selected-p ((obj geom-chain-or-polygon) (bucket bucket) (mode (eql :intersects)) &key) (some #'(lambda (segment) (bucket-selected-p segment bucket :intersects)) (segments obj))) (defmethod bucket-selected-p ((obj geom-chain-or-polygon) (bucket bucket) (mode (eql :epsilon)) &key epsilon-r (epsilon-a 1) (epsilon-b 1)) (let ((epsilon-r (* epsilon-r (max epsilon-a epsilon-b))) (box (bbox bucket))) (some #'(lambda (segment) (enlarged-box-overlaps-box-p segment box epsilon-r)) (segments obj)))) ;;; ;;; POLYGONE ;;; (defmethod bucket-selected-p ((obj geom-polygon) (bucket bucket) (mode (eql :inside)) &key) (box-overlaps-box-p obj (bbox bucket))) (defmethod bucket-selected-p ((obj geom-polygon) (bucket bucket) (mode (eql :outside)) &key) t) ;;; ;;; ----------------------------- ;;; ;;; ;;; Feintest: Objekt selektiert? ;;; INSIDE f. Bounding Boxes ;;; spez. fuer den Map-Viewer ;;; (defmethod candidate-selected-p ((reference-obj bounding-box) (candidate bounding-box-mixin) (mode (eql :inside)) &key) (box-overlaps-box-p candidate reference-obj)) (defmethod candidate-selected-p ((reference-obj bounding-box) (candidate geom-point) (mode (eql :inside)) &key) (point-truly-inside-box-p candidate reference-obj)) ;;; ;;; INTERSECTS ;;; (defmethod candidate-selected-p ((reference-obj geom-thing) (candidate geom-thing) (mode (eql :intersects)) &key) (intersects-p candidate reference-obj)) ;;; ;;; INSIDE ;;; (defmethod candidate-selected-p ((reference-obj geom-polygon) (candidate geom-thing) (mode (eql :inside)) &key) (inside-p candidate reference-obj)) ;;; ;;; OUTSIDE ;;; (defmethod candidate-selected-p ((reference-obj geom-polygon) (candidate geom-thing) (mode (eql :outside)) &key) (outside-p candidate reference-obj)) ;;; ;;; EPSILON ;;; (defmethod candidate-selected-p ((reference-obj geom-thing) (candidate geom-thing) (mode (eql :epsilon)) &key epsilon-r (epsilon-a 1) (epsilon-b 1)) (inside-epsilon-p candidate reference-obj epsilon-r :epsilon-a epsilon-a :epsilon-b epsilon-b)) ;;; ;;; ----------------------------- ;;; ;;; ;;; Retrieval: ;;; (defun get-point-from-spatial-index* (x y &optional (epsilon 0.0001)) (let ((bucket (get-bucket-for-point* *cur-index* x y))) (when bucket (dolist (obj (elements bucket)) (when (and (typep obj 'si-geom-point) (=-eps x (x obj) epsilon) (=-eps y (y obj) epsilon)) (return-from get-point-from-spatial-index* obj))))))
11,552
Common Lisp
.lisp
332
31.081325
104
0.657336
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
b8c3c9c19b9e1653c993cfea2108cdaedc1f53356f55b3b70bde3699890734e8
11,677
[ -1 ]
11,678
si-obj-w-rel3.lisp
lambdamikel_VISCO/src/si-objects-with-relations/si-obj-w-rel3.lisp
;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: SI-OBJECTS-WITH-RELATIONS; Base: 10 -*- (in-package si-objects-with-relations) ;;; ;;; Instantiierbare Klassen (Konstruktoren existieren): ;;; (defpersistentclass si-geom-thing-with-relations (si-geom-thing geom-thing-with-relations) ()) (defpersistentclass si-geom-point-with-relations (si-geom-thing-with-relations si-geom-point geom-point-with-relations) ()) (defpersistentclass si-geom-line-with-relations (si-geom-thing-with-relations si-geom-line geom-line-with-relations) ()) (defpersistentclass si-geom-chain-with-relations (si-geom-thing-with-relations si-geom-chain geom-chain-with-relations) ()) (defpersistentclass si-geom-polygon-with-relations (si-geom-thing-with-relations si-geom-polygon geom-polygon-with-relations) ()) ;;; ;;; ;;; (defmethod make-point ((class (eql 'si-geom-point-with-relations)) x y &rest initargs) (let ((point (get-point-from-spatial-index* x y))) (or point (apply #'make-instance class :allow-other-keys t :x x :y y initargs)))) (defmethod make-line ((class (eql 'si-geom-line-with-relations)) p1 p2 &rest initargs) (let ((line (get-already-present-direct-master p1 p2))) (or line (apply #'make-instance class :allow-other-keys t :p1 p1 :p2 p2 :class-of-internal-points 'si-geom-point-with-relations initargs)))) (defun polygon-or-chain-constructor (class segment-list &rest initargs) (let ((obj (apply #'get-already-present-direct-master segment-list))) (or obj (apply #'make-instance class :allow-other-keys t :segments segment-list :class-of-internal-points 'si-geom-point-with-relations initargs)))) (defmethod make-chain ((class (eql 'si-geom-chain-with-relations)) segment-list &rest initargs) (apply #'polygon-or-chain-constructor class segment-list initargs)) (defmethod make-polygon ((class (eql 'si-geom-polygon-with-relations)) segment-list &rest initargs) (apply #'polygon-or-chain-constructor class segment-list initargs)) ;;; ;;; ;;; (defmethod calculate-relations ((i si-geom-point-with-relations)) "Wenn ein neuer Punkt eingefuehrt wird => Relationen zu bestehenden Linien berechnen, hochpropagieren!" (with-selected-objects (j i (and (typep j 'si-geom-line-with-relations) (not (component-p i j))) :intersects) (store-intersection-between i j))) (defmethod calculate-relations ((i si-geom-line-with-relations)) "Wenn eine neue Linie eingefuehrt wird => Relationen zu bestehenden Linien berechnen, hochpropagieren!" (let ((new-points nil)) (with-selected-objects (j i (not (or (eq i j) (component-p i j) (component-p j i))) :intersects) (store-intersection-between i j) (when (and (typep j 'si-geom-line-with-relations) (crosses-p i j)) (multiple-value-bind (ix iy) (calculate-intersection-point i j) (when (and ix iy) (push (list ix iy) new-points))))) (dolist (new-point new-points) (make-point 'si-geom-point-with-relations (first new-point) (second new-point))))) ;;; ;;; ;;; (defun calculate-inside-relations (list-of-rel-objects) (dolist (obj list-of-rel-objects) (when (typep obj 'si-geom-polygon-with-relations) (with-selected-objects (cur-obj obj (not (component-p cur-obj obj)) :inside) (store-inside-between cur-obj obj))))) ;;; ;;; ;;; (defun calculate-relations-for-chain-or-polygon (chain-or-polygon) (dolist (segment (segments chain-or-polygon)) ; hochpropagieren: von Segmenten => chain-or-polygon (dolist (intersecting-obj (intersects segment)) (unless (or (eq intersecting-obj chain-or-polygon) (component-p intersecting-obj chain-or-polygon)) (store-intersection-between intersecting-obj chain-or-polygon))))) ;;; ;;; ;;; (defmethod calculate-relations ((i si-geom-chain-with-relations)) (calculate-relations-for-chain-or-polygon i)) (defmethod calculate-relations ((i si-geom-polygon-with-relations)) (calculate-relations-for-chain-or-polygon i))
4,192
Common Lisp
.lisp
111
33.027027
107
0.69634
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
7f6edc4d9b39b12191263a933d095941c80ad68791f11d87436b8b2956696f04
11,678
[ -1 ]
11,679
hex.lisp
lambdamikel_VISCO/src/SQD/hex.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: SQD; Base: 10 -*- (in-package sqd) (defun decode-digit (char) (let ((code (char-code char))) (if (<= 48 code 57) (- code 48) (if (<= 65 code 70) (- code 55) (if (<= 97 code 102) (- code 87) 'error))))) (defun num-to-bin (zahl count &optional (res 0)) (if (zerop zahl) res (let ((mod (mod zahl 2))) (num-to-bin (floor zahl 2) (1- count) (if (zerop mod) res (+ res (expt 2 (- count)))))))) (defun read-hex (string) (when (> (length string) 2) (let ((afterpoint-digits (decode-digit (elt string 1))) (beforepoint-digits (decode-digit (elt string 2))) (negative-p nil) (n (length string))) (unless (or (eq afterpoint-digits 'error) (eq beforepoint-digits 'error)) (when (>= afterpoint-digits 8) (decf afterpoint-digits 8) (setf negative-p t)) (when (= beforepoint-digits 15) ; !!!!! Fehler in den Daten ? (setf beforepoint-digits 2)) (let* ((beforepoint (if (not (zerop beforepoint-digits)) (let ((*read-base* 16)) (read-from-string (subseq string 3 (+ 3 beforepoint-digits)))) 0)) (afterpoint (if (not (zerop afterpoint-digits)) (num-to-bin (let ((*read-base* 16)) (read-from-string (subseq string (+ 3 beforepoint-digits) (min n (+ 3 beforepoint-digits afterpoint-digits))))) (* 4 afterpoint-digits)) 0))) (let ((res (+ beforepoint afterpoint))) (if negative-p (- res) res)))))))
1,664
Common Lisp
.lisp
56
22.803571
72
0.560051
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
714e01e27e3fbaabcece41f72589ff2695824dcf9cd080b9532cfc37bcc77ef8
11,679
[ -1 ]
11,680
sqd-reader2.lisp
lambdamikel_VISCO/src/SQD/sqd-reader2.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: SQD; Base: 10 -*- (in-package sqd) (defparameter *saetze* nil) (defparameter *bloecke* nil) (defmacro datensatz (fn-name &rest rest) (pushnew fn-name *saetze*) (let ((variables nil) (counter 0)) (labels ((code-block (clauses variables) (if (null clauses) t (let ((clause (first clauses)) (dont-register-variable nil)) (when (null clause) (setf clause `( ( ,(intern (format nil "?ANONYMOUS~A" (incf counter)))))) (setf dont-register-variable t)) (unless (<= (length clause) 3) (break "Compilation Error: 1!")) (let ((optional nil)) (when (eq (first clause) 'optional) (setf clause (rest clause)) (setf optional t)) (unless (<= (length clause) 2) (break "Compilation Error!")) (let* ((length (length clause)) (string-pattern (if (and (= length 1) (listp (first clause))) "" (first clause))) (variable-pattern (if (and (= length 1) (listp (first clause))) (first clause) (second clause)))) (when (or (not (stringp string-pattern)) (null string-pattern)) (break "Compilation Error: 2!")) (unless (listp variable-pattern) (break "Compilation Error: 3!")) (let ((variable (first variable-pattern)) (l (length variable-pattern))) (when (not (or (and (= l 1) (= length 1) (listp variable) (not optional)) ; einfache Funktion, keine Variable (and (= l 1) (= length 2) (listp variable)) (and (= l 1) (symbolp variable)) ; einfache variable (and (= l 2) (symbolp variable) (listp (second variable-pattern))) (= l 0))) (terpri) (princ variable-pattern) (princ variable) (break "Compilation Error: 4!")) (cond ( (and (= l 1) (listp variable)) (if (= length 1) (let ((dummy-var (gensym))) `(progn (let ((,dummy-var line)) (declare (ignore ,dummy-var)) ,variable ,(code-block (rest clauses) variables)))) (if (= length 2) (if optional `(let ((lastline line) (line (consume line ,string-pattern))) (if (eq line 'error) (let ((line lastline)) ,(code-block (rest clauses) variables)) (progn ,variable ,(code-block (rest clauses) variables)))) `(let ((line (consume line ,string-pattern))) (when (eq line 'error) (return-from ,fn-name nil)) ,variable ,(code-block (rest clauses) variables)))))) (t (when (and variable (not dont-register-variable)) (when (member variable variables) (break "Error! Double Variable!")) (push variable variables)) (let ((function (or (second variable-pattern) t))) (if optional `(let ((lastline line) (line (consume line ,string-pattern))) (if (eq line 'error) (let ((line lastline)) ,(code-block (rest clauses) (rest variables))) ,@(if variable-pattern `((multiple-value-bind (line ,variable) (assign-variable-value line) (when (eq ,variable 'error) (return-from ,fn-name nil)) (unless ,function (return-from ,fn-name nil)) ,(code-block (rest clauses) variables))) `(,(code-block (rest clauses) variables))))) `(let ((line (consume line ,string-pattern))) (when (eq line 'error) (return-from ,fn-name nil)) ,@(if variable-pattern `((multiple-value-bind (line ,variable) (assign-variable-value line) (when (eq ,variable 'error) (return-from ,fn-name nil)) (unless ,function (return-from ,fn-name nil)) ,(code-block (rest clauses) variables))) `(,(code-block (rest clauses) variables))))))))))))))) `(defun ,fn-name (line) ,(code-block rest variables))))) (defun consume (line string-pattern) (let ((num (position-if-not #'(lambda (i) (char= #\space i)) line))) (unless num (return-from consume 'error)) (let* ((line (subseq line num))) (if (string= string-pattern "") line (let* ((end (position-if #'(lambda (i) (char= #\space i)) line)) (word (subseq line 0 end)) (search (search string-pattern word))) (if (or (not search) (not (zerop search))) 'error (subseq line (length string-pattern)))))))) (defun assign-variable-value (line) (let ((num (position-if #'(lambda (i) (char= #\space i)) line))) (if (and num (zerop num)) 'error (if num (values (subseq line num) (let ((word (subseq line 0 num))) (if (string= word ".") "" word))) (values "" (if (string= line ".") "" line)))))) (defparameter *line-counter* 0) (defun get-line (stream) (let ((line (read-line stream nil 'eof))) (incf *line-counter*) (if (eq line 'eof) 'eof line))) (defmacro datenblock (fn-name &rest rest) (pushnew fn-name *bloecke*) (let ((code nil)) (dolist (clause (reverse rest)) (let ((l (length clause)) (1st (first clause)) (optional nil) (loop nil)) (when (or (> l 3) (= l 0)) (break "Compilation Error: 1!")) (when (eq 1st 'optional) (setf clause (rest clause)) (setf optional t)) (when (eq 1st 'loop) (setf clause (rest clause)) (setf loop t)) (let ((1st (first clause)) (2nd (second clause))) (cond ( (and (= l 1) (listp 1st)) (push 1st code)) (t (if (or (not (symbolp 1st)) (not (symbol-function 1st))) (break "Compilation Error: 2!")) (unless (listp 2nd) (break "Compilation Error: 3!")) (if optional (if 2nd (push `(if (,1st line) ,2nd (setf dont-read-next-line t)) code) (push `(unless (,1st line) (setf dont-read-next-line t)) code)) (if loop (if 2nd (push `(loop (if (,1st line) ,2nd (progn (setf dont-read-next-line t) (return))) (setf line (get-line stream))) code) (push `(loop (unless (,1st line) (setf dont-read-next-line t) (return)) (setf line (get-line stream))) code)) (if 2nd (push `(if (,1st line) ,2nd (return-from ,fn-name 'error)) code) (push `(unless (,1st line) (return-from ,fn-name 'error)) code)))) (push '(setf dont-read-next-line nil) code) (push '(unless dont-read-next-line (setf line (get-line stream))) code)))))) `(defun ,fn-name (stream line) (let ( (dont-read-next-line t)) (progn ,@ code t)))))
7,755
Common Lisp
.lisp
213
24.7277
83
0.493047
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
5bad007605ac9970a793c1fba21c0a6c66bec3a59d0ea6e31a98caa5e6df64d7
11,680
[ -1 ]
11,681
sqd-transformer.lisp
lambdamikel_VISCO/src/SQD/sqd-transformer.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: SQD; Base: 10 -*- (in-package sqd) (defvar *line*) (defvar *obj*) (defvar *erg*) (defun transform (liste) (mapcar #'(lambda (obj) (let ((master (first obj)) (rest (rest obj))) (setf *obj* obj) (construct master (first rest)))) ; ( (master (.....) = rest ) ) liste)) ;;; ;;; Vom benutzenden Modul (Client) muessen die Funktionen ;;; transform-sqd-... ;;; implementiert werden! ;;; Zudem: set-client-bb (xmin,ymin,xmax,ymax) ;;; (defmethod construct ((master null) (rest list)) nil) (defmethod construct ((master pg) (rest list)) (transform-sqd-pg (enum master) (line-no master) (os master) (x master) (y master))) (defmethod construct ((master kr) (rest list)) (transform-sqd-kr (enum master) (line-no master) (os master) (x master) (y master) (r master))) (defmethod construct ((master li) (rest list)) (let ((startpoint (first rest)) (endpoint (second rest))) (transform-sqd-li (enum master) (line-no master) (os master) (construct startpoint nil) (construct endpoint nil)))) (defmethod construct ((master sn) (rest list)) (let ((startpoint (first rest)) (endpoint (second rest))) (transform-sqd-sn (enum master) (line-no master) (os master) (construct startpoint nil) (construct endpoint nil) (points master)))) (defmethod construct ((master bo) (rest list)) (let ((startpoint (first rest)) (endpoint (second rest))) (transform-sqd-bo (enum master) (line-no master) (os master) (x master) (y master) (r master) (w master) (construct startpoint nil) (construct endpoint nil)))) (defmethod construct ((master fl) (rest list)) (transform-sqd-fl (enum master) (line-no master) (os master) (let ((components nil)) (loop (let ((master (first rest)) (params (rest rest))) (cond ((null rest) (return components)) (t (unless (listp master) (push (construct master (first params)) components)) (setf rest (rest rest))))))))) (defmethod construct ((master sy) (rest list)) (transform-sqd-sy (enum master) (line-no master) (os master) (x master) (y master) (nam master))) (defmethod construct ((master tx) (rest list)) (transform-sqd-tx (enum master) (line-no master) (os master) (x master) (y master) (h master) (w master) (txt master))) ;;; ;;; ;;; (defun blank-line (line) (not (position-if-not #'(lambda (i) (char= i #\space)) line))) (defun read-sqd-file (fn) (setf *line-counter* 0) (reset-sqd-bb) (transform (let ((objects nil) (line)) (with-open-file (stream fn :direction :input) (setf line (get-line stream)) (loop (multiple-value-bind (erg line1) (read-rec line 1 stream) (push erg objects) (setf *erg* erg) (if (eq line1 'eof) (return *line-counter*) (setf line line1))))) (set-client-bb *xmin* *ymin* *xmax* *ymax*) (tree-reverse objects)))) (defun read-rec (line letzte-stufe stream) (let ((erg nil)) (loop (loop (when (or (eq line 'eof) (not (or (ds-trennung line) (blank-line line)))) (return)) (setf line (get-line stream))) (when (eq line 'eof) (return-from read-rec (values erg 'eof))) (if (not (ds-kopf line)) (break "Error! Out of Sync!") (let ((stufe *?stu*)) (setf *line* line) (cond ((and (= stufe 1) (= letzte-stufe 1) (not (null erg))) (return-from read-rec (values erg line))) ((= stufe letzte-stufe) (let* ((name (intern *?etyp* "SQD")) (fn (case name ((pg1 pg2) #'db-pg) ((kr1 kr2) #'db-kr) ((li1 li2 li3) #'db-li) ((bo1 bo2) #'db-bo) ((sn1 sn2 sn3) #'db-sn) ((sy1 sy2) #'db-sy) ((tx1 tx2) #'db-tx) ((fl1 fl2) #'db-fl) ((tp1 tp2) #'db-tp) ((pa1 pa2) #'db-pa) (otherwise (break "Error! Unknown Block!"))))) (let ((obj (funcall fn stream line))) (if (not (eq obj 'error)) (progn (push obj erg) (setf line (get-line stream))) (break "Error! Wrong Blockformat!"))))) ((> stufe letzte-stufe) (multiple-value-bind (erg1 line1) (read-rec line stufe stream) (push erg1 erg) (setf line line1) (when (eq line1 'eof) (return-from read-rec (values erg 'eof))))) ((< stufe letzte-stufe) (return-from read-rec (values erg line)))))))))
4,891
Common Lisp
.lisp
171
21.812865
81
0.554508
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
c90048c79260b52150c2ba400a4ce73c4d66e5bb09efab69a69391eaea0e357e
11,681
[ -1 ]
11,682
db-knowledge2.lisp
lambdamikel_VISCO/src/query-compiler/db-knowledge2.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: QUERY-COMPILER; Base: 10 -*- (in-package query-compiler) ;;; ;;; Ab hier ist nun Wissen ueber die Datenstrukturen des Datenbestandes notwendig: welche Objekte sind implizit, welche explizit; ;;; z.B.: gibt es im Datenbestand EXPLIZIT vorhandene (modellierte) Polygone, oder muessen Polygone durch Aggregation gebildet ;;; werden, sind also implizit? ;;; matches-with-database-object-p <=> Objekt kann DIREKT (ohne weitere Unterteilungen etc.) aus der DB instantiiert werden, da ;;; das Objekte explizit im Datenbestand vorliegt! ;;; (defmethod matches-with-database-object-p ((object query-object)) (member (status object) '(db db-component))) ; fuer Punkte und Segmente !!! (defmethod matches-with-database-object-p ((object rubberband)) (eq (status object) 'db)) ; ganze Kettenobjekte (stets primaer) oder (primaere) Linien(segmente). ; DB-C-Rubberbands: Teilketten von Polygonen oder Ketten ; sind nicht explizit im Datenbestand vorhanden, ; sondern muessen zur Suchzeit durch segmentweise Aggregation gebildet werden. (defmethod matches-with-database-object-p ((object chain)) (eq (status object) 'db)) ; echte db-component chains sind nicht in ; der DB als Ketten ausgezeichnet - ; nur ganze Ketten sind in der DB (defmethod matches-with-database-object-p ((object polygon)) (member (status object) '(db db-component))) ; jedes Polygon im Datenbestand ist primaer (es gibt keine Komponentenpolygone); ; in diesem Fall ist DB = DB-C fuer Polygone (da DB => DB-C und Komponentenpolygone ; keine besondere Bedeutung haben wie Komponenten-Ketten) (defmethod matches-with-database-object-p ((object visco-object)) nil) ;;; ;;; stored-relation-p <=> keine aufwendigen geometrischen Berechnung notwendig, ;;; da im Datenmodell explizit vermerkt ;;; (defmethod stored-relation-p ((cs binary-constraint)) (with-slots (1st-arg 2nd-arg) cs (and (matches-with-database-object-p 2nd-arg) (matches-with-database-object-p 1st-arg)))) (defmethod stored-relation-p ((cs intersects)) (call-next-method)) (defmethod stored-relation-p ((cs disjoint)) nil) (defmethod stored-relation-p ((cs angle-between)) nil) (defmethod stored-relation-p ((cs inside)) (and (matches-with-database-object-p (1st-arg cs)) (typecase (2nd-arg cs) ((or inner-enclosure outer-enclosure) (matches-with-database-object-p (arg-object (2nd-arg cs)))) (otherwise nil)))) (defmethod stored-relation-p ((cs contains)) (and (matches-with-database-object-p (2nd-arg cs)) (typecase (1st-arg cs) ((or inner-enclosure outer-enclosure) (matches-with-database-object-p (arg-object (1st-arg cs)))) (otherwise nil))))
2,738
Common Lisp
.lisp
52
49.442308
130
0.739798
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
cb0ee129025b7a908838d58df87e54045722ed7f1d8967113fc5b688d0640a8b
11,682
[ -1 ]
11,683
compiler-pieces17.lisp
lambdamikel_VISCO/src/query-compiler/compiler-pieces17.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: QUERY-COMPILER; Base: 10 -*- (in-package query-compiler) ;;; ;;; ;;; (defun get-check-ticks-code (name-for-angle ticks) (let ((ticks (remove '(nil nil) (remove nil ticks) :test #'equal))) (if ticks `(and (or ,@(mapcar #'(lambda (tick) (if (listp tick) (if (rest (rest tick)) (error "Bad intervall!") (let ((first (first tick)) (second (second tick))) (if first (if second (if (= first second) `(=-eps ,first ,name-for-angle) (if (not (< first second)) (error "Bad intervall!") `(and (<=-eps ,first ,name-for-angle) (<=-eps ,name-for-angle ,second)))) `(<=-eps ,first ,name-for-angle)) (if second `(<=-eps ,name-for-angle ,second))))) `(=-eps ,tick ,name-for-angle))) ticks))) t))) (defun get-check-circle-ticks-code (name-for-angle ticks) (let ((ticks (remove '(nil nil) (remove nil ticks) :test #'equal))) (if ticks `(and (or ,@(mapcar #'(lambda (tick) (if (listp tick) (if (rest (rest tick)) (error "Bad circle intervall!") (let ((first (first tick)) (second (second tick))) (cond ((and first second) (if (= first second) `(=-eps ,name-for-angle ,first) (if (< first second) `(and (<=-eps ,first ,name-for-angle) (<=-eps ,name-for-angle ,second)) `(or ; RICHTIG !!!, nicht AND !!! (>=-eps ,second ,name-for-angle) (>=-eps ,name-for-angle ,first))))) (t (error "Bad circle intervall!"))))) `(=-eps ,name-for-angle ,tick))) ticks))) t))) (defmacro spatial-select-and-bind ((candidate mode present &rest args) &body body) `(with-selected-objects (candidate ,present (and (not (bound-to candidate)) (typep candidate 'db-object)) ,mode ,@args) (with-binding (,candidate candidate) ,@body))) ;;; ;;; ;;; (defproperty is-whole-DB-generator (:generator-T `( (dolist (candidate (objects (get-current-db))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:logic `( (db-object ,candidate) ,@(funcall continuation)))) (defproperty is-primary (:tester-T `( (primary-p candidate) ,@(funcall continuation))) (:logic `( (primary ,candidate) ,@(funcall continuation)))) (defproperty type-is (:tester-T `( ,(typecase candidate (point `(typep candidate 'db-point)) (atomic-rubberband `(typep candidate 'db-line)) (rubberband `(or (typep candidate 'db-line) (typep candidate 'db-chain))) (chain `(typep candidate 'db-chain)) (polygon `(typep candidate 'db-polygon))) ,@(funcall continuation))) (:logic `( ,(typecase candidate (point `(point ,candidate)) (atomic-rubberband `(line ,candidate)) (rubberband `(or (line ,candidate) (chain ,candidate))) (chain `(chain ,candidate)) (polygon `(polygon ,candidate))) ,@(funcall continuation)))) #| (defproperty legal-binding-is (:tester-T `( (legal-binding-p ,candidate candidate) ,@(funcall continuation)))) |# (defproperty relations-exists-is (:additional-slots constraints) (:tester-T (let ((res (remove nil (mapcar #'(lambda (constraint-type) (let ((num (count-if (first constraint-type) (remove-if-not #'stored-relation-p constraints)))) (unless (zerop num) (funcall (second constraint-type) num)))) (list (list #'(lambda (obj) (typep obj 'inside)) #'(lambda (num) `(>= (length (inside candidate)) ,num))) (list #'(lambda (obj) (and (typep obj 'contains) (typep (2nd-arg obj) 'point))) #'(lambda (num) `(>= (length (contains-points candidate)) ,num))) (list #'(lambda (obj) (and (typep obj 'contains) (typep (2nd-arg obj) 'atomic-rubberband))) #'(lambda (num) `(>= (length (contains-lines candidate)) ,num))) (list #'(lambda (obj) (and (typep obj 'contains) (typep (2nd-arg obj) 'rubberband))) #'(lambda (num) `(>= (+ (length (contains-lines candidate)) (length (contains-chains candidate))) ,num))) (list #'(lambda (obj) (and (typep obj 'contains) (typep (2nd-arg obj) 'chain))) #'(lambda (num) `(>= (length (contains-chains candidate)) ,num))) (list #'(lambda (obj) (and (typep obj 'contains) (typep (2nd-arg obj) 'polygon))) #'(lambda (num) `(>= (length (contains-polygons candidate)) ,num))) (list #'(lambda (obj) (and (typep obj 'intersects) (typep (2nd-arg obj) 'point))) #'(lambda (num) `(>= (length (intersects-points candidate)) ,num))) (list #'(lambda (obj) (and (typep obj 'intersects) (typep (2nd-arg obj) 'atomic-rubberband))) #'(lambda (num) `(>= (length (intersects-lines candidate)) ,num))) (list #'(lambda (obj) (and (typep obj 'intersects) (typep (2nd-arg obj) 'rubberband))) #'(lambda (num) `(>= (+ (length (intersects-lines candidate)) (length (intersects-chains candidate))) ,num))) (list #'(lambda (obj) (and (typep obj 'intersects) (typep (2nd-arg obj) 'chain))) #'(lambda (num) `(>= (length (intersects-chains candidate)) ,num))) (list #'(lambda (obj) (and (typep obj 'intersects) (typep (2nd-arg obj) 'polygon))) #'(lambda (num) `(>= (length (intersects-polygons candidate)) ,num)))))))) (when res `( ,@res ,@(funcall continuation)))))) (defproperty semantics-is (:additional-slots keys) (:tester-T `( (with-slots (all-os) candidate (and ,@(mapcar #'(lambda (descriptor) `(member ',descriptor all-os)) keys))) ,@(funcall continuation))) (:logic `( ,@(mapcar #'(lambda (descriptor) `(semantics ,candidate ,descriptor)) keys) ,@(funcall continuation)))) (defproperty at-most-has-segments-is (:additional-slots at-most) (:tester `( (=> (typep candidate 'geom-chain-or-polygon) ; absichern weg. Rubberbands ! (<= (length (segments candidate)) ,at-most)) ,@(funcall continuation))) (:logic `( (=> (or (chain ,candidate) (polygon ,candidate)) (<= (no-of-segments ,candidate) ,at-most)) ,@(funcall continuation)))) (defproperty at-least-has-segments-is ; redundant, aber gut fuer Effizienz! => :logic fehlt (:additional-slots at-least) (:tester-T `( (=> (typep candidate 'geom-chain-or-polygon) ; s.o. (>= (length (segments candidate)) ,at-least)) ,@(funcall continuation)))) ;;; ;;; ;;; (defdependency depends-on ; erzwingt *NUR* Abhaengigkeit: "present" vor "candidate" suchen! nil) ;;; ;;; ;;; (defdependency position-is ; CANDIDATE = Nail, PRESENT = Transparency (:generator-T `( (with-matrix (,(matrix present)) (let ((candidate (get-point-from-spatial-index* (x ,candidate) (y ,candidate)))) (with-binding (,candidate candidate) ,@(funcall continuation)))))) (:generator-NIL `( (with-matrix (,(matrix present)) (let ((candidate (p (x ,candidate) (y ,candidate) :affected-by-matrix-p nil))) (with-binding (,candidate candidate) ,@(funcall continuation)))))) (:tester `( (with-matrix (,(matrix present)) (and (=-eps (slot-value candidate 'x) (x ,candidate)) ; with-matrix wirkt ueber ACCESSORS (=-eps (slot-value candidate 'y) (y ,candidate)))) ,@(funcall continuation))) (:logic `( (= ,candidate ,(get-transformed-object candidate)) ,@(funcall continuation)))) (defdependency position-is-inverse ; CANDIDATE = Transparency (ist bereits instantiiert, TESTER !!!!), PRESENT = Nail (:tester `( (with-matrix (,(matrix candidate)) (and (=-eps (slot-value (bound-to ,present) 'x) (x ,present)) ; with-matrix wirkt ueber ACCESSORS (=-eps (slot-value (bound-to ,present) 'y) (y ,present)))) ,@(funcall continuation))) (:logic `( (= ,present ,(get-transformed-object present)) ,@(funcall continuation)))) ;;; ;;; ;;; (defdependency length-is (:tester `(( ,(typecase candidate (beam '=-eps) (atomic-<=-rubberband '<=-eps) (atomic->=-rubberband '>=-eps)) (with-matrix (,(inverse-matrix present)) (length-of-line ,candidate)) ,(length-of-line candidate)) ,@(funcall continuation))) (:logic `( ( ,(typecase candidate (beam '=-eps) (atomic-<=-rubberband '<=-eps) (atomic->=-rubberband '>=-eps)) (length-of-line ,(get-inverse-transformed-object candidate)) (length-of-line ,(get-const-name candidate))) ,@(funcall continuation)))) (defdependency length-is-inverse (:tester `(( ,(typecase present (beam '=-eps) (atomic-<=-rubberband '<=-eps) (atomic->=-rubberband '>=-eps)) (with-matrix (,(inverse-matrix candidate)) (length-of-line (bound-to ,present))) ,(length-of-line present)) ,@(funcall continuation))) (:logic `( (,(typecase present (beam '=-eps) (atomic-<=-rubberband '<=-eps) (atomic->=-rubberband '>=-eps)) (length-of-line ,(get-inverse-transformed-object present)) (length-of-line ,(get-const-name present))) ,@(funcall continuation)))) ;;; ;;; ;;; (defdependency orientation-is (:additional-slots ticks) (:tester `( (let* ((global-orientation-of-query-element ,(global-orientation candidate)) (global-orientation-of-candidate (with-matrix ( ,(inverse-matrix present) ) (global-orientation candidate))) (angle-difference1 ; die Differenz muss Tick-Wert (bzw. Intervall) entsprechen! (normalize (- global-orientation-of-query-element global-orientation-of-candidate))) (angle-difference2 (normalize (- angle-difference1 pi)))) (or ,(get-check-circle-ticks-code 'angle-difference1 ticks) ,(get-check-circle-ticks-code 'angle-difference2 ticks)) ,@(funcall continuation)))) (:logic `( (exists (orientation) (and (real orientation) (or (= orientation (normalize (- (orientation ,(get-inverse-transformed-object candidate)) (orientation ,(get-const-name candidate))))) (= orientation (normalize (- (orientation ,(get-inverse-transformed-object candidate)) (orientation ,(get-const-name candidate)) pi)))) ,(third (get-check-circle-ticks-code 'orientation ticks)))) ,@(funcall continuation)))) (defdependency orientation-is-inverse (:additional-slots ticks) (:tester `( (let* ((global-orientation-of-query-element ,(global-orientation present)) (global-orientation-of-present (with-matrix ( ,(inverse-matrix candidate) ) (global-orientation (bound-to ,present)))) (angle-difference1 ; die Differenz muss Tick-Wert (bzw. Intervall) entsprechen! (normalize (- global-orientation-of-query-element global-orientation-of-present))) (angle-difference2 (normalize (- angle-difference1 pi)))) (or ,(get-check-circle-ticks-code 'angle-difference1 ticks) ,(get-check-circle-ticks-code 'angle-difference2 ticks)) ,@(funcall continuation)))) (:logic `( (exists (orientation) (and (real orientation) (or (= orientation (normalize (- (orientation ,(get-inverse-transformed-object present)) (orientation ,(get-const-name present))))) (= orientation (normalize (- (orientation ,(get-inverse-transformed-object present)) (orientation ,(get-const-name present)) pi)))) ,(third (get-check-circle-ticks-code 'orientation ticks)))) ,@(funcall continuation)))) ;;; ;;; fuer Segmente X Punkte ;;; (defdependency endpoint-of ; candidate = point, present = Line or Chain (:generator-T->T `( (let ((candidate (p1 (bound-to ,present)))) (with-binding (,candidate candidate) ,@(funcall continuation))) (let ((candidate (p2 (bound-to ,present)))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:tester-T->T `( (or (eq candidate (p1 (bound-to ,present))) (eq candidate (p2 (bound-to ,present)))) ,@(funcall continuation))) (:logic `( (endpoint-of ,candidate ,present) ,@(funcall continuation)))) (defdependency has-endpoint ; candidate = line or chain, present = point (:generator-T->T `( (dolist (candidate (p1-of (bound-to ,present))) (with-binding (,candidate candidate) ,@(funcall continuation))) (dolist (candidate (p2-of (bound-to ,present))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:tester-T->T `( (or (member candidate (p1-of (bound-to ,present))) (member candidate (p2-of (bound-to ,present)))) ,@(funcall continuation))) (:logic `( (has-endpoint ,candidate ,present) ,@(funcall continuation)))) ;;; ;;; fuer Ketten/Polygone X Punkte ;;; (defdependency point-of ; candidate = point, present = Polygon oder Kette (:generator-T->T `( (dolist (candidate (point-list (bound-to ,present))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:tester-T->T `( (member candidate (point-list (bound-to ,present))) ,@(funcall continuation)))) ;;; reine Effizienz-Kante: logic redundant! (defdependency has-point ; candidate = Polygon oder Kette, present = point (:generator-T->T `( (dolist (candidate (part-of (bound-to ,present))) (dolist (candidate (part-of candidate)) (with-binding (,candidate candidate) ,@(funcall continuation)))))) (:tester-T->T `( (member (bound-to ,present) (point-list candidate)) ,@(funcall continuation)))) ;;; ;;; ;;; (defdependency segment-of ; candidate ===segment-of====> present (:generator-T->T `( (dolist (candidate (segments (bound-to ,present))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:tester-T->T `( (member candidate (segments (bound-to ,present))) ,@(funcall continuation))) (:logic `( (segment-of ,candidate ,present) ,@(funcall continuation)))) (defdependency has-segment (:generator-T->T `( (dolist (candidate (part-of (bound-to ,present))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:tester-T->T `( (member (bound-to ,present) (segments candidate)) ,@(funcall continuation))) (:logic `( (has-segment ,candidate ,present) ,@(funcall continuation)))) ;;; ;;; ;;; (defdependency rubberband-of ; master ist Kette o. Polygon (:generator `( (let* ((master (bound-to ,present)) (length (length (segments master)))) (dotimes (chain-length (let ((n (- length ; fuer die anderen Segmente noch was uebriglassen! ,(1- (length (segments present)))))) ,(if (at-most-constraint candidate) `(min n ,(at-most-constraint candidate)) `n))) (dotimes (start-pos length) (let ((segments (circle-subseq (segments master) start-pos (+ 1 start-pos chain-length)))) (unless (some #'(lambda (s) (bound-to s)) segments) (let ((candidate (if (null (rest segments)) (first segments) (progn (dolist (s segments) (setf (bound-to s) ,candidate)) (chain segments :check-p nil :affected-by-matrix-p nil))))) (unwind-protect (with-binding (,candidate candidate) ,@(funcall continuation)) (when (typep candidate 'geom-chain) (delete-object candidate) (dolist (s segments) (setf (bound-to s) nil)))))))))))) (:tester `( ,(etypecase candidate (atomic-rubberband `(member candidate (segments (bound-to ,present)))) (rubberband `(let ((segments (segments (bound-to ,present)))) (if (typep candidate 'geom-chain) (every #'(lambda (s) (member s segments)) (segments candidate)) (member candidate segments))))) ,@(funcall continuation))) (:logic `( (rubberband-of ,candidate ,present) ,@(funcall continuation)))) (defdependency has-rubberband (:generator-T `( (etypecase (bound-to ,present) (geom-line (dolist (candidate (part-of (bound-to ,present))) (with-binding (,candidate candidate) ,@(funcall continuation)))) (geom-chain (dolist (candidate (get-direct-common-master-from-list (segments (bound-to ,present)))) (with-binding (,candidate candidate) ,@(funcall continuation))))) )) (:tester-T `( ,(etypecase present (atomic-rubberband `(member (bound-to present) (segments candidate))) (rubberband `(let ((segments (segments candidate))) (if (typep (bound-to ,present) 'geom-chain) (every #'(lambda (s) (member s segments)) (segments (bound-to ,present))) (member (bound-to present) segments))))) ,@(funcall continuation))) (:logic `( (has-rubberband ,candidate ,present) ,@(funcall continuation)))) ;;; ;;; ;;; (defdependency joins (:generator `( (let ((p1 (p1 (bound-to ,present))) (p2 (p2 (bound-to ,present)))) (dolist (candidate (part-of p1)) (with-binding (,candidate candidate) ,@(funcall continuation))) (dolist (candidate (part-of p2)) (with-binding (,candidate candidate) ,@(funcall continuation)))))) (:tester `( (joins-p ,candidate ,present) ,@(funcall continuation)))) ;;; ;;; ;;; (defdependency inside ; candidate is-inside present; present ist vom Typ Polygon (:generator-T->T `( (dolist (candidate (contains (bound-to ,present))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:generator-T->NIL (if (or (typep present 'drawn-enclosure) (typep present 'transparency)) `( (with-matrix (,(matrix (on-transparency present))) (spatial-select-and-bind (,candidate :inside (bound-to ,present)) ,@(funcall continuation)))) `( (spatial-select-and-bind (,candidate :inside (bound-to ,present)) ,@(funcall continuation))))) (:tester-T->T `( (member candidate (contains (bound-to ,present))) ,@(funcall continuation))) (:tester (if (or (typep present 'drawn-enclosure) (typep present 'transparency)) `( (with-matrix (,(matrix (on-transparency candidate))) (candidate-selected-p (bound-to ,present) candidate :inside)) ,@(funcall continuation)) `( (candidate-selected-p (bound-to ,present) candidate :inside) ,@(funcall continuation)))) (:logic `( ,(if (typep present 'drawn-enclosure) `(inside ,candidate ,(get-transformed-object present)) `(inside ,candidate ,present)) ,@(funcall continuation)))) ; Syntax: candidate "is :inside" (bound-to ,present) !! (defdependency contains ; candidate ist vom Typ Polygon (:generator-T->T `( (dolist (candidate (inside (bound-to ,present))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:tester-T->T `( (member candidate (inside (bound-to ,present))) ,@(funcall continuation))) (:tester (if (or (typep candidate 'drawn-enclosure) (typep candidate 'transparency)) `( (with-matrix (,(matrix (on-transparency candidate))) (candidate-selected-p candidate (bound-to ,present) :inside)) ,@(funcall continuation)) `( (candidate-selected-p candidate (bound-to ,present) :inside) ,@(funcall continuation)))) (:logic `( ,(if (typep candidate 'drawn-enclosure) `(contains ,(get-transformed-object candidate) ,present) `(contains ,candidate ,present)) ,@(funcall continuation)))) (defdependency outside ; present ist vom Typ Polygon (:tester-T->T `( (not (or (member candidate (intersects (bound-to ,present))) (member candidate (contains (bound-to ,present))))) ,@(funcall continuation))) (:tester (if (or (typep present 'drawn-enclosure) (typep present 'transparency)) `( (with-matrix (,(matrix (on-transparency present))) (candidate-selected-p (bound-to ,present) candidate :outside)) ,@(funcall continuation)) `( (candidate-selected-p (bound-to ,present) candidate :outside) ,@(funcall continuation)))) (:logic `( ,(if (typep present 'drawn-enclosure) `(outside ,candidate ,(get-transformed-object present)) `(outside ,candidate ,present)) ,@(funcall continuation)))) (defdependency excludes ; candidate ist vom Typ Polygon (:tester-T->T `( (typep candidate 'geom-polygon) (not (or (member candidate (inside (bound-to ,present))) (member candidate (intersects (bound-to ,present))))) ,@(funcall continuation))) (:tester (if (or (typep candidate 'drawn-enclosure) (typep candidate 'transparency)) `( (with-matrix (,(matrix (on-transparency present))) (candidate-selected-p candidate (bound-to ,present) :outside)) ,@(funcall continuation)) `( (candidate-selected-p candidate (bound-to ,present) :outside) ,@(funcall continuation)))) (:logic `( ,(if (typep candidate 'drawn-enclosure) `(excludes ,(get-transformed-object candidate) ,present) `(excludes ,candidate ,present)) ,@(funcall continuation)))) ;;; ;;; ;;; (defdependency disjoint ; disjoint <=> not(intersects) (:tester-T->T `( (not (or (member candidate (intersects (bound-to ,present))) (component-p candidate (bound-to ,present)) (component-p (bound-to ,present) candidate))) ,@(funcall continuation))) (:tester `( (not (or (candidate-selected-p (bound-to ,present) candidate :intersects) (component-p candidate (bound-to ,present)) (component-p (bound-to ,present) candidate))) ,@(funcall continuation))) (:logic `( (disjoint ,candidate ,present) ,@(funcall continuation)))) ;;; ;;; ;;; (defdependency intersects (:generator-T->T `( (dolist (candidate (intersects (bound-to ,present))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:generator-T->NIL `( (spatial-select-and-bind (,candidate :intersects (bound-to ,present)) ,@(funcall continuation)))) (:tester-T->T `( (member candidate (intersects (bound-to ,present))) ,@(funcall continuation))) (:tester `( (candidate-selected-p (bound-to ,present) candidate :intersects) ,@(funcall continuation))) (:logic `( (intersects ,candidate ,present) ,@(funcall continuation)))) ;;; ;;; ;;; (defdependency has-centroid ; candidate : line or chain or polygon, present : point (:generator-T->T `( (dolist (candidate (centroid-of (bound-to ,present))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:tester-T->T `( (eq candidate (centroid-of (bound-to ,present))) ,@(funcall continuation))) (:logic `( (has-centroid ,candidate ,present) ,@(funcall continuation)))) (defdependency centroid-of (:generator-T->T `( (let ((candidate (centroid (bound-to ,present)))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:generator-T->NIL `( (let ((candidate (let ((c (centroid (bound-to ,present)))) (get-point-from-spatial-index* (x c) (y c))))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:generator-NIL `( (let ((candidate (centroid (bound-to ,present)))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:tester-T->T `( (eq candidate (centroid (bound-to ,present))) ,@(funcall continuation))) (:tester `( (=-eps (slot-value (centroid (bound-to ,present)) 'x) (slot-value candidate 'x)) (=-eps (slot-value (centroid (bound-to ,present)) 'y) (slot-value candidate 'y)) ,@(funcall continuation))) (:logic `( (centroid-of ,candidate ,present) ,@(funcall continuation)))) ;;; ;;; ;;; (defdependency inside-epsilon ; "candidate" ist in der epsilon-Umgebung von "present" enthalten! (:additional-slots radius) (:generator-T `( (spatial-select-and-bind (,candidate :epsilon (bound-to ,present) :epsilon-r ,radius :epsilon-a (epsilon-a ,(on-transparency present)) :epsilon-b (epsilon-b ,(on-transparency present))) ,@(funcall continuation)))) (:tester `( (candidate-selected-p (bound-to ,present) candidate :epsilon :epsilon-r ,radius :epsilon-a (epsilon-a ,(on-transparency present)) :epsilon-b (epsilon-b ,(on-transparency present))) ,@(funcall continuation))) (:logic `( (inside-epsilon ,(get-inverse-transformed-object candidate) ,(get-inverse-transformed-object present)) ,@(funcall continuation)))) (defdependency epsilon-contains ; epsilon-Umgebung von "candidate" enthaelt "present" (:additional-slots radius) (:tester `( (candidate-selected-p (bound-to ,present) candidate :epsilon :epsilon-r ,radius :epsilon-a (epsilon-a ,(on-transparency present)) :epsilon-b (epsilon-b ,(on-transparency present))) ,@(funcall continuation))) (:logic `( (epsilon-contains ,(get-inverse-transformed-object candidate) ,(get-inverse-transformed-object present)) ,@(funcall continuation)))) ;;; ;;; ;;; (defdependency angle-between ; klaeren: "angle-between" lokal oder nicht? (:additional-slots allowed-derivation) (:tester `((let* ((global-orientation-diff-of-query-elements ,(angle-difference (global-orientation present) (global-orientation candidate))) (global-orientation-diff-of-T-elements (with-matrix ( ,(inverse-matrix (on-transparency candidate)) ) (angle-difference (global-orientation (bound-to ,present)) (global-orientation candidate)))) (angle-difference (angle-difference global-orientation-diff-of-query-elements global-orientation-diff-of-T-elements))) (<=-eps angle-difference ,allowed-derivation)) ,@(funcall continuation))) (:logic `( (<= (angle-difference (angle-difference ,(get-const-name candidate) ,(get-const-name present)) (angle-difference ,(get-inverse-transformed-object candidate) ,(get-inverse-transformed-object present))) ,allowed-derivation) ,@(funcall continuation)))) ;;; ;;; ;;; (defmultidependency construct-atomic-rubberband-from-components (:generator-NIL `( (let ((candidate (handler-case (l (bound-to (p1 ,candidate)) (bound-to (p2 ,candidate)) :affected-by-matrix-p nil) (geom-error nil nil) (error (cond) (error cond))))) (when candidate (with-binding (,candidate candidate) ,@(funcall continuation)))))) (:generator-T `( (dolist (candidate (get-direct-common-master (bound-to (p1 ,candidate)) (bound-to (p2 ,candidate)))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:tester `( (or (and (eq (p1 candidate) (bound-to ,(first args))) (eq (p2 candidate) (bound-to ,(second args)))) (and (eq (p2 candidate) (bound-to ,(first args))) (eq (p1 candidate) (bound-to ,(second args))))) ,@(funcall continuation)))) (defmultidependency construct-rubberband-from-components (:generator-NIL ; status(candidate) = db-component oder universe (ecase (status candidate) (db-component `( (dolist (candidate (get-topmost-common-master (bound-to (p1 ,candidate)) (bound-to (p2 ,candidate)))) (typecase candidate (geom-line (with-binding (,candidate candidate) ,@(funcall continuation))) (geom-chain-or-polygon (dolist (segments ; die Segmente sind in der DB!!! (list (get-segments-from-to candidate (bound-to (p1 ,candidate)) (bound-to (p2 ,candidate))) (get-segments-from-to candidate (bound-to (p2 ,candidate)) (bound-to (p1 ,candidate))))) (unless (some #'(lambda (s) (bound-to s)) segments) (let ((candidate (if (null (rest segments)) (first segments) (chain segments :check-p nil :affected-by-matrix-p nil)))) (with-binding (,candidate candidate) (dolist (segment segments) (setf (bound-to segment) candidate)) (unwind-protect (progn ,@(funcall continuation)) (when (typep candidate 'geom-chain) (delete-object candidate)) (dolist (segment segments) (setf (bound-to segment) nil)))))))))))) (universe (error "Not implemented!")))) (:generator-T ; status(candidate) = DB `( (dolist (candidate (get-direct-common-master (bound-to (p1 ,candidate)) (bound-to (p2 ,candidate)))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:tester `( (or (and (eq (p1 candidate) (bound-to ,(first args))) (eq (p2 candidate) (bound-to ,(second args)))) (and (eq (p2 candidate) (bound-to ,(first args))) (eq (p1 candidate) (bound-to ,(second args))))) ,@(funcall continuation)))) (defmultidependency construct-chain-or-polygon-from-components (:generator-NIL `( (let ((candidate (handler-case ( ,(if (typep candidate 'chain) ; Konstruktor-Funktion 'chain 'poly) (append ,@(mapcar #'(lambda (segment) (etypecase segment (atomic-rubberband `(list (bound-to ,segment))) (rubberband `(if (typep (bound-to segment) 'geom-chain) `(segments (bound-to ,segment)) (list (bound-to ,segment)))))) (segments candidate)))) (geom-error nil nil)))) (when candidate (unwind-protect (with-binding (,candidate candidate) ,@(funcall continuation)) (delete-object candidate)))))) (:generator-T `( (dolist (candidate (get-direct-common-master-from-list (nconc ,@(mapcar #'(lambda (segment) (etypecase segment (atomic-rubberband `(list (bound-to ,segment))) (rubberband `(if (typep (bound-to segment) 'geom-chain) `(segments (bound-to ,segment)) (list (bound-to ,segment)))))) (segments candidate))))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (:tester `( ,@(mapcar #'(lambda (segment) (etypecase segment (atomic-rubberband `(member (bound-to ,segment) (segments ,candidate))) (rubberband `(if (typep (bound-to segment) 'geom-chain) `(every #'(lambda (s) (member (bound-to s) (segments ,candidate))) (segments segment)) `(member (bound-to ,segment) (segments ,candidate)))))) (segments candidate)) ,@(funcall continuation))) (:logic `( ,@(mapcar #'(lambda (s) (etypecase s (atomic-rubberband `(has-segment ,candidate ,s)) (rubberband `(has-rubberband ,candidate ,s)))) (segments candidate)) ,@(funcall continuation)))) ;;; ;;; ;;; (defmultidependency construct-intersection-point (:generator-nil `( (let ((first-bound-to (bound-to ,(first args))) (second-bound-to (bound-to ,(second args)))) (etypecase first-bound-to (geom-line (etypecase second-bound-to (geom-line (multiple-value-bind (ix iy) (calculate-intersection-point first-bound-to second-bound-to) (let ((candidate (p ix iy :affected-by-matrix-p nil))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (geom-chain-or-polygon (dolist (segment (segments second-bound-to)) (multiple-value-bind (ix iy) (calculate-intersection-point first-bound-to segment) (let ((candidate (p ix iy :affected-by-matrix-p nil))) (with-binding (,candidate candidate) ,@(funcall continuation)))))))) (geom-chain-or-polygon (etypecase second-bound-to (geom-line (dolist (segment (segments first-bound-to)) (multiple-value-bind (ix iy) (calculate-intersection-point second-bound-to segment) (let ((candidate (p ix iy :affected-by-matrix-p nil))) (with-binding (,candidate candidate) ,@(funcall continuation)))))) (geom-chain-or-polygon (dolist (segment1 (segments first-bound-to)) (dolist (segment2 (segments second-bound-to)) (multiple-value-bind (ix iy) (calculate-intersection-point segment1 segment2) (let ((candidate (p ix iy :affected-by-matrix-p nil))) (with-binding (,candidate candidate) ,@(funcall continuation))))))))))))) (:generator-T `( (let ((first-bound-to (bound-to ,(first args))) (second-bound-to (bound-to ,(second args)))) (etypecase first-bound-to (geom-line (etypecase second-bound-to (geom-line (multiple-value-bind (ix iy) (calculate-intersection-point first-bound-to second-bound-to) (let ((candidate (get-point-from-spatial-index* ix iy))) (with-binding (,candidate candidate) ,@(funcall continuation))))) (geom-chain-or-polygon (dolist (segment (segments second-bound-to)) (multiple-value-bind (ix iy) (calculate-intersection-point first-bound-to segment) (let ((candidate (get-point-from-spatial-index* ix iy))) (with-binding (,candidate candidate) ,@(funcall continuation)))))))) (geom-chain-or-polygon (etypecase second-bound-to (geom-line (dolist (segment (segments first-bound-to)) (multiple-value-bind (ix iy) (calculate-intersection-point second-bound-to segment) (let ((candidate (get-point-from-spatial-index* ix iy))) (with-binding (,candidate candidate) ,@(funcall continuation)))))) (geom-chain-or-polygon (dolist (segment1 (segments first-bound-to)) (dolist (segment2 (segments second-bound-to)) (multiple-value-bind (ix iy) (calculate-intersection-point segment1 segment2) (let ((candidate (get-point-from-spatial-index* ix iy))) (with-binding (,candidate candidate) ,@(funcall continuation))))))))))))) (:logic `( (intersection-point-of ,candidate ,(first args) ,(second args)) ,@(funcall continuation)))) ;;; ;;; ;;; (defmethod get-segments-from-to ((obj geom-chain-or-polygon) (from geom-point) (to geom-point)) (with-slots (point-list) obj (let* ((n (length point-list)) (point-list (append point-list point-list)) (pos1 (position from point-list :test #'point-=-p)) (pos2 (position to point-list :test #'point-=-p))) (when (and pos1 pos2) (when (< pos2 pos1) (incf pos2 n)) (let ((pos2 (1+ pos2))) (if (and (= pos1 0) (= pos2 (length point-list))) (butlast (segments obj)) (let* ((points (subseq point-list pos1 pos2)) (segments (mapcar #'(lambda (p1 p2) (first (intersection (append (p1-of p1) (p2-of p1)) (append (p1-of p2) (p2-of p2))))) points (rest points)))) segments)))))))
35,455
Common Lisp
.lisp
926
31.855292
117
0.621772
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
2e5978b00b02639a116f631b0e152c7e702ecaba0ca15907895dcffca2593a04
11,683
[ -1 ]
11,684
optimizer10.lisp
lambdamikel_VISCO/src/query-compiler/optimizer10.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: QUERY-COMPILER; Base: 10 -*- (in-package query-compiler) ;;; ;;; ;;; (defun get-sorted-and-activated-ccs-no-generator-required (obj) (remove-if #'(lambda (cc) (or (not (activated-p cc)) (ignored-p cc))) (sorted-testers obj))) (defmethod get-sorted-and-activated-ccs ((obj enclosure)) (get-sorted-and-activated-ccs-no-generator-required obj)) (defmethod get-sorted-and-activated-ccs ((obj transparency)) (get-sorted-and-activated-ccs-no-generator-required obj)) (defmethod get-sorted-and-activated-ccs ((obj visco-object)) (let ((generator (find-if #'(lambda (cc) (and (activated-p cc) (not (ignored-p cc)))) ; evtl. ist ein ignorierter Generator dennoch sehr gut ?! (sorted-generators obj)))) (cons generator (remove-if #'(lambda (cc) (or (eq cc generator) (ignored-p cc) (not (activated-p cc)))) (sorted-testers obj))))) ;;; ;;; ;;; (defun get-object-rank-no-generator-required (obj) (loop as cc in (sorted-testers obj) when (and (activated-p cc) (not (ignored-p cc))) sum (tester-rank cc))) (defmethod get-object-rank ((obj enclosure)) (get-object-rank-no-generator-required obj)) (defmethod get-object-rank ((obj transparency)) (get-object-rank-no-generator-required obj)) (defmethod get-object-rank ((obj visco-object)) (let ((generator (find-if #'activated-p (sorted-generators obj)))) (* (1+ (generator-rank generator)) (loop as cc in (sorted-testers obj) when (and (not (eq cc generator)) (activated-p cc) (not (ignored-p cc))) sum (tester-rank cc))))) ;;; ;;; ;;; (defmethod compare-nodes ((node1 visco-object) (node2 visco-object)) (typecase node1 (transparency t) (enclosure (activated-p (on-transparency node1))) (otherwise (typecase node2 (transparency nil) (enclosure (not (activated-p (on-transparency node2)))) (otherwise (> (get-object-rank node1) ; echte Kosten (get-object-rank node2))))))) ;;; ;;; ;;; (defun finalize-and-install-plan (plan) (dolist (obj plan) (setf (activated-and-sorted-compiler-conditions obj) (get-sorted-and-activated-ccs obj)) (activate obj)) (deactivate-all (reverse plan)) plan) (defun determine-best-plan (plans) (finalize-and-install-plan (get-best plans))) (defun get-best (plans) (let ((max-rank nil) (max-plan nil)) (dolist (plan plans max-plan) (let ((rank (get-plan-rank plan))) (when (or (not max-rank) (> rank max-rank)) (setf max-rank rank max-plan plan)))))) (defun get-plan-rank (plan) (let ((count 0)) (prog1 (loop as obj in plan sum (float (* (get-object-rank obj) (exp count))) do (progn (decf count) (activate obj))) (deactivate-all (reverse plan))))) ;;; ;;; ;;; (defconstant +generator-hash-pos+ (let ((ht (make-hash-table)) (order '(cc-construct-chain-or-polygon-from-components cc-construct-atomic-rubberband-from-components cc-construct-rubberband-from-components cc-construct-intersection-point cc-has-centroid cc-centroid-of cc-endpoint-of cc-has-endpoint cc-joins cc-position-is cc-segment-of cc-has-segment cc-point-of cc-has-point cc-rubberband-of cc-has-rubberband cc-intersects cc-inside cc-contains cc-inside-epsilon))) (dolist (g order) (setf (gethash g ht) (position g order))) ht)) (defmethod generator-is-better-than-p ((cc1 compiler-condition) (cc2 compiler-condition)) (let ((pos1 (or (gethash (type-of cc1) +generator-hash-pos+) 1000)) (pos2 (or (gethash (type-of cc2) +generator-hash-pos+) 1000))) (if (= pos1 pos2) (compare-equal-generators cc1 cc2) (< pos1 pos2)))) (defmethod compare-equal-generators ((cc1 compiler-condition) (cc2 compiler-condition)) nil) ;;; ;;; ;;; (defconstant +tester-hash-pos+ (let ((ht (make-hash-table)) (order '(cc-type-is cc-is-primary cc-position-is cc-position-is-inverse cc-semantics-is cc-length-is cc-length-is-inverse cc-orientation-is cc-orientation-is-inverse cc-angle-between cc-has-centroid cc-centroid-of cc-endpoint-of cc-has-endpoint cc-joins cc-point-of cc-has-point cc-segment-of cc-has-segment cc-construct-atomic-rubberband-from-components cc-at-most-has-segments-is cc-at-least-has-segments-is cc-rubberband-of cc-has-rubberband cc-construct-rubberband-from-components cc-construct-chain-or-polygon-from-components cc-intersects cc-disjoint cc-inside cc-contains cc-outside cc-excludes cc-inside-epsilon cc-epsilon-contains #| cc-relations-exists-is |#))) (dolist (g order) (setf (gethash g ht) (position g order))) ht)) (defmethod tester-is-better-than-p ((cc1 compiler-condition) (cc2 compiler-condition)) (let ((pos1 (or (gethash (type-of cc1) +tester-hash-pos+) 1000)) (pos2 (or (gethash (type-of cc2) +tester-hash-pos+) 1000))) (if (= pos1 pos2) (compare-equal-testers cc1 cc2) (< pos1 pos2)))) (defmethod compare-equal-testers ((cc1 compiler-condition) (cc2 compiler-condition)) nil) (defmethod compare-equal-testers ((cc1 cc-type-is) (cc2 cc-type-is)) (let ((c1 (candidate cc1)) (c2 (candidate cc2))) (typecase c1 (chain-or-polygon t) (line (or (typep c2 'point) (typep c2 'rubberband))) (point (not (typep c2 'rubberband))) (rubberband nil))))
5,631
Common Lisp
.lisp
188
25.260638
89
0.658973
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
c28b023f7c13e9a2f62a5b893c347495dc1df59d4e6149797f8173fee695b303
11,684
[ -1 ]
11,685
compiler-macros8.lisp
lambdamikel_VISCO/src/query-compiler/compiler-macros8.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: QUERY-COMPILER; Base: 10 -*- (in-package query-compiler) ;;; ;;; ;;; (defmacro with-binding ((qo dbo) &body body) (let ((qo-gensym (gensym)) ; evaluate a and b only once! (db-gensym (gensym))) `(let* ((,qo-gensym ,qo) (,db-gensym ,dbo)) (when ,db-gensym (unless (bound-to ,db-gensym) (setf (bound-to ,qo-gensym) ,db-gensym) (setf (bound-to ,db-gensym) ,qo-gensym) (unwind-protect (progn ,@body) (setf (bound-to ,db-gensym) nil))))))) ;;; ;;; ;;; (defun get-code-for-class-and-constructor (name superclasses all-slots additional-slots) (let ((class-name (intern (format nil "CC-~A" name))) (constructor-name (intern (format nil "MAKE-~A" name)))) `( (defpersistentclass ,class-name ,superclasses ,(mapcar #'(lambda (name) (list name :accessor name :initarg (intern (format nil "~A" name) (find-package 'keyword)))) additional-slots)) (defun ,constructor-name ( ,@all-slots &rest initargs) (apply #'make-instance ',class-name ,@(mapcan #'(lambda (slot) (list (intern (format nil "~A" slot) (find-package 'keyword)) slot)) all-slots) initargs))))) (defun get-code-for-method-definitions (class-name all-slots method-definitions) (let ((class-name (intern (format nil "CC-~A" class-name)))) (remove nil (mapcan #'(lambda (line) (let* ((name (first line)) (cond (second line)) (pos (position :not-before (third line))) (code (if pos (subseq (third line) 0 pos) (third line))) (precond (when pos (subseq (third line) (1+ pos))))) (when code (cons `(defmethod ,(intern (format nil "GET-~A-CODE" name)) ((self ,class-name) continuation &key (check t)) ,@(unless cond `((declare (ignore check)))) (let ((continuation (or continuation #'(lambda () nil)))) (with-slots (,@all-slots) self ,@(if cond `((when check (unless (and ,(if (first cond) `(matches-with-database-object-p candidate) `(not (matches-with-database-object-p candidate))) ,@(when (= (length cond) 2) (if (second cond) `((matches-with-database-object-p present)) `((not (matches-with-database-object-p present)))))) (error "!!!"))) ,@code) `(,@code))))) (mapcar #'(lambda (other-class) `(defmethod may-appear-before-p ((self ,class-name) (other ,(intern (format nil "CC-~A" other-class)))) nil)) precond))))) method-definitions)))) (defmacro defdependency (name &body body) (let ((body (remove nil body))) (unless (every #'(lambda (entry) (member (first entry) '(:additional-slots :logic :generator :tester :generator-T :generator-NIL :generator-T->T :generator-T->NIL :generator-NIL->T :generator-NIL->NIL :tester-T :tester-NIL :tester-T->T :tester-T->NIL :tester-NIL->T :tester-NIL->NIL))) body) (error "Syntax Error!")) (let ((additional-slots (rest (assoc :additional-slots body))) (logic (rest (assoc :logic body))) (generator (rest (assoc :generator body))) (generator-T (rest (assoc :generator-T body))) (generator-NIL (rest (assoc :generator-NIL body))) (generator-T->T (rest (assoc :generator-T->T body))) (generator-T->NIL (rest (assoc :generator-T->NIL body))) (generator-NIL->T (rest (assoc :generator-NIL->T body))) (generator-NIL->NIL (rest (assoc :generator-NIL->NIL body))) (tester (rest (assoc :tester body))) (tester-T (rest (assoc :tester-T body))) (tester-NIL (rest (assoc :tester-NIL body))) (tester-T->T (rest (assoc :tester-T->T body))) (tester-T->NIL (rest (assoc :tester-T->NIL body))) (tester-NIL->T (rest (assoc :tester-NIL->T body))) (tester-NIL->NIL (rest (assoc :tester-NIL->NIL body)))) (let ((all-slots (append '(candidate present) additional-slots))) `(progn ,@(get-code-for-class-and-constructor name '(dependency) all-slots additional-slots) ,@(get-code-for-method-definitions name all-slots (list (list 'logic nil logic) (list 'generator nil generator) (list 'generator-T '(t) generator-t) (list 'generator-NIL '(nil) generator-nil) (list 'tester-T '(t) tester-t) (list 'tester-NIL '(nil) tester-nil) (list 'generator-T->T '(t t) generator-t->t) (list 'generator-T->NIL '(t nil) generator-t->nil) (list 'generator-NIL->T '(nil t) generator-nil->t) (list 'generator-NIL->NIL '(nil nil) generator-nil->nil) (list 'tester nil tester) (list 'tester-T->T '(t t) tester-t->t) (list 'tester-T->NIL '(t nil) tester-t->nil) (list 'tester-NIL->T '(nil t) tester-nil->t) (list 'tester-NIL->NIL '(nil nil) tester-nil->nil)))))))) (defmacro defmultidependency (name &body body) (let ((body (remove nil body))) (unless (every #'(lambda (entry) (member (first entry) '(:additional-slots :logic :generator :tester :generator-T :generator-NIL :tester-T :tester-NIL))) body) (error "Syntax Error!")) (let ((additional-slots (rest (assoc :additional-slots body))) (logic (rest (assoc :logic body))) (generator-T (rest (assoc :generator-T body))) (generator-NIL (rest (assoc :generator-NIL body))) (tester (rest (assoc :tester body))) (generator (rest (assoc :generator body))) (tester-T (rest (assoc :tester-T body))) (tester-NIL (rest (assoc :tester-NIL body)))) (let ((all-slots (append '(candidate args) additional-slots))) `(progn ,@(get-code-for-class-and-constructor name '(multidependency) all-slots additional-slots) ,@(get-code-for-method-definitions name all-slots (list (list 'logic nil logic) (list 'generator-T '(t) generator-t) (list 'generator nil generator) (list 'tester nil tester) (list 'generator-NIL '(nil) generator-nil) (list 'tester-T '(t) tester-t) (list 'tester-NIL '(nil) tester-nil)))))))) (defmacro defproperty (name &body body) (let ((body (remove nil body))) (unless (every #'(lambda (entry) (member (first entry) '(:additional-slots :logic :generator :tester :generator-T :generator-NIL :tester-T :tester-NIL))) body) (error "Syntax Error!")) (let ((additional-slots (rest (assoc :additional-slots body))) (logic (rest (assoc :logic body))) (generator-T (rest (assoc :generator-T body))) (generator-NIL (rest (assoc :generator-NIL body))) (tester (rest (assoc :tester body))) (generator (rest (assoc :generator body))) (tester-T (rest (assoc :tester-T body))) (tester-NIL (rest (assoc :tester-NIL body)))) (let ((all-slots (append '(candidate) additional-slots))) `(progn ,@(get-code-for-class-and-constructor name '(property) all-slots additional-slots) ,@(get-code-for-method-definitions name all-slots (list (list 'logic nil logic) (list 'generator-T '(t) generator-t) (list 'generator nil generator) (list 'tester nil tester) (list 'generator-NIL '(nil) generator-nil) (list 'tester-T '(t) tester-t) (list 'tester-NIL '(nil) tester-nil))))))))
8,017
Common Lisp
.lisp
214
28.943925
83
0.586225
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
e2a064550389019038f855ff526bd4366dcf0f3780234743d0dbc34cc81e3ed7
11,685
[ -1 ]
11,686
query-compiler27.lisp
lambdamikel_VISCO/src/query-compiler/query-compiler27.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: QUERY-COMPILER; Base: 10 -*- (in-package query-compiler) (define-condition compiler-error (simple-error) ((descr :initarg :descr :accessor descr))) (defconstant +max-no-of-plans+ 1) (defvar *abort-search* nil) ;;; ;;; ;;; (defclass compiler-condition () ((candidate :reader candidate :initarg :candidate) (generator-rank :accessor generator-rank :initform nil) (tester-rank :accessor tester-rank :initform nil) (ignore-when :initarg :ignore-when :initform #'no) (deferable-when :initarg :deferable-when :initform #'yes) (additional-activated-when-condition :initarg :additional-activated-when-condition :initform #'yes) (d-flag :reader d-flag :initform t) (group :accessor group :initarg :group :initform nil))) (defmethod initialize-instance :after ((obj compiler-condition) &rest initargs) (declare (ignore initargs)) (push obj (compiler-conditions (candidate obj)))) ;;; ;;; ;;; (defclass property (compiler-condition) ((deferable-when :initform #'no))) (defmethod print-object ((obj property) stream) (format stream "~A(~A)" (type-of obj) (candidate obj))) (defclass dependency (compiler-condition) ((present :reader present :initarg :present))) (defmethod print-object ((obj dependency) stream) (format stream "~A(~A,~A)" (type-of obj) (candidate obj) (present obj))) (defclass multidependency (compiler-condition) ((args :reader args :initarg :args))) (defmethod print-object ((obj multidependency) stream) (format stream "~A(~A,~A)" (type-of obj) (candidate obj) (args obj))) ;;; ;;; ;;; (defmethod find-dependency ((type-symbol symbol) (a compiler-object) (b compiler-object)) (find-if #'(lambda (cc) (and (typep cc type-symbol) (eq (present cc) b))) (compiler-conditions a))) ;;; ;;; ;;; (defmethod deferable-p ((cc compiler-condition)) (and (d-flag cc) (funcall (slot-value cc 'deferable-when) cc))) (defmethod ignored-p ((cc compiler-condition)) (funcall (slot-value cc 'ignore-when) cc)) (defmacro with-activated-object ((obj) &body body) `(progn (activate ,obj) ,@body (deactivate ,obj))) (defmethod activate ((obj compiler-object)) (setf (activated-p obj) t) (push (get-group-state obj) (saved-group-state obj)) (dolist (cc (compiler-conditions obj)) (unless (activated-p cc) (unless (ignored-p cc) (if (not (deferable-p cc)) (error "Not deferable!") (defer cc)))))) (defmethod activate :after ((obj nail)) (unless (typep obj 'origin) (let ((transparency (on-transparency obj))) (when (matches-with-database-object-p obj) (cond ((not (1st-nail transparency)) (setf (1st-nail transparency) obj)) ((not (2nd-nail transparency)) (setf (2nd-nail transparency) obj))))))) ;;; ;;; ;;; (defmethod deactivate ((obj compiler-object)) (setf (activated-p obj) nil) (restore-group-state obj (pop (saved-group-state obj)))) (defmethod deactivate :after ((obj nail)) (let ((transparency (on-transparency obj))) (cond ((eq (1st-nail transparency) obj) (setf (1st-nail transparency) nil)) ((eq (2nd-nail transparency) obj) (setf (2nd-nail transparency) nil))))) ;;; ;;; ;;; (defmethod activated-p ((dependency dependency)) (and (activated-p (present dependency)) (funcall (slot-value dependency 'additional-activated-when-condition) dependency))) (defmethod activated-p ((property property)) t) (defmethod activated-p ((multidependency multidependency)) (and (every #'activated-p (args multidependency)) (funcall (slot-value multidependency 'additional-activated-when-condition) multidependency))) ;;; ;;; ;;; (defmethod valid-p ((cc compiler-condition)) (or (activated-p cc) (ignored-p cc) (deferable-p cc))) (defmethod defer ((cc compiler-condition)) (when (deferable-p cc) (setf (slot-value cc 'd-flag) nil) (dolist (other (group cc)) (setf (slot-value other 'd-flag) nil)))) (defmethod get-group-state ((obj compiler-object)) (mapcar #'(lambda (cc) (cons (d-flag cc) (mapcar #'d-flag (group cc)))) (compiler-conditions obj))) (defmethod restore-group-state ((obj compiler-object) (state list)) (mapcar #'(lambda (cc state) (setf (slot-value cc 'd-flag) (first state)) (mapc #'(lambda (cc flag) (setf (slot-value cc 'd-flag) flag)) (group cc) (rest state))) (compiler-conditions obj) state)) ;;; ;;; ;;; (defmethod get-activated-compiler-conditions ((obj compiler-object)) (remove-if #'(lambda (cc) (or (not (activated-p cc)) (ignored-p cc))) (compiler-conditions obj))) (defun deactivate-all (objects) (dolist (obj objects) (deactivate obj))) (defun activate-all (objects) (dolist (obj objects) (activate obj))) ;;; ;;; ;;; (defmethod get-logic-code ((cc compiler-condition) continuation &key &allow-other-keys) (funcall continuation)) ;;; ;;; ;;; (defmethod get-generator-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-generator-T-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-generator-NIL-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-generator-T->T-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-generator-NIL->T-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-generator-T->NIL-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-generator-NIL->NIL-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-tester-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-tester-T-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-tester-NIL-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-tester-T->T-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-tester-NIL->T-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-tester-T->NIL-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-tester-NIL->NIL-code ((cc compiler-condition) continuation &key &allow-other-keys) (declare (ignore continuation)) nil) (defmethod get-candidate-generator-code ((dependency dependency) continuation) (let ((a (matches-with-database-object-p (candidate dependency))) (b (matches-with-database-object-p (present dependency)))) (cond ((and a b) (or (get-generator-T->T-code dependency continuation) (get-generator-T-code dependency continuation) (get-generator-code dependency continuation))) ((and a (not b)) (or (get-generator-T->NIL-code dependency continuation) (get-generator-T-code dependency continuation) (get-generator-code dependency continuation) )) ((and (not a) b) (or (get-generator-NIL->T-code dependency continuation) (get-generator-NIL-code dependency continuation) (get-generator-code dependency continuation))) ((and (not a) (not b)) (or (get-generator-NIL->NIL-code dependency continuation) (get-generator-NIL-code dependency continuation) (get-generator-code dependency continuation)))))) (defmethod get-candidate-tester-code ((dependency dependency) continuation) (let ((a (matches-with-database-object-p (candidate dependency))) (b (matches-with-database-object-p (present dependency)))) (cond ((and a b) (or (get-tester-T->T-code dependency continuation) (get-tester-T-code dependency continuation) (get-tester-code dependency continuation))) ((and a (not b)) (or (get-tester-T->NIL-code dependency continuation) (get-tester-T-code dependency continuation) (get-tester-code dependency continuation))) ((and (not a) b) (or (get-tester-NIL->T-code dependency continuation) (get-tester-NIL-code dependency continuation) (get-tester-code dependency continuation))) ((and (not a) (not b)) (or (get-tester-NIL->NIL-code dependency continuation) (get-tester-NIL-code dependency continuation) (get-tester-code dependency continuation)))))) ;;; ;;; ;;; (defmethod get-candidate-generator-code ((cc compiler-condition) continuation) (if (matches-with-database-object-p (candidate cc)) (or (get-generator-T-code cc continuation) (get-generator-code cc continuation)) (or (get-generator-NIL-code cc continuation) (get-generator-code cc continuation)))) (defmethod get-candidate-tester-code ((cc compiler-condition) continuation) (if (matches-with-database-object-p (candidate cc)) (or (get-tester-T-code cc continuation) (get-tester-code cc continuation)) (or (get-tester-NIL-code cc continuation) (get-tester-code cc continuation)))) ;;; ;;; ;;; (defgeneric legal-successor-p (obj) (:method-combination and)) (defmethod legal-successor-p and ((obj visco-object)) (and (every #'valid-p (compiler-conditions obj)) (=> (and (not (typep obj 'enclosure)) (not (typep obj 'transparency))) (some #'activated-p (sorted-generators obj))))) (defmethod legal-successor-p and ((transparency transparency)) (and (activated-p (origin transparency)) (let ((no (no-of-required-nails-without-origin transparency))) (case no (0 t) (1 (1st-nail transparency)) (2 (and (1st-nail transparency) (2nd-nail transparency))))))) (defmethod legal-successor-p and ((obj nail)) (let ((transparency (on-transparency obj))) (or (activated-p transparency) (and (=> (not (matches-with-database-object-p obj)) ; Transparency noch nicht aktiv (some #'(lambda (op) ; ein Operator ist aktiv und kann den Nagel konstruieren (every #'activated-p (args op))) (res-of-operators obj))) (or (typep obj 'origin) (and (=> (not (1st-nail transparency)) ; bin ich der erste Nagel ? Wenn JA => .... (activated-p (origin transparency))) (let ((sxt (sx-type transparency)) (syt (sy-type transparency)) (rt (rot-type transparency))) (cond ((and (not sxt) (not syt)) t) ((and sxt (not syt)) (=> (not (1st-nail transparency)) (not (= (x (origin transparency)) (x obj))))) ((and (not sxt) syt) (=> (not (1st-nail transparency)) (not (= (y (origin transparency)) (y obj))))) ((and sxt (eq syt 'fac)) t) ((and sxt syt (not rt)) (and (=> (not (1st-nail transparency)) (and (not (= (x (origin transparency)) (x obj))) (not (= (y (origin transparency)) (y obj))))))) ((and sxt syt rt) (=> (and (1st-nail transparency) (not (2nd-nail transparency))) (not (zerop (det (x (origin transparency)) (y (origin transparency)) (x (1st-nail transparency)) (y (1st-nail transparency)) (x (origin transparency)) (y (origin transparency)) (x obj) (y obj)))))))))))))) ;;; ;;; ;;; (defun generate-plans (all-nodes &optional (no-of-plans 1)) (let ((plans nil) (plan-counter 0)) (labels ((do-it (sub-plan nodes-left) (cond (nodes-left (let ((activated-and-sorted-nodes (sort (remove-if-not #'legal-successor-p nodes-left) #'compare-nodes))) #| (mapc #'(lambda (a) (format t "(~A ~A) " a (get-object-rank a))) activated-and-sorted-nodes) (terpri) (terpri) |# (dolist (succ activated-and-sorted-nodes) (with-activated-object (succ) (do-it (cons succ sub-plan) (remove succ nodes-left)))))) (t (push (reverse sub-plan) plans) (incf plan-counter) (when (= plan-counter no-of-plans) (deactivate-all sub-plan) (return-from generate-plans plans)))))) (do-it nil all-nodes) plans))) (defmethod generate-plan ((query query) &key (infos t)) (dolist (obj (visco-objects query)) (setf (compiler-conditions obj) nil) (create-compiler-dependencies obj) (create-compiler-properties obj)) (setf (all-compiler-conditions query) nil) (dolist (obj (visco-objects query)) (setf (all-compiler-conditions query) (append (all-compiler-conditions query) (compiler-conditions obj)))) (let ((all-ccs (all-compiler-conditions query))) ; Bewerten der CCS (dolist (ccs1 (all-compiler-conditions query)) (when (get-candidate-generator-code ccs1 nil) (setf (generator-rank ccs1) (count-if #'(lambda (ccs2) (and (not (eq ccs1 ccs2)) (get-candidate-generator-code ccs2 nil) (generator-is-better-than-p ccs1 ccs2))) all-ccs))) (when (get-candidate-tester-code ccs1 nil) (setf (tester-rank ccs1) (count-if #'(lambda (ccs2) (and (not (eq ccs1 ccs2)) (get-candidate-tester-code ccs2 nil) (tester-is-better-than-p ccs1 ccs2))) all-ccs))))) (dolist (obj (visco-objects query)) ; fuer Objekt sortieren (setf (sorted-testers obj) (sort (remove-if-not #'tester-rank (compiler-conditions obj)) #'> :key #'tester-rank)) (setf (sorted-generators obj) (sort (remove-if-not #'generator-rank (compiler-conditions obj)) #'> :key #'generator-rank))) (dolist (obj (visco-objects query)) ; Gruppen installieren (install-groups obj) #| (when (typep obj 'chain-or-polygon) ( install-td-bo-groups obj)) |# (when (typep obj 'transparency) (setf (1st-nail obj) nil (2nd-nail obj) nil))) (let ((plan (determine-best-plan (let ((plans (generate-plans (visco-objects query) +max-no-of-plans+))) (when infos (format t "~%~A plans were generated - please wait..." (length plans)) (terpri) #| (princ plans) |# ) plans)))) (when infos (princ plan)) plan)) (defmethod install-td-bo-groups ((obj chain-or-polygon)) (dolist (cc1 (compiler-conditions obj)) (when (typep cc1 'cc-has-segment) (dolist (s (get-direct-components obj)) (dolist (p (get-direct-components s)) (dolist (cc2 (compiler-conditions p)) (when (typep cc2 'cc-endpoint-of) (push cc1 (group cc2)) (push cc2 (group cc1))))))))) (defconstant +inverses+ '((cc-joins cc-joins) (cc-segment-of cc-has-segment) (cc-segment-of cc-construct-chain-or-polygon-from-components) ; Effizienz-Kante (cc-rubberband-of cc-has-rubberband) (cc-rubberband-of cc-construct-chain-or-polygon-from-components) ; Effizienz-Kante (cc-endpoint-of cc-has-endpoint) ; fuer Ketten und Segmente (cc-endpoint-of cc-construct-atomic-rubberband-from-components) (cc-endpoint-of cc-construct-rubberband-from-components) (cc-point-of cc-has-point) ; fuer Ketten und Polygone ; Effizienz-Kante (cc-inside cc-contains) (cc-outside cc-excludes) (cc-disjoint cc-disjoint) (cc-intersects cc-intersects) (cc-has-centroid cc-centroid-of) (cc-inside-epsilon cc-epsilon-contains) (cc-angle-between cc-angle-between) (cc-position-is cc-position-is-inverse) (cc-orientation-is cc-orientation-is-inverse) (cc-length-is cc-length-is-inverse))) (defun cc-inverse (obj) (let ((type (type-of obj)) (res nil)) (dolist (entry +inverses+) (cond ((eq (first entry) type) (push (second entry) res)) ((eq (second entry) type) (push (first entry) res)))) res)) (defmethod install-groups ((obj compiler-object)) (dolist (cc (compiler-conditions obj)) (install-group cc))) (defmethod install-group ((cc compiler-condition)) nil) (defmethod install-group ((cc dependency)) (dolist (inverse (cc-inverse cc)) (dolist (cci (compiler-conditions (present cc))) (when (typep cci inverse) (typecase cci (dependency (when (and (eq (candidate cci) (present cc)) (eq (present cci) (candidate cc))) (push cci (group cc)))) (multidependency (when (and (eq (candidate cci) (present cc)) (member (candidate cc) (args cci))) (push cci (group cc))))))))) (defmethod install-group ((cc multidependency)) (dolist (inverse (cc-inverse cc)) (dolist (arg (args cc)) (dolist (cci (compiler-conditions arg)) (when (typep cci inverse) (typecase cci (dependency (when (and (eq (present cci) (candidate cc)) (member (candidate cci) (args cc))) (push cci (group cc)))))))))) ;;; ;;; ;;; (defgeneric create-compiler-properties (compiler-object) (:method-combination progn)) ;;; ;;; ;;; (defmethod create-compiler-properties progn ((obj compiler-object)) nil) (defmethod create-compiler-properties progn ((obj query-object)) (with-slots (status semantics constraints) obj (make-type-is obj) (when (eq status 'db) ; (primary-p obj) ist FALSCH !!! (make-is-primary obj)) #| (when (matches-with-database-object-p obj) (make-legal-binding-is obj)) |# (when semantics (make-semantics-is obj semantics)) #| (when constraints (make-relations-exists-is obj constraints)) |# (when (matches-with-database-object-p obj) (make-is-whole-DB-generator obj)))) (defmethod create-compiler-properties progn ((obj chain-or-polygon)) (make-at-least-has-segments-is obj (length (segments obj))) (when (every #'(lambda (s) (typep s 'atomic-rubberband)) (segments obj)) (make-at-most-has-segments-is obj (length (segments obj))))) (defmethod create-compiler-properties progn ((obj at-most-has-segments-constraint-mixin)) (with-slots (at-most-constraint) obj (when at-most-constraint (make-at-most-has-segments-is obj at-most-constraint)))) #| ;;; noch nicht implementiert (defmethod create-compiler-properties progn ((obj at-most-contains-constraint-mixin)) (with-slots (at-most-constraint) obj (when at-most-constraint (make-at-most-contains-is obj at-most-constraint)))) |# ;;; ;;; ;;; (defgeneric create-compiler-dependencies (compiler-object) (:method-combination progn)) ;;; ;;; ;;; (defmethod create-compiler-dependencies progn ((obj compiler-object)) nil) (defmethod create-compiler-dependencies progn ((obj epsilon-enclosure)) (make-depends-on obj (on-transparency obj) :deferable-when #'no)) ; wegen Radius (defmethod create-compiler-dependencies progn ((obj transparency)) (dolist (other (transparency-query-objects-and-enclosures obj)) (let ((other other)) (typecase other (nail (make-position-is-inverse obj other :ignore-when #'(lambda (self) (declare (ignore self)) (let ((no (no-of-required-nails-without-origin obj))) (or (eq other (origin obj)) (and (eq other (1st-nail obj)) (> no 0)) ; denn dann wurde Nail zur Bestimmung der Transformation benutzt => OK (and (eq other (2nd-nail obj)) (> no 1))))))) ; s.o. (atomic-rubberband (when (orientation-constraint other) (make-orientation-is-inverse obj other (orientation-constraint other) :ignore-when #'(lambda (self) (declare (ignore self)) (and (activated-p (p1 other)) (activated-p (p2 other)) (typep (p1 other) 'nail) (typep (p2 other) 'nail))))) (when (typep other '(or atomic-<=-rubberband atomic->=-rubberband beam)) (make-length-is-inverse obj other :ignore-when #'(lambda (self) (declare (ignore self)) (and (activated-p (p1 other)) (activated-p (p2 other)) (typep (p1 other) 'nail) (typep (p2 other) 'nail)))))))))) (defmethod create-compiler-dependencies progn ((obj nail)) (make-position-is obj (on-transparency obj))) (defmethod create-compiler-dependencies progn ((obj point)) (when (matches-with-database-object-p obj) ; DB, DB-COMPONENT (let ((lines (append (p1-of obj) (p2-of obj)))) (dolist (line lines) (when (matches-with-database-object-p line) ; DB, DB-COMPONENT atomic-rubb., DB rubb. (make-endpoint-of obj line))) (dolist (polygon-or-chain (remove-duplicates (apply #'append (mapcar #'part-of lines)))) (when (matches-with-database-object-p polygon-or-chain) (make-point-of obj polygon-or-chain :ignore-when #'(lambda (self) (declare (ignore self)) (some #'activated-p (part-of obj))))))))) (defmethod create-compiler-dependencies progn ((obj atomic-rubberband)) (when (orientation-constraint obj) (make-orientation-is obj (on-transparency obj) (orientation-constraint obj) :ignore-when #'(lambda (self) (declare (ignore self)) (and (activated-p (p1 obj)) (activated-p (p2 obj)) (typep (p1 obj) 'nail) (typep (p2 obj) 'nail))))) (when (typep obj '(or atomic-<=-rubberband atomic->=-rubberband beam)) (make-length-is obj (on-transparency obj) :ignore-when #'(lambda (self) (declare (ignore self)) (and (activated-p (p1 obj)) (activated-p (p2 obj)) (typep (p1 obj) 'nail) (typep (p2 obj) 'nail))))) (case (status obj) (universe (make-construct-atomic-rubberband-from-components obj (list (p1 obj) (p2 obj)) :deferable-when #'no)) ((db db-component) (make-has-endpoint obj (p1 obj) :ignore-when #'(lambda (self) ; denn dann ist "construct from" effizienter (declare (ignore self)) (and (activated-p (p1 obj)) (activated-p (p2 obj))))) (make-has-endpoint obj (p2 obj) :ignore-when #'(lambda (self) (declare (ignore self)) (and (activated-p (p1 obj)) (activated-p (p2 obj))))) (make-construct-atomic-rubberband-from-components obj (list (p1 obj) (p2 obj))) (dolist (chain-or-polygon (part-of obj)) (when (matches-with-database-object-p chain-or-polygon) (make-segment-of obj chain-or-polygon)))))) (defmethod create-compiler-dependencies progn ((obj rubberband)) (case (status obj) (universe (make-construct-rubberband-from-components obj (list (p1 obj) (p2 obj)) :deferable-when #'no)) ((db db-component) (make-has-endpoint obj (p1 obj) :ignore-when #'(lambda (self) ; denn dann ist "construct from" effizienter (declare (ignore self)) (and (activated-p (p1 obj)) (activated-p (p2 obj))))) (make-has-endpoint obj (p2 obj) :ignore-when #'(lambda (self) (declare (ignore self)) (and (activated-p (p1 obj)) (activated-p (p2 obj))))) (make-construct-rubberband-from-components obj (list (p1 obj) (p2 obj))) (dolist (chain-or-polygon (part-of obj)) (when (matches-with-database-object-p chain-or-polygon) (make-rubberband-of obj chain-or-polygon)))))) (defmethod create-compiler-dependencies progn ((obj chain-or-polygon)) (let ((segments (segments obj))) (case (status obj) (universe (make-construct-chain-or-polygon-from-components obj segments :deferable-when #'no)) ((db db-component) (dolist (segment segments) (if (typep segment 'rubberband) (make-has-rubberband obj segment :ignore-when #'(lambda (self) (declare (ignore self)) (every #'activated-p segments))) (make-has-segment obj segment :ignore-when #'(lambda (self) (declare (ignore self)) (every #'activated-p segments))))) #| (multiple-value-call #'mapc #'(lambda (s1 s2) (make-joins s1 s2)) (if (typep obj 'chain) (values segments (rest segments)) (values (cons (first (last segments)) segments) segments))) |# (make-construct-chain-or-polygon-from-components obj segments) (dolist (point (point-list obj)) (let ((point point)) (make-has-point obj point :ignore-when #'(lambda (self) (declare (ignore self)) (some #'activated-p (part-of point)))))))))) ;;; ;;; ;;; (defmethod create-compiler-dependencies progn ((obj on-transparency-mixin)) (when (and (matches-with-database-object-p obj) (not (typep obj 'nail))) (make-inside obj (on-transparency obj) :ignore-when #'yes))) (defmethod create-compiler-dependencies progn ((obj constraints-mixin)) (dolist (constraint (constraints obj)) (map-constraint-to-dependency constraint))) (defmethod create-compiler-dependencies progn ((obj possible-operator-argument-mixin)) (dolist (op (arg-of-operators obj)) (with-slots (args res) op (typecase op (create-centroid (when (and (matches-with-database-object-p res) (matches-with-database-object-p obj)) (make-has-centroid obj res))) (create-intersection-point (when (every #'matches-with-database-object-p (cons res args)) nil)))))) (defmethod create-compiler-dependencies progn ((obj possible-operator-result-mixin)) (unless (typep obj 'derived-enclosure) ; Sonderregelung: DERIVED ENCLOSURES werden nicht konstruiert (dolist (op (res-of-operators obj)) (with-slots (args res) op (typecase op (create-centroid (make-centroid-of obj (first args) :deferable-when (if (and (matches-with-database-object-p res) (matches-with-database-object-p obj)) ; s. obige Inverse! #'yes #'no))) (create-intersection-point (unless (every #'matches-with-database-object-p (cons res args)) (make-construct-intersection-point res args :deferable-when #'no)))))))) ;;; ;;; ;;; ;;; (defmethod map-constraint-to-dependency ((constraint binary-constraint)) (with-slots (1st-arg 2nd-arg) constraint (labels ((transparency-must-be-activated (arg) #'(lambda (self) (declare (ignore self)) (activated-p (on-transparency arg)))) (all-components-or-some-master (a rel b) #'(lambda (self) (declare (ignore self)) (or (let ((components (remove-if-not #'(lambda (o) (and (typep o 'visco-object) (activated-p o))) (get-direct-components a)))) (and components (every #'(lambda (c) (let ((cc (find-dependency rel c b))) (and cc (not (d-flag cc))))) components))) (some #'(lambda (m) (let ((cc (find-dependency rel m b))) (and cc (not (d-flag cc))))) (remove-if-not #'(lambda (o) (and (typep o 'visco-object) (activated-p o))) (part-of a))))))) (etypecase constraint (angle-between (make-angle-between 1st-arg 2nd-arg (allowed-derivation constraint) :additional-activated-when-condition (transparency-must-be-activated 1st-arg) :ignore-when #'(lambda (self) (declare (ignore self)) (every #'(lambda (p) (and (activated-p p) (typep p 'nail))) (list (p1 1st-arg) (p2 1st-arg) (p1 2nd-arg) (p2 2nd-arg)))))) (intersects (when (not (or (reduce #'intersection ; gemeinsamer Punkt? -> kein INTERSECTS-Constraint notw. (mapcar #'(lambda (arg) (typecase arg (point (list arg)) (otherwise (point-list arg)))) (list 1st-arg 2nd-arg))) (and (not (may-vary-p 1st-arg)) (not (may-vary-p 2nd-arg))) (and (typep 1st-arg '(or line point)) (typep 2nd-arg '(or line point)) (or (ignore-disjoint-and-intersects-relations-p 1st-arg) (ignore-disjoint-and-intersects-relations-p 2nd-arg))))) (make-intersects 1st-arg 2nd-arg :ignore-when #'(lambda (self) (declare (ignore self)) (some #'(lambda (c) (let ((cc (find-dependency 'cc-intersects c 2nd-arg))) (and cc (not (d-flag cc))))) (remove-if-not #'activated-p (get-all-components 1st-arg))))))) (disjoint (when (not (or (and (typep 1st-arg 'point) (typep 2nd-arg 'point)) (and (not (may-vary-p 1st-arg)) (not (may-vary-p 2nd-arg))) (and (typep 1st-arg '(or line point)) (typep 2nd-arg '(or line point)) (or (ignore-disjoint-and-intersects-relations-p 1st-arg) (ignore-disjoint-and-intersects-relations-p 2nd-arg))) (some #'(lambda (m) (and (typep m 'possible-operator-argument-mixin) (some #'(lambda (op) (let ((2nd-arg (res op))) (find-constraint 'inside 1st-arg 2nd-arg))) (arg-of-operators m)))) (get-all-masters 2nd-arg)) (some #'(lambda (m) (and (typep m 'possible-operator-argument-mixin) (some #'(lambda (op) (let ((1st-arg (res op))) (find-constraint 'inside 2nd-arg 1st-arg))) (arg-of-operators m)))) (get-all-masters 1st-arg)))) (make-disjoint 1st-arg 2nd-arg :ignore-when (all-components-or-some-master 1st-arg 'cc-disjoint 2nd-arg)))) (inside (unless (typep 1st-arg 'nail) (if (typep 2nd-arg 'drawn-enclosure) (if (negated-p 2nd-arg) (make-outside 1st-arg 2nd-arg :ignore-when (all-components-or-some-master 1st-arg 'cc-outside 2nd-arg) :additional-activated-when-condition (transparency-must-be-activated 1st-arg)) (make-inside 1st-arg 2nd-arg :ignore-when (all-components-or-some-master 1st-arg 'cc-inside 2nd-arg) :additional-activated-when-condition (transparency-must-be-activated 1st-arg))) (when (or (may-vary-p 1st-arg) (may-vary-p 2nd-arg)) (typecase 2nd-arg (epsilon-enclosure (make-inside-epsilon 1st-arg (arg-object 2nd-arg) (radius 2nd-arg) :ignore-when (all-components-or-some-master 1st-arg 'cc-inside-epsilon (arg-object 2nd-arg)) :additional-activated-when-condition (transparency-must-be-activated 1st-arg))) (inner-enclosure (make-inside 1st-arg (arg-object 2nd-arg) :ignore-when (all-components-or-some-master 1st-arg 'cc-inside (arg-object 2nd-arg)))) (outer-enclosure (make-outside 1st-arg (arg-object 2nd-arg) :ignore-when (all-components-or-some-master 1st-arg 'cc-outside (arg-object 2nd-arg))))))))) (contains (unless (typep 2nd-arg 'nail) (if (typep 1st-arg 'drawn-enclosure) (if (negated-p 1st-arg) (make-excludes 1st-arg 2nd-arg :ignore-when (all-components-or-some-master 1st-arg 'cc-excludes 2nd-arg) :additional-activated-when-condition (transparency-must-be-activated 1st-arg)) (make-contains 1st-arg 2nd-arg :ignore-when (all-components-or-some-master 1st-arg 'cc-contains 2nd-arg) :additional-activated-when-condition (transparency-must-be-activated 1st-arg))) (when (or (may-vary-p 1st-arg) (may-vary-p 2nd-arg)) (typecase 1st-arg (epsilon-enclosure (make-epsilon-contains (arg-object 1st-arg) 2nd-arg (radius 1st-arg) :ignore-when (all-components-or-some-master (arg-object 1st-arg) 'cc-epsilon-contains 2nd-arg) :additional-activated-when-condition (transparency-must-be-activated 1st-arg))) (inner-enclosure (make-contains (arg-object 1st-arg) 2nd-arg :ignore-when (all-components-or-some-master (arg-object 1st-arg) 'cc-contains 2nd-arg))) (outer-enclosure (make-excludes (arg-object 1st-arg) 2nd-arg :ignore-when (all-components-or-some-master (arg-object 1st-arg) 'cc-excludes 2nd-arg)))))))))))) ;;; ;;; ;;; (defmethod y-mirror-query ((query query)) (dolist (obj (visco-objects query)) (typecase obj (point (setf (y obj) (- (y obj)))) ((or transparency drawn-enclosure) (dolist (point (point-list obj)) (setf (y point) (- (y point)))))) (when (typep obj 'geom-chain-or-polygon) (invalidate-bounding-box obj)))) (defmethod reset-query ((query query)) (dolist (obj (elements spatial-index::*cur-index*)) (setf (bound-to obj) nil)) (dolist (obj (visco-objects query)) (when (typep obj 'query-object) (setf (bound-to obj) nil)))) (defmethod invalidate ((query query)) (setf (exec-fn query) nil)) (defmethod executable-p ((query query)) (exec-fn query)) (defmethod execute-query ((query query)) (let ((db (get-current-db))) (setf *abort-search* nil) (when (and db (exec-fn query)) (reset-query query) (y-mirror-query query) (catch 'abort (funcall (exec-fn query))) (reset-query query) (y-mirror-query query)))) (defmethod get-name-for-exec-fn ((obj compiler-object)) (intern (format nil "EXEC-~A" (name obj)))) ;;; ;;; ;;; (defmethod compile-query ((query query) &key (debug t) (check-for-abort t) (infos t)) (let* ((plan (generate-plan query :infos infos)) (n (length plan))) (unless plan (error "Bad query! No plan(s)!")) (y-mirror-query query) (mapc #'(lambda (obj next-obj) (activate obj) (compile-it obj next-obj :infos infos :debug debug :check-for-abort check-for-abort :plan-length n :plan-pos (1+ (position obj plan)))) plan (append (rest plan) '(nil))) (y-mirror-query query) (deactivate-all (reverse plan)) (setf (exec-fn query) (get-name-for-exec-fn (first plan))))) ;;; ;;; ;;; (defun get-query-semantics (query) (let ((plan (generate-plan query))) (unless plan (error "Bad query! No plan(s)!")) (prog1 (first (get-semantics plan)) (deactivate-all (reverse plan))))) (defun get-semantics (plan) (let ((obj (first plan)) (rest-plan (rest plan))) (when obj (activate obj) (get-object-semantics obj #'(lambda () (get-semantics rest-plan)))))) (defmethod get-object-semantics ((obj visco-object) continuation) `( (exists (,obj) (and ,@(get-condition-semantics (remove-if #'(lambda (cc) (not (activated-p cc))) (compiler-conditions obj))) ,@(funcall continuation))))) (defun get-transparency-parameters (transparency) (mapcar #'(lambda (sym) (get-transparency-parameter-name transparency sym)) '(tx ty sx sy r))) (defun get-transparency-parameter-name (transparency name) (intern (string-upcase (format nil "~A-~A" name transparency)))) (defun get-const-name (obj) (intern (string-upcase (format nil "+CONST-~A+" obj)))) (defun get-transformed-object (obj) `(transform ,(get-const-name obj) ,@(get-transparency-parameters (on-transparency obj)))) (defun get-inverse-transformed-object (obj) `(inverse-transform ,obj ,@(get-transparency-parameters (on-transparency obj)))) (defmethod get-object-semantics ((obj transparency) continuation) (let ((tx (get-transparency-parameter-name obj 'tx)) (ty (get-transparency-parameter-name obj 'ty)) (sx (get-transparency-parameter-name obj 'sx)) (sy (get-transparency-parameter-name obj 'sy)) (r (get-transparency-parameter-name obj 'r))) `( (exists (,obj ,tx ,ty ,sx ,sy ,r) (and (rectangle ,obj) (real ,tx) (real ,ty) (real ,sx) (real ,sy) (real ,r) (= ,obj ,(get-transformed-object obj)) ,@(when (sxmin obj) `( (>= sx ,(sxmin obj)))) ,@(when (symin obj) `( (>= sy ,(symin obj)))) ,@(when (sxmax obj) `( (<= sx ,(sxmax obj)))) ,@(when (symax obj) `( (<= sy ,(symax obj)))) ,@(when (sxsy-constraint obj) `( (= ,sx ,sy))) ,@(when (orientation-constraint (origin obj)) (list (get-check-circle-ticks-code 'r (orientation-constraint (origin obj))))) ,@(get-condition-semantics (remove-if #'(lambda (cc) (not (activated-p cc))) (compiler-conditions obj))) ,@(funcall continuation)))))) (defmethod get-object-semantics ((obj drawn-enclosure) continuation) `( ,@(get-condition-semantics (remove-if #'(lambda (cc) (not (activated-p cc))) (compiler-conditions obj))) ,@(funcall continuation))) (defun get-condition-semantics (ccs) (when ccs `( ,@(get-logic-code (first ccs) #'(lambda () (get-condition-semantics (rest ccs))))))) ;;; ;;; ;;; #| (defun show-search-progress (n) nil) |# (defmethod compile-it (obj next-obj &key &allow-other-keys) (declare (ignore obj next-obj)) nil) (defmethod compile-it :around ((obj compiler-object) next-obj &key (debug nil) (check-for-abort t) (infos t) plan-pos plan-length) (declare (ignore next-obj)) (when infos (format t "~%-------------------------------------------------~%") (format t "~%Compiling ~A:~%" obj) (format t "~%All Compiler Conditions: ~A" (compiler-conditions obj)) (format t "~%Activated & Sorted Compiler Conditions: ~A" (activated-and-sorted-compiler-conditions obj))) (let ((source `(lambda () ,@(when debug `((format t "Trying to match: ~A~%" ,obj))) (show-search-progress ,(/ plan-pos plan-length)) ,@(when check-for-abort `((when *abort-search* (throw 'abort nil)))) ,@(call-next-method)))) (when infos (format t "~%~%~A :~%~A~%" (get-name-for-exec-fn obj) source)) (setf (exec-fn obj) (compile (get-name-for-exec-fn obj) source)) (setf (exec-source obj) source))) ;;; ;;; ;;; (defmethod compile-it ((obj transparency) next-obj &key &allow-other-keys) `( (when (and ,@(compile-conditions (activated-and-sorted-compiler-conditions obj))) ,@(compile-next next-obj)))) (defmethod compile-it ((obj visco-object) next-obj &key &allow-other-keys) `( (let ((candidate ,obj)) (when (and ,@(compile-conditions (activated-and-sorted-compiler-conditions obj))) ,@(compile-next next-obj))))) (defmethod compile-it ((obj query-object) next-obj &key (check-for-abort t) &allow-other-keys) (let ((generator (first (activated-and-sorted-compiler-conditions obj))) (cont #'(lambda () `( ,@(when check-for-abort `((when *abort-search* (throw 'abort nil)))) (when (and ,@(compile-conditions (rest (activated-and-sorted-compiler-conditions obj)))) ,@(compile-next next-obj)))))) (if (get-candidate-generator-code generator nil) (get-candidate-generator-code generator cont) (error "No candidate generator!")))) (defmethod compile-it ((obj nail) next-obj &key (check-for-abort t) &allow-other-keys) (let* ((transparency (on-transparency obj)) (origin (origin transparency)) (sxt (sx-type transparency)) ; nil, free (syt (sy-type transparency)) ; nil, fac, free (sxi (sx-s->w transparency)) (syi (sy-s->w transparency)) (sxsy-constraint (sxsy-constraint transparency)) (rt (rot-type transparency)) (no (no-of-required-nails-without-origin transparency))) (labels ((get-check-and-set-code (paste-in) ; Input: sx, sy, r `( ,@(when check-for-abort `((when *abort-search* (throw 'abort nil)))) (when (and ,@(compile-conditions (rest (activated-and-sorted-compiler-conditions obj)))) (let* (sx sy r (origin-bound-to (bound-to ,(origin transparency))) (ox ,(slot-value origin 'x)) (oy ,(slot-value origin 'y)) (tx (slot-value origin-bound-to 'x)) (ty (slot-value origin-bound-to 'y))) ,@paste-in (when (and sx (plusp sx) (let ((a (/ sx ,sxi))) ,(get-check-ticks-code 'a (list (list (sxmin transparency) (sxmax transparency))))) sy (plusp sy) (let ((b (/ sy ,syi))) ,(get-check-ticks-code 'b (list (list (symin transparency) (symax transparency))))) ,@(when (eq syt 'fac) `((=-eps sy (* sx ,sxsy-constraint)))) ,(get-check-circle-ticks-code 'r (orientation-constraint (origin transparency)))) (setf (sx ,transparency) sx (sy ,transparency) sy (r ,transparency) r (epsilon-a ,transparency) ,(if (eq rt 'free) `(abs (- (* sx (cos r)) (* sy (sin r)))) 'sx) (epsilon-b ,transparency) ,(if (eq rt 'free) `(abs (+ (* sx (sin r)) (* sy (cos r)))) 'sy)) (let ((matrix ,(matrix transparency)) (inverse-matrix ,(inverse-matrix transparency))) (reset matrix) (translate matrix (- ox) (- oy)) (scale matrix sx sy) ,@(when (eq rt 'free) `((rotate matrix r))) (translate matrix tx ty) (reset inverse-matrix) (translate inverse-matrix (- tx) (- ty)) ,@(when (eq rt 'free) `((rotate inverse-matrix (- r)))) (scale inverse-matrix (/ 1 sx) (/ 1 sy)) (translate inverse-matrix ox oy) ,@(compile-next next-obj)))))))) (let* ((generator (first (activated-and-sorted-compiler-conditions obj))) (cont (with-slots (origin sxsy-constraint) transparency (cond ((and (eq obj origin) ; (nil nil nil) (= no 0)) #'(lambda () (get-check-and-set-code `((setf sx ,sxi sy ,syi r 0))))) ((and (eq obj (1st-nail transparency)) (= no 1)) (if (not rt) ; also (free free nil) (free fac nil) (free nil nil) (nil free nil) #'(lambda () (get-check-and-set-code `((let ((sdx ,(- (slot-value obj 'x) (slot-value origin 'x))) (sdy ,(- (slot-value obj 'y) (slot-value origin 'y))) (wdx (- (slot-value candidate 'x) (slot-value origin-bound-to 'x))) (wdy (- (slot-value candidate 'y) (slot-value origin-bound-to 'y)))) (setf r 0) (setf sx (unless (or (zerop wdx) (zerop sdx)) (/ wdx sdx))) (setf sy (unless (or (zerop wdy) (zerop sdy)) (/ wdy sdy))) ,@(when (zerop (- (slot-value obj 'x) (slot-value origin 'x))) `((unless (zerop wdx) (setf sx nil sy nil)))) ,@(when (zerop (- (slot-value obj 'y) (slot-value origin 'y))) `((unless (zerop wdy) (setf sx nil sy nil))))) ,@(when sxsy-constraint `((when (and sx (not sy)) (setf sy (* sx ,sxsy-constraint))) (when (and sy (not sx)) (setf sx (/ sy ,sxsy-constraint)))))))) #'(lambda () ; (nil nil free) (free nil free) (nil free free) (free fac free) (get-check-and-set-code `((multiple-value-bind (s rot) ( ,(if (or (and (not sxt) (not syt)) sxsy-constraint) 'proportional-2-point (if (and sxt (not syt)) #| 'fixed-sy-2-point |# (error "fixed-sy-2-point-transformation: not implemented!") #| 'fixed-sx-2-point |# (error "fixed-sx-2-point-transformation: not implemented!"))) ox oy ,(slot-value obj 'x) ,(slot-value obj 'y) tx ty (slot-value candidate 'x) (slot-value candidate 'y)) (setf r rot) ,@(when (eq sxt 'free) `((setf sx s))) ,@(when (eq syt 'free) `((setf sy s))) ,@(when sxsy-constraint `((when (and sx (not sy)) (setf sy (* s ,sxsy-constraint))) (when (and sy (not sx)) (setf sx (/ s ,sxsy-constraint))))) ,@(when (and (not sxt) (not syt)) `((setf sx s sy s))))))))) ((> no 1) ; (free free free) (error "3-point-transformation: not implemented!")) (t ; normaler Nagel, wird nicht zur Trafo.best. benutzt! #'(lambda () `( ,@(when check-for-abort `((when *abort-search* (throw 'abort nil)))) (when (and ,@(compile-conditions (rest (activated-and-sorted-compiler-conditions obj)))) ,@(compile-next next-obj))))))))) (if (get-candidate-generator-code generator nil) (get-candidate-generator-code generator cont) (error "No candidate generator!")))))) ;;; ;;; ;;; (defun compile-next (next-obj) (if next-obj `( (,(get-name-for-exec-fn next-obj) ) ) `( (ready)))) (defun compile-conditions (all-ccs) (when all-ccs (get-candidate-tester-code (first all-ccs) #'(lambda () (compile-conditions (rest all-ccs)))))) ;;; ;;; Testhilfe: ;;; (defun legal-subplan (plan) (let ((trace (mapcar #'(lambda (succ) (when (legal-successor-p succ) (activate succ) succ)) plan))) (deactivate-all (remove nil (reverse trace))) trace)) (defun list-all-ccs (q) (dolist (o (visco-objects q)) (princ o) (terpri) (princ (compiler-conditions o)) (terpri)))
45,562
Common Lisp
.lisp
1,200
31.628333
107
0.63306
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
a7c462c48888e68484a9845a488ff123053d1f6042083ba305b578ce80963901
11,686
[ -1 ]
11,687
asg17.lisp
lambdamikel_VISCO/src/ASG/asg17.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: QUERY-COMPILER; Base: 10 -*- (in-package query-compiler) (defconstant +intersects-threshold+ 4) (defconstant +inner-enclosure-r-fac+ 8) (defconstant +outer-enclosure-r-fac+ 8) ;;; ;;; ;;; (defpersistentclass compiler-object (name-mixin) ; abstrakt !!!! ((exec-fn :accessor exec-fn :initform nil :not-persistent) (exec-source :accessor exec-source :not-persistent) (activated-p :accessor activated-p :initform nil :not-persistent) (saved-group-state :accessor saved-group-state :initform nil :not-persistent) (compiler-conditions :accessor compiler-conditions :initform nil :not-persistent) (sorted-generators :accessor sorted-generators :not-persistent) (sorted-testers :accessor sorted-testers :not-persistent) (activated-and-sorted-compiler-conditions :accessor activated-and-sorted-compiler-conditions :not-persistent))) (defmethod initialize-loaded-persistent-object :after ((obj compiler-object)) (setf (exec-fn obj) nil)) ;;; ;;; ;;; (defparameter *name-counter* 0) (defun get-next-name () (prog1 *name-counter* (incf *name-counter*))) ;;; ;;; ;;; (defpersistentclass name-mixin () ((name :accessor name :initform nil :initarg :name))) (defpersistentclass on-transparency-mixin () ((on-transparency :accessor on-transparency :initarg :on-transparency))) (defpersistentclass possible-operator-result-mixin () ((res-of-operators :accessor res-of-operators :initarg :res-of-operators :initform nil))) (defpersistentclass possible-operator-argument-mixin () ((arg-of-operators :accessor arg-of-operators :initform nil))) (defpersistentclass orientation-constraint-mixin () ((orientation-constraint :accessor orientation-constraint :initarg :orientation-constraint :initform nil))) (defpersistentclass at-most-constraint-mixin () ((at-most-constraint :accessor at-most-constraint :initarg :at-most-constraint :initform nil))) (defpersistentclass at-most-has-segments-constraint-mixin (at-most-constraint-mixin) ()) (defpersistentclass at-most-contains-constraint-mixin (at-most-constraint-mixin) ()) ;;; ;;; ;;; (defpersistentclass query (compiler-object) ; unvollstaendig: nur ein Transparency erlaubt! ((visco-objects :accessor visco-objects :initform nil) (all-compiler-conditions :accessor all-compiler-conditions :initform nil))) (defmethod get-transparencies ((query query)) (remove-if-not #'(lambda (obj) (typep obj 'transparency)) (visco-objects query))) (defmethod visco-objects ((obj null)) nil) ;;; ;;; ;;; (defpersistentclass visco-object (compiler-object) ; abstrakt ((query :accessor query :initarg :query))) (defmethod print-object ((obj visco-object) stream) (if (name obj) (format stream "~A-~A" (type-of obj) (name obj)) (format stream "~A" (type-of obj)))) (defpersistentclass transparency (visco-object geom-polygon) ((transparency-query-objects-and-enclosures :accessor transparency-query-objects-and-enclosures :initform nil) (child-transparencies :accessor child-transparencies :initform nil) (parent-transparency :accessor parent-transparency) (sx :accessor sx :initarg :sx :initform 1.0) ; Parameter der aktuellen Transparency-Transformation (Matrix, Matrix-1) (sy :accessor sy :initarg :sy :initform 1.0) (r :accessor r :initarg :r :initform 0) (sx-s->w :accessor sx-s->w :initform 1.0) ; INITIALE Skalierungsfaktoren Screenkoordinaten -> Weltkoordinaten (sy-s->w :accessor sy-s->w :initform 1.0) ; sxmin, symin, sxmax, symax beziehen sich auf sx-s->w, sy-s->w ; (z.B. BB-Width=1oo Pixel und Width=20 m. => sx-s->w = 20/100 = 1/5) ; Unterschied: berechnete totale Skalierung: ; sx = Weltkoordinaten / Pixelkoordinaten ; sy = entsp. ; (sx, sy) f. Matrix : Pixel -> Welt ; Constraints fuer sx-s->w, sy-s->w: ; sxmin <= (/ sx sx-s->w) <= sxmax ; symin <= (/ sy sy-s->w) <= symax (epsilon-a :accessor epsilon-a) ; Metrik: r(dx,dy) = (sqrt (+ (exp (/ dx epsilon-a) 2) (exp (/ dy epsilon-b) 2))), (epsilon-b :accessor epsilon-b) ; epsilon-a = (- (* sx (cos r)) (* sy (sin r))) ; epsilon-b = (+ (* sx (sin r)) (* sy (cos r))) (matrix :accessor matrix :initform (make-matrix)) ; Bildkoordinaten (Pixel) => Weltkoordinaten (Meter) (inverse-matrix :accessor inverse-matrix :initform (make-matrix)) ; Weltkoordinaten (Meter) => Bildkoordinaten (width :accessor width :initarg :width :initform nil) ; in Metern (height :accessor height :initarg :height :initform nil) (sxmin :accessor sxmin :initarg :sxmin :initform nil) (sxmax :accessor sxmax :initarg :sxmax :initform nil) (symin :accessor symin :initarg :symin :initform nil) (symax :accessor symax :initarg :symax :initform nil) (sxsy-constraint :accessor sxsy-constraint :initarg :sxsy-constraint :initform nil) (origin :accessor origin :initform nil) ; wird vom Compiler gefuellt (1st-nail :accessor 1st-nail :initform nil) ; s.o. (2nd-nail :accessor 2nd-nail :initform nil))) ; s.o. (defpersistentclass query-object-or-enclosure (visco-object constraints-mixin on-transparency-mixin) ; abstrakt ((transparency :accessor transparency :initarg :transparency))) (defpersistentclass query-object (query-object-or-enclosure) ; abstrakt ((status :accessor status :initarg :status) (semantics :accessor semantics :initarg :semantics :initform nil) (bound-to :accessor bound-to))) (defpersistentclass at-least-1d-query-object (query-object) ; abstrakt ()) ;;; ;;; ;;; (defpersistentclass point (query-object geom-point) ; abstrakt ((ignore-disjoint-and-intersects-relations-p :accessor ignore-disjoint-and-intersects-relations-p :initform nil :initarg :ignore-disjoint-and-intersects-relations-p))) (defpersistentclass marble (point possible-operator-result-mixin possible-operator-argument-mixin) ()) (defpersistentclass nail (point possible-operator-result-mixin possible-operator-argument-mixin) ()) (defpersistentclass origin (nail orientation-constraint-mixin) ((parent-fixed-p :accessor parent-fixed-p :initform nil))) ;;; ;;; ;;; (defpersistentclass line (at-least-1d-query-object geom-line) ; abstrakt ((ignore-disjoint-and-intersects-relations-p :accessor ignore-disjoint-and-intersects-relations-p :initform nil :initarg :ignore-disjoint-and-intersects-relations-p) (1d-intersects-other-lines-p :accessor 1d-intersects-other-lines-p :initform nil))) (defpersistentclass rubberband (line at-most-has-segments-constraint-mixin possible-operator-argument-mixin) ()) (defpersistentclass atomic-rubberband (line possible-operator-argument-mixin orientation-constraint-mixin) ()) (defpersistentclass atomic-<=-rubberband (atomic-rubberband) ()) (defpersistentclass atomic->=-rubberband (atomic-rubberband) ()) (defpersistentclass beam (atomic-rubberband) ()) ;;; ;;; ;;; (defpersistentclass chain-or-polygon (at-least-1d-query-object ; abstrakt possible-operator-argument-mixin at-most-has-segments-constraint-mixin orientation-constraint-mixin geom-chain-or-polygon) ()) (defpersistentclass chain (chain-or-polygon geom-chain) ()) (defpersistentclass polygon (chain-or-polygon geom-polygon) ()) ;;; ;;; ;;; (defpersistentclass enclosure (query-object-or-enclosure ; abstrakt at-most-contains-constraint-mixin) ((opaque-p :accessor opaque-p :initarg :opaque-p :initform nil))) (defpersistentclass derived-enclosure (enclosure possible-operator-result-mixin) ; abstrakt ((arg-object :accessor arg-object :initform nil :initarg :arg-object))) (defmethod print-object ((obj derived-enclosure) stream) (format stream "~A Of ~A" (apply #'call-next-method obj nil nil) (arg-object obj))) (defpersistentclass drawn-enclosure (enclosure geom-polygon) ((negated-p :accessor negated-p :initarg :negated-p :initform nil))) (defpersistentclass inner-enclosure (derived-enclosure) ((polygon :accessor polygon :initarg :polygon))) (defpersistentclass outer-enclosure (derived-enclosure) ((polygon :accessor polygon :initarg :polygon))) (defpersistentclass epsilon-enclosure (derived-enclosure) ((radius :accessor radius :initarg :radius))) ;;; ;;; ;;; (defun get-shrinked-polygon (arg-obj &optional (r +inner-enclosure-r-fac+)) (let ((pl (point-list arg-obj))) (poly (make-segments (mapcar #'(lambda (p1 p2 p3) (let* ((s1 (angle-between* (x p1) (y p1) (x p2) (y p2))) (s2 (angle-between* (x p2) (y p2) (x p3) (y p3))) (s1s2 (/ (+ s1 s2) 2)) (x (x p2)) (y (y p2)) (x1a (+ x (* r (cos (+ +pi/2+ s1s2))))) (y1a (+ y (* r (sin (+ +pi/2+ s1s2))))) (x1b (+ x (* r (cos (+ s1s2 (- +pi/2+)))))) (y1b (+ y (* r (sin (+ s1s2 (- +pi/2+))))))) (if (inside-p* x1a y1a arg-obj) (if (plusp r) (list x1a y1a) (list x1b y1b)) (if (plusp r) (list x1b y1b) (list x1a y1a))))) pl (append (cdr pl) (list (first pl))) (append (cddr pl) (list (first pl) (second pl)))))))) (defun get-expanded-polygon (arg-obj &optional (r +outer-enclosure-r-fac+)) (let ((pl (point-list arg-obj))) (poly (make-segments (mapcar #'(lambda (p1 p2 p3) (let* ((s1 (angle-between* (x p1) (y p1) (x p2) (y p2))) (s2 (angle-between* (x p2) (y p2) (x p3) (y p3))) (s1s2 (/ (+ s1 s2) 2)) (x (x p2)) (y (y p2)) (x1a (+ x (* r (cos (+ +pi/2+ s1s2))))) (y1a (+ y (* r (sin (+ +pi/2+ s1s2))))) (x1b (+ x (* r (cos (+ s1s2 (- +pi/2+)))))) (y1b (+ y (* r (sin (+ s1s2 (- +pi/2+))))))) (if (not (inside-p* x1a y1a arg-obj)) (if (plusp r) (list x1a y1a) (list x1b y1b)) (if (plusp r) (list x1b y1b) (list x1a y1a))))) pl (append (cdr pl) (list (first pl))) (append (cddr pl) (list (first pl) (second pl)))))))) (defun make-segments (points) (mapcar #'(lambda (p1 p2) (let ((p1 (p (first p1) (second p1))) (p2 (p (first p2) (second p2)))) (l p1 p2))) (cons (first (last points)) points) points)) ;;; ;;; Konstruktoren ;;; (defun make-visco-query () (make-instance 'query)) (defmethod make-visco-marble ((transparency transparency) (status symbol) (x number) (y number) &rest initargs) (apply #'make-instance 'marble :query (query transparency) :on-transparency transparency :x x :y y :status status initargs)) (defmethod make-visco-nail ((transparency transparency) (status symbol) (x number) (y number) &rest initargs) (apply #'make-instance 'nail :query (query transparency) :on-transparency transparency :x x :y y :status status initargs)) (defmethod make-visco-origin ((transparency transparency) (status symbol) (x number) (y number) &rest initargs) (apply #'make-instance 'origin :query (query transparency) :on-transparency transparency :x x :y y :status status initargs)) (defmethod make-visco-op-derived-point ((transparency transparency) (status symbol) (x number) (y number) &rest initargs) (apply (get-constructor-for-derived-point x y (query transparency)) transparency status x y initargs)) (defun get-constructor-for-derived-point (x y query) (if (inside-any-enclosure-p* x y query) #'make-visco-marble #'make-visco-nail)) (defun get-classname-for-derived-point (x y query) (if (inside-any-enclosure-p* x y query) 'marble 'nail)) ;;; ;;; ;;; (defmethod make-visco-rubberband ((transparency transparency) (status symbol) (p1 point) (p2 point) &rest initargs) (apply #'make-instance 'rubberband :query (query transparency) :on-transparency transparency :p1 p1 :p2 p2 :status status initargs)) (defmethod make-visco-atomic-rubberband ((transparency transparency) (status symbol) (p1 point) (p2 point) &rest initargs) (apply #'make-instance 'atomic-rubberband :query (query transparency) :on-transparency transparency :p1 p1 :p2 p2 :status status initargs)) (defmethod make-visco-atomic-<=-rubberband ((transparency transparency) (status symbol) (p1 point) (p2 point) &rest initargs) (apply #'make-instance 'atomic-<=-rubberband :query (query transparency) :on-transparency transparency :p1 p1 :p2 p2 :status status initargs)) (defmethod make-visco-atomic->=-rubberband ((transparency transparency) (status symbol) (p1 point) (p2 point) &rest initargs) (apply #'make-instance 'atomic->=-rubberband :query (query transparency) :on-transparency transparency :p1 p1 :p2 p2 :status status initargs)) (defmethod make-visco-beam ((transparency transparency) (status symbol) (p1 point) (p2 point) &rest initargs) (apply #'make-instance 'beam :query (query transparency) :on-transparency transparency :p1 p1 :p2 p2 :status status initargs)) ;;; ;;; ;;; (defmethod make-visco-chain ((transparency transparency) (status symbol) (segments list) &rest initargs) (apply #'make-instance 'chain :query (query transparency) :on-transparency transparency :segments segments :status status initargs)) (defmethod make-visco-polygon ((transparency transparency) (status symbol) (segments list) &rest initargs) (apply #'make-instance 'polygon :query (query transparency) :on-transparency transparency :segments segments :status status initargs)) ;;; ;;; ;;; (defmethod make-visco-drawn-enclosure ((transparency transparency) (segments list) opaque-p &rest initargs) (apply #'make-instance 'drawn-enclosure :query (query transparency) :on-transparency transparency :segments segments :opaque-p opaque-p initargs)) (defmethod make-visco-inner-enclosure ((arg polygon) opaque-p &rest initargs) (apply #'make-instance 'inner-enclosure :query (query arg) :on-transparency (on-transparency arg) :arg-object arg :polygon (get-shrinked-polygon arg) :opaque-p opaque-p initargs)) (defmethod make-visco-outer-enclosure ((arg polygon) opaque-p &rest initargs) (apply #'make-instance 'outer-enclosure :query (query arg) :on-transparency (on-transparency arg) :arg-object arg :polygon (get-expanded-polygon arg) :opaque-p opaque-p initargs)) (defmethod make-visco-epsilon-enclosure ((arg query-object) (radius number) opaque-p &rest initargs) (apply #'make-instance 'epsilon-enclosure :query (query arg) :on-transparency (on-transparency arg) :arg-object arg :radius radius :opaque-p opaque-p initargs)) ;;; ;;; ;;; (defmethod make-visco-transparency ((query query) xmin ymin xmax ymax &rest initargs) (apply #'make-instance 'transparency :segments (let ((p1 (p xmin ymin)) (p2 (p xmax ymin)) (p3 (p xmax ymax)) (p4 (p xmin ymax))) (list (l p1 p2) (l p2 p3) (l p3 p4) (l p4 p1))) #| :bounding-box-p nil |# ; funktioniert nun! bei Matrixaenderung => reset-bb #| :xmin xmin :ymin ymin :xmax xmax :ymax ymax |# :query query initargs)) ;;; ;;; ;;; (defmethod get-objects-above ((obj query-object-or-enclosure)) (rest (member obj (get-all-query-objects-and-enclosures obj)))) (defmethod get-all-query-objects-and-enclosures ((obj visco-object)) (remove-if-not #'(lambda (obj) (typep obj 'query-object-or-enclosure)) (visco-objects (query obj)))) (defmethod get-all-query-objects-and-enclosures ((obj query)) (remove-if-not #'(lambda (obj) (typep obj 'query-object-or-enclosure)) (visco-objects obj))) (defmethod get-all-query-objects-and-enclosures ((obj null)) nil) ;;; ;;; ;;; (defmethod initialize ((new-obj query-object-or-enclosure) &rest initargs) (declare (ignore initargs)) (dolist (obj2 (get-all-query-objects-and-enclosures new-obj)) (calculate-and-store-relation new-obj obj2)) (push new-obj (transparency-query-objects-and-enclosures (on-transparency new-obj)))) (defmethod initialize ((new-obj chain-or-polygon) &rest initargs) (declare (ignore initargs)) (dolist (segment (segments new-obj)) (dolist (cs (constraints segment)) (let ((obj2 (2nd-arg cs))) (when (and (typep cs 'intersects) (not (eq obj2 new-obj)) (not (component-p obj2 new-obj))) (make-and-memoize-binary-constraint 'intersects new-obj obj2))))) (when (every #'(lambda (segment) (some #'(lambda (cs) (typep cs 'inside)) (constraints segment))) (segments new-obj)) (let ((containing-enclosures (reduce #'intersection (mapcar #'(lambda (segment) (mapcar #'2nd-arg (remove-if-not #'(lambda (cs) (typep cs 'inside)) (constraints segment)))) (segments new-obj))))) (dolist (enclosure containing-enclosures) (make-and-memoize-binary-constraint 'inside new-obj enclosure)))) (when (every #'(lambda (segment) (some #'(lambda (cs) (typep cs 'disjoint)) (constraints segment))) (segments new-obj)) (let ((disjoint-objects (reduce #'intersection (mapcar #'(lambda (segment) (mapcar #'2nd-arg (remove-if-not #'(lambda (cs) (typep cs 'disjoint)) (constraints segment)))) (segments new-obj))))) (dolist (obj2 disjoint-objects) (make-and-memoize-binary-constraint 'disjoint new-obj obj2)))) (push new-obj (transparency-query-objects-and-enclosures (on-transparency new-obj)))) (defmethod initialize ((new-obj derived-enclosure) &rest initargs) (declare (ignore initargs)) (let ((arg-obj (arg-object new-obj))) (dolist (obj2 (get-all-query-objects-and-enclosures new-obj)) (unless (eq obj2 arg-obj) (calculate-and-store-relation new-obj obj2)))) (push new-obj (transparency-query-objects-and-enclosures (on-transparency new-obj)))) (defmethod initialize ((new-obj visco-object) &rest initargs) (declare (ignore initargs)) t) ;;; ;;; ;;; (defmethod initialize :after ((new-obj visco-object) &rest initargs) (declare (ignore initargs)) (invalidate (query new-obj)) (pushend new-obj (visco-objects (query new-obj)))) (defmethod initialize :after ((new-obj origin) &rest initargs) (declare (ignore initargs)) (setf (origin (on-transparency new-obj)) new-obj)) (defmethod initialize :after ((new-obj name-mixin) &rest initargs) (declare (ignore initargs)) (unless (name new-obj) (setf (name new-obj) (get-next-name)))) (defmethod initialize :after ((new-obj chain-or-polygon) &rest initargs &key ignore-disjoint-and-intersects-component-relations-p) (declare (ignore initargs)) (when ignore-disjoint-and-intersects-component-relations-p (dolist (s (segments new-obj)) (setf (ignore-disjoint-and-intersects-relations-p s) t)))) (defmethod initialize :after ((new-obj line) &rest initargs &key ignore-disjoint-and-intersects-component-relations-p) (declare (ignore initargs)) (when ignore-disjoint-and-intersects-component-relations-p (setf (ignore-disjoint-and-intersects-relations-p (p1 new-obj)) t (ignore-disjoint-and-intersects-relations-p (p2 new-obj)) t))) ;;; ;;; ;;; (defmethod initialize-instance :after ((new-obj visco-object) &rest initargs &key &allow-other-keys) (apply #'initialize new-obj :allow-other-keys t initargs)) ;;; ;;; ;;; (defmethod update-instance-for-different-class :after ((old geom-thing) (new query-object-or-enclosure) &key &allow-other-keys) (unless (typep old 'visco-object) (initialize new))) ;;; ;;; ;;; (defmethod delete-object progn ((obj constraints-mixin) &key) (dolist (constraint (constraints obj)) (let ((obj2 (2nd-arg constraint))) (remove-eventually-present-constraints obj obj2)))) (defmethod delete-object progn ((obj query-object) &key (delete-component-objects-p t)) (dolist (part (get-direct-components obj)) (setf (part-of part) (delete obj (part-of part))) (when (and delete-component-objects-p (primary-p part) (=> (typep part 'possible-operator-result-mixin) (not (res-of-operators part)))) (delete-object part)))) (defmethod delete-object progn ((obj drawn-enclosure) &key) (dolist (part (get-direct-components obj)) (setf (part-of part) (delete obj (part-of part))))) (defmethod delete-object progn ((obj origin) &keY) (setf (origin (on-transparency obj)) nil)) (defmethod delete-object progn ((obj transparency) &key (delete-component-objects-p t)) (when delete-component-objects-p (dolist (transparency-obj (transparency-query-objects-and-enclosures obj)) (delete-object transparency-obj)))) (defmethod delete-object progn ((obj visco-object) &key) (let ((query (query obj))) (invalidate query) (setf (visco-objects query) (delete obj (visco-objects query))))) (defmethod delete-object progn ((obj on-transparency-mixin) &key) (let ((transparency (on-transparency obj))) (setf (transparency-query-objects-and-enclosures transparency) (delete obj (transparency-query-objects-and-enclosures transparency))))) (defmethod delete-object progn ((obj possible-operator-result-mixin) &key) (dolist (op (res-of-operators obj)) (dolist (arg (args op)) (setf (arg-of-operators arg) (delete op (arg-of-operators arg)))))) (defmethod delete-object progn ((obj possible-operator-argument-mixin) &key) (dolist (dependent (mapcar #'res (arg-of-operators obj))) (delete-object dependent))) ;;; ;;; Achtung: new-obj ist stets vollstaendig sichtbar! ;;; Hier werden zunaechst alle sichtbaren Relationen erzeugt, unabh. davon, ob ;;; die Relation relevant ist oder redundant. Die Oberflaeche macht KEINE INFERENZEN! (bis auf WYSIWYG-Bestimmung) ;;; Erst der Compiler nimmt dann evtl. eine Normalisierung vor und entfernt redundante ;;; Constraints. Die einzigen Relationen, die nicht angelegt werden, sind Relationen ;;; zwischen Master-Komponente-Objekten. ;;; (defmethod calculate-and-store-relation ((new-obj point) (obj2 point)) #| (make-and-memoize-binary-constraint 'disjoint new-obj obj2)) |# ) (defmethod calculate-and-store-relation ((new-obj point) (obj2 line)) (if (and (< (distance-between new-obj obj2) +intersects-threshold+) (fully-visible-p new-obj (get-objects-above obj2))) (make-and-memoize-binary-constraint 'intersects new-obj obj2) (when (fully-visible-p obj2) (make-and-memoize-binary-constraint 'disjoint new-obj obj2)))) (defmethod calculate-and-store-relation ((new-obj line) (obj2 point)) (when (fully-visible-p obj2) (if (< (distance-between new-obj obj2) +intersects-threshold+) (unless (component-p obj2 new-obj) (make-and-memoize-binary-constraint 'intersects new-obj obj2)) (make-and-memoize-binary-constraint 'disjoint new-obj obj2)))) (defmethod calculate-and-store-relation ((new-obj line) (obj2 line)) (let ((rel (calculate-relation new-obj obj2 :detailed nil))) (case rel (disjoint (if (or (find-constraint 'intersects (p1 new-obj) obj2) (find-constraint 'intersects (p2 new-obj) obj2) (< (distance-between new-obj obj2) +intersects-threshold+)) (make-and-memoize-binary-constraint 'intersects new-obj obj2) (when (fully-visible-p obj2) (make-and-memoize-binary-constraint 'disjoint new-obj obj2)))) ((touches crosses) (multiple-value-bind (ix iy) (calculate-intersection-point new-obj obj2) (when (point-visible-p* ix iy (get-objects-above obj2)) (make-and-memoize-binary-constraint 'intersects new-obj obj2)))) (1d-intersects (setf (1d-intersects-other-lines-p new-obj) t) (multiple-value-bind (x1 y1 x2 y2) (calculate-intersection-line new-obj obj2) (when (one-part-visible-p* x1 y1 x2 y2 (get-objects-above obj2) (query obj2)) (make-and-memoize-binary-constraint 'intersects new-obj obj2))))))) ;;; ;;; ENCLOSURES ;;; (defmethod calculate-and-store-relation ((new-obj query-object) (obj2 enclosure)) (when (and (or (typep new-obj 'point) (typep new-obj 'line)) (asg-inside-p new-obj obj2) (fully-visible-p new-obj (get-objects-above obj2))) (make-and-memoize-binary-constraint 'inside new-obj obj2))) (defmethod calculate-and-store-relation ((new-obj enclosure) (obj2 query-object)) (when (and (not (opaque-p new-obj)) (or (typep obj2 'point) (typep obj2 'line)) (asg-inside-p obj2 new-obj) (fully-visible-p obj2) (=> (typep new-obj 'derived-enclosure) (and (not (eq obj2 (arg-object new-obj))) (not (component-p obj2 (arg-object new-obj)))))) (make-and-memoize-binary-constraint 'contains new-obj obj2))) ;;; ;;; ;;; (defmethod calculate-and-store-relation ((new-obj enclosure) (obj2 chain-or-polygon)) (when (every #'(lambda (segment) ; da die Relationen fuer die Segment vorher berechnet werden => OK! (find-constraint 'inside segment new-obj)) (segments obj2)) (make-and-memoize-binary-constraint 'contains new-obj obj2))) (defmethod memoize-constraints-to-chain-or-polygon ((new-obj query-object) (obj2 chain-or-polygon)) (when (some #'(lambda (segment) (find-constraint 'intersects segment new-obj)) (segments obj2)) (make-and-memoize-binary-constraint 'intersects new-obj obj2)) (when (every #'(lambda (segment) (find-constraint 'disjoint segment new-obj)) (segments obj2)) (make-and-memoize-binary-constraint 'disjoint new-obj obj2))) (defmethod calculate-and-store-relation ((new-obj point) (obj2 chain-or-polygon)) (memoize-constraints-to-chain-or-polygon new-obj obj2)) (defmethod calculate-and-store-relation ((new-obj line) (obj2 chain-or-polygon)) (memoize-constraints-to-chain-or-polygon new-obj obj2)) ;;; ;;; ;;; (defmethod calculate-and-store-relation ((new-obj origin) (obj2 transparency)) nil) ; Folienhierarchie aufbauen ! (defmethod calculate-and-store-relation ((new-obj visco-object) (obj2 visco-object)) nil) ; nichts tun ! ;;; ;;; ;;; (defmethod asg-inside-p ((obj geom-thing) (enclosure drawn-enclosure)) (if (negated-p enclosure) (outside-p obj enclosure) (inside-p obj enclosure))) (defmethod asg-inside-p ((obj geom-thing) (enclosure inner-enclosure)) (inside-p obj (polygon enclosure))) (defmethod asg-inside-p ((obj geom-thing) (enclosure outer-enclosure)) (outside-p obj (polygon enclosure))) (defmethod asg-inside-p ((obj geom-thing) (enclosure epsilon-enclosure)) (inside-epsilon-p obj (arg-object enclosure) (radius enclosure))) ;;; ;;; ;;; (defmethod asg-inside-p* (x y (enclosure drawn-enclosure)) (if (negated-p enclosure) (outside-p* x y enclosure) (inside-p* x y enclosure))) (defmethod asg-inside-p* (x y (enclosure inner-enclosure)) (inside-p* x y (polygon enclosure))) (defmethod asg-inside-p* (x y (enclosure outer-enclosure)) (outside-p* x y (polygon enclosure))) (defmethod asg-inside-p* (x y (enclosure epsilon-enclosure)) (inside-epsilon-p* x y (arg-object enclosure) (radius enclosure))) ;;; ;;; ;;; (defmethod asg-outside-p ((obj geom-thing) (enclosure drawn-enclosure)) (if (negated-p enclosure) (inside-p obj enclosure) (outside-p obj enclosure))) (defmethod asg-outside-p ((obj geom-thing) (enclosure inner-enclosure)) (outside-p obj (polygon enclosure))) (defmethod asg-outside-p ((obj geom-thing) (enclosure outer-enclosure)) (inside-p obj (polygon enclosure))) (defmethod asg-outside-p ((obj geom-thing) (enclosure epsilon-enclosure)) (not (inside-epsilon-p obj (arg-object enclosure) (radius enclosure)))) ;;; ;;; ;;; (defmethod asg-outside-p* (x y (enclosure drawn-enclosure)) (if (negated-p enclosure) (inside-p* x y enclosure) (outside-p* x y enclosure))) (defmethod asg-outside-p* (x y (enclosure inner-enclosure)) (outside-p* x y (polygon enclosure))) (defmethod asg-outside-p* (x y (enclosure outer-enclosure)) (inside-p* x y (polygon enclosure))) (defmethod asg-outside-p* (x y (enclosure epsilon-enclosure)) (not (inside-epsilon-p* x y (arg-object enclosure) (radius enclosure)))) ;;; ;;; ;;; (defmethod point-visible-p ((point point) &optional (objects-above (get-objects-above point))) (point-visible-p* (x point) (y point) objects-above)) (defun point-visible-p* (x y objects-above) (dolist (obj objects-above) (when (and (typep obj 'enclosure) (opaque-p obj) (asg-inside-p* x y obj)) (return-from point-visible-p* nil))) t) (defmethod fully-visible-p ((obj point) &optional (objects-above (get-objects-above obj))) (point-visible-p obj objects-above)) (defmethod fully-visible-p ((line geom-line) &optional (objects-above (get-objects-above line))) (dolist (obj objects-above) (when (and (typep obj 'enclosure) (opaque-p obj) (asg-inside-p line obj)) (return-from fully-visible-p nil))) t) (defun one-part-visible-p* (x1 y1 x2 y2 objects-above &optional (threshold 2.0)) (let ((xm (/ (+ x1 x2) 2)) (ym (/ (+ y1 y2) 2))) (or (point-visible-p* xm ym objects-above) (and (>= (distance-between* x1 y1 x2 y2) threshold) (or (one-part-visible-p* x1 y1 xm ym objects-above threshold) (one-part-visible-p* xm ym x2 y2 objects-above threshold)))))) (defun inside-any-enclosure-p* (x y query) (some #'(lambda (obj) (when (typep obj 'enclosure) (asg-inside-p* x y obj))) (get-all-query-objects-and-enclosures query))) ;;; ;;; ;;; (defmethod get-present-point-at ((query query) (x number) (y number)) (dolist (obj2 (get-all-query-objects-and-enclosures query)) (when (and (typep obj2 'geom-point) (= x (x obj2)) (= y (y obj2))) (return-from get-present-point-at obj2)))) ;;; ;;; ;;; (defmethod sx-type ((transparency transparency)) (when (or (not (width transparency)) (not (sxmin transparency)) (not (sxmax transparency)) (and (sxmin transparency) (sxmax transparency) (not (= (sxmin transparency) (sxmax transparency))))) 'free)) (defmethod sy-type ((transparency transparency)) (when (or (not (height transparency)) (not (symin transparency)) (not (symax transparency)) (and (symin transparency) (symax transparency) (not (= (symin transparency) (symax transparency))))) (if (and (sxsy-constraint transparency) (eq (sx-type transparency) 'free)) 'fac 'free))) (defmethod rot-type ((transparency transparency)) (unless (equal '(0) (orientation-constraint (origin transparency))) 'free)) (defmethod no-of-required-nails-without-origin ((transparency transparency)) (let ((sxt (sx-type transparency)) (syt (sy-type transparency)) (rt (rot-type transparency))) (cond ((or (and (not sxt) (not syt) (not rt)) (not (rest (transparency-query-objects-and-enclosures transparency)))) 0) ((or (and (not sxt) (not syt) rt) (and sxt (not syt)) (and (not sxt) syt) (and sxt (eq syt 'fac)) (and sxt syt (not rt))) ; Achtung: es wird verlangt, dass hier ueber einen Punkt instantiiert wird! 1) ((and sxt syt rt) 2) (t (error "!"))))) ;;; ;;; ;;; (defmethod bound-to ((obj transparency)) obj) (defmethod bound-to ((obj derived-enclosure)) (arg-object obj)) (defmethod bound-to ((obj drawn-enclosure)) obj) (defmethod on-transparency ((obj transparency)) ; ??? obj) ;;; ;;; Achtung: unvollstaendig, da die Constraints z.B. Marbles zu Nails machen koennen, etc. ;;; Normalisierung (Inferenz) fehlt! ;;; (defmethod may-vary-p ((obj point)) (typep obj 'marble)) (defmethod may-vary-p ((obj line)) (or (may-vary-p (p1 obj)) (may-vary-p (p2 obj)) (typep obj 'rubberband))) (defmethod may-vary-p ((obj chain-or-polygon)) (some #'may-vary-p (segments obj))) (defmethod may-vary-p ((obj drawn-enclosure)) nil) (defmethod may-vary-p ((obj derived-enclosure)) (may-vary-p (arg-object obj)))
31,912
Common Lisp
.lisp
767
37.45502
133
0.695368
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
91bf46559b8e379dcd3b992ae2710f4d2ebba8e298c7fd1c591a5d2c9a8c2dc5
11,687
[ -1 ]
11,688
constraints4.lisp
lambdamikel_VISCO/src/ASG/constraints4.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: QUERY-COMPILER; Base: 10 -*- (in-package query-compiler) ;;; ;;; Constraints sind stets unidirektional ("->"-Kante, es gibt jedoch IMMER eine entsp. Inverse!) ;;; Constraint sind stets binaer: unaere Constraints werden im Query-Objekt selbst modelliert ;;; (werden hineinkomponiert). ;;; (defpersistentclass constraints-mixin () ((constraints :accessor constraints :initform nil))) ;;; ;;; ;;; (defpersistentclass constraint () ()) (defpersistentclass binary-constraint (constraint) ((1st-arg :accessor 1st-arg :initarg :1st-arg) (2nd-arg :accessor 2nd-arg :initarg :2nd-arg))) ;;; ;;; Die folgenden Constraints werden auf der Oberflaeche (bzw. durch die Sprache) erzeugt: ;;; (defpersistentclass disjoint (binary-constraint) ()) (defpersistentclass inside (binary-constraint) ()) (defpersistentclass contains (binary-constraint) ()) (defpersistentclass intersects (binary-constraint) ()) (defpersistentclass angle-between (binary-constraint) ((allowed-derivation :accessor allowed-derivation :initarg :allowed-derivation))) ;;; ;;; ;;; (defun inverse (rel) (case rel (inside 'contains) (contains 'inside) (outside 'excludes) (excludes 'outside) (inside-epsilon 'epsilon-contains) (epsilon-contains 'inside-epsilon) (otherwise rel))) (defmethod find-constraint ((symbol symbol) (obj1 constraints-mixin) (obj2 constraints-mixin)) (find-if #'(lambda (constraint) (and (typep constraint symbol) (eq (2nd-arg constraint) obj2))) (constraints obj1))) (defmethod find-and-delete-constraint ((symbol symbol) (obj1 constraints-mixin) (obj2 constraints-mixin)) (setf (constraints obj1) (delete (find-constraint symbol obj1 obj2) (constraints obj1))) (setf (constraints obj2) (delete (find-constraint (inverse symbol) obj2 obj1) (constraints obj2)))) (defmethod make-and-memoize-binary-constraint ((symbol symbol) (obj1 constraints-mixin) (obj2 constraints-mixin) &rest initargs) (if (eq obj1 obj2) (error "No constraint!") (progn (unless (find-constraint symbol obj1 obj2) (push (apply #'make-instance symbol :1st-arg obj1 :2nd-arg obj2 initargs) (constraints obj1)) (push (apply #'make-instance (inverse symbol) :1st-arg obj2 :2nd-arg obj1 initargs) (constraints obj2)))))) ;;; ;;; ;;; (defun remove-eventually-present-constraints (&rest args) (when (every #'(lambda (obj) (typep obj 'constraints-mixin)) args) (dolist (i args) (dolist (constraint (constraints i)) (when (member (2nd-arg constraint) args) (setf (constraints i) (delete constraint (constraints i))))))))
2,835
Common Lisp
.lisp
89
27.280899
97
0.68626
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
9bd6b4ed90ccdead1f9941344417bfa807cfdad62319764153f0ff8a3980e091
11,688
[ -1 ]
11,689
status2.lisp
lambdamikel_VISCO/src/ASG/status2.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: QUERY-COMPILER; Base: 10 -*- (in-package query-compiler) ;;; ;;; Status ;;; (defun status-of-chain-or-polygon-object-ok-p (status type components) (declare (ignore type)) (case status (universe (every #'instantiable-object-p components)) ((db db-component) (every #'(lambda (component) (and (member (status component) '(db db-component)) (=> (eq (status component) 'db) (change-status-applicable-p component 'db-component)))) components)) (otherwise nil))) (defun status-of-line-object-ok-p (status type components) (case status (universe (and (every #'instantiable-object-p components) (=> (eq type 'rubberband) (every #'(lambda (component) (eq (status component) 'db-component)) components)))) ((db db-component) (every #'(lambda (component) (and (member (status component) '(db db-component)) (=> (eq (status component) 'db) (change-status-applicable-p component 'db-component)))) components)) (otherwise nil))) (defun status-of-point-object-ok-p (status type res-of-operator) (if (eq status 'universe) (case type ((origin nail) t) (marble res-of-operator)) (member status '(db db-component)))) ;;; ;;; ;;; (defmethod change-status-of-component-objects ((obj at-least-1d-query-object)) (when (member (status obj) '(db db-component)) (dolist (component (get-direct-components obj)) (set-status component 'db-component)) obj)) ;;; ;;; ;;; (defmethod instantiable-object-p ((obj marble)) (=> (eq (status obj) 'universe) (res-of-operators obj))) (defmethod instantiable-object-p ((obj nail)) t) ; weil Koordinaten bekannt! (defmethod instantiable-object-p ((obj at-least-1d-query-object)) ; fuer Linien, Ketten, Polygone (every #'(lambda (part) (instantiable-object-p part)) (get-direct-components obj))) ;;; ;;; ;;; (defmethod change-status-applicable-p ((obj query-object) (status (eql 'db))) (and (primary-p obj) (every #'(lambda (component) (change-status-applicable-p component 'db-component)) (get-direct-components obj)))) (defmethod change-status-applicable-p ((obj query-object) (status (eql 'db-component))) (and (not (typep obj 'polygon)) (every #'(lambda (component) (change-status-applicable-p component 'db-component)) (get-direct-components obj)))) (defmethod change-status-applicable-p ((obj query-object) (status (eql 'universe))) (instantiable-object-p obj)) (defmethod change-status-applicable-p ((obj point) (status (eql 'universe))) (every #'(lambda (master) (not (typep master 'rubberband))) (part-of obj))) (defmethod change-status-applicable-p ((obj marble) (status (eql 'universe))) (res-of-operators obj)) (defmethod change-status-applicable-p ((obj origin) (status (eql 'universe))) nil) ;;; ;;; ;;; (defmethod set-status ((obj query-object) (status (eql 'db))) (when (and (every #'(lambda (master) (change-status-applicable-p master 'universe)) (part-of obj)) (every #'(lambda (part) (change-status-applicable-p part 'db-component)) (get-direct-components obj))) (setf (status obj) 'db) (dolist (part (get-direct-components obj)) (set-status part 'db-component)) (dolist (master (part-of obj)) (set-status master 'universe)))) (defmethod set-status ((obj query-object) (status (eql 'db-component))) (when (every #'(lambda (part) (change-status-applicable-p part 'db-component)) (get-direct-components obj)) (setf (status obj) 'db-component) (dolist (part (get-direct-components obj)) (set-status part 'db-component)))) (defmethod set-status ((obj query-object) (status (eql 'universe))) (when (every #'(lambda (master) (change-status-applicable-p master 'universe)) (part-of obj)) (setf (status obj) 'universe) (dolist (master (part-of obj)) (set-status master 'universe))))
4,084
Common Lisp
.lisp
114
31.114035
97
0.65965
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
0bda00ac745d52ed30ec399ba4e5f74465e581dee92c209fccf47cff00e32207
11,689
[ -1 ]
11,690
ops10.lisp
lambdamikel_VISCO/src/ASG/ops10.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: QUERY-COMPILER; Base: 10 -*- (in-package query-compiler) (eval-when (:compile-toplevel :load-toplevel) (defun get-args (lambda-list) (dolist (item '(&rest &optional &key)) (setf lambda-list (remove item lambda-list))) (mapcar #'(lambda (entry) (if (listp entry) (first entry) entry)) lambda-list))) (eval-when (:compile-toplevel :load-toplevel) (defmacro defoperator (name lambda-list (&key stored-operator additional-slots after-code) (&key precondition) (&key code)) (let ((precond-name (intern (format nil "~A-APPLICABLE-P" name))) (apply-name (intern (format nil "APPLY-~A" name)))) `(progn ,(when precondition `(progn (defmethod ,precond-name ,(mapcar #'(lambda (lambda-entry) (if (listp lambda-entry) (first lambda-entry) lambda-entry)) lambda-list) (declare (ignore ,@(get-args lambda-list))) nil) (defmethod ,precond-name ,lambda-list ,@precondition))) ,(if stored-operator `(progn (defpersistentclass ,name (operator) ,(mapcar #'(lambda (slot) `(,slot :accessor ,slot :initarg ,(intern (string-upcase (write-to-string slot)) (find-package 'keyword)))) additional-slots)) (defmethod ,apply-name ,lambda-list ,(let ((args (get-args lambda-list))) `(if (apply #',precond-name ,@args ,@(unless (member '&rest lambda-list) '(nil))) (multiple-value-bind (result args initargs) ,@code (let ((operator (apply #'make-instance ',name :res result :args args initargs))) (push operator (res-of-operators result)) (dolist (arg args) (push operator (arg-of-operators arg))) ,@(when after-code (list after-code)) result)) 'not-applicable)))) `(defmethod ,apply-name ,lambda-list ,(let ((args (get-args lambda-list))) `(if (apply #',precond-name ,@args ,@(unless (member '&rest lambda-list) '(nil))) ,@code 'not-applicable)))))))) ;;; ;;; ;;; (defpersistentclass operator () ((args :accessor args :initarg :args) (res :accessor res :initarg :res))) (defmethod binary-operator-p ((op operator)) (null (rest (args op)))) ;;; ;;; ;;; ;;; ;;; Hier fehlen die at-most-Constraint-Checks fuer die Enclosures! Der Opererator ist noch nicht implementiert, da kompliziert. ;;; m.a.W.: ein Objekt darf nicht in eine Enclosure gesetzt werden, wenn dadurch der at-most Constraint der Enclosure verletzt wird. ;;; #| ; (=> primary-p (let ((p (apply #'make-visco-marble transparency status x y :dont-initialize t initargs))) (with-temporary-inserted-object (p) (call-all-enclosure-at-most-constraints p)))) |# (defoperator create-transparency ((query query) xmin ymin xmax ymax &rest initargs) (:stored-operator nil) (:precondition ((declare (ignore initargs)) (not (zerop (* (- xmax xmin) (- ymax ymin)))))) (:code ((apply #'make-visco-transparency query xmin ymin xmax ymax initargs)))) ;;; ;;; ;;; (defun check-point (x y status type operator-result transparency) (and (not (get-present-point-at (query transparency) x y)) (status-of-point-object-ok-p status type operator-result) (inside-p* x y transparency) (every #'(lambda (obj) (=> (typep obj 'point) (> (distance-between* x y (x obj) (y obj)) +intersects-threshold+))) (visco-objects (query transparency))))) (defoperator create-marble ((transparency transparency) (status symbol) (x number) (y number) operator-result &rest initargs) (:stored-operator nil) (:precondition ((declare (ignore initargs)) (and (check-point x y status 'marble operator-result transparency) (inside-any-enclosure-p* x y (query transparency))))) (:code ((apply #'make-visco-marble transparency status x y initargs)))) (defoperator create-nail ((transparency transparency) (status symbol) (x number) (y number) operator-result &rest initargs) (:stored-operator nil) (:precondition ((declare (ignore initargs)) (check-point x y status 'nail operator-result transparency))) (:code ((apply #'make-visco-nail transparency status x y initargs)))) (defoperator create-origin ((transparency transparency) (status symbol) (x number) (y number) operator-result &rest initargs) (:stored-operator nil) (:precondition ((declare (ignore initargs)) (and (not (origin transparency)) (check-point x y status 'origin operator-result transparency)))) (:code ((apply #'make-visco-origin transparency status x y initargs)))) ;;; ;;; ;;; (defun same-transparency-p (&rest args) (let ((transparency (on-transparency (first args)))) (every #'(lambda (arg) (eq (on-transparency arg) transparency)) (rest args)))) (defun check-line (p1 p2 status type) (and (same-transparency-p p1 p2) (not (point-=-p p1 p2)) (not (get-already-present-direct-master p1 p2)) (status-of-line-object-ok-p status type (list p1 p2)) (fully-visible-p p1) (fully-visible-p p2))) ;;; ;;; ;;; (defoperator create-rubberband ((transparency transparency) (status symbol) (p1 point) (p2 point) &rest initargs) (:stored-operator nil) (:precondition ((declare (ignore initargs)) (check-line p1 p2 status 'rubberband))) (:code ((let ((obj (apply #'make-visco-rubberband transparency status p1 p2 initargs))) (change-status-of-component-objects obj) obj)))) (defoperator create-atomic-rubberband ((transparency transparency) (status symbol) (p1 point) (p2 point) &rest initargs) (:stored-operator nil) (:precondition ((declare (ignore initargs)) (check-line p1 p2 status 'atomic-rubberband))) (:code ((let ((obj (apply #'make-visco-atomic-rubberband transparency status p1 p2 initargs))) (change-status-of-component-objects obj) obj)))) (defoperator create-atomic-<=-rubberband ((transparency transparency) (status symbol) (p1 point) (p2 point) &rest initargs) (:stored-operator nil) (:precondition ((declare (ignore initargs)) (check-line p1 p2 status 'atomic-<=-rubberband))) (:code ((let ((obj (apply #'make-visco-atomic-<=-rubberband transparency status p1 p2 initargs))) (change-status-of-component-objects obj) obj)))) (defoperator create-atomic->=-rubberband ((transparency transparency) (status symbol) (p1 point) (p2 point) &rest initargs) (:stored-operator nil) (:precondition ((declare (ignore initargs)) (check-line p1 p2 status 'atomic->=-rubberband))) (:code ((let ((obj (apply #'make-visco-atomic->=-rubberband transparency status p1 p2 initargs))) (change-status-of-component-objects obj) obj)))) (defoperator create-beam ((transparency transparency) (status symbol) (p1 point) (p2 point) &rest initargs) (:stored-operator nil) (:precondition ((declare (ignore initargs)) (check-line p1 p2 status 'beam))) (:code ((let ((obj (apply #'make-visco-beam transparency status p1 p2 initargs))) (change-status-of-component-objects obj) obj)))) ;;; ;;; ;;; (defmethod check-chain-or-polygon ((transparency transparency) (status symbol) (segments list) (type symbol)) (and (apply #'same-transparency-p segments) (every #'(lambda (segment) (typep segment 'line)) segments) (segment-list-ok-p segments type nil) (let ((master (apply #'get-already-present-direct-master segments))) (=> master (not (and (= (length (segments master)) (length segments)) (every #'(lambda (i) (= 1 (count-if #'(lambda (j) (equal-p i j)) (segments master)))) segments))))) (status-of-chain-or-polygon-object-ok-p status type segments) (every #'fully-visible-p segments))) (defoperator create-chain ((transparency transparency) (status symbol) (segments list) &rest initargs) (:stored-operator nil) (:precondition ((declare (ignore initargs)) (check-chain-or-polygon transparency status segments 'chain))) (:code ((let ((obj (apply #'make-visco-chain transparency status segments initargs))) (change-status-of-component-objects obj) obj)))) (defoperator create-polygon ((transparency transparency) (status symbol) (segments list) &rest initargs) (:stored-operator nil) (:precondition ((declare (ignore initargs)) (check-chain-or-polygon transparency status segments 'polygon))) (:code ((let ((obj (apply #'make-visco-polygon transparency status segments initargs))) (change-status-of-component-objects obj) obj)))) ;;; ;;; durch Malen eines Polygones: ;;; (defoperator create-drawn-enclosure ((transparency transparency) (segments list) opaque-p &rest initargs) (:stored-operator nil) (:precondition ((declare (ignore initargs opaque-p)) (and (every #'(lambda (segment) (and (typep segment 'geom-line) (inside-p segment transparency) (not (typep segment 'line)))) ; ausschliesslich geom-lines o.ae.! segments) (segment-list-ok-p segments 'polygon nil)))) (:code ((apply #'make-visco-drawn-enclosure transparency segments opaque-p initargs)))) ;;; ;;; Abgeleitete Objekte => Konstruktor-Operatoren ;;; (defoperator create-inner-enclosure ((obj polygon) opaque-p &rest initargs) (:stored-operator t :after-code (initialize result)) (:precondition ((declare (ignore initargs opaque-p)) t)) (:code ((values (apply #'make-visco-inner-enclosure obj opaque-p :dont-initialize t initargs) (list obj))))) (defoperator create-outer-enclosure ((obj polygon) opaque-p &rest initargs) (:stored-operator t :after-code (initialize result)) (:precondition ((declare (ignore initargs opaque-p)) t)) (:code ((values (apply #'make-visco-outer-enclosure obj opaque-p :dont-initialize t initargs) (list obj))))) ;;; ;;; ;;; (defoperator create-epsilon-enclosure ((obj query-object) (radius number) opaque-p &rest initargs) (:stored-operator t :additional-slots (radius) :after-code (initialize result)) (:precondition ((declare (ignore initargs opaque-p)) (< radius (distance-between obj (on-transparency obj))))) (:code ((values (apply #'make-visco-epsilon-enclosure obj radius opaque-p :dont-initialize t initargs) (list obj) (list :radius radius))))) (defoperator create-epsilon-p-enclosure ((obj polygon) (radius number) opaque-p &rest initargs) (:stored-operator t :additional-slots (radius) :after-code (initialize result)) (:precondition ((declare (ignore initargs opaque-p)) (< radius (distance-between obj (on-transparency obj))))) (:code ((values (apply #'make-visco-epsilon-p-enclosure obj radius opaque-p :dont-initialize t initargs) (list obj) (list :radius radius))))) (defoperator create-epsilon-m-enclosure ((obj polygon) (radius number) opaque-p &rest initargs) (:stored-operator t :additional-slots (radius) :after-code (initialize result)) (:precondition ((declare (ignore initargs opaque-p)) (< radius (distance-between obj (on-transparency obj))))) (:code ((values (apply #'make-visco-epsilon-m-enclosure obj radius opaque-p :dont-initialize t initargs) (list obj) (list :radius radius))))) ;;; ;;; ;;; (defoperator create-centroid ((obj at-least-1d-query-object) (status symbol) (class-instance point) &rest initargs) (:stored-operator t) (:precondition ((declare (ignore initargs)) (let* ((centroid (centroid obj)) (pp (get-present-point-at (query obj) (x centroid) (y centroid)))) (and (not (some #'(lambda (op) (typep op 'create-centroid)) (arg-of-operators obj))) (if pp (typep pp (type-of class-instance)) (etypecase class-instance (marble (create-marble-applicable-p (on-transparency obj) status (x centroid) (y centroid) t)) (origin (create-origin-applicable-p (on-transparency obj) status (x centroid) (y centroid) t)) (nail (create-nail-applicable-p (on-transparency obj) status (x centroid) (y centroid) t)))))))) (:code ((let* ((centroid (centroid obj)) (pp (get-present-point-at (query obj) (x centroid) (y centroid)))) (values (if pp (progn (initialize pp) pp) (apply #'change-class centroid (type-of class-instance) :on-transparency (on-transparency obj) :query (query obj) :status status initargs)) (list obj)))))) (defoperator create-intersection-point ((obj1 line) (obj2 line) (status symbol) (class-instance point) &rest initargs) (:stored-operator t) (:precondition ((declare (ignore initargs)) (and (same-transparency-p obj1 obj2) (not (eq obj1 obj2)) #| (find-constraint 'intersects obj1 obj2) |# (crosses-p obj1 obj2) (not (ignore-disjoint-and-intersects-relations-p obj1)) (not (ignore-disjoint-and-intersects-relations-p obj2)) (crosses-p obj1 obj2) (not (some #'(lambda (op) ; Schnittpkt. existiert noch nicht (typep op 'create-intersection-point)) (intersection ; gem. Ops. (arg-of-operators obj1) (arg-of-operators obj2)))) (multiple-value-bind (ix iy) (calculate-intersection-point obj1 obj2) (let ((pp (get-present-point-at (query obj1) ix iy))) (if pp (typep pp (type-of class-instance)) (etypecase class-instance (marble (create-marble-applicable-p (on-transparency obj1) status ix iy t)) (origin (create-origin-applicable-p (on-transparency obj1) status ix iy t)) (nail (create-nail-applicable-p (on-transparency obj1) status ix iy t))))))))) (:code ((multiple-value-bind (ix iy) (calculate-intersection-point obj1 obj2) (let ((pp (get-present-point-at (query obj1) ix iy))) (values (if pp (progn (initialize pp) pp) (apply (etypecase class-instance (marble #'apply-create-marble) (origin #'apply-create-origin) (nail #'apply-create-nail)) (on-transparency obj1) status ix iy t initargs)) (list obj1 obj2))))))) ;;; ;;; Thematik / Semantik (DL-Konzepte o.”.): ;;; (defoperator set-semantics ((obj query-object) semantics) (:stored-operator nil) (:precondition ((and (matches-with-database-object-p obj) semantics))) (:code ((progn (setf (semantics obj) (if (consp semantics) semantics (list semantics))) obj)))) (defoperator delete-semantics ((obj query-object)) (:stored-operator nil) (:precondition ((semantics obj))) (:code ((progn (setf (semantics obj) nil) obj)))) ;;; ;;; ;;; #| ; (defmethod get-all-visible-containing-enclosures ((obj query-object)) (loop as obj2 in (get-all-query-objects-and-enclosures obj) when (and (typep obj2 'enclosure) (fully-visible-p obj)) collect obj2)) (defmethod check-at-most-constraint ((obj enclosure) (at-most integer)) (<= (count-if #'(lambda (cs) (and (typep cs 'contains) (matches-with-database-object-p (2nd-arg cs)) (primary-p (2nd-arg cs)))) (constraints obj)) at-most)) (defmethod check-all-enclosure-at-most-constraints ((obj query-object)) (every #'(lambda (enclosure) (=> (at-most-constraint enclosure) (check-at-most-constraint enclosure (at-most-constraint enclosure)))) (get-all-visible-containing-enclosures obj))) |# ;;; ;;; ;;; (defoperator set-at-most-constraint ((obj rubberband) (at-most integer)) (:stored-operator nil) (:precondition ((> at-most 0))) (:code ((progn (setf (at-most-constraint obj) at-most) (dolist (master (part-of obj)) (when (every #'(lambda (s) (or (typep s 'atomic-rubberband) (at-most-constraint s))) (segments master)) (setf (at-most-constraint master) (loop as s in (segments master) sum (if (typep s 'atomic-rubberband) 1 (at-most-constraint s)))))) obj)))) (defoperator set-at-most-constraint ((obj chain-or-polygon) (at-most integer)) (:stored-operator nil) (:precondition ((and (<= (length (segments obj)) at-most) (some #'(lambda (segment) (and (typep segment 'rubberband) (not (typep segment 'atomic-rubberband)))) (segments obj))))) (:code ((progn (setf (at-most-constraint obj) (if (at-most-constraint obj) (min at-most (at-most-constraint obj)) at-most)) (let ((n (length (segments obj)))) (dolist (s (segments obj)) (when (typep s 'rubberband) (setf (at-most-constraint s) (if (at-most-constraint s) (min (at-most-constraint s) (1+ (- at-most n))) (1+ (- at-most n))))))) obj)))) #| ; ;;; ;;; noch nicht implementiert => damit "at-most" Subsumption stimmt, muss inside(enclosure1,enclosure2) ;;; auch zwischen epsilon-enclosures berechnet werden! ;;; (defoperator set-at-most-constraint ((obj enclosure) (at-most integer)) (:stored-operator nil) (:precondition (check-at-most-constraint obj at-most)) (:code (progn (setf (at-most-constraint obj) at-most) obj))) |# (defoperator delete-at-most-constraint ((obj at-most-constraint-mixin)) (:stored-operator nil) (:precondition ((at-most-constraint obj))) (:code ((progn (setf (at-most-constraint obj) nil) obj)))) ;;; ;;; ;;; (defun check-orientation-constraint-p (orientation-constraint) ; (a b) = von a nach b a.d. Kreis gegen die Uhr! (every #'(lambda (entry) (or (and (numberp entry) (<= 0 entry +2pi+)) (and (consp entry) (numberp (first entry)) (numberp (second entry)) (<= 0 (first entry) +2pi+) (<= 0 (second entry) +2pi+)))) orientation-constraint)) (defun normalize-orientation-constraint (orientation-constraint) (labels ((do-it (orientation-constraint) (let ((noc nil) (found-one nil)) (dolist (i orientation-constraint) (let ((intersecting-intervalls (loop as j in noc when (circle-intervall-intersects-p (first i) (second i) (first j) (second j)) collect j))) (if (not intersecting-intervalls) (push i noc) (let ((int-min (first i)) (int-max (second i)) (intersecting-intervalls (cons i intersecting-intervalls))) (dolist (j intersecting-intervalls) (let ((j-min (first j)) (j-max (second j))) (let* ((l (circle-intervall-length int-min int-max)) (l1 (circle-intervall-length j-min j-max)) (l2 (circle-intervall-length int-min j-max)) (l3 (circle-intervall-length j-min int-max)) (max (max l l1 l2 l3))) (cond ((= max l1) (setf found-one t) (setf int-min j-min int-max j-max)) ((= max l2) (setf found-one t) (setf int-max j-max)) ((= max l3) (setf found-one t) (setf int-min j-min)))))) (dolist (j intersecting-intervalls) (setf noc (delete j noc))) (push (list int-min int-max) noc))))) (values noc found-one)))) (let* ((cs (remove-if #'(lambda (entry) (and (not (consp entry)) (some #'(lambda (intervall) (and (consp intervall) (lies-in-circle-intervall-p entry (first intervall) (second intervall)))) orientation-constraint))) orientation-constraint)) (numbers (remove-if-not #'numberp cs)) (cs2 (remove-if #'numberp cs))) (loop (multiple-value-bind (res flag) (do-it cs2) (setf cs2 res) (unless flag (return (append numbers res)))))))) (defoperator set-orientation-constraint ((obj orientation-constraint-mixin) (orientation-constraint cons)) (:stored-operator nil) (:precondition ((and (not (typep obj 'transparency)) (check-orientation-constraint-p orientation-constraint) (=> (typep obj 'chain-or-polygon) (some #'(lambda (segment) (typep segment 'atomic-rubberband)) (segments obj)))))) (:code ((progn (setf (orientation-constraint obj) orientation-constraint) obj)))) #| ; (normalize-orientation-constraint (mapcan #'(lambda (o) (if (consp o) (let* ((a (normalize (first o))) (b (normalize (second o))) (c (normalize (+ pi a))) (d (normalize (+ pi b)))) (unless (circle-intervall-intersects-p a b c d) (list o (list c d )))) (list o (normalize (+ pi o))))) orientation-constraint)) |# (defoperator delete-orientation-constraint ((obj orientation-constraint-mixin)) (:stored-operator nil) (:precondition ((orientation-constraint obj))) (:code ((progn (setf (orientation-constraint obj) nil) obj)))) ;;; ;;; ;;; (defoperator set-relative-orientation-constraint ((obj1 atomic-rubberband) (obj2 atomic-rubberband) (allowed-derivation number)) (:stored-operator nil) (:precondition ((and (not (eq obj1 obj2)) (not (or (ignore-disjoint-and-intersects-relations-p obj1) (ignore-disjoint-and-intersects-relations-p obj2))) (intersects-p obj1 obj2) (not ; existiert noch nicht (some #'(lambda (constraint) (and (typep constraint 'angle-between) (eq (2nd-arg constraint) obj2))) (constraints obj1)))))) (:code ((make-and-memoize-binary-constraint 'angle-between obj1 obj2 :allowed-derivation allowed-derivation)))) #| ; (defoperator create-relative-orientation-constraint ((obj point) (orientation-constraint list)) (:stored-operator nil) (:precondition (and (check-orientation-constraint-p orientation-constraint) (>= (length orientation-constraint) 2) (every #'(lambda (entry) (some #'(lambda (segment) (and (typep segment 'atomic-rubberband) (multiple-value-bind (r alpha) (if (eq (p1 segment) obj) (distance-and-orientation* (x obj) (y obj) (x (p2 segment)) (y (p2 segment))) (distance-and-orientation* (x obj) (y obj) (x (p1 segment)) (y (p1 segment)))) (if (consp entry) (inside-circle-intervall-p alpha entry) (=-eps entry alpha))))) (part-of obj))) orientation-constraint))) (:code (progn (dolist (s1 (part-of obj)) (dolist (s2 (part-of obj)) (when (and (typep s1 'atomic-rubberband) (typep s2 'atomic-rubberband) (not (eq s1 s2))) (labels ((find-all-containing-intervalls (constraint alpha) (loop as cs in constraint when (or (and (consp cs) (inside-circle-intervall-p alpha cs)) (=-eps cs alpha)) collect cs))) (let* ((i1 (sort #'< (mapcar #'(lambda (cs) (if (consp cs) (angle-difference (first cs) (second cs)) 0)) (find-all-containing-intervalls s1)))) (i2 (sort #'< (mapcar #'(lambda (cs) (if (consp cs) (angle-difference (first cs) (second cs)) 0)) (find-all-containing-intervalls s2)))) (min (min (angle-difference (first i1) (first i2)) (angle-difference (first i1) (second i2)) (angle-difference (second i1) (first i2)) (angle-difference (second i1) (second i2)))) (max (max (angle-difference (first i1) (first i2)) (angle-difference (first i1) (second i2)) (angle-difference (second i1) (first i2)) (angle-difference (second i1) (second i2))))) (make-and-memoize-binary-constraint 'angle-between s1 s2 :ticks (list min max))))))) obj))) |# (defoperator delete-relative-orientation-constraint ((obj1 atomic-rubberband) (obj2 atomic-rubberband)) (:stored-operator nil) (:precondition ((and (some #'(lambda (constraint) (eq (2nd-arg constraint) obj2)) (constraints obj1)) (some #'(lambda (constraint) (eq (2nd-arg constraint) obj1)) (constraints obj2))))) (:code ((progn (find-and-delete-constraint 'angle-between obj1 obj2) (list obj1 obj2))))) ;;; ;;; ;;; (defoperator set-transparency-properties ((obj transparency) minw maxw minh maxh factor) (:stored-operator nil) (:precondition ((and (=> minw (plusp minw)) (=> minh (plusp minh)) (=> maxw (plusp maxw)) (=> maxh (plusp maxh)) (=> (and minw maxw) (<= minw maxw)) (=> (and minh maxh) (<= minh maxh)) (=> factor (plusp factor))))) (:code ((let* ((minw (if (and minh factor) (if minw (min (/ minh factor) minw) (/ minh factor)) minw)) (minh (if (and minw factor) (if minh (min (/ minw factor) minh) (/ minw factor)) minh)) (maxw (if (and maxh factor) (if maxw (max (/ maxh factor) maxw) (/ maxh factor)) maxw)) (maxh (if (and maxw factor) (if maxh (max (/ maxw factor) maxh) (/ maxw factor)) maxh)) (w (cond ((and maxw minw) (/ (+ minw maxw) 2)) (t (or minw maxw)))) (h (cond ((and maxh minh) (/ (+ minh maxh) 2)) (t (or minh maxh)))) (sxmin (and w minw (/ minw w))) (symin (and h minh (/ minh h))) (sxmax (and w maxw (/ maxw w))) (symax (and h maxh (/ maxh h)))) (setf (width obj) w (height obj) h (sxmin obj) sxmin (symin obj) symin (sxmax obj) sxmax (symax obj) symax (sx-s->w obj) (if w (/ w (- (x (pmax obj)) (x (pmin obj)))) 1) (sy-s->w obj) (if h (/ h (- (y (pmax obj)) (y (pmin obj)))) 1) (sxsy-constraint obj) (when (or (sx-type obj) (sy-type obj)) factor)) obj))))
26,234
Common Lisp
.lisp
681
31.958884
132
0.627285
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
8a530891edcab43c84224264fd1bfc61a27b1e6d06ae93b872a1a4a60bd0aeb6
11,690
[ -1 ]
11,691
define-system.lisp
lambdamikel_VISCO/src/Defsystem/define-system.lisp
;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Package: CL-USER -*- (cl:in-package :cl-user) ;;; ---------------------------------------------------------------------- ;;; ;;; Portable system declaration expanding into vendor-specific versions. ;;; ;;; DEFINE System = DEFsystem Is Now Expanded System ;;; ;;; ---------------------------------------------------------------------- ;;; Make load-system and compile-system available in cl-user. ;;; Both systems accept a system-name (symbol or string) as a parameter. ;;; Please notice that in some native defsystems, symbols used for ;;; system names might be package-sensitive. ;;; Therefore it is recommended that cl-user is used for defsystem definitions. #+:Genera (import '(scl:load-system scl:compile-system) 'fcl-user) (defun load-system-definition (system-name) (let ((name (if (symbolp system-name) (string-downcase (symbol-name system-name)) (string-downcase system-name)))) (load-logical-pathname-translations name) (load (concatenate 'string name ":system-declarations;" name "-sysdcl.lisp")))) #+(and :aclpc :cl-http) (defvar *logical-translations-directory* (merge-pathnames "Translations\\" allegro::*application-directory*)) #+(and :aclpc :cl-http) (defun LOAD-LOGICAL-PATHNAME-TRANSLATIONS (host) "Loads the logical pathname translations for host named HOST if the logical pathname translations are not already defined. First checks for a file with the same name as the host (lowercase) and type \"translations\" in the current directory, then the translations directory. If it finds such a file it loads it and returns T, otherwise it signals an error." (let* ((trans-fname (concatenate 'string (string-downcase host) ".translations")) (pathname (when *logical-translations-directory* (merge-pathnames trans-fname *logical-translations-directory*)))) (cond ((probe-file trans-fname) (load trans-fname) t) ((and *logical-translations-directory* (probe-file pathname)) (load pathname) t) (t (error "Logical pathname translations for host ~A not found." host))))) #+(and :aclpc :cl-http) (defvar *systems-directory* (merge-pathnames "Systems\\" allegro::*application-directory*)) #+(and :aclpc :cl-http) (defun load-system-declaration-file (system-name) (load (merge-pathnames (concatenate 'string (string-downcase (symbol-name system-name)) "-sysdcl.lisp") *systems-directory*))) #+(and :aclpc :cl-http) (unless (fboundp '%%compile-system) (setf (symbol-function '%%compile-system) #'compile-system) (defun compile-system (sym &rest args) (load-system-declaration-file sym) (apply #'%%compile-system sym args))) #+(and :aclpc :cl-http) (unless (fboundp '%%load-system) (setf (symbol-function '%%load-system) #'load-system) (defun load-system (sym &rest args) (load-system-declaration-file sym) (apply #'%%load-system sym args))) #+:mcl (defun delete-logical-host (name) (setf ccl::%logical-host-translations% (delete name ccl::%logical-host-translations% :key #'first :test #'string-equal))) (defmacro define-system (name (&key (pretty-name (symbol-name name)) default-pathname (default-package nil) (subsystem nil)) components) #+(or :Allegro :mcl :Lispworks (and :ACLPC (not :CL-HTTP))) (declare (ignore subsystem #+(or :mcl :Lispworks) pretty-name #-:mcl default-package)) (labels ((host-substring (logical-pathname) (let ((position (position #\: logical-pathname))) (if position (subseq logical-pathname 0 position) nil))) #+(or :Genera :mcl :Lispworks :ACLPC) (flatten-serial-parallel-descriptions (description) (if (consp description) (mapcan #'flatten-serial-parallel-descriptions (rest description)) (list description)))) (unless default-pathname (error "A default pathname must be supplied in a system definition.")) (let ((logical-host (host-substring default-pathname)) #+:Genera (systems-depending-on (remove-if-not #'symbolp (flatten-serial-parallel-descriptions components)))) (unless logical-host (error "Systems must be given a logical pathname as default pathname.")) `(progn #|#+:mcl (delete-logical-host ,logical-host) (load-logical-pathname-translations ,logical-host)|# #+:Allegro (excl:defsystem ,name (:default-pathname ,default-pathname :pretty-name ,pretty-name) ,components) #+(and :ACLPC (not :cl-http)) (define-system-1 :name ',name :source-dir (translate-logical-pathname ,default-pathname) :items ',(flatten-serial-parallel-descriptions components)) #+(and :ACLPC :CL-HTTP) (defsystem ,name (:pretty-name ,pretty-name :default-pathname ,default-pathname) ,components) #+:Lispworks (lw:defsystem ,name (:default-pathname ,(string-upcase default-pathname)) :members ,(mapcar #'(lambda (component) (if (symbolp component) `(,component :type :system) component)) (flatten-serial-parallel-descriptions components)) :rules ((:in-order-to :compile :all (:requires (:load :previous))))) #+:Genera (,(if subsystem 'sct:defsubsystem 'sct:defsystem) ,name (:default-pathname ,default-pathname :pretty-name ,pretty-name) ,@(mapcar #'(lambda (system) `(:module ,system (,system) (:type :system))) systems-depending-on) ,components) #+(and :mcl (not (and :mk-defsystem :ui-lib))) (defsystem:defserial-system ,name (:default-pathname ,default-pathname . ,(if default-package `(:default-package ,default-package) ())) . ,(flatten-serial-parallel-descriptions components)) #+(and :mcl :mk-defsystem :ui-lib) (cl-user::defsystem ,name :source-pathname ,default-pathname :binary-pathname ,default-pathname :depends-on ,systems-depending-on :components ,(mapcar #'(lambda (component) `(:file ,component)) (remove-if #'symbolp (flatten-serial-parallel-descriptions components)))))))) #+:MCL (pushnew '("ccl:*.pathname-translations" "ccl:translations;*.translations") (logical-pathname-translations "ccl") :test #'equal) #| (define-system :test (:default-pathname "test:default;" :pretty-name "Test" :subsystem t) (:serial (:parallel :bar :bvyy) "test1" "test2")) |#
7,939
Common Lisp
.lisp
189
29.89418
80
0.549863
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
321226fdc592fd3a62805d845348b7b91a973212845cbaf875cb078f1fa4bec0
11,691
[ -1 ]
11,692
aux6.lisp
lambdamikel_VISCO/src/Aux2/aux6.lisp
;;; -*- Mode: Lisp; Syntax: Ansi-Common-Lisp; Package: CL-USER; Base: 10 -*- (in-package cl-user) (defconstant +vector-size+ 100000) (defconstant +hash-table-size+ 100000) (defconstant +rehash-size+ 40000) (defconstant +pi/2+ (/ pi 2)) (defconstant +2pi+ (* 2 pi)) (defconstant +epsilon+ 1e-4) (defun yes (&rest args) (declare (ignore args)) t) (defun no (&rest args) (declare (ignore args)) nil) (defun get-lambda-args (fn) (nreverse (mapcar #'(lambda (arg) (if (consp arg) (first arg) arg)) (set-difference #+:allegro (excl:arglist fn) #+:mcl (arglist fn) '(&rest &optional &key))))) (defun set-equal (a b) (and (every #'(lambda (i) (member i b)) a) (every #'(lambda (i) (member i a)) b))) (defun set-disjoint (a b) (and (not (some #'(lambda (i) (member i b)) a)) (not (some #'(lambda (i) (member i a)) b)))) (defmacro zerop-eps (a) `(=-eps 0 ,a)) (defmacro =-eps (a b &optional (epsilon +epsilon+)) `(<= (abs (- ,a ,b)) ,epsilon)) (defmacro <=-eps (a b &optional (epsilon +epsilon+)) `(<= ,a (+ ,b ,epsilon))) (defmacro >=-eps (a b &optional (epsilon +epsilon+)) `(>= ,a (- ,b ,epsilon))) (defun tree-reverse (liste) (labels ((do-it (liste akku) (cond ((null liste) akku) (t (let ((first (first liste))) (do-it (rest liste) (cons (if (listp first) (do-it first nil) first) akku))))))) (do-it liste nil))) (defun tree-remove (item tree) (cond ((not (consp tree)) (if (eq item tree) nil tree)) (t (let ((car (tree-remove item (car tree))) (cdr (tree-remove item (cdr tree)))) (if car (cons car cdr) cdr))))) (defun transform-xy-list (xylist) (loop for x in xylist by #'cddr for y in (cdr xylist) by #'cddr collect (list x y))) (defmacro => (i j) `(or (not ,i) ,j)) (defun <=> (i j) (eq i j)) (defun intervall-intersects-p (a b c d) (not (or (< b c) (< d a)))) (defun lies-in-circle-intervall-p (x a b) (if (= a b) t (if (<= a b) (<= a x b) (or (>= b x) (>= x a))))) (defun circle-intervall-intersects-p (a b c d) (or (lies-in-circle-intervall-p b c d) (lies-in-circle-intervall-p d a b))) (defun circle-intervall-length (a b &optional (modulo +2pi+)) (if (<= a b) (- b a) (+ (- modulo a) b))) (defun rad-to-deg (phi) (* 180 (/ phi pi))) (defun deg-to-rad (phi) (* pi (/ phi 180))) (defmacro pushend (obj list) `(setf ,list (nconc ,list (list ,obj)))) (defmacro mynconc (lista listb) `(setf ,lista (nconc ,lista ,listb))) (defmacro my-format (stream indent-level string &rest args) `(progn (dotimes (i (* 7 ,indent-level)) (princ " " ,stream)) (format ,stream ,string ,@args))) (defmacro my-read (stream) #+:allegro `(read ,stream) #+:mcl `(read-from-string (read-line ,stream))) #+:allegro (defun circle-subseq (list from to) (let* ((copy (copy-list list))) (setf (rest (last copy)) copy) (subseq copy from to))) #+:mcl (defun circle-subseq (list from to) (let* ((copy (copy-list list))) (setf (rest (last copy)) copy) (let ((start copy)) (loop repeat from do (setf start (cdr start))) (loop repeat (- to from) collect (car start) do (setf start (cdr start)))))) #+:allegro (defun recode-german-characters (string) (nsubstitute (character 228) (character 204) string) ; dos aeh -> unix aeh (nsubstitute (character 246) (character 224) string) ; dos oeh -> unix oeh (nsubstitute (character 252) (character 201) string) ; dos ueh -> unix ueh (nsubstitute (character 196) (character 216) string) ; dos AEH -> unix AEH (nsubstitute (character 214) (character 231) string) ; dos OEH -> unix OEH (nsubstitute (character 220) (character 232) string) ; dos UEH -> unix UEH (nsubstitute (character 223) #\· string) ; dos sz -> unix sz (nsubstitute (character 228) (character 132) string) ; siemens aeh -> unix aeh ; dxf (nsubstitute (character 246) (character 148) string) ; siemens oeh -> unix oeh ; dxf (nsubstitute (character 252) (character 129) string) ; siemens ueh -> unix ueh ; dxf (nsubstitute (character 214) (character 153) string) ; siemens OEH -> unix OEH ; andere Code unbekannt! ; dxf (nsubstitute (character 228) (character #xbf) string) ; siemens aeh -> unix aeh ; sqd (nsubstitute (character 246) (character #xd0) string) ; siemens oeh -> unix oeh ; sqd (nsubstitute (character 252) (character #xdd) string) ; siemens ueh -> unix ueh ; sqd (nsubstitute (character 214) (character #xf0) string) ; siemens OEH -> unix OEH ; andere Codes sind unbekannt! ; dxf (nsubstitute (character 223) (character #xc5) string) ; dos sz -> unix sz ; dxf string) #+:mcl (defun recode-german-characters (string) string) ;;; ;;; ;;; #| (defvar *read-objects* (make-hash-table :test #'eql :size +hash-table-size+ :rehash-size +rehash-size+)) |# (defvar *read-objects* (make-array +vector-size+ :initial-element nil)) (defvar *writen-objects* (make-hash-table :test #'eql :size +hash-table-size+ :rehash-size +rehash-size+)) ;;; ;;; ;;; #| (defun store (io-id obj) (setf (gethash io-id *read-objects*) obj)) (defun retrieve (io-id) (gethash io-id *read-objects*)) |# (defvar *io-id-counter* 0) (defun get-io-id-for (object) (gethash object *writen-objects*)) (defun get-io-id () (incf *io-id-counter*)) (defun store (io-id obj) (setf *io-id-counter* (max io-id *io-id-counter*)) (setf (svref *read-objects* io-id) obj)) (defun retrieve (io-id) (svref *read-objects* io-id)) #| (defun reset () (setf *io-id-counter* 0) (clrhash *writen-objects*) (clrhash *read-objects*)) |# (defun reset () (setf *io-id-counter* 0) (clrhash *writen-objects*) (setf *read-objects* (make-array +vector-size+ :initial-element nil))) ;;; ;;; ;;; (defclass persistent-object () ()) (defmethod write-object-constructor ((obj persistent-object) stream) (declare (ignore stream)) nil) (defmethod write-object-initializer ((obj persistent-object) stream) (declare (ignore stream)) nil) (defmethod fill-persistent-object ((obj persistent-object) stream) (declare (ignore stream)) nil) ;;; verhindere, da"s initialize-instance fuer Subklassen aufgerufen wird! (defmethod initialize-instance :around ((obj persistent-object) &rest initargs &key (dont-initialize nil)) (if (not dont-initialize) (progn #+:allegro (clos::validate-make-instance-initargs (find-class (type-of obj)) initargs) (call-next-method)) ; normale Initialisierung (apply #'shared-initialize obj t initargs))) (defmethod initialize-loaded-persistent-object ((obj persistent-object)) nil) ;;; ;;; ;;; (defconstant +already-present-marker+ #\!) (defconstant +string-marker+ #\s) (defconstant +array-marker+ #\a) (defconstant +list-marker+ #\l) (defconstant +number-marker+ #\n) (defconstant +symbol-marker+ #\i) (defconstant +object-marker+ #\o) (defconstant +otherwise-marker+ #\?) (defconstant +unbound-marker+ #\*) (defconstant +section-marker+ #\+) ;;; ;;; ;;; (defmacro with-only-once-constructed-object ((object marker stream) &body body) `(unless (gethash ,object *writen-objects*) (let ((io-id (get-io-id))) (setf (gethash ,object *writen-objects*) io-id) (format ,stream "~A~A~%" ,marker io-id) ,@body))) (defmethod write-constructor ((object t) stream) (declare (ignore stream)) nil) (defmethod write-constructor ((object cons) stream) (with-only-once-constructed-object (object +list-marker+ stream) (format stream "~A~%" (length object)) (dolist (obj object) (write-constructor obj stream)))) (defmethod write-constructor ((object string) stream) (declare (ignore stream)) nil) (defmethod write-constructor ((object array) stream) (with-only-once-constructed-object (object +array-marker+ stream) (format stream "~A~%" (array-dimensions object)) (dotimes (i (array-total-size object)) (write-constructor (row-major-aref object i) stream)))) (defmethod write-constructor ((object persistent-object) stream) (with-only-once-constructed-object (object +object-marker+ stream) (format stream "~S~%" (type-of object)) (write-object-constructor object stream))) ;;; ;;; ;;; (defmacro with-complex-object-header ((id stream) &body body) `(progn (format ,stream "~A~%" ,id) ,@body)) (defun write-referencer (object stream) (typecase object ((and (or cons array persistent-object) (not string)) (format stream "~A~A~%" +object-marker+ (get-io-id-for object))) (otherwise (typecase object (string (format stream "~A~A~%" +string-marker+ object)) (number (format stream "~A~A~%" +number-marker+ object)) (symbol (format stream "~A~S~%" +symbol-marker+ object)) (otherwise (format stream "~A~S~%" +otherwise-marker+ object)))))) (defmethod write-initializer ((object cons) id stream) (with-complex-object-header (id stream) (dolist (obj object) (write-referencer obj stream)))) (defmethod write-initializer ((object array) id stream) (with-complex-object-header (id stream) (dotimes (i (array-total-size object)) (write-referencer (row-major-aref object i) stream)))) (defmethod write-initializer ((object persistent-object) id stream) (with-complex-object-header (id stream) (write-object-initializer object stream))) ;;; ;;; ;;; (defmethod fill-object ((object cons) stream) (let ((length (first object))) (setf (first object) (read-value stream)) (setf (rest object) (loop as i from 1 to (1- length) collect (read-value stream)))) object) (defmethod fill-object ((object array) stream) (dotimes (i (array-total-size object)) (setf (row-major-aref object i) (read-value stream))) object) (defmethod fill-object ((object persistent-object) stream) (fill-persistent-object object stream) object) ;;; ;;; ;;; (defun read-value (stream) (let ((marker (read-char stream))) (cond ((char= marker +object-marker+) (values (retrieve (parse-integer (read-line stream))) nil)) ((char= marker +symbol-marker+) (values (my-read stream) nil)) ((char= marker +string-marker+) (values (read-line stream) nil)) ((char= marker +number-marker+) (values (my-read stream) nil)) ((char= marker +otherwise-marker+) (values (my-read stream) nil)) ((char= marker +unbound-marker+) (values nil t)) (t (error "Bad marker ~A in read-value!" marker))))) (defun construct-object (stream) (loop (let ((marker (read-char stream))) (if (or (char= marker +section-marker+) (eq marker 'eof)) (return) (store (parse-integer (read-line stream)) (cond ((char= marker +list-marker+) (list (read-from-string (read-line stream)))) ((char= marker +array-marker+) (make-array (my-read stream))) ((char= marker +object-marker+) (make-instance (my-read stream) :allow-other-keys t :dont-initialize t)))))))) (defun initialize-object (stream) (loop (let ((io-id (read-line stream nil 'eof))) (if (eq io-id 'eof) (return) (fill-object (retrieve (parse-integer io-id)) stream))))) ;;; ;;; ;;; (defmacro defpersistentclass (&rest rest) `(progn ,@(let* ((name (first rest)) (superclasses (append (second rest) '(persistent-object))) (body (third rest)) (slotnames (mapcar #'first body))) (list `(defclass ,name ,superclasses ,(loop for slotspec in body collect (remove :not-persistent slotspec))) `(defmethod write-object-constructor ((obj ,name) stream) (declare (ignore-if-unused stream)) (with-slots ,slotnames obj ,@(mapcan #'(lambda (slot) (let ((name (first slot))) (unless (member :not-persistent slot) `((when (slot-boundp obj ',name) (write-constructor ,name stream)))))) (reverse body))) (call-next-method)) `(defmethod write-object-initializer ((obj ,name) stream) (declare (ignore-if-unused stream)) (with-slots ,slotnames obj ,@(mapcan #'(lambda (slot) (let ((name (first slot))) (unless (member :not-persistent slot) `((if (slot-boundp obj ',name) (write-referencer ,name stream) (princ +unbound-marker+ stream)))))) (reverse body))) (call-next-method)) `(defmethod fill-persistent-object ((obj ,name) stream) (declare (ignore-if-unused stream)) (let (val unbound) (declare (ignore-if-unused val unbound)) (with-slots ,slotnames obj ,@(mapcan #'(lambda (slot) (let ((name (first slot))) (unless (member :not-persistent slot) `((multiple-value-setq (val unbound) (read-value stream)) (unless unbound (setf ,name val)))))) (reverse body))) (call-next-method))))))) ;;; ;;; ;;; (defun write-section-separator (stream) (format stream "~A" +section-marker+)) (defun make-object-persistent (obj fn) (with-open-file (stream fn :direction :output :if-exists :supersede :if-does-not-exist :create) (let ((*package* (find-package "CL-USER"))) (reset) (write-constructor (list obj) stream) (write-section-separator stream) (maphash #'(lambda (key value) (write-initializer key value stream)) *writen-objects*)))) (defun load-persistent-object (fn) (with-open-file (stream fn :direction :input) (let ((*package* (find-package "CL-USER"))) (reset) (construct-object stream) (initialize-object stream) (dotimes (i (+ 2 *io-id-counter*)) (let ((obj (svref *read-objects* i))) (when (typep obj 'persistent-object) (initialize-loaded-persistent-object obj)))) (first (retrieve 1))))) ;;; ;;; ;;; #| (defpersistentclass test () ((a :accessor a :initarg :a) (b :accessor b :initarg :b))) (defpersistentclass test2 (test) ((c :accessor c :initarg :c))) (setf x (make-instance 'test :a (list 1 2 3))) (setf y (make-instance 'test :a x :b (make-array '(10)))) (setf z (make-instance 'test2 :c (list x y (make-array '(3) :initial-contents (list x y x))))) (make-persistent (vector x y z (list x (vector x z y) x z)) "test") |#
14,671
Common Lisp
.lisp
451
27.824834
118
0.632569
lambdamikel/VISCO
9
0
0
GPL-3.0
9/19/2024, 11:26:49 AM (Europe/Amsterdam)
28f76efc174e11a0e11ab78994b74006d25f6e2fa70618c8b20af377318516fa
11,692
[ -1 ]