在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. 如何跟踪某个session的SQL

    1 oracle自带的sql trace程序可以跟踪本地session sys: alter system set sql_trace = true;对所有会话跟踪 schema: alter ses ...

  2. async.series

    [async.series] series适用于顺序执行异步且前后无关联的调用.对于顺序执行异步且前后有叛逆的调用,则需要使用waterfall. If any functions in the se ...

  3. appium API接口

    appium API接口 标签(空格分隔): appium常用api 1.contexts contexts(self) 返回当前会话的上下文,使用可以识别H5页面的控件: driver.contex ...

  4. Java反射、动态加载(将java类名、方法、方法参数当做参数传递,执行方法)

    需求:将java类名.方法.方法参数当做参数传递,执行方法.可以用java的动态加载实现   反射的过程如下:     第一步:通过反射找到类并创建实例(classname为要实例化的类名,由pack ...

  5. android 区分wifi是5G还是2.4G(转)

    http://bbs.csdn.net/topics/391033966?page=1 我一开始看这帖子,找不到答案,为了后来的人,我来回复吧.WifiManager wifiManager = (W ...

  6. js增减日期

    参考 https://www.cnblogs.com/gmq-sh/p/5194706.html date.setDate(date.getDate() + 3);

  7. SQL Server 2008 R2官方中文版下载

    SQL Server 2008是一个重大的产品版本,它推出了许多新的特性和关键的改进,使得它成为至今为止的最强大和最全面的SQL Server版本. 在现今数据的世界里,公司要获得成功和不断发展,他们 ...

  8. 终端设备 tty,pty,pts 概念与文件描述符的联系

    第1节 理解终端设备tty.pty.pts概念 简要描述: 终端设备默认具有输入.输出功能. 现代我们最常用的接入服务器端的方式(如:ssh通过tcp/ip的方式连接服务器端,作为服务器的终端设备)为 ...

  9. .mht文件转换为html

    用360浏览器打开文件后,Ctrl + s  保存即可

  10. 三:python 对象类型详解一:数字(上)

    一:python 的数字类型: a)整数和浮点数 b)复数 c)固定精度的十进制数 d)有理分数 e)集合 f)布尔类型 g)无穷的整数精度 h)各种数字内置函数和模块 二:各种数字类型的详解 1,数 ...