rwsice9 发表于 2022-7-6 06:36:41

LISP和DCL给出“坏函数”

我希望有人能帮上忙。我有一个LISP,它打开DCL并提示用户输入,然后设置USERI2变量。如果我注释掉“If”函数,DCL工作,USERI2设置正确。一旦我把IF放回,我就会得到一个“坏函数”错误,我似乎找不到。有人能帮忙吗?
 
DCL代码:

notiftype : dialog {
label = "Notification Type";

:column        {
: boxed_radio_column {
             label = "Notification Label Selection";
             : radio_button {
                   label = "Conventional Notification \"V\"";
                   key = "nconv";
                     }
             : radio_button {
                   label = "Addressable Notification \"A\"";
                   key = "naddr";
                     }
             
}

       }

           ok_cancel;


}

 
LISP代码:

(defun c:INDCPLINE (/ r3 nconv naddr )
(setq r3 (getvar "USERI2"))
(if
(= r3 0)
(
(setq dcl_id (load_dialog "notiftype.dcl"))
(if (not (new_dialog "notiftype" dcl_id))(exit))

        (action_tile "nconv" "(setq nconv $value)(setq nconv (atoi nconv))(setq naddr 0)")
(action_tile "naddr" "(setq naddr $value)(setq naddr (atoi naddr))(setq nconv 0)")
        (action_tile "accept" "(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(start_dialog)
;(unload_dialog dcl_id)

)
)
(if (= nconv 1)(COMMAND "userI2" 1))
(if (= naddr 1)(COMMAND "userI2" 2))
;(command "._pline")
)

Tharwat 发表于 2022-7-6 06:58:24

我不太明白你的意思,但你现在能试试吗?
 

(defun c:INDCPLINE (/ r3 nconv naddr)
(setq r3 (getvar "USERI2"))
(if
   (= r3 0)
    (progn
      (setq dcl_id (load_dialog "notiftype.dcl"))
      (if (not (new_dialog "notiftype" dcl_id))
      (exit)
      )

      (action_tile
      "nconv"
      "(setq nconv $value)(setq nconv (atoi nconv))(setq naddr 0)"
      )
      (action_tile
      "naddr"
      "(setq naddr $value)(setq naddr (atoi naddr))(setq nconv 0)"
      )
      (action_tile "accept" "(done_dialog 1)")
      (action_tile "cancel" "(done_dialog 0)")
      (start_dialog)
      (if (= nconv 1)
      (COMMAND "userI2" 1)
      )
      (if (= naddr 1)
      (COMMAND "userI2" 2)
      )                              ;(unload_dialog dcl_id)
    )
)                                    ;(command "._pline")
)

rwsice9 发表于 2022-7-6 07:21:38

好吧,因为你没有“理解我的想法”,你还是成功了。非常感谢!

Tharwat 发表于 2022-7-6 07:41:53

不客气。
 
如果使用cond函数替换后两个函数,则最好如下所示:
 

(cond ((= nconv 1)(COMMAND "userI2" 1))
            ((= naddr 1)(COMMAND "userI2" 2))
      )

 
祝你好运
页: [1]
查看完整版本: LISP和DCL给出“坏函数”