Project

General

Profile

Code Blocks » History » Revision 3

Revision 2 (iri, 09/24/2012 06:41 PM) → Revision 3/4 (iri, 09/24/2012 06:42 PM)

h1. Code::Blocks and Scol 

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

 h2. How to add the Scol highlighting ? 

 # 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. 
 # Create two files : _lexer_scol.sample_ and _lexer_scol.xml_ 
 # Open _lexer_scol.sample_, add these lines : 
 <pre> 
 /* 
  * 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 
	 );; 
 } 
 </pre> 
 # Open _lexer_scol.xml_, add that : 
 <pre> 
 <?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> 
 </pre> 
 # Save these two files 
 # Launch C::B 
 # Select Settings in the menu bar, next Editor. Choose Highlight. 
 # In the combo box, verify Scol/PKG 
 # Now, you can open your packages in C::B 

 h2. How to add the Scol project ? 

 # Download the Scol wizard project for C::B (see in the bottom of this page) 
 # 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) 
 # Edit the _C:\Program Files\CodeBlocks\share\CodeBlocks\templates\wizard\config.script_ (on MS Windows) or _/usr/share/codeblocks/templates/wizard/config.Script_ file 
 # In the function _RegisterWizards()_ (normally, it is the first function), add this line : 
 <pre> 
 // add Scol support 
     RegisterWizard(wizProject,       _T("scol"),    _T("Scol application"),     _T("Scol")); 
 </pre> 
 # Save it 
 # Launch C::B if this is not already done 
 # Go to _Settings_ menu, next _Compiler_ 
 # In the Compiler combo box, select the _GNU GCC Compiler_ and click on _Copy_. Rename it in "Scol compiler". 
 # "Scol compiler" should be compiled. Choose the Toolchain executables". 
 # In the "Compiler directory" field, enter the Scol installation directory (_C:\Program Files\Scol Voyager_ by default on MS Windows) 
 # In "Program files" sub-tab, enter "scol.exe" in all fields 
 # Click on "OK" 


 h2. How to add the Scol executable to run a project ? 

 I'm not sure that this is possible ... 
 Maybe via a "script":http://wiki.codeblocks.org/index.php?title=Scripting_Code::Blocks ?