• Ubuntu下实现gedit支持nesC语法高亮


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

    1 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> 
    =======================================================================
    中文名:高洪臣
    英文名:Gordon Scott
    E-mail:gaohongchen01@163.com
    =======================================================================
  • 相关阅读:
    MonkeyScript_API
    APP性能(Monkey)【启动时间、CPU、流量、电量、内存、FPS、过度渲染】
    adb基本命令 & Monkey发生随机事件命令及参数说明
    MonkeyRunner_API
    2021春招冲刺-1218 页面置换算法 | sort的原理 | 语义化标签 | 标签的继承
    2021春招冲刺-1217 线程与进程 | ES6语法 | h5新增标签
    2021春招冲刺-1216 死锁 | 箭头函数 | 内联元素 | 页面渲染
    【unity】旧世开发日志
    HTTP 与HTTPS 简单理解
    GET POST 区分
  • 原文地址:https://www.cnblogs.com/gaohongchen01/p/3693824.html
Copyright © 2020-2023  润新知