@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.
- package/README.md +255 -0
- package/bin/lpc +4 -0
- package/bin/lpcserver +4 -0
- package/cancellationToken/cancellationToken.d.ts +8 -0
- package/cancellationToken/cancellationToken.d.ts.map +1 -0
- package/cancellationToken/serverCancellationToken.d.ts +21 -0
- package/cancellationToken/serverCancellationToken.d.ts.map +1 -0
- package/cli/_namespaces/lpc.d.ts +2 -0
- package/cli/_namespaces/lpc.d.ts.map +1 -0
- package/cli/lpc.d.ts +2 -0
- package/cli/lpc.d.ts.map +1 -0
- package/compiler/LpcConfig.d.ts +17 -0
- package/compiler/LpcConfig.d.ts.map +1 -0
- package/compiler/_namespaces/lpc.d.ts +49 -0
- package/compiler/_namespaces/lpc.d.ts.map +1 -0
- package/compiler/_namespaces/lpc.moduleSpecifiers.d.ts +2 -0
- package/compiler/_namespaces/lpc.moduleSpecifiers.d.ts.map +1 -0
- package/compiler/_namespaces/lpc.performance.d.ts +2 -0
- package/compiler/_namespaces/lpc.performance.d.ts.map +1 -0
- package/compiler/binder.d.ts +2 -0
- package/compiler/binder.d.ts.map +1 -0
- package/compiler/builderPublic.d.ts +76 -0
- package/compiler/builderPublic.d.ts.map +1 -0
- package/compiler/checker.d.ts +2 -0
- package/compiler/checker.d.ts.map +1 -0
- package/compiler/commandLineParser.d.ts +47 -0
- package/compiler/commandLineParser.d.ts.map +1 -0
- package/compiler/core.d.ts +3 -0
- package/compiler/core.d.ts.map +1 -0
- package/compiler/corePublic.d.ts +19 -0
- package/compiler/corePublic.d.ts.map +1 -0
- package/compiler/debug.d.ts +71 -0
- package/compiler/debug.d.ts.map +1 -0
- package/compiler/diagnosticInformation.d.ts +518 -0
- package/compiler/diagnosticInformation.d.ts.map +1 -0
- package/compiler/emitter.d.ts +11 -0
- package/compiler/emitter.d.ts.map +1 -0
- package/compiler/executeCommandLine.d.ts +15 -0
- package/compiler/executeCommandLine.d.ts.map +1 -0
- package/compiler/expressionToTypeNode.d.ts +2 -0
- package/compiler/expressionToTypeNode.d.ts.map +1 -0
- package/compiler/factory/baseNodeFactory.d.ts +2 -0
- package/compiler/factory/baseNodeFactory.d.ts.map +1 -0
- package/compiler/factory/emitHelper.d.ts +2 -0
- package/compiler/factory/emitHelper.d.ts.map +1 -0
- package/compiler/factory/emitNode.d.ts +22 -0
- package/compiler/factory/emitNode.d.ts.map +1 -0
- package/compiler/factory/nodeChildren.d.ts +2 -0
- package/compiler/factory/nodeChildren.d.ts.map +1 -0
- package/compiler/factory/nodeConverters.d.ts +2 -0
- package/compiler/factory/nodeConverters.d.ts.map +1 -0
- package/compiler/factory/nodeFactory.d.ts +4 -0
- package/compiler/factory/nodeFactory.d.ts.map +1 -0
- package/compiler/factory/parenthesizerRules.d.ts +2 -0
- package/compiler/factory/parenthesizerRules.d.ts.map +1 -0
- package/compiler/factory/utilities.d.ts +2 -0
- package/compiler/factory/utilities.d.ts.map +1 -0
- package/compiler/factory/utilitiesPublic.d.ts +4 -0
- package/compiler/factory/utilitiesPublic.d.ts.map +1 -0
- package/compiler/lpcFileHandler.d.ts +10 -0
- package/compiler/lpcFileHandler.d.ts.map +1 -0
- package/compiler/lpcJsHelpers.d.ts +17 -0
- package/compiler/lpcJsHelpers.d.ts.map +1 -0
- package/compiler/lpcbuild.d.ts +2 -0
- package/compiler/lpcbuild.d.ts.map +1 -0
- package/compiler/lpcbuildPublic.d.ts +26 -0
- package/compiler/lpcbuildPublic.d.ts.map +1 -0
- package/compiler/moduleNameResolver.d.ts +55 -0
- package/compiler/moduleNameResolver.d.ts.map +1 -0
- package/compiler/moduleSpecifiers.d.ts +2 -0
- package/compiler/moduleSpecifiers.d.ts.map +1 -0
- package/compiler/nodeTests.d.ts +115 -0
- package/compiler/nodeTests.d.ts.map +1 -0
- package/compiler/parser.d.ts +65 -0
- package/compiler/parser.d.ts.map +1 -0
- package/compiler/path.d.ts +2 -0
- package/compiler/path.d.ts.map +1 -0
- package/compiler/perfLoger.d.ts +2 -0
- package/compiler/perfLoger.d.ts.map +1 -0
- package/compiler/performance.d.ts +2 -0
- package/compiler/performance.d.ts.map +1 -0
- package/compiler/performanceCore.d.ts +2 -0
- package/compiler/performanceCore.d.ts.map +1 -0
- package/compiler/program.d.ts +72 -0
- package/compiler/program.d.ts.map +1 -0
- package/compiler/resolutionCache.d.ts +6 -0
- package/compiler/resolutionCache.d.ts.map +1 -0
- package/compiler/resolver.d.ts +1 -0
- package/compiler/resolver.d.ts.map +1 -0
- package/compiler/scanner.d.ts +85 -0
- package/compiler/scanner.d.ts.map +1 -0
- package/compiler/sourcemap.d.ts +2 -0
- package/compiler/sourcemap.d.ts.map +1 -0
- package/compiler/sys.d.ts +56 -0
- package/compiler/sys.d.ts.map +1 -0
- package/compiler/tracing.d.ts +31 -0
- package/compiler/tracing.d.ts.map +1 -0
- package/compiler/transformers/declarations.d.ts +2 -0
- package/compiler/transformers/declarations.d.ts.map +1 -0
- package/compiler/transformers.d.ts +2 -0
- package/compiler/transformers.d.ts.map +1 -0
- package/compiler/types.d.ts +3284 -0
- package/compiler/types.d.ts.map +1 -0
- package/compiler/utilities.d.ts +57 -0
- package/compiler/utilities.d.ts.map +1 -0
- package/compiler/utilitiesPublic.d.ts +213 -0
- package/compiler/utilitiesPublic.d.ts.map +1 -0
- package/compiler/visitorPublic.d.ts +72 -0
- package/compiler/visitorPublic.d.ts.map +1 -0
- package/compiler/watch.d.ts +2 -0
- package/compiler/watch.d.ts.map +1 -0
- package/compiler/watchPublic.d.ts +44 -0
- package/compiler/watchPublic.d.ts.map +1 -0
- package/compiler/watchUtilities.d.ts +14 -0
- package/compiler/watchUtilities.d.ts.map +1 -0
- package/config-types.d.ts +33 -0
- package/config-types.d.ts.map +1 -0
- package/harness/harnessIO.d.ts +4 -0
- package/harness/harnessIO.d.ts.map +1 -0
- package/lpc/_namespaces/lpc.d.ts +6 -0
- package/lpc/_namespaces/lpc.d.ts.map +1 -0
- package/lpc/_namespaces/lpc.server.d.ts +2 -0
- package/lpc/_namespaces/lpc.server.d.ts.map +1 -0
- package/lpc/lpc.d.ts +2 -0
- package/lpc/lpc.d.ts.map +1 -0
- package/lpcserver/document.d.ts +1 -0
- package/lpcserver/document.d.ts.map +1 -0
- package/lpcserver/nodeServer.d.ts +25 -0
- package/lpcserver/nodeServer.d.ts.map +1 -0
- package/lpcserver/protocol.const.d.ts +46 -0
- package/lpcserver/protocol.const.d.ts.map +1 -0
- package/lpcserver/server.d.ts +3 -0
- package/lpcserver/server.d.ts.map +1 -0
- package/lpcserver/textRendering.d.ts +14 -0
- package/lpcserver/textRendering.d.ts.map +1 -0
- package/lpcserver/typeConverters.d.ts +44 -0
- package/lpcserver/typeConverters.d.ts.map +1 -0
- package/lpcserver/utils.d.ts +14 -0
- package/lpcserver/utils.d.ts.map +1 -0
- package/package.json +48 -0
- package/parse-fluff-docs.d.ts +2 -0
- package/parse-fluff-docs.d.ts.map +1 -0
- package/parse-ld-docs.d.ts +2 -0
- package/parse-ld-docs.d.ts.map +1 -0
- package/server/_namespaces/lpc.d.ts +5 -0
- package/server/_namespaces/lpc.d.ts.map +1 -0
- package/server/_namespaces/lpc.server.d.ts +11 -0
- package/server/_namespaces/lpc.server.d.ts.map +1 -0
- package/server/_namespaces/lpc.server.protocol.d.ts +2 -0
- package/server/_namespaces/lpc.server.protocol.d.ts.map +1 -0
- package/server/editorServices.d.ts +261 -0
- package/server/editorServices.d.ts.map +1 -0
- package/server/project.d.ts +143 -0
- package/server/project.d.ts.map +1 -0
- package/server/protocol.d.ts +962 -0
- package/server/protocol.d.ts.map +1 -0
- package/server/scriptInfo.d.ts +53 -0
- package/server/scriptInfo.d.ts.map +1 -0
- package/server/scriptVersionCache.d.ts +2 -0
- package/server/scriptVersionCache.d.ts.map +1 -0
- package/server/session.d.ts +150 -0
- package/server/session.d.ts.map +1 -0
- package/server/types.d.ts +24 -0
- package/server/types.d.ts.map +1 -0
- package/server/utilities.d.ts +2 -0
- package/server/utilities.d.ts.map +1 -0
- package/server/utilitiesPublic.d.ts +37 -0
- package/server/utilitiesPublic.d.ts.map +1 -0
- package/server.d.ts +2 -0
- package/server.d.ts.map +1 -0
- package/services/_namespaces/lpc.Completions.StringCompletions.d.ts +2 -0
- package/services/_namespaces/lpc.Completions.StringCompletions.d.ts.map +1 -0
- package/services/_namespaces/lpc.Completions.d.ts +4 -0
- package/services/_namespaces/lpc.Completions.d.ts.map +1 -0
- package/services/_namespaces/lpc.FindAllReferences.d.ts +3 -0
- package/services/_namespaces/lpc.FindAllReferences.d.ts.map +1 -0
- package/services/_namespaces/lpc.GoToDefinition.d.ts +2 -0
- package/services/_namespaces/lpc.GoToDefinition.d.ts.map +1 -0
- package/services/_namespaces/lpc.JsDoc.d.ts +2 -0
- package/services/_namespaces/lpc.JsDoc.d.ts.map +1 -0
- package/services/_namespaces/lpc.NavigationBar.d.ts +2 -0
- package/services/_namespaces/lpc.NavigationBar.d.ts.map +1 -0
- package/services/_namespaces/lpc.Rename.d.ts +2 -0
- package/services/_namespaces/lpc.Rename.d.ts.map +1 -0
- package/services/_namespaces/lpc.SignatureHelp.d.ts +2 -0
- package/services/_namespaces/lpc.SignatureHelp.d.ts.map +1 -0
- package/services/_namespaces/lpc.SymbolDisplay.d.ts +2 -0
- package/services/_namespaces/lpc.SymbolDisplay.d.ts.map +1 -0
- package/services/_namespaces/lpc.codefix.d.ts +3 -0
- package/services/_namespaces/lpc.codefix.d.ts.map +1 -0
- package/services/_namespaces/lpc.d.ts +30 -0
- package/services/_namespaces/lpc.d.ts.map +1 -0
- package/services/_namespaces/lpc.formatting.d.ts +7 -0
- package/services/_namespaces/lpc.formatting.d.ts.map +1 -0
- package/services/_namespaces/lpc.textChanges.d.ts +2 -0
- package/services/_namespaces/lpc.textChanges.d.ts.map +1 -0
- package/services/classifier2020.d.ts +2 -0
- package/services/classifier2020.d.ts.map +1 -0
- package/services/codefixes/helpers.d.ts +2 -0
- package/services/codefixes/helpers.d.ts.map +1 -0
- package/services/codefixes/importFixes.d.ts +2 -0
- package/services/codefixes/importFixes.d.ts.map +1 -0
- package/services/completions.d.ts +2 -0
- package/services/completions.d.ts.map +1 -0
- package/services/documentRegistry.d.ts +90 -0
- package/services/documentRegistry.d.ts.map +1 -0
- package/services/exportInfoMap.d.ts +5 -0
- package/services/exportInfoMap.d.ts.map +1 -0
- package/services/findAllReferences.d.ts +2 -0
- package/services/findAllReferences.d.ts.map +1 -0
- package/services/formatting/formatting.d.ts +2 -0
- package/services/formatting/formatting.d.ts.map +1 -0
- package/services/formatting/formattingContext.d.ts +2 -0
- package/services/formatting/formattingContext.d.ts.map +1 -0
- package/services/formatting/rule.d.ts +2 -0
- package/services/formatting/rule.d.ts.map +1 -0
- package/services/formatting/rules.d.ts +2 -0
- package/services/formatting/rules.d.ts.map +1 -0
- package/services/formatting/rulesMap.d.ts +2 -0
- package/services/formatting/rulesMap.d.ts.map +1 -0
- package/services/formatting/smartIndenter.d.ts +2 -0
- package/services/formatting/smartIndenter.d.ts.map +1 -0
- package/services/goToDefinition.d.ts +2 -0
- package/services/goToDefinition.d.ts.map +1 -0
- package/services/importTracker.d.ts +2 -0
- package/services/importTracker.d.ts.map +1 -0
- package/services/jsDoc.d.ts +2 -0
- package/services/jsDoc.d.ts.map +1 -0
- package/services/navigationBar.d.ts +2 -0
- package/services/navigationBar.d.ts.map +1 -0
- package/services/rename.d.ts +2 -0
- package/services/rename.d.ts.map +1 -0
- package/services/services.d.ts +54 -0
- package/services/services.d.ts.map +1 -0
- package/services/signatureHelp.d.ts +2 -0
- package/services/signatureHelp.d.ts.map +1 -0
- package/services/sourcemaps.d.ts +2 -0
- package/services/sourcemaps.d.ts.map +1 -0
- package/services/stringCompletions.d.ts +2 -0
- package/services/stringCompletions.d.ts.map +1 -0
- package/services/suggestionDiagnostics.d.ts +2 -0
- package/services/suggestionDiagnostics.d.ts.map +1 -0
- package/services/symbolDisplay.d.ts +2 -0
- package/services/symbolDisplay.d.ts.map +1 -0
- package/services/textChanges.d.ts +2 -0
- package/services/textChanges.d.ts.map +1 -0
- package/services/types.d.ts +901 -0
- package/services/types.d.ts.map +1 -0
- package/services/utilities.d.ts +3 -0
- package/services/utilities.d.ts.map +1 -0
- package/src/cli.js +58 -0
- package/src/cli.js.map +7 -0
- package/src/efuns/fluffos/arrays.h +205 -0
- package/src/efuns/fluffos/async.h +84 -0
- package/src/efuns/fluffos/buffers.h +80 -0
- package/src/efuns/fluffos/calls.h +275 -0
- package/src/efuns/fluffos/contrib.h +805 -0
- package/src/efuns/fluffos/db.h +125 -0
- package/src/efuns/fluffos/driver.h +107 -0
- package/src/efuns/fluffos/ed.h +48 -0
- package/src/efuns/fluffos/efuns.fluffos.h +75 -0
- package/src/efuns/fluffos/external.h +30 -0
- package/src/efuns/fluffos/filesystem.h +154 -0
- package/src/efuns/fluffos/floats.h +136 -0
- package/src/efuns/fluffos/functions.h +104 -0
- package/src/efuns/fluffos/general.h +548 -0
- package/src/efuns/fluffos/interactive.h +777 -0
- package/src/efuns/fluffos/internals.h +455 -0
- package/src/efuns/fluffos/lpc-config.json +10 -0
- package/src/efuns/fluffos/mappings.h +205 -0
- package/src/efuns/fluffos/misc.h +43 -0
- package/src/efuns/fluffos/mudlib.h +228 -0
- package/src/efuns/fluffos/numbers.h +41 -0
- package/src/efuns/fluffos/objects.h +365 -0
- package/src/efuns/fluffos/parsing.h +220 -0
- package/src/efuns/fluffos/pcre.h +75 -0
- package/src/efuns/fluffos/sockets.h +276 -0
- package/src/efuns/fluffos/strings.h +542 -0
- package/src/efuns/fluffos/system.h +408 -0
- package/src/efuns/fluffos/zh-cn/arrays.zh-cn.h +167 -0
- package/src/efuns/fluffos/zh-cn/async.zh-cn.h +81 -0
- package/src/efuns/fluffos/zh-cn/buffers.zh-cn.h +69 -0
- package/src/efuns/fluffos/zh-cn/calls.zh-cn.h +242 -0
- package/src/efuns/fluffos/zh-cn/contrib.zh-cn.h +767 -0
- package/src/efuns/fluffos/zh-cn/db.zh-cn.h +113 -0
- package/src/efuns/fluffos/zh-cn/ed.zh-cn.h +42 -0
- package/src/efuns/fluffos/zh-cn/efuns.fluffos.h +76 -0
- package/src/efuns/fluffos/zh-cn/external.zh-cn.h +25 -0
- package/src/efuns/fluffos/zh-cn/filesystem.zh-cn.h +140 -0
- package/src/efuns/fluffos/zh-cn/floats.zh-cn.h +129 -0
- package/src/efuns/fluffos/zh-cn/functions.zh-cn.h +87 -0
- package/src/efuns/fluffos/zh-cn/general.zh-cn.h +506 -0
- package/src/efuns/fluffos/zh-cn/interactive.zh-cn.h +659 -0
- package/src/efuns/fluffos/zh-cn/internals.zh-cn.h +356 -0
- package/src/efuns/fluffos/zh-cn/mappings.zh-cn.h +188 -0
- package/src/efuns/fluffos/zh-cn/misc.zh-cn.h +43 -0
- package/src/efuns/fluffos/zh-cn/mudlib.zh-cn.h +190 -0
- package/src/efuns/fluffos/zh-cn/numbers.zh-cn.h +36 -0
- package/src/efuns/fluffos/zh-cn/objects.zh-cn.h +280 -0
- package/src/efuns/fluffos/zh-cn/parsing.zh-cn.h +212 -0
- package/src/efuns/fluffos/zh-cn/pcre.zh-cn.h +67 -0
- package/src/efuns/fluffos/zh-cn/sockets.zh-cn.h +230 -0
- package/src/efuns/fluffos/zh-cn/strings.zh-cn.h +484 -0
- package/src/efuns/fluffos/zh-cn/system.zh-cn.h +366 -0
- package/src/efuns/ldmud/defines.h +69 -0
- package/src/efuns/ldmud/efun.h +10449 -0
- package/src/efuns/ldmud/efuns.ldmud.h +87 -0
- package/src/efuns/ldmud/lpc-config.json +9 -0
- package/src/efuns/ldmud/obsolete.h +2168 -0
- package/src/lpc.js +82486 -0
- package/src/lpc.js.map +6 -0
- package/src/server.js +129 -0
- package/src/server.js.map +7 -0
- package/types.d.ts +23 -0
- package/types.d.ts.map +1 -0
- package/utils.d.ts +21 -0
- package/utils.d.ts.map +1 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// arrays.h
|
|
2
|
+
|
|
3
|
+
#undef ALL_ARRAY_TYPES
|
|
4
|
+
#define ALL_ARRAY_TYPES string*|int*|float*|object*|mixed*|function*
|
|
5
|
+
#undef ALL_PRIMITIVE_TYPES
|
|
6
|
+
#define ALL_PRIMITIVE_TYPES string|int|float|object|mixed|function
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* unique_array() - partitions an array of objects into groups
|
|
10
|
+
*
|
|
11
|
+
* Groups objects together for which the 'separator' function returns the
|
|
12
|
+
* same value. 'obarr' should be an array of objects, other types are
|
|
13
|
+
* ignored. The 'separator' function is called only once in each object
|
|
14
|
+
* in 'obarr'. THe optional 'skip' parameter enables a pre-filter on
|
|
15
|
+
* 'obarr', skipping elements which match 'skip'. The second form works a
|
|
16
|
+
* bit differently. each element of the array is passed to f and the ele‐
|
|
17
|
+
* ments are partitioned based on the return value of f. In particular,
|
|
18
|
+
* the array does not need to be composed of objects.
|
|
19
|
+
*
|
|
20
|
+
* @template {object} T
|
|
21
|
+
* @param {T*} obarr The array of objects to partition
|
|
22
|
+
* @param separator The function to use to partition the array
|
|
23
|
+
* @param {T} skip The value to skip
|
|
24
|
+
* @returns {<T*>*} The partitioned array
|
|
25
|
+
*/
|
|
26
|
+
varargs mixed unique_array(object *obarr, string separator, mixed skip);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @template T, Y
|
|
30
|
+
* @callback uniqueArrayCallback
|
|
31
|
+
* @param {T} element The element to test
|
|
32
|
+
* @returns {Y} The map callback return value
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* unique_array() - partitions an array of objects into groups
|
|
38
|
+
*
|
|
39
|
+
* Groups objects together for which the 'separator' function returns the
|
|
40
|
+
* same value. 'obarr' should be an array of objects, other types are
|
|
41
|
+
* ignored. The 'separator' function is called only once in each object
|
|
42
|
+
* in 'obarr'. THe optional 'skip' parameter enables a pre-filter on
|
|
43
|
+
* 'obarr', skipping elements which match 'skip'. The second form works a
|
|
44
|
+
* bit differently. each element of the array is passed to f and the ele‐
|
|
45
|
+
* ments are partitioned based on the return value of f. In particular,
|
|
46
|
+
* the array does not need to be composed of objects.
|
|
47
|
+
*
|
|
48
|
+
* @template T
|
|
49
|
+
* @param {T*} arr The array of objects to partition
|
|
50
|
+
* @param {uniqueArrayCallback<T,Y>} f The function to use to partition the array
|
|
51
|
+
* @param {T|void} skip The value to skip
|
|
52
|
+
* @returns {<T*>*} The partitioned array
|
|
53
|
+
*/
|
|
54
|
+
varargs <mixed*>* unique_array(mixed *arr, function f, mixed skip );
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* sort_array() - sort an array
|
|
58
|
+
*
|
|
59
|
+
* The first form returns an array with the same elements as 'arr', but
|
|
60
|
+
* quicksorted in ascending order according to the rules in 'ob->fun()'.
|
|
61
|
+
* 'ob->fun()' will be passed two arguments for each call. It should
|
|
62
|
+
* return -1, 0, or 1, depending on the relationship of the two arguments
|
|
63
|
+
* (lesser, equal to, greater than).
|
|
64
|
+
*
|
|
65
|
+
* The second form does the same thing but allows a function pointer to be
|
|
66
|
+
* used instead.
|
|
67
|
+
*
|
|
68
|
+
* The third form returns an array with the same elements as 'arr', but
|
|
69
|
+
* quicksorted using built-in sort routines. A 'direction' of 1 or 0 will
|
|
70
|
+
* quicksort in ascending order, while a 'direction' of -1 will quicksort
|
|
71
|
+
* in descending order. A limitation of the built-in sort routines is
|
|
72
|
+
* that the array must be homogeneous, composed entirely of a single type,
|
|
73
|
+
* where that type is string, int, or float. Arrays of arrays are sorted
|
|
74
|
+
* by sorting based on the first element, making database sorts possible.
|
|
75
|
+
* @template {ALL_ARRAY_TYPES} T
|
|
76
|
+
* @param {T} arr The array to sort
|
|
77
|
+
* @returns {T} The sorted array
|
|
78
|
+
*/
|
|
79
|
+
mixed *sort_array( mixed *arr, string fun, object ob );
|
|
80
|
+
mixed *sort_array( mixed *arr, function f );
|
|
81
|
+
mixed *sort_array( mixed *arr, int direction );
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* shuffle() - Rearrange the elements in the array in random order
|
|
85
|
+
*
|
|
86
|
+
* Shuffle the array and return.
|
|
87
|
+
* @template {ALL_ARRAY_TYPES} T
|
|
88
|
+
* @param {T} arr The array to shuffle
|
|
89
|
+
* @returns {T} The shuffled array
|
|
90
|
+
*/
|
|
91
|
+
mixed *shuffle(mixed *arr);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* pointerp() - identifies whether a given variable is an array
|
|
95
|
+
* @param {mixed} arg The argument to check
|
|
96
|
+
* @returns {arg is mixed*} 1 if 'arg' is an array, otherwise returns 0.
|
|
97
|
+
* @example
|
|
98
|
+
* int is_array = pointerp( ({ 1, 2, 3, 4 }) ); // 1
|
|
99
|
+
* int is_array = pointerp( "Foo" ); // 0
|
|
100
|
+
*
|
|
101
|
+
*/
|
|
102
|
+
int pointerp( mixed arg );
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* member_array() - returns index of an occurence of a given item in an
|
|
106
|
+
array or string
|
|
107
|
+
*
|
|
108
|
+
* Returns the index of the first occurence of 'item' in array 'arr', or
|
|
109
|
+
* the first occurence at or after 'start'. If the item is not found,
|
|
110
|
+
* then -1 is returned.
|
|
111
|
+
*
|
|
112
|
+
* Note, if the second argument is a string, the first parameter must be an int
|
|
113
|
+
* representing the character you are looking for in the provided string.
|
|
114
|
+
* @example
|
|
115
|
+
* ```c
|
|
116
|
+
* member_array( "red", ({ "red", "blue", "red", "green", "red", }) ) ;
|
|
117
|
+
* // 0
|
|
118
|
+
*
|
|
119
|
+
* member_array( "red", ({ "red", "blue", "red", "green", "red", }) , 1) ;
|
|
120
|
+
* // 2
|
|
121
|
+
*
|
|
122
|
+
* member_array( "blue", ({ "red", "blue", "red", "green", "red", }) , 3) ;
|
|
123
|
+
* // -1
|
|
124
|
+
*
|
|
125
|
+
* member_array( "purple", ({ "red", "blue", "red", "green", "red", }) ) ;
|
|
126
|
+
* // -1
|
|
127
|
+
*
|
|
128
|
+
* member_array('F', "Drink the FluffOS Kool-Aid!") ;
|
|
129
|
+
* // 10
|
|
130
|
+
*
|
|
131
|
+
* member_array('Z', "Drink the FluffOS Kool-Aid!") ;
|
|
132
|
+
* // -1
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
varargs int member_array( mixed item, mixed * | string arr, void | int start );
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* map_array() - modify an array of elements via application of a function
|
|
139
|
+
*
|
|
140
|
+
* Returns an array holding the items of 'arr' mapped through either
|
|
141
|
+
* 'ob->fun()' or 'f'. The function is called for each element in 'arr'
|
|
142
|
+
* with that element as a parameter. A second parameter 'extra' is sent in
|
|
143
|
+
* each call if given. Principal function:
|
|
144
|
+
* ```c
|
|
145
|
+
* foreach (index) arr[index] = ob->fun(arr[index],extra);
|
|
146
|
+
* ```
|
|
147
|
+
* The value returned by 'ob->fun(arr[.index.], extra)' replaces the existing
|
|
148
|
+
* element in the array. If 'arr' is not an array, then 0 will be returned.
|
|
149
|
+
*
|
|
150
|
+
*/
|
|
151
|
+
mixed *map_array( mixed *arr, string fun, object ob, mixed extra... );
|
|
152
|
+
mixed *map_array( mixed *arr, function f, mixed extra... );
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* filter_array() - return a selective sub-array
|
|
156
|
+
*
|
|
157
|
+
* filter_array() returns an array holding the items of <arr> which passed
|
|
158
|
+
* sucessfully through the function <fun> found in object <ob>. The func‐
|
|
159
|
+
* tion <fun> is called for each element in <arr> with that element as
|
|
160
|
+
* parameter. The second parameter <extra> and following parameters are
|
|
161
|
+
* sent in each call if given. An object is considered to have passed
|
|
162
|
+
* sucessfully through <fun> (and hence is included in the return array)
|
|
163
|
+
* if <fun> returns 1. If f is passed it is used instead of ob->fun().
|
|
164
|
+
* If <arr> is not an array, then 0 will be returned.
|
|
165
|
+
*
|
|
166
|
+
*/
|
|
167
|
+
mixed *filter_array( mixed *arr, string fun, object|string ob, mixed extra... );
|
|
168
|
+
mixed *filter_array( mixed *arr, function f, mixed extra... );
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* element_of() - Return an element randomly from the array
|
|
172
|
+
*
|
|
173
|
+
* Returns a random element from an array.
|
|
174
|
+
*
|
|
175
|
+
*/
|
|
176
|
+
mixed element_of(mixed *arr);
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* arrayp() - identifies whether a given variable is an array
|
|
180
|
+
*
|
|
181
|
+
* Returns 1 if 'arg' is an array, otherwise returns 0.
|
|
182
|
+
*
|
|
183
|
+
* @param {mixed} arg The argument to check
|
|
184
|
+
* @returns {arg is mixed*} 1 if 'arg' is an array, otherwise returns 0.
|
|
185
|
+
* @example
|
|
186
|
+
* int is_array = arrayp( ({ 1, 2, 3, 4 }) ); // 1
|
|
187
|
+
* int is_array = arrayp( "Foo" ); // 0
|
|
188
|
+
*/
|
|
189
|
+
int arrayp( mixed arg );
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* allocate() - allocate an array
|
|
193
|
+
*
|
|
194
|
+
* Allocate an array of <size> elements. The number of elements must be
|
|
195
|
+
* >= 0 and not bigger than a system maximum (usually ~10000). All elements
|
|
196
|
+
* are initialized to 0 by default.
|
|
197
|
+
*
|
|
198
|
+
* If the optional second argument is provided, the values are initialized
|
|
199
|
+
* to that argument, unless the second argument is a functional. In that case,
|
|
200
|
+
* the functional will be evaluated for each array element, with the first
|
|
201
|
+
* argument passed to the functional being the number of the array element.
|
|
202
|
+
*
|
|
203
|
+
*/
|
|
204
|
+
varargs mixed *allocate( int size, void | mixed value );
|
|
205
|
+
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// async.h
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* async_write() - appends a string to a file then executes a callback
|
|
5
|
+
*
|
|
6
|
+
* Append the string 'str' into the file 'file'. If flag is 1, write_file
|
|
7
|
+
* overwrites instead of appending.
|
|
8
|
+
*
|
|
9
|
+
* Unlike write_file, which returns 0 for failure or 1 for success, this efun
|
|
10
|
+
* will return -1 for failure and 0 for success to the callback.
|
|
11
|
+
*
|
|
12
|
+
* The callback should follow this format:
|
|
13
|
+
*
|
|
14
|
+
* function (int res) {
|
|
15
|
+
* // -1 for failure
|
|
16
|
+
* // 0 for success
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
void async_write( string file, string str, int flag, function callback );
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* async_read() - read a file into a string then executes a callback
|
|
24
|
+
*
|
|
25
|
+
* Read a line of text from a file into a string. Normally, read_file
|
|
26
|
+
* takes a second and third arguments for start_line and number_of_lines to
|
|
27
|
+
* read, but async_read will return the entire file to the callback.
|
|
28
|
+
*
|
|
29
|
+
* The callback should follow this format:
|
|
30
|
+
*
|
|
31
|
+
* function(mixed res) {
|
|
32
|
+
* // -1 for file not read
|
|
33
|
+
* // string file contents otherwise
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
void async_read( string file, function callback );
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* async_getdir() - returns information pertaining to a filesystem directory
|
|
41
|
+
*
|
|
42
|
+
* If 'dir' is a filename ('*' and '?' wildcards are supported), an array
|
|
43
|
+
* of strings is returned to the callback containing all filenames that match
|
|
44
|
+
* the specification. If 'dir' is a directory name (ending with a slash--ie:
|
|
45
|
+
* "/u/", "/adm/", etc), all filenames in that directory are returned.
|
|
46
|
+
*
|
|
47
|
+
* Unlike the get_dir routine, this efun does not take an integer second
|
|
48
|
+
* argument to specify more information (filename, filesize, last touched).
|
|
49
|
+
*
|
|
50
|
+
* The callback should follow this format:
|
|
51
|
+
*
|
|
52
|
+
* function(mixed res) {
|
|
53
|
+
* // 0 when directory doesn't exist
|
|
54
|
+
* // empty array when no matching files exist
|
|
55
|
+
* // array of matching filenames
|
|
56
|
+
* }
|
|
57
|
+
*
|
|
58
|
+
*/
|
|
59
|
+
void async_getdir( string dir, function callback );
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* async_db_exec() - executes an sql statement then executes a callback
|
|
63
|
+
*
|
|
64
|
+
* This function will execute the passed sql statement for the given data‐
|
|
65
|
+
* base handle.
|
|
66
|
+
*
|
|
67
|
+
* Returns the database handle to the callback function provided.
|
|
68
|
+
*
|
|
69
|
+
* The callback should follow this format:
|
|
70
|
+
*
|
|
71
|
+
* ```c
|
|
72
|
+
* async_db_exec(
|
|
73
|
+
* handle,
|
|
74
|
+
* sql_query,
|
|
75
|
+
* function (int rows) { // number of matched rows
|
|
76
|
+
* mixed *results = db_fetch(handle, 1);
|
|
77
|
+
* db_close(handle);
|
|
78
|
+
* }
|
|
79
|
+
* );
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
*/
|
|
83
|
+
void async_db_exec( int handle, string sql_query, function callback );
|
|
84
|
+
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// buffers.h
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* write_buffer() - write a buffer to a file, or read into a buffer from a
|
|
5
|
+
source
|
|
6
|
+
*
|
|
7
|
+
* If 'dest' is a file, then 'source' must be an int (and will be written
|
|
8
|
+
* to the file in network-byte-order), a buffer, or a string, and 'source'
|
|
9
|
+
* will be written to the file 'dest' starting at byte # 'start'.
|
|
10
|
+
*
|
|
11
|
+
* If 'dest' is a buffer, then 'source' will be written into the buffer
|
|
12
|
+
* starting at byte # 'start' in the buffer. If 'source' is an int, it
|
|
13
|
+
* will be written in network-byte-order.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
int write_buffer( string | buffer dest,
|
|
17
|
+
int start,
|
|
18
|
+
mixed source );
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* read_buffer() - read from a file and return a buffer, or return part of
|
|
22
|
+
a buffer as a string
|
|
23
|
+
*
|
|
24
|
+
* If 'src' is a string (filename), then the filename will be read, start‐
|
|
25
|
+
* ing at byte # 'start', for 'len' bytes, and returned as a buffer. If
|
|
26
|
+
* neither argument is given, the entire file is read.
|
|
27
|
+
*
|
|
28
|
+
* If 'src' is a buffer, then characters are read from the buffer begin‐
|
|
29
|
+
* ning at byte # 'start' in the buffer, and for 'len' # of bytes, and
|
|
30
|
+
* returned as a string.
|
|
31
|
+
*
|
|
32
|
+
* Note that the maximum number of bytes you can read from a file and into
|
|
33
|
+
* a buffer is controlled via the 'maximum byte transfer' parameter in the
|
|
34
|
+
* runtime config file.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
string | buffer read_buffer( string | buffer src,
|
|
38
|
+
int start,
|
|
39
|
+
int len );
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* crc32() - compute the cycle redundancy code for a buffer or string
|
|
43
|
+
*
|
|
44
|
+
* Computes and returns the CRC-32 code for the given buffer or string, 'x'.
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
int crc32( buffer | string x );
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* bufferp() - identifies whether a given variable is a buffer
|
|
51
|
+
*
|
|
52
|
+
* Return 1 if 'arg' is a buffer value and zero (0) otherwise.
|
|
53
|
+
*
|
|
54
|
+
* int is_buffer = bufferp( allocate_buffer(10) ); // 1
|
|
55
|
+
* int is_buffer = bufferp( "Foo" ); // 0
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
int bufferp( mixed arg );
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* buffer_transcode() - transcode a buffer from one encoding to another
|
|
62
|
+
*
|
|
63
|
+
* Transcode given buffer from encoding 'from_encoding' to encoding
|
|
64
|
+
* 'to_encoding'.
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
buffer buffer_transcode(buffer src,
|
|
68
|
+
string from_encoding,
|
|
69
|
+
string to_encoding);
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* allocate_buffer() - allocate a buffer
|
|
73
|
+
*
|
|
74
|
+
* Allocate a buffer of <size> elements. The number of elements must be
|
|
75
|
+
* >= 0 and not bigger than a system maximum (usually ~10000). All ele‐
|
|
76
|
+
* ments are initialized to 0.
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
buffer allocate_buffer( int size );
|
|
80
|
+
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
// calls.h
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* throw() - forces an error to occur in an object.
|
|
5
|
+
*
|
|
6
|
+
* The throw() efun may be used to force an error to occur in an object.
|
|
7
|
+
* When used in conjunction, throw() and catch() allow the programmer to
|
|
8
|
+
* choose what error message is displayed when a runtime error occurs.
|
|
9
|
+
* When throw() is used, it should be used in conjunction with the
|
|
10
|
+
* catch(3) efun. Here is a typical usage:
|
|
11
|
+
*
|
|
12
|
+
* string err;
|
|
13
|
+
* int rc;
|
|
14
|
+
*
|
|
15
|
+
* err = catch(rc = ob->move(dest));
|
|
16
|
+
* if (err) {
|
|
17
|
+
* throw("move.c: ob->move(dest): " + err + "\n");
|
|
18
|
+
* return;
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
void throw(mixed);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* this_object() - return the object pointer of the calling object
|
|
26
|
+
*
|
|
27
|
+
* Return the object pointer of this object. This function is useful when
|
|
28
|
+
* an object wants to call functions that are not in the same source file
|
|
29
|
+
* but are in the same object (via inheritance).
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
object this_object( void );
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* shadow() - shadow one or more functions in some object
|
|
36
|
+
*
|
|
37
|
+
* If 'flag' is 1 or missing, then current object will shadow 'ob'. If
|
|
38
|
+
* 'flag' is 0, then either 0 will be returned, or the object that is
|
|
39
|
+
* already shadowing 'ob'.
|
|
40
|
+
*
|
|
41
|
+
* The master object defines the function "valid_shadow()". If it returns
|
|
42
|
+
* 1 the target object can't be shadowed, and the "shadow()" function will
|
|
43
|
+
* return 0 instead of 'ob'.
|
|
44
|
+
*
|
|
45
|
+
* If an object 'a' shadows an object 'b', then all "call_other(func)" to
|
|
46
|
+
* 'b' will be redirected to 'a'. If object 'a' has not defined the func‐
|
|
47
|
+
* tion, then the call will be forwarded to 'b' (as if there were no
|
|
48
|
+
* shadow). There is only one object that can call functions in 'b' with
|
|
49
|
+
* call_other(), and that is 'a'. Not even object 'b' can "call_other()"
|
|
50
|
+
* itself. All normal (internal) function calls inside 'b' will however
|
|
51
|
+
* remain internal to 'b'.
|
|
52
|
+
*
|
|
53
|
+
* There are two ways to remove the shadow. Either destruct it, or the
|
|
54
|
+
* object that was shadowed. In the latter case, the shadow will also be
|
|
55
|
+
* destructed automatically.
|
|
56
|
+
*
|
|
57
|
+
* The result is that it is possible to hide an object behind another one,
|
|
58
|
+
* but everything can be totally transparent. The shadow() efunction
|
|
59
|
+
* makes it possible to change the behavior of an object without changing
|
|
60
|
+
* the code for the object in question. One possible use for shadow() is
|
|
61
|
+
* to add special capabilities to various classes of players (thief,
|
|
62
|
+
* fighter, mage, etc). This usage would make it possible to keep the
|
|
63
|
+
* player object much simpler than it could be if the code for the various
|
|
64
|
+
* classes had to be in the player object itself.
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
67
|
+
varargs object shadow( object ob, int flag );
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* remove_call_out() - remove a pending call_out
|
|
71
|
+
*
|
|
72
|
+
* In the first form this function removes the next pending call out for
|
|
73
|
+
* function <fun> in the current object. The return value is the number
|
|
74
|
+
* of seconds remaining before the callback was to be called, or -1 if
|
|
75
|
+
* there was no call out pending to this function.
|
|
76
|
+
*
|
|
77
|
+
* In the second form, this function removes a pending call out identified
|
|
78
|
+
* by the <handle> returned from the call_out() function. The return
|
|
79
|
+
* value is the number of remaining seconds before the call_out was to be
|
|
80
|
+
* called, or -1 if there was no valid call_out identified by the
|
|
81
|
+
* specified <handle>.
|
|
82
|
+
*
|
|
83
|
+
* In the third form all pending call outs for the current object will be
|
|
84
|
+
* removed. In this case the return value is always 0.
|
|
85
|
+
*
|
|
86
|
+
*/
|
|
87
|
+
int remove_call_out( string fun );
|
|
88
|
+
int remove_call_out( int handle );
|
|
89
|
+
int remove_call_out();
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* shadowp() - determine whether or not a given object it shadowing
|
|
93
|
+
another
|
|
94
|
+
*
|
|
95
|
+
* Returns the object that 'ob' is shadowing, or zero (0) if it is not
|
|
96
|
+
* shadowing any object.
|
|
97
|
+
*
|
|
98
|
+
*/
|
|
99
|
+
object shadowp( object ob );
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* previous_object() - returns the object(s) that called the current func‐
|
|
103
|
+
tion
|
|
104
|
+
*
|
|
105
|
+
* Returns an object pointer to the object, if any, that called current
|
|
106
|
+
* function. Note that local function calls do not set previous_object()
|
|
107
|
+
* to the current object, but leave it unchanged. If passed a positive
|
|
108
|
+
* integer, it goes back the given number of previous objects in the call‐
|
|
109
|
+
* ing chain. previous_object(0) is the same as previous_object(), previ‐
|
|
110
|
+
* ous_object(1) is the previous object's previous_object(), etc. previ‐
|
|
111
|
+
* ous_object(-1) returns an array containing all of the previous objects.
|
|
112
|
+
*
|
|
113
|
+
*/
|
|
114
|
+
mixed previous_object( int | void );
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* origin() - determine how the current function was called
|
|
118
|
+
*
|
|
119
|
+
* Returns an integer specifying how the current function was called.
|
|
120
|
+
* Current values are:
|
|
121
|
+
*
|
|
122
|
+
* 1 Driver (heart_beats, etc)
|
|
123
|
+
* 2 Local function call
|
|
124
|
+
* 4 call_other()
|
|
125
|
+
* 8 simul_efun object via a simul_efun call
|
|
126
|
+
* 16 call_out()
|
|
127
|
+
* 32 called by an efun (sort_array, etc)
|
|
128
|
+
* 64 function_pointer
|
|
129
|
+
* 128 functional
|
|
130
|
+
*
|
|
131
|
+
*/
|
|
132
|
+
int origin( void );
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* catch() - catch an evaluation error
|
|
136
|
+
*
|
|
137
|
+
* Evaluate <expr>. If there is no error, 0 is returned. If there is a
|
|
138
|
+
* standard error, a string (with a leading '*') will be returned.
|
|
139
|
+
*
|
|
140
|
+
* The function throw() can also be used to immediately return any value,
|
|
141
|
+
* except 0. catch() is not really a function call, but a directive to the
|
|
142
|
+
* compiler.
|
|
143
|
+
*
|
|
144
|
+
* The catch() is somewhat costly, and should not be used just anywhere.
|
|
145
|
+
* Rather, use it at places where an error would destroy consistency.
|
|
146
|
+
*
|
|
147
|
+
* void example1() {
|
|
148
|
+
* object ob ;
|
|
149
|
+
* mixed err ;
|
|
150
|
+
*
|
|
151
|
+
* err = catch( ob = load_object("/obj/weapon/sword") ) ;
|
|
152
|
+
* if(err) throw("There was an error loading the specified file.") ;
|
|
153
|
+
* }
|
|
154
|
+
*
|
|
155
|
+
* void example2() {
|
|
156
|
+
* mixed err = catch {
|
|
157
|
+
* string file, *files = ({
|
|
158
|
+
* "/u/g/gesslar/one", // good file
|
|
159
|
+
* "/u/g/gesslar/two", // bad file
|
|
160
|
+
* "/u/g/gesslar/three", // good file
|
|
161
|
+
* }) ;
|
|
162
|
+
*
|
|
163
|
+
* foreach(file in files) load_object(file) ;
|
|
164
|
+
* } ;
|
|
165
|
+
*
|
|
166
|
+
* if(err) printf("ERR: %O", err) ;
|
|
167
|
+
* }
|
|
168
|
+
*
|
|
169
|
+
* // ERR: "*Error in loading object '/u/g/gesslar/two'"
|
|
170
|
+
*
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
// This will be handled through the parser
|
|
174
|
+
// mixed catch( mixed expr );
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* call_stack - returns information about the functions involved in calling
|
|
178
|
+
this function
|
|
179
|
+
*
|
|
180
|
+
* If the int `option` argument is 0, call_stack() returns an array of the
|
|
181
|
+
* names of the on the call stack, with the first one being the most recent
|
|
182
|
+
* (i.e. the currently running program). If the int argument is 1, call_stack
|
|
183
|
+
* returns the objects in which that program is executing. If it is 2, the
|
|
184
|
+
* name of the functions are returned. If it is 3, the value of origin() in
|
|
185
|
+
* that frame is returned. If it is 4, the value will be the full file path
|
|
186
|
+
* and the line number.
|
|
187
|
+
*
|
|
188
|
+
*/
|
|
189
|
+
varargs string *call_stack(int option);
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* call_out_walltime - delayed function call in same object
|
|
193
|
+
*
|
|
194
|
+
* This efun is identical to call_out except it does not schedule the
|
|
195
|
+
* call on the game loop. Rather, in real seconds. The delay can be in
|
|
196
|
+
* seconds or fraction of a second.
|
|
197
|
+
*
|
|
198
|
+
*/
|
|
199
|
+
int call_out_walltime( string | function fun, int | float delay, mixed arg ... );
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* call_out - delayed function call in same object
|
|
203
|
+
*
|
|
204
|
+
* Schedule a future call of function <fun> in this_object(). The call will
|
|
205
|
+
* take place in <delay> seconds, with each of the arguments <arg> provided.
|
|
206
|
+
* <arg> can be of any type.
|
|
207
|
+
*
|
|
208
|
+
* If the gametick in the runtime config is less than 1000, you may specify
|
|
209
|
+
* a <delay> as a float in milliseconds (gametick / 1000) representing a
|
|
210
|
+
* value that is divisible by the gametick. A <delay> which is not equally
|
|
211
|
+
* divisible by the gametick value will be rounded up to the next game tick.
|
|
212
|
+
* A <delay> of 0 is special, see below.
|
|
213
|
+
*
|
|
214
|
+
* For example, if your gametick is set to 250ms in the runtime config,
|
|
215
|
+
* you may perform callouts with a granularity of a quarter of a second.
|
|
216
|
+
* call_out( "function", 0.75 ) will execute the <fun> in 3 game ticks
|
|
217
|
+
* (750 milliseconds), thereby affording more precision over timing
|
|
218
|
+
* when calling out.
|
|
219
|
+
*
|
|
220
|
+
* A <delay> of 0 (or 0.0), will perform <fun> on the same gametick in which
|
|
221
|
+
* it was called after all previous call_outs have been executed. The number
|
|
222
|
+
* of call_outs(0)s which may be executed on the same gametick may be
|
|
223
|
+
* configured via the "call_out(0) nest level" property in the runtime config.
|
|
224
|
+
*
|
|
225
|
+
* Please note that you can't rely on write() or say() in <fun> since
|
|
226
|
+
* this_player() is set to 0. Use tell_object() instead.
|
|
227
|
+
*
|
|
228
|
+
* The runtime config value "this_player in call_out" exists to remedy the
|
|
229
|
+
* above problem.
|
|
230
|
+
*
|
|
231
|
+
* The return value is an integer representing the handle of the call_out
|
|
232
|
+
* which may be used as an argument to remove_call_out().
|
|
233
|
+
*
|
|
234
|
+
*/
|
|
235
|
+
int call_out( string | function fun, int | float delay, mixed arg ... );
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* call_other() - call a function in another object
|
|
239
|
+
*
|
|
240
|
+
* Calls a function in another object, with [optional] argument(s). The
|
|
241
|
+
* return value is returned from the other object, so it cannot be known
|
|
242
|
+
* at compile time and may need to be cast if using type checking. The
|
|
243
|
+
* function named 'func' will be called in 'ob', with arguments 3, 4, etc
|
|
244
|
+
* given as arguments 1, 2, etc to 'func' in 'ob'. call_other will return
|
|
245
|
+
* the return value of 'func'. If the first argument is an array instead
|
|
246
|
+
* of an object, then the call will be done in all elements of that array
|
|
247
|
+
* (all elements should be of type object), and an array of returns will
|
|
248
|
+
* be returned. If argument 2 is an array instead of a string, then the
|
|
249
|
+
* first element in the array should be a string, the function to call,
|
|
250
|
+
* and all other elements will be passed to the function in the order they
|
|
251
|
+
* appear in the array.
|
|
252
|
+
*
|
|
253
|
+
* There is a much more attractive way to do call_others:
|
|
254
|
+
*
|
|
255
|
+
* object ob | object *obs -> func ( ... );
|
|
256
|
+
*
|
|
257
|
+
* ie,
|
|
258
|
+
*
|
|
259
|
+
* call_other(ob, "query", "name");
|
|
260
|
+
*
|
|
261
|
+
* could be written as:
|
|
262
|
+
*
|
|
263
|
+
* ob->query("name");
|
|
264
|
+
*
|
|
265
|
+
* Using an array as second argument, the same call could be written:
|
|
266
|
+
*
|
|
267
|
+
* call_other(ob, ({ "query", "name" }));
|
|
268
|
+
*
|
|
269
|
+
* An example of using an array as the first argument:
|
|
270
|
+
*
|
|
271
|
+
* users()->quit();
|
|
272
|
+
*
|
|
273
|
+
*/
|
|
274
|
+
mixed call_other( object|object* ob, string|mixed * funcArgs... );
|
|
275
|
+
|