Project

General

Profile

Actions

Code::Blocks and Scol

Multiplatform, Code::Blocks (C::B) is a free C/C++ IDE. This software can be helpful if you develop the Scol language too.

How to add the Scol highlighting ?

  1. Once C::B installed, go to C:\Program Files\CodeBlocks\share\CodeBlocks\lexers directory (adapt this path to your case, if any) if you are on a MS Windows system or go to /usr/share/codeblocks/lexers if you are on GNULinux.
  2. Create two files : lexer_scol.sample and lexer_scol.xml
  3. Open lexer_scol.sample, add these lines :
    /*
     * Sample preview code
     * This is a block comment
     */
    
    typeof string = S;; // this is a line comment
    
    fun CBend (obj, user_param)=
        _closemachine;;
    
    /*
      * This is a documentation comment block
      */
    fun main ()
    {
        // This is a documentation comment line
        _showconsole;
        set string = "Hello World !";
        _fooS string;
        let _CRwindow _channel nil 0 0 250 60 WN_NORMAL string -> window in
        if window != nil then
        (
            _CBwinClose window @CBend 0;
            0
        )
        else
        (
            _fooS "Unable to create a window !";
            1
        );;
    }
    
  4. Open lexer_scol.xml, add that :
    <?xml version="1.0"?>
    <!DOCTYPE CodeBlocks_lexer_properties>
    <CodeBlocks_lexer_properties>
            <Lexer name="Scol/PKG" 
                    index="3" 
                    filemasks="*.pkg">
                    <Style name="Default" 
                            index="0,11" 
                            fg="0,0,0" 
                            bg="255,255,255" 
                            bold="0" 
                            italics="0" 
                            underlined="0"/>
                    <Style name="Default (inactive)" 
                            index="64,72,75" 
                            fg="200,200,200"/>
                    <Style name="Comment (normal)" 
                            index="1,23,65,87" 
                            fg="160,160,160"/>
                    <Style name="Comment line (normal)" 
                            index="2,66" 
                            fg="190,190,230"/>
                    <Style name="Comment (documentation)" 
                            index="3,67" 
                            fg="128,128,255" 
                            bold="1"/>
                    <Style name="Comment line (documentation)" 
                            index="15,79" 
                            fg="128,128,255" 
                            bold="1"/>
                    <Style name="Comment keyword (documentation)" 
                            index="17,81" 
                            fg="0,128,128"/>
                    <Style name="Comment keyword error (documentation)" 
                            index="18,82" 
                            fg="128,0,0"/>
                    <Style name="Number" 
                            index="4" 
                            fg="240,0,240"/>
                    <Style name="Number (inactive)" 
                            index="68" 
                            fg="240,200,240"/>
                    <Style name="Keyword" 
                            index="5" 
                            fg="0,0,160" 
                            bold="1"/>
                    <Style name="Keyword (inactive)" 
                            index="69" 
                            fg="135,135,200" 
                            bold="1"/>
                    <Style name="User keyword" 
                            index="16" 
                            fg="0,160,0" 
                            bold="1"/>
                    <Style name="User keyword (inactive)" 
                            index="80" 
                            fg="154,200,154" 
                            bold="1"/>
                    <Style name="Global classes and typedefs" 
                            index="19" 
                            fg="190,0,190" 
                            bold="1"/>
                    <Style name="Global classes and typedefs (inactive)" 
                            index="83" 
                            fg="190,137,190" 
                            bold="1"/>
                    <Style name="String" 
                            index="6,12" 
                            fg="0,0,255"/>
                    <Style name="String (inactive)" 
                            index="70,76" 
                            fg="190,190,255"/>
                    <Style name="Character" 
                            index="7" 
                            fg="224,160,0"/>
                    <Style name="Character (inactive)" 
                            index="71" 
                            fg="224,206,159"/>
                    <Style name="Operator" 
                            index="10" 
                            fg="255,0,0"/>
                    <Style name="Operator (inactive)" 
                            index="74" 
                            fg="255,200,200"/>
                    <Style name="Selection" 
                            index="-99" 
                            bg="192,192,192"/>
                    <Style name="Active line" 
                            index="-98" 
                            bg="255,255,160"/>
                    <Style name="Breakpoint line" 
                            index="-2" 
                            bg="255,160,160"/>
                    <Style name="Debugger active line" 
                            index="-3" 
                            bg="160,160,255"/>
                    <Style name="Compiler error line" 
                            index="-4" 
                            bg="255,128,0"/>
                    <Style name="Matching brace highlight" 
                            index="34" 
                            fg="0,0,0" 
                            bg="128,255,255" 
                            bold="1"/>
                    <Style name="No matching brace highlight" 
                            index="35" 
                            fg="255,255,255" 
                            bg="255,0,0" 
                            bold="1"/>
                    <Keywords>
                            <Set index="0" 
                                value="I S F Env Chn Srv Comm r1 r2
                                    fun proto typedef struct var typeof defcom defcomvar
                                    if then else while do exec with match"/>
                            <Set index="1" 
                                value="set let in mutate tab nil"/>
                    </Keywords>
                    <SampleCode value="lexer_scol.sample" 
                            breakpoint_line="20" 
                            debug_line="22" 
                            error_line="23"/>
                    <LanguageAttributes
                        LineComment="//" 
                        StreamCommentStart="/*" 
                        StreamCommentEnd="*/" 
                        BoxCommentStart="/* " 
                        BoxCommentMid=" * " 
                        BoxCommentEnd=" */" 
                        CaseSensitive="1"/>
            </Lexer>
    </CodeBlocks_lexer_properties>
    
  5. Save these two files
  6. Launch C::B
  7. Select Settings in the menu bar, next Editor. Choose Highlight.
  8. In the combo box, verify Scol/PKG
  9. Now, you can open your packages in C::B

How to add the Scol project ?

  1. Download the Scol wizard for C::B (see in the bottom of this page)
  2. Extract the archive in C:\Program Files\CodeBlocks\share\CodeBlocks\templates\wizard (on MS Windows system) or /usr/share/codeblocks/templates/wizard (on GNU/Linux)
  3. Edit the C:\Program Files\CodeBlocks\share\CodeBlocks\templates\wizard\config.script (on MS Windows) or /usr/share/codeblocks/templates/wizard/config.script file
  4. In the function RegisterWizards() (normally, it is the first function), add this line :
    // add Scol support
        RegisterWizard(wizProject,     _T("scol"),  _T("Scol application"),   _T("Scol"));
    
  5. Save it
  6. Launch C::B if this is not already done
  7. Go to Settings menu, next Compiler
  8. In the Compiler combo box, select the GNU GCC Compiler and click on Copy. Rename it in "Scol compiler".
  9. "Scol compiler" should be compiled. Choose the Toolchain executables".
  10. In the "Compiler directory" field, enter the Scol installation directory (C:\Program Files\Scol Voyager by default on MS Windows)
  11. In "Program files" sub-tab, enter "scol.exe" in all fields
  12. Click on "OK"

How to add the Scol executable to run a project ?

I'm not sure that this is possible ...
Maybe via a script ?

Updated by iri over 11 years ago · 4 revisions