GizmoWiki:サンドボックス

提供:GizmoLabs - だいたい CAD LISP なサイト

記事書きのためしページ。

AutoLISP のコード

;;; Debugging functions 
(defun break (s) 
    (if *BREAK* 
      (progn (princ "BREAK>> (stop with <Enter>)\nBREAK>> ")
        (princ s) 
        (while (/= (setq s (getstring "\nBREAK>> ")) "") (print (eval (read s)))))))

;bugfix from v1.3! 
(defun dbg-print (s) ;accepts atoms and lists 
  (if *DEBUG* 
    (if (listp s) (mapcar 'print s) (print s)))) 

(defun C:DEBUG () (setq *DEBUG* (not *DEBUG*))) ;switch it on and off 
(defun C:BREAK () (setq *BREAK* (not *BREAK*))) 
(defun CONT () (setq *BREAK* nil)) ;continue without any interruption 

;;;Example 
(setq *BREAK* T *DEBUG* T) 
(defun C:TEST () 
  (foreach x '("1" "1.0" "1e-3") 
    (break "in foreach") ; stops evaluation if *BREAK* is on, you can 
                         ; enter x and the value of x is printed 
                         ; until you enter Enter 
    (setq x (atof x))    ; this is some code which manipulates x 
    (dbg-print x)        ; this prints the new value of x 
                         ; if *DEBUG* is on 
   )
)


&arguments はおいしいのに...

;;; print a variable number of arguments (of any type) 
(defun my-princ (x) 
  ;; simple version, for better stuff look at the SDK2: PRINTF.LLB 
  (if (listp x) 
    (mapcar 'princ x) 
    (princ x))) 


フォーム入れ込み {{#form:action=https://www.paypal.com/cgi-bin/webscr|method=POST|}}{{#input:type=hidden|name=cmd|value=_s-xclick}}{{#input:type=hidden|name=hosted_button_id|value=1169525}}{{#input:type=image|src=https://www.paypal.com/ja_JP/JP/i/btn/btn_donate_LG.gif|name=submit}}{{#input:type=image|alt=|border=0|src=https://www.paypal.com/ja_JP/i/scr/pixel.gif|width=1|height=1}} {{#formend:}}