rapid.in 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. ! vim: set ft=rapid :
  2. ! START_INDENT
  3. %%%
  4. VERSION:1
  5. LANGUAGE:ENGLISH
  6. %%%
  7. module LowerCaseModule
  8. task pers num n1 := 0;
  9. local pers num n2 := 1;
  10. var bool b1 := false;
  11. var intnum i1;
  12. ! put some stuff in those strings that may confuse indentation
  13. const string st1 := "endmodule (";
  14. pers string st_Appl_Info{3,3}:=[
  15. [
  16. "["
  17. ,
  18. "default"
  19. ,
  20. "case"
  21. ],
  22. [
  23. "else"
  24. ,
  25. "then"
  26. ,
  27. "endif"
  28. ],
  29. [
  30. "do"
  31. ,
  32. "}"
  33. ,
  34. ")"
  35. ],
  36. ];
  37. pers tooldata tTool1:=[TRUE,
  38. [
  39. [97.4, 0, 223.1],
  40. [0.924, 0, 0.383 ,0]
  41. ],
  42. [5,
  43. [23, 0, 75],
  44. [1, 0, 0, 0], 0, 0, 0
  45. ]
  46. ];
  47. const robtarget p1:=[
  48. [600, 500, 225.3],
  49. [1, 0, 0, 0],
  50. [1, 1, 0, 0],
  51. [ 11, 12.3, 9E9, 9E9, 9E9, 9E9]
  52. ];
  53. record myRec
  54. num nRecNum1
  55. bool bRecBool1
  56. endrecord
  57. proc proc1(num n1,
  58. num n2)
  59. var string st1;
  60. n1 := n1+1;
  61. MoveJSync p1, vmax, z30, tool1, "proc2";
  62. backward
  63. MoveJSync p1, v100, fine, tool1, "proc2";
  64. undo
  65. n1 := n1-1;
  66. error
  67. trynext;
  68. endproc
  69. func num nFunc1(
  70. switch s1
  71. |switch s2
  72. ,num n1
  73. ,bool b1)
  74. var num nVar;
  75. if not Present(s1) return;
  76. if Present(s1) then
  77. Incr n1;'
  78. elseif Present(s2) then
  79. b1:=false;
  80. else
  81. while n1>0 do
  82. Decr n1;
  83. test n1
  84. case 1:
  85. test1;
  86. case 2:
  87. test2;
  88. default:
  89. WaitUntil false;
  90. endtest
  91. endwhile
  92. endif
  93. for i from 1 to 10 step 2 do
  94. for j from 1 to 10 do
  95. st_Appl_Info{i,j} := "";
  96. endfor
  97. endfor
  98. ! return 1;
  99. return 0;
  100. error
  101. return -1;
  102. endfunc
  103. trap Trap1
  104. Reset do1;
  105. endtrap
  106. endmodule
  107. MODULE UpperCaseModule(SYSMODULE,NOSTEPIN)
  108. TASK pers num n1 := 0;
  109. LOCAL pers num n2 := 1;
  110. VAR bool b1 := false;
  111. VAR intnum i1;
  112. LOCAL FUNC num nFunc1(
  113. switch s1
  114. |switch s2
  115. ,num n1
  116. ,bool b1)
  117. VAR num nVar;
  118. IF NOT PRESENT(s1) RETURN;
  119. IF PRESENT(s1) THEN
  120. INCR n1;'
  121. ELSEIF PRESENT(s2) THEN
  122. b1:=FALSE;
  123. ELSE
  124. WHILE n1>0 DO
  125. DECR n1;
  126. TEST n1
  127. CASE 1:
  128. test1;
  129. CASE 2:
  130. test2;
  131. DEFAULT:
  132. WAITUNTIL FALSE;
  133. ENDTEST
  134. ENDWHILE
  135. ENDIF
  136. FOR i FROM 1 TO 10 STEP 2 DO
  137. FOR j FROM 1 TO 10 DO
  138. st_Appl_Info{i,j} := "";
  139. ENDFOR
  140. ENDFOR
  141. ! RETURN 1;
  142. RETURN 0;
  143. ERROR
  144. RETURN -1;
  145. ENDFUNC
  146. TRAP Trap1
  147. Reset do1;
  148. ENDTRAP
  149. ENDMODULE
  150. Module MixedCaseModule(SysModule)
  151. Task pers num n1 := 0;
  152. Local pers num n2 := 1;
  153. Var bool b1 := false;
  154. Var intnum i1;
  155. Task Func num nFunc1(
  156. switch s1
  157. |switch s2
  158. ,num n1
  159. ,bool b1)
  160. Var num nVar;
  161. If Not Present(s1) Return;
  162. If Present(s1) Then
  163. Incr n1;'
  164. ElseIf Present(s2) Then
  165. b1:=false;
  166. Else
  167. While n1>0 Do
  168. Decr n1;
  169. Test n1
  170. Case 1:
  171. test1;
  172. Case 2:
  173. test2;
  174. Default:
  175. WaitUntil false;
  176. EndTest
  177. EndWhile
  178. EndIf
  179. For i From 1 To 10 Step 2 Do
  180. For j From 1 To 10 Do
  181. st_Appl_Info{i,j} := "";
  182. EndFor
  183. EndFor
  184. ! Return 1;
  185. Return 0;
  186. Error
  187. Return -1;
  188. EndFunc
  189. Trap Trap1
  190. Reset do1;
  191. EndTrap
  192. EndModule
  193. ! END_INDENT
  194. ! START_INDENT
  195. ! INDENT_EXE let g:rapidSpaceIndent = 0
  196. ! INDENT_EXE set shiftwidth=4
  197. proc bla()
  198. var num i;
  199. Incr i;
  200. endproc
  201. ! END_INDENT
  202. ! START_INDENT
  203. ! INDENT_EXE let g:rapidCommentIndent = 1
  204. !
  205. proc bla()
  206. ! indent this first column comment because of g:rapidCommentIndent=1
  207. endproc
  208. ! END_INDENT
  209. ! START_INDENT
  210. ! INDENT_EXE let g:rapidNewStyleIndent = 1
  211. pers string st_Appl_Info{3,3}:=
  212. [
  213. [
  214. "["
  215. ,
  216. "default"
  217. ,
  218. "case"
  219. ]
  220. ,
  221. [
  222. "else"
  223. ,
  224. "then"
  225. ,
  226. "endif"
  227. ]
  228. ,
  229. [
  230. "do"
  231. ,
  232. "}"
  233. ,
  234. ")"
  235. ]
  236. ,
  237. ];
  238. ! END_INDENT