欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > DOCX文档下载  

    fortran 多行注释.docx

    • 资源ID:3157297       资源大小:37.70KB        全文页数:5页
    • 资源格式: DOCX        下载积分:6.99金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要6.99金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    fortran 多行注释.docx

    fortran 多行注释fortran 多行注释 你编程序时肯定遇到要一次为很多行代码加注释的情况,以前我都是一行行的加“!”,今天偶然在一个论坛上看到一个解决方案,而且自己按照他的方法,试验了一下,证明切实可行!现与大家分享: 不止一位问道可不可以在visual fortran中为多行代码加注释。 visual fortran本身无这样的功能,但是可以用macro功能自己添!而且是添加工具钮! 做法: (1) 在.Microsoft Visual StudioCommonMSDEV98MACROS文件夹下生成文件GrpComment.dsm (2) 用文本编辑器打开该文件,将以下所附的代码贴在其中,保存 (3) 启动CVF,选Tools=>Customize=>Add-ins and Macro Files (4) 在GrpComment前打勾,去掉其他的勾 (5) 在同一对话框中选Commands=>Macros,此时在右边可以看见CommentDel和CommentOut (6) 选中CommentOut,拖到CVF的工具栏上去,会弹出Button Appearance对话框 (7) 选Image and text,在下边Button text框中输入名称,如“加注释” (8) 类似的方法再将CommentDel命令以工具钮的形式添加到工具栏上,名称可取为“去注释” 这时,工具栏上应该多了两个工具钮:“加注释”和“去注释”。 用法: 加注释:选择要加注释的多行代码,点击“加注释”按钮即可; 去注释:选择已经注释的多行代码,点击“去注释”按钮即可。 适用:后缀为f90或f77的代码文件。 = VBscript代码: Function FileType (ByVal doc) ext = doc.Name FileType = 0 pos = Instr(ext, ".") if pos > 0 then Do While pos <> 1 ext = Mid(ext, pos, Len(ext) - pos + 1) pos = Instr(ext, ".") Loop ext = LCase(ext) end if If ext = ".f90" Then FileType = 8 ElseIf ext = ".for" Then FileType = 9 Else FileType = 0 End If End Function Sub CommentOut 'DESCRIPTION: 为所选的多行代码加注释 Dim win set win = ActiveWindow if win.type <> "Text" Then MsgBox "This macro can only be run when a text editor window is active." else TypeOfFile = FileType(ActiveDocument) If TypeOfFile = 8 Or TypeOfFile = 9 Then If TypeOfFile = 8 Then CommentType = "! " ' Fortran 90 file Else CommentType = "C " ' Fortran 77 file End If StartLine = ActiveDocument.Selection.TopLine EndLine = ActiveDocument.Selection.BottomLine If EndLine < StartLine Then Temp = StartLine StartLine = EndLine EndLine = Temp End If If EndLine = StartLine Then ActiveDocument.Selection.SelectLine ActiveDocument.Selection = CommentType ActiveDocument.Selection Else For i = StartLine To EndLine ActiveDocument.Selection.GoToLine i ActiveDocument.Selection.SelectLine ActiveDocument.Selection = CommentType + _ ActiveDocument.Selection Next End If else MsgBox("Unable to comment out the highlighted text" + vbLf + _ "because the file type was unrecognized." + vbLf + _ "If the file has not yet been saved, " + vbLf + _ "please save it and try again.") End If End If End Sub Sub CommentDel 'DESCRIPTION: 去除所选的多行代码的注释 Dim win set win = ActiveWindow if win.type <> "Text" Then MsgBox "This macro can only be run when a text editor window is active." else TypeOfFile = FileType(ActiveDocument) If TypeOfFile = 8 Or TypeOfFile = 9 Then StartLine = ActiveDocument.Selection.TopLine EndLine = ActiveDocument.Selection.BottomLine If EndLine < StartLine Then Temp = StartLine StartLine = EndLine EndLine = Temp End If If EndLine = StartLine Then ActiveDocument.Selection.SelectLine ActiveDocument.Selection = mid(ActiveDocument.Selection, 3) + Else For i = StartLine To EndLine ActiveDocument.Selection.GoToLine i ActiveDocument.Selection.SelectLine ActiveDocument.Selection = mid(ActiveDocument.Selection, 3) Next End If else MsgBox("Unable to comment out the highlighted text" + vbLf + _ End If End If End Sub "because the file type was unrecognized." + vbLf + _ "If the file has not yet been saved, " + vbLf + _ "please save it and try again.")

    注意事项

    本文(fortran 多行注释.docx)为本站会员(小飞机)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开