source: trunk/tools/vslick/odin32.e@ 3669

Last change on this file since 3669 was 3574, checked in by bird, 25 years ago

Added command which sets the current directory to the working directory
specified in the projekt when the project is loaded.

File size: 7.6 KB
Line 
1/* $Id: odin32.e,v 1.4 2000-05-19 21:22:51 bird Exp $
2 *
3 * Visual SlickEdit Documentation Macros.
4 *
5 * Copyright (c) 1999-2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 ****
10 *
11 * This define the following keys:
12 *---------------------------------
13 * Ctrl+Shift+C: Class description box.
14 * Ctrl+Shift+F: Function/method description box.
15 * Ctrl+Shift+M: Module(file) description box
16 * Ctrl+Shift+O: One-liner (comment)
17 *
18 * Ctrl+Shift+G: Global box
19 * Ctrl+Shift+H: Header box
20 * Ctrl+Shift+I: Internal function box
21 * Ctrl+Shift+K: Const/macro box
22 * Ctrl+Shift+S: Struct/Typedef box
23 *
24 * Ctrl+Shift+T: Makes tag file
25 *
26 * Remember to set the correct sOdin32UserName, sOdin32UserEmail and sOdin32UserInitials
27 * before compiling and loading the macros into Visual SlickEdit.
28 *
29 * These macros are compatible with both 3.0(c) and 4.0(b).
30 *
31 */
32defeventtab default_keys
33def 'C-S-A' = odin32_signature
34def 'C-S-C' = odin32_classbox
35def 'C-S-F' = odin32_funcbox
36def 'C-S-G' = odin32_globalbox
37def 'C-S-H' = odin32_headerbox
38def 'C-S-I' = odin32_intfuncbox
39def 'C-S-K' = odin32_constbox
40def 'C-S-M' = odin32_modulebox
41def 'C-S-O' = odin32_oneliner
42def 'C-S-S' = odin32_structbox
43def 'C-S-T' = odin32_maketagfile
44
45
46//MARKER. Editor searches for this line!
47#pragma option(redeclvars, on)
48#include 'slick.sh'
49
50/* Remeber to change these! */
51_str sOdin32UserInitials = "kso";
52_str sOdin32UserName = "knut st. osmundsen";
53_str sOdin32UserEmail = "knut.stange.osmundsen@pmsc.no";
54
55
56
57/**
58 * Insers a date string. The date is in ISO format.
59 */
60void odin32_date()
61{
62 int i,j;
63 _str date;
64
65 date = _date('U');
66 i = pos("/", date);
67 j = pos("/", date, i+1);
68 month = substr(date, 1, i-1);
69 if (length(month) == 1) month = '0'month;
70 day = substr(date, i+1, j-i-1);
71 if (length(day) == 1) day = '0'day;
72 year = substr(date, j+1);
73 _insert_text(nls("%s-%s-%s", year, month, day));
74}
75
76
77/**
78 * Get the current year.
79 * @returns Current year string.
80 */
81_str odin32_year()
82{
83 date = _date('U');
84 return substr(date, pos("/",date, pos("/",date)+1)+1, 4);
85}
86
87
88/**
89 * Inserts the first line in a box.
90 * @param sTag Not used - box tag.
91 */
92static void odin32_firstline(sTag)
93{
94 begin_line();
95 if (file_eq(p_extension, 'asm'))
96 _insert_text(";\n");
97 else
98 {
99 _insert_text("/");
100 for (i = 0; i < 80-1; i++)
101 _insert_text("*");
102 _insert_text("\n");
103 }
104}
105
106/**
107 * Inserts a line with a '*' in both ends and some text (a) inside.
108 * @param a text.
109 */
110void odin32_starlinestr(a)
111{
112 if (file_eq(p_extension, 'asm'))
113 {
114 _insert_text("; ");
115 _insert_text(a);
116 _insert_text("\n");
117 }
118 else
119 {
120 _insert_text("* ");
121 _insert_text(a);
122 for (i = 0; i < 80-3-length(a); i++)
123 _insert_text(" ");
124 _insert_text("*\n");
125 }
126}
127
128
129/**
130 * Empty line with a '*' in both ends.
131 */
132void odin32_starline()
133{
134 odin32_starlinestr("");
135}
136
137
138/**
139 * Inserts the last line in a box.
140 */
141void odin32_lastline()
142{
143 if (file_eq(p_extension, 'asm'))
144 _insert_text(";\n");
145 else
146 {
147 for (i = 0; i < 80-1; i++)
148 _insert_text("*");
149 _insert_text("/\n");
150 }
151}
152
153
154
155/**
156 * Inserts a signature. Form: "//Initials ISO-date:"
157 * @remark defeventtab
158 */
159void odin32_signature()
160{
161 if (file_eq(p_extension, 'asm'))
162 _insert_text(";"sOdin32UserInitials" ");
163 else
164 _insert_text("//"sOdin32UserInitials" ");
165
166 odin32_date()
167 _insert_text(":");
168}
169
170
171/**
172 * SDS - Classbox(/header).
173 * @remark defeventtab
174 */
175void odin32_classbox()
176{
177 _begin_line();
178 _insert_text("/**\n");
179 _insert_text(" * \n");
180 _insert_text(" * @shortdesc \n");
181 _insert_text(" * @dstruct \n");
182 _insert_text(" * @version \n");
183 _insert_text(" * @verdesc \n");
184 _insert_text(" * @author " sOdin32UserName " (" sOdin32UserEmail ")\n");
185 _insert_text(" * @approval \n");
186 _insert_text(" */\n");
187
188 up(8);
189 p_col += 3;
190}
191
192
193/**
194 * SDS - functionbox(/header).
195 * @remark defeventtab
196 */
197void odin32_funcbox()
198{
199 _begin_line();
200 if (file_eq(p_extension, 'asm'))
201 {
202 _insert_text(";;\n");
203 _insert_text("; \n");
204 _insert_text("; @cproto \n");
205 _insert_text("; @returns \n");
206 _insert_text("; @param \n");
207 _insert_text("; @uses \n");
208 _insert_text("; @equiv \n");
209 _insert_text("; @time \n");
210 _insert_text("; @sketch \n");
211 _insert_text("; @status \n");
212 _insert_text("; @author "sOdin32UserName" (" sOdin32UserEmail ")\n");
213 _insert_text("; @remark \n");
214 up(11);
215 p_col = 3;
216 }
217 else
218 {
219 _insert_text("/**\n");
220 _insert_text(" * \n");
221 _insert_text(" * @returns \n");
222 _insert_text(" * @param \n");
223 _insert_text(" * @equiv \n");
224 _insert_text(" * @time \n");
225 _insert_text(" * @sketch \n");
226 _insert_text(" * @status \n");
227 _insert_text(" * @author "sOdin32UserName" (" sOdin32UserEmail ")\n");
228 _insert_text(" * @remark \n");
229 _insert_text(" */\n");
230 up(10);
231 p_col = 4;
232 }
233
234}
235
236
237/**
238 *
239 * @remark defeventtab
240 */
241void odin32_globalbox()
242{
243 odin32_firstline("Global");
244 odin32_starlinestr(" Global Variables");
245 odin32_lastline();
246}
247
248
249void odin32_headerbox()
250{
251 odin32_firstline("Header");
252 odin32_starlinestr(" Header Files");
253 odin32_lastline();
254}
255
256
257void odin32_intfuncbox()
258{
259 odin32_firstline("IntFunc");
260 odin32_starlinestr(" Internal Functions");
261 odin32_lastline();
262}
263
264
265void odin32_constbox()
266{
267 odin32_firstline("Const");
268 odin32_starlinestr(" Defined Constants And Macros");
269 odin32_lastline();
270}
271
272
273void odin32_oneliner()
274{
275 end_line();
276 do
277 {
278 _insert_text(" ");
279 } while (p_col < 41);
280
281 if (file_eq(p_extension, 'asm'))
282 {
283 _insert_text("; ");
284 }
285 else
286 {
287 _insert_text("/* */");
288 p_col = p_col - 3;
289 }
290}
291
292
293void odin32_structbox()
294{
295 odin32_firstline("Struct");
296 odin32_starlinestr(" Structures and Typedefs");
297 odin32_lastline();
298}
299
300
301void odin32_modulebox()
302{
303 _begin_line();
304 if (file_eq(p_extension, 'asm'))
305 {
306 _insert_text("; $Id: odin32.e,v 1.4 2000-05-19 21:22:51 bird Exp $\n");
307 _insert_text("; \n");
308 _insert_text("; \n");
309 _insert_text("; \n");
310 _insert_text("; Copyright (c) " odin32_year() " "sOdin32UserName" (" sOdin32UserEmail ")\n");
311 _insert_text("; \n");
312 _insert_text("; Project Odin Software License can be found in LICENSE.TXT\n");
313 _insert_text("; \n");
314 up(6);
315 p_col = 3;
316 }
317 else
318 {
319 _insert_text("/* $Id: odin32.e,v 1.4 2000-05-19 21:22:51 bird Exp $\n");
320 _insert_text(" * \n");
321 _insert_text(" * \n");
322 _insert_text(" * \n");
323 _insert_text(" * Copyright (c) " odin32_year() " "sOdin32UserName" (" sOdin32UserEmail ")\n");
324 _insert_text(" *\n");
325 _insert_text(" * Project Odin Software License can be found in LICENSE.TXT\n");
326 _insert_text(" *\n");
327 _insert_text(" */\n");
328 up(7);
329 p_col = 4;
330 }
331}
332
333
334_command void odin32_maketagfile()
335{
336 if (file_match('-p 'maybe_quote_filename(strip_filename(_project_name,'e'):+TAG_FILE_EXT),1)=="")
337 _project_update_files_retag(true,false,false,true);
338}
339
340_command void odin32_setcurrentdir()
341{
342 _ini_get_value(_project_name,"COMPILER","WORKINGDIR", workingdir);
343 chdir(workingdir, 1);
344}
Note: See TracBrowser for help on using the repository browser.