Fortran添加多行注释
来源:互联网 发布:橡木 知乎 编辑:程序博客网 时间:2024/06/05 02:43
原文地址:http://blog.sina.com.cn/s/blog_4d3905b40100b3vq.html
做法:
- 在..Microsoft VisualStudioCommonMSDEV98MACROS文件夹下生成文件GrpComment.dsm
- 用文本编辑器打开该文件,将以下所附的代码贴在其中,保存(注意保留.dsm后缀)
- 启动CVF,选Tools=>Customize=>Add-insand Macro Files
- 在GrpComment前打勾,去掉其他的勾
- 在同一对话框中选Commands=>Macros,此时在右边可以看见CommentDel和CommentOut
- 选中CommentOut,拖到CVF的工具栏上去(添加工具钮),会弹出Button Appearance对话框
- 选Image and text,在下边Buttontext框中输入名称(默认是CommentOut),如“加注释”
- 类似的方法再将CommentDel命令以工具钮的形式添加到工具栏上,名称可取为“去注释”
这时,工具栏上应该多了两个工具钮:“加注释”和“去注释”。
用法:
- 加注释:选择要加注释的多行代码,点击“加注释”按钮即可;
- 去注释:选择已经注释的多行代码,点击“去注释”按钮即可。
适用:
后缀为f90或f77的代码文件,根据编译器默认的文件后缀不同,自行修改(f90为.f90,f77为.f)。
VBscript代码:
“`VB
Function FileType (ByVal doc)ext= doc.NameFileType= 0pos= Instr(ext, ".")ifpos > 0 then DoWhile pos <> 1 ext= Mid(ext, pos, Len(ext) - pos + 1) pos= Instr(ext, ".") Loop ext= LCase(ext)endifIfext = ".f90" Then FileType= 8ElseIfext = ".f" Then FileType= 9Else FileType= 0EndIfEnd FunctionSub CommentOut ()'DESCRIPTION: 为所选的多行代码加注释Dimwinsetwin = ActiveWindowifwin.type <> "Text" Then MsgBox"This macro can only be run when a text editor window isactive."else TypeOfFile=FileType(ActiveDocument) IfTypeOfFile = 8 Or TypeOfFile = 9 Then IfTypeOfFile = 8 Then CommentType= "! " ' Fortran 90 file Else CommentType= "C " ' Fortran 77 file EndIf StartLine= ActiveDocument.Selection.TopLine EndLine= ActiveDocument.Selection.BottomLine IfEndLine < StartLine Then Temp= StartLine StartLine= EndLine EndLine= Temp EndIf IfEndLine = StartLine Then ActiveDocument.Selection.SelectLine ActiveDocument.Selection= CommentType + ActiveDocument.Selection Else Fori = StartLine To EndLine ActiveDocument.Selection.GoToLinei ActiveDocument.Selection.SelectLine ActiveDocument.Selection= CommentType + _ ActiveDocument.Selection Next EndIf else MsgBox("Unableto comment out the highlighted text" + vbLf + _ "becausethe file type was unrecognized." + vbLf + _ "Ifthe file has not yet been saved, " + vbLf + _ "pleasesave it and try again.") EndIfEndIfEnd SubSub CommentDel ()'DESCRIPTION: 去除所选的多行代码的注释Dimwinsetwin = ActiveWindowifwin.type <> "Text" Then MsgBox"This macro can only be run when a text editor window isactive."else TypeOfFile=FileType(ActiveDocument) IfTypeOfFile = 8 Or TypeOfFile = 9 Then StartLine= ActiveDocument.Selection.TopLine EndLine= ActiveDocument.Selection.BottomLine IfEndLine < StartLine Then Temp= StartLine StartLine= EndLine EndLine= Temp EndIf IfEndLine = StartLine Then ActiveDocument.Selection.SelectLine ActiveDocument.Selection= mid(ActiveDocument.Selection, 3) Else Fori = StartLine To EndLine ActiveDocument.Selection.GoToLinei ActiveDocument.Selection.SelectLine ActiveDocument.Selection= mid(ActiveDocument.Selection, 3) Next EndIf else MsgBox("Unableto comment out the highlighted text" + vbLf + _ "becausethe file type was unrecognized." + vbLf + _ "Ifthe file has not yet been saved, " + vbLf + _ "pleasesave it and try again.") EndIfEndIfEnd Sub
0 0
- Fortran添加多行注释
- Fortran添加多行注释
- fortran 多行注释
- vim 多行添加注释,删除注释
- vi 多行添加注释,删除注释,多行操作
- vi 多行添加注释,删除注释,多行操作
- ADT快速添加多行注释
- Vim 添加删除多行注释
- VC6.0多行代码注释工具,VC6.0怎么添加多行注释
- 如何在Visual C++ 6.0中添加多行注释图标和多行注释快捷键?
- vi/vim如何添加或删除多行注释
- vi/vim如何添加或删除多行注释
- shell脚本中怎样添加多行注释
- vim如何添加或删除多行注释
- vi/vim如何添加或删除多行注释
- vim如何添加或删除多行注释
- vi/vim如何添加或删除多行注释
- [Linux]vi/vim下添加多行注释和取消注释
- 互联网组织的未来:剖析GitHub员工的任性之源
- JS的本地保存localStorage、sessionStorage用法总结
- Programming input drivers
- 计算机网络面试题总结
- Linux crontab定时执行任务 命令格式与详细例子
- Fortran添加多行注释
- C# .net mvc 依赖注入、控制反转、Ioc、Autoface(草稿)
- js闭包
- MQTT+ActiveMQ实现消息推送(服务器端java实现)
- 2017/5/9第一篇博客内容 点击文字选中checkbox
- iOS开发 非常全的三方库、插件、大牛博客等等
- UI——Material Design设计之滑动菜单详解
- [李景山php] 深入理解PHP内核[读书笔记]--第二章:用户代码执行--PHP脚本的执行 词法分析和语法分析
- git常用命令(二)