cmds.tin 6.7 KB

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