基于 VisualLisp编程语言下的编译实现方法及*** 技术领域 Compilation implementation method and system based on VisualLisp programming language
本发明涉及计算机技术领域,尤其涉及一种基于 VisualLisp编程语言下的编 译实现方法及***。 背景技术 The present invention relates to the field of computer technology, and in particular, to a method and system for compiling a translation based on a VisualLisp programming language. Background technique
目前针对 AutoCAD 进行二次开发的其中一门编程语言 VisualLisp 是 AutoDesk公司于上世纪 90年代引入 AutoCAD的编程语言。 在 AutoCAD使用 用户中仅有 5%的人能够进行一般性的开发, 仅有不到 1%的人能够进行专业开 发。因为对于非计算机专业人员来说,编程是难度较高的一项技能。原 AutoCAD 二次开发编程语言均是英文的, 英文不好的人较难以接受。 原 AutoCAD二次开 发编程语言语法均相对复杂, 不符合中文语法习惯, 学习和操作有一定难度。 原 AutoCAD二次开发编程语言编码量过大,实现一个筒单功能需编写大量代码, 造成人力浪费。 发明内容 One of the current programming languages for AutoCAD, VisualLisp, is the programming language that AutoDesk introduced in the 1990s. Only 5% of AutoCAD users are able to develop in general, and less than 1% are able to develop professionally. Because programming is a more difficult skill for non-computer professionals. The original AutoCAD secondary development programming language is in English, and people with bad English are more difficult to accept. The original AutoCAD secondary development programming language grammar is relatively complex, does not conform to Chinese grammar habits, learning and operation have certain difficulties. The original AutoCAD secondary development programming language code is too large, to achieve a single function, you need to write a lot of code, resulting in waste of manpower. Summary of the invention
本发明实施例为了解决现有 AutoCAD中操作界面的难度和中文用户的接受 能力,基于 VisualLisp语言的命令库开发了中文命令, 实现了中文操作界面的筒 易度和筒化了开发难度。 In order to solve the difficulty of the operation interface in the existing AutoCAD and the acceptance ability of the Chinese user, the embodiment of the present invention develops a Chinese command based on the VisualLisp language command library, which realizes the ease of the Chinese operation interface and the difficulty of development.
基于上述目的,本发明实施例提供了一种基于 VisualLisp编程语言下的中文 编译实现方法, 所述方法包括: Based on the above objective, an embodiment of the present invention provides a Chinese translation implementation method based on a VisualLisp programming language, and the method includes:
在 VisualLisp命令库中设置中文函数库和中文代码解释器; Set Chinese function library and Chinese code interpreter in VisualLisp command library;
基于 AutoCAD的可视化窗口接收操作用户输入的操作命令; The visualization window based on AutoCAD receives an operation command input by the operation user;
基于中文函数库和中文代码解释器对输入的操作命令进行编译处理; 将编译处理后的结果显示给操作用户。 The input operation command is compiled and processed based on the Chinese function library and the Chinese code interpreter; the compiled result is displayed to the operation user.
所述在 VisualLisp命令库中设置中文函数库和中文代码解释器包括:设置中 文代码解释器所能支持的中文命令库; 以及每一中文命令所对应的中文函数库。
所述基于中文函数库和中文代码解释器对输入的操作命令进行编译处理包 括: 对所述输入的操作命令进行识别判断, 若所述操作命令为中文代码解释器 所解析时, 则调用对应的中文函数库对所述操作命令进行编译处理; 若所述操 作命令不能为中文代码解释器所解析时, 则提示用户输入错误。 The setting of the Chinese function library and the Chinese code interpreter in the VisualLisp command library includes: setting a Chinese command library supported by the Chinese code interpreter; and a Chinese function library corresponding to each Chinese command. The compiling process of the input operation command based on the Chinese function library and the Chinese code interpreter includes: identifying and determining the input operation command, and if the operation command is parsed by the Chinese code interpreter, calling the corresponding The Chinese function library compiles the operation command; if the operation command cannot be parsed by the Chinese code interpreter, the user is prompted to input an error.
相应的,本发明实施例还提供了一种基于 VisualLisp编程语言下的编译实现 方法, 所述方法包括: Correspondingly, an embodiment of the present invention further provides a method for compiling and implementing a method based on a VisualLisp programming language, where the method includes:
在 VisualLisp命令库中设置中文函数库和中文代码解释器; Set Chinese function library and Chinese code interpreter in VisualLisp command library;
基于 AutoCAD的可视化窗口接收操作用户输入的操作命令; The visualization window based on AutoCAD receives an operation command input by the operation user;
判断所述操作命令所处的编译环境; Determining a compilation environment in which the operation command is located;
若判断所述操作命令为中文编译环境, 则基于中文函数库和中文代码解释 器对输入的操作命令进行编译处理; 若判断所述操作命令为英文编译环境, 则 基于英文函数库和英文代码解释器对输入的操作命令进行编译处理; If it is determined that the operation command is a Chinese compilation environment, the input operation command is compiled based on the Chinese function library and the Chinese code interpreter; if the operation command is determined to be an English compilation environment, the English function library and the English code are interpreted. Compiling and processing the input operation commands;
将编译处理后的结果显示给操作用户。 Display the compiled result to the operating user.
所述在 VisualLisp命令库中设置中文函数库和中文代码解释器包括:设置中 文代码解释器所能支持的中文命令库; 以及每一中文命令所对应的中文函数库。 The setting of the Chinese function library and the Chinese code interpreter in the VisualLisp command library includes: setting a Chinese command library supported by the Chinese code interpreter; and a Chinese function library corresponding to each Chinese command.
所述基于中文函数库和中文代码解释器对输入的操作命令进行编译处理包 括: 对所述输入的操作命令进行识别判断, 若所述操作命令为中文代码解释器 所解析时, 则调用对应的中文函数库对所述操作命令进行编译处理; 若所述操 作命令不能为中文代码解释器所解析时, 则提示用户输入错误。 The compiling process of the input operation command based on the Chinese function library and the Chinese code interpreter includes: identifying and determining the input operation command, and if the operation command is parsed by the Chinese code interpreter, calling the corresponding The Chinese function library compiles the operation command; if the operation command cannot be parsed by the Chinese code interpreter, the user is prompted to input an error.
相应的,本发明实施例子还提供了一种基于 VisualLisp编程语言下的编译实 现***, 所述***包括: Correspondingly, the embodiment of the present invention further provides a compiling and realizing system based on the VisualLisp programming language, and the system includes:
命令设置模块,用于在 VisualLisp命令库中设置中文函数库和中文代码解释 哭口. , The command setting module is used to set the Chinese function library and Chinese code in the VisualLisp command library to explain the crying.
VisualLisp命令库模块, 用于存储设置的中文函数库和中文代码解释器; 输入模块,用于基于 AutoCAD的可视化窗口接收操作用户输入的操作命令; 编译模块,用于基于 VisualLisp命令库模块中存储的中文函数库和中文代码 解释器对输入的操作命令进行编译处理; a VisualLisp command library module, a Chinese function library for storing settings and a Chinese code interpreter; an input module for receiving an operation command input by an operation user based on an AutoCAD-based visualization window; and a compilation module for storing based on the VisualLisp command library module The Chinese function library and the Chinese code interpreter compile and process the input operation commands;
显示模块, 用于将编译模块所编译处理后的结果显示给操作用户。 A display module, configured to display the compiled result of the compiled module to the operation user.
所述命令设置模块用于设置中文代码解释器所能支持的中文命令库, 以及 每一中文命令所对应的中文函数库。
所述编译模块还用于对所述输入的操作命令进行识别判断, 若所述操作命 令为中文代码解释器所解析时, 则调用对应的中文函数库对中文命令进行编译 处理; 若所述操作命令不能为中文代码解释器所解析时, 则提示用户输入错误。 The command setting module is configured to set a Chinese command library supported by the Chinese code interpreter, and a Chinese function library corresponding to each Chinese command. The compiling module is further configured to: identify and determine the input operation command, if the operation command is parsed by the Chinese code interpreter, call the corresponding Chinese function library to compile the Chinese command; When the command cannot be parsed by the Chinese code interpreter, the user is prompted to enter an error.
相应的,本发明实施例还提供了一种基于 VisualLisp编程语言下的编译实现 ***, 所述方法包括: Correspondingly, an embodiment of the present invention further provides a compiler implementation system based on a VisualLisp programming language, where the method includes:
命令设置模块,用于在 VisualLisp命令库中设置中文函数库和中文代码解释 哭口. , The command setting module is used to set the Chinese function library and Chinese code in the VisualLisp command library to explain the crying.
VisualLisp命令库模块, 用于存储设置的中文函数库和中文代码解释器; 输入模块,用于基于 AutoCAD的可视化窗口接收操作用户输入的操作命令; 环境识别模块, 用于判断所述操作命令所处的编译环境; The VisualLisp command library module is configured to store the set Chinese function library and the Chinese code interpreter; the input module is configured to receive an operation command input by the operation user according to the AutoCAD-based visualization window; and an environment recognition module, configured to determine that the operation command is located Compilation environment;
第一编译模块, 用于在环境识别模块判断所述操作命令为中文编译环境后, 基于中文函数库和中文代码解释器对输入的操作命令进行编译处理; a first compiling module, configured to: after the environment identification module determines that the operation command is a Chinese compilation environment, compile and process the input operation command based on the Chinese function library and the Chinese code interpreter;
第二编译模块, 用于在环境识别模块判断所述操作命令为英文编译环境后, 基于英文函数库和英文代码解释器对输入的操作命令进行编译处理; a second compiling module, configured to: after the environment identification module determines that the operation command is an English compilation environment, compile and process the input operation command based on the English function library and the English code interpreter;
显示模块, 用于将第一编译模块或者第二编译模块所编译处理后的结果显 示给操作用户。 And a display module, configured to display the compiled result of the first compilation module or the second compilation module to the operation user.
所述命令设置模块用于设置中文代码解释器所能支持的中文命令库, 以及 每一中文命令所对应的中文函数库。 The command setting module is configured to set a Chinese command library supported by the Chinese code interpreter, and a Chinese function library corresponding to each Chinese command.
所述编译模块还用于对所述输入的操作命令进行识别判断, 若所述操作命 令为中文代码解释器所解析时, 则调用对应的中文函数库对中文命令进行编译 处理; 若所述操作命令不能为中文代码解释器所解析时, 则提示用户输入错误。 The compiling module is further configured to: identify and determine the input operation command, if the operation command is parsed by the Chinese code interpreter, call the corresponding Chinese function library to compile the Chinese command; When the command cannot be parsed by the Chinese code interpreter, the user is prompted to enter an error.
通过实施本发明实施例, 以原英文版为底层语言基础, 编写中文函数库和 中文代码解释器, 实现了新的语法筒单而功能更强大的中文 Lisp编程语言。 对 用户来说只需关注中文语言的编写, 无需理会中文代码的解释过程, 这个解释 过程是通过后台编译方式实现的。 比现有任何 AutoCAD相关开发语言更筒单易 学, 可以使用中文语言进行编程, 改掉英文版倒叙的语法方式, 更符合中国人 ***台, 用户的使用安装与原英文 Lisp 编程语言相同, 在
AutoCAD中使用加载 Lisp程序命令即可完成中文编程解释器的加载。用户在编 程时同样可以使用原英文版的编辑器, 并且可以中英文混合操作的命令识别, 也方便传统的操作用户。 附图说明 例或现有技术描述中所需要使用的附图作筒单地介绍, 显而易见地, 下面描述 中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付 出创造性劳动的前提下, 还可以根据这些附图获得其它的附图。 By implementing the embodiment of the present invention, the Chinese language library and the Chinese code interpreter are written on the basis of the original English version as the underlying language, and a new Chinese Lisp programming language with a new grammar and a more powerful function is realized. For the user, it is only necessary to pay attention to the writing of the Chinese language, and there is no need to pay attention to the interpretation process of the Chinese code. This interpretation process is realized by the background compilation method. It is easier to learn than any existing AutoCAD-related development language. It can be programmed in Chinese language, and the English version of the flashback grammar is changed. It is more in line with Chinese habits, the learning cycle is greatly shortened, the Chinese language is more acceptable, and the learning cost is effectively saved. The Chinese function is more powerful than the English function, and the function library is more abundant. The English version of the multi-line code action is completed in one sentence. The English version requires a custom function. The Chinese version is directly provided. Significantly save coding time and save costs. The system development is based on the AutoCAD platform, and the user's installation is the same as the original English Lisp programming language. The loading of the Chinese programming interpreter can be completed by using the Load Lisp program command in AutoCAD. The user can also use the original English version of the editor when programming, and can recognize the commands in the mixed operation of Chinese and English, and also facilitate the traditional operation of the user. BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings, which are incorporated in the claims Other drawings may also be obtained from these drawings without the use of creative labor.
图 1为本发明实施例中的基于 VisualLisp编程语言下的中文编译实现方法流 程图; 1 is a flow chart of a Chinese compiling implementation method based on a VisualLisp programming language according to an embodiment of the present invention;
图 2为本发明实施例中的基于 VisualLisp编程语言下的编译实现***结构示 意图; 2 is a schematic structural diagram of a system for compiling and implementing a system based on a VisualLisp programming language according to an embodiment of the present invention;
图 3为本发明实施例中的基于 VisualLisp编程语言下的编译实现方法流程 图; 3 is a flow chart of a method for compiling and implementing a method based on a VisualLisp programming language according to an embodiment of the present invention;
图 4为本发明实施例中的基于 VisualLisp编程语言下的编译实现***另一结 构示意图; 4 is a schematic diagram of another structure of a compiler implementation system based on a VisualLisp programming language according to an embodiment of the present invention;
图 5为本发明实施例中的基于 VisualLisp编程语言下的编译实现方法的应用 状态图; 5 is an application state diagram of a method for compiling and implementing a method based on a VisualLisp programming language according to an embodiment of the present invention;
图 6为本发明实施例中的基于 VisualLisp编程语言下的编译实现方法的另一 应用状态图。 具体实施方式 FIG. 6 is another application state diagram of a compiling implementation method based on a VisualLisp programming language in an embodiment of the present invention. detailed description
下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行清 楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是 全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有作出创造 性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。 BRIEF DESCRIPTION OF THE DRAWINGS The technical solutions in the embodiments of the present invention will be described in detail with reference to the accompanying drawings. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative work are within the scope of the present invention.
本发明实施例以原英文版为底层语言基础, 编写中文函数库和中文代码解 释器, 实现了新的语法筒单而功能更强大的中文 Lisp编程语言。 以下对本发明 实施例中的内容作具体的说明。
图 1示出了本发明实施例中的基于 VisualLisp编程语言下的中文编译实现方 法流程图, 包括如下步骤: The embodiment of the invention uses the original English version as the basis of the underlying language, and writes a Chinese function library and a Chinese code interpreter, and realizes a new Chinese Lisp programming language with a more powerful grammar and more powerful functions. The contents of the embodiments of the present invention are specifically described below. FIG. 1 is a flowchart of a Chinese compiling implementation method based on a VisualLisp programming language in an embodiment of the present invention, including the following steps:
S101 : 在 VisualLisp命令库中设置中文函数库和中文代码解释器; 设置中文代码解释器所能支持的中文命令库; 以及每一中文命令所对应的 中文函数库。 S101: Setting a Chinese function library and a Chinese code interpreter in the VisualLisp command library; setting a Chinese command library supported by the Chinese code interpreter; and a Chinese function library corresponding to each Chinese command.
S102: 基于 AutoCAD的可视化窗口接收操作用户输入的操作命令; S102: The AutoCAD-based visualization window receives an operation command input by the operation user;
S103: 基于中文函数库和中文代码解释器对输入的操作命令进行编译处理; 对输入的操作命令进行识别判断, 若该操作命令为中文代码解释器所解析 时, 则调用对应的中文函数库对所述操作命令进行编译处理; 若该操作命令不 能为中文代码解释器所解析时, 则提示用户输入错误。 S103: Compiling and processing the input operation command based on the Chinese function library and the Chinese code interpreter; identifying and determining the input operation command, and if the operation command is parsed by the Chinese code interpreter, calling the corresponding Chinese function library pair The operation command performs a compilation process; if the operation command cannot be parsed by the Chinese code interpreter, the user is prompted to input an error.
S104: 将编译处理后的结果显示给操作用户。 S104: Display the compiled result to the operation user.
需要说明的是, 这里以中文开发界面支持操作用户进行 AutoCAD命令的输 入, 首先通过在 VisualLisp命令库中设置相应的中文开发环境和编译环境, 能够 使输入的中文命令支持后台编译处理, 从而筒化了汉字使用者的可操作性。 进 一步的, 在操作命令为原始的英文命令时, 该中文代码解释器和中文函数库识 别不了的情况下, 可以提示用户输入错误; 或者中文编译环境解析不了操作命 令时, 可以把操作命令发送到英文命令的编译环境中, 基于英文代码解释器和 英文函数库进行编译处理, 若能编译处理, 则将编译处理后的结果显示给操作 用户, 否则可提示用户输入错误。 It should be noted that the Chinese development interface supports the operation of the user to input the AutoCAD command. First, by setting the corresponding Chinese development environment and compilation environment in the VisualLisp command library, the input Chinese command can support the background compilation processing, thereby The operability of Chinese characters users. Further, when the operation command is the original English command, the Chinese code interpreter and the Chinese function library may not be recognized, and the user may be prompted to input an error; or when the Chinese compiler environment cannot resolve the operation command, the operation command may be sent to In the compilation environment of the English command, the English code interpreter and the English function library are compiled and processed. If the compilation process can be performed, the compiled result is displayed to the operation user, otherwise the user may be prompted to input an error.
图 2示出了本发明实施例中的基于 VisualLisp编程语言下的编译实现***结 构示意图, 包括如下: FIG. 2 is a schematic diagram showing the structure of a compiler implementation system based on the VisualLisp programming language in the embodiment of the present invention, including the following:
命令设置模块 201 , 用于在 VisualLisp命令库中设置中文函数库和中文代码 解释器; The command setting module 201 is configured to set a Chinese function library and a Chinese code interpreter in the VisualLisp command library;
VisualLisp命令库模块 202,用于存储设置的中文函数库和中文代码解释器; 输入模块 203 , 用于基于 AutoCAD的可视化窗口接收操作用户输入的操作 命令; The VisualLisp command library module 202 is configured to store the set Chinese function library and the Chinese code interpreter; and the input module 203 is configured to receive an operation command input by the operation user according to the AutoCAD-based visualization window;
编译模块 204, 用于基于 VisualLisp命令库模块 202中存储的中文函数库和 中文代码解释器对输入的操作命令进行编译处理; The compiling module 204 is configured to compile and process the input operation command based on the Chinese function library and the Chinese code interpreter stored in the VisualLisp command library module 202;
显示模块 205 , 用于将编译模块所编译处理后的结果显示给操作用户。 The display module 205 is configured to display the compiled result of the compiled module to the operation user.
需要说明的是, 这里的命令设置模块 201 用于设置中文代码解释器所能支
持的中文命令库, 以及每一中文命令所对应的中文函数库。 这里的编译模块 204 还用于对输入的操作命令进行识别判断, 若该操作命令为中文代码解释器所解 析时, 则调用对应的中文函数库对中文命令进行编译处理; 若该操作命令不能 为中文代码解释器所解析时, 则提示用户输入错误。 It should be noted that the command setting module 201 is used to set the Chinese code interpreter. The Chinese command library and the Chinese function library corresponding to each Chinese command. The compiling module 204 is further configured to identify and determine the input operation command. If the operation command is parsed by the Chinese code interpreter, the corresponding Chinese function library is called to compile the Chinese command; if the operation command cannot be When the Chinese code interpreter parses, the user is prompted to enter an error.
需要说明的是, 这里以中文开发界面支持操作用户进行 AutoCAD命令的输 入,首先开发人员会通过命令设置模块 201在 VisualLisp命令库中设置相应的中 文开发环境和编译环境, 能够使输入的中文命令支持后台编译处理, 从而筒化 了汉字使用者的可操作性。 进一步的, 这里的命令设置模块 201 可以同时支持 中文和英文的混合开发, VisualLisp命令库模块 202中存储有中文函数库和中文 代码解释器之外, 还有英文函数库和应为你代码解释器, 在操作命令为原始的 英文命令时, 该中文代码解释器和中文函数库识别不了的情况下, 可以提示用 户输入错误; 或者中文编译环境解析不了操作命令时, 编译模块 204可以调用 英文命令的编译环境中, 基于英文代码解释器和英文函数库进行编译处理, 若 能编译处理, 则将编译处理后的结果显示给操作用户, 否则可提示用户输入错 误。 It should be noted that the Chinese development interface supports the operation of the user to input the AutoCAD command. First, the developer will set the corresponding Chinese development environment and compilation environment in the VisualLisp command library through the command setting module 201, which can enable the input Chinese command support. The background compile processing, which simplifies the operability of Chinese characters. Further, the command setting module 201 can simultaneously support mixed development of Chinese and English. The VisualLisp command library module 202 stores a Chinese function library and a Chinese code interpreter, and an English function library and a code interpreter for you. When the operation command is the original English command, if the Chinese code interpreter and the Chinese function library are not recognized, the user may be prompted to input an error; or when the Chinese compiler environment cannot resolve the operation command, the compiling module 204 may invoke the English command. In the compiler environment, the English code interpreter and the English function library are compiled and processed. If the compilation process can be performed, the compiled result is displayed to the operation user, otherwise the user may be prompted to input an error.
图 3示出了本发明实施例中的基于 VisualLisp编程语言下的编译实现方法流 程图, 包括如下步骤: FIG. 3 is a flowchart of a method for compiling and implementing a method based on a VisualLisp programming language in an embodiment of the present invention, including the following steps:
S301: 在 VisualLisp命令库中设置中文函数库和中文代码解释器; 需要说明的是, 为了满足汉字操作者的需求, 可以基于现有的 VisualLisp 编程语言开发中文函数库和中文代码解释器, 用来实现操作用户的中文命令的 输入。 这里也保留了传统的英文开发环境, 也可以接收传统使用者的喜好, 接 收英文命令的输入。 开发人员在命令设置时, 需要设置中文代码解释器所能支 持的中文命令库; 以及每一中文命令所对应的中文函数库。 S301: setting a Chinese function library and a Chinese code interpreter in the VisualLisp command library; it should be noted that, in order to meet the needs of the Chinese character operator, the Chinese function library and the Chinese code interpreter can be developed based on the existing VisualLisp programming language, The input of the Chinese command of the operating user is implemented. It also retains the traditional English development environment, and can also receive the preferences of traditional users and receive input of English commands. When the developer sets the command, the Chinese command library supported by the Chinese code interpreter needs to be set; and the Chinese function library corresponding to each Chinese command.
S302: 基于 AutoCAD的可视化窗口接收操作用户输入的操作命令; 这里的操作命令可以是中文命令, 也可以是英文命令, ***同时支持两种 命令的输入 S302: The AutoCAD-based visualization window receives an operation command input by the operation user; the operation command here may be a Chinese command or an English command, and the system simultaneously supports input of two commands.
S303: 判断操作命令所处的编译环境, 若识别出操作命令所处的编译环境 为中文时, 则发送到 S304, 若识别出操作命令所处的编译环境为英文时, 则发 送到 S305; S303: determining the compilation environment in which the operation command is located, if it is found that the compilation environment in which the operation command is located is Chinese, then sending to S304, if it is recognized that the compilation environment in which the operation command is located is English, then sending to S305;
S304: 基于中文函数库和中文代码解释器对输入的操作命令进行编译处理;
进一步的, 该步骤中具体包括: 对输入的操作命令进行识别判断, 若操作 命令为中文代码解释器所解析时, 则调用对应的中文函数库对操作命令进行编 译处理; 若操作命令不能为中文代码解释器所解析时, 则提示用户输入错误。 S304: Compiling and processing the input operation command based on the Chinese function library and the Chinese code interpreter; Further, the step specifically includes: identifying and determining the input operation command, and if the operation command is parsed by the Chinese code interpreter, calling the corresponding Chinese function library to compile the operation command; if the operation command cannot be Chinese When the code interpreter parses, the user is prompted to enter an error.
S305: 基于英文函数库和英文代码解释器对输入的操作命令进行编译处理; S306: 将编译处理后的结果显示给操作用户。 S305: Compile and process the input operation command based on the English function library and the English code interpreter; S306: Display the compiled result to the operation user.
需要说明的是, 这里在原有的体系中增加中文编译环境, 以中文开发界面 或者英文开发界面支持操作用户进行 AutoCAD命令的输入。 由于原有的英文命 令库已经存在,首先通过在 VisualLisp命令库中设置相应的中文开发环境和编译 环境, 能够使输入的中文命令支持后台编译处理, 从而筒化了汉字使用者的可 操作性。 在***接收到操作用户的命令输入时, 识别编译环境, 从而调用相应 的编译环境来实现命令的编译处理及输出。 It should be noted that the Chinese compiler environment is added to the original system, and the Chinese development interface or the English development interface is used to support the operation of the user to input AutoCAD commands. Since the original English command library already exists, firstly, by setting the corresponding Chinese development environment and compilation environment in the VisualLisp command library, the input Chinese command can support the background compilation processing, thereby simplifying the operability of the Chinese character user. When the system receives the command input of the operation user, the compilation environment is identified, thereby calling the corresponding compilation environment to implement the compilation processing and output of the command.
图 4示出了本发明实施例中的基于 VisualLisp编程语言下的编译实现***另 一结构示意图, 包括如下: FIG. 4 is a schematic diagram showing another structure of a compiler implementation system based on the VisualLisp programming language in the embodiment of the present invention, including the following:
命令设置模块 401 , 用于在 VisualLisp命令库中设置中文函数库和中文代码 解释器; a command setting module 401, configured to set a Chinese function library and a Chinese code interpreter in the VisualLisp command library;
VisualLisp命令库模块 402,用于存储设置的中文函数库和中文代码解释器; 输入模块 403 , 用于基于 AutoCAD的可视化窗口接收操作用户输入的操作 命令; The VisualLisp command library module 402 is configured to store the set Chinese function library and the Chinese code interpreter; the input module 403 is configured to receive an operation command input by the operation user according to the AutoCAD-based visualization window;
环境识别模块 404, 用于判断所述操作命令所处的编译环境; An environment identification module 404, configured to determine a compilation environment in which the operation command is located;
第一编译模块 405 ,用于在环境识别模块判断所述操作命令为中文编译环境 后, 基于中文函数库和中文代码解释器对输入的操作命令进行编译处理; The first compiling module 405 is configured to: after the environment recognizing module determines that the operation command is a Chinese compiling environment, compile and process the input operation command based on the Chinese function library and the Chinese code interpreter;
第二编译模块 406,用于在环境识别模块判断所述操作命令为英文编译环境 后, 基于英文函数库和英文代码解释器对输入的操作命令进行编译处理; The second compiling module 406 is configured to: after the environment recognizing module determines that the operation command is an English compiling environment, compile and process the input operation command based on the English function library and the English code interpreter;
显示模块 407,用于将第一编译模块或者第二编译模块所编译处理后的结果 显示给操作用户。 The display module 407 is configured to display the compiled result of the first compilation module or the second compilation module to the operation user.
这里的命令设置模块 401用于设置中文代码解释器所能支持的中文命令库, 以及每一中文命令所对应的中文函数库。 这里的编译模块还用于对所述输入的 操作命令进行识别判断, 若所述操作命令为中文代码解释器所解析时, 则调用 对应的中文函数库对中文命令进行编译处理; 若所述操作命令不能为中文代码 解释器所解析时, 则提示用户输入错误。
进一步需要说明的是, 这里在原有的体系中增加中文编译环境, 以中文开 发界面或者英文开发界面支持操作用户进行 AutoCAD命令的输入。 由于原有的 英文命令库已经存在,首先通过在 VisualLisp命令库中设置相应的中文开发环境 和编译环境, 能够使输入的中文命令支持后台编译处理, 从而筒化了汉字使用 者的可操作性。 在***接收到操作用户的命令输入时, 识别编译环境, 从而调 用相应的编译环境来实现命令的编译处理及输出。 The command setting module 401 is used to set the Chinese command library supported by the Chinese code interpreter, and the Chinese function library corresponding to each Chinese command. The compiling module is further configured to: identify and determine the input operation command, and if the operation command is parsed by the Chinese code interpreter, call the corresponding Chinese function library to compile the Chinese command; When the command cannot be parsed by the Chinese code interpreter, the user is prompted to enter an error. Further, it should be noted that the Chinese compiler environment is added to the original system, and the Chinese development interface or the English development interface is used to support the operation user to input AutoCAD commands. Since the original English command library already exists, firstly, by setting the corresponding Chinese development environment and compilation environment in the VisualLisp command library, the input Chinese command can support the background compilation processing, thereby simplifying the operability of the Chinese character user. When the system receives the command input of the operation user, the compilation environment is identified, thereby calling the corresponding compilation environment to implement the compilation processing and output of the command.
图 5和图 6示出了本发明实施例中的操作应用环境, 图 5的操作命令如下: 执行一句(修改(单选) "颜色" = 2) Figures 5 and 6 show the operational application environment in the embodiment of the present invention. The operation command of Figure 5 is as follows: Execute a sentence (modify (single choice) "color" = 2)
先选择一个圓点击即可完成图形修改。 First select a circle and click to complete the graphic modification.
图 6的操作命令如下: The operation commands in Figure 6 are as follows:
执行一句(修改(多选) "颜色" = 3) Execute one sentence (modify (multiple choice) "color" = 3)
先选择多个图形确认即可完成图形修改。 You can complete the graphic modification by selecting multiple graphic confirmations.
综上, 通过实施本发明, 以原英文版为底层语言基础, 编写中文函数库和 中文代码解释器, 实现了新的语法筒单而功能更强大的中文 Lisp编程语言。 对 用户来说只需关注中文语言的编写, 无需理会中文代码的解释过程, 这个解释 过程是通过后台编译方式实现的。 比现有任何 AutoCAD相关开发语言更筒单易 学, 可以使用中文语言进行编程, 改掉英文版倒叙的语法方式, 更符合中国人 ***台, 用户的使用安装与原英文 Lisp 编程语言相同, 在 AutoCAD中使用加载 Lisp程序命令即可完成中文编程解释器的加载。用户在编 程时同样可以使用原英文版的编辑器, 并且可以中英文混合操作的命令识别, 也方便传统的操作用户。 In summary, by implementing the present invention, the Chinese language library and the Chinese code interpreter are written on the basis of the original English version as the underlying language, and a new Chinese Lisp programming language with a new grammar and a more powerful function is realized. For the user, it is only necessary to pay attention to the writing of the Chinese language, and there is no need to pay attention to the interpretation process of the Chinese code. This interpretation process is realized by the background compilation method. It is easier to learn than any existing AutoCAD-related development language. It can be programmed in Chinese language, and the English version of the flashback method is changed. It is more in line with Chinese habits, the learning cycle is greatly shortened, the Chinese language is more acceptable, and the learning cost is effectively saved. The Chinese function is more powerful than the English function, and the function library is more abundant. The English version of the multi-line code action is completed in one sentence. The English version requires a custom function, and the Chinese version is directly provided. Significantly save coding time and save costs. The system development is based on the AutoCAD platform. The user's installation is the same as the original English Lisp programming language. The loading of the Lisp program command in AutoCAD can complete the loading of the Chinese programming interpreter. The user can also use the original English version of the editor when programming, and can recognize the commands in the mixed operation of Chinese and English, and also facilitate the traditional operation of the user.
以上对本发明实施例所提供的基于 VisualLisp 编程语言下的编译实现方法 行了阐述, 以上实施例的说明只是用于帮助理解本发明的方法及其核心思想; 同时, 对于本领域的一般技术人员, 依据本发明的思想, 在具体实施方式及应 用范围上均会有改变之处, 综上所述, 本说明书内容不应理解为对本发明的限 制。
The method for compiling and implementing the VisualLisp programming language provided by the embodiment of the present invention is described above. The description of the above embodiments is only for helping to understand the method and core idea of the present invention. Meanwhile, for those skilled in the art, In view of the above, the description of the present invention is not limited to the scope of the present invention.