cmds.tin 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. #nop vim: set filetype=tt:;
  2. /*
  3. 本文件属于 PaoTin++ 的一部分。
  4. PaoTin++ © 2020~2022 的所有版权均由担子炮(dzp <danzipao@gmail.com>) 享有并保留一切法律权利
  5. 你可以在遵照 GPLv3 协议的基础之上使用、修改及重新分发本程序。
  6. */
  7. #alias {Tick} {xtt.Tick};
  8. #alias {xtt.Tick} {
  9. #local id {%1};
  10. #local code {%2};
  11. #local interval {%3};
  12. #line sub var #untick {$id};
  13. #line sub var #tick {$id} {$code} $interval;
  14. $code;
  15. };
  16. #alias {xtt.ListTicker} {
  17. #info tickers save;
  18. #echo {<128>%+20s %+20s %+20s} {定时器名称} {执行间隔} {距离下次执行(s)};
  19. #draw Yellow scroll line 1 1 1 62;
  20. #format utime %U;
  21. #local index {};
  22. #loop {1} {&info[TICKERS][]} {index} {
  23. #local uval {};
  24. #math uval $info[TICKERS][+$index][arg3] * 1000000;
  25. #echo {%+20s %+20s %+20m}
  26. {$info[TICKERS][+$index][arg1]}
  27. {$info[TICKERS][+$index][arg3]}
  28. {($uval - ($utime - $info[TICKERS][+$index][arg4]) % $uval) / 1000000.00};
  29. };
  30. };
  31. #alias {xtt.ListAlias} {
  32. #local pattern {%1};
  33. #info aliases save;
  34. #local aliasTable {};
  35. #local index {};
  36. #loop {1} {&info[ALIASES][]} {index} {
  37. #local name {$info[ALIASES][+$index][arg1]};
  38. #local class {$info[ALIASES][+$index][class]};
  39. #if { "$class" == "" && "$pattern" != "all" } {
  40. #continue;
  41. };
  42. #if { "$class" == "" } {
  43. #local class {未分组};
  44. };
  45. #if { "$name" == "%*{[^a-zA-Z0-9-_.]}%*" } {
  46. #continue;
  47. };
  48. #if { "$pattern" != "{|all}" && "$class/$name" != "%*$pattern%*" } {
  49. #continue;
  50. };
  51. #list {aliasTable[$class]} sort {$name};
  52. };
  53. #local format { %-20s %-30s %-10s};
  54. #echo {<128>$format} {class} {别名} {类型};
  55. #draw Yellow scroll line 1 1 1 80;
  56. #local classList {@sort{*aliasTable[]}};
  57. #local class {};
  58. #foreach {$classList} {class} {
  59. #local name {};
  60. #foreach {${aliasTable[$class][]}} {name} {
  61. #local type {<130>自定义<070>};
  62. #if { "$name" == "%*.{[A-Z][a-zA-Z0-9]+}" } {
  63. #local type {<120>开放API<070>};
  64. };
  65. #if { "$class" == "module-loader" } {
  66. #if { "$name" == "{[A-Z]+}" } {
  67. #local type {<160>快捷方式<070>};
  68. };
  69. #else {
  70. #local type {<020>语法增强<070>};
  71. }
  72. };
  73. #if { "${class}.$name" == "main.class.%*" } {
  74. #local type {<020>语法增强<070>};
  75. };
  76. #if { "${class}.$name" == "main.load-file" } {
  77. #local type {<020>语法增强<070>};
  78. };
  79. #if { "${class}.$name" == "main.%*Log" } {
  80. #local type {<120>日志接口<070>};
  81. };
  82. #if { "$pattern" == "" && "$type" == "%*自定义%*" } {
  83. #continue;
  84. };
  85. #echo {<060>$format}
  86. {$class}
  87. {$name}
  88. {$type};
  89. };
  90. };
  91. };
  92. #alias {xtt.ListVar} {
  93. #local pattern {%1};
  94. #info variable save;
  95. #local varTable {};
  96. #local index {};
  97. #loop {1} {&info[VARIABLES][]} {index} {
  98. #local name {$info[VARIABLES][+$index][arg1]};
  99. #local class {$info[VARIABLES][+$index][class]};
  100. #local value {$info[VARIABLES][+$index][arg2]};
  101. #local nest {$info[VARIABLES][+$index][nest]};
  102. #if { "$class" == "" && "$pattern" != "all" } {
  103. #continue;
  104. };
  105. #if { "$class" == "" } {
  106. #local class {未分组};
  107. };
  108. #if { "$pattern" != "{|all}" && "$class/$name" != "%*$pattern%*" } {
  109. #continue;
  110. };
  111. #local {varTable[$class][$name]} {
  112. {nest}{$nest}
  113. {value}{$value}
  114. };
  115. };
  116. #local format { %-20s %-30s %-10s %s};
  117. #echo {<128>$format} {class} {变量} {类型} {值};
  118. #draw Yellow scroll line 1 1 1 80;
  119. #local classList {@sort{*varTable[]}};
  120. #local class {};
  121. #foreach {$classList} {class} {
  122. #local name {};
  123. #local nameList {@sort{*varTable[$class][]}};
  124. #foreach {$nameList} {name} {
  125. #local type {<020>字符串<070>};
  126. #local value {<160>$varTable[$class][$name][value]<070>};
  127. #local nest {$varTable[$class][$name][nest]};
  128. #if { $nest > 0 } {
  129. #local type {<050>表格<070>};
  130. #local value {<130>[... 共 $nest 项数据]<070>};
  131. };
  132. #echo {<060>$format}
  133. {$class}
  134. {$name}
  135. {$type}
  136. {$value};
  137. };
  138. };
  139. };
  140. #alias {xtt.ListFunc} {
  141. #local pattern {%1};
  142. #info functions save;
  143. #local funcsTable {};
  144. #local index {};
  145. #loop {1} {&info[FUNCTIONS][]} {index} {
  146. #local name {$info[FUNCTIONS][+$index][arg1]};
  147. #local class {$info[FUNCTIONS][+$index][class]};
  148. #if { "$class" == "" && "$pattern" != "all" } {
  149. #continue;
  150. };
  151. #if { "$class" == "" } {
  152. #local class {未分组};
  153. };
  154. #if { "$name" == "%*{[^a-zA-Z0-9_./-]}%*" } {
  155. #continue;
  156. };
  157. #if { "$pattern" != "{|all}" && "$class/$name" != "%*$pattern%*" } {
  158. #continue;
  159. };
  160. #list {funcsTable[$class]} sort {$name};
  161. };
  162. #local format { %-20s %-30s %-10s};
  163. #echo {<128>$format} {class} {函数} {类型};
  164. #draw Yellow scroll line 1 1 1 80;
  165. #local classList {@sort{*funcsTable[]}};
  166. #local class {};
  167. #foreach {$classList} {class} {
  168. #local name {};
  169. #foreach {${funcsTable[$class][]}} {name} {
  170. #local type {<130>自定义<070>};
  171. #if { "$name" == "%*.{[A-Z][a-zA-Z0-9]+}" } {
  172. #local type {<120>开放API<070>};
  173. };
  174. #if { "$class" == "{lib/xtintin|main}" } {
  175. #local type {<020>语法增强<070>};
  176. };
  177. #if { "${class}.$name" == "main.%*Log" } {
  178. #local type {<120>日志接口<070>};
  179. };
  180. #if { "$pattern" == "" && "$type" == "%*自定义%*" } {
  181. #continue;
  182. };
  183. #echo {<060>$format}
  184. {$class}
  185. {$name}
  186. {$type};
  187. };
  188. };
  189. };
  190. #alias {xtt.Send} {
  191. #if { "$xttOptions[DisableOutput]" == "true" } {
  192. #echo {<160>命令已被抑制: <420>%p<070>} {%0};
  193. #return;
  194. };
  195. #send %0
  196. };
  197. #alias {xtt.SendAtOnce} {
  198. #local cmds {%1};
  199. #send {#$cmds#};
  200. };