@lpc-lang/core 1.1.2-5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/README.md +255 -0
  2. package/bin/lpc +4 -0
  3. package/bin/lpcserver +4 -0
  4. package/cancellationToken/cancellationToken.d.ts +8 -0
  5. package/cancellationToken/cancellationToken.d.ts.map +1 -0
  6. package/cancellationToken/serverCancellationToken.d.ts +21 -0
  7. package/cancellationToken/serverCancellationToken.d.ts.map +1 -0
  8. package/cli/_namespaces/lpc.d.ts +2 -0
  9. package/cli/_namespaces/lpc.d.ts.map +1 -0
  10. package/cli/lpc.d.ts +2 -0
  11. package/cli/lpc.d.ts.map +1 -0
  12. package/compiler/LpcConfig.d.ts +17 -0
  13. package/compiler/LpcConfig.d.ts.map +1 -0
  14. package/compiler/_namespaces/lpc.d.ts +49 -0
  15. package/compiler/_namespaces/lpc.d.ts.map +1 -0
  16. package/compiler/_namespaces/lpc.moduleSpecifiers.d.ts +2 -0
  17. package/compiler/_namespaces/lpc.moduleSpecifiers.d.ts.map +1 -0
  18. package/compiler/_namespaces/lpc.performance.d.ts +2 -0
  19. package/compiler/_namespaces/lpc.performance.d.ts.map +1 -0
  20. package/compiler/binder.d.ts +2 -0
  21. package/compiler/binder.d.ts.map +1 -0
  22. package/compiler/builderPublic.d.ts +76 -0
  23. package/compiler/builderPublic.d.ts.map +1 -0
  24. package/compiler/checker.d.ts +2 -0
  25. package/compiler/checker.d.ts.map +1 -0
  26. package/compiler/commandLineParser.d.ts +47 -0
  27. package/compiler/commandLineParser.d.ts.map +1 -0
  28. package/compiler/core.d.ts +3 -0
  29. package/compiler/core.d.ts.map +1 -0
  30. package/compiler/corePublic.d.ts +19 -0
  31. package/compiler/corePublic.d.ts.map +1 -0
  32. package/compiler/debug.d.ts +71 -0
  33. package/compiler/debug.d.ts.map +1 -0
  34. package/compiler/diagnosticInformation.d.ts +518 -0
  35. package/compiler/diagnosticInformation.d.ts.map +1 -0
  36. package/compiler/emitter.d.ts +11 -0
  37. package/compiler/emitter.d.ts.map +1 -0
  38. package/compiler/executeCommandLine.d.ts +15 -0
  39. package/compiler/executeCommandLine.d.ts.map +1 -0
  40. package/compiler/expressionToTypeNode.d.ts +2 -0
  41. package/compiler/expressionToTypeNode.d.ts.map +1 -0
  42. package/compiler/factory/baseNodeFactory.d.ts +2 -0
  43. package/compiler/factory/baseNodeFactory.d.ts.map +1 -0
  44. package/compiler/factory/emitHelper.d.ts +2 -0
  45. package/compiler/factory/emitHelper.d.ts.map +1 -0
  46. package/compiler/factory/emitNode.d.ts +22 -0
  47. package/compiler/factory/emitNode.d.ts.map +1 -0
  48. package/compiler/factory/nodeChildren.d.ts +2 -0
  49. package/compiler/factory/nodeChildren.d.ts.map +1 -0
  50. package/compiler/factory/nodeConverters.d.ts +2 -0
  51. package/compiler/factory/nodeConverters.d.ts.map +1 -0
  52. package/compiler/factory/nodeFactory.d.ts +4 -0
  53. package/compiler/factory/nodeFactory.d.ts.map +1 -0
  54. package/compiler/factory/parenthesizerRules.d.ts +2 -0
  55. package/compiler/factory/parenthesizerRules.d.ts.map +1 -0
  56. package/compiler/factory/utilities.d.ts +2 -0
  57. package/compiler/factory/utilities.d.ts.map +1 -0
  58. package/compiler/factory/utilitiesPublic.d.ts +4 -0
  59. package/compiler/factory/utilitiesPublic.d.ts.map +1 -0
  60. package/compiler/lpcFileHandler.d.ts +10 -0
  61. package/compiler/lpcFileHandler.d.ts.map +1 -0
  62. package/compiler/lpcJsHelpers.d.ts +17 -0
  63. package/compiler/lpcJsHelpers.d.ts.map +1 -0
  64. package/compiler/lpcbuild.d.ts +2 -0
  65. package/compiler/lpcbuild.d.ts.map +1 -0
  66. package/compiler/lpcbuildPublic.d.ts +26 -0
  67. package/compiler/lpcbuildPublic.d.ts.map +1 -0
  68. package/compiler/moduleNameResolver.d.ts +55 -0
  69. package/compiler/moduleNameResolver.d.ts.map +1 -0
  70. package/compiler/moduleSpecifiers.d.ts +2 -0
  71. package/compiler/moduleSpecifiers.d.ts.map +1 -0
  72. package/compiler/nodeTests.d.ts +115 -0
  73. package/compiler/nodeTests.d.ts.map +1 -0
  74. package/compiler/parser.d.ts +65 -0
  75. package/compiler/parser.d.ts.map +1 -0
  76. package/compiler/path.d.ts +2 -0
  77. package/compiler/path.d.ts.map +1 -0
  78. package/compiler/perfLoger.d.ts +2 -0
  79. package/compiler/perfLoger.d.ts.map +1 -0
  80. package/compiler/performance.d.ts +2 -0
  81. package/compiler/performance.d.ts.map +1 -0
  82. package/compiler/performanceCore.d.ts +2 -0
  83. package/compiler/performanceCore.d.ts.map +1 -0
  84. package/compiler/program.d.ts +72 -0
  85. package/compiler/program.d.ts.map +1 -0
  86. package/compiler/resolutionCache.d.ts +6 -0
  87. package/compiler/resolutionCache.d.ts.map +1 -0
  88. package/compiler/resolver.d.ts +1 -0
  89. package/compiler/resolver.d.ts.map +1 -0
  90. package/compiler/scanner.d.ts +85 -0
  91. package/compiler/scanner.d.ts.map +1 -0
  92. package/compiler/sourcemap.d.ts +2 -0
  93. package/compiler/sourcemap.d.ts.map +1 -0
  94. package/compiler/sys.d.ts +56 -0
  95. package/compiler/sys.d.ts.map +1 -0
  96. package/compiler/tracing.d.ts +31 -0
  97. package/compiler/tracing.d.ts.map +1 -0
  98. package/compiler/transformers/declarations.d.ts +2 -0
  99. package/compiler/transformers/declarations.d.ts.map +1 -0
  100. package/compiler/transformers.d.ts +2 -0
  101. package/compiler/transformers.d.ts.map +1 -0
  102. package/compiler/types.d.ts +3284 -0
  103. package/compiler/types.d.ts.map +1 -0
  104. package/compiler/utilities.d.ts +57 -0
  105. package/compiler/utilities.d.ts.map +1 -0
  106. package/compiler/utilitiesPublic.d.ts +213 -0
  107. package/compiler/utilitiesPublic.d.ts.map +1 -0
  108. package/compiler/visitorPublic.d.ts +72 -0
  109. package/compiler/visitorPublic.d.ts.map +1 -0
  110. package/compiler/watch.d.ts +2 -0
  111. package/compiler/watch.d.ts.map +1 -0
  112. package/compiler/watchPublic.d.ts +44 -0
  113. package/compiler/watchPublic.d.ts.map +1 -0
  114. package/compiler/watchUtilities.d.ts +14 -0
  115. package/compiler/watchUtilities.d.ts.map +1 -0
  116. package/config-types.d.ts +33 -0
  117. package/config-types.d.ts.map +1 -0
  118. package/harness/harnessIO.d.ts +4 -0
  119. package/harness/harnessIO.d.ts.map +1 -0
  120. package/lpc/_namespaces/lpc.d.ts +6 -0
  121. package/lpc/_namespaces/lpc.d.ts.map +1 -0
  122. package/lpc/_namespaces/lpc.server.d.ts +2 -0
  123. package/lpc/_namespaces/lpc.server.d.ts.map +1 -0
  124. package/lpc/lpc.d.ts +2 -0
  125. package/lpc/lpc.d.ts.map +1 -0
  126. package/lpcserver/document.d.ts +1 -0
  127. package/lpcserver/document.d.ts.map +1 -0
  128. package/lpcserver/nodeServer.d.ts +25 -0
  129. package/lpcserver/nodeServer.d.ts.map +1 -0
  130. package/lpcserver/protocol.const.d.ts +46 -0
  131. package/lpcserver/protocol.const.d.ts.map +1 -0
  132. package/lpcserver/server.d.ts +3 -0
  133. package/lpcserver/server.d.ts.map +1 -0
  134. package/lpcserver/textRendering.d.ts +14 -0
  135. package/lpcserver/textRendering.d.ts.map +1 -0
  136. package/lpcserver/typeConverters.d.ts +44 -0
  137. package/lpcserver/typeConverters.d.ts.map +1 -0
  138. package/lpcserver/utils.d.ts +14 -0
  139. package/lpcserver/utils.d.ts.map +1 -0
  140. package/package.json +48 -0
  141. package/parse-fluff-docs.d.ts +2 -0
  142. package/parse-fluff-docs.d.ts.map +1 -0
  143. package/parse-ld-docs.d.ts +2 -0
  144. package/parse-ld-docs.d.ts.map +1 -0
  145. package/server/_namespaces/lpc.d.ts +5 -0
  146. package/server/_namespaces/lpc.d.ts.map +1 -0
  147. package/server/_namespaces/lpc.server.d.ts +11 -0
  148. package/server/_namespaces/lpc.server.d.ts.map +1 -0
  149. package/server/_namespaces/lpc.server.protocol.d.ts +2 -0
  150. package/server/_namespaces/lpc.server.protocol.d.ts.map +1 -0
  151. package/server/editorServices.d.ts +261 -0
  152. package/server/editorServices.d.ts.map +1 -0
  153. package/server/project.d.ts +143 -0
  154. package/server/project.d.ts.map +1 -0
  155. package/server/protocol.d.ts +962 -0
  156. package/server/protocol.d.ts.map +1 -0
  157. package/server/scriptInfo.d.ts +53 -0
  158. package/server/scriptInfo.d.ts.map +1 -0
  159. package/server/scriptVersionCache.d.ts +2 -0
  160. package/server/scriptVersionCache.d.ts.map +1 -0
  161. package/server/session.d.ts +150 -0
  162. package/server/session.d.ts.map +1 -0
  163. package/server/types.d.ts +24 -0
  164. package/server/types.d.ts.map +1 -0
  165. package/server/utilities.d.ts +2 -0
  166. package/server/utilities.d.ts.map +1 -0
  167. package/server/utilitiesPublic.d.ts +37 -0
  168. package/server/utilitiesPublic.d.ts.map +1 -0
  169. package/server.d.ts +2 -0
  170. package/server.d.ts.map +1 -0
  171. package/services/_namespaces/lpc.Completions.StringCompletions.d.ts +2 -0
  172. package/services/_namespaces/lpc.Completions.StringCompletions.d.ts.map +1 -0
  173. package/services/_namespaces/lpc.Completions.d.ts +4 -0
  174. package/services/_namespaces/lpc.Completions.d.ts.map +1 -0
  175. package/services/_namespaces/lpc.FindAllReferences.d.ts +3 -0
  176. package/services/_namespaces/lpc.FindAllReferences.d.ts.map +1 -0
  177. package/services/_namespaces/lpc.GoToDefinition.d.ts +2 -0
  178. package/services/_namespaces/lpc.GoToDefinition.d.ts.map +1 -0
  179. package/services/_namespaces/lpc.JsDoc.d.ts +2 -0
  180. package/services/_namespaces/lpc.JsDoc.d.ts.map +1 -0
  181. package/services/_namespaces/lpc.NavigationBar.d.ts +2 -0
  182. package/services/_namespaces/lpc.NavigationBar.d.ts.map +1 -0
  183. package/services/_namespaces/lpc.Rename.d.ts +2 -0
  184. package/services/_namespaces/lpc.Rename.d.ts.map +1 -0
  185. package/services/_namespaces/lpc.SignatureHelp.d.ts +2 -0
  186. package/services/_namespaces/lpc.SignatureHelp.d.ts.map +1 -0
  187. package/services/_namespaces/lpc.SymbolDisplay.d.ts +2 -0
  188. package/services/_namespaces/lpc.SymbolDisplay.d.ts.map +1 -0
  189. package/services/_namespaces/lpc.codefix.d.ts +3 -0
  190. package/services/_namespaces/lpc.codefix.d.ts.map +1 -0
  191. package/services/_namespaces/lpc.d.ts +30 -0
  192. package/services/_namespaces/lpc.d.ts.map +1 -0
  193. package/services/_namespaces/lpc.formatting.d.ts +7 -0
  194. package/services/_namespaces/lpc.formatting.d.ts.map +1 -0
  195. package/services/_namespaces/lpc.textChanges.d.ts +2 -0
  196. package/services/_namespaces/lpc.textChanges.d.ts.map +1 -0
  197. package/services/classifier2020.d.ts +2 -0
  198. package/services/classifier2020.d.ts.map +1 -0
  199. package/services/codefixes/helpers.d.ts +2 -0
  200. package/services/codefixes/helpers.d.ts.map +1 -0
  201. package/services/codefixes/importFixes.d.ts +2 -0
  202. package/services/codefixes/importFixes.d.ts.map +1 -0
  203. package/services/completions.d.ts +2 -0
  204. package/services/completions.d.ts.map +1 -0
  205. package/services/documentRegistry.d.ts +90 -0
  206. package/services/documentRegistry.d.ts.map +1 -0
  207. package/services/exportInfoMap.d.ts +5 -0
  208. package/services/exportInfoMap.d.ts.map +1 -0
  209. package/services/findAllReferences.d.ts +2 -0
  210. package/services/findAllReferences.d.ts.map +1 -0
  211. package/services/formatting/formatting.d.ts +2 -0
  212. package/services/formatting/formatting.d.ts.map +1 -0
  213. package/services/formatting/formattingContext.d.ts +2 -0
  214. package/services/formatting/formattingContext.d.ts.map +1 -0
  215. package/services/formatting/rule.d.ts +2 -0
  216. package/services/formatting/rule.d.ts.map +1 -0
  217. package/services/formatting/rules.d.ts +2 -0
  218. package/services/formatting/rules.d.ts.map +1 -0
  219. package/services/formatting/rulesMap.d.ts +2 -0
  220. package/services/formatting/rulesMap.d.ts.map +1 -0
  221. package/services/formatting/smartIndenter.d.ts +2 -0
  222. package/services/formatting/smartIndenter.d.ts.map +1 -0
  223. package/services/goToDefinition.d.ts +2 -0
  224. package/services/goToDefinition.d.ts.map +1 -0
  225. package/services/importTracker.d.ts +2 -0
  226. package/services/importTracker.d.ts.map +1 -0
  227. package/services/jsDoc.d.ts +2 -0
  228. package/services/jsDoc.d.ts.map +1 -0
  229. package/services/navigationBar.d.ts +2 -0
  230. package/services/navigationBar.d.ts.map +1 -0
  231. package/services/rename.d.ts +2 -0
  232. package/services/rename.d.ts.map +1 -0
  233. package/services/services.d.ts +54 -0
  234. package/services/services.d.ts.map +1 -0
  235. package/services/signatureHelp.d.ts +2 -0
  236. package/services/signatureHelp.d.ts.map +1 -0
  237. package/services/sourcemaps.d.ts +2 -0
  238. package/services/sourcemaps.d.ts.map +1 -0
  239. package/services/stringCompletions.d.ts +2 -0
  240. package/services/stringCompletions.d.ts.map +1 -0
  241. package/services/suggestionDiagnostics.d.ts +2 -0
  242. package/services/suggestionDiagnostics.d.ts.map +1 -0
  243. package/services/symbolDisplay.d.ts +2 -0
  244. package/services/symbolDisplay.d.ts.map +1 -0
  245. package/services/textChanges.d.ts +2 -0
  246. package/services/textChanges.d.ts.map +1 -0
  247. package/services/types.d.ts +901 -0
  248. package/services/types.d.ts.map +1 -0
  249. package/services/utilities.d.ts +3 -0
  250. package/services/utilities.d.ts.map +1 -0
  251. package/src/cli.js +58 -0
  252. package/src/cli.js.map +7 -0
  253. package/src/efuns/fluffos/arrays.h +205 -0
  254. package/src/efuns/fluffos/async.h +84 -0
  255. package/src/efuns/fluffos/buffers.h +80 -0
  256. package/src/efuns/fluffos/calls.h +275 -0
  257. package/src/efuns/fluffos/contrib.h +805 -0
  258. package/src/efuns/fluffos/db.h +125 -0
  259. package/src/efuns/fluffos/driver.h +107 -0
  260. package/src/efuns/fluffos/ed.h +48 -0
  261. package/src/efuns/fluffos/efuns.fluffos.h +75 -0
  262. package/src/efuns/fluffos/external.h +30 -0
  263. package/src/efuns/fluffos/filesystem.h +154 -0
  264. package/src/efuns/fluffos/floats.h +136 -0
  265. package/src/efuns/fluffos/functions.h +104 -0
  266. package/src/efuns/fluffos/general.h +548 -0
  267. package/src/efuns/fluffos/interactive.h +777 -0
  268. package/src/efuns/fluffos/internals.h +455 -0
  269. package/src/efuns/fluffos/lpc-config.json +10 -0
  270. package/src/efuns/fluffos/mappings.h +205 -0
  271. package/src/efuns/fluffos/misc.h +43 -0
  272. package/src/efuns/fluffos/mudlib.h +228 -0
  273. package/src/efuns/fluffos/numbers.h +41 -0
  274. package/src/efuns/fluffos/objects.h +365 -0
  275. package/src/efuns/fluffos/parsing.h +220 -0
  276. package/src/efuns/fluffos/pcre.h +75 -0
  277. package/src/efuns/fluffos/sockets.h +276 -0
  278. package/src/efuns/fluffos/strings.h +542 -0
  279. package/src/efuns/fluffos/system.h +408 -0
  280. package/src/efuns/fluffos/zh-cn/arrays.zh-cn.h +167 -0
  281. package/src/efuns/fluffos/zh-cn/async.zh-cn.h +81 -0
  282. package/src/efuns/fluffos/zh-cn/buffers.zh-cn.h +69 -0
  283. package/src/efuns/fluffos/zh-cn/calls.zh-cn.h +242 -0
  284. package/src/efuns/fluffos/zh-cn/contrib.zh-cn.h +767 -0
  285. package/src/efuns/fluffos/zh-cn/db.zh-cn.h +113 -0
  286. package/src/efuns/fluffos/zh-cn/ed.zh-cn.h +42 -0
  287. package/src/efuns/fluffos/zh-cn/efuns.fluffos.h +76 -0
  288. package/src/efuns/fluffos/zh-cn/external.zh-cn.h +25 -0
  289. package/src/efuns/fluffos/zh-cn/filesystem.zh-cn.h +140 -0
  290. package/src/efuns/fluffos/zh-cn/floats.zh-cn.h +129 -0
  291. package/src/efuns/fluffos/zh-cn/functions.zh-cn.h +87 -0
  292. package/src/efuns/fluffos/zh-cn/general.zh-cn.h +506 -0
  293. package/src/efuns/fluffos/zh-cn/interactive.zh-cn.h +659 -0
  294. package/src/efuns/fluffos/zh-cn/internals.zh-cn.h +356 -0
  295. package/src/efuns/fluffos/zh-cn/mappings.zh-cn.h +188 -0
  296. package/src/efuns/fluffos/zh-cn/misc.zh-cn.h +43 -0
  297. package/src/efuns/fluffos/zh-cn/mudlib.zh-cn.h +190 -0
  298. package/src/efuns/fluffos/zh-cn/numbers.zh-cn.h +36 -0
  299. package/src/efuns/fluffos/zh-cn/objects.zh-cn.h +280 -0
  300. package/src/efuns/fluffos/zh-cn/parsing.zh-cn.h +212 -0
  301. package/src/efuns/fluffos/zh-cn/pcre.zh-cn.h +67 -0
  302. package/src/efuns/fluffos/zh-cn/sockets.zh-cn.h +230 -0
  303. package/src/efuns/fluffos/zh-cn/strings.zh-cn.h +484 -0
  304. package/src/efuns/fluffos/zh-cn/system.zh-cn.h +366 -0
  305. package/src/efuns/ldmud/defines.h +69 -0
  306. package/src/efuns/ldmud/efun.h +10449 -0
  307. package/src/efuns/ldmud/efuns.ldmud.h +87 -0
  308. package/src/efuns/ldmud/lpc-config.json +9 -0
  309. package/src/efuns/ldmud/obsolete.h +2168 -0
  310. package/src/lpc.js +82486 -0
  311. package/src/lpc.js.map +6 -0
  312. package/src/server.js +129 -0
  313. package/src/server.js.map +7 -0
  314. package/types.d.ts +23 -0
  315. package/types.d.ts.map +1 -0
  316. package/utils.d.ts +21 -0
  317. package/utils.d.ts.map +1 -0
@@ -0,0 +1,220 @@
1
+ // parsing.h
2
+
3
+ /**
4
+ * query_verb() - return the name of the command currently being executed
5
+ *
6
+ * Give the name of the current command, or 0 if not executing from a com‐
7
+ * mand. This function is useful when several commands (verbs) may cause
8
+ * the same function to execute and it is necessary to determine which
9
+ * verb it was that invoked the function.
10
+ *
11
+ */
12
+ string query_verb( void );
13
+
14
+ /**
15
+ * process_value() - give a value from a described function call
16
+ *
17
+ * Get the replacement of one syntactic pattern. The pattern is on the
18
+ * form:
19
+ *
20
+ * "function[:filename][|arg1|arg2....|argN]"
21
+ *
22
+ * The returned value can be of any type.
23
+ *
24
+ * Note that both object and arguments are marked optional with the brack‐
25
+ * ets and that the brackets are not included in the actual pattern.
26
+ *
27
+ */
28
+ mixed process_value( string calldescription );
29
+
30
+ /**
31
+ * process_string() - give a string with replaced calldescriptions
32
+ *
33
+ * Processes a string by replacing specific syntactic patterns with what
34
+ * is returned when the pattern is interpreted as a function call descrip‐
35
+ * tion.
36
+ *
37
+ * The syntactic patterns are on the form:
38
+ *
39
+ * "@@function[:filename][|arg1|arg2....|argN]@@"
40
+ *
41
+ * This is interpreted as a call:
42
+ *
43
+ * filename->function(arg1, arg2, ....., argN)
44
+ *
45
+ * Note that process_string does not recurse over returned replacement
46
+ * values. If a function returns another syntactic pattern, that descrip‐
47
+ * tion will not be replaced.
48
+ *
49
+ * All such occurrences in 'combinestring' is processed and replaced if
50
+ * the return value is a string. If the return value is not a string the
51
+ * pattern will remain unreplaced.
52
+ *
53
+ * Note that both object and arguments are marked optional with the brack‐
54
+ * ets and that the brackets are not included in the actual pattern.
55
+ *
56
+ * A string:
57
+ * "You are chased by @@query_the_name:/obj/monster#123@@ eastward."
58
+ *
59
+ * is replaced by:
60
+ * "You are chased by the orc eastward."
61
+ *
62
+ * Assuming that query_the_name in monster#123 returns "the orc".
63
+ *
64
+ */
65
+ string process_string( string combinestring );
66
+
67
+ /**
68
+ * parse_sentence() - parse the command contained in the given string
69
+ *
70
+ * This efun calls the driver parser and tells it to parse and execute the
71
+ * command contained in the given string. The efun may return an integer
72
+ * error code, or a string error message. If a string message is returned,
73
+ * it should be displayed to the player. The integer codes are:
74
+ *
75
+ * * 1: command has been processed ok
76
+ * * 0: no matching command was found, no processing done
77
+ * * -1: A matching command was found but none of its rules were matched.
78
+ * * -2: A rule made sense but all "can" or "direct" applies returned 0.
79
+ *
80
+ */
81
+ mixed parse_sentence(string, void | int, void | object *, void | mapping);
82
+
83
+ /**
84
+ * parse_refresh()
85
+ *
86
+ * The parsing package caches information about objects in order to improve
87
+ * performance. This means that if any information that gets cached is
88
+ * changed, you need to tell MudOS to clear the cache. That's what this efun
89
+ * does. If the information returned by any of the applies below changes, you
90
+ * need to call parse_refresh() so that the parser knows it has changed. For
91
+ * example if the name of an object changes, or perhaps an adjective changes
92
+ * as a spell is cast to change it from blue to red - call parse_refresh()
93
+ * afterwards. The efun clears the cache for the object that called it.
94
+ *
95
+ */
96
+ void parse_refresh();
97
+
98
+ /**
99
+ * parse_init()
100
+ *
101
+ * The efun parse_init() is used to tell MudOS that this object is one
102
+ * that may use or be used by the parsing package. If your object does
103
+ * not call this then trying to use other parsing efuns will generate a
104
+ * runtime error and the parser will ignore the object when searching
105
+ * for matches. Suggest call parse_init() from create() in the standard
106
+ * object.
107
+ *
108
+ */
109
+ void parse_init();
110
+
111
+ /**
112
+ * parse_command() - try to match a string with a given pattern
113
+ *
114
+ * parse_command() is a piffed up sscanf(3) operating on word basis. It
115
+ * works similar to sscanf(3) in that it takes a pattern and a variable
116
+ * set of destination arguments. It is together with sscanf(3) the only
117
+ * efun to use pass by reference for other variables than arrays. That
118
+ * is, parse_command() returns values in its arguments.
119
+ *
120
+ * parse_command() returns 1 if 'command' is considered to have matched
121
+ * 'pattern'.
122
+ *
123
+ * The 'env' or 'oblist' parameter either holds an object or a list of
124
+ * objects. If it holds a single object than a list of objects are auto‐
125
+ * matically created by adding the deep_inventory of the object, ie this
126
+ * is identical:
127
+ *
128
+ * parse_command(cmd, environment(), pattern, arg)
129
+ *
130
+ * and
131
+ *
132
+ * parse_command( cmd, ({ environment() }) +
133
+ * deep_inventory(environment()), pattern, arg)
134
+ *
135
+ * 'pattern' is a list of words and formats:
136
+ *
137
+ * Example string = " 'get' / 'take' %i "
138
+ * Syntax:
139
+ * 'word' obligatory text
140
+ * [word] optional text
141
+ * / Alternative marker
142
+ * %o Single item, object
143
+ * %l Living objects
144
+ * %s Any text
145
+ * %w Any word
146
+ * %p One of a list (prepositions)
147
+ * %i Any items
148
+ * %d Number 0- or tx(0-99)
149
+ *
150
+ * The 'arg' list is zero or more arguments. These are the result vari‐
151
+ * ables as in sscanf. Note that one variable is needed for each %_
152
+ *
153
+ * The return types of different %_ is:
154
+ * %o Returns an object
155
+ * %s Returns a string of words
156
+ * %w Returns a string of one word
157
+ * %p Can on entry hold a list of word in array
158
+ * or an empty variable
159
+ * Returns:
160
+ * if empty variable: a string
161
+ * if array: array[0] = matched word
162
+ * %i Returns a special array on the form:
163
+ * [0] = (int) +(wanted) -(order) 0(all)
164
+ * [1..n] (object) Objectpointers
165
+ * %l Returns a special array on the form:
166
+ * [0] = (int) +(wanted) -(order) 0(all)
167
+ * [1..n] (object) Objectpointers
168
+ * These are only living objects.
169
+ * %d Returns a number
170
+ *
171
+ * The only types of % that uses all the loaded information from the
172
+ * objects are %i and %l. These are in fact identical except that %l fil‐
173
+ * ters out all nonliving objects from the list of objects before trying
174
+ * to parse.
175
+ *
176
+ * The return values of %i and %l is also the most complex. They return an
177
+ * array consisting of first a number and then all possible objects match‐
178
+ * ing. As the typical string matched by %i/%l looks like: 'three red
179
+ * roses', 'all nasty bugs' or 'second blue sword' the number indicates
180
+ * which of these numerical constructs was matched:
181
+ *
182
+ * if numeral >0 then three, four, five etc were matched
183
+ * if numeral <0 then second, twentyfirst etc were matched
184
+ * if numeral==0 then 'all' or a generic plural form such as
185
+ * 'apples' were matched.
186
+ *
187
+ * if (parse_command("spray car",environment(this_player()),
188
+ * " 'spray' / 'paint' [paint] %i ",items))
189
+ * {
190
+ * /*
191
+ * If the pattern matched then items holds a return array as
192
+ * described under 'destargs' %i above.
193
+ * *\/
194
+ * }
195
+ *
196
+ */
197
+ int parse_command( string command, object|object* env,
198
+ string pattern, mixed arg... );
199
+
200
+ /**
201
+ * parse_add_rule() - add parsing rules for a verb
202
+ *
203
+ * Here "verb" is the command word (e.g. "look", "read" etc), The "rule" is
204
+ * the parsing rule to add. Rules are made up from two parts - tokens, and
205
+ * prepositions. Tokens are used to match various objects or strings, and
206
+ * prepositions are fixed positional words to specify meaning (like "with"
207
+ * or "in").
208
+ *
209
+ * The MudOS accepts six tokens that I'm aware of:
210
+ *
211
+ * OBJ - matches a single object
212
+ * OBS - matches one or more objects
213
+ * LIV - matches a single, living object
214
+ * LVS - matches one or more living objects
215
+ * WRD - matches a single word
216
+ * STR - matches one or more words
217
+ *
218
+ */
219
+ void parse_add_rule(string verb, string rule);
220
+
@@ -0,0 +1,75 @@
1
+ // pcre.h
2
+
3
+ /**
4
+ * pcre_version() - returns the version of the compiled PCRE library used
5
+ *
6
+ * returns the version of the compiled PCRE library used
7
+ *
8
+ */
9
+ string pcre_version(void);
10
+
11
+ /**
12
+ * pcre_replace_callback() - string replace uses a callback to get the replace string
13
+ *
14
+ * returns a string where all captured groups have been replaced by the return
15
+ * value of function pointer fun or function fun in object ob. (called with the
16
+ * matched string and match number, starting with 0)
17
+ *
18
+ */
19
+ string pcre_replace_callback(string input, string pattern, string|function, mixed *args...);
20
+
21
+ /**
22
+ * pcre_replace()
23
+ *
24
+ * returns a string where all captured groups have been replaced by the
25
+ * elements of the replacement array. Number of subgroups and the size of the
26
+ * replacement array must match.
27
+ *
28
+ */
29
+ string pcre_replace(string input, string pattern, string *replacments);
30
+
31
+ /**
32
+ * pcre_match_all() - find all matches
33
+ *
34
+ * Similiar to php preg_match_all, this EFUN returns a array of string arrays,
35
+ * containing all matches and captured groups.
36
+ *
37
+ */
38
+ mixed pcre_match_all(string input, string pattern);
39
+
40
+ /**
41
+ * pcre_match() - regular expression handler
42
+ *
43
+ * analog with regexp efun for backwards compatibility reasons but utilizing
44
+ * the PCRE library.
45
+ *
46
+ */
47
+ mixed pcre_match(string|string *lines, string pattern, void|int flag);
48
+
49
+ /**
50
+ * pcre_extract() - extract matching parts
51
+ *
52
+ * returns an array of captured groups specified in pattern.
53
+ *
54
+ */
55
+ string *pcre_extract(string input, string pattern);
56
+
57
+ /**
58
+ * pcre_cache() - return content of the pcre cache
59
+ *
60
+ * returns content of the pcre cache (not all that useful).
61
+ *
62
+ */
63
+ mapping pcre_cache(void);
64
+
65
+ /**
66
+ * pcre_assoc() - A regular pattern substring extractor
67
+ *
68
+ * analog with reg_assoc efun for backwards compatibility reasons but utilizing
69
+ * the PCRE library.
70
+ *
71
+ */
72
+ varargs mixed *pcre_assoc(string input, string *patterns,
73
+ mixed *token_aray,
74
+ mixed default_value);
75
+
@@ -0,0 +1,276 @@
1
+ // sockets.h
2
+
3
+ /**
4
+ * socket_write() - send a message from a socket
5
+ *
6
+ * socket_write() sends a message on a socket s. If the socket s is of
7
+ * type STREAM or MUD, the socket must already be connected and the
8
+ * address is not specified. If the socket is of type DATAGRAM, the
9
+ * address must be specified. The address is of the form: "127.0.0.1 23".
10
+ *
11
+ */
12
+ int socket_write( int s, mixed message,
13
+ void | string address );
14
+
15
+ /**
16
+ * socket_status() - display the status of each LPC socket
17
+ *
18
+ * socket_status() returns an array of arrays; one for each socket.
19
+ *
20
+ */
21
+ mixed *socket_status(void | int);
22
+
23
+ /**
24
+ * socket_release() - release ownership of a socket to another object
25
+ *
26
+ * socket_release() is used to change ownership (and control) of a socket
27
+ * to another object. It is useful in daemon objects (like inetd) which
28
+ * handle connection set-up and then transfer a connected socket to
29
+ * another object for further processing.
30
+ *
31
+ * Socket ownership transfer involves a handshake between the current
32
+ * owner object and the socket to which the current owner wishes to trans‐
33
+ * fer the socket. The handshake is initiated when socket_release() is
34
+ * called. socket_release() does appropriate security/integrity checking
35
+ * and then calls the release_callback function in object ob. This func‐
36
+ * tion is used to notify ob that socket ownership is being transferred to
37
+ * it. It is then ob's responsibility to call socket_acquire() within the
38
+ * release callback function. If socket_acquire() is called then the
39
+ * handshake is complete and socket ownership has been successfully trans‐
40
+ * ferred to ob. ob may decline to accept responsibility for the socket
41
+ * by not calling socket_acquire(), in which case ownership does not
42
+ * change and the current socket owner must decide how to respond to this.
43
+ *
44
+ * If the socket owner is successfully transfered then socket_release()
45
+ * returns EESUCCESS. If ob does not accept ownership for the socket then
46
+ * EESOCKNOTRLSD is returned. Other errors can be returned based on secu‐
47
+ * rity violation, bad socket descriptor vbalues, etc.
48
+ *
49
+ */
50
+ int socket_release( int socket, object ob,
51
+ string release_callback );
52
+
53
+ /**
54
+ * socket_listen() - listen for connections on a socket
55
+ *
56
+ * To accept connections, a socket is first created with socket_create(3),
57
+ * the socket is them put into listening mode with socket_listen(3), and
58
+ * the connections are accepted with socket_accept(3). The socket_listen()
59
+ * call applies only to sockets of type STREAM or MUD.
60
+ *
61
+ * The argument listen_callback is the name of a function for the driver
62
+ * to call when a connection is requested on the listening socket. The
63
+ * listen callback should follow this format:
64
+ *
65
+ * void listen_callback(int fd)
66
+ *
67
+ * Where fd is the listening socket.
68
+ *
69
+ */
70
+
71
+
72
+ int socket_listen( int s, string listen_callback );
73
+
74
+ /**
75
+ * socket_error() - return a text description of a socket error
76
+ *
77
+ * socket_error() returns a string describing the error signified by
78
+ * error.
79
+ *
80
+ */
81
+
82
+
83
+ string socket_error( int error );
84
+
85
+ /**
86
+ * socket_create() - create an efun socket
87
+ *
88
+ * socket_create() creates an efun socket. mode determines which type of
89
+ * socket is created. Currently supported socket modes are:
90
+ *
91
+ * 0 MUD for sending LPC data types using TCP protocol.
92
+ *
93
+ * 1 STREAM for sending raw data using TCP protocol.
94
+ *
95
+ * 2 DATAGRAM for using UDP protocol.
96
+ *
97
+ * 3 STREAM_BINARY for exchange binary message with TCP protocol.
98
+ *
99
+ * 4 DATAGRAM_BINARY for exchange binary message with UDP protocol.
100
+ *
101
+ * The argument read_callback is the name of a function for the driver to
102
+ * call when the socket gets data from its peer. The read callback should
103
+ * follow this format:
104
+ *
105
+ * void read_callback(int fd, mixed message, string addr)
106
+ *
107
+ * Where fd is the socket which received the data, and message is the data
108
+ * which was received, addr is the client address.
109
+ *
110
+ * In non-binary mode, message will be sanitized with UTF8 encoding and returned as an string.
111
+ *
112
+ * In binary mode, raw messages will be returned as a buffer.
113
+ *
114
+ * The argument close_callback is the name of a function for the driver to
115
+ * call if the socket closes unexpectedly, i.e. not as the result of a
116
+ * socket_close(3) call. The close callback should follow this format:
117
+ *
118
+ * void close_callback(int fd)
119
+ *
120
+ * Where fd is the socket which has closed. NOTE: close_callback is not
121
+ * used with DATAGRAM mode sockets.
122
+ *
123
+ */
124
+ int socket_create( int mode, string read_callback,
125
+ void | string close_callback );
126
+
127
+ /**
128
+ * socket_connect() - initiate a connection on a socket
129
+ *
130
+ * The argument s is a socket. s must be either a STREAM mode or a MUD
131
+ * mode socket. address is the address to which the socket will attempt to
132
+ * connect. address is of the form: "127.0.0.1 23"
133
+ *
134
+ * The argument read_callback is the name of a function for the driver to
135
+ * call when the socket gets data from its peer. The read callback should
136
+ * follow this format:
137
+ *
138
+ * void read_callback(int fd, mixed message)
139
+ *
140
+ * Where fd is the socket which received the data, and message is the data
141
+ * which was received.
142
+ *
143
+ * The argument write_callback is the name of a function for the driver to
144
+ * call when the socket is ready to be written to. The write callback
145
+ * should follow this format:
146
+ *
147
+ * void write_callback(int fd)
148
+ *
149
+ * Where fd is the socket which is ready to be written to.
150
+ *
151
+ */
152
+
153
+
154
+ int socket_connect( int s, string address,
155
+ string read_callback,
156
+ string write_callback );
157
+
158
+ /**
159
+ * socket_close() - close a socket
160
+ *
161
+ * socket_close() closes socket s. This frees a socket efun slot for use.
162
+ *
163
+ */
164
+
165
+
166
+ int socket_close( int s );
167
+
168
+ /**
169
+ * socket_bind() - bind a name to a socket
170
+ *
171
+ * socket_bind() assigns a name to an unnamed socket. When a socket is
172
+ * created with socket_create(3) it exists in a name space (address fam‐
173
+ * ily) but has no name assigned. socket_bind() requests that the port be
174
+ * assigned to the socket s.
175
+ *
176
+ */
177
+
178
+
179
+ int socket_bind( int s, int port );
180
+
181
+ /**
182
+ * socket_address() - return the remote address for an efun socket
183
+ *
184
+ * socket_address() returns the remote address for an efun socket s. The
185
+ * returned address is of the form:
186
+ *
187
+ * "127.0.0.1 23".
188
+ *
189
+ */
190
+
191
+
192
+ string socket_address( int s );
193
+
194
+ /**
195
+ * socket_acquire() - assume ownership of a socket
196
+ *
197
+ * socket_acquire() is called to complete the handshake begun by
198
+ * socket_release() for transferring ownership (and control) of a socket
199
+ * to a new object. socket_release() calls the release callback function
200
+ * within the new owner object to notify the object that it wishes to pass
201
+ * control of the socket on. It is the responsibility of the new owner
202
+ * socket to decide whether it wishes to accept the socket. It it does,
203
+ * then socket_acquire() is called to complete the transfer. If not, then
204
+ * the callback simply returns without completing the handshake.
205
+ *
206
+ * In the former case the handshake is completed and the new object
207
+ * becomes the socket owner. The read, write and close callback function
208
+ * parameters refer to functions within the new object. These are speci‐
209
+ * fied so that the MudOS driver will know which functions to call within
210
+ * the new object. Decling to acquire the socket will cause
211
+ * socket_release() to return EESOCKNOTRLSD so the owner can perform
212
+ * appropriate clean-up.
213
+ *
214
+ * socket_acquire() may only be called within the context of thr release
215
+ * callback function and only with the socket specified.
216
+ *
217
+ */
218
+
219
+
220
+ int socket_acquire( int socket, string read_callback,
221
+ string write_callback,
222
+ string close_callback );
223
+
224
+ /**
225
+ * socket_accept() - accept a connection on a socket
226
+ *
227
+ * The argument s is a socket that has been created with socket_create(3),
228
+ * bound to an address with socket_bind(3), and is listening for connec‐
229
+ * tions after a socket_listen(3). socket_accept() extracts the first con‐
230
+ * nection on the queue of pending connections, creates a new socket with
231
+ * the same properties of s and allocates a new file descriptor for the
232
+ * socket. If no pending connections are present on the queue,
233
+ * socket_accept() returns an error as described below. The accepted
234
+ * socket is used to read and write data to and from the socket which con‐
235
+ * nected to this one; it is not used to accept more connections. The
236
+ * original socket s remains open for accepting further connections.
237
+ *
238
+ * The argument read_callback is the name of a function for the driver to
239
+ * call when the new socket (not the accepting socket) receives data. The
240
+ * write callback should follow this format:
241
+ *
242
+ * void read_callback(int fd)
243
+ *
244
+ * Where fd is the socket which is ready to accept data.
245
+ *
246
+ * The argument write_callback is the name of a function for the driver to
247
+ * call when the new socket (not the accepting socket) is ready to be
248
+ * written to. The write callback should follow this format:
249
+ *
250
+ * void write_callback(int fd)
251
+ *
252
+ * Where fd is the socket which is ready to be written to.
253
+ *
254
+ * Note: The close_callback of the accepting socket (not the new socket)
255
+ * is called if the new socket closes unexpectedly, i.e. not as the result
256
+ * of a socket_close(3) call. The close callback should follow this for‐
257
+ * mat:
258
+ *
259
+ * void close_callback(int fd)
260
+ *
261
+ * Where fd is the socket which has closed.
262
+ *
263
+ */
264
+
265
+
266
+ int socket_accept( int s, string read_callback,
267
+ string write_callback );
268
+
269
+
270
+ /**
271
+ * Set the option for a socket.
272
+ * @param socket
273
+ * @param option
274
+ * @param host
275
+ */
276
+ void socket_set_option(int socket, int option, int|string host);