1 | "
|
---|
2 | " TOPPERS Software
|
---|
3 | " Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
4 | "
|
---|
5 | " Copyright (C) 2011 by TAKUYA
|
---|
6 | " Embedded and Real-Time Systems Laboratory
|
---|
7 | " Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
8 | "
|
---|
9 | " ä¸è¨è使¨©è
|
---|
10 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
11 | " ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»
|
---|
12 | " åé
|
---|
13 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
14 | " (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®è使¨©
|
---|
15 | " 表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼ã¹
|
---|
16 | " ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
17 | " (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿ç¨
|
---|
18 | " ã§ããå½¢ã§åé
|
---|
19 | å¸ããå ´åã«ã¯ï¼åé
|
---|
20 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
21 | ã
|
---|
22 | " ãã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è使¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿
|
---|
23 | " 証è¦å®ãæ²è¼ãããã¨ï¼
|
---|
24 | " (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿ç¨
|
---|
25 | " ã§ããªãå½¢ã§åé
|
---|
26 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºãããã¨ï¼
|
---|
27 | " (a) åé
|
---|
28 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
29 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½
|
---|
30 | " 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
31 | " (b) åé
|
---|
32 | å¸ã®å½¢æ
|
---|
33 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«å ±
|
---|
34 | " åãããã¨ï¼
|
---|
35 | " (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³
|
---|
36 | " ãããï¼ä¸è¨è使¨©è
|
---|
37 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
38 | 責ãããã¨ï¼ã¾ãï¼
|
---|
39 | " æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãçç±ã«åºã¥
|
---|
40 | " ãè«æ±ãããï¼ä¸è¨è使¨©è
|
---|
41 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
42 | 責ãããã¨ï¼
|
---|
43 | "
|
---|
44 | " æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨è使¨©è
|
---|
45 | ãã
|
---|
46 | " ã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®çã«å¯¾ã
|
---|
47 | " ãé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨
|
---|
48 | " ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè²
|
---|
49 | " ããªãï¼
|
---|
50 | "
|
---|
51 | "
|
---|
52 | " Vim indent file
|
---|
53 | " Language: tf (Template File for TOPPERS)
|
---|
54 | " Maintainer: TAKUYA
|
---|
55 | " Last Change: 2011 June 28
|
---|
56 |
|
---|
57 | " Only load this indent file when no other was loaded.
|
---|
58 | if exists("b:did_indent")
|
---|
59 | finish
|
---|
60 | endif
|
---|
61 | let b:did_indent = 1
|
---|
62 |
|
---|
63 | setlocal indentexpr=GetTFIndent()
|
---|
64 | setlocal indentkeys-=0{,0} indentkeys-=0# indentkeys-=:
|
---|
65 | setlocal indentkeys+==\$ELSE\$,=\$ELIF\$,=\$END\$,0;
|
---|
66 |
|
---|
67 | " Only define the function once:
|
---|
68 | if exists("*GetTFIndent")
|
---|
69 | finish
|
---|
70 | endif
|
---|
71 |
|
---|
72 | " if the line is Comment line then return 1,
|
---|
73 | " otherwise, return 0.
|
---|
74 | function IsTFCommentLine(line)
|
---|
75 | if getline(a:line) =~ '^\$[ \t]'
|
---|
76 | return 1
|
---|
77 | else
|
---|
78 | return 0
|
---|
79 | endif
|
---|
80 |
|
---|
81 | endfunction
|
---|
82 |
|
---|
83 | " calculate indent
|
---|
84 | function GetTFIndent()
|
---|
85 | if IsTFCommentLine(v:lnum)
|
---|
86 | return 0
|
---|
87 | endif
|
---|
88 |
|
---|
89 | " Find a non-blank line above the current line:
|
---|
90 | let lnum = prevnonblank(v:lnum - 1)
|
---|
91 |
|
---|
92 | while IsTFCommentLine(lnum) == 1
|
---|
93 | if lnum == 0
|
---|
94 | return 0
|
---|
95 | endif
|
---|
96 | let lnum = prevnonblank(lnum - 1)
|
---|
97 | endwhile
|
---|
98 |
|
---|
99 | " No indent for the start of the file:
|
---|
100 | if lnum == 0
|
---|
101 | return 0
|
---|
102 | endif
|
---|
103 |
|
---|
104 | let ind = indent(lnum)
|
---|
105 | let line = getline(lnum)
|
---|
106 |
|
---|
107 | " No indentation if the previous line didn't end with "\":
|
---|
108 | " (Could be annoying, but it lets you know if you made a mistake.)
|
---|
109 | if line =~# '\$\(FOREACH\|JOINEACH\|IF\|ELIF\|FUNCTION\)[ ]'
|
---|
110 | if line !~# '\$END\$'
|
---|
111 | let ind = ind + &sw
|
---|
112 | endif
|
---|
113 | elseif line =~# '\$\(ERROR\|WORNING\)[ \$]'
|
---|
114 | if line !~# '\$END\$'
|
---|
115 | let ind = ind + &sw
|
---|
116 | endif
|
---|
117 | elseif line =~# '\$ELSE\$'
|
---|
118 | if line !~# '\$END\$'
|
---|
119 | let ind = ind + &sw
|
---|
120 | endif
|
---|
121 | endif
|
---|
122 |
|
---|
123 | let line = getline(v:lnum)
|
---|
124 |
|
---|
125 | if line =~# '\$\(ELSE\|END\)\$'
|
---|
126 | let ind = ind - &sw
|
---|
127 |
|
---|
128 | if line =~# '\$\(FOREACH\|JOINEACH\|IF\|FUNCTION\)[ ]'
|
---|
129 | let ind = ind + &sw
|
---|
130 | elseif line =~# '\$\(ERROR\|WORNING\)[ \$]'
|
---|
131 | let ind = ind + &sw
|
---|
132 | endif
|
---|
133 | elseif line =~# '\$ELIF[ ]'
|
---|
134 | let ind = ind - &sw
|
---|
135 |
|
---|
136 | if line =~# '\$\(FOREACH\|JOINEACH\|IF\|FUNCTION\)[ ]'
|
---|
137 | let ind = ind + &sw
|
---|
138 | elseif line =~# '\$\(ERROR\|WORNING\)[ \$]'
|
---|
139 | let ind = ind + &sw
|
---|
140 | endif
|
---|
141 | endif
|
---|
142 |
|
---|
143 | return ind
|
---|
144 |
|
---|
145 | endfunction
|
---|