1 | /* $Id: kdev.e 113 2004-06-25 12:53:33Z bird $
|
---|
2 | *
|
---|
3 | * Visual SlickEdit Documentation Macros.
|
---|
4 | *
|
---|
5 | * Copyright (c) 1999-2004 knut st. osmundsen <bird@anduin.net>
|
---|
6 | *
|
---|
7 | *
|
---|
8 | * This program is free software; you can redistribute it and/or modify
|
---|
9 | * it under the terms of the GNU General Public License as published by
|
---|
10 | * the Free Software Foundation; either version 2 of the License, or
|
---|
11 | * (at your option) any later version.
|
---|
12 | *
|
---|
13 | * This program is distributed in the hope that it will be useful,
|
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | * GNU General Public License for more details.
|
---|
17 | *
|
---|
18 | * You should have received a copy of the GNU General Public License
|
---|
19 | * along with This program; if not, write to the Free Software
|
---|
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
21 | *
|
---|
22 | */
|
---|
23 |
|
---|
24 | /***
|
---|
25 | *
|
---|
26 | * This define the following keys:
|
---|
27 | *---------------------------------
|
---|
28 | * Ctrl+Shift+C: Class description box.
|
---|
29 | * Ctrl+Shift+F: Function/method description box.
|
---|
30 | * Ctrl+Shift+M: Module(file) description box
|
---|
31 | * Ctrl+Shift+O: One-liner (comment)
|
---|
32 | *
|
---|
33 | * Ctrl+Shift+G: Global box
|
---|
34 | * Ctrl+Shift+H: Header box
|
---|
35 | * Ctrl+Shift+E: Exported Symbols
|
---|
36 | * Ctrl+Shift+I: Internal function box
|
---|
37 | * Ctrl+Shift+K: Const/macro box
|
---|
38 | * Ctrl+Shift+S: Struct/Typedef box
|
---|
39 | *
|
---|
40 | * Ctrl+Shift+A: Signature+Date marker
|
---|
41 | * Ctrl+Shift+P: Mark line as change by me
|
---|
42 | *
|
---|
43 | * Ctrl+Shift+T: Update project tagfile.
|
---|
44 | *
|
---|
45 | * Ctrl+Shift+B: KLOGENTRYX(..)
|
---|
46 | * Ctrl+Shift+E: KLOGEXIT(..)
|
---|
47 | * Ctrl+Shift+N: Do kLog stuff for the current file. No questions.
|
---|
48 | * Ctrl+Shift+Q: Do kLog stuff for the current file. Ask a lot of questions.
|
---|
49 | *
|
---|
50 | * Remember to set the correct sOdin32UserName, sOdin32UserEmail and sOdin32UserInitials
|
---|
51 | * before compiling and loading the macros into Visual SlickEdit.
|
---|
52 | *
|
---|
53 | * These macros are compatible with both 3.0(c) and 4.0(b).
|
---|
54 | *
|
---|
55 | */
|
---|
56 | defeventtab default_keys
|
---|
57 | def 'C-S-A' = k_signature
|
---|
58 | def 'C-S-C' = k_javadoc_classbox
|
---|
59 | def 'C-S-E' = k_box_exported
|
---|
60 | def 'C-S-F' = k_javadoc_funcbox
|
---|
61 | def 'C-S-G' = k_box_globals
|
---|
62 | def 'C-S-H' = k_box_headers
|
---|
63 | def 'C-S-I' = k_box_intfuncs
|
---|
64 | def 'C-S-K' = k_box_consts
|
---|
65 | def 'C-S-M' = k_javadoc_moduleheader
|
---|
66 | def 'C-S-O' = k_oneliner
|
---|
67 | def 'C-S-P' = k_mark_modified_line
|
---|
68 | def 'C-S-S' = k_box_structs
|
---|
69 | def 'C-S-T' = odin32_maketagfile
|
---|
70 |
|
---|
71 | //optional stuff
|
---|
72 | //def 'C-S-Q' = odin32_klog_file_ask
|
---|
73 | //def 'C-S-N' = odin32_klog_file_no_ask
|
---|
74 | //def 'C-S-1' = odin32_klogentry
|
---|
75 | //def 'C-S-3' = odin32_klogexit
|
---|
76 |
|
---|
77 |
|
---|
78 | //MARKER. Editor searches for this line!
|
---|
79 | #pragma option(redeclvars, on)
|
---|
80 | #include 'slick.sh'
|
---|
81 |
|
---|
82 | /* Remeber to change these! */
|
---|
83 | static _str skUserInitials = "kso";
|
---|
84 | static _str skUserName = "knut st. osmundsen";
|
---|
85 | static _str skUserEmail = "bird@innotek.de";
|
---|
86 |
|
---|
87 |
|
---|
88 | /*******************************************************************************
|
---|
89 | * Global Variables *
|
---|
90 | *******************************************************************************/
|
---|
91 | static _str skCodeStyle = 'Opt2Ind4'; /* coding style scheme. */
|
---|
92 | static _str skDocStyle = 'javadoc';/* options: javadoc, */
|
---|
93 | static _str skLicense = 'GPL'; /* options: GPL, LGPL, Odin32, Confidential */
|
---|
94 | static _str skCompany = ''; /* empty or company name for copyright */
|
---|
95 | static _str skProgram = ''; /* Current program name - used by [L]GPL */
|
---|
96 | static _str skChange = ''; /* Current change identifier. */
|
---|
97 |
|
---|
98 | static int ikStyleWidth = 80; /* The page width of the style. */
|
---|
99 | static boolean fkStyleFullHeaders = false; /* false: omit some tags. */
|
---|
100 | static int ikStyleOneliner = 41; /* The oneline comment column. */
|
---|
101 | static int ikStyleModifyMarkColumn = 105;
|
---|
102 | static boolean fkStyleBoxTag = false; /* true: Include tag in k_box_start. */
|
---|
103 |
|
---|
104 | /*******************************************************************************
|
---|
105 | * Internal Functions *
|
---|
106 | *******************************************************************************/
|
---|
107 | /**
|
---|
108 | * Gets iso date.
|
---|
109 | * @returns ISO formatted date.
|
---|
110 | */
|
---|
111 | static _str k_date()
|
---|
112 | {
|
---|
113 | int i,j;
|
---|
114 | _str date;
|
---|
115 |
|
---|
116 | date = _date('U');
|
---|
117 | i = pos("/", date);
|
---|
118 | j = pos("/", date, i+1);
|
---|
119 | month = substr(date, 1, i-1);
|
---|
120 | if (length(month) == 1) month = '0'month;
|
---|
121 | day = substr(date, i+1, j-i-1);
|
---|
122 | if (length(day) == 1) day = '0'day;
|
---|
123 | year = substr(date, j+1);
|
---|
124 | return year"-"month"-"day;
|
---|
125 | }
|
---|
126 |
|
---|
127 |
|
---|
128 | /**
|
---|
129 | * Get the current year.
|
---|
130 | * @returns Current year string.
|
---|
131 | */
|
---|
132 | static _str k_year()
|
---|
133 | {
|
---|
134 | date = _date('U');
|
---|
135 | return substr(date, pos("/",date, pos("/",date)+1)+1, 4);
|
---|
136 | }
|
---|
137 |
|
---|
138 |
|
---|
139 | /**
|
---|
140 | * Aligns a value up to a given alignment.
|
---|
141 | */
|
---|
142 | static int k_alignup(int iValue, iAlign)
|
---|
143 | {
|
---|
144 | if (iAlign <= 0)
|
---|
145 | {
|
---|
146 | message('k_alignup: iValue='iValue ' iAlign='iAlign);
|
---|
147 | iAlign = 4;
|
---|
148 | }
|
---|
149 | return ((iValue intdiv iAlign) + 1) * iAlign;
|
---|
150 | }
|
---|
151 |
|
---|
152 |
|
---|
153 | /**
|
---|
154 | * Reads the comment setup for this lexer/extension .
|
---|
155 | *
|
---|
156 | * @returns Success indicator.
|
---|
157 | * @param sLeft Left comment. (output)
|
---|
158 | * @param sRight Right comment. (output)
|
---|
159 | * @param iColumn Comment mark column. (1-based) (output)
|
---|
160 | * @param sExt The extension to lookup defaults to the current one.
|
---|
161 | * @param sLexer The lexer to lookup defaults to the current one.
|
---|
162 | * @author knut st. osmundsen (bird@anduin.net)
|
---|
163 | * @remark This should be exported from box.e, but unfortunately it isn't.
|
---|
164 | */
|
---|
165 | static boolean k_commentconfig(_str &sLeft, _str &sRight, int &iColumn, _str sExt = p_extension, _str sLexer = p_lexer_name)
|
---|
166 | {
|
---|
167 | /* init returns */
|
---|
168 | sLeft = sRight = '';
|
---|
169 | iColumn = 0;
|
---|
170 |
|
---|
171 | /*
|
---|
172 | * Get comment setup from the lexer.
|
---|
173 | */
|
---|
174 | if (sLexer)
|
---|
175 | {
|
---|
176 | sLine = '';
|
---|
177 | /* multiline */
|
---|
178 | rc = _ini_get_value(slick_path_search("user.vlx"), sLexer, 'mlcomment', sLine);
|
---|
179 | if (rc)
|
---|
180 | rc = _ini_get_value(slick_path_search("vslick.vlx"), sLexer, 'mlcomment', sLine);
|
---|
181 | if (!rc)
|
---|
182 | {
|
---|
183 | sLeft = strip(word(sLine, 1));
|
---|
184 | sRight = strip(word(sLine, 2));
|
---|
185 | if (sLeft != '' && sRight != '')
|
---|
186 | return true;
|
---|
187 | }
|
---|
188 |
|
---|
189 | /* failed, try single line. */
|
---|
190 | rc = _ini_get_value(slick_path_search("user.vlx"), sLexer, 'linecomment', sLine);
|
---|
191 | if (rc)
|
---|
192 | rc = _ini_get_value(slick_path_search("vslick.vlx"), sLexer, 'linecomment', sLine);
|
---|
193 | if (!rc)
|
---|
194 | {
|
---|
195 | sLeft = strip(word(sLine, 1));
|
---|
196 | sRight = '';
|
---|
197 | iColumn = 0;
|
---|
198 | sTmp = word(sLine, 2);
|
---|
199 | if (isnumber(sTmp))
|
---|
200 | iColumn = (int)sTmp;
|
---|
201 | if (sLeft != '')
|
---|
202 | return true;
|
---|
203 | }
|
---|
204 | }
|
---|
205 |
|
---|
206 | /*
|
---|
207 | * Read the nonboxchars and determin user or default box.ini.
|
---|
208 | */
|
---|
209 | sFile = slick_path_search("ubox.ini");
|
---|
210 | frc = _ini_get_value(sFile, sExt, 'nonboxchars', sLine);
|
---|
211 | if (frc)
|
---|
212 | {
|
---|
213 | sFile = slick_path_search("box.ini")
|
---|
214 | frc = _ini_get_value(sFile, sExt, 'nonboxchars', sLine);
|
---|
215 | }
|
---|
216 |
|
---|
217 | if (!frc)
|
---|
218 | { /*
|
---|
219 | * Found extension.
|
---|
220 | */
|
---|
221 | sLeft = strip(eq_name2value('left',sLine));
|
---|
222 | if (sLeft == '\e') sLeft = '';
|
---|
223 | sRight = strip(eq_name2value('right',sLine));
|
---|
224 | if (sRight == '\e') sRight = '';
|
---|
225 |
|
---|
226 | /* Read comment column too */
|
---|
227 | frc = _ini_get_value(sFile, sExt, 'comment_col', sLine);
|
---|
228 | if (frc)
|
---|
229 | {
|
---|
230 | iColumn = eq_name2value('comment_col', sLine);
|
---|
231 | if (iColumn == '\e') iColumn = 0;
|
---|
232 | }
|
---|
233 | else
|
---|
234 | iColumn = 0;
|
---|
235 | return true;
|
---|
236 | }
|
---|
237 |
|
---|
238 | /* failure */
|
---|
239 | sLeft = sRight = '';
|
---|
240 | iColumn = 0;
|
---|
241 |
|
---|
242 | return false;
|
---|
243 | }
|
---|
244 |
|
---|
245 |
|
---|
246 | /**
|
---|
247 | * Checks if current file only support line comments.
|
---|
248 | * @returns True / False.
|
---|
249 | * @remark Use builtin extension stuff!
|
---|
250 | */
|
---|
251 | static boolean k_line_comment()
|
---|
252 | {
|
---|
253 | _str sRight = '';
|
---|
254 | boolean fLineComment = false;
|
---|
255 | if (k_commentconfig(sLeft, sRight, iColumn))
|
---|
256 | fLineComment = (sRight == '' || iColumn > 0);
|
---|
257 | return fLineComment;
|
---|
258 | }
|
---|
259 |
|
---|
260 |
|
---|
261 |
|
---|
262 | #define KIC_CURSOR_BEFORE 1
|
---|
263 | #define KIC_CURSOR_AFTER 2
|
---|
264 | #define KIC_CURSOR_AT_END 3
|
---|
265 |
|
---|
266 | /**
|
---|
267 | * Insert a comment at current or best fitting position in the text.
|
---|
268 | * @param sStr The comment to insert.
|
---|
269 | * @param iCursor Where to put the cursor.
|
---|
270 | * @param iPosition Where to start the comment.
|
---|
271 | * Doesn't apply to column based source.
|
---|
272 | * -1 means at cursor position. (default)
|
---|
273 | * >0 means at end of line, but not before this column (1-based).
|
---|
274 | * This also implies a min of one space to EOL.
|
---|
275 | */
|
---|
276 | void k_insert_comment(_str sStr, int iCursor, int iPosition = -1)
|
---|
277 | {
|
---|
278 | _str sLeft;
|
---|
279 | _str sRight;
|
---|
280 | int iColumn;
|
---|
281 | if (!k_commentconfig(sLeft, sRight, iColumn))
|
---|
282 | {
|
---|
283 | sLeft = '/*'; sRight = '*/'; iColumn = 0;
|
---|
284 | }
|
---|
285 |
|
---|
286 | if (iColumn <= 0)
|
---|
287 | { /*
|
---|
288 | * not column based source
|
---|
289 | */
|
---|
290 |
|
---|
291 | /* position us first */
|
---|
292 | if (iPosition > 0)
|
---|
293 | {
|
---|
294 | end_line();
|
---|
295 | do {
|
---|
296 | _insert_text(" ");
|
---|
297 | } while (p_col < iPosition);
|
---|
298 | }
|
---|
299 |
|
---|
300 | /* insert comment saving the position for _BEFORE. */
|
---|
301 | iCol = p_col;
|
---|
302 | _insert_text(sLeft:+' ':+sStr);
|
---|
303 | if (iCursor == KIC_CURSOR_AT_END)
|
---|
304 | iCol = p_col;
|
---|
305 | /* right comment delimiter? */
|
---|
306 | if (sRight != '')
|
---|
307 | _insert_text(' ':+sRight);
|
---|
308 | }
|
---|
309 | else
|
---|
310 | {
|
---|
311 | if (p_col >= iColumn)
|
---|
312 | _insert_text("\n");
|
---|
313 | do { _insert_text(" "); } while (p_col < iColumn);
|
---|
314 | if (iCursor == KIC_CURSOR_BEFORE)
|
---|
315 | iCol = p_col;
|
---|
316 | _insert_text(sLeft:+' ':+sStr);
|
---|
317 | if (iCursor == KIC_CURSOR_AT_END)
|
---|
318 | iCol = p_col;
|
---|
319 | }
|
---|
320 |
|
---|
321 | /* set cursor. */
|
---|
322 | if (iCursor != KIC_CURSOR_AFTER)
|
---|
323 | p_col = iCol;
|
---|
324 | }
|
---|
325 |
|
---|
326 |
|
---|
327 | /**
|
---|
328 | * Gets the comment prefix or postfix.
|
---|
329 | * @returns Comment prefix or postfix.
|
---|
330 | * @param fRight If clear left comment string - default.
|
---|
331 | * If set right comment string.
|
---|
332 | * @author knut st. osmundsen (bird@anduin.net)
|
---|
333 | */
|
---|
334 | static _str k_comment(boolean fRight = false)
|
---|
335 | {
|
---|
336 | sComment = '/*';
|
---|
337 | if (k_commentconfig(sLeft, sRight, iColumn))
|
---|
338 | sComment = (!fRight || iColumn > 0 ? sLeft : sRight);
|
---|
339 |
|
---|
340 | return strip(sComment);
|
---|
341 | }
|
---|
342 |
|
---|
343 |
|
---|
344 | /*******************************************************************************
|
---|
345 | * BOXES *
|
---|
346 | *******************************************************************************/
|
---|
347 |
|
---|
348 | /**
|
---|
349 | * Inserts the first line in a box.
|
---|
350 | * @param sTag Not used - box tag.
|
---|
351 | */
|
---|
352 | static void k_box_start(sTag)
|
---|
353 | {
|
---|
354 | if (!k_commentconfig(sLeft, sRight, iColumn))
|
---|
355 | return;
|
---|
356 | _begin_line();
|
---|
357 | if (iColumn >= 0)
|
---|
358 | while (p_col < iColumn)
|
---|
359 | _insert_text(" ");
|
---|
360 |
|
---|
361 | sText = sLeft;
|
---|
362 | if (sTag != '' && fkStyleBoxTag)
|
---|
363 | {
|
---|
364 | if (substr(sText, length(sText)) != '*')
|
---|
365 | sText = sText:+'*';
|
---|
366 | sText = sText:+sTag;
|
---|
367 | }
|
---|
368 |
|
---|
369 | for (i = length(sText); i <= ikStyleWidth - p_col; i++)
|
---|
370 | sText = sText:+'*';
|
---|
371 | sText = sText:+"\n";
|
---|
372 |
|
---|
373 | _insert_text(sText);
|
---|
374 | }
|
---|
375 |
|
---|
376 |
|
---|
377 | /**
|
---|
378 | * Places a string, sStr, into a line started and ended by '*'.
|
---|
379 | * @param sStr Text to have between the '*'s.
|
---|
380 | */
|
---|
381 | static void k_box_line(_str sStr)
|
---|
382 | {
|
---|
383 | if (!k_commentconfig(sLeft, sRight, iColumn))
|
---|
384 | return;
|
---|
385 | if (iColumn >= 0)
|
---|
386 | while (p_col < iColumn)
|
---|
387 | _insert_text(" ");
|
---|
388 |
|
---|
389 | sText = '';
|
---|
390 | if (k_line_comment())
|
---|
391 | sText = sLeft;
|
---|
392 | if (sText == '' || substr(sText, length(sText)) != '*')
|
---|
393 | sText = sText:+'*';
|
---|
394 |
|
---|
395 | sText = sText:+' ';
|
---|
396 | for (i = length(sText); i < p_SyntaxIndent; i++)
|
---|
397 | sText = sText:+' ';
|
---|
398 |
|
---|
399 | sText = sText:+sStr;
|
---|
400 |
|
---|
401 | for (i = length(sText) + 1; i <= ikStyleWidth - p_col; i++)
|
---|
402 | sText = sText:+' ';
|
---|
403 | sText = sText:+"*\n";
|
---|
404 |
|
---|
405 | _insert_text(sText);
|
---|
406 | }
|
---|
407 |
|
---|
408 |
|
---|
409 | /**
|
---|
410 | * Inserts the last line in a box.
|
---|
411 | */
|
---|
412 | static void k_box_end()
|
---|
413 | {
|
---|
414 | if (!k_commentconfig(sLeft, sRight, iColumn))
|
---|
415 | return;
|
---|
416 | if (iColumn >= 0)
|
---|
417 | while (p_col < iColumn)
|
---|
418 | _insert_text(" ");
|
---|
419 |
|
---|
420 | sText = '';
|
---|
421 | if (k_line_comment())
|
---|
422 | sText = sLeft;
|
---|
423 | for (i = length(sText) + length(sRight); i <= ikStyleWidth - p_col; i++)
|
---|
424 | sText = sText:+'*';
|
---|
425 | sText = sText:+sRight:+"\n";
|
---|
426 |
|
---|
427 | _insert_text(sText);
|
---|
428 | }
|
---|
429 |
|
---|
430 |
|
---|
431 |
|
---|
432 | /*******************************************************************************
|
---|
433 | * FUNCTION AND CODE PARSERS *
|
---|
434 | *******************************************************************************/
|
---|
435 | /**
|
---|
436 | * Moves cursor to nearest function start.
|
---|
437 | * @returns 0 if ok.
|
---|
438 | * -1 on failure.
|
---|
439 | */
|
---|
440 | static int k_func_goto_nearest_function()
|
---|
441 | {
|
---|
442 | boolean fFix = false; /* cursor at function fix. (last function) */
|
---|
443 | cur_line = p_line;
|
---|
444 | prev_line = -1;
|
---|
445 | next_line = -1;
|
---|
446 | _save_pos2(org_pos);
|
---|
447 |
|
---|
448 | if (!next_proc(1))
|
---|
449 | {
|
---|
450 | next_line = p_line;
|
---|
451 | if (!prev_proc(1) && p_line == cur_line)
|
---|
452 | {
|
---|
453 | _restore_pos2(org_pos);
|
---|
454 | return 0;
|
---|
455 | }
|
---|
456 | _restore_pos2(org_pos);
|
---|
457 | _save_pos2(org_pos);
|
---|
458 | }
|
---|
459 | else
|
---|
460 | {
|
---|
461 | p_col++; /* fixes problem with single function files. */
|
---|
462 | fFix = true;
|
---|
463 | }
|
---|
464 |
|
---|
465 | if (!prev_proc(1))
|
---|
466 | {
|
---|
467 | prev_line = p_line;
|
---|
468 | if (!next_proc(1) && p_line == cur_line)
|
---|
469 | {
|
---|
470 | _restore_pos2(org_pos);
|
---|
471 | return 0;
|
---|
472 | }
|
---|
473 | _restore_pos2(org_pos);
|
---|
474 | _save_pos2(org_pos);
|
---|
475 | }
|
---|
476 |
|
---|
477 |
|
---|
478 | if (prev_line != -1 && (next_line == -1 || cur_line - prev_line <= next_line - cur_line))
|
---|
479 | {
|
---|
480 | if (fFix)
|
---|
481 | p_col++;
|
---|
482 | prev_proc(1);
|
---|
483 | return 0;
|
---|
484 | }
|
---|
485 |
|
---|
486 | if (next_line != -1 && (prev_line == -1 || cur_line - prev_line > next_line - cur_line))
|
---|
487 | {
|
---|
488 | next_proc();
|
---|
489 | return 0;
|
---|
490 | }
|
---|
491 |
|
---|
492 | _restore_pos2(org_pos);
|
---|
493 | return -1;
|
---|
494 | }
|
---|
495 |
|
---|
496 |
|
---|
497 | /**
|
---|
498 | * Check if nearest function is a prototype.
|
---|
499 | * @returns True if function prototype.
|
---|
500 | * False if not function prototype.
|
---|
501 | */
|
---|
502 | static boolean k_func_prototype()
|
---|
503 | {
|
---|
504 | /*
|
---|
505 | * Check if this is a real function implementation.
|
---|
506 | */
|
---|
507 | _save_pos2(procpos);
|
---|
508 | if (!k_func_goto_nearest_functions())
|
---|
509 | {
|
---|
510 | proc_line = p_line;
|
---|
511 |
|
---|
512 | if (!k_func_searchcode("{"))
|
---|
513 | {
|
---|
514 | prev_proc();
|
---|
515 | if (p_line != proc_line)
|
---|
516 | {
|
---|
517 | _restore_pos2(procpos);
|
---|
518 | return true;
|
---|
519 | }
|
---|
520 | }
|
---|
521 | }
|
---|
522 | _restore_pos2(procpos);
|
---|
523 |
|
---|
524 | return false;
|
---|
525 | }
|
---|
526 |
|
---|
527 |
|
---|
528 | /**
|
---|
529 | * Gets the name fo the current function.
|
---|
530 | * @returns The current function name.
|
---|
531 | */
|
---|
532 | static _str k_func_getfunction_name()
|
---|
533 | {
|
---|
534 | sFunctionName = current_proc();
|
---|
535 | if (!sFunctionName)
|
---|
536 | sFunctionName = "";
|
---|
537 | //say 'functionanme='sFunctionName;
|
---|
538 | return sFunctionName;
|
---|
539 | }
|
---|
540 |
|
---|
541 |
|
---|
542 | /**
|
---|
543 | * Goes to the neares function and gets its parameters.
|
---|
544 | * @remark Should be reimplemented to use tags (if someone can figure out how to query that stuff).
|
---|
545 | */
|
---|
546 | static _str k_func_getparams()
|
---|
547 | {
|
---|
548 | _save_pos2(org_pos);
|
---|
549 |
|
---|
550 | /*
|
---|
551 | * Go to nearest function.
|
---|
552 | */
|
---|
553 | if ( !k_func_goto_nearest_function()
|
---|
554 | && !k_func_searchcode("(") /* makes some assumptions. */
|
---|
555 | )
|
---|
556 | {
|
---|
557 | /*
|
---|
558 | * Get parameters.
|
---|
559 | */
|
---|
560 | _save_pos2(posStart);
|
---|
561 | offStart = _QROffset();
|
---|
562 | if (!find_matching_paren())
|
---|
563 | {
|
---|
564 | offEnd = _QROffset();
|
---|
565 | _restore_pos2(posStart);
|
---|
566 | p_col++;
|
---|
567 | _str sParamsRaw = strip(get_text(offEnd - offStart - 1));
|
---|
568 |
|
---|
569 |
|
---|
570 | /*
|
---|
571 | * Remove new lines and double spaces within params.
|
---|
572 | */
|
---|
573 | _str sParams = "";
|
---|
574 |
|
---|
575 | int i;
|
---|
576 | for (i = 1, chPrev = ' '; i <= length(sParamsRaw); i++)
|
---|
577 | {
|
---|
578 | ch = substr(sParamsRaw, i, 1);
|
---|
579 |
|
---|
580 | /*
|
---|
581 | * Do fixups.
|
---|
582 | */
|
---|
583 | if (ch == " " && chPrev == " ")
|
---|
584 | continue;
|
---|
585 |
|
---|
586 | if ((ch :== "\n") || (ch :== "\r") || (ch :== "\t"))
|
---|
587 | {
|
---|
588 | if (chPrev == ' ')
|
---|
589 | continue;
|
---|
590 | ch = ' ';
|
---|
591 | }
|
---|
592 |
|
---|
593 | if (ch == ',' && chPrev == ' ')
|
---|
594 | {
|
---|
595 | sParams = substr(sParams, 1, length(sParams) - 1);
|
---|
596 | }
|
---|
597 |
|
---|
598 | if (ch == '*')
|
---|
599 | {
|
---|
600 | if (chPrev != ' ')
|
---|
601 | sParams = sParams :+ ' * ';
|
---|
602 | else
|
---|
603 | sParams = sParams :+ '* ';
|
---|
604 | chPrev = ' ';
|
---|
605 | }
|
---|
606 | else
|
---|
607 | {
|
---|
608 | sParams = sParams :+ ch;
|
---|
609 | chPrev = ch;
|
---|
610 | }
|
---|
611 |
|
---|
612 | } /* for */
|
---|
613 |
|
---|
614 | sParams = strip(sParams);
|
---|
615 | if (sParams == 'void' || sParams == 'VOID')
|
---|
616 | sParams = "";
|
---|
617 | _restore_pos2(org_pos);
|
---|
618 | return sParams;
|
---|
619 | }
|
---|
620 | else
|
---|
621 | message("find_matchin_paren failed");
|
---|
622 | }
|
---|
623 |
|
---|
624 | _restore_pos2(org_pos);
|
---|
625 | return false;
|
---|
626 | }
|
---|
627 |
|
---|
628 |
|
---|
629 |
|
---|
630 | /**
|
---|
631 | * Enumerates the parameters to the function.
|
---|
632 | * @param sParams Parameter string from k_func_getparams.
|
---|
633 | * @param iParam The index (0-based) of the parameter to get.
|
---|
634 | * @param sType Type. (output)
|
---|
635 | * @param sName Name. (output)
|
---|
636 | * @param sDefault Default value. (output)
|
---|
637 | * @remark Doesn't perhaps handle function pointers very well (I think)?
|
---|
638 | * @remark Should be reimplemented to use tags (if someone can figure out how to query that stuff).
|
---|
639 | */
|
---|
640 | static int k_func_enumparams(_str sParams, int iParam, _str &sType, _str &sName, _str &sDefault)
|
---|
641 | {
|
---|
642 | int i;
|
---|
643 | int iParLevel;
|
---|
644 | int iCurParam;
|
---|
645 | int iStartParam;
|
---|
646 |
|
---|
647 | sType = sName = sDefault = "";
|
---|
648 |
|
---|
649 | /* no use working on empty string! */
|
---|
650 | if (length(sParams) == 0)
|
---|
651 | return -1;
|
---|
652 |
|
---|
653 | /* find the parameter in question */
|
---|
654 | for (iStartParam = i = 1, iParLevel = iCurParam = 0; i <= length(sParams); i++)
|
---|
655 | {
|
---|
656 | _str ch = substr(sParams, i, 1);
|
---|
657 | if (ch == ',' && iParLevel == 0)
|
---|
658 | {
|
---|
659 | /* is it this parameter ? */
|
---|
660 | if (iParam == iCurParam)
|
---|
661 | break;
|
---|
662 |
|
---|
663 | iCurParam++;
|
---|
664 | iStartParam = i + 1;
|
---|
665 | }
|
---|
666 | else if (ch == '(')
|
---|
667 | iParLevel++;
|
---|
668 | else if (ch == ')')
|
---|
669 | iParLevel--;
|
---|
670 | }
|
---|
671 |
|
---|
672 | /* did we find the parameter? */
|
---|
673 | if (iParam == iCurParam)
|
---|
674 | { /* (yeah, we did!) */
|
---|
675 | sArg = strip(substr(sParams, iStartParam, i - iStartParam));
|
---|
676 | /* remove M$ stuff */
|
---|
677 | sArg = stranslate(sArg, "", "IN", "E");
|
---|
678 | sArg = stranslate(sArg, "", "OUT", "E");
|
---|
679 | sArg = stranslate(sArg, "", "OPTIONAL", "E");
|
---|
680 | sArg = strip(sArg);
|
---|
681 |
|
---|
682 | /* lazy approach, which doens't support function types */
|
---|
683 |
|
---|
684 | if (pos('=', sParams) > 0) /* default */
|
---|
685 | {
|
---|
686 | sDefault = strip(substr(sParams, pos('=', sParams) + 1));
|
---|
687 | sArg = strip(substr(sArg, 1, pos('=', sParams) - 1));
|
---|
688 | }
|
---|
689 |
|
---|
690 | for (i = length(sArg); i > 1; i--)
|
---|
691 | {
|
---|
692 | _str ch = substr(sArg, i, 1);
|
---|
693 | if ( !(ch >= 'a' && ch <= 'z')
|
---|
694 | && !(ch >= 'A' && ch <= 'Z')
|
---|
695 | && !(ch >= '0' && ch <= '9')
|
---|
696 | && ch != '_' && ch != '$')
|
---|
697 | break;
|
---|
698 | }
|
---|
699 | if (sArg == "...")
|
---|
700 | i = 0;
|
---|
701 | sName = strip(substr(sArg, i + 1));
|
---|
702 | sType = strip(substr(sArg, 1, i));
|
---|
703 |
|
---|
704 | return 0;
|
---|
705 | }
|
---|
706 |
|
---|
707 | return -1;
|
---|
708 | }
|
---|
709 |
|
---|
710 |
|
---|
711 | /**
|
---|
712 | * Counts the parameters to the function.
|
---|
713 | * @param sParams Parameter string from k_func_getparams.
|
---|
714 | * @remark Should be reimplemented to use tags (if someone can figure out how to query that stuff).
|
---|
715 | */
|
---|
716 | static int k_func_countparams(_str sParams)
|
---|
717 | {
|
---|
718 | int i;
|
---|
719 | int iParLevel;
|
---|
720 | int iCurParam;
|
---|
721 |
|
---|
722 | sType = sName = sDefault = "";
|
---|
723 |
|
---|
724 | /* check for 0 parameters */
|
---|
725 | if (length(sParams) == 0)
|
---|
726 | return 0;
|
---|
727 |
|
---|
728 | /* find the parameter in question */
|
---|
729 | for (i = 1, iParLevel = iCurParam = 0; i <= length(sParams); i++)
|
---|
730 | {
|
---|
731 | _str ch = substr(sParams, i, 1);
|
---|
732 | if (ch == ',' && iParLevel == 0)
|
---|
733 | {
|
---|
734 | iCurParam++;
|
---|
735 | }
|
---|
736 | else if (ch == '(')
|
---|
737 | iParLevel++;
|
---|
738 | else if (ch == ')')
|
---|
739 | iParLevel--;
|
---|
740 | }
|
---|
741 |
|
---|
742 | return iCurParam + 1;
|
---|
743 | }
|
---|
744 |
|
---|
745 |
|
---|
746 | /**
|
---|
747 | * Gets the return type.
|
---|
748 | */
|
---|
749 | static _str k_func_getreturntype(boolean fPureType = false)
|
---|
750 | {
|
---|
751 | _save_pos2(org_pos);
|
---|
752 |
|
---|
753 | /*
|
---|
754 | * Go to nearest function.
|
---|
755 | */
|
---|
756 | if (!k_func_goto_nearest_function())
|
---|
757 | {
|
---|
758 | /*
|
---|
759 | * Return type is from function start to function name...
|
---|
760 | */
|
---|
761 | _save_pos2(posStart);
|
---|
762 | offStart = _QROffset();
|
---|
763 |
|
---|
764 | if (!k_func_searchcode("(")) /* makes some assumptions. */
|
---|
765 | {
|
---|
766 | prev_word();
|
---|
767 | offEnd = _QROffset();
|
---|
768 | _restore_pos2(posStart);
|
---|
769 | _str sTypeRaw = strip(get_text(offEnd - offStart));
|
---|
770 |
|
---|
771 | //say 'sTypeRaw='sTypeRaw;
|
---|
772 | /*
|
---|
773 | * Remove static, inline, _Optlink, stdcall, EXPENTRY etc.
|
---|
774 | */
|
---|
775 | if (fPureType)
|
---|
776 | {
|
---|
777 | sTypeRaw = stranslate(sTypeRaw, "", "__static__", "I");
|
---|
778 | sTypeRaw = stranslate(sTypeRaw, "", "__static", "I");
|
---|
779 | sTypeRaw = stranslate(sTypeRaw, "", "static__", "I");
|
---|
780 | sTypeRaw = stranslate(sTypeRaw, "", "static", "I");
|
---|
781 | sTypeRaw = stranslate(sTypeRaw, "", "__inline__", "I");
|
---|
782 | sTypeRaw = stranslate(sTypeRaw, "", "__inline", "I");
|
---|
783 | sTypeRaw = stranslate(sTypeRaw, "", "inline__", "I");
|
---|
784 | sTypeRaw = stranslate(sTypeRaw, "", "inline", "I");
|
---|
785 | sTypeRaw = stranslate(sTypeRaw, "", "EXPENTRY", "I");
|
---|
786 | sTypeRaw = stranslate(sTypeRaw, "", "_Optlink", "I");
|
---|
787 | sTypeRaw = stranslate(sTypeRaw, "", "__stdcall", "I");
|
---|
788 | sTypeRaw = stranslate(sTypeRaw, "", "__cdecl", "I");
|
---|
789 | sTypeRaw = stranslate(sTypeRaw, "", "_cdecl", "I");
|
---|
790 | sTypeRaw = stranslate(sTypeRaw, "", "cdecl", "I");
|
---|
791 | sTypeRaw = stranslate(sTypeRaw, "", "__PASCAL", "I");
|
---|
792 | sTypeRaw = stranslate(sTypeRaw, "", "_PASCAL", "I");
|
---|
793 | sTypeRaw = stranslate(sTypeRaw, "", "PASCAL", "I");
|
---|
794 | sTypeRaw = stranslate(sTypeRaw, "", "__Far32__", "I");
|
---|
795 | sTypeRaw = stranslate(sTypeRaw, "", "__Far32", "I");
|
---|
796 | sTypeRaw = stranslate(sTypeRaw, "", "Far32__", "I");
|
---|
797 | sTypeRaw = stranslate(sTypeRaw, "", "_Far32_", "I");
|
---|
798 | sTypeRaw = stranslate(sTypeRaw, "", "_Far32", "I");
|
---|
799 | sTypeRaw = stranslate(sTypeRaw, "", "Far32_", "I");
|
---|
800 | sTypeRaw = stranslate(sTypeRaw, "", "Far32", "I");
|
---|
801 | sTypeRaw = stranslate(sTypeRaw, "", "__far", "I");
|
---|
802 | sTypeRaw = stranslate(sTypeRaw, "", "_far", "I");
|
---|
803 | sTypeRaw = stranslate(sTypeRaw, "", "far", "I");
|
---|
804 | sTypeRaw = stranslate(sTypeRaw, "", "__near", "I");
|
---|
805 | sTypeRaw = stranslate(sTypeRaw, "", "_near", "I");
|
---|
806 | sTypeRaw = stranslate(sTypeRaw, "", "near", "I");
|
---|
807 | sTypeRaw = stranslate(sTypeRaw, "", "__loadds__", "I");
|
---|
808 | sTypeRaw = stranslate(sTypeRaw, "", "__loadds", "I");
|
---|
809 | sTypeRaw = stranslate(sTypeRaw, "", "loadds__", "I");
|
---|
810 | sTypeRaw = stranslate(sTypeRaw, "", "_loadds_", "I");
|
---|
811 | sTypeRaw = stranslate(sTypeRaw, "", "_loadds", "I");
|
---|
812 | sTypeRaw = stranslate(sTypeRaw, "", "loadds_", "I");
|
---|
813 | sTypeRaw = stranslate(sTypeRaw, "", "loadds", "I");
|
---|
814 | sTypeRaw = stranslate(sTypeRaw, "", "__loades__", "I");
|
---|
815 | sTypeRaw = stranslate(sTypeRaw, "", "__loades", "I");
|
---|
816 | sTypeRaw = stranslate(sTypeRaw, "", "loades__", "I");
|
---|
817 | sTypeRaw = stranslate(sTypeRaw, "", "_loades_", "I");
|
---|
818 | sTypeRaw = stranslate(sTypeRaw, "", "_loades", "I");
|
---|
819 | sTypeRaw = stranslate(sTypeRaw, "", "loades_", "I");
|
---|
820 | sTypeRaw = stranslate(sTypeRaw, "", "loades", "I");
|
---|
821 | sTypeRaw = stranslate(sTypeRaw, "", "WIN32API", "I");
|
---|
822 | sTypeRaw = stranslate(sTypeRaw, "", "WINAPI", "I");
|
---|
823 | sTypeRaw = stranslate(sTypeRaw, "", "LDRCALL", "I");
|
---|
824 | sTypeRaw = stranslate(sTypeRaw, "", "KRNLCALL", "I");
|
---|
825 | sTypeRaw = stranslate(sTypeRaw, "", "__operator__", "I"); /* operator fix */
|
---|
826 | sTypeRaw = stranslate(sTypeRaw, "", "__operator", "I"); /* operator fix */
|
---|
827 | sTypeRaw = stranslate(sTypeRaw, "", "operator__", "I"); /* operator fix */
|
---|
828 | sTypeRaw = stranslate(sTypeRaw, "", "operator", "I"); /* operator fix */
|
---|
829 | sTypeRaw = stranslate(sTypeRaw, "", "IN", "E");
|
---|
830 | sTypeRaw = stranslate(sTypeRaw, "", "OUT", "E");
|
---|
831 | sTypeRaw = stranslate(sTypeRaw, "", "OPTIONAL", "E");
|
---|
832 | }
|
---|
833 |
|
---|
834 | /*
|
---|
835 | * Remove new lines and double spaces within params.
|
---|
836 | */
|
---|
837 | _str sType = "";
|
---|
838 |
|
---|
839 | int i;
|
---|
840 | for (i = 1, chPrev = ' '; i <= length(sTypeRaw); i++)
|
---|
841 | {
|
---|
842 | ch = substr(sTypeRaw, i, 1);
|
---|
843 |
|
---|
844 | /*
|
---|
845 | * Do fixups.
|
---|
846 | */
|
---|
847 | if (ch == " " && chPrev == " ")
|
---|
848 | continue;
|
---|
849 |
|
---|
850 | if ((ch :== "\n") || (ch :== "\r") || (ch :== "\t"))
|
---|
851 | {
|
---|
852 | if (chPrev == ' ')
|
---|
853 | continue;
|
---|
854 | ch = ' ';
|
---|
855 | }
|
---|
856 |
|
---|
857 | if (ch == ',' && chPrev == ' ')
|
---|
858 | {
|
---|
859 | sType = substr(sType, 1, length(sType) - 1);
|
---|
860 | }
|
---|
861 |
|
---|
862 | if (ch == '*')
|
---|
863 | {
|
---|
864 | if (chPrev != ' ')
|
---|
865 | sType = sType :+ ' * ';
|
---|
866 | else
|
---|
867 | sType = sType :+ '* ';
|
---|
868 | chPrev = ' ';
|
---|
869 | }
|
---|
870 | else
|
---|
871 | {
|
---|
872 | sType = sType :+ ch;
|
---|
873 | chPrev = ch;
|
---|
874 | }
|
---|
875 |
|
---|
876 | } /* for */
|
---|
877 |
|
---|
878 | sType = strip(sType);
|
---|
879 |
|
---|
880 | _restore_pos2(org_pos);
|
---|
881 | return sType;
|
---|
882 | }
|
---|
883 | else
|
---|
884 | message('k_func_getreturntype: can''t find ''(''.');
|
---|
885 | }
|
---|
886 |
|
---|
887 | _restore_pos2(org_pos);
|
---|
888 | return false;
|
---|
889 | }
|
---|
890 |
|
---|
891 |
|
---|
892 | /**
|
---|
893 | * Search for some piece of code.
|
---|
894 | */
|
---|
895 | static int k_func_searchcode(_str sSearchString, _str sOptions = "E+")
|
---|
896 | {
|
---|
897 | int rc;
|
---|
898 | rc = search(sSearchString, sOptions);
|
---|
899 | while (!rc && !k_func_in_code())
|
---|
900 | {
|
---|
901 | p_col++;
|
---|
902 | rc = search(sSearchString, sOptions);
|
---|
903 | }
|
---|
904 | return rc;
|
---|
905 | }
|
---|
906 |
|
---|
907 |
|
---|
908 | /**
|
---|
909 | * Checks if cursor is in code or in comment.
|
---|
910 | * @return True if cursor in code.
|
---|
911 | */
|
---|
912 | static boolean k_func_in_code()
|
---|
913 | {
|
---|
914 | _save_pos2(searchsave);
|
---|
915 | boolean fRc = !_in_comment();
|
---|
916 | _restore_pos2(searchsave);
|
---|
917 | return fRc;
|
---|
918 | }
|
---|
919 |
|
---|
920 |
|
---|
921 | /*
|
---|
922 | * Gets the next piece of code.
|
---|
923 | */
|
---|
924 | static _str k_func_get_next_code_text()
|
---|
925 | {
|
---|
926 | _str ch;
|
---|
927 | _save_pos2(searchsave);
|
---|
928 | ch = k_func_get_next_code_text2();
|
---|
929 | _restore_pos2(searchsave);
|
---|
930 | return ch;
|
---|
931 | }
|
---|
932 |
|
---|
933 |
|
---|
934 | /**
|
---|
935 | * Checks if there is more code on the line.
|
---|
936 | */
|
---|
937 | static boolean k_func_more_code_on_line()
|
---|
938 | {
|
---|
939 | boolean fRc;
|
---|
940 | int curline = p_line;
|
---|
941 |
|
---|
942 | _save_pos2(searchsave);
|
---|
943 | k_func_get_next_code_text2();
|
---|
944 | fRc = curline == p_line;
|
---|
945 | _restore_pos2(searchsave);
|
---|
946 |
|
---|
947 | return fRc;
|
---|
948 | }
|
---|
949 |
|
---|
950 |
|
---|
951 | /**
|
---|
952 | * Gets the next piece of code.
|
---|
953 | * Doesn't preserver cursor position.
|
---|
954 | */
|
---|
955 | static _str k_func_get_next_code_text2()
|
---|
956 | {
|
---|
957 | _str ch;
|
---|
958 | do
|
---|
959 | {
|
---|
960 | curcol = ++p_col;
|
---|
961 | end_line()
|
---|
962 | if (p_col <= curcol)
|
---|
963 | {
|
---|
964 | p_line++;
|
---|
965 | p_col = 1;
|
---|
966 | }
|
---|
967 | else
|
---|
968 | p_col = curcol;
|
---|
969 |
|
---|
970 | ch = get_text();
|
---|
971 | //say ch ' ('_asc(ch)')';
|
---|
972 | while (ch == "#") /* preprocessor stuff */
|
---|
973 | {
|
---|
974 | p_col = 1;
|
---|
975 | p_line++;
|
---|
976 | ch = get_text();
|
---|
977 | //say ch ' ('_asc(ch)')';
|
---|
978 | continue;
|
---|
979 | }
|
---|
980 | } while (ch :== ' ' || ch :== "\t" || ch :== "\n" || ch :== "\r" || !k_func_in_code());
|
---|
981 |
|
---|
982 | return ch;
|
---|
983 | }
|
---|
984 |
|
---|
985 |
|
---|
986 |
|
---|
987 |
|
---|
988 | /*******************************************************************************
|
---|
989 | * JAVA DOC STYLED WORKERS *
|
---|
990 | *******************************************************************************/
|
---|
991 |
|
---|
992 | /** starts a javadoc documentation box. */
|
---|
993 | static void k_javadoc_box_start(_str sStr = '', boolean fDouble = true)
|
---|
994 | {
|
---|
995 | if (!k_commentconfig(sLeft, sRight, iColumn))
|
---|
996 | return;
|
---|
997 | _begin_line();
|
---|
998 | if (iColumn >= 0)
|
---|
999 | while (p_col < iColumn)
|
---|
1000 | _insert_text(" ");
|
---|
1001 |
|
---|
1002 | sText = sLeft;
|
---|
1003 | if (fDouble)
|
---|
1004 | sText = sLeft:+substr(sLeft, length(sLeft), 1);
|
---|
1005 | if (sStr != '')
|
---|
1006 | sText = sText:+' ':+sStr;
|
---|
1007 | sText = sText:+"\n";
|
---|
1008 |
|
---|
1009 | _insert_text(sText);
|
---|
1010 | }
|
---|
1011 |
|
---|
1012 | /** inserts a new line in a javadoc documentation box. */
|
---|
1013 | static void k_javadoc_box_line(_str sStr = '', int iPadd = 0, _str sStr2 = '', int iPadd2 = 0, _str sStr3 = '')
|
---|
1014 | {
|
---|
1015 | if (!k_commentconfig(sLeft, sRight, iColumn))
|
---|
1016 | return;
|
---|
1017 | if (iColumn >= 0)
|
---|
1018 | while (p_col < iColumn)
|
---|
1019 | _insert_text(" ");
|
---|
1020 |
|
---|
1021 | if (k_line_comment())
|
---|
1022 | sText = sLeft;
|
---|
1023 | else
|
---|
1024 | {
|
---|
1025 | sText = sLeft;
|
---|
1026 | sText = ' ':+substr(sLeft, length(sLeft));
|
---|
1027 | }
|
---|
1028 |
|
---|
1029 | if (sStr != '')
|
---|
1030 | sText = sText:+' ':+sStr;
|
---|
1031 | if (iPadd > 0)
|
---|
1032 | {
|
---|
1033 | for (i = length(sText); i < iPadd; i++)
|
---|
1034 | sText = sText:+' ';
|
---|
1035 |
|
---|
1036 | if (sStr2 != '')
|
---|
1037 | sText = sText:+sStr2;
|
---|
1038 |
|
---|
1039 | if (iPadd2 > 0)
|
---|
1040 | {
|
---|
1041 | for (i = length(sText); i < iPadd2; i++)
|
---|
1042 | sText = sText:+' ';
|
---|
1043 |
|
---|
1044 | if (sStr3 != '')
|
---|
1045 | sText = sText:+sStr3;
|
---|
1046 | }
|
---|
1047 | }
|
---|
1048 | sText = sText:+"\n";
|
---|
1049 |
|
---|
1050 | _insert_text(sText);
|
---|
1051 | }
|
---|
1052 |
|
---|
1053 | /** ends a javadoc documentation box. */
|
---|
1054 | static void k_javadoc_box_end()
|
---|
1055 | {
|
---|
1056 | if (!k_commentconfig(sLeft, sRight, iColumn))
|
---|
1057 | return;
|
---|
1058 | if (iColumn >= 0)
|
---|
1059 | while (p_col < iColumn)
|
---|
1060 | _insert_text(" ");
|
---|
1061 |
|
---|
1062 | if (k_line_comment())
|
---|
1063 | sText = sLeft;
|
---|
1064 | else
|
---|
1065 | {
|
---|
1066 | sText = sRight;
|
---|
1067 | /*if (substr(sText, 1, 1) != '*')
|
---|
1068 | sText = '*':+sText;*/
|
---|
1069 | sText = ' ':+sText;
|
---|
1070 | }
|
---|
1071 | sText = sText:+"\n";
|
---|
1072 |
|
---|
1073 | _insert_text(sText);
|
---|
1074 | }
|
---|
1075 |
|
---|
1076 |
|
---|
1077 | /**
|
---|
1078 | * Write a Javadoc styled classbox.
|
---|
1079 | */
|
---|
1080 | void k_javadoc_classbox()
|
---|
1081 | {
|
---|
1082 | int iCursorLine;
|
---|
1083 | int iPadd = k_alignup(12, p_SyntaxIndent);
|
---|
1084 |
|
---|
1085 | k_javadoc_box_start();
|
---|
1086 | iCursorLine = p_RLine;
|
---|
1087 | k_javadoc_box_line(' ');
|
---|
1088 |
|
---|
1089 | if (fkStyleFullHeaders)
|
---|
1090 | {
|
---|
1091 | k_javadoc_box_line('@shortdesc', iPadd);
|
---|
1092 | k_javadoc_box_line('@dstruct', iPadd);
|
---|
1093 | k_javadoc_box_line('@version', iPadd);
|
---|
1094 | k_javadoc_box_line('@verdesc', iPadd);
|
---|
1095 | }
|
---|
1096 | k_javadoc_box_line('@author', iPadd, skUserName ' <' skUserEmail '>');
|
---|
1097 | k_javadoc_box_line('@approval', iPadd);
|
---|
1098 | k_javadoc_box_end();
|
---|
1099 |
|
---|
1100 | up(p_RLine - iCursorLine);
|
---|
1101 | end_line();
|
---|
1102 | keyin(' ');
|
---|
1103 | }
|
---|
1104 |
|
---|
1105 |
|
---|
1106 | /**
|
---|
1107 | * Javadoc - functionbox(/header).
|
---|
1108 | */
|
---|
1109 | void k_javadoc_funcbox()
|
---|
1110 | {
|
---|
1111 | int cArgs = 1;
|
---|
1112 | _str sArgs = "";
|
---|
1113 | int iCursorLine;
|
---|
1114 | int iPadd = k_alignup(11, p_SyntaxIndent);
|
---|
1115 | /* look for parameters */
|
---|
1116 | boolean fFoundFn = !k_func_goto_nearest_function();
|
---|
1117 | if (fFoundFn)
|
---|
1118 | {
|
---|
1119 | sArgs = k_func_getparams();
|
---|
1120 | cArgs = k_func_countparams(sArgs);
|
---|
1121 | }
|
---|
1122 |
|
---|
1123 | k_javadoc_box_start();
|
---|
1124 | iCursorLine = p_RLine;
|
---|
1125 | k_javadoc_box_line(' ');
|
---|
1126 | if (file_eq(p_extension, 'asm'))
|
---|
1127 | k_javadoc_box_line('@cproto', iPadd);
|
---|
1128 | k_javadoc_box_line('@returns', iPadd);
|
---|
1129 | if (fFoundFn)
|
---|
1130 | {
|
---|
1131 | /*
|
---|
1132 | * Determin parameter description indent.
|
---|
1133 | */
|
---|
1134 | int iPadd2 = 0;
|
---|
1135 | for (i = 0; i < cArgs; i++)
|
---|
1136 | {
|
---|
1137 | _str sName, sType, sDefault;
|
---|
1138 | if (!k_func_enumparams(sArgs, i, sType, sName, sDefault)
|
---|
1139 | && iPadd2 < length(sName))
|
---|
1140 | iPadd2 = length(sName);
|
---|
1141 | }
|
---|
1142 | iPadd2 = k_alignup((iPadd + iPadd2), p_SyntaxIndent);
|
---|
1143 |
|
---|
1144 | /*
|
---|
1145 | * Insert parameter.
|
---|
1146 | */
|
---|
1147 | for (i = 0; i < cArgs; i++)
|
---|
1148 | {
|
---|
1149 | _str sName, sType, sDefault;
|
---|
1150 | if (!k_func_enumparams(sArgs, i, sType, sName, sDefault))
|
---|
1151 | {
|
---|
1152 | sStr3 = '';
|
---|
1153 | if (sDefault != "")
|
---|
1154 | sStr3 = '(default='sDefault')';
|
---|
1155 | k_javadoc_box_line('@param', iPadd, sName, iPadd2, sStr3);
|
---|
1156 | }
|
---|
1157 | else
|
---|
1158 | k_javadoc_box_line('@param', iPadd);
|
---|
1159 | }
|
---|
1160 | }
|
---|
1161 | else
|
---|
1162 | k_javadoc_box_line('@param', iPadd);
|
---|
1163 |
|
---|
1164 | if (file_eq(p_extension, 'asm'))
|
---|
1165 | k_javadoc_box_line('@uses', iPadd);
|
---|
1166 | if (fkStyleFullHeaders)
|
---|
1167 | {
|
---|
1168 | k_javadoc_box_line('@equiv', iPadd);
|
---|
1169 | k_javadoc_box_line('@time', iPadd);
|
---|
1170 | k_javadoc_box_line('@sketch', iPadd);
|
---|
1171 | }
|
---|
1172 | k_javadoc_box_line('@status', iPadd);
|
---|
1173 | k_javadoc_box_line('@author', iPadd, skUserName ' <' skUserEmail '>');
|
---|
1174 | if (fkStyleFullHeaders)
|
---|
1175 | k_javadoc_box_line('@remark', iPadd);
|
---|
1176 | k_javadoc_box_end();
|
---|
1177 |
|
---|
1178 | up(p_RLine - iCursorLine);
|
---|
1179 | end_line();
|
---|
1180 | keyin(' ');
|
---|
1181 | }
|
---|
1182 |
|
---|
1183 |
|
---|
1184 | /**
|
---|
1185 | * Javadoc module header.
|
---|
1186 | */
|
---|
1187 | void k_javadoc_moduleheader()
|
---|
1188 | {
|
---|
1189 | int iCursorLine;
|
---|
1190 |
|
---|
1191 | _begin_line();
|
---|
1192 | k_insert_comment('$':+'I':+'d: $', KIC_CURSOR_AT_END, -1);
|
---|
1193 | _end_line();
|
---|
1194 | _insert_text("\n");
|
---|
1195 |
|
---|
1196 | k_javadoc_box_start('@file');
|
---|
1197 | k_javadoc_box_line();
|
---|
1198 | iCursorLine = p_RLine;
|
---|
1199 | k_javadoc_box_line();
|
---|
1200 | k_javadoc_box_line();
|
---|
1201 |
|
---|
1202 | if (skLicense == 'Confidential')
|
---|
1203 | {
|
---|
1204 | k_javadoc_box_line(skCompany ' confidential');
|
---|
1205 | k_javadoc_box_line();
|
---|
1206 | }
|
---|
1207 |
|
---|
1208 | if (skCompany != '')
|
---|
1209 | {
|
---|
1210 | k_javadoc_box_line('Copyright (c) ' k_year() ' ' skCompany);
|
---|
1211 | k_javadoc_box_line();
|
---|
1212 | k_javadoc_box_line('Author: ' skUserName' <' skUserEmail '>');
|
---|
1213 | }
|
---|
1214 | else
|
---|
1215 | k_javadoc_box_line('Copyright (c) ' k_year() ' 'skUserName' <' skUserEmail '>');
|
---|
1216 | k_javadoc_box_line();
|
---|
1217 | switch (skLicense)
|
---|
1218 | {
|
---|
1219 | case 'Odin32':
|
---|
1220 | k_javadoc_box_line('Project Odin Software License can be found in LICENSE.TXT.');
|
---|
1221 | break;
|
---|
1222 |
|
---|
1223 | case 'GPL':
|
---|
1224 | sProg = skProgram;
|
---|
1225 | k_javadoc_box_line()
|
---|
1226 | if (sProg == '')
|
---|
1227 | sProg = 'This program';
|
---|
1228 | else
|
---|
1229 | {
|
---|
1230 | k_javadoc_box_line('This file is part of ' sProg '.');
|
---|
1231 | k_javadoc_box_line();
|
---|
1232 | }
|
---|
1233 | k_javadoc_box_line(sProg ' is free software; you can redistribute it and/or modify');
|
---|
1234 | k_javadoc_box_line('it under the terms of the GNU General Public License as published by');
|
---|
1235 | k_javadoc_box_line('the Free Software Foundation; either version 2 of the License, or');
|
---|
1236 | k_javadoc_box_line('(at your option) any later version.');
|
---|
1237 | k_javadoc_box_line()
|
---|
1238 | k_javadoc_box_line(sProg ' is distributed in the hope that it will be useful,');
|
---|
1239 | k_javadoc_box_line('but WITHOUT ANY WARRANTY; without even the implied warranty of');
|
---|
1240 | k_javadoc_box_line('MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the');
|
---|
1241 | k_javadoc_box_line('GNU General Public License for more details.');
|
---|
1242 | k_javadoc_box_line()
|
---|
1243 | k_javadoc_box_line('You should have received a copy of the GNU General Public License');
|
---|
1244 | k_javadoc_box_line('along with ' sProg '; if not, write to the Free Software');
|
---|
1245 | k_javadoc_box_line('Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA');
|
---|
1246 | break;
|
---|
1247 |
|
---|
1248 | case 'LGPL':
|
---|
1249 | sProg = skProgram;
|
---|
1250 | k_javadoc_box_line()
|
---|
1251 | if (sProg == '')
|
---|
1252 | sProg = 'This program';
|
---|
1253 | else
|
---|
1254 | {
|
---|
1255 | k_javadoc_box_line('This file is part of ' sProg '.');
|
---|
1256 | k_javadoc_box_line();
|
---|
1257 | }
|
---|
1258 | k_javadoc_box_line(sProg ' is free software; you can redistribute it and/or modify');
|
---|
1259 | k_javadoc_box_line('it under the terms of the GNU Lesser General Public License as published');
|
---|
1260 | k_javadoc_box_line('by the Free Software Foundation; either version 2 of the License, or');
|
---|
1261 | k_javadoc_box_line('(at your option) any later version.');
|
---|
1262 | k_javadoc_box_line()
|
---|
1263 | k_javadoc_box_line(sProg ' is distributed in the hope that it will be useful,');
|
---|
1264 | k_javadoc_box_line('but WITHOUT ANY WARRANTY; without even the implied warranty of');
|
---|
1265 | k_javadoc_box_line('MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the');
|
---|
1266 | k_javadoc_box_line('GNU Lesser General Public License for more details.');
|
---|
1267 | k_javadoc_box_line()
|
---|
1268 | k_javadoc_box_line('You should have received a copy of the GNU Lesser General Public License');
|
---|
1269 | k_javadoc_box_line('along with ' sProg '; if not, write to the Free Software');
|
---|
1270 | k_javadoc_box_line('Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA');
|
---|
1271 | break;
|
---|
1272 |
|
---|
1273 | case 'Confidential':
|
---|
1274 | k_javadoc_box_line('All Rights Reserved');
|
---|
1275 | break;
|
---|
1276 |
|
---|
1277 | default:
|
---|
1278 |
|
---|
1279 | }
|
---|
1280 | k_javadoc_box_line();
|
---|
1281 | k_javadoc_box_end();
|
---|
1282 |
|
---|
1283 | up(p_RLine - iCursorLine);
|
---|
1284 | end_line();
|
---|
1285 | keyin(' ');
|
---|
1286 | }
|
---|
1287 |
|
---|
1288 |
|
---|
1289 |
|
---|
1290 |
|
---|
1291 |
|
---|
1292 |
|
---|
1293 |
|
---|
1294 | /*******************************************************************************
|
---|
1295 | * Keyboard Shortcuts *
|
---|
1296 | *******************************************************************************/
|
---|
1297 | /** Makes global box. */
|
---|
1298 | void k_box_globals()
|
---|
1299 | {
|
---|
1300 | k_box_start('Global');
|
---|
1301 | k_box_line('Global Variables');
|
---|
1302 | k_box_end();
|
---|
1303 | }
|
---|
1304 |
|
---|
1305 | /** Makes header box. */
|
---|
1306 | void k_box_headers()
|
---|
1307 | {
|
---|
1308 | k_box_start("Header");
|
---|
1309 | k_box_line("Header Files");
|
---|
1310 | k_box_end();
|
---|
1311 | }
|
---|
1312 |
|
---|
1313 | /** Makes internal function box. */
|
---|
1314 | void k_box_intfuncs()
|
---|
1315 | {
|
---|
1316 | k_box_start("IntFunc");
|
---|
1317 | k_box_line("Internal Functions");
|
---|
1318 | k_box_end();
|
---|
1319 | }
|
---|
1320 |
|
---|
1321 | /** Makes def/const box. */
|
---|
1322 | void k_box_consts()
|
---|
1323 | {
|
---|
1324 | k_box_start("Const");
|
---|
1325 | k_box_line("Defined Constants And Macros");
|
---|
1326 | k_box_end();
|
---|
1327 | }
|
---|
1328 |
|
---|
1329 | /** Structure box */
|
---|
1330 | void k_box_structs()
|
---|
1331 | {
|
---|
1332 | k_box_start("Struct");
|
---|
1333 | k_box_line("Structures and Typedefs");
|
---|
1334 | k_box_end();
|
---|
1335 | }
|
---|
1336 |
|
---|
1337 | /** Makes exported symbols box. */
|
---|
1338 | void k_box_exported()
|
---|
1339 | {
|
---|
1340 | k_box_start('Exported');
|
---|
1341 | k_box_line('Exported Symbols');
|
---|
1342 | k_box_end();
|
---|
1343 | }
|
---|
1344 |
|
---|
1345 |
|
---|
1346 |
|
---|
1347 | /** oneliner comment */
|
---|
1348 | void k_oneliner()
|
---|
1349 | {
|
---|
1350 | if ( k_commentconfig(sLeft, sRight, iColumn)
|
---|
1351 | && iColumn > 0)
|
---|
1352 | { /* column based needs some tricky repositioning. */
|
---|
1353 | _end_line();
|
---|
1354 | if (p_col > iColumn)
|
---|
1355 | {
|
---|
1356 | _begin_line();
|
---|
1357 | _insert_text("\n\r");
|
---|
1358 | up();
|
---|
1359 | }
|
---|
1360 | }
|
---|
1361 | k_insert_comment("", KIC_CURSOR_AT_END, ikStyleOneliner);
|
---|
1362 | }
|
---|
1363 |
|
---|
1364 | /** mark line as modified. */
|
---|
1365 | void k_mark_modified_line()
|
---|
1366 | {
|
---|
1367 | /* not supported for column based sources */
|
---|
1368 | if ( !k_commentconfig(sLeft, sRight, iColumn)
|
---|
1369 | || iColumn > 0)
|
---|
1370 | return;
|
---|
1371 |
|
---|
1372 | if (skChange != '')
|
---|
1373 | sStr = skChange ' (' skUserInitials ')';
|
---|
1374 | else
|
---|
1375 | sStr = skUserInitials;
|
---|
1376 | k_insert_comment(sStr, KIC_CURSOR_BEFORE, ikStyleModifyMarkColumn);
|
---|
1377 | down();
|
---|
1378 | }
|
---|
1379 |
|
---|
1380 |
|
---|
1381 | /**
|
---|
1382 | * Inserts a signature. Form: "//Initials ISO-date:"
|
---|
1383 | * @remark defeventtab
|
---|
1384 | */
|
---|
1385 | void k_signature()
|
---|
1386 | {
|
---|
1387 | /* kso I5-10000 2002-09-10: */
|
---|
1388 | if (skChange != '')
|
---|
1389 | sSig = skUserInitials ' ' skChange ' ' k_date() ': ';
|
---|
1390 | else
|
---|
1391 | sSig = skUserInitials ' ' k_date() ': ';
|
---|
1392 | k_insert_comment(sSig, KIC_CURSOR_AT_END);
|
---|
1393 | }
|
---|
1394 |
|
---|
1395 |
|
---|
1396 | /*******************************************************************************
|
---|
1397 | * kLIB Logging *
|
---|
1398 | *******************************************************************************/
|
---|
1399 | /**
|
---|
1400 | * Hot-Key: Inserts a KLOGENTRY statement at start of nearest function.
|
---|
1401 | */
|
---|
1402 | void klib_klogentry()
|
---|
1403 | {
|
---|
1404 | _save_pos2(org_pos);
|
---|
1405 |
|
---|
1406 | /*
|
---|
1407 | * Go to nearest function.
|
---|
1408 | */
|
---|
1409 | if (!k_func_goto_nearest_function())
|
---|
1410 | {
|
---|
1411 | /*
|
---|
1412 | * Get parameters.
|
---|
1413 | */
|
---|
1414 | _str sParams = k_func_getparams();
|
---|
1415 | if (sParams)
|
---|
1416 | {
|
---|
1417 | _str sRetType = k_func_getreturntype(true);
|
---|
1418 | if (!sRetType || sRetType == "")
|
---|
1419 | sRetType = "void"; /* paranoia! */
|
---|
1420 |
|
---|
1421 | /*
|
---|
1422 | * Insert text.
|
---|
1423 | */
|
---|
1424 | if (!k_func_searchcode("{"))
|
---|
1425 | {
|
---|
1426 | p_col++;
|
---|
1427 | cArgs = k_func_countparams(sParams);
|
---|
1428 | if (cArgs > 0)
|
---|
1429 | {
|
---|
1430 | sArgs = "";
|
---|
1431 | for (i = 0; i < cArgs; i++)
|
---|
1432 | {
|
---|
1433 | _str sType, sName, sDefault
|
---|
1434 | if (!k_func_enumparams(sParams, i, sType, sName, sDefault))
|
---|
1435 | sArgs = sArgs', 'sName;
|
---|
1436 | }
|
---|
1437 |
|
---|
1438 | _insert_text("\n KLOGENTRY"cArgs"(\""sRetType"\",\""sParams"\""sArgs");"); /* todo tab size.. or smart indent */
|
---|
1439 | }
|
---|
1440 | else
|
---|
1441 | _insert_text("\n KLOGENTRY0(\""sRetType"\");"); /* todo tab size.. or smart indent */
|
---|
1442 |
|
---|
1443 | /*
|
---|
1444 | * Check if the next word is KLOGENTRY.
|
---|
1445 | */
|
---|
1446 | next_word();
|
---|
1447 | if (def_next_word_style == 'E')
|
---|
1448 | prev_word();
|
---|
1449 | if (substr(cur_word(iIgnorePos), 1, 9) == "KLOGENTRY")
|
---|
1450 | delete_line();
|
---|
1451 |
|
---|
1452 | }
|
---|
1453 | else
|
---|
1454 | message("didn't find {");
|
---|
1455 | }
|
---|
1456 | else
|
---|
1457 | message("k_func_getparams failed, sParams=" sParams);
|
---|
1458 | return;
|
---|
1459 | }
|
---|
1460 |
|
---|
1461 | _restore_pos2(org_pos);
|
---|
1462 | }
|
---|
1463 |
|
---|
1464 |
|
---|
1465 | /**
|
---|
1466 | * Hot-Key: Inserts a KLOGEXIT statement at cursor location.
|
---|
1467 | */
|
---|
1468 | void klib_klogexit()
|
---|
1469 | {
|
---|
1470 | _save_pos2(org_pos);
|
---|
1471 |
|
---|
1472 | /*
|
---|
1473 | * Go to nearest function.
|
---|
1474 | */
|
---|
1475 | if (!prev_proc())
|
---|
1476 | {
|
---|
1477 | /*
|
---|
1478 | * Get parameters.
|
---|
1479 | */
|
---|
1480 | _str sType = k_func_getreturntype(true);
|
---|
1481 | _restore_pos2(org_pos);
|
---|
1482 | if (sType)
|
---|
1483 | {
|
---|
1484 | boolean fReturn = true; /* true if an return statment is following the KLOGEXIT statement. */
|
---|
1485 |
|
---|
1486 | /*
|
---|
1487 | * Insert text.
|
---|
1488 | */
|
---|
1489 | cur_col = p_col;
|
---|
1490 | if (sType == 'void' || sType == 'VOID')
|
---|
1491 | { /* procedure */
|
---|
1492 | fReturn = cur_word(iIgnorePos) == 'return';
|
---|
1493 | if (!fReturn)
|
---|
1494 | {
|
---|
1495 | while (p_col <= p_SyntaxIndent)
|
---|
1496 | keyin(" ");
|
---|
1497 | }
|
---|
1498 |
|
---|
1499 | _insert_text("KLOGEXITVOID();\n");
|
---|
1500 |
|
---|
1501 | if (fReturn)
|
---|
1502 | {
|
---|
1503 | for (i = 1; i < cur_col; i++)
|
---|
1504 | _insert_text(" ");
|
---|
1505 | }
|
---|
1506 | search(")","E-");
|
---|
1507 | }
|
---|
1508 | else
|
---|
1509 | { /* function */
|
---|
1510 | _insert_text("KLOGEXIT();\n");
|
---|
1511 | for (i = 1; i < cur_col; i++)
|
---|
1512 | _insert_text(" ");
|
---|
1513 | search(")","E-");
|
---|
1514 |
|
---|
1515 | /*
|
---|
1516 | * Insert value if possible.
|
---|
1517 | */
|
---|
1518 | _save_pos2(valuepos);
|
---|
1519 | next_word();
|
---|
1520 | if (def_next_word_style == 'E')
|
---|
1521 | prev_word();
|
---|
1522 | if (cur_word(iIgnorePos) == 'return')
|
---|
1523 | {
|
---|
1524 | p_col += length('return');
|
---|
1525 | _save_pos2(posStart);
|
---|
1526 | offStart = _QROffset();
|
---|
1527 | if (!k_func_searchcode(";", "E+"))
|
---|
1528 | {
|
---|
1529 | offEnd = _QROffset();
|
---|
1530 | _restore_pos2(posStart);
|
---|
1531 | _str sValue = strip(get_text(offEnd - offStart));
|
---|
1532 | //say 'sValue = 'sValue;
|
---|
1533 | _restore_pos2(valuepos);
|
---|
1534 | _save_pos2(valuepos);
|
---|
1535 | _insert_text(sValue);
|
---|
1536 | }
|
---|
1537 | }
|
---|
1538 | _restore_pos2(valuepos);
|
---|
1539 | }
|
---|
1540 |
|
---|
1541 | /*
|
---|
1542 | * Remove old KLOGEXIT statement on previous line if any.
|
---|
1543 | */
|
---|
1544 | _save_pos2(valuepos);
|
---|
1545 | newexitline = p_line;
|
---|
1546 | p_line--; p_col = 1;
|
---|
1547 | next_word();
|
---|
1548 | if (def_next_word_style == 'E')
|
---|
1549 | prev_word();
|
---|
1550 | if (p_line == newexitline - 1 && substr(cur_word(iIgnorePos), 1, 8) == 'KLOGEXIT')
|
---|
1551 | delete_line();
|
---|
1552 | _restore_pos2(valuepos);
|
---|
1553 |
|
---|
1554 | /*
|
---|
1555 | * Check for missing '{...}'.
|
---|
1556 | */
|
---|
1557 | if (fReturn)
|
---|
1558 | {
|
---|
1559 | boolean fFound = false;
|
---|
1560 | _save_pos2(valuepos);
|
---|
1561 | p_col--; find_matching_paren(); p_col += 2;
|
---|
1562 | k_func_searchcode(';', 'E+'); /* places us at the ';' of the return. (hopefully) */
|
---|
1563 |
|
---|
1564 | _str ch = k_func_get_next_code_text();
|
---|
1565 | if (ch != '}')
|
---|
1566 | {
|
---|
1567 | _restore_pos2(valuepos);
|
---|
1568 | _save_pos2(valuepos);
|
---|
1569 | p_col--; find_matching_paren(); p_col += 2;
|
---|
1570 | k_func_searchcode(';', 'E+'); /* places us at the ';' of the return. (hopefully) */
|
---|
1571 | p_col++;
|
---|
1572 | if (k_func_more_code_on_line())
|
---|
1573 | _insert_text(' }');
|
---|
1574 | else
|
---|
1575 | {
|
---|
1576 | _save_pos2(returnget);
|
---|
1577 | k_func_searchcode("return", "E-");
|
---|
1578 | return_col = p_col;
|
---|
1579 | _restore_pos2(returnget);
|
---|
1580 |
|
---|
1581 | end_line();
|
---|
1582 | _insert_text("\n");
|
---|
1583 | while (p_col < return_col - p_SyntaxIndent)
|
---|
1584 | _insert_text(' ');
|
---|
1585 | _insert_text('}');
|
---|
1586 | }
|
---|
1587 |
|
---|
1588 | _restore_pos2(valuepos);
|
---|
1589 | _save_pos2(valuepos);
|
---|
1590 | prev_word();
|
---|
1591 | p_col -= p_SyntaxIndent;
|
---|
1592 | codecol = p_col;
|
---|
1593 | _insert_text("{\n");
|
---|
1594 | while (p_col < codecol)
|
---|
1595 | _insert_text(' ');
|
---|
1596 | }
|
---|
1597 |
|
---|
1598 | _restore_pos2(valuepos);
|
---|
1599 | }
|
---|
1600 | }
|
---|
1601 | else
|
---|
1602 | message("k_func_getreturntype failed, sType=" sType);
|
---|
1603 | return;
|
---|
1604 | }
|
---|
1605 |
|
---|
1606 | _restore_pos2(org_pos);
|
---|
1607 | }
|
---|
1608 |
|
---|
1609 |
|
---|
1610 | /**
|
---|
1611 | * Processes a file - ask user all the time.
|
---|
1612 | */
|
---|
1613 | void klib_klog_file_ask()
|
---|
1614 | {
|
---|
1615 | klib_klog_file_int(true)
|
---|
1616 | }
|
---|
1617 |
|
---|
1618 |
|
---|
1619 | /**
|
---|
1620 | * Processes a file - no questions.
|
---|
1621 | */
|
---|
1622 | void klib_klog_file_no_ask()
|
---|
1623 | {
|
---|
1624 | klib_klog_file_int(false)
|
---|
1625 | }
|
---|
1626 |
|
---|
1627 |
|
---|
1628 |
|
---|
1629 | /**
|
---|
1630 | * Processes a file.
|
---|
1631 | */
|
---|
1632 | static void klib_klog_file_int(boolean fAsk)
|
---|
1633 | {
|
---|
1634 | show_all();
|
---|
1635 | bottom();
|
---|
1636 | _refresh_scroll();
|
---|
1637 |
|
---|
1638 | /* ask question so we can get to the right position somehow.. */
|
---|
1639 | if (fAsk && _message_box("kLog process this file?", "Visual SlickEdit", MB_YESNO | MB_ICONQUESTION) != IDYES)
|
---|
1640 | return;
|
---|
1641 |
|
---|
1642 | /*
|
---|
1643 | * Entries.
|
---|
1644 | */
|
---|
1645 | while (!prev_proc())
|
---|
1646 | {
|
---|
1647 | //say 'entry main loop: ' k_func_getfunction_name();
|
---|
1648 |
|
---|
1649 | /*
|
---|
1650 | * Skip prototypes.
|
---|
1651 | */
|
---|
1652 | if (k_func_prototype())
|
---|
1653 | continue;
|
---|
1654 |
|
---|
1655 | /*
|
---|
1656 | * Ask user.
|
---|
1657 | */
|
---|
1658 | center_line();
|
---|
1659 | _refresh_scroll();
|
---|
1660 | sFunction = k_func_getfunction_name();
|
---|
1661 | rc = fAsk ? _message_box("Process this function ("sFunction")?", "Visual SlickEdit", MB_YESNOCANCEL | MB_ICONQUESTION) : IDYES;
|
---|
1662 | if (rc == IDYES)
|
---|
1663 | {
|
---|
1664 | _save_pos2(procpos);
|
---|
1665 | klib_klogentry();
|
---|
1666 | _restore_pos2(procpos);
|
---|
1667 | }
|
---|
1668 | else if (rc == IDNO)
|
---|
1669 | continue;
|
---|
1670 | else
|
---|
1671 | break;
|
---|
1672 | }
|
---|
1673 |
|
---|
1674 | /*
|
---|
1675 | * Exits.
|
---|
1676 | */
|
---|
1677 | bottom(); _refresh_scroll();
|
---|
1678 | boolean fUserCancel = false;
|
---|
1679 | while (!prev_proc() && !fUserCancel)
|
---|
1680 | {
|
---|
1681 | _save_pos2(procpos);
|
---|
1682 | sCurFunction = k_func_getfunction_name();
|
---|
1683 | //say 'exit main loop: ' sCurFunction
|
---|
1684 |
|
---|
1685 | /*
|
---|
1686 | * Skip prototypes.
|
---|
1687 | */
|
---|
1688 | if (k_func_prototype())
|
---|
1689 | continue;
|
---|
1690 |
|
---|
1691 | /*
|
---|
1692 | * Select procedure.
|
---|
1693 | */
|
---|
1694 | while ( !k_func_searchcode("return", "WE<+")
|
---|
1695 | && k_func_getfunction_name() == sCurFunction)
|
---|
1696 | {
|
---|
1697 | //say 'exit sub loop: ' p_line
|
---|
1698 | /*
|
---|
1699 | * Ask User.
|
---|
1700 | */
|
---|
1701 | center_line();
|
---|
1702 | _refresh_scroll();
|
---|
1703 | sFunction = k_func_getfunction_name();
|
---|
1704 | rc = fAsk ? _message_box("Process this exit from "sFunction"?", "Visual SlickEdit", MB_YESNOCANCEL | MB_ICONQUESTION) : IDYES;
|
---|
1705 | deselect();
|
---|
1706 | if (rc == IDYES)
|
---|
1707 | {
|
---|
1708 | _save_pos2(returnpos);
|
---|
1709 | klib_klogexit();
|
---|
1710 | _restore_pos2(returnpos);
|
---|
1711 | p_line++;
|
---|
1712 | }
|
---|
1713 | else if (rc != IDNO)
|
---|
1714 | {
|
---|
1715 | fUserCancel = true;
|
---|
1716 | break;
|
---|
1717 | }
|
---|
1718 | p_line++; /* just so we won't hit it again. */
|
---|
1719 | }
|
---|
1720 |
|
---|
1721 | /*
|
---|
1722 | * If void function we'll have to check if there is and return; prior to the ending '}'.
|
---|
1723 | */
|
---|
1724 | _restore_pos2(procpos);
|
---|
1725 | _save_pos2(procpos);
|
---|
1726 | sType = k_func_getreturntype(true);
|
---|
1727 | if (!fUserCancel && sType && (sType == 'void' || sType == 'VOID'))
|
---|
1728 | {
|
---|
1729 | if ( !k_func_searchcode("{", "E+")
|
---|
1730 | && !find_matching_paren())
|
---|
1731 | {
|
---|
1732 | _save_pos2(funcend);
|
---|
1733 | prev_word();
|
---|
1734 | if (cur_word(iIgnorePos) != "return")
|
---|
1735 | {
|
---|
1736 | /*
|
---|
1737 | * Ask User.
|
---|
1738 | */
|
---|
1739 | _restore_pos2(funcend);
|
---|
1740 | center_line();
|
---|
1741 | _refresh_scroll();
|
---|
1742 | sFunction = k_func_getfunction_name();
|
---|
1743 | rc = fAsk ? _message_box("Process this exit from "sFunction"?", "Visual SlickEdit", MB_YESNOCANCEL | MB_ICONQUESTION) : IDYES;
|
---|
1744 | deselect();
|
---|
1745 | if (rc == IDYES)
|
---|
1746 | {
|
---|
1747 | _save_pos2(returnpos);
|
---|
1748 | klib_klogexit();
|
---|
1749 | _restore_pos2(returnpos);
|
---|
1750 | }
|
---|
1751 | }
|
---|
1752 | }
|
---|
1753 | }
|
---|
1754 |
|
---|
1755 | /*
|
---|
1756 | * Next proc.
|
---|
1757 | */
|
---|
1758 | _restore_pos2(procpos);
|
---|
1759 | }
|
---|
1760 | }
|
---|
1761 |
|
---|
1762 |
|
---|
1763 | /*******************************************************************************
|
---|
1764 | * Odin32 backward compatibility *
|
---|
1765 | *******************************************************************************/
|
---|
1766 | _command void odin32_maketagfile()
|
---|
1767 | {
|
---|
1768 | /* We'll */
|
---|
1769 | if (file_match('-p 'maybe_quote_filename(strip_filename(_project_name,'e'):+TAG_FILE_EXT),1) != "")
|
---|
1770 | {
|
---|
1771 | _project_update_files_retag(false,false,false,false);
|
---|
1772 | /*
|
---|
1773 | RetagFilesInTagFile2(project_tag_file, orig_view_id, temp_view_id, rebuild_all, false,
|
---|
1774 | doRemove,false,true,true);*/7
|
---|
1775 | }
|
---|
1776 | else
|
---|
1777 | _project_update_files_retag(true,false,false,true);
|
---|
1778 | }
|
---|
1779 |
|
---|
1780 | _command void odin32_setcurrentdir()
|
---|
1781 | {
|
---|
1782 | //_ini_get_value(_project_name,"COMPILER","WORKINGDIR", workingdir);
|
---|
1783 | //cd(workingdir);
|
---|
1784 | /* Go the the directory containing the project filename */
|
---|
1785 | cd(strip_filename(_project_name, 'NE'));
|
---|
1786 | }
|
---|
1787 |
|
---|
1788 |
|
---|
1789 |
|
---|
1790 |
|
---|
1791 | /*******************************************************************************
|
---|
1792 | * Styles *
|
---|
1793 | *******************************************************************************/
|
---|
1794 | static _str StyleLanguages[] =
|
---|
1795 | {
|
---|
1796 | "c",
|
---|
1797 | "e",
|
---|
1798 | "java"
|
---|
1799 | };
|
---|
1800 |
|
---|
1801 | struct StyleScheme
|
---|
1802 | {
|
---|
1803 | _str name;
|
---|
1804 | _str settings[];
|
---|
1805 | };
|
---|
1806 |
|
---|
1807 | static StyleScheme StyleSchemes[] =
|
---|
1808 | {
|
---|
1809 | {
|
---|
1810 | "Opt2Ind4",
|
---|
1811 | {
|
---|
1812 | "orig_tabsize=4",
|
---|
1813 | "syntax_indent=4",
|
---|
1814 | "tabsize=4",
|
---|
1815 | "align_on_equal=1",
|
---|
1816 | "pad_condition_state=1",
|
---|
1817 | "indent_with_tabs=0",
|
---|
1818 | "nospace_before_paren=0",
|
---|
1819 | "indent_comments=1",
|
---|
1820 | "indent_case=1",
|
---|
1821 | "statement_comment_col=0",
|
---|
1822 | "disable_bestyle=0",
|
---|
1823 | "decl_comment_col=0",
|
---|
1824 | "bestyle_on_functions=0",
|
---|
1825 | "use_relative_indent=1",
|
---|
1826 | "nospace_before_brace=0",
|
---|
1827 | "indent_fl=1",
|
---|
1828 | "statement_comment_state=2",
|
---|
1829 | "indent_pp=1",
|
---|
1830 | "be_style=1",
|
---|
1831 | "parens_on_return=0",
|
---|
1832 | "eat_blank_lines=0",
|
---|
1833 | "brace_indent=0",
|
---|
1834 | "eat_pp_space=1",
|
---|
1835 | "align_on_parens=1",
|
---|
1836 | "continuation_indent=0",
|
---|
1837 | "cuddle_else=0",
|
---|
1838 | "nopad_condition=1",
|
---|
1839 | "pad_condition=0",
|
---|
1840 | "indent_col1_comments=0"
|
---|
1841 | }
|
---|
1842 | }
|
---|
1843 | ,
|
---|
1844 | {
|
---|
1845 | "Opt2Ind3",
|
---|
1846 | {
|
---|
1847 | "orig_tabsize=3",
|
---|
1848 | "syntax_indent=3",
|
---|
1849 | "tabsize=3",
|
---|
1850 | "align_on_equal=1",
|
---|
1851 | "pad_condition_state=1",
|
---|
1852 | "indent_with_tabs=0",
|
---|
1853 | "nospace_before_paren=0",
|
---|
1854 | "indent_comments=1",
|
---|
1855 | "indent_case=1",
|
---|
1856 | "statement_comment_col=0",
|
---|
1857 | "disable_bestyle=0",
|
---|
1858 | "decl_comment_col=0",
|
---|
1859 | "bestyle_on_functions=0",
|
---|
1860 | "use_relative_indent=1",
|
---|
1861 | "nospace_before_brace=0",
|
---|
1862 | "indent_fl=1",
|
---|
1863 | "statement_comment_state=2",
|
---|
1864 | "indent_pp=1",
|
---|
1865 | "be_style=1",
|
---|
1866 | "parens_on_return=0",
|
---|
1867 | "eat_blank_lines=0",
|
---|
1868 | "brace_indent=0",
|
---|
1869 | "eat_pp_space=1",
|
---|
1870 | "align_on_parens=1",
|
---|
1871 | "continuation_indent=0",
|
---|
1872 | "cuddle_else=0",
|
---|
1873 | "nopad_condition=1",
|
---|
1874 | "pad_condition=0",
|
---|
1875 | "indent_col1_comments=0"
|
---|
1876 | }
|
---|
1877 | }
|
---|
1878 | ,
|
---|
1879 | {
|
---|
1880 | "Opt2Ind8",
|
---|
1881 | {
|
---|
1882 | "orig_tabsize=8",
|
---|
1883 | "syntax_indent=8",
|
---|
1884 | "tabsize=8",
|
---|
1885 | "align_on_equal=1",
|
---|
1886 | "pad_condition_state=1",
|
---|
1887 | "indent_with_tabs=0",
|
---|
1888 | "nospace_before_paren=0",
|
---|
1889 | "indent_comments=1",
|
---|
1890 | "indent_case=1",
|
---|
1891 | "statement_comment_col=0",
|
---|
1892 | "disable_bestyle=0",
|
---|
1893 | "decl_comment_col=0",
|
---|
1894 | "bestyle_on_functions=0",
|
---|
1895 | "use_relative_indent=1",
|
---|
1896 | "nospace_before_brace=0",
|
---|
1897 | "indent_fl=1",
|
---|
1898 | "statement_comment_state=2",
|
---|
1899 | "indent_pp=1",
|
---|
1900 | "be_style=1",
|
---|
1901 | "parens_on_return=0",
|
---|
1902 | "eat_blank_lines=0",
|
---|
1903 | "brace_indent=0",
|
---|
1904 | "eat_pp_space=1",
|
---|
1905 | "align_on_parens=1",
|
---|
1906 | "continuation_indent=0",
|
---|
1907 | "cuddle_else=0",
|
---|
1908 | "nopad_condition=1",
|
---|
1909 | "pad_condition=0",
|
---|
1910 | "indent_col1_comments=0"
|
---|
1911 | }
|
---|
1912 | }
|
---|
1913 | ,
|
---|
1914 | {
|
---|
1915 | "Opt3Ind4",
|
---|
1916 | {
|
---|
1917 | "orig_tabsize=4",
|
---|
1918 | "syntax_indent=4",
|
---|
1919 | "tabsize=4",
|
---|
1920 | "align_on_equal=1",
|
---|
1921 | "pad_condition_state=1",
|
---|
1922 | "indent_with_tabs=0",
|
---|
1923 | "nospace_before_paren=0",
|
---|
1924 | "indent_comments=1",
|
---|
1925 | "indent_case=1",
|
---|
1926 | "statement_comment_col=0",
|
---|
1927 | "disable_bestyle=0",
|
---|
1928 | "decl_comment_col=0",
|
---|
1929 | "bestyle_on_functions=0",
|
---|
1930 | "use_relative_indent=1",
|
---|
1931 | "nospace_before_brace=0",
|
---|
1932 | "indent_fl=1",
|
---|
1933 | "statement_comment_state=2",
|
---|
1934 | "indent_pp=1",
|
---|
1935 | "be_style=2",
|
---|
1936 | "parens_on_return=0",
|
---|
1937 | "eat_blank_lines=0",
|
---|
1938 | "brace_indent=0",
|
---|
1939 | "eat_pp_space=1",
|
---|
1940 | "align_on_parens=1",
|
---|
1941 | "continuation_indent=0",
|
---|
1942 | "cuddle_else=0",
|
---|
1943 | "nopad_condition=1",
|
---|
1944 | "pad_condition=0",
|
---|
1945 | "indent_col1_comments=0"
|
---|
1946 | }
|
---|
1947 | }
|
---|
1948 | ,
|
---|
1949 | {
|
---|
1950 | "Opt3Ind3",
|
---|
1951 | {
|
---|
1952 | "orig_tabsize=3",
|
---|
1953 | "syntax_indent=3",
|
---|
1954 | "tabsize=3",
|
---|
1955 | "align_on_equal=1",
|
---|
1956 | "pad_condition_state=1",
|
---|
1957 | "indent_with_tabs=0",
|
---|
1958 | "nospace_before_paren=0",
|
---|
1959 | "indent_comments=1",
|
---|
1960 | "indent_case=1",
|
---|
1961 | "statement_comment_col=0",
|
---|
1962 | "disable_bestyle=0",
|
---|
1963 | "decl_comment_col=0",
|
---|
1964 | "bestyle_on_functions=0",
|
---|
1965 | "use_relative_indent=1",
|
---|
1966 | "nospace_before_brace=0",
|
---|
1967 | "indent_fl=1",
|
---|
1968 | "statement_comment_state=2",
|
---|
1969 | "indent_pp=1",
|
---|
1970 | "be_style=2",
|
---|
1971 | "parens_on_return=0",
|
---|
1972 | "eat_blank_lines=0",
|
---|
1973 | "brace_indent=0",
|
---|
1974 | "eat_pp_space=1",
|
---|
1975 | "align_on_parens=1",
|
---|
1976 | "continuation_indent=0",
|
---|
1977 | "cuddle_else=0",
|
---|
1978 | "nopad_condition=1",
|
---|
1979 | "pad_condition=0",
|
---|
1980 | "indent_col1_comments=0"
|
---|
1981 | }
|
---|
1982 | }
|
---|
1983 | };
|
---|
1984 |
|
---|
1985 |
|
---|
1986 | static void k_styles_create()
|
---|
1987 | {
|
---|
1988 | /*
|
---|
1989 | * Find user format ini file.
|
---|
1990 | */
|
---|
1991 | userini = maybe_quote_filename(_config_path():+'uformat.ini');
|
---|
1992 | if (file_match('-p 'userini, 1) == '')
|
---|
1993 | {
|
---|
1994 | ini = maybe_quote_filename(slick_path_search('uformat.ini'));
|
---|
1995 | if (ini != '') userini = ini;
|
---|
1996 | }
|
---|
1997 |
|
---|
1998 |
|
---|
1999 | /*
|
---|
2000 | * Remove any old schemes.
|
---|
2001 | */
|
---|
2002 | for (i = 0; i < StyleSchemes._length(); i++)
|
---|
2003 | for (j = 0; j < StyleLanguages._length(); j++)
|
---|
2004 | {
|
---|
2005 | sectionname = StyleLanguages[j]:+'-scheme-':+StyleSchemes[i].name;
|
---|
2006 | if (!_ini_get_section(userini, sectionname, tv))
|
---|
2007 | {
|
---|
2008 | _ini_delete_section(userini, sectionname);
|
---|
2009 | _delete_temp_view(tv);
|
---|
2010 | //message("delete old scheme");
|
---|
2011 | }
|
---|
2012 | }
|
---|
2013 |
|
---|
2014 | /*
|
---|
2015 | * Create the new schemes.
|
---|
2016 | */
|
---|
2017 | for (i = 0; i < StyleSchemes._length(); i++)
|
---|
2018 | {
|
---|
2019 | for (j = 0; j < StyleLanguages._length(); j++)
|
---|
2020 | {
|
---|
2021 | sectionname = StyleLanguages[j]:+'-scheme-':+StyleSchemes[i].name;
|
---|
2022 | orig_view_id = _create_temp_view(temp_view_id);
|
---|
2023 | activate_view(temp_view_id);
|
---|
2024 | for (k = 0; k < StyleSchemes[i].settings._length(); k++)
|
---|
2025 | insert_line(StyleSchemes[i].settings[k]);
|
---|
2026 |
|
---|
2027 | /* Insert the scheme section. */
|
---|
2028 | _ini_replace_section(userini, sectionname, temp_view_id);
|
---|
2029 | //message(userini)
|
---|
2030 | activate_view(orig_view_id);
|
---|
2031 | }
|
---|
2032 | }
|
---|
2033 |
|
---|
2034 | //last_scheme = last scheme name!!!
|
---|
2035 | }
|
---|
2036 |
|
---|
2037 |
|
---|
2038 | /*
|
---|
2039 | * Sets the last used beutify scheme.
|
---|
2040 | */
|
---|
2041 | static k_styles_set(_str scheme)
|
---|
2042 | {
|
---|
2043 |
|
---|
2044 | /*
|
---|
2045 | * Find user format ini file.
|
---|
2046 | */
|
---|
2047 | userini = maybe_quote_filename(_config_path():+'uformat.ini');
|
---|
2048 | if (file_match('-p 'userini, 1) == '')
|
---|
2049 | {
|
---|
2050 | ini = maybe_quote_filename(slick_path_search('uformat.ini'));
|
---|
2051 | if (ini != '') userini = ini;
|
---|
2052 | }
|
---|
2053 |
|
---|
2054 | /*
|
---|
2055 | * Set the scheme for each language.
|
---|
2056 | */
|
---|
2057 | for (j = 0; j < StyleLanguages._length(); j++)
|
---|
2058 | {
|
---|
2059 | _ini_set_value(userini,
|
---|
2060 | StyleLanguages[j]:+'-scheme-Default',
|
---|
2061 | 'last_scheme',
|
---|
2062 | scheme);
|
---|
2063 | }
|
---|
2064 | }
|
---|
2065 |
|
---|
2066 |
|
---|
2067 | static _str defoptions[] =
|
---|
2068 | {
|
---|
2069 | "def-options-sas",
|
---|
2070 | "def-options-js",
|
---|
2071 | "def-options-bat",
|
---|
2072 | "def-options-c",
|
---|
2073 | "def-options-pas",
|
---|
2074 | "def-options-e",
|
---|
2075 | "def-options-java",
|
---|
2076 | "def-options-bourneshell",
|
---|
2077 | "def-options-csh",
|
---|
2078 | "def-options-vlx",
|
---|
2079 | "def-options-plsql",
|
---|
2080 | "def-options-sqlserver",
|
---|
2081 | "def-options-cmd"
|
---|
2082 | };
|
---|
2083 |
|
---|
2084 | static _str defsetups[] =
|
---|
2085 | {
|
---|
2086 | "def-setup-sas",
|
---|
2087 | "def-setup-js",
|
---|
2088 | "def-setup-bat",
|
---|
2089 | "def-setup-fundamental",
|
---|
2090 | "def-setup-process",
|
---|
2091 | "def-setup-c",
|
---|
2092 | "def-setup-pas",
|
---|
2093 | "def-setup-e",
|
---|
2094 | "def-setup-asm",
|
---|
2095 | "def-setup-java",
|
---|
2096 | "def-setup-html",
|
---|
2097 | "def-setup-bourneshell",
|
---|
2098 | "def-setup-csh",
|
---|
2099 | "def-setup-vlx",
|
---|
2100 | "def-setup-fileman",
|
---|
2101 | "def-setup-plsql",
|
---|
2102 | "def-setup-sqlserver",
|
---|
2103 | "def-setup-s",
|
---|
2104 | "def-setup-cmd"
|
---|
2105 | };
|
---|
2106 |
|
---|
2107 | static _str defsetupstab8[] =
|
---|
2108 | {
|
---|
2109 | "def-setup-c"
|
---|
2110 | };
|
---|
2111 |
|
---|
2112 |
|
---|
2113 | static void k_styles_setindent(int indent, int iBraceStyle, boolean iWithTabs = false)
|
---|
2114 | {
|
---|
2115 | if (iBraceStyle < 1 || iBraceStyle > 3)
|
---|
2116 | {
|
---|
2117 | say 'k_styles_setindent: iBraceStyle is bad (='iBraceStyle')';
|
---|
2118 | iBraceStyle = 2;
|
---|
2119 | }
|
---|
2120 | /*
|
---|
2121 | * def-options for extentions known to have that info.
|
---|
2122 | */
|
---|
2123 | for (i = 0; i < defoptions._length(); i++)
|
---|
2124 | {
|
---|
2125 | idx = find_index(defoptions[i], MISC_TYPE);
|
---|
2126 | if (!idx)
|
---|
2127 | continue;
|
---|
2128 |
|
---|
2129 | parse name_info(idx) with syntax_indent o2 o3 o4 flags indent_fl o7 indent_case rest;
|
---|
2130 |
|
---|
2131 | /* Begin/end style */
|
---|
2132 | flags = flags & ~(1|2);
|
---|
2133 | flags = flags | (iBraceStyle - 1); /* Set style (0-based) */
|
---|
2134 | flags = flags & ~(16); /* no scape before parent.*/
|
---|
2135 | indent_fl = 1; /* Indent first level */
|
---|
2136 | indent_case = 1; /* Indent case from switch */
|
---|
2137 |
|
---|
2138 | sNewOptions = indent' 'o2' 'o3' 'o4' 'flags' 'indent_fl' 'o7' 'indent_case' 'rest;
|
---|
2139 | set_name_info(idx, sNewOptions);
|
---|
2140 | _config_modify |= CFGMODIFY_DEFDATA;
|
---|
2141 | }
|
---|
2142 |
|
---|
2143 | /*
|
---|
2144 | * def-setup for known extentions.
|
---|
2145 | */
|
---|
2146 | for (i = 0; i < defsetups._length(); i++)
|
---|
2147 | {
|
---|
2148 | idx = find_index(defsetups[i], MISC_TYPE);
|
---|
2149 | if (!idx)
|
---|
2150 | continue;
|
---|
2151 | sExt = substr(defsetups[i], length('def-setup-') + 1);
|
---|
2152 | sSetup = name_info(idx);
|
---|
2153 |
|
---|
2154 | /*
|
---|
2155 | parse sSetup with 'MN=' mode_name ','\
|
---|
2156 | 'TABS=' tabs ',' 'MA=' margins ',' 'KEYTAB=' keytab_name ','\
|
---|
2157 | 'WW='word_wrap_style ',' 'IWT='indent_with_tabs ','\
|
---|
2158 | 'ST='show_tabs ',' 'IN='indent_style ','\
|
---|
2159 | 'WC='word_chars',' 'LN='lexer_name',' 'CF='color_flags','\
|
---|
2160 | 'LNL='line_numbers_len','rest;
|
---|
2161 |
|
---|
2162 | indent_with_tabs = 0; /* Indent with tabs */
|
---|
2163 |
|
---|
2164 | /* Make sure all the values are legal */
|
---|
2165 | _ext_init_values(ext, lexer_name, color_flags);
|
---|
2166 | if (!isinteger(line_numbers_len)) line_numbers_len = 0;
|
---|
2167 | if (word_chars == '') word_chars = 'A-Za-z0-9_$';
|
---|
2168 | if (word_wrap_style == '') word_wrap_style = 3;
|
---|
2169 | if (show_tabs == '') show_tabs = 0;
|
---|
2170 | if (indent_style == '') indent_style = INDENT_SMART;
|
---|
2171 |
|
---|
2172 | /* Set new indent */
|
---|
2173 | tabs = '+'indent;
|
---|
2174 | */
|
---|
2175 |
|
---|
2176 | sNewSetup = sSetup;
|
---|
2177 |
|
---|
2178 | /* Set new indent */
|
---|
2179 | if (pos('TABS=', sNewSetup) > 0)
|
---|
2180 | {
|
---|
2181 | /*
|
---|
2182 | * If either in defoptions or defsetupstab8 use default tab of 8
|
---|
2183 | * For those supporting separate syntax indent using the normal tabsize
|
---|
2184 | * helps us a lot when reading it...
|
---|
2185 | */
|
---|
2186 | fTab8 = false;
|
---|
2187 | for (j = 0; !fTab8 && j < defsetupstab8._length(); j++)
|
---|
2188 | if (substr(defsetupstab8[j], lastpos('-', defsetupstab8[j]) + 1) == sExt)
|
---|
2189 | fTab8 = true;
|
---|
2190 | for (j = 0; !fTab8 && j < defoptions._length(); j++)
|
---|
2191 | if (substr(defoptions[j], lastpos('-', defoptions[j]) + 1) == sExt)
|
---|
2192 | fTab8 = true;
|
---|
2193 |
|
---|
2194 | parse sNewSetup with sPre 'TABS=' sValue ',' sPost;
|
---|
2195 | if (fTab8)
|
---|
2196 | sNewSetup = sPre 'TABS=+8,' sPost
|
---|
2197 | else
|
---|
2198 | sNewSetup = sPre 'TABS=+' indent ',' sPost
|
---|
2199 | }
|
---|
2200 |
|
---|
2201 | /* Set indent with tabs flag. */
|
---|
2202 | if (pos('IWT=', sNewSetup) > 0)
|
---|
2203 | {
|
---|
2204 | parse sNewSetup with sPre 'IWT=' sValue ',' sPost;
|
---|
2205 | if (iWithTabs)
|
---|
2206 | sNewSetup = sPre 'IWT=1,' sPost
|
---|
2207 | else
|
---|
2208 | sNewSetup = sPre 'IWT=0,' sPost
|
---|
2209 | }
|
---|
2210 |
|
---|
2211 | /* Do the real changes */
|
---|
2212 | set_name_info(idx, sNewSetup);
|
---|
2213 | _config_modify |= CFGMODIFY_DEFDATA;
|
---|
2214 | _update_buffers(sExt);
|
---|
2215 | }
|
---|
2216 | }
|
---|
2217 |
|
---|
2218 |
|
---|
2219 | /*******************************************************************************
|
---|
2220 | * Menu and Menu commands *
|
---|
2221 | *******************************************************************************/
|
---|
2222 | static int iTimer = 0;
|
---|
2223 | static int mhkDev = 0;
|
---|
2224 | static int mhCode = 0;
|
---|
2225 | static int mhDoc = 0;
|
---|
2226 | static int mhLic = 0;
|
---|
2227 | static int mhPre = 0;
|
---|
2228 |
|
---|
2229 | /*
|
---|
2230 | * Creates the kDev menu.
|
---|
2231 | */
|
---|
2232 | static k_menu_create()
|
---|
2233 | {
|
---|
2234 | if (arg(1) == 'timer')
|
---|
2235 | _kill_timer(iTimer);
|
---|
2236 | menu_handle = _mdi.p_menu_handle;
|
---|
2237 | menu_index = find_index(_cur_mdi_menu,oi2type(OI_MENU));
|
---|
2238 |
|
---|
2239 | /*
|
---|
2240 | * Remove any old menu.
|
---|
2241 | */
|
---|
2242 | mhDelete = iPos = 0;
|
---|
2243 | index = _menu_find(menu_handle, "kDev", mhDelete, iPos, 'C');
|
---|
2244 | //message("index="index " mhDelete="mhDelete " iPos="iPos);
|
---|
2245 | if (index == 0)
|
---|
2246 | _menu_delete(mhDelete, iPos);
|
---|
2247 |
|
---|
2248 |
|
---|
2249 | /*
|
---|
2250 | * Insert the "kDev" menu.
|
---|
2251 | */
|
---|
2252 | mhkDev = _menu_insert(menu_handle, 9, MF_SUBMENU, "&kDev", "", "kDev");
|
---|
2253 | mhCode=_menu_insert(mhkDev, -1, MF_ENABLED | MF_SUBMENU, "Coding &Style", "", "coding");
|
---|
2254 | rc = _menu_insert(mhCode, -1, MF_ENABLED | MF_UNCHECKED, "Braces 2, Syntax Indent 4 (knut)", "k_menu_style Opt2Ind4", "Opt2Ind4");
|
---|
2255 | rc = _menu_insert(mhCode, -1, MF_ENABLED | MF_UNCHECKED, "Braces 2, Syntax Indent 3", "k_menu_style Opt2Ind3", "Opt2Ind3");
|
---|
2256 | rc = _menu_insert(mhCode, -1, MF_ENABLED | MF_UNCHECKED, "Braces 2, Syntax Indent 8", "k_menu_style Opt2Ind8", "Opt2Ind8");
|
---|
2257 | rc = _menu_insert(mhCode, -1, MF_ENABLED | MF_UNCHECKED, "Braces 3, Syntax Indent 4 (giws)", "k_menu_style Opt3Ind4", "Opt3Ind4");
|
---|
2258 | rc = _menu_insert(mhCode, -1, MF_ENABLED | MF_UNCHECKED, "Braces 3, Syntax Indent 3 (giws)", "k_menu_style Opt3Ind3", "Opt3Ind3");
|
---|
2259 |
|
---|
2260 | mhDoc= _menu_insert(mhkDev, -1, MF_ENABLED | MF_SUBMENU, "&Documentation", "", "doc");
|
---|
2261 | mhDSJ= _menu_insert(mhDoc, -1, MF_ENABLED | MF_UNCHECKED, "&Javadoc Style", "k_menu_doc_style javadoc", "javadoc");
|
---|
2262 | mhDSL= _menu_insert(mhDoc, -1, MF_GRAYED | MF_UNCHECKED, "&Linux Kernel Style", "k_menu_doc_style linux", "linux");
|
---|
2263 |
|
---|
2264 | mhLic= _menu_insert(mhkDev, -1, MF_ENABLED | MF_SUBMENU, "&License", "", "License");
|
---|
2265 | rc = _menu_insert(mhLic, -1, MF_ENABLED | MF_UNCHECKED, "&Odin32", "k_menu_license Odin32", "Odin32");
|
---|
2266 | rc = _menu_insert(mhLic, -1, MF_ENABLED | MF_UNCHECKED, "&GPL", "k_menu_license GPL", "GPL");
|
---|
2267 | rc = _menu_insert(mhLic, -1, MF_ENABLED | MF_UNCHECKED, "&LGPL", "k_menu_license LGPL", "LGPL");
|
---|
2268 | rc = _menu_insert(mhLic, -1, MF_ENABLED | MF_UNCHECKED, "&Confidential", "k_menu_license Confidential", "Confidential");
|
---|
2269 |
|
---|
2270 | rc = _menu_insert(mhkDev, -1, MF_ENABLED, "-", "", "dash vars");
|
---|
2271 | rc = _menu_insert(mhkDev, -1, MF_ENABLED, skChange == '' ? '&Change...' : '&Change (' skChange ')...', "k_menu_change", "");
|
---|
2272 | rc = _menu_insert(mhkDev, -1, MF_ENABLED, skProgram == '' ? '&Program...' : '&Program (' skProgram ')...', "k_menu_program", "");
|
---|
2273 | rc = _menu_insert(mhkDev, -1, MF_ENABLED, skCompany == '' ? 'Co&mpany...' : 'Co&mpany (' skCompany ')...', "k_menu_company", "");
|
---|
2274 | rc = _menu_insert(mhkDev, -1, MF_ENABLED, '&User Name (' skUserName ')...', "k_menu_user_name", "username");
|
---|
2275 | rc = _menu_insert(mhkDev, -1, MF_ENABLED, 'User &e-mail (' skUserEmail ')...', "k_menu_user_email", "useremail");
|
---|
2276 | rc = _menu_insert(mhkDev, -1, MF_ENABLED, 'User &Initials (' skUserInitials ')...', "k_menu_user_initials", "userinitials");
|
---|
2277 | rc = _menu_insert(mhkDev, -1, MF_ENABLED, "-", "", "dash preset");
|
---|
2278 | mhPre= _menu_insert(mhkDev, -1, MF_SUBMENU, "P&resets", "", "");
|
---|
2279 | rc = _menu_insert(mhPre, -1, MF_ENABLED, "Odin32", "k_menu_preset javadoc, Odin32, Opt2Ind4,,Odin32", "odin32");
|
---|
2280 | rc = _menu_insert(mhPre, -1, MF_ENABLED, "Linux Kernel","k_menu_preset linux, GPL, Opt1Ind4,,Linux", "linux");
|
---|
2281 | rc = _menu_insert(mhPre, -1, MF_ENABLED, "The Bird", "k_menu_preset javadoc, GPL, Opt2Ind4", "bird");
|
---|
2282 | rc = _menu_insert(mhPre, -1, MF_ENABLED, "Win32k", "k_menu_preset javadoc, GPL, Opt2Ind4,, Win32k", "Win32k");
|
---|
2283 | rc = _menu_insert(mhPre, -1, MF_ENABLED, "kKrnlLib", "k_menu_preset javadoc, GPL, Opt2Ind4,, kKrnlLib", "kKrnlLib");
|
---|
2284 | rc = _menu_insert(mhPre, -1, MF_ENABLED, "kLib", "k_menu_preset javadoc, GPL, Opt2Ind4,, kLib", "kLib");
|
---|
2285 | rc = _menu_insert(mhPre, -1, MF_ENABLED, "kBuild", "k_menu_preset javadoc, GPL, Opt2Ind4,, kBuild", "kBuild");
|
---|
2286 | rc = _menu_insert(mhPre, -1, MF_ENABLED, "Innotek", "k_menu_preset javadoc, Confidential, Opt2Ind4, InnoTek Systemberatung GmbH", "Innotek");
|
---|
2287 | rc = _menu_insert(mhPre, -1, MF_ENABLED, "VPC/2", "k_menu_preset javadoc, Confidential, Opt2Ind4, InnoTek Systemberatung GmbH, VPC/2", "VPC2");
|
---|
2288 |
|
---|
2289 | k_menu_doc_style();
|
---|
2290 | k_menu_license();
|
---|
2291 | k_menu_style();
|
---|
2292 | }
|
---|
2293 |
|
---|
2294 |
|
---|
2295 | /**
|
---|
2296 | * Change change Id.
|
---|
2297 | */
|
---|
2298 | _command k_menu_change()
|
---|
2299 | {
|
---|
2300 | sRc = show("-modal k_form_simple_input", "Change ID", skChange);
|
---|
2301 | if (sRc != "\r")
|
---|
2302 | {
|
---|
2303 | skChange = sRc;
|
---|
2304 | k_menu_create();
|
---|
2305 | }
|
---|
2306 | }
|
---|
2307 |
|
---|
2308 |
|
---|
2309 | /**
|
---|
2310 | * Change program name.
|
---|
2311 | */
|
---|
2312 | _command k_menu_program()
|
---|
2313 | {
|
---|
2314 | sRc = show("-modal k_form_simple_input", "Program", skProgram);
|
---|
2315 | if (sRc != "\r")
|
---|
2316 | {
|
---|
2317 | skProgram = sRc;
|
---|
2318 | k_menu_create();
|
---|
2319 | }
|
---|
2320 | }
|
---|
2321 |
|
---|
2322 |
|
---|
2323 | /**
|
---|
2324 | * Change company.
|
---|
2325 | */
|
---|
2326 | _command k_menu_company()
|
---|
2327 | {
|
---|
2328 | if (skCompany == '')
|
---|
2329 | sRc = show("-modal k_form_simple_input", "Company", 'InnoTek Systemberatung GmbH');
|
---|
2330 | else
|
---|
2331 | sRc = show("-modal k_form_simple_input", "Company", skCompany);
|
---|
2332 | if (sRc != "\r")
|
---|
2333 | {
|
---|
2334 | skCompany = sRc;
|
---|
2335 | k_menu_create();
|
---|
2336 | }
|
---|
2337 | }
|
---|
2338 |
|
---|
2339 |
|
---|
2340 | /**
|
---|
2341 | * Change user name.
|
---|
2342 | */
|
---|
2343 | _command k_menu_user_name()
|
---|
2344 | {
|
---|
2345 | sRc = show("-modal k_form_simple_input", "User Name", skUserName);
|
---|
2346 | if (sRc != "\r" && sRc != '')
|
---|
2347 | {
|
---|
2348 | skUserName = sRc;
|
---|
2349 | k_menu_create();
|
---|
2350 | }
|
---|
2351 | }
|
---|
2352 |
|
---|
2353 |
|
---|
2354 | /**
|
---|
2355 | * Change user email.
|
---|
2356 | */
|
---|
2357 | _command k_menu_user_email()
|
---|
2358 | {
|
---|
2359 | sRc = show("-modal k_form_simple_input", "User e-mail", skUserEmail);
|
---|
2360 | if (sRc != "\r" && sRc != '')
|
---|
2361 | {
|
---|
2362 | skUserEmail = sRc;
|
---|
2363 | k_menu_create();
|
---|
2364 | }
|
---|
2365 | }
|
---|
2366 |
|
---|
2367 |
|
---|
2368 | /**
|
---|
2369 | * Change user initials.
|
---|
2370 | */
|
---|
2371 | _command k_menu_user_initials()
|
---|
2372 | {
|
---|
2373 | sRc = show("-modal k_form_simple_input", "User e-mail", skUserInitials);
|
---|
2374 | if (sRc != "\r" && sRc != '')
|
---|
2375 | {
|
---|
2376 | skUserInitials = sRc;
|
---|
2377 | k_menu_create();
|
---|
2378 | }
|
---|
2379 | }
|
---|
2380 |
|
---|
2381 |
|
---|
2382 |
|
---|
2383 | /**
|
---|
2384 | * Checks the correct menu item.
|
---|
2385 | */
|
---|
2386 | _command void k_menu_doc_style(_str sNewDocStyle = '')
|
---|
2387 | {
|
---|
2388 | //say 'sNewDocStyle='sNewDocStyle;
|
---|
2389 | if (sNewDocStyle != '')
|
---|
2390 | skDocStyle = sNewDocStyle
|
---|
2391 | _menu_set_state(mhDoc, "javadoc", MF_UNCHECKED);
|
---|
2392 | _menu_set_state(mhDoc, "linux", MF_UNCHECKED | MF_GRAYED);
|
---|
2393 | _menu_set_state(mhDoc, skDocStyle, MF_CHECKED);
|
---|
2394 | }
|
---|
2395 |
|
---|
2396 |
|
---|
2397 | /**
|
---|
2398 | * Checks the correct menu item.
|
---|
2399 | */
|
---|
2400 | _command void k_menu_license(_str sNewLicense = '')
|
---|
2401 | {
|
---|
2402 | //say 'sNewLicense='sNewLicense;
|
---|
2403 | if (sNewLicense != '')
|
---|
2404 | skLicense = sNewLicense
|
---|
2405 | _menu_set_state(mhLic, "Odin32", MF_UNCHECKED);
|
---|
2406 | _menu_set_state(mhLic, "GPL", MF_UNCHECKED);
|
---|
2407 | _menu_set_state(mhLic, "LGPL", MF_UNCHECKED);
|
---|
2408 | _menu_set_state(mhLic, "Confidential", MF_UNCHECKED);
|
---|
2409 | _menu_set_state(mhLic, skLicense, MF_CHECKED);
|
---|
2410 | }
|
---|
2411 |
|
---|
2412 |
|
---|
2413 | /**
|
---|
2414 | * Check the correct style menu item.
|
---|
2415 | */
|
---|
2416 | _command void k_menu_style(_str sNewStyle = '')
|
---|
2417 | {
|
---|
2418 | //say 'sNewStyle='sNewStyle;
|
---|
2419 | _menu_set_state(mhCode, "Opt1Ind4", MF_UNCHECKED);
|
---|
2420 | _menu_set_state(mhCode, "Opt1Ind3", MF_UNCHECKED);
|
---|
2421 | _menu_set_state(mhCode, "Opt1Ind8", MF_UNCHECKED);
|
---|
2422 | _menu_set_state(mhCode, "Opt2Ind4", MF_UNCHECKED);
|
---|
2423 | _menu_set_state(mhCode, "Opt2Ind3", MF_UNCHECKED);
|
---|
2424 | _menu_set_state(mhCode, "Opt2Ind8", MF_UNCHECKED);
|
---|
2425 | _menu_set_state(mhCode, "Opt3Ind4", MF_UNCHECKED);
|
---|
2426 | _menu_set_state(mhCode, "Opt3Ind3", MF_UNCHECKED);
|
---|
2427 | _menu_set_state(mhCode, "Opt3Ind8", MF_UNCHECKED);
|
---|
2428 |
|
---|
2429 | if (sNewStyle != '')
|
---|
2430 | {
|
---|
2431 | int iIndent = (int)substr(sNewStyle, 8, 1);
|
---|
2432 | int iBraceStyle = (int)substr(sNewStyle, 4, 1);
|
---|
2433 | skCodeStyle = sNewStyle;
|
---|
2434 | k_styles_setindent(iIndent, iBraceStyle);
|
---|
2435 | k_styles_set(sNewStyle);
|
---|
2436 | }
|
---|
2437 |
|
---|
2438 | _menu_set_state(mhCode, skCodeStyle, MF_CHECKED);
|
---|
2439 | }
|
---|
2440 |
|
---|
2441 |
|
---|
2442 | /**
|
---|
2443 | * Load a 'preset'.
|
---|
2444 | */
|
---|
2445 | _command void k_menu_preset(_str sArgs = '')
|
---|
2446 | {
|
---|
2447 | parse sArgs with sNewDocStyle ',' sNewLicense ',' sNewStyle ',' sNewCompany ',' sNewProgram ',' sNewChange
|
---|
2448 | sNewDocStyle= strip(sNewDocStyle);
|
---|
2449 | sNewLicense = strip(sNewLicense);
|
---|
2450 | sNewStyle = strip(sNewStyle);
|
---|
2451 | sNewCompany = strip(sNewCompany);
|
---|
2452 | sNewProgram = strip(sNewProgram);
|
---|
2453 | sNewChange = strip(sNewChange);
|
---|
2454 |
|
---|
2455 | //say 'k_menu_preset('sNewDocStyle',' sNewLicense',' sNewStyle',' sNewCompany',' sNewProgram')';
|
---|
2456 | k_menu_doc_style(sNewDocStyle);
|
---|
2457 | k_menu_license(sNewLicense);
|
---|
2458 | k_menu_style(sNewStyle);
|
---|
2459 | skCompany = sNewCompany;
|
---|
2460 | skProgram = sNewProgram;
|
---|
2461 | skChange = sNewChange;
|
---|
2462 | k_menu_create();
|
---|
2463 | }
|
---|
2464 |
|
---|
2465 |
|
---|
2466 |
|
---|
2467 | /* future ones..
|
---|
2468 | _command k_menu_setcolor()
|
---|
2469 | {
|
---|
2470 | createMyColorSchemeAndUseIt();
|
---|
2471 | }
|
---|
2472 |
|
---|
2473 |
|
---|
2474 | _command k_menu_setkeys()
|
---|
2475 | {
|
---|
2476 | rc = load("d:/knut/VSlickMacros/BoxerDef.e");
|
---|
2477 | }
|
---|
2478 |
|
---|
2479 | _command k_menu_settings()
|
---|
2480 | {
|
---|
2481 | mySettings();
|
---|
2482 | }
|
---|
2483 | */
|
---|
2484 |
|
---|
2485 |
|
---|
2486 | /*******************************************************************************
|
---|
2487 | * Dialogs *
|
---|
2488 | *******************************************************************************/
|
---|
2489 | _form k_form_simple_input {
|
---|
2490 | p_backcolor=0x80000005
|
---|
2491 | p_border_style=BDS_DIALOG_BOX
|
---|
2492 | p_caption='Simple Input'
|
---|
2493 | p_clip_controls=FALSE
|
---|
2494 | p_forecolor=0x80000008
|
---|
2495 | p_height=1120
|
---|
2496 | p_width=5020
|
---|
2497 | p_x=6660
|
---|
2498 | p_y=6680
|
---|
2499 | _text_box entText {
|
---|
2500 | p_auto_size=TRUE
|
---|
2501 | p_backcolor=0x80000005
|
---|
2502 | p_border_style=BDS_FIXED_SINGLE
|
---|
2503 | p_completion=NONE_ARG
|
---|
2504 | p_font_bold=FALSE
|
---|
2505 | p_font_italic=FALSE
|
---|
2506 | p_font_name='MS Sans Serif'
|
---|
2507 | p_font_size=8
|
---|
2508 | p_font_underline=FALSE
|
---|
2509 | p_forecolor=0x80000008
|
---|
2510 | p_height=270
|
---|
2511 | p_tab_index=1
|
---|
2512 | p_tab_stop=TRUE
|
---|
2513 | p_text='text'
|
---|
2514 | p_width=3180
|
---|
2515 | p_x=1680
|
---|
2516 | p_y=240
|
---|
2517 | p_eventtab2=_ul2_textbox
|
---|
2518 | }
|
---|
2519 | _label lblLabel {
|
---|
2520 | p_alignment=AL_VCENTERRIGHT
|
---|
2521 | p_auto_size=FALSE
|
---|
2522 | p_backcolor=0x80000005
|
---|
2523 | p_border_style=BDS_NONE
|
---|
2524 | p_caption='Label'
|
---|
2525 | p_font_bold=FALSE
|
---|
2526 | p_font_italic=FALSE
|
---|
2527 | p_font_name='MS Sans Serif'
|
---|
2528 | p_font_size=8
|
---|
2529 | p_font_underline=FALSE
|
---|
2530 | p_forecolor=0x80000008
|
---|
2531 | p_height=240
|
---|
2532 | p_tab_index=2
|
---|
2533 | p_width=1380
|
---|
2534 | p_word_wrap=FALSE
|
---|
2535 | p_x=180
|
---|
2536 | p_y=240
|
---|
2537 | }
|
---|
2538 | _command_button btnOK {
|
---|
2539 | p_cancel=FALSE
|
---|
2540 | p_caption='&OK'
|
---|
2541 | p_default=TRUE
|
---|
2542 | p_font_bold=FALSE
|
---|
2543 | p_font_italic=FALSE
|
---|
2544 | p_font_name='MS Sans Serif'
|
---|
2545 | p_font_size=8
|
---|
2546 | p_font_underline=FALSE
|
---|
2547 | p_height=360
|
---|
2548 | p_tab_index=3
|
---|
2549 | p_tab_stop=TRUE
|
---|
2550 | p_width=1020
|
---|
2551 | p_x=180
|
---|
2552 | p_y=660
|
---|
2553 | }
|
---|
2554 | _command_button btnCancel {
|
---|
2555 | p_cancel=TRUE
|
---|
2556 | p_caption='Cancel'
|
---|
2557 | p_default=FALSE
|
---|
2558 | p_font_bold=FALSE
|
---|
2559 | p_font_italic=FALSE
|
---|
2560 | p_font_name='MS Sans Serif'
|
---|
2561 | p_font_size=8
|
---|
2562 | p_font_underline=FALSE
|
---|
2563 | p_height=360
|
---|
2564 | p_tab_index=4
|
---|
2565 | p_tab_stop=TRUE
|
---|
2566 | p_width=840
|
---|
2567 | p_x=1380
|
---|
2568 | p_y=660
|
---|
2569 | }
|
---|
2570 | }
|
---|
2571 |
|
---|
2572 | defeventtab k_form_simple_input
|
---|
2573 | btnOK.on_create(_str sLabel = '', _str sText = '')
|
---|
2574 | {
|
---|
2575 | p_active_form.p_caption = sLabel;
|
---|
2576 | lblLabel.p_caption = sLabel;
|
---|
2577 | entText.p_text = sText;
|
---|
2578 | }
|
---|
2579 |
|
---|
2580 | btnOK.lbutton_up()
|
---|
2581 | {
|
---|
2582 | sText = entText.p_text;
|
---|
2583 | p_active_form._delete_window(sText);
|
---|
2584 | }
|
---|
2585 | btnCancel.lbutton_up()
|
---|
2586 | {
|
---|
2587 | sText = entText.p_text;
|
---|
2588 | p_active_form._delete_window("\r");
|
---|
2589 | }
|
---|
2590 |
|
---|
2591 |
|
---|
2592 |
|
---|
2593 | /**
|
---|
2594 | * Module initiation.
|
---|
2595 | */
|
---|
2596 | definit()
|
---|
2597 | {
|
---|
2598 | k_styles_create();
|
---|
2599 | k_menu_create();
|
---|
2600 | iTimer = _set_timer(1000, k_menu_create, "timer");
|
---|
2601 | /* createMyColorSchemeAndUseIt();*/
|
---|
2602 | }
|
---|
2603 |
|
---|
2604 |
|
---|