newlisp 注释生成文档
来源:互联网 发布:隐藏电话号码软件 编辑:程序博客网 时间:2024/05/17 09:12
最近写了一个newlisp_armory库,用来实现一些newlisp自身不支持的操作。比如跨windows和ubuntu的目录拷贝功能等。
自己用的时候,发现没有API reference文档参考,很不方便。于是学习了如何用注释生成文档。
在Ubuntu环境下,首先要下载newlispdoc程序的源码:http://newlisp.org/syntax.cgi?code/newlispdoc.txt
将文件重命名为newlispdoc,添加执行权限,复制到/usr/bin目录下。
也可直接从我的github项目中获得:https://github.com/csfreebird/newlisp_armory.git
然后注意注释的写法,下面是个例子:
;; file.lsp;; @module file;; @description file module provides some file operations on both Ubuntu and Windows;; @location file.lsp;; @version 1.0;; @author Dean Chen;; @example;; (let ((test-dir1 (append (real-path) file:file-seperator "a")) (test-dir2 (append (real-path) file:file-seperator "b")));; (make-dir test-dir1);; (make-dir test-dir2);; (if (directory? test-dir1);; (begin;; (unless (catch (file:copy-folder test-dir1 test-dir2) 'result);; (println (append "catch error: " result));; (println "test copy-folder failed"));; (file:remove-folder test-dir1);; (file:remove-folder test-dir2))))(context 'file);; @syntax (file:init);; @throw Throw error if environment variable NEWLISP_ARMORY_HOME does not exist or is invalid;; @throw Throw error if OS is not Windows or UBuntu;; @note init function will be called automatically when loading file.lsp module, don't call it manually(define (init) (unless (env "NEWLISP_ARMORY_HOME") (throw-error "NEWLISP_ARMORY_HOME does not exist")) (unless (file? (env "NEWLISP_ARMORY_HOME")) (throw-error "NEWLISP_ARMORY_HOME points to a non-existing file")) (unless (directory? (env "NEWLISP_ARMORY_HOME")) (throw-error "NEWLISP_ARMORY_HOME points to a file instead of directory")) (set 'file-folder (append (env "NEWLISP_ARMORY_HOME") "/codes/file")) (if (= ostype "Linux") (load (append file-folder "/file_ubuntu.lsp")) (= ostype "Win32") (load (append file-folder "/file_win.lsp")) (throw-error (append "file tool doesn't support this OS for now, ostype:" ostype)) ))
现在运行命令产生doc:
newlispdoc file.lsp
由于我还有几个支持不同平台的文件,file_ubuntu.lsp和file.win.lsp,似乎newlispdoc没有这么智能。因此我将file_ubuntu.lsp的注释复制到file.lsp中,不复制源代码。
也能够生成。
下面的截图展示了我的doc:
点击链接后,进入详细页面:
说明:
1. @syntax 作用是在index页面中显示函数名称,注意加上模块名,形如:mongo:connect, 参数也不能少
2. @return 作用是表示返回值
3. @param 参数说明
4. @description 添加描述性文字
5. 自定义标签需要首字母大写
- newlisp 注释生成文档
- javadoc生成注释文档
- Doxygen生成文档注释
- javadoc生成注释文档
- Eclipse文档注释生成
- Doxygen生成注释文档
- Doxygen生成注释文档
- 使用appledoc生成注释文档
- Appledoc 生成xcode 注释文档
- eclipse生成Java注释文档
- Java文档注释生成说明书
- Xcode 生成文档与注释
- Ecplise 文档注释及生成
- 快速生成文档注释快捷键
- java注释文档的生成
- Java注释详解-Java文档注释生成Java API文档
- Java注释详解-Java文档注释生成Java API文档
- C#注释文档生成的HTML问题解决
- Find pairs equal zero -- Paypal
- 菜鸟玩云计算之十一:Hadoop 手动安装指南
- Linux 网络应用开发(二)之socket编程
- 比特币的唯一出路-可交易的大规模并行运算包
- 查看某一个shell脚本在什么位置 显示当前操作系统的名称
- newlisp 注释生成文档
- Find the maximum contiguous subsequence product -- InMobi
- android中的dp,px深度解析
- 如何编译无效对象
- 在静态库中,实现自动的初始化与卸载接口
- XP + VS2010 + DirectShow9.0 SDK 环境配置 遇到的问题
- 提高工作效率的一些方法 .
- 移动调研
- Hibernate查询方式汇总