在TinyOS下主要采用nesC语言(C语言的一个变种)编程,ubuntu系统默认打开文本的工具是gedit,为实现gedit支持nesC语法高亮,将最下面的代码保存为nesC.lang文件,然后将nesC.lang复制到指定目录,执行一下命令:

 sudo cp ~/nesc.lang /usr/share/gtksourceview-3.0/language-specs/

重启gedit,选择View->Hightlight Mode->Sources->NesC,就OK了。

<?xml version="1.0" encoding="UTF-8"?>

<!--

 nesC (network embedded system C) GtkSourceview language definition
based on GtkSourceview C language definition. Authors: Ariel Núñez, Marco Barisione, Emanuele Aina, Trilok Inakota
Copyright (C) 2005-2007 Marco Barisione <barisione@gmail.com>
Copyright (C) 2005-2007 Emanuele Aina
Copyright (C) 2007 Ariel Núñez (Adapted to NesC the cpp.lang written by Marco and Emanuele)
Copyright (C) 2010,Trilok Inakota, <itrilok@gmail.com> This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. --> <language id="nesc" _name="NesC" version="2.0" _section="Sources">
<metadata>
<property name="mimetypes">text/x-nc</property>
<property name="globs">*.nc;*C.nc;*M.nc;*P.nc</property>
<property name="Wiring">-></property>
<property name="line-comment-start">//</property>
<property name="block-comment-start">/*</property>
<property name="block-comment-end">*/</property>
</metadata> <styles>
<style id="keyword" _name="Keyword" map-to="c:keyword"/>
<style id="wire" _name="Wiring" map-to="c:preprocessor"/>
<style id="type" _name="Data Type" map-to="c:type"/>
<style id="common-defines" _name="Common Defines" map-to="c:common-defines"/>
</styles> <definitions>
<!-- NesC-specific stuff (i.e. stuff which is not C) -->
<context id="nesc-proper">
<include>
<context id="keywords" style-ref="keyword" class="keyword">
<keyword>false</keyword>
<keyword>new</keyword>
<keyword>this</keyword>
<keyword>true</keyword>
<keyword>using</keyword> <keyword>task</keyword>
<keyword>post</keyword>
<keyword>namespace</keyword>
<keyword>event</keyword>
<keyword>command</keyword> <keyword>module</keyword>
<keyword>implementation</keyword>
<keyword>configuration</keyword>
<keyword>typename</keyword>
<keyword>template</keyword>
<keyword>virtual</keyword>
</context> <context id="types" style-ref="type">
<keyword>interface</keyword>
<keyword>generic</keyword>
<keyword>uint8_t</keyword>
<keyword>uint16_t</keyword>
<keyword>uint32_t</keyword>
<keyword>int8_t</keyword>
<keyword>int16_t</keyword>
<keyword>int32_t</keyword>
<keyword>bool</keyword>
<keyword>explicit</keyword>
<keyword>export</keyword>
<keyword>inline</keyword>
<keyword>error_t</keyword>
<keyword>result_t</keyword>
<keyword>packet_t</keyword>
<keyword>message_t</keyword>
<keyword>struct</keyword>
<keyword>enum</keyword>
</context> <context id="common-defines" style-ref="common-defines">
<keyword>provides</keyword>
<keyword>components</keyword>
<keyword>as</keyword>
<keyword>uses</keyword>
<keyword>atomic</keyword>
</context> <context id="wire" style-ref="wire">
<start>-></start>
<end></end>
<include>
<context ref="c:preprocessor"/>
</include>
</context>
</include>
</context> <!-- actual language definition: NesC -specific stuff plus everything from C -->
<context id="nesc">
<include>
<context ref="nesc-proper"/>
<context ref="c:c"/>
</include>
</context>
</definitions>
</language>

Ubuntu下实现gedit支持nesC语法高亮的更多相关文章

  1. wxpython 支持python语法高亮的自定义文本框控件的代码

    在研发闲暇时间,把开发过程中比较重要的一些代码做个珍藏,下面的代码内容是关于wxpython 支持python语法高亮的自定义文本框控件的代码,应该是对大家也有用. import keywordimp ...

  2. VS2015 企业版不支持 JavaScript 语法高亮、智能提醒

    2015年7月,微软终于放出了 Visual Studio 2015 正式版,博主安装了 Visual Studio 2015 企业版之后,居然不支持 JavaScript 的语法高亮.智能提醒功能, ...

  3. 如何让 Editplus 支持 SQL 语法高亮

    editplus 用来编辑或查看一些常用程序源码都很方便,而且软件小巧,但是他原生不能支持对 SQL 文件的高亮显示,有点遗憾,但好在我们可以自定义这种高亮显示,那么要如何设置呢 1. 首先点击下载文 ...

  4. editplus的配置文件来支持sql语法高亮【转】

      editplus默认是没有sql语法高亮的,原因是它的内部没有sql.stx的这样一个语法文件 我们自己在 EditPlus 的安装目录下面新建一个文件名为sql.stx,然后打开editplus ...

  5. 让ubuntu下的eclipse支持GBK编码

    把Windows下工程导入Linux下Eclipse中,由于以前的工程代码,都是GBK编码,而Ubuntu默认不支持GBK编码,所以,我们要让Ubuntu支持GBK,方法如下: 1.修改/var/li ...

  6. myeclipse2014中如何安装freeMarker插件(支持ftl语法高亮)

    MyEcplise2014安装Freemarker插件(支持.ftl文件) 1.下载插件:http://sourceforge.net/projects/freemarker-ide/?source= ...

  7. ubuntu下安装gedit插件

    因为gedit-plugins : 依赖: gir1.2-zeitgeist-2.0 所以首先 sudo apt-get install gir1.2-zeitgeist-2.0 如果报错可以先 su ...

  8. notepad++ 设置支持golang语法高亮

    see https://stackoverflow.com/questions/27747457/golang-plugin-on-notepad

  9. 如何设置nesC在vim中语法高亮

    默认的vim没有支持nesC语法高亮,给阅读源码带来不便.不过可以通过装NesC Syntax Highlighting插件来解决这个问题,具体操作如下:   步骤一:下载插件 在http://www ...

随机推荐

  1. Illegal access: this web application instance has been stopped already. could not load **

    启动tomcat的时候会报这样的错误: Illegal access: this web application instance has been stopped already.  could n ...

  2. curl get请求

    curl --proxy 192.168.1.159:8889  -d "grant_type=client_credential&appid=wxxx&secret=xxx ...

  3. Excel 整个列数字转换成文本

    选中该列----数据---分列----下一步---到步骤三----列数据格式---勾选"文本"---完成.

  4. 微信小程序--分享报错(thirdScriptError Cannot read property 'from' of undefined;at pages/index/index page onShareAppMessage function TypeError: Cannot read property 'from' of undefined)

    分享功能: onShareAppMessage: function (res) { if (res.from === 'button') { // 来自页面内转发按钮 console.log(res. ...

  5. js获取url传值的方法

    这篇文章主要介绍了js获取url传值的方法,实例分析了字符串分割与正则分析两种方法,并补充了一个基于正则匹配实现的js获取url的get传值函数,需要的朋友可以参考下 js获取url参数值: inde ...

  6. RealtimeRendering III

    [RealtimeRendering III] 1.砖块渲染实例. 1)brick & mortar diffuse texture. 2)brick & mortar gloss t ...

  7. Gimbal Lock

    [Gimbal Lock] 万向锁源于欧拉角的是有序处理的.U3D中的序列为: y->x->z.当旋转y时,local坐标系与世界坐标系重合,所以y等于永远按惯性坐标旋转.当x旋转+/-9 ...

  8. c# list批量添加 对象 到数据库的sql

    public void AddList(List<ProModule.Model.pro_manifest_item> list) { Hashtable SQLStringList = ...

  9. iframe解决ajax主域和子域之间的跨域问题

    在某些应用场景下,需要在主域中,调用子域中的某个接口,如果直接在主域中向子域发ajax请求,会报跨域错误,可以用iframe来解决这种跨域问题.假如主域为www.baidu.com,子域为baike. ...

  10. dedecms(织梦系统)如何更新手机版首页模板文件

    https://jingyan.baidu.com/article/ad310e80e4b1dd1849f49e8f.html