乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 61|回复: 3

[编程交流] 修复旧LISP+DCL

[复制链接]

76

主题

312

帖子

254

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
390
发表于 2022-7-5 16:48:45 | 显示全部楼层 |阅读模式
大家好,
 
在另一个主题中,我发现了以下代码:
但是当我运行命令消息时,它返回了一个错误。
  1. Error in dialog file
  2. line 2: syntax error.
  3. Symbol: "key".

 
我对DCL脚本和函数一无所知。
谁能帮我看一下吗?:-)
 
干杯
 
 
  1. ;Tip1756a:  MESSAGE.LSP      Message Service            (c)2001, John R. Fair III;  $50 Bonus Winner
  2. ;;; ----------------------------------------------------------
  3. ;;;    Message.lsp is a program to store and retrieve        ;
  4. ;;; information about a drawing.  Use it to save notes to    ;
  5. ;;; yourself or others, information about "odd" non-standard ;
  6. ;;; things you were asked to do to a drawing.  Saves right in;
  7. ;;; the drawing, retrieve the message the next day, next week;
  8. ;;; or next year.
  9. ;;; ----------------------------------------------------------
  10. ;;; ************ main function *******************************
  11. (defun
  12.   C:MESSAGE (/ MSG-CMD MSG-DCL_ID)
  13. (setq
  14.    OLDERR *ERROR*
  15.    *ERROR* MERR
  16. ) ; end setq
  17. (if (< (setq MSG-DCL_ID (load_dialog "message.dcl")) 0)
  18. ; if dialog file is not loaded
  19.    (exit) ; then exit
  20. ) ; end if
  21. (if (not (new_dialog "message" MSG-DCL_ID))
  22. ; if dialog box is not loaded
  23.    (exit) ; then exit
  24. ) ; end if
  25. (SHOW_LIST "exmess")
  26. (action_tile "exmess" "(show_info $value)")
  27. (action_tile "delete" "(delmessage (get_tile "exmess"))")
  28. (action_tile "store" "(storemessage (get_tile "newmess"))")
  29. (action_tile
  30.    "accept"
  31.    "(yesno "Message has not been stored!" "" "Do you wish to save the message?" "")"
  32. ) ;_ end of action_tile
  33. (start_dialog)
  34. (princ)
  35. ) ; close defun
  36. ;;; ******************Store message function *******************
  37. (defun
  38.   STOREMESSAGE
  39.   (MSG-MSG / MSG-MESSAGE MSG-XNAME MSG-SCRT MSG-XNAME MSG-AMPM)
  40. (setq
  41.    MSG-MESSAGE 1
  42.    MSG-SCRT
  43.     (rtos (getvar "CDATE") 2 6)
  44. ) ; end setq
  45. (if (or (= MSG-MSG " ") (= MSG-MSG ""))
  46.    (set_tile "error" "No Message to Store!")
  47.    (progn
  48.      (while (/= (dictsearch
  49. ; Use while loop to find last message in drawing
  50.                   (namedobjdict)
  51.                   (strcat "message" (rtos MSG-MESSAGE 2 0))
  52.                 ) ;_ end of dictsearch
  53.                 NIL
  54.             ) ;_ end of /=
  55.        (setq MSG-MESSAGE (1+ MSG-MESSAGE))
  56.      ) ; end while
  57.      (setq
  58.        MSG-XNAME ; use entmakex to create the xrecord with no owner.
  59.         (entmakex
  60.           (append
  61.             (list '(0 . "XRECORD") '(100 . "AcDbXrecord"))
  62.             (list (cons 1 MSG-MSG))
  63.             (list (cons 2 (getvar "LOGINNAME"))) ; Message stored by?
  64.             (list
  65.               (cons
  66.                 3
  67.                 (strcat
  68.                   (substr MSG-SCRT 5 2) ; Date Message stored on?
  69.                   "/"
  70.                   (substr MSG-SCRT 7 2)
  71.                   "/"
  72.                   (substr MSG-SCRT 1 4)
  73.                 ) ; end strcat
  74.               ) ; end cons
  75.             ) ; end list
  76.             (list
  77.               (cons
  78.                 4
  79.                 (strcat ; Time Message stored at?
  80.                   (if
  81.                     (<=
  82.                       (setq MSG-AMPM (fix (atof (substr MSG-SCRT 10 2))))
  83.                       12
  84.                     ) ;_ end of <=
  85.                      (eval (substr MSG-SCRT 10 2))
  86.                      (eval
  87.                        (rtos
  88.                          (- (fix (atof (substr MSG-SCRT 10 2))) 12)
  89.                          2
  90.                          0
  91.                        ) ;_ end of RTOS
  92.                      ) ;_ end of eval
  93.                   ) ; end if
  94.                   ":"
  95.                   (substr MSG-SCRT 12 2)
  96.                   " "
  97.                   (if (>= MSG-AMPM 12) ; AM or PM ?
  98.                     (eval "pm")
  99.                     (eval "am")
  100.                   ) ; end if
  101.                 ) ; end strcat
  102.               ) ; end cons
  103.             ) ; end list
  104.           ) ; end append
  105.         ) ; end entmakex
  106.      ) ; end setq
  107.      (dictadd
  108.        (namedobjdict)
  109. ; add the new xrecord to the named object dictionary.
  110.        (strcat "message" (rtos MSG-MESSAGE 2 0))
  111.        MSG-XNAME
  112.      ) ; end dictadd
  113.      (set_tile "newmess" "")
  114.      (set_tile "strdby" (getvar "loginname")) ; Show stored by name
  115.      (set_tile
  116.        "datestrd"
  117.        (strcat
  118.          (substr MSG-SCRT 5 2)
  119.          "/"
  120.          (substr MSG-SCRT 7 2)
  121.          "/"
  122.          (substr MSG-SCRT 1 4)
  123.        ) ;_ end of strcat
  124.      ) ; show date stored
  125.      (set_tile
  126.        "strdtm" ; show stored time
  127.        (strcat
  128.          (if
  129.            (<= (setq MSG-AMPM (fix (atof (substr MSG-SCRT 10 2)))) 12)
  130. ; hours
  131.             (eval (substr MSG-SCRT 10 2))
  132.             (eval (rtos (- (fix (atof (substr MSG-SCRT 10 2))) 12) 2 0))
  133.          ) ; end if
  134.          ":"
  135.          (substr MSG-SCRT 12 2) ; minutes
  136.          " "
  137.          (if (>= MSG-AMPM 12) ; am or pm
  138.            (eval "pm")
  139.            (eval "am")
  140.          ) ; end if
  141.        ) ; end strcat
  142.      ) ; end set_tile
  143.    ) ; close progn
  144. ) ; end if
  145. (SHOW_LIST "exmess") ; refresh message list
  146. ) ; close defun
  147. ;;; ****************** Function to delete messages ***********************
  148. (defun
  149.   DELMESSAGE (MSG-LINENO / MSG-TEST)
  150. (if (= MSG-LINENO "")
  151.    (set_tile "error" "Please select a message to delete! ")
  152.    (progn
  153.      (setq MSG-TEST (read MSG-LINENO))
  154.      (set_tile "error" "Deleting message, please wait....")
  155.      (dictremove ; remove selected message from dictionary
  156.        (namedobjdict)
  157.        (strcat "message" (rtos (1+ (read MSG-LINENO)) 2 0))
  158.      ) ;_ end of dictremove
  159.      (while (dictrename ; rename any remaining message to fill gap
  160.               (namedobjdict)
  161.               (strcat "message" (rtos (+ MSG-TEST 2) 2 0))
  162.               (strcat "message" (rtos (+ MSG-TEST 1) 2 0))
  163.             ) ;_ end of dictrename
  164.        (setq MSG-TEST (1+ MSG-TEST))
  165.      ) ;_ end of while
  166.    ) ;_ end of PROGN
  167. ) ;_ end of IF
  168. (set_tile "error" "") ; clear error and info tiles
  169. (set_tile "strdby" "")
  170. (set_tile "datestrd" "")
  171. (set_tile "strdtm" "")
  172. (SHOW_LIST "exmess") ; refresh  message list
  173. ) ;_ end of DEFUN
  174. ;;; *************** Error handler ****************************
  175. (defun
  176.   MERR (S)
  177. (if (not
  178.        (member
  179.          S
  180.          '("console break" "Function canceled" "Invalid selection")
  181.        ) ;_ end of member
  182.      ) ; if command is aborted
  183.    (princ (strcat "\nMessage Error: " S)) ; then prompt user
  184. ) ; end if
  185. (setq
  186.    *ERROR* OLDERR
  187.    MERR NIL
  188. ) ; undo back to mark
  189. ) ;_ end of defun
  190. ;;; *************** Show/Refresh message list *********************
  191. (defun
  192.   SHOW_LIST (MSG-TILE / MSG-ITEM MSG-MESSAGE)
  193. (start_list MSG-TILE) ; start message list
  194. (setq MSG-MESSAGE 1)
  195. (while (setq
  196.           MSG-ITEM
  197.            (dictsearch ; find any messages
  198.              (namedobjdict)
  199.              (strcat "message" (rtos MSG-MESSAGE 2 0))
  200.            ) ;_ end of dictsearch
  201.         ) ;_ end of setq
  202.    (add_list (cdr (assoc 1 MSG-ITEM))) ; add message to list
  203.    (setq MSG-MESSAGE (1+ MSG-MESSAGE))
  204. ) ;_ end of while
  205. (end_list) ; end list
  206. ) ;_ end of defun
  207. ;;; ****************** Show message info *************************
  208. (defun
  209.   SHOW_INFO (MSG-INFO / MSG-STRDBY MSG-DATESTRD MSG-RECORD)
  210. (setq
  211.    MSG-RECORD
  212.     (dictsearch ; find selected message in dictionary
  213.       (namedobjdict)
  214.       (strcat "message" (rtos (1+ (read MSG-INFO)) 2 0))
  215.     ) ;_ end of dictsearch
  216. ) ;_ end of setq
  217. (if (cdr (assoc 2 MSG-RECORD)) ; display "Stored by:" info
  218.    (set_tile "strdby" (cdr (assoc 2 MSG-RECORD)))
  219.    (set_tile "strdby" "---")
  220. ) ;_ end of if
  221. (if (cdr (assoc 3 MSG-RECORD)) ; display "Date Stored:" info
  222.    (set_tile "datestrd" (cdr (assoc 3 MSG-RECORD)))
  223.    (set_tile "datestrd" "---")
  224. ) ;_ end of if
  225. (if (cdr (assoc 4 MSG-RECORD)) ; display "Time Stored" info
  226.    (set_tile "strdtm" (cdr (assoc 4 MSG-RECORD)))
  227.    (set_tile "strdtm" "---")
  228. ) ;_ end of if
  229. ) ;_ end of defun
  230. ;;; ************* Message alert box for unsaved messages ******************
  231. (defun
  232.   YESNO (MSG0 MSG1 MSG2 MSG3 /)
  233. (if (not (= (get_tile "newmess") ""))
  234. ; is there a message typed in new message box?
  235.    (progn ; if yes show "do you want to save" alert
  236.      (if (not (new_dialog "yes_no" MSG-DCL_ID))
  237. ; if dialog box is not loaded
  238.        (exit) ; then exit
  239.      ) ;_ end of if
  240.      (set_tile "msg0" MSG0)
  241.      (set_tile "msg1" MSG1)
  242.      (set_tile "msg2" MSG2)
  243.      (set_tile "msg3" MSG3)
  244.      (action_tile "accept" "(done_dialog 1)")
  245. ; if yes then return to main dialog box
  246.      (action_tile "cancel" "(term_dialog)")
  247. ; if no then terminate all dialog boxes
  248.      (start_dialog)
  249.    ) ;_ end of progn
  250.    (done_dialog 1) ; if no message close dialog
  251. ) ;_ end of if
  252. ) ;_ end of defun
  253. ;;; ************** Message load alert function **************************
  254. (if ; find selected message in dictionary
  255. (dictsearch (namedobjdict) "message1")
  256.   (progn
  257.     (if (< (setq MSG-DCL_ID (load_dialog "message.dcl")) 0)
  258. ; if dialog file is not loaded
  259.       (exit) ; then exit
  260.     ) ;_ end of if
  261.     (if (not (new_dialog "yes_no" MSG-DCL_ID))
  262. ; if dialog box is not loaded
  263.       (exit) ; then exit
  264.     ) ;_ end of if
  265.     (set_tile "msg0" "There are messages in this drawing!")
  266.     (set_tile "msg1" "")
  267.     (set_tile "msg2" "Do you want to view messages now?")
  268.     (set_tile "msg3" "")
  269.     (action_tile "accept" "(done_dialog 1)")
  270. ; if yes then return to main dialog box
  271.     (action_tile "cancel" "(done_dialog 0)")
  272. ; if no then terminate all dialog boxes
  273.     (if (= (start_dialog) 1)
  274.       (C:MESSAGE)
  275.     ) ;_ end of if
  276.   ) ;_ end of progn
  277. ) ;_ end of if
  278. (princ "\nType MESSAGE to start program")
  279. (princ)

由中的该行引起。lsp文件:
  1. //;Tip1756b:  MESSAGE.DCL      Message Service            (c)2001, John R. Fair III;  $50 Bonus Winnermessage : dialog {        label = "Message Service" ;        //initial_focus = "exmess" ;        : boxed_column {                label = "Messages: " ;                : list_box {                        //label = "Messages" ;                        key = "exmess" ;                        width = 80 ;                        //height = 10 ;                        value = "1" ;                }                : row {                        : concatenation {                                : text_part {                                        label = "Stored by: " ;                                }                                : text {                                        key = "strdby" ;                                        width = 10 ;                                }                                : text_part {                                        label = "Date Stored: " ;                                }                                : text {                                        key = "datestrd" ;                                        width = 10 ;                                }                                : text_part {                                        label = "Time Stored: " ;                                }                                : text {                                        key = "strdtm" ;                                        width = 10 ;                                }                        }                        : button {                                label = "Delete Message" ;                                key = "delete" ;                        }                }        }        : spacer { }        : row {                : edit_box {                        label = "Message:" ;                        key = "newmess" ;                        width = 60 ;                        edit_limit = 80;                }                : button {                        label = "Store" ;                        key = "store" ;                }        }        : button {                label = "OK" ;                key = "accept" ;                width = 15 ;                fixed_width = true;                alignment = centered;                is_default = true;        }        errtile ;}yes_no : dialog {    label = "Message Alert";    : column {        : text_part {         label = "";         key = "msg0" ;        }        : text_part {         label = "";         key = "msg1" ;        }        : text_part {         label = "";         key = "msg2" ;        }        : text_part {         label = "";         key = "msg3" ;        }    }    : row {      : spacer {}      : button {          label = " Yes ";          mnemonic = "Y";          key = "accept";          is_default=true;          fixed_width=true;          width=12;      }      : button {         label = " No  ";          mnemonic = "N";          key = "cancel";          is_cancel=true;          fixed_width=true;          width=12;      }      : spacer {}   }}

因此,一种解决方案是重命名Tip1756b。dcl转换为消息。dcl或use(load_对话框“Tip1756b.dcl”)。
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-5 17:21:50 | 显示全部楼层
谢谢Grrr,
另一个下载位置很有魅力。
奇怪的是,另一个网站有一个坏版本。。。
 
再次感谢!
回复

使用道具 举报

66

主题

1552

帖子

1514

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
325
发表于 2022-7-5 17:39:12 | 显示全部楼层
174847dsvdv3dbfmqdddss.jpg
回复

使用道具 举报

76

主题

312

帖子

254

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
390
发表于 2022-7-5 17:50:28 | 显示全部楼层
Thanks Grrr,
The other download location worked like a charm.
Odd that the other website had a broken version...
 
Thanks again!
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-8-23 13:24 , Processed in 0.802349 second(s), 62 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表