在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. HTML 设置字体

    HTML,CSS,font-family:中文字体的英文名称 (宋体 微软雅黑)     宋体 SimSun 黑体 SimHei 微软雅黑 Microsoft YaHei 微软正黑体 Microsof ...

  2. float double 如何存储计算2 (这个写的也不错)

    目前java遵照IEEE制定的浮点数表示法来进行float,double运算.这种结构是一种科学计数法,用符号.指数和尾数来表示,底数定为2——即把一个浮点数表示为尾数乘以2的指数次方再添上符号. 我 ...

  3. zookeeper 常用cLi命令

    官网:https://zookeeper.apache.org/doc/r3.4.8/zookeeperAdmin.html#sc_zkCommands stat path [watch] set p ...

  4. idea 热部署之JRebel安装-激活-简单使用(修改方法\配置文件均生效)

    1.简介 JRebel插件在IntelliJ IDEA中用于代码的热部署,即工程在已经启动的状态下修改代码,可以不用再重启服务,JRebel插件会自动帮我们编译代码,然后重启.整个重启的过程耗时非常短 ...

  5. day27 异常处理 和 网络协议

    元类补充 class MyMeta(type): # 用于新建类对象 def __new__(cls,*args,**kwargs) print(MyMeta) print(*args) # 调用ty ...

  6. 问题:使用ajax跳转到新页面无效(浏览器Safari)

    问题:使用ajax跳转到新页面无效(浏览器Safari)   window.open("{% url "runtestinfo" %}")   但是使用loca ...

  7. Jboss 数据源密码明文加密

    转载:https://blog.csdn.net/iberr/article/details/40896479 备注:解密小程序没有测试,知识了解了加密解密过程.对自己的帮助是看懂了连接数据库的配置, ...

  8. js获取当前网页header头部信息

    思路,通过ajax重新请求当前页面,用getAllResponseHeaders方法获取: var req = new XMLHttpRequest();req.open('GET', documen ...

  9. pta7-19打印学生选课清单(模拟)

    题目链接:https://pintia.cn/problem-sets/1101307589335527424/problems/1101314114875633664 题意:输入n个学生,k門课程, ...

  10. openstack(Pike 版)集群部署(六)--- Horizon 部署

    一.介绍 参照官网部署:https://docs.openstack.org/horizon/pike/install/    继续上一博客进行部署:http://www.cnblogs.com/we ...