Project

General

Profile

Code Blocks » History » Version 3

iri, 09/24/2012 06:42 PM

1 1 iri
h1. Code::Blocks and Scol
2
3
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.
4
5
h2. How to add the Scol highlighting ?
6
7
# 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.
8
# Create two files : _lexer_scol.sample_ and _lexer_scol.xml_
9
# Open _lexer_scol.sample_, add these lines :
10
<pre>
11
/*
12
 * Sample preview code
13
 * This is a block comment
14
 */
15
16
typeof string = S;; // this is a line comment
17
18
fun CBend (obj, user_param)=
19
	_closemachine;;
20
	
21
/*
22
  * This is a documentation comment block
23
  */
24
fun main ()
25
{
26
	// This is a documentation comment line
27
	_showconsole;
28
	set string = "Hello World !";
29
	_fooS string;
30
	let _CRwindow _channel nil 0 0 250 60 WN_NORMAL string -> window in
31
	if window != nil then
32
	(
33
		_CBwinClose window @CBend 0;
34
		0
35
	)
36
	else
37
	(
38
		_fooS "Unable to create a window !";
39
		1
40
	);;
41
}
42
</pre>
43
# Open _lexer_scol.xml_, add that :
44
<pre>
45
<?xml version="1.0"?>
46
<!DOCTYPE CodeBlocks_lexer_properties>
47
<CodeBlocks_lexer_properties>
48
        <Lexer name="Scol/PKG"
49
                index="3"
50
                filemasks="*.pkg">
51
                <Style name="Default"
52
                        index="0,11"
53
                        fg="0,0,0"
54
                        bg="255,255,255"
55
                        bold="0"
56
                        italics="0"
57
                        underlined="0"/>
58
                <Style name="Default (inactive)"
59
                        index="64,72,75"
60
                        fg="200,200,200"/>
61
                <Style name="Comment (normal)"
62
                        index="1,23,65,87"
63
                        fg="160,160,160"/>
64
                <Style name="Comment line (normal)"
65
                        index="2,66"
66
                        fg="190,190,230"/>
67
                <Style name="Comment (documentation)"
68
                        index="3,67"
69
                        fg="128,128,255"
70
                        bold="1"/>
71
                <Style name="Comment line (documentation)"
72
                        index="15,79"
73
                        fg="128,128,255"
74
                        bold="1"/>
75
                <Style name="Comment keyword (documentation)"
76
                        index="17,81"
77
                        fg="0,128,128"/>
78
                <Style name="Comment keyword error (documentation)"
79
                        index="18,82"
80
                        fg="128,0,0"/>
81
                <Style name="Number"
82
                        index="4"
83
                        fg="240,0,240"/>
84
                <Style name="Number (inactive)"
85
                        index="68"
86
                        fg="240,200,240"/>
87
                <Style name="Keyword"
88
                        index="5"
89
                        fg="0,0,160"
90
                        bold="1"/>
91
                <Style name="Keyword (inactive)"
92
                        index="69"
93
                        fg="135,135,200"
94
                        bold="1"/>
95
                <Style name="User keyword"
96
                        index="16"
97
                        fg="0,160,0"
98
                        bold="1"/>
99
                <Style name="User keyword (inactive)"
100
                        index="80"
101
                        fg="154,200,154"
102
                        bold="1"/>
103
                <Style name="Global classes and typedefs"
104
                        index="19"
105
                        fg="190,0,190"
106
                        bold="1"/>
107
                <Style name="Global classes and typedefs (inactive)"
108
                        index="83"
109
                        fg="190,137,190"
110
                        bold="1"/>
111
                <Style name="String"
112
                        index="6,12"
113
                        fg="0,0,255"/>
114
                <Style name="String (inactive)"
115
                        index="70,76"
116
                        fg="190,190,255"/>
117
                <Style name="Character"
118
                        index="7"
119
                        fg="224,160,0"/>
120
                <Style name="Character (inactive)"
121
                        index="71"
122
                        fg="224,206,159"/>
123
                <Style name="Operator"
124
                        index="10"
125
                        fg="255,0,0"/>
126
                <Style name="Operator (inactive)"
127
                        index="74"
128
                        fg="255,200,200"/>
129
                <Style name="Selection"
130
                        index="-99"
131
                        bg="192,192,192"/>
132
                <Style name="Active line"
133
                        index="-98"
134
                        bg="255,255,160"/>
135
                <Style name="Breakpoint line"
136
                        index="-2"
137
                        bg="255,160,160"/>
138
                <Style name="Debugger active line"
139
                        index="-3"
140
                        bg="160,160,255"/>
141
                <Style name="Compiler error line"
142
                        index="-4"
143
                        bg="255,128,0"/>
144
                <Style name="Matching brace highlight"
145
                        index="34"
146
                        fg="0,0,0"
147
                        bg="128,255,255"
148
                        bold="1"/>
149
                <Style name="No matching brace highlight"
150
                        index="35"
151
                        fg="255,255,255"
152
                        bg="255,0,0"
153
                        bold="1"/>
154
                <Keywords>
155
                        <Set index="0"
156
                            value="I S F Env Chn Srv Comm r1 r2
157 2 iri
                            	fun proto typedef struct var typeof defcom defcomvar
158
                                if then else while do exec with match"/>
159 1 iri
                        <Set index="1"
160
                            value="set let in mutate tab nil"/>
161
                </Keywords>
162
                <SampleCode value="lexer_scol.sample"
163
                        breakpoint_line="20"
164
                        debug_line="22"
165
                        error_line="23"/>
166
                <LanguageAttributes
167
                    LineComment="//"
168
                    StreamCommentStart="/*"
169
                    StreamCommentEnd="*/"
170
                    BoxCommentStart="/* "
171
                    BoxCommentMid=" * "
172
                    BoxCommentEnd=" */"
173
                    CaseSensitive="1"/>
174
        </Lexer>
175
</CodeBlocks_lexer_properties>
176
</pre>
177
# Save these two files
178
# Launch C::B
179
# Select Settings in the menu bar, next Editor. Choose Highlight.
180
# In the combo box, verify Scol/PKG
181
# Now, you can open your packages in C::B
182
183
h2. How to add the Scol project ?
184
185 3 iri
# Download the Scol wizard for C::B (see in the bottom of this page)
186 1 iri
# 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)
187
# Edit the _C:\Program Files\CodeBlocks\share\CodeBlocks\templates\wizard\config.script_ (on MS Windows) or _/usr/share/codeblocks/templates/wizard/config.Script_ file
188
# In the function _RegisterWizards()_ (normally, it is the first function), add this line :
189
<pre>
190
// add Scol support
191
    RegisterWizard(wizProject,     _T("scol"),  _T("Scol application"),   _T("Scol"));
192
</pre>
193
# Save it
194
# Launch C::B if this is not already done
195
# Go to _Settings_ menu, next _Compiler_
196
# In the Compiler combo box, select the _GNU GCC Compiler_ and click on _Copy_. Rename it in "Scol compiler".
197
# "Scol compiler" should be compiled. Choose the Toolchain executables".
198
# In the "Compiler directory" field, enter the Scol installation directory (_C:\Program Files\Scol Voyager_ by default on MS Windows)
199
# In "Program files" sub-tab, enter "scol.exe" in all fields
200
# Click on "OK"
201
202
203
h2. How to add the Scol executable to run a project ?
204
205
I'm not sure that this is possible ...
206
Maybe via a "script":http://wiki.codeblocks.org/index.php?title=Scripting_Code::Blocks ?