@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,455 @@
|
|
|
1
|
+
// internals.h
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* traceprefix() - sets the prefix determining which objects to trace
|
|
5
|
+
*
|
|
6
|
+
* If the the traceprefix is set (i.e. not 0) tracing will only occur in
|
|
7
|
+
* objects having a name with the set prefix.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
string traceprefix( string prefix );
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* trace() - sets trace flags and returns the old ones.
|
|
14
|
+
*
|
|
15
|
+
* Sets the trace flags and returns the old trace flags. When tracing is
|
|
16
|
+
* on a lot of information is printed during execution.
|
|
17
|
+
*
|
|
18
|
+
* The trace bits are:
|
|
19
|
+
*
|
|
20
|
+
* 1 Trace all function calls to lfuns.
|
|
21
|
+
*
|
|
22
|
+
* 2 Trace all calls to "call_other".
|
|
23
|
+
*
|
|
24
|
+
* 4 Trace all function returns.
|
|
25
|
+
*
|
|
26
|
+
* 8 Print arguments at function calls and return values.
|
|
27
|
+
*
|
|
28
|
+
* 16 Print all executed stack machine instructions (produces a lot of
|
|
29
|
+
* output!).
|
|
30
|
+
*
|
|
31
|
+
* 32 Enable trace in heart beat functions.
|
|
32
|
+
*
|
|
33
|
+
* 64 Trace calls to apply.
|
|
34
|
+
*
|
|
35
|
+
* 128 Show object name in tracing.
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
int trace( int traceflags );
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* time_expression() - return the amount of real time that an expression
|
|
42
|
+
took
|
|
43
|
+
*
|
|
44
|
+
* Evaluate <expr>. The amount of real time that passed during the evalu‐
|
|
45
|
+
* ation of <expr>, in microseconds, is returned. The precision of the
|
|
46
|
+
* value is not necessarily 1 microsecond; in fact, it probably is much
|
|
47
|
+
* less precise.
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
int time_expression( mixed expr );
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* swap - swap out a file explicitly
|
|
54
|
+
*
|
|
55
|
+
* This efun should be reserved for debugging only. It allows an object
|
|
56
|
+
* to be explicitly swapped out. If enabled, it is strongly recommended
|
|
57
|
+
* that a simul_efun override (for this efun) be used to prevent abuse.
|
|
58
|
+
*
|
|
59
|
+
* Note: objects which have been destructed, already swapped out, contain
|
|
60
|
+
* a heart beat, cloned, inherited, or interactive, cannot be swapped out.
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
void swap( object );
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* set_malloc_mask() - sets the mask controlling display of malloc debug
|
|
67
|
+
info
|
|
68
|
+
*
|
|
69
|
+
* This efun is only available when DEBUGMALLOC and DEBUGMALLOC_EXTENSIONS
|
|
70
|
+
* are both defined in options.h at driver build time. The mask controls
|
|
71
|
+
* what memory-related debugging information is displayed as the driver
|
|
72
|
+
* allocates and deallocates memory. Read md.c in the driver source for
|
|
73
|
+
* more information.
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
void set_malloc_mask( int mask );
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* set_debug_level() - sets the debug level used by the driver's debug()
|
|
80
|
+
macro
|
|
81
|
+
*
|
|
82
|
+
* The purpose of this efun is to allow the amount and type of
|
|
83
|
+
* debugging information produced to be controlled from within the mud
|
|
84
|
+
* (while the driver is running).
|
|
85
|
+
*
|
|
86
|
+
* The information is printed to stdout as well as to the file specified in
|
|
87
|
+
* the runtime configuration file as the "debug log file" setting.
|
|
88
|
+
*
|
|
89
|
+
* The level is a bitmask integer or a string. If using an integer, multiple
|
|
90
|
+
* levels can be set by using the bitwise OR operator (|).
|
|
91
|
+
*
|
|
92
|
+
* The following levels are available:
|
|
93
|
+
* "call_out" 1 << 0
|
|
94
|
+
* "d_flag" 1 << 2
|
|
95
|
+
* "connections" 1 << 3
|
|
96
|
+
* "mapping" 1 << 4
|
|
97
|
+
* "sockets" 1 << 5
|
|
98
|
+
* "comp_func_tab" 1 << 6
|
|
99
|
+
* "LPC" 1 << 7
|
|
100
|
+
* "LPC_line" 1 << 8
|
|
101
|
+
* "event" 1 << 9
|
|
102
|
+
* "dns" 1 << 10
|
|
103
|
+
* "file" 1 << 11
|
|
104
|
+
* "add_action" 1 << 12
|
|
105
|
+
* "telnet" 1 << 13
|
|
106
|
+
* "websocket" 1 << 14
|
|
107
|
+
*
|
|
108
|
+
* When level is an integer, the debug level will be set to that value,
|
|
109
|
+
* erasing any previous settings.
|
|
110
|
+
*
|
|
111
|
+
* If level is a string, the debug level for that option will be toggled on,
|
|
112
|
+
* while all other options will be preserved.
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
115
|
+
void set_debug_level( int | string level );
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* set_config() - set various driver config settings during runtime
|
|
119
|
+
*
|
|
120
|
+
* This efun is used to set the driver's various config settings during
|
|
121
|
+
* runtime. Please refer to the "runtime_config.h" include file for a list of
|
|
122
|
+
* currently recognized options.
|
|
123
|
+
*
|
|
124
|
+
* Note that this only modifies the currently running options and will not
|
|
125
|
+
* persist across driver restarts.
|
|
126
|
+
*
|
|
127
|
+
* // set the driver's heartbeat to 1000 milliseconds
|
|
128
|
+
* set_config(__RC_HEARTBEAT_INTERVAL_MSEC__, 1000)
|
|
129
|
+
*
|
|
130
|
+
* // adjust the driver's limit for call_out(0)
|
|
131
|
+
* set_config(__RC_CALL_OUT_ZERO_NEST_LEVEL__, 250)
|
|
132
|
+
*
|
|
133
|
+
*/
|
|
134
|
+
void set_config( int option, mixed value );
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* rusage() - reports information gathered by the getrusage() system call
|
|
138
|
+
*
|
|
139
|
+
* This efun collects information gathered via the getrusage() system
|
|
140
|
+
* call. Read the getrusage() man page for more information on what
|
|
141
|
+
* information will be collected. Some systems do not have the
|
|
142
|
+
* getrusage() system call but do have the times() system call. On those
|
|
143
|
+
* systems, only "utime" and "stime" will be available. Times are
|
|
144
|
+
* reported in milliseconds.
|
|
145
|
+
*
|
|
146
|
+
* Here is an example usage of rusage():
|
|
147
|
+
*
|
|
148
|
+
* void
|
|
149
|
+
* create()
|
|
150
|
+
* {
|
|
151
|
+
* mapping info;
|
|
152
|
+
*
|
|
153
|
+
* info = rusage();
|
|
154
|
+
* write("user time = " + info["utime"] + "ms\n");
|
|
155
|
+
* write("system time = " + info["stime"] + "ms\n");
|
|
156
|
+
* }
|
|
157
|
+
*
|
|
158
|
+
* The available fields are:
|
|
159
|
+
*
|
|
160
|
+
* utime, stime, maxrss, ixrss, idrss, isrss, minflt, majflt, nswap,
|
|
161
|
+
* inblock, oublock, msgsnd, msgrcv, nsignals, nvcsw, nivcsw.
|
|
162
|
+
*
|
|
163
|
+
*/
|
|
164
|
+
mapping rusage( void );
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* refs - return the number of references to a data structure
|
|
168
|
+
*
|
|
169
|
+
* The number of references to 'data' will be returned by refs(). This is
|
|
170
|
+
* useful for deciding whether or not to make a copy of a data structure
|
|
171
|
+
* before returning it.
|
|
172
|
+
*
|
|
173
|
+
*/
|
|
174
|
+
int refs( mixed data );
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* query_load_average() - forces an error to occur in an object.
|
|
178
|
+
*
|
|
179
|
+
* This function returns a string which reports two things: 1) user com‐
|
|
180
|
+
* mands per second, and 2) compiled lines per second.
|
|
181
|
+
*
|
|
182
|
+
*/
|
|
183
|
+
string query_load_average( void );
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* opcprof() - reports statistics on calling frequencies of various efuns
|
|
187
|
+
*
|
|
188
|
+
* This function dumps a list of statistics on each efunction and eopera‐
|
|
189
|
+
* tor. If no argument is specified, then the information will be dumped
|
|
190
|
+
* to files named /OPCPROF.efun and /OPCPROF.eoper. If an argument is
|
|
191
|
+
* specified, then that name is used as the filename for the dump.
|
|
192
|
+
*
|
|
193
|
+
*/
|
|
194
|
+
void opcprof( string | void );
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* mud_status() - report various driver and mudlib statistics
|
|
198
|
+
*
|
|
199
|
+
* This function writes driver and mudlib statistics to the caller's
|
|
200
|
+
* screen. If extra is non-zero, then additional information will be
|
|
201
|
+
* written. This function replaces the hardcoded 'status' and 'status
|
|
202
|
+
* tables' commands in vanilla 3.1.2.
|
|
203
|
+
*
|
|
204
|
+
*/
|
|
205
|
+
void mud_status( int extra );
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* moncontrol() - turns on/off profiling during execution
|
|
209
|
+
*
|
|
210
|
+
* If passed 1, moncontrol() enables profiling. If passed 0, moncontrol()
|
|
211
|
+
* disables profiling. It can be called many times during execution, typ‐
|
|
212
|
+
* ical use is to profile only certain parts of driver execution. moncon‐
|
|
213
|
+
* trol() has no effect if profiling is not enabled at driver compile
|
|
214
|
+
* time.
|
|
215
|
+
*
|
|
216
|
+
*/
|
|
217
|
+
void moncontrol( int on );
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* memory_info - obtain info on object/overall memory usage
|
|
221
|
+
*
|
|
222
|
+
* If optional argument 'ob' is given, memory_info() returns the approxi‐
|
|
223
|
+
* mate amount of memory that 'ob' is using. If no argument is given,
|
|
224
|
+
* memory_info() returns the approximate amount of memory that the entire
|
|
225
|
+
* mud is using. Note that the amount of memory the mud is using does not
|
|
226
|
+
* necessarily correspond to the amount of memory actually allocated by
|
|
227
|
+
* the mud from the system.
|
|
228
|
+
*
|
|
229
|
+
*/
|
|
230
|
+
varargs int memory_info( object ob );
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* malloc_status() - report various statistics related to memory usage.
|
|
234
|
+
*
|
|
235
|
+
* This function writes memory usage statistics to the caller's screen.
|
|
236
|
+
* This function replaces the hardcoded 'malloc' command in vanilla 3.1.2.
|
|
237
|
+
* Note that the output produced by malloc_status() depends upon which
|
|
238
|
+
* memory management package is chosen in options.h when building the
|
|
239
|
+
* driver.
|
|
240
|
+
*
|
|
241
|
+
*/
|
|
242
|
+
void malloc_status( void );
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* get_config() - query various driver config settings
|
|
246
|
+
*
|
|
247
|
+
* This efun is used to query the driver's various config settings.
|
|
248
|
+
* Please refer to the "runtime_config.h" include file for a list of currently
|
|
249
|
+
* recognized options.
|
|
250
|
+
*
|
|
251
|
+
* get_config( __RC_HEARTBEAT_INTERVAL_MSEC__ );
|
|
252
|
+
* get_config( __RC_CALL_OUT_ZERO_NEST_LEVEL__ );
|
|
253
|
+
*
|
|
254
|
+
*/
|
|
255
|
+
string | int get_config( int );
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* dumpallobj() - report various statistics on all objects that have been
|
|
259
|
+
loaded
|
|
260
|
+
*
|
|
261
|
+
* This function dumps a list of statistics on all objects that have been
|
|
262
|
+
* loaded. If no argument is specified, then the information will be
|
|
263
|
+
* dumped to a file named /OBJ_DUMP. If an argument is specified, then
|
|
264
|
+
* that name is used as the filename for the dump.
|
|
265
|
+
*
|
|
266
|
+
*/
|
|
267
|
+
void dumpallobj( string | void );
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* dump_socket_status() - display the status of each LPC socket
|
|
271
|
+
*
|
|
272
|
+
* dump_socket_status() is a diagnostic facility which displays the cur‐
|
|
273
|
+
* rent status of all LPC sockets configured into the MudOS driver. It is
|
|
274
|
+
* useful for debugging LPC sockets applications. Each row in the output
|
|
275
|
+
* corresponds to a single LPC socket. The first row corresponds to LPC
|
|
276
|
+
* socket descriptor 0, the second row, 1, etc. The total number of sock‐
|
|
277
|
+
* ets is configured when the driver is built.
|
|
278
|
+
*
|
|
279
|
+
* The first column "Fd" is the operating system file descriptor associ‐
|
|
280
|
+
* ated with the LPC socket. "State" is the current operational state of
|
|
281
|
+
* the LPC socket. "Mode" is the socket mode, which is passed as an argu‐
|
|
282
|
+
* ment to socket_create(). The local and remote addresses are the Inter‐
|
|
283
|
+
* net address and port numbers in Internet dot notations. '*' indicates
|
|
284
|
+
* an address or which is 0. N.B. LPC sockets that are in the CLOSED
|
|
285
|
+
* state are not currently in use; therefore the data displayed for that
|
|
286
|
+
* socket may be idiosyncratic.
|
|
287
|
+
*
|
|
288
|
+
* The following output was generated on Portals, where the only socket
|
|
289
|
+
* application running at the time was MWHOD. It indicates that two sock‐
|
|
290
|
+
* ets are current in use, one is listening for connection requests on a
|
|
291
|
+
* STREAM mode socket. The other is waiting for incoming data on a DATA‐
|
|
292
|
+
* GRAM mode socket.
|
|
293
|
+
*
|
|
294
|
+
* Fd State Mode Local Address Remote Address
|
|
295
|
+
* -- --------- -------- ----------------- ------------------
|
|
296
|
+
* 13 LISTEN STREAM *.6889 *.*
|
|
297
|
+
* 14 BOUND DATAGRAM *.6888 *.*
|
|
298
|
+
* -1 CLOSED MUD *.* *.*
|
|
299
|
+
*
|
|
300
|
+
*/
|
|
301
|
+
void dump_socket_status( void );
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* dump_prog() - dump/disassemble an LPC object
|
|
305
|
+
*
|
|
306
|
+
* dump_prog() dumps information about the program of 'obj' to a file,
|
|
307
|
+
* 'file', or "/PROG_DUMP" if 'file' is not given. If the current object
|
|
308
|
+
* does not have write access to the file, it fails.
|
|
309
|
+
*
|
|
310
|
+
* Flags can be a combination of the following values: 1 - include a dis‐
|
|
311
|
+
* assembly of the i-code 2 - include line number information
|
|
312
|
+
*
|
|
313
|
+
* @param {object} ob - the object to dump
|
|
314
|
+
* @param {int} flags - the flags to use, defaults to
|
|
315
|
+
* @param {string} file - the file to dump to, defaults to "/PROG_DUMP"
|
|
316
|
+
*/
|
|
317
|
+
varargs void dump_prog(object ob, int flags, string file);
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* dump_file_descriptors() - dump the MudOS process file descriptor table
|
|
321
|
+
*
|
|
322
|
+
* This function is provided to assist in debugging the MudOS driver and
|
|
323
|
+
* helps overcome deficiencies in some UN*X implementations which do not
|
|
324
|
+
* provide equivalent or superior debugging facilities as part of the
|
|
325
|
+
* operating system itself. The interpretation of the output is very sys‐
|
|
326
|
+
* tem-dependent. Each file descriptor is checked to determine whether it
|
|
327
|
+
* refers to an open file. If so, information is displayed from the "stat
|
|
328
|
+
* structure" returned by the fstat() system call.
|
|
329
|
+
*
|
|
330
|
+
* The following output was produced on Lambda Realms running on a Sequent
|
|
331
|
+
* DYNIX/ptx system:
|
|
332
|
+
*
|
|
333
|
+
* Fd Device Number Inode Mode Uid Gid Size
|
|
334
|
+
* -- ------------- ----- ------ ----- ----- ----------
|
|
335
|
+
* 0 3 2 10319 c 666 0 3 0
|
|
336
|
+
* 1 79 7 164598 f 644 2862 1 789522
|
|
337
|
+
* 2 79 7 164598 f 644 2862 1 789522
|
|
338
|
+
* 3 40 33b 6925 c 0 2862 1 0
|
|
339
|
+
* 4 40 2a4 6943 c 0 2862 1 0
|
|
340
|
+
* 5 79 7 164599 f 600 2862 1 44784
|
|
341
|
+
* 6 40 2e2 145996 c 0 2862 1 0
|
|
342
|
+
* 7 79 7 164601 f 644 2862 1 506
|
|
343
|
+
*
|
|
344
|
+
*/
|
|
345
|
+
void dump_file_descriptors( void );
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* debugmalloc() - dumps information on malloc'd memory to a file.
|
|
349
|
+
*
|
|
350
|
+
* This efun is only available when DEBUGMALLOC and DEBUGMALLOC_EXTENSIONS
|
|
351
|
+
* are both defined in options.h at driver build time. The debugmalloc()
|
|
352
|
+
* efun will dump information on those chunks of memory allocated by DMAL‐
|
|
353
|
+
* LOC() and related macros if the mask bitwise and'd (&) with the tag
|
|
354
|
+
* supplied by the macro (i.e. (mask & tag)) is non-zero. Read md.c and
|
|
355
|
+
* config.h in the driver source for more information.
|
|
356
|
+
*
|
|
357
|
+
*/
|
|
358
|
+
void debugmalloc( string filename, int mask );
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* debug_levels
|
|
362
|
+
*
|
|
363
|
+
* Returns a mapping of the current debug levels, where the keys are the
|
|
364
|
+
* names of the debug levels and the values 0 (disabled) or the integer
|
|
365
|
+
* value representing the bitmask value of the debug level.
|
|
366
|
+
*
|
|
367
|
+
* set_debug_level( (1 << 0) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) );
|
|
368
|
+
* printf("%O\n", debug_levels());
|
|
369
|
+
*
|
|
370
|
+
* Result:
|
|
371
|
+
* ([ /* sizeof() == 14 *\/
|
|
372
|
+
* "telnet" : 0,
|
|
373
|
+
* "file" : 0,
|
|
374
|
+
* "LPC_line" : 0,
|
|
375
|
+
* "mapping" : 16,
|
|
376
|
+
* "d_flag" : 4,
|
|
377
|
+
* "add_action" : 0,
|
|
378
|
+
* "event" : 0,
|
|
379
|
+
* "comp_func_tab" : 0,
|
|
380
|
+
* "sockets" : 32,
|
|
381
|
+
* "dns" : 0,
|
|
382
|
+
* "websocket" : 0,
|
|
383
|
+
* "LPC" : 0,
|
|
384
|
+
* "connections" : 8,
|
|
385
|
+
* "call_out" : 1,
|
|
386
|
+
* ])
|
|
387
|
+
*
|
|
388
|
+
*/
|
|
389
|
+
mapping debug_levels();
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* debug_info() - display debug information
|
|
393
|
+
*
|
|
394
|
+
* debug_info() is a general-purpose facility which may be used to debug
|
|
395
|
+
* the MudOS driver. The debugging information requested is determined by
|
|
396
|
+
* the first argument. Successive arguments are determine by the opera‐
|
|
397
|
+
* tion selected.
|
|
398
|
+
*
|
|
399
|
+
* The existing operations (0 and 1) require a second object type argu‐
|
|
400
|
+
* ment, and may be used to display the various fields of the MudOS object
|
|
401
|
+
* structure.
|
|
402
|
+
*
|
|
403
|
+
* The following LPC code was used to generate the sample output:
|
|
404
|
+
*
|
|
405
|
+
* /* di0.c *\/
|
|
406
|
+
* create() {
|
|
407
|
+
* debug_info(0, this_object());
|
|
408
|
+
* }
|
|
409
|
+
*
|
|
410
|
+
* O_HEART_BEAT : FALSE
|
|
411
|
+
* O_IS_WIZARD : FALSE
|
|
412
|
+
* O_ENABLE_COMMANDS : FALSE
|
|
413
|
+
* O_CLONE : FALSE
|
|
414
|
+
* O_DESTRUCTED : FALSE
|
|
415
|
+
* O_SWAPPED : FALSE
|
|
416
|
+
* O_ONCE_INTERACTIVE: FALSE
|
|
417
|
+
* O_RESET_STATE : FALSE
|
|
418
|
+
* O_WILL_CLEAN_UP : FALSE
|
|
419
|
+
* O_WILL_RESET: TRUE
|
|
420
|
+
* total light : 0
|
|
421
|
+
* next_reset : 720300560
|
|
422
|
+
* time_of_ref : 720299416
|
|
423
|
+
* ref : 2
|
|
424
|
+
* swap_num : -1
|
|
425
|
+
* name : 'u/c/cynosure/di0'
|
|
426
|
+
* next_all : OBJ(bin/dev/_update)
|
|
427
|
+
* This object is the head of the object list.
|
|
428
|
+
*
|
|
429
|
+
* /* di1.c *\/
|
|
430
|
+
* create() {
|
|
431
|
+
* debug_info(1, this_object());
|
|
432
|
+
* }
|
|
433
|
+
*
|
|
434
|
+
* program ref's 1
|
|
435
|
+
* Name u/c/cynosure/di1.c
|
|
436
|
+
* program size 10
|
|
437
|
+
* num func's 1 (16)
|
|
438
|
+
* num strings 0
|
|
439
|
+
* num vars 0 (0)
|
|
440
|
+
* num inherits 0 (0)
|
|
441
|
+
* total size 104
|
|
442
|
+
*
|
|
443
|
+
*/
|
|
444
|
+
mixed debug_info( int operation... );
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* cache_stats() - report various driver and mudlib statistics
|
|
448
|
+
*
|
|
449
|
+
* This efun is only available if CACHE_STATS is defined in options.h at
|
|
450
|
+
* driver build time. This efun dumps statistics on the call_other()
|
|
451
|
+
* cache hit rate to the caller's screen.
|
|
452
|
+
*
|
|
453
|
+
*/
|
|
454
|
+
void cache_stats( void );
|
|
455
|
+
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// mappings.h
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* values() - return an array of the values from the (key, value) pairs
|
|
5
|
+
in a mapping
|
|
6
|
+
*
|
|
7
|
+
* values() returns an array of values corresponding to the value elements
|
|
8
|
+
* in the (key, value) pairs stored in the mapping m.
|
|
9
|
+
*
|
|
10
|
+
* For example, if:
|
|
11
|
+
*
|
|
12
|
+
* mapping m;
|
|
13
|
+
*
|
|
14
|
+
* m = (["hp" : 35, "sp" : 42, "mass" : 100]);
|
|
15
|
+
*
|
|
16
|
+
* then
|
|
17
|
+
*
|
|
18
|
+
* values(m) == ({35, 42, 100})
|
|
19
|
+
*
|
|
20
|
+
* Note: the values will be returned in the same order as the correspond‐
|
|
21
|
+
* ing keys.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
mixed *values( mapping m );
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* unique_mapping() - create a mapping from an array based on a function
|
|
28
|
+
*
|
|
29
|
+
* Returns a mapping built in the following manner:
|
|
30
|
+
*
|
|
31
|
+
* 'ob->fun()' or 'f' is evaluated for each member of the array. The mem‐
|
|
32
|
+
* bers for which the function returns the same value are grouped
|
|
33
|
+
* together, and associated with the return value as the key.
|
|
34
|
+
*
|
|
35
|
+
* The key/value ordering in the returned mapping is consistent but not
|
|
36
|
+
* guaranteed to not change in the future.
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
mapping unique_mapping( mixed *arr, string fun, object ob,
|
|
40
|
+
mixed extra... );
|
|
41
|
+
mapping unique_mapping( mixed *arr, function f, mixed extra... );
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* match_path() - search a mapping for a path
|
|
45
|
+
*
|
|
46
|
+
* match_path() searches a mapping for a path. Each key is assumed to be
|
|
47
|
+
* a string. The value is completely arbitrary. The efun finds the
|
|
48
|
+
* largest matching path in the mapping. Keys ended in '/' are assumed to
|
|
49
|
+
* match paths with character that follow the '/', i.e. / is a wildcard
|
|
50
|
+
* for anything below this directory.
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
mixed match_path( mapping m, string str );
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* mapp() - determine whether or not a given variable is a mapping
|
|
57
|
+
*
|
|
58
|
+
* Return 1 if 'arg' is a mapping.
|
|
59
|
+
*
|
|
60
|
+
*/
|
|
61
|
+
int mapp( mixed arg );
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* map_mapping() - modify an mapping of elements via application of a
|
|
65
|
+
function
|
|
66
|
+
*
|
|
67
|
+
* Returns an mapping with the same keys as map whose items have been
|
|
68
|
+
* mapped throught 'ob->fun()' or 'f'. The function is called for each
|
|
69
|
+
* element in 'map' and the return value is put back in that spot in
|
|
70
|
+
* 'map'. 'extra' and following are passed as parameters to the function
|
|
71
|
+
* after the item.
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
mapping map_mapping( mapping map,
|
|
75
|
+
string fun,
|
|
76
|
+
object ob,
|
|
77
|
+
mixed extra... );
|
|
78
|
+
mapping map_mapping( mapping map, function f, mixed extra... );
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* map_delete() - remove a (key, value) pair from a mapping based on the
|
|
82
|
+
key
|
|
83
|
+
*
|
|
84
|
+
* map_delete removes the (key, value) from the mapping m that has key
|
|
85
|
+
* equal to element.
|
|
86
|
+
*
|
|
87
|
+
* For example, given:
|
|
88
|
+
*
|
|
89
|
+
* mapping names;
|
|
90
|
+
*
|
|
91
|
+
* names = ([]);
|
|
92
|
+
* names["truilkan"] = "john";
|
|
93
|
+
* names["wayfarer"] = "erik";
|
|
94
|
+
* names["jacques"] = "dwayne";
|
|
95
|
+
*
|
|
96
|
+
* Then:
|
|
97
|
+
*
|
|
98
|
+
* map_delete(names,"truilkan");
|
|
99
|
+
*
|
|
100
|
+
* causes the mapping 'names' to be equal to:
|
|
101
|
+
*
|
|
102
|
+
* (["wayfarer" : "erik", "jacques" : "dwayne"])
|
|
103
|
+
*
|
|
104
|
+
* keys(names) will not contain "truilkan" after map_delete(names,"tru‐
|
|
105
|
+
* ilkan") is called [unless ("truilkan", *) is subsequently added back to
|
|
106
|
+
* the mapping].
|
|
107
|
+
*
|
|
108
|
+
*/
|
|
109
|
+
void map_delete( mapping m, mixed element );
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* keys() - return an array of the keys from the (key, value) pairs in a
|
|
113
|
+
mapping
|
|
114
|
+
*
|
|
115
|
+
* keys() returns an array of keys (indices) corresponding to the keys in
|
|
116
|
+
* the (key, value) pairs stored in the mapping m.
|
|
117
|
+
*
|
|
118
|
+
* For example, if:
|
|
119
|
+
*
|
|
120
|
+
* mapping m;
|
|
121
|
+
* m = (["hp" : 35, "sp" : 42, "mass" : 100]);
|
|
122
|
+
*
|
|
123
|
+
* then
|
|
124
|
+
*
|
|
125
|
+
* keys(m) == ({"hp", "sp", "mass"})
|
|
126
|
+
*
|
|
127
|
+
* Note: the keys will not be returned in any apparent order. However,
|
|
128
|
+
* they will be returned in the same order as the corresponding values
|
|
129
|
+
* (returned by the values() efun).
|
|
130
|
+
*
|
|
131
|
+
*/
|
|
132
|
+
mixed *keys( mapping m );
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* filter_mapping() - remove some elements of a mapping based on a
|
|
136
|
+
function
|
|
137
|
+
*
|
|
138
|
+
* Returns an mapping with the same keys as map whose items have been
|
|
139
|
+
* mapped throught 'ob->fun()' or 'f'. The function is called for each
|
|
140
|
+
* element in 'arr' and the return value is put back in that spot in
|
|
141
|
+
* 'arr'. 'extra' and following are passed as parameters to the function
|
|
142
|
+
* after the item.
|
|
143
|
+
*
|
|
144
|
+
*/
|
|
145
|
+
mapping filter_mapping( mapping map,
|
|
146
|
+
string fun,
|
|
147
|
+
object ob,
|
|
148
|
+
mixed extra... );
|
|
149
|
+
mapping filter_mapping( mapping map, function f, mixed extra... );
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* allocate_mapping() - pre-allocate space for a mapping
|
|
153
|
+
*
|
|
154
|
+
* Returns a mapping with space for 'size' elements preallocated.
|
|
155
|
+
*
|
|
156
|
+
* For example:
|
|
157
|
+
*
|
|
158
|
+
* mapping x;
|
|
159
|
+
* int y = 200;
|
|
160
|
+
*
|
|
161
|
+
* x = allocate_mapping(y);
|
|
162
|
+
*
|
|
163
|
+
* where y is the initial size of the mapping. Using allocate_mapping is
|
|
164
|
+
* the preferred way to initalize the mapping if you have some idea of how
|
|
165
|
+
* many elements the map will contain (200 in this case). The reason is
|
|
166
|
+
* that allocating storage all at once is slightly more memory efficient.
|
|
167
|
+
* Thus if you are using mappings to store a soul with 200 entries, the
|
|
168
|
+
* above initialization would be quite appropriate. Note, that the above
|
|
169
|
+
* initialization does not restrict you to 200 entries. It just that the
|
|
170
|
+
* first 200 entries will be stored more efficiently. Note: if you will
|
|
171
|
+
* be deleting many elements from the mapping, you should use x = ([]) to
|
|
172
|
+
* initialize the mapping rather than using allocate_mapping().
|
|
173
|
+
*
|
|
174
|
+
* Note: at this point in time, 'size' is meaningless, x = allocate_map‐
|
|
175
|
+
* ping(200); is equivalent to x = ([ ]);
|
|
176
|
+
*
|
|
177
|
+
* allocate_mapping(mixed *keys, mixed v):
|
|
178
|
+
* - if value is an array, the returned array has keys 'keys' and values
|
|
179
|
+
* 'value' (like 3.2.x's mkmapping)
|
|
180
|
+
* - if it is a function, then the mapping has keys 'keys' and values
|
|
181
|
+
* evaluate(value, key)
|
|
182
|
+
* - otherwise, each key has the value 'value'
|
|
183
|
+
*
|
|
184
|
+
* allocate_mapping(0) ;
|
|
185
|
+
* // ([ ])
|
|
186
|
+
*
|
|
187
|
+
* allocate_mapping(25) ;
|
|
188
|
+
* // ([ ])
|
|
189
|
+
*
|
|
190
|
+
* allocate_mapping( ({ 1, 2, 3 }), ({ "one", "two", "three" }) )
|
|
191
|
+
* // ([ 1 : "one", 2 : "two", 3 : "three" ])
|
|
192
|
+
*
|
|
193
|
+
* allocate_mapping( users(), (: $1->query_name() :))
|
|
194
|
+
* // ([
|
|
195
|
+
* // OBJ(karahd /std/user#9) : "Karahd",
|
|
196
|
+
* // OBJ(gesslar /std/user#2) : "Gesslar"
|
|
197
|
+
* // ])
|
|
198
|
+
*
|
|
199
|
+
* allocate_mapping( ({ "apple", "banana", "pear" }), 25)
|
|
200
|
+
* // ([ "pear" : 25, "apple" : 25, "banana" : 25 ])
|
|
201
|
+
*
|
|
202
|
+
*/
|
|
203
|
+
mapping allocate_mapping( int size );
|
|
204
|
+
mapping allocate_mapping(mixed *key, mixed value);
|
|
205
|
+
|